@fileverse-dev/ddoc 1.7.3 → 1.7.4-patch

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.umd.js CHANGED
@@ -470,7 +470,7 @@ img.ProseMirror-separator {
470
470
 
471
471
  If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
472
472
 
473
- For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return V.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},UH="DialogDescriptionWarning",VH=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${$3(UH).contentName}}.`;return V.useEffect(()=>{var i;const s=(i=t.current)==null?void 0:i.getAttribute("aria-describedby");e&&s&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},G3=_3,W3=N3,K3=P3,Tw=I3,Dw=L3,Ow=F3,_w=U3,q3=H3;function HH(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",e.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}const Q3=N.createContext({drawerRef:{current:null},overlayRef:{current:null},scaleBackground:()=>{},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,handleOnly:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},visible:!1,closeDrawer:()=>{},setVisible:()=>{},direction:"bottom"}),H0=()=>{const t=N.useContext(Q3);if(!t)throw new Error("useDrawerContext must be used within a Drawer.Root");return t};HH("[vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1)}[vaul-drawer][vaul-drawer-direction=bottom]{transform:translate3d(0,100%,0)}[vaul-drawer][vaul-drawer-direction=top]{transform:translate3d(0,-100%,0)}[vaul-drawer][vaul-drawer-direction=left]{transform:translate3d(-100%,0,0)}[vaul-drawer][vaul-drawer-direction=right]{transform:translate3d(100%,0,0)}.vaul-dragging .vaul-scrollable [vault-drawer-direction=top]{overflow-y:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=bottom]{overflow-y:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=left]{overflow-x:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=right]{overflow-x:hidden!important}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[vaul-overlay]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[vaul-overlay][vaul-drawer-visible=true]{opacity:1}[vaul-drawer]::after{content:'';position:absolute;background:inherit;background-color:inherit}[vaul-drawer][vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[vaul-drawer][vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[vaul-drawer][vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[vaul-drawer][vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[vaul-handle]{display:block;position:relative;opacity:.8;margin-left:auto;margin-right:auto;height:5px;width:56px;border-radius:1rem;touch-action:pan-y;cursor:grab}[vaul-handle]:active,[vaul-handle]:hover{opacity:1}[vaul-handle]:active{cursor:grabbing}[vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}[vaul-overlay][vaul-snap-points=true]:not([vaul-snap-points-overlay=true]):not([data-state=closed]){opacity:0}[vaul-overlay][vaul-snap-points-overlay=true]:not([vaul-drawer-visible=false]){opacity:1}@media (hover:hover) and (pointer:fine){[vaul-drawer]{user-select:none}}@media (pointer:fine){[vaul-handle-hitarea]:{width:100%;height:100%}}");const zH=typeof window<"u"?N.useLayoutEffect:N.useEffect;function Mw(...t){return(...e)=>{for(let n of t)typeof n=="function"&&n(...e)}}function $H(){return Nw(/^Mac/)}function GH(){return Nw(/^iPhone/)}function WH(){return Nw(/^iPad/)||$H()&&navigator.maxTouchPoints>1}function J3(){return GH()||WH()}function Nw(t){return typeof window<"u"&&window.navigator!=null?t.test(window.navigator.platform):void 0}const Rw=typeof document<"u"&&window.visualViewport;function Y3(t){let e=window.getComputedStyle(t);return/(auto|scroll)/.test(e.overflow+e.overflowX+e.overflowY)}function X3(t){for(Y3(t)&&(t=t.parentElement);t&&!Y3(t);)t=t.parentElement;return t||document.scrollingElement||document.documentElement}const KH=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let z0=0,Pw;function qH(t={}){let{isDisabled:e}=t;zH(()=>{if(!e)return z0++,z0===1&&(J3()?Pw=JH():Pw=QH()),()=>{z0--,z0===0&&Pw()}},[e])}function QH(){return Mw(Z3(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`))}function JH(){let t,e=0,n=f=>{t=X3(f.target),!(t===document.documentElement&&t===document.body)&&(e=f.changedTouches[0].pageY)},r=f=>{if(!t||t===document.documentElement||t===document.body){f.preventDefault();return}let d=f.changedTouches[0].pageY,h=t.scrollTop,p=t.scrollHeight-t.clientHeight;p!==0&&((h<=0&&d>e||h>=p&&d<e)&&f.preventDefault(),e=d)},s=f=>{let d=f.target;Iw(d)&&d!==document.activeElement&&(f.preventDefault(),d.style.transform="translateY(-2000px)",d.focus(),requestAnimationFrame(()=>{d.style.transform=""}))},i=f=>{let d=f.target;Iw(d)&&(d.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{d.style.transform="",Rw&&(Rw.height<window.innerHeight?requestAnimationFrame(()=>{eD(d)}):Rw.addEventListener("resize",()=>eD(d),{once:!0}))}))},o=()=>{window.scrollTo(0,0)},a=window.pageXOffset,l=window.pageYOffset,u=Mw(Z3(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let c=Mw(Rd(document,"touchstart",n,{passive:!1,capture:!0}),Rd(document,"touchmove",r,{passive:!1,capture:!0}),Rd(document,"touchend",s,{passive:!1,capture:!0}),Rd(document,"focus",i,!0),Rd(window,"scroll",o));return()=>{u(),c(),window.scrollTo(a,l)}}function Z3(t,e,n){let r=t.style[e];return t.style[e]=n,()=>{t.style[e]=r}}function Rd(t,e,n,r){return t.addEventListener(e,n,r),()=>{t.removeEventListener(e,n,r)}}function eD(t){let e=document.scrollingElement||document.documentElement;for(;t&&t!==e;){let n=X3(t);if(n!==document.documentElement&&n!==document.body&&n!==t){let r=n.getBoundingClientRect().top,s=t.getBoundingClientRect().top,i=t.getBoundingClientRect().bottom;const o=n.getBoundingClientRect().bottom;i>o&&(n.scrollTop+=s-r)}t=n.parentElement}}function Iw(t){return t instanceof HTMLInputElement&&!KH.has(t.type)||t instanceof HTMLTextAreaElement||t instanceof HTMLElement&&t.isContentEditable}function YH(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function XH(...t){return e=>t.forEach(n=>YH(n,e))}function tD(...t){return V.useCallback(XH(...t),t)}let Pd=null;function ZH({isOpen:t,modal:e,nested:n,hasBeenOpened:r,preventScrollRestoration:s,noBodyStyles:i}){const[o,a]=N.useState(()=>typeof window<"u"?window.location.href:""),l=N.useRef(0),u=N.useCallback(()=>{if(Pd===null&&t&&!i){Pd={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:f,innerHeight:d}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-l.current}px`,left:`${-f}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const h=d-window.innerHeight;h&&l.current>=d&&(document.body.style.top=`${-(l.current+h)}px`)}),300)}},[t]),c=N.useCallback(()=>{if(Pd!==null&&!i){const f=-parseInt(document.body.style.top,10),d=-parseInt(document.body.style.left,10);Object.assign(document.body.style,Pd),window.requestAnimationFrame(()=>{if(s&&o!==window.location.href){a(window.location.href);return}window.scrollTo(d,f)}),Pd=null}},[o]);return N.useEffect(()=>{function f(){l.current=window.scrollY}return f(),window.addEventListener("scroll",f),()=>{window.removeEventListener("scroll",f)}},[]),N.useEffect(()=>{n||!r||(t?(!window.matchMedia("(display-mode: standalone)").matches&&u(),e||window.setTimeout(()=>{c()},500)):c())},[t,r,o,e,n,u,c]),{restorePositionSetting:c}}const nD=new WeakMap;function Dt(t,e,n=!1){if(!t||!(t instanceof HTMLElement))return;let r={};Object.entries(e).forEach(([s,i])=>{if(s.startsWith("--")){t.style.setProperty(s,i);return}r[s]=t.style[s],t.style[s]=i}),!n&&nD.set(t,r)}function $0(t,e){if(!t||!(t instanceof HTMLElement))return;let n=nD.get(t);n&&(e?t.style[e]=n[e]:Object.entries(n).forEach(([r,s])=>{t.style[r]=s}))}const Xt=t=>{switch(t){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return t}};function G0(t,e){if(!t)return null;const n=window.getComputedStyle(t),r=n.transform||n.webkitTransform||n.mozTransform;let s=r.match(/^matrix3d\((.+)\)$/);return s?parseFloat(s[1].split(", ")[Xt(e)?13:12]):(s=r.match(/^matrix\((.+)\)$/),s?parseFloat(s[1].split(", ")[Xt(e)?5:4]):null)}function ez(t){return 8*(Math.log(t+1)-2)}const At={DURATION:.5,EASE:[.32,.72,0,1]},rD=.4;function sD(t){const e=N.useRef(t);return N.useEffect(()=>{e.current=t}),N.useMemo(()=>(...n)=>e.current==null?void 0:e.current.call(e,...n),[])}function tz({defaultProp:t,onChange:e}){const n=N.useState(t),[r]=n,s=N.useRef(r),i=sD(e);return N.useEffect(()=>{s.current!==r&&(i(r),s.current=r)},[r,s,i]),n}function nz({prop:t,defaultProp:e,onChange:n=()=>{}}){const[r,s]=tz({defaultProp:e,onChange:n}),i=t!==void 0,o=i?t:r,a=sD(n),l=N.useCallback(u=>{if(i){const f=typeof u=="function"?u(t):u;f!==t&&a(f)}else s(u)},[i,t,s,a]);return[o,l]}function rz({activeSnapPointProp:t,setActiveSnapPointProp:e,snapPoints:n,drawerRef:r,overlayRef:s,fadeFromIndex:i,onSnapPointChange:o,direction:a="bottom"}){const[l,u]=nz({prop:t,defaultProp:n==null?void 0:n[0],onChange:e}),c=N.useMemo(()=>l===(n==null?void 0:n[n.length-1])||null,[n,l]),f=n&&n.length>0&&(i||i===0)&&!Number.isNaN(i)&&n[i]===l||!n,d=N.useMemo(()=>n==null?void 0:n.findIndex(w=>w===l),[n,l]),h=N.useMemo(()=>{var w;return(w=n==null?void 0:n.map(A=>{const x=typeof window<"u",k=typeof A=="string";let C=0;if(k&&(C=parseInt(A,10)),Xt(a)){const _=k?C:x?A*window.innerHeight:0;return x?a==="bottom"?window.innerHeight-_:-window.innerHeight+_:_}const O=k?C:x?A*window.innerWidth:0;return x?a==="right"?window.innerWidth-O:-window.innerWidth+O:O}))!=null?w:[]},[n]),p=N.useMemo(()=>d!==null?h==null?void 0:h[d]:null,[h,d]),m=N.useCallback(w=>{var A;const x=(A=h==null?void 0:h.findIndex(k=>k===w))!=null?A:null;o(x),Dt(r.current,{transition:`transform ${At.DURATION}s cubic-bezier(${At.EASE.join(",")})`,transform:Xt(a)?`translate3d(0, ${w}px, 0)`:`translate3d(${w}px, 0, 0)`}),h&&x!==h.length-1&&x!==i?Dt(s.current,{transition:`opacity ${At.DURATION}s cubic-bezier(${At.EASE.join(",")})`,opacity:"0"}):Dt(s.current,{transition:`opacity ${At.DURATION}s cubic-bezier(${At.EASE.join(",")})`,opacity:"1"}),u(x!==null?n==null?void 0:n[x]:null)},[r.current,n,h,i,s,u]);N.useEffect(()=>{if(l||t){var w;const A=(w=n==null?void 0:n.findIndex(x=>x===t||x===l))!=null?w:-1;h&&A!==-1&&typeof h[A]=="number"&&m(h[A])}},[l,t,n,h,m]);function g({draggedDistance:w,closeDrawer:A,velocity:x,dismissible:k}){if(i===void 0)return;const C=a==="bottom"||a==="right"?(p??0)-w:(p??0)+w,O=d===i-1,_=d===0,D=w>0;if(O&&Dt(s.current,{transition:`opacity ${At.DURATION}s cubic-bezier(${At.EASE.join(",")})`}),x>2&&!D){k?A():m(h[0]);return}if(x>2&&D&&h&&n){m(h[n.length-1]);return}const R=h==null?void 0:h.reduce((F,G)=>typeof F!="number"||typeof G!="number"?F:Math.abs(G-C)<Math.abs(F-C)?G:F),L=Xt(a)?window.innerHeight:window.innerWidth;if(x>rD&&Math.abs(w)<L*.4){const F=D?1:-1;if(F>0&&c){m(h[n.length-1]);return}if(_&&F<0&&k&&A(),d===null)return;m(h[d+F]);return}m(R)}function y({draggedDistance:w}){if(p===null)return;const A=a==="bottom"||a==="right"?p-w:p+w;(a==="bottom"||a==="right")&&A<h[h.length-1]||(a==="top"||a==="left")&&A>h[h.length-1]||Dt(r.current,{transform:Xt(a)?`translate3d(0, ${A}px, 0)`:`translate3d(${A}px, 0, 0)`})}function v(w,A){if(!n||typeof d!="number"||!h||i===void 0)return null;const x=d===i-1;if(d>=i&&A)return 0;if(x&&!A)return 1;if(!f&&!x)return null;const C=x?d+1:d-1,O=x?h[C]-h[C-1]:h[C+1]-h[C],_=w/Math.abs(O);return x?1-_:_}return{isLastSnapPoint:c,activeSnapPoint:l,shouldFade:f,getPercentageDragged:v,setActiveSnapPoint:u,activeSnapPointIndex:d,onRelease:g,onDrag:y,snapPointsOffset:h}}const sz=.25,iz=100,iD=8,nl=16,oD=26,Lw="vaul-dragging";function aD({open:t,onOpenChange:e,children:n,shouldScaleBackground:r,onDrag:s,onRelease:i,snapPoints:o,nested:a=!1,setBackgroundColorOnScale:l=!0,closeThreshold:u=sz,scrollLockTimeout:c=iz,dismissible:f=!0,handleOnly:d=!1,fadeFromIndex:h=o&&o.length-1,activeSnapPoint:p,setActiveSnapPoint:m,fixed:g,modal:y=!0,onClose:v,noBodyStyles:w,direction:A="bottom",preventScrollRestoration:x=!0,disablePreventScroll:k=!1}){var C;const[O=!1,_]=N.useState(!1),[D,R]=N.useState(!1),[L,F]=N.useState(!1),[G,B]=N.useState(!1),[H,Q]=N.useState(!1),[te,Z]=N.useState(!1),pe=N.useRef(null),Ee=N.useRef(null),Re=N.useRef(null),Ce=N.useRef(null),ke=N.useRef(null),He=N.useRef(!1),Ue=N.useRef(null),ze=N.useRef(0),Le=N.useRef(!1),tt=N.useRef(0),le=N.useRef(null),$e=N.useRef(((C=le.current)==null?void 0:C.getBoundingClientRect().height)||0),ae=N.useRef(0),be=N.useCallback(ne=>{o&&ne===ue.length-1&&(Ee.current=new Date)},[]),{activeSnapPoint:Be,activeSnapPointIndex:z,setActiveSnapPoint:q,onRelease:re,snapPointsOffset:ue,onDrag:P,shouldFade:b,getPercentageDragged:E}=rz({snapPoints:o,activeSnapPointProp:p,setActiveSnapPointProp:m,drawerRef:le,fadeFromIndex:h,overlayRef:pe,onSnapPointChange:be,direction:A});qH({isDisabled:!O||H||!y||te||!D||k});const{restorePositionSetting:M}=ZH({isOpen:O,modal:y,nested:a,hasBeenOpened:D,preventScrollRestoration:x,noBodyStyles:w});function j(){return(window.innerWidth-oD)/window.innerWidth}function K(ne){var ie;!f&&!o||le.current&&!le.current.contains(ne.target)||($e.current=((ie=le.current)==null?void 0:ie.getBoundingClientRect().height)||0,Q(!0),Re.current=new Date,J3()&&window.addEventListener("touchend",()=>He.current=!1,{once:!0}),ne.target.setPointerCapture(ne.pointerId),ze.current=Xt(A)?ne.clientY:ne.clientX)}function Y(ne,ie){var Te;let me=ne;const qe=(Te=window.getSelection())==null?void 0:Te.toString(),nt=le.current?G0(le.current,A):null,yt=new Date;if(me.hasAttribute("data-vaul-no-drag")||me.closest("[data-vaul-no-drag]"))return!1;if(A==="right"||A==="left")return!0;if(Ee.current&&yt.getTime()-Ee.current.getTime()<500)return!1;if(nt!==null&&(A==="bottom"?nt>0:nt<0))return!0;if(qe&&qe.length>0)return!1;if(ke.current&&yt.getTime()-ke.current.getTime()<c&&nt===0||ie)return ke.current=yt,!1;for(;me;){if(me.scrollHeight>me.clientHeight){if(me.scrollTop!==0)return ke.current=new Date,!1;if(me.getAttribute("role")==="dialog")return!0}me=me.parentNode}return!0}function ye(ne){if(le.current&&H){const ie=A==="bottom"||A==="right"?1:-1,Te=(ze.current-(Xt(A)?ne.clientY:ne.clientX))*ie,me=Te>0,qe=o&&!f&&!me;if(qe&&z===0)return;const nt=Math.abs(Te),yt=document.querySelector("[vaul-drawer-wrapper]");let sn=nt/$e.current;const Ft=E(nt,me);if(Ft!==null&&(sn=Ft),qe&&sn>=1||!He.current&&!Y(ne.target,me))return;if(le.current.classList.add(Lw),He.current=!0,Dt(le.current,{transition:"none"}),Dt(pe.current,{transition:"none"}),o&&P({draggedDistance:Te}),me&&!o){const wr=ez(Te),Ar=Math.min(wr*-1,0)*ie;Dt(le.current,{transform:Xt(A)?`translate3d(0, ${Ar}px, 0)`:`translate3d(${Ar}px, 0, 0)`});return}const Is=1-sn;if((b||h&&z===h-1)&&(s==null||s(ne,sn),Dt(pe.current,{opacity:`${Is}`,transition:"none"},!0)),yt&&pe.current&&r){const wr=Math.min(j()+sn*(1-j()),1),Ar=8-sn*8,Wf=Math.max(0,14-sn*14);Dt(yt,{borderRadius:`${Ar}px`,transform:Xt(A)?`scale(${wr}) translate3d(0, ${Wf}px, 0)`:`scale(${wr}) translate3d(${Wf}px, 0, 0)`,transition:"none"},!0)}if(!o){const wr=nt*ie;Dt(le.current,{transform:Xt(A)?`translate3d(0, ${wr}px, 0)`:`translate3d(${wr}px, 0, 0)`})}}}N.useEffect(()=>()=>{ft(!1),M()},[]),N.useEffect(()=>{var ne;function ie(){if(!le.current)return;const Te=document.activeElement;if(Iw(Te)||Le.current){var me;const qe=((me=window.visualViewport)==null?void 0:me.height)||0;let nt=window.innerHeight-qe;const yt=le.current.getBoundingClientRect().height||0;ae.current||(ae.current=yt);const sn=le.current.getBoundingClientRect().top;if(Math.abs(tt.current-nt)>60&&(Le.current=!Le.current),o&&o.length>0&&ue&&z){const Ft=ue[z]||0;nt+=Ft}if(tt.current=nt,yt>qe||Le.current){const Ft=le.current.getBoundingClientRect().height;let Is=Ft;Ft>qe&&(Is=qe-oD),g?le.current.style.height=`${Ft-Math.max(nt,0)}px`:le.current.style.height=`${Math.max(Is,qe-sn)}px`}else le.current.style.height=`${ae.current}px`;o&&o.length>0&&!Le.current?le.current.style.bottom="0px":le.current.style.bottom=`${Math.max(nt,0)}px`}}return(ne=window.visualViewport)==null||ne.addEventListener("resize",ie),()=>{var Te;return(Te=window.visualViewport)==null?void 0:Te.removeEventListener("resize",ie)}},[z,o,ue]);function Se(){le.current&&(Ve(),v==null||v(),Dt(le.current,{transform:Xt(A)?`translate3d(0, ${A==="bottom"?"100%":"-100%"}, 0)`:`translate3d(${A==="right"?"100%":"-100%"}, 0, 0)`,transition:`transform ${At.DURATION}s cubic-bezier(${At.EASE.join(",")})`}),Dt(pe.current,{opacity:"0",transition:`opacity ${At.DURATION}s cubic-bezier(${At.EASE.join(",")})`}),ft(!1),setTimeout(()=>{F(!1),_(!1)},300),setTimeout(()=>{o&&q(o[0])},At.DURATION*1e3))}N.useEffect(()=>{if(!O&&r){const ne=setTimeout(()=>{$0(document.body)},200);return()=>clearTimeout(ne)}},[O,r]),N.useLayoutEffect(()=>{t?(_(!0),R(!0)):Se()},[t]),N.useEffect(()=>{G&&(e==null||e(O))},[O]),N.useEffect(()=>{B(!0)},[]);function Je(){if(!le.current)return;const ne=document.querySelector("[vaul-drawer-wrapper]"),ie=G0(le.current,A);Dt(le.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${At.DURATION}s cubic-bezier(${At.EASE.join(",")})`}),Dt(pe.current,{transition:`opacity ${At.DURATION}s cubic-bezier(${At.EASE.join(",")})`,opacity:"1"}),r&&ie&&ie>0&&O&&Dt(ne,{borderRadius:`${iD}px`,overflow:"hidden",...Xt(A)?{transform:`scale(${j()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${j()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${At.DURATION}s`,transitionTimingFunction:`cubic-bezier(${At.EASE.join(",")})`},!0)}function Ve(){!H||!le.current||(le.current.classList.remove(Lw),He.current=!1,Q(!1),Ce.current=new Date)}function Fe(ne){if(!H||!le.current)return;le.current.classList.remove(Lw),He.current=!1,Q(!1),Ce.current=new Date;const ie=G0(le.current,A);if(!Y(ne.target,!1)||!ie||Number.isNaN(ie)||Re.current===null)return;const Te=Ce.current.getTime()-Re.current.getTime(),me=ze.current-(Xt(A)?ne.clientY:ne.clientX),qe=Math.abs(me)/Te;if(qe>.05&&(Z(!0),setTimeout(()=>{Z(!1)},200)),o){re({draggedDistance:me*(A==="bottom"||A==="right"?1:-1),closeDrawer:Se,velocity:qe,dismissible:f}),i==null||i(ne,!0);return}if(A==="bottom"||A==="right"?me>0:me<0){Je(),i==null||i(ne,!0);return}if(qe>rD){Se(),i==null||i(ne,!1);return}var nt;const yt=Math.min((nt=le.current.getBoundingClientRect().height)!=null?nt:0,window.innerHeight);if(ie>=yt*u){Se(),i==null||i(ne,!1);return}i==null||i(ne,!0),Je()}N.useEffect(()=>{O&&(Dt(document.documentElement,{scrollBehavior:"auto"}),Ee.current=new Date,ft(!0))},[O]),N.useEffect(()=>{if(le.current&&L){var ne;const ie=le==null||(ne=le.current)==null?void 0:ne.querySelectorAll("*");ie==null||ie.forEach(Te=>{const me=Te;(me.scrollHeight>me.clientHeight||me.scrollWidth>me.clientWidth)&&me.classList.add("vaul-scrollable")})}},[L]);function ft(ne){const ie=document.querySelector("[vaul-drawer-wrapper]");!ie||!r||(ne?(l&&(w||(Dt(document.body,{background:document.body.style.backgroundColor||document.body.style.background}),Dt(document.body,{background:"black"},!0))),Dt(ie,{borderRadius:`${iD}px`,overflow:"hidden",...Xt(A)?{transform:`scale(${j()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${j()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${At.DURATION}s`,transitionTimingFunction:`cubic-bezier(${At.EASE.join(",")})`})):($0(ie,"overflow"),$0(ie,"transform"),$0(ie,"borderRadius"),Dt(ie,{transitionProperty:"transform, border-radius",transitionDuration:`${At.DURATION}s`,transitionTimingFunction:`cubic-bezier(${At.EASE.join(",")})`})))}function Xn(ne){const ie=ne?(window.innerWidth-nl)/window.innerWidth:1,Te=ne?-nl:0;Ue.current&&window.clearTimeout(Ue.current),Dt(le.current,{transition:`transform ${At.DURATION}s cubic-bezier(${At.EASE.join(",")})`,transform:`scale(${ie}) translate3d(0, ${Te}px, 0)`}),!ne&&le.current&&(Ue.current=setTimeout(()=>{const me=G0(le.current,A);Dt(le.current,{transition:"none",transform:Xt(A)?`translate3d(0, ${me}px, 0)`:`translate3d(${me}px, 0, 0)`})},500))}function br(ne,ie){if(ie<0)return;const Te=Xt(A)?window.innerHeight:window.innerWidth,me=(Te-nl)/Te,qe=me+ie*(1-me),nt=-nl+ie*nl;Dt(le.current,{transform:Xt(A)?`scale(${qe}) translate3d(0, ${nt}px, 0)`:`scale(${qe}) translate3d(${nt}px, 0, 0)`,transition:"none"})}function X(ne,ie){const Te=Xt(A)?window.innerHeight:window.innerWidth,me=ie?(Te-nl)/Te:1,qe=ie?-nl:0;ie&&Dt(le.current,{transition:`transform ${At.DURATION}s cubic-bezier(${At.EASE.join(",")})`,transform:Xt(A)?`scale(${me}) translate3d(0, ${qe}px, 0)`:`scale(${me}) translate3d(${qe}px, 0, 0)`})}return N.createElement(G3,{modal:y,onOpenChange:ne=>{if(t!==void 0){e==null||e(ne);return}ne?(R(!0),_(ne)):Se()},open:O},N.createElement(Q3.Provider,{value:{visible:L,activeSnapPoint:Be,snapPoints:o,setActiveSnapPoint:q,drawerRef:le,overlayRef:pe,scaleBackground:ft,onOpenChange:e,onPress:K,setVisible:F,onRelease:Fe,onDrag:ye,dismissible:f,handleOnly:d,isOpen:O,isDragging:H,shouldFade:b,closeDrawer:Se,onNestedDrag:br,onNestedOpenChange:Xn,onNestedRelease:X,keyboardIsOpen:Le,openProp:t,modal:y,snapPointsOffset:ue,direction:A}},n))}const oz=250,az=120,lD=N.forwardRef(function({preventCycle:t=!1,children:e,...n},r){const{visible:s,closeDrawer:i,isDragging:o,snapPoints:a,activeSnapPoint:l,setActiveSnapPoint:u,dismissible:c,handleOnly:f,onPress:d,onDrag:h}=H0(),p=N.useRef(null),m=N.useRef(!1);function g(){if(m.current){w();return}window.setTimeout(()=>{y()},az)}function y(){if(o||t||m.current){w();return}if(w(),(!a||a.length===0)&&c){i();return}if(l===a[a.length-1]&&c){i();return}const x=a.findIndex(C=>C===l);if(x===-1)return;const k=a[x+1];u(k)}function v(){p.current=window.setTimeout(()=>{m.current=!0},oz)}function w(){window.clearTimeout(p.current),m.current=!1}return N.createElement("div",{onClick:g,onDoubleClick:()=>{m.current=!0,i()},onPointerCancel:w,onPointerDown:A=>{f&&d(A),v()},onPointerMove:A=>{f&&h(A)},ref:r,"vaul-drawer-visible":s?"true":"false","vaul-handle":"","aria-hidden":"true",...n},N.createElement("span",{"vaul-handle-hitarea":"","aria-hidden":"true"},e))});lD.displayName="Drawer.Handle";const uD=N.forwardRef(function({children:t,...e},n){const{overlayRef:r,snapPoints:s,onRelease:i,shouldFade:o,isOpen:a,visible:l}=H0(),u=tD(n,r),c=s&&s.length>0;return N.createElement(Tw,{onMouseUp:i,ref:u,"vaul-drawer-visible":l?"true":"false","vaul-overlay":"","vaul-snap-points":a&&c?"true":"false","vaul-snap-points-overlay":a&&o?"true":"false",...e})});uD.displayName="Drawer.Overlay";const cD=N.forwardRef(function({onOpenAutoFocus:t,onPointerDownOutside:e,onAnimationEnd:n,style:r,...s},i){const{drawerRef:o,onPress:a,onRelease:l,onDrag:u,dismissible:c,keyboardIsOpen:f,snapPointsOffset:d,visible:h,closeDrawer:p,modal:m,openProp:g,onOpenChange:y,setVisible:v,handleOnly:w,direction:A}=H0(),x=tD(i,o),k=N.useRef(null),C=N.useRef(!1),O=(_,D,R=0)=>{if(C.current)return!0;const L=Math.abs(_.y),F=Math.abs(_.x),G=F>L,B=["bottom","right"].includes(D)?1:-1;if(D==="left"||D==="right"){if(!(_.x*B<0)&&F>=0&&F<=R)return G}else if(!(_.y*B<0)&&L>=0&&L<=R)return!G;return C.current=!0,!0};return N.useEffect(()=>{v(!0)},[]),N.createElement(Dw,{"vaul-drawer":"","vaul-drawer-direction":A,"vaul-drawer-visible":h?"true":"false",...s,ref:x,style:d&&d.length>0?{"--snap-point-height":`${d[0]}px`,...r}:r,onOpenAutoFocus:_=>{if(t)t(_);else{var D;_.preventDefault(),(D=o.current)==null||D.focus()}},onPointerDown:_=>{w||(s.onPointerDown==null||s.onPointerDown.call(s,_),k.current={x:_.clientX,y:_.clientY},a(_))},onPointerDownOutside:_=>{if(e==null||e(_),!m||_.defaultPrevented){_.preventDefault();return}f.current&&(f.current=!1),_.preventDefault(),y==null||y(!1),!(!c||g!==void 0)&&p()},onFocusOutside:_=>{if(!m){_.preventDefault();return}},onEscapeKeyDown:_=>{if(!m){_.preventDefault();return}},onPointerMove:_=>{if(w||(s.onPointerMove==null||s.onPointerMove.call(s,_),!k.current))return;const D=_.clientY-k.current.y,R=_.clientX-k.current.x,L=_.pointerType==="touch"?10:2;O({x:R,y:D},A,L)?u(_):(Math.abs(R)>L||Math.abs(D)>L)&&(k.current=null)},onPointerUp:_=>{s.onPointerUp==null||s.onPointerUp.call(s,_),k.current=null,C.current=!1,l(_)}})});cD.displayName="Drawer.Content";function lz({onDrag:t,onOpenChange:e,...n}){const{onNestedDrag:r,onNestedOpenChange:s,onNestedRelease:i}=H0();if(!r)throw new Error("Drawer.NestedRoot must be placed in another drawer");return N.createElement(aD,{nested:!0,onClose:()=>{s(!1)},onDrag:(o,a)=>{r(o,a),t==null||t(o,a)},onOpenChange:o=>{o&&s(o),e==null||e(o)},onRelease:i,...n})}const ps={Root:aD,NestedRoot:lz,Content:cD,Handle:lD,Overlay:uD,Trigger:W3,Portal:K3,Close:q3,Title:Ow,Description:_w},fD=({shouldScaleBackground:t=!0,...e})=>S.jsx(ps.Root,{shouldScaleBackground:t,...e});fD.displayName="Drawer";const dD=ps.Trigger,uz=ps.Portal,hD=N.forwardRef(({className:t,...e},n)=>S.jsx(ps.Overlay,{ref:n,className:he("fixed inset-0 z-50 bg-black/5 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));hD.displayName=ps.Overlay.displayName;const pD=N.forwardRef(({className:t,children:e,...n},r)=>S.jsxs(uz,{children:[S.jsx(hD,{}),S.jsx(Vu,{trapped:!1,children:S.jsxs(ps.Content,{ref:r,className:he("fixed inset-x-0 bottom-0 z-50 flex h-auto flex-col rounded-t-[16px] drop-shadow-2xl bg-white",t),...n,children:[S.jsx("div",{className:"mx-auto mt-4 h-2 w-[100px] rounded-full bg-white"}),e,S.jsx(ps.Close,{className:"absolute right-2 top-4 hover:bg-gray-200 rounded-full p-2 ring-offset-white transition focus:outline-none focus:ring-2 focus:ring-blue-700 focus:ring-offset-2 disabled:pointer-events-none text-black data-[state=open]:bg-gray-100 data-[state=open]:text-black",children:S.jsx(cV,{size:20,fill:"black"})})]})})]}));pD.displayName="DrawerContent";const mD=({className:t,...e})=>S.jsx("div",{className:he("grid gap-1.5 p-4 text-center sm:text-left",t),...e});mD.displayName="DrawerHeader";const gD=N.forwardRef(({className:t,...e},n)=>S.jsx(ps.Title,{ref:n,className:he("text-lg font-semibold leading-none tracking-tight",t),...e}));gD.displayName=ps.Title.displayName;const cz=N.forwardRef(({className:t,...e},n)=>S.jsx(ps.Description,{ref:n,className:he("text-sm text-black",t),...e}));cz.displayName=ps.Description.displayName;const fz=({title:t,content:e,contentClassName:n})=>S.jsxs(pD,{className:"w-full z-20",children:[S.jsx(mD,{className:"px-4 pt-0",children:S.jsx(gD,{className:"text-left sm:text-center text-base",children:t})}),S.jsx("div",{className:he("flex flex-col gap-4 w-full h-full pb-4 text-base text-black",n),children:e&&e})]}),dz=G3,hz=W3,pz=K3,mz=q3,yD=V.forwardRef(({className:t,...e},n)=>S.jsx(Tw,{ref:n,className:he("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));yD.displayName=Tw.displayName;const bD=V.forwardRef(({className:t,children:e,...n},r)=>S.jsxs(pz,{children:[S.jsx(yD,{}),S.jsx(Vu,{trapped:!1,children:S.jsxs(Dw,{ref:r,className:he("fixed left-[50%] top-[50%] z-50 grid translate-x-[-50%] translate-y-[-50%] gap-4 bg-white duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-xl",t),...n,children:[S.jsx("div",{}),e]})})]}));bD.displayName=Dw.displayName;const wD=({className:t,...e})=>S.jsx("div",{className:he("grid gap-1.5 p-4 text-center sm:text-left",t),...e});wD.displayName="DialogHeader";const AD=({className:t,...e})=>S.jsx("div",{className:he("flex space-x-2",t),...e});AD.displayName="DialogFooter";const vD=V.forwardRef(({className:t,...e},n)=>S.jsx(Ow,{ref:n,className:he("text-lg font-semibold leading-none tracking-tight",t),...e}));vD.displayName=Ow.displayName;const gz=V.forwardRef(({className:t,...e},n)=>S.jsx(_w,{ref:n,className:he("text-sm text-black",t),...e}));gz.displayName=_w.displayName;function yz(t){return Object.prototype.toString.call(t)==="[object Object]"}function xD(t){return yz(t)||Array.isArray(t)}function bz(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function Bw(t,e){const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;const s=JSON.stringify(Object.keys(t.breakpoints||{})),i=JSON.stringify(Object.keys(e.breakpoints||{}));return s!==i?!1:n.every(o=>{const a=t[o],l=e[o];return typeof a=="function"?`${a}`==`${l}`:!xD(a)||!xD(l)?a===l:Bw(a,l)})}function kD(t){return t.concat().sort((e,n)=>e.name>n.name?1:-1).map(e=>e.options)}function wz(t,e){if(t.length!==e.length)return!1;const n=kD(t),r=kD(e);return n.every((s,i)=>{const o=r[i];return Bw(s,o)})}function Fw(t){return typeof t=="number"}function jw(t){return typeof t=="string"}function Uw(t){return typeof t=="boolean"}function ED(t){return Object.prototype.toString.call(t)==="[object Object]"}function Mt(t){return Math.abs(t)}function Vw(t){return Math.sign(t)}function Id(t,e){return Mt(t-e)}function Az(t,e){if(t===0||e===0||Mt(t)<=Mt(e))return 0;const n=Id(Mt(t),Mt(e));return Mt(n/t)}function Ld(t){return Fd(t).map(Number)}function ms(t){return t[Bd(t)]}function Bd(t){return Math.max(0,t.length-1)}function Hw(t,e){return e===Bd(t)}function CD(t,e=0){return Array.from(Array(t),(n,r)=>e+r)}function Fd(t){return Object.keys(t)}function SD(t,e){return[t,e].reduce((n,r)=>(Fd(r).forEach(s=>{const i=n[s],o=r[s],a=ED(i)&&ED(o);n[s]=a?SD(i,o):o}),n),{})}function zw(t,e){return typeof e.MouseEvent<"u"&&t instanceof e.MouseEvent}function vz(t,e){const n={start:r,center:s,end:i};function r(){return 0}function s(l){return i(l)/2}function i(l){return e-l}function o(l,u){return jw(t)?n[t](l):t(e,l,u)}return{measure:o}}function jd(){let t=[];function e(s,i,o,a={passive:!0}){let l;if("addEventListener"in s)s.addEventListener(i,o,a),l=()=>s.removeEventListener(i,o,a);else{const u=s;u.addListener(o),l=()=>u.removeListener(o)}return t.push(l),r}function n(){t=t.filter(s=>s())}const r={add:e,clear:n};return r}function xz(t,e,n,r){const s=jd(),i=1e3/60;let o=null,a=0,l=0;function u(){s.add(t,"visibilitychange",()=>{t.hidden&&p()})}function c(){h(),s.clear()}function f(g){if(!l)return;o||(o=g);const y=g-o;for(o=g,a+=y;a>=i;)n(),a-=i;const v=Mt(a/i);r(v),l&&e.requestAnimationFrame(f)}function d(){l||(l=e.requestAnimationFrame(f))}function h(){e.cancelAnimationFrame(l),o=null,a=0,l=0}function p(){o=null,a=0}return{init:u,destroy:c,start:d,stop:h,update:n,render:r}}function kz(t,e){const n=e==="rtl",r=t==="y",s=r?"y":"x",i=r?"x":"y",o=!r&&n?-1:1,a=c(),l=f();function u(p){const{height:m,width:g}=p;return r?m:g}function c(){return r?"top":n?"right":"left"}function f(){return r?"bottom":n?"left":"right"}function d(p){return p*o}return{scroll:s,cross:i,startEdge:a,endEdge:l,measureSize:u,direction:d}}function rl(t=0,e=0){const n=Mt(t-e);function r(u){return u<t}function s(u){return u>e}function i(u){return r(u)||s(u)}function o(u){return i(u)?r(u)?t:e:u}function a(u){return n?u-n*Math.ceil((u-e)/n):u}return{length:n,max:e,min:t,constrain:o,reachedAny:i,reachedMax:s,reachedMin:r,removeOffset:a}}function TD(t,e,n){const{constrain:r}=rl(0,t),s=t+1;let i=o(e);function o(d){return n?Mt((s+d)%s):r(d)}function a(){return i}function l(d){return i=o(d),f}function u(d){return c().set(a()+d)}function c(){return TD(t,a(),n)}const f={get:a,set:l,add:u,clone:c};return f}function Ez(t,e,n,r,s,i,o,a,l,u,c,f,d,h,p,m,g,y,v){const{cross:w,direction:A}=t,x=["INPUT","SELECT","TEXTAREA"],k={passive:!1},C=jd(),O=jd(),_=rl(50,225).constrain(h.measure(20)),D={mouse:300,touch:400},R={mouse:500,touch:600},L=p?43:25;let F=!1,G=0,B=0,H=!1,Q=!1,te=!1,Z=!1;function pe(ae){if(!v)return;function be(z){(Uw(v)||v(ae,z))&&Ue(z)}const Be=e;C.add(Be,"dragstart",z=>z.preventDefault(),k).add(Be,"touchmove",()=>{},k).add(Be,"touchend",()=>{}).add(Be,"touchstart",be).add(Be,"mousedown",be).add(Be,"touchcancel",Le).add(Be,"contextmenu",Le).add(Be,"click",tt,!0)}function Ee(){C.clear(),O.clear()}function Re(){const ae=Z?n:e;O.add(ae,"touchmove",ze,k).add(ae,"touchend",Le).add(ae,"mousemove",ze,k).add(ae,"mouseup",Le)}function Ce(ae){const be=ae.nodeName||"";return x.includes(be)}function ke(){return(p?R:D)[Z?"mouse":"touch"]}function He(ae,be){const Be=f.add(Vw(ae)*-1),z=c.byDistance(ae,!p).distance;return p||Mt(ae)<_?z:g&&be?z*.5:c.byIndex(Be.get(),0).distance}function Ue(ae){const be=zw(ae,r);Z=be,te=p&&be&&!ae.buttons&&F,F=Id(s.get(),o.get())>=2,!(be&&ae.button!==0)&&(Ce(ae.target)||(H=!0,i.pointerDown(ae),u.useFriction(0).useDuration(0),s.set(o),Re(),G=i.readPoint(ae),B=i.readPoint(ae,w),d.emit("pointerDown")))}function ze(ae){if(!zw(ae,r)&&ae.touches.length>=2)return Le(ae);const Be=i.readPoint(ae),z=i.readPoint(ae,w),q=Id(Be,G),re=Id(z,B);if(!Q&&!Z&&(!ae.cancelable||(Q=q>re,!Q)))return Le(ae);const ue=i.pointerMove(ae);q>m&&(te=!0),u.useFriction(.3).useDuration(.75),a.start(),s.add(A(ue)),ae.preventDefault()}function Le(ae){const Be=c.byDistance(0,!1).index!==f.get(),z=i.pointerUp(ae)*ke(),q=He(A(z),Be),re=Az(z,q),ue=L-10*re,P=y+re/50;Q=!1,H=!1,O.clear(),u.useDuration(ue).useFriction(P),l.distance(q,!p),Z=!1,d.emit("pointerUp")}function tt(ae){te&&(ae.stopPropagation(),ae.preventDefault(),te=!1)}function le(){return H}return{init:pe,destroy:Ee,pointerDown:le}}function Cz(t,e){let r,s;function i(f){return f.timeStamp}function o(f,d){const p=`client${(d||t.scroll)==="x"?"X":"Y"}`;return(zw(f,e)?f:f.touches[0])[p]}function a(f){return r=f,s=f,o(f)}function l(f){const d=o(f)-o(s),h=i(f)-i(r)>170;return s=f,h&&(r=f),d}function u(f){if(!r||!s)return 0;const d=o(s)-o(r),h=i(f)-i(r),p=i(f)-i(s)>170,m=d/h;return h&&!p&&Mt(m)>.1?m:0}return{pointerDown:a,pointerMove:l,pointerUp:u,readPoint:o}}function Sz(){function t(n){const{offsetTop:r,offsetLeft:s,offsetWidth:i,offsetHeight:o}=n;return{top:r,right:s+i,bottom:r+o,left:s,width:i,height:o}}return{measure:t}}function Tz(t){function e(r){return t*(r/100)}return{measure:e}}function Dz(t,e,n,r,s,i,o){let a,l,u=[],c=!1;function f(m){return s.measureSize(o.measure(m))}function d(m){if(!i)return;l=f(t),u=r.map(f);function g(v){for(const w of v){const A=w.target===t,x=r.indexOf(w.target),k=A?l:u[x],C=f(A?t:r[x]);if(Mt(C-k)>=.5){n.requestAnimationFrame(()=>{m.reInit(),e.emit("resize")});break}}}a=new ResizeObserver(v=>{c||(Uw(i)||i(m,v))&&g(v)}),[t].concat(r).forEach(v=>a.observe(v))}function h(){a&&a.disconnect(),c=!0}return{init:d,destroy:h}}function Oz(t,e,n,r,s){let i=0,o=0,a=r,l=s,u=t.get(),c=0;function f(){const x=n.get()-t.get(),k=!a;let C=0;return k?(i=0,t.set(n),C=x):(i+=x/a,i*=l,u+=i,t.add(i),C=u-c),o=Vw(C),c=u,A}function d(){const x=n.get()-e.get();return Mt(x)<.001}function h(){return a}function p(){return o}function m(){return i}function g(){return v(r)}function y(){return w(s)}function v(x){return a=x,A}function w(x){return l=x,A}const A={direction:p,duration:h,velocity:m,seek:f,settled:d,useBaseFriction:y,useBaseDuration:g,useFriction:w,useDuration:v};return A}function _z(t,e,n,r,s){const i=s.measure(10),o=s.measure(50),a=rl(.1,.99);let l=!1;function u(){return!(l||!t.reachedAny(n.get())||!t.reachedAny(e.get()))}function c(h){if(!u())return;const p=t.reachedMin(e.get())?"min":"max",m=Mt(t[p]-e.get()),g=n.get()-e.get(),y=a.constrain(m/o);n.subtract(g*y),!h&&Mt(g)<i&&(n.set(t.constrain(n.get())),r.useDuration(25).useBaseFriction())}function f(h){l=!h}return{shouldConstrain:u,constrain:c,toggleActive:f}}function Mz(t,e,n,r,s){const i=rl(-e+t,0),o=f(),a=c(),l=d();function u(p,m){return Id(p,m)<1}function c(){const p=o[0],m=ms(o),g=o.lastIndexOf(p),y=o.indexOf(m)+1;return rl(g,y)}function f(){return n.map((p,m)=>{const{min:g,max:y}=i,v=i.constrain(p),w=!m,A=Hw(n,m);return w?y:A||u(g,v)?g:u(y,v)?y:v}).map(p=>parseFloat(p.toFixed(3)))}function d(){if(e<=t+s)return[i.max];if(r==="keepSnaps")return o;const{min:p,max:m}=a;return o.slice(p,m)}return{snapsContained:l,scrollContainLimit:a}}function Nz(t,e,n){const r=e[0],s=n?r-t:ms(e);return{limit:rl(s,r)}}function Rz(t,e,n,r){const i=e.min+.1,o=e.max+.1,{reachedMin:a,reachedMax:l}=rl(i,o);function u(d){return d===1?l(n.get()):d===-1?a(n.get()):!1}function c(d){if(!u(d))return;const h=t*(d*-1);r.forEach(p=>p.add(h))}return{loop:c}}function Pz(t){const{max:e,length:n}=t;function r(i){const o=i-e;return n?o/-n:0}return{get:r}}function Iz(t,e,n,r,s){const{startEdge:i,endEdge:o}=t,{groupSlides:a}=s,l=f().map(e.measure),u=d(),c=h();function f(){return a(r).map(m=>ms(m)[o]-m[0][i]).map(Mt)}function d(){return r.map(m=>n[i]-m[i]).map(m=>-Mt(m))}function h(){return a(u).map(m=>m[0]).map((m,g)=>m+l[g])}return{snaps:u,snapsAligned:c}}function Lz(t,e,n,r,s,i){const{groupSlides:o}=s,{min:a,max:l}=r,u=c();function c(){const d=o(i),h=!t||e==="keepSnaps";return n.length===1?[i]:h?d:d.slice(a,l).map((p,m,g)=>{const y=!m,v=Hw(g,m);if(y){const w=ms(g[0])+1;return CD(w)}if(v){const w=Bd(i)-ms(g)[0]+1;return CD(w,ms(g)[0])}return p})}return{slideRegistry:u}}function Bz(t,e,n,r,s){const{reachedAny:i,removeOffset:o,constrain:a}=r;function l(p){return p.concat().sort((m,g)=>Mt(m)-Mt(g))[0]}function u(p){const m=t?o(p):a(p),g=e.map((v,w)=>({diff:c(v-m,0),index:w})).sort((v,w)=>Mt(v.diff)-Mt(w.diff)),{index:y}=g[0];return{index:y,distance:m}}function c(p,m){const g=[p,p+n,p-n];if(!t)return p;if(!m)return l(g);const y=g.filter(v=>Vw(v)===m);return y.length?l(y):ms(g)-n}function f(p,m){const g=e[p]-s.get(),y=c(g,m);return{index:p,distance:y}}function d(p,m){const g=s.get()+p,{index:y,distance:v}=u(g),w=!t&&i(g);if(!m||w)return{index:y,distance:p};const A=e[y]-v,x=p+c(A,0);return{index:y,distance:x}}return{byDistance:d,byIndex:f,shortcut:c}}function Fz(t,e,n,r,s,i,o){function a(f){const d=f.distance,h=f.index!==e.get();i.add(d),d&&(r.duration()?t.start():(t.update(),t.render(1),t.update())),h&&(n.set(e.get()),e.set(f.index),o.emit("select"))}function l(f,d){const h=s.byDistance(f,d);a(h)}function u(f,d){const h=e.clone().set(f),p=s.byIndex(h.get(),d);a(p)}return{distance:l,index:u}}function jz(t,e,n,r,s,i,o){let a=0;function l(){i.add(document,"keydown",u,!1),e.forEach(c)}function u(d){d.code==="Tab"&&(a=new Date().getTime())}function c(d){const h=()=>{if(new Date().getTime()-a>10)return;t.scrollLeft=0;const g=e.indexOf(d),y=n.findIndex(v=>v.includes(g));Fw(y)&&(s.useDuration(0),r.index(y,0),o.emit("slideFocus"))};i.add(d,"focus",h,{passive:!0,capture:!0})}return{init:l}}function W0(t){let e=t;function n(){return e}function r(l){e=o(l)}function s(l){e+=o(l)}function i(l){e-=o(l)}function o(l){return Fw(l)?l:l.get()}return{get:n,set:r,add:s,subtract:i}}function DD(t,e){const n=t.scroll==="x"?i:o,r=e.style;let s=!1;function i(f){return`translate3d(${f}px,0px,0px)`}function o(f){return`translate3d(0px,${f}px,0px)`}function a(f){s||(r.transform=n(t.direction(f)))}function l(f){s=!f}function u(){s||(r.transform="",e.getAttribute("style")||e.removeAttribute("style"))}return{clear:u,to:a,toggleActive:l}}function Uz(t,e,n,r,s,i,o,a,l){const c=Ld(s),f=Ld(s).reverse(),d=y().concat(v());function h(C,O){return C.reduce((_,D)=>_-s[D],O)}function p(C,O){return C.reduce((_,D)=>h(_,O)>0?_.concat([D]):_,[])}function m(C){return i.map((O,_)=>({start:O-r[_]+.5+C,end:O+e-.5+C}))}function g(C,O,_){const D=m(O);return C.map(R=>{const L=_?0:-n,F=_?n:0,G=_?"end":"start",B=D[R][G];return{index:R,loopPoint:B,slideLocation:W0(-1),translate:DD(t,l[R]),target:()=>a.get()>B?L:F}})}function y(){const C=o[0],O=p(f,C);return g(O,n,!1)}function v(){const C=e-o[0]-1,O=p(c,C);return g(O,-n,!0)}function w(){return d.every(({index:C})=>{const O=c.filter(_=>_!==C);return h(O,e)<=.1})}function A(){d.forEach(C=>{const{target:O,translate:_,slideLocation:D}=C,R=O();R!==D.get()&&(_.to(R),D.set(R))})}function x(){d.forEach(C=>C.translate.clear())}return{canLoop:w,clear:x,loop:A,loopPoints:d}}function Vz(t,e,n){let r,s=!1;function i(l){if(!n)return;function u(c){for(const f of c)if(f.type==="childList"){l.reInit(),e.emit("slidesChanged");break}}r=new MutationObserver(c=>{s||(Uw(n)||n(l,c))&&u(c)}),r.observe(t,{childList:!0})}function o(){r&&r.disconnect(),s=!0}return{init:i,destroy:o}}function Hz(t,e,n,r){const s={};let i=null,o=null,a,l=!1;function u(){a=new IntersectionObserver(p=>{l||(p.forEach(m=>{const g=e.indexOf(m.target);s[g]=m}),i=null,o=null,n.emit("slidesInView"))},{root:t.parentElement,threshold:r}),e.forEach(p=>a.observe(p))}function c(){a&&a.disconnect(),l=!0}function f(p){return Fd(s).reduce((m,g)=>{const y=parseInt(g),{isIntersecting:v}=s[y];return(p&&v||!p&&!v)&&m.push(y),m},[])}function d(p=!0){if(p&&i)return i;if(!p&&o)return o;const m=f(p);return p&&(i=m),p||(o=m),m}return{init:u,destroy:c,get:d}}function zz(t,e,n,r,s,i){const{measureSize:o,startEdge:a,endEdge:l}=t,u=n[0]&&s,c=p(),f=m(),d=n.map(o),h=g();function p(){if(!u)return 0;const v=n[0];return Mt(e[a]-v[a])}function m(){if(!u)return 0;const v=i.getComputedStyle(ms(r));return parseFloat(v.getPropertyValue(`margin-${l}`))}function g(){return n.map((v,w,A)=>{const x=!w,k=Hw(A,w);return x?d[w]+c:k?d[w]+f:A[w+1][a]-v[a]}).map(Mt)}return{slideSizes:d,slideSizesWithGaps:h,startGap:c,endGap:f}}function $z(t,e,n,r,s,i,o,a,l){const{startEdge:u,endEdge:c,direction:f}=t,d=Fw(n);function h(y,v){return Ld(y).filter(w=>w%v===0).map(w=>y.slice(w,w+v))}function p(y){return y.length?Ld(y).reduce((v,w,A)=>{const x=ms(v)||0,k=x===0,C=w===Bd(y),O=s[u]-i[x][u],_=s[u]-i[w][c],D=!r&&k?f(o):0,R=!r&&C?f(a):0,L=Mt(_-R-(O+D));return A&&L>e+l&&v.push(w),C&&v.push(y.length),v},[]).map((v,w,A)=>{const x=Math.max(A[w-1]||0);return y.slice(x,v)}):[]}function m(y){return d?h(y,n):p(y)}return{groupSlides:m}}function Gz(t,e,n,r,s,i,o){const{align:a,axis:l,direction:u,startIndex:c,loop:f,duration:d,dragFree:h,dragThreshold:p,inViewThreshold:m,slidesToScroll:g,skipSnaps:y,containScroll:v,watchResize:w,watchSlides:A,watchDrag:x}=i,k=2,C=Sz(),O=C.measure(e),_=n.map(C.measure),D=kz(l,u),R=D.measureSize(O),L=Tz(R),F=vz(a,R),G=!f&&!!v,B=f||!!v,{slideSizes:H,slideSizesWithGaps:Q,startGap:te,endGap:Z}=zz(D,O,_,n,B,s),pe=$z(D,R,g,f,O,_,te,Z,k),{snaps:Ee,snapsAligned:Re}=Iz(D,F,O,_,pe),Ce=-ms(Ee)+ms(Q),{snapsContained:ke,scrollContainLimit:He}=Mz(R,Ce,Re,v,k),Ue=G?ke:Re,{limit:ze}=Nz(Ce,Ue,f),Le=TD(Bd(Ue),c,f),tt=Le.clone(),le=Ld(n),$e=({dragHandler:Je,scrollBody:Ve,scrollBounds:Fe,options:{loop:ft}})=>{ft||Fe.constrain(Je.pointerDown()),Ve.seek()},ae=({scrollBody:Je,translate:Ve,location:Fe,offsetLocation:ft,scrollLooper:Xn,slideLooper:br,dragHandler:X,animation:ne,eventHandler:ie,scrollBounds:Te,options:{loop:me}},qe)=>{const nt=Je.velocity(),yt=Je.settled(),sn=!Te.shouldConstrain(),Ft=me?yt:yt&&sn;Ft&&!X.pointerDown()&&(ne.stop(),ie.emit("settle")),Ft||ie.emit("scroll"),ft.set(Fe.get()-nt+nt*qe),me&&(Xn.loop(Je.direction()),br.loop()),Ve.to(ft.get())},be=xz(r,s,()=>$e(Se),Je=>ae(Se,Je)),Be=.68,z=Ue[Le.get()],q=W0(z),re=W0(z),ue=W0(z),P=Oz(q,re,ue,d,Be),b=Bz(f,Ue,Ce,ze,ue),E=Fz(be,Le,tt,P,b,ue,o),M=Pz(ze),j=jd(),K=Hz(e,n,o,m),{slideRegistry:Y}=Lz(G,v,Ue,He,pe,le),ye=jz(t,n,Y,E,P,j,o),Se={ownerDocument:r,ownerWindow:s,eventHandler:o,containerRect:O,slideRects:_,animation:be,axis:D,dragHandler:Ez(D,t,r,s,ue,Cz(D,s),q,be,E,P,b,Le,o,L,h,p,y,Be,x),eventStore:j,percentOfView:L,index:Le,indexPrevious:tt,limit:ze,location:q,offsetLocation:re,options:i,resizeHandler:Dz(e,o,s,n,D,w,C),scrollBody:P,scrollBounds:_z(ze,re,ue,P,L),scrollLooper:Rz(Ce,ze,re,[q,re,ue]),scrollProgress:M,scrollSnapList:Ue.map(M.get),scrollSnaps:Ue,scrollTarget:b,scrollTo:E,slideLooper:Uz(D,R,Ce,H,Q,Ee,Ue,re,n),slideFocus:ye,slidesHandler:Vz(e,o,A),slidesInView:K,slideIndexes:le,slideRegistry:Y,slidesToScroll:pe,target:ue,translate:DD(D,e)};return Se}function Wz(){let t={},e;function n(u){e=u}function r(u){return t[u]||[]}function s(u){return r(u).forEach(c=>c(e,u)),l}function i(u,c){return t[u]=r(u).concat([c]),l}function o(u,c){return t[u]=r(u).filter(f=>f!==c),l}function a(){t={}}const l={init:n,emit:s,off:o,on:i,clear:a};return l}const Kz={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0};function qz(t){function e(i,o){return SD(i,o||{})}function n(i){const o=i.breakpoints||{},a=Fd(o).filter(l=>t.matchMedia(l).matches).map(l=>o[l]).reduce((l,u)=>e(l,u),{});return e(i,a)}function r(i){return i.map(o=>Fd(o.breakpoints||{})).reduce((o,a)=>o.concat(a),[]).map(t.matchMedia)}return{mergeOptions:e,optionsAtMedia:n,optionsMediaQueries:r}}function Qz(t){let e=[];function n(i,o){return e=o.filter(({options:a})=>t.optionsAtMedia(a).active!==!1),e.forEach(a=>a.init(i,t)),o.reduce((a,l)=>Object.assign(a,{[l.name]:l}),{})}function r(){e=e.filter(i=>i.destroy())}return{init:n,destroy:r}}function K0(t,e,n){const r=t.ownerDocument,s=r.defaultView,i=qz(s),o=Qz(i),a=jd(),l=Wz(),{mergeOptions:u,optionsAtMedia:c,optionsMediaQueries:f}=i,{on:d,off:h,emit:p}=l,m=R;let g=!1,y,v=u(Kz,K0.globalOptions),w=u(v),A=[],x,k,C;function O(){const{container:$e,slides:ae}=w;k=(jw($e)?t.querySelector($e):$e)||t.children[0];const Be=jw(ae)?k.querySelectorAll(ae):ae;C=[].slice.call(Be||k.children)}function _($e){const ae=Gz(t,k,C,r,s,$e,l);if($e.loop&&!ae.slideLooper.canLoop()){const be=Object.assign({},$e,{loop:!1});return _(be)}return ae}function D($e,ae){g||(v=u(v,$e),w=c(v),A=ae||A,O(),y=_(w),f([v,...A.map(({options:be})=>be)]).forEach(be=>a.add(be,"change",R)),w.active&&(y.translate.to(y.location.get()),y.animation.init(),y.slidesInView.init(),y.slideFocus.init(),y.eventHandler.init(le),y.resizeHandler.init(le),y.slidesHandler.init(le),y.options.loop&&y.slideLooper.loop(),k.offsetParent&&C.length&&y.dragHandler.init(le),x=o.init(le,A)))}function R($e,ae){const be=Ee();L(),D(u({startIndex:be},$e),ae),l.emit("reInit")}function L(){y.dragHandler.destroy(),y.eventStore.clear(),y.translate.clear(),y.slideLooper.clear(),y.resizeHandler.destroy(),y.slidesHandler.destroy(),y.slidesInView.destroy(),y.animation.destroy(),o.destroy(),a.clear()}function F(){g||(g=!0,a.clear(),L(),l.emit("destroy"),l.clear())}function G($e,ae,be){!w.active||g||(y.scrollBody.useBaseFriction().useDuration(ae===!0?0:w.duration),y.scrollTo.index($e,be||0))}function B($e){const ae=y.index.add(1).get();G(ae,$e,-1)}function H($e){const ae=y.index.add(-1).get();G(ae,$e,1)}function Q(){return y.index.add(1).get()!==Ee()}function te(){return y.index.add(-1).get()!==Ee()}function Z(){return y.scrollSnapList}function pe(){return y.scrollProgress.get(y.location.get())}function Ee(){return y.index.get()}function Re(){return y.indexPrevious.get()}function Ce(){return y.slidesInView.get()}function ke(){return y.slidesInView.get(!1)}function He(){return x}function Ue(){return y}function ze(){return t}function Le(){return k}function tt(){return C}const le={canScrollNext:Q,canScrollPrev:te,containerNode:Le,internalEngine:Ue,destroy:F,off:h,on:d,emit:p,plugins:He,previousScrollSnap:Re,reInit:m,rootNode:ze,scrollNext:B,scrollPrev:H,scrollProgress:pe,scrollSnapList:Z,scrollTo:G,selectedScrollSnap:Ee,slideNodes:tt,slidesInView:Ce,slidesNotInView:ke};return D(e,n),setTimeout(()=>l.emit("init"),0),le}K0.globalOptions=void 0;function $w(t={},e=[]){const n=N.useRef(t),r=N.useRef(e),[s,i]=N.useState(),[o,a]=N.useState(),l=N.useCallback(()=>{s&&s.reInit(n.current,r.current)},[s]);return N.useEffect(()=>{if(bz()&&o){K0.globalOptions=$w.globalOptions;const u=K0(o,n.current,r.current);return i(u),()=>u.destroy()}else i(void 0)},[o,i]),N.useEffect(()=>{Bw(n.current,t)||(n.current=t,l())},[t,l]),N.useEffect(()=>{wz(r.current,e)||(r.current=e,l())},[e,l]),[a,s]}$w.globalOptions=void 0;const OD=N.createContext(null);function Ud(){const t=N.useContext(OD);if(!t)throw new Error("useCarousel must be used within a <Carousel />");return t}const _D=N.forwardRef(({orientation:t="horizontal",opts:e,setApi:n,plugins:r,className:s,children:i,...o},a)=>{const[l,u]=$w({...e,axis:t==="horizontal"?"x":"y"},r),[c,f]=N.useState(!1),[d,h]=N.useState(!1),p=N.useCallback(v=>{v&&(f(v.canScrollPrev()),h(v.canScrollNext()))},[]),m=N.useCallback(()=>{u==null||u.scrollPrev()},[u]),g=N.useCallback(()=>{u==null||u.scrollNext()},[u]),y=N.useCallback(v=>{v.key==="ArrowLeft"?(v.preventDefault(),m()):v.key==="ArrowRight"&&(v.preventDefault(),g())},[m,g]);return N.useEffect(()=>{!u||!n||n(u)},[u,n]),N.useEffect(()=>{if(u)return p(u),u.on("reInit",p),u.on("select",p),()=>{u==null||u.off("select",p)}},[u,p]),S.jsx(OD.Provider,{value:{carouselRef:l,api:u,opts:e,orientation:t||((e==null?void 0:e.axis)==="y"?"vertical":"horizontal"),scrollPrev:m,scrollNext:g,canScrollPrev:c,canScrollNext:d},children:S.jsx("div",{ref:a,onKeyDownCapture:y,className:he("relative",s),role:"region","aria-roledescription":"carousel",...o,children:i})})});_D.displayName="Carousel";const MD=N.forwardRef(({className:t,...e},n)=>{const{carouselRef:r,orientation:s}=Ud();return S.jsx("div",{ref:r,className:"overflow-hidden",children:S.jsx("div",{ref:n,className:he("flex",s==="horizontal"?"-ml-4":"-mt-4 flex-col",t),...e})})});MD.displayName="CarouselContent";const Gw=N.forwardRef(({className:t,...e},n)=>{const{orientation:r}=Ud();return S.jsx("div",{ref:n,role:"group","aria-roledescription":"slide",className:he("min-w-0 shrink-0 grow-0 basis-full",r==="horizontal"?"pl-4":"pt-4",t),...e})});Gw.displayName="CarouselItem";const ND=N.forwardRef(({index:t,className:e,...n},r)=>{const{api:s}=Ud(),[i,o]=N.useState(0),[,a]=N.useState([]),l=N.useCallback(d=>{s&&s.scrollTo(d)},[s]),u=N.useCallback(d=>{d&&a(d.scrollSnapList())},[]),c=N.useCallback(d=>{d&&o(d.selectedScrollSnap())},[]);N.useEffect(()=>{s&&(u(s),c(s),s.on("reInit",u),s.on("reInit",c),s.on("select",c))},[s,u,c]);const f=i===t;return S.jsx("button",{ref:r,className:he("w-2 h-2 transition-colors duration-200 rounded-full",f?"bg-black":"bg-[#E8EBEC] hover:bg-black/50",e),onClick:()=>l(t),...n})});ND.displayName="CarouselIndicator";const Jz=N.forwardRef(({className:t,...e},n)=>{const{scrollPrev:r,canScrollPrev:s}=Ud();return S.jsx("button",{ref:n,className:he("btn bg-white hover:bg-[#F2F4F5] transition text-black flex items-center border-2 rounded h-9 px-4 py-2 text-sm font-medium disabled:bg-[#E8EBEC] disabled:text-[#A1AAB1]",t),disabled:!s,onClick:r,...e,children:S.jsx("span",{children:"Back"})})});Jz.displayName="CarouselPrevious";const Yz=N.forwardRef(({className:t,...e},n)=>{const{scrollNext:r,canScrollNext:s}=Ud();return S.jsx("button",{ref:n,className:he("btn bg-black hover:bg-black text-white flex items-center border-2 rounded h-9 px-4 py-2 text-sm font-medium disabled:bg-[#E8EBEC] disabled:text-[#A1AAB1]",t),disabled:!s,onClick:r,...e,children:S.jsx("span",{children:"Next"})})});Yz.displayName="CarouselNext";const q0=V.forwardRef(({className:t,label:e,type:n="text",isValid:r=!0,message:s,onChange:i,leftIcon:o,rightIcon:a,...l},u)=>{const c=V.useRef(null),f=Gr(u,c),d=V.useCallback(()=>{var m;(m=c.current)==null||m.focus()},[]),h=V.useMemo(()=>{if(o==null)return;const m=V.Children.only(o);if(V.isValidElement(m))return V.cloneElement(m,{...m.props,onClick:g=>{var y,v;(v=(y=m.props).onClick)==null||v.call(y,g),d()},className:he("absolute left-3 text-[#A1AAB1]",{"cursor-not-allowed":l.disabled})})},[d,o,l.disabled]),p=V.useMemo(()=>{if(a==null)return;const m=V.Children.only(a);if(V.isValidElement(m))return V.cloneElement(m,{...m.props,onClick:g=>{var y,v;(v=(y=m.props).onClick)==null||v.call(y,g),d()},className:he("absolute right-3 cursor-pointer text-[#A1AAB1]",{"cursor-not-allowed":l.disabled},{"text-red-500":!r})})},[d,a,l.disabled,r]);return S.jsxs("div",{className:"flex flex-col",children:[e?S.jsx("label",{className:"mb-2 text-sm font-medium",children:e}):null,S.jsxs("div",{className:"relative flex items-center group",children:[h,S.jsx("input",{type:n,className:he("flex h-9 w-full rounded border-[1px] border-[#E8EBEC] hover:border-black bg-transparent px-3 py-2 text-sm text-black transition-colors file:border-0 file:bg-transparent file:text-sm placeholder:text-[#A1AAB1] focus-visible:outline-none focus-visible:border-black",{"pr-3 pl-10":h},{"pr-10":p},{"border-red-500":!r},{"disabled:cursor-not-allowed disabled:bg-[#E8EBEC] disabled:border-[#A1AAB1] disabled:text-[#A1AAB1]":l.disabled},t),onChange:i,ref:f,...l}),p]}),s?S.jsx("p",{className:he("text-sm mt-2 font-normal text-wrap text-justify",{"text-red-500":!r,"text-black":r}),children:s}):null]})});q0.displayName="TextField";const sl=N.forwardRef(({active:t,buttonSize:e="medium",children:n,disabled:r,variant:s="primary",className:i,activeClassname:o,isLoading:a=!1,...l},u)=>{const c=he("flex items-center justify-center border-2 gap-2 transition text-sm font-semibold rounded disabled:opacity-50 whitespace-nowrap",s==="primary"&&he("text-white bg-black border-black",!r&&!t&&"hover:bg-neutral-800 active:bg-neutral-900",t&&he("bg-neutral-900 dark:bg-neutral-300",o)),s==="secondary"&&he("text-neutral-900 border-black",!r&&!t&&"hover:bg-neutral-100 active:bg-neutral-200",t&&"bg-neutral-200"),s==="tertiary"&&he("bg-neutral-50 text-neutral-900 border-transparent",!r&&!t&&"hover:bg-neutral-100 active:bg-neutral-200",t&&he("bg-neutral-200",o)),s==="ghost"&&he("bg-transparent border-transparent text-neutral-900",!r&&!t&&"hover:bg-black/5 hover:text-neutral-700 active:bg-black/10",t&&he("bg-black/10",o)),e==="medium"&&"py-2 px-3",e==="small"&&"py-1 px-2",e==="icon"&&"w-8 h-8",e==="iconSmall"&&"w-6 h-6",i);return S.jsx("button",{ref:u,disabled:r,className:c,...l,children:a?S.jsx(eV,{size:20,className:"animate-spin",fill:"transparent",stroke:"currentColor"}):n})});sl.displayName="Button";const RD=[{title:"Trebuchet MS",value:"Trebuchet MS, sans-serif",command:t=>{t.chain().focus().setFontFamily("Trebuchet MS, sans-serif").run()}},{title:"Verdana",value:"Verdana, Geneva, sans-serif",command:t=>{t.chain().focus().setFontFamily("Verdana, Geneva, sans-serif").run()}},{title:"Georgia",value:"Georgia, serif",command:t=>{t.chain().focus().setFontFamily("Georgia, serif").run()}},{title:"Arial",value:"Arial, Helvetica, sans-serif",command:t=>{t.chain().focus().setFontFamily("Arial, Helvetica, sans-serif").run()}},{title:"Comic Sans MS",value:"Comic Sans MS, Comic Sans",command:t=>{t.chain().focus().setFontFamily("Comic Sans MS, Comic Sans").run()}},{title:"Impact",value:"Impact, Charcoal, sans-serif",command:t=>{t.chain().focus().setFontFamily("Impact, Charcoal, sans-serif").run()}},{title:"Palatino",value:"Palatino Linotype, Book Antiqua, Palatino, serif",command:t=>{t.chain().focus().setFontFamily("Palatino Linotype, Book Antiqua, Palatino, serif").run()}},{title:"Lucida Grande",value:"Lucida Sans Unicode, Lucida Grande, sans-serif",command:t=>{t.chain().focus().setFontFamily("Lucida Sans Unicode, Lucida Grande, sans-serif").run()}},{title:"Serif",value:"serif",command:t=>{t.chain().focus().setFontFamily("serif").run()}},{title:"Monospace",value:"monospace",command:t=>{t.chain().focus().setFontFamily("monospace").run()}},{title:"Cursive",value:"cursive",command:t=>{t.chain().focus().setFontFamily("cursive").run()}}],Ww=[{color:"#00FF00",code:"bg-[#00FF00]"},{color:"#008080",code:"bg-[#008080]"},{color:"#FFC0CB",code:"bg-[#FFC0CB]"},{color:"#808000",code:"bg-[#808000]"},{color:"#800000",code:"bg-[#800000]"},{color:"#000080",code:"bg-[#000080]"},{color:"#7FFFD4",code:"bg-[#7FFFD4]"},{color:"#40E0D0",code:"bg-[#40E0D0]"},{color:"#C0C0C0",code:"bg-[#C0C0C0]"},{color:"#808080",code:"bg-[#808080]"},{color:"#000000",code:"bg-[#000000]"},{color:"#FFFFFF",code:"bg-[#FFFFFF]"},{color:"#CD5C5C",code:"bg-[#CD5C5C]"},{color:"#F08080",code:"bg-[#F08080]"},{color:"#FA8072",code:"bg-[#FA8072]"},{color:"#E9967A",code:"bg-[#E9967A]"},{color:"#FFA07A",code:"bg-[#FFA07A]"},{color:"#DC143C",code:"bg-[#DC143C]"},{color:"#FF6347",code:"bg-[#FF6347]"},{color:"#FF7F50",code:"bg-[#FF7F50]"},{color:"#FF4500",code:"bg-[#FF4500]"},{color:"#BDB76B",code:"bg-[#BDB76B]"},{color:"#FFD700",code:"bg-[#FFD700]"},{color:"#F0E68C",code:"bg-[#F0E68C]"},{color:"#FFE5B4",code:"bg-[#FFE5B4]"},{color:"#9ACD32",code:"bg-[#9ACD32]"},{color:"#556B2F",code:"bg-[#556B2F]"},{color:"#6B8E23",code:"bg-[#6B8E23]"},{color:"#7CFC00",code:"bg-[#7CFC00]"},{color:"#7FFF00",code:"bg-[#7FFF00]"},{color:"#ADFF2F",code:"bg-[#ADFF2F]"},{color:"#00BFFF",code:"bg-[#00BFFF]"},{color:"#1E90FF",code:"bg-[#1E90FF]"},{color:"#6495ED",code:"bg-[#6495ED]"},{color:"#4682B4",code:"bg-[#4682B4]"},{color:"#4169E1",code:"bg-[#4169E1]"},{color:"#8A2BE2",code:"bg-[#8A2BE2]"},{color:"#4B0082",code:"bg-[#4B0082]"},{color:"#6A5ACD",code:"bg-[#6A5ACD]"}],Vd=1024*100,Kw={IMAGE_SIZE:"Image size should be less than 2 MB"},qw=({editor:t,onError:e})=>{const{ref:n,toolVisibilty:r,setToolVisibility:s}=hV(Me.NONE),i=[{icon:S.jsx(KU,{size:20}),title:"Text Color",onClick:()=>s(Me.TEXT_COLOR),isActive:r===Me.TEXT_COLOR},{icon:S.jsx(QT,{size:20}),title:"Highlight",onClick:()=>s(Me.HIGHLIGHT),isActive:r===Me.HIGHLIGHT},null,{icon:S.jsx(ew,{size:20}),title:"Bold",onClick:()=>t==null?void 0:t.chain().focus().toggleBold().run(),isActive:t==null?void 0:t.isActive("bold")},{icon:S.jsx(tw,{size:20}),title:"Italic",onClick:()=>t==null?void 0:t.chain().focus().toggleItalic().run(),isActive:t==null?void 0:t.isActive("italic")},{icon:S.jsx(lw,{size:20}),title:"Underlined",onClick:()=>t==null?void 0:t.chain().focus().toggleUnderline().run(),isActive:t==null?void 0:t.isActive("underline")},{icon:S.jsx(sw,{size:20}),title:"Strikethrough",onClick:()=>t==null?void 0:t.chain().focus().toggleStrike().run(),isActive:t==null?void 0:t.isActive("strike")},null,{icon:S.jsx(D0,{size:20}),title:"List",onClick:()=>{t==null||t.chain().focus().toggleBulletList().run(),s(Me.NONE)},isActive:t==null?void 0:t.isActive("bulletList")},{icon:S.jsx(Uu,{size:20}),title:"Ordered List",onClick:()=>{t==null||t.chain().focus().toggleOrderedList().run(),s(Me.NONE)},isActive:t==null?void 0:t.isActive("orderedList")},{icon:S.jsx(rw,{size:20}),title:"To-do List",onClick:()=>{t==null||t.chain().focus().toggleTaskList().run(),s(Me.NONE)},isActive:t==null?void 0:t.isActive("taskList")},{icon:S.jsx(Od,{size:20}),title:"Alignment",onClick:()=>s(Me.ALIGNMENT),isActive:r===Me.ALIGNMENT},{icon:S.jsx(O0,{size:20}),title:"Quote",onClick:()=>t==null?void 0:t.chain().focus().toggleBlockquote().run(),isActive:t==null?void 0:t.isActive("blockquote")},null,{icon:S.jsx(JT,{size:20}),title:"Upload Image",onClick:()=>{t==null||t.chain().focus().deleteRange(t.state.selection).run();const a=document.createElement("input");a.type="file",a.accept="image/*",a.onchange=async()=>{var l;if((l=a.files)!=null&&l.length){const u=a.files[0];if(u.size>Vd){e&&typeof e=="function"&&e(Kw.IMAGE_SIZE);return}const f=t.view.state.selection.from;uw(u,t.view,f)}},a.click()},isActive:!1},{icon:S.jsx(nw,{size:20}),title:"Link",onClick:()=>s(Me.LINK),isActive:t==null?void 0:t.isActive("link")},{icon:S.jsx(Md,{size:20}),title:"Code",onClick:()=>t==null?void 0:t.chain().focus().toggleCodeBlock().run(),isActive:t==null?void 0:t.isActive("codeBlock")},{icon:S.jsx(iw,{size:20}),title:"Add table",onClick:()=>t==null?void 0:t.chain().focus().insertTable({rows:3,cols:2,withHeaderRow:!0}).run(),isActive:r===Me.TEXT_COLOR}],o=[{icon:S.jsx(aw,{size:24}),title:"Text formating",onClick:()=>s(Me.TEXT_FORMATING),isActive:r===Me.TEXT_FORMATING},{icon:S.jsx(iw,{size:24}),title:"Add table",onClick:()=>t==null?void 0:t.chain().focus().insertTable({rows:3,cols:2,withHeaderRow:!0}).run(),isActive:!0},{icon:S.jsx(rw,{size:24}),title:"To-do list",onClick:()=>{t==null||t.chain().focus().toggleTaskList().run(),s(Me.NONE)},isActive:!0},{icon:S.jsx(JT,{size:24}),title:"Add image",onClick:()=>{t==null||t.chain().focus().deleteRange(t.state.selection).run();const a=document.createElement("input");a.type="file",a.accept="image/*",a.onchange=async()=>{var l;if((l=a.files)!=null&&l.length){const u=a.files[0];if(u.size>Vd){e&&typeof e=="function"&&e(Kw.IMAGE_SIZE);return}const f=t.view.state.selection.from;uw(u,t.view,f)}},a.click()},isActive:!0},{icon:S.jsx(uV,{size:24}),title:"Undo",onClick:()=>{t==null||t.chain().focus().undo().run()},isActive:t==null?void 0:t.can().undo()},{icon:S.jsx(oV,{size:24}),title:"Redo",onClick:()=>{t==null||t.chain().focus().redo().run()},isActive:t==null?void 0:t.can().redo()}];return{toolbar:i,bottomToolbar:o,toolRef:n,toolVisibilty:r,setToolVisibility:s}},PD=({editor:t,setVisibility:e,elementRef:n})=>{const r=[{color:"#00FF00",code:"bg-[#00FF00]"},{color:"#008080",code:"bg-[#008080]"},{color:"#FFC0CB",code:"bg-[#FFC0CB]"},{color:"#808000",code:"bg-[#808000]"},{color:"#800000",code:"bg-[#800000]"},{color:"#000080",code:"bg-[#000080]"},{color:"#7FFFD4",code:"bg-[#7FFFD4]"},{color:"#40E0D0",code:"bg-[#40E0D0]"},{color:"#C0C0C0",code:"bg-[#C0C0C0]"},{color:"#808080",code:"bg-[#808080]"},{color:"#000000",code:"bg-[#000000]"},{color:"#FFFFFF",code:"bg-[#FFFFFF]"},{color:"#CD5C5C",code:"bg-[#CD5C5C]"},{color:"#F08080",code:"bg-[#F08080]"},{color:"#FA8072",code:"bg-[#FA8072]"},{color:"#E9967A",code:"bg-[#E9967A]"},{color:"#FFA07A",code:"bg-[#FFA07A]"},{color:"#DC143C",code:"bg-[#DC143C]"},{color:"#FF6347",code:"bg-[#FF6347]"},{color:"#FF7F50",code:"bg-[#FF7F50]"},{color:"#FF4500",code:"bg-[#FF4500]"},{color:"#BDB76B",code:"bg-[#BDB76B]"},{color:"#FFD700",code:"bg-[#FFD700]"},{color:"#F0E68C",code:"bg-[#F0E68C]"},{color:"#FFE5B4",code:"bg-[#FFE5B4]"},{color:"#9ACD32",code:"bg-[#9ACD32]"},{color:"#556B2F",code:"bg-[#556B2F]"},{color:"#6B8E23",code:"bg-[#6B8E23]"},{color:"#7CFC00",code:"bg-[#7CFC00]"},{color:"#7FFF00",code:"bg-[#7FFF00]"},{color:"#ADFF2F",code:"bg-[#ADFF2F]"},{color:"#00BFFF",code:"bg-[#00BFFF]"},{color:"#1E90FF",code:"bg-[#1E90FF]"},{color:"#6495ED",code:"bg-[#6495ED]"},{color:"#4682B4",code:"bg-[#4682B4]"},{color:"#4169E1",code:"bg-[#4169E1]"},{color:"#8A2BE2",code:"bg-[#8A2BE2]"},{color:"#4B0082",code:"bg-[#4B0082]"},{color:"#6A5ACD",code:"bg-[#6A5ACD]"}];return S.jsxs("div",{ref:n,className:"z-50 h-auto absolute gap-2 top-14 flex flex-wrap left-[20%] max-h-[330px] w-[20.5rem] overflow-y-auto scroll-smooth rounded bg-white px-1 py-2 shadow-lg transition-all",children:[S.jsx(Z1,{className:"cursor-pointer",onClick:()=>{t.chain().focus().unsetHighlight().run(),e(Me.NONE)}}),r.map(s=>S.jsx("div",{onClick:()=>{t.chain().focus().toggleHighlight({color:s.color}).run(),e(Me.NONE)},className:he("w-6 drop-shadow rounded-full flex items-center justify-center cursor-pointer ease-in duration-200 hover:scale-[1.05] h-6",s.code),children:S.jsx(_d,{size:14,className:he(t.isActive("highlight",{color:s.color})?"visible":"invisible")})},s.color))]})},Xz=({elementRef:t,editor:e,setToolVisibility:n})=>S.jsx("div",{ref:t,className:he("z-50 h-auto absolute top-14 left-0 max-h-[330px] w-48 overflow-y-auto scroll-smooth bg-white px-1 py-2 shadow-lg transition-all rounded animate-in fade-in slide-in-from-top-1"),children:RD.map(r=>S.jsx("button",{onClick:()=>{r.command(e),n(Me.NONE)},style:{fontFamily:r.title},className:he("flex w-full items-center space-x-2 rounded px-2 py-1 text-left text-sm text-black transition",e.isActive("textStyle",{fontFamily:r.value})?"bg-yellow-300 hover:brightness-90":"hover:bg-[#f2f2f2]"),children:S.jsx("p",{className:"font-medium",children:r.title})},r.title))}),ID=({elementRef:t,editor:e,setToolVisibility:n})=>S.jsxs("div",{ref:t,className:"z-50 h-auto absolute gap-2 top-14 left-[60%] translate-x-1/2 flex flex-wrap max-h-[330px] overflow-y-auto scroll-smooth rounded bg-white px-1 py-2 shadow-lg transition-all",children:[S.jsx("span",{onClick:()=>{e==null||e.chain().focus().setTextAlign("left").run(),n(Me.NONE)},className:he("rounded w-8 h-8 p-1 flex justify-center items-center cursor-pointer transition",e.isActive({textAlign:"left"})?"bg-yellow-300 hover:brightness-90":"hover:bg-[#f2f2f2]"),children:S.jsx(Od,{})}),S.jsx("span",{onClick:()=>{e==null||e.chain().focus().setTextAlign("center").run(),n(Me.NONE)},className:he("rounded w-8 h-8 p-1 flex justify-center items-center cursor-pointer transition",e.isActive({textAlign:"center"})?"bg-yellow-300 hover:brightness-90":"hover:bg-[#f2f2f2]"),children:S.jsx(Y1,{})}),S.jsx("span",{onClick:()=>{e==null||e.chain().focus().setTextAlign("right").run(),n(Me.NONE)},className:he("rounded w-8 h-8 p-1 flex justify-center items-center cursor-pointer transition",e.isActive({textAlign:"right"})?"bg-yellow-300 hover:brightness-90":"hover:bg-[#f2f2f2]"),children:S.jsx(X1,{})})]}),Zz=({elementRef:t,editor:e,setToolVisibility:n})=>S.jsxs("div",{ref:t,className:he("z-50 h-auto absolute gap-2 top-[50px] right-[30%] flex flex-wrap max-h-[330px] overflow-y-auto scroll-smooth rounded bg-white px-1 py-2 shadow-lg transition-all"),children:[S.jsx("div",{className:"tooltip tooltip-open tooltip-bottom","data-tip":"unordered list",children:S.jsx("span",{onClick:()=>{e==null||e.chain().focus().toggleBulletList().run(),n(Me.NONE)},className:` hover:bg-[#f2f2f2] ${e.isActive("bulletList")?"bg-[#f2f2f2]":""} rounded-lg w-8 h-8 p-1 flex justify-center items-center`,children:S.jsx(D0,{size:20})})}),S.jsx("div",{className:"tooltip tooltip-open tooltip-bottom","data-tip":"ordered list",children:S.jsx("span",{onClick:()=>{e==null||e.chain().focus().toggleOrderedList().run(),n(Me.NONE)},className:` hover:bg-[#f2f2f2] ${e.isActive("orderedList")?"bg-[#f2f2f2]":""} rounded-lg w-8 h-8 p-1 flex justify-center items-center`,children:S.jsx(Uu,{size:20})})}),S.jsx("div",{className:"tooltip tooltip-open tooltip-bottom","data-tip":"to-do list",children:S.jsx("span",{onClick:()=>{e==null||e.chain().focus().toggleTaskList().run(),n(Me.NONE)},className:` hover:bg-[#f2f2f2] ${e.isActive("taskList")?"bg-[#f2f2f2]":""} rounded-lg w-8 h-8 p-1 flex justify-center items-center`,children:S.jsx(rw,{size:20})})})]}),LD=({elementRef:t,editor:e,setToolVisibility:n,bubbleMenu:r,setIsLinkPopupOpen:s})=>{const[i,o]=N.useState(e.getAttributes("link").href),a=()=>{if(i===null)return;if(i===""){e.chain().focus().extendMarkRange("link").unsetLink().run();return}let l=i;!i.startsWith("http://")&&!i.startsWith("https://")&&(l="https://"+i);try{l.match(/^((http|https):\/\/)?([w|W]{3}\.)+[a-zA-Z0-9\-\.]{3,}\.[a-zA-Z]{2,}(\.[a-zA-Z]{2,})?$/)&&e.chain().focus().extendMarkRange("link").setLink({href:l}).run()}catch{console.error("Invalid URL");return}e.chain().focus().extendMarkRange("link").setLink({href:l}).run(),n(Me.NONE),r&&s&&s(!1)};return S.jsxs("div",{ref:t,className:"z-50 h-auto absolute gap-2 top-14 translate-x-1/2 items-center flex max-h-[330px] overflow-y-auto scroll-smooth rounded-lg bg-white p-2 shadow-lg transition-all",children:[S.jsx(q0,{onChange:l=>o(l.target.value),className:"w-full",placeholder:"Add link here",value:i}),S.jsx("div",{className:"h-full flex items-center",children:S.jsx(sl,{variant:"secondary",onClick:()=>a(),className:"min-w-fit h-[36px]",children:"Apply"})})]})},e$=({editor:t,setVisibility:e,elementRef:n})=>S.jsxs("div",{ref:n,className:"z-50 h-auto absolute gap-2 top-14 flex flex-wrap left-[100px] max-h-[330px] w-[20.5rem] overflow-y-auto scroll-smooth rounded bg-white px-1 py-2 shadow-lg transition-all",children:[S.jsx(Z1,{className:"cursor-pointer",onClick:()=>{t.chain().focus().unsetColor().run(),e(Me.NONE)}}),Ww.map(r=>S.jsx("div",{onClick:()=>{t.chain().focus().setColor(r.color).run(),e(Me.NONE)},className:he("w-6 drop-shadow rounded-full flex justify-center items-center cursor-pointer ease-in duration-200 hover:scale-[1.05] h-6",r.code),children:S.jsx(_d,{size:14,className:he(t.isActive("textStyle",{color:r.color})?"visible":"invisible")})},r.color))]}),t$=({editor:t,setVisibility:e,elementRef:n})=>{const r=[{title:"Text",description:"Normal",icon:S.jsx(aw,{size:20}),command:s=>s.chain().focus().toggleNode("paragraph","paragraph").run(),isActive:()=>t.isActive("paragraph")&&!t.isActive("bulletList")&&!t.isActive("orderedList")},{title:"Heading 1",description:"Big",icon:S.jsx(C0,{size:20}),command:s=>{s.chain().focus().toggleHeading({level:1}).run()},isActive:()=>t.isActive("heading",{level:1})},{title:"Heading 2",description:"Medium",icon:S.jsx(S0,{size:20}),command:s=>{s.chain().focus().toggleHeading({level:2}).run()},isActive:()=>t.isActive("heading",{level:2})},{title:"Heading 3",description:"Small",icon:S.jsx(T0,{size:20}),command:s=>{s.chain().focus().toggleHeading({level:3}).run()},isActive:()=>t.isActive("heading",{level:3})}];return S.jsx("div",{ref:n,className:he("absolute top-[50px] z-50 mt-1 flex w-48 flex-col overflow-hidden rounded bg-white p-1 shadow-lg animate-in fade-in slide-in-from-top-1","left-0"),children:r.map(s=>S.jsxs("button",{onClick:()=>{s.command(t),e(Me.NONE)},className:he("flex w-full items-center space-x-2 rounded-md px-2 py-1 text-left text-sm text-black transition",{"bg-yellow-300 hover:brightness-90":s.isActive(),"hover:bg-[#f2f2f2]":!s.isActive()}),children:[S.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded bg-white",children:s.icon}),S.jsxs("div",{children:[S.jsx("p",{className:"font-medium",children:s.title}),S.jsxs("p",{className:"text-xs text-stone-500",children:[" ",s.description," "]})]})]},s.title))})},n$=({editor:t,setToolVisibility:e})=>{const n=[{title:"Text",description:"Normal",icon:S.jsx(aw,{size:20}),command:r=>r.chain().focus().toggleNode("paragraph","paragraph").run(),isActive:()=>t.isActive("paragraph")&&!t.isActive("bulletList")&&!t.isActive("orderedList")},{title:"Heading 1",description:"Big",icon:S.jsx(C0,{size:20}),command:r=>{r.chain().focus().toggleHeading({level:1}).run()},isActive:()=>t.isActive("heading",{level:1})},{title:"Heading 2",description:"Medium",icon:S.jsx(S0,{size:20}),command:r=>{r.chain().focus().toggleHeading({level:2}).run()},isActive:()=>t.isActive("heading",{level:2})},{title:"Heading 3",description:"Small",icon:S.jsx(T0,{size:20}),command:r=>{r.chain().focus().toggleHeading({level:3}).run()},isActive:()=>t.isActive("heading",{level:3})}];return S.jsx(fz,{title:"Text formating",content:S.jsxs("div",{className:"px-4 flex flex-col gap-2 w-full",children:[S.jsx("div",{className:"flex justify-start sm:justify-center items-center gap-1",children:n.map(r=>S.jsx("button",{onClick:()=>r.command(t),className:he("flex w-fit items-center font-medium space-x-2 rounded p-2 text-center text-sm text-black transition",{"bg-yellow-300 hover:brightness-90":r.isActive(),"hover:bg-[#f2f2f2]":!r.isActive()}),children:r.title},r.title))}),S.jsxs("div",{className:"flex justify-between sm:justify-center items-center gap-1",children:[S.jsxs("div",{className:"bg-[#f8f9fa] rounded flex gap-1 justify-evenly w-full sm:w-fit p-1",children:[S.jsx("button",{onClick:()=>{t==null||t.chain().focus().setTextAlign("left").run()},className:he("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive({textAlign:"left"}),"hover:bg-[#f2f2f2]":!t.isActive({textAlign:"left"})}),children:S.jsx(Od,{size:20})}),S.jsx("button",{onClick:()=>{t==null||t.chain().focus().setTextAlign("center").run()},className:he("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive({textAlign:"center"}),"hover:bg-[#f2f2f2]":!t.isActive({textAlign:"center"})}),children:S.jsx(Y1,{size:20})}),S.jsx("button",{onClick:()=>{t==null||t.chain().focus().setTextAlign("right").run()},className:he("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive({textAlign:"right"}),"hover:bg-[#f2f2f2]":!t.isActive({textAlign:"right"})}),children:S.jsx(X1,{size:20})})]}),S.jsxs("div",{className:"bg-[#f8f9fa] rounded flex gap-1 justify-evenly w-full sm:w-fit p-1",children:[S.jsx(hz,{asChild:!0,children:S.jsx("button",{onClick:()=>e(Me.LINK_POPUP),className:he("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive("link"),"hover:bg-[#f2f2f2]":!t.isActive("link")}),children:S.jsx(nw,{size:20})})}),S.jsx("button",{onClick:()=>{t==null||t.chain().focus().toggleCodeBlock().run()},className:he("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive("codeBlock"),"hover:bg-[#f2f2f2]":!t.isActive("codeBlock")}),children:S.jsx(Md,{size:20})}),S.jsx("button",{onClick:()=>{t==null||t.chain().focus().toggleBlockquote().run()},className:he("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive("blockquote"),"hover:bg-[#f2f2f2]":!t.isActive("blockquote")}),children:S.jsx(O0,{size:20})})]})]}),S.jsxs("div",{className:"flex justify-between sm:justify-center items-center gap-1",children:[S.jsxs("div",{className:"bg-[#f8f9fa] rounded flex gap-1 justify-evenly w-full sm:w-fit p-1",children:[S.jsx("button",{onClick:()=>{t.chain().focus().toggleBold().run()},className:he("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive("bold"),"hover:bg-[#f2f2f2]":!t.isActive("bold")}),children:S.jsx(ew,{size:20})}),S.jsx("button",{onClick:()=>{t.chain().focus().toggleItalic().run()},className:he("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive("italic"),"hover:bg-[#f2f2f2]":!t.isActive("italic")}),children:S.jsx(tw,{size:20})}),S.jsx("button",{onClick:()=>{t.chain().focus().toggleUnderline().run()},className:he("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive("underline"),"hover:bg-[#f2f2f2]":!t.isActive("bold")}),children:S.jsx(lw,{size:20})}),S.jsx("button",{onClick:()=>{t.chain().focus().toggleStrike().run()},className:he("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive("strike"),"hover:bg-[#f2f2f2]":!t.isActive("bold")}),children:S.jsx(sw,{size:20})})]}),S.jsxs("div",{className:"bg-[#f8f9fa] rounded flex flex-[0.5] sm:flex-none gap-2 justify-evenly w-full sm:w-fit p-1",children:[S.jsx("button",{onClick:()=>{t==null||t.chain().focus().toggleBulletList().run()},className:he("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive("bulletList"),"hover:bg-[#f2f2f2]":!t.isActive("bulletList")}),children:S.jsx(D0,{size:20})}),S.jsx("button",{onClick:()=>{t==null||t.chain().focus().toggleOrderedList().run()},className:he("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive("orderedList"),"hover:bg-[#f2f2f2]":!t.isActive("orderedList")}),children:S.jsx(Uu,{size:20})})]})]}),S.jsxs("div",{className:"flex flex-col gap-4 mt-4",children:[S.jsx("p",{className:"text-left sm:text-center text-lg font-semibold leading-none tracking-tight",children:"Text color"}),S.jsxs(_D,{opts:{align:"start",dragFree:!0,slidesToScroll:"auto"},className:"w-full max-w-md mx-auto",children:[S.jsxs(MD,{children:[S.jsx(Gw,{style:{flexBasis:"calc(100% / 12)"},children:S.jsx(Z1,{className:"cursor-pointer",onClick:()=>{t.chain().focus().unsetColor().run()}})}),Ww.map((r,s)=>S.jsx(Gw,{style:{flexBasis:"calc(100% / 12)"},children:S.jsx("button",{onClick:()=>{t.chain().focus().setColor(r.color).run()},className:he("w-6 h-6 mb-1 drop-shadow rounded-full flex justify-center items-center cursor-pointer transition",r.code),children:S.jsx(_d,{size:14,className:he(t.isActive("textStyle",{color:r.color})?"visible":"invisible")})},r.color)},s))]}),S.jsx("div",{className:"flex justify-center gap-2 mt-4 w-full max-w-sm",children:Array.from({length:Ww.length/8}).map((r,s)=>S.jsx(ND,{index:s},s))})]})]})]})})},r$=t=>{const e=[{name:"Bold",isActive:()=>t.editor.isActive("bold"),command:()=>t.editor.chain().focus().toggleBold().run(),icon:S.jsx(ew,{size:20})},{name:"Italic",isActive:()=>t.editor.isActive("italic"),command:()=>t.editor.chain().focus().toggleItalic().run(),icon:S.jsx(tw,{size:20})},{name:"Underline",isActive:()=>t.editor.isActive("underline"),command:()=>t.editor.chain().focus().toggleUnderline().run(),icon:S.jsx(lw,{size:20})},{name:"Strikethrough",isActive:()=>t.editor.isActive("strike"),command:()=>t.editor.chain().focus().toggleStrike().run(),icon:S.jsx(sw,{size:20})},{name:"Alignment",isActive:()=>f===Me.ALIGNMENT,command:()=>c(Me.ALIGNMENT),icon:S.jsx(Od,{size:20})},{name:"Code",isActive:()=>t.editor.isActive("codeBlock"),command:()=>t.editor.chain().focus().toggleCodeBlock().run(),icon:S.jsx(Md,{size:20})},{name:"Link",isActive:()=>t.editor.isActive("link"),command:()=>l(!a),icon:S.jsx(nw,{size:20})}],n={...t,shouldShow:({state:h,editor:p})=>{const{selection:m}=h,{empty:g}=m;return!(p.isActive("image")||g||k1(m))},tippyOptions:{moveTransition:"transform 0.15s ease-out",duration:200,animation:"shift-toward-subtle",onHidden:()=>{s(!1),o(!1),l(!1)}}},[r,s]=N.useState(!1),[i,o]=N.useState(!1),[a,l]=N.useState(!1),{toolRef:u,setToolVisibility:c,toolVisibilty:f}=qw({editor:t.editor}),d=({editor:h})=>{const{from:p,to:m}=h.state.selection;if(p===m)return!1;let g=!1;return h.state.doc.nodesBetween(p,m,y=>{y.marks&&y.marks.forEach(v=>{v.type.name==="highlight"&&v.attrs.color==="yellow"&&(g=!0)})}),!g};return S.jsxs(VT,{...n,shouldShow:d,className:"hidden lg:flex gap-2 overflow-hidden rounded-[12px] h-[52px] min-w-[550px] w-full py-2 px-4 bg-white items-center shadow-lg",children:[S.jsx(fV,{editor:t.editor,isOpen:r,setIsOpen:()=>{s(!r),o(!1)}}),e.map((h,p)=>S.jsxs("div",{className:"flex items-center",children:[S.jsx("button",{onClick:h.command,className:he("min-w-fit w-8 h-8 px-2 rounded",{"bg-yellow-300":h.isActive()}),children:h.icon}),(p===4||p===6)&&S.jsx("div",{className:"w-1.5 h-4 bg-gray-300 mx-2"})]},p)),S.jsx(dV,{editor:t.editor,isOpen:i,setIsOpen:()=>{o(!i),s(!1)}}),S.jsx("button",{onClick:()=>c(Me.HIGHLIGHT),className:he("min-w-fit w-8 h-8 px-2",{"bg-yellow-300":f===Me.HIGHLIGHT}),children:S.jsx(QT,{size:20})}),f===Me.ALIGNMENT&&S.jsx(ID,{setToolVisibility:c,editor:t.editor,elementRef:u}),a&&S.jsx(LD,{setToolVisibility:c,editor:t.editor,elementRef:u,bubbleMenu:!0,setIsLinkPopupOpen:l}),f===Me.HIGHLIGHT&&S.jsx(PD,{setVisibility:c,editor:t.editor,elementRef:u})]})};function s$(){const t=["a","b","c","d","e","f","0","1","2","3","4","5","6","7","8","9"];let e=[];for(let n=0;n<36;n++)n===8||n===13||n===18||n===23?e[n]="-":e[n]=t[Math.ceil(Math.random()*t.length-1)];return e.join("")}var i$=s$;const o$=Np(i$),BD=Ye.create({name:"column",content:"dBlock+",isolating:!0,addAttributes(){return{position:{default:"",parseHTML:t=>t.getAttribute("data-position"),renderHTML:t=>({"data-position":t.position})}}},renderHTML({HTMLAttributes:t}){return["div",rt(t,{"data-type":"column"}),0]},parseHTML(){return[{tag:'div[data-type="column"]'}]}}),a$=(t,e)=>Array.from({length:t},(n,r)=>e(r)),Q0=({type:t,content:e})=>e?{type:t,content:e}:{type:t},l$=({content:t})=>Q0({type:"paragraph",content:t}),FD=({content:t})=>Q0({type:"dBlock",content:t}),jD=({content:t})=>Q0({type:"column",content:t}),UD=({content:t})=>Q0({type:"columns",content:t}),VD=t=>{const e=[FD({content:[l$({})]})];return a$(t,()=>jD({content:e}))},HD=(t,e)=>{for(let n=t.depth;n>0;n--){const r=t.node(n),s=n>0?t.before(n):0,i=t.start(n);if(e({node:r,pos:s,start:i}))return{start:i,depth:n,node:r,pos:s}}throw Error("no ancestor found")};class J0 extends Pe{constructor(n){const{$from:r,$to:s}=n;super(r,s);W(this,"_$from");W(this,"_$to");this._$from=r,this._$to=s}get $from(){return this._$from}get $to(){return this._$to}map(){return this}content(){return this.$from.doc.slice(this.from,this.to,!0)}eq(n){return n instanceof J0&&n.anchor==this.anchor}toJSON(){return{type:"column",from:this.from,to:this.to}}expandSelection(n){var l;const r=({pos:u,node:c})=>c.type.name===BD.name?!0:n.resolve(u).depth<=0,{pos:s}=HD(this.$from,r);this._$from=n.resolve(s);const{pos:i,node:o}=HD(this.$to,r);this._$to=n.resolve(i+o.nodeSize),((l=this.getFirstNode())==null?void 0:l.type.name)===Y0.name&&(this._$from=n.resolve(this.$from.pos+2),this._$to=n.resolve(this.$to.pos+2));const a=this;a.$anchor=this._$from,a.$head=this._$to,a.ranges=[new Rb(this._$from,this._$to)]}static create(n,r,s){const i=n.resolve(r),o=n.resolve(s),a=new _e(i,o);return new J0(a)}getFirstNode(){return this.content().content.firstChild}}var il=(t=>(t.AlignLeft="align-left",t.AlignRight="align-right",t.AlignCenter="align-center",t))(il||{});const Y0=Ye.create({name:"columns",group:"columns",content:"column{2,}",defining:!0,draggable:!0,isolating:!0,addAttributes(){return{layout:{default:"align-center"}}},addCommands(){return{unsetColumns:()=>({tr:t,dispatch:e})=>{try{if(!e)return;const n=t.selection.$from,s=b1(n,({node:l})=>!this.options.nestedColumns&&l.type==this.type?!0:l.type==this.type);if(s===void 0)return;let i=[];s.node.descendants((l,u,c)=>{(c==null?void 0:c.type.name)===Y0.name&&i.push(l)}),i=i.reverse().filter(l=>l.content.size>0);const o=t.doc.resolve(s.pos),a=new De(o);return t=t.setSelection(a),i.forEach(l=>t=t.insert(s.pos,l)),t=t.deleteSelection(),e(t)}catch(n){console.error(n)}},setColumns:(t,e=!1)=>({tr:n,dispatch:r})=>{try{const{doc:s,selection:i}=n;if(!r){console.log("no dispatch");return}const o=new J0(i);o.expandSelection(s);const{openStart:a,openEnd:l}=o.content();if(a!==l){console.warn("failed depth check");return}let u;if(e){const h=o.content().toJSON(),p=jD(h),m=VD(t-1);u=UD({content:[p,...m]})}else{const h=VD(t);u=UD({content:h})}const c=s.type.schema.nodeFromJSON(FD({content:[u]}));if(c===null)return;const f=o.$anchor.parent.type;if(!(h=>!(!h.contentMatch.matchType(this.type)||!this.options.nestedColumns&&h.name===Y0.name))(f)){console.warn("content not allowed");return}return n=n.setSelection(o),n=n.replaceSelectionWith(c,!1),r(n)}catch(s){console.error(s)}},setLayout:t=>({commands:e})=>e.updateAttributes("columns",{layout:t})}},renderHTML({HTMLAttributes:t}){return["div",{"data-type":"columns",class:`layout-${t.layout}`},0]},parseHTML(){return[{tag:'div[data-type="columns"]'}]}}),u$=(t,e)=>{const{view:n,state:{selection:{from:r}}}=t,s=document.querySelectorAll(".has-focus"),i=s.length,a=s[i-1];if(a&&a.getAttribute("data-type")&&a.getAttribute("data-type")===e||a&&a.classList&&a.classList.contains(e))return a;const l=n.domAtPos(r).node;let u=l;for(u.tagName||(u=l.parentElement);u&&!(u.getAttribute("data-type")&&u.getAttribute("data-type")===e)&&!u.classList.contains(e);)u=u.parentElement;return u},Qw=N.forwardRef(({children:t,className:e,withShadow:n=!0,withBorder:r=!1,...s},i)=>{const o=he(e,"bg-white rounded",n?"shadow-lg":"",r?"border border-neutral-200":"");return S.jsx("div",{className:o,...s,ref:i,children:t})});Qw.displayName="Surface";const zD=({content:t,children:e})=>{const[n,r]=N.useState(!1);return S.jsxs("div",{className:"relative inline-block",onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[e,n&&S.jsx("div",{className:"absolute z-10 p-2 mt-2 text-sm text-white bg-gray-800 rounded shadow-lg",children:t})]})},$D=N.forwardRef(({shouldShowContent:t=!0,children:e,isVertical:n=!1,className:r,...s},i)=>{const o=he("text-black inline-flex h-full leading-none gap-0.5",n?"flex-col p-2":"flex-row p-1 items-center",r);return t?t&&S.jsx(Qw,{className:o,...s,ref:i,children:e}):null});$D.displayName="Toolbar";const GD=N.forwardRef(({horizontal:t,className:e,...n},r)=>{const s=he("bg-neutral-200",t?"w-full min-w-[1.5rem] h-[1px] my-1 first:mt-0 last:mt-0":"h-full min-h-[1.5rem] w-[1px] mx-1 first:ml-0 last:mr-0",e);return S.jsx("div",{className:s,ref:r,...n})});GD.displayName="Toolbar.Divider";const WD=N.forwardRef(({children:t,buttonSize:e="icon",variant:n="ghost",className:r,tooltip:s,activeClassname:i,...o},a)=>{const l=he("gap-1 min-w-[2rem] px-2 w-auto",r),u=S.jsx(sl,{activeClassname:i,className:l,variant:n,buttonSize:e,ref:a,...o,children:t});return s?S.jsx(zD,{content:s,children:u}):u});WD.displayName="ToolbarButton";const Wu={Wrapper:$D,Divider:GD,Button:WD},c$=({editor:t,appendTo:e})=>{const n=N.useCallback(()=>{const l=u$(t,"columns");return(l==null?void 0:l.getBoundingClientRect())||new DOMRect(-1e3,-1e3,0,0)},[t]),r=N.useCallback(()=>t.isActive("columns"),[t]),s=N.useCallback(()=>{t.chain().focus().setLayout(il.AlignLeft).run()},[t]),i=N.useCallback(()=>{t.chain().focus().setLayout(il.AlignRight).run()},[t]),o=N.useCallback(()=>{t.chain().focus().setLayout(il.AlignCenter).run()},[t]),a=N.useCallback(()=>{t.chain().focus().deleteNode("columns").run()},[t]);return S.jsx(VT,{editor:t,pluginKey:`columnsMenu-${o$()}`,shouldShow:r,updateDelay:0,tippyOptions:{offset:[0,8],popperOptions:{modifiers:[{name:"flip",enabled:!1}]},getReferenceClientRect:n,moveTransition:"transform 0.15s ease-out",duration:200,animation:"shift-toward-subtle",appendTo:()=>e==null?void 0:e.current,plugins:[kU],sticky:"popper"},children:S.jsxs(Wu.Wrapper,{children:[S.jsx(Wu.Button,{tooltip:"Align left",active:t.isActive("columns",{layout:il.AlignLeft}),activeClassname:"bg-yellow-300 hover:brightness-90",onClick:s,children:S.jsx(rV,{size:20})}),S.jsx(Wu.Button,{tooltip:"Align center",active:t.isActive("columns",{layout:il.AlignCenter}),activeClassname:"bg-yellow-300 hover:brightness-90",onClick:o,children:S.jsx(qT,{size:20})}),S.jsx(Wu.Button,{tooltip:"Align right",active:t.isActive("columns",{layout:il.AlignRight}),activeClassname:"bg-yellow-300 hover:brightness-90",onClick:i,children:S.jsx(sV,{size:20})}),S.jsx(Wu.Button,{tooltip:"Remove column",onClick:a,children:S.jsx(ow,{size:20})})]})})},KD=N.createContext(null),X0=()=>N.useContext(KD),f$=({children:t,isPreviewMode:e})=>S.jsx(KD.Provider,{value:e,children:t}),qD=({height:t,width:e})=>S.jsx("span",{className:"flex items-center justify-center ",children:S.jsx("span",{className:`${e?`w-${e}`:"w-8"} ${t?`h-${t}`:"h-8"} border-4 border-t-4 border-t-[#ccc] border-gray-500 rounded-full animate-spin`})}),d$=({editor:t,onError:e})=>{var o;const{toolRef:n,toolVisibilty:r,setToolVisibility:s,toolbar:i}=qw({editor:t,onError:e});return S.jsxs("div",{className:"w-fit bg-transparent px-4 items-center h-16 flex gap-1 justify-center relative",children:[S.jsxs("button",{className:"bg-transparent flex items-center gap-2 min-w-[55px]",onClick:()=>s(Me.FONT_FAMILY),children:[S.jsx("span",{className:"text-sm",children:((o=RD.find(a=>t==null?void 0:t.isActive("textStyle",{fontFamily:a.value})))==null?void 0:o.title)||"Font"}),S.jsx(E0,{size:16})]}),S.jsx("div",{className:"w-[2px] h-4 bg-gray-200 mx-2"}),S.jsxs("button",{className:"bg-transparent gap-2 flex items-center min-w-[55px]",onClick:()=>s(Me.HEADING),children:[S.jsx("span",{className:"text-sm",children:t!=null&&t.isActive("heading",{level:1})?"Heading 1":t!=null&&t.isActive("heading",{level:2})?"Heading 2":t!=null&&t.isActive("heading",{level:3})?"Heading 3":"Text"}),S.jsx(E0,{size:16})]}),S.jsx("div",{className:"w-[2px] h-4 bg-gray-200 mx-2"}),i.map((a,l)=>a?S.jsx("div",{className:"tooltip tooltip-neutral tooltip-bottom text-xs","data-tip":a.title,children:S.jsx("span",{onClick:()=>a.onClick(),className:he("rounded w-8 h-8 p-1 flex cursor-pointer justify-center items-center transition",a.isActive?"bg-yellow-300 hover:brightness-90":"hover:bg-[#f2f2f2]"),children:typeof a.icon=="string"?S.jsx("img",{src:a.icon,className:"w-4"}):a.icon})},a.title):S.jsx("div",{className:"w-[2px] h-4 bg-gray-200 mx-2"},l)),r===Me.FONT_FAMILY&&S.jsx(Xz,{setToolVisibility:s,editor:t,elementRef:n}),r===Me.HEADING&&S.jsx(t$,{setVisibility:s,editor:t,elementRef:n}),r===Me.TEXT_COLOR&&S.jsx(e$,{setVisibility:s,editor:t,elementRef:n}),r===Me.HIGHLIGHT&&S.jsx(PD,{setVisibility:s,editor:t,elementRef:n}),r===Me.ALIGNMENT&&S.jsx(ID,{setToolVisibility:s,editor:t,elementRef:n}),r===Me.LIST&&S.jsx(Zz,{setToolVisibility:s,editor:t,elementRef:n}),r===Me.LINK&&S.jsx(LD,{setToolVisibility:s,editor:t,elementRef:n})]})},zn=()=>new Map,Jw=t=>{const e=zn();return t.forEach((n,r)=>{e.set(r,n)}),e},or=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r},h$=(t,e)=>{const n=[];for(const[r,s]of t)n.push(e(s,r));return n},p$=(t,e)=>{for(const[n,r]of t)if(e(r,n))return!0;return!1},Oi=()=>new Set,Yw=t=>t[t.length-1],m$=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},_i=Array.from,g$=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1},Xw=Array.isArray;class Zw{constructor(){this._observers=zn()}on(e,n){return or(this._observers,e,Oi).add(n),n}once(e,n){const r=(...s)=>{this.off(e,r),n(...s)};this.on(e,r)}off(e,n){const r=this._observers.get(e);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e))}emit(e,n){return _i((this._observers.get(e)||zn()).values()).forEach(r=>r(...n))}destroy(){this._observers=zn()}}class QD{constructor(){this._observers=zn()}on(e,n){or(this._observers,e,Oi).add(n)}once(e,n){const r=(...s)=>{this.off(e,r),n(...s)};this.on(e,r)}off(e,n){const r=this._observers.get(e);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e))}emit(e,n){return _i((this._observers.get(e)||zn()).values()).forEach(r=>r(...n))}destroy(){this._observers=zn()}}const gs=Math.floor,Z0=Math.abs,y$=Math.log10,Lo=(t,e)=>t<e?t:e,Mi=(t,e)=>t>e?t:e,JD=t=>t!==0?t<0:1/t<0,$s=Date.now,b$=1200,w$=2500,em=3e4,eA=t=>{if(t.shouldConnect&&t.ws===null){const e=new WebSocket(t.url),n=t.binaryType;let r=null;n&&(e.binaryType=n),t.ws=e,t.connecting=!0,t.connected=!1,e.onmessage=o=>{t.lastMessageReceived=$s();const a=o.data,l=typeof a=="string"?JSON.parse(a):a;l&&l.type==="pong"&&(clearTimeout(r),r=setTimeout(i,em/2)),t.emit("message",[l,t])};const s=o=>{t.ws!==null&&(t.ws=null,t.connecting=!1,t.connected?(t.connected=!1,t.emit("disconnect",[{type:"disconnect",error:o},t])):t.unsuccessfulReconnects++,setTimeout(eA,Lo(y$(t.unsuccessfulReconnects+1)*b$,w$),t)),clearTimeout(r)},i=()=>{t.ws===e&&t.send({type:"ping"})};e.onclose=()=>s(null),e.onerror=o=>s(o),e.onopen=()=>{t.lastMessageReceived=$s(),t.connecting=!1,t.connected=!0,t.unsuccessfulReconnects=0,t.emit("connect",[{type:"connect"},t]),r=setTimeout(i,em/2)}}};class A$ extends QD{constructor(e,{binaryType:n}={}){super(),this.url=e,this.ws=null,this.binaryType=n||null,this.connected=!1,this.connecting=!1,this.unsuccessfulReconnects=0,this.lastMessageReceived=0,this.shouldConnect=!0,this._checkInterval=setInterval(()=>{this.connected&&em<$s()-this.lastMessageReceived&&this.ws.close()},em/2),eA(this)}send(e){this.ws&&this.ws.send(JSON.stringify(e))}destroy(){clearInterval(this._checkInterval),this.disconnect(),super.destroy()}disconnect(){this.shouldConnect=!1,this.ws!==null&&this.ws.close()}connect(){this.shouldConnect=!0,!this.connected&&this.ws===null&&eA(this)}}const Gs=t=>new Error(t),ys=()=>{throw Gs("Method unimplemented")},Sr=()=>{throw Gs("Unexpected case")},YD=1,XD=2,tA=4,nA=8,Hd=32,Ni=64,Tr=128,tm=31,rA=63,ol=127,v$=2147483647,x$=crypto.getRandomValues.bind(crypto),ZD=Math.random,eO=()=>x$(new Uint32Array(1))[0],k$=t=>t[gs(ZD()*t.length)],E$="10000000-1000-4000-8000"+-1e11,tO=()=>E$.replace(/[018]/g,t=>(t^eO()&15>>t/4).toString(16)),nO=Number.MAX_SAFE_INTEGER,C$=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&gs(t)===t),S$=String.fromCharCode,T$=t=>t.toLowerCase(),D$=/^\s*/g,O$=t=>t.replace(D$,""),_$=/([A-Z])/g,rO=(t,e)=>O$(t.replace(_$,n=>`${e}${T$(n)}`)),M$=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n);for(let s=0;s<n;s++)r[s]=e.codePointAt(s);return r},zd=typeof TextEncoder<"u"?new TextEncoder:null,sA=zd?t=>zd.encode(t):M$;let $d=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});$d&&$d.decode(new Uint8Array).length===1&&($d=null);class Gd{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const un=()=>new Gd,N$=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},Rt=t=>{const e=new Uint8Array(N$(t));let n=0;for(let r=0;r<t.bufs.length;r++){const s=t.bufs[r];e.set(s,n),n+=s.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},R$=(t,e)=>{const n=t.cbuf.length;n-t.cpos<e&&(t.bufs.push(new Uint8Array(t.cbuf.buffer,0,t.cpos)),t.cbuf=new Uint8Array(Mi(n,e)*2),t.cpos=0)},cn=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0),t.cbuf[t.cpos++]=e},Wd=cn,Ne=(t,e)=>{for(;e>ol;)cn(t,Tr|ol&e),e=gs(e/128);cn(t,ol&e)},iA=(t,e)=>{const n=JD(e);for(n&&(e=-e),cn(t,(e>rA?Tr:0)|(n?Ni:0)|rA&e),e=gs(e/64);e>0;)cn(t,(e>ol?Tr:0)|ol&e),e=gs(e/128)},oA=new Uint8Array(3e4),P$=oA.length/3,I$=(t,e)=>{if(e.length<P$){const n=zd.encodeInto(e,oA).written||0;Ne(t,n);for(let r=0;r<n;r++)cn(t,oA[r])}else jt(t,sA(e))},L$=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;Ne(t,r);for(let s=0;s<r;s++)cn(t,n.codePointAt(s))},Ws=zd&&zd.encodeInto?I$:L$,nm=(t,e)=>{const n=t.cbuf.length,r=t.cpos,s=Lo(n-r,e.length),i=e.length-s;t.cbuf.set(e.subarray(0,s),r),t.cpos+=s,i>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(Mi(n*2,i)),t.cbuf.set(e.subarray(s)),t.cpos=i)},jt=(t,e)=>{Ne(t,e.byteLength),nm(t,e)},aA=(t,e)=>{R$(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},B$=(t,e)=>aA(t,4).setFloat32(0,e,!1),F$=(t,e)=>aA(t,8).setFloat64(0,e,!1),j$=(t,e)=>aA(t,8).setBigInt64(0,e,!1),sO=new DataView(new ArrayBuffer(4)),U$=t=>(sO.setFloat32(0,t),sO.getFloat32(0)===t),Ku=(t,e)=>{switch(typeof e){case"string":cn(t,119),Ws(t,e);break;case"number":C$(e)&&Z0(e)<=v$?(cn(t,125),iA(t,e)):U$(e)?(cn(t,124),B$(t,e)):(cn(t,123),F$(t,e));break;case"bigint":cn(t,122),j$(t,e);break;case"object":if(e===null)cn(t,126);else if(Xw(e)){cn(t,117),Ne(t,e.length);for(let n=0;n<e.length;n++)Ku(t,e[n])}else if(e instanceof Uint8Array)cn(t,116),jt(t,e);else{cn(t,118);const n=Object.keys(e);Ne(t,n.length);for(let r=0;r<n.length;r++){const s=n[r];Ws(t,s),Ku(t,e[s])}}break;case"boolean":cn(t,e?120:121);break;default:cn(t,127)}};class iO extends Gd{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&Ne(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const oO=t=>{t.count>0&&(iA(t.encoder,t.count===1?t.s:-t.s),t.count>1&&Ne(t.encoder,t.count-2))};class rm{constructor(){this.encoder=new Gd,this.s=0,this.count=0}write(e){this.s===e?this.count++:(oO(this),this.count=1,this.s=e)}toUint8Array(){return oO(this),Rt(this.encoder)}}const aO=t=>{if(t.count>0){const e=t.diff*2+(t.count===1?0:1);iA(t.encoder,e),t.count>1&&Ne(t.encoder,t.count-2)}};class lA{constructor(){this.encoder=new Gd,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(aO(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return aO(this),Rt(this.encoder)}}class V${constructor(){this.sarr=[],this.s="",this.lensE=new rm}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new Gd;return this.sarr.push(this.s),this.s="",Ws(e,this.sarr.join("")),nm(e,this.lensE.toUint8Array()),Rt(e)}}const lO=Gs("Unexpected end of array"),uO=Gs("Integer out of Range");class sm{constructor(e){this.arr=e,this.pos=0}}const Ks=t=>new sm(t),H$=t=>t.pos!==t.arr.length,z$=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},fn=t=>z$(t,We(t)),al=t=>t.arr[t.pos++],We=t=>{let e=0,n=1;const r=t.arr.length;for(;t.pos<r;){const s=t.arr[t.pos++];if(e=e+(s&ol)*n,n*=128,s<Tr)return e;if(e>nO)throw uO}throw lO},uA=t=>{let e=t.arr[t.pos++],n=e&rA,r=64;const s=(e&Ni)>0?-1:1;if(!(e&Tr))return s*n;const i=t.arr.length;for(;t.pos<i;){if(e=t.arr[t.pos++],n=n+(e&ol)*r,r*=128,e<Tr)return s*n;if(n>nO)throw uO}throw lO},Ri=$d?t=>$d.decode(fn(t)):t=>{let e=We(t);if(e===0)return"";{let n=String.fromCodePoint(al(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(al(t));else for(;e>0;){const r=e<1e4?e:1e4,s=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,n+=String.fromCodePoint.apply(null,s),e-=r}return decodeURIComponent(escape(n))}},cA=(t,e)=>{const n=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,e);return t.pos+=e,n},$$=[t=>{},t=>null,uA,t=>cA(t,4).getFloat32(0,!1),t=>cA(t,8).getFloat64(0,!1),t=>cA(t,8).getBigInt64(0,!1),t=>!1,t=>!0,Ri,t=>{const e=We(t),n={};for(let r=0;r<e;r++){const s=Ri(t);n[s]=qu(t)}return n},t=>{const e=We(t),n=[];for(let r=0;r<e;r++)n.push(qu(t));return n},fn],qu=t=>$$[127-al(t)](t);class cO extends sm{constructor(e,n){super(e),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),H$(this)?this.count=We(this)+1:this.count=-1),this.count--,this.s}}class im extends sm{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=uA(this);const e=JD(this.s);this.count=1,e&&(this.s=-this.s,this.count=We(this)+2)}return this.count--,this.s}}class fA extends sm{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=uA(this),n=e&1;this.diff=gs(e/2),this.count=1,n&&(this.count=We(this)+2)}return this.s+=this.diff,this.count--,this.s}}class G${constructor(e){this.decoder=new im(e),this.str=Ri(this.decoder),this.spos=0}read(){const e=this.spos+this.decoder.read(),n=this.str.slice(this.spos,e);return this.spos=e,n}}const fO=t=>t===void 0?null:t;class W${constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let dO=new W$,dA=!0;try{typeof localStorage<"u"&&localStorage&&(dO=localStorage,dA=!1)}catch{}const hO=dO,K$=t=>dA||addEventListener("storage",t),q$=t=>dA||removeEventListener("storage",t),Q$=Object.assign,hA=Object.keys,J$=(t,e)=>{for(const n in t)e(t[n],n)},pO=t=>hA(t).length,mO=t=>hA(t).length,Y$=t=>{for(const e in t)return!1;return!0},X$=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},gO=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Z$=(t,e)=>t===e||mO(t)===mO(e)&&X$(t,(n,r)=>(n!==void 0||gO(e,r))&&e[r]===n),pA=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&pA(t,e,n+1)}},eG=()=>{},tG=t=>t,nG=(t,e)=>t===e,Kd=(t,e)=>{if(t==null||e==null)return nG(t,e);if(t.constructor!==e.constructor)return!1;if(t===e)return!0;switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:{if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;break}case Set:{if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;break}case Map:{if(t.size!==e.size)return!1;for(const n of t.keys())if(!e.has(n)||!Kd(t.get(n),e.get(n)))return!1;break}case Object:if(pO(t)!==pO(e))return!1;for(const n in t)if(!gO(t,n)||!Kd(t[n],e[n]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!Kd(t[n],e[n]))return!1;break;default:return!1}return!0},rG=(t,e)=>e.includes(t),Qu=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",mA=typeof window<"u"&&typeof document<"u"&&!Qu;let qs;const sG=()=>{if(qs===void 0)if(Qu){qs=zn();const t=process.argv;let e=null;for(let n=0;n<t.length;n++){const r=t[n];r[0]==="-"?(e!==null&&qs.set(e,""),e=r):e!==null&&(qs.set(e,r),e=null)}e!==null&&qs.set(e,"")}else typeof location=="object"?(qs=zn(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");qs.set(`--${rO(e,"-")}`,n),qs.set(`-${rO(e,"-")}`,n)}})):qs=zn();return qs},gA=t=>sG().has(t),om=t=>fO(Qu?process.env[t.toUpperCase().replaceAll("-","_")]:hO.getItem(t));(t=>gA("--"+t)||om(t)!==null)("production");const yO=Qu&&rG(process.env.FORCE_COLOR,["true","1","2"]),iG=!gA("--no-colors")&&(!Qu||process.stdout.isTTY||yO)&&(!Qu||gA("--color")||yO||om("COLORTERM")!==null||(om("TERM")||"").includes("color"));class oG{constructor(e,n){this.left=e,this.right=n}}const Pi=(t,e)=>new oG(t,e),aG=typeof document<"u"?document:{};typeof DOMParser<"u"&&new DOMParser;const lG=t=>h$(t,(e,n)=>`${n}:${e};`).join(""),uG=JSON.stringify,cG=(t=>class{constructor(n){this._=n}destroy(){t(this._)}})(clearTimeout),yA=(t,e)=>new cG(setTimeout(e,t)),Ii=Symbol,Wr=Ii(),ll=Ii(),bO=Ii(),bA=Ii(),wO=Ii(),AO=Ii(),vO=Ii(),am=Ii(),lm=Ii(),fG=t=>{var r;t.length===1&&((r=t[0])==null?void 0:r.constructor)===Function&&(t=t[0]());const e=[];let n=0;for(;n<t.length;n++){const s=t[n];s===void 0||s.constructor===String||s.constructor===Number||s.constructor===Object&&e.push(JSON.stringify(s))}return e},xO=[wO,vO,am,bO];let wA=0,kO=$s();const dG=(t,e)=>{const n=xO[wA],r=om("log"),s=r!==null&&(r==="*"||r==="true"||new RegExp(r,"gi").test(e));return wA=(wA+1)%xO.length,e+=": ",s?(...i)=>{var l;i.length===1&&((l=i[0])==null?void 0:l.constructor)===Function&&(i=i[0]());const o=$s(),a=o-kO;kO=o,t(n,e,lm,...i.map(u=>{switch(u!=null&&u.constructor===Uint8Array&&(u=Array.from(u)),typeof u){case"string":case"symbol":return u;default:return uG(u)}}),n," +"+a+"ms")}:eG},hG={[Wr]:Pi("font-weight","bold"),[ll]:Pi("font-weight","normal"),[bO]:Pi("color","blue"),[wO]:Pi("color","green"),[bA]:Pi("color","grey"),[AO]:Pi("color","red"),[vO]:Pi("color","purple"),[am]:Pi("color","orange"),[lm]:Pi("color","black")},EO=iG?t=>{var o;t.length===1&&((o=t[0])==null?void 0:o.constructor)===Function&&(t=t[0]());const e=[],n=[],r=zn();let s=[],i=0;for(;i<t.length;i++){const a=t[i],l=hG[a];if(l!==void 0)r.set(l.left,l.right);else{if(a===void 0)break;if(a.constructor===String||a.constructor===Number){const u=lG(r);i>0||u.length>0?(e.push("%c"+a),n.push(u)):e.push(a)}else break}}for(i>0&&(s=n,s.unshift(e.join("")));i<t.length;i++){const a=t[i];a instanceof Symbol||s.push(a)}return s}:fG,CO=(...t)=>{console.log(...EO(t)),SO.forEach(e=>e.print(t))},pG=(...t)=>{console.warn(...EO(t)),t.unshift(am),SO.forEach(e=>e.print(t))},SO=Oi(),mG=t=>dG(CO,t),TO=t=>new Promise(t);Promise.all.bind(Promise);const gG=t=>Promise.reject(t),AA=t=>Promise.resolve(t),DO=t=>new Uint8Array(t),yG=(t,e,n)=>new Uint8Array(t,e,n),bG=t=>new Uint8Array(t),wG=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=S$(t[n]);return btoa(e)},AG=t=>Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"),vG=t=>{const e=atob(t),n=DO(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return n},xG=t=>{const e=Buffer.from(t,"base64");return yG(e.buffer,e.byteOffset,e.byteLength)},OO=mA?wG:AG,_O=mA?vG:xG,kG=t=>{const e=DO(t.byteLength);return e.set(t),e},MO=new Map;class EG{constructor(e){this.room=e,this.onmessage=null,this._onChange=n=>n.key===e&&this.onmessage!==null&&this.onmessage({data:_O(n.newValue||"")}),K$(this._onChange)}postMessage(e){hO.setItem(this.room,OO(bG(e)))}close(){q$(this._onChange)}}const CG=typeof BroadcastChannel>"u"?EG:BroadcastChannel,vA=t=>or(MO,t,()=>{const e=Oi(),n=new CG(t);return n.onmessage=r=>e.forEach(s=>s(r.data,"broadcastchannel")),{bc:n,subs:e}}),SG=(t,e)=>(vA(t).subs.add(e),e),TG=(t,e)=>{const n=vA(t),r=n.subs.delete(e);return r&&n.subs.size===0&&(n.bc.close(),MO.delete(t)),r},DG=(t,e,n=null)=>{const r=vA(t);r.bc.postMessage(e),r.subs.forEach(s=>s(e,n))},NO=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}},RO=t=>({[Symbol.iterator](){return this},next:t}),OG=(t,e)=>RO(()=>{let n;do n=t.next();while(!n.done&&!e(n.value));return n}),xA=(t,e)=>RO(()=>{const{done:n,value:r}=t.next();return{done:n,value:n?void 0:e(r)}});class kA{constructor(e,n){this.clock=e,this.len=n}}class Ju{constructor(){this.clients=new Map}}const Bo=(t,e,n)=>e.clients.forEach((r,s)=>{const i=t.doc.store.clients.get(s);for(let o=0;o<r.length;o++){const a=r[o];ZO(t,i,a.clock,a.len,n)}}),_G=(t,e)=>{let n=0,r=t.length-1;for(;n<=r;){const s=gs((n+r)/2),i=t[s],o=i.clock;if(o<=e){if(e<o+i.len)return s;n=s+1}else r=s-1}return null},Yu=(t,e)=>{const n=t.clients.get(e.client);return n!==void 0&&_G(n,e.clock)!==null},EA=t=>{t.clients.forEach(e=>{e.sort((s,i)=>s.clock-i.clock);let n,r;for(n=1,r=1;n<e.length;n++){const s=e[r-1],i=e[n];s.clock+s.len>=i.clock?s.len=Mi(s.len,i.clock+i.len-s.clock):(r<n&&(e[r]=i),r++)}e.length=r})},CA=t=>{const e=new Ju;for(let n=0;n<t.length;n++)t[n].clients.forEach((r,s)=>{if(!e.clients.has(s)){const i=r.slice();for(let o=n+1;o<t.length;o++)m$(i,t[o].clients.get(s)||[]);e.clients.set(s,i)}});return EA(e),e},qd=(t,e,n,r)=>{or(t.clients,e,()=>[]).push(new kA(n,r))},PO=()=>new Ju,IO=t=>{const e=PO();return t.clients.forEach((n,r)=>{const s=[];for(let i=0;i<n.length;i++){const o=n[i];if(o.deleted){const a=o.id.clock;let l=o.length;if(i+1<n.length)for(let u=n[i+1];i+1<n.length&&u.deleted;u=n[++i+1])l+=u.length;s.push(new kA(a,l))}}s.length>0&&e.clients.set(r,s)}),e},Xu=(t,e)=>{Ne(t.restEncoder,e.clients.size),_i(e.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{t.resetDsCurVal(),Ne(t.restEncoder,n);const s=r.length;Ne(t.restEncoder,s);for(let i=0;i<s;i++){const o=r[i];t.writeDsClock(o.clock),t.writeDsLen(o.len)}})},SA=t=>{const e=new Ju,n=We(t.restDecoder);for(let r=0;r<n;r++){t.resetDsCurVal();const s=We(t.restDecoder),i=We(t.restDecoder);if(i>0){const o=or(e.clients,s,()=>[]);for(let a=0;a<i;a++)o.push(new kA(t.readDsClock(),t.readDsLen()))}}return e},LO=(t,e,n)=>{const r=new Ju,s=We(t.restDecoder);for(let i=0;i<s;i++){t.resetDsCurVal();const o=We(t.restDecoder),a=We(t.restDecoder),l=n.clients.get(o)||[],u=zt(n,o);for(let c=0;c<a;c++){const f=t.readDsClock(),d=f+t.readDsLen();if(f<u){u<d&&qd(r,o,u,d-u);let h=Qs(l,f),p=l[h];for(!p.deleted&&p.id.clock<f&&(l.splice(h+1,0,xm(e,p,f-p.id.clock)),h++);h<l.length&&(p=l[h++],p.id.clock<d);)p.deleted||(d<p.id.clock+p.length&&l.splice(h,0,xm(e,p,d-p.id.clock)),p.delete(e))}else qd(r,o,f,d-f)}}if(r.clients.size>0){const i=new cl;return Ne(i.restEncoder,0),Xu(i,r),i.toUint8Array()}return null},BO=eO;class ul extends Zw{constructor({guid:e=tO(),collectionid:n=null,gc:r=!0,gcFilter:s=()=>!0,meta:i=null,autoLoad:o=!1,shouldLoad:a=!0}={}){super(),this.gc=r,this.gcFilter=s,this.clientID=BO(),this.guid=e,this.collectionid=n,this.share=new Map,this.store=new JO,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=a,this.autoLoad=o,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.whenLoaded=TO(u=>{this.on("load",()=>{this.isLoaded=!0,u(this)})});const l=()=>TO(u=>{const c=f=>{(f===void 0||f===!0)&&(this.off("sync",c),u())};this.on("sync",c)});this.on("sync",u=>{u===!1&&this.isSynced&&(this.whenSynced=l()),this.isSynced=u===void 0||u===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=l()}load(){const e=this._item;e!==null&&!this.shouldLoad&&vt(e.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(_i(this.subdocs).map(e=>e.guid))}transact(e,n=null){return vt(this,e,n)}get(e,n=kn){const r=or(this.share,e,()=>{const i=new n;return i._integrate(this,null),i}),s=r.constructor;if(n!==kn&&s!==n)if(s===kn){const i=new n;i._map=r._map,r._map.forEach(o=>{for(;o!==null;o=o.left)o.parent=i}),i._start=r._start;for(let o=i._start;o!==null;o=o.right)o.parent=i;return i._length=r._length,this.share.set(e,i),i._integrate(this,null),i}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return r}getArray(e=""){return this.get(e,rc)}getText(e=""){return this.get(e,dl)}getMap(e=""){return this.get(e,sc)}getXmlElement(e=""){return this.get(e,$n)}getXmlFragment(e=""){return this.get(e,hl)}toJSON(){const e={};return this.share.forEach((n,r)=>{e[r]=n.toJSON()}),e}destroy(){_i(this.subdocs).forEach(n=>n.destroy());const e=this._item;if(e!==null){this._item=null;const n=e.content;n.doc=new ul({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=e,vt(e.parent.doc,r=>{const s=n.doc;e.deleted||r.subdocsAdded.add(s),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class FO{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return We(this.restDecoder)}readDsLen(){return We(this.restDecoder)}}class jO extends FO{readLeftID(){return Ke(We(this.restDecoder),We(this.restDecoder))}readRightID(){return Ke(We(this.restDecoder),We(this.restDecoder))}readClient(){return We(this.restDecoder)}readInfo(){return al(this.restDecoder)}readString(){return Ri(this.restDecoder)}readParentInfo(){return We(this.restDecoder)===1}readTypeRef(){return We(this.restDecoder)}readLen(){return We(this.restDecoder)}readAny(){return qu(this.restDecoder)}readBuf(){return kG(fn(this.restDecoder))}readJSON(){return JSON.parse(Ri(this.restDecoder))}readKey(){return Ri(this.restDecoder)}}class MG{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=We(this.restDecoder),this.dsCurrVal}readDsLen(){const e=We(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class Zu extends MG{constructor(e){super(e),this.keys=[],We(e),this.keyClockDecoder=new fA(fn(e)),this.clientDecoder=new im(fn(e)),this.leftClockDecoder=new fA(fn(e)),this.rightClockDecoder=new fA(fn(e)),this.infoDecoder=new cO(fn(e),al),this.stringDecoder=new G$(fn(e)),this.parentInfoDecoder=new cO(fn(e),al),this.typeRefDecoder=new im(fn(e)),this.lenDecoder=new im(fn(e))}readLeftID(){return new ec(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new ec(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return qu(this.restDecoder)}readBuf(){return fn(this.restDecoder)}readJSON(){return qu(this.restDecoder)}readKey(){const e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{const n=this.stringDecoder.read();return this.keys.push(n),n}}}class UO{constructor(){this.restEncoder=un()}toUint8Array(){return Rt(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){Ne(this.restEncoder,e)}writeDsLen(e){Ne(this.restEncoder,e)}}class Qd extends UO{writeLeftID(e){Ne(this.restEncoder,e.client),Ne(this.restEncoder,e.clock)}writeRightID(e){Ne(this.restEncoder,e.client),Ne(this.restEncoder,e.clock)}writeClient(e){Ne(this.restEncoder,e)}writeInfo(e){Wd(this.restEncoder,e)}writeString(e){Ws(this.restEncoder,e)}writeParentInfo(e){Ne(this.restEncoder,e?1:0)}writeTypeRef(e){Ne(this.restEncoder,e)}writeLen(e){Ne(this.restEncoder,e)}writeAny(e){Ku(this.restEncoder,e)}writeBuf(e){jt(this.restEncoder,e)}writeJSON(e){Ws(this.restEncoder,JSON.stringify(e))}writeKey(e){Ws(this.restEncoder,e)}}class VO{constructor(){this.restEncoder=un(),this.dsCurrVal=0}toUint8Array(){return Rt(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const n=e-this.dsCurrVal;this.dsCurrVal=e,Ne(this.restEncoder,n)}writeDsLen(e){e===0&&Sr(),Ne(this.restEncoder,e-1),this.dsCurrVal+=e}}class cl extends VO{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new lA,this.clientEncoder=new rm,this.leftClockEncoder=new lA,this.rightClockEncoder=new lA,this.infoEncoder=new iO(Wd),this.stringEncoder=new V$,this.parentInfoEncoder=new iO(Wd),this.typeRefEncoder=new rm,this.lenEncoder=new rm}toUint8Array(){const e=un();return Ne(e,0),jt(e,this.keyClockEncoder.toUint8Array()),jt(e,this.clientEncoder.toUint8Array()),jt(e,this.leftClockEncoder.toUint8Array()),jt(e,this.rightClockEncoder.toUint8Array()),jt(e,Rt(this.infoEncoder)),jt(e,this.stringEncoder.toUint8Array()),jt(e,Rt(this.parentInfoEncoder)),jt(e,this.typeRefEncoder.toUint8Array()),jt(e,this.lenEncoder.toUint8Array()),nm(e,Rt(this.restEncoder)),Rt(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){Ku(this.restEncoder,e)}writeBuf(e){jt(this.restEncoder,e)}writeJSON(e){Ku(this.restEncoder,e)}writeKey(e){const n=this.keyMap.get(e);n===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(n)}}const NG=(t,e,n,r)=>{r=Mi(r,e[0].id.clock);const s=Qs(e,r);Ne(t.restEncoder,e.length-s),t.writeClient(n),Ne(t.restEncoder,r);const i=e[s];i.write(t,r-i.id.clock);for(let o=s+1;o<e.length;o++)e[o].write(t,0)},TA=(t,e,n)=>{const r=new Map;n.forEach((s,i)=>{zt(e,i)>s&&r.set(i,s)}),eh(e).forEach((s,i)=>{n.has(i)||r.set(i,0)}),Ne(t.restEncoder,r.size),_i(r.entries()).sort((s,i)=>i[0]-s[0]).forEach(([s,i])=>{NG(t,e.clients.get(s),s,i)})},RG=(t,e)=>{const n=zn(),r=We(t.restDecoder);for(let s=0;s<r;s++){const i=We(t.restDecoder),o=new Array(i),a=t.readClient();let l=We(t.restDecoder);n.set(a,{i:0,refs:o});for(let u=0;u<i;u++){const c=t.readInfo();switch(tm&c){case 0:{const f=t.readLen();o[u]=new Kr(Ke(a,l),f),l+=f;break}case 10:{const f=We(t.restDecoder);o[u]=new qr(Ke(a,l),f),l+=f;break}default:{const f=(c&(Ni|Tr))===0,d=new Et(Ke(a,l),null,(c&Tr)===Tr?t.readLeftID():null,null,(c&Ni)===Ni?t.readRightID():null,f?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,f&&(c&Hd)===Hd?t.readString():null,__(t,c));o[u]=d,l+=d.length}}}}return n},PG=(t,e,n)=>{const r=[];let s=_i(n.keys()).sort((h,p)=>h-p);if(s.length===0)return null;const i=()=>{if(s.length===0)return null;let h=n.get(s[s.length-1]);for(;h.refs.length===h.i;)if(s.pop(),s.length>0)h=n.get(s[s.length-1]);else return null;return h};let o=i();if(o===null)return null;const a=new JO,l=new Map,u=(h,p)=>{const m=l.get(h);(m==null||m>p)&&l.set(h,p)};let c=o.refs[o.i++];const f=new Map,d=()=>{for(const h of r){const p=h.id.client,m=n.get(p);m?(m.i--,a.clients.set(p,m.refs.slice(m.i)),n.delete(p),m.i=0,m.refs=[]):a.clients.set(p,[h]),s=s.filter(g=>g!==p)}r.length=0};for(;;){if(c.constructor!==qr){const p=or(f,c.id.client,()=>zt(e,c.id.client))-c.id.clock;if(p<0)r.push(c),u(c.id.client,c.id.clock-1),d();else{const m=c.getMissing(t,e);if(m!==null){r.push(c);const g=n.get(m)||{refs:[],i:0};if(g.refs.length===g.i)u(m,zt(e,m)),d();else{c=g.refs[g.i++];continue}}else(p===0||p<c.length)&&(c.integrate(t,p),f.set(c.id.client,c.id.clock+c.length))}}if(r.length>0)c=r.pop();else if(o!==null&&o.i<o.refs.length)c=o.refs[o.i++];else{if(o=i(),o===null)break;c=o.refs[o.i++]}}if(a.clients.size>0){const h=new cl;return TA(h,a,new Map),Ne(h.restEncoder,0),{missing:l,update:h.toUint8Array()}}return null},IG=(t,e)=>TA(t,e.doc.store,e.beforeState),LG=(t,e,n,r=new Zu(t))=>vt(e,s=>{s.local=!1;let i=!1;const o=s.doc,a=o.store,l=RG(r,o),u=PG(s,a,l),c=a.pendingStructs;if(c){for(const[d,h]of c.missing)if(h<zt(a,d)){i=!0;break}if(u){for(const[d,h]of u.missing){const p=c.missing.get(d);(p==null||p>h)&&c.missing.set(d,h)}c.update=dm([c.update,u.update])}}else a.pendingStructs=u;const f=LO(r,s,a);if(a.pendingDs){const d=new Zu(Ks(a.pendingDs));We(d.restDecoder);const h=LO(d,s,a);f&&h?a.pendingDs=dm([f,h]):a.pendingDs=f||h}else a.pendingDs=f;if(i){const d=a.pendingStructs.update;a.pendingStructs=null,um(s.doc,d)}},n,!1),um=(t,e,n,r=Zu)=>{const s=Ks(e);LG(s,t,n,new r(s))},BG=(t,e,n)=>um(t,e,n,jO),FG=(t,e,n=new Map)=>{TA(t,e.store,n),Xu(t,IO(e.store))},jG=(t,e=new Uint8Array([0]),n=new cl)=>{const r=HO(e);FG(n,t,r);const s=[n.toUint8Array()];if(t.store.pendingDs&&s.push(t.store.pendingDs),t.store.pendingStructs&&s.push(rW(t.store.pendingStructs.update,e)),s.length>1){if(n.constructor===Qd)return tW(s.map((i,o)=>o===0?i:iW(i)));if(n.constructor===cl)return dm(s)}return s[0]},UG=(t,e)=>jG(t,e,new Qd),VG=t=>{const e=new Map,n=We(t.restDecoder);for(let r=0;r<n;r++){const s=We(t.restDecoder),i=We(t.restDecoder);e.set(s,i)}return e},HO=t=>VG(new FO(Ks(t))),zO=(t,e)=>(Ne(t.restEncoder,e.size),_i(e.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{Ne(t.restEncoder,n),Ne(t.restEncoder,r)}),t),HG=(t,e)=>zO(t,eh(e.store)),zG=(t,e=new VO)=>(t instanceof Map?zO(e,t):HG(e,t),e.toUint8Array()),$G=t=>zG(t,new UO);class GG{constructor(){this.l=[]}}const $O=()=>new GG,GO=(t,e)=>t.l.push(e),WO=(t,e)=>{const n=t.l,r=n.length;t.l=n.filter(s=>e!==s),r===t.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},KO=(t,e,n)=>pA(t.l,[e,n]);class ec{constructor(e,n){this.client=e,this.clock=n}}const tc=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,Ke=(t,e)=>new ec(t,e),Jd=t=>{for(const[e,n]of t.doc.share.entries())if(n===t)return e;throw Sr()},Yd=(t,e)=>{for(;e!==null;){if(e.parent===t)return!0;e=e.parent._item}return!1};class Xd{constructor(e,n,r,s=0){this.type=e,this.tname=n,this.item=r,this.assoc=s}}const Zd=t=>new Xd(t.type==null?null:Ke(t.type.client,t.type.clock),t.tname??null,t.item==null?null:Ke(t.item.client,t.item.clock),t.assoc==null?0:t.assoc);class WG{constructor(e,n,r=0){this.type=e,this.index=n,this.assoc=r}}const KG=(t,e,n=0)=>new WG(t,e,n),cm=(t,e,n)=>{let r=null,s=null;return t._item===null?s=Jd(t):r=Ke(t._item.id.client,t._item.id.clock),new Xd(r,s,e,n)},DA=(t,e,n=0)=>{let r=t._start;if(n<0){if(e===0)return cm(t,null,n);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return cm(t,Ke(r.id.client,r.id.clock+e),n);e-=r.length}if(r.right===null&&n<0)return cm(t,r.lastId,n);r=r.right}return cm(t,null,n)},qG=(t,e,n=!0)=>{const r=e.store,s=t.item,i=t.type,o=t.tname,a=t.assoc;let l=null,u=0;if(s!==null){if(zt(r,s.client)<=s.clock)return null;const c=n?zA(r,s):{item:nc(r,s),diff:0},f=c.item;if(!(f instanceof Et))return null;if(l=f.parent,l._item===null||!l._item.deleted){u=f.deleted||!f.countable?0:c.diff+(a>=0?0:1);let d=f.left;for(;d!==null;)!d.deleted&&d.countable&&(u+=d.length),d=d.left}}else{if(o!==null)l=e.get(o);else if(i!==null){if(zt(r,i.client)<=i.clock)return null;const{item:c}=n?zA(r,i):{item:nc(r,i)};if(c instanceof Et&&c.content instanceof ws)l=c.content.type;else return null}else throw Sr();a>=0?u=l._length:u=0}return KG(l,u,t.assoc)},qO=(t,e)=>t===e||t!==null&&e!==null&&t.tname===e.tname&&tc(t.item,e.item)&&tc(t.type,e.type)&&t.assoc===e.assoc;class OA{constructor(e,n){this.ds=e,this.sv=n}}const QO=(t,e)=>new OA(t,e),_A=t=>QO(IO(t.store),eh(t.store)),fl=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!Yu(e.ds,t.id),MA=(t,e)=>{const n=or(t.meta,MA,Oi),r=t.doc.store;n.has(e)||(e.sv.forEach((s,i)=>{s<zt(r,i)&&ar(t,Ke(i,s))}),Bo(t,e.ds,s=>{}),n.add(e))};class JO{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const eh=t=>{const e=new Map;return t.clients.forEach((n,r)=>{const s=n[n.length-1];e.set(r,s.id.clock+s.length)}),e},zt=(t,e)=>{const n=t.clients.get(e);if(n===void 0)return 0;const r=n[n.length-1];return r.id.clock+r.length},YO=(t,e)=>{let n=t.clients.get(e.id.client);if(n===void 0)n=[],t.clients.set(e.id.client,n);else{const r=n[n.length-1];if(r.id.clock+r.length!==e.id.clock)throw Sr()}n.push(e)},Qs=(t,e)=>{let n=0,r=t.length-1,s=t[r],i=s.id.clock;if(i===e)return r;let o=gs(e/(i+s.length-1)*r);for(;n<=r;){if(s=t[o],i=s.id.clock,i<=e){if(e<i+s.length)return o;n=o+1}else r=o-1;o=gs((n+r)/2)}throw Sr()},nc=(t,e)=>{const n=t.clients.get(e.client);return n[Qs(n,e.clock)]},NA=(t,e,n)=>{const r=Qs(e,n),s=e[r];return s.id.clock<n&&s instanceof Et?(e.splice(r+1,0,xm(t,s,n-s.id.clock)),r+1):r},ar=(t,e)=>{const n=t.doc.store.clients.get(e.client);return n[NA(t,n,e.clock)]},XO=(t,e,n)=>{const r=e.clients.get(n.client),s=Qs(r,n.clock),i=r[s];return n.clock!==i.id.clock+i.length-1&&i.constructor!==Kr&&r.splice(s+1,0,xm(t,i,n.clock-i.id.clock+1)),i},QG=(t,e,n)=>{const r=t.clients.get(e.id.client);r[Qs(r,e.id.clock)]=n},ZO=(t,e,n,r,s)=>{if(r===0)return;const i=n+r;let o=NA(t,e,n),a;do a=e[o++],i<a.id.clock+a.length&&NA(t,e,i),s(a);while(o<e.length&&e[o].id.clock<i)};let JG=class{constructor(e,n,r){this.doc=e,this.deleteSet=new Ju,this.beforeState=eh(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=n,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}};const e_=(t,e)=>e.deleteSet.clients.size===0&&!p$(e.afterState,(n,r)=>e.beforeState.get(r)!==n)?!1:(EA(e.deleteSet),IG(t,e),Xu(t,e.deleteSet),!0),t_=(t,e,n)=>{const r=e._item;(r===null||r.id.clock<(t.beforeState.get(r.id.client)||0)&&!r.deleted)&&or(t.changed,e,Oi).add(n)},fm=(t,e)=>{let n=t[e],r=t[e-1],s=e;for(;s>0;n=r,r=t[--s-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof Et&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}const i=e-s;return i&&t.splice(e+1-i,i),i},YG=(t,e,n)=>{for(const[r,s]of t.clients.entries()){const i=e.clients.get(r);for(let o=s.length-1;o>=0;o--){const a=s[o],l=a.clock+a.len;for(let u=Qs(i,a.clock),c=i[u];u<i.length&&c.id.clock<l;c=i[++u]){const f=i[u];if(a.clock+a.len<=f.id.clock)break;f instanceof Et&&f.deleted&&!f.keep&&n(f)&&f.gc(e,!1)}}}},XG=(t,e)=>{t.clients.forEach((n,r)=>{const s=e.clients.get(r);for(let i=n.length-1;i>=0;i--){const o=n[i],a=Lo(s.length-1,1+Qs(s,o.clock+o.len-1));for(let l=a,u=s[l];l>0&&u.id.clock>=o.clock;u=s[l])l-=1+fm(s,l)}})},n_=(t,e)=>{if(e<t.length){const n=t[e],r=n.doc,s=r.store,i=n.deleteSet,o=n._mergeStructs;try{EA(i),n.afterState=eh(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const a=[];n.changed.forEach((l,u)=>a.push(()=>{(u._item===null||!u._item.deleted)&&u._callObserver(n,l)})),a.push(()=>{n.changedParentTypes.forEach((l,u)=>{u._dEH.l.length>0&&(u._item===null||!u._item.deleted)&&(l=l.filter(c=>c.target._item===null||!c.target._item.deleted),l.forEach(c=>{c.currentTarget=u,c._path=null}),l.sort((c,f)=>c.path.length-f.path.length),KO(u._dEH,l,n))})}),a.push(()=>r.emit("afterTransaction",[n,r])),pA(a,[]),n._needFormattingCleanup&&wW(n)}finally{r.gc&&YG(i,s,r.gcFilter),XG(i,s),n.afterState.forEach((c,f)=>{const d=n.beforeState.get(f)||0;if(d!==c){const h=s.clients.get(f),p=Mi(Qs(h,d),1);for(let m=h.length-1;m>=p;)m-=1+fm(h,m)}});for(let c=o.length-1;c>=0;c--){const{client:f,clock:d}=o[c].id,h=s.clients.get(f),p=Qs(h,d);p+1<h.length&&fm(h,p+1)>1||p>0&&fm(h,p)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(CO(am,Wr,"[yjs] ",ll,AO,"Changed the client-id because another client seems to be using it."),r.clientID=BO()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const c=new Qd;e_(c,n)&&r.emit("update",[c.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const c=new cl;e_(c,n)&&r.emit("updateV2",[c.toUint8Array(),n.origin,r,n])}const{subdocsAdded:a,subdocsLoaded:l,subdocsRemoved:u}=n;(a.size>0||u.size>0||l.size>0)&&(a.forEach(c=>{c.clientID=r.clientID,c.collectionid==null&&(c.collectionid=r.collectionid),r.subdocs.add(c)}),u.forEach(c=>r.subdocs.delete(c)),r.emit("subdocs",[{loaded:l,added:a,removed:u},r,n]),u.forEach(c=>c.destroy())),t.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,t])):n_(t,e+1)}}},vt=(t,e,n=null,r=!0)=>{const s=t._transactionCleanups;let i=!1,o=null;t._transaction===null&&(i=!0,t._transaction=new JG(t,n,r),s.push(t._transaction),s.length===1&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{o=e(t._transaction)}finally{if(i){const a=t._transaction===s[0];t._transaction=null,a&&n_(s,0)}}return o};class ZG{constructor(e,n){this.insertions=n,this.deletions=e,this.meta=new Map}}const r_=(t,e,n)=>{Bo(t,n.deletions,r=>{r instanceof Et&&e.scope.some(s=>Yd(s,r))&&$A(r,!1)})},s_=(t,e,n)=>{let r=null;const s=t.doc,i=t.scope;vt(s,a=>{for(;e.length>0&&t.currStackItem===null;){const l=s.store,u=e.pop(),c=new Set,f=[];let d=!1;Bo(a,u.insertions,h=>{if(h instanceof Et){if(h.redone!==null){let{item:p,diff:m}=zA(l,h.id);m>0&&(p=ar(a,Ke(p.id.client,p.id.clock+m))),h=p}!h.deleted&&i.some(p=>Yd(p,h))&&f.push(h)}}),Bo(a,u.deletions,h=>{h instanceof Et&&i.some(p=>Yd(p,h))&&!Yu(u.insertions,h.id)&&c.add(h)}),c.forEach(h=>{d=O_(a,h,c,u.insertions,t.ignoreRemoteMapChanges,t)!==null||d});for(let h=f.length-1;h>=0;h--){const p=f[h];t.deleteFilter(p)&&(p.delete(a),d=!0)}t.currStackItem=d?u:null}a.changed.forEach((l,u)=>{l.has(null)&&u._searchMarker&&(u._searchMarker.length=0)}),r=a},t);const o=t.currStackItem;if(o!=null){const a=r.changedParentTypes;t.emit("stack-item-popped",[{stackItem:o,type:n,changedParentTypes:a,origin:t},t]),t.currStackItem=null}return o};class i_ extends Zw{constructor(e,{captureTimeout:n=500,captureTransaction:r=l=>!0,deleteFilter:s=()=>!0,trackedOrigins:i=new Set([null]),ignoreRemoteMapChanges:o=!1,doc:a=Xw(e)?e[0].doc:e.doc}={}){super(),this.scope=[],this.doc=a,this.addToScope(e),this.deleteFilter=s,i.add(this),this.trackedOrigins=i,this.captureTransaction=r,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=o,this.captureTimeout=n,this.afterTransactionHandler=l=>{if(!this.captureTransaction(l)||!this.scope.some(g=>l.changedParentTypes.has(g))||!this.trackedOrigins.has(l.origin)&&(!l.origin||!this.trackedOrigins.has(l.origin.constructor)))return;const u=this.undoing,c=this.redoing,f=u?this.redoStack:this.undoStack;u?this.stopCapturing():c||this.clear(!1,!0);const d=new Ju;l.afterState.forEach((g,y)=>{const v=l.beforeState.get(y)||0,w=g-v;w>0&&qd(d,y,v,w)});const h=$s();let p=!1;if(this.lastChange>0&&h-this.lastChange<this.captureTimeout&&f.length>0&&!u&&!c){const g=f[f.length-1];g.deletions=CA([g.deletions,l.deleteSet]),g.insertions=CA([g.insertions,d])}else f.push(new ZG(l.deleteSet,d)),p=!0;!u&&!c&&(this.lastChange=h),Bo(l,l.deleteSet,g=>{g instanceof Et&&this.scope.some(y=>Yd(y,g))&&$A(g,!0)});const m=[{stackItem:f[f.length-1],origin:l.origin,type:u?"redo":"undo",changedParentTypes:l.changedParentTypes},this];p?this.emit("stack-item-added",m):this.emit("stack-item-updated",m)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(e){e=Xw(e)?e:[e],e.forEach(n=>{this.scope.every(r=>r!==n)&&(n.doc!==this.doc&&pG("[yjs#509] Not same Y.Doc"),this.scope.push(n))})}addTrackedOrigin(e){this.trackedOrigins.add(e)}removeTrackedOrigin(e){this.trackedOrigins.delete(e)}clear(e=!0,n=!0){(e&&this.canUndo()||n&&this.canRedo())&&this.doc.transact(r=>{e&&(this.undoStack.forEach(s=>r_(r,this,s)),this.undoStack=[]),n&&(this.redoStack.forEach(s=>r_(r,this,s)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:e,redoStackCleared:n}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=s_(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=s_(this,this.redoStack,"redo")}finally{this.redoing=!1}return e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),super.destroy()}}function*eW(t){const e=We(t.restDecoder);for(let n=0;n<e;n++){const r=We(t.restDecoder),s=t.readClient();let i=We(t.restDecoder);for(let o=0;o<r;o++){const a=t.readInfo();if(a===10){const l=We(t.restDecoder);yield new qr(Ke(s,i),l),i+=l}else if(tm&a){const l=(a&(Ni|Tr))===0,u=new Et(Ke(s,i),null,(a&Tr)===Tr?t.readLeftID():null,null,(a&Ni)===Ni?t.readRightID():null,l?t.readParentInfo()?t.readString():t.readLeftID():null,l&&(a&Hd)===Hd?t.readString():null,__(t,a));yield u,i+=u.length}else{const l=t.readLen();yield new Kr(Ke(s,i),l),i+=l}}}}class RA{constructor(e,n){this.gen=eW(e),this.curr=null,this.done=!1,this.filterSkips=n,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===qr);return this.curr}}class PA{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}const tW=t=>dm(t,jO,Qd),nW=(t,e)=>{if(t.constructor===Kr){const{client:n,clock:r}=t.id;return new Kr(Ke(n,r+e),t.length-e)}else if(t.constructor===qr){const{client:n,clock:r}=t.id;return new qr(Ke(n,r+e),t.length-e)}else{const n=t,{client:r,clock:s}=n.id;return new Et(Ke(r,s+e),null,Ke(r,s+e-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(e))}},dm=(t,e=Zu,n=cl)=>{if(t.length===1)return t[0];const r=t.map(c=>new e(Ks(c)));let s=r.map(c=>new RA(c,!0)),i=null;const o=new n,a=new PA(o);for(;s=s.filter(d=>d.curr!==null),s.sort((d,h)=>{if(d.curr.id.client===h.curr.id.client){const p=d.curr.id.clock-h.curr.id.clock;return p===0?d.curr.constructor===h.curr.constructor?0:d.curr.constructor===qr?1:-1:p}else return h.curr.id.client-d.curr.id.client}),s.length!==0;){const c=s[0],f=c.curr.id.client;if(i!==null){let d=c.curr,h=!1;for(;d!==null&&d.id.clock+d.length<=i.struct.id.clock+i.struct.length&&d.id.client>=i.struct.id.client;)d=c.next(),h=!0;if(d===null||d.id.client!==f||h&&d.id.clock>i.struct.id.clock+i.struct.length)continue;if(f!==i.struct.id.client)Fo(a,i.struct,i.offset),i={struct:d,offset:0},c.next();else if(i.struct.id.clock+i.struct.length<d.id.clock)if(i.struct.constructor===qr)i.struct.length=d.id.clock+d.length-i.struct.id.clock;else{Fo(a,i.struct,i.offset);const p=d.id.clock-i.struct.id.clock-i.struct.length;i={struct:new qr(Ke(f,i.struct.id.clock+i.struct.length),p),offset:0}}else{const p=i.struct.id.clock+i.struct.length-d.id.clock;p>0&&(i.struct.constructor===qr?i.struct.length-=p:d=nW(d,p)),i.struct.mergeWith(d)||(Fo(a,i.struct,i.offset),i={struct:d,offset:0},c.next())}}else i={struct:c.curr,offset:0},c.next();for(let d=c.curr;d!==null&&d.id.client===f&&d.id.clock===i.struct.id.clock+i.struct.length&&d.constructor!==qr;d=c.next())Fo(a,i.struct,i.offset),i={struct:d,offset:0}}i!==null&&(Fo(a,i.struct,i.offset),i=null),IA(a);const l=r.map(c=>SA(c)),u=CA(l);return Xu(o,u),o.toUint8Array()},rW=(t,e,n=Zu,r=cl)=>{const s=HO(e),i=new r,o=new PA(i),a=new n(Ks(t)),l=new RA(a,!1);for(;l.curr;){const c=l.curr,f=c.id.client,d=s.get(f)||0;if(l.curr.constructor===qr){l.next();continue}if(c.id.clock+c.length>d)for(Fo(o,c,Mi(d-c.id.clock,0)),l.next();l.curr&&l.curr.id.client===f;)Fo(o,l.curr,0),l.next();else for(;l.curr&&l.curr.id.client===f&&l.curr.id.clock+l.curr.length<=d;)l.next()}IA(o);const u=SA(a);return Xu(i,u),i.toUint8Array()},o_=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:Rt(t.encoder.restEncoder)}),t.encoder.restEncoder=un(),t.written=0)},Fo=(t,e,n)=>{t.written>0&&t.currClient!==e.id.client&&o_(t),t.written===0&&(t.currClient=e.id.client,t.encoder.writeClient(e.id.client),Ne(t.encoder.restEncoder,e.id.clock+n)),e.write(t.encoder,n),t.written++},IA=t=>{o_(t);const e=t.encoder.restEncoder;Ne(e,t.clientStructs.length);for(let n=0;n<t.clientStructs.length;n++){const r=t.clientStructs[n];Ne(e,r.written),nm(e,r.restEncoder)}},sW=(t,e,n,r)=>{const s=new n(Ks(t)),i=new RA(s,!1),o=new r,a=new PA(o);for(let u=i.curr;u!==null;u=i.next())Fo(a,e(u),0);IA(a);const l=SA(s);return Xu(o,l),o.toUint8Array()},iW=t=>sW(t,tG,Zu,Qd),a_="You must not compute changes after the event-handler fired.";class hm{constructor(e,n){this.target=e,this.currentTarget=e,this.transaction=n,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=oW(this.currentTarget,this.target))}deletes(e){return Yu(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Gs(a_);const e=new Map,n=this.target;this.transaction.changed.get(n).forEach(s=>{if(s!==null){const i=n._map.get(s);let o,a;if(this.adds(i)){let l=i.left;for(;l!==null&&this.adds(l);)l=l.left;if(this.deletes(i))if(l!==null&&this.deletes(l))o="delete",a=Yw(l.content.getContent());else return;else l!==null&&this.deletes(l)?(o="update",a=Yw(l.content.getContent())):(o="add",a=void 0)}else if(this.deletes(i))o="delete",a=Yw(i.content.getContent());else return;e.set(s,{action:o,oldValue:a})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw Gs(a_);const n=this.target,r=Oi(),s=Oi(),i=[];if(e={added:r,deleted:s,delta:i,keys:this.keys},this.transaction.changed.get(n).has(null)){let a=null;const l=()=>{a&&i.push(a)};for(let u=n._start;u!==null;u=u.right)u.deleted?this.deletes(u)&&!this.adds(u)&&((a===null||a.delete===void 0)&&(l(),a={delete:0}),a.delete+=u.length,s.add(u)):this.adds(u)?((a===null||a.insert===void 0)&&(l(),a={insert:[]}),a.insert=a.insert.concat(u.content.getContent()),r.add(u)):((a===null||a.retain===void 0)&&(l(),a={retain:0}),a.retain+=u.length);a!==null&&a.retain===void 0&&l()}this._changes=e}return e}}const oW=(t,e)=>{const n=[];for(;e._item!==null&&e!==t;){if(e._item.parentSub!==null)n.unshift(e._item.parentSub);else{let r=0,s=e._item.parent._start;for(;s!==e._item&&s!==null;)!s.deleted&&s.countable&&(r+=s.length),s=s.right;n.unshift(r)}e=e._item.parent}return n},l_=80;let LA=0;class aW{constructor(e,n){e.marker=!0,this.p=e,this.index=n,this.timestamp=LA++}}const lW=t=>{t.timestamp=LA++},u_=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=LA++},uW=(t,e,n)=>{if(t.length>=l_){const r=t.reduce((s,i)=>s.timestamp<i.timestamp?s:i);return u_(r,e,n),r}else{const r=new aW(e,n);return t.push(r),r}},pm=(t,e)=>{if(t._start===null||e===0||t._searchMarker===null)return null;const n=t._searchMarker.length===0?null:t._searchMarker.reduce((i,o)=>Z0(e-i.index)<Z0(e-o.index)?i:o);let r=t._start,s=0;for(n!==null&&(r=n.p,s=n.index,lW(n));r.right!==null&&s<e;){if(!r.deleted&&r.countable){if(e<s+r.length)break;s+=r.length}r=r.right}for(;r.left!==null&&s>e;)r=r.left,!r.deleted&&r.countable&&(s-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(s-=r.length);return n!==null&&Z0(n.index-s)<r.parent.length/l_?(u_(n,r,s),n):uW(t._searchMarker,r,s)},th=(t,e,n)=>{for(let r=t.length-1;r>=0;r--){const s=t[r];if(n>0){let i=s.p;for(i.marker=!1;i&&(i.deleted||!i.countable);)i=i.left,i&&!i.deleted&&i.countable&&(s.index-=i.length);if(i===null||i.marker===!0){t.splice(r,1);continue}s.p=i,i.marker=!0}(e<s.index||n>0&&e===s.index)&&(s.index=Mi(e,s.index+n))}},mm=(t,e,n)=>{const r=t,s=e.changedParentTypes;for(;or(s,t,()=>[]).push(n),t._item!==null;)t=t._item.parent;KO(r._eH,n,e)};class kn{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=$O(),this._dEH=$O(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,n){this.doc=e,this._item=n}_copy(){throw ys()}clone(){throw ys()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,n){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){GO(this._eH,e)}observeDeep(e){GO(this._dEH,e)}unobserve(e){WO(this._eH,e)}unobserveDeep(e){WO(this._dEH,e)}toJSON(){}}const c_=(t,e,n)=>{e<0&&(e=t._length+e),n<0&&(n=t._length+n);let r=n-e;const s=[];let i=t._start;for(;i!==null&&r>0;){if(i.countable&&!i.deleted){const o=i.content.getContent();if(o.length<=e)e-=o.length;else{for(let a=e;a<o.length&&r>0;a++)s.push(o[a]),r--;e=0}}i=i.right}return s},f_=t=>{const e=[];let n=t._start;for(;n!==null;){if(n.countable&&!n.deleted){const r=n.content.getContent();for(let s=0;s<r.length;s++)e.push(r[s])}n=n.right}return e},d_=(t,e)=>{const n=[];let r=t._start;for(;r!==null;){if(r.countable&&fl(r,e)){const s=r.content.getContent();for(let i=0;i<s.length;i++)n.push(s[i])}r=r.right}return n},nh=(t,e)=>{let n=0,r=t._start;for(;r!==null;){if(r.countable&&!r.deleted){const s=r.content.getContent();for(let i=0;i<s.length;i++)e(s[i],n++,t)}r=r.right}},h_=(t,e)=>{const n=[];return nh(t,(r,s)=>{n.push(e(r,s,t))}),n},cW=t=>{let e=t._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;e!==null&&e.deleted;)e=e.right;if(e===null)return{done:!0,value:void 0};n=e.content.getContent(),r=0,e=e.right}const s=n[r++];return n.length<=r&&(n=null),{done:!1,value:s}}}},p_=(t,e)=>{const n=pm(t,e);let r=t._start;for(n!==null&&(r=n.p,e-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(e<r.length)return r.content.getContent()[e];e-=r.length}},gm=(t,e,n,r)=>{let s=n;const i=t.doc,o=i.clientID,a=i.store,l=n===null?e._start:n.right;let u=[];const c=()=>{u.length>0&&(s=new Et(Ke(o,zt(a,o)),s,s&&s.lastId,l,l&&l.id,e,null,new ml(u)),s.integrate(t,0),u=[])};r.forEach(f=>{if(f===null)u.push(f);else switch(f.constructor){case Number:case Object:case Boolean:case Array:case String:u.push(f);break;default:switch(c(),f.constructor){case Uint8Array:case ArrayBuffer:s=new Et(Ke(o,zt(a,o)),s,s&&s.lastId,l,l&&l.id,e,null,new rh(new Uint8Array(f))),s.integrate(t,0);break;case ul:s=new Et(Ke(o,zt(a,o)),s,s&&s.lastId,l,l&&l.id,e,null,new ih(f)),s.integrate(t,0);break;default:if(f instanceof kn)s=new Et(Ke(o,zt(a,o)),s,s&&s.lastId,l,l&&l.id,e,null,new ws(f)),s.integrate(t,0);else throw new Error("Unexpected content type in insert operation")}}}),c()},m_=()=>Gs("Length exceeded!"),g_=(t,e,n,r)=>{if(n>e._length)throw m_();if(n===0)return e._searchMarker&&th(e._searchMarker,n,r.length),gm(t,e,null,r);const s=n,i=pm(e,n);let o=e._start;for(i!==null&&(o=i.p,n-=i.index,n===0&&(o=o.prev,n+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(n<=o.length){n<o.length&&ar(t,Ke(o.id.client,o.id.clock+n));break}n-=o.length}return e._searchMarker&&th(e._searchMarker,s,r.length),gm(t,e,o,r)},fW=(t,e,n)=>{let s=(e._searchMarker||[]).reduce((i,o)=>o.index>i.index?o:i,{index:0,p:e._start}).p;if(s)for(;s.right;)s=s.right;return gm(t,e,s,n)},y_=(t,e,n,r)=>{if(r===0)return;const s=n,i=r,o=pm(e,n);let a=e._start;for(o!==null&&(a=o.p,n-=o.index);a!==null&&n>0;a=a.right)!a.deleted&&a.countable&&(n<a.length&&ar(t,Ke(a.id.client,a.id.clock+n)),n-=a.length);for(;r>0&&a!==null;)a.deleted||(r<a.length&&ar(t,Ke(a.id.client,a.id.clock+r)),a.delete(t),r-=a.length),a=a.right;if(r>0)throw m_();e._searchMarker&&th(e._searchMarker,s,-i+r)},ym=(t,e,n)=>{const r=e._map.get(n);r!==void 0&&r.delete(t)},BA=(t,e,n,r)=>{const s=e._map.get(n)||null,i=t.doc,o=i.clientID;let a;if(r==null)a=new ml([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:a=new ml([r]);break;case Uint8Array:a=new rh(r);break;case ul:a=new ih(r);break;default:if(r instanceof kn)a=new ws(r);else throw new Error("Unexpected content type")}new Et(Ke(o,zt(i.store,o)),s,s&&s.lastId,null,null,e,n,a).integrate(t,0)},FA=(t,e)=>{const n=t._map.get(e);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},b_=t=>{const e={};return t._map.forEach((n,r)=>{n.deleted||(e[r]=n.content.getContent()[n.length-1])}),e},w_=(t,e)=>{const n=t._map.get(e);return n!==void 0&&!n.deleted},dW=(t,e)=>{const n={};return t._map.forEach((r,s)=>{let i=r;for(;i!==null&&(!e.sv.has(i.id.client)||i.id.clock>=(e.sv.get(i.id.client)||0));)i=i.left;i!==null&&fl(i,e)&&(n[s]=i.content.getContent()[i.length-1])}),n},bm=t=>OG(t.entries(),e=>!e[1].deleted);class hW extends hm{}class rc extends kn{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const n=new rc;return n.push(e),n}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new rc}clone(){const e=new rc;return e.insert(0,this.toArray().map(n=>n instanceof kn?n.clone():n)),e}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}_callObserver(e,n){super._callObserver(e,n),mm(this,e,new hW(this,e))}insert(e,n){this.doc!==null?vt(this.doc,r=>{g_(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}push(e){this.doc!==null?vt(this.doc,n=>{fW(n,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,n=1){this.doc!==null?vt(this.doc,r=>{y_(r,this,e,n)}):this._prelimContent.splice(e,n)}get(e){return p_(this,e)}toArray(){return f_(this)}slice(e=0,n=this.length){return c_(this,e,n)}toJSON(){return this.map(e=>e instanceof kn?e.toJSON():e)}map(e){return h_(this,e)}forEach(e){nh(this,e)}[Symbol.iterator](){return cW(this)}_write(e){e.writeTypeRef(BW)}}const pW=t=>new rc;class mW extends hm{constructor(e,n,r){super(e,n),this.keysChanged=r}}class sc extends kn{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,n){super._integrate(e,n),this._prelimContent.forEach((r,s)=>{this.set(s,r)}),this._prelimContent=null}_copy(){return new sc}clone(){const e=new sc;return this.forEach((n,r)=>{e.set(r,n instanceof kn?n.clone():n)}),e}_callObserver(e,n){mm(this,e,new mW(this,e,n))}toJSON(){const e={};return this._map.forEach((n,r)=>{if(!n.deleted){const s=n.content.getContent()[n.length-1];e[r]=s instanceof kn?s.toJSON():s}}),e}get size(){return[...bm(this._map)].length}keys(){return xA(bm(this._map),e=>e[0])}values(){return xA(bm(this._map),e=>e[1].content.getContent()[e[1].length-1])}entries(){return xA(bm(this._map),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this._map.forEach((n,r)=>{n.deleted||e(n.content.getContent()[n.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?vt(this.doc,n=>{ym(n,this,e)}):this._prelimContent.delete(e)}set(e,n){return this.doc!==null?vt(this.doc,r=>{BA(r,this,e,n)}):this._prelimContent.set(e,n),n}get(e){return FA(this,e)}has(e){return w_(this,e)}clear(){this.doc!==null?vt(this.doc,e=>{this.forEach(function(n,r,s){ym(e,s,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(FW)}}const gW=t=>new sc,jo=(t,e)=>t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&Z$(t,e);class jA{constructor(e,n,r,s){this.left=e,this.right=n,this.index=r,this.currentAttributes=s}forward(){switch(this.right===null&&Sr(),this.right.content.constructor){case Zt:this.right.deleted||ic(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}}const A_=(t,e,n)=>{for(;e.right!==null&&n>0;){switch(e.right.content.constructor){case Zt:e.right.deleted||ic(e.currentAttributes,e.right.content);break;default:e.right.deleted||(n<e.right.length&&ar(t,Ke(e.right.id.client,e.right.id.clock+n)),e.index+=e.right.length,n-=e.right.length);break}e.left=e.right,e.right=e.right.right}return e},wm=(t,e,n,r)=>{const s=new Map,i=r?pm(e,n):null;if(i){const o=new jA(i.p.left,i.p,i.index,s);return A_(t,o,n-i.index)}else{const o=new jA(null,e._start,0,s);return A_(t,o,n)}},v_=(t,e,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===Zt&&jo(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const s=t.doc,i=s.clientID;r.forEach((o,a)=>{const l=n.left,u=n.right,c=new Et(Ke(i,zt(s.store,i)),l,l&&l.lastId,u,u&&u.id,e,null,new Zt(a,o));c.integrate(t,0),n.right=c,n.forward()})},ic=(t,e)=>{const{key:n,value:r}=e;r===null?t.delete(n):t.set(n,r)},x_=(t,e)=>{for(;t.right!==null;){if(!(t.right.deleted||t.right.content.constructor===Zt&&jo(e[t.right.content.key]??null,t.right.content.value)))break;t.forward()}},k_=(t,e,n,r)=>{const s=t.doc,i=s.clientID,o=new Map;for(const a in r){const l=r[a],u=n.currentAttributes.get(a)??null;if(!jo(u,l)){o.set(a,u);const{left:c,right:f}=n;n.right=new Et(Ke(i,zt(s.store,i)),c,c&&c.lastId,f,f&&f.id,e,null,new Zt(a,l)),n.right.integrate(t,0),n.forward()}}return o},UA=(t,e,n,r,s)=>{n.currentAttributes.forEach((d,h)=>{s[h]===void 0&&(s[h]=null)});const i=t.doc,o=i.clientID;x_(n,s);const a=k_(t,e,n,s),l=r.constructor===String?new bs(r):r instanceof kn?new ws(r):new pl(r);let{left:u,right:c,index:f}=n;e._searchMarker&&th(e._searchMarker,n.index,l.getLength()),c=new Et(Ke(o,zt(i.store,o)),u,u&&u.lastId,c,c&&c.id,e,null,l),c.integrate(t,0),n.right=c,n.index=f,n.forward(),v_(t,e,n,a)},E_=(t,e,n,r,s)=>{const i=t.doc,o=i.clientID;x_(n,s);const a=k_(t,e,n,s);e:for(;n.right!==null&&(r>0||a.size>0&&(n.right.deleted||n.right.content.constructor===Zt));){if(!n.right.deleted)switch(n.right.content.constructor){case Zt:{const{key:l,value:u}=n.right.content,c=s[l];if(c!==void 0){if(jo(c,u))a.delete(l);else{if(r===0)break e;a.set(l,u)}n.right.delete(t)}else n.currentAttributes.set(l,u);break}default:r<n.right.length&&ar(t,Ke(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let l="";for(;r>0;r--)l+=`
473
+ For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return V.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},UH="DialogDescriptionWarning",VH=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${$3(UH).contentName}}.`;return V.useEffect(()=>{var i;const s=(i=t.current)==null?void 0:i.getAttribute("aria-describedby");e&&s&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},G3=_3,W3=N3,K3=P3,Tw=I3,Dw=L3,Ow=F3,_w=U3,q3=H3;function HH(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",e.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}const Q3=N.createContext({drawerRef:{current:null},overlayRef:{current:null},scaleBackground:()=>{},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,handleOnly:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},visible:!1,closeDrawer:()=>{},setVisible:()=>{},direction:"bottom"}),H0=()=>{const t=N.useContext(Q3);if(!t)throw new Error("useDrawerContext must be used within a Drawer.Root");return t};HH("[vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1)}[vaul-drawer][vaul-drawer-direction=bottom]{transform:translate3d(0,100%,0)}[vaul-drawer][vaul-drawer-direction=top]{transform:translate3d(0,-100%,0)}[vaul-drawer][vaul-drawer-direction=left]{transform:translate3d(-100%,0,0)}[vaul-drawer][vaul-drawer-direction=right]{transform:translate3d(100%,0,0)}.vaul-dragging .vaul-scrollable [vault-drawer-direction=top]{overflow-y:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=bottom]{overflow-y:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=left]{overflow-x:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=right]{overflow-x:hidden!important}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[vaul-overlay]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[vaul-overlay][vaul-drawer-visible=true]{opacity:1}[vaul-drawer]::after{content:'';position:absolute;background:inherit;background-color:inherit}[vaul-drawer][vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[vaul-drawer][vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[vaul-drawer][vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[vaul-drawer][vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[vaul-handle]{display:block;position:relative;opacity:.8;margin-left:auto;margin-right:auto;height:5px;width:56px;border-radius:1rem;touch-action:pan-y;cursor:grab}[vaul-handle]:active,[vaul-handle]:hover{opacity:1}[vaul-handle]:active{cursor:grabbing}[vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}[vaul-overlay][vaul-snap-points=true]:not([vaul-snap-points-overlay=true]):not([data-state=closed]){opacity:0}[vaul-overlay][vaul-snap-points-overlay=true]:not([vaul-drawer-visible=false]){opacity:1}@media (hover:hover) and (pointer:fine){[vaul-drawer]{user-select:none}}@media (pointer:fine){[vaul-handle-hitarea]:{width:100%;height:100%}}");const zH=typeof window<"u"?N.useLayoutEffect:N.useEffect;function Mw(...t){return(...e)=>{for(let n of t)typeof n=="function"&&n(...e)}}function $H(){return Nw(/^Mac/)}function GH(){return Nw(/^iPhone/)}function WH(){return Nw(/^iPad/)||$H()&&navigator.maxTouchPoints>1}function J3(){return GH()||WH()}function Nw(t){return typeof window<"u"&&window.navigator!=null?t.test(window.navigator.platform):void 0}const Rw=typeof document<"u"&&window.visualViewport;function Y3(t){let e=window.getComputedStyle(t);return/(auto|scroll)/.test(e.overflow+e.overflowX+e.overflowY)}function X3(t){for(Y3(t)&&(t=t.parentElement);t&&!Y3(t);)t=t.parentElement;return t||document.scrollingElement||document.documentElement}const KH=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let z0=0,Pw;function qH(t={}){let{isDisabled:e}=t;zH(()=>{if(!e)return z0++,z0===1&&(J3()?Pw=JH():Pw=QH()),()=>{z0--,z0===0&&Pw()}},[e])}function QH(){return Mw(Z3(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`))}function JH(){let t,e=0,n=f=>{t=X3(f.target),!(t===document.documentElement&&t===document.body)&&(e=f.changedTouches[0].pageY)},r=f=>{if(!t||t===document.documentElement||t===document.body){f.preventDefault();return}let d=f.changedTouches[0].pageY,h=t.scrollTop,p=t.scrollHeight-t.clientHeight;p!==0&&((h<=0&&d>e||h>=p&&d<e)&&f.preventDefault(),e=d)},s=f=>{let d=f.target;Iw(d)&&d!==document.activeElement&&(f.preventDefault(),d.style.transform="translateY(-2000px)",d.focus(),requestAnimationFrame(()=>{d.style.transform=""}))},i=f=>{let d=f.target;Iw(d)&&(d.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{d.style.transform="",Rw&&(Rw.height<window.innerHeight?requestAnimationFrame(()=>{eD(d)}):Rw.addEventListener("resize",()=>eD(d),{once:!0}))}))},o=()=>{window.scrollTo(0,0)},a=window.pageXOffset,l=window.pageYOffset,u=Mw(Z3(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let c=Mw(Rd(document,"touchstart",n,{passive:!1,capture:!0}),Rd(document,"touchmove",r,{passive:!1,capture:!0}),Rd(document,"touchend",s,{passive:!1,capture:!0}),Rd(document,"focus",i,!0),Rd(window,"scroll",o));return()=>{u(),c(),window.scrollTo(a,l)}}function Z3(t,e,n){let r=t.style[e];return t.style[e]=n,()=>{t.style[e]=r}}function Rd(t,e,n,r){return t.addEventListener(e,n,r),()=>{t.removeEventListener(e,n,r)}}function eD(t){let e=document.scrollingElement||document.documentElement;for(;t&&t!==e;){let n=X3(t);if(n!==document.documentElement&&n!==document.body&&n!==t){let r=n.getBoundingClientRect().top,s=t.getBoundingClientRect().top,i=t.getBoundingClientRect().bottom;const o=n.getBoundingClientRect().bottom;i>o&&(n.scrollTop+=s-r)}t=n.parentElement}}function Iw(t){return t instanceof HTMLInputElement&&!KH.has(t.type)||t instanceof HTMLTextAreaElement||t instanceof HTMLElement&&t.isContentEditable}function YH(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function XH(...t){return e=>t.forEach(n=>YH(n,e))}function tD(...t){return V.useCallback(XH(...t),t)}let Pd=null;function ZH({isOpen:t,modal:e,nested:n,hasBeenOpened:r,preventScrollRestoration:s,noBodyStyles:i}){const[o,a]=N.useState(()=>typeof window<"u"?window.location.href:""),l=N.useRef(0),u=N.useCallback(()=>{if(Pd===null&&t&&!i){Pd={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:f,innerHeight:d}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-l.current}px`,left:`${-f}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const h=d-window.innerHeight;h&&l.current>=d&&(document.body.style.top=`${-(l.current+h)}px`)}),300)}},[t]),c=N.useCallback(()=>{if(Pd!==null&&!i){const f=-parseInt(document.body.style.top,10),d=-parseInt(document.body.style.left,10);Object.assign(document.body.style,Pd),window.requestAnimationFrame(()=>{if(s&&o!==window.location.href){a(window.location.href);return}window.scrollTo(d,f)}),Pd=null}},[o]);return N.useEffect(()=>{function f(){l.current=window.scrollY}return f(),window.addEventListener("scroll",f),()=>{window.removeEventListener("scroll",f)}},[]),N.useEffect(()=>{n||!r||(t?(!window.matchMedia("(display-mode: standalone)").matches&&u(),e||window.setTimeout(()=>{c()},500)):c())},[t,r,o,e,n,u,c]),{restorePositionSetting:c}}const nD=new WeakMap;function Dt(t,e,n=!1){if(!t||!(t instanceof HTMLElement))return;let r={};Object.entries(e).forEach(([s,i])=>{if(s.startsWith("--")){t.style.setProperty(s,i);return}r[s]=t.style[s],t.style[s]=i}),!n&&nD.set(t,r)}function $0(t,e){if(!t||!(t instanceof HTMLElement))return;let n=nD.get(t);n&&(e?t.style[e]=n[e]:Object.entries(n).forEach(([r,s])=>{t.style[r]=s}))}const Xt=t=>{switch(t){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return t}};function G0(t,e){if(!t)return null;const n=window.getComputedStyle(t),r=n.transform||n.webkitTransform||n.mozTransform;let s=r.match(/^matrix3d\((.+)\)$/);return s?parseFloat(s[1].split(", ")[Xt(e)?13:12]):(s=r.match(/^matrix\((.+)\)$/),s?parseFloat(s[1].split(", ")[Xt(e)?5:4]):null)}function ez(t){return 8*(Math.log(t+1)-2)}const At={DURATION:.5,EASE:[.32,.72,0,1]},rD=.4;function sD(t){const e=N.useRef(t);return N.useEffect(()=>{e.current=t}),N.useMemo(()=>(...n)=>e.current==null?void 0:e.current.call(e,...n),[])}function tz({defaultProp:t,onChange:e}){const n=N.useState(t),[r]=n,s=N.useRef(r),i=sD(e);return N.useEffect(()=>{s.current!==r&&(i(r),s.current=r)},[r,s,i]),n}function nz({prop:t,defaultProp:e,onChange:n=()=>{}}){const[r,s]=tz({defaultProp:e,onChange:n}),i=t!==void 0,o=i?t:r,a=sD(n),l=N.useCallback(u=>{if(i){const f=typeof u=="function"?u(t):u;f!==t&&a(f)}else s(u)},[i,t,s,a]);return[o,l]}function rz({activeSnapPointProp:t,setActiveSnapPointProp:e,snapPoints:n,drawerRef:r,overlayRef:s,fadeFromIndex:i,onSnapPointChange:o,direction:a="bottom"}){const[l,u]=nz({prop:t,defaultProp:n==null?void 0:n[0],onChange:e}),c=N.useMemo(()=>l===(n==null?void 0:n[n.length-1])||null,[n,l]),f=n&&n.length>0&&(i||i===0)&&!Number.isNaN(i)&&n[i]===l||!n,d=N.useMemo(()=>n==null?void 0:n.findIndex(w=>w===l),[n,l]),h=N.useMemo(()=>{var w;return(w=n==null?void 0:n.map(A=>{const x=typeof window<"u",k=typeof A=="string";let C=0;if(k&&(C=parseInt(A,10)),Xt(a)){const _=k?C:x?A*window.innerHeight:0;return x?a==="bottom"?window.innerHeight-_:-window.innerHeight+_:_}const O=k?C:x?A*window.innerWidth:0;return x?a==="right"?window.innerWidth-O:-window.innerWidth+O:O}))!=null?w:[]},[n]),p=N.useMemo(()=>d!==null?h==null?void 0:h[d]:null,[h,d]),m=N.useCallback(w=>{var A;const x=(A=h==null?void 0:h.findIndex(k=>k===w))!=null?A:null;o(x),Dt(r.current,{transition:`transform ${At.DURATION}s cubic-bezier(${At.EASE.join(",")})`,transform:Xt(a)?`translate3d(0, ${w}px, 0)`:`translate3d(${w}px, 0, 0)`}),h&&x!==h.length-1&&x!==i?Dt(s.current,{transition:`opacity ${At.DURATION}s cubic-bezier(${At.EASE.join(",")})`,opacity:"0"}):Dt(s.current,{transition:`opacity ${At.DURATION}s cubic-bezier(${At.EASE.join(",")})`,opacity:"1"}),u(x!==null?n==null?void 0:n[x]:null)},[r.current,n,h,i,s,u]);N.useEffect(()=>{if(l||t){var w;const A=(w=n==null?void 0:n.findIndex(x=>x===t||x===l))!=null?w:-1;h&&A!==-1&&typeof h[A]=="number"&&m(h[A])}},[l,t,n,h,m]);function g({draggedDistance:w,closeDrawer:A,velocity:x,dismissible:k}){if(i===void 0)return;const C=a==="bottom"||a==="right"?(p??0)-w:(p??0)+w,O=d===i-1,_=d===0,D=w>0;if(O&&Dt(s.current,{transition:`opacity ${At.DURATION}s cubic-bezier(${At.EASE.join(",")})`}),x>2&&!D){k?A():m(h[0]);return}if(x>2&&D&&h&&n){m(h[n.length-1]);return}const R=h==null?void 0:h.reduce((F,G)=>typeof F!="number"||typeof G!="number"?F:Math.abs(G-C)<Math.abs(F-C)?G:F),L=Xt(a)?window.innerHeight:window.innerWidth;if(x>rD&&Math.abs(w)<L*.4){const F=D?1:-1;if(F>0&&c){m(h[n.length-1]);return}if(_&&F<0&&k&&A(),d===null)return;m(h[d+F]);return}m(R)}function y({draggedDistance:w}){if(p===null)return;const A=a==="bottom"||a==="right"?p-w:p+w;(a==="bottom"||a==="right")&&A<h[h.length-1]||(a==="top"||a==="left")&&A>h[h.length-1]||Dt(r.current,{transform:Xt(a)?`translate3d(0, ${A}px, 0)`:`translate3d(${A}px, 0, 0)`})}function v(w,A){if(!n||typeof d!="number"||!h||i===void 0)return null;const x=d===i-1;if(d>=i&&A)return 0;if(x&&!A)return 1;if(!f&&!x)return null;const C=x?d+1:d-1,O=x?h[C]-h[C-1]:h[C+1]-h[C],_=w/Math.abs(O);return x?1-_:_}return{isLastSnapPoint:c,activeSnapPoint:l,shouldFade:f,getPercentageDragged:v,setActiveSnapPoint:u,activeSnapPointIndex:d,onRelease:g,onDrag:y,snapPointsOffset:h}}const sz=.25,iz=100,iD=8,nl=16,oD=26,Lw="vaul-dragging";function aD({open:t,onOpenChange:e,children:n,shouldScaleBackground:r,onDrag:s,onRelease:i,snapPoints:o,nested:a=!1,setBackgroundColorOnScale:l=!0,closeThreshold:u=sz,scrollLockTimeout:c=iz,dismissible:f=!0,handleOnly:d=!1,fadeFromIndex:h=o&&o.length-1,activeSnapPoint:p,setActiveSnapPoint:m,fixed:g,modal:y=!0,onClose:v,noBodyStyles:w,direction:A="bottom",preventScrollRestoration:x=!0,disablePreventScroll:k=!1}){var C;const[O=!1,_]=N.useState(!1),[D,R]=N.useState(!1),[L,F]=N.useState(!1),[G,B]=N.useState(!1),[H,Q]=N.useState(!1),[te,Z]=N.useState(!1),pe=N.useRef(null),Ee=N.useRef(null),Re=N.useRef(null),Ce=N.useRef(null),ke=N.useRef(null),He=N.useRef(!1),Ue=N.useRef(null),ze=N.useRef(0),Le=N.useRef(!1),tt=N.useRef(0),le=N.useRef(null),$e=N.useRef(((C=le.current)==null?void 0:C.getBoundingClientRect().height)||0),ae=N.useRef(0),be=N.useCallback(ne=>{o&&ne===ue.length-1&&(Ee.current=new Date)},[]),{activeSnapPoint:Be,activeSnapPointIndex:z,setActiveSnapPoint:q,onRelease:re,snapPointsOffset:ue,onDrag:P,shouldFade:b,getPercentageDragged:E}=rz({snapPoints:o,activeSnapPointProp:p,setActiveSnapPointProp:m,drawerRef:le,fadeFromIndex:h,overlayRef:pe,onSnapPointChange:be,direction:A});qH({isDisabled:!O||H||!y||te||!D||k});const{restorePositionSetting:M}=ZH({isOpen:O,modal:y,nested:a,hasBeenOpened:D,preventScrollRestoration:x,noBodyStyles:w});function j(){return(window.innerWidth-oD)/window.innerWidth}function K(ne){var ie;!f&&!o||le.current&&!le.current.contains(ne.target)||($e.current=((ie=le.current)==null?void 0:ie.getBoundingClientRect().height)||0,Q(!0),Re.current=new Date,J3()&&window.addEventListener("touchend",()=>He.current=!1,{once:!0}),ne.target.setPointerCapture(ne.pointerId),ze.current=Xt(A)?ne.clientY:ne.clientX)}function Y(ne,ie){var Te;let me=ne;const qe=(Te=window.getSelection())==null?void 0:Te.toString(),nt=le.current?G0(le.current,A):null,yt=new Date;if(me.hasAttribute("data-vaul-no-drag")||me.closest("[data-vaul-no-drag]"))return!1;if(A==="right"||A==="left")return!0;if(Ee.current&&yt.getTime()-Ee.current.getTime()<500)return!1;if(nt!==null&&(A==="bottom"?nt>0:nt<0))return!0;if(qe&&qe.length>0)return!1;if(ke.current&&yt.getTime()-ke.current.getTime()<c&&nt===0||ie)return ke.current=yt,!1;for(;me;){if(me.scrollHeight>me.clientHeight){if(me.scrollTop!==0)return ke.current=new Date,!1;if(me.getAttribute("role")==="dialog")return!0}me=me.parentNode}return!0}function ye(ne){if(le.current&&H){const ie=A==="bottom"||A==="right"?1:-1,Te=(ze.current-(Xt(A)?ne.clientY:ne.clientX))*ie,me=Te>0,qe=o&&!f&&!me;if(qe&&z===0)return;const nt=Math.abs(Te),yt=document.querySelector("[vaul-drawer-wrapper]");let sn=nt/$e.current;const Ft=E(nt,me);if(Ft!==null&&(sn=Ft),qe&&sn>=1||!He.current&&!Y(ne.target,me))return;if(le.current.classList.add(Lw),He.current=!0,Dt(le.current,{transition:"none"}),Dt(pe.current,{transition:"none"}),o&&P({draggedDistance:Te}),me&&!o){const wr=ez(Te),Ar=Math.min(wr*-1,0)*ie;Dt(le.current,{transform:Xt(A)?`translate3d(0, ${Ar}px, 0)`:`translate3d(${Ar}px, 0, 0)`});return}const Is=1-sn;if((b||h&&z===h-1)&&(s==null||s(ne,sn),Dt(pe.current,{opacity:`${Is}`,transition:"none"},!0)),yt&&pe.current&&r){const wr=Math.min(j()+sn*(1-j()),1),Ar=8-sn*8,Wf=Math.max(0,14-sn*14);Dt(yt,{borderRadius:`${Ar}px`,transform:Xt(A)?`scale(${wr}) translate3d(0, ${Wf}px, 0)`:`scale(${wr}) translate3d(${Wf}px, 0, 0)`,transition:"none"},!0)}if(!o){const wr=nt*ie;Dt(le.current,{transform:Xt(A)?`translate3d(0, ${wr}px, 0)`:`translate3d(${wr}px, 0, 0)`})}}}N.useEffect(()=>()=>{ft(!1),M()},[]),N.useEffect(()=>{var ne;function ie(){if(!le.current)return;const Te=document.activeElement;if(Iw(Te)||Le.current){var me;const qe=((me=window.visualViewport)==null?void 0:me.height)||0;let nt=window.innerHeight-qe;const yt=le.current.getBoundingClientRect().height||0;ae.current||(ae.current=yt);const sn=le.current.getBoundingClientRect().top;if(Math.abs(tt.current-nt)>60&&(Le.current=!Le.current),o&&o.length>0&&ue&&z){const Ft=ue[z]||0;nt+=Ft}if(tt.current=nt,yt>qe||Le.current){const Ft=le.current.getBoundingClientRect().height;let Is=Ft;Ft>qe&&(Is=qe-oD),g?le.current.style.height=`${Ft-Math.max(nt,0)}px`:le.current.style.height=`${Math.max(Is,qe-sn)}px`}else le.current.style.height=`${ae.current}px`;o&&o.length>0&&!Le.current?le.current.style.bottom="0px":le.current.style.bottom=`${Math.max(nt,0)}px`}}return(ne=window.visualViewport)==null||ne.addEventListener("resize",ie),()=>{var Te;return(Te=window.visualViewport)==null?void 0:Te.removeEventListener("resize",ie)}},[z,o,ue]);function Se(){le.current&&(Ve(),v==null||v(),Dt(le.current,{transform:Xt(A)?`translate3d(0, ${A==="bottom"?"100%":"-100%"}, 0)`:`translate3d(${A==="right"?"100%":"-100%"}, 0, 0)`,transition:`transform ${At.DURATION}s cubic-bezier(${At.EASE.join(",")})`}),Dt(pe.current,{opacity:"0",transition:`opacity ${At.DURATION}s cubic-bezier(${At.EASE.join(",")})`}),ft(!1),setTimeout(()=>{F(!1),_(!1)},300),setTimeout(()=>{o&&q(o[0])},At.DURATION*1e3))}N.useEffect(()=>{if(!O&&r){const ne=setTimeout(()=>{$0(document.body)},200);return()=>clearTimeout(ne)}},[O,r]),N.useLayoutEffect(()=>{t?(_(!0),R(!0)):Se()},[t]),N.useEffect(()=>{G&&(e==null||e(O))},[O]),N.useEffect(()=>{B(!0)},[]);function Je(){if(!le.current)return;const ne=document.querySelector("[vaul-drawer-wrapper]"),ie=G0(le.current,A);Dt(le.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${At.DURATION}s cubic-bezier(${At.EASE.join(",")})`}),Dt(pe.current,{transition:`opacity ${At.DURATION}s cubic-bezier(${At.EASE.join(",")})`,opacity:"1"}),r&&ie&&ie>0&&O&&Dt(ne,{borderRadius:`${iD}px`,overflow:"hidden",...Xt(A)?{transform:`scale(${j()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${j()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${At.DURATION}s`,transitionTimingFunction:`cubic-bezier(${At.EASE.join(",")})`},!0)}function Ve(){!H||!le.current||(le.current.classList.remove(Lw),He.current=!1,Q(!1),Ce.current=new Date)}function Fe(ne){if(!H||!le.current)return;le.current.classList.remove(Lw),He.current=!1,Q(!1),Ce.current=new Date;const ie=G0(le.current,A);if(!Y(ne.target,!1)||!ie||Number.isNaN(ie)||Re.current===null)return;const Te=Ce.current.getTime()-Re.current.getTime(),me=ze.current-(Xt(A)?ne.clientY:ne.clientX),qe=Math.abs(me)/Te;if(qe>.05&&(Z(!0),setTimeout(()=>{Z(!1)},200)),o){re({draggedDistance:me*(A==="bottom"||A==="right"?1:-1),closeDrawer:Se,velocity:qe,dismissible:f}),i==null||i(ne,!0);return}if(A==="bottom"||A==="right"?me>0:me<0){Je(),i==null||i(ne,!0);return}if(qe>rD){Se(),i==null||i(ne,!1);return}var nt;const yt=Math.min((nt=le.current.getBoundingClientRect().height)!=null?nt:0,window.innerHeight);if(ie>=yt*u){Se(),i==null||i(ne,!1);return}i==null||i(ne,!0),Je()}N.useEffect(()=>{O&&(Dt(document.documentElement,{scrollBehavior:"auto"}),Ee.current=new Date,ft(!0))},[O]),N.useEffect(()=>{if(le.current&&L){var ne;const ie=le==null||(ne=le.current)==null?void 0:ne.querySelectorAll("*");ie==null||ie.forEach(Te=>{const me=Te;(me.scrollHeight>me.clientHeight||me.scrollWidth>me.clientWidth)&&me.classList.add("vaul-scrollable")})}},[L]);function ft(ne){const ie=document.querySelector("[vaul-drawer-wrapper]");!ie||!r||(ne?(l&&(w||(Dt(document.body,{background:document.body.style.backgroundColor||document.body.style.background}),Dt(document.body,{background:"black"},!0))),Dt(ie,{borderRadius:`${iD}px`,overflow:"hidden",...Xt(A)?{transform:`scale(${j()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${j()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${At.DURATION}s`,transitionTimingFunction:`cubic-bezier(${At.EASE.join(",")})`})):($0(ie,"overflow"),$0(ie,"transform"),$0(ie,"borderRadius"),Dt(ie,{transitionProperty:"transform, border-radius",transitionDuration:`${At.DURATION}s`,transitionTimingFunction:`cubic-bezier(${At.EASE.join(",")})`})))}function Xn(ne){const ie=ne?(window.innerWidth-nl)/window.innerWidth:1,Te=ne?-nl:0;Ue.current&&window.clearTimeout(Ue.current),Dt(le.current,{transition:`transform ${At.DURATION}s cubic-bezier(${At.EASE.join(",")})`,transform:`scale(${ie}) translate3d(0, ${Te}px, 0)`}),!ne&&le.current&&(Ue.current=setTimeout(()=>{const me=G0(le.current,A);Dt(le.current,{transition:"none",transform:Xt(A)?`translate3d(0, ${me}px, 0)`:`translate3d(${me}px, 0, 0)`})},500))}function br(ne,ie){if(ie<0)return;const Te=Xt(A)?window.innerHeight:window.innerWidth,me=(Te-nl)/Te,qe=me+ie*(1-me),nt=-nl+ie*nl;Dt(le.current,{transform:Xt(A)?`scale(${qe}) translate3d(0, ${nt}px, 0)`:`scale(${qe}) translate3d(${nt}px, 0, 0)`,transition:"none"})}function X(ne,ie){const Te=Xt(A)?window.innerHeight:window.innerWidth,me=ie?(Te-nl)/Te:1,qe=ie?-nl:0;ie&&Dt(le.current,{transition:`transform ${At.DURATION}s cubic-bezier(${At.EASE.join(",")})`,transform:Xt(A)?`scale(${me}) translate3d(0, ${qe}px, 0)`:`scale(${me}) translate3d(${qe}px, 0, 0)`})}return N.createElement(G3,{modal:y,onOpenChange:ne=>{if(t!==void 0){e==null||e(ne);return}ne?(R(!0),_(ne)):Se()},open:O},N.createElement(Q3.Provider,{value:{visible:L,activeSnapPoint:Be,snapPoints:o,setActiveSnapPoint:q,drawerRef:le,overlayRef:pe,scaleBackground:ft,onOpenChange:e,onPress:K,setVisible:F,onRelease:Fe,onDrag:ye,dismissible:f,handleOnly:d,isOpen:O,isDragging:H,shouldFade:b,closeDrawer:Se,onNestedDrag:br,onNestedOpenChange:Xn,onNestedRelease:X,keyboardIsOpen:Le,openProp:t,modal:y,snapPointsOffset:ue,direction:A}},n))}const oz=250,az=120,lD=N.forwardRef(function({preventCycle:t=!1,children:e,...n},r){const{visible:s,closeDrawer:i,isDragging:o,snapPoints:a,activeSnapPoint:l,setActiveSnapPoint:u,dismissible:c,handleOnly:f,onPress:d,onDrag:h}=H0(),p=N.useRef(null),m=N.useRef(!1);function g(){if(m.current){w();return}window.setTimeout(()=>{y()},az)}function y(){if(o||t||m.current){w();return}if(w(),(!a||a.length===0)&&c){i();return}if(l===a[a.length-1]&&c){i();return}const x=a.findIndex(C=>C===l);if(x===-1)return;const k=a[x+1];u(k)}function v(){p.current=window.setTimeout(()=>{m.current=!0},oz)}function w(){window.clearTimeout(p.current),m.current=!1}return N.createElement("div",{onClick:g,onDoubleClick:()=>{m.current=!0,i()},onPointerCancel:w,onPointerDown:A=>{f&&d(A),v()},onPointerMove:A=>{f&&h(A)},ref:r,"vaul-drawer-visible":s?"true":"false","vaul-handle":"","aria-hidden":"true",...n},N.createElement("span",{"vaul-handle-hitarea":"","aria-hidden":"true"},e))});lD.displayName="Drawer.Handle";const uD=N.forwardRef(function({children:t,...e},n){const{overlayRef:r,snapPoints:s,onRelease:i,shouldFade:o,isOpen:a,visible:l}=H0(),u=tD(n,r),c=s&&s.length>0;return N.createElement(Tw,{onMouseUp:i,ref:u,"vaul-drawer-visible":l?"true":"false","vaul-overlay":"","vaul-snap-points":a&&c?"true":"false","vaul-snap-points-overlay":a&&o?"true":"false",...e})});uD.displayName="Drawer.Overlay";const cD=N.forwardRef(function({onOpenAutoFocus:t,onPointerDownOutside:e,onAnimationEnd:n,style:r,...s},i){const{drawerRef:o,onPress:a,onRelease:l,onDrag:u,dismissible:c,keyboardIsOpen:f,snapPointsOffset:d,visible:h,closeDrawer:p,modal:m,openProp:g,onOpenChange:y,setVisible:v,handleOnly:w,direction:A}=H0(),x=tD(i,o),k=N.useRef(null),C=N.useRef(!1),O=(_,D,R=0)=>{if(C.current)return!0;const L=Math.abs(_.y),F=Math.abs(_.x),G=F>L,B=["bottom","right"].includes(D)?1:-1;if(D==="left"||D==="right"){if(!(_.x*B<0)&&F>=0&&F<=R)return G}else if(!(_.y*B<0)&&L>=0&&L<=R)return!G;return C.current=!0,!0};return N.useEffect(()=>{v(!0)},[]),N.createElement(Dw,{"vaul-drawer":"","vaul-drawer-direction":A,"vaul-drawer-visible":h?"true":"false",...s,ref:x,style:d&&d.length>0?{"--snap-point-height":`${d[0]}px`,...r}:r,onOpenAutoFocus:_=>{if(t)t(_);else{var D;_.preventDefault(),(D=o.current)==null||D.focus()}},onPointerDown:_=>{w||(s.onPointerDown==null||s.onPointerDown.call(s,_),k.current={x:_.clientX,y:_.clientY},a(_))},onPointerDownOutside:_=>{if(e==null||e(_),!m||_.defaultPrevented){_.preventDefault();return}f.current&&(f.current=!1),_.preventDefault(),y==null||y(!1),!(!c||g!==void 0)&&p()},onFocusOutside:_=>{if(!m){_.preventDefault();return}},onEscapeKeyDown:_=>{if(!m){_.preventDefault();return}},onPointerMove:_=>{if(w||(s.onPointerMove==null||s.onPointerMove.call(s,_),!k.current))return;const D=_.clientY-k.current.y,R=_.clientX-k.current.x,L=_.pointerType==="touch"?10:2;O({x:R,y:D},A,L)?u(_):(Math.abs(R)>L||Math.abs(D)>L)&&(k.current=null)},onPointerUp:_=>{s.onPointerUp==null||s.onPointerUp.call(s,_),k.current=null,C.current=!1,l(_)}})});cD.displayName="Drawer.Content";function lz({onDrag:t,onOpenChange:e,...n}){const{onNestedDrag:r,onNestedOpenChange:s,onNestedRelease:i}=H0();if(!r)throw new Error("Drawer.NestedRoot must be placed in another drawer");return N.createElement(aD,{nested:!0,onClose:()=>{s(!1)},onDrag:(o,a)=>{r(o,a),t==null||t(o,a)},onOpenChange:o=>{o&&s(o),e==null||e(o)},onRelease:i,...n})}const ps={Root:aD,NestedRoot:lz,Content:cD,Handle:lD,Overlay:uD,Trigger:W3,Portal:K3,Close:q3,Title:Ow,Description:_w},fD=({shouldScaleBackground:t=!0,...e})=>S.jsx(ps.Root,{shouldScaleBackground:t,...e});fD.displayName="Drawer";const dD=ps.Trigger,uz=ps.Portal,hD=N.forwardRef(({className:t,...e},n)=>S.jsx(ps.Overlay,{ref:n,className:he("fixed inset-0 z-50 bg-black/5 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));hD.displayName=ps.Overlay.displayName;const pD=N.forwardRef(({className:t,children:e,...n},r)=>S.jsxs(uz,{children:[S.jsx(hD,{}),S.jsx(Vu,{trapped:!1,children:S.jsxs(ps.Content,{ref:r,className:he("fixed inset-x-0 bottom-0 z-50 flex h-auto flex-col rounded-t-[16px] drop-shadow-2xl bg-white",t),...n,children:[S.jsx("div",{className:"mx-auto mt-4 h-2 w-[100px] rounded-full bg-white"}),e,S.jsx(ps.Close,{className:"absolute right-2 top-4 hover:bg-gray-200 rounded-full p-2 ring-offset-white transition focus:outline-none focus:ring-2 focus:ring-blue-700 focus:ring-offset-2 disabled:pointer-events-none text-black data-[state=open]:bg-gray-100 data-[state=open]:text-black",children:S.jsx(cV,{size:20,fill:"black"})})]})})]}));pD.displayName="DrawerContent";const mD=({className:t,...e})=>S.jsx("div",{className:he("grid gap-1.5 p-4 text-center sm:text-left",t),...e});mD.displayName="DrawerHeader";const gD=N.forwardRef(({className:t,...e},n)=>S.jsx(ps.Title,{ref:n,className:he("text-lg font-semibold leading-none tracking-tight",t),...e}));gD.displayName=ps.Title.displayName;const cz=N.forwardRef(({className:t,...e},n)=>S.jsx(ps.Description,{ref:n,className:he("text-sm text-black",t),...e}));cz.displayName=ps.Description.displayName;const fz=({title:t,content:e,contentClassName:n})=>S.jsxs(pD,{className:"w-full z-20",children:[S.jsx(mD,{className:"px-4 pt-0",children:S.jsx(gD,{className:"text-left sm:text-center text-base",children:t})}),S.jsx("div",{className:he("flex flex-col gap-4 w-full h-full pb-4 text-base text-black",n),children:e&&e})]}),dz=G3,hz=W3,pz=K3,mz=q3,yD=V.forwardRef(({className:t,...e},n)=>S.jsx(Tw,{ref:n,className:he("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));yD.displayName=Tw.displayName;const bD=V.forwardRef(({className:t,children:e,...n},r)=>S.jsxs(pz,{children:[S.jsx(yD,{}),S.jsx(Vu,{trapped:!1,children:S.jsxs(Dw,{ref:r,className:he("fixed left-[50%] top-[50%] z-50 grid translate-x-[-50%] translate-y-[-50%] gap-4 bg-white duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-xl",t),...n,children:[S.jsx("div",{}),e]})})]}));bD.displayName=Dw.displayName;const wD=({className:t,...e})=>S.jsx("div",{className:he("grid gap-1.5 p-4 text-center sm:text-left",t),...e});wD.displayName="DialogHeader";const AD=({className:t,...e})=>S.jsx("div",{className:he("flex space-x-2",t),...e});AD.displayName="DialogFooter";const vD=V.forwardRef(({className:t,...e},n)=>S.jsx(Ow,{ref:n,className:he("text-lg font-semibold leading-none tracking-tight",t),...e}));vD.displayName=Ow.displayName;const gz=V.forwardRef(({className:t,...e},n)=>S.jsx(_w,{ref:n,className:he("text-sm text-black",t),...e}));gz.displayName=_w.displayName;function yz(t){return Object.prototype.toString.call(t)==="[object Object]"}function xD(t){return yz(t)||Array.isArray(t)}function bz(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function Bw(t,e){const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;const s=JSON.stringify(Object.keys(t.breakpoints||{})),i=JSON.stringify(Object.keys(e.breakpoints||{}));return s!==i?!1:n.every(o=>{const a=t[o],l=e[o];return typeof a=="function"?`${a}`==`${l}`:!xD(a)||!xD(l)?a===l:Bw(a,l)})}function kD(t){return t.concat().sort((e,n)=>e.name>n.name?1:-1).map(e=>e.options)}function wz(t,e){if(t.length!==e.length)return!1;const n=kD(t),r=kD(e);return n.every((s,i)=>{const o=r[i];return Bw(s,o)})}function Fw(t){return typeof t=="number"}function jw(t){return typeof t=="string"}function Uw(t){return typeof t=="boolean"}function ED(t){return Object.prototype.toString.call(t)==="[object Object]"}function Mt(t){return Math.abs(t)}function Vw(t){return Math.sign(t)}function Id(t,e){return Mt(t-e)}function Az(t,e){if(t===0||e===0||Mt(t)<=Mt(e))return 0;const n=Id(Mt(t),Mt(e));return Mt(n/t)}function Ld(t){return Fd(t).map(Number)}function ms(t){return t[Bd(t)]}function Bd(t){return Math.max(0,t.length-1)}function Hw(t,e){return e===Bd(t)}function CD(t,e=0){return Array.from(Array(t),(n,r)=>e+r)}function Fd(t){return Object.keys(t)}function SD(t,e){return[t,e].reduce((n,r)=>(Fd(r).forEach(s=>{const i=n[s],o=r[s],a=ED(i)&&ED(o);n[s]=a?SD(i,o):o}),n),{})}function zw(t,e){return typeof e.MouseEvent<"u"&&t instanceof e.MouseEvent}function vz(t,e){const n={start:r,center:s,end:i};function r(){return 0}function s(l){return i(l)/2}function i(l){return e-l}function o(l,u){return jw(t)?n[t](l):t(e,l,u)}return{measure:o}}function jd(){let t=[];function e(s,i,o,a={passive:!0}){let l;if("addEventListener"in s)s.addEventListener(i,o,a),l=()=>s.removeEventListener(i,o,a);else{const u=s;u.addListener(o),l=()=>u.removeListener(o)}return t.push(l),r}function n(){t=t.filter(s=>s())}const r={add:e,clear:n};return r}function xz(t,e,n,r){const s=jd(),i=1e3/60;let o=null,a=0,l=0;function u(){s.add(t,"visibilitychange",()=>{t.hidden&&p()})}function c(){h(),s.clear()}function f(g){if(!l)return;o||(o=g);const y=g-o;for(o=g,a+=y;a>=i;)n(),a-=i;const v=Mt(a/i);r(v),l&&e.requestAnimationFrame(f)}function d(){l||(l=e.requestAnimationFrame(f))}function h(){e.cancelAnimationFrame(l),o=null,a=0,l=0}function p(){o=null,a=0}return{init:u,destroy:c,start:d,stop:h,update:n,render:r}}function kz(t,e){const n=e==="rtl",r=t==="y",s=r?"y":"x",i=r?"x":"y",o=!r&&n?-1:1,a=c(),l=f();function u(p){const{height:m,width:g}=p;return r?m:g}function c(){return r?"top":n?"right":"left"}function f(){return r?"bottom":n?"left":"right"}function d(p){return p*o}return{scroll:s,cross:i,startEdge:a,endEdge:l,measureSize:u,direction:d}}function rl(t=0,e=0){const n=Mt(t-e);function r(u){return u<t}function s(u){return u>e}function i(u){return r(u)||s(u)}function o(u){return i(u)?r(u)?t:e:u}function a(u){return n?u-n*Math.ceil((u-e)/n):u}return{length:n,max:e,min:t,constrain:o,reachedAny:i,reachedMax:s,reachedMin:r,removeOffset:a}}function TD(t,e,n){const{constrain:r}=rl(0,t),s=t+1;let i=o(e);function o(d){return n?Mt((s+d)%s):r(d)}function a(){return i}function l(d){return i=o(d),f}function u(d){return c().set(a()+d)}function c(){return TD(t,a(),n)}const f={get:a,set:l,add:u,clone:c};return f}function Ez(t,e,n,r,s,i,o,a,l,u,c,f,d,h,p,m,g,y,v){const{cross:w,direction:A}=t,x=["INPUT","SELECT","TEXTAREA"],k={passive:!1},C=jd(),O=jd(),_=rl(50,225).constrain(h.measure(20)),D={mouse:300,touch:400},R={mouse:500,touch:600},L=p?43:25;let F=!1,G=0,B=0,H=!1,Q=!1,te=!1,Z=!1;function pe(ae){if(!v)return;function be(z){(Uw(v)||v(ae,z))&&Ue(z)}const Be=e;C.add(Be,"dragstart",z=>z.preventDefault(),k).add(Be,"touchmove",()=>{},k).add(Be,"touchend",()=>{}).add(Be,"touchstart",be).add(Be,"mousedown",be).add(Be,"touchcancel",Le).add(Be,"contextmenu",Le).add(Be,"click",tt,!0)}function Ee(){C.clear(),O.clear()}function Re(){const ae=Z?n:e;O.add(ae,"touchmove",ze,k).add(ae,"touchend",Le).add(ae,"mousemove",ze,k).add(ae,"mouseup",Le)}function Ce(ae){const be=ae.nodeName||"";return x.includes(be)}function ke(){return(p?R:D)[Z?"mouse":"touch"]}function He(ae,be){const Be=f.add(Vw(ae)*-1),z=c.byDistance(ae,!p).distance;return p||Mt(ae)<_?z:g&&be?z*.5:c.byIndex(Be.get(),0).distance}function Ue(ae){const be=zw(ae,r);Z=be,te=p&&be&&!ae.buttons&&F,F=Id(s.get(),o.get())>=2,!(be&&ae.button!==0)&&(Ce(ae.target)||(H=!0,i.pointerDown(ae),u.useFriction(0).useDuration(0),s.set(o),Re(),G=i.readPoint(ae),B=i.readPoint(ae,w),d.emit("pointerDown")))}function ze(ae){if(!zw(ae,r)&&ae.touches.length>=2)return Le(ae);const Be=i.readPoint(ae),z=i.readPoint(ae,w),q=Id(Be,G),re=Id(z,B);if(!Q&&!Z&&(!ae.cancelable||(Q=q>re,!Q)))return Le(ae);const ue=i.pointerMove(ae);q>m&&(te=!0),u.useFriction(.3).useDuration(.75),a.start(),s.add(A(ue)),ae.preventDefault()}function Le(ae){const Be=c.byDistance(0,!1).index!==f.get(),z=i.pointerUp(ae)*ke(),q=He(A(z),Be),re=Az(z,q),ue=L-10*re,P=y+re/50;Q=!1,H=!1,O.clear(),u.useDuration(ue).useFriction(P),l.distance(q,!p),Z=!1,d.emit("pointerUp")}function tt(ae){te&&(ae.stopPropagation(),ae.preventDefault(),te=!1)}function le(){return H}return{init:pe,destroy:Ee,pointerDown:le}}function Cz(t,e){let r,s;function i(f){return f.timeStamp}function o(f,d){const p=`client${(d||t.scroll)==="x"?"X":"Y"}`;return(zw(f,e)?f:f.touches[0])[p]}function a(f){return r=f,s=f,o(f)}function l(f){const d=o(f)-o(s),h=i(f)-i(r)>170;return s=f,h&&(r=f),d}function u(f){if(!r||!s)return 0;const d=o(s)-o(r),h=i(f)-i(r),p=i(f)-i(s)>170,m=d/h;return h&&!p&&Mt(m)>.1?m:0}return{pointerDown:a,pointerMove:l,pointerUp:u,readPoint:o}}function Sz(){function t(n){const{offsetTop:r,offsetLeft:s,offsetWidth:i,offsetHeight:o}=n;return{top:r,right:s+i,bottom:r+o,left:s,width:i,height:o}}return{measure:t}}function Tz(t){function e(r){return t*(r/100)}return{measure:e}}function Dz(t,e,n,r,s,i,o){let a,l,u=[],c=!1;function f(m){return s.measureSize(o.measure(m))}function d(m){if(!i)return;l=f(t),u=r.map(f);function g(v){for(const w of v){const A=w.target===t,x=r.indexOf(w.target),k=A?l:u[x],C=f(A?t:r[x]);if(Mt(C-k)>=.5){n.requestAnimationFrame(()=>{m.reInit(),e.emit("resize")});break}}}a=new ResizeObserver(v=>{c||(Uw(i)||i(m,v))&&g(v)}),[t].concat(r).forEach(v=>a.observe(v))}function h(){a&&a.disconnect(),c=!0}return{init:d,destroy:h}}function Oz(t,e,n,r,s){let i=0,o=0,a=r,l=s,u=t.get(),c=0;function f(){const x=n.get()-t.get(),k=!a;let C=0;return k?(i=0,t.set(n),C=x):(i+=x/a,i*=l,u+=i,t.add(i),C=u-c),o=Vw(C),c=u,A}function d(){const x=n.get()-e.get();return Mt(x)<.001}function h(){return a}function p(){return o}function m(){return i}function g(){return v(r)}function y(){return w(s)}function v(x){return a=x,A}function w(x){return l=x,A}const A={direction:p,duration:h,velocity:m,seek:f,settled:d,useBaseFriction:y,useBaseDuration:g,useFriction:w,useDuration:v};return A}function _z(t,e,n,r,s){const i=s.measure(10),o=s.measure(50),a=rl(.1,.99);let l=!1;function u(){return!(l||!t.reachedAny(n.get())||!t.reachedAny(e.get()))}function c(h){if(!u())return;const p=t.reachedMin(e.get())?"min":"max",m=Mt(t[p]-e.get()),g=n.get()-e.get(),y=a.constrain(m/o);n.subtract(g*y),!h&&Mt(g)<i&&(n.set(t.constrain(n.get())),r.useDuration(25).useBaseFriction())}function f(h){l=!h}return{shouldConstrain:u,constrain:c,toggleActive:f}}function Mz(t,e,n,r,s){const i=rl(-e+t,0),o=f(),a=c(),l=d();function u(p,m){return Id(p,m)<1}function c(){const p=o[0],m=ms(o),g=o.lastIndexOf(p),y=o.indexOf(m)+1;return rl(g,y)}function f(){return n.map((p,m)=>{const{min:g,max:y}=i,v=i.constrain(p),w=!m,A=Hw(n,m);return w?y:A||u(g,v)?g:u(y,v)?y:v}).map(p=>parseFloat(p.toFixed(3)))}function d(){if(e<=t+s)return[i.max];if(r==="keepSnaps")return o;const{min:p,max:m}=a;return o.slice(p,m)}return{snapsContained:l,scrollContainLimit:a}}function Nz(t,e,n){const r=e[0],s=n?r-t:ms(e);return{limit:rl(s,r)}}function Rz(t,e,n,r){const i=e.min+.1,o=e.max+.1,{reachedMin:a,reachedMax:l}=rl(i,o);function u(d){return d===1?l(n.get()):d===-1?a(n.get()):!1}function c(d){if(!u(d))return;const h=t*(d*-1);r.forEach(p=>p.add(h))}return{loop:c}}function Pz(t){const{max:e,length:n}=t;function r(i){const o=i-e;return n?o/-n:0}return{get:r}}function Iz(t,e,n,r,s){const{startEdge:i,endEdge:o}=t,{groupSlides:a}=s,l=f().map(e.measure),u=d(),c=h();function f(){return a(r).map(m=>ms(m)[o]-m[0][i]).map(Mt)}function d(){return r.map(m=>n[i]-m[i]).map(m=>-Mt(m))}function h(){return a(u).map(m=>m[0]).map((m,g)=>m+l[g])}return{snaps:u,snapsAligned:c}}function Lz(t,e,n,r,s,i){const{groupSlides:o}=s,{min:a,max:l}=r,u=c();function c(){const d=o(i),h=!t||e==="keepSnaps";return n.length===1?[i]:h?d:d.slice(a,l).map((p,m,g)=>{const y=!m,v=Hw(g,m);if(y){const w=ms(g[0])+1;return CD(w)}if(v){const w=Bd(i)-ms(g)[0]+1;return CD(w,ms(g)[0])}return p})}return{slideRegistry:u}}function Bz(t,e,n,r,s){const{reachedAny:i,removeOffset:o,constrain:a}=r;function l(p){return p.concat().sort((m,g)=>Mt(m)-Mt(g))[0]}function u(p){const m=t?o(p):a(p),g=e.map((v,w)=>({diff:c(v-m,0),index:w})).sort((v,w)=>Mt(v.diff)-Mt(w.diff)),{index:y}=g[0];return{index:y,distance:m}}function c(p,m){const g=[p,p+n,p-n];if(!t)return p;if(!m)return l(g);const y=g.filter(v=>Vw(v)===m);return y.length?l(y):ms(g)-n}function f(p,m){const g=e[p]-s.get(),y=c(g,m);return{index:p,distance:y}}function d(p,m){const g=s.get()+p,{index:y,distance:v}=u(g),w=!t&&i(g);if(!m||w)return{index:y,distance:p};const A=e[y]-v,x=p+c(A,0);return{index:y,distance:x}}return{byDistance:d,byIndex:f,shortcut:c}}function Fz(t,e,n,r,s,i,o){function a(f){const d=f.distance,h=f.index!==e.get();i.add(d),d&&(r.duration()?t.start():(t.update(),t.render(1),t.update())),h&&(n.set(e.get()),e.set(f.index),o.emit("select"))}function l(f,d){const h=s.byDistance(f,d);a(h)}function u(f,d){const h=e.clone().set(f),p=s.byIndex(h.get(),d);a(p)}return{distance:l,index:u}}function jz(t,e,n,r,s,i,o){let a=0;function l(){i.add(document,"keydown",u,!1),e.forEach(c)}function u(d){d.code==="Tab"&&(a=new Date().getTime())}function c(d){const h=()=>{if(new Date().getTime()-a>10)return;t.scrollLeft=0;const g=e.indexOf(d),y=n.findIndex(v=>v.includes(g));Fw(y)&&(s.useDuration(0),r.index(y,0),o.emit("slideFocus"))};i.add(d,"focus",h,{passive:!0,capture:!0})}return{init:l}}function W0(t){let e=t;function n(){return e}function r(l){e=o(l)}function s(l){e+=o(l)}function i(l){e-=o(l)}function o(l){return Fw(l)?l:l.get()}return{get:n,set:r,add:s,subtract:i}}function DD(t,e){const n=t.scroll==="x"?i:o,r=e.style;let s=!1;function i(f){return`translate3d(${f}px,0px,0px)`}function o(f){return`translate3d(0px,${f}px,0px)`}function a(f){s||(r.transform=n(t.direction(f)))}function l(f){s=!f}function u(){s||(r.transform="",e.getAttribute("style")||e.removeAttribute("style"))}return{clear:u,to:a,toggleActive:l}}function Uz(t,e,n,r,s,i,o,a,l){const c=Ld(s),f=Ld(s).reverse(),d=y().concat(v());function h(C,O){return C.reduce((_,D)=>_-s[D],O)}function p(C,O){return C.reduce((_,D)=>h(_,O)>0?_.concat([D]):_,[])}function m(C){return i.map((O,_)=>({start:O-r[_]+.5+C,end:O+e-.5+C}))}function g(C,O,_){const D=m(O);return C.map(R=>{const L=_?0:-n,F=_?n:0,G=_?"end":"start",B=D[R][G];return{index:R,loopPoint:B,slideLocation:W0(-1),translate:DD(t,l[R]),target:()=>a.get()>B?L:F}})}function y(){const C=o[0],O=p(f,C);return g(O,n,!1)}function v(){const C=e-o[0]-1,O=p(c,C);return g(O,-n,!0)}function w(){return d.every(({index:C})=>{const O=c.filter(_=>_!==C);return h(O,e)<=.1})}function A(){d.forEach(C=>{const{target:O,translate:_,slideLocation:D}=C,R=O();R!==D.get()&&(_.to(R),D.set(R))})}function x(){d.forEach(C=>C.translate.clear())}return{canLoop:w,clear:x,loop:A,loopPoints:d}}function Vz(t,e,n){let r,s=!1;function i(l){if(!n)return;function u(c){for(const f of c)if(f.type==="childList"){l.reInit(),e.emit("slidesChanged");break}}r=new MutationObserver(c=>{s||(Uw(n)||n(l,c))&&u(c)}),r.observe(t,{childList:!0})}function o(){r&&r.disconnect(),s=!0}return{init:i,destroy:o}}function Hz(t,e,n,r){const s={};let i=null,o=null,a,l=!1;function u(){a=new IntersectionObserver(p=>{l||(p.forEach(m=>{const g=e.indexOf(m.target);s[g]=m}),i=null,o=null,n.emit("slidesInView"))},{root:t.parentElement,threshold:r}),e.forEach(p=>a.observe(p))}function c(){a&&a.disconnect(),l=!0}function f(p){return Fd(s).reduce((m,g)=>{const y=parseInt(g),{isIntersecting:v}=s[y];return(p&&v||!p&&!v)&&m.push(y),m},[])}function d(p=!0){if(p&&i)return i;if(!p&&o)return o;const m=f(p);return p&&(i=m),p||(o=m),m}return{init:u,destroy:c,get:d}}function zz(t,e,n,r,s,i){const{measureSize:o,startEdge:a,endEdge:l}=t,u=n[0]&&s,c=p(),f=m(),d=n.map(o),h=g();function p(){if(!u)return 0;const v=n[0];return Mt(e[a]-v[a])}function m(){if(!u)return 0;const v=i.getComputedStyle(ms(r));return parseFloat(v.getPropertyValue(`margin-${l}`))}function g(){return n.map((v,w,A)=>{const x=!w,k=Hw(A,w);return x?d[w]+c:k?d[w]+f:A[w+1][a]-v[a]}).map(Mt)}return{slideSizes:d,slideSizesWithGaps:h,startGap:c,endGap:f}}function $z(t,e,n,r,s,i,o,a,l){const{startEdge:u,endEdge:c,direction:f}=t,d=Fw(n);function h(y,v){return Ld(y).filter(w=>w%v===0).map(w=>y.slice(w,w+v))}function p(y){return y.length?Ld(y).reduce((v,w,A)=>{const x=ms(v)||0,k=x===0,C=w===Bd(y),O=s[u]-i[x][u],_=s[u]-i[w][c],D=!r&&k?f(o):0,R=!r&&C?f(a):0,L=Mt(_-R-(O+D));return A&&L>e+l&&v.push(w),C&&v.push(y.length),v},[]).map((v,w,A)=>{const x=Math.max(A[w-1]||0);return y.slice(x,v)}):[]}function m(y){return d?h(y,n):p(y)}return{groupSlides:m}}function Gz(t,e,n,r,s,i,o){const{align:a,axis:l,direction:u,startIndex:c,loop:f,duration:d,dragFree:h,dragThreshold:p,inViewThreshold:m,slidesToScroll:g,skipSnaps:y,containScroll:v,watchResize:w,watchSlides:A,watchDrag:x}=i,k=2,C=Sz(),O=C.measure(e),_=n.map(C.measure),D=kz(l,u),R=D.measureSize(O),L=Tz(R),F=vz(a,R),G=!f&&!!v,B=f||!!v,{slideSizes:H,slideSizesWithGaps:Q,startGap:te,endGap:Z}=zz(D,O,_,n,B,s),pe=$z(D,R,g,f,O,_,te,Z,k),{snaps:Ee,snapsAligned:Re}=Iz(D,F,O,_,pe),Ce=-ms(Ee)+ms(Q),{snapsContained:ke,scrollContainLimit:He}=Mz(R,Ce,Re,v,k),Ue=G?ke:Re,{limit:ze}=Nz(Ce,Ue,f),Le=TD(Bd(Ue),c,f),tt=Le.clone(),le=Ld(n),$e=({dragHandler:Je,scrollBody:Ve,scrollBounds:Fe,options:{loop:ft}})=>{ft||Fe.constrain(Je.pointerDown()),Ve.seek()},ae=({scrollBody:Je,translate:Ve,location:Fe,offsetLocation:ft,scrollLooper:Xn,slideLooper:br,dragHandler:X,animation:ne,eventHandler:ie,scrollBounds:Te,options:{loop:me}},qe)=>{const nt=Je.velocity(),yt=Je.settled(),sn=!Te.shouldConstrain(),Ft=me?yt:yt&&sn;Ft&&!X.pointerDown()&&(ne.stop(),ie.emit("settle")),Ft||ie.emit("scroll"),ft.set(Fe.get()-nt+nt*qe),me&&(Xn.loop(Je.direction()),br.loop()),Ve.to(ft.get())},be=xz(r,s,()=>$e(Se),Je=>ae(Se,Je)),Be=.68,z=Ue[Le.get()],q=W0(z),re=W0(z),ue=W0(z),P=Oz(q,re,ue,d,Be),b=Bz(f,Ue,Ce,ze,ue),E=Fz(be,Le,tt,P,b,ue,o),M=Pz(ze),j=jd(),K=Hz(e,n,o,m),{slideRegistry:Y}=Lz(G,v,Ue,He,pe,le),ye=jz(t,n,Y,E,P,j,o),Se={ownerDocument:r,ownerWindow:s,eventHandler:o,containerRect:O,slideRects:_,animation:be,axis:D,dragHandler:Ez(D,t,r,s,ue,Cz(D,s),q,be,E,P,b,Le,o,L,h,p,y,Be,x),eventStore:j,percentOfView:L,index:Le,indexPrevious:tt,limit:ze,location:q,offsetLocation:re,options:i,resizeHandler:Dz(e,o,s,n,D,w,C),scrollBody:P,scrollBounds:_z(ze,re,ue,P,L),scrollLooper:Rz(Ce,ze,re,[q,re,ue]),scrollProgress:M,scrollSnapList:Ue.map(M.get),scrollSnaps:Ue,scrollTarget:b,scrollTo:E,slideLooper:Uz(D,R,Ce,H,Q,Ee,Ue,re,n),slideFocus:ye,slidesHandler:Vz(e,o,A),slidesInView:K,slideIndexes:le,slideRegistry:Y,slidesToScroll:pe,target:ue,translate:DD(D,e)};return Se}function Wz(){let t={},e;function n(u){e=u}function r(u){return t[u]||[]}function s(u){return r(u).forEach(c=>c(e,u)),l}function i(u,c){return t[u]=r(u).concat([c]),l}function o(u,c){return t[u]=r(u).filter(f=>f!==c),l}function a(){t={}}const l={init:n,emit:s,off:o,on:i,clear:a};return l}const Kz={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0};function qz(t){function e(i,o){return SD(i,o||{})}function n(i){const o=i.breakpoints||{},a=Fd(o).filter(l=>t.matchMedia(l).matches).map(l=>o[l]).reduce((l,u)=>e(l,u),{});return e(i,a)}function r(i){return i.map(o=>Fd(o.breakpoints||{})).reduce((o,a)=>o.concat(a),[]).map(t.matchMedia)}return{mergeOptions:e,optionsAtMedia:n,optionsMediaQueries:r}}function Qz(t){let e=[];function n(i,o){return e=o.filter(({options:a})=>t.optionsAtMedia(a).active!==!1),e.forEach(a=>a.init(i,t)),o.reduce((a,l)=>Object.assign(a,{[l.name]:l}),{})}function r(){e=e.filter(i=>i.destroy())}return{init:n,destroy:r}}function K0(t,e,n){const r=t.ownerDocument,s=r.defaultView,i=qz(s),o=Qz(i),a=jd(),l=Wz(),{mergeOptions:u,optionsAtMedia:c,optionsMediaQueries:f}=i,{on:d,off:h,emit:p}=l,m=R;let g=!1,y,v=u(Kz,K0.globalOptions),w=u(v),A=[],x,k,C;function O(){const{container:$e,slides:ae}=w;k=(jw($e)?t.querySelector($e):$e)||t.children[0];const Be=jw(ae)?k.querySelectorAll(ae):ae;C=[].slice.call(Be||k.children)}function _($e){const ae=Gz(t,k,C,r,s,$e,l);if($e.loop&&!ae.slideLooper.canLoop()){const be=Object.assign({},$e,{loop:!1});return _(be)}return ae}function D($e,ae){g||(v=u(v,$e),w=c(v),A=ae||A,O(),y=_(w),f([v,...A.map(({options:be})=>be)]).forEach(be=>a.add(be,"change",R)),w.active&&(y.translate.to(y.location.get()),y.animation.init(),y.slidesInView.init(),y.slideFocus.init(),y.eventHandler.init(le),y.resizeHandler.init(le),y.slidesHandler.init(le),y.options.loop&&y.slideLooper.loop(),k.offsetParent&&C.length&&y.dragHandler.init(le),x=o.init(le,A)))}function R($e,ae){const be=Ee();L(),D(u({startIndex:be},$e),ae),l.emit("reInit")}function L(){y.dragHandler.destroy(),y.eventStore.clear(),y.translate.clear(),y.slideLooper.clear(),y.resizeHandler.destroy(),y.slidesHandler.destroy(),y.slidesInView.destroy(),y.animation.destroy(),o.destroy(),a.clear()}function F(){g||(g=!0,a.clear(),L(),l.emit("destroy"),l.clear())}function G($e,ae,be){!w.active||g||(y.scrollBody.useBaseFriction().useDuration(ae===!0?0:w.duration),y.scrollTo.index($e,be||0))}function B($e){const ae=y.index.add(1).get();G(ae,$e,-1)}function H($e){const ae=y.index.add(-1).get();G(ae,$e,1)}function Q(){return y.index.add(1).get()!==Ee()}function te(){return y.index.add(-1).get()!==Ee()}function Z(){return y.scrollSnapList}function pe(){return y.scrollProgress.get(y.location.get())}function Ee(){return y.index.get()}function Re(){return y.indexPrevious.get()}function Ce(){return y.slidesInView.get()}function ke(){return y.slidesInView.get(!1)}function He(){return x}function Ue(){return y}function ze(){return t}function Le(){return k}function tt(){return C}const le={canScrollNext:Q,canScrollPrev:te,containerNode:Le,internalEngine:Ue,destroy:F,off:h,on:d,emit:p,plugins:He,previousScrollSnap:Re,reInit:m,rootNode:ze,scrollNext:B,scrollPrev:H,scrollProgress:pe,scrollSnapList:Z,scrollTo:G,selectedScrollSnap:Ee,slideNodes:tt,slidesInView:Ce,slidesNotInView:ke};return D(e,n),setTimeout(()=>l.emit("init"),0),le}K0.globalOptions=void 0;function $w(t={},e=[]){const n=N.useRef(t),r=N.useRef(e),[s,i]=N.useState(),[o,a]=N.useState(),l=N.useCallback(()=>{s&&s.reInit(n.current,r.current)},[s]);return N.useEffect(()=>{if(bz()&&o){K0.globalOptions=$w.globalOptions;const u=K0(o,n.current,r.current);return i(u),()=>u.destroy()}else i(void 0)},[o,i]),N.useEffect(()=>{Bw(n.current,t)||(n.current=t,l())},[t,l]),N.useEffect(()=>{wz(r.current,e)||(r.current=e,l())},[e,l]),[a,s]}$w.globalOptions=void 0;const OD=N.createContext(null);function Ud(){const t=N.useContext(OD);if(!t)throw new Error("useCarousel must be used within a <Carousel />");return t}const _D=N.forwardRef(({orientation:t="horizontal",opts:e,setApi:n,plugins:r,className:s,children:i,...o},a)=>{const[l,u]=$w({...e,axis:t==="horizontal"?"x":"y"},r),[c,f]=N.useState(!1),[d,h]=N.useState(!1),p=N.useCallback(v=>{v&&(f(v.canScrollPrev()),h(v.canScrollNext()))},[]),m=N.useCallback(()=>{u==null||u.scrollPrev()},[u]),g=N.useCallback(()=>{u==null||u.scrollNext()},[u]),y=N.useCallback(v=>{v.key==="ArrowLeft"?(v.preventDefault(),m()):v.key==="ArrowRight"&&(v.preventDefault(),g())},[m,g]);return N.useEffect(()=>{!u||!n||n(u)},[u,n]),N.useEffect(()=>{if(u)return p(u),u.on("reInit",p),u.on("select",p),()=>{u==null||u.off("select",p)}},[u,p]),S.jsx(OD.Provider,{value:{carouselRef:l,api:u,opts:e,orientation:t||((e==null?void 0:e.axis)==="y"?"vertical":"horizontal"),scrollPrev:m,scrollNext:g,canScrollPrev:c,canScrollNext:d},children:S.jsx("div",{ref:a,onKeyDownCapture:y,className:he("relative",s),role:"region","aria-roledescription":"carousel",...o,children:i})})});_D.displayName="Carousel";const MD=N.forwardRef(({className:t,...e},n)=>{const{carouselRef:r,orientation:s}=Ud();return S.jsx("div",{ref:r,className:"overflow-hidden",children:S.jsx("div",{ref:n,className:he("flex",s==="horizontal"?"-ml-4":"-mt-4 flex-col",t),...e})})});MD.displayName="CarouselContent";const Gw=N.forwardRef(({className:t,...e},n)=>{const{orientation:r}=Ud();return S.jsx("div",{ref:n,role:"group","aria-roledescription":"slide",className:he("min-w-0 shrink-0 grow-0 basis-full",r==="horizontal"?"pl-4":"pt-4",t),...e})});Gw.displayName="CarouselItem";const ND=N.forwardRef(({index:t,className:e,...n},r)=>{const{api:s}=Ud(),[i,o]=N.useState(0),[,a]=N.useState([]),l=N.useCallback(d=>{s&&s.scrollTo(d)},[s]),u=N.useCallback(d=>{d&&a(d.scrollSnapList())},[]),c=N.useCallback(d=>{d&&o(d.selectedScrollSnap())},[]);N.useEffect(()=>{s&&(u(s),c(s),s.on("reInit",u),s.on("reInit",c),s.on("select",c))},[s,u,c]);const f=i===t;return S.jsx("button",{ref:r,className:he("w-2 h-2 transition-colors duration-200 rounded-full",f?"bg-black":"bg-[#E8EBEC] hover:bg-black/50",e),onClick:()=>l(t),...n})});ND.displayName="CarouselIndicator";const Jz=N.forwardRef(({className:t,...e},n)=>{const{scrollPrev:r,canScrollPrev:s}=Ud();return S.jsx("button",{ref:n,className:he("btn bg-white hover:bg-[#F2F4F5] transition text-black flex items-center border-2 rounded h-9 px-4 py-2 text-sm font-medium disabled:bg-[#E8EBEC] disabled:text-[#A1AAB1]",t),disabled:!s,onClick:r,...e,children:S.jsx("span",{children:"Back"})})});Jz.displayName="CarouselPrevious";const Yz=N.forwardRef(({className:t,...e},n)=>{const{scrollNext:r,canScrollNext:s}=Ud();return S.jsx("button",{ref:n,className:he("btn bg-black hover:bg-black text-white flex items-center border-2 rounded h-9 px-4 py-2 text-sm font-medium disabled:bg-[#E8EBEC] disabled:text-[#A1AAB1]",t),disabled:!s,onClick:r,...e,children:S.jsx("span",{children:"Next"})})});Yz.displayName="CarouselNext";const q0=V.forwardRef(({className:t,label:e,type:n="text",isValid:r=!0,message:s,onChange:i,leftIcon:o,rightIcon:a,...l},u)=>{const c=V.useRef(null),f=Gr(u,c),d=V.useCallback(()=>{var m;(m=c.current)==null||m.focus()},[]),h=V.useMemo(()=>{if(o==null)return;const m=V.Children.only(o);if(V.isValidElement(m))return V.cloneElement(m,{...m.props,onClick:g=>{var y,v;(v=(y=m.props).onClick)==null||v.call(y,g),d()},className:he("absolute left-3 text-[#A1AAB1]",{"cursor-not-allowed":l.disabled})})},[d,o,l.disabled]),p=V.useMemo(()=>{if(a==null)return;const m=V.Children.only(a);if(V.isValidElement(m))return V.cloneElement(m,{...m.props,onClick:g=>{var y,v;(v=(y=m.props).onClick)==null||v.call(y,g),d()},className:he("absolute right-3 cursor-pointer text-[#A1AAB1]",{"cursor-not-allowed":l.disabled},{"text-red-500":!r})})},[d,a,l.disabled,r]);return S.jsxs("div",{className:"flex flex-col",children:[e?S.jsx("label",{className:"mb-2 text-sm font-medium",children:e}):null,S.jsxs("div",{className:"relative flex items-center group",children:[h,S.jsx("input",{type:n,className:he("flex h-9 w-full rounded border-[1px] border-[#E8EBEC] hover:border-black bg-transparent px-3 py-2 text-sm text-black transition-colors file:border-0 file:bg-transparent file:text-sm placeholder:text-[#A1AAB1] focus-visible:outline-none focus-visible:border-black",{"pr-3 pl-10":h},{"pr-10":p},{"border-red-500":!r},{"disabled:cursor-not-allowed disabled:bg-[#E8EBEC] disabled:border-[#A1AAB1] disabled:text-[#A1AAB1]":l.disabled},t),onChange:i,ref:f,...l}),p]}),s?S.jsx("p",{className:he("text-sm mt-2 font-normal text-wrap text-justify",{"text-red-500":!r,"text-black":r}),children:s}):null]})});q0.displayName="TextField";const sl=N.forwardRef(({active:t,buttonSize:e="medium",children:n,disabled:r,variant:s="primary",className:i,activeClassname:o,isLoading:a=!1,...l},u)=>{const c=he("flex items-center justify-center border-2 gap-2 transition text-sm font-semibold rounded disabled:opacity-50 whitespace-nowrap",s==="primary"&&he("text-white bg-black border-black",!r&&!t&&"hover:bg-neutral-800 active:bg-neutral-900",t&&he("bg-neutral-900 dark:bg-neutral-300",o)),s==="secondary"&&he("text-neutral-900 border-black",!r&&!t&&"hover:bg-neutral-100 active:bg-neutral-200",t&&"bg-neutral-200"),s==="tertiary"&&he("bg-neutral-50 text-neutral-900 border-transparent",!r&&!t&&"hover:bg-neutral-100 active:bg-neutral-200",t&&he("bg-neutral-200",o)),s==="ghost"&&he("bg-transparent border-transparent text-neutral-900",!r&&!t&&"hover:bg-black/5 hover:text-neutral-700 active:bg-black/10",t&&he("bg-black/10",o)),e==="medium"&&"py-2 px-3",e==="small"&&"py-1 px-2",e==="icon"&&"w-8 h-8",e==="iconSmall"&&"w-6 h-6",i);return S.jsx("button",{ref:u,disabled:r,className:c,...l,children:a?S.jsx(eV,{size:20,className:"animate-spin",fill:"transparent",stroke:"currentColor"}):n})});sl.displayName="Button";const RD=[{title:"Trebuchet MS",value:"Trebuchet MS, sans-serif",command:t=>{t.chain().focus().setFontFamily("Trebuchet MS, sans-serif").run()}},{title:"Verdana",value:"Verdana, Geneva, sans-serif",command:t=>{t.chain().focus().setFontFamily("Verdana, Geneva, sans-serif").run()}},{title:"Georgia",value:"Georgia, serif",command:t=>{t.chain().focus().setFontFamily("Georgia, serif").run()}},{title:"Arial",value:"Arial, Helvetica, sans-serif",command:t=>{t.chain().focus().setFontFamily("Arial, Helvetica, sans-serif").run()}},{title:"Comic Sans MS",value:"Comic Sans MS, Comic Sans",command:t=>{t.chain().focus().setFontFamily("Comic Sans MS, Comic Sans").run()}},{title:"Impact",value:"Impact, Charcoal, sans-serif",command:t=>{t.chain().focus().setFontFamily("Impact, Charcoal, sans-serif").run()}},{title:"Palatino",value:"Palatino Linotype, Book Antiqua, Palatino, serif",command:t=>{t.chain().focus().setFontFamily("Palatino Linotype, Book Antiqua, Palatino, serif").run()}},{title:"Lucida Grande",value:"Lucida Sans Unicode, Lucida Grande, sans-serif",command:t=>{t.chain().focus().setFontFamily("Lucida Sans Unicode, Lucida Grande, sans-serif").run()}},{title:"Serif",value:"serif",command:t=>{t.chain().focus().setFontFamily("serif").run()}},{title:"Monospace",value:"monospace",command:t=>{t.chain().focus().setFontFamily("monospace").run()}},{title:"Cursive",value:"cursive",command:t=>{t.chain().focus().setFontFamily("cursive").run()}}],Ww=[{color:"#00FF00",code:"bg-[#00FF00]"},{color:"#008080",code:"bg-[#008080]"},{color:"#FFC0CB",code:"bg-[#FFC0CB]"},{color:"#808000",code:"bg-[#808000]"},{color:"#800000",code:"bg-[#800000]"},{color:"#000080",code:"bg-[#000080]"},{color:"#7FFFD4",code:"bg-[#7FFFD4]"},{color:"#40E0D0",code:"bg-[#40E0D0]"},{color:"#C0C0C0",code:"bg-[#C0C0C0]"},{color:"#808080",code:"bg-[#808080]"},{color:"#000000",code:"bg-[#000000]"},{color:"#FFFFFF",code:"bg-[#FFFFFF]"},{color:"#CD5C5C",code:"bg-[#CD5C5C]"},{color:"#F08080",code:"bg-[#F08080]"},{color:"#FA8072",code:"bg-[#FA8072]"},{color:"#E9967A",code:"bg-[#E9967A]"},{color:"#FFA07A",code:"bg-[#FFA07A]"},{color:"#DC143C",code:"bg-[#DC143C]"},{color:"#FF6347",code:"bg-[#FF6347]"},{color:"#FF7F50",code:"bg-[#FF7F50]"},{color:"#FF4500",code:"bg-[#FF4500]"},{color:"#BDB76B",code:"bg-[#BDB76B]"},{color:"#FFD700",code:"bg-[#FFD700]"},{color:"#F0E68C",code:"bg-[#F0E68C]"},{color:"#FFE5B4",code:"bg-[#FFE5B4]"},{color:"#9ACD32",code:"bg-[#9ACD32]"},{color:"#556B2F",code:"bg-[#556B2F]"},{color:"#6B8E23",code:"bg-[#6B8E23]"},{color:"#7CFC00",code:"bg-[#7CFC00]"},{color:"#7FFF00",code:"bg-[#7FFF00]"},{color:"#ADFF2F",code:"bg-[#ADFF2F]"},{color:"#00BFFF",code:"bg-[#00BFFF]"},{color:"#1E90FF",code:"bg-[#1E90FF]"},{color:"#6495ED",code:"bg-[#6495ED]"},{color:"#4682B4",code:"bg-[#4682B4]"},{color:"#4169E1",code:"bg-[#4169E1]"},{color:"#8A2BE2",code:"bg-[#8A2BE2]"},{color:"#4B0082",code:"bg-[#4B0082]"},{color:"#6A5ACD",code:"bg-[#6A5ACD]"}],Vd=1024*100,Kw={IMAGE_SIZE:"Image size should be less than 100KB"},qw=({editor:t,onError:e})=>{const{ref:n,toolVisibilty:r,setToolVisibility:s}=hV(Me.NONE),i=[{icon:S.jsx(KU,{size:20}),title:"Text Color",onClick:()=>s(Me.TEXT_COLOR),isActive:r===Me.TEXT_COLOR},{icon:S.jsx(QT,{size:20}),title:"Highlight",onClick:()=>s(Me.HIGHLIGHT),isActive:r===Me.HIGHLIGHT},null,{icon:S.jsx(ew,{size:20}),title:"Bold",onClick:()=>t==null?void 0:t.chain().focus().toggleBold().run(),isActive:t==null?void 0:t.isActive("bold")},{icon:S.jsx(tw,{size:20}),title:"Italic",onClick:()=>t==null?void 0:t.chain().focus().toggleItalic().run(),isActive:t==null?void 0:t.isActive("italic")},{icon:S.jsx(lw,{size:20}),title:"Underlined",onClick:()=>t==null?void 0:t.chain().focus().toggleUnderline().run(),isActive:t==null?void 0:t.isActive("underline")},{icon:S.jsx(sw,{size:20}),title:"Strikethrough",onClick:()=>t==null?void 0:t.chain().focus().toggleStrike().run(),isActive:t==null?void 0:t.isActive("strike")},null,{icon:S.jsx(D0,{size:20}),title:"List",onClick:()=>{t==null||t.chain().focus().toggleBulletList().run(),s(Me.NONE)},isActive:t==null?void 0:t.isActive("bulletList")},{icon:S.jsx(Uu,{size:20}),title:"Ordered List",onClick:()=>{t==null||t.chain().focus().toggleOrderedList().run(),s(Me.NONE)},isActive:t==null?void 0:t.isActive("orderedList")},{icon:S.jsx(rw,{size:20}),title:"To-do List",onClick:()=>{t==null||t.chain().focus().toggleTaskList().run(),s(Me.NONE)},isActive:t==null?void 0:t.isActive("taskList")},{icon:S.jsx(Od,{size:20}),title:"Alignment",onClick:()=>s(Me.ALIGNMENT),isActive:r===Me.ALIGNMENT},{icon:S.jsx(O0,{size:20}),title:"Quote",onClick:()=>t==null?void 0:t.chain().focus().toggleBlockquote().run(),isActive:t==null?void 0:t.isActive("blockquote")},null,{icon:S.jsx(JT,{size:20}),title:"Upload Image",onClick:()=>{t==null||t.chain().focus().deleteRange(t.state.selection).run();const a=document.createElement("input");a.type="file",a.accept="image/*",a.onchange=async()=>{var l;if((l=a.files)!=null&&l.length){const u=a.files[0];if(u.size>Vd){e&&typeof e=="function"&&e(Kw.IMAGE_SIZE);return}const f=t.view.state.selection.from;uw(u,t.view,f)}},a.click()},isActive:!1},{icon:S.jsx(nw,{size:20}),title:"Link",onClick:()=>s(Me.LINK),isActive:t==null?void 0:t.isActive("link")},{icon:S.jsx(Md,{size:20}),title:"Code",onClick:()=>t==null?void 0:t.chain().focus().toggleCodeBlock().run(),isActive:t==null?void 0:t.isActive("codeBlock")},{icon:S.jsx(iw,{size:20}),title:"Add table",onClick:()=>t==null?void 0:t.chain().focus().insertTable({rows:3,cols:2,withHeaderRow:!0}).run(),isActive:r===Me.TEXT_COLOR}],o=[{icon:S.jsx(aw,{size:24}),title:"Text formating",onClick:()=>s(Me.TEXT_FORMATING),isActive:r===Me.TEXT_FORMATING},{icon:S.jsx(iw,{size:24}),title:"Add table",onClick:()=>t==null?void 0:t.chain().focus().insertTable({rows:3,cols:2,withHeaderRow:!0}).run(),isActive:!0},{icon:S.jsx(rw,{size:24}),title:"To-do list",onClick:()=>{t==null||t.chain().focus().toggleTaskList().run(),s(Me.NONE)},isActive:!0},{icon:S.jsx(JT,{size:24}),title:"Add image",onClick:()=>{t==null||t.chain().focus().deleteRange(t.state.selection).run();const a=document.createElement("input");a.type="file",a.accept="image/*",a.onchange=async()=>{var l;if((l=a.files)!=null&&l.length){const u=a.files[0];if(u.size>Vd){e&&typeof e=="function"&&e(Kw.IMAGE_SIZE);return}const f=t.view.state.selection.from;uw(u,t.view,f)}},a.click()},isActive:!0},{icon:S.jsx(uV,{size:24}),title:"Undo",onClick:()=>{t==null||t.chain().focus().undo().run()},isActive:t==null?void 0:t.can().undo()},{icon:S.jsx(oV,{size:24}),title:"Redo",onClick:()=>{t==null||t.chain().focus().redo().run()},isActive:t==null?void 0:t.can().redo()}];return{toolbar:i,bottomToolbar:o,toolRef:n,toolVisibilty:r,setToolVisibility:s}},PD=({editor:t,setVisibility:e,elementRef:n})=>{const r=[{color:"#00FF00",code:"bg-[#00FF00]"},{color:"#008080",code:"bg-[#008080]"},{color:"#FFC0CB",code:"bg-[#FFC0CB]"},{color:"#808000",code:"bg-[#808000]"},{color:"#800000",code:"bg-[#800000]"},{color:"#000080",code:"bg-[#000080]"},{color:"#7FFFD4",code:"bg-[#7FFFD4]"},{color:"#40E0D0",code:"bg-[#40E0D0]"},{color:"#C0C0C0",code:"bg-[#C0C0C0]"},{color:"#808080",code:"bg-[#808080]"},{color:"#000000",code:"bg-[#000000]"},{color:"#FFFFFF",code:"bg-[#FFFFFF]"},{color:"#CD5C5C",code:"bg-[#CD5C5C]"},{color:"#F08080",code:"bg-[#F08080]"},{color:"#FA8072",code:"bg-[#FA8072]"},{color:"#E9967A",code:"bg-[#E9967A]"},{color:"#FFA07A",code:"bg-[#FFA07A]"},{color:"#DC143C",code:"bg-[#DC143C]"},{color:"#FF6347",code:"bg-[#FF6347]"},{color:"#FF7F50",code:"bg-[#FF7F50]"},{color:"#FF4500",code:"bg-[#FF4500]"},{color:"#BDB76B",code:"bg-[#BDB76B]"},{color:"#FFD700",code:"bg-[#FFD700]"},{color:"#F0E68C",code:"bg-[#F0E68C]"},{color:"#FFE5B4",code:"bg-[#FFE5B4]"},{color:"#9ACD32",code:"bg-[#9ACD32]"},{color:"#556B2F",code:"bg-[#556B2F]"},{color:"#6B8E23",code:"bg-[#6B8E23]"},{color:"#7CFC00",code:"bg-[#7CFC00]"},{color:"#7FFF00",code:"bg-[#7FFF00]"},{color:"#ADFF2F",code:"bg-[#ADFF2F]"},{color:"#00BFFF",code:"bg-[#00BFFF]"},{color:"#1E90FF",code:"bg-[#1E90FF]"},{color:"#6495ED",code:"bg-[#6495ED]"},{color:"#4682B4",code:"bg-[#4682B4]"},{color:"#4169E1",code:"bg-[#4169E1]"},{color:"#8A2BE2",code:"bg-[#8A2BE2]"},{color:"#4B0082",code:"bg-[#4B0082]"},{color:"#6A5ACD",code:"bg-[#6A5ACD]"}];return S.jsxs("div",{ref:n,className:"z-50 h-auto absolute gap-2 top-14 flex flex-wrap left-[20%] max-h-[330px] w-[20.5rem] overflow-y-auto scroll-smooth rounded bg-white px-1 py-2 shadow-lg transition-all",children:[S.jsx(Z1,{className:"cursor-pointer",onClick:()=>{t.chain().focus().unsetHighlight().run(),e(Me.NONE)}}),r.map(s=>S.jsx("div",{onClick:()=>{t.chain().focus().toggleHighlight({color:s.color}).run(),e(Me.NONE)},className:he("w-6 drop-shadow rounded-full flex items-center justify-center cursor-pointer ease-in duration-200 hover:scale-[1.05] h-6",s.code),children:S.jsx(_d,{size:14,className:he(t.isActive("highlight",{color:s.color})?"visible":"invisible")})},s.color))]})},Xz=({elementRef:t,editor:e,setToolVisibility:n})=>S.jsx("div",{ref:t,className:he("z-50 h-auto absolute top-14 left-0 max-h-[330px] w-48 overflow-y-auto scroll-smooth bg-white px-1 py-2 shadow-lg transition-all rounded animate-in fade-in slide-in-from-top-1"),children:RD.map(r=>S.jsx("button",{onClick:()=>{r.command(e),n(Me.NONE)},style:{fontFamily:r.title},className:he("flex w-full items-center space-x-2 rounded px-2 py-1 text-left text-sm text-black transition",e.isActive("textStyle",{fontFamily:r.value})?"bg-yellow-300 hover:brightness-90":"hover:bg-[#f2f2f2]"),children:S.jsx("p",{className:"font-medium",children:r.title})},r.title))}),ID=({elementRef:t,editor:e,setToolVisibility:n})=>S.jsxs("div",{ref:t,className:"z-50 h-auto absolute gap-2 top-14 left-[60%] translate-x-1/2 flex flex-wrap max-h-[330px] overflow-y-auto scroll-smooth rounded bg-white px-1 py-2 shadow-lg transition-all",children:[S.jsx("span",{onClick:()=>{e==null||e.chain().focus().setTextAlign("left").run(),n(Me.NONE)},className:he("rounded w-8 h-8 p-1 flex justify-center items-center cursor-pointer transition",e.isActive({textAlign:"left"})?"bg-yellow-300 hover:brightness-90":"hover:bg-[#f2f2f2]"),children:S.jsx(Od,{})}),S.jsx("span",{onClick:()=>{e==null||e.chain().focus().setTextAlign("center").run(),n(Me.NONE)},className:he("rounded w-8 h-8 p-1 flex justify-center items-center cursor-pointer transition",e.isActive({textAlign:"center"})?"bg-yellow-300 hover:brightness-90":"hover:bg-[#f2f2f2]"),children:S.jsx(Y1,{})}),S.jsx("span",{onClick:()=>{e==null||e.chain().focus().setTextAlign("right").run(),n(Me.NONE)},className:he("rounded w-8 h-8 p-1 flex justify-center items-center cursor-pointer transition",e.isActive({textAlign:"right"})?"bg-yellow-300 hover:brightness-90":"hover:bg-[#f2f2f2]"),children:S.jsx(X1,{})})]}),Zz=({elementRef:t,editor:e,setToolVisibility:n})=>S.jsxs("div",{ref:t,className:he("z-50 h-auto absolute gap-2 top-[50px] right-[30%] flex flex-wrap max-h-[330px] overflow-y-auto scroll-smooth rounded bg-white px-1 py-2 shadow-lg transition-all"),children:[S.jsx("div",{className:"tooltip tooltip-open tooltip-bottom","data-tip":"unordered list",children:S.jsx("span",{onClick:()=>{e==null||e.chain().focus().toggleBulletList().run(),n(Me.NONE)},className:` hover:bg-[#f2f2f2] ${e.isActive("bulletList")?"bg-[#f2f2f2]":""} rounded-lg w-8 h-8 p-1 flex justify-center items-center`,children:S.jsx(D0,{size:20})})}),S.jsx("div",{className:"tooltip tooltip-open tooltip-bottom","data-tip":"ordered list",children:S.jsx("span",{onClick:()=>{e==null||e.chain().focus().toggleOrderedList().run(),n(Me.NONE)},className:` hover:bg-[#f2f2f2] ${e.isActive("orderedList")?"bg-[#f2f2f2]":""} rounded-lg w-8 h-8 p-1 flex justify-center items-center`,children:S.jsx(Uu,{size:20})})}),S.jsx("div",{className:"tooltip tooltip-open tooltip-bottom","data-tip":"to-do list",children:S.jsx("span",{onClick:()=>{e==null||e.chain().focus().toggleTaskList().run(),n(Me.NONE)},className:` hover:bg-[#f2f2f2] ${e.isActive("taskList")?"bg-[#f2f2f2]":""} rounded-lg w-8 h-8 p-1 flex justify-center items-center`,children:S.jsx(rw,{size:20})})})]}),LD=({elementRef:t,editor:e,setToolVisibility:n,bubbleMenu:r,setIsLinkPopupOpen:s})=>{const[i,o]=N.useState(e.getAttributes("link").href),a=()=>{if(i===null)return;if(i===""){e.chain().focus().extendMarkRange("link").unsetLink().run();return}let l=i;!i.startsWith("http://")&&!i.startsWith("https://")&&(l="https://"+i);try{l.match(/^((http|https):\/\/)?([w|W]{3}\.)+[a-zA-Z0-9\-\.]{3,}\.[a-zA-Z]{2,}(\.[a-zA-Z]{2,})?$/)&&e.chain().focus().extendMarkRange("link").setLink({href:l}).run()}catch{console.error("Invalid URL");return}e.chain().focus().extendMarkRange("link").setLink({href:l}).run(),n(Me.NONE),r&&s&&s(!1)};return S.jsxs("div",{ref:t,className:"z-50 h-auto absolute gap-2 top-14 translate-x-1/2 items-center flex max-h-[330px] overflow-y-auto scroll-smooth rounded-lg bg-white p-2 shadow-lg transition-all",children:[S.jsx(q0,{onChange:l=>o(l.target.value),className:"w-full",placeholder:"Add link here",value:i}),S.jsx("div",{className:"h-full flex items-center",children:S.jsx(sl,{variant:"secondary",onClick:()=>a(),className:"min-w-fit h-[36px]",children:"Apply"})})]})},e$=({editor:t,setVisibility:e,elementRef:n})=>S.jsxs("div",{ref:n,className:"z-50 h-auto absolute gap-2 top-14 flex flex-wrap left-[100px] max-h-[330px] w-[20.5rem] overflow-y-auto scroll-smooth rounded bg-white px-1 py-2 shadow-lg transition-all",children:[S.jsx(Z1,{className:"cursor-pointer",onClick:()=>{t.chain().focus().unsetColor().run(),e(Me.NONE)}}),Ww.map(r=>S.jsx("div",{onClick:()=>{t.chain().focus().setColor(r.color).run(),e(Me.NONE)},className:he("w-6 drop-shadow rounded-full flex justify-center items-center cursor-pointer ease-in duration-200 hover:scale-[1.05] h-6",r.code),children:S.jsx(_d,{size:14,className:he(t.isActive("textStyle",{color:r.color})?"visible":"invisible")})},r.color))]}),t$=({editor:t,setVisibility:e,elementRef:n})=>{const r=[{title:"Text",description:"Normal",icon:S.jsx(aw,{size:20}),command:s=>s.chain().focus().toggleNode("paragraph","paragraph").run(),isActive:()=>t.isActive("paragraph")&&!t.isActive("bulletList")&&!t.isActive("orderedList")},{title:"Heading 1",description:"Big",icon:S.jsx(C0,{size:20}),command:s=>{s.chain().focus().toggleHeading({level:1}).run()},isActive:()=>t.isActive("heading",{level:1})},{title:"Heading 2",description:"Medium",icon:S.jsx(S0,{size:20}),command:s=>{s.chain().focus().toggleHeading({level:2}).run()},isActive:()=>t.isActive("heading",{level:2})},{title:"Heading 3",description:"Small",icon:S.jsx(T0,{size:20}),command:s=>{s.chain().focus().toggleHeading({level:3}).run()},isActive:()=>t.isActive("heading",{level:3})}];return S.jsx("div",{ref:n,className:he("absolute top-[50px] z-50 mt-1 flex w-48 flex-col overflow-hidden rounded bg-white p-1 shadow-lg animate-in fade-in slide-in-from-top-1","left-0"),children:r.map(s=>S.jsxs("button",{onClick:()=>{s.command(t),e(Me.NONE)},className:he("flex w-full items-center space-x-2 rounded-md px-2 py-1 text-left text-sm text-black transition",{"bg-yellow-300 hover:brightness-90":s.isActive(),"hover:bg-[#f2f2f2]":!s.isActive()}),children:[S.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded bg-white",children:s.icon}),S.jsxs("div",{children:[S.jsx("p",{className:"font-medium",children:s.title}),S.jsxs("p",{className:"text-xs text-stone-500",children:[" ",s.description," "]})]})]},s.title))})},n$=({editor:t,setToolVisibility:e})=>{const n=[{title:"Text",description:"Normal",icon:S.jsx(aw,{size:20}),command:r=>r.chain().focus().toggleNode("paragraph","paragraph").run(),isActive:()=>t.isActive("paragraph")&&!t.isActive("bulletList")&&!t.isActive("orderedList")},{title:"Heading 1",description:"Big",icon:S.jsx(C0,{size:20}),command:r=>{r.chain().focus().toggleHeading({level:1}).run()},isActive:()=>t.isActive("heading",{level:1})},{title:"Heading 2",description:"Medium",icon:S.jsx(S0,{size:20}),command:r=>{r.chain().focus().toggleHeading({level:2}).run()},isActive:()=>t.isActive("heading",{level:2})},{title:"Heading 3",description:"Small",icon:S.jsx(T0,{size:20}),command:r=>{r.chain().focus().toggleHeading({level:3}).run()},isActive:()=>t.isActive("heading",{level:3})}];return S.jsx(fz,{title:"Text formating",content:S.jsxs("div",{className:"px-4 flex flex-col gap-2 w-full",children:[S.jsx("div",{className:"flex justify-start sm:justify-center items-center gap-1",children:n.map(r=>S.jsx("button",{onClick:()=>r.command(t),className:he("flex w-fit items-center font-medium space-x-2 rounded p-2 text-center text-sm text-black transition",{"bg-yellow-300 hover:brightness-90":r.isActive(),"hover:bg-[#f2f2f2]":!r.isActive()}),children:r.title},r.title))}),S.jsxs("div",{className:"flex justify-between sm:justify-center items-center gap-1",children:[S.jsxs("div",{className:"bg-[#f8f9fa] rounded flex gap-1 justify-evenly w-full sm:w-fit p-1",children:[S.jsx("button",{onClick:()=>{t==null||t.chain().focus().setTextAlign("left").run()},className:he("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive({textAlign:"left"}),"hover:bg-[#f2f2f2]":!t.isActive({textAlign:"left"})}),children:S.jsx(Od,{size:20})}),S.jsx("button",{onClick:()=>{t==null||t.chain().focus().setTextAlign("center").run()},className:he("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive({textAlign:"center"}),"hover:bg-[#f2f2f2]":!t.isActive({textAlign:"center"})}),children:S.jsx(Y1,{size:20})}),S.jsx("button",{onClick:()=>{t==null||t.chain().focus().setTextAlign("right").run()},className:he("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive({textAlign:"right"}),"hover:bg-[#f2f2f2]":!t.isActive({textAlign:"right"})}),children:S.jsx(X1,{size:20})})]}),S.jsxs("div",{className:"bg-[#f8f9fa] rounded flex gap-1 justify-evenly w-full sm:w-fit p-1",children:[S.jsx(hz,{asChild:!0,children:S.jsx("button",{onClick:()=>e(Me.LINK_POPUP),className:he("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive("link"),"hover:bg-[#f2f2f2]":!t.isActive("link")}),children:S.jsx(nw,{size:20})})}),S.jsx("button",{onClick:()=>{t==null||t.chain().focus().toggleCodeBlock().run()},className:he("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive("codeBlock"),"hover:bg-[#f2f2f2]":!t.isActive("codeBlock")}),children:S.jsx(Md,{size:20})}),S.jsx("button",{onClick:()=>{t==null||t.chain().focus().toggleBlockquote().run()},className:he("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive("blockquote"),"hover:bg-[#f2f2f2]":!t.isActive("blockquote")}),children:S.jsx(O0,{size:20})})]})]}),S.jsxs("div",{className:"flex justify-between sm:justify-center items-center gap-1",children:[S.jsxs("div",{className:"bg-[#f8f9fa] rounded flex gap-1 justify-evenly w-full sm:w-fit p-1",children:[S.jsx("button",{onClick:()=>{t.chain().focus().toggleBold().run()},className:he("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive("bold"),"hover:bg-[#f2f2f2]":!t.isActive("bold")}),children:S.jsx(ew,{size:20})}),S.jsx("button",{onClick:()=>{t.chain().focus().toggleItalic().run()},className:he("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive("italic"),"hover:bg-[#f2f2f2]":!t.isActive("italic")}),children:S.jsx(tw,{size:20})}),S.jsx("button",{onClick:()=>{t.chain().focus().toggleUnderline().run()},className:he("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive("underline"),"hover:bg-[#f2f2f2]":!t.isActive("bold")}),children:S.jsx(lw,{size:20})}),S.jsx("button",{onClick:()=>{t.chain().focus().toggleStrike().run()},className:he("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive("strike"),"hover:bg-[#f2f2f2]":!t.isActive("bold")}),children:S.jsx(sw,{size:20})})]}),S.jsxs("div",{className:"bg-[#f8f9fa] rounded flex flex-[0.5] sm:flex-none gap-2 justify-evenly w-full sm:w-fit p-1",children:[S.jsx("button",{onClick:()=>{t==null||t.chain().focus().toggleBulletList().run()},className:he("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive("bulletList"),"hover:bg-[#f2f2f2]":!t.isActive("bulletList")}),children:S.jsx(D0,{size:20})}),S.jsx("button",{onClick:()=>{t==null||t.chain().focus().toggleOrderedList().run()},className:he("flex items-center space-x-2 rounded px-4 py-1 text-black transition h-9",{"bg-yellow-300 hover:brightness-90":t.isActive("orderedList"),"hover:bg-[#f2f2f2]":!t.isActive("orderedList")}),children:S.jsx(Uu,{size:20})})]})]}),S.jsxs("div",{className:"flex flex-col gap-4 mt-4",children:[S.jsx("p",{className:"text-left sm:text-center text-lg font-semibold leading-none tracking-tight",children:"Text color"}),S.jsxs(_D,{opts:{align:"start",dragFree:!0,slidesToScroll:"auto"},className:"w-full max-w-md mx-auto",children:[S.jsxs(MD,{children:[S.jsx(Gw,{style:{flexBasis:"calc(100% / 12)"},children:S.jsx(Z1,{className:"cursor-pointer",onClick:()=>{t.chain().focus().unsetColor().run()}})}),Ww.map((r,s)=>S.jsx(Gw,{style:{flexBasis:"calc(100% / 12)"},children:S.jsx("button",{onClick:()=>{t.chain().focus().setColor(r.color).run()},className:he("w-6 h-6 mb-1 drop-shadow rounded-full flex justify-center items-center cursor-pointer transition",r.code),children:S.jsx(_d,{size:14,className:he(t.isActive("textStyle",{color:r.color})?"visible":"invisible")})},r.color)},s))]}),S.jsx("div",{className:"flex justify-center gap-2 mt-4 w-full max-w-sm",children:Array.from({length:Ww.length/8}).map((r,s)=>S.jsx(ND,{index:s},s))})]})]})]})})},r$=t=>{const e=[{name:"Bold",isActive:()=>t.editor.isActive("bold"),command:()=>t.editor.chain().focus().toggleBold().run(),icon:S.jsx(ew,{size:20})},{name:"Italic",isActive:()=>t.editor.isActive("italic"),command:()=>t.editor.chain().focus().toggleItalic().run(),icon:S.jsx(tw,{size:20})},{name:"Underline",isActive:()=>t.editor.isActive("underline"),command:()=>t.editor.chain().focus().toggleUnderline().run(),icon:S.jsx(lw,{size:20})},{name:"Strikethrough",isActive:()=>t.editor.isActive("strike"),command:()=>t.editor.chain().focus().toggleStrike().run(),icon:S.jsx(sw,{size:20})},{name:"Alignment",isActive:()=>f===Me.ALIGNMENT,command:()=>c(Me.ALIGNMENT),icon:S.jsx(Od,{size:20})},{name:"Code",isActive:()=>t.editor.isActive("codeBlock"),command:()=>t.editor.chain().focus().toggleCodeBlock().run(),icon:S.jsx(Md,{size:20})},{name:"Link",isActive:()=>t.editor.isActive("link"),command:()=>l(!a),icon:S.jsx(nw,{size:20})}],n={...t,shouldShow:({state:h,editor:p})=>{const{selection:m}=h,{empty:g}=m;return!(p.isActive("image")||g||k1(m))},tippyOptions:{moveTransition:"transform 0.15s ease-out",duration:200,animation:"shift-toward-subtle",onHidden:()=>{s(!1),o(!1),l(!1)}}},[r,s]=N.useState(!1),[i,o]=N.useState(!1),[a,l]=N.useState(!1),{toolRef:u,setToolVisibility:c,toolVisibilty:f}=qw({editor:t.editor}),d=({editor:h})=>{const{from:p,to:m}=h.state.selection;if(p===m)return!1;let g=!1;return h.state.doc.nodesBetween(p,m,y=>{y.marks&&y.marks.forEach(v=>{v.type.name==="highlight"&&v.attrs.color==="yellow"&&(g=!0)})}),!g};return S.jsxs(VT,{...n,shouldShow:d,className:"hidden lg:flex gap-2 overflow-hidden rounded-[12px] h-[52px] min-w-[550px] w-full py-2 px-4 bg-white items-center shadow-lg",children:[S.jsx(fV,{editor:t.editor,isOpen:r,setIsOpen:()=>{s(!r),o(!1)}}),e.map((h,p)=>S.jsxs("div",{className:"flex items-center",children:[S.jsx("button",{onClick:h.command,className:he("min-w-fit w-8 h-8 px-2 rounded",{"bg-yellow-300":h.isActive()}),children:h.icon}),(p===4||p===6)&&S.jsx("div",{className:"w-1.5 h-4 bg-gray-300 mx-2"})]},p)),S.jsx(dV,{editor:t.editor,isOpen:i,setIsOpen:()=>{o(!i),s(!1)}}),S.jsx("button",{onClick:()=>c(Me.HIGHLIGHT),className:he("min-w-fit w-8 h-8 px-2",{"bg-yellow-300":f===Me.HIGHLIGHT}),children:S.jsx(QT,{size:20})}),f===Me.ALIGNMENT&&S.jsx(ID,{setToolVisibility:c,editor:t.editor,elementRef:u}),a&&S.jsx(LD,{setToolVisibility:c,editor:t.editor,elementRef:u,bubbleMenu:!0,setIsLinkPopupOpen:l}),f===Me.HIGHLIGHT&&S.jsx(PD,{setVisibility:c,editor:t.editor,elementRef:u})]})};function s$(){const t=["a","b","c","d","e","f","0","1","2","3","4","5","6","7","8","9"];let e=[];for(let n=0;n<36;n++)n===8||n===13||n===18||n===23?e[n]="-":e[n]=t[Math.ceil(Math.random()*t.length-1)];return e.join("")}var i$=s$;const o$=Np(i$),BD=Ye.create({name:"column",content:"dBlock+",isolating:!0,addAttributes(){return{position:{default:"",parseHTML:t=>t.getAttribute("data-position"),renderHTML:t=>({"data-position":t.position})}}},renderHTML({HTMLAttributes:t}){return["div",rt(t,{"data-type":"column"}),0]},parseHTML(){return[{tag:'div[data-type="column"]'}]}}),a$=(t,e)=>Array.from({length:t},(n,r)=>e(r)),Q0=({type:t,content:e})=>e?{type:t,content:e}:{type:t},l$=({content:t})=>Q0({type:"paragraph",content:t}),FD=({content:t})=>Q0({type:"dBlock",content:t}),jD=({content:t})=>Q0({type:"column",content:t}),UD=({content:t})=>Q0({type:"columns",content:t}),VD=t=>{const e=[FD({content:[l$({})]})];return a$(t,()=>jD({content:e}))},HD=(t,e)=>{for(let n=t.depth;n>0;n--){const r=t.node(n),s=n>0?t.before(n):0,i=t.start(n);if(e({node:r,pos:s,start:i}))return{start:i,depth:n,node:r,pos:s}}throw Error("no ancestor found")};class J0 extends Pe{constructor(n){const{$from:r,$to:s}=n;super(r,s);W(this,"_$from");W(this,"_$to");this._$from=r,this._$to=s}get $from(){return this._$from}get $to(){return this._$to}map(){return this}content(){return this.$from.doc.slice(this.from,this.to,!0)}eq(n){return n instanceof J0&&n.anchor==this.anchor}toJSON(){return{type:"column",from:this.from,to:this.to}}expandSelection(n){var l;const r=({pos:u,node:c})=>c.type.name===BD.name?!0:n.resolve(u).depth<=0,{pos:s}=HD(this.$from,r);this._$from=n.resolve(s);const{pos:i,node:o}=HD(this.$to,r);this._$to=n.resolve(i+o.nodeSize),((l=this.getFirstNode())==null?void 0:l.type.name)===Y0.name&&(this._$from=n.resolve(this.$from.pos+2),this._$to=n.resolve(this.$to.pos+2));const a=this;a.$anchor=this._$from,a.$head=this._$to,a.ranges=[new Rb(this._$from,this._$to)]}static create(n,r,s){const i=n.resolve(r),o=n.resolve(s),a=new _e(i,o);return new J0(a)}getFirstNode(){return this.content().content.firstChild}}var il=(t=>(t.AlignLeft="align-left",t.AlignRight="align-right",t.AlignCenter="align-center",t))(il||{});const Y0=Ye.create({name:"columns",group:"columns",content:"column{2,}",defining:!0,draggable:!0,isolating:!0,addAttributes(){return{layout:{default:"align-center"}}},addCommands(){return{unsetColumns:()=>({tr:t,dispatch:e})=>{try{if(!e)return;const n=t.selection.$from,s=b1(n,({node:l})=>!this.options.nestedColumns&&l.type==this.type?!0:l.type==this.type);if(s===void 0)return;let i=[];s.node.descendants((l,u,c)=>{(c==null?void 0:c.type.name)===Y0.name&&i.push(l)}),i=i.reverse().filter(l=>l.content.size>0);const o=t.doc.resolve(s.pos),a=new De(o);return t=t.setSelection(a),i.forEach(l=>t=t.insert(s.pos,l)),t=t.deleteSelection(),e(t)}catch(n){console.error(n)}},setColumns:(t,e=!1)=>({tr:n,dispatch:r})=>{try{const{doc:s,selection:i}=n;if(!r){console.log("no dispatch");return}const o=new J0(i);o.expandSelection(s);const{openStart:a,openEnd:l}=o.content();if(a!==l){console.warn("failed depth check");return}let u;if(e){const h=o.content().toJSON(),p=jD(h),m=VD(t-1);u=UD({content:[p,...m]})}else{const h=VD(t);u=UD({content:h})}const c=s.type.schema.nodeFromJSON(FD({content:[u]}));if(c===null)return;const f=o.$anchor.parent.type;if(!(h=>!(!h.contentMatch.matchType(this.type)||!this.options.nestedColumns&&h.name===Y0.name))(f)){console.warn("content not allowed");return}return n=n.setSelection(o),n=n.replaceSelectionWith(c,!1),r(n)}catch(s){console.error(s)}},setLayout:t=>({commands:e})=>e.updateAttributes("columns",{layout:t})}},renderHTML({HTMLAttributes:t}){return["div",{"data-type":"columns",class:`layout-${t.layout}`},0]},parseHTML(){return[{tag:'div[data-type="columns"]'}]}}),u$=(t,e)=>{const{view:n,state:{selection:{from:r}}}=t,s=document.querySelectorAll(".has-focus"),i=s.length,a=s[i-1];if(a&&a.getAttribute("data-type")&&a.getAttribute("data-type")===e||a&&a.classList&&a.classList.contains(e))return a;const l=n.domAtPos(r).node;let u=l;for(u.tagName||(u=l.parentElement);u&&!(u.getAttribute("data-type")&&u.getAttribute("data-type")===e)&&!u.classList.contains(e);)u=u.parentElement;return u},Qw=N.forwardRef(({children:t,className:e,withShadow:n=!0,withBorder:r=!1,...s},i)=>{const o=he(e,"bg-white rounded",n?"shadow-lg":"",r?"border border-neutral-200":"");return S.jsx("div",{className:o,...s,ref:i,children:t})});Qw.displayName="Surface";const zD=({content:t,children:e})=>{const[n,r]=N.useState(!1);return S.jsxs("div",{className:"relative inline-block",onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[e,n&&S.jsx("div",{className:"absolute z-10 p-2 mt-2 text-sm text-white bg-gray-800 rounded shadow-lg",children:t})]})},$D=N.forwardRef(({shouldShowContent:t=!0,children:e,isVertical:n=!1,className:r,...s},i)=>{const o=he("text-black inline-flex h-full leading-none gap-0.5",n?"flex-col p-2":"flex-row p-1 items-center",r);return t?t&&S.jsx(Qw,{className:o,...s,ref:i,children:e}):null});$D.displayName="Toolbar";const GD=N.forwardRef(({horizontal:t,className:e,...n},r)=>{const s=he("bg-neutral-200",t?"w-full min-w-[1.5rem] h-[1px] my-1 first:mt-0 last:mt-0":"h-full min-h-[1.5rem] w-[1px] mx-1 first:ml-0 last:mr-0",e);return S.jsx("div",{className:s,ref:r,...n})});GD.displayName="Toolbar.Divider";const WD=N.forwardRef(({children:t,buttonSize:e="icon",variant:n="ghost",className:r,tooltip:s,activeClassname:i,...o},a)=>{const l=he("gap-1 min-w-[2rem] px-2 w-auto",r),u=S.jsx(sl,{activeClassname:i,className:l,variant:n,buttonSize:e,ref:a,...o,children:t});return s?S.jsx(zD,{content:s,children:u}):u});WD.displayName="ToolbarButton";const Wu={Wrapper:$D,Divider:GD,Button:WD},c$=({editor:t,appendTo:e})=>{const n=N.useCallback(()=>{const l=u$(t,"columns");return(l==null?void 0:l.getBoundingClientRect())||new DOMRect(-1e3,-1e3,0,0)},[t]),r=N.useCallback(()=>t.isActive("columns"),[t]),s=N.useCallback(()=>{t.chain().focus().setLayout(il.AlignLeft).run()},[t]),i=N.useCallback(()=>{t.chain().focus().setLayout(il.AlignRight).run()},[t]),o=N.useCallback(()=>{t.chain().focus().setLayout(il.AlignCenter).run()},[t]),a=N.useCallback(()=>{t.chain().focus().deleteNode("columns").run()},[t]);return S.jsx(VT,{editor:t,pluginKey:`columnsMenu-${o$()}`,shouldShow:r,updateDelay:0,tippyOptions:{offset:[0,8],popperOptions:{modifiers:[{name:"flip",enabled:!1}]},getReferenceClientRect:n,moveTransition:"transform 0.15s ease-out",duration:200,animation:"shift-toward-subtle",appendTo:()=>e==null?void 0:e.current,plugins:[kU],sticky:"popper"},children:S.jsxs(Wu.Wrapper,{children:[S.jsx(Wu.Button,{tooltip:"Align left",active:t.isActive("columns",{layout:il.AlignLeft}),activeClassname:"bg-yellow-300 hover:brightness-90",onClick:s,children:S.jsx(rV,{size:20})}),S.jsx(Wu.Button,{tooltip:"Align center",active:t.isActive("columns",{layout:il.AlignCenter}),activeClassname:"bg-yellow-300 hover:brightness-90",onClick:o,children:S.jsx(qT,{size:20})}),S.jsx(Wu.Button,{tooltip:"Align right",active:t.isActive("columns",{layout:il.AlignRight}),activeClassname:"bg-yellow-300 hover:brightness-90",onClick:i,children:S.jsx(sV,{size:20})}),S.jsx(Wu.Button,{tooltip:"Remove column",onClick:a,children:S.jsx(ow,{size:20})})]})})},KD=N.createContext(null),X0=()=>N.useContext(KD),f$=({children:t,isPreviewMode:e})=>S.jsx(KD.Provider,{value:e,children:t}),qD=({height:t,width:e})=>S.jsx("span",{className:"flex items-center justify-center ",children:S.jsx("span",{className:`${e?`w-${e}`:"w-8"} ${t?`h-${t}`:"h-8"} border-4 border-t-4 border-t-[#ccc] border-gray-500 rounded-full animate-spin`})}),d$=({editor:t,onError:e})=>{var o;const{toolRef:n,toolVisibilty:r,setToolVisibility:s,toolbar:i}=qw({editor:t,onError:e});return S.jsxs("div",{className:"w-fit bg-transparent px-4 items-center h-16 flex gap-1 justify-center relative",children:[S.jsxs("button",{className:"bg-transparent flex items-center gap-2 min-w-[55px]",onClick:()=>s(Me.FONT_FAMILY),children:[S.jsx("span",{className:"text-sm",children:((o=RD.find(a=>t==null?void 0:t.isActive("textStyle",{fontFamily:a.value})))==null?void 0:o.title)||"Font"}),S.jsx(E0,{size:16})]}),S.jsx("div",{className:"w-[2px] h-4 bg-gray-200 mx-2"}),S.jsxs("button",{className:"bg-transparent gap-2 flex items-center min-w-[55px]",onClick:()=>s(Me.HEADING),children:[S.jsx("span",{className:"text-sm",children:t!=null&&t.isActive("heading",{level:1})?"Heading 1":t!=null&&t.isActive("heading",{level:2})?"Heading 2":t!=null&&t.isActive("heading",{level:3})?"Heading 3":"Text"}),S.jsx(E0,{size:16})]}),S.jsx("div",{className:"w-[2px] h-4 bg-gray-200 mx-2"}),i.map((a,l)=>a?S.jsx("div",{className:"tooltip tooltip-neutral tooltip-bottom text-xs","data-tip":a.title,children:S.jsx("span",{onClick:()=>a.onClick(),className:he("rounded w-8 h-8 p-1 flex cursor-pointer justify-center items-center transition",a.isActive?"bg-yellow-300 hover:brightness-90":"hover:bg-[#f2f2f2]"),children:typeof a.icon=="string"?S.jsx("img",{src:a.icon,className:"w-4"}):a.icon})},a.title):S.jsx("div",{className:"w-[2px] h-4 bg-gray-200 mx-2"},l)),r===Me.FONT_FAMILY&&S.jsx(Xz,{setToolVisibility:s,editor:t,elementRef:n}),r===Me.HEADING&&S.jsx(t$,{setVisibility:s,editor:t,elementRef:n}),r===Me.TEXT_COLOR&&S.jsx(e$,{setVisibility:s,editor:t,elementRef:n}),r===Me.HIGHLIGHT&&S.jsx(PD,{setVisibility:s,editor:t,elementRef:n}),r===Me.ALIGNMENT&&S.jsx(ID,{setToolVisibility:s,editor:t,elementRef:n}),r===Me.LIST&&S.jsx(Zz,{setToolVisibility:s,editor:t,elementRef:n}),r===Me.LINK&&S.jsx(LD,{setToolVisibility:s,editor:t,elementRef:n})]})},zn=()=>new Map,Jw=t=>{const e=zn();return t.forEach((n,r)=>{e.set(r,n)}),e},or=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r},h$=(t,e)=>{const n=[];for(const[r,s]of t)n.push(e(s,r));return n},p$=(t,e)=>{for(const[n,r]of t)if(e(r,n))return!0;return!1},Oi=()=>new Set,Yw=t=>t[t.length-1],m$=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},_i=Array.from,g$=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1},Xw=Array.isArray;class Zw{constructor(){this._observers=zn()}on(e,n){return or(this._observers,e,Oi).add(n),n}once(e,n){const r=(...s)=>{this.off(e,r),n(...s)};this.on(e,r)}off(e,n){const r=this._observers.get(e);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e))}emit(e,n){return _i((this._observers.get(e)||zn()).values()).forEach(r=>r(...n))}destroy(){this._observers=zn()}}class QD{constructor(){this._observers=zn()}on(e,n){or(this._observers,e,Oi).add(n)}once(e,n){const r=(...s)=>{this.off(e,r),n(...s)};this.on(e,r)}off(e,n){const r=this._observers.get(e);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e))}emit(e,n){return _i((this._observers.get(e)||zn()).values()).forEach(r=>r(...n))}destroy(){this._observers=zn()}}const gs=Math.floor,Z0=Math.abs,y$=Math.log10,Lo=(t,e)=>t<e?t:e,Mi=(t,e)=>t>e?t:e,JD=t=>t!==0?t<0:1/t<0,$s=Date.now,b$=1200,w$=2500,em=3e4,eA=t=>{if(t.shouldConnect&&t.ws===null){const e=new WebSocket(t.url),n=t.binaryType;let r=null;n&&(e.binaryType=n),t.ws=e,t.connecting=!0,t.connected=!1,e.onmessage=o=>{t.lastMessageReceived=$s();const a=o.data,l=typeof a=="string"?JSON.parse(a):a;l&&l.type==="pong"&&(clearTimeout(r),r=setTimeout(i,em/2)),t.emit("message",[l,t])};const s=o=>{t.ws!==null&&(t.ws=null,t.connecting=!1,t.connected?(t.connected=!1,t.emit("disconnect",[{type:"disconnect",error:o},t])):t.unsuccessfulReconnects++,setTimeout(eA,Lo(y$(t.unsuccessfulReconnects+1)*b$,w$),t)),clearTimeout(r)},i=()=>{t.ws===e&&t.send({type:"ping"})};e.onclose=()=>s(null),e.onerror=o=>s(o),e.onopen=()=>{t.lastMessageReceived=$s(),t.connecting=!1,t.connected=!0,t.unsuccessfulReconnects=0,t.emit("connect",[{type:"connect"},t]),r=setTimeout(i,em/2)}}};class A$ extends QD{constructor(e,{binaryType:n}={}){super(),this.url=e,this.ws=null,this.binaryType=n||null,this.connected=!1,this.connecting=!1,this.unsuccessfulReconnects=0,this.lastMessageReceived=0,this.shouldConnect=!0,this._checkInterval=setInterval(()=>{this.connected&&em<$s()-this.lastMessageReceived&&this.ws.close()},em/2),eA(this)}send(e){this.ws&&this.ws.send(JSON.stringify(e))}destroy(){clearInterval(this._checkInterval),this.disconnect(),super.destroy()}disconnect(){this.shouldConnect=!1,this.ws!==null&&this.ws.close()}connect(){this.shouldConnect=!0,!this.connected&&this.ws===null&&eA(this)}}const Gs=t=>new Error(t),ys=()=>{throw Gs("Method unimplemented")},Sr=()=>{throw Gs("Unexpected case")},YD=1,XD=2,tA=4,nA=8,Hd=32,Ni=64,Tr=128,tm=31,rA=63,ol=127,v$=2147483647,x$=crypto.getRandomValues.bind(crypto),ZD=Math.random,eO=()=>x$(new Uint32Array(1))[0],k$=t=>t[gs(ZD()*t.length)],E$="10000000-1000-4000-8000"+-1e11,tO=()=>E$.replace(/[018]/g,t=>(t^eO()&15>>t/4).toString(16)),nO=Number.MAX_SAFE_INTEGER,C$=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&gs(t)===t),S$=String.fromCharCode,T$=t=>t.toLowerCase(),D$=/^\s*/g,O$=t=>t.replace(D$,""),_$=/([A-Z])/g,rO=(t,e)=>O$(t.replace(_$,n=>`${e}${T$(n)}`)),M$=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n);for(let s=0;s<n;s++)r[s]=e.codePointAt(s);return r},zd=typeof TextEncoder<"u"?new TextEncoder:null,sA=zd?t=>zd.encode(t):M$;let $d=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});$d&&$d.decode(new Uint8Array).length===1&&($d=null);class Gd{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const un=()=>new Gd,N$=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},Rt=t=>{const e=new Uint8Array(N$(t));let n=0;for(let r=0;r<t.bufs.length;r++){const s=t.bufs[r];e.set(s,n),n+=s.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},R$=(t,e)=>{const n=t.cbuf.length;n-t.cpos<e&&(t.bufs.push(new Uint8Array(t.cbuf.buffer,0,t.cpos)),t.cbuf=new Uint8Array(Mi(n,e)*2),t.cpos=0)},cn=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0),t.cbuf[t.cpos++]=e},Wd=cn,Ne=(t,e)=>{for(;e>ol;)cn(t,Tr|ol&e),e=gs(e/128);cn(t,ol&e)},iA=(t,e)=>{const n=JD(e);for(n&&(e=-e),cn(t,(e>rA?Tr:0)|(n?Ni:0)|rA&e),e=gs(e/64);e>0;)cn(t,(e>ol?Tr:0)|ol&e),e=gs(e/128)},oA=new Uint8Array(3e4),P$=oA.length/3,I$=(t,e)=>{if(e.length<P$){const n=zd.encodeInto(e,oA).written||0;Ne(t,n);for(let r=0;r<n;r++)cn(t,oA[r])}else jt(t,sA(e))},L$=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;Ne(t,r);for(let s=0;s<r;s++)cn(t,n.codePointAt(s))},Ws=zd&&zd.encodeInto?I$:L$,nm=(t,e)=>{const n=t.cbuf.length,r=t.cpos,s=Lo(n-r,e.length),i=e.length-s;t.cbuf.set(e.subarray(0,s),r),t.cpos+=s,i>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(Mi(n*2,i)),t.cbuf.set(e.subarray(s)),t.cpos=i)},jt=(t,e)=>{Ne(t,e.byteLength),nm(t,e)},aA=(t,e)=>{R$(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},B$=(t,e)=>aA(t,4).setFloat32(0,e,!1),F$=(t,e)=>aA(t,8).setFloat64(0,e,!1),j$=(t,e)=>aA(t,8).setBigInt64(0,e,!1),sO=new DataView(new ArrayBuffer(4)),U$=t=>(sO.setFloat32(0,t),sO.getFloat32(0)===t),Ku=(t,e)=>{switch(typeof e){case"string":cn(t,119),Ws(t,e);break;case"number":C$(e)&&Z0(e)<=v$?(cn(t,125),iA(t,e)):U$(e)?(cn(t,124),B$(t,e)):(cn(t,123),F$(t,e));break;case"bigint":cn(t,122),j$(t,e);break;case"object":if(e===null)cn(t,126);else if(Xw(e)){cn(t,117),Ne(t,e.length);for(let n=0;n<e.length;n++)Ku(t,e[n])}else if(e instanceof Uint8Array)cn(t,116),jt(t,e);else{cn(t,118);const n=Object.keys(e);Ne(t,n.length);for(let r=0;r<n.length;r++){const s=n[r];Ws(t,s),Ku(t,e[s])}}break;case"boolean":cn(t,e?120:121);break;default:cn(t,127)}};class iO extends Gd{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&Ne(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const oO=t=>{t.count>0&&(iA(t.encoder,t.count===1?t.s:-t.s),t.count>1&&Ne(t.encoder,t.count-2))};class rm{constructor(){this.encoder=new Gd,this.s=0,this.count=0}write(e){this.s===e?this.count++:(oO(this),this.count=1,this.s=e)}toUint8Array(){return oO(this),Rt(this.encoder)}}const aO=t=>{if(t.count>0){const e=t.diff*2+(t.count===1?0:1);iA(t.encoder,e),t.count>1&&Ne(t.encoder,t.count-2)}};class lA{constructor(){this.encoder=new Gd,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(aO(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return aO(this),Rt(this.encoder)}}class V${constructor(){this.sarr=[],this.s="",this.lensE=new rm}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new Gd;return this.sarr.push(this.s),this.s="",Ws(e,this.sarr.join("")),nm(e,this.lensE.toUint8Array()),Rt(e)}}const lO=Gs("Unexpected end of array"),uO=Gs("Integer out of Range");class sm{constructor(e){this.arr=e,this.pos=0}}const Ks=t=>new sm(t),H$=t=>t.pos!==t.arr.length,z$=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},fn=t=>z$(t,We(t)),al=t=>t.arr[t.pos++],We=t=>{let e=0,n=1;const r=t.arr.length;for(;t.pos<r;){const s=t.arr[t.pos++];if(e=e+(s&ol)*n,n*=128,s<Tr)return e;if(e>nO)throw uO}throw lO},uA=t=>{let e=t.arr[t.pos++],n=e&rA,r=64;const s=(e&Ni)>0?-1:1;if(!(e&Tr))return s*n;const i=t.arr.length;for(;t.pos<i;){if(e=t.arr[t.pos++],n=n+(e&ol)*r,r*=128,e<Tr)return s*n;if(n>nO)throw uO}throw lO},Ri=$d?t=>$d.decode(fn(t)):t=>{let e=We(t);if(e===0)return"";{let n=String.fromCodePoint(al(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(al(t));else for(;e>0;){const r=e<1e4?e:1e4,s=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,n+=String.fromCodePoint.apply(null,s),e-=r}return decodeURIComponent(escape(n))}},cA=(t,e)=>{const n=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,e);return t.pos+=e,n},$$=[t=>{},t=>null,uA,t=>cA(t,4).getFloat32(0,!1),t=>cA(t,8).getFloat64(0,!1),t=>cA(t,8).getBigInt64(0,!1),t=>!1,t=>!0,Ri,t=>{const e=We(t),n={};for(let r=0;r<e;r++){const s=Ri(t);n[s]=qu(t)}return n},t=>{const e=We(t),n=[];for(let r=0;r<e;r++)n.push(qu(t));return n},fn],qu=t=>$$[127-al(t)](t);class cO extends sm{constructor(e,n){super(e),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),H$(this)?this.count=We(this)+1:this.count=-1),this.count--,this.s}}class im extends sm{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=uA(this);const e=JD(this.s);this.count=1,e&&(this.s=-this.s,this.count=We(this)+2)}return this.count--,this.s}}class fA extends sm{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=uA(this),n=e&1;this.diff=gs(e/2),this.count=1,n&&(this.count=We(this)+2)}return this.s+=this.diff,this.count--,this.s}}class G${constructor(e){this.decoder=new im(e),this.str=Ri(this.decoder),this.spos=0}read(){const e=this.spos+this.decoder.read(),n=this.str.slice(this.spos,e);return this.spos=e,n}}const fO=t=>t===void 0?null:t;class W${constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let dO=new W$,dA=!0;try{typeof localStorage<"u"&&localStorage&&(dO=localStorage,dA=!1)}catch{}const hO=dO,K$=t=>dA||addEventListener("storage",t),q$=t=>dA||removeEventListener("storage",t),Q$=Object.assign,hA=Object.keys,J$=(t,e)=>{for(const n in t)e(t[n],n)},pO=t=>hA(t).length,mO=t=>hA(t).length,Y$=t=>{for(const e in t)return!1;return!0},X$=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},gO=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Z$=(t,e)=>t===e||mO(t)===mO(e)&&X$(t,(n,r)=>(n!==void 0||gO(e,r))&&e[r]===n),pA=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&pA(t,e,n+1)}},eG=()=>{},tG=t=>t,nG=(t,e)=>t===e,Kd=(t,e)=>{if(t==null||e==null)return nG(t,e);if(t.constructor!==e.constructor)return!1;if(t===e)return!0;switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:{if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;break}case Set:{if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;break}case Map:{if(t.size!==e.size)return!1;for(const n of t.keys())if(!e.has(n)||!Kd(t.get(n),e.get(n)))return!1;break}case Object:if(pO(t)!==pO(e))return!1;for(const n in t)if(!gO(t,n)||!Kd(t[n],e[n]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!Kd(t[n],e[n]))return!1;break;default:return!1}return!0},rG=(t,e)=>e.includes(t),Qu=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",mA=typeof window<"u"&&typeof document<"u"&&!Qu;let qs;const sG=()=>{if(qs===void 0)if(Qu){qs=zn();const t=process.argv;let e=null;for(let n=0;n<t.length;n++){const r=t[n];r[0]==="-"?(e!==null&&qs.set(e,""),e=r):e!==null&&(qs.set(e,r),e=null)}e!==null&&qs.set(e,"")}else typeof location=="object"?(qs=zn(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");qs.set(`--${rO(e,"-")}`,n),qs.set(`-${rO(e,"-")}`,n)}})):qs=zn();return qs},gA=t=>sG().has(t),om=t=>fO(Qu?process.env[t.toUpperCase().replaceAll("-","_")]:hO.getItem(t));(t=>gA("--"+t)||om(t)!==null)("production");const yO=Qu&&rG(process.env.FORCE_COLOR,["true","1","2"]),iG=!gA("--no-colors")&&(!Qu||process.stdout.isTTY||yO)&&(!Qu||gA("--color")||yO||om("COLORTERM")!==null||(om("TERM")||"").includes("color"));class oG{constructor(e,n){this.left=e,this.right=n}}const Pi=(t,e)=>new oG(t,e),aG=typeof document<"u"?document:{};typeof DOMParser<"u"&&new DOMParser;const lG=t=>h$(t,(e,n)=>`${n}:${e};`).join(""),uG=JSON.stringify,cG=(t=>class{constructor(n){this._=n}destroy(){t(this._)}})(clearTimeout),yA=(t,e)=>new cG(setTimeout(e,t)),Ii=Symbol,Wr=Ii(),ll=Ii(),bO=Ii(),bA=Ii(),wO=Ii(),AO=Ii(),vO=Ii(),am=Ii(),lm=Ii(),fG=t=>{var r;t.length===1&&((r=t[0])==null?void 0:r.constructor)===Function&&(t=t[0]());const e=[];let n=0;for(;n<t.length;n++){const s=t[n];s===void 0||s.constructor===String||s.constructor===Number||s.constructor===Object&&e.push(JSON.stringify(s))}return e},xO=[wO,vO,am,bO];let wA=0,kO=$s();const dG=(t,e)=>{const n=xO[wA],r=om("log"),s=r!==null&&(r==="*"||r==="true"||new RegExp(r,"gi").test(e));return wA=(wA+1)%xO.length,e+=": ",s?(...i)=>{var l;i.length===1&&((l=i[0])==null?void 0:l.constructor)===Function&&(i=i[0]());const o=$s(),a=o-kO;kO=o,t(n,e,lm,...i.map(u=>{switch(u!=null&&u.constructor===Uint8Array&&(u=Array.from(u)),typeof u){case"string":case"symbol":return u;default:return uG(u)}}),n," +"+a+"ms")}:eG},hG={[Wr]:Pi("font-weight","bold"),[ll]:Pi("font-weight","normal"),[bO]:Pi("color","blue"),[wO]:Pi("color","green"),[bA]:Pi("color","grey"),[AO]:Pi("color","red"),[vO]:Pi("color","purple"),[am]:Pi("color","orange"),[lm]:Pi("color","black")},EO=iG?t=>{var o;t.length===1&&((o=t[0])==null?void 0:o.constructor)===Function&&(t=t[0]());const e=[],n=[],r=zn();let s=[],i=0;for(;i<t.length;i++){const a=t[i],l=hG[a];if(l!==void 0)r.set(l.left,l.right);else{if(a===void 0)break;if(a.constructor===String||a.constructor===Number){const u=lG(r);i>0||u.length>0?(e.push("%c"+a),n.push(u)):e.push(a)}else break}}for(i>0&&(s=n,s.unshift(e.join("")));i<t.length;i++){const a=t[i];a instanceof Symbol||s.push(a)}return s}:fG,CO=(...t)=>{console.log(...EO(t)),SO.forEach(e=>e.print(t))},pG=(...t)=>{console.warn(...EO(t)),t.unshift(am),SO.forEach(e=>e.print(t))},SO=Oi(),mG=t=>dG(CO,t),TO=t=>new Promise(t);Promise.all.bind(Promise);const gG=t=>Promise.reject(t),AA=t=>Promise.resolve(t),DO=t=>new Uint8Array(t),yG=(t,e,n)=>new Uint8Array(t,e,n),bG=t=>new Uint8Array(t),wG=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=S$(t[n]);return btoa(e)},AG=t=>Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"),vG=t=>{const e=atob(t),n=DO(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return n},xG=t=>{const e=Buffer.from(t,"base64");return yG(e.buffer,e.byteOffset,e.byteLength)},OO=mA?wG:AG,_O=mA?vG:xG,kG=t=>{const e=DO(t.byteLength);return e.set(t),e},MO=new Map;class EG{constructor(e){this.room=e,this.onmessage=null,this._onChange=n=>n.key===e&&this.onmessage!==null&&this.onmessage({data:_O(n.newValue||"")}),K$(this._onChange)}postMessage(e){hO.setItem(this.room,OO(bG(e)))}close(){q$(this._onChange)}}const CG=typeof BroadcastChannel>"u"?EG:BroadcastChannel,vA=t=>or(MO,t,()=>{const e=Oi(),n=new CG(t);return n.onmessage=r=>e.forEach(s=>s(r.data,"broadcastchannel")),{bc:n,subs:e}}),SG=(t,e)=>(vA(t).subs.add(e),e),TG=(t,e)=>{const n=vA(t),r=n.subs.delete(e);return r&&n.subs.size===0&&(n.bc.close(),MO.delete(t)),r},DG=(t,e,n=null)=>{const r=vA(t);r.bc.postMessage(e),r.subs.forEach(s=>s(e,n))},NO=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}},RO=t=>({[Symbol.iterator](){return this},next:t}),OG=(t,e)=>RO(()=>{let n;do n=t.next();while(!n.done&&!e(n.value));return n}),xA=(t,e)=>RO(()=>{const{done:n,value:r}=t.next();return{done:n,value:n?void 0:e(r)}});class kA{constructor(e,n){this.clock=e,this.len=n}}class Ju{constructor(){this.clients=new Map}}const Bo=(t,e,n)=>e.clients.forEach((r,s)=>{const i=t.doc.store.clients.get(s);for(let o=0;o<r.length;o++){const a=r[o];ZO(t,i,a.clock,a.len,n)}}),_G=(t,e)=>{let n=0,r=t.length-1;for(;n<=r;){const s=gs((n+r)/2),i=t[s],o=i.clock;if(o<=e){if(e<o+i.len)return s;n=s+1}else r=s-1}return null},Yu=(t,e)=>{const n=t.clients.get(e.client);return n!==void 0&&_G(n,e.clock)!==null},EA=t=>{t.clients.forEach(e=>{e.sort((s,i)=>s.clock-i.clock);let n,r;for(n=1,r=1;n<e.length;n++){const s=e[r-1],i=e[n];s.clock+s.len>=i.clock?s.len=Mi(s.len,i.clock+i.len-s.clock):(r<n&&(e[r]=i),r++)}e.length=r})},CA=t=>{const e=new Ju;for(let n=0;n<t.length;n++)t[n].clients.forEach((r,s)=>{if(!e.clients.has(s)){const i=r.slice();for(let o=n+1;o<t.length;o++)m$(i,t[o].clients.get(s)||[]);e.clients.set(s,i)}});return EA(e),e},qd=(t,e,n,r)=>{or(t.clients,e,()=>[]).push(new kA(n,r))},PO=()=>new Ju,IO=t=>{const e=PO();return t.clients.forEach((n,r)=>{const s=[];for(let i=0;i<n.length;i++){const o=n[i];if(o.deleted){const a=o.id.clock;let l=o.length;if(i+1<n.length)for(let u=n[i+1];i+1<n.length&&u.deleted;u=n[++i+1])l+=u.length;s.push(new kA(a,l))}}s.length>0&&e.clients.set(r,s)}),e},Xu=(t,e)=>{Ne(t.restEncoder,e.clients.size),_i(e.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{t.resetDsCurVal(),Ne(t.restEncoder,n);const s=r.length;Ne(t.restEncoder,s);for(let i=0;i<s;i++){const o=r[i];t.writeDsClock(o.clock),t.writeDsLen(o.len)}})},SA=t=>{const e=new Ju,n=We(t.restDecoder);for(let r=0;r<n;r++){t.resetDsCurVal();const s=We(t.restDecoder),i=We(t.restDecoder);if(i>0){const o=or(e.clients,s,()=>[]);for(let a=0;a<i;a++)o.push(new kA(t.readDsClock(),t.readDsLen()))}}return e},LO=(t,e,n)=>{const r=new Ju,s=We(t.restDecoder);for(let i=0;i<s;i++){t.resetDsCurVal();const o=We(t.restDecoder),a=We(t.restDecoder),l=n.clients.get(o)||[],u=zt(n,o);for(let c=0;c<a;c++){const f=t.readDsClock(),d=f+t.readDsLen();if(f<u){u<d&&qd(r,o,u,d-u);let h=Qs(l,f),p=l[h];for(!p.deleted&&p.id.clock<f&&(l.splice(h+1,0,xm(e,p,f-p.id.clock)),h++);h<l.length&&(p=l[h++],p.id.clock<d);)p.deleted||(d<p.id.clock+p.length&&l.splice(h,0,xm(e,p,d-p.id.clock)),p.delete(e))}else qd(r,o,f,d-f)}}if(r.clients.size>0){const i=new cl;return Ne(i.restEncoder,0),Xu(i,r),i.toUint8Array()}return null},BO=eO;class ul extends Zw{constructor({guid:e=tO(),collectionid:n=null,gc:r=!0,gcFilter:s=()=>!0,meta:i=null,autoLoad:o=!1,shouldLoad:a=!0}={}){super(),this.gc=r,this.gcFilter=s,this.clientID=BO(),this.guid=e,this.collectionid=n,this.share=new Map,this.store=new JO,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=a,this.autoLoad=o,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.whenLoaded=TO(u=>{this.on("load",()=>{this.isLoaded=!0,u(this)})});const l=()=>TO(u=>{const c=f=>{(f===void 0||f===!0)&&(this.off("sync",c),u())};this.on("sync",c)});this.on("sync",u=>{u===!1&&this.isSynced&&(this.whenSynced=l()),this.isSynced=u===void 0||u===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=l()}load(){const e=this._item;e!==null&&!this.shouldLoad&&vt(e.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(_i(this.subdocs).map(e=>e.guid))}transact(e,n=null){return vt(this,e,n)}get(e,n=kn){const r=or(this.share,e,()=>{const i=new n;return i._integrate(this,null),i}),s=r.constructor;if(n!==kn&&s!==n)if(s===kn){const i=new n;i._map=r._map,r._map.forEach(o=>{for(;o!==null;o=o.left)o.parent=i}),i._start=r._start;for(let o=i._start;o!==null;o=o.right)o.parent=i;return i._length=r._length,this.share.set(e,i),i._integrate(this,null),i}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return r}getArray(e=""){return this.get(e,rc)}getText(e=""){return this.get(e,dl)}getMap(e=""){return this.get(e,sc)}getXmlElement(e=""){return this.get(e,$n)}getXmlFragment(e=""){return this.get(e,hl)}toJSON(){const e={};return this.share.forEach((n,r)=>{e[r]=n.toJSON()}),e}destroy(){_i(this.subdocs).forEach(n=>n.destroy());const e=this._item;if(e!==null){this._item=null;const n=e.content;n.doc=new ul({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=e,vt(e.parent.doc,r=>{const s=n.doc;e.deleted||r.subdocsAdded.add(s),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class FO{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return We(this.restDecoder)}readDsLen(){return We(this.restDecoder)}}class jO extends FO{readLeftID(){return Ke(We(this.restDecoder),We(this.restDecoder))}readRightID(){return Ke(We(this.restDecoder),We(this.restDecoder))}readClient(){return We(this.restDecoder)}readInfo(){return al(this.restDecoder)}readString(){return Ri(this.restDecoder)}readParentInfo(){return We(this.restDecoder)===1}readTypeRef(){return We(this.restDecoder)}readLen(){return We(this.restDecoder)}readAny(){return qu(this.restDecoder)}readBuf(){return kG(fn(this.restDecoder))}readJSON(){return JSON.parse(Ri(this.restDecoder))}readKey(){return Ri(this.restDecoder)}}class MG{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=We(this.restDecoder),this.dsCurrVal}readDsLen(){const e=We(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class Zu extends MG{constructor(e){super(e),this.keys=[],We(e),this.keyClockDecoder=new fA(fn(e)),this.clientDecoder=new im(fn(e)),this.leftClockDecoder=new fA(fn(e)),this.rightClockDecoder=new fA(fn(e)),this.infoDecoder=new cO(fn(e),al),this.stringDecoder=new G$(fn(e)),this.parentInfoDecoder=new cO(fn(e),al),this.typeRefDecoder=new im(fn(e)),this.lenDecoder=new im(fn(e))}readLeftID(){return new ec(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new ec(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return qu(this.restDecoder)}readBuf(){return fn(this.restDecoder)}readJSON(){return qu(this.restDecoder)}readKey(){const e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{const n=this.stringDecoder.read();return this.keys.push(n),n}}}class UO{constructor(){this.restEncoder=un()}toUint8Array(){return Rt(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){Ne(this.restEncoder,e)}writeDsLen(e){Ne(this.restEncoder,e)}}class Qd extends UO{writeLeftID(e){Ne(this.restEncoder,e.client),Ne(this.restEncoder,e.clock)}writeRightID(e){Ne(this.restEncoder,e.client),Ne(this.restEncoder,e.clock)}writeClient(e){Ne(this.restEncoder,e)}writeInfo(e){Wd(this.restEncoder,e)}writeString(e){Ws(this.restEncoder,e)}writeParentInfo(e){Ne(this.restEncoder,e?1:0)}writeTypeRef(e){Ne(this.restEncoder,e)}writeLen(e){Ne(this.restEncoder,e)}writeAny(e){Ku(this.restEncoder,e)}writeBuf(e){jt(this.restEncoder,e)}writeJSON(e){Ws(this.restEncoder,JSON.stringify(e))}writeKey(e){Ws(this.restEncoder,e)}}class VO{constructor(){this.restEncoder=un(),this.dsCurrVal=0}toUint8Array(){return Rt(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const n=e-this.dsCurrVal;this.dsCurrVal=e,Ne(this.restEncoder,n)}writeDsLen(e){e===0&&Sr(),Ne(this.restEncoder,e-1),this.dsCurrVal+=e}}class cl extends VO{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new lA,this.clientEncoder=new rm,this.leftClockEncoder=new lA,this.rightClockEncoder=new lA,this.infoEncoder=new iO(Wd),this.stringEncoder=new V$,this.parentInfoEncoder=new iO(Wd),this.typeRefEncoder=new rm,this.lenEncoder=new rm}toUint8Array(){const e=un();return Ne(e,0),jt(e,this.keyClockEncoder.toUint8Array()),jt(e,this.clientEncoder.toUint8Array()),jt(e,this.leftClockEncoder.toUint8Array()),jt(e,this.rightClockEncoder.toUint8Array()),jt(e,Rt(this.infoEncoder)),jt(e,this.stringEncoder.toUint8Array()),jt(e,Rt(this.parentInfoEncoder)),jt(e,this.typeRefEncoder.toUint8Array()),jt(e,this.lenEncoder.toUint8Array()),nm(e,Rt(this.restEncoder)),Rt(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){Ku(this.restEncoder,e)}writeBuf(e){jt(this.restEncoder,e)}writeJSON(e){Ku(this.restEncoder,e)}writeKey(e){const n=this.keyMap.get(e);n===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(n)}}const NG=(t,e,n,r)=>{r=Mi(r,e[0].id.clock);const s=Qs(e,r);Ne(t.restEncoder,e.length-s),t.writeClient(n),Ne(t.restEncoder,r);const i=e[s];i.write(t,r-i.id.clock);for(let o=s+1;o<e.length;o++)e[o].write(t,0)},TA=(t,e,n)=>{const r=new Map;n.forEach((s,i)=>{zt(e,i)>s&&r.set(i,s)}),eh(e).forEach((s,i)=>{n.has(i)||r.set(i,0)}),Ne(t.restEncoder,r.size),_i(r.entries()).sort((s,i)=>i[0]-s[0]).forEach(([s,i])=>{NG(t,e.clients.get(s),s,i)})},RG=(t,e)=>{const n=zn(),r=We(t.restDecoder);for(let s=0;s<r;s++){const i=We(t.restDecoder),o=new Array(i),a=t.readClient();let l=We(t.restDecoder);n.set(a,{i:0,refs:o});for(let u=0;u<i;u++){const c=t.readInfo();switch(tm&c){case 0:{const f=t.readLen();o[u]=new Kr(Ke(a,l),f),l+=f;break}case 10:{const f=We(t.restDecoder);o[u]=new qr(Ke(a,l),f),l+=f;break}default:{const f=(c&(Ni|Tr))===0,d=new Et(Ke(a,l),null,(c&Tr)===Tr?t.readLeftID():null,null,(c&Ni)===Ni?t.readRightID():null,f?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,f&&(c&Hd)===Hd?t.readString():null,__(t,c));o[u]=d,l+=d.length}}}}return n},PG=(t,e,n)=>{const r=[];let s=_i(n.keys()).sort((h,p)=>h-p);if(s.length===0)return null;const i=()=>{if(s.length===0)return null;let h=n.get(s[s.length-1]);for(;h.refs.length===h.i;)if(s.pop(),s.length>0)h=n.get(s[s.length-1]);else return null;return h};let o=i();if(o===null)return null;const a=new JO,l=new Map,u=(h,p)=>{const m=l.get(h);(m==null||m>p)&&l.set(h,p)};let c=o.refs[o.i++];const f=new Map,d=()=>{for(const h of r){const p=h.id.client,m=n.get(p);m?(m.i--,a.clients.set(p,m.refs.slice(m.i)),n.delete(p),m.i=0,m.refs=[]):a.clients.set(p,[h]),s=s.filter(g=>g!==p)}r.length=0};for(;;){if(c.constructor!==qr){const p=or(f,c.id.client,()=>zt(e,c.id.client))-c.id.clock;if(p<0)r.push(c),u(c.id.client,c.id.clock-1),d();else{const m=c.getMissing(t,e);if(m!==null){r.push(c);const g=n.get(m)||{refs:[],i:0};if(g.refs.length===g.i)u(m,zt(e,m)),d();else{c=g.refs[g.i++];continue}}else(p===0||p<c.length)&&(c.integrate(t,p),f.set(c.id.client,c.id.clock+c.length))}}if(r.length>0)c=r.pop();else if(o!==null&&o.i<o.refs.length)c=o.refs[o.i++];else{if(o=i(),o===null)break;c=o.refs[o.i++]}}if(a.clients.size>0){const h=new cl;return TA(h,a,new Map),Ne(h.restEncoder,0),{missing:l,update:h.toUint8Array()}}return null},IG=(t,e)=>TA(t,e.doc.store,e.beforeState),LG=(t,e,n,r=new Zu(t))=>vt(e,s=>{s.local=!1;let i=!1;const o=s.doc,a=o.store,l=RG(r,o),u=PG(s,a,l),c=a.pendingStructs;if(c){for(const[d,h]of c.missing)if(h<zt(a,d)){i=!0;break}if(u){for(const[d,h]of u.missing){const p=c.missing.get(d);(p==null||p>h)&&c.missing.set(d,h)}c.update=dm([c.update,u.update])}}else a.pendingStructs=u;const f=LO(r,s,a);if(a.pendingDs){const d=new Zu(Ks(a.pendingDs));We(d.restDecoder);const h=LO(d,s,a);f&&h?a.pendingDs=dm([f,h]):a.pendingDs=f||h}else a.pendingDs=f;if(i){const d=a.pendingStructs.update;a.pendingStructs=null,um(s.doc,d)}},n,!1),um=(t,e,n,r=Zu)=>{const s=Ks(e);LG(s,t,n,new r(s))},BG=(t,e,n)=>um(t,e,n,jO),FG=(t,e,n=new Map)=>{TA(t,e.store,n),Xu(t,IO(e.store))},jG=(t,e=new Uint8Array([0]),n=new cl)=>{const r=HO(e);FG(n,t,r);const s=[n.toUint8Array()];if(t.store.pendingDs&&s.push(t.store.pendingDs),t.store.pendingStructs&&s.push(rW(t.store.pendingStructs.update,e)),s.length>1){if(n.constructor===Qd)return tW(s.map((i,o)=>o===0?i:iW(i)));if(n.constructor===cl)return dm(s)}return s[0]},UG=(t,e)=>jG(t,e,new Qd),VG=t=>{const e=new Map,n=We(t.restDecoder);for(let r=0;r<n;r++){const s=We(t.restDecoder),i=We(t.restDecoder);e.set(s,i)}return e},HO=t=>VG(new FO(Ks(t))),zO=(t,e)=>(Ne(t.restEncoder,e.size),_i(e.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{Ne(t.restEncoder,n),Ne(t.restEncoder,r)}),t),HG=(t,e)=>zO(t,eh(e.store)),zG=(t,e=new VO)=>(t instanceof Map?zO(e,t):HG(e,t),e.toUint8Array()),$G=t=>zG(t,new UO);class GG{constructor(){this.l=[]}}const $O=()=>new GG,GO=(t,e)=>t.l.push(e),WO=(t,e)=>{const n=t.l,r=n.length;t.l=n.filter(s=>e!==s),r===t.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},KO=(t,e,n)=>pA(t.l,[e,n]);class ec{constructor(e,n){this.client=e,this.clock=n}}const tc=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,Ke=(t,e)=>new ec(t,e),Jd=t=>{for(const[e,n]of t.doc.share.entries())if(n===t)return e;throw Sr()},Yd=(t,e)=>{for(;e!==null;){if(e.parent===t)return!0;e=e.parent._item}return!1};class Xd{constructor(e,n,r,s=0){this.type=e,this.tname=n,this.item=r,this.assoc=s}}const Zd=t=>new Xd(t.type==null?null:Ke(t.type.client,t.type.clock),t.tname??null,t.item==null?null:Ke(t.item.client,t.item.clock),t.assoc==null?0:t.assoc);class WG{constructor(e,n,r=0){this.type=e,this.index=n,this.assoc=r}}const KG=(t,e,n=0)=>new WG(t,e,n),cm=(t,e,n)=>{let r=null,s=null;return t._item===null?s=Jd(t):r=Ke(t._item.id.client,t._item.id.clock),new Xd(r,s,e,n)},DA=(t,e,n=0)=>{let r=t._start;if(n<0){if(e===0)return cm(t,null,n);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return cm(t,Ke(r.id.client,r.id.clock+e),n);e-=r.length}if(r.right===null&&n<0)return cm(t,r.lastId,n);r=r.right}return cm(t,null,n)},qG=(t,e,n=!0)=>{const r=e.store,s=t.item,i=t.type,o=t.tname,a=t.assoc;let l=null,u=0;if(s!==null){if(zt(r,s.client)<=s.clock)return null;const c=n?zA(r,s):{item:nc(r,s),diff:0},f=c.item;if(!(f instanceof Et))return null;if(l=f.parent,l._item===null||!l._item.deleted){u=f.deleted||!f.countable?0:c.diff+(a>=0?0:1);let d=f.left;for(;d!==null;)!d.deleted&&d.countable&&(u+=d.length),d=d.left}}else{if(o!==null)l=e.get(o);else if(i!==null){if(zt(r,i.client)<=i.clock)return null;const{item:c}=n?zA(r,i):{item:nc(r,i)};if(c instanceof Et&&c.content instanceof ws)l=c.content.type;else return null}else throw Sr();a>=0?u=l._length:u=0}return KG(l,u,t.assoc)},qO=(t,e)=>t===e||t!==null&&e!==null&&t.tname===e.tname&&tc(t.item,e.item)&&tc(t.type,e.type)&&t.assoc===e.assoc;class OA{constructor(e,n){this.ds=e,this.sv=n}}const QO=(t,e)=>new OA(t,e),_A=t=>QO(IO(t.store),eh(t.store)),fl=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!Yu(e.ds,t.id),MA=(t,e)=>{const n=or(t.meta,MA,Oi),r=t.doc.store;n.has(e)||(e.sv.forEach((s,i)=>{s<zt(r,i)&&ar(t,Ke(i,s))}),Bo(t,e.ds,s=>{}),n.add(e))};class JO{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const eh=t=>{const e=new Map;return t.clients.forEach((n,r)=>{const s=n[n.length-1];e.set(r,s.id.clock+s.length)}),e},zt=(t,e)=>{const n=t.clients.get(e);if(n===void 0)return 0;const r=n[n.length-1];return r.id.clock+r.length},YO=(t,e)=>{let n=t.clients.get(e.id.client);if(n===void 0)n=[],t.clients.set(e.id.client,n);else{const r=n[n.length-1];if(r.id.clock+r.length!==e.id.clock)throw Sr()}n.push(e)},Qs=(t,e)=>{let n=0,r=t.length-1,s=t[r],i=s.id.clock;if(i===e)return r;let o=gs(e/(i+s.length-1)*r);for(;n<=r;){if(s=t[o],i=s.id.clock,i<=e){if(e<i+s.length)return o;n=o+1}else r=o-1;o=gs((n+r)/2)}throw Sr()},nc=(t,e)=>{const n=t.clients.get(e.client);return n[Qs(n,e.clock)]},NA=(t,e,n)=>{const r=Qs(e,n),s=e[r];return s.id.clock<n&&s instanceof Et?(e.splice(r+1,0,xm(t,s,n-s.id.clock)),r+1):r},ar=(t,e)=>{const n=t.doc.store.clients.get(e.client);return n[NA(t,n,e.clock)]},XO=(t,e,n)=>{const r=e.clients.get(n.client),s=Qs(r,n.clock),i=r[s];return n.clock!==i.id.clock+i.length-1&&i.constructor!==Kr&&r.splice(s+1,0,xm(t,i,n.clock-i.id.clock+1)),i},QG=(t,e,n)=>{const r=t.clients.get(e.id.client);r[Qs(r,e.id.clock)]=n},ZO=(t,e,n,r,s)=>{if(r===0)return;const i=n+r;let o=NA(t,e,n),a;do a=e[o++],i<a.id.clock+a.length&&NA(t,e,i),s(a);while(o<e.length&&e[o].id.clock<i)};let JG=class{constructor(e,n,r){this.doc=e,this.deleteSet=new Ju,this.beforeState=eh(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=n,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}};const e_=(t,e)=>e.deleteSet.clients.size===0&&!p$(e.afterState,(n,r)=>e.beforeState.get(r)!==n)?!1:(EA(e.deleteSet),IG(t,e),Xu(t,e.deleteSet),!0),t_=(t,e,n)=>{const r=e._item;(r===null||r.id.clock<(t.beforeState.get(r.id.client)||0)&&!r.deleted)&&or(t.changed,e,Oi).add(n)},fm=(t,e)=>{let n=t[e],r=t[e-1],s=e;for(;s>0;n=r,r=t[--s-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof Et&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}const i=e-s;return i&&t.splice(e+1-i,i),i},YG=(t,e,n)=>{for(const[r,s]of t.clients.entries()){const i=e.clients.get(r);for(let o=s.length-1;o>=0;o--){const a=s[o],l=a.clock+a.len;for(let u=Qs(i,a.clock),c=i[u];u<i.length&&c.id.clock<l;c=i[++u]){const f=i[u];if(a.clock+a.len<=f.id.clock)break;f instanceof Et&&f.deleted&&!f.keep&&n(f)&&f.gc(e,!1)}}}},XG=(t,e)=>{t.clients.forEach((n,r)=>{const s=e.clients.get(r);for(let i=n.length-1;i>=0;i--){const o=n[i],a=Lo(s.length-1,1+Qs(s,o.clock+o.len-1));for(let l=a,u=s[l];l>0&&u.id.clock>=o.clock;u=s[l])l-=1+fm(s,l)}})},n_=(t,e)=>{if(e<t.length){const n=t[e],r=n.doc,s=r.store,i=n.deleteSet,o=n._mergeStructs;try{EA(i),n.afterState=eh(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const a=[];n.changed.forEach((l,u)=>a.push(()=>{(u._item===null||!u._item.deleted)&&u._callObserver(n,l)})),a.push(()=>{n.changedParentTypes.forEach((l,u)=>{u._dEH.l.length>0&&(u._item===null||!u._item.deleted)&&(l=l.filter(c=>c.target._item===null||!c.target._item.deleted),l.forEach(c=>{c.currentTarget=u,c._path=null}),l.sort((c,f)=>c.path.length-f.path.length),KO(u._dEH,l,n))})}),a.push(()=>r.emit("afterTransaction",[n,r])),pA(a,[]),n._needFormattingCleanup&&wW(n)}finally{r.gc&&YG(i,s,r.gcFilter),XG(i,s),n.afterState.forEach((c,f)=>{const d=n.beforeState.get(f)||0;if(d!==c){const h=s.clients.get(f),p=Mi(Qs(h,d),1);for(let m=h.length-1;m>=p;)m-=1+fm(h,m)}});for(let c=o.length-1;c>=0;c--){const{client:f,clock:d}=o[c].id,h=s.clients.get(f),p=Qs(h,d);p+1<h.length&&fm(h,p+1)>1||p>0&&fm(h,p)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(CO(am,Wr,"[yjs] ",ll,AO,"Changed the client-id because another client seems to be using it."),r.clientID=BO()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const c=new Qd;e_(c,n)&&r.emit("update",[c.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const c=new cl;e_(c,n)&&r.emit("updateV2",[c.toUint8Array(),n.origin,r,n])}const{subdocsAdded:a,subdocsLoaded:l,subdocsRemoved:u}=n;(a.size>0||u.size>0||l.size>0)&&(a.forEach(c=>{c.clientID=r.clientID,c.collectionid==null&&(c.collectionid=r.collectionid),r.subdocs.add(c)}),u.forEach(c=>r.subdocs.delete(c)),r.emit("subdocs",[{loaded:l,added:a,removed:u},r,n]),u.forEach(c=>c.destroy())),t.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,t])):n_(t,e+1)}}},vt=(t,e,n=null,r=!0)=>{const s=t._transactionCleanups;let i=!1,o=null;t._transaction===null&&(i=!0,t._transaction=new JG(t,n,r),s.push(t._transaction),s.length===1&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{o=e(t._transaction)}finally{if(i){const a=t._transaction===s[0];t._transaction=null,a&&n_(s,0)}}return o};class ZG{constructor(e,n){this.insertions=n,this.deletions=e,this.meta=new Map}}const r_=(t,e,n)=>{Bo(t,n.deletions,r=>{r instanceof Et&&e.scope.some(s=>Yd(s,r))&&$A(r,!1)})},s_=(t,e,n)=>{let r=null;const s=t.doc,i=t.scope;vt(s,a=>{for(;e.length>0&&t.currStackItem===null;){const l=s.store,u=e.pop(),c=new Set,f=[];let d=!1;Bo(a,u.insertions,h=>{if(h instanceof Et){if(h.redone!==null){let{item:p,diff:m}=zA(l,h.id);m>0&&(p=ar(a,Ke(p.id.client,p.id.clock+m))),h=p}!h.deleted&&i.some(p=>Yd(p,h))&&f.push(h)}}),Bo(a,u.deletions,h=>{h instanceof Et&&i.some(p=>Yd(p,h))&&!Yu(u.insertions,h.id)&&c.add(h)}),c.forEach(h=>{d=O_(a,h,c,u.insertions,t.ignoreRemoteMapChanges,t)!==null||d});for(let h=f.length-1;h>=0;h--){const p=f[h];t.deleteFilter(p)&&(p.delete(a),d=!0)}t.currStackItem=d?u:null}a.changed.forEach((l,u)=>{l.has(null)&&u._searchMarker&&(u._searchMarker.length=0)}),r=a},t);const o=t.currStackItem;if(o!=null){const a=r.changedParentTypes;t.emit("stack-item-popped",[{stackItem:o,type:n,changedParentTypes:a,origin:t},t]),t.currStackItem=null}return o};class i_ extends Zw{constructor(e,{captureTimeout:n=500,captureTransaction:r=l=>!0,deleteFilter:s=()=>!0,trackedOrigins:i=new Set([null]),ignoreRemoteMapChanges:o=!1,doc:a=Xw(e)?e[0].doc:e.doc}={}){super(),this.scope=[],this.doc=a,this.addToScope(e),this.deleteFilter=s,i.add(this),this.trackedOrigins=i,this.captureTransaction=r,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=o,this.captureTimeout=n,this.afterTransactionHandler=l=>{if(!this.captureTransaction(l)||!this.scope.some(g=>l.changedParentTypes.has(g))||!this.trackedOrigins.has(l.origin)&&(!l.origin||!this.trackedOrigins.has(l.origin.constructor)))return;const u=this.undoing,c=this.redoing,f=u?this.redoStack:this.undoStack;u?this.stopCapturing():c||this.clear(!1,!0);const d=new Ju;l.afterState.forEach((g,y)=>{const v=l.beforeState.get(y)||0,w=g-v;w>0&&qd(d,y,v,w)});const h=$s();let p=!1;if(this.lastChange>0&&h-this.lastChange<this.captureTimeout&&f.length>0&&!u&&!c){const g=f[f.length-1];g.deletions=CA([g.deletions,l.deleteSet]),g.insertions=CA([g.insertions,d])}else f.push(new ZG(l.deleteSet,d)),p=!0;!u&&!c&&(this.lastChange=h),Bo(l,l.deleteSet,g=>{g instanceof Et&&this.scope.some(y=>Yd(y,g))&&$A(g,!0)});const m=[{stackItem:f[f.length-1],origin:l.origin,type:u?"redo":"undo",changedParentTypes:l.changedParentTypes},this];p?this.emit("stack-item-added",m):this.emit("stack-item-updated",m)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(e){e=Xw(e)?e:[e],e.forEach(n=>{this.scope.every(r=>r!==n)&&(n.doc!==this.doc&&pG("[yjs#509] Not same Y.Doc"),this.scope.push(n))})}addTrackedOrigin(e){this.trackedOrigins.add(e)}removeTrackedOrigin(e){this.trackedOrigins.delete(e)}clear(e=!0,n=!0){(e&&this.canUndo()||n&&this.canRedo())&&this.doc.transact(r=>{e&&(this.undoStack.forEach(s=>r_(r,this,s)),this.undoStack=[]),n&&(this.redoStack.forEach(s=>r_(r,this,s)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:e,redoStackCleared:n}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=s_(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=s_(this,this.redoStack,"redo")}finally{this.redoing=!1}return e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),super.destroy()}}function*eW(t){const e=We(t.restDecoder);for(let n=0;n<e;n++){const r=We(t.restDecoder),s=t.readClient();let i=We(t.restDecoder);for(let o=0;o<r;o++){const a=t.readInfo();if(a===10){const l=We(t.restDecoder);yield new qr(Ke(s,i),l),i+=l}else if(tm&a){const l=(a&(Ni|Tr))===0,u=new Et(Ke(s,i),null,(a&Tr)===Tr?t.readLeftID():null,null,(a&Ni)===Ni?t.readRightID():null,l?t.readParentInfo()?t.readString():t.readLeftID():null,l&&(a&Hd)===Hd?t.readString():null,__(t,a));yield u,i+=u.length}else{const l=t.readLen();yield new Kr(Ke(s,i),l),i+=l}}}}class RA{constructor(e,n){this.gen=eW(e),this.curr=null,this.done=!1,this.filterSkips=n,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===qr);return this.curr}}class PA{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}const tW=t=>dm(t,jO,Qd),nW=(t,e)=>{if(t.constructor===Kr){const{client:n,clock:r}=t.id;return new Kr(Ke(n,r+e),t.length-e)}else if(t.constructor===qr){const{client:n,clock:r}=t.id;return new qr(Ke(n,r+e),t.length-e)}else{const n=t,{client:r,clock:s}=n.id;return new Et(Ke(r,s+e),null,Ke(r,s+e-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(e))}},dm=(t,e=Zu,n=cl)=>{if(t.length===1)return t[0];const r=t.map(c=>new e(Ks(c)));let s=r.map(c=>new RA(c,!0)),i=null;const o=new n,a=new PA(o);for(;s=s.filter(d=>d.curr!==null),s.sort((d,h)=>{if(d.curr.id.client===h.curr.id.client){const p=d.curr.id.clock-h.curr.id.clock;return p===0?d.curr.constructor===h.curr.constructor?0:d.curr.constructor===qr?1:-1:p}else return h.curr.id.client-d.curr.id.client}),s.length!==0;){const c=s[0],f=c.curr.id.client;if(i!==null){let d=c.curr,h=!1;for(;d!==null&&d.id.clock+d.length<=i.struct.id.clock+i.struct.length&&d.id.client>=i.struct.id.client;)d=c.next(),h=!0;if(d===null||d.id.client!==f||h&&d.id.clock>i.struct.id.clock+i.struct.length)continue;if(f!==i.struct.id.client)Fo(a,i.struct,i.offset),i={struct:d,offset:0},c.next();else if(i.struct.id.clock+i.struct.length<d.id.clock)if(i.struct.constructor===qr)i.struct.length=d.id.clock+d.length-i.struct.id.clock;else{Fo(a,i.struct,i.offset);const p=d.id.clock-i.struct.id.clock-i.struct.length;i={struct:new qr(Ke(f,i.struct.id.clock+i.struct.length),p),offset:0}}else{const p=i.struct.id.clock+i.struct.length-d.id.clock;p>0&&(i.struct.constructor===qr?i.struct.length-=p:d=nW(d,p)),i.struct.mergeWith(d)||(Fo(a,i.struct,i.offset),i={struct:d,offset:0},c.next())}}else i={struct:c.curr,offset:0},c.next();for(let d=c.curr;d!==null&&d.id.client===f&&d.id.clock===i.struct.id.clock+i.struct.length&&d.constructor!==qr;d=c.next())Fo(a,i.struct,i.offset),i={struct:d,offset:0}}i!==null&&(Fo(a,i.struct,i.offset),i=null),IA(a);const l=r.map(c=>SA(c)),u=CA(l);return Xu(o,u),o.toUint8Array()},rW=(t,e,n=Zu,r=cl)=>{const s=HO(e),i=new r,o=new PA(i),a=new n(Ks(t)),l=new RA(a,!1);for(;l.curr;){const c=l.curr,f=c.id.client,d=s.get(f)||0;if(l.curr.constructor===qr){l.next();continue}if(c.id.clock+c.length>d)for(Fo(o,c,Mi(d-c.id.clock,0)),l.next();l.curr&&l.curr.id.client===f;)Fo(o,l.curr,0),l.next();else for(;l.curr&&l.curr.id.client===f&&l.curr.id.clock+l.curr.length<=d;)l.next()}IA(o);const u=SA(a);return Xu(i,u),i.toUint8Array()},o_=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:Rt(t.encoder.restEncoder)}),t.encoder.restEncoder=un(),t.written=0)},Fo=(t,e,n)=>{t.written>0&&t.currClient!==e.id.client&&o_(t),t.written===0&&(t.currClient=e.id.client,t.encoder.writeClient(e.id.client),Ne(t.encoder.restEncoder,e.id.clock+n)),e.write(t.encoder,n),t.written++},IA=t=>{o_(t);const e=t.encoder.restEncoder;Ne(e,t.clientStructs.length);for(let n=0;n<t.clientStructs.length;n++){const r=t.clientStructs[n];Ne(e,r.written),nm(e,r.restEncoder)}},sW=(t,e,n,r)=>{const s=new n(Ks(t)),i=new RA(s,!1),o=new r,a=new PA(o);for(let u=i.curr;u!==null;u=i.next())Fo(a,e(u),0);IA(a);const l=SA(s);return Xu(o,l),o.toUint8Array()},iW=t=>sW(t,tG,Zu,Qd),a_="You must not compute changes after the event-handler fired.";class hm{constructor(e,n){this.target=e,this.currentTarget=e,this.transaction=n,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=oW(this.currentTarget,this.target))}deletes(e){return Yu(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Gs(a_);const e=new Map,n=this.target;this.transaction.changed.get(n).forEach(s=>{if(s!==null){const i=n._map.get(s);let o,a;if(this.adds(i)){let l=i.left;for(;l!==null&&this.adds(l);)l=l.left;if(this.deletes(i))if(l!==null&&this.deletes(l))o="delete",a=Yw(l.content.getContent());else return;else l!==null&&this.deletes(l)?(o="update",a=Yw(l.content.getContent())):(o="add",a=void 0)}else if(this.deletes(i))o="delete",a=Yw(i.content.getContent());else return;e.set(s,{action:o,oldValue:a})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw Gs(a_);const n=this.target,r=Oi(),s=Oi(),i=[];if(e={added:r,deleted:s,delta:i,keys:this.keys},this.transaction.changed.get(n).has(null)){let a=null;const l=()=>{a&&i.push(a)};for(let u=n._start;u!==null;u=u.right)u.deleted?this.deletes(u)&&!this.adds(u)&&((a===null||a.delete===void 0)&&(l(),a={delete:0}),a.delete+=u.length,s.add(u)):this.adds(u)?((a===null||a.insert===void 0)&&(l(),a={insert:[]}),a.insert=a.insert.concat(u.content.getContent()),r.add(u)):((a===null||a.retain===void 0)&&(l(),a={retain:0}),a.retain+=u.length);a!==null&&a.retain===void 0&&l()}this._changes=e}return e}}const oW=(t,e)=>{const n=[];for(;e._item!==null&&e!==t;){if(e._item.parentSub!==null)n.unshift(e._item.parentSub);else{let r=0,s=e._item.parent._start;for(;s!==e._item&&s!==null;)!s.deleted&&s.countable&&(r+=s.length),s=s.right;n.unshift(r)}e=e._item.parent}return n},l_=80;let LA=0;class aW{constructor(e,n){e.marker=!0,this.p=e,this.index=n,this.timestamp=LA++}}const lW=t=>{t.timestamp=LA++},u_=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=LA++},uW=(t,e,n)=>{if(t.length>=l_){const r=t.reduce((s,i)=>s.timestamp<i.timestamp?s:i);return u_(r,e,n),r}else{const r=new aW(e,n);return t.push(r),r}},pm=(t,e)=>{if(t._start===null||e===0||t._searchMarker===null)return null;const n=t._searchMarker.length===0?null:t._searchMarker.reduce((i,o)=>Z0(e-i.index)<Z0(e-o.index)?i:o);let r=t._start,s=0;for(n!==null&&(r=n.p,s=n.index,lW(n));r.right!==null&&s<e;){if(!r.deleted&&r.countable){if(e<s+r.length)break;s+=r.length}r=r.right}for(;r.left!==null&&s>e;)r=r.left,!r.deleted&&r.countable&&(s-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(s-=r.length);return n!==null&&Z0(n.index-s)<r.parent.length/l_?(u_(n,r,s),n):uW(t._searchMarker,r,s)},th=(t,e,n)=>{for(let r=t.length-1;r>=0;r--){const s=t[r];if(n>0){let i=s.p;for(i.marker=!1;i&&(i.deleted||!i.countable);)i=i.left,i&&!i.deleted&&i.countable&&(s.index-=i.length);if(i===null||i.marker===!0){t.splice(r,1);continue}s.p=i,i.marker=!0}(e<s.index||n>0&&e===s.index)&&(s.index=Mi(e,s.index+n))}},mm=(t,e,n)=>{const r=t,s=e.changedParentTypes;for(;or(s,t,()=>[]).push(n),t._item!==null;)t=t._item.parent;KO(r._eH,n,e)};class kn{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=$O(),this._dEH=$O(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,n){this.doc=e,this._item=n}_copy(){throw ys()}clone(){throw ys()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,n){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){GO(this._eH,e)}observeDeep(e){GO(this._dEH,e)}unobserve(e){WO(this._eH,e)}unobserveDeep(e){WO(this._dEH,e)}toJSON(){}}const c_=(t,e,n)=>{e<0&&(e=t._length+e),n<0&&(n=t._length+n);let r=n-e;const s=[];let i=t._start;for(;i!==null&&r>0;){if(i.countable&&!i.deleted){const o=i.content.getContent();if(o.length<=e)e-=o.length;else{for(let a=e;a<o.length&&r>0;a++)s.push(o[a]),r--;e=0}}i=i.right}return s},f_=t=>{const e=[];let n=t._start;for(;n!==null;){if(n.countable&&!n.deleted){const r=n.content.getContent();for(let s=0;s<r.length;s++)e.push(r[s])}n=n.right}return e},d_=(t,e)=>{const n=[];let r=t._start;for(;r!==null;){if(r.countable&&fl(r,e)){const s=r.content.getContent();for(let i=0;i<s.length;i++)n.push(s[i])}r=r.right}return n},nh=(t,e)=>{let n=0,r=t._start;for(;r!==null;){if(r.countable&&!r.deleted){const s=r.content.getContent();for(let i=0;i<s.length;i++)e(s[i],n++,t)}r=r.right}},h_=(t,e)=>{const n=[];return nh(t,(r,s)=>{n.push(e(r,s,t))}),n},cW=t=>{let e=t._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;e!==null&&e.deleted;)e=e.right;if(e===null)return{done:!0,value:void 0};n=e.content.getContent(),r=0,e=e.right}const s=n[r++];return n.length<=r&&(n=null),{done:!1,value:s}}}},p_=(t,e)=>{const n=pm(t,e);let r=t._start;for(n!==null&&(r=n.p,e-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(e<r.length)return r.content.getContent()[e];e-=r.length}},gm=(t,e,n,r)=>{let s=n;const i=t.doc,o=i.clientID,a=i.store,l=n===null?e._start:n.right;let u=[];const c=()=>{u.length>0&&(s=new Et(Ke(o,zt(a,o)),s,s&&s.lastId,l,l&&l.id,e,null,new ml(u)),s.integrate(t,0),u=[])};r.forEach(f=>{if(f===null)u.push(f);else switch(f.constructor){case Number:case Object:case Boolean:case Array:case String:u.push(f);break;default:switch(c(),f.constructor){case Uint8Array:case ArrayBuffer:s=new Et(Ke(o,zt(a,o)),s,s&&s.lastId,l,l&&l.id,e,null,new rh(new Uint8Array(f))),s.integrate(t,0);break;case ul:s=new Et(Ke(o,zt(a,o)),s,s&&s.lastId,l,l&&l.id,e,null,new ih(f)),s.integrate(t,0);break;default:if(f instanceof kn)s=new Et(Ke(o,zt(a,o)),s,s&&s.lastId,l,l&&l.id,e,null,new ws(f)),s.integrate(t,0);else throw new Error("Unexpected content type in insert operation")}}}),c()},m_=()=>Gs("Length exceeded!"),g_=(t,e,n,r)=>{if(n>e._length)throw m_();if(n===0)return e._searchMarker&&th(e._searchMarker,n,r.length),gm(t,e,null,r);const s=n,i=pm(e,n);let o=e._start;for(i!==null&&(o=i.p,n-=i.index,n===0&&(o=o.prev,n+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(n<=o.length){n<o.length&&ar(t,Ke(o.id.client,o.id.clock+n));break}n-=o.length}return e._searchMarker&&th(e._searchMarker,s,r.length),gm(t,e,o,r)},fW=(t,e,n)=>{let s=(e._searchMarker||[]).reduce((i,o)=>o.index>i.index?o:i,{index:0,p:e._start}).p;if(s)for(;s.right;)s=s.right;return gm(t,e,s,n)},y_=(t,e,n,r)=>{if(r===0)return;const s=n,i=r,o=pm(e,n);let a=e._start;for(o!==null&&(a=o.p,n-=o.index);a!==null&&n>0;a=a.right)!a.deleted&&a.countable&&(n<a.length&&ar(t,Ke(a.id.client,a.id.clock+n)),n-=a.length);for(;r>0&&a!==null;)a.deleted||(r<a.length&&ar(t,Ke(a.id.client,a.id.clock+r)),a.delete(t),r-=a.length),a=a.right;if(r>0)throw m_();e._searchMarker&&th(e._searchMarker,s,-i+r)},ym=(t,e,n)=>{const r=e._map.get(n);r!==void 0&&r.delete(t)},BA=(t,e,n,r)=>{const s=e._map.get(n)||null,i=t.doc,o=i.clientID;let a;if(r==null)a=new ml([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:a=new ml([r]);break;case Uint8Array:a=new rh(r);break;case ul:a=new ih(r);break;default:if(r instanceof kn)a=new ws(r);else throw new Error("Unexpected content type")}new Et(Ke(o,zt(i.store,o)),s,s&&s.lastId,null,null,e,n,a).integrate(t,0)},FA=(t,e)=>{const n=t._map.get(e);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},b_=t=>{const e={};return t._map.forEach((n,r)=>{n.deleted||(e[r]=n.content.getContent()[n.length-1])}),e},w_=(t,e)=>{const n=t._map.get(e);return n!==void 0&&!n.deleted},dW=(t,e)=>{const n={};return t._map.forEach((r,s)=>{let i=r;for(;i!==null&&(!e.sv.has(i.id.client)||i.id.clock>=(e.sv.get(i.id.client)||0));)i=i.left;i!==null&&fl(i,e)&&(n[s]=i.content.getContent()[i.length-1])}),n},bm=t=>OG(t.entries(),e=>!e[1].deleted);class hW extends hm{}class rc extends kn{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const n=new rc;return n.push(e),n}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new rc}clone(){const e=new rc;return e.insert(0,this.toArray().map(n=>n instanceof kn?n.clone():n)),e}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}_callObserver(e,n){super._callObserver(e,n),mm(this,e,new hW(this,e))}insert(e,n){this.doc!==null?vt(this.doc,r=>{g_(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}push(e){this.doc!==null?vt(this.doc,n=>{fW(n,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,n=1){this.doc!==null?vt(this.doc,r=>{y_(r,this,e,n)}):this._prelimContent.splice(e,n)}get(e){return p_(this,e)}toArray(){return f_(this)}slice(e=0,n=this.length){return c_(this,e,n)}toJSON(){return this.map(e=>e instanceof kn?e.toJSON():e)}map(e){return h_(this,e)}forEach(e){nh(this,e)}[Symbol.iterator](){return cW(this)}_write(e){e.writeTypeRef(BW)}}const pW=t=>new rc;class mW extends hm{constructor(e,n,r){super(e,n),this.keysChanged=r}}class sc extends kn{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,n){super._integrate(e,n),this._prelimContent.forEach((r,s)=>{this.set(s,r)}),this._prelimContent=null}_copy(){return new sc}clone(){const e=new sc;return this.forEach((n,r)=>{e.set(r,n instanceof kn?n.clone():n)}),e}_callObserver(e,n){mm(this,e,new mW(this,e,n))}toJSON(){const e={};return this._map.forEach((n,r)=>{if(!n.deleted){const s=n.content.getContent()[n.length-1];e[r]=s instanceof kn?s.toJSON():s}}),e}get size(){return[...bm(this._map)].length}keys(){return xA(bm(this._map),e=>e[0])}values(){return xA(bm(this._map),e=>e[1].content.getContent()[e[1].length-1])}entries(){return xA(bm(this._map),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this._map.forEach((n,r)=>{n.deleted||e(n.content.getContent()[n.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?vt(this.doc,n=>{ym(n,this,e)}):this._prelimContent.delete(e)}set(e,n){return this.doc!==null?vt(this.doc,r=>{BA(r,this,e,n)}):this._prelimContent.set(e,n),n}get(e){return FA(this,e)}has(e){return w_(this,e)}clear(){this.doc!==null?vt(this.doc,e=>{this.forEach(function(n,r,s){ym(e,s,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(FW)}}const gW=t=>new sc,jo=(t,e)=>t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&Z$(t,e);class jA{constructor(e,n,r,s){this.left=e,this.right=n,this.index=r,this.currentAttributes=s}forward(){switch(this.right===null&&Sr(),this.right.content.constructor){case Zt:this.right.deleted||ic(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}}const A_=(t,e,n)=>{for(;e.right!==null&&n>0;){switch(e.right.content.constructor){case Zt:e.right.deleted||ic(e.currentAttributes,e.right.content);break;default:e.right.deleted||(n<e.right.length&&ar(t,Ke(e.right.id.client,e.right.id.clock+n)),e.index+=e.right.length,n-=e.right.length);break}e.left=e.right,e.right=e.right.right}return e},wm=(t,e,n,r)=>{const s=new Map,i=r?pm(e,n):null;if(i){const o=new jA(i.p.left,i.p,i.index,s);return A_(t,o,n-i.index)}else{const o=new jA(null,e._start,0,s);return A_(t,o,n)}},v_=(t,e,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===Zt&&jo(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const s=t.doc,i=s.clientID;r.forEach((o,a)=>{const l=n.left,u=n.right,c=new Et(Ke(i,zt(s.store,i)),l,l&&l.lastId,u,u&&u.id,e,null,new Zt(a,o));c.integrate(t,0),n.right=c,n.forward()})},ic=(t,e)=>{const{key:n,value:r}=e;r===null?t.delete(n):t.set(n,r)},x_=(t,e)=>{for(;t.right!==null;){if(!(t.right.deleted||t.right.content.constructor===Zt&&jo(e[t.right.content.key]??null,t.right.content.value)))break;t.forward()}},k_=(t,e,n,r)=>{const s=t.doc,i=s.clientID,o=new Map;for(const a in r){const l=r[a],u=n.currentAttributes.get(a)??null;if(!jo(u,l)){o.set(a,u);const{left:c,right:f}=n;n.right=new Et(Ke(i,zt(s.store,i)),c,c&&c.lastId,f,f&&f.id,e,null,new Zt(a,l)),n.right.integrate(t,0),n.forward()}}return o},UA=(t,e,n,r,s)=>{n.currentAttributes.forEach((d,h)=>{s[h]===void 0&&(s[h]=null)});const i=t.doc,o=i.clientID;x_(n,s);const a=k_(t,e,n,s),l=r.constructor===String?new bs(r):r instanceof kn?new ws(r):new pl(r);let{left:u,right:c,index:f}=n;e._searchMarker&&th(e._searchMarker,n.index,l.getLength()),c=new Et(Ke(o,zt(i.store,o)),u,u&&u.lastId,c,c&&c.id,e,null,l),c.integrate(t,0),n.right=c,n.index=f,n.forward(),v_(t,e,n,a)},E_=(t,e,n,r,s)=>{const i=t.doc,o=i.clientID;x_(n,s);const a=k_(t,e,n,s);e:for(;n.right!==null&&(r>0||a.size>0&&(n.right.deleted||n.right.content.constructor===Zt));){if(!n.right.deleted)switch(n.right.content.constructor){case Zt:{const{key:l,value:u}=n.right.content,c=s[l];if(c!==void 0){if(jo(c,u))a.delete(l);else{if(r===0)break e;a.set(l,u)}n.right.delete(t)}else n.currentAttributes.set(l,u);break}default:r<n.right.length&&ar(t,Ke(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let l="";for(;r>0;r--)l+=`
474
474
  `;n.right=new Et(Ke(o,zt(i.store,o)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new bs(l)),n.right.integrate(t,0),n.forward()}v_(t,e,n,a)},C_=(t,e,n,r,s)=>{let i=e;const o=zn();for(;i&&(!i.countable||i.deleted);){if(!i.deleted&&i.content.constructor===Zt){const u=i.content;o.set(u.key,u)}i=i.right}let a=0,l=!1;for(;e!==i;){if(n===e&&(l=!0),!e.deleted){const u=e.content;switch(u.constructor){case Zt:{const{key:c,value:f}=u,d=r.get(c)??null;(o.get(c)!==u||d===f)&&(e.delete(t),a++,!l&&(s.get(c)??null)===f&&d!==f&&(d===null?s.delete(c):s.set(c,d))),!l&&!e.deleted&&ic(s,u);break}}}e=e.right}return a},yW=(t,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;const n=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===Zt){const r=e.content.key;n.has(r)?e.delete(t):n.add(r)}e=e.left}},bW=t=>{let e=0;return vt(t.doc,n=>{let r=t._start,s=t._start,i=zn();const o=Jw(i);for(;s;){if(s.deleted===!1)switch(s.content.constructor){case Zt:ic(o,s.content);break;default:e+=C_(n,r,s,i,o),i=Jw(o),r=s;break}s=s.right}}),e},wW=t=>{const e=new Set,n=t.doc;for(const[r,s]of t.afterState.entries()){const i=t.beforeState.get(r)||0;s!==i&&ZO(t,n.store.clients.get(r),i,s,o=>{!o.deleted&&o.content.constructor===Zt&&o.constructor!==Kr&&e.add(o.parent)})}vt(n,r=>{Bo(t,t.deleteSet,s=>{if(s instanceof Kr||!s.parent._hasFormatting||e.has(s.parent))return;const i=s.parent;s.content.constructor===Zt?e.add(i):yW(r,s)});for(const s of e)bW(s)})},S_=(t,e,n)=>{const r=n,s=Jw(e.currentAttributes),i=e.right;for(;n>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case ws:case pl:case bs:n<e.right.length&&ar(t,Ke(e.right.id.client,e.right.id.clock+n)),n-=e.right.length,e.right.delete(t);break}e.forward()}i&&C_(t,i,e.right,s,e.currentAttributes);const o=(e.left||e.right).parent;return o._searchMarker&&th(o._searchMarker,e.index,-r+n),e};class AW extends hm{constructor(e,n,r){super(e,n),this.childListChanged=!1,this.keysChanged=new Set,r.forEach(s=>{s===null?this.childListChanged=!0:this.keysChanged.add(s)})}get changes(){if(this._changes===null){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){const e=this.target.doc,n=[];vt(e,r=>{const s=new Map,i=new Map;let o=this.target._start,a=null;const l={};let u="",c=0,f=0;const d=()=>{if(a!==null){let h=null;switch(a){case"delete":f>0&&(h={delete:f}),f=0;break;case"insert":(typeof u=="object"||u.length>0)&&(h={insert:u},s.size>0&&(h.attributes={},s.forEach((p,m)=>{p!==null&&(h.attributes[m]=p)}))),u="";break;case"retain":c>0&&(h={retain:c},Y$(l)||(h.attributes=Q$({},l))),c=0;break}h&&n.push(h),a=null}};for(;o!==null;){switch(o.content.constructor){case ws:case pl:this.adds(o)?this.deletes(o)||(d(),a="insert",u=o.content.getContent()[0],d()):this.deletes(o)?(a!=="delete"&&(d(),a="delete"),f+=1):o.deleted||(a!=="retain"&&(d(),a="retain"),c+=1);break;case bs:this.adds(o)?this.deletes(o)||(a!=="insert"&&(d(),a="insert"),u+=o.content.str):this.deletes(o)?(a!=="delete"&&(d(),a="delete"),f+=o.length):o.deleted||(a!=="retain"&&(d(),a="retain"),c+=o.length);break;case Zt:{const{key:h,value:p}=o.content;if(this.adds(o)){if(!this.deletes(o)){const m=s.get(h)??null;jo(m,p)?p!==null&&o.delete(r):(a==="retain"&&d(),jo(p,i.get(h)??null)?delete l[h]:l[h]=p)}}else if(this.deletes(o)){i.set(h,p);const m=s.get(h)??null;jo(m,p)||(a==="retain"&&d(),l[h]=m)}else if(!o.deleted){i.set(h,p);const m=l[h];m!==void 0&&(jo(m,p)?m!==null&&o.delete(r):(a==="retain"&&d(),p===null?delete l[h]:l[h]=p))}o.deleted||(a==="insert"&&d(),ic(s,o.content));break}}o=o.right}for(d();n.length>0;){const h=n[n.length-1];if(h.retain!==void 0&&h.attributes===void 0)n.pop();else break}}),this._delta=n}return this._delta}}class dl extends kn{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this._length}_integrate(e,n){super._integrate(e,n);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new dl}clone(){const e=new dl;return e.applyDelta(this.toDelta()),e}_callObserver(e,n){super._callObserver(e,n);const r=new AW(this,e,n);mm(this,e,r),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){let e="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===bs&&(e+=n.content.str),n=n.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:n=!0}={}){this.doc!==null?vt(this.doc,r=>{const s=new jA(null,this._start,0,new Map);for(let i=0;i<e.length;i++){const o=e[i];if(o.insert!==void 0){const a=!n&&typeof o.insert=="string"&&i===e.length-1&&s.right===null&&o.insert.slice(-1)===`
475
475
  `?o.insert.slice(0,-1):o.insert;(typeof a!="string"||a.length>0)&&UA(r,this,s,a,o.attributes||{})}else o.retain!==void 0?E_(r,this,s,o.retain,o.attributes||{}):o.delete!==void 0&&S_(r,s,o.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,n,r){const s=[],i=new Map,o=this.doc;let a="",l=this._start;function u(){if(a.length>0){const f={};let d=!1;i.forEach((p,m)=>{d=!0,f[m]=p});const h={insert:a};d&&(h.attributes=f),s.push(h),a=""}}const c=()=>{for(;l!==null;){if(fl(l,e)||n!==void 0&&fl(l,n))switch(l.content.constructor){case bs:{const f=i.get("ychange");e!==void 0&&!fl(l,e)?(f===void 0||f.user!==l.id.client||f.type!=="removed")&&(u(),i.set("ychange",r?r("removed",l.id):{type:"removed"})):n!==void 0&&!fl(l,n)?(f===void 0||f.user!==l.id.client||f.type!=="added")&&(u(),i.set("ychange",r?r("added",l.id):{type:"added"})):f!==void 0&&(u(),i.delete("ychange")),a+=l.content.str;break}case ws:case pl:{u();const f={insert:l.content.getContent()[0]};if(i.size>0){const d={};f.attributes=d,i.forEach((h,p)=>{d[p]=h})}s.push(f);break}case Zt:fl(l,e)&&(u(),ic(i,l.content));break}l=l.right}u()};return e||n?vt(o,f=>{e&&MA(f,e),n&&MA(f,n),c()},"cleanup"):c(),s}insert(e,n,r){if(n.length<=0)return;const s=this.doc;s!==null?vt(s,i=>{const o=wm(i,this,e,!r);r||(r={},o.currentAttributes.forEach((a,l)=>{r[l]=a})),UA(i,this,o,n,r)}):this._pending.push(()=>this.insert(e,n,r))}insertEmbed(e,n,r){const s=this.doc;s!==null?vt(s,i=>{const o=wm(i,this,e,!r);UA(i,this,o,n,r||{})}):this._pending.push(()=>this.insertEmbed(e,n,r||{}))}delete(e,n){if(n===0)return;const r=this.doc;r!==null?vt(r,s=>{S_(s,wm(s,this,e,!0),n)}):this._pending.push(()=>this.delete(e,n))}format(e,n,r){if(n===0)return;const s=this.doc;s!==null?vt(s,i=>{const o=wm(i,this,e,!1);o.right!==null&&E_(i,this,o,n,r)}):this._pending.push(()=>this.format(e,n,r))}removeAttribute(e){this.doc!==null?vt(this.doc,n=>{ym(n,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,n){this.doc!==null?vt(this.doc,r=>{BA(r,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return FA(this,e)}getAttributes(){return b_(this)}_write(e){e.writeTypeRef(jW)}}const vW=t=>new dl;class VA{constructor(e,n=()=>!0){this._filter=n,this._root=e,this._currentNode=e._start,this._firstCall=!0}[Symbol.iterator](){return this}next(){let e=this._currentNode,n=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(n)))do if(n=e.content.type,!e.deleted&&(n.constructor===$n||n.constructor===hl)&&n._start!==null)e=n._start;else for(;e!==null;)if(e.right!==null){e=e.right;break}else e.parent===this._root?e=null:e=e.parent._item;while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class hl extends kn{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new hl}clone(){const e=new hl;return e.insert(0,this.toArray().map(n=>n instanceof kn?n.clone():n)),e}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new VA(this,e)}querySelector(e){e=e.toUpperCase();const r=new VA(this,s=>s.nodeName&&s.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),_i(new VA(this,n=>n.nodeName&&n.nodeName.toUpperCase()===e))}_callObserver(e,n){mm(this,e,new EW(this,n,e))}toString(){return h_(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,n={},r){const s=e.createDocumentFragment();return r!==void 0&&r._createAssociation(s,this),nh(this,i=>{s.insertBefore(i.toDOM(e,n,r),null)}),s}insert(e,n){this.doc!==null?vt(this.doc,r=>{g_(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}insertAfter(e,n){if(this.doc!==null)vt(this.doc,r=>{const s=e&&e instanceof kn?e._item:e;gm(r,this,s,n)});else{const r=this._prelimContent,s=e===null?0:r.findIndex(i=>i===e)+1;if(s===0&&e!==null)throw Gs("Reference item not found");r.splice(s,0,...n)}}delete(e,n=1){this.doc!==null?vt(this.doc,r=>{y_(r,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return f_(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return p_(this,e)}slice(e=0,n=this.length){return c_(this,e,n)}forEach(e){nh(this,e)}_write(e){e.writeTypeRef(VW)}}const xW=t=>new hl;class $n extends hl{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,n){super._integrate(e,n),this._prelimAttrs.forEach((r,s)=>{this.setAttribute(s,r)}),this._prelimAttrs=null}_copy(){return new $n(this.nodeName)}clone(){const e=new $n(this.nodeName),n=this.getAttributes();return J$(n,(r,s)=>{typeof r=="string"&&e.setAttribute(s,r)}),e.insert(0,this.toArray().map(r=>r instanceof kn?r.clone():r)),e}toString(){const e=this.getAttributes(),n=[],r=[];for(const a in e)r.push(a);r.sort();const s=r.length;for(let a=0;a<s;a++){const l=r[a];n.push(l+'="'+e[l]+'"')}const i=this.nodeName.toLocaleLowerCase(),o=n.length>0?" "+n.join(" "):"";return`<${i}${o}>${super.toString()}</${i}>`}removeAttribute(e){this.doc!==null?vt(this.doc,n=>{ym(n,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,n){this.doc!==null?vt(this.doc,r=>{BA(r,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return FA(this,e)}hasAttribute(e){return w_(this,e)}getAttributes(e){return e?dW(this,e):b_(this)}toDOM(e=document,n={},r){const s=e.createElement(this.nodeName),i=this.getAttributes();for(const o in i){const a=i[o];typeof a=="string"&&s.setAttribute(o,a)}return nh(this,o=>{s.appendChild(o.toDOM(e,n,r))}),r!==void 0&&r._createAssociation(s,this),s}_write(e){e.writeTypeRef(UW),e.writeKey(this.nodeName)}}const kW=t=>new $n(t.readKey());class EW extends hm{constructor(e,n,r){super(e,r),this.childListChanged=!1,this.attributesChanged=new Set,n.forEach(s=>{s===null?this.childListChanged=!0:this.attributesChanged.add(s)})}}class Am extends sc{constructor(e){super(),this.hookName=e}_copy(){return new Am(this.hookName)}clone(){const e=new Am(this.hookName);return this.forEach((n,r)=>{e.set(r,n)}),e}toDOM(e=document,n={},r){const s=n[this.hookName];let i;return s!==void 0?i=s.createDom(this):i=document.createElement(this.hookName),i.setAttribute("data-yjs-hook",this.hookName),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(HW),e.writeKey(this.hookName)}}const CW=t=>new Am(t.readKey());class Dr extends dl{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new Dr}clone(){const e=new Dr;return e.applyDelta(this.toDelta()),e}toDOM(e=document,n,r){const s=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(s,this),s}toString(){return this.toDelta().map(e=>{const n=[];for(const s in e.attributes){const i=[];for(const o in e.attributes[s])i.push({key:o,value:e.attributes[s][o]});i.sort((o,a)=>o.key<a.key?-1:1),n.push({nodeName:s,attrs:i})}n.sort((s,i)=>s.nodeName<i.nodeName?-1:1);let r="";for(let s=0;s<n.length;s++){const i=n[s];r+=`<${i.nodeName}`;for(let o=0;o<i.attrs.length;o++){const a=i.attrs[o];r+=` ${a.key}="${a.value}"`}r+=">"}r+=e.insert;for(let s=n.length-1;s>=0;s--)r+=`</${n[s].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(zW)}}const SW=t=>new Dr;class HA{constructor(e,n){this.id=e,this.length=n}get deleted(){throw ys()}mergeWith(e){return!1}write(e,n,r){throw ys()}integrate(e,n){throw ys()}}const TW=0;class Kr extends HA{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){n>0&&(this.id.clock+=n,this.length-=n),YO(e.doc.store,this)}write(e,n){e.writeInfo(TW),e.writeLen(this.length-n)}getMissing(e,n){return null}}class rh{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new rh(this.content)}splice(e){throw ys()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeBuf(this.content)}getRef(){return 3}}const DW=t=>new rh(t.readBuf());class sh{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new sh(this.len)}splice(e){const n=new sh(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){qd(e.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(e){}gc(e){}write(e,n){e.writeLen(this.len-n)}getRef(){return 1}}const OW=t=>new sh(t.readLen()),T_=(t,e)=>new ul({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class ih{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const n={};this.opts=n,e.gc||(n.gc=!1),e.autoLoad&&(n.autoLoad=!0),e.meta!==null&&(n.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new ih(T_(this.doc.guid,this.opts))}splice(e){throw ys()}mergeWith(e){return!1}integrate(e,n){this.doc._item=n,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,n){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}const _W=t=>new ih(T_(t.readString(),t.readAny()));class pl{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new pl(this.embed)}splice(e){throw ys()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeJSON(this.embed)}getRef(){return 5}}const MW=t=>new pl(t.readJSON());class Zt{constructor(e,n){this.key=e,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new Zt(this.key,this.value)}splice(e){throw ys()}mergeWith(e){return!1}integrate(e,n){const r=n.parent;r._searchMarker=null,r._hasFormatting=!0}delete(e){}gc(e){}write(e,n){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const NW=t=>new Zt(t.readKey(),t.readJSON());class vm{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new vm(this.arr)}splice(e){const n=new vm(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let s=n;s<r;s++){const i=this.arr[s];e.writeString(i===void 0?"undefined":JSON.stringify(i))}}getRef(){return 2}}const RW=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++){const s=t.readString();s==="undefined"?n.push(void 0):n.push(JSON.parse(s))}return new vm(n)};class ml{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new ml(this.arr)}splice(e){const n=new ml(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let s=n;s<r;s++){const i=this.arr[s];e.writeAny(i)}}getRef(){return 8}}const PW=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++)n.push(t.readAny());return new ml(n)};class bs{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new bs(this.str)}splice(e){const n=new bs(this.str.slice(e));this.str=this.str.slice(0,e);const r=this.str.charCodeAt(e-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"�",n.str="�"+n.str.slice(1)),n}mergeWith(e){return this.str+=e.str,!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeString(n===0?this.str:this.str.slice(n))}getRef(){return 4}}const IW=t=>new bs(t.readString()),LW=[pW,gW,vW,kW,xW,CW,SW],BW=0,FW=1,jW=2,UW=3,VW=4,HW=5,zW=6;class ws{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new ws(this.type._copy())}splice(e){throw ys()}mergeWith(e){return!1}integrate(e,n){this.type._integrate(e.doc,n)}delete(e){let n=this.type._start;for(;n!==null;)n.deleted?n.id.clock<(e.beforeState.get(n.id.client)||0)&&e._mergeStructs.push(n):n.delete(e),n=n.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(e.beforeState.get(r.id.client)||0)&&e._mergeStructs.push(r):r.delete(e)}),e.changed.delete(this.type)}gc(e){let n=this.type._start;for(;n!==null;)n.gc(e,!0),n=n.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(e,!0),r=r.left}),this.type._map=new Map}write(e,n){this.type._write(e)}getRef(){return 7}}const $W=t=>new ws(LW[t.readTypeRef()](t)),zA=(t,e)=>{let n=e,r=0,s;do r>0&&(n=Ke(n.client,n.clock+r)),s=nc(t,n),r=n.clock-s.id.clock,n=s.redone;while(n!==null&&s instanceof Et);return{item:s,diff:r}},$A=(t,e)=>{for(;t!==null&&t.keep!==e;)t.keep=e,t=t.parent._item},xm=(t,e,n)=>{const{client:r,clock:s}=e.id,i=new Et(Ke(r,s+n),e,Ke(r,s+n-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(n));return e.deleted&&i.markDeleted(),e.keep&&(i.keep=!0),e.redone!==null&&(i.redone=Ke(e.redone.client,e.redone.clock+n)),e.right=i,i.right!==null&&(i.right.left=i),t._mergeStructs.push(i),i.parentSub!==null&&i.right===null&&i.parent._map.set(i.parentSub,i),e.length=n,i},D_=(t,e)=>g$(t,n=>Yu(n.deletions,e)),O_=(t,e,n,r,s,i)=>{const o=t.doc,a=o.store,l=o.clientID,u=e.redone;if(u!==null)return ar(t,u);let c=e.parent._item,f=null,d;if(c!==null&&c.deleted===!0){if(c.redone===null&&(!n.has(c)||O_(t,c,n,r,s,i)===null))return null;for(;c.redone!==null;)c=ar(t,c.redone)}const h=c===null?e.parent:c.content.type;if(e.parentSub===null){for(f=e.left,d=e;f!==null;){let y=f;for(;y!==null&&y.parent._item!==c;)y=y.redone===null?null:ar(t,y.redone);if(y!==null&&y.parent._item===c){f=y;break}f=f.left}for(;d!==null;){let y=d;for(;y!==null&&y.parent._item!==c;)y=y.redone===null?null:ar(t,y.redone);if(y!==null&&y.parent._item===c){d=y;break}d=d.right}}else if(d=null,e.right&&!s){for(f=e;f!==null&&f.right!==null&&(f.right.redone||Yu(r,f.right.id)||D_(i.undoStack,f.right.id)||D_(i.redoStack,f.right.id));)for(f=f.right;f.redone;)f=ar(t,f.redone);if(f&&f.right!==null)return null}else f=h._map.get(e.parentSub)||null;const p=zt(a,l),m=Ke(l,p),g=new Et(m,f,f&&f.lastId,d,d&&d.id,h,e.parentSub,e.content.copy());return e.redone=m,$A(g,!0),g.integrate(t,0),g};let Et=class Yk extends HA{constructor(e,n,r,s,i,o,a,l){super(e,l.getLength()),this.origin=r,this.left=n,this.right=s,this.rightOrigin=i,this.parent=o,this.parentSub=a,this.redone=null,this.content=l,this.info=this.content.isCountable()?XD:0}set marker(e){(this.info&nA)>0!==e&&(this.info^=nA)}get marker(){return(this.info&nA)>0}get keep(){return(this.info&YD)>0}set keep(e){this.keep!==e&&(this.info^=YD)}get countable(){return(this.info&XD)>0}get deleted(){return(this.info&tA)>0}set deleted(e){this.deleted!==e&&(this.info^=tA)}markDeleted(){this.info|=tA}getMissing(e,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=zt(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=zt(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===ec&&this.id.client!==this.parent.client&&this.parent.clock>=zt(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=XO(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=ar(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===Kr||this.right&&this.right.constructor===Kr)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===Yk&&(this.parent=this.left.parent,this.parentSub=this.left.parentSub),this.right&&this.right.constructor===Yk&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===ec){const r=nc(n,this.parent);r.constructor===Kr?this.parent=null:this.parent=r.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=XO(e,e.doc.store,Ke(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,s;if(r!==null)s=r.right;else if(this.parentSub!==null)for(s=this.parent._map.get(this.parentSub)||null;s!==null&&s.left!==null;)s=s.left;else s=this.parent._start;const i=new Set,o=new Set;for(;s!==null&&s!==this.right;){if(o.add(s),i.add(s),tc(this.origin,s.origin)){if(s.id.client<this.id.client)r=s,i.clear();else if(tc(this.rightOrigin,s.rightOrigin))break}else if(s.origin!==null&&o.has(nc(e.doc.store,s.origin)))i.has(nc(e.doc.store,s.origin))||(r=s,i.clear());else break;s=s.right}this.left=r}if(this.left!==null){const r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start,this.parent._start=this;this.right=r}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),YO(e.doc.store,this),this.content.integrate(e,this),t_(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new Kr(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:Ke(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&tc(e.origin,this.lastId)&&this.right===e&&tc(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const n=this.parent._searchMarker;return n&&n.forEach(r=>{r.p===e&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),qd(e.deleteSet,this.id.client,this.id.clock,this.length),t_(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw Sr();this.content.gc(e),n?QG(e,this,new Kr(this.id,this.length)):this.content=new sh(this.length)}write(e,n){const r=n>0?Ke(this.id.client,this.id.clock+n-1):this.origin,s=this.rightOrigin,i=this.parentSub,o=this.content.getRef()&tm|(r===null?0:Tr)|(s===null?0:Ni)|(i===null?0:Hd);if(e.writeInfo(o),r!==null&&e.writeLeftID(r),s!==null&&e.writeRightID(s),r===null&&s===null){const a=this.parent;if(a._item!==void 0){const l=a._item;if(l===null){const u=Jd(a);e.writeParentInfo(!0),e.writeString(u)}else e.writeParentInfo(!1),e.writeLeftID(l.id)}else a.constructor===String?(e.writeParentInfo(!0),e.writeString(a)):a.constructor===ec?(e.writeParentInfo(!1),e.writeLeftID(a)):Sr();i!==null&&e.writeString(i)}this.content.write(e,n)}};const __=(t,e)=>GW[e&tm](t),GW=[()=>{Sr()},OW,RW,DW,IW,MW,NW,$W,PW,_W,()=>{Sr()}],WW=10;class qr extends HA{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){Sr()}write(e,n){e.writeInfo(WW),Ne(e.restEncoder,this.length-n)}getMissing(e,n){return null}}const M_=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},N_="__ $YJS$ __";M_[N_]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438"),M_[N_]=!0;function km(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var R_={exports:{}};(function(t,e){(function(n){t.exports=n()})(function(){var n=Math.floor,r=Math.abs,s=Math.pow;return function(){function i(o,a,l){function u(d,h){if(!a[d]){if(!o[d]){var p=typeof km=="function"&&km;if(!h&&p)return p(d,!0);if(c)return c(d,!0);var m=new Error("Cannot find module '"+d+"'");throw m.code="MODULE_NOT_FOUND",m}var g=a[d]={exports:{}};o[d][0].call(g.exports,function(y){var v=o[d][1][y];return u(v||y)},g,g.exports,i,o,a,l)}return a[d].exports}for(var c=typeof km=="function"&&km,f=0;f<l.length;f++)u(l[f]);return u}return i}()({1:[function(i,o,a){function l(A){var x=A.length;if(0<x%4)throw new Error("Invalid string. Length must be a multiple of 4");var k=A.indexOf("=");k===-1&&(k=x);var C=k===x?0:4-k%4;return[k,C]}function u(A,x,k){return 3*(x+k)/4-k}function c(A){var x,k,C=l(A),O=C[0],_=C[1],D=new g(u(A,O,_)),R=0,L=0<_?O-4:O;for(k=0;k<L;k+=4)x=m[A.charCodeAt(k)]<<18|m[A.charCodeAt(k+1)]<<12|m[A.charCodeAt(k+2)]<<6|m[A.charCodeAt(k+3)],D[R++]=255&x>>16,D[R++]=255&x>>8,D[R++]=255&x;return _===2&&(x=m[A.charCodeAt(k)]<<2|m[A.charCodeAt(k+1)]>>4,D[R++]=255&x),_===1&&(x=m[A.charCodeAt(k)]<<10|m[A.charCodeAt(k+1)]<<4|m[A.charCodeAt(k+2)]>>2,D[R++]=255&x>>8,D[R++]=255&x),D}function f(A){return p[63&A>>18]+p[63&A>>12]+p[63&A>>6]+p[63&A]}function d(A,x,k){for(var C,O=[],_=x;_<k;_+=3)C=(16711680&A[_]<<16)+(65280&A[_+1]<<8)+(255&A[_+2]),O.push(f(C));return O.join("")}function h(A){for(var x,k=A.length,C=k%3,O=[],_=16383,D=0,R=k-C;D<R;D+=_)O.push(d(A,D,D+_>R?R:D+_));return C===1?(x=A[k-1],O.push(p[x>>2]+p[63&x<<4]+"==")):C===2&&(x=(A[k-2]<<8)+A[k-1],O.push(p[x>>10]+p[63&x>>4]+p[63&x<<2]+"=")),O.join("")}a.byteLength=function(A){var x=l(A),k=x[0],C=x[1];return 3*(k+C)/4-C},a.toByteArray=c,a.fromByteArray=h;for(var p=[],m=[],g=typeof Uint8Array>"u"?Array:Uint8Array,y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",v=0,w=y.length;v<w;++v)p[v]=y[v],m[y.charCodeAt(v)]=v;m[45]=62,m[95]=63},{}],2:[function(){},{}],3:[function(i,o,a){(function(){(function(){var l=String.fromCharCode,u=Math.min;function c(b){if(2147483647<b)throw new RangeError('The value "'+b+'" is invalid for option "size"');var E=new Uint8Array(b);return E.__proto__=f.prototype,E}function f(b,E,M){if(typeof b=="number"){if(typeof E=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(b)}return d(b,E,M)}function d(b,E,M){if(typeof b=="string")return g(b,E);if(ArrayBuffer.isView(b))return y(b);if(b==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof b);if(z(b,ArrayBuffer)||b&&z(b.buffer,ArrayBuffer))return v(b,E,M);if(typeof b=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var j=b.valueOf&&b.valueOf();if(j!=null&&j!==b)return f.from(j,E,M);var K=w(b);if(K)return K;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof b[Symbol.toPrimitive]=="function")return f.from(b[Symbol.toPrimitive]("string"),E,M);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof b)}function h(b){if(typeof b!="number")throw new TypeError('"size" argument must be of type number');if(0>b)throw new RangeError('The value "'+b+'" is invalid for option "size"')}function p(b,E,M){return h(b),0>=b||E===void 0?c(b):typeof M=="string"?c(b).fill(E,M):c(b).fill(E)}function m(b){return h(b),c(0>b?0:0|A(b))}function g(b,E){if((typeof E!="string"||E==="")&&(E="utf8"),!f.isEncoding(E))throw new TypeError("Unknown encoding: "+E);var M=0|x(b,E),j=c(M),K=j.write(b,E);return K!==M&&(j=j.slice(0,K)),j}function y(b){for(var E=0>b.length?0:0|A(b.length),M=c(E),j=0;j<E;j+=1)M[j]=255&b[j];return M}function v(b,E,M){if(0>E||b.byteLength<E)throw new RangeError('"offset" is outside of buffer bounds');if(b.byteLength<E+(M||0))throw new RangeError('"length" is outside of buffer bounds');var j;return j=E===void 0&&M===void 0?new Uint8Array(b):M===void 0?new Uint8Array(b,E):new Uint8Array(b,E,M),j.__proto__=f.prototype,j}function w(b){if(f.isBuffer(b)){var E=0|A(b.length),M=c(E);return M.length===0||b.copy(M,0,0,E),M}return b.length===void 0?b.type==="Buffer"&&Array.isArray(b.data)?y(b.data):void 0:typeof b.length!="number"||q(b.length)?c(0):y(b)}function A(b){if(b>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|b}function x(b,E){if(f.isBuffer(b))return b.length;if(ArrayBuffer.isView(b)||z(b,ArrayBuffer))return b.byteLength;if(typeof b!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof b);var M=b.length,j=2<arguments.length&&arguments[2]===!0;if(!j&&M===0)return 0;for(var K=!1;;)switch(E){case"ascii":case"latin1":case"binary":return M;case"utf8":case"utf-8":return le(b).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*M;case"hex":return M>>>1;case"base64":return be(b).length;default:if(K)return j?-1:le(b).length;E=(""+E).toLowerCase(),K=!0}}function k(b,E,M){var j=!1;if((E===void 0||0>E)&&(E=0),E>this.length||((M===void 0||M>this.length)&&(M=this.length),0>=M)||(M>>>=0,E>>>=0,M<=E))return"";for(b||(b="utf8");;)switch(b){case"hex":return Ee(this,E,M);case"utf8":case"utf-8":return Q(this,E,M);case"ascii":return Z(this,E,M);case"latin1":case"binary":return pe(this,E,M);case"base64":return H(this,E,M);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Re(this,E,M);default:if(j)throw new TypeError("Unknown encoding: "+b);b=(b+"").toLowerCase(),j=!0}}function C(b,E,M){var j=b[E];b[E]=b[M],b[M]=j}function O(b,E,M,j,K){if(b.length===0)return-1;if(typeof M=="string"?(j=M,M=0):2147483647<M?M=2147483647:-2147483648>M&&(M=-2147483648),M=+M,q(M)&&(M=K?0:b.length-1),0>M&&(M=b.length+M),M>=b.length){if(K)return-1;M=b.length-1}else if(0>M)if(K)M=0;else return-1;if(typeof E=="string"&&(E=f.from(E,j)),f.isBuffer(E))return E.length===0?-1:_(b,E,M,j,K);if(typeof E=="number")return E&=255,typeof Uint8Array.prototype.indexOf=="function"?K?Uint8Array.prototype.indexOf.call(b,E,M):Uint8Array.prototype.lastIndexOf.call(b,E,M):_(b,[E],M,j,K);throw new TypeError("val must be string, number or Buffer")}function _(b,E,M,j,K){function Y(br,X){return ye===1?br[X]:br.readUInt16BE(X*ye)}var ye=1,Se=b.length,Je=E.length;if(j!==void 0&&(j=(j+"").toLowerCase(),j==="ucs2"||j==="ucs-2"||j==="utf16le"||j==="utf-16le")){if(2>b.length||2>E.length)return-1;ye=2,Se/=2,Je/=2,M/=2}var Ve;if(K){var Fe=-1;for(Ve=M;Ve<Se;Ve++)if(Y(b,Ve)!==Y(E,Fe===-1?0:Ve-Fe))Fe!==-1&&(Ve-=Ve-Fe),Fe=-1;else if(Fe===-1&&(Fe=Ve),Ve-Fe+1===Je)return Fe*ye}else for(M+Je>Se&&(M=Se-Je),Ve=M;0<=Ve;Ve--){for(var ft=!0,Xn=0;Xn<Je;Xn++)if(Y(b,Ve+Xn)!==Y(E,Xn)){ft=!1;break}if(ft)return Ve}return-1}function D(b,E,M,j){M=+M||0;var K=b.length-M;j?(j=+j,j>K&&(j=K)):j=K;var Y=E.length;j>Y/2&&(j=Y/2);for(var ye,Se=0;Se<j;++Se){if(ye=parseInt(E.substr(2*Se,2),16),q(ye))return Se;b[M+Se]=ye}return Se}function R(b,E,M,j){return Be(le(E,b.length-M),b,M,j)}function L(b,E,M,j){return Be($e(E),b,M,j)}function F(b,E,M,j){return L(b,E,M,j)}function G(b,E,M,j){return Be(be(E),b,M,j)}function B(b,E,M,j){return Be(ae(E,b.length-M),b,M,j)}function H(b,E,M){return E===0&&M===b.length?re.fromByteArray(b):re.fromByteArray(b.slice(E,M))}function Q(b,E,M){M=u(b.length,M);for(var j=[],K=E;K<M;){var Y=b[K],ye=null,Se=239<Y?4:223<Y?3:191<Y?2:1;if(K+Se<=M){var Je,Ve,Fe,ft;Se===1?128>Y&&(ye=Y):Se===2?(Je=b[K+1],(192&Je)==128&&(ft=(31&Y)<<6|63&Je,127<ft&&(ye=ft))):Se===3?(Je=b[K+1],Ve=b[K+2],(192&Je)==128&&(192&Ve)==128&&(ft=(15&Y)<<12|(63&Je)<<6|63&Ve,2047<ft&&(55296>ft||57343<ft)&&(ye=ft))):Se===4&&(Je=b[K+1],Ve=b[K+2],Fe=b[K+3],(192&Je)==128&&(192&Ve)==128&&(192&Fe)==128&&(ft=(15&Y)<<18|(63&Je)<<12|(63&Ve)<<6|63&Fe,65535<ft&&1114112>ft&&(ye=ft)))}ye===null?(ye=65533,Se=1):65535<ye&&(ye-=65536,j.push(55296|1023&ye>>>10),ye=56320|1023&ye),j.push(ye),K+=Se}return te(j)}function te(b){var E=b.length;if(E<=4096)return l.apply(String,b);for(var M="",j=0;j<E;)M+=l.apply(String,b.slice(j,j+=4096));return M}function Z(b,E,M){var j="";M=u(b.length,M);for(var K=E;K<M;++K)j+=l(127&b[K]);return j}function pe(b,E,M){var j="";M=u(b.length,M);for(var K=E;K<M;++K)j+=l(b[K]);return j}function Ee(b,E,M){var j=b.length;(!E||0>E)&&(E=0),(!M||0>M||M>j)&&(M=j);for(var K="",Y=E;Y<M;++Y)K+=tt(b[Y]);return K}function Re(b,E,M){for(var j=b.slice(E,M),K="",Y=0;Y<j.length;Y+=2)K+=l(j[Y]+256*j[Y+1]);return K}function Ce(b,E,M){if(b%1!=0||0>b)throw new RangeError("offset is not uint");if(b+E>M)throw new RangeError("Trying to access beyond buffer length")}function ke(b,E,M,j,K,Y){if(!f.isBuffer(b))throw new TypeError('"buffer" argument must be a Buffer instance');if(E>K||E<Y)throw new RangeError('"value" argument is out of bounds');if(M+j>b.length)throw new RangeError("Index out of range")}function He(b,E,M,j){if(M+j>b.length)throw new RangeError("Index out of range");if(0>M)throw new RangeError("Index out of range")}function Ue(b,E,M,j,K){return E=+E,M>>>=0,K||He(b,E,M,4),ue.write(b,E,M,j,23,4),M+4}function ze(b,E,M,j,K){return E=+E,M>>>=0,K||He(b,E,M,8),ue.write(b,E,M,j,52,8),M+8}function Le(b){if(b=b.split("=")[0],b=b.trim().replace(P,""),2>b.length)return"";for(;b.length%4!=0;)b+="=";return b}function tt(b){return 16>b?"0"+b.toString(16):b.toString(16)}function le(b,E){E=E||1/0;for(var M,j=b.length,K=null,Y=[],ye=0;ye<j;++ye){if(M=b.charCodeAt(ye),55295<M&&57344>M){if(!K){if(56319<M){-1<(E-=3)&&Y.push(239,191,189);continue}else if(ye+1===j){-1<(E-=3)&&Y.push(239,191,189);continue}K=M;continue}if(56320>M){-1<(E-=3)&&Y.push(239,191,189),K=M;continue}M=(K-55296<<10|M-56320)+65536}else K&&-1<(E-=3)&&Y.push(239,191,189);if(K=null,128>M){if(0>(E-=1))break;Y.push(M)}else if(2048>M){if(0>(E-=2))break;Y.push(192|M>>6,128|63&M)}else if(65536>M){if(0>(E-=3))break;Y.push(224|M>>12,128|63&M>>6,128|63&M)}else if(1114112>M){if(0>(E-=4))break;Y.push(240|M>>18,128|63&M>>12,128|63&M>>6,128|63&M)}else throw new Error("Invalid code point")}return Y}function $e(b){for(var E=[],M=0;M<b.length;++M)E.push(255&b.charCodeAt(M));return E}function ae(b,E){for(var M,j,K,Y=[],ye=0;ye<b.length&&!(0>(E-=2));++ye)M=b.charCodeAt(ye),j=M>>8,K=M%256,Y.push(K),Y.push(j);return Y}function be(b){return re.toByteArray(Le(b))}function Be(b,E,M,j){for(var K=0;K<j&&!(K+M>=E.length||K>=b.length);++K)E[K+M]=b[K];return K}function z(b,E){return b instanceof E||b!=null&&b.constructor!=null&&b.constructor.name!=null&&b.constructor.name===E.name}function q(b){return b!==b}var re=i("base64-js"),ue=i("ieee754");a.Buffer=f,a.SlowBuffer=function(b){return+b!=b&&(b=0),f.alloc(+b)},a.INSPECT_MAX_BYTES=50,a.kMaxLength=2147483647,f.TYPED_ARRAY_SUPPORT=function(){try{var b=new Uint8Array(1);return b.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},b.foo()===42}catch{return!1}}(),f.TYPED_ARRAY_SUPPORT||typeof console>"u"||typeof console.error!="function"||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(f.prototype,"parent",{enumerable:!0,get:function(){return f.isBuffer(this)?this.buffer:void 0}}),Object.defineProperty(f.prototype,"offset",{enumerable:!0,get:function(){return f.isBuffer(this)?this.byteOffset:void 0}}),typeof Symbol<"u"&&Symbol.species!=null&&f[Symbol.species]===f&&Object.defineProperty(f,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),f.poolSize=8192,f.from=function(b,E,M){return d(b,E,M)},f.prototype.__proto__=Uint8Array.prototype,f.__proto__=Uint8Array,f.alloc=function(b,E,M){return p(b,E,M)},f.allocUnsafe=function(b){return m(b)},f.allocUnsafeSlow=function(b){return m(b)},f.isBuffer=function(b){return b!=null&&b._isBuffer===!0&&b!==f.prototype},f.compare=function(b,E){if(z(b,Uint8Array)&&(b=f.from(b,b.offset,b.byteLength)),z(E,Uint8Array)&&(E=f.from(E,E.offset,E.byteLength)),!f.isBuffer(b)||!f.isBuffer(E))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(b===E)return 0;for(var M=b.length,j=E.length,K=0,Y=u(M,j);K<Y;++K)if(b[K]!==E[K]){M=b[K],j=E[K];break}return M<j?-1:j<M?1:0},f.isEncoding=function(b){switch((b+"").toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},f.concat=function(b,E){if(!Array.isArray(b))throw new TypeError('"list" argument must be an Array of Buffers');if(b.length===0)return f.alloc(0);var M;if(E===void 0)for(E=0,M=0;M<b.length;++M)E+=b[M].length;var j=f.allocUnsafe(E),K=0;for(M=0;M<b.length;++M){var Y=b[M];if(z(Y,Uint8Array)&&(Y=f.from(Y)),!f.isBuffer(Y))throw new TypeError('"list" argument must be an Array of Buffers');Y.copy(j,K),K+=Y.length}return j},f.byteLength=x,f.prototype._isBuffer=!0,f.prototype.swap16=function(){var b=this.length;if(b%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var E=0;E<b;E+=2)C(this,E,E+1);return this},f.prototype.swap32=function(){var b=this.length;if(b%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var E=0;E<b;E+=4)C(this,E,E+3),C(this,E+1,E+2);return this},f.prototype.swap64=function(){var b=this.length;if(b%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var E=0;E<b;E+=8)C(this,E,E+7),C(this,E+1,E+6),C(this,E+2,E+5),C(this,E+3,E+4);return this},f.prototype.toString=function(){var b=this.length;return b===0?"":arguments.length===0?Q(this,0,b):k.apply(this,arguments)},f.prototype.toLocaleString=f.prototype.toString,f.prototype.equals=function(b){if(!f.isBuffer(b))throw new TypeError("Argument must be a Buffer");return this===b||f.compare(this,b)===0},f.prototype.inspect=function(){var b="",E=a.INSPECT_MAX_BYTES;return b=this.toString("hex",0,E).replace(/(.{2})/g,"$1 ").trim(),this.length>E&&(b+=" ... "),"<Buffer "+b+">"},f.prototype.compare=function(b,E,M,j,K){if(z(b,Uint8Array)&&(b=f.from(b,b.offset,b.byteLength)),!f.isBuffer(b))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof b);if(E===void 0&&(E=0),M===void 0&&(M=b?b.length:0),j===void 0&&(j=0),K===void 0&&(K=this.length),0>E||M>b.length||0>j||K>this.length)throw new RangeError("out of range index");if(j>=K&&E>=M)return 0;if(j>=K)return-1;if(E>=M)return 1;if(E>>>=0,M>>>=0,j>>>=0,K>>>=0,this===b)return 0;for(var Y=K-j,ye=M-E,Se=u(Y,ye),Je=this.slice(j,K),Ve=b.slice(E,M),Fe=0;Fe<Se;++Fe)if(Je[Fe]!==Ve[Fe]){Y=Je[Fe],ye=Ve[Fe];break}return Y<ye?-1:ye<Y?1:0},f.prototype.includes=function(b,E,M){return this.indexOf(b,E,M)!==-1},f.prototype.indexOf=function(b,E,M){return O(this,b,E,M,!0)},f.prototype.lastIndexOf=function(b,E,M){return O(this,b,E,M,!1)},f.prototype.write=function(b,E,M,j){if(E===void 0)j="utf8",M=this.length,E=0;else if(M===void 0&&typeof E=="string")j=E,M=this.length,E=0;else if(isFinite(E))E>>>=0,isFinite(M)?(M>>>=0,j===void 0&&(j="utf8")):(j=M,M=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var K=this.length-E;if((M===void 0||M>K)&&(M=K),0<b.length&&(0>M||0>E)||E>this.length)throw new RangeError("Attempt to write outside buffer bounds");j||(j="utf8");for(var Y=!1;;)switch(j){case"hex":return D(this,b,E,M);case"utf8":case"utf-8":return R(this,b,E,M);case"ascii":return L(this,b,E,M);case"latin1":case"binary":return F(this,b,E,M);case"base64":return G(this,b,E,M);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,b,E,M);default:if(Y)throw new TypeError("Unknown encoding: "+j);j=(""+j).toLowerCase(),Y=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},f.prototype.slice=function(b,E){var M=this.length;b=~~b,E=E===void 0?M:~~E,0>b?(b+=M,0>b&&(b=0)):b>M&&(b=M),0>E?(E+=M,0>E&&(E=0)):E>M&&(E=M),E<b&&(E=b);var j=this.subarray(b,E);return j.__proto__=f.prototype,j},f.prototype.readUIntLE=function(b,E,M){b>>>=0,E>>>=0,M||Ce(b,E,this.length);for(var j=this[b],K=1,Y=0;++Y<E&&(K*=256);)j+=this[b+Y]*K;return j},f.prototype.readUIntBE=function(b,E,M){b>>>=0,E>>>=0,M||Ce(b,E,this.length);for(var j=this[b+--E],K=1;0<E&&(K*=256);)j+=this[b+--E]*K;return j},f.prototype.readUInt8=function(b,E){return b>>>=0,E||Ce(b,1,this.length),this[b]},f.prototype.readUInt16LE=function(b,E){return b>>>=0,E||Ce(b,2,this.length),this[b]|this[b+1]<<8},f.prototype.readUInt16BE=function(b,E){return b>>>=0,E||Ce(b,2,this.length),this[b]<<8|this[b+1]},f.prototype.readUInt32LE=function(b,E){return b>>>=0,E||Ce(b,4,this.length),(this[b]|this[b+1]<<8|this[b+2]<<16)+16777216*this[b+3]},f.prototype.readUInt32BE=function(b,E){return b>>>=0,E||Ce(b,4,this.length),16777216*this[b]+(this[b+1]<<16|this[b+2]<<8|this[b+3])},f.prototype.readIntLE=function(b,E,M){b>>>=0,E>>>=0,M||Ce(b,E,this.length);for(var j=this[b],K=1,Y=0;++Y<E&&(K*=256);)j+=this[b+Y]*K;return K*=128,j>=K&&(j-=s(2,8*E)),j},f.prototype.readIntBE=function(b,E,M){b>>>=0,E>>>=0,M||Ce(b,E,this.length);for(var j=E,K=1,Y=this[b+--j];0<j&&(K*=256);)Y+=this[b+--j]*K;return K*=128,Y>=K&&(Y-=s(2,8*E)),Y},f.prototype.readInt8=function(b,E){return b>>>=0,E||Ce(b,1,this.length),128&this[b]?-1*(255-this[b]+1):this[b]},f.prototype.readInt16LE=function(b,E){b>>>=0,E||Ce(b,2,this.length);var M=this[b]|this[b+1]<<8;return 32768&M?4294901760|M:M},f.prototype.readInt16BE=function(b,E){b>>>=0,E||Ce(b,2,this.length);var M=this[b+1]|this[b]<<8;return 32768&M?4294901760|M:M},f.prototype.readInt32LE=function(b,E){return b>>>=0,E||Ce(b,4,this.length),this[b]|this[b+1]<<8|this[b+2]<<16|this[b+3]<<24},f.prototype.readInt32BE=function(b,E){return b>>>=0,E||Ce(b,4,this.length),this[b]<<24|this[b+1]<<16|this[b+2]<<8|this[b+3]},f.prototype.readFloatLE=function(b,E){return b>>>=0,E||Ce(b,4,this.length),ue.read(this,b,!0,23,4)},f.prototype.readFloatBE=function(b,E){return b>>>=0,E||Ce(b,4,this.length),ue.read(this,b,!1,23,4)},f.prototype.readDoubleLE=function(b,E){return b>>>=0,E||Ce(b,8,this.length),ue.read(this,b,!0,52,8)},f.prototype.readDoubleBE=function(b,E){return b>>>=0,E||Ce(b,8,this.length),ue.read(this,b,!1,52,8)},f.prototype.writeUIntLE=function(b,E,M,j){if(b=+b,E>>>=0,M>>>=0,!j){var K=s(2,8*M)-1;ke(this,b,E,M,K,0)}var Y=1,ye=0;for(this[E]=255&b;++ye<M&&(Y*=256);)this[E+ye]=255&b/Y;return E+M},f.prototype.writeUIntBE=function(b,E,M,j){if(b=+b,E>>>=0,M>>>=0,!j){var K=s(2,8*M)-1;ke(this,b,E,M,K,0)}var Y=M-1,ye=1;for(this[E+Y]=255&b;0<=--Y&&(ye*=256);)this[E+Y]=255&b/ye;return E+M},f.prototype.writeUInt8=function(b,E,M){return b=+b,E>>>=0,M||ke(this,b,E,1,255,0),this[E]=255&b,E+1},f.prototype.writeUInt16LE=function(b,E,M){return b=+b,E>>>=0,M||ke(this,b,E,2,65535,0),this[E]=255&b,this[E+1]=b>>>8,E+2},f.prototype.writeUInt16BE=function(b,E,M){return b=+b,E>>>=0,M||ke(this,b,E,2,65535,0),this[E]=b>>>8,this[E+1]=255&b,E+2},f.prototype.writeUInt32LE=function(b,E,M){return b=+b,E>>>=0,M||ke(this,b,E,4,4294967295,0),this[E+3]=b>>>24,this[E+2]=b>>>16,this[E+1]=b>>>8,this[E]=255&b,E+4},f.prototype.writeUInt32BE=function(b,E,M){return b=+b,E>>>=0,M||ke(this,b,E,4,4294967295,0),this[E]=b>>>24,this[E+1]=b>>>16,this[E+2]=b>>>8,this[E+3]=255&b,E+4},f.prototype.writeIntLE=function(b,E,M,j){if(b=+b,E>>>=0,!j){var K=s(2,8*M-1);ke(this,b,E,M,K-1,-K)}var Y=0,ye=1,Se=0;for(this[E]=255&b;++Y<M&&(ye*=256);)0>b&&Se===0&&this[E+Y-1]!==0&&(Se=1),this[E+Y]=255&(b/ye>>0)-Se;return E+M},f.prototype.writeIntBE=function(b,E,M,j){if(b=+b,E>>>=0,!j){var K=s(2,8*M-1);ke(this,b,E,M,K-1,-K)}var Y=M-1,ye=1,Se=0;for(this[E+Y]=255&b;0<=--Y&&(ye*=256);)0>b&&Se===0&&this[E+Y+1]!==0&&(Se=1),this[E+Y]=255&(b/ye>>0)-Se;return E+M},f.prototype.writeInt8=function(b,E,M){return b=+b,E>>>=0,M||ke(this,b,E,1,127,-128),0>b&&(b=255+b+1),this[E]=255&b,E+1},f.prototype.writeInt16LE=function(b,E,M){return b=+b,E>>>=0,M||ke(this,b,E,2,32767,-32768),this[E]=255&b,this[E+1]=b>>>8,E+2},f.prototype.writeInt16BE=function(b,E,M){return b=+b,E>>>=0,M||ke(this,b,E,2,32767,-32768),this[E]=b>>>8,this[E+1]=255&b,E+2},f.prototype.writeInt32LE=function(b,E,M){return b=+b,E>>>=0,M||ke(this,b,E,4,2147483647,-2147483648),this[E]=255&b,this[E+1]=b>>>8,this[E+2]=b>>>16,this[E+3]=b>>>24,E+4},f.prototype.writeInt32BE=function(b,E,M){return b=+b,E>>>=0,M||ke(this,b,E,4,2147483647,-2147483648),0>b&&(b=4294967295+b+1),this[E]=b>>>24,this[E+1]=b>>>16,this[E+2]=b>>>8,this[E+3]=255&b,E+4},f.prototype.writeFloatLE=function(b,E,M){return Ue(this,b,E,!0,M)},f.prototype.writeFloatBE=function(b,E,M){return Ue(this,b,E,!1,M)},f.prototype.writeDoubleLE=function(b,E,M){return ze(this,b,E,!0,M)},f.prototype.writeDoubleBE=function(b,E,M){return ze(this,b,E,!1,M)},f.prototype.copy=function(b,E,M,j){if(!f.isBuffer(b))throw new TypeError("argument should be a Buffer");if(M||(M=0),j||j===0||(j=this.length),E>=b.length&&(E=b.length),E||(E=0),0<j&&j<M&&(j=M),j===M||b.length===0||this.length===0)return 0;if(0>E)throw new RangeError("targetStart out of bounds");if(0>M||M>=this.length)throw new RangeError("Index out of range");if(0>j)throw new RangeError("sourceEnd out of bounds");j>this.length&&(j=this.length),b.length-E<j-M&&(j=b.length-E+M);var K=j-M;if(this===b&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(E,M,j);else if(this===b&&M<E&&E<j)for(var Y=K-1;0<=Y;--Y)b[Y+E]=this[Y+M];else Uint8Array.prototype.set.call(b,this.subarray(M,j),E);return K},f.prototype.fill=function(b,E,M,j){if(typeof b=="string"){if(typeof E=="string"?(j=E,E=0,M=this.length):typeof M=="string"&&(j=M,M=this.length),j!==void 0&&typeof j!="string")throw new TypeError("encoding must be a string");if(typeof j=="string"&&!f.isEncoding(j))throw new TypeError("Unknown encoding: "+j);if(b.length===1){var K=b.charCodeAt(0);(j==="utf8"&&128>K||j==="latin1")&&(b=K)}}else typeof b=="number"&&(b&=255);if(0>E||this.length<E||this.length<M)throw new RangeError("Out of range index");if(M<=E)return this;E>>>=0,M=M===void 0?this.length:M>>>0,b||(b=0);var Y;if(typeof b=="number")for(Y=E;Y<M;++Y)this[Y]=b;else{var ye=f.isBuffer(b)?b:f.from(b,j),Se=ye.length;if(Se===0)throw new TypeError('The value "'+b+'" is invalid for argument "value"');for(Y=0;Y<M-E;++Y)this[Y+E]=ye[Y%Se]}return this};var P=/[^+/0-9A-Za-z-_]/g}).call(this)}).call(this,i("buffer").Buffer)},{"base64-js":1,buffer:3,ieee754:9}],4:[function(i,o,a){(function(l){(function(){function u(){let f;try{f=a.storage.getItem("debug")}catch{}return!f&&typeof l<"u"&&"env"in l&&(f=l.env.DEBUG),f}a.formatArgs=function(f){if(f[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+f[0]+(this.useColors?"%c ":" ")+"+"+o.exports.humanize(this.diff),!this.useColors)return;const d="color: "+this.color;f.splice(1,0,d,"color: inherit");let h=0,p=0;f[0].replace(/%[a-zA-Z%]/g,m=>{m==="%%"||(h++,m==="%c"&&(p=h))}),f.splice(p,0,d)},a.save=function(f){try{f?a.storage.setItem("debug",f):a.storage.removeItem("debug")}catch{}},a.load=u,a.useColors=function(){return!!(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))||!(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&(typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&31<=parseInt(RegExp.$1,10)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},a.storage=function(){try{return localStorage}catch{}}(),a.destroy=(()=>{let f=!1;return()=>{f||(f=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),a.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],a.log=console.debug||console.log||(()=>{}),o.exports=i("./common")(a);const{formatters:c}=o.exports;c.j=function(f){try{return JSON.stringify(f)}catch(d){return"[UnexpectedJSONParseError]: "+d.message}}}).call(this)}).call(this,i("_process"))},{"./common":5,_process:12}],5:[function(i,o){o.exports=function(a){function l(f){function d(...m){if(!d.enabled)return;const g=d,y=+new Date,v=y-(h||y);g.diff=v,g.prev=h,g.curr=y,h=y,m[0]=l.coerce(m[0]),typeof m[0]!="string"&&m.unshift("%O");let w=0;m[0]=m[0].replace(/%([a-zA-Z%])/g,(x,k)=>{if(x==="%%")return"%";w++;const C=l.formatters[k];if(typeof C=="function"){const O=m[w];x=C.call(g,O),m.splice(w,1),w--}return x}),l.formatArgs.call(g,m),(g.log||l.log).apply(g,m)}let h,p=null;return d.namespace=f,d.useColors=l.useColors(),d.color=l.selectColor(f),d.extend=u,d.destroy=l.destroy,Object.defineProperty(d,"enabled",{enumerable:!0,configurable:!1,get:()=>p===null?l.enabled(f):p,set:m=>{p=m}}),typeof l.init=="function"&&l.init(d),d}function u(f,d){const h=l(this.namespace+(typeof d>"u"?":":d)+f);return h.log=this.log,h}function c(f){return f.toString().substring(2,f.toString().length-2).replace(/\.\*\?$/,"*")}return l.debug=l,l.default=l,l.coerce=function(f){return f instanceof Error?f.stack||f.message:f},l.disable=function(){const f=[...l.names.map(c),...l.skips.map(c).map(d=>"-"+d)].join(",");return l.enable(""),f},l.enable=function(f){l.save(f),l.names=[],l.skips=[];let d;const h=(typeof f=="string"?f:"").split(/[\s,]+/),p=h.length;for(d=0;d<p;d++)h[d]&&(f=h[d].replace(/\*/g,".*?"),f[0]==="-"?l.skips.push(new RegExp("^"+f.substr(1)+"$")):l.names.push(new RegExp("^"+f+"$")))},l.enabled=function(f){if(f[f.length-1]==="*")return!0;let d,h;for(d=0,h=l.skips.length;d<h;d++)if(l.skips[d].test(f))return!1;for(d=0,h=l.names.length;d<h;d++)if(l.names[d].test(f))return!0;return!1},l.humanize=i("ms"),l.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(a).forEach(f=>{l[f]=a[f]}),l.names=[],l.skips=[],l.formatters={},l.selectColor=function(f){let d=0;for(let h=0;h<f.length;h++)d=(d<<5)-d+f.charCodeAt(h),d|=0;return l.colors[r(d)%l.colors.length]},l.enable(l.load()),l}},{ms:11}],6:[function(i,o){function a(l,u){for(const c in u)Object.defineProperty(l,c,{value:u[c],enumerable:!0,configurable:!0});return l}o.exports=function(l,u,c){if(!l||typeof l=="string")throw new TypeError("Please pass an Error to err-code");c||(c={}),typeof u=="object"&&(c=u,u=""),u&&(c.code=u);try{return a(l,c)}catch{c.message=l.message,c.stack=l.stack;const d=function(){};return d.prototype=Object.create(Object.getPrototypeOf(l)),a(new d,c)}}},{}],7:[function(i,o){function a(D){console&&console.warn&&console.warn(D)}function l(){l.init.call(this)}function u(D){if(typeof D!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof D)}function c(D){return D._maxListeners===void 0?l.defaultMaxListeners:D._maxListeners}function f(D,R,L,F){var G,B,H;if(u(L),B=D._events,B===void 0?(B=D._events=Object.create(null),D._eventsCount=0):(B.newListener!==void 0&&(D.emit("newListener",R,L.listener?L.listener:L),B=D._events),H=B[R]),H===void 0)H=B[R]=L,++D._eventsCount;else if(typeof H=="function"?H=B[R]=F?[L,H]:[H,L]:F?H.unshift(L):H.push(L),G=c(D),0<G&&H.length>G&&!H.warned){H.warned=!0;var Q=new Error("Possible EventEmitter memory leak detected. "+H.length+" "+(R+" listeners added. Use emitter.setMaxListeners() to increase limit"));Q.name="MaxListenersExceededWarning",Q.emitter=D,Q.type=R,Q.count=H.length,a(Q)}return D}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(D,R,L){var F={fired:!1,wrapFn:void 0,target:D,type:R,listener:L},G=d.bind(F);return G.listener=L,F.wrapFn=G,G}function p(D,R,L){var F=D._events;if(F===void 0)return[];var G=F[R];return G===void 0?[]:typeof G=="function"?L?[G.listener||G]:[G]:L?v(G):g(G,G.length)}function m(D){var R=this._events;if(R!==void 0){var L=R[D];if(typeof L=="function")return 1;if(L!==void 0)return L.length}return 0}function g(D,R){for(var L=Array(R),F=0;F<R;++F)L[F]=D[F];return L}function y(D,R){for(;R+1<D.length;R++)D[R]=D[R+1];D.pop()}function v(D){for(var R=Array(D.length),L=0;L<R.length;++L)R[L]=D[L].listener||D[L];return R}function w(D,R,L){typeof D.on=="function"&&A(D,"error",R,L)}function A(D,R,L,F){if(typeof D.on=="function")F.once?D.once(R,L):D.on(R,L);else if(typeof D.addEventListener=="function")D.addEventListener(R,function G(B){F.once&&D.removeEventListener(R,G),L(B)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof D)}var x,k=typeof Reflect=="object"?Reflect:null,C=k&&typeof k.apply=="function"?k.apply:function(D,R,L){return Function.prototype.apply.call(D,R,L)};x=k&&typeof k.ownKeys=="function"?k.ownKeys:Object.getOwnPropertySymbols?function(D){return Object.getOwnPropertyNames(D).concat(Object.getOwnPropertySymbols(D))}:function(D){return Object.getOwnPropertyNames(D)};var O=Number.isNaN||function(D){return D!==D};o.exports=l,o.exports.once=function(D,R){return new Promise(function(L,F){function G(H){D.removeListener(R,B),F(H)}function B(){typeof D.removeListener=="function"&&D.removeListener("error",G),L([].slice.call(arguments))}A(D,R,B,{once:!0}),R!=="error"&&w(D,G,{once:!0})})},l.EventEmitter=l,l.prototype._events=void 0,l.prototype._eventsCount=0,l.prototype._maxListeners=void 0;var _=10;Object.defineProperty(l,"defaultMaxListeners",{enumerable:!0,get:function(){return _},set:function(D){if(typeof D!="number"||0>D||O(D))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+D+".");_=D}}),l.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},l.prototype.setMaxListeners=function(D){if(typeof D!="number"||0>D||O(D))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+D+".");return this._maxListeners=D,this},l.prototype.getMaxListeners=function(){return c(this)},l.prototype.emit=function(D){for(var R=[],L=1;L<arguments.length;L++)R.push(arguments[L]);var F=D==="error",G=this._events;if(G!==void 0)F=F&&G.error===void 0;else if(!F)return!1;if(F){var B;if(0<R.length&&(B=R[0]),B instanceof Error)throw B;var H=new Error("Unhandled error."+(B?" ("+B.message+")":""));throw H.context=B,H}var Q=G[D];if(Q===void 0)return!1;if(typeof Q=="function")C(Q,this,R);else for(var te=Q.length,Z=g(Q,te),L=0;L<te;++L)C(Z[L],this,R);return!0},l.prototype.addListener=function(D,R){return f(this,D,R,!1)},l.prototype.on=l.prototype.addListener,l.prototype.prependListener=function(D,R){return f(this,D,R,!0)},l.prototype.once=function(D,R){return u(R),this.on(D,h(this,D,R)),this},l.prototype.prependOnceListener=function(D,R){return u(R),this.prependListener(D,h(this,D,R)),this},l.prototype.removeListener=function(D,R){var L,F,G,B,H;if(u(R),F=this._events,F===void 0)return this;if(L=F[D],L===void 0)return this;if(L===R||L.listener===R)--this._eventsCount==0?this._events=Object.create(null):(delete F[D],F.removeListener&&this.emit("removeListener",D,L.listener||R));else if(typeof L!="function"){for(G=-1,B=L.length-1;0<=B;B--)if(L[B]===R||L[B].listener===R){H=L[B].listener,G=B;break}if(0>G)return this;G===0?L.shift():y(L,G),L.length===1&&(F[D]=L[0]),F.removeListener!==void 0&&this.emit("removeListener",D,H||R)}return this},l.prototype.off=l.prototype.removeListener,l.prototype.removeAllListeners=function(D){var R,L,F;if(L=this._events,L===void 0)return this;if(L.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):L[D]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete L[D]),this;if(arguments.length===0){var G,B=Object.keys(L);for(F=0;F<B.length;++F)G=B[F],G!=="removeListener"&&this.removeAllListeners(G);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(R=L[D],typeof R=="function")this.removeListener(D,R);else if(R!==void 0)for(F=R.length-1;0<=F;F--)this.removeListener(D,R[F]);return this},l.prototype.listeners=function(D){return p(this,D,!0)},l.prototype.rawListeners=function(D){return p(this,D,!1)},l.listenerCount=function(D,R){return typeof D.listenerCount=="function"?D.listenerCount(R):m.call(D,R)},l.prototype.listenerCount=m,l.prototype.eventNames=function(){return 0<this._eventsCount?x(this._events):[]}},{}],8:[function(i,o){o.exports=function(){if(typeof globalThis>"u")return null;var a={RTCPeerConnection:globalThis.RTCPeerConnection||globalThis.mozRTCPeerConnection||globalThis.webkitRTCPeerConnection,RTCSessionDescription:globalThis.RTCSessionDescription||globalThis.mozRTCSessionDescription||globalThis.webkitRTCSessionDescription,RTCIceCandidate:globalThis.RTCIceCandidate||globalThis.mozRTCIceCandidate||globalThis.webkitRTCIceCandidate};return a.RTCPeerConnection?a:null}},{}],9:[function(i,o,a){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */a.read=function(l,u,c,f,d){var h,p,m=8*d-f-1,g=(1<<m)-1,y=g>>1,v=-7,w=c?d-1:0,A=c?-1:1,x=l[u+w];for(w+=A,h=x&(1<<-v)-1,x>>=-v,v+=m;0<v;h=256*h+l[u+w],w+=A,v-=8);for(p=h&(1<<-v)-1,h>>=-v,v+=f;0<v;p=256*p+l[u+w],w+=A,v-=8);if(h===0)h=1-y;else{if(h===g)return p?NaN:(x?-1:1)*(1/0);p+=s(2,f),h-=y}return(x?-1:1)*p*s(2,h-f)},a.write=function(l,u,c,f,d,h){var p,m,g,y=Math.LN2,v=Math.log,w=8*h-d-1,A=(1<<w)-1,x=A>>1,k=d===23?s(2,-24)-s(2,-77):0,C=f?0:h-1,O=f?1:-1,_=0>u||u===0&&0>1/u?1:0;for(u=r(u),isNaN(u)||u===1/0?(m=isNaN(u)?1:0,p=A):(p=n(v(u)/y),1>u*(g=s(2,-p))&&(p--,g*=2),u+=1<=p+x?k/g:k*s(2,1-x),2<=u*g&&(p++,g/=2),p+x>=A?(m=0,p=A):1<=p+x?(m=(u*g-1)*s(2,d),p+=x):(m=u*s(2,x-1)*s(2,d),p=0));8<=d;l[c+C]=255&m,C+=O,m/=256,d-=8);for(p=p<<d|m,w+=d;0<w;l[c+C]=255&p,C+=O,p/=256,w-=8);l[c+C-O]|=128*_}},{}],10:[function(i,o){o.exports=typeof Object.create=="function"?function(a,l){l&&(a.super_=l,a.prototype=Object.create(l.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}))}:function(a,l){if(l){a.super_=l;var u=function(){};u.prototype=l.prototype,a.prototype=new u,a.prototype.constructor=a}}},{}],11:[function(i,o){var a=Math.round;function l(d){if(d+="",!(100<d.length)){var h=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(d);if(h){var p=parseFloat(h[1]),m=(h[2]||"ms").toLowerCase();return m==="years"||m==="year"||m==="yrs"||m==="yr"||m==="y"?315576e5*p:m==="weeks"||m==="week"||m==="w"?6048e5*p:m==="days"||m==="day"||m==="d"?864e5*p:m==="hours"||m==="hour"||m==="hrs"||m==="hr"||m==="h"?36e5*p:m==="minutes"||m==="minute"||m==="mins"||m==="min"||m==="m"?6e4*p:m==="seconds"||m==="second"||m==="secs"||m==="sec"||m==="s"?1e3*p:m==="milliseconds"||m==="millisecond"||m==="msecs"||m==="msec"||m==="ms"?p:void 0}}}function u(d){var h=r(d);return 864e5<=h?a(d/864e5)+"d":36e5<=h?a(d/36e5)+"h":6e4<=h?a(d/6e4)+"m":1e3<=h?a(d/1e3)+"s":d+"ms"}function c(d){var h=r(d);return 864e5<=h?f(d,h,864e5,"day"):36e5<=h?f(d,h,36e5,"hour"):6e4<=h?f(d,h,6e4,"minute"):1e3<=h?f(d,h,1e3,"second"):d+" ms"}function f(d,h,p,m){return a(d/p)+" "+m+(h>=1.5*p?"s":"")}o.exports=function(d,h){h=h||{};var p=typeof d;if(p=="string"&&0<d.length)return l(d);if(p==="number"&&isFinite(d))return h.long?c(d):u(d);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(d))}},{}],12:[function(i,o){function a(){throw new Error("setTimeout has not been defined")}function l(){throw new Error("clearTimeout has not been defined")}function u(k){if(m===setTimeout)return setTimeout(k,0);if((m===a||!m)&&setTimeout)return m=setTimeout,setTimeout(k,0);try{return m(k,0)}catch{try{return m.call(null,k,0)}catch{return m.call(this,k,0)}}}function c(k){if(g===clearTimeout)return clearTimeout(k);if((g===l||!g)&&clearTimeout)return g=clearTimeout,clearTimeout(k);try{return g(k)}catch{try{return g.call(null,k)}catch{return g.call(this,k)}}}function f(){A&&v&&(A=!1,v.length?w=v.concat(w):x=-1,w.length&&d())}function d(){if(!A){var k=u(f);A=!0;for(var C=w.length;C;){for(v=w,w=[];++x<C;)v&&v[x].run();x=-1,C=w.length}v=null,A=!1,c(k)}}function h(k,C){this.fun=k,this.array=C}function p(){}var m,g,y=o.exports={};(function(){try{m=typeof setTimeout=="function"?setTimeout:a}catch{m=a}try{g=typeof clearTimeout=="function"?clearTimeout:l}catch{g=l}})();var v,w=[],A=!1,x=-1;y.nextTick=function(k){var C=Array(arguments.length-1);if(1<arguments.length)for(var O=1;O<arguments.length;O++)C[O-1]=arguments[O];w.push(new h(k,C)),w.length!==1||A||u(d)},h.prototype.run=function(){this.fun.apply(null,this.array)},y.title="browser",y.browser=!0,y.env={},y.argv=[],y.version="",y.versions={},y.on=p,y.addListener=p,y.once=p,y.off=p,y.removeListener=p,y.removeAllListeners=p,y.emit=p,y.prependListener=p,y.prependOnceListener=p,y.listeners=function(){return[]},y.binding=function(){throw new Error("process.binding is not supported")},y.cwd=function(){return"/"},y.chdir=function(){throw new Error("process.chdir is not supported")},y.umask=function(){return 0}},{}],13:[function(i,o){(function(a){(function(){/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */let l;o.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window>"u"?a:window):u=>(l||(l=Promise.resolve())).then(u).catch(c=>setTimeout(()=>{throw c},0))}).call(this)}).call(this,typeof tr>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:tr)},{}],14:[function(i,o){(function(a,l){(function(){var u=i("safe-buffer").Buffer,c=l.crypto||l.msCrypto;o.exports=c&&c.getRandomValues?function(f,d){if(f>4294967295)throw new RangeError("requested too many random bytes");var h=u.allocUnsafe(f);if(0<f)if(65536<f)for(var p=0;p<f;p+=65536)c.getRandomValues(h.slice(p,p+65536));else c.getRandomValues(h);return typeof d=="function"?a.nextTick(function(){d(null,h)}):h}:function(){throw new Error(`Secure random number generation is not supported by this browser.
476
476
  Use Chrome, Firefox or Internet Explorer 11`)}}).call(this)}).call(this,i("_process"),typeof tr>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:tr)},{_process:12,"safe-buffer":30}],15:[function(i,o){function a(p,m){p.prototype=Object.create(m.prototype),p.prototype.constructor=p,p.__proto__=m}function l(p,m,g){function y(w,A,x){return typeof m=="string"?m:m(w,A,x)}g||(g=Error);var v=function(w){function A(x,k,C){return w.call(this,y(x,k,C))||this}return a(A,w),A}(g);v.prototype.name=g.name,v.prototype.code=p,h[p]=v}function u(p,m){if(Array.isArray(p)){var g=p.length;return p=p.map(function(y){return y+""}),2<g?"one of ".concat(m," ").concat(p.slice(0,g-1).join(", "),", or ")+p[g-1]:g===2?"one of ".concat(m," ").concat(p[0]," or ").concat(p[1]):"of ".concat(m," ").concat(p[0])}return"of ".concat(m," ").concat(p+"")}function c(p,m,g){return p.substr(0,m.length)===m}function f(p,m,g){return(g===void 0||g>p.length)&&(g=p.length),p.substring(g-m.length,g)===m}function d(p,m,g){return typeof g!="number"&&(g=0),!(g+m.length>p.length)&&p.indexOf(m,g)!==-1}var h={};l("ERR_INVALID_OPT_VALUE",function(p,m){return'The value "'+m+'" is invalid for option "'+p+'"'},TypeError),l("ERR_INVALID_ARG_TYPE",function(p,m,g){var y;typeof m=="string"&&c(m,"not ")?(y="must not be",m=m.replace(/^not /,"")):y="must be";var v;if(f(p," argument"))v="The ".concat(p," ").concat(y," ").concat(u(m,"type"));else{var w=d(p,".")?"property":"argument";v='The "'.concat(p,'" ').concat(w," ").concat(y," ").concat(u(m,"type"))}return v+=". Received type ".concat(typeof g),v},TypeError),l("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),l("ERR_METHOD_NOT_IMPLEMENTED",function(p){return"The "+p+" method is not implemented"}),l("ERR_STREAM_PREMATURE_CLOSE","Premature close"),l("ERR_STREAM_DESTROYED",function(p){return"Cannot call "+p+" after a stream was destroyed"}),l("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),l("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),l("ERR_STREAM_WRITE_AFTER_END","write after end"),l("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),l("ERR_UNKNOWN_ENCODING",function(p){return"Unknown encoding: "+p},TypeError),l("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),o.exports.codes=h},{}],16:[function(i,o){(function(a){(function(){function l(y){return this instanceof l?(d.call(this,y),h.call(this,y),this.allowHalfOpen=!0,void(y&&(y.readable===!1&&(this.readable=!1),y.writable===!1&&(this.writable=!1),y.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",u))))):new l(y)}function u(){this._writableState.ended||a.nextTick(c,this)}function c(y){y.end()}var f=Object.keys||function(y){var v=[];for(var w in y)v.push(w);return v};o.exports=l;var d=i("./_stream_readable"),h=i("./_stream_writable");i("inherits")(l,d);for(var p,m=f(h.prototype),g=0;g<m.length;g++)p=m[g],l.prototype[p]||(l.prototype[p]=h.prototype[p]);Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(l.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(l.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(l.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._writableState!==void 0&&this._readableState.destroyed&&this._writableState.destroyed},set:function(y){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=y,this._writableState.destroyed=y)}})}).call(this)}).call(this,i("_process"))},{"./_stream_readable":18,"./_stream_writable":20,_process:12,inherits:10}],17:[function(i,o){function a(u){return this instanceof a?void l.call(this,u):new a(u)}o.exports=a;var l=i("./_stream_transform");i("inherits")(a,l),a.prototype._transform=function(u,c,f){f(null,u)}},{"./_stream_transform":19,inherits:10}],18:[function(i,o){(function(a,l){(function(){function u(P){return Re.from(P)}function c(P){return Re.isBuffer(P)||P instanceof Ce}function f(P,b,E){return typeof P.prependListener=="function"?P.prependListener(b,E):void(P._events&&P._events[b]?Array.isArray(P._events[b])?P._events[b].unshift(E):P._events[b]=[E,P._events[b]]:P.on(b,E))}function d(P,b,E){te=te||i("./_stream_duplex"),P=P||{},typeof E!="boolean"&&(E=b instanceof te),this.objectMode=!!P.objectMode,E&&(this.objectMode=this.objectMode||!!P.readableObjectMode),this.highWaterMark=$e(this,P,"readableHighWaterMark",E),this.buffer=new Le,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=P.emitClose!==!1,this.autoDestroy=!!P.autoDestroy,this.destroyed=!1,this.defaultEncoding=P.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,P.encoding&&(!He&&(He=i("string_decoder/").StringDecoder),this.decoder=new He(P.encoding),this.encoding=P.encoding)}function h(P){if(te=te||i("./_stream_duplex"),!(this instanceof h))return new h(P);var b=this instanceof te;this._readableState=new d(P,this,b),this.readable=!0,P&&(typeof P.read=="function"&&(this._read=P.read),typeof P.destroy=="function"&&(this._destroy=P.destroy)),Ee.call(this)}function p(P,b,E,M,j){Z("readableAddChunk",b);var K=P._readableState;if(b===null)K.reading=!1,w(P,K);else{var Y;if(j||(Y=g(K,b)),Y)re(P,Y);else if(!(K.objectMode||b&&0<b.length))M||(K.reading=!1,k(P,K));else if(typeof b=="string"||K.objectMode||Object.getPrototypeOf(b)===Re.prototype||(b=u(b)),M)K.endEmitted?re(P,new q):m(P,K,b,!0);else if(K.ended)re(P,new Be);else{if(K.destroyed)return!1;K.reading=!1,K.decoder&&!E?(b=K.decoder.write(b),K.objectMode||b.length!==0?m(P,K,b,!1):k(P,K)):m(P,K,b,!1)}}return!K.ended&&(K.length<K.highWaterMark||K.length===0)}function m(P,b,E,M){b.flowing&&b.length===0&&!b.sync?(b.awaitDrain=0,P.emit("data",E)):(b.length+=b.objectMode?1:E.length,M?b.buffer.unshift(E):b.buffer.push(E),b.needReadable&&A(P)),k(P,b)}function g(P,b){var E;return c(b)||typeof b=="string"||b===void 0||P.objectMode||(E=new be("chunk",["string","Buffer","Uint8Array"],b)),E}function y(P){return 1073741824<=P?P=1073741824:(P--,P|=P>>>1,P|=P>>>2,P|=P>>>4,P|=P>>>8,P|=P>>>16,P++),P}function v(P,b){return 0>=P||b.length===0&&b.ended?0:b.objectMode?1:P===P?(P>b.highWaterMark&&(b.highWaterMark=y(P)),P<=b.length?P:b.ended?b.length:(b.needReadable=!0,0)):b.flowing&&b.length?b.buffer.head.data.length:b.length}function w(P,b){if(Z("onEofChunk"),!b.ended){if(b.decoder){var E=b.decoder.end();E&&E.length&&(b.buffer.push(E),b.length+=b.objectMode?1:E.length)}b.ended=!0,b.sync?A(P):(b.needReadable=!1,!b.emittedReadable&&(b.emittedReadable=!0,x(P)))}}function A(P){var b=P._readableState;Z("emitReadable",b.needReadable,b.emittedReadable),b.needReadable=!1,b.emittedReadable||(Z("emitReadable",b.flowing),b.emittedReadable=!0,a.nextTick(x,P))}function x(P){var b=P._readableState;Z("emitReadable_",b.destroyed,b.length,b.ended),!b.destroyed&&(b.length||b.ended)&&(P.emit("readable"),b.emittedReadable=!1),b.needReadable=!b.flowing&&!b.ended&&b.length<=b.highWaterMark,F(P)}function k(P,b){b.readingMore||(b.readingMore=!0,a.nextTick(C,P,b))}function C(P,b){for(;!b.reading&&!b.ended&&(b.length<b.highWaterMark||b.flowing&&b.length===0);){var E=b.length;if(Z("maybeReadMore read 0"),P.read(0),E===b.length)break}b.readingMore=!1}function O(P){return function(){var b=P._readableState;Z("pipeOnDrain",b.awaitDrain),b.awaitDrain&&b.awaitDrain--,b.awaitDrain===0&&pe(P,"data")&&(b.flowing=!0,F(P))}}function _(P){var b=P._readableState;b.readableListening=0<P.listenerCount("readable"),b.resumeScheduled&&!b.paused?b.flowing=!0:0<P.listenerCount("data")&&P.resume()}function D(P){Z("readable nexttick read 0"),P.read(0)}function R(P,b){b.resumeScheduled||(b.resumeScheduled=!0,a.nextTick(L,P,b))}function L(P,b){Z("resume",b.reading),b.reading||P.read(0),b.resumeScheduled=!1,P.emit("resume"),F(P),b.flowing&&!b.reading&&P.read(0)}function F(P){var b=P._readableState;for(Z("flow",b.flowing);b.flowing&&P.read()!==null;);}function G(P,b){if(b.length===0)return null;var E;return b.objectMode?E=b.buffer.shift():!P||P>=b.length?(E=b.decoder?b.buffer.join(""):b.buffer.length===1?b.buffer.first():b.buffer.concat(b.length),b.buffer.clear()):E=b.buffer.consume(P,b.decoder),E}function B(P){var b=P._readableState;Z("endReadable",b.endEmitted),b.endEmitted||(b.ended=!0,a.nextTick(H,b,P))}function H(P,b){if(Z("endReadableNT",P.endEmitted,P.length),!P.endEmitted&&P.length===0&&(P.endEmitted=!0,b.readable=!1,b.emit("end"),P.autoDestroy)){var E=b._writableState;(!E||E.autoDestroy&&E.finished)&&b.destroy()}}function Q(P,b){for(var E=0,M=P.length;E<M;E++)if(P[E]===b)return E;return-1}o.exports=h;var te;h.ReadableState=d;var Z;i("events").EventEmitter;var pe=function(P,b){return P.listeners(b).length},Ee=i("./internal/streams/stream"),Re=i("buffer").Buffer,Ce=l.Uint8Array||function(){},ke=i("util");Z=ke&&ke.debuglog?ke.debuglog("stream"):function(){};var He,Ue,ze,Le=i("./internal/streams/buffer_list"),tt=i("./internal/streams/destroy"),le=i("./internal/streams/state"),$e=le.getHighWaterMark,ae=i("../errors").codes,be=ae.ERR_INVALID_ARG_TYPE,Be=ae.ERR_STREAM_PUSH_AFTER_EOF,z=ae.ERR_METHOD_NOT_IMPLEMENTED,q=ae.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;i("inherits")(h,Ee);var re=tt.errorOrDestroy,ue=["error","close","destroy","pause","resume"];Object.defineProperty(h.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._readableState.destroyed},set:function(P){this._readableState&&(this._readableState.destroyed=P)}}),h.prototype.destroy=tt.destroy,h.prototype._undestroy=tt.undestroy,h.prototype._destroy=function(P,b){b(P)},h.prototype.push=function(P,b){var E,M=this._readableState;return M.objectMode?E=!0:typeof P=="string"&&(b=b||M.defaultEncoding,b!==M.encoding&&(P=Re.from(P,b),b=""),E=!0),p(this,P,b,!1,E)},h.prototype.unshift=function(P){return p(this,P,null,!0,!1)},h.prototype.isPaused=function(){return this._readableState.flowing===!1},h.prototype.setEncoding=function(P){He||(He=i("string_decoder/").StringDecoder);var b=new He(P);this._readableState.decoder=b,this._readableState.encoding=this._readableState.decoder.encoding;for(var E=this._readableState.buffer.head,M="";E!==null;)M+=b.write(E.data),E=E.next;return this._readableState.buffer.clear(),M!==""&&this._readableState.buffer.push(M),this._readableState.length=M.length,this},h.prototype.read=function(P){Z("read",P),P=parseInt(P,10);var b=this._readableState,E=P;if(P!==0&&(b.emittedReadable=!1),P===0&&b.needReadable&&((b.highWaterMark===0?0<b.length:b.length>=b.highWaterMark)||b.ended))return Z("read: emitReadable",b.length,b.ended),b.length===0&&b.ended?B(this):A(this),null;if(P=v(P,b),P===0&&b.ended)return b.length===0&&B(this),null;var M=b.needReadable;Z("need readable",M),(b.length===0||b.length-P<b.highWaterMark)&&(M=!0,Z("length less than watermark",M)),b.ended||b.reading?(M=!1,Z("reading or ended",M)):M&&(Z("do read"),b.reading=!0,b.sync=!0,b.length===0&&(b.needReadable=!0),this._read(b.highWaterMark),b.sync=!1,!b.reading&&(P=v(E,b)));var j;return j=0<P?G(P,b):null,j===null?(b.needReadable=b.length<=b.highWaterMark,P=0):(b.length-=P,b.awaitDrain=0),b.length===0&&(!b.ended&&(b.needReadable=!0),E!==P&&b.ended&&B(this)),j!==null&&this.emit("data",j),j},h.prototype._read=function(){re(this,new z("_read()"))},h.prototype.pipe=function(P,b){function E(ne,ie){Z("onunpipe"),ne===Ve&&ie&&ie.hasUnpiped===!1&&(ie.hasUnpiped=!0,j())}function M(){Z("onend"),P.end()}function j(){Z("cleanup"),P.removeListener("close",ye),P.removeListener("finish",Se),P.removeListener("drain",br),P.removeListener("error",Y),P.removeListener("unpipe",E),Ve.removeListener("end",M),Ve.removeListener("end",Je),Ve.removeListener("data",K),X=!0,Fe.awaitDrain&&(!P._writableState||P._writableState.needDrain)&&br()}function K(ne){Z("ondata");var ie=P.write(ne);Z("dest.write",ie),ie===!1&&((Fe.pipesCount===1&&Fe.pipes===P||1<Fe.pipesCount&&Q(Fe.pipes,P)!==-1)&&!X&&(Z("false write response, pause",Fe.awaitDrain),Fe.awaitDrain++),Ve.pause())}function Y(ne){Z("onerror",ne),Je(),P.removeListener("error",Y),pe(P,"error")===0&&re(P,ne)}function ye(){P.removeListener("finish",Se),Je()}function Se(){Z("onfinish"),P.removeListener("close",ye),Je()}function Je(){Z("unpipe"),Ve.unpipe(P)}var Ve=this,Fe=this._readableState;switch(Fe.pipesCount){case 0:Fe.pipes=P;break;case 1:Fe.pipes=[Fe.pipes,P];break;default:Fe.pipes.push(P)}Fe.pipesCount+=1,Z("pipe count=%d opts=%j",Fe.pipesCount,b);var ft=(!b||b.end!==!1)&&P!==a.stdout&&P!==a.stderr,Xn=ft?M:Je;Fe.endEmitted?a.nextTick(Xn):Ve.once("end",Xn),P.on("unpipe",E);var br=O(Ve);P.on("drain",br);var X=!1;return Ve.on("data",K),f(P,"error",Y),P.once("close",ye),P.once("finish",Se),P.emit("pipe",Ve),Fe.flowing||(Z("pipe resume"),Ve.resume()),P},h.prototype.unpipe=function(P){var b=this._readableState,E={hasUnpiped:!1};if(b.pipesCount===0)return this;if(b.pipesCount===1)return P&&P!==b.pipes?this:(P||(P=b.pipes),b.pipes=null,b.pipesCount=0,b.flowing=!1,P&&P.emit("unpipe",this,E),this);if(!P){var M=b.pipes,j=b.pipesCount;b.pipes=null,b.pipesCount=0,b.flowing=!1;for(var K=0;K<j;K++)M[K].emit("unpipe",this,{hasUnpiped:!1});return this}var Y=Q(b.pipes,P);return Y===-1?this:(b.pipes.splice(Y,1),b.pipesCount-=1,b.pipesCount===1&&(b.pipes=b.pipes[0]),P.emit("unpipe",this,E),this)},h.prototype.on=function(P,b){var E=Ee.prototype.on.call(this,P,b),M=this._readableState;return P==="data"?(M.readableListening=0<this.listenerCount("readable"),M.flowing!==!1&&this.resume()):P=="readable"&&!M.endEmitted&&!M.readableListening&&(M.readableListening=M.needReadable=!0,M.flowing=!1,M.emittedReadable=!1,Z("on readable",M.length,M.reading),M.length?A(this):!M.reading&&a.nextTick(D,this)),E},h.prototype.addListener=h.prototype.on,h.prototype.removeListener=function(P,b){var E=Ee.prototype.removeListener.call(this,P,b);return P==="readable"&&a.nextTick(_,this),E},h.prototype.removeAllListeners=function(P){var b=Ee.prototype.removeAllListeners.apply(this,arguments);return(P==="readable"||P===void 0)&&a.nextTick(_,this),b},h.prototype.resume=function(){var P=this._readableState;return P.flowing||(Z("resume"),P.flowing=!P.readableListening,R(this,P)),P.paused=!1,this},h.prototype.pause=function(){return Z("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Z("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},h.prototype.wrap=function(P){var b=this,E=this._readableState,M=!1;for(var j in P.on("end",function(){if(Z("wrapped end"),E.decoder&&!E.ended){var Y=E.decoder.end();Y&&Y.length&&b.push(Y)}b.push(null)}),P.on("data",function(Y){if(Z("wrapped data"),E.decoder&&(Y=E.decoder.write(Y)),!(E.objectMode&&Y==null)&&(E.objectMode||Y&&Y.length)){var ye=b.push(Y);ye||(M=!0,P.pause())}}),P)this[j]===void 0&&typeof P[j]=="function"&&(this[j]=function(Y){return function(){return P[Y].apply(P,arguments)}}(j));for(var K=0;K<ue.length;K++)P.on(ue[K],this.emit.bind(this,ue[K]));return this._read=function(Y){Z("wrapped _read",Y),M&&(M=!1,P.resume())},this},typeof Symbol=="function"&&(h.prototype[Symbol.asyncIterator]=function(){return Ue===void 0&&(Ue=i("./internal/streams/async_iterator")),Ue(this)}),Object.defineProperty(h.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(h.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(h.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(P){this._readableState&&(this._readableState.flowing=P)}}),h._fromList=G,Object.defineProperty(h.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),typeof Symbol=="function"&&(h.from=function(P,b){return ze===void 0&&(ze=i("./internal/streams/from")),ze(h,P,b)})}).call(this)}).call(this,i("_process"),typeof tr>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:tr)},{"../errors":15,"./_stream_duplex":16,"./internal/streams/async_iterator":21,"./internal/streams/buffer_list":22,"./internal/streams/destroy":23,"./internal/streams/from":25,"./internal/streams/state":27,"./internal/streams/stream":28,_process:12,buffer:3,events:7,inherits:10,"string_decoder/":31,util:2}],19:[function(i,o){function a(y,v){var w=this._transformState;w.transforming=!1;var A=w.writecb;if(A===null)return this.emit("error",new h);w.writechunk=null,w.writecb=null,v!=null&&this.push(v),A(y);var x=this._readableState;x.reading=!1,(x.needReadable||x.length<x.highWaterMark)&&this._read(x.highWaterMark)}function l(y){return this instanceof l?(g.call(this,y),this._transformState={afterTransform:a.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,y&&(typeof y.transform=="function"&&(this._transform=y.transform),typeof y.flush=="function"&&(this._flush=y.flush)),void this.on("prefinish",u)):new l(y)}function u(){var y=this;typeof this._flush!="function"||this._readableState.destroyed?c(this,null,null):this._flush(function(v,w){c(y,v,w)})}function c(y,v,w){if(v)return y.emit("error",v);if(w!=null&&y.push(w),y._writableState.length)throw new m;if(y._transformState.transforming)throw new p;return y.push(null)}o.exports=l;var f=i("../errors").codes,d=f.ERR_METHOD_NOT_IMPLEMENTED,h=f.ERR_MULTIPLE_CALLBACK,p=f.ERR_TRANSFORM_ALREADY_TRANSFORMING,m=f.ERR_TRANSFORM_WITH_LENGTH_0,g=i("./_stream_duplex");i("inherits")(l,g),l.prototype.push=function(y,v){return this._transformState.needTransform=!1,g.prototype.push.call(this,y,v)},l.prototype._transform=function(y,v,w){w(new d("_transform()"))},l.prototype._write=function(y,v,w){var A=this._transformState;if(A.writecb=w,A.writechunk=y,A.writeencoding=v,!A.transforming){var x=this._readableState;(A.needTransform||x.needReadable||x.length<x.highWaterMark)&&this._read(x.highWaterMark)}},l.prototype._read=function(){var y=this._transformState;y.writechunk===null||y.transforming?y.needTransform=!0:(y.transforming=!0,this._transform(y.writechunk,y.writeencoding,y.afterTransform))},l.prototype._destroy=function(y,v){g.prototype._destroy.call(this,y,function(w){v(w)})}},{"../errors":15,"./_stream_duplex":16,inherits:10}],20:[function(i,o){(function(a,l){(function(){function u(z){var q=this;this.next=null,this.entry=null,this.finish=function(){B(q,z)}}function c(z){return Z.from(z)}function f(z){return Z.isBuffer(z)||z instanceof pe}function d(){}function h(z,q,re){H=H||i("./_stream_duplex"),z=z||{},typeof re!="boolean"&&(re=q instanceof H),this.objectMode=!!z.objectMode,re&&(this.objectMode=this.objectMode||!!z.writableObjectMode),this.highWaterMark=Ce(this,z,"writableHighWaterMark",re),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var ue=z.decodeStrings===!1;this.decodeStrings=!ue,this.defaultEncoding=z.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(P){k(q,P)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=z.emitClose!==!1,this.autoDestroy=!!z.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new u(this)}function p(z){H=H||i("./_stream_duplex");var q=this instanceof H;return q||Be.call(p,this)?(this._writableState=new h(z,this,q),this.writable=!0,z&&(typeof z.write=="function"&&(this._write=z.write),typeof z.writev=="function"&&(this._writev=z.writev),typeof z.destroy=="function"&&(this._destroy=z.destroy),typeof z.final=="function"&&(this._final=z.final)),void te.call(this)):new p(z)}function m(z,q){var re=new $e;be(z,re),a.nextTick(q,re)}function g(z,q,re,ue){var P;return re===null?P=new le:typeof re!="string"&&!q.objectMode&&(P=new He("chunk",["string","Buffer"],re)),!P||(be(z,P),a.nextTick(ue,P),!1)}function y(z,q,re){return z.objectMode||z.decodeStrings===!1||typeof q!="string"||(q=Z.from(q,re)),q}function v(z,q,re,ue,P,b){if(!re){var E=y(q,ue,P);ue!==E&&(re=!0,P="buffer",ue=E)}var M=q.objectMode?1:ue.length;q.length+=M;var j=q.length<q.highWaterMark;if(j||(q.needDrain=!0),q.writing||q.corked){var K=q.lastBufferedRequest;q.lastBufferedRequest={chunk:ue,encoding:P,isBuf:re,callback:b,next:null},K?K.next=q.lastBufferedRequest:q.bufferedRequest=q.lastBufferedRequest,q.bufferedRequestCount+=1}else w(z,q,!1,M,ue,P,b);return j}function w(z,q,re,ue,P,b,E){q.writelen=ue,q.writecb=E,q.writing=!0,q.sync=!0,q.destroyed?q.onwrite(new tt("write")):re?z._writev(P,q.onwrite):z._write(P,b,q.onwrite),q.sync=!1}function A(z,q,re,ue,P){--q.pendingcb,re?(a.nextTick(P,ue),a.nextTick(F,z,q),z._writableState.errorEmitted=!0,be(z,ue)):(P(ue),z._writableState.errorEmitted=!0,be(z,ue),F(z,q))}function x(z){z.writing=!1,z.writecb=null,z.length-=z.writelen,z.writelen=0}function k(z,q){var re=z._writableState,ue=re.sync,P=re.writecb;if(typeof P!="function")throw new ze;if(x(re),q)A(z,re,ue,q,P);else{var b=D(re)||z.destroyed;b||re.corked||re.bufferProcessing||!re.bufferedRequest||_(z,re),ue?a.nextTick(C,z,re,b,P):C(z,re,b,P)}}function C(z,q,re,ue){re||O(z,q),q.pendingcb--,ue(),F(z,q)}function O(z,q){q.length===0&&q.needDrain&&(q.needDrain=!1,z.emit("drain"))}function _(z,q){q.bufferProcessing=!0;var re=q.bufferedRequest;if(z._writev&&re&&re.next){var ue=q.bufferedRequestCount,P=Array(ue),b=q.corkedRequestsFree;b.entry=re;for(var E=0,M=!0;re;)P[E]=re,re.isBuf||(M=!1),re=re.next,E+=1;P.allBuffers=M,w(z,q,!0,q.length,P,"",b.finish),q.pendingcb++,q.lastBufferedRequest=null,b.next?(q.corkedRequestsFree=b.next,b.next=null):q.corkedRequestsFree=new u(q),q.bufferedRequestCount=0}else{for(;re;){var j=re.chunk,K=re.encoding,Y=re.callback,ye=q.objectMode?1:j.length;if(w(z,q,!1,ye,j,K,Y),re=re.next,q.bufferedRequestCount--,q.writing)break}re===null&&(q.lastBufferedRequest=null)}q.bufferedRequest=re,q.bufferProcessing=!1}function D(z){return z.ending&&z.length===0&&z.bufferedRequest===null&&!z.finished&&!z.writing}function R(z,q){z._final(function(re){q.pendingcb--,re&&be(z,re),q.prefinished=!0,z.emit("prefinish"),F(z,q)})}function L(z,q){q.prefinished||q.finalCalled||(typeof z._final!="function"||q.destroyed?(q.prefinished=!0,z.emit("prefinish")):(q.pendingcb++,q.finalCalled=!0,a.nextTick(R,z,q)))}function F(z,q){var re=D(q);if(re&&(L(z,q),q.pendingcb===0&&(q.finished=!0,z.emit("finish"),q.autoDestroy))){var ue=z._readableState;(!ue||ue.autoDestroy&&ue.endEmitted)&&z.destroy()}return re}function G(z,q,re){q.ending=!0,F(z,q),re&&(q.finished?a.nextTick(re):z.once("finish",re)),q.ended=!0,z.writable=!1}function B(z,q,re){var ue=z.entry;for(z.entry=null;ue;){var P=ue.callback;q.pendingcb--,P(re),ue=ue.next}q.corkedRequestsFree.next=z}o.exports=p;var H;p.WritableState=h;var Q={deprecate:i("util-deprecate")},te=i("./internal/streams/stream"),Z=i("buffer").Buffer,pe=l.Uint8Array||function(){},Ee=i("./internal/streams/destroy"),Re=i("./internal/streams/state"),Ce=Re.getHighWaterMark,ke=i("../errors").codes,He=ke.ERR_INVALID_ARG_TYPE,Ue=ke.ERR_METHOD_NOT_IMPLEMENTED,ze=ke.ERR_MULTIPLE_CALLBACK,Le=ke.ERR_STREAM_CANNOT_PIPE,tt=ke.ERR_STREAM_DESTROYED,le=ke.ERR_STREAM_NULL_VALUES,$e=ke.ERR_STREAM_WRITE_AFTER_END,ae=ke.ERR_UNKNOWN_ENCODING,be=Ee.errorOrDestroy;i("inherits")(p,te),h.prototype.getBuffer=function(){for(var z=this.bufferedRequest,q=[];z;)q.push(z),z=z.next;return q},function(){try{Object.defineProperty(h.prototype,"buffer",{get:Q.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var Be;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Be=Function.prototype[Symbol.hasInstance],Object.defineProperty(p,Symbol.hasInstance,{value:function(z){return!!Be.call(this,z)||this===p&&z&&z._writableState instanceof h}})):Be=function(z){return z instanceof this},p.prototype.pipe=function(){be(this,new Le)},p.prototype.write=function(z,q,re){var ue=this._writableState,P=!1,b=!ue.objectMode&&f(z);return b&&!Z.isBuffer(z)&&(z=c(z)),typeof q=="function"&&(re=q,q=null),b?q="buffer":!q&&(q=ue.defaultEncoding),typeof re!="function"&&(re=d),ue.ending?m(this,re):(b||g(this,ue,z,re))&&(ue.pendingcb++,P=v(this,ue,b,z,q,re)),P},p.prototype.cork=function(){this._writableState.corked++},p.prototype.uncork=function(){var z=this._writableState;z.corked&&(z.corked--,!z.writing&&!z.corked&&!z.bufferProcessing&&z.bufferedRequest&&_(this,z))},p.prototype.setDefaultEncoding=function(z){if(typeof z=="string"&&(z=z.toLowerCase()),!(-1<["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((z+"").toLowerCase())))throw new ae(z);return this._writableState.defaultEncoding=z,this},Object.defineProperty(p.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(p.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),p.prototype._write=function(z,q,re){re(new Ue("_write()"))},p.prototype._writev=null,p.prototype.end=function(z,q,re){var ue=this._writableState;return typeof z=="function"?(re=z,z=null,q=null):typeof q=="function"&&(re=q,q=null),z!=null&&this.write(z,q),ue.corked&&(ue.corked=1,this.uncork()),ue.ending||G(this,ue,re),this},Object.defineProperty(p.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(p.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function(z){this._writableState&&(this._writableState.destroyed=z)}}),p.prototype.destroy=Ee.destroy,p.prototype._undestroy=Ee.undestroy,p.prototype._destroy=function(z,q){q(z)}}).call(this)}).call(this,i("_process"),typeof tr>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:tr)},{"../errors":15,"./_stream_duplex":16,"./internal/streams/destroy":23,"./internal/streams/state":27,"./internal/streams/stream":28,_process:12,buffer:3,inherits:10,"util-deprecate":32}],21:[function(i,o){(function(a){(function(){function l(O,_,D){return _ in O?Object.defineProperty(O,_,{value:D,enumerable:!0,configurable:!0,writable:!0}):O[_]=D,O}function u(O,_){return{value:O,done:_}}function c(O){var _=O[m];if(_!==null){var D=O[x].read();D!==null&&(O[w]=null,O[m]=null,O[g]=null,_(u(D,!1)))}}function f(O){a.nextTick(c,O)}function d(O,_){return function(D,R){O.then(function(){return _[v]?void D(u(void 0,!0)):void _[A](D,R)},R)}}var h,p=i("./end-of-stream"),m=Symbol("lastResolve"),g=Symbol("lastReject"),y=Symbol("error"),v=Symbol("ended"),w=Symbol("lastPromise"),A=Symbol("handlePromise"),x=Symbol("stream"),k=Object.getPrototypeOf(function(){}),C=Object.setPrototypeOf((h={get stream(){return this[x]},next:function(){var O=this,_=this[y];if(_!==null)return Promise.reject(_);if(this[v])return Promise.resolve(u(void 0,!0));if(this[x].destroyed)return new Promise(function(F,G){a.nextTick(function(){O[y]?G(O[y]):F(u(void 0,!0))})});var D,R=this[w];if(R)D=new Promise(d(R,this));else{var L=this[x].read();if(L!==null)return Promise.resolve(u(L,!1));D=new Promise(this[A])}return this[w]=D,D}},l(h,Symbol.asyncIterator,function(){return this}),l(h,"return",function(){var O=this;return new Promise(function(_,D){O[x].destroy(null,function(R){return R?void D(R):void _(u(void 0,!0))})})}),h),k);o.exports=function(O){var _,D=Object.create(C,(_={},l(_,x,{value:O,writable:!0}),l(_,m,{value:null,writable:!0}),l(_,g,{value:null,writable:!0}),l(_,y,{value:null,writable:!0}),l(_,v,{value:O._readableState.endEmitted,writable:!0}),l(_,A,{value:function(R,L){var F=D[x].read();F?(D[w]=null,D[m]=null,D[g]=null,R(u(F,!1))):(D[m]=R,D[g]=L)},writable:!0}),_));return D[w]=null,p(O,function(R){if(R&&R.code!=="ERR_STREAM_PREMATURE_CLOSE"){var L=D[g];return L!==null&&(D[w]=null,D[m]=null,D[g]=null,L(R)),void(D[y]=R)}var F=D[m];F!==null&&(D[w]=null,D[m]=null,D[g]=null,F(u(void 0,!0))),D[v]=!0}),O.on("readable",f.bind(null,D)),D}}).call(this)}).call(this,i("_process"))},{"./end-of-stream":24,_process:12}],22:[function(i,o){function a(w,A){var x=Object.keys(w);if(Object.getOwnPropertySymbols){var k=Object.getOwnPropertySymbols(w);A&&(k=k.filter(function(C){return Object.getOwnPropertyDescriptor(w,C).enumerable})),x.push.apply(x,k)}return x}function l(w){for(var A,x=1;x<arguments.length;x++)A=arguments[x]==null?{}:arguments[x],x%2?a(Object(A),!0).forEach(function(k){u(w,k,A[k])}):Object.getOwnPropertyDescriptors?Object.defineProperties(w,Object.getOwnPropertyDescriptors(A)):a(Object(A)).forEach(function(k){Object.defineProperty(w,k,Object.getOwnPropertyDescriptor(A,k))});return w}function u(w,A,x){return A in w?Object.defineProperty(w,A,{value:x,enumerable:!0,configurable:!0,writable:!0}):w[A]=x,w}function c(w,A){if(!(w instanceof A))throw new TypeError("Cannot call a class as a function")}function f(w,A){for(var x,k=0;k<A.length;k++)x=A[k],x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(w,x.key,x)}function d(w,A,x){return A&&f(w.prototype,A),w}function h(w,A,x){m.prototype.copy.call(w,A,x)}var p=i("buffer"),m=p.Buffer,g=i("util"),y=g.inspect,v=y&&y.custom||"inspect";o.exports=function(){function w(){c(this,w),this.head=null,this.tail=null,this.length=0}return d(w,[{key:"push",value:function(A){var x={data:A,next:null};0<this.length?this.tail.next=x:this.head=x,this.tail=x,++this.length}},{key:"unshift",value:function(A){var x={data:A,next:this.head};this.length===0&&(this.tail=x),this.head=x,++this.length}},{key:"shift",value:function(){if(this.length!==0){var A=this.head.data;return this.head=this.length===1?this.tail=null:this.head.next,--this.length,A}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(A){if(this.length===0)return"";for(var x=this.head,k=""+x.data;x=x.next;)k+=A+x.data;return k}},{key:"concat",value:function(A){if(this.length===0)return m.alloc(0);for(var x=m.allocUnsafe(A>>>0),k=this.head,C=0;k;)h(k.data,x,C),C+=k.data.length,k=k.next;return x}},{key:"consume",value:function(A,x){var k;return A<this.head.data.length?(k=this.head.data.slice(0,A),this.head.data=this.head.data.slice(A)):A===this.head.data.length?k=this.shift():k=x?this._getString(A):this._getBuffer(A),k}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(A){var x=this.head,k=1,C=x.data;for(A-=C.length;x=x.next;){var O=x.data,_=A>O.length?O.length:A;if(C+=_===O.length?O:O.slice(0,A),A-=_,A===0){_===O.length?(++k,this.head=x.next?x.next:this.tail=null):(this.head=x,x.data=O.slice(_));break}++k}return this.length-=k,C}},{key:"_getBuffer",value:function(A){var x=m.allocUnsafe(A),k=this.head,C=1;for(k.data.copy(x),A-=k.data.length;k=k.next;){var O=k.data,_=A>O.length?O.length:A;if(O.copy(x,x.length-A,0,_),A-=_,A===0){_===O.length?(++C,this.head=k.next?k.next:this.tail=null):(this.head=k,k.data=O.slice(_));break}++C}return this.length-=C,x}},{key:v,value:function(A,x){return y(this,l({},x,{depth:0,customInspect:!1}))}}]),w}()},{buffer:3,util:2}],23:[function(i,o){(function(a){(function(){function l(f,d){c(f,d),u(f)}function u(f){f._writableState&&!f._writableState.emitClose||f._readableState&&!f._readableState.emitClose||f.emit("close")}function c(f,d){f.emit("error",d)}o.exports={destroy:function(f,d){var h=this,p=this._readableState&&this._readableState.destroyed,m=this._writableState&&this._writableState.destroyed;return p||m?(d?d(f):f&&(this._writableState?!this._writableState.errorEmitted&&(this._writableState.errorEmitted=!0,a.nextTick(c,this,f)):a.nextTick(c,this,f)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(f||null,function(g){!d&&g?h._writableState?h._writableState.errorEmitted?a.nextTick(u,h):(h._writableState.errorEmitted=!0,a.nextTick(l,h,g)):a.nextTick(l,h,g):d?(a.nextTick(u,h),d(g)):a.nextTick(u,h)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(f,d){var h=f._readableState,p=f._writableState;h&&h.autoDestroy||p&&p.autoDestroy?f.destroy(d):f.emit("error",d)}}}).call(this)}).call(this,i("_process"))},{_process:12}],24:[function(i,o){function a(d){var h=!1;return function(){if(!h){h=!0;for(var p=arguments.length,m=Array(p),g=0;g<p;g++)m[g]=arguments[g];d.apply(this,m)}}}function l(){}function u(d){return d.setHeader&&typeof d.abort=="function"}function c(d,h,p){if(typeof h=="function")return c(d,null,h);h||(h={}),p=a(p||l);var m=h.readable||h.readable!==!1&&d.readable,g=h.writable||h.writable!==!1&&d.writable,y=function(){d.writable||w()},v=d._writableState&&d._writableState.finished,w=function(){g=!1,v=!0,m||p.call(d)},A=d._readableState&&d._readableState.endEmitted,x=function(){m=!1,A=!0,g||p.call(d)},k=function(_){p.call(d,_)},C=function(){var _;return m&&!A?(d._readableState&&d._readableState.ended||(_=new f),p.call(d,_)):g&&!v?(d._writableState&&d._writableState.ended||(_=new f),p.call(d,_)):void 0},O=function(){d.req.on("finish",w)};return u(d)?(d.on("complete",w),d.on("abort",C),d.req?O():d.on("request",O)):g&&!d._writableState&&(d.on("end",y),d.on("close",y)),d.on("end",x),d.on("finish",w),h.error!==!1&&d.on("error",k),d.on("close",C),function(){d.removeListener("complete",w),d.removeListener("abort",C),d.removeListener("request",O),d.req&&d.req.removeListener("finish",w),d.removeListener("end",y),d.removeListener("close",y),d.removeListener("finish",w),d.removeListener("end",x),d.removeListener("error",k),d.removeListener("close",C)}}var f=i("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;o.exports=c},{"../../../errors":15}],25:[function(i,o){o.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],26:[function(i,o){function a(v){var w=!1;return function(){w||(w=!0,v.apply(void 0,arguments))}}function l(v){if(v)throw v}function u(v){return v.setHeader&&typeof v.abort=="function"}function c(v,w,A,x){x=a(x);var k=!1;v.on("close",function(){k=!0}),p===void 0&&(p=i("./end-of-stream")),p(v,{readable:w,writable:A},function(O){return O?x(O):(k=!0,void x())});var C=!1;return function(O){if(!k)return C?void 0:(C=!0,u(v)?v.abort():typeof v.destroy=="function"?v.destroy():void x(O||new y("pipe")))}}function f(v){v()}function d(v,w){return v.pipe(w)}function h(v){return v.length&&typeof v[v.length-1]=="function"?v.pop():l}var p,m=i("../../../errors").codes,g=m.ERR_MISSING_ARGS,y=m.ERR_STREAM_DESTROYED;o.exports=function(){for(var v=arguments.length,w=Array(v),A=0;A<v;A++)w[A]=arguments[A];var x=h(w);if(Array.isArray(w[0])&&(w=w[0]),2>w.length)throw new g("streams");var k,C=w.map(function(O,_){var D=_<w.length-1;return c(O,D,0<_,function(R){k||(k=R),R&&C.forEach(f),D||(C.forEach(f),x(k))})});return w.reduce(d)}},{"../../../errors":15,"./end-of-stream":24}],27:[function(i,o){function a(u,c,f){return u.highWaterMark==null?c?u[f]:null:u.highWaterMark}var l=i("../../../errors").codes.ERR_INVALID_OPT_VALUE;o.exports={getHighWaterMark:function(u,c,f,d){var h=a(c,d,f);if(h!=null){if(!(isFinite(h)&&n(h)===h)||0>h){var p=d?f:"highWaterMark";throw new l(p,h)}return n(h)}return u.objectMode?16:16384}}},{"../../../errors":15}],28:[function(i,o){o.exports=i("events").EventEmitter},{events:7}],29:[function(i,o,a){a=o.exports=i("./lib/_stream_readable.js"),a.Stream=a,a.Readable=a,a.Writable=i("./lib/_stream_writable.js"),a.Duplex=i("./lib/_stream_duplex.js"),a.Transform=i("./lib/_stream_transform.js"),a.PassThrough=i("./lib/_stream_passthrough.js"),a.finished=i("./lib/internal/streams/end-of-stream.js"),a.pipeline=i("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":16,"./lib/_stream_passthrough.js":17,"./lib/_stream_readable.js":18,"./lib/_stream_transform.js":19,"./lib/_stream_writable.js":20,"./lib/internal/streams/end-of-stream.js":24,"./lib/internal/streams/pipeline.js":26}],30:[function(i,o,a){function l(d,h){for(var p in d)h[p]=d[p]}function u(d,h,p){return f(d,h,p)}/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var c=i("buffer"),f=c.Buffer;f.from&&f.alloc&&f.allocUnsafe&&f.allocUnsafeSlow?o.exports=c:(l(c,a),a.Buffer=u),u.prototype=Object.create(f.prototype),l(f,u),u.from=function(d,h,p){if(typeof d=="number")throw new TypeError("Argument must not be a number");return f(d,h,p)},u.alloc=function(d,h,p){if(typeof d!="number")throw new TypeError("Argument must be a number");var m=f(d);return h===void 0?m.fill(0):typeof p=="string"?m.fill(h,p):m.fill(h),m},u.allocUnsafe=function(d){if(typeof d!="number")throw new TypeError("Argument must be a number");return f(d)},u.allocUnsafeSlow=function(d){if(typeof d!="number")throw new TypeError("Argument must be a number");return c.SlowBuffer(d)}},{buffer:3}],31:[function(i,o,a){function l(C){if(!C)return"utf8";for(var O;;)switch(C){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return C;default:if(O)return;C=(""+C).toLowerCase(),O=!0}}function u(C){var O=l(C);if(typeof O!="string"&&(x.isEncoding===k||!k(C)))throw new Error("Unknown encoding: "+C);return O||C}function c(C){this.encoding=u(C);var O;switch(this.encoding){case"utf16le":this.text=m,this.end=g,O=4;break;case"utf8":this.fillLast=p,O=4;break;case"base64":this.text=y,this.end=v,O=3;break;default:return this.write=w,void(this.end=A)}this.lastNeed=0,this.lastTotal=0,this.lastChar=x.allocUnsafe(O)}function f(C){return 127>=C?0:C>>5==6?2:C>>4==14?3:C>>3==30?4:C>>6==2?-1:-2}function d(C,O,_){var D=O.length-1;if(D<_)return 0;var R=f(O[D]);return 0<=R?(0<R&&(C.lastNeed=R-1),R):--D<_||R===-2?0:(R=f(O[D]),0<=R?(0<R&&(C.lastNeed=R-2),R):--D<_||R===-2?0:(R=f(O[D]),0<=R?(0<R&&(R===2?R=0:C.lastNeed=R-3),R):0))}function h(C,O){if((192&O[0])!=128)return C.lastNeed=0,"�";if(1<C.lastNeed&&1<O.length){if((192&O[1])!=128)return C.lastNeed=1,"�";if(2<C.lastNeed&&2<O.length&&(192&O[2])!=128)return C.lastNeed=2,"�"}}function p(C){var O=this.lastTotal-this.lastNeed,_=h(this,C);return _===void 0?this.lastNeed<=C.length?(C.copy(this.lastChar,O,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(C.copy(this.lastChar,O,0,C.length),void(this.lastNeed-=C.length)):_}function m(C,O){if((C.length-O)%2==0){var _=C.toString("utf16le",O);if(_){var D=_.charCodeAt(_.length-1);if(55296<=D&&56319>=D)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=C[C.length-2],this.lastChar[1]=C[C.length-1],_.slice(0,-1)}return _}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=C[C.length-1],C.toString("utf16le",O,C.length-1)}function g(C){var O=C&&C.length?this.write(C):"";if(this.lastNeed){var _=this.lastTotal-this.lastNeed;return O+this.lastChar.toString("utf16le",0,_)}return O}function y(C,O){var _=(C.length-O)%3;return _==0?C.toString("base64",O):(this.lastNeed=3-_,this.lastTotal=3,_==1?this.lastChar[0]=C[C.length-1]:(this.lastChar[0]=C[C.length-2],this.lastChar[1]=C[C.length-1]),C.toString("base64",O,C.length-_))}function v(C){var O=C&&C.length?this.write(C):"";return this.lastNeed?O+this.lastChar.toString("base64",0,3-this.lastNeed):O}function w(C){return C.toString(this.encoding)}function A(C){return C&&C.length?this.write(C):""}var x=i("safe-buffer").Buffer,k=x.isEncoding||function(C){switch(C=""+C,C&&C.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};a.StringDecoder=c,c.prototype.write=function(C){if(C.length===0)return"";var O,_;if(this.lastNeed){if(O=this.fillLast(C),O===void 0)return"";_=this.lastNeed,this.lastNeed=0}else _=0;return _<C.length?O?O+this.text(C,_):this.text(C,_):O||""},c.prototype.end=function(C){var O=C&&C.length?this.write(C):"";return this.lastNeed?O+"�":O},c.prototype.text=function(C,O){var _=d(this,C,O);if(!this.lastNeed)return C.toString("utf8",O);this.lastTotal=_;var D=C.length-(_-this.lastNeed);return C.copy(this.lastChar,0,D),C.toString("utf8",O,D)},c.prototype.fillLast=function(C){return this.lastNeed<=C.length?(C.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(C.copy(this.lastChar,this.lastTotal-this.lastNeed,0,C.length),void(this.lastNeed-=C.length))}},{"safe-buffer":30}],32:[function(i,o){(function(a){(function(){function l(u){try{if(!a.localStorage)return!1}catch{return!1}var c=a.localStorage[u];return c!=null&&(c+"").toLowerCase()==="true"}o.exports=function(u,c){function f(){if(!d){if(l("throwDeprecation"))throw new Error(c);l("traceDeprecation")?console.trace(c):console.warn(c),d=!0}return u.apply(this,arguments)}if(l("noDeprecation"))return u;var d=!1;return f}}).call(this)}).call(this,typeof tr>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:tr)},{}],"/":[function(i,o){function a(v){return v.replace(/a=ice-options:trickle\s\n/g,"")}function l(v){console.warn(v)}/*! simple-peer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */const u=i("debug")("simple-peer"),c=i("get-browser-rtc"),f=i("randombytes"),d=i("readable-stream"),h=i("queue-microtask"),p=i("err-code"),{Buffer:m}=i("buffer"),g=65536;class y extends d.Duplex{constructor(w){if(w=Object.assign({allowHalfOpen:!1},w),super(w),this._id=f(4).toString("hex").slice(0,7),this._debug("new peer %o",w),this.channelName=w.initiator?w.channelName||f(20).toString("hex"):null,this.initiator=w.initiator||!1,this.channelConfig=w.channelConfig||y.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},y.config,w.config),this.offerOptions=w.offerOptions||{},this.answerOptions=w.answerOptions||{},this.sdpTransform=w.sdpTransform||(A=>A),this.streams=w.streams||(w.stream?[w.stream]:[]),this.trickle=w.trickle===void 0||w.trickle,this.allowHalfTrickle=w.allowHalfTrickle!==void 0&&w.allowHalfTrickle,this.iceCompleteTimeout=w.iceCompleteTimeout||5e3,this.destroyed=!1,this.destroying=!1,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=w.wrtc&&typeof w.wrtc=="object"?w.wrtc:c(),!this._wrtc)throw p(typeof window>"u"?new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"):new Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!1,this._firstNegotiation=!0,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(A){return void this.destroy(p(A,"ERR_PC_CONSTRUCTOR"))}this._isReactNativeWebrtc=typeof this._pc._peerConnectionId=="number",this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=A=>{this._onIceCandidate(A)},typeof this._pc.peerIdentity=="object"&&this._pc.peerIdentity.catch(A=>{this.destroy(p(A,"ERR_PC_PEER_IDENTITY"))}),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=A=>{this._setupData(A)},this.streams&&this.streams.forEach(A=>{this.addStream(A)}),this._pc.ontrack=A=>{this._onTrack(A)},this._debug("initial negotiation"),this._needsNegotiation(),this._onFinishBound=()=>{this._onFinish()},this.once("finish",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&this._channel.readyState==="open"}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(w){if(!this.destroying){if(this.destroyed)throw p(new Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if(typeof w=="string")try{w=JSON.parse(w)}catch{w={}}this._debug("signal()"),w.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),w.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(w.transceiverRequest.kind,w.transceiverRequest.init)),w.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(w.candidate):this._pendingCandidates.push(w.candidate)),w.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(w)).then(()=>{this.destroyed||(this._pendingCandidates.forEach(A=>{this._addIceCandidate(A)}),this._pendingCandidates=[],this._pc.remoteDescription.type==="offer"&&this._createAnswer())}).catch(A=>{this.destroy(p(A,"ERR_SET_REMOTE_DESCRIPTION"))}),w.sdp||w.candidate||w.renegotiate||w.transceiverRequest||this.destroy(p(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(w){const A=new this._wrtc.RTCIceCandidate(w);this._pc.addIceCandidate(A).catch(x=>{!A.address||A.address.endsWith(".local")?l("Ignoring unsupported ICE candidate."):this.destroy(p(x,"ERR_ADD_ICE_CANDIDATE"))})}send(w){if(!this.destroying){if(this.destroyed)throw p(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(w)}}addTransceiver(w,A){if(!this.destroying){if(this.destroyed)throw p(new Error("cannot addTransceiver after peer is destroyed"),"ERR_DESTROYED");if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(w,A),this._needsNegotiation()}catch(x){this.destroy(p(x,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{type:"transceiverRequest",transceiverRequest:{kind:w,init:A}})}}addStream(w){if(!this.destroying){if(this.destroyed)throw p(new Error("cannot addStream after peer is destroyed"),"ERR_DESTROYED");this._debug("addStream()"),w.getTracks().forEach(A=>{this.addTrack(A,w)})}}addTrack(w,A){if(this.destroying)return;if(this.destroyed)throw p(new Error("cannot addTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("addTrack()");const x=this._senderMap.get(w)||new Map;let k=x.get(A);if(!k)k=this._pc.addTrack(w,A),x.set(A,k),this._senderMap.set(w,x),this._needsNegotiation();else throw k.removed?p(new Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):p(new Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED")}replaceTrack(w,A,x){if(this.destroying)return;if(this.destroyed)throw p(new Error("cannot replaceTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("replaceTrack()");const k=this._senderMap.get(w),C=k?k.get(x):null;if(!C)throw p(new Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");A&&this._senderMap.set(A,k),C.replaceTrack==null?this.destroy(p(new Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK")):C.replaceTrack(A)}removeTrack(w,A){if(this.destroying)return;if(this.destroyed)throw p(new Error("cannot removeTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSender()");const x=this._senderMap.get(w),k=x?x.get(A):null;if(!k)throw p(new Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{k.removed=!0,this._pc.removeTrack(k)}catch(C){C.name==="NS_ERROR_UNEXPECTED"?this._sendersAwaitingStable.push(k):this.destroy(p(C,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}removeStream(w){if(!this.destroying){if(this.destroyed)throw p(new Error("cannot removeStream after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSenders()"),w.getTracks().forEach(A=>{this.removeTrack(A,w)})}}_needsNegotiation(){this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,h(()=>{this._batchedNegotiation=!1,this.initiator||!this._firstNegotiation?(this._debug("starting batched negotiation"),this.negotiate()):this._debug("non-initiator initial negotiation request discarded"),this._firstNegotiation=!1}))}negotiate(){if(!this.destroying){if(this.destroyed)throw p(new Error("cannot negotiate after peer is destroyed"),"ERR_DESTROYED");this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout(()=>{this._createOffer()},0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("requesting negotiation from initiator"),this.emit("signal",{type:"renegotiate",renegotiate:!0})),this._isNegotiating=!0}}destroy(w){this._destroy(w,()=>{})}_destroy(w,A){this.destroyed||this.destroying||(this.destroying=!0,this._debug("destroying (error: %s)",w&&(w.message||w)),h(()=>{if(this.destroyed=!0,this.destroying=!1,this._debug("destroy (error: %s)",w&&(w.message||w)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this._connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch{}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch{}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,w&&this.emit("error",w),this.emit("close"),A()}))}_setupData(w){if(!w.channel)return this.destroy(p(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=w.channel,this._channel.binaryType="arraybuffer",typeof this._channel.bufferedAmountLowThreshold=="number"&&(this._channel.bufferedAmountLowThreshold=g),this.channelName=this._channel.label,this._channel.onmessage=x=>{this._onChannelMessage(x)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=x=>{const k=x.error instanceof Error?x.error:new Error(`Datachannel error: ${x.message} ${x.filename}:${x.lineno}:${x.colno}`);this.destroy(p(k,"ERR_DATA_CHANNEL"))};let A=!1;this._closingInterval=setInterval(()=>{this._channel&&this._channel.readyState==="closing"?(A&&this._onChannelClose(),A=!0):A=!1},5e3)}_read(){}_write(w,A,x){if(this.destroyed)return x(p(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(w)}catch(k){return this.destroy(p(k,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>g?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=x):x(null)}else this._debug("write before connect"),this._chunk=w,this._cb=x}_onFinish(){if(!this.destroyed){const w=()=>{setTimeout(()=>this.destroy(),1e3)};this._connected?w():this.once("connect",w)}}_startIceCompleteTimeout(){this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout(()=>{this._iceComplete||(this._iceComplete=!0,this._debug("iceComplete timeout completed"),this.emit("iceTimeout"),this.emit("_iceComplete"))},this.iceCompleteTimeout))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then(w=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(w.sdp=a(w.sdp)),w.sdp=this.sdpTransform(w.sdp);const A=()=>{if(!this.destroyed){const x=this._pc.localDescription||w;this._debug("signal"),this.emit("signal",{type:x.type,sdp:x.sdp})}};this._pc.setLocalDescription(w).then(()=>{this._debug("createOffer success"),this.destroyed||(this.trickle||this._iceComplete?A():this.once("_iceComplete",A))}).catch(x=>{this.destroy(p(x,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(w=>{this.destroy(p(w,"ERR_CREATE_OFFER"))})}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach(w=>{w.mid||!w.sender.track||w.requested||(w.requested=!0,this.addTransceiver(w.sender.track.kind))})}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then(w=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(w.sdp=a(w.sdp)),w.sdp=this.sdpTransform(w.sdp);const A=()=>{if(!this.destroyed){const x=this._pc.localDescription||w;this._debug("signal"),this.emit("signal",{type:x.type,sdp:x.sdp}),this.initiator||this._requestMissingTransceivers()}};this._pc.setLocalDescription(w).then(()=>{this.destroyed||(this.trickle||this._iceComplete?A():this.once("_iceComplete",A))}).catch(x=>{this.destroy(p(x,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(w=>{this.destroy(p(w,"ERR_CREATE_ANSWER"))})}_onConnectionStateChange(){this.destroyed||this._pc.connectionState==="failed"&&this.destroy(p(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(this.destroyed)return;const w=this._pc.iceConnectionState,A=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",w,A),this.emit("iceStateChange",w,A),(w==="connected"||w==="completed")&&(this._pcReady=!0,this._maybeReady()),w==="failed"&&this.destroy(p(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),w==="closed"&&this.destroy(p(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}getStats(w){const A=x=>(Object.prototype.toString.call(x.values)==="[object Array]"&&x.values.forEach(k=>{Object.assign(x,k)}),x);this._pc.getStats.length===0||this._isReactNativeWebrtc?this._pc.getStats().then(x=>{const k=[];x.forEach(C=>{k.push(A(C))}),w(null,k)},x=>w(x)):0<this._pc.getStats.length?this._pc.getStats(x=>{if(this.destroyed)return;const k=[];x.result().forEach(C=>{const O={};C.names().forEach(_=>{O[_]=C.stat(_)}),O.id=C.id,O.type=C.type,O.timestamp=C.timestamp,k.push(A(O))}),w(null,k)},x=>w(x)):w(null,[])}_maybeReady(){if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;const w=()=>{this.destroyed||this.getStats((A,x)=>{if(this.destroyed)return;A&&(x=[]);const k={},C={},O={};let _=!1;x.forEach(R=>{(R.type==="remotecandidate"||R.type==="remote-candidate")&&(k[R.id]=R),(R.type==="localcandidate"||R.type==="local-candidate")&&(C[R.id]=R),(R.type==="candidatepair"||R.type==="candidate-pair")&&(O[R.id]=R)});const D=R=>{_=!0;let L=C[R.localCandidateId];L&&(L.ip||L.address)?(this.localAddress=L.ip||L.address,this.localPort=+L.port):L&&L.ipAddress?(this.localAddress=L.ipAddress,this.localPort=+L.portNumber):typeof R.googLocalAddress=="string"&&(L=R.googLocalAddress.split(":"),this.localAddress=L[0],this.localPort=+L[1]),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");let F=k[R.remoteCandidateId];F&&(F.ip||F.address)?(this.remoteAddress=F.ip||F.address,this.remotePort=+F.port):F&&F.ipAddress?(this.remoteAddress=F.ipAddress,this.remotePort=+F.portNumber):typeof R.googRemoteAddress=="string"&&(F=R.googRemoteAddress.split(":"),this.remoteAddress=F[0],this.remotePort=+F[1]),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(":")?"IPv6":"IPv4"),this._debug("connect local: %s:%s remote: %s:%s",this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(x.forEach(R=>{R.type==="transport"&&R.selectedCandidatePairId&&D(O[R.selectedCandidatePairId]),(R.type==="googCandidatePair"&&R.googActiveConnection==="true"||(R.type==="candidatepair"||R.type==="candidate-pair")&&R.selected)&&D(R)}),!_&&(!Object.keys(O).length||Object.keys(C).length))return void setTimeout(w,100);if(this._connecting=!1,this._connected=!0,this._chunk){try{this.send(this._chunk)}catch(L){return this.destroy(p(L,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');const R=this._cb;this._cb=null,R(null)}typeof this._channel.bufferedAmountLowThreshold!="number"&&(this._interval=setInterval(()=>this._onInterval(),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")})};w()}_onInterval(){this._cb&&this._channel&&!(this._channel.bufferedAmount>g)&&this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||(this._pc.signalingState==="stable"&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach(w=>{this._pc.removeTrack(w),this._queuedNegotiation=!0}),this._sendersAwaitingStable=[],this._queuedNegotiation?(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()):(this._debug("negotiated"),this.emit("negotiated"))),this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}_onIceCandidate(w){this.destroyed||(w.candidate&&this.trickle?this.emit("signal",{type:"candidate",candidate:{candidate:w.candidate.candidate,sdpMLineIndex:w.candidate.sdpMLineIndex,sdpMid:w.candidate.sdpMid}}):!w.candidate&&!this._iceComplete&&(this._iceComplete=!0,this.emit("_iceComplete")),w.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(w){if(this.destroyed)return;let A=w.data;A instanceof ArrayBuffer&&(A=m.from(A)),this.push(A)}_onChannelBufferedAmountLow(){if(!this.destroyed&&this._cb){this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);const w=this._cb;this._cb=null,w(null)}}_onChannelOpen(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug("on channel close"),this.destroy())}_onTrack(w){this.destroyed||w.streams.forEach(A=>{this._debug("on track"),this.emit("track",w.track,A),this._remoteTracks.push({track:w.track,stream:A}),this._remoteStreams.some(x=>x.id===A.id)||(this._remoteStreams.push(A),h(()=>{this._debug("on stream"),this.emit("stream",A)}))})}_debug(){const w=[].slice.call(arguments);w[0]="["+this._id+"] "+w[0],u.apply(null,w)}}y.WEBRTC_SUPPORT=!!c(),y.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},y.channelConfig={},o.exports=y},{buffer:3,debug:4,"err-code":6,"get-browser-rtc":8,"queue-microtask":13,randombytes:14,"readable-stream":29}]},{},[])("/")})})(R_);var KW=R_.exports;const qW=Np(KW),GA=0,WA=1,P_=2,I_=(t,e)=>{Ne(t,GA);const n=$G(e);jt(t,n)},L_=(t,e,n)=>{Ne(t,WA),jt(t,UG(e,n))},QW=(t,e,n)=>L_(e,n,fn(t)),B_=(t,e,n)=>{try{BG(e,fn(t),n)}catch(r){console.error("Caught error while handling a Yjs update",r)}},JW=(t,e)=>{Ne(t,P_),jt(t,e)},YW=B_,XW=(t,e,n,r)=>{const s=We(t);switch(s){case GA:QW(t,e,n);break;case WA:B_(t,n,r);break;case P_:YW(t,n,r);break;default:throw new Error("Unknown message type")}return s},KA=3e4;class ZW extends QD{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const n=$s();this.getLocalState()!==null&&KA/2<=n-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const r=[];this.meta.forEach((s,i)=>{i!==this.clientID&&KA<=n-s.lastUpdated&&this.states.has(i)&&r.push(i)}),r.length>0&&qA(this,r,"timeout")},gs(KA/10)),e.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){const n=this.clientID,r=this.meta.get(n),s=r===void 0?0:r.clock+1,i=this.states.get(n);e===null?this.states.delete(n):this.states.set(n,e),this.meta.set(n,{clock:s,lastUpdated:$s()});const o=[],a=[],l=[],u=[];e===null?u.push(n):i==null?e!=null&&o.push(n):(a.push(n),Kd(i,e)||l.push(n)),(o.length>0||l.length>0||u.length>0)&&this.emit("change",[{added:o,updated:l,removed:u},"local"]),this.emit("update",[{added:o,updated:a,removed:u},"local"])}setLocalStateField(e,n){const r=this.getLocalState();r!==null&&this.setLocalState({...r,[e]:n})}getStates(){return this.states}}const qA=(t,e,n)=>{const r=[];for(let s=0;s<e.length;s++){const i=e[s];if(t.states.has(i)){if(t.states.delete(i),i===t.clientID){const o=t.meta.get(i);t.meta.set(i,{clock:o.clock+1,lastUpdated:$s()})}r.push(i)}}r.length>0&&(t.emit("change",[{added:[],updated:[],removed:r},n]),t.emit("update",[{added:[],updated:[],removed:r},n]))},Em=(t,e,n=t.states)=>{const r=e.length,s=un();Ne(s,r);for(let i=0;i<r;i++){const o=e[i],a=n.get(o)||null,l=t.meta.get(o).clock;Ne(s,o),Ne(s,l),Ws(s,JSON.stringify(a))}return Rt(s)},eK=(t,e,n)=>{const r=Ks(e),s=$s(),i=[],o=[],a=[],l=[],u=We(r);for(let c=0;c<u;c++){const f=We(r);let d=We(r);const h=JSON.parse(Ri(r)),p=t.meta.get(f),m=t.states.get(f),g=p===void 0?0:p.clock;(g<d||g===d&&h===null&&t.states.has(f))&&(h===null?f===t.clientID&&t.getLocalState()!=null?d++:t.states.delete(f):t.states.set(f,h),t.meta.set(f,{clock:d,lastUpdated:s}),p===void 0&&h!==null?i.push(f):p!==void 0&&h===null?l.push(f):h!==null&&(Kd(h,m)||a.push(f),o.push(f)))}(i.length>0||a.length>0||l.length>0)&&t.emit("change",[{added:i,updated:a,removed:l},n]),(i.length>0||o.length>0||l.length>0)&&t.emit("update",[{added:i,updated:o,removed:l},n])},tK=(t,e)=>{const n=sA(t).buffer,r=sA(e).buffer;return crypto.subtle.importKey("raw",n,"PBKDF2",!1,["deriveKey"]).then(s=>crypto.subtle.deriveKey({name:"PBKDF2",salt:r,iterations:1e5,hash:"SHA-256"},s,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]))},F_=(t,e)=>{if(!e)return AA(t);const n=crypto.getRandomValues(new Uint8Array(12));return crypto.subtle.encrypt({name:"AES-GCM",iv:n},e,t).then(r=>{const s=un();return Ws(s,"AES-GCM"),jt(s,n),jt(s,new Uint8Array(r)),Rt(s)})},nK=(t,e)=>{const n=un();return Ku(n,t),F_(Rt(n),e)},j_=(t,e)=>{if(!e)return AA(t);const n=Ks(t);Ri(n)!=="AES-GCM"&&gG(Gs("Unknown encryption algorithm"));const s=fn(n),i=fn(n);return crypto.subtle.decrypt({name:"AES-GCM",iv:s},e,i).then(o=>new Uint8Array(o))},rK=(t,e)=>j_(t,e).then(n=>qu(Ks(new Uint8Array(n)))),Or=mG("y-webrtc"),oc=0,U_=3,oh=1,QA=4,Cm=new Map,gl=new Map,V_=t=>{let e=!0;t.webrtcConns.forEach(n=>{n.synced||(e=!1)}),(!e&&t.synced||e&&!t.synced)&&(t.synced=e,t.provider.emit("synced",[{synced:e}]),Or("synced ",Wr,t.name,ll," with all peers"))},H_=(t,e,n)=>{const r=Ks(e),s=un(),i=We(r);if(t===void 0)return null;const o=t.awareness,a=t.doc;let l=!1;switch(i){case oc:{Ne(s,oc);const u=XW(r,s,a,t);u===WA&&!t.synced&&n(),u===GA&&(l=!0);break}case U_:Ne(s,oh),jt(s,Em(o,Array.from(o.getStates().keys()))),l=!0;break;case oh:eK(o,fn(r),t);break;case QA:{const u=al(r)===1,c=Ri(r);if(c!==t.peerId&&(t.bcConns.has(c)&&!u||!t.bcConns.has(c)&&u)){const f=[],d=[];u?(t.bcConns.add(c),d.push(c)):(t.bcConns.delete(c),f.push(c)),t.provider.emit("peers",[{added:d,removed:f,webrtcPeers:Array.from(t.webrtcConns.keys()),bcPeers:Array.from(t.bcConns)}]),G_(t)}break}default:return console.error("Unable to compute message"),s}return l?s:null},sK=(t,e)=>{const n=t.room;return Or("received message from ",Wr,t.remotePeerId,bA," (",n.name,")",ll,lm),H_(n,e,()=>{t.synced=!0,Or("synced ",Wr,n.name,ll," with ",Wr,t.remotePeerId),V_(n)})},JA=(t,e)=>{Or("send message to ",Wr,t.remotePeerId,ll,bA," (",t.room.name,")",lm);try{t.peer.send(Rt(e))}catch{}},iK=(t,e)=>{Or("broadcast message in ",Wr,t.name,ll),t.webrtcConns.forEach(n=>{try{n.peer.send(e)}catch{}})};class z_{constructor(e,n,r,s){Or("establishing connection to ",Wr,r),this.room=s,this.remotePeerId=r,this.glareToken=void 0,this.closed=!1,this.connected=!1,this.synced=!1,this.peer=new qW({initiator:n,...s.provider.peerOpts}),this.peer.on("signal",i=>{this.glareToken===void 0&&(this.glareToken=Date.now()+Math.random()),XA(e,s,{to:r,from:s.peerId,type:"signal",token:this.glareToken,signal:i})}),this.peer.on("connect",()=>{Or("connected to ",Wr,r),this.connected=!0;const o=s.provider.doc,a=s.awareness,l=un();Ne(l,oc),I_(l,o),JA(this,l);const u=a.getStates();if(u.size>0){const c=un();Ne(c,oh),jt(c,Em(a,Array.from(u.keys()))),JA(this,c)}}),this.peer.on("close",()=>{this.connected=!1,this.closed=!0,s.webrtcConns.has(this.remotePeerId)&&(s.webrtcConns.delete(this.remotePeerId),s.provider.emit("peers",[{removed:[this.remotePeerId],added:[],webrtcPeers:Array.from(s.webrtcConns.keys()),bcPeers:Array.from(s.bcConns)}])),V_(s),this.peer.destroy(),Or("closed connection to ",Wr,r),YA(s)}),this.peer.on("error",i=>{Or("Error in connection to ",Wr,r,": ",i),YA(s)}),this.peer.on("data",i=>{const o=sK(this,i);o!==null&&JA(this,o)})}destroy(){this.peer.destroy()}}const Uo=(t,e)=>F_(e,t.key).then(n=>t.mux(()=>DG(t.name,n))),$_=(t,e)=>{t.bcconnected&&Uo(t,e),iK(t,e)},YA=t=>{Cm.forEach(e=>{e.connected&&(e.send({type:"subscribe",topics:[t.name]}),t.webrtcConns.size<t.provider.maxConns&&XA(e,t,{type:"announce",from:t.peerId}))})},G_=t=>{if(t.provider.filterBcConns){const e=un();Ne(e,QA),Wd(e,1),Ws(e,t.peerId),Uo(t,Rt(e))}};class oK{constructor(e,n,r,s){this.peerId=tO(),this.doc=e,this.awareness=n.awareness,this.provider=n,this.synced=!1,this.name=r,this.key=s,this.webrtcConns=new Map,this.bcConns=new Set,this.mux=NO(),this.bcconnected=!1,this._bcSubscriber=i=>j_(new Uint8Array(i),s).then(o=>this.mux(()=>{const a=H_(this,o,()=>{});a&&Uo(this,Rt(a))})),this._docUpdateHandler=(i,o)=>{const a=un();Ne(a,oc),JW(a,i),$_(this,Rt(a))},this._awarenessUpdateHandler=({added:i,updated:o,removed:a},l)=>{const u=i.concat(o).concat(a),c=un();Ne(c,oh),jt(c,Em(this.awareness,u)),$_(this,Rt(c))},this._beforeUnloadHandler=()=>{qA(this.awareness,[e.clientID],"window unload"),gl.forEach(i=>{i.disconnect()})},typeof window<"u"?window.addEventListener("beforeunload",this._beforeUnloadHandler):typeof process<"u"&&process.on("exit",this._beforeUnloadHandler)}connect(){this.doc.on("update",this._docUpdateHandler),this.awareness.on("update",this._awarenessUpdateHandler),YA(this);const e=this.name;SG(e,this._bcSubscriber),this.bcconnected=!0,G_(this);const n=un();Ne(n,oc),I_(n,this.doc),Uo(this,Rt(n));const r=un();Ne(r,oc),L_(r,this.doc),Uo(this,Rt(r));const s=un();Ne(s,U_),Uo(this,Rt(s));const i=un();Ne(i,oh),jt(i,Em(this.awareness,[this.doc.clientID])),Uo(this,Rt(i))}disconnect(){Cm.forEach(n=>{n.connected&&n.send({type:"unsubscribe",topics:[this.name]})}),qA(this.awareness,[this.doc.clientID],"disconnect");const e=un();Ne(e,QA),Wd(e,0),Ws(e,this.peerId),Uo(this,Rt(e)),TG(this.name,this._bcSubscriber),this.bcconnected=!1,this.doc.off("update",this._docUpdateHandler),this.awareness.off("update",this._awarenessUpdateHandler),this.webrtcConns.forEach(n=>n.destroy())}destroy(){this.disconnect(),typeof window<"u"?window.removeEventListener("beforeunload",this._beforeUnloadHandler):typeof process<"u"&&process.off("exit",this._beforeUnloadHandler)}}const aK=(t,e,n,r)=>{if(gl.has(n))throw Gs(`A Yjs Doc connected to room "${n}" already exists!`);const s=new oK(t,e,n,r);return gl.set(n,s),s},XA=(t,e,n)=>{e.key?nK(n,e.key).then(r=>{t.send({type:"publish",topic:e.name,data:OO(r)})}):t.send({type:"publish",topic:e.name,data:n})};class lK extends A${constructor(e){super(e),this.providers=new Set,this.on("connect",()=>{Or(`connected (${e})`);const n=Array.from(gl.keys());this.send({type:"subscribe",topics:n}),gl.forEach(r=>XA(this,r,{type:"announce",from:r.peerId}))}),this.on("message",n=>{switch(n.type){case"publish":{const r=n.topic,s=gl.get(r);if(s==null||typeof r!="string")return;const i=o=>{const a=s.webrtcConns,l=s.peerId;if(o==null||o.from===l||o.to!==void 0&&o.to!==l||s.bcConns.has(o.from))return;const u=a.has(o.from)?()=>{}:()=>s.provider.emit("peers",[{removed:[],added:[o.from],webrtcPeers:Array.from(s.webrtcConns.keys()),bcPeers:Array.from(s.bcConns)}]);switch(o.type){case"announce":a.size<s.provider.maxConns&&(or(a,o.from,()=>new z_(this,!0,o.from,s)),u());break;case"signal":if(o.signal.type==="offer"){const c=a.get(o.from);if(c){const f=o.token,d=c.glareToken;if(d&&d>f){Or("offer rejected: ",o.from);return}c.glareToken=void 0}}if(o.signal.type==="answer"){Or("offer answered by: ",o.from);const c=a.get(o.from);c.glareToken=void 0}o.to===l&&(or(a,o.from,()=>new z_(this,!1,o.from,s)).peer.signal(o.signal),u());break}};s.key?typeof n.data=="string"&&rK(_O(n.data),s.key).then(i):i(n.data)}}}),this.on("disconnect",()=>Or(`disconnect (${e})`))}}const ZA=t=>{t.emit("status",[{connected:t.connected}])};class uK extends Zw{constructor(e,n,{signaling:r=["wss://y-webrtc-eu.fly.dev"],password:s=null,awareness:i=new ZW(n),maxConns:o=20+gs(ZD()*15),filterBcConns:a=!0,peerOpts:l={}}={}){super(),this.roomName=e,this.doc=n,this.filterBcConns=a,this.awareness=i,this.shouldConnect=!1,this.signalingUrls=r,this.signalingConns=[],this.maxConns=o,this.peerOpts=l,this.key=s?tK(s,e):AA(null),this.room=null,this.key.then(u=>{this.room=aK(n,this,e,u),this.shouldConnect?this.room.connect():this.room.disconnect(),ZA(this)}),this.connect(),this.destroy=this.destroy.bind(this),n.on("destroy",this.destroy)}get connected(){return this.room!==null&&this.shouldConnect}connect(){this.shouldConnect=!0,this.signalingUrls.forEach(e=>{const n=or(Cm,e,()=>new lK(e));this.signalingConns.push(n),n.providers.add(this)}),this.room&&(this.room.connect(),ZA(this))}disconnect(){this.shouldConnect=!1,this.signalingConns.forEach(e=>{e.providers.delete(this),e.providers.size===0&&(e.destroy(),Cm.delete(e.url))}),this.room&&(this.room.disconnect(),ZA(this))}destroy(){this.doc.off("destroy",this.destroy),this.key.then(()=>{this.room.destroy(),gl.delete(this.roomName)}),super.destroy()}}const cK={attributes:{class:"prose-lg prose-headings:font-display prose prose-p:my-2 prose-h1:my-2 prose-h2:my-2 prose-h3:my-2 prose-ul:my-2 prose-ol:my-2 max-w-none focus:outline-none w-full",spellcheck:"false",suppressContentEditableWarning:"true"}},fK=/[\uD800-\uDBFF]/,dK=/[\uDC00-\uDFFF]/,hK=(t,e)=>{let n=0,r=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;for(n>0&&fK.test(t[n-1])&&n--;r+n<t.length&&r+n<e.length&&t[t.length-r-1]===e[e.length-r-1];)r++;return r>0&&dK.test(t[t.length-r])&&r--,{index:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}},Pt=new _t("y-sync"),Li=new _t("y-undo"),Sm=new _t("yjs-cursor"),Tm=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&e.sv.get(t.id.client)>t.id.clock&&!Yu(e.ds,t.id),pK=[{light:"#ecd44433",dark:"#ecd444"}],mK=(t,e,n)=>{if(!t.has(n)){if(t.size<e.length){const r=Oi();t.forEach(s=>r.add(s)),e=e.filter(s=>!r.has(s))}t.set(n,k$(e))}return t.get(n)},gK=(t,{colors:e=pK,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:s=()=>{},mapping:i}={})=>{let o=!1;const a=new bK(t,i),l=new bt({props:{editable:u=>{const c=Pt.getState(u);return c.snapshot==null&&c.prevSnapshot==null}},key:Pt,state:{init:(u,c)=>({type:t,doc:t.doc,binding:a,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:n,permanentUserData:r}),apply:(u,c)=>{const f=u.getMeta(Pt);if(f!==void 0){c=Object.assign({},c);for(const d in f)c[d]=f[d]}return c.addToHistory=u.getMeta("addToHistory")!==!1,c.isChangeOrigin=f!==void 0&&!!f.isChangeOrigin,c.isUndoRedoOperation=f!==void 0&&!!f.isChangeOrigin&&!!f.isUndoRedoOperation,a.prosemirrorView!==null&&f!==void 0&&(f.snapshot!=null||f.prevSnapshot!=null)&&yA(0,()=>{a.prosemirrorView!=null&&(f.restore==null?a._renderSnapshot(f.snapshot,f.prevSnapshot,c):(a._renderSnapshot(f.snapshot,f.snapshot,c),delete c.restore,delete c.snapshot,delete c.prevSnapshot,a.mux(()=>{a._prosemirrorChanged(a.prosemirrorView.state.doc)})))}),c}},view:u=>(a.initView(u),i==null&&a._forceRerender(),s(),{update:()=>{const c=l.getState(u.state);if(c.snapshot==null&&c.prevSnapshot==null&&(o||u.state.doc.content.findDiffStart(u.state.doc.type.createAndFill().content)!==null)){if(o=!0,c.addToHistory===!1&&!c.isChangeOrigin){const f=Li.getState(u.state),d=f&&f.undoManager;d&&d.stopCapturing()}a.mux(()=>{c.doc.transact(f=>{f.meta.set("addToHistory",c.addToHistory),a._prosemirrorChanged(u.state.doc)},Pt)})}},destroy:()=>{a.destroy()}})});return l},yK=(t,e,n)=>{if(e!==null&&e.anchor!==null&&e.head!==null){const r=uh(n.doc,n.type,e.anchor,n.mapping),s=uh(n.doc,n.type,e.head,n.mapping);r!==null&&s!==null&&(t=t.setSelection(_e.create(t.doc,r,s)))}},ev=(t,e)=>({anchor:Mm(e.selection.anchor,t.type,t.mapping),head:Mm(e.selection.head,t.type,t.mapping)});class bK{constructor(e,n=new Map){this.type=e,this.prosemirrorView=null,this.mux=NO(),this.mapping=n,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=ev(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta("addToHistory",!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(mA&&this._domSelectionInView===null&&(yA(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){const e=this.prosemirrorView._root.getSelection(),n=this.prosemirrorView._root.createRange();n.setStart(e.anchorNode,e.anchorOffset),n.setEnd(e.focusNode,e.focusOffset),n.getClientRects().length===0&&n.startContainer&&n.collapsed&&n.selectNodeContents(n.startContainer);const s=n.getBoundingClientRect(),i=aG.documentElement;return s.bottom>=0&&s.right>=0&&s.left<=(window.innerWidth||i.clientWidth||0)&&s.top<=(window.innerHeight||i.clientHeight||0)}renderSnapshot(e,n){n||(n=QO(PO(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(Pt,{snapshot:e,prevSnapshot:n}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{const e=this.type.toArray().map(r=>Dm(r,this.prosemirrorView.state.schema,this.mapping)).filter(r=>r!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ce(se.from(e),0,0));n.setMeta(Pt,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(n)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{const e=this.beforeTransactionSelection!==null?null:this.prosemirrorView.state.selection,n=this.type.toArray().map(s=>Dm(s,this.prosemirrorView.state.schema,this.mapping)).filter(s=>s!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ce(se.from(n),0,0));e&&r.setSelection(_e.create(r.doc,e.anchor,e.head)),this.prosemirrorView.dispatch(r.setMeta(Pt,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,n,r){let s=this.doc;e||(e=_A(this.doc)),(e instanceof Uint8Array||n instanceof Uint8Array)&&((!(e instanceof Uint8Array)||!(n instanceof Uint8Array))&&Sr(),s=new ul({gc:!1}),um(s,n),n=_A(s),um(s,e),e=_A(s)),this.mapping.clear(),this.mux(()=>{s.transact(i=>{const o=r.permanentUserData;o&&o.dss.forEach(c=>{Bo(i,c,f=>{})});const a=(c,f)=>{const d=c==="added"?o.getUserByClientId(f.client):o.getUserByDeletedId(f);return{user:d,type:c,color:mK(r.colorMapping,r.colors,d)}},l=d_(this.type,new OA(n.ds,e.sv)).map(c=>!c._item.deleted||Tm(c._item,e)||Tm(c._item,n)?Dm(c,this.prosemirrorView.state.schema,new Map,e,n,a):null).filter(c=>c!==null),u=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ce(se.from(l),0,0));this.prosemirrorView.dispatch(u.setMeta(Pt,{isChangeOrigin:!0}))},Pt)})}_typeChanged(e,n){if(this.prosemirrorView==null)return;const r=Pt.getState(this.prosemirrorView.state);if(e.length===0||r.snapshot!=null||r.prevSnapshot!=null){this.renderSnapshot(r.snapshot,r.prevSnapshot);return}this.mux(()=>{const s=(a,l)=>this.mapping.delete(l);Bo(n,n.deleteSet,a=>{if(a.constructor===Et){const l=a.content.type;l&&this.mapping.delete(l)}}),n.changed.forEach(s),n.changedParentTypes.forEach(s);const i=this.type.toArray().map(a=>W_(a,this.prosemirrorView.state.schema,this.mapping)).filter(a=>a!==null);let o=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ce(se.from(i),0,0));yK(o,this.beforeTransactionSelection,this),o=o.setMeta(Pt,{isChangeOrigin:!0,isUndoRedoOperation:n.origin instanceof i_}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&o.scrollIntoView(),this.prosemirrorView.dispatch(o)})}_prosemirrorChanged(e){this.doc.transact(()=>{rv(this.doc,this.type,e,this.mapping),this.beforeTransactionSelection=ev(this,this.prosemirrorView.state)},Pt)}initView(e){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=e,this.doc.on("beforeAllTransactions",this.beforeAllTransactions),this.doc.on("afterAllTransactions",this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off("beforeAllTransactions",this.beforeAllTransactions),this.doc.off("afterAllTransactions",this.afterAllTransactions))}}const W_=(t,e,n,r,s,i)=>{const o=n.get(t);if(o===void 0){if(t instanceof $n)return Dm(t,e,n,r,s,i);throw ys()}return o},Dm=(t,e,n,r,s,i)=>{const o=[],a=l=>{if(l.constructor===$n){const u=W_(l,e,n,r,s,i);u!==null&&o.push(u)}else{const u=wK(l,e,n,r,s,i);u!==null&&u.forEach(c=>{c!==null&&o.push(c)})}};r===void 0||s===void 0?t.toArray().forEach(a):d_(t,new OA(s.ds,r.sv)).forEach(a);try{const l=t.getAttributes(r);r!==void 0&&(Tm(t._item,r)?Tm(t._item,s)||(l.ychange=i?i("added",t._item.id):{type:"added"}):l.ychange=i?i("removed",t._item.id):{type:"removed"});const u=e.node(t.nodeName,l,o);return n.set(t,u),u}catch{return t.doc.transact(u=>{t._item.delete(u)},Pt),n.delete(t),null}},wK=(t,e,n,r,s,i)=>{const o=[],a=t.toDelta(r,s,i);try{for(let l=0;l<a.length;l++){const u=a[l],c=[];for(const f in u.attributes)c.push(e.mark(f,u.attributes[f]));o.push(e.text(u.insert,c))}}catch{return t.doc.transact(u=>{t._item.delete(u)},Pt),null}return o},AK=(t,e)=>{const n=new Dr,r=t.map(s=>({insert:s.text,attributes:J_(s.marks)}));return n.applyDelta(r),e.set(n,t),n},vK=(t,e)=>{const n=new $n(t.type.name);for(const r in t.attrs){const s=t.attrs[r];s!==null&&r!=="ychange"&&n.setAttribute(r,s)}return n.insert(0,Om(t).map(r=>tv(r,e))),e.set(n,t),n},tv=(t,e)=>t instanceof Array?AK(t,e):vK(t,e),K_=t=>typeof t=="object"&&t!==null,nv=(t,e)=>{const n=Object.keys(t).filter(s=>t[s]!==null);let r=n.length===Object.keys(e).filter(s=>e[s]!==null).length;for(let s=0;s<n.length&&r;s++){const i=n[s],o=t[i],a=e[i];r=i==="ychange"||o===a||K_(o)&&K_(a)&&nv(o,a)}return r},Om=t=>{const e=t.content.content,n=[];for(let r=0;r<e.length;r++){const s=e[r];if(s.isText){const i=[];for(let o=e[r];r<e.length&&o.isText;o=e[++r])i.push(o);r--,n.push(i)}else n.push(s)}return n},q_=(t,e)=>{const n=t.toDelta();return n.length===e.length&&n.every((r,s)=>r.insert===e[s].text&&hA(r.attributes||{}).length===e[s].marks.length&&e[s].marks.every(i=>nv(r.attributes[i.type.name]||{},i.attrs)))},ah=(t,e)=>{if(t instanceof $n&&!(e instanceof Array)&&sv(t,e)){const n=Om(e);return t._length===n.length&&nv(t.getAttributes(),e.attrs)&&t.toArray().every((r,s)=>ah(r,n[s]))}return t instanceof Dr&&e instanceof Array&&q_(t,e)},_m=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((n,r)=>e[r]===n),Q_=(t,e,n)=>{const r=t.toArray(),s=Om(e),i=s.length,o=r.length,a=Lo(o,i);let l=0,u=0,c=!1;for(;l<a;l++){const f=r[l],d=s[l];if(_m(n.get(f),d))c=!0;else if(!ah(f,d))break}for(;l+u<a;u++){const f=r[o-u-1],d=s[i-u-1];if(_m(n.get(f),d))c=!0;else if(!ah(f,d))break}return{equalityFactor:l+u,foundMappedChild:c}},xK=t=>{let e="",n=t._start;const r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof bs?e+=n.content.str:n.content instanceof Zt&&(r[n.content.key]=null)),n=n.right;return{str:e,nAttrs:r}},kK=(t,e,n)=>{n.set(t,e);const{nAttrs:r,str:s}=xK(t),i=e.map(u=>({insert:u.text,attributes:Object.assign({},r,J_(u.marks))})),{insert:o,remove:a,index:l}=hK(s,i.map(u=>u.insert).join(""));t.delete(l,a),t.insert(l,o),t.applyDelta(i.map(u=>({retain:u.insert.length,attributes:u.attributes})))},J_=t=>{const e={};return t.forEach(n=>{n.type.name!=="ychange"&&(e[n.type.name]=n.attrs)}),e},rv=(t,e,n,r)=>{if(e instanceof $n&&e.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.set(e,n),e instanceof $n){const f=e.getAttributes(),d=n.attrs;for(const h in d)d[h]!==null?f[h]!==d[h]&&h!=="ychange"&&e.setAttribute(h,d[h]):e.removeAttribute(h);for(const h in f)d[h]===void 0&&e.removeAttribute(h)}const s=Om(n),i=s.length,o=e.toArray(),a=o.length,l=Lo(i,a);let u=0,c=0;for(;u<l;u++){const f=o[u],d=s[u];if(!_m(r.get(f),d))if(ah(f,d))r.set(f,d);else break}for(;c+u+1<l;c++){const f=o[a-c-1],d=s[i-c-1];if(!_m(r.get(f),d))if(ah(f,d))r.set(f,d);else break}t.transact(()=>{for(;a-u-c>0&&i-u-c>0;){const d=o[u],h=s[u],p=o[a-c-1],m=s[i-c-1];if(d instanceof Dr&&h instanceof Array)q_(d,h)||kK(d,h,r),u+=1;else{let g=d instanceof $n&&sv(d,h),y=p instanceof $n&&sv(p,m);if(g&&y){const v=Q_(d,h,r),w=Q_(p,m,r);v.foundMappedChild&&!w.foundMappedChild?y=!1:!v.foundMappedChild&&w.foundMappedChild||v.equalityFactor<w.equalityFactor?g=!1:y=!1}g?(rv(t,d,h,r),u+=1):y?(rv(t,p,m,r),c+=1):(r.delete(e.get(u)),e.delete(u,1),e.insert(u,[tv(h,r)]),u+=1)}}const f=a-u-c;if(a===1&&i===0&&o[0]instanceof Dr?(r.delete(o[0]),o[0].delete(0,o[0].length)):f>0&&(e.slice(u,u+f).forEach(d=>r.delete(d)),e.delete(u,f)),u+c<i){const d=[];for(let h=u;h<i-c;h++)d.push(tv(s[h],r));e.insert(u,d)}},Pt)},sv=(t,e)=>!(e instanceof Array)&&t.nodeName===e.type.name;let lh=null;const EK=()=>{const t=lh;lh=null,t.forEach((e,n)=>{const r=n.state.tr,s=Pt.getState(n.state);s&&s.binding&&!s.binding.isDestroyed&&(e.forEach((i,o)=>{r.setMeta(o,i)}),n.dispatch(r))})},CK=(t,e,n)=>{lh||(lh=new Map,yA(0,EK)),or(lh,t,zn).set(e,n)},Mm=(t,e,n)=>{if(t===0)return DA(e,0,-1);let r=e._first===null?null:e._first.content.type;for(;r!==null&&e!==r;){if(r instanceof Dr){if(r._length>=t)return DA(r,t,-1);if(t-=r._length,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{do r=r._item===null?null:r._item.parent,t--;while(r!==e&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==e&&(r=r._item===null?null:r._item.next.content.type)}}else{const s=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&t<s)r=r._first.content.type,t--;else{if(t===1&&r._length===0&&s>1)return new Xd(r._item===null?null:r._item.id,r._item===null?Jd(r):null,null);if(t-=s,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(t===0)return r=r._item===null?r:r._item.parent,new Xd(r._item===null?null:r._item.id,r._item===null?Jd(r):null,null);do r=r._item.parent,t--;while(r!==e&&r._item.next===null);r!==e&&(r=r._item.next.content.type)}}}if(r===null)throw Sr();if(t===0&&r.constructor!==Dr&&r!==e)return SK(r._item.parent,r._item)}return DA(e,e._length,-1)},SK=(t,e)=>{let n=null,r=null;return t._item===null?r=Jd(t):n=Ke(t._item.id.client,t._item.id.clock),new Xd(n,r,e.id)},uh=(t,e,n,r)=>{const s=qG(n,t);if(s===null||s.type!==e&&!Yd(e,s.type._item))return null;let i=s.type,o=0;if(i.constructor===Dr)o=s.index;else if(i._item===null||!i._item.deleted){let a=i._first,l=0;for(;l<i._length&&l<s.index&&a!==null;){if(!a.deleted){const u=a.content.type;l++,u instanceof Dr?o+=u._length:o+=r.get(u).nodeSize}a=a.right}o+=1}for(;i!==e&&i._item!==null;){const a=i._item.parent;if(a._item===null||!a._item.deleted){o+=1;let l=a._first;for(;l!==null;){const u=l.content.type;if(u===i)break;l.deleted||(u instanceof Dr?o+=u._length:o+=r.get(u).nodeSize),l=l.right}}i=a}return o-1},TK=(t,e,n)=>t!==e,DK=t=>{const e=document.createElement("span");e.classList.add("ProseMirror-yjs-cursor"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");n.setAttribute("style",`background-color: ${t.color}`),n.insertBefore(document.createTextNode(t.name),null);const r=document.createTextNode("⁠"),s=document.createTextNode("⁠");return e.insertBefore(r,null),e.insertBefore(n,null),e.insertBefore(s,null),e},Y_=t=>({style:`background-color: ${t.color}70`,class:"ProseMirror-yjs-selection"}),OK=/^#[0-9a-fA-F]{6}$/,X_=(t,e,n,r,s)=>{const i=Pt.getState(t),o=i.doc,a=[];return i.snapshot!=null||i.prevSnapshot!=null||i.binding===null?kt.create(t.doc,[]):(e.getStates().forEach((l,u)=>{if(n(o.clientID,u,l)&&l.cursor!=null){const c=l.user||{};c.color==null?c.color="#ffa500":OK.test(c.color)||console.warn("A user uses an unsupported color format",c),c.name==null&&(c.name=`User: ${u}`);let f=uh(o,i.type,Zd(l.cursor.anchor),i.binding.mapping),d=uh(o,i.type,Zd(l.cursor.head),i.binding.mapping);if(f!==null&&d!==null){const h=Mi(t.doc.content.size-1,0);f=Lo(f,h),d=Lo(d,h),a.push(nn.widget(d,()=>r(c),{key:u+"",side:10}));const p=Lo(f,d),m=Mi(f,d);a.push(nn.inline(p,m,s(c),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),kt.create(t.doc,a))},_K=(t,{awarenessStateFilter:e=TK,cursorBuilder:n=DK,selectionBuilder:r=Y_,getSelection:s=o=>o.selection}={},i="cursor")=>new bt({key:Sm,state:{init(o,a){return X_(a,t,e,n,r)},apply(o,a,l,u){const c=Pt.getState(u),f=o.getMeta(Sm);return c&&c.isChangeOrigin||f&&f.awarenessUpdated?X_(u,t,e,n,r):a.map(o.mapping,o.doc)}},props:{decorations:o=>Sm.getState(o)},view:o=>{const a=()=>{o.docView&&CK(o,Sm,{awarenessUpdated:!0})},l=()=>{const u=Pt.getState(o.state),c=t.getLocalState()||{};if(u.binding!=null)if(o.hasFocus()){const f=s(o.state),d=Mm(f.anchor,u.type,u.binding.mapping),h=Mm(f.head,u.type,u.binding.mapping);(c.cursor==null||!qO(Zd(c.cursor.anchor),d)||!qO(Zd(c.cursor.head),h))&&t.setLocalStateField(i,{anchor:d,head:h})}else c.cursor!=null&&uh(u.doc,u.type,Zd(c.cursor.anchor),u.binding.mapping)!==null&&t.setLocalStateField(i,null)};return t.on("change",a),o.dom.addEventListener("focusin",l),o.dom.addEventListener("focusout",l),{update:l,destroy:()=>{o.dom.removeEventListener("focusin",l),o.dom.removeEventListener("focusout",l),t.off("change",a),t.setLocalStateField(i,null)}}}}),MK=t=>{const e=Li.getState(t).undoManager;if(e!=null)return e.undo(),!0},NK=t=>{const e=Li.getState(t).undoManager;if(e!=null)return e.redo(),!0},RK=new Set(["paragraph"]),PK=(t,e)=>!(t instanceof Et)||!(t.content instanceof ws)||!(t.content.type instanceof dl||t.content.type instanceof $n&&e.has(t.content.type.nodeName))||t.content.type._length===0,IK=({protectedNodes:t=RK,trackedOrigins:e=[],undoManager:n=null}={})=>new bt({key:Li,state:{init:(r,s)=>{const i=Pt.getState(s),o=n||new i_(i.type,{trackedOrigins:new Set([Pt].concat(e)),deleteFilter:a=>PK(a,t),captureTransaction:a=>a.meta.get("addToHistory")!==!1});return{undoManager:o,prevSel:null,hasUndoOps:o.undoStack.length>0,hasRedoOps:o.redoStack.length>0}},apply:(r,s,i,o)=>{const a=Pt.getState(o).binding,l=s.undoManager,u=l.undoStack.length>0,c=l.redoStack.length>0;return a?{undoManager:l,prevSel:ev(a,i),hasUndoOps:u,hasRedoOps:c}:u!==s.hasUndoOps||c!==s.hasRedoOps?Object.assign({},s,{hasUndoOps:l.undoStack.length>0,hasRedoOps:l.redoStack.length>0}):s}},view:r=>{const s=Pt.getState(r.state),i=Li.getState(r.state).undoManager;return i.on("stack-item-added",({stackItem:o})=>{const a=s.binding;a&&o.meta.set(a,Li.getState(r.state).prevSel)}),i.on("stack-item-popped",({stackItem:o})=>{const a=s.binding;a&&(a.beforeTransactionSelection=o.meta.get(a)||a.beforeTransactionSelection)}),{destroy:()=>{i.destroy()}}}}),LK=wt.create({name:"collaboration",priority:1e3,addOptions(){return{document:null,field:"default",fragment:null}},onCreate(){this.editor.extensionManager.extensions.find(t=>t.name==="history")&&console.warn('[tiptap warn]: "@tiptap/extension-collaboration" comes with its own history support and is not compatible with "@tiptap/extension-history".')},addCommands(){return{undo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),Li.getState(e).undoManager.undoStack.length===0?!1:n?MK(e):!0),redo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),Li.getState(e).undoManager.redoStack.length===0?!1:n?NK(e):!0)}},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}},addProseMirrorPlugins(){const t=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),e=IK(),n=e.spec.view;e.spec.view=i=>{const{undoManager:o}=Li.getState(i.state);o.restore&&(o.restore(),o.restore=()=>{});const a=n?n(i):void 0;return{destroy:()=>{const l=o.trackedOrigins.has(o),u=o._observers;o.restore=()=>{l&&o.trackedOrigins.add(o),o.doc.on("afterTransaction",o.afterTransactionHandler),o._observers=u},a!=null&&a.destroy&&a.destroy()}}};const r={...this.options.ySyncOptions?{...this.options.ySyncOptions}:{},...this.options.onFirstRender?{...this.options.onFirstRender}:{}};return[gK(t,r),e]}}),Z_=t=>Array.from(t.entries()).map(([e,n])=>({clientId:e,...n.user})),eM=()=>null,BK=wt.create({name:"collaborationCursor",addOptions(){return{provider:null,user:{name:null,color:null},render:t=>{const e=document.createElement("span");e.classList.add("collaboration-cursor__caret"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");return n.classList.add("collaboration-cursor__label"),n.setAttribute("style",`background-color: ${t.color}`),n.insertBefore(document.createTextNode(t.name),null),e.insertBefore(n,null),e},selectionRender:Y_,onUpdate:eM}},onCreate(){this.options.onUpdate!==eM&&console.warn('[tiptap warn]: DEPRECATED: The "onUpdate" option is deprecated. Please use `editor.storage.collaborationCursor.users` instead. Read more: https://tiptap.dev/api/extensions/collaboration-cursor')},addStorage(){return{users:[]}},addCommands(){return{updateUser:t=>()=>(this.options.user=t,this.options.provider.awareness.setLocalStateField("user",this.options.user),!0),user:t=>({editor:e})=>(console.warn('[tiptap warn]: DEPRECATED: The "user" command is deprecated. Please use "updateUser" instead. Read more: https://tiptap.dev/api/extensions/collaboration-cursor'),e.commands.updateUser(t))}},addProseMirrorPlugins(){return[_K((this.options.provider.awareness.setLocalStateField("user",this.options.user),this.storage.users=Z_(this.options.provider.awareness.states),this.options.provider.awareness.on("update",()=>{this.storage.users=Z_(this.options.provider.awareness.states)}),this.options.provider.awareness),{cursorBuilder:this.options.render,selectionBuilder:this.options.selectionRender})]}}),FK=/^\s*>\s$/,jK=Ye.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",rt(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Ru({find:FK,type:this.type})]}}),UK=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,VK=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,HK=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,zK=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,$K=Yt.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",rt(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[qa({find:UK,type:this.type}),qa({find:HK,type:this.type})]},addPasteRules(){return[No({find:VK,type:this.type}),No({find:zK,type:this.type})]}}),GK=Ye.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",rt(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),tM=Yt.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["span",rt(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{const n=yd(t,this.type);return Object.entries(n).some(([,s])=>!!s)?!0:e.unsetMark(this.name)}}}}),nM=/^\s*([-+*])\s$/,rM=Ye.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",rt(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(GK.name,this.editor.getAttributes(tM.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Ru({find:nM,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ru({find:nM,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(tM.name),editor:this.editor})),[t]}}),WK=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/,KK=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g,qK=Yt.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",rt(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[qa({find:WK,type:this.type})]},addPasteRules(){return[No({find:KK,type:this.type})]}}),QK=/^```([a-z]+)?[\s\n]$/,JK=/^~~~([a-z]+)?[\s\n]$/,YK=Ye.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:null,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options,i=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",rt(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:s}=n;if(!s||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
@@ -512,7 +512,7 @@ ${n.innerHTML}
512
512
  `),t.text(e.textContent,!1),t.ensureNewLine(),t.write("```"),t.closeBlock(e)},parse:{setup(t){var e;t.set({langPrefix:(e=this.options.languageClassPrefix)!==null&&e!==void 0?e:"language-"})},updateDOM(t){t.innerHTML=t.innerHTML.replace(/\n<\/code><\/pre>/g,"</code></pre>")}}}}}}),n4=Ye.create({name:"hardBreak"}).extend({addStorage(){return{markdown:{serialize(t,e,n,r){for(let s=r+1;s<n.childCount;s++)if(n.child(s).type!=e.type){t.write(t.inTable?Hg.storage.markdown.serialize.call(this,t,e,n):`\\
513
513
  `);return}},parse:{}}}}}),Cte=Ye.create({name:"heading"}).extend({addStorage(){return{markdown:{serialize:li.nodes.heading,parse:{}}}}}),Ste=Ye.create({name:"horizontalRule"}).extend({addStorage(){return{markdown:{serialize:li.nodes.horizontal_rule,parse:{}}}}}),Tte=Ye.create({name:"image"}).extend({addStorage(){return{markdown:{serialize:li.nodes.image,parse:{}}}}}),Dte=Ye.create({name:"listItem"}).extend({addStorage(){return{markdown:{serialize:li.nodes.list_item,parse:{}}}}}),Ote=Ye.create({name:"orderedList"});function _te(t,e,n){let r=0;for(;n-r>0&&e.child(n-r-1).type.name===t.type.name;r++);return r}const Mte=Ote.extend({addStorage(){return{markdown:{serialize(t,e,n,r){const s=e.attrs.start||1,i=String(s+e.childCount-1).length,o=t.repeat(" ",i+2),l=_te(e,n,r)%2?") ":". ";t.renderList(e,o,u=>{const c=String(s+u);return t.repeat(" ",i-c.length)+c+l})},parse:{}}}}}),Nte=Ye.create({name:"paragraph"}).extend({addStorage(){return{markdown:{serialize:li.nodes.paragraph,parse:{}}}}});function wx(t){var e,n;return(e=t==null||(n=t.content)===null||n===void 0?void 0:n.content)!==null&&e!==void 0?e:[]}const Rte=Ye.create({name:"table"}).extend({addStorage(){return{markdown:{serialize(t,e,n){if(!Pte(e)){Hg.storage.markdown.serialize.call(this,t,e,n);return}t.inTable=!0,e.forEach((r,s,i)=>{if(t.write("| "),r.forEach((o,a,l)=>{l&&t.write(" | ");const u=o.firstChild;u.textContent.trim()&&t.renderInline(u)}),t.write(" |"),t.ensureNewLine(),!i){const o=Array.from({length:r.childCount}).map(()=>"---").join(" | ");t.write(`| ${o} |`),t.ensureNewLine()}}),t.closeBlock(e),t.inTable=!1},parse:{}}}}});function r4(t){return t.attrs.colspan>1||t.attrs.rowspan>1}function Pte(t){const e=wx(t),n=e[0],r=e.slice(1);return!(wx(n).some(s=>s.type.name!=="tableHeader"||r4(s)||s.childCount>1)||r.some(s=>wx(s).some(i=>i.type.name==="tableHeader"||r4(i)||i.childCount>1)))}const Ite=Ye.create({name:"taskItem"}).extend({addStorage(){return{markdown:{serialize(t,e){const n=e.attrs.checked?"[x]":"[ ]";t.write(`${n} `),t.renderContent(e)},parse:{updateDOM(t){[...t.querySelectorAll(".task-list-item")].forEach(e=>{const n=e.querySelector("input");e.setAttribute("data-type","taskItem"),n&&(e.setAttribute("data-checked",n.checked),n.remove())})}}}}}}),Lte=Ye.create({name:"taskList"}).extend({addStorage(){return{markdown:{serialize:t4.storage.markdown.serialize,parse:{setup(t){t.use(cte)},updateDOM(t){[...t.querySelectorAll(".contains-task-list")].forEach(e=>{e.setAttribute("data-type","taskList")})}}}}}}),Bte=Ye.create({name:"text"}).extend({addStorage(){return{markdown:{serialize(t,e){t.text(bte(e.text))},parse:{}}}}}),Fte=Yt.create({name:"bold"}).extend({addStorage(){return{markdown:{serialize:li.marks.strong,parse:{}}}}}),jte=Yt.create({name:"code"}).extend({addStorage(){return{markdown:{serialize:li.marks.code,parse:{}}}}}),Ute=Yt.create({name:"italic"}).extend({addStorage(){return{markdown:{serialize:li.marks.em,parse:{}}}}}),Vte=Yt.create({name:"link"}).extend({addStorage(){return{markdown:{serialize:li.marks.link,parse:{}}}}}),Hte=Yt.create({name:"strike"}).extend({addStorage(){return{markdown:{serialize:{open:"~~",close:"~~",expelEnclosingWhitespace:!0},parse:{}}}}}),zte=[kte,t4,Ete,n4,Cte,Ste,Hg,Tte,Dte,Mte,Nte,Rte,Ite,Lte,Bte,Fte,jte,Z6,Ute,Vte,Hte];function zg(t){var e,n;const r=(e=t.storage)===null||e===void 0?void 0:e.markdown,s=(n=zte.find(i=>i.name===t.name))===null||n===void 0?void 0:n.storage.markdown;return r||s?{...s,...r}:null}class $te{constructor(e){Vg(this,"editor",null),this.editor=e}serialize(e){const n=new yte(this.nodes,this.marks,{hardBreakNodeName:n4.name});return n.renderContent(e),n.out}get nodes(){var e;return{...Object.fromEntries(Object.keys(this.editor.schema.nodes).map(n=>[n,this.serializeNode(Hg)])),...Object.fromEntries((e=this.editor.extensionManager.extensions.filter(n=>n.type==="node"&&this.serializeNode(n)).map(n=>[n.name,this.serializeNode(n)]))!==null&&e!==void 0?e:[])}}get marks(){var e;return{...Object.fromEntries(Object.keys(this.editor.schema.marks).map(n=>[n,this.serializeMark(Z6)])),...Object.fromEntries((e=this.editor.extensionManager.extensions.filter(n=>n.type==="mark"&&this.serializeMark(n)).map(n=>[n.name,this.serializeMark(n)]))!==null&&e!==void 0?e:[])}}serializeNode(e){var n;return(n=zg(e))===null||n===void 0||(n=n.serialize)===null||n===void 0?void 0:n.bind({editor:this.editor,options:e.options})}serializeMark(e){var n;const r=(n=zg(e))===null||n===void 0?void 0:n.serialize;return r?{...r,open:typeof r.open=="function"?r.open.bind({editor:this.editor,options:e.options}):r.open,close:typeof r.close=="function"?r.close.bind({editor:this.editor,options:e.options}):r.close}:null}}class Gte{constructor(e,n){Vg(this,"editor",null),Vg(this,"md",null);let{html:r,linkify:s,breaks:i}=n;this.editor=e,this.md=this.withPatchedRenderer(cr({html:r,linkify:s,breaks:i}))}parse(e){let{inline:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof e=="string"){this.editor.extensionManager.extensions.forEach(i=>{var o;return(o=zg(i))===null||o===void 0||(o=o.parse)===null||o===void 0||(o=o.setup)===null||o===void 0?void 0:o.call({editor:this.editor,options:i.options},this.md)});const r=this.md.render(e),s=bx(r);return this.editor.extensionManager.extensions.forEach(i=>{var o;return(o=zg(i))===null||o===void 0||(o=o.parse)===null||o===void 0||(o=o.updateDOM)===null||o===void 0?void 0:o.call({editor:this.editor,options:i.options},s)}),this.normalizeDOM(s,{inline:n,content:e}),s.innerHTML}return e}normalizeDOM(e,n){let{inline:r,content:s}=n;return this.normalizeBlocks(e),e.querySelectorAll("*").forEach(i=>{var o;((o=i.nextSibling)===null||o===void 0?void 0:o.nodeType)===Node.TEXT_NODE&&!i.closest("pre")&&(i.nextSibling.textContent=i.nextSibling.textContent.replace(/^\n/,""))}),r&&this.normalizeInline(e,s),e}normalizeBlocks(e){const r=Object.values(this.editor.schema.nodes).filter(s=>s.isBlock).map(s=>{var i;return(i=s.spec.parseDOM)===null||i===void 0?void 0:i.map(o=>o.tag)}).flat().filter(Boolean).join(",");r&&[...e.querySelectorAll(r)].forEach(s=>{s.parentElement.matches("p")&&wte(s)})}normalizeInline(e,n){var r;if((r=e.firstElementChild)!==null&&r!==void 0&&r.matches("p")){var s,i,o,a;const l=e.firstElementChild,{nextElementSibling:u}=l,c=(s=(i=n.match(/^\s+/))===null||i===void 0?void 0:i[0])!==null&&s!==void 0?s:"",f=u?"":(o=(a=n.match(/\s+$/))===null||a===void 0?void 0:a[0])!==null&&o!==void 0?o:"";if(n.match(/^\n\n/)){l.innerHTML=`${l.innerHTML}${f}`;return}Ate(l),e.innerHTML=`${c}${e.innerHTML}${f}`}}withPatchedRenderer(e){const n=r=>function(){const s=r(...arguments);return s===`
514
514
  `?s:s[s.length-1]===`
515
- `?s.slice(0,-1):s};return e.renderer.rules.hardbreak=n(e.renderer.rules.hardbreak),e.renderer.rules.softbreak=n(e.renderer.rules.softbreak),e.renderer.rules.fence=n(e.renderer.rules.fence),e.renderer.rules.code_block=n(e.renderer.rules.code_block),e.renderer.renderToken=n(e.renderer.renderToken.bind(e.renderer)),e}}const Wte=wt.create({name:"markdownClipboard",addOptions(){return{transformPastedText:!1,transformCopiedText:!1}},addProseMirrorPlugins(){return[new bt({key:new _t("markdownClipboard"),props:{clipboardTextParser:(t,e,n)=>{if(n||!this.options.transformPastedText)return null;const r=this.editor.storage.markdown.parser.parse(t,{inline:!0});return Up.fromSchema(this.editor.schema).parseSlice(bx(r),{preserveWhitespace:!0,context:e})},clipboardTextSerializer:t=>this.options.transformCopiedText?this.editor.storage.markdown.serializer.serialize(t.content):null}})]}}),Kte=wt.create({name:"markdown",priority:50,addOptions(){return{html:!0,tightLists:!0,tightListClass:"tight",bulletListMarker:"-",linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}},addCommands(){const t=B7.Commands.config.addCommands();return{setContent:(e,n,r)=>s=>t.setContent(s.editor.storage.markdown.parser.parse(e),n,r)(s),insertContentAt:(e,n,r)=>s=>t.insertContentAt(e,s.editor.storage.markdown.parser.parse(n,{inline:!0}),r)(s)}},onBeforeCreate(){this.editor.storage.markdown={options:{...this.options},parser:new Gte(this.editor,this.options),serializer:new $te(this.editor),getMarkdown:()=>this.editor.storage.markdown.serializer.serialize(this.editor.state.doc)},this.editor.options.initialContent=this.editor.options.content,this.editor.options.content=this.editor.storage.markdown.parser.parse(this.editor.options.content)},onCreate(){this.editor.options.content=this.editor.options.initialContent,delete this.editor.options.initialContent},addStorage(){return{}},addExtensions(){return[hte.configure({tight:this.options.tightLists,tightClass:this.options.tightListClass}),Wte.configure({transformPastedText:this.options.transformPastedText,transformCopiedText:this.options.transformCopiedText})]}}),qte=[Nq,_q.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,bulletList:!1,listItem:!1}),hM.configure({depth:10,newGroupDelay:100}),Rq.configure({types:["heading","paragraph"]}),hQ,sQ.extend({exitable:!0}).configure({HTMLAttributes:{class:"text-blue-500 font-bold transition-colors cursor-pointer select-text pointer-events-auto"},openOnClick:!0,autolink:!1}),iQ.configure({placeholder:()=>"",includeChildren:!0,showOnlyCurrent:!0}),lQ.configure({multicolor:!0}),dQ.configure({HTMLAttributes:{class:"select-text pointer-events-auto"}}),Mq,gQ,uQ.configure({HTMLAttributes:{class:"not-prose space-y-4 !ml-0"}}),fQ.configure({HTMLAttributes:{class:"flex items-start"},nested:!0}),rM.configure({HTMLAttributes:{class:"space-y-4 !ml-6"}}),mM.configure({HTMLAttributes:{class:"leading-normal"}}),iM.configure({width:3,color:"#d1d5db"}),oM,QJ,dX,fX,...cX,CQ.configure({uploadFn:yV}),mQ,yQ,vQ,pX,pQ,Kte.configure({html:!0,tightLists:!0,tightListClass:"tight",bulletListMarker:"-",linkify:!0,breaks:!0,transformPastedText:!0,transformCopiedText:!1})],Qte="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAOCAYAAAD0f5bSAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAE/SURBVHgBhVJBTsJQEH3zMcElR+gRuIF6gwYPAOwkLoQTUE6ArEA3xbWJ4gnQE8gNwBuwhMR2fPNLk9o0ZZImM/P/e39e3wgqojPXXiPFJnFovw1kWT53xSKca3C70LXlr/eySYFdZ6Fb61eCePnBCb6VF3P21UA+WX+wv+086fgfyMbh4aPlqWJSZH2/k6EINlBEJI6tdxHG2tIDrsUqxYzsO5Qi+UXfNfwUPT7w49wRU1EyZWNFqIgV9REw84Wga+P1Uj7PsW5QE9pEZMT8Aq+JQmNcYl8HwgEtEvf9fc3RR4zrMCRe84WA6dJRz8upPwyftV0FOP3ugHqu0iZGzsSbF3bYUMRlgDdWMcyE4WvVl73XRC9CNiaqaHMDpkUQrYh8kmKUmy5lVpvdBNs2mOk0tptk9a5AVKHhzML+AZaSjR/r++n9AAAAAElFTkSuQmCC",Jte="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEjSURBVHgBjZJBToNQEIb/NzTeoMbGjTeoN5Au1S7wBrqwyk5OoD1B46pRF9UbsEBc9nmEHsI08QhGZnxMpaGUEv4EwoP/mxnyj0GNTp++AoPORA+Gx+mo91r1mOJh+LL0WYwDqC8i/obJGCuSfRJ1bHLdtWtQIaY5WoiYBknYtZQfmOGjpTIvC7TAahTvpMksmUQCvK0A6itzNl1egmi2k2K+2gPsD+mvHGkh4MIVoPuSLYbIYxOk3YAJVRuktwd3DhjvggqRB0Slc3D+/D1Lw95DE5Rnq3E487ySXeyu4zooz/R9tD/QUYV5Ufke1HbKvW4RdFS9icRoKeKO1c7Fi+HUbQ/BzzPdXjmxDCy8TOIk7G2CZf1nqzEJfqOPm8Otif4AFnp3K1F5HHAAAAAASUVORK5CYII=",Yte=t=>{const e=document.createElement("span");e.classList.add("collaboration-cursor__caret"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");return n.classList.add("collaboration-cursor__label"),n.setAttribute("style",`background-color: ${t.color}`),n.insertBefore(document.createTextNode(t.name),null),e.insertBefore(n,null),e},Xte=t=>{const e=document.createElement("span");e.classList.add("custom-cursor__caret"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");n.classList.add("custom-cursor__label-container"),n.setAttribute("style",`border: 1px solid ${t.color}`);const r=document.createElement("img");r.src=Qte,r.classList.add("custom-cursor__icon");const s=document.createElement("div");s.classList.add("custom-cursor__label");const i=document.createElement("span");i.classList.add("custom-cursor__text"),i.textContent=t.name;const o=document.createElement("img");return o.src=Jte,o.classList.add("custom-cursor__badge"),s.appendChild(i),n.appendChild(r),n.appendChild(s),n.appendChild(o),e.appendChild(n),e},Zte=t=>t.isEns?Xte(t):Yte(t),ene="6.13.1";function tne(t,e,n){const r=e.split("|").map(i=>i.trim());for(let i=0;i<r.length;i++)switch(e){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof t===e)return}const s=new Error(`invalid value for type ${e}`);throw s.code="INVALID_ARGUMENT",s.argument=`value.${n}`,s.value=t,s}async function Nn(t){const e=Object.keys(t);return(await Promise.all(e.map(r=>Promise.resolve(t[r])))).reduce((r,s,i)=>(r[e[i]]=s,r),{})}function Oe(t,e,n){for(let r in e){let s=e[r];const i=n?n[r]:null;i&&tne(s,i,r),Object.defineProperty(t,r,{enumerable:!0,value:s,writable:!1})}}function Ec(t){if(t==null)return"null";if(Array.isArray(t))return"[ "+t.map(Ec).join(", ")+" ]";if(t instanceof Uint8Array){const e="0123456789abcdef";let n="0x";for(let r=0;r<t.length;r++)n+=e[t[r]>>4],n+=e[t[r]&15];return n}if(typeof t=="object"&&typeof t.toJSON=="function")return Ec(t.toJSON());switch(typeof t){case"boolean":case"symbol":return t.toString();case"bigint":return BigInt(t).toString();case"number":return t.toString();case"string":return JSON.stringify(t);case"object":{const e=Object.keys(t);return e.sort(),"{ "+e.map(n=>`${Ec(n)}: ${Ec(t[n])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function gn(t,e){return t&&t.code===e}function Ax(t){return gn(t,"CALL_EXCEPTION")}function Nt(t,e,n){let r=t;{const i=[];if(n){if("message"in n||"code"in n||"name"in n)throw new Error(`value will overwrite populated values: ${Ec(n)}`);for(const o in n){if(o==="shortMessage")continue;const a=n[o];i.push(o+"="+Ec(a))}}i.push(`code=${e}`),i.push(`version=${ene}`),i.length&&(t+=" ("+i.join(", ")+")")}let s;switch(e){case"INVALID_ARGUMENT":s=new TypeError(t);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":s=new RangeError(t);break;default:s=new Error(t)}return Oe(s,{code:e}),n&&Object.assign(s,n),s.shortMessage==null&&Oe(s,{shortMessage:r}),s}function ee(t,e,n,r){if(!t)throw Nt(e,n,r)}function $(t,e,n,r){ee(t,e,"INVALID_ARGUMENT",{argument:n,value:r})}function s4(t,e,n){n==null&&(n=""),n&&(n=": "+n),ee(t>=e,"missing arguemnt"+n,"MISSING_ARGUMENT",{count:t,expectedCount:e}),ee(t<=e,"too many arguments"+n,"UNEXPECTED_ARGUMENT",{count:t,expectedCount:e})}["NFD","NFC","NFKD","NFKC"].reduce((t,e)=>{try{if("test".normalize(e)!=="test")throw new Error("bad");if(e==="NFD"&&"é".normalize("NFD")!=="é")throw new Error("broken");t.push(e)}catch{}return t},[]);function $g(t,e,n){if(n==null&&(n=""),t!==e){let r=n,s="new";n&&(r+=".",s+=" "+n),ee(!1,`private constructor; use ${r}from* methods`,"UNSUPPORTED_OPERATION",{operation:s})}}function i4(t,e,n){if(t instanceof Uint8Array)return n?new Uint8Array(t):t;if(typeof t=="string"&&t.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const r=new Uint8Array((t.length-2)/2);let s=2;for(let i=0;i<r.length;i++)r[i]=parseInt(t.substring(s,s+2),16),s+=2;return r}$(!1,"invalid BytesLike value",e||"value",t)}function ct(t,e){return i4(t,e,!1)}function Gn(t,e){return i4(t,e,!0)}function St(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||typeof e=="number"&&t.length!==2+2*e||e===!0&&t.length%2!==0)}function vx(t){return St(t,!0)||t instanceof Uint8Array}const o4="0123456789abcdef";function we(t){const e=ct(t);let n="0x";for(let r=0;r<e.length;r++){const s=e[r];n+=o4[(s&240)>>4]+o4[s&15]}return n}function $t(t){return"0x"+t.map(e=>we(e).substring(2)).join("")}function Cc(t){return St(t,!0)?(t.length-2)/2:ct(t).length}function Ht(t,e,n){const r=ct(t);return n!=null&&n>r.length&&ee(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:r,length:r.length,offset:n}),we(r.slice(e??0,n??r.length))}function a4(t,e,n){const r=ct(t);ee(e>=r.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(r),length:e,offset:e+1});const s=new Uint8Array(e);return s.fill(0),n?s.set(r,e-r.length):s.set(r,0),we(s)}function xl(t,e){return a4(t,e,!0)}function nne(t,e){return a4(t,e,!1)}const Gg=BigInt(0),Es=BigInt(1),Sc=9007199254740991;function rne(t,e){const n=Wg(t,"value"),r=BigInt(Qe(e,"width"));if(ee(n>>r===Gg,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:t}),n>>r-Es){const s=(Es<<r)-Es;return-((~n&s)+Es)}return n}function l4(t,e){let n=xe(t,"value");const r=BigInt(Qe(e,"width")),s=Es<<r-Es;if(n<Gg){n=-n,ee(n<=s,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:t});const i=(Es<<r)-Es;return(~n&i)+Es}else ee(n<s,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:t});return n}function Oh(t,e){const n=Wg(t,"value"),r=BigInt(Qe(e,"bits"));return n&(Es<<r)-Es}function xe(t,e){switch(typeof t){case"bigint":return t;case"number":return $(Number.isInteger(t),"underflow",e||"value",t),$(t>=-Sc&&t<=Sc,"overflow",e||"value",t),BigInt(t);case"string":try{if(t==="")throw new Error("empty string");return t[0]==="-"&&t[1]!=="-"?-BigInt(t.substring(1)):BigInt(t)}catch(n){$(!1,`invalid BigNumberish string: ${n.message}`,e||"value",t)}}$(!1,"invalid BigNumberish value",e||"value",t)}function Wg(t,e){const n=xe(t,e);return ee(n>=Gg,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:t}),n}const u4="0123456789abcdef";function xx(t){if(t instanceof Uint8Array){let e="0x0";for(const n of t)e+=u4[n>>4],e+=u4[n&15];return BigInt(e)}return xe(t)}function Qe(t,e){switch(typeof t){case"bigint":return $(t>=-Sc&&t<=Sc,"overflow",e||"value",t),Number(t);case"number":return $(Number.isInteger(t),"underflow",e||"value",t),$(t>=-Sc&&t<=Sc,"overflow",e||"value",t),t;case"string":try{if(t==="")throw new Error("empty string");return Qe(BigInt(t),e)}catch(n){$(!1,`invalid numeric string: ${n.message}`,e||"value",t)}}$(!1,"invalid numeric value",e||"value",t)}function sne(t){return Qe(xx(t))}function Xo(t,e){let r=Wg(t,"value").toString(16);if(e==null)r.length%2&&(r="0"+r);else{const s=Qe(e,"width");for(ee(s*2>=r.length,`value exceeds width (${s} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:t});r.length<s*2;)r="0"+r}return"0x"+r}function Wn(t){const e=Wg(t,"value");if(e===Gg)return new Uint8Array([]);let n=e.toString(16);n.length%2&&(n="0"+n);const r=new Uint8Array(n.length/2);for(let s=0;s<r.length;s++){const i=s*2;r[s]=parseInt(n.substring(i,i+2),16)}return r}function kl(t){let e=we(vx(t)?t:Wn(t)).substring(2);for(;e.startsWith("0");)e=e.substring(1);return e===""&&(e="0"),"0x"+e}const c4="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";BigInt(0);const f4=BigInt(58);function ine(t){const e=ct(t);let n=xx(e),r="";for(;n;)r=c4[Number(n%f4)]+r,n/=f4;for(let s=0;s<e.length&&!e[s];s++)r=c4[0]+r;return r}function one(t){t=atob(t);const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return ct(e)}function ane(t){const e=ct(t);let n="";for(let r=0;r<e.length;r++)n+=String.fromCharCode(e[r]);return btoa(n)}class d4{constructor(e,n,r){W(this,"filter");W(this,"emitter");J(this,ef);I(this,ef,n),Oe(this,{emitter:e,filter:r})}async removeListener(){T(this,ef)!=null&&await this.emitter.off(this.filter,T(this,ef))}}ef=new WeakMap;function lne(t,e,n,r,s){$(!1,`invalid codepoint at offset ${e}; ${t}`,"bytes",n)}function h4(t,e,n,r,s){if(t==="BAD_PREFIX"||t==="UNEXPECTED_CONTINUE"){let i=0;for(let o=e+1;o<n.length&&n[o]>>6===2;o++)i++;return i}return t==="OVERRUN"?n.length-e-1:0}function une(t,e,n,r,s){return t==="OVERLONG"?($(typeof s=="number","invalid bad code point for replacement","badCodepoint",s),r.push(s),0):(r.push(65533),h4(t,e,n))}const cne=Object.freeze({error:lne,ignore:h4,replace:une});function fne(t,e){e==null&&(e=cne.error);const n=ct(t,"bytes"),r=[];let s=0;for(;s<n.length;){const i=n[s++];if(!(i>>7)){r.push(i);continue}let o=null,a=null;if((i&224)===192)o=1,a=127;else if((i&240)===224)o=2,a=2047;else if((i&248)===240)o=3,a=65535;else{(i&192)===128?s+=e("UNEXPECTED_CONTINUE",s-1,n,r):s+=e("BAD_PREFIX",s-1,n,r);continue}if(s-1+o>=n.length){s+=e("OVERRUN",s-1,n,r);continue}let l=i&(1<<8-o-1)-1;for(let u=0;u<o;u++){let c=n[s];if((c&192)!=128){s+=e("MISSING_CONTINUE",s,n,r),l=null;break}l=l<<6|c&63,s++}if(l!==null){if(l>1114111){s+=e("OUT_OF_RANGE",s-1-o,n,r,l);continue}if(l>=55296&&l<=57343){s+=e("UTF16_SURROGATE",s-1-o,n,r,l);continue}if(l<=a){s+=e("OVERLONG",s-1-o,n,r,l);continue}r.push(l)}}return r}function Vi(t,e){$(typeof t=="string","invalid string value","str",t);let n=[];for(let r=0;r<t.length;r++){const s=t.charCodeAt(r);if(s<128)n.push(s);else if(s<2048)n.push(s>>6|192),n.push(s&63|128);else if((s&64512)==55296){r++;const i=t.charCodeAt(r);$(r<t.length&&(i&64512)===56320,"invalid surrogate pair","str",t);const o=65536+((s&1023)<<10)+(i&1023);n.push(o>>18|240),n.push(o>>12&63|128),n.push(o>>6&63|128),n.push(o&63|128)}else n.push(s>>12|224),n.push(s>>6&63|128),n.push(s&63|128)}return new Uint8Array(n)}function dne(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function Tc(t,e){return dne(fne(t,e))}function p4(t){async function e(n,r){ee(r==null||!r.cancelled,"request cancelled before sending","CANCELLED");const s=n.url.split(":")[0].toLowerCase();ee(s==="http"||s==="https",`unsupported protocol ${s}`,"UNSUPPORTED_OPERATION",{info:{protocol:s},operation:"request"}),ee(s==="https"||!n.credentials||n.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let i=null;const o=new AbortController,a=setTimeout(()=>{i=Nt("request timeout","TIMEOUT"),o.abort()},n.timeout);r&&r.addListener(()=>{i=Nt("request cancelled","CANCELLED"),o.abort()});const l={method:n.method,headers:new Headers(Array.from(n)),body:n.body||void 0,signal:o.signal};let u;try{u=await fetch(n.url,l)}catch(h){throw clearTimeout(a),i||h}clearTimeout(a);const c={};u.headers.forEach((h,p)=>{c[p.toLowerCase()]=h});const f=await u.arrayBuffer(),d=f==null?null:new Uint8Array(f);return{statusCode:u.status,statusMessage:u.statusText,headers:c,body:d}}return e}const hne=12,pne=250;let m4=p4();const mne=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),gne=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let kx=!1;async function g4(t,e){try{const n=t.match(mne);if(!n)throw new Error("invalid data");return new Zo(200,"OK",{"content-type":n[1]||"text/plain"},n[2]?one(n[3]):bne(n[3]))}catch{return new Zo(599,"BAD REQUEST (invalid data: URI)",{},null,new Kn(t))}}function y4(t){async function e(n,r){try{const s=n.match(gne);if(!s)throw new Error("invalid link");return new Kn(`${t}${s[2]}`)}catch{return new Zo(599,"BAD REQUEST (invalid IPFS URI)",{},null,new Kn(n))}}return e}const Kg={data:g4,ipfs:y4("https://gateway.ipfs.io/ipfs/")},b4=new WeakMap;class yne{constructor(e){J(this,$l);J(this,ha);I(this,$l,[]),I(this,ha,!1),b4.set(e,()=>{if(!T(this,ha)){I(this,ha,!0);for(const n of T(this,$l))setTimeout(()=>{n()},0);I(this,$l,[])}})}addListener(e){ee(!T(this,ha),"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),T(this,$l).push(e)}get cancelled(){return T(this,ha)}checkSignal(){ee(!this.cancelled,"cancelled","CANCELLED",{})}}$l=new WeakMap,ha=new WeakMap;function qg(t){if(t==null)throw new Error("missing signal; should not happen");return t.checkSignal(),t}const sb=class sb{constructor(e){J(this,ql);J(this,tf);J(this,nf);J(this,Os);J(this,ro);J(this,rf);J(this,sf);J(this,wn);J(this,Ir);J(this,so);J(this,Gl);J(this,Wl);J(this,Kl);J(this,hi);J(this,_s);J(this,pa);I(this,sf,String(e)),I(this,tf,!1),I(this,nf,!0),I(this,Os,{}),I(this,ro,""),I(this,rf,3e5),I(this,_s,{slotInterval:pne,maxAttempts:hne}),I(this,pa,null)}get url(){return T(this,sf)}set url(e){I(this,sf,String(e))}get body(){return T(this,wn)==null?null:new Uint8Array(T(this,wn))}set body(e){if(e==null)I(this,wn,void 0),I(this,Ir,void 0);else if(typeof e=="string")I(this,wn,Vi(e)),I(this,Ir,"text/plain");else if(e instanceof Uint8Array)I(this,wn,e),I(this,Ir,"application/octet-stream");else if(typeof e=="object")I(this,wn,Vi(JSON.stringify(e))),I(this,Ir,"application/json");else throw new Error("invalid body")}hasBody(){return T(this,wn)!=null}get method(){return T(this,ro)?T(this,ro):this.hasBody()?"POST":"GET"}set method(e){e==null&&(e=""),I(this,ro,String(e).toUpperCase())}get headers(){const e=Object.assign({},T(this,Os));return T(this,so)&&(e.authorization=`Basic ${ane(Vi(T(this,so)))}`),this.allowGzip&&(e["accept-encoding"]="gzip"),e["content-type"]==null&&T(this,Ir)&&(e["content-type"]=T(this,Ir)),this.body&&(e["content-length"]=String(this.body.length)),e}getHeader(e){return this.headers[e.toLowerCase()]}setHeader(e,n){T(this,Os)[String(e).toLowerCase()]=String(n)}clearHeaders(){I(this,Os,{})}[Symbol.iterator](){const e=this.headers,n=Object.keys(e);let r=0;return{next:()=>{if(r<n.length){const s=n[r++];return{value:[s,e[s]],done:!1}}return{value:void 0,done:!0}}}}get credentials(){return T(this,so)||null}setCredentials(e,n){$(!e.match(/:/),"invalid basic authentication username","username","[REDACTED]"),I(this,so,`${e}:${n}`)}get allowGzip(){return T(this,nf)}set allowGzip(e){I(this,nf,!!e)}get allowInsecureAuthentication(){return!!T(this,tf)}set allowInsecureAuthentication(e){I(this,tf,!!e)}get timeout(){return T(this,rf)}set timeout(e){$(e>=0,"timeout must be non-zero","timeout",e),I(this,rf,e)}get preflightFunc(){return T(this,Gl)||null}set preflightFunc(e){I(this,Gl,e)}get processFunc(){return T(this,Wl)||null}set processFunc(e){I(this,Wl,e)}get retryFunc(){return T(this,Kl)||null}set retryFunc(e){I(this,Kl,e)}get getUrlFunc(){return T(this,pa)||m4}set getUrlFunc(e){I(this,pa,e)}toString(){return`<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${T(this,wn)?we(T(this,wn)):"null"}>`}setThrottleParams(e){e.slotInterval!=null&&(T(this,_s).slotInterval=e.slotInterval),e.maxAttempts!=null&&(T(this,_s).maxAttempts=e.maxAttempts)}send(){return ee(T(this,hi)==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),I(this,hi,new yne(this)),fe(this,ql,Op).call(this,0,w4()+this.timeout,0,this,new Zo(0,"",{},null,this))}cancel(){ee(T(this,hi)!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const e=b4.get(this);if(!e)throw new Error("missing signal; should not happen");e()}redirect(e){const n=this.url.split(":")[0].toLowerCase(),r=e.split(":")[0].toLowerCase();ee(this.method==="GET"&&(n!=="https"||r!=="http")&&e.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})`});const s=new sb(e);return s.method="GET",s.allowGzip=this.allowGzip,s.timeout=this.timeout,I(s,Os,Object.assign({},T(this,Os))),T(this,wn)&&I(s,wn,new Uint8Array(T(this,wn))),I(s,Ir,T(this,Ir)),s}clone(){const e=new sb(this.url);return I(e,ro,T(this,ro)),T(this,wn)&&I(e,wn,T(this,wn)),I(e,Ir,T(this,Ir)),I(e,Os,Object.assign({},T(this,Os))),I(e,so,T(this,so)),this.allowGzip&&(e.allowGzip=!0),e.timeout=this.timeout,this.allowInsecureAuthentication&&(e.allowInsecureAuthentication=!0),I(e,Gl,T(this,Gl)),I(e,Wl,T(this,Wl)),I(e,Kl,T(this,Kl)),I(e,_s,Object.assign({},T(this,_s))),I(e,pa,T(this,pa)),e}static lockConfig(){kx=!0}static getGateway(e){return Kg[e.toLowerCase()]||null}static registerGateway(e,n){if(e=e.toLowerCase(),e==="http"||e==="https")throw new Error(`cannot intercept ${e}; use registerGetUrl`);if(kx)throw new Error("gateways locked");Kg[e]=n}static registerGetUrl(e){if(kx)throw new Error("gateways locked");m4=e}static createGetUrlFunc(e){return p4()}static createDataGateway(){return g4}static createIpfsGatewayFunc(e){return y4(e)}};tf=new WeakMap,nf=new WeakMap,Os=new WeakMap,ro=new WeakMap,rf=new WeakMap,sf=new WeakMap,wn=new WeakMap,Ir=new WeakMap,so=new WeakMap,Gl=new WeakMap,Wl=new WeakMap,Kl=new WeakMap,hi=new WeakMap,_s=new WeakMap,pa=new WeakMap,ql=new WeakSet,Op=async function(e,n,r,s,i){var c,f,d;if(e>=T(this,_s).maxAttempts)return i.makeServerError("exceeded maximum retry limit");ee(w4()<=n,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:s}),r>0&&await wne(r);let o=this.clone();const a=(o.url.split(":")[0]||"").toLowerCase();if(a in Kg){const h=await Kg[a](o.url,qg(T(s,hi)));if(h instanceof Zo){let p=h;if(this.processFunc){qg(T(s,hi));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,qg(T(s,hi)));let u=new Zo(l.statusCode,l.statusMessage,l.headers,l.body,s);if(u.statusCode===301||u.statusCode===302){try{const h=u.headers.location||"";return fe(c=o.redirect(h),ql,Op).call(c,e+1,n,0,s,u)}catch{}return u}else if(u.statusCode===429&&(this.retryFunc==null||await this.retryFunc(o,u,e))){const h=u.headers["retry-after"];let p=T(this,_s).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(),ql,Op).call(f,e+1,n,p,s,u)}if(this.processFunc){qg(T(s,hi));try{u=await this.processFunc(o,u)}catch(h){(h.throttle==null||typeof h.stall!="number")&&u.makeServerError("error in post-processing function",h).assertOk();let p=T(this,_s).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return h.stall>=0&&(p=h.stall),fe(d=o.clone(),ql,Op).call(d,e+1,n,p,s,u)}}return u};let Kn=sb;const Hk=class Hk{constructor(e,n,r,s,i){J(this,hp);J(this,pp);J(this,mp);J(this,Lr);J(this,of);J(this,Ql);I(this,hp,e),I(this,pp,n),I(this,mp,Object.keys(r).reduce((o,a)=>(o[a.toLowerCase()]=String(r[a]),o),{})),I(this,Lr,s==null?null:new Uint8Array(s)),I(this,of,i||null),I(this,Ql,{message:""})}toString(){return`<FetchResponse status=${this.statusCode} body=${T(this,Lr)?we(T(this,Lr)):"null"}>`}get statusCode(){return T(this,hp)}get statusMessage(){return T(this,pp)}get headers(){return Object.assign({},T(this,mp))}get body(){return T(this,Lr)==null?null:new Uint8Array(T(this,Lr))}get bodyText(){try{return T(this,Lr)==null?"":Tc(T(this,Lr))}catch{ee(!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{ee(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const e=this.headers,n=Object.keys(e);let r=0;return{next:()=>{if(r<n.length){const s=n[r++];return{value:[s,e[s]],done:!1}}return{value:void 0,done:!0}}}}makeServerError(e,n){let r;e?r=`CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${e})`:(e=`${this.statusCode} ${this.statusMessage}`,r=`CLIENT ESCALATED SERVER ERROR (${e})`);const s=new Hk(599,r,this.headers,this.body,T(this,of)||void 0);return I(s,Ql,{message:e,error:n}),s}throwThrottleError(e,n){n==null?n=-1:$(Number.isInteger(n)&&n>=0,"invalid stall timeout","stall",n);const r=new Error(e||"throttling requests");throw Oe(r,{stall:n,throttle:!0}),r}getHeader(e){return this.headers[e.toLowerCase()]}hasBody(){return T(this,Lr)!=null}get request(){return T(this,of)}ok(){return T(this,Ql).message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:e,error:n}=T(this,Ql);e===""&&(e=`server response ${this.statusCode} ${this.statusMessage}`);let r=null;this.request&&(r=this.request.url);let s=null;try{T(this,Lr)&&(s=Tc(T(this,Lr)))}catch{}ee(!1,e,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:n,info:{requestUrl:r,responseBody:s,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}};hp=new WeakMap,pp=new WeakMap,mp=new WeakMap,Lr=new WeakMap,of=new WeakMap,Ql=new WeakMap;let Zo=Hk;function w4(){return new Date().getTime()}function bne(t){return Vi(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,n)=>String.fromCharCode(parseInt(n,16))))}function wne(t){return new Promise(e=>setTimeout(e,t))}function Ane(t){let e=t.toString(16);for(;e.length<2;)e="0"+e;return"0x"+e}function A4(t,e,n){let r=0;for(let s=0;s<n;s++)r=r*256+t[e+s];return r}function v4(t,e,n,r){const s=[];for(;n<e+1+r;){const i=x4(t,n);s.push(i.result),n+=i.consumed,ee(n<=e+1+r,"child data too short","BUFFER_OVERRUN",{buffer:t,length:r,offset:e})}return{consumed:1+r,result:s}}function x4(t,e){ee(t.length!==0,"data too short","BUFFER_OVERRUN",{buffer:t,length:0,offset:1});const n=r=>{ee(r<=t.length,"data short segment too short","BUFFER_OVERRUN",{buffer:t,length:t.length,offset:r})};if(t[e]>=248){const r=t[e]-247;n(e+1+r);const s=A4(t,e+1,r);return n(e+1+r+s),v4(t,e,e+1+r,r+s)}else if(t[e]>=192){const r=t[e]-192;return n(e+1+r),v4(t,e,e+1,r)}else if(t[e]>=184){const r=t[e]-183;n(e+1+r);const s=A4(t,e+1,r);n(e+1+r+s);const i=we(t.slice(e+1+r,e+1+r+s));return{consumed:1+r+s,result:i}}else if(t[e]>=128){const r=t[e]-128;n(e+1+r);const s=we(t.slice(e+1,e+1+r));return{consumed:1+r,result:s}}return{consumed:1,result:Ane(t[e])}}function Qg(t){const e=ct(t,"data"),n=x4(e,0);return $(n.consumed===e.length,"unexpected junk after rlp payload","data",t),n.result}function k4(t){const e=[];for(;t;)e.unshift(t&255),t>>=8;return e}function E4(t){if(Array.isArray(t)){let r=[];if(t.forEach(function(i){r=r.concat(E4(i))}),r.length<=55)return r.unshift(192+r.length),r;const s=k4(r.length);return s.unshift(247+s.length),s.concat(r)}const e=Array.prototype.slice.call(ct(t,"object"));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const n=k4(e.length);return n.unshift(183+n.length),n.concat(e)}const C4="0123456789abcdef";function El(t){let e="0x";for(const n of E4(t))e+=C4[n>>4],e+=C4[n&15];return e}const qn=32,Ex=new Uint8Array(qn),vne=["then"],Jg={},S4=new WeakMap;function Cl(t){return S4.get(t)}function T4(t,e){S4.set(t,e)}function _h(t,e){const n=new Error(`deferred error during ABI decoding triggered accessing ${t}`);throw n.error=e,n}function Cx(t,e,n){return t.indexOf(null)>=0?e.map((r,s)=>r instanceof Dc?Cx(Cl(r),r,n):r):t.reduce((r,s,i)=>{let o=e.getValue(s);return s in r||(n&&o instanceof Dc&&(o=Cx(Cl(o),o,n)),r[s]=o),r},{})}const lf=class lf extends Array{constructor(...n){const r=n[0];let s=n[1],i=(n[2]||[]).slice(),o=!0;r!==Jg&&(s=n,i=[],o=!1);super(s.length);J(this,af);s.forEach((u,c)=>{this[c]=u});const a=i.reduce((u,c)=>(typeof c=="string"&&u.set(c,(u.get(c)||0)+1),u),new Map);if(T4(this,Object.freeze(s.map((u,c)=>{const f=i[c];return f!=null&&a.get(f)===1?f:null}))),I(this,af,[]),T(this,af)==null&&T(this,af),!o)return;Object.freeze(this);const l=new Proxy(this,{get:(u,c,f)=>{if(typeof c=="string"){if(c.match(/^[0-9]+$/)){const h=Qe(c,"%index");if(h<0||h>=this.length)throw new RangeError("out of result range");const p=u[h];return p instanceof Error&&_h(`index ${h}`,p),p}if(vne.indexOf(c)>=0)return Reflect.get(u,c,f);const d=u[c];if(d instanceof Function)return function(...h){return d.apply(this===f?u:this,h)};if(!(c in u))return u.getValue.apply(this===f?u:this,[c])}return Reflect.get(u,c,f)}});return T4(l,Cl(this)),l}toArray(n){const r=[];return this.forEach((s,i)=>{s instanceof Error&&_h(`index ${i}`,s),n&&s instanceof lf&&(s=s.toArray(n)),r.push(s)}),r}toObject(n){const r=Cl(this);return r.reduce((s,i,o)=>(ee(i!=null,`value at index ${o} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),Cx(r,this,n)),{})}slice(n,r){n==null&&(n=0),n<0&&(n+=this.length,n<0&&(n=0)),r==null&&(r=this.length),r<0&&(r+=this.length,r<0&&(r=0)),r>this.length&&(r=this.length);const s=Cl(this),i=[],o=[];for(let a=n;a<r;a++)i.push(this[a]),o.push(s[a]);return new lf(Jg,i,o)}filter(n,r){const s=Cl(this),i=[],o=[];for(let a=0;a<this.length;a++){const l=this[a];l instanceof Error&&_h(`index ${a}`,l),n.call(r,l,a,this)&&(i.push(l),o.push(s[a]))}return new lf(Jg,i,o)}map(n,r){const s=[];for(let i=0;i<this.length;i++){const o=this[i];o instanceof Error&&_h(`index ${i}`,o),s.push(n.call(r,o,i,this))}return s}getValue(n){const r=Cl(this).indexOf(n);if(r===-1)return;const s=this[r];return s instanceof Error&&_h(`property ${JSON.stringify(n)}`,s.error),s}static fromItems(n,r){return new lf(Jg,n,r)}};af=new WeakMap;let Dc=lf;function D4(t){let e=Wn(t);return ee(e.length<=qn,"value out-of-bounds","BUFFER_OVERRUN",{buffer:e,length:qn,offset:e.length}),e.length!==qn&&(e=Gn($t([Ex.slice(e.length%qn),e]))),e}class Hi{constructor(e,n,r,s){W(this,"name");W(this,"type");W(this,"localName");W(this,"dynamic");Oe(this,{name:e,type:n,localName:r,dynamic:s},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(e,n){$(!1,e,this.localName,n)}}class Sx{constructor(){J(this,uf);J(this,io);J(this,Jl);I(this,io,[]),I(this,Jl,0)}get data(){return $t(T(this,io))}get length(){return T(this,Jl)}appendWriter(e){return fe(this,uf,fb).call(this,Gn(e.data))}writeBytes(e){let n=Gn(e);const r=n.length%qn;return r&&(n=Gn($t([n,Ex.slice(r)]))),fe(this,uf,fb).call(this,n)}writeValue(e){return fe(this,uf,fb).call(this,D4(e))}writeUpdatableValue(){const e=T(this,io).length;return T(this,io).push(Ex),I(this,Jl,T(this,Jl)+qn),n=>{T(this,io)[e]=D4(n)}}}io=new WeakMap,Jl=new WeakMap,uf=new WeakSet,fb=function(e){return T(this,io).push(e),I(this,Jl,T(this,Jl)+e.length),e.length};const zk=class zk{constructor(e,n,r){J(this,Zl);W(this,"allowLoose");J(this,pr);J(this,Br);J(this,Yl);J(this,Xl);J(this,ma);Oe(this,{allowLoose:!!n}),I(this,pr,Gn(e)),I(this,Yl,0),I(this,Xl,null),I(this,ma,r??1024),I(this,Br,0)}get data(){return we(T(this,pr))}get dataLength(){return T(this,pr).length}get consumed(){return T(this,Br)}get bytes(){return new Uint8Array(T(this,pr))}subReader(e){const n=new zk(T(this,pr).slice(T(this,Br)+e),this.allowLoose,T(this,ma));return I(n,Xl,this),n}readBytes(e,n){let r=fe(this,Zl,qL).call(this,0,e,!!n);return fe(this,Zl,Xk).call(this,e),I(this,Br,T(this,Br)+r.length),r.slice(0,e)}readValue(){return xx(this.readBytes(qn))}readIndex(){return sne(this.readBytes(qn))}};pr=new WeakMap,Br=new WeakMap,Yl=new WeakMap,Xl=new WeakMap,ma=new WeakMap,Zl=new WeakSet,Xk=function(e){var n;if(T(this,Xl))return fe(n=T(this,Xl),Zl,Xk).call(n,e);I(this,Yl,T(this,Yl)+e),ee(T(this,ma)<1||T(this,Yl)<=T(this,ma)*this.dataLength,`compressed ABI data exceeds inflation ratio of ${T(this,ma)} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:Gn(T(this,pr)),offset:T(this,Br),length:e,info:{bytesRead:T(this,Yl),dataLength:this.dataLength}})},qL=function(e,n,r){let s=Math.ceil(n/qn)*qn;return T(this,Br)+s>T(this,pr).length&&(this.allowLoose&&r&&T(this,Br)+n<=T(this,pr).length?s=n:ee(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:Gn(T(this,pr)),length:T(this,pr).length,offset:T(this,Br)+s})),T(this,pr).slice(T(this,Br),T(this,Br)+s)};let Tx=zk;function Yg(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function Dx(t,...e){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function xne(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Yg(t.outputLen),Yg(t.blockLen)}function Oc(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function O4(t,e){Dx(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}const Ox=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _4=t=>t instanceof Uint8Array,kne=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),_x=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),ui=(t,e)=>t<<32-e|t>>>e;if(!(new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68))throw new Error("Non little-endian hardware is not supported");function Ene(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function Xg(t){if(typeof t=="string"&&(t=Ene(t)),!_4(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}function Cne(...t){const e=new Uint8Array(t.reduce((r,s)=>r+s.length,0));let n=0;return t.forEach(r=>{if(!_4(r))throw new Error("Uint8Array expected");e.set(r,n),n+=r.length}),e}class Mx{clone(){return this._cloneInto()}}function Nx(t){const e=r=>t().update(Xg(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function Sne(t=32){if(Ox&&typeof Ox.getRandomValues=="function")return Ox.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}class M4 extends Mx{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,xne(e);const r=Xg(n);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,i=new Uint8Array(s);i.set(r.length>s?e.create().update(r).digest():r);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=e.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),i.fill(0)}update(e){return Oc(this),this.iHash.update(e),this}digestInto(e){Oc(this),Dx(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:s,destroyed:i,blockLen:o,outputLen:a}=this;return e=e,e.finished=s,e.destroyed=i,e.blockLen=o,e.outputLen=a,e.oHash=n._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const N4=(t,e,n)=>new M4(t,e).update(n).digest();N4.create=(t,e)=>new M4(t,e);function Tne(t,e,n,r){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,n,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(n>>s&i),a=Number(n&i),l=r?4:0,u=r?0:4;t.setUint32(e+l,o,r),t.setUint32(e+u,a,r)}class R4 extends Mx{constructor(e,n,r,s){super(),this.blockLen=e,this.outputLen=n,this.padOffset=r,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=_x(this.buffer)}update(e){Oc(this);const{view:n,buffer:r,blockLen:s}=this;e=Xg(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=_x(e);for(;s<=i-o;o+=s)this.process(l,o);continue}r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Oc(this),O4(e,this),this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:i}=this;let{pos:o}=this;n[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>s-o&&(this.process(r,0),o=0);for(let f=o;f<s;f++)n[f]=0;Tne(r,s-8,BigInt(this.length*8),i),this.process(r,0);const a=_x(e),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=l/4,c=this.get();if(u>c.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)a.setUint32(4*f,c[f],i)}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:n,buffer:r,length:s,finished:i,destroyed:o,pos:a}=this;return e.length=s,e.pos=a,e.finished=i,e.destroyed=o,s%n&&e.buffer.set(r),e}}const Dne=(t,e,n)=>t&e^~t&n,One=(t,e,n)=>t&e^t&n^e&n,_ne=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]),ea=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ta=new Uint32Array(64);class Mne extends R4{constructor(){super(64,32,8,!1),this.A=ea[0]|0,this.B=ea[1]|0,this.C=ea[2]|0,this.D=ea[3]|0,this.E=ea[4]|0,this.F=ea[5]|0,this.G=ea[6]|0,this.H=ea[7]|0}get(){const{A:e,B:n,C:r,D:s,E:i,F:o,G:a,H:l}=this;return[e,n,r,s,i,o,a,l]}set(e,n,r,s,i,o,a,l){this.A=e|0,this.B=n|0,this.C=r|0,this.D=s|0,this.E=i|0,this.F=o|0,this.G=a|0,this.H=l|0}process(e,n){for(let f=0;f<16;f++,n+=4)ta[f]=e.getUint32(n,!1);for(let f=16;f<64;f++){const d=ta[f-15],h=ta[f-2],p=ui(d,7)^ui(d,18)^d>>>3,m=ui(h,17)^ui(h,19)^h>>>10;ta[f]=m+ta[f-7]+p+ta[f-16]|0}let{A:r,B:s,C:i,D:o,E:a,F:l,G:u,H:c}=this;for(let f=0;f<64;f++){const d=ui(a,6)^ui(a,11)^ui(a,25),h=c+d+Dne(a,l,u)+_ne[f]+ta[f]|0,m=(ui(r,2)^ui(r,13)^ui(r,22))+One(r,s,i)|0;c=u,u=l,l=a,a=o+h|0,o=i,i=s,s=r,r=h+m|0}r=r+this.A|0,s=s+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,l=l+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(r,s,i,o,a,l,u,c)}roundClean(){ta.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const P4=Nx(()=>new Mne),Zg=BigInt(2**32-1),Rx=BigInt(32);function I4(t,e=!1){return e?{h:Number(t&Zg),l:Number(t>>Rx&Zg)}:{h:Number(t>>Rx&Zg)|0,l:Number(t&Zg)|0}}function L4(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let s=0;s<t.length;s++){const{h:i,l:o}=I4(t[s],e);[n[s],r[s]]=[i,o]}return[n,r]}const Nne=(t,e)=>BigInt(t>>>0)<<Rx|BigInt(e>>>0),Rne=(t,e,n)=>t>>>n,Pne=(t,e,n)=>t<<32-n|e>>>n,Ine=(t,e,n)=>t>>>n|e<<32-n,Lne=(t,e,n)=>t<<32-n|e>>>n,Bne=(t,e,n)=>t<<64-n|e>>>n-32,Fne=(t,e,n)=>t>>>n-32|e<<64-n,jne=(t,e)=>e,Une=(t,e)=>t,B4=(t,e,n)=>t<<n|e>>>32-n,F4=(t,e,n)=>e<<n|t>>>32-n,j4=(t,e,n)=>e<<n-32|t>>>64-n,U4=(t,e,n)=>t<<n-32|e>>>64-n;function Vne(t,e,n,r){const s=(e>>>0)+(r>>>0);return{h:t+n+(s/2**32|0)|0,l:s|0}}const Ze={fromBig:I4,split:L4,toBig:Nne,shrSH:Rne,shrSL:Pne,rotrSH:Ine,rotrSL:Lne,rotrBH:Bne,rotrBL:Fne,rotr32H:jne,rotr32L:Une,rotlSH:B4,rotlSL:F4,rotlBH:j4,rotlBL:U4,add:Vne,add3L:(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),add3H:(t,e,n,r)=>e+n+r+(t/2**32|0)|0,add4L:(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),add4H:(t,e,n,r,s)=>e+n+r+s+(t/2**32|0)|0,add5H:(t,e,n,r,s,i)=>e+n+r+s+i+(t/2**32|0)|0,add5L:(t,e,n,r,s)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(s>>>0)},[Hne,zne]=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(t=>BigInt(t))),na=new Uint32Array(80),ra=new Uint32Array(80);class $ne extends R4{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:n,Bh:r,Bl:s,Ch:i,Cl:o,Dh:a,Dl:l,Eh:u,El:c,Fh:f,Fl:d,Gh:h,Gl:p,Hh:m,Hl:g}=this;return[e,n,r,s,i,o,a,l,u,c,f,d,h,p,m,g]}set(e,n,r,s,i,o,a,l,u,c,f,d,h,p,m,g){this.Ah=e|0,this.Al=n|0,this.Bh=r|0,this.Bl=s|0,this.Ch=i|0,this.Cl=o|0,this.Dh=a|0,this.Dl=l|0,this.Eh=u|0,this.El=c|0,this.Fh=f|0,this.Fl=d|0,this.Gh=h|0,this.Gl=p|0,this.Hh=m|0,this.Hl=g|0}process(e,n){for(let w=0;w<16;w++,n+=4)na[w]=e.getUint32(n),ra[w]=e.getUint32(n+=4);for(let w=16;w<80;w++){const A=na[w-15]|0,x=ra[w-15]|0,k=Ze.rotrSH(A,x,1)^Ze.rotrSH(A,x,8)^Ze.shrSH(A,x,7),C=Ze.rotrSL(A,x,1)^Ze.rotrSL(A,x,8)^Ze.shrSL(A,x,7),O=na[w-2]|0,_=ra[w-2]|0,D=Ze.rotrSH(O,_,19)^Ze.rotrBH(O,_,61)^Ze.shrSH(O,_,6),R=Ze.rotrSL(O,_,19)^Ze.rotrBL(O,_,61)^Ze.shrSL(O,_,6),L=Ze.add4L(C,R,ra[w-7],ra[w-16]),F=Ze.add4H(L,k,D,na[w-7],na[w-16]);na[w]=F|0,ra[w]=L|0}let{Ah:r,Al:s,Bh:i,Bl:o,Ch:a,Cl:l,Dh:u,Dl:c,Eh:f,El:d,Fh:h,Fl:p,Gh:m,Gl:g,Hh:y,Hl:v}=this;for(let w=0;w<80;w++){const A=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),k=f&h^~f&m,C=d&p^~d&g,O=Ze.add5L(v,x,C,zne[w],ra[w]),_=Ze.add5H(O,y,A,k,Hne[w],na[w]),D=O|0,R=Ze.rotrSH(r,s,28)^Ze.rotrBH(r,s,34)^Ze.rotrBH(r,s,39),L=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;y=m|0,v=g|0,m=h|0,g=p|0,h=f|0,p=d|0,{h:f,l:d}=Ze.add(u|0,c|0,_|0,D|0),u=a|0,c=l|0,a=i|0,l=o|0,i=r|0,o=s|0;const B=Ze.add3L(D,L,G);r=Ze.add3H(B,_,R,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:u,l:c}=Ze.add(this.Dh|0,this.Dl|0,u|0,c|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:g}=Ze.add(this.Gh|0,this.Gl|0,m|0,g|0),{h:y,l:v}=Ze.add(this.Hh|0,this.Hl|0,y|0,v|0),this.set(r,s,i,o,a,l,u,c,f,d,h,p,m,g,y,v)}roundClean(){na.fill(0),ra.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 Gne=Nx(()=>new $ne);function Wne(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}const V4=Wne();V4.crypto||V4.msCrypto;function Kne(t){switch(t){case"sha256":return P4.create();case"sha512":return Gne.create()}$(!1,"invalid hashing algorithm name","algorithm",t)}const[H4,z4,$4]=[[],[],[]],qne=BigInt(0),Mh=BigInt(1),Qne=BigInt(2),Jne=BigInt(7),Yne=BigInt(256),Xne=BigInt(113);for(let t=0,e=Mh,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],H4.push(2*(5*r+n)),z4.push((t+1)*(t+2)/2%64);let s=qne;for(let i=0;i<7;i++)e=(e<<Mh^(e>>Jne)*Xne)%Yne,e&Qne&&(s^=Mh<<(Mh<<BigInt(i))-Mh);$4.push(s)}const[Zne,ere]=L4($4,!0),G4=(t,e,n)=>n>32?j4(t,e,n):B4(t,e,n),W4=(t,e,n)=>n>32?U4(t,e,n):F4(t,e,n);function tre(t,e=24){const n=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let o=0;o<10;o++)n[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,l=(o+2)%10,u=n[l],c=n[l+1],f=G4(u,c,1)^n[a],d=W4(u,c,1)^n[a+1];for(let h=0;h<50;h+=10)t[o+h]^=f,t[o+h+1]^=d}let s=t[2],i=t[3];for(let o=0;o<24;o++){const a=z4[o],l=G4(s,i,a),u=W4(s,i,a),c=H4[o];s=t[c],i=t[c+1],t[c]=l,t[c+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)n[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~n[(a+2)%10]&n[(a+4)%10]}t[0]^=Zne[r],t[1]^=ere[r]}n.fill(0)}class Px extends Mx{constructor(e,n,r,s=!1,i=24){if(super(),this.blockLen=e,this.suffix=n,this.outputLen=r,this.enableXOF=s,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Yg(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=kne(this.state)}keccak(){tre(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){Oc(this);const{blockLen:n,state:r}=this;e=Xg(e);const s=e.length;for(let i=0;i<s;){const o=Math.min(n-this.pos,s-i);for(let a=0;a<o;a++)r[this.pos++]^=e[i++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:n,pos:r,blockLen:s}=this;e[r]^=n,n&128&&r===s-1&&this.keccak(),e[s-1]^=128,this.keccak()}writeInto(e){Oc(this,!1),Dx(e),this.finish();const n=this.state,{blockLen:r}=this;for(let s=0,i=e.length;s<i;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,i-s);e.set(n.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Yg(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(O4(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:n,suffix:r,outputLen:s,rounds:i,enableXOF:o}=this;return e||(e=new Px(n,r,s,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=s,e.enableXOF=o,e.destroyed=this.destroyed,e}}const nre=((t,e,n)=>Nx(()=>new Px(e,t,n)))(1,136,256/8);let K4=!1;const q4=function(t){return nre(t)};let Q4=q4;function en(t){const e=ct(t,"data");return we(Q4(e))}en._=q4,en.lock=function(){K4=!0},en.register=function(t){if(K4)throw new TypeError("keccak256 is locked");Q4=t},Object.freeze(en);const J4=function(t){return Kne("sha256").update(t).digest()};let Y4=J4,X4=!1;function _c(t){const e=ct(t,"data");return we(Y4(e))}_c._=J4,_c.lock=function(){X4=!0},_c.register=function(t){if(X4)throw new Error("sha256 is locked");Y4=t},Object.freeze(_c),Object.freeze(_c);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Z4=BigInt(0),ey=BigInt(1),rre=BigInt(2),ty=t=>t instanceof Uint8Array,sre=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Mc(t){if(!ty(t))throw new Error("Uint8Array expected");let e="";for(let n=0;n<t.length;n++)e+=sre[t[n]];return e}function eR(t){const e=t.toString(16);return e.length&1?`0${e}`:e}function Ix(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}function Nc(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(e/2);for(let r=0;r<n.length;r++){const s=r*2,i=t.slice(s,s+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");n[r]=o}return n}function Sl(t){return Ix(Mc(t))}function Lx(t){if(!ty(t))throw new Error("Uint8Array expected");return Ix(Mc(Uint8Array.from(t).reverse()))}function Rc(t,e){return Nc(t.toString(16).padStart(e*2,"0"))}function Bx(t,e){return Rc(t,e).reverse()}function ire(t){return Nc(eR(t))}function Cs(t,e,n){let r;if(typeof e=="string")try{r=Nc(e)}catch(i){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${i}`)}else if(ty(e))r=Uint8Array.from(e);else throw new Error(`${t} must be hex string or Uint8Array`);const s=r.length;if(typeof n=="number"&&s!==n)throw new Error(`${t} expected ${n} bytes, got ${s}`);return r}function Nh(...t){const e=new Uint8Array(t.reduce((r,s)=>r+s.length,0));let n=0;return t.forEach(r=>{if(!ty(r))throw new Error("Uint8Array expected");e.set(r,n),n+=r.length}),e}function ore(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function are(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function lre(t){let e;for(e=0;t>Z4;t>>=ey,e+=1);return e}function ure(t,e){return t>>BigInt(e)&ey}const cre=(t,e,n)=>t|(n?ey:Z4)<<BigInt(e),Fx=t=>(rre<<BigInt(t-1))-ey,jx=t=>new Uint8Array(t),tR=t=>Uint8Array.from(t);function nR(t,e,n){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=jx(t),s=jx(t),i=0;const o=()=>{r.fill(1),s.fill(0),i=0},a=(...f)=>n(s,r,...f),l=(f=jx())=>{s=a(tR([0]),f),r=a(),f.length!==0&&(s=a(tR([1]),f),r=a())},u=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const d=[];for(;f<e;){r=a();const h=r.slice();d.push(h),f+=r.length}return Nh(...d)};return(f,d)=>{o(),l(f);let h;for(;!(h=d(u()));)l();return o(),h}}const fre={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||t instanceof Uint8Array,isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function Rh(t,e,n={}){const r=(s,i,o)=>{const a=fre[i];if(typeof a!="function")throw new Error(`Invalid validator "${i}", expected function`);const l=t[s];if(!(o&&l===void 0)&&!a(l,t))throw new Error(`Invalid param ${String(s)}=${l} (${typeof l}), expected ${i}`)};for(const[s,i]of Object.entries(e))r(s,i,!1);for(const[s,i]of Object.entries(n))r(s,i,!0);return t}const dre=Object.freeze(Object.defineProperty({__proto__:null,bitGet:ure,bitLen:lre,bitMask:Fx,bitSet:cre,bytesToHex:Mc,bytesToNumberBE:Sl,bytesToNumberLE:Lx,concatBytes:Nh,createHmacDrbg:nR,ensureBytes:Cs,equalBytes:ore,hexToBytes:Nc,hexToNumber:Ix,numberToBytesBE:Rc,numberToBytesLE:Bx,numberToHexUnpadded:eR,numberToVarBytesBE:ire,utf8ToBytes:are,validateObject:Rh},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const yn=BigInt(0),Gt=BigInt(1),Tl=BigInt(2),hre=BigInt(3),Ux=BigInt(4),rR=BigInt(5),sR=BigInt(8);BigInt(9),BigInt(16);function fr(t,e){const n=t%e;return n>=yn?n:e+n}function pre(t,e,n){if(n<=yn||e<yn)throw new Error("Expected power/modulo > 0");if(n===Gt)return yn;let r=Gt;for(;e>yn;)e&Gt&&(r=r*t%n),t=t*t%n,e>>=Gt;return r}function Xr(t,e,n){let r=t;for(;e-- >yn;)r*=r,r%=n;return r}function Vx(t,e){if(t===yn||e<=yn)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=fr(t,e),r=e,s=yn,i=Gt;for(;n!==yn;){const a=r/n,l=r%n,u=s-i*a;r=n,n=l,s=i,i=u}if(r!==Gt)throw new Error("invert: does not exist");return fr(s,e)}function mre(t){const e=(t-Gt)/Tl;let n,r,s;for(n=t-Gt,r=0;n%Tl===yn;n/=Tl,r++);for(s=Tl;s<t&&pre(s,e,t)!==t-Gt;s++);if(r===1){const o=(t+Gt)/Ux;return function(l,u){const c=l.pow(u,o);if(!l.eql(l.sqr(c),u))throw new Error("Cannot find square root");return c}}const i=(n+Gt)/Tl;return function(a,l){if(a.pow(l,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let u=r,c=a.pow(a.mul(a.ONE,s),n),f=a.pow(l,i),d=a.pow(l,n);for(;!a.eql(d,a.ONE);){if(a.eql(d,a.ZERO))return a.ZERO;let h=1;for(let m=a.sqr(d);h<u&&!a.eql(m,a.ONE);h++)m=a.sqr(m);const p=a.pow(c,Gt<<BigInt(u-h-1));c=a.sqr(p),f=a.mul(f,p),d=a.mul(d,c),u=h}return f}}function gre(t){if(t%Ux===hre){const e=(t+Gt)/Ux;return function(r,s){const i=r.pow(s,e);if(!r.eql(r.sqr(i),s))throw new Error("Cannot find square root");return i}}if(t%sR===rR){const e=(t-rR)/sR;return function(r,s){const i=r.mul(s,Tl),o=r.pow(i,e),a=r.mul(s,o),l=r.mul(r.mul(a,Tl),o),u=r.mul(a,r.sub(l,r.ONE));if(!r.eql(r.sqr(u),s))throw new Error("Cannot find square root");return u}}return mre(t)}const yre=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function bre(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=yre.reduce((r,s)=>(r[s]="function",r),e);return Rh(t,n)}function wre(t,e,n){if(n<yn)throw new Error("Expected power > 0");if(n===yn)return t.ONE;if(n===Gt)return e;let r=t.ONE,s=e;for(;n>yn;)n&Gt&&(r=t.mul(r,s)),s=t.sqr(s),n>>=Gt;return r}function Are(t,e){const n=new Array(e.length),r=e.reduce((i,o,a)=>t.is0(o)?i:(n[a]=i,t.mul(i,o)),t.ONE),s=t.inv(r);return e.reduceRight((i,o,a)=>t.is0(o)?i:(n[a]=t.mul(i,n[a]),t.mul(i,o)),s),n}function iR(t,e){const n=e!==void 0?e:t.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function vre(t,e,n=!1,r={}){if(t<=yn)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:s,nByteLength:i}=iR(t,e);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=gre(t),a=Object.freeze({ORDER:t,BITS:s,BYTES:i,MASK:Fx(s),ZERO:yn,ONE:Gt,create:l=>fr(l,t),isValid:l=>{if(typeof l!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof l}`);return yn<=l&&l<t},is0:l=>l===yn,isOdd:l=>(l&Gt)===Gt,neg:l=>fr(-l,t),eql:(l,u)=>l===u,sqr:l=>fr(l*l,t),add:(l,u)=>fr(l+u,t),sub:(l,u)=>fr(l-u,t),mul:(l,u)=>fr(l*u,t),pow:(l,u)=>wre(a,l,u),div:(l,u)=>fr(l*Vx(u,t),t),sqrN:l=>l*l,addN:(l,u)=>l+u,subN:(l,u)=>l-u,mulN:(l,u)=>l*u,inv:l=>Vx(l,t),sqrt:r.sqrt||(l=>o(a,l)),invertBatch:l=>Are(a,l),cmov:(l,u,c)=>c?u:l,toBytes:l=>n?Bx(l,i):Rc(l,i),fromBytes:l=>{if(l.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${l.length}`);return n?Lx(l):Sl(l)}});return Object.freeze(a)}function oR(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function aR(t){const e=oR(t);return e+Math.ceil(e/2)}function xre(t,e,n=!1){const r=t.length,s=oR(e),i=aR(e);if(r<16||r<i||r>1024)throw new Error(`expected ${i}-1024 bytes of input, got ${r}`);const o=n?Sl(t):Lx(t),a=fr(o,e-Gt)+Gt;return n?Bx(a,s):Rc(a,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const kre=BigInt(0),Hx=BigInt(1);function Ere(t,e){const n=(s,i)=>{const o=i.negate();return s?o:i},r=s=>{const i=Math.ceil(e/s)+1,o=2**(s-1);return{windows:i,windowSize:o}};return{constTimeNegate:n,unsafeLadder(s,i){let o=t.ZERO,a=s;for(;i>kre;)i&Hx&&(o=o.add(a)),a=a.double(),i>>=Hx;return o},precomputeWindow(s,i){const{windows:o,windowSize:a}=r(i),l=[];let u=s,c=u;for(let f=0;f<o;f++){c=u,l.push(c);for(let d=1;d<a;d++)c=c.add(u),l.push(c);u=c.double()}return l},wNAF(s,i,o){const{windows:a,windowSize:l}=r(s);let u=t.ZERO,c=t.BASE;const f=BigInt(2**s-1),d=2**s,h=BigInt(s);for(let p=0;p<a;p++){const m=p*l;let g=Number(o&f);o>>=h,g>l&&(g-=d,o+=Hx);const y=m,v=m+Math.abs(g)-1,w=p%2!==0,A=g<0;g===0?c=c.add(n(w,i[y])):u=u.add(n(A,i[v]))}return{p:u,f:c}},wNAFCached(s,i,o,a){const l=s._WINDOW_SIZE||1;let u=i.get(s);return u||(u=this.precomputeWindow(s,l),l!==1&&i.set(s,a(u))),this.wNAF(l,u,o)}}}function lR(t){return bre(t.Fp),Rh(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...iR(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Cre(t){const e=lR(t);Rh(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:s}=e;if(n){if(!r.eql(s,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:Sre,hexToBytes:Tre}=dre,Dl={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){const{Err:e}=Dl;if(t.length<2||t[0]!==2)throw new e("Invalid signature integer tag");const n=t[1],r=t.subarray(2,n+2);if(!n||r.length!==n)throw new e("Invalid signature integer: wrong length");if(r[0]&128)throw new e("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:Sre(r),l:t.subarray(n+2)}},toSig(t){const{Err:e}=Dl,n=typeof t=="string"?Tre(t):t;if(!(n instanceof Uint8Array))throw new Error("ui8a expected");let r=n.length;if(r<2||n[0]!=48)throw new e("Invalid signature tag");if(n[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:s,l:i}=Dl._parseInt(n.subarray(2)),{d:o,l:a}=Dl._parseInt(i);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:s,s:o}},hexFromSig(t){const e=u=>Number.parseInt(u[0],16)&8?"00"+u:u,n=u=>{const c=u.toString(16);return c.length&1?`0${c}`:c},r=e(n(t.s)),s=e(n(t.r)),i=r.length/2,o=s.length/2,a=n(i),l=n(o);return`30${n(o+i+4)}02${l}${s}02${a}${r}`}},zi=BigInt(0),Zr=BigInt(1);BigInt(2);const uR=BigInt(3);BigInt(4);function Dre(t){const e=Cre(t),{Fp:n}=e,r=e.toBytes||((p,m,g)=>{const y=m.toAffine();return Nh(Uint8Array.from([4]),n.toBytes(y.x),n.toBytes(y.y))}),s=e.fromBytes||(p=>{const m=p.subarray(1),g=n.fromBytes(m.subarray(0,n.BYTES)),y=n.fromBytes(m.subarray(n.BYTES,2*n.BYTES));return{x:g,y}});function i(p){const{a:m,b:g}=e,y=n.sqr(p),v=n.mul(y,p);return n.add(n.add(v,n.mul(p,m)),g)}if(!n.eql(n.sqr(e.Gy),i(e.Gx)))throw new Error("bad generator point: equation left != right");function o(p){return typeof p=="bigint"&&zi<p&&p<e.n}function a(p){if(!o(p))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function l(p){const{allowedPrivateKeyLengths:m,nByteLength:g,wrapPrivateKey:y,n:v}=e;if(m&&typeof p!="bigint"){if(p instanceof Uint8Array&&(p=Mc(p)),typeof p!="string"||!m.includes(p.length))throw new Error("Invalid key");p=p.padStart(g*2,"0")}let w;try{w=typeof p=="bigint"?p:Sl(Cs("private key",p,g))}catch{throw new Error(`private key must be ${g} bytes, hex or bigint, not ${typeof p}`)}return y&&(w=fr(w,v)),a(w),w}const u=new Map;function c(p){if(!(p instanceof f))throw new Error("ProjectivePoint expected")}class f{constructor(m,g,y){if(this.px=m,this.py=g,this.pz=y,m==null||!n.isValid(m))throw new Error("x required");if(g==null||!n.isValid(g))throw new Error("y required");if(y==null||!n.isValid(y))throw new Error("z required")}static fromAffine(m){const{x:g,y}=m||{};if(!m||!n.isValid(g)||!n.isValid(y))throw new Error("invalid affine point");if(m instanceof f)throw new Error("projective point not allowed");const v=w=>n.eql(w,n.ZERO);return v(g)&&v(y)?f.ZERO:new f(g,y,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(m){const g=n.invertBatch(m.map(y=>y.pz));return m.map((y,v)=>y.toAffine(g[v])).map(f.fromAffine)}static fromHex(m){const g=f.fromAffine(s(Cs("pointHex",m)));return g.assertValidity(),g}static fromPrivateKey(m){return f.BASE.multiply(l(m))}_setWindowSize(m){this._WINDOW_SIZE=m,u.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:m,y:g}=this.toAffine();if(!n.isValid(m)||!n.isValid(g))throw new Error("bad point: x or y not FE");const y=n.sqr(g),v=i(m);if(!n.eql(y,v))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:m}=this.toAffine();if(n.isOdd)return!n.isOdd(m);throw new Error("Field doesn't support isOdd")}equals(m){c(m);const{px:g,py:y,pz:v}=this,{px:w,py:A,pz:x}=m,k=n.eql(n.mul(g,x),n.mul(w,v)),C=n.eql(n.mul(y,x),n.mul(A,v));return k&&C}negate(){return new f(this.px,n.neg(this.py),this.pz)}double(){const{a:m,b:g}=e,y=n.mul(g,uR),{px:v,py:w,pz:A}=this;let x=n.ZERO,k=n.ZERO,C=n.ZERO,O=n.mul(v,v),_=n.mul(w,w),D=n.mul(A,A),R=n.mul(v,w);return R=n.add(R,R),C=n.mul(v,A),C=n.add(C,C),x=n.mul(m,C),k=n.mul(y,D),k=n.add(x,k),x=n.sub(_,k),k=n.add(_,k),k=n.mul(x,k),x=n.mul(R,x),C=n.mul(y,C),D=n.mul(m,D),R=n.sub(O,D),R=n.mul(m,R),R=n.add(R,C),C=n.add(O,O),O=n.add(C,O),O=n.add(O,D),O=n.mul(O,R),k=n.add(k,O),D=n.mul(w,A),D=n.add(D,D),O=n.mul(D,R),x=n.sub(x,O),C=n.mul(D,_),C=n.add(C,C),C=n.add(C,C),new f(x,k,C)}add(m){c(m);const{px:g,py:y,pz:v}=this,{px:w,py:A,pz:x}=m;let k=n.ZERO,C=n.ZERO,O=n.ZERO;const _=e.a,D=n.mul(e.b,uR);let R=n.mul(g,w),L=n.mul(y,A),F=n.mul(v,x),G=n.add(g,y),B=n.add(w,A);G=n.mul(G,B),B=n.add(R,L),G=n.sub(G,B),B=n.add(g,v);let H=n.add(w,x);return B=n.mul(B,H),H=n.add(R,F),B=n.sub(B,H),H=n.add(y,v),k=n.add(A,x),H=n.mul(H,k),k=n.add(L,F),H=n.sub(H,k),O=n.mul(_,B),k=n.mul(D,F),O=n.add(k,O),k=n.sub(L,O),O=n.add(L,O),C=n.mul(k,O),L=n.add(R,R),L=n.add(L,R),F=n.mul(_,F),B=n.mul(D,B),L=n.add(L,F),F=n.sub(R,F),F=n.mul(_,F),B=n.add(B,F),R=n.mul(L,B),C=n.add(C,R),R=n.mul(H,B),k=n.mul(G,k),k=n.sub(k,R),R=n.mul(G,L),O=n.mul(H,O),O=n.add(O,R),new f(k,C,O)}subtract(m){return this.add(m.negate())}is0(){return this.equals(f.ZERO)}wNAF(m){return h.wNAFCached(this,u,m,g=>{const y=n.invertBatch(g.map(v=>v.pz));return g.map((v,w)=>v.toAffine(y[w])).map(f.fromAffine)})}multiplyUnsafe(m){const g=f.ZERO;if(m===zi)return g;if(a(m),m===Zr)return this;const{endo:y}=e;if(!y)return h.unsafeLadder(this,m);let{k1neg:v,k1:w,k2neg:A,k2:x}=y.splitScalar(m),k=g,C=g,O=this;for(;w>zi||x>zi;)w&Zr&&(k=k.add(O)),x&Zr&&(C=C.add(O)),O=O.double(),w>>=Zr,x>>=Zr;return v&&(k=k.negate()),A&&(C=C.negate()),C=new f(n.mul(C.px,y.beta),C.py,C.pz),k.add(C)}multiply(m){a(m);let g=m,y,v;const{endo:w}=e;if(w){const{k1neg:A,k1:x,k2neg:k,k2:C}=w.splitScalar(g);let{p:O,f:_}=this.wNAF(x),{p:D,f:R}=this.wNAF(C);O=h.constTimeNegate(A,O),D=h.constTimeNegate(k,D),D=new f(n.mul(D.px,w.beta),D.py,D.pz),y=O.add(D),v=_.add(R)}else{const{p:A,f:x}=this.wNAF(g);y=A,v=x}return f.normalizeZ([y,v])[0]}multiplyAndAddUnsafe(m,g,y){const v=f.BASE,w=(x,k)=>k===zi||k===Zr||!x.equals(v)?x.multiplyUnsafe(k):x.multiply(k),A=w(this,g).add(w(m,y));return A.is0()?void 0:A}toAffine(m){const{px:g,py:y,pz:v}=this,w=this.is0();m==null&&(m=w?n.ONE:n.inv(v));const A=n.mul(g,m),x=n.mul(y,m),k=n.mul(v,m);if(w)return{x:n.ZERO,y:n.ZERO};if(!n.eql(k,n.ONE))throw new Error("invZ was invalid");return{x:A,y:x}}isTorsionFree(){const{h:m,isTorsionFree:g}=e;if(m===Zr)return!0;if(g)return g(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:m,clearCofactor:g}=e;return m===Zr?this:g?g(f,this):this.multiplyUnsafe(e.h)}toRawBytes(m=!0){return this.assertValidity(),r(f,this,m)}toHex(m=!0){return Mc(this.toRawBytes(m))}}f.BASE=new f(e.Gx,e.Gy,n.ONE),f.ZERO=new f(n.ZERO,n.ONE,n.ZERO);const d=e.nBitLength,h=Ere(f,e.endo?Math.ceil(d/2):d);return{CURVE:e,ProjectivePoint:f,normPrivateKeyToScalar:l,weierstrassEquation:i,isWithinCurveOrder:o}}function Ore(t){const e=lR(t);return Rh(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function _re(t){const e=Ore(t),{Fp:n,n:r}=e,s=n.BYTES+1,i=2*n.BYTES+1;function o(B){return zi<B&&B<n.ORDER}function a(B){return fr(B,r)}function l(B){return Vx(B,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:c,weierstrassEquation:f,isWithinCurveOrder:d}=Dre({...e,toBytes(B,H,Q){const te=H.toAffine(),Z=n.toBytes(te.x),pe=Nh;return Q?pe(Uint8Array.from([H.hasEvenY()?2:3]),Z):pe(Uint8Array.from([4]),Z,n.toBytes(te.y))},fromBytes(B){const H=B.length,Q=B[0],te=B.subarray(1);if(H===s&&(Q===2||Q===3)){const Z=Sl(te);if(!o(Z))throw new Error("Point is not on curve");const pe=f(Z);let Ee=n.sqrt(pe);const Re=(Ee&Zr)===Zr;return(Q&1)===1!==Re&&(Ee=n.neg(Ee)),{x:Z,y:Ee}}else if(H===i&&Q===4){const Z=n.fromBytes(te.subarray(0,n.BYTES)),pe=n.fromBytes(te.subarray(n.BYTES,2*n.BYTES));return{x:Z,y:pe}}else throw new Error(`Point of length ${H} was invalid. Expected ${s} compressed bytes or ${i} uncompressed bytes`)}}),h=B=>Mc(Rc(B,e.nByteLength));function p(B){const H=r>>Zr;return B>H}function m(B){return p(B)?a(-B):B}const g=(B,H,Q)=>Sl(B.slice(H,Q));class y{constructor(H,Q,te){this.r=H,this.s=Q,this.recovery=te,this.assertValidity()}static fromCompact(H){const Q=e.nByteLength;return H=Cs("compactSignature",H,Q*2),new y(g(H,0,Q),g(H,Q,2*Q))}static fromDER(H){const{r:Q,s:te}=Dl.toSig(Cs("DER",H));return new y(Q,te)}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(H){return new y(this.r,this.s,H)}recoverPublicKey(H){const{r:Q,s:te,recovery:Z}=this,pe=C(Cs("msgHash",H));if(Z==null||![0,1,2,3].includes(Z))throw new Error("recovery id invalid");const Ee=Z===2||Z===3?Q+e.n:Q;if(Ee>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const Re=Z&1?"03":"02",Ce=u.fromHex(Re+h(Ee)),ke=l(Ee),He=a(-pe*ke),Ue=a(te*ke),ze=u.BASE.multiplyAndAddUnsafe(Ce,He,Ue);if(!ze)throw new Error("point at infinify");return ze.assertValidity(),ze}hasHighS(){return p(this.s)}normalizeS(){return this.hasHighS()?new y(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return Nc(this.toDERHex())}toDERHex(){return Dl.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Nc(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const v={isValidPrivateKey(B){try{return c(B),!0}catch{return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const B=aR(e.n);return xre(e.randomBytes(B),e.n)},precompute(B=8,H=u.BASE){return H._setWindowSize(B),H.multiply(BigInt(3)),H}};function w(B,H=!0){return u.fromPrivateKey(B).toRawBytes(H)}function A(B){const H=B instanceof Uint8Array,Q=typeof B=="string",te=(H||Q)&&B.length;return H?te===s||te===i:Q?te===2*s||te===2*i:B instanceof u}function x(B,H,Q=!0){if(A(B))throw new Error("first arg must be private key");if(!A(H))throw new Error("second arg must be public key");return u.fromHex(H).multiply(c(B)).toRawBytes(Q)}const k=e.bits2int||function(B){const H=Sl(B),Q=B.length*8-e.nBitLength;return Q>0?H>>BigInt(Q):H},C=e.bits2int_modN||function(B){return a(k(B))},O=Fx(e.nBitLength);function _(B){if(typeof B!="bigint")throw new Error("bigint expected");if(!(zi<=B&&B<O))throw new Error(`bigint expected < 2^${e.nBitLength}`);return Rc(B,e.nByteLength)}function D(B,H,Q=R){if(["recovered","canonical"].some(tt=>tt in Q))throw new Error("sign() legacy options not supported");const{hash:te,randomBytes:Z}=e;let{lowS:pe,prehash:Ee,extraEntropy:Re}=Q;pe==null&&(pe=!0),B=Cs("msgHash",B),Ee&&(B=Cs("prehashed msgHash",te(B)));const Ce=C(B),ke=c(H),He=[_(ke),_(Ce)];if(Re!=null){const tt=Re===!0?Z(n.BYTES):Re;He.push(Cs("extraEntropy",tt))}const Ue=Nh(...He),ze=Ce;function Le(tt){const le=k(tt);if(!d(le))return;const $e=l(le),ae=u.BASE.multiply(le).toAffine(),be=a(ae.x);if(be===zi)return;const Be=a($e*a(ze+be*ke));if(Be===zi)return;let z=(ae.x===be?0:2)|Number(ae.y&Zr),q=Be;return pe&&p(Be)&&(q=m(Be),z^=1),new y(be,q,z)}return{seed:Ue,k2sig:Le}}const R={lowS:e.lowS,prehash:!1},L={lowS:e.lowS,prehash:!1};function F(B,H,Q=R){const{seed:te,k2sig:Z}=D(B,H,Q),pe=e;return nR(pe.hash.outputLen,pe.nByteLength,pe.hmac)(te,Z)}u.BASE._setWindowSize(8);function G(B,H,Q,te=L){var ae;const Z=B;if(H=Cs("msgHash",H),Q=Cs("publicKey",Q),"strict"in te)throw new Error("options.strict was renamed to lowS");const{lowS:pe,prehash:Ee}=te;let Re,Ce;try{if(typeof Z=="string"||Z instanceof Uint8Array)try{Re=y.fromDER(Z)}catch(be){if(!(be instanceof Dl.Err))throw be;Re=y.fromCompact(Z)}else if(typeof Z=="object"&&typeof Z.r=="bigint"&&typeof Z.s=="bigint"){const{r:be,s:Be}=Z;Re=new y(be,Be)}else throw new Error("PARSE");Ce=u.fromHex(Q)}catch(be){if(be.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(pe&&Re.hasHighS())return!1;Ee&&(H=e.hash(H));const{r:ke,s:He}=Re,Ue=C(H),ze=l(He),Le=a(Ue*ze),tt=a(ke*ze),le=(ae=u.BASE.multiplyAndAddUnsafe(Ce,Le,tt))==null?void 0:ae.toAffine();return le?a(le.x)===ke:!1}return{CURVE:e,getPublicKey:w,getSharedSecret:x,sign:F,verify:G,ProjectivePoint:u,Signature:y,utils:v}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Mre(t){return{hash:t,hmac:(e,...n)=>N4(t,e,Cne(...n)),randomBytes:Sne}}function Nre(t,e){const n=r=>_re({...t,...Mre(r)});return Object.freeze({...n(e),create:n})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const cR=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),fR=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Rre=BigInt(1),zx=BigInt(2),dR=(t,e)=>(t+e/zx)/e;function Pre(t){const e=cR,n=BigInt(3),r=BigInt(6),s=BigInt(11),i=BigInt(22),o=BigInt(23),a=BigInt(44),l=BigInt(88),u=t*t*t%e,c=u*u*t%e,f=Xr(c,n,e)*c%e,d=Xr(f,n,e)*c%e,h=Xr(d,zx,e)*u%e,p=Xr(h,s,e)*h%e,m=Xr(p,i,e)*p%e,g=Xr(m,a,e)*m%e,y=Xr(g,l,e)*g%e,v=Xr(y,a,e)*m%e,w=Xr(v,n,e)*c%e,A=Xr(w,o,e)*p%e,x=Xr(A,r,e)*u%e,k=Xr(x,zx,e);if(!$x.eql($x.sqr(k),t))throw new Error("Cannot find square root");return k}const $x=vre(cR,void 0,void 0,{sqrt:Pre}),sa=Nre({a:BigInt(0),b:BigInt(7),Fp:$x,n:fR,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=fR,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Rre*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=n,o=BigInt("0x100000000000000000000000000000000"),a=dR(i*t,e),l=dR(-r*t,e);let u=fr(t-a*n-l*s,e),c=fr(-a*r-l*i,e);const f=u>o,d=c>o;if(f&&(u=e-u),d&&(c=e-c),u>o||c>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:f,k1:u,k2neg:d,k2:c}}}},P4);BigInt(0),sa.ProjectivePoint;const Ph="0x0000000000000000000000000000000000000000",hR="0x0000000000000000000000000000000000000000000000000000000000000000",pR=BigInt(0),mR=BigInt(1),gR=BigInt(2),yR=BigInt(27),bR=BigInt(28),ny=BigInt(35),Pc={};function wR(t){return xl(Wn(t),32)}const Ms=class Ms{constructor(e,n,r,s){J(this,cf);J(this,ff);J(this,df);J(this,eu);$g(e,Pc,"Signature"),I(this,cf,n),I(this,ff,r),I(this,df,s),I(this,eu,null)}get r(){return T(this,cf)}set r(e){$(Cc(e)===32,"invalid r","value",e),I(this,cf,we(e))}get s(){return T(this,ff)}set s(e){$(Cc(e)===32,"invalid s","value",e);const n=we(e);$(parseInt(n.substring(0,3))<8,"non-canonical s","value",n),I(this,ff,n)}get v(){return T(this,df)}set v(e){const n=Qe(e,"value");$(n===27||n===28,"invalid v","v",e),I(this,df,n)}get networkV(){return T(this,eu)}get legacyChainId(){const e=this.networkV;return e==null?null:Ms.getChainId(e)}get yParity(){return this.v===27?0:1}get yParityAndS(){const e=ct(this.s);return this.yParity&&(e[0]|=128),we(e)}get compactSerialized(){return $t([this.r,this.yParityAndS])}get serialized(){return $t([this.r,this.s,this.yParity?"0x1c":"0x1b"])}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const e=new Ms(Pc,this.r,this.s,this.v);return this.networkV&&I(e,eu,this.networkV),e}toJSON(){const e=this.networkV;return{_type:"signature",networkV:e!=null?e.toString():null,r:this.r,s:this.s,v:this.v}}static getChainId(e){const n=xe(e,"v");return n==yR||n==bR?pR:($(n>=ny,"invalid EIP-155 v","v",e),(n-ny)/gR)}static getChainIdV(e,n){return xe(e)*gR+BigInt(35+n-27)}static getNormalizedV(e){const n=xe(e);return n===pR||n===yR?27:n===mR||n===bR?28:($(n>=ny,"invalid v","v",e),n&mR?27:28)}static from(e){function n(u,c){$(u,c,"signature",e)}if(e==null)return new Ms(Pc,hR,hR,27);if(typeof e=="string"){const u=ct(e,"signature");if(u.length===64){const c=we(u.slice(0,32)),f=u.slice(32,64),d=f[0]&128?28:27;return f[0]&=127,new Ms(Pc,c,we(f),d)}if(u.length===65){const c=we(u.slice(0,32)),f=u.slice(32,64);n((f[0]&128)===0,"non-canonical s");const d=Ms.getNormalizedV(u[64]);return new Ms(Pc,c,we(f),d)}n(!1,"invalid raw signature length")}if(e instanceof Ms)return e.clone();const r=e.r;n(r!=null,"missing r");const s=wR(r),i=function(u,c){if(u!=null)return wR(u);if(c!=null){n(St(c,32),"invalid yParityAndS");const f=ct(c);return f[0]&=127,we(f)}n(!1,"missing s")}(e.s,e.yParityAndS);n((ct(i)[0]&128)==0,"non-canonical s");const{networkV:o,v:a}=function(u,c,f){if(u!=null){const d=xe(u);return{networkV:d>=ny?d:void 0,v:Ms.getNormalizedV(d)}}if(c!=null)return n(St(c,32),"invalid yParityAndS"),{v:ct(c)[0]&128?28:27};if(f!=null){switch(Qe(f,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}n(!1,"invalid yParity")}n(!1,"missing v")}(e.v,e.yParityAndS,e.yParity),l=new Ms(Pc,s,i,a);return o&&I(l,eu,o),n(e.yParity==null||Qe(e.yParity,"sig.yParity")===l.yParity,"yParity mismatch"),n(e.yParityAndS==null||e.yParityAndS===l.yParityAndS,"yParityAndS mismatch"),l}};cf=new WeakMap,ff=new WeakMap,df=new WeakMap,eu=new WeakMap;let Ss=Ms;const tu=class tu{constructor(e){J(this,oo);$(Cc(e)===32,"invalid private key","privateKey","[REDACTED]"),I(this,oo,we(e))}get privateKey(){return T(this,oo)}get publicKey(){return tu.computePublicKey(T(this,oo))}get compressedPublicKey(){return tu.computePublicKey(T(this,oo),!0)}sign(e){$(Cc(e)===32,"invalid digest length","digest",e);const n=sa.sign(Gn(e),Gn(T(this,oo)),{lowS:!0});return Ss.from({r:Xo(n.r,32),s:Xo(n.s,32),v:n.recovery?28:27})}computeSharedSecret(e){const n=tu.computePublicKey(e);return we(sa.getSharedSecret(Gn(T(this,oo)),ct(n),!1))}static computePublicKey(e,n){let r=ct(e,"key");if(r.length===32){const i=sa.getPublicKey(r,!!n);return we(i)}if(r.length===64){const i=new Uint8Array(65);i[0]=4,i.set(r,1),r=i}const s=sa.ProjectivePoint.fromHex(r);return we(s.toRawBytes(n))}static recoverPublicKey(e,n){$(Cc(e)===32,"invalid digest length","digest",e);const r=Ss.from(n);let s=sa.Signature.fromCompact(Gn($t([r.r,r.s])));s=s.addRecoveryBit(r.yParity);const i=s.recoverPublicKey(Gn(e));return $(i!=null,"invalid signautre for digest","signature",n),"0x"+i.toHex(!1)}static addPoints(e,n,r){const s=sa.ProjectivePoint.fromHex(tu.computePublicKey(e).substring(2)),i=sa.ProjectivePoint.fromHex(tu.computePublicKey(n).substring(2));return"0x"+s.add(i).toHex(!!r)}};oo=new WeakMap;let Ih=tu;const Ire=BigInt(0),Lre=BigInt(36);function AR(t){t=t.toLowerCase();const e=t.substring(2).split(""),n=new Uint8Array(40);for(let s=0;s<40;s++)n[s]=e[s].charCodeAt(0);const r=ct(en(n));for(let s=0;s<40;s+=2)r[s>>1]>>4>=8&&(e[s]=e[s].toUpperCase()),(r[s>>1]&15)>=8&&(e[s+1]=e[s+1].toUpperCase());return"0x"+e.join("")}const Gx={};for(let t=0;t<10;t++)Gx[String(t)]=String(t);for(let t=0;t<26;t++)Gx[String.fromCharCode(65+t)]=String(10+t);const vR=15;function Bre(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(r=>Gx[r]).join("");for(;e.length>=vR;){let r=e.substring(0,vR);e=parseInt(r,10)%97+e.substring(r.length)}let n=String(98-parseInt(e,10)%97);for(;n.length<2;)n="0"+n;return n}const Fre=function(){const t={};for(let e=0;e<36;e++){const n="0123456789abcdefghijklmnopqrstuvwxyz"[e];t[n]=BigInt(e)}return t}();function jre(t){t=t.toLowerCase();let e=Ire;for(let n=0;n<t.length;n++)e=e*Lre+Fre[t[n]];return e}function gt(t){if($(typeof t=="string","invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/)){t.startsWith("0x")||(t="0x"+t);const e=AR(t);return $(!t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||e===t,"bad address checksum","address",t),e}if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){$(t.substring(2,4)===Bre(t),"bad icap checksum","address",t);let e=jre(t.substring(4)).toString(16);for(;e.length<40;)e="0"+e;return AR("0x"+e)}$(!1,"invalid address","address",t)}function Ure(t){const e=gt(t.from);let r=xe(t.nonce,"tx.nonce").toString(16);return r==="0"?r="0x":r.length%2?r="0x0"+r:r="0x"+r,gt(Ht(en(El([e,r])),12))}function xR(t){return t&&typeof t.getAddress=="function"}function Vre(t){try{return gt(t),!0}catch{}return!1}async function Wx(t,e){const n=await e;return(n==null||n==="0x0000000000000000000000000000000000000000")&&(ee(typeof t!="string","unconfigured name","UNCONFIGURED_NAME",{value:t}),$(!1,"invalid AddressLike value; did not resolve to a value address","target",t)),gt(n)}function Qn(t,e){if(typeof t=="string")return t.match(/^0x[0-9a-f]{40}$/i)?gt(t):(ee(e!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),Wx(t,e.resolveName(t)));if(xR(t))return Wx(t,t.getAddress());if(t&&typeof t.then=="function")return Wx(t,t);$(!1,"unsupported addressable value","target",t)}const $i={};function Ae(t,e){let n=!1;return e<0&&(n=!0,e*=-1),new Rn($i,`${n?"":"u"}int${e}`,t,{signed:n,width:e})}function dt(t,e){return new Rn($i,`bytes${e||""}`,t,{size:e})}const kR=Symbol.for("_ethers_typed"),ao=class ao{constructor(e,n,r,s){W(this,"type");W(this,"value");J(this,nu);W(this,"_typedSymbol");s==null&&(s=null),$g($i,e,"Typed"),Oe(this,{_typedSymbol:kR,type:n,value:r}),I(this,nu,s),this.format()}format(){if(this.type==="array")throw new Error("");if(this.type==="dynamicArray")throw new Error("");return this.type==="tuple"?`tuple(${this.value.map(e=>e.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return T(this,nu)}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return T(this,nu)===!0?-1:T(this,nu)===!1?this.value.length:null}static from(e,n){return new ao($i,e,n)}static uint8(e){return Ae(e,8)}static uint16(e){return Ae(e,16)}static uint24(e){return Ae(e,24)}static uint32(e){return Ae(e,32)}static uint40(e){return Ae(e,40)}static uint48(e){return Ae(e,48)}static uint56(e){return Ae(e,56)}static uint64(e){return Ae(e,64)}static uint72(e){return Ae(e,72)}static uint80(e){return Ae(e,80)}static uint88(e){return Ae(e,88)}static uint96(e){return Ae(e,96)}static uint104(e){return Ae(e,104)}static uint112(e){return Ae(e,112)}static uint120(e){return Ae(e,120)}static uint128(e){return Ae(e,128)}static uint136(e){return Ae(e,136)}static uint144(e){return Ae(e,144)}static uint152(e){return Ae(e,152)}static uint160(e){return Ae(e,160)}static uint168(e){return Ae(e,168)}static uint176(e){return Ae(e,176)}static uint184(e){return Ae(e,184)}static uint192(e){return Ae(e,192)}static uint200(e){return Ae(e,200)}static uint208(e){return Ae(e,208)}static uint216(e){return Ae(e,216)}static uint224(e){return Ae(e,224)}static uint232(e){return Ae(e,232)}static uint240(e){return Ae(e,240)}static uint248(e){return Ae(e,248)}static uint256(e){return Ae(e,256)}static uint(e){return Ae(e,256)}static int8(e){return Ae(e,-8)}static int16(e){return Ae(e,-16)}static int24(e){return Ae(e,-24)}static int32(e){return Ae(e,-32)}static int40(e){return Ae(e,-40)}static int48(e){return Ae(e,-48)}static int56(e){return Ae(e,-56)}static int64(e){return Ae(e,-64)}static int72(e){return Ae(e,-72)}static int80(e){return Ae(e,-80)}static int88(e){return Ae(e,-88)}static int96(e){return Ae(e,-96)}static int104(e){return Ae(e,-104)}static int112(e){return Ae(e,-112)}static int120(e){return Ae(e,-120)}static int128(e){return Ae(e,-128)}static int136(e){return Ae(e,-136)}static int144(e){return Ae(e,-144)}static int152(e){return Ae(e,-152)}static int160(e){return Ae(e,-160)}static int168(e){return Ae(e,-168)}static int176(e){return Ae(e,-176)}static int184(e){return Ae(e,-184)}static int192(e){return Ae(e,-192)}static int200(e){return Ae(e,-200)}static int208(e){return Ae(e,-208)}static int216(e){return Ae(e,-216)}static int224(e){return Ae(e,-224)}static int232(e){return Ae(e,-232)}static int240(e){return Ae(e,-240)}static int248(e){return Ae(e,-248)}static int256(e){return Ae(e,-256)}static int(e){return Ae(e,-256)}static bytes1(e){return dt(e,1)}static bytes2(e){return dt(e,2)}static bytes3(e){return dt(e,3)}static bytes4(e){return dt(e,4)}static bytes5(e){return dt(e,5)}static bytes6(e){return dt(e,6)}static bytes7(e){return dt(e,7)}static bytes8(e){return dt(e,8)}static bytes9(e){return dt(e,9)}static bytes10(e){return dt(e,10)}static bytes11(e){return dt(e,11)}static bytes12(e){return dt(e,12)}static bytes13(e){return dt(e,13)}static bytes14(e){return dt(e,14)}static bytes15(e){return dt(e,15)}static bytes16(e){return dt(e,16)}static bytes17(e){return dt(e,17)}static bytes18(e){return dt(e,18)}static bytes19(e){return dt(e,19)}static bytes20(e){return dt(e,20)}static bytes21(e){return dt(e,21)}static bytes22(e){return dt(e,22)}static bytes23(e){return dt(e,23)}static bytes24(e){return dt(e,24)}static bytes25(e){return dt(e,25)}static bytes26(e){return dt(e,26)}static bytes27(e){return dt(e,27)}static bytes28(e){return dt(e,28)}static bytes29(e){return dt(e,29)}static bytes30(e){return dt(e,30)}static bytes31(e){return dt(e,31)}static bytes32(e){return dt(e,32)}static address(e){return new ao($i,"address",e)}static bool(e){return new ao($i,"bool",!!e)}static bytes(e){return new ao($i,"bytes",e)}static string(e){return new ao($i,"string",e)}static array(e,n){throw new Error("not implemented yet")}static tuple(e,n){throw new Error("not implemented yet")}static overrides(e){return new ao($i,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===kR}static dereference(e,n){if(ao.isTyped(e)){if(e.type!==n)throw new Error(`invalid type: expecetd ${n}, got ${e.type}`);return e.value}return e}};nu=new WeakMap;let Rn=ao;class Hre extends Hi{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,n){let r=Rn.dereference(n,"string");try{r=gt(r)}catch(s){return this._throwError(s.message,n)}return e.writeValue(r)}decode(e){return gt(Xo(e.readValue(),20))}}class zre extends Hi{constructor(n){super(n.name,n.type,"_",n.dynamic);W(this,"coder");this.coder=n}defaultValue(){return this.coder.defaultValue()}encode(n,r){return this.coder.encode(n,r)}decode(n){return this.coder.decode(n)}}function ER(t,e,n){let r=[];if(Array.isArray(n))r=n;else if(n&&typeof n=="object"){let l={};r=e.map(u=>{const c=u.localName;return ee(c,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:u},value:n}),ee(!l[c],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:u},value:n}),l[c]=!0,n[c]})}else $(!1,"invalid tuple value","tuple",n);$(e.length===r.length,"types/value length mismatch","tuple",n);let s=new Sx,i=new Sx,o=[];e.forEach((l,u)=>{let c=r[u];if(l.dynamic){let f=i.length;l.encode(i,c);let d=s.writeUpdatableValue();o.push(h=>{d(h+f)})}else l.encode(s,c)}),o.forEach(l=>{l(s.length)});let a=t.appendWriter(s);return a+=t.appendWriter(i),a}function CR(t,e){let n=[],r=[],s=t.subReader(0);return e.forEach(i=>{let o=null;if(i.dynamic){let a=t.readIndex(),l=s.subReader(a);try{o=i.decode(l)}catch(u){if(gn(u,"BUFFER_OVERRUN"))throw u;o=u,o.baseType=i.name,o.name=i.localName,o.type=i.type}}else try{o=i.decode(t)}catch(a){if(gn(a,"BUFFER_OVERRUN"))throw a;o=a,o.baseType=i.name,o.name=i.localName,o.type=i.type}if(o==null)throw new Error("investigate");n.push(o),r.push(i.localName||null)}),Dc.fromItems(n,r)}class $re extends Hi{constructor(n,r,s){const i=n.type+"["+(r>=0?r:"")+"]",o=r===-1||n.dynamic;super("array",i,s,o);W(this,"coder");W(this,"length");Oe(this,{coder:n,length:r})}defaultValue(){const n=this.coder.defaultValue(),r=[];for(let s=0;s<this.length;s++)r.push(n);return r}encode(n,r){const s=Rn.dereference(r,"array");Array.isArray(s)||this._throwError("expected array value",s);let i=this.length;i===-1&&(i=s.length,n.writeValue(s.length)),s4(s.length,i,"coder array"+(this.localName?" "+this.localName:""));let o=[];for(let a=0;a<s.length;a++)o.push(this.coder);return ER(n,o,s)}decode(n){let r=this.length;r===-1&&(r=n.readIndex(),ee(r*qn<=n.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:n.bytes,offset:r*qn,length:n.dataLength}));let s=[];for(let i=0;i<r;i++)s.push(new zre(this.coder));return CR(n,s)}}class Gre extends Hi{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,n){const r=Rn.dereference(n,"bool");return e.writeValue(r?1:0)}decode(e){return!!e.readValue()}}class SR extends Hi{constructor(e,n){super(e,e,n,!0)}defaultValue(){return"0x"}encode(e,n){n=Gn(n);let r=e.writeValue(n.length);return r+=e.writeBytes(n),r}decode(e){return e.readBytes(e.readIndex(),!0)}}class Wre extends SR{constructor(e){super("bytes",e)}decode(e){return we(super.decode(e))}}class Kre extends Hi{constructor(n,r){let s="bytes"+String(n);super(s,s,r,!1);W(this,"size");Oe(this,{size:n},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(n,r){let s=Gn(Rn.dereference(r,this.type));return s.length!==this.size&&this._throwError("incorrect data length",r),n.writeBytes(s)}decode(n){return we(n.readBytes(this.size))}}const qre=new Uint8Array([]);class Qre extends Hi{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,n){return n!=null&&this._throwError("not null",n),e.writeBytes(qre)}decode(e){return e.readBytes(0),null}}const Jre=BigInt(0),Yre=BigInt(1),Xre=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class Zre extends Hi{constructor(n,r,s){const i=(r?"int":"uint")+n*8;super(i,i,s,!1);W(this,"size");W(this,"signed");Oe(this,{size:n,signed:r},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(n,r){let s=xe(Rn.dereference(r,this.type)),i=Oh(Xre,qn*8);if(this.signed){let o=Oh(i,this.size*8-1);(s>o||s<-(o+Yre))&&this._throwError("value out-of-bounds",r),s=l4(s,8*qn)}else(s<Jre||s>Oh(i,this.size*8))&&this._throwError("value out-of-bounds",r);return n.writeValue(s)}decode(n){let r=Oh(n.readValue(),this.size*8);return this.signed&&(r=rne(r,this.size*8)),r}}class ese extends SR{constructor(e){super("string",e)}defaultValue(){return""}encode(e,n){return super.encode(e,Vi(Rn.dereference(n,"string")))}decode(e){return Tc(super.decode(e))}}class ry extends Hi{constructor(n,r){let s=!1;const i=[];n.forEach(a=>{a.dynamic&&(s=!0),i.push(a.type)});const o="tuple("+i.join(",")+")";super("tuple",o,r,s);W(this,"coders");Oe(this,{coders:Object.freeze(n.slice())})}defaultValue(){const n=[];this.coders.forEach(s=>{n.push(s.defaultValue())});const r=this.coders.reduce((s,i)=>{const o=i.localName;return o&&(s[o]||(s[o]=0),s[o]++),s},{});return this.coders.forEach((s,i)=>{let o=s.localName;!o||r[o]!==1||(o==="length"&&(o="_length"),n[o]==null&&(n[o]=n[i]))}),Object.freeze(n)}encode(n,r){const s=Rn.dereference(r,"tuple");return ER(n,this.coders,s)}decode(n){return CR(n,this.coders)}}function Ol(t){return en(Vi(t))}var tse="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";const TR=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),DR=4;function nse(t){let e=0;function n(){return t[e++]<<8|t[e++]}let r=n(),s=1,i=[0,1];for(let x=1;x<r;x++)i.push(s+=n());let o=n(),a=e;e+=o;let l=0,u=0;function c(){return l==0&&(u=u<<8|t[e++],l=8),u>>--l&1}const f=31,d=2**f,h=d>>>1,p=h>>1,m=d-1;let g=0;for(let x=0;x<f;x++)g=g<<1|c();let y=[],v=0,w=d;for(;;){let x=Math.floor(((g-v+1)*s-1)/w),k=0,C=r;for(;C-k>1;){let D=k+C>>>1;x<i[D]?C=D:k=D}if(k==0)break;y.push(k);let O=v+Math.floor(w*i[k]/s),_=v+Math.floor(w*i[k+1]/s)-1;for(;!((O^_)&h);)g=g<<1&m|c(),O=O<<1&m,_=_<<1&m|1;for(;O&~_&p;)g=g&h|g<<1&m>>>1|c(),O=O<<1^h,_=(_^h)<<1|h|1;v=O,w=1+_-O}let A=r-4;return y.map(x=>{switch(x-A){case 3:return A+65792+(t[a++]<<16|t[a++]<<8|t[a++]);case 2:return A+256+(t[a++]<<8|t[a++]);case 1:return A+t[a++];default:return x-1}})}function rse(t){let e=0;return()=>t[e++]}function OR(t){return rse(nse(sse(t)))}function sse(t){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((s,i)=>e[s.charCodeAt(0)]=i);let n=t.length,r=new Uint8Array(6*n>>3);for(let s=0,i=0,o=0,a=0;s<n;s++)a=a<<6|e[t.charCodeAt(s)],o+=6,o>=8&&(r[i++]=a>>(o-=8));return r}function ise(t){return t&1?~t>>1:t>>1}function ose(t,e){let n=Array(t);for(let r=0,s=0;r<t;r++)n[r]=s+=ise(e());return n}function Lh(t,e=0){let n=[];for(;;){let r=t(),s=t();if(!s)break;e+=r;for(let i=0;i<s;i++)n.push(e+i);e+=s+1}return n}function _R(t){return Bh(()=>{let e=Lh(t);if(e.length)return e})}function MR(t){let e=[];for(;;){let n=t();if(n==0)break;e.push(ase(n,t))}for(;;){let n=t()-1;if(n<0)break;e.push(lse(n,t))}return e.flat()}function Bh(t){let e=[];for(;;){let n=t(e.length);if(!n)break;e.push(n)}return e}function NR(t,e,n){let r=Array(t).fill().map(()=>[]);for(let s=0;s<e;s++)ose(t,n).forEach((i,o)=>r[o].push(i));return r}function ase(t,e){let n=1+e(),r=e(),s=Bh(e);return NR(s.length,1+t,e).flatMap((o,a)=>{let[l,...u]=o;return Array(s[a]).fill().map((c,f)=>{let d=f*r;return[l+f*n,u.map(h=>h+d)]})})}function lse(t,e){let n=1+e();return NR(n,1+t,e).map(s=>[s[0],s.slice(1)])}function use(t){let e=[],n=Lh(t);return s(r([]),[]),e;function r(i){let o=t(),a=Bh(()=>{let l=Lh(t).map(u=>n[u]);if(l.length)return r(l)});return{S:o,B:a,Q:i}}function s({S:i,B:o},a,l){if(!(i&4&&l===a[a.length-1])){i&2&&(l=a[a.length-1]),i&1&&e.push(a);for(let u of o)for(let c of u.Q)s(u,[...a,c],l)}}}function cse(t){return t.toString(16).toUpperCase().padStart(2,"0")}function RR(t){return`{${cse(t)}}`}function fse(t){let e=[];for(let n=0,r=t.length;n<r;){let s=t.codePointAt(n);n+=s<65536?1:2,e.push(s)}return e}function Ic(t){let n=t.length;if(n<4096)return String.fromCodePoint(...t);let r=[];for(let s=0;s<n;)r.push(String.fromCodePoint(...t.slice(s,s+=4096)));return r.join("")}function dse(t,e){let n=t.length,r=n-e.length;for(let s=0;r==0&&s<n;s++)r=t[s]-e[s];return r}var hse="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";const Fh=44032,sy=4352,iy=4449,oy=4519,PR=19,IR=21,Lc=28,ay=IR*Lc,pse=PR*ay,mse=Fh+pse,gse=sy+PR,yse=iy+IR,bse=oy+Lc;function jh(t){return t>>24&255}function LR(t){return t&16777215}let Kx,BR,qx,ly;function wse(){let t=OR(hse);Kx=new Map(_R(t).flatMap((e,n)=>e.map(r=>[r,n+1<<24]))),BR=new Set(Lh(t)),qx=new Map,ly=new Map;for(let[e,n]of MR(t)){if(!BR.has(e)&&n.length==2){let[r,s]=n,i=ly.get(r);i||(i=new Map,ly.set(r,i)),i.set(s,e)}qx.set(e,n.reverse())}}function FR(t){return t>=Fh&&t<mse}function Ase(t,e){if(t>=sy&&t<gse&&e>=iy&&e<yse)return Fh+(t-sy)*ay+(e-iy)*Lc;if(FR(t)&&e>oy&&e<bse&&(t-Fh)%Lc==0)return t+(e-oy);{let n=ly.get(t);return n&&(n=n.get(e),n)?n:-1}}function jR(t){Kx||wse();let e=[],n=[],r=!1;function s(i){let o=Kx.get(i);o&&(r=!0,i|=o),e.push(i)}for(let i of t)for(;;){if(i<128)e.push(i);else if(FR(i)){let o=i-Fh,a=o/ay|0,l=o%ay/Lc|0,u=o%Lc;s(sy+a),s(iy+l),u>0&&s(oy+u)}else{let o=qx.get(i);o?n.push(...o):s(i)}if(!n.length)break;i=n.pop()}if(r&&e.length>1){let i=jh(e[0]);for(let o=1;o<e.length;o++){let a=jh(e[o]);if(a==0||i<=a){i=a;continue}let l=o-1;for(;;){let u=e[l+1];if(e[l+1]=e[l],e[l]=u,!l||(i=jh(e[--l]),i<=a))break}i=jh(e[o])}}return e}function vse(t){let e=[],n=[],r=-1,s=0;for(let i of t){let o=jh(i),a=LR(i);if(r==-1)o==0?r=a:e.push(a);else if(s>0&&s>=o)o==0?(e.push(r,...n),n.length=0,r=a):n.push(a),s=o;else{let l=Ase(r,a);l>=0?r=l:s==0&&o==0?(e.push(r),r=a):(n.push(a),s=o)}}return r>=0&&e.push(r,...n),e}function UR(t){return jR(t).map(LR)}function xse(t){return vse(jR(t))}const VR=45,HR=".",zR=65039,$R=1,uy=t=>Array.from(t);function Uh(t,e){return t.P.has(e)||t.Q.has(e)}class kse extends Array{get is_emoji(){return!0}}let Qx,GR,_l,Jx,WR,Bc,Yx,Fc,Ml,KR,Xx;function Zx(){if(Qx)return;let t=OR(tse);const e=()=>Lh(t),n=()=>new Set(e()),r=(c,f)=>f.forEach(d=>c.add(d));Qx=new Map(MR(t)),GR=n(),_l=e(),Jx=new Set(e().map(c=>_l[c])),_l=new Set(_l),WR=n(),n();let s=_R(t),i=t();const o=()=>{let c=new Set;return e().forEach(f=>r(c,s[f])),r(c,e()),c};Bc=Bh(c=>{let f=Bh(t).map(d=>d+96);if(f.length){let d=c>=i;f[0]-=32,f=Ic(f),d&&(f=`Restricted[${f}]`);let h=o(),p=o(),m=!t();return{N:f,P:h,Q:p,M:m,R:d}}}),Yx=n(),Fc=new Map;let a=e().concat(uy(Yx)).sort((c,f)=>c-f);a.forEach((c,f)=>{let d=t(),h=a[f]=d?a[f-d]:{V:[],M:new Map};h.V.push(c),Yx.has(c)||Fc.set(c,h)});for(let{V:c,M:f}of new Set(Fc.values())){let d=[];for(let p of c){let m=Bc.filter(y=>Uh(y,p)),g=d.find(({G:y})=>m.some(v=>y.has(v)));g||(g={G:new Set,V:[]},d.push(g)),g.V.push(p),r(g.G,m)}let h=d.flatMap(p=>uy(p.G));for(let{G:p,V:m}of d){let g=new Set(h.filter(y=>!p.has(y)));for(let y of m)f.set(y,g)}}Ml=new Set;let l=new Set;const u=c=>Ml.has(c)?l.add(c):Ml.add(c);for(let c of Bc){for(let f of c.P)u(f);for(let f of c.Q)u(f)}for(let c of Ml)!Fc.has(c)&&!l.has(c)&&Fc.set(c,$R);r(Ml,UR(Ml)),KR=use(t).map(c=>kse.from(c)).sort(dse),Xx=new Map;for(let c of KR){let f=[Xx];for(let d of c){let h=f.map(p=>{let m=p.get(d);return m||(m=new Map,p.set(d,m)),m});d===zR?f.push(...h):f=h}for(let d of f)d.V=c}}function e2(t){return(qR(t)?"":`${t2(cy([t]))} `)+RR(t)}function t2(t){return`"${t}"‎`}function Ese(t){if(t.length>=4&&t[2]==VR&&t[3]==VR)throw new Error(`invalid label extension: "${Ic(t.slice(0,4))}"`)}function Cse(t){for(let n=t.lastIndexOf(95);n>0;)if(t[--n]!==95)throw new Error("underscore allowed only at start")}function Sse(t){let e=t[0],n=TR.get(e);if(n)throw Vh(`leading ${n}`);let r=t.length,s=-1;for(let i=1;i<r;i++){e=t[i];let o=TR.get(e);if(o){if(s==i)throw Vh(`${n} + ${o}`);s=i+1,n=o}}if(s==r)throw Vh(`trailing ${n}`)}function cy(t,e=1/0,n=RR){let r=[];Tse(t[0])&&r.push("◌"),t.length>e&&(e>>=1,t=[...t.slice(0,e),8230,...t.slice(-e)]);let s=0,i=t.length;for(let o=0;o<i;o++){let a=t[o];qR(a)&&(r.push(Ic(t.slice(s,o))),r.push(n(a)),s=o+1)}return r.push(Ic(t.slice(s,i))),r.join("")}function Tse(t){return Zx(),_l.has(t)}function qR(t){return Zx(),WR.has(t)}function Dse(t){return Nse(Ose(t,xse,Ise))}function Ose(t,e,n){if(!t)return[];Zx();let r=0;return t.split(HR).map(s=>{let i=fse(s),o={input:i,offset:r};r+=i.length+1;try{let a=o.tokens=Pse(i,e,n),l=a.length,u;if(!l)throw new Error("empty label");let c=o.output=a.flat();if(Cse(c),!(o.emoji=l>1||a[0].is_emoji)&&c.every(d=>d<128))Ese(c),u="ASCII";else{let d=a.flatMap(h=>h.is_emoji?[]:h);if(!d.length)u="Emoji";else{if(_l.has(c[0]))throw Vh("leading combining mark");for(let m=1;m<l;m++){let g=a[m];if(!g.is_emoji&&_l.has(g[0]))throw Vh(`emoji + combining mark: "${Ic(a[m-1])} + ${cy([g[0]])}"`)}Sse(c);let h=uy(new Set(d)),[p]=Mse(h);Rse(p,d),_se(p,h),u=p.N}}o.type=u}catch(a){o.error=a}return o})}function _se(t,e){let n,r=[];for(let s of e){let i=Fc.get(s);if(i===$R)return;if(i){let o=i.M.get(s);if(n=n?n.filter(a=>o.has(a)):uy(o),!n.length)return}else r.push(s)}if(n){for(let s of n)if(r.every(i=>Uh(s,i)))throw new Error(`whole-script confusable: ${t.N}/${s.N}`)}}function Mse(t){let e=Bc;for(let n of t){let r=e.filter(s=>Uh(s,n));if(!r.length)throw Bc.some(s=>Uh(s,n))?JR(e[0],n):QR(n);if(e=r,r.length==1)break}return e}function Nse(t){return t.map(({input:e,error:n,output:r})=>{if(n){let s=n.message;throw new Error(t.length==1?s:`Invalid label ${t2(cy(e,63))}: ${s}`)}return Ic(r)}).join(HR)}function QR(t){return new Error(`disallowed character: ${e2(t)}`)}function JR(t,e){let n=e2(e),r=Bc.find(s=>s.P.has(e));return r&&(n=`${r.N} ${n}`),new Error(`illegal mixture: ${t.N} + ${n}`)}function Vh(t){return new Error(`illegal placement: ${t}`)}function Rse(t,e){for(let n of e)if(!Uh(t,n))throw JR(t,n);if(t.M){let n=UR(e);for(let r=1,s=n.length;r<s;r++)if(Jx.has(n[r])){let i=r+1;for(let o;i<s&&Jx.has(o=n[i]);i++)for(let a=r;a<i;a++)if(n[a]==o)throw new Error(`duplicate non-spacing marks: ${e2(o)}`);if(i-r>DR)throw new Error(`excessive non-spacing marks: ${t2(cy(n.slice(r-1,i)))} (${i-r}/${DR})`);r=i}}}function Pse(t,e,n){let r=[],s=[];for(t=t.slice().reverse();t.length;){let i=Lse(t);if(i)s.length&&(r.push(e(s)),s=[]),r.push(n(i));else{let o=t.pop();if(Ml.has(o))s.push(o);else{let a=Qx.get(o);if(a)s.push(...a);else if(!GR.has(o))throw QR(o)}}}return s.length&&r.push(e(s)),r}function Ise(t){return t.filter(e=>e!=zR)}function Lse(t,e){let n=Xx,r,s=t.length;for(;s&&(n=n.get(t[--s]),!!n);){let{V:i}=n;i&&(r=i,t.length=s)}return r}const YR=new Uint8Array(32);YR.fill(0);function XR(t){return $(t.length!==0,"invalid ENS name; empty component","comp",t),t}function ZR(t){const e=Vi(Bse(t)),n=[];if(t.length===0)return n;let r=0;for(let s=0;s<e.length;s++)e[s]===46&&(n.push(XR(e.slice(r,s))),r=s+1);return $(r<e.length,"invalid ENS name; empty component","name",t),n.push(XR(e.slice(r))),n}function Bse(t){try{if(t.length===0)throw new Error("empty label");return Dse(t)}catch(e){$(!1,`invalid ENS name (${e.message})`,"name",t)}}function n2(t){$(typeof t=="string","invalid ENS name; not a string","name",t),$(t.length,"invalid ENS name (empty label)","name",t);let e=YR;const n=ZR(t);for(;n.length;)e=en($t([e,en(n.pop())]));return we(e)}function Fse(t,e){const n=e;return $(n<=255,"DNS encoded label cannot exceed 255","length",n),we($t(ZR(t).map(r=>{$(r.length<=n,`label ${JSON.stringify(t)} exceeds ${n} bytes`,"name",t);const s=new Uint8Array(r.length+1);return s.set(r,1),s[0]=s.length-1,s})))+"00"}function r2(t,e){return{address:gt(t),storageKeys:e.map((n,r)=>($(St(n,32),"invalid slot",`storageKeys[${r}]`,n),n.toLowerCase()))}}function ia(t){if(Array.isArray(t))return t.map((n,r)=>Array.isArray(n)?($(n.length===2,"invalid slot set",`value[${r}]`,n),r2(n[0],n[1])):($(n!=null&&typeof n=="object","invalid address-slot set","value",t),r2(n.address,n.storageKeys)));$(t!=null&&typeof t=="object","invalid access list","value",t);const e=Object.keys(t).map(n=>{const r=t[n].reduce((s,i)=>(s[i]=!0,s),{});return r2(n,Object.keys(r).sort())});return e.sort((n,r)=>n.address.localeCompare(r.address)),e}function jse(t){let e;return typeof t=="string"?e=Ih.computePublicKey(t,!1):e=t.publicKey,gt(en("0x"+e.substring(4)).substring(26))}function Use(t,e){return jse(Ih.recoverPublicKey(t,e))}const bn=BigInt(0),Vse=BigInt(2),Hse=BigInt(27),zse=BigInt(28),$se=BigInt(35),Gse=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),s2=4096*32;function eP(t,e){let n=t.toString(16);for(;n.length<2;)n="0"+n;return n+=_c(e).substring(4),"0x"+n}function fy(t){return t==="0x"?null:gt(t)}function i2(t,e){try{return ia(t)}catch(n){$(!1,n.message,e,t)}}function Hh(t,e){return t==="0x"?0:Qe(t,e)}function Wt(t,e){if(t==="0x")return bn;const n=xe(t,e);return $(n<=Gse,"value exceeds uint size",e,n),n}function Ot(t,e){const n=xe(t,"value"),r=Wn(n);return $(r.length<=32,"value too large",`tx.${e}`,n),r}function o2(t){return ia(t).map(e=>[e.address,e.storageKeys])}function Wse(t,e){$(Array.isArray(t),`invalid ${e}`,"value",t);for(let n=0;n<t.length;n++)$(St(t[n],32),"invalid ${ param } hash",`value[${n}]`,t[n]);return t}function Kse(t){const e=Qg(t);$(Array.isArray(e)&&(e.length===9||e.length===6),"invalid field count for legacy transaction","data",t);const n={type:0,nonce:Hh(e[0],"nonce"),gasPrice:Wt(e[1],"gasPrice"),gasLimit:Wt(e[2],"gasLimit"),to:fy(e[3]),value:Wt(e[4],"value"),data:we(e[5]),chainId:bn};if(e.length===6)return n;const r=Wt(e[6],"v"),s=Wt(e[7],"r"),i=Wt(e[8],"s");if(s===bn&&i===bn)n.chainId=r;else{let o=(r-$se)/Vse;o<bn&&(o=bn),n.chainId=o,$(o!==bn||r===Hse||r===zse,"non-canonical legacy v","v",e[6]),n.signature=Ss.from({r:xl(e[7],32),s:xl(e[8],32),v:r})}return n}function qse(t,e){const n=[Ot(t.nonce,"nonce"),Ot(t.gasPrice||0,"gasPrice"),Ot(t.gasLimit,"gasLimit"),t.to||"0x",Ot(t.value,"value"),t.data];let r=bn;if(t.chainId!=bn)r=xe(t.chainId,"tx.chainId"),$(!e||e.networkV==null||e.legacyChainId===r,"tx.chainId/sig.v mismatch","sig",e);else if(t.signature){const i=t.signature.legacyChainId;i!=null&&(r=i)}if(!e)return r!==bn&&(n.push(Wn(r)),n.push("0x"),n.push("0x")),El(n);let s=BigInt(27+e.yParity);return r!==bn?s=Ss.getChainIdV(r,e.v):BigInt(e.v)!==s&&$(!1,"tx.chainId/sig.v mismatch","sig",e),n.push(Wn(s)),n.push(Wn(e.r)),n.push(Wn(e.s)),El(n)}function a2(t,e){let n;try{if(n=Hh(e[0],"yParity"),n!==0&&n!==1)throw new Error("bad yParity")}catch{$(!1,"invalid yParity","yParity",e[0])}const r=xl(e[1],32),s=xl(e[2],32),i=Ss.from({r,s,yParity:n});t.signature=i}function Qse(t){const e=Qg(ct(t).slice(1));$(Array.isArray(e)&&(e.length===9||e.length===12),"invalid field count for transaction type: 2","data",we(t));const n={type:2,chainId:Wt(e[0],"chainId"),nonce:Hh(e[1],"nonce"),maxPriorityFeePerGas:Wt(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Wt(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Wt(e[4],"gasLimit"),to:fy(e[5]),value:Wt(e[6],"value"),data:we(e[7]),accessList:i2(e[8],"accessList")};return e.length===9||a2(n,e.slice(9)),n}function Jse(t,e){const n=[Ot(t.chainId,"chainId"),Ot(t.nonce,"nonce"),Ot(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Ot(t.maxFeePerGas||0,"maxFeePerGas"),Ot(t.gasLimit,"gasLimit"),t.to||"0x",Ot(t.value,"value"),t.data,o2(t.accessList||[])];return e&&(n.push(Ot(e.yParity,"yParity")),n.push(Wn(e.r)),n.push(Wn(e.s))),$t(["0x02",El(n)])}function Yse(t){const e=Qg(ct(t).slice(1));$(Array.isArray(e)&&(e.length===8||e.length===11),"invalid field count for transaction type: 1","data",we(t));const n={type:1,chainId:Wt(e[0],"chainId"),nonce:Hh(e[1],"nonce"),gasPrice:Wt(e[2],"gasPrice"),gasLimit:Wt(e[3],"gasLimit"),to:fy(e[4]),value:Wt(e[5],"value"),data:we(e[6]),accessList:i2(e[7],"accessList")};return e.length===8||a2(n,e.slice(8)),n}function Xse(t,e){const n=[Ot(t.chainId,"chainId"),Ot(t.nonce,"nonce"),Ot(t.gasPrice||0,"gasPrice"),Ot(t.gasLimit,"gasLimit"),t.to||"0x",Ot(t.value,"value"),t.data,o2(t.accessList||[])];return e&&(n.push(Ot(e.yParity,"recoveryParam")),n.push(Wn(e.r)),n.push(Wn(e.s))),$t(["0x01",El(n)])}function Zse(t){let e=Qg(ct(t).slice(1)),n="3",r=null;if(e.length===4&&Array.isArray(e[0])){n="3 (network format)";const i=e[1],o=e[2],a=e[3];$(Array.isArray(i),"invalid network format: blobs not an array","fields[1]",i),$(Array.isArray(o),"invalid network format: commitments not an array","fields[2]",o),$(Array.isArray(a),"invalid network format: proofs not an array","fields[3]",a),$(i.length===o.length,"invalid network format: blobs/commitments length mismatch","fields",e),$(i.length===a.length,"invalid network format: blobs/proofs length mismatch","fields",e),r=[];for(let l=0;l<e[1].length;l++)r.push({data:i[l],commitment:o[l],proof:a[l]});e=e[0]}$(Array.isArray(e)&&(e.length===11||e.length===14),`invalid field count for transaction type: ${n}`,"data",we(t));const s={type:3,chainId:Wt(e[0],"chainId"),nonce:Hh(e[1],"nonce"),maxPriorityFeePerGas:Wt(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Wt(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Wt(e[4],"gasLimit"),to:fy(e[5]),value:Wt(e[6],"value"),data:we(e[7]),accessList:i2(e[8],"accessList"),maxFeePerBlobGas:Wt(e[9],"maxFeePerBlobGas"),blobVersionedHashes:e[10]};r&&(s.blobs=r),$(s.to!=null,`invalid address for transaction type: ${n}`,"data",t),$(Array.isArray(s.blobVersionedHashes),"invalid blobVersionedHashes: must be an array","data",t);for(let i=0;i<s.blobVersionedHashes.length;i++)$(St(s.blobVersionedHashes[i],32),`invalid blobVersionedHash at index ${i}: must be length 32`,"data",t);return e.length===11||a2(s,e.slice(11)),s}function eie(t,e,n){const r=[Ot(t.chainId,"chainId"),Ot(t.nonce,"nonce"),Ot(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Ot(t.maxFeePerGas||0,"maxFeePerGas"),Ot(t.gasLimit,"gasLimit"),t.to||Ph,Ot(t.value,"value"),t.data,o2(t.accessList||[]),Ot(t.maxFeePerBlobGas||0,"maxFeePerBlobGas"),Wse(t.blobVersionedHashes||[],"blobVersionedHashes")];return e&&(r.push(Ot(e.yParity,"yParity")),r.push(Wn(e.r)),r.push(Wn(e.s)),n)?$t(["0x03",El([r,n.map(s=>s.data),n.map(s=>s.commitment),n.map(s=>s.proof)])]):$t(["0x03",El(r)])}const uo=class uo{constructor(){J(this,Ef);J(this,pi);J(this,hf);J(this,pf);J(this,mf);J(this,gf);J(this,yf);J(this,bf);J(this,wf);J(this,Af);J(this,vf);J(this,xf);J(this,kf);J(this,ru);J(this,ga);J(this,lo);J(this,ya);I(this,pi,null),I(this,hf,null),I(this,mf,0),I(this,gf,bn),I(this,yf,null),I(this,bf,null),I(this,wf,null),I(this,pf,"0x"),I(this,Af,bn),I(this,vf,bn),I(this,xf,null),I(this,kf,null),I(this,ru,null),I(this,ga,null),I(this,ya,null),I(this,lo,null)}get type(){return T(this,pi)}set type(e){switch(e){case null:I(this,pi,null);break;case 0:case"legacy":I(this,pi,0);break;case 1:case"berlin":case"eip-2930":I(this,pi,1);break;case 2:case"london":case"eip-1559":I(this,pi,2);break;case 3:case"cancun":case"eip-4844":I(this,pi,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,hf);return e==null&&this.type===3?Ph:e}set to(e){I(this,hf,e==null?null:gt(e))}get nonce(){return T(this,mf)}set nonce(e){I(this,mf,Qe(e,"value"))}get gasLimit(){return T(this,gf)}set gasLimit(e){I(this,gf,xe(e))}get gasPrice(){const e=T(this,yf);return e==null&&(this.type===0||this.type===1)?bn:e}set gasPrice(e){I(this,yf,e==null?null:xe(e,"gasPrice"))}get maxPriorityFeePerGas(){const e=T(this,bf);return e??(this.type===2||this.type===3?bn:null)}set maxPriorityFeePerGas(e){I(this,bf,e==null?null:xe(e,"maxPriorityFeePerGas"))}get maxFeePerGas(){const e=T(this,wf);return e??(this.type===2||this.type===3?bn:null)}set maxFeePerGas(e){I(this,wf,e==null?null:xe(e,"maxFeePerGas"))}get data(){return T(this,pf)}set data(e){I(this,pf,we(e))}get value(){return T(this,Af)}set value(e){I(this,Af,xe(e,"value"))}get chainId(){return T(this,vf)}set chainId(e){I(this,vf,xe(e))}get signature(){return T(this,xf)||null}set signature(e){I(this,xf,e==null?null:Ss.from(e))}get accessList(){const e=T(this,kf)||null;return e??(this.type===1||this.type===2||this.type===3?[]:null)}set accessList(e){I(this,kf,e==null?null:ia(e))}get maxFeePerBlobGas(){const e=T(this,ru);return e==null&&this.type===3?bn:e}set maxFeePerBlobGas(e){I(this,ru,e==null?null:xe(e,"maxFeePerBlobGas"))}get blobVersionedHashes(){let e=T(this,ga);return e==null&&this.type===3?[]:e}set blobVersionedHashes(e){if(e!=null){$(Array.isArray(e),"blobVersionedHashes must be an Array","value",e),e=e.slice();for(let n=0;n<e.length;n++)$(St(e[n],32),"invalid blobVersionedHash",`value[${n}]`,e[n])}I(this,ga,e)}get blobs(){return T(this,ya)==null?null:T(this,ya).map(e=>Object.assign({},e))}set blobs(e){if(e==null){I(this,ya,null);return}const n=[],r=[];for(let s=0;s<e.length;s++){const i=e[s];if(vx(i)){ee(T(this,lo),"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let o=ct(i);if($(o.length<=s2,"blob is too large",`blobs[${s}]`,i),o.length!==s2){const u=new Uint8Array(s2);u.set(o),o=u}const a=T(this,lo).blobToKzgCommitment(o),l=we(T(this,lo).computeBlobKzgProof(o,a));n.push({data:we(o),commitment:we(a),proof:l}),r.push(eP(1,a))}else{const o=we(i.commitment);n.push({data:we(i.data),commitment:o,proof:we(i.proof)}),r.push(eP(1,o))}}I(this,ya,n),I(this,ga,r)}get kzg(){return T(this,lo)}set kzg(e){I(this,lo,e)}get hash(){return this.signature==null?null:en(fe(this,Ef,db).call(this,!0,!1))}get unsignedHash(){return en(this.unsignedSerialized)}get from(){return this.signature==null?null:Use(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,Ef,db).call(this,!0,!0)}get unsignedSerialized(){return fe(this,Ef,db).call(this,!1,!1)}inferType(){const e=this.inferTypes();return e.indexOf(2)>=0?2:e.pop()}inferTypes(){const e=this.gasPrice!=null,n=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,r=this.accessList!=null,s=T(this,ru)!=null||T(this,ga);this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&ee(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),ee(!n||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),ee(this.type!==0||!r,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const i=[];return this.type!=null?i.push(this.type):n?i.push(2):e?(i.push(1),r||i.push(0)):r?(i.push(1),i.push(2)):(s&&this.to||(i.push(0),i.push(1),i.push(2)),i.push(3)),i.sort(),i}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}clone(){return uo.from(this)}toJSON(){const e=n=>n==null?null:n.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:e(this.gasLimit),gasPrice:e(this.gasPrice),maxPriorityFeePerGas:e(this.maxPriorityFeePerGas),maxFeePerGas:e(this.maxFeePerGas),value:e(this.value),chainId:e(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(e){if(e==null)return new uo;if(typeof e=="string"){const r=ct(e);if(r[0]>=127)return uo.from(Kse(r));switch(r[0]){case 1:return uo.from(Yse(r));case 2:return uo.from(Qse(r));case 3:return uo.from(Zse(r))}ee(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const n=new uo;return e.type!=null&&(n.type=e.type),e.to!=null&&(n.to=e.to),e.nonce!=null&&(n.nonce=e.nonce),e.gasLimit!=null&&(n.gasLimit=e.gasLimit),e.gasPrice!=null&&(n.gasPrice=e.gasPrice),e.maxPriorityFeePerGas!=null&&(n.maxPriorityFeePerGas=e.maxPriorityFeePerGas),e.maxFeePerGas!=null&&(n.maxFeePerGas=e.maxFeePerGas),e.maxFeePerBlobGas!=null&&(n.maxFeePerBlobGas=e.maxFeePerBlobGas),e.data!=null&&(n.data=e.data),e.value!=null&&(n.value=e.value),e.chainId!=null&&(n.chainId=e.chainId),e.signature!=null&&(n.signature=Ss.from(e.signature)),e.accessList!=null&&(n.accessList=e.accessList),e.blobVersionedHashes!=null&&(n.blobVersionedHashes=e.blobVersionedHashes),e.kzg!=null&&(n.kzg=e.kzg),e.blobs!=null&&(n.blobs=e.blobs),e.hash!=null&&($(n.isSigned(),"unsigned transaction cannot define '.hash'","tx",e),$(n.hash===e.hash,"hash mismatch","tx",e)),e.from!=null&&($(n.isSigned(),"unsigned transaction cannot define '.from'","tx",e),$(n.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),n}};pi=new WeakMap,hf=new WeakMap,pf=new WeakMap,mf=new WeakMap,gf=new WeakMap,yf=new WeakMap,bf=new WeakMap,wf=new WeakMap,Af=new WeakMap,vf=new WeakMap,xf=new WeakMap,kf=new WeakMap,ru=new WeakMap,ga=new WeakMap,lo=new WeakMap,ya=new WeakMap,Ef=new WeakSet,db=function(e,n){ee(!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 qse(this,r);case 1:return Xse(this,r);case 2:return Jse(this,r);case 3:return eie(this,r,n?this.blobs:null)}ee(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})};let zh=uo;const tP=new Uint8Array(32);tP.fill(0);const tie=BigInt(-1),nP=BigInt(0),rP=BigInt(1),nie=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function rie(t){const e=ct(t),n=e.length%32;return n?$t([e,tP.slice(n)]):we(e)}const sie=Xo(rP,32),iie=Xo(nP,32),sP={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},l2=["name","version","chainId","verifyingContract","salt"];function iP(t){return function(e){return $(typeof e=="string",`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const oie={name:iP("name"),version:iP("version"),chainId:function(t){const e=xe(t,"domain.chainId");return $(e>=0,"invalid chain ID","domain.chainId",t),Number.isSafeInteger(e)?Number(e):kl(e)},verifyingContract:function(t){try{return gt(t).toLowerCase()}catch{}$(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){const e=ct(t,"domain.salt");return $(e.length===32,'invalid domain value "salt"',"domain.salt",t),we(e)}};function u2(t){{const e=t.match(/^(u?)int(\d+)$/);if(e){const n=e[1]==="",r=parseInt(e[2]);$(r%8===0&&r!==0&&r<=256&&e[2]===String(r),"invalid numeric width","type",t);const s=Oh(nie,n?r-1:r),i=n?(s+rP)*tie:nP;return function(o){const a=xe(o,"value");return $(a>=i&&a<=s,`value out-of-bounds for ${t}`,"value",a),Xo(n?l4(a,256):a,32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const n=parseInt(e[1]);return $(n!==0&&n<=32&&e[1]===String(n),"invalid bytes width","type",t),function(r){const s=ct(r);return $(s.length===n,`invalid length for ${t}`,"value",r),rie(r)}}}switch(t){case"address":return function(e){return xl(gt(e),32)};case"bool":return function(e){return e?sie:iie};case"bytes":return function(e){return en(e)};case"string":return function(e){return Ol(e)}}return null}function oP(t,e){return`${t}(${e.map(({name:n,type:r})=>r+" "+n).join(",")})`}function dy(t){const e=t.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);return e?{base:e[1],index:e[2]+e[4],array:{base:e[1],prefix:e[1]+e[2],count:e[5]?parseInt(e[5]):-1}}:{base:t}}const ns=class ns{constructor(e){J(this,ib);W(this,"primaryType");J(this,gp);J(this,co);J(this,Cf);I(this,co,new Map),I(this,Cf,new Map);const n=new Map,r=new Map,s=new Map,i={};Object.keys(e).forEach(l=>{i[l]=e[l].map(({name:u,type:c})=>{let{base:f,index:d}=dy(c);return f==="int"&&!e.int&&(f="int256"),f==="uint"&&!e.uint&&(f="uint256"),{name:u,type:f+(d||"")}}),n.set(l,new Set),r.set(l,[]),s.set(l,new Set)}),I(this,gp,JSON.stringify(i));for(const l in i){const u=new Set;for(const c of i[l]){$(!u.has(c.name),`duplicate variable name ${JSON.stringify(c.name)} in ${JSON.stringify(l)}`,"types",e),u.add(c.name);const f=dy(c.type).base;$(f!==l,`circular type reference to ${JSON.stringify(f)}`,"types",e),!u2(f)&&($(r.has(f),`unknown type ${JSON.stringify(f)}`,"types",e),r.get(f).push(l),n.get(l).add(f))}}const o=Array.from(r.keys()).filter(l=>r.get(l).length===0);$(o.length!==0,"missing primary type","types",e),$(o.length===1,`ambiguous primary types or unused types: ${o.map(l=>JSON.stringify(l)).join(", ")}`,"types",e),Oe(this,{primaryType:o[0]});function a(l,u){$(!u.has(l),`circular type reference to ${JSON.stringify(l)}`,"types",e),u.add(l);for(const c of n.get(l))if(r.has(c)){a(c,u);for(const f of u)s.get(f).add(c)}u.delete(l)}a(this.primaryType,new Set);for(const[l,u]of s){const c=Array.from(u);c.sort(),T(this,co).set(l,oP(l,i[l])+c.map(f=>oP(f,i[f])).join(""))}}get types(){return JSON.parse(T(this,gp))}getEncoder(e){let n=T(this,Cf).get(e);return n||(n=fe(this,ib,QL).call(this,e),T(this,Cf).set(e,n)),n}encodeType(e){const n=T(this,co).get(e);return $(n,`unknown type: ${JSON.stringify(e)}`,"name",e),n}encodeData(e,n){return this.getEncoder(e)(n)}hashStruct(e,n){return en(this.encodeData(e,n))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,n,r){if(u2(e))return r(e,n);const s=dy(e).array;if(s)return $(s.count===-1||s.count===n.length,`array length mismatch; expected length ${s.count}`,"value",n),n.map(o=>this._visit(s.prefix,o,r));const i=this.types[e];if(i)return i.reduce((o,{name:a,type:l})=>(o[a]=this._visit(l,n[a],r),o),{});$(!1,`unknown type: ${e}`,"type",e)}visit(e,n){return this._visit(this.primaryType,e,n)}static from(e){return new ns(e)}static getPrimaryType(e){return ns.from(e).primaryType}static hashStruct(e,n,r){return ns.from(n).hashStruct(e,r)}static hashDomain(e){const n=[];for(const r in e){if(e[r]==null)continue;const s=sP[r];$(s,`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),n.push({name:r,type:s})}return n.sort((r,s)=>l2.indexOf(r.name)-l2.indexOf(s.name)),ns.hashStruct("EIP712Domain",{EIP712Domain:n},e)}static encode(e,n,r){return $t(["0x1901",ns.hashDomain(e),ns.from(n).hash(r)])}static hash(e,n,r){return en(ns.encode(e,n,r))}static async resolveNames(e,n,r,s){e=Object.assign({},e);for(const a in e)e[a]==null&&delete e[a];const i={};e.verifyingContract&&!St(e.verifyingContract,20)&&(i[e.verifyingContract]="0x");const o=ns.from(n);o.visit(r,(a,l)=>(a==="address"&&!St(l,20)&&(i[l]="0x"),l));for(const a in i)i[a]=await s(a);return e.verifyingContract&&i[e.verifyingContract]&&(e.verifyingContract=i[e.verifyingContract]),r=o.visit(r,(a,l)=>a==="address"&&i[l]?i[l]:l),{domain:e,value:r}}static getPayload(e,n,r){ns.hashDomain(e);const s={},i=[];l2.forEach(l=>{const u=e[l];u!=null&&(s[l]=oie[l](u),i.push({name:l,type:sP[l]}))});const o=ns.from(n);n=o.types;const a=Object.assign({},n);return $(a.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",n),a.EIP712Domain=i,o.encode(r),{types:a,domain:s,primaryType:o.primaryType,message:o.visit(r,(l,u)=>{if(l.match(/^bytes(\d*)/))return we(ct(u));if(l.match(/^u?int/))return xe(u).toString();switch(l){case"address":return u.toLowerCase();case"bool":return!!u;case"string":return $(typeof u=="string","invalid string","value",u),u}$(!1,"unsupported type","type",l)})}}};gp=new WeakMap,co=new WeakMap,Cf=new WeakMap,ib=new WeakSet,QL=function(e){{const s=u2(e);if(s)return s}const n=dy(e).array;if(n){const s=n.prefix,i=this.getEncoder(s);return o=>{$(n.count===-1||n.count===o.length,`array length mismatch; expected length ${n.count}`,"value",o);let a=o.map(i);return T(this,co).has(s)&&(a=a.map(en)),en($t(a))}}const r=this.types[e];if(r){const s=Ol(T(this,co).get(e));return i=>{const o=r.map(({name:a,type:l})=>{const u=this.getEncoder(l)(i[a]);return T(this,co).has(l)?en(u):u});return o.unshift(s),$t(o)}}$(!1,`unknown type: ${e}`,"type",e)};let hy=ns;function Jn(t){const e=new Set;return t.forEach(n=>e.add(n)),Object.freeze(e)}const aie=Jn("external public payable override".split(" ")),aP="constant external internal payable private public pure view override",lie=Jn(aP.split(" ")),lP="constructor error event fallback function receive struct",uP=Jn(lP.split(" ")),cP="calldata memory storage payable indexed",uie=Jn(cP.split(" ")),cie=[lP,cP,"tuple returns",aP].join(" "),fie=Jn(cie.split(" ")),die={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},hie=new RegExp("^(\\s*)"),pie=new RegExp("^([0-9]+)"),mie=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),fP=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),dP=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"),ob=class ob{constructor(e){J(this,yp);J(this,Dn);J(this,Ns);I(this,Dn,0),I(this,Ns,e.slice())}get offset(){return T(this,Dn)}get length(){return T(this,Ns).length-T(this,Dn)}clone(){return new ob(T(this,Ns))}reset(){I(this,Dn,0)}popKeyword(e){const n=this.peek();if(n.type!=="KEYWORD"||!e.has(n.text))throw new Error(`expected keyword ${n.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){const n=this.peek();throw new Error(`expected ${e}; got ${n.type} ${JSON.stringify(n.text)}`)}return this.pop().text}popParen(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const n=fe(this,yp,Zk).call(this,T(this,Dn)+1,e.match+1);return I(this,Dn,e.match+1),n}popParams(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const n=[];for(;T(this,Dn)<e.match-1;){const r=this.peek().linkNext;n.push(fe(this,yp,Zk).call(this,T(this,Dn)+1,r)),I(this,Dn,r)}return I(this,Dn,e.match+1),n}peek(){if(T(this,Dn)>=T(this,Ns).length)throw new Error("out-of-bounds");return T(this,Ns)[T(this,Dn)]}peekKeyword(e){const n=this.peekType("KEYWORD");return n!=null&&e.has(n)?n:null}peekType(e){if(this.length===0)return null;const n=this.peek();return n.type===e?n.text:null}pop(){const e=this.peek();return Dp(this,Dn)._++,e}toString(){const e=[];for(let n=T(this,Dn);n<T(this,Ns).length;n++){const r=T(this,Ns)[n];e.push(`${r.type}:${r.text}`)}return`<TokenString ${e.join(" ")}>`}};Dn=new WeakMap,Ns=new WeakMap,yp=new WeakSet,Zk=function(e=0,n=0){return new ob(T(this,Ns).slice(e,n).map(r=>Object.freeze(Object.assign({},r,{match:r.match-e,linkBack:r.linkBack-e,linkNext:r.linkNext-e}))))};let Ts=ob;function oa(t){const e=[],n=o=>{const a=i<t.length?JSON.stringify(t[i]):"$EOI";throw new Error(`invalid token ${a} at ${i}: ${o}`)};let r=[],s=[],i=0;for(;i<t.length;){let o=t.substring(i),a=o.match(hie);a&&(i+=a[1].length,o=t.substring(i));const l={depth:r.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:i,value:-1};e.push(l);let u=die[o[0]]||"";if(u){if(l.type=u,l.text=o[0],i++,u==="OPEN_PAREN")r.push(e.length-1),s.push(e.length-1);else if(u=="CLOSE_PAREN")r.length===0&&n("no matching open bracket"),l.match=r.pop(),e[l.match].match=e.length-1,l.depth--,l.linkBack=s.pop(),e[l.linkBack].linkNext=e.length-1;else if(u==="COMMA")l.linkBack=s.pop(),e[l.linkBack].linkNext=e.length-1,s.push(e.length-1);else if(u==="OPEN_BRACKET")l.type="BRACKET";else if(u==="CLOSE_BRACKET"){let c=e.pop().text;if(e.length>0&&e[e.length-1].type==="NUMBER"){const f=e.pop().text;c=f+c,e[e.length-1].value=Qe(f)}if(e.length===0||e[e.length-1].type!=="BRACKET")throw new Error("missing opening bracket");e[e.length-1].text+=c}continue}if(a=o.match(mie),a){if(l.text=a[1],i+=l.text.length,fie.has(l.text)){l.type="KEYWORD";continue}if(l.text.match(dP)){l.type="TYPE";continue}l.type="ID";continue}if(a=o.match(pie),a){l.text=a[1],l.type="NUMBER",i+=l.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(o[0])} at position ${i}`)}return new Ts(e.map(o=>Object.freeze(o)))}function hP(t,e){let n=[];for(const r in e.keys())t.has(r)&&n.push(r);if(n.length>1)throw new Error(`conflicting types: ${n.join(", ")}`)}function py(t,e){if(e.peekKeyword(uP)){const n=e.pop().text;if(n!==t)throw new Error(`expected ${t}, got ${n}`)}return e.popType("ID")}function Gi(t,e){const n=new Set;for(;;){const r=t.peekType("KEYWORD");if(r==null||e&&!e.has(r))break;if(t.pop(),n.has(r))throw new Error(`duplicate keywords: ${JSON.stringify(r)}`);n.add(r)}return Object.freeze(n)}function pP(t){let e=Gi(t,lie);return hP(e,Jn("constant payable nonpayable".split(" "))),hP(e,Jn("pure view payable nonpayable".split(" "))),e.has("view")?"view":e.has("pure")?"pure":e.has("payable")?"payable":e.has("nonpayable")?"nonpayable":e.has("constant")?"view":"nonpayable"}function Wi(t,e){return t.popParams().map(n=>En.from(n,e))}function mP(t){if(t.peekType("AT")){if(t.pop(),t.peekType("NUMBER"))return xe(t.pop().text);throw new Error("invalid gas")}return null}function Nl(t){if(t.length)throw new Error(`unexpected tokens at offset ${t.offset}: ${t.toString()}`)}const gie=new RegExp(/^(.*)\[([0-9]*)\]$/);function gP(t){const e=t.match(dP);if($(e,"invalid type","type",t),t==="uint")return"uint256";if(t==="int")return"int256";if(e[2]){const n=parseInt(e[2]);$(n!==0&&n<=32,"invalid bytes length","type",t)}else if(e[3]){const n=parseInt(e[3]);$(n!==0&&n<=256&&n%8===0,"invalid numeric width","type",t)}return t}const Lt={},dr=Symbol.for("_ethers_internal"),yP="_ParamTypeInternal",bP="_ErrorInternal",wP="_EventInternal",AP="_ConstructorInternal",vP="_FallbackInternal",xP="_FunctionInternal",kP="_StructInternal",rs=class rs{constructor(e,n,r,s,i,o,a,l){J(this,Sf);W(this,"name");W(this,"type");W(this,"baseType");W(this,"indexed");W(this,"components");W(this,"arrayLength");W(this,"arrayChildren");if($g(e,Lt,"ParamType"),Object.defineProperty(this,dr,{value:yP}),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("");Oe(this,{name:n,type:r,baseType:s,indexed:i,components:o,arrayLength:a,arrayChildren:l})}format(e){if(e==null&&(e="sighash"),e==="json"){const r=this.name||"";if(this.isArray()){const i=JSON.parse(this.arrayChildren.format("json"));return i.name=r,i.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(i)}const s={type:this.baseType==="tuple"?"tuple":this.type,name:r};return typeof this.indexed=="boolean"&&(s.indexed=this.indexed),this.isTuple()&&(s.components=this.components.map(i=>JSON.parse(i.format(e)))),JSON.stringify(s)}let n="";return this.isArray()?(n+=this.arrayChildren.format(e),n+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?n+="("+this.components.map(r=>r.format(e)).join(e==="full"?", ":",")+")":n+=this.type,e!=="sighash"&&(this.indexed===!0&&(n+=" indexed"),e==="full"&&this.name&&(n+=" "+this.name)),n}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(e,n){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw new Error("array is wrong length");const r=this;return e.map(s=>r.arrayChildren.walk(s,n))}if(this.isTuple()){if(!Array.isArray(e))throw new Error("invalid tuple value");if(e.length!==this.components.length)throw new Error("array is wrong length");const r=this;return e.map((s,i)=>r.components[i].walk(s,n))}return n(this.type,e)}async walkAsync(e,n){const r=[],s=[e];return fe(this,Sf,hb).call(this,r,e,n,i=>{s[0]=i}),r.length&&await Promise.all(r),s[0]}static from(e,n){if(rs.isParamType(e))return e;if(typeof e=="string")try{return rs.from(oa(e),n)}catch{$(!1,"invalid param type","obj",e)}else if(e instanceof Ts){let a="",l="",u=null;Gi(e,Jn(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(l="tuple",u=e.popParams().map(m=>rs.from(m)),a=`tuple(${u.map(m=>m.format()).join(",")})`):(a=gP(e.popType("TYPE")),l=a);let c=null,f=null;for(;e.length&&e.peekType("BRACKET");){const m=e.pop();c=new rs(Lt,"",a,l,null,u,f,c),f=m.value,a+=m.text,l="array",u=null}let d=null;if(Gi(e,uie).has("indexed")){if(!n)throw new Error("");d=!0}const p=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new rs(Lt,p,a,l,d,u,f,c)}const r=e.name;$(!r||typeof r=="string"&&r.match(fP),"invalid name","obj.name",r);let s=e.indexed;s!=null&&($(n,"parameter cannot be indexed","obj.indexed",e.indexed),s=!!s);let i=e.type,o=i.match(gie);if(o){const a=parseInt(o[2]||"-1"),l=rs.from({type:o[1],components:e.components});return new rs(Lt,r||"",i,"array",s,null,a,l)}if(i==="tuple"||i.startsWith("tuple(")||i.startsWith("(")){const a=e.components!=null?e.components.map(u=>rs.from(u)):null;return new rs(Lt,r||"",i,"tuple",s,a,null,null)}return i=gP(e.type),new rs(Lt,r||"",i,i,s,null,null,null)}static isParamType(e){return e&&e[dr]===yP}};Sf=new WeakSet,hb=function(e,n,r,s){if(this.isArray()){if(!Array.isArray(n))throw new Error("invalid array value");if(this.arrayLength!==-1&&n.length!==this.arrayLength)throw new Error("array is wrong length");const o=this.arrayChildren,a=n.slice();a.forEach((l,u)=>{var c;fe(c=o,Sf,hb).call(c,e,l,r,f=>{a[u]=f})}),s(a);return}if(this.isTuple()){const o=this.components;let a;if(Array.isArray(n))a=n.slice();else{if(n==null||typeof n!="object")throw new Error("invalid tuple value");a=o.map(l=>{if(!l.name)throw new Error("cannot use object value with unnamed components");if(!(l.name in n))throw new Error(`missing value for component ${l.name}`);return n[l.name]})}if(a.length!==this.components.length)throw new Error("array is wrong length");a.forEach((l,u)=>{var c;fe(c=o[u],Sf,hb).call(c,e,l,r,f=>{a[u]=f})}),s(a);return}const i=r(this.type,n);i.then?e.push(async function(){s(await i)}()):s(i)};let En=rs;class Rl{constructor(e,n,r){W(this,"type");W(this,"inputs");$g(e,Lt,"Fragment"),r=Object.freeze(r.slice()),Oe(this,{type:n,inputs:r})}static from(e){if(typeof e=="string"){try{Rl.from(JSON.parse(e))}catch{}return Rl.from(oa(e))}if(e instanceof Ts)switch(e.peekKeyword(uP)){case"constructor":return Ki.from(e);case"error":return hr.from(e);case"event":return ci.from(e);case"fallback":case"receive":return qi.from(e);case"function":return fi.from(e);case"struct":return Pl.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return Ki.from(e);case"error":return hr.from(e);case"event":return ci.from(e);case"fallback":case"receive":return qi.from(e);case"function":return fi.from(e);case"struct":return Pl.from(e)}ee(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}$(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return Ki.isFragment(e)}static isError(e){return hr.isFragment(e)}static isEvent(e){return ci.isFragment(e)}static isFunction(e){return fi.isFragment(e)}static isStruct(e){return Pl.isFragment(e)}}class my extends Rl{constructor(n,r,s,i){super(n,r,i);W(this,"name");$(typeof s=="string"&&s.match(fP),"invalid identifier","name",s),i=Object.freeze(i.slice()),Oe(this,{name:s})}}function $h(t,e){return"("+e.map(n=>n.format(t)).join(t==="full"?", ":",")+")"}class hr extends my{constructor(e,n,r){super(e,"error",n,r),Object.defineProperty(this,dr,{value:bP})}get selector(){return Ol(this.format("sighash")).substring(0,10)}format(e){if(e==null&&(e="sighash"),e==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});const n=[];return e!=="sighash"&&n.push("error"),n.push(this.name+$h(e,this.inputs)),n.join(" ")}static from(e){if(hr.isFragment(e))return e;if(typeof e=="string")return hr.from(oa(e));if(e instanceof Ts){const n=py("error",e),r=Wi(e);return Nl(e),new hr(Lt,n,r)}return new hr(Lt,e.name,e.inputs?e.inputs.map(En.from):[])}static isFragment(e){return e&&e[dr]===bP}}class ci extends my{constructor(n,r,s,i){super(n,"event",r,s);W(this,"anonymous");Object.defineProperty(this,dr,{value:wP}),Oe(this,{anonymous:i})}get topicHash(){return Ol(this.format("sighash"))}format(n){if(n==null&&(n="sighash"),n==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(s=>JSON.parse(s.format(n)))});const r=[];return n!=="sighash"&&r.push("event"),r.push(this.name+$h(n,this.inputs)),n!=="sighash"&&this.anonymous&&r.push("anonymous"),r.join(" ")}static getTopicHash(n,r){return r=(r||[]).map(i=>En.from(i)),new ci(Lt,n,r,!1).topicHash}static from(n){if(ci.isFragment(n))return n;if(typeof n=="string")try{return ci.from(oa(n))}catch{$(!1,"invalid event fragment","obj",n)}else if(n instanceof Ts){const r=py("event",n),s=Wi(n,!0),i=!!Gi(n,Jn(["anonymous"])).has("anonymous");return Nl(n),new ci(Lt,r,s,i)}return new ci(Lt,n.name,n.inputs?n.inputs.map(r=>En.from(r,!0)):[],!!n.anonymous)}static isFragment(n){return n&&n[dr]===wP}}class Ki extends Rl{constructor(n,r,s,i,o){super(n,r,s);W(this,"payable");W(this,"gas");Object.defineProperty(this,dr,{value:AP}),Oe(this,{payable:i,gas:o})}format(n){if(ee(n!=null&&n!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),n==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(n)))});const r=[`constructor${$h(n,this.inputs)}`];return this.payable&&r.push("payable"),this.gas!=null&&r.push(`@${this.gas.toString()}`),r.join(" ")}static from(n){if(Ki.isFragment(n))return n;if(typeof n=="string")try{return Ki.from(oa(n))}catch{$(!1,"invalid constuctor fragment","obj",n)}else if(n instanceof Ts){Gi(n,Jn(["constructor"]));const r=Wi(n),s=!!Gi(n,aie).has("payable"),i=mP(n);return Nl(n),new Ki(Lt,"constructor",r,s,i)}return new Ki(Lt,"constructor",n.inputs?n.inputs.map(En.from):[],!!n.payable,n.gas!=null?n.gas:null)}static isFragment(n){return n&&n[dr]===AP}}class qi extends Rl{constructor(n,r,s){super(n,"fallback",r);W(this,"payable");Object.defineProperty(this,dr,{value:vP}),Oe(this,{payable:s})}format(n){const r=this.inputs.length===0?"receive":"fallback";if(n==="json"){const s=this.payable?"payable":"nonpayable";return JSON.stringify({type:r,stateMutability:s})}return`${r}()${this.payable?" payable":""}`}static from(n){if(qi.isFragment(n))return n;if(typeof n=="string")try{return qi.from(oa(n))}catch{$(!1,"invalid fallback fragment","obj",n)}else if(n instanceof Ts){const r=n.toString(),s=n.peekKeyword(Jn(["fallback","receive"]));if($(s,"type must be fallback or receive","obj",r),n.popKeyword(Jn(["fallback","receive"]))==="receive"){const l=Wi(n);return $(l.length===0,"receive cannot have arguments","obj.inputs",l),Gi(n,Jn(["payable"])),Nl(n),new qi(Lt,[],!0)}let o=Wi(n);o.length?$(o.length===1&&o[0].type==="bytes","invalid fallback inputs","obj.inputs",o.map(l=>l.format("minimal")).join(", ")):o=[En.from("bytes")];const a=pP(n);if($(a==="nonpayable"||a==="payable","fallback cannot be constants","obj.stateMutability",a),Gi(n,Jn(["returns"])).has("returns")){const l=Wi(n);$(l.length===1&&l[0].type==="bytes","invalid fallback outputs","obj.outputs",l.map(u=>u.format("minimal")).join(", "))}return Nl(n),new qi(Lt,o,a==="payable")}if(n.type==="receive")return new qi(Lt,[],!0);if(n.type==="fallback"){const r=[En.from("bytes")],s=n.stateMutability==="payable";return new qi(Lt,r,s)}$(!1,"invalid fallback description","obj",n)}static isFragment(n){return n&&n[dr]===vP}}class fi extends my{constructor(n,r,s,i,o,a){super(n,"function",r,i);W(this,"constant");W(this,"outputs");W(this,"stateMutability");W(this,"payable");W(this,"gas");Object.defineProperty(this,dr,{value:xP}),o=Object.freeze(o.slice()),Oe(this,{constant:s==="view"||s==="pure",gas:a,outputs:o,payable:s==="payable",stateMutability:s})}get selector(){return Ol(this.format("sighash")).substring(0,10)}format(n){if(n==null&&(n="sighash"),n==="json")return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(n))),outputs:this.outputs.map(s=>JSON.parse(s.format(n)))});const r=[];return n!=="sighash"&&r.push("function"),r.push(this.name+$h(n,this.inputs)),n!=="sighash"&&(this.stateMutability!=="nonpayable"&&r.push(this.stateMutability),this.outputs&&this.outputs.length&&(r.push("returns"),r.push($h(n,this.outputs))),this.gas!=null&&r.push(`@${this.gas.toString()}`)),r.join(" ")}static getSelector(n,r){return r=(r||[]).map(i=>En.from(i)),new fi(Lt,n,"view",r,[],null).selector}static from(n){if(fi.isFragment(n))return n;if(typeof n=="string")try{return fi.from(oa(n))}catch{$(!1,"invalid function fragment","obj",n)}else if(n instanceof Ts){const s=py("function",n),i=Wi(n),o=pP(n);let a=[];Gi(n,Jn(["returns"])).has("returns")&&(a=Wi(n));const l=mP(n);return Nl(n),new fi(Lt,s,o,i,a,l)}let r=n.stateMutability;return r==null&&(r="payable",typeof n.constant=="boolean"?(r="view",n.constant||(r="payable",typeof n.payable=="boolean"&&!n.payable&&(r="nonpayable"))):typeof n.payable=="boolean"&&!n.payable&&(r="nonpayable")),new fi(Lt,n.name,r,n.inputs?n.inputs.map(En.from):[],n.outputs?n.outputs.map(En.from):[],n.gas!=null?n.gas:null)}static isFragment(n){return n&&n[dr]===xP}}class Pl extends my{constructor(e,n,r){super(e,"struct",n,r),Object.defineProperty(this,dr,{value:kP})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return Pl.from(oa(e))}catch{$(!1,"invalid struct fragment","obj",e)}else if(e instanceof Ts){const n=py("struct",e),r=Wi(e);return Nl(e),new Pl(Lt,n,r)}return new Pl(Lt,e.name,e.inputs?e.inputs.map(En.from):[])}static isFragment(e){return e&&e[dr]===kP}}const Ds=new Map;Ds.set(0,"GENERIC_PANIC"),Ds.set(1,"ASSERT_FALSE"),Ds.set(17,"OVERFLOW"),Ds.set(18,"DIVIDE_BY_ZERO"),Ds.set(33,"ENUM_RANGE_ERROR"),Ds.set(34,"BAD_STORAGE_DATA"),Ds.set(49,"STACK_UNDERFLOW"),Ds.set(50,"ARRAY_RANGE_ERROR"),Ds.set(65,"OUT_OF_MEMORY"),Ds.set(81,"UNINITIALIZED_FUNCTION_CALL");const yie=new RegExp(/^bytes([0-9]*)$/),bie=new RegExp(/^(u?int)([0-9]*)$/);let c2=null,EP=1024;function wie(t,e,n,r){let s="missing revert data",i=null;const o=null;let a=null;if(n){s="execution reverted";const u=ct(n);if(n=we(n),u.length===0)s+=" (no data present; likely require(false) occurred",i="require(false)";else if(u.length%32!==4)s+=" (could not decode reason; invalid data length)";else if(we(u.slice(0,4))==="0x08c379a0")try{i=r.decode(["string"],u.slice(4))[0],a={signature:"Error(string)",name:"Error",args:[i]},s+=`: ${JSON.stringify(i)}`}catch{s+=" (could not decode reason; invalid string data)"}else if(we(u.slice(0,4))==="0x4e487b71")try{const c=Number(r.decode(["uint256"],u.slice(4))[0]);a={signature:"Panic(uint256)",name:"Panic",args:[c]},i=`Panic due to ${Ds.get(c)||"UNKNOWN"}(${c})`,s+=`: ${i}`}catch{s+=" (could not decode panic code)"}else s+=" (unknown custom error)"}const l={to:e.to?gt(e.to):null,data:e.data||"0x"};return e.from&&(l.from=gt(e.from)),Nt(s,"CALL_EXCEPTION",{action:t,data:n,reason:i,transaction:l,invocation:o,revert:a})}const ab=class ab{constructor(){J(this,ba)}getDefaultValue(e){const n=e.map(s=>fe(this,ba,Qf).call(this,En.from(s)));return new ry(n,"_").defaultValue()}encode(e,n){s4(n.length,e.length,"types/values length mismatch");const r=e.map(o=>fe(this,ba,Qf).call(this,En.from(o))),s=new ry(r,"_"),i=new Sx;return s.encode(i,n),i.data}decode(e,n,r){const s=e.map(o=>fe(this,ba,Qf).call(this,En.from(o)));return new ry(s,"_").decode(new Tx(n,r,EP))}static _setDefaultMaxInflation(e){$(typeof e=="number"&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),EP=e}static defaultAbiCoder(){return c2==null&&(c2=new ab),c2}static getBuiltinCallException(e,n,r){return wie(e,n,r,ab.defaultAbiCoder())}};ba=new WeakSet,Qf=function(e){if(e.isArray())return new $re(fe(this,ba,Qf).call(this,e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new ry(e.components.map(r=>fe(this,ba,Qf).call(this,r)),e.name);switch(e.baseType){case"address":return new Hre(e.name);case"bool":return new Gre(e.name);case"string":return new ese(e.name);case"bytes":return new Wre(e.name);case"":return new Qre(e.name)}let n=e.type.match(bie);if(n){let r=parseInt(n[2]||"256");return $(r!==0&&r<=256&&r%8===0,"invalid "+n[1]+" bit length","param",e),new Zre(r/8,n[1]==="int",e.name)}if(n=e.type.match(yie),n){let r=parseInt(n[1]);return $(r!==0&&r<=32,"invalid bytes length","param",e),new Kre(r,e.name)}$(!1,"invalid type","type",e.type)};let jc=ab;class Aie{constructor(e,n,r){W(this,"fragment");W(this,"name");W(this,"signature");W(this,"topic");W(this,"args");const s=e.name,i=e.format();Oe(this,{fragment:e,name:s,signature:i,topic:n,args:r})}}class vie{constructor(e,n,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();Oe(this,{fragment:e,name:i,args:r,signature:o,selector:n,value:s})}}class xie{constructor(e,n,r){W(this,"fragment");W(this,"name");W(this,"args");W(this,"signature");W(this,"selector");const s=e.name,i=e.format();Oe(this,{fragment:e,name:s,args:r,signature:i,selector:n})}}class CP{constructor(e){W(this,"hash");W(this,"_isIndexed");Oe(this,{hash:e,_isIndexed:!0})}static isIndexed(e){return!!(e&&e._isIndexed)}}const SP={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"},TP={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:t=>`reverted with reason string ${JSON.stringify(t)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:t=>{let e="unknown panic code";return t>=0&&t<=255&&SP[t.toString()]&&(e=SP[t.toString()]),`reverted with panic code 0x${t.toString(16)} (${e})`}}},su=class su{constructor(e){J(this,bi);W(this,"fragments");W(this,"deploy");W(this,"fallback");W(this,"receive");J(this,mi);J(this,gi);J(this,yi);J(this,Ln);let n=[];typeof e=="string"?n=JSON.parse(e):n=e,I(this,yi,new Map),I(this,mi,new Map),I(this,gi,new Map);const r=[];for(const o of n)try{r.push(Rl.from(o))}catch(a){console.log(`[Warning] Invalid Fragment ${JSON.stringify(o)}:`,a.message)}Oe(this,{fragments:Object.freeze(r)});let s=null,i=!1;I(this,Ln,this.getAbiCoder()),this.fragments.forEach((o,a)=>{let l;switch(o.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}Oe(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,yi);break;case"event":l=T(this,gi);break;case"error":l=T(this,mi);break;default:return}const u=o.format();l.has(u)||l.set(u,o)}),this.deploy||Oe(this,{deploy:Ki.from("constructor()")}),Oe(this,{fallback:s,receive:i})}format(e){const n=e?"minimal":"full";return this.fragments.map(s=>s.format(n))}formatJson(){const e=this.fragments.map(n=>n.format("json"));return JSON.stringify(e.map(n=>JSON.parse(n)))}getAbiCoder(){return jc.defaultAbiCoder()}getFunctionName(e){const n=fe(this,bi,pb).call(this,e,null,!1);return $(n,"no matching function","key",e),n.name}hasFunction(e){return!!fe(this,bi,pb).call(this,e,null,!1)}getFunction(e,n){return fe(this,bi,pb).call(this,e,n||null,!0)}forEachFunction(e){const n=Array.from(T(this,yi).keys());n.sort((r,s)=>r.localeCompare(s));for(let r=0;r<n.length;r++){const s=n[r];e(T(this,yi).get(s),r)}}getEventName(e){const n=fe(this,bi,mb).call(this,e,null,!1);return $(n,"no matching event","key",e),n.name}hasEvent(e){return!!fe(this,bi,mb).call(this,e,null,!1)}getEvent(e,n){return fe(this,bi,mb).call(this,e,n||null,!0)}forEachEvent(e){const n=Array.from(T(this,gi).keys());n.sort((r,s)=>r.localeCompare(s));for(let r=0;r<n.length;r++){const s=n[r];e(T(this,gi).get(s),r)}}getError(e,n){if(St(e)){const s=e.toLowerCase();if(TP[s])return hr.from(TP[s].signature);for(const i of T(this,mi).values())if(s===i.selector)return i;return null}if(e.indexOf("(")===-1){const s=[];for(const[i,o]of T(this,mi))i.split("(")[0]===e&&s.push(o);if(s.length===0)return e==="Error"?hr.from("error Error(string)"):e==="Panic"?hr.from("error Panic(uint256)"):null;if(s.length>1){const i=s.map(o=>JSON.stringify(o.format())).join(", ");$(!1,`ambiguous error description (i.e. ${i})`,"name",e)}return s[0]}if(e=hr.from(e).format(),e==="Error(string)")return hr.from("error Error(string)");if(e==="Panic(uint256)")return hr.from("error Panic(uint256)");const r=T(this,mi).get(e);return r||null}forEachError(e){const n=Array.from(T(this,mi).keys());n.sort((r,s)=>r.localeCompare(s));for(let r=0;r<n.length;r++){const s=n[r];e(T(this,mi).get(s),r)}}_decodeParams(e,n){return T(this,Ln).decode(e,n)}_encodeParams(e,n){return T(this,Ln).encode(e,n)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,n){if(typeof e=="string"){const r=this.getError(e);$(r,"unknown error","fragment",e),e=r}return $(Ht(n,0,4)===e.selector,`data signature does not match error ${e.name}.`,"data",n),this._decodeParams(e.inputs,Ht(n,4))}encodeErrorResult(e,n){if(typeof e=="string"){const r=this.getError(e);$(r,"unknown error","fragment",e),e=r}return $t([e.selector,this._encodeParams(e.inputs,n||[])])}decodeFunctionData(e,n){if(typeof e=="string"){const r=this.getFunction(e);$(r,"unknown function","fragment",e),e=r}return $(Ht(n,0,4)===e.selector,`data signature does not match function ${e.name}.`,"data",n),this._decodeParams(e.inputs,Ht(n,4))}encodeFunctionData(e,n){if(typeof e=="string"){const r=this.getFunction(e);$(r,"unknown function","fragment",e),e=r}return $t([e.selector,this._encodeParams(e.inputs,n||[])])}decodeFunctionResult(e,n){if(typeof e=="string"){const i=this.getFunction(e);$(i,"unknown function","fragment",e),e=i}let r="invalid length for result data";const s=Gn(n);if(s.length%32===0)try{return T(this,Ln).decode(e.outputs,s)}catch{r="could not decode result data"}ee(!1,r,"BAD_DATA",{value:we(s),info:{method:e.name,signature:e.format()}})}makeError(e,n){const r=ct(e,"data"),s=jc.getBuiltinCallException("call",n,r);if(s.message.startsWith("execution reverted (unknown custom error)")){const a=we(r.slice(0,4)),l=this.getError(a);if(l)try{const u=T(this,Ln).decode(l.inputs,r.slice(4));s.revert={name:l.name,signature:l.format(),args:u},s.reason=s.revert.signature,s.message=`execution reverted: ${s.reason}`}catch{s.message="execution reverted (coult not decode custom error)"}}const o=this.parseTransaction(n);return o&&(s.invocation={method:o.name,signature:o.signature,args:o.args}),s}encodeFunctionResult(e,n){if(typeof e=="string"){const r=this.getFunction(e);$(r,"unknown function","fragment",e),e=r}return we(T(this,Ln).encode(e.outputs,n||[]))}encodeFilterTopics(e,n){if(typeof e=="string"){const i=this.getEvent(e);$(i,"unknown event","eventFragment",e),e=i}ee(n.length<=e.inputs.length,`too many arguments for ${e.format()}`,"UNEXPECTED_ARGUMENT",{count:n.length,expectedCount:e.inputs.length});const r=[];e.anonymous||r.push(e.topicHash);const s=(i,o)=>i.type==="string"?Ol(o):i.type==="bytes"?en(we(o)):(i.type==="bool"&&typeof o=="boolean"?o=o?"0x01":"0x00":i.type.match(/^u?int/)?o=Xo(o):i.type.match(/^bytes/)?o=nne(o,32):i.type==="address"&&T(this,Ln).encode(["address"],[o]),xl(we(o),32));for(n.forEach((i,o)=>{const a=e.inputs[o];if(!a.indexed){$(i==null,"cannot filter non-indexed parameters; must be null","contract."+a.name,i);return}i==null?r.push(null):a.baseType==="array"||a.baseType==="tuple"?$(!1,"filtering with tuples or arrays not supported","contract."+a.name,i):Array.isArray(i)?r.push(i.map(l=>s(a,l))):r.push(s(a,i))});r.length&&r[r.length-1]===null;)r.pop();return r}encodeEventLog(e,n){if(typeof e=="string"){const o=this.getEvent(e);$(o,"unknown event","eventFragment",e),e=o}const r=[],s=[],i=[];return e.anonymous||r.push(e.topicHash),$(n.length===e.inputs.length,"event arguments/values mismatch","values",n),e.inputs.forEach((o,a)=>{const l=n[a];if(o.indexed)if(o.type==="string")r.push(Ol(l));else if(o.type==="bytes")r.push(en(l));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");r.push(T(this,Ln).encode([o.type],[l]))}else s.push(o),i.push(l)}),{data:T(this,Ln).encode(s,i),topics:r}}decodeEventLog(e,n,r){if(typeof e=="string"){const h=this.getEvent(e);$(h,"unknown event","eventFragment",e),e=h}if(r!=null&&!e.anonymous){const h=e.topicHash;$(St(r[0],32)&&r[0].toLowerCase()===h,"fragment/topic mismatch","topics[0]",r[0]),r=r.slice(1)}const s=[],i=[],o=[];e.inputs.forEach((h,p)=>{h.indexed?h.type==="string"||h.type==="bytes"||h.baseType==="tuple"||h.baseType==="array"?(s.push(En.from({type:"bytes32",name:h.name})),o.push(!0)):(s.push(h),o.push(!1)):(i.push(h),o.push(!1))});const a=r!=null?T(this,Ln).decode(s,$t(r)):null,l=T(this,Ln).decode(i,n,!0),u=[],c=[];let f=0,d=0;return e.inputs.forEach((h,p)=>{let m=null;if(h.indexed)if(a==null)m=new CP(null);else if(o[p])m=new CP(a[d++]);else try{m=a[d++]}catch(g){m=g}else try{m=l[f++]}catch(g){m=g}u.push(m),c.push(h.name||null)}),Dc.fromItems(u,c)}parseTransaction(e){const n=ct(e.data,"tx.data"),r=xe(e.value!=null?e.value:0,"tx.value"),s=this.getFunction(we(n.slice(0,4)));if(!s)return null;const i=T(this,Ln).decode(s.inputs,n.slice(4));return new vie(s,s.selector,i,r)}parseCallResult(e){throw new Error("@TODO")}parseLog(e){const n=this.getEvent(e.topics[0]);return!n||n.anonymous?null:new Aie(n,n.topicHash,this.decodeEventLog(n,e.data,e.topics))}parseError(e){const n=we(e),r=this.getError(Ht(n,0,4));if(!r)return null;const s=T(this,Ln).decode(r.inputs,Ht(n,4));return new xie(r,r.selector,s)}static from(e){return e instanceof su?e:typeof e=="string"?new su(JSON.parse(e)):typeof e.formatJson=="function"?new su(e.formatJson()):typeof e.format=="function"?new su(e.format("json")):new su(e)}};mi=new WeakMap,gi=new WeakMap,yi=new WeakMap,Ln=new WeakMap,bi=new WeakSet,pb=function(e,n,r){if(St(e)){const i=e.toLowerCase();for(const o of T(this,yi).values())if(i===o.selector)return o;return null}if(e.indexOf("(")===-1){const i=[];for(const[o,a]of T(this,yi))o.split("(")[0]===e&&i.push(a);if(n){const o=n.length>0?n[n.length-1]:null;let a=n.length,l=!0;Rn.isTyped(o)&&o.type==="overrides"&&(l=!1,a--);for(let u=i.length-1;u>=0;u--){const c=i[u].inputs.length;c!==a&&(!l||c!==a-1)&&i.splice(u,1)}for(let u=i.length-1;u>=0;u--){const c=i[u].inputs;for(let f=0;f<n.length;f++)if(Rn.isTyped(n[f])){if(f>=c.length){if(n[f].type==="overrides")continue;i.splice(u,1);break}if(n[f].type!==c[f].baseType){i.splice(u,1);break}}}}if(i.length===1&&n&&n.length!==i[0].inputs.length){const o=n[n.length-1];(o==null||Array.isArray(o)||typeof o!="object")&&i.splice(0,1)}if(i.length===0)return null;if(i.length>1&&r){const o=i.map(a=>JSON.stringify(a.format())).join(", ");$(!1,`ambiguous function description (i.e. matches ${o})`,"key",e)}return i[0]}const s=T(this,yi).get(fi.from(e).format());return s||null},mb=function(e,n,r){if(St(e)){const i=e.toLowerCase();for(const o of T(this,gi).values())if(i===o.topicHash)return o;return null}if(e.indexOf("(")===-1){const i=[];for(const[o,a]of T(this,gi))o.split("(")[0]===e&&i.push(a);if(n){for(let o=i.length-1;o>=0;o--)i[o].inputs.length<n.length&&i.splice(o,1);for(let o=i.length-1;o>=0;o--){const a=i[o].inputs;for(let l=0;l<n.length;l++)if(Rn.isTyped(n[l])&&n[l].type!==a[l].baseType){i.splice(o,1);break}}}if(i.length===0)return null;if(i.length>1&&r){const o=i.map(a=>JSON.stringify(a.format())).join(", ");$(!1,`ambiguous event description (i.e. matches ${o})`,"key",e)}return i[0]}const s=T(this,gi).get(ci.from(e).format());return s||null};let f2=su;const DP=BigInt(0);function Uc(t){return t??null}function Kt(t){return t==null?null:t.toString()}class OP{constructor(e,n,r){W(this,"gasPrice");W(this,"maxFeePerGas");W(this,"maxPriorityFeePerGas");Oe(this,{gasPrice:Uc(e),maxFeePerGas:Uc(n),maxPriorityFeePerGas:Uc(r)})}toJSON(){const{gasPrice:e,maxFeePerGas:n,maxPriorityFeePerGas:r}=this;return{_type:"FeeData",gasPrice:Kt(e),maxFeePerGas:Kt(n),maxPriorityFeePerGas:Kt(r)}}}function gy(t){const e={};t.to&&(e.to=t.to),t.from&&(e.from=t.from),t.data&&(e.data=we(t.data));const n="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const s of n)!(s in t)||t[s]==null||(e[s]=xe(t[s],`request.${s}`));const r="type,nonce".split(/,/);for(const s of r)!(s in t)||t[s]==null||(e[s]=Qe(t[s],`request.${s}`));return t.accessList&&(e.accessList=ia(t.accessList)),"blockTag"in t&&(e.blockTag=t.blockTag),"enableCcipRead"in t&&(e.enableCcipRead=!!t.enableCcipRead),"customData"in t&&(e.customData=t.customData),"blobVersionedHashes"in t&&t.blobVersionedHashes&&(e.blobVersionedHashes=t.blobVersionedHashes.slice()),"kzg"in t&&(e.kzg=t.kzg),"blobs"in t&&t.blobs&&(e.blobs=t.blobs.map(s=>vx(s)?we(s):Object.assign({},s))),e}class kie{constructor(e,n){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");J(this,fo);I(this,fo,e.transactions.map(r=>typeof r!="string"?new Wh(r,n):r)),Oe(this,{provider:n,hash:Uc(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:Uc(e.prevRandao),extraData:e.extraData,baseFeePerGas:Uc(e.baseFeePerGas),stateRoot:e.stateRoot,receiptsRoot:e.receiptsRoot})}get transactions(){return T(this,fo).map(e=>typeof e=="string"?e:e.hash)}get prefetchedTransactions(){const e=T(this,fo).slice();return e.length===0?[]:(ee(typeof e[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),e)}toJSON(){const{baseFeePerGas:e,difficulty:n,extraData:r,gasLimit:s,gasUsed:i,hash:o,miner:a,prevRandao:l,nonce:u,number:c,parentHash:f,parentBeaconBlockRoot:d,stateRoot:h,receiptsRoot:p,timestamp:m,transactions:g}=this;return{_type:"Block",baseFeePerGas:Kt(e),difficulty:Kt(n),extraData:r,gasLimit:Kt(s),gasUsed:Kt(i),blobGasUsed:Kt(this.blobGasUsed),excessBlobGas:Kt(this.excessBlobGas),hash:o,miner:a,prevRandao:l,nonce:u,number:c,parentHash:f,timestamp:m,parentBeaconBlockRoot:d,stateRoot:h,receiptsRoot:p,transactions:g}}[Symbol.iterator](){let e=0;const n=this.transactions;return{next:()=>e<this.length?{value:n[e++],done:!1}:{value:void 0,done:!0}}}get length(){return T(this,fo).length}get date(){return this.timestamp==null?null:new Date(this.timestamp*1e3)}async getTransaction(e){let n;if(typeof e=="number")n=T(this,fo)[e];else{const r=e.toLowerCase();for(const s of T(this,fo))if(typeof s=="string"){if(s!==r)continue;n=s;break}else{if(s.hash===r)continue;n=s;break}}if(n==null)throw new Error("no such tx");return typeof n=="string"?await this.provider.getTransaction(n):n}getPrefetchedTransaction(e){const n=this.prefetchedTransactions;if(typeof e=="number")return n[e];e=e.toLowerCase();for(const r of n)if(r.hash===e)return r;$(!1,"no matching transaction","indexOrHash",e)}isMined(){return!!this.hash}isLondon(){return!!this.baseFeePerGas}orphanedEvent(){if(!this.isMined())throw new Error("");return Eie(this)}}fo=new WeakMap;class Gh{constructor(e,n){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=n;const r=Object.freeze(e.topics.slice());Oe(this,{transactionHash:e.transactionHash,blockHash:e.blockHash,blockNumber:e.blockNumber,removed:e.removed,address:e.address,data:e.data,topics:r,index:e.index,transactionIndex:e.transactionIndex})}toJSON(){const{address:e,blockHash:n,blockNumber:r,data:s,index:i,removed:o,topics:a,transactionHash:l,transactionIndex:u}=this;return{_type:"log",address:e,blockHash:n,blockNumber:r,data:s,index:i,removed:o,topics:a,transactionHash:l,transactionIndex:u}}async getBlock(){const e=await this.provider.getBlock(this.blockHash);return ee(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransaction(){const e=await this.provider.getTransaction(this.transactionHash);return ee(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransactionReceipt(){const e=await this.provider.getTransactionReceipt(this.transactionHash);return ee(!!e,"failed to find transaction receipt","UNKNOWN_ERROR",{}),e}removedEvent(){return Cie(this)}}class _P{constructor(e,n){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");J(this,bp);I(this,bp,Object.freeze(e.logs.map(s=>new Gh(s,n))));let r=DP;e.effectiveGasPrice!=null?r=e.effectiveGasPrice:e.gasPrice!=null&&(r=e.gasPrice),Oe(this,{provider:n,to:e.to,from:e.from,contractAddress:e.contractAddress,hash:e.hash,index:e.index,blockHash:e.blockHash,blockNumber:e.blockNumber,logsBloom:e.logsBloom,gasUsed:e.gasUsed,cumulativeGasUsed:e.cumulativeGasUsed,blobGasUsed:e.blobGasUsed,gasPrice:r,blobGasPrice:e.blobGasPrice,type:e.type,status:e.status,root:e.root})}get logs(){return T(this,bp)}toJSON(){const{to:e,from:n,contractAddress:r,hash:s,index:i,blockHash:o,blockNumber:a,logsBloom:l,logs:u,status:c,root:f}=this;return{_type:"TransactionReceipt",blockHash:o,blockNumber:a,contractAddress:r,cumulativeGasUsed:Kt(this.cumulativeGasUsed),from:n,gasPrice:Kt(this.gasPrice),blobGasUsed:Kt(this.blobGasUsed),blobGasPrice:Kt(this.blobGasPrice),gasUsed:Kt(this.gasUsed),hash:s,index:i,logs:u,logsBloom:l,root:f,status:c,to:e}}get length(){return this.logs.length}[Symbol.iterator](){let e=0;return{next:()=>e<this.length?{value:this.logs[e++],done:!1}:{value:void 0,done:!0}}}get fee(){return this.gasUsed*this.gasPrice}async getBlock(){const e=await this.provider.getBlock(this.blockHash);if(e==null)throw new Error("TODO");return e}async getTransaction(){const e=await this.provider.getTransaction(this.hash);if(e==null)throw new Error("TODO");return e}async getResult(){return await this.provider.getTransactionResult(this.hash)}async confirmations(){return await this.provider.getBlockNumber()-this.blockNumber+1}removedEvent(){return NP(this)}reorderedEvent(e){return ee(!e||e.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),MP(this,e)}}bp=new WeakMap;const $k=class $k{constructor(e,n){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");J(this,wa);this.provider=n,this.blockNumber=e.blockNumber!=null?e.blockNumber:null,this.blockHash=e.blockHash!=null?e.blockHash:null,this.hash=e.hash,this.index=e.index,this.type=e.type,this.from=e.from,this.to=e.to||null,this.gasLimit=e.gasLimit,this.nonce=e.nonce,this.data=e.data,this.value=e.value,this.gasPrice=e.gasPrice,this.maxPriorityFeePerGas=e.maxPriorityFeePerGas!=null?e.maxPriorityFeePerGas:null,this.maxFeePerGas=e.maxFeePerGas!=null?e.maxFeePerGas:null,this.maxFeePerBlobGas=e.maxFeePerBlobGas!=null?e.maxFeePerBlobGas:null,this.chainId=e.chainId,this.signature=e.signature,this.accessList=e.accessList!=null?e.accessList:null,this.blobVersionedHashes=e.blobVersionedHashes!=null?e.blobVersionedHashes:null,I(this,wa,-1)}toJSON(){const{blockNumber:e,blockHash:n,index:r,hash:s,type:i,to:o,from:a,nonce:l,data:u,signature:c,accessList:f,blobVersionedHashes:d}=this;return{_type:"TransactionResponse",accessList:f,blockNumber:e,blockHash:n,blobVersionedHashes:d,chainId:Kt(this.chainId),data:u,from:a,gasLimit:Kt(this.gasLimit),gasPrice:Kt(this.gasPrice),hash:s,maxFeePerGas:Kt(this.maxFeePerGas),maxPriorityFeePerGas:Kt(this.maxPriorityFeePerGas),maxFeePerBlobGas:Kt(this.maxFeePerBlobGas),nonce:l,signature:c,to:o,index:r,type:i,value:Kt(this.value)}}async getBlock(){let e=this.blockNumber;if(e==null){const r=await this.getTransaction();r&&(e=r.blockNumber)}if(e==null)return null;const n=this.provider.getBlock(e);if(n==null)throw new Error("TODO");return n}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(this.blockNumber==null){const{tx:n,blockNumber:r}=await Nn({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return n==null||n.blockNumber==null?0:r-n.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(e,n){const r=e??1,s=n??0;let i=T(this,wa),o=-1,a=i===-1;const l=async()=>{if(a)return null;const{blockNumber:d,nonce:h}=await Nn({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,wa)&&(o=T(this,wa)));o<=d;){if(a)return null;const m=await this.provider.getBlock(o,!0);if(m==null)return;for(const g of m)if(g===this.hash)return;for(let g=0;g<m.length;g++){const y=await m.getTransaction(g);if(y.from===this.from&&y.nonce===this.nonce){if(a)return null;const v=await this.provider.getTransactionReceipt(y.hash);if(v==null||d-v.blockNumber+1<r)return;let w="replaced";y.data===this.data&&y.to===this.to&&y.value===this.value?w="repriced":y.data==="0x"&&y.from===y.to&&y.value===DP&&(w="cancelled"),ee(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:w==="replaced"||w==="cancelled",reason:w,replacement:y.replaceableTransaction(i),hash:y.hash,receipt:v})}}o++}},u=d=>{if(d==null||d.status!==0)return d;ee(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:d.to,from:d.from,data:""},receipt:d})},c=await this.provider.getTransactionReceipt(this.hash);if(r===0)return u(c);if(c){if(await c.confirmations()>=r)return u(c)}else if(await l(),r===0)return null;return await new Promise((d,h)=>{const p=[],m=()=>{p.forEach(y=>y())};if(p.push(()=>{a=!0}),s>0){const y=setTimeout(()=>{m(),h(Nt("wait for transaction timeout","TIMEOUT"))},s);p.push(()=>{clearTimeout(y)})}const g=async y=>{if(await y.confirmations()>=r){m();try{d(u(y))}catch(v){h(v)}}};if(p.push(()=>{this.provider.off(this.hash,g)}),this.provider.on(this.hash,g),i>=0){const y=async()=>{try{await l()}catch(v){if(gn(v,"TRANSACTION_REPLACED")){m(),h(v);return}}a||this.provider.once("block",y)};p.push(()=>{this.provider.off("block",y)}),this.provider.once("block",y)}})}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 ee(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),NP(this)}reorderedEvent(e){return ee(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),ee(!e||e.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),MP(this,e)}replaceableTransaction(e){$(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const n=new $k(this,this.provider);return I(n,wa,e),n}};wa=new WeakMap;let Wh=$k;function Eie(t){return{orphan:"drop-block",hash:t.hash,number:t.number}}function MP(t,e){return{orphan:"reorder-transaction",tx:t,other:e}}function NP(t){return{orphan:"drop-transaction",tx:t}}function Cie(t){return{orphan:"drop-log",log:{transactionHash:t.transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,address:t.address,data:t.data,topics:Object.freeze(t.topics.slice()),index:t.index}}}class d2 extends Gh{constructor(n,r,s){super(n,n.provider);W(this,"interface");W(this,"fragment");W(this,"args");const i=r.decodeEventLog(s,n.data,n.topics);Oe(this,{args:i,fragment:s,interface:r})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class RP extends Gh{constructor(n,r){super(n,n.provider);W(this,"error");Oe(this,{error:r})}}class Sie extends _P{constructor(n,r,s){super(s,r);J(this,Tf);I(this,Tf,n)}get logs(){return super.logs.map(n=>{const r=n.topics.length?T(this,Tf).getEvent(n.topics[0]):null;if(r)try{return new d2(n,T(this,Tf),r)}catch(s){return new RP(n,s)}return n})}}Tf=new WeakMap;class h2 extends Wh{constructor(n,r,s){super(s,r);J(this,wp);I(this,wp,n)}async wait(n,r){const s=await super.wait(n,r);return s==null?null:new Sie(T(this,wp),this.provider,s)}}wp=new WeakMap;class PP extends d4{constructor(n,r,s,i){super(n,r,s);W(this,"log");Oe(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 Tie extends PP{constructor(e,n,r,s,i){super(e,n,r,new d2(i,e.interface,s));const o=e.interface.decodeEventLog(s,this.log.data,this.log.topics);Oe(this,{args:o,fragment:s})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const IP=BigInt(0);function LP(t){return t&&typeof t.call=="function"}function BP(t){return t&&typeof t.estimateGas=="function"}function yy(t){return t&&typeof t.resolveName=="function"}function FP(t){return t&&typeof t.sendTransaction=="function"}function jP(t){if(t!=null){if(yy(t))return t;if(t.provider)return t.provider}}class Die{constructor(e,n,r){J(this,Ap);W(this,"fragment");if(Oe(this,{fragment:n}),n.inputs.length<r.length)throw new Error("too many arguments");const s=Il(e.runner,"resolveName"),i=yy(s)?s:null;I(this,Ap,async function(){const o=await Promise.all(n.inputs.map((a,l)=>r[l]==null?null:a.walkAsync(r[l],(c,f)=>c==="address"?Array.isArray(f)?Promise.all(f.map(d=>Qn(d,i))):Qn(f,i):f)));return e.interface.encodeFilterTopics(n,o)}())}getTopicFilter(){return T(this,Ap)}}Ap=new WeakMap;function Il(t,e){return t==null?null:typeof t[e]=="function"?t:t.provider&&typeof t.provider[e]=="function"?t.provider:null}function Ll(t){return t==null?null:t.provider||null}async function UP(t,e){const n=Rn.dereference(t,"overrides");$(typeof n=="object","invalid overrides parameter","overrides",t);const r=gy(n);return $(r.to==null||(e||[]).indexOf("to")>=0,"cannot override to","overrides.to",r.to),$(r.data==null||(e||[]).indexOf("data")>=0,"cannot override data","overrides.data",r.data),r.from&&(r.from=r.from),r}async function Oie(t,e,n){const r=Il(t,"resolveName"),s=yy(r)?r:null;return await Promise.all(e.map((i,o)=>i.walkAsync(n[o],(a,l)=>(l=Rn.dereference(l,a),a==="address"?Qn(l,s):l))))}function _ie(t){const e=async function(o){const a=await UP(o,["data"]);a.to=await t.getAddress(),a.from&&(a.from=await Qn(a.from,jP(t.runner)));const l=t.interface,u=xe(a.value||IP,"overrides.value")===IP,c=(a.data||"0x")==="0x";l.fallback&&!l.fallback.payable&&l.receive&&!c&&!u&&$(!1,"cannot send data to receive or send value to non-payable fallback","overrides",o),$(l.fallback||c,"cannot send data to receive-only contract","overrides.data",a.data);const f=l.receive||l.fallback&&l.fallback.payable;return $(f||u,"cannot send value to non-payable fallback","overrides.value",a.value),$(l.fallback||c,"cannot send data to receive-only contract","overrides.data",a.data),a},n=async function(o){const a=Il(t.runner,"call");ee(LP(a),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const l=await e(o);try{return await a.call(l)}catch(u){throw Ax(u)&&u.data?t.interface.makeError(u.data,l):u}},r=async function(o){const a=t.runner;ee(FP(a),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const l=await a.sendTransaction(await e(o)),u=Ll(t.runner);return new h2(t.interface,u,l)},s=async function(o){const a=Il(t.runner,"estimateGas");return ee(BP(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 Oe(i,{_contract:t,estimateGas:s,populateTransaction:e,send:r,staticCall:n}),i}function Mie(t,e){const n=function(...u){const c=t.interface.getFunction(e,u);return ee(c,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:u}}),c},r=async function(...u){const c=n(...u);let f={};if(c.inputs.length+1===u.length&&(f=await UP(u.pop()),f.from&&(f.from=await Qn(f.from,jP(t.runner)))),c.inputs.length!==u.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const d=await Oie(t.runner,c.inputs,u);return Object.assign({},f,await Nn({to:t.getAddress(),data:t.interface.encodeFunctionData(c,d)}))},s=async function(...u){const c=await a(...u);return c.length===1?c[0]:c},i=async function(...u){const c=t.runner;ee(FP(c),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const f=await c.sendTransaction(await r(...u)),d=Ll(t.runner);return new h2(t.interface,d,f)},o=async function(...u){const c=Il(t.runner,"estimateGas");return ee(BP(c),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await c.estimateGas(await r(...u))},a=async function(...u){const c=Il(t.runner,"call");ee(LP(c),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const f=await r(...u);let d="0x";try{d=await c.call(f)}catch(p){throw Ax(p)&&p.data?t.interface.makeError(p.data,f):p}const h=n(...u);return t.interface.decodeFunctionResult(h,d)},l=async(...u)=>n(...u).constant?await s(...u):await i(...u);return Oe(l,{name:t.interface.getFunctionName(e),_contract:t,_key:e,getFragment:n,estimateGas:o,populateTransaction:r,send:i,staticCall:s,staticCallResult:a}),Object.defineProperty(l,"fragment",{configurable:!1,enumerable:!0,get:()=>{const u=t.interface.getFunction(e);return ee(u,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),u}}),l}function Nie(t,e){const n=function(...s){const i=t.interface.getEvent(e,s);return ee(i,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:s}}),i},r=function(...s){return new Die(t,n(...s),s)};return Oe(r,{name:t.interface.getEventName(e),_contract:t,_key:e,getFragment:n}),Object.defineProperty(r,"fragment",{configurable:!1,enumerable:!0,get:()=>{const s=t.interface.getEvent(e);return ee(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),s}}),r}const by=Symbol.for("_ethersInternal_contract"),VP=new WeakMap;function Rie(t,e){VP.set(t[by],e)}function Rr(t){return VP.get(t[by])}function Pie(t){return t&&typeof t=="object"&&"getTopicFilter"in t&&typeof t.getTopicFilter=="function"&&t.fragment}async function p2(t,e){let n,r=null;if(Array.isArray(e)){const i=function(o){if(St(o,32))return o;const a=t.interface.getEvent(o);return $(a,"unknown fragment","name",o),a.topicHash};n=e.map(o=>o==null?null:Array.isArray(o)?o.map(i):i(o))}else e==="*"?n=[null]:typeof e=="string"?St(e,32)?n=[e]:(r=t.interface.getEvent(e),$(r,"unknown fragment","event",e),n=[r.topicHash]):Pie(e)?n=await e.getTopicFilter():"fragment"in e?(r=e.fragment,n=[r.topicHash]):$(!1,"unknown event name","event",e);n=n.map(i=>{if(i==null)return null;if(Array.isArray(i)){const o=Array.from(new Set(i.map(a=>a.toLowerCase())).values());return o.length===1?o[0]:(o.sort(),o)}return i.toLowerCase()});const s=n.map(i=>i==null?"null":Array.isArray(i)?i.join("|"):i).join("&");return{fragment:r,tag:s,topics:n}}async function Kh(t,e){const{subs:n}=Rr(t);return n.get((await p2(t,e)).tag)||null}async function HP(t,e,n){const r=Ll(t.runner);ee(r,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:s,tag:i,topics:o}=await p2(t,n),{addr:a,subs:l}=Rr(t);let u=l.get(i);if(!u){const f={address:a||t,topics:o},d=g=>{let y=s;if(y==null)try{y=t.interface.getEvent(g.topics[0])}catch{}if(y){const v=y,w=s?t.interface.decodeEventLog(s,g.data,g.topics):[];g2(t,n,w,A=>new Tie(t,A,n,v,g))}else g2(t,n,[],v=>new PP(t,v,n,g))};let h=[];u={tag:i,listeners:[],start:()=>{h.length||h.push(r.on(f,d))},stop:async()=>{if(h.length==0)return;let g=h;h=[],await Promise.all(g),r.off(f,d)}},l.set(i,u)}return u}let m2=Promise.resolve();async function Iie(t,e,n,r){await m2;const s=await Kh(t,e);if(!s)return!1;const i=s.listeners.length;return s.listeners=s.listeners.filter(({listener:o,once:a})=>{const l=Array.from(n);r&&l.push(r(a?null:o));try{o.call(t,...l)}catch{}return!a}),s.listeners.length===0&&(s.stop(),Rr(t).subs.delete(s.tag)),i>0}async function g2(t,e,n,r){try{await m2}catch{}const s=Iie(t,e,n,r);return m2=s,await s}const wy=["then"];zL=by;const vp=class vp{constructor(e,n,r,s){W(this,"target");W(this,"interface");W(this,"runner");W(this,"filters");W(this,zL);W(this,"fallback");$(typeof e=="string"||xR(e),"invalid value for Contract target","target",e),r==null&&(r=null);const i=f2.from(n);Oe(this,{target:e,runner:r,interface:i}),Object.defineProperty(this,by,{value:{}});let o,a=null,l=null;if(s){const f=Ll(r);l=new h2(this.interface,f,s)}let u=new Map;if(typeof e=="string")if(St(e))a=e,o=Promise.resolve(e);else{const f=Il(r,"resolveName");if(!yy(f))throw Nt("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});o=f.resolveName(e).then(d=>{if(d==null)throw Nt("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:e});return Rr(this).addr=d,d})}else o=e.getAddress().then(f=>{if(f==null)throw new Error("TODO");return Rr(this).addr=f,f});Rie(this,{addrPromise:o,addr:a,deployTx:l,subs:u});const c=new Proxy({},{get:(f,d,h)=>{if(typeof d=="symbol"||wy.indexOf(d)>=0)return Reflect.get(f,d,h);try{return this.getEvent(d)}catch(p){if(!gn(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(f,d)=>wy.indexOf(d)>=0?Reflect.has(f,d):Reflect.has(f,d)||this.interface.hasEvent(String(d))});return Oe(this,{filters:c}),Oe(this,{fallback:i.receive||i.fallback?_ie(this):null}),new Proxy(this,{get:(f,d,h)=>{if(typeof d=="symbol"||d in f||wy.indexOf(d)>=0)return Reflect.get(f,d,h);try{return f.getFunction(d)}catch(p){if(!gn(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(f,d)=>typeof d=="symbol"||d in f||wy.indexOf(d)>=0?Reflect.has(f,d):f.interface.hasFunction(d)})}connect(e){return new vp(this.target,this.interface,e)}attach(e){return new vp(e,this.interface,this.runner)}async getAddress(){return await Rr(this).addrPromise}async getDeployedCode(){const e=Ll(this.runner);ee(e,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const n=await e.getCode(await this.getAddress());return n==="0x"?null:n}async waitForDeployment(){const e=this.deploymentTransaction();if(e)return await e.wait(),this;if(await this.getDeployedCode()!=null)return this;const r=Ll(this.runner);return ee(r!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((s,i)=>{const o=async()=>{try{if(await this.getDeployedCode()!=null)return s(this);r.once("block",o)}catch(a){i(a)}};o()})}deploymentTransaction(){return Rr(this).deployTx}getFunction(e){return typeof e!="string"&&(e=e.format()),Mie(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),Nie(this,e)}async queryTransaction(e){throw new Error("@TODO")}async queryFilter(e,n,r){n==null&&(n=0),r==null&&(r="latest");const{addr:s,addrPromise:i}=Rr(this),o=s||await i,{fragment:a,topics:l}=await p2(this,e),u={address:o,topics:l,fromBlock:n,toBlock:r},c=Ll(this.runner);return ee(c,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await c.getLogs(u)).map(f=>{let d=a;if(d==null)try{d=this.interface.getEvent(f.topics[0])}catch{}if(d)try{return new d2(f,this.interface,d)}catch(h){return new RP(f,h)}return new Gh(f,c)})}async on(e,n){const r=await HP(this,"on",e);return r.listeners.push({listener:n,once:!1}),r.start(),this}async once(e,n){const r=await HP(this,"once",e);return r.listeners.push({listener:n,once:!0}),r.start(),this}async emit(e,...n){return await g2(this,e,n,null)}async listenerCount(e){if(e){const s=await Kh(this,e);return s?s.listeners.length:0}const{subs:n}=Rr(this);let r=0;for(const{listeners:s}of n.values())r+=s.length;return r}async listeners(e){if(e){const s=await Kh(this,e);return s?s.listeners.map(({listener:i})=>i):[]}const{subs:n}=Rr(this);let r=[];for(const{listeners:s}of n.values())r=r.concat(s.map(({listener:i})=>i));return r}async off(e,n){const r=await Kh(this,e);if(!r)return this;if(n){const s=r.listeners.map(({listener:i})=>i).indexOf(n);s>=0&&r.listeners.splice(s,1)}return(n==null||r.listeners.length===0)&&(r.stop(),Rr(this).subs.delete(r.tag)),this}async removeAllListeners(e){if(e){const n=await Kh(this,e);if(!n)return this;n.stop(),Rr(this).subs.delete(n.tag)}else{const{subs:n}=Rr(this);for(const{tag:r,stop:s}of n.values())s(),n.delete(r)}return this}async addListener(e,n){return await this.on(e,n)}async removeListener(e,n){return await this.off(e,n)}static buildClass(e){class n extends vp{constructor(s,i=null){super(s,e,i)}}return n}static from(e,n,r){return r==null&&(r=null),new this(e,n,r)}};let y2=vp;function Lie(){return y2}class Vc extends Lie(){}function b2(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):$(!1,"unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}class Bie{constructor(e){W(this,"name");Oe(this,{name:e})}connect(e){return this}supportsCoinType(e){return!1}async encodeAddress(e,n){throw new Error("unsupported coin")}async decodeAddress(e,n){throw new Error("unsupported coin")}}const zP=new RegExp("^(ipfs)://(.*)$","i"),$P=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),zP,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")],Df=class Df{constructor(e,n,r){J(this,va);W(this,"provider");W(this,"address");W(this,"name");J(this,Aa);J(this,iu);Oe(this,{provider:e,address:n,name:r}),I(this,Aa,null),I(this,iu,new Vc(n,["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)","function addr(bytes32, uint) view returns (bytes)","function text(bytes32, string) view returns (string)","function contenthash(bytes32) view returns (bytes)"],e))}async supportsWildcard(){return T(this,Aa)==null&&I(this,Aa,(async()=>{try{return await T(this,iu).supportsInterface("0x9061b923")}catch(e){if(gn(e,"CALL_EXCEPTION"))return!1;throw I(this,Aa,null),e}})()),await T(this,Aa)}async getAddress(e){if(e==null&&(e=60),e===60)try{const i=await fe(this,va,Jf).call(this,"addr(bytes32)");return i==null||i===Ph?null:i}catch(i){if(gn(i,"CALL_EXCEPTION"))return null;throw i}if(e>=0&&e<2147483648){let i=e+2147483648;const o=await fe(this,va,Jf).call(this,"addr(bytes32,uint)",[i]);if(St(o,20))return gt(o)}let n=null;for(const i of this.provider.plugins)if(i instanceof Bie&&i.supportsCoinType(e)){n=i;break}if(n==null)return null;const r=await fe(this,va,Jf).call(this,"addr(bytes32,uint)",[e]);if(r==null||r==="0x")return null;const s=await n.decodeAddress(e,r);if(s!=null)return s;ee(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${e})`,info:{coinType:e,data:r}})}async getText(e){const n=await fe(this,va,Jf).call(this,"text(bytes32,string)",[e]);return n==null||n==="0x"?null:n}async getContentHash(){const e=await fe(this,va,Jf).call(this,"contenthash(bytes32)");if(e==null||e==="0x")return null;const n=e.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(n){const s=n[1]==="e3010170"?"ipfs":"ipns",i=parseInt(n[4],16);if(n[5].length===i*2)return`${s}://${ine("0x"+n[2])}`}const r=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(r&&r[1].length===64)return`bzz://${r[1]}`;ee(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:e}})}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const e=[{type:"name",value:this.name}];try{const n=await this.getText("avatar");if(n==null)return e.push({type:"!avatar",value:""}),{url:null,linkage:e};e.push({type:"avatar",value:n});for(let r=0;r<$P.length;r++){const s=n.match($P[r]);if(s==null)continue;const i=s[1].toLowerCase();switch(i){case"https":case"data":return e.push({type:"url",value:n}),{linkage:e,url:n};case"ipfs":{const o=b2(n);return e.push({type:"ipfs",value:n}),e.push({type:"url",value:o}),{linkage:e,url:o}}case"erc721":case"erc1155":{const o=i==="erc721"?"tokenURI(uint256)":"uri(uint256)";e.push({type:i,value:n});const a=await this.getAddress();if(a==null)return e.push({type:"!owner",value:""}),{url:null,linkage:e};const l=(s[2]||"").split("/");if(l.length!==2)return e.push({type:`!${i}caip`,value:s[2]||""}),{url:null,linkage:e};const u=l[1],c=new Vc(l[0],["function tokenURI(uint) view returns (string)","function ownerOf(uint) view returns (address)","function uri(uint) view returns (string)","function balanceOf(address, uint256) view returns (uint)"],this.provider);if(i==="erc721"){const m=await c.ownerOf(u);if(a!==m)return e.push({type:"!owner",value:m}),{url:null,linkage:e};e.push({type:"owner",value:m})}else if(i==="erc1155"){const m=await c.balanceOf(a,u);if(!m)return e.push({type:"!balance",value:"0"}),{url:null,linkage:e};e.push({type:"balance",value:m.toString()})}let f=await c[o](u);if(f==null||f==="0x")return e.push({type:"!metadata-url",value:""}),{url:null,linkage:e};e.push({type:"metadata-url-base",value:f}),i==="erc1155"&&(f=f.replace("{id}",Xo(u,32).substring(2)),e.push({type:"metadata-url-expanded",value:f})),f.match(/^ipfs:/i)&&(f=b2(f)),e.push({type:"metadata-url",value:f});let d={};const h=await new Kn(f).send();h.assertOk();try{d=h.bodyJson}catch{try{e.push({type:"!metadata",value:h.bodyText})}catch{const y=h.body;return y&&e.push({type:"!metadata",value:we(y)}),{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(zP)==null)return e.push({type:"!imageUrl-ipfs",value:p}),{url:null,linkage:e};e.push({type:"imageUrl-ipfs",value:p}),p=b2(p)}return e.push({type:"url",value:p}),{linkage:e,url:p}}}}}catch{}return{linkage:e,url:null}}static async getEnsAddress(e){const n=await e.getNetwork(),r=n.getPlugin("org.ethers.plugins.network.Ens");return ee(r,"network does not support ENS","UNSUPPORTED_OPERATION",{operation:"getEnsAddress",info:{network:n}}),r.address}static async fromName(e,n){var s;let r=n;for(;;){if(r===""||r==="."||n!=="eth"&&r==="eth")return null;const i=await fe(s=Df,lb,JL).call(s,e,r);if(i!=null){const o=new Df(e,i,n);return r!==n&&!await o.supportsWildcard()?null:o}r=r.split(".").slice(1).join(".")}}};Aa=new WeakMap,iu=new WeakMap,va=new WeakSet,Jf=async function(e,n){n=(n||[]).slice();const r=T(this,iu).interface;n.unshift(n2(this.name));let s=null;await this.supportsWildcard()&&(s=r.getFunction(e),ee(s,"missing fragment","UNKNOWN_ERROR",{info:{funcName:e}}),n=[Fse(this.name,255),r.encodeFunctionData(s,n)],e="resolve(bytes,bytes)"),n.push({enableCcipRead:!0});try{const i=await T(this,iu)[e](...n);return s?r.decodeFunctionResult(s,i)[0]:i}catch(i){if(!gn(i,"CALL_EXCEPTION"))throw i}return null},lb=new WeakSet,JL=async function(e,n){const r=await Df.getEnsAddress(e);try{const i=await new Vc(r,["function resolver(bytes32) view returns (address)"],e).resolver(n2(n),{enableCcipRead:!0});return i===Ph?null:i}catch(s){throw s}return null},J(Df,lb);let Ay=Df;const GP=BigInt(0);function lt(t,e){return function(n){return n==null?e:t(n)}}function vy(t,e){return n=>{if(e&&n==null)return null;if(!Array.isArray(n))throw new Error("not an array");return n.map(r=>t(r))}}function qh(t,e){return n=>{const r={};for(const s in t){let i=s;if(e&&s in e&&!(i in n)){for(const o of e[s])if(o in n){i=o;break}}try{const o=t[s](n[i]);o!==void 0&&(r[s]=o)}catch(o){const a=o instanceof Error?o.message:"not-an-error";ee(!1,`invalid value for value.${s} (${a})`,"BAD_DATA",{value:n})}}return r}}function Fie(t){switch(t){case!0:case"true":return!0;case!1:case"false":return!1}$(!1,`invalid boolean; ${JSON.stringify(t)}`,"value",t)}function Hc(t){return $(St(t,!0),"invalid data","value",t),t}function Cn(t){return $(St(t,32),"invalid hash","value",t),t}const jie=qh({address:gt,blockHash:Cn,blockNumber:Qe,data:Hc,index:Qe,removed:lt(Fie,!1),topics:vy(Cn),transactionHash:Cn,transactionIndex:Qe},{index:["logIndex"]});function Uie(t){return jie(t)}const Vie=qh({hash:lt(Cn),parentHash:Cn,parentBeaconBlockRoot:lt(Cn,null),number:Qe,timestamp:Qe,nonce:lt(Hc),difficulty:xe,gasLimit:xe,gasUsed:xe,stateRoot:lt(Cn,null),receiptsRoot:lt(Cn,null),blobGasUsed:lt(xe,null),excessBlobGas:lt(xe,null),miner:lt(gt),prevRandao:lt(Cn,null),extraData:Hc,baseFeePerGas:lt(xe)},{prevRandao:["mixHash"]});function Hie(t){const e=Vie(t);return e.transactions=t.transactions.map(n=>typeof n=="string"?n:WP(n)),e}const zie=qh({transactionIndex:Qe,blockNumber:Qe,transactionHash:Cn,address:gt,topics:vy(Cn),data:Hc,index:Qe,blockHash:Cn},{index:["logIndex"]});function $ie(t){return zie(t)}const Gie=qh({to:lt(gt,null),from:lt(gt,null),contractAddress:lt(gt,null),index:Qe,root:lt(we),gasUsed:xe,blobGasUsed:lt(xe,null),logsBloom:lt(Hc),blockHash:Cn,hash:Cn,logs:vy($ie),blockNumber:Qe,cumulativeGasUsed:xe,effectiveGasPrice:lt(xe),blobGasPrice:lt(xe,null),status:lt(Qe),type:lt(Qe,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function Wie(t){return Gie(t)}function WP(t){t.to&&xe(t.to)===GP&&(t.to="0x0000000000000000000000000000000000000000");const e=qh({hash:Cn,index:lt(Qe,void 0),type:n=>n==="0x"||n==null?0:Qe(n),accessList:lt(ia,null),blobVersionedHashes:lt(vy(Cn,!0),null),blockHash:lt(Cn,null),blockNumber:lt(Qe,null),transactionIndex:lt(Qe,null),from:gt,gasPrice:lt(xe),maxPriorityFeePerGas:lt(xe),maxFeePerGas:lt(xe),maxFeePerBlobGas:lt(xe,null),gasLimit:xe,to:lt(gt,null),value:xe,nonce:Qe,data:Hc,creates:lt(gt,null),chainId:lt(xe,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(t);if(e.to==null&&e.creates==null&&(e.creates=Ure(e)),(t.type===1||t.type===2)&&t.accessList==null&&(e.accessList=[]),t.signature?e.signature=Ss.from(t.signature):e.signature=Ss.from(t),e.chainId==null){const n=e.signature.legacyChainId;n!=null&&(e.chainId=n)}return e.blockHash&&xe(e.blockHash)===GP&&(e.blockHash=null),e}const Kie="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class Qh{constructor(e){W(this,"name");Oe(this,{name:e})}clone(){return new Qh(this.name)}}class xy extends Qh{constructor(n,r){n==null&&(n=0);super(`org.ethers.network.plugins.GasCost#${n||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:n};function i(o,a){let l=(r||{})[o];l==null&&(l=a),$(typeof l=="number",`invalud value for ${o}`,"costs",r),s[o]=l}i("txBase",21e3),i("txCreate",32e3),i("txDataZero",4),i("txDataNonzero",16),i("txAccessListStorageKey",1900),i("txAccessListAddress",2400),Oe(this,s)}clone(){return new xy(this.effectiveBlock,this)}}class ky extends Qh{constructor(n,r){super("org.ethers.plugins.network.Ens");W(this,"address");W(this,"targetNetwork");Oe(this,{address:n||Kie,targetNetwork:r??1})}clone(){return new ky(this.address,this.targetNetwork)}}class qie extends Qh{constructor(n,r){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin");J(this,xp);J(this,kp);I(this,xp,n),I(this,kp,r)}get url(){return T(this,xp)}get processFunc(){return T(this,kp)}clone(){return this}}xp=new WeakMap,kp=new WeakMap;const w2=new Map,Mf=class Mf{constructor(e,n){J(this,Of);J(this,_f);J(this,xa);I(this,Of,e),I(this,_f,xe(n)),I(this,xa,new Map)}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return T(this,Of)}set name(e){I(this,Of,e)}get chainId(){return T(this,_f)}set chainId(e){I(this,_f,xe(e,"chainId"))}matches(e){if(e==null)return!1;if(typeof e=="string"){try{return this.chainId===xe(e)}catch{}return this.name===e}if(typeof e=="number"||typeof e=="bigint"){try{return this.chainId===xe(e)}catch{}return!1}if(typeof e=="object"){if(e.chainId!=null){try{return this.chainId===xe(e.chainId)}catch{}return!1}return e.name!=null?this.name===e.name:!1}return!1}get plugins(){return Array.from(T(this,xa).values())}attachPlugin(e){if(T(this,xa).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return T(this,xa).set(e.name,e.clone()),this}getPlugin(e){return T(this,xa).get(e)||null}getPlugins(e){return this.plugins.filter(n=>n.name.split("#")[0]===e)}clone(){const e=new Mf(this.name,this.chainId);return this.plugins.forEach(n=>{e.attachPlugin(n.clone())}),e}computeIntrinsicGas(e){const n=this.getPlugin("org.ethers.plugins.network.GasCost")||new xy;let r=n.txBase;if(e.to==null&&(r+=n.txCreate),e.data)for(let s=2;s<e.data.length;s+=2)e.data.substring(s,s+2)==="00"?r+=n.txDataZero:r+=n.txDataNonzero;if(e.accessList){const s=ia(e.accessList);for(const i in s)r+=n.txAccessListAddress+n.txAccessListStorageKey*s[i].storageKeys.length}return r}static from(e){if(Qie(),e==null)return Mf.from("mainnet");if(typeof e=="number"&&(e=BigInt(e)),typeof e=="string"||typeof e=="bigint"){const n=w2.get(e);if(n)return n();if(typeof e=="bigint")return new Mf("unknown",e);$(!1,"unknown network","network",e)}if(typeof e.clone=="function")return e.clone();if(typeof e=="object"){$(typeof e.name=="string"&&typeof e.chainId=="number","invalid network object name or chainId","network",e);const n=new Mf(e.name,e.chainId);return(e.ensAddress||e.ensNetwork!=null)&&n.attachPlugin(new ky(e.ensAddress,e.ensNetwork)),n}$(!1,"invalid network","network",e)}static register(e,n){typeof e=="number"&&(e=BigInt(e));const r=w2.get(e);r&&$(!1,`conflicting network for ${JSON.stringify(r.name)}`,"nameOrChainId",e),w2.set(e,n)}};Of=new WeakMap,_f=new WeakMap,xa=new WeakMap;let rn=Mf;function KP(t,e){const n=String(t);if(!n.match(/^[0-9.]+$/))throw new Error(`invalid gwei value: ${t}`);const r=n.split(".");if(r.length===1&&r.push(""),r.length!==2)throw new Error(`invalid gwei value: ${t}`);for(;r[1].length<e;)r[1]+="0";if(r[1].length>9){let s=BigInt(r[1].substring(0,9));r[1].substring(9).match(/^0+$/)||s++,r[1]=s.toString()}return BigInt(r[0]+r[1])}function qP(t){return new qie(t,async(e,n,r)=>{r.setHeader("User-Agent","ethers");let s;try{const[i,o]=await Promise.all([r.send(),e()]);s=i;const a=s.bodyJson.standard;return{gasPrice:o.gasPrice,maxFeePerGas:KP(a.maxFee,9),maxPriorityFeePerGas:KP(a.maxPriorityFee,9)}}catch(i){ee(!1,`error encountered with polygon gas station (${JSON.stringify(r.url)})`,"SERVER_ERROR",{request:r,response:s,error:i})}})}let QP=!1;function Qie(){if(QP)return;QP=!0;function t(e,n,r){const s=function(){const i=new rn(e,n);return r.ensNetwork!=null&&i.attachPlugin(new ky(null,r.ensNetwork)),i.attachPlugin(new xy),(r.plugins||[]).forEach(o=>{i.attachPlugin(o)}),i};rn.register(e,s),rn.register(n,s),r.altNames&&r.altNames.forEach(i=>{rn.register(i,s)})}t("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),t("ropsten",3,{ensNetwork:3}),t("rinkeby",4,{ensNetwork:4}),t("goerli",5,{ensNetwork:5}),t("kovan",42,{ensNetwork:42}),t("sepolia",11155111,{ensNetwork:11155111}),t("holesky",17e3,{ensNetwork:17e3}),t("classic",61,{}),t("classicKotti",6,{}),t("arbitrum",42161,{ensNetwork:1}),t("arbitrum-goerli",421613,{}),t("arbitrum-sepolia",421614,{}),t("base",8453,{ensNetwork:1}),t("base-goerli",84531,{}),t("base-sepolia",84532,{}),t("bnb",56,{ensNetwork:1}),t("bnbt",97,{}),t("linea",59144,{ensNetwork:1}),t("linea-goerli",59140,{}),t("linea-sepolia",59141,{}),t("matic",137,{ensNetwork:1,plugins:[qP("https://gasstation.polygon.technology/v2")]}),t("matic-amoy",80002,{}),t("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[qP("https://gasstation-testnet.polygon.technology/v2")]}),t("optimism",10,{ensNetwork:1,plugins:[]}),t("optimism-goerli",420,{}),t("optimism-sepolia",11155420,{}),t("xdai",100,{ensNetwork:1})}function A2(t){return JSON.parse(JSON.stringify(t))}class Jie{constructor(e){J(this,Nf);J(this,ho);J(this,ss);J(this,ka);J(this,wi);I(this,ho,e),I(this,ss,null),I(this,ka,4e3),I(this,wi,-2)}get pollingInterval(){return T(this,ka)}set pollingInterval(e){I(this,ka,e)}start(){T(this,ss)||(I(this,ss,T(this,ho)._setTimeout(fe(this,Nf,gb).bind(this),T(this,ka))),fe(this,Nf,gb).call(this))}stop(){T(this,ss)&&(T(this,ho)._clearTimeout(T(this,ss)),I(this,ss,null))}pause(e){this.stop(),e&&I(this,wi,-2)}resume(){this.start()}}ho=new WeakMap,ss=new WeakMap,ka=new WeakMap,wi=new WeakMap,Nf=new WeakSet,gb=async function(){try{const e=await T(this,ho).getBlockNumber();if(T(this,wi)===-2){I(this,wi,e);return}if(e!==T(this,wi)){for(let n=T(this,wi)+1;n<=e;n++){if(T(this,ss)==null)return;await T(this,ho).emit("block",n)}I(this,wi,e)}}catch{}T(this,ss)!=null&&I(this,ss,T(this,ho)._setTimeout(fe(this,Nf,gb).bind(this),T(this,ka)))};class v2{constructor(e){J(this,ou);J(this,au);J(this,Ea);I(this,ou,e),I(this,Ea,!1),I(this,au,n=>{this._poll(n,T(this,ou))})}async _poll(e,n){throw new Error("sub-classes must override this")}start(){T(this,Ea)||(I(this,Ea,!0),T(this,au).call(this,-2),T(this,ou).on("block",T(this,au)))}stop(){T(this,Ea)&&(I(this,Ea,!1),T(this,ou).off("block",T(this,au)))}pause(e){this.stop()}resume(){this.start()}}ou=new WeakMap,au=new WeakMap,Ea=new WeakMap;class Yie extends v2{constructor(n,r){super(n);J(this,Rf);J(this,po);I(this,Rf,r),I(this,po,-2)}pause(n){n&&I(this,po,-2),super.pause(n)}async _poll(n,r){const s=await r.getBlock(T(this,Rf));s!=null&&(T(this,po)===-2?I(this,po,s.number):s.number>T(this,po)&&(r.emit(T(this,Rf),s.number),I(this,po,s.number)))}}Rf=new WeakMap,po=new WeakMap;class Xie extends v2{constructor(n,r){super(n);J(this,ub);I(this,ub,A2(r))}async _poll(n,r){throw new Error("@TODO")}}ub=new WeakMap;class Zie extends v2{constructor(n,r){super(n);J(this,Pf);I(this,Pf,r)}async _poll(n,r){const s=await r.getTransactionReceipt(T(this,Pf));s&&r.emit(T(this,Pf),s)}}Pf=new WeakMap;class x2{constructor(e,n){J(this,cb);J(this,mo);J(this,If);J(this,Lf);J(this,Ca);J(this,is);I(this,mo,e),I(this,If,A2(n)),I(this,Lf,fe(this,cb,YL).bind(this)),I(this,Ca,!1),I(this,is,-2)}start(){T(this,Ca)||(I(this,Ca,!0),T(this,is)===-2&&T(this,mo).getBlockNumber().then(e=>{I(this,is,e)}),T(this,mo).on("block",T(this,Lf)))}stop(){T(this,Ca)&&(I(this,Ca,!1),T(this,mo).off("block",T(this,Lf)))}pause(e){this.stop(),e&&I(this,is,-2)}resume(){this.start()}}mo=new WeakMap,If=new WeakMap,Lf=new WeakMap,Ca=new WeakMap,is=new WeakMap,cb=new WeakSet,YL=async function(e){if(T(this,is)===-2)return;const n=A2(T(this,If));n.fromBlock=T(this,is)+1,n.toBlock=e;const r=await T(this,mo).getLogs(n);if(r.length===0){T(this,is)<e-60&&I(this,is,e-60);return}for(const s of r)T(this,mo).emit(T(this,If),s),I(this,is,s.blockNumber)};const eoe=BigInt(2),toe=10;function Ey(t){return t&&typeof t.then=="function"}function Cy(t,e){return t+":"+JSON.stringify(e,(n,r)=>{if(r==null)return"null";if(typeof r=="bigint")return`bigint:${r.toString()}`;if(typeof r=="string")return r.toLowerCase();if(typeof r=="object"&&!Array.isArray(r)){const s=Object.keys(r);return s.sort(),s.reduce((i,o)=>(i[o]=r[o],i),{})}return r})}class Sy{constructor(e){W(this,"name");Oe(this,{name:e})}start(){}stop(){}pause(e){}resume(){}}function noe(t){return JSON.parse(JSON.stringify(t))}function k2(t){return t=Array.from(new Set(t).values()),t.sort(),t}async function E2(t,e){if(t==null)throw new Error("invalid event");if(Array.isArray(t)&&(t={topics:t}),typeof t=="string")switch(t){case"block":case"debug":case"error":case"finalized":case"network":case"pending":case"safe":return{type:t,tag:t}}if(St(t,32)){const n=t.toLowerCase();return{type:"transaction",tag:Cy("tx",{hash:n}),hash:n}}if(t.orphan){const n=t;return{type:"orphan",tag:Cy("orphan",n),filter:noe(n)}}if(t.address||t.topics){const n=t,r={topics:(n.topics||[]).map(s=>s==null?null:Array.isArray(s)?k2(s.map(i=>i.toLowerCase())):s.toLowerCase())};if(n.address){const s=[],i=[],o=a=>{St(a)?s.push(a):i.push((async()=>{s.push(await Qn(a,e))})())};Array.isArray(n.address)?n.address.forEach(o):o(n.address),i.length&&await Promise.all(i),r.address=k2(s.map(a=>a.toLowerCase()))}return{filter:r,tag:Cy("event",r),type:"event"}}$(!1,"unknown ProviderEvent","event",t)}function C2(){return new Date().getTime()}const roe={cacheTimeout:250,pollingInterval:4e3};class Ty{constructor(e,n){J(this,st);J(this,Bn);J(this,Sa);J(this,Fn);J(this,Bf);J(this,Fr);J(this,lu);J(this,Ta);J(this,go);J(this,Ep);J(this,as);J(this,Ff);J(this,jf);if(I(this,jf,Object.assign({},roe,n||{})),e==="any")I(this,lu,!0),I(this,Fr,null);else if(e){const r=rn.from(e);I(this,lu,!1),I(this,Fr,Promise.resolve(r)),setTimeout(()=>{this.emit("network",r,null)},0)}else I(this,lu,!1),I(this,Fr,null);I(this,go,-1),I(this,Ta,new Map),I(this,Bn,new Map),I(this,Sa,new Map),I(this,Fn,null),I(this,Bf,!1),I(this,Ep,1),I(this,as,new Map),I(this,Ff,!1)}get pollingInterval(){return T(this,jf).pollingInterval}get provider(){return this}get plugins(){return Array.from(T(this,Sa).values())}attachPlugin(e){if(T(this,Sa).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return T(this,Sa).set(e.name,e.connect(this)),this}getPlugin(e){return T(this,Sa).get(e)||null}get disableCcipRead(){return T(this,Ff)}set disableCcipRead(e){I(this,Ff,!!e)}async ccipReadFetch(e,n,r){if(this.disableCcipRead||r.length===0||e.to==null)return null;const s=e.to.toLowerCase(),i=n.toLowerCase(),o=[];for(let a=0;a<r.length;a++){const l=r[a],u=l.replace("{sender}",s).replace("{data}",i),c=new Kn(u);l.indexOf("{data}")===-1&&(c.body={data:i,sender:s}),this.emit("debug",{action:"sendCcipReadFetchRequest",request:c,index:a,urls:r});let f="unknown error";const d=await c.send();try{const h=d.bodyJson;if(h.data)return this.emit("debug",{action:"receiveCcipReadFetchResult",request:c,result:h}),h.data;h.message&&(f=h.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:c,result:h})}catch{}ee(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)}ee(!1,`error encountered during CCIP fetch: ${o.map(a=>JSON.stringify(a)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:e,info:{urls:r,errorMessages:o}})}_wrapBlock(e,n){return new kie(Hie(e),this)}_wrapLog(e,n){return new Gh(Uie(e),this)}_wrapTransactionReceipt(e,n){return new _P(Wie(e),this)}_wrapTransactionResponse(e,n){return new Wh(WP(e),this)}_detectNetwork(){ee(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(e){ee(!1,`unsupported method: ${e.method}`,"UNSUPPORTED_OPERATION",{operation:e.method,info:e})}async getBlockNumber(){const e=Qe(await fe(this,st,jr).call(this,{method:"getBlockNumber"}),"%response");return T(this,go)>=0&&I(this,go,e),e}_getAddress(e){return Qn(e,this)}_getBlockTag(e){if(e==null)return"latest";switch(e){case"earliest":return"0x0";case"finalized":case"latest":case"pending":case"safe":return e}if(St(e))return St(e,32)?e:kl(e);if(typeof e=="bigint"&&(e=Qe(e,"blockTag")),typeof e=="number")return e>=0?kl(e):T(this,go)>=0?kl(T(this,go)+e):this.getBlockNumber().then(n=>kl(n+e));$(!1,"invalid blockTag","blockTag",e)}_getFilter(e){const n=(e.topics||[]).map(l=>l==null?null:Array.isArray(l)?k2(l.map(u=>u.toLowerCase())):l.toLowerCase()),r="blockHash"in e?e.blockHash:void 0,s=(l,u,c)=>{let f;switch(l.length){case 0:break;case 1:f=l[0];break;default:l.sort(),f=l}if(r&&(u!=null||c!=null))throw new Error("invalid filter");const d={};return f&&(d.address=f),n.length&&(d.topics=n),u&&(d.fromBlock=u),c&&(d.toBlock=c),r&&(d.blockHash=r),d};let i=[];if(e.address)if(Array.isArray(e.address))for(const l of e.address)i.push(this._getAddress(l));else i.push(this._getAddress(e.address));let o;"fromBlock"in e&&(o=this._getBlockTag(e.fromBlock));let a;return"toBlock"in e&&(a=this._getBlockTag(e.toBlock)),i.filter(l=>typeof l!="string").length||o!=null&&typeof o!="string"||a!=null&&typeof a!="string"?Promise.all([Promise.all(i),o,a]).then(l=>s(l[0],l[1],l[2])):s(i,o,a)}_getTransactionRequest(e){const n=gy(e),r=[];if(["to","from"].forEach(s=>{if(n[s]==null)return;const i=Qn(n[s],this);Ey(i)?r.push(async function(){n[s]=await i}()):n[s]=i}),n.blockTag!=null){const s=this._getBlockTag(n.blockTag);Ey(s)?r.push(async function(){n.blockTag=await s}()):n.blockTag=s}return r.length?async function(){return await Promise.all(r),n}():n}async getNetwork(){if(T(this,Fr)==null){const s=(async()=>{try{const i=await this._detectNetwork();return this.emit("network",i,null),i}catch(i){throw T(this,Fr)===s&&I(this,Fr,null),i}})();return I(this,Fr,s),(await s).clone()}const e=T(this,Fr),[n,r]=await Promise.all([e,this._detectNetwork()]);return n.chainId!==r.chainId&&(T(this,lu)?(this.emit("network",r,n),T(this,Fr)===e&&I(this,Fr,Promise.resolve(r))):ee(!1,`network changed: ${n.chainId} => ${r.chainId} `,"NETWORK_ERROR",{event:"changed"})),n.clone()}async getFeeData(){const e=await this.getNetwork(),n=async()=>{const{_block:s,gasPrice:i,priorityFee:o}=await Nn({_block:fe(this,st,nE).call(this,"latest",!1),gasPrice:(async()=>{try{const c=await fe(this,st,jr).call(this,{method:"getGasPrice"});return xe(c,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const c=await fe(this,st,jr).call(this,{method:"getPriorityFee"});return xe(c,"%response")}catch{}return null})()});let a=null,l=null;const u=this._wrapBlock(s,e);return u&&u.baseFeePerGas&&(l=o??BigInt("1000000000"),a=u.baseFeePerGas*eoe+l),new OP(i,a,l)},r=e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(r){const s=new Kn(r.url),i=await r.processFunc(n,this,s);return new OP(i.gasPrice,i.maxFeePerGas,i.maxPriorityFeePerGas)}return await n()}async estimateGas(e){let n=this._getTransactionRequest(e);return Ey(n)&&(n=await n),xe(await fe(this,st,jr).call(this,{method:"estimateGas",transaction:n}),"%response")}async call(e){const{tx:n,blockTag:r}=await Nn({tx:this._getTransactionRequest(e),blockTag:this._getBlockTag(e.blockTag)});return await fe(this,st,tE).call(this,fe(this,st,eE).call(this,n,r,e.enableCcipRead?0:-1))}async getBalance(e,n){return xe(await fe(this,st,_p).call(this,{method:"getBalance"},e,n),"%response")}async getTransactionCount(e,n){return Qe(await fe(this,st,_p).call(this,{method:"getTransactionCount"},e,n),"%response")}async getCode(e,n){return we(await fe(this,st,_p).call(this,{method:"getCode"},e,n))}async getStorage(e,n,r){const s=xe(n,"position");return we(await fe(this,st,_p).call(this,{method:"getStorage",position:s},e,r))}async broadcastTransaction(e){const{blockNumber:n,hash:r,network:s}=await Nn({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:e}),network:this.getNetwork()}),i=zh.from(e);if(i.hash!==r)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(i,s).replaceableTransaction(n)}async getBlock(e,n){const{network:r,params:s}=await Nn({network:this.getNetwork(),params:fe(this,st,nE).call(this,e,!!n)});return s==null?null:this._wrapBlock(s,r)}async getTransaction(e){const{network:n,params:r}=await Nn({network:this.getNetwork(),params:fe(this,st,jr).call(this,{method:"getTransaction",hash:e})});return r==null?null:this._wrapTransactionResponse(r,n)}async getTransactionReceipt(e){const{network:n,params:r}=await Nn({network:this.getNetwork(),params:fe(this,st,jr).call(this,{method:"getTransactionReceipt",hash:e})});if(r==null)return null;if(r.gasPrice==null&&r.effectiveGasPrice==null){const s=await fe(this,st,jr).call(this,{method:"getTransaction",hash:e});if(s==null)throw new Error("report this; could not find tx or effectiveGasPrice");r.effectiveGasPrice=s.gasPrice}return this._wrapTransactionReceipt(r,n)}async getTransactionResult(e){const{result:n}=await Nn({network:this.getNetwork(),result:fe(this,st,jr).call(this,{method:"getTransactionResult",hash:e})});return n==null?null:we(n)}async getLogs(e){let n=this._getFilter(e);Ey(n)&&(n=await n);const{network:r,params:s}=await Nn({network:this.getNetwork(),params:fe(this,st,jr).call(this,{method:"getLogs",filter:n})});return s.map(i=>this._wrapLog(i,r))}_getProvider(e){ee(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(e){return await Ay.fromName(this,e)}async getAvatar(e){const n=await this.getResolver(e);return n?await n.getAvatar():null}async resolveName(e){const n=await this.getResolver(e);return n?await n.getAddress():null}async lookupAddress(e){e=gt(e);const n=n2(e.substring(2).toLowerCase()+".addr.reverse");try{const r=await Ay.getEnsAddress(this),i=await new Vc(r,["function resolver(bytes32) view returns (address)"],this).resolver(n);if(i==null||i===Ph)return null;const a=await new Vc(i,["function name(bytes32) view returns (string)"],this).name(n);return await this.resolveName(a)!==e?null:a}catch(r){if(gn(r,"BAD_DATA")&&r.value==="0x"||gn(r,"CALL_EXCEPTION"))return null;throw r}return null}async waitForTransaction(e,n,r){const s=n??1;return s===0?this.getTransactionReceipt(e):new Promise(async(i,o)=>{let a=null;const l=async u=>{try{const c=await this.getTransactionReceipt(e);if(c!=null&&u-c.blockNumber+1>=s){i(c),a&&(clearTimeout(a),a=null);return}}catch(c){console.log("EEE",c)}this.once("block",l)};r!=null&&(a=setTimeout(()=>{a!=null&&(a=null,this.off("block",l),o(Nt("timeout","TIMEOUT",{reason:"timeout"})))},r)),l(await this.getBlockNumber())})}async waitForBlock(e){ee(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(e){const n=T(this,as).get(e);n&&(n.timer&&clearTimeout(n.timer),T(this,as).delete(e))}_setTimeout(e,n){n==null&&(n=0);const r=Dp(this,Ep)._++,s=()=>{T(this,as).delete(r),e()};if(this.paused)T(this,as).set(r,{timer:null,func:s,time:n});else{const i=setTimeout(s,n);T(this,as).set(r,{timer:i,func:s,time:C2()})}return r}_forEachSubscriber(e){for(const n of T(this,Bn).values())e(n.subscriber)}_getSubscriber(e){switch(e.type){case"debug":case"error":case"network":return new Sy(e.type);case"block":{const n=new Jie(this);return n.pollingInterval=this.pollingInterval,n}case"safe":case"finalized":return new Yie(this,e.type);case"event":return new x2(this,e.filter);case"transaction":return new Zie(this,e.hash);case"orphan":return new Xie(this,e.filter)}throw new Error(`unsupported event: ${e.type}`)}_recoverSubscriber(e,n){for(const r of T(this,Bn).values())if(r.subscriber===e){r.started&&r.subscriber.stop(),r.subscriber=n,r.started&&n.start(),T(this,Fn)!=null&&n.pause(T(this,Fn));break}}async on(e,n){const r=await fe(this,st,yb).call(this,e);return r.listeners.push({listener:n,once:!1}),r.started||(r.subscriber.start(),r.started=!0,T(this,Fn)!=null&&r.subscriber.pause(T(this,Fn))),this}async once(e,n){const r=await fe(this,st,yb).call(this,e);return r.listeners.push({listener:n,once:!0}),r.started||(r.subscriber.start(),r.started=!0,T(this,Fn)!=null&&r.subscriber.pause(T(this,Fn))),this}async emit(e,...n){const r=await fe(this,st,Mp).call(this,e,n);if(!r||r.listeners.length===0)return!1;const s=r.listeners.length;return r.listeners=r.listeners.filter(({listener:i,once:o})=>{const a=new d4(this,o?null:i,e);try{i.call(this,...n,a)}catch{}return!o}),r.listeners.length===0&&(r.started&&r.subscriber.stop(),T(this,Bn).delete(r.tag)),s>0}async listenerCount(e){if(e){const r=await fe(this,st,Mp).call(this,e);return r?r.listeners.length:0}let n=0;for(const{listeners:r}of T(this,Bn).values())n+=r.length;return n}async listeners(e){if(e){const r=await fe(this,st,Mp).call(this,e);return r?r.listeners.map(({listener:s})=>s):[]}let n=[];for(const{listeners:r}of T(this,Bn).values())n=n.concat(r.map(({listener:s})=>s));return n}async off(e,n){const r=await fe(this,st,Mp).call(this,e);if(!r)return this;if(n){const s=r.listeners.map(({listener:i})=>i).indexOf(n);s>=0&&r.listeners.splice(s,1)}return(!n||r.listeners.length===0)&&(r.started&&r.subscriber.stop(),T(this,Bn).delete(r.tag)),this}async removeAllListeners(e){if(e){const{tag:n,started:r,subscriber:s}=await fe(this,st,yb).call(this,e);r&&s.stop(),T(this,Bn).delete(n)}else for(const[n,{started:r,subscriber:s}]of T(this,Bn))r&&s.stop(),T(this,Bn).delete(n);return this}async addListener(e,n){return await this.on(e,n)}async removeListener(e,n){return this.off(e,n)}get destroyed(){return T(this,Bf)}destroy(){this.removeAllListeners();for(const e of T(this,as).keys())this._clearTimeout(e);I(this,Bf,!0)}get paused(){return T(this,Fn)!=null}set paused(e){!!e!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(e){if(I(this,go,-1),T(this,Fn)!=null){if(T(this,Fn)==!!e)return;ee(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(n=>n.pause(e)),I(this,Fn,!!e);for(const n of T(this,as).values())n.timer&&clearTimeout(n.timer),n.time=C2()-n.time}resume(){if(T(this,Fn)!=null){this._forEachSubscriber(e=>e.resume()),I(this,Fn,null);for(const e of T(this,as).values()){let n=e.time;n<0&&(n=0),e.time=C2(),setTimeout(e.func,n)}}}}Bn=new WeakMap,Sa=new WeakMap,Fn=new WeakMap,Bf=new WeakMap,Fr=new WeakMap,lu=new WeakMap,Ta=new WeakMap,go=new WeakMap,Ep=new WeakMap,as=new WeakMap,Ff=new WeakMap,jf=new WeakMap,st=new WeakSet,jr=async function(e){const n=T(this,jf).cacheTimeout;if(n<0)return await this._perform(e);const r=Cy(e.method,e);let s=T(this,Ta).get(r);return s||(s=this._perform(e),T(this,Ta).set(r,s),setTimeout(()=>{T(this,Ta).get(r)===s&&T(this,Ta).delete(r)},n)),await s},eE=async function(e,n,r){ee(r<toe,"CCIP read exceeded maximum redirections","OFFCHAIN_FAULT",{reason:"TOO_MANY_REDIRECTS",transaction:Object.assign({},e,{blockTag:n,enableCcipRead:!0})});const s=gy(e);try{return we(await this._perform({method:"call",transaction:s,blockTag:n}))}catch(i){if(!this.disableCcipRead&&Ax(i)&&i.data&&r>=0&&n==="latest"&&s.to!=null&&Ht(i.data,0,4)==="0x556f1830"){const o=i.data,a=await Qn(s.to,this);let l;try{l=loe(Ht(i.data,4))}catch(f){ee(!1,f.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:s,info:{data:o}})}ee(l.sender.toLowerCase()===a.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:o,reason:"OffchainLookup",transaction:s,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:l.errorArgs}});const u=await this.ccipReadFetch(s,l.calldata,l.urls);ee(u!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:s,info:{data:i.data,errorArgs:l.errorArgs}});const c={to:a,data:$t([l.selector,aoe([u,l.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:c});try{const f=await fe(this,st,eE).call(this,c,n,r+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},c),result:f}),f}catch(f){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},c),error:f}),f}}throw i}},tE=async function(e){const{value:n}=await Nn({network:this.getNetwork(),value:e});return n},_p=async function(e,n,r){let s=this._getAddress(n),i=this._getBlockTag(r);return(typeof s!="string"||typeof i!="string")&&([s,i]=await Promise.all([s,i])),await fe(this,st,tE).call(this,fe(this,st,jr).call(this,Object.assign(e,{address:s,blockTag:i})))},nE=async function(e,n){if(St(e,32))return await fe(this,st,jr).call(this,{method:"getBlock",blockHash:e,includeTransactions:n});let r=this._getBlockTag(e);return typeof r!="string"&&(r=await r),await fe(this,st,jr).call(this,{method:"getBlock",blockTag:r,includeTransactions:n})},Mp=async function(e,n){let r=await E2(e,this);return r.type==="event"&&n&&n.length>0&&n[0].removed===!0&&(r=await E2({orphan:"drop-log",log:n[0]},this)),T(this,Bn).get(r.tag)||null},yb=async function(e){const n=await E2(e,this),r=n.tag;let s=T(this,Bn).get(r);return s||(s={subscriber:this._getSubscriber(n),tag:r,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},T(this,Bn).set(r,s)),s};function soe(t,e){try{const n=S2(t,e);if(n)return Tc(n)}catch{}return null}function S2(t,e){if(t==="0x")return null;try{const n=Qe(Ht(t,e,e+32)),r=Qe(Ht(t,n,n+32));return Ht(t,n+32,n+32+r)}catch{}return null}function JP(t){const e=Wn(t);if(e.length>32)throw new Error("internal; should not happen");const n=new Uint8Array(32);return n.set(e,32-e.length),n}function ioe(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}const ooe=new Uint8Array([]);function aoe(t){const e=[];let n=0;for(let r=0;r<t.length;r++)e.push(ooe),n+=32;for(let r=0;r<t.length;r++){const s=ct(t[r]);e[r]=JP(n),e.push(JP(s.length)),e.push(ioe(s)),n+=32+Math.ceil(s.length/32)*32}return $t(e)}const YP="0x0000000000000000000000000000000000000000000000000000000000000000";function loe(t){const e={sender:"",urls:[],calldata:"",selector:"",extraData:"",errorArgs:[]};ee(Cc(t)>=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const n=Ht(t,0,32);ee(Ht(n,0,12)===Ht(YP,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),e.sender=Ht(n,12);try{const r=[],s=Qe(Ht(t,32,64)),i=Qe(Ht(t,s,s+32)),o=Ht(t,s+32);for(let a=0;a<i;a++){const l=soe(o,a*32);if(l==null)throw new Error("abort");r.push(l)}e.urls=r}catch{ee(!1,"corrupt OffchainLookup urls","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup urls"})}try{const r=S2(t,64);if(r==null)throw new Error("abort");e.calldata=r}catch{ee(!1,"corrupt OffchainLookup calldata","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup calldata"})}ee(Ht(t,100,128)===Ht(YP,0,28),"corrupt OffchainLookup callbaackSelector","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup callbaackSelector"}),e.selector=Ht(t,96,100);try{const r=S2(t,128);if(r==null)throw new Error("abort");e.extraData=r}catch{ee(!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 zc(t,e){if(t.provider)return t.provider;ee(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:e})}async function XP(t,e){let n=gy(e);if(n.to!=null&&(n.to=Qn(n.to,t)),n.from!=null){const r=n.from;n.from=Promise.all([t.getAddress(),Qn(r,t)]).then(([s,i])=>($(s.toLowerCase()===i.toLowerCase(),"transaction from mismatch","tx.from",i),s))}else n.from=t.getAddress();return await Nn(n)}class uoe{constructor(e){W(this,"provider");Oe(this,{provider:e||null})}async getNonce(e){return zc(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await XP(this,e)}async populateTransaction(e){const n=zc(this,"populateTransaction"),r=await XP(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=xe(r.chainId);$(o===s.chainId,"transaction chainId mismatch","tx.chainId",e.chainId)}else r.chainId=s.chainId;const i=r.maxFeePerGas!=null||r.maxPriorityFeePerGas!=null;if(r.gasPrice!=null&&(r.type===2||i)?$(!1,"eip-1559 transaction do not support gasPrice","tx",e):(r.type===0||r.type===1)&&i&&$(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",e),(r.type===2||r.type==null)&&r.maxFeePerGas!=null&&r.maxPriorityFeePerGas!=null)r.type=2;else if(r.type===0||r.type===1){const o=await n.getFeeData();ee(o.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),r.gasPrice==null&&(r.gasPrice=o.gasPrice)}else{const o=await n.getFeeData();if(r.type==null)if(o.maxFeePerGas!=null&&o.maxPriorityFeePerGas!=null)if(r.type=2,r.gasPrice!=null){const a=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=a,r.maxPriorityFeePerGas=a}else r.maxFeePerGas==null&&(r.maxFeePerGas=o.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=o.maxPriorityFeePerGas);else o.gasPrice!=null?(ee(!i,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=o.gasPrice),r.type=0):ee(!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 Nn(r)}async estimateGas(e){return zc(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return zc(this,"call").call(await this.populateCall(e))}async resolveName(e){return await zc(this,"resolveName").resolveName(e)}async sendTransaction(e){const n=zc(this,"sendTransaction"),r=await this.populateTransaction(e);delete r.from;const s=zh.from(r);return await n.broadcastTransaction(await this.signTransaction(s))}}const ZP=new Set;function $c(t){ZP.has(t)||(ZP.add(t),console.log("========= NOTICE ========="),console.log(`Request-Rate Exceeded for ${t} (this message will not be repeated)`),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.org/api-keys/"),console.log("=========================="))}function coe(t){return JSON.parse(JSON.stringify(t))}class eI{constructor(e){J(this,Oa);J(this,Yn);J(this,Ai);J(this,uu);J(this,Da);J(this,cu);J(this,Uf);I(this,Yn,e),I(this,Ai,null),I(this,uu,fe(this,Oa,rE).bind(this)),I(this,Da,!1),I(this,cu,null),I(this,Uf,!1)}_subscribe(e){throw new Error("subclasses must override this")}_emitResults(e,n){throw new Error("subclasses must override this")}_recover(e){throw new Error("subclasses must override this")}start(){T(this,Da)||(I(this,Da,!0),fe(this,Oa,rE).call(this,-2))}stop(){T(this,Da)&&(I(this,Da,!1),I(this,Uf,!0),fe(this,Oa,sE).call(this),T(this,Yn).off("block",T(this,uu)))}pause(e){e&&fe(this,Oa,sE).call(this),T(this,Yn).off("block",T(this,uu))}resume(){this.start()}}Yn=new WeakMap,Ai=new WeakMap,uu=new WeakMap,Da=new WeakMap,cu=new WeakMap,Uf=new WeakMap,Oa=new WeakSet,rE=async function(e){try{T(this,Ai)==null&&I(this,Ai,this._subscribe(T(this,Yn)));let n=null;try{n=await T(this,Ai)}catch(i){if(!gn(i,"UNSUPPORTED_OPERATION")||i.operation!=="eth_newFilter")throw i}if(n==null){I(this,Ai,null),T(this,Yn)._recoverSubscriber(this,this._recover(T(this,Yn)));return}const r=await T(this,Yn).getNetwork();if(T(this,cu)||I(this,cu,r),T(this,cu).chainId!==r.chainId)throw new Error("chaid changed");if(T(this,Uf))return;const s=await T(this,Yn).send("eth_getFilterChanges",[n]);await this._emitResults(T(this,Yn),s)}catch(n){console.log("@TODO",n)}T(this,Yn).once("block",T(this,uu))},sE=function(){const e=T(this,Ai);e&&(I(this,Ai,null),e.then(n=>{T(this,Yn).destroyed||T(this,Yn).send("eth_uninstallFilter",[n])}))};class foe extends eI{constructor(n,r){super(n);J(this,fu);I(this,fu,coe(r))}_recover(n){return new x2(n,T(this,fu))}async _subscribe(n){return await n.send("eth_newFilter",[T(this,fu)])}async _emitResults(n,r){for(const s of r)n.emit(T(this,fu),n._wrapLog(s,n._network))}}fu=new WeakMap;class doe extends eI{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,n){for(const r of n)e.emit("pending",r)}}const hoe="bigint,boolean,function,number,string,symbol".split(/,/g);function Dy(t){if(t==null||hoe.indexOf(typeof t)>=0||typeof t.getAddress=="function")return t;if(Array.isArray(t))return t.map(Dy);if(typeof t=="object")return Object.keys(t).reduce((e,n)=>(e[n]=t[n],e),{});throw new Error(`should not happen: ${t} (${typeof t})`)}function poe(t){return new Promise(e=>{setTimeout(e,t)})}function Gc(t){return t&&t.toLowerCase()}function tI(t){return t&&typeof t.pollingInterval=="number"}const nI={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class T2 extends uoe{constructor(n,r){super(n);W(this,"address");r=gt(r),Oe(this,{address:r})}connect(n){ee(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(n){return await this.populateCall(n)}async sendUncheckedTransaction(n){const r=Dy(n),s=[];if(r.from){const o=r.from;s.push((async()=>{const a=await Qn(o,this.provider);$(a!=null&&a.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",n),r.from=a})())}else r.from=this.address;if(r.gasLimit==null&&s.push((async()=>{r.gasLimit=await this.provider.estimateGas({...r,from:this.address})})()),r.to!=null){const o=r.to;s.push((async()=>{r.to=await Qn(o,this.provider)})())}s.length&&await Promise.all(s);const i=this.provider.getRpcTransaction(r);return this.provider.send("eth_sendTransaction",[i])}async sendTransaction(n){const r=await this.provider.getBlockNumber(),s=await this.sendUncheckedTransaction(n);return await new Promise((i,o)=>{const a=[1e3,100];let l=0;const u=async()=>{try{const c=await this.provider.getTransaction(s);if(c!=null){i(c.replaceableTransaction(r));return}}catch(c){if(gn(c,"CANCELLED")||gn(c,"BAD_DATA")||gn(c,"NETWORK_ERROR")){c.info==null&&(c.info={}),c.info.sendTransactionHash=s,o(c);return}if(gn(c,"INVALID_ARGUMENT")&&(l++,c.info==null&&(c.info={}),c.info.sendTransactionHash=s,l>10)){o(c);return}this.provider.emit("error",Nt("failed to fetch transation after sending (will try again)","UNKNOWN_ERROR",{error:c}))}this.provider._setTimeout(()=>{u()},a.pop()||4e3)};u()})}async signTransaction(n){const r=Dy(n);if(r.from){const i=await Qn(r.from,this.provider);$(i!=null&&i.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",n),r.from=i}else r.from=this.address;const s=this.provider.getRpcTransaction(r);return await this.provider.send("eth_signTransaction",[s])}async signMessage(n){const r=typeof n=="string"?Vi(n):n;return await this.provider.send("personal_sign",[we(r),this.address.toLowerCase()])}async signTypedData(n,r,s){const i=Dy(s),o=await hy.resolveNames(n,r,i,async a=>{const l=await Qn(a);return $(l!=null,"TypedData does not support null address","value",a),l});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(hy.getPayload(o.domain,r,o.value))])}async unlock(n){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),n,null])}async _legacySignMessage(n){const r=typeof n=="string"?Vi(n):n;return await this.provider.send("eth_sign",[this.address.toLowerCase(),we(r)])}}class rI extends Ty{constructor(n,r){super(n,r);J(this,Cp);J(this,du);J(this,Vf);J(this,yo);J(this,vi);J(this,Rs);J(this,ls);J(this,mr);I(this,Vf,1),I(this,du,Object.assign({},nI,r||{})),I(this,yo,[]),I(this,vi,null),I(this,ls,null),I(this,mr,null);{let i=null;const o=new Promise(a=>{i=a});I(this,Rs,{promise:o,resolve:i})}const s=this._getOption("staticNetwork");typeof s=="boolean"?($(!s||n!=="any","staticNetwork cannot be used on special network 'any'","options",r),s&&n!=null&&I(this,ls,rn.from(n))):s&&($(n==null||s.matches(n),"staticNetwork MUST match network object","options",r),I(this,ls,s))}_getOption(n){return T(this,du)[n]}get _network(){return ee(T(this,ls),"network is not available yet","NETWORK_ERROR"),T(this,ls)}async _perform(n){if(n.method==="call"||n.method==="estimateGas"){let s=n.transaction;if(s&&s.type!=null&&xe(s.type)&&s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null){const i=await this.getFeeData();i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null&&(n=Object.assign({},n,{transaction:Object.assign({},s,{type:void 0})}))}}const r=this.getRpcRequest(n);return r!=null?await this.send(r.method,r.args):super._perform(n)}async _detectNetwork(){const n=this._getOption("staticNetwork");if(n)if(n===!0){if(T(this,ls))return T(this,ls)}else return n;return T(this,mr)?await T(this,mr):this.ready?(I(this,mr,(async()=>{try{const r=rn.from(xe(await this.send("eth_chainId",[])));return I(this,mr,null),r}catch(r){throw I(this,mr,null),r}})()),await T(this,mr)):(I(this,mr,(async()=>{const r={id:Dp(this,Vf)._++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:r});let s;try{s=(await this._send(r))[0],I(this,mr,null)}catch(i){throw I(this,mr,null),this.emit("debug",{action:"receiveRpcError",error:i}),i}if(this.emit("debug",{action:"receiveRpcResult",result:s}),"result"in s)return rn.from(xe(s.result));throw this.getRpcError(r,s)})()),await T(this,mr))}_start(){T(this,Rs)==null||T(this,Rs).resolve==null||(T(this,Rs).resolve(),I(this,Rs,null),(async()=>{for(;T(this,ls)==null&&!this.destroyed;)try{I(this,ls,await this._detectNetwork())}catch(n){if(this.destroyed)break;console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"),this.emit("error",Nt("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:n}})),await poe(1e3)}fe(this,Cp,iE).call(this)})())}async _waitUntilReady(){if(T(this,Rs)!=null)return await T(this,Rs).promise}_getSubscriber(n){return n.type==="pending"?new doe(this):n.type==="event"?this._getOption("polling")?new x2(this,n.filter):new foe(this,n.filter):n.type==="orphan"&&n.filter.orphan==="drop-log"?new Sy("orphan"):super._getSubscriber(n)}get ready(){return T(this,Rs)==null}getRpcTransaction(n){const r={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(s=>{if(n[s]==null)return;let i=s;s==="gasLimit"&&(i="gas"),r[i]=kl(xe(n[s],`tx.${s}`))}),["from","to","data"].forEach(s=>{n[s]!=null&&(r[s]=we(n[s]))}),n.accessList&&(r.accessList=ia(n.accessList)),n.blobVersionedHashes&&(r.blobVersionedHashes=n.blobVersionedHashes.map(s=>s.toLowerCase())),r}getRpcRequest(n){switch(n.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getPriorityFee":return{method:"eth_maxPriorityFeePerGas",args:[]};case"getBalance":return{method:"eth_getBalance",args:[Gc(n.address),n.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[Gc(n.address),n.blockTag]};case"getCode":return{method:"eth_getCode",args:[Gc(n.address),n.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[Gc(n.address),"0x"+n.position.toString(16),n.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[n.signedTransaction]};case"getBlock":if("blockTag"in n)return{method:"eth_getBlockByNumber",args:[n.blockTag,!!n.includeTransactions]};if("blockHash"in n)return{method:"eth_getBlockByHash",args:[n.blockHash,!!n.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[n.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[n.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(n.transaction),n.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(n.transaction)]};case"getLogs":return n.filter&&n.filter.address!=null&&(Array.isArray(n.filter.address)?n.filter.address=n.filter.address.map(Gc):n.filter.address=Gc(n.filter.address)),{method:"eth_getLogs",args:[n.filter]}}return null}getRpcError(n,r){const{method:s}=n,{error:i}=r;if(s==="eth_estimateGas"&&i.message){const l=i.message;if(!l.match(/revert/i)&&l.match(/insufficient funds/i))return Nt("insufficient funds","INSUFFICIENT_FUNDS",{transaction:n.params[0],info:{payload:n,error:i}})}if(s==="eth_call"||s==="eth_estimateGas"){const l=D2(i),u=jc.getBuiltinCallException(s==="eth_call"?"call":"estimateGas",n.params[0],l?l.data:null);return u.info={error:i,payload:n},u}const o=JSON.stringify(goe(i));if(typeof i.message=="string"&&i.message.match(/user denied|ethers-user-denied/i))return Nt("user rejected action","ACTION_REJECTED",{action:{eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"}[s]||"unknown",reason:"rejected",info:{payload:n,error:i}});if(s==="eth_sendRawTransaction"||s==="eth_sendTransaction"){const l=n.params[0];if(o.match(/insufficient funds|base fee exceeds gas limit/i))return Nt("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:l,info:{error:i}});if(o.match(/nonce/i)&&o.match(/too low/i))return Nt("nonce has already been used","NONCE_EXPIRED",{transaction:l,info:{error:i}});if(o.match(/replacement transaction/i)&&o.match(/underpriced/i))return Nt("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:l,info:{error:i}});if(o.match(/only replay-protected/i))return Nt("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?Nt("unsupported operation","UNSUPPORTED_OPERATION",{operation:n.method,info:{error:i,payload:n}}):Nt("could not coalesce error","UNKNOWN_ERROR",{error:i,payload:n})}send(n,r){if(this.destroyed)return Promise.reject(Nt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:n}));const s=Dp(this,Vf)._++,i=new Promise((o,a)=>{T(this,yo).push({resolve:o,reject:a,payload:{method:n,params:r,id:s,jsonrpc:"2.0"}})});return fe(this,Cp,iE).call(this),i}async getSigner(n){n==null&&(n=0);const r=this.send("eth_accounts",[]);if(typeof n=="number"){const i=await r;if(n>=i.length)throw new Error("no such account");return new T2(this,i[n])}const{accounts:s}=await Nn({network:this.getNetwork(),accounts:r});n=gt(n);for(const i of s)if(gt(i)===n)return new T2(this,n);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(r=>new T2(this,r))}destroy(){T(this,vi)&&(clearTimeout(T(this,vi)),I(this,vi,null));for(const{payload:n,reject:r}of T(this,yo))r(Nt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:n.method}));I(this,yo,[]),super.destroy()}}du=new WeakMap,Vf=new WeakMap,yo=new WeakMap,vi=new WeakMap,Rs=new WeakMap,ls=new WeakMap,mr=new WeakMap,Cp=new WeakSet,iE=function(){if(T(this,vi))return;const n=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");I(this,vi,setTimeout(()=>{I(this,vi,null);const r=T(this,yo);for(I(this,yo,[]);r.length;){const s=[r.shift()];for(;r.length&&s.length!==T(this,du).batchMaxCount;)if(s.push(r.shift()),JSON.stringify(s.map(o=>o.payload)).length>T(this,du).batchMaxSize){r.unshift(s.pop());break}(async()=>{const i=s.length===1?s[0].payload:s.map(o=>o.payload);this.emit("debug",{action:"sendRpcPayload",payload:i});try{const o=await this._send(i);this.emit("debug",{action:"receiveRpcResult",result:o});for(const{resolve:a,reject:l,payload:u}of s){if(this.destroyed){l(Nt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:u.method}));continue}const c=o.filter(f=>f.id===u.id)[0];if(c==null){const f=Nt("missing response for request","BAD_DATA",{value:o,info:{payload:u}});this.emit("error",f),l(f);continue}if("error"in c){l(this.getRpcError(u,c));continue}a(c.result)}}catch(o){this.emit("debug",{action:"receiveRpcError",error:o});for(const{reject:a}of s)a(o)}})()}},n))};class moe extends rI{constructor(n,r){super(n,r);J(this,_a);let s=this._getOption("pollingInterval");s==null&&(s=nI.pollingInterval),I(this,_a,s)}_getSubscriber(n){const r=super._getSubscriber(n);return tI(r)&&(r.pollingInterval=T(this,_a)),r}get pollingInterval(){return T(this,_a)}set pollingInterval(n){if(!Number.isInteger(n)||n<0)throw new Error("invalid interval");I(this,_a,n),this._forEachSubscriber(r=>{tI(r)&&(r.pollingInterval=T(this,_a))})}}_a=new WeakMap;class Qi extends moe{constructor(n,r,s){n==null&&(n="http://localhost:8545");super(r,s);J(this,Hf);typeof n=="string"?I(this,Hf,new Kn(n)):I(this,Hf,n.clone())}_getConnection(){return T(this,Hf).clone()}async send(n,r){return await this._start(),await super.send(n,r)}async _send(n){const r=this._getConnection();r.body=JSON.stringify(n),r.setHeader("content-type","application/json");const s=await r.send();s.assertOk();let i=s.bodyJson;return Array.isArray(i)||(i=[i]),i}}Hf=new WeakMap;function D2(t){if(t==null)return null;if(typeof t.message=="string"&&t.message.match(/revert/i)&&St(t.data))return{message:t.message,data:t.data};if(typeof t=="object"){for(const e in t){const n=D2(t[e]);if(n)return n}return null}if(typeof t=="string")try{return D2(JSON.parse(t))}catch{}return null}function O2(t,e){if(t!=null){if(typeof t.message=="string"&&e.push(t.message),typeof t=="object")for(const n in t)O2(t[n],e);if(typeof t=="string")try{return O2(JSON.parse(t),e)}catch{}}}function goe(t){const e=[];return O2(t,e),e}const Oy="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function yoe(t){switch(t){case"mainnet":return"rpc.ankr.com/eth";case"goerli":return"rpc.ankr.com/eth_goerli";case"sepolia":return"rpc.ankr.com/eth_sepolia";case"arbitrum":return"rpc.ankr.com/arbitrum";case"base":return"rpc.ankr.com/base";case"base-goerli":return"rpc.ankr.com/base_goerli";case"base-sepolia":return"rpc.ankr.com/base_sepolia";case"bnb":return"rpc.ankr.com/bsc";case"bnbt":return"rpc.ankr.com/bsc_testnet_chapel";case"matic":return"rpc.ankr.com/polygon";case"matic-mumbai":return"rpc.ankr.com/polygon_mumbai";case"optimism":return"rpc.ankr.com/optimism";case"optimism-goerli":return"rpc.ankr.com/optimism_testnet";case"optimism-sepolia":return"rpc.ankr.com/optimism_sepolia"}$(!1,"unsupported network","network",t)}class _y extends Qi{constructor(n,r){n==null&&(n="mainnet");const s=rn.from(n);r==null&&(r=Oy);const i={polling:!0,staticNetwork:s},o=_y.getRequest(s,r);super(o,s,i);W(this,"apiKey");Oe(this,{apiKey:r})}_getProvider(n){try{return new _y(n,this.apiKey)}catch{}return super._getProvider(n)}static getRequest(n,r){r==null&&(r=Oy);const s=new Kn(`https://${yoe(n.name)}/${r}`);return s.allowGzip=!0,r===Oy&&(s.retryFunc=async(i,o,a)=>($c("AnkrProvider"),!0)),s}getRpcError(n,r){return n.method==="eth_sendRawTransaction"&&r&&r.error&&r.error.message==="INTERNAL_ERROR: could not replace existing tx"&&(r.error.message="replacement transaction underpriced"),super.getRpcError(n,r)}isCommunityResource(){return this.apiKey===Oy}}const My="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";function boe(t){switch(t){case"mainnet":return"eth-mainnet.alchemyapi.io";case"goerli":return"eth-goerli.g.alchemy.com";case"sepolia":return"eth-sepolia.g.alchemy.com";case"arbitrum":return"arb-mainnet.g.alchemy.com";case"arbitrum-goerli":return"arb-goerli.g.alchemy.com";case"arbitrum-sepolia":return"arb-sepolia.g.alchemy.com";case"base":return"base-mainnet.g.alchemy.com";case"base-goerli":return"base-goerli.g.alchemy.com";case"base-sepolia":return"base-sepolia.g.alchemy.com";case"matic":return"polygon-mainnet.g.alchemy.com";case"matic-amoy":return"polygon-amoy.g.alchemy.com";case"matic-mumbai":return"polygon-mumbai.g.alchemy.com";case"optimism":return"opt-mainnet.g.alchemy.com";case"optimism-goerli":return"opt-goerli.g.alchemy.com";case"optimism-sepolia":return"opt-sepolia.g.alchemy.com"}$(!1,"unsupported network","network",t)}class Ny extends Qi{constructor(n,r){n==null&&(n="mainnet");const s=rn.from(n);r==null&&(r=My);const i=Ny.getRequest(s,r);super(i,s,{staticNetwork:s});W(this,"apiKey");Oe(this,{apiKey:r})}_getProvider(n){try{return new Ny(n,this.apiKey)}catch{}return super._getProvider(n)}async _perform(n){if(n.method==="getTransactionResult"){const{trace:r,tx:s}=await Nn({trace:this.send("trace_transaction",[n.hash]),tx:this.getTransaction(n.hash)});if(r==null||s==null)return null;let i,o=!1;try{i=r[0].result.output,o=r[0].error==="Reverted"}catch{}if(i)return ee(!o,"an error occurred during transaction executions","CALL_EXCEPTION",{action:"getTransactionResult",data:i,reason:null,transaction:s,invocation:null,revert:null}),i;ee(!1,"could not parse trace result","BAD_DATA",{value:r})}return await super._perform(n)}isCommunityResource(){return this.apiKey===My}static getRequest(n,r){r==null&&(r=My);const s=new Kn(`https://${boe(n.name)}/v2/${r}`);return s.allowGzip=!0,r===My&&(s.retryFunc=async(i,o,a)=>($c("alchemy"),!0)),s}}function Ry(t){switch(t){case"mainnet":return"39f1d67cedf8b7831010a665328c9197";case"arbitrum":return"0550c209db33c3abf4cc927e1e18cea1";case"bnb":return"98b5a77e531614387366f6fc5da097f8";case"matic":return"cd9d4d70377471aa7c142ec4a4205249"}$(!1,"unsupported network","network",t)}function woe(t){switch(t){case"mainnet":return"ethereum-mainnet.core.chainstack.com";case"arbitrum":return"arbitrum-mainnet.core.chainstack.com";case"bnb":return"bsc-mainnet.core.chainstack.com";case"matic":return"polygon-mainnet.core.chainstack.com"}$(!1,"unsupported network","network",t)}class Py extends Qi{constructor(n,r){n==null&&(n="mainnet");const s=rn.from(n);r==null&&(r=Ry(s.name));const i=Py.getRequest(s,r);super(i,s,{staticNetwork:s});W(this,"apiKey");Oe(this,{apiKey:r})}_getProvider(n){try{return new Py(n,this.apiKey)}catch{}return super._getProvider(n)}isCommunityResource(){return this.apiKey===Ry(this._network.name)}static getRequest(n,r){r==null&&(r=Ry(n.name));const s=new Kn(`https://${woe(n.name)}/${r}`);return s.allowGzip=!0,r===Ry(n.name)&&(s.retryFunc=async(i,o,a)=>($c("ChainstackProvider"),!0)),s}}class Aoe extends Qi{constructor(e){e==null&&(e="mainnet");const n=rn.from(e);$(n.name==="mainnet","unsupported network","network",e),super("https://cloudflare-eth.com/",n,{staticNetwork:n})}}const sI=2e3;function voe(t){return t&&typeof t.then=="function"}const xoe="org.ethers.plugins.provider.Etherscan",koe=["enableCcipRead"];let Eoe=1;class Coe extends Ty{constructor(n,r){const s=r??null;super();W(this,"network");W(this,"apiKey");J(this,zf);const i=rn.from(n);I(this,zf,i.getPlugin(xoe)),Oe(this,{apiKey:s,network:i}),this.getBaseUrl()}getBaseUrl(){if(T(this,zf))return T(this,zf).baseUrl;switch(this.network.name){case"mainnet":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"holesky":return"https://api-holesky.etherscan.io";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"base":return"https://api.basescan.org";case"base-sepolia":return"https://api-sepolia.basescan.org";case"bnb":return"https://api.bscscan.com";case"bnbt":return"https://api-testnet.bscscan.com";case"matic":return"https://api.polygonscan.com";case"matic-amoy":return"https://api-amoy.polygonscan.com";case"matic-mumbai":return"https://api-testnet.polygonscan.com";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}$(!1,"unsupported network","network",this.network)}getUrl(n,r){const s=Object.keys(r).reduce((o,a)=>{const l=r[a];return l!=null&&(o+=`&${a}=${l}`),o},""),i=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.getBaseUrl()}/api?module=${n}${s}${i}`}getPostUrl(){return`${this.getBaseUrl()}/api`}getPostData(n,r){return r.module=n,r.apikey=this.apiKey,r}async detectNetwork(){return this.network}async fetch(n,r,s){const i=Eoe++,o=s?this.getPostUrl():this.getUrl(n,r),a=s?this.getPostData(n,r):null;this.emit("debug",{action:"sendRequest",id:i,url:o,payload:a});const l=new Kn(o);l.setThrottleParams({slotInterval:1e3}),l.retryFunc=(f,d,h)=>(this.isCommunityResource()&&$c("Etherscan"),Promise.resolve(!0)),l.processFunc=async(f,d)=>{const h=d.hasBody()?JSON.parse(Tc(d.body)):{},p=(typeof h.result=="string"?h.result:"").toLowerCase().indexOf("rate limit")>=0;return n==="proxy"?h&&h.status==0&&h.message=="NOTOK"&&p&&(this.emit("debug",{action:"receiveError",id:i,reason:"proxy-NOTOK",error:h}),d.throwThrottleError(h.result,sI)):p&&(this.emit("debug",{action:"receiveError",id:i,reason:"null result",error:h.result}),d.throwThrottleError(h.result,sI)),d},a&&(l.setHeader("content-type","application/x-www-form-urlencoded; charset=UTF-8"),l.body=Object.keys(a).map(f=>`${f}=${a[f]}`).join("&"));const u=await l.send();try{u.assertOk()}catch(f){this.emit("debug",{action:"receiveError",id:i,error:f,reason:"assertOk"}),ee(!1,"response error","SERVER_ERROR",{request:l,response:u})}u.hasBody()||(this.emit("debug",{action:"receiveError",id:i,error:"missing body",reason:"null body"}),ee(!1,"missing response","SERVER_ERROR",{request:l,response:u}));const c=JSON.parse(Tc(u.body));return n==="proxy"?(c.jsonrpc!="2.0"&&(this.emit("debug",{action:"receiveError",id:i,result:c,reason:"invalid JSON-RPC"}),ee(!1,"invalid JSON-RPC response (missing jsonrpc='2.0')","SERVER_ERROR",{request:l,response:u,info:{result:c}})),c.error&&(this.emit("debug",{action:"receiveError",id:i,result:c,reason:"JSON-RPC error"}),ee(!1,"error response","SERVER_ERROR",{request:l,response:u,info:{result:c}})),this.emit("debug",{action:"receiveRequest",id:i,result:c}),c.result):c.status==0&&(c.message==="No records found"||c.message==="No transactions found")?(this.emit("debug",{action:"receiveRequest",id:i,result:c}),c.result):((c.status!=1||typeof c.message=="string"&&!c.message.match(/^OK/))&&(this.emit("debug",{action:"receiveError",id:i,result:c}),ee(!1,"error response","SERVER_ERROR",{request:l,response:u,info:{result:c}})),this.emit("debug",{action:"receiveRequest",id:i,result:c}),c.result)}_getTransactionPostData(n){const r={};for(let s in n){if(koe.indexOf(s)>=0||n[s]==null)continue;let i=n[s];if(!(s==="type"&&i===0)&&!(s==="blockTag"&&i==="latest")){if({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[s])i=kl(i);else if(s==="accessList")i="["+ia(i).map(o=>`{address:"${o.address}",storageKeys:["${o.storageKeys.join('","')}"]}`).join(",")+"]";else if(s==="blobVersionedHashes"){if(i.length===0)continue;ee(!1,"Etherscan API does not support blobVersionedHashes","UNSUPPORTED_OPERATION",{operation:"_getTransactionPostData",info:{transaction:n}})}else i=we(i);r[s]=i}}return r}_checkError(n,r,s){let i="";if(gn(r,"SERVER_ERROR")){try{i=r.info.result.error.message}catch{}if(!i)try{i=r.info.message}catch{}}if(n.method==="estimateGas"&&!i.match(/revert/i)&&i.match(/insufficient funds/i)&&ee(!1,"insufficient funds","INSUFFICIENT_FUNDS",{transaction:n.transaction}),(n.method==="call"||n.method==="estimateGas")&&i.match(/execution reverted/i)){let o="";try{o=r.info.result.error.data}catch{}const a=jc.getBuiltinCallException(n.method,n.transaction,o);throw a.info={request:n,error:r},a}if(i&&n.method==="broadcastTransaction"){const o=zh.from(n.signedTransaction);i.match(/replacement/i)&&i.match(/underpriced/i)&&ee(!1,"replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:o}),i.match(/insufficient funds/)&&ee(!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/)&&ee(!1,"nonce has already been used","NONCE_EXPIRED",{transaction:o})}throw r}async _detectNetwork(){return this.network}async _perform(n){switch(n.method){case"chainId":return this.network.chainId;case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getPriorityFee":if(this.network.name==="mainnet")return"1000000000";if(this.network.name==="optimism")return"1000000";throw new Error("fallback onto the AbstractProvider default");case"getBalance":return this.fetch("account",{action:"balance",address:n.address,tag:n.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:n.address,tag:n.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:n.address,tag:n.blockTag});case"getStorage":return this.fetch("proxy",{action:"eth_getStorageAt",address:n.address,position:n.position,tag:n.blockTag});case"broadcastTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:n.signedTransaction},!0).catch(r=>this._checkError(n,r,n.signedTransaction));case"getBlock":if("blockTag"in n)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:n.blockTag,boolean:n.includeTransactions?"true":"false"});ee(!1,"getBlock by blockHash not supported by Etherscan","UNSUPPORTED_OPERATION",{operation:"getBlock(blockHash)"});case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:n.hash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:n.hash});case"call":{if(n.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const r=this._getTransactionPostData(n.transaction);r.module="proxy",r.action="eth_call";try{return await this.fetch("proxy",r,!0)}catch(s){return this._checkError(n,s,n.transaction)}}case"estimateGas":{const r=this._getTransactionPostData(n.transaction);r.module="proxy",r.action="eth_estimateGas";try{return await this.fetch("proxy",r,!0)}catch(s){return this._checkError(n,s,n.transaction)}}}return super._perform(n)}async getNetwork(){return this.network}async getEtherPrice(){return this.network.name!=="mainnet"?0:parseFloat((await this.fetch("stats",{action:"ethprice"})).ethusd)}async getContract(n){let r=this._getAddress(n);voe(r)&&(r=await r);try{const s=await this.fetch("contract",{action:"getabi",address:r}),i=JSON.parse(s);return new Vc(r,i,this)}catch{return null}}isCommunityResource(){return this.apiKey==null}}zf=new WeakMap;function Soe(){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 Toe=Soe().WebSocket;class _2{constructor(e,n){J(this,xi);J(this,Sp);J(this,Ma);J(this,hu);J(this,Na);I(this,xi,e),I(this,Sp,JSON.stringify(n)),I(this,Ma,null),I(this,hu,null),I(this,Na,null)}get filter(){return JSON.parse(T(this,Sp))}start(){I(this,Ma,T(this,xi).send("eth_subscribe",this.filter).then(e=>(T(this,xi)._register(e,this),e)))}stop(){T(this,Ma).then(e=>{T(this,xi).destroyed||T(this,xi).send("eth_unsubscribe",[e])}),I(this,Ma,null)}pause(e){ee(e,"preserve logs while paused not supported by SocketSubscriber yet","UNSUPPORTED_OPERATION",{operation:"pause(false)"}),I(this,hu,!!e)}resume(){I(this,hu,null)}_handleMessage(e){if(T(this,Ma)!=null&&T(this,hu)===null){let n=T(this,Na);n==null?n=this._emit(T(this,xi),e):n=n.then(async()=>{await this._emit(T(this,xi),e)}),I(this,Na,n.then(()=>{T(this,Na)===n&&I(this,Na,null)}))}}async _emit(e,n){throw new Error("sub-classes must implemente this; _emit")}}xi=new WeakMap,Sp=new WeakMap,Ma=new WeakMap,hu=new WeakMap,Na=new WeakMap;class Doe extends _2{constructor(e){super(e,["newHeads"])}async _emit(e,n){e.emit("block",parseInt(n.number))}}class Ooe extends _2{constructor(e){super(e,["newPendingTransactions"])}async _emit(e,n){e.emit("pending",n)}}class _oe extends _2{constructor(n,r){super(n,["logs",r]);J(this,Tp);I(this,Tp,JSON.stringify(r))}get logFilter(){return JSON.parse(T(this,Tp))}async _emit(n,r){n.emit(this.logFilter,n._wrapLog(r,n._network))}}Tp=new WeakMap;class Moe extends rI{constructor(n,r){const s=Object.assign({},r??{});$(s.batchMaxCount==null||s.batchMaxCount===1,"sockets-based providers do not support batches","options.batchMaxCount",r),s.batchMaxCount=1,s.staticNetwork==null&&(s.staticNetwork=!0);super(n,s);J(this,pu);J(this,$f);J(this,Ra);I(this,pu,new Map),I(this,$f,new Map),I(this,Ra,new Map)}_getSubscriber(n){switch(n.type){case"close":return new Sy("close");case"block":return new Doe(this);case"pending":return new Ooe(this);case"event":return new _oe(this,n.filter);case"orphan":if(n.filter.orphan==="drop-log")return new Sy("drop-log")}return super._getSubscriber(n)}_register(n,r){T(this,$f).set(n,r);const s=T(this,Ra).get(n);if(s){for(const i of s)r._handleMessage(i);T(this,Ra).delete(n)}}async _send(n){$(!Array.isArray(n),"WebSocket does not support batch send","payload",n);const r=new Promise((s,i)=>{T(this,pu).set(n.id,{payload:n,resolve:s,reject:i})});return await this._waitUntilReady(),await this._write(JSON.stringify(n)),[await r]}async _processMessage(n){const r=JSON.parse(n);if(r&&typeof r=="object"&&"id"in r){const s=T(this,pu).get(r.id);if(s==null){this.emit("error",Nt("received result for unknown id","UNKNOWN_ERROR",{reasonCode:"UNKNOWN_ID",result:r}));return}T(this,pu).delete(r.id),s.resolve(r)}else if(r&&r.method==="eth_subscription"){const s=r.params.subscription,i=T(this,$f).get(s);if(i)i._handleMessage(r.params.result);else{let o=T(this,Ra).get(s);o==null&&(o=[],T(this,Ra).set(s,o)),o.push(r.params.result)}}else{this.emit("error",Nt("received unexpected message","UNKNOWN_ERROR",{reasonCode:"UNEXPECTED_MESSAGE",result:r}));return}}async _write(n){throw new Error("sub-classes must override this")}}pu=new WeakMap,$f=new WeakMap,Ra=new WeakMap;class iI extends Moe{constructor(n,r,s){super(r,s);J(this,mu);J(this,Ps);typeof n=="string"?(I(this,mu,()=>new Toe(n)),I(this,Ps,T(this,mu).call(this))):typeof n=="function"?(I(this,mu,n),I(this,Ps,n())):(I(this,mu,null),I(this,Ps,n)),this.websocket.onopen=async()=>{try{await this._start(),this.resume()}catch(i){console.log("failed to start WebsocketProvider",i)}},this.websocket.onmessage=i=>{this._processMessage(i.data)}}get websocket(){if(T(this,Ps)==null)throw new Error("websocket closed");return T(this,Ps)}async _write(n){this.websocket.send(n)}async destroy(){T(this,Ps)!=null&&(T(this,Ps).close(),I(this,Ps,null)),super.destroy()}}mu=new WeakMap,Ps=new WeakMap;const Jh="84842078b09946638c03157f83405213";function Noe(t){switch(t){case"mainnet":return"mainnet.infura.io";case"goerli":return"goerli.infura.io";case"sepolia":return"sepolia.infura.io";case"arbitrum":return"arbitrum-mainnet.infura.io";case"arbitrum-goerli":return"arbitrum-goerli.infura.io";case"arbitrum-sepolia":return"arbitrum-sepolia.infura.io";case"base":return"base-mainnet.infura.io";case"base-goerlia":return"base-goerli.infura.io";case"base-sepolia":return"base-sepolia.infura.io";case"bnb":return"bnbsmartchain-mainnet.infura.io";case"bnbt":return"bnbsmartchain-testnet.infura.io";case"linea":return"linea-mainnet.infura.io";case"linea-goerli":return"linea-goerli.infura.io";case"linea-sepolia":return"linea-sepolia.infura.io";case"matic":return"polygon-mainnet.infura.io";case"matic-amoy":return"polygon-amoy.infura.io";case"matic-mumbai":return"polygon-mumbai.infura.io";case"optimism":return"optimism-mainnet.infura.io";case"optimism-goerli":return"optimism-goerli.infura.io";case"optimism-sepolia":return"optimism-sepolia.infura.io"}$(!1,"unsupported network","network",t)}class Roe extends iI{constructor(n,r){const s=new Yh(n,r),i=s._getConnection();ee(!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");Oe(this,{projectId:s.projectId,projectSecret:s.projectSecret})}isCommunityResource(){return this.projectId===Jh}}class Yh extends Qi{constructor(n,r,s){n==null&&(n="mainnet");const i=rn.from(n);r==null&&(r=Jh),s==null&&(s=null);const o=Yh.getRequest(i,r,s);super(o,i,{staticNetwork:i});W(this,"projectId");W(this,"projectSecret");Oe(this,{projectId:r,projectSecret:s})}_getProvider(n){try{return new Yh(n,this.projectId,this.projectSecret)}catch{}return super._getProvider(n)}isCommunityResource(){return this.projectId===Jh}static getWebSocketProvider(n,r){return new Roe(n,r)}static getRequest(n,r,s){r==null&&(r=Jh),s==null&&(s=null);const i=new Kn(`https://${Noe(n.name)}/v3/${r}`);return i.allowGzip=!0,s&&i.setCredentials("",s),r===Jh&&(i.retryFunc=async(o,a,l)=>($c("InfuraProvider"),!0)),i}}const Iy="919b412a057b5e9c9b6dce193c5a60242d6efadb";function Poe(t){switch(t){case"mainnet":return"ethers.quiknode.pro";case"goerli":return"ethers.ethereum-goerli.quiknode.pro";case"sepolia":return"ethers.ethereum-sepolia.quiknode.pro";case"holesky":return"ethers.ethereum-holesky.quiknode.pro";case"arbitrum":return"ethers.arbitrum-mainnet.quiknode.pro";case"arbitrum-goerli":return"ethers.arbitrum-goerli.quiknode.pro";case"arbitrum-sepolia":return"ethers.arbitrum-sepolia.quiknode.pro";case"base":return"ethers.base-mainnet.quiknode.pro";case"base-goerli":return"ethers.base-goerli.quiknode.pro";case"base-spolia":return"ethers.base-sepolia.quiknode.pro";case"bnb":return"ethers.bsc.quiknode.pro";case"bnbt":return"ethers.bsc-testnet.quiknode.pro";case"matic":return"ethers.matic.quiknode.pro";case"matic-mumbai":return"ethers.matic-testnet.quiknode.pro";case"optimism":return"ethers.optimism.quiknode.pro";case"optimism-goerli":return"ethers.optimism-goerli.quiknode.pro";case"optimism-sepolia":return"ethers.optimism-sepolia.quiknode.pro";case"xdai":return"ethers.xdai.quiknode.pro"}$(!1,"unsupported network","network",t)}class Ly extends Qi{constructor(n,r){n==null&&(n="mainnet");const s=rn.from(n);r==null&&(r=Iy);const i=Ly.getRequest(s,r);super(i,s,{staticNetwork:s});W(this,"token");Oe(this,{token:r})}_getProvider(n){try{return new Ly(n,this.token)}catch{}return super._getProvider(n)}isCommunityResource(){return this.token===Iy}static getRequest(n,r){r==null&&(r=Iy);const s=new Kn(`https://${Poe(n.name)}/${r}`);return s.allowGzip=!0,r===Iy&&(s.retryFunc=async(i,o,a)=>($c("QuickNodeProvider"),!0)),s}}const Ioe=BigInt("1"),Loe=BigInt("2");function Boe(t){for(let e=t.length-1;e>0;e--){const n=Math.floor(Math.random()*(e+1)),r=t[e];t[e]=t[n],t[n]=r}}function Foe(t){return new Promise(e=>{setTimeout(e,t)})}function M2(){return new Date().getTime()}function N2(t){return JSON.stringify(t,(e,n)=>typeof n=="bigint"?{type:"bigint",value:n.toString()}:n)}const oI={stallTimeout:400,priority:1,weight:1},aI={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 joe(t,e){for(;(t.blockNumber<0||t.blockNumber<e)&&(t._updateNumber||(t._updateNumber=(async()=>{try{const n=await t.provider.getBlockNumber();n>t.blockNumber&&(t.blockNumber=n)}catch(n){t.blockNumber=-2,t._lastFatalError=n,t._lastFatalErrorTimestamp=M2()}t._updateNumber=null})()),await t._updateNumber,t.outOfSync++,!t._lastFatalError););}function Xh(t){if(t==null)return"null";if(Array.isArray(t))return"["+t.map(Xh).join(",")+"]";if(typeof t=="object"&&typeof t.toJSON=="function")return Xh(t.toJSON());switch(typeof t){case"boolean":case"symbol":return t.toString();case"bigint":case"number":return BigInt(t).toString();case"string":return JSON.stringify(t);case"object":{const e=Object.keys(t);return e.sort(),"{"+e.map(n=>`${JSON.stringify(n)}:${Xh(t[n])}`).join(",")+"}"}}throw console.log("Could not serialize",t),new Error("Hmm...")}function R2(t){if("error"in t){const n=t.error;return{tag:Xh(n),value:n}}const e=t.result;return{tag:Xh(e),value:e}}function By(t,e){const n=new Map;for(const{value:s,tag:i,weight:o}of e){const a=n.get(i)||{value:s,weight:0};a.weight+=o,n.set(i,a)}let r=null;for(const s of n.values())s.weight>=t&&(!r||s.weight>r.weight)&&(r=s);if(r)return r.value}function P2(t,e){let n=0;const r=new Map;let s=null;const i=[];for(const{value:a,tag:l,weight:u}of e)if(a instanceof Error){const c=r.get(l)||{value:a,weight:0};c.weight+=u,r.set(l,c),(s==null||c.weight>s.weight)&&(s=c)}else i.push(BigInt(a)),n+=u;if(n<t)return s&&s.weight>=t?s.value:void 0;i.sort((a,l)=>a<l?-1:l>a?1:0);const o=Math.floor(i.length/2);return i.length%2?i[o]:(i[o-1]+i[o]+Ioe)/Loe}function I2(t,e){const n=By(t,e);if(n!==void 0)return n;for(const r of e)if(r.value)return r.value}function Uoe(t,e){if(t===1)return Qe(P2(t,e),"%internal");const n=new Map,r=(o,a)=>{const l=n.get(o)||{result:o,weight:0};l.weight+=a,n.set(o,l)};for(const{weight:o,value:a}of e){const l=Qe(a);r(l-1,o),r(l,o),r(l+1,o)}let s=0,i;for(const{weight:o,result:a}of n.values())o>=t&&(o>s||i!=null&&o===s&&a>i)&&(s=o,i=a);return i}class Voe extends Ty{constructor(n,r,s){super(r,s);J(this,yr);W(this,"quorum");W(this,"eventQuorum");W(this,"eventWorkers");J(this,gr);J(this,bo);J(this,Gf);I(this,gr,n.map(i=>i instanceof Ty?Object.assign({provider:i},oI,aI):Object.assign({},oI,i,aI))),I(this,bo,-2),I(this,Gf,null),s&&s.quorum!=null?this.quorum=s.quorum:this.quorum=Math.ceil(T(this,gr).reduce((i,o)=>(i+=o.weight,i),0)/2),this.eventQuorum=1,this.eventWorkers=1,$(this.quorum<=T(this,gr).reduce((i,o)=>i+o.weight,0),"quorum exceed provider weight","quorum",this.quorum)}get providerConfigs(){return T(this,gr).map(n=>{const r=Object.assign({},n);for(const s in r)s[0]==="_"&&delete r[s];return r})}async _detectNetwork(){return rn.from(xe(await this._perform({method:"chainId"})))}async _translatePerform(n,r){switch(r.method){case"broadcastTransaction":return await n.broadcastTransaction(r.signedTransaction);case"call":return await n.call(Object.assign({},r.transaction,{blockTag:r.blockTag}));case"chainId":return(await n.getNetwork()).chainId;case"estimateGas":return await n.estimateGas(r.transaction);case"getBalance":return await n.getBalance(r.address,r.blockTag);case"getBlock":{const s="blockHash"in r?r.blockHash:r.blockTag;return await n.getBlock(s,r.includeTransactions)}case"getBlockNumber":return await n.getBlockNumber();case"getCode":return await n.getCode(r.address,r.blockTag);case"getGasPrice":return(await n.getFeeData()).gasPrice;case"getPriorityFee":return(await n.getFeeData()).maxPriorityFeePerGas;case"getLogs":return await n.getLogs(r.filter);case"getStorage":return await n.getStorage(r.address,r.position,r.blockTag);case"getTransaction":return await n.getTransaction(r.hash);case"getTransactionCount":return await n.getTransactionCount(r.address,r.blockTag);case"getTransactionReceipt":return await n.getTransactionReceipt(r.hash);case"getTransactionResult":return await n.getTransactionResult(r.hash)}}async _perform(n){if(n.method==="broadcastTransaction"){const o=T(this,gr).map(u=>null),a=T(this,gr).map(async({provider:u,weight:c},f)=>{try{const d=await u._perform(n);o[f]=Object.assign(R2({result:d}),{weight:c})}catch(d){o[f]=Object.assign(R2({error:d}),{weight:c})}});for(;;){const u=o.filter(d=>d!=null);for(const{value:d}of u)if(!(d instanceof Error))return d;const c=By(this.quorum,o.filter(d=>d!=null));if(gn(c,"INSUFFICIENT_FUNDS"))throw c;const f=a.filter((d,h)=>o[h]==null);if(f.length===0)break;await Promise.race(f)}const l=I2(this.quorum,o);if(ee(l!==void 0,"problem multi-broadcasting","SERVER_ERROR",{request:"%sub-requests",info:{request:n,results:o.map(N2)}}),l instanceof Error)throw l;return l}await fe(this,yr,ZL).call(this);const r=new Set;let s=0;for(;;){const o=fe(this,yr,oE).call(this,r,n);if(o==null||(s+=o.config.weight,s>=this.quorum))break}const i=await fe(this,yr,aE).call(this,r,n);for(const o of r)o.perform&&o.result==null&&o.config.lateResponses++;return i}async destroy(){for(const{provider:n}of T(this,gr))n.destroy();super.destroy()}}gr=new WeakMap,bo=new WeakMap,Gf=new WeakMap,yr=new WeakSet,XL=function(n){const r=Array.from(n).map(i=>i.config),s=T(this,gr).slice();Boe(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},oE=function(n,r){const s=fe(this,yr,XL).call(this,n);if(s==null)return null;const i={config:s,result:null,didBump:!1,perform:null,staller:null},o=M2();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=M2()-o;s._totalTime+=a,s.rollingDuration=.95*s.rollingDuration+.05*a,i.perform=null})(),i.staller=(async()=>{await Foe(s.stallTimeout),i.staller=null})(),n.add(i),i},ZL=async function(){let n=T(this,Gf);if(!n){const r=[];T(this,gr).forEach(s=>{r.push((async()=>{await joe(s,0),s._lastFatalError||(s._network=await s.provider.getNetwork())})())}),I(this,Gf,n=(async()=>{await Promise.all(r);let s=null;for(const i of T(this,gr)){if(i._lastFatalError)continue;const o=i._network;s==null?s=o.chainId:o.chainId!==s&&ee(!1,"cannot mix providers on different networks","UNSUPPORTED_OPERATION",{operation:"new FallbackProvider"})}})())}await n},e5=async function(n,r){const s=[];for(const i of n)if(i.result!=null){const{tag:o,value:a}=R2(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,bo)===-2&&I(this,bo,Math.ceil(Qe(P2(this.quorum,T(this,gr).filter(o=>!o._lastFatalError).map(o=>({value:o.blockNumber,tag:Qe(o.blockNumber).toString(),weight:o.weight}))))));const i=Uoe(this.quorum,s);return i===void 0?void 0:(i>T(this,bo)&&I(this,bo,i),T(this,bo))}case"getGasPrice":case"getPriorityFee":case"estimateGas":return P2(this.quorum,s);case"getBlock":return"blockTag"in r&&r.blockTag==="pending"?I2(this.quorum,s):By(this.quorum,s);case"call":case"chainId":case"getBalance":case"getTransactionCount":case"getCode":case"getStorage":case"getTransaction":case"getTransactionReceipt":case"getLogs":return By(this.quorum,s);case"broadcastTransaction":return I2(this.quorum,s)}ee(!1,"unsupported method","UNSUPPORTED_OPERATION",{operation:`_perform(${N2(r.method)})`})}},aE=async function(n,r){if(n.size===0)throw new Error("no runners?!");const s=[];let i=0;for(const a of n){if(a.perform&&s.push(a.perform),a.staller){s.push(a.staller);continue}a.didBump||(a.didBump=!0,i++)}const o=await fe(this,yr,e5).call(this,n,r);if(o!==void 0){if(o instanceof Error)throw o;return o}for(let a=0;a<i;a++)fe(this,yr,oE).call(this,n,r);return ee(s.length>0,"quorum not met","SERVER_ERROR",{request:"%sub-requests",info:{request:r,results:Array.from(n).map(a=>N2(a.result))}}),await Promise.race(s),await fe(this,yr,aE).call(this,n,r)};function Hoe(t){return t&&typeof t.send=="function"&&typeof t.close=="function"}const zoe="goerli kovan sepolia classicKotti optimism-goerli arbitrum-goerli matic-mumbai bnbt".split(" ");function $oe(t,e){e==null&&(e={});const n=o=>e[o]==="-"?!1:typeof e.exclusive=="string"?o===e.exclusive:Array.isArray(e.exclusive)?e.exclusive.indexOf(o)!==-1:!0;if(typeof t=="string"&&t.match(/^https?:/))return new Qi(t);if(typeof t=="string"&&t.match(/^wss?:/)||Hoe(t))return new iI(t);let r=null;try{r=rn.from(t)}catch{}const s=[];if(n("publicPolygon")&&r&&(r.name==="matic"?s.push(new Qi("https://polygon-rpc.com/",r,{staticNetwork:r})):r.name==="matic-amoy"&&s.push(new Qi("https://rpc-amoy.polygon.technology/",r,{staticNetwork:r}))),n("alchemy"))try{s.push(new Ny(t,e.alchemy))}catch{}if(n("ankr")&&e.ankr!=null)try{s.push(new _y(t,e.ankr))}catch{}if(n("chainstack"))try{s.push(new Py(t,e.chainstack))}catch{}if(n("cloudflare"))try{s.push(new Aoe(t))}catch{}if(n("etherscan"))try{s.push(new Coe(t,e.etherscan))}catch{}if(n("infura"))try{let o=e.infura,a;typeof o=="object"&&(a=o.projectSecret,o=o.projectId),s.push(new Yh(t,o,a))}catch{}if(n("quicknode"))try{let o=e.quicknode;s.push(new Ly(t,o))}catch{}if(ee(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&&zoe.indexOf(r.name)!==-1&&(i=1),e&&e.quorum&&(i=e.quorum),new Voe(s,void 0,{quorum:i})}const Goe=async(t,e)=>{const n={name:t,isEns:!1};if(!e)throw new Error("cannot fetch ens name without a provider url");if(!Vre(t))return n;try{const r=await Woe(t,e);r&&(n.name=r,n.isEns=!0)}catch(r){console.log(r)}return n},Woe=async(t,e)=>await Koe(e).lookupAddress(t),Koe=t=>$oe(t),qoe=(t,e,n)=>{if((t==null?void 0:t.length)>n){const r=t.substring(0,e),s=t.substring((t==null?void 0:t.length)-e);return`${r}...${s}`}return t};function Qoe(t){var e;const{char:n,allowSpaces:r,allowedPrefixes:s,startOfLine:i,$position:o}=t,a=z7(n),l=new RegExp(`\\s${a}$`),u=i?"^":"",c=r?new RegExp(`${u}${a}.*?(?=\\s${a}|$)`,"gm"):new RegExp(`${u}(?:^)?${a}[^\\s${a}]*`,"gm"),f=((e=o.nodeBefore)===null||e===void 0?void 0:e.isText)&&o.nodeBefore.text;if(!f)return null;const d=o.pos-f.length,h=Array.from(f.matchAll(c)).pop();if(!h||h.input===void 0||h.index===void 0)return null;const p=h.input.slice(Math.max(0,h.index-1),h.index),m=new RegExp(`^[${s==null?void 0:s.join("")}\0]?$`).test(p);if(s!==null&&!m)return null;const g=d+h.index;let y=g+h[0].length;return r&&l.test(f.slice(y-1,y+1))&&(h[0]+=" ",y+=1),g<o.pos&&y>=o.pos?{range:{from:g,to:y},query:h[0].slice(n.length),text:h[0]}:null}const Joe=new _t("suggestion");function Yoe({pluginKey:t=Joe,editor:e,char:n="@",allowSpaces:r=!1,allowedPrefixes:s=[" "],startOfLine:i=!1,decorationTag:o="span",decorationClass:a="suggestion",command:l=()=>null,items:u=()=>[],render:c=()=>({}),allow:f=()=>!0,findSuggestionMatch:d=Qoe}){let h;const p=c==null?void 0:c(),m=new bt({key:t,view(){return{update:async(g,y)=>{var v,w,A,x,k,C,O;const _=(v=this.key)===null||v===void 0?void 0:v.getState(y),D=(w=this.key)===null||w===void 0?void 0:w.getState(g.state),R=_.active&&D.active&&_.range.from!==D.range.from,L=!_.active&&D.active,F=_.active&&!D.active,G=!L&&!F&&_.query!==D.query,B=L,H=G||R,Q=F;if(!B&&!H&&!Q)return;const te=Q&&!B?_:D,Z=g.dom.querySelector(`[data-decoration-id="${te.decorationId}"]`);h={editor:e,range:te.range,query:te.query,text:te.text,items:[],command:pe=>l({editor:e,range:te.range,props:pe}),decorationNode:Z,clientRect:Z?()=>{var pe;const{decorationId:Ee}=(pe=this.key)===null||pe===void 0?void 0:pe.getState(e.state),Re=g.dom.querySelector(`[data-decoration-id="${Ee}"]`);return(Re==null?void 0:Re.getBoundingClientRect())||null}:null},B&&((A=p==null?void 0:p.onBeforeStart)===null||A===void 0||A.call(p,h)),H&&((x=p==null?void 0:p.onBeforeUpdate)===null||x===void 0||x.call(p,h)),(H||B)&&(h.items=await u({editor:e,query:te.query})),Q&&((k=p==null?void 0:p.onExit)===null||k===void 0||k.call(p,h)),H&&((C=p==null?void 0:p.onUpdate)===null||C===void 0||C.call(p,h)),B&&((O=p==null?void 0:p.onStart)===null||O===void 0||O.call(p,h))},destroy:()=>{var g;h&&((g=p==null?void 0:p.onExit)===null||g===void 0||g.call(p,h))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(g,y,v,w){const{isEditable:A}=e,{composing:x}=e.view,{selection:k}=g,{empty:C,from:O}=k,_={...y};if(_.composing=x,A&&(C||e.view.composing)){(O<y.range.from||O>y.range.to)&&!x&&!y.composing&&(_.active=!1);const D=d({char:n,allowSpaces:r,allowedPrefixes:s,startOfLine:i,$position:k.$from}),R=`id_${Math.floor(Math.random()*4294967295)}`;D&&f({editor:e,state:w,range:D.range,isActive:y.active})?(_.active=!0,_.decorationId=y.decorationId?y.decorationId:R,_.range=D.range,_.query=D.query,_.text=D.text):_.active=!1}else _.active=!1;return _.active||(_.decorationId=null,_.range={from:0,to:0},_.query=null,_.text=null),_}},props:{handleKeyDown(g,y){var v;const{active:w,range:A}=m.getState(g.state);return w&&((v=p==null?void 0:p.onKeyDown)===null||v===void 0?void 0:v.call(p,{view:g,event:y,range:A}))||!1},decorations(g){const{active:y,range:v,decorationId:w}=m.getState(g);return y?kt.create(g.doc,[nn.inline(v.from,v.to,{nodeName:o,class:a,"data-decoration-id":w})]):null}}});return m}var Xoe=typeof tr=="object"&&tr&&tr.Object===Object&&tr,Zoe=typeof self=="object"&&self&&self.Object===Object&&self;Xoe||Zoe||Function("return this")();var eae=typeof window<"u"?N.useLayoutEffect:N.useEffect,tae=typeof window>"u";function L2(t,{defaultValue:e=!1,initializeWithValue:n=!0}={}){const r=a=>tae?e:window.matchMedia(a).matches,[s,i]=N.useState(()=>n?r(t):e);function o(){i(r(t))}return eae(()=>{const a=window.matchMedia(t);return o(),a.addListener?a.addListener(o):a.addEventListener("change",o),()=>{a.removeListener?a.removeListener(o):a.removeEventListener("change",o)}},[t]),s}const nae=wt.create({name:"slash-command",addOptions(){return{suggestion:{char:"/",command:({editor:t,range:e,props:n})=>{n.command({editor:t,range:e})}}}},addProseMirrorPlugins(){return[Yoe({editor:this.editor,...this.options.suggestion})]}}),rae=({query:t,onError:e})=>[{title:"Text",description:"Just start typing with plain text.",searchTerms:["p","paragraph"],icon:S.jsx(XT,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).toggleNode("paragraph","paragraph").run()}},{title:"To-do List",description:"Track tasks with a to-do list.",searchTerms:["todo","task","list","check","checkbox"],icon:S.jsx(YT,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).toggleTaskList().run()}},{title:"Heading 1",description:"Big section heading.",searchTerms:["title","big","large"],icon:S.jsx(C0,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setNode("heading",{level:1}).run()}},{title:"Heading 2",description:"Medium section heading.",searchTerms:["subtitle","medium"],icon:S.jsx(S0,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setNode("heading",{level:2}).run()}},{title:"Heading 3",description:"Small section heading.",searchTerms:["subtitle","small"],icon:S.jsx(T0,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setNode("heading",{level:3}).run()}},{title:"Bullet List",description:"Create a simple bullet list.",searchTerms:["unordered","point"],icon:S.jsx(D0,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).toggleBulletList().run()}},{title:"Numbered List",description:"Create a list with numbering.",searchTerms:["ordered"],icon:S.jsx(Uu,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).toggleOrderedList().run()}},{title:"Divider",description:"Visually divide content.",searchTerms:["hr","divider","break","line","delimiter"],icon:S.jsx(nV,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setHorizontalRule().run()}},{title:"Quote",description:"Capture a quote.",searchTerms:["blockquote"],icon:S.jsx(O0,{size:18}),image:"",command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).toggleNode("paragraph","paragraph").toggleBlockquote().run()},{title:"Code",description:"Capture a code snippet.",searchTerms:["codeblock"],icon:S.jsx(Md,{size:18}),image:"",command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).toggleCodeBlock().run()},{title:"Table",description:"Create a table.",searchTerms:["table"],icon:S.jsx(iw,{size:18}),image:"",command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).insertTable({rows:3,cols:2,withHeaderRow:!0}).run()},{title:"Image",description:"Upload an image from your computer.",searchTerms:["photo","picture","media"],icon:S.jsx(ZU,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).run();const s=document.createElement("input");s.type="file",s.accept="image/*",s.onchange=async()=>{var i;if((i=s.files)!=null&&i.length){const o=s.files[0];if(o.size>Vd){e&&typeof e=="function"&&e(Kw.IMAGE_SIZE);return}const l=n.view.state.selection.from;uw(o,n.view,l)}},s.click()}},{title:"Video Embed",description:"Embed a video from YouTube, Vimeo, etc.",searchTerms:["iframe","embed","video","youtube"],icon:S.jsx(e3,{}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setActionButton("iframe").run()}},{title:"Twitter",description:"Embed a Twitter tweet.",searchTerms:["embed","twitter","tweet"],icon:S.jsx(ZT,{}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setActionButton("twitter").run()}},{title:"2 Columns",description:"Create 2 columns of block",searchTerms:["col","column","2","layout"],icon:S.jsx(qT,{}),image:"",command:({editor:n})=>{n.chain().focus().setColumns(2).focus(n.state.selection.head-1).run()}},{title:"3 Columns",description:"Create 3 columns of block",searchTerms:["col","column","3","layout"],icon:S.jsx(QU,{}),image:"",command:({editor:n})=>{n.chain().focus().setColumns(3).focus(n.state.selection.head-1).run()}}].filter(n=>{if(typeof t=="string"&&t.length>0){const r=t.toLowerCase();return n.title.toLowerCase().includes(r)||n.description.toLowerCase().includes(r)||n.searchTerms&&n.searchTerms.some(s=>s.includes(r))}return!0}),sae=(t,e)=>{const n=t.offsetHeight,r=e?e.offsetHeight:0,s=e.offsetTop,i=s+r;s<t.scrollTop?t.scrollTop-=t.scrollTop-s+5:i>n+t.scrollTop&&(t.scrollTop+=i-n-t.scrollTop+5)},iae=({items:t,command:e,editor:n})=>{const[r,s]=N.useState(0),[i,o]=N.useState(t),a=L2("(max-width: 640px)"),l=N.useCallback(c=>{const f=i[c];f&&(f.title==="Continue writing"||e(f))},[e,n,i]);N.useEffect(()=>{if(a){const c=t.filter(f=>!["2 Columns","3 Columns","Twitter","Video Embed"].includes(f.title));o(c)}else o(t)},[t,a]),N.useEffect(()=>{const c=["ArrowUp","ArrowDown","Enter"],f=d=>{if(c.includes(d.key))return d.preventDefault(),d.key==="ArrowUp"?(s((r+i.length-1)%i.length),!0):d.key==="ArrowDown"?(s((r+1)%i.length),!0):d.key==="Enter"?(l(r),!0):!1};return document.addEventListener("keydown",f),()=>{document.removeEventListener("keydown",f)}},[i,r,s,l]),N.useEffect(()=>{s(0)},[i]);const u=N.useRef(null);return N.useLayoutEffect(()=>{const c=u==null?void 0:u.current,f=c==null?void 0:c.children[r];f&&c&&sae(c,f)},[r]),i.length>0?S.jsx("div",{id:"slash-command",ref:u,className:"z-50 h-auto max-h-[330px] w-72 overflow-y-auto scroll-smooth rounded-md border border-[#DDD] bg-white px-1 py-2 shadow-md transition-all",children:i.map((c,f)=>S.jsxs("button",{className:`flex w-full items-center space-x-2 rounded-md px-2 py-1 text-left text-sm text-neutral-500 hover:bg-neutral-100 hover:border-neutral-200 border border-transparent transition-all ${f===r?"bg-neutral-200 text-neutral-800":""}`,onClick:()=>l(f),children:[S.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-md border border-neutral-200 bg-white",children:c.icon}),S.jsxs("div",{children:[S.jsx("p",{className:"font-medium",children:c.title}),S.jsx("p",{className:"text-xs text-neutral-500",children:c.description})]})]},f))}):null},oae=()=>{let t=null,e=null;return{onStart:n=>{t=new GT(iae,{props:n,editor:n.editor}),e=Xa("body",{getReferenceClientRect:n.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"})},onUpdate:n=>{t==null||t.updateProps(n),e&&e[0].setProps({getReferenceClientRect:n.clientRect})},onKeyDown:n=>{var r;return n.event.key==="Escape"?(e==null||e[0].hide(),!0):(r=t==null?void 0:t.ref)==null?void 0:r.onKeyDown(n)},onExit:()=>{e==null||e[0].destroy(),t==null||t.destroy()}}},aae=t=>{const e=({query:n})=>rae({query:n,onError:t});return nae.configure({suggestion:{items:e,render:oae}})},lI=["#30bced","#6eeb83","#fa69d1","#ecd444","#ee6352","#db3041","#0ad7f2","#1bff39"],lae=({isPreviewMode:t,initialContent:e,enableCollaboration:n,collaborationId:r,walletAddress:s,username:i,onChange:o,onCollaboratorChange:a,onCommentInteraction:l,onTextSelection:u,ensResolutionUrl:c,onError:f})=>{var O,_;const[d]=N.useState(new ul),[h,p]=N.useState([...qte,aae(f)]),m=N.useRef(!1),g=(D,R,L)=>{let F=!1;return D.doc.nodesBetween(R,L,G=>{G.marks&&G.marks.some(B=>B.type.name==="highlight"&&B.attrs.color==="yellow")&&(F=!0)}),F},y=(D,R)=>{var F;const L=R.target;if(L&&L.nodeName==="MARK"&&L.dataset.color&&((F=L==null?void 0:L.dataset)==null?void 0:F.color)==="yellow"){const G=L.textContent,B=D.posAtCoords({left:R.clientX,top:R.clientY});if(B){const{state:H}=D;let Q=B.pos,te=B.pos;if(H.doc.nodesBetween(Q,te,(Z,pe)=>{Z.marks&&Z.marks.length&&Z.marks.forEach(Ee=>{Ee.type.name==="highlight"&&(Q=pe,te=pe+Z.nodeSize)})}),Q!==te){const Z={text:G,from:Q,to:te,isHighlightedYellow:g(H,Q,te)};l==null||l(Z)}}}},w=FU({extensions:h,editorProps:{...cK,handleDOMEvents:{mouseover:y,keydown:(D,R)=>{if(["ArrowUp","ArrowDown","Enter"].includes(R.key)&&document.querySelector("#slash-command"))return!0}},handleClick:(D,R,L)=>{y(D,L)}},autofocus:"start",onTransaction:D=>{w!=null&&w.isEmpty||o==null||o(D.editor.getJSON())},shouldRerenderOnTransaction:!0,immediatelyRender:!1},[h]),A=N.useRef(()=>{}),x=(D,R=!1)=>{if(!n||!r)throw new Error("docId or username is not provided");const L=new uK(r,d,{signaling:["wss://fileverse-signaling-server-0529292ff51c.herokuapp.com/"]});return p([...h,LK.configure({document:d}),BK.configure({provider:L,user:{name:D&&D.length>20?qoe(D,7,15):D,color:lI[Math.floor(Math.random()*lI.length)],isEns:R},render:Zte})]),A.current=()=>{L.destroy(),d.destroy()},A.current},k=N.useRef(null);N.useEffect(()=>{w==null||w.setEditable(!t)},[t,w]),N.useEffect(()=>{e&&w&&!m.current&&(queueMicrotask(()=>{w.commands.setContent(e)}),m.current=!0),setTimeout(()=>{m.current=!1})},[e,w]),N.useEffect(()=>{if(!w)return;const D=()=>{const{state:R}=w,{from:L,to:F}=R.selection,G=R.doc.textBetween(L,F," ");u==null||u({text:G,from:L,to:F,isHighlightedYellow:g(R,L,F)})};return w.on("selectionUpdate",D),()=>{w.off("selectionUpdate",D)}},[w]);const C=async()=>{let D=i,R=!1;if(s&&c){const{name:L,isEns:F}=await Goe(s,c);D=L,R=F}if(!D)throw new Error("Cannot start collaboration without a username");x(D,R)};return N.useEffect(()=>{n?C():A.current()},[n]),N.useEffect(()=>{var D,R;a==null||a((R=(D=w==null?void 0:w.storage)==null?void 0:D.collaborationCursor)==null?void 0:R.users)},[(_=(O=w==null?void 0:w.storage)==null?void 0:O.collaborationCursor)==null?void 0:_.users]),{editor:w,ref:k,connect:x,ydoc:d}},uae=({title:t,content:e,contentClassName:n,open:r,onOpenChange:s,primaryAction:i,secondaryAction:o})=>S.jsx(dz,{open:r,onOpenChange:s,children:S.jsxs(bD,{className:"max-w-md sm:w-full w-[90%] z-20",children:[S.jsx(wD,{className:"px-4 pt-0 border-b-[1px]",children:S.jsx(vD,{className:"text-left text-base",children:t})}),S.jsx("div",{className:he("flex flex-col gap-4 w-full h-full pb-4 text-base text-black",n),children:e&&e}),S.jsxs(AD,{className:"px-5 pb-5 justify-end sm:",children:[o&&S.jsx(mz,{asChild:!0,children:S.jsx(sl,{disabled:o==null?void 0:o.isLoading,isLoading:o==null?void 0:o.isLoading,className:o==null?void 0:o.className,variant:(o==null?void 0:o.variant)||"ghost",onClick:o==null?void 0:o.onClick,children:o==null?void 0:o.label})}),i&&S.jsx(sl,{disabled:i==null?void 0:i.isLoading,isLoading:i==null?void 0:i.isLoading,className:i==null?void 0:i.className,variant:(i==null?void 0:i.variant)||"primary",onClick:i==null?void 0:i.onClick,children:i==null?void 0:i.label})]})]})}),cae=({editor:t,onError:e})=>{const{toolVisibilty:n,setToolVisibility:r,bottomToolbar:s}=qw({editor:t,onError:e}),i=L2("(max-width: 1023px)"),[o,a]=N.useState(""),[l,u]=N.useState(""),[c,f]=N.useState(!0),d=()=>{if(o===null){f(!1);return}if(o===""){t.chain().focus().extendMarkRange("link").unsetLink().run(),f(!1);return}let m=o;!o.startsWith("http://")&&!o.startsWith("https://")&&(m="https://"+o);try{m.match(/^((http|https):\/\/)?([w|W]{3}\.)+[a-zA-Z0-9\-\.]{3,}\.[a-zA-Z]{2,}(\.[a-zA-Z]{2,})?$/)&&t.chain().focus().extendMarkRange("link").setLink({href:m}).command(({tr:g})=>(g.insertText(l),!0)).run(),f(!0)}catch{console.error("Invalid URL"),f(!1);return}t.chain().focus().extendMarkRange("link").setLink({href:m}).command(({tr:g})=>(g.insertText(l),!0)).run(),f(!0),r(Me.NONE)},h=m=>{const{from:g,to:y}=m.state.selection,v=m.state.doc.textBetween(g,y);return u(v),v},p=N.useRef(null);return N.useEffect(()=>{let m=0;const g=()=>{m=Date.now()},y=()=>{var A;if(Date.now()-m>500){const{selection:x}=t.state;x.from!==x.to&&((A=p.current)==null||A.click())}},v=()=>{var x;if(!i)return;const{selection:w}=t.state;w.from!==w.to&&((x=p.current)==null||x.click())};return i?(document.addEventListener("touchstart",g),document.addEventListener("touchend",y)):document.addEventListener("mouseup",v),()=>{i?(document.removeEventListener("touchstart",g),document.removeEventListener("touchend",y)):document.removeEventListener("mouseup",v)}},[t,i]),N.useEffect(()=>{h(t)},[t]),N.useEffect(()=>{const m=g=>{g.key==="k"&&(g.metaKey||g.ctrlKey)&&(g.preventDefault(),n!==Me.LINK_POPUP?r(Me.LINK_POPUP):r(Me.NONE))};return document.addEventListener("keydown",m),()=>{document.removeEventListener("keydown",m)}},[t,n]),S.jsxs(fD,{children:[S.jsx("div",{className:"flex w-full justify-between sm:justify-evenly select-none",children:s.map(m=>{if(m)return S.jsx("div",{className:"flex items-center",children:m.title==="Text formating"?S.jsx(dD,{asChild:!0,children:S.jsx("button",{ref:p,onClick:()=>m.onClick(),children:m.icon})}):m.title==="Text color"?S.jsx(dD,{asChild:!0,children:S.jsx("button",{onClick:()=>m.onClick(),children:m.icon})}):S.jsx("button",{className:he("flex items-center rounded px-2 py-1 transition",{"text-black":m.isActive,"text-[#A1AAB1]":!m.isActive}),onClick:()=>m.onClick(),disabled:!m.isActive,children:m.icon})},m.title)})}),n===Me.TEXT_FORMATING&&S.jsx(n$,{editor:t,setToolVisibility:r}),n===Me.LINK_POPUP&&S.jsx(uae,{open:n===Me.LINK_POPUP,onOpenChange:()=>r(Me.NONE),title:"Link",content:S.jsxs("div",{className:"flex flex-col gap-4 w-full h-full px-4",children:[S.jsx(q0,{label:"Text",placeholder:"Link text",className:"w-full",defaultValue:l,onChange:m=>{m.preventDefault(),u(m.target.value)}}),S.jsx(q0,{label:"Link",placeholder:"Paste URL",className:"w-full",defaultValue:t.getAttributes("link").href,onChange:m=>{m.preventDefault(),a(m.target.value)},isValid:c,message:c?"":"Invalid URL"})]}),primaryAction:{label:"Save",onClick:()=>d(),isLoading:!1,className:"w-auto min-w-[80px]"},secondaryAction:{label:"Cancel",variant:"secondary",onClick:()=>r(Me.NONE),className:"w-auto min-w-[80px]"}})]})},B2=N.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),Fy=N.createContext({}),jy=N.createContext(null),F2=typeof document<"u",j2=F2?N.useLayoutEffect:N.useEffect,uI=N.createContext({strict:!1}),U2=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),cI="data-"+U2("framerAppearId"),fae={skipAnimations:!1,useManualTiming:!1};class fI{constructor(){this.order=[],this.scheduled=new Set}add(e){if(!this.scheduled.has(e))return this.scheduled.add(e),this.order.push(e),!0}remove(e){const n=this.order.indexOf(e);n!==-1&&(this.order.splice(n,1),this.scheduled.delete(e))}clear(){this.order.length=0,this.scheduled.clear()}}function dae(t){let e=new fI,n=new fI,r=0,s=!1,i=!1;const o=new WeakSet,a={schedule:(l,u=!1,c=!1)=>{const f=c&&s,d=f?e:n;return u&&o.add(l),d.add(l)&&f&&s&&(r=e.order.length),l},cancel:l=>{n.remove(l),o.delete(l)},process:l=>{if(s){i=!0;return}if(s=!0,[e,n]=[n,e],n.clear(),r=e.order.length,r)for(let u=0;u<r;u++){const c=e.order[u];o.has(c)&&(a.schedule(c),t()),c(l)}s=!1,i&&(i=!1,a.process(l))}};return a}const Uy=["read","resolveKeyframes","update","preRender","render","postRender"],hae=40;function dI(t,e){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=Uy.reduce((f,d)=>(f[d]=dae(()=>n=!0),f),{}),o=f=>{i[f].process(s)},a=()=>{const f=performance.now();n=!1,s.delta=r?1e3/60:Math.max(Math.min(f-s.timestamp,hae),1),s.timestamp=f,s.isProcessing=!0,Uy.forEach(o),s.isProcessing=!1,n&&e&&(r=!1,t(a))},l=()=>{n=!0,r=!0,s.isProcessing||t(a)};return{schedule:Uy.reduce((f,d)=>{const h=i[d];return f[d]=(p,m=!1,g=!1)=>(n||l(),h.schedule(p,m,g)),f},{}),cancel:f=>Uy.forEach(d=>i[d].cancel(f)),state:s,steps:i}}const{schedule:V2,cancel:Yde}=dI(queueMicrotask,!1);function Wc(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}const hI=N.createContext({});let pI=!1;function pae(t,e,n,r,s){const{visualElement:i}=N.useContext(Fy),o=N.useContext(uI),a=N.useContext(jy),l=N.useContext(B2).reducedMotion,u=N.useRef();r=r||o.renderer,!u.current&&r&&(u.current=r(t,{visualState:e,parent:i,props:n,presenceContext:a,blockInitialAnimation:a?a.initial===!1:!1,reducedMotionConfig:l}));const c=u.current,f=N.useContext(hI);c&&!c.projection&&s&&(c.type==="html"||c.type==="svg")&&gae(u.current,n,s,f),N.useInsertionEffect(()=>{c&&c.update(n,a)});const d=N.useRef(!!(n[cI]&&!window.HandoffComplete));return j2(()=>{c&&(c.updateFeatures(),V2.render(c.render),d.current&&c.animationState&&c.animationState.animateChanges())}),N.useEffect(()=>{c&&(!d.current&&c.animationState&&c.animationState.animateChanges(),d.current&&(d.current=!1,pI||(pI=!0,queueMicrotask(mae))))}),c}function mae(){window.HandoffComplete=!0}function gae(t,e,n,r){const{layoutId:s,layout:i,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:u}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:mI(t.parent)),t.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||a&&Wc(a),visualElement:t,scheduleRender:()=>t.scheduleRender(),animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,layoutScroll:l,layoutRoot:u})}function mI(t){if(t)return t.options.allowProjection!==!1?t.projection:mI(t.parent)}function yae(t,e,n){return N.useCallback(r=>{r&&t.mount&&t.mount(r),e&&(r?e.mount(r):e.unmount()),n&&(typeof n=="function"?n(r):Wc(n)&&(n.current=r))},[e])}function Zh(t){return typeof t=="string"||Array.isArray(t)}function Vy(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const H2=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],z2=["initial",...H2];function Hy(t){return Vy(t.animate)||z2.some(e=>Zh(t[e]))}function gI(t){return!!(Hy(t)||t.variants)}function bae(t,e){if(Hy(t)){const{initial:n,animate:r}=t;return{initial:n===!1||Zh(n)?n:void 0,animate:Zh(r)?r:void 0}}return t.inherit!==!1?e:{}}function wae(t){const{initial:e,animate:n}=bae(t,N.useContext(Fy));return N.useMemo(()=>({initial:e,animate:n}),[yI(e),yI(n)])}function yI(t){return Array.isArray(t)?t.join(" "):t}const bI={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"]},Kc={};for(const t in bI)Kc[t]={isEnabled:e=>bI[t].some(n=>!!e[n])};function Aae(t){for(const e in t)Kc[e]={...Kc[e],...t[e]}}const $2=N.createContext({}),vae=Symbol.for("motionComponentSymbol"),Sn=t=>t;let qc=Sn,Ji=Sn;process.env.NODE_ENV!=="production"&&(qc=(t,e)=>{!t&&typeof console<"u"&&console.warn(e)},Ji=(t,e)=>{if(!t)throw new Error(e)});function xae({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:r,Component:s}){t&&Aae(t);function i(a,l){let u;const c={...N.useContext(B2),...a,layoutId:kae(a)},{isStatic:f}=c,d=wae(a),h=r(a,f);if(!f&&F2){Eae(c,t);const p=Cae(c);u=p.MeasureLayout,d.visualElement=pae(s,h,c,e,p.ProjectionNode)}return S.jsxs(Fy.Provider,{value:d,children:[u&&d.visualElement?S.jsx(u,{visualElement:d.visualElement,...c}):null,n(s,a,yae(h,d.visualElement,l),h,f,d.visualElement)]})}const o=N.forwardRef(i);return o[vae]=s,o}function kae({layoutId:t}){const e=N.useContext($2).id;return e&&t!==void 0?e+"-"+t:t}function Eae(t,e){const n=N.useContext(uI).strict;if(process.env.NODE_ENV!=="production"&&e&&n){const r="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?qc(!1,r):Ji(!1,r)}}function Cae(t){const{drag:e,layout:n}=Kc;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:e!=null&&e.isEnabled(t)||n!=null&&n.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function Sae(t){function e(r,s={}){return xae(t(r,s))}if(typeof Proxy>"u")return e;const n=new Map;return new Proxy(e,{get:(r,s)=>(n.has(s)||n.set(s,e(s)),n.get(s))})}const Tae=["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 G2(t){return typeof t!="string"||t.includes("-")?!1:!!(Tae.indexOf(t)>-1||/[A-Z]/u.test(t))}const zy={};function Dae(t){Object.assign(zy,t)}const ep=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Bl=new Set(ep);function wI(t,{layout:e,layoutId:n}){return Bl.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!zy[t]||t==="opacity")}const Pn=t=>!!(t&&t.getVelocity),Oae={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},_ae=ep.length;function Mae(t,{enableHardwareAcceleration:e=!0,allowTransformNone:n=!0},r,s){let i="";for(let o=0;o<_ae;o++){const a=ep[o];if(t[a]!==void 0){const l=Oae[a]||a;i+=`${l}(${t[a]}) `}}return e&&!t.z&&(i+="translateZ(0)"),i=i.trim(),s?i=s(t,r?"":i):n&&r&&(i="none"),i}const AI=t=>e=>typeof e=="string"&&e.startsWith(t),vI=AI("--"),Nae=AI("var(--"),W2=t=>Nae(t)?Rae.test(t.split("/*")[0].trim()):!1,Rae=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Pae=(t,e)=>e&&typeof t=="number"?e.transform(t):t,aa=(t,e,n)=>n>e?e:n<t?t:n,Qc={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},tp={...Qc,transform:t=>aa(0,1,t)},$y={...Qc,default:1},np=t=>Math.round(t*1e5)/1e5,K2=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,Iae=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,Lae=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;function rp(t){return typeof t=="string"}const sp=t=>({test:e=>rp(e)&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),la=sp("deg"),di=sp("%"),Ie=sp("px"),Bae=sp("vh"),Fae=sp("vw"),xI={...di,parse:t=>di.parse(t)/100,transform:t=>di.transform(t*100)},kI={...Qc,transform:Math.round},EI={borderWidth:Ie,borderTopWidth:Ie,borderRightWidth:Ie,borderBottomWidth:Ie,borderLeftWidth:Ie,borderRadius:Ie,radius:Ie,borderTopLeftRadius:Ie,borderTopRightRadius:Ie,borderBottomRightRadius:Ie,borderBottomLeftRadius:Ie,width:Ie,maxWidth:Ie,height:Ie,maxHeight:Ie,size:Ie,top:Ie,right:Ie,bottom:Ie,left:Ie,padding:Ie,paddingTop:Ie,paddingRight:Ie,paddingBottom:Ie,paddingLeft:Ie,margin:Ie,marginTop:Ie,marginRight:Ie,marginBottom:Ie,marginLeft:Ie,rotate:la,rotateX:la,rotateY:la,rotateZ:la,scale:$y,scaleX:$y,scaleY:$y,scaleZ:$y,skew:la,skewX:la,skewY:la,distance:Ie,translateX:Ie,translateY:Ie,translateZ:Ie,x:Ie,y:Ie,z:Ie,perspective:Ie,transformPerspective:Ie,opacity:tp,originX:xI,originY:xI,originZ:Ie,zIndex:kI,backgroundPositionX:Ie,backgroundPositionY:Ie,fillOpacity:tp,strokeOpacity:tp,numOctaves:kI};function q2(t,e,n,r){const{style:s,vars:i,transform:o,transformOrigin:a}=t;let l=!1,u=!1,c=!0;for(const f in e){const d=e[f];if(vI(f)){i[f]=d;continue}const h=EI[f],p=Pae(d,h);if(Bl.has(f)){if(l=!0,o[f]=p,!c)continue;d!==(h.default||0)&&(c=!1)}else f.startsWith("origin")?(u=!0,a[f]=p):s[f]=p}if(e.transform||(l||r?s.transform=Mae(t.transform,n,c,r):s.transform&&(s.transform="none")),u){const{originX:f="50%",originY:d="50%",originZ:h=0}=a;s.transformOrigin=`${f} ${d} ${h}`}}const Q2=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function CI(t,e,n){for(const r in e)!Pn(e[r])&&!wI(r,n)&&(t[r]=e[r])}function jae({transformTemplate:t},e,n){return N.useMemo(()=>{const r=Q2();return q2(r,e,{enableHardwareAcceleration:!n},t),Object.assign({},r.vars,r.style)},[e])}function Uae(t,e,n){const r=t.style||{},s={};return CI(s,r,t),Object.assign(s,jae(t,e,n)),s}function Vae(t,e,n){const r={},s=Uae(t,e,n);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=s,r}const Hae=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 Gy(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Hae.has(t)}let SI=t=>!Gy(t);function zae(t){t&&(SI=e=>e.startsWith("on")?!Gy(e):t(e))}try{zae(require("@emotion/is-prop-valid").default)}catch{}function $ae(t,e,n){const r={};for(const s in t)s==="values"&&typeof t.values=="object"||(SI(s)||n===!0&&Gy(s)||!e&&!Gy(s)||t.draggable&&s.startsWith("onDrag"))&&(r[s]=t[s]);return r}function TI(t,e,n){return typeof t=="string"?t:Ie.transform(e+n*t)}function Gae(t,e,n){const r=TI(e,t.x,t.width),s=TI(n,t.y,t.height);return`${r} ${s}`}const Wae={offset:"stroke-dashoffset",array:"stroke-dasharray"},Kae={offset:"strokeDashoffset",array:"strokeDasharray"};function qae(t,e,n=1,r=0,s=!0){t.pathLength=1;const i=s?Wae:Kae;t[i.offset]=Ie.transform(-r);const o=Ie.transform(e),a=Ie.transform(n);t[i.array]=`${o} ${a}`}function J2(t,{attrX:e,attrY:n,attrScale:r,originX:s,originY:i,pathLength:o,pathSpacing:a=1,pathOffset:l=0,...u},c,f,d){if(q2(t,u,c,d),f){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:h,style:p,dimensions:m}=t;h.transform&&(m&&(p.transform=h.transform),delete h.transform),m&&(s!==void 0||i!==void 0||p.transform)&&(p.transformOrigin=Gae(m,s!==void 0?s:.5,i!==void 0?i:.5)),e!==void 0&&(h.x=e),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),o!==void 0&&qae(h,o,a,l,!1)}const DI=()=>({...Q2(),attrs:{}}),Y2=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Qae(t,e,n,r){const s=N.useMemo(()=>{const i=DI();return J2(i,e,{enableHardwareAcceleration:!1},Y2(r),t.transformTemplate),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};CI(i,t.style,t),s.style={...i,...s.style}}return s}function Jae(t=!1){return(n,r,s,{latestValues:i},o)=>{const l=(G2(n)?Qae:Vae)(r,i,o,n),u=$ae(r,typeof n=="string",t),c=n!==N.Fragment?{...u,...l,ref:s}:{},{children:f}=r,d=N.useMemo(()=>Pn(f)?f.get():f,[f]);return N.createElement(n,{...c,children:d})}}function OI(t,{style:e,vars:n},r,s){Object.assign(t.style,e,s&&s.getProjectionStyles(r));for(const i in n)t.style.setProperty(i,n[i])}const _I=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 MI(t,e,n,r){OI(t,e,void 0,r);for(const s in e.attrs)t.setAttribute(_I.has(s)?s:U2(s),e.attrs[s])}function X2(t,e,n){var r;const{style:s}=t,i={};for(const o in s)(Pn(s[o])||e.style&&Pn(e.style[o])||wI(o,t)||((r=n==null?void 0:n.getValue(o))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(i[o]=s[o]);return i}function NI(t,e,n){const r=X2(t,e,n);for(const s in t)if(Pn(t[s])||Pn(e[s])){const i=ep.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=t[s]}return r}function RI(t){const e=[{},{}];return t==null||t.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function Z2(t,e,n,r){if(typeof e=="function"){const[s,i]=RI(r);e=e(n!==void 0?n:t.custom,s,i)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[s,i]=RI(r);e=e(n!==void 0?n:t.custom,s,i)}return e}function PI(t){const e=N.useRef(null);return e.current===null&&(e.current=t()),e.current}const ek=t=>Array.isArray(t),Yae=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),Xae=t=>ek(t)?t[t.length-1]||0:t;function Wy(t){const e=Pn(t)?t.get():t;return Yae(e)?e.toValue():e}function Zae({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:n},r,s,i){const o={latestValues:ele(r,s,i,t),renderState:e()};return n&&(o.mount=a=>n(r,a,o)),o}const II=t=>(e,n)=>{const r=N.useContext(Fy),s=N.useContext(jy),i=()=>Zae(t,e,r,s);return n?i():PI(i)};function ele(t,e,n,r){const s={},i=r(t,{});for(const d in i)s[d]=Wy(i[d]);let{initial:o,animate:a}=t;const l=Hy(t),u=gI(t);e&&u&&!l&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let c=n?n.initial===!1:!1;c=c||o===!1;const f=c?a:o;return f&&typeof f!="boolean"&&!Vy(f)&&(Array.isArray(f)?f:[f]).forEach(h=>{const p=Z2(t,h);if(!p)return;const{transitionEnd:m,transition:g,...y}=p;for(const v in y){let w=y[v];if(Array.isArray(w)){const A=c?w.length-1:0;w=w[A]}w!==null&&(s[v]=w)}for(const v in m)s[v]=m[v]}),s}const{schedule:pt,cancel:Yi,state:Tn,steps:tk}=dI(typeof requestAnimationFrame<"u"?requestAnimationFrame:Sn,!0),tle={useVisualState:II({scrapeMotionValuesFromProps:NI,createRenderState:DI,onMount:(t,e,{renderState:n,latestValues:r})=>{pt.read(()=>{try{n.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}}),pt.render(()=>{J2(n,r,{enableHardwareAcceleration:!1},Y2(e.tagName),t.transformTemplate),MI(e,n)})}})},nle={useVisualState:II({scrapeMotionValuesFromProps:X2,createRenderState:Q2})};function rle(t,{forwardMotionProps:e=!1},n,r){return{...G2(t)?tle:nle,preloadedFeatures:n,useRender:Jae(e),createVisualElement:r,Component:t}}function Xi(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}const LI=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function Ky(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const sle=t=>e=>LI(e)&&t(e,Ky(e));function Zi(t,e,n,r){return Xi(t,e,sle(n),r)}const ile=(t,e)=>n=>e(t(n)),eo=(...t)=>t.reduce(ile);function BI(t){let e=null;return()=>{const n=()=>{e=null};return e===null?(e=t,n):!1}}const FI=BI("dragHorizontal"),jI=BI("dragVertical");function UI(t){let e=!1;if(t==="y")e=jI();else if(t==="x")e=FI();else{const n=FI(),r=jI();n&&r?e=()=>{n(),r()}:(n&&n(),r&&r())}return e}function VI(){const t=UI(!0);return t?(t(),!1):!0}class ua{constructor(e){this.isMounted=!1,this.node=e}update(){}}function HI(t,e){const n=e?"pointerenter":"pointerleave",r=e?"onHoverStart":"onHoverEnd",s=(i,o)=>{if(i.pointerType==="touch"||VI())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e);const l=a[r];l&&pt.postRender(()=>l(i,o))};return Zi(t.current,n,s,{passive:!t.getProps()[r]})}class ole extends ua{mount(){this.unmount=eo(HI(this.node,!0),HI(this.node,!1))}unmount(){}}class ale extends ua{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=eo(Xi(this.node.current,"focus",()=>this.onFocus()),Xi(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const zI=(t,e)=>e?t===e?!0:zI(t,e.parentElement):!1;function nk(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,Ky(n))}class lle extends ua{constructor(){super(...arguments),this.removeStartListeners=Sn,this.removeEndListeners=Sn,this.removeAccessibleListeners=Sn,this.startPointerPress=(e,n)=>{if(this.isPressing)return;this.removeEndListeners();const r=this.node.getProps(),i=Zi(window,"pointerup",(a,l)=>{if(!this.checkPressEnd())return;const{onTap:u,onTapCancel:c,globalTapTarget:f}=this.node.getProps(),d=!f&&!zI(this.node.current,a.target)?c:u;d&&pt.update(()=>d(a,l))},{passive:!(r.onTap||r.onPointerUp)}),o=Zi(window,"pointercancel",(a,l)=>this.cancelPress(a,l),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=eo(i,o),this.startPress(e,n)},this.startAccessiblePress=()=>{const e=i=>{if(i.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||nk("up",(l,u)=>{const{onTap:c}=this.node.getProps();c&&pt.postRender(()=>c(l,u))})};this.removeEndListeners(),this.removeEndListeners=Xi(this.node.current,"keyup",o),nk("down",(a,l)=>{this.startPress(a,l)})},n=Xi(this.node.current,"keydown",e),r=()=>{this.isPressing&&nk("cancel",(i,o)=>this.cancelPress(i,o))},s=Xi(this.node.current,"blur",r);this.removeAccessibleListeners=eo(n,s)}}startPress(e,n){this.isPressing=!0;const{onTapStart:r,whileTap:s}=this.node.getProps();s&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),r&&pt.postRender(()=>r(e,n))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!VI()}cancelPress(e,n){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&pt.postRender(()=>r(e,n))}mount(){const e=this.node.getProps(),n=Zi(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),r=Xi(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=eo(n,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const rk=new WeakMap,sk=new WeakMap,ule=t=>{const e=rk.get(t.target);e&&e(t)},cle=t=>{t.forEach(ule)};function fle({root:t,...e}){const n=t||document;sk.has(n)||sk.set(n,{});const r=sk.get(n),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(cle,{root:t,...e})),r[s]}function dle(t,e,n){const r=fle(e);return rk.set(t,n),r.observe(t),()=>{rk.delete(t),r.unobserve(t)}}const hle={some:0,all:1};class ple extends ua{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=e,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:hle[s]},a=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,i&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:c,onViewportLeave:f}=this.node.getProps(),d=u?c:f;d&&d(l)};return dle(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(mle(e,n))&&this.startObserver()}unmount(){}}function mle({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const gle={inView:{Feature:ple},tap:{Feature:lle},focus:{Feature:ale},hover:{Feature:ole}};function $I(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}function qy(t,e,n){const r=t.getProps();return Z2(r,e,n!==void 0?n:r.custom,t)}const to=t=>t*1e3,no=t=>t/1e3,yle={type:"spring",stiffness:500,damping:25,restSpeed:10},ble=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),wle={type:"keyframes",duration:.8},Ale={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},vle=(t,{keyframes:e})=>e.length>2?wle:Bl.has(t)?t.startsWith("scale")?ble(e[1]):yle:Ale;function xle({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:o,repeatDelay:a,from:l,elapsed:u,...c}){return!!Object.keys(c).length}function ik(t,e){return t[e]||t.default||t}const kle=t=>t!==null;function Qy(t,{repeat:e,repeatType:n="loop"},r){const s=t.filter(kle),i=e&&n!=="loop"&&e%2===1?0:s.length-1;return!i||r===void 0?s[i]:r}let Jy;function Ele(){Jy=void 0}const ca={now:()=>(Jy===void 0&&ca.set(Tn.isProcessing||fae.useManualTiming?Tn.timestamp:performance.now()),Jy),set:t=>{Jy=t,queueMicrotask(Ele)}},GI=t=>/^0[^.\s]+$/u.test(t);function Cle(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||GI(t):!0}const WI=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),Sle=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Tle(t){const e=Sle.exec(t);if(!e)return[,];const[,n,r,s]=e;return[`--${n??r}`,s]}const Dle=4;function KI(t,e,n=1){Ji(n<=Dle,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[r,s]=Tle(t);if(!r)return;const i=window.getComputedStyle(e).getPropertyValue(r);if(i){const o=i.trim();return WI(o)?parseFloat(o):o}return W2(s)?KI(s,e,n+1):s}const Ole=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),qI=t=>t===Qc||t===Ie,QI=(t,e)=>parseFloat(t.split(", ")[e]),JI=(t,e)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/u);if(s)return QI(s[1],e);{const i=r.match(/^matrix\((.+)\)$/u);return i?QI(i[1],t):0}},_le=new Set(["x","y","z"]),Mle=ep.filter(t=>!_le.has(t));function Nle(t){const e=[];return Mle.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const Jc={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:JI(4,13),y:JI(5,14)};Jc.translateX=Jc.x,Jc.translateY=Jc.y;const YI=t=>e=>e.test(t),XI=[Qc,Ie,di,la,Fae,Bae,{test:t=>t==="auto",parse:t=>t}],ZI=t=>XI.find(YI(t)),Fl=new Set;let ok=!1,ak=!1;function e8(){if(ak){const t=Array.from(Fl).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const s=Nle(r);s.length&&(n.set(r,s),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,o])=>{var a;(a=r.getValue(i))===null||a===void 0||a.set(o)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}ak=!1,ok=!1,Fl.forEach(t=>t.complete()),Fl.clear()}function t8(){Fl.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(ak=!0)})}function Rle(){t8(),e8()}class lk{constructor(e,n,r,s,i,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Fl.add(this),ok||(ok=!0,pt.read(t8),pt.resolveKeyframes(e8))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:s}=this;for(let i=0;i<e.length;i++)if(e[i]===null)if(i===0){const o=s==null?void 0:s.get(),a=e[e.length-1];if(o!==void 0)e[0]=o;else if(r&&n){const l=r.readValue(n,a);l!=null&&(e[0]=l)}e[0]===void 0&&(e[0]=a),s&&o===void 0&&s.set(e[0])}else e[i]=e[i-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Fl.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Fl.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const uk=(t,e)=>n=>!!(rp(n)&&Lae.test(n)&&n.startsWith(t)||e&&Object.prototype.hasOwnProperty.call(n,e)),n8=(t,e,n)=>r=>{if(!rp(r))return r;const[s,i,o,a]=r.match(K2);return{[t]:parseFloat(s),[e]:parseFloat(i),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},Ple=t=>aa(0,255,t),ck={...Qc,transform:t=>Math.round(Ple(t))},jl={test:uk("rgb","red"),parse:n8("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+ck.transform(t)+", "+ck.transform(e)+", "+ck.transform(n)+", "+np(tp.transform(r))+")"};function Ile(t){let e="",n="",r="",s="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),s=t.substring(4,5),e+=e,n+=n,r+=r,s+=s),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const fk={test:uk("#"),parse:Ile,transform:jl.transform},Yc={test:uk("hsl","hue"),parse:n8("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+di.transform(np(e))+", "+di.transform(np(n))+", "+np(tp.transform(r))+")"},In={test:t=>jl.test(t)||fk.test(t)||Yc.test(t),parse:t=>jl.test(t)?jl.parse(t):Yc.test(t)?Yc.parse(t):fk.parse(t),transform:t=>rp(t)?t:t.hasOwnProperty("red")?jl.transform(t):Yc.transform(t)};function Lle(t){var e,n;return isNaN(t)&&rp(t)&&(((e=t.match(K2))===null||e===void 0?void 0:e.length)||0)+(((n=t.match(Iae))===null||n===void 0?void 0:n.length)||0)>0}const r8="number",s8="color",Ble="var",Fle="var(",i8="${}",jle=/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 ip(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const a=e.replace(jle,l=>(In.test(l)?(r.color.push(i),s.push(s8),n.push(In.parse(l))):l.startsWith(Fle)?(r.var.push(i),s.push(Ble),n.push(l)):(r.number.push(i),s.push(r8),n.push(parseFloat(l))),++i,i8)).split(i8);return{values:n,split:a,indexes:r,types:s}}function o8(t){return ip(t).values}function a8(t){const{split:e,types:n}=ip(t),r=e.length;return s=>{let i="";for(let o=0;o<r;o++)if(i+=e[o],s[o]!==void 0){const a=n[o];a===r8?i+=np(s[o]):a===s8?i+=In.transform(s[o]):i+=s[o]}return i}}const Ule=t=>typeof t=="number"?0:t;function Vle(t){const e=o8(t);return a8(t)(e.map(Ule))}const fa={test:Lle,parse:o8,createTransformer:a8,getAnimatableNone:Vle},Hle=new Set(["brightness","contrast","saturate","opacity"]);function zle(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(K2)||[];if(!r)return t;const s=n.replace(r,"");let i=Hle.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+s+")"}const $le=/\b([a-z-]*)\(.*?\)/gu,dk={...fa,getAnimatableNone:t=>{const e=t.match($le);return e?e.map(zle).join(" "):t}},Gle={...EI,color:In,backgroundColor:In,outlineColor:In,fill:In,stroke:In,borderColor:In,borderTopColor:In,borderRightColor:In,borderBottomColor:In,borderLeftColor:In,filter:dk,WebkitFilter:dk},hk=t=>Gle[t];function l8(t,e){let n=hk(t);return n!==dk&&(n=fa),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Wle=new Set(["auto","none","0"]);function Kle(t,e,n){let r=0,s;for(;r<t.length&&!s;){const i=t[r];typeof i=="string"&&!Wle.has(i)&&ip(i).values.length&&(s=t[r]),r++}if(s&&n)for(const i of e)t[i]=l8(n,s)}class u8 extends lk{constructor(e,n,r,s){super(e,n,r,s,s==null?void 0:s.owner,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:r}=this;if(!n.current)return;super.readKeyframes();for(let l=0;l<e.length;l++){let u=e[l];if(typeof u=="string"&&(u=u.trim(),W2(u))){const c=KI(u,n.current);c!==void 0&&(e[l]=c),l===e.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!Ole.has(r)||e.length!==2)return;const[s,i]=e,o=ZI(s),a=ZI(i);if(o!==a)if(qI(o)&&qI(a))for(let l=0;l<e.length;l++){const u=e[l];typeof u=="string"&&(e[l]=parseFloat(u))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let s=0;s<e.length;s++)Cle(e[s])&&r.push(s);r.length&&Kle(e,r,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:r}=this;if(!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Jc[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&e.getValue(r,s).jump(s,!1)}measureEndState(){var e;const{element:n,name:r,unresolvedKeyframes:s}=this;if(!n.current)return;const i=n.getValue(r);i&&i.jump(this.measuredOrigin,!1);const o=s.length-1,a=s[o];s[o]=Jc[r](n.measureViewportBox(),window.getComputedStyle(n.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),!((e=this.removedTransforms)===null||e===void 0)&&e.length&&this.removedTransforms.forEach(([l,u])=>{n.getValue(l).set(u)}),this.resolveNoneKeyframes()}}function c8(t){let e;return()=>(e===void 0&&(e=t()),e)}const f8=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(fa.test(t)||t==="0")&&!t.startsWith("url("));function qle(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function Qle(t,e,n,r){const s=t[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const i=t[t.length-1],o=f8(s,e),a=f8(i,e);return qc(o===a,`You are trying to animate ${e} from "${s}" to "${i}". ${s} is not an animatable value - to enable this animation set ${s} to a value animatable to ${i} via the \`style\` property.`),!o||!a?!1:qle(t)||n==="spring"&&r}class d8{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:o="loop",...a}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.options={autoplay:e,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:o,...a},this.updateFinishedPromise()}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&Rle(),this._resolved}onKeyframesResolved(e,n){this.hasAttemptedResolve=!0;const{name:r,type:s,velocity:i,delay:o,onComplete:a,onUpdate:l,isGenerator:u}=this.options;if(!u&&!Qle(e,r,s,i))if(o)this.options.duration=0;else{l==null||l(Qy(e,this.options,n)),a==null||a(),this.resolveFinishedPromise();return}const c=this.initPlayback(e,n);c!==!1&&(this._resolved={keyframes:e,finalKeyframe:n,...c},this.onPostResolved())}onPostResolved(){}then(e,n){return this.currentFinishedPromise.then(e,n)}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function h8(t,e){return e?t*(1e3/e):0}const Jle=5;function p8(t,e,n){const r=Math.max(e-Jle,0);return h8(n-t(r),e-r)}const pk=.001,Yle=.01,m8=10,Xle=.05,Zle=1;function eue({duration:t=800,bounce:e=.25,velocity:n=0,mass:r=1}){let s,i;qc(t<=to(m8),"Spring duration must be 10 seconds or less");let o=1-e;o=aa(Xle,Zle,o),t=aa(Yle,m8,no(t)),o<1?(s=u=>{const c=u*o,f=c*t,d=c-n,h=mk(u,o),p=Math.exp(-f);return pk-d/h*p},i=u=>{const f=u*o*t,d=f*n+n,h=Math.pow(o,2)*Math.pow(u,2)*t,p=Math.exp(-f),m=mk(Math.pow(u,2),o);return(-s(u)+pk>0?-1:1)*((d-h)*p)/m}):(s=u=>{const c=Math.exp(-u*t),f=(u-n)*t+1;return-pk+c*f},i=u=>{const c=Math.exp(-u*t),f=(n-u)*(t*t);return c*f});const a=5/t,l=nue(s,i,a);if(t=to(t),isNaN(l))return{stiffness:100,damping:10,duration:t};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:o*2*Math.sqrt(r*u),duration:t}}}const tue=12;function nue(t,e,n){let r=n;for(let s=1;s<tue;s++)r=r-t(r)/e(r);return r}function mk(t,e){return t*Math.sqrt(1-e*e)}const rue=["duration","bounce"],sue=["stiffness","damping","mass"];function g8(t,e){return e.some(n=>t[n]!==void 0)}function iue(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!g8(t,sue)&&g8(t,rue)){const n=eue(t);e={...e,...n,mass:1},e.isResolvedFromDuration=!0}return e}function y8({keyframes:t,restDelta:e,restSpeed:n,...r}){const s=t[0],i=t[t.length-1],o={done:!1,value:s},{stiffness:a,damping:l,mass:u,duration:c,velocity:f,isResolvedFromDuration:d}=iue({...r,velocity:-no(r.velocity||0)}),h=f||0,p=l/(2*Math.sqrt(a*u)),m=i-s,g=no(Math.sqrt(a/u)),y=Math.abs(m)<5;n||(n=y?.01:2),e||(e=y?.005:.5);let v;if(p<1){const w=mk(g,p);v=A=>{const x=Math.exp(-p*g*A);return i-x*((h+p*g*m)/w*Math.sin(w*A)+m*Math.cos(w*A))}}else if(p===1)v=w=>i-Math.exp(-g*w)*(m+(h+g*m)*w);else{const w=g*Math.sqrt(p*p-1);v=A=>{const x=Math.exp(-p*g*A),k=Math.min(w*A,300);return i-x*((h+p*g*m)*Math.sinh(k)+w*m*Math.cosh(k))/w}}return{calculatedDuration:d&&c||null,next:w=>{const A=v(w);if(d)o.done=w>=c;else{let x=h;w!==0&&(p<1?x=p8(v,w,A):x=0);const k=Math.abs(x)<=n,C=Math.abs(i-A)<=e;o.done=k&&C}return o.value=o.done?i:A,o}}}function b8({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:a,max:l,restDelta:u=.5,restSpeed:c}){const f=t[0],d={done:!1,value:f},h=O=>a!==void 0&&O<a||l!==void 0&&O>l,p=O=>a===void 0?l:l===void 0||Math.abs(a-O)<Math.abs(l-O)?a:l;let m=n*e;const g=f+m,y=o===void 0?g:o(g);y!==g&&(m=y-f);const v=O=>-m*Math.exp(-O/r),w=O=>y+v(O),A=O=>{const _=v(O),D=w(O);d.done=Math.abs(_)<=u,d.value=d.done?y:D};let x,k;const C=O=>{h(d.value)&&(x=O,k=y8({keyframes:[d.value,p(d.value)],velocity:p8(w,O,d.value),damping:s,stiffness:i,restDelta:u,restSpeed:c}))};return C(0),{calculatedDuration:null,next:O=>{let _=!1;return!k&&x===void 0&&(_=!0,A(O),C(O)),x!==void 0&&O>=x?k.next(O-x):(!_&&A(O),d)}}}const w8=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,oue=1e-7,aue=12;function lue(t,e,n,r,s){let i,o,a=0;do o=e+(n-e)/2,i=w8(o,r,s)-t,i>0?n=o:e=o;while(Math.abs(i)>oue&&++a<aue);return o}function op(t,e,n,r){if(t===e&&n===r)return Sn;const s=i=>lue(i,0,1,t,n);return i=>i===0||i===1?i:w8(s(i),e,r)}const uue=op(.42,0,1,1),cue=op(0,0,.58,1),A8=op(.42,0,.58,1),fue=t=>Array.isArray(t)&&typeof t[0]!="number",v8=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,x8=t=>e=>1-t(1-e),gk=t=>1-Math.sin(Math.acos(t)),k8=x8(gk),due=v8(gk),E8=op(.33,1.53,.69,.99),yk=x8(E8),hue=v8(yk),C8={linear:Sn,easeIn:uue,easeInOut:A8,easeOut:cue,circIn:gk,circInOut:due,circOut:k8,backIn:yk,backInOut:hue,backOut:E8,anticipate:t=>(t*=2)<1?.5*yk(t):.5*(2-Math.pow(2,-10*(t-1)))},S8=t=>{if(Array.isArray(t)){Ji(t.length===4,"Cubic bezier arrays must contain four numerical values.");const[e,n,r,s]=t;return op(e,n,r,s)}else if(typeof t=="string")return Ji(C8[t]!==void 0,`Invalid easing type '${t}'`),C8[t];return t},ap=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r},Bt=(t,e,n)=>t+(e-t)*n;function bk(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function pue({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let s=0,i=0,o=0;if(!e)s=i=o=n;else{const a=n<.5?n*(1+e):n+e-n*e,l=2*n-a;s=bk(l,a,t+1/3),i=bk(l,a,t),o=bk(l,a,t-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:r}}function Yy(t,e){return n=>n>0?e:t}const wk=(t,e,n)=>{const r=t*t,s=n*(e*e-r)+r;return s<0?0:Math.sqrt(s)},mue=[fk,jl,Yc],gue=t=>mue.find(e=>e.test(t));function T8(t){const e=gue(t);if(qc(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`),!e)return!1;let n=e.parse(t);return e===Yc&&(n=pue(n)),n}const D8=(t,e)=>{const n=T8(t),r=T8(e);if(!n||!r)return Yy(t,e);const s={...n};return i=>(s.red=wk(n.red,r.red,i),s.green=wk(n.green,r.green,i),s.blue=wk(n.blue,r.blue,i),s.alpha=Bt(n.alpha,r.alpha,i),jl.transform(s))},Ak=new Set(["none","hidden"]);function yue(t,e){return Ak.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function bue(t,e){return n=>Bt(t,e,n)}function vk(t){return typeof t=="number"?bue:typeof t=="string"?W2(t)?Yy:In.test(t)?D8:vue:Array.isArray(t)?O8:typeof t=="object"?In.test(t)?D8:wue:Yy}function O8(t,e){const n=[...t],r=n.length,s=t.map((i,o)=>vk(i)(i,e[o]));return i=>{for(let o=0;o<r;o++)n[o]=s[o](i);return n}}function wue(t,e){const n={...t,...e},r={};for(const s in n)t[s]!==void 0&&e[s]!==void 0&&(r[s]=vk(t[s])(t[s],e[s]));return s=>{for(const i in r)n[i]=r[i](s);return n}}function Aue(t,e){var n;const r=[],s={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const o=e.types[i],a=t.indexes[o][s[o]],l=(n=t.values[a])!==null&&n!==void 0?n:0;r[i]=l,s[o]++}return r}const vue=(t,e)=>{const n=fa.createTransformer(e),r=ip(t),s=ip(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?Ak.has(t)&&!s.values.length||Ak.has(e)&&!r.values.length?yue(t,e):eo(O8(Aue(r,s),s.values),n):(qc(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),Yy(t,e))};function _8(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?Bt(t,e,n):vk(t)(t,e)}function xue(t,e,n){const r=[],s=n||_8,i=t.length-1;for(let o=0;o<i;o++){let a=s(t[o],t[o+1]);if(e){const l=Array.isArray(e)?e[o]||Sn:e;a=eo(l,a)}r.push(a)}return r}function kue(t,e,{clamp:n=!0,ease:r,mixer:s}={}){const i=t.length;if(Ji(i===e.length,"Both input and output ranges must be the same length"),i===1)return()=>e[0];if(i===2&&t[0]===t[1])return()=>e[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=xue(e,r,s),a=o.length,l=u=>{let c=0;if(a>1)for(;c<t.length-2&&!(u<t[c+1]);c++);const f=ap(t[c],t[c+1],u);return o[c](f)};return n?u=>l(aa(t[0],t[i-1],u)):l}function Eue(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const s=ap(0,e,r);t.push(Bt(n,1,s))}}function Cue(t){const e=[0];return Eue(e,t.length-1),e}function Sue(t,e){return t.map(n=>n*e)}function Tue(t,e){return t.map(()=>e||A8).splice(0,t.length-1)}function Xy({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const s=fue(r)?r.map(S8):S8(r),i={done:!1,value:e[0]},o=Sue(n&&n.length===e.length?n:Cue(e),t),a=kue(o,e,{ease:Array.isArray(s)?s:Tue(e,s)});return{calculatedDuration:t,next:l=>(i.value=a(l),i.done=l>=t,i)}}const M8=2e4;function Due(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<M8;)e+=n,r=t.next(e);return e>=M8?1/0:e}const Oue=t=>{const e=({timestamp:n})=>t(n);return{start:()=>pt.update(e,!0),stop:()=>Yi(e),now:()=>Tn.isProcessing?Tn.timestamp:ca.now()}},_ue={decay:b8,inertia:b8,tween:Xy,keyframes:Xy,spring:y8},Mue=t=>t/100;class xk extends d8{constructor({KeyframeResolver:e=lk,...n}){super(n),this.holdTime=null,this.startTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:a}=this.options;a&&a()};const{name:r,motionValue:s,keyframes:i}=this.options,o=(a,l)=>this.onKeyframesResolved(a,l);r&&s&&s.owner?this.resolver=s.owner.resolveKeyframes(i,o,r,s):this.resolver=new e(i,o,r,s),this.resolver.scheduleResolve()}initPlayback(e){const{type:n="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:o=0}=this.options,a=_ue[n]||Xy;let l,u;a!==Xy&&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=eo(Mue,_8(e[0],e[1])),e=[0,100]);const c=a({...this.options,keyframes:e});i==="mirror"&&(u=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),c.calculatedDuration===null&&(c.calculatedDuration=Due(c));const{calculatedDuration:f}=c,d=f+s,h=d*(r+1)-s;return{generator:c,mirroredGenerator:u,mapPercentToKeyframes:l,calculatedDuration:f,resolvedDuration:d,totalDuration:h}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,n=!1){const{resolved:r}=this;if(!r){const{keyframes:O}=this.options;return{done:!0,value:O[O.length-1]}}const{finalKeyframe:s,generator:i,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:l,calculatedDuration:u,totalDuration:c,resolvedDuration:f}=r;if(this.startTime===null)return i.next(0);const{delay:d,repeat:h,repeatType:p,repeatDelay:m,onUpdate:g}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-c/this.speed,this.startTime)),n?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const y=this.currentTime-d*(this.speed>=0?1:-1),v=this.speed>=0?y<0:y>c;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=c);let w=this.currentTime,A=i;if(h){const O=Math.min(this.currentTime,c)/f;let _=Math.floor(O),D=O%1;!D&&O>=1&&(D=1),D===1&&_--,_=Math.min(_,h+1),!!(_%2)&&(p==="reverse"?(D=1-D,m&&(D-=m/f)):p==="mirror"&&(A=o)),w=aa(0,1,D)*f}const x=v?{done:!1,value:l[0]}:A.next(w);a&&(x.value=a(x.value));let{done:k}=x;!v&&u!==null&&(k=this.speed>=0?this.currentTime>=c:this.currentTime<=0);const C=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&k);return C&&s!==void 0&&(x.value=Qy(l,this.options,s)),g&&g(x.value),C&&this.finish(),x}get duration(){const{resolved:e}=this;return e?no(e.calculatedDuration):0}get time(){return no(this.currentTime)}set time(e){e=to(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=no(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=Oue,onPlay:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),n&&n();const r=this.driver.now();this.holdTime!==null?this.startTime=r-this.holdTime:(!this.startTime||this.state==="finished")&&(this.startTime=r),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const N8=t=>Array.isArray(t)&&typeof t[0]=="number";function R8(t){return!!(!t||typeof t=="string"&&t in kk||N8(t)||Array.isArray(t)&&t.every(R8))}const lp=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,kk={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:lp([0,.65,.55,1]),circOut:lp([.55,0,1,.45]),backIn:lp([.31,.01,.66,-.59]),backOut:lp([.33,1.53,.69,.99])};function Nue(t){return P8(t)||kk.easeOut}function P8(t){if(t)return N8(t)?lp(t):Array.isArray(t)?t.map(Nue):kk[t]}function Rue(t,e,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:o="loop",ease:a,times:l}={}){const u={[e]:n};l&&(u.offset=l);const c=P8(a);return Array.isArray(c)&&(u.easing=c),t.animate(u,{delay:r,duration:s,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"})}const Pue=c8(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Iue=new Set(["opacity","clipPath","filter","transform"]),Zy=10,Lue=2e4;function Bue(t){return t.type==="spring"||t.name==="backgroundColor"||!R8(t.ease)}function Fue(t,e){const n=new xk({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const s=[];let i=0;for(;!r.done&&i<Lue;)r=n.sample(i),s.push(r.value),i+=Zy;return{times:void 0,keyframes:s,duration:i-Zy,ease:"linear"}}class I8 extends d8{constructor(e){super(e);const{name:n,motionValue:r,keyframes:s}=this.options;this.resolver=new u8(s,(i,o)=>this.onKeyframesResolved(i,o),n,r),this.resolver.scheduleResolve()}initPlayback(e,n){var r;let{duration:s=300,times:i,ease:o,type:a,motionValue:l,name:u}=this.options;if(!(!((r=l.owner)===null||r===void 0)&&r.current))return!1;if(Bue(this.options)){const{onComplete:f,onUpdate:d,motionValue:h,...p}=this.options,m=Fue(e,p);e=m.keyframes,e.length===1&&(e[1]=e[0]),s=m.duration,i=m.times,o=m.ease,a="keyframes"}const c=Rue(l.owner.current,u,e,{...this.options,duration:s,times:i,ease:o});return c.startTime=ca.now(),this.pendingTimeline?(c.timeline=this.pendingTimeline,this.pendingTimeline=void 0):c.onfinish=()=>{const{onComplete:f}=this.options;l.set(Qy(e,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:c,duration:s,times:i,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:n}=e;return no(n)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:n}=e;return no(n.currentTime||0)}set time(e){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=to(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:n}=e;return n.playbackRate}set speed(e){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:n}=e;return n.playState}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:n}=this;if(!n)return Sn;const{animation:r}=n;r.timeline=e,r.onfinish=null}return Sn}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;const{resolved:e}=this;if(!e)return;const{animation:n,keyframes:r,duration:s,type:i,ease:o,times:a}=e;if(!(n.playState==="idle"||n.playState==="finished")){if(this.time){const{motionValue:l,onUpdate:u,onComplete:c,...f}=this.options,d=new xk({...f,keyframes:r,duration:s,type:i,ease:o,times:a,isGenerator:!0}),h=to(this.time);l.setWithVelocity(d.sample(h-Zy).value,d.sample(h).value,Zy)}this.cancel()}}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:n,name:r,repeatDelay:s,repeatType:i,damping:o,type:a}=e;return Pue()&&r&&Iue.has(r)&&n&&n.owner&&n.owner.current instanceof HTMLElement&&!n.owner.getProps().onUpdate&&!s&&i!=="mirror"&&o!==0&&a!=="inertia"}}function jue(t,e){let n;const r=()=>{const{currentTime:s}=e,o=(s===null?0:s.value)/100;n!==o&&t(o),n=o};return pt.update(r,!0),()=>Yi(r)}const Uue=c8(()=>window.ScrollTimeline!==void 0);class Vue{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,n){return Promise.all(this.animations).then(e).catch(n)}getAll(e){return this.animations[0][e]}setAll(e,n){for(let r=0;r<this.animations.length;r++)this.animations[r][e]=n}attachTimeline(e){const n=this.animations.map(r=>{if(Uue()&&r.attachTimeline)r.attachTimeline(e);else return r.pause(),jue(s=>{r.time=r.duration*s},e)});return()=>{n.forEach((r,s)=>{r&&r(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get duration(){let e=0;for(let n=0;n<this.animations.length;n++)e=Math.max(e,this.animations[n].duration);return e}runAll(e){this.animations.forEach(n=>n[e]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const Ek=(t,e,n,r={},s,i)=>o=>{const a=ik(r,t)||{},l=a.delay||r.delay||0;let{elapsed:u=0}=r;u=u-to(l);let c={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-u,onUpdate:d=>{e.set(d),a.onUpdate&&a.onUpdate(d)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:i?void 0:s};xle(a)||(c={...c,...vle(t,c)}),c.duration&&(c.duration=to(c.duration)),c.repeatDelay&&(c.repeatDelay=to(c.repeatDelay)),c.from!==void 0&&(c.keyframes[0]=c.from);let f=!1;if((c.type===!1||c.duration===0&&!c.repeatDelay)&&(c.duration=0,c.delay===0&&(f=!0)),f&&!i&&e.get()!==void 0){const d=Qy(c.keyframes,a);if(d!==void 0)return pt.update(()=>{c.onUpdate(d),c.onComplete()}),new Vue([])}return!i&&I8.supports(c)?new I8(c):new xk(c)};function eb(t){return!!(Pn(t)&&t.add)}function Ck(t,e){t.indexOf(e)===-1&&t.push(e)}function Sk(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class Tk{constructor(){this.subscriptions=[]}add(e){return Ck(this.subscriptions,e),()=>Sk(this.subscriptions,e)}notify(e,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,n,r);else for(let i=0;i<s;i++){const o=this.subscriptions[i];o&&o(e,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const L8=new Set;function Dk(t,e,n){t||L8.has(e)||(console.warn(e),L8.add(e))}const B8=30,Hue=t=>!isNaN(parseFloat(t));class zue{constructor(e,n={}){this.version="11.2.12",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{const i=ca.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),s&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=ca.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Hue(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&Dk(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new Tk);const r=this.events[e].add(n);return e==="change"?()=>{r(),pt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e,n=!0){!n||!this.passiveEffect?this.updateAndNotify(e,n):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=ca.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>B8)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,B8);return h8(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function up(t,e){return new zue(t,e)}function $ue(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,up(n))}function Gue(t,e){const n=qy(t,e);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const o in i){const a=Xae(i[o]);$ue(t,o,a)}}function F8(t){return t.getProps()[cI]}function Wue({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function j8(t,e,{delay:n=0,transitionOverride:r,type:s}={}){var i;let{transition:o=t.getDefaultTransition(),transitionEnd:a,...l}=e;const u=t.getValue("willChange");r&&(o=r);const c=[],f=s&&t.animationState&&t.animationState.getState()[s];for(const d in l){const h=t.getValue(d,(i=t.latestValues[d])!==null&&i!==void 0?i:null),p=l[d];if(p===void 0||f&&Wue(f,d))continue;const m={delay:n,elapsed:0,...ik(o||{},d)};let g=!1;if(window.HandoffAppearAnimations){const v=F8(t);if(v){const w=window.HandoffAppearAnimations(v,d,h,pt);w!==null&&(m.elapsed=w,g=!0)}}h.start(Ek(d,h,p,t.shouldReduceMotion&&Bl.has(d)?{type:!1}:m,t,g));const y=h.animation;y&&(eb(u)&&(u.add(d),y.then(()=>u.remove(d))),c.push(y))}return a&&Promise.all(c).then(()=>{pt.update(()=>{a&&Gue(t,a)})}),c}function Ok(t,e,n={}){var r;const s=qy(t,e,n.type==="exit"?(r=t.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:i=t.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const o=s?()=>Promise.all(j8(t,s,n)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(u=0)=>{const{delayChildren:c=0,staggerChildren:f,staggerDirection:d}=i;return Kue(t,e,c+u,f,d,n)}:()=>Promise.resolve(),{when:l}=i;if(l){const[u,c]=l==="beforeChildren"?[o,a]:[a,o];return u().then(()=>c())}else return Promise.all([o(),a(n.delay)])}function Kue(t,e,n=0,r=0,s=1,i){const o=[],a=(t.variantChildren.size-1)*r,l=s===1?(u=0)=>u*r:(u=0)=>a-u*r;return Array.from(t.variantChildren).sort(que).forEach((u,c)=>{u.notify("AnimationStart",e),o.push(Ok(u,e,{...i,delay:n+l(c)}).then(()=>u.notify("AnimationComplete",e)))}),Promise.all(o)}function que(t,e){return t.sortNodePosition(e)}function Que(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const s=e.map(i=>Ok(t,i,n));r=Promise.all(s)}else if(typeof e=="string")r=Ok(t,e,n);else{const s=typeof e=="function"?qy(t,e,n.custom):e;r=Promise.all(j8(t,s,n))}return r.then(()=>{pt.postRender(()=>{t.notify("AnimationComplete",e)})})}const Jue=[...H2].reverse(),Yue=H2.length;function Xue(t){return e=>Promise.all(e.map(({animation:n,options:r})=>Que(t,n,r)))}function Zue(t){let e=Xue(t),n=U8(),r=!0;const s=l=>(u,c)=>{var f;const d=qy(t,c,l==="exit"?(f=t.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(d){const{transition:h,transitionEnd:p,...m}=d;u={...u,...m,...p}}return u};function i(l){e=l(t)}function o(l){const u=t.getProps(),c=t.getVariantContext(!0)||{},f=[],d=new Set;let h={},p=1/0;for(let g=0;g<Yue;g++){const y=Jue[g],v=n[y],w=u[y]!==void 0?u[y]:c[y],A=Zh(w),x=y===l?v.isActive:null;x===!1&&(p=g);let k=w===c[y]&&w!==u[y]&&A;if(k&&r&&t.manuallyAnimateOnMount&&(k=!1),v.protectedKeys={...h},!v.isActive&&x===null||!w&&!v.prevProp||Vy(w)||typeof w=="boolean")continue;let O=ece(v.prevProp,w)||y===l&&v.isActive&&!k&&A||g>p&&A,_=!1;const D=Array.isArray(w)?w:[w];let R=D.reduce(s(y),{});x===!1&&(R={});const{prevResolvedValues:L={}}=v,F={...L,...R},G=B=>{O=!0,d.has(B)&&(_=!0,d.delete(B)),v.needsAnimating[B]=!0;const H=t.getValue(B);H&&(H.liveStyle=!1)};for(const B in F){const H=R[B],Q=L[B];if(h.hasOwnProperty(B))continue;let te=!1;ek(H)&&ek(Q)?te=!$I(H,Q):te=H!==Q,te?H!=null?G(B):d.add(B):H!==void 0&&d.has(B)?G(B):v.protectedKeys[B]=!0}v.prevProp=w,v.prevResolvedValues=R,v.isActive&&(h={...h,...R}),r&&t.blockInitialAnimation&&(O=!1),O&&(!k||_)&&f.push(...D.map(B=>({animation:B,options:{type:y}})))}if(d.size){const g={};d.forEach(y=>{const v=t.getBaseTarget(y),w=t.getValue(y);w&&(w.liveStyle=!0),g[y]=v??null}),f.push({animation:g})}let m=!!f.length;return r&&(u.initial===!1||u.initial===u.animate)&&!t.manuallyAnimateOnMount&&(m=!1),r=!1,m?e(f):Promise.resolve()}function a(l,u){var c;if(n[l].isActive===u)return Promise.resolve();(c=t.variantChildren)===null||c===void 0||c.forEach(d=>{var h;return(h=d.animationState)===null||h===void 0?void 0:h.setActive(l,u)}),n[l].isActive=u;const f=o(l);for(const d in n)n[d].protectedKeys={};return f}return{animateChanges:o,setActive:a,setAnimateFunction:i,getState:()=>n,reset:()=>{n=U8(),r=!0}}}function ece(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!$I(e,t):!1}function Ul(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function U8(){return{animate:Ul(!0),whileInView:Ul(),whileHover:Ul(),whileTap:Ul(),whileDrag:Ul(),whileFocus:Ul(),exit:Ul()}}class tce extends ua{constructor(e){super(e),e.animationState||(e.animationState=Zue(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Vy(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let nce=0;class rce extends ua{constructor(){super(...arguments),this.id=nce++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const s=this.node.animationState.setActive("exit",!e);n&&!e&&s.then(()=>n(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const sce={animation:{Feature:tce},exit:{Feature:rce}},V8=(t,e)=>Math.abs(t-e);function ice(t,e){const n=V8(t.x,e.x),r=V8(t.y,e.y);return Math.sqrt(n**2+r**2)}class H8{constructor(e,n,{transformPagePoint:r,contextWindow:s,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=Mk(this.lastMoveEventInfo,this.history),d=this.startEvent!==null,h=ice(f.offset,{x:0,y:0})>=3;if(!d&&!h)return;const{point:p}=f,{timestamp:m}=Tn;this.history.push({...p,timestamp:m});const{onStart:g,onMove:y}=this.handlers;d||(g&&g(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),y&&y(this.lastMoveEvent,f)},this.handlePointerMove=(f,d)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=_k(d,this.transformPagePoint),pt.update(this.updatePoint,!0)},this.handlePointerUp=(f,d)=>{this.end();const{onEnd:h,onSessionEnd:p,resumeAnimation:m}=this.handlers;if(this.dragSnapToOrigin&&m&&m(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const g=Mk(f.type==="pointercancel"?this.lastMoveEventInfo:_k(d,this.transformPagePoint),this.history);this.startEvent&&h&&h(f,g),p&&p(f,g)},!LI(e))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.contextWindow=s||window;const o=Ky(e),a=_k(o,this.transformPagePoint),{point:l}=a,{timestamp:u}=Tn;this.history=[{...l,timestamp:u}];const{onSessionStart:c}=n;c&&c(e,Mk(a,this.history)),this.removeListeners=eo(Zi(this.contextWindow,"pointermove",this.handlePointerMove),Zi(this.contextWindow,"pointerup",this.handlePointerUp),Zi(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Yi(this.updatePoint)}}function _k(t,e){return e?{point:e(t.point)}:t}function z8(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Mk({point:t},e){return{point:t,delta:z8(t,$8(e)),offset:z8(t,oce(e)),velocity:ace(e,.1)}}function oce(t){return t[0]}function $8(t){return t[t.length-1]}function ace(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const s=$8(t);for(;n>=0&&(r=t[n],!(s.timestamp-r.timestamp>to(e)));)n--;if(!r)return{x:0,y:0};const i=no(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const o={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function Pr(t){return t.max-t.min}function Nk(t,e=0,n=.01){return Math.abs(t-e)<=n}function G8(t,e,n,r=.5){t.origin=r,t.originPoint=Bt(e.min,e.max,t.origin),t.scale=Pr(n)/Pr(e),(Nk(t.scale,1,1e-4)||isNaN(t.scale))&&(t.scale=1),t.translate=Bt(n.min,n.max,t.origin)-t.originPoint,(Nk(t.translate)||isNaN(t.translate))&&(t.translate=0)}function cp(t,e,n,r){G8(t.x,e.x,n.x,r?r.originX:void 0),G8(t.y,e.y,n.y,r?r.originY:void 0)}function W8(t,e,n){t.min=n.min+e.min,t.max=t.min+Pr(e)}function lce(t,e,n){W8(t.x,e.x,n.x),W8(t.y,e.y,n.y)}function K8(t,e,n){t.min=e.min-n.min,t.max=t.min+Pr(e)}function fp(t,e,n){K8(t.x,e.x,n.x),K8(t.y,e.y,n.y)}function uce(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?Bt(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?Bt(n,t,r.max):Math.min(t,n)),t}function q8(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function cce(t,{top:e,left:n,bottom:r,right:s}){return{x:q8(t.x,n,s),y:q8(t.y,e,r)}}function Q8(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}function fce(t,e){return{x:Q8(t.x,e.x),y:Q8(t.y,e.y)}}function dce(t,e){let n=.5;const r=Pr(t),s=Pr(e);return s>r?n=ap(e.min,e.max-r,t.min):r>s&&(n=ap(t.min,t.max-s,e.min)),aa(0,1,n)}function hce(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const Rk=.35;function pce(t=Rk){return t===!1?t=0:t===!0&&(t=Rk),{x:J8(t,"left","right"),y:J8(t,"top","bottom")}}function J8(t,e,n){return{min:Y8(t,e),max:Y8(t,n)}}function Y8(t,e){return typeof t=="number"?t:t[e]||0}const X8=()=>({translate:0,scale:1,origin:0,originPoint:0}),Xc=()=>({x:X8(),y:X8()}),Z8=()=>({min:0,max:0}),qt=()=>({x:Z8(),y:Z8()});function es(t){return[t("x"),t("y")]}function eL({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function mce({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function gce(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Pk(t){return t===void 0||t===1}function Ik({scale:t,scaleX:e,scaleY:n}){return!Pk(t)||!Pk(e)||!Pk(n)}function Vl(t){return Ik(t)||tL(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function tL(t){return nL(t.x)||nL(t.y)}function nL(t){return t&&t!=="0%"}function tb(t,e,n){const r=t-n,s=e*r;return n+s}function rL(t,e,n,r,s){return s!==void 0&&(t=tb(t,s,r)),tb(t,n,r)+e}function Lk(t,e=0,n=1,r,s){t.min=rL(t.min,e,n,r,s),t.max=rL(t.max,e,n,r,s)}function sL(t,{x:e,y:n}){Lk(t.x,e.translate,e.scale,e.originPoint),Lk(t.y,n.translate,n.scale,n.originPoint)}function yce(t,e,n,r=!1){const s=n.length;if(!s)return;e.x=e.y=1;let i,o;for(let a=0;a<s;a++){i=n[a],o=i.projectionDelta;const l=i.instance;l&&l.style&&l.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&Zc(t,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,sL(t,o)),r&&Vl(i.latestValues)&&Zc(t,i.latestValues))}e.x=iL(e.x),e.y=iL(e.y)}function iL(t){return Number.isInteger(t)||t>1.0000000000001||t<.999999999999?t:1}function da(t,e){t.min=t.min+e,t.max=t.max+e}function oL(t,e,[n,r,s]){const i=e[s]!==void 0?e[s]:.5,o=Bt(t.min,t.max,i);Lk(t,e[n],e[r],o,e.scale)}const bce=["x","scaleX","originX"],wce=["y","scaleY","originY"];function Zc(t,e){oL(t.x,e,bce),oL(t.y,e,wce)}function aL(t,e){return eL(gce(t.getBoundingClientRect(),e))}function Ace(t,e,n){const r=aL(t,n),{scroll:s}=e;return s&&(da(r.x,s.offset.x),da(r.y,s.offset.y)),r}const lL=({current:t})=>t?t.ownerDocument.defaultView:null,vce=new WeakMap;class xce{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=qt(),this.visualElement=e}start(e,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=c=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Ky(c,"page").point)},i=(c,f)=>{const{drag:d,dragPropagation:h,onDragStart:p}=this.getProps();if(d&&!h&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=UI(d),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),es(g=>{let y=this.getAxisMotionValue(g).get()||0;if(di.test(y)){const{projection:v}=this.visualElement;if(v&&v.layout){const w=v.layout.layoutBox[g];w&&(y=Pr(w)*(parseFloat(y)/100))}}this.originPoint[g]=y}),p&&pt.postRender(()=>p(c,f));const{animationState:m}=this.visualElement;m&&m.setActive("whileDrag",!0)},o=(c,f)=>{const{dragPropagation:d,dragDirectionLock:h,onDirectionLock:p,onDrag:m}=this.getProps();if(!d&&!this.openGlobalLock)return;const{offset:g}=f;if(h&&this.currentDirection===null){this.currentDirection=kce(g),this.currentDirection!==null&&p&&p(this.currentDirection);return}this.updateAxis("x",f.point,g),this.updateAxis("y",f.point,g),this.visualElement.render(),m&&m(c,f)},a=(c,f)=>this.stop(c,f),l=()=>es(c=>{var f;return this.getAnimationState(c)==="paused"&&((f=this.getAxisMotionValue(c).animation)===null||f===void 0?void 0:f.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new H8(e,{onSessionStart:s,onStart:i,onMove:o,onSessionEnd:a,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:lL(this.visualElement)})}stop(e,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=n;this.startAnimation(s);const{onDragEnd:i}=this.getProps();i&&pt.postRender(()=>i(e,n))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,r){const{drag:s}=this.getProps();if(!r||!nb(e,s,this.currentDirection))return;const i=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=uce(o,this.constraints[e],this.elastic[e])),i.set(o)}resolveConstraints(){var e;const{dragConstraints:n,dragElastic:r}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,i=this.constraints;n&&Wc(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&s?this.constraints=cce(s.layoutBox,n):this.constraints=!1,this.elastic=pce(r),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&es(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=hce(s.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!Wc(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=Ace(r,s.root,this.visualElement.getTransformPagePoint());let o=fce(s.layout.layoutBox,i);if(n){const a=n(mce(o));this.hasMutatedConstraints=!!a,a&&(o=eL(a))}return o}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},u=es(c=>{if(!nb(c,n,this.currentDirection))return;let f=l&&l[c]||{};o&&(f={min:0,max:0});const d=s?200:1e6,h=s?40:1e7,p={type:"inertia",velocity:r?e[c]:0,bounceStiffness:d,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...i,...f};return this.startAxisValueAnimation(c,p)});return Promise.all(u).then(a)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return r.start(Ek(e,r,0,n,this.visualElement))}stopAnimation(){es(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){es(e=>{var n;return(n=this.getAxisMotionValue(e).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(e){var n;return(n=this.getAxisMotionValue(e).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){es(n=>{const{drag:r}=this.getProps();if(!nb(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:o,max:a}=s.layout.layoutBox[n];i.set(e[n]-Bt(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Wc(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};es(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const l=a.get();s[o]=dce({min:l,max:l},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),es(o=>{if(!nb(o,e,null))return;const a=this.getAxisMotionValue(o),{min:l,max:u}=this.constraints[o];a.set(Bt(l,u,s[o]))})}addListeners(){if(!this.visualElement.current)return;vce.set(this.visualElement,this);const e=this.visualElement.current,n=Zi(e,"pointerdown",l=>{const{drag:u,dragListener:c=!0}=this.getProps();u&&c&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();Wc(l)&&l.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),pt.read(r);const o=Xi(window,"resize",()=>this.scalePositionWithinConstraints()),a=s.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(es(c=>{const f=this.getAxisMotionValue(c);f&&(this.originPoint[c]+=l[c].translate,f.set(f.get()+l[c].translate))}),this.visualElement.render())});return()=>{o(),n(),i(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=Rk,dragMomentum:a=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:a}}}function nb(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function kce(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class Ece extends ua{constructor(e){super(e),this.removeGroupControls=Sn,this.removeListeners=Sn,this.controls=new xce(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Sn}unmount(){this.removeGroupControls(),this.removeListeners()}}const uL=t=>(e,n)=>{t&&pt.postRender(()=>t(e,n))};class Cce extends ua{constructor(){super(...arguments),this.removePointerDownListener=Sn}onPointerDown(e){this.session=new H8(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:lL(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:uL(e),onStart:uL(n),onMove:r,onEnd:(i,o)=>{delete this.session,s&&pt.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=Zi(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 Sce(){const t=N.useContext(jy);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:n,register:r}=t,s=N.useId();return N.useEffect(()=>r(s),[]),!e&&n?[!1,()=>n&&n(s)]:[!0]}const rb={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function cL(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const dp={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(Ie.test(t))t=parseFloat(t);else return t;const n=cL(t,e.target.x),r=cL(t,e.target.y);return`${n}% ${r}%`}},Tce={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,s=fa.parse(t);if(s.length>5)return r;const i=fa.createTransformer(t),o=typeof s[0]!="number"?1:0,a=n.x.scale*e.x,l=n.y.scale*e.y;s[0+o]/=a,s[1+o]/=l;const u=Bt(a,l,.5);return typeof s[2+o]=="number"&&(s[2+o]/=u),typeof s[3+o]=="number"&&(s[3+o]/=u),i(s)}};class Dce extends N.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=e;Dae(Oce),i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),rb.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,o=r.projection;return o&&(o.isPresent=i,s||e.layoutDependency!==n||n===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?o.promote():o.relegate()||pt.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),V2.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=e;s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function fL(t){const[e,n]=Sce(),r=N.useContext($2);return S.jsx(Dce,{...t,layoutGroup:r,switchLayoutGroup:N.useContext(hI),isPresent:e,safeToRemove:n})}const Oce={borderRadius:{...dp,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:dp,borderTopRightRadius:dp,borderBottomLeftRadius:dp,borderBottomRightRadius:dp,boxShadow:Tce},dL=["TopLeft","TopRight","BottomLeft","BottomRight"],_ce=dL.length,hL=t=>typeof t=="string"?parseFloat(t):t,pL=t=>typeof t=="number"||Ie.test(t);function Mce(t,e,n,r,s,i){s?(t.opacity=Bt(0,n.opacity!==void 0?n.opacity:1,Nce(r)),t.opacityExit=Bt(e.opacity!==void 0?e.opacity:1,0,Rce(r))):i&&(t.opacity=Bt(e.opacity!==void 0?e.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let o=0;o<_ce;o++){const a=`border${dL[o]}Radius`;let l=mL(e,a),u=mL(n,a);if(l===void 0&&u===void 0)continue;l||(l=0),u||(u=0),l===0||u===0||pL(l)===pL(u)?(t[a]=Math.max(Bt(hL(l),hL(u),r),0),(di.test(u)||di.test(l))&&(t[a]+="%")):t[a]=u}(e.rotate||n.rotate)&&(t.rotate=Bt(e.rotate||0,n.rotate||0,r))}function mL(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const Nce=gL(0,.5,k8),Rce=gL(.5,.95,Sn);function gL(t,e,n){return r=>r<t?0:r>e?1:n(ap(t,e,r))}function yL(t,e){t.min=e.min,t.max=e.max}function ts(t,e){yL(t.x,e.x),yL(t.y,e.y)}function bL(t,e,n,r,s){return t-=e,t=tb(t,1/n,r),s!==void 0&&(t=tb(t,1/s,r)),t}function Pce(t,e=0,n=1,r=.5,s,i=t,o=t){if(di.test(e)&&(e=parseFloat(e),e=Bt(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Bt(i.min,i.max,r);t===i&&(a-=e),t.min=bL(t.min,e,n,a,s),t.max=bL(t.max,e,n,a,s)}function wL(t,e,[n,r,s],i,o){Pce(t,e[n],e[r],e[s],e.scale,i,o)}const Ice=["x","scaleX","originX"],Lce=["y","scaleY","originY"];function AL(t,e,n,r){wL(t.x,e,Ice,n?n.x:void 0,r?r.x:void 0),wL(t.y,e,Lce,n?n.y:void 0,r?r.y:void 0)}function vL(t){return t.translate===0&&t.scale===1}function xL(t){return vL(t.x)&&vL(t.y)}function Bce(t,e){return t.x.min===e.x.min&&t.x.max===e.x.max&&t.y.min===e.y.min&&t.y.max===e.y.max}function kL(t,e){return Math.round(t.x.min)===Math.round(e.x.min)&&Math.round(t.x.max)===Math.round(e.x.max)&&Math.round(t.y.min)===Math.round(e.y.min)&&Math.round(t.y.max)===Math.round(e.y.max)}function EL(t){return Pr(t.x)/Pr(t.y)}class Fce{constructor(){this.members=[]}add(e){Ck(this.members,e),e.scheduleRender()}remove(e){if(Sk(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(s=>e===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(e,n){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender(),e.resumeFrom=r,n&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:s}=e.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:r}=e;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function CL(t,e,n){let r="";const s=t.x.translate/e.x,i=t.y.translate/e.y,o=(n==null?void 0:n.z)||0;if((s||i||o)&&(r=`translate3d(${s}px, ${i}px, ${o}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:u,rotate:c,rotateX:f,rotateY:d,skewX:h,skewY:p}=n;u&&(r=`perspective(${u}px) ${r}`),c&&(r+=`rotate(${c}deg) `),f&&(r+=`rotateX(${f}deg) `),d&&(r+=`rotateY(${d}deg) `),h&&(r+=`skewX(${h}deg) `),p&&(r+=`skewY(${p}deg) `)}const a=t.x.scale*e.x,l=t.y.scale*e.y;return(a!==1||l!==1)&&(r+=`scale(${a}, ${l})`),r||"none"}const jce=(t,e)=>t.depth-e.depth;class Uce{constructor(){this.children=[],this.isDirty=!1}add(e){Ck(this.children,e),this.isDirty=!0}remove(e){Sk(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(jce),this.isDirty=!1,this.children.forEach(e)}}function Vce(t,e){const n=ca.now(),r=({timestamp:s})=>{const i=s-n;i>=e&&(Yi(r),t(i-e))};return pt.read(r,!0),()=>Yi(r)}function Hce(t){window.MotionDebug&&window.MotionDebug.record(t)}function zce(t){return t instanceof SVGElement&&t.tagName!=="svg"}function $ce(t,e,n){const r=Pn(t)?t:up(t);return r.start(Ek("",r,e,n)),r.animation}const Bk=["","X","Y","Z"],Gce={visibility:"hidden"},SL=1e3;let Wce=0;const Hl={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function Fk(t,e,n,r){const{latestValues:s}=e;s[t]&&(n[t]=s[t],e.setStaticValue(t,0),r&&(r[t]=0))}function TL(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return!1;const{visualElement:e}=t.options;return e?F8(e)?!0:t.parent&&!t.parent.hasCheckedOptimisedAppear?TL(t.parent):!1:!1}function DL({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},a=e==null?void 0:e()){this.id=Wce++,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,Hl.totalNodes=Hl.resolvedTargetDeltas=Hl.recalculatedProjection=0,this.nodes.forEach(Qce),this.nodes.forEach(efe),this.nodes.forEach(tfe),this.nodes.forEach(Jce),Hce(Hl)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new Uce)}addEventListener(o,a){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new Tk),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=zce(o),this.instance=o;const{layoutId:l,layout:u,visualElement:c}=this.options;if(c&&!c.current&&c.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),a&&(u||l)&&(this.isLayoutDirty=!0),t){let f;const d=()=>this.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=Vce(d,250),rb.hasAnimatedSinceResize&&(rb.hasAnimatedSinceResize=!1,this.nodes.forEach(_L))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&c&&(l||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:d,hasRelativeTargetChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||c.getDefaultTransition()||ofe,{onLayoutAnimationStart:g,onLayoutAnimationComplete:y}=c.getProps(),v=!this.targetLayout||!kL(this.targetLayout,p)||h,w=!d&&h;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||w||d&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,w);const A={...ik(m,"layout"),onPlay:g,onComplete:y};(c.shouldReduceMotion||this.options.layoutRoot)&&(A.delay=0,A.type=!1),this.startAnimation(A)}else d||_L(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,Yi(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(nfe),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&&TL(this)&&window.HandoffCancelAllAnimations(),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let c=0;c<this.path.length;c++){const f=this.path[c];f.shouldResetTransform=!0,f.updateScroll("snapshot"),f.options.layoutRoot&&f.willUpdate(!1)}const{layoutId:a,layout:l}=this.options;if(a===void 0&&!l)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(OL);return}this.isUpdating||this.nodes.forEach(Xce),this.isUpdating=!1,this.nodes.forEach(Zce),this.nodes.forEach(Kce),this.nodes.forEach(qce),this.clearAllSnapshots();const a=ca.now();Tn.delta=aa(0,1e3/60,a-Tn.timestamp),Tn.timestamp=a,Tn.isProcessing=!0,tk.update.process(Tn),tk.preRender.process(Tn),tk.render.process(Tn),Tn.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,V2.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Yce),this.sharedNodes.forEach(rfe)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,pt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){pt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=qt(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let a=!!(this.options.layoutScroll&&this.instance);this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(a=!1),a&&(this.scroll={animationId:this.root.animationId,phase:o,isRoot:r(this.instance),offset:n(this.instance)})}resetTransform(){if(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!xL(this.projectionDelta),l=this.getTransformTemplate(),u=l?l(this.latestValues,""):void 0,c=u!==this.prevTransformTemplateValue;o&&(a||Vl(this.latestValues)||c)&&(s(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const a=this.measurePageBox();let l=this.removeElementScroll(a);return o&&(l=this.removeTransform(l)),afe(l),{animationId:this.root.animationId,measuredBox:a,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:o}=this.options;if(!o)return qt();const a=o.measureViewportBox(),{scroll:l}=this.root;return l&&(da(a.x,l.offset.x),da(a.y,l.offset.y)),a}removeElementScroll(o){const a=qt();ts(a,o);for(let l=0;l<this.path.length;l++){const u=this.path[l],{scroll:c,options:f}=u;if(u!==this.root&&c&&f.layoutScroll){if(c.isRoot){ts(a,o);const{scroll:d}=this.root;d&&(da(a.x,-d.offset.x),da(a.y,-d.offset.y))}da(a.x,c.offset.x),da(a.y,c.offset.y)}}return a}applyTransform(o,a=!1){const l=qt();ts(l,o);for(let u=0;u<this.path.length;u++){const c=this.path[u];!a&&c.options.layoutScroll&&c.scroll&&c!==c.root&&Zc(l,{x:-c.scroll.offset.x,y:-c.scroll.offset.y}),Vl(c.latestValues)&&Zc(l,c.latestValues)}return Vl(this.latestValues)&&Zc(l,this.latestValues),l}removeTransform(o){const a=qt();ts(a,o);for(let l=0;l<this.path.length;l++){const u=this.path[l];if(!u.instance||!Vl(u.latestValues))continue;Ik(u.latestValues)&&u.updateSnapshot();const c=qt(),f=u.measurePageBox();ts(c,f),AL(a,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,c)}return Vl(this.latestValues)&&AL(a,this.latestValues),a}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Tn.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var a;const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const u=!!this.resumingFrom||this!==l;if(!(o||u&&this.isSharedProjectionDirty||this.isProjectionDirty||!((a=this.parent)===null||a===void 0)&&a.isProjectionDirty||this.attemptToResolveRelativeTarget))return;const{layout:f,layoutId:d}=this.options;if(!(!this.layout||!(f||d))){if(this.resolvedRelativeTargetAt=Tn.timestamp,!this.targetDelta&&!this.relativeTarget){const h=this.getClosestProjectingParent();h&&h.layout&&this.animationProgress!==1?(this.relativeParent=h,this.forceRelativeParentToResolveTarget(),this.relativeTarget=qt(),this.relativeTargetOrigin=qt(),fp(this.relativeTargetOrigin,this.layout.layoutBox,h.layout.layoutBox),ts(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=qt(),this.targetWithTransforms=qt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),lce(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):ts(this.target,this.layout.layoutBox),sL(this.target,this.targetDelta)):ts(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const h=this.getClosestProjectingParent();h&&!!h.resumingFrom==!!this.resumingFrom&&!h.options.layoutScroll&&h.target&&this.animationProgress!==1?(this.relativeParent=h,this.forceRelativeParentToResolveTarget(),this.relativeTarget=qt(),this.relativeTargetOrigin=qt(),fp(this.relativeTargetOrigin,this.target,h.target),ts(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Hl.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||Ik(this.parent.latestValues)||tL(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var o;const a=this.getLead(),l=!!this.resumingFrom||this!==a;let u=!0;if((this.isProjectionDirty||!((o=this.parent)===null||o===void 0)&&o.isProjectionDirty)&&(u=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(u=!1),this.resolvedRelativeTargetAt===Tn.timestamp&&(u=!1),u)return;const{layout:c,layoutId:f}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(c||f))return;ts(this.layoutCorrected,this.layout.layoutBox);const d=this.treeScale.x,h=this.treeScale.y;yce(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=qt());const{target:p}=a;if(!p){this.projectionTransform&&(this.projectionDelta=Xc(),this.projectionTransform="none",this.scheduleRender());return}this.projectionDelta||(this.projectionDelta=Xc(),this.projectionDeltaWithTransform=Xc());const m=this.projectionTransform;cp(this.projectionDelta,this.layoutCorrected,p,this.latestValues),this.projectionTransform=CL(this.projectionDelta,this.treeScale),(this.projectionTransform!==m||this.treeScale.x!==d||this.treeScale.y!==h)&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",p)),Hl.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){if(this.options.scheduleRender&&this.options.scheduleRender(),o){const a=this.getStack();a&&a.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}setAnimationOrigin(o,a=!1){const l=this.snapshot,u=l?l.latestValues:{},c={...this.latestValues},f=Xc();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const d=qt(),h=l?l.source:void 0,p=this.layout?this.layout.source:void 0,m=h!==p,g=this.getStack(),y=!g||g.members.length<=1,v=!!(m&&!y&&this.options.crossfade===!0&&!this.path.some(ife));this.animationProgress=0;let w;this.mixTargetDelta=A=>{const x=A/1e3;ML(f.x,o.x,x),ML(f.y,o.y,x),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(fp(d,this.layout.layoutBox,this.relativeParent.layout.layoutBox),sfe(this.relativeTarget,this.relativeTargetOrigin,d,x),w&&Bce(this.relativeTarget,w)&&(this.isProjectionDirty=!1),w||(w=qt()),ts(w,this.relativeTarget)),m&&(this.animationValues=c,Mce(c,u,this.latestValues,x,v,y)),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&&(Yi(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=pt.update(()=>{rb.hasAnimatedSinceResize=!0,this.currentAnimation=$ce(0,SL,{...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(SL),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:u,latestValues:c}=o;if(!(!a||!l||!u)){if(this!==o&&this.layout&&u&&LL(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||qt();const f=Pr(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+f;const d=Pr(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+d}ts(a,l),Zc(a,c),cp(this.projectionDeltaWithTransform,this.layoutCorrected,a,c)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new Fce),this.sharedNodes.get(o).add(a);const u=a.options.initialPromotionConfig;a.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const u={};l.z&&Fk("z",o,u,this.animationValues);for(let c=0;c<Bk.length;c++)Fk(`rotate${Bk[c]}`,o,u,this.animationValues),Fk(`skew${Bk[c]}`,o,u,this.animationValues);o.render();for(const c in u)o.setStaticValue(c,u[c]),this.animationValues&&(this.animationValues[c]=u[c]);o.scheduleRender()}getProjectionStyles(o){var a,l;if(!this.instance||this.isSVG)return;if(!this.isVisible)return Gce;const u={visibility:""},c=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,u.opacity="",u.pointerEvents=Wy(o==null?void 0:o.pointerEvents)||"",u.transform=c?c(this.latestValues,""):"none",u;const f=this.getLead();if(!this.projectionDelta||!this.layout||!f.target){const m={};return this.options.layoutId&&(m.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,m.pointerEvents=Wy(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!Vl(this.latestValues)&&(m.transform=c?c({},""):"none",this.hasProjected=!1),m}const d=f.animationValues||f.latestValues;this.applyTransformsToTarget(),u.transform=CL(this.projectionDeltaWithTransform,this.treeScale,d),c&&(u.transform=c(d,u.transform));const{x:h,y:p}=this.projectionDelta;u.transformOrigin=`${h.origin*100}% ${p.origin*100}% 0`,f.animationValues?u.opacity=f===this?(l=(a=d.opacity)!==null&&a!==void 0?a:this.latestValues.opacity)!==null&&l!==void 0?l:1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:u.opacity=f===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const m in zy){if(d[m]===void 0)continue;const{correct:g,applyTo:y}=zy[m],v=u.transform==="none"?d[m]:g(d[m],f);if(y){const w=y.length;for(let A=0;A<w;A++)u[y[A]]=v}else u[m]=v}return this.options.layoutId&&(u.pointerEvents=f===this?Wy(o==null?void 0:o.pointerEvents)||"":"none"),u}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(OL),this.root.sharedNodes.clear()}}}function Kce(t){t.updateLayout()}function qce(t){var e;const n=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&n&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=t.layout,{animationType:i}=t.options,o=n.source!==t.layout.source;i==="size"?es(f=>{const d=o?n.measuredBox[f]:n.layoutBox[f],h=Pr(d);d.min=r[f].min,d.max=d.min+h}):LL(i,n.layoutBox,r)&&es(f=>{const d=o?n.measuredBox[f]:n.layoutBox[f],h=Pr(r[f]);d.max=d.min+h,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[f].max=t.relativeTarget[f].min+h)});const a=Xc();cp(a,r,n.layoutBox);const l=Xc();o?cp(l,t.applyTransform(s,!0),n.measuredBox):cp(l,r,n.layoutBox);const u=!xL(a);let c=!1;if(!t.resumeFrom){const f=t.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:d,layout:h}=f;if(d&&h){const p=qt();fp(p,n.layoutBox,d.layoutBox);const m=qt();fp(m,r,h.layoutBox),kL(p,m)||(c=!0),f.options.layoutRoot&&(t.relativeTarget=m,t.relativeTargetOrigin=p,t.relativeParent=f)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:l,layoutDelta:a,hasLayoutChanged:u,hasRelativeTargetChanged:c})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function Qce(t){Hl.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function Jce(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Yce(t){t.clearSnapshot()}function OL(t){t.clearMeasurements()}function Xce(t){t.isLayoutDirty=!1}function Zce(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function _L(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function efe(t){t.resolveTargetDelta()}function tfe(t){t.calcProjection()}function nfe(t){t.resetSkewAndRotation()}function rfe(t){t.removeLeadSnapshot()}function ML(t,e,n){t.translate=Bt(e.translate,0,n),t.scale=Bt(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function NL(t,e,n,r){t.min=Bt(e.min,n.min,r),t.max=Bt(e.max,n.max,r)}function sfe(t,e,n,r){NL(t.x,e.x,n.x,r),NL(t.y,e.y,n.y,r)}function ife(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const ofe={duration:.45,ease:[.4,0,.1,1]},RL=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),PL=RL("applewebkit/")&&!RL("chrome/")?Math.round:Sn;function IL(t){t.min=PL(t.min),t.max=PL(t.max)}function afe(t){IL(t.x),IL(t.y)}function LL(t,e,n){return t==="position"||t==="preserve-aspect"&&!Nk(EL(e),EL(n),.2)}const lfe=DL({attachResizeListener:(t,e)=>Xi(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),jk={current:void 0},BL=DL({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!jk.current){const t=new lfe({});t.mount(window),t.setOptions({layoutScroll:!0}),jk.current=t}return jk.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),ufe={pan:{Feature:Cce},drag:{Feature:Ece,ProjectionNode:BL,MeasureLayout:fL}},Uk={current:null},FL={current:!1};function cfe(){if(FL.current=!0,!!F2)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Uk.current=t.matches;t.addListener(e),e()}else Uk.current=!1}function ffe(t,e,n){const{willChange:r}=e;for(const s in e){const i=e[s],o=n[s];if(Pn(i))t.addValue(s,i),eb(r)&&r.add(s),process.env.NODE_ENV==="development"&&Dk(i.version==="11.2.12",`Attempting to mix Framer Motion versions ${i.version} with 11.2.12 may not work as expected.`);else if(Pn(o))t.addValue(s,up(i,{owner:t})),eb(r)&&r.remove(s);else if(o!==i)if(t.hasValue(s)){const a=t.getValue(s);a.liveStyle===!0?a.jump(i):a.hasAnimated||a.set(i)}else{const a=t.getStaticValue(s);t.addValue(s,up(a!==void 0?a:i,{owner:t}))}}for(const s in n)e[s]===void 0&&t.removeValue(s);return e}const jL=new WeakMap,dfe=[...XI,In,fa],hfe=t=>dfe.find(YI(t)),UL=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],pfe=z2.length;class mfe{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:i,visualState:o},a={}){this.resolveKeyframes=(d,h,p,m)=>new this.KeyframeResolver(d,h,p,m,this),this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=lk,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>pt.render(this.render,!1,!0);const{latestValues:l,renderState:u}=o;this.latestValues=l,this.baseTarget={...l},this.initialValues=n.initial?{...l}:{},this.renderState=u,this.parent=e,this.props=n,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.options=a,this.blockInitialAnimation=!!i,this.isControllingVariants=Hy(n),this.isVariantNode=gI(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:c,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const d in f){const h=f[d];l[d]!==void 0&&Pn(h)&&(h.set(l[d],!1),eb(c)&&c.add(d))}}mount(e){this.current=e,jL.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),FL.current||cfe(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Uk.current,process.env.NODE_ENV!=="production"&&Dk(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(){jL.delete(this.current),this.projection&&this.projection.unmount(),Yi(this.notifyUpdate),Yi(this.render),this.valueSubscriptions.forEach(e=>e()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(e,n){const r=Bl.has(e),s=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&pt.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),i=n.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(e,()=>{s(),i(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Kc){const n=Kc[e];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[e]&&s&&r(this.props)&&(this.features[e]=new s(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):qt()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<UL.length;r++){const s=UL[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=ffe(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}getVariantContext(e=!1){if(e)return this.parent?this.parent.getVariantContext():void 0;if(!this.isControllingVariants){const r=this.parent?this.parent.getVariantContext()||{}:{};return this.props.initial!==void 0&&(r.initial=this.props.initial),r}const n={};for(let r=0;r<pfe;r++){const s=z2[r],i=this.props[s];(Zh(i)||i===!1)&&(n[s]=i)}return n}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const r=this.values.get(e);n!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&n!==void 0&&(r=up(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){var r;let s=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(r=this.getBaseTargetFromProps(this.props,e))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,e,this.options);return s!=null&&(typeof s=="string"&&(WI(s)||GI(s))?s=parseFloat(s):!hfe(s)&&fa.test(n)&&(s=l8(e,n)),this.setBaseTarget(e,Pn(s)?s.get():s)),Pn(s)?s.get():s}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var n;const{initial:r}=this.props;let s;if(typeof r=="string"||typeof r=="object"){const o=Z2(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);o&&(s=o[e])}if(r&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,e);return i!==void 0&&!Pn(i)?i:this.initialValues[e]!==void 0&&s===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new Tk),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}}class VL extends mfe{constructor(){super(...arguments),this.KeyframeResolver=u8}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:r}){delete n[e],delete r[e]}}function gfe(t){return window.getComputedStyle(t)}class yfe extends VL{constructor(){super(...arguments),this.type="html"}readValueFromInstance(e,n){if(Bl.has(n)){const r=hk(n);return r&&r.default||0}else{const r=gfe(e),s=(vI(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:n}){return aL(e,n)}build(e,n,r,s){q2(e,n,r,s.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return X2(e,n,r)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Pn(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}renderInstance(e,n,r,s){OI(e,n,r,s)}}class bfe extends VL{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Bl.has(n)){const r=hk(n);return r&&r.default||0}return n=_I.has(n)?n:U2(n),e.getAttribute(n)}measureInstanceViewportBox(){return qt()}scrapeMotionValuesFromProps(e,n,r){return NI(e,n,r)}build(e,n,r,s){J2(e,n,r,this.isSVGTag,s.transformTemplate)}renderInstance(e,n,r,s){MI(e,n,r,s)}mount(e){this.isSVGTag=Y2(e.tagName),super.mount(e)}}const wfe=(t,e)=>G2(t)?new bfe(e,{enableHardwareAcceleration:!1}):new yfe(e,{allowProjection:t!==N.Fragment,enableHardwareAcceleration:!0}),Afe={...sce,...gle,...ufe,...{layout:{ProjectionNode:BL,MeasureLayout:fL}}},vfe=Sae((t,e)=>rle(t,e,Afe,wfe));function HL(){const t=N.useRef(!1);return j2(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function xfe(){const t=HL(),[e,n]=N.useState(0),r=N.useCallback(()=>{t.current&&n(e+1)},[e]);return[N.useCallback(()=>pt.postRender(r),[r]),e]}class kfe extends V.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function Efe({children:t,isPresent:e}){const n=N.useId(),r=N.useRef(null),s=N.useRef({width:0,height:0,top:0,left:0}),{nonce:i}=N.useContext(B2);return N.useInsertionEffect(()=>{const{width:o,height:a,top:l,left:u}=s.current;if(e||!r.current||!o||!a)return;r.current.dataset.motionPopId=n;const c=document.createElement("style");return i&&(c.nonce=i),document.head.appendChild(c),c.sheet&&c.sheet.insertRule(`
515
+ `?s.slice(0,-1):s};return e.renderer.rules.hardbreak=n(e.renderer.rules.hardbreak),e.renderer.rules.softbreak=n(e.renderer.rules.softbreak),e.renderer.rules.fence=n(e.renderer.rules.fence),e.renderer.rules.code_block=n(e.renderer.rules.code_block),e.renderer.renderToken=n(e.renderer.renderToken.bind(e.renderer)),e}}const Wte=wt.create({name:"markdownClipboard",addOptions(){return{transformPastedText:!1,transformCopiedText:!1}},addProseMirrorPlugins(){return[new bt({key:new _t("markdownClipboard"),props:{clipboardTextParser:(t,e,n)=>{if(n||!this.options.transformPastedText)return null;const r=this.editor.storage.markdown.parser.parse(t,{inline:!0});return Up.fromSchema(this.editor.schema).parseSlice(bx(r),{preserveWhitespace:!0,context:e})},clipboardTextSerializer:t=>this.options.transformCopiedText?this.editor.storage.markdown.serializer.serialize(t.content):null}})]}}),Kte=wt.create({name:"markdown",priority:50,addOptions(){return{html:!0,tightLists:!0,tightListClass:"tight",bulletListMarker:"-",linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}},addCommands(){const t=B7.Commands.config.addCommands();return{setContent:(e,n,r)=>s=>t.setContent(s.editor.storage.markdown.parser.parse(e),n,r)(s),insertContentAt:(e,n,r)=>s=>t.insertContentAt(e,s.editor.storage.markdown.parser.parse(n,{inline:!0}),r)(s)}},onBeforeCreate(){this.editor.storage.markdown={options:{...this.options},parser:new Gte(this.editor,this.options),serializer:new $te(this.editor),getMarkdown:()=>this.editor.storage.markdown.serializer.serialize(this.editor.state.doc)},this.editor.options.initialContent=this.editor.options.content,this.editor.options.content=this.editor.storage.markdown.parser.parse(this.editor.options.content)},onCreate(){this.editor.options.content=this.editor.options.initialContent,delete this.editor.options.initialContent},addStorage(){return{}},addExtensions(){return[hte.configure({tight:this.options.tightLists,tightClass:this.options.tightListClass}),Wte.configure({transformPastedText:this.options.transformPastedText,transformCopiedText:this.options.transformCopiedText})]}}),qte=[Nq,_q.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,bulletList:!1,listItem:!1}),hM.configure({depth:10,newGroupDelay:100}),Rq.configure({types:["heading","paragraph"]}),hQ,sQ.extend({exitable:!0}).configure({HTMLAttributes:{class:"text-blue-500 font-bold transition-colors cursor-pointer select-text pointer-events-auto"},openOnClick:!0,autolink:!1}),iQ.configure({placeholder:()=>"",includeChildren:!0,showOnlyCurrent:!0}),lQ.configure({multicolor:!0}),dQ.configure({HTMLAttributes:{class:"select-text pointer-events-auto"}}),Mq,gQ,uQ.configure({HTMLAttributes:{class:"not-prose space-y-4 !ml-0"}}),fQ.configure({HTMLAttributes:{class:"flex items-start"},nested:!0}),rM.configure({HTMLAttributes:{class:"space-y-4 !ml-6"}}),mM.configure({HTMLAttributes:{class:"leading-normal"}}),iM.configure({width:3,color:"#d1d5db"}),oM,QJ,dX,fX,...cX,CQ.configure({uploadFn:yV}),mQ,yQ,vQ,pX,pQ,Kte.configure({html:!0,tightLists:!0,tightListClass:"tight",bulletListMarker:"-",linkify:!0,breaks:!0,transformPastedText:!0,transformCopiedText:!1})],Qte="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAOCAYAAAD0f5bSAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAE/SURBVHgBhVJBTsJQEH3zMcElR+gRuIF6gwYPAOwkLoQTUE6ArEA3xbWJ4gnQE8gNwBuwhMR2fPNLk9o0ZZImM/P/e39e3wgqojPXXiPFJnFovw1kWT53xSKca3C70LXlr/eySYFdZ6Fb61eCePnBCb6VF3P21UA+WX+wv+086fgfyMbh4aPlqWJSZH2/k6EINlBEJI6tdxHG2tIDrsUqxYzsO5Qi+UXfNfwUPT7w49wRU1EyZWNFqIgV9REw84Wga+P1Uj7PsW5QE9pEZMT8Aq+JQmNcYl8HwgEtEvf9fc3RR4zrMCRe84WA6dJRz8upPwyftV0FOP3ugHqu0iZGzsSbF3bYUMRlgDdWMcyE4WvVl73XRC9CNiaqaHMDpkUQrYh8kmKUmy5lVpvdBNs2mOk0tptk9a5AVKHhzML+AZaSjR/r++n9AAAAAElFTkSuQmCC",Jte="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEjSURBVHgBjZJBToNQEIb/NzTeoMbGjTeoN5Au1S7wBrqwyk5OoD1B46pRF9UbsEBc9nmEHsI08QhGZnxMpaGUEv4EwoP/mxnyj0GNTp++AoPORA+Gx+mo91r1mOJh+LL0WYwDqC8i/obJGCuSfRJ1bHLdtWtQIaY5WoiYBknYtZQfmOGjpTIvC7TAahTvpMksmUQCvK0A6itzNl1egmi2k2K+2gPsD+mvHGkh4MIVoPuSLYbIYxOk3YAJVRuktwd3DhjvggqRB0Slc3D+/D1Lw95DE5Rnq3E487ySXeyu4zooz/R9tD/QUYV5Ufke1HbKvW4RdFS9icRoKeKO1c7Fi+HUbQ/BzzPdXjmxDCy8TOIk7G2CZf1nqzEJfqOPm8Otif4AFnp3K1F5HHAAAAAASUVORK5CYII=",Yte=t=>{const e=document.createElement("span");e.classList.add("collaboration-cursor__caret"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");return n.classList.add("collaboration-cursor__label"),n.setAttribute("style",`background-color: ${t.color}`),n.insertBefore(document.createTextNode(t.name),null),e.insertBefore(n,null),e},Xte=t=>{const e=document.createElement("span");e.classList.add("custom-cursor__caret"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");n.classList.add("custom-cursor__label-container"),n.setAttribute("style",`border: 1px solid ${t.color}`);const r=document.createElement("img");r.src=Qte,r.classList.add("custom-cursor__icon");const s=document.createElement("div");s.classList.add("custom-cursor__label");const i=document.createElement("span");i.classList.add("custom-cursor__text"),i.textContent=t.name;const o=document.createElement("img");return o.src=Jte,o.classList.add("custom-cursor__badge"),s.appendChild(i),n.appendChild(r),n.appendChild(s),n.appendChild(o),e.appendChild(n),e},Zte=t=>t.isEns?Xte(t):Yte(t),ene="6.13.1";function tne(t,e,n){const r=e.split("|").map(i=>i.trim());for(let i=0;i<r.length;i++)switch(e){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof t===e)return}const s=new Error(`invalid value for type ${e}`);throw s.code="INVALID_ARGUMENT",s.argument=`value.${n}`,s.value=t,s}async function Nn(t){const e=Object.keys(t);return(await Promise.all(e.map(r=>Promise.resolve(t[r])))).reduce((r,s,i)=>(r[e[i]]=s,r),{})}function Oe(t,e,n){for(let r in e){let s=e[r];const i=n?n[r]:null;i&&tne(s,i,r),Object.defineProperty(t,r,{enumerable:!0,value:s,writable:!1})}}function Ec(t){if(t==null)return"null";if(Array.isArray(t))return"[ "+t.map(Ec).join(", ")+" ]";if(t instanceof Uint8Array){const e="0123456789abcdef";let n="0x";for(let r=0;r<t.length;r++)n+=e[t[r]>>4],n+=e[t[r]&15];return n}if(typeof t=="object"&&typeof t.toJSON=="function")return Ec(t.toJSON());switch(typeof t){case"boolean":case"symbol":return t.toString();case"bigint":return BigInt(t).toString();case"number":return t.toString();case"string":return JSON.stringify(t);case"object":{const e=Object.keys(t);return e.sort(),"{ "+e.map(n=>`${Ec(n)}: ${Ec(t[n])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function gn(t,e){return t&&t.code===e}function Ax(t){return gn(t,"CALL_EXCEPTION")}function Nt(t,e,n){let r=t;{const i=[];if(n){if("message"in n||"code"in n||"name"in n)throw new Error(`value will overwrite populated values: ${Ec(n)}`);for(const o in n){if(o==="shortMessage")continue;const a=n[o];i.push(o+"="+Ec(a))}}i.push(`code=${e}`),i.push(`version=${ene}`),i.length&&(t+=" ("+i.join(", ")+")")}let s;switch(e){case"INVALID_ARGUMENT":s=new TypeError(t);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":s=new RangeError(t);break;default:s=new Error(t)}return Oe(s,{code:e}),n&&Object.assign(s,n),s.shortMessage==null&&Oe(s,{shortMessage:r}),s}function ee(t,e,n,r){if(!t)throw Nt(e,n,r)}function $(t,e,n,r){ee(t,e,"INVALID_ARGUMENT",{argument:n,value:r})}function s4(t,e,n){n==null&&(n=""),n&&(n=": "+n),ee(t>=e,"missing arguemnt"+n,"MISSING_ARGUMENT",{count:t,expectedCount:e}),ee(t<=e,"too many arguments"+n,"UNEXPECTED_ARGUMENT",{count:t,expectedCount:e})}["NFD","NFC","NFKD","NFKC"].reduce((t,e)=>{try{if("test".normalize(e)!=="test")throw new Error("bad");if(e==="NFD"&&"é".normalize("NFD")!=="é")throw new Error("broken");t.push(e)}catch{}return t},[]);function $g(t,e,n){if(n==null&&(n=""),t!==e){let r=n,s="new";n&&(r+=".",s+=" "+n),ee(!1,`private constructor; use ${r}from* methods`,"UNSUPPORTED_OPERATION",{operation:s})}}function i4(t,e,n){if(t instanceof Uint8Array)return n?new Uint8Array(t):t;if(typeof t=="string"&&t.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const r=new Uint8Array((t.length-2)/2);let s=2;for(let i=0;i<r.length;i++)r[i]=parseInt(t.substring(s,s+2),16),s+=2;return r}$(!1,"invalid BytesLike value",e||"value",t)}function ct(t,e){return i4(t,e,!1)}function Gn(t,e){return i4(t,e,!0)}function St(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||typeof e=="number"&&t.length!==2+2*e||e===!0&&t.length%2!==0)}function vx(t){return St(t,!0)||t instanceof Uint8Array}const o4="0123456789abcdef";function we(t){const e=ct(t);let n="0x";for(let r=0;r<e.length;r++){const s=e[r];n+=o4[(s&240)>>4]+o4[s&15]}return n}function $t(t){return"0x"+t.map(e=>we(e).substring(2)).join("")}function Cc(t){return St(t,!0)?(t.length-2)/2:ct(t).length}function Ht(t,e,n){const r=ct(t);return n!=null&&n>r.length&&ee(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:r,length:r.length,offset:n}),we(r.slice(e??0,n??r.length))}function a4(t,e,n){const r=ct(t);ee(e>=r.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(r),length:e,offset:e+1});const s=new Uint8Array(e);return s.fill(0),n?s.set(r,e-r.length):s.set(r,0),we(s)}function xl(t,e){return a4(t,e,!0)}function nne(t,e){return a4(t,e,!1)}const Gg=BigInt(0),Es=BigInt(1),Sc=9007199254740991;function rne(t,e){const n=Wg(t,"value"),r=BigInt(Qe(e,"width"));if(ee(n>>r===Gg,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:t}),n>>r-Es){const s=(Es<<r)-Es;return-((~n&s)+Es)}return n}function l4(t,e){let n=xe(t,"value");const r=BigInt(Qe(e,"width")),s=Es<<r-Es;if(n<Gg){n=-n,ee(n<=s,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:t});const i=(Es<<r)-Es;return(~n&i)+Es}else ee(n<s,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:t});return n}function Oh(t,e){const n=Wg(t,"value"),r=BigInt(Qe(e,"bits"));return n&(Es<<r)-Es}function xe(t,e){switch(typeof t){case"bigint":return t;case"number":return $(Number.isInteger(t),"underflow",e||"value",t),$(t>=-Sc&&t<=Sc,"overflow",e||"value",t),BigInt(t);case"string":try{if(t==="")throw new Error("empty string");return t[0]==="-"&&t[1]!=="-"?-BigInt(t.substring(1)):BigInt(t)}catch(n){$(!1,`invalid BigNumberish string: ${n.message}`,e||"value",t)}}$(!1,"invalid BigNumberish value",e||"value",t)}function Wg(t,e){const n=xe(t,e);return ee(n>=Gg,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:t}),n}const u4="0123456789abcdef";function xx(t){if(t instanceof Uint8Array){let e="0x0";for(const n of t)e+=u4[n>>4],e+=u4[n&15];return BigInt(e)}return xe(t)}function Qe(t,e){switch(typeof t){case"bigint":return $(t>=-Sc&&t<=Sc,"overflow",e||"value",t),Number(t);case"number":return $(Number.isInteger(t),"underflow",e||"value",t),$(t>=-Sc&&t<=Sc,"overflow",e||"value",t),t;case"string":try{if(t==="")throw new Error("empty string");return Qe(BigInt(t),e)}catch(n){$(!1,`invalid numeric string: ${n.message}`,e||"value",t)}}$(!1,"invalid numeric value",e||"value",t)}function sne(t){return Qe(xx(t))}function Xo(t,e){let r=Wg(t,"value").toString(16);if(e==null)r.length%2&&(r="0"+r);else{const s=Qe(e,"width");for(ee(s*2>=r.length,`value exceeds width (${s} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:t});r.length<s*2;)r="0"+r}return"0x"+r}function Wn(t){const e=Wg(t,"value");if(e===Gg)return new Uint8Array([]);let n=e.toString(16);n.length%2&&(n="0"+n);const r=new Uint8Array(n.length/2);for(let s=0;s<r.length;s++){const i=s*2;r[s]=parseInt(n.substring(i,i+2),16)}return r}function kl(t){let e=we(vx(t)?t:Wn(t)).substring(2);for(;e.startsWith("0");)e=e.substring(1);return e===""&&(e="0"),"0x"+e}const c4="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";BigInt(0);const f4=BigInt(58);function ine(t){const e=ct(t);let n=xx(e),r="";for(;n;)r=c4[Number(n%f4)]+r,n/=f4;for(let s=0;s<e.length&&!e[s];s++)r=c4[0]+r;return r}function one(t){t=atob(t);const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return ct(e)}function ane(t){const e=ct(t);let n="";for(let r=0;r<e.length;r++)n+=String.fromCharCode(e[r]);return btoa(n)}class d4{constructor(e,n,r){W(this,"filter");W(this,"emitter");J(this,ef);I(this,ef,n),Oe(this,{emitter:e,filter:r})}async removeListener(){T(this,ef)!=null&&await this.emitter.off(this.filter,T(this,ef))}}ef=new WeakMap;function lne(t,e,n,r,s){$(!1,`invalid codepoint at offset ${e}; ${t}`,"bytes",n)}function h4(t,e,n,r,s){if(t==="BAD_PREFIX"||t==="UNEXPECTED_CONTINUE"){let i=0;for(let o=e+1;o<n.length&&n[o]>>6===2;o++)i++;return i}return t==="OVERRUN"?n.length-e-1:0}function une(t,e,n,r,s){return t==="OVERLONG"?($(typeof s=="number","invalid bad code point for replacement","badCodepoint",s),r.push(s),0):(r.push(65533),h4(t,e,n))}const cne=Object.freeze({error:lne,ignore:h4,replace:une});function fne(t,e){e==null&&(e=cne.error);const n=ct(t,"bytes"),r=[];let s=0;for(;s<n.length;){const i=n[s++];if(!(i>>7)){r.push(i);continue}let o=null,a=null;if((i&224)===192)o=1,a=127;else if((i&240)===224)o=2,a=2047;else if((i&248)===240)o=3,a=65535;else{(i&192)===128?s+=e("UNEXPECTED_CONTINUE",s-1,n,r):s+=e("BAD_PREFIX",s-1,n,r);continue}if(s-1+o>=n.length){s+=e("OVERRUN",s-1,n,r);continue}let l=i&(1<<8-o-1)-1;for(let u=0;u<o;u++){let c=n[s];if((c&192)!=128){s+=e("MISSING_CONTINUE",s,n,r),l=null;break}l=l<<6|c&63,s++}if(l!==null){if(l>1114111){s+=e("OUT_OF_RANGE",s-1-o,n,r,l);continue}if(l>=55296&&l<=57343){s+=e("UTF16_SURROGATE",s-1-o,n,r,l);continue}if(l<=a){s+=e("OVERLONG",s-1-o,n,r,l);continue}r.push(l)}}return r}function Vi(t,e){$(typeof t=="string","invalid string value","str",t);let n=[];for(let r=0;r<t.length;r++){const s=t.charCodeAt(r);if(s<128)n.push(s);else if(s<2048)n.push(s>>6|192),n.push(s&63|128);else if((s&64512)==55296){r++;const i=t.charCodeAt(r);$(r<t.length&&(i&64512)===56320,"invalid surrogate pair","str",t);const o=65536+((s&1023)<<10)+(i&1023);n.push(o>>18|240),n.push(o>>12&63|128),n.push(o>>6&63|128),n.push(o&63|128)}else n.push(s>>12|224),n.push(s>>6&63|128),n.push(s&63|128)}return new Uint8Array(n)}function dne(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function Tc(t,e){return dne(fne(t,e))}function p4(t){async function e(n,r){ee(r==null||!r.cancelled,"request cancelled before sending","CANCELLED");const s=n.url.split(":")[0].toLowerCase();ee(s==="http"||s==="https",`unsupported protocol ${s}`,"UNSUPPORTED_OPERATION",{info:{protocol:s},operation:"request"}),ee(s==="https"||!n.credentials||n.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let i=null;const o=new AbortController,a=setTimeout(()=>{i=Nt("request timeout","TIMEOUT"),o.abort()},n.timeout);r&&r.addListener(()=>{i=Nt("request cancelled","CANCELLED"),o.abort()});const l={method:n.method,headers:new Headers(Array.from(n)),body:n.body||void 0,signal:o.signal};let u;try{u=await fetch(n.url,l)}catch(h){throw clearTimeout(a),i||h}clearTimeout(a);const c={};u.headers.forEach((h,p)=>{c[p.toLowerCase()]=h});const f=await u.arrayBuffer(),d=f==null?null:new Uint8Array(f);return{statusCode:u.status,statusMessage:u.statusText,headers:c,body:d}}return e}const hne=12,pne=250;let m4=p4();const mne=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),gne=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let kx=!1;async function g4(t,e){try{const n=t.match(mne);if(!n)throw new Error("invalid data");return new Zo(200,"OK",{"content-type":n[1]||"text/plain"},n[2]?one(n[3]):bne(n[3]))}catch{return new Zo(599,"BAD REQUEST (invalid data: URI)",{},null,new Kn(t))}}function y4(t){async function e(n,r){try{const s=n.match(gne);if(!s)throw new Error("invalid link");return new Kn(`${t}${s[2]}`)}catch{return new Zo(599,"BAD REQUEST (invalid IPFS URI)",{},null,new Kn(n))}}return e}const Kg={data:g4,ipfs:y4("https://gateway.ipfs.io/ipfs/")},b4=new WeakMap;class yne{constructor(e){J(this,$l);J(this,ha);I(this,$l,[]),I(this,ha,!1),b4.set(e,()=>{if(!T(this,ha)){I(this,ha,!0);for(const n of T(this,$l))setTimeout(()=>{n()},0);I(this,$l,[])}})}addListener(e){ee(!T(this,ha),"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),T(this,$l).push(e)}get cancelled(){return T(this,ha)}checkSignal(){ee(!this.cancelled,"cancelled","CANCELLED",{})}}$l=new WeakMap,ha=new WeakMap;function qg(t){if(t==null)throw new Error("missing signal; should not happen");return t.checkSignal(),t}const sb=class sb{constructor(e){J(this,ql);J(this,tf);J(this,nf);J(this,Os);J(this,ro);J(this,rf);J(this,sf);J(this,wn);J(this,Ir);J(this,so);J(this,Gl);J(this,Wl);J(this,Kl);J(this,hi);J(this,_s);J(this,pa);I(this,sf,String(e)),I(this,tf,!1),I(this,nf,!0),I(this,Os,{}),I(this,ro,""),I(this,rf,3e5),I(this,_s,{slotInterval:pne,maxAttempts:hne}),I(this,pa,null)}get url(){return T(this,sf)}set url(e){I(this,sf,String(e))}get body(){return T(this,wn)==null?null:new Uint8Array(T(this,wn))}set body(e){if(e==null)I(this,wn,void 0),I(this,Ir,void 0);else if(typeof e=="string")I(this,wn,Vi(e)),I(this,Ir,"text/plain");else if(e instanceof Uint8Array)I(this,wn,e),I(this,Ir,"application/octet-stream");else if(typeof e=="object")I(this,wn,Vi(JSON.stringify(e))),I(this,Ir,"application/json");else throw new Error("invalid body")}hasBody(){return T(this,wn)!=null}get method(){return T(this,ro)?T(this,ro):this.hasBody()?"POST":"GET"}set method(e){e==null&&(e=""),I(this,ro,String(e).toUpperCase())}get headers(){const e=Object.assign({},T(this,Os));return T(this,so)&&(e.authorization=`Basic ${ane(Vi(T(this,so)))}`),this.allowGzip&&(e["accept-encoding"]="gzip"),e["content-type"]==null&&T(this,Ir)&&(e["content-type"]=T(this,Ir)),this.body&&(e["content-length"]=String(this.body.length)),e}getHeader(e){return this.headers[e.toLowerCase()]}setHeader(e,n){T(this,Os)[String(e).toLowerCase()]=String(n)}clearHeaders(){I(this,Os,{})}[Symbol.iterator](){const e=this.headers,n=Object.keys(e);let r=0;return{next:()=>{if(r<n.length){const s=n[r++];return{value:[s,e[s]],done:!1}}return{value:void 0,done:!0}}}}get credentials(){return T(this,so)||null}setCredentials(e,n){$(!e.match(/:/),"invalid basic authentication username","username","[REDACTED]"),I(this,so,`${e}:${n}`)}get allowGzip(){return T(this,nf)}set allowGzip(e){I(this,nf,!!e)}get allowInsecureAuthentication(){return!!T(this,tf)}set allowInsecureAuthentication(e){I(this,tf,!!e)}get timeout(){return T(this,rf)}set timeout(e){$(e>=0,"timeout must be non-zero","timeout",e),I(this,rf,e)}get preflightFunc(){return T(this,Gl)||null}set preflightFunc(e){I(this,Gl,e)}get processFunc(){return T(this,Wl)||null}set processFunc(e){I(this,Wl,e)}get retryFunc(){return T(this,Kl)||null}set retryFunc(e){I(this,Kl,e)}get getUrlFunc(){return T(this,pa)||m4}set getUrlFunc(e){I(this,pa,e)}toString(){return`<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${T(this,wn)?we(T(this,wn)):"null"}>`}setThrottleParams(e){e.slotInterval!=null&&(T(this,_s).slotInterval=e.slotInterval),e.maxAttempts!=null&&(T(this,_s).maxAttempts=e.maxAttempts)}send(){return ee(T(this,hi)==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),I(this,hi,new yne(this)),fe(this,ql,Op).call(this,0,w4()+this.timeout,0,this,new Zo(0,"",{},null,this))}cancel(){ee(T(this,hi)!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const e=b4.get(this);if(!e)throw new Error("missing signal; should not happen");e()}redirect(e){const n=this.url.split(":")[0].toLowerCase(),r=e.split(":")[0].toLowerCase();ee(this.method==="GET"&&(n!=="https"||r!=="http")&&e.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})`});const s=new sb(e);return s.method="GET",s.allowGzip=this.allowGzip,s.timeout=this.timeout,I(s,Os,Object.assign({},T(this,Os))),T(this,wn)&&I(s,wn,new Uint8Array(T(this,wn))),I(s,Ir,T(this,Ir)),s}clone(){const e=new sb(this.url);return I(e,ro,T(this,ro)),T(this,wn)&&I(e,wn,T(this,wn)),I(e,Ir,T(this,Ir)),I(e,Os,Object.assign({},T(this,Os))),I(e,so,T(this,so)),this.allowGzip&&(e.allowGzip=!0),e.timeout=this.timeout,this.allowInsecureAuthentication&&(e.allowInsecureAuthentication=!0),I(e,Gl,T(this,Gl)),I(e,Wl,T(this,Wl)),I(e,Kl,T(this,Kl)),I(e,_s,Object.assign({},T(this,_s))),I(e,pa,T(this,pa)),e}static lockConfig(){kx=!0}static getGateway(e){return Kg[e.toLowerCase()]||null}static registerGateway(e,n){if(e=e.toLowerCase(),e==="http"||e==="https")throw new Error(`cannot intercept ${e}; use registerGetUrl`);if(kx)throw new Error("gateways locked");Kg[e]=n}static registerGetUrl(e){if(kx)throw new Error("gateways locked");m4=e}static createGetUrlFunc(e){return p4()}static createDataGateway(){return g4}static createIpfsGatewayFunc(e){return y4(e)}};tf=new WeakMap,nf=new WeakMap,Os=new WeakMap,ro=new WeakMap,rf=new WeakMap,sf=new WeakMap,wn=new WeakMap,Ir=new WeakMap,so=new WeakMap,Gl=new WeakMap,Wl=new WeakMap,Kl=new WeakMap,hi=new WeakMap,_s=new WeakMap,pa=new WeakMap,ql=new WeakSet,Op=async function(e,n,r,s,i){var c,f,d;if(e>=T(this,_s).maxAttempts)return i.makeServerError("exceeded maximum retry limit");ee(w4()<=n,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:s}),r>0&&await wne(r);let o=this.clone();const a=(o.url.split(":")[0]||"").toLowerCase();if(a in Kg){const h=await Kg[a](o.url,qg(T(s,hi)));if(h instanceof Zo){let p=h;if(this.processFunc){qg(T(s,hi));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,qg(T(s,hi)));let u=new Zo(l.statusCode,l.statusMessage,l.headers,l.body,s);if(u.statusCode===301||u.statusCode===302){try{const h=u.headers.location||"";return fe(c=o.redirect(h),ql,Op).call(c,e+1,n,0,s,u)}catch{}return u}else if(u.statusCode===429&&(this.retryFunc==null||await this.retryFunc(o,u,e))){const h=u.headers["retry-after"];let p=T(this,_s).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(),ql,Op).call(f,e+1,n,p,s,u)}if(this.processFunc){qg(T(s,hi));try{u=await this.processFunc(o,u)}catch(h){(h.throttle==null||typeof h.stall!="number")&&u.makeServerError("error in post-processing function",h).assertOk();let p=T(this,_s).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return h.stall>=0&&(p=h.stall),fe(d=o.clone(),ql,Op).call(d,e+1,n,p,s,u)}}return u};let Kn=sb;const Hk=class Hk{constructor(e,n,r,s,i){J(this,hp);J(this,pp);J(this,mp);J(this,Lr);J(this,of);J(this,Ql);I(this,hp,e),I(this,pp,n),I(this,mp,Object.keys(r).reduce((o,a)=>(o[a.toLowerCase()]=String(r[a]),o),{})),I(this,Lr,s==null?null:new Uint8Array(s)),I(this,of,i||null),I(this,Ql,{message:""})}toString(){return`<FetchResponse status=${this.statusCode} body=${T(this,Lr)?we(T(this,Lr)):"null"}>`}get statusCode(){return T(this,hp)}get statusMessage(){return T(this,pp)}get headers(){return Object.assign({},T(this,mp))}get body(){return T(this,Lr)==null?null:new Uint8Array(T(this,Lr))}get bodyText(){try{return T(this,Lr)==null?"":Tc(T(this,Lr))}catch{ee(!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{ee(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const e=this.headers,n=Object.keys(e);let r=0;return{next:()=>{if(r<n.length){const s=n[r++];return{value:[s,e[s]],done:!1}}return{value:void 0,done:!0}}}}makeServerError(e,n){let r;e?r=`CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${e})`:(e=`${this.statusCode} ${this.statusMessage}`,r=`CLIENT ESCALATED SERVER ERROR (${e})`);const s=new Hk(599,r,this.headers,this.body,T(this,of)||void 0);return I(s,Ql,{message:e,error:n}),s}throwThrottleError(e,n){n==null?n=-1:$(Number.isInteger(n)&&n>=0,"invalid stall timeout","stall",n);const r=new Error(e||"throttling requests");throw Oe(r,{stall:n,throttle:!0}),r}getHeader(e){return this.headers[e.toLowerCase()]}hasBody(){return T(this,Lr)!=null}get request(){return T(this,of)}ok(){return T(this,Ql).message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:e,error:n}=T(this,Ql);e===""&&(e=`server response ${this.statusCode} ${this.statusMessage}`);let r=null;this.request&&(r=this.request.url);let s=null;try{T(this,Lr)&&(s=Tc(T(this,Lr)))}catch{}ee(!1,e,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:n,info:{requestUrl:r,responseBody:s,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}};hp=new WeakMap,pp=new WeakMap,mp=new WeakMap,Lr=new WeakMap,of=new WeakMap,Ql=new WeakMap;let Zo=Hk;function w4(){return new Date().getTime()}function bne(t){return Vi(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,n)=>String.fromCharCode(parseInt(n,16))))}function wne(t){return new Promise(e=>setTimeout(e,t))}function Ane(t){let e=t.toString(16);for(;e.length<2;)e="0"+e;return"0x"+e}function A4(t,e,n){let r=0;for(let s=0;s<n;s++)r=r*256+t[e+s];return r}function v4(t,e,n,r){const s=[];for(;n<e+1+r;){const i=x4(t,n);s.push(i.result),n+=i.consumed,ee(n<=e+1+r,"child data too short","BUFFER_OVERRUN",{buffer:t,length:r,offset:e})}return{consumed:1+r,result:s}}function x4(t,e){ee(t.length!==0,"data too short","BUFFER_OVERRUN",{buffer:t,length:0,offset:1});const n=r=>{ee(r<=t.length,"data short segment too short","BUFFER_OVERRUN",{buffer:t,length:t.length,offset:r})};if(t[e]>=248){const r=t[e]-247;n(e+1+r);const s=A4(t,e+1,r);return n(e+1+r+s),v4(t,e,e+1+r,r+s)}else if(t[e]>=192){const r=t[e]-192;return n(e+1+r),v4(t,e,e+1,r)}else if(t[e]>=184){const r=t[e]-183;n(e+1+r);const s=A4(t,e+1,r);n(e+1+r+s);const i=we(t.slice(e+1+r,e+1+r+s));return{consumed:1+r+s,result:i}}else if(t[e]>=128){const r=t[e]-128;n(e+1+r);const s=we(t.slice(e+1,e+1+r));return{consumed:1+r,result:s}}return{consumed:1,result:Ane(t[e])}}function Qg(t){const e=ct(t,"data"),n=x4(e,0);return $(n.consumed===e.length,"unexpected junk after rlp payload","data",t),n.result}function k4(t){const e=[];for(;t;)e.unshift(t&255),t>>=8;return e}function E4(t){if(Array.isArray(t)){let r=[];if(t.forEach(function(i){r=r.concat(E4(i))}),r.length<=55)return r.unshift(192+r.length),r;const s=k4(r.length);return s.unshift(247+s.length),s.concat(r)}const e=Array.prototype.slice.call(ct(t,"object"));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const n=k4(e.length);return n.unshift(183+n.length),n.concat(e)}const C4="0123456789abcdef";function El(t){let e="0x";for(const n of E4(t))e+=C4[n>>4],e+=C4[n&15];return e}const qn=32,Ex=new Uint8Array(qn),vne=["then"],Jg={},S4=new WeakMap;function Cl(t){return S4.get(t)}function T4(t,e){S4.set(t,e)}function _h(t,e){const n=new Error(`deferred error during ABI decoding triggered accessing ${t}`);throw n.error=e,n}function Cx(t,e,n){return t.indexOf(null)>=0?e.map((r,s)=>r instanceof Dc?Cx(Cl(r),r,n):r):t.reduce((r,s,i)=>{let o=e.getValue(s);return s in r||(n&&o instanceof Dc&&(o=Cx(Cl(o),o,n)),r[s]=o),r},{})}const lf=class lf extends Array{constructor(...n){const r=n[0];let s=n[1],i=(n[2]||[]).slice(),o=!0;r!==Jg&&(s=n,i=[],o=!1);super(s.length);J(this,af);s.forEach((u,c)=>{this[c]=u});const a=i.reduce((u,c)=>(typeof c=="string"&&u.set(c,(u.get(c)||0)+1),u),new Map);if(T4(this,Object.freeze(s.map((u,c)=>{const f=i[c];return f!=null&&a.get(f)===1?f:null}))),I(this,af,[]),T(this,af)==null&&T(this,af),!o)return;Object.freeze(this);const l=new Proxy(this,{get:(u,c,f)=>{if(typeof c=="string"){if(c.match(/^[0-9]+$/)){const h=Qe(c,"%index");if(h<0||h>=this.length)throw new RangeError("out of result range");const p=u[h];return p instanceof Error&&_h(`index ${h}`,p),p}if(vne.indexOf(c)>=0)return Reflect.get(u,c,f);const d=u[c];if(d instanceof Function)return function(...h){return d.apply(this===f?u:this,h)};if(!(c in u))return u.getValue.apply(this===f?u:this,[c])}return Reflect.get(u,c,f)}});return T4(l,Cl(this)),l}toArray(n){const r=[];return this.forEach((s,i)=>{s instanceof Error&&_h(`index ${i}`,s),n&&s instanceof lf&&(s=s.toArray(n)),r.push(s)}),r}toObject(n){const r=Cl(this);return r.reduce((s,i,o)=>(ee(i!=null,`value at index ${o} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),Cx(r,this,n)),{})}slice(n,r){n==null&&(n=0),n<0&&(n+=this.length,n<0&&(n=0)),r==null&&(r=this.length),r<0&&(r+=this.length,r<0&&(r=0)),r>this.length&&(r=this.length);const s=Cl(this),i=[],o=[];for(let a=n;a<r;a++)i.push(this[a]),o.push(s[a]);return new lf(Jg,i,o)}filter(n,r){const s=Cl(this),i=[],o=[];for(let a=0;a<this.length;a++){const l=this[a];l instanceof Error&&_h(`index ${a}`,l),n.call(r,l,a,this)&&(i.push(l),o.push(s[a]))}return new lf(Jg,i,o)}map(n,r){const s=[];for(let i=0;i<this.length;i++){const o=this[i];o instanceof Error&&_h(`index ${i}`,o),s.push(n.call(r,o,i,this))}return s}getValue(n){const r=Cl(this).indexOf(n);if(r===-1)return;const s=this[r];return s instanceof Error&&_h(`property ${JSON.stringify(n)}`,s.error),s}static fromItems(n,r){return new lf(Jg,n,r)}};af=new WeakMap;let Dc=lf;function D4(t){let e=Wn(t);return ee(e.length<=qn,"value out-of-bounds","BUFFER_OVERRUN",{buffer:e,length:qn,offset:e.length}),e.length!==qn&&(e=Gn($t([Ex.slice(e.length%qn),e]))),e}class Hi{constructor(e,n,r,s){W(this,"name");W(this,"type");W(this,"localName");W(this,"dynamic");Oe(this,{name:e,type:n,localName:r,dynamic:s},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(e,n){$(!1,e,this.localName,n)}}class Sx{constructor(){J(this,uf);J(this,io);J(this,Jl);I(this,io,[]),I(this,Jl,0)}get data(){return $t(T(this,io))}get length(){return T(this,Jl)}appendWriter(e){return fe(this,uf,fb).call(this,Gn(e.data))}writeBytes(e){let n=Gn(e);const r=n.length%qn;return r&&(n=Gn($t([n,Ex.slice(r)]))),fe(this,uf,fb).call(this,n)}writeValue(e){return fe(this,uf,fb).call(this,D4(e))}writeUpdatableValue(){const e=T(this,io).length;return T(this,io).push(Ex),I(this,Jl,T(this,Jl)+qn),n=>{T(this,io)[e]=D4(n)}}}io=new WeakMap,Jl=new WeakMap,uf=new WeakSet,fb=function(e){return T(this,io).push(e),I(this,Jl,T(this,Jl)+e.length),e.length};const zk=class zk{constructor(e,n,r){J(this,Zl);W(this,"allowLoose");J(this,pr);J(this,Br);J(this,Yl);J(this,Xl);J(this,ma);Oe(this,{allowLoose:!!n}),I(this,pr,Gn(e)),I(this,Yl,0),I(this,Xl,null),I(this,ma,r??1024),I(this,Br,0)}get data(){return we(T(this,pr))}get dataLength(){return T(this,pr).length}get consumed(){return T(this,Br)}get bytes(){return new Uint8Array(T(this,pr))}subReader(e){const n=new zk(T(this,pr).slice(T(this,Br)+e),this.allowLoose,T(this,ma));return I(n,Xl,this),n}readBytes(e,n){let r=fe(this,Zl,qL).call(this,0,e,!!n);return fe(this,Zl,Xk).call(this,e),I(this,Br,T(this,Br)+r.length),r.slice(0,e)}readValue(){return xx(this.readBytes(qn))}readIndex(){return sne(this.readBytes(qn))}};pr=new WeakMap,Br=new WeakMap,Yl=new WeakMap,Xl=new WeakMap,ma=new WeakMap,Zl=new WeakSet,Xk=function(e){var n;if(T(this,Xl))return fe(n=T(this,Xl),Zl,Xk).call(n,e);I(this,Yl,T(this,Yl)+e),ee(T(this,ma)<1||T(this,Yl)<=T(this,ma)*this.dataLength,`compressed ABI data exceeds inflation ratio of ${T(this,ma)} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:Gn(T(this,pr)),offset:T(this,Br),length:e,info:{bytesRead:T(this,Yl),dataLength:this.dataLength}})},qL=function(e,n,r){let s=Math.ceil(n/qn)*qn;return T(this,Br)+s>T(this,pr).length&&(this.allowLoose&&r&&T(this,Br)+n<=T(this,pr).length?s=n:ee(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:Gn(T(this,pr)),length:T(this,pr).length,offset:T(this,Br)+s})),T(this,pr).slice(T(this,Br),T(this,Br)+s)};let Tx=zk;function Yg(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function Dx(t,...e){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function xne(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Yg(t.outputLen),Yg(t.blockLen)}function Oc(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function O4(t,e){Dx(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}const Ox=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _4=t=>t instanceof Uint8Array,kne=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),_x=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),ui=(t,e)=>t<<32-e|t>>>e;if(!(new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68))throw new Error("Non little-endian hardware is not supported");function Ene(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function Xg(t){if(typeof t=="string"&&(t=Ene(t)),!_4(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}function Cne(...t){const e=new Uint8Array(t.reduce((r,s)=>r+s.length,0));let n=0;return t.forEach(r=>{if(!_4(r))throw new Error("Uint8Array expected");e.set(r,n),n+=r.length}),e}class Mx{clone(){return this._cloneInto()}}function Nx(t){const e=r=>t().update(Xg(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function Sne(t=32){if(Ox&&typeof Ox.getRandomValues=="function")return Ox.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}class M4 extends Mx{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,xne(e);const r=Xg(n);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,i=new Uint8Array(s);i.set(r.length>s?e.create().update(r).digest():r);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=e.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),i.fill(0)}update(e){return Oc(this),this.iHash.update(e),this}digestInto(e){Oc(this),Dx(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:s,destroyed:i,blockLen:o,outputLen:a}=this;return e=e,e.finished=s,e.destroyed=i,e.blockLen=o,e.outputLen=a,e.oHash=n._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const N4=(t,e,n)=>new M4(t,e).update(n).digest();N4.create=(t,e)=>new M4(t,e);function Tne(t,e,n,r){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,n,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(n>>s&i),a=Number(n&i),l=r?4:0,u=r?0:4;t.setUint32(e+l,o,r),t.setUint32(e+u,a,r)}class R4 extends Mx{constructor(e,n,r,s){super(),this.blockLen=e,this.outputLen=n,this.padOffset=r,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=_x(this.buffer)}update(e){Oc(this);const{view:n,buffer:r,blockLen:s}=this;e=Xg(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=_x(e);for(;s<=i-o;o+=s)this.process(l,o);continue}r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Oc(this),O4(e,this),this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:i}=this;let{pos:o}=this;n[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>s-o&&(this.process(r,0),o=0);for(let f=o;f<s;f++)n[f]=0;Tne(r,s-8,BigInt(this.length*8),i),this.process(r,0);const a=_x(e),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=l/4,c=this.get();if(u>c.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)a.setUint32(4*f,c[f],i)}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:n,buffer:r,length:s,finished:i,destroyed:o,pos:a}=this;return e.length=s,e.pos=a,e.finished=i,e.destroyed=o,s%n&&e.buffer.set(r),e}}const Dne=(t,e,n)=>t&e^~t&n,One=(t,e,n)=>t&e^t&n^e&n,_ne=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]),ea=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ta=new Uint32Array(64);class Mne extends R4{constructor(){super(64,32,8,!1),this.A=ea[0]|0,this.B=ea[1]|0,this.C=ea[2]|0,this.D=ea[3]|0,this.E=ea[4]|0,this.F=ea[5]|0,this.G=ea[6]|0,this.H=ea[7]|0}get(){const{A:e,B:n,C:r,D:s,E:i,F:o,G:a,H:l}=this;return[e,n,r,s,i,o,a,l]}set(e,n,r,s,i,o,a,l){this.A=e|0,this.B=n|0,this.C=r|0,this.D=s|0,this.E=i|0,this.F=o|0,this.G=a|0,this.H=l|0}process(e,n){for(let f=0;f<16;f++,n+=4)ta[f]=e.getUint32(n,!1);for(let f=16;f<64;f++){const d=ta[f-15],h=ta[f-2],p=ui(d,7)^ui(d,18)^d>>>3,m=ui(h,17)^ui(h,19)^h>>>10;ta[f]=m+ta[f-7]+p+ta[f-16]|0}let{A:r,B:s,C:i,D:o,E:a,F:l,G:u,H:c}=this;for(let f=0;f<64;f++){const d=ui(a,6)^ui(a,11)^ui(a,25),h=c+d+Dne(a,l,u)+_ne[f]+ta[f]|0,m=(ui(r,2)^ui(r,13)^ui(r,22))+One(r,s,i)|0;c=u,u=l,l=a,a=o+h|0,o=i,i=s,s=r,r=h+m|0}r=r+this.A|0,s=s+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,l=l+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(r,s,i,o,a,l,u,c)}roundClean(){ta.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const P4=Nx(()=>new Mne),Zg=BigInt(2**32-1),Rx=BigInt(32);function I4(t,e=!1){return e?{h:Number(t&Zg),l:Number(t>>Rx&Zg)}:{h:Number(t>>Rx&Zg)|0,l:Number(t&Zg)|0}}function L4(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let s=0;s<t.length;s++){const{h:i,l:o}=I4(t[s],e);[n[s],r[s]]=[i,o]}return[n,r]}const Nne=(t,e)=>BigInt(t>>>0)<<Rx|BigInt(e>>>0),Rne=(t,e,n)=>t>>>n,Pne=(t,e,n)=>t<<32-n|e>>>n,Ine=(t,e,n)=>t>>>n|e<<32-n,Lne=(t,e,n)=>t<<32-n|e>>>n,Bne=(t,e,n)=>t<<64-n|e>>>n-32,Fne=(t,e,n)=>t>>>n-32|e<<64-n,jne=(t,e)=>e,Une=(t,e)=>t,B4=(t,e,n)=>t<<n|e>>>32-n,F4=(t,e,n)=>e<<n|t>>>32-n,j4=(t,e,n)=>e<<n-32|t>>>64-n,U4=(t,e,n)=>t<<n-32|e>>>64-n;function Vne(t,e,n,r){const s=(e>>>0)+(r>>>0);return{h:t+n+(s/2**32|0)|0,l:s|0}}const Ze={fromBig:I4,split:L4,toBig:Nne,shrSH:Rne,shrSL:Pne,rotrSH:Ine,rotrSL:Lne,rotrBH:Bne,rotrBL:Fne,rotr32H:jne,rotr32L:Une,rotlSH:B4,rotlSL:F4,rotlBH:j4,rotlBL:U4,add:Vne,add3L:(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),add3H:(t,e,n,r)=>e+n+r+(t/2**32|0)|0,add4L:(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),add4H:(t,e,n,r,s)=>e+n+r+s+(t/2**32|0)|0,add5H:(t,e,n,r,s,i)=>e+n+r+s+i+(t/2**32|0)|0,add5L:(t,e,n,r,s)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(s>>>0)},[Hne,zne]=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(t=>BigInt(t))),na=new Uint32Array(80),ra=new Uint32Array(80);class $ne extends R4{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:n,Bh:r,Bl:s,Ch:i,Cl:o,Dh:a,Dl:l,Eh:u,El:c,Fh:f,Fl:d,Gh:h,Gl:p,Hh:m,Hl:g}=this;return[e,n,r,s,i,o,a,l,u,c,f,d,h,p,m,g]}set(e,n,r,s,i,o,a,l,u,c,f,d,h,p,m,g){this.Ah=e|0,this.Al=n|0,this.Bh=r|0,this.Bl=s|0,this.Ch=i|0,this.Cl=o|0,this.Dh=a|0,this.Dl=l|0,this.Eh=u|0,this.El=c|0,this.Fh=f|0,this.Fl=d|0,this.Gh=h|0,this.Gl=p|0,this.Hh=m|0,this.Hl=g|0}process(e,n){for(let w=0;w<16;w++,n+=4)na[w]=e.getUint32(n),ra[w]=e.getUint32(n+=4);for(let w=16;w<80;w++){const A=na[w-15]|0,x=ra[w-15]|0,k=Ze.rotrSH(A,x,1)^Ze.rotrSH(A,x,8)^Ze.shrSH(A,x,7),C=Ze.rotrSL(A,x,1)^Ze.rotrSL(A,x,8)^Ze.shrSL(A,x,7),O=na[w-2]|0,_=ra[w-2]|0,D=Ze.rotrSH(O,_,19)^Ze.rotrBH(O,_,61)^Ze.shrSH(O,_,6),R=Ze.rotrSL(O,_,19)^Ze.rotrBL(O,_,61)^Ze.shrSL(O,_,6),L=Ze.add4L(C,R,ra[w-7],ra[w-16]),F=Ze.add4H(L,k,D,na[w-7],na[w-16]);na[w]=F|0,ra[w]=L|0}let{Ah:r,Al:s,Bh:i,Bl:o,Ch:a,Cl:l,Dh:u,Dl:c,Eh:f,El:d,Fh:h,Fl:p,Gh:m,Gl:g,Hh:y,Hl:v}=this;for(let w=0;w<80;w++){const A=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),k=f&h^~f&m,C=d&p^~d&g,O=Ze.add5L(v,x,C,zne[w],ra[w]),_=Ze.add5H(O,y,A,k,Hne[w],na[w]),D=O|0,R=Ze.rotrSH(r,s,28)^Ze.rotrBH(r,s,34)^Ze.rotrBH(r,s,39),L=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;y=m|0,v=g|0,m=h|0,g=p|0,h=f|0,p=d|0,{h:f,l:d}=Ze.add(u|0,c|0,_|0,D|0),u=a|0,c=l|0,a=i|0,l=o|0,i=r|0,o=s|0;const B=Ze.add3L(D,L,G);r=Ze.add3H(B,_,R,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:u,l:c}=Ze.add(this.Dh|0,this.Dl|0,u|0,c|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:g}=Ze.add(this.Gh|0,this.Gl|0,m|0,g|0),{h:y,l:v}=Ze.add(this.Hh|0,this.Hl|0,y|0,v|0),this.set(r,s,i,o,a,l,u,c,f,d,h,p,m,g,y,v)}roundClean(){na.fill(0),ra.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 Gne=Nx(()=>new $ne);function Wne(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}const V4=Wne();V4.crypto||V4.msCrypto;function Kne(t){switch(t){case"sha256":return P4.create();case"sha512":return Gne.create()}$(!1,"invalid hashing algorithm name","algorithm",t)}const[H4,z4,$4]=[[],[],[]],qne=BigInt(0),Mh=BigInt(1),Qne=BigInt(2),Jne=BigInt(7),Yne=BigInt(256),Xne=BigInt(113);for(let t=0,e=Mh,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],H4.push(2*(5*r+n)),z4.push((t+1)*(t+2)/2%64);let s=qne;for(let i=0;i<7;i++)e=(e<<Mh^(e>>Jne)*Xne)%Yne,e&Qne&&(s^=Mh<<(Mh<<BigInt(i))-Mh);$4.push(s)}const[Zne,ere]=L4($4,!0),G4=(t,e,n)=>n>32?j4(t,e,n):B4(t,e,n),W4=(t,e,n)=>n>32?U4(t,e,n):F4(t,e,n);function tre(t,e=24){const n=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let o=0;o<10;o++)n[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,l=(o+2)%10,u=n[l],c=n[l+1],f=G4(u,c,1)^n[a],d=W4(u,c,1)^n[a+1];for(let h=0;h<50;h+=10)t[o+h]^=f,t[o+h+1]^=d}let s=t[2],i=t[3];for(let o=0;o<24;o++){const a=z4[o],l=G4(s,i,a),u=W4(s,i,a),c=H4[o];s=t[c],i=t[c+1],t[c]=l,t[c+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)n[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~n[(a+2)%10]&n[(a+4)%10]}t[0]^=Zne[r],t[1]^=ere[r]}n.fill(0)}class Px extends Mx{constructor(e,n,r,s=!1,i=24){if(super(),this.blockLen=e,this.suffix=n,this.outputLen=r,this.enableXOF=s,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Yg(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=kne(this.state)}keccak(){tre(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){Oc(this);const{blockLen:n,state:r}=this;e=Xg(e);const s=e.length;for(let i=0;i<s;){const o=Math.min(n-this.pos,s-i);for(let a=0;a<o;a++)r[this.pos++]^=e[i++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:n,pos:r,blockLen:s}=this;e[r]^=n,n&128&&r===s-1&&this.keccak(),e[s-1]^=128,this.keccak()}writeInto(e){Oc(this,!1),Dx(e),this.finish();const n=this.state,{blockLen:r}=this;for(let s=0,i=e.length;s<i;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,i-s);e.set(n.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Yg(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(O4(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:n,suffix:r,outputLen:s,rounds:i,enableXOF:o}=this;return e||(e=new Px(n,r,s,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=s,e.enableXOF=o,e.destroyed=this.destroyed,e}}const nre=((t,e,n)=>Nx(()=>new Px(e,t,n)))(1,136,256/8);let K4=!1;const q4=function(t){return nre(t)};let Q4=q4;function en(t){const e=ct(t,"data");return we(Q4(e))}en._=q4,en.lock=function(){K4=!0},en.register=function(t){if(K4)throw new TypeError("keccak256 is locked");Q4=t},Object.freeze(en);const J4=function(t){return Kne("sha256").update(t).digest()};let Y4=J4,X4=!1;function _c(t){const e=ct(t,"data");return we(Y4(e))}_c._=J4,_c.lock=function(){X4=!0},_c.register=function(t){if(X4)throw new Error("sha256 is locked");Y4=t},Object.freeze(_c),Object.freeze(_c);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Z4=BigInt(0),ey=BigInt(1),rre=BigInt(2),ty=t=>t instanceof Uint8Array,sre=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Mc(t){if(!ty(t))throw new Error("Uint8Array expected");let e="";for(let n=0;n<t.length;n++)e+=sre[t[n]];return e}function eR(t){const e=t.toString(16);return e.length&1?`0${e}`:e}function Ix(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}function Nc(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(e/2);for(let r=0;r<n.length;r++){const s=r*2,i=t.slice(s,s+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");n[r]=o}return n}function Sl(t){return Ix(Mc(t))}function Lx(t){if(!ty(t))throw new Error("Uint8Array expected");return Ix(Mc(Uint8Array.from(t).reverse()))}function Rc(t,e){return Nc(t.toString(16).padStart(e*2,"0"))}function Bx(t,e){return Rc(t,e).reverse()}function ire(t){return Nc(eR(t))}function Cs(t,e,n){let r;if(typeof e=="string")try{r=Nc(e)}catch(i){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${i}`)}else if(ty(e))r=Uint8Array.from(e);else throw new Error(`${t} must be hex string or Uint8Array`);const s=r.length;if(typeof n=="number"&&s!==n)throw new Error(`${t} expected ${n} bytes, got ${s}`);return r}function Nh(...t){const e=new Uint8Array(t.reduce((r,s)=>r+s.length,0));let n=0;return t.forEach(r=>{if(!ty(r))throw new Error("Uint8Array expected");e.set(r,n),n+=r.length}),e}function ore(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function are(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function lre(t){let e;for(e=0;t>Z4;t>>=ey,e+=1);return e}function ure(t,e){return t>>BigInt(e)&ey}const cre=(t,e,n)=>t|(n?ey:Z4)<<BigInt(e),Fx=t=>(rre<<BigInt(t-1))-ey,jx=t=>new Uint8Array(t),tR=t=>Uint8Array.from(t);function nR(t,e,n){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=jx(t),s=jx(t),i=0;const o=()=>{r.fill(1),s.fill(0),i=0},a=(...f)=>n(s,r,...f),l=(f=jx())=>{s=a(tR([0]),f),r=a(),f.length!==0&&(s=a(tR([1]),f),r=a())},u=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const d=[];for(;f<e;){r=a();const h=r.slice();d.push(h),f+=r.length}return Nh(...d)};return(f,d)=>{o(),l(f);let h;for(;!(h=d(u()));)l();return o(),h}}const fre={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||t instanceof Uint8Array,isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function Rh(t,e,n={}){const r=(s,i,o)=>{const a=fre[i];if(typeof a!="function")throw new Error(`Invalid validator "${i}", expected function`);const l=t[s];if(!(o&&l===void 0)&&!a(l,t))throw new Error(`Invalid param ${String(s)}=${l} (${typeof l}), expected ${i}`)};for(const[s,i]of Object.entries(e))r(s,i,!1);for(const[s,i]of Object.entries(n))r(s,i,!0);return t}const dre=Object.freeze(Object.defineProperty({__proto__:null,bitGet:ure,bitLen:lre,bitMask:Fx,bitSet:cre,bytesToHex:Mc,bytesToNumberBE:Sl,bytesToNumberLE:Lx,concatBytes:Nh,createHmacDrbg:nR,ensureBytes:Cs,equalBytes:ore,hexToBytes:Nc,hexToNumber:Ix,numberToBytesBE:Rc,numberToBytesLE:Bx,numberToHexUnpadded:eR,numberToVarBytesBE:ire,utf8ToBytes:are,validateObject:Rh},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const yn=BigInt(0),Gt=BigInt(1),Tl=BigInt(2),hre=BigInt(3),Ux=BigInt(4),rR=BigInt(5),sR=BigInt(8);BigInt(9),BigInt(16);function fr(t,e){const n=t%e;return n>=yn?n:e+n}function pre(t,e,n){if(n<=yn||e<yn)throw new Error("Expected power/modulo > 0");if(n===Gt)return yn;let r=Gt;for(;e>yn;)e&Gt&&(r=r*t%n),t=t*t%n,e>>=Gt;return r}function Xr(t,e,n){let r=t;for(;e-- >yn;)r*=r,r%=n;return r}function Vx(t,e){if(t===yn||e<=yn)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=fr(t,e),r=e,s=yn,i=Gt;for(;n!==yn;){const a=r/n,l=r%n,u=s-i*a;r=n,n=l,s=i,i=u}if(r!==Gt)throw new Error("invert: does not exist");return fr(s,e)}function mre(t){const e=(t-Gt)/Tl;let n,r,s;for(n=t-Gt,r=0;n%Tl===yn;n/=Tl,r++);for(s=Tl;s<t&&pre(s,e,t)!==t-Gt;s++);if(r===1){const o=(t+Gt)/Ux;return function(l,u){const c=l.pow(u,o);if(!l.eql(l.sqr(c),u))throw new Error("Cannot find square root");return c}}const i=(n+Gt)/Tl;return function(a,l){if(a.pow(l,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let u=r,c=a.pow(a.mul(a.ONE,s),n),f=a.pow(l,i),d=a.pow(l,n);for(;!a.eql(d,a.ONE);){if(a.eql(d,a.ZERO))return a.ZERO;let h=1;for(let m=a.sqr(d);h<u&&!a.eql(m,a.ONE);h++)m=a.sqr(m);const p=a.pow(c,Gt<<BigInt(u-h-1));c=a.sqr(p),f=a.mul(f,p),d=a.mul(d,c),u=h}return f}}function gre(t){if(t%Ux===hre){const e=(t+Gt)/Ux;return function(r,s){const i=r.pow(s,e);if(!r.eql(r.sqr(i),s))throw new Error("Cannot find square root");return i}}if(t%sR===rR){const e=(t-rR)/sR;return function(r,s){const i=r.mul(s,Tl),o=r.pow(i,e),a=r.mul(s,o),l=r.mul(r.mul(a,Tl),o),u=r.mul(a,r.sub(l,r.ONE));if(!r.eql(r.sqr(u),s))throw new Error("Cannot find square root");return u}}return mre(t)}const yre=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function bre(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=yre.reduce((r,s)=>(r[s]="function",r),e);return Rh(t,n)}function wre(t,e,n){if(n<yn)throw new Error("Expected power > 0");if(n===yn)return t.ONE;if(n===Gt)return e;let r=t.ONE,s=e;for(;n>yn;)n&Gt&&(r=t.mul(r,s)),s=t.sqr(s),n>>=Gt;return r}function Are(t,e){const n=new Array(e.length),r=e.reduce((i,o,a)=>t.is0(o)?i:(n[a]=i,t.mul(i,o)),t.ONE),s=t.inv(r);return e.reduceRight((i,o,a)=>t.is0(o)?i:(n[a]=t.mul(i,n[a]),t.mul(i,o)),s),n}function iR(t,e){const n=e!==void 0?e:t.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function vre(t,e,n=!1,r={}){if(t<=yn)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:s,nByteLength:i}=iR(t,e);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=gre(t),a=Object.freeze({ORDER:t,BITS:s,BYTES:i,MASK:Fx(s),ZERO:yn,ONE:Gt,create:l=>fr(l,t),isValid:l=>{if(typeof l!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof l}`);return yn<=l&&l<t},is0:l=>l===yn,isOdd:l=>(l&Gt)===Gt,neg:l=>fr(-l,t),eql:(l,u)=>l===u,sqr:l=>fr(l*l,t),add:(l,u)=>fr(l+u,t),sub:(l,u)=>fr(l-u,t),mul:(l,u)=>fr(l*u,t),pow:(l,u)=>wre(a,l,u),div:(l,u)=>fr(l*Vx(u,t),t),sqrN:l=>l*l,addN:(l,u)=>l+u,subN:(l,u)=>l-u,mulN:(l,u)=>l*u,inv:l=>Vx(l,t),sqrt:r.sqrt||(l=>o(a,l)),invertBatch:l=>Are(a,l),cmov:(l,u,c)=>c?u:l,toBytes:l=>n?Bx(l,i):Rc(l,i),fromBytes:l=>{if(l.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${l.length}`);return n?Lx(l):Sl(l)}});return Object.freeze(a)}function oR(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function aR(t){const e=oR(t);return e+Math.ceil(e/2)}function xre(t,e,n=!1){const r=t.length,s=oR(e),i=aR(e);if(r<16||r<i||r>1024)throw new Error(`expected ${i}-1024 bytes of input, got ${r}`);const o=n?Sl(t):Lx(t),a=fr(o,e-Gt)+Gt;return n?Bx(a,s):Rc(a,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const kre=BigInt(0),Hx=BigInt(1);function Ere(t,e){const n=(s,i)=>{const o=i.negate();return s?o:i},r=s=>{const i=Math.ceil(e/s)+1,o=2**(s-1);return{windows:i,windowSize:o}};return{constTimeNegate:n,unsafeLadder(s,i){let o=t.ZERO,a=s;for(;i>kre;)i&Hx&&(o=o.add(a)),a=a.double(),i>>=Hx;return o},precomputeWindow(s,i){const{windows:o,windowSize:a}=r(i),l=[];let u=s,c=u;for(let f=0;f<o;f++){c=u,l.push(c);for(let d=1;d<a;d++)c=c.add(u),l.push(c);u=c.double()}return l},wNAF(s,i,o){const{windows:a,windowSize:l}=r(s);let u=t.ZERO,c=t.BASE;const f=BigInt(2**s-1),d=2**s,h=BigInt(s);for(let p=0;p<a;p++){const m=p*l;let g=Number(o&f);o>>=h,g>l&&(g-=d,o+=Hx);const y=m,v=m+Math.abs(g)-1,w=p%2!==0,A=g<0;g===0?c=c.add(n(w,i[y])):u=u.add(n(A,i[v]))}return{p:u,f:c}},wNAFCached(s,i,o,a){const l=s._WINDOW_SIZE||1;let u=i.get(s);return u||(u=this.precomputeWindow(s,l),l!==1&&i.set(s,a(u))),this.wNAF(l,u,o)}}}function lR(t){return bre(t.Fp),Rh(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...iR(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Cre(t){const e=lR(t);Rh(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:s}=e;if(n){if(!r.eql(s,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:Sre,hexToBytes:Tre}=dre,Dl={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){const{Err:e}=Dl;if(t.length<2||t[0]!==2)throw new e("Invalid signature integer tag");const n=t[1],r=t.subarray(2,n+2);if(!n||r.length!==n)throw new e("Invalid signature integer: wrong length");if(r[0]&128)throw new e("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:Sre(r),l:t.subarray(n+2)}},toSig(t){const{Err:e}=Dl,n=typeof t=="string"?Tre(t):t;if(!(n instanceof Uint8Array))throw new Error("ui8a expected");let r=n.length;if(r<2||n[0]!=48)throw new e("Invalid signature tag");if(n[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:s,l:i}=Dl._parseInt(n.subarray(2)),{d:o,l:a}=Dl._parseInt(i);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:s,s:o}},hexFromSig(t){const e=u=>Number.parseInt(u[0],16)&8?"00"+u:u,n=u=>{const c=u.toString(16);return c.length&1?`0${c}`:c},r=e(n(t.s)),s=e(n(t.r)),i=r.length/2,o=s.length/2,a=n(i),l=n(o);return`30${n(o+i+4)}02${l}${s}02${a}${r}`}},zi=BigInt(0),Zr=BigInt(1);BigInt(2);const uR=BigInt(3);BigInt(4);function Dre(t){const e=Cre(t),{Fp:n}=e,r=e.toBytes||((p,m,g)=>{const y=m.toAffine();return Nh(Uint8Array.from([4]),n.toBytes(y.x),n.toBytes(y.y))}),s=e.fromBytes||(p=>{const m=p.subarray(1),g=n.fromBytes(m.subarray(0,n.BYTES)),y=n.fromBytes(m.subarray(n.BYTES,2*n.BYTES));return{x:g,y}});function i(p){const{a:m,b:g}=e,y=n.sqr(p),v=n.mul(y,p);return n.add(n.add(v,n.mul(p,m)),g)}if(!n.eql(n.sqr(e.Gy),i(e.Gx)))throw new Error("bad generator point: equation left != right");function o(p){return typeof p=="bigint"&&zi<p&&p<e.n}function a(p){if(!o(p))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function l(p){const{allowedPrivateKeyLengths:m,nByteLength:g,wrapPrivateKey:y,n:v}=e;if(m&&typeof p!="bigint"){if(p instanceof Uint8Array&&(p=Mc(p)),typeof p!="string"||!m.includes(p.length))throw new Error("Invalid key");p=p.padStart(g*2,"0")}let w;try{w=typeof p=="bigint"?p:Sl(Cs("private key",p,g))}catch{throw new Error(`private key must be ${g} bytes, hex or bigint, not ${typeof p}`)}return y&&(w=fr(w,v)),a(w),w}const u=new Map;function c(p){if(!(p instanceof f))throw new Error("ProjectivePoint expected")}class f{constructor(m,g,y){if(this.px=m,this.py=g,this.pz=y,m==null||!n.isValid(m))throw new Error("x required");if(g==null||!n.isValid(g))throw new Error("y required");if(y==null||!n.isValid(y))throw new Error("z required")}static fromAffine(m){const{x:g,y}=m||{};if(!m||!n.isValid(g)||!n.isValid(y))throw new Error("invalid affine point");if(m instanceof f)throw new Error("projective point not allowed");const v=w=>n.eql(w,n.ZERO);return v(g)&&v(y)?f.ZERO:new f(g,y,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(m){const g=n.invertBatch(m.map(y=>y.pz));return m.map((y,v)=>y.toAffine(g[v])).map(f.fromAffine)}static fromHex(m){const g=f.fromAffine(s(Cs("pointHex",m)));return g.assertValidity(),g}static fromPrivateKey(m){return f.BASE.multiply(l(m))}_setWindowSize(m){this._WINDOW_SIZE=m,u.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:m,y:g}=this.toAffine();if(!n.isValid(m)||!n.isValid(g))throw new Error("bad point: x or y not FE");const y=n.sqr(g),v=i(m);if(!n.eql(y,v))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:m}=this.toAffine();if(n.isOdd)return!n.isOdd(m);throw new Error("Field doesn't support isOdd")}equals(m){c(m);const{px:g,py:y,pz:v}=this,{px:w,py:A,pz:x}=m,k=n.eql(n.mul(g,x),n.mul(w,v)),C=n.eql(n.mul(y,x),n.mul(A,v));return k&&C}negate(){return new f(this.px,n.neg(this.py),this.pz)}double(){const{a:m,b:g}=e,y=n.mul(g,uR),{px:v,py:w,pz:A}=this;let x=n.ZERO,k=n.ZERO,C=n.ZERO,O=n.mul(v,v),_=n.mul(w,w),D=n.mul(A,A),R=n.mul(v,w);return R=n.add(R,R),C=n.mul(v,A),C=n.add(C,C),x=n.mul(m,C),k=n.mul(y,D),k=n.add(x,k),x=n.sub(_,k),k=n.add(_,k),k=n.mul(x,k),x=n.mul(R,x),C=n.mul(y,C),D=n.mul(m,D),R=n.sub(O,D),R=n.mul(m,R),R=n.add(R,C),C=n.add(O,O),O=n.add(C,O),O=n.add(O,D),O=n.mul(O,R),k=n.add(k,O),D=n.mul(w,A),D=n.add(D,D),O=n.mul(D,R),x=n.sub(x,O),C=n.mul(D,_),C=n.add(C,C),C=n.add(C,C),new f(x,k,C)}add(m){c(m);const{px:g,py:y,pz:v}=this,{px:w,py:A,pz:x}=m;let k=n.ZERO,C=n.ZERO,O=n.ZERO;const _=e.a,D=n.mul(e.b,uR);let R=n.mul(g,w),L=n.mul(y,A),F=n.mul(v,x),G=n.add(g,y),B=n.add(w,A);G=n.mul(G,B),B=n.add(R,L),G=n.sub(G,B),B=n.add(g,v);let H=n.add(w,x);return B=n.mul(B,H),H=n.add(R,F),B=n.sub(B,H),H=n.add(y,v),k=n.add(A,x),H=n.mul(H,k),k=n.add(L,F),H=n.sub(H,k),O=n.mul(_,B),k=n.mul(D,F),O=n.add(k,O),k=n.sub(L,O),O=n.add(L,O),C=n.mul(k,O),L=n.add(R,R),L=n.add(L,R),F=n.mul(_,F),B=n.mul(D,B),L=n.add(L,F),F=n.sub(R,F),F=n.mul(_,F),B=n.add(B,F),R=n.mul(L,B),C=n.add(C,R),R=n.mul(H,B),k=n.mul(G,k),k=n.sub(k,R),R=n.mul(G,L),O=n.mul(H,O),O=n.add(O,R),new f(k,C,O)}subtract(m){return this.add(m.negate())}is0(){return this.equals(f.ZERO)}wNAF(m){return h.wNAFCached(this,u,m,g=>{const y=n.invertBatch(g.map(v=>v.pz));return g.map((v,w)=>v.toAffine(y[w])).map(f.fromAffine)})}multiplyUnsafe(m){const g=f.ZERO;if(m===zi)return g;if(a(m),m===Zr)return this;const{endo:y}=e;if(!y)return h.unsafeLadder(this,m);let{k1neg:v,k1:w,k2neg:A,k2:x}=y.splitScalar(m),k=g,C=g,O=this;for(;w>zi||x>zi;)w&Zr&&(k=k.add(O)),x&Zr&&(C=C.add(O)),O=O.double(),w>>=Zr,x>>=Zr;return v&&(k=k.negate()),A&&(C=C.negate()),C=new f(n.mul(C.px,y.beta),C.py,C.pz),k.add(C)}multiply(m){a(m);let g=m,y,v;const{endo:w}=e;if(w){const{k1neg:A,k1:x,k2neg:k,k2:C}=w.splitScalar(g);let{p:O,f:_}=this.wNAF(x),{p:D,f:R}=this.wNAF(C);O=h.constTimeNegate(A,O),D=h.constTimeNegate(k,D),D=new f(n.mul(D.px,w.beta),D.py,D.pz),y=O.add(D),v=_.add(R)}else{const{p:A,f:x}=this.wNAF(g);y=A,v=x}return f.normalizeZ([y,v])[0]}multiplyAndAddUnsafe(m,g,y){const v=f.BASE,w=(x,k)=>k===zi||k===Zr||!x.equals(v)?x.multiplyUnsafe(k):x.multiply(k),A=w(this,g).add(w(m,y));return A.is0()?void 0:A}toAffine(m){const{px:g,py:y,pz:v}=this,w=this.is0();m==null&&(m=w?n.ONE:n.inv(v));const A=n.mul(g,m),x=n.mul(y,m),k=n.mul(v,m);if(w)return{x:n.ZERO,y:n.ZERO};if(!n.eql(k,n.ONE))throw new Error("invZ was invalid");return{x:A,y:x}}isTorsionFree(){const{h:m,isTorsionFree:g}=e;if(m===Zr)return!0;if(g)return g(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:m,clearCofactor:g}=e;return m===Zr?this:g?g(f,this):this.multiplyUnsafe(e.h)}toRawBytes(m=!0){return this.assertValidity(),r(f,this,m)}toHex(m=!0){return Mc(this.toRawBytes(m))}}f.BASE=new f(e.Gx,e.Gy,n.ONE),f.ZERO=new f(n.ZERO,n.ONE,n.ZERO);const d=e.nBitLength,h=Ere(f,e.endo?Math.ceil(d/2):d);return{CURVE:e,ProjectivePoint:f,normPrivateKeyToScalar:l,weierstrassEquation:i,isWithinCurveOrder:o}}function Ore(t){const e=lR(t);return Rh(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function _re(t){const e=Ore(t),{Fp:n,n:r}=e,s=n.BYTES+1,i=2*n.BYTES+1;function o(B){return zi<B&&B<n.ORDER}function a(B){return fr(B,r)}function l(B){return Vx(B,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:c,weierstrassEquation:f,isWithinCurveOrder:d}=Dre({...e,toBytes(B,H,Q){const te=H.toAffine(),Z=n.toBytes(te.x),pe=Nh;return Q?pe(Uint8Array.from([H.hasEvenY()?2:3]),Z):pe(Uint8Array.from([4]),Z,n.toBytes(te.y))},fromBytes(B){const H=B.length,Q=B[0],te=B.subarray(1);if(H===s&&(Q===2||Q===3)){const Z=Sl(te);if(!o(Z))throw new Error("Point is not on curve");const pe=f(Z);let Ee=n.sqrt(pe);const Re=(Ee&Zr)===Zr;return(Q&1)===1!==Re&&(Ee=n.neg(Ee)),{x:Z,y:Ee}}else if(H===i&&Q===4){const Z=n.fromBytes(te.subarray(0,n.BYTES)),pe=n.fromBytes(te.subarray(n.BYTES,2*n.BYTES));return{x:Z,y:pe}}else throw new Error(`Point of length ${H} was invalid. Expected ${s} compressed bytes or ${i} uncompressed bytes`)}}),h=B=>Mc(Rc(B,e.nByteLength));function p(B){const H=r>>Zr;return B>H}function m(B){return p(B)?a(-B):B}const g=(B,H,Q)=>Sl(B.slice(H,Q));class y{constructor(H,Q,te){this.r=H,this.s=Q,this.recovery=te,this.assertValidity()}static fromCompact(H){const Q=e.nByteLength;return H=Cs("compactSignature",H,Q*2),new y(g(H,0,Q),g(H,Q,2*Q))}static fromDER(H){const{r:Q,s:te}=Dl.toSig(Cs("DER",H));return new y(Q,te)}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(H){return new y(this.r,this.s,H)}recoverPublicKey(H){const{r:Q,s:te,recovery:Z}=this,pe=C(Cs("msgHash",H));if(Z==null||![0,1,2,3].includes(Z))throw new Error("recovery id invalid");const Ee=Z===2||Z===3?Q+e.n:Q;if(Ee>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const Re=Z&1?"03":"02",Ce=u.fromHex(Re+h(Ee)),ke=l(Ee),He=a(-pe*ke),Ue=a(te*ke),ze=u.BASE.multiplyAndAddUnsafe(Ce,He,Ue);if(!ze)throw new Error("point at infinify");return ze.assertValidity(),ze}hasHighS(){return p(this.s)}normalizeS(){return this.hasHighS()?new y(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return Nc(this.toDERHex())}toDERHex(){return Dl.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Nc(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const v={isValidPrivateKey(B){try{return c(B),!0}catch{return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const B=aR(e.n);return xre(e.randomBytes(B),e.n)},precompute(B=8,H=u.BASE){return H._setWindowSize(B),H.multiply(BigInt(3)),H}};function w(B,H=!0){return u.fromPrivateKey(B).toRawBytes(H)}function A(B){const H=B instanceof Uint8Array,Q=typeof B=="string",te=(H||Q)&&B.length;return H?te===s||te===i:Q?te===2*s||te===2*i:B instanceof u}function x(B,H,Q=!0){if(A(B))throw new Error("first arg must be private key");if(!A(H))throw new Error("second arg must be public key");return u.fromHex(H).multiply(c(B)).toRawBytes(Q)}const k=e.bits2int||function(B){const H=Sl(B),Q=B.length*8-e.nBitLength;return Q>0?H>>BigInt(Q):H},C=e.bits2int_modN||function(B){return a(k(B))},O=Fx(e.nBitLength);function _(B){if(typeof B!="bigint")throw new Error("bigint expected");if(!(zi<=B&&B<O))throw new Error(`bigint expected < 2^${e.nBitLength}`);return Rc(B,e.nByteLength)}function D(B,H,Q=R){if(["recovered","canonical"].some(tt=>tt in Q))throw new Error("sign() legacy options not supported");const{hash:te,randomBytes:Z}=e;let{lowS:pe,prehash:Ee,extraEntropy:Re}=Q;pe==null&&(pe=!0),B=Cs("msgHash",B),Ee&&(B=Cs("prehashed msgHash",te(B)));const Ce=C(B),ke=c(H),He=[_(ke),_(Ce)];if(Re!=null){const tt=Re===!0?Z(n.BYTES):Re;He.push(Cs("extraEntropy",tt))}const Ue=Nh(...He),ze=Ce;function Le(tt){const le=k(tt);if(!d(le))return;const $e=l(le),ae=u.BASE.multiply(le).toAffine(),be=a(ae.x);if(be===zi)return;const Be=a($e*a(ze+be*ke));if(Be===zi)return;let z=(ae.x===be?0:2)|Number(ae.y&Zr),q=Be;return pe&&p(Be)&&(q=m(Be),z^=1),new y(be,q,z)}return{seed:Ue,k2sig:Le}}const R={lowS:e.lowS,prehash:!1},L={lowS:e.lowS,prehash:!1};function F(B,H,Q=R){const{seed:te,k2sig:Z}=D(B,H,Q),pe=e;return nR(pe.hash.outputLen,pe.nByteLength,pe.hmac)(te,Z)}u.BASE._setWindowSize(8);function G(B,H,Q,te=L){var ae;const Z=B;if(H=Cs("msgHash",H),Q=Cs("publicKey",Q),"strict"in te)throw new Error("options.strict was renamed to lowS");const{lowS:pe,prehash:Ee}=te;let Re,Ce;try{if(typeof Z=="string"||Z instanceof Uint8Array)try{Re=y.fromDER(Z)}catch(be){if(!(be instanceof Dl.Err))throw be;Re=y.fromCompact(Z)}else if(typeof Z=="object"&&typeof Z.r=="bigint"&&typeof Z.s=="bigint"){const{r:be,s:Be}=Z;Re=new y(be,Be)}else throw new Error("PARSE");Ce=u.fromHex(Q)}catch(be){if(be.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(pe&&Re.hasHighS())return!1;Ee&&(H=e.hash(H));const{r:ke,s:He}=Re,Ue=C(H),ze=l(He),Le=a(Ue*ze),tt=a(ke*ze),le=(ae=u.BASE.multiplyAndAddUnsafe(Ce,Le,tt))==null?void 0:ae.toAffine();return le?a(le.x)===ke:!1}return{CURVE:e,getPublicKey:w,getSharedSecret:x,sign:F,verify:G,ProjectivePoint:u,Signature:y,utils:v}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Mre(t){return{hash:t,hmac:(e,...n)=>N4(t,e,Cne(...n)),randomBytes:Sne}}function Nre(t,e){const n=r=>_re({...t,...Mre(r)});return Object.freeze({...n(e),create:n})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const cR=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),fR=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Rre=BigInt(1),zx=BigInt(2),dR=(t,e)=>(t+e/zx)/e;function Pre(t){const e=cR,n=BigInt(3),r=BigInt(6),s=BigInt(11),i=BigInt(22),o=BigInt(23),a=BigInt(44),l=BigInt(88),u=t*t*t%e,c=u*u*t%e,f=Xr(c,n,e)*c%e,d=Xr(f,n,e)*c%e,h=Xr(d,zx,e)*u%e,p=Xr(h,s,e)*h%e,m=Xr(p,i,e)*p%e,g=Xr(m,a,e)*m%e,y=Xr(g,l,e)*g%e,v=Xr(y,a,e)*m%e,w=Xr(v,n,e)*c%e,A=Xr(w,o,e)*p%e,x=Xr(A,r,e)*u%e,k=Xr(x,zx,e);if(!$x.eql($x.sqr(k),t))throw new Error("Cannot find square root");return k}const $x=vre(cR,void 0,void 0,{sqrt:Pre}),sa=Nre({a:BigInt(0),b:BigInt(7),Fp:$x,n:fR,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=fR,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Rre*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=n,o=BigInt("0x100000000000000000000000000000000"),a=dR(i*t,e),l=dR(-r*t,e);let u=fr(t-a*n-l*s,e),c=fr(-a*r-l*i,e);const f=u>o,d=c>o;if(f&&(u=e-u),d&&(c=e-c),u>o||c>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:f,k1:u,k2neg:d,k2:c}}}},P4);BigInt(0),sa.ProjectivePoint;const Ph="0x0000000000000000000000000000000000000000",hR="0x0000000000000000000000000000000000000000000000000000000000000000",pR=BigInt(0),mR=BigInt(1),gR=BigInt(2),yR=BigInt(27),bR=BigInt(28),ny=BigInt(35),Pc={};function wR(t){return xl(Wn(t),32)}const Ms=class Ms{constructor(e,n,r,s){J(this,cf);J(this,ff);J(this,df);J(this,eu);$g(e,Pc,"Signature"),I(this,cf,n),I(this,ff,r),I(this,df,s),I(this,eu,null)}get r(){return T(this,cf)}set r(e){$(Cc(e)===32,"invalid r","value",e),I(this,cf,we(e))}get s(){return T(this,ff)}set s(e){$(Cc(e)===32,"invalid s","value",e);const n=we(e);$(parseInt(n.substring(0,3))<8,"non-canonical s","value",n),I(this,ff,n)}get v(){return T(this,df)}set v(e){const n=Qe(e,"value");$(n===27||n===28,"invalid v","v",e),I(this,df,n)}get networkV(){return T(this,eu)}get legacyChainId(){const e=this.networkV;return e==null?null:Ms.getChainId(e)}get yParity(){return this.v===27?0:1}get yParityAndS(){const e=ct(this.s);return this.yParity&&(e[0]|=128),we(e)}get compactSerialized(){return $t([this.r,this.yParityAndS])}get serialized(){return $t([this.r,this.s,this.yParity?"0x1c":"0x1b"])}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const e=new Ms(Pc,this.r,this.s,this.v);return this.networkV&&I(e,eu,this.networkV),e}toJSON(){const e=this.networkV;return{_type:"signature",networkV:e!=null?e.toString():null,r:this.r,s:this.s,v:this.v}}static getChainId(e){const n=xe(e,"v");return n==yR||n==bR?pR:($(n>=ny,"invalid EIP-155 v","v",e),(n-ny)/gR)}static getChainIdV(e,n){return xe(e)*gR+BigInt(35+n-27)}static getNormalizedV(e){const n=xe(e);return n===pR||n===yR?27:n===mR||n===bR?28:($(n>=ny,"invalid v","v",e),n&mR?27:28)}static from(e){function n(u,c){$(u,c,"signature",e)}if(e==null)return new Ms(Pc,hR,hR,27);if(typeof e=="string"){const u=ct(e,"signature");if(u.length===64){const c=we(u.slice(0,32)),f=u.slice(32,64),d=f[0]&128?28:27;return f[0]&=127,new Ms(Pc,c,we(f),d)}if(u.length===65){const c=we(u.slice(0,32)),f=u.slice(32,64);n((f[0]&128)===0,"non-canonical s");const d=Ms.getNormalizedV(u[64]);return new Ms(Pc,c,we(f),d)}n(!1,"invalid raw signature length")}if(e instanceof Ms)return e.clone();const r=e.r;n(r!=null,"missing r");const s=wR(r),i=function(u,c){if(u!=null)return wR(u);if(c!=null){n(St(c,32),"invalid yParityAndS");const f=ct(c);return f[0]&=127,we(f)}n(!1,"missing s")}(e.s,e.yParityAndS);n((ct(i)[0]&128)==0,"non-canonical s");const{networkV:o,v:a}=function(u,c,f){if(u!=null){const d=xe(u);return{networkV:d>=ny?d:void 0,v:Ms.getNormalizedV(d)}}if(c!=null)return n(St(c,32),"invalid yParityAndS"),{v:ct(c)[0]&128?28:27};if(f!=null){switch(Qe(f,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}n(!1,"invalid yParity")}n(!1,"missing v")}(e.v,e.yParityAndS,e.yParity),l=new Ms(Pc,s,i,a);return o&&I(l,eu,o),n(e.yParity==null||Qe(e.yParity,"sig.yParity")===l.yParity,"yParity mismatch"),n(e.yParityAndS==null||e.yParityAndS===l.yParityAndS,"yParityAndS mismatch"),l}};cf=new WeakMap,ff=new WeakMap,df=new WeakMap,eu=new WeakMap;let Ss=Ms;const tu=class tu{constructor(e){J(this,oo);$(Cc(e)===32,"invalid private key","privateKey","[REDACTED]"),I(this,oo,we(e))}get privateKey(){return T(this,oo)}get publicKey(){return tu.computePublicKey(T(this,oo))}get compressedPublicKey(){return tu.computePublicKey(T(this,oo),!0)}sign(e){$(Cc(e)===32,"invalid digest length","digest",e);const n=sa.sign(Gn(e),Gn(T(this,oo)),{lowS:!0});return Ss.from({r:Xo(n.r,32),s:Xo(n.s,32),v:n.recovery?28:27})}computeSharedSecret(e){const n=tu.computePublicKey(e);return we(sa.getSharedSecret(Gn(T(this,oo)),ct(n),!1))}static computePublicKey(e,n){let r=ct(e,"key");if(r.length===32){const i=sa.getPublicKey(r,!!n);return we(i)}if(r.length===64){const i=new Uint8Array(65);i[0]=4,i.set(r,1),r=i}const s=sa.ProjectivePoint.fromHex(r);return we(s.toRawBytes(n))}static recoverPublicKey(e,n){$(Cc(e)===32,"invalid digest length","digest",e);const r=Ss.from(n);let s=sa.Signature.fromCompact(Gn($t([r.r,r.s])));s=s.addRecoveryBit(r.yParity);const i=s.recoverPublicKey(Gn(e));return $(i!=null,"invalid signautre for digest","signature",n),"0x"+i.toHex(!1)}static addPoints(e,n,r){const s=sa.ProjectivePoint.fromHex(tu.computePublicKey(e).substring(2)),i=sa.ProjectivePoint.fromHex(tu.computePublicKey(n).substring(2));return"0x"+s.add(i).toHex(!!r)}};oo=new WeakMap;let Ih=tu;const Ire=BigInt(0),Lre=BigInt(36);function AR(t){t=t.toLowerCase();const e=t.substring(2).split(""),n=new Uint8Array(40);for(let s=0;s<40;s++)n[s]=e[s].charCodeAt(0);const r=ct(en(n));for(let s=0;s<40;s+=2)r[s>>1]>>4>=8&&(e[s]=e[s].toUpperCase()),(r[s>>1]&15)>=8&&(e[s+1]=e[s+1].toUpperCase());return"0x"+e.join("")}const Gx={};for(let t=0;t<10;t++)Gx[String(t)]=String(t);for(let t=0;t<26;t++)Gx[String.fromCharCode(65+t)]=String(10+t);const vR=15;function Bre(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(r=>Gx[r]).join("");for(;e.length>=vR;){let r=e.substring(0,vR);e=parseInt(r,10)%97+e.substring(r.length)}let n=String(98-parseInt(e,10)%97);for(;n.length<2;)n="0"+n;return n}const Fre=function(){const t={};for(let e=0;e<36;e++){const n="0123456789abcdefghijklmnopqrstuvwxyz"[e];t[n]=BigInt(e)}return t}();function jre(t){t=t.toLowerCase();let e=Ire;for(let n=0;n<t.length;n++)e=e*Lre+Fre[t[n]];return e}function gt(t){if($(typeof t=="string","invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/)){t.startsWith("0x")||(t="0x"+t);const e=AR(t);return $(!t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||e===t,"bad address checksum","address",t),e}if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){$(t.substring(2,4)===Bre(t),"bad icap checksum","address",t);let e=jre(t.substring(4)).toString(16);for(;e.length<40;)e="0"+e;return AR("0x"+e)}$(!1,"invalid address","address",t)}function Ure(t){const e=gt(t.from);let r=xe(t.nonce,"tx.nonce").toString(16);return r==="0"?r="0x":r.length%2?r="0x0"+r:r="0x"+r,gt(Ht(en(El([e,r])),12))}function xR(t){return t&&typeof t.getAddress=="function"}function Vre(t){try{return gt(t),!0}catch{}return!1}async function Wx(t,e){const n=await e;return(n==null||n==="0x0000000000000000000000000000000000000000")&&(ee(typeof t!="string","unconfigured name","UNCONFIGURED_NAME",{value:t}),$(!1,"invalid AddressLike value; did not resolve to a value address","target",t)),gt(n)}function Qn(t,e){if(typeof t=="string")return t.match(/^0x[0-9a-f]{40}$/i)?gt(t):(ee(e!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),Wx(t,e.resolveName(t)));if(xR(t))return Wx(t,t.getAddress());if(t&&typeof t.then=="function")return Wx(t,t);$(!1,"unsupported addressable value","target",t)}const $i={};function Ae(t,e){let n=!1;return e<0&&(n=!0,e*=-1),new Rn($i,`${n?"":"u"}int${e}`,t,{signed:n,width:e})}function dt(t,e){return new Rn($i,`bytes${e||""}`,t,{size:e})}const kR=Symbol.for("_ethers_typed"),ao=class ao{constructor(e,n,r,s){W(this,"type");W(this,"value");J(this,nu);W(this,"_typedSymbol");s==null&&(s=null),$g($i,e,"Typed"),Oe(this,{_typedSymbol:kR,type:n,value:r}),I(this,nu,s),this.format()}format(){if(this.type==="array")throw new Error("");if(this.type==="dynamicArray")throw new Error("");return this.type==="tuple"?`tuple(${this.value.map(e=>e.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return T(this,nu)}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return T(this,nu)===!0?-1:T(this,nu)===!1?this.value.length:null}static from(e,n){return new ao($i,e,n)}static uint8(e){return Ae(e,8)}static uint16(e){return Ae(e,16)}static uint24(e){return Ae(e,24)}static uint32(e){return Ae(e,32)}static uint40(e){return Ae(e,40)}static uint48(e){return Ae(e,48)}static uint56(e){return Ae(e,56)}static uint64(e){return Ae(e,64)}static uint72(e){return Ae(e,72)}static uint80(e){return Ae(e,80)}static uint88(e){return Ae(e,88)}static uint96(e){return Ae(e,96)}static uint104(e){return Ae(e,104)}static uint112(e){return Ae(e,112)}static uint120(e){return Ae(e,120)}static uint128(e){return Ae(e,128)}static uint136(e){return Ae(e,136)}static uint144(e){return Ae(e,144)}static uint152(e){return Ae(e,152)}static uint160(e){return Ae(e,160)}static uint168(e){return Ae(e,168)}static uint176(e){return Ae(e,176)}static uint184(e){return Ae(e,184)}static uint192(e){return Ae(e,192)}static uint200(e){return Ae(e,200)}static uint208(e){return Ae(e,208)}static uint216(e){return Ae(e,216)}static uint224(e){return Ae(e,224)}static uint232(e){return Ae(e,232)}static uint240(e){return Ae(e,240)}static uint248(e){return Ae(e,248)}static uint256(e){return Ae(e,256)}static uint(e){return Ae(e,256)}static int8(e){return Ae(e,-8)}static int16(e){return Ae(e,-16)}static int24(e){return Ae(e,-24)}static int32(e){return Ae(e,-32)}static int40(e){return Ae(e,-40)}static int48(e){return Ae(e,-48)}static int56(e){return Ae(e,-56)}static int64(e){return Ae(e,-64)}static int72(e){return Ae(e,-72)}static int80(e){return Ae(e,-80)}static int88(e){return Ae(e,-88)}static int96(e){return Ae(e,-96)}static int104(e){return Ae(e,-104)}static int112(e){return Ae(e,-112)}static int120(e){return Ae(e,-120)}static int128(e){return Ae(e,-128)}static int136(e){return Ae(e,-136)}static int144(e){return Ae(e,-144)}static int152(e){return Ae(e,-152)}static int160(e){return Ae(e,-160)}static int168(e){return Ae(e,-168)}static int176(e){return Ae(e,-176)}static int184(e){return Ae(e,-184)}static int192(e){return Ae(e,-192)}static int200(e){return Ae(e,-200)}static int208(e){return Ae(e,-208)}static int216(e){return Ae(e,-216)}static int224(e){return Ae(e,-224)}static int232(e){return Ae(e,-232)}static int240(e){return Ae(e,-240)}static int248(e){return Ae(e,-248)}static int256(e){return Ae(e,-256)}static int(e){return Ae(e,-256)}static bytes1(e){return dt(e,1)}static bytes2(e){return dt(e,2)}static bytes3(e){return dt(e,3)}static bytes4(e){return dt(e,4)}static bytes5(e){return dt(e,5)}static bytes6(e){return dt(e,6)}static bytes7(e){return dt(e,7)}static bytes8(e){return dt(e,8)}static bytes9(e){return dt(e,9)}static bytes10(e){return dt(e,10)}static bytes11(e){return dt(e,11)}static bytes12(e){return dt(e,12)}static bytes13(e){return dt(e,13)}static bytes14(e){return dt(e,14)}static bytes15(e){return dt(e,15)}static bytes16(e){return dt(e,16)}static bytes17(e){return dt(e,17)}static bytes18(e){return dt(e,18)}static bytes19(e){return dt(e,19)}static bytes20(e){return dt(e,20)}static bytes21(e){return dt(e,21)}static bytes22(e){return dt(e,22)}static bytes23(e){return dt(e,23)}static bytes24(e){return dt(e,24)}static bytes25(e){return dt(e,25)}static bytes26(e){return dt(e,26)}static bytes27(e){return dt(e,27)}static bytes28(e){return dt(e,28)}static bytes29(e){return dt(e,29)}static bytes30(e){return dt(e,30)}static bytes31(e){return dt(e,31)}static bytes32(e){return dt(e,32)}static address(e){return new ao($i,"address",e)}static bool(e){return new ao($i,"bool",!!e)}static bytes(e){return new ao($i,"bytes",e)}static string(e){return new ao($i,"string",e)}static array(e,n){throw new Error("not implemented yet")}static tuple(e,n){throw new Error("not implemented yet")}static overrides(e){return new ao($i,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===kR}static dereference(e,n){if(ao.isTyped(e)){if(e.type!==n)throw new Error(`invalid type: expecetd ${n}, got ${e.type}`);return e.value}return e}};nu=new WeakMap;let Rn=ao;class Hre extends Hi{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,n){let r=Rn.dereference(n,"string");try{r=gt(r)}catch(s){return this._throwError(s.message,n)}return e.writeValue(r)}decode(e){return gt(Xo(e.readValue(),20))}}class zre extends Hi{constructor(n){super(n.name,n.type,"_",n.dynamic);W(this,"coder");this.coder=n}defaultValue(){return this.coder.defaultValue()}encode(n,r){return this.coder.encode(n,r)}decode(n){return this.coder.decode(n)}}function ER(t,e,n){let r=[];if(Array.isArray(n))r=n;else if(n&&typeof n=="object"){let l={};r=e.map(u=>{const c=u.localName;return ee(c,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:u},value:n}),ee(!l[c],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:u},value:n}),l[c]=!0,n[c]})}else $(!1,"invalid tuple value","tuple",n);$(e.length===r.length,"types/value length mismatch","tuple",n);let s=new Sx,i=new Sx,o=[];e.forEach((l,u)=>{let c=r[u];if(l.dynamic){let f=i.length;l.encode(i,c);let d=s.writeUpdatableValue();o.push(h=>{d(h+f)})}else l.encode(s,c)}),o.forEach(l=>{l(s.length)});let a=t.appendWriter(s);return a+=t.appendWriter(i),a}function CR(t,e){let n=[],r=[],s=t.subReader(0);return e.forEach(i=>{let o=null;if(i.dynamic){let a=t.readIndex(),l=s.subReader(a);try{o=i.decode(l)}catch(u){if(gn(u,"BUFFER_OVERRUN"))throw u;o=u,o.baseType=i.name,o.name=i.localName,o.type=i.type}}else try{o=i.decode(t)}catch(a){if(gn(a,"BUFFER_OVERRUN"))throw a;o=a,o.baseType=i.name,o.name=i.localName,o.type=i.type}if(o==null)throw new Error("investigate");n.push(o),r.push(i.localName||null)}),Dc.fromItems(n,r)}class $re extends Hi{constructor(n,r,s){const i=n.type+"["+(r>=0?r:"")+"]",o=r===-1||n.dynamic;super("array",i,s,o);W(this,"coder");W(this,"length");Oe(this,{coder:n,length:r})}defaultValue(){const n=this.coder.defaultValue(),r=[];for(let s=0;s<this.length;s++)r.push(n);return r}encode(n,r){const s=Rn.dereference(r,"array");Array.isArray(s)||this._throwError("expected array value",s);let i=this.length;i===-1&&(i=s.length,n.writeValue(s.length)),s4(s.length,i,"coder array"+(this.localName?" "+this.localName:""));let o=[];for(let a=0;a<s.length;a++)o.push(this.coder);return ER(n,o,s)}decode(n){let r=this.length;r===-1&&(r=n.readIndex(),ee(r*qn<=n.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:n.bytes,offset:r*qn,length:n.dataLength}));let s=[];for(let i=0;i<r;i++)s.push(new zre(this.coder));return CR(n,s)}}class Gre extends Hi{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,n){const r=Rn.dereference(n,"bool");return e.writeValue(r?1:0)}decode(e){return!!e.readValue()}}class SR extends Hi{constructor(e,n){super(e,e,n,!0)}defaultValue(){return"0x"}encode(e,n){n=Gn(n);let r=e.writeValue(n.length);return r+=e.writeBytes(n),r}decode(e){return e.readBytes(e.readIndex(),!0)}}class Wre extends SR{constructor(e){super("bytes",e)}decode(e){return we(super.decode(e))}}class Kre extends Hi{constructor(n,r){let s="bytes"+String(n);super(s,s,r,!1);W(this,"size");Oe(this,{size:n},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(n,r){let s=Gn(Rn.dereference(r,this.type));return s.length!==this.size&&this._throwError("incorrect data length",r),n.writeBytes(s)}decode(n){return we(n.readBytes(this.size))}}const qre=new Uint8Array([]);class Qre extends Hi{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,n){return n!=null&&this._throwError("not null",n),e.writeBytes(qre)}decode(e){return e.readBytes(0),null}}const Jre=BigInt(0),Yre=BigInt(1),Xre=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class Zre extends Hi{constructor(n,r,s){const i=(r?"int":"uint")+n*8;super(i,i,s,!1);W(this,"size");W(this,"signed");Oe(this,{size:n,signed:r},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(n,r){let s=xe(Rn.dereference(r,this.type)),i=Oh(Xre,qn*8);if(this.signed){let o=Oh(i,this.size*8-1);(s>o||s<-(o+Yre))&&this._throwError("value out-of-bounds",r),s=l4(s,8*qn)}else(s<Jre||s>Oh(i,this.size*8))&&this._throwError("value out-of-bounds",r);return n.writeValue(s)}decode(n){let r=Oh(n.readValue(),this.size*8);return this.signed&&(r=rne(r,this.size*8)),r}}class ese extends SR{constructor(e){super("string",e)}defaultValue(){return""}encode(e,n){return super.encode(e,Vi(Rn.dereference(n,"string")))}decode(e){return Tc(super.decode(e))}}class ry extends Hi{constructor(n,r){let s=!1;const i=[];n.forEach(a=>{a.dynamic&&(s=!0),i.push(a.type)});const o="tuple("+i.join(",")+")";super("tuple",o,r,s);W(this,"coders");Oe(this,{coders:Object.freeze(n.slice())})}defaultValue(){const n=[];this.coders.forEach(s=>{n.push(s.defaultValue())});const r=this.coders.reduce((s,i)=>{const o=i.localName;return o&&(s[o]||(s[o]=0),s[o]++),s},{});return this.coders.forEach((s,i)=>{let o=s.localName;!o||r[o]!==1||(o==="length"&&(o="_length"),n[o]==null&&(n[o]=n[i]))}),Object.freeze(n)}encode(n,r){const s=Rn.dereference(r,"tuple");return ER(n,this.coders,s)}decode(n){return CR(n,this.coders)}}function Ol(t){return en(Vi(t))}var tse="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";const TR=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),DR=4;function nse(t){let e=0;function n(){return t[e++]<<8|t[e++]}let r=n(),s=1,i=[0,1];for(let x=1;x<r;x++)i.push(s+=n());let o=n(),a=e;e+=o;let l=0,u=0;function c(){return l==0&&(u=u<<8|t[e++],l=8),u>>--l&1}const f=31,d=2**f,h=d>>>1,p=h>>1,m=d-1;let g=0;for(let x=0;x<f;x++)g=g<<1|c();let y=[],v=0,w=d;for(;;){let x=Math.floor(((g-v+1)*s-1)/w),k=0,C=r;for(;C-k>1;){let D=k+C>>>1;x<i[D]?C=D:k=D}if(k==0)break;y.push(k);let O=v+Math.floor(w*i[k]/s),_=v+Math.floor(w*i[k+1]/s)-1;for(;!((O^_)&h);)g=g<<1&m|c(),O=O<<1&m,_=_<<1&m|1;for(;O&~_&p;)g=g&h|g<<1&m>>>1|c(),O=O<<1^h,_=(_^h)<<1|h|1;v=O,w=1+_-O}let A=r-4;return y.map(x=>{switch(x-A){case 3:return A+65792+(t[a++]<<16|t[a++]<<8|t[a++]);case 2:return A+256+(t[a++]<<8|t[a++]);case 1:return A+t[a++];default:return x-1}})}function rse(t){let e=0;return()=>t[e++]}function OR(t){return rse(nse(sse(t)))}function sse(t){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((s,i)=>e[s.charCodeAt(0)]=i);let n=t.length,r=new Uint8Array(6*n>>3);for(let s=0,i=0,o=0,a=0;s<n;s++)a=a<<6|e[t.charCodeAt(s)],o+=6,o>=8&&(r[i++]=a>>(o-=8));return r}function ise(t){return t&1?~t>>1:t>>1}function ose(t,e){let n=Array(t);for(let r=0,s=0;r<t;r++)n[r]=s+=ise(e());return n}function Lh(t,e=0){let n=[];for(;;){let r=t(),s=t();if(!s)break;e+=r;for(let i=0;i<s;i++)n.push(e+i);e+=s+1}return n}function _R(t){return Bh(()=>{let e=Lh(t);if(e.length)return e})}function MR(t){let e=[];for(;;){let n=t();if(n==0)break;e.push(ase(n,t))}for(;;){let n=t()-1;if(n<0)break;e.push(lse(n,t))}return e.flat()}function Bh(t){let e=[];for(;;){let n=t(e.length);if(!n)break;e.push(n)}return e}function NR(t,e,n){let r=Array(t).fill().map(()=>[]);for(let s=0;s<e;s++)ose(t,n).forEach((i,o)=>r[o].push(i));return r}function ase(t,e){let n=1+e(),r=e(),s=Bh(e);return NR(s.length,1+t,e).flatMap((o,a)=>{let[l,...u]=o;return Array(s[a]).fill().map((c,f)=>{let d=f*r;return[l+f*n,u.map(h=>h+d)]})})}function lse(t,e){let n=1+e();return NR(n,1+t,e).map(s=>[s[0],s.slice(1)])}function use(t){let e=[],n=Lh(t);return s(r([]),[]),e;function r(i){let o=t(),a=Bh(()=>{let l=Lh(t).map(u=>n[u]);if(l.length)return r(l)});return{S:o,B:a,Q:i}}function s({S:i,B:o},a,l){if(!(i&4&&l===a[a.length-1])){i&2&&(l=a[a.length-1]),i&1&&e.push(a);for(let u of o)for(let c of u.Q)s(u,[...a,c],l)}}}function cse(t){return t.toString(16).toUpperCase().padStart(2,"0")}function RR(t){return`{${cse(t)}}`}function fse(t){let e=[];for(let n=0,r=t.length;n<r;){let s=t.codePointAt(n);n+=s<65536?1:2,e.push(s)}return e}function Ic(t){let n=t.length;if(n<4096)return String.fromCodePoint(...t);let r=[];for(let s=0;s<n;)r.push(String.fromCodePoint(...t.slice(s,s+=4096)));return r.join("")}function dse(t,e){let n=t.length,r=n-e.length;for(let s=0;r==0&&s<n;s++)r=t[s]-e[s];return r}var hse="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";const Fh=44032,sy=4352,iy=4449,oy=4519,PR=19,IR=21,Lc=28,ay=IR*Lc,pse=PR*ay,mse=Fh+pse,gse=sy+PR,yse=iy+IR,bse=oy+Lc;function jh(t){return t>>24&255}function LR(t){return t&16777215}let Kx,BR,qx,ly;function wse(){let t=OR(hse);Kx=new Map(_R(t).flatMap((e,n)=>e.map(r=>[r,n+1<<24]))),BR=new Set(Lh(t)),qx=new Map,ly=new Map;for(let[e,n]of MR(t)){if(!BR.has(e)&&n.length==2){let[r,s]=n,i=ly.get(r);i||(i=new Map,ly.set(r,i)),i.set(s,e)}qx.set(e,n.reverse())}}function FR(t){return t>=Fh&&t<mse}function Ase(t,e){if(t>=sy&&t<gse&&e>=iy&&e<yse)return Fh+(t-sy)*ay+(e-iy)*Lc;if(FR(t)&&e>oy&&e<bse&&(t-Fh)%Lc==0)return t+(e-oy);{let n=ly.get(t);return n&&(n=n.get(e),n)?n:-1}}function jR(t){Kx||wse();let e=[],n=[],r=!1;function s(i){let o=Kx.get(i);o&&(r=!0,i|=o),e.push(i)}for(let i of t)for(;;){if(i<128)e.push(i);else if(FR(i)){let o=i-Fh,a=o/ay|0,l=o%ay/Lc|0,u=o%Lc;s(sy+a),s(iy+l),u>0&&s(oy+u)}else{let o=qx.get(i);o?n.push(...o):s(i)}if(!n.length)break;i=n.pop()}if(r&&e.length>1){let i=jh(e[0]);for(let o=1;o<e.length;o++){let a=jh(e[o]);if(a==0||i<=a){i=a;continue}let l=o-1;for(;;){let u=e[l+1];if(e[l+1]=e[l],e[l]=u,!l||(i=jh(e[--l]),i<=a))break}i=jh(e[o])}}return e}function vse(t){let e=[],n=[],r=-1,s=0;for(let i of t){let o=jh(i),a=LR(i);if(r==-1)o==0?r=a:e.push(a);else if(s>0&&s>=o)o==0?(e.push(r,...n),n.length=0,r=a):n.push(a),s=o;else{let l=Ase(r,a);l>=0?r=l:s==0&&o==0?(e.push(r),r=a):(n.push(a),s=o)}}return r>=0&&e.push(r,...n),e}function UR(t){return jR(t).map(LR)}function xse(t){return vse(jR(t))}const VR=45,HR=".",zR=65039,$R=1,uy=t=>Array.from(t);function Uh(t,e){return t.P.has(e)||t.Q.has(e)}class kse extends Array{get is_emoji(){return!0}}let Qx,GR,_l,Jx,WR,Bc,Yx,Fc,Ml,KR,Xx;function Zx(){if(Qx)return;let t=OR(tse);const e=()=>Lh(t),n=()=>new Set(e()),r=(c,f)=>f.forEach(d=>c.add(d));Qx=new Map(MR(t)),GR=n(),_l=e(),Jx=new Set(e().map(c=>_l[c])),_l=new Set(_l),WR=n(),n();let s=_R(t),i=t();const o=()=>{let c=new Set;return e().forEach(f=>r(c,s[f])),r(c,e()),c};Bc=Bh(c=>{let f=Bh(t).map(d=>d+96);if(f.length){let d=c>=i;f[0]-=32,f=Ic(f),d&&(f=`Restricted[${f}]`);let h=o(),p=o(),m=!t();return{N:f,P:h,Q:p,M:m,R:d}}}),Yx=n(),Fc=new Map;let a=e().concat(uy(Yx)).sort((c,f)=>c-f);a.forEach((c,f)=>{let d=t(),h=a[f]=d?a[f-d]:{V:[],M:new Map};h.V.push(c),Yx.has(c)||Fc.set(c,h)});for(let{V:c,M:f}of new Set(Fc.values())){let d=[];for(let p of c){let m=Bc.filter(y=>Uh(y,p)),g=d.find(({G:y})=>m.some(v=>y.has(v)));g||(g={G:new Set,V:[]},d.push(g)),g.V.push(p),r(g.G,m)}let h=d.flatMap(p=>uy(p.G));for(let{G:p,V:m}of d){let g=new Set(h.filter(y=>!p.has(y)));for(let y of m)f.set(y,g)}}Ml=new Set;let l=new Set;const u=c=>Ml.has(c)?l.add(c):Ml.add(c);for(let c of Bc){for(let f of c.P)u(f);for(let f of c.Q)u(f)}for(let c of Ml)!Fc.has(c)&&!l.has(c)&&Fc.set(c,$R);r(Ml,UR(Ml)),KR=use(t).map(c=>kse.from(c)).sort(dse),Xx=new Map;for(let c of KR){let f=[Xx];for(let d of c){let h=f.map(p=>{let m=p.get(d);return m||(m=new Map,p.set(d,m)),m});d===zR?f.push(...h):f=h}for(let d of f)d.V=c}}function e2(t){return(qR(t)?"":`${t2(cy([t]))} `)+RR(t)}function t2(t){return`"${t}"‎`}function Ese(t){if(t.length>=4&&t[2]==VR&&t[3]==VR)throw new Error(`invalid label extension: "${Ic(t.slice(0,4))}"`)}function Cse(t){for(let n=t.lastIndexOf(95);n>0;)if(t[--n]!==95)throw new Error("underscore allowed only at start")}function Sse(t){let e=t[0],n=TR.get(e);if(n)throw Vh(`leading ${n}`);let r=t.length,s=-1;for(let i=1;i<r;i++){e=t[i];let o=TR.get(e);if(o){if(s==i)throw Vh(`${n} + ${o}`);s=i+1,n=o}}if(s==r)throw Vh(`trailing ${n}`)}function cy(t,e=1/0,n=RR){let r=[];Tse(t[0])&&r.push("◌"),t.length>e&&(e>>=1,t=[...t.slice(0,e),8230,...t.slice(-e)]);let s=0,i=t.length;for(let o=0;o<i;o++){let a=t[o];qR(a)&&(r.push(Ic(t.slice(s,o))),r.push(n(a)),s=o+1)}return r.push(Ic(t.slice(s,i))),r.join("")}function Tse(t){return Zx(),_l.has(t)}function qR(t){return Zx(),WR.has(t)}function Dse(t){return Nse(Ose(t,xse,Ise))}function Ose(t,e,n){if(!t)return[];Zx();let r=0;return t.split(HR).map(s=>{let i=fse(s),o={input:i,offset:r};r+=i.length+1;try{let a=o.tokens=Pse(i,e,n),l=a.length,u;if(!l)throw new Error("empty label");let c=o.output=a.flat();if(Cse(c),!(o.emoji=l>1||a[0].is_emoji)&&c.every(d=>d<128))Ese(c),u="ASCII";else{let d=a.flatMap(h=>h.is_emoji?[]:h);if(!d.length)u="Emoji";else{if(_l.has(c[0]))throw Vh("leading combining mark");for(let m=1;m<l;m++){let g=a[m];if(!g.is_emoji&&_l.has(g[0]))throw Vh(`emoji + combining mark: "${Ic(a[m-1])} + ${cy([g[0]])}"`)}Sse(c);let h=uy(new Set(d)),[p]=Mse(h);Rse(p,d),_se(p,h),u=p.N}}o.type=u}catch(a){o.error=a}return o})}function _se(t,e){let n,r=[];for(let s of e){let i=Fc.get(s);if(i===$R)return;if(i){let o=i.M.get(s);if(n=n?n.filter(a=>o.has(a)):uy(o),!n.length)return}else r.push(s)}if(n){for(let s of n)if(r.every(i=>Uh(s,i)))throw new Error(`whole-script confusable: ${t.N}/${s.N}`)}}function Mse(t){let e=Bc;for(let n of t){let r=e.filter(s=>Uh(s,n));if(!r.length)throw Bc.some(s=>Uh(s,n))?JR(e[0],n):QR(n);if(e=r,r.length==1)break}return e}function Nse(t){return t.map(({input:e,error:n,output:r})=>{if(n){let s=n.message;throw new Error(t.length==1?s:`Invalid label ${t2(cy(e,63))}: ${s}`)}return Ic(r)}).join(HR)}function QR(t){return new Error(`disallowed character: ${e2(t)}`)}function JR(t,e){let n=e2(e),r=Bc.find(s=>s.P.has(e));return r&&(n=`${r.N} ${n}`),new Error(`illegal mixture: ${t.N} + ${n}`)}function Vh(t){return new Error(`illegal placement: ${t}`)}function Rse(t,e){for(let n of e)if(!Uh(t,n))throw JR(t,n);if(t.M){let n=UR(e);for(let r=1,s=n.length;r<s;r++)if(Jx.has(n[r])){let i=r+1;for(let o;i<s&&Jx.has(o=n[i]);i++)for(let a=r;a<i;a++)if(n[a]==o)throw new Error(`duplicate non-spacing marks: ${e2(o)}`);if(i-r>DR)throw new Error(`excessive non-spacing marks: ${t2(cy(n.slice(r-1,i)))} (${i-r}/${DR})`);r=i}}}function Pse(t,e,n){let r=[],s=[];for(t=t.slice().reverse();t.length;){let i=Lse(t);if(i)s.length&&(r.push(e(s)),s=[]),r.push(n(i));else{let o=t.pop();if(Ml.has(o))s.push(o);else{let a=Qx.get(o);if(a)s.push(...a);else if(!GR.has(o))throw QR(o)}}}return s.length&&r.push(e(s)),r}function Ise(t){return t.filter(e=>e!=zR)}function Lse(t,e){let n=Xx,r,s=t.length;for(;s&&(n=n.get(t[--s]),!!n);){let{V:i}=n;i&&(r=i,t.length=s)}return r}const YR=new Uint8Array(32);YR.fill(0);function XR(t){return $(t.length!==0,"invalid ENS name; empty component","comp",t),t}function ZR(t){const e=Vi(Bse(t)),n=[];if(t.length===0)return n;let r=0;for(let s=0;s<e.length;s++)e[s]===46&&(n.push(XR(e.slice(r,s))),r=s+1);return $(r<e.length,"invalid ENS name; empty component","name",t),n.push(XR(e.slice(r))),n}function Bse(t){try{if(t.length===0)throw new Error("empty label");return Dse(t)}catch(e){$(!1,`invalid ENS name (${e.message})`,"name",t)}}function n2(t){$(typeof t=="string","invalid ENS name; not a string","name",t),$(t.length,"invalid ENS name (empty label)","name",t);let e=YR;const n=ZR(t);for(;n.length;)e=en($t([e,en(n.pop())]));return we(e)}function Fse(t,e){const n=e;return $(n<=255,"DNS encoded label cannot exceed 255","length",n),we($t(ZR(t).map(r=>{$(r.length<=n,`label ${JSON.stringify(t)} exceeds ${n} bytes`,"name",t);const s=new Uint8Array(r.length+1);return s.set(r,1),s[0]=s.length-1,s})))+"00"}function r2(t,e){return{address:gt(t),storageKeys:e.map((n,r)=>($(St(n,32),"invalid slot",`storageKeys[${r}]`,n),n.toLowerCase()))}}function ia(t){if(Array.isArray(t))return t.map((n,r)=>Array.isArray(n)?($(n.length===2,"invalid slot set",`value[${r}]`,n),r2(n[0],n[1])):($(n!=null&&typeof n=="object","invalid address-slot set","value",t),r2(n.address,n.storageKeys)));$(t!=null&&typeof t=="object","invalid access list","value",t);const e=Object.keys(t).map(n=>{const r=t[n].reduce((s,i)=>(s[i]=!0,s),{});return r2(n,Object.keys(r).sort())});return e.sort((n,r)=>n.address.localeCompare(r.address)),e}function jse(t){let e;return typeof t=="string"?e=Ih.computePublicKey(t,!1):e=t.publicKey,gt(en("0x"+e.substring(4)).substring(26))}function Use(t,e){return jse(Ih.recoverPublicKey(t,e))}const bn=BigInt(0),Vse=BigInt(2),Hse=BigInt(27),zse=BigInt(28),$se=BigInt(35),Gse=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),s2=4096*32;function eP(t,e){let n=t.toString(16);for(;n.length<2;)n="0"+n;return n+=_c(e).substring(4),"0x"+n}function fy(t){return t==="0x"?null:gt(t)}function i2(t,e){try{return ia(t)}catch(n){$(!1,n.message,e,t)}}function Hh(t,e){return t==="0x"?0:Qe(t,e)}function Wt(t,e){if(t==="0x")return bn;const n=xe(t,e);return $(n<=Gse,"value exceeds uint size",e,n),n}function Ot(t,e){const n=xe(t,"value"),r=Wn(n);return $(r.length<=32,"value too large",`tx.${e}`,n),r}function o2(t){return ia(t).map(e=>[e.address,e.storageKeys])}function Wse(t,e){$(Array.isArray(t),`invalid ${e}`,"value",t);for(let n=0;n<t.length;n++)$(St(t[n],32),"invalid ${ param } hash",`value[${n}]`,t[n]);return t}function Kse(t){const e=Qg(t);$(Array.isArray(e)&&(e.length===9||e.length===6),"invalid field count for legacy transaction","data",t);const n={type:0,nonce:Hh(e[0],"nonce"),gasPrice:Wt(e[1],"gasPrice"),gasLimit:Wt(e[2],"gasLimit"),to:fy(e[3]),value:Wt(e[4],"value"),data:we(e[5]),chainId:bn};if(e.length===6)return n;const r=Wt(e[6],"v"),s=Wt(e[7],"r"),i=Wt(e[8],"s");if(s===bn&&i===bn)n.chainId=r;else{let o=(r-$se)/Vse;o<bn&&(o=bn),n.chainId=o,$(o!==bn||r===Hse||r===zse,"non-canonical legacy v","v",e[6]),n.signature=Ss.from({r:xl(e[7],32),s:xl(e[8],32),v:r})}return n}function qse(t,e){const n=[Ot(t.nonce,"nonce"),Ot(t.gasPrice||0,"gasPrice"),Ot(t.gasLimit,"gasLimit"),t.to||"0x",Ot(t.value,"value"),t.data];let r=bn;if(t.chainId!=bn)r=xe(t.chainId,"tx.chainId"),$(!e||e.networkV==null||e.legacyChainId===r,"tx.chainId/sig.v mismatch","sig",e);else if(t.signature){const i=t.signature.legacyChainId;i!=null&&(r=i)}if(!e)return r!==bn&&(n.push(Wn(r)),n.push("0x"),n.push("0x")),El(n);let s=BigInt(27+e.yParity);return r!==bn?s=Ss.getChainIdV(r,e.v):BigInt(e.v)!==s&&$(!1,"tx.chainId/sig.v mismatch","sig",e),n.push(Wn(s)),n.push(Wn(e.r)),n.push(Wn(e.s)),El(n)}function a2(t,e){let n;try{if(n=Hh(e[0],"yParity"),n!==0&&n!==1)throw new Error("bad yParity")}catch{$(!1,"invalid yParity","yParity",e[0])}const r=xl(e[1],32),s=xl(e[2],32),i=Ss.from({r,s,yParity:n});t.signature=i}function Qse(t){const e=Qg(ct(t).slice(1));$(Array.isArray(e)&&(e.length===9||e.length===12),"invalid field count for transaction type: 2","data",we(t));const n={type:2,chainId:Wt(e[0],"chainId"),nonce:Hh(e[1],"nonce"),maxPriorityFeePerGas:Wt(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Wt(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Wt(e[4],"gasLimit"),to:fy(e[5]),value:Wt(e[6],"value"),data:we(e[7]),accessList:i2(e[8],"accessList")};return e.length===9||a2(n,e.slice(9)),n}function Jse(t,e){const n=[Ot(t.chainId,"chainId"),Ot(t.nonce,"nonce"),Ot(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Ot(t.maxFeePerGas||0,"maxFeePerGas"),Ot(t.gasLimit,"gasLimit"),t.to||"0x",Ot(t.value,"value"),t.data,o2(t.accessList||[])];return e&&(n.push(Ot(e.yParity,"yParity")),n.push(Wn(e.r)),n.push(Wn(e.s))),$t(["0x02",El(n)])}function Yse(t){const e=Qg(ct(t).slice(1));$(Array.isArray(e)&&(e.length===8||e.length===11),"invalid field count for transaction type: 1","data",we(t));const n={type:1,chainId:Wt(e[0],"chainId"),nonce:Hh(e[1],"nonce"),gasPrice:Wt(e[2],"gasPrice"),gasLimit:Wt(e[3],"gasLimit"),to:fy(e[4]),value:Wt(e[5],"value"),data:we(e[6]),accessList:i2(e[7],"accessList")};return e.length===8||a2(n,e.slice(8)),n}function Xse(t,e){const n=[Ot(t.chainId,"chainId"),Ot(t.nonce,"nonce"),Ot(t.gasPrice||0,"gasPrice"),Ot(t.gasLimit,"gasLimit"),t.to||"0x",Ot(t.value,"value"),t.data,o2(t.accessList||[])];return e&&(n.push(Ot(e.yParity,"recoveryParam")),n.push(Wn(e.r)),n.push(Wn(e.s))),$t(["0x01",El(n)])}function Zse(t){let e=Qg(ct(t).slice(1)),n="3",r=null;if(e.length===4&&Array.isArray(e[0])){n="3 (network format)";const i=e[1],o=e[2],a=e[3];$(Array.isArray(i),"invalid network format: blobs not an array","fields[1]",i),$(Array.isArray(o),"invalid network format: commitments not an array","fields[2]",o),$(Array.isArray(a),"invalid network format: proofs not an array","fields[3]",a),$(i.length===o.length,"invalid network format: blobs/commitments length mismatch","fields",e),$(i.length===a.length,"invalid network format: blobs/proofs length mismatch","fields",e),r=[];for(let l=0;l<e[1].length;l++)r.push({data:i[l],commitment:o[l],proof:a[l]});e=e[0]}$(Array.isArray(e)&&(e.length===11||e.length===14),`invalid field count for transaction type: ${n}`,"data",we(t));const s={type:3,chainId:Wt(e[0],"chainId"),nonce:Hh(e[1],"nonce"),maxPriorityFeePerGas:Wt(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Wt(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Wt(e[4],"gasLimit"),to:fy(e[5]),value:Wt(e[6],"value"),data:we(e[7]),accessList:i2(e[8],"accessList"),maxFeePerBlobGas:Wt(e[9],"maxFeePerBlobGas"),blobVersionedHashes:e[10]};r&&(s.blobs=r),$(s.to!=null,`invalid address for transaction type: ${n}`,"data",t),$(Array.isArray(s.blobVersionedHashes),"invalid blobVersionedHashes: must be an array","data",t);for(let i=0;i<s.blobVersionedHashes.length;i++)$(St(s.blobVersionedHashes[i],32),`invalid blobVersionedHash at index ${i}: must be length 32`,"data",t);return e.length===11||a2(s,e.slice(11)),s}function eie(t,e,n){const r=[Ot(t.chainId,"chainId"),Ot(t.nonce,"nonce"),Ot(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Ot(t.maxFeePerGas||0,"maxFeePerGas"),Ot(t.gasLimit,"gasLimit"),t.to||Ph,Ot(t.value,"value"),t.data,o2(t.accessList||[]),Ot(t.maxFeePerBlobGas||0,"maxFeePerBlobGas"),Wse(t.blobVersionedHashes||[],"blobVersionedHashes")];return e&&(r.push(Ot(e.yParity,"yParity")),r.push(Wn(e.r)),r.push(Wn(e.s)),n)?$t(["0x03",El([r,n.map(s=>s.data),n.map(s=>s.commitment),n.map(s=>s.proof)])]):$t(["0x03",El(r)])}const uo=class uo{constructor(){J(this,Ef);J(this,pi);J(this,hf);J(this,pf);J(this,mf);J(this,gf);J(this,yf);J(this,bf);J(this,wf);J(this,Af);J(this,vf);J(this,xf);J(this,kf);J(this,ru);J(this,ga);J(this,lo);J(this,ya);I(this,pi,null),I(this,hf,null),I(this,mf,0),I(this,gf,bn),I(this,yf,null),I(this,bf,null),I(this,wf,null),I(this,pf,"0x"),I(this,Af,bn),I(this,vf,bn),I(this,xf,null),I(this,kf,null),I(this,ru,null),I(this,ga,null),I(this,ya,null),I(this,lo,null)}get type(){return T(this,pi)}set type(e){switch(e){case null:I(this,pi,null);break;case 0:case"legacy":I(this,pi,0);break;case 1:case"berlin":case"eip-2930":I(this,pi,1);break;case 2:case"london":case"eip-1559":I(this,pi,2);break;case 3:case"cancun":case"eip-4844":I(this,pi,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,hf);return e==null&&this.type===3?Ph:e}set to(e){I(this,hf,e==null?null:gt(e))}get nonce(){return T(this,mf)}set nonce(e){I(this,mf,Qe(e,"value"))}get gasLimit(){return T(this,gf)}set gasLimit(e){I(this,gf,xe(e))}get gasPrice(){const e=T(this,yf);return e==null&&(this.type===0||this.type===1)?bn:e}set gasPrice(e){I(this,yf,e==null?null:xe(e,"gasPrice"))}get maxPriorityFeePerGas(){const e=T(this,bf);return e??(this.type===2||this.type===3?bn:null)}set maxPriorityFeePerGas(e){I(this,bf,e==null?null:xe(e,"maxPriorityFeePerGas"))}get maxFeePerGas(){const e=T(this,wf);return e??(this.type===2||this.type===3?bn:null)}set maxFeePerGas(e){I(this,wf,e==null?null:xe(e,"maxFeePerGas"))}get data(){return T(this,pf)}set data(e){I(this,pf,we(e))}get value(){return T(this,Af)}set value(e){I(this,Af,xe(e,"value"))}get chainId(){return T(this,vf)}set chainId(e){I(this,vf,xe(e))}get signature(){return T(this,xf)||null}set signature(e){I(this,xf,e==null?null:Ss.from(e))}get accessList(){const e=T(this,kf)||null;return e??(this.type===1||this.type===2||this.type===3?[]:null)}set accessList(e){I(this,kf,e==null?null:ia(e))}get maxFeePerBlobGas(){const e=T(this,ru);return e==null&&this.type===3?bn:e}set maxFeePerBlobGas(e){I(this,ru,e==null?null:xe(e,"maxFeePerBlobGas"))}get blobVersionedHashes(){let e=T(this,ga);return e==null&&this.type===3?[]:e}set blobVersionedHashes(e){if(e!=null){$(Array.isArray(e),"blobVersionedHashes must be an Array","value",e),e=e.slice();for(let n=0;n<e.length;n++)$(St(e[n],32),"invalid blobVersionedHash",`value[${n}]`,e[n])}I(this,ga,e)}get blobs(){return T(this,ya)==null?null:T(this,ya).map(e=>Object.assign({},e))}set blobs(e){if(e==null){I(this,ya,null);return}const n=[],r=[];for(let s=0;s<e.length;s++){const i=e[s];if(vx(i)){ee(T(this,lo),"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let o=ct(i);if($(o.length<=s2,"blob is too large",`blobs[${s}]`,i),o.length!==s2){const u=new Uint8Array(s2);u.set(o),o=u}const a=T(this,lo).blobToKzgCommitment(o),l=we(T(this,lo).computeBlobKzgProof(o,a));n.push({data:we(o),commitment:we(a),proof:l}),r.push(eP(1,a))}else{const o=we(i.commitment);n.push({data:we(i.data),commitment:o,proof:we(i.proof)}),r.push(eP(1,o))}}I(this,ya,n),I(this,ga,r)}get kzg(){return T(this,lo)}set kzg(e){I(this,lo,e)}get hash(){return this.signature==null?null:en(fe(this,Ef,db).call(this,!0,!1))}get unsignedHash(){return en(this.unsignedSerialized)}get from(){return this.signature==null?null:Use(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,Ef,db).call(this,!0,!0)}get unsignedSerialized(){return fe(this,Ef,db).call(this,!1,!1)}inferType(){const e=this.inferTypes();return e.indexOf(2)>=0?2:e.pop()}inferTypes(){const e=this.gasPrice!=null,n=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,r=this.accessList!=null,s=T(this,ru)!=null||T(this,ga);this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&ee(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),ee(!n||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),ee(this.type!==0||!r,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const i=[];return this.type!=null?i.push(this.type):n?i.push(2):e?(i.push(1),r||i.push(0)):r?(i.push(1),i.push(2)):(s&&this.to||(i.push(0),i.push(1),i.push(2)),i.push(3)),i.sort(),i}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}clone(){return uo.from(this)}toJSON(){const e=n=>n==null?null:n.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:e(this.gasLimit),gasPrice:e(this.gasPrice),maxPriorityFeePerGas:e(this.maxPriorityFeePerGas),maxFeePerGas:e(this.maxFeePerGas),value:e(this.value),chainId:e(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(e){if(e==null)return new uo;if(typeof e=="string"){const r=ct(e);if(r[0]>=127)return uo.from(Kse(r));switch(r[0]){case 1:return uo.from(Yse(r));case 2:return uo.from(Qse(r));case 3:return uo.from(Zse(r))}ee(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const n=new uo;return e.type!=null&&(n.type=e.type),e.to!=null&&(n.to=e.to),e.nonce!=null&&(n.nonce=e.nonce),e.gasLimit!=null&&(n.gasLimit=e.gasLimit),e.gasPrice!=null&&(n.gasPrice=e.gasPrice),e.maxPriorityFeePerGas!=null&&(n.maxPriorityFeePerGas=e.maxPriorityFeePerGas),e.maxFeePerGas!=null&&(n.maxFeePerGas=e.maxFeePerGas),e.maxFeePerBlobGas!=null&&(n.maxFeePerBlobGas=e.maxFeePerBlobGas),e.data!=null&&(n.data=e.data),e.value!=null&&(n.value=e.value),e.chainId!=null&&(n.chainId=e.chainId),e.signature!=null&&(n.signature=Ss.from(e.signature)),e.accessList!=null&&(n.accessList=e.accessList),e.blobVersionedHashes!=null&&(n.blobVersionedHashes=e.blobVersionedHashes),e.kzg!=null&&(n.kzg=e.kzg),e.blobs!=null&&(n.blobs=e.blobs),e.hash!=null&&($(n.isSigned(),"unsigned transaction cannot define '.hash'","tx",e),$(n.hash===e.hash,"hash mismatch","tx",e)),e.from!=null&&($(n.isSigned(),"unsigned transaction cannot define '.from'","tx",e),$(n.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),n}};pi=new WeakMap,hf=new WeakMap,pf=new WeakMap,mf=new WeakMap,gf=new WeakMap,yf=new WeakMap,bf=new WeakMap,wf=new WeakMap,Af=new WeakMap,vf=new WeakMap,xf=new WeakMap,kf=new WeakMap,ru=new WeakMap,ga=new WeakMap,lo=new WeakMap,ya=new WeakMap,Ef=new WeakSet,db=function(e,n){ee(!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 qse(this,r);case 1:return Xse(this,r);case 2:return Jse(this,r);case 3:return eie(this,r,n?this.blobs:null)}ee(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})};let zh=uo;const tP=new Uint8Array(32);tP.fill(0);const tie=BigInt(-1),nP=BigInt(0),rP=BigInt(1),nie=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function rie(t){const e=ct(t),n=e.length%32;return n?$t([e,tP.slice(n)]):we(e)}const sie=Xo(rP,32),iie=Xo(nP,32),sP={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},l2=["name","version","chainId","verifyingContract","salt"];function iP(t){return function(e){return $(typeof e=="string",`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const oie={name:iP("name"),version:iP("version"),chainId:function(t){const e=xe(t,"domain.chainId");return $(e>=0,"invalid chain ID","domain.chainId",t),Number.isSafeInteger(e)?Number(e):kl(e)},verifyingContract:function(t){try{return gt(t).toLowerCase()}catch{}$(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){const e=ct(t,"domain.salt");return $(e.length===32,'invalid domain value "salt"',"domain.salt",t),we(e)}};function u2(t){{const e=t.match(/^(u?)int(\d+)$/);if(e){const n=e[1]==="",r=parseInt(e[2]);$(r%8===0&&r!==0&&r<=256&&e[2]===String(r),"invalid numeric width","type",t);const s=Oh(nie,n?r-1:r),i=n?(s+rP)*tie:nP;return function(o){const a=xe(o,"value");return $(a>=i&&a<=s,`value out-of-bounds for ${t}`,"value",a),Xo(n?l4(a,256):a,32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const n=parseInt(e[1]);return $(n!==0&&n<=32&&e[1]===String(n),"invalid bytes width","type",t),function(r){const s=ct(r);return $(s.length===n,`invalid length for ${t}`,"value",r),rie(r)}}}switch(t){case"address":return function(e){return xl(gt(e),32)};case"bool":return function(e){return e?sie:iie};case"bytes":return function(e){return en(e)};case"string":return function(e){return Ol(e)}}return null}function oP(t,e){return`${t}(${e.map(({name:n,type:r})=>r+" "+n).join(",")})`}function dy(t){const e=t.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);return e?{base:e[1],index:e[2]+e[4],array:{base:e[1],prefix:e[1]+e[2],count:e[5]?parseInt(e[5]):-1}}:{base:t}}const ns=class ns{constructor(e){J(this,ib);W(this,"primaryType");J(this,gp);J(this,co);J(this,Cf);I(this,co,new Map),I(this,Cf,new Map);const n=new Map,r=new Map,s=new Map,i={};Object.keys(e).forEach(l=>{i[l]=e[l].map(({name:u,type:c})=>{let{base:f,index:d}=dy(c);return f==="int"&&!e.int&&(f="int256"),f==="uint"&&!e.uint&&(f="uint256"),{name:u,type:f+(d||"")}}),n.set(l,new Set),r.set(l,[]),s.set(l,new Set)}),I(this,gp,JSON.stringify(i));for(const l in i){const u=new Set;for(const c of i[l]){$(!u.has(c.name),`duplicate variable name ${JSON.stringify(c.name)} in ${JSON.stringify(l)}`,"types",e),u.add(c.name);const f=dy(c.type).base;$(f!==l,`circular type reference to ${JSON.stringify(f)}`,"types",e),!u2(f)&&($(r.has(f),`unknown type ${JSON.stringify(f)}`,"types",e),r.get(f).push(l),n.get(l).add(f))}}const o=Array.from(r.keys()).filter(l=>r.get(l).length===0);$(o.length!==0,"missing primary type","types",e),$(o.length===1,`ambiguous primary types or unused types: ${o.map(l=>JSON.stringify(l)).join(", ")}`,"types",e),Oe(this,{primaryType:o[0]});function a(l,u){$(!u.has(l),`circular type reference to ${JSON.stringify(l)}`,"types",e),u.add(l);for(const c of n.get(l))if(r.has(c)){a(c,u);for(const f of u)s.get(f).add(c)}u.delete(l)}a(this.primaryType,new Set);for(const[l,u]of s){const c=Array.from(u);c.sort(),T(this,co).set(l,oP(l,i[l])+c.map(f=>oP(f,i[f])).join(""))}}get types(){return JSON.parse(T(this,gp))}getEncoder(e){let n=T(this,Cf).get(e);return n||(n=fe(this,ib,QL).call(this,e),T(this,Cf).set(e,n)),n}encodeType(e){const n=T(this,co).get(e);return $(n,`unknown type: ${JSON.stringify(e)}`,"name",e),n}encodeData(e,n){return this.getEncoder(e)(n)}hashStruct(e,n){return en(this.encodeData(e,n))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,n,r){if(u2(e))return r(e,n);const s=dy(e).array;if(s)return $(s.count===-1||s.count===n.length,`array length mismatch; expected length ${s.count}`,"value",n),n.map(o=>this._visit(s.prefix,o,r));const i=this.types[e];if(i)return i.reduce((o,{name:a,type:l})=>(o[a]=this._visit(l,n[a],r),o),{});$(!1,`unknown type: ${e}`,"type",e)}visit(e,n){return this._visit(this.primaryType,e,n)}static from(e){return new ns(e)}static getPrimaryType(e){return ns.from(e).primaryType}static hashStruct(e,n,r){return ns.from(n).hashStruct(e,r)}static hashDomain(e){const n=[];for(const r in e){if(e[r]==null)continue;const s=sP[r];$(s,`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),n.push({name:r,type:s})}return n.sort((r,s)=>l2.indexOf(r.name)-l2.indexOf(s.name)),ns.hashStruct("EIP712Domain",{EIP712Domain:n},e)}static encode(e,n,r){return $t(["0x1901",ns.hashDomain(e),ns.from(n).hash(r)])}static hash(e,n,r){return en(ns.encode(e,n,r))}static async resolveNames(e,n,r,s){e=Object.assign({},e);for(const a in e)e[a]==null&&delete e[a];const i={};e.verifyingContract&&!St(e.verifyingContract,20)&&(i[e.verifyingContract]="0x");const o=ns.from(n);o.visit(r,(a,l)=>(a==="address"&&!St(l,20)&&(i[l]="0x"),l));for(const a in i)i[a]=await s(a);return e.verifyingContract&&i[e.verifyingContract]&&(e.verifyingContract=i[e.verifyingContract]),r=o.visit(r,(a,l)=>a==="address"&&i[l]?i[l]:l),{domain:e,value:r}}static getPayload(e,n,r){ns.hashDomain(e);const s={},i=[];l2.forEach(l=>{const u=e[l];u!=null&&(s[l]=oie[l](u),i.push({name:l,type:sP[l]}))});const o=ns.from(n);n=o.types;const a=Object.assign({},n);return $(a.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",n),a.EIP712Domain=i,o.encode(r),{types:a,domain:s,primaryType:o.primaryType,message:o.visit(r,(l,u)=>{if(l.match(/^bytes(\d*)/))return we(ct(u));if(l.match(/^u?int/))return xe(u).toString();switch(l){case"address":return u.toLowerCase();case"bool":return!!u;case"string":return $(typeof u=="string","invalid string","value",u),u}$(!1,"unsupported type","type",l)})}}};gp=new WeakMap,co=new WeakMap,Cf=new WeakMap,ib=new WeakSet,QL=function(e){{const s=u2(e);if(s)return s}const n=dy(e).array;if(n){const s=n.prefix,i=this.getEncoder(s);return o=>{$(n.count===-1||n.count===o.length,`array length mismatch; expected length ${n.count}`,"value",o);let a=o.map(i);return T(this,co).has(s)&&(a=a.map(en)),en($t(a))}}const r=this.types[e];if(r){const s=Ol(T(this,co).get(e));return i=>{const o=r.map(({name:a,type:l})=>{const u=this.getEncoder(l)(i[a]);return T(this,co).has(l)?en(u):u});return o.unshift(s),$t(o)}}$(!1,`unknown type: ${e}`,"type",e)};let hy=ns;function Jn(t){const e=new Set;return t.forEach(n=>e.add(n)),Object.freeze(e)}const aie=Jn("external public payable override".split(" ")),aP="constant external internal payable private public pure view override",lie=Jn(aP.split(" ")),lP="constructor error event fallback function receive struct",uP=Jn(lP.split(" ")),cP="calldata memory storage payable indexed",uie=Jn(cP.split(" ")),cie=[lP,cP,"tuple returns",aP].join(" "),fie=Jn(cie.split(" ")),die={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},hie=new RegExp("^(\\s*)"),pie=new RegExp("^([0-9]+)"),mie=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),fP=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),dP=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"),ob=class ob{constructor(e){J(this,yp);J(this,Dn);J(this,Ns);I(this,Dn,0),I(this,Ns,e.slice())}get offset(){return T(this,Dn)}get length(){return T(this,Ns).length-T(this,Dn)}clone(){return new ob(T(this,Ns))}reset(){I(this,Dn,0)}popKeyword(e){const n=this.peek();if(n.type!=="KEYWORD"||!e.has(n.text))throw new Error(`expected keyword ${n.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){const n=this.peek();throw new Error(`expected ${e}; got ${n.type} ${JSON.stringify(n.text)}`)}return this.pop().text}popParen(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const n=fe(this,yp,Zk).call(this,T(this,Dn)+1,e.match+1);return I(this,Dn,e.match+1),n}popParams(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const n=[];for(;T(this,Dn)<e.match-1;){const r=this.peek().linkNext;n.push(fe(this,yp,Zk).call(this,T(this,Dn)+1,r)),I(this,Dn,r)}return I(this,Dn,e.match+1),n}peek(){if(T(this,Dn)>=T(this,Ns).length)throw new Error("out-of-bounds");return T(this,Ns)[T(this,Dn)]}peekKeyword(e){const n=this.peekType("KEYWORD");return n!=null&&e.has(n)?n:null}peekType(e){if(this.length===0)return null;const n=this.peek();return n.type===e?n.text:null}pop(){const e=this.peek();return Dp(this,Dn)._++,e}toString(){const e=[];for(let n=T(this,Dn);n<T(this,Ns).length;n++){const r=T(this,Ns)[n];e.push(`${r.type}:${r.text}`)}return`<TokenString ${e.join(" ")}>`}};Dn=new WeakMap,Ns=new WeakMap,yp=new WeakSet,Zk=function(e=0,n=0){return new ob(T(this,Ns).slice(e,n).map(r=>Object.freeze(Object.assign({},r,{match:r.match-e,linkBack:r.linkBack-e,linkNext:r.linkNext-e}))))};let Ts=ob;function oa(t){const e=[],n=o=>{const a=i<t.length?JSON.stringify(t[i]):"$EOI";throw new Error(`invalid token ${a} at ${i}: ${o}`)};let r=[],s=[],i=0;for(;i<t.length;){let o=t.substring(i),a=o.match(hie);a&&(i+=a[1].length,o=t.substring(i));const l={depth:r.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:i,value:-1};e.push(l);let u=die[o[0]]||"";if(u){if(l.type=u,l.text=o[0],i++,u==="OPEN_PAREN")r.push(e.length-1),s.push(e.length-1);else if(u=="CLOSE_PAREN")r.length===0&&n("no matching open bracket"),l.match=r.pop(),e[l.match].match=e.length-1,l.depth--,l.linkBack=s.pop(),e[l.linkBack].linkNext=e.length-1;else if(u==="COMMA")l.linkBack=s.pop(),e[l.linkBack].linkNext=e.length-1,s.push(e.length-1);else if(u==="OPEN_BRACKET")l.type="BRACKET";else if(u==="CLOSE_BRACKET"){let c=e.pop().text;if(e.length>0&&e[e.length-1].type==="NUMBER"){const f=e.pop().text;c=f+c,e[e.length-1].value=Qe(f)}if(e.length===0||e[e.length-1].type!=="BRACKET")throw new Error("missing opening bracket");e[e.length-1].text+=c}continue}if(a=o.match(mie),a){if(l.text=a[1],i+=l.text.length,fie.has(l.text)){l.type="KEYWORD";continue}if(l.text.match(dP)){l.type="TYPE";continue}l.type="ID";continue}if(a=o.match(pie),a){l.text=a[1],l.type="NUMBER",i+=l.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(o[0])} at position ${i}`)}return new Ts(e.map(o=>Object.freeze(o)))}function hP(t,e){let n=[];for(const r in e.keys())t.has(r)&&n.push(r);if(n.length>1)throw new Error(`conflicting types: ${n.join(", ")}`)}function py(t,e){if(e.peekKeyword(uP)){const n=e.pop().text;if(n!==t)throw new Error(`expected ${t}, got ${n}`)}return e.popType("ID")}function Gi(t,e){const n=new Set;for(;;){const r=t.peekType("KEYWORD");if(r==null||e&&!e.has(r))break;if(t.pop(),n.has(r))throw new Error(`duplicate keywords: ${JSON.stringify(r)}`);n.add(r)}return Object.freeze(n)}function pP(t){let e=Gi(t,lie);return hP(e,Jn("constant payable nonpayable".split(" "))),hP(e,Jn("pure view payable nonpayable".split(" "))),e.has("view")?"view":e.has("pure")?"pure":e.has("payable")?"payable":e.has("nonpayable")?"nonpayable":e.has("constant")?"view":"nonpayable"}function Wi(t,e){return t.popParams().map(n=>En.from(n,e))}function mP(t){if(t.peekType("AT")){if(t.pop(),t.peekType("NUMBER"))return xe(t.pop().text);throw new Error("invalid gas")}return null}function Nl(t){if(t.length)throw new Error(`unexpected tokens at offset ${t.offset}: ${t.toString()}`)}const gie=new RegExp(/^(.*)\[([0-9]*)\]$/);function gP(t){const e=t.match(dP);if($(e,"invalid type","type",t),t==="uint")return"uint256";if(t==="int")return"int256";if(e[2]){const n=parseInt(e[2]);$(n!==0&&n<=32,"invalid bytes length","type",t)}else if(e[3]){const n=parseInt(e[3]);$(n!==0&&n<=256&&n%8===0,"invalid numeric width","type",t)}return t}const Lt={},dr=Symbol.for("_ethers_internal"),yP="_ParamTypeInternal",bP="_ErrorInternal",wP="_EventInternal",AP="_ConstructorInternal",vP="_FallbackInternal",xP="_FunctionInternal",kP="_StructInternal",rs=class rs{constructor(e,n,r,s,i,o,a,l){J(this,Sf);W(this,"name");W(this,"type");W(this,"baseType");W(this,"indexed");W(this,"components");W(this,"arrayLength");W(this,"arrayChildren");if($g(e,Lt,"ParamType"),Object.defineProperty(this,dr,{value:yP}),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("");Oe(this,{name:n,type:r,baseType:s,indexed:i,components:o,arrayLength:a,arrayChildren:l})}format(e){if(e==null&&(e="sighash"),e==="json"){const r=this.name||"";if(this.isArray()){const i=JSON.parse(this.arrayChildren.format("json"));return i.name=r,i.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(i)}const s={type:this.baseType==="tuple"?"tuple":this.type,name:r};return typeof this.indexed=="boolean"&&(s.indexed=this.indexed),this.isTuple()&&(s.components=this.components.map(i=>JSON.parse(i.format(e)))),JSON.stringify(s)}let n="";return this.isArray()?(n+=this.arrayChildren.format(e),n+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?n+="("+this.components.map(r=>r.format(e)).join(e==="full"?", ":",")+")":n+=this.type,e!=="sighash"&&(this.indexed===!0&&(n+=" indexed"),e==="full"&&this.name&&(n+=" "+this.name)),n}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(e,n){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw new Error("array is wrong length");const r=this;return e.map(s=>r.arrayChildren.walk(s,n))}if(this.isTuple()){if(!Array.isArray(e))throw new Error("invalid tuple value");if(e.length!==this.components.length)throw new Error("array is wrong length");const r=this;return e.map((s,i)=>r.components[i].walk(s,n))}return n(this.type,e)}async walkAsync(e,n){const r=[],s=[e];return fe(this,Sf,hb).call(this,r,e,n,i=>{s[0]=i}),r.length&&await Promise.all(r),s[0]}static from(e,n){if(rs.isParamType(e))return e;if(typeof e=="string")try{return rs.from(oa(e),n)}catch{$(!1,"invalid param type","obj",e)}else if(e instanceof Ts){let a="",l="",u=null;Gi(e,Jn(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(l="tuple",u=e.popParams().map(m=>rs.from(m)),a=`tuple(${u.map(m=>m.format()).join(",")})`):(a=gP(e.popType("TYPE")),l=a);let c=null,f=null;for(;e.length&&e.peekType("BRACKET");){const m=e.pop();c=new rs(Lt,"",a,l,null,u,f,c),f=m.value,a+=m.text,l="array",u=null}let d=null;if(Gi(e,uie).has("indexed")){if(!n)throw new Error("");d=!0}const p=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new rs(Lt,p,a,l,d,u,f,c)}const r=e.name;$(!r||typeof r=="string"&&r.match(fP),"invalid name","obj.name",r);let s=e.indexed;s!=null&&($(n,"parameter cannot be indexed","obj.indexed",e.indexed),s=!!s);let i=e.type,o=i.match(gie);if(o){const a=parseInt(o[2]||"-1"),l=rs.from({type:o[1],components:e.components});return new rs(Lt,r||"",i,"array",s,null,a,l)}if(i==="tuple"||i.startsWith("tuple(")||i.startsWith("(")){const a=e.components!=null?e.components.map(u=>rs.from(u)):null;return new rs(Lt,r||"",i,"tuple",s,a,null,null)}return i=gP(e.type),new rs(Lt,r||"",i,i,s,null,null,null)}static isParamType(e){return e&&e[dr]===yP}};Sf=new WeakSet,hb=function(e,n,r,s){if(this.isArray()){if(!Array.isArray(n))throw new Error("invalid array value");if(this.arrayLength!==-1&&n.length!==this.arrayLength)throw new Error("array is wrong length");const o=this.arrayChildren,a=n.slice();a.forEach((l,u)=>{var c;fe(c=o,Sf,hb).call(c,e,l,r,f=>{a[u]=f})}),s(a);return}if(this.isTuple()){const o=this.components;let a;if(Array.isArray(n))a=n.slice();else{if(n==null||typeof n!="object")throw new Error("invalid tuple value");a=o.map(l=>{if(!l.name)throw new Error("cannot use object value with unnamed components");if(!(l.name in n))throw new Error(`missing value for component ${l.name}`);return n[l.name]})}if(a.length!==this.components.length)throw new Error("array is wrong length");a.forEach((l,u)=>{var c;fe(c=o[u],Sf,hb).call(c,e,l,r,f=>{a[u]=f})}),s(a);return}const i=r(this.type,n);i.then?e.push(async function(){s(await i)}()):s(i)};let En=rs;class Rl{constructor(e,n,r){W(this,"type");W(this,"inputs");$g(e,Lt,"Fragment"),r=Object.freeze(r.slice()),Oe(this,{type:n,inputs:r})}static from(e){if(typeof e=="string"){try{Rl.from(JSON.parse(e))}catch{}return Rl.from(oa(e))}if(e instanceof Ts)switch(e.peekKeyword(uP)){case"constructor":return Ki.from(e);case"error":return hr.from(e);case"event":return ci.from(e);case"fallback":case"receive":return qi.from(e);case"function":return fi.from(e);case"struct":return Pl.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return Ki.from(e);case"error":return hr.from(e);case"event":return ci.from(e);case"fallback":case"receive":return qi.from(e);case"function":return fi.from(e);case"struct":return Pl.from(e)}ee(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}$(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return Ki.isFragment(e)}static isError(e){return hr.isFragment(e)}static isEvent(e){return ci.isFragment(e)}static isFunction(e){return fi.isFragment(e)}static isStruct(e){return Pl.isFragment(e)}}class my extends Rl{constructor(n,r,s,i){super(n,r,i);W(this,"name");$(typeof s=="string"&&s.match(fP),"invalid identifier","name",s),i=Object.freeze(i.slice()),Oe(this,{name:s})}}function $h(t,e){return"("+e.map(n=>n.format(t)).join(t==="full"?", ":",")+")"}class hr extends my{constructor(e,n,r){super(e,"error",n,r),Object.defineProperty(this,dr,{value:bP})}get selector(){return Ol(this.format("sighash")).substring(0,10)}format(e){if(e==null&&(e="sighash"),e==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});const n=[];return e!=="sighash"&&n.push("error"),n.push(this.name+$h(e,this.inputs)),n.join(" ")}static from(e){if(hr.isFragment(e))return e;if(typeof e=="string")return hr.from(oa(e));if(e instanceof Ts){const n=py("error",e),r=Wi(e);return Nl(e),new hr(Lt,n,r)}return new hr(Lt,e.name,e.inputs?e.inputs.map(En.from):[])}static isFragment(e){return e&&e[dr]===bP}}class ci extends my{constructor(n,r,s,i){super(n,"event",r,s);W(this,"anonymous");Object.defineProperty(this,dr,{value:wP}),Oe(this,{anonymous:i})}get topicHash(){return Ol(this.format("sighash"))}format(n){if(n==null&&(n="sighash"),n==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(s=>JSON.parse(s.format(n)))});const r=[];return n!=="sighash"&&r.push("event"),r.push(this.name+$h(n,this.inputs)),n!=="sighash"&&this.anonymous&&r.push("anonymous"),r.join(" ")}static getTopicHash(n,r){return r=(r||[]).map(i=>En.from(i)),new ci(Lt,n,r,!1).topicHash}static from(n){if(ci.isFragment(n))return n;if(typeof n=="string")try{return ci.from(oa(n))}catch{$(!1,"invalid event fragment","obj",n)}else if(n instanceof Ts){const r=py("event",n),s=Wi(n,!0),i=!!Gi(n,Jn(["anonymous"])).has("anonymous");return Nl(n),new ci(Lt,r,s,i)}return new ci(Lt,n.name,n.inputs?n.inputs.map(r=>En.from(r,!0)):[],!!n.anonymous)}static isFragment(n){return n&&n[dr]===wP}}class Ki extends Rl{constructor(n,r,s,i,o){super(n,r,s);W(this,"payable");W(this,"gas");Object.defineProperty(this,dr,{value:AP}),Oe(this,{payable:i,gas:o})}format(n){if(ee(n!=null&&n!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),n==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(n)))});const r=[`constructor${$h(n,this.inputs)}`];return this.payable&&r.push("payable"),this.gas!=null&&r.push(`@${this.gas.toString()}`),r.join(" ")}static from(n){if(Ki.isFragment(n))return n;if(typeof n=="string")try{return Ki.from(oa(n))}catch{$(!1,"invalid constuctor fragment","obj",n)}else if(n instanceof Ts){Gi(n,Jn(["constructor"]));const r=Wi(n),s=!!Gi(n,aie).has("payable"),i=mP(n);return Nl(n),new Ki(Lt,"constructor",r,s,i)}return new Ki(Lt,"constructor",n.inputs?n.inputs.map(En.from):[],!!n.payable,n.gas!=null?n.gas:null)}static isFragment(n){return n&&n[dr]===AP}}class qi extends Rl{constructor(n,r,s){super(n,"fallback",r);W(this,"payable");Object.defineProperty(this,dr,{value:vP}),Oe(this,{payable:s})}format(n){const r=this.inputs.length===0?"receive":"fallback";if(n==="json"){const s=this.payable?"payable":"nonpayable";return JSON.stringify({type:r,stateMutability:s})}return`${r}()${this.payable?" payable":""}`}static from(n){if(qi.isFragment(n))return n;if(typeof n=="string")try{return qi.from(oa(n))}catch{$(!1,"invalid fallback fragment","obj",n)}else if(n instanceof Ts){const r=n.toString(),s=n.peekKeyword(Jn(["fallback","receive"]));if($(s,"type must be fallback or receive","obj",r),n.popKeyword(Jn(["fallback","receive"]))==="receive"){const l=Wi(n);return $(l.length===0,"receive cannot have arguments","obj.inputs",l),Gi(n,Jn(["payable"])),Nl(n),new qi(Lt,[],!0)}let o=Wi(n);o.length?$(o.length===1&&o[0].type==="bytes","invalid fallback inputs","obj.inputs",o.map(l=>l.format("minimal")).join(", ")):o=[En.from("bytes")];const a=pP(n);if($(a==="nonpayable"||a==="payable","fallback cannot be constants","obj.stateMutability",a),Gi(n,Jn(["returns"])).has("returns")){const l=Wi(n);$(l.length===1&&l[0].type==="bytes","invalid fallback outputs","obj.outputs",l.map(u=>u.format("minimal")).join(", "))}return Nl(n),new qi(Lt,o,a==="payable")}if(n.type==="receive")return new qi(Lt,[],!0);if(n.type==="fallback"){const r=[En.from("bytes")],s=n.stateMutability==="payable";return new qi(Lt,r,s)}$(!1,"invalid fallback description","obj",n)}static isFragment(n){return n&&n[dr]===vP}}class fi extends my{constructor(n,r,s,i,o,a){super(n,"function",r,i);W(this,"constant");W(this,"outputs");W(this,"stateMutability");W(this,"payable");W(this,"gas");Object.defineProperty(this,dr,{value:xP}),o=Object.freeze(o.slice()),Oe(this,{constant:s==="view"||s==="pure",gas:a,outputs:o,payable:s==="payable",stateMutability:s})}get selector(){return Ol(this.format("sighash")).substring(0,10)}format(n){if(n==null&&(n="sighash"),n==="json")return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(n))),outputs:this.outputs.map(s=>JSON.parse(s.format(n)))});const r=[];return n!=="sighash"&&r.push("function"),r.push(this.name+$h(n,this.inputs)),n!=="sighash"&&(this.stateMutability!=="nonpayable"&&r.push(this.stateMutability),this.outputs&&this.outputs.length&&(r.push("returns"),r.push($h(n,this.outputs))),this.gas!=null&&r.push(`@${this.gas.toString()}`)),r.join(" ")}static getSelector(n,r){return r=(r||[]).map(i=>En.from(i)),new fi(Lt,n,"view",r,[],null).selector}static from(n){if(fi.isFragment(n))return n;if(typeof n=="string")try{return fi.from(oa(n))}catch{$(!1,"invalid function fragment","obj",n)}else if(n instanceof Ts){const s=py("function",n),i=Wi(n),o=pP(n);let a=[];Gi(n,Jn(["returns"])).has("returns")&&(a=Wi(n));const l=mP(n);return Nl(n),new fi(Lt,s,o,i,a,l)}let r=n.stateMutability;return r==null&&(r="payable",typeof n.constant=="boolean"?(r="view",n.constant||(r="payable",typeof n.payable=="boolean"&&!n.payable&&(r="nonpayable"))):typeof n.payable=="boolean"&&!n.payable&&(r="nonpayable")),new fi(Lt,n.name,r,n.inputs?n.inputs.map(En.from):[],n.outputs?n.outputs.map(En.from):[],n.gas!=null?n.gas:null)}static isFragment(n){return n&&n[dr]===xP}}class Pl extends my{constructor(e,n,r){super(e,"struct",n,r),Object.defineProperty(this,dr,{value:kP})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return Pl.from(oa(e))}catch{$(!1,"invalid struct fragment","obj",e)}else if(e instanceof Ts){const n=py("struct",e),r=Wi(e);return Nl(e),new Pl(Lt,n,r)}return new Pl(Lt,e.name,e.inputs?e.inputs.map(En.from):[])}static isFragment(e){return e&&e[dr]===kP}}const Ds=new Map;Ds.set(0,"GENERIC_PANIC"),Ds.set(1,"ASSERT_FALSE"),Ds.set(17,"OVERFLOW"),Ds.set(18,"DIVIDE_BY_ZERO"),Ds.set(33,"ENUM_RANGE_ERROR"),Ds.set(34,"BAD_STORAGE_DATA"),Ds.set(49,"STACK_UNDERFLOW"),Ds.set(50,"ARRAY_RANGE_ERROR"),Ds.set(65,"OUT_OF_MEMORY"),Ds.set(81,"UNINITIALIZED_FUNCTION_CALL");const yie=new RegExp(/^bytes([0-9]*)$/),bie=new RegExp(/^(u?int)([0-9]*)$/);let c2=null,EP=1024;function wie(t,e,n,r){let s="missing revert data",i=null;const o=null;let a=null;if(n){s="execution reverted";const u=ct(n);if(n=we(n),u.length===0)s+=" (no data present; likely require(false) occurred",i="require(false)";else if(u.length%32!==4)s+=" (could not decode reason; invalid data length)";else if(we(u.slice(0,4))==="0x08c379a0")try{i=r.decode(["string"],u.slice(4))[0],a={signature:"Error(string)",name:"Error",args:[i]},s+=`: ${JSON.stringify(i)}`}catch{s+=" (could not decode reason; invalid string data)"}else if(we(u.slice(0,4))==="0x4e487b71")try{const c=Number(r.decode(["uint256"],u.slice(4))[0]);a={signature:"Panic(uint256)",name:"Panic",args:[c]},i=`Panic due to ${Ds.get(c)||"UNKNOWN"}(${c})`,s+=`: ${i}`}catch{s+=" (could not decode panic code)"}else s+=" (unknown custom error)"}const l={to:e.to?gt(e.to):null,data:e.data||"0x"};return e.from&&(l.from=gt(e.from)),Nt(s,"CALL_EXCEPTION",{action:t,data:n,reason:i,transaction:l,invocation:o,revert:a})}const ab=class ab{constructor(){J(this,ba)}getDefaultValue(e){const n=e.map(s=>fe(this,ba,Qf).call(this,En.from(s)));return new ry(n,"_").defaultValue()}encode(e,n){s4(n.length,e.length,"types/values length mismatch");const r=e.map(o=>fe(this,ba,Qf).call(this,En.from(o))),s=new ry(r,"_"),i=new Sx;return s.encode(i,n),i.data}decode(e,n,r){const s=e.map(o=>fe(this,ba,Qf).call(this,En.from(o)));return new ry(s,"_").decode(new Tx(n,r,EP))}static _setDefaultMaxInflation(e){$(typeof e=="number"&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),EP=e}static defaultAbiCoder(){return c2==null&&(c2=new ab),c2}static getBuiltinCallException(e,n,r){return wie(e,n,r,ab.defaultAbiCoder())}};ba=new WeakSet,Qf=function(e){if(e.isArray())return new $re(fe(this,ba,Qf).call(this,e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new ry(e.components.map(r=>fe(this,ba,Qf).call(this,r)),e.name);switch(e.baseType){case"address":return new Hre(e.name);case"bool":return new Gre(e.name);case"string":return new ese(e.name);case"bytes":return new Wre(e.name);case"":return new Qre(e.name)}let n=e.type.match(bie);if(n){let r=parseInt(n[2]||"256");return $(r!==0&&r<=256&&r%8===0,"invalid "+n[1]+" bit length","param",e),new Zre(r/8,n[1]==="int",e.name)}if(n=e.type.match(yie),n){let r=parseInt(n[1]);return $(r!==0&&r<=32,"invalid bytes length","param",e),new Kre(r,e.name)}$(!1,"invalid type","type",e.type)};let jc=ab;class Aie{constructor(e,n,r){W(this,"fragment");W(this,"name");W(this,"signature");W(this,"topic");W(this,"args");const s=e.name,i=e.format();Oe(this,{fragment:e,name:s,signature:i,topic:n,args:r})}}class vie{constructor(e,n,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();Oe(this,{fragment:e,name:i,args:r,signature:o,selector:n,value:s})}}class xie{constructor(e,n,r){W(this,"fragment");W(this,"name");W(this,"args");W(this,"signature");W(this,"selector");const s=e.name,i=e.format();Oe(this,{fragment:e,name:s,args:r,signature:i,selector:n})}}class CP{constructor(e){W(this,"hash");W(this,"_isIndexed");Oe(this,{hash:e,_isIndexed:!0})}static isIndexed(e){return!!(e&&e._isIndexed)}}const SP={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"},TP={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:t=>`reverted with reason string ${JSON.stringify(t)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:t=>{let e="unknown panic code";return t>=0&&t<=255&&SP[t.toString()]&&(e=SP[t.toString()]),`reverted with panic code 0x${t.toString(16)} (${e})`}}},su=class su{constructor(e){J(this,bi);W(this,"fragments");W(this,"deploy");W(this,"fallback");W(this,"receive");J(this,mi);J(this,gi);J(this,yi);J(this,Ln);let n=[];typeof e=="string"?n=JSON.parse(e):n=e,I(this,yi,new Map),I(this,mi,new Map),I(this,gi,new Map);const r=[];for(const o of n)try{r.push(Rl.from(o))}catch(a){console.log(`[Warning] Invalid Fragment ${JSON.stringify(o)}:`,a.message)}Oe(this,{fragments:Object.freeze(r)});let s=null,i=!1;I(this,Ln,this.getAbiCoder()),this.fragments.forEach((o,a)=>{let l;switch(o.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}Oe(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,yi);break;case"event":l=T(this,gi);break;case"error":l=T(this,mi);break;default:return}const u=o.format();l.has(u)||l.set(u,o)}),this.deploy||Oe(this,{deploy:Ki.from("constructor()")}),Oe(this,{fallback:s,receive:i})}format(e){const n=e?"minimal":"full";return this.fragments.map(s=>s.format(n))}formatJson(){const e=this.fragments.map(n=>n.format("json"));return JSON.stringify(e.map(n=>JSON.parse(n)))}getAbiCoder(){return jc.defaultAbiCoder()}getFunctionName(e){const n=fe(this,bi,pb).call(this,e,null,!1);return $(n,"no matching function","key",e),n.name}hasFunction(e){return!!fe(this,bi,pb).call(this,e,null,!1)}getFunction(e,n){return fe(this,bi,pb).call(this,e,n||null,!0)}forEachFunction(e){const n=Array.from(T(this,yi).keys());n.sort((r,s)=>r.localeCompare(s));for(let r=0;r<n.length;r++){const s=n[r];e(T(this,yi).get(s),r)}}getEventName(e){const n=fe(this,bi,mb).call(this,e,null,!1);return $(n,"no matching event","key",e),n.name}hasEvent(e){return!!fe(this,bi,mb).call(this,e,null,!1)}getEvent(e,n){return fe(this,bi,mb).call(this,e,n||null,!0)}forEachEvent(e){const n=Array.from(T(this,gi).keys());n.sort((r,s)=>r.localeCompare(s));for(let r=0;r<n.length;r++){const s=n[r];e(T(this,gi).get(s),r)}}getError(e,n){if(St(e)){const s=e.toLowerCase();if(TP[s])return hr.from(TP[s].signature);for(const i of T(this,mi).values())if(s===i.selector)return i;return null}if(e.indexOf("(")===-1){const s=[];for(const[i,o]of T(this,mi))i.split("(")[0]===e&&s.push(o);if(s.length===0)return e==="Error"?hr.from("error Error(string)"):e==="Panic"?hr.from("error Panic(uint256)"):null;if(s.length>1){const i=s.map(o=>JSON.stringify(o.format())).join(", ");$(!1,`ambiguous error description (i.e. ${i})`,"name",e)}return s[0]}if(e=hr.from(e).format(),e==="Error(string)")return hr.from("error Error(string)");if(e==="Panic(uint256)")return hr.from("error Panic(uint256)");const r=T(this,mi).get(e);return r||null}forEachError(e){const n=Array.from(T(this,mi).keys());n.sort((r,s)=>r.localeCompare(s));for(let r=0;r<n.length;r++){const s=n[r];e(T(this,mi).get(s),r)}}_decodeParams(e,n){return T(this,Ln).decode(e,n)}_encodeParams(e,n){return T(this,Ln).encode(e,n)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,n){if(typeof e=="string"){const r=this.getError(e);$(r,"unknown error","fragment",e),e=r}return $(Ht(n,0,4)===e.selector,`data signature does not match error ${e.name}.`,"data",n),this._decodeParams(e.inputs,Ht(n,4))}encodeErrorResult(e,n){if(typeof e=="string"){const r=this.getError(e);$(r,"unknown error","fragment",e),e=r}return $t([e.selector,this._encodeParams(e.inputs,n||[])])}decodeFunctionData(e,n){if(typeof e=="string"){const r=this.getFunction(e);$(r,"unknown function","fragment",e),e=r}return $(Ht(n,0,4)===e.selector,`data signature does not match function ${e.name}.`,"data",n),this._decodeParams(e.inputs,Ht(n,4))}encodeFunctionData(e,n){if(typeof e=="string"){const r=this.getFunction(e);$(r,"unknown function","fragment",e),e=r}return $t([e.selector,this._encodeParams(e.inputs,n||[])])}decodeFunctionResult(e,n){if(typeof e=="string"){const i=this.getFunction(e);$(i,"unknown function","fragment",e),e=i}let r="invalid length for result data";const s=Gn(n);if(s.length%32===0)try{return T(this,Ln).decode(e.outputs,s)}catch{r="could not decode result data"}ee(!1,r,"BAD_DATA",{value:we(s),info:{method:e.name,signature:e.format()}})}makeError(e,n){const r=ct(e,"data"),s=jc.getBuiltinCallException("call",n,r);if(s.message.startsWith("execution reverted (unknown custom error)")){const a=we(r.slice(0,4)),l=this.getError(a);if(l)try{const u=T(this,Ln).decode(l.inputs,r.slice(4));s.revert={name:l.name,signature:l.format(),args:u},s.reason=s.revert.signature,s.message=`execution reverted: ${s.reason}`}catch{s.message="execution reverted (coult not decode custom error)"}}const o=this.parseTransaction(n);return o&&(s.invocation={method:o.name,signature:o.signature,args:o.args}),s}encodeFunctionResult(e,n){if(typeof e=="string"){const r=this.getFunction(e);$(r,"unknown function","fragment",e),e=r}return we(T(this,Ln).encode(e.outputs,n||[]))}encodeFilterTopics(e,n){if(typeof e=="string"){const i=this.getEvent(e);$(i,"unknown event","eventFragment",e),e=i}ee(n.length<=e.inputs.length,`too many arguments for ${e.format()}`,"UNEXPECTED_ARGUMENT",{count:n.length,expectedCount:e.inputs.length});const r=[];e.anonymous||r.push(e.topicHash);const s=(i,o)=>i.type==="string"?Ol(o):i.type==="bytes"?en(we(o)):(i.type==="bool"&&typeof o=="boolean"?o=o?"0x01":"0x00":i.type.match(/^u?int/)?o=Xo(o):i.type.match(/^bytes/)?o=nne(o,32):i.type==="address"&&T(this,Ln).encode(["address"],[o]),xl(we(o),32));for(n.forEach((i,o)=>{const a=e.inputs[o];if(!a.indexed){$(i==null,"cannot filter non-indexed parameters; must be null","contract."+a.name,i);return}i==null?r.push(null):a.baseType==="array"||a.baseType==="tuple"?$(!1,"filtering with tuples or arrays not supported","contract."+a.name,i):Array.isArray(i)?r.push(i.map(l=>s(a,l))):r.push(s(a,i))});r.length&&r[r.length-1]===null;)r.pop();return r}encodeEventLog(e,n){if(typeof e=="string"){const o=this.getEvent(e);$(o,"unknown event","eventFragment",e),e=o}const r=[],s=[],i=[];return e.anonymous||r.push(e.topicHash),$(n.length===e.inputs.length,"event arguments/values mismatch","values",n),e.inputs.forEach((o,a)=>{const l=n[a];if(o.indexed)if(o.type==="string")r.push(Ol(l));else if(o.type==="bytes")r.push(en(l));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");r.push(T(this,Ln).encode([o.type],[l]))}else s.push(o),i.push(l)}),{data:T(this,Ln).encode(s,i),topics:r}}decodeEventLog(e,n,r){if(typeof e=="string"){const h=this.getEvent(e);$(h,"unknown event","eventFragment",e),e=h}if(r!=null&&!e.anonymous){const h=e.topicHash;$(St(r[0],32)&&r[0].toLowerCase()===h,"fragment/topic mismatch","topics[0]",r[0]),r=r.slice(1)}const s=[],i=[],o=[];e.inputs.forEach((h,p)=>{h.indexed?h.type==="string"||h.type==="bytes"||h.baseType==="tuple"||h.baseType==="array"?(s.push(En.from({type:"bytes32",name:h.name})),o.push(!0)):(s.push(h),o.push(!1)):(i.push(h),o.push(!1))});const a=r!=null?T(this,Ln).decode(s,$t(r)):null,l=T(this,Ln).decode(i,n,!0),u=[],c=[];let f=0,d=0;return e.inputs.forEach((h,p)=>{let m=null;if(h.indexed)if(a==null)m=new CP(null);else if(o[p])m=new CP(a[d++]);else try{m=a[d++]}catch(g){m=g}else try{m=l[f++]}catch(g){m=g}u.push(m),c.push(h.name||null)}),Dc.fromItems(u,c)}parseTransaction(e){const n=ct(e.data,"tx.data"),r=xe(e.value!=null?e.value:0,"tx.value"),s=this.getFunction(we(n.slice(0,4)));if(!s)return null;const i=T(this,Ln).decode(s.inputs,n.slice(4));return new vie(s,s.selector,i,r)}parseCallResult(e){throw new Error("@TODO")}parseLog(e){const n=this.getEvent(e.topics[0]);return!n||n.anonymous?null:new Aie(n,n.topicHash,this.decodeEventLog(n,e.data,e.topics))}parseError(e){const n=we(e),r=this.getError(Ht(n,0,4));if(!r)return null;const s=T(this,Ln).decode(r.inputs,Ht(n,4));return new xie(r,r.selector,s)}static from(e){return e instanceof su?e:typeof e=="string"?new su(JSON.parse(e)):typeof e.formatJson=="function"?new su(e.formatJson()):typeof e.format=="function"?new su(e.format("json")):new su(e)}};mi=new WeakMap,gi=new WeakMap,yi=new WeakMap,Ln=new WeakMap,bi=new WeakSet,pb=function(e,n,r){if(St(e)){const i=e.toLowerCase();for(const o of T(this,yi).values())if(i===o.selector)return o;return null}if(e.indexOf("(")===-1){const i=[];for(const[o,a]of T(this,yi))o.split("(")[0]===e&&i.push(a);if(n){const o=n.length>0?n[n.length-1]:null;let a=n.length,l=!0;Rn.isTyped(o)&&o.type==="overrides"&&(l=!1,a--);for(let u=i.length-1;u>=0;u--){const c=i[u].inputs.length;c!==a&&(!l||c!==a-1)&&i.splice(u,1)}for(let u=i.length-1;u>=0;u--){const c=i[u].inputs;for(let f=0;f<n.length;f++)if(Rn.isTyped(n[f])){if(f>=c.length){if(n[f].type==="overrides")continue;i.splice(u,1);break}if(n[f].type!==c[f].baseType){i.splice(u,1);break}}}}if(i.length===1&&n&&n.length!==i[0].inputs.length){const o=n[n.length-1];(o==null||Array.isArray(o)||typeof o!="object")&&i.splice(0,1)}if(i.length===0)return null;if(i.length>1&&r){const o=i.map(a=>JSON.stringify(a.format())).join(", ");$(!1,`ambiguous function description (i.e. matches ${o})`,"key",e)}return i[0]}const s=T(this,yi).get(fi.from(e).format());return s||null},mb=function(e,n,r){if(St(e)){const i=e.toLowerCase();for(const o of T(this,gi).values())if(i===o.topicHash)return o;return null}if(e.indexOf("(")===-1){const i=[];for(const[o,a]of T(this,gi))o.split("(")[0]===e&&i.push(a);if(n){for(let o=i.length-1;o>=0;o--)i[o].inputs.length<n.length&&i.splice(o,1);for(let o=i.length-1;o>=0;o--){const a=i[o].inputs;for(let l=0;l<n.length;l++)if(Rn.isTyped(n[l])&&n[l].type!==a[l].baseType){i.splice(o,1);break}}}if(i.length===0)return null;if(i.length>1&&r){const o=i.map(a=>JSON.stringify(a.format())).join(", ");$(!1,`ambiguous event description (i.e. matches ${o})`,"key",e)}return i[0]}const s=T(this,gi).get(ci.from(e).format());return s||null};let f2=su;const DP=BigInt(0);function Uc(t){return t??null}function Kt(t){return t==null?null:t.toString()}class OP{constructor(e,n,r){W(this,"gasPrice");W(this,"maxFeePerGas");W(this,"maxPriorityFeePerGas");Oe(this,{gasPrice:Uc(e),maxFeePerGas:Uc(n),maxPriorityFeePerGas:Uc(r)})}toJSON(){const{gasPrice:e,maxFeePerGas:n,maxPriorityFeePerGas:r}=this;return{_type:"FeeData",gasPrice:Kt(e),maxFeePerGas:Kt(n),maxPriorityFeePerGas:Kt(r)}}}function gy(t){const e={};t.to&&(e.to=t.to),t.from&&(e.from=t.from),t.data&&(e.data=we(t.data));const n="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const s of n)!(s in t)||t[s]==null||(e[s]=xe(t[s],`request.${s}`));const r="type,nonce".split(/,/);for(const s of r)!(s in t)||t[s]==null||(e[s]=Qe(t[s],`request.${s}`));return t.accessList&&(e.accessList=ia(t.accessList)),"blockTag"in t&&(e.blockTag=t.blockTag),"enableCcipRead"in t&&(e.enableCcipRead=!!t.enableCcipRead),"customData"in t&&(e.customData=t.customData),"blobVersionedHashes"in t&&t.blobVersionedHashes&&(e.blobVersionedHashes=t.blobVersionedHashes.slice()),"kzg"in t&&(e.kzg=t.kzg),"blobs"in t&&t.blobs&&(e.blobs=t.blobs.map(s=>vx(s)?we(s):Object.assign({},s))),e}class kie{constructor(e,n){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");J(this,fo);I(this,fo,e.transactions.map(r=>typeof r!="string"?new Wh(r,n):r)),Oe(this,{provider:n,hash:Uc(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:Uc(e.prevRandao),extraData:e.extraData,baseFeePerGas:Uc(e.baseFeePerGas),stateRoot:e.stateRoot,receiptsRoot:e.receiptsRoot})}get transactions(){return T(this,fo).map(e=>typeof e=="string"?e:e.hash)}get prefetchedTransactions(){const e=T(this,fo).slice();return e.length===0?[]:(ee(typeof e[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),e)}toJSON(){const{baseFeePerGas:e,difficulty:n,extraData:r,gasLimit:s,gasUsed:i,hash:o,miner:a,prevRandao:l,nonce:u,number:c,parentHash:f,parentBeaconBlockRoot:d,stateRoot:h,receiptsRoot:p,timestamp:m,transactions:g}=this;return{_type:"Block",baseFeePerGas:Kt(e),difficulty:Kt(n),extraData:r,gasLimit:Kt(s),gasUsed:Kt(i),blobGasUsed:Kt(this.blobGasUsed),excessBlobGas:Kt(this.excessBlobGas),hash:o,miner:a,prevRandao:l,nonce:u,number:c,parentHash:f,timestamp:m,parentBeaconBlockRoot:d,stateRoot:h,receiptsRoot:p,transactions:g}}[Symbol.iterator](){let e=0;const n=this.transactions;return{next:()=>e<this.length?{value:n[e++],done:!1}:{value:void 0,done:!0}}}get length(){return T(this,fo).length}get date(){return this.timestamp==null?null:new Date(this.timestamp*1e3)}async getTransaction(e){let n;if(typeof e=="number")n=T(this,fo)[e];else{const r=e.toLowerCase();for(const s of T(this,fo))if(typeof s=="string"){if(s!==r)continue;n=s;break}else{if(s.hash===r)continue;n=s;break}}if(n==null)throw new Error("no such tx");return typeof n=="string"?await this.provider.getTransaction(n):n}getPrefetchedTransaction(e){const n=this.prefetchedTransactions;if(typeof e=="number")return n[e];e=e.toLowerCase();for(const r of n)if(r.hash===e)return r;$(!1,"no matching transaction","indexOrHash",e)}isMined(){return!!this.hash}isLondon(){return!!this.baseFeePerGas}orphanedEvent(){if(!this.isMined())throw new Error("");return Eie(this)}}fo=new WeakMap;class Gh{constructor(e,n){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=n;const r=Object.freeze(e.topics.slice());Oe(this,{transactionHash:e.transactionHash,blockHash:e.blockHash,blockNumber:e.blockNumber,removed:e.removed,address:e.address,data:e.data,topics:r,index:e.index,transactionIndex:e.transactionIndex})}toJSON(){const{address:e,blockHash:n,blockNumber:r,data:s,index:i,removed:o,topics:a,transactionHash:l,transactionIndex:u}=this;return{_type:"log",address:e,blockHash:n,blockNumber:r,data:s,index:i,removed:o,topics:a,transactionHash:l,transactionIndex:u}}async getBlock(){const e=await this.provider.getBlock(this.blockHash);return ee(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransaction(){const e=await this.provider.getTransaction(this.transactionHash);return ee(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransactionReceipt(){const e=await this.provider.getTransactionReceipt(this.transactionHash);return ee(!!e,"failed to find transaction receipt","UNKNOWN_ERROR",{}),e}removedEvent(){return Cie(this)}}class _P{constructor(e,n){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");J(this,bp);I(this,bp,Object.freeze(e.logs.map(s=>new Gh(s,n))));let r=DP;e.effectiveGasPrice!=null?r=e.effectiveGasPrice:e.gasPrice!=null&&(r=e.gasPrice),Oe(this,{provider:n,to:e.to,from:e.from,contractAddress:e.contractAddress,hash:e.hash,index:e.index,blockHash:e.blockHash,blockNumber:e.blockNumber,logsBloom:e.logsBloom,gasUsed:e.gasUsed,cumulativeGasUsed:e.cumulativeGasUsed,blobGasUsed:e.blobGasUsed,gasPrice:r,blobGasPrice:e.blobGasPrice,type:e.type,status:e.status,root:e.root})}get logs(){return T(this,bp)}toJSON(){const{to:e,from:n,contractAddress:r,hash:s,index:i,blockHash:o,blockNumber:a,logsBloom:l,logs:u,status:c,root:f}=this;return{_type:"TransactionReceipt",blockHash:o,blockNumber:a,contractAddress:r,cumulativeGasUsed:Kt(this.cumulativeGasUsed),from:n,gasPrice:Kt(this.gasPrice),blobGasUsed:Kt(this.blobGasUsed),blobGasPrice:Kt(this.blobGasPrice),gasUsed:Kt(this.gasUsed),hash:s,index:i,logs:u,logsBloom:l,root:f,status:c,to:e}}get length(){return this.logs.length}[Symbol.iterator](){let e=0;return{next:()=>e<this.length?{value:this.logs[e++],done:!1}:{value:void 0,done:!0}}}get fee(){return this.gasUsed*this.gasPrice}async getBlock(){const e=await this.provider.getBlock(this.blockHash);if(e==null)throw new Error("TODO");return e}async getTransaction(){const e=await this.provider.getTransaction(this.hash);if(e==null)throw new Error("TODO");return e}async getResult(){return await this.provider.getTransactionResult(this.hash)}async confirmations(){return await this.provider.getBlockNumber()-this.blockNumber+1}removedEvent(){return NP(this)}reorderedEvent(e){return ee(!e||e.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),MP(this,e)}}bp=new WeakMap;const $k=class $k{constructor(e,n){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");J(this,wa);this.provider=n,this.blockNumber=e.blockNumber!=null?e.blockNumber:null,this.blockHash=e.blockHash!=null?e.blockHash:null,this.hash=e.hash,this.index=e.index,this.type=e.type,this.from=e.from,this.to=e.to||null,this.gasLimit=e.gasLimit,this.nonce=e.nonce,this.data=e.data,this.value=e.value,this.gasPrice=e.gasPrice,this.maxPriorityFeePerGas=e.maxPriorityFeePerGas!=null?e.maxPriorityFeePerGas:null,this.maxFeePerGas=e.maxFeePerGas!=null?e.maxFeePerGas:null,this.maxFeePerBlobGas=e.maxFeePerBlobGas!=null?e.maxFeePerBlobGas:null,this.chainId=e.chainId,this.signature=e.signature,this.accessList=e.accessList!=null?e.accessList:null,this.blobVersionedHashes=e.blobVersionedHashes!=null?e.blobVersionedHashes:null,I(this,wa,-1)}toJSON(){const{blockNumber:e,blockHash:n,index:r,hash:s,type:i,to:o,from:a,nonce:l,data:u,signature:c,accessList:f,blobVersionedHashes:d}=this;return{_type:"TransactionResponse",accessList:f,blockNumber:e,blockHash:n,blobVersionedHashes:d,chainId:Kt(this.chainId),data:u,from:a,gasLimit:Kt(this.gasLimit),gasPrice:Kt(this.gasPrice),hash:s,maxFeePerGas:Kt(this.maxFeePerGas),maxPriorityFeePerGas:Kt(this.maxPriorityFeePerGas),maxFeePerBlobGas:Kt(this.maxFeePerBlobGas),nonce:l,signature:c,to:o,index:r,type:i,value:Kt(this.value)}}async getBlock(){let e=this.blockNumber;if(e==null){const r=await this.getTransaction();r&&(e=r.blockNumber)}if(e==null)return null;const n=this.provider.getBlock(e);if(n==null)throw new Error("TODO");return n}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(this.blockNumber==null){const{tx:n,blockNumber:r}=await Nn({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return n==null||n.blockNumber==null?0:r-n.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(e,n){const r=e??1,s=n??0;let i=T(this,wa),o=-1,a=i===-1;const l=async()=>{if(a)return null;const{blockNumber:d,nonce:h}=await Nn({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,wa)&&(o=T(this,wa)));o<=d;){if(a)return null;const m=await this.provider.getBlock(o,!0);if(m==null)return;for(const g of m)if(g===this.hash)return;for(let g=0;g<m.length;g++){const y=await m.getTransaction(g);if(y.from===this.from&&y.nonce===this.nonce){if(a)return null;const v=await this.provider.getTransactionReceipt(y.hash);if(v==null||d-v.blockNumber+1<r)return;let w="replaced";y.data===this.data&&y.to===this.to&&y.value===this.value?w="repriced":y.data==="0x"&&y.from===y.to&&y.value===DP&&(w="cancelled"),ee(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:w==="replaced"||w==="cancelled",reason:w,replacement:y.replaceableTransaction(i),hash:y.hash,receipt:v})}}o++}},u=d=>{if(d==null||d.status!==0)return d;ee(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:d.to,from:d.from,data:""},receipt:d})},c=await this.provider.getTransactionReceipt(this.hash);if(r===0)return u(c);if(c){if(await c.confirmations()>=r)return u(c)}else if(await l(),r===0)return null;return await new Promise((d,h)=>{const p=[],m=()=>{p.forEach(y=>y())};if(p.push(()=>{a=!0}),s>0){const y=setTimeout(()=>{m(),h(Nt("wait for transaction timeout","TIMEOUT"))},s);p.push(()=>{clearTimeout(y)})}const g=async y=>{if(await y.confirmations()>=r){m();try{d(u(y))}catch(v){h(v)}}};if(p.push(()=>{this.provider.off(this.hash,g)}),this.provider.on(this.hash,g),i>=0){const y=async()=>{try{await l()}catch(v){if(gn(v,"TRANSACTION_REPLACED")){m(),h(v);return}}a||this.provider.once("block",y)};p.push(()=>{this.provider.off("block",y)}),this.provider.once("block",y)}})}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 ee(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),NP(this)}reorderedEvent(e){return ee(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),ee(!e||e.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),MP(this,e)}replaceableTransaction(e){$(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const n=new $k(this,this.provider);return I(n,wa,e),n}};wa=new WeakMap;let Wh=$k;function Eie(t){return{orphan:"drop-block",hash:t.hash,number:t.number}}function MP(t,e){return{orphan:"reorder-transaction",tx:t,other:e}}function NP(t){return{orphan:"drop-transaction",tx:t}}function Cie(t){return{orphan:"drop-log",log:{transactionHash:t.transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,address:t.address,data:t.data,topics:Object.freeze(t.topics.slice()),index:t.index}}}class d2 extends Gh{constructor(n,r,s){super(n,n.provider);W(this,"interface");W(this,"fragment");W(this,"args");const i=r.decodeEventLog(s,n.data,n.topics);Oe(this,{args:i,fragment:s,interface:r})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class RP extends Gh{constructor(n,r){super(n,n.provider);W(this,"error");Oe(this,{error:r})}}class Sie extends _P{constructor(n,r,s){super(s,r);J(this,Tf);I(this,Tf,n)}get logs(){return super.logs.map(n=>{const r=n.topics.length?T(this,Tf).getEvent(n.topics[0]):null;if(r)try{return new d2(n,T(this,Tf),r)}catch(s){return new RP(n,s)}return n})}}Tf=new WeakMap;class h2 extends Wh{constructor(n,r,s){super(s,r);J(this,wp);I(this,wp,n)}async wait(n,r){const s=await super.wait(n,r);return s==null?null:new Sie(T(this,wp),this.provider,s)}}wp=new WeakMap;class PP extends d4{constructor(n,r,s,i){super(n,r,s);W(this,"log");Oe(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 Tie extends PP{constructor(e,n,r,s,i){super(e,n,r,new d2(i,e.interface,s));const o=e.interface.decodeEventLog(s,this.log.data,this.log.topics);Oe(this,{args:o,fragment:s})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const IP=BigInt(0);function LP(t){return t&&typeof t.call=="function"}function BP(t){return t&&typeof t.estimateGas=="function"}function yy(t){return t&&typeof t.resolveName=="function"}function FP(t){return t&&typeof t.sendTransaction=="function"}function jP(t){if(t!=null){if(yy(t))return t;if(t.provider)return t.provider}}class Die{constructor(e,n,r){J(this,Ap);W(this,"fragment");if(Oe(this,{fragment:n}),n.inputs.length<r.length)throw new Error("too many arguments");const s=Il(e.runner,"resolveName"),i=yy(s)?s:null;I(this,Ap,async function(){const o=await Promise.all(n.inputs.map((a,l)=>r[l]==null?null:a.walkAsync(r[l],(c,f)=>c==="address"?Array.isArray(f)?Promise.all(f.map(d=>Qn(d,i))):Qn(f,i):f)));return e.interface.encodeFilterTopics(n,o)}())}getTopicFilter(){return T(this,Ap)}}Ap=new WeakMap;function Il(t,e){return t==null?null:typeof t[e]=="function"?t:t.provider&&typeof t.provider[e]=="function"?t.provider:null}function Ll(t){return t==null?null:t.provider||null}async function UP(t,e){const n=Rn.dereference(t,"overrides");$(typeof n=="object","invalid overrides parameter","overrides",t);const r=gy(n);return $(r.to==null||(e||[]).indexOf("to")>=0,"cannot override to","overrides.to",r.to),$(r.data==null||(e||[]).indexOf("data")>=0,"cannot override data","overrides.data",r.data),r.from&&(r.from=r.from),r}async function Oie(t,e,n){const r=Il(t,"resolveName"),s=yy(r)?r:null;return await Promise.all(e.map((i,o)=>i.walkAsync(n[o],(a,l)=>(l=Rn.dereference(l,a),a==="address"?Qn(l,s):l))))}function _ie(t){const e=async function(o){const a=await UP(o,["data"]);a.to=await t.getAddress(),a.from&&(a.from=await Qn(a.from,jP(t.runner)));const l=t.interface,u=xe(a.value||IP,"overrides.value")===IP,c=(a.data||"0x")==="0x";l.fallback&&!l.fallback.payable&&l.receive&&!c&&!u&&$(!1,"cannot send data to receive or send value to non-payable fallback","overrides",o),$(l.fallback||c,"cannot send data to receive-only contract","overrides.data",a.data);const f=l.receive||l.fallback&&l.fallback.payable;return $(f||u,"cannot send value to non-payable fallback","overrides.value",a.value),$(l.fallback||c,"cannot send data to receive-only contract","overrides.data",a.data),a},n=async function(o){const a=Il(t.runner,"call");ee(LP(a),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const l=await e(o);try{return await a.call(l)}catch(u){throw Ax(u)&&u.data?t.interface.makeError(u.data,l):u}},r=async function(o){const a=t.runner;ee(FP(a),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const l=await a.sendTransaction(await e(o)),u=Ll(t.runner);return new h2(t.interface,u,l)},s=async function(o){const a=Il(t.runner,"estimateGas");return ee(BP(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 Oe(i,{_contract:t,estimateGas:s,populateTransaction:e,send:r,staticCall:n}),i}function Mie(t,e){const n=function(...u){const c=t.interface.getFunction(e,u);return ee(c,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:u}}),c},r=async function(...u){const c=n(...u);let f={};if(c.inputs.length+1===u.length&&(f=await UP(u.pop()),f.from&&(f.from=await Qn(f.from,jP(t.runner)))),c.inputs.length!==u.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const d=await Oie(t.runner,c.inputs,u);return Object.assign({},f,await Nn({to:t.getAddress(),data:t.interface.encodeFunctionData(c,d)}))},s=async function(...u){const c=await a(...u);return c.length===1?c[0]:c},i=async function(...u){const c=t.runner;ee(FP(c),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const f=await c.sendTransaction(await r(...u)),d=Ll(t.runner);return new h2(t.interface,d,f)},o=async function(...u){const c=Il(t.runner,"estimateGas");return ee(BP(c),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await c.estimateGas(await r(...u))},a=async function(...u){const c=Il(t.runner,"call");ee(LP(c),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const f=await r(...u);let d="0x";try{d=await c.call(f)}catch(p){throw Ax(p)&&p.data?t.interface.makeError(p.data,f):p}const h=n(...u);return t.interface.decodeFunctionResult(h,d)},l=async(...u)=>n(...u).constant?await s(...u):await i(...u);return Oe(l,{name:t.interface.getFunctionName(e),_contract:t,_key:e,getFragment:n,estimateGas:o,populateTransaction:r,send:i,staticCall:s,staticCallResult:a}),Object.defineProperty(l,"fragment",{configurable:!1,enumerable:!0,get:()=>{const u=t.interface.getFunction(e);return ee(u,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),u}}),l}function Nie(t,e){const n=function(...s){const i=t.interface.getEvent(e,s);return ee(i,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:s}}),i},r=function(...s){return new Die(t,n(...s),s)};return Oe(r,{name:t.interface.getEventName(e),_contract:t,_key:e,getFragment:n}),Object.defineProperty(r,"fragment",{configurable:!1,enumerable:!0,get:()=>{const s=t.interface.getEvent(e);return ee(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),s}}),r}const by=Symbol.for("_ethersInternal_contract"),VP=new WeakMap;function Rie(t,e){VP.set(t[by],e)}function Rr(t){return VP.get(t[by])}function Pie(t){return t&&typeof t=="object"&&"getTopicFilter"in t&&typeof t.getTopicFilter=="function"&&t.fragment}async function p2(t,e){let n,r=null;if(Array.isArray(e)){const i=function(o){if(St(o,32))return o;const a=t.interface.getEvent(o);return $(a,"unknown fragment","name",o),a.topicHash};n=e.map(o=>o==null?null:Array.isArray(o)?o.map(i):i(o))}else e==="*"?n=[null]:typeof e=="string"?St(e,32)?n=[e]:(r=t.interface.getEvent(e),$(r,"unknown fragment","event",e),n=[r.topicHash]):Pie(e)?n=await e.getTopicFilter():"fragment"in e?(r=e.fragment,n=[r.topicHash]):$(!1,"unknown event name","event",e);n=n.map(i=>{if(i==null)return null;if(Array.isArray(i)){const o=Array.from(new Set(i.map(a=>a.toLowerCase())).values());return o.length===1?o[0]:(o.sort(),o)}return i.toLowerCase()});const s=n.map(i=>i==null?"null":Array.isArray(i)?i.join("|"):i).join("&");return{fragment:r,tag:s,topics:n}}async function Kh(t,e){const{subs:n}=Rr(t);return n.get((await p2(t,e)).tag)||null}async function HP(t,e,n){const r=Ll(t.runner);ee(r,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:s,tag:i,topics:o}=await p2(t,n),{addr:a,subs:l}=Rr(t);let u=l.get(i);if(!u){const f={address:a||t,topics:o},d=g=>{let y=s;if(y==null)try{y=t.interface.getEvent(g.topics[0])}catch{}if(y){const v=y,w=s?t.interface.decodeEventLog(s,g.data,g.topics):[];g2(t,n,w,A=>new Tie(t,A,n,v,g))}else g2(t,n,[],v=>new PP(t,v,n,g))};let h=[];u={tag:i,listeners:[],start:()=>{h.length||h.push(r.on(f,d))},stop:async()=>{if(h.length==0)return;let g=h;h=[],await Promise.all(g),r.off(f,d)}},l.set(i,u)}return u}let m2=Promise.resolve();async function Iie(t,e,n,r){await m2;const s=await Kh(t,e);if(!s)return!1;const i=s.listeners.length;return s.listeners=s.listeners.filter(({listener:o,once:a})=>{const l=Array.from(n);r&&l.push(r(a?null:o));try{o.call(t,...l)}catch{}return!a}),s.listeners.length===0&&(s.stop(),Rr(t).subs.delete(s.tag)),i>0}async function g2(t,e,n,r){try{await m2}catch{}const s=Iie(t,e,n,r);return m2=s,await s}const wy=["then"];zL=by;const vp=class vp{constructor(e,n,r,s){W(this,"target");W(this,"interface");W(this,"runner");W(this,"filters");W(this,zL);W(this,"fallback");$(typeof e=="string"||xR(e),"invalid value for Contract target","target",e),r==null&&(r=null);const i=f2.from(n);Oe(this,{target:e,runner:r,interface:i}),Object.defineProperty(this,by,{value:{}});let o,a=null,l=null;if(s){const f=Ll(r);l=new h2(this.interface,f,s)}let u=new Map;if(typeof e=="string")if(St(e))a=e,o=Promise.resolve(e);else{const f=Il(r,"resolveName");if(!yy(f))throw Nt("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});o=f.resolveName(e).then(d=>{if(d==null)throw Nt("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:e});return Rr(this).addr=d,d})}else o=e.getAddress().then(f=>{if(f==null)throw new Error("TODO");return Rr(this).addr=f,f});Rie(this,{addrPromise:o,addr:a,deployTx:l,subs:u});const c=new Proxy({},{get:(f,d,h)=>{if(typeof d=="symbol"||wy.indexOf(d)>=0)return Reflect.get(f,d,h);try{return this.getEvent(d)}catch(p){if(!gn(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(f,d)=>wy.indexOf(d)>=0?Reflect.has(f,d):Reflect.has(f,d)||this.interface.hasEvent(String(d))});return Oe(this,{filters:c}),Oe(this,{fallback:i.receive||i.fallback?_ie(this):null}),new Proxy(this,{get:(f,d,h)=>{if(typeof d=="symbol"||d in f||wy.indexOf(d)>=0)return Reflect.get(f,d,h);try{return f.getFunction(d)}catch(p){if(!gn(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(f,d)=>typeof d=="symbol"||d in f||wy.indexOf(d)>=0?Reflect.has(f,d):f.interface.hasFunction(d)})}connect(e){return new vp(this.target,this.interface,e)}attach(e){return new vp(e,this.interface,this.runner)}async getAddress(){return await Rr(this).addrPromise}async getDeployedCode(){const e=Ll(this.runner);ee(e,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const n=await e.getCode(await this.getAddress());return n==="0x"?null:n}async waitForDeployment(){const e=this.deploymentTransaction();if(e)return await e.wait(),this;if(await this.getDeployedCode()!=null)return this;const r=Ll(this.runner);return ee(r!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((s,i)=>{const o=async()=>{try{if(await this.getDeployedCode()!=null)return s(this);r.once("block",o)}catch(a){i(a)}};o()})}deploymentTransaction(){return Rr(this).deployTx}getFunction(e){return typeof e!="string"&&(e=e.format()),Mie(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),Nie(this,e)}async queryTransaction(e){throw new Error("@TODO")}async queryFilter(e,n,r){n==null&&(n=0),r==null&&(r="latest");const{addr:s,addrPromise:i}=Rr(this),o=s||await i,{fragment:a,topics:l}=await p2(this,e),u={address:o,topics:l,fromBlock:n,toBlock:r},c=Ll(this.runner);return ee(c,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await c.getLogs(u)).map(f=>{let d=a;if(d==null)try{d=this.interface.getEvent(f.topics[0])}catch{}if(d)try{return new d2(f,this.interface,d)}catch(h){return new RP(f,h)}return new Gh(f,c)})}async on(e,n){const r=await HP(this,"on",e);return r.listeners.push({listener:n,once:!1}),r.start(),this}async once(e,n){const r=await HP(this,"once",e);return r.listeners.push({listener:n,once:!0}),r.start(),this}async emit(e,...n){return await g2(this,e,n,null)}async listenerCount(e){if(e){const s=await Kh(this,e);return s?s.listeners.length:0}const{subs:n}=Rr(this);let r=0;for(const{listeners:s}of n.values())r+=s.length;return r}async listeners(e){if(e){const s=await Kh(this,e);return s?s.listeners.map(({listener:i})=>i):[]}const{subs:n}=Rr(this);let r=[];for(const{listeners:s}of n.values())r=r.concat(s.map(({listener:i})=>i));return r}async off(e,n){const r=await Kh(this,e);if(!r)return this;if(n){const s=r.listeners.map(({listener:i})=>i).indexOf(n);s>=0&&r.listeners.splice(s,1)}return(n==null||r.listeners.length===0)&&(r.stop(),Rr(this).subs.delete(r.tag)),this}async removeAllListeners(e){if(e){const n=await Kh(this,e);if(!n)return this;n.stop(),Rr(this).subs.delete(n.tag)}else{const{subs:n}=Rr(this);for(const{tag:r,stop:s}of n.values())s(),n.delete(r)}return this}async addListener(e,n){return await this.on(e,n)}async removeListener(e,n){return await this.off(e,n)}static buildClass(e){class n extends vp{constructor(s,i=null){super(s,e,i)}}return n}static from(e,n,r){return r==null&&(r=null),new this(e,n,r)}};let y2=vp;function Lie(){return y2}class Vc extends Lie(){}function b2(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):$(!1,"unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}class Bie{constructor(e){W(this,"name");Oe(this,{name:e})}connect(e){return this}supportsCoinType(e){return!1}async encodeAddress(e,n){throw new Error("unsupported coin")}async decodeAddress(e,n){throw new Error("unsupported coin")}}const zP=new RegExp("^(ipfs)://(.*)$","i"),$P=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),zP,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")],Df=class Df{constructor(e,n,r){J(this,va);W(this,"provider");W(this,"address");W(this,"name");J(this,Aa);J(this,iu);Oe(this,{provider:e,address:n,name:r}),I(this,Aa,null),I(this,iu,new Vc(n,["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)","function addr(bytes32, uint) view returns (bytes)","function text(bytes32, string) view returns (string)","function contenthash(bytes32) view returns (bytes)"],e))}async supportsWildcard(){return T(this,Aa)==null&&I(this,Aa,(async()=>{try{return await T(this,iu).supportsInterface("0x9061b923")}catch(e){if(gn(e,"CALL_EXCEPTION"))return!1;throw I(this,Aa,null),e}})()),await T(this,Aa)}async getAddress(e){if(e==null&&(e=60),e===60)try{const i=await fe(this,va,Jf).call(this,"addr(bytes32)");return i==null||i===Ph?null:i}catch(i){if(gn(i,"CALL_EXCEPTION"))return null;throw i}if(e>=0&&e<2147483648){let i=e+2147483648;const o=await fe(this,va,Jf).call(this,"addr(bytes32,uint)",[i]);if(St(o,20))return gt(o)}let n=null;for(const i of this.provider.plugins)if(i instanceof Bie&&i.supportsCoinType(e)){n=i;break}if(n==null)return null;const r=await fe(this,va,Jf).call(this,"addr(bytes32,uint)",[e]);if(r==null||r==="0x")return null;const s=await n.decodeAddress(e,r);if(s!=null)return s;ee(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${e})`,info:{coinType:e,data:r}})}async getText(e){const n=await fe(this,va,Jf).call(this,"text(bytes32,string)",[e]);return n==null||n==="0x"?null:n}async getContentHash(){const e=await fe(this,va,Jf).call(this,"contenthash(bytes32)");if(e==null||e==="0x")return null;const n=e.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(n){const s=n[1]==="e3010170"?"ipfs":"ipns",i=parseInt(n[4],16);if(n[5].length===i*2)return`${s}://${ine("0x"+n[2])}`}const r=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(r&&r[1].length===64)return`bzz://${r[1]}`;ee(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:e}})}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const e=[{type:"name",value:this.name}];try{const n=await this.getText("avatar");if(n==null)return e.push({type:"!avatar",value:""}),{url:null,linkage:e};e.push({type:"avatar",value:n});for(let r=0;r<$P.length;r++){const s=n.match($P[r]);if(s==null)continue;const i=s[1].toLowerCase();switch(i){case"https":case"data":return e.push({type:"url",value:n}),{linkage:e,url:n};case"ipfs":{const o=b2(n);return e.push({type:"ipfs",value:n}),e.push({type:"url",value:o}),{linkage:e,url:o}}case"erc721":case"erc1155":{const o=i==="erc721"?"tokenURI(uint256)":"uri(uint256)";e.push({type:i,value:n});const a=await this.getAddress();if(a==null)return e.push({type:"!owner",value:""}),{url:null,linkage:e};const l=(s[2]||"").split("/");if(l.length!==2)return e.push({type:`!${i}caip`,value:s[2]||""}),{url:null,linkage:e};const u=l[1],c=new Vc(l[0],["function tokenURI(uint) view returns (string)","function ownerOf(uint) view returns (address)","function uri(uint) view returns (string)","function balanceOf(address, uint256) view returns (uint)"],this.provider);if(i==="erc721"){const m=await c.ownerOf(u);if(a!==m)return e.push({type:"!owner",value:m}),{url:null,linkage:e};e.push({type:"owner",value:m})}else if(i==="erc1155"){const m=await c.balanceOf(a,u);if(!m)return e.push({type:"!balance",value:"0"}),{url:null,linkage:e};e.push({type:"balance",value:m.toString()})}let f=await c[o](u);if(f==null||f==="0x")return e.push({type:"!metadata-url",value:""}),{url:null,linkage:e};e.push({type:"metadata-url-base",value:f}),i==="erc1155"&&(f=f.replace("{id}",Xo(u,32).substring(2)),e.push({type:"metadata-url-expanded",value:f})),f.match(/^ipfs:/i)&&(f=b2(f)),e.push({type:"metadata-url",value:f});let d={};const h=await new Kn(f).send();h.assertOk();try{d=h.bodyJson}catch{try{e.push({type:"!metadata",value:h.bodyText})}catch{const y=h.body;return y&&e.push({type:"!metadata",value:we(y)}),{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(zP)==null)return e.push({type:"!imageUrl-ipfs",value:p}),{url:null,linkage:e};e.push({type:"imageUrl-ipfs",value:p}),p=b2(p)}return e.push({type:"url",value:p}),{linkage:e,url:p}}}}}catch{}return{linkage:e,url:null}}static async getEnsAddress(e){const n=await e.getNetwork(),r=n.getPlugin("org.ethers.plugins.network.Ens");return ee(r,"network does not support ENS","UNSUPPORTED_OPERATION",{operation:"getEnsAddress",info:{network:n}}),r.address}static async fromName(e,n){var s;let r=n;for(;;){if(r===""||r==="."||n!=="eth"&&r==="eth")return null;const i=await fe(s=Df,lb,JL).call(s,e,r);if(i!=null){const o=new Df(e,i,n);return r!==n&&!await o.supportsWildcard()?null:o}r=r.split(".").slice(1).join(".")}}};Aa=new WeakMap,iu=new WeakMap,va=new WeakSet,Jf=async function(e,n){n=(n||[]).slice();const r=T(this,iu).interface;n.unshift(n2(this.name));let s=null;await this.supportsWildcard()&&(s=r.getFunction(e),ee(s,"missing fragment","UNKNOWN_ERROR",{info:{funcName:e}}),n=[Fse(this.name,255),r.encodeFunctionData(s,n)],e="resolve(bytes,bytes)"),n.push({enableCcipRead:!0});try{const i=await T(this,iu)[e](...n);return s?r.decodeFunctionResult(s,i)[0]:i}catch(i){if(!gn(i,"CALL_EXCEPTION"))throw i}return null},lb=new WeakSet,JL=async function(e,n){const r=await Df.getEnsAddress(e);try{const i=await new Vc(r,["function resolver(bytes32) view returns (address)"],e).resolver(n2(n),{enableCcipRead:!0});return i===Ph?null:i}catch(s){throw s}return null},J(Df,lb);let Ay=Df;const GP=BigInt(0);function lt(t,e){return function(n){return n==null?e:t(n)}}function vy(t,e){return n=>{if(e&&n==null)return null;if(!Array.isArray(n))throw new Error("not an array");return n.map(r=>t(r))}}function qh(t,e){return n=>{const r={};for(const s in t){let i=s;if(e&&s in e&&!(i in n)){for(const o of e[s])if(o in n){i=o;break}}try{const o=t[s](n[i]);o!==void 0&&(r[s]=o)}catch(o){const a=o instanceof Error?o.message:"not-an-error";ee(!1,`invalid value for value.${s} (${a})`,"BAD_DATA",{value:n})}}return r}}function Fie(t){switch(t){case!0:case"true":return!0;case!1:case"false":return!1}$(!1,`invalid boolean; ${JSON.stringify(t)}`,"value",t)}function Hc(t){return $(St(t,!0),"invalid data","value",t),t}function Cn(t){return $(St(t,32),"invalid hash","value",t),t}const jie=qh({address:gt,blockHash:Cn,blockNumber:Qe,data:Hc,index:Qe,removed:lt(Fie,!1),topics:vy(Cn),transactionHash:Cn,transactionIndex:Qe},{index:["logIndex"]});function Uie(t){return jie(t)}const Vie=qh({hash:lt(Cn),parentHash:Cn,parentBeaconBlockRoot:lt(Cn,null),number:Qe,timestamp:Qe,nonce:lt(Hc),difficulty:xe,gasLimit:xe,gasUsed:xe,stateRoot:lt(Cn,null),receiptsRoot:lt(Cn,null),blobGasUsed:lt(xe,null),excessBlobGas:lt(xe,null),miner:lt(gt),prevRandao:lt(Cn,null),extraData:Hc,baseFeePerGas:lt(xe)},{prevRandao:["mixHash"]});function Hie(t){const e=Vie(t);return e.transactions=t.transactions.map(n=>typeof n=="string"?n:WP(n)),e}const zie=qh({transactionIndex:Qe,blockNumber:Qe,transactionHash:Cn,address:gt,topics:vy(Cn),data:Hc,index:Qe,blockHash:Cn},{index:["logIndex"]});function $ie(t){return zie(t)}const Gie=qh({to:lt(gt,null),from:lt(gt,null),contractAddress:lt(gt,null),index:Qe,root:lt(we),gasUsed:xe,blobGasUsed:lt(xe,null),logsBloom:lt(Hc),blockHash:Cn,hash:Cn,logs:vy($ie),blockNumber:Qe,cumulativeGasUsed:xe,effectiveGasPrice:lt(xe),blobGasPrice:lt(xe,null),status:lt(Qe),type:lt(Qe,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function Wie(t){return Gie(t)}function WP(t){t.to&&xe(t.to)===GP&&(t.to="0x0000000000000000000000000000000000000000");const e=qh({hash:Cn,index:lt(Qe,void 0),type:n=>n==="0x"||n==null?0:Qe(n),accessList:lt(ia,null),blobVersionedHashes:lt(vy(Cn,!0),null),blockHash:lt(Cn,null),blockNumber:lt(Qe,null),transactionIndex:lt(Qe,null),from:gt,gasPrice:lt(xe),maxPriorityFeePerGas:lt(xe),maxFeePerGas:lt(xe),maxFeePerBlobGas:lt(xe,null),gasLimit:xe,to:lt(gt,null),value:xe,nonce:Qe,data:Hc,creates:lt(gt,null),chainId:lt(xe,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(t);if(e.to==null&&e.creates==null&&(e.creates=Ure(e)),(t.type===1||t.type===2)&&t.accessList==null&&(e.accessList=[]),t.signature?e.signature=Ss.from(t.signature):e.signature=Ss.from(t),e.chainId==null){const n=e.signature.legacyChainId;n!=null&&(e.chainId=n)}return e.blockHash&&xe(e.blockHash)===GP&&(e.blockHash=null),e}const Kie="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class Qh{constructor(e){W(this,"name");Oe(this,{name:e})}clone(){return new Qh(this.name)}}class xy extends Qh{constructor(n,r){n==null&&(n=0);super(`org.ethers.network.plugins.GasCost#${n||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:n};function i(o,a){let l=(r||{})[o];l==null&&(l=a),$(typeof l=="number",`invalud value for ${o}`,"costs",r),s[o]=l}i("txBase",21e3),i("txCreate",32e3),i("txDataZero",4),i("txDataNonzero",16),i("txAccessListStorageKey",1900),i("txAccessListAddress",2400),Oe(this,s)}clone(){return new xy(this.effectiveBlock,this)}}class ky extends Qh{constructor(n,r){super("org.ethers.plugins.network.Ens");W(this,"address");W(this,"targetNetwork");Oe(this,{address:n||Kie,targetNetwork:r??1})}clone(){return new ky(this.address,this.targetNetwork)}}class qie extends Qh{constructor(n,r){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin");J(this,xp);J(this,kp);I(this,xp,n),I(this,kp,r)}get url(){return T(this,xp)}get processFunc(){return T(this,kp)}clone(){return this}}xp=new WeakMap,kp=new WeakMap;const w2=new Map,Mf=class Mf{constructor(e,n){J(this,Of);J(this,_f);J(this,xa);I(this,Of,e),I(this,_f,xe(n)),I(this,xa,new Map)}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return T(this,Of)}set name(e){I(this,Of,e)}get chainId(){return T(this,_f)}set chainId(e){I(this,_f,xe(e,"chainId"))}matches(e){if(e==null)return!1;if(typeof e=="string"){try{return this.chainId===xe(e)}catch{}return this.name===e}if(typeof e=="number"||typeof e=="bigint"){try{return this.chainId===xe(e)}catch{}return!1}if(typeof e=="object"){if(e.chainId!=null){try{return this.chainId===xe(e.chainId)}catch{}return!1}return e.name!=null?this.name===e.name:!1}return!1}get plugins(){return Array.from(T(this,xa).values())}attachPlugin(e){if(T(this,xa).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return T(this,xa).set(e.name,e.clone()),this}getPlugin(e){return T(this,xa).get(e)||null}getPlugins(e){return this.plugins.filter(n=>n.name.split("#")[0]===e)}clone(){const e=new Mf(this.name,this.chainId);return this.plugins.forEach(n=>{e.attachPlugin(n.clone())}),e}computeIntrinsicGas(e){const n=this.getPlugin("org.ethers.plugins.network.GasCost")||new xy;let r=n.txBase;if(e.to==null&&(r+=n.txCreate),e.data)for(let s=2;s<e.data.length;s+=2)e.data.substring(s,s+2)==="00"?r+=n.txDataZero:r+=n.txDataNonzero;if(e.accessList){const s=ia(e.accessList);for(const i in s)r+=n.txAccessListAddress+n.txAccessListStorageKey*s[i].storageKeys.length}return r}static from(e){if(Qie(),e==null)return Mf.from("mainnet");if(typeof e=="number"&&(e=BigInt(e)),typeof e=="string"||typeof e=="bigint"){const n=w2.get(e);if(n)return n();if(typeof e=="bigint")return new Mf("unknown",e);$(!1,"unknown network","network",e)}if(typeof e.clone=="function")return e.clone();if(typeof e=="object"){$(typeof e.name=="string"&&typeof e.chainId=="number","invalid network object name or chainId","network",e);const n=new Mf(e.name,e.chainId);return(e.ensAddress||e.ensNetwork!=null)&&n.attachPlugin(new ky(e.ensAddress,e.ensNetwork)),n}$(!1,"invalid network","network",e)}static register(e,n){typeof e=="number"&&(e=BigInt(e));const r=w2.get(e);r&&$(!1,`conflicting network for ${JSON.stringify(r.name)}`,"nameOrChainId",e),w2.set(e,n)}};Of=new WeakMap,_f=new WeakMap,xa=new WeakMap;let rn=Mf;function KP(t,e){const n=String(t);if(!n.match(/^[0-9.]+$/))throw new Error(`invalid gwei value: ${t}`);const r=n.split(".");if(r.length===1&&r.push(""),r.length!==2)throw new Error(`invalid gwei value: ${t}`);for(;r[1].length<e;)r[1]+="0";if(r[1].length>9){let s=BigInt(r[1].substring(0,9));r[1].substring(9).match(/^0+$/)||s++,r[1]=s.toString()}return BigInt(r[0]+r[1])}function qP(t){return new qie(t,async(e,n,r)=>{r.setHeader("User-Agent","ethers");let s;try{const[i,o]=await Promise.all([r.send(),e()]);s=i;const a=s.bodyJson.standard;return{gasPrice:o.gasPrice,maxFeePerGas:KP(a.maxFee,9),maxPriorityFeePerGas:KP(a.maxPriorityFee,9)}}catch(i){ee(!1,`error encountered with polygon gas station (${JSON.stringify(r.url)})`,"SERVER_ERROR",{request:r,response:s,error:i})}})}let QP=!1;function Qie(){if(QP)return;QP=!0;function t(e,n,r){const s=function(){const i=new rn(e,n);return r.ensNetwork!=null&&i.attachPlugin(new ky(null,r.ensNetwork)),i.attachPlugin(new xy),(r.plugins||[]).forEach(o=>{i.attachPlugin(o)}),i};rn.register(e,s),rn.register(n,s),r.altNames&&r.altNames.forEach(i=>{rn.register(i,s)})}t("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),t("ropsten",3,{ensNetwork:3}),t("rinkeby",4,{ensNetwork:4}),t("goerli",5,{ensNetwork:5}),t("kovan",42,{ensNetwork:42}),t("sepolia",11155111,{ensNetwork:11155111}),t("holesky",17e3,{ensNetwork:17e3}),t("classic",61,{}),t("classicKotti",6,{}),t("arbitrum",42161,{ensNetwork:1}),t("arbitrum-goerli",421613,{}),t("arbitrum-sepolia",421614,{}),t("base",8453,{ensNetwork:1}),t("base-goerli",84531,{}),t("base-sepolia",84532,{}),t("bnb",56,{ensNetwork:1}),t("bnbt",97,{}),t("linea",59144,{ensNetwork:1}),t("linea-goerli",59140,{}),t("linea-sepolia",59141,{}),t("matic",137,{ensNetwork:1,plugins:[qP("https://gasstation.polygon.technology/v2")]}),t("matic-amoy",80002,{}),t("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[qP("https://gasstation-testnet.polygon.technology/v2")]}),t("optimism",10,{ensNetwork:1,plugins:[]}),t("optimism-goerli",420,{}),t("optimism-sepolia",11155420,{}),t("xdai",100,{ensNetwork:1})}function A2(t){return JSON.parse(JSON.stringify(t))}class Jie{constructor(e){J(this,Nf);J(this,ho);J(this,ss);J(this,ka);J(this,wi);I(this,ho,e),I(this,ss,null),I(this,ka,4e3),I(this,wi,-2)}get pollingInterval(){return T(this,ka)}set pollingInterval(e){I(this,ka,e)}start(){T(this,ss)||(I(this,ss,T(this,ho)._setTimeout(fe(this,Nf,gb).bind(this),T(this,ka))),fe(this,Nf,gb).call(this))}stop(){T(this,ss)&&(T(this,ho)._clearTimeout(T(this,ss)),I(this,ss,null))}pause(e){this.stop(),e&&I(this,wi,-2)}resume(){this.start()}}ho=new WeakMap,ss=new WeakMap,ka=new WeakMap,wi=new WeakMap,Nf=new WeakSet,gb=async function(){try{const e=await T(this,ho).getBlockNumber();if(T(this,wi)===-2){I(this,wi,e);return}if(e!==T(this,wi)){for(let n=T(this,wi)+1;n<=e;n++){if(T(this,ss)==null)return;await T(this,ho).emit("block",n)}I(this,wi,e)}}catch{}T(this,ss)!=null&&I(this,ss,T(this,ho)._setTimeout(fe(this,Nf,gb).bind(this),T(this,ka)))};class v2{constructor(e){J(this,ou);J(this,au);J(this,Ea);I(this,ou,e),I(this,Ea,!1),I(this,au,n=>{this._poll(n,T(this,ou))})}async _poll(e,n){throw new Error("sub-classes must override this")}start(){T(this,Ea)||(I(this,Ea,!0),T(this,au).call(this,-2),T(this,ou).on("block",T(this,au)))}stop(){T(this,Ea)&&(I(this,Ea,!1),T(this,ou).off("block",T(this,au)))}pause(e){this.stop()}resume(){this.start()}}ou=new WeakMap,au=new WeakMap,Ea=new WeakMap;class Yie extends v2{constructor(n,r){super(n);J(this,Rf);J(this,po);I(this,Rf,r),I(this,po,-2)}pause(n){n&&I(this,po,-2),super.pause(n)}async _poll(n,r){const s=await r.getBlock(T(this,Rf));s!=null&&(T(this,po)===-2?I(this,po,s.number):s.number>T(this,po)&&(r.emit(T(this,Rf),s.number),I(this,po,s.number)))}}Rf=new WeakMap,po=new WeakMap;class Xie extends v2{constructor(n,r){super(n);J(this,ub);I(this,ub,A2(r))}async _poll(n,r){throw new Error("@TODO")}}ub=new WeakMap;class Zie extends v2{constructor(n,r){super(n);J(this,Pf);I(this,Pf,r)}async _poll(n,r){const s=await r.getTransactionReceipt(T(this,Pf));s&&r.emit(T(this,Pf),s)}}Pf=new WeakMap;class x2{constructor(e,n){J(this,cb);J(this,mo);J(this,If);J(this,Lf);J(this,Ca);J(this,is);I(this,mo,e),I(this,If,A2(n)),I(this,Lf,fe(this,cb,YL).bind(this)),I(this,Ca,!1),I(this,is,-2)}start(){T(this,Ca)||(I(this,Ca,!0),T(this,is)===-2&&T(this,mo).getBlockNumber().then(e=>{I(this,is,e)}),T(this,mo).on("block",T(this,Lf)))}stop(){T(this,Ca)&&(I(this,Ca,!1),T(this,mo).off("block",T(this,Lf)))}pause(e){this.stop(),e&&I(this,is,-2)}resume(){this.start()}}mo=new WeakMap,If=new WeakMap,Lf=new WeakMap,Ca=new WeakMap,is=new WeakMap,cb=new WeakSet,YL=async function(e){if(T(this,is)===-2)return;const n=A2(T(this,If));n.fromBlock=T(this,is)+1,n.toBlock=e;const r=await T(this,mo).getLogs(n);if(r.length===0){T(this,is)<e-60&&I(this,is,e-60);return}for(const s of r)T(this,mo).emit(T(this,If),s),I(this,is,s.blockNumber)};const eoe=BigInt(2),toe=10;function Ey(t){return t&&typeof t.then=="function"}function Cy(t,e){return t+":"+JSON.stringify(e,(n,r)=>{if(r==null)return"null";if(typeof r=="bigint")return`bigint:${r.toString()}`;if(typeof r=="string")return r.toLowerCase();if(typeof r=="object"&&!Array.isArray(r)){const s=Object.keys(r);return s.sort(),s.reduce((i,o)=>(i[o]=r[o],i),{})}return r})}class Sy{constructor(e){W(this,"name");Oe(this,{name:e})}start(){}stop(){}pause(e){}resume(){}}function noe(t){return JSON.parse(JSON.stringify(t))}function k2(t){return t=Array.from(new Set(t).values()),t.sort(),t}async function E2(t,e){if(t==null)throw new Error("invalid event");if(Array.isArray(t)&&(t={topics:t}),typeof t=="string")switch(t){case"block":case"debug":case"error":case"finalized":case"network":case"pending":case"safe":return{type:t,tag:t}}if(St(t,32)){const n=t.toLowerCase();return{type:"transaction",tag:Cy("tx",{hash:n}),hash:n}}if(t.orphan){const n=t;return{type:"orphan",tag:Cy("orphan",n),filter:noe(n)}}if(t.address||t.topics){const n=t,r={topics:(n.topics||[]).map(s=>s==null?null:Array.isArray(s)?k2(s.map(i=>i.toLowerCase())):s.toLowerCase())};if(n.address){const s=[],i=[],o=a=>{St(a)?s.push(a):i.push((async()=>{s.push(await Qn(a,e))})())};Array.isArray(n.address)?n.address.forEach(o):o(n.address),i.length&&await Promise.all(i),r.address=k2(s.map(a=>a.toLowerCase()))}return{filter:r,tag:Cy("event",r),type:"event"}}$(!1,"unknown ProviderEvent","event",t)}function C2(){return new Date().getTime()}const roe={cacheTimeout:250,pollingInterval:4e3};class Ty{constructor(e,n){J(this,st);J(this,Bn);J(this,Sa);J(this,Fn);J(this,Bf);J(this,Fr);J(this,lu);J(this,Ta);J(this,go);J(this,Ep);J(this,as);J(this,Ff);J(this,jf);if(I(this,jf,Object.assign({},roe,n||{})),e==="any")I(this,lu,!0),I(this,Fr,null);else if(e){const r=rn.from(e);I(this,lu,!1),I(this,Fr,Promise.resolve(r)),setTimeout(()=>{this.emit("network",r,null)},0)}else I(this,lu,!1),I(this,Fr,null);I(this,go,-1),I(this,Ta,new Map),I(this,Bn,new Map),I(this,Sa,new Map),I(this,Fn,null),I(this,Bf,!1),I(this,Ep,1),I(this,as,new Map),I(this,Ff,!1)}get pollingInterval(){return T(this,jf).pollingInterval}get provider(){return this}get plugins(){return Array.from(T(this,Sa).values())}attachPlugin(e){if(T(this,Sa).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return T(this,Sa).set(e.name,e.connect(this)),this}getPlugin(e){return T(this,Sa).get(e)||null}get disableCcipRead(){return T(this,Ff)}set disableCcipRead(e){I(this,Ff,!!e)}async ccipReadFetch(e,n,r){if(this.disableCcipRead||r.length===0||e.to==null)return null;const s=e.to.toLowerCase(),i=n.toLowerCase(),o=[];for(let a=0;a<r.length;a++){const l=r[a],u=l.replace("{sender}",s).replace("{data}",i),c=new Kn(u);l.indexOf("{data}")===-1&&(c.body={data:i,sender:s}),this.emit("debug",{action:"sendCcipReadFetchRequest",request:c,index:a,urls:r});let f="unknown error";const d=await c.send();try{const h=d.bodyJson;if(h.data)return this.emit("debug",{action:"receiveCcipReadFetchResult",request:c,result:h}),h.data;h.message&&(f=h.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:c,result:h})}catch{}ee(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)}ee(!1,`error encountered during CCIP fetch: ${o.map(a=>JSON.stringify(a)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:e,info:{urls:r,errorMessages:o}})}_wrapBlock(e,n){return new kie(Hie(e),this)}_wrapLog(e,n){return new Gh(Uie(e),this)}_wrapTransactionReceipt(e,n){return new _P(Wie(e),this)}_wrapTransactionResponse(e,n){return new Wh(WP(e),this)}_detectNetwork(){ee(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(e){ee(!1,`unsupported method: ${e.method}`,"UNSUPPORTED_OPERATION",{operation:e.method,info:e})}async getBlockNumber(){const e=Qe(await fe(this,st,jr).call(this,{method:"getBlockNumber"}),"%response");return T(this,go)>=0&&I(this,go,e),e}_getAddress(e){return Qn(e,this)}_getBlockTag(e){if(e==null)return"latest";switch(e){case"earliest":return"0x0";case"finalized":case"latest":case"pending":case"safe":return e}if(St(e))return St(e,32)?e:kl(e);if(typeof e=="bigint"&&(e=Qe(e,"blockTag")),typeof e=="number")return e>=0?kl(e):T(this,go)>=0?kl(T(this,go)+e):this.getBlockNumber().then(n=>kl(n+e));$(!1,"invalid blockTag","blockTag",e)}_getFilter(e){const n=(e.topics||[]).map(l=>l==null?null:Array.isArray(l)?k2(l.map(u=>u.toLowerCase())):l.toLowerCase()),r="blockHash"in e?e.blockHash:void 0,s=(l,u,c)=>{let f;switch(l.length){case 0:break;case 1:f=l[0];break;default:l.sort(),f=l}if(r&&(u!=null||c!=null))throw new Error("invalid filter");const d={};return f&&(d.address=f),n.length&&(d.topics=n),u&&(d.fromBlock=u),c&&(d.toBlock=c),r&&(d.blockHash=r),d};let i=[];if(e.address)if(Array.isArray(e.address))for(const l of e.address)i.push(this._getAddress(l));else i.push(this._getAddress(e.address));let o;"fromBlock"in e&&(o=this._getBlockTag(e.fromBlock));let a;return"toBlock"in e&&(a=this._getBlockTag(e.toBlock)),i.filter(l=>typeof l!="string").length||o!=null&&typeof o!="string"||a!=null&&typeof a!="string"?Promise.all([Promise.all(i),o,a]).then(l=>s(l[0],l[1],l[2])):s(i,o,a)}_getTransactionRequest(e){const n=gy(e),r=[];if(["to","from"].forEach(s=>{if(n[s]==null)return;const i=Qn(n[s],this);Ey(i)?r.push(async function(){n[s]=await i}()):n[s]=i}),n.blockTag!=null){const s=this._getBlockTag(n.blockTag);Ey(s)?r.push(async function(){n.blockTag=await s}()):n.blockTag=s}return r.length?async function(){return await Promise.all(r),n}():n}async getNetwork(){if(T(this,Fr)==null){const s=(async()=>{try{const i=await this._detectNetwork();return this.emit("network",i,null),i}catch(i){throw T(this,Fr)===s&&I(this,Fr,null),i}})();return I(this,Fr,s),(await s).clone()}const e=T(this,Fr),[n,r]=await Promise.all([e,this._detectNetwork()]);return n.chainId!==r.chainId&&(T(this,lu)?(this.emit("network",r,n),T(this,Fr)===e&&I(this,Fr,Promise.resolve(r))):ee(!1,`network changed: ${n.chainId} => ${r.chainId} `,"NETWORK_ERROR",{event:"changed"})),n.clone()}async getFeeData(){const e=await this.getNetwork(),n=async()=>{const{_block:s,gasPrice:i,priorityFee:o}=await Nn({_block:fe(this,st,nE).call(this,"latest",!1),gasPrice:(async()=>{try{const c=await fe(this,st,jr).call(this,{method:"getGasPrice"});return xe(c,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const c=await fe(this,st,jr).call(this,{method:"getPriorityFee"});return xe(c,"%response")}catch{}return null})()});let a=null,l=null;const u=this._wrapBlock(s,e);return u&&u.baseFeePerGas&&(l=o??BigInt("1000000000"),a=u.baseFeePerGas*eoe+l),new OP(i,a,l)},r=e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(r){const s=new Kn(r.url),i=await r.processFunc(n,this,s);return new OP(i.gasPrice,i.maxFeePerGas,i.maxPriorityFeePerGas)}return await n()}async estimateGas(e){let n=this._getTransactionRequest(e);return Ey(n)&&(n=await n),xe(await fe(this,st,jr).call(this,{method:"estimateGas",transaction:n}),"%response")}async call(e){const{tx:n,blockTag:r}=await Nn({tx:this._getTransactionRequest(e),blockTag:this._getBlockTag(e.blockTag)});return await fe(this,st,tE).call(this,fe(this,st,eE).call(this,n,r,e.enableCcipRead?0:-1))}async getBalance(e,n){return xe(await fe(this,st,_p).call(this,{method:"getBalance"},e,n),"%response")}async getTransactionCount(e,n){return Qe(await fe(this,st,_p).call(this,{method:"getTransactionCount"},e,n),"%response")}async getCode(e,n){return we(await fe(this,st,_p).call(this,{method:"getCode"},e,n))}async getStorage(e,n,r){const s=xe(n,"position");return we(await fe(this,st,_p).call(this,{method:"getStorage",position:s},e,r))}async broadcastTransaction(e){const{blockNumber:n,hash:r,network:s}=await Nn({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:e}),network:this.getNetwork()}),i=zh.from(e);if(i.hash!==r)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(i,s).replaceableTransaction(n)}async getBlock(e,n){const{network:r,params:s}=await Nn({network:this.getNetwork(),params:fe(this,st,nE).call(this,e,!!n)});return s==null?null:this._wrapBlock(s,r)}async getTransaction(e){const{network:n,params:r}=await Nn({network:this.getNetwork(),params:fe(this,st,jr).call(this,{method:"getTransaction",hash:e})});return r==null?null:this._wrapTransactionResponse(r,n)}async getTransactionReceipt(e){const{network:n,params:r}=await Nn({network:this.getNetwork(),params:fe(this,st,jr).call(this,{method:"getTransactionReceipt",hash:e})});if(r==null)return null;if(r.gasPrice==null&&r.effectiveGasPrice==null){const s=await fe(this,st,jr).call(this,{method:"getTransaction",hash:e});if(s==null)throw new Error("report this; could not find tx or effectiveGasPrice");r.effectiveGasPrice=s.gasPrice}return this._wrapTransactionReceipt(r,n)}async getTransactionResult(e){const{result:n}=await Nn({network:this.getNetwork(),result:fe(this,st,jr).call(this,{method:"getTransactionResult",hash:e})});return n==null?null:we(n)}async getLogs(e){let n=this._getFilter(e);Ey(n)&&(n=await n);const{network:r,params:s}=await Nn({network:this.getNetwork(),params:fe(this,st,jr).call(this,{method:"getLogs",filter:n})});return s.map(i=>this._wrapLog(i,r))}_getProvider(e){ee(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(e){return await Ay.fromName(this,e)}async getAvatar(e){const n=await this.getResolver(e);return n?await n.getAvatar():null}async resolveName(e){const n=await this.getResolver(e);return n?await n.getAddress():null}async lookupAddress(e){e=gt(e);const n=n2(e.substring(2).toLowerCase()+".addr.reverse");try{const r=await Ay.getEnsAddress(this),i=await new Vc(r,["function resolver(bytes32) view returns (address)"],this).resolver(n);if(i==null||i===Ph)return null;const a=await new Vc(i,["function name(bytes32) view returns (string)"],this).name(n);return await this.resolveName(a)!==e?null:a}catch(r){if(gn(r,"BAD_DATA")&&r.value==="0x"||gn(r,"CALL_EXCEPTION"))return null;throw r}return null}async waitForTransaction(e,n,r){const s=n??1;return s===0?this.getTransactionReceipt(e):new Promise(async(i,o)=>{let a=null;const l=async u=>{try{const c=await this.getTransactionReceipt(e);if(c!=null&&u-c.blockNumber+1>=s){i(c),a&&(clearTimeout(a),a=null);return}}catch(c){console.log("EEE",c)}this.once("block",l)};r!=null&&(a=setTimeout(()=>{a!=null&&(a=null,this.off("block",l),o(Nt("timeout","TIMEOUT",{reason:"timeout"})))},r)),l(await this.getBlockNumber())})}async waitForBlock(e){ee(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(e){const n=T(this,as).get(e);n&&(n.timer&&clearTimeout(n.timer),T(this,as).delete(e))}_setTimeout(e,n){n==null&&(n=0);const r=Dp(this,Ep)._++,s=()=>{T(this,as).delete(r),e()};if(this.paused)T(this,as).set(r,{timer:null,func:s,time:n});else{const i=setTimeout(s,n);T(this,as).set(r,{timer:i,func:s,time:C2()})}return r}_forEachSubscriber(e){for(const n of T(this,Bn).values())e(n.subscriber)}_getSubscriber(e){switch(e.type){case"debug":case"error":case"network":return new Sy(e.type);case"block":{const n=new Jie(this);return n.pollingInterval=this.pollingInterval,n}case"safe":case"finalized":return new Yie(this,e.type);case"event":return new x2(this,e.filter);case"transaction":return new Zie(this,e.hash);case"orphan":return new Xie(this,e.filter)}throw new Error(`unsupported event: ${e.type}`)}_recoverSubscriber(e,n){for(const r of T(this,Bn).values())if(r.subscriber===e){r.started&&r.subscriber.stop(),r.subscriber=n,r.started&&n.start(),T(this,Fn)!=null&&n.pause(T(this,Fn));break}}async on(e,n){const r=await fe(this,st,yb).call(this,e);return r.listeners.push({listener:n,once:!1}),r.started||(r.subscriber.start(),r.started=!0,T(this,Fn)!=null&&r.subscriber.pause(T(this,Fn))),this}async once(e,n){const r=await fe(this,st,yb).call(this,e);return r.listeners.push({listener:n,once:!0}),r.started||(r.subscriber.start(),r.started=!0,T(this,Fn)!=null&&r.subscriber.pause(T(this,Fn))),this}async emit(e,...n){const r=await fe(this,st,Mp).call(this,e,n);if(!r||r.listeners.length===0)return!1;const s=r.listeners.length;return r.listeners=r.listeners.filter(({listener:i,once:o})=>{const a=new d4(this,o?null:i,e);try{i.call(this,...n,a)}catch{}return!o}),r.listeners.length===0&&(r.started&&r.subscriber.stop(),T(this,Bn).delete(r.tag)),s>0}async listenerCount(e){if(e){const r=await fe(this,st,Mp).call(this,e);return r?r.listeners.length:0}let n=0;for(const{listeners:r}of T(this,Bn).values())n+=r.length;return n}async listeners(e){if(e){const r=await fe(this,st,Mp).call(this,e);return r?r.listeners.map(({listener:s})=>s):[]}let n=[];for(const{listeners:r}of T(this,Bn).values())n=n.concat(r.map(({listener:s})=>s));return n}async off(e,n){const r=await fe(this,st,Mp).call(this,e);if(!r)return this;if(n){const s=r.listeners.map(({listener:i})=>i).indexOf(n);s>=0&&r.listeners.splice(s,1)}return(!n||r.listeners.length===0)&&(r.started&&r.subscriber.stop(),T(this,Bn).delete(r.tag)),this}async removeAllListeners(e){if(e){const{tag:n,started:r,subscriber:s}=await fe(this,st,yb).call(this,e);r&&s.stop(),T(this,Bn).delete(n)}else for(const[n,{started:r,subscriber:s}]of T(this,Bn))r&&s.stop(),T(this,Bn).delete(n);return this}async addListener(e,n){return await this.on(e,n)}async removeListener(e,n){return this.off(e,n)}get destroyed(){return T(this,Bf)}destroy(){this.removeAllListeners();for(const e of T(this,as).keys())this._clearTimeout(e);I(this,Bf,!0)}get paused(){return T(this,Fn)!=null}set paused(e){!!e!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(e){if(I(this,go,-1),T(this,Fn)!=null){if(T(this,Fn)==!!e)return;ee(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(n=>n.pause(e)),I(this,Fn,!!e);for(const n of T(this,as).values())n.timer&&clearTimeout(n.timer),n.time=C2()-n.time}resume(){if(T(this,Fn)!=null){this._forEachSubscriber(e=>e.resume()),I(this,Fn,null);for(const e of T(this,as).values()){let n=e.time;n<0&&(n=0),e.time=C2(),setTimeout(e.func,n)}}}}Bn=new WeakMap,Sa=new WeakMap,Fn=new WeakMap,Bf=new WeakMap,Fr=new WeakMap,lu=new WeakMap,Ta=new WeakMap,go=new WeakMap,Ep=new WeakMap,as=new WeakMap,Ff=new WeakMap,jf=new WeakMap,st=new WeakSet,jr=async function(e){const n=T(this,jf).cacheTimeout;if(n<0)return await this._perform(e);const r=Cy(e.method,e);let s=T(this,Ta).get(r);return s||(s=this._perform(e),T(this,Ta).set(r,s),setTimeout(()=>{T(this,Ta).get(r)===s&&T(this,Ta).delete(r)},n)),await s},eE=async function(e,n,r){ee(r<toe,"CCIP read exceeded maximum redirections","OFFCHAIN_FAULT",{reason:"TOO_MANY_REDIRECTS",transaction:Object.assign({},e,{blockTag:n,enableCcipRead:!0})});const s=gy(e);try{return we(await this._perform({method:"call",transaction:s,blockTag:n}))}catch(i){if(!this.disableCcipRead&&Ax(i)&&i.data&&r>=0&&n==="latest"&&s.to!=null&&Ht(i.data,0,4)==="0x556f1830"){const o=i.data,a=await Qn(s.to,this);let l;try{l=loe(Ht(i.data,4))}catch(f){ee(!1,f.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:s,info:{data:o}})}ee(l.sender.toLowerCase()===a.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:o,reason:"OffchainLookup",transaction:s,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:l.errorArgs}});const u=await this.ccipReadFetch(s,l.calldata,l.urls);ee(u!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:s,info:{data:i.data,errorArgs:l.errorArgs}});const c={to:a,data:$t([l.selector,aoe([u,l.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:c});try{const f=await fe(this,st,eE).call(this,c,n,r+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},c),result:f}),f}catch(f){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},c),error:f}),f}}throw i}},tE=async function(e){const{value:n}=await Nn({network:this.getNetwork(),value:e});return n},_p=async function(e,n,r){let s=this._getAddress(n),i=this._getBlockTag(r);return(typeof s!="string"||typeof i!="string")&&([s,i]=await Promise.all([s,i])),await fe(this,st,tE).call(this,fe(this,st,jr).call(this,Object.assign(e,{address:s,blockTag:i})))},nE=async function(e,n){if(St(e,32))return await fe(this,st,jr).call(this,{method:"getBlock",blockHash:e,includeTransactions:n});let r=this._getBlockTag(e);return typeof r!="string"&&(r=await r),await fe(this,st,jr).call(this,{method:"getBlock",blockTag:r,includeTransactions:n})},Mp=async function(e,n){let r=await E2(e,this);return r.type==="event"&&n&&n.length>0&&n[0].removed===!0&&(r=await E2({orphan:"drop-log",log:n[0]},this)),T(this,Bn).get(r.tag)||null},yb=async function(e){const n=await E2(e,this),r=n.tag;let s=T(this,Bn).get(r);return s||(s={subscriber:this._getSubscriber(n),tag:r,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},T(this,Bn).set(r,s)),s};function soe(t,e){try{const n=S2(t,e);if(n)return Tc(n)}catch{}return null}function S2(t,e){if(t==="0x")return null;try{const n=Qe(Ht(t,e,e+32)),r=Qe(Ht(t,n,n+32));return Ht(t,n+32,n+32+r)}catch{}return null}function JP(t){const e=Wn(t);if(e.length>32)throw new Error("internal; should not happen");const n=new Uint8Array(32);return n.set(e,32-e.length),n}function ioe(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}const ooe=new Uint8Array([]);function aoe(t){const e=[];let n=0;for(let r=0;r<t.length;r++)e.push(ooe),n+=32;for(let r=0;r<t.length;r++){const s=ct(t[r]);e[r]=JP(n),e.push(JP(s.length)),e.push(ioe(s)),n+=32+Math.ceil(s.length/32)*32}return $t(e)}const YP="0x0000000000000000000000000000000000000000000000000000000000000000";function loe(t){const e={sender:"",urls:[],calldata:"",selector:"",extraData:"",errorArgs:[]};ee(Cc(t)>=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const n=Ht(t,0,32);ee(Ht(n,0,12)===Ht(YP,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),e.sender=Ht(n,12);try{const r=[],s=Qe(Ht(t,32,64)),i=Qe(Ht(t,s,s+32)),o=Ht(t,s+32);for(let a=0;a<i;a++){const l=soe(o,a*32);if(l==null)throw new Error("abort");r.push(l)}e.urls=r}catch{ee(!1,"corrupt OffchainLookup urls","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup urls"})}try{const r=S2(t,64);if(r==null)throw new Error("abort");e.calldata=r}catch{ee(!1,"corrupt OffchainLookup calldata","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup calldata"})}ee(Ht(t,100,128)===Ht(YP,0,28),"corrupt OffchainLookup callbaackSelector","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup callbaackSelector"}),e.selector=Ht(t,96,100);try{const r=S2(t,128);if(r==null)throw new Error("abort");e.extraData=r}catch{ee(!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 zc(t,e){if(t.provider)return t.provider;ee(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:e})}async function XP(t,e){let n=gy(e);if(n.to!=null&&(n.to=Qn(n.to,t)),n.from!=null){const r=n.from;n.from=Promise.all([t.getAddress(),Qn(r,t)]).then(([s,i])=>($(s.toLowerCase()===i.toLowerCase(),"transaction from mismatch","tx.from",i),s))}else n.from=t.getAddress();return await Nn(n)}class uoe{constructor(e){W(this,"provider");Oe(this,{provider:e||null})}async getNonce(e){return zc(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await XP(this,e)}async populateTransaction(e){const n=zc(this,"populateTransaction"),r=await XP(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=xe(r.chainId);$(o===s.chainId,"transaction chainId mismatch","tx.chainId",e.chainId)}else r.chainId=s.chainId;const i=r.maxFeePerGas!=null||r.maxPriorityFeePerGas!=null;if(r.gasPrice!=null&&(r.type===2||i)?$(!1,"eip-1559 transaction do not support gasPrice","tx",e):(r.type===0||r.type===1)&&i&&$(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",e),(r.type===2||r.type==null)&&r.maxFeePerGas!=null&&r.maxPriorityFeePerGas!=null)r.type=2;else if(r.type===0||r.type===1){const o=await n.getFeeData();ee(o.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),r.gasPrice==null&&(r.gasPrice=o.gasPrice)}else{const o=await n.getFeeData();if(r.type==null)if(o.maxFeePerGas!=null&&o.maxPriorityFeePerGas!=null)if(r.type=2,r.gasPrice!=null){const a=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=a,r.maxPriorityFeePerGas=a}else r.maxFeePerGas==null&&(r.maxFeePerGas=o.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=o.maxPriorityFeePerGas);else o.gasPrice!=null?(ee(!i,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=o.gasPrice),r.type=0):ee(!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 Nn(r)}async estimateGas(e){return zc(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return zc(this,"call").call(await this.populateCall(e))}async resolveName(e){return await zc(this,"resolveName").resolveName(e)}async sendTransaction(e){const n=zc(this,"sendTransaction"),r=await this.populateTransaction(e);delete r.from;const s=zh.from(r);return await n.broadcastTransaction(await this.signTransaction(s))}}const ZP=new Set;function $c(t){ZP.has(t)||(ZP.add(t),console.log("========= NOTICE ========="),console.log(`Request-Rate Exceeded for ${t} (this message will not be repeated)`),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.org/api-keys/"),console.log("=========================="))}function coe(t){return JSON.parse(JSON.stringify(t))}class eI{constructor(e){J(this,Oa);J(this,Yn);J(this,Ai);J(this,uu);J(this,Da);J(this,cu);J(this,Uf);I(this,Yn,e),I(this,Ai,null),I(this,uu,fe(this,Oa,rE).bind(this)),I(this,Da,!1),I(this,cu,null),I(this,Uf,!1)}_subscribe(e){throw new Error("subclasses must override this")}_emitResults(e,n){throw new Error("subclasses must override this")}_recover(e){throw new Error("subclasses must override this")}start(){T(this,Da)||(I(this,Da,!0),fe(this,Oa,rE).call(this,-2))}stop(){T(this,Da)&&(I(this,Da,!1),I(this,Uf,!0),fe(this,Oa,sE).call(this),T(this,Yn).off("block",T(this,uu)))}pause(e){e&&fe(this,Oa,sE).call(this),T(this,Yn).off("block",T(this,uu))}resume(){this.start()}}Yn=new WeakMap,Ai=new WeakMap,uu=new WeakMap,Da=new WeakMap,cu=new WeakMap,Uf=new WeakMap,Oa=new WeakSet,rE=async function(e){try{T(this,Ai)==null&&I(this,Ai,this._subscribe(T(this,Yn)));let n=null;try{n=await T(this,Ai)}catch(i){if(!gn(i,"UNSUPPORTED_OPERATION")||i.operation!=="eth_newFilter")throw i}if(n==null){I(this,Ai,null),T(this,Yn)._recoverSubscriber(this,this._recover(T(this,Yn)));return}const r=await T(this,Yn).getNetwork();if(T(this,cu)||I(this,cu,r),T(this,cu).chainId!==r.chainId)throw new Error("chaid changed");if(T(this,Uf))return;const s=await T(this,Yn).send("eth_getFilterChanges",[n]);await this._emitResults(T(this,Yn),s)}catch(n){console.log("@TODO",n)}T(this,Yn).once("block",T(this,uu))},sE=function(){const e=T(this,Ai);e&&(I(this,Ai,null),e.then(n=>{T(this,Yn).destroyed||T(this,Yn).send("eth_uninstallFilter",[n])}))};class foe extends eI{constructor(n,r){super(n);J(this,fu);I(this,fu,coe(r))}_recover(n){return new x2(n,T(this,fu))}async _subscribe(n){return await n.send("eth_newFilter",[T(this,fu)])}async _emitResults(n,r){for(const s of r)n.emit(T(this,fu),n._wrapLog(s,n._network))}}fu=new WeakMap;class doe extends eI{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,n){for(const r of n)e.emit("pending",r)}}const hoe="bigint,boolean,function,number,string,symbol".split(/,/g);function Dy(t){if(t==null||hoe.indexOf(typeof t)>=0||typeof t.getAddress=="function")return t;if(Array.isArray(t))return t.map(Dy);if(typeof t=="object")return Object.keys(t).reduce((e,n)=>(e[n]=t[n],e),{});throw new Error(`should not happen: ${t} (${typeof t})`)}function poe(t){return new Promise(e=>{setTimeout(e,t)})}function Gc(t){return t&&t.toLowerCase()}function tI(t){return t&&typeof t.pollingInterval=="number"}const nI={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class T2 extends uoe{constructor(n,r){super(n);W(this,"address");r=gt(r),Oe(this,{address:r})}connect(n){ee(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(n){return await this.populateCall(n)}async sendUncheckedTransaction(n){const r=Dy(n),s=[];if(r.from){const o=r.from;s.push((async()=>{const a=await Qn(o,this.provider);$(a!=null&&a.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",n),r.from=a})())}else r.from=this.address;if(r.gasLimit==null&&s.push((async()=>{r.gasLimit=await this.provider.estimateGas({...r,from:this.address})})()),r.to!=null){const o=r.to;s.push((async()=>{r.to=await Qn(o,this.provider)})())}s.length&&await Promise.all(s);const i=this.provider.getRpcTransaction(r);return this.provider.send("eth_sendTransaction",[i])}async sendTransaction(n){const r=await this.provider.getBlockNumber(),s=await this.sendUncheckedTransaction(n);return await new Promise((i,o)=>{const a=[1e3,100];let l=0;const u=async()=>{try{const c=await this.provider.getTransaction(s);if(c!=null){i(c.replaceableTransaction(r));return}}catch(c){if(gn(c,"CANCELLED")||gn(c,"BAD_DATA")||gn(c,"NETWORK_ERROR")){c.info==null&&(c.info={}),c.info.sendTransactionHash=s,o(c);return}if(gn(c,"INVALID_ARGUMENT")&&(l++,c.info==null&&(c.info={}),c.info.sendTransactionHash=s,l>10)){o(c);return}this.provider.emit("error",Nt("failed to fetch transation after sending (will try again)","UNKNOWN_ERROR",{error:c}))}this.provider._setTimeout(()=>{u()},a.pop()||4e3)};u()})}async signTransaction(n){const r=Dy(n);if(r.from){const i=await Qn(r.from,this.provider);$(i!=null&&i.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",n),r.from=i}else r.from=this.address;const s=this.provider.getRpcTransaction(r);return await this.provider.send("eth_signTransaction",[s])}async signMessage(n){const r=typeof n=="string"?Vi(n):n;return await this.provider.send("personal_sign",[we(r),this.address.toLowerCase()])}async signTypedData(n,r,s){const i=Dy(s),o=await hy.resolveNames(n,r,i,async a=>{const l=await Qn(a);return $(l!=null,"TypedData does not support null address","value",a),l});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(hy.getPayload(o.domain,r,o.value))])}async unlock(n){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),n,null])}async _legacySignMessage(n){const r=typeof n=="string"?Vi(n):n;return await this.provider.send("eth_sign",[this.address.toLowerCase(),we(r)])}}class rI extends Ty{constructor(n,r){super(n,r);J(this,Cp);J(this,du);J(this,Vf);J(this,yo);J(this,vi);J(this,Rs);J(this,ls);J(this,mr);I(this,Vf,1),I(this,du,Object.assign({},nI,r||{})),I(this,yo,[]),I(this,vi,null),I(this,ls,null),I(this,mr,null);{let i=null;const o=new Promise(a=>{i=a});I(this,Rs,{promise:o,resolve:i})}const s=this._getOption("staticNetwork");typeof s=="boolean"?($(!s||n!=="any","staticNetwork cannot be used on special network 'any'","options",r),s&&n!=null&&I(this,ls,rn.from(n))):s&&($(n==null||s.matches(n),"staticNetwork MUST match network object","options",r),I(this,ls,s))}_getOption(n){return T(this,du)[n]}get _network(){return ee(T(this,ls),"network is not available yet","NETWORK_ERROR"),T(this,ls)}async _perform(n){if(n.method==="call"||n.method==="estimateGas"){let s=n.transaction;if(s&&s.type!=null&&xe(s.type)&&s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null){const i=await this.getFeeData();i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null&&(n=Object.assign({},n,{transaction:Object.assign({},s,{type:void 0})}))}}const r=this.getRpcRequest(n);return r!=null?await this.send(r.method,r.args):super._perform(n)}async _detectNetwork(){const n=this._getOption("staticNetwork");if(n)if(n===!0){if(T(this,ls))return T(this,ls)}else return n;return T(this,mr)?await T(this,mr):this.ready?(I(this,mr,(async()=>{try{const r=rn.from(xe(await this.send("eth_chainId",[])));return I(this,mr,null),r}catch(r){throw I(this,mr,null),r}})()),await T(this,mr)):(I(this,mr,(async()=>{const r={id:Dp(this,Vf)._++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:r});let s;try{s=(await this._send(r))[0],I(this,mr,null)}catch(i){throw I(this,mr,null),this.emit("debug",{action:"receiveRpcError",error:i}),i}if(this.emit("debug",{action:"receiveRpcResult",result:s}),"result"in s)return rn.from(xe(s.result));throw this.getRpcError(r,s)})()),await T(this,mr))}_start(){T(this,Rs)==null||T(this,Rs).resolve==null||(T(this,Rs).resolve(),I(this,Rs,null),(async()=>{for(;T(this,ls)==null&&!this.destroyed;)try{I(this,ls,await this._detectNetwork())}catch(n){if(this.destroyed)break;console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"),this.emit("error",Nt("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:n}})),await poe(1e3)}fe(this,Cp,iE).call(this)})())}async _waitUntilReady(){if(T(this,Rs)!=null)return await T(this,Rs).promise}_getSubscriber(n){return n.type==="pending"?new doe(this):n.type==="event"?this._getOption("polling")?new x2(this,n.filter):new foe(this,n.filter):n.type==="orphan"&&n.filter.orphan==="drop-log"?new Sy("orphan"):super._getSubscriber(n)}get ready(){return T(this,Rs)==null}getRpcTransaction(n){const r={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(s=>{if(n[s]==null)return;let i=s;s==="gasLimit"&&(i="gas"),r[i]=kl(xe(n[s],`tx.${s}`))}),["from","to","data"].forEach(s=>{n[s]!=null&&(r[s]=we(n[s]))}),n.accessList&&(r.accessList=ia(n.accessList)),n.blobVersionedHashes&&(r.blobVersionedHashes=n.blobVersionedHashes.map(s=>s.toLowerCase())),r}getRpcRequest(n){switch(n.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getPriorityFee":return{method:"eth_maxPriorityFeePerGas",args:[]};case"getBalance":return{method:"eth_getBalance",args:[Gc(n.address),n.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[Gc(n.address),n.blockTag]};case"getCode":return{method:"eth_getCode",args:[Gc(n.address),n.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[Gc(n.address),"0x"+n.position.toString(16),n.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[n.signedTransaction]};case"getBlock":if("blockTag"in n)return{method:"eth_getBlockByNumber",args:[n.blockTag,!!n.includeTransactions]};if("blockHash"in n)return{method:"eth_getBlockByHash",args:[n.blockHash,!!n.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[n.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[n.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(n.transaction),n.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(n.transaction)]};case"getLogs":return n.filter&&n.filter.address!=null&&(Array.isArray(n.filter.address)?n.filter.address=n.filter.address.map(Gc):n.filter.address=Gc(n.filter.address)),{method:"eth_getLogs",args:[n.filter]}}return null}getRpcError(n,r){const{method:s}=n,{error:i}=r;if(s==="eth_estimateGas"&&i.message){const l=i.message;if(!l.match(/revert/i)&&l.match(/insufficient funds/i))return Nt("insufficient funds","INSUFFICIENT_FUNDS",{transaction:n.params[0],info:{payload:n,error:i}})}if(s==="eth_call"||s==="eth_estimateGas"){const l=D2(i),u=jc.getBuiltinCallException(s==="eth_call"?"call":"estimateGas",n.params[0],l?l.data:null);return u.info={error:i,payload:n},u}const o=JSON.stringify(goe(i));if(typeof i.message=="string"&&i.message.match(/user denied|ethers-user-denied/i))return Nt("user rejected action","ACTION_REJECTED",{action:{eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"}[s]||"unknown",reason:"rejected",info:{payload:n,error:i}});if(s==="eth_sendRawTransaction"||s==="eth_sendTransaction"){const l=n.params[0];if(o.match(/insufficient funds|base fee exceeds gas limit/i))return Nt("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:l,info:{error:i}});if(o.match(/nonce/i)&&o.match(/too low/i))return Nt("nonce has already been used","NONCE_EXPIRED",{transaction:l,info:{error:i}});if(o.match(/replacement transaction/i)&&o.match(/underpriced/i))return Nt("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:l,info:{error:i}});if(o.match(/only replay-protected/i))return Nt("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?Nt("unsupported operation","UNSUPPORTED_OPERATION",{operation:n.method,info:{error:i,payload:n}}):Nt("could not coalesce error","UNKNOWN_ERROR",{error:i,payload:n})}send(n,r){if(this.destroyed)return Promise.reject(Nt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:n}));const s=Dp(this,Vf)._++,i=new Promise((o,a)=>{T(this,yo).push({resolve:o,reject:a,payload:{method:n,params:r,id:s,jsonrpc:"2.0"}})});return fe(this,Cp,iE).call(this),i}async getSigner(n){n==null&&(n=0);const r=this.send("eth_accounts",[]);if(typeof n=="number"){const i=await r;if(n>=i.length)throw new Error("no such account");return new T2(this,i[n])}const{accounts:s}=await Nn({network:this.getNetwork(),accounts:r});n=gt(n);for(const i of s)if(gt(i)===n)return new T2(this,n);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(r=>new T2(this,r))}destroy(){T(this,vi)&&(clearTimeout(T(this,vi)),I(this,vi,null));for(const{payload:n,reject:r}of T(this,yo))r(Nt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:n.method}));I(this,yo,[]),super.destroy()}}du=new WeakMap,Vf=new WeakMap,yo=new WeakMap,vi=new WeakMap,Rs=new WeakMap,ls=new WeakMap,mr=new WeakMap,Cp=new WeakSet,iE=function(){if(T(this,vi))return;const n=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");I(this,vi,setTimeout(()=>{I(this,vi,null);const r=T(this,yo);for(I(this,yo,[]);r.length;){const s=[r.shift()];for(;r.length&&s.length!==T(this,du).batchMaxCount;)if(s.push(r.shift()),JSON.stringify(s.map(o=>o.payload)).length>T(this,du).batchMaxSize){r.unshift(s.pop());break}(async()=>{const i=s.length===1?s[0].payload:s.map(o=>o.payload);this.emit("debug",{action:"sendRpcPayload",payload:i});try{const o=await this._send(i);this.emit("debug",{action:"receiveRpcResult",result:o});for(const{resolve:a,reject:l,payload:u}of s){if(this.destroyed){l(Nt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:u.method}));continue}const c=o.filter(f=>f.id===u.id)[0];if(c==null){const f=Nt("missing response for request","BAD_DATA",{value:o,info:{payload:u}});this.emit("error",f),l(f);continue}if("error"in c){l(this.getRpcError(u,c));continue}a(c.result)}}catch(o){this.emit("debug",{action:"receiveRpcError",error:o});for(const{reject:a}of s)a(o)}})()}},n))};class moe extends rI{constructor(n,r){super(n,r);J(this,_a);let s=this._getOption("pollingInterval");s==null&&(s=nI.pollingInterval),I(this,_a,s)}_getSubscriber(n){const r=super._getSubscriber(n);return tI(r)&&(r.pollingInterval=T(this,_a)),r}get pollingInterval(){return T(this,_a)}set pollingInterval(n){if(!Number.isInteger(n)||n<0)throw new Error("invalid interval");I(this,_a,n),this._forEachSubscriber(r=>{tI(r)&&(r.pollingInterval=T(this,_a))})}}_a=new WeakMap;class Qi extends moe{constructor(n,r,s){n==null&&(n="http://localhost:8545");super(r,s);J(this,Hf);typeof n=="string"?I(this,Hf,new Kn(n)):I(this,Hf,n.clone())}_getConnection(){return T(this,Hf).clone()}async send(n,r){return await this._start(),await super.send(n,r)}async _send(n){const r=this._getConnection();r.body=JSON.stringify(n),r.setHeader("content-type","application/json");const s=await r.send();s.assertOk();let i=s.bodyJson;return Array.isArray(i)||(i=[i]),i}}Hf=new WeakMap;function D2(t){if(t==null)return null;if(typeof t.message=="string"&&t.message.match(/revert/i)&&St(t.data))return{message:t.message,data:t.data};if(typeof t=="object"){for(const e in t){const n=D2(t[e]);if(n)return n}return null}if(typeof t=="string")try{return D2(JSON.parse(t))}catch{}return null}function O2(t,e){if(t!=null){if(typeof t.message=="string"&&e.push(t.message),typeof t=="object")for(const n in t)O2(t[n],e);if(typeof t=="string")try{return O2(JSON.parse(t),e)}catch{}}}function goe(t){const e=[];return O2(t,e),e}const Oy="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function yoe(t){switch(t){case"mainnet":return"rpc.ankr.com/eth";case"goerli":return"rpc.ankr.com/eth_goerli";case"sepolia":return"rpc.ankr.com/eth_sepolia";case"arbitrum":return"rpc.ankr.com/arbitrum";case"base":return"rpc.ankr.com/base";case"base-goerli":return"rpc.ankr.com/base_goerli";case"base-sepolia":return"rpc.ankr.com/base_sepolia";case"bnb":return"rpc.ankr.com/bsc";case"bnbt":return"rpc.ankr.com/bsc_testnet_chapel";case"matic":return"rpc.ankr.com/polygon";case"matic-mumbai":return"rpc.ankr.com/polygon_mumbai";case"optimism":return"rpc.ankr.com/optimism";case"optimism-goerli":return"rpc.ankr.com/optimism_testnet";case"optimism-sepolia":return"rpc.ankr.com/optimism_sepolia"}$(!1,"unsupported network","network",t)}class _y extends Qi{constructor(n,r){n==null&&(n="mainnet");const s=rn.from(n);r==null&&(r=Oy);const i={polling:!0,staticNetwork:s},o=_y.getRequest(s,r);super(o,s,i);W(this,"apiKey");Oe(this,{apiKey:r})}_getProvider(n){try{return new _y(n,this.apiKey)}catch{}return super._getProvider(n)}static getRequest(n,r){r==null&&(r=Oy);const s=new Kn(`https://${yoe(n.name)}/${r}`);return s.allowGzip=!0,r===Oy&&(s.retryFunc=async(i,o,a)=>($c("AnkrProvider"),!0)),s}getRpcError(n,r){return n.method==="eth_sendRawTransaction"&&r&&r.error&&r.error.message==="INTERNAL_ERROR: could not replace existing tx"&&(r.error.message="replacement transaction underpriced"),super.getRpcError(n,r)}isCommunityResource(){return this.apiKey===Oy}}const My="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";function boe(t){switch(t){case"mainnet":return"eth-mainnet.alchemyapi.io";case"goerli":return"eth-goerli.g.alchemy.com";case"sepolia":return"eth-sepolia.g.alchemy.com";case"arbitrum":return"arb-mainnet.g.alchemy.com";case"arbitrum-goerli":return"arb-goerli.g.alchemy.com";case"arbitrum-sepolia":return"arb-sepolia.g.alchemy.com";case"base":return"base-mainnet.g.alchemy.com";case"base-goerli":return"base-goerli.g.alchemy.com";case"base-sepolia":return"base-sepolia.g.alchemy.com";case"matic":return"polygon-mainnet.g.alchemy.com";case"matic-amoy":return"polygon-amoy.g.alchemy.com";case"matic-mumbai":return"polygon-mumbai.g.alchemy.com";case"optimism":return"opt-mainnet.g.alchemy.com";case"optimism-goerli":return"opt-goerli.g.alchemy.com";case"optimism-sepolia":return"opt-sepolia.g.alchemy.com"}$(!1,"unsupported network","network",t)}class Ny extends Qi{constructor(n,r){n==null&&(n="mainnet");const s=rn.from(n);r==null&&(r=My);const i=Ny.getRequest(s,r);super(i,s,{staticNetwork:s});W(this,"apiKey");Oe(this,{apiKey:r})}_getProvider(n){try{return new Ny(n,this.apiKey)}catch{}return super._getProvider(n)}async _perform(n){if(n.method==="getTransactionResult"){const{trace:r,tx:s}=await Nn({trace:this.send("trace_transaction",[n.hash]),tx:this.getTransaction(n.hash)});if(r==null||s==null)return null;let i,o=!1;try{i=r[0].result.output,o=r[0].error==="Reverted"}catch{}if(i)return ee(!o,"an error occurred during transaction executions","CALL_EXCEPTION",{action:"getTransactionResult",data:i,reason:null,transaction:s,invocation:null,revert:null}),i;ee(!1,"could not parse trace result","BAD_DATA",{value:r})}return await super._perform(n)}isCommunityResource(){return this.apiKey===My}static getRequest(n,r){r==null&&(r=My);const s=new Kn(`https://${boe(n.name)}/v2/${r}`);return s.allowGzip=!0,r===My&&(s.retryFunc=async(i,o,a)=>($c("alchemy"),!0)),s}}function Ry(t){switch(t){case"mainnet":return"39f1d67cedf8b7831010a665328c9197";case"arbitrum":return"0550c209db33c3abf4cc927e1e18cea1";case"bnb":return"98b5a77e531614387366f6fc5da097f8";case"matic":return"cd9d4d70377471aa7c142ec4a4205249"}$(!1,"unsupported network","network",t)}function woe(t){switch(t){case"mainnet":return"ethereum-mainnet.core.chainstack.com";case"arbitrum":return"arbitrum-mainnet.core.chainstack.com";case"bnb":return"bsc-mainnet.core.chainstack.com";case"matic":return"polygon-mainnet.core.chainstack.com"}$(!1,"unsupported network","network",t)}class Py extends Qi{constructor(n,r){n==null&&(n="mainnet");const s=rn.from(n);r==null&&(r=Ry(s.name));const i=Py.getRequest(s,r);super(i,s,{staticNetwork:s});W(this,"apiKey");Oe(this,{apiKey:r})}_getProvider(n){try{return new Py(n,this.apiKey)}catch{}return super._getProvider(n)}isCommunityResource(){return this.apiKey===Ry(this._network.name)}static getRequest(n,r){r==null&&(r=Ry(n.name));const s=new Kn(`https://${woe(n.name)}/${r}`);return s.allowGzip=!0,r===Ry(n.name)&&(s.retryFunc=async(i,o,a)=>($c("ChainstackProvider"),!0)),s}}class Aoe extends Qi{constructor(e){e==null&&(e="mainnet");const n=rn.from(e);$(n.name==="mainnet","unsupported network","network",e),super("https://cloudflare-eth.com/",n,{staticNetwork:n})}}const sI=2e3;function voe(t){return t&&typeof t.then=="function"}const xoe="org.ethers.plugins.provider.Etherscan",koe=["enableCcipRead"];let Eoe=1;class Coe extends Ty{constructor(n,r){const s=r??null;super();W(this,"network");W(this,"apiKey");J(this,zf);const i=rn.from(n);I(this,zf,i.getPlugin(xoe)),Oe(this,{apiKey:s,network:i}),this.getBaseUrl()}getBaseUrl(){if(T(this,zf))return T(this,zf).baseUrl;switch(this.network.name){case"mainnet":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"holesky":return"https://api-holesky.etherscan.io";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"base":return"https://api.basescan.org";case"base-sepolia":return"https://api-sepolia.basescan.org";case"bnb":return"https://api.bscscan.com";case"bnbt":return"https://api-testnet.bscscan.com";case"matic":return"https://api.polygonscan.com";case"matic-amoy":return"https://api-amoy.polygonscan.com";case"matic-mumbai":return"https://api-testnet.polygonscan.com";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}$(!1,"unsupported network","network",this.network)}getUrl(n,r){const s=Object.keys(r).reduce((o,a)=>{const l=r[a];return l!=null&&(o+=`&${a}=${l}`),o},""),i=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.getBaseUrl()}/api?module=${n}${s}${i}`}getPostUrl(){return`${this.getBaseUrl()}/api`}getPostData(n,r){return r.module=n,r.apikey=this.apiKey,r}async detectNetwork(){return this.network}async fetch(n,r,s){const i=Eoe++,o=s?this.getPostUrl():this.getUrl(n,r),a=s?this.getPostData(n,r):null;this.emit("debug",{action:"sendRequest",id:i,url:o,payload:a});const l=new Kn(o);l.setThrottleParams({slotInterval:1e3}),l.retryFunc=(f,d,h)=>(this.isCommunityResource()&&$c("Etherscan"),Promise.resolve(!0)),l.processFunc=async(f,d)=>{const h=d.hasBody()?JSON.parse(Tc(d.body)):{},p=(typeof h.result=="string"?h.result:"").toLowerCase().indexOf("rate limit")>=0;return n==="proxy"?h&&h.status==0&&h.message=="NOTOK"&&p&&(this.emit("debug",{action:"receiveError",id:i,reason:"proxy-NOTOK",error:h}),d.throwThrottleError(h.result,sI)):p&&(this.emit("debug",{action:"receiveError",id:i,reason:"null result",error:h.result}),d.throwThrottleError(h.result,sI)),d},a&&(l.setHeader("content-type","application/x-www-form-urlencoded; charset=UTF-8"),l.body=Object.keys(a).map(f=>`${f}=${a[f]}`).join("&"));const u=await l.send();try{u.assertOk()}catch(f){this.emit("debug",{action:"receiveError",id:i,error:f,reason:"assertOk"}),ee(!1,"response error","SERVER_ERROR",{request:l,response:u})}u.hasBody()||(this.emit("debug",{action:"receiveError",id:i,error:"missing body",reason:"null body"}),ee(!1,"missing response","SERVER_ERROR",{request:l,response:u}));const c=JSON.parse(Tc(u.body));return n==="proxy"?(c.jsonrpc!="2.0"&&(this.emit("debug",{action:"receiveError",id:i,result:c,reason:"invalid JSON-RPC"}),ee(!1,"invalid JSON-RPC response (missing jsonrpc='2.0')","SERVER_ERROR",{request:l,response:u,info:{result:c}})),c.error&&(this.emit("debug",{action:"receiveError",id:i,result:c,reason:"JSON-RPC error"}),ee(!1,"error response","SERVER_ERROR",{request:l,response:u,info:{result:c}})),this.emit("debug",{action:"receiveRequest",id:i,result:c}),c.result):c.status==0&&(c.message==="No records found"||c.message==="No transactions found")?(this.emit("debug",{action:"receiveRequest",id:i,result:c}),c.result):((c.status!=1||typeof c.message=="string"&&!c.message.match(/^OK/))&&(this.emit("debug",{action:"receiveError",id:i,result:c}),ee(!1,"error response","SERVER_ERROR",{request:l,response:u,info:{result:c}})),this.emit("debug",{action:"receiveRequest",id:i,result:c}),c.result)}_getTransactionPostData(n){const r={};for(let s in n){if(koe.indexOf(s)>=0||n[s]==null)continue;let i=n[s];if(!(s==="type"&&i===0)&&!(s==="blockTag"&&i==="latest")){if({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[s])i=kl(i);else if(s==="accessList")i="["+ia(i).map(o=>`{address:"${o.address}",storageKeys:["${o.storageKeys.join('","')}"]}`).join(",")+"]";else if(s==="blobVersionedHashes"){if(i.length===0)continue;ee(!1,"Etherscan API does not support blobVersionedHashes","UNSUPPORTED_OPERATION",{operation:"_getTransactionPostData",info:{transaction:n}})}else i=we(i);r[s]=i}}return r}_checkError(n,r,s){let i="";if(gn(r,"SERVER_ERROR")){try{i=r.info.result.error.message}catch{}if(!i)try{i=r.info.message}catch{}}if(n.method==="estimateGas"&&!i.match(/revert/i)&&i.match(/insufficient funds/i)&&ee(!1,"insufficient funds","INSUFFICIENT_FUNDS",{transaction:n.transaction}),(n.method==="call"||n.method==="estimateGas")&&i.match(/execution reverted/i)){let o="";try{o=r.info.result.error.data}catch{}const a=jc.getBuiltinCallException(n.method,n.transaction,o);throw a.info={request:n,error:r},a}if(i&&n.method==="broadcastTransaction"){const o=zh.from(n.signedTransaction);i.match(/replacement/i)&&i.match(/underpriced/i)&&ee(!1,"replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:o}),i.match(/insufficient funds/)&&ee(!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/)&&ee(!1,"nonce has already been used","NONCE_EXPIRED",{transaction:o})}throw r}async _detectNetwork(){return this.network}async _perform(n){switch(n.method){case"chainId":return this.network.chainId;case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getPriorityFee":if(this.network.name==="mainnet")return"1000000000";if(this.network.name==="optimism")return"1000000";throw new Error("fallback onto the AbstractProvider default");case"getBalance":return this.fetch("account",{action:"balance",address:n.address,tag:n.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:n.address,tag:n.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:n.address,tag:n.blockTag});case"getStorage":return this.fetch("proxy",{action:"eth_getStorageAt",address:n.address,position:n.position,tag:n.blockTag});case"broadcastTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:n.signedTransaction},!0).catch(r=>this._checkError(n,r,n.signedTransaction));case"getBlock":if("blockTag"in n)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:n.blockTag,boolean:n.includeTransactions?"true":"false"});ee(!1,"getBlock by blockHash not supported by Etherscan","UNSUPPORTED_OPERATION",{operation:"getBlock(blockHash)"});case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:n.hash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:n.hash});case"call":{if(n.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const r=this._getTransactionPostData(n.transaction);r.module="proxy",r.action="eth_call";try{return await this.fetch("proxy",r,!0)}catch(s){return this._checkError(n,s,n.transaction)}}case"estimateGas":{const r=this._getTransactionPostData(n.transaction);r.module="proxy",r.action="eth_estimateGas";try{return await this.fetch("proxy",r,!0)}catch(s){return this._checkError(n,s,n.transaction)}}}return super._perform(n)}async getNetwork(){return this.network}async getEtherPrice(){return this.network.name!=="mainnet"?0:parseFloat((await this.fetch("stats",{action:"ethprice"})).ethusd)}async getContract(n){let r=this._getAddress(n);voe(r)&&(r=await r);try{const s=await this.fetch("contract",{action:"getabi",address:r}),i=JSON.parse(s);return new Vc(r,i,this)}catch{return null}}isCommunityResource(){return this.apiKey==null}}zf=new WeakMap;function Soe(){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 Toe=Soe().WebSocket;class _2{constructor(e,n){J(this,xi);J(this,Sp);J(this,Ma);J(this,hu);J(this,Na);I(this,xi,e),I(this,Sp,JSON.stringify(n)),I(this,Ma,null),I(this,hu,null),I(this,Na,null)}get filter(){return JSON.parse(T(this,Sp))}start(){I(this,Ma,T(this,xi).send("eth_subscribe",this.filter).then(e=>(T(this,xi)._register(e,this),e)))}stop(){T(this,Ma).then(e=>{T(this,xi).destroyed||T(this,xi).send("eth_unsubscribe",[e])}),I(this,Ma,null)}pause(e){ee(e,"preserve logs while paused not supported by SocketSubscriber yet","UNSUPPORTED_OPERATION",{operation:"pause(false)"}),I(this,hu,!!e)}resume(){I(this,hu,null)}_handleMessage(e){if(T(this,Ma)!=null&&T(this,hu)===null){let n=T(this,Na);n==null?n=this._emit(T(this,xi),e):n=n.then(async()=>{await this._emit(T(this,xi),e)}),I(this,Na,n.then(()=>{T(this,Na)===n&&I(this,Na,null)}))}}async _emit(e,n){throw new Error("sub-classes must implemente this; _emit")}}xi=new WeakMap,Sp=new WeakMap,Ma=new WeakMap,hu=new WeakMap,Na=new WeakMap;class Doe extends _2{constructor(e){super(e,["newHeads"])}async _emit(e,n){e.emit("block",parseInt(n.number))}}class Ooe extends _2{constructor(e){super(e,["newPendingTransactions"])}async _emit(e,n){e.emit("pending",n)}}class _oe extends _2{constructor(n,r){super(n,["logs",r]);J(this,Tp);I(this,Tp,JSON.stringify(r))}get logFilter(){return JSON.parse(T(this,Tp))}async _emit(n,r){n.emit(this.logFilter,n._wrapLog(r,n._network))}}Tp=new WeakMap;class Moe extends rI{constructor(n,r){const s=Object.assign({},r??{});$(s.batchMaxCount==null||s.batchMaxCount===1,"sockets-based providers do not support batches","options.batchMaxCount",r),s.batchMaxCount=1,s.staticNetwork==null&&(s.staticNetwork=!0);super(n,s);J(this,pu);J(this,$f);J(this,Ra);I(this,pu,new Map),I(this,$f,new Map),I(this,Ra,new Map)}_getSubscriber(n){switch(n.type){case"close":return new Sy("close");case"block":return new Doe(this);case"pending":return new Ooe(this);case"event":return new _oe(this,n.filter);case"orphan":if(n.filter.orphan==="drop-log")return new Sy("drop-log")}return super._getSubscriber(n)}_register(n,r){T(this,$f).set(n,r);const s=T(this,Ra).get(n);if(s){for(const i of s)r._handleMessage(i);T(this,Ra).delete(n)}}async _send(n){$(!Array.isArray(n),"WebSocket does not support batch send","payload",n);const r=new Promise((s,i)=>{T(this,pu).set(n.id,{payload:n,resolve:s,reject:i})});return await this._waitUntilReady(),await this._write(JSON.stringify(n)),[await r]}async _processMessage(n){const r=JSON.parse(n);if(r&&typeof r=="object"&&"id"in r){const s=T(this,pu).get(r.id);if(s==null){this.emit("error",Nt("received result for unknown id","UNKNOWN_ERROR",{reasonCode:"UNKNOWN_ID",result:r}));return}T(this,pu).delete(r.id),s.resolve(r)}else if(r&&r.method==="eth_subscription"){const s=r.params.subscription,i=T(this,$f).get(s);if(i)i._handleMessage(r.params.result);else{let o=T(this,Ra).get(s);o==null&&(o=[],T(this,Ra).set(s,o)),o.push(r.params.result)}}else{this.emit("error",Nt("received unexpected message","UNKNOWN_ERROR",{reasonCode:"UNEXPECTED_MESSAGE",result:r}));return}}async _write(n){throw new Error("sub-classes must override this")}}pu=new WeakMap,$f=new WeakMap,Ra=new WeakMap;class iI extends Moe{constructor(n,r,s){super(r,s);J(this,mu);J(this,Ps);typeof n=="string"?(I(this,mu,()=>new Toe(n)),I(this,Ps,T(this,mu).call(this))):typeof n=="function"?(I(this,mu,n),I(this,Ps,n())):(I(this,mu,null),I(this,Ps,n)),this.websocket.onopen=async()=>{try{await this._start(),this.resume()}catch(i){console.log("failed to start WebsocketProvider",i)}},this.websocket.onmessage=i=>{this._processMessage(i.data)}}get websocket(){if(T(this,Ps)==null)throw new Error("websocket closed");return T(this,Ps)}async _write(n){this.websocket.send(n)}async destroy(){T(this,Ps)!=null&&(T(this,Ps).close(),I(this,Ps,null)),super.destroy()}}mu=new WeakMap,Ps=new WeakMap;const Jh="84842078b09946638c03157f83405213";function Noe(t){switch(t){case"mainnet":return"mainnet.infura.io";case"goerli":return"goerli.infura.io";case"sepolia":return"sepolia.infura.io";case"arbitrum":return"arbitrum-mainnet.infura.io";case"arbitrum-goerli":return"arbitrum-goerli.infura.io";case"arbitrum-sepolia":return"arbitrum-sepolia.infura.io";case"base":return"base-mainnet.infura.io";case"base-goerlia":return"base-goerli.infura.io";case"base-sepolia":return"base-sepolia.infura.io";case"bnb":return"bnbsmartchain-mainnet.infura.io";case"bnbt":return"bnbsmartchain-testnet.infura.io";case"linea":return"linea-mainnet.infura.io";case"linea-goerli":return"linea-goerli.infura.io";case"linea-sepolia":return"linea-sepolia.infura.io";case"matic":return"polygon-mainnet.infura.io";case"matic-amoy":return"polygon-amoy.infura.io";case"matic-mumbai":return"polygon-mumbai.infura.io";case"optimism":return"optimism-mainnet.infura.io";case"optimism-goerli":return"optimism-goerli.infura.io";case"optimism-sepolia":return"optimism-sepolia.infura.io"}$(!1,"unsupported network","network",t)}class Roe extends iI{constructor(n,r){const s=new Yh(n,r),i=s._getConnection();ee(!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");Oe(this,{projectId:s.projectId,projectSecret:s.projectSecret})}isCommunityResource(){return this.projectId===Jh}}class Yh extends Qi{constructor(n,r,s){n==null&&(n="mainnet");const i=rn.from(n);r==null&&(r=Jh),s==null&&(s=null);const o=Yh.getRequest(i,r,s);super(o,i,{staticNetwork:i});W(this,"projectId");W(this,"projectSecret");Oe(this,{projectId:r,projectSecret:s})}_getProvider(n){try{return new Yh(n,this.projectId,this.projectSecret)}catch{}return super._getProvider(n)}isCommunityResource(){return this.projectId===Jh}static getWebSocketProvider(n,r){return new Roe(n,r)}static getRequest(n,r,s){r==null&&(r=Jh),s==null&&(s=null);const i=new Kn(`https://${Noe(n.name)}/v3/${r}`);return i.allowGzip=!0,s&&i.setCredentials("",s),r===Jh&&(i.retryFunc=async(o,a,l)=>($c("InfuraProvider"),!0)),i}}const Iy="919b412a057b5e9c9b6dce193c5a60242d6efadb";function Poe(t){switch(t){case"mainnet":return"ethers.quiknode.pro";case"goerli":return"ethers.ethereum-goerli.quiknode.pro";case"sepolia":return"ethers.ethereum-sepolia.quiknode.pro";case"holesky":return"ethers.ethereum-holesky.quiknode.pro";case"arbitrum":return"ethers.arbitrum-mainnet.quiknode.pro";case"arbitrum-goerli":return"ethers.arbitrum-goerli.quiknode.pro";case"arbitrum-sepolia":return"ethers.arbitrum-sepolia.quiknode.pro";case"base":return"ethers.base-mainnet.quiknode.pro";case"base-goerli":return"ethers.base-goerli.quiknode.pro";case"base-spolia":return"ethers.base-sepolia.quiknode.pro";case"bnb":return"ethers.bsc.quiknode.pro";case"bnbt":return"ethers.bsc-testnet.quiknode.pro";case"matic":return"ethers.matic.quiknode.pro";case"matic-mumbai":return"ethers.matic-testnet.quiknode.pro";case"optimism":return"ethers.optimism.quiknode.pro";case"optimism-goerli":return"ethers.optimism-goerli.quiknode.pro";case"optimism-sepolia":return"ethers.optimism-sepolia.quiknode.pro";case"xdai":return"ethers.xdai.quiknode.pro"}$(!1,"unsupported network","network",t)}class Ly extends Qi{constructor(n,r){n==null&&(n="mainnet");const s=rn.from(n);r==null&&(r=Iy);const i=Ly.getRequest(s,r);super(i,s,{staticNetwork:s});W(this,"token");Oe(this,{token:r})}_getProvider(n){try{return new Ly(n,this.token)}catch{}return super._getProvider(n)}isCommunityResource(){return this.token===Iy}static getRequest(n,r){r==null&&(r=Iy);const s=new Kn(`https://${Poe(n.name)}/${r}`);return s.allowGzip=!0,r===Iy&&(s.retryFunc=async(i,o,a)=>($c("QuickNodeProvider"),!0)),s}}const Ioe=BigInt("1"),Loe=BigInt("2");function Boe(t){for(let e=t.length-1;e>0;e--){const n=Math.floor(Math.random()*(e+1)),r=t[e];t[e]=t[n],t[n]=r}}function Foe(t){return new Promise(e=>{setTimeout(e,t)})}function M2(){return new Date().getTime()}function N2(t){return JSON.stringify(t,(e,n)=>typeof n=="bigint"?{type:"bigint",value:n.toString()}:n)}const oI={stallTimeout:400,priority:1,weight:1},aI={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 joe(t,e){for(;(t.blockNumber<0||t.blockNumber<e)&&(t._updateNumber||(t._updateNumber=(async()=>{try{const n=await t.provider.getBlockNumber();n>t.blockNumber&&(t.blockNumber=n)}catch(n){t.blockNumber=-2,t._lastFatalError=n,t._lastFatalErrorTimestamp=M2()}t._updateNumber=null})()),await t._updateNumber,t.outOfSync++,!t._lastFatalError););}function Xh(t){if(t==null)return"null";if(Array.isArray(t))return"["+t.map(Xh).join(",")+"]";if(typeof t=="object"&&typeof t.toJSON=="function")return Xh(t.toJSON());switch(typeof t){case"boolean":case"symbol":return t.toString();case"bigint":case"number":return BigInt(t).toString();case"string":return JSON.stringify(t);case"object":{const e=Object.keys(t);return e.sort(),"{"+e.map(n=>`${JSON.stringify(n)}:${Xh(t[n])}`).join(",")+"}"}}throw console.log("Could not serialize",t),new Error("Hmm...")}function R2(t){if("error"in t){const n=t.error;return{tag:Xh(n),value:n}}const e=t.result;return{tag:Xh(e),value:e}}function By(t,e){const n=new Map;for(const{value:s,tag:i,weight:o}of e){const a=n.get(i)||{value:s,weight:0};a.weight+=o,n.set(i,a)}let r=null;for(const s of n.values())s.weight>=t&&(!r||s.weight>r.weight)&&(r=s);if(r)return r.value}function P2(t,e){let n=0;const r=new Map;let s=null;const i=[];for(const{value:a,tag:l,weight:u}of e)if(a instanceof Error){const c=r.get(l)||{value:a,weight:0};c.weight+=u,r.set(l,c),(s==null||c.weight>s.weight)&&(s=c)}else i.push(BigInt(a)),n+=u;if(n<t)return s&&s.weight>=t?s.value:void 0;i.sort((a,l)=>a<l?-1:l>a?1:0);const o=Math.floor(i.length/2);return i.length%2?i[o]:(i[o-1]+i[o]+Ioe)/Loe}function I2(t,e){const n=By(t,e);if(n!==void 0)return n;for(const r of e)if(r.value)return r.value}function Uoe(t,e){if(t===1)return Qe(P2(t,e),"%internal");const n=new Map,r=(o,a)=>{const l=n.get(o)||{result:o,weight:0};l.weight+=a,n.set(o,l)};for(const{weight:o,value:a}of e){const l=Qe(a);r(l-1,o),r(l,o),r(l+1,o)}let s=0,i;for(const{weight:o,result:a}of n.values())o>=t&&(o>s||i!=null&&o===s&&a>i)&&(s=o,i=a);return i}class Voe extends Ty{constructor(n,r,s){super(r,s);J(this,yr);W(this,"quorum");W(this,"eventQuorum");W(this,"eventWorkers");J(this,gr);J(this,bo);J(this,Gf);I(this,gr,n.map(i=>i instanceof Ty?Object.assign({provider:i},oI,aI):Object.assign({},oI,i,aI))),I(this,bo,-2),I(this,Gf,null),s&&s.quorum!=null?this.quorum=s.quorum:this.quorum=Math.ceil(T(this,gr).reduce((i,o)=>(i+=o.weight,i),0)/2),this.eventQuorum=1,this.eventWorkers=1,$(this.quorum<=T(this,gr).reduce((i,o)=>i+o.weight,0),"quorum exceed provider weight","quorum",this.quorum)}get providerConfigs(){return T(this,gr).map(n=>{const r=Object.assign({},n);for(const s in r)s[0]==="_"&&delete r[s];return r})}async _detectNetwork(){return rn.from(xe(await this._perform({method:"chainId"})))}async _translatePerform(n,r){switch(r.method){case"broadcastTransaction":return await n.broadcastTransaction(r.signedTransaction);case"call":return await n.call(Object.assign({},r.transaction,{blockTag:r.blockTag}));case"chainId":return(await n.getNetwork()).chainId;case"estimateGas":return await n.estimateGas(r.transaction);case"getBalance":return await n.getBalance(r.address,r.blockTag);case"getBlock":{const s="blockHash"in r?r.blockHash:r.blockTag;return await n.getBlock(s,r.includeTransactions)}case"getBlockNumber":return await n.getBlockNumber();case"getCode":return await n.getCode(r.address,r.blockTag);case"getGasPrice":return(await n.getFeeData()).gasPrice;case"getPriorityFee":return(await n.getFeeData()).maxPriorityFeePerGas;case"getLogs":return await n.getLogs(r.filter);case"getStorage":return await n.getStorage(r.address,r.position,r.blockTag);case"getTransaction":return await n.getTransaction(r.hash);case"getTransactionCount":return await n.getTransactionCount(r.address,r.blockTag);case"getTransactionReceipt":return await n.getTransactionReceipt(r.hash);case"getTransactionResult":return await n.getTransactionResult(r.hash)}}async _perform(n){if(n.method==="broadcastTransaction"){const o=T(this,gr).map(u=>null),a=T(this,gr).map(async({provider:u,weight:c},f)=>{try{const d=await u._perform(n);o[f]=Object.assign(R2({result:d}),{weight:c})}catch(d){o[f]=Object.assign(R2({error:d}),{weight:c})}});for(;;){const u=o.filter(d=>d!=null);for(const{value:d}of u)if(!(d instanceof Error))return d;const c=By(this.quorum,o.filter(d=>d!=null));if(gn(c,"INSUFFICIENT_FUNDS"))throw c;const f=a.filter((d,h)=>o[h]==null);if(f.length===0)break;await Promise.race(f)}const l=I2(this.quorum,o);if(ee(l!==void 0,"problem multi-broadcasting","SERVER_ERROR",{request:"%sub-requests",info:{request:n,results:o.map(N2)}}),l instanceof Error)throw l;return l}await fe(this,yr,ZL).call(this);const r=new Set;let s=0;for(;;){const o=fe(this,yr,oE).call(this,r,n);if(o==null||(s+=o.config.weight,s>=this.quorum))break}const i=await fe(this,yr,aE).call(this,r,n);for(const o of r)o.perform&&o.result==null&&o.config.lateResponses++;return i}async destroy(){for(const{provider:n}of T(this,gr))n.destroy();super.destroy()}}gr=new WeakMap,bo=new WeakMap,Gf=new WeakMap,yr=new WeakSet,XL=function(n){const r=Array.from(n).map(i=>i.config),s=T(this,gr).slice();Boe(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},oE=function(n,r){const s=fe(this,yr,XL).call(this,n);if(s==null)return null;const i={config:s,result:null,didBump:!1,perform:null,staller:null},o=M2();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=M2()-o;s._totalTime+=a,s.rollingDuration=.95*s.rollingDuration+.05*a,i.perform=null})(),i.staller=(async()=>{await Foe(s.stallTimeout),i.staller=null})(),n.add(i),i},ZL=async function(){let n=T(this,Gf);if(!n){const r=[];T(this,gr).forEach(s=>{r.push((async()=>{await joe(s,0),s._lastFatalError||(s._network=await s.provider.getNetwork())})())}),I(this,Gf,n=(async()=>{await Promise.all(r);let s=null;for(const i of T(this,gr)){if(i._lastFatalError)continue;const o=i._network;s==null?s=o.chainId:o.chainId!==s&&ee(!1,"cannot mix providers on different networks","UNSUPPORTED_OPERATION",{operation:"new FallbackProvider"})}})())}await n},e5=async function(n,r){const s=[];for(const i of n)if(i.result!=null){const{tag:o,value:a}=R2(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,bo)===-2&&I(this,bo,Math.ceil(Qe(P2(this.quorum,T(this,gr).filter(o=>!o._lastFatalError).map(o=>({value:o.blockNumber,tag:Qe(o.blockNumber).toString(),weight:o.weight}))))));const i=Uoe(this.quorum,s);return i===void 0?void 0:(i>T(this,bo)&&I(this,bo,i),T(this,bo))}case"getGasPrice":case"getPriorityFee":case"estimateGas":return P2(this.quorum,s);case"getBlock":return"blockTag"in r&&r.blockTag==="pending"?I2(this.quorum,s):By(this.quorum,s);case"call":case"chainId":case"getBalance":case"getTransactionCount":case"getCode":case"getStorage":case"getTransaction":case"getTransactionReceipt":case"getLogs":return By(this.quorum,s);case"broadcastTransaction":return I2(this.quorum,s)}ee(!1,"unsupported method","UNSUPPORTED_OPERATION",{operation:`_perform(${N2(r.method)})`})}},aE=async function(n,r){if(n.size===0)throw new Error("no runners?!");const s=[];let i=0;for(const a of n){if(a.perform&&s.push(a.perform),a.staller){s.push(a.staller);continue}a.didBump||(a.didBump=!0,i++)}const o=await fe(this,yr,e5).call(this,n,r);if(o!==void 0){if(o instanceof Error)throw o;return o}for(let a=0;a<i;a++)fe(this,yr,oE).call(this,n,r);return ee(s.length>0,"quorum not met","SERVER_ERROR",{request:"%sub-requests",info:{request:r,results:Array.from(n).map(a=>N2(a.result))}}),await Promise.race(s),await fe(this,yr,aE).call(this,n,r)};function Hoe(t){return t&&typeof t.send=="function"&&typeof t.close=="function"}const zoe="goerli kovan sepolia classicKotti optimism-goerli arbitrum-goerli matic-mumbai bnbt".split(" ");function $oe(t,e){e==null&&(e={});const n=o=>e[o]==="-"?!1:typeof e.exclusive=="string"?o===e.exclusive:Array.isArray(e.exclusive)?e.exclusive.indexOf(o)!==-1:!0;if(typeof t=="string"&&t.match(/^https?:/))return new Qi(t);if(typeof t=="string"&&t.match(/^wss?:/)||Hoe(t))return new iI(t);let r=null;try{r=rn.from(t)}catch{}const s=[];if(n("publicPolygon")&&r&&(r.name==="matic"?s.push(new Qi("https://polygon-rpc.com/",r,{staticNetwork:r})):r.name==="matic-amoy"&&s.push(new Qi("https://rpc-amoy.polygon.technology/",r,{staticNetwork:r}))),n("alchemy"))try{s.push(new Ny(t,e.alchemy))}catch{}if(n("ankr")&&e.ankr!=null)try{s.push(new _y(t,e.ankr))}catch{}if(n("chainstack"))try{s.push(new Py(t,e.chainstack))}catch{}if(n("cloudflare"))try{s.push(new Aoe(t))}catch{}if(n("etherscan"))try{s.push(new Coe(t,e.etherscan))}catch{}if(n("infura"))try{let o=e.infura,a;typeof o=="object"&&(a=o.projectSecret,o=o.projectId),s.push(new Yh(t,o,a))}catch{}if(n("quicknode"))try{let o=e.quicknode;s.push(new Ly(t,o))}catch{}if(ee(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&&zoe.indexOf(r.name)!==-1&&(i=1),e&&e.quorum&&(i=e.quorum),new Voe(s,void 0,{quorum:i})}const Goe=async(t,e)=>{const n={name:t,isEns:!1};if(!e)throw new Error("cannot fetch ens name without a provider url");if(!Vre(t))return n;try{const r=await Woe(t,e);r&&(n.name=r,n.isEns=!0)}catch(r){console.log(r)}return n},Woe=async(t,e)=>await Koe(e).lookupAddress(t),Koe=t=>$oe(t),qoe=(t,e,n)=>{if((t==null?void 0:t.length)>n){const r=t.substring(0,e),s=t.substring((t==null?void 0:t.length)-e);return`${r}...${s}`}return t};function Qoe(t){var e;const{char:n,allowSpaces:r,allowedPrefixes:s,startOfLine:i,$position:o}=t,a=z7(n),l=new RegExp(`\\s${a}$`),u=i?"^":"",c=r?new RegExp(`${u}${a}.*?(?=\\s${a}|$)`,"gm"):new RegExp(`${u}(?:^)?${a}[^\\s${a}]*`,"gm"),f=((e=o.nodeBefore)===null||e===void 0?void 0:e.isText)&&o.nodeBefore.text;if(!f)return null;const d=o.pos-f.length,h=Array.from(f.matchAll(c)).pop();if(!h||h.input===void 0||h.index===void 0)return null;const p=h.input.slice(Math.max(0,h.index-1),h.index),m=new RegExp(`^[${s==null?void 0:s.join("")}\0]?$`).test(p);if(s!==null&&!m)return null;const g=d+h.index;let y=g+h[0].length;return r&&l.test(f.slice(y-1,y+1))&&(h[0]+=" ",y+=1),g<o.pos&&y>=o.pos?{range:{from:g,to:y},query:h[0].slice(n.length),text:h[0]}:null}const Joe=new _t("suggestion");function Yoe({pluginKey:t=Joe,editor:e,char:n="@",allowSpaces:r=!1,allowedPrefixes:s=[" "],startOfLine:i=!1,decorationTag:o="span",decorationClass:a="suggestion",command:l=()=>null,items:u=()=>[],render:c=()=>({}),allow:f=()=>!0,findSuggestionMatch:d=Qoe}){let h;const p=c==null?void 0:c(),m=new bt({key:t,view(){return{update:async(g,y)=>{var v,w,A,x,k,C,O;const _=(v=this.key)===null||v===void 0?void 0:v.getState(y),D=(w=this.key)===null||w===void 0?void 0:w.getState(g.state),R=_.active&&D.active&&_.range.from!==D.range.from,L=!_.active&&D.active,F=_.active&&!D.active,G=!L&&!F&&_.query!==D.query,B=L,H=G||R,Q=F;if(!B&&!H&&!Q)return;const te=Q&&!B?_:D,Z=g.dom.querySelector(`[data-decoration-id="${te.decorationId}"]`);h={editor:e,range:te.range,query:te.query,text:te.text,items:[],command:pe=>l({editor:e,range:te.range,props:pe}),decorationNode:Z,clientRect:Z?()=>{var pe;const{decorationId:Ee}=(pe=this.key)===null||pe===void 0?void 0:pe.getState(e.state),Re=g.dom.querySelector(`[data-decoration-id="${Ee}"]`);return(Re==null?void 0:Re.getBoundingClientRect())||null}:null},B&&((A=p==null?void 0:p.onBeforeStart)===null||A===void 0||A.call(p,h)),H&&((x=p==null?void 0:p.onBeforeUpdate)===null||x===void 0||x.call(p,h)),(H||B)&&(h.items=await u({editor:e,query:te.query})),Q&&((k=p==null?void 0:p.onExit)===null||k===void 0||k.call(p,h)),H&&((C=p==null?void 0:p.onUpdate)===null||C===void 0||C.call(p,h)),B&&((O=p==null?void 0:p.onStart)===null||O===void 0||O.call(p,h))},destroy:()=>{var g;h&&((g=p==null?void 0:p.onExit)===null||g===void 0||g.call(p,h))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(g,y,v,w){const{isEditable:A}=e,{composing:x}=e.view,{selection:k}=g,{empty:C,from:O}=k,_={...y};if(_.composing=x,A&&(C||e.view.composing)){(O<y.range.from||O>y.range.to)&&!x&&!y.composing&&(_.active=!1);const D=d({char:n,allowSpaces:r,allowedPrefixes:s,startOfLine:i,$position:k.$from}),R=`id_${Math.floor(Math.random()*4294967295)}`;D&&f({editor:e,state:w,range:D.range,isActive:y.active})?(_.active=!0,_.decorationId=y.decorationId?y.decorationId:R,_.range=D.range,_.query=D.query,_.text=D.text):_.active=!1}else _.active=!1;return _.active||(_.decorationId=null,_.range={from:0,to:0},_.query=null,_.text=null),_}},props:{handleKeyDown(g,y){var v;const{active:w,range:A}=m.getState(g.state);return w&&((v=p==null?void 0:p.onKeyDown)===null||v===void 0?void 0:v.call(p,{view:g,event:y,range:A}))||!1},decorations(g){const{active:y,range:v,decorationId:w}=m.getState(g);return y?kt.create(g.doc,[nn.inline(v.from,v.to,{nodeName:o,class:a,"data-decoration-id":w})]):null}}});return m}var Xoe=typeof tr=="object"&&tr&&tr.Object===Object&&tr,Zoe=typeof self=="object"&&self&&self.Object===Object&&self;Xoe||Zoe||Function("return this")();var eae=typeof window<"u"?N.useLayoutEffect:N.useEffect,tae=typeof window>"u";function L2(t,{defaultValue:e=!1,initializeWithValue:n=!0}={}){const r=a=>tae?e:window.matchMedia(a).matches,[s,i]=N.useState(()=>n?r(t):e);function o(){i(r(t))}return eae(()=>{const a=window.matchMedia(t);return o(),a.addListener?a.addListener(o):a.addEventListener("change",o),()=>{a.removeListener?a.removeListener(o):a.removeEventListener("change",o)}},[t]),s}const nae=wt.create({name:"slash-command",addOptions(){return{suggestion:{char:"/",command:({editor:t,range:e,props:n})=>{n.command({editor:t,range:e})}}}},addProseMirrorPlugins(){return[Yoe({editor:this.editor,...this.options.suggestion})]}}),rae=({query:t,onError:e})=>[{title:"Text",description:"Just start typing with plain text.",searchTerms:["p","paragraph"],icon:S.jsx(XT,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).toggleNode("paragraph","paragraph").run()}},{title:"To-do List",description:"Track tasks with a to-do list.",searchTerms:["todo","task","list","check","checkbox"],icon:S.jsx(YT,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).toggleTaskList().run()}},{title:"Heading 1",description:"Big section heading.",searchTerms:["title","big","large"],icon:S.jsx(C0,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setNode("heading",{level:1}).run()}},{title:"Heading 2",description:"Medium section heading.",searchTerms:["subtitle","medium"],icon:S.jsx(S0,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setNode("heading",{level:2}).run()}},{title:"Heading 3",description:"Small section heading.",searchTerms:["subtitle","small"],icon:S.jsx(T0,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setNode("heading",{level:3}).run()}},{title:"Bullet List",description:"Create a simple bullet list.",searchTerms:["unordered","point"],icon:S.jsx(D0,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).toggleBulletList().run()}},{title:"Numbered List",description:"Create a list with numbering.",searchTerms:["ordered"],icon:S.jsx(Uu,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).toggleOrderedList().run()}},{title:"Divider",description:"Visually divide content.",searchTerms:["hr","divider","break","line","delimiter"],icon:S.jsx(nV,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setHorizontalRule().run()}},{title:"Quote",description:"Capture a quote.",searchTerms:["blockquote"],icon:S.jsx(O0,{size:18}),image:"",command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).toggleNode("paragraph","paragraph").toggleBlockquote().run()},{title:"Code",description:"Capture a code snippet.",searchTerms:["codeblock"],icon:S.jsx(Md,{size:18}),image:"",command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).toggleCodeBlock().run()},{title:"Table",description:"Create a table.",searchTerms:["table"],icon:S.jsx(iw,{size:18}),image:"",command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).insertTable({rows:3,cols:2,withHeaderRow:!0}).run()},{title:"Image",description:"Upload an image from your computer.",searchTerms:["photo","picture","media"],icon:S.jsx(ZU,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).run();const s=document.createElement("input");s.type="file",s.accept="image/*",s.onchange=async()=>{var i;if((i=s.files)!=null&&i.length){const o=s.files[0];if(o.size>Vd){e&&typeof e=="function"&&e(Kw.IMAGE_SIZE);return}const l=n.view.state.selection.from;uw(o,n.view,l)}},s.click()}},{title:"Video Embed",description:"Embed a video from YouTube, Vimeo, etc.",searchTerms:["iframe","embed","video","youtube"],icon:S.jsx(e3,{}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setActionButton("iframe").run()}},{title:"Twitter",description:"Embed a Twitter tweet.",searchTerms:["embed","twitter","tweet"],icon:S.jsx(ZT,{}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setActionButton("twitter").run()}},{title:"2 Columns",description:"Create 2 columns of block",searchTerms:["col","column","2","layout"],icon:S.jsx(qT,{}),image:"",command:({editor:n})=>{n.chain().focus().setColumns(2).focus(n.state.selection.head-1).run()}},{title:"3 Columns",description:"Create 3 columns of block",searchTerms:["col","column","3","layout"],icon:S.jsx(QU,{}),image:"",command:({editor:n})=>{n.chain().focus().setColumns(3).focus(n.state.selection.head-1).run()}}].filter(n=>{if(typeof t=="string"&&t.length>0){const r=t.toLowerCase();return n.title.toLowerCase().includes(r)||n.description.toLowerCase().includes(r)||n.searchTerms&&n.searchTerms.some(s=>s.includes(r))}return!0}),sae=(t,e)=>{const n=t.offsetHeight,r=e?e.offsetHeight:0,s=e.offsetTop,i=s+r;s<t.scrollTop?t.scrollTop-=t.scrollTop-s+5:i>n+t.scrollTop&&(t.scrollTop+=i-n-t.scrollTop+5)},iae=({items:t,command:e,editor:n})=>{const[r,s]=N.useState(0),[i,o]=N.useState(t),a=L2("(max-width: 640px)"),l=N.useCallback(c=>{const f=i[c];f&&(f.title==="Continue writing"||e(f))},[e,n,i]);N.useEffect(()=>{if(a){const c=t.filter(f=>!["2 Columns","3 Columns","Twitter","Video Embed"].includes(f.title));o(c)}else o(t)},[t,a]),N.useEffect(()=>{const c=["ArrowUp","ArrowDown","Enter"],f=d=>{if(c.includes(d.key))return d.preventDefault(),d.key==="ArrowUp"?(s((r+i.length-1)%i.length),!0):d.key==="ArrowDown"?(s((r+1)%i.length),!0):d.key==="Enter"?(l(r),!0):!1};return document.addEventListener("keydown",f),()=>{document.removeEventListener("keydown",f)}},[i,r,s,l]),N.useEffect(()=>{s(0)},[i]);const u=N.useRef(null);return N.useLayoutEffect(()=>{const c=u==null?void 0:u.current,f=c==null?void 0:c.children[r];f&&c&&sae(c,f)},[r]),i.length>0?S.jsx("div",{id:"slash-command",ref:u,className:"z-50 h-auto max-h-[330px] w-72 overflow-y-auto scroll-smooth rounded-md border border-[#DDD] bg-white px-1 py-2 shadow-md transition-all",children:i.map((c,f)=>S.jsxs("button",{className:`flex w-full items-center space-x-2 rounded-md px-2 py-1 text-left text-sm text-neutral-500 hover:bg-neutral-100 hover:border-neutral-200 border border-transparent transition-all ${f===r?"bg-neutral-200 text-neutral-800":""}`,onClick:()=>l(f),children:[S.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-md border border-neutral-200 bg-white",children:c.icon}),S.jsxs("div",{children:[S.jsx("p",{className:"font-medium",children:c.title}),S.jsx("p",{className:"text-xs text-neutral-500",children:c.description})]})]},f))}):null},oae=()=>{let t=null,e=null;return{onStart:n=>{t=new GT(iae,{props:n,editor:n.editor}),e=Xa("body",{getReferenceClientRect:n.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"})},onUpdate:n=>{t==null||t.updateProps(n),e&&e[0].setProps({getReferenceClientRect:n.clientRect})},onKeyDown:n=>{var r;return n.event.key==="Escape"?(e==null||e[0].hide(),!0):(r=t==null?void 0:t.ref)==null?void 0:r.onKeyDown(n)},onExit:()=>{e==null||e[0].destroy(),t==null||t.destroy()}}},aae=t=>{const e=({query:n})=>rae({query:n,onError:t});return nae.configure({suggestion:{items:e,render:oae}})},lI=["#30bced","#6eeb83","#fa69d1","#ecd444","#ee6352","#db3041","#0ad7f2","#1bff39"],lae=({isPreviewMode:t,initialContent:e,enableCollaboration:n,collaborationId:r,walletAddress:s,username:i,onChange:o,onCollaboratorChange:a,onCommentInteraction:l,onTextSelection:u,ensResolutionUrl:c,onError:f})=>{var O,_;const[d]=N.useState(new ul),[h,p]=N.useState([...qte,aae(f)]),m=N.useRef(!1),g=(D,R,L)=>{let F=!1;return D.doc.nodesBetween(R,L,G=>{G.marks&&G.marks.some(B=>B.type.name==="highlight"&&B.attrs.color==="yellow")&&(F=!0)}),F},y=(D,R)=>{var F;const L=R.target;if(L&&L.nodeName==="MARK"&&L.dataset.color&&((F=L==null?void 0:L.dataset)==null?void 0:F.color)==="yellow"){const G=L.textContent,B=D.posAtCoords({left:R.clientX,top:R.clientY});if(B){const{state:H}=D;let Q=B.pos,te=B.pos;if(H.doc.nodesBetween(Q,te,(Z,pe)=>{Z.marks&&Z.marks.length&&Z.marks.forEach(Ee=>{Ee.type.name==="highlight"&&(Q=pe,te=pe+Z.nodeSize)})}),Q!==te){const Z={text:G,from:Q,to:te,isHighlightedYellow:g(H,Q,te)};l==null||l(Z)}}}},w=FU({extensions:h,editorProps:{...cK,handleDOMEvents:{mouseover:y,keydown:(D,R)=>{if(["ArrowUp","ArrowDown","Enter"].includes(R.key)&&document.querySelector("#slash-command"))return!0}},handleClick:(D,R,L)=>{y(D,L)}},autofocus:"start",onTransaction:({editor:D,transaction:R})=>{D!=null&&D.isEmpty||R.docChanged&&(o==null||o(D.getJSON()))},shouldRerenderOnTransaction:!0,immediatelyRender:!1},[h]),A=N.useRef(()=>{}),x=(D,R=!1)=>{if(!n||!r)throw new Error("docId or username is not provided");const L=new uK(r,d,{signaling:["wss://fileverse-signaling-server-0529292ff51c.herokuapp.com/"]});return p([...h,LK.configure({document:d}),BK.configure({provider:L,user:{name:D&&D.length>20?qoe(D,7,15):D,color:lI[Math.floor(Math.random()*lI.length)],isEns:R},render:Zte})]),A.current=()=>{L.destroy(),d.destroy()},A.current},k=N.useRef(null);N.useEffect(()=>{w==null||w.setEditable(!t)},[t,w]),N.useEffect(()=>{e&&w&&!m.current&&(queueMicrotask(()=>{w.commands.setContent(e)}),m.current=!0),setTimeout(()=>{m.current=!1})},[e,w]),N.useEffect(()=>{if(!w)return;const D=()=>{const{state:R}=w,{from:L,to:F}=R.selection,G=R.doc.textBetween(L,F," ");u==null||u({text:G,from:L,to:F,isHighlightedYellow:g(R,L,F)})};return w.on("selectionUpdate",D),()=>{w.off("selectionUpdate",D)}},[w]);const C=async()=>{let D=i,R=!1;if(s&&c){const{name:L,isEns:F}=await Goe(s,c);D=L,R=F}if(!D)throw new Error("Cannot start collaboration without a username");x(D,R)};return N.useEffect(()=>{n?C():A.current()},[n]),N.useEffect(()=>{var D,R;a==null||a((R=(D=w==null?void 0:w.storage)==null?void 0:D.collaborationCursor)==null?void 0:R.users)},[(_=(O=w==null?void 0:w.storage)==null?void 0:O.collaborationCursor)==null?void 0:_.users]),{editor:w,ref:k,connect:x,ydoc:d}},uae=({title:t,content:e,contentClassName:n,open:r,onOpenChange:s,primaryAction:i,secondaryAction:o})=>S.jsx(dz,{open:r,onOpenChange:s,children:S.jsxs(bD,{className:"max-w-md sm:w-full w-[90%] z-20",children:[S.jsx(wD,{className:"px-4 pt-0 border-b-[1px]",children:S.jsx(vD,{className:"text-left text-base",children:t})}),S.jsx("div",{className:he("flex flex-col gap-4 w-full h-full pb-4 text-base text-black",n),children:e&&e}),S.jsxs(AD,{className:"px-5 pb-5 justify-end sm:",children:[o&&S.jsx(mz,{asChild:!0,children:S.jsx(sl,{disabled:o==null?void 0:o.isLoading,isLoading:o==null?void 0:o.isLoading,className:o==null?void 0:o.className,variant:(o==null?void 0:o.variant)||"ghost",onClick:o==null?void 0:o.onClick,children:o==null?void 0:o.label})}),i&&S.jsx(sl,{disabled:i==null?void 0:i.isLoading,isLoading:i==null?void 0:i.isLoading,className:i==null?void 0:i.className,variant:(i==null?void 0:i.variant)||"primary",onClick:i==null?void 0:i.onClick,children:i==null?void 0:i.label})]})]})}),cae=({editor:t,onError:e})=>{const{toolVisibilty:n,setToolVisibility:r,bottomToolbar:s}=qw({editor:t,onError:e}),i=L2("(max-width: 1023px)"),[o,a]=N.useState(""),[l,u]=N.useState(""),[c,f]=N.useState(!0),d=()=>{if(o===null){f(!1);return}if(o===""){t.chain().focus().extendMarkRange("link").unsetLink().run(),f(!1);return}let m=o;!o.startsWith("http://")&&!o.startsWith("https://")&&(m="https://"+o);try{m.match(/^((http|https):\/\/)?([w|W]{3}\.)+[a-zA-Z0-9\-\.]{3,}\.[a-zA-Z]{2,}(\.[a-zA-Z]{2,})?$/)&&t.chain().focus().extendMarkRange("link").setLink({href:m}).command(({tr:g})=>(g.insertText(l),!0)).run(),f(!0)}catch{console.error("Invalid URL"),f(!1);return}t.chain().focus().extendMarkRange("link").setLink({href:m}).command(({tr:g})=>(g.insertText(l),!0)).run(),f(!0),r(Me.NONE)},h=m=>{const{from:g,to:y}=m.state.selection,v=m.state.doc.textBetween(g,y);return u(v),v},p=N.useRef(null);return N.useEffect(()=>{let m=0;const g=()=>{m=Date.now()},y=()=>{var A;if(Date.now()-m>500){const{selection:x}=t.state;x.from!==x.to&&((A=p.current)==null||A.click())}},v=()=>{var x;if(!i)return;const{selection:w}=t.state;w.from!==w.to&&((x=p.current)==null||x.click())};return i?(document.addEventListener("touchstart",g),document.addEventListener("touchend",y)):document.addEventListener("mouseup",v),()=>{i?(document.removeEventListener("touchstart",g),document.removeEventListener("touchend",y)):document.removeEventListener("mouseup",v)}},[t,i]),N.useEffect(()=>{h(t)},[t]),N.useEffect(()=>{const m=g=>{g.key==="k"&&(g.metaKey||g.ctrlKey)&&(g.preventDefault(),n!==Me.LINK_POPUP?r(Me.LINK_POPUP):r(Me.NONE))};return document.addEventListener("keydown",m),()=>{document.removeEventListener("keydown",m)}},[t,n]),S.jsxs(fD,{children:[S.jsx("div",{className:"flex w-full justify-between sm:justify-evenly select-none",children:s.map(m=>{if(m)return S.jsx("div",{className:"flex items-center",children:m.title==="Text formating"?S.jsx(dD,{asChild:!0,children:S.jsx("button",{ref:p,onClick:()=>m.onClick(),children:m.icon})}):m.title==="Text color"?S.jsx(dD,{asChild:!0,children:S.jsx("button",{onClick:()=>m.onClick(),children:m.icon})}):S.jsx("button",{className:he("flex items-center rounded px-2 py-1 transition",{"text-black":m.isActive,"text-[#A1AAB1]":!m.isActive}),onClick:()=>m.onClick(),disabled:!m.isActive,children:m.icon})},m.title)})}),n===Me.TEXT_FORMATING&&S.jsx(n$,{editor:t,setToolVisibility:r}),n===Me.LINK_POPUP&&S.jsx(uae,{open:n===Me.LINK_POPUP,onOpenChange:()=>r(Me.NONE),title:"Link",content:S.jsxs("div",{className:"flex flex-col gap-4 w-full h-full px-4",children:[S.jsx(q0,{label:"Text",placeholder:"Link text",className:"w-full",defaultValue:l,onChange:m=>{m.preventDefault(),u(m.target.value)}}),S.jsx(q0,{label:"Link",placeholder:"Paste URL",className:"w-full",defaultValue:t.getAttributes("link").href,onChange:m=>{m.preventDefault(),a(m.target.value)},isValid:c,message:c?"":"Invalid URL"})]}),primaryAction:{label:"Save",onClick:()=>d(),isLoading:!1,className:"w-auto min-w-[80px]"},secondaryAction:{label:"Cancel",variant:"secondary",onClick:()=>r(Me.NONE),className:"w-auto min-w-[80px]"}})]})},B2=N.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),Fy=N.createContext({}),jy=N.createContext(null),F2=typeof document<"u",j2=F2?N.useLayoutEffect:N.useEffect,uI=N.createContext({strict:!1}),U2=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),cI="data-"+U2("framerAppearId"),fae={skipAnimations:!1,useManualTiming:!1};class fI{constructor(){this.order=[],this.scheduled=new Set}add(e){if(!this.scheduled.has(e))return this.scheduled.add(e),this.order.push(e),!0}remove(e){const n=this.order.indexOf(e);n!==-1&&(this.order.splice(n,1),this.scheduled.delete(e))}clear(){this.order.length=0,this.scheduled.clear()}}function dae(t){let e=new fI,n=new fI,r=0,s=!1,i=!1;const o=new WeakSet,a={schedule:(l,u=!1,c=!1)=>{const f=c&&s,d=f?e:n;return u&&o.add(l),d.add(l)&&f&&s&&(r=e.order.length),l},cancel:l=>{n.remove(l),o.delete(l)},process:l=>{if(s){i=!0;return}if(s=!0,[e,n]=[n,e],n.clear(),r=e.order.length,r)for(let u=0;u<r;u++){const c=e.order[u];o.has(c)&&(a.schedule(c),t()),c(l)}s=!1,i&&(i=!1,a.process(l))}};return a}const Uy=["read","resolveKeyframes","update","preRender","render","postRender"],hae=40;function dI(t,e){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=Uy.reduce((f,d)=>(f[d]=dae(()=>n=!0),f),{}),o=f=>{i[f].process(s)},a=()=>{const f=performance.now();n=!1,s.delta=r?1e3/60:Math.max(Math.min(f-s.timestamp,hae),1),s.timestamp=f,s.isProcessing=!0,Uy.forEach(o),s.isProcessing=!1,n&&e&&(r=!1,t(a))},l=()=>{n=!0,r=!0,s.isProcessing||t(a)};return{schedule:Uy.reduce((f,d)=>{const h=i[d];return f[d]=(p,m=!1,g=!1)=>(n||l(),h.schedule(p,m,g)),f},{}),cancel:f=>Uy.forEach(d=>i[d].cancel(f)),state:s,steps:i}}const{schedule:V2,cancel:Yde}=dI(queueMicrotask,!1);function Wc(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}const hI=N.createContext({});let pI=!1;function pae(t,e,n,r,s){const{visualElement:i}=N.useContext(Fy),o=N.useContext(uI),a=N.useContext(jy),l=N.useContext(B2).reducedMotion,u=N.useRef();r=r||o.renderer,!u.current&&r&&(u.current=r(t,{visualState:e,parent:i,props:n,presenceContext:a,blockInitialAnimation:a?a.initial===!1:!1,reducedMotionConfig:l}));const c=u.current,f=N.useContext(hI);c&&!c.projection&&s&&(c.type==="html"||c.type==="svg")&&gae(u.current,n,s,f),N.useInsertionEffect(()=>{c&&c.update(n,a)});const d=N.useRef(!!(n[cI]&&!window.HandoffComplete));return j2(()=>{c&&(c.updateFeatures(),V2.render(c.render),d.current&&c.animationState&&c.animationState.animateChanges())}),N.useEffect(()=>{c&&(!d.current&&c.animationState&&c.animationState.animateChanges(),d.current&&(d.current=!1,pI||(pI=!0,queueMicrotask(mae))))}),c}function mae(){window.HandoffComplete=!0}function gae(t,e,n,r){const{layoutId:s,layout:i,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:u}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:mI(t.parent)),t.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||a&&Wc(a),visualElement:t,scheduleRender:()=>t.scheduleRender(),animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,layoutScroll:l,layoutRoot:u})}function mI(t){if(t)return t.options.allowProjection!==!1?t.projection:mI(t.parent)}function yae(t,e,n){return N.useCallback(r=>{r&&t.mount&&t.mount(r),e&&(r?e.mount(r):e.unmount()),n&&(typeof n=="function"?n(r):Wc(n)&&(n.current=r))},[e])}function Zh(t){return typeof t=="string"||Array.isArray(t)}function Vy(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const H2=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],z2=["initial",...H2];function Hy(t){return Vy(t.animate)||z2.some(e=>Zh(t[e]))}function gI(t){return!!(Hy(t)||t.variants)}function bae(t,e){if(Hy(t)){const{initial:n,animate:r}=t;return{initial:n===!1||Zh(n)?n:void 0,animate:Zh(r)?r:void 0}}return t.inherit!==!1?e:{}}function wae(t){const{initial:e,animate:n}=bae(t,N.useContext(Fy));return N.useMemo(()=>({initial:e,animate:n}),[yI(e),yI(n)])}function yI(t){return Array.isArray(t)?t.join(" "):t}const bI={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"]},Kc={};for(const t in bI)Kc[t]={isEnabled:e=>bI[t].some(n=>!!e[n])};function Aae(t){for(const e in t)Kc[e]={...Kc[e],...t[e]}}const $2=N.createContext({}),vae=Symbol.for("motionComponentSymbol"),Sn=t=>t;let qc=Sn,Ji=Sn;process.env.NODE_ENV!=="production"&&(qc=(t,e)=>{!t&&typeof console<"u"&&console.warn(e)},Ji=(t,e)=>{if(!t)throw new Error(e)});function xae({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:r,Component:s}){t&&Aae(t);function i(a,l){let u;const c={...N.useContext(B2),...a,layoutId:kae(a)},{isStatic:f}=c,d=wae(a),h=r(a,f);if(!f&&F2){Eae(c,t);const p=Cae(c);u=p.MeasureLayout,d.visualElement=pae(s,h,c,e,p.ProjectionNode)}return S.jsxs(Fy.Provider,{value:d,children:[u&&d.visualElement?S.jsx(u,{visualElement:d.visualElement,...c}):null,n(s,a,yae(h,d.visualElement,l),h,f,d.visualElement)]})}const o=N.forwardRef(i);return o[vae]=s,o}function kae({layoutId:t}){const e=N.useContext($2).id;return e&&t!==void 0?e+"-"+t:t}function Eae(t,e){const n=N.useContext(uI).strict;if(process.env.NODE_ENV!=="production"&&e&&n){const r="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?qc(!1,r):Ji(!1,r)}}function Cae(t){const{drag:e,layout:n}=Kc;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:e!=null&&e.isEnabled(t)||n!=null&&n.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function Sae(t){function e(r,s={}){return xae(t(r,s))}if(typeof Proxy>"u")return e;const n=new Map;return new Proxy(e,{get:(r,s)=>(n.has(s)||n.set(s,e(s)),n.get(s))})}const Tae=["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 G2(t){return typeof t!="string"||t.includes("-")?!1:!!(Tae.indexOf(t)>-1||/[A-Z]/u.test(t))}const zy={};function Dae(t){Object.assign(zy,t)}const ep=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Bl=new Set(ep);function wI(t,{layout:e,layoutId:n}){return Bl.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!zy[t]||t==="opacity")}const Pn=t=>!!(t&&t.getVelocity),Oae={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},_ae=ep.length;function Mae(t,{enableHardwareAcceleration:e=!0,allowTransformNone:n=!0},r,s){let i="";for(let o=0;o<_ae;o++){const a=ep[o];if(t[a]!==void 0){const l=Oae[a]||a;i+=`${l}(${t[a]}) `}}return e&&!t.z&&(i+="translateZ(0)"),i=i.trim(),s?i=s(t,r?"":i):n&&r&&(i="none"),i}const AI=t=>e=>typeof e=="string"&&e.startsWith(t),vI=AI("--"),Nae=AI("var(--"),W2=t=>Nae(t)?Rae.test(t.split("/*")[0].trim()):!1,Rae=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Pae=(t,e)=>e&&typeof t=="number"?e.transform(t):t,aa=(t,e,n)=>n>e?e:n<t?t:n,Qc={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},tp={...Qc,transform:t=>aa(0,1,t)},$y={...Qc,default:1},np=t=>Math.round(t*1e5)/1e5,K2=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,Iae=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,Lae=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;function rp(t){return typeof t=="string"}const sp=t=>({test:e=>rp(e)&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),la=sp("deg"),di=sp("%"),Ie=sp("px"),Bae=sp("vh"),Fae=sp("vw"),xI={...di,parse:t=>di.parse(t)/100,transform:t=>di.transform(t*100)},kI={...Qc,transform:Math.round},EI={borderWidth:Ie,borderTopWidth:Ie,borderRightWidth:Ie,borderBottomWidth:Ie,borderLeftWidth:Ie,borderRadius:Ie,radius:Ie,borderTopLeftRadius:Ie,borderTopRightRadius:Ie,borderBottomRightRadius:Ie,borderBottomLeftRadius:Ie,width:Ie,maxWidth:Ie,height:Ie,maxHeight:Ie,size:Ie,top:Ie,right:Ie,bottom:Ie,left:Ie,padding:Ie,paddingTop:Ie,paddingRight:Ie,paddingBottom:Ie,paddingLeft:Ie,margin:Ie,marginTop:Ie,marginRight:Ie,marginBottom:Ie,marginLeft:Ie,rotate:la,rotateX:la,rotateY:la,rotateZ:la,scale:$y,scaleX:$y,scaleY:$y,scaleZ:$y,skew:la,skewX:la,skewY:la,distance:Ie,translateX:Ie,translateY:Ie,translateZ:Ie,x:Ie,y:Ie,z:Ie,perspective:Ie,transformPerspective:Ie,opacity:tp,originX:xI,originY:xI,originZ:Ie,zIndex:kI,backgroundPositionX:Ie,backgroundPositionY:Ie,fillOpacity:tp,strokeOpacity:tp,numOctaves:kI};function q2(t,e,n,r){const{style:s,vars:i,transform:o,transformOrigin:a}=t;let l=!1,u=!1,c=!0;for(const f in e){const d=e[f];if(vI(f)){i[f]=d;continue}const h=EI[f],p=Pae(d,h);if(Bl.has(f)){if(l=!0,o[f]=p,!c)continue;d!==(h.default||0)&&(c=!1)}else f.startsWith("origin")?(u=!0,a[f]=p):s[f]=p}if(e.transform||(l||r?s.transform=Mae(t.transform,n,c,r):s.transform&&(s.transform="none")),u){const{originX:f="50%",originY:d="50%",originZ:h=0}=a;s.transformOrigin=`${f} ${d} ${h}`}}const Q2=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function CI(t,e,n){for(const r in e)!Pn(e[r])&&!wI(r,n)&&(t[r]=e[r])}function jae({transformTemplate:t},e,n){return N.useMemo(()=>{const r=Q2();return q2(r,e,{enableHardwareAcceleration:!n},t),Object.assign({},r.vars,r.style)},[e])}function Uae(t,e,n){const r=t.style||{},s={};return CI(s,r,t),Object.assign(s,jae(t,e,n)),s}function Vae(t,e,n){const r={},s=Uae(t,e,n);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=s,r}const Hae=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 Gy(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Hae.has(t)}let SI=t=>!Gy(t);function zae(t){t&&(SI=e=>e.startsWith("on")?!Gy(e):t(e))}try{zae(require("@emotion/is-prop-valid").default)}catch{}function $ae(t,e,n){const r={};for(const s in t)s==="values"&&typeof t.values=="object"||(SI(s)||n===!0&&Gy(s)||!e&&!Gy(s)||t.draggable&&s.startsWith("onDrag"))&&(r[s]=t[s]);return r}function TI(t,e,n){return typeof t=="string"?t:Ie.transform(e+n*t)}function Gae(t,e,n){const r=TI(e,t.x,t.width),s=TI(n,t.y,t.height);return`${r} ${s}`}const Wae={offset:"stroke-dashoffset",array:"stroke-dasharray"},Kae={offset:"strokeDashoffset",array:"strokeDasharray"};function qae(t,e,n=1,r=0,s=!0){t.pathLength=1;const i=s?Wae:Kae;t[i.offset]=Ie.transform(-r);const o=Ie.transform(e),a=Ie.transform(n);t[i.array]=`${o} ${a}`}function J2(t,{attrX:e,attrY:n,attrScale:r,originX:s,originY:i,pathLength:o,pathSpacing:a=1,pathOffset:l=0,...u},c,f,d){if(q2(t,u,c,d),f){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:h,style:p,dimensions:m}=t;h.transform&&(m&&(p.transform=h.transform),delete h.transform),m&&(s!==void 0||i!==void 0||p.transform)&&(p.transformOrigin=Gae(m,s!==void 0?s:.5,i!==void 0?i:.5)),e!==void 0&&(h.x=e),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),o!==void 0&&qae(h,o,a,l,!1)}const DI=()=>({...Q2(),attrs:{}}),Y2=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Qae(t,e,n,r){const s=N.useMemo(()=>{const i=DI();return J2(i,e,{enableHardwareAcceleration:!1},Y2(r),t.transformTemplate),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};CI(i,t.style,t),s.style={...i,...s.style}}return s}function Jae(t=!1){return(n,r,s,{latestValues:i},o)=>{const l=(G2(n)?Qae:Vae)(r,i,o,n),u=$ae(r,typeof n=="string",t),c=n!==N.Fragment?{...u,...l,ref:s}:{},{children:f}=r,d=N.useMemo(()=>Pn(f)?f.get():f,[f]);return N.createElement(n,{...c,children:d})}}function OI(t,{style:e,vars:n},r,s){Object.assign(t.style,e,s&&s.getProjectionStyles(r));for(const i in n)t.style.setProperty(i,n[i])}const _I=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 MI(t,e,n,r){OI(t,e,void 0,r);for(const s in e.attrs)t.setAttribute(_I.has(s)?s:U2(s),e.attrs[s])}function X2(t,e,n){var r;const{style:s}=t,i={};for(const o in s)(Pn(s[o])||e.style&&Pn(e.style[o])||wI(o,t)||((r=n==null?void 0:n.getValue(o))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(i[o]=s[o]);return i}function NI(t,e,n){const r=X2(t,e,n);for(const s in t)if(Pn(t[s])||Pn(e[s])){const i=ep.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=t[s]}return r}function RI(t){const e=[{},{}];return t==null||t.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function Z2(t,e,n,r){if(typeof e=="function"){const[s,i]=RI(r);e=e(n!==void 0?n:t.custom,s,i)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[s,i]=RI(r);e=e(n!==void 0?n:t.custom,s,i)}return e}function PI(t){const e=N.useRef(null);return e.current===null&&(e.current=t()),e.current}const ek=t=>Array.isArray(t),Yae=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),Xae=t=>ek(t)?t[t.length-1]||0:t;function Wy(t){const e=Pn(t)?t.get():t;return Yae(e)?e.toValue():e}function Zae({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:n},r,s,i){const o={latestValues:ele(r,s,i,t),renderState:e()};return n&&(o.mount=a=>n(r,a,o)),o}const II=t=>(e,n)=>{const r=N.useContext(Fy),s=N.useContext(jy),i=()=>Zae(t,e,r,s);return n?i():PI(i)};function ele(t,e,n,r){const s={},i=r(t,{});for(const d in i)s[d]=Wy(i[d]);let{initial:o,animate:a}=t;const l=Hy(t),u=gI(t);e&&u&&!l&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let c=n?n.initial===!1:!1;c=c||o===!1;const f=c?a:o;return f&&typeof f!="boolean"&&!Vy(f)&&(Array.isArray(f)?f:[f]).forEach(h=>{const p=Z2(t,h);if(!p)return;const{transitionEnd:m,transition:g,...y}=p;for(const v in y){let w=y[v];if(Array.isArray(w)){const A=c?w.length-1:0;w=w[A]}w!==null&&(s[v]=w)}for(const v in m)s[v]=m[v]}),s}const{schedule:pt,cancel:Yi,state:Tn,steps:tk}=dI(typeof requestAnimationFrame<"u"?requestAnimationFrame:Sn,!0),tle={useVisualState:II({scrapeMotionValuesFromProps:NI,createRenderState:DI,onMount:(t,e,{renderState:n,latestValues:r})=>{pt.read(()=>{try{n.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}}),pt.render(()=>{J2(n,r,{enableHardwareAcceleration:!1},Y2(e.tagName),t.transformTemplate),MI(e,n)})}})},nle={useVisualState:II({scrapeMotionValuesFromProps:X2,createRenderState:Q2})};function rle(t,{forwardMotionProps:e=!1},n,r){return{...G2(t)?tle:nle,preloadedFeatures:n,useRender:Jae(e),createVisualElement:r,Component:t}}function Xi(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}const LI=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function Ky(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const sle=t=>e=>LI(e)&&t(e,Ky(e));function Zi(t,e,n,r){return Xi(t,e,sle(n),r)}const ile=(t,e)=>n=>e(t(n)),eo=(...t)=>t.reduce(ile);function BI(t){let e=null;return()=>{const n=()=>{e=null};return e===null?(e=t,n):!1}}const FI=BI("dragHorizontal"),jI=BI("dragVertical");function UI(t){let e=!1;if(t==="y")e=jI();else if(t==="x")e=FI();else{const n=FI(),r=jI();n&&r?e=()=>{n(),r()}:(n&&n(),r&&r())}return e}function VI(){const t=UI(!0);return t?(t(),!1):!0}class ua{constructor(e){this.isMounted=!1,this.node=e}update(){}}function HI(t,e){const n=e?"pointerenter":"pointerleave",r=e?"onHoverStart":"onHoverEnd",s=(i,o)=>{if(i.pointerType==="touch"||VI())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e);const l=a[r];l&&pt.postRender(()=>l(i,o))};return Zi(t.current,n,s,{passive:!t.getProps()[r]})}class ole extends ua{mount(){this.unmount=eo(HI(this.node,!0),HI(this.node,!1))}unmount(){}}class ale extends ua{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=eo(Xi(this.node.current,"focus",()=>this.onFocus()),Xi(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const zI=(t,e)=>e?t===e?!0:zI(t,e.parentElement):!1;function nk(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,Ky(n))}class lle extends ua{constructor(){super(...arguments),this.removeStartListeners=Sn,this.removeEndListeners=Sn,this.removeAccessibleListeners=Sn,this.startPointerPress=(e,n)=>{if(this.isPressing)return;this.removeEndListeners();const r=this.node.getProps(),i=Zi(window,"pointerup",(a,l)=>{if(!this.checkPressEnd())return;const{onTap:u,onTapCancel:c,globalTapTarget:f}=this.node.getProps(),d=!f&&!zI(this.node.current,a.target)?c:u;d&&pt.update(()=>d(a,l))},{passive:!(r.onTap||r.onPointerUp)}),o=Zi(window,"pointercancel",(a,l)=>this.cancelPress(a,l),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=eo(i,o),this.startPress(e,n)},this.startAccessiblePress=()=>{const e=i=>{if(i.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||nk("up",(l,u)=>{const{onTap:c}=this.node.getProps();c&&pt.postRender(()=>c(l,u))})};this.removeEndListeners(),this.removeEndListeners=Xi(this.node.current,"keyup",o),nk("down",(a,l)=>{this.startPress(a,l)})},n=Xi(this.node.current,"keydown",e),r=()=>{this.isPressing&&nk("cancel",(i,o)=>this.cancelPress(i,o))},s=Xi(this.node.current,"blur",r);this.removeAccessibleListeners=eo(n,s)}}startPress(e,n){this.isPressing=!0;const{onTapStart:r,whileTap:s}=this.node.getProps();s&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),r&&pt.postRender(()=>r(e,n))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!VI()}cancelPress(e,n){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&pt.postRender(()=>r(e,n))}mount(){const e=this.node.getProps(),n=Zi(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),r=Xi(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=eo(n,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const rk=new WeakMap,sk=new WeakMap,ule=t=>{const e=rk.get(t.target);e&&e(t)},cle=t=>{t.forEach(ule)};function fle({root:t,...e}){const n=t||document;sk.has(n)||sk.set(n,{});const r=sk.get(n),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(cle,{root:t,...e})),r[s]}function dle(t,e,n){const r=fle(e);return rk.set(t,n),r.observe(t),()=>{rk.delete(t),r.unobserve(t)}}const hle={some:0,all:1};class ple extends ua{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=e,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:hle[s]},a=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,i&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:c,onViewportLeave:f}=this.node.getProps(),d=u?c:f;d&&d(l)};return dle(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(mle(e,n))&&this.startObserver()}unmount(){}}function mle({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const gle={inView:{Feature:ple},tap:{Feature:lle},focus:{Feature:ale},hover:{Feature:ole}};function $I(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}function qy(t,e,n){const r=t.getProps();return Z2(r,e,n!==void 0?n:r.custom,t)}const to=t=>t*1e3,no=t=>t/1e3,yle={type:"spring",stiffness:500,damping:25,restSpeed:10},ble=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),wle={type:"keyframes",duration:.8},Ale={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},vle=(t,{keyframes:e})=>e.length>2?wle:Bl.has(t)?t.startsWith("scale")?ble(e[1]):yle:Ale;function xle({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:o,repeatDelay:a,from:l,elapsed:u,...c}){return!!Object.keys(c).length}function ik(t,e){return t[e]||t.default||t}const kle=t=>t!==null;function Qy(t,{repeat:e,repeatType:n="loop"},r){const s=t.filter(kle),i=e&&n!=="loop"&&e%2===1?0:s.length-1;return!i||r===void 0?s[i]:r}let Jy;function Ele(){Jy=void 0}const ca={now:()=>(Jy===void 0&&ca.set(Tn.isProcessing||fae.useManualTiming?Tn.timestamp:performance.now()),Jy),set:t=>{Jy=t,queueMicrotask(Ele)}},GI=t=>/^0[^.\s]+$/u.test(t);function Cle(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||GI(t):!0}const WI=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),Sle=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Tle(t){const e=Sle.exec(t);if(!e)return[,];const[,n,r,s]=e;return[`--${n??r}`,s]}const Dle=4;function KI(t,e,n=1){Ji(n<=Dle,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[r,s]=Tle(t);if(!r)return;const i=window.getComputedStyle(e).getPropertyValue(r);if(i){const o=i.trim();return WI(o)?parseFloat(o):o}return W2(s)?KI(s,e,n+1):s}const Ole=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),qI=t=>t===Qc||t===Ie,QI=(t,e)=>parseFloat(t.split(", ")[e]),JI=(t,e)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/u);if(s)return QI(s[1],e);{const i=r.match(/^matrix\((.+)\)$/u);return i?QI(i[1],t):0}},_le=new Set(["x","y","z"]),Mle=ep.filter(t=>!_le.has(t));function Nle(t){const e=[];return Mle.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const Jc={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:JI(4,13),y:JI(5,14)};Jc.translateX=Jc.x,Jc.translateY=Jc.y;const YI=t=>e=>e.test(t),XI=[Qc,Ie,di,la,Fae,Bae,{test:t=>t==="auto",parse:t=>t}],ZI=t=>XI.find(YI(t)),Fl=new Set;let ok=!1,ak=!1;function e8(){if(ak){const t=Array.from(Fl).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const s=Nle(r);s.length&&(n.set(r,s),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,o])=>{var a;(a=r.getValue(i))===null||a===void 0||a.set(o)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}ak=!1,ok=!1,Fl.forEach(t=>t.complete()),Fl.clear()}function t8(){Fl.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(ak=!0)})}function Rle(){t8(),e8()}class lk{constructor(e,n,r,s,i,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Fl.add(this),ok||(ok=!0,pt.read(t8),pt.resolveKeyframes(e8))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:s}=this;for(let i=0;i<e.length;i++)if(e[i]===null)if(i===0){const o=s==null?void 0:s.get(),a=e[e.length-1];if(o!==void 0)e[0]=o;else if(r&&n){const l=r.readValue(n,a);l!=null&&(e[0]=l)}e[0]===void 0&&(e[0]=a),s&&o===void 0&&s.set(e[0])}else e[i]=e[i-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Fl.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Fl.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const uk=(t,e)=>n=>!!(rp(n)&&Lae.test(n)&&n.startsWith(t)||e&&Object.prototype.hasOwnProperty.call(n,e)),n8=(t,e,n)=>r=>{if(!rp(r))return r;const[s,i,o,a]=r.match(K2);return{[t]:parseFloat(s),[e]:parseFloat(i),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},Ple=t=>aa(0,255,t),ck={...Qc,transform:t=>Math.round(Ple(t))},jl={test:uk("rgb","red"),parse:n8("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+ck.transform(t)+", "+ck.transform(e)+", "+ck.transform(n)+", "+np(tp.transform(r))+")"};function Ile(t){let e="",n="",r="",s="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),s=t.substring(4,5),e+=e,n+=n,r+=r,s+=s),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const fk={test:uk("#"),parse:Ile,transform:jl.transform},Yc={test:uk("hsl","hue"),parse:n8("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+di.transform(np(e))+", "+di.transform(np(n))+", "+np(tp.transform(r))+")"},In={test:t=>jl.test(t)||fk.test(t)||Yc.test(t),parse:t=>jl.test(t)?jl.parse(t):Yc.test(t)?Yc.parse(t):fk.parse(t),transform:t=>rp(t)?t:t.hasOwnProperty("red")?jl.transform(t):Yc.transform(t)};function Lle(t){var e,n;return isNaN(t)&&rp(t)&&(((e=t.match(K2))===null||e===void 0?void 0:e.length)||0)+(((n=t.match(Iae))===null||n===void 0?void 0:n.length)||0)>0}const r8="number",s8="color",Ble="var",Fle="var(",i8="${}",jle=/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 ip(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const a=e.replace(jle,l=>(In.test(l)?(r.color.push(i),s.push(s8),n.push(In.parse(l))):l.startsWith(Fle)?(r.var.push(i),s.push(Ble),n.push(l)):(r.number.push(i),s.push(r8),n.push(parseFloat(l))),++i,i8)).split(i8);return{values:n,split:a,indexes:r,types:s}}function o8(t){return ip(t).values}function a8(t){const{split:e,types:n}=ip(t),r=e.length;return s=>{let i="";for(let o=0;o<r;o++)if(i+=e[o],s[o]!==void 0){const a=n[o];a===r8?i+=np(s[o]):a===s8?i+=In.transform(s[o]):i+=s[o]}return i}}const Ule=t=>typeof t=="number"?0:t;function Vle(t){const e=o8(t);return a8(t)(e.map(Ule))}const fa={test:Lle,parse:o8,createTransformer:a8,getAnimatableNone:Vle},Hle=new Set(["brightness","contrast","saturate","opacity"]);function zle(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(K2)||[];if(!r)return t;const s=n.replace(r,"");let i=Hle.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+s+")"}const $le=/\b([a-z-]*)\(.*?\)/gu,dk={...fa,getAnimatableNone:t=>{const e=t.match($le);return e?e.map(zle).join(" "):t}},Gle={...EI,color:In,backgroundColor:In,outlineColor:In,fill:In,stroke:In,borderColor:In,borderTopColor:In,borderRightColor:In,borderBottomColor:In,borderLeftColor:In,filter:dk,WebkitFilter:dk},hk=t=>Gle[t];function l8(t,e){let n=hk(t);return n!==dk&&(n=fa),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Wle=new Set(["auto","none","0"]);function Kle(t,e,n){let r=0,s;for(;r<t.length&&!s;){const i=t[r];typeof i=="string"&&!Wle.has(i)&&ip(i).values.length&&(s=t[r]),r++}if(s&&n)for(const i of e)t[i]=l8(n,s)}class u8 extends lk{constructor(e,n,r,s){super(e,n,r,s,s==null?void 0:s.owner,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:r}=this;if(!n.current)return;super.readKeyframes();for(let l=0;l<e.length;l++){let u=e[l];if(typeof u=="string"&&(u=u.trim(),W2(u))){const c=KI(u,n.current);c!==void 0&&(e[l]=c),l===e.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!Ole.has(r)||e.length!==2)return;const[s,i]=e,o=ZI(s),a=ZI(i);if(o!==a)if(qI(o)&&qI(a))for(let l=0;l<e.length;l++){const u=e[l];typeof u=="string"&&(e[l]=parseFloat(u))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let s=0;s<e.length;s++)Cle(e[s])&&r.push(s);r.length&&Kle(e,r,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:r}=this;if(!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Jc[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&e.getValue(r,s).jump(s,!1)}measureEndState(){var e;const{element:n,name:r,unresolvedKeyframes:s}=this;if(!n.current)return;const i=n.getValue(r);i&&i.jump(this.measuredOrigin,!1);const o=s.length-1,a=s[o];s[o]=Jc[r](n.measureViewportBox(),window.getComputedStyle(n.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),!((e=this.removedTransforms)===null||e===void 0)&&e.length&&this.removedTransforms.forEach(([l,u])=>{n.getValue(l).set(u)}),this.resolveNoneKeyframes()}}function c8(t){let e;return()=>(e===void 0&&(e=t()),e)}const f8=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(fa.test(t)||t==="0")&&!t.startsWith("url("));function qle(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function Qle(t,e,n,r){const s=t[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const i=t[t.length-1],o=f8(s,e),a=f8(i,e);return qc(o===a,`You are trying to animate ${e} from "${s}" to "${i}". ${s} is not an animatable value - to enable this animation set ${s} to a value animatable to ${i} via the \`style\` property.`),!o||!a?!1:qle(t)||n==="spring"&&r}class d8{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:o="loop",...a}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.options={autoplay:e,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:o,...a},this.updateFinishedPromise()}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&Rle(),this._resolved}onKeyframesResolved(e,n){this.hasAttemptedResolve=!0;const{name:r,type:s,velocity:i,delay:o,onComplete:a,onUpdate:l,isGenerator:u}=this.options;if(!u&&!Qle(e,r,s,i))if(o)this.options.duration=0;else{l==null||l(Qy(e,this.options,n)),a==null||a(),this.resolveFinishedPromise();return}const c=this.initPlayback(e,n);c!==!1&&(this._resolved={keyframes:e,finalKeyframe:n,...c},this.onPostResolved())}onPostResolved(){}then(e,n){return this.currentFinishedPromise.then(e,n)}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function h8(t,e){return e?t*(1e3/e):0}const Jle=5;function p8(t,e,n){const r=Math.max(e-Jle,0);return h8(n-t(r),e-r)}const pk=.001,Yle=.01,m8=10,Xle=.05,Zle=1;function eue({duration:t=800,bounce:e=.25,velocity:n=0,mass:r=1}){let s,i;qc(t<=to(m8),"Spring duration must be 10 seconds or less");let o=1-e;o=aa(Xle,Zle,o),t=aa(Yle,m8,no(t)),o<1?(s=u=>{const c=u*o,f=c*t,d=c-n,h=mk(u,o),p=Math.exp(-f);return pk-d/h*p},i=u=>{const f=u*o*t,d=f*n+n,h=Math.pow(o,2)*Math.pow(u,2)*t,p=Math.exp(-f),m=mk(Math.pow(u,2),o);return(-s(u)+pk>0?-1:1)*((d-h)*p)/m}):(s=u=>{const c=Math.exp(-u*t),f=(u-n)*t+1;return-pk+c*f},i=u=>{const c=Math.exp(-u*t),f=(n-u)*(t*t);return c*f});const a=5/t,l=nue(s,i,a);if(t=to(t),isNaN(l))return{stiffness:100,damping:10,duration:t};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:o*2*Math.sqrt(r*u),duration:t}}}const tue=12;function nue(t,e,n){let r=n;for(let s=1;s<tue;s++)r=r-t(r)/e(r);return r}function mk(t,e){return t*Math.sqrt(1-e*e)}const rue=["duration","bounce"],sue=["stiffness","damping","mass"];function g8(t,e){return e.some(n=>t[n]!==void 0)}function iue(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!g8(t,sue)&&g8(t,rue)){const n=eue(t);e={...e,...n,mass:1},e.isResolvedFromDuration=!0}return e}function y8({keyframes:t,restDelta:e,restSpeed:n,...r}){const s=t[0],i=t[t.length-1],o={done:!1,value:s},{stiffness:a,damping:l,mass:u,duration:c,velocity:f,isResolvedFromDuration:d}=iue({...r,velocity:-no(r.velocity||0)}),h=f||0,p=l/(2*Math.sqrt(a*u)),m=i-s,g=no(Math.sqrt(a/u)),y=Math.abs(m)<5;n||(n=y?.01:2),e||(e=y?.005:.5);let v;if(p<1){const w=mk(g,p);v=A=>{const x=Math.exp(-p*g*A);return i-x*((h+p*g*m)/w*Math.sin(w*A)+m*Math.cos(w*A))}}else if(p===1)v=w=>i-Math.exp(-g*w)*(m+(h+g*m)*w);else{const w=g*Math.sqrt(p*p-1);v=A=>{const x=Math.exp(-p*g*A),k=Math.min(w*A,300);return i-x*((h+p*g*m)*Math.sinh(k)+w*m*Math.cosh(k))/w}}return{calculatedDuration:d&&c||null,next:w=>{const A=v(w);if(d)o.done=w>=c;else{let x=h;w!==0&&(p<1?x=p8(v,w,A):x=0);const k=Math.abs(x)<=n,C=Math.abs(i-A)<=e;o.done=k&&C}return o.value=o.done?i:A,o}}}function b8({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:a,max:l,restDelta:u=.5,restSpeed:c}){const f=t[0],d={done:!1,value:f},h=O=>a!==void 0&&O<a||l!==void 0&&O>l,p=O=>a===void 0?l:l===void 0||Math.abs(a-O)<Math.abs(l-O)?a:l;let m=n*e;const g=f+m,y=o===void 0?g:o(g);y!==g&&(m=y-f);const v=O=>-m*Math.exp(-O/r),w=O=>y+v(O),A=O=>{const _=v(O),D=w(O);d.done=Math.abs(_)<=u,d.value=d.done?y:D};let x,k;const C=O=>{h(d.value)&&(x=O,k=y8({keyframes:[d.value,p(d.value)],velocity:p8(w,O,d.value),damping:s,stiffness:i,restDelta:u,restSpeed:c}))};return C(0),{calculatedDuration:null,next:O=>{let _=!1;return!k&&x===void 0&&(_=!0,A(O),C(O)),x!==void 0&&O>=x?k.next(O-x):(!_&&A(O),d)}}}const w8=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,oue=1e-7,aue=12;function lue(t,e,n,r,s){let i,o,a=0;do o=e+(n-e)/2,i=w8(o,r,s)-t,i>0?n=o:e=o;while(Math.abs(i)>oue&&++a<aue);return o}function op(t,e,n,r){if(t===e&&n===r)return Sn;const s=i=>lue(i,0,1,t,n);return i=>i===0||i===1?i:w8(s(i),e,r)}const uue=op(.42,0,1,1),cue=op(0,0,.58,1),A8=op(.42,0,.58,1),fue=t=>Array.isArray(t)&&typeof t[0]!="number",v8=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,x8=t=>e=>1-t(1-e),gk=t=>1-Math.sin(Math.acos(t)),k8=x8(gk),due=v8(gk),E8=op(.33,1.53,.69,.99),yk=x8(E8),hue=v8(yk),C8={linear:Sn,easeIn:uue,easeInOut:A8,easeOut:cue,circIn:gk,circInOut:due,circOut:k8,backIn:yk,backInOut:hue,backOut:E8,anticipate:t=>(t*=2)<1?.5*yk(t):.5*(2-Math.pow(2,-10*(t-1)))},S8=t=>{if(Array.isArray(t)){Ji(t.length===4,"Cubic bezier arrays must contain four numerical values.");const[e,n,r,s]=t;return op(e,n,r,s)}else if(typeof t=="string")return Ji(C8[t]!==void 0,`Invalid easing type '${t}'`),C8[t];return t},ap=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r},Bt=(t,e,n)=>t+(e-t)*n;function bk(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function pue({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let s=0,i=0,o=0;if(!e)s=i=o=n;else{const a=n<.5?n*(1+e):n+e-n*e,l=2*n-a;s=bk(l,a,t+1/3),i=bk(l,a,t),o=bk(l,a,t-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:r}}function Yy(t,e){return n=>n>0?e:t}const wk=(t,e,n)=>{const r=t*t,s=n*(e*e-r)+r;return s<0?0:Math.sqrt(s)},mue=[fk,jl,Yc],gue=t=>mue.find(e=>e.test(t));function T8(t){const e=gue(t);if(qc(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`),!e)return!1;let n=e.parse(t);return e===Yc&&(n=pue(n)),n}const D8=(t,e)=>{const n=T8(t),r=T8(e);if(!n||!r)return Yy(t,e);const s={...n};return i=>(s.red=wk(n.red,r.red,i),s.green=wk(n.green,r.green,i),s.blue=wk(n.blue,r.blue,i),s.alpha=Bt(n.alpha,r.alpha,i),jl.transform(s))},Ak=new Set(["none","hidden"]);function yue(t,e){return Ak.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function bue(t,e){return n=>Bt(t,e,n)}function vk(t){return typeof t=="number"?bue:typeof t=="string"?W2(t)?Yy:In.test(t)?D8:vue:Array.isArray(t)?O8:typeof t=="object"?In.test(t)?D8:wue:Yy}function O8(t,e){const n=[...t],r=n.length,s=t.map((i,o)=>vk(i)(i,e[o]));return i=>{for(let o=0;o<r;o++)n[o]=s[o](i);return n}}function wue(t,e){const n={...t,...e},r={};for(const s in n)t[s]!==void 0&&e[s]!==void 0&&(r[s]=vk(t[s])(t[s],e[s]));return s=>{for(const i in r)n[i]=r[i](s);return n}}function Aue(t,e){var n;const r=[],s={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const o=e.types[i],a=t.indexes[o][s[o]],l=(n=t.values[a])!==null&&n!==void 0?n:0;r[i]=l,s[o]++}return r}const vue=(t,e)=>{const n=fa.createTransformer(e),r=ip(t),s=ip(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?Ak.has(t)&&!s.values.length||Ak.has(e)&&!r.values.length?yue(t,e):eo(O8(Aue(r,s),s.values),n):(qc(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),Yy(t,e))};function _8(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?Bt(t,e,n):vk(t)(t,e)}function xue(t,e,n){const r=[],s=n||_8,i=t.length-1;for(let o=0;o<i;o++){let a=s(t[o],t[o+1]);if(e){const l=Array.isArray(e)?e[o]||Sn:e;a=eo(l,a)}r.push(a)}return r}function kue(t,e,{clamp:n=!0,ease:r,mixer:s}={}){const i=t.length;if(Ji(i===e.length,"Both input and output ranges must be the same length"),i===1)return()=>e[0];if(i===2&&t[0]===t[1])return()=>e[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=xue(e,r,s),a=o.length,l=u=>{let c=0;if(a>1)for(;c<t.length-2&&!(u<t[c+1]);c++);const f=ap(t[c],t[c+1],u);return o[c](f)};return n?u=>l(aa(t[0],t[i-1],u)):l}function Eue(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const s=ap(0,e,r);t.push(Bt(n,1,s))}}function Cue(t){const e=[0];return Eue(e,t.length-1),e}function Sue(t,e){return t.map(n=>n*e)}function Tue(t,e){return t.map(()=>e||A8).splice(0,t.length-1)}function Xy({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const s=fue(r)?r.map(S8):S8(r),i={done:!1,value:e[0]},o=Sue(n&&n.length===e.length?n:Cue(e),t),a=kue(o,e,{ease:Array.isArray(s)?s:Tue(e,s)});return{calculatedDuration:t,next:l=>(i.value=a(l),i.done=l>=t,i)}}const M8=2e4;function Due(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<M8;)e+=n,r=t.next(e);return e>=M8?1/0:e}const Oue=t=>{const e=({timestamp:n})=>t(n);return{start:()=>pt.update(e,!0),stop:()=>Yi(e),now:()=>Tn.isProcessing?Tn.timestamp:ca.now()}},_ue={decay:b8,inertia:b8,tween:Xy,keyframes:Xy,spring:y8},Mue=t=>t/100;class xk extends d8{constructor({KeyframeResolver:e=lk,...n}){super(n),this.holdTime=null,this.startTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:a}=this.options;a&&a()};const{name:r,motionValue:s,keyframes:i}=this.options,o=(a,l)=>this.onKeyframesResolved(a,l);r&&s&&s.owner?this.resolver=s.owner.resolveKeyframes(i,o,r,s):this.resolver=new e(i,o,r,s),this.resolver.scheduleResolve()}initPlayback(e){const{type:n="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:o=0}=this.options,a=_ue[n]||Xy;let l,u;a!==Xy&&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=eo(Mue,_8(e[0],e[1])),e=[0,100]);const c=a({...this.options,keyframes:e});i==="mirror"&&(u=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),c.calculatedDuration===null&&(c.calculatedDuration=Due(c));const{calculatedDuration:f}=c,d=f+s,h=d*(r+1)-s;return{generator:c,mirroredGenerator:u,mapPercentToKeyframes:l,calculatedDuration:f,resolvedDuration:d,totalDuration:h}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,n=!1){const{resolved:r}=this;if(!r){const{keyframes:O}=this.options;return{done:!0,value:O[O.length-1]}}const{finalKeyframe:s,generator:i,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:l,calculatedDuration:u,totalDuration:c,resolvedDuration:f}=r;if(this.startTime===null)return i.next(0);const{delay:d,repeat:h,repeatType:p,repeatDelay:m,onUpdate:g}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-c/this.speed,this.startTime)),n?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const y=this.currentTime-d*(this.speed>=0?1:-1),v=this.speed>=0?y<0:y>c;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=c);let w=this.currentTime,A=i;if(h){const O=Math.min(this.currentTime,c)/f;let _=Math.floor(O),D=O%1;!D&&O>=1&&(D=1),D===1&&_--,_=Math.min(_,h+1),!!(_%2)&&(p==="reverse"?(D=1-D,m&&(D-=m/f)):p==="mirror"&&(A=o)),w=aa(0,1,D)*f}const x=v?{done:!1,value:l[0]}:A.next(w);a&&(x.value=a(x.value));let{done:k}=x;!v&&u!==null&&(k=this.speed>=0?this.currentTime>=c:this.currentTime<=0);const C=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&k);return C&&s!==void 0&&(x.value=Qy(l,this.options,s)),g&&g(x.value),C&&this.finish(),x}get duration(){const{resolved:e}=this;return e?no(e.calculatedDuration):0}get time(){return no(this.currentTime)}set time(e){e=to(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=no(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=Oue,onPlay:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),n&&n();const r=this.driver.now();this.holdTime!==null?this.startTime=r-this.holdTime:(!this.startTime||this.state==="finished")&&(this.startTime=r),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const N8=t=>Array.isArray(t)&&typeof t[0]=="number";function R8(t){return!!(!t||typeof t=="string"&&t in kk||N8(t)||Array.isArray(t)&&t.every(R8))}const lp=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,kk={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:lp([0,.65,.55,1]),circOut:lp([.55,0,1,.45]),backIn:lp([.31,.01,.66,-.59]),backOut:lp([.33,1.53,.69,.99])};function Nue(t){return P8(t)||kk.easeOut}function P8(t){if(t)return N8(t)?lp(t):Array.isArray(t)?t.map(Nue):kk[t]}function Rue(t,e,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:o="loop",ease:a,times:l}={}){const u={[e]:n};l&&(u.offset=l);const c=P8(a);return Array.isArray(c)&&(u.easing=c),t.animate(u,{delay:r,duration:s,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"})}const Pue=c8(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Iue=new Set(["opacity","clipPath","filter","transform"]),Zy=10,Lue=2e4;function Bue(t){return t.type==="spring"||t.name==="backgroundColor"||!R8(t.ease)}function Fue(t,e){const n=new xk({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const s=[];let i=0;for(;!r.done&&i<Lue;)r=n.sample(i),s.push(r.value),i+=Zy;return{times:void 0,keyframes:s,duration:i-Zy,ease:"linear"}}class I8 extends d8{constructor(e){super(e);const{name:n,motionValue:r,keyframes:s}=this.options;this.resolver=new u8(s,(i,o)=>this.onKeyframesResolved(i,o),n,r),this.resolver.scheduleResolve()}initPlayback(e,n){var r;let{duration:s=300,times:i,ease:o,type:a,motionValue:l,name:u}=this.options;if(!(!((r=l.owner)===null||r===void 0)&&r.current))return!1;if(Bue(this.options)){const{onComplete:f,onUpdate:d,motionValue:h,...p}=this.options,m=Fue(e,p);e=m.keyframes,e.length===1&&(e[1]=e[0]),s=m.duration,i=m.times,o=m.ease,a="keyframes"}const c=Rue(l.owner.current,u,e,{...this.options,duration:s,times:i,ease:o});return c.startTime=ca.now(),this.pendingTimeline?(c.timeline=this.pendingTimeline,this.pendingTimeline=void 0):c.onfinish=()=>{const{onComplete:f}=this.options;l.set(Qy(e,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:c,duration:s,times:i,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:n}=e;return no(n)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:n}=e;return no(n.currentTime||0)}set time(e){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=to(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:n}=e;return n.playbackRate}set speed(e){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:n}=e;return n.playState}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:n}=this;if(!n)return Sn;const{animation:r}=n;r.timeline=e,r.onfinish=null}return Sn}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;const{resolved:e}=this;if(!e)return;const{animation:n,keyframes:r,duration:s,type:i,ease:o,times:a}=e;if(!(n.playState==="idle"||n.playState==="finished")){if(this.time){const{motionValue:l,onUpdate:u,onComplete:c,...f}=this.options,d=new xk({...f,keyframes:r,duration:s,type:i,ease:o,times:a,isGenerator:!0}),h=to(this.time);l.setWithVelocity(d.sample(h-Zy).value,d.sample(h).value,Zy)}this.cancel()}}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:n,name:r,repeatDelay:s,repeatType:i,damping:o,type:a}=e;return Pue()&&r&&Iue.has(r)&&n&&n.owner&&n.owner.current instanceof HTMLElement&&!n.owner.getProps().onUpdate&&!s&&i!=="mirror"&&o!==0&&a!=="inertia"}}function jue(t,e){let n;const r=()=>{const{currentTime:s}=e,o=(s===null?0:s.value)/100;n!==o&&t(o),n=o};return pt.update(r,!0),()=>Yi(r)}const Uue=c8(()=>window.ScrollTimeline!==void 0);class Vue{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,n){return Promise.all(this.animations).then(e).catch(n)}getAll(e){return this.animations[0][e]}setAll(e,n){for(let r=0;r<this.animations.length;r++)this.animations[r][e]=n}attachTimeline(e){const n=this.animations.map(r=>{if(Uue()&&r.attachTimeline)r.attachTimeline(e);else return r.pause(),jue(s=>{r.time=r.duration*s},e)});return()=>{n.forEach((r,s)=>{r&&r(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get duration(){let e=0;for(let n=0;n<this.animations.length;n++)e=Math.max(e,this.animations[n].duration);return e}runAll(e){this.animations.forEach(n=>n[e]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const Ek=(t,e,n,r={},s,i)=>o=>{const a=ik(r,t)||{},l=a.delay||r.delay||0;let{elapsed:u=0}=r;u=u-to(l);let c={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-u,onUpdate:d=>{e.set(d),a.onUpdate&&a.onUpdate(d)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:i?void 0:s};xle(a)||(c={...c,...vle(t,c)}),c.duration&&(c.duration=to(c.duration)),c.repeatDelay&&(c.repeatDelay=to(c.repeatDelay)),c.from!==void 0&&(c.keyframes[0]=c.from);let f=!1;if((c.type===!1||c.duration===0&&!c.repeatDelay)&&(c.duration=0,c.delay===0&&(f=!0)),f&&!i&&e.get()!==void 0){const d=Qy(c.keyframes,a);if(d!==void 0)return pt.update(()=>{c.onUpdate(d),c.onComplete()}),new Vue([])}return!i&&I8.supports(c)?new I8(c):new xk(c)};function eb(t){return!!(Pn(t)&&t.add)}function Ck(t,e){t.indexOf(e)===-1&&t.push(e)}function Sk(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class Tk{constructor(){this.subscriptions=[]}add(e){return Ck(this.subscriptions,e),()=>Sk(this.subscriptions,e)}notify(e,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,n,r);else for(let i=0;i<s;i++){const o=this.subscriptions[i];o&&o(e,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const L8=new Set;function Dk(t,e,n){t||L8.has(e)||(console.warn(e),L8.add(e))}const B8=30,Hue=t=>!isNaN(parseFloat(t));class zue{constructor(e,n={}){this.version="11.2.12",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{const i=ca.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),s&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=ca.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Hue(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&Dk(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new Tk);const r=this.events[e].add(n);return e==="change"?()=>{r(),pt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e,n=!0){!n||!this.passiveEffect?this.updateAndNotify(e,n):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=ca.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>B8)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,B8);return h8(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function up(t,e){return new zue(t,e)}function $ue(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,up(n))}function Gue(t,e){const n=qy(t,e);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const o in i){const a=Xae(i[o]);$ue(t,o,a)}}function F8(t){return t.getProps()[cI]}function Wue({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function j8(t,e,{delay:n=0,transitionOverride:r,type:s}={}){var i;let{transition:o=t.getDefaultTransition(),transitionEnd:a,...l}=e;const u=t.getValue("willChange");r&&(o=r);const c=[],f=s&&t.animationState&&t.animationState.getState()[s];for(const d in l){const h=t.getValue(d,(i=t.latestValues[d])!==null&&i!==void 0?i:null),p=l[d];if(p===void 0||f&&Wue(f,d))continue;const m={delay:n,elapsed:0,...ik(o||{},d)};let g=!1;if(window.HandoffAppearAnimations){const v=F8(t);if(v){const w=window.HandoffAppearAnimations(v,d,h,pt);w!==null&&(m.elapsed=w,g=!0)}}h.start(Ek(d,h,p,t.shouldReduceMotion&&Bl.has(d)?{type:!1}:m,t,g));const y=h.animation;y&&(eb(u)&&(u.add(d),y.then(()=>u.remove(d))),c.push(y))}return a&&Promise.all(c).then(()=>{pt.update(()=>{a&&Gue(t,a)})}),c}function Ok(t,e,n={}){var r;const s=qy(t,e,n.type==="exit"?(r=t.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:i=t.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const o=s?()=>Promise.all(j8(t,s,n)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(u=0)=>{const{delayChildren:c=0,staggerChildren:f,staggerDirection:d}=i;return Kue(t,e,c+u,f,d,n)}:()=>Promise.resolve(),{when:l}=i;if(l){const[u,c]=l==="beforeChildren"?[o,a]:[a,o];return u().then(()=>c())}else return Promise.all([o(),a(n.delay)])}function Kue(t,e,n=0,r=0,s=1,i){const o=[],a=(t.variantChildren.size-1)*r,l=s===1?(u=0)=>u*r:(u=0)=>a-u*r;return Array.from(t.variantChildren).sort(que).forEach((u,c)=>{u.notify("AnimationStart",e),o.push(Ok(u,e,{...i,delay:n+l(c)}).then(()=>u.notify("AnimationComplete",e)))}),Promise.all(o)}function que(t,e){return t.sortNodePosition(e)}function Que(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const s=e.map(i=>Ok(t,i,n));r=Promise.all(s)}else if(typeof e=="string")r=Ok(t,e,n);else{const s=typeof e=="function"?qy(t,e,n.custom):e;r=Promise.all(j8(t,s,n))}return r.then(()=>{pt.postRender(()=>{t.notify("AnimationComplete",e)})})}const Jue=[...H2].reverse(),Yue=H2.length;function Xue(t){return e=>Promise.all(e.map(({animation:n,options:r})=>Que(t,n,r)))}function Zue(t){let e=Xue(t),n=U8(),r=!0;const s=l=>(u,c)=>{var f;const d=qy(t,c,l==="exit"?(f=t.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(d){const{transition:h,transitionEnd:p,...m}=d;u={...u,...m,...p}}return u};function i(l){e=l(t)}function o(l){const u=t.getProps(),c=t.getVariantContext(!0)||{},f=[],d=new Set;let h={},p=1/0;for(let g=0;g<Yue;g++){const y=Jue[g],v=n[y],w=u[y]!==void 0?u[y]:c[y],A=Zh(w),x=y===l?v.isActive:null;x===!1&&(p=g);let k=w===c[y]&&w!==u[y]&&A;if(k&&r&&t.manuallyAnimateOnMount&&(k=!1),v.protectedKeys={...h},!v.isActive&&x===null||!w&&!v.prevProp||Vy(w)||typeof w=="boolean")continue;let O=ece(v.prevProp,w)||y===l&&v.isActive&&!k&&A||g>p&&A,_=!1;const D=Array.isArray(w)?w:[w];let R=D.reduce(s(y),{});x===!1&&(R={});const{prevResolvedValues:L={}}=v,F={...L,...R},G=B=>{O=!0,d.has(B)&&(_=!0,d.delete(B)),v.needsAnimating[B]=!0;const H=t.getValue(B);H&&(H.liveStyle=!1)};for(const B in F){const H=R[B],Q=L[B];if(h.hasOwnProperty(B))continue;let te=!1;ek(H)&&ek(Q)?te=!$I(H,Q):te=H!==Q,te?H!=null?G(B):d.add(B):H!==void 0&&d.has(B)?G(B):v.protectedKeys[B]=!0}v.prevProp=w,v.prevResolvedValues=R,v.isActive&&(h={...h,...R}),r&&t.blockInitialAnimation&&(O=!1),O&&(!k||_)&&f.push(...D.map(B=>({animation:B,options:{type:y}})))}if(d.size){const g={};d.forEach(y=>{const v=t.getBaseTarget(y),w=t.getValue(y);w&&(w.liveStyle=!0),g[y]=v??null}),f.push({animation:g})}let m=!!f.length;return r&&(u.initial===!1||u.initial===u.animate)&&!t.manuallyAnimateOnMount&&(m=!1),r=!1,m?e(f):Promise.resolve()}function a(l,u){var c;if(n[l].isActive===u)return Promise.resolve();(c=t.variantChildren)===null||c===void 0||c.forEach(d=>{var h;return(h=d.animationState)===null||h===void 0?void 0:h.setActive(l,u)}),n[l].isActive=u;const f=o(l);for(const d in n)n[d].protectedKeys={};return f}return{animateChanges:o,setActive:a,setAnimateFunction:i,getState:()=>n,reset:()=>{n=U8(),r=!0}}}function ece(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!$I(e,t):!1}function Ul(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function U8(){return{animate:Ul(!0),whileInView:Ul(),whileHover:Ul(),whileTap:Ul(),whileDrag:Ul(),whileFocus:Ul(),exit:Ul()}}class tce extends ua{constructor(e){super(e),e.animationState||(e.animationState=Zue(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Vy(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let nce=0;class rce extends ua{constructor(){super(...arguments),this.id=nce++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const s=this.node.animationState.setActive("exit",!e);n&&!e&&s.then(()=>n(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const sce={animation:{Feature:tce},exit:{Feature:rce}},V8=(t,e)=>Math.abs(t-e);function ice(t,e){const n=V8(t.x,e.x),r=V8(t.y,e.y);return Math.sqrt(n**2+r**2)}class H8{constructor(e,n,{transformPagePoint:r,contextWindow:s,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=Mk(this.lastMoveEventInfo,this.history),d=this.startEvent!==null,h=ice(f.offset,{x:0,y:0})>=3;if(!d&&!h)return;const{point:p}=f,{timestamp:m}=Tn;this.history.push({...p,timestamp:m});const{onStart:g,onMove:y}=this.handlers;d||(g&&g(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),y&&y(this.lastMoveEvent,f)},this.handlePointerMove=(f,d)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=_k(d,this.transformPagePoint),pt.update(this.updatePoint,!0)},this.handlePointerUp=(f,d)=>{this.end();const{onEnd:h,onSessionEnd:p,resumeAnimation:m}=this.handlers;if(this.dragSnapToOrigin&&m&&m(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const g=Mk(f.type==="pointercancel"?this.lastMoveEventInfo:_k(d,this.transformPagePoint),this.history);this.startEvent&&h&&h(f,g),p&&p(f,g)},!LI(e))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.contextWindow=s||window;const o=Ky(e),a=_k(o,this.transformPagePoint),{point:l}=a,{timestamp:u}=Tn;this.history=[{...l,timestamp:u}];const{onSessionStart:c}=n;c&&c(e,Mk(a,this.history)),this.removeListeners=eo(Zi(this.contextWindow,"pointermove",this.handlePointerMove),Zi(this.contextWindow,"pointerup",this.handlePointerUp),Zi(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Yi(this.updatePoint)}}function _k(t,e){return e?{point:e(t.point)}:t}function z8(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Mk({point:t},e){return{point:t,delta:z8(t,$8(e)),offset:z8(t,oce(e)),velocity:ace(e,.1)}}function oce(t){return t[0]}function $8(t){return t[t.length-1]}function ace(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const s=$8(t);for(;n>=0&&(r=t[n],!(s.timestamp-r.timestamp>to(e)));)n--;if(!r)return{x:0,y:0};const i=no(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const o={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function Pr(t){return t.max-t.min}function Nk(t,e=0,n=.01){return Math.abs(t-e)<=n}function G8(t,e,n,r=.5){t.origin=r,t.originPoint=Bt(e.min,e.max,t.origin),t.scale=Pr(n)/Pr(e),(Nk(t.scale,1,1e-4)||isNaN(t.scale))&&(t.scale=1),t.translate=Bt(n.min,n.max,t.origin)-t.originPoint,(Nk(t.translate)||isNaN(t.translate))&&(t.translate=0)}function cp(t,e,n,r){G8(t.x,e.x,n.x,r?r.originX:void 0),G8(t.y,e.y,n.y,r?r.originY:void 0)}function W8(t,e,n){t.min=n.min+e.min,t.max=t.min+Pr(e)}function lce(t,e,n){W8(t.x,e.x,n.x),W8(t.y,e.y,n.y)}function K8(t,e,n){t.min=e.min-n.min,t.max=t.min+Pr(e)}function fp(t,e,n){K8(t.x,e.x,n.x),K8(t.y,e.y,n.y)}function uce(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?Bt(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?Bt(n,t,r.max):Math.min(t,n)),t}function q8(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function cce(t,{top:e,left:n,bottom:r,right:s}){return{x:q8(t.x,n,s),y:q8(t.y,e,r)}}function Q8(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}function fce(t,e){return{x:Q8(t.x,e.x),y:Q8(t.y,e.y)}}function dce(t,e){let n=.5;const r=Pr(t),s=Pr(e);return s>r?n=ap(e.min,e.max-r,t.min):r>s&&(n=ap(t.min,t.max-s,e.min)),aa(0,1,n)}function hce(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const Rk=.35;function pce(t=Rk){return t===!1?t=0:t===!0&&(t=Rk),{x:J8(t,"left","right"),y:J8(t,"top","bottom")}}function J8(t,e,n){return{min:Y8(t,e),max:Y8(t,n)}}function Y8(t,e){return typeof t=="number"?t:t[e]||0}const X8=()=>({translate:0,scale:1,origin:0,originPoint:0}),Xc=()=>({x:X8(),y:X8()}),Z8=()=>({min:0,max:0}),qt=()=>({x:Z8(),y:Z8()});function es(t){return[t("x"),t("y")]}function eL({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function mce({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function gce(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Pk(t){return t===void 0||t===1}function Ik({scale:t,scaleX:e,scaleY:n}){return!Pk(t)||!Pk(e)||!Pk(n)}function Vl(t){return Ik(t)||tL(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function tL(t){return nL(t.x)||nL(t.y)}function nL(t){return t&&t!=="0%"}function tb(t,e,n){const r=t-n,s=e*r;return n+s}function rL(t,e,n,r,s){return s!==void 0&&(t=tb(t,s,r)),tb(t,n,r)+e}function Lk(t,e=0,n=1,r,s){t.min=rL(t.min,e,n,r,s),t.max=rL(t.max,e,n,r,s)}function sL(t,{x:e,y:n}){Lk(t.x,e.translate,e.scale,e.originPoint),Lk(t.y,n.translate,n.scale,n.originPoint)}function yce(t,e,n,r=!1){const s=n.length;if(!s)return;e.x=e.y=1;let i,o;for(let a=0;a<s;a++){i=n[a],o=i.projectionDelta;const l=i.instance;l&&l.style&&l.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&Zc(t,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,sL(t,o)),r&&Vl(i.latestValues)&&Zc(t,i.latestValues))}e.x=iL(e.x),e.y=iL(e.y)}function iL(t){return Number.isInteger(t)||t>1.0000000000001||t<.999999999999?t:1}function da(t,e){t.min=t.min+e,t.max=t.max+e}function oL(t,e,[n,r,s]){const i=e[s]!==void 0?e[s]:.5,o=Bt(t.min,t.max,i);Lk(t,e[n],e[r],o,e.scale)}const bce=["x","scaleX","originX"],wce=["y","scaleY","originY"];function Zc(t,e){oL(t.x,e,bce),oL(t.y,e,wce)}function aL(t,e){return eL(gce(t.getBoundingClientRect(),e))}function Ace(t,e,n){const r=aL(t,n),{scroll:s}=e;return s&&(da(r.x,s.offset.x),da(r.y,s.offset.y)),r}const lL=({current:t})=>t?t.ownerDocument.defaultView:null,vce=new WeakMap;class xce{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=qt(),this.visualElement=e}start(e,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=c=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Ky(c,"page").point)},i=(c,f)=>{const{drag:d,dragPropagation:h,onDragStart:p}=this.getProps();if(d&&!h&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=UI(d),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),es(g=>{let y=this.getAxisMotionValue(g).get()||0;if(di.test(y)){const{projection:v}=this.visualElement;if(v&&v.layout){const w=v.layout.layoutBox[g];w&&(y=Pr(w)*(parseFloat(y)/100))}}this.originPoint[g]=y}),p&&pt.postRender(()=>p(c,f));const{animationState:m}=this.visualElement;m&&m.setActive("whileDrag",!0)},o=(c,f)=>{const{dragPropagation:d,dragDirectionLock:h,onDirectionLock:p,onDrag:m}=this.getProps();if(!d&&!this.openGlobalLock)return;const{offset:g}=f;if(h&&this.currentDirection===null){this.currentDirection=kce(g),this.currentDirection!==null&&p&&p(this.currentDirection);return}this.updateAxis("x",f.point,g),this.updateAxis("y",f.point,g),this.visualElement.render(),m&&m(c,f)},a=(c,f)=>this.stop(c,f),l=()=>es(c=>{var f;return this.getAnimationState(c)==="paused"&&((f=this.getAxisMotionValue(c).animation)===null||f===void 0?void 0:f.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new H8(e,{onSessionStart:s,onStart:i,onMove:o,onSessionEnd:a,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:lL(this.visualElement)})}stop(e,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=n;this.startAnimation(s);const{onDragEnd:i}=this.getProps();i&&pt.postRender(()=>i(e,n))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,r){const{drag:s}=this.getProps();if(!r||!nb(e,s,this.currentDirection))return;const i=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=uce(o,this.constraints[e],this.elastic[e])),i.set(o)}resolveConstraints(){var e;const{dragConstraints:n,dragElastic:r}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,i=this.constraints;n&&Wc(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&s?this.constraints=cce(s.layoutBox,n):this.constraints=!1,this.elastic=pce(r),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&es(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=hce(s.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!Wc(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=Ace(r,s.root,this.visualElement.getTransformPagePoint());let o=fce(s.layout.layoutBox,i);if(n){const a=n(mce(o));this.hasMutatedConstraints=!!a,a&&(o=eL(a))}return o}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},u=es(c=>{if(!nb(c,n,this.currentDirection))return;let f=l&&l[c]||{};o&&(f={min:0,max:0});const d=s?200:1e6,h=s?40:1e7,p={type:"inertia",velocity:r?e[c]:0,bounceStiffness:d,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...i,...f};return this.startAxisValueAnimation(c,p)});return Promise.all(u).then(a)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return r.start(Ek(e,r,0,n,this.visualElement))}stopAnimation(){es(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){es(e=>{var n;return(n=this.getAxisMotionValue(e).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(e){var n;return(n=this.getAxisMotionValue(e).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){es(n=>{const{drag:r}=this.getProps();if(!nb(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:o,max:a}=s.layout.layoutBox[n];i.set(e[n]-Bt(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Wc(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};es(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const l=a.get();s[o]=dce({min:l,max:l},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),es(o=>{if(!nb(o,e,null))return;const a=this.getAxisMotionValue(o),{min:l,max:u}=this.constraints[o];a.set(Bt(l,u,s[o]))})}addListeners(){if(!this.visualElement.current)return;vce.set(this.visualElement,this);const e=this.visualElement.current,n=Zi(e,"pointerdown",l=>{const{drag:u,dragListener:c=!0}=this.getProps();u&&c&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();Wc(l)&&l.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),pt.read(r);const o=Xi(window,"resize",()=>this.scalePositionWithinConstraints()),a=s.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(es(c=>{const f=this.getAxisMotionValue(c);f&&(this.originPoint[c]+=l[c].translate,f.set(f.get()+l[c].translate))}),this.visualElement.render())});return()=>{o(),n(),i(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=Rk,dragMomentum:a=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:a}}}function nb(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function kce(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class Ece extends ua{constructor(e){super(e),this.removeGroupControls=Sn,this.removeListeners=Sn,this.controls=new xce(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Sn}unmount(){this.removeGroupControls(),this.removeListeners()}}const uL=t=>(e,n)=>{t&&pt.postRender(()=>t(e,n))};class Cce extends ua{constructor(){super(...arguments),this.removePointerDownListener=Sn}onPointerDown(e){this.session=new H8(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:lL(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:uL(e),onStart:uL(n),onMove:r,onEnd:(i,o)=>{delete this.session,s&&pt.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=Zi(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 Sce(){const t=N.useContext(jy);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:n,register:r}=t,s=N.useId();return N.useEffect(()=>r(s),[]),!e&&n?[!1,()=>n&&n(s)]:[!0]}const rb={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function cL(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const dp={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(Ie.test(t))t=parseFloat(t);else return t;const n=cL(t,e.target.x),r=cL(t,e.target.y);return`${n}% ${r}%`}},Tce={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,s=fa.parse(t);if(s.length>5)return r;const i=fa.createTransformer(t),o=typeof s[0]!="number"?1:0,a=n.x.scale*e.x,l=n.y.scale*e.y;s[0+o]/=a,s[1+o]/=l;const u=Bt(a,l,.5);return typeof s[2+o]=="number"&&(s[2+o]/=u),typeof s[3+o]=="number"&&(s[3+o]/=u),i(s)}};class Dce extends N.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=e;Dae(Oce),i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),rb.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,o=r.projection;return o&&(o.isPresent=i,s||e.layoutDependency!==n||n===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?o.promote():o.relegate()||pt.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),V2.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=e;s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function fL(t){const[e,n]=Sce(),r=N.useContext($2);return S.jsx(Dce,{...t,layoutGroup:r,switchLayoutGroup:N.useContext(hI),isPresent:e,safeToRemove:n})}const Oce={borderRadius:{...dp,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:dp,borderTopRightRadius:dp,borderBottomLeftRadius:dp,borderBottomRightRadius:dp,boxShadow:Tce},dL=["TopLeft","TopRight","BottomLeft","BottomRight"],_ce=dL.length,hL=t=>typeof t=="string"?parseFloat(t):t,pL=t=>typeof t=="number"||Ie.test(t);function Mce(t,e,n,r,s,i){s?(t.opacity=Bt(0,n.opacity!==void 0?n.opacity:1,Nce(r)),t.opacityExit=Bt(e.opacity!==void 0?e.opacity:1,0,Rce(r))):i&&(t.opacity=Bt(e.opacity!==void 0?e.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let o=0;o<_ce;o++){const a=`border${dL[o]}Radius`;let l=mL(e,a),u=mL(n,a);if(l===void 0&&u===void 0)continue;l||(l=0),u||(u=0),l===0||u===0||pL(l)===pL(u)?(t[a]=Math.max(Bt(hL(l),hL(u),r),0),(di.test(u)||di.test(l))&&(t[a]+="%")):t[a]=u}(e.rotate||n.rotate)&&(t.rotate=Bt(e.rotate||0,n.rotate||0,r))}function mL(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const Nce=gL(0,.5,k8),Rce=gL(.5,.95,Sn);function gL(t,e,n){return r=>r<t?0:r>e?1:n(ap(t,e,r))}function yL(t,e){t.min=e.min,t.max=e.max}function ts(t,e){yL(t.x,e.x),yL(t.y,e.y)}function bL(t,e,n,r,s){return t-=e,t=tb(t,1/n,r),s!==void 0&&(t=tb(t,1/s,r)),t}function Pce(t,e=0,n=1,r=.5,s,i=t,o=t){if(di.test(e)&&(e=parseFloat(e),e=Bt(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Bt(i.min,i.max,r);t===i&&(a-=e),t.min=bL(t.min,e,n,a,s),t.max=bL(t.max,e,n,a,s)}function wL(t,e,[n,r,s],i,o){Pce(t,e[n],e[r],e[s],e.scale,i,o)}const Ice=["x","scaleX","originX"],Lce=["y","scaleY","originY"];function AL(t,e,n,r){wL(t.x,e,Ice,n?n.x:void 0,r?r.x:void 0),wL(t.y,e,Lce,n?n.y:void 0,r?r.y:void 0)}function vL(t){return t.translate===0&&t.scale===1}function xL(t){return vL(t.x)&&vL(t.y)}function Bce(t,e){return t.x.min===e.x.min&&t.x.max===e.x.max&&t.y.min===e.y.min&&t.y.max===e.y.max}function kL(t,e){return Math.round(t.x.min)===Math.round(e.x.min)&&Math.round(t.x.max)===Math.round(e.x.max)&&Math.round(t.y.min)===Math.round(e.y.min)&&Math.round(t.y.max)===Math.round(e.y.max)}function EL(t){return Pr(t.x)/Pr(t.y)}class Fce{constructor(){this.members=[]}add(e){Ck(this.members,e),e.scheduleRender()}remove(e){if(Sk(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(s=>e===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(e,n){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender(),e.resumeFrom=r,n&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:s}=e.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:r}=e;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function CL(t,e,n){let r="";const s=t.x.translate/e.x,i=t.y.translate/e.y,o=(n==null?void 0:n.z)||0;if((s||i||o)&&(r=`translate3d(${s}px, ${i}px, ${o}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:u,rotate:c,rotateX:f,rotateY:d,skewX:h,skewY:p}=n;u&&(r=`perspective(${u}px) ${r}`),c&&(r+=`rotate(${c}deg) `),f&&(r+=`rotateX(${f}deg) `),d&&(r+=`rotateY(${d}deg) `),h&&(r+=`skewX(${h}deg) `),p&&(r+=`skewY(${p}deg) `)}const a=t.x.scale*e.x,l=t.y.scale*e.y;return(a!==1||l!==1)&&(r+=`scale(${a}, ${l})`),r||"none"}const jce=(t,e)=>t.depth-e.depth;class Uce{constructor(){this.children=[],this.isDirty=!1}add(e){Ck(this.children,e),this.isDirty=!0}remove(e){Sk(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(jce),this.isDirty=!1,this.children.forEach(e)}}function Vce(t,e){const n=ca.now(),r=({timestamp:s})=>{const i=s-n;i>=e&&(Yi(r),t(i-e))};return pt.read(r,!0),()=>Yi(r)}function Hce(t){window.MotionDebug&&window.MotionDebug.record(t)}function zce(t){return t instanceof SVGElement&&t.tagName!=="svg"}function $ce(t,e,n){const r=Pn(t)?t:up(t);return r.start(Ek("",r,e,n)),r.animation}const Bk=["","X","Y","Z"],Gce={visibility:"hidden"},SL=1e3;let Wce=0;const Hl={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function Fk(t,e,n,r){const{latestValues:s}=e;s[t]&&(n[t]=s[t],e.setStaticValue(t,0),r&&(r[t]=0))}function TL(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return!1;const{visualElement:e}=t.options;return e?F8(e)?!0:t.parent&&!t.parent.hasCheckedOptimisedAppear?TL(t.parent):!1:!1}function DL({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},a=e==null?void 0:e()){this.id=Wce++,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,Hl.totalNodes=Hl.resolvedTargetDeltas=Hl.recalculatedProjection=0,this.nodes.forEach(Qce),this.nodes.forEach(efe),this.nodes.forEach(tfe),this.nodes.forEach(Jce),Hce(Hl)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new Uce)}addEventListener(o,a){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new Tk),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=zce(o),this.instance=o;const{layoutId:l,layout:u,visualElement:c}=this.options;if(c&&!c.current&&c.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),a&&(u||l)&&(this.isLayoutDirty=!0),t){let f;const d=()=>this.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=Vce(d,250),rb.hasAnimatedSinceResize&&(rb.hasAnimatedSinceResize=!1,this.nodes.forEach(_L))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&c&&(l||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:d,hasRelativeTargetChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||c.getDefaultTransition()||ofe,{onLayoutAnimationStart:g,onLayoutAnimationComplete:y}=c.getProps(),v=!this.targetLayout||!kL(this.targetLayout,p)||h,w=!d&&h;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||w||d&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,w);const A={...ik(m,"layout"),onPlay:g,onComplete:y};(c.shouldReduceMotion||this.options.layoutRoot)&&(A.delay=0,A.type=!1),this.startAnimation(A)}else d||_L(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,Yi(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(nfe),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&&TL(this)&&window.HandoffCancelAllAnimations(),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let c=0;c<this.path.length;c++){const f=this.path[c];f.shouldResetTransform=!0,f.updateScroll("snapshot"),f.options.layoutRoot&&f.willUpdate(!1)}const{layoutId:a,layout:l}=this.options;if(a===void 0&&!l)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(OL);return}this.isUpdating||this.nodes.forEach(Xce),this.isUpdating=!1,this.nodes.forEach(Zce),this.nodes.forEach(Kce),this.nodes.forEach(qce),this.clearAllSnapshots();const a=ca.now();Tn.delta=aa(0,1e3/60,a-Tn.timestamp),Tn.timestamp=a,Tn.isProcessing=!0,tk.update.process(Tn),tk.preRender.process(Tn),tk.render.process(Tn),Tn.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,V2.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Yce),this.sharedNodes.forEach(rfe)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,pt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){pt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=qt(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let a=!!(this.options.layoutScroll&&this.instance);this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(a=!1),a&&(this.scroll={animationId:this.root.animationId,phase:o,isRoot:r(this.instance),offset:n(this.instance)})}resetTransform(){if(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!xL(this.projectionDelta),l=this.getTransformTemplate(),u=l?l(this.latestValues,""):void 0,c=u!==this.prevTransformTemplateValue;o&&(a||Vl(this.latestValues)||c)&&(s(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const a=this.measurePageBox();let l=this.removeElementScroll(a);return o&&(l=this.removeTransform(l)),afe(l),{animationId:this.root.animationId,measuredBox:a,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:o}=this.options;if(!o)return qt();const a=o.measureViewportBox(),{scroll:l}=this.root;return l&&(da(a.x,l.offset.x),da(a.y,l.offset.y)),a}removeElementScroll(o){const a=qt();ts(a,o);for(let l=0;l<this.path.length;l++){const u=this.path[l],{scroll:c,options:f}=u;if(u!==this.root&&c&&f.layoutScroll){if(c.isRoot){ts(a,o);const{scroll:d}=this.root;d&&(da(a.x,-d.offset.x),da(a.y,-d.offset.y))}da(a.x,c.offset.x),da(a.y,c.offset.y)}}return a}applyTransform(o,a=!1){const l=qt();ts(l,o);for(let u=0;u<this.path.length;u++){const c=this.path[u];!a&&c.options.layoutScroll&&c.scroll&&c!==c.root&&Zc(l,{x:-c.scroll.offset.x,y:-c.scroll.offset.y}),Vl(c.latestValues)&&Zc(l,c.latestValues)}return Vl(this.latestValues)&&Zc(l,this.latestValues),l}removeTransform(o){const a=qt();ts(a,o);for(let l=0;l<this.path.length;l++){const u=this.path[l];if(!u.instance||!Vl(u.latestValues))continue;Ik(u.latestValues)&&u.updateSnapshot();const c=qt(),f=u.measurePageBox();ts(c,f),AL(a,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,c)}return Vl(this.latestValues)&&AL(a,this.latestValues),a}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Tn.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var a;const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const u=!!this.resumingFrom||this!==l;if(!(o||u&&this.isSharedProjectionDirty||this.isProjectionDirty||!((a=this.parent)===null||a===void 0)&&a.isProjectionDirty||this.attemptToResolveRelativeTarget))return;const{layout:f,layoutId:d}=this.options;if(!(!this.layout||!(f||d))){if(this.resolvedRelativeTargetAt=Tn.timestamp,!this.targetDelta&&!this.relativeTarget){const h=this.getClosestProjectingParent();h&&h.layout&&this.animationProgress!==1?(this.relativeParent=h,this.forceRelativeParentToResolveTarget(),this.relativeTarget=qt(),this.relativeTargetOrigin=qt(),fp(this.relativeTargetOrigin,this.layout.layoutBox,h.layout.layoutBox),ts(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=qt(),this.targetWithTransforms=qt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),lce(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):ts(this.target,this.layout.layoutBox),sL(this.target,this.targetDelta)):ts(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const h=this.getClosestProjectingParent();h&&!!h.resumingFrom==!!this.resumingFrom&&!h.options.layoutScroll&&h.target&&this.animationProgress!==1?(this.relativeParent=h,this.forceRelativeParentToResolveTarget(),this.relativeTarget=qt(),this.relativeTargetOrigin=qt(),fp(this.relativeTargetOrigin,this.target,h.target),ts(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Hl.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||Ik(this.parent.latestValues)||tL(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var o;const a=this.getLead(),l=!!this.resumingFrom||this!==a;let u=!0;if((this.isProjectionDirty||!((o=this.parent)===null||o===void 0)&&o.isProjectionDirty)&&(u=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(u=!1),this.resolvedRelativeTargetAt===Tn.timestamp&&(u=!1),u)return;const{layout:c,layoutId:f}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(c||f))return;ts(this.layoutCorrected,this.layout.layoutBox);const d=this.treeScale.x,h=this.treeScale.y;yce(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=qt());const{target:p}=a;if(!p){this.projectionTransform&&(this.projectionDelta=Xc(),this.projectionTransform="none",this.scheduleRender());return}this.projectionDelta||(this.projectionDelta=Xc(),this.projectionDeltaWithTransform=Xc());const m=this.projectionTransform;cp(this.projectionDelta,this.layoutCorrected,p,this.latestValues),this.projectionTransform=CL(this.projectionDelta,this.treeScale),(this.projectionTransform!==m||this.treeScale.x!==d||this.treeScale.y!==h)&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",p)),Hl.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){if(this.options.scheduleRender&&this.options.scheduleRender(),o){const a=this.getStack();a&&a.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}setAnimationOrigin(o,a=!1){const l=this.snapshot,u=l?l.latestValues:{},c={...this.latestValues},f=Xc();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const d=qt(),h=l?l.source:void 0,p=this.layout?this.layout.source:void 0,m=h!==p,g=this.getStack(),y=!g||g.members.length<=1,v=!!(m&&!y&&this.options.crossfade===!0&&!this.path.some(ife));this.animationProgress=0;let w;this.mixTargetDelta=A=>{const x=A/1e3;ML(f.x,o.x,x),ML(f.y,o.y,x),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(fp(d,this.layout.layoutBox,this.relativeParent.layout.layoutBox),sfe(this.relativeTarget,this.relativeTargetOrigin,d,x),w&&Bce(this.relativeTarget,w)&&(this.isProjectionDirty=!1),w||(w=qt()),ts(w,this.relativeTarget)),m&&(this.animationValues=c,Mce(c,u,this.latestValues,x,v,y)),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&&(Yi(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=pt.update(()=>{rb.hasAnimatedSinceResize=!0,this.currentAnimation=$ce(0,SL,{...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(SL),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:u,latestValues:c}=o;if(!(!a||!l||!u)){if(this!==o&&this.layout&&u&&LL(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||qt();const f=Pr(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+f;const d=Pr(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+d}ts(a,l),Zc(a,c),cp(this.projectionDeltaWithTransform,this.layoutCorrected,a,c)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new Fce),this.sharedNodes.get(o).add(a);const u=a.options.initialPromotionConfig;a.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const u={};l.z&&Fk("z",o,u,this.animationValues);for(let c=0;c<Bk.length;c++)Fk(`rotate${Bk[c]}`,o,u,this.animationValues),Fk(`skew${Bk[c]}`,o,u,this.animationValues);o.render();for(const c in u)o.setStaticValue(c,u[c]),this.animationValues&&(this.animationValues[c]=u[c]);o.scheduleRender()}getProjectionStyles(o){var a,l;if(!this.instance||this.isSVG)return;if(!this.isVisible)return Gce;const u={visibility:""},c=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,u.opacity="",u.pointerEvents=Wy(o==null?void 0:o.pointerEvents)||"",u.transform=c?c(this.latestValues,""):"none",u;const f=this.getLead();if(!this.projectionDelta||!this.layout||!f.target){const m={};return this.options.layoutId&&(m.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,m.pointerEvents=Wy(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!Vl(this.latestValues)&&(m.transform=c?c({},""):"none",this.hasProjected=!1),m}const d=f.animationValues||f.latestValues;this.applyTransformsToTarget(),u.transform=CL(this.projectionDeltaWithTransform,this.treeScale,d),c&&(u.transform=c(d,u.transform));const{x:h,y:p}=this.projectionDelta;u.transformOrigin=`${h.origin*100}% ${p.origin*100}% 0`,f.animationValues?u.opacity=f===this?(l=(a=d.opacity)!==null&&a!==void 0?a:this.latestValues.opacity)!==null&&l!==void 0?l:1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:u.opacity=f===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const m in zy){if(d[m]===void 0)continue;const{correct:g,applyTo:y}=zy[m],v=u.transform==="none"?d[m]:g(d[m],f);if(y){const w=y.length;for(let A=0;A<w;A++)u[y[A]]=v}else u[m]=v}return this.options.layoutId&&(u.pointerEvents=f===this?Wy(o==null?void 0:o.pointerEvents)||"":"none"),u}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(OL),this.root.sharedNodes.clear()}}}function Kce(t){t.updateLayout()}function qce(t){var e;const n=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&n&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=t.layout,{animationType:i}=t.options,o=n.source!==t.layout.source;i==="size"?es(f=>{const d=o?n.measuredBox[f]:n.layoutBox[f],h=Pr(d);d.min=r[f].min,d.max=d.min+h}):LL(i,n.layoutBox,r)&&es(f=>{const d=o?n.measuredBox[f]:n.layoutBox[f],h=Pr(r[f]);d.max=d.min+h,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[f].max=t.relativeTarget[f].min+h)});const a=Xc();cp(a,r,n.layoutBox);const l=Xc();o?cp(l,t.applyTransform(s,!0),n.measuredBox):cp(l,r,n.layoutBox);const u=!xL(a);let c=!1;if(!t.resumeFrom){const f=t.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:d,layout:h}=f;if(d&&h){const p=qt();fp(p,n.layoutBox,d.layoutBox);const m=qt();fp(m,r,h.layoutBox),kL(p,m)||(c=!0),f.options.layoutRoot&&(t.relativeTarget=m,t.relativeTargetOrigin=p,t.relativeParent=f)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:l,layoutDelta:a,hasLayoutChanged:u,hasRelativeTargetChanged:c})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function Qce(t){Hl.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function Jce(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Yce(t){t.clearSnapshot()}function OL(t){t.clearMeasurements()}function Xce(t){t.isLayoutDirty=!1}function Zce(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function _L(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function efe(t){t.resolveTargetDelta()}function tfe(t){t.calcProjection()}function nfe(t){t.resetSkewAndRotation()}function rfe(t){t.removeLeadSnapshot()}function ML(t,e,n){t.translate=Bt(e.translate,0,n),t.scale=Bt(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function NL(t,e,n,r){t.min=Bt(e.min,n.min,r),t.max=Bt(e.max,n.max,r)}function sfe(t,e,n,r){NL(t.x,e.x,n.x,r),NL(t.y,e.y,n.y,r)}function ife(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const ofe={duration:.45,ease:[.4,0,.1,1]},RL=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),PL=RL("applewebkit/")&&!RL("chrome/")?Math.round:Sn;function IL(t){t.min=PL(t.min),t.max=PL(t.max)}function afe(t){IL(t.x),IL(t.y)}function LL(t,e,n){return t==="position"||t==="preserve-aspect"&&!Nk(EL(e),EL(n),.2)}const lfe=DL({attachResizeListener:(t,e)=>Xi(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),jk={current:void 0},BL=DL({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!jk.current){const t=new lfe({});t.mount(window),t.setOptions({layoutScroll:!0}),jk.current=t}return jk.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),ufe={pan:{Feature:Cce},drag:{Feature:Ece,ProjectionNode:BL,MeasureLayout:fL}},Uk={current:null},FL={current:!1};function cfe(){if(FL.current=!0,!!F2)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Uk.current=t.matches;t.addListener(e),e()}else Uk.current=!1}function ffe(t,e,n){const{willChange:r}=e;for(const s in e){const i=e[s],o=n[s];if(Pn(i))t.addValue(s,i),eb(r)&&r.add(s),process.env.NODE_ENV==="development"&&Dk(i.version==="11.2.12",`Attempting to mix Framer Motion versions ${i.version} with 11.2.12 may not work as expected.`);else if(Pn(o))t.addValue(s,up(i,{owner:t})),eb(r)&&r.remove(s);else if(o!==i)if(t.hasValue(s)){const a=t.getValue(s);a.liveStyle===!0?a.jump(i):a.hasAnimated||a.set(i)}else{const a=t.getStaticValue(s);t.addValue(s,up(a!==void 0?a:i,{owner:t}))}}for(const s in n)e[s]===void 0&&t.removeValue(s);return e}const jL=new WeakMap,dfe=[...XI,In,fa],hfe=t=>dfe.find(YI(t)),UL=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],pfe=z2.length;class mfe{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:i,visualState:o},a={}){this.resolveKeyframes=(d,h,p,m)=>new this.KeyframeResolver(d,h,p,m,this),this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=lk,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>pt.render(this.render,!1,!0);const{latestValues:l,renderState:u}=o;this.latestValues=l,this.baseTarget={...l},this.initialValues=n.initial?{...l}:{},this.renderState=u,this.parent=e,this.props=n,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.options=a,this.blockInitialAnimation=!!i,this.isControllingVariants=Hy(n),this.isVariantNode=gI(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:c,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const d in f){const h=f[d];l[d]!==void 0&&Pn(h)&&(h.set(l[d],!1),eb(c)&&c.add(d))}}mount(e){this.current=e,jL.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),FL.current||cfe(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Uk.current,process.env.NODE_ENV!=="production"&&Dk(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(){jL.delete(this.current),this.projection&&this.projection.unmount(),Yi(this.notifyUpdate),Yi(this.render),this.valueSubscriptions.forEach(e=>e()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(e,n){const r=Bl.has(e),s=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&pt.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),i=n.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(e,()=>{s(),i(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Kc){const n=Kc[e];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[e]&&s&&r(this.props)&&(this.features[e]=new s(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):qt()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<UL.length;r++){const s=UL[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=ffe(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}getVariantContext(e=!1){if(e)return this.parent?this.parent.getVariantContext():void 0;if(!this.isControllingVariants){const r=this.parent?this.parent.getVariantContext()||{}:{};return this.props.initial!==void 0&&(r.initial=this.props.initial),r}const n={};for(let r=0;r<pfe;r++){const s=z2[r],i=this.props[s];(Zh(i)||i===!1)&&(n[s]=i)}return n}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const r=this.values.get(e);n!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&n!==void 0&&(r=up(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){var r;let s=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(r=this.getBaseTargetFromProps(this.props,e))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,e,this.options);return s!=null&&(typeof s=="string"&&(WI(s)||GI(s))?s=parseFloat(s):!hfe(s)&&fa.test(n)&&(s=l8(e,n)),this.setBaseTarget(e,Pn(s)?s.get():s)),Pn(s)?s.get():s}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var n;const{initial:r}=this.props;let s;if(typeof r=="string"||typeof r=="object"){const o=Z2(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);o&&(s=o[e])}if(r&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,e);return i!==void 0&&!Pn(i)?i:this.initialValues[e]!==void 0&&s===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new Tk),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}}class VL extends mfe{constructor(){super(...arguments),this.KeyframeResolver=u8}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:r}){delete n[e],delete r[e]}}function gfe(t){return window.getComputedStyle(t)}class yfe extends VL{constructor(){super(...arguments),this.type="html"}readValueFromInstance(e,n){if(Bl.has(n)){const r=hk(n);return r&&r.default||0}else{const r=gfe(e),s=(vI(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:n}){return aL(e,n)}build(e,n,r,s){q2(e,n,r,s.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return X2(e,n,r)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Pn(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}renderInstance(e,n,r,s){OI(e,n,r,s)}}class bfe extends VL{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Bl.has(n)){const r=hk(n);return r&&r.default||0}return n=_I.has(n)?n:U2(n),e.getAttribute(n)}measureInstanceViewportBox(){return qt()}scrapeMotionValuesFromProps(e,n,r){return NI(e,n,r)}build(e,n,r,s){J2(e,n,r,this.isSVGTag,s.transformTemplate)}renderInstance(e,n,r,s){MI(e,n,r,s)}mount(e){this.isSVGTag=Y2(e.tagName),super.mount(e)}}const wfe=(t,e)=>G2(t)?new bfe(e,{enableHardwareAcceleration:!1}):new yfe(e,{allowProjection:t!==N.Fragment,enableHardwareAcceleration:!0}),Afe={...sce,...gle,...ufe,...{layout:{ProjectionNode:BL,MeasureLayout:fL}}},vfe=Sae((t,e)=>rle(t,e,Afe,wfe));function HL(){const t=N.useRef(!1);return j2(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function xfe(){const t=HL(),[e,n]=N.useState(0),r=N.useCallback(()=>{t.current&&n(e+1)},[e]);return[N.useCallback(()=>pt.postRender(r),[r]),e]}class kfe extends V.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function Efe({children:t,isPresent:e}){const n=N.useId(),r=N.useRef(null),s=N.useRef({width:0,height:0,top:0,left:0}),{nonce:i}=N.useContext(B2);return N.useInsertionEffect(()=>{const{width:o,height:a,top:l,left:u}=s.current;if(e||!r.current||!o||!a)return;r.current.dataset.motionPopId=n;const c=document.createElement("style");return i&&(c.nonce=i),document.head.appendChild(c),c.sheet&&c.sheet.insertRule(`
516
516
  [data-motion-pop-id="${n}"] {
517
517
  position: absolute !important;
518
518
  width: ${o}px !important;