@powerhousedao/connect 6.0.0-dev.14 → 6.0.0-dev.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/assets/{AddDriveModal-CdO7bn3v.js → AddDriveModal-qEnuBO_x.js} +1 -1
  2. package/dist/assets/ClearStorageModal-C-jQAs02.js +1 -0
  3. package/dist/assets/CookiesPolicyModal-C2paP1mB.js +1 -0
  4. package/dist/assets/CreateDocumentModal-RAQMk5HC.js +1 -0
  5. package/dist/assets/{DebugSettingsModal-DDhbtnTJ.js → DebugSettingsModal-CT0Y_y3S.js} +1 -1
  6. package/dist/assets/{DeleteDriveModal-CCys4Xug.js → DeleteDriveModal-CwrQtSlk.js} +1 -1
  7. package/dist/assets/DeleteItemModal-CsX6EyD3.js +1 -0
  8. package/dist/assets/{DisclaimerModal-B6mOULsM.js → DisclaimerModal-D-UKOYjV.js} +1 -1
  9. package/dist/assets/DriveSettingsModal-CVwoXZ33.js +1 -0
  10. package/dist/assets/{ExportDocumentWithErrorsModal-Dw8uNeOX.js → ExportDocumentWithErrorsModal-BMnWEsAG.js} +1 -1
  11. package/dist/assets/{SettingsModal-xfAWiRI0.js → SettingsModal-CVtu0vMc.js} +1 -1
  12. package/dist/assets/{UpgradeDriveModal-DV6zwMol.js → UpgradeDriveModal-k1kHvjgE.js} +1 -1
  13. package/dist/assets/{design_system-IWZk5eiE.js → design_system-OamFlF5e.js} +2 -2
  14. package/dist/assets/{design_system_connect-BwXoX_zu.js → design_system_connect-DiR-4e0Y.js} +33 -33
  15. package/dist/assets/{design_system_ui-DSdkJYwh.js → design_system_ui-C91aaCcj.js} +1 -1
  16. package/dist/assets/{document_engineering-BXIkRAQ4.js → document_engineering-Cvoj_Gxy.js} +1 -1
  17. package/dist/assets/{document_model_editor-bjkSCbVR.js → document_model_editor-QUld_aUx.js} +5 -5
  18. package/dist/assets/{drive_explorer-CHwbHSwK.js → drive_explorer-BFislAzR.js} +2 -2
  19. package/dist/assets/{graphql-editor-BUXhhUBs.js → graphql-editor-BQ6BXaXq.js} +1 -1
  20. package/dist/assets/{hooks-CBZDlj3_.js → hooks-DhpARCZV.js} +1 -1
  21. package/dist/assets/{index-DxBII4B2.js → index-CAv1ewUf.js} +3 -3
  22. package/dist/assets/index-KvbX0WxU.js +18 -0
  23. package/dist/assets/{json-editor-COS1W6K2.js → json-editor-Bgr9t_-i.js} +1 -1
  24. package/dist/assets/{nodefs-AJuGHwpT.js → nodefs-DDYpZiCJ.js} +1 -1
  25. package/dist/assets/{opfs-ahp-C00YgeRt.js → opfs-ahp-B7Az90a5.js} +1 -1
  26. package/dist/assets/{reactor_browser-xHwaGmj0.js → reactor_browser-i5whXQtt.js} +12 -12
  27. package/dist/assets/{state-schemas-BlHVnfyI.js → state-schemas-C4i97w88.js} +2 -2
  28. package/dist/index.html +7 -7
  29. package/lib/package.copy.json +1 -1
  30. package/lib/src/components/document-editor-container.d.ts.map +1 -1
  31. package/lib/src/components/document-editor-container.js +1 -1
  32. package/lib/src/components/document-editor-container.js.map +1 -1
  33. package/lib/src/components/sidebar.d.ts.map +1 -1
  34. package/lib/src/components/sidebar.js +2 -2
  35. package/lib/src/components/sidebar.js.map +1 -1
  36. package/lib/tsconfig.tsbuildinfo +1 -1
  37. package/package.copy.json +1 -1
  38. package/package.json +10 -10
  39. package/dist/assets/ClearStorageModal-FTxWJX1x.js +0 -1
  40. package/dist/assets/CookiesPolicyModal-N2NEJZC5.js +0 -1
  41. package/dist/assets/CreateDocumentModal-CUBTy1Vr.js +0 -1
  42. package/dist/assets/DeleteItemModal-C7-lZCXg.js +0 -1
  43. package/dist/assets/DriveSettingsModal-DiPVKK3j.js +0 -1
  44. package/dist/assets/index-CyQb1t7o.js +0 -18
@@ -1,47 +1,47 @@
1
- import{j as c,u as ki,r as Ri,C as Ai,b as Ys,a as We}from"./document_model_editor-bjkSCbVR.js";import{r as b,R as Ho,a as Y}from"./sentry_react-cODD7zWc.js";import{c as Ks,d as Li,e as Fi,f as Gu,s as Qu,g as xt,h as Yu,i as Ku,j as Xu,k as Ju,l as Zu,m as ed,n as td,o as nd,p as Xs,q as rd,r as sd,t as od,v as ad,w as $i,x as id,S as Fe}from"./reactor_browser-xHwaGmj0.js";import{P as Et,a as zi,b as _i,u as Ui,d as Vi,R as cd,A as ld,e as Ae,f as Js,g as ud,D as dd,C as fd,h as hd,i as pd,j as md,I as O,k as gd,m as ce,l as Pe,M as _e,n as bd,o as yd,p as vd,q as xd,r as wd,s as Bi,t as Cd,v as Sd,c as Hi,w as jd,x as Pd,S as Ed,y as Nd,z as Od,B as Id}from"./design_system-IWZk5eiE.js";import{t as M,a as Zs}from"./tailwind_merge-Dr4f9Rms.js";import{a6 as Md,a7 as Td,Z as Wo,o as Dd,s as kd}from"./document_model-_oCbt5YE.js";import{c as Nn,g as Wi}from"./react-DQSxOgtG.js";import{p as os,q as Rd}from"./document_drive-Bubv8iix.js";import{o as Ad,r as qo,s as Mt}from"./zod-9j67vCAu.js";import{P as Ld,a as Fd,b as $d,S as qi,I as zd,c as _d}from"./design_system_ui-DSdkJYwh.js";import{_ as Ud}from"./drive_explorer-CHwbHSwK.js";var Vd=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Bd="VisuallyHidden",Gi=b.forwardRef((e,t)=>c.jsx(Et.span,{...e,ref:t,style:{...Vd,...e.style}}));Gi.displayName=Bd;var Hd=Gi,[br]=zi("Tooltip",[_i]),yr=_i(),Qi="TooltipProvider",Wd=700,as="tooltip.open",[qd,eo]=br(Qi),Yi=e=>{const{__scopeTooltip:t,delayDuration:n=Wd,skipDelayDuration:s=300,disableHoverableContent:r=!1,children:o}=e,a=b.useRef(!0),i=b.useRef(!1),l=b.useRef(0);return b.useEffect(()=>{const u=l.current;return()=>window.clearTimeout(u)},[]),c.jsx(qd,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(l.current),a.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>a.current=!0,s)},[s]),isPointerInTransitRef:i,onPointerInTransitChange:b.useCallback(u=>{i.current=u},[]),disableHoverableContent:r,children:o})};Yi.displayName=Qi;var _t="Tooltip",[Gd,bn]=br(_t),Ki=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:r,onOpenChange:o,disableHoverableContent:a,delayDuration:i}=e,l=eo(_t,e.__scopeTooltip),u=yr(t),[d,h]=b.useState(null),f=Ui(),p=b.useRef(0),g=a??l.disableHoverableContent,m=i??l.delayDuration,y=b.useRef(!1),[v,x]=Vi({prop:s,defaultProp:r??!1,onChange:S=>{S?(l.onOpen(),document.dispatchEvent(new CustomEvent(as))):l.onClose(),o?.(S)},caller:_t}),C=b.useMemo(()=>v?y.current?"delayed-open":"instant-open":"closed",[v]),E=b.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y.current=!1,x(!0)},[x]),w=b.useCallback(()=>{window.clearTimeout(p.current),p.current=0,x(!1)},[x]),j=b.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{y.current=!0,x(!0),p.current=0},m)},[m,x]);return b.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),c.jsx(cd,{...u,children:c.jsx(Gd,{scope:t,contentId:f,open:v,stateAttribute:C,trigger:d,onTriggerChange:h,onTriggerEnter:b.useCallback(()=>{l.isOpenDelayedRef.current?j():E()},[l.isOpenDelayedRef,j,E]),onTriggerLeave:b.useCallback(()=>{g?w():(window.clearTimeout(p.current),p.current=0)},[w,g]),onOpen:E,onClose:w,disableHoverableContent:g,children:n})})};Ki.displayName=_t;var is="TooltipTrigger",Xi=b.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,r=bn(is,n),o=eo(is,n),a=yr(n),i=b.useRef(null),l=ki(t,i,r.onTriggerChange),u=b.useRef(!1),d=b.useRef(!1),h=b.useCallback(()=>u.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),c.jsx(ld,{asChild:!0,...a,children:c.jsx(Et.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...s,ref:l,onPointerMove:Ae(e.onPointerMove,f=>{f.pointerType!=="touch"&&!d.current&&!o.isPointerInTransitRef.current&&(r.onTriggerEnter(),d.current=!0)}),onPointerLeave:Ae(e.onPointerLeave,()=>{r.onTriggerLeave(),d.current=!1}),onPointerDown:Ae(e.onPointerDown,()=>{r.open&&r.onClose(),u.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Ae(e.onFocus,()=>{u.current||r.onOpen()}),onBlur:Ae(e.onBlur,r.onClose),onClick:Ae(e.onClick,r.onClose)})})});Xi.displayName=is;var to="TooltipPortal",[Qd,Yd]=br(to,{forceMount:void 0}),Ji=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:r}=e,o=bn(to,t);return c.jsx(Qd,{scope:t,forceMount:n,children:c.jsx(Js,{present:n||o.open,children:c.jsx(ud,{asChild:!0,container:r,children:s})})})};Ji.displayName=to;var wt="TooltipContent",Zi=b.forwardRef((e,t)=>{const n=Yd(wt,e.__scopeTooltip),{forceMount:s=n.forceMount,side:r="top",...o}=e,a=bn(wt,e.__scopeTooltip);return c.jsx(Js,{present:s||a.open,children:a.disableHoverableContent?c.jsx(ec,{side:r,...o,ref:t}):c.jsx(Kd,{side:r,...o,ref:t})})}),Kd=b.forwardRef((e,t)=>{const n=bn(wt,e.__scopeTooltip),s=eo(wt,e.__scopeTooltip),r=b.useRef(null),o=ki(t,r),[a,i]=b.useState(null),{trigger:l,onClose:u}=n,d=r.current,{onPointerInTransitChange:h}=s,f=b.useCallback(()=>{i(null),h(!1)},[h]),p=b.useCallback((g,m)=>{const y=g.currentTarget,v={x:g.clientX,y:g.clientY},x=tf(v,y.getBoundingClientRect()),C=nf(v,x),E=rf(m.getBoundingClientRect()),w=of([...C,...E]);i(w),h(!0)},[h]);return b.useEffect(()=>()=>f(),[f]),b.useEffect(()=>{if(l&&d){const g=y=>p(y,d),m=y=>p(y,l);return l.addEventListener("pointerleave",g),d.addEventListener("pointerleave",m),()=>{l.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",m)}}},[l,d,p,f]),b.useEffect(()=>{if(a){const g=m=>{const y=m.target,v={x:m.clientX,y:m.clientY},x=l?.contains(y)||d?.contains(y),C=!sf(v,a);x?f():C&&(f(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[l,d,a,u,f]),c.jsx(ec,{...e,ref:o})}),[Xd,Jd]=br(_t,{isInside:!1}),Zd=hd("TooltipContent"),ec=b.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":r,onEscapeKeyDown:o,onPointerDownOutside:a,...i}=e,l=bn(wt,n),u=yr(n),{onClose:d}=l;return b.useEffect(()=>(document.addEventListener(as,d),()=>document.removeEventListener(as,d)),[d]),b.useEffect(()=>{if(l.trigger){const h=f=>{f.target?.contains(l.trigger)&&d()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[l.trigger,d]),c.jsx(dd,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:c.jsxs(fd,{"data-state":l.stateAttribute,...u,...i,ref:t,style:{...i.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[c.jsx(Zd,{children:s}),c.jsx(Xd,{scope:n,isInside:!0,children:c.jsx(Hd,{id:l.contentId,role:"tooltip",children:r||s})})]})})});Zi.displayName=wt;var tc="TooltipArrow",ef=b.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,r=yr(n);return Jd(tc,n).isInside?null:c.jsx(pd,{...r,...s,ref:t})});ef.displayName=tc;function tf(e,t){const n=Math.abs(t.top-e.y),s=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,s,r,o)){case o:return"left";case r:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function nf(e,t,n=5){const s=[];switch(t){case"top":s.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":s.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":s.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":s.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return s}function rf(e){const{top:t,right:n,bottom:s,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:s},{x:r,y:s}]}function sf(e,t){const{x:n,y:s}=e;let r=!1;for(let o=0,a=t.length-1;o<t.length;a=o++){const i=t[o],l=t[a],u=i.x,d=i.y,h=l.x,f=l.y;d>s!=f>s&&n<(h-u)*(s-d)/(f-d)+u&&(r=!r)}return r}function of(e){const t=e.slice();return t.sort((n,s)=>n.x<s.x?-1:n.x>s.x?1:n.y<s.y?-1:n.y>s.y?1:0),af(t)}function af(e){if(e.length<=1)return e.slice();const t=[];for(let s=0;s<e.length;s++){const r=e[s];for(;t.length>=2;){const o=t[t.length-1],a=t[t.length-2];if((o.x-a.x)*(r.y-a.y)>=(o.y-a.y)*(r.x-a.x))t.pop();else break}t.push(r)}t.pop();const n=[];for(let s=e.length-1;s>=0;s--){const r=e[s];for(;n.length>=2;){const o=n[n.length-1],a=n[n.length-2];if((o.x-a.x)*(r.y-a.y)>=(o.y-a.y)*(r.x-a.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var cf=Yi,lf=Ki,uf=Xi,df=Ji,ff=Zi;const nc=6048e5,hf=864e5,rc=6e4,sc=36e5,On=43200,Go=1440,Qo=Symbol.for("constructDateFrom");function Te(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&Qo in e?e[Qo](t):e instanceof Date?new e.constructor(t):new Date(t)}function ie(e,t){return Te(t||e,e)}let pf={};function yn(){return pf}function Ut(e,t){const n=yn(),s=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,r=ie(e,t?.in),o=r.getDay(),a=(o<s?7:0)+o-s;return r.setDate(r.getDate()-a),r.setHours(0,0,0,0),r}function Zn(e,t){return Ut(e,{...t,weekStartsOn:1})}function oc(e,t){const n=ie(e,t?.in),s=n.getFullYear(),r=Te(n,0);r.setFullYear(s+1,0,4),r.setHours(0,0,0,0);const o=Zn(r),a=Te(n,0);a.setFullYear(s,0,4),a.setHours(0,0,0,0);const i=Zn(a);return n.getTime()>=o.getTime()?s+1:n.getTime()>=i.getTime()?s:s-1}function er(e){const t=ie(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function vr(e,...t){const n=Te.bind(null,e||t.find(s=>typeof s=="object"));return t.map(n)}function Yo(e,t){const n=ie(e,t?.in);return n.setHours(0,0,0,0),n}function mf(e,t,n){const[s,r]=vr(n?.in,e,t),o=Yo(s),a=Yo(r),i=+o-er(o),l=+a-er(a);return Math.round((i-l)/hf)}function gf(e,t){const n=oc(e,t),s=Te(e,0);return s.setFullYear(n,0,4),s.setHours(0,0,0,0),Zn(s)}function Hn(e,t){const n=+ie(e)-+ie(t);return n<0?-1:n>0?1:n}function bf(e){return Te(e,Date.now())}function yf(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function vf(e){return!(!yf(e)&&typeof e!="number"||isNaN(+ie(e)))}function xf(e,t,n){const[s,r]=vr(n?.in,e,t),o=s.getFullYear()-r.getFullYear(),a=s.getMonth()-r.getMonth();return o*12+a}function wf(e){return t=>{const s=(e?Math[e]:Math.trunc)(t);return s===0?0:s}}function Cf(e,t){return+ie(e)-+ie(t)}function Sf(e,t){const n=ie(e,t?.in);return n.setHours(23,59,59,999),n}function jf(e,t){const n=ie(e,t?.in),s=n.getMonth();return n.setFullYear(n.getFullYear(),s+1,0),n.setHours(23,59,59,999),n}function Pf(e,t){const n=ie(e,t?.in);return+Sf(n,t)==+jf(n,t)}function Ef(e,t,n){const[s,r,o]=vr(n?.in,e,e,t),a=Hn(r,o),i=Math.abs(xf(r,o));if(i<1)return 0;r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-a*i);let l=Hn(r,o)===-a;Pf(s)&&i===1&&Hn(s,o)===1&&(l=!1);const u=a*(i-+l);return u===0?0:u}function Nf(e,t,n){const s=Cf(e,t)/1e3;return wf(n?.roundingMethod)(s)}function Of(e,t){const n=ie(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const If={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Mf=(e,t,n)=>{let s;const r=If[e];return typeof r=="string"?s=r:t===1?s=r.one:s=r.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+s:s+" ago":s};function Rr(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const Tf={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Df={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},kf={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Rf={date:Rr({formats:Tf,defaultWidth:"full"}),time:Rr({formats:Df,defaultWidth:"full"}),dateTime:Rr({formats:kf,defaultWidth:"full"})},Af={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Lf=(e,t,n,s)=>Af[e];function Tt(e){return(t,n)=>{const s=n?.context?String(n.context):"standalone";let r;if(s==="formatting"&&e.formattingValues){const a=e.defaultFormattingWidth||e.defaultWidth,i=n?.width?String(n.width):a;r=e.formattingValues[i]||e.formattingValues[a]}else{const a=e.defaultWidth,i=n?.width?String(n.width):e.defaultWidth;r=e.values[i]||e.values[a]}const o=e.argumentCallback?e.argumentCallback(t):t;return r[o]}}const Ff={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},$f={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},zf={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},_f={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Uf={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Vf={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Bf=(e,t)=>{const n=Number(e),s=n%100;if(s>20||s<10)switch(s%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},Hf={ordinalNumber:Bf,era:Tt({values:Ff,defaultWidth:"wide"}),quarter:Tt({values:$f,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Tt({values:zf,defaultWidth:"wide"}),day:Tt({values:_f,defaultWidth:"wide"}),dayPeriod:Tt({values:Uf,defaultWidth:"wide",formattingValues:Vf,defaultFormattingWidth:"wide"})};function Dt(e){return(t,n={})=>{const s=n.width,r=s&&e.matchPatterns[s]||e.matchPatterns[e.defaultMatchWidth],o=t.match(r);if(!o)return null;const a=o[0],i=s&&e.parsePatterns[s]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(i)?qf(i,h=>h.test(a)):Wf(i,h=>h.test(a));let u;u=e.valueCallback?e.valueCallback(l):l,u=n.valueCallback?n.valueCallback(u):u;const d=t.slice(a.length);return{value:u,rest:d}}}function Wf(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function qf(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function Gf(e){return(t,n={})=>{const s=t.match(e.matchPattern);if(!s)return null;const r=s[0],o=t.match(e.parsePattern);if(!o)return null;let a=e.valueCallback?e.valueCallback(o[0]):o[0];a=n.valueCallback?n.valueCallback(a):a;const i=t.slice(r.length);return{value:a,rest:i}}}const Qf=/^(\d+)(th|st|nd|rd)?/i,Yf=/\d+/i,Kf={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Xf={any:[/^b/i,/^(a|c)/i]},Jf={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Zf={any:[/1/i,/2/i,/3/i,/4/i]},e0={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},t0={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},n0={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},r0={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},s0={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},o0={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},a0={ordinalNumber:Gf({matchPattern:Qf,parsePattern:Yf,valueCallback:e=>parseInt(e,10)}),era:Dt({matchPatterns:Kf,defaultMatchWidth:"wide",parsePatterns:Xf,defaultParseWidth:"any"}),quarter:Dt({matchPatterns:Jf,defaultMatchWidth:"wide",parsePatterns:Zf,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Dt({matchPatterns:e0,defaultMatchWidth:"wide",parsePatterns:t0,defaultParseWidth:"any"}),day:Dt({matchPatterns:n0,defaultMatchWidth:"wide",parsePatterns:r0,defaultParseWidth:"any"}),dayPeriod:Dt({matchPatterns:s0,defaultMatchWidth:"any",parsePatterns:o0,defaultParseWidth:"any"})},ac={code:"en-US",formatDistance:Mf,formatLong:Rf,formatRelative:Lf,localize:Hf,match:a0,options:{weekStartsOn:0,firstWeekContainsDate:1}};function i0(e,t){const n=ie(e,t?.in);return mf(n,Of(n))+1}function c0(e,t){const n=ie(e,t?.in),s=+Zn(n)-+gf(n);return Math.round(s/nc)+1}function ic(e,t){const n=ie(e,t?.in),s=n.getFullYear(),r=yn(),o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=Te(t?.in||e,0);a.setFullYear(s+1,0,o),a.setHours(0,0,0,0);const i=Ut(a,t),l=Te(t?.in||e,0);l.setFullYear(s,0,o),l.setHours(0,0,0,0);const u=Ut(l,t);return+n>=+i?s+1:+n>=+u?s:s-1}function l0(e,t){const n=yn(),s=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,r=ic(e,t),o=Te(t?.in||e,0);return o.setFullYear(r,0,s),o.setHours(0,0,0,0),Ut(o,t)}function u0(e,t){const n=ie(e,t?.in),s=+Ut(n,t)-+l0(n,t);return Math.round(s/nc)+1}function K(e,t){const n=e<0?"-":"",s=Math.abs(e).toString().padStart(t,"0");return n+s}const He={y(e,t){const n=e.getFullYear(),s=n>0?n:1-n;return K(t==="yy"?s%100:s,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):K(n+1,2)},d(e,t){return K(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return K(e.getHours()%12||12,t.length)},H(e,t){return K(e.getHours(),t.length)},m(e,t){return K(e.getMinutes(),t.length)},s(e,t){return K(e.getSeconds(),t.length)},S(e,t){const n=t.length,s=e.getMilliseconds(),r=Math.trunc(s*Math.pow(10,n-3));return K(r,t.length)}},dt={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Ko={G:function(e,t,n){const s=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(s,{width:"abbreviated"});case"GGGGG":return n.era(s,{width:"narrow"});case"GGGG":default:return n.era(s,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const s=e.getFullYear(),r=s>0?s:1-s;return n.ordinalNumber(r,{unit:"year"})}return He.y(e,t)},Y:function(e,t,n,s){const r=ic(e,s),o=r>0?r:1-r;if(t==="YY"){const a=o%100;return K(a,2)}return t==="Yo"?n.ordinalNumber(o,{unit:"year"}):K(o,t.length)},R:function(e,t){const n=oc(e);return K(n,t.length)},u:function(e,t){const n=e.getFullYear();return K(n,t.length)},Q:function(e,t,n){const s=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(s);case"QQ":return K(s,2);case"Qo":return n.ordinalNumber(s,{unit:"quarter"});case"QQQ":return n.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(s,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(s,{width:"wide",context:"formatting"})}},q:function(e,t,n){const s=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(s);case"qq":return K(s,2);case"qo":return n.ordinalNumber(s,{unit:"quarter"});case"qqq":return n.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(s,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(s,{width:"wide",context:"standalone"})}},M:function(e,t,n){const s=e.getMonth();switch(t){case"M":case"MM":return He.M(e,t);case"Mo":return n.ordinalNumber(s+1,{unit:"month"});case"MMM":return n.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(s,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(s,{width:"wide",context:"formatting"})}},L:function(e,t,n){const s=e.getMonth();switch(t){case"L":return String(s+1);case"LL":return K(s+1,2);case"Lo":return n.ordinalNumber(s+1,{unit:"month"});case"LLL":return n.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(s,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(s,{width:"wide",context:"standalone"})}},w:function(e,t,n,s){const r=u0(e,s);return t==="wo"?n.ordinalNumber(r,{unit:"week"}):K(r,t.length)},I:function(e,t,n){const s=c0(e);return t==="Io"?n.ordinalNumber(s,{unit:"week"}):K(s,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):He.d(e,t)},D:function(e,t,n){const s=i0(e);return t==="Do"?n.ordinalNumber(s,{unit:"dayOfYear"}):K(s,t.length)},E:function(e,t,n){const s=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(s,{width:"short",context:"formatting"});case"EEEE":default:return n.day(s,{width:"wide",context:"formatting"})}},e:function(e,t,n,s){const r=e.getDay(),o=(r-s.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return K(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(r,{width:"short",context:"formatting"});case"eeee":default:return n.day(r,{width:"wide",context:"formatting"})}},c:function(e,t,n,s){const r=e.getDay(),o=(r-s.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return K(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(r,{width:"narrow",context:"standalone"});case"cccccc":return n.day(r,{width:"short",context:"standalone"});case"cccc":default:return n.day(r,{width:"wide",context:"standalone"})}},i:function(e,t,n){const s=e.getDay(),r=s===0?7:s;switch(t){case"i":return String(r);case"ii":return K(r,t.length);case"io":return n.ordinalNumber(r,{unit:"day"});case"iii":return n.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(s,{width:"short",context:"formatting"});case"iiii":default:return n.day(s,{width:"wide",context:"formatting"})}},a:function(e,t,n){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,t,n){const s=e.getHours();let r;switch(s===12?r=dt.noon:s===0?r=dt.midnight:r=s/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(e,t,n){const s=e.getHours();let r;switch(s>=17?r=dt.evening:s>=12?r=dt.afternoon:s>=4?r=dt.morning:r=dt.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let s=e.getHours()%12;return s===0&&(s=12),n.ordinalNumber(s,{unit:"hour"})}return He.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):He.H(e,t)},K:function(e,t,n){const s=e.getHours()%12;return t==="Ko"?n.ordinalNumber(s,{unit:"hour"}):K(s,t.length)},k:function(e,t,n){let s=e.getHours();return s===0&&(s=24),t==="ko"?n.ordinalNumber(s,{unit:"hour"}):K(s,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):He.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):He.s(e,t)},S:function(e,t){return He.S(e,t)},X:function(e,t,n){const s=e.getTimezoneOffset();if(s===0)return"Z";switch(t){case"X":return Jo(s);case"XXXX":case"XX":return Xe(s);case"XXXXX":case"XXX":default:return Xe(s,":")}},x:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"x":return Jo(s);case"xxxx":case"xx":return Xe(s);case"xxxxx":case"xxx":default:return Xe(s,":")}},O:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Xo(s,":");case"OOOO":default:return"GMT"+Xe(s,":")}},z:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Xo(s,":");case"zzzz":default:return"GMT"+Xe(s,":")}},t:function(e,t,n){const s=Math.trunc(+e/1e3);return K(s,t.length)},T:function(e,t,n){return K(+e,t.length)}};function Xo(e,t=""){const n=e>0?"-":"+",s=Math.abs(e),r=Math.trunc(s/60),o=s%60;return o===0?n+String(r):n+String(r)+t+K(o,2)}function Jo(e,t){return e%60===0?(e>0?"-":"+")+K(Math.abs(e)/60,2):Xe(e,t)}function Xe(e,t=""){const n=e>0?"-":"+",s=Math.abs(e),r=K(Math.trunc(s/60),2),o=K(s%60,2);return n+r+t+o}const Zo=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},cc=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},d0=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],s=n[1],r=n[2];if(!r)return Zo(e,t);let o;switch(s){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;case"PPPP":default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",Zo(s,t)).replace("{{time}}",cc(r,t))},f0={p:cc,P:d0},h0=/^D+$/,p0=/^Y+$/,m0=["D","DD","YY","YYYY"];function g0(e){return h0.test(e)}function b0(e){return p0.test(e)}function y0(e,t,n){const s=v0(e,t,n);if(console.warn(s),m0.includes(e))throw new RangeError(s)}function v0(e,t,n){const s=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${s} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const x0=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,w0=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,C0=/^'([^]*?)'?$/,S0=/''/g,j0=/[a-zA-Z]/;function tr(e,t,n){const s=yn(),r=s.locale??ac,o=s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,a=s.weekStartsOn??s.locale?.options?.weekStartsOn??0,i=ie(e,n?.in);if(!vf(i))throw new RangeError("Invalid time value");let l=t.match(w0).map(d=>{const h=d[0];if(h==="p"||h==="P"){const f=f0[h];return f(d,r.formatLong)}return d}).join("").match(x0).map(d=>{if(d==="''")return{isToken:!1,value:"'"};const h=d[0];if(h==="'")return{isToken:!1,value:P0(d)};if(Ko[h])return{isToken:!0,value:d};if(h.match(j0))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");return{isToken:!1,value:d}});r.localize.preprocessor&&(l=r.localize.preprocessor(i,l));const u={firstWeekContainsDate:o,weekStartsOn:a,locale:r};return l.map(d=>{if(!d.isToken)return d.value;const h=d.value;(b0(h)||g0(h))&&y0(h,t,String(e));const f=Ko[h[0]];return f(i,h,r.localize,u)}).join("")}function P0(e){const t=e.match(C0);return t?t[1].replace(S0,"'"):e}function E0(e,t,n){const s=yn(),r=n?.locale??s.locale??ac,o=2520,a=Hn(e,t);if(isNaN(a))throw new RangeError("Invalid time value");const i=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:a}),[l,u]=vr(n?.in,...a>0?[t,e]:[e,t]),d=Nf(u,l),h=(er(u)-er(l))/1e3,f=Math.round((d-h)/60);let p;if(f<2)return n?.includeSeconds?d<5?r.formatDistance("lessThanXSeconds",5,i):d<10?r.formatDistance("lessThanXSeconds",10,i):d<20?r.formatDistance("lessThanXSeconds",20,i):d<40?r.formatDistance("halfAMinute",0,i):d<60?r.formatDistance("lessThanXMinutes",1,i):r.formatDistance("xMinutes",1,i):f===0?r.formatDistance("lessThanXMinutes",1,i):r.formatDistance("xMinutes",f,i);if(f<45)return r.formatDistance("xMinutes",f,i);if(f<90)return r.formatDistance("aboutXHours",1,i);if(f<Go){const g=Math.round(f/60);return r.formatDistance("aboutXHours",g,i)}else{if(f<o)return r.formatDistance("xDays",1,i);if(f<On){const g=Math.round(f/Go);return r.formatDistance("xDays",g,i)}else if(f<On*2)return p=Math.round(f/On),r.formatDistance("aboutXMonths",p,i)}if(p=Ef(u,l),p<12){const g=Math.round(f/On);return r.formatDistance("xMonths",g,i)}else{const g=p%12,m=Math.trunc(p/12);return g<3?r.formatDistance("aboutXYears",m,i):g<9?r.formatDistance("overXYears",m,i):r.formatDistance("almostXYears",m+1,i)}}function N0(e,t){return E0(e,bf(e),t)}function O0(e,t){const n=()=>Te(t?.in,NaN),r=D0(e);let o;if(r.date){const u=k0(r.date,2);o=R0(u.restDateString,u.year)}if(!o||isNaN(+o))return n();const a=+o;let i=0,l;if(r.time&&(i=A0(r.time),isNaN(i)))return n();if(r.timezone){if(l=L0(r.timezone),isNaN(l))return n()}else{const u=new Date(a+i),d=ie(0,t?.in);return d.setFullYear(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()),d.setHours(u.getUTCHours(),u.getUTCMinutes(),u.getUTCSeconds(),u.getUTCMilliseconds()),d}return ie(a+i+l,t?.in)}const In={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},I0=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,M0=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,T0=/^([+-])(\d{2})(?::?(\d{2}))?$/;function D0(e){const t={},n=e.split(In.dateTimeDelimiter);let s;if(n.length>2)return t;if(/:/.test(n[0])?s=n[0]:(t.date=n[0],s=n[1],In.timeZoneDelimiter.test(t.date)&&(t.date=e.split(In.timeZoneDelimiter)[0],s=e.substr(t.date.length,e.length))),s){const r=In.timezone.exec(s);r?(t.time=s.replace(r[1],""),t.timezone=r[1]):t.time=s}return t}function k0(e,t){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),s=e.match(n);if(!s)return{year:NaN,restDateString:""};const r=s[1]?parseInt(s[1]):null,o=s[2]?parseInt(s[2]):null;return{year:o===null?r:o*100,restDateString:e.slice((s[1]||s[2]).length)}}function R0(e,t){if(t===null)return new Date(NaN);const n=e.match(I0);if(!n)return new Date(NaN);const s=!!n[4],r=kt(n[1]),o=kt(n[2])-1,a=kt(n[3]),i=kt(n[4]),l=kt(n[5])-1;if(s)return U0(t,i,l)?F0(t,i,l):new Date(NaN);{const u=new Date(0);return!z0(t,o,a)||!_0(t,r)?new Date(NaN):(u.setUTCFullYear(t,o,Math.max(r,a)),u)}}function kt(e){return e?parseInt(e):1}function A0(e){const t=e.match(M0);if(!t)return NaN;const n=Ar(t[1]),s=Ar(t[2]),r=Ar(t[3]);return V0(n,s,r)?n*sc+s*rc+r*1e3:NaN}function Ar(e){return e&&parseFloat(e.replace(",","."))||0}function L0(e){if(e==="Z")return 0;const t=e.match(T0);if(!t)return 0;const n=t[1]==="+"?-1:1,s=parseInt(t[2]),r=t[3]&&parseInt(t[3])||0;return B0(s,r)?n*(s*sc+r*rc):NaN}function F0(e,t,n){const s=new Date(0);s.setUTCFullYear(e,0,4);const r=s.getUTCDay()||7,o=(t-1)*7+n+1-r;return s.setUTCDate(s.getUTCDate()+o),s}const $0=[31,null,31,30,31,30,31,31,30,31,30,31];function lc(e){return e%400===0||e%4===0&&e%100!==0}function z0(e,t,n){return t>=0&&t<=11&&n>=1&&n<=($0[t]||(lc(e)?29:28))}function _0(e,t){return t>=1&&t<=(lc(e)?366:365)}function U0(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function V0(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function B0(e,t){return t>=0&&t<=59}var Lr,ea;function H0(){if(ea)return Lr;ea=1;var e="Expected a function",t=NaN,n="[object Symbol]",s=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,a=/^0o[0-7]+$/i,i=parseInt,l=typeof Nn=="object"&&Nn&&Nn.Object===Object&&Nn,u=typeof self=="object"&&self&&self.Object===Object&&self,d=l||u||Function("return this")(),h=Object.prototype,f=h.toString,p=Math.max,g=Math.min,m=function(){return d.Date.now()};function y(w,j,S){var P,N,T,I,D,R,F=0,$=!1,V=!1,W=!0;if(typeof w!="function")throw new TypeError(e);j=E(j)||0,v(S)&&($=!!S.leading,V="maxWait"in S,T=V?p(E(S.maxWait)||0,j):T,W="trailing"in S?!!S.trailing:W);function q(H){var oe=P,Ee=N;return P=N=void 0,F=H,I=w.apply(Ee,oe),I}function Z(H){return F=H,D=setTimeout(U,j),$?q(H):I}function ee(H){var oe=H-R,Ee=H-F,En=j-oe;return V?g(En,T-Ee):En}function se(H){var oe=H-R,Ee=H-F;return R===void 0||oe>=j||oe<0||V&&Ee>=T}function U(){var H=m();if(se(H))return A(H);D=setTimeout(U,ee(H))}function A(H){return D=void 0,W&&P?q(H):(P=N=void 0,I)}function B(){D!==void 0&&clearTimeout(D),F=0,P=R=N=D=void 0}function te(){return D===void 0?I:A(m())}function ne(){var H=m(),oe=se(H);if(P=arguments,N=this,R=H,oe){if(D===void 0)return Z(R);if(V)return D=setTimeout(U,j),q(R)}return D===void 0&&(D=setTimeout(U,j)),I}return ne.cancel=B,ne.flush=te,ne}function v(w){var j=typeof w;return!!w&&(j=="object"||j=="function")}function x(w){return!!w&&typeof w=="object"}function C(w){return typeof w=="symbol"||x(w)&&f.call(w)==n}function E(w){if(typeof w=="number")return w;if(C(w))return t;if(v(w)){var j=typeof w.valueOf=="function"?w.valueOf():w;w=v(j)?j+"":j}if(typeof w!="string")return w===0?w:+w;w=w.replace(s,"");var S=o.test(w);return S||a.test(w)?i(w.slice(2),S?2:8):r.test(w)?t:+w}return Lr=y,Lr}var W0=H0();const ta=Wi(W0);var uc=typeof window<"u"?b.useLayoutEffect:b.useEffect;function dc(e,t,n,s){const r=b.useRef(t);uc(()=>{r.current=t},[t]),b.useEffect(()=>{const o=window;if(!(o&&o.addEventListener))return;const a=i=>{r.current(i)};return o.addEventListener(e,a,s),()=>{o.removeEventListener(e,a,s)}},[e,n,s])}function xr(){const[e,t]=b.useState(null),n=b.useCallback(async s=>{if(!navigator?.clipboard)return console.warn("Clipboard not supported"),!1;try{return await navigator.clipboard.writeText(s),t(s),!0}catch(r){return console.warn("Copy failed",r),t(null),!1}},[]);return[e,n]}var q0=typeof window>"u";function vw(e,{defaultValue:t=!1,initializeWithValue:n=!0}={}){const s=i=>q0?t:window.matchMedia(i).matches,[r,o]=b.useState(()=>n?s(e):t);function a(){o(s(e))}return uc(()=>{const i=window.matchMedia(e);return a(),i.addListener?i.addListener(a):i.addEventListener("change",a),()=>{i.removeListener?i.removeListener(a):i.removeEventListener("change",a)}},[e]),r}function G0(e){const t=b.useRef(e);t.current=e,b.useEffect(()=>()=>{t.current()},[])}function Q0(e,t=500,n){const s=b.useRef();G0(()=>{s.current&&s.current.cancel()});const r=b.useMemo(()=>{const o=ta(e,t,n),a=(...i)=>o(...i);return a.cancel=()=>{o.cancel()},a.isPending=()=>!!s.current,a.flush=()=>o.flush(),a},[e,t,n]);return b.useEffect(()=>{s.current=ta(e,t,n)},[e,t,n]),r}function Y0(e,t,n){const s=((u,d)=>u===d),r=e instanceof Function?e():e,[o,a]=b.useState(r),i=b.useRef(r),l=Q0(a,t,n);return s(i.current,r)||(l(r),i.current=r),[o,l]}function K0(e,t,n="mousedown",s={}){dc(n,r=>{const o=r.target;if(!o||!o.isConnected)return;(Array.isArray(e)?e.filter(i=>!!i.current).every(i=>i.current&&!i.current.contains(o)):e.current&&!e.current.contains(o))&&t(r)},void 0,s)}const fc=({children:e,content:t})=>c.jsxs(Ld,{children:[c.jsx(Fd,{asChild:!0,children:c.jsx("button",{type:"button","aria-label":"Open Account",className:"cursor-pointer",children:e})}),c.jsx($d,{className:"w-52 p-0",align:"start",children:t})]}),X0=new URL("/assets/connect-loader-CvOC68Ih.mp4",import.meta.url).href;function J0(e){const{style:t,size:n=100,...s}=e,r=md(n),o={objectFit:"contain",pointerEvents:"none",...r,...t},a=r.width?.replace("px",""),i=r.height?.replace("px","");return c.jsx("video",{autoPlay:!0,height:i,loop:!0,muted:!0,playsInline:!0,width:a,...s,style:o,children:c.jsx("source",{src:X0,type:"video/mp4"})})}function no(e){const{onSubmit:t,onCancel:n,defaultValue:s,className:r,minLength:o=1,...a}=e,[i,l]=b.useState(s??""),u=b.useRef(null);K0(u,d),dc("keyup",h=>{h.key==="Enter"&&d(),h.key==="Escape"&&n()}),b.useLayoutEffect(()=>{setTimeout(()=>{u.current?.focus(),u.current?.select(),u.current?.scroll({left:9999})},100)},[]);function d(){i.length>=o&&t(i)}return c.jsx("input",{...a,autoFocus:!0,className:M("bg-inherit text-inherit outline-none",r),minLength:o,onChange:h=>l(h.target.value),ref:u,required:!0,type:"text",value:i})}function xw(){const{isAllowedToCreateDocuments:e}=Ks(),[t]=Li(),n=Fi(),s=Gu(),[r,o]=b.useState(!1);function a(){o(!0)}function i(h){!e||!n||Yu(n,h,s.at(-1)?.id).then(f=>{xt(f)}).catch(f=>{console.error(f)}).finally(()=>{o(!1)})}function l(){o(!1)}const u=!!t,d=!!s.length;return c.jsxs("div",{className:"flex h-9 flex-row items-center gap-2 p-6 text-gray-500",children:[u&&c.jsxs(c.Fragment,{children:[c.jsx(na,{name:t.state.global.name,onClick:()=>Qu(t)}),c.jsx("span",{children:"/"})]}),d&&s.map(h=>c.jsxs(b.Fragment,{children:[c.jsx(na,{name:h.name,onClick:()=>xt(h)}),c.jsx("span",{children:"/"})]},h.id)),e&&(r?c.jsx(no,{className:"text-gray-800",defaultValue:"New Folder",onCancel:l,onSubmit:i,placeholder:"New Folder"}):c.jsxs("button",{type:"button",className:"ml-1 flex items-center justify-center gap-2 rounded-md bg-gray-50 px-2 py-1.5 transition-colors hover:bg-gray-200 hover:text-gray-800",onClick:a,children:[c.jsx(O,{name:"Plus",size:14}),"Add new"]}))]})}function na(e){const{name:t,onClick:n}=e;return c.jsx("div",{className:"transition-colors last-of-type:text-gray-800 hover:text-gray-800",onClick:n,role:"button",children:t})}function st(e){"@babel/helpers - typeof";return st=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},st(e)}function Z0(e,t){if(st(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(st(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function hc(e){var t=Z0(e,"string");return st(t)=="symbol"?t:t+""}function $t(e,t,n){return(t=hc(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ra(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,s)}return n}function z(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ra(Object(n),!0).forEach(function(s){$t(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ra(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function eh(e){if(Array.isArray(e))return e}function th(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s,r,o,a,i=[],l=!0,u=!1;try{if(o=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;l=!1}else for(;!(l=(s=o.call(n)).done)&&(i.push(s.value),i.length!==t);l=!0);}catch(d){u=!0,r=d}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw r}}return i}}function cs(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=Array(t);n<t;n++)s[n]=e[n];return s}function pc(e,t){if(e){if(typeof e=="string")return cs(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cs(e,t):void 0}}function nh(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $e(e,t){return eh(e)||th(e,t)||pc(e,t)||nh()}function rh(e,t){if(e==null)return{};var n={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(t.indexOf(s)!==-1)continue;n[s]=e[s]}return n}function Ue(e,t){if(e==null)return{};var n,s,r=rh(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)n=o[s],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var sh=["defaultInputValue","defaultMenuIsOpen","defaultValue","inputValue","menuIsOpen","onChange","onInputChange","onMenuClose","onMenuOpen","value"];function oh(e){var t=e.defaultInputValue,n=t===void 0?"":t,s=e.defaultMenuIsOpen,r=s===void 0?!1:s,o=e.defaultValue,a=o===void 0?null:o,i=e.inputValue,l=e.menuIsOpen,u=e.onChange,d=e.onInputChange,h=e.onMenuClose,f=e.onMenuOpen,p=e.value,g=Ue(e,sh),m=b.useState(i!==void 0?i:n),y=$e(m,2),v=y[0],x=y[1],C=b.useState(l!==void 0?l:r),E=$e(C,2),w=E[0],j=E[1],S=b.useState(p!==void 0?p:a),P=$e(S,2),N=P[0],T=P[1],I=b.useCallback(function(q,Z){typeof u=="function"&&u(q,Z),T(q)},[u]),D=b.useCallback(function(q,Z){var ee;typeof d=="function"&&(ee=d(q,Z)),x(ee!==void 0?ee:q)},[d]),R=b.useCallback(function(){typeof f=="function"&&f(),j(!0)},[f]),F=b.useCallback(function(){typeof h=="function"&&h(),j(!1)},[h]),$=i!==void 0?i:v,V=l!==void 0?l:w,W=p!==void 0?p:N;return z(z({},g),{},{inputValue:$,menuIsOpen:V,onChange:I,onInputChange:D,onMenuClose:F,onMenuOpen:R,value:W})}function _(){return _=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)({}).hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},_.apply(null,arguments)}function ah(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sa(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,hc(s.key),s)}}function ih(e,t,n){return t&&sa(e.prototype,t),n&&sa(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function ls(e,t){return ls=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},ls(e,t)}function ch(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ls(e,t)}function nr(e){return nr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},nr(e)}function mc(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(mc=function(){return!!e})()}function lh(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function uh(e,t){if(t&&(st(t)=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return lh(e)}function dh(e){var t=mc();return function(){var n,s=nr(e);if(t){var r=nr(this).constructor;n=Reflect.construct(s,arguments,r)}else n=s.apply(this,arguments);return uh(this,n)}}function fh(e){if(Array.isArray(e))return cs(e)}function hh(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ph(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
3
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ro(e){return fh(e)||hh(e)||pc(e)||ph()}function mh(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}function gh(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),e.nonce!==void 0&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}var bh=(function(){function e(n){var s=this;this._insertTag=function(r){var o;s.tags.length===0?s.insertionPoint?o=s.insertionPoint.nextSibling:s.prepend?o=s.container.firstChild:o=s.before:o=s.tags[s.tags.length-1].nextSibling,s.container.insertBefore(r,o),s.tags.push(r)},this.isSpeedy=n.speedy===void 0?!0:n.speedy,this.tags=[],this.ctr=0,this.nonce=n.nonce,this.key=n.key,this.container=n.container,this.prepend=n.prepend,this.insertionPoint=n.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(s){s.forEach(this._insertTag)},t.insert=function(s){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(gh(this));var r=this.tags[this.tags.length-1];if(this.isSpeedy){var o=mh(r);try{o.insertRule(s,o.cssRules.length)}catch{}}else r.appendChild(document.createTextNode(s));this.ctr++},t.flush=function(){this.tags.forEach(function(s){var r;return(r=s.parentNode)==null?void 0:r.removeChild(s)}),this.tags=[],this.ctr=0},e})(),de="-ms-",rr="-moz-",G="-webkit-",gc="comm",so="rule",oo="decl",yh="@import",bc="@keyframes",vh="@layer",xh=Math.abs,wr=String.fromCharCode,wh=Object.assign;function Ch(e,t){return le(e,0)^45?(((t<<2^le(e,0))<<2^le(e,1))<<2^le(e,2))<<2^le(e,3):0}function yc(e){return e.trim()}function Sh(e,t){return(e=t.exec(e))?e[0]:e}function Q(e,t,n){return e.replace(t,n)}function us(e,t){return e.indexOf(t)}function le(e,t){return e.charCodeAt(t)|0}function Vt(e,t,n){return e.slice(t,n)}function Ne(e){return e.length}function ao(e){return e.length}function Mn(e,t){return t.push(e),e}function jh(e,t){return e.map(t).join("")}var Cr=1,Ct=1,vc=0,ge=0,ae=0,Nt="";function Sr(e,t,n,s,r,o,a){return{value:e,root:t,parent:n,type:s,props:r,children:o,line:Cr,column:Ct,length:a,return:""}}function Rt(e,t){return wh(Sr("",null,null,"",null,null,0),e,{length:-e.length},t)}function Ph(){return ae}function Eh(){return ae=ge>0?le(Nt,--ge):0,Ct--,ae===10&&(Ct=1,Cr--),ae}function ve(){return ae=ge<vc?le(Nt,ge++):0,Ct++,ae===10&&(Ct=1,Cr++),ae}function Ie(){return le(Nt,ge)}function Wn(){return ge}function vn(e,t){return Vt(Nt,e,t)}function Bt(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function xc(e){return Cr=Ct=1,vc=Ne(Nt=e),ge=0,[]}function wc(e){return Nt="",e}function qn(e){return yc(vn(ge-1,ds(e===91?e+2:e===40?e+1:e)))}function Nh(e){for(;(ae=Ie())&&ae<33;)ve();return Bt(e)>2||Bt(ae)>3?"":" "}function Oh(e,t){for(;--t&&ve()&&!(ae<48||ae>102||ae>57&&ae<65||ae>70&&ae<97););return vn(e,Wn()+(t<6&&Ie()==32&&ve()==32))}function ds(e){for(;ve();)switch(ae){case e:return ge;case 34:case 39:e!==34&&e!==39&&ds(ae);break;case 40:e===41&&ds(e);break;case 92:ve();break}return ge}function Ih(e,t){for(;ve()&&e+ae!==57;)if(e+ae===84&&Ie()===47)break;return"/*"+vn(t,ge-1)+"*"+wr(e===47?e:ve())}function Mh(e){for(;!Bt(Ie());)ve();return vn(e,ge)}function Th(e){return wc(Gn("",null,null,null,[""],e=xc(e),0,[0],e))}function Gn(e,t,n,s,r,o,a,i,l){for(var u=0,d=0,h=a,f=0,p=0,g=0,m=1,y=1,v=1,x=0,C="",E=r,w=o,j=s,S=C;y;)switch(g=x,x=ve()){case 40:if(g!=108&&le(S,h-1)==58){us(S+=Q(qn(x),"&","&\f"),"&\f")!=-1&&(v=-1);break}case 34:case 39:case 91:S+=qn(x);break;case 9:case 10:case 13:case 32:S+=Nh(g);break;case 92:S+=Oh(Wn()-1,7);continue;case 47:switch(Ie()){case 42:case 47:Mn(Dh(Ih(ve(),Wn()),t,n),l);break;default:S+="/"}break;case 123*m:i[u++]=Ne(S)*v;case 125*m:case 59:case 0:switch(x){case 0:case 125:y=0;case 59+d:v==-1&&(S=Q(S,/\f/g,"")),p>0&&Ne(S)-h&&Mn(p>32?aa(S+";",s,n,h-1):aa(Q(S," ","")+";",s,n,h-2),l);break;case 59:S+=";";default:if(Mn(j=oa(S,t,n,u,d,r,i,C,E=[],w=[],h),o),x===123)if(d===0)Gn(S,t,j,j,E,o,h,i,w);else switch(f===99&&le(S,3)===110?100:f){case 100:case 108:case 109:case 115:Gn(e,j,j,s&&Mn(oa(e,j,j,0,0,r,i,C,r,E=[],h),w),r,w,h,i,s?E:w);break;default:Gn(S,j,j,j,[""],w,0,i,w)}}u=d=p=0,m=v=1,C=S="",h=a;break;case 58:h=1+Ne(S),p=g;default:if(m<1){if(x==123)--m;else if(x==125&&m++==0&&Eh()==125)continue}switch(S+=wr(x),x*m){case 38:v=d>0?1:(S+="\f",-1);break;case 44:i[u++]=(Ne(S)-1)*v,v=1;break;case 64:Ie()===45&&(S+=qn(ve())),f=Ie(),d=h=Ne(C=S+=Mh(Wn())),x++;break;case 45:g===45&&Ne(S)==2&&(m=0)}}return o}function oa(e,t,n,s,r,o,a,i,l,u,d){for(var h=r-1,f=r===0?o:[""],p=ao(f),g=0,m=0,y=0;g<s;++g)for(var v=0,x=Vt(e,h+1,h=xh(m=a[g])),C=e;v<p;++v)(C=yc(m>0?f[v]+" "+x:Q(x,/&\f/g,f[v])))&&(l[y++]=C);return Sr(e,t,n,r===0?so:i,l,u,d)}function Dh(e,t,n){return Sr(e,t,n,gc,wr(Ph()),Vt(e,2,-2),0)}function aa(e,t,n,s){return Sr(e,t,n,oo,Vt(e,0,s),Vt(e,s+1,-1),s)}function bt(e,t){for(var n="",s=ao(e),r=0;r<s;r++)n+=t(e[r],r,e,t)||"";return n}function kh(e,t,n,s){switch(e.type){case vh:if(e.children.length)break;case yh:case oo:return e.return=e.return||e.value;case gc:return"";case bc:return e.return=e.value+"{"+bt(e.children,s)+"}";case so:e.value=e.props.join(",")}return Ne(n=bt(e.children,s))?e.return=e.value+"{"+n+"}":""}function Rh(e){var t=ao(e);return function(n,s,r,o){for(var a="",i=0;i<t;i++)a+=e[i](n,s,r,o)||"";return a}}function Ah(e){return function(t){t.root||(t=t.return)&&e(t)}}function Lh(e){var t=Object.create(null);return function(n){return t[n]===void 0&&(t[n]=e(n)),t[n]}}var Fh=function(t,n,s){for(var r=0,o=0;r=o,o=Ie(),r===38&&o===12&&(n[s]=1),!Bt(o);)ve();return vn(t,ge)},$h=function(t,n){var s=-1,r=44;do switch(Bt(r)){case 0:r===38&&Ie()===12&&(n[s]=1),t[s]+=Fh(ge-1,n,s);break;case 2:t[s]+=qn(r);break;case 4:if(r===44){t[++s]=Ie()===58?"&\f":"",n[s]=t[s].length;break}default:t[s]+=wr(r)}while(r=ve());return t},zh=function(t,n){return wc($h(xc(t),n))},ia=new WeakMap,_h=function(t){if(!(t.type!=="rule"||!t.parent||t.length<1)){for(var n=t.value,s=t.parent,r=t.column===s.column&&t.line===s.line;s.type!=="rule";)if(s=s.parent,!s)return;if(!(t.props.length===1&&n.charCodeAt(0)!==58&&!ia.get(s))&&!r){ia.set(t,!0);for(var o=[],a=zh(n,o),i=s.props,l=0,u=0;l<a.length;l++)for(var d=0;d<i.length;d++,u++)t.props[u]=o[l]?a[l].replace(/&\f/g,i[d]):i[d]+" "+a[l]}}},Uh=function(t){if(t.type==="decl"){var n=t.value;n.charCodeAt(0)===108&&n.charCodeAt(2)===98&&(t.return="",t.value="")}};function Cc(e,t){switch(Ch(e,t)){case 5103:return G+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return G+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return G+e+rr+e+de+e+e;case 6828:case 4268:return G+e+de+e+e;case 6165:return G+e+de+"flex-"+e+e;case 5187:return G+e+Q(e,/(\w+).+(:[^]+)/,G+"box-$1$2"+de+"flex-$1$2")+e;case 5443:return G+e+de+"flex-item-"+Q(e,/flex-|-self/,"")+e;case 4675:return G+e+de+"flex-line-pack"+Q(e,/align-content|flex-|-self/,"")+e;case 5548:return G+e+de+Q(e,"shrink","negative")+e;case 5292:return G+e+de+Q(e,"basis","preferred-size")+e;case 6060:return G+"box-"+Q(e,"-grow","")+G+e+de+Q(e,"grow","positive")+e;case 4554:return G+Q(e,/([^-])(transform)/g,"$1"+G+"$2")+e;case 6187:return Q(Q(Q(e,/(zoom-|grab)/,G+"$1"),/(image-set)/,G+"$1"),e,"")+e;case 5495:case 3959:return Q(e,/(image-set\([^]*)/,G+"$1$`$1");case 4968:return Q(Q(e,/(.+:)(flex-)?(.*)/,G+"box-pack:$3"+de+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+G+e+e;case 4095:case 3583:case 4068:case 2532:return Q(e,/(.+)-inline(.+)/,G+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Ne(e)-1-t>6)switch(le(e,t+1)){case 109:if(le(e,t+4)!==45)break;case 102:return Q(e,/(.+:)(.+)-([^]+)/,"$1"+G+"$2-$3$1"+rr+(le(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~us(e,"stretch")?Cc(Q(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(le(e,t+1)!==115)break;case 6444:switch(le(e,Ne(e)-3-(~us(e,"!important")&&10))){case 107:return Q(e,":",":"+G)+e;case 101:return Q(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+G+(le(e,14)===45?"inline-":"")+"box$3$1"+G+"$2$3$1"+de+"$2box$3")+e}break;case 5936:switch(le(e,t+11)){case 114:return G+e+de+Q(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return G+e+de+Q(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return G+e+de+Q(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return G+e+de+e+e}return e}var Vh=function(t,n,s,r){if(t.length>-1&&!t.return)switch(t.type){case oo:t.return=Cc(t.value,t.length);break;case bc:return bt([Rt(t,{value:Q(t.value,"@","@"+G)})],r);case so:if(t.length)return jh(t.props,function(o){switch(Sh(o,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return bt([Rt(t,{props:[Q(o,/:(read-\w+)/,":"+rr+"$1")]})],r);case"::placeholder":return bt([Rt(t,{props:[Q(o,/:(plac\w+)/,":"+G+"input-$1")]}),Rt(t,{props:[Q(o,/:(plac\w+)/,":"+rr+"$1")]}),Rt(t,{props:[Q(o,/:(plac\w+)/,de+"input-$1")]})],r)}return""})}},Bh=[Vh],Hh=function(t){var n=t.key;if(n==="css"){var s=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(s,function(m){var y=m.getAttribute("data-emotion");y.indexOf(" ")!==-1&&(document.head.appendChild(m),m.setAttribute("data-s",""))})}var r=t.stylisPlugins||Bh,o={},a,i=[];a=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(m){for(var y=m.getAttribute("data-emotion").split(" "),v=1;v<y.length;v++)o[y[v]]=!0;i.push(m)});var l,u=[_h,Uh];{var d,h=[kh,Ah(function(m){d.insert(m)})],f=Rh(u.concat(r,h)),p=function(y){return bt(Th(y),f)};l=function(y,v,x,C){d=x,p(y?y+"{"+v.styles+"}":v.styles),C&&(g.inserted[v.name]=!0)}}var g={key:n,sheet:new bh({key:n,container:a,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:o,registered:{},insert:l};return g.sheet.hydrate(i),g},Wh=!0;function qh(e,t,n){var s="";return n.split(" ").forEach(function(r){e[r]!==void 0?t.push(e[r]+";"):r&&(s+=r+" ")}),s}var Sc=function(t,n,s){var r=t.key+"-"+n.name;(s===!1||Wh===!1)&&t.registered[r]===void 0&&(t.registered[r]=n.styles)},Gh=function(t,n,s){Sc(t,n,s);var r=t.key+"-"+n.name;if(t.inserted[n.name]===void 0){var o=n;do t.insert(n===o?"."+r:"",o,t.sheet,!0),o=o.next;while(o!==void 0)}};function Qh(e){for(var t=0,n,s=0,r=e.length;r>=4;++s,r-=4)n=e.charCodeAt(s)&255|(e.charCodeAt(++s)&255)<<8|(e.charCodeAt(++s)&255)<<16|(e.charCodeAt(++s)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(r){case 3:t^=(e.charCodeAt(s+2)&255)<<16;case 2:t^=(e.charCodeAt(s+1)&255)<<8;case 1:t^=e.charCodeAt(s)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var Yh={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Kh=/[A-Z]|^ms/g,Xh=/_EMO_([^_]+?)_([^]*?)_EMO_/g,jc=function(t){return t.charCodeAt(1)===45},ca=function(t){return t!=null&&typeof t!="boolean"},Fr=Lh(function(e){return jc(e)?e:e.replace(Kh,"-$&").toLowerCase()}),la=function(t,n){switch(t){case"animation":case"animationName":if(typeof n=="string")return n.replace(Xh,function(s,r,o){return Oe={name:r,styles:o,next:Oe},r})}return Yh[t]!==1&&!jc(t)&&typeof n=="number"&&n!==0?n+"px":n};function Ht(e,t,n){if(n==null)return"";var s=n;if(s.__emotion_styles!==void 0)return s;switch(typeof n){case"boolean":return"";case"object":{var r=n;if(r.anim===1)return Oe={name:r.name,styles:r.styles,next:Oe},r.name;var o=n;if(o.styles!==void 0){var a=o.next;if(a!==void 0)for(;a!==void 0;)Oe={name:a.name,styles:a.styles,next:Oe},a=a.next;var i=o.styles+";";return i}return Jh(e,t,n)}case"function":{if(e!==void 0){var l=Oe,u=n(e);return Oe=l,Ht(e,t,u)}break}}var d=n;return d}function Jh(e,t,n){var s="";if(Array.isArray(n))for(var r=0;r<n.length;r++)s+=Ht(e,t,n[r])+";";else for(var o in n){var a=n[o];if(typeof a!="object"){var i=a;ca(i)&&(s+=Fr(o)+":"+la(o,i)+";")}else if(Array.isArray(a)&&typeof a[0]=="string"&&t==null)for(var l=0;l<a.length;l++)ca(a[l])&&(s+=Fr(o)+":"+la(o,a[l])+";");else{var u=Ht(e,t,a);switch(o){case"animation":case"animationName":{s+=Fr(o)+":"+u+";";break}default:s+=o+"{"+u+"}"}}}return s}var ua=/label:\s*([^\s;{]+)\s*(;|$)/g,Oe;function Pc(e,t,n){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var s=!0,r="";Oe=void 0;var o=e[0];if(o==null||o.raw===void 0)s=!1,r+=Ht(n,t,o);else{var a=o;r+=a[0]}for(var i=1;i<e.length;i++)if(r+=Ht(n,t,e[i]),s){var l=o;r+=l[i]}ua.lastIndex=0;for(var u="",d;(d=ua.exec(r))!==null;)u+="-"+d[1];var h=Qh(r)+u;return{name:h,styles:r,next:Oe}}var Zh=function(t){return t()},ep=Ho.useInsertionEffect?Ho.useInsertionEffect:!1,tp=ep||Zh,Ec=b.createContext(typeof HTMLElement<"u"?Hh({key:"css"}):null);Ec.Provider;var np=function(t){return b.forwardRef(function(n,s){var r=b.useContext(Ec);return t(n,r,s)})},rp=b.createContext({}),io={}.hasOwnProperty,fs="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",sp=function(t,n){var s={};for(var r in n)io.call(n,r)&&(s[r]=n[r]);return s[fs]=t,s},op=function(t){var n=t.cache,s=t.serialized,r=t.isStringTag;return Sc(n,s,r),tp(function(){return Gh(n,s,r)}),null},ap=np(function(e,t,n){var s=e.css;typeof s=="string"&&t.registered[s]!==void 0&&(s=t.registered[s]);var r=e[fs],o=[s],a="";typeof e.className=="string"?a=qh(t.registered,o,e.className):e.className!=null&&(a=e.className+" ");var i=Pc(o,void 0,b.useContext(rp));a+=t.key+"-"+i.name;var l={};for(var u in e)io.call(e,u)&&u!=="css"&&u!==fs&&(l[u]=e[u]);return l.className=a,n&&(l.ref=n),b.createElement(b.Fragment,null,b.createElement(op,{cache:t,serialized:i,isStringTag:typeof r=="string"}),b.createElement(r,l))}),ip=ap,L=function(t,n){var s=arguments;if(n==null||!io.call(n,"css"))return b.createElement.apply(void 0,s);var r=s.length,o=new Array(r);o[0]=ip,o[1]=sp(t,n);for(var a=2;a<r;a++)o[a]=s[a];return b.createElement.apply(null,o)};(function(e){var t;t||(t=e.JSX||(e.JSX={}))})(L||(L={}));function co(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Pc(t)}function cp(){var e=co.apply(void 0,arguments),t="animation-"+e.name;return{name:t,styles:"@keyframes "+t+"{"+e.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}}function lp(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var hs=b.useLayoutEffect,up=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"],sr=function(){};function dp(e,t){return t?t[0]==="-"?e+t:e+"__"+t:e}function fp(e,t){for(var n=arguments.length,s=new Array(n>2?n-2:0),r=2;r<n;r++)s[r-2]=arguments[r];var o=[].concat(s);if(t&&e)for(var a in t)t.hasOwnProperty(a)&&t[a]&&o.push("".concat(dp(e,a)));return o.filter(function(i){return i}).map(function(i){return String(i).trim()}).join(" ")}var da=function(t){return wp(t)?t.filter(Boolean):st(t)==="object"&&t!==null?[t]:[]},Nc=function(t){t.className,t.clearValue,t.cx,t.getStyles,t.getClassNames,t.getValue,t.hasValue,t.isMulti,t.isRtl,t.options,t.selectOption,t.selectProps,t.setValue,t.theme;var n=Ue(t,up);return z({},n)},re=function(t,n,s){var r=t.cx,o=t.getStyles,a=t.getClassNames,i=t.className;return{css:o(n,t),className:r(s??{},a(n,t),i)}};function jr(e){return[document.documentElement,document.body,window].indexOf(e)>-1}function hp(e){return jr(e)?window.innerHeight:e.clientHeight}function Oc(e){return jr(e)?window.pageYOffset:e.scrollTop}function or(e,t){if(jr(e)){window.scrollTo(0,t);return}e.scrollTop=t}function pp(e){var t=getComputedStyle(e),n=t.position==="absolute",s=/(auto|scroll)/;if(t.position==="fixed")return document.documentElement;for(var r=e;r=r.parentElement;)if(t=getComputedStyle(r),!(n&&t.position==="static")&&s.test(t.overflow+t.overflowY+t.overflowX))return r;return document.documentElement}function mp(e,t,n,s){return n*((e=e/s-1)*e*e+1)+t}function Tn(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:200,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:sr,r=Oc(e),o=t-r,a=10,i=0;function l(){i+=a;var u=mp(i,r,o,n);or(e,u),i<n?window.requestAnimationFrame(l):s(e)}l()}function fa(e,t){var n=e.getBoundingClientRect(),s=t.getBoundingClientRect(),r=t.offsetHeight/3;s.bottom+r>n.bottom?or(e,Math.min(t.offsetTop+t.clientHeight-e.offsetHeight+r,e.scrollHeight)):s.top-r<n.top&&or(e,Math.max(t.offsetTop-r,0))}function gp(e){var t=e.getBoundingClientRect();return{bottom:t.bottom,height:t.height,left:t.left,right:t.right,top:t.top,width:t.width}}function ha(){try{return document.createEvent("TouchEvent"),!0}catch{return!1}}function bp(){try{return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}catch{return!1}}var Ic=!1,yp={get passive(){return Ic=!0}},Dn=typeof window<"u"?window:{};Dn.addEventListener&&Dn.removeEventListener&&(Dn.addEventListener("p",sr,yp),Dn.removeEventListener("p",sr,!1));var vp=Ic;function xp(e){return e!=null}function wp(e){return Array.isArray(e)}function kn(e,t,n){return e?t:n}var Cp=function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),r=1;r<n;r++)s[r-1]=arguments[r];var o=Object.entries(t).filter(function(a){var i=$e(a,1),l=i[0];return!s.includes(l)});return o.reduce(function(a,i){var l=$e(i,2),u=l[0],d=l[1];return a[u]=d,a},{})},Sp=["children","innerProps"],jp=["children","innerProps"];function Pp(e){var t=e.maxHeight,n=e.menuEl,s=e.minHeight,r=e.placement,o=e.shouldScroll,a=e.isFixedPosition,i=e.controlHeight,l=pp(n),u={placement:"bottom",maxHeight:t};if(!n||!n.offsetParent)return u;var d=l.getBoundingClientRect(),h=d.height,f=n.getBoundingClientRect(),p=f.bottom,g=f.height,m=f.top,y=n.offsetParent.getBoundingClientRect(),v=y.top,x=a?window.innerHeight:hp(l),C=Oc(l),E=parseInt(getComputedStyle(n).marginBottom,10),w=parseInt(getComputedStyle(n).marginTop,10),j=v-w,S=x-m,P=j+C,N=h-C-m,T=p-x+C+E,I=C+m-w,D=160;switch(r){case"auto":case"bottom":if(S>=g)return{placement:"bottom",maxHeight:t};if(N>=g&&!a)return o&&Tn(l,T,D),{placement:"bottom",maxHeight:t};if(!a&&N>=s||a&&S>=s){o&&Tn(l,T,D);var R=a?S-E:N-E;return{placement:"bottom",maxHeight:R}}if(r==="auto"||a){var F=t,$=a?j:P;return $>=s&&(F=Math.min($-E-i,t)),{placement:"top",maxHeight:F}}if(r==="bottom")return o&&or(l,T),{placement:"bottom",maxHeight:t};break;case"top":if(j>=g)return{placement:"top",maxHeight:t};if(P>=g&&!a)return o&&Tn(l,I,D),{placement:"top",maxHeight:t};if(!a&&P>=s||a&&j>=s){var V=t;return(!a&&P>=s||a&&j>=s)&&(V=a?j-w:P-w),o&&Tn(l,I,D),{placement:"top",maxHeight:V}}return{placement:"bottom",maxHeight:t};default:throw new Error('Invalid placement provided "'.concat(r,'".'))}return u}function Ep(e){var t={bottom:"top",top:"bottom"};return e?t[e]:"bottom"}var Mc=function(t){return t==="auto"?"bottom":t},Np=function(t,n){var s,r=t.placement,o=t.theme,a=o.borderRadius,i=o.spacing,l=o.colors;return z((s={label:"menu"},$t(s,Ep(r),"100%"),$t(s,"position","absolute"),$t(s,"width","100%"),$t(s,"zIndex",1),s),n?{}:{backgroundColor:l.neutral0,borderRadius:a,boxShadow:"0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",marginBottom:i.menuGutter,marginTop:i.menuGutter})},Tc=b.createContext(null),Op=function(t){var n=t.children,s=t.minMenuHeight,r=t.maxMenuHeight,o=t.menuPlacement,a=t.menuPosition,i=t.menuShouldScrollIntoView,l=t.theme,u=b.useContext(Tc)||{},d=u.setPortalPlacement,h=b.useRef(null),f=b.useState(r),p=$e(f,2),g=p[0],m=p[1],y=b.useState(null),v=$e(y,2),x=v[0],C=v[1],E=l.spacing.controlHeight;return hs(function(){var w=h.current;if(w){var j=a==="fixed",S=i&&!j,P=Pp({maxHeight:r,menuEl:w,minHeight:s,placement:o,shouldScroll:S,isFixedPosition:j,controlHeight:E});m(P.maxHeight),C(P.placement),d?.(P.placement)}},[r,o,a,i,s,d,E]),n({ref:h,placerProps:z(z({},t),{},{placement:x||Mc(o),maxHeight:g})})},Ip=function(t){var n=t.children,s=t.innerRef,r=t.innerProps;return L("div",_({},re(t,"menu",{menu:!0}),{ref:s},r),n)},Mp=Ip,Tp=function(t,n){var s=t.maxHeight,r=t.theme.spacing.baseUnit;return z({maxHeight:s,overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},n?{}:{paddingBottom:r,paddingTop:r})},Dp=function(t){var n=t.children,s=t.innerProps,r=t.innerRef,o=t.isMulti;return L("div",_({},re(t,"menuList",{"menu-list":!0,"menu-list--is-multi":o}),{ref:r},s),n)},Dc=function(t,n){var s=t.theme,r=s.spacing.baseUnit,o=s.colors;return z({textAlign:"center"},n?{}:{color:o.neutral40,padding:"".concat(r*2,"px ").concat(r*3,"px")})},kp=Dc,Rp=Dc,Ap=function(t){var n=t.children,s=n===void 0?"No options":n,r=t.innerProps,o=Ue(t,Sp);return L("div",_({},re(z(z({},o),{},{children:s,innerProps:r}),"noOptionsMessage",{"menu-notice":!0,"menu-notice--no-options":!0}),r),s)},Lp=function(t){var n=t.children,s=n===void 0?"Loading...":n,r=t.innerProps,o=Ue(t,jp);return L("div",_({},re(z(z({},o),{},{children:s,innerProps:r}),"loadingMessage",{"menu-notice":!0,"menu-notice--loading":!0}),r),s)},Fp=function(t){var n=t.rect,s=t.offset,r=t.position;return{left:n.left,position:r,top:s,width:n.width,zIndex:1}},$p=function(t){var n=t.appendTo,s=t.children,r=t.controlElement,o=t.innerProps,a=t.menuPlacement,i=t.menuPosition,l=b.useRef(null),u=b.useRef(null),d=b.useState(Mc(a)),h=$e(d,2),f=h[0],p=h[1],g=b.useMemo(function(){return{setPortalPlacement:p}},[]),m=b.useState(null),y=$e(m,2),v=y[0],x=y[1],C=b.useCallback(function(){if(r){var S=gp(r),P=i==="fixed"?0:window.pageYOffset,N=S[f]+P;(N!==v?.offset||S.left!==v?.rect.left||S.width!==v?.rect.width)&&x({offset:N,rect:S})}},[r,i,f,v?.offset,v?.rect.left,v?.rect.width]);hs(function(){C()},[C]);var E=b.useCallback(function(){typeof u.current=="function"&&(u.current(),u.current=null),r&&l.current&&(u.current=gd(r,l.current,C,{elementResize:"ResizeObserver"in window}))},[r,C]);hs(function(){E()},[E]);var w=b.useCallback(function(S){l.current=S,E()},[E]);if(!n&&i!=="fixed"||!v)return null;var j=L("div",_({ref:w},re(z(z({},t),{},{offset:v.offset,position:i,rect:v.rect}),"menuPortal",{"menu-portal":!0}),o),s);return L(Tc.Provider,{value:g},n?Ri.createPortal(j,n):j)},zp=function(t){var n=t.isDisabled,s=t.isRtl;return{label:"container",direction:s?"rtl":void 0,pointerEvents:n?"none":void 0,position:"relative"}},_p=function(t){var n=t.children,s=t.innerProps,r=t.isDisabled,o=t.isRtl;return L("div",_({},re(t,"container",{"--is-disabled":r,"--is-rtl":o}),s),n)},Up=function(t,n){var s=t.theme.spacing,r=t.isMulti,o=t.hasValue,a=t.selectProps.controlShouldRenderValue;return z({alignItems:"center",display:r&&o&&a?"flex":"grid",flex:1,flexWrap:"wrap",WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"},n?{}:{padding:"".concat(s.baseUnit/2,"px ").concat(s.baseUnit*2,"px")})},Vp=function(t){var n=t.children,s=t.innerProps,r=t.isMulti,o=t.hasValue;return L("div",_({},re(t,"valueContainer",{"value-container":!0,"value-container--is-multi":r,"value-container--has-value":o}),s),n)},Bp=function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},Hp=function(t){var n=t.children,s=t.innerProps;return L("div",_({},re(t,"indicatorsContainer",{indicators:!0}),s),n)},pa,Wp=["size"],qp=["innerProps","isRtl","size"],Gp={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},kc=function(t){var n=t.size,s=Ue(t,Wp);return L("svg",_({height:n,width:n,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:Gp},s))},lo=function(t){return L(kc,_({size:20},t),L("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"}))},Rc=function(t){return L(kc,_({size:20},t),L("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},Ac=function(t,n){var s=t.isFocused,r=t.theme,o=r.spacing.baseUnit,a=r.colors;return z({label:"indicatorContainer",display:"flex",transition:"color 150ms"},n?{}:{color:s?a.neutral60:a.neutral20,padding:o*2,":hover":{color:s?a.neutral80:a.neutral40}})},Qp=Ac,Yp=function(t){var n=t.children,s=t.innerProps;return L("div",_({},re(t,"dropdownIndicator",{indicator:!0,"dropdown-indicator":!0}),s),n||L(Rc,null))},Kp=Ac,Xp=function(t){var n=t.children,s=t.innerProps;return L("div",_({},re(t,"clearIndicator",{indicator:!0,"clear-indicator":!0}),s),n||L(lo,null))},Jp=function(t,n){var s=t.isDisabled,r=t.theme,o=r.spacing.baseUnit,a=r.colors;return z({label:"indicatorSeparator",alignSelf:"stretch",width:1},n?{}:{backgroundColor:s?a.neutral10:a.neutral20,marginBottom:o*2,marginTop:o*2})},Zp=function(t){var n=t.innerProps;return L("span",_({},n,re(t,"indicatorSeparator",{"indicator-separator":!0})))},em=cp(pa||(pa=lp([`
1
+ import{r as b,R as Ho,a as K}from"./sentry_react-cODD7zWc.js";import{j as c,u as ki,r as Ri,C as Ai,b as Xs,a as We}from"./document_model_editor-QUld_aUx.js";import{c as Js,d as Li,e as Fi,f as Gu,s as Qu,g as xt,h as Yu,i as Ku,j as Xu,k as br,l as Ju,m as Zu,n as ed,o as td,p as nd,q as rd,r as sd,t as od,v as ad,w as $i,x as id,S as Fe}from"./reactor_browser-i5whXQtt.js";import{P as Nt,a as zi,b as _i,u as Ui,d as Vi,R as cd,A as ld,e as Ae,f as Zs,g as ud,D as dd,C as fd,h as hd,i as pd,j as md,I as O,k as gd,m as ce,l as Pe,M as _e,n as bd,o as Bi,p as yd,q as vd,r as xd,s as wd,t as Cd,v as Sd,c as Hi,w as jd,x as Pd,S as Nd,y as Ed,z as Od,B as Id}from"./design_system-OamFlF5e.js";import{t as M,a as eo}from"./tailwind_merge-Dr4f9Rms.js";import{a6 as Md,a7 as Td,Z as Wo,o as Dd,s as kd}from"./document_model-_oCbt5YE.js";import{c as En,g as Wi}from"./react-DQSxOgtG.js";import{p as is,q as Rd}from"./document_drive-Bubv8iix.js";import{o as Ad,r as qo,s as Mt}from"./zod-9j67vCAu.js";import{P as Ld,a as Fd,b as $d,S as qi,I as zd,c as _d}from"./design_system_ui-C91aaCcj.js";import{_ as Ud}from"./drive_explorer-BFislAzR.js";var Vd=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Bd="VisuallyHidden",Gi=b.forwardRef((e,t)=>c.jsx(Nt.span,{...e,ref:t,style:{...Vd,...e.style}}));Gi.displayName=Bd;var Hd=Gi,[yr]=zi("Tooltip",[_i]),vr=_i(),Qi="TooltipProvider",Wd=700,cs="tooltip.open",[qd,to]=yr(Qi),Yi=e=>{const{__scopeTooltip:t,delayDuration:n=Wd,skipDelayDuration:s=300,disableHoverableContent:r=!1,children:o}=e,a=b.useRef(!0),i=b.useRef(!1),l=b.useRef(0);return b.useEffect(()=>{const u=l.current;return()=>window.clearTimeout(u)},[]),c.jsx(qd,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(l.current),a.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>a.current=!0,s)},[s]),isPointerInTransitRef:i,onPointerInTransitChange:b.useCallback(u=>{i.current=u},[]),disableHoverableContent:r,children:o})};Yi.displayName=Qi;var _t="Tooltip",[Gd,bn]=yr(_t),Ki=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:r,onOpenChange:o,disableHoverableContent:a,delayDuration:i}=e,l=to(_t,e.__scopeTooltip),u=vr(t),[d,h]=b.useState(null),f=Ui(),p=b.useRef(0),g=a??l.disableHoverableContent,m=i??l.delayDuration,y=b.useRef(!1),[v,x]=Vi({prop:s,defaultProp:r??!1,onChange:S=>{S?(l.onOpen(),document.dispatchEvent(new CustomEvent(cs))):l.onClose(),o?.(S)},caller:_t}),C=b.useMemo(()=>v?y.current?"delayed-open":"instant-open":"closed",[v]),N=b.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y.current=!1,x(!0)},[x]),w=b.useCallback(()=>{window.clearTimeout(p.current),p.current=0,x(!1)},[x]),j=b.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{y.current=!0,x(!0),p.current=0},m)},[m,x]);return b.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),c.jsx(cd,{...u,children:c.jsx(Gd,{scope:t,contentId:f,open:v,stateAttribute:C,trigger:d,onTriggerChange:h,onTriggerEnter:b.useCallback(()=>{l.isOpenDelayedRef.current?j():N()},[l.isOpenDelayedRef,j,N]),onTriggerLeave:b.useCallback(()=>{g?w():(window.clearTimeout(p.current),p.current=0)},[w,g]),onOpen:N,onClose:w,disableHoverableContent:g,children:n})})};Ki.displayName=_t;var ls="TooltipTrigger",Xi=b.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,r=bn(ls,n),o=to(ls,n),a=vr(n),i=b.useRef(null),l=ki(t,i,r.onTriggerChange),u=b.useRef(!1),d=b.useRef(!1),h=b.useCallback(()=>u.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),c.jsx(ld,{asChild:!0,...a,children:c.jsx(Nt.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...s,ref:l,onPointerMove:Ae(e.onPointerMove,f=>{f.pointerType!=="touch"&&!d.current&&!o.isPointerInTransitRef.current&&(r.onTriggerEnter(),d.current=!0)}),onPointerLeave:Ae(e.onPointerLeave,()=>{r.onTriggerLeave(),d.current=!1}),onPointerDown:Ae(e.onPointerDown,()=>{r.open&&r.onClose(),u.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Ae(e.onFocus,()=>{u.current||r.onOpen()}),onBlur:Ae(e.onBlur,r.onClose),onClick:Ae(e.onClick,r.onClose)})})});Xi.displayName=ls;var no="TooltipPortal",[Qd,Yd]=yr(no,{forceMount:void 0}),Ji=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:r}=e,o=bn(no,t);return c.jsx(Qd,{scope:t,forceMount:n,children:c.jsx(Zs,{present:n||o.open,children:c.jsx(ud,{asChild:!0,container:r,children:s})})})};Ji.displayName=no;var wt="TooltipContent",Zi=b.forwardRef((e,t)=>{const n=Yd(wt,e.__scopeTooltip),{forceMount:s=n.forceMount,side:r="top",...o}=e,a=bn(wt,e.__scopeTooltip);return c.jsx(Zs,{present:s||a.open,children:a.disableHoverableContent?c.jsx(ec,{side:r,...o,ref:t}):c.jsx(Kd,{side:r,...o,ref:t})})}),Kd=b.forwardRef((e,t)=>{const n=bn(wt,e.__scopeTooltip),s=to(wt,e.__scopeTooltip),r=b.useRef(null),o=ki(t,r),[a,i]=b.useState(null),{trigger:l,onClose:u}=n,d=r.current,{onPointerInTransitChange:h}=s,f=b.useCallback(()=>{i(null),h(!1)},[h]),p=b.useCallback((g,m)=>{const y=g.currentTarget,v={x:g.clientX,y:g.clientY},x=tf(v,y.getBoundingClientRect()),C=nf(v,x),N=rf(m.getBoundingClientRect()),w=of([...C,...N]);i(w),h(!0)},[h]);return b.useEffect(()=>()=>f(),[f]),b.useEffect(()=>{if(l&&d){const g=y=>p(y,d),m=y=>p(y,l);return l.addEventListener("pointerleave",g),d.addEventListener("pointerleave",m),()=>{l.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",m)}}},[l,d,p,f]),b.useEffect(()=>{if(a){const g=m=>{const y=m.target,v={x:m.clientX,y:m.clientY},x=l?.contains(y)||d?.contains(y),C=!sf(v,a);x?f():C&&(f(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[l,d,a,u,f]),c.jsx(ec,{...e,ref:o})}),[Xd,Jd]=yr(_t,{isInside:!1}),Zd=hd("TooltipContent"),ec=b.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":r,onEscapeKeyDown:o,onPointerDownOutside:a,...i}=e,l=bn(wt,n),u=vr(n),{onClose:d}=l;return b.useEffect(()=>(document.addEventListener(cs,d),()=>document.removeEventListener(cs,d)),[d]),b.useEffect(()=>{if(l.trigger){const h=f=>{f.target?.contains(l.trigger)&&d()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[l.trigger,d]),c.jsx(dd,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:c.jsxs(fd,{"data-state":l.stateAttribute,...u,...i,ref:t,style:{...i.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[c.jsx(Zd,{children:s}),c.jsx(Xd,{scope:n,isInside:!0,children:c.jsx(Hd,{id:l.contentId,role:"tooltip",children:r||s})})]})})});Zi.displayName=wt;var tc="TooltipArrow",ef=b.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,r=vr(n);return Jd(tc,n).isInside?null:c.jsx(pd,{...r,...s,ref:t})});ef.displayName=tc;function tf(e,t){const n=Math.abs(t.top-e.y),s=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,s,r,o)){case o:return"left";case r:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function nf(e,t,n=5){const s=[];switch(t){case"top":s.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":s.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":s.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":s.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return s}function rf(e){const{top:t,right:n,bottom:s,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:s},{x:r,y:s}]}function sf(e,t){const{x:n,y:s}=e;let r=!1;for(let o=0,a=t.length-1;o<t.length;a=o++){const i=t[o],l=t[a],u=i.x,d=i.y,h=l.x,f=l.y;d>s!=f>s&&n<(h-u)*(s-d)/(f-d)+u&&(r=!r)}return r}function of(e){const t=e.slice();return t.sort((n,s)=>n.x<s.x?-1:n.x>s.x?1:n.y<s.y?-1:n.y>s.y?1:0),af(t)}function af(e){if(e.length<=1)return e.slice();const t=[];for(let s=0;s<e.length;s++){const r=e[s];for(;t.length>=2;){const o=t[t.length-1],a=t[t.length-2];if((o.x-a.x)*(r.y-a.y)>=(o.y-a.y)*(r.x-a.x))t.pop();else break}t.push(r)}t.pop();const n=[];for(let s=e.length-1;s>=0;s--){const r=e[s];for(;n.length>=2;){const o=n[n.length-1],a=n[n.length-2];if((o.x-a.x)*(r.y-a.y)>=(o.y-a.y)*(r.x-a.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var cf=Yi,lf=Ki,uf=Xi,df=Ji,ff=Zi;const nc=6048e5,hf=864e5,rc=6e4,sc=36e5,On=43200,Go=1440,Qo=Symbol.for("constructDateFrom");function Te(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&Qo in e?e[Qo](t):e instanceof Date?new e.constructor(t):new Date(t)}function ie(e,t){return Te(t||e,e)}let pf={};function yn(){return pf}function Ut(e,t){const n=yn(),s=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,r=ie(e,t?.in),o=r.getDay(),a=(o<s?7:0)+o-s;return r.setDate(r.getDate()-a),r.setHours(0,0,0,0),r}function Zn(e,t){return Ut(e,{...t,weekStartsOn:1})}function oc(e,t){const n=ie(e,t?.in),s=n.getFullYear(),r=Te(n,0);r.setFullYear(s+1,0,4),r.setHours(0,0,0,0);const o=Zn(r),a=Te(n,0);a.setFullYear(s,0,4),a.setHours(0,0,0,0);const i=Zn(a);return n.getTime()>=o.getTime()?s+1:n.getTime()>=i.getTime()?s:s-1}function er(e){const t=ie(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function xr(e,...t){const n=Te.bind(null,e||t.find(s=>typeof s=="object"));return t.map(n)}function Yo(e,t){const n=ie(e,t?.in);return n.setHours(0,0,0,0),n}function mf(e,t,n){const[s,r]=xr(n?.in,e,t),o=Yo(s),a=Yo(r),i=+o-er(o),l=+a-er(a);return Math.round((i-l)/hf)}function gf(e,t){const n=oc(e,t),s=Te(e,0);return s.setFullYear(n,0,4),s.setHours(0,0,0,0),Zn(s)}function Hn(e,t){const n=+ie(e)-+ie(t);return n<0?-1:n>0?1:n}function bf(e){return Te(e,Date.now())}function yf(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function vf(e){return!(!yf(e)&&typeof e!="number"||isNaN(+ie(e)))}function xf(e,t,n){const[s,r]=xr(n?.in,e,t),o=s.getFullYear()-r.getFullYear(),a=s.getMonth()-r.getMonth();return o*12+a}function wf(e){return t=>{const s=(e?Math[e]:Math.trunc)(t);return s===0?0:s}}function Cf(e,t){return+ie(e)-+ie(t)}function Sf(e,t){const n=ie(e,t?.in);return n.setHours(23,59,59,999),n}function jf(e,t){const n=ie(e,t?.in),s=n.getMonth();return n.setFullYear(n.getFullYear(),s+1,0),n.setHours(23,59,59,999),n}function Pf(e,t){const n=ie(e,t?.in);return+Sf(n,t)==+jf(n,t)}function Nf(e,t,n){const[s,r,o]=xr(n?.in,e,e,t),a=Hn(r,o),i=Math.abs(xf(r,o));if(i<1)return 0;r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-a*i);let l=Hn(r,o)===-a;Pf(s)&&i===1&&Hn(s,o)===1&&(l=!1);const u=a*(i-+l);return u===0?0:u}function Ef(e,t,n){const s=Cf(e,t)/1e3;return wf(n?.roundingMethod)(s)}function Of(e,t){const n=ie(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const If={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Mf=(e,t,n)=>{let s;const r=If[e];return typeof r=="string"?s=r:t===1?s=r.one:s=r.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+s:s+" ago":s};function Lr(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const Tf={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Df={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},kf={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Rf={date:Lr({formats:Tf,defaultWidth:"full"}),time:Lr({formats:Df,defaultWidth:"full"}),dateTime:Lr({formats:kf,defaultWidth:"full"})},Af={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Lf=(e,t,n,s)=>Af[e];function Tt(e){return(t,n)=>{const s=n?.context?String(n.context):"standalone";let r;if(s==="formatting"&&e.formattingValues){const a=e.defaultFormattingWidth||e.defaultWidth,i=n?.width?String(n.width):a;r=e.formattingValues[i]||e.formattingValues[a]}else{const a=e.defaultWidth,i=n?.width?String(n.width):e.defaultWidth;r=e.values[i]||e.values[a]}const o=e.argumentCallback?e.argumentCallback(t):t;return r[o]}}const Ff={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},$f={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},zf={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},_f={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Uf={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Vf={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Bf=(e,t)=>{const n=Number(e),s=n%100;if(s>20||s<10)switch(s%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},Hf={ordinalNumber:Bf,era:Tt({values:Ff,defaultWidth:"wide"}),quarter:Tt({values:$f,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Tt({values:zf,defaultWidth:"wide"}),day:Tt({values:_f,defaultWidth:"wide"}),dayPeriod:Tt({values:Uf,defaultWidth:"wide",formattingValues:Vf,defaultFormattingWidth:"wide"})};function Dt(e){return(t,n={})=>{const s=n.width,r=s&&e.matchPatterns[s]||e.matchPatterns[e.defaultMatchWidth],o=t.match(r);if(!o)return null;const a=o[0],i=s&&e.parsePatterns[s]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(i)?qf(i,h=>h.test(a)):Wf(i,h=>h.test(a));let u;u=e.valueCallback?e.valueCallback(l):l,u=n.valueCallback?n.valueCallback(u):u;const d=t.slice(a.length);return{value:u,rest:d}}}function Wf(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function qf(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function Gf(e){return(t,n={})=>{const s=t.match(e.matchPattern);if(!s)return null;const r=s[0],o=t.match(e.parsePattern);if(!o)return null;let a=e.valueCallback?e.valueCallback(o[0]):o[0];a=n.valueCallback?n.valueCallback(a):a;const i=t.slice(r.length);return{value:a,rest:i}}}const Qf=/^(\d+)(th|st|nd|rd)?/i,Yf=/\d+/i,Kf={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Xf={any:[/^b/i,/^(a|c)/i]},Jf={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Zf={any:[/1/i,/2/i,/3/i,/4/i]},e0={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},t0={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},n0={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},r0={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},s0={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},o0={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},a0={ordinalNumber:Gf({matchPattern:Qf,parsePattern:Yf,valueCallback:e=>parseInt(e,10)}),era:Dt({matchPatterns:Kf,defaultMatchWidth:"wide",parsePatterns:Xf,defaultParseWidth:"any"}),quarter:Dt({matchPatterns:Jf,defaultMatchWidth:"wide",parsePatterns:Zf,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Dt({matchPatterns:e0,defaultMatchWidth:"wide",parsePatterns:t0,defaultParseWidth:"any"}),day:Dt({matchPatterns:n0,defaultMatchWidth:"wide",parsePatterns:r0,defaultParseWidth:"any"}),dayPeriod:Dt({matchPatterns:s0,defaultMatchWidth:"any",parsePatterns:o0,defaultParseWidth:"any"})},ac={code:"en-US",formatDistance:Mf,formatLong:Rf,formatRelative:Lf,localize:Hf,match:a0,options:{weekStartsOn:0,firstWeekContainsDate:1}};function i0(e,t){const n=ie(e,t?.in);return mf(n,Of(n))+1}function c0(e,t){const n=ie(e,t?.in),s=+Zn(n)-+gf(n);return Math.round(s/nc)+1}function ic(e,t){const n=ie(e,t?.in),s=n.getFullYear(),r=yn(),o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=Te(t?.in||e,0);a.setFullYear(s+1,0,o),a.setHours(0,0,0,0);const i=Ut(a,t),l=Te(t?.in||e,0);l.setFullYear(s,0,o),l.setHours(0,0,0,0);const u=Ut(l,t);return+n>=+i?s+1:+n>=+u?s:s-1}function l0(e,t){const n=yn(),s=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,r=ic(e,t),o=Te(t?.in||e,0);return o.setFullYear(r,0,s),o.setHours(0,0,0,0),Ut(o,t)}function u0(e,t){const n=ie(e,t?.in),s=+Ut(n,t)-+l0(n,t);return Math.round(s/nc)+1}function X(e,t){const n=e<0?"-":"",s=Math.abs(e).toString().padStart(t,"0");return n+s}const He={y(e,t){const n=e.getFullYear(),s=n>0?n:1-n;return X(t==="yy"?s%100:s,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):X(n+1,2)},d(e,t){return X(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return X(e.getHours()%12||12,t.length)},H(e,t){return X(e.getHours(),t.length)},m(e,t){return X(e.getMinutes(),t.length)},s(e,t){return X(e.getSeconds(),t.length)},S(e,t){const n=t.length,s=e.getMilliseconds(),r=Math.trunc(s*Math.pow(10,n-3));return X(r,t.length)}},dt={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Ko={G:function(e,t,n){const s=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(s,{width:"abbreviated"});case"GGGGG":return n.era(s,{width:"narrow"});case"GGGG":default:return n.era(s,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const s=e.getFullYear(),r=s>0?s:1-s;return n.ordinalNumber(r,{unit:"year"})}return He.y(e,t)},Y:function(e,t,n,s){const r=ic(e,s),o=r>0?r:1-r;if(t==="YY"){const a=o%100;return X(a,2)}return t==="Yo"?n.ordinalNumber(o,{unit:"year"}):X(o,t.length)},R:function(e,t){const n=oc(e);return X(n,t.length)},u:function(e,t){const n=e.getFullYear();return X(n,t.length)},Q:function(e,t,n){const s=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(s);case"QQ":return X(s,2);case"Qo":return n.ordinalNumber(s,{unit:"quarter"});case"QQQ":return n.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(s,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(s,{width:"wide",context:"formatting"})}},q:function(e,t,n){const s=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(s);case"qq":return X(s,2);case"qo":return n.ordinalNumber(s,{unit:"quarter"});case"qqq":return n.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(s,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(s,{width:"wide",context:"standalone"})}},M:function(e,t,n){const s=e.getMonth();switch(t){case"M":case"MM":return He.M(e,t);case"Mo":return n.ordinalNumber(s+1,{unit:"month"});case"MMM":return n.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(s,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(s,{width:"wide",context:"formatting"})}},L:function(e,t,n){const s=e.getMonth();switch(t){case"L":return String(s+1);case"LL":return X(s+1,2);case"Lo":return n.ordinalNumber(s+1,{unit:"month"});case"LLL":return n.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(s,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(s,{width:"wide",context:"standalone"})}},w:function(e,t,n,s){const r=u0(e,s);return t==="wo"?n.ordinalNumber(r,{unit:"week"}):X(r,t.length)},I:function(e,t,n){const s=c0(e);return t==="Io"?n.ordinalNumber(s,{unit:"week"}):X(s,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):He.d(e,t)},D:function(e,t,n){const s=i0(e);return t==="Do"?n.ordinalNumber(s,{unit:"dayOfYear"}):X(s,t.length)},E:function(e,t,n){const s=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(s,{width:"short",context:"formatting"});case"EEEE":default:return n.day(s,{width:"wide",context:"formatting"})}},e:function(e,t,n,s){const r=e.getDay(),o=(r-s.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return X(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(r,{width:"short",context:"formatting"});case"eeee":default:return n.day(r,{width:"wide",context:"formatting"})}},c:function(e,t,n,s){const r=e.getDay(),o=(r-s.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return X(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(r,{width:"narrow",context:"standalone"});case"cccccc":return n.day(r,{width:"short",context:"standalone"});case"cccc":default:return n.day(r,{width:"wide",context:"standalone"})}},i:function(e,t,n){const s=e.getDay(),r=s===0?7:s;switch(t){case"i":return String(r);case"ii":return X(r,t.length);case"io":return n.ordinalNumber(r,{unit:"day"});case"iii":return n.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(s,{width:"short",context:"formatting"});case"iiii":default:return n.day(s,{width:"wide",context:"formatting"})}},a:function(e,t,n){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,t,n){const s=e.getHours();let r;switch(s===12?r=dt.noon:s===0?r=dt.midnight:r=s/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(e,t,n){const s=e.getHours();let r;switch(s>=17?r=dt.evening:s>=12?r=dt.afternoon:s>=4?r=dt.morning:r=dt.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let s=e.getHours()%12;return s===0&&(s=12),n.ordinalNumber(s,{unit:"hour"})}return He.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):He.H(e,t)},K:function(e,t,n){const s=e.getHours()%12;return t==="Ko"?n.ordinalNumber(s,{unit:"hour"}):X(s,t.length)},k:function(e,t,n){let s=e.getHours();return s===0&&(s=24),t==="ko"?n.ordinalNumber(s,{unit:"hour"}):X(s,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):He.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):He.s(e,t)},S:function(e,t){return He.S(e,t)},X:function(e,t,n){const s=e.getTimezoneOffset();if(s===0)return"Z";switch(t){case"X":return Jo(s);case"XXXX":case"XX":return Xe(s);case"XXXXX":case"XXX":default:return Xe(s,":")}},x:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"x":return Jo(s);case"xxxx":case"xx":return Xe(s);case"xxxxx":case"xxx":default:return Xe(s,":")}},O:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Xo(s,":");case"OOOO":default:return"GMT"+Xe(s,":")}},z:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Xo(s,":");case"zzzz":default:return"GMT"+Xe(s,":")}},t:function(e,t,n){const s=Math.trunc(+e/1e3);return X(s,t.length)},T:function(e,t,n){return X(+e,t.length)}};function Xo(e,t=""){const n=e>0?"-":"+",s=Math.abs(e),r=Math.trunc(s/60),o=s%60;return o===0?n+String(r):n+String(r)+t+X(o,2)}function Jo(e,t){return e%60===0?(e>0?"-":"+")+X(Math.abs(e)/60,2):Xe(e,t)}function Xe(e,t=""){const n=e>0?"-":"+",s=Math.abs(e),r=X(Math.trunc(s/60),2),o=X(s%60,2);return n+r+t+o}const Zo=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},cc=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},d0=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],s=n[1],r=n[2];if(!r)return Zo(e,t);let o;switch(s){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;case"PPPP":default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",Zo(s,t)).replace("{{time}}",cc(r,t))},f0={p:cc,P:d0},h0=/^D+$/,p0=/^Y+$/,m0=["D","DD","YY","YYYY"];function g0(e){return h0.test(e)}function b0(e){return p0.test(e)}function y0(e,t,n){const s=v0(e,t,n);if(console.warn(s),m0.includes(e))throw new RangeError(s)}function v0(e,t,n){const s=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${s} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const x0=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,w0=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,C0=/^'([^]*?)'?$/,S0=/''/g,j0=/[a-zA-Z]/;function tr(e,t,n){const s=yn(),r=s.locale??ac,o=s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,a=s.weekStartsOn??s.locale?.options?.weekStartsOn??0,i=ie(e,n?.in);if(!vf(i))throw new RangeError("Invalid time value");let l=t.match(w0).map(d=>{const h=d[0];if(h==="p"||h==="P"){const f=f0[h];return f(d,r.formatLong)}return d}).join("").match(x0).map(d=>{if(d==="''")return{isToken:!1,value:"'"};const h=d[0];if(h==="'")return{isToken:!1,value:P0(d)};if(Ko[h])return{isToken:!0,value:d};if(h.match(j0))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");return{isToken:!1,value:d}});r.localize.preprocessor&&(l=r.localize.preprocessor(i,l));const u={firstWeekContainsDate:o,weekStartsOn:a,locale:r};return l.map(d=>{if(!d.isToken)return d.value;const h=d.value;(b0(h)||g0(h))&&y0(h,t,String(e));const f=Ko[h[0]];return f(i,h,r.localize,u)}).join("")}function P0(e){const t=e.match(C0);return t?t[1].replace(S0,"'"):e}function N0(e,t,n){const s=yn(),r=n?.locale??s.locale??ac,o=2520,a=Hn(e,t);if(isNaN(a))throw new RangeError("Invalid time value");const i=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:a}),[l,u]=xr(n?.in,...a>0?[t,e]:[e,t]),d=Ef(u,l),h=(er(u)-er(l))/1e3,f=Math.round((d-h)/60);let p;if(f<2)return n?.includeSeconds?d<5?r.formatDistance("lessThanXSeconds",5,i):d<10?r.formatDistance("lessThanXSeconds",10,i):d<20?r.formatDistance("lessThanXSeconds",20,i):d<40?r.formatDistance("halfAMinute",0,i):d<60?r.formatDistance("lessThanXMinutes",1,i):r.formatDistance("xMinutes",1,i):f===0?r.formatDistance("lessThanXMinutes",1,i):r.formatDistance("xMinutes",f,i);if(f<45)return r.formatDistance("xMinutes",f,i);if(f<90)return r.formatDistance("aboutXHours",1,i);if(f<Go){const g=Math.round(f/60);return r.formatDistance("aboutXHours",g,i)}else{if(f<o)return r.formatDistance("xDays",1,i);if(f<On){const g=Math.round(f/Go);return r.formatDistance("xDays",g,i)}else if(f<On*2)return p=Math.round(f/On),r.formatDistance("aboutXMonths",p,i)}if(p=Nf(u,l),p<12){const g=Math.round(f/On);return r.formatDistance("xMonths",g,i)}else{const g=p%12,m=Math.trunc(p/12);return g<3?r.formatDistance("aboutXYears",m,i):g<9?r.formatDistance("overXYears",m,i):r.formatDistance("almostXYears",m+1,i)}}function E0(e,t){return N0(e,bf(e),t)}function O0(e,t){const n=()=>Te(t?.in,NaN),r=D0(e);let o;if(r.date){const u=k0(r.date,2);o=R0(u.restDateString,u.year)}if(!o||isNaN(+o))return n();const a=+o;let i=0,l;if(r.time&&(i=A0(r.time),isNaN(i)))return n();if(r.timezone){if(l=L0(r.timezone),isNaN(l))return n()}else{const u=new Date(a+i),d=ie(0,t?.in);return d.setFullYear(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()),d.setHours(u.getUTCHours(),u.getUTCMinutes(),u.getUTCSeconds(),u.getUTCMilliseconds()),d}return ie(a+i+l,t?.in)}const In={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},I0=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,M0=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,T0=/^([+-])(\d{2})(?::?(\d{2}))?$/;function D0(e){const t={},n=e.split(In.dateTimeDelimiter);let s;if(n.length>2)return t;if(/:/.test(n[0])?s=n[0]:(t.date=n[0],s=n[1],In.timeZoneDelimiter.test(t.date)&&(t.date=e.split(In.timeZoneDelimiter)[0],s=e.substr(t.date.length,e.length))),s){const r=In.timezone.exec(s);r?(t.time=s.replace(r[1],""),t.timezone=r[1]):t.time=s}return t}function k0(e,t){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),s=e.match(n);if(!s)return{year:NaN,restDateString:""};const r=s[1]?parseInt(s[1]):null,o=s[2]?parseInt(s[2]):null;return{year:o===null?r:o*100,restDateString:e.slice((s[1]||s[2]).length)}}function R0(e,t){if(t===null)return new Date(NaN);const n=e.match(I0);if(!n)return new Date(NaN);const s=!!n[4],r=kt(n[1]),o=kt(n[2])-1,a=kt(n[3]),i=kt(n[4]),l=kt(n[5])-1;if(s)return U0(t,i,l)?F0(t,i,l):new Date(NaN);{const u=new Date(0);return!z0(t,o,a)||!_0(t,r)?new Date(NaN):(u.setUTCFullYear(t,o,Math.max(r,a)),u)}}function kt(e){return e?parseInt(e):1}function A0(e){const t=e.match(M0);if(!t)return NaN;const n=Fr(t[1]),s=Fr(t[2]),r=Fr(t[3]);return V0(n,s,r)?n*sc+s*rc+r*1e3:NaN}function Fr(e){return e&&parseFloat(e.replace(",","."))||0}function L0(e){if(e==="Z")return 0;const t=e.match(T0);if(!t)return 0;const n=t[1]==="+"?-1:1,s=parseInt(t[2]),r=t[3]&&parseInt(t[3])||0;return B0(s,r)?n*(s*sc+r*rc):NaN}function F0(e,t,n){const s=new Date(0);s.setUTCFullYear(e,0,4);const r=s.getUTCDay()||7,o=(t-1)*7+n+1-r;return s.setUTCDate(s.getUTCDate()+o),s}const $0=[31,null,31,30,31,30,31,31,30,31,30,31];function lc(e){return e%400===0||e%4===0&&e%100!==0}function z0(e,t,n){return t>=0&&t<=11&&n>=1&&n<=($0[t]||(lc(e)?29:28))}function _0(e,t){return t>=1&&t<=(lc(e)?366:365)}function U0(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function V0(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function B0(e,t){return t>=0&&t<=59}var $r,ea;function H0(){if(ea)return $r;ea=1;var e="Expected a function",t=NaN,n="[object Symbol]",s=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,a=/^0o[0-7]+$/i,i=parseInt,l=typeof En=="object"&&En&&En.Object===Object&&En,u=typeof self=="object"&&self&&self.Object===Object&&self,d=l||u||Function("return this")(),h=Object.prototype,f=h.toString,p=Math.max,g=Math.min,m=function(){return d.Date.now()};function y(w,j,S){var P,E,T,I,D,R,F=0,_=!1,U=!1,H=!0;if(typeof w!="function")throw new TypeError(e);j=N(j)||0,v(S)&&(_=!!S.leading,U="maxWait"in S,T=U?p(N(S.maxWait)||0,j):T,H="trailing"in S?!!S.trailing:H);function G(q){var oe=P,Ne=E;return P=E=void 0,F=q,I=w.apply(Ne,oe),I}function W(q){return F=q,D=setTimeout(V,j),_?G(q):I}function ee(q){var oe=q-R,Ne=q-F,Nn=j-oe;return U?g(Nn,T-Ne):Nn}function re(q){var oe=q-R,Ne=q-F;return R===void 0||oe>=j||oe<0||U&&Ne>=T}function V(){var q=m();if(re(q))return A(q);D=setTimeout(V,ee(q))}function A(q){return D=void 0,H&&P?G(q):(P=E=void 0,I)}function B(){D!==void 0&&clearTimeout(D),F=0,P=R=E=D=void 0}function te(){return D===void 0?I:A(m())}function ne(){var q=m(),oe=re(q);if(P=arguments,E=this,R=q,oe){if(D===void 0)return W(R);if(U)return D=setTimeout(V,j),G(R)}return D===void 0&&(D=setTimeout(V,j)),I}return ne.cancel=B,ne.flush=te,ne}function v(w){var j=typeof w;return!!w&&(j=="object"||j=="function")}function x(w){return!!w&&typeof w=="object"}function C(w){return typeof w=="symbol"||x(w)&&f.call(w)==n}function N(w){if(typeof w=="number")return w;if(C(w))return t;if(v(w)){var j=typeof w.valueOf=="function"?w.valueOf():w;w=v(j)?j+"":j}if(typeof w!="string")return w===0?w:+w;w=w.replace(s,"");var S=o.test(w);return S||a.test(w)?i(w.slice(2),S?2:8):r.test(w)?t:+w}return $r=y,$r}var W0=H0();const ta=Wi(W0);var uc=typeof window<"u"?b.useLayoutEffect:b.useEffect;function dc(e,t,n,s){const r=b.useRef(t);uc(()=>{r.current=t},[t]),b.useEffect(()=>{const o=window;if(!(o&&o.addEventListener))return;const a=i=>{r.current(i)};return o.addEventListener(e,a,s),()=>{o.removeEventListener(e,a,s)}},[e,n,s])}function wr(){const[e,t]=b.useState(null),n=b.useCallback(async s=>{if(!navigator?.clipboard)return console.warn("Clipboard not supported"),!1;try{return await navigator.clipboard.writeText(s),t(s),!0}catch(r){return console.warn("Copy failed",r),t(null),!1}},[]);return[e,n]}var q0=typeof window>"u";function vw(e,{defaultValue:t=!1,initializeWithValue:n=!0}={}){const s=i=>q0?t:window.matchMedia(i).matches,[r,o]=b.useState(()=>n?s(e):t);function a(){o(s(e))}return uc(()=>{const i=window.matchMedia(e);return a(),i.addListener?i.addListener(a):i.addEventListener("change",a),()=>{i.removeListener?i.removeListener(a):i.removeEventListener("change",a)}},[e]),r}function G0(e){const t=b.useRef(e);t.current=e,b.useEffect(()=>()=>{t.current()},[])}function Q0(e,t=500,n){const s=b.useRef();G0(()=>{s.current&&s.current.cancel()});const r=b.useMemo(()=>{const o=ta(e,t,n),a=(...i)=>o(...i);return a.cancel=()=>{o.cancel()},a.isPending=()=>!!s.current,a.flush=()=>o.flush(),a},[e,t,n]);return b.useEffect(()=>{s.current=ta(e,t,n)},[e,t,n]),r}function Y0(e,t,n){const s=((u,d)=>u===d),r=e instanceof Function?e():e,[o,a]=b.useState(r),i=b.useRef(r),l=Q0(a,t,n);return s(i.current,r)||(l(r),i.current=r),[o,l]}function K0(e,t,n="mousedown",s={}){dc(n,r=>{const o=r.target;if(!o||!o.isConnected)return;(Array.isArray(e)?e.filter(i=>!!i.current).every(i=>i.current&&!i.current.contains(o)):e.current&&!e.current.contains(o))&&t(r)},void 0,s)}const fc=({children:e,content:t})=>c.jsxs(Ld,{children:[c.jsx(Fd,{asChild:!0,children:c.jsx("button",{type:"button","aria-label":"Open Account",className:"cursor-pointer",children:e})}),c.jsx($d,{className:"w-52 p-0",align:"start",children:t})]}),X0=new URL("/assets/connect-loader-CvOC68Ih.mp4",import.meta.url).href;function J0(e){const{style:t,size:n=100,...s}=e,r=md(n),o={objectFit:"contain",pointerEvents:"none",...r,...t},a=r.width?.replace("px",""),i=r.height?.replace("px","");return c.jsx("video",{autoPlay:!0,height:i,loop:!0,muted:!0,playsInline:!0,width:a,...s,style:o,children:c.jsx("source",{src:X0,type:"video/mp4"})})}function Cr(e){const{onSubmit:t,onCancel:n,defaultValue:s,className:r,minLength:o=1,...a}=e,[i,l]=b.useState(s??""),u=b.useRef(null);K0(u,d),dc("keyup",h=>{h.key==="Enter"&&d(),h.key==="Escape"&&n()}),b.useLayoutEffect(()=>{setTimeout(()=>{u.current?.focus(),u.current?.select(),u.current?.scroll({left:9999})},100)},[]);function d(){i.length>=o&&t(i)}return c.jsx("input",{...a,autoFocus:!0,className:M("bg-inherit text-inherit outline-none",r),minLength:o,onChange:h=>l(h.target.value),ref:u,required:!0,type:"text",value:i})}function xw(){const{isAllowedToCreateDocuments:e}=Js(),[t]=Li(),n=Fi(),s=Gu(),[r,o]=b.useState(!1);function a(){o(!0)}function i(h){!e||!n||Yu(n,h,s.at(-1)?.id).then(f=>{xt(f)}).catch(f=>{console.error(f)}).finally(()=>{o(!1)})}function l(){o(!1)}const u=!!t,d=!!s.length;return c.jsxs("div",{className:"flex h-9 flex-row items-center gap-2 p-6 text-gray-500",children:[u&&c.jsxs(c.Fragment,{children:[c.jsx(na,{name:t.state.global.name,onClick:()=>Qu(t)}),c.jsx("span",{children:"/"})]}),d&&s.map(h=>c.jsxs(b.Fragment,{children:[c.jsx(na,{name:h.name,onClick:()=>xt(h)}),c.jsx("span",{children:"/"})]},h.id)),e&&(r?c.jsx(Cr,{className:"text-gray-800",defaultValue:"New Folder",onCancel:l,onSubmit:i,placeholder:"New Folder"}):c.jsxs("button",{type:"button",className:"ml-1 flex items-center justify-center gap-2 rounded-md bg-gray-50 px-2 py-1.5 transition-colors hover:bg-gray-200 hover:text-gray-800",onClick:a,children:[c.jsx(O,{name:"Plus",size:14}),"Add new"]}))]})}function na(e){const{name:t,onClick:n}=e;return c.jsx("div",{className:"transition-colors last-of-type:text-gray-800 hover:text-gray-800",onClick:n,role:"button",children:t})}function st(e){"@babel/helpers - typeof";return st=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},st(e)}function Z0(e,t){if(st(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(st(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function hc(e){var t=Z0(e,"string");return st(t)=="symbol"?t:t+""}function $t(e,t,n){return(t=hc(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ra(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,s)}return n}function $(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ra(Object(n),!0).forEach(function(s){$t(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ra(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function eh(e){if(Array.isArray(e))return e}function th(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s,r,o,a,i=[],l=!0,u=!1;try{if(o=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;l=!1}else for(;!(l=(s=o.call(n)).done)&&(i.push(s.value),i.length!==t);l=!0);}catch(d){u=!0,r=d}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw r}}return i}}function us(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=Array(t);n<t;n++)s[n]=e[n];return s}function pc(e,t){if(e){if(typeof e=="string")return us(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?us(e,t):void 0}}function nh(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $e(e,t){return eh(e)||th(e,t)||pc(e,t)||nh()}function rh(e,t){if(e==null)return{};var n={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(t.indexOf(s)!==-1)continue;n[s]=e[s]}return n}function Ue(e,t){if(e==null)return{};var n,s,r=rh(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)n=o[s],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var sh=["defaultInputValue","defaultMenuIsOpen","defaultValue","inputValue","menuIsOpen","onChange","onInputChange","onMenuClose","onMenuOpen","value"];function oh(e){var t=e.defaultInputValue,n=t===void 0?"":t,s=e.defaultMenuIsOpen,r=s===void 0?!1:s,o=e.defaultValue,a=o===void 0?null:o,i=e.inputValue,l=e.menuIsOpen,u=e.onChange,d=e.onInputChange,h=e.onMenuClose,f=e.onMenuOpen,p=e.value,g=Ue(e,sh),m=b.useState(i!==void 0?i:n),y=$e(m,2),v=y[0],x=y[1],C=b.useState(l!==void 0?l:r),N=$e(C,2),w=N[0],j=N[1],S=b.useState(p!==void 0?p:a),P=$e(S,2),E=P[0],T=P[1],I=b.useCallback(function(G,W){typeof u=="function"&&u(G,W),T(G)},[u]),D=b.useCallback(function(G,W){var ee;typeof d=="function"&&(ee=d(G,W)),x(ee!==void 0?ee:G)},[d]),R=b.useCallback(function(){typeof f=="function"&&f(),j(!0)},[f]),F=b.useCallback(function(){typeof h=="function"&&h(),j(!1)},[h]),_=i!==void 0?i:v,U=l!==void 0?l:w,H=p!==void 0?p:E;return $($({},g),{},{inputValue:_,menuIsOpen:U,onChange:I,onInputChange:D,onMenuClose:F,onMenuOpen:R,value:H})}function z(){return z=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)({}).hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},z.apply(null,arguments)}function ah(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sa(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,hc(s.key),s)}}function ih(e,t,n){return t&&sa(e.prototype,t),n&&sa(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function ds(e,t){return ds=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},ds(e,t)}function ch(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ds(e,t)}function nr(e){return nr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},nr(e)}function mc(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(mc=function(){return!!e})()}function lh(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function uh(e,t){if(t&&(st(t)=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return lh(e)}function dh(e){var t=mc();return function(){var n,s=nr(e);if(t){var r=nr(this).constructor;n=Reflect.construct(s,arguments,r)}else n=s.apply(this,arguments);return uh(this,n)}}function fh(e){if(Array.isArray(e))return us(e)}function hh(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ph(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
3
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ro(e){return fh(e)||hh(e)||pc(e)||ph()}function mh(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}function gh(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),e.nonce!==void 0&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}var bh=(function(){function e(n){var s=this;this._insertTag=function(r){var o;s.tags.length===0?s.insertionPoint?o=s.insertionPoint.nextSibling:s.prepend?o=s.container.firstChild:o=s.before:o=s.tags[s.tags.length-1].nextSibling,s.container.insertBefore(r,o),s.tags.push(r)},this.isSpeedy=n.speedy===void 0?!0:n.speedy,this.tags=[],this.ctr=0,this.nonce=n.nonce,this.key=n.key,this.container=n.container,this.prepend=n.prepend,this.insertionPoint=n.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(s){s.forEach(this._insertTag)},t.insert=function(s){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(gh(this));var r=this.tags[this.tags.length-1];if(this.isSpeedy){var o=mh(r);try{o.insertRule(s,o.cssRules.length)}catch{}}else r.appendChild(document.createTextNode(s));this.ctr++},t.flush=function(){this.tags.forEach(function(s){var r;return(r=s.parentNode)==null?void 0:r.removeChild(s)}),this.tags=[],this.ctr=0},e})(),de="-ms-",rr="-moz-",Q="-webkit-",gc="comm",so="rule",oo="decl",yh="@import",bc="@keyframes",vh="@layer",xh=Math.abs,Sr=String.fromCharCode,wh=Object.assign;function Ch(e,t){return le(e,0)^45?(((t<<2^le(e,0))<<2^le(e,1))<<2^le(e,2))<<2^le(e,3):0}function yc(e){return e.trim()}function Sh(e,t){return(e=t.exec(e))?e[0]:e}function Y(e,t,n){return e.replace(t,n)}function fs(e,t){return e.indexOf(t)}function le(e,t){return e.charCodeAt(t)|0}function Vt(e,t,n){return e.slice(t,n)}function Ee(e){return e.length}function ao(e){return e.length}function Mn(e,t){return t.push(e),e}function jh(e,t){return e.map(t).join("")}var jr=1,Ct=1,vc=0,ge=0,ae=0,Et="";function Pr(e,t,n,s,r,o,a){return{value:e,root:t,parent:n,type:s,props:r,children:o,line:jr,column:Ct,length:a,return:""}}function Rt(e,t){return wh(Pr("",null,null,"",null,null,0),e,{length:-e.length},t)}function Ph(){return ae}function Nh(){return ae=ge>0?le(Et,--ge):0,Ct--,ae===10&&(Ct=1,jr--),ae}function ve(){return ae=ge<vc?le(Et,ge++):0,Ct++,ae===10&&(Ct=1,jr++),ae}function Ie(){return le(Et,ge)}function Wn(){return ge}function vn(e,t){return Vt(Et,e,t)}function Bt(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function xc(e){return jr=Ct=1,vc=Ee(Et=e),ge=0,[]}function wc(e){return Et="",e}function qn(e){return yc(vn(ge-1,hs(e===91?e+2:e===40?e+1:e)))}function Eh(e){for(;(ae=Ie())&&ae<33;)ve();return Bt(e)>2||Bt(ae)>3?"":" "}function Oh(e,t){for(;--t&&ve()&&!(ae<48||ae>102||ae>57&&ae<65||ae>70&&ae<97););return vn(e,Wn()+(t<6&&Ie()==32&&ve()==32))}function hs(e){for(;ve();)switch(ae){case e:return ge;case 34:case 39:e!==34&&e!==39&&hs(ae);break;case 40:e===41&&hs(e);break;case 92:ve();break}return ge}function Ih(e,t){for(;ve()&&e+ae!==57;)if(e+ae===84&&Ie()===47)break;return"/*"+vn(t,ge-1)+"*"+Sr(e===47?e:ve())}function Mh(e){for(;!Bt(Ie());)ve();return vn(e,ge)}function Th(e){return wc(Gn("",null,null,null,[""],e=xc(e),0,[0],e))}function Gn(e,t,n,s,r,o,a,i,l){for(var u=0,d=0,h=a,f=0,p=0,g=0,m=1,y=1,v=1,x=0,C="",N=r,w=o,j=s,S=C;y;)switch(g=x,x=ve()){case 40:if(g!=108&&le(S,h-1)==58){fs(S+=Y(qn(x),"&","&\f"),"&\f")!=-1&&(v=-1);break}case 34:case 39:case 91:S+=qn(x);break;case 9:case 10:case 13:case 32:S+=Eh(g);break;case 92:S+=Oh(Wn()-1,7);continue;case 47:switch(Ie()){case 42:case 47:Mn(Dh(Ih(ve(),Wn()),t,n),l);break;default:S+="/"}break;case 123*m:i[u++]=Ee(S)*v;case 125*m:case 59:case 0:switch(x){case 0:case 125:y=0;case 59+d:v==-1&&(S=Y(S,/\f/g,"")),p>0&&Ee(S)-h&&Mn(p>32?aa(S+";",s,n,h-1):aa(Y(S," ","")+";",s,n,h-2),l);break;case 59:S+=";";default:if(Mn(j=oa(S,t,n,u,d,r,i,C,N=[],w=[],h),o),x===123)if(d===0)Gn(S,t,j,j,N,o,h,i,w);else switch(f===99&&le(S,3)===110?100:f){case 100:case 108:case 109:case 115:Gn(e,j,j,s&&Mn(oa(e,j,j,0,0,r,i,C,r,N=[],h),w),r,w,h,i,s?N:w);break;default:Gn(S,j,j,j,[""],w,0,i,w)}}u=d=p=0,m=v=1,C=S="",h=a;break;case 58:h=1+Ee(S),p=g;default:if(m<1){if(x==123)--m;else if(x==125&&m++==0&&Nh()==125)continue}switch(S+=Sr(x),x*m){case 38:v=d>0?1:(S+="\f",-1);break;case 44:i[u++]=(Ee(S)-1)*v,v=1;break;case 64:Ie()===45&&(S+=qn(ve())),f=Ie(),d=h=Ee(C=S+=Mh(Wn())),x++;break;case 45:g===45&&Ee(S)==2&&(m=0)}}return o}function oa(e,t,n,s,r,o,a,i,l,u,d){for(var h=r-1,f=r===0?o:[""],p=ao(f),g=0,m=0,y=0;g<s;++g)for(var v=0,x=Vt(e,h+1,h=xh(m=a[g])),C=e;v<p;++v)(C=yc(m>0?f[v]+" "+x:Y(x,/&\f/g,f[v])))&&(l[y++]=C);return Pr(e,t,n,r===0?so:i,l,u,d)}function Dh(e,t,n){return Pr(e,t,n,gc,Sr(Ph()),Vt(e,2,-2),0)}function aa(e,t,n,s){return Pr(e,t,n,oo,Vt(e,0,s),Vt(e,s+1,-1),s)}function bt(e,t){for(var n="",s=ao(e),r=0;r<s;r++)n+=t(e[r],r,e,t)||"";return n}function kh(e,t,n,s){switch(e.type){case vh:if(e.children.length)break;case yh:case oo:return e.return=e.return||e.value;case gc:return"";case bc:return e.return=e.value+"{"+bt(e.children,s)+"}";case so:e.value=e.props.join(",")}return Ee(n=bt(e.children,s))?e.return=e.value+"{"+n+"}":""}function Rh(e){var t=ao(e);return function(n,s,r,o){for(var a="",i=0;i<t;i++)a+=e[i](n,s,r,o)||"";return a}}function Ah(e){return function(t){t.root||(t=t.return)&&e(t)}}function Lh(e){var t=Object.create(null);return function(n){return t[n]===void 0&&(t[n]=e(n)),t[n]}}var Fh=function(t,n,s){for(var r=0,o=0;r=o,o=Ie(),r===38&&o===12&&(n[s]=1),!Bt(o);)ve();return vn(t,ge)},$h=function(t,n){var s=-1,r=44;do switch(Bt(r)){case 0:r===38&&Ie()===12&&(n[s]=1),t[s]+=Fh(ge-1,n,s);break;case 2:t[s]+=qn(r);break;case 4:if(r===44){t[++s]=Ie()===58?"&\f":"",n[s]=t[s].length;break}default:t[s]+=Sr(r)}while(r=ve());return t},zh=function(t,n){return wc($h(xc(t),n))},ia=new WeakMap,_h=function(t){if(!(t.type!=="rule"||!t.parent||t.length<1)){for(var n=t.value,s=t.parent,r=t.column===s.column&&t.line===s.line;s.type!=="rule";)if(s=s.parent,!s)return;if(!(t.props.length===1&&n.charCodeAt(0)!==58&&!ia.get(s))&&!r){ia.set(t,!0);for(var o=[],a=zh(n,o),i=s.props,l=0,u=0;l<a.length;l++)for(var d=0;d<i.length;d++,u++)t.props[u]=o[l]?a[l].replace(/&\f/g,i[d]):i[d]+" "+a[l]}}},Uh=function(t){if(t.type==="decl"){var n=t.value;n.charCodeAt(0)===108&&n.charCodeAt(2)===98&&(t.return="",t.value="")}};function Cc(e,t){switch(Ch(e,t)){case 5103:return Q+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Q+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Q+e+rr+e+de+e+e;case 6828:case 4268:return Q+e+de+e+e;case 6165:return Q+e+de+"flex-"+e+e;case 5187:return Q+e+Y(e,/(\w+).+(:[^]+)/,Q+"box-$1$2"+de+"flex-$1$2")+e;case 5443:return Q+e+de+"flex-item-"+Y(e,/flex-|-self/,"")+e;case 4675:return Q+e+de+"flex-line-pack"+Y(e,/align-content|flex-|-self/,"")+e;case 5548:return Q+e+de+Y(e,"shrink","negative")+e;case 5292:return Q+e+de+Y(e,"basis","preferred-size")+e;case 6060:return Q+"box-"+Y(e,"-grow","")+Q+e+de+Y(e,"grow","positive")+e;case 4554:return Q+Y(e,/([^-])(transform)/g,"$1"+Q+"$2")+e;case 6187:return Y(Y(Y(e,/(zoom-|grab)/,Q+"$1"),/(image-set)/,Q+"$1"),e,"")+e;case 5495:case 3959:return Y(e,/(image-set\([^]*)/,Q+"$1$`$1");case 4968:return Y(Y(e,/(.+:)(flex-)?(.*)/,Q+"box-pack:$3"+de+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Q+e+e;case 4095:case 3583:case 4068:case 2532:return Y(e,/(.+)-inline(.+)/,Q+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Ee(e)-1-t>6)switch(le(e,t+1)){case 109:if(le(e,t+4)!==45)break;case 102:return Y(e,/(.+:)(.+)-([^]+)/,"$1"+Q+"$2-$3$1"+rr+(le(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~fs(e,"stretch")?Cc(Y(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(le(e,t+1)!==115)break;case 6444:switch(le(e,Ee(e)-3-(~fs(e,"!important")&&10))){case 107:return Y(e,":",":"+Q)+e;case 101:return Y(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Q+(le(e,14)===45?"inline-":"")+"box$3$1"+Q+"$2$3$1"+de+"$2box$3")+e}break;case 5936:switch(le(e,t+11)){case 114:return Q+e+de+Y(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Q+e+de+Y(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Q+e+de+Y(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Q+e+de+e+e}return e}var Vh=function(t,n,s,r){if(t.length>-1&&!t.return)switch(t.type){case oo:t.return=Cc(t.value,t.length);break;case bc:return bt([Rt(t,{value:Y(t.value,"@","@"+Q)})],r);case so:if(t.length)return jh(t.props,function(o){switch(Sh(o,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return bt([Rt(t,{props:[Y(o,/:(read-\w+)/,":"+rr+"$1")]})],r);case"::placeholder":return bt([Rt(t,{props:[Y(o,/:(plac\w+)/,":"+Q+"input-$1")]}),Rt(t,{props:[Y(o,/:(plac\w+)/,":"+rr+"$1")]}),Rt(t,{props:[Y(o,/:(plac\w+)/,de+"input-$1")]})],r)}return""})}},Bh=[Vh],Hh=function(t){var n=t.key;if(n==="css"){var s=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(s,function(m){var y=m.getAttribute("data-emotion");y.indexOf(" ")!==-1&&(document.head.appendChild(m),m.setAttribute("data-s",""))})}var r=t.stylisPlugins||Bh,o={},a,i=[];a=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(m){for(var y=m.getAttribute("data-emotion").split(" "),v=1;v<y.length;v++)o[y[v]]=!0;i.push(m)});var l,u=[_h,Uh];{var d,h=[kh,Ah(function(m){d.insert(m)})],f=Rh(u.concat(r,h)),p=function(y){return bt(Th(y),f)};l=function(y,v,x,C){d=x,p(y?y+"{"+v.styles+"}":v.styles),C&&(g.inserted[v.name]=!0)}}var g={key:n,sheet:new bh({key:n,container:a,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:o,registered:{},insert:l};return g.sheet.hydrate(i),g},Wh=!0;function qh(e,t,n){var s="";return n.split(" ").forEach(function(r){e[r]!==void 0?t.push(e[r]+";"):r&&(s+=r+" ")}),s}var Sc=function(t,n,s){var r=t.key+"-"+n.name;(s===!1||Wh===!1)&&t.registered[r]===void 0&&(t.registered[r]=n.styles)},Gh=function(t,n,s){Sc(t,n,s);var r=t.key+"-"+n.name;if(t.inserted[n.name]===void 0){var o=n;do t.insert(n===o?"."+r:"",o,t.sheet,!0),o=o.next;while(o!==void 0)}};function Qh(e){for(var t=0,n,s=0,r=e.length;r>=4;++s,r-=4)n=e.charCodeAt(s)&255|(e.charCodeAt(++s)&255)<<8|(e.charCodeAt(++s)&255)<<16|(e.charCodeAt(++s)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(r){case 3:t^=(e.charCodeAt(s+2)&255)<<16;case 2:t^=(e.charCodeAt(s+1)&255)<<8;case 1:t^=e.charCodeAt(s)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var Yh={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Kh=/[A-Z]|^ms/g,Xh=/_EMO_([^_]+?)_([^]*?)_EMO_/g,jc=function(t){return t.charCodeAt(1)===45},ca=function(t){return t!=null&&typeof t!="boolean"},zr=Lh(function(e){return jc(e)?e:e.replace(Kh,"-$&").toLowerCase()}),la=function(t,n){switch(t){case"animation":case"animationName":if(typeof n=="string")return n.replace(Xh,function(s,r,o){return Oe={name:r,styles:o,next:Oe},r})}return Yh[t]!==1&&!jc(t)&&typeof n=="number"&&n!==0?n+"px":n};function Ht(e,t,n){if(n==null)return"";var s=n;if(s.__emotion_styles!==void 0)return s;switch(typeof n){case"boolean":return"";case"object":{var r=n;if(r.anim===1)return Oe={name:r.name,styles:r.styles,next:Oe},r.name;var o=n;if(o.styles!==void 0){var a=o.next;if(a!==void 0)for(;a!==void 0;)Oe={name:a.name,styles:a.styles,next:Oe},a=a.next;var i=o.styles+";";return i}return Jh(e,t,n)}case"function":{if(e!==void 0){var l=Oe,u=n(e);return Oe=l,Ht(e,t,u)}break}}var d=n;return d}function Jh(e,t,n){var s="";if(Array.isArray(n))for(var r=0;r<n.length;r++)s+=Ht(e,t,n[r])+";";else for(var o in n){var a=n[o];if(typeof a!="object"){var i=a;ca(i)&&(s+=zr(o)+":"+la(o,i)+";")}else if(Array.isArray(a)&&typeof a[0]=="string"&&t==null)for(var l=0;l<a.length;l++)ca(a[l])&&(s+=zr(o)+":"+la(o,a[l])+";");else{var u=Ht(e,t,a);switch(o){case"animation":case"animationName":{s+=zr(o)+":"+u+";";break}default:s+=o+"{"+u+"}"}}}return s}var ua=/label:\s*([^\s;{]+)\s*(;|$)/g,Oe;function Pc(e,t,n){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var s=!0,r="";Oe=void 0;var o=e[0];if(o==null||o.raw===void 0)s=!1,r+=Ht(n,t,o);else{var a=o;r+=a[0]}for(var i=1;i<e.length;i++)if(r+=Ht(n,t,e[i]),s){var l=o;r+=l[i]}ua.lastIndex=0;for(var u="",d;(d=ua.exec(r))!==null;)u+="-"+d[1];var h=Qh(r)+u;return{name:h,styles:r,next:Oe}}var Zh=function(t){return t()},ep=Ho.useInsertionEffect?Ho.useInsertionEffect:!1,tp=ep||Zh,Nc=b.createContext(typeof HTMLElement<"u"?Hh({key:"css"}):null);Nc.Provider;var np=function(t){return b.forwardRef(function(n,s){var r=b.useContext(Nc);return t(n,r,s)})},rp=b.createContext({}),io={}.hasOwnProperty,ps="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",sp=function(t,n){var s={};for(var r in n)io.call(n,r)&&(s[r]=n[r]);return s[ps]=t,s},op=function(t){var n=t.cache,s=t.serialized,r=t.isStringTag;return Sc(n,s,r),tp(function(){return Gh(n,s,r)}),null},ap=np(function(e,t,n){var s=e.css;typeof s=="string"&&t.registered[s]!==void 0&&(s=t.registered[s]);var r=e[ps],o=[s],a="";typeof e.className=="string"?a=qh(t.registered,o,e.className):e.className!=null&&(a=e.className+" ");var i=Pc(o,void 0,b.useContext(rp));a+=t.key+"-"+i.name;var l={};for(var u in e)io.call(e,u)&&u!=="css"&&u!==ps&&(l[u]=e[u]);return l.className=a,n&&(l.ref=n),b.createElement(b.Fragment,null,b.createElement(op,{cache:t,serialized:i,isStringTag:typeof r=="string"}),b.createElement(r,l))}),ip=ap,L=function(t,n){var s=arguments;if(n==null||!io.call(n,"css"))return b.createElement.apply(void 0,s);var r=s.length,o=new Array(r);o[0]=ip,o[1]=sp(t,n);for(var a=2;a<r;a++)o[a]=s[a];return b.createElement.apply(null,o)};(function(e){var t;t||(t=e.JSX||(e.JSX={}))})(L||(L={}));function co(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Pc(t)}function cp(){var e=co.apply(void 0,arguments),t="animation-"+e.name;return{name:t,styles:"@keyframes "+t+"{"+e.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}}function lp(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var ms=b.useLayoutEffect,up=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"],sr=function(){};function dp(e,t){return t?t[0]==="-"?e+t:e+"__"+t:e}function fp(e,t){for(var n=arguments.length,s=new Array(n>2?n-2:0),r=2;r<n;r++)s[r-2]=arguments[r];var o=[].concat(s);if(t&&e)for(var a in t)t.hasOwnProperty(a)&&t[a]&&o.push("".concat(dp(e,a)));return o.filter(function(i){return i}).map(function(i){return String(i).trim()}).join(" ")}var da=function(t){return wp(t)?t.filter(Boolean):st(t)==="object"&&t!==null?[t]:[]},Ec=function(t){t.className,t.clearValue,t.cx,t.getStyles,t.getClassNames,t.getValue,t.hasValue,t.isMulti,t.isRtl,t.options,t.selectOption,t.selectProps,t.setValue,t.theme;var n=Ue(t,up);return $({},n)},se=function(t,n,s){var r=t.cx,o=t.getStyles,a=t.getClassNames,i=t.className;return{css:o(n,t),className:r(s??{},a(n,t),i)}};function Nr(e){return[document.documentElement,document.body,window].indexOf(e)>-1}function hp(e){return Nr(e)?window.innerHeight:e.clientHeight}function Oc(e){return Nr(e)?window.pageYOffset:e.scrollTop}function or(e,t){if(Nr(e)){window.scrollTo(0,t);return}e.scrollTop=t}function pp(e){var t=getComputedStyle(e),n=t.position==="absolute",s=/(auto|scroll)/;if(t.position==="fixed")return document.documentElement;for(var r=e;r=r.parentElement;)if(t=getComputedStyle(r),!(n&&t.position==="static")&&s.test(t.overflow+t.overflowY+t.overflowX))return r;return document.documentElement}function mp(e,t,n,s){return n*((e=e/s-1)*e*e+1)+t}function Tn(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:200,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:sr,r=Oc(e),o=t-r,a=10,i=0;function l(){i+=a;var u=mp(i,r,o,n);or(e,u),i<n?window.requestAnimationFrame(l):s(e)}l()}function fa(e,t){var n=e.getBoundingClientRect(),s=t.getBoundingClientRect(),r=t.offsetHeight/3;s.bottom+r>n.bottom?or(e,Math.min(t.offsetTop+t.clientHeight-e.offsetHeight+r,e.scrollHeight)):s.top-r<n.top&&or(e,Math.max(t.offsetTop-r,0))}function gp(e){var t=e.getBoundingClientRect();return{bottom:t.bottom,height:t.height,left:t.left,right:t.right,top:t.top,width:t.width}}function ha(){try{return document.createEvent("TouchEvent"),!0}catch{return!1}}function bp(){try{return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}catch{return!1}}var Ic=!1,yp={get passive(){return Ic=!0}},Dn=typeof window<"u"?window:{};Dn.addEventListener&&Dn.removeEventListener&&(Dn.addEventListener("p",sr,yp),Dn.removeEventListener("p",sr,!1));var vp=Ic;function xp(e){return e!=null}function wp(e){return Array.isArray(e)}function kn(e,t,n){return e?t:n}var Cp=function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),r=1;r<n;r++)s[r-1]=arguments[r];var o=Object.entries(t).filter(function(a){var i=$e(a,1),l=i[0];return!s.includes(l)});return o.reduce(function(a,i){var l=$e(i,2),u=l[0],d=l[1];return a[u]=d,a},{})},Sp=["children","innerProps"],jp=["children","innerProps"];function Pp(e){var t=e.maxHeight,n=e.menuEl,s=e.minHeight,r=e.placement,o=e.shouldScroll,a=e.isFixedPosition,i=e.controlHeight,l=pp(n),u={placement:"bottom",maxHeight:t};if(!n||!n.offsetParent)return u;var d=l.getBoundingClientRect(),h=d.height,f=n.getBoundingClientRect(),p=f.bottom,g=f.height,m=f.top,y=n.offsetParent.getBoundingClientRect(),v=y.top,x=a?window.innerHeight:hp(l),C=Oc(l),N=parseInt(getComputedStyle(n).marginBottom,10),w=parseInt(getComputedStyle(n).marginTop,10),j=v-w,S=x-m,P=j+C,E=h-C-m,T=p-x+C+N,I=C+m-w,D=160;switch(r){case"auto":case"bottom":if(S>=g)return{placement:"bottom",maxHeight:t};if(E>=g&&!a)return o&&Tn(l,T,D),{placement:"bottom",maxHeight:t};if(!a&&E>=s||a&&S>=s){o&&Tn(l,T,D);var R=a?S-N:E-N;return{placement:"bottom",maxHeight:R}}if(r==="auto"||a){var F=t,_=a?j:P;return _>=s&&(F=Math.min(_-N-i,t)),{placement:"top",maxHeight:F}}if(r==="bottom")return o&&or(l,T),{placement:"bottom",maxHeight:t};break;case"top":if(j>=g)return{placement:"top",maxHeight:t};if(P>=g&&!a)return o&&Tn(l,I,D),{placement:"top",maxHeight:t};if(!a&&P>=s||a&&j>=s){var U=t;return(!a&&P>=s||a&&j>=s)&&(U=a?j-w:P-w),o&&Tn(l,I,D),{placement:"top",maxHeight:U}}return{placement:"bottom",maxHeight:t};default:throw new Error('Invalid placement provided "'.concat(r,'".'))}return u}function Np(e){var t={bottom:"top",top:"bottom"};return e?t[e]:"bottom"}var Mc=function(t){return t==="auto"?"bottom":t},Ep=function(t,n){var s,r=t.placement,o=t.theme,a=o.borderRadius,i=o.spacing,l=o.colors;return $((s={label:"menu"},$t(s,Np(r),"100%"),$t(s,"position","absolute"),$t(s,"width","100%"),$t(s,"zIndex",1),s),n?{}:{backgroundColor:l.neutral0,borderRadius:a,boxShadow:"0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",marginBottom:i.menuGutter,marginTop:i.menuGutter})},Tc=b.createContext(null),Op=function(t){var n=t.children,s=t.minMenuHeight,r=t.maxMenuHeight,o=t.menuPlacement,a=t.menuPosition,i=t.menuShouldScrollIntoView,l=t.theme,u=b.useContext(Tc)||{},d=u.setPortalPlacement,h=b.useRef(null),f=b.useState(r),p=$e(f,2),g=p[0],m=p[1],y=b.useState(null),v=$e(y,2),x=v[0],C=v[1],N=l.spacing.controlHeight;return ms(function(){var w=h.current;if(w){var j=a==="fixed",S=i&&!j,P=Pp({maxHeight:r,menuEl:w,minHeight:s,placement:o,shouldScroll:S,isFixedPosition:j,controlHeight:N});m(P.maxHeight),C(P.placement),d?.(P.placement)}},[r,o,a,i,s,d,N]),n({ref:h,placerProps:$($({},t),{},{placement:x||Mc(o),maxHeight:g})})},Ip=function(t){var n=t.children,s=t.innerRef,r=t.innerProps;return L("div",z({},se(t,"menu",{menu:!0}),{ref:s},r),n)},Mp=Ip,Tp=function(t,n){var s=t.maxHeight,r=t.theme.spacing.baseUnit;return $({maxHeight:s,overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},n?{}:{paddingBottom:r,paddingTop:r})},Dp=function(t){var n=t.children,s=t.innerProps,r=t.innerRef,o=t.isMulti;return L("div",z({},se(t,"menuList",{"menu-list":!0,"menu-list--is-multi":o}),{ref:r},s),n)},Dc=function(t,n){var s=t.theme,r=s.spacing.baseUnit,o=s.colors;return $({textAlign:"center"},n?{}:{color:o.neutral40,padding:"".concat(r*2,"px ").concat(r*3,"px")})},kp=Dc,Rp=Dc,Ap=function(t){var n=t.children,s=n===void 0?"No options":n,r=t.innerProps,o=Ue(t,Sp);return L("div",z({},se($($({},o),{},{children:s,innerProps:r}),"noOptionsMessage",{"menu-notice":!0,"menu-notice--no-options":!0}),r),s)},Lp=function(t){var n=t.children,s=n===void 0?"Loading...":n,r=t.innerProps,o=Ue(t,jp);return L("div",z({},se($($({},o),{},{children:s,innerProps:r}),"loadingMessage",{"menu-notice":!0,"menu-notice--loading":!0}),r),s)},Fp=function(t){var n=t.rect,s=t.offset,r=t.position;return{left:n.left,position:r,top:s,width:n.width,zIndex:1}},$p=function(t){var n=t.appendTo,s=t.children,r=t.controlElement,o=t.innerProps,a=t.menuPlacement,i=t.menuPosition,l=b.useRef(null),u=b.useRef(null),d=b.useState(Mc(a)),h=$e(d,2),f=h[0],p=h[1],g=b.useMemo(function(){return{setPortalPlacement:p}},[]),m=b.useState(null),y=$e(m,2),v=y[0],x=y[1],C=b.useCallback(function(){if(r){var S=gp(r),P=i==="fixed"?0:window.pageYOffset,E=S[f]+P;(E!==v?.offset||S.left!==v?.rect.left||S.width!==v?.rect.width)&&x({offset:E,rect:S})}},[r,i,f,v?.offset,v?.rect.left,v?.rect.width]);ms(function(){C()},[C]);var N=b.useCallback(function(){typeof u.current=="function"&&(u.current(),u.current=null),r&&l.current&&(u.current=gd(r,l.current,C,{elementResize:"ResizeObserver"in window}))},[r,C]);ms(function(){N()},[N]);var w=b.useCallback(function(S){l.current=S,N()},[N]);if(!n&&i!=="fixed"||!v)return null;var j=L("div",z({ref:w},se($($({},t),{},{offset:v.offset,position:i,rect:v.rect}),"menuPortal",{"menu-portal":!0}),o),s);return L(Tc.Provider,{value:g},n?Ri.createPortal(j,n):j)},zp=function(t){var n=t.isDisabled,s=t.isRtl;return{label:"container",direction:s?"rtl":void 0,pointerEvents:n?"none":void 0,position:"relative"}},_p=function(t){var n=t.children,s=t.innerProps,r=t.isDisabled,o=t.isRtl;return L("div",z({},se(t,"container",{"--is-disabled":r,"--is-rtl":o}),s),n)},Up=function(t,n){var s=t.theme.spacing,r=t.isMulti,o=t.hasValue,a=t.selectProps.controlShouldRenderValue;return $({alignItems:"center",display:r&&o&&a?"flex":"grid",flex:1,flexWrap:"wrap",WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"},n?{}:{padding:"".concat(s.baseUnit/2,"px ").concat(s.baseUnit*2,"px")})},Vp=function(t){var n=t.children,s=t.innerProps,r=t.isMulti,o=t.hasValue;return L("div",z({},se(t,"valueContainer",{"value-container":!0,"value-container--is-multi":r,"value-container--has-value":o}),s),n)},Bp=function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},Hp=function(t){var n=t.children,s=t.innerProps;return L("div",z({},se(t,"indicatorsContainer",{indicators:!0}),s),n)},pa,Wp=["size"],qp=["innerProps","isRtl","size"],Gp={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},kc=function(t){var n=t.size,s=Ue(t,Wp);return L("svg",z({height:n,width:n,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:Gp},s))},lo=function(t){return L(kc,z({size:20},t),L("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"}))},Rc=function(t){return L(kc,z({size:20},t),L("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},Ac=function(t,n){var s=t.isFocused,r=t.theme,o=r.spacing.baseUnit,a=r.colors;return $({label:"indicatorContainer",display:"flex",transition:"color 150ms"},n?{}:{color:s?a.neutral60:a.neutral20,padding:o*2,":hover":{color:s?a.neutral80:a.neutral40}})},Qp=Ac,Yp=function(t){var n=t.children,s=t.innerProps;return L("div",z({},se(t,"dropdownIndicator",{indicator:!0,"dropdown-indicator":!0}),s),n||L(Rc,null))},Kp=Ac,Xp=function(t){var n=t.children,s=t.innerProps;return L("div",z({},se(t,"clearIndicator",{indicator:!0,"clear-indicator":!0}),s),n||L(lo,null))},Jp=function(t,n){var s=t.isDisabled,r=t.theme,o=r.spacing.baseUnit,a=r.colors;return $({label:"indicatorSeparator",alignSelf:"stretch",width:1},n?{}:{backgroundColor:s?a.neutral10:a.neutral20,marginBottom:o*2,marginTop:o*2})},Zp=function(t){var n=t.innerProps;return L("span",z({},n,se(t,"indicatorSeparator",{"indicator-separator":!0})))},em=cp(pa||(pa=lp([`
4
4
  0%, 80%, 100% { opacity: 0; }
5
5
  40% { opacity: 1; }
6
- `]))),tm=function(t,n){var s=t.isFocused,r=t.size,o=t.theme,a=o.colors,i=o.spacing.baseUnit;return z({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:r,lineHeight:1,marginRight:r,textAlign:"center",verticalAlign:"middle"},n?{}:{color:s?a.neutral60:a.neutral20,padding:i*2})},$r=function(t){var n=t.delay,s=t.offset;return L("span",{css:co({animation:"".concat(em," 1s ease-in-out ").concat(n,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:s?"1em":void 0,height:"1em",verticalAlign:"top",width:"1em"},"","")})},nm=function(t){var n=t.innerProps,s=t.isRtl,r=t.size,o=r===void 0?4:r,a=Ue(t,qp);return L("div",_({},re(z(z({},a),{},{innerProps:n,isRtl:s,size:o}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),n),L($r,{delay:0,offset:s}),L($r,{delay:160,offset:!0}),L($r,{delay:320,offset:!s}))},rm=function(t,n){var s=t.isDisabled,r=t.isFocused,o=t.theme,a=o.colors,i=o.borderRadius,l=o.spacing;return z({label:"control",alignItems:"center",cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:l.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms"},n?{}:{backgroundColor:s?a.neutral5:a.neutral0,borderColor:s?a.neutral10:r?a.primary:a.neutral20,borderRadius:i,borderStyle:"solid",borderWidth:1,boxShadow:r?"0 0 0 1px ".concat(a.primary):void 0,"&:hover":{borderColor:r?a.primary:a.neutral30}})},sm=function(t){var n=t.children,s=t.isDisabled,r=t.isFocused,o=t.innerRef,a=t.innerProps,i=t.menuIsOpen;return L("div",_({ref:o},re(t,"control",{control:!0,"control--is-disabled":s,"control--is-focused":r,"control--menu-is-open":i}),a,{"aria-disabled":s||void 0}),n)},om=sm,am=["data"],im=function(t,n){var s=t.theme.spacing;return n?{}:{paddingBottom:s.baseUnit*2,paddingTop:s.baseUnit*2}},cm=function(t){var n=t.children,s=t.cx,r=t.getStyles,o=t.getClassNames,a=t.Heading,i=t.headingProps,l=t.innerProps,u=t.label,d=t.theme,h=t.selectProps;return L("div",_({},re(t,"group",{group:!0}),l),L(a,_({},i,{selectProps:h,theme:d,getStyles:r,getClassNames:o,cx:s}),u),L("div",null,n))},lm=function(t,n){var s=t.theme,r=s.colors,o=s.spacing;return z({label:"group",cursor:"default",display:"block"},n?{}:{color:r.neutral40,fontSize:"75%",fontWeight:500,marginBottom:"0.25em",paddingLeft:o.baseUnit*3,paddingRight:o.baseUnit*3,textTransform:"uppercase"})},um=function(t){var n=Nc(t);n.data;var s=Ue(n,am);return L("div",_({},re(t,"groupHeading",{"group-heading":!0}),s))},dm=cm,fm=["innerRef","isDisabled","isHidden","inputClassName"],hm=function(t,n){var s=t.isDisabled,r=t.value,o=t.theme,a=o.spacing,i=o.colors;return z(z({visibility:s?"hidden":"visible",transform:r?"translateZ(0)":""},pm),n?{}:{margin:a.baseUnit/2,paddingBottom:a.baseUnit/2,paddingTop:a.baseUnit/2,color:i.neutral80})},Lc={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},pm={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":z({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},Lc)},mm=function(t){return z({label:"input",color:"inherit",background:0,opacity:t?0:1,width:"100%"},Lc)},gm=function(t){var n=t.cx,s=t.value,r=Nc(t),o=r.innerRef,a=r.isDisabled,i=r.isHidden,l=r.inputClassName,u=Ue(r,fm);return L("div",_({},re(t,"input",{"input-container":!0}),{"data-value":s||""}),L("input",_({className:n({input:!0},l),ref:o,style:mm(i),disabled:a},u)))},bm=gm,ym=function(t,n){var s=t.theme,r=s.spacing,o=s.borderRadius,a=s.colors;return z({label:"multiValue",display:"flex",minWidth:0},n?{}:{backgroundColor:a.neutral10,borderRadius:o/2,margin:r.baseUnit/2})},vm=function(t,n){var s=t.theme,r=s.borderRadius,o=s.colors,a=t.cropWithEllipsis;return z({overflow:"hidden",textOverflow:a||a===void 0?"ellipsis":void 0,whiteSpace:"nowrap"},n?{}:{borderRadius:r/2,color:o.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},xm=function(t,n){var s=t.theme,r=s.spacing,o=s.borderRadius,a=s.colors,i=t.isFocused;return z({alignItems:"center",display:"flex"},n?{}:{borderRadius:o/2,backgroundColor:i?a.dangerLight:void 0,paddingLeft:r.baseUnit,paddingRight:r.baseUnit,":hover":{backgroundColor:a.dangerLight,color:a.danger}})},Fc=function(t){var n=t.children,s=t.innerProps;return L("div",s,n)},wm=Fc,Cm=Fc;function Sm(e){var t=e.children,n=e.innerProps;return L("div",_({role:"button"},n),t||L(lo,{size:14}))}var jm=function(t){var n=t.children,s=t.components,r=t.data,o=t.innerProps,a=t.isDisabled,i=t.removeProps,l=t.selectProps,u=s.Container,d=s.Label,h=s.Remove;return L(u,{data:r,innerProps:z(z({},re(t,"multiValue",{"multi-value":!0,"multi-value--is-disabled":a})),o),selectProps:l},L(d,{data:r,innerProps:z({},re(t,"multiValueLabel",{"multi-value__label":!0})),selectProps:l},n),L(h,{data:r,innerProps:z(z({},re(t,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(n||"option")},i),selectProps:l}))},Pm=jm,Em=function(t,n){var s=t.isDisabled,r=t.isFocused,o=t.isSelected,a=t.theme,i=a.spacing,l=a.colors;return z({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},n?{}:{backgroundColor:o?l.primary:r?l.primary25:"transparent",color:s?l.neutral20:o?l.neutral0:"inherit",padding:"".concat(i.baseUnit*2,"px ").concat(i.baseUnit*3,"px"),":active":{backgroundColor:s?void 0:o?l.primary:l.primary50}})},Nm=function(t){var n=t.children,s=t.isDisabled,r=t.isFocused,o=t.isSelected,a=t.innerRef,i=t.innerProps;return L("div",_({},re(t,"option",{option:!0,"option--is-disabled":s,"option--is-focused":r,"option--is-selected":o}),{ref:a,"aria-disabled":s},i),n)},Om=Nm,Im=function(t,n){var s=t.theme,r=s.spacing,o=s.colors;return z({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},n?{}:{color:o.neutral50,marginLeft:r.baseUnit/2,marginRight:r.baseUnit/2})},Mm=function(t){var n=t.children,s=t.innerProps;return L("div",_({},re(t,"placeholder",{placeholder:!0}),s),n)},Tm=Mm,Dm=function(t,n){var s=t.isDisabled,r=t.theme,o=r.spacing,a=r.colors;return z({label:"singleValue",gridArea:"1 / 1 / 2 / 3",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},n?{}:{color:s?a.neutral40:a.neutral80,marginLeft:o.baseUnit/2,marginRight:o.baseUnit/2})},km=function(t){var n=t.children,s=t.isDisabled,r=t.innerProps;return L("div",_({},re(t,"singleValue",{"single-value":!0,"single-value--is-disabled":s}),r),n)},Rm=km,Pr={ClearIndicator:Xp,Control:om,DropdownIndicator:Yp,DownChevron:Rc,CrossIcon:lo,Group:dm,GroupHeading:um,IndicatorsContainer:Hp,IndicatorSeparator:Zp,Input:bm,LoadingIndicator:nm,Menu:Mp,MenuList:Dp,MenuPortal:$p,LoadingMessage:Lp,NoOptionsMessage:Ap,MultiValue:Pm,MultiValueContainer:wm,MultiValueLabel:Cm,MultiValueRemove:Sm,Option:Om,Placeholder:Tm,SelectContainer:_p,SingleValue:Rm,ValueContainer:Vp},Am=function(t){return z(z({},Pr),t.components)},ma=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function Lm(e,t){return!!(e===t||ma(e)&&ma(t))}function Fm(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!Lm(e[n],t[n]))return!1;return!0}function $m(e,t){t===void 0&&(t=Fm);var n=null;function s(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];if(n&&n.lastThis===this&&t(r,n.lastArgs))return n.lastResult;var a=e.apply(this,r);return n={lastResult:a,lastArgs:r,lastThis:this},a}return s.clear=function(){n=null},s}var zm={name:"7pg0cj-a11yText",styles:"label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap"},_m=function(t){return L("span",_({css:zm},t))},ga=_m,Um={guidance:function(t){var n=t.isSearchable,s=t.isMulti,r=t.tabSelectsValue,o=t.context,a=t.isInitialFocus;switch(o){case"menu":return"Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu".concat(r?", press Tab to select the option and exit the menu":"",".");case"input":return a?"".concat(t["aria-label"]||"Select"," is focused ").concat(n?",type to refine list":"",", press Down to open the menu, ").concat(s?" press left to focus selected values":""):"";case"value":return"Use left and right to toggle between focused values, press Backspace to remove the currently focused value";default:return""}},onChange:function(t){var n=t.action,s=t.label,r=s===void 0?"":s,o=t.labels,a=t.isDisabled;switch(n){case"deselect-option":case"pop-value":case"remove-value":return"option ".concat(r,", deselected.");case"clear":return"All selected options have been cleared.";case"initial-input-focus":return"option".concat(o.length>1?"s":""," ").concat(o.join(","),", selected.");case"select-option":return a?"option ".concat(r," is disabled. Select another option."):"option ".concat(r,", selected.");default:return""}},onFocus:function(t){var n=t.context,s=t.focused,r=t.options,o=t.label,a=o===void 0?"":o,i=t.selectValue,l=t.isDisabled,u=t.isSelected,d=t.isAppleDevice,h=function(m,y){return m&&m.length?"".concat(m.indexOf(y)+1," of ").concat(m.length):""};if(n==="value"&&i)return"value ".concat(a," focused, ").concat(h(i,s),".");if(n==="menu"&&d){var f=l?" disabled":"",p="".concat(u?" selected":"").concat(f);return"".concat(a).concat(p,", ").concat(h(r,s),".")}return""},onFilter:function(t){var n=t.inputValue,s=t.resultsMessage;return"".concat(s).concat(n?" for search term "+n:"",".")}},Vm=function(t){var n=t.ariaSelection,s=t.focusedOption,r=t.focusedValue,o=t.focusableOptions,a=t.isFocused,i=t.selectValue,l=t.selectProps,u=t.id,d=t.isAppleDevice,h=l.ariaLiveMessages,f=l.getOptionLabel,p=l.inputValue,g=l.isMulti,m=l.isOptionDisabled,y=l.isSearchable,v=l.menuIsOpen,x=l.options,C=l.screenReaderStatus,E=l.tabSelectsValue,w=l.isLoading,j=l["aria-label"],S=l["aria-live"],P=b.useMemo(function(){return z(z({},Um),h||{})},[h]),N=b.useMemo(function(){var $="";if(n&&P.onChange){var V=n.option,W=n.options,q=n.removedValue,Z=n.removedValues,ee=n.value,se=function(oe){return Array.isArray(oe)?null:oe},U=q||V||se(ee),A=U?f(U):"",B=W||Z||void 0,te=B?B.map(f):[],ne=z({isDisabled:U&&m(U,i),label:A,labels:te},n);$=P.onChange(ne)}return $},[n,P,m,i,f]),T=b.useMemo(function(){var $="",V=s||r,W=!!(s&&i&&i.includes(s));if(V&&P.onFocus){var q={focused:V,label:f(V),isDisabled:m(V,i),isSelected:W,options:o,context:V===s?"menu":"value",selectValue:i,isAppleDevice:d};$=P.onFocus(q)}return $},[s,r,f,m,P,o,i,d]),I=b.useMemo(function(){var $="";if(v&&x.length&&!w&&P.onFilter){var V=C({count:o.length});$=P.onFilter({inputValue:p,resultsMessage:V})}return $},[o,p,v,P,x,C,w]),D=n?.action==="initial-input-focus",R=b.useMemo(function(){var $="";if(P.guidance){var V=r?"value":v?"menu":"input";$=P.guidance({"aria-label":j,context:V,isDisabled:s&&m(s,i),isMulti:g,isSearchable:y,tabSelectsValue:E,isInitialFocus:D})}return $},[j,s,r,g,m,y,v,P,i,E,D]),F=L(b.Fragment,null,L("span",{id:"aria-selection"},N),L("span",{id:"aria-focused"},T),L("span",{id:"aria-results"},I),L("span",{id:"aria-guidance"},R));return L(b.Fragment,null,L(ga,{id:u},D&&F),L(ga,{"aria-live":S,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},a&&!D&&F))},Bm=Vm,ps=[{base:"A",letters:"AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"},{base:"c",letters:"cⓒcćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ"},{base:"nj",letters:"nj"},{base:"o",letters:"oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}],Hm=new RegExp("["+ps.map(function(e){return e.letters}).join("")+"]","g"),$c={};for(var zr=0;zr<ps.length;zr++)for(var _r=ps[zr],Ur=0;Ur<_r.letters.length;Ur++)$c[_r.letters[Ur]]=_r.base;var zc=function(t){return t.replace(Hm,function(n){return $c[n]})},Wm=$m(zc),ba=function(t){return t.replace(/^\s+|\s+$/g,"")},qm=function(t){return"".concat(t.label," ").concat(t.value)},Gm=function(t){return function(n,s){if(n.data.__isNew__)return!0;var r=z({ignoreCase:!0,ignoreAccents:!0,stringify:qm,trim:!0,matchFrom:"any"},t),o=r.ignoreCase,a=r.ignoreAccents,i=r.stringify,l=r.trim,u=r.matchFrom,d=l?ba(s):s,h=l?ba(i(n)):i(n);return o&&(d=d.toLowerCase(),h=h.toLowerCase()),a&&(d=Wm(d),h=zc(h)),u==="start"?h.substr(0,d.length)===d:h.indexOf(d)>-1}},Qm=["innerRef"];function Ym(e){var t=e.innerRef,n=Ue(e,Qm),s=Cp(n,"onExited","in","enter","exit","appear");return L("input",_({ref:t},s,{css:co({label:"dummyInput",background:0,border:0,caretColor:"transparent",fontSize:"inherit",gridArea:"1 / 1 / 2 / 3",outline:0,padding:0,width:1,color:"transparent",left:-100,opacity:0,position:"relative",transform:"scale(.01)"},"","")}))}var Km=function(t){t.cancelable&&t.preventDefault(),t.stopPropagation()};function Xm(e){var t=e.isEnabled,n=e.onBottomArrive,s=e.onBottomLeave,r=e.onTopArrive,o=e.onTopLeave,a=b.useRef(!1),i=b.useRef(!1),l=b.useRef(0),u=b.useRef(null),d=b.useCallback(function(y,v){if(u.current!==null){var x=u.current,C=x.scrollTop,E=x.scrollHeight,w=x.clientHeight,j=u.current,S=v>0,P=E-w-C,N=!1;P>v&&a.current&&(s&&s(y),a.current=!1),S&&i.current&&(o&&o(y),i.current=!1),S&&v>P?(n&&!a.current&&n(y),j.scrollTop=E,N=!0,a.current=!0):!S&&-v>C&&(r&&!i.current&&r(y),j.scrollTop=0,N=!0,i.current=!0),N&&Km(y)}},[n,s,r,o]),h=b.useCallback(function(y){d(y,y.deltaY)},[d]),f=b.useCallback(function(y){l.current=y.changedTouches[0].clientY},[]),p=b.useCallback(function(y){var v=l.current-y.changedTouches[0].clientY;d(y,v)},[d]),g=b.useCallback(function(y){if(y){var v=vp?{passive:!1}:!1;y.addEventListener("wheel",h,v),y.addEventListener("touchstart",f,v),y.addEventListener("touchmove",p,v)}},[p,f,h]),m=b.useCallback(function(y){y&&(y.removeEventListener("wheel",h,!1),y.removeEventListener("touchstart",f,!1),y.removeEventListener("touchmove",p,!1))},[p,f,h]);return b.useEffect(function(){if(t){var y=u.current;return g(y),function(){m(y)}}},[t,g,m]),function(y){u.current=y}}var ya=["boxSizing","height","overflow","paddingRight","position"],va={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function xa(e){e.cancelable&&e.preventDefault()}function wa(e){e.stopPropagation()}function Ca(){var e=this.scrollTop,t=this.scrollHeight,n=e+this.offsetHeight;e===0?this.scrollTop=1:n===t&&(this.scrollTop=e-1)}function Sa(){return"ontouchstart"in window||navigator.maxTouchPoints}var ja=!!(typeof window<"u"&&window.document&&window.document.createElement),At=0,ft={capture:!1,passive:!1};function Jm(e){var t=e.isEnabled,n=e.accountForScrollbars,s=n===void 0?!0:n,r=b.useRef({}),o=b.useRef(null),a=b.useCallback(function(l){if(ja){var u=document.body,d=u&&u.style;if(s&&ya.forEach(function(g){var m=d&&d[g];r.current[g]=m}),s&&At<1){var h=parseInt(r.current.paddingRight,10)||0,f=document.body?document.body.clientWidth:0,p=window.innerWidth-f+h||0;Object.keys(va).forEach(function(g){var m=va[g];d&&(d[g]=m)}),d&&(d.paddingRight="".concat(p,"px"))}u&&Sa()&&(u.addEventListener("touchmove",xa,ft),l&&(l.addEventListener("touchstart",Ca,ft),l.addEventListener("touchmove",wa,ft))),At+=1}},[s]),i=b.useCallback(function(l){if(ja){var u=document.body,d=u&&u.style;At=Math.max(At-1,0),s&&At<1&&ya.forEach(function(h){var f=r.current[h];d&&(d[h]=f)}),u&&Sa()&&(u.removeEventListener("touchmove",xa,ft),l&&(l.removeEventListener("touchstart",Ca,ft),l.removeEventListener("touchmove",wa,ft)))}},[s]);return b.useEffect(function(){if(t){var l=o.current;return a(l),function(){i(l)}}},[t,a,i]),function(l){o.current=l}}var Zm=function(t){var n=t.target;return n.ownerDocument.activeElement&&n.ownerDocument.activeElement.blur()},eg={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function tg(e){var t=e.children,n=e.lockEnabled,s=e.captureEnabled,r=s===void 0?!0:s,o=e.onBottomArrive,a=e.onBottomLeave,i=e.onTopArrive,l=e.onTopLeave,u=Xm({isEnabled:r,onBottomArrive:o,onBottomLeave:a,onTopArrive:i,onTopLeave:l}),d=Jm({isEnabled:n}),h=function(p){u(p),d(p)};return L(b.Fragment,null,n&&L("div",{onClick:Zm,css:eg}),t(h))}var ng={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},rg=function(t){var n=t.name,s=t.onFocus;return L("input",{required:!0,name:n,tabIndex:-1,"aria-hidden":"true",onFocus:s,css:ng,value:"",onChange:function(){}})},sg=rg;function uo(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function og(){return uo(/^iPhone/i)}function _c(){return uo(/^Mac/i)}function ag(){return uo(/^iPad/i)||_c()&&navigator.maxTouchPoints>1}function ig(){return og()||ag()}function cg(){return _c()||ig()}var lg=function(t){return t.label},ug=function(t){return t.label},dg=function(t){return t.value},fg=function(t){return!!t.isDisabled},hg={clearIndicator:Kp,container:zp,control:rm,dropdownIndicator:Qp,group:im,groupHeading:lm,indicatorsContainer:Bp,indicatorSeparator:Jp,input:hm,loadingIndicator:tm,loadingMessage:Rp,menu:Np,menuList:Tp,menuPortal:Fp,multiValue:ym,multiValueLabel:vm,multiValueRemove:xm,noOptionsMessage:kp,option:Em,placeholder:Im,singleValue:Dm,valueContainer:Up},pg={primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},mg=4,Uc=4,gg=38,bg=Uc*2,yg={baseUnit:Uc,controlHeight:gg,menuGutter:bg},Vr={borderRadius:mg,colors:pg,spacing:yg},vg={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:ha(),captureMenuScroll:!ha(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:Gm(),formatGroupLabel:lg,getOptionLabel:ug,getOptionValue:dg,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:fg,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!bp(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(t){var n=t.count;return"".concat(n," result").concat(n!==1?"s":""," available")},styles:{},tabIndex:0,tabSelectsValue:!0,unstyled:!1};function Pa(e,t,n,s){var r=Hc(e,t,n),o=Wc(e,t,n),a=Bc(e,t),i=ar(e,t);return{type:"option",data:t,isDisabled:r,isSelected:o,label:a,value:i,index:s}}function Qn(e,t){return e.options.map(function(n,s){if("options"in n){var r=n.options.map(function(a,i){return Pa(e,a,t,i)}).filter(function(a){return Na(e,a)});return r.length>0?{type:"group",data:n,options:r,index:s}:void 0}var o=Pa(e,n,t,s);return Na(e,o)?o:void 0}).filter(xp)}function Vc(e){return e.reduce(function(t,n){return n.type==="group"?t.push.apply(t,ro(n.options.map(function(s){return s.data}))):t.push(n.data),t},[])}function Ea(e,t){return e.reduce(function(n,s){return s.type==="group"?n.push.apply(n,ro(s.options.map(function(r){return{data:r.data,id:"".concat(t,"-").concat(s.index,"-").concat(r.index)}}))):n.push({data:s.data,id:"".concat(t,"-").concat(s.index)}),n},[])}function xg(e,t){return Vc(Qn(e,t))}function Na(e,t){var n=e.inputValue,s=n===void 0?"":n,r=t.data,o=t.isSelected,a=t.label,i=t.value;return(!Gc(e)||!o)&&qc(e,{label:a,value:i,data:r},s)}function wg(e,t){var n=e.focusedValue,s=e.selectValue,r=s.indexOf(n);if(r>-1){var o=t.indexOf(n);if(o>-1)return n;if(r<t.length)return t[r]}return null}function Cg(e,t){var n=e.focusedOption;return n&&t.indexOf(n)>-1?n:t[0]}var Br=function(t,n){var s,r=(s=t.find(function(o){return o.data===n}))===null||s===void 0?void 0:s.id;return r||null},Bc=function(t,n){return t.getOptionLabel(n)},ar=function(t,n){return t.getOptionValue(n)};function Hc(e,t,n){return typeof e.isOptionDisabled=="function"?e.isOptionDisabled(t,n):!1}function Wc(e,t,n){if(n.indexOf(t)>-1)return!0;if(typeof e.isOptionSelected=="function")return e.isOptionSelected(t,n);var s=ar(e,t);return n.some(function(r){return ar(e,r)===s})}function qc(e,t,n){return e.filterOption?e.filterOption(t,n):!0}var Gc=function(t){var n=t.hideSelectedOptions,s=t.isMulti;return n===void 0?s:n},Sg=1,Qc=(function(e){ch(n,e);var t=dh(n);function n(s){var r;if(ah(this,n),r=t.call(this,s),r.state={ariaSelection:null,focusedOption:null,focusedOptionId:null,focusableOptionsWithIds:[],focusedValue:null,inputIsHidden:!1,isFocused:!1,selectValue:[],clearFocusValueOnUpdate:!1,prevWasFocused:!1,inputIsHiddenAfterUpdate:void 0,prevProps:void 0,instancePrefix:"",isAppleDevice:!1},r.blockOptionHover=!1,r.isComposing=!1,r.commonProps=void 0,r.initialTouchX=0,r.initialTouchY=0,r.openAfterFocus=!1,r.scrollToFocusedOptionOnUpdate=!1,r.userIsDragging=void 0,r.controlRef=null,r.getControlRef=function(l){r.controlRef=l},r.focusedOptionRef=null,r.getFocusedOptionRef=function(l){r.focusedOptionRef=l},r.menuListRef=null,r.getMenuListRef=function(l){r.menuListRef=l},r.inputRef=null,r.getInputRef=function(l){r.inputRef=l},r.focus=r.focusInput,r.blur=r.blurInput,r.onChange=function(l,u){var d=r.props,h=d.onChange,f=d.name;u.name=f,r.ariaOnChange(l,u),h(l,u)},r.setValue=function(l,u,d){var h=r.props,f=h.closeMenuOnSelect,p=h.isMulti,g=h.inputValue;r.onInputChange("",{action:"set-value",prevInputValue:g}),f&&(r.setState({inputIsHiddenAfterUpdate:!p}),r.onMenuClose()),r.setState({clearFocusValueOnUpdate:!0}),r.onChange(l,{action:u,option:d})},r.selectOption=function(l){var u=r.props,d=u.blurInputOnSelect,h=u.isMulti,f=u.name,p=r.state.selectValue,g=h&&r.isOptionSelected(l,p),m=r.isOptionDisabled(l,p);if(g){var y=r.getOptionValue(l);r.setValue(p.filter(function(v){return r.getOptionValue(v)!==y}),"deselect-option",l)}else if(!m)h?r.setValue([].concat(ro(p),[l]),"select-option",l):r.setValue(l,"select-option");else{r.ariaOnChange(l,{action:"select-option",option:l,name:f});return}d&&r.blurInput()},r.removeValue=function(l){var u=r.props.isMulti,d=r.state.selectValue,h=r.getOptionValue(l),f=d.filter(function(g){return r.getOptionValue(g)!==h}),p=kn(u,f,f[0]||null);r.onChange(p,{action:"remove-value",removedValue:l}),r.focusInput()},r.clearValue=function(){var l=r.state.selectValue;r.onChange(kn(r.props.isMulti,[],null),{action:"clear",removedValues:l})},r.popValue=function(){var l=r.props.isMulti,u=r.state.selectValue,d=u[u.length-1],h=u.slice(0,u.length-1),f=kn(l,h,h[0]||null);d&&r.onChange(f,{action:"pop-value",removedValue:d})},r.getFocusedOptionId=function(l){return Br(r.state.focusableOptionsWithIds,l)},r.getFocusableOptionsWithIds=function(){return Ea(Qn(r.props,r.state.selectValue),r.getElementId("option"))},r.getValue=function(){return r.state.selectValue},r.cx=function(){for(var l=arguments.length,u=new Array(l),d=0;d<l;d++)u[d]=arguments[d];return fp.apply(void 0,[r.props.classNamePrefix].concat(u))},r.getOptionLabel=function(l){return Bc(r.props,l)},r.getOptionValue=function(l){return ar(r.props,l)},r.getStyles=function(l,u){var d=r.props.unstyled,h=hg[l](u,d);h.boxSizing="border-box";var f=r.props.styles[l];return f?f(h,u):h},r.getClassNames=function(l,u){var d,h;return(d=(h=r.props.classNames)[l])===null||d===void 0?void 0:d.call(h,u)},r.getElementId=function(l){return"".concat(r.state.instancePrefix,"-").concat(l)},r.getComponents=function(){return Am(r.props)},r.buildCategorizedOptions=function(){return Qn(r.props,r.state.selectValue)},r.getCategorizedOptions=function(){return r.props.menuIsOpen?r.buildCategorizedOptions():[]},r.buildFocusableOptions=function(){return Vc(r.buildCategorizedOptions())},r.getFocusableOptions=function(){return r.props.menuIsOpen?r.buildFocusableOptions():[]},r.ariaOnChange=function(l,u){r.setState({ariaSelection:z({value:l},u)})},r.onMenuMouseDown=function(l){l.button===0&&(l.stopPropagation(),l.preventDefault(),r.focusInput())},r.onMenuMouseMove=function(l){r.blockOptionHover=!1},r.onControlMouseDown=function(l){if(!l.defaultPrevented){var u=r.props.openMenuOnClick;r.state.isFocused?r.props.menuIsOpen?l.target.tagName!=="INPUT"&&l.target.tagName!=="TEXTAREA"&&r.onMenuClose():u&&r.openMenu("first"):(u&&(r.openAfterFocus=!0),r.focusInput()),l.target.tagName!=="INPUT"&&l.target.tagName!=="TEXTAREA"&&l.preventDefault()}},r.onDropdownIndicatorMouseDown=function(l){if(!(l&&l.type==="mousedown"&&l.button!==0)&&!r.props.isDisabled){var u=r.props,d=u.isMulti,h=u.menuIsOpen;r.focusInput(),h?(r.setState({inputIsHiddenAfterUpdate:!d}),r.onMenuClose()):r.openMenu("first"),l.preventDefault()}},r.onClearIndicatorMouseDown=function(l){l&&l.type==="mousedown"&&l.button!==0||(r.clearValue(),l.preventDefault(),r.openAfterFocus=!1,l.type==="touchend"?r.focusInput():setTimeout(function(){return r.focusInput()}))},r.onScroll=function(l){typeof r.props.closeMenuOnScroll=="boolean"?l.target instanceof HTMLElement&&jr(l.target)&&r.props.onMenuClose():typeof r.props.closeMenuOnScroll=="function"&&r.props.closeMenuOnScroll(l)&&r.props.onMenuClose()},r.onCompositionStart=function(){r.isComposing=!0},r.onCompositionEnd=function(){r.isComposing=!1},r.onTouchStart=function(l){var u=l.touches,d=u&&u.item(0);d&&(r.initialTouchX=d.clientX,r.initialTouchY=d.clientY,r.userIsDragging=!1)},r.onTouchMove=function(l){var u=l.touches,d=u&&u.item(0);if(d){var h=Math.abs(d.clientX-r.initialTouchX),f=Math.abs(d.clientY-r.initialTouchY),p=5;r.userIsDragging=h>p||f>p}},r.onTouchEnd=function(l){r.userIsDragging||(r.controlRef&&!r.controlRef.contains(l.target)&&r.menuListRef&&!r.menuListRef.contains(l.target)&&r.blurInput(),r.initialTouchX=0,r.initialTouchY=0)},r.onControlTouchEnd=function(l){r.userIsDragging||r.onControlMouseDown(l)},r.onClearIndicatorTouchEnd=function(l){r.userIsDragging||r.onClearIndicatorMouseDown(l)},r.onDropdownIndicatorTouchEnd=function(l){r.userIsDragging||r.onDropdownIndicatorMouseDown(l)},r.handleInputChange=function(l){var u=r.props.inputValue,d=l.currentTarget.value;r.setState({inputIsHiddenAfterUpdate:!1}),r.onInputChange(d,{action:"input-change",prevInputValue:u}),r.props.menuIsOpen||r.onMenuOpen()},r.onInputFocus=function(l){r.props.onFocus&&r.props.onFocus(l),r.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(r.openAfterFocus||r.props.openMenuOnFocus)&&r.openMenu("first"),r.openAfterFocus=!1},r.onInputBlur=function(l){var u=r.props.inputValue;if(r.menuListRef&&r.menuListRef.contains(document.activeElement)){r.inputRef.focus();return}r.props.onBlur&&r.props.onBlur(l),r.onInputChange("",{action:"input-blur",prevInputValue:u}),r.onMenuClose(),r.setState({focusedValue:null,isFocused:!1})},r.onOptionHover=function(l){if(!(r.blockOptionHover||r.state.focusedOption===l)){var u=r.getFocusableOptions(),d=u.indexOf(l);r.setState({focusedOption:l,focusedOptionId:d>-1?r.getFocusedOptionId(l):null})}},r.shouldHideSelectedOptions=function(){return Gc(r.props)},r.onValueInputFocus=function(l){l.preventDefault(),l.stopPropagation(),r.focus()},r.onKeyDown=function(l){var u=r.props,d=u.isMulti,h=u.backspaceRemovesValue,f=u.escapeClearsValue,p=u.inputValue,g=u.isClearable,m=u.isDisabled,y=u.menuIsOpen,v=u.onKeyDown,x=u.tabSelectsValue,C=u.openMenuOnFocus,E=r.state,w=E.focusedOption,j=E.focusedValue,S=E.selectValue;if(!m&&!(typeof v=="function"&&(v(l),l.defaultPrevented))){switch(r.blockOptionHover=!0,l.key){case"ArrowLeft":if(!d||p)return;r.focusValue("previous");break;case"ArrowRight":if(!d||p)return;r.focusValue("next");break;case"Delete":case"Backspace":if(p)return;if(j)r.removeValue(j);else{if(!h)return;d?r.popValue():g&&r.clearValue()}break;case"Tab":if(r.isComposing||l.shiftKey||!y||!x||!w||C&&r.isOptionSelected(w,S))return;r.selectOption(w);break;case"Enter":if(l.keyCode===229)break;if(y){if(!w||r.isComposing)return;r.selectOption(w);break}return;case"Escape":y?(r.setState({inputIsHiddenAfterUpdate:!1}),r.onInputChange("",{action:"menu-close",prevInputValue:p}),r.onMenuClose()):g&&f&&r.clearValue();break;case" ":if(p)return;if(!y){r.openMenu("first");break}if(!w)return;r.selectOption(w);break;case"ArrowUp":y?r.focusOption("up"):r.openMenu("last");break;case"ArrowDown":y?r.focusOption("down"):r.openMenu("first");break;case"PageUp":if(!y)return;r.focusOption("pageup");break;case"PageDown":if(!y)return;r.focusOption("pagedown");break;case"Home":if(!y)return;r.focusOption("first");break;case"End":if(!y)return;r.focusOption("last");break;default:return}l.preventDefault()}},r.state.instancePrefix="react-select-"+(r.props.instanceId||++Sg),r.state.selectValue=da(s.value),s.menuIsOpen&&r.state.selectValue.length){var o=r.getFocusableOptionsWithIds(),a=r.buildFocusableOptions(),i=a.indexOf(r.state.selectValue[0]);r.state.focusableOptionsWithIds=o,r.state.focusedOption=a[i],r.state.focusedOptionId=Br(o,a[i])}return r}return ih(n,[{key:"componentDidMount",value:function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput(),this.props.menuIsOpen&&this.state.focusedOption&&this.menuListRef&&this.focusedOptionRef&&fa(this.menuListRef,this.focusedOptionRef),cg()&&this.setState({isAppleDevice:!0})}},{key:"componentDidUpdate",value:function(r){var o=this.props,a=o.isDisabled,i=o.menuIsOpen,l=this.state.isFocused;(l&&!a&&r.isDisabled||l&&i&&!r.menuIsOpen)&&this.focusInput(),l&&a&&!r.isDisabled?this.setState({isFocused:!1},this.onMenuClose):!l&&!a&&r.isDisabled&&this.inputRef===document.activeElement&&this.setState({isFocused:!0}),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(fa(this.menuListRef,this.focusedOptionRef),this.scrollToFocusedOptionOnUpdate=!1)}},{key:"componentWillUnmount",value:function(){this.stopListeningComposition(),this.stopListeningToTouch(),document.removeEventListener("scroll",this.onScroll,!0)}},{key:"onMenuOpen",value:function(){this.props.onMenuOpen()}},{key:"onMenuClose",value:function(){this.onInputChange("",{action:"menu-close",prevInputValue:this.props.inputValue}),this.props.onMenuClose()}},{key:"onInputChange",value:function(r,o){this.props.onInputChange(r,o)}},{key:"focusInput",value:function(){this.inputRef&&this.inputRef.focus()}},{key:"blurInput",value:function(){this.inputRef&&this.inputRef.blur()}},{key:"openMenu",value:function(r){var o=this,a=this.state,i=a.selectValue,l=a.isFocused,u=this.buildFocusableOptions(),d=r==="first"?0:u.length-1;if(!this.props.isMulti){var h=u.indexOf(i[0]);h>-1&&(d=h)}this.scrollToFocusedOptionOnUpdate=!(l&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:u[d],focusedOptionId:this.getFocusedOptionId(u[d])},function(){return o.onMenuOpen()})}},{key:"focusValue",value:function(r){var o=this.state,a=o.selectValue,i=o.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var l=a.indexOf(i);i||(l=-1);var u=a.length-1,d=-1;if(a.length){switch(r){case"previous":l===0?d=0:l===-1?d=u:d=l-1;break;case"next":l>-1&&l<u&&(d=l+1);break}this.setState({inputIsHidden:d!==-1,focusedValue:a[d]})}}}},{key:"focusOption",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"first",o=this.props.pageSize,a=this.state.focusedOption,i=this.getFocusableOptions();if(i.length){var l=0,u=i.indexOf(a);a||(u=-1),r==="up"?l=u>0?u-1:i.length-1:r==="down"?l=(u+1)%i.length:r==="pageup"?(l=u-o,l<0&&(l=0)):r==="pagedown"?(l=u+o,l>i.length-1&&(l=i.length-1)):r==="last"&&(l=i.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:i[l],focusedValue:null,focusedOptionId:this.getFocusedOptionId(i[l])})}}},{key:"getTheme",value:(function(){return this.props.theme?typeof this.props.theme=="function"?this.props.theme(Vr):z(z({},Vr),this.props.theme):Vr})},{key:"getCommonProps",value:function(){var r=this.clearValue,o=this.cx,a=this.getStyles,i=this.getClassNames,l=this.getValue,u=this.selectOption,d=this.setValue,h=this.props,f=h.isMulti,p=h.isRtl,g=h.options,m=this.hasValue();return{clearValue:r,cx:o,getStyles:a,getClassNames:i,getValue:l,hasValue:m,isMulti:f,isRtl:p,options:g,selectOption:u,selectProps:h,setValue:d,theme:this.getTheme()}}},{key:"hasValue",value:function(){var r=this.state.selectValue;return r.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var r=this.props,o=r.isClearable,a=r.isMulti;return o===void 0?a:o}},{key:"isOptionDisabled",value:function(r,o){return Hc(this.props,r,o)}},{key:"isOptionSelected",value:function(r,o){return Wc(this.props,r,o)}},{key:"filterOption",value:function(r,o){return qc(this.props,r,o)}},{key:"formatOptionLabel",value:function(r,o){if(typeof this.props.formatOptionLabel=="function"){var a=this.props.inputValue,i=this.state.selectValue;return this.props.formatOptionLabel(r,{context:o,inputValue:a,selectValue:i})}else return this.getOptionLabel(r)}},{key:"formatGroupLabel",value:function(r){return this.props.formatGroupLabel(r)}},{key:"startListeningComposition",value:(function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))})},{key:"stopListeningComposition",value:function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))}},{key:"startListeningToTouch",value:(function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))})},{key:"stopListeningToTouch",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))}},{key:"renderInput",value:(function(){var r=this.props,o=r.isDisabled,a=r.isSearchable,i=r.inputId,l=r.inputValue,u=r.tabIndex,d=r.form,h=r.menuIsOpen,f=r.required,p=this.getComponents(),g=p.Input,m=this.state,y=m.inputIsHidden,v=m.ariaSelection,x=this.commonProps,C=i||this.getElementId("input"),E=z(z(z({"aria-autocomplete":"list","aria-expanded":h,"aria-haspopup":!0,"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props["aria-invalid"],"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-required":f,role:"combobox","aria-activedescendant":this.state.isAppleDevice?void 0:this.state.focusedOptionId||""},h&&{"aria-controls":this.getElementId("listbox")}),!a&&{"aria-readonly":!0}),this.hasValue()?v?.action==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return a?b.createElement(g,_({},x,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:C,innerRef:this.getInputRef,isDisabled:o,isHidden:y,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:u,form:d,type:"text",value:l},E)):b.createElement(Ym,_({id:C,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:sr,onFocus:this.onInputFocus,disabled:o,tabIndex:u,inputMode:"none",form:d,value:""},E))})},{key:"renderPlaceholderOrValue",value:function(){var r=this,o=this.getComponents(),a=o.MultiValue,i=o.MultiValueContainer,l=o.MultiValueLabel,u=o.MultiValueRemove,d=o.SingleValue,h=o.Placeholder,f=this.commonProps,p=this.props,g=p.controlShouldRenderValue,m=p.isDisabled,y=p.isMulti,v=p.inputValue,x=p.placeholder,C=this.state,E=C.selectValue,w=C.focusedValue,j=C.isFocused;if(!this.hasValue()||!g)return v?null:b.createElement(h,_({},f,{key:"placeholder",isDisabled:m,isFocused:j,innerProps:{id:this.getElementId("placeholder")}}),x);if(y)return E.map(function(P,N){var T=P===w,I="".concat(r.getOptionLabel(P),"-").concat(r.getOptionValue(P));return b.createElement(a,_({},f,{components:{Container:i,Label:l,Remove:u},isFocused:T,isDisabled:m,key:I,index:N,removeProps:{onClick:function(){return r.removeValue(P)},onTouchEnd:function(){return r.removeValue(P)},onMouseDown:function(R){R.preventDefault()}},data:P}),r.formatOptionLabel(P,"value"))});if(v)return null;var S=E[0];return b.createElement(d,_({},f,{data:S,isDisabled:m}),this.formatOptionLabel(S,"value"))}},{key:"renderClearIndicator",value:function(){var r=this.getComponents(),o=r.ClearIndicator,a=this.commonProps,i=this.props,l=i.isDisabled,u=i.isLoading,d=this.state.isFocused;if(!this.isClearable()||!o||l||!this.hasValue()||u)return null;var h={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return b.createElement(o,_({},a,{innerProps:h,isFocused:d}))}},{key:"renderLoadingIndicator",value:function(){var r=this.getComponents(),o=r.LoadingIndicator,a=this.commonProps,i=this.props,l=i.isDisabled,u=i.isLoading,d=this.state.isFocused;if(!o||!u)return null;var h={"aria-hidden":"true"};return b.createElement(o,_({},a,{innerProps:h,isDisabled:l,isFocused:d}))}},{key:"renderIndicatorSeparator",value:function(){var r=this.getComponents(),o=r.DropdownIndicator,a=r.IndicatorSeparator;if(!o||!a)return null;var i=this.commonProps,l=this.props.isDisabled,u=this.state.isFocused;return b.createElement(a,_({},i,{isDisabled:l,isFocused:u}))}},{key:"renderDropdownIndicator",value:function(){var r=this.getComponents(),o=r.DropdownIndicator;if(!o)return null;var a=this.commonProps,i=this.props.isDisabled,l=this.state.isFocused,u={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return b.createElement(o,_({},a,{innerProps:u,isDisabled:i,isFocused:l}))}},{key:"renderMenu",value:function(){var r=this,o=this.getComponents(),a=o.Group,i=o.GroupHeading,l=o.Menu,u=o.MenuList,d=o.MenuPortal,h=o.LoadingMessage,f=o.NoOptionsMessage,p=o.Option,g=this.commonProps,m=this.state.focusedOption,y=this.props,v=y.captureMenuScroll,x=y.inputValue,C=y.isLoading,E=y.loadingMessage,w=y.minMenuHeight,j=y.maxMenuHeight,S=y.menuIsOpen,P=y.menuPlacement,N=y.menuPosition,T=y.menuPortalTarget,I=y.menuShouldBlockScroll,D=y.menuShouldScrollIntoView,R=y.noOptionsMessage,F=y.onMenuScrollToTop,$=y.onMenuScrollToBottom;if(!S)return null;var V=function(A,B){var te=A.type,ne=A.data,H=A.isDisabled,oe=A.isSelected,Ee=A.label,En=A.value,Uo=m===ne,Vo=H?void 0:function(){return r.onOptionHover(ne)},Wu=H?void 0:function(){return r.selectOption(ne)},Bo="".concat(r.getElementId("option"),"-").concat(B),qu={id:Bo,onClick:Wu,onMouseMove:Vo,onMouseOver:Vo,tabIndex:-1,role:"option","aria-selected":r.state.isAppleDevice?void 0:oe};return b.createElement(p,_({},g,{innerProps:qu,data:ne,isDisabled:H,isSelected:oe,key:Bo,label:Ee,type:te,value:En,isFocused:Uo,innerRef:Uo?r.getFocusedOptionRef:void 0}),r.formatOptionLabel(A.data,"menu"))},W;if(this.hasOptions())W=this.getCategorizedOptions().map(function(U){if(U.type==="group"){var A=U.data,B=U.options,te=U.index,ne="".concat(r.getElementId("group"),"-").concat(te),H="".concat(ne,"-heading");return b.createElement(a,_({},g,{key:ne,data:A,options:B,Heading:i,headingProps:{id:H,data:U.data},label:r.formatGroupLabel(U.data)}),U.options.map(function(oe){return V(oe,"".concat(te,"-").concat(oe.index))}))}else if(U.type==="option")return V(U,"".concat(U.index))});else if(C){var q=E({inputValue:x});if(q===null)return null;W=b.createElement(h,g,q)}else{var Z=R({inputValue:x});if(Z===null)return null;W=b.createElement(f,g,Z)}var ee={minMenuHeight:w,maxMenuHeight:j,menuPlacement:P,menuPosition:N,menuShouldScrollIntoView:D},se=b.createElement(Op,_({},g,ee),function(U){var A=U.ref,B=U.placerProps,te=B.placement,ne=B.maxHeight;return b.createElement(l,_({},g,ee,{innerRef:A,innerProps:{onMouseDown:r.onMenuMouseDown,onMouseMove:r.onMenuMouseMove},isLoading:C,placement:te}),b.createElement(tg,{captureEnabled:v,onTopArrive:F,onBottomArrive:$,lockEnabled:I},function(H){return b.createElement(u,_({},g,{innerRef:function(Ee){r.getMenuListRef(Ee),H(Ee)},innerProps:{role:"listbox","aria-multiselectable":g.isMulti,id:r.getElementId("listbox")},isLoading:C,maxHeight:ne,focusedOption:m}),W)}))});return T||N==="fixed"?b.createElement(d,_({},g,{appendTo:T,controlElement:this.controlRef,menuPlacement:P,menuPosition:N}),se):se}},{key:"renderFormField",value:function(){var r=this,o=this.props,a=o.delimiter,i=o.isDisabled,l=o.isMulti,u=o.name,d=o.required,h=this.state.selectValue;if(d&&!this.hasValue()&&!i)return b.createElement(sg,{name:u,onFocus:this.onValueInputFocus});if(!(!u||i))if(l)if(a){var f=h.map(function(m){return r.getOptionValue(m)}).join(a);return b.createElement("input",{name:u,type:"hidden",value:f})}else{var p=h.length>0?h.map(function(m,y){return b.createElement("input",{key:"i-".concat(y),name:u,type:"hidden",value:r.getOptionValue(m)})}):b.createElement("input",{name:u,type:"hidden",value:""});return b.createElement("div",null,p)}else{var g=h[0]?this.getOptionValue(h[0]):"";return b.createElement("input",{name:u,type:"hidden",value:g})}}},{key:"renderLiveRegion",value:function(){var r=this.commonProps,o=this.state,a=o.ariaSelection,i=o.focusedOption,l=o.focusedValue,u=o.isFocused,d=o.selectValue,h=this.getFocusableOptions();return b.createElement(Bm,_({},r,{id:this.getElementId("live-region"),ariaSelection:a,focusedOption:i,focusedValue:l,isFocused:u,selectValue:d,focusableOptions:h,isAppleDevice:this.state.isAppleDevice}))}},{key:"render",value:function(){var r=this.getComponents(),o=r.Control,a=r.IndicatorsContainer,i=r.SelectContainer,l=r.ValueContainer,u=this.props,d=u.className,h=u.id,f=u.isDisabled,p=u.menuIsOpen,g=this.state.isFocused,m=this.commonProps=this.getCommonProps();return b.createElement(i,_({},m,{className:d,innerProps:{id:h,onKeyDown:this.onKeyDown},isDisabled:f,isFocused:g}),this.renderLiveRegion(),b.createElement(o,_({},m,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:f,isFocused:g,menuIsOpen:p}),b.createElement(l,_({},m,{isDisabled:f}),this.renderPlaceholderOrValue(),this.renderInput()),b.createElement(a,_({},m,{isDisabled:f}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(r,o){var a=o.prevProps,i=o.clearFocusValueOnUpdate,l=o.inputIsHiddenAfterUpdate,u=o.ariaSelection,d=o.isFocused,h=o.prevWasFocused,f=o.instancePrefix,p=r.options,g=r.value,m=r.menuIsOpen,y=r.inputValue,v=r.isMulti,x=da(g),C={};if(a&&(g!==a.value||p!==a.options||m!==a.menuIsOpen||y!==a.inputValue)){var E=m?xg(r,x):[],w=m?Ea(Qn(r,x),"".concat(f,"-option")):[],j=i?wg(o,x):null,S=Cg(o,E),P=Br(w,S);C={selectValue:x,focusedOption:S,focusedOptionId:P,focusableOptionsWithIds:w,focusedValue:j,clearFocusValueOnUpdate:!1}}var N=l!=null&&r!==a?{inputIsHidden:l,inputIsHiddenAfterUpdate:void 0}:{},T=u,I=d&&h;return d&&!I&&(T={value:kn(v,x,x[0]||null),options:x,action:"initial-input-focus"},I=!h),u?.action==="initial-input-focus"&&(T=null),z(z(z({},C),N),{},{prevProps:r,ariaSelection:T,prevWasFocused:I})}}]),n})(b.Component);Qc.defaultProps=vg;var jg=b.forwardRef(function(e,t){var n=oh(e);return b.createElement(Qc,_({ref:t},n))}),Pg=jg;function Eg(e){return c.jsx(Pr.DropdownIndicator,{...e,children:c.jsx(O,{name:"ChevronDown",size:16})})}function Ng(e){return c.jsx(Pr.ClearIndicator,{...e,children:c.jsx(O,{name:"Xmark",size:16})})}function Og(e){const{label:t,onClick:n,...s}=e,r=!!t&&!!n;return c.jsxs(Pr.MenuList,{...s,children:[e.children,r?c.jsx("button",{className:"w-full px-2 py-3 hover:bg-slate-50",onClick:n,children:t}):null]})}function ww(e){const t=e["aria-invalid"]==="true",{addItemButtonProps:n,...s}=e;return c.jsx(Pg,{...s,components:{DropdownIndicator:Eg,ClearIndicator:Ng,MenuList:r=>Og({...r,...n})},styles:{dropdownIndicator:()=>({label:"indicatorContainer",display:"flex",transition:"color 150ms",color:"var(color-gray-900)",padding:8,boxSizing:"border-box"}),clearIndicator:r=>({...r,color:"var(color-gray-900)"}),container:r=>({...r,borderColor:"var(color-gray-200)",fontSize:12}),placeholder:r=>({...r,color:t?"var(color-red-800)":"var(color-gray-500)"}),control:()=>({label:"control",alignItems:"center",cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:32,outline:"0 !important",position:"relative",transition:"all 100ms",backgroundColor:"var(--color-white)",borderColor:t?"var(--color-red-900)":"var(--color-gray-200)",borderStyle:"solid",borderWidth:1,borderRadius:"6px",boxSizing:"border-box"}),option:(r,o)=>({...r,backgroundColor:o.isSelected?"var(--color-slate-50)":"var(--color-white)",color:"var(--color-gray-800)",":hover":{backgroundColor:"var(--color-slate-50)"}}),menuList:r=>({...r,padding:0,borderRadius:"6px"})},theme:r=>({...r,colors:{...r.colors,primary:"var(--color-slate-100)",primary25:"var(--color-slate-50)",primary50:"var(--color-slate-100)",primary75:"var(--color-slate-100)",danger:"var(--color-red-900)",dangerLight:"var(--color-red-100)",neutral0:"var(--color-white)",neutral5:"var(--color-gray-50)",neutral10:"var(--color-gray-100)",neutral20:"var(--color-gray-200)",neutral30:"var(--color-gray-300)",neutral40:"var(--color-gray-400)",neutral50:"var(--color-gray-500)",neutral60:"var(--color-gray-600)",neutral70:"var(--color-gray-700)",neutral80:"var(--color-gray-800)",neutral90:"var(--color-gray-900)"}})})}const Cw=e=>{const{children:t,cookies:n,submitLabel:s,rejectLabel:r,onSubmit:o=()=>{},onReject:a=()=>{},...i}=e,[l,u]=b.useState(n),d=f=>{const{id:p,checked:g}=f.target;u(m=>m.map(y=>y.id===p?{...y,value:g}:y))},h="min-w-64 h-8 text-base";return c.jsxs("div",{...ce(i,"flex flex-col items-center"),children:[c.jsx("div",{className:"text-center",children:t}),c.jsx("div",{className:"my-8 flex gap-x-16 text-sm font-medium",children:l.map((f,p)=>c.jsxs("div",{className:"cursor-pointer",children:[c.jsx("input",{checked:f.value,className:"mr-1 size-3 cursor-pointer rounded-sm border-2 border-gray-900 accent-gray-900 focus:outline-none",id:f.id,onChange:d,type:"checkbox"}),c.jsx("label",{className:"cursor-pointer select-none",htmlFor:f.id,children:f.label})]},p))}),c.jsxs("div",{className:"flex gap-x-8",children:[c.jsx(Pe,{className:h,color:"light",onClick:()=>a(),size:"small",children:r},"button-reject"),c.jsx(Pe,{className:h,onClick:()=>o(l),size:"small",children:s},"button-submit")]})]})},Oa="min-h-[48px] min-w-[142px] text-base font-semibold py-3 px-6 rounded-xl outline-none active:opacity-75 hover:scale-105 transform transition-all";function fo(e){const{body:t,header:n,children:s,onCancel:r,onOpenChange:o,onContinue:a,cancelLabel:i,continueLabel:l,overlayProps:u,contentProps:d,bodyProps:h={},headerProps:f={},containerProps:p={},cancelButtonProps:g={},continueButtonProps:m={},buttonContainerProps:y={},...v}=e;return c.jsx(_e,{contentProps:{...d,className:M("rounded-3xl",d?.className)},onOpenChange:o,overlayProps:{...u,className:u?.className},...v,children:c.jsxs("div",{...ce(p,"w-[400px] p-6 text-slate-300"),children:[c.jsx("div",{...ce(f,"border-b border-slate-50 pb-2 text-2xl font-bold text-gray-800"),children:n}),c.jsxs("div",{...ce(h,"my-6 rounded-md bg-slate-50 p-4 text-center"),children:[t,s]}),c.jsxs("div",{...ce(y,"mt-8 flex justify-between gap-3"),children:[c.jsx("button",{onClick:r,...ce(g,M(Oa,"flex-1 bg-slate-50 text-slate-800")),children:i}),c.jsx("button",{onClick:a,...ce(m,M(Oa,"flex-1 bg-gray-800 text-gray-50")),children:l})]})]})})}const Yc=16;function Ia({label:e,depth:t,expanded:n,selected:s,hasChildren:r,icon:o,onToggle:a,onClick:i,children:l}){const u=d=>{d.stopPropagation(),a?.()};return c.jsxs("div",{children:[c.jsxs("div",{className:M("flex cursor-pointer items-center gap-1 py-1 pr-2 text-sm hover:bg-gray-100",s&&"bg-blue-50"),style:{paddingLeft:t*Yc+4},onClick:i,children:[r?c.jsx("button",{className:"flex h-4 w-4 shrink-0 items-center justify-center text-gray-500 hover:text-gray-700",onClick:u,type:"button",children:c.jsx(O,{className:M("transition-transform",n&&"rotate-90"),name:"CaretRight",size:12})}):c.jsx("span",{className:"w-4 shrink-0"}),o&&c.jsx("span",{className:"shrink-0 text-gray-500",children:o}),c.jsx("span",{className:"min-w-0 flex-1 truncate text-gray-700",children:e}),s&&c.jsx("span",{className:"ml-auto h-2 w-2 shrink-0 rounded-full bg-blue-500"})]}),n&&l]})}function Ig({column:e,depth:t}){const n=e.dataType.length>10?e.dataType.slice(0,10)+"…":e.dataType;return c.jsxs("div",{className:"flex items-center gap-1 py-0.5 pr-2 text-xs text-gray-500",style:{paddingLeft:t*Yc+4},children:[c.jsx("span",{className:"w-4 shrink-0"}),c.jsx("span",{className:"truncate",children:e.name}),c.jsxs("span",{className:"ml-auto shrink-0 text-gray-400",children:["(",n,")"]})]})}function Mg({schema:e,tables:t,selectedTable:n,onSelectTable:s,onRefresh:r,loading:o}){const[a,i]=b.useState({[e]:!0}),l=f=>{i(p=>({...p,[f]:!p[f]}))},u=f=>{s(f),i(p=>({...p,[f]:!p[f]}))},d=a[e]??!1,h=f=>{f.stopPropagation(),r?.()};return c.jsx("div",{className:"flex flex-col overflow-auto pt-4 text-sm",children:c.jsx(Ia,{depth:0,expanded:d,hasChildren:t.length>0,icon:c.jsx(O,{name:d?"FolderOpen":"FolderClose",size:16}),label:c.jsxs("div",{className:"flex flex-1 items-center",children:[c.jsx("span",{className:"truncate",children:e}),r&&c.jsx("button",{className:"ml-auto p-0.5 text-gray-400 hover:text-gray-600",onClick:h,type:"button",disabled:o,children:c.jsx(O,{name:"Reload",size:14,className:o?"animate-spin":void 0})})]}),onClick:()=>l(e),onToggle:()=>l(e),children:t.map(f=>{const p=a[f.name]??!1,g=n===f.name;return c.jsx(Ia,{depth:1,expanded:p,hasChildren:f.columns.length>0,icon:c.jsx(O,{name:"TreeViewSlash",size:16}),label:f.name,selected:g,onClick:()=>u(f.name),onToggle:()=>l(f.name),children:f.columns.map(m=>c.jsx(Ig,{column:m,depth:2},m.name))},f.name)})})})}function Tg(e){return b.forwardRef(e)}const yt=Tg(function(t,n){const{items:s,value:r,id:o,onChange:a,containerClassName:i,menuClassName:l,itemClassName:u,absolutePositionMenu:d=!1,borderRadius:h="6px"}=t,[f,p]=b.useState(!1),g=y(r)??s[0];function m(x){x.disabled||(a(x.value),p(!1))}function y(x){return s.find(C=>C.value===x)}const v=s.filter(x=>x.value!==r);return c.jsxs("div",{className:M("border border-gray-200 bg-gray-50 text-gray-800 transition-[border-radius]",d&&"relative",i),"data-open":f,ref:n,style:{borderRadius:h},children:[c.jsxs("div",{className:M("flex min-w-[360px] cursor-pointer items-center justify-between pr-3 text-gray-800 outline-none",l),id:o,onClick:()=>p(!f),children:[c.jsx(Ma,{...g,className:u}),c.jsx(O,{className:Zs("transition",f?"":"-rotate-90"),name:"ChevronDown"})]}),c.jsx("div",{className:M("max-h-0 w-full overflow-hidden bg-inherit transition-[max-height] ease-in-out",f&&"max-h-screen",d&&"absolute"),style:{borderRadius:`0 0 ${h} ${h}`},children:v.map(x=>c.jsx(Ma,{...x,className:u,onItemClick:()=>m(x)},x.value))})]})});function Ma(e){const{className:t,disabled:n,onItemClick:s,icon:r,displayValue:o,value:a,description:i}=e;return c.jsxs("div",{className:M(n?"cursor-not-allowed text-gray-500":"text-gray-800","flex size-full cursor-pointer items-center gap-2 bg-inherit py-3 pl-3 text-start outline-none",t),onClick:s,children:[r,c.jsxs("div",{children:[c.jsx("p",{className:"capitalize text-inherit",children:o??a.toLowerCase()}),c.jsx("p",{className:"text-xs text-gray-600",children:i})]})]})}function Ta(e){const t=["=","!=",">","<",">=","<=","IS NULL","IS NOT NULL"],n=e.dataType.toLowerCase();return n.includes("varchar")||n.includes("text")||n.includes("char")?[...t,"LIKE","ILIKE"]:(n.includes("int")||n.includes("decimal")||n.includes("numeric")||n.includes("real")||n.includes("double")||n.includes("float")||n.includes("bigint")||n.includes("smallint"),t)}function Dg(e,t){if(t==="IS NULL"||t==="IS NOT NULL")return"text";const n=e.dataType.toLowerCase();return n.includes("int")||n.includes("decimal")||n.includes("numeric")||n.includes("real")||n.includes("double")||n.includes("float")||n.includes("bigint")||n.includes("smallint")?"number":n.includes("timestamp")||n.includes("date")||n.includes("time")?"datetime-local":"text"}function kg({clause:e,columns:t,onUpdate:n,onRemove:s,showConnector:r,connector:o,onConnectorChange:a}){const i=t.find(v=>v.name===e.column),l=i?Ta(i):["=","!="],u=i?Dg(i,e.operator):"text",d=e.operator!=="IS NULL"&&e.operator!=="IS NOT NULL",h=b.useMemo(()=>t.map(v=>({value:v.name,displayValue:v.name})),[t]),f=b.useMemo(()=>l.map(v=>({value:v,displayValue:v})),[l]),p=b.useMemo(()=>[{value:"AND",displayValue:"AND"},{value:"OR",displayValue:"OR"}],[]),g=b.useCallback(v=>{const x=t.find(w=>w.name===v);if(!x)return;const C=Ta(x),E=C.includes(e.operator)?e.operator:C[0];n({...e,column:v,operator:E,value:""})},[e,t,n]),m=b.useCallback(v=>{n({...e,operator:v,value:v==="IS NULL"||v==="IS NOT NULL"?"":e.value})},[e,n]),y=b.useCallback(v=>{n({...e,value:v})},[e,n]);return c.jsxs("div",{className:"flex items-center gap-2",children:[r&&c.jsx(yt,{absolutePositionMenu:!0,borderRadius:"4px",containerClassName:"min-w-[80px]",id:`connector-${e.id}`,items:p,itemClassName:"px-2 py-1 text-xs",menuClassName:"px-2 py-1 text-xs min-w-[80px]",value:o,onChange:a}),c.jsx(yt,{absolutePositionMenu:!0,borderRadius:"4px",containerClassName:"min-w-[150px]",id:`column-${e.id}`,items:h,itemClassName:"px-2 py-1 text-xs",menuClassName:"px-2 py-1 text-xs min-w-[150px]",value:e.column,onChange:g}),c.jsx(yt,{absolutePositionMenu:!0,borderRadius:"4px",containerClassName:"min-w-[100px]",id:`operator-${e.id}`,items:f,itemClassName:"px-2 py-1 text-xs",menuClassName:"px-2 py-1 text-xs min-w-[100px]",value:e.operator,onChange:m}),d&&c.jsx("input",{className:"min-w-[150px] rounded border border-gray-300 bg-white px-2 py-1 text-xs text-gray-900",type:u,value:e.value,onChange:v=>y(v.target.value)}),c.jsx("button",{className:"flex items-center justify-center rounded p-1 text-gray-500 hover:bg-gray-200 hover:text-gray-700",onClick:s,title:"Remove filter",type:"button",children:c.jsx(O,{name:"Xmark",size:14})})]})}function Rg({columns:e,filters:t,onFiltersChange:n}){const[s,r]=b.useState(!1),o=b.useCallback(()=>{const d={id:`filter-${Date.now()}-${Math.random()}`,column:e[0]?.name??"",operator:"=",value:""};n(t?{clauses:[...t.clauses,d],connectors:[...t.connectors,(t.clauses.length>0,"AND")]}:{clauses:[d],connectors:[]}),r(!0)},[e,t,n]),a=b.useCallback((d,h)=>{if(!t)return;const f=[...t.clauses];f[d]=h,n({...t,clauses:f})},[t,n]),i=b.useCallback(d=>{if(!t)return;const h=t.clauses.filter((p,g)=>g!==d),f=t.connectors.filter((p,g)=>g!==d-1);h.length===0?n(void 0):n({clauses:h,connectors:f})},[t,n]),l=b.useCallback((d,h)=>{if(!t)return;const f=[...t.connectors];f[d]=h,n({...t,connectors:f})},[t,n]),u=t&&t.clauses.length>0;return c.jsxs("div",{className:"flex shrink-0 flex-col gap-2 rounded-lg border border-gray-300 bg-white p-2",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("button",{className:"flex items-center gap-1 text-xs text-gray-700 hover:text-gray-900",onClick:()=>r(!s),type:"button",children:[c.jsx(O,{className:M("transition-transform",s&&"rotate-90"),name:"ChevronDown",size:12}),c.jsx("span",{children:"Filters"}),u&&c.jsx("span",{className:"rounded bg-blue-100 px-1.5 py-0.5 text-xs text-blue-700",children:t.clauses.length})]}),c.jsxs("button",{className:"flex items-center gap-1 rounded border border-gray-300 bg-white px-2 py-1 text-xs text-gray-700 hover:bg-gray-100",onClick:o,type:"button",children:[c.jsx(O,{name:"Plus",size:12}),"Add Filter"]})]}),s&&u&&c.jsx("div",{className:"flex flex-col gap-2",children:t.clauses.map((d,h)=>c.jsx(kg,{clause:d,columns:e,connector:h>0?t.connectors[h-1]??"AND":"AND",onConnectorChange:f=>l(h-1,f),onRemove:()=>i(h),onUpdate:f=>a(h,f),showConnector:h>0},d.id))})]})}function ms(e){return e===null?"NULL":e===void 0?"":typeof e=="object"?JSON.stringify(e):typeof e=="function"?"[function]":typeof e=="symbol"?e.toString():String(e)}function Kc(e){return e.includes(",")||e.includes(`
7
- `)||e.includes('"')?`"${e.replace(/"/g,'""')}"`:e}function Xc(e,t){return t.map(n=>{const s=ms(e[n.name]);return Kc(s)}).join(",")}function Jc(e,t){const n=t.map(r=>Kc(r.name)).join(","),s=e.map(r=>Xc(r,t));return[n,...s].join(`
8
- `)}async function Da(e){await navigator.clipboard.writeText(e)}function Ag({direction:e,active:t}){return t?c.jsx(O,{className:e==="asc"?"rotate-180":void 0,name:"TriangleDown",size:12}):c.jsx(O,{className:"opacity-0 group-hover:opacity-50",name:"CaretSort",size:12})}function Lg({columns:e,rows:t,pagination:n,onPageChange:s,onSort:r,currentSort:o,loading:a=!1,filters:i,onFiltersChange:l,onCopyAll:u}){const{offset:d,limit:h,total:f}=n,p=Math.floor(d/h),g=f!==null?Math.ceil(f/h):0,m=f===0?0:d+1,y=f!==null?Math.min(d+h,f):d+t.length,v=I=>{s(I*h)},x=I=>{if(!r)return;const D=o?.column===I&&o.direction==="asc"?"desc":"asc";r({column:I,direction:D})},E=(()=>{if(g<=3)return Array.from({length:g},($,V)=>V);const D=Math.max(0,Math.min(p-1,g-3)),R=Math.min(g-1,D+3-1),F=[];for(let $=D;$<=R;$++)F.push($);return F})(),[w,j]=b.useState(!1),[S,P]=b.useState(null),N=async()=>{if(t.length!==0){j(!0);try{const I=u?await u():Jc(t,e);await Da(I),setTimeout(()=>j(!1),1e3)}catch(I){console.error("Failed to copy to clipboard:",I),j(!1)}}},T=async I=>{if(!(I<0||I>=t.length)){P(I);try{const D=Xc(t[I],e);await Da(D),setTimeout(()=>P(null),1e3)}catch(D){console.error("Failed to copy to clipboard:",D),P(null)}}};return c.jsxs("div",{className:"flex h-full flex-col gap-2",children:[l&&c.jsx(Rg,{columns:e,filters:i,onFiltersChange:l}),c.jsxs("div",{className:"flex shrink-0 items-center justify-between text-sm",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-gray-600",children:a?"Loading...":f!==null?`Showing ${m.toLocaleString()}-${y.toLocaleString()} of ${f.toLocaleString()}`:`Showing ${t.length.toLocaleString()} rows`}),t.length>0&&c.jsxs("button",{className:"flex items-center gap-1 rounded border border-gray-300 bg-white px-2 py-1 text-xs text-gray-700 hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50",disabled:a||w,onClick:N,title:"Copy all rows as CSV",type:"button",children:[c.jsx(O,{name:w?"Check":"Copy",size:14}),w?"Copied!":"Copy All"]})]}),f!==null&&f>h&&c.jsxs("div",{className:"flex gap-1",children:[c.jsx("button",{className:"rounded border border-gray-300 bg-white px-2 py-1 text-xs text-gray-700 hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50",disabled:p===0,onClick:()=>v(0),type:"button",children:"First"}),c.jsx("button",{className:"rounded border border-gray-300 bg-white px-2 py-1 text-xs text-gray-700 hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50",disabled:p===0,onClick:()=>v(p-1),type:"button",children:c.jsx(O,{className:"rotate-90",name:"ChevronDown",size:14})}),E[0]>0&&c.jsx("span",{className:"flex items-center px-1 text-xs text-gray-500",children:"..."}),E.map(I=>c.jsx("button",{className:M("min-w-8 rounded border px-2 py-1 text-xs",I===p?"border-blue-500 bg-blue-50 text-blue-700":"border-gray-300 bg-white text-gray-700 hover:bg-gray-100"),onClick:()=>v(I),type:"button",children:I+1},I)),E[E.length-1]<g-1&&c.jsx("span",{className:"flex items-center px-1 text-xs text-gray-500",children:"..."}),c.jsx("button",{className:"rounded border border-gray-300 bg-white px-2 py-1 text-xs text-gray-700 hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50",disabled:p>=g-1,onClick:()=>v(p+1),type:"button",children:c.jsx(O,{className:"-rotate-90",name:"ChevronDown",size:14})}),c.jsx("button",{className:"rounded border border-gray-300 bg-white px-2 py-1 text-xs text-gray-700 hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50",disabled:p>=g-1,onClick:()=>v(g-1),type:"button",children:"Last"})]})]}),c.jsx("div",{className:M("max-h-full overflow-auto rounded-lg border border-gray-300 transition-opacity",a&&"pointer-events-none opacity-50"),children:c.jsxs("table",{className:"w-full border-collapse",children:[c.jsx("thead",{className:"sticky top-0 bg-gray-100",children:c.jsxs("tr",{children:[c.jsx("th",{className:"w-12 px-2 py-2 text-center text-xs font-medium text-gray-600",children:c.jsx("span",{className:"sr-only",children:"Copy"})}),e.map((I,D)=>{const R=o?.column===I.name,F=R?o.direction:"asc";return c.jsx("th",{className:M("group px-3 py-2 text-left text-xs font-medium text-gray-600",D>0&&"border-l border-gray-300",r&&"cursor-pointer hover:bg-gray-200 hover:text-gray-900"),onClick:()=>r&&x(I.name),children:c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("span",{className:"truncate",children:I.name}),r&&c.jsx(Ag,{active:R,direction:F})]})},I.name)})]})}),c.jsx("tbody",{children:t.length===0?c.jsx("tr",{children:c.jsx("td",{className:"px-3 py-8 text-center text-sm text-gray-500",colSpan:e.length+1,children:"No data"})}):t.map((I,D)=>c.jsxs("tr",{className:"odd:bg-white even:bg-gray-50 hover:bg-blue-50",children:[c.jsx("td",{className:"px-2 py-2 text-center",children:c.jsx("button",{className:"flex items-center justify-center rounded p-1 text-gray-500 hover:bg-gray-200 hover:text-gray-700",onClick:()=>void T(D),title:"Copy row as CSV",type:"button",children:c.jsx(O,{name:S===D?"Check":"Copy",size:14})})}),e.map((R,F)=>c.jsx("td",{className:M("px-3 py-2 text-xs text-gray-900",F>0&&"border-l border-gray-300"),children:c.jsx("span",{className:M("block truncate",I[R.name]===null&&"italic text-gray-400"),title:ms(I[R.name]),children:ms(I[R.name])})},R.name))]},D))})]})})]})}const Fg=50;function $g({schema:e,getTables:t,getTableRows:n,getDefaultSort:s,pageSize:r=Fg,onImportDb:o,onExportDb:a}){const i=b.useRef(null),[l,u]=b.useState([]),[d,h]=b.useState(!0),[f,p]=b.useState(),[g,m]=b.useState(null),[y,v]=b.useState({offset:0,limit:r,total:null}),[x,C]=b.useState(),[E,w]=b.useState(),[j,S]=b.useState(!1),[P,N]=b.useState(null),T=l.find(A=>A.name===f)?.columns??[],I=b.useCallback(async()=>{if(!f)return;S(!0);const A=await n(f,{schema:e,limit:y.limit,offset:y.offset,sort:x,filters:E});m(A),v(B=>({...B,total:A.total})),S(!1)},[f,e,y.limit,y.offset,x,E,n]),D=b.useCallback(async()=>{if(!f)return"";const A=y.total??1e6,B=await n(f,{schema:e,limit:A,offset:0,sort:x,filters:E});return Jc(B.rows,T)},[f,e,y.total,x,E,n,T]),R=b.useCallback(async()=>{h(!0);const A=await t();return u(A),h(!1),A},[t]),F=b.useCallback(async()=>{const A=await R();if(f&&!A.some(B=>B.name===f)){p(void 0),m(null);return}f&&await I()},[R,f,I]);b.useEffect(()=>{R()},[R]),b.useEffect(()=>{f&&I()},[f,y.offset,x,E,I]);const $=A=>{A!==f&&(p(A),v(B=>({...B,offset:0,total:null})),C(s?.(A)),w(void 0),m(null))},V=A=>{v(B=>({...B,offset:A}))},W=A=>{C(A),v(B=>({...B,offset:0}))},q=()=>{i.current?.click()},Z=A=>{const B=A.target.files?.[0];B&&(B.text().then(te=>{N(te)}),A.target.value="")},ee=async()=>{P&&(p(void 0),m(null),await o?.(P),N(null),await R())},se=()=>{N(null)},U=()=>{a?.()};return c.jsxs("div",{className:"flex h-full",children:[c.jsx("input",{ref:i,type:"file",accept:".sql,.txt,text/plain",className:"hidden",onChange:Z}),c.jsx(fo,{open:!!P,onOpenChange:A=>!A&&N(null),header:"Replace Database?",body:"This will delete all existing data and replace it with the imported file. This action cannot be undone.",cancelLabel:"Cancel",continueLabel:"Replace Data",onCancel:se,onContinue:()=>void ee(),continueButtonProps:{className:"bg-red-900 text-white hover:bg-red-800"}}),c.jsxs("div",{className:"flex w-64 shrink-0 flex-col border-r border-gray-200",children:[c.jsx("div",{className:"flex-1 overflow-auto",children:c.jsx(Mg,{schema:e,tables:l,selectedTable:f,onSelectTable:$,onRefresh:F,loading:d||j})}),(o||a)&&c.jsxs("div",{className:"flex shrink-0 flex-col gap-2 border-t border-gray-200 p-2",children:[o&&c.jsx("button",{className:"rounded border border-gray-300 bg-white px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-100",onClick:q,type:"button",children:"Import DB"}),a&&c.jsx("button",{className:"rounded border border-gray-300 bg-white px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-100",onClick:U,type:"button",children:"Export DB"})]})]}),c.jsx("div",{className:"flex-1 overflow-auto p-4",children:f?!g&&j?c.jsx("div",{className:"text-sm text-gray-500",children:"Loading..."}):g?c.jsx(Lg,{columns:T,rows:g.rows,pagination:y,onPageChange:V,onSort:W,currentSort:x,loading:j,filters:E,onFiltersChange:A=>{w(A),v(B=>({...B,offset:0}))},onCopyAll:D}):null:c.jsx("div",{className:"text-sm text-gray-500",children:"Select a table to view data"})})]})}function Sw(e){const{message:t="Loading editor",...n}=e;return c.jsx("div",{className:"grid h-full place-items-center",...n,children:c.jsxs("div",{className:"-mt-20 grid place-items-center",children:[c.jsx("h3",{className:"mb-4 text-xl",children:t}),c.jsx(J0,{})]})})}function ir(e){const{title:t,isOpen:n,onOpenChange:s,children:r,containerClassName:o,toggleClassName:a,contentClassName:i}=e;return c.jsxs("div",{className:M(o),children:[c.jsxs("div",{className:M("flex cursor-pointer justify-between text-gray-500",a),onClick:s,children:[c.jsx("h2",{className:"font-semibold text-inherit",children:t}),c.jsx(O,{className:Zs("transition",n?"":"-rotate-90"),size:16,name:"ChevronDown"})]}),c.jsx("div",{className:M("max-h-0 overflow-hidden transition-[max-height] duration-300 ease-in-out",n&&"max-h-screen",i),children:r})]})}function mt(e){return c.jsx("div",{...e,className:M("h-px bg-gray-200",e.className)})}function Ve(e){const{children:t,content:n,open:s,defaultOpen:r,onOpenChange:o,className:a,side:i="top",sideOffset:l=5,delayDuration:u,...d}=e;return c.jsxs(lf,{defaultOpen:r,delayDuration:u,onOpenChange:o,open:s,children:[c.jsx(uf,{asChild:!0,children:t}),c.jsx(df,{children:c.jsx(ff,{...d,side:i,sideOffset:l,className:M("shadow-tooltip rounded-lg border border-gray-200 bg-white p-2 text-xs",a),children:n})})]})}const Zc=cf,zg=e=>{const{className:t,timestampUtcMs:n,title:s,subtitle:r,onClick:o,isSelected:a=!1}=e,[i,l]=b.useState(!1),u=!!s||!!r||!!n;b.useEffect(()=>{i&&(l(!1),setTimeout(()=>u&&l(!0),50))},[s,r,n,u]);const d=g=>{if(!g)return"";try{return N0(new Date(g),{addSuffix:!0})}catch{return g}},h=c.jsxs("div",{className:"flex flex-col text-xs",children:[!!s&&c.jsx("div",{children:s}),!!r&&c.jsx("div",{className:"text-gray-300",children:r}),!!n&&c.jsx("div",{children:d(n)})]}),f=()=>{u&&l(!0)},p=()=>{l(!1)};return c.jsxs("div",{className:"relative",onMouseEnter:f,onMouseLeave:p,children:[a&&c.jsx(O,{name:"TimelineCaret",color:"#4EA9FF",size:10,className:"absolute top-[-11px] z-40"}),c.jsx(Ve,{className:"rounded-md bg-gray-900 text-white",content:h,open:i&&u,onOpenChange:l,delayDuration:0,side:"bottom",sideOffset:5,children:c.jsx("div",{className:M("mx-0.5 flex h-[25px] w-1.5 cursor-pointer flex-col items-center justify-center rounded-[2px] hover:bg-blue-300",a&&"bg-blue-300",t),onClick:o,"data-title":s,"data-subtitle":r,"data-timestamp":n,children:c.jsx("div",{className:"h-0.5 w-1 rounded-full bg-gray-500"})})})]})},ka=(e=0)=>{switch(!0){case e<=0:return"h-[1px]";case e===1:return"h-[3px]";case e===2:return"h-[6px]";case e===3:return"h-[9px]";case e>=4:return"h-[12px]";default:return"h-[1px]"}},_g=e=>{if(!e)return"";try{const t=O0(e);return tr(t,"HH:mm, dd, MMMM")}catch{return e}},Ug=({onClick:e,className:t,timestampUtcMs:n,additions:s,deletions:r,addSize:o=0,delSize:a=0,isSelected:i=!1})=>{const[l,u]=b.useState(!1),d=o===0&&a===0,h=ka(o),f=ka(a),p=c.jsxs("div",{className:"flex flex-col text-xs",children:[c.jsx("div",{children:_g(n)}),c.jsx("div",{className:"text-green-900",children:`${s} additions +`}),c.jsx("div",{className:"text-red-700",children:`${r} deletions -`})]}),g=()=>{d||u(!0)},m=()=>{u(!1)};return c.jsxs("div",{className:"relative",onMouseEnter:g,onMouseLeave:m,children:[i&&c.jsx(O,{name:"TimelineCaret",color:"#4EA9FF",size:10,className:"absolute left-[-2px] top-[-11px] z-40"}),d?c.jsx("div",{className:M("flex h-[25px] w-1.5 cursor-pointer flex-col items-center justify-center rounded-[2px] hover:bg-blue-300",t),"data-timestamp":n,onClick:e,children:c.jsx("div",{className:"size-[3px] rounded-full bg-gray-500"})}):c.jsx(Ve,{className:"rounded-md bg-gray-900 text-white",content:p,open:l,onOpenChange:u,delayDuration:0,side:"bottom",sideOffset:5,children:c.jsxs("div",{className:M("flex h-[25px] w-1.5 cursor-pointer flex-col items-center justify-center rounded-[2px] hover:bg-blue-300",t,i&&"bg-blue-300"),"data-timestamp":n,onClick:e,children:[c.jsx("div",{className:"flex h-3 w-0.5 items-end",children:c.jsx("div",{className:M("h-3 w-0.5 rounded-t-full bg-green-600",h)})}),c.jsx("div",{className:"flex h-3 w-0.5 items-start",children:c.jsx("div",{className:M("h-3 w-0.5 rounded-b-full bg-red-600",f)})})]})})]})},Ra={id:"default",type:"bar",addSize:0,delSize:0},Vg=e=>{const{timeline:t=[],onItemClick:n}=e,[s,r]=b.useState(null),o=b.useRef(null),a=p=>{p.id===s||p.id===Ra.id?(n?.(null),r(null)):(n?.(p),r(p.id))},i=[...t,Ra],[l,u]=b.useMemo(()=>{const p=i.findIndex(g=>g.id===s);return p===-1?[i,[]]:[i.slice(0,p),i.slice(p)]},[i,s]),d=b.useCallback(p=>p.map(g=>{if(g.type==="divider"){const{timestampUtcMs:m,title:y,subtitle:v}=g;return c.jsx(zg,{timestampUtcMs:m,title:y,subtitle:v,onClick:()=>a(g),isSelected:g.id===s},g.id)}return c.jsx(Ug,{timestampUtcMs:g.timestampUtcMs,addSize:g.addSize,delSize:g.delSize,additions:g.additions,deletions:g.deletions,isSelected:g.id===s,onClick:()=>a(g)},g.id)}),[a,s]),h=b.useMemo(()=>d(l),[l,d]),f=b.useMemo(()=>d(u),[u,d]);return b.useEffect(()=>{o.current&&(o.current.scrollLeft=o.current.scrollWidth)},[]),c.jsx(Zc,{delayDuration:0,skipDelayDuration:0,children:c.jsxs("div",{className:"relative h-[36px] w-full",children:[c.jsx("div",{className:"absolute left-[0px] z-[20] h-[17px] w-[6px] bg-white",children:c.jsx("div",{className:"mt-[11px] h-[6px] w-[6px] rounded-tl-md bg-slate-50"})}),c.jsx("div",{className:"absolute right-[0px] top-[11px] z-[20] h-[6px] w-[6px] bg-white",children:c.jsx("div",{className:"h-[6px] w-[6px] rounded-tr-md bg-slate-50"})}),c.jsx("div",{className:"absolute inset-x-0 bottom-0 h-[25px] rounded-md bg-slate-50"}),c.jsx("div",{className:"absolute inset-x-0 bottom-0 h-[36px]",children:c.jsx("div",{ref:o,className:"h-full overflow-x-auto rounded-md",children:c.jsxs("div",{className:"ml-auto flex h-[36px] w-max items-end px-2 pb-0",children:[c.jsx("div",{className:"flex",children:h}),c.jsx("div",{className:"flex rounded-sm bg-blue-200",children:f})]})})}),c.jsx("div",{className:"pointer-events-none absolute bottom-0 left-0 z-10 h-[25px] w-2 rounded-l-md bg-slate-50"}),c.jsx("div",{className:"pointer-events-none absolute bottom-0 right-0 z-10 h-[25px] w-2 rounded-r-md bg-slate-50"})]})})};function Bg(e){const[t,n]=Ku(e),s=t?.header.revision.global??0,r=t?.header.revision.local??0,o=s>0||r>0,a=!!t?.clipboard.length;return{undo:()=>{n(Td())},redo:()=>{n(Md())},canUndo:o,canRedo:a}}function Hg(e){return[]}const jw=e=>{const{onClose:t,children:n,onExport:s,className:r,document:o,onSwitchboardLinkClick:a,enabledControls:i=["undo","redo","export","history"],defaultTimelineVisible:l=!0,disableRevisionHistory:u=!1,initialTimelineVisible:d=!1,...h}=e,[f]=Xu(),p=o??f,g=p?.header.name||void 0,m=Ju(p?.header.id),y=t??(()=>xt(m)),v=async $=>{$&&(s?s($):await nd($))},x=Bg(p?.header.id),C=!x.canUndo,E=!x.canRedo,w=Hg(p?.header.id),[j,S]=b.useState(d),P=Zu(p),T=a??(P?async()=>{if(P)try{const $=await P();window.open($,"_blank")}catch($){console.error("Error opening switchboard link:",$)}}:void 0),I=!p,D=!T,R=w.length===0;b.useEffect(()=>{typeof d=="boolean"&&S(d)},[d]);const F=()=>{R||S(!j)};return c.jsxs("div",{className:"flex w-full flex-col",...h,children:[c.jsxs("div",{className:M("flex h-12 w-full items-center justify-between rounded-xl border border-gray-200 bg-slate-50 px-4",r),children:[c.jsxs("div",{className:"flex items-center gap-x-2",children:[i.includes("undo")&&c.jsx("button",{className:M("grid size-8 place-items-center rounded-lg border border-gray-200 bg-white",C?"cursor-not-allowed":"cursor-pointer active:opacity-70"),onClick:x.undo,disabled:C,children:c.jsx(O,{name:"ArrowCouterclockwise",size:16,className:C?"text-gray-500":"text-gray-900"})}),i.includes("redo")&&c.jsx("button",{className:M("grid size-8 place-items-center rounded-lg border border-gray-200 bg-white",E?"cursor-not-allowed":"cursor-pointer active:opacity-70"),onClick:x.redo,disabled:E,children:c.jsx("div",{className:"-scale-x-100",children:c.jsx(O,{name:"ArrowCouterclockwise",size:16,className:E?"text-gray-500":"text-gray-900"})})}),i.includes("export")&&c.jsx("button",{className:M("flex h-8 items-center rounded-lg border border-gray-200 bg-white px-3 text-sm",I?"cursor-not-allowed":"cursor-pointer active:opacity-70"),onClick:()=>void v(p),disabled:I,children:c.jsx("span",{className:I?"text-gray-500":"text-gray-900",children:"Export"})})]}),c.jsx("div",{className:"flex items-center",children:c.jsx("h1",{className:"text-sm font-medium text-gray-500",children:g})}),c.jsxs("div",{className:"flex items-center gap-x-2",children:[!D&&c.jsx("button",{className:M("grid size-8 place-items-center rounded-lg border border-gray-200 bg-white","cursor-pointer active:opacity-70"),onClick:T,disabled:D,children:c.jsx(O,{name:"Drive",size:16,className:"text-gray-900"})}),i.includes("history")&&c.jsx("button",{className:M("grid size-8 place-items-center rounded-lg border border-gray-200 bg-white",u?"cursor-not-allowed":"cursor-pointer active:opacity-70"),onClick:ed,disabled:u,children:c.jsx(O,{name:"History",size:16,className:u?"text-gray-500":"text-gray-900"})}),i.includes("timeline")&&l&&c.jsx("button",{className:M("grid size-8 place-items-center rounded-lg border border-gray-200 bg-white",R?"cursor-not-allowed":"cursor-pointer active:opacity-70"),onClick:F,disabled:R,"aria-pressed":j,children:c.jsx(O,{name:"Timeline",size:16,className:M("text-gray-900",R&&"opacity-50",j&&"text-blue-600")})}),c.jsx("button",{"aria-label":"Close document",className:"grid size-8 cursor-pointer place-items-center rounded-lg border border-gray-200 bg-white active:opacity-70",onClick:y,children:c.jsx(O,{name:"XmarkLight",size:16,className:"text-gray-900"})})]})]}),j&&c.jsx("div",{className:"mt-2 w-full",children:c.jsx(Vg,{timeline:w,onItemClick:td})}),n]})};function el(e){const{target:t,onAddFileOverride:n,trackNestedDrag:s=!1,acceptedFileExtensions:r}=e??{},[o,a]=b.useState(!1),i=b.useRef(0),{onMoveNode:l,onCopyNode:u,onAddFile:d}=Xs(),h=n??d,f=b.useCallback(x=>{if(!r||r.length===0||x.types.includes("UI_NODE"))return!0;if(x.types.includes("Files")){const C=Array.from(x.items);return C.length===0?!0:C.some(E=>{if(E.kind==="file"){if(E.type==="application/zip"||E.type==="application/x-zip-compressed")return r.includes(".zip");if(E.type===""||E.type==="application/octet-stream")return!0}return!1})}return!1},[r]),p=b.useCallback(x=>{x.preventDefault(),x.stopPropagation(),f(x.dataTransfer)?a(!0):x.dataTransfer.dropEffect="none"},[f]),g=b.useCallback(x=>{x.preventDefault(),x.stopPropagation(),f(x.dataTransfer)&&(i.current+=1,a(!0))},[f]),m=b.useCallback(x=>{x.preventDefault(),x.stopPropagation(),i.current=Math.max(0,i.current-1),i.current===0&&a(!1)},[]),y=b.useCallback(()=>{a(!1)},[]),v=b.useCallback(async x=>{x.preventDefault();const E=x.target.closest("[data-drop-zone]"),w=t?.id||"root";if((E?.getAttribute("data-drop-zone")||"root")!==w){a(!1);return}try{let S=Wg(x.dataTransfer.items).filter(Boolean);if(r&&r.length>0&&(S=S.filter(I=>{if(!I)return!1;const D=I.name.toLowerCase();return r.some(R=>D.endsWith(R.toLowerCase()))})),S.length){for(const I of S)I&&await h(I,t);return}const P=x.getModifierState("Alt"),N=x.dataTransfer.getData("UI_NODE"),T=JSON.parse(N);P?await u(T,t):await l(T,t)}catch(S){console.error(S)}finally{s&&(i.current=0),a(!1)}},[h,u,l,t,s]);return b.useMemo(()=>{const x={onDragOver:p,onDrop:v,"data-drop-zone":t?.id||"root"};return s?(x.onDragEnter=g,x.onDragLeave=m):x.onDragLeave=y,{isDropTarget:o,dropProps:x}},[o,t?.id,g,m,y,p,v,s])}function Wg(e){return Array.from(e).map(n=>n.kind==="file"?n.getAsFile():null).filter(Boolean)}const Aa="min-h-[48px] min-w-[142px] text-base font-semibold py-3 px-6 rounded-xl outline-none active:opacity-75 hover:scale-105 transform transition-all";function qg(e){const{title:t="Document Already Exists",fileName:n,message:s,children:r,onReplace:o,onOpenChange:a,onDuplicate:i,replaceLabel:l="Replace",duplicateLabel:u="Create Copy",overlayProps:d,contentProps:h,bodyProps:f={},headerProps:p={},containerProps:g={},replaceButtonProps:m={},duplicateButtonProps:y={},buttonContainerProps:v={},...x}=e,C=n?`A document named "${n}" already exists in this location. Would you like to replace it or create a copy?`:"A document with the same name already exists in this location. Would you like to replace it or create a copy?";return c.jsx(_e,{contentProps:{...h,className:M("rounded-3xl",h?.className)},onOpenChange:a,overlayProps:{...d,className:d?.className},...x,children:c.jsxs("div",{...ce(g,"w-[450px] p-6 text-slate-300"),children:[c.jsxs("div",{className:"flex items-center justify-between border-b border-slate-50 pb-2",children:[c.jsx("div",{...ce(p,"text-2xl font-bold text-gray-800"),children:t}),c.jsx("button",{type:"button",className:"flex size-6 items-center justify-center rounded-md outline-none hover:bg-slate-100",onClick:()=>a?.(!1),children:c.jsx(O,{name:"XmarkLight",size:24})})]}),c.jsxs("div",{...ce(f,"my-6 rounded-md bg-slate-50 p-4 text-center"),children:[s||C,r]}),c.jsxs("div",{...ce(v,"mt-8 flex justify-between gap-3"),children:[c.jsx("button",{onClick:o,...ce(m,M(Aa,"flex-1 bg-slate-50 text-slate-800")),children:l}),c.jsx("button",{onClick:i,...ce(y,M(Aa,"flex-1 bg-gray-800 text-gray-50")),children:u})]})]})})}function Gg(e){const{status:t,errorDetails:n}=e;return(t==="failed"||t==="unsupported-document-type")&&n?c.jsx("div",{className:"break-words text-xs leading-[18px] text-gray-500",children:n}):null}function Qg(e){switch(e){case"analytics-processor":return"AnalyticsProcessorModule";case"relational-processor":return"RelationalProcessorModule";case"codegen-processor":return"CodegenProcessorModule";case"app":return"AppModule";case"document-model":return"DocumentModelModule";case"editor":return"EditorModule";case"package":return"PackageModule";case"subgraph":return"SubgraphModule";default:return"PowerhouseDocumentModule"}}function Yg(e){const{fileName:t,fileSize:n,documentType:s,onClose:r,...o}=e;return c.jsxs("div",{className:"flex items-center gap-2",...o,children:[c.jsx("div",{className:"flex h-9 w-7 flex-shrink-0 items-center justify-center",children:c.jsx(O,{name:Qg(s),size:48,className:"text-gray-600"})}),c.jsxs("div",{className:"flex flex-1 flex-col gap-0.5",children:[c.jsx("div",{className:"text-xs font-medium leading-[18px] text-gray-900",children:t}),c.jsx("div",{className:"text-xs font-medium leading-[18px] text-gray-500",children:n})]}),r&&c.jsx("div",{className:"flex h-9 w-[18px] flex-shrink-0 items-start justify-center",children:c.jsx("button",{type:"button",onClick:r,className:"flex h-[18px] w-[18px] items-center justify-center text-gray-600 hover:text-gray-800","aria-label":"Close",children:c.jsx(O,{name:"XmarkLight",size:18})})})]})}function Kg(e){const{status:t,progress:n=0}=e;if(t!=="uploading")return null;const s=Math.min(100,Math.max(0,n));return c.jsx("div",{className:"h-2 w-full overflow-hidden rounded-sm bg-gray-200",children:c.jsx("div",{className:"h-full bg-blue-900 transition-all duration-300 ease-out",style:{width:`${s}%`}})})}function Xg(e){switch(e){case"success":return"Upload successful";case"failed":return"Upload failed";case"unsupported-document-type":return"Document not supported by this drive";case"pending":return"Pending resolution";case"conflict":return"Pending Resolution";case"uploading":return"Uploading...";default:return""}}function Jg(e){switch(e){case"success":return"text-green-700";case"failed":case"unsupported-document-type":case"pending":case"conflict":return"text-red-900";case"uploading":return"text-gray-900";default:return"text-gray-900"}}function Zg(e,t,n){return e==="success"&&!!t||e==="pending"&&!!n||e==="conflict"&&!!n}function eb(e){return e==="success"?"Open Document":e==="pending"||e==="conflict"?"Find resolution":""}function tb(e){const{status:t,progress:n=0,onOpenDocument:s,onFindResolution:r}=e,o=()=>{t==="success"&&s?s():(t==="pending"||t==="conflict")&&r&&r()};return c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("div",{className:M("text-xs leading-[18px]",Jg(t)),children:Xg(t)}),t==="uploading"&&c.jsxs("div",{className:"text-xs font-medium leading-[18px] text-gray-900",children:[Math.round(n),"%"]}),Zg(t,s,r)&&c.jsx("button",{type:"button",onClick:o,className:"text-xs leading-[18px] text-blue-900 hover:opacity-80",children:eb(t)})]})}const nb=b.forwardRef(function(t,n){const{fileName:s,fileSize:r,status:o,documentType:a,progress:i=0,errorDetails:l,onClose:u,onOpenDocument:d,onFindResolution:h,className:f,...p}=t;return c.jsxs("div",{ref:n,className:M("flex w-full flex-col gap-0.5 rounded-md border border-gray-100 bg-white p-2 shadow-[0_2px_12px_rgba(37,42,52,0.1)]",f),...p,children:[c.jsx(Yg,{fileName:s,fileSize:r,documentType:a,onClose:u}),c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx(tb,{status:o,progress:i,onOpenDocument:d,onFindResolution:h}),c.jsx(Kg,{status:o,progress:i}),c.jsx(Gg,{status:o,errorDetails:l})]})]})});function rb(e,t){return t||`Uploading ${e} document${e===1?"":"s"}`}function sb(e){const{items:t,title:n,defaultCollapsed:s=!1,onClose:r,className:o,...a}=e,[i,l]=b.useState(s),u=b.useMemo(()=>rb(t.length,n),[t.length,n]);return c.jsxs("div",{className:M("w-[358px] rounded-md border border-gray-100 bg-gray-50 p-4 shadow-[1px_4px_15px_rgba(74,88,115,0.25)]",o),...a,children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("button",{type:"button","aria-expanded":!i,"aria-label":i?"Expand list":"Collapse list",onClick:()=>l(d=>!d),className:"min-w-0 flex-1 text-left text-sm font-medium leading-4 text-gray-900 hover:opacity-80",children:u}),c.jsxs("div",{className:"flex shrink-0 items-center gap-4",children:[c.jsx("button",{type:"button","aria-label":i?"Expand":"Collapse",onClick:()=>l(d=>!d),className:"text-gray-900 hover:opacity-80",children:c.jsx("span",{className:M("inline-block h-4 w-4 select-none transition-transform",i?"-rotate-90":"rotate-0"),children:c.jsx(O,{name:"CaretDown",size:16,"aria-hidden":"true"})})}),r&&c.jsx("button",{type:"button","aria-label":"Close",onClick:r,className:"text-gray-900 hover:opacity-80",children:c.jsx("span",{className:"inline-block h-4 w-4 select-none",children:c.jsx(O,{name:"XmarkLight",size:16,"aria-hidden":"true"})})})]})]}),!i&&c.jsx("div",{className:"mt-4 flex max-h-[404px] flex-col gap-4 overflow-y-auto overflow-x-visible px-2 py-2",children:t.map((d,h)=>c.jsx(nb,{...d},`${d.fileName}-${h}`))})]})}function ob(){return`upload_${Date.now()}_${Math.random().toString(36).substring(2,9)}`}function ab(e){if(e===0)return"0 Bytes";const t=1024,n=["Bytes","KB","MB","GB"],s=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,s)).toFixed(2))} ${n[s]}`}function ib(e){switch(e){case"loading":case"initializing":return"pending";case"uploading":return"uploading";case"complete":return"success";case"failed":return"failed";case"conflict":return"conflict";case"unsupported-document-type":return"unsupported-document-type";default:return"pending"}}function cb(e,t,n,s){return e.filter(r=>r!==void 0).map(r=>({fileName:r.fileName,fileSize:r.fileSize,status:r.status,progress:r.progress,errorDetails:r.errorDetails,documentType:r.documentType,onClose:()=>{t(r.id)},onOpenDocument:r.status==="success"?()=>{r.fileNode&&n?n(r.fileNode):console.error("Opening document for upload:",r.id,"- fileNode not available or setSelectedNode not provided")}:void 0,onFindResolution:r.status==="failed"?()=>{console.log("Finding resolution for upload:",r.id)}:r.status==="conflict"?()=>{console.log("Finding conflict resolution for upload:",r.id),s?.(r.id)}:void 0}))}function lb(e){const{uploadsArray:t,uploadsCount:n,removeUpload:s,clearAllUploads:r,setSelectedNode:o,onClose:a,onConflictResolution:i,className:l,...u}=e;if(n===0)return null;const d=cb(t,s,o,i),h=a??r;return c.jsx("div",{className:M("fixed bottom-4 right-4 z-[1001]",l),...u,children:c.jsx(sb,{items:d,onClose:h})})}function ub(e,t){switch(t.type){case"ADD_UPLOAD":return{...e,[t.payload.id]:{id:t.payload.id,fileName:t.payload.fileName,fileSize:t.payload.fileSize,status:"pending",progress:0,fileNode:void 0}};case"UPDATE_PROGRESS":{const n=e[t.payload.id];return n?{...e,[t.payload.id]:{...n,status:ib(t.payload.progress.stage),progress:t.payload.progress.progress,errorDetails:t.payload.progress.error,...t.payload.progress.documentType&&{documentType:t.payload.progress.documentType},...t.payload.progress.duplicateType&&{duplicateType:t.payload.progress.duplicateType}}}:e}case"SET_FILE_NODE":{const n=e[t.payload.id];return n?{...e,[t.payload.id]:{...n,fileNode:t.payload.fileNode}}:e}case"SET_ERROR":{const n=e[t.payload.id];return n?{...e,[t.payload.id]:{...n,status:n.status||"failed",errorDetails:t.payload.error}}:e}case"REMOVE_UPLOAD":{const{[t.payload.id]:n,...s}=e;return s}case"CLEAR_ALL_UPLOADS":return{};case"SET_CONFLICT_DATA":{const n=e[t.payload.id];return n?{...e,[t.payload.id]:{...n,file:t.payload.file,parentNode:t.payload.parentNode}}:e}case"CLEAR_CONFLICTED_UPLOADS":{const n={};for(const[s,r]of Object.entries(e))r&&r.status!=="conflict"&&(n[s]=r);return n}default:return e}}function db(e=!1,t){const n=b.useCallback(()=>{if(e&&t)try{const f=localStorage.getItem(`uploadTracker_${t}`);return f?JSON.parse(f):{}}catch(f){return console.error("Failed to load upload tracker from localStorage:",f),{}}return{}},[e,t]),[s,r]=b.useReducer(ub,n());b.useEffect(()=>{if(e&&t)try{localStorage.setItem(`uploadTracker_${t}`,JSON.stringify(s))}catch(f){console.error("Failed to save upload tracker to localStorage:",f)}},[s,e,t]);const o=b.useCallback(f=>{if(f)return async(p,g)=>{const m=ob();r({type:"ADD_UPLOAD",payload:{id:m,fileName:p.name,fileSize:ab(p.size)}});const y=v=>{r({type:"UPDATE_PROGRESS",payload:{id:m,progress:v}}),v.stage==="conflict"&&r({type:"SET_CONFLICT_DATA",payload:{id:m,file:p,parentNode:g}})};try{const v=await f(p,g,y);r({type:"SET_FILE_NODE",payload:{id:m,fileNode:v||void 0}})}catch(v){r({type:"SET_ERROR",payload:{id:m,error:v instanceof Error?v.message:"Unknown error"}})}}},[]),a=b.useCallback(f=>{r({type:"REMOVE_UPLOAD",payload:{id:f}})},[]),i=b.useCallback(()=>{r({type:"CLEAR_ALL_UPLOADS"})},[]),l=b.useCallback(()=>{r({type:"CLEAR_CONFLICTED_UPLOADS"})},[]),u=b.useCallback(()=>Object.values(s),[s]),d=b.useCallback(()=>Object.keys(s).length,[s]),h=b.useCallback((f,p,g)=>{const m=s[f];if(!m?.file||!g){console.error("Cannot resolve conflict: missing upload data or onAddFile function");return}const y=x=>{r({type:"UPDATE_PROGRESS",payload:{id:f,progress:x}})},v=g(m.file,m.parentNode,y,p);Promise.resolve(v).then(x=>{x&&r({type:"SET_FILE_NODE",payload:{id:f,fileNode:x}})}).catch(x=>{r({type:"SET_ERROR",payload:{id:f,error:x instanceof Error?x.message:"Unknown error"}})})},[s]);return{uploads:s,uploadsArray:u(),uploadsCount:d(),createUploadHandler:o,removeUpload:a,clearAllUploads:i,clearConflictedUploads:l,resolveConflict:h}}function fb(e){const{title:t="Drag your documents",subtitle:n="to drop them in the currently selected folder.",node:s,enable:r=!0,children:o,onAddFile:a,useLocalStorage:i=!1,driveId:l,acceptedFileExtensions:u=[".zip",".phd",".phdm"],className:d,...h}=e,[f,p]=b.useState(!1),[g,m]=b.useState(null),{uploadsArray:y,uploadsCount:v,createUploadHandler:x,clearAllUploads:C,clearConflictedUploads:E,removeUpload:w,resolveConflict:j}=db(i,l);b.useEffect(()=>{E()},[]);const S=x(a)??(async()=>{}),P=F=>{m(F),p(!0)},N=()=>{g&&a&&j(g,"replace",a),p(!1),m(null)},T=()=>{g&&a&&j(g,"duplicate",a),p(!1),m(null)},I=()=>{p(!1),m(null)},{isDropTarget:D,dropProps:R}=el({target:s,onAddFileOverride:S,trackNestedDrag:!0,acceptedFileExtensions:u});return c.jsxs("div",{className:M("relative",d),...r?R:{},...h,children:[o,r&&D&&c.jsx("div",{className:"fixed inset-0 z-[1000] flex min-h-screen w-screen items-center justify-center bg-black/50",children:c.jsx("div",{className:"rounded-[24px] bg-white p-6 shadow-[1px_4px_15px_rgba(74,88,115,0.25)]",children:c.jsxs("div",{className:"relative flex h-[130px] w-[400px] flex-col items-center justify-start overflow-visible rounded-lg border border-dashed border-black px-4 py-6",children:[c.jsx("div",{className:"text-center text-base leading-5 text-zinc-500",children:t}),c.jsx("div",{className:"text-center text-base leading-5 text-zinc-500",children:n}),c.jsx("span",{className:"pointer-events-none absolute -bottom-16 left-1/2 z-10 -translate-x-1/2",children:c.jsx(O,{name:"DocumentIcons",size:144,"aria-hidden":"true"})})]})})}),c.jsx(lb,{uploadsArray:y,uploadsCount:v,removeUpload:w,clearAllUploads:C,setSelectedNode:xt,onConflictResolution:P}),c.jsx(qg,{open:f,onOpenChange:I,fileName:g?y.find(F=>F?.id===g)?.fileName:void 0,onReplace:N,onDuplicate:T})]})}function Pw({children:e,...t}){const n=rd(),s=Fi(),r=sd(),o=async(a,i,l,u)=>await r(a,l,u);return!n||!s?c.jsx(c.Fragment,{children:e}):c.jsx(fb,{onAddFile:o,driveId:s,useLocalStorage:!0,...t,children:e})}function Er(e){const{children:t,items:n,open:s,onItemClick:r,onOpenChange:o,menuClassName:a}=e;return c.jsxs(bd,{onOpenChange:o,open:s,children:[c.jsx(yd,{asChild:!0,className:"outline-none",children:t}),c.jsx(vd,{className:M("modal-shadow cursor-pointer rounded-2xl bg-white text-sm font-medium text-slate-500",a),children:n.map(({id:i,label:l,icon:u,className:d})=>c.jsxs(xd,{className:M("flex items-center px-5 py-2 outline-none first-of-type:rounded-t-2xl first-of-type:pt-3 last-of-type:rounded-b-2xl last-of-type:pb-3 hover:bg-slate-50",d),onClick:h=>h.stopPropagation(),onSelect:()=>r(i),children:[u?c.jsx("span",{className:"mr-2 inline-block",children:u}):null,l]},i))})]})}const La=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],gs=[{name:"query",type:"function",stateMutability:"view",inputs:[{type:"tuple[]",name:"queries",components:[{type:"address",name:"sender"},{type:"string[]",name:"urls"},{type:"bytes",name:"data"}]}],outputs:[{type:"bool[]",name:"failures"},{type:"bytes[]",name:"responses"}]},{name:"HttpError",type:"error",inputs:[{type:"uint16",name:"status"},{type:"string",name:"message"}]}],tl=[{inputs:[{name:"dns",type:"bytes"}],name:"DNSDecodingFailed",type:"error"},{inputs:[{name:"ens",type:"string"}],name:"DNSEncodingFailed",type:"error"},{inputs:[],name:"EmptyAddress",type:"error"},{inputs:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"HttpError",type:"error"},{inputs:[],name:"InvalidBatchGatewayResponse",type:"error"},{inputs:[{name:"errorData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{name:"name",type:"bytes"},{name:"resolver",type:"address"}],name:"ResolverNotContract",type:"error"},{inputs:[{name:"name",type:"bytes"}],name:"ResolverNotFound",type:"error"},{inputs:[{name:"primary",type:"string"},{name:"primaryAddress",type:"bytes"}],name:"ReverseAddressMismatch",type:"error"},{inputs:[{internalType:"bytes4",name:"selector",type:"bytes4"}],name:"UnsupportedResolverProfile",type:"error"}],hb=[...tl,{name:"resolveWithGateways",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],pb=[...tl,{name:"reverseWithGateways",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"uint256",name:"coinType"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolver"},{type:"address",name:"reverseResolver"}]}],Fa=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}];function Ye(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new Eb(e.type);return`${e.name}(${ho(e.inputs,{includeName:t})})`}function ho(e,{includeName:t=!1}={}){return e?e.map(n=>mb(n,{includeName:t})).join(t?", ":","):""}function mb(e,{includeName:t}){return e.type.startsWith("tuple")?`(${ho(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function ut(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function fe(e){return ut(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const nl="2.38.6";let Hr={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${nl}`},k=class bs extends Error{constructor(t,n={}){const s=n.cause instanceof bs?n.cause.details:n.cause?.message?n.cause.message:n.details,r=n.cause instanceof bs&&n.cause.docsPath||n.docsPath,o=Hr.getDocsUrl?.({...n,docsPath:r}),a=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...o?[`Docs: ${o}`]:[],...s?[`Details: ${s}`]:[],...Hr.version?[`Version: ${Hr.version}`]:[]].join(`
9
- `);super(a,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=s,this.docsPath=r,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=nl}walk(t){return rl(this,t)}};function rl(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?rl(e.cause,t):t?null:e}class gb extends k{constructor({docsPath:t}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
6
+ `]))),tm=function(t,n){var s=t.isFocused,r=t.size,o=t.theme,a=o.colors,i=o.spacing.baseUnit;return $({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:r,lineHeight:1,marginRight:r,textAlign:"center",verticalAlign:"middle"},n?{}:{color:s?a.neutral60:a.neutral20,padding:i*2})},_r=function(t){var n=t.delay,s=t.offset;return L("span",{css:co({animation:"".concat(em," 1s ease-in-out ").concat(n,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:s?"1em":void 0,height:"1em",verticalAlign:"top",width:"1em"},"","")})},nm=function(t){var n=t.innerProps,s=t.isRtl,r=t.size,o=r===void 0?4:r,a=Ue(t,qp);return L("div",z({},se($($({},a),{},{innerProps:n,isRtl:s,size:o}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),n),L(_r,{delay:0,offset:s}),L(_r,{delay:160,offset:!0}),L(_r,{delay:320,offset:!s}))},rm=function(t,n){var s=t.isDisabled,r=t.isFocused,o=t.theme,a=o.colors,i=o.borderRadius,l=o.spacing;return $({label:"control",alignItems:"center",cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:l.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms"},n?{}:{backgroundColor:s?a.neutral5:a.neutral0,borderColor:s?a.neutral10:r?a.primary:a.neutral20,borderRadius:i,borderStyle:"solid",borderWidth:1,boxShadow:r?"0 0 0 1px ".concat(a.primary):void 0,"&:hover":{borderColor:r?a.primary:a.neutral30}})},sm=function(t){var n=t.children,s=t.isDisabled,r=t.isFocused,o=t.innerRef,a=t.innerProps,i=t.menuIsOpen;return L("div",z({ref:o},se(t,"control",{control:!0,"control--is-disabled":s,"control--is-focused":r,"control--menu-is-open":i}),a,{"aria-disabled":s||void 0}),n)},om=sm,am=["data"],im=function(t,n){var s=t.theme.spacing;return n?{}:{paddingBottom:s.baseUnit*2,paddingTop:s.baseUnit*2}},cm=function(t){var n=t.children,s=t.cx,r=t.getStyles,o=t.getClassNames,a=t.Heading,i=t.headingProps,l=t.innerProps,u=t.label,d=t.theme,h=t.selectProps;return L("div",z({},se(t,"group",{group:!0}),l),L(a,z({},i,{selectProps:h,theme:d,getStyles:r,getClassNames:o,cx:s}),u),L("div",null,n))},lm=function(t,n){var s=t.theme,r=s.colors,o=s.spacing;return $({label:"group",cursor:"default",display:"block"},n?{}:{color:r.neutral40,fontSize:"75%",fontWeight:500,marginBottom:"0.25em",paddingLeft:o.baseUnit*3,paddingRight:o.baseUnit*3,textTransform:"uppercase"})},um=function(t){var n=Ec(t);n.data;var s=Ue(n,am);return L("div",z({},se(t,"groupHeading",{"group-heading":!0}),s))},dm=cm,fm=["innerRef","isDisabled","isHidden","inputClassName"],hm=function(t,n){var s=t.isDisabled,r=t.value,o=t.theme,a=o.spacing,i=o.colors;return $($({visibility:s?"hidden":"visible",transform:r?"translateZ(0)":""},pm),n?{}:{margin:a.baseUnit/2,paddingBottom:a.baseUnit/2,paddingTop:a.baseUnit/2,color:i.neutral80})},Lc={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},pm={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":$({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},Lc)},mm=function(t){return $({label:"input",color:"inherit",background:0,opacity:t?0:1,width:"100%"},Lc)},gm=function(t){var n=t.cx,s=t.value,r=Ec(t),o=r.innerRef,a=r.isDisabled,i=r.isHidden,l=r.inputClassName,u=Ue(r,fm);return L("div",z({},se(t,"input",{"input-container":!0}),{"data-value":s||""}),L("input",z({className:n({input:!0},l),ref:o,style:mm(i),disabled:a},u)))},bm=gm,ym=function(t,n){var s=t.theme,r=s.spacing,o=s.borderRadius,a=s.colors;return $({label:"multiValue",display:"flex",minWidth:0},n?{}:{backgroundColor:a.neutral10,borderRadius:o/2,margin:r.baseUnit/2})},vm=function(t,n){var s=t.theme,r=s.borderRadius,o=s.colors,a=t.cropWithEllipsis;return $({overflow:"hidden",textOverflow:a||a===void 0?"ellipsis":void 0,whiteSpace:"nowrap"},n?{}:{borderRadius:r/2,color:o.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},xm=function(t,n){var s=t.theme,r=s.spacing,o=s.borderRadius,a=s.colors,i=t.isFocused;return $({alignItems:"center",display:"flex"},n?{}:{borderRadius:o/2,backgroundColor:i?a.dangerLight:void 0,paddingLeft:r.baseUnit,paddingRight:r.baseUnit,":hover":{backgroundColor:a.dangerLight,color:a.danger}})},Fc=function(t){var n=t.children,s=t.innerProps;return L("div",s,n)},wm=Fc,Cm=Fc;function Sm(e){var t=e.children,n=e.innerProps;return L("div",z({role:"button"},n),t||L(lo,{size:14}))}var jm=function(t){var n=t.children,s=t.components,r=t.data,o=t.innerProps,a=t.isDisabled,i=t.removeProps,l=t.selectProps,u=s.Container,d=s.Label,h=s.Remove;return L(u,{data:r,innerProps:$($({},se(t,"multiValue",{"multi-value":!0,"multi-value--is-disabled":a})),o),selectProps:l},L(d,{data:r,innerProps:$({},se(t,"multiValueLabel",{"multi-value__label":!0})),selectProps:l},n),L(h,{data:r,innerProps:$($({},se(t,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(n||"option")},i),selectProps:l}))},Pm=jm,Nm=function(t,n){var s=t.isDisabled,r=t.isFocused,o=t.isSelected,a=t.theme,i=a.spacing,l=a.colors;return $({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},n?{}:{backgroundColor:o?l.primary:r?l.primary25:"transparent",color:s?l.neutral20:o?l.neutral0:"inherit",padding:"".concat(i.baseUnit*2,"px ").concat(i.baseUnit*3,"px"),":active":{backgroundColor:s?void 0:o?l.primary:l.primary50}})},Em=function(t){var n=t.children,s=t.isDisabled,r=t.isFocused,o=t.isSelected,a=t.innerRef,i=t.innerProps;return L("div",z({},se(t,"option",{option:!0,"option--is-disabled":s,"option--is-focused":r,"option--is-selected":o}),{ref:a,"aria-disabled":s},i),n)},Om=Em,Im=function(t,n){var s=t.theme,r=s.spacing,o=s.colors;return $({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},n?{}:{color:o.neutral50,marginLeft:r.baseUnit/2,marginRight:r.baseUnit/2})},Mm=function(t){var n=t.children,s=t.innerProps;return L("div",z({},se(t,"placeholder",{placeholder:!0}),s),n)},Tm=Mm,Dm=function(t,n){var s=t.isDisabled,r=t.theme,o=r.spacing,a=r.colors;return $({label:"singleValue",gridArea:"1 / 1 / 2 / 3",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},n?{}:{color:s?a.neutral40:a.neutral80,marginLeft:o.baseUnit/2,marginRight:o.baseUnit/2})},km=function(t){var n=t.children,s=t.isDisabled,r=t.innerProps;return L("div",z({},se(t,"singleValue",{"single-value":!0,"single-value--is-disabled":s}),r),n)},Rm=km,Er={ClearIndicator:Xp,Control:om,DropdownIndicator:Yp,DownChevron:Rc,CrossIcon:lo,Group:dm,GroupHeading:um,IndicatorsContainer:Hp,IndicatorSeparator:Zp,Input:bm,LoadingIndicator:nm,Menu:Mp,MenuList:Dp,MenuPortal:$p,LoadingMessage:Lp,NoOptionsMessage:Ap,MultiValue:Pm,MultiValueContainer:wm,MultiValueLabel:Cm,MultiValueRemove:Sm,Option:Om,Placeholder:Tm,SelectContainer:_p,SingleValue:Rm,ValueContainer:Vp},Am=function(t){return $($({},Er),t.components)},ma=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function Lm(e,t){return!!(e===t||ma(e)&&ma(t))}function Fm(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!Lm(e[n],t[n]))return!1;return!0}function $m(e,t){t===void 0&&(t=Fm);var n=null;function s(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];if(n&&n.lastThis===this&&t(r,n.lastArgs))return n.lastResult;var a=e.apply(this,r);return n={lastResult:a,lastArgs:r,lastThis:this},a}return s.clear=function(){n=null},s}var zm={name:"7pg0cj-a11yText",styles:"label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap"},_m=function(t){return L("span",z({css:zm},t))},ga=_m,Um={guidance:function(t){var n=t.isSearchable,s=t.isMulti,r=t.tabSelectsValue,o=t.context,a=t.isInitialFocus;switch(o){case"menu":return"Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu".concat(r?", press Tab to select the option and exit the menu":"",".");case"input":return a?"".concat(t["aria-label"]||"Select"," is focused ").concat(n?",type to refine list":"",", press Down to open the menu, ").concat(s?" press left to focus selected values":""):"";case"value":return"Use left and right to toggle between focused values, press Backspace to remove the currently focused value";default:return""}},onChange:function(t){var n=t.action,s=t.label,r=s===void 0?"":s,o=t.labels,a=t.isDisabled;switch(n){case"deselect-option":case"pop-value":case"remove-value":return"option ".concat(r,", deselected.");case"clear":return"All selected options have been cleared.";case"initial-input-focus":return"option".concat(o.length>1?"s":""," ").concat(o.join(","),", selected.");case"select-option":return a?"option ".concat(r," is disabled. Select another option."):"option ".concat(r,", selected.");default:return""}},onFocus:function(t){var n=t.context,s=t.focused,r=t.options,o=t.label,a=o===void 0?"":o,i=t.selectValue,l=t.isDisabled,u=t.isSelected,d=t.isAppleDevice,h=function(m,y){return m&&m.length?"".concat(m.indexOf(y)+1," of ").concat(m.length):""};if(n==="value"&&i)return"value ".concat(a," focused, ").concat(h(i,s),".");if(n==="menu"&&d){var f=l?" disabled":"",p="".concat(u?" selected":"").concat(f);return"".concat(a).concat(p,", ").concat(h(r,s),".")}return""},onFilter:function(t){var n=t.inputValue,s=t.resultsMessage;return"".concat(s).concat(n?" for search term "+n:"",".")}},Vm=function(t){var n=t.ariaSelection,s=t.focusedOption,r=t.focusedValue,o=t.focusableOptions,a=t.isFocused,i=t.selectValue,l=t.selectProps,u=t.id,d=t.isAppleDevice,h=l.ariaLiveMessages,f=l.getOptionLabel,p=l.inputValue,g=l.isMulti,m=l.isOptionDisabled,y=l.isSearchable,v=l.menuIsOpen,x=l.options,C=l.screenReaderStatus,N=l.tabSelectsValue,w=l.isLoading,j=l["aria-label"],S=l["aria-live"],P=b.useMemo(function(){return $($({},Um),h||{})},[h]),E=b.useMemo(function(){var _="";if(n&&P.onChange){var U=n.option,H=n.options,G=n.removedValue,W=n.removedValues,ee=n.value,re=function(oe){return Array.isArray(oe)?null:oe},V=G||U||re(ee),A=V?f(V):"",B=H||W||void 0,te=B?B.map(f):[],ne=$({isDisabled:V&&m(V,i),label:A,labels:te},n);_=P.onChange(ne)}return _},[n,P,m,i,f]),T=b.useMemo(function(){var _="",U=s||r,H=!!(s&&i&&i.includes(s));if(U&&P.onFocus){var G={focused:U,label:f(U),isDisabled:m(U,i),isSelected:H,options:o,context:U===s?"menu":"value",selectValue:i,isAppleDevice:d};_=P.onFocus(G)}return _},[s,r,f,m,P,o,i,d]),I=b.useMemo(function(){var _="";if(v&&x.length&&!w&&P.onFilter){var U=C({count:o.length});_=P.onFilter({inputValue:p,resultsMessage:U})}return _},[o,p,v,P,x,C,w]),D=n?.action==="initial-input-focus",R=b.useMemo(function(){var _="";if(P.guidance){var U=r?"value":v?"menu":"input";_=P.guidance({"aria-label":j,context:U,isDisabled:s&&m(s,i),isMulti:g,isSearchable:y,tabSelectsValue:N,isInitialFocus:D})}return _},[j,s,r,g,m,y,v,P,i,N,D]),F=L(b.Fragment,null,L("span",{id:"aria-selection"},E),L("span",{id:"aria-focused"},T),L("span",{id:"aria-results"},I),L("span",{id:"aria-guidance"},R));return L(b.Fragment,null,L(ga,{id:u},D&&F),L(ga,{"aria-live":S,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},a&&!D&&F))},Bm=Vm,gs=[{base:"A",letters:"AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"},{base:"c",letters:"cⓒcćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ"},{base:"nj",letters:"nj"},{base:"o",letters:"oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}],Hm=new RegExp("["+gs.map(function(e){return e.letters}).join("")+"]","g"),$c={};for(var Ur=0;Ur<gs.length;Ur++)for(var Vr=gs[Ur],Br=0;Br<Vr.letters.length;Br++)$c[Vr.letters[Br]]=Vr.base;var zc=function(t){return t.replace(Hm,function(n){return $c[n]})},Wm=$m(zc),ba=function(t){return t.replace(/^\s+|\s+$/g,"")},qm=function(t){return"".concat(t.label," ").concat(t.value)},Gm=function(t){return function(n,s){if(n.data.__isNew__)return!0;var r=$({ignoreCase:!0,ignoreAccents:!0,stringify:qm,trim:!0,matchFrom:"any"},t),o=r.ignoreCase,a=r.ignoreAccents,i=r.stringify,l=r.trim,u=r.matchFrom,d=l?ba(s):s,h=l?ba(i(n)):i(n);return o&&(d=d.toLowerCase(),h=h.toLowerCase()),a&&(d=Wm(d),h=zc(h)),u==="start"?h.substr(0,d.length)===d:h.indexOf(d)>-1}},Qm=["innerRef"];function Ym(e){var t=e.innerRef,n=Ue(e,Qm),s=Cp(n,"onExited","in","enter","exit","appear");return L("input",z({ref:t},s,{css:co({label:"dummyInput",background:0,border:0,caretColor:"transparent",fontSize:"inherit",gridArea:"1 / 1 / 2 / 3",outline:0,padding:0,width:1,color:"transparent",left:-100,opacity:0,position:"relative",transform:"scale(.01)"},"","")}))}var Km=function(t){t.cancelable&&t.preventDefault(),t.stopPropagation()};function Xm(e){var t=e.isEnabled,n=e.onBottomArrive,s=e.onBottomLeave,r=e.onTopArrive,o=e.onTopLeave,a=b.useRef(!1),i=b.useRef(!1),l=b.useRef(0),u=b.useRef(null),d=b.useCallback(function(y,v){if(u.current!==null){var x=u.current,C=x.scrollTop,N=x.scrollHeight,w=x.clientHeight,j=u.current,S=v>0,P=N-w-C,E=!1;P>v&&a.current&&(s&&s(y),a.current=!1),S&&i.current&&(o&&o(y),i.current=!1),S&&v>P?(n&&!a.current&&n(y),j.scrollTop=N,E=!0,a.current=!0):!S&&-v>C&&(r&&!i.current&&r(y),j.scrollTop=0,E=!0,i.current=!0),E&&Km(y)}},[n,s,r,o]),h=b.useCallback(function(y){d(y,y.deltaY)},[d]),f=b.useCallback(function(y){l.current=y.changedTouches[0].clientY},[]),p=b.useCallback(function(y){var v=l.current-y.changedTouches[0].clientY;d(y,v)},[d]),g=b.useCallback(function(y){if(y){var v=vp?{passive:!1}:!1;y.addEventListener("wheel",h,v),y.addEventListener("touchstart",f,v),y.addEventListener("touchmove",p,v)}},[p,f,h]),m=b.useCallback(function(y){y&&(y.removeEventListener("wheel",h,!1),y.removeEventListener("touchstart",f,!1),y.removeEventListener("touchmove",p,!1))},[p,f,h]);return b.useEffect(function(){if(t){var y=u.current;return g(y),function(){m(y)}}},[t,g,m]),function(y){u.current=y}}var ya=["boxSizing","height","overflow","paddingRight","position"],va={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function xa(e){e.cancelable&&e.preventDefault()}function wa(e){e.stopPropagation()}function Ca(){var e=this.scrollTop,t=this.scrollHeight,n=e+this.offsetHeight;e===0?this.scrollTop=1:n===t&&(this.scrollTop=e-1)}function Sa(){return"ontouchstart"in window||navigator.maxTouchPoints}var ja=!!(typeof window<"u"&&window.document&&window.document.createElement),At=0,ft={capture:!1,passive:!1};function Jm(e){var t=e.isEnabled,n=e.accountForScrollbars,s=n===void 0?!0:n,r=b.useRef({}),o=b.useRef(null),a=b.useCallback(function(l){if(ja){var u=document.body,d=u&&u.style;if(s&&ya.forEach(function(g){var m=d&&d[g];r.current[g]=m}),s&&At<1){var h=parseInt(r.current.paddingRight,10)||0,f=document.body?document.body.clientWidth:0,p=window.innerWidth-f+h||0;Object.keys(va).forEach(function(g){var m=va[g];d&&(d[g]=m)}),d&&(d.paddingRight="".concat(p,"px"))}u&&Sa()&&(u.addEventListener("touchmove",xa,ft),l&&(l.addEventListener("touchstart",Ca,ft),l.addEventListener("touchmove",wa,ft))),At+=1}},[s]),i=b.useCallback(function(l){if(ja){var u=document.body,d=u&&u.style;At=Math.max(At-1,0),s&&At<1&&ya.forEach(function(h){var f=r.current[h];d&&(d[h]=f)}),u&&Sa()&&(u.removeEventListener("touchmove",xa,ft),l&&(l.removeEventListener("touchstart",Ca,ft),l.removeEventListener("touchmove",wa,ft)))}},[s]);return b.useEffect(function(){if(t){var l=o.current;return a(l),function(){i(l)}}},[t,a,i]),function(l){o.current=l}}var Zm=function(t){var n=t.target;return n.ownerDocument.activeElement&&n.ownerDocument.activeElement.blur()},eg={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function tg(e){var t=e.children,n=e.lockEnabled,s=e.captureEnabled,r=s===void 0?!0:s,o=e.onBottomArrive,a=e.onBottomLeave,i=e.onTopArrive,l=e.onTopLeave,u=Xm({isEnabled:r,onBottomArrive:o,onBottomLeave:a,onTopArrive:i,onTopLeave:l}),d=Jm({isEnabled:n}),h=function(p){u(p),d(p)};return L(b.Fragment,null,n&&L("div",{onClick:Zm,css:eg}),t(h))}var ng={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},rg=function(t){var n=t.name,s=t.onFocus;return L("input",{required:!0,name:n,tabIndex:-1,"aria-hidden":"true",onFocus:s,css:ng,value:"",onChange:function(){}})},sg=rg;function uo(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function og(){return uo(/^iPhone/i)}function _c(){return uo(/^Mac/i)}function ag(){return uo(/^iPad/i)||_c()&&navigator.maxTouchPoints>1}function ig(){return og()||ag()}function cg(){return _c()||ig()}var lg=function(t){return t.label},ug=function(t){return t.label},dg=function(t){return t.value},fg=function(t){return!!t.isDisabled},hg={clearIndicator:Kp,container:zp,control:rm,dropdownIndicator:Qp,group:im,groupHeading:lm,indicatorsContainer:Bp,indicatorSeparator:Jp,input:hm,loadingIndicator:tm,loadingMessage:Rp,menu:Ep,menuList:Tp,menuPortal:Fp,multiValue:ym,multiValueLabel:vm,multiValueRemove:xm,noOptionsMessage:kp,option:Nm,placeholder:Im,singleValue:Dm,valueContainer:Up},pg={primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},mg=4,Uc=4,gg=38,bg=Uc*2,yg={baseUnit:Uc,controlHeight:gg,menuGutter:bg},Hr={borderRadius:mg,colors:pg,spacing:yg},vg={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:ha(),captureMenuScroll:!ha(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:Gm(),formatGroupLabel:lg,getOptionLabel:ug,getOptionValue:dg,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:fg,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!bp(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(t){var n=t.count;return"".concat(n," result").concat(n!==1?"s":""," available")},styles:{},tabIndex:0,tabSelectsValue:!0,unstyled:!1};function Pa(e,t,n,s){var r=Hc(e,t,n),o=Wc(e,t,n),a=Bc(e,t),i=ar(e,t);return{type:"option",data:t,isDisabled:r,isSelected:o,label:a,value:i,index:s}}function Qn(e,t){return e.options.map(function(n,s){if("options"in n){var r=n.options.map(function(a,i){return Pa(e,a,t,i)}).filter(function(a){return Ea(e,a)});return r.length>0?{type:"group",data:n,options:r,index:s}:void 0}var o=Pa(e,n,t,s);return Ea(e,o)?o:void 0}).filter(xp)}function Vc(e){return e.reduce(function(t,n){return n.type==="group"?t.push.apply(t,ro(n.options.map(function(s){return s.data}))):t.push(n.data),t},[])}function Na(e,t){return e.reduce(function(n,s){return s.type==="group"?n.push.apply(n,ro(s.options.map(function(r){return{data:r.data,id:"".concat(t,"-").concat(s.index,"-").concat(r.index)}}))):n.push({data:s.data,id:"".concat(t,"-").concat(s.index)}),n},[])}function xg(e,t){return Vc(Qn(e,t))}function Ea(e,t){var n=e.inputValue,s=n===void 0?"":n,r=t.data,o=t.isSelected,a=t.label,i=t.value;return(!Gc(e)||!o)&&qc(e,{label:a,value:i,data:r},s)}function wg(e,t){var n=e.focusedValue,s=e.selectValue,r=s.indexOf(n);if(r>-1){var o=t.indexOf(n);if(o>-1)return n;if(r<t.length)return t[r]}return null}function Cg(e,t){var n=e.focusedOption;return n&&t.indexOf(n)>-1?n:t[0]}var Wr=function(t,n){var s,r=(s=t.find(function(o){return o.data===n}))===null||s===void 0?void 0:s.id;return r||null},Bc=function(t,n){return t.getOptionLabel(n)},ar=function(t,n){return t.getOptionValue(n)};function Hc(e,t,n){return typeof e.isOptionDisabled=="function"?e.isOptionDisabled(t,n):!1}function Wc(e,t,n){if(n.indexOf(t)>-1)return!0;if(typeof e.isOptionSelected=="function")return e.isOptionSelected(t,n);var s=ar(e,t);return n.some(function(r){return ar(e,r)===s})}function qc(e,t,n){return e.filterOption?e.filterOption(t,n):!0}var Gc=function(t){var n=t.hideSelectedOptions,s=t.isMulti;return n===void 0?s:n},Sg=1,Qc=(function(e){ch(n,e);var t=dh(n);function n(s){var r;if(ah(this,n),r=t.call(this,s),r.state={ariaSelection:null,focusedOption:null,focusedOptionId:null,focusableOptionsWithIds:[],focusedValue:null,inputIsHidden:!1,isFocused:!1,selectValue:[],clearFocusValueOnUpdate:!1,prevWasFocused:!1,inputIsHiddenAfterUpdate:void 0,prevProps:void 0,instancePrefix:"",isAppleDevice:!1},r.blockOptionHover=!1,r.isComposing=!1,r.commonProps=void 0,r.initialTouchX=0,r.initialTouchY=0,r.openAfterFocus=!1,r.scrollToFocusedOptionOnUpdate=!1,r.userIsDragging=void 0,r.controlRef=null,r.getControlRef=function(l){r.controlRef=l},r.focusedOptionRef=null,r.getFocusedOptionRef=function(l){r.focusedOptionRef=l},r.menuListRef=null,r.getMenuListRef=function(l){r.menuListRef=l},r.inputRef=null,r.getInputRef=function(l){r.inputRef=l},r.focus=r.focusInput,r.blur=r.blurInput,r.onChange=function(l,u){var d=r.props,h=d.onChange,f=d.name;u.name=f,r.ariaOnChange(l,u),h(l,u)},r.setValue=function(l,u,d){var h=r.props,f=h.closeMenuOnSelect,p=h.isMulti,g=h.inputValue;r.onInputChange("",{action:"set-value",prevInputValue:g}),f&&(r.setState({inputIsHiddenAfterUpdate:!p}),r.onMenuClose()),r.setState({clearFocusValueOnUpdate:!0}),r.onChange(l,{action:u,option:d})},r.selectOption=function(l){var u=r.props,d=u.blurInputOnSelect,h=u.isMulti,f=u.name,p=r.state.selectValue,g=h&&r.isOptionSelected(l,p),m=r.isOptionDisabled(l,p);if(g){var y=r.getOptionValue(l);r.setValue(p.filter(function(v){return r.getOptionValue(v)!==y}),"deselect-option",l)}else if(!m)h?r.setValue([].concat(ro(p),[l]),"select-option",l):r.setValue(l,"select-option");else{r.ariaOnChange(l,{action:"select-option",option:l,name:f});return}d&&r.blurInput()},r.removeValue=function(l){var u=r.props.isMulti,d=r.state.selectValue,h=r.getOptionValue(l),f=d.filter(function(g){return r.getOptionValue(g)!==h}),p=kn(u,f,f[0]||null);r.onChange(p,{action:"remove-value",removedValue:l}),r.focusInput()},r.clearValue=function(){var l=r.state.selectValue;r.onChange(kn(r.props.isMulti,[],null),{action:"clear",removedValues:l})},r.popValue=function(){var l=r.props.isMulti,u=r.state.selectValue,d=u[u.length-1],h=u.slice(0,u.length-1),f=kn(l,h,h[0]||null);d&&r.onChange(f,{action:"pop-value",removedValue:d})},r.getFocusedOptionId=function(l){return Wr(r.state.focusableOptionsWithIds,l)},r.getFocusableOptionsWithIds=function(){return Na(Qn(r.props,r.state.selectValue),r.getElementId("option"))},r.getValue=function(){return r.state.selectValue},r.cx=function(){for(var l=arguments.length,u=new Array(l),d=0;d<l;d++)u[d]=arguments[d];return fp.apply(void 0,[r.props.classNamePrefix].concat(u))},r.getOptionLabel=function(l){return Bc(r.props,l)},r.getOptionValue=function(l){return ar(r.props,l)},r.getStyles=function(l,u){var d=r.props.unstyled,h=hg[l](u,d);h.boxSizing="border-box";var f=r.props.styles[l];return f?f(h,u):h},r.getClassNames=function(l,u){var d,h;return(d=(h=r.props.classNames)[l])===null||d===void 0?void 0:d.call(h,u)},r.getElementId=function(l){return"".concat(r.state.instancePrefix,"-").concat(l)},r.getComponents=function(){return Am(r.props)},r.buildCategorizedOptions=function(){return Qn(r.props,r.state.selectValue)},r.getCategorizedOptions=function(){return r.props.menuIsOpen?r.buildCategorizedOptions():[]},r.buildFocusableOptions=function(){return Vc(r.buildCategorizedOptions())},r.getFocusableOptions=function(){return r.props.menuIsOpen?r.buildFocusableOptions():[]},r.ariaOnChange=function(l,u){r.setState({ariaSelection:$({value:l},u)})},r.onMenuMouseDown=function(l){l.button===0&&(l.stopPropagation(),l.preventDefault(),r.focusInput())},r.onMenuMouseMove=function(l){r.blockOptionHover=!1},r.onControlMouseDown=function(l){if(!l.defaultPrevented){var u=r.props.openMenuOnClick;r.state.isFocused?r.props.menuIsOpen?l.target.tagName!=="INPUT"&&l.target.tagName!=="TEXTAREA"&&r.onMenuClose():u&&r.openMenu("first"):(u&&(r.openAfterFocus=!0),r.focusInput()),l.target.tagName!=="INPUT"&&l.target.tagName!=="TEXTAREA"&&l.preventDefault()}},r.onDropdownIndicatorMouseDown=function(l){if(!(l&&l.type==="mousedown"&&l.button!==0)&&!r.props.isDisabled){var u=r.props,d=u.isMulti,h=u.menuIsOpen;r.focusInput(),h?(r.setState({inputIsHiddenAfterUpdate:!d}),r.onMenuClose()):r.openMenu("first"),l.preventDefault()}},r.onClearIndicatorMouseDown=function(l){l&&l.type==="mousedown"&&l.button!==0||(r.clearValue(),l.preventDefault(),r.openAfterFocus=!1,l.type==="touchend"?r.focusInput():setTimeout(function(){return r.focusInput()}))},r.onScroll=function(l){typeof r.props.closeMenuOnScroll=="boolean"?l.target instanceof HTMLElement&&Nr(l.target)&&r.props.onMenuClose():typeof r.props.closeMenuOnScroll=="function"&&r.props.closeMenuOnScroll(l)&&r.props.onMenuClose()},r.onCompositionStart=function(){r.isComposing=!0},r.onCompositionEnd=function(){r.isComposing=!1},r.onTouchStart=function(l){var u=l.touches,d=u&&u.item(0);d&&(r.initialTouchX=d.clientX,r.initialTouchY=d.clientY,r.userIsDragging=!1)},r.onTouchMove=function(l){var u=l.touches,d=u&&u.item(0);if(d){var h=Math.abs(d.clientX-r.initialTouchX),f=Math.abs(d.clientY-r.initialTouchY),p=5;r.userIsDragging=h>p||f>p}},r.onTouchEnd=function(l){r.userIsDragging||(r.controlRef&&!r.controlRef.contains(l.target)&&r.menuListRef&&!r.menuListRef.contains(l.target)&&r.blurInput(),r.initialTouchX=0,r.initialTouchY=0)},r.onControlTouchEnd=function(l){r.userIsDragging||r.onControlMouseDown(l)},r.onClearIndicatorTouchEnd=function(l){r.userIsDragging||r.onClearIndicatorMouseDown(l)},r.onDropdownIndicatorTouchEnd=function(l){r.userIsDragging||r.onDropdownIndicatorMouseDown(l)},r.handleInputChange=function(l){var u=r.props.inputValue,d=l.currentTarget.value;r.setState({inputIsHiddenAfterUpdate:!1}),r.onInputChange(d,{action:"input-change",prevInputValue:u}),r.props.menuIsOpen||r.onMenuOpen()},r.onInputFocus=function(l){r.props.onFocus&&r.props.onFocus(l),r.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(r.openAfterFocus||r.props.openMenuOnFocus)&&r.openMenu("first"),r.openAfterFocus=!1},r.onInputBlur=function(l){var u=r.props.inputValue;if(r.menuListRef&&r.menuListRef.contains(document.activeElement)){r.inputRef.focus();return}r.props.onBlur&&r.props.onBlur(l),r.onInputChange("",{action:"input-blur",prevInputValue:u}),r.onMenuClose(),r.setState({focusedValue:null,isFocused:!1})},r.onOptionHover=function(l){if(!(r.blockOptionHover||r.state.focusedOption===l)){var u=r.getFocusableOptions(),d=u.indexOf(l);r.setState({focusedOption:l,focusedOptionId:d>-1?r.getFocusedOptionId(l):null})}},r.shouldHideSelectedOptions=function(){return Gc(r.props)},r.onValueInputFocus=function(l){l.preventDefault(),l.stopPropagation(),r.focus()},r.onKeyDown=function(l){var u=r.props,d=u.isMulti,h=u.backspaceRemovesValue,f=u.escapeClearsValue,p=u.inputValue,g=u.isClearable,m=u.isDisabled,y=u.menuIsOpen,v=u.onKeyDown,x=u.tabSelectsValue,C=u.openMenuOnFocus,N=r.state,w=N.focusedOption,j=N.focusedValue,S=N.selectValue;if(!m&&!(typeof v=="function"&&(v(l),l.defaultPrevented))){switch(r.blockOptionHover=!0,l.key){case"ArrowLeft":if(!d||p)return;r.focusValue("previous");break;case"ArrowRight":if(!d||p)return;r.focusValue("next");break;case"Delete":case"Backspace":if(p)return;if(j)r.removeValue(j);else{if(!h)return;d?r.popValue():g&&r.clearValue()}break;case"Tab":if(r.isComposing||l.shiftKey||!y||!x||!w||C&&r.isOptionSelected(w,S))return;r.selectOption(w);break;case"Enter":if(l.keyCode===229)break;if(y){if(!w||r.isComposing)return;r.selectOption(w);break}return;case"Escape":y?(r.setState({inputIsHiddenAfterUpdate:!1}),r.onInputChange("",{action:"menu-close",prevInputValue:p}),r.onMenuClose()):g&&f&&r.clearValue();break;case" ":if(p)return;if(!y){r.openMenu("first");break}if(!w)return;r.selectOption(w);break;case"ArrowUp":y?r.focusOption("up"):r.openMenu("last");break;case"ArrowDown":y?r.focusOption("down"):r.openMenu("first");break;case"PageUp":if(!y)return;r.focusOption("pageup");break;case"PageDown":if(!y)return;r.focusOption("pagedown");break;case"Home":if(!y)return;r.focusOption("first");break;case"End":if(!y)return;r.focusOption("last");break;default:return}l.preventDefault()}},r.state.instancePrefix="react-select-"+(r.props.instanceId||++Sg),r.state.selectValue=da(s.value),s.menuIsOpen&&r.state.selectValue.length){var o=r.getFocusableOptionsWithIds(),a=r.buildFocusableOptions(),i=a.indexOf(r.state.selectValue[0]);r.state.focusableOptionsWithIds=o,r.state.focusedOption=a[i],r.state.focusedOptionId=Wr(o,a[i])}return r}return ih(n,[{key:"componentDidMount",value:function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput(),this.props.menuIsOpen&&this.state.focusedOption&&this.menuListRef&&this.focusedOptionRef&&fa(this.menuListRef,this.focusedOptionRef),cg()&&this.setState({isAppleDevice:!0})}},{key:"componentDidUpdate",value:function(r){var o=this.props,a=o.isDisabled,i=o.menuIsOpen,l=this.state.isFocused;(l&&!a&&r.isDisabled||l&&i&&!r.menuIsOpen)&&this.focusInput(),l&&a&&!r.isDisabled?this.setState({isFocused:!1},this.onMenuClose):!l&&!a&&r.isDisabled&&this.inputRef===document.activeElement&&this.setState({isFocused:!0}),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(fa(this.menuListRef,this.focusedOptionRef),this.scrollToFocusedOptionOnUpdate=!1)}},{key:"componentWillUnmount",value:function(){this.stopListeningComposition(),this.stopListeningToTouch(),document.removeEventListener("scroll",this.onScroll,!0)}},{key:"onMenuOpen",value:function(){this.props.onMenuOpen()}},{key:"onMenuClose",value:function(){this.onInputChange("",{action:"menu-close",prevInputValue:this.props.inputValue}),this.props.onMenuClose()}},{key:"onInputChange",value:function(r,o){this.props.onInputChange(r,o)}},{key:"focusInput",value:function(){this.inputRef&&this.inputRef.focus()}},{key:"blurInput",value:function(){this.inputRef&&this.inputRef.blur()}},{key:"openMenu",value:function(r){var o=this,a=this.state,i=a.selectValue,l=a.isFocused,u=this.buildFocusableOptions(),d=r==="first"?0:u.length-1;if(!this.props.isMulti){var h=u.indexOf(i[0]);h>-1&&(d=h)}this.scrollToFocusedOptionOnUpdate=!(l&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:u[d],focusedOptionId:this.getFocusedOptionId(u[d])},function(){return o.onMenuOpen()})}},{key:"focusValue",value:function(r){var o=this.state,a=o.selectValue,i=o.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var l=a.indexOf(i);i||(l=-1);var u=a.length-1,d=-1;if(a.length){switch(r){case"previous":l===0?d=0:l===-1?d=u:d=l-1;break;case"next":l>-1&&l<u&&(d=l+1);break}this.setState({inputIsHidden:d!==-1,focusedValue:a[d]})}}}},{key:"focusOption",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"first",o=this.props.pageSize,a=this.state.focusedOption,i=this.getFocusableOptions();if(i.length){var l=0,u=i.indexOf(a);a||(u=-1),r==="up"?l=u>0?u-1:i.length-1:r==="down"?l=(u+1)%i.length:r==="pageup"?(l=u-o,l<0&&(l=0)):r==="pagedown"?(l=u+o,l>i.length-1&&(l=i.length-1)):r==="last"&&(l=i.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:i[l],focusedValue:null,focusedOptionId:this.getFocusedOptionId(i[l])})}}},{key:"getTheme",value:(function(){return this.props.theme?typeof this.props.theme=="function"?this.props.theme(Hr):$($({},Hr),this.props.theme):Hr})},{key:"getCommonProps",value:function(){var r=this.clearValue,o=this.cx,a=this.getStyles,i=this.getClassNames,l=this.getValue,u=this.selectOption,d=this.setValue,h=this.props,f=h.isMulti,p=h.isRtl,g=h.options,m=this.hasValue();return{clearValue:r,cx:o,getStyles:a,getClassNames:i,getValue:l,hasValue:m,isMulti:f,isRtl:p,options:g,selectOption:u,selectProps:h,setValue:d,theme:this.getTheme()}}},{key:"hasValue",value:function(){var r=this.state.selectValue;return r.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var r=this.props,o=r.isClearable,a=r.isMulti;return o===void 0?a:o}},{key:"isOptionDisabled",value:function(r,o){return Hc(this.props,r,o)}},{key:"isOptionSelected",value:function(r,o){return Wc(this.props,r,o)}},{key:"filterOption",value:function(r,o){return qc(this.props,r,o)}},{key:"formatOptionLabel",value:function(r,o){if(typeof this.props.formatOptionLabel=="function"){var a=this.props.inputValue,i=this.state.selectValue;return this.props.formatOptionLabel(r,{context:o,inputValue:a,selectValue:i})}else return this.getOptionLabel(r)}},{key:"formatGroupLabel",value:function(r){return this.props.formatGroupLabel(r)}},{key:"startListeningComposition",value:(function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))})},{key:"stopListeningComposition",value:function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))}},{key:"startListeningToTouch",value:(function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))})},{key:"stopListeningToTouch",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))}},{key:"renderInput",value:(function(){var r=this.props,o=r.isDisabled,a=r.isSearchable,i=r.inputId,l=r.inputValue,u=r.tabIndex,d=r.form,h=r.menuIsOpen,f=r.required,p=this.getComponents(),g=p.Input,m=this.state,y=m.inputIsHidden,v=m.ariaSelection,x=this.commonProps,C=i||this.getElementId("input"),N=$($($({"aria-autocomplete":"list","aria-expanded":h,"aria-haspopup":!0,"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props["aria-invalid"],"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-required":f,role:"combobox","aria-activedescendant":this.state.isAppleDevice?void 0:this.state.focusedOptionId||""},h&&{"aria-controls":this.getElementId("listbox")}),!a&&{"aria-readonly":!0}),this.hasValue()?v?.action==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return a?b.createElement(g,z({},x,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:C,innerRef:this.getInputRef,isDisabled:o,isHidden:y,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:u,form:d,type:"text",value:l},N)):b.createElement(Ym,z({id:C,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:sr,onFocus:this.onInputFocus,disabled:o,tabIndex:u,inputMode:"none",form:d,value:""},N))})},{key:"renderPlaceholderOrValue",value:function(){var r=this,o=this.getComponents(),a=o.MultiValue,i=o.MultiValueContainer,l=o.MultiValueLabel,u=o.MultiValueRemove,d=o.SingleValue,h=o.Placeholder,f=this.commonProps,p=this.props,g=p.controlShouldRenderValue,m=p.isDisabled,y=p.isMulti,v=p.inputValue,x=p.placeholder,C=this.state,N=C.selectValue,w=C.focusedValue,j=C.isFocused;if(!this.hasValue()||!g)return v?null:b.createElement(h,z({},f,{key:"placeholder",isDisabled:m,isFocused:j,innerProps:{id:this.getElementId("placeholder")}}),x);if(y)return N.map(function(P,E){var T=P===w,I="".concat(r.getOptionLabel(P),"-").concat(r.getOptionValue(P));return b.createElement(a,z({},f,{components:{Container:i,Label:l,Remove:u},isFocused:T,isDisabled:m,key:I,index:E,removeProps:{onClick:function(){return r.removeValue(P)},onTouchEnd:function(){return r.removeValue(P)},onMouseDown:function(R){R.preventDefault()}},data:P}),r.formatOptionLabel(P,"value"))});if(v)return null;var S=N[0];return b.createElement(d,z({},f,{data:S,isDisabled:m}),this.formatOptionLabel(S,"value"))}},{key:"renderClearIndicator",value:function(){var r=this.getComponents(),o=r.ClearIndicator,a=this.commonProps,i=this.props,l=i.isDisabled,u=i.isLoading,d=this.state.isFocused;if(!this.isClearable()||!o||l||!this.hasValue()||u)return null;var h={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return b.createElement(o,z({},a,{innerProps:h,isFocused:d}))}},{key:"renderLoadingIndicator",value:function(){var r=this.getComponents(),o=r.LoadingIndicator,a=this.commonProps,i=this.props,l=i.isDisabled,u=i.isLoading,d=this.state.isFocused;if(!o||!u)return null;var h={"aria-hidden":"true"};return b.createElement(o,z({},a,{innerProps:h,isDisabled:l,isFocused:d}))}},{key:"renderIndicatorSeparator",value:function(){var r=this.getComponents(),o=r.DropdownIndicator,a=r.IndicatorSeparator;if(!o||!a)return null;var i=this.commonProps,l=this.props.isDisabled,u=this.state.isFocused;return b.createElement(a,z({},i,{isDisabled:l,isFocused:u}))}},{key:"renderDropdownIndicator",value:function(){var r=this.getComponents(),o=r.DropdownIndicator;if(!o)return null;var a=this.commonProps,i=this.props.isDisabled,l=this.state.isFocused,u={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return b.createElement(o,z({},a,{innerProps:u,isDisabled:i,isFocused:l}))}},{key:"renderMenu",value:function(){var r=this,o=this.getComponents(),a=o.Group,i=o.GroupHeading,l=o.Menu,u=o.MenuList,d=o.MenuPortal,h=o.LoadingMessage,f=o.NoOptionsMessage,p=o.Option,g=this.commonProps,m=this.state.focusedOption,y=this.props,v=y.captureMenuScroll,x=y.inputValue,C=y.isLoading,N=y.loadingMessage,w=y.minMenuHeight,j=y.maxMenuHeight,S=y.menuIsOpen,P=y.menuPlacement,E=y.menuPosition,T=y.menuPortalTarget,I=y.menuShouldBlockScroll,D=y.menuShouldScrollIntoView,R=y.noOptionsMessage,F=y.onMenuScrollToTop,_=y.onMenuScrollToBottom;if(!S)return null;var U=function(A,B){var te=A.type,ne=A.data,q=A.isDisabled,oe=A.isSelected,Ne=A.label,Nn=A.value,Uo=m===ne,Vo=q?void 0:function(){return r.onOptionHover(ne)},Wu=q?void 0:function(){return r.selectOption(ne)},Bo="".concat(r.getElementId("option"),"-").concat(B),qu={id:Bo,onClick:Wu,onMouseMove:Vo,onMouseOver:Vo,tabIndex:-1,role:"option","aria-selected":r.state.isAppleDevice?void 0:oe};return b.createElement(p,z({},g,{innerProps:qu,data:ne,isDisabled:q,isSelected:oe,key:Bo,label:Ne,type:te,value:Nn,isFocused:Uo,innerRef:Uo?r.getFocusedOptionRef:void 0}),r.formatOptionLabel(A.data,"menu"))},H;if(this.hasOptions())H=this.getCategorizedOptions().map(function(V){if(V.type==="group"){var A=V.data,B=V.options,te=V.index,ne="".concat(r.getElementId("group"),"-").concat(te),q="".concat(ne,"-heading");return b.createElement(a,z({},g,{key:ne,data:A,options:B,Heading:i,headingProps:{id:q,data:V.data},label:r.formatGroupLabel(V.data)}),V.options.map(function(oe){return U(oe,"".concat(te,"-").concat(oe.index))}))}else if(V.type==="option")return U(V,"".concat(V.index))});else if(C){var G=N({inputValue:x});if(G===null)return null;H=b.createElement(h,g,G)}else{var W=R({inputValue:x});if(W===null)return null;H=b.createElement(f,g,W)}var ee={minMenuHeight:w,maxMenuHeight:j,menuPlacement:P,menuPosition:E,menuShouldScrollIntoView:D},re=b.createElement(Op,z({},g,ee),function(V){var A=V.ref,B=V.placerProps,te=B.placement,ne=B.maxHeight;return b.createElement(l,z({},g,ee,{innerRef:A,innerProps:{onMouseDown:r.onMenuMouseDown,onMouseMove:r.onMenuMouseMove},isLoading:C,placement:te}),b.createElement(tg,{captureEnabled:v,onTopArrive:F,onBottomArrive:_,lockEnabled:I},function(q){return b.createElement(u,z({},g,{innerRef:function(Ne){r.getMenuListRef(Ne),q(Ne)},innerProps:{role:"listbox","aria-multiselectable":g.isMulti,id:r.getElementId("listbox")},isLoading:C,maxHeight:ne,focusedOption:m}),H)}))});return T||E==="fixed"?b.createElement(d,z({},g,{appendTo:T,controlElement:this.controlRef,menuPlacement:P,menuPosition:E}),re):re}},{key:"renderFormField",value:function(){var r=this,o=this.props,a=o.delimiter,i=o.isDisabled,l=o.isMulti,u=o.name,d=o.required,h=this.state.selectValue;if(d&&!this.hasValue()&&!i)return b.createElement(sg,{name:u,onFocus:this.onValueInputFocus});if(!(!u||i))if(l)if(a){var f=h.map(function(m){return r.getOptionValue(m)}).join(a);return b.createElement("input",{name:u,type:"hidden",value:f})}else{var p=h.length>0?h.map(function(m,y){return b.createElement("input",{key:"i-".concat(y),name:u,type:"hidden",value:r.getOptionValue(m)})}):b.createElement("input",{name:u,type:"hidden",value:""});return b.createElement("div",null,p)}else{var g=h[0]?this.getOptionValue(h[0]):"";return b.createElement("input",{name:u,type:"hidden",value:g})}}},{key:"renderLiveRegion",value:function(){var r=this.commonProps,o=this.state,a=o.ariaSelection,i=o.focusedOption,l=o.focusedValue,u=o.isFocused,d=o.selectValue,h=this.getFocusableOptions();return b.createElement(Bm,z({},r,{id:this.getElementId("live-region"),ariaSelection:a,focusedOption:i,focusedValue:l,isFocused:u,selectValue:d,focusableOptions:h,isAppleDevice:this.state.isAppleDevice}))}},{key:"render",value:function(){var r=this.getComponents(),o=r.Control,a=r.IndicatorsContainer,i=r.SelectContainer,l=r.ValueContainer,u=this.props,d=u.className,h=u.id,f=u.isDisabled,p=u.menuIsOpen,g=this.state.isFocused,m=this.commonProps=this.getCommonProps();return b.createElement(i,z({},m,{className:d,innerProps:{id:h,onKeyDown:this.onKeyDown},isDisabled:f,isFocused:g}),this.renderLiveRegion(),b.createElement(o,z({},m,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:f,isFocused:g,menuIsOpen:p}),b.createElement(l,z({},m,{isDisabled:f}),this.renderPlaceholderOrValue(),this.renderInput()),b.createElement(a,z({},m,{isDisabled:f}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(r,o){var a=o.prevProps,i=o.clearFocusValueOnUpdate,l=o.inputIsHiddenAfterUpdate,u=o.ariaSelection,d=o.isFocused,h=o.prevWasFocused,f=o.instancePrefix,p=r.options,g=r.value,m=r.menuIsOpen,y=r.inputValue,v=r.isMulti,x=da(g),C={};if(a&&(g!==a.value||p!==a.options||m!==a.menuIsOpen||y!==a.inputValue)){var N=m?xg(r,x):[],w=m?Na(Qn(r,x),"".concat(f,"-option")):[],j=i?wg(o,x):null,S=Cg(o,N),P=Wr(w,S);C={selectValue:x,focusedOption:S,focusedOptionId:P,focusableOptionsWithIds:w,focusedValue:j,clearFocusValueOnUpdate:!1}}var E=l!=null&&r!==a?{inputIsHidden:l,inputIsHiddenAfterUpdate:void 0}:{},T=u,I=d&&h;return d&&!I&&(T={value:kn(v,x,x[0]||null),options:x,action:"initial-input-focus"},I=!h),u?.action==="initial-input-focus"&&(T=null),$($($({},C),E),{},{prevProps:r,ariaSelection:T,prevWasFocused:I})}}]),n})(b.Component);Qc.defaultProps=vg;var jg=b.forwardRef(function(e,t){var n=oh(e);return b.createElement(Qc,z({ref:t},n))}),Pg=jg;function Ng(e){return c.jsx(Er.DropdownIndicator,{...e,children:c.jsx(O,{name:"ChevronDown",size:16})})}function Eg(e){return c.jsx(Er.ClearIndicator,{...e,children:c.jsx(O,{name:"Xmark",size:16})})}function Og(e){const{label:t,onClick:n,...s}=e,r=!!t&&!!n;return c.jsxs(Er.MenuList,{...s,children:[e.children,r?c.jsx("button",{className:"w-full px-2 py-3 hover:bg-slate-50",onClick:n,children:t}):null]})}function ww(e){const t=e["aria-invalid"]==="true",{addItemButtonProps:n,...s}=e;return c.jsx(Pg,{...s,components:{DropdownIndicator:Ng,ClearIndicator:Eg,MenuList:r=>Og({...r,...n})},styles:{dropdownIndicator:()=>({label:"indicatorContainer",display:"flex",transition:"color 150ms",color:"var(color-gray-900)",padding:8,boxSizing:"border-box"}),clearIndicator:r=>({...r,color:"var(color-gray-900)"}),container:r=>({...r,borderColor:"var(color-gray-200)",fontSize:12}),placeholder:r=>({...r,color:t?"var(color-red-800)":"var(color-gray-500)"}),control:()=>({label:"control",alignItems:"center",cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:32,outline:"0 !important",position:"relative",transition:"all 100ms",backgroundColor:"var(--color-white)",borderColor:t?"var(--color-red-900)":"var(--color-gray-200)",borderStyle:"solid",borderWidth:1,borderRadius:"6px",boxSizing:"border-box"}),option:(r,o)=>({...r,backgroundColor:o.isSelected?"var(--color-slate-50)":"var(--color-white)",color:"var(--color-gray-800)",":hover":{backgroundColor:"var(--color-slate-50)"}}),menuList:r=>({...r,padding:0,borderRadius:"6px"})},theme:r=>({...r,colors:{...r.colors,primary:"var(--color-slate-100)",primary25:"var(--color-slate-50)",primary50:"var(--color-slate-100)",primary75:"var(--color-slate-100)",danger:"var(--color-red-900)",dangerLight:"var(--color-red-100)",neutral0:"var(--color-white)",neutral5:"var(--color-gray-50)",neutral10:"var(--color-gray-100)",neutral20:"var(--color-gray-200)",neutral30:"var(--color-gray-300)",neutral40:"var(--color-gray-400)",neutral50:"var(--color-gray-500)",neutral60:"var(--color-gray-600)",neutral70:"var(--color-gray-700)",neutral80:"var(--color-gray-800)",neutral90:"var(--color-gray-900)"}})})}const Cw=e=>{const{children:t,cookies:n,submitLabel:s,rejectLabel:r,onSubmit:o=()=>{},onReject:a=()=>{},...i}=e,[l,u]=b.useState(n),d=f=>{const{id:p,checked:g}=f.target;u(m=>m.map(y=>y.id===p?{...y,value:g}:y))},h="min-w-64 h-8 text-base";return c.jsxs("div",{...ce(i,"flex flex-col items-center"),children:[c.jsx("div",{className:"text-center",children:t}),c.jsx("div",{className:"my-8 flex gap-x-16 text-sm font-medium",children:l.map((f,p)=>c.jsxs("div",{className:"cursor-pointer",children:[c.jsx("input",{checked:f.value,className:"mr-1 size-3 cursor-pointer rounded-sm border-2 border-gray-900 accent-gray-900 focus:outline-none",id:f.id,onChange:d,type:"checkbox"}),c.jsx("label",{className:"cursor-pointer select-none",htmlFor:f.id,children:f.label})]},p))}),c.jsxs("div",{className:"flex gap-x-8",children:[c.jsx(Pe,{className:h,color:"light",onClick:()=>a(),size:"small",children:r},"button-reject"),c.jsx(Pe,{className:h,onClick:()=>o(l),size:"small",children:s},"button-submit")]})]})},Oa="min-h-[48px] min-w-[142px] text-base font-semibold py-3 px-6 rounded-xl outline-none active:opacity-75 hover:scale-105 transform transition-all";function fo(e){const{body:t,header:n,children:s,onCancel:r,onOpenChange:o,onContinue:a,cancelLabel:i,continueLabel:l,overlayProps:u,contentProps:d,bodyProps:h={},headerProps:f={},containerProps:p={},cancelButtonProps:g={},continueButtonProps:m={},buttonContainerProps:y={},...v}=e;return c.jsx(_e,{contentProps:{...d,className:M("rounded-3xl",d?.className)},onOpenChange:o,overlayProps:{...u,className:u?.className},...v,children:c.jsxs("div",{...ce(p,"w-[400px] p-6 text-slate-300"),children:[c.jsx("div",{...ce(f,"border-b border-slate-50 pb-2 text-2xl font-bold text-gray-800"),children:n}),c.jsxs("div",{...ce(h,"my-6 rounded-md bg-slate-50 p-4 text-center"),children:[t,s]}),c.jsxs("div",{...ce(y,"mt-8 flex justify-between gap-3"),children:[c.jsx("button",{onClick:r,...ce(g,M(Oa,"flex-1 bg-slate-50 text-slate-800")),children:i}),c.jsx("button",{onClick:a,...ce(m,M(Oa,"flex-1 bg-gray-800 text-gray-50")),children:l})]})]})})}const Yc=16;function Ia({label:e,depth:t,expanded:n,selected:s,hasChildren:r,icon:o,onToggle:a,onClick:i,children:l}){const u=d=>{d.stopPropagation(),a?.()};return c.jsxs("div",{children:[c.jsxs("div",{className:M("flex cursor-pointer items-center gap-1 py-1 pr-2 text-sm hover:bg-gray-100",s&&"bg-blue-50"),style:{paddingLeft:t*Yc+4},onClick:i,children:[r?c.jsx("button",{className:"flex h-4 w-4 shrink-0 items-center justify-center text-gray-500 hover:text-gray-700",onClick:u,type:"button",children:c.jsx(O,{className:M("transition-transform",n&&"rotate-90"),name:"CaretRight",size:12})}):c.jsx("span",{className:"w-4 shrink-0"}),o&&c.jsx("span",{className:"shrink-0 text-gray-500",children:o}),c.jsx("span",{className:"min-w-0 flex-1 truncate text-gray-700",children:e}),s&&c.jsx("span",{className:"ml-auto h-2 w-2 shrink-0 rounded-full bg-blue-500"})]}),n&&l]})}function Ig({column:e,depth:t}){const n=e.dataType.length>10?e.dataType.slice(0,10)+"…":e.dataType;return c.jsxs("div",{className:"flex items-center gap-1 py-0.5 pr-2 text-xs text-gray-500",style:{paddingLeft:t*Yc+4},children:[c.jsx("span",{className:"w-4 shrink-0"}),c.jsx("span",{className:"truncate",children:e.name}),c.jsxs("span",{className:"ml-auto shrink-0 text-gray-400",children:["(",n,")"]})]})}function Mg({schema:e,tables:t,selectedTable:n,onSelectTable:s,onRefresh:r,loading:o}){const[a,i]=b.useState({[e]:!0}),l=f=>{i(p=>({...p,[f]:!p[f]}))},u=f=>{s(f),i(p=>({...p,[f]:!p[f]}))},d=a[e]??!1,h=f=>{f.stopPropagation(),r?.()};return c.jsx("div",{className:"flex flex-col overflow-auto pt-4 text-sm",children:c.jsx(Ia,{depth:0,expanded:d,hasChildren:t.length>0,icon:c.jsx(O,{name:d?"FolderOpen":"FolderClose",size:16}),label:c.jsxs("div",{className:"flex flex-1 items-center",children:[c.jsx("span",{className:"truncate",children:e}),r&&c.jsx("button",{className:"ml-auto p-0.5 text-gray-400 hover:text-gray-600",onClick:h,type:"button",disabled:o,children:c.jsx(O,{name:"Reload",size:14,className:o?"animate-spin":void 0})})]}),onClick:()=>l(e),onToggle:()=>l(e),children:t.map(f=>{const p=a[f.name]??!1,g=n===f.name;return c.jsx(Ia,{depth:1,expanded:p,hasChildren:f.columns.length>0,icon:c.jsx(O,{name:"TreeViewSlash",size:16}),label:f.name,selected:g,onClick:()=>u(f.name),onToggle:()=>l(f.name),children:f.columns.map(m=>c.jsx(Ig,{column:m,depth:2},m.name))},f.name)})})})}function Tg(e){return b.forwardRef(e)}const yt=Tg(function(t,n){const{items:s,value:r,id:o,onChange:a,containerClassName:i,menuClassName:l,itemClassName:u,absolutePositionMenu:d=!1,borderRadius:h="6px"}=t,[f,p]=b.useState(!1),g=y(r)??s[0];function m(x){x.disabled||(a(x.value),p(!1))}function y(x){return s.find(C=>C.value===x)}const v=s.filter(x=>x.value!==r);return c.jsxs("div",{className:M("border border-gray-200 bg-gray-50 text-gray-800 transition-[border-radius]",d&&"relative",i),"data-open":f,ref:n,style:{borderRadius:h},children:[c.jsxs("div",{className:M("flex min-w-[360px] cursor-pointer items-center justify-between pr-3 text-gray-800 outline-none",l),id:o,onClick:()=>p(!f),children:[c.jsx(Ma,{...g,className:u}),c.jsx(O,{className:eo("transition",f?"":"-rotate-90"),name:"ChevronDown"})]}),c.jsx("div",{className:M("max-h-0 w-full overflow-hidden bg-inherit transition-[max-height] ease-in-out",f&&"max-h-screen",d&&"absolute"),style:{borderRadius:`0 0 ${h} ${h}`},children:v.map(x=>c.jsx(Ma,{...x,className:u,onItemClick:()=>m(x)},x.value))})]})});function Ma(e){const{className:t,disabled:n,onItemClick:s,icon:r,displayValue:o,value:a,description:i}=e;return c.jsxs("div",{className:M(n?"cursor-not-allowed text-gray-500":"text-gray-800","flex size-full cursor-pointer items-center gap-2 bg-inherit py-3 pl-3 text-start outline-none",t),onClick:s,children:[r,c.jsxs("div",{children:[c.jsx("p",{className:"capitalize text-inherit",children:o??a.toLowerCase()}),c.jsx("p",{className:"text-xs text-gray-600",children:i})]})]})}function Ta(e){const t=["=","!=",">","<",">=","<=","IS NULL","IS NOT NULL"],n=e.dataType.toLowerCase();return n.includes("varchar")||n.includes("text")||n.includes("char")?[...t,"LIKE","ILIKE"]:(n.includes("int")||n.includes("decimal")||n.includes("numeric")||n.includes("real")||n.includes("double")||n.includes("float")||n.includes("bigint")||n.includes("smallint"),t)}function Dg(e,t){if(t==="IS NULL"||t==="IS NOT NULL")return"text";const n=e.dataType.toLowerCase();return n.includes("int")||n.includes("decimal")||n.includes("numeric")||n.includes("real")||n.includes("double")||n.includes("float")||n.includes("bigint")||n.includes("smallint")?"number":n.includes("timestamp")||n.includes("date")||n.includes("time")?"datetime-local":"text"}function kg({clause:e,columns:t,onUpdate:n,onRemove:s,showConnector:r,connector:o,onConnectorChange:a}){const i=t.find(v=>v.name===e.column),l=i?Ta(i):["=","!="],u=i?Dg(i,e.operator):"text",d=e.operator!=="IS NULL"&&e.operator!=="IS NOT NULL",h=b.useMemo(()=>t.map(v=>({value:v.name,displayValue:v.name})),[t]),f=b.useMemo(()=>l.map(v=>({value:v,displayValue:v})),[l]),p=b.useMemo(()=>[{value:"AND",displayValue:"AND"},{value:"OR",displayValue:"OR"}],[]),g=b.useCallback(v=>{const x=t.find(w=>w.name===v);if(!x)return;const C=Ta(x),N=C.includes(e.operator)?e.operator:C[0];n({...e,column:v,operator:N,value:""})},[e,t,n]),m=b.useCallback(v=>{n({...e,operator:v,value:v==="IS NULL"||v==="IS NOT NULL"?"":e.value})},[e,n]),y=b.useCallback(v=>{n({...e,value:v})},[e,n]);return c.jsxs("div",{className:"flex items-center gap-2",children:[r&&c.jsx(yt,{absolutePositionMenu:!0,borderRadius:"4px",containerClassName:"min-w-[80px]",id:`connector-${e.id}`,items:p,itemClassName:"px-2 py-1 text-xs",menuClassName:"px-2 py-1 text-xs min-w-[80px]",value:o,onChange:a}),c.jsx(yt,{absolutePositionMenu:!0,borderRadius:"4px",containerClassName:"min-w-[150px]",id:`column-${e.id}`,items:h,itemClassName:"px-2 py-1 text-xs",menuClassName:"px-2 py-1 text-xs min-w-[150px]",value:e.column,onChange:g}),c.jsx(yt,{absolutePositionMenu:!0,borderRadius:"4px",containerClassName:"min-w-[100px]",id:`operator-${e.id}`,items:f,itemClassName:"px-2 py-1 text-xs",menuClassName:"px-2 py-1 text-xs min-w-[100px]",value:e.operator,onChange:m}),d&&c.jsx("input",{className:"min-w-[150px] rounded border border-gray-300 bg-white px-2 py-1 text-xs text-gray-900",type:u,value:e.value,onChange:v=>y(v.target.value)}),c.jsx("button",{className:"flex items-center justify-center rounded p-1 text-gray-500 hover:bg-gray-200 hover:text-gray-700",onClick:s,title:"Remove filter",type:"button",children:c.jsx(O,{name:"Xmark",size:14})})]})}function Rg({columns:e,filters:t,onFiltersChange:n}){const[s,r]=b.useState(!1),o=b.useCallback(()=>{const d={id:`filter-${Date.now()}-${Math.random()}`,column:e[0]?.name??"",operator:"=",value:""};n(t?{clauses:[...t.clauses,d],connectors:[...t.connectors,(t.clauses.length>0,"AND")]}:{clauses:[d],connectors:[]}),r(!0)},[e,t,n]),a=b.useCallback((d,h)=>{if(!t)return;const f=[...t.clauses];f[d]=h,n({...t,clauses:f})},[t,n]),i=b.useCallback(d=>{if(!t)return;const h=t.clauses.filter((p,g)=>g!==d),f=t.connectors.filter((p,g)=>g!==d-1);h.length===0?n(void 0):n({clauses:h,connectors:f})},[t,n]),l=b.useCallback((d,h)=>{if(!t)return;const f=[...t.connectors];f[d]=h,n({...t,connectors:f})},[t,n]),u=t&&t.clauses.length>0;return c.jsxs("div",{className:"flex shrink-0 flex-col gap-2 rounded-lg border border-gray-300 bg-white p-2",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("button",{className:"flex items-center gap-1 text-xs text-gray-700 hover:text-gray-900",onClick:()=>r(!s),type:"button",children:[c.jsx(O,{className:M("transition-transform",s&&"rotate-90"),name:"ChevronDown",size:12}),c.jsx("span",{children:"Filters"}),u&&c.jsx("span",{className:"rounded bg-blue-100 px-1.5 py-0.5 text-xs text-blue-700",children:t.clauses.length})]}),c.jsxs("button",{className:"flex items-center gap-1 rounded border border-gray-300 bg-white px-2 py-1 text-xs text-gray-700 hover:bg-gray-100",onClick:o,type:"button",children:[c.jsx(O,{name:"Plus",size:12}),"Add Filter"]})]}),s&&u&&c.jsx("div",{className:"flex flex-col gap-2",children:t.clauses.map((d,h)=>c.jsx(kg,{clause:d,columns:e,connector:h>0?t.connectors[h-1]??"AND":"AND",onConnectorChange:f=>l(h-1,f),onRemove:()=>i(h),onUpdate:f=>a(h,f),showConnector:h>0},d.id))})]})}function bs(e){return e===null?"NULL":e===void 0?"":typeof e=="object"?JSON.stringify(e):typeof e=="function"?"[function]":typeof e=="symbol"?e.toString():String(e)}function Kc(e){return e.includes(",")||e.includes(`
7
+ `)||e.includes('"')?`"${e.replace(/"/g,'""')}"`:e}function Xc(e,t){return t.map(n=>{const s=bs(e[n.name]);return Kc(s)}).join(",")}function Jc(e,t){const n=t.map(r=>Kc(r.name)).join(","),s=e.map(r=>Xc(r,t));return[n,...s].join(`
8
+ `)}async function Da(e){await navigator.clipboard.writeText(e)}function Ag({direction:e,active:t}){return t?c.jsx(O,{className:e==="asc"?"rotate-180":void 0,name:"TriangleDown",size:12}):c.jsx(O,{className:"opacity-0 group-hover:opacity-50",name:"CaretSort",size:12})}function Lg({columns:e,rows:t,pagination:n,onPageChange:s,onSort:r,currentSort:o,loading:a=!1,filters:i,onFiltersChange:l,onCopyAll:u}){const{offset:d,limit:h,total:f}=n,p=Math.floor(d/h),g=f!==null?Math.ceil(f/h):0,m=f===0?0:d+1,y=f!==null?Math.min(d+h,f):d+t.length,v=I=>{s(I*h)},x=I=>{if(!r)return;const D=o?.column===I&&o.direction==="asc"?"desc":"asc";r({column:I,direction:D})},N=(()=>{if(g<=3)return Array.from({length:g},(_,U)=>U);const D=Math.max(0,Math.min(p-1,g-3)),R=Math.min(g-1,D+3-1),F=[];for(let _=D;_<=R;_++)F.push(_);return F})(),[w,j]=b.useState(!1),[S,P]=b.useState(null),E=async()=>{if(t.length!==0){j(!0);try{const I=u?await u():Jc(t,e);await Da(I),setTimeout(()=>j(!1),1e3)}catch(I){console.error("Failed to copy to clipboard:",I),j(!1)}}},T=async I=>{if(!(I<0||I>=t.length)){P(I);try{const D=Xc(t[I],e);await Da(D),setTimeout(()=>P(null),1e3)}catch(D){console.error("Failed to copy to clipboard:",D),P(null)}}};return c.jsxs("div",{className:"flex h-full flex-col gap-2",children:[l&&c.jsx(Rg,{columns:e,filters:i,onFiltersChange:l}),c.jsxs("div",{className:"flex shrink-0 items-center justify-between text-sm",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-gray-600",children:a?"Loading...":f!==null?`Showing ${m.toLocaleString()}-${y.toLocaleString()} of ${f.toLocaleString()}`:`Showing ${t.length.toLocaleString()} rows`}),t.length>0&&c.jsxs("button",{className:"flex items-center gap-1 rounded border border-gray-300 bg-white px-2 py-1 text-xs text-gray-700 hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50",disabled:a||w,onClick:E,title:"Copy all rows as CSV",type:"button",children:[c.jsx(O,{name:w?"Check":"Copy",size:14}),w?"Copied!":"Copy All"]})]}),f!==null&&f>h&&c.jsxs("div",{className:"flex gap-1",children:[c.jsx("button",{className:"rounded border border-gray-300 bg-white px-2 py-1 text-xs text-gray-700 hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50",disabled:p===0,onClick:()=>v(0),type:"button",children:"First"}),c.jsx("button",{className:"rounded border border-gray-300 bg-white px-2 py-1 text-xs text-gray-700 hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50",disabled:p===0,onClick:()=>v(p-1),type:"button",children:c.jsx(O,{className:"rotate-90",name:"ChevronDown",size:14})}),N[0]>0&&c.jsx("span",{className:"flex items-center px-1 text-xs text-gray-500",children:"..."}),N.map(I=>c.jsx("button",{className:M("min-w-8 rounded border px-2 py-1 text-xs",I===p?"border-blue-500 bg-blue-50 text-blue-700":"border-gray-300 bg-white text-gray-700 hover:bg-gray-100"),onClick:()=>v(I),type:"button",children:I+1},I)),N[N.length-1]<g-1&&c.jsx("span",{className:"flex items-center px-1 text-xs text-gray-500",children:"..."}),c.jsx("button",{className:"rounded border border-gray-300 bg-white px-2 py-1 text-xs text-gray-700 hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50",disabled:p>=g-1,onClick:()=>v(p+1),type:"button",children:c.jsx(O,{className:"-rotate-90",name:"ChevronDown",size:14})}),c.jsx("button",{className:"rounded border border-gray-300 bg-white px-2 py-1 text-xs text-gray-700 hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50",disabled:p>=g-1,onClick:()=>v(g-1),type:"button",children:"Last"})]})]}),c.jsx("div",{className:M("max-h-full overflow-auto rounded-lg border border-gray-300 transition-opacity",a&&"pointer-events-none opacity-50"),children:c.jsxs("table",{className:"w-full border-collapse",children:[c.jsx("thead",{className:"sticky top-0 bg-gray-100",children:c.jsxs("tr",{children:[c.jsx("th",{className:"w-12 px-2 py-2 text-center text-xs font-medium text-gray-600",children:c.jsx("span",{className:"sr-only",children:"Copy"})}),e.map((I,D)=>{const R=o?.column===I.name,F=R?o.direction:"asc";return c.jsx("th",{className:M("group px-3 py-2 text-left text-xs font-medium text-gray-600",D>0&&"border-l border-gray-300",r&&"cursor-pointer hover:bg-gray-200 hover:text-gray-900"),onClick:()=>r&&x(I.name),children:c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("span",{className:"truncate",children:I.name}),r&&c.jsx(Ag,{active:R,direction:F})]})},I.name)})]})}),c.jsx("tbody",{children:t.length===0?c.jsx("tr",{children:c.jsx("td",{className:"px-3 py-8 text-center text-sm text-gray-500",colSpan:e.length+1,children:"No data"})}):t.map((I,D)=>c.jsxs("tr",{className:"odd:bg-white even:bg-gray-50 hover:bg-blue-50",children:[c.jsx("td",{className:"px-2 py-2 text-center",children:c.jsx("button",{className:"flex items-center justify-center rounded p-1 text-gray-500 hover:bg-gray-200 hover:text-gray-700",onClick:()=>void T(D),title:"Copy row as CSV",type:"button",children:c.jsx(O,{name:S===D?"Check":"Copy",size:14})})}),e.map((R,F)=>c.jsx("td",{className:M("px-3 py-2 text-xs text-gray-900",F>0&&"border-l border-gray-300"),children:c.jsx("span",{className:M("block truncate",I[R.name]===null&&"italic text-gray-400"),title:bs(I[R.name]),children:bs(I[R.name])})},R.name))]},D))})]})})]})}const Fg=50;function $g({schema:e,getTables:t,getTableRows:n,getDefaultSort:s,pageSize:r=Fg,onImportDb:o,onExportDb:a}){const i=b.useRef(null),[l,u]=b.useState([]),[d,h]=b.useState(!0),[f,p]=b.useState(),[g,m]=b.useState(null),[y,v]=b.useState({offset:0,limit:r,total:null}),[x,C]=b.useState(),[N,w]=b.useState(),[j,S]=b.useState(!1),[P,E]=b.useState(null),T=l.find(A=>A.name===f)?.columns??[],I=b.useCallback(async()=>{if(!f)return;S(!0);const A=await n(f,{schema:e,limit:y.limit,offset:y.offset,sort:x,filters:N});m(A),v(B=>({...B,total:A.total})),S(!1)},[f,e,y.limit,y.offset,x,N,n]),D=b.useCallback(async()=>{if(!f)return"";const A=y.total??1e6,B=await n(f,{schema:e,limit:A,offset:0,sort:x,filters:N});return Jc(B.rows,T)},[f,e,y.total,x,N,n,T]),R=b.useCallback(async()=>{h(!0);const A=await t();return u(A),h(!1),A},[t]),F=b.useCallback(async()=>{const A=await R();if(f&&!A.some(B=>B.name===f)){p(void 0),m(null);return}f&&await I()},[R,f,I]);b.useEffect(()=>{R()},[R]),b.useEffect(()=>{f&&I()},[f,y.offset,x,N,I]);const _=A=>{A!==f&&(p(A),v(B=>({...B,offset:0,total:null})),C(s?.(A)),w(void 0),m(null))},U=A=>{v(B=>({...B,offset:A}))},H=A=>{C(A),v(B=>({...B,offset:0}))},G=()=>{i.current?.click()},W=A=>{const B=A.target.files?.[0];B&&(B.text().then(te=>{E(te)}),A.target.value="")},ee=async()=>{P&&(p(void 0),m(null),await o?.(P),E(null),await R())},re=()=>{E(null)},V=()=>{a?.()};return c.jsxs("div",{className:"flex h-full",children:[c.jsx("input",{ref:i,type:"file",accept:".sql,.txt,text/plain",className:"hidden",onChange:W}),c.jsx(fo,{open:!!P,onOpenChange:A=>!A&&E(null),header:"Replace Database?",body:"This will delete all existing data and replace it with the imported file. This action cannot be undone.",cancelLabel:"Cancel",continueLabel:"Replace Data",onCancel:re,onContinue:()=>void ee(),continueButtonProps:{className:"bg-red-900 text-white hover:bg-red-800"}}),c.jsxs("div",{className:"flex w-64 shrink-0 flex-col border-r border-gray-200",children:[c.jsx("div",{className:"flex-1 overflow-auto",children:c.jsx(Mg,{schema:e,tables:l,selectedTable:f,onSelectTable:_,onRefresh:F,loading:d||j})}),(o||a)&&c.jsxs("div",{className:"flex shrink-0 flex-col gap-2 border-t border-gray-200 p-2",children:[o&&c.jsx("button",{className:"rounded border border-gray-300 bg-white px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-100",onClick:G,type:"button",children:"Import DB"}),a&&c.jsx("button",{className:"rounded border border-gray-300 bg-white px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-100",onClick:V,type:"button",children:"Export DB"})]})]}),c.jsx("div",{className:"flex-1 overflow-auto p-4",children:f?!g&&j?c.jsx("div",{className:"text-sm text-gray-500",children:"Loading..."}):g?c.jsx(Lg,{columns:T,rows:g.rows,pagination:y,onPageChange:U,onSort:H,currentSort:x,loading:j,filters:N,onFiltersChange:A=>{w(A),v(B=>({...B,offset:0}))},onCopyAll:D}):null:c.jsx("div",{className:"text-sm text-gray-500",children:"Select a table to view data"})})]})}function Sw(e){const{message:t="Loading editor",...n}=e;return c.jsx("div",{className:"grid h-full place-items-center",...n,children:c.jsxs("div",{className:"-mt-20 grid place-items-center",children:[c.jsx("h3",{className:"mb-4 text-xl",children:t}),c.jsx(J0,{})]})})}function ir(e){const{title:t,isOpen:n,onOpenChange:s,children:r,containerClassName:o,toggleClassName:a,contentClassName:i}=e;return c.jsxs("div",{className:M(o),children:[c.jsxs("div",{className:M("flex cursor-pointer justify-between text-gray-500",a),onClick:s,children:[c.jsx("h2",{className:"font-semibold text-inherit",children:t}),c.jsx(O,{className:eo("transition",n?"":"-rotate-90"),size:16,name:"ChevronDown"})]}),c.jsx("div",{className:M("max-h-0 overflow-hidden transition-[max-height] duration-300 ease-in-out",n&&"max-h-screen",i),children:r})]})}function mt(e){return c.jsx("div",{...e,className:M("h-px bg-gray-200",e.className)})}function cr(e){const{label:t,children:n}=e;return c.jsx("div",{children:n})}var Or="Tabs",[zg]=zi(Or,[Bi]),Zc=Bi(),[_g,ho]=zg(Or),el=b.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:r,defaultValue:o,orientation:a="horizontal",dir:i,activationMode:l="automatic",...u}=e,d=bd(i),[h,f]=Vi({prop:s,onChange:r,defaultProp:o??"",caller:Or});return c.jsx(_g,{scope:n,baseId:Ui(),value:h,onValueChange:f,orientation:a,dir:d,activationMode:l,children:c.jsx(Nt.div,{dir:d,"data-orientation":a,...u,ref:t})})});el.displayName=Or;var tl="TabsList",nl=b.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...r}=e,o=ho(tl,n),a=Zc(n);return c.jsx(yd,{asChild:!0,...a,orientation:o.orientation,dir:o.dir,loop:s,children:c.jsx(Nt.div,{role:"tablist","aria-orientation":o.orientation,...r,ref:t})})});nl.displayName=tl;var rl="TabsTrigger",sl=b.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:r=!1,...o}=e,a=ho(rl,n),i=Zc(n),l=il(a.baseId,s),u=cl(a.baseId,s),d=s===a.value;return c.jsx(vd,{asChild:!0,...i,focusable:!r,active:d,children:c.jsx(Nt.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:l,...o,ref:t,onMouseDown:Ae(e.onMouseDown,h=>{!r&&h.button===0&&h.ctrlKey===!1?a.onValueChange(s):h.preventDefault()}),onKeyDown:Ae(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&a.onValueChange(s)}),onFocus:Ae(e.onFocus,()=>{const h=a.activationMode!=="manual";!d&&!r&&h&&a.onValueChange(s)})})})});sl.displayName=rl;var ol="TabsContent",al=b.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:r,children:o,...a}=e,i=ho(ol,n),l=il(i.baseId,s),u=cl(i.baseId,s),d=s===i.value,h=b.useRef(d);return b.useEffect(()=>{const f=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(f)},[]),c.jsx(Zs,{present:r||d,children:({present:f})=>c.jsx(Nt.div,{"data-state":d?"active":"inactive","data-orientation":i.orientation,role:"tabpanel","aria-labelledby":l,hidden:!f,id:u,tabIndex:0,...a,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:f&&o})})});al.displayName=ol;function il(e,t){return`${e}-trigger-${t}`}function cl(e,t){return`${e}-content-${t}`}var Ug=el,Vg=nl,Bg=sl,Hg=al;function ll({children:e,defaultValue:t}){return c.jsxs(Ug,{defaultValue:t,className:"flex flex-col gap-2",children:[c.jsx("div",{className:"flex w-full justify-between",children:c.jsx(Vg,{className:"flex w-full gap-x-2 rounded-xl bg-slate-50 p-1 text-sm font-semibold text-gray-600 outline-none",children:K.Children.map(e,(n,s)=>{if(!K.isValidElement(n))return;const{label:r,disabled:o}=n.props;return c.jsx(Bg,{className:"data-[state='active']:tab-shadow ata-disabled:cursor-not-allowed data-disabled:text-gray-400 flex h-7 flex-1 items-center justify-center rounded-lg transition duration-300 data-[state='active']:bg-gray-50 data-[state='active']:text-gray-900",value:r,disabled:o??!1,children:r},r)})})}),c.jsx("div",{className:"mt-3 rounded-md bg-white",children:K.Children.map(e,(n,s)=>{if(!K.isValidElement(n))return;const{label:r}=n.props;return c.jsx(Hg,{value:r,children:n},s)})})]})}function Ve(e){const{children:t,content:n,open:s,defaultOpen:r,onOpenChange:o,className:a,side:i="top",sideOffset:l=5,delayDuration:u,...d}=e;return c.jsxs(lf,{defaultOpen:r,delayDuration:u,onOpenChange:o,open:s,children:[c.jsx(uf,{asChild:!0,children:t}),c.jsx(df,{children:c.jsx(ff,{...d,side:i,sideOffset:l,className:M("shadow-tooltip rounded-lg border border-gray-200 bg-white p-2 text-xs",a),children:n})})]})}const ul=cf,Wg=e=>{const{className:t,timestampUtcMs:n,title:s,subtitle:r,onClick:o,isSelected:a=!1}=e,[i,l]=b.useState(!1),u=!!s||!!r||!!n;b.useEffect(()=>{i&&(l(!1),setTimeout(()=>u&&l(!0),50))},[s,r,n,u]);const d=g=>{if(!g)return"";try{return E0(new Date(g),{addSuffix:!0})}catch{return g}},h=c.jsxs("div",{className:"flex flex-col text-xs",children:[!!s&&c.jsx("div",{children:s}),!!r&&c.jsx("div",{className:"text-gray-300",children:r}),!!n&&c.jsx("div",{children:d(n)})]}),f=()=>{u&&l(!0)},p=()=>{l(!1)};return c.jsxs("div",{className:"relative",onMouseEnter:f,onMouseLeave:p,children:[a&&c.jsx(O,{name:"TimelineCaret",color:"#4EA9FF",size:10,className:"absolute top-[-11px] z-40"}),c.jsx(Ve,{className:"rounded-md bg-gray-900 text-white",content:h,open:i&&u,onOpenChange:l,delayDuration:0,side:"bottom",sideOffset:5,children:c.jsx("div",{className:M("mx-0.5 flex h-[25px] w-1.5 cursor-pointer flex-col items-center justify-center rounded-[2px] hover:bg-blue-300",a&&"bg-blue-300",t),onClick:o,"data-title":s,"data-subtitle":r,"data-timestamp":n,children:c.jsx("div",{className:"h-0.5 w-1 rounded-full bg-gray-500"})})})]})},ka=(e=0)=>{switch(!0){case e<=0:return"h-[1px]";case e===1:return"h-[3px]";case e===2:return"h-[6px]";case e===3:return"h-[9px]";case e>=4:return"h-[12px]";default:return"h-[1px]"}},qg=e=>{if(!e)return"";try{const t=O0(e);return tr(t,"HH:mm, dd, MMMM")}catch{return e}},Gg=({onClick:e,className:t,timestampUtcMs:n,additions:s,deletions:r,addSize:o=0,delSize:a=0,isSelected:i=!1})=>{const[l,u]=b.useState(!1),d=o===0&&a===0,h=ka(o),f=ka(a),p=c.jsxs("div",{className:"flex flex-col text-xs",children:[c.jsx("div",{children:qg(n)}),c.jsx("div",{className:"text-green-900",children:`${s} additions +`}),c.jsx("div",{className:"text-red-700",children:`${r} deletions -`})]}),g=()=>{d||u(!0)},m=()=>{u(!1)};return c.jsxs("div",{className:"relative",onMouseEnter:g,onMouseLeave:m,children:[i&&c.jsx(O,{name:"TimelineCaret",color:"#4EA9FF",size:10,className:"absolute left-[-2px] top-[-11px] z-40"}),d?c.jsx("div",{className:M("flex h-[25px] w-1.5 cursor-pointer flex-col items-center justify-center rounded-[2px] hover:bg-blue-300",t),"data-timestamp":n,onClick:e,children:c.jsx("div",{className:"size-[3px] rounded-full bg-gray-500"})}):c.jsx(Ve,{className:"rounded-md bg-gray-900 text-white",content:p,open:l,onOpenChange:u,delayDuration:0,side:"bottom",sideOffset:5,children:c.jsxs("div",{className:M("flex h-[25px] w-1.5 cursor-pointer flex-col items-center justify-center rounded-[2px] hover:bg-blue-300",t,i&&"bg-blue-300"),"data-timestamp":n,onClick:e,children:[c.jsx("div",{className:"flex h-3 w-0.5 items-end",children:c.jsx("div",{className:M("h-3 w-0.5 rounded-t-full bg-green-600",h)})}),c.jsx("div",{className:"flex h-3 w-0.5 items-start",children:c.jsx("div",{className:M("h-3 w-0.5 rounded-b-full bg-red-600",f)})})]})})]})},Ra={id:"default",type:"bar",addSize:0,delSize:0},Qg=e=>{const{timeline:t=[],onItemClick:n}=e,[s,r]=b.useState(null),o=b.useRef(null),a=p=>{p.id===s||p.id===Ra.id?(n?.(null),r(null)):(n?.(p),r(p.id))},i=[...t,Ra],[l,u]=b.useMemo(()=>{const p=i.findIndex(g=>g.id===s);return p===-1?[i,[]]:[i.slice(0,p),i.slice(p)]},[i,s]),d=b.useCallback(p=>p.map(g=>{if(g.type==="divider"){const{timestampUtcMs:m,title:y,subtitle:v}=g;return c.jsx(Wg,{timestampUtcMs:m,title:y,subtitle:v,onClick:()=>a(g),isSelected:g.id===s},g.id)}return c.jsx(Gg,{timestampUtcMs:g.timestampUtcMs,addSize:g.addSize,delSize:g.delSize,additions:g.additions,deletions:g.deletions,isSelected:g.id===s,onClick:()=>a(g)},g.id)}),[a,s]),h=b.useMemo(()=>d(l),[l,d]),f=b.useMemo(()=>d(u),[u,d]);return b.useEffect(()=>{o.current&&(o.current.scrollLeft=o.current.scrollWidth)},[]),c.jsx(ul,{delayDuration:0,skipDelayDuration:0,children:c.jsxs("div",{className:"relative h-[36px] w-full",children:[c.jsx("div",{className:"absolute left-[0px] z-[20] h-[17px] w-[6px] bg-white",children:c.jsx("div",{className:"mt-[11px] h-[6px] w-[6px] rounded-tl-md bg-slate-50"})}),c.jsx("div",{className:"absolute right-[0px] top-[11px] z-[20] h-[6px] w-[6px] bg-white",children:c.jsx("div",{className:"h-[6px] w-[6px] rounded-tr-md bg-slate-50"})}),c.jsx("div",{className:"absolute inset-x-0 bottom-0 h-[25px] rounded-md bg-slate-50"}),c.jsx("div",{className:"absolute inset-x-0 bottom-0 h-[36px]",children:c.jsx("div",{ref:o,className:"h-full overflow-x-auto rounded-md",children:c.jsxs("div",{className:"ml-auto flex h-[36px] w-max items-end px-2 pb-0",children:[c.jsx("div",{className:"flex",children:h}),c.jsx("div",{className:"flex rounded-sm bg-blue-200",children:f})]})})}),c.jsx("div",{className:"pointer-events-none absolute bottom-0 left-0 z-10 h-[25px] w-2 rounded-l-md bg-slate-50"}),c.jsx("div",{className:"pointer-events-none absolute bottom-0 right-0 z-10 h-[25px] w-2 rounded-r-md bg-slate-50"})]})})};function Yg(e){const[t,n]=Ku(e),s=t?.header.revision.global??0,r=t?.header.revision.local??0,o=s>0||r>0,a=!!t?.clipboard.length;return{undo:()=>{n(Td())},redo:()=>{n(Md())},canUndo:o,canRedo:a}}function Kg(e){return[]}const jw=e=>{const{onClose:t,children:n,onExport:s,className:r,document:o,onSwitchboardLinkClick:a,enabledControls:i=["undo","redo","export","history"],defaultTimelineVisible:l=!0,disableRevisionHistory:u=!1,initialTimelineVisible:d=!1,...h}=e,[f]=Xu(),p=o??f,{onRenameNode:g,onRenameDriveNodes:m}=br(),y=p?.header.name||void 0,[v,x]=b.useState(!1),C=Ju(p?.header.id),N=t??(()=>xt(C)),w=async W=>{W&&(s?s(W):await nd(W))},j=Yg(p?.header.id),S=!j.canUndo,P=!j.canRedo,E=Kg(p?.header.id),[T,I]=b.useState(d),D=Zu(p),F=a??(D?async()=>{if(D)try{const W=await D();window.open(W,"_blank")}catch(W){console.error("Error opening switchboard link:",W)}}:void 0),_=!p,U=!F,H=E.length===0;b.useEffect(()=>{typeof d=="boolean"&&I(d)},[d]);const G=()=>{H||I(!T)};return c.jsxs("div",{className:"flex w-full flex-col",...h,children:[c.jsxs("div",{className:M("flex h-12 w-full items-center justify-between rounded-xl border border-gray-200 bg-slate-50 px-4",r),children:[c.jsxs("div",{className:"flex items-center gap-x-2",children:[i.includes("undo")&&c.jsx("button",{className:M("grid size-8 place-items-center rounded-lg border border-gray-200 bg-white",S?"cursor-not-allowed":"cursor-pointer active:opacity-70"),onClick:j.undo,disabled:S,children:c.jsx(O,{name:"ArrowCouterclockwise",size:16,className:S?"text-gray-500":"text-gray-900"})}),i.includes("redo")&&c.jsx("button",{className:M("grid size-8 place-items-center rounded-lg border border-gray-200 bg-white",P?"cursor-not-allowed":"cursor-pointer active:opacity-70"),onClick:j.redo,disabled:P,children:c.jsx("div",{className:"-scale-x-100",children:c.jsx(O,{name:"ArrowCouterclockwise",size:16,className:P?"text-gray-500":"text-gray-900"})})}),i.includes("export")&&c.jsx("button",{className:M("flex h-8 items-center rounded-lg border border-gray-200 bg-white px-3 text-sm",_?"cursor-not-allowed":"cursor-pointer active:opacity-70"),onClick:()=>void w(p),disabled:_,children:c.jsx("span",{className:_?"text-gray-500":"text-gray-900",children:"Export"})})]}),c.jsx("div",{className:"flex items-center",children:v&&p?c.jsx(Cr,{defaultValue:y,className:"text-center text-sm font-medium text-gray-500","aria-label":"Document name",onCancel:()=>x(!1),onSubmit:W=>{const ee={id:p.header.id};Promise.all([g(W,ee),m(W,p.header.id)]).then(()=>x(!1)).catch(re=>{console.error("Failed to rename document:",re),x(!1)})}}):c.jsx("h1",{className:M("text-sm font-medium text-gray-500",p&&"cursor-pointer hover:text-gray-700"),onDoubleClick:p?()=>x(!0):void 0,title:p?"Double-click to edit":void 0,children:y})}),c.jsxs("div",{className:"flex items-center gap-x-2",children:[!U&&c.jsx("button",{className:M("grid size-8 place-items-center rounded-lg border border-gray-200 bg-white","cursor-pointer active:opacity-70"),onClick:F,disabled:U,children:c.jsx(O,{name:"Drive",size:16,className:"text-gray-900"})}),i.includes("history")&&c.jsx("button",{className:M("grid size-8 place-items-center rounded-lg border border-gray-200 bg-white",u?"cursor-not-allowed":"cursor-pointer active:opacity-70"),onClick:ed,disabled:u,children:c.jsx(O,{name:"History",size:16,className:u?"text-gray-500":"text-gray-900"})}),i.includes("timeline")&&l&&c.jsx("button",{className:M("grid size-8 place-items-center rounded-lg border border-gray-200 bg-white",H?"cursor-not-allowed":"cursor-pointer active:opacity-70"),onClick:G,disabled:H,"aria-pressed":T,children:c.jsx(O,{name:"Timeline",size:16,className:M("text-gray-900",H&&"opacity-50",T&&"text-blue-600")})}),c.jsx("button",{"aria-label":"Close document",className:"grid size-8 cursor-pointer place-items-center rounded-lg border border-gray-200 bg-white active:opacity-70",onClick:N,children:c.jsx(O,{name:"XmarkLight",size:16,className:"text-gray-900"})})]})]}),T&&c.jsx("div",{className:"mt-2 w-full",children:c.jsx(Qg,{timeline:E,onItemClick:td})}),n]})};function dl(e){const{target:t,onAddFileOverride:n,trackNestedDrag:s=!1,acceptedFileExtensions:r}=e??{},[o,a]=b.useState(!1),i=b.useRef(0),{onMoveNode:l,onCopyNode:u,onAddFile:d}=br(),h=n??d,f=b.useCallback(x=>{if(!r||r.length===0||x.types.includes("UI_NODE"))return!0;if(x.types.includes("Files")){const C=Array.from(x.items);return C.length===0?!0:C.some(N=>{if(N.kind==="file"){if(N.type==="application/zip"||N.type==="application/x-zip-compressed")return r.includes(".zip");if(N.type===""||N.type==="application/octet-stream")return!0}return!1})}return!1},[r]),p=b.useCallback(x=>{x.preventDefault(),x.stopPropagation(),f(x.dataTransfer)?a(!0):x.dataTransfer.dropEffect="none"},[f]),g=b.useCallback(x=>{x.preventDefault(),x.stopPropagation(),f(x.dataTransfer)&&(i.current+=1,a(!0))},[f]),m=b.useCallback(x=>{x.preventDefault(),x.stopPropagation(),i.current=Math.max(0,i.current-1),i.current===0&&a(!1)},[]),y=b.useCallback(()=>{a(!1)},[]),v=b.useCallback(async x=>{x.preventDefault();const N=x.target.closest("[data-drop-zone]"),w=t?.id||"root";if((N?.getAttribute("data-drop-zone")||"root")!==w){a(!1);return}try{let S=Xg(x.dataTransfer.items).filter(Boolean);if(r&&r.length>0&&(S=S.filter(I=>{if(!I)return!1;const D=I.name.toLowerCase();return r.some(R=>D.endsWith(R.toLowerCase()))})),S.length){for(const I of S)I&&await h(I,t);return}const P=x.getModifierState("Alt"),E=x.dataTransfer.getData("UI_NODE"),T=JSON.parse(E);P?await u(T,t):await l(T,t)}catch(S){console.error(S)}finally{s&&(i.current=0),a(!1)}},[h,u,l,t,s]);return b.useMemo(()=>{const x={onDragOver:p,onDrop:v,"data-drop-zone":t?.id||"root"};return s?(x.onDragEnter=g,x.onDragLeave=m):x.onDragLeave=y,{isDropTarget:o,dropProps:x}},[o,t?.id,g,m,y,p,v,s])}function Xg(e){return Array.from(e).map(n=>n.kind==="file"?n.getAsFile():null).filter(Boolean)}const Aa="min-h-[48px] min-w-[142px] text-base font-semibold py-3 px-6 rounded-xl outline-none active:opacity-75 hover:scale-105 transform transition-all";function Jg(e){const{title:t="Document Already Exists",fileName:n,message:s,children:r,onReplace:o,onOpenChange:a,onDuplicate:i,replaceLabel:l="Replace",duplicateLabel:u="Create Copy",overlayProps:d,contentProps:h,bodyProps:f={},headerProps:p={},containerProps:g={},replaceButtonProps:m={},duplicateButtonProps:y={},buttonContainerProps:v={},...x}=e,C=n?`A document named "${n}" already exists in this location. Would you like to replace it or create a copy?`:"A document with the same name already exists in this location. Would you like to replace it or create a copy?";return c.jsx(_e,{contentProps:{...h,className:M("rounded-3xl",h?.className)},onOpenChange:a,overlayProps:{...d,className:d?.className},...x,children:c.jsxs("div",{...ce(g,"w-[450px] p-6 text-slate-300"),children:[c.jsxs("div",{className:"flex items-center justify-between border-b border-slate-50 pb-2",children:[c.jsx("div",{...ce(p,"text-2xl font-bold text-gray-800"),children:t}),c.jsx("button",{type:"button",className:"flex size-6 items-center justify-center rounded-md outline-none hover:bg-slate-100",onClick:()=>a?.(!1),children:c.jsx(O,{name:"XmarkLight",size:24})})]}),c.jsxs("div",{...ce(f,"my-6 rounded-md bg-slate-50 p-4 text-center"),children:[s||C,r]}),c.jsxs("div",{...ce(v,"mt-8 flex justify-between gap-3"),children:[c.jsx("button",{onClick:o,...ce(m,M(Aa,"flex-1 bg-slate-50 text-slate-800")),children:l}),c.jsx("button",{onClick:i,...ce(y,M(Aa,"flex-1 bg-gray-800 text-gray-50")),children:u})]})]})})}function Zg(e){const{status:t,errorDetails:n}=e;return(t==="failed"||t==="unsupported-document-type")&&n?c.jsx("div",{className:"break-words text-xs leading-[18px] text-gray-500",children:n}):null}function eb(e){switch(e){case"analytics-processor":return"AnalyticsProcessorModule";case"relational-processor":return"RelationalProcessorModule";case"codegen-processor":return"CodegenProcessorModule";case"app":return"AppModule";case"document-model":return"DocumentModelModule";case"editor":return"EditorModule";case"package":return"PackageModule";case"subgraph":return"SubgraphModule";default:return"PowerhouseDocumentModule"}}function tb(e){const{fileName:t,fileSize:n,documentType:s,onClose:r,...o}=e;return c.jsxs("div",{className:"flex items-center gap-2",...o,children:[c.jsx("div",{className:"flex h-9 w-7 flex-shrink-0 items-center justify-center",children:c.jsx(O,{name:eb(s),size:48,className:"text-gray-600"})}),c.jsxs("div",{className:"flex flex-1 flex-col gap-0.5",children:[c.jsx("div",{className:"text-xs font-medium leading-[18px] text-gray-900",children:t}),c.jsx("div",{className:"text-xs font-medium leading-[18px] text-gray-500",children:n})]}),r&&c.jsx("div",{className:"flex h-9 w-[18px] flex-shrink-0 items-start justify-center",children:c.jsx("button",{type:"button",onClick:r,className:"flex h-[18px] w-[18px] items-center justify-center text-gray-600 hover:text-gray-800","aria-label":"Close",children:c.jsx(O,{name:"XmarkLight",size:18})})})]})}function nb(e){const{status:t,progress:n=0}=e;if(t!=="uploading")return null;const s=Math.min(100,Math.max(0,n));return c.jsx("div",{className:"h-2 w-full overflow-hidden rounded-sm bg-gray-200",children:c.jsx("div",{className:"h-full bg-blue-900 transition-all duration-300 ease-out",style:{width:`${s}%`}})})}function rb(e){switch(e){case"success":return"Upload successful";case"failed":return"Upload failed";case"unsupported-document-type":return"Document not supported by this drive";case"pending":return"Pending resolution";case"conflict":return"Pending Resolution";case"uploading":return"Uploading...";default:return""}}function sb(e){switch(e){case"success":return"text-green-700";case"failed":case"unsupported-document-type":case"pending":case"conflict":return"text-red-900";case"uploading":return"text-gray-900";default:return"text-gray-900"}}function ob(e,t,n){return e==="success"&&!!t||e==="pending"&&!!n||e==="conflict"&&!!n}function ab(e){return e==="success"?"Open Document":e==="pending"||e==="conflict"?"Find resolution":""}function ib(e){const{status:t,progress:n=0,onOpenDocument:s,onFindResolution:r}=e,o=()=>{t==="success"&&s?s():(t==="pending"||t==="conflict")&&r&&r()};return c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("div",{className:M("text-xs leading-[18px]",sb(t)),children:rb(t)}),t==="uploading"&&c.jsxs("div",{className:"text-xs font-medium leading-[18px] text-gray-900",children:[Math.round(n),"%"]}),ob(t,s,r)&&c.jsx("button",{type:"button",onClick:o,className:"text-xs leading-[18px] text-blue-900 hover:opacity-80",children:ab(t)})]})}const cb=b.forwardRef(function(t,n){const{fileName:s,fileSize:r,status:o,documentType:a,progress:i=0,errorDetails:l,onClose:u,onOpenDocument:d,onFindResolution:h,className:f,...p}=t;return c.jsxs("div",{ref:n,className:M("flex w-full flex-col gap-0.5 rounded-md border border-gray-100 bg-white p-2 shadow-[0_2px_12px_rgba(37,42,52,0.1)]",f),...p,children:[c.jsx(tb,{fileName:s,fileSize:r,documentType:a,onClose:u}),c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx(ib,{status:o,progress:i,onOpenDocument:d,onFindResolution:h}),c.jsx(nb,{status:o,progress:i}),c.jsx(Zg,{status:o,errorDetails:l})]})]})});function lb(e,t){return t||`Uploading ${e} document${e===1?"":"s"}`}function ub(e){const{items:t,title:n,defaultCollapsed:s=!1,onClose:r,className:o,...a}=e,[i,l]=b.useState(s),u=b.useMemo(()=>lb(t.length,n),[t.length,n]);return c.jsxs("div",{className:M("w-[358px] rounded-md border border-gray-100 bg-gray-50 p-4 shadow-[1px_4px_15px_rgba(74,88,115,0.25)]",o),...a,children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("button",{type:"button","aria-expanded":!i,"aria-label":i?"Expand list":"Collapse list",onClick:()=>l(d=>!d),className:"min-w-0 flex-1 text-left text-sm font-medium leading-4 text-gray-900 hover:opacity-80",children:u}),c.jsxs("div",{className:"flex shrink-0 items-center gap-4",children:[c.jsx("button",{type:"button","aria-label":i?"Expand":"Collapse",onClick:()=>l(d=>!d),className:"text-gray-900 hover:opacity-80",children:c.jsx("span",{className:M("inline-block h-4 w-4 select-none transition-transform",i?"-rotate-90":"rotate-0"),children:c.jsx(O,{name:"CaretDown",size:16,"aria-hidden":"true"})})}),r&&c.jsx("button",{type:"button","aria-label":"Close",onClick:r,className:"text-gray-900 hover:opacity-80",children:c.jsx("span",{className:"inline-block h-4 w-4 select-none",children:c.jsx(O,{name:"XmarkLight",size:16,"aria-hidden":"true"})})})]})]}),!i&&c.jsx("div",{className:"mt-4 flex max-h-[404px] flex-col gap-4 overflow-y-auto overflow-x-visible px-2 py-2",children:t.map((d,h)=>c.jsx(cb,{...d},`${d.fileName}-${h}`))})]})}function db(){return`upload_${Date.now()}_${Math.random().toString(36).substring(2,9)}`}function fb(e){if(e===0)return"0 Bytes";const t=1024,n=["Bytes","KB","MB","GB"],s=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,s)).toFixed(2))} ${n[s]}`}function hb(e){switch(e){case"loading":case"initializing":return"pending";case"uploading":return"uploading";case"complete":return"success";case"failed":return"failed";case"conflict":return"conflict";case"unsupported-document-type":return"unsupported-document-type";default:return"pending"}}function pb(e,t,n,s){return e.filter(r=>r!==void 0).map(r=>({fileName:r.fileName,fileSize:r.fileSize,status:r.status,progress:r.progress,errorDetails:r.errorDetails,documentType:r.documentType,onClose:()=>{t(r.id)},onOpenDocument:r.status==="success"?()=>{r.fileNode&&n?n(r.fileNode):console.error("Opening document for upload:",r.id,"- fileNode not available or setSelectedNode not provided")}:void 0,onFindResolution:r.status==="failed"?()=>{console.log("Finding resolution for upload:",r.id)}:r.status==="conflict"?()=>{console.log("Finding conflict resolution for upload:",r.id),s?.(r.id)}:void 0}))}function mb(e){const{uploadsArray:t,uploadsCount:n,removeUpload:s,clearAllUploads:r,setSelectedNode:o,onClose:a,onConflictResolution:i,className:l,...u}=e;if(n===0)return null;const d=pb(t,s,o,i),h=a??r;return c.jsx("div",{className:M("fixed bottom-4 right-4 z-[1001]",l),...u,children:c.jsx(ub,{items:d,onClose:h})})}function gb(e,t){switch(t.type){case"ADD_UPLOAD":return{...e,[t.payload.id]:{id:t.payload.id,fileName:t.payload.fileName,fileSize:t.payload.fileSize,status:"pending",progress:0,fileNode:void 0}};case"UPDATE_PROGRESS":{const n=e[t.payload.id];return n?{...e,[t.payload.id]:{...n,status:hb(t.payload.progress.stage),progress:t.payload.progress.progress,errorDetails:t.payload.progress.error,...t.payload.progress.documentType&&{documentType:t.payload.progress.documentType},...t.payload.progress.duplicateType&&{duplicateType:t.payload.progress.duplicateType}}}:e}case"SET_FILE_NODE":{const n=e[t.payload.id];return n?{...e,[t.payload.id]:{...n,fileNode:t.payload.fileNode}}:e}case"SET_ERROR":{const n=e[t.payload.id];return n?{...e,[t.payload.id]:{...n,status:n.status||"failed",errorDetails:t.payload.error}}:e}case"REMOVE_UPLOAD":{const{[t.payload.id]:n,...s}=e;return s}case"CLEAR_ALL_UPLOADS":return{};case"SET_CONFLICT_DATA":{const n=e[t.payload.id];return n?{...e,[t.payload.id]:{...n,file:t.payload.file,parentNode:t.payload.parentNode}}:e}case"CLEAR_CONFLICTED_UPLOADS":{const n={};for(const[s,r]of Object.entries(e))r&&r.status!=="conflict"&&(n[s]=r);return n}default:return e}}function bb(e=!1,t){const n=b.useCallback(()=>{if(e&&t)try{const f=localStorage.getItem(`uploadTracker_${t}`);return f?JSON.parse(f):{}}catch(f){return console.error("Failed to load upload tracker from localStorage:",f),{}}return{}},[e,t]),[s,r]=b.useReducer(gb,n());b.useEffect(()=>{if(e&&t)try{localStorage.setItem(`uploadTracker_${t}`,JSON.stringify(s))}catch(f){console.error("Failed to save upload tracker to localStorage:",f)}},[s,e,t]);const o=b.useCallback(f=>{if(f)return async(p,g)=>{const m=db();r({type:"ADD_UPLOAD",payload:{id:m,fileName:p.name,fileSize:fb(p.size)}});const y=v=>{r({type:"UPDATE_PROGRESS",payload:{id:m,progress:v}}),v.stage==="conflict"&&r({type:"SET_CONFLICT_DATA",payload:{id:m,file:p,parentNode:g}})};try{const v=await f(p,g,y);r({type:"SET_FILE_NODE",payload:{id:m,fileNode:v||void 0}})}catch(v){r({type:"SET_ERROR",payload:{id:m,error:v instanceof Error?v.message:"Unknown error"}})}}},[]),a=b.useCallback(f=>{r({type:"REMOVE_UPLOAD",payload:{id:f}})},[]),i=b.useCallback(()=>{r({type:"CLEAR_ALL_UPLOADS"})},[]),l=b.useCallback(()=>{r({type:"CLEAR_CONFLICTED_UPLOADS"})},[]),u=b.useCallback(()=>Object.values(s),[s]),d=b.useCallback(()=>Object.keys(s).length,[s]),h=b.useCallback((f,p,g)=>{const m=s[f];if(!m?.file||!g){console.error("Cannot resolve conflict: missing upload data or onAddFile function");return}const y=x=>{r({type:"UPDATE_PROGRESS",payload:{id:f,progress:x}})},v=g(m.file,m.parentNode,y,p);Promise.resolve(v).then(x=>{x&&r({type:"SET_FILE_NODE",payload:{id:f,fileNode:x}})}).catch(x=>{r({type:"SET_ERROR",payload:{id:f,error:x instanceof Error?x.message:"Unknown error"}})})},[s]);return{uploads:s,uploadsArray:u(),uploadsCount:d(),createUploadHandler:o,removeUpload:a,clearAllUploads:i,clearConflictedUploads:l,resolveConflict:h}}function yb(e){const{title:t="Drag your documents",subtitle:n="to drop them in the currently selected folder.",node:s,enable:r=!0,children:o,onAddFile:a,useLocalStorage:i=!1,driveId:l,acceptedFileExtensions:u=[".zip",".phd",".phdm"],className:d,...h}=e,[f,p]=b.useState(!1),[g,m]=b.useState(null),{uploadsArray:y,uploadsCount:v,createUploadHandler:x,clearAllUploads:C,clearConflictedUploads:N,removeUpload:w,resolveConflict:j}=bb(i,l);b.useEffect(()=>{N()},[]);const S=x(a)??(async()=>{}),P=F=>{m(F),p(!0)},E=()=>{g&&a&&j(g,"replace",a),p(!1),m(null)},T=()=>{g&&a&&j(g,"duplicate",a),p(!1),m(null)},I=()=>{p(!1),m(null)},{isDropTarget:D,dropProps:R}=dl({target:s,onAddFileOverride:S,trackNestedDrag:!0,acceptedFileExtensions:u});return c.jsxs("div",{className:M("relative",d),...r?R:{},...h,children:[o,r&&D&&c.jsx("div",{className:"fixed inset-0 z-[1000] flex min-h-screen w-screen items-center justify-center bg-black/50",children:c.jsx("div",{className:"rounded-[24px] bg-white p-6 shadow-[1px_4px_15px_rgba(74,88,115,0.25)]",children:c.jsxs("div",{className:"relative flex h-[130px] w-[400px] flex-col items-center justify-start overflow-visible rounded-lg border border-dashed border-black px-4 py-6",children:[c.jsx("div",{className:"text-center text-base leading-5 text-zinc-500",children:t}),c.jsx("div",{className:"text-center text-base leading-5 text-zinc-500",children:n}),c.jsx("span",{className:"pointer-events-none absolute -bottom-16 left-1/2 z-10 -translate-x-1/2",children:c.jsx(O,{name:"DocumentIcons",size:144,"aria-hidden":"true"})})]})})}),c.jsx(mb,{uploadsArray:y,uploadsCount:v,removeUpload:w,clearAllUploads:C,setSelectedNode:xt,onConflictResolution:P}),c.jsx(Jg,{open:f,onOpenChange:I,fileName:g?y.find(F=>F?.id===g)?.fileName:void 0,onReplace:E,onDuplicate:T})]})}function Pw({children:e,...t}){const n=rd(),s=Fi(),r=sd(),o=async(a,i,l,u)=>await r(a,l,u);return!n||!s?c.jsx(c.Fragment,{children:e}):c.jsx(yb,{onAddFile:o,driveId:s,useLocalStorage:!0,...t,children:e})}function Ir(e){const{children:t,items:n,open:s,onItemClick:r,onOpenChange:o,menuClassName:a}=e;return c.jsxs(xd,{onOpenChange:o,open:s,children:[c.jsx(wd,{asChild:!0,className:"outline-none",children:t}),c.jsx(Cd,{className:M("modal-shadow cursor-pointer rounded-2xl bg-white text-sm font-medium text-slate-500",a),children:n.map(({id:i,label:l,icon:u,className:d})=>c.jsxs(Sd,{className:M("flex items-center px-5 py-2 outline-none first-of-type:rounded-t-2xl first-of-type:pt-3 last-of-type:rounded-b-2xl last-of-type:pb-3 hover:bg-slate-50",d),onClick:h=>h.stopPropagation(),onSelect:()=>r(i),children:[u?c.jsx("span",{className:"mr-2 inline-block",children:u}):null,l]},i))})]})}const La=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],ys=[{name:"query",type:"function",stateMutability:"view",inputs:[{type:"tuple[]",name:"queries",components:[{type:"address",name:"sender"},{type:"string[]",name:"urls"},{type:"bytes",name:"data"}]}],outputs:[{type:"bool[]",name:"failures"},{type:"bytes[]",name:"responses"}]},{name:"HttpError",type:"error",inputs:[{type:"uint16",name:"status"},{type:"string",name:"message"}]}],fl=[{inputs:[{name:"dns",type:"bytes"}],name:"DNSDecodingFailed",type:"error"},{inputs:[{name:"ens",type:"string"}],name:"DNSEncodingFailed",type:"error"},{inputs:[],name:"EmptyAddress",type:"error"},{inputs:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"HttpError",type:"error"},{inputs:[],name:"InvalidBatchGatewayResponse",type:"error"},{inputs:[{name:"errorData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{name:"name",type:"bytes"},{name:"resolver",type:"address"}],name:"ResolverNotContract",type:"error"},{inputs:[{name:"name",type:"bytes"}],name:"ResolverNotFound",type:"error"},{inputs:[{name:"primary",type:"string"},{name:"primaryAddress",type:"bytes"}],name:"ReverseAddressMismatch",type:"error"},{inputs:[{internalType:"bytes4",name:"selector",type:"bytes4"}],name:"UnsupportedResolverProfile",type:"error"}],vb=[...fl,{name:"resolveWithGateways",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],xb=[...fl,{name:"reverseWithGateways",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"uint256",name:"coinType"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolver"},{type:"address",name:"reverseResolver"}]}],Fa=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}];function Ye(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new Db(e.type);return`${e.name}(${po(e.inputs,{includeName:t})})`}function po(e,{includeName:t=!1}={}){return e?e.map(n=>wb(n,{includeName:t})).join(t?", ":","):""}function wb(e,{includeName:t}){return e.type.startsWith("tuple")?`(${po(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function ut(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function fe(e){return ut(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const hl="2.38.6";let qr={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${hl}`},k=class vs extends Error{constructor(t,n={}){const s=n.cause instanceof vs?n.cause.details:n.cause?.message?n.cause.message:n.details,r=n.cause instanceof vs&&n.cause.docsPath||n.docsPath,o=qr.getDocsUrl?.({...n,docsPath:r}),a=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...o?[`Docs: ${o}`]:[],...s?[`Details: ${s}`]:[],...qr.version?[`Version: ${qr.version}`]:[]].join(`
9
+ `);super(a,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=s,this.docsPath=r,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=hl}walk(t){return pl(this,t)}};function pl(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?pl(e.cause,t):t?null:e}class Cb extends k{constructor({docsPath:t}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
10
10
  `),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class $a extends k{constructor({docsPath:t}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(`
11
- `),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}}class bb extends k{constructor({data:t,params:n,size:s}){super([`Data size of ${s} bytes is too small for given parameters.`].join(`
12
- `),{metaMessages:[`Params: (${ho(n,{includeName:!0})})`,`Data: ${t} (${s} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t,this.params=n,this.size=s}}class po extends k{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class yb extends k{constructor({expectedLength:t,givenLength:n,type:s}){super([`ABI encoding array length mismatch for type ${s}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
13
- `),{name:"AbiEncodingArrayLengthMismatchError"})}}class vb extends k{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${fe(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class xb extends k{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
14
- `),{name:"AbiEncodingLengthMismatchError"})}}class wb extends k{constructor(t,{docsPath:n}){super([`Arguments (\`args\`) were provided to "${t}", but "${t}" on the ABI does not contain any parameters (\`inputs\`).`,"Cannot encode error result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the inputs exist on it."].join(`
11
+ `),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}}class Sb extends k{constructor({data:t,params:n,size:s}){super([`Data size of ${s} bytes is too small for given parameters.`].join(`
12
+ `),{metaMessages:[`Params: (${po(n,{includeName:!0})})`,`Data: ${t} (${s} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t,this.params=n,this.size=s}}class mo extends k{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class jb extends k{constructor({expectedLength:t,givenLength:n,type:s}){super([`ABI encoding array length mismatch for type ${s}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
13
+ `),{name:"AbiEncodingArrayLengthMismatchError"})}}class Pb extends k{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${fe(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class Nb extends k{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
14
+ `),{name:"AbiEncodingLengthMismatchError"})}}class Eb extends k{constructor(t,{docsPath:n}){super([`Arguments (\`args\`) were provided to "${t}", but "${t}" on the ABI does not contain any parameters (\`inputs\`).`,"Cannot encode error result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the inputs exist on it."].join(`
15
15
  `),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}}class za extends k{constructor(t,{docsPath:n}={}){super([`Error ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it."].join(`
16
- `),{docsPath:n,name:"AbiErrorNotFoundError"})}}class sl extends k{constructor(t,{docsPath:n}){super([`Encoded error signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
16
+ `),{docsPath:n,name:"AbiErrorNotFoundError"})}}class ml extends k{constructor(t,{docsPath:n}){super([`Encoded error signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
17
17
  `),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}}class St extends k{constructor(t,{docsPath:n}={}){super([`Function ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(`
18
- `),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class ol extends k{constructor(t,{docsPath:n}){super([`Function "${t}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(`
19
- `),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class Cb extends k{constructor(t,{docsPath:n}){super([`Encoded function signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
20
- `),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class Sb extends k{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${Ye(t.abiItem)}\`, and`,`\`${n.type}\` in \`${Ye(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class jb extends k{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
21
- `),{docsPath:n,name:"InvalidAbiEncodingType"})}}class Pb extends k{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
22
- `),{docsPath:n,name:"InvalidAbiDecodingType"})}}class al extends k{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
23
- `),{name:"InvalidArrayError"})}}class Eb extends k{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
24
- `),{name:"InvalidDefinitionTypeError"})}}class ot extends k{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class il extends k{constructor({offset:t,position:n,size:s}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${s}).`,{name:"SliceOffsetOutOfBoundsError"})}}let cl=class extends k{constructor({size:t,targetSize:n,type:s}){super(`${s.charAt(0).toUpperCase()}${s.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}};class _a extends k{constructor({size:t,targetSize:n,type:s}){super(`${s.charAt(0).toUpperCase()}${s.slice(1).toLowerCase()} is expected to be ${n} ${s} long, but is ${t} ${s} long.`,{name:"InvalidBytesLengthError"})}}function Ot(e,{dir:t,size:n=32}={}){return typeof e=="string"?qe(e,{dir:t,size:n}):Nb(e,{dir:t,size:n})}function qe(e,{dir:t,size:n=32}={}){if(n===null)return e;const s=e.replace("0x","");if(s.length>n*2)throw new cl({size:Math.ceil(s.length/2),targetSize:n,type:"hex"});return`0x${s[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function Nb(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new cl({size:e.length,targetSize:n,type:"bytes"});const s=new Uint8Array(n);for(let r=0;r<n;r++){const o=t==="right";s[o?r:n-r-1]=e[o?r:e.length-r-1]}return s}let ll=class extends k{constructor({max:t,min:n,signed:s,size:r,value:o}){super(`Number "${o}" is not in safe ${r?`${r*8}-bit ${s?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}};class Ob extends k{constructor(t){super(`Bytes value "${t}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}}class Ib extends k{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function mo(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,s=0;for(let r=0;r<n.length-1&&n[t==="left"?r:n.length-r-1].toString()==="0";r++)s++;return n=t==="left"?n.slice(s):n.slice(0,n.length-s),typeof e=="string"?(n.length===1&&t==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}function ke(e,{size:t}){if(fe(e)>t)throw new Ib({givenSize:fe(e),maxSize:t})}function ul(e,t={}){const{signed:n}=t;t.size&&ke(e,{size:t.size});const s=BigInt(e);if(!n)return s;const r=(e.length-2)/2,o=(1n<<BigInt(r)*8n-1n)-1n;return s<=o?s:s-BigInt(`0x${"f".padStart(r*2,"f")}`)-1n}function Mb(e,t={}){return Number(ul(e,t))}const Tb=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function dl(e,t={}){return typeof e=="number"||typeof e=="bigint"?J(e,t):typeof e=="string"?go(e,t):typeof e=="boolean"?fl(e,t):Ce(e,t)}function fl(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(ke(n,{size:t.size}),Ot(n,{size:t.size})):n}function Ce(e,t={}){let n="";for(let r=0;r<e.length;r++)n+=Tb[e[r]];const s=`0x${n}`;return typeof t.size=="number"?(ke(s,{size:t.size}),Ot(s,{dir:"right",size:t.size})):s}function J(e,t={}){const{signed:n,size:s}=t,r=BigInt(e);let o;s?n?o=(1n<<BigInt(s)*8n-1n)-1n:o=2n**(BigInt(s)*8n)-1n:typeof e=="number"&&(o=BigInt(Number.MAX_SAFE_INTEGER));const a=typeof o=="bigint"&&n?-o-1n:0;if(o&&r>o||r<a){const l=typeof e=="bigint"?"n":"";throw new ll({max:o?`${o}${l}`:void 0,min:`${a}${l}`,signed:n,size:s,value:`${e}${l}`})}const i=`0x${(n&&r<0?(1n<<BigInt(s*8))+BigInt(r):r).toString(16)}`;return s?Ot(i,{size:s}):i}const Db=new TextEncoder;function go(e,t={}){const n=Db.encode(e);return Ce(n,t)}const kb=new TextEncoder;function bo(e,t={}){return typeof e=="number"||typeof e=="bigint"?Ab(e,t):typeof e=="boolean"?Rb(e,t):ut(e)?yo(e,t):et(e,t)}function Rb(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(ke(n,{size:t.size}),Ot(n,{size:t.size})):n}const Re={zero:48,nine:57,A:65,F:70,a:97,f:102};function Ua(e){if(e>=Re.zero&&e<=Re.nine)return e-Re.zero;if(e>=Re.A&&e<=Re.F)return e-(Re.A-10);if(e>=Re.a&&e<=Re.f)return e-(Re.a-10)}function yo(e,t={}){let n=e;t.size&&(ke(n,{size:t.size}),n=Ot(n,{dir:"right",size:t.size}));let s=n.slice(2);s.length%2&&(s=`0${s}`);const r=s.length/2,o=new Uint8Array(r);for(let a=0,i=0;a<r;a++){const l=Ua(s.charCodeAt(i++)),u=Ua(s.charCodeAt(i++));if(l===void 0||u===void 0)throw new k(`Invalid byte sequence ("${s[i-2]}${s[i-1]}" in "${s}").`);o[a]=l*16+u}return o}function Ab(e,t){const n=J(e,t);return yo(n)}function et(e,t={}){const n=kb.encode(e);return typeof t.size=="number"?(ke(n,{size:t.size}),Ot(n,{dir:"right",size:t.size})):n}function Wt(e,t){const n=t||"hex",s=od(ut(e,{strict:!1})?bo(e):e);return n==="bytes"?s:dl(s)}class vo extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const s=this.keys().next().value;s&&this.delete(s)}return this}}const Lb=/^0x[a-fA-F0-9]{40}$/,Wr=new vo(8192);function De(e,t){const{strict:n=!0}=t??{},s=`${e}.${n}`;if(Wr.has(s))return Wr.get(s);const r=Lb.test(e)?e.toLowerCase()===e?!0:n?xo(e)===e:!0:!1;return Wr.set(s,r),r}const qr=new vo(8192);function xo(e,t){if(qr.has(`${e}.${t}`))return qr.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),s=Wt(et(n),"bytes"),r=n.split("");for(let a=0;a<40;a+=2)s[a>>1]>>4>=8&&r[a]&&(r[a]=r[a].toUpperCase()),(s[a>>1]&15)>=8&&r[a+1]&&(r[a+1]=r[a+1].toUpperCase());const o=`0x${r.join("")}`;return qr.set(`${e}.${t}`,o),o}function Rn(e,t){if(!De(e,{strict:!1}))throw new ot({address:e});return xo(e,t)}class Va extends k{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class Fb extends k{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}}class $b extends k{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}const zb={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new $b({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Fb({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Va({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new Va({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function _b(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(zb);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function jt(e,t,n,{strict:s}={}){return ut(e,{strict:!1})?Ub(e,t,n,{strict:s}):ml(e,t,n,{strict:s})}function hl(e,t){if(typeof t=="number"&&t>0&&t>fe(e)-1)throw new il({offset:t,position:"start",size:fe(e)})}function pl(e,t,n){if(typeof t=="number"&&typeof n=="number"&&fe(e)!==n-t)throw new il({offset:n,position:"end",size:fe(e)})}function ml(e,t,n,{strict:s}={}){hl(e,t);const r=e.slice(t,n);return s&&pl(r,t,n),r}function Ub(e,t,n,{strict:s}={}){hl(e,t);const r=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return s&&pl(r,t,n),r}function Vb(e,t={}){typeof t.size<"u"&&ke(e,{size:t.size});const n=Ce(e,t);return ul(n,t)}function Bb(e,t={}){let n=e;if(typeof t.size<"u"&&(ke(n,{size:t.size}),n=mo(n)),n.length>1||n[0]>1)throw new Ob(n);return!!n[0]}function ze(e,t={}){typeof t.size<"u"&&ke(e,{size:t.size});const n=Ce(e,t);return Mb(n,t)}function Hb(e,t={}){let n=e;return typeof t.size<"u"&&(ke(n,{size:t.size}),n=mo(n,{dir:"right"})),new TextDecoder().decode(n)}function Ke(e){return typeof e[0]=="string"?Nr(e):Wb(e)}function Wb(e){let t=0;for(const r of e)t+=r.length;const n=new Uint8Array(t);let s=0;for(const r of e)n.set(r,s),s+=r.length;return n}function Nr(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}const qb=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function xn(e,t){if(e.length!==t.length)throw new xb({expectedLength:e.length,givenLength:t.length});const n=Gb({params:e,values:t}),s=Co(n);return s.length===0?"0x":s}function Gb({params:e,values:t}){const n=[];for(let s=0;s<e.length;s++)n.push(wo({param:e[s],value:t[s]}));return n}function wo({param:e,value:t}){const n=So(e.type);if(n){const[s,r]=n;return Yb(t,{length:s,param:{...e,type:r}})}if(e.type==="tuple")return e1(t,{param:e});if(e.type==="address")return Qb(t);if(e.type==="bool")return Xb(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const s=e.type.startsWith("int"),[,,r="256"]=qb.exec(e.type)??[];return Jb(t,{signed:s,size:Number(r)})}if(e.type.startsWith("bytes"))return Kb(t,{param:e});if(e.type==="string")return Zb(t);throw new jb(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Co(e){let t=0;for(let o=0;o<e.length;o++){const{dynamic:a,encoded:i}=e[o];a?t+=32:t+=fe(i)}const n=[],s=[];let r=0;for(let o=0;o<e.length;o++){const{dynamic:a,encoded:i}=e[o];a?(n.push(J(t+r,{size:32})),s.push(i),r+=fe(i)):n.push(i)}return Ke([...n,...s])}function Qb(e){if(!De(e))throw new ot({address:e});return{dynamic:!1,encoded:qe(e.toLowerCase())}}function Yb(e,{length:t,param:n}){const s=t===null;if(!Array.isArray(e))throw new al(e);if(!s&&e.length!==t)throw new yb({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let r=!1;const o=[];for(let a=0;a<e.length;a++){const i=wo({param:n,value:e[a]});i.dynamic&&(r=!0),o.push(i)}if(s||r){const a=Co(o);if(s){const i=J(o.length,{size:32});return{dynamic:!0,encoded:o.length>0?Ke([i,a]):i}}if(r)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:Ke(o.map(({encoded:a})=>a))}}function Kb(e,{param:t}){const[,n]=t.type.split("bytes"),s=fe(e);if(!n){let r=e;return s%32!==0&&(r=qe(r,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:Ke([qe(J(s,{size:32})),r])}}if(s!==Number.parseInt(n,10))throw new vb({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:qe(e,{dir:"right"})}}function Xb(e){if(typeof e!="boolean")throw new k(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:qe(fl(e))}}function Jb(e,{signed:t,size:n=256}){if(typeof n=="number"){const s=2n**(BigInt(n)-(t?1n:0n))-1n,r=t?-s-1n:0n;if(e>s||e<r)throw new ll({max:s.toString(),min:r.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:J(e,{size:32,signed:t})}}function Zb(e){const t=go(e),n=Math.ceil(fe(t)/32),s=[];for(let r=0;r<n;r++)s.push(qe(jt(t,r*32,(r+1)*32),{dir:"right"}));return{dynamic:!0,encoded:Ke([qe(J(fe(t),{size:32})),...s])}}function e1(e,{param:t}){let n=!1;const s=[];for(let r=0;r<t.components.length;r++){const o=t.components[r],a=Array.isArray(e)?r:o.name,i=wo({param:o,value:e[a]});s.push(i),i.dynamic&&(n=!0)}return{dynamic:n,encoded:n?Co(s):Ke(s.map(({encoded:r})=>r))}}function So(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function jo(e,t){const n=typeof t=="string"?yo(t):t,s=_b(n);if(fe(n)===0&&e.length>0)throw new po;if(fe(t)&&fe(t)<32)throw new bb({data:typeof t=="string"?t:Ce(t),params:e,size:fe(t)});let r=0;const o=[];for(let a=0;a<e.length;++a){const i=e[a];s.setPosition(r);const[l,u]=vt(s,i,{staticPosition:0});r+=u,o.push(l)}return o}function vt(e,t,{staticPosition:n}){const s=So(t.type);if(s){const[r,o]=s;return n1(e,{...t,type:o},{length:r,staticPosition:n})}if(t.type==="tuple")return a1(e,t,{staticPosition:n});if(t.type==="address")return t1(e);if(t.type==="bool")return r1(e);if(t.type.startsWith("bytes"))return s1(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return o1(e,t);if(t.type==="string")return i1(e,{staticPosition:n});throw new Pb(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const Ba=32,ys=32;function t1(e){const t=e.readBytes(32);return[xo(Ce(ml(t,-20))),32]}function n1(e,t,{length:n,staticPosition:s}){if(!n){const a=ze(e.readBytes(ys)),i=s+a,l=i+Ba;e.setPosition(i);const u=ze(e.readBytes(Ba)),d=qt(t);let h=0;const f=[];for(let p=0;p<u;++p){e.setPosition(l+(d?p*32:h));const[g,m]=vt(e,t,{staticPosition:l});h+=m,f.push(g)}return e.setPosition(s+32),[f,32]}if(qt(t)){const a=ze(e.readBytes(ys)),i=s+a,l=[];for(let u=0;u<n;++u){e.setPosition(i+u*32);const[d]=vt(e,t,{staticPosition:i});l.push(d)}return e.setPosition(s+32),[l,32]}let r=0;const o=[];for(let a=0;a<n;++a){const[i,l]=vt(e,t,{staticPosition:s+r});r+=l,o.push(i)}return[o,r]}function r1(e){return[Bb(e.readBytes(32),{size:32}),32]}function s1(e,t,{staticPosition:n}){const[s,r]=t.type.split("bytes");if(!r){const a=ze(e.readBytes(32));e.setPosition(n+a);const i=ze(e.readBytes(32));if(i===0)return e.setPosition(n+32),["0x",32];const l=e.readBytes(i);return e.setPosition(n+32),[Ce(l),32]}return[Ce(e.readBytes(Number.parseInt(r,10),32)),32]}function o1(e,t){const n=t.type.startsWith("int"),s=Number.parseInt(t.type.split("int")[1]||"256",10),r=e.readBytes(32);return[s>48?Vb(r,{signed:n}):ze(r,{signed:n}),32]}function a1(e,t,{staticPosition:n}){const s=t.components.length===0||t.components.some(({name:a})=>!a),r=s?[]:{};let o=0;if(qt(t)){const a=ze(e.readBytes(ys)),i=n+a;for(let l=0;l<t.components.length;++l){const u=t.components[l];e.setPosition(i+o);const[d,h]=vt(e,u,{staticPosition:i});o+=h,r[s?l:u?.name]=d}return e.setPosition(n+32),[r,32]}for(let a=0;a<t.components.length;++a){const i=t.components[a],[l,u]=vt(e,i,{staticPosition:n});r[s?a:i?.name]=l,o+=u}return[r,o]}function i1(e,{staticPosition:t}){const n=ze(e.readBytes(32)),s=t+n;e.setPosition(s);const r=ze(e.readBytes(32));if(r===0)return e.setPosition(t+32),["",32];const o=e.readBytes(r,32),a=Hb(mo(o));return e.setPosition(t+32),[a,32]}function qt(e){const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return e.components?.some(qt);const n=So(e.type);return!!(n&&qt({...e,type:n[1]}))}const c1=e=>Wt(bo(e));function l1(e){return c1(e)}const u1="1.1.0";let Se=class vs extends Error{constructor(t,n={}){const s=n.cause instanceof vs?n.cause.details:n.cause?.message?n.cause.message:n.details,r=n.cause instanceof vs&&n.cause.docsPath||n.docsPath,o=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...r?[`Docs: https://abitype.dev${r}`]:[],...s?[`Details: ${s}`]:[],`Version: abitype@${u1}`].join(`
25
- `);super(o),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=s,this.docsPath=r,this.metaMessages=n.metaMessages,this.shortMessage=t}};function Be(e,t){return e.exec(t)?.groups}const gl=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,bl=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,yl=/^\(.+?\).*?$/,Ha=/^tuple(?<array>(\[(\d*)\])*)$/;function xs(e){let t=e.type;if(Ha.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let r=0;r<n;r++){const o=e.components[r];t+=xs(o),r<n-1&&(t+=", ")}const s=Be(Ha,e.type);return t+=`)${s?.array??""}`,xs({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function Lt(e){let t="";const n=e.length;for(let s=0;s<n;s++){const r=e[s];t+=xs(r),s!==n-1&&(t+=", ")}return t}function d1(e){return e.type==="function"?`function ${e.name}(${Lt(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${e.outputs?.length?` returns (${Lt(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Lt(e.inputs)})`:e.type==="error"?`error ${e.name}(${Lt(e.inputs)})`:e.type==="constructor"?`constructor(${Lt(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const vl=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function f1(e){return vl.test(e)}function h1(e){return Be(vl,e)}const xl=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function p1(e){return xl.test(e)}function m1(e){return Be(xl,e)}const wl=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function g1(e){return wl.test(e)}function b1(e){return Be(wl,e)}const Cl=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function Sl(e){return Cl.test(e)}function y1(e){return Be(Cl,e)}const jl=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function v1(e){return jl.test(e)}function x1(e){return Be(jl,e)}const Pl=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function w1(e){return Pl.test(e)}function C1(e){return Be(Pl,e)}const S1=/^receive\(\) external payable$/;function j1(e){return S1.test(e)}const P1=new Set(["indexed"]),ws=new Set(["calldata","memory","storage"]);class E1 extends Se{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class N1 extends Se{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class O1 extends Se{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class I1 extends Se{constructor({param:t,name:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class M1 extends Se{constructor({param:t,type:n,modifier:s}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${s}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class T1 extends Se{constructor({param:t,type:n,modifier:s}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${s}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${s}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class D1 extends Se{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class It extends Se{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class k1 extends Se{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class R1 extends Se{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class A1 extends Se{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class L1 extends Se{constructor({current:t,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function F1(e,t,n){let s="";if(n)for(const r of Object.entries(n)){if(!r)continue;let o="";for(const a of r[1])o+=`[${a.type}${a.name?`:${a.name}`:""}]`;s+=`(${r[0]}{${o}})`}return t?`${t}:${e}${s}`:e}const Gr=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function $1(e,t={}){if(g1(e))return z1(e,t);if(p1(e))return _1(e,t);if(f1(e))return U1(e,t);if(v1(e))return V1(e,t);if(w1(e))return B1(e);if(j1(e))return{type:"receive",stateMutability:"payable"};throw new k1({signature:e})}function z1(e,t={}){const n=b1(e);if(!n)throw new It({signature:e,type:"function"});const s=je(n.parameters),r=[],o=s.length;for(let i=0;i<o;i++)r.push(at(s[i],{modifiers:ws,structs:t,type:"function"}));const a=[];if(n.returns){const i=je(n.returns),l=i.length;for(let u=0;u<l;u++)a.push(at(i[u],{modifiers:ws,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:r,outputs:a}}function _1(e,t={}){const n=m1(e);if(!n)throw new It({signature:e,type:"event"});const s=je(n.parameters),r=[],o=s.length;for(let a=0;a<o;a++)r.push(at(s[a],{modifiers:P1,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:r}}function U1(e,t={}){const n=h1(e);if(!n)throw new It({signature:e,type:"error"});const s=je(n.parameters),r=[],o=s.length;for(let a=0;a<o;a++)r.push(at(s[a],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:r}}function V1(e,t={}){const n=x1(e);if(!n)throw new It({signature:e,type:"constructor"});const s=je(n.parameters),r=[],o=s.length;for(let a=0;a<o;a++)r.push(at(s[a],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:r}}function B1(e){const t=C1(e);if(!t)throw new It({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const H1=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,W1=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,q1=/^u?int$/;function at(e,t){const n=F1(e,t?.type,t?.structs);if(Gr.has(n))return Gr.get(n);const s=yl.test(e),r=Be(s?W1:H1,e);if(!r)throw new O1({param:e});if(r.name&&Q1(r.name))throw new I1({param:e,name:r.name});const o=r.name?{name:r.name}:{},a=r.modifier==="indexed"?{indexed:!0}:{},i=t?.structs??{};let l,u={};if(s){l="tuple";const h=je(r.type),f=[],p=h.length;for(let g=0;g<p;g++)f.push(at(h[g],{structs:i}));u={components:f}}else if(r.type in i)l="tuple",u={components:i[r.type]};else if(q1.test(r.type))l=`${r.type}256`;else if(r.type==="address payable")l="address";else if(l=r.type,t?.type!=="struct"&&!El(l))throw new N1({type:l});if(r.modifier){if(!t?.modifiers?.has?.(r.modifier))throw new M1({param:e,type:t?.type,modifier:r.modifier});if(ws.has(r.modifier)&&!Y1(l,!!r.array))throw new T1({param:e,type:t?.type,modifier:r.modifier})}const d={type:`${l}${r.array??""}`,...o,...a,...u};return Gr.set(n,d),d}function je(e,t=[],n="",s=0){const r=e.trim().length;for(let o=0;o<r;o++){const a=e[o],i=e.slice(o+1);switch(a){case",":return s===0?je(i,[...t,n.trim()]):je(i,t,`${n}${a}`,s);case"(":return je(i,t,`${n}${a}`,s+1);case")":return je(i,t,`${n}${a}`,s-1);default:return je(i,t,`${n}${a}`,s)}}if(n==="")return t;if(s!==0)throw new L1({current:n,depth:s});return t.push(n.trim()),t}function El(e){return e==="address"||e==="bool"||e==="function"||e==="string"||gl.test(e)||bl.test(e)}const G1=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function Q1(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||gl.test(e)||bl.test(e)||G1.test(e)}function Y1(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function K1(e){const t={},n=e.length;for(let a=0;a<n;a++){const i=e[a];if(!Sl(i))continue;const l=y1(i);if(!l)throw new It({signature:i,type:"struct"});const u=l.properties.split(";"),d=[],h=u.length;for(let f=0;f<h;f++){const g=u[f].trim();if(!g)continue;const m=at(g,{type:"struct"});d.push(m)}if(!d.length)throw new R1({signature:i});t[l.name]=d}const s={},r=Object.entries(t),o=r.length;for(let a=0;a<o;a++){const[i,l]=r[a];s[i]=Nl(l,t)}return s}const X1=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function Nl(e,t,n=new Set){const s=[],r=e.length;for(let o=0;o<r;o++){const a=e[o];if(yl.test(a.type))s.push(a);else{const l=Be(X1,a.type);if(!l?.type)throw new D1({abiParameter:a});const{array:u,type:d}=l;if(d in t){if(n.has(d))throw new A1({type:d});s.push({...a,type:`tuple${u??""}`,components:Nl(t[d]??[],t,new Set([...n,d]))})}else if(El(d))s.push(a);else throw new E1({type:d})}}return s}function Ol(e){const t=K1(e),n=[],s=e.length;for(let r=0;r<s;r++){const o=e[r];Sl(o)||n.push($1(o,t))}return n}function J1(e){let t=!0,n="",s=0,r="",o=!1;for(let a=0;a<e.length;a++){const i=e[a];if(["(",")",","].includes(i)&&(t=!0),i==="("&&s++,i===")"&&s--,!!t){if(s===0){if(i===" "&&["event","function",""].includes(r))r="";else if(r+=i,i===")"){o=!0;break}continue}if(i===" "){e[a-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}r+=i,n+=i}}if(!o)throw new k("Unable to normalize signature.");return r}const Z1=e=>{const t=typeof e=="string"?e:d1(e);return J1(t)};function Il(e){return l1(Z1(e))}const ey=Il,wn=e=>jt(Il(e),0,4);function Cn(e){const{abi:t,args:n=[],name:s}=e,r=ut(s,{strict:!1}),o=t.filter(i=>r?i.type==="function"?wn(i)===s:i.type==="event"?ey(i)===s:!1:"name"in i&&i.name===s);if(o.length===0)return;if(o.length===1)return o[0];let a;for(const i of o){if(!("inputs"in i))continue;if(!n||n.length===0){if(!i.inputs||i.inputs.length===0)return i;continue}if(!i.inputs||i.inputs.length===0||i.inputs.length!==n.length)continue;if(n.every((u,d)=>{const h="inputs"in i&&i.inputs[d];return h?Cs(u,h):!1})){if(a&&"inputs"in a&&a.inputs){const u=Ml(i.inputs,a.inputs,n);if(u)throw new Sb({abiItem:i,type:u[0]},{abiItem:a,type:u[1]})}a=i}}return a||o[0]}function Cs(e,t){const n=typeof e,s=t.type;switch(s){case"address":return De(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return s==="tuple"&&"components"in t?Object.values(t.components).every((r,o)=>Cs(Object.values(e)[o],r)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(s)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(s)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(s)?Array.isArray(e)&&e.every(r=>Cs(r,{...t,type:s.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Ml(e,t,n){for(const s in e){const r=e[s],o=t[s];if(r.type==="tuple"&&o.type==="tuple"&&"components"in r&&"components"in o)return Ml(r.components,o.components,n[s]);const a=[r.type,o.type];if(a.includes("address")&&a.includes("bytes20")?!0:a.includes("address")&&a.includes("string")?De(n[s],{strict:!1}):a.includes("address")&&a.includes("bytes")?De(n[s],{strict:!1}):!1)return a}}const Qr="/docs/contract/decodeFunctionResult";function Po(e){const{abi:t,args:n,functionName:s,data:r}=e;let o=t[0];if(s){const i=Cn({abi:t,args:n,name:s});if(!i)throw new St(s,{docsPath:Qr});o=i}if(o.type!=="function")throw new St(void 0,{docsPath:Qr});if(!o.outputs)throw new ol(o.name,{docsPath:Qr});const a=jo(o.outputs,r);if(a&&a.length>1)return a;if(a&&a.length===1)return a[0]}const Wa="/docs/contract/encodeFunctionData";function ty(e){const{abi:t,args:n,functionName:s}=e;let r=t[0];if(s){const o=Cn({abi:t,args:n,name:s});if(!o)throw new St(s,{docsPath:Wa});r=o}if(r.type!=="function")throw new St(void 0,{docsPath:Wa});return{abi:[r],functionName:wn(Ye(r))}}function Eo(e){const{args:t}=e,{abi:n,functionName:s}=e.abi.length===1&&e.functionName?.startsWith("0x")?e:ty(e),r=n[0],o=s,a="inputs"in r&&r.inputs?xn(r.inputs,t??[]):void 0;return Nr([o,a??"0x"])}class Ss extends k{constructor({blockNumber:t,chain:n,contract:s}){super(`Chain "${n.name}" does not support contract "${s.name}".`,{metaMessages:["This could be due to any of the following:",...t&&s.blockCreated&&s.blockCreated>t?[`- The contract "${s.name}" was not deployed until block ${s.blockCreated} (current block ${t}).`]:[`- The chain does not have the contract "${s.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class Tl extends k{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}function No({blockNumber:e,chain:t,contract:n}){const s=t?.contracts?.[n];if(!s)throw new Ss({chain:t,contract:{name:n}});if(e&&s.blockCreated&&s.blockCreated>e)throw new Ss({blockNumber:e,chain:t,contract:{name:n,blockCreated:s.blockCreated}});return s.address}function Or(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const ny={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},Dl={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},ry={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function kl(e){const{abi:t,data:n}=e,s=jt(n,0,4);if(s==="0x")throw new po;const o=[...t||[],Dl,ry].find(a=>a.type==="error"&&s===wn(Ye(a)));if(!o)throw new sl(s,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:o,args:"inputs"in o&&o.inputs&&o.inputs.length>0?jo(o.inputs,jt(n,4)):void 0,errorName:o.name}}const Me=(e,t,n)=>JSON.stringify(e,(s,r)=>typeof r=="bigint"?r.toString():r,n);function Rl({abiItem:e,args:t,includeFunctionName:n=!0,includeName:s=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${n?e.name:""}(${e.inputs.map((r,o)=>`${s&&r.name?`${r.name}: `:""}${typeof t[o]=="object"?Me(t[o]):t[o]}`).join(", ")})`}const sy={gwei:9,wei:18},oy={ether:-9,wei:9};function Al(e,t){let n=e.toString();const s=n.startsWith("-");s&&(n=n.slice(1)),n=n.padStart(t,"0");let[r,o]=[n.slice(0,n.length-t),n.slice(n.length-t)];return o=o.replace(/(0+)$/,""),`${s?"-":""}${r||"0"}${o?`.${o}`:""}`}function ay(e,t="wei"){return Al(e,sy[t])}function tt(e,t="wei"){return Al(e,oy[t])}class iy extends k{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class cy extends k{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function qa(e){return e.reduce((t,{slot:n,value:s})=>`${t} ${n}: ${s}
26
- `,"")}function ly(e){return e.reduce((t,{address:n,...s})=>{let r=`${t} ${n}:
18
+ `),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class gl extends k{constructor(t,{docsPath:n}){super([`Function "${t}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(`
19
+ `),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class Ob extends k{constructor(t,{docsPath:n}){super([`Encoded function signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
20
+ `),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class Ib extends k{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${Ye(t.abiItem)}\`, and`,`\`${n.type}\` in \`${Ye(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class Mb extends k{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
21
+ `),{docsPath:n,name:"InvalidAbiEncodingType"})}}class Tb extends k{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
22
+ `),{docsPath:n,name:"InvalidAbiDecodingType"})}}class bl extends k{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
23
+ `),{name:"InvalidArrayError"})}}class Db extends k{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
24
+ `),{name:"InvalidDefinitionTypeError"})}}class ot extends k{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class yl extends k{constructor({offset:t,position:n,size:s}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${s}).`,{name:"SliceOffsetOutOfBoundsError"})}}let vl=class extends k{constructor({size:t,targetSize:n,type:s}){super(`${s.charAt(0).toUpperCase()}${s.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}};class _a extends k{constructor({size:t,targetSize:n,type:s}){super(`${s.charAt(0).toUpperCase()}${s.slice(1).toLowerCase()} is expected to be ${n} ${s} long, but is ${t} ${s} long.`,{name:"InvalidBytesLengthError"})}}function Ot(e,{dir:t,size:n=32}={}){return typeof e=="string"?qe(e,{dir:t,size:n}):kb(e,{dir:t,size:n})}function qe(e,{dir:t,size:n=32}={}){if(n===null)return e;const s=e.replace("0x","");if(s.length>n*2)throw new vl({size:Math.ceil(s.length/2),targetSize:n,type:"hex"});return`0x${s[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function kb(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new vl({size:e.length,targetSize:n,type:"bytes"});const s=new Uint8Array(n);for(let r=0;r<n;r++){const o=t==="right";s[o?r:n-r-1]=e[o?r:e.length-r-1]}return s}let xl=class extends k{constructor({max:t,min:n,signed:s,size:r,value:o}){super(`Number "${o}" is not in safe ${r?`${r*8}-bit ${s?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}};class Rb extends k{constructor(t){super(`Bytes value "${t}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}}class Ab extends k{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function go(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,s=0;for(let r=0;r<n.length-1&&n[t==="left"?r:n.length-r-1].toString()==="0";r++)s++;return n=t==="left"?n.slice(s):n.slice(0,n.length-s),typeof e=="string"?(n.length===1&&t==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}function ke(e,{size:t}){if(fe(e)>t)throw new Ab({givenSize:fe(e),maxSize:t})}function wl(e,t={}){const{signed:n}=t;t.size&&ke(e,{size:t.size});const s=BigInt(e);if(!n)return s;const r=(e.length-2)/2,o=(1n<<BigInt(r)*8n-1n)-1n;return s<=o?s:s-BigInt(`0x${"f".padStart(r*2,"f")}`)-1n}function Lb(e,t={}){return Number(wl(e,t))}const Fb=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Cl(e,t={}){return typeof e=="number"||typeof e=="bigint"?Z(e,t):typeof e=="string"?bo(e,t):typeof e=="boolean"?Sl(e,t):Ce(e,t)}function Sl(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(ke(n,{size:t.size}),Ot(n,{size:t.size})):n}function Ce(e,t={}){let n="";for(let r=0;r<e.length;r++)n+=Fb[e[r]];const s=`0x${n}`;return typeof t.size=="number"?(ke(s,{size:t.size}),Ot(s,{dir:"right",size:t.size})):s}function Z(e,t={}){const{signed:n,size:s}=t,r=BigInt(e);let o;s?n?o=(1n<<BigInt(s)*8n-1n)-1n:o=2n**(BigInt(s)*8n)-1n:typeof e=="number"&&(o=BigInt(Number.MAX_SAFE_INTEGER));const a=typeof o=="bigint"&&n?-o-1n:0;if(o&&r>o||r<a){const l=typeof e=="bigint"?"n":"";throw new xl({max:o?`${o}${l}`:void 0,min:`${a}${l}`,signed:n,size:s,value:`${e}${l}`})}const i=`0x${(n&&r<0?(1n<<BigInt(s*8))+BigInt(r):r).toString(16)}`;return s?Ot(i,{size:s}):i}const $b=new TextEncoder;function bo(e,t={}){const n=$b.encode(e);return Ce(n,t)}const zb=new TextEncoder;function yo(e,t={}){return typeof e=="number"||typeof e=="bigint"?Ub(e,t):typeof e=="boolean"?_b(e,t):ut(e)?vo(e,t):et(e,t)}function _b(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(ke(n,{size:t.size}),Ot(n,{size:t.size})):n}const Re={zero:48,nine:57,A:65,F:70,a:97,f:102};function Ua(e){if(e>=Re.zero&&e<=Re.nine)return e-Re.zero;if(e>=Re.A&&e<=Re.F)return e-(Re.A-10);if(e>=Re.a&&e<=Re.f)return e-(Re.a-10)}function vo(e,t={}){let n=e;t.size&&(ke(n,{size:t.size}),n=Ot(n,{dir:"right",size:t.size}));let s=n.slice(2);s.length%2&&(s=`0${s}`);const r=s.length/2,o=new Uint8Array(r);for(let a=0,i=0;a<r;a++){const l=Ua(s.charCodeAt(i++)),u=Ua(s.charCodeAt(i++));if(l===void 0||u===void 0)throw new k(`Invalid byte sequence ("${s[i-2]}${s[i-1]}" in "${s}").`);o[a]=l*16+u}return o}function Ub(e,t){const n=Z(e,t);return vo(n)}function et(e,t={}){const n=zb.encode(e);return typeof t.size=="number"?(ke(n,{size:t.size}),Ot(n,{dir:"right",size:t.size})):n}function Wt(e,t){const n=t||"hex",s=od(ut(e,{strict:!1})?yo(e):e);return n==="bytes"?s:Cl(s)}class xo extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const s=this.keys().next().value;s&&this.delete(s)}return this}}const Vb=/^0x[a-fA-F0-9]{40}$/,Gr=new xo(8192);function De(e,t){const{strict:n=!0}=t??{},s=`${e}.${n}`;if(Gr.has(s))return Gr.get(s);const r=Vb.test(e)?e.toLowerCase()===e?!0:n?wo(e)===e:!0:!1;return Gr.set(s,r),r}const Qr=new xo(8192);function wo(e,t){if(Qr.has(`${e}.${t}`))return Qr.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),s=Wt(et(n),"bytes"),r=n.split("");for(let a=0;a<40;a+=2)s[a>>1]>>4>=8&&r[a]&&(r[a]=r[a].toUpperCase()),(s[a>>1]&15)>=8&&r[a+1]&&(r[a+1]=r[a+1].toUpperCase());const o=`0x${r.join("")}`;return Qr.set(`${e}.${t}`,o),o}function Rn(e,t){if(!De(e,{strict:!1}))throw new ot({address:e});return wo(e,t)}class Va extends k{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class Bb extends k{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}}class Hb extends k{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}const Wb={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new Hb({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Bb({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Va({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new Va({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function qb(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(Wb);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function jt(e,t,n,{strict:s}={}){return ut(e,{strict:!1})?Gb(e,t,n,{strict:s}):Nl(e,t,n,{strict:s})}function jl(e,t){if(typeof t=="number"&&t>0&&t>fe(e)-1)throw new yl({offset:t,position:"start",size:fe(e)})}function Pl(e,t,n){if(typeof t=="number"&&typeof n=="number"&&fe(e)!==n-t)throw new yl({offset:n,position:"end",size:fe(e)})}function Nl(e,t,n,{strict:s}={}){jl(e,t);const r=e.slice(t,n);return s&&Pl(r,t,n),r}function Gb(e,t,n,{strict:s}={}){jl(e,t);const r=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return s&&Pl(r,t,n),r}function Qb(e,t={}){typeof t.size<"u"&&ke(e,{size:t.size});const n=Ce(e,t);return wl(n,t)}function Yb(e,t={}){let n=e;if(typeof t.size<"u"&&(ke(n,{size:t.size}),n=go(n)),n.length>1||n[0]>1)throw new Rb(n);return!!n[0]}function ze(e,t={}){typeof t.size<"u"&&ke(e,{size:t.size});const n=Ce(e,t);return Lb(n,t)}function Kb(e,t={}){let n=e;return typeof t.size<"u"&&(ke(n,{size:t.size}),n=go(n,{dir:"right"})),new TextDecoder().decode(n)}function Ke(e){return typeof e[0]=="string"?Mr(e):Xb(e)}function Xb(e){let t=0;for(const r of e)t+=r.length;const n=new Uint8Array(t);let s=0;for(const r of e)n.set(r,s),s+=r.length;return n}function Mr(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}const Jb=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function xn(e,t){if(e.length!==t.length)throw new Nb({expectedLength:e.length,givenLength:t.length});const n=Zb({params:e,values:t}),s=So(n);return s.length===0?"0x":s}function Zb({params:e,values:t}){const n=[];for(let s=0;s<e.length;s++)n.push(Co({param:e[s],value:t[s]}));return n}function Co({param:e,value:t}){const n=jo(e.type);if(n){const[s,r]=n;return t1(t,{length:s,param:{...e,type:r}})}if(e.type==="tuple")return a1(t,{param:e});if(e.type==="address")return e1(t);if(e.type==="bool")return r1(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const s=e.type.startsWith("int"),[,,r="256"]=Jb.exec(e.type)??[];return s1(t,{signed:s,size:Number(r)})}if(e.type.startsWith("bytes"))return n1(t,{param:e});if(e.type==="string")return o1(t);throw new Mb(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function So(e){let t=0;for(let o=0;o<e.length;o++){const{dynamic:a,encoded:i}=e[o];a?t+=32:t+=fe(i)}const n=[],s=[];let r=0;for(let o=0;o<e.length;o++){const{dynamic:a,encoded:i}=e[o];a?(n.push(Z(t+r,{size:32})),s.push(i),r+=fe(i)):n.push(i)}return Ke([...n,...s])}function e1(e){if(!De(e))throw new ot({address:e});return{dynamic:!1,encoded:qe(e.toLowerCase())}}function t1(e,{length:t,param:n}){const s=t===null;if(!Array.isArray(e))throw new bl(e);if(!s&&e.length!==t)throw new jb({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let r=!1;const o=[];for(let a=0;a<e.length;a++){const i=Co({param:n,value:e[a]});i.dynamic&&(r=!0),o.push(i)}if(s||r){const a=So(o);if(s){const i=Z(o.length,{size:32});return{dynamic:!0,encoded:o.length>0?Ke([i,a]):i}}if(r)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:Ke(o.map(({encoded:a})=>a))}}function n1(e,{param:t}){const[,n]=t.type.split("bytes"),s=fe(e);if(!n){let r=e;return s%32!==0&&(r=qe(r,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:Ke([qe(Z(s,{size:32})),r])}}if(s!==Number.parseInt(n,10))throw new Pb({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:qe(e,{dir:"right"})}}function r1(e){if(typeof e!="boolean")throw new k(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:qe(Sl(e))}}function s1(e,{signed:t,size:n=256}){if(typeof n=="number"){const s=2n**(BigInt(n)-(t?1n:0n))-1n,r=t?-s-1n:0n;if(e>s||e<r)throw new xl({max:s.toString(),min:r.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Z(e,{size:32,signed:t})}}function o1(e){const t=bo(e),n=Math.ceil(fe(t)/32),s=[];for(let r=0;r<n;r++)s.push(qe(jt(t,r*32,(r+1)*32),{dir:"right"}));return{dynamic:!0,encoded:Ke([qe(Z(fe(t),{size:32})),...s])}}function a1(e,{param:t}){let n=!1;const s=[];for(let r=0;r<t.components.length;r++){const o=t.components[r],a=Array.isArray(e)?r:o.name,i=Co({param:o,value:e[a]});s.push(i),i.dynamic&&(n=!0)}return{dynamic:n,encoded:n?So(s):Ke(s.map(({encoded:r})=>r))}}function jo(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function Po(e,t){const n=typeof t=="string"?vo(t):t,s=qb(n);if(fe(n)===0&&e.length>0)throw new mo;if(fe(t)&&fe(t)<32)throw new Sb({data:typeof t=="string"?t:Ce(t),params:e,size:fe(t)});let r=0;const o=[];for(let a=0;a<e.length;++a){const i=e[a];s.setPosition(r);const[l,u]=vt(s,i,{staticPosition:0});r+=u,o.push(l)}return o}function vt(e,t,{staticPosition:n}){const s=jo(t.type);if(s){const[r,o]=s;return c1(e,{...t,type:o},{length:r,staticPosition:n})}if(t.type==="tuple")return f1(e,t,{staticPosition:n});if(t.type==="address")return i1(e);if(t.type==="bool")return l1(e);if(t.type.startsWith("bytes"))return u1(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return d1(e,t);if(t.type==="string")return h1(e,{staticPosition:n});throw new Tb(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const Ba=32,xs=32;function i1(e){const t=e.readBytes(32);return[wo(Ce(Nl(t,-20))),32]}function c1(e,t,{length:n,staticPosition:s}){if(!n){const a=ze(e.readBytes(xs)),i=s+a,l=i+Ba;e.setPosition(i);const u=ze(e.readBytes(Ba)),d=qt(t);let h=0;const f=[];for(let p=0;p<u;++p){e.setPosition(l+(d?p*32:h));const[g,m]=vt(e,t,{staticPosition:l});h+=m,f.push(g)}return e.setPosition(s+32),[f,32]}if(qt(t)){const a=ze(e.readBytes(xs)),i=s+a,l=[];for(let u=0;u<n;++u){e.setPosition(i+u*32);const[d]=vt(e,t,{staticPosition:i});l.push(d)}return e.setPosition(s+32),[l,32]}let r=0;const o=[];for(let a=0;a<n;++a){const[i,l]=vt(e,t,{staticPosition:s+r});r+=l,o.push(i)}return[o,r]}function l1(e){return[Yb(e.readBytes(32),{size:32}),32]}function u1(e,t,{staticPosition:n}){const[s,r]=t.type.split("bytes");if(!r){const a=ze(e.readBytes(32));e.setPosition(n+a);const i=ze(e.readBytes(32));if(i===0)return e.setPosition(n+32),["0x",32];const l=e.readBytes(i);return e.setPosition(n+32),[Ce(l),32]}return[Ce(e.readBytes(Number.parseInt(r,10),32)),32]}function d1(e,t){const n=t.type.startsWith("int"),s=Number.parseInt(t.type.split("int")[1]||"256",10),r=e.readBytes(32);return[s>48?Qb(r,{signed:n}):ze(r,{signed:n}),32]}function f1(e,t,{staticPosition:n}){const s=t.components.length===0||t.components.some(({name:a})=>!a),r=s?[]:{};let o=0;if(qt(t)){const a=ze(e.readBytes(xs)),i=n+a;for(let l=0;l<t.components.length;++l){const u=t.components[l];e.setPosition(i+o);const[d,h]=vt(e,u,{staticPosition:i});o+=h,r[s?l:u?.name]=d}return e.setPosition(n+32),[r,32]}for(let a=0;a<t.components.length;++a){const i=t.components[a],[l,u]=vt(e,i,{staticPosition:n});r[s?a:i?.name]=l,o+=u}return[r,o]}function h1(e,{staticPosition:t}){const n=ze(e.readBytes(32)),s=t+n;e.setPosition(s);const r=ze(e.readBytes(32));if(r===0)return e.setPosition(t+32),["",32];const o=e.readBytes(r,32),a=Kb(go(o));return e.setPosition(t+32),[a,32]}function qt(e){const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return e.components?.some(qt);const n=jo(e.type);return!!(n&&qt({...e,type:n[1]}))}const p1=e=>Wt(yo(e));function m1(e){return p1(e)}const g1="1.1.0";let Se=class ws extends Error{constructor(t,n={}){const s=n.cause instanceof ws?n.cause.details:n.cause?.message?n.cause.message:n.details,r=n.cause instanceof ws&&n.cause.docsPath||n.docsPath,o=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...r?[`Docs: https://abitype.dev${r}`]:[],...s?[`Details: ${s}`]:[],`Version: abitype@${g1}`].join(`
25
+ `);super(o),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=s,this.docsPath=r,this.metaMessages=n.metaMessages,this.shortMessage=t}};function Be(e,t){return e.exec(t)?.groups}const El=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Ol=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,Il=/^\(.+?\).*?$/,Ha=/^tuple(?<array>(\[(\d*)\])*)$/;function Cs(e){let t=e.type;if(Ha.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let r=0;r<n;r++){const o=e.components[r];t+=Cs(o),r<n-1&&(t+=", ")}const s=Be(Ha,e.type);return t+=`)${s?.array??""}`,Cs({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function Lt(e){let t="";const n=e.length;for(let s=0;s<n;s++){const r=e[s];t+=Cs(r),s!==n-1&&(t+=", ")}return t}function b1(e){return e.type==="function"?`function ${e.name}(${Lt(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${e.outputs?.length?` returns (${Lt(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Lt(e.inputs)})`:e.type==="error"?`error ${e.name}(${Lt(e.inputs)})`:e.type==="constructor"?`constructor(${Lt(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const Ml=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function y1(e){return Ml.test(e)}function v1(e){return Be(Ml,e)}const Tl=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function x1(e){return Tl.test(e)}function w1(e){return Be(Tl,e)}const Dl=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function C1(e){return Dl.test(e)}function S1(e){return Be(Dl,e)}const kl=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function Rl(e){return kl.test(e)}function j1(e){return Be(kl,e)}const Al=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function P1(e){return Al.test(e)}function N1(e){return Be(Al,e)}const Ll=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function E1(e){return Ll.test(e)}function O1(e){return Be(Ll,e)}const I1=/^receive\(\) external payable$/;function M1(e){return I1.test(e)}const T1=new Set(["indexed"]),Ss=new Set(["calldata","memory","storage"]);class D1 extends Se{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class k1 extends Se{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class R1 extends Se{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class A1 extends Se{constructor({param:t,name:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class L1 extends Se{constructor({param:t,type:n,modifier:s}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${s}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class F1 extends Se{constructor({param:t,type:n,modifier:s}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${s}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${s}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class $1 extends Se{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class It extends Se{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class z1 extends Se{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class _1 extends Se{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class U1 extends Se{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class V1 extends Se{constructor({current:t,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function B1(e,t,n){let s="";if(n)for(const r of Object.entries(n)){if(!r)continue;let o="";for(const a of r[1])o+=`[${a.type}${a.name?`:${a.name}`:""}]`;s+=`(${r[0]}{${o}})`}return t?`${t}:${e}${s}`:e}const Yr=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function H1(e,t={}){if(C1(e))return W1(e,t);if(x1(e))return q1(e,t);if(y1(e))return G1(e,t);if(P1(e))return Q1(e,t);if(E1(e))return Y1(e);if(M1(e))return{type:"receive",stateMutability:"payable"};throw new z1({signature:e})}function W1(e,t={}){const n=S1(e);if(!n)throw new It({signature:e,type:"function"});const s=je(n.parameters),r=[],o=s.length;for(let i=0;i<o;i++)r.push(at(s[i],{modifiers:Ss,structs:t,type:"function"}));const a=[];if(n.returns){const i=je(n.returns),l=i.length;for(let u=0;u<l;u++)a.push(at(i[u],{modifiers:Ss,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:r,outputs:a}}function q1(e,t={}){const n=w1(e);if(!n)throw new It({signature:e,type:"event"});const s=je(n.parameters),r=[],o=s.length;for(let a=0;a<o;a++)r.push(at(s[a],{modifiers:T1,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:r}}function G1(e,t={}){const n=v1(e);if(!n)throw new It({signature:e,type:"error"});const s=je(n.parameters),r=[],o=s.length;for(let a=0;a<o;a++)r.push(at(s[a],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:r}}function Q1(e,t={}){const n=N1(e);if(!n)throw new It({signature:e,type:"constructor"});const s=je(n.parameters),r=[],o=s.length;for(let a=0;a<o;a++)r.push(at(s[a],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:r}}function Y1(e){const t=O1(e);if(!t)throw new It({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const K1=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,X1=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,J1=/^u?int$/;function at(e,t){const n=B1(e,t?.type,t?.structs);if(Yr.has(n))return Yr.get(n);const s=Il.test(e),r=Be(s?X1:K1,e);if(!r)throw new R1({param:e});if(r.name&&ey(r.name))throw new A1({param:e,name:r.name});const o=r.name?{name:r.name}:{},a=r.modifier==="indexed"?{indexed:!0}:{},i=t?.structs??{};let l,u={};if(s){l="tuple";const h=je(r.type),f=[],p=h.length;for(let g=0;g<p;g++)f.push(at(h[g],{structs:i}));u={components:f}}else if(r.type in i)l="tuple",u={components:i[r.type]};else if(J1.test(r.type))l=`${r.type}256`;else if(r.type==="address payable")l="address";else if(l=r.type,t?.type!=="struct"&&!Fl(l))throw new k1({type:l});if(r.modifier){if(!t?.modifiers?.has?.(r.modifier))throw new L1({param:e,type:t?.type,modifier:r.modifier});if(Ss.has(r.modifier)&&!ty(l,!!r.array))throw new F1({param:e,type:t?.type,modifier:r.modifier})}const d={type:`${l}${r.array??""}`,...o,...a,...u};return Yr.set(n,d),d}function je(e,t=[],n="",s=0){const r=e.trim().length;for(let o=0;o<r;o++){const a=e[o],i=e.slice(o+1);switch(a){case",":return s===0?je(i,[...t,n.trim()]):je(i,t,`${n}${a}`,s);case"(":return je(i,t,`${n}${a}`,s+1);case")":return je(i,t,`${n}${a}`,s-1);default:return je(i,t,`${n}${a}`,s)}}if(n==="")return t;if(s!==0)throw new V1({current:n,depth:s});return t.push(n.trim()),t}function Fl(e){return e==="address"||e==="bool"||e==="function"||e==="string"||El.test(e)||Ol.test(e)}const Z1=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function ey(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||El.test(e)||Ol.test(e)||Z1.test(e)}function ty(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function ny(e){const t={},n=e.length;for(let a=0;a<n;a++){const i=e[a];if(!Rl(i))continue;const l=j1(i);if(!l)throw new It({signature:i,type:"struct"});const u=l.properties.split(";"),d=[],h=u.length;for(let f=0;f<h;f++){const g=u[f].trim();if(!g)continue;const m=at(g,{type:"struct"});d.push(m)}if(!d.length)throw new _1({signature:i});t[l.name]=d}const s={},r=Object.entries(t),o=r.length;for(let a=0;a<o;a++){const[i,l]=r[a];s[i]=$l(l,t)}return s}const ry=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function $l(e,t,n=new Set){const s=[],r=e.length;for(let o=0;o<r;o++){const a=e[o];if(Il.test(a.type))s.push(a);else{const l=Be(ry,a.type);if(!l?.type)throw new $1({abiParameter:a});const{array:u,type:d}=l;if(d in t){if(n.has(d))throw new U1({type:d});s.push({...a,type:`tuple${u??""}`,components:$l(t[d]??[],t,new Set([...n,d]))})}else if(Fl(d))s.push(a);else throw new D1({type:d})}}return s}function zl(e){const t=ny(e),n=[],s=e.length;for(let r=0;r<s;r++){const o=e[r];Rl(o)||n.push(H1(o,t))}return n}function sy(e){let t=!0,n="",s=0,r="",o=!1;for(let a=0;a<e.length;a++){const i=e[a];if(["(",")",","].includes(i)&&(t=!0),i==="("&&s++,i===")"&&s--,!!t){if(s===0){if(i===" "&&["event","function",""].includes(r))r="";else if(r+=i,i===")"){o=!0;break}continue}if(i===" "){e[a-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}r+=i,n+=i}}if(!o)throw new k("Unable to normalize signature.");return r}const oy=e=>{const t=typeof e=="string"?e:b1(e);return sy(t)};function _l(e){return m1(oy(e))}const ay=_l,wn=e=>jt(_l(e),0,4);function Cn(e){const{abi:t,args:n=[],name:s}=e,r=ut(s,{strict:!1}),o=t.filter(i=>r?i.type==="function"?wn(i)===s:i.type==="event"?ay(i)===s:!1:"name"in i&&i.name===s);if(o.length===0)return;if(o.length===1)return o[0];let a;for(const i of o){if(!("inputs"in i))continue;if(!n||n.length===0){if(!i.inputs||i.inputs.length===0)return i;continue}if(!i.inputs||i.inputs.length===0||i.inputs.length!==n.length)continue;if(n.every((u,d)=>{const h="inputs"in i&&i.inputs[d];return h?js(u,h):!1})){if(a&&"inputs"in a&&a.inputs){const u=Ul(i.inputs,a.inputs,n);if(u)throw new Ib({abiItem:i,type:u[0]},{abiItem:a,type:u[1]})}a=i}}return a||o[0]}function js(e,t){const n=typeof e,s=t.type;switch(s){case"address":return De(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return s==="tuple"&&"components"in t?Object.values(t.components).every((r,o)=>js(Object.values(e)[o],r)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(s)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(s)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(s)?Array.isArray(e)&&e.every(r=>js(r,{...t,type:s.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Ul(e,t,n){for(const s in e){const r=e[s],o=t[s];if(r.type==="tuple"&&o.type==="tuple"&&"components"in r&&"components"in o)return Ul(r.components,o.components,n[s]);const a=[r.type,o.type];if(a.includes("address")&&a.includes("bytes20")?!0:a.includes("address")&&a.includes("string")?De(n[s],{strict:!1}):a.includes("address")&&a.includes("bytes")?De(n[s],{strict:!1}):!1)return a}}const Kr="/docs/contract/decodeFunctionResult";function No(e){const{abi:t,args:n,functionName:s,data:r}=e;let o=t[0];if(s){const i=Cn({abi:t,args:n,name:s});if(!i)throw new St(s,{docsPath:Kr});o=i}if(o.type!=="function")throw new St(void 0,{docsPath:Kr});if(!o.outputs)throw new gl(o.name,{docsPath:Kr});const a=Po(o.outputs,r);if(a&&a.length>1)return a;if(a&&a.length===1)return a[0]}const Wa="/docs/contract/encodeFunctionData";function iy(e){const{abi:t,args:n,functionName:s}=e;let r=t[0];if(s){const o=Cn({abi:t,args:n,name:s});if(!o)throw new St(s,{docsPath:Wa});r=o}if(r.type!=="function")throw new St(void 0,{docsPath:Wa});return{abi:[r],functionName:wn(Ye(r))}}function Eo(e){const{args:t}=e,{abi:n,functionName:s}=e.abi.length===1&&e.functionName?.startsWith("0x")?e:iy(e),r=n[0],o=s,a="inputs"in r&&r.inputs?xn(r.inputs,t??[]):void 0;return Mr([o,a??"0x"])}class Ps extends k{constructor({blockNumber:t,chain:n,contract:s}){super(`Chain "${n.name}" does not support contract "${s.name}".`,{metaMessages:["This could be due to any of the following:",...t&&s.blockCreated&&s.blockCreated>t?[`- The contract "${s.name}" was not deployed until block ${s.blockCreated} (current block ${t}).`]:[`- The chain does not have the contract "${s.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class Vl extends k{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}function Oo({blockNumber:e,chain:t,contract:n}){const s=t?.contracts?.[n];if(!s)throw new Ps({chain:t,contract:{name:n}});if(e&&s.blockCreated&&s.blockCreated>e)throw new Ps({blockNumber:e,chain:t,contract:{name:n,blockCreated:s.blockCreated}});return s.address}function Tr(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const cy={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},Bl={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},ly={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function Hl(e){const{abi:t,data:n}=e,s=jt(n,0,4);if(s==="0x")throw new mo;const o=[...t||[],Bl,ly].find(a=>a.type==="error"&&s===wn(Ye(a)));if(!o)throw new ml(s,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:o,args:"inputs"in o&&o.inputs&&o.inputs.length>0?Po(o.inputs,jt(n,4)):void 0,errorName:o.name}}const Me=(e,t,n)=>JSON.stringify(e,(s,r)=>typeof r=="bigint"?r.toString():r,n);function Wl({abiItem:e,args:t,includeFunctionName:n=!0,includeName:s=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${n?e.name:""}(${e.inputs.map((r,o)=>`${s&&r.name?`${r.name}: `:""}${typeof t[o]=="object"?Me(t[o]):t[o]}`).join(", ")})`}const uy={gwei:9,wei:18},dy={ether:-9,wei:9};function ql(e,t){let n=e.toString();const s=n.startsWith("-");s&&(n=n.slice(1)),n=n.padStart(t,"0");let[r,o]=[n.slice(0,n.length-t),n.slice(n.length-t)];return o=o.replace(/(0+)$/,""),`${s?"-":""}${r||"0"}${o?`.${o}`:""}`}function fy(e,t="wei"){return ql(e,uy[t])}function tt(e,t="wei"){return ql(e,dy[t])}class hy extends k{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class py extends k{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function qa(e){return e.reduce((t,{slot:n,value:s})=>`${t} ${n}: ${s}
26
+ `,"")}function my(e){return e.reduce((t,{address:n,...s})=>{let r=`${t} ${n}:
27
27
  `;return s.nonce&&(r+=` nonce: ${s.nonce}
28
28
  `),s.balance&&(r+=` balance: ${s.balance}
29
29
  `),s.code&&(r+=` code: ${s.code}
30
30
  `),s.state&&(r+=` state:
31
31
  `,r+=qa(s.state)),s.stateDiff&&(r+=` stateDiff:
32
32
  `,r+=qa(s.stateDiff)),r},` State Override:
33
- `).slice(0,-1)}function Ll(e){const t=Object.entries(e).map(([s,r])=>r===void 0||r===!1?null:[s,r]).filter(Boolean),n=t.reduce((s,[r])=>Math.max(s,r.length),0);return t.map(([s,r])=>` ${`${s}:`.padEnd(n+1)} ${r}`).join(`
34
- `)}class uy extends k{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(`
35
- `),{name:"FeeConflictError"})}}const dy=e=>e,Sn=e=>e;class fy extends k{constructor(t,{account:n,docsPath:s,chain:r,data:o,gas:a,gasPrice:i,maxFeePerGas:l,maxPriorityFeePerGas:u,nonce:d,to:h,value:f,stateOverride:p}){const g=n?Or(n):void 0;let m=Ll({from:g?.address,to:h,value:typeof f<"u"&&`${ay(f)} ${r?.nativeCurrency?.symbol||"ETH"}`,data:o,gas:a,gasPrice:typeof i<"u"&&`${tt(i)} gwei`,maxFeePerGas:typeof l<"u"&&`${tt(l)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${tt(u)} gwei`,nonce:d});p&&(m+=`
36
- ${ly(p)}`),super(t.shortMessage,{cause:t,docsPath:s,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",m].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class hy extends k{constructor(t,{abi:n,args:s,contractAddress:r,docsPath:o,functionName:a,sender:i}){const l=Cn({abi:n,args:s,name:a}),u=l?Rl({abiItem:l,args:s,includeFunctionName:!1,includeName:!1}):void 0,d=l?Ye(l,{includeName:!0}):void 0,h=Ll({address:r&&dy(r),function:d,args:u&&u!=="()"&&`${[...Array(a?.length??0).keys()].map(()=>" ").join("")}${u}`,sender:i});super(t.shortMessage||`An unknown error occurred while executing the contract function "${a}".`,{cause:t,docsPath:o,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],h&&"Contract Call:",h].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=n,this.args=s,this.cause=t,this.contractAddress=r,this.functionName=a,this.sender=i}}class js extends k{constructor({abi:t,data:n,functionName:s,message:r}){let o,a,i,l;if(n&&n!=="0x")try{a=kl({abi:t,data:n});const{abiItem:d,errorName:h,args:f}=a;if(h==="Error")l=f[0];else if(h==="Panic"){const[p]=f;l=ny[p]}else{const p=d?Ye(d,{includeName:!0}):void 0,g=d&&f?Rl({abiItem:d,args:f,includeFunctionName:!1,includeName:!1}):void 0;i=[p?`Error: ${p}`:"",g&&g!=="()"?` ${[...Array(h?.length??0).keys()].map(()=>" ").join("")}${g}`:""]}}catch(d){o=d}else r&&(l=r);let u;o instanceof sl&&(u=o.signature,i=[`Unable to decode signature "${u}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${u}.`]),super(l&&l!=="execution reverted"||u?[`The contract function "${s}" reverted with the following ${u?"signature":"reason"}:`,l||u].join(`
37
- `):`The contract function "${s}" reverted.`,{cause:o,metaMessages:i,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=a,this.raw=n,this.reason=l,this.signature=u}}class py extends k{constructor({functionName:t}){super(`The contract function "${t}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${t}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class my extends k{constructor({factory:t}){super(`Deployment for counterfactual contract call failed${t?` for factory "${t}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}}class Fl extends k{constructor({data:t,message:n}){super(n||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t}}function $l(e){if(!(e instanceof k))return!1;const t=e.walk(n=>n instanceof js);return t instanceof js?t.data?.errorName==="HttpError"||t.data?.errorName==="ResolverError"||t.data?.errorName==="ResolverNotContract"||t.data?.errorName==="ResolverNotFound"||t.data?.errorName==="ReverseAddressMismatch"||t.data?.errorName==="UnsupportedResolverProfile":!1}function gy(e){const{abi:t,data:n}=e,s=jt(n,0,4),r=t.find(o=>o.type==="function"&&s===wn(Ye(o)));if(!r)throw new Cb(s,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:r.name,args:"inputs"in r&&r.inputs&&r.inputs.length>0?jo(r.inputs,jt(n,4)):void 0}}const Yr="/docs/contract/encodeErrorResult";function Ga(e){const{abi:t,errorName:n,args:s}=e;let r=t[0];if(n){const l=Cn({abi:t,args:s,name:n});if(!l)throw new za(n,{docsPath:Yr});r=l}if(r.type!=="error")throw new za(void 0,{docsPath:Yr});const o=Ye(r),a=wn(o);let i="0x";if(s&&s.length>0){if(!r.inputs)throw new wb(r.name,{docsPath:Yr});i=xn(r.inputs,s)}return Nr([a,i])}const Kr="/docs/contract/encodeFunctionResult";function by(e){const{abi:t,functionName:n,result:s}=e;let r=t[0];if(n){const a=Cn({abi:t,name:n});if(!a)throw new St(n,{docsPath:Kr});r=a}if(r.type!=="function")throw new St(void 0,{docsPath:Kr});if(!r.outputs)throw new ol(r.name,{docsPath:Kr});const o=(()=>{if(r.outputs.length===0)return[];if(r.outputs.length===1)return[s];if(Array.isArray(s))return s;throw new al(s)})();return xn(r.outputs,o)}const Ir="x-batch-gateway:true";async function zl(e){const{data:t,ccipRequest:n}=e,{args:[s]}=gy({abi:gs,data:t}),r=[],o=[];return await Promise.all(s.map(async(a,i)=>{try{o[i]=a.urls.includes(Ir)?await zl({data:a.data,ccipRequest:n}):await n(a),r[i]=!1}catch(l){r[i]=!0,o[i]=yy(l)}})),by({abi:gs,functionName:"query",result:[r,o]})}function yy(e){return e.name==="HttpRequestError"&&e.status?Ga({abi:gs,errorName:"HttpError",args:[e.status,e.shortMessage]}):Ga({abi:[Dl],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function _l(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return ut(t)?t:null}function vy(e){let t=new Uint8Array(32).fill(0);if(!e)return Ce(t);const n=e.split(".");for(let s=n.length-1;s>=0;s-=1){const r=_l(n[s]),o=r?bo(r):Wt(et(n[s]),"bytes");t=Wt(Ke([t,o]),"bytes")}return Ce(t)}function xy(e){return`[${e.slice(2)}]`}function wy(e){const t=new Uint8Array(32).fill(0);return e?_l(e)||Wt(et(e)):Ce(t)}function Cy(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(et(t).byteLength+2);let s=0;const r=t.split(".");for(let o=0;o<r.length;o++){let a=et(r[o]);a.byteLength>255&&(a=et(xy(wy(r[o])))),n[s]=a.length,n.set(a,s+1),s+=a.length+1}return n.byteLength!==s+1?n.slice(0,s+1):n}function Mr(e,t,n){const s=e[t.name];if(typeof s=="function")return s;const r=e[n];return typeof r=="function"?r:o=>t(e,o)}class nt extends k{constructor({body:t,cause:n,details:s,headers:r,status:o,url:a}){super("HTTP request failed.",{cause:n,details:s,metaMessages:[o&&`Status: ${o}`,`URL: ${Sn(a)}`,t&&`Request body: ${Me(t)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=t,this.headers=r,this.status=o,this.url=a}}class Oo extends k{constructor({body:t,error:n,url:s}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${Sn(s)}`,`Request body: ${Me(t)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=n.code,this.data=n.data}}class Qa extends k{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${Sn(n)}`,`Request body: ${Me(t)}`],name:"TimeoutError"})}}const Sy=-1;class be extends k{constructor(t,{code:n,docsPath:s,metaMessages:r,name:o,shortMessage:a}){super(a,{cause:t,docsPath:s,metaMessages:r||t?.metaMessages,name:o||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=o||t.name,this.code=t instanceof Oo?t.code:n??Sy}}class xe extends be{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class Gt extends be{constructor(t){super(t,{code:Gt.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Gt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class Qt extends be{constructor(t){super(t,{code:Qt.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(Qt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class Yt extends be{constructor(t,{method:n}={}){super(t,{code:Yt.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(Yt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class Kt extends be{constructor(t){super(t,{code:Kt.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
33
+ `).slice(0,-1)}function Gl(e){const t=Object.entries(e).map(([s,r])=>r===void 0||r===!1?null:[s,r]).filter(Boolean),n=t.reduce((s,[r])=>Math.max(s,r.length),0);return t.map(([s,r])=>` ${`${s}:`.padEnd(n+1)} ${r}`).join(`
34
+ `)}class gy extends k{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(`
35
+ `),{name:"FeeConflictError"})}}const by=e=>e,Sn=e=>e;class yy extends k{constructor(t,{account:n,docsPath:s,chain:r,data:o,gas:a,gasPrice:i,maxFeePerGas:l,maxPriorityFeePerGas:u,nonce:d,to:h,value:f,stateOverride:p}){const g=n?Tr(n):void 0;let m=Gl({from:g?.address,to:h,value:typeof f<"u"&&`${fy(f)} ${r?.nativeCurrency?.symbol||"ETH"}`,data:o,gas:a,gasPrice:typeof i<"u"&&`${tt(i)} gwei`,maxFeePerGas:typeof l<"u"&&`${tt(l)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${tt(u)} gwei`,nonce:d});p&&(m+=`
36
+ ${my(p)}`),super(t.shortMessage,{cause:t,docsPath:s,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",m].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class vy extends k{constructor(t,{abi:n,args:s,contractAddress:r,docsPath:o,functionName:a,sender:i}){const l=Cn({abi:n,args:s,name:a}),u=l?Wl({abiItem:l,args:s,includeFunctionName:!1,includeName:!1}):void 0,d=l?Ye(l,{includeName:!0}):void 0,h=Gl({address:r&&by(r),function:d,args:u&&u!=="()"&&`${[...Array(a?.length??0).keys()].map(()=>" ").join("")}${u}`,sender:i});super(t.shortMessage||`An unknown error occurred while executing the contract function "${a}".`,{cause:t,docsPath:o,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],h&&"Contract Call:",h].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=n,this.args=s,this.cause=t,this.contractAddress=r,this.functionName=a,this.sender=i}}class Ns extends k{constructor({abi:t,data:n,functionName:s,message:r}){let o,a,i,l;if(n&&n!=="0x")try{a=Hl({abi:t,data:n});const{abiItem:d,errorName:h,args:f}=a;if(h==="Error")l=f[0];else if(h==="Panic"){const[p]=f;l=cy[p]}else{const p=d?Ye(d,{includeName:!0}):void 0,g=d&&f?Wl({abiItem:d,args:f,includeFunctionName:!1,includeName:!1}):void 0;i=[p?`Error: ${p}`:"",g&&g!=="()"?` ${[...Array(h?.length??0).keys()].map(()=>" ").join("")}${g}`:""]}}catch(d){o=d}else r&&(l=r);let u;o instanceof ml&&(u=o.signature,i=[`Unable to decode signature "${u}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${u}.`]),super(l&&l!=="execution reverted"||u?[`The contract function "${s}" reverted with the following ${u?"signature":"reason"}:`,l||u].join(`
37
+ `):`The contract function "${s}" reverted.`,{cause:o,metaMessages:i,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=a,this.raw=n,this.reason=l,this.signature=u}}class xy extends k{constructor({functionName:t}){super(`The contract function "${t}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${t}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class wy extends k{constructor({factory:t}){super(`Deployment for counterfactual contract call failed${t?` for factory "${t}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}}class Ql extends k{constructor({data:t,message:n}){super(n||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t}}function Yl(e){if(!(e instanceof k))return!1;const t=e.walk(n=>n instanceof Ns);return t instanceof Ns?t.data?.errorName==="HttpError"||t.data?.errorName==="ResolverError"||t.data?.errorName==="ResolverNotContract"||t.data?.errorName==="ResolverNotFound"||t.data?.errorName==="ReverseAddressMismatch"||t.data?.errorName==="UnsupportedResolverProfile":!1}function Cy(e){const{abi:t,data:n}=e,s=jt(n,0,4),r=t.find(o=>o.type==="function"&&s===wn(Ye(o)));if(!r)throw new Ob(s,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:r.name,args:"inputs"in r&&r.inputs&&r.inputs.length>0?Po(r.inputs,jt(n,4)):void 0}}const Xr="/docs/contract/encodeErrorResult";function Ga(e){const{abi:t,errorName:n,args:s}=e;let r=t[0];if(n){const l=Cn({abi:t,args:s,name:n});if(!l)throw new za(n,{docsPath:Xr});r=l}if(r.type!=="error")throw new za(void 0,{docsPath:Xr});const o=Ye(r),a=wn(o);let i="0x";if(s&&s.length>0){if(!r.inputs)throw new Eb(r.name,{docsPath:Xr});i=xn(r.inputs,s)}return Mr([a,i])}const Jr="/docs/contract/encodeFunctionResult";function Sy(e){const{abi:t,functionName:n,result:s}=e;let r=t[0];if(n){const a=Cn({abi:t,name:n});if(!a)throw new St(n,{docsPath:Jr});r=a}if(r.type!=="function")throw new St(void 0,{docsPath:Jr});if(!r.outputs)throw new gl(r.name,{docsPath:Jr});const o=(()=>{if(r.outputs.length===0)return[];if(r.outputs.length===1)return[s];if(Array.isArray(s))return s;throw new bl(s)})();return xn(r.outputs,o)}const Dr="x-batch-gateway:true";async function Kl(e){const{data:t,ccipRequest:n}=e,{args:[s]}=Cy({abi:ys,data:t}),r=[],o=[];return await Promise.all(s.map(async(a,i)=>{try{o[i]=a.urls.includes(Dr)?await Kl({data:a.data,ccipRequest:n}):await n(a),r[i]=!1}catch(l){r[i]=!0,o[i]=jy(l)}})),Sy({abi:ys,functionName:"query",result:[r,o]})}function jy(e){return e.name==="HttpRequestError"&&e.status?Ga({abi:ys,errorName:"HttpError",args:[e.status,e.shortMessage]}):Ga({abi:[Bl],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function Xl(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return ut(t)?t:null}function Py(e){let t=new Uint8Array(32).fill(0);if(!e)return Ce(t);const n=e.split(".");for(let s=n.length-1;s>=0;s-=1){const r=Xl(n[s]),o=r?yo(r):Wt(et(n[s]),"bytes");t=Wt(Ke([t,o]),"bytes")}return Ce(t)}function Ny(e){return`[${e.slice(2)}]`}function Ey(e){const t=new Uint8Array(32).fill(0);return e?Xl(e)||Wt(et(e)):Ce(t)}function Oy(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(et(t).byteLength+2);let s=0;const r=t.split(".");for(let o=0;o<r.length;o++){let a=et(r[o]);a.byteLength>255&&(a=et(Ny(Ey(r[o])))),n[s]=a.length,n.set(a,s+1),s+=a.length+1}return n.byteLength!==s+1?n.slice(0,s+1):n}function kr(e,t,n){const s=e[t.name];if(typeof s=="function")return s;const r=e[n];return typeof r=="function"?r:o=>t(e,o)}class nt extends k{constructor({body:t,cause:n,details:s,headers:r,status:o,url:a}){super("HTTP request failed.",{cause:n,details:s,metaMessages:[o&&`Status: ${o}`,`URL: ${Sn(a)}`,t&&`Request body: ${Me(t)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=t,this.headers=r,this.status=o,this.url=a}}class Io extends k{constructor({body:t,error:n,url:s}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${Sn(s)}`,`Request body: ${Me(t)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=n.code,this.data=n.data}}class Qa extends k{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${Sn(n)}`,`Request body: ${Me(t)}`],name:"TimeoutError"})}}const Iy=-1;class be extends k{constructor(t,{code:n,docsPath:s,metaMessages:r,name:o,shortMessage:a}){super(a,{cause:t,docsPath:s,metaMessages:r||t?.metaMessages,name:o||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=o||t.name,this.code=t instanceof Io?t.code:n??Iy}}class xe extends be{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class Gt extends be{constructor(t){super(t,{code:Gt.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Gt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class Qt extends be{constructor(t){super(t,{code:Qt.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(Qt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class Yt extends be{constructor(t,{method:n}={}){super(t,{code:Yt.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(Yt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class Kt extends be{constructor(t){super(t,{code:Kt.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
38
38
  `)})}}Object.defineProperty(Kt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class it extends be{constructor(t){super(t,{code:it.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(it,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class Xt extends be{constructor(t){super(t,{code:Xt.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
39
- `)})}}Object.defineProperty(Xt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Jt extends be{constructor(t){super(t,{code:Jt.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Jt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Ge extends be{constructor(t){super(t,{code:Ge.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Ge,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Zt extends be{constructor(t){super(t,{code:Zt.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Zt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Je extends be{constructor(t,{method:n}={}){super(t,{code:Je.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(Je,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Pt extends be{constructor(t){super(t,{code:Pt.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Pt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class en extends be{constructor(t){super(t,{code:en.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(en,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class he extends xe{constructor(t){super(t,{code:he.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(he,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class tn extends xe{constructor(t){super(t,{code:tn.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(tn,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class nn extends xe{constructor(t,{method:n}={}){super(t,{code:nn.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(nn,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class rn extends xe{constructor(t){super(t,{code:rn.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(rn,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class sn extends xe{constructor(t){super(t,{code:sn.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(sn,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class ct extends xe{constructor(t){super(t,{code:ct.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(ct,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class on extends xe{constructor(t){super(t,{code:on.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(on,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class an extends xe{constructor(t){super(t,{code:an.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(an,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class cn extends xe{constructor(t){super(t,{code:cn.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(cn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class ln extends xe{constructor(t){super(t,{code:ln.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(ln,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class un extends xe{constructor(t){super(t,{code:un.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(un,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class dn extends xe{constructor(t){super(t,{code:dn.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(dn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class fn extends xe{constructor(t){super(t,{code:fn.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(fn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class jy extends be{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const Py=3;function Ey(e,{abi:t,address:n,args:s,docsPath:r,functionName:o,sender:a}){const i=e instanceof Fl?e:e instanceof k?e.walk(g=>"data"in g)||e.walk():{},{code:l,data:u,details:d,message:h,shortMessage:f}=i,p=e instanceof po?new py({functionName:o}):[Py,it.code].includes(l)&&(u||d||h||f)?new js({abi:t,data:typeof u=="object"?u.data:u,functionName:o,message:i instanceof Oo?d:f??h}):e;return new hy(p,{abi:t,args:s,contractAddress:n,docsPath:r,functionName:o,sender:a})}const Ny="0.1.1";function Oy(){return Ny}let Ul=class Ps extends Error{constructor(t,n={}){const s=(()=>{if(n.cause instanceof Ps){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&"details"in n.cause&&typeof n.cause.details=="string"?n.cause.details:n.cause?.message?n.cause.message:n.details})(),r=n.cause instanceof Ps&&n.cause.docsPath||n.docsPath,a=`https://oxlib.sh${r??""}`,i=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...s||r?["",s?`Details: ${s}`:void 0,r?`See: ${a}`:void 0]:[]].filter(l=>typeof l=="string").join(`
40
- `);super(i,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${Oy()}`}),this.cause=n.cause,this.details=s,this.docs=a,this.docsPath=r,this.shortMessage=t}walk(t){return Vl(this,t)}};function Vl(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?Vl(e.cause,t):t?null:e}function Iy(e,t={}){const{dir:n,size:s=32}=t;if(s===0)return e;const r=e.replace("0x","");if(r.length>s*2)throw new Dy({size:Math.ceil(r.length/2),targetSize:s,type:"Hex"});return`0x${r[n==="right"?"padEnd":"padStart"](s*2,"0")}`}function Le(e,t={}){const{signed:n,size:s}=t,r=BigInt(e);let o;s?n?o=(1n<<BigInt(s)*8n-1n)-1n:o=2n**(BigInt(s)*8n)-1n:typeof e=="number"&&(o=BigInt(Number.MAX_SAFE_INTEGER));const a=typeof o=="bigint"&&n?-o-1n:0;if(o&&r>o||r<a){const u=typeof e=="bigint"?"n":"";throw new Ty({max:o?`${o}${u}`:void 0,min:`${a}${u}`,signed:n,size:s,value:`${e}${u}`})}const l=`0x${(n&&r<0?(1n<<BigInt(s*8))+BigInt(r):r).toString(16)}`;return s?My(l,s):l}function My(e,t){return Iy(e,{dir:"left",size:t})}class Ty extends Ul{constructor({max:t,min:n,signed:s,size:r,value:o}){super(`Number \`${o}\` is not in safe${r?` ${r*8}-bit`:""}${s?" signed":" unsigned"} integer range ${t?`(\`${n}\` to \`${t}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}class Dy extends Ul{constructor({size:t,targetSize:n,type:s}){super(`${s.charAt(0).toUpperCase()}${s.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}function ky(e){return{address:e.address,amount:Le(e.amount),index:Le(e.index),validatorIndex:Le(e.validatorIndex)}}function Ry(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:Le(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:Le(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:Le(e.gasLimit)},...typeof e.number=="bigint"&&{number:Le(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:Le(e.prevRandao)},...typeof e.time=="bigint"&&{time:Le(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(ky)}}}const Ay="0x82ad56cb",Ly="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",Fy="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",$y="0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033",Xr="/docs/contract/encodeDeployData";function Bl(e){const{abi:t,args:n,bytecode:s}=e;if(!n||n.length===0)return s;const r=t.find(a=>"type"in a&&a.type==="constructor");if(!r)throw new gb({docsPath:Xr});if(!("inputs"in r))throw new $a({docsPath:Xr});if(!r.inputs||r.inputs.length===0)throw new $a({docsPath:Xr});const o=xn(r.inputs,n);return Nr([s,o])}class gt extends k{constructor({cause:t,message:n}={}){const s=n?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${s?`with reason: ${s}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}}Object.defineProperty(gt,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(gt,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class cr extends k{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${tt(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(cr,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class Es extends k{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${tt(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(Es,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class Ns extends k{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:t,name:"NonceTooHighError"})}}Object.defineProperty(Ns,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Os extends k{constructor({cause:t,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
41
- `),{cause:t,name:"NonceTooLowError"})}}Object.defineProperty(Os,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class Is extends k{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}}Object.defineProperty(Is,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class Ms extends k{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
42
- `),{cause:t,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(Ms,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class Ts extends k{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:t,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(Ts,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class Ds extends k{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction is too low.`,{cause:t,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(Ds,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class ks extends k{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(ks,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class lr extends k{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:s}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${tt(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${s?` = ${tt(s)} gwei`:""}).`].join(`
43
- `),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(lr,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class Hl extends k{constructor({cause:t}){super(`An error occurred while executing: ${t?.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function zy(e,t){const n=(e.details||"").toLowerCase(),s=e instanceof k?e.walk(r=>r?.code===gt.code):e;return s instanceof k?new gt({cause:e,message:s.details}):gt.nodeMessage.test(n)?new gt({cause:e,message:e.details}):cr.nodeMessage.test(n)?new cr({cause:e,maxFeePerGas:t?.maxFeePerGas}):Es.nodeMessage.test(n)?new Es({cause:e,maxFeePerGas:t?.maxFeePerGas}):Ns.nodeMessage.test(n)?new Ns({cause:e,nonce:t?.nonce}):Os.nodeMessage.test(n)?new Os({cause:e,nonce:t?.nonce}):Is.nodeMessage.test(n)?new Is({cause:e,nonce:t?.nonce}):Ms.nodeMessage.test(n)?new Ms({cause:e}):Ts.nodeMessage.test(n)?new Ts({cause:e,gas:t?.gas}):Ds.nodeMessage.test(n)?new Ds({cause:e,gas:t?.gas}):ks.nodeMessage.test(n)?new ks({cause:e}):lr.nodeMessage.test(n)?new lr({cause:e,maxFeePerGas:t?.maxFeePerGas,maxPriorityFeePerGas:t?.maxPriorityFeePerGas}):new Hl({cause:e})}function _y(e,{docsPath:t,...n}){const s=(()=>{const r=zy(e,n);return r instanceof Hl?e:r})();return new fy(s,{docsPath:t,...n})}function Uy(e,{format:t}){if(!t)return{};const n={};function s(o){const a=Object.keys(o);for(const i of a)i in e&&(n[i]=e[i]),o[i]&&typeof o[i]=="object"&&!Array.isArray(o[i])&&s(o[i])}const r=t(e||{});return s(r),n}const Vy={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function By(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=Hy(e.authorizationList)),typeof e.accessList<"u"&&(n.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(n.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?n.blobs=e.blobs.map(s=>Ce(s)):n.blobs=e.blobs),typeof e.data<"u"&&(n.data=e.data),e.account&&(n.from=e.account.address),typeof e.from<"u"&&(n.from=e.from),typeof e.gas<"u"&&(n.gas=J(e.gas)),typeof e.gasPrice<"u"&&(n.gasPrice=J(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(n.maxFeePerBlobGas=J(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(n.maxFeePerGas=J(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(n.maxPriorityFeePerGas=J(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(n.nonce=J(e.nonce)),typeof e.to<"u"&&(n.to=e.to),typeof e.type<"u"&&(n.type=Vy[e.type]),typeof e.value<"u"&&(n.value=J(e.value)),n}function Hy(e){return e.map(t=>({address:t.address,r:t.r?J(BigInt(t.r)):t.r,s:t.s?J(BigInt(t.s)):t.s,chainId:J(t.chainId),nonce:J(t.nonce),...typeof t.yParity<"u"?{yParity:J(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:J(t.v)}:{}}))}function Wy(){let e=()=>{},t=()=>{};return{promise:new Promise((s,r)=>{e=s,t=r}),resolve:e,reject:t}}const Jr=new Map;function Wl({fn:e,id:t,shouldSplitBatch:n,wait:s=0,sort:r}){const o=async()=>{const d=l();a();const h=d.map(({args:f})=>f);h.length!==0&&e(h).then(f=>{r&&Array.isArray(f)&&f.sort(r);for(let p=0;p<d.length;p++){const{resolve:g}=d[p];g?.([f[p],f])}}).catch(f=>{for(let p=0;p<d.length;p++){const{reject:g}=d[p];g?.(f)}})},a=()=>Jr.delete(t),i=()=>l().map(({args:d})=>d),l=()=>Jr.get(t)||[],u=d=>Jr.set(t,[...l(),d]);return{flush:a,async schedule(d){const{promise:h,resolve:f,reject:p}=Wy();return n?.([...i(),d])&&o(),l().length>0?(u({args:d,resolve:f,reject:p}),h):(u({args:d,resolve:f,reject:p}),setTimeout(o,s),h)}}}function Ya(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:s})=>{if(n.length!==66)throw new _a({size:n.length,targetSize:66,type:"hex"});if(s.length!==66)throw new _a({size:s.length,targetSize:66,type:"hex"});return t[n]=s,t},{})}function qy(e){const{balance:t,nonce:n,state:s,stateDiff:r,code:o}=e,a={};if(o!==void 0&&(a.code=o),t!==void 0&&(a.balance=J(t)),n!==void 0&&(a.nonce=J(n)),s!==void 0&&(a.state=Ya(s)),r!==void 0){if(a.state)throw new cy;a.stateDiff=Ya(r)}return a}function Gy(e){if(!e)return;const t={};for(const{address:n,...s}of e){if(!De(n,{strict:!1}))throw new ot({address:n});if(t[n])throw new iy({address:n});t[n]=qy(s)}return t}const Qy=2n**256n-1n;function Yy(e){const{account:t,gasPrice:n,maxFeePerGas:s,maxPriorityFeePerGas:r,to:o}=e,a=t?Or(t):void 0;if(a&&!De(a.address))throw new ot({address:a.address});if(o&&!De(o))throw new ot({address:o});if(typeof n<"u"&&(typeof s<"u"||typeof r<"u"))throw new uy;if(s&&s>Qy)throw new cr({maxFeePerGas:s});if(r&&s&&r>s)throw new lr({maxFeePerGas:s,maxPriorityFeePerGas:r})}async function ql(e,t){const{account:n=e.account,authorizationList:s,batch:r=!!e.batch?.multicall,blockNumber:o,blockTag:a=e.experimental_blockTag??"latest",accessList:i,blobs:l,blockOverrides:u,code:d,data:h,factory:f,factoryData:p,gas:g,gasPrice:m,maxFeePerBlobGas:y,maxFeePerGas:v,maxPriorityFeePerGas:x,nonce:C,to:E,value:w,stateOverride:j,...S}=t,P=n?Or(n):void 0;if(d&&(f||p))throw new k("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(d&&E)throw new k("Cannot provide both `code` & `to` as parameters.");const N=d&&h,T=f&&p&&E&&h,I=N||T,D=N?Gl({code:d,data:h}):T?Jy({data:h,factory:f,factoryData:p,to:E}):h;try{Yy(t);const F=(typeof o=="bigint"?J(o):void 0)||a,$=u?Ry(u):void 0,V=Gy(j),W=e.chain?.formatters?.transactionRequest?.format,Z=(W||By)({...Uy(S,{format:W}),accessList:i,account:P,authorizationList:s,blobs:l,data:D,gas:g,gasPrice:m,maxFeePerBlobGas:y,maxFeePerGas:v,maxPriorityFeePerGas:x,nonce:C,to:I?void 0:E,value:w},"call");if(r&&Ky({request:Z})&&!V&&!$)try{return await Xy(e,{...Z,blockNumber:o,blockTag:a})}catch(U){if(!(U instanceof Tl)&&!(U instanceof Ss))throw U}const ee=(()=>{const U=[Z,F];return V&&$?[...U,V,$]:V?[...U,V]:$?[...U,{},$]:U})(),se=await e.request({method:"eth_call",params:ee});return se==="0x"?{data:void 0}:{data:se}}catch(R){const F=Zy(R),{offchainLookup:$,offchainLookupSignature:V}=await Ud(async()=>{const{offchainLookup:W,offchainLookupSignature:q}=await Promise.resolve().then(()=>Pv);return{offchainLookup:W,offchainLookupSignature:q}},void 0);if(e.ccipRead!==!1&&F?.slice(0,10)===V&&E)return{data:await $(e,{data:F,to:E})};throw I&&F?.slice(0,10)==="0x101bb98d"?new my({factory:f}):_y(R,{...t,account:P,chain:e.chain})}}function Ky({request:e}){const{data:t,to:n,...s}=e;return!(!t||t.startsWith(Ay)||!n||Object.values(s).filter(r=>typeof r<"u").length>0)}async function Xy(e,t){const{batchSize:n=1024,deployless:s=!1,wait:r=0}=typeof e.batch?.multicall=="object"?e.batch.multicall:{},{blockNumber:o,blockTag:a=e.experimental_blockTag??"latest",data:i,to:l}=t,u=(()=>{if(s)return null;if(t.multicallAddress)return t.multicallAddress;if(e.chain)return No({blockNumber:o,chain:e.chain,contract:"multicall3"});throw new Tl})(),h=(typeof o=="bigint"?J(o):void 0)||a,{schedule:f}=Wl({id:`${e.uid}.${h}`,wait:r,shouldSplitBatch(m){return m.reduce((v,{data:x})=>v+(x.length-2),0)>n*2},fn:async m=>{const y=m.map(C=>({allowFailure:!0,callData:C.data,target:C.to})),v=Eo({abi:La,args:[y],functionName:"aggregate3"}),x=await e.request({method:"eth_call",params:[{...u===null?{data:Gl({code:$y,data:v})}:{to:u,data:v}},h]});return Po({abi:La,args:[y],functionName:"aggregate3",data:x||"0x"})}}),[{returnData:p,success:g}]=await f({data:i,to:l});if(!g)throw new Fl({data:p});return p==="0x"?{data:void 0}:{data:p}}function Gl(e){const{code:t,data:n}=e;return Bl({abi:Ol(["constructor(bytes, bytes)"]),bytecode:Ly,args:[t,n]})}function Jy(e){const{data:t,factory:n,factoryData:s,to:r}=e;return Bl({abi:Ol(["constructor(address, bytes, address, bytes)"]),bytecode:Fy,args:[r,t,n,s]})}function Zy(e){if(!(e instanceof k))return;const t=e.walk();return typeof t?.data=="object"?t.data?.data:t.data}async function ur(e,t){const{abi:n,address:s,args:r,functionName:o,...a}=t,i=Eo({abi:n,args:r,functionName:o});try{const{data:l}=await Mr(e,ql,"call")({...a,data:i,to:s});return Po({abi:n,args:r,functionName:o,data:l||"0x"})}catch(l){throw Ey(l,{abi:n,address:s,args:r,docsPath:"/docs/contract/readContract",functionName:o})}}class ev extends k{constructor({data:t}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(t)}`],name:"EnsAvatarInvalidMetadataError"})}}class Ft extends k{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class Io extends k{constructor({uri:t}){super(`Unable to resolve ENS avatar URI "${t}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class tv extends k{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const nv=/(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,rv=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/,sv=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,ov=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function av(e){try{const t=await fetch(e,{method:"HEAD"});return t.status===200?t.headers.get("content-type")?.startsWith("image/"):!1}catch(t){return typeof t=="object"&&typeof t.response<"u"||!Object.hasOwn(globalThis,"Image")?!1:new Promise(n=>{const s=new Image;s.onload=()=>{n(!0)},s.onerror=()=>{n(!1)},s.src=e})}}function Ka(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function Ql({uri:e,gatewayUrls:t}){const n=sv.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const s=Ka(t?.ipfs,"https://ipfs.io"),r=Ka(t?.arweave,"https://arweave.net"),o=e.match(nv),{protocol:a,subpath:i,target:l,subtarget:u=""}=o?.groups||{},d=a==="ipns:/"||i==="ipns/",h=a==="ipfs:/"||i==="ipfs/"||rv.test(e);if(e.startsWith("http")&&!d&&!h){let p=e;return t?.arweave&&(p=e.replace(/https:\/\/arweave.net/g,t?.arweave)),{uri:p,isOnChain:!1,isEncoded:!1}}if((d||h)&&l)return{uri:`${s}/${d?"ipns":"ipfs"}/${l}${u}`,isOnChain:!1,isEncoded:!1};if(a==="ar:/"&&l)return{uri:`${r}/${l}${u||""}`,isOnChain:!1,isEncoded:!1};let f=e.replace(ov,"");if(f.startsWith("<svg")&&(f=`data:image/svg+xml;base64,${btoa(f)}`),f.startsWith("data:")||f.startsWith("{"))return{uri:f,isOnChain:!0,isEncoded:!1};throw new Io({uri:e})}function Yl(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new ev({data:e});return e.image||e.image_url||e.image_data}async function iv({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(r=>r.json());return await Mo({gatewayUrls:e,uri:Yl(n)})}catch{throw new Io({uri:t})}}async function Mo({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:s}=Ql({uri:t,gatewayUrls:e});if(s||await av(n))return n;throw new Io({uri:t})}function cv(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[n,s,r]=t.split("/"),[o,a]=n.split(":"),[i,l]=s.split(":");if(!o||o.toLowerCase()!=="eip155")throw new Ft({reason:"Only EIP-155 supported"});if(!a)throw new Ft({reason:"Chain ID not found"});if(!l)throw new Ft({reason:"Contract address not found"});if(!r)throw new Ft({reason:"Token ID not found"});if(!i)throw new Ft({reason:"ERC namespace not found"});return{chainID:Number.parseInt(a,10),namespace:i.toLowerCase(),contractAddress:l,tokenID:r}}async function lv(e,{nft:t}){if(t.namespace==="erc721")return ur(e,{address:t.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(t.tokenID)]});if(t.namespace==="erc1155")return ur(e,{address:t.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(t.tokenID)]});throw new tv({namespace:t.namespace})}async function uv(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?dv(e,{gatewayUrls:t,record:n}):Mo({uri:n,gatewayUrls:t})}async function dv(e,{gatewayUrls:t,record:n}){const s=cv(n),r=await lv(e,{nft:s}),{uri:o,isOnChain:a,isEncoded:i}=Ql({uri:r,gatewayUrls:t});if(a&&(o.includes("data:application/json;base64,")||o.startsWith("{"))){const u=i?atob(o.replace("data:application/json;base64,","")):o,d=JSON.parse(u);return Mo({uri:Yl(d),gatewayUrls:t})}let l=s.tokenID;return s.namespace==="erc1155"&&(l=l.replace("0x","").padStart(64,"0")),iv({gatewayUrls:t,uri:o.replace(/(?:0x)?{id}/,l)})}async function fv(e,t){const{blockNumber:n,blockTag:s,key:r,name:o,gatewayUrls:a,strict:i}=t,{chain:l}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!l)throw new Error("client chain not configured. universalResolverAddress is required.");return No({blockNumber:n,chain:l,contract:"ensUniversalResolver"})})(),d=l?.ensTlds;if(d&&!d.some(h=>o.endsWith(h)))return null;try{const h={address:u,abi:hb,args:[dl(Cy(o)),Eo({abi:Fa,functionName:"text",args:[vy(o),r]}),a??[Ir]],functionName:"resolveWithGateways",blockNumber:n,blockTag:s},p=await Mr(e,ur,"readContract")(h);if(p[0]==="0x")return null;const g=Po({abi:Fa,functionName:"text",data:p[0]});return g===""?null:g}catch(h){if(i)throw h;if($l(h))return null;throw h}}async function hv(e,{blockNumber:t,blockTag:n,assetGatewayUrls:s,name:r,gatewayUrls:o,strict:a,universalResolverAddress:i}){const l=await Mr(e,fv,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:r,universalResolverAddress:i,gatewayUrls:o,strict:a});if(!l)return null;try{return await uv(e,{record:l,gatewayUrls:s})}catch{return null}}async function pv(e,t){const{address:n,blockNumber:s,blockTag:r,coinType:o=60n,gatewayUrls:a,strict:i}=t,{chain:l}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!l)throw new Error("client chain not configured. universalResolverAddress is required.");return No({blockNumber:s,chain:l,contract:"ensUniversalResolver"})})();try{const d={address:u,abi:pb,args:[n,o,a??[Ir]],functionName:"reverseWithGateways",blockNumber:s,blockTag:r},h=Mr(e,ur,"readContract"),[f]=await h(d);return f||null}catch(d){if(i)throw d;if($l(d))return null;throw d}}function mv(e,t){if(!De(e,{strict:!1}))throw new ot({address:e});if(!De(t,{strict:!1}))throw new ot({address:t});return e.toLowerCase()===t.toLowerCase()}const An=new vo(8192);function gv(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(An.get(n))return An.get(n);const s=e().finally(()=>An.delete(n));return An.set(n,s),s}async function bv(e){return new Promise(t=>setTimeout(t,e))}function Kl(e,{delay:t=100,retryCount:n=2,shouldRetry:s=()=>!0}={}){return new Promise((r,o)=>{const a=async({count:i=0}={})=>{const l=async({error:u})=>{const d=typeof t=="function"?t({count:i,error:u}):t;d&&await bv(d),a({count:i+1})};try{const u=await e();r(u)}catch(u){if(i<n&&await s({count:i,error:u}))return l({error:u});o(u)}};a()})}function yv(e,t={}){return async(n,s={})=>{const{dedupe:r=!1,methods:o,retryDelay:a=150,retryCount:i=3,uid:l}={...t,...s},{method:u}=n;if(o?.exclude?.includes(u))throw new Je(new Error("method not supported"),{method:u});if(o?.include&&!o.include.includes(u))throw new Je(new Error("method not supported"),{method:u});const d=r?go(`${l}.${Me(n)}`):void 0;return gv(()=>Kl(async()=>{try{return await e(n)}catch(h){const f=h;switch(f.code){case Gt.code:throw new Gt(f);case Qt.code:throw new Qt(f);case Yt.code:throw new Yt(f,{method:n.method});case Kt.code:throw new Kt(f);case it.code:throw new it(f);case Xt.code:throw new Xt(f);case Jt.code:throw new Jt(f);case Ge.code:throw new Ge(f);case Zt.code:throw new Zt(f);case Je.code:throw new Je(f,{method:n.method});case Pt.code:throw new Pt(f);case en.code:throw new en(f);case he.code:throw new he(f);case tn.code:throw new tn(f);case nn.code:throw new nn(f);case rn.code:throw new rn(f);case sn.code:throw new sn(f);case ct.code:throw new ct(f);case on.code:throw new on(f);case an.code:throw new an(f);case cn.code:throw new cn(f);case ln.code:throw new ln(f);case un.code:throw new un(f);case dn.code:throw new dn(f);case fn.code:throw new fn(f);case 5e3:throw new he(f);default:throw h instanceof k?h:new jy(f)}}},{delay:({count:h,error:f})=>{if(f&&f instanceof nt){const p=f?.headers?.get("Retry-After");if(p?.match(/\d/))return Number.parseInt(p,10)*1e3}return~~(1<<h)*a},retryCount:i,shouldRetry:({error:h})=>vv(h)}),{enabled:r,id:d})}}function vv(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===Pt.code||e.code===it.code:e instanceof nt&&e.status?e.status===403||e.status===408||e.status===413||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:!0}class xv extends k{constructor({callbackSelector:t,cause:n,data:s,extraData:r,sender:o,urls:a}){super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],n.metaMessages?.length?"":[],"Offchain Gateway Call:",a&&[" Gateway URL(s):",...a.map(i=>` ${Sn(i)}`)],` Sender: ${o}`,` Data: ${s}`,` Callback selector: ${t}`,` Extra data: ${r}`].flat(),name:"OffchainLookupError"})}}class wv extends k{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${Sn(n)}`,`Response: ${Me(t)}`],name:"OffchainLookupResponseMalformedError"})}}class Cv extends k{constructor({sender:t,to:n}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${n}`,`OffchainLookup sender address: ${t}`],name:"OffchainLookupSenderMismatchError"})}}const Sv="0x556f1830",Xl={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function jv(e,{blockNumber:t,blockTag:n,data:s,to:r}){const{args:o}=kl({data:s,abi:[Xl]}),[a,i,l,u,d]=o,{ccipRead:h}=e,f=h&&typeof h?.request=="function"?h.request:Jl;try{if(!mv(r,a))throw new Cv({sender:a,to:r});const p=i.includes(Ir)?await zl({data:l,ccipRequest:f}):await f({data:l,sender:a,urls:i}),{data:g}=await ql(e,{blockNumber:t,blockTag:n,data:Ke([u,xn([{type:"bytes"},{type:"bytes"}],[p,d])]),to:r});return g}catch(p){throw new xv({callbackSelector:u,cause:p,data:s,extraData:d,sender:a,urls:i})}}async function Jl({data:e,sender:t,urls:n}){let s=new Error("An unknown error occurred.");for(let r=0;r<n.length;r++){const o=n[r],a=o.includes("{data}")?"GET":"POST",i=a==="POST"?{data:e,sender:t}:void 0,l=a==="POST"?{"Content-Type":"application/json"}:{};try{const u=await fetch(o.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(i),headers:l,method:a});let d;if(u.headers.get("Content-Type")?.startsWith("application/json")?d=(await u.json()).data:d=await u.text(),!u.ok){s=new nt({body:i,details:d?.error?Me(d.error):u.statusText,headers:u.headers,status:u.status,url:o});continue}if(!ut(d)){s=new wv({result:d,url:o});continue}return d}catch(u){s=new nt({body:i,details:u.message,url:o})}}throw s}const Pv=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:Jl,offchainLookup:jv,offchainLookupAbiItem:Xl,offchainLookupSignature:Sv},Symbol.toStringTag,{value:"Module"}));function Ev(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}function Zl(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:s}){return new Promise((r,o)=>{(async()=>{let a;try{const i=new AbortController;n>0&&(a=setTimeout(()=>{s?i.abort():o(t)},n)),r(await e({signal:i?.signal||null}))}catch(i){i?.name==="AbortError"&&o(t),o(i)}finally{clearTimeout(a)}})()})}function Nv(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const Xa=Nv();function Ov(e,t={}){return{async request(n){const{body:s,fetchFn:r=t.fetchFn??fetch,onRequest:o=t.onRequest,onResponse:a=t.onResponse,timeout:i=t.timeout??1e4}=n,l={...t.fetchOptions??{},...n.fetchOptions??{}},{headers:u,method:d,signal:h}=l;try{const f=await Zl(async({signal:g})=>{const m={...l,body:Array.isArray(s)?Me(s.map(C=>({jsonrpc:"2.0",id:C.id??Xa.take(),...C}))):Me({jsonrpc:"2.0",id:s.id??Xa.take(),...s}),headers:{"Content-Type":"application/json",...u},method:d||"POST",signal:h||(i>0?g:null)},y=new Request(e,m),v=await o?.(y,m)??{...m,url:e};return await r(v.url??e,v)},{errorInstance:new Qa({body:s,url:e}),timeout:i,signal:!0});a&&await a(f);let p;if(f.headers.get("Content-Type")?.startsWith("application/json"))p=await f.json();else{p=await f.text();try{p=JSON.parse(p||"{}")}catch(g){if(f.ok)throw g;p={error:p}}}if(!f.ok)throw new nt({body:s,details:Me(p.error)||f.statusText,headers:f.headers,status:f.status,url:e});return p}catch(f){throw f instanceof nt||f instanceof Qa?f:new nt({body:s,cause:f,url:e})}}}}function eu(e,t,n){const s=e[t.name];if(typeof s=="function")return s;const r=e[n];return typeof r=="function"?r:o=>t(e,o)}const Yn="2.22.1",Iv=()=>`@wagmi/core@${Yn}`;var tu=function(e,t,n,s){if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?s:n==="a"?s.call(e):s?s.value:t.get(e)},dr,nu;let To=class Rs extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return Iv()}constructor(t,n={}){super(),dr.add(this),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiCoreError"});const s=n.cause instanceof Rs?n.cause.details:n.cause?.message?n.cause.message:n.details,r=n.cause instanceof Rs&&n.cause.docsPath||n.docsPath;this.message=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...r?[`Docs: ${this.docsBaseUrl}${r}.html${n.docsSlug?`#${n.docsSlug}`:""}`]:[],...s?[`Details: ${s}`]:[],`Version: ${this.version}`].join(`
44
- `),n.cause&&(this.cause=n.cause),this.details=s,this.docsPath=r,this.metaMessages=n.metaMessages,this.shortMessage=t}walk(t){return tu(this,dr,"m",nu).call(this,this,t)}};dr=new WeakSet,nu=function e(t,n){return n?.(t)?t:t.cause?tu(this,dr,"m",e).call(this,t.cause,n):t};class As extends To{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}const Ls=256;let Ln=Ls,Fn;function ru(e=11){if(!Fn||Ln+e>Ls*2){Fn="",Ln=0;for(let t=0;t<Ls;t++)Fn+=(256+Math.random()*256|0).toString(16).substring(1)}return Fn.substring(Ln,Ln+++e)}function Mv(e){const{batch:t,chain:n,ccipRead:s,key:r="base",name:o="Base Client",type:a="base"}=e,i=e.experimental_blockTag??(typeof n?.experimental_preconfirmationTime=="number"?"pending":void 0),l=n?.blockTime??12e3,u=Math.min(Math.max(Math.floor(l/2),500),4e3),d=e.pollingInterval??u,h=e.cacheTime??d,f=e.account?Or(e.account):void 0,{config:p,request:g,value:m}=e.transport({chain:n,pollingInterval:d}),y={...p,...m},v={account:f,batch:t,cacheTime:h,ccipRead:s,chain:n,key:r,name:o,pollingInterval:d,request:g,transport:y,type:a,uid:ru(),...i?{experimental_blockTag:i}:{}};function x(C){return E=>{const w=E(C);for(const S in v)delete w[S];const j={...C,...w};return Object.assign(j,{extend:x(j)})}}return Object.assign(v,{extend:x(v)})}function Tv({key:e,methods:t,name:n,request:s,retryCount:r=3,retryDelay:o=150,timeout:a,type:i},l){const u=ru();return{config:{key:e,methods:t,name:n,request:s,retryCount:r,retryDelay:o,timeout:a,type:i},request:yv(s,{methods:t,retryCount:r,retryDelay:o,uid:u}),value:l}}class Dv extends k{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function kv(e,t={}){const{batch:n,fetchFn:s,fetchOptions:r,key:o="http",methods:a,name:i="HTTP JSON-RPC",onFetchRequest:l,onFetchResponse:u,retryDelay:d,raw:h}=t;return({chain:f,retryCount:p,timeout:g})=>{const{batchSize:m=1e3,wait:y=0}=typeof n=="object"?n:{},v=t.retryCount??p,x=g??t.timeout??1e4,C=f?.rpcUrls.default.http[0];if(!C)throw new Dv;const E=Ov(C,{fetchFn:s,fetchOptions:r,onRequest:l,onResponse:u,timeout:x});return Tv({key:o,methods:a,name:i,async request({method:w,params:j}){const S={method:w,params:j},{schedule:P}=Wl({id:C,wait:y,shouldSplitBatch(D){return D.length>m},fn:D=>E.request({body:D}),sort:(D,R)=>D.id-R.id}),N=async D=>n?P(D):[await E.request({body:D})],[{error:T,result:I}]=await N(S);if(h)return{error:T,result:I};if(T)throw new Oo({body:S,error:T,url:C});return I},retryCount:v,retryDelay:d,timeout:x,type:"http"},{fetchOptions:r,url:C})}}function Ja(e){return e.state.chainId}function Rv(e,t){const{chainId:n,...s}=t,r=e.getClient({chainId:n});return eu(r,hv,"getEnsAvatar")(s)}function Av(e,t){const{chainId:n,...s}=t,r=e.getClient({chainId:n});return eu(r,pv,"getEnsName")(s)}let Zr=!1;async function Lv(e,t={}){if(Zr)return[];Zr=!0,e.setState(u=>({...u,status:u.current?"reconnecting":"connecting"}));const n=[];if(t.connectors?.length)for(const u of t.connectors){let d;typeof u=="function"?d=e._internal.connectors.setup(u):d=u,n.push(d)}else n.push(...e.connectors);let s;try{s=await e.storage?.getItem("recentConnectorId")}catch{}const r={};for(const[,u]of e.state.connections)r[u.connector.id]=1;s&&(r[s]=0);const o=Object.keys(r).length>0?[...n].sort((u,d)=>(r[u.id]??10)-(r[d.id]??10)):n;let a=!1;const i=[],l=[];for(const u of o){const d=await u.getProvider().catch(()=>{});if(!d||l.some(p=>p===d)||!await u.isAuthorized())continue;const f=await u.connect({isReconnecting:!0}).catch(()=>null);f&&(u.emitter.off("connect",e._internal.events.connect),u.emitter.on("change",e._internal.events.change),u.emitter.on("disconnect",e._internal.events.disconnect),e.setState(p=>{const g=new Map(a?p.connections:new Map).set(u.uid,{accounts:f.accounts,chainId:f.chainId,connector:u});return{...p,current:a?p.current:u.uid,connections:g}}),i.push({accounts:f.accounts,chainId:f.chainId,connector:u}),l.push(d),a=!0)}return(e.state.status==="reconnecting"||e.state.status==="connecting")&&(a?e.setState(u=>({...u,status:"connected"})):e.setState(u=>({...u,connections:new Map,current:null,status:"disconnected"}))),Zr=!1,i}class ht extends To{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}function Fv(e,t){const{onChange:n}=t;return e.subscribe(s=>s.chainId,n)}Do.type="injected";function Do(e={}){const{shimDisconnect:t=!0,unstable_shimAsyncInject:n}=e;function s(){const l=e.target;if(typeof l=="function"){const u=l();if(u)return u}return typeof l=="object"?l:typeof l=="string"?{...$v[l]??{id:l,name:`${l[0].toUpperCase()}${l.slice(1)}`,provider:`is${l[0].toUpperCase()}${l.slice(1)}`}}:{id:"injected",name:"Injected",provider(u){return u?.ethereum}}}let r,o,a,i;return l=>({get icon(){return s().icon},get id(){return s().id},get name(){return s().name},get supportsSimulation(){return!0},type:Do.type,async setup(){const u=await this.getProvider();u?.on&&e.target&&(a||(a=this.onConnect.bind(this),u.on("connect",a)),r||(r=this.onAccountsChanged.bind(this),u.on("accountsChanged",r)))},async connect({chainId:u,isReconnecting:d,withCapabilities:h}={}){const f=await this.getProvider();if(!f)throw new ht;let p=[];if(d)p=await this.getAccounts().catch(()=>[]);else if(t)try{p=(await f.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}))[0]?.caveats?.[0]?.value?.map(m=>Rn(m)),p.length>0&&(p=await this.getAccounts())}catch(g){const m=g;if(m.code===he.code)throw new he(m);if(m.code===Ge.code)throw m}try{!p?.length&&!d&&(p=(await f.request({method:"eth_requestAccounts"})).map(y=>Rn(y))),a&&(f.removeListener("connect",a),a=void 0),r||(r=this.onAccountsChanged.bind(this),f.on("accountsChanged",r)),o||(o=this.onChainChanged.bind(this),f.on("chainChanged",o)),i||(i=this.onDisconnect.bind(this),f.on("disconnect",i));let g=await this.getChainId();return u&&g!==u&&(g=(await this.switchChain({chainId:u}).catch(y=>{if(y.code===he.code)throw y;return{id:g}}))?.id??g),t&&await l.storage?.removeItem(`${this.id}.disconnected`),e.target||await l.storage?.setItem("injected.connected",!0),{accounts:h?p.map(m=>({address:m,capabilities:{}})):p,chainId:g}}catch(g){const m=g;throw m.code===he.code?new he(m):m.code===Ge.code?new Ge(m):m}},async disconnect(){const u=await this.getProvider();if(!u)throw new ht;o&&(u.removeListener("chainChanged",o),o=void 0),i&&(u.removeListener("disconnect",i),i=void 0),a||(a=this.onConnect.bind(this),u.on("connect",a));try{await Zl(()=>u.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}t&&await l.storage?.setItem(`${this.id}.disconnected`,!0),e.target||await l.storage?.removeItem("injected.connected")},async getAccounts(){const u=await this.getProvider();if(!u)throw new ht;return(await u.request({method:"eth_accounts"})).map(h=>Rn(h))},async getChainId(){const u=await this.getProvider();if(!u)throw new ht;const d=await u.request({method:"eth_chainId"});return Number(d)},async getProvider(){if(typeof window>"u")return;let u;const d=s();return typeof d.provider=="function"?u=d.provider(window):typeof d.provider=="string"?u=Kn(window,d.provider):u=d.provider,u&&!u.removeListener&&("off"in u&&typeof u.off=="function"?u.removeListener=u.off:u.removeListener=()=>{}),u},async isAuthorized(){try{if(t&&await l.storage?.getItem(`${this.id}.disconnected`)||!e.target&&!await l.storage?.getItem("injected.connected"))return!1;if(!await this.getProvider()){if(n!==void 0&&n!==!1){const f=async()=>(typeof window<"u"&&window.removeEventListener("ethereum#initialized",f),!!await this.getProvider()),p=typeof n=="number"?n:1e3;if(await Promise.race([...typeof window<"u"?[new Promise(m=>window.addEventListener("ethereum#initialized",()=>m(f()),{once:!0}))]:[],new Promise(m=>setTimeout(()=>m(f()),p))]))return!0}throw new ht}return!!(await Kl(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:u,chainId:d}){const h=await this.getProvider();if(!h)throw new ht;const f=l.chains.find(g=>g.id===d);if(!f)throw new ct(new As);const p=new Promise(g=>{const m=(y=>{"chainId"in y&&y.chainId===d&&(l.emitter.off("change",m),g())});l.emitter.on("change",m)});try{return await Promise.all([h.request({method:"wallet_switchEthereumChain",params:[{chainId:J(d)}]}).then(async()=>{await this.getChainId()===d&&l.emitter.emit("change",{chainId:d})}),p]),f}catch(g){const m=g;if(m.code===4902||m?.data?.originalError?.code===4902)try{const{default:y,...v}=f.blockExplorers??{};let x;u?.blockExplorerUrls?x=u.blockExplorerUrls:y&&(x=[y.url,...Object.values(v).map(w=>w.url)]);let C;u?.rpcUrls?.length?C=u.rpcUrls:C=[f.rpcUrls.default?.http[0]??""];const E={blockExplorerUrls:x,chainId:J(d),chainName:u?.chainName??f.name,iconUrls:u?.iconUrls,nativeCurrency:u?.nativeCurrency??f.nativeCurrency,rpcUrls:C};return await Promise.all([h.request({method:"wallet_addEthereumChain",params:[E]}).then(async()=>{if(await this.getChainId()===d)l.emitter.emit("change",{chainId:d});else throw new he(new Error("User rejected switch after adding network."))}),p]),f}catch(y){throw new he(y)}throw m.code===he.code?new he(m):new ct(m)}},async onAccountsChanged(u){if(u.length===0)this.onDisconnect();else if(l.emitter.listenerCount("connect")){const d=(await this.getChainId()).toString();this.onConnect({chainId:d}),t&&await l.storage?.removeItem(`${this.id}.disconnected`)}else l.emitter.emit("change",{accounts:u.map(d=>Rn(d))})},onChainChanged(u){const d=Number(u);l.emitter.emit("change",{chainId:d})},async onConnect(u){const d=await this.getAccounts();if(d.length===0)return;const h=Number(u.chainId);l.emitter.emit("connect",{accounts:d,chainId:h});const f=await this.getProvider();f&&(a&&(f.removeListener("connect",a),a=void 0),r||(r=this.onAccountsChanged.bind(this),f.on("accountsChanged",r)),o||(o=this.onChainChanged.bind(this),f.on("chainChanged",o)),i||(i=this.onDisconnect.bind(this),f.on("disconnect",i)))},async onDisconnect(u){const d=await this.getProvider();u&&u.code===1013&&d&&(await this.getAccounts()).length||(l.emitter.emit("disconnect"),d&&(o&&(d.removeListener("chainChanged",o),o=void 0),i&&(d.removeListener("disconnect",i),i=void 0),a||(a=this.onConnect.bind(this),d.on("connect",a))))}})}const $v={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(e){return e?.coinbaseWalletExtension?e.coinbaseWalletExtension:Kn(e,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(e){return Kn(e,t=>{if(!t.isMetaMask||t.isBraveWallet&&!t._events&&!t._state)return!1;const n=["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPhantom","isPortal","isRabby","isTokenPocket","isTokenary","isUniswapWallet","isZerion"];for(const s of n)if(t[s])return!1;return!0})}},phantom:{id:"phantom",name:"Phantom",provider(e){return e?.phantom?.ethereum?e.phantom?.ethereum:Kn(e,"isPhantom")}}};function Kn(e,t){function n(r){return typeof t=="function"?t(r):typeof t=="string"?r[t]:!0}const s=e.ethereum;if(s?.providers)return s.providers.find(r=>n(r));if(s&&n(s))return s}function zv(e){if(typeof window>"u")return;const t=n=>e(n.detail);return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)}function _v(){const e=new Set;let t=[];const n=()=>zv(r=>{t.some(({info:o})=>o.uuid===r.info.uuid)||(t=[...t,r],e.forEach(o=>o(t,{added:[r]})))});let s=n();return{_listeners(){return e},clear(){e.forEach(r=>r([],{removed:[...t]})),t=[]},destroy(){this.clear(),e.clear(),s?.()},findProvider({rdns:r}){return t.find(o=>o.info.rdns===r)},getProviders(){return t},reset(){this.clear(),s?.(),s=n()},subscribe(r,{emitImmediately:o}={}){return e.add(r),o&&r(t,{added:t}),()=>e.delete(r)}}}const Uv=e=>(t,n,s)=>{const r=s.subscribe;return s.subscribe=(a,i,l)=>{let u=a;if(i){const d=l?.equalityFn||Object.is;let h=a(s.getState());u=f=>{const p=a(f);if(!d(h,p)){const g=h;i(h=p,g)}},l?.fireImmediately&&i(h,h)}return r(u)},e(t,n,s)},Vv=Uv;function Bv(e,t){let n;try{n=e()}catch{return}return{getItem:r=>{var o;const a=l=>l===null?null:JSON.parse(l,void 0),i=(o=n.getItem(r))!=null?o:null;return i instanceof Promise?i.then(a):a(i)},setItem:(r,o)=>n.setItem(r,JSON.stringify(o,void 0)),removeItem:r=>n.removeItem(r)}}const Fs=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(s){return Fs(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return Fs(s)(n)}}}},Hv=(e,t)=>(n,s,r)=>{let o={storage:Bv(()=>localStorage),partialize:m=>m,version:0,merge:(m,y)=>({...y,...m}),...t},a=!1;const i=new Set,l=new Set;let u=o.storage;if(!u)return e((...m)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...m)},s,r);const d=()=>{const m=o.partialize({...s()});return u.setItem(o.name,{state:m,version:o.version})},h=r.setState;r.setState=(m,y)=>{h(m,y),d()};const f=e((...m)=>{n(...m),d()},s,r);r.getInitialState=()=>f;let p;const g=()=>{var m,y;if(!u)return;a=!1,i.forEach(x=>{var C;return x((C=s())!=null?C:f)});const v=((y=o.onRehydrateStorage)==null?void 0:y.call(o,(m=s())!=null?m:f))||void 0;return Fs(u.getItem.bind(u))(o.name).then(x=>{if(x)if(typeof x.version=="number"&&x.version!==o.version){if(o.migrate)return[!0,o.migrate(x.state,x.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,x.state];return[!1,void 0]}).then(x=>{var C;const[E,w]=x;if(p=o.merge(w,(C=s())!=null?C:f),n(p,!0),E)return d()}).then(()=>{v?.(p,void 0),p=s(),a=!0,l.forEach(x=>x(p))}).catch(x=>{v?.(void 0,x)})};return r.persist={setOptions:m=>{o={...o,...m},m.storage&&(u=m.storage)},clearStorage:()=>{u?.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>g(),hasHydrated:()=>a,onHydrate:m=>(i.add(m),()=>{i.delete(m)}),onFinishHydration:m=>(l.add(m),()=>{l.delete(m)})},o.skipHydration||g(),p||f},Wv=Hv,Za=e=>{let t;const n=new Set,s=(u,d)=>{const h=typeof u=="function"?u(t):u;if(!Object.is(h,t)){const f=t;t=d??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(p=>p(t,f))}},r=()=>t,i={setState:s,getState:r,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u))},l=t=e(s,r,i);return i},es=e=>e?Za(e):Za;var ts={exports:{}},ei;function qv(){return ei||(ei=1,(function(e){var t=Object.prototype.hasOwnProperty,n="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(n=!1));function r(l,u,d){this.fn=l,this.context=u,this.once=d||!1}function o(l,u,d,h,f){if(typeof d!="function")throw new TypeError("The listener must be a function");var p=new r(d,h||l,f),g=n?n+u:u;return l._events[g]?l._events[g].fn?l._events[g]=[l._events[g],p]:l._events[g].push(p):(l._events[g]=p,l._eventsCount++),l}function a(l,u){--l._eventsCount===0?l._events=new s:delete l._events[u]}function i(){this._events=new s,this._eventsCount=0}i.prototype.eventNames=function(){var u=[],d,h;if(this._eventsCount===0)return u;for(h in d=this._events)t.call(d,h)&&u.push(n?h.slice(1):h);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},i.prototype.listeners=function(u){var d=n?n+u:u,h=this._events[d];if(!h)return[];if(h.fn)return[h.fn];for(var f=0,p=h.length,g=new Array(p);f<p;f++)g[f]=h[f].fn;return g},i.prototype.listenerCount=function(u){var d=n?n+u:u,h=this._events[d];return h?h.fn?1:h.length:0},i.prototype.emit=function(u,d,h,f,p,g){var m=n?n+u:u;if(!this._events[m])return!1;var y=this._events[m],v=arguments.length,x,C;if(y.fn){switch(y.once&&this.removeListener(u,y.fn,void 0,!0),v){case 1:return y.fn.call(y.context),!0;case 2:return y.fn.call(y.context,d),!0;case 3:return y.fn.call(y.context,d,h),!0;case 4:return y.fn.call(y.context,d,h,f),!0;case 5:return y.fn.call(y.context,d,h,f,p),!0;case 6:return y.fn.call(y.context,d,h,f,p,g),!0}for(C=1,x=new Array(v-1);C<v;C++)x[C-1]=arguments[C];y.fn.apply(y.context,x)}else{var E=y.length,w;for(C=0;C<E;C++)switch(y[C].once&&this.removeListener(u,y[C].fn,void 0,!0),v){case 1:y[C].fn.call(y[C].context);break;case 2:y[C].fn.call(y[C].context,d);break;case 3:y[C].fn.call(y[C].context,d,h);break;case 4:y[C].fn.call(y[C].context,d,h,f);break;default:if(!x)for(w=1,x=new Array(v-1);w<v;w++)x[w-1]=arguments[w];y[C].fn.apply(y[C].context,x)}}return!0},i.prototype.on=function(u,d,h){return o(this,u,d,h,!1)},i.prototype.once=function(u,d,h){return o(this,u,d,h,!0)},i.prototype.removeListener=function(u,d,h,f){var p=n?n+u:u;if(!this._events[p])return this;if(!d)return a(this,p),this;var g=this._events[p];if(g.fn)g.fn===d&&(!f||g.once)&&(!h||g.context===h)&&a(this,p);else{for(var m=0,y=[],v=g.length;m<v;m++)(g[m].fn!==d||f&&!g[m].once||h&&g[m].context!==h)&&y.push(g[m]);y.length?this._events[p]=y.length===1?y[0]:y:a(this,p)}return this},i.prototype.removeAllListeners=function(u){var d;return u?(d=n?n+u:u,this._events[d]&&a(this,d)):(this._events=new s,this._eventsCount=0),this},i.prototype.off=i.prototype.removeListener,i.prototype.addListener=i.prototype.on,i.prefixed=n,i.EventEmitter=i,e.exports=i})(ts)),ts.exports}var Gv=qv();const Qv=Wi(Gv);class Yv{constructor(t){Object.defineProperty(this,"uid",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:new Qv})}on(t,n){this._emitter.on(t,n)}once(t,n){this._emitter.once(t,n)}off(t,n){this._emitter.off(t,n)}emit(t,...n){const s=n[0];this._emitter.emit(t,{uid:this.uid,...s})}listenerCount(t){return this._emitter.listenerCount(t)}}function Kv(e){return new Yv(e)}function Xv(e,t){return JSON.parse(e,(n,s)=>{let r=s;return r?.__type==="bigint"&&(r=BigInt(r.value)),r?.__type==="Map"&&(r=new Map(r.value)),t?.(n,r)??r})}function ti(e,t){return e.slice(0,t).join(".")||"."}function ni(e,t){const{length:n}=e;for(let s=0;s<n;++s)if(e[s]===t)return s+1;return 0}function Jv(e,t){const n=typeof e=="function",s=typeof t=="function",r=[],o=[];return function(i,l){if(typeof l=="object")if(r.length){const u=ni(r,this);u===0?r[r.length]=this:(r.splice(u),o.splice(u)),o[o.length]=i;const d=ni(r,l);if(d!==0)return s?t.call(this,i,l,ti(o,d)):`[ref=${ti(o,d)}]`}else r[0]=l,o[0]=i;return n?e.call(this,i,l):l}}function Zv(e,t,n,s){return JSON.stringify(e,Jv((r,o)=>{let a=o;return typeof a=="bigint"&&(a={__type:"bigint",value:o.toString()}),a instanceof Map&&(a={__type:"Map",value:Array.from(o.entries())}),t?.(r,a)??a},s),n??void 0)}function ex(e){const{deserialize:t=Xv,key:n="wagmi",serialize:s=Zv,storage:r=su}=e;function o(a){return a instanceof Promise?a.then(i=>i).catch(()=>null):a}return{...r,key:n,async getItem(a,i){const l=r.getItem(`${n}.${a}`),u=await o(l);return u?t(u)??null:i??null},async setItem(a,i){const l=`${n}.${a}`;i===null?await o(r.removeItem(l)):await o(r.setItem(l,s(i)))},async removeItem(a){await o(r.removeItem(`${n}.${a}`))}}}const su={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};function tx(){const e=typeof window<"u"&&window.localStorage?window.localStorage:su;return{getItem(t){return e.getItem(t)},removeItem(t){e.removeItem(t)},setItem(t,n){try{e.setItem(t,n)}catch{}}}}const $s=256;let $n=$s,zn;function nx(e=11){if(!zn||$n+e>$s*2){zn="",$n=0;for(let t=0;t<$s;t++)zn+=(256+Math.random()*256|0).toString(16).substring(1)}return zn.substring($n,$n+++e)}function rx(e){const{multiInjectedProviderDiscovery:t=!0,storage:n=ex({storage:tx()}),syncConnectedChain:s=!0,ssr:r=!1,...o}=e,a=typeof window<"u"&&t?_v():void 0,i=es(()=>o.chains),l=es(()=>{const w=[],j=new Set;for(const S of o.connectors??[]){const P=u(S);if(w.push(P),!r&&P.rdns){const N=typeof P.rdns=="string"?[P.rdns]:P.rdns;for(const T of N)j.add(T)}}if(!r&&a){const S=a.getProviders();for(const P of S)j.has(P.info.rdns)||w.push(u(d(P)))}return w});function u(w){const j=Kv(nx()),S={...w({emitter:j,chains:i.getState(),storage:n,transports:o.transports}),emitter:j,uid:j.uid};return j.on("connect",C),S.setup?.(),S}function d(w){const{info:j}=w,S=w.provider;return Do({target:{...j,id:j.rdns,provider:S}})}const h=new Map;function f(w={}){const j=w.chainId??y.getState().chainId,S=i.getState().find(N=>N.id===j);if(w.chainId&&!S)throw new As;{const N=h.get(y.getState().chainId);if(N&&!S)return N;if(!S)throw new As}{const N=h.get(j);if(N)return N}let P;if(o.client)P=o.client({chain:S});else{const N=S.id,T=i.getState().map(R=>R.id),I={},D=Object.entries(o);for(const[R,F]of D)if(!(R==="chains"||R==="client"||R==="connectors"||R==="transports"))if(typeof F=="object")if(N in F)I[R]=F[N];else{if(T.some(V=>V in F))continue;I[R]=F}else I[R]=F;P=Mv({...I,chain:S,batch:I.batch??{multicall:!0},transport:R=>o.transports[N]({...R,connectors:l})})}return h.set(j,P),P}function p(){return{chainId:i.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let g;const m="0.0.0-canary-";Yn.startsWith(m)?g=Number.parseInt(Yn.replace(m,""),10):g=Number.parseInt(Yn.split(".")[0]??"0",10);const y=es(Vv(n?Wv(p,{migrate(w,j){if(j===g)return w;const S=p(),P=v(w,S.chainId);return{...S,chainId:P}},name:"store",partialize(w){return{connections:{__type:"Map",value:Array.from(w.connections.entries()).map(([j,S])=>{const{id:P,name:N,type:T,uid:I}=S.connector;return[j,{...S,connector:{id:P,name:N,type:T,uid:I}}]})},chainId:w.chainId,current:w.current}},merge(w,j){typeof w=="object"&&w&&"status"in w&&delete w.status;const S=v(w,j.chainId);return{...j,...w,chainId:S}},skipHydration:r,storage:n,version:g}):p));y.setState(p());function v(w,j){return w&&typeof w=="object"&&"chainId"in w&&typeof w.chainId=="number"&&i.getState().some(S=>S.id===w.chainId)?w.chainId:j}s&&y.subscribe(({connections:w,current:j})=>j?w.get(j)?.chainId:void 0,w=>{if(i.getState().some(S=>S.id===w))return y.setState(S=>({...S,chainId:w??S.chainId}))}),a?.subscribe(w=>{const j=new Set,S=new Set;for(const N of l.getState())if(j.add(N.id),N.rdns){const T=typeof N.rdns=="string"?[N.rdns]:N.rdns;for(const I of T)S.add(I)}const P=[];for(const N of w){if(S.has(N.info.rdns))continue;const T=u(d(N));j.has(T.id)||P.push(T)}n&&!y.persist.hasHydrated()||l.setState(N=>[...N,...P],!0)});function x(w){y.setState(j=>{const S=j.connections.get(w.uid);return S?{...j,connections:new Map(j.connections).set(w.uid,{accounts:w.accounts??S.accounts,chainId:w.chainId??S.chainId,connector:S.connector})}:j})}function C(w){y.getState().status==="connecting"||y.getState().status==="reconnecting"||y.setState(j=>{const S=l.getState().find(P=>P.uid===w.uid);return S?(S.emitter.listenerCount("connect")&&S.emitter.off("connect",x),S.emitter.listenerCount("change")||S.emitter.on("change",x),S.emitter.listenerCount("disconnect")||S.emitter.on("disconnect",E),{...j,connections:new Map(j.connections).set(w.uid,{accounts:w.accounts,chainId:w.chainId,connector:S}),current:w.uid,status:"connected"}):j})}function E(w){y.setState(j=>{const S=j.connections.get(w.uid);if(S){const N=S.connector;N.emitter.listenerCount("change")&&S.connector.emitter.off("change",x),N.emitter.listenerCount("disconnect")&&S.connector.emitter.off("disconnect",E),N.emitter.listenerCount("connect")||S.connector.emitter.on("connect",C)}if(j.connections.delete(w.uid),j.connections.size===0)return{...j,connections:new Map,current:null,status:"disconnected"};const P=j.connections.values().next().value;return{...j,connections:new Map(j.connections),current:P.connector.uid}})}return{get chains(){return i.getState()},get connectors(){return l.getState()},storage:n,getClient:f,get state(){return y.getState()},setState(w){let j;typeof w=="function"?j=w(y.getState()):j=w;const S=p();typeof j!="object"&&(j=S),Object.keys(S).some(N=>!(N in j))&&(j=S),y.setState(j,!0)},subscribe(w,j,S){return y.subscribe(w,j,S?{...S,fireImmediately:S.emitImmediately}:void 0)},_internal:{mipd:a,async revalidate(){const w=y.getState(),j=w.connections;let S=w.current;for(const[,P]of j){const N=P.connector;N.isAuthorized&&await N.isAuthorized()||(j.delete(N.uid),S===N.uid&&(S=null))}y.setState(P=>({...P,connections:j,current:S}))},store:y,ssr:!!r,syncConnectedChain:s,transports:o.transports,chains:{setState(w){const j=typeof w=="function"?w(i.getState()):w;if(j.length!==0)return i.setState(j,!0)},subscribe(w){return i.subscribe(w)}},connectors:{providerDetailToConnector:d,setup:u,setState(w){return l.setState(typeof w=="function"?w(l.getState()):w,!0)},subscribe(w){return l.subscribe(w)}},events:{change:x,connect:C,disconnect:E}}}}function sx(e,t){const{initialState:n,reconnectOnMount:s}=t;return n&&!e._internal.store.persist.hasHydrated()&&e.setState({...n,chainId:e.chains.some(r=>r.id===n.chainId)?n.chainId:e.chains[0].id,connections:s?n.connections:new Map,status:s?"reconnecting":"disconnected"}),{async onMount(){e._internal.ssr&&(await e._internal.store.persist.rehydrate(),e._internal.mipd&&e._internal.connectors.setState(r=>{const o=new Set;for(const l of r??[])if(l.rdns){const u=Array.isArray(l.rdns)?l.rdns:[l.rdns];for(const d of u)o.add(d)}const a=[],i=e._internal.mipd?.getProviders()??[];for(const l of i){if(o.has(l.info.rdns))continue;const u=e._internal.connectors.providerDetailToConnector(l),d=e._internal.connectors.setup(u);a.push(d)}return[...r,...a]})),s?Lv(e):e.storage&&e.setState(r=>({...r,connections:new Map}))}}}function ox(e){const{children:t,config:n,initialState:s,reconnectOnMount:r=!0}=e,{onMount:o}=sx(n,{initialState:s,reconnectOnMount:r});n._internal.ssr||o();const a=b.useRef(!0);return b.useEffect(()=>{if(a.current&&n._internal.ssr)return o(),()=>{a.current=!1}},[]),t}const ou=b.createContext(void 0);function ax(e){const{children:t,config:n}=e,s={value:n};return b.createElement(ox,e,b.createElement(ou.Provider,s,t))}const ix="2.19.2",cx=()=>`wagmi@${ix}`;class lx extends To{constructor(){super(...arguments),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiError"})}get docsBaseUrl(){return"https://wagmi.sh/react"}get version(){return cx()}}class ux extends lx{constructor(){super("`useConfig` must be used within `WagmiProvider`.",{docsPath:"/api/WagmiProvider"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiProviderNotFoundError"})}}function ko(e={}){const t=e.config??b.useContext(ou);if(!t)throw new ux;return t}var jn=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},dx={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},fx=class{#e=dx;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},Ze=new fx;function hx(e){setTimeout(e,0)}var lt=typeof window>"u"||"Deno"in globalThis;function me(){}function px(e,t){return typeof e=="function"?e(t):e}function zs(e){return typeof e=="number"&&e>=0&&e!==1/0}function au(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Qe(e,t){return typeof e=="function"?e(t):e}function we(e,t){return typeof e=="function"?e(t):e}function ri(e,t){const{type:n="all",exact:s,fetchStatus:r,predicate:o,queryKey:a,stale:i}=e;if(a){if(s){if(t.queryHash!==Ro(a,t.options))return!1}else if(!pn(t.queryKey,a))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof i=="boolean"&&t.isStale()!==i||r&&r!==t.state.fetchStatus||o&&!o(t))}function si(e,t){const{exact:n,status:s,predicate:r,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(hn(t.options.mutationKey)!==hn(o))return!1}else if(!pn(t.options.mutationKey,o))return!1}return!(s&&t.state.status!==s||r&&!r(t))}function Ro(e,t){return(t?.queryKeyHashFn||hn)(e)}function hn(e){return JSON.stringify(e,(t,n)=>Us(n)?Object.keys(n).sort().reduce((s,r)=>(s[r]=n[r],s),{}):n)}function pn(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>pn(e[n],t[n])):!1}var mx=Object.prototype.hasOwnProperty;function iu(e,t){if(e===t)return e;const n=oi(e)&&oi(t);if(!n&&!(Us(e)&&Us(t)))return t;const r=(n?e:Object.keys(e)).length,o=n?t:Object.keys(t),a=o.length,i=n?new Array(a):{};let l=0;for(let u=0;u<a;u++){const d=n?u:o[u],h=e[d],f=t[d];if(h===f){i[d]=h,(n?u<r:mx.call(e,d))&&l++;continue}if(h===null||f===null||typeof h!="object"||typeof f!="object"){i[d]=f;continue}const p=iu(h,f);i[d]=p,p===h&&l++}return r===a&&l===r?e:i}function _s(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function oi(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Us(e){if(!ai(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!ai(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function ai(e){return Object.prototype.toString.call(e)==="[object Object]"}function gx(e){return new Promise(t=>{Ze.setTimeout(t,e)})}function Vs(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?iu(e,t):t}function bx(e,t,n=0){const s=[...e,t];return n&&s.length>n?s.slice(1):s}function yx(e,t,n=0){const s=[t,...e];return n&&s.length>n?s.slice(0,-1):s}var Ao=Symbol();function cu(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Ao?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function vx(e,t){return typeof e=="function"?e(...t):!!e}var xx=class extends jn{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!lt&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},Lo=new xx;function Bs(){let e,t;const n=new Promise((r,o)=>{e=r,t=o});n.status="pending",n.catch(()=>{});function s(r){Object.assign(n,r),delete n.resolve,delete n.reject}return n.resolve=r=>{s({status:"fulfilled",value:r}),e(r)},n.reject=r=>{s({status:"rejected",reason:r}),t(r)},n}var wx=hx;function Cx(){let e=[],t=0,n=i=>{i()},s=i=>{i()},r=wx;const o=i=>{t?e.push(i):r(()=>{n(i)})},a=()=>{const i=e;e=[],i.length&&r(()=>{s(()=>{i.forEach(l=>{n(l)})})})};return{batch:i=>{let l;t++;try{l=i()}finally{t--,t||a()}return l},batchCalls:i=>(...l)=>{o(()=>{i(...l)})},schedule:o,setNotifyFunction:i=>{n=i},setBatchNotifyFunction:i=>{s=i},setScheduler:i=>{r=i}}}var ue=Cx(),Sx=class extends jn{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!lt&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#e}},fr=new Sx;function jx(e){return Math.min(1e3*2**e,3e4)}function lu(e){return(e??"online")==="online"?fr.isOnline():!0}var Hs=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function uu(e){let t=!1,n=0,s;const r=Bs(),o=()=>r.status!=="pending",a=m=>{if(!o()){const y=new Hs(m);f(y),e.onCancel?.(y)}},i=()=>{t=!0},l=()=>{t=!1},u=()=>Lo.isFocused()&&(e.networkMode==="always"||fr.isOnline())&&e.canRun(),d=()=>lu(e.networkMode)&&e.canRun(),h=m=>{o()||(s?.(),r.resolve(m))},f=m=>{o()||(s?.(),r.reject(m))},p=()=>new Promise(m=>{s=y=>{(o()||u())&&m(y)},e.onPause?.()}).then(()=>{s=void 0,o()||e.onContinue?.()}),g=()=>{if(o())return;let m;const y=n===0?e.initialPromise:void 0;try{m=y??e.fn()}catch(v){m=Promise.reject(v)}Promise.resolve(m).then(h).catch(v=>{if(o())return;const x=e.retry??(lt?0:3),C=e.retryDelay??jx,E=typeof C=="function"?C(n,v):C,w=x===!0||typeof x=="number"&&n<x||typeof x=="function"&&x(n,v);if(t||!w){f(v);return}n++,e.onFail?.(n,v),gx(E).then(()=>u()?void 0:p()).then(()=>{t?f(v):g()})})};return{promise:r,status:()=>r.status,cancel:a,continue:()=>(s?.(),r),cancelRetry:i,continueRetry:l,canStart:d,start:()=>(d()?g():p().then(g),r)}}var du=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),zs(this.gcTime)&&(this.#e=Ze.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(lt?1/0:300*1e3))}clearGcTimeout(){this.#e&&(Ze.clearTimeout(this.#e),this.#e=void 0)}},Px=class extends du{#e;#t;#n;#s;#r;#i;#a;constructor(e){super(),this.#a=!1,this.#i=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#s=e.client,this.#n=this.#s.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=ci(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#r?.promise}setOptions(e){if(this.options={...this.#i,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=ci(this.options);t.data!==void 0&&(this.setState(ii(t.data,t.dataUpdatedAt)),this.#e=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const n=Vs(this.state.data,e,this.options);return this.#o({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#o({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#r?.promise;return this.#r?.cancel(e),t?t.then(me).catch(me):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>we(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ao||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Qe(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!au(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#r&&(this.#a?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#o({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(e&&this.setOptions(e),!this.options.queryFn){const i=this.observers.find(l=>l.options.queryFn);i&&this.setOptions(i.options)}const n=new AbortController,s=i=>{Object.defineProperty(i,"signal",{enumerable:!0,get:()=>(this.#a=!0,n.signal)})},r=()=>{const i=cu(this.options,t),u=(()=>{const d={client:this.#s,queryKey:this.queryKey,meta:this.meta};return s(d),d})();return this.#a=!1,this.options.persister?this.options.persister(i,u,this):i(u)},a=(()=>{const i={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#s,state:this.state,fetchFn:r};return s(i),i})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#o({type:"fetch",meta:a.fetchOptions?.meta}),this.#r=uu({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:i=>{i instanceof Hs&&i.revert&&this.setState({...this.#t,fetchStatus:"idle"}),n.abort()},onFail:(i,l)=>{this.#o({type:"failed",failureCount:i,error:l})},onPause:()=>{this.#o({type:"pause"})},onContinue:()=>{this.#o({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{const i=await this.#r.start();if(i===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(i),this.#n.config.onSuccess?.(i,this),this.#n.config.onSettled?.(i,this.state.error,this),i}catch(i){if(i instanceof Hs){if(i.silent)return this.#r.promise;if(i.revert){if(this.state.data===void 0)throw i;return this.state.data}}throw this.#o({type:"error",error:i}),this.#n.config.onError?.(i,this),this.#n.config.onSettled?.(this.state.data,i,this),i}finally{this.scheduleGc()}}#o(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...fu(n.data,this.options),fetchMeta:e.meta??null};case"success":const s={...n,...ii(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?s:void 0,s;case"error":const r=e.error;return{...n,error:r,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),ue.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function fu(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:lu(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function ii(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function ci(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,s=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Ex=class extends jn{constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.#a=Bs(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#s=void 0;#r;#i;#a;#o;#m;#f;#h;#l;#u;#c;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),li(this.#t,this.options)?this.#d():this.updateResult(),this.#v())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ws(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ws(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#w(),this.#t.removeObserver(this)}setOptions(e){const t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof we(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#C(),this.#t.setOptions(this.options),t._defaulted&&!_s(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const s=this.hasListeners();s&&ui(this.#t,n,this.options,t)&&this.#d(),this.updateResult(),s&&(this.#t!==n||we(this.options.enabled,this.#t)!==we(t.enabled,this.#t)||Qe(this.options.staleTime,this.#t)!==Qe(t.staleTime,this.#t))&&this.#g();const r=this.#b();s&&(this.#t!==n||we(this.options.enabled,this.#t)!==we(t.enabled,this.#t)||r!==this.#c)&&this.#y(r)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Ox(this,n)&&(this.#s=n,this.#i=this.options,this.#r=this.#t.state),n}getCurrentResult(){return this.#s}trackResult(e,t){return new Proxy(e,{get:(n,s)=>(this.trackProp(s),t?.(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#a.status==="pending"&&this.#a.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,s))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#s))}#d(e){this.#C();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(me)),t}#g(){this.#x();const e=Qe(this.options.staleTime,this.#t);if(lt||this.#s.isStale||!zs(e))return;const n=au(this.#s.dataUpdatedAt,e)+1;this.#l=Ze.setTimeout(()=>{this.#s.isStale||this.updateResult()},n)}#b(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#y(e){this.#w(),this.#c=e,!(lt||we(this.options.enabled,this.#t)===!1||!zs(this.#c)||this.#c===0)&&(this.#u=Ze.setInterval(()=>{(this.options.refetchIntervalInBackground||Lo.isFocused())&&this.#d()},this.#c))}#v(){this.#g(),this.#y(this.#b())}#x(){this.#l&&(Ze.clearTimeout(this.#l),this.#l=void 0)}#w(){this.#u&&(Ze.clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const n=this.#t,s=this.options,r=this.#s,o=this.#r,a=this.#i,l=e!==n?e.state:this.#n,{state:u}=e;let d={...u},h=!1,f;if(t._optimisticResults){const P=this.hasListeners(),N=!P&&li(e,t),T=P&&ui(e,n,t,s);(N||T)&&(d={...d,...fu(u.data,e.options)}),t._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:p,errorUpdatedAt:g,status:m}=d;f=d.data;let y=!1;if(t.placeholderData!==void 0&&f===void 0&&m==="pending"){let P;r?.isPlaceholderData&&t.placeholderData===a?.placeholderData?(P=r.data,y=!0):P=typeof t.placeholderData=="function"?t.placeholderData(this.#h?.state.data,this.#h):t.placeholderData,P!==void 0&&(m="success",f=Vs(r?.data,P,t),h=!0)}if(t.select&&f!==void 0&&!y)if(r&&f===o?.data&&t.select===this.#m)f=this.#f;else try{this.#m=t.select,f=t.select(f),f=Vs(r?.data,f,t),this.#f=f,this.#o=null}catch(P){this.#o=P}this.#o&&(p=this.#o,f=this.#f,g=Date.now(),m="error");const v=d.fetchStatus==="fetching",x=m==="pending",C=m==="error",E=x&&v,w=f!==void 0,S={status:m,fetchStatus:d.fetchStatus,isPending:x,isSuccess:m==="success",isError:C,isInitialLoading:E,isLoading:E,data:f,dataUpdatedAt:d.dataUpdatedAt,error:p,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:v,isRefetching:v&&!x,isLoadingError:C&&!w,isPaused:d.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:C&&w,isStale:Fo(e,t),refetch:this.refetch,promise:this.#a,isEnabled:we(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const P=I=>{S.status==="error"?I.reject(S.error):S.data!==void 0&&I.resolve(S.data)},N=()=>{const I=this.#a=S.promise=Bs();P(I)},T=this.#a;switch(T.status){case"pending":e.queryHash===n.queryHash&&P(T);break;case"fulfilled":(S.status==="error"||S.data!==T.value)&&N();break;case"rejected":(S.status!=="error"||S.error!==T.reason)&&N();break}}return S}updateResult(){const e=this.#s,t=this.createResult(this.#t,this.options);if(this.#r=this.#t.state,this.#i=this.options,this.#r.data!==void 0&&(this.#h=this.#t),_s(t,e))return;this.#s=t;const n=()=>{if(!e)return!0;const{notifyOnChangeProps:s}=this.options,r=typeof s=="function"?s():s;if(r==="all"||!r&&!this.#p.size)return!0;const o=new Set(r??this.#p);return this.options.throwOnError&&o.add("error"),Object.keys(this.#s).some(a=>{const i=a;return this.#s[i]!==e[i]&&o.has(i)})};this.#S({listeners:n()})}#C(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#v()}#S(e){ue.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#s)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function Nx(e,t){return we(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function li(e,t){return Nx(e,t)||e.state.data!==void 0&&Ws(e,t,t.refetchOnMount)}function Ws(e,t,n){if(we(t.enabled,e)!==!1&&Qe(t.staleTime,e)!=="static"){const s=typeof n=="function"?n(e):n;return s==="always"||s!==!1&&Fo(e,t)}return!1}function ui(e,t,n,s){return(e!==t||we(s.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Fo(e,n)}function Fo(e,t){return we(t.enabled,e)!==!1&&e.isStaleByTime(Qe(t.staleTime,e))}function Ox(e,t){return!_s(e.getCurrentResult(),t)}function di(e){return{onFetch:(t,n)=>{const s=t.options,r=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],a=t.state.data?.pageParams||[];let i={pages:[],pageParams:[]},l=0;const u=async()=>{let d=!1;const h=g=>{Object.defineProperty(g,"signal",{enumerable:!0,get:()=>(t.signal.aborted?d=!0:t.signal.addEventListener("abort",()=>{d=!0}),t.signal)})},f=cu(t.options,t.fetchOptions),p=async(g,m,y)=>{if(d)return Promise.reject();if(m==null&&g.pages.length)return Promise.resolve(g);const x=(()=>{const j={client:t.client,queryKey:t.queryKey,pageParam:m,direction:y?"backward":"forward",meta:t.options.meta};return h(j),j})(),C=await f(x),{maxPages:E}=t.options,w=y?yx:bx;return{pages:w(g.pages,C,E),pageParams:w(g.pageParams,m,E)}};if(r&&o.length){const g=r==="backward",m=g?Ix:fi,y={pages:o,pageParams:a},v=m(s,y);i=await p(y,v,g)}else{const g=e??o.length;do{const m=l===0?a[0]??s.initialPageParam:fi(s,i);if(l>0&&m==null)break;i=await p(i,m),l++}while(l<g)}return i};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=u}}}function fi(e,{pages:t,pageParams:n}){const s=t.length-1;return t.length>0?e.getNextPageParam(t[s],t,n[s],n):void 0}function Ix(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Mx=class extends du{#e;#t;#n;#s;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Tx(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#s?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#r({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#s=uu({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(o,a)=>{this.#r({type:"failed",failureCount:o,error:a})},onPause:()=>{this.#r({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const s=this.state.status==="pending",r=!this.#s.canStart();try{if(s)t();else{this.#r({type:"pending",variables:e,isPaused:r}),await this.#n.config.onMutate?.(e,this,n);const a=await this.options.onMutate?.(e,n);a!==this.state.context&&this.#r({type:"pending",context:a,variables:e,isPaused:r})}const o=await this.#s.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#r({type:"success",data:o}),o}catch(o){try{throw await this.#n.config.onError?.(o,e,this.state.context,this,n),await this.options.onError?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(void 0,o,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(void 0,o,e,this.state.context,n),o}finally{this.#r({type:"error",error:o})}}finally{this.#n.runNext(this)}}#r(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),ue.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function Tx(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Dx=class extends jn{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){const s=new Mx({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(s),s}add(e){this.#e.add(e);const t=_n(e);if(typeof t=="string"){const n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=_n(e);if(typeof t=="string"){const n=this.#t.get(t);if(n)if(n.length>1){const s=n.indexOf(e);s!==-1&&n.splice(s,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=_n(e);if(typeof t=="string"){const s=this.#t.get(t)?.find(r=>r.state.status==="pending");return!s||s===e}else return!0}runNext(e){const t=_n(e);return typeof t=="string"?this.#t.get(t)?.find(s=>s!==e&&s.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){ue.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>si(t,n))}findAll(e={}){return this.getAll().filter(t=>si(e,t))}notify(e){ue.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return ue.batch(()=>Promise.all(e.map(t=>t.continue().catch(me))))}};function _n(e){return e.options.scope?.id}var kx=class extends jn{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){const s=t.queryKey,r=t.queryHash??Ro(s,t);let o=this.get(r);return o||(o=new Px({client:e,queryKey:s,queryHash:r,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(s)}),this.add(o)),o}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){ue.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>ri(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>ri(e,n)):t}notify(e){ue.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){ue.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ue.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Rx=class{#e;#t;#n;#s;#r;#i;#a;#o;constructor(e={}){this.#e=e.queryCache||new kx,this.#t=e.mutationCache||new Dx,this.#n=e.defaultOptions||{},this.#s=new Map,this.#r=new Map,this.#i=0}mount(){this.#i++,this.#i===1&&(this.#a=Lo.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#o=fr.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#i--,this.#i===0&&(this.#a?.(),this.#a=void 0,this.#o?.(),this.#o=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#e.build(this,t),s=n.state.data;return s===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Qe(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(s))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:n})=>{const s=n.data;return[t,s]})}setQueryData(e,t,n){const s=this.defaultQueryOptions({queryKey:e}),o=this.#e.get(s.queryHash)?.state.data,a=px(t,o);if(a!==void 0)return this.#e.build(this,s).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return ue.batch(()=>this.#e.findAll(e).map(({queryKey:s})=>[s,this.setQueryData(s,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;ue.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return ue.batch(()=>(n.findAll(e).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},s=ue.batch(()=>this.#e.findAll(e).map(r=>r.cancel(n)));return Promise.all(s).then(me).catch(me)}invalidateQueries(e,t={}){return ue.batch(()=>(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},s=ue.batch(()=>this.#e.findAll(e).filter(r=>!r.isDisabled()&&!r.isStatic()).map(r=>{let o=r.fetch(void 0,n);return n.throwOnError||(o=o.catch(me)),r.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(s).then(me)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime(Qe(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(me).catch(me)}fetchInfiniteQuery(e){return e.behavior=di(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(me).catch(me)}ensureInfiniteQueryData(e){return e.behavior=di(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return fr.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#s.set(hn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#s.values()],n={};return t.forEach(s=>{pn(e,s.queryKey)&&Object.assign(n,s.defaultOptions)}),n}setMutationDefaults(e,t){this.#r.set(hn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(s=>{pn(e,s.mutationKey)&&Object.assign(n,s.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ro(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Ao&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};function Ax(e){return JSON.stringify(e,(t,n)=>Lx(n)?Object.keys(n).sort().reduce((s,r)=>(s[r]=n[r],s),{}):typeof n=="bigint"?n.toString():n)}function Lx(e){if(!hi(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!hi(n)||!n.hasOwnProperty("isPrototypeOf"))}function hi(e){return Object.prototype.toString.call(e)==="[object Object]"}function hu(e){const{_defaulted:t,behavior:n,gcTime:s,initialData:r,initialDataUpdatedAt:o,maxPages:a,meta:i,networkMode:l,queryFn:u,queryHash:d,queryKey:h,queryKeyHashFn:f,retry:p,retryDelay:g,structuralSharing:m,getPreviousPageParam:y,getNextPageParam:v,initialPageParam:x,_optimisticResults:C,enabled:E,notifyOnChangeProps:w,placeholderData:j,refetchInterval:S,refetchIntervalInBackground:P,refetchOnMount:N,refetchOnReconnect:T,refetchOnWindowFocus:I,retryOnMount:D,select:R,staleTime:F,suspense:$,throwOnError:V,config:W,connector:q,query:Z,...ee}=e;return ee}function Fx(e,t={}){return{async queryFn({queryKey:n}){const{name:s,scopeKey:r,...o}=n[1];if(!s)throw new Error("name is required");return Rv(e,{...o,name:s})},queryKey:$x(t)}}function $x(e={}){return["ensAvatar",hu(e)]}function zx(e,t={}){return{async queryFn({queryKey:n}){const{address:s,scopeKey:r,...o}=n[1];if(!s)throw new Error("address is required");return Av(e,{...o,address:s})},queryKey:_x(t)}}function _x(e={}){return["ensName",hu(e)]}var pu=b.createContext(void 0),Ux=e=>{const t=b.useContext(pu);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Vx=({client:e,children:t})=>(b.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),c.jsx(pu.Provider,{value:e,children:t})),mu=b.createContext(!1),Bx=()=>b.useContext(mu);mu.Provider;function Hx(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Wx=b.createContext(Hx()),qx=()=>b.useContext(Wx),Gx=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Qx=e=>{b.useEffect(()=>{e.clearReset()},[e])},Yx=({result:e,errorResetBoundary:t,throwOnError:n,query:s,suspense:r})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(r&&e.data===void 0||vx(n,[e.error,s])),Kx=e=>{if(e.suspense){const n=r=>r==="static"?r:Math.max(r??1e3,1e3),s=e.staleTime;e.staleTime=typeof s=="function"?(...r)=>n(s(...r)):n(s),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Xx=(e,t)=>e.isLoading&&e.isFetching&&!t,Jx=(e,t)=>e?.suspense&&t.isPending,pi=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Zx(e,t,n){const s=Bx(),r=qx(),o=Ux(),a=o.defaultQueryOptions(e);o.getDefaultOptions().queries?._experimental_beforeQuery?.(a),a._optimisticResults=s?"isRestoring":"optimistic",Kx(a),Gx(a,r),Qx(r);const i=!o.getQueryCache().get(a.queryHash),[l]=b.useState(()=>new t(o,a)),u=l.getOptimisticResult(a),d=!s&&e.subscribed!==!1;if(b.useSyncExternalStore(b.useCallback(h=>{const f=d?l.subscribe(ue.batchCalls(h)):me;return l.updateResult(),f},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),b.useEffect(()=>{l.setOptions(a)},[a,l]),Jx(a,u))throw pi(a,l,r);if(Yx({result:u,errorResetBoundary:r,throwOnError:a.throwOnError,query:o.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw u.error;return o.getDefaultOptions().queries?._experimental_afterQuery?.(a,u),a.experimental_prefetchInRender&&!lt&&Xx(u,s)&&(i?pi(a,l,r):o.getQueryCache().get(a.queryHash)?.promise)?.catch(me).finally(()=>{l.updateResult()}),a.notifyOnChangeProps?u:l.trackResult(u)}function e5(e,t){return Zx(e,Ex)}function gu(e){const t=e5({...e,queryKeyHashFn:Ax});return t.queryKey=e.queryKey,t}function bu(e={}){const t=ko(e);return b.useSyncExternalStore(n=>Fv(t,{onChange:n}),()=>Ja(t),()=>Ja(t))}function t5(e={}){const{name:t,query:n={}}=e,s=ko(e),r=bu({config:s}),o=Fx(s,{...e,chainId:e.chainId??r}),a=!!(t&&(n.enabled??!0));return gu({...n,...o,enabled:a})}function yu(e={}){const{address:t,query:n={}}=e,s=ko(e),r=bu({config:s}),o=zx(s,{...e,chainId:e.chainId??r}),a=!!(t&&(n.enabled??!0));return gu({...n,...o,enabled:a})}const n5=new URL("/assets/powerhouse-rounded-CeKGGUG4.png",import.meta.url).href;function vu(e){const{address:t,chainId:n=1,size:s="14px"}=e,r={width:s,height:s},o=yu({address:t,chainId:n}),a=o.data??void 0,i=t5({name:a}),l=i.data??n5;return o.isLoading||i.isLoading?c.jsx("div",{className:"fade-out flex-none animate-pulse rounded-full bg-gray-400",style:r}):c.jsx("img",{alt:"ENS Avatar",className:"flex-none rounded-full object-contain",src:l,style:r})}const xu=["RENAME","DELETE","DUPLICATE"],r5=[{value:"LOCAL",icon:c.jsx(O,{name:"Lock"}),description:"Only available to you"},{value:"CLOUD",icon:c.jsx(O,{name:"People"}),description:"Only available to people in this drive"},{value:"PUBLIC",icon:c.jsx(O,{name:"Globe"}),description:"Available to everyone",disabled:!0}],s5={CLOUD:{title:"Secure cloud",description:"End to end encryption between members.",icon:c.jsx(O,{name:"Lock"})},LOCAL:{title:"Local",description:"Private and only available to you.",icon:c.jsx(O,{name:"Hdd"})},SWITCHBOARD:{title:"Switchboard",description:"Public and available to everyone.",icon:c.jsx(O,{name:"Drive"})}},o5={ADD_TRIGGER:{label:"Add Trigger",icon:c.jsx(O,{className:"text-orange-900",name:"Plus"})},REMOVE_TRIGGER:{label:"Remove Trigger",icon:c.jsx(O,{className:"text-orange-900",name:"Xmark"})},ADD_INVALID_TRIGGER:{label:"Add Trigger",icon:c.jsx(O,{className:"text-orange-900",name:"Exclamation"})}},a5={DUPLICATE:{label:"Duplicate",icon:c.jsx(O,{name:"FilesEarmark"})},RENAME:{label:"Rename",icon:c.jsx(O,{name:"Pencil"})},DELETE:{label:"Delete",icon:c.jsx(O,{name:"Trash"}),className:"text-red-900"},SETTINGS:{label:"Settings",icon:c.jsx(O,{name:"Gear"})}},wu={...o5,...a5};function Cu(e){const{node:t}=e,[n,s]=b.useState(!1),r=b.useCallback(a=>{a.dataTransfer.setData("UI_NODE",JSON.stringify(t))},[t]),o=b.useCallback(()=>{s(!1)},[]);return b.useMemo(()=>({isDragging:n,dragProps:{draggable:!0,onDragStart:r,onDragEnd:o}}),[n,o,r])}const Su="powerhouse/budget-statement",$o="powerhouse/default",ju="makerdao/rwa-portfolio",i5=[Su,$o,ju],c5=new URL("../../../../../assets/icons/budget.png",import.meta.url).href,l5=new URL("../../../../../assets/icons/rwa-report.png",import.meta.url).href,u5=new URL("../../../../../assets/icons/template.png",import.meta.url).href,mi={[Su]:c5,[$o]:u5,[ju]:l5};function d5(e,t){return t||(i5.includes(e)?mi[e]:mi[$o])}const gi="SYNCING",bi="SUCCESS",yi="CONFLICT",vi="MISSING",xi="ERROR",wi="INITIAL_SYNC",f5={SYNCING:"Syncing",SUCCESS:"Synced",CONFLICT:"Error",MISSING:"Circle",ERROR:"Error",INITIAL_SYNC:"Syncing"};function h5(e){const{syncStatus:t,className:n,overrideSyncIcons:s={},...r}=e,o={...f5,...s};return{[wi]:c.jsx(O,{size:16,...r,className:M("text-blue-900",n),name:o[wi]}),[gi]:c.jsx(O,{size:16,...r,className:M("text-blue-900",n),name:o[gi]}),[bi]:c.jsx(O,{size:16,...r,className:M("text-green-900",n),name:o[bi]}),[yi]:c.jsx(O,{size:16,...r,className:M("text-orange-900",n),name:o[yi]}),[vi]:c.jsx(O,{size:16,...r,className:M("text-red-900",n),name:o[vi]}),[xi]:c.jsx(O,{size:16,...r,className:M("text-red-900",n),name:o[xi]})}[t]}function Ow(e){const{fileNode:t,className:n,customDocumentIconSrc:s}=e,[r,o]=b.useState("READ"),[a,i]=b.useState(!1),[l]=Li(),u=l?os(l):"LOCAL",{dragProps:d}=Cu({node:t}),{isAllowedToCreateDocuments:h}=Ks(),{onRenameNode:f,onDuplicateNode:p}=Xs(),g=r==="READ",m=ad(t.id,u),y={DUPLICATE:()=>p(t),RENAME:()=>o("WRITE"),DELETE:()=>$i(t)},v=Object.entries(wu).map(([N,T])=>({...T,id:N})).filter(N=>xu.includes(N.id));function x(N){f(N,t).catch(T=>{console.error(T)}).finally(()=>{o("READ")})}function C(){o("READ")}function E(N){const T=y[N];if(!T){console.error(`No handler found for dropdown menu item: ${N}`);return}T(),i(!1)}const w=d5(t.documentType,s),j=c.jsxs("div",{className:"relative",children:[c.jsx("img",{alt:"file icon",className:"max-w-none",height:34,src:w,width:32}),g&&m&&c.jsx("div",{className:"absolute bottom-[-2px] right-0 size-3 rounded-full bg-white",children:c.jsx("div",{className:"absolute left-[-2px] top-[-2px]",children:c.jsx(h5,{overrideSyncIcons:{SUCCESS:"CheckCircleFill"},syncStatus:m})})})]}),S=M("group flex h-12 cursor-pointer select-none items-center rounded-lg bg-gray-200 px-2 text-gray-600 hover:text-gray-800",n),P=g?c.jsxs("div",{className:"flex w-52 items-center justify-between",children:[c.jsxs("div",{className:"mr-2 truncate group-hover:mr-0",children:[c.jsx("div",{className:"max-h-6 truncate text-sm font-medium group-hover:text-gray-800",children:t.name}),c.jsx("div",{className:"max-h-6 truncate text-xs font-medium text-gray-600 group-hover:text-gray-800",children:t.documentType})]}),h?c.jsx(Er,{items:v,onItemClick:E,onOpenChange:i,open:a,children:c.jsx("button",{className:M("hidden group-hover:block",a&&"block"),onClick:N=>{N.stopPropagation(),i(!0)},children:c.jsx(O,{className:"text-gray-600",name:"VerticalDots"})})}):null]}):c.jsx(no,{className:"ml-3 flex-1 font-medium",defaultValue:t.name,onCancel:C,onSubmit:x});return c.jsx("div",{className:"relative w-64",onClick:()=>xt(t),children:c.jsx("div",{...d,className:S,children:c.jsxs("div",{className:"flex items-center",children:[c.jsx("div",{className:"mr-1.5",children:j}),P]})})})}function Iw(e){const{folderNode:t,className:n}=e,{isAllowedToCreateDocuments:s}=Ks(),[r,o]=b.useState("READ"),[a,i]=b.useState(!1),{dragProps:l}=Cu({node:t}),{onRenameNode:u,onDuplicateNode:d}=Xs(),{isDropTarget:h,dropProps:f}=el({target:t}),p=r==="READ";function g(){o("READ")}function m(w){u(w,t).catch(j=>{console.error(j)}).finally(()=>{o("READ")})}const y={DUPLICATE:()=>d(t),RENAME:()=>o("WRITE"),DELETE:()=>$i(t)},v=Object.entries(wu).map(([w,j])=>({...j,id:w})).filter(w=>xu.includes(w.id));function x(w){const j=y[w];if(!j){console.error(`No handler found for dropdown menu item: ${w}`);return}j(),i(!1)}const C=p||!s?c.jsx("div",{className:"ml-3 max-h-6 truncate font-medium text-gray-600 group-hover:text-gray-800",children:t.name}):c.jsx(no,{className:"ml-3 font-medium",defaultValue:t.name,onCancel:g,onSubmit:m}),E=M("group flex h-12 cursor-pointer select-none items-center rounded-lg bg-gray-200 px-2",n,h&&"bg-blue-100");return c.jsx("div",{className:"relative w-64",onClick:()=>xt(t),children:c.jsxs("div",{...l,...f,className:E,children:[c.jsxs("div",{className:"flex items-center overflow-hidden",children:[c.jsx("div",{className:"p-1",children:c.jsx("div",{className:"relative",children:c.jsx(O,{name:"FolderClose",size:24})})}),C]}),p&&s?c.jsx(Er,{items:v,onItemClick:x,onOpenChange:i,open:a,children:c.jsx("button",{className:M("ml-auto hidden group-hover:block",a&&"block"),onClick:w=>{w.stopPropagation(),i(!0)},children:c.jsx(O,{className:"text-gray-600",name:"VerticalDots"})})}):null]})})}const Pn=b.forwardRef(function(t,n){const{icon:s,errorMessage:r,isDirty:o,containerClassName:a,inputClassName:i,errorMessageClassName:l,hideErrors:u=!1,...d}=t,h=t.type??"text",f=!!r;return c.jsxs("div",{children:[c.jsxs("div",{className:M("mb-1 flex gap-2 rounded-md border border-gray-200 bg-gray-50 p-3 text-black placeholder:text-gray-50",f&&"border-red-900",a),children:[s&&c.jsx("span",{className:Zs((!o||f)&&"text-slate-200"),children:s}),c.jsx("input",{...d,className:M("w-full bg-transparent font-semibold outline-none",i),ref:n,type:h})]}),c.jsx("p",{className:M("hidden min-h-4 text-xs text-red-900",f&&"block",u&&"hidden",l),children:r})]})});function p5(e){return{value:e.id,displayValue:e.name,icon:c.jsx(O,{name:"PowerhouseLogoSmall"}),description:"Built by Powerhouse"}}function m5(e){const{control:t,appOptions:n,...s}=e,r=n.map(p5);return c.jsx(Ai,{control:t,name:"appId",render:({field:o})=>c.jsx(yt,{...s,...o,id:"appId",items:r})})}const g5=b.forwardRef(function(t,n){return c.jsxs("label",{className:"relative cursor-pointer items-center",htmlFor:t.id,children:[c.jsx("input",{className:"peer sr-only",ref:n,type:"checkbox",value:"",...t}),c.jsx("div",{className:"peer h-6 w-11 rounded-full bg-gray-500 after:absolute after:start-0.5 after:top-0.5 after:size-5 after:rounded-full after:border after:border-none after:bg-gray-50 after:transition-all peer-checked:bg-blue-900 peer-checked:after:translate-x-full peer-focus:outline-none"})]})}),zo=b.forwardRef(function(t,n){return c.jsxs("div",{className:"flex items-center rounded-md border border-gray-200 bg-gray-50 p-3 text-gray-900",children:[c.jsxs("div",{className:"flex-1",children:[c.jsx("label",{className:"font-medium text-gray-900",htmlFor:"availableOffline",children:"Make available offline"}),c.jsxs("p",{className:"text-xs text-gray-600",children:["Check this options if you keep a local backup",c.jsx("br",{}),"available at all times."]})]}),c.jsx(g5,{id:"availableOffline",ref:n,...t})]})});function Xn(e){const{children:t,className:n,...s}=e;return c.jsx("label",{...s,className:M("block font-semibold text-gray-500",n),children:t})}function Pu(e){const{control:t,...n}=e;return c.jsx(Ai,{control:t,name:"sharingType",render:({field:s})=>c.jsx(yt,{...n,...s,id:"sharingType",items:r5})})}function b5(e){const{register:t,handleSubmit:n,control:s,formState:{errors:r}}=Ys({defaultValues:{name:"",sharingType:"LOCAL",availableOffline:!1,appId:e.appOptions[0].id}});return c.jsx("form",{name:"add-local-drive",onSubmit:n(e.onSubmit),className:"flex flex-col gap-4",children:c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsxs("div",{children:[c.jsx(Xn,{htmlFor:"name",className:"text-sm font-medium text-gray-800",children:"Drive Name"}),c.jsx(Pn,{...t("name",{required:"Drive name is required"}),errorMessage:r.name?.message,placeholder:"Drive name"})]}),c.jsxs("div",{children:[c.jsx(Xn,{htmlFor:"driveApp",className:"text-sm font-medium text-gray-800",children:"Drive App"}),c.jsx(m5,{control:s,appOptions:e.appOptions})]}),c.jsxs("div",{children:[c.jsx(Xn,{htmlFor:"sharingType",className:"text-sm font-medium text-gray-800",children:"Location"}),c.jsx(Pu,{control:s})]}),c.jsx("div",{children:c.jsx(zo,{...t("availableOffline")})}),c.jsx(Pe,{className:"mt-2 w-full",type:"submit",children:"Create new drive"})]})})}function y5(e){return c.jsxs("div",{className:"flex gap-2 rounded-xl bg-gray-100 p-3 font-semibold text-gray-500",children:[c.jsx(O,{className:"text-gray-600",name:"Drive"}),e.driveName]})}function Eu(e){const{location:t,className:n,...s}=e,r=s5[t];return c.jsxs("div",{...s,className:M("my-3 flex items-center gap-2 rounded-xl border border-gray-100 p-3 text-gray-800 shadow",n),children:[r.icon,c.jsxs("div",{children:[c.jsx("p",{children:r.title}),c.jsx("p",{className:"text-xs text-slate-200",children:r.description})]})]})}function v5(e){const{sharingType:t="PUBLIC",requestPublicDrive:n}=e,[s,r]=b.useState(),[o,a]=b.useState(!1),[i,l]=b.useState(!0),[u,d]=b.useState(!1),[h,f]=b.useState(""),[p,g]=b.useState(""),[m,y]=Y0(p,500),{register:v,handleSubmit:x,setValue:C}=Ys({mode:"onBlur",defaultValues:{availableOffline:s?.availableOffline??!1}});b.useEffect(()=>{y(p)},[p]),b.useEffect(()=>{if(d(!1),m==="")return;w().catch(console.error);async function w(){try{const{id:j,name:S}=await n(m);r({id:j,name:S,sharingType:t,location:"SWITCHBOARD",availableOffline:!0}),C("availableOffline",!0),l(!0),f("")}catch(j){r(void 0),l(!1),f(j.message)}}},[m,C,t]);function E({availableOffline:w}){s&&e.onSubmit({...s,availableOffline:w,url:m})}return c.jsx("form",{onSubmit:x(E),children:u?c.jsxs(c.Fragment,{children:[c.jsx(y5,{driveName:s?.name??"New drive"}),c.jsx(mt,{className:"my-3"}),c.jsxs(ir,{isOpen:o,onOpenChange:()=>a(!o),title:"Location",children:[c.jsx(Eu,{location:"SWITCHBOARD"}),c.jsx(zo,{...v("availableOffline")})]}),c.jsx(Pe,{className:"mt-4 w-full",color:"dark",type:"submit",children:"Add new drive"})]}):c.jsxs(c.Fragment,{children:[c.jsx(Pn,{errorMessage:h,onChange:w=>g(w.target.value),placeholder:"Drive URL",required:!0,type:"url",value:p}),c.jsx(Pe,{className:"mt-4 w-full py-2 text-base",color:"dark",size:"small",disabled:!i||p==="",onClick:w=>{w.preventDefault(),d(!0)},type:"button",children:"Add drive"})]})})}const x5=new URL("/assets/home-bg-BRYzhkhi.avif",import.meta.url).href,w5=new URL("/assets/home-bg-BEhF9NuW.png",import.meta.url).href;function C5(){return c.jsxs("picture",{className:"pointer-events-none absolute inset-8 z-0 size-[calc(100%-32px)] object-contain",children:[c.jsx("source",{srcSet:x5,type:"image/avif"}),c.jsx("img",{src:w5,alt:"background",className:"object-contain"})]})}const S5=function(t){const{icon:n,title:s,description:r,containerClassName:o,shareable:a,onClick:i}=t;return c.jsxs("div",{className:M("hover-bg-transparent relative flex h-24 w-40 cursor-pointer flex-col items-center justify-center overflow-hidden rounded-md p-2 text-center text-sm text-black",o,i&&"cursor-pointer"),onClick:i,children:[c.jsx("div",{className:"mx-auto pb-2",children:n||c.jsx("div",{className:"size-8 items-center justify-center rounded-lg bg-black pt-1",children:c.jsx("span",{className:"text-6 w-6 text-white",children:s.slice(0,1).toUpperCase()})})}),c.jsxs("div",{className:"w-full max-w-full",children:[c.jsx("h3",{className:"w-full max-w-full truncate px-2",children:s}),r&&c.jsx("p",{className:"text-gray-500",children:r})]}),a&&c.jsx("div",{className:"absolute left-2 top-0 mb-2",children:c.jsx(O,{name:"PeopleFill",width:12,height:12})})]})},Mw=function(t){const{containerClassName:n}=t;return c.jsx(S5,{title:"Create New Drive",icon:c.jsx(O,{name:"PlusSquare",size:32}),onClick:()=>id({type:"addDrive"}),containerClassName:n})},Tw=function(t){const{children:n,containerClassName:s}=t;return c.jsx("div",{className:M("container relative mx-auto flex h-full flex-col",s),children:c.jsxs("div",{className:"m-8 flex flex-wrap justify-center gap-4 pt-12",children:[c.jsx(C5,{}),n]})})};function hr(e){const{label:t,children:n}=e;return c.jsx("div",{children:n})}var Tr="Tabs",[j5]=zi(Tr,[Bi]),Nu=Bi(),[P5,_o]=j5(Tr),Ou=b.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:r,defaultValue:o,orientation:a="horizontal",dir:i,activationMode:l="automatic",...u}=e,d=wd(i),[h,f]=Vi({prop:s,onChange:r,defaultProp:o??"",caller:Tr});return c.jsx(P5,{scope:n,baseId:Ui(),value:h,onValueChange:f,orientation:a,dir:d,activationMode:l,children:c.jsx(Et.div,{dir:d,"data-orientation":a,...u,ref:t})})});Ou.displayName=Tr;var Iu="TabsList",Mu=b.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...r}=e,o=_o(Iu,n),a=Nu(n);return c.jsx(Cd,{asChild:!0,...a,orientation:o.orientation,dir:o.dir,loop:s,children:c.jsx(Et.div,{role:"tablist","aria-orientation":o.orientation,...r,ref:t})})});Mu.displayName=Iu;var Tu="TabsTrigger",Du=b.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:r=!1,...o}=e,a=_o(Tu,n),i=Nu(n),l=Au(a.baseId,s),u=Lu(a.baseId,s),d=s===a.value;return c.jsx(Sd,{asChild:!0,...i,focusable:!r,active:d,children:c.jsx(Et.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:l,...o,ref:t,onMouseDown:Ae(e.onMouseDown,h=>{!r&&h.button===0&&h.ctrlKey===!1?a.onValueChange(s):h.preventDefault()}),onKeyDown:Ae(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&a.onValueChange(s)}),onFocus:Ae(e.onFocus,()=>{const h=a.activationMode!=="manual";!d&&!r&&h&&a.onValueChange(s)})})})});Du.displayName=Tu;var ku="TabsContent",Ru=b.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:r,children:o,...a}=e,i=_o(ku,n),l=Au(i.baseId,s),u=Lu(i.baseId,s),d=s===i.value,h=b.useRef(d);return b.useEffect(()=>{const f=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(f)},[]),c.jsx(Js,{present:r||d,children:({present:f})=>c.jsx(Et.div,{"data-state":d?"active":"inactive","data-orientation":i.orientation,role:"tabpanel","aria-labelledby":l,hidden:!f,id:u,tabIndex:0,...a,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:f&&o})})});Ru.displayName=ku;function Au(e,t){return`${e}-trigger-${t}`}function Lu(e,t){return`${e}-content-${t}`}var E5=Ou,N5=Mu,O5=Du,I5=Ru;function Fu({children:e,defaultValue:t}){return c.jsxs(E5,{defaultValue:t,className:"flex flex-col gap-2",children:[c.jsx("div",{className:"flex w-full justify-between",children:c.jsx(N5,{className:"flex w-full gap-x-2 rounded-xl bg-slate-50 p-1 text-sm font-semibold text-gray-600 outline-none",children:Y.Children.map(e,(n,s)=>{if(!Y.isValidElement(n))return;const{label:r,disabled:o}=n.props;return c.jsx(O5,{className:"data-[state='active']:tab-shadow ata-disabled:cursor-not-allowed data-disabled:text-gray-400 flex h-7 flex-1 items-center justify-center rounded-lg transition duration-300 data-[state='active']:bg-gray-50 data-[state='active']:text-gray-900",value:r,disabled:o??!1,children:r},r)})})}),c.jsx("div",{className:"mt-3 rounded-md bg-white",children:Y.Children.map(e,(n,s)=>{if(!Y.isValidElement(n))return;const{label:r}=n.props;return c.jsx(I5,{value:r,children:n},s)})})]})}function Dw(e){function t(){s(!1)}const{open:n,onOpenChange:s,onAddRemoteDrive:r,onAddLocalDrive:o,requestPublicDrive:a,modalProps:i,containerProps:l}=e;return c.jsx(_e,{...i,contentProps:{className:"rounded-2xl"},onOpenChange:s,open:n,children:c.jsx("div",{...l,className:M("w-[408px] rounded-2xl p-6",l?.className),children:c.jsxs(Fu,{defaultValue:"Create Drive",children:[c.jsx(hr,{label:"Create Drive",description:"Create a new drive",children:c.jsx(b5,{onCancel:t,onSubmit:o,appOptions:e.appOptions})}),c.jsx(hr,{label:"Add Drive",description:"Add a drive",children:c.jsx(v5,{sharingType:"PUBLIC",onSubmit:r,onCancel:t,requestPublicDrive:a})})]})})})}const Ci="min-h-[48px] min-w-[142px] text-base font-semibold py-3 px-6 rounded-xl outline-none active:opacity-75 hover:scale-105 transform transition-all",Si=300;function kw(e){const{onOpenChange:t,onContinue:n,overlayProps:s,contentProps:r,...o}=e,[a,i]=b.useState(""),[l,u]=b.useState(!1),d=()=>{t?.(!1),setTimeout(()=>i(""),Si)},h=b.useCallback(()=>{l&&(n(a),setTimeout(()=>i(""),Si))},[l,a,n]),f=b.useCallback(p=>{p.preventDefault(),h()},[h]);return c.jsx(_e,{contentProps:{...r,className:M("rounded-3xl",r?.className)},onOpenChange:t,overlayProps:{...s,className:s?.className},...o,children:c.jsxs("form",{name:"create-document",className:"w-[400px] p-6 text-slate-300",onSubmit:f,children:[c.jsx("div",{className:"border-b border-slate-50 pb-2 text-2xl font-bold text-gray-800",children:"Create a new document"}),c.jsxs("div",{className:"my-6",children:[!l&&a&&c.jsx("div",{className:"mb-2 text-red-500",children:"Document name must be valid URL characters."}),c.jsx(Pn,{icon:c.jsx(O,{name:"BrickGlobe"}),onChange:p=>{const g=p.target.value;i(g),u(Rd(g))},placeholder:"Document name",required:!0,value:a})]}),c.jsxs("div",{className:"mt-8 flex justify-between gap-3",children:[c.jsx("button",{type:"button",className:M(Ci,"flex-1 bg-slate-50 text-slate-800"),onClick:d,children:"Cancel"}),c.jsx(Pe,{type:"submit",className:M(Ci,"flex-1 bg-gray-800 text-gray-50"),disabled:!l,children:"Create"})]})]})})}const Rw=e=>{const{inputPlaceholder:t,body:n,driveName:s,...r}=e,[o,a]=b.useState("");return c.jsx(fo,{bodyProps:{className:"p-0 bg-white my-0"},containerProps:{className:"w-[450px]"},continueButtonProps:{disabled:o!==s,className:o!==s?"bg-red-600 hover:scale-100 cursor-not-allowed active:opacity-100":"bg-red-900"},...r,children:c.jsxs("div",{children:[c.jsx("div",{className:"my-6 rounded-md bg-slate-50 p-4 text-center",children:n}),c.jsx("div",{children:c.jsx(Pn,{hideErrors:!0,icon:c.jsx(O,{name:"Lock"}),onChange:i=>a(i.target.value),placeholder:t,value:o})})]})})};function Aw(e){const{onDelete:t,deleteLabel:n,...s}=e;return c.jsx(fo,{...s,containerProps:{className:"w-[450px]"},continueButtonProps:{className:"bg-red-900"},continueLabel:n,onContinue:t})}const $u=b.forwardRef(function(t,n){return c.jsx(Pn,{...t,icon:t.icon??c.jsx(O,{name:"Drive"}),id:"driveName",placeholder:"Drive name",ref:n})});function M5(e){const{drive:t,handleDeleteDrive:n,onCancel:s}=e,[r,o]=b.useState(""),a=r===t.header.name;function i(){a&&n()}return c.jsxs("div",{children:[c.jsx("p",{className:"mb-2 rounded-md bg-slate-50 p-4 text-center text-slate-200",children:"Are you sure you want to delete this drive? All files and subfolders within it will be removed. Do you want to proceed?"}),c.jsx($u,{icon:c.jsx(O,{name:"Lock"}),onChange:l=>o(l.target.value),placeholder:"Enter drive name...",value:r}),c.jsxs("div",{className:"flex gap-3",children:[c.jsx(Pe,{className:"w-full",color:"light",onClick:s,children:"Cancel"}),c.jsx(Pe,{className:"w-full",color:"red",disabled:!a,onClick:i,children:"Delete"})]})]})}function T5(e){const{drive:t,sharingType:n,availableOffline:s,onSubmit:r,handleDeleteDrive:o}=e,a=t.header.name,[i,l]=b.useState(!1),[u,d]=b.useState(!1),[h,f]=b.useState(!1),{register:p,handleSubmit:g,control:m}=Ys({mode:"onBlur",defaultValues:{name:a,sharingType:n,availableOffline:s}}),y=n==="PUBLIC"?"SWITCHBOARD":n;return c.jsxs("form",{onSubmit:g(r),children:[c.jsx($u,{...p("name")}),c.jsx(mt,{className:"my-4"}),c.jsx(Xn,{htmlFor:"sharingType",children:"Sharing settings"}),c.jsx(Pu,{control:m}),c.jsx(mt,{className:"my-3"}),c.jsxs(ir,{isOpen:i,onOpenChange:()=>l(!i),title:"Location",children:[c.jsx(Eu,{location:y}),c.jsx(zo,{...p("availableOffline")})]}),c.jsx(mt,{className:"my-3"}),c.jsx(ir,{isOpen:u,onOpenChange:()=>d(!u),title:"Danger zone",children:c.jsxs("button",{className:"flex gap-2 py-3 font-semibold text-red-900 transition hover:brightness-125",onClick:()=>f(!0),type:"button",children:[c.jsx(O,{name:"Trash"}),"Delete drive"]})}),h&&u?c.jsx(M5,{drive:t,handleDeleteDrive:o,onCancel:()=>f(!1)}):c.jsxs(c.Fragment,{children:[c.jsx(mt,{className:"my-3"}),c.jsx(Pe,{className:"mb-4 w-full",type:"submit",children:"Confirm"})]})]})}function Lw(e){const{drive:t,open:n,sharingType:s,availableOffline:r,onOpenChange:o,onDeleteDrive:a,onRenameDrive:i,onChangeSharingType:l,onChangeAvailableOffline:u,modalProps:d,containerProps:h}=e,f=m=>{m.name!==t.header.name&&i(t,m.name),m.sharingType!==s&&l(t,m.sharingType),m.availableOffline!==r&&u(t,m.availableOffline),o(!1)};function p(){a(t),o(!1)}function g(){o(!1)}return c.jsx(_e,{...d,contentProps:{className:"rounded-2xl"},onOpenChange:o,open:n,children:c.jsxs("div",{...h,className:M("max-w-[408px] rounded-2xl p-6",h?.className),children:[c.jsxs("div",{className:"flex justify-between",children:[c.jsx("h1",{className:"text-xl font-bold",children:"Drive settings"}),c.jsx("button",{className:"flex size-8 items-center justify-center rounded-md bg-gray-100 text-gray-500 outline-none hover:text-gray-900",onClick:g,tabIndex:-1,children:c.jsx(O,{name:"XmarkLight",size:24})})]}),c.jsx(mt,{className:"my-4"}),c.jsx(T5,{handleCancel:g,handleDeleteDrive:p,onSubmit:f,drive:t,sharingType:s,availableOffline:r})]})})}function qs(e,t=12){return e.length<=t?e:e.slice(0,t)+"..."}function zu({direction:e,active:t}){return t?c.jsx(O,{className:e==="asc"?"rotate-180":void 0,name:"TriangleDown",size:12}):c.jsx(O,{className:"opacity-0 group-hover:opacity-50",name:"CaretSort",size:12})}const D5=[{key:"id",label:"ID",width:"120px"},{key:"documentId",label:"Document ID",width:"150px"},{key:"branch",label:"Branch",width:"100px"},{key:"status",label:"Status",width:"150px"},{key:"opsCount",label:"Ops Count",width:"80px"}],k5=[{key:"id",label:"ID",width:"120px"},{key:"documentId",label:"Document ID",width:"150px"},{key:"branch",label:"Branch",width:"100px"},{key:"error",label:"Error",width:"200px"}];function R5(e){switch(e){case Fe.Unknown:return"Unknown";case Fe.TransportPending:return"Transport Pending";case Fe.ExecutionPending:return"Execution Pending";case Fe.Applied:return"Applied";case Fe.Error:return"Error";default:return"Unknown"}}function A5(e){switch(e){case Fe.TransportPending:case Fe.ExecutionPending:return c.jsx("span",{children:"⏳"});case Fe.Applied:return c.jsx("span",{children:"✅"});case Fe.Error:return c.jsx("span",{children:"❌"});default:return c.jsx("span",{children:"❓"})}}function pr(e){return e?e.error.message:""}function L5(e,t){const n=[...e];return t?n.sort((s,r)=>{let o=0;switch(t.column){case"id":o=s.id.localeCompare(r.id);break;case"documentId":o=s.documentId.localeCompare(r.documentId);break;case"branch":o=s.branch.localeCompare(r.branch);break;case"status":o=s.status-r.status;break;case"opsCount":o=s.operations.length-r.operations.length;break;case"error":o=pr(s.error).localeCompare(pr(r.error));break;default:return 0}return t.direction==="asc"?o:-o}):n}function ns({title:e,mailboxType:t,operations:n,sort:s,onSort:r,collapsed:o,onToggleCollapse:a}){const i=t==="deadLetter"?k5:D5,l=L5(n,s),u=d=>{r(t,d)};return c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsxs("button",{className:"flex items-center gap-2 text-left text-sm font-medium text-gray-700 hover:text-gray-900",onClick:a,type:"button",children:[c.jsx(O,{className:M("transition-transform",o&&"-rotate-90"),name:"ChevronDown",size:14}),e," (",n.length," item",n.length!==1?"s":"",")"]}),!o&&c.jsx("div",{className:"max-h-64 overflow-auto rounded-lg border border-gray-300",children:c.jsxs("table",{className:"w-full border-collapse",children:[c.jsx("thead",{className:"sticky top-0 bg-gray-100",children:c.jsx("tr",{children:i.map((d,h)=>{const f=s?.column===d.key,p=f?s.direction:"asc";return c.jsx("th",{className:M("group cursor-pointer px-3 py-2 text-left text-xs font-medium text-gray-600 hover:bg-gray-200 hover:text-gray-900",h>0&&"border-l border-gray-300"),onClick:()=>u(d.key),style:{width:d.width},children:c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("span",{className:"truncate",children:d.label}),c.jsx(zu,{active:f,direction:p})]})},d.key)})})}),c.jsx("tbody",{children:l.length===0?c.jsx("tr",{children:c.jsx("td",{className:"px-3 py-4 text-center text-sm text-gray-500",colSpan:i.length,children:"No operations"})}):l.map(d=>c.jsxs("tr",{className:"odd:bg-white even:bg-gray-50 hover:bg-blue-50",children:[c.jsx("td",{className:"px-3 py-2 text-xs text-gray-900",children:c.jsx("span",{className:"block truncate",title:d.id,children:qs(d.id)})}),c.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:c.jsx("span",{className:"block truncate",title:d.documentId,children:qs(d.documentId)})}),c.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:c.jsx("span",{className:"block truncate",title:d.branch,children:d.branch})}),t==="deadLetter"?c.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs",children:c.jsxs("span",{className:"block truncate text-red-600",title:pr(d.error),children:["❌ ",pr(d.error)||"Unknown error"]})}):c.jsxs(c.Fragment,{children:[c.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:c.jsxs("span",{className:"flex items-center gap-1",children:[A5(d.status),R5(d.status)]})}),c.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:d.operations.length})]})]},d.id))})]})})]})}function F5({remoteName:e,channel:t,onBack:n,onRefresh:s}){const[r,o]=b.useState({inbox:void 0,outbox:void 0,deadLetter:void 0}),[a,i]=b.useState({inbox:!1,outbox:!1,deadLetter:!1}),l=d=>{i(h=>({...h,[d]:!h[d]}))},u=(d,h)=>{o(f=>{const p=f[d],g=p?.column===h&&p.direction==="asc"?"desc":"asc";return{...f,[d]:{column:h,direction:g}}})};return c.jsxs("div",{className:"flex h-full flex-col gap-4 p-4",children:[c.jsxs("div",{className:"flex shrink-0 items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("button",{className:"flex items-center gap-1 rounded border border-gray-300 bg-white px-2 py-1 text-sm text-gray-700 hover:bg-gray-100",onClick:n,type:"button",children:[c.jsx(O,{className:"rotate-90",name:"ChevronDown",size:14}),"Back"]}),c.jsxs("h2",{className:"text-lg font-semibold text-gray-900",children:["Channel: ",e]})]}),s&&c.jsxs("button",{className:"flex items-center gap-1 rounded border border-gray-300 bg-white px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-100",onClick:s,type:"button",children:[c.jsx(O,{name:"Reload",size:14}),"Refresh"]})]}),c.jsxs("div",{className:"flex flex-1 flex-col gap-6 overflow-auto",children:[c.jsx(ns,{collapsed:a.inbox,mailboxType:"inbox",onSort:u,onToggleCollapse:()=>l("inbox"),operations:t.inbox.items,sort:r.inbox,title:"Inbox"}),c.jsx(ns,{collapsed:a.outbox,mailboxType:"outbox",onSort:u,onToggleCollapse:()=>l("outbox"),operations:t.outbox.items,sort:r.outbox,title:"Outbox"}),c.jsx(ns,{collapsed:a.deadLetter,mailboxType:"deadLetter",onSort:u,onToggleCollapse:()=>l("deadLetter"),operations:t.deadLetter.items,sort:r.deadLetter,title:"Dead Letter"})]})]})}const rs=[{key:"id",label:"ID",width:"120px"},{key:"name",label:"Name",width:"150px"},{key:"collectionId",label:"Collection ID",width:"200px"},{key:"filter",label:"Filter",width:"200px"},{key:"channel",label:"Channel",width:"100px"}];function mr(e){const t=[];return e.branch&&t.push(`branch:${e.branch}`),e.documentId.length>0&&t.push(`${e.documentId.length} doc(s)`),e.scope.length>0&&t.push(`${e.scope.length} scope(s)`),t.length>0?t.join(", "):"-"}function $5(e,t){return t?[...e].sort((n,s)=>{let r,o;switch(t.column){case"id":r=n.id,o=s.id;break;case"name":r=n.name,o=s.name;break;case"collectionId":r=n.collectionId,o=s.collectionId;break;case"filter":r=mr(n.filter),o=mr(s.filter);break;default:return 0}const a=r.localeCompare(o);return t.direction==="asc"?a:-a}):e}function z5({getRemotes:e}){const[t,n]=b.useState([]),[s,r]=b.useState(!0),[o,a]=b.useState(),[i,l]=b.useState(),u=b.useCallback(async()=>{r(!0);const m=await e();n(m),r(!1)},[e]);b.useEffect(()=>{u()},[u]);const d=b.useCallback(async()=>{if(await u(),i){const m=t.find(y=>y.id===i.id);l(m)}},[u,i,t]),h=m=>{if(m==="channel")return;const y=o?.column===m&&o.direction==="asc"?"desc":"asc";a({column:m,direction:y})},f=m=>{l(m)},p=()=>{l(void 0)};if(i)return c.jsx(F5,{channel:i.channel,onBack:p,onRefresh:()=>void d(),remoteName:i.name});const g=$5(t,o);return c.jsxs("div",{className:"flex h-full flex-col gap-2 p-4",children:[c.jsxs("div",{className:"flex shrink-0 items-center justify-between",children:[c.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"Remotes Inspector"}),c.jsxs("button",{className:"flex items-center gap-1 rounded border border-gray-300 bg-white px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-100 disabled:opacity-50",disabled:s,onClick:()=>void d(),type:"button",children:[c.jsx(O,{name:"Reload",size:14}),"Refresh"]})]}),c.jsx("div",{className:"max-h-full overflow-auto rounded-lg border border-gray-300",children:c.jsxs("table",{className:"w-full border-collapse",children:[c.jsx("thead",{className:"sticky top-0 bg-gray-100",children:c.jsx("tr",{children:rs.map((m,y)=>{const v=o?.column===m.key,x=v?o.direction:"asc",C=m.key!=="channel";return c.jsx("th",{className:M("group px-3 py-2 text-left text-xs font-medium text-gray-600",y>0&&"border-l border-gray-300",C&&"cursor-pointer hover:bg-gray-200 hover:text-gray-900"),onClick:()=>C&&h(m.key),style:{width:m.width},children:c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("span",{className:"truncate",children:m.label}),C&&c.jsx(zu,{active:v,direction:x})]})},m.key)})})}),c.jsx("tbody",{children:s&&g.length===0?c.jsx("tr",{children:c.jsx("td",{className:"px-3 py-8 text-center text-sm text-gray-500",colSpan:rs.length,children:"Loading..."})}):g.length===0?c.jsx("tr",{children:c.jsx("td",{className:"px-3 py-8 text-center text-sm text-gray-500",colSpan:rs.length,children:"No remotes configured"})}):g.map(m=>c.jsxs("tr",{className:"odd:bg-white even:bg-gray-50 hover:bg-blue-50",children:[c.jsx("td",{className:"px-3 py-2 text-xs text-gray-900",children:c.jsx("span",{className:"block truncate",title:m.id,children:qs(m.id)})}),c.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:c.jsx("span",{className:"block truncate",title:m.name,children:m.name})}),c.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:c.jsx("span",{className:"block truncate",title:m.collectionId,children:m.collectionId})}),c.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:c.jsx("span",{className:"block truncate",title:mr(m.filter),children:mr(m.filter)})}),c.jsx("td",{className:"border-l border-gray-300 px-3 py-2",children:c.jsxs("button",{className:"flex items-center gap-1 rounded bg-blue-50 px-2 py-1 text-xs text-blue-700 hover:bg-blue-100",onClick:()=>f(m),type:"button",children:["View",c.jsx(O,{name:"CaretRight",size:12})]})})]},m.id))})]})}),c.jsxs("div",{className:"shrink-0 text-sm text-gray-600",children:["Showing ",g.length," remote(s)"]})]})}function Fw({open:e,onOpenChange:t,modalProps:n,containerProps:s,dbExplorerProps:r,remotesInspectorProps:o,defaultTab:a="Database"}){return c.jsx(_e,{...n,contentProps:{className:"rounded-2xl"},onOpenChange:t,open:e,children:c.jsxs("div",{...s,className:M("flex h-[600px] w-[900px] flex-col rounded-2xl",s?.className),children:[c.jsx("div",{className:"flex items-center justify-end p-4 pb-0",children:c.jsx("button",{className:"flex size-6 cursor-pointer items-center justify-center rounded-md text-gray-500 outline-none hover:text-gray-900",onClick:()=>t(!1),type:"button",children:c.jsx(O,{name:"XmarkLight",size:24})})}),c.jsx("div",{className:"flex flex-1 flex-col overflow-hidden p-4 pt-2",children:c.jsxs(Fu,{defaultValue:a,children:[c.jsx(hr,{description:"Database explorer",label:"Database",children:c.jsx("div",{className:"h-[480px]",children:c.jsx($g,{...r})})}),c.jsx(hr,{description:"Remotes inspector",label:"Remotes",children:c.jsx("div",{className:"h-[480px]",children:c.jsx(z5,{...o})})})]})})]})})}const _5="min-h-[48px] min-w-[142px] text-base font-semibold py-3 px-6 rounded-xl outline-none active:opacity-75 hover:scale-105 transform transition-all";function $w(e){const{body:t,header:n,children:s,onOpenChange:r,onContinue:o,closeLabel:a,overlayProps:i,contentProps:l,bodyProps:u={},headerProps:d={},containerProps:h={},continueButtonProps:f={},buttonContainerProps:p={},...g}=e,[m,y]=b.useState(!0),v=b.useRef(null);return b.useEffect(()=>{const x=()=>{const E=v.current;E&&(E.scrollHeight>E.clientHeight?(y(!0),E.addEventListener("scroll",C)):y(!1))},C=()=>{const E=v.current;E&&E.scrollHeight-Math.ceil(E.scrollTop)===E.clientHeight&&y(!1)};return requestAnimationFrame(x),()=>{const E=v.current;E&&E.removeEventListener("scroll",C)}},[]),c.jsx(_e,{contentProps:{...l,className:M("rounded-3xl outline-none",l?.className)},onOpenChange:r,overlayProps:{...i,className:i?.className},...g,children:c.jsxs("div",{...ce(h,"w-[500px] p-6 text-slate-300"),children:[c.jsx("div",{...ce(d,"border-b border-slate-50 pb-2 text-2xl font-bold text-gray-800"),children:n}),c.jsxs("div",{ref:v,...ce(u,"my-6 max-h-[245px] overflow-scroll rounded-md bg-slate-50 p-4 text-center"),children:[t,s]}),c.jsx("div",{...ce(p,"mt-8 flex justify-between gap-3"),children:c.jsx("button",{disabled:m,onClick:o,...ce(f,M(_5,"flex-1 bg-gray-800 text-gray-50",m&&"cursor-not-allowed bg-gray-300 hover:scale-100")),children:a})})]})})}const U5=[/^@powerhousedao\/.+$/,"document-drive","document-model"],V5=Ad({version:Mt({message:"Missing version field in package.json"}),dependencies:qo(Mt(),Mt()).nullable(),devDependencies:qo(Mt(),Mt()).nullable()}).refine(e=>e.dependencies!=null||e.devDependencies!=null,"package.json must have either dependencies or devDependencies").transform(e=>{const t={...e.dependencies,...e.devDependencies};return{version:e.version,dependencies:Object.fromEntries(Object.entries(t).filter(([n])=>U5.some(s=>typeof s=="string"?s===n:s.test(n))))}});function B5(e){const t=V5.safeParse(e);return t.success?t.data:(console.error("Package.json validation failed:",t.error.format()),!1)}function H5(e){const[t,n]=b.useState(!1),{packageJson:s,phCliVersion:r}=e,o=B5(s);return o?c.jsx(ir,{isOpen:t,onOpenChange:()=>n(!t),title:`App version: ${o.version}`,toggleClassName:"text-gray-900 text-sm",children:c.jsxs("ul",{className:"text-sm text-gray-600",children:[Object.entries(o.dependencies).map(([a,i])=>c.jsxs("li",{className:"my-1 flex justify-between pr-1",children:[c.jsxs("span",{children:[a.replace("@powerhousedao/",""),":"]}),c.jsx("span",{className:"font-normal",children:i})]},a)),r&&c.jsxs("li",{className:"my-1 flex justify-between pr-1",children:[c.jsx("span",{children:"@powerhousedao/ph-cli:"}),c.jsx("span",{className:"font-normal",children:r})]},"ph-cli")]})}):(console.error("Failed to validate package.json data"),null)}function zw(e){const{packageJson:t,phCliVersion:n}=e;return c.jsxs("div",{className:"bg-white p-3",children:[c.jsx("h2",{className:"font-semibold",children:"About"}),c.jsx("p",{className:"text-sm font-normal text-gray-600",children:"Connect is the hub for your most important documents and processes translated into software. Easily capture data in a structured way with Connect."}),c.jsx("div",{className:"my-4",children:c.jsx(H5,{packageJson:t,phCliVersion:n})})]})}function _w(e){const{className:t,...n}=e;return c.jsxs("div",{className:Hi("h-full rounded-lg bg-white p-3",t),children:[c.jsx("h2",{className:"mb-4 font-semibold",children:"Modify Drives"}),c.jsx(W5,{...n}),c.jsx("h2",{className:"my-4 font-semibold",children:"Local Storage"}),c.jsx(Q5,{...n})]})}function W5(e){const{className:t,...n}=e;return c.jsx("div",{className:t,children:c.jsx(q5,{...n})})}function q5(e){const{className:t,...n}=e;return c.jsx("div",{className:t,children:e.drives.map(s=>c.jsx(G5,{drive:s,...n},s.header.id))})}function G5(e){const{drive:t,className:n,onDeleteDrive:s}=e,[r,o]=b.useState(!1),a=c.jsx(O,{name:"Hdd",size:16,className:"flex-none"}),i=c.jsx(O,{name:"Server",size:16,className:"flex-none"}),l=t.state.global.icon?c.jsx("img",{alt:"drive icon",className:"size-4 flex-none object-contain",src:t.state.global.icon}):c.jsx(O,{name:"M",size:16,className:"flex-none"});function u(){const h=os(t);return h==="PUBLIC"?l:h==="CLOUD"?i:a}const d=u();return c.jsxs("div",{className:Hi("mb-4 flex w-96 items-center gap-2 rounded-md border border-gray-200 bg-gray-50 px-3 py-2 shadow-sm last-of-type:mb-0",n),children:[d,c.jsxs("div",{children:[c.jsx("span",{className:"block text-sm font-medium leading-[18px]",children:Wo(t.header.name)}),c.jsxs("div",{className:"flex items-baseline gap-x-2 leading-[18px]",children:[c.jsxs("span",{className:"text-sm text-gray-600",children:[Wo(os(t))," App"]}),c.jsxs("a",{className:"group flex items-center gap-x-2 text-sm text-slate-500 transition-colors hover:text-[#9896FF]",children:["By Powerhouse",c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 12",className:"size-4 text-gray-400 transition-colors group-hover:text-inherit",children:c.jsx("path",{d:"M7.99365 11.9939C9.46632 11.9939 10.6603 10.7999 10.6603 9.32722V7.32722C10.6603 6.95922 10.3617 6.66056 9.99365 6.66056C9.62565 6.66056 9.32699 6.95922 9.32699 7.32722V9.32722C9.32699 10.0639 8.73032 10.6606 7.99365 10.6606H2.66032C1.92365 10.6606 1.32699 10.0639 1.32699 9.32722V3.99389C1.32699 3.25723 1.92365 2.66056 2.66032 2.66056H4.66032C5.02832 2.66056 5.32699 2.36189 5.32699 1.99389C5.32699 1.6259 5.02832 1.32723 4.66032 1.32723H2.66032C1.18765 1.32723 -0.00634766 2.52123 -0.00634766 3.99389V9.32722C-0.00634766 10.7999 1.18765 11.9939 2.66032 11.9939H7.99365ZM5.32699 7.32722C5.49765 7.32722 5.67565 7.26989 5.80632 7.13989L10.1396 2.80656L11.9937 4.66056V-0.00610352H7.32699L9.18099 1.8479L4.84766 6.18123C4.58766 6.4419 4.58766 6.87922 4.84766 7.13989C4.97832 7.26989 5.15632 7.32722 5.32699 7.32722Z",fill:"currentColor"})})]})]})]}),c.jsx(Er,{items:[{id:"delete-drive",label:"Delete",icon:c.jsx(O,{name:"Trash"}),className:"text-red-900"}],onItemClick:h=>{h==="delete-drive"&&s(t)},onOpenChange:o,open:r,children:c.jsx("button",{className:"group ml-auto flex-none",onClick:h=>{h.stopPropagation(),o(!0)},children:c.jsx(O,{className:"text-gray-600 group-hover:text-gray-900",name:"VerticalDots",size:16})})})]})}function Q5(e){const{onClearStorage:t}=e;return c.jsx("div",{children:c.jsxs("button",{className:"flex items-center gap-x-2 rounded-md border border-gray-300 bg-transparent px-3 py-1 text-sm font-medium text-red-900 transition-colors hover:bg-gray-100",onClick:t,children:["Clear Storage ",c.jsx(O,{name:"Trash",size:16})]})})}function Uw(e){const{className:t,...n}=e;return c.jsx("div",{className:M("rounded-lg p-3",t),children:c.jsx(Y5,{...n})})}function Y5(e){const{documentModelEditor:t,setDocumentModelEditor:n,documentModelEditorOptions:s,className:r}=e;return c.jsxs("div",{children:[c.jsx("h3",{className:"mb-4 font-semibold text-gray-900",children:"Default Editor Selection"}),c.jsx(qi,{className:M("min-w-36 max-w-fit",r),name:"default-editor",required:!0,value:t,options:s,multiple:!1,onChange:o=>n(o)})]})}const K5={npm:{icon:"Npm"},github:{icon:"Github",size:28},local:{icon:"Hdd"}},X5=({packageName:e,provider:t})=>{const n=t&&K5[t];return c.jsxs("div",{className:"flex w-full items-center justify-between px-2 py-1",children:[c.jsx("p",{className:"font-medium",children:e}),n&&c.jsx(O,{name:n.icon,size:n.size})]})},J5=e=>{const{onInstall:t,packageOptions:n,className:s}=e,[r,o]=b.useState(""),[a,i]=b.useState(!1),[l,u]=b.useState(),d=b.useCallback(()=>{const g=t(r);g?(i(!0),g.then(()=>o("")).catch(u).finally(()=>i(!1))):(o(""),u(void 0))},[t,r]),h=b.useCallback(g=>{o(g.target.value)},[]),f=l?typeof l=="string"?l:l instanceof Error?l.message:l:" ",p=b.useMemo(()=>{const g=n?.map(m=>({...m,value:m.packageName}));return n?.length?{autoComplete:!0,initialOptions:g,fetchOptionsCallback:m=>g?.filter(y=>y.packageName.toLowerCase().includes(m.toLowerCase()))??[],renderOption:m=>c.jsx(X5,{...m})}:{autoComplete:!1}},[n]);return c.jsxs("div",{className:s,children:[c.jsx("h3",{className:"mb-4 font-semibold text-gray-900",children:"Install Package"}),c.jsxs("div",{className:"flex items-center gap-4",children:[n?.length?c.jsx(_d,{...p,onChange:o}):c.jsx(zd,{name:"package",className:"max-w-xs text-gray-700",value:r,onChange:h,onSubmit:d,disabled:a}),c.jsx(Pe,{className:"h-9 rounded-md text-sm",onClick:d,disabled:a,children:"Install"})]}),c.jsx("p",{className:"mb-3 ml-2 h-3 text-sm text-red-800",children:f})]})},Un=({label:e,value:t})=>c.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[c.jsxs("p",{className:"text-gray-600",children:[e,":"]}),c.jsx("p",{className:"text-gray-600",children:t})]}),Z5=e=>{const{package:{name:t,description:n,category:s,publisher:r,publisherUrl:o,modules:a,id:i,removable:l},mutable:u,onUninstall:d,className:h}=e,[f,p]=b.useState(!1);return c.jsxs("li",{className:M("relative flex flex-col items-start rounded-md border border-gray-200 p-3 text-sm leading-5 shadow-sm",h),children:[c.jsx("h3",{className:"font-semibold text-gray-900",children:t}),c.jsx(Un,{label:"Description",value:n}),c.jsx(Un,{label:"Category",value:s}),c.jsx(Un,{label:"Publisher",value:r}),c.jsx(Un,{label:"Publisher URL",value:c.jsx("a",{className:"underline",href:o,children:o})}),c.jsx("p",{className:"text-sm text-gray-600",children:"Modules included:"}),c.jsx("ul",{className:"list-disc pl-5",children:a.map(g=>c.jsx("li",{children:c.jsx("span",{className:"text-gray-600",children:g})},g))}),u&&l&&c.jsx(Er,{items:[{id:"uninstall",label:"Uninstall",icon:c.jsx(O,{name:"Trash"}),className:"text-red-900"}],onItemClick:g=>{g==="uninstall"&&d(i)},onOpenChange:p,open:f,children:c.jsx("button",{className:"group absolute right-3 top-3",onClick:g=>{g.stopPropagation(),p(!0)},children:c.jsx(O,{className:"text-gray-600 group-hover:text-gray-900",name:"VerticalDots"})})})]})},e6=e=>{const{className:t,packages:n,onUninstall:s,mutable:r,...o}=e,a=b.useCallback(i=>{s(i)},[s]);return c.jsxs("div",{...o,className:M("flex max-h-[370px] flex-col items-stretch overflow-hidden",t),children:[c.jsx("h3",{className:"mb-4 font-semibold text-gray-900",children:"Installed Packages"}),c.jsx("div",{className:"flex-1 overflow-y-auto pr-2",children:c.jsx("ul",{className:"flex flex-col items-stretch gap-4 pr-2",children:n.map(i=>c.jsx(Z5,{package:i,onUninstall:a,mutable:r},i.id))})})]})},t6=e=>{const{reactorOptions:t,reactor:n,onReactorChange:s,...r}=e,o=b.useCallback(a=>{s(Array.isArray(a)?a.at(-1):a)},[s]);return c.jsxs("div",{...r,children:[c.jsx("h3",{className:"mb-4 font-semibold text-gray-900",children:"Select Reactor"}),c.jsx(qi,{className:"min-w-36 max-w-fit",name:"reactor",required:!0,value:n,options:t,multiple:!1,onChange:o})]})},Vw=e=>{const{className:t,reactorOptions:n,reactor:s,onReactorChange:r,onInstall:o,packages:a,onUninstall:i,mutable:l,packageOptions:u,...d}=e,h=b.useMemo(()=>u?.filter(f=>!a.find(p=>p.name===f.packageName)),[a,u]);return c.jsxs("div",{...d,className:M("flex h-full flex-1 flex-col rounded-lg p-3",t),children:[c.jsx(t6,{reactor:s,reactorOptions:n,onReactorChange:r,className:"mb-4"}),l&&c.jsx(J5,{onInstall:o,packageOptions:h}),c.jsx(e6,{packages:a,onUninstall:i,mutable:l})]})};function Bw(e){const{title:t,overlayProps:n,contentProps:s,onOpenChange:r,tabs:o,defaultTab:a,...i}=e,[l,u]=b.useState(a??o.at(0)?.id),d=o.map(p=>c.jsx("button",{type:"button",onClick:()=>u(p.id),children:c.jsxs("div",{className:M("flex h-9 w-48 cursor-pointer items-center gap-x-2 rounded-md pl-3 hover:bg-slate-50",l===p.id?"bg-slate-50":"bg-transparent"),children:[p.icon,c.jsx("span",{children:p.label})]})},p.id)),f=o.find(p=>p.id===l)?.content;return c.jsxs(_e,{contentProps:{...s,className:M("min-h-full w-full max-w-4xl rounded-xl",s?.className),style:{...s?.style,boxShadow:"0px 0px 16px 4px rgba(0, 0, 0, 0.04), 0px 33px 32px -16px rgba(0, 0, 0, 0.10)"}},onOpenChange:r,overlayProps:{...n,className:M("py-28",n?.className)},...i,children:[c.jsxs("div",{className:"flex justify-between border-b border-slate-50 p-4",children:[c.jsx("h1",{className:"text-center text-xl font-semibold",children:t}),c.jsx("button",{type:"button",className:"flex size-6 items-center justify-center rounded-md outline-none",onClick:()=>r?.(!1),children:c.jsx(O,{name:"XmarkLight",size:24})})]}),c.jsxs("div",{className:"flex flex-1",children:[c.jsx("div",{className:"flex flex-col gap-y-1 p-3 pt-6",children:d}),c.jsx("div",{className:"m-6 flex h-full flex-1 flex-col overflow-hidden rounded-lg border border-slate-50",children:typeof f=="function"?c.jsx(f,{}):f})]})]})}const ji="min-h-[48px] min-w-[142px] text-base font-semibold py-3 px-6 rounded-xl outline-none active:opacity-75 hover:scale-105 transform transition-all";function Hw(e){const{body:t,header:n,onOpenChange:s,onContinue:r,cancelLabel:o,continueLabel:a,overlayProps:i,contentProps:l,...u}=e;return c.jsx(_e,{contentProps:{...l,className:M("rounded-3xl",l?.className)},onOpenChange:s,overlayProps:{...i,className:i?.className},...u,children:c.jsxs("div",{className:"w-[400px] p-6 text-slate-300",children:[c.jsx("div",{className:"border-b border-slate-50 pb-2 text-2xl font-bold text-gray-800",children:n}),c.jsx("div",{className:"my-6 rounded-md bg-slate-50 p-4 text-center",children:t}),c.jsxs("div",{className:"mt-8 flex justify-between gap-3",children:[c.jsx("button",{className:M(ji,"flex-1 bg-slate-50 text-slate-800"),onClick:()=>s?.(!1),children:o}),c.jsx("button",{className:M(ji,"flex-1 bg-gray-800 text-gray-50"),onClick:r,children:a})]})]})})}function n6(e){const{branch:t="main"}=e;return c.jsxs("button",{className:"flex h-8 w-fit items-center gap-1 rounded-lg bg-slate-50 pl-1 pr-2 text-xs text-stone-300",children:[c.jsx(O,{name:"Branch"}),c.jsx("span",{children:"BRANCH"}),c.jsx("span",{className:"text-gray-900",children:t})]})}function r6(e){const{docId:t}=e,[,n]=xr();function s(r){return()=>{n(r).catch(o=>{console.error("Failed to copy!",o)})}}return c.jsxs("button",{className:"flex h-8 w-fit items-center gap-1 rounded-lg bg-slate-50 pl-1 pr-2 text-xs text-stone-300",onClick:s(t),children:[c.jsx(O,{name:"Link"}),"DOC ID",c.jsx("span",{className:"text-gray-900",children:t})]})}const s6=e=>{const{documentState:t,onCopyState:n}=e,[,s]=xr();function r(){const o=JSON.stringify(t,null,2);s(o).then(()=>{n?.()}).catch(a=>{console.error("Failed to copy document state!",a)})}return c.jsx("button",{className:"rounded-lg bg-slate-50 p-1 text-stone-300",onClick:r,children:c.jsx(O,{name:"CurlyBrackets"})})};function o6(e){const{value:t,onChange:n}=e,s=[{displayValue:"Global scope",value:"global"},{displayValue:"Local scope",value:"local"}];return c.jsx(yt,{absolutePositionMenu:!0,containerClassName:"bg-slate-50 text-gray-500 rounded-lg w-fit text-xs z-10",id:"scope select",itemClassName:"py-2 text-gray-500 grid grid-cols-[auto,auto] gap-1",items:s,menuClassName:"min-w-0 text-gray-500",onChange:n,value:t})}function a6(e){const{title:t,docId:n,scope:s,onChangeScope:r,onClose:o,className:a,documentState:i,onCopyState:l,...u}=e;return c.jsxs("header",{className:M("flex items-center justify-between bg-transparent",a),...u,children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("button",{name:"close-revision-history",className:"shadow-button rounded-lg bg-gray-50 p-1 text-stone-300",onClick:o,children:c.jsx(O,{name:"VariantArrowLeft"})}),c.jsx("h1",{className:"text-xs",children:t})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(r6,{docId:n}),i&&c.jsx(s6,{documentState:i,onCopyState:l}),c.jsx(n6,{}),c.jsx(o6,{onChange:r,value:s})]})]})}function pt(e,t,n){let s=n.initialDeps??[],r;function o(){var a,i,l,u;let d;n.key&&((a=n.debug)!=null&&a.call(n))&&(d=Date.now());const h=e();if(!(h.length!==s.length||h.some((g,m)=>s[m]!==g)))return r;s=h;let p;if(n.key&&((i=n.debug)!=null&&i.call(n))&&(p=Date.now()),r=t(...h),n.key&&((l=n.debug)!=null&&l.call(n))){const g=Math.round((Date.now()-d)*100)/100,m=Math.round((Date.now()-p)*100)/100,y=m/16,v=(x,C)=>{for(x=String(x);x.length<C;)x=" "+x;return x};console.info(`%c⏱ ${v(m,5)} /${v(g,5)} ms`,`
39
+ `)})}}Object.defineProperty(Xt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Jt extends be{constructor(t){super(t,{code:Jt.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Jt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Ge extends be{constructor(t){super(t,{code:Ge.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Ge,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Zt extends be{constructor(t){super(t,{code:Zt.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Zt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Je extends be{constructor(t,{method:n}={}){super(t,{code:Je.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(Je,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Pt extends be{constructor(t){super(t,{code:Pt.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Pt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class en extends be{constructor(t){super(t,{code:en.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(en,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class he extends xe{constructor(t){super(t,{code:he.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(he,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class tn extends xe{constructor(t){super(t,{code:tn.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(tn,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class nn extends xe{constructor(t,{method:n}={}){super(t,{code:nn.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(nn,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class rn extends xe{constructor(t){super(t,{code:rn.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(rn,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class sn extends xe{constructor(t){super(t,{code:sn.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(sn,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class ct extends xe{constructor(t){super(t,{code:ct.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(ct,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class on extends xe{constructor(t){super(t,{code:on.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(on,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class an extends xe{constructor(t){super(t,{code:an.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(an,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class cn extends xe{constructor(t){super(t,{code:cn.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(cn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class ln extends xe{constructor(t){super(t,{code:ln.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(ln,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class un extends xe{constructor(t){super(t,{code:un.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(un,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class dn extends xe{constructor(t){super(t,{code:dn.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(dn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class fn extends xe{constructor(t){super(t,{code:fn.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(fn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class My extends be{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const Ty=3;function Dy(e,{abi:t,address:n,args:s,docsPath:r,functionName:o,sender:a}){const i=e instanceof Ql?e:e instanceof k?e.walk(g=>"data"in g)||e.walk():{},{code:l,data:u,details:d,message:h,shortMessage:f}=i,p=e instanceof mo?new xy({functionName:o}):[Ty,it.code].includes(l)&&(u||d||h||f)?new Ns({abi:t,data:typeof u=="object"?u.data:u,functionName:o,message:i instanceof Io?d:f??h}):e;return new vy(p,{abi:t,args:s,contractAddress:n,docsPath:r,functionName:o,sender:a})}const ky="0.1.1";function Ry(){return ky}let Jl=class Es extends Error{constructor(t,n={}){const s=(()=>{if(n.cause instanceof Es){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&"details"in n.cause&&typeof n.cause.details=="string"?n.cause.details:n.cause?.message?n.cause.message:n.details})(),r=n.cause instanceof Es&&n.cause.docsPath||n.docsPath,a=`https://oxlib.sh${r??""}`,i=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...s||r?["",s?`Details: ${s}`:void 0,r?`See: ${a}`:void 0]:[]].filter(l=>typeof l=="string").join(`
40
+ `);super(i,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${Ry()}`}),this.cause=n.cause,this.details=s,this.docs=a,this.docsPath=r,this.shortMessage=t}walk(t){return Zl(this,t)}};function Zl(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?Zl(e.cause,t):t?null:e}function Ay(e,t={}){const{dir:n,size:s=32}=t;if(s===0)return e;const r=e.replace("0x","");if(r.length>s*2)throw new $y({size:Math.ceil(r.length/2),targetSize:s,type:"Hex"});return`0x${r[n==="right"?"padEnd":"padStart"](s*2,"0")}`}function Le(e,t={}){const{signed:n,size:s}=t,r=BigInt(e);let o;s?n?o=(1n<<BigInt(s)*8n-1n)-1n:o=2n**(BigInt(s)*8n)-1n:typeof e=="number"&&(o=BigInt(Number.MAX_SAFE_INTEGER));const a=typeof o=="bigint"&&n?-o-1n:0;if(o&&r>o||r<a){const u=typeof e=="bigint"?"n":"";throw new Fy({max:o?`${o}${u}`:void 0,min:`${a}${u}`,signed:n,size:s,value:`${e}${u}`})}const l=`0x${(n&&r<0?(1n<<BigInt(s*8))+BigInt(r):r).toString(16)}`;return s?Ly(l,s):l}function Ly(e,t){return Ay(e,{dir:"left",size:t})}class Fy extends Jl{constructor({max:t,min:n,signed:s,size:r,value:o}){super(`Number \`${o}\` is not in safe${r?` ${r*8}-bit`:""}${s?" signed":" unsigned"} integer range ${t?`(\`${n}\` to \`${t}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}class $y extends Jl{constructor({size:t,targetSize:n,type:s}){super(`${s.charAt(0).toUpperCase()}${s.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}function zy(e){return{address:e.address,amount:Le(e.amount),index:Le(e.index),validatorIndex:Le(e.validatorIndex)}}function _y(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:Le(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:Le(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:Le(e.gasLimit)},...typeof e.number=="bigint"&&{number:Le(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:Le(e.prevRandao)},...typeof e.time=="bigint"&&{time:Le(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(zy)}}}const Uy="0x82ad56cb",Vy="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",By="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",Hy="0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033",Zr="/docs/contract/encodeDeployData";function eu(e){const{abi:t,args:n,bytecode:s}=e;if(!n||n.length===0)return s;const r=t.find(a=>"type"in a&&a.type==="constructor");if(!r)throw new Cb({docsPath:Zr});if(!("inputs"in r))throw new $a({docsPath:Zr});if(!r.inputs||r.inputs.length===0)throw new $a({docsPath:Zr});const o=xn(r.inputs,n);return Mr([s,o])}class gt extends k{constructor({cause:t,message:n}={}){const s=n?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${s?`with reason: ${s}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}}Object.defineProperty(gt,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(gt,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class lr extends k{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${tt(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(lr,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class Os extends k{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${tt(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(Os,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class Is extends k{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:t,name:"NonceTooHighError"})}}Object.defineProperty(Is,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Ms extends k{constructor({cause:t,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
41
+ `),{cause:t,name:"NonceTooLowError"})}}Object.defineProperty(Ms,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class Ts extends k{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}}Object.defineProperty(Ts,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class Ds extends k{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
42
+ `),{cause:t,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(Ds,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class ks extends k{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:t,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(ks,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class Rs extends k{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction is too low.`,{cause:t,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(Rs,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class As extends k{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(As,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class ur extends k{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:s}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${tt(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${s?` = ${tt(s)} gwei`:""}).`].join(`
43
+ `),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(ur,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class tu extends k{constructor({cause:t}){super(`An error occurred while executing: ${t?.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function Wy(e,t){const n=(e.details||"").toLowerCase(),s=e instanceof k?e.walk(r=>r?.code===gt.code):e;return s instanceof k?new gt({cause:e,message:s.details}):gt.nodeMessage.test(n)?new gt({cause:e,message:e.details}):lr.nodeMessage.test(n)?new lr({cause:e,maxFeePerGas:t?.maxFeePerGas}):Os.nodeMessage.test(n)?new Os({cause:e,maxFeePerGas:t?.maxFeePerGas}):Is.nodeMessage.test(n)?new Is({cause:e,nonce:t?.nonce}):Ms.nodeMessage.test(n)?new Ms({cause:e,nonce:t?.nonce}):Ts.nodeMessage.test(n)?new Ts({cause:e,nonce:t?.nonce}):Ds.nodeMessage.test(n)?new Ds({cause:e}):ks.nodeMessage.test(n)?new ks({cause:e,gas:t?.gas}):Rs.nodeMessage.test(n)?new Rs({cause:e,gas:t?.gas}):As.nodeMessage.test(n)?new As({cause:e}):ur.nodeMessage.test(n)?new ur({cause:e,maxFeePerGas:t?.maxFeePerGas,maxPriorityFeePerGas:t?.maxPriorityFeePerGas}):new tu({cause:e})}function qy(e,{docsPath:t,...n}){const s=(()=>{const r=Wy(e,n);return r instanceof tu?e:r})();return new yy(s,{docsPath:t,...n})}function Gy(e,{format:t}){if(!t)return{};const n={};function s(o){const a=Object.keys(o);for(const i of a)i in e&&(n[i]=e[i]),o[i]&&typeof o[i]=="object"&&!Array.isArray(o[i])&&s(o[i])}const r=t(e||{});return s(r),n}const Qy={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Yy(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=Ky(e.authorizationList)),typeof e.accessList<"u"&&(n.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(n.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?n.blobs=e.blobs.map(s=>Ce(s)):n.blobs=e.blobs),typeof e.data<"u"&&(n.data=e.data),e.account&&(n.from=e.account.address),typeof e.from<"u"&&(n.from=e.from),typeof e.gas<"u"&&(n.gas=Z(e.gas)),typeof e.gasPrice<"u"&&(n.gasPrice=Z(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(n.maxFeePerBlobGas=Z(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(n.maxFeePerGas=Z(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(n.maxPriorityFeePerGas=Z(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(n.nonce=Z(e.nonce)),typeof e.to<"u"&&(n.to=e.to),typeof e.type<"u"&&(n.type=Qy[e.type]),typeof e.value<"u"&&(n.value=Z(e.value)),n}function Ky(e){return e.map(t=>({address:t.address,r:t.r?Z(BigInt(t.r)):t.r,s:t.s?Z(BigInt(t.s)):t.s,chainId:Z(t.chainId),nonce:Z(t.nonce),...typeof t.yParity<"u"?{yParity:Z(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:Z(t.v)}:{}}))}function Xy(){let e=()=>{},t=()=>{};return{promise:new Promise((s,r)=>{e=s,t=r}),resolve:e,reject:t}}const es=new Map;function nu({fn:e,id:t,shouldSplitBatch:n,wait:s=0,sort:r}){const o=async()=>{const d=l();a();const h=d.map(({args:f})=>f);h.length!==0&&e(h).then(f=>{r&&Array.isArray(f)&&f.sort(r);for(let p=0;p<d.length;p++){const{resolve:g}=d[p];g?.([f[p],f])}}).catch(f=>{for(let p=0;p<d.length;p++){const{reject:g}=d[p];g?.(f)}})},a=()=>es.delete(t),i=()=>l().map(({args:d})=>d),l=()=>es.get(t)||[],u=d=>es.set(t,[...l(),d]);return{flush:a,async schedule(d){const{promise:h,resolve:f,reject:p}=Xy();return n?.([...i(),d])&&o(),l().length>0?(u({args:d,resolve:f,reject:p}),h):(u({args:d,resolve:f,reject:p}),setTimeout(o,s),h)}}}function Ya(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:s})=>{if(n.length!==66)throw new _a({size:n.length,targetSize:66,type:"hex"});if(s.length!==66)throw new _a({size:s.length,targetSize:66,type:"hex"});return t[n]=s,t},{})}function Jy(e){const{balance:t,nonce:n,state:s,stateDiff:r,code:o}=e,a={};if(o!==void 0&&(a.code=o),t!==void 0&&(a.balance=Z(t)),n!==void 0&&(a.nonce=Z(n)),s!==void 0&&(a.state=Ya(s)),r!==void 0){if(a.state)throw new py;a.stateDiff=Ya(r)}return a}function Zy(e){if(!e)return;const t={};for(const{address:n,...s}of e){if(!De(n,{strict:!1}))throw new ot({address:n});if(t[n])throw new hy({address:n});t[n]=Jy(s)}return t}const ev=2n**256n-1n;function tv(e){const{account:t,gasPrice:n,maxFeePerGas:s,maxPriorityFeePerGas:r,to:o}=e,a=t?Tr(t):void 0;if(a&&!De(a.address))throw new ot({address:a.address});if(o&&!De(o))throw new ot({address:o});if(typeof n<"u"&&(typeof s<"u"||typeof r<"u"))throw new gy;if(s&&s>ev)throw new lr({maxFeePerGas:s});if(r&&s&&r>s)throw new ur({maxFeePerGas:s,maxPriorityFeePerGas:r})}async function ru(e,t){const{account:n=e.account,authorizationList:s,batch:r=!!e.batch?.multicall,blockNumber:o,blockTag:a=e.experimental_blockTag??"latest",accessList:i,blobs:l,blockOverrides:u,code:d,data:h,factory:f,factoryData:p,gas:g,gasPrice:m,maxFeePerBlobGas:y,maxFeePerGas:v,maxPriorityFeePerGas:x,nonce:C,to:N,value:w,stateOverride:j,...S}=t,P=n?Tr(n):void 0;if(d&&(f||p))throw new k("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(d&&N)throw new k("Cannot provide both `code` & `to` as parameters.");const E=d&&h,T=f&&p&&N&&h,I=E||T,D=E?su({code:d,data:h}):T?sv({data:h,factory:f,factoryData:p,to:N}):h;try{tv(t);const F=(typeof o=="bigint"?Z(o):void 0)||a,_=u?_y(u):void 0,U=Zy(j),H=e.chain?.formatters?.transactionRequest?.format,W=(H||Yy)({...Gy(S,{format:H}),accessList:i,account:P,authorizationList:s,blobs:l,data:D,gas:g,gasPrice:m,maxFeePerBlobGas:y,maxFeePerGas:v,maxPriorityFeePerGas:x,nonce:C,to:I?void 0:N,value:w},"call");if(r&&nv({request:W})&&!U&&!_)try{return await rv(e,{...W,blockNumber:o,blockTag:a})}catch(V){if(!(V instanceof Vl)&&!(V instanceof Ps))throw V}const ee=(()=>{const V=[W,F];return U&&_?[...V,U,_]:U?[...V,U]:_?[...V,{},_]:V})(),re=await e.request({method:"eth_call",params:ee});return re==="0x"?{data:void 0}:{data:re}}catch(R){const F=ov(R),{offchainLookup:_,offchainLookupSignature:U}=await Ud(async()=>{const{offchainLookup:H,offchainLookupSignature:G}=await Promise.resolve().then(()=>Tv);return{offchainLookup:H,offchainLookupSignature:G}},void 0);if(e.ccipRead!==!1&&F?.slice(0,10)===U&&N)return{data:await _(e,{data:F,to:N})};throw I&&F?.slice(0,10)==="0x101bb98d"?new wy({factory:f}):qy(R,{...t,account:P,chain:e.chain})}}function nv({request:e}){const{data:t,to:n,...s}=e;return!(!t||t.startsWith(Uy)||!n||Object.values(s).filter(r=>typeof r<"u").length>0)}async function rv(e,t){const{batchSize:n=1024,deployless:s=!1,wait:r=0}=typeof e.batch?.multicall=="object"?e.batch.multicall:{},{blockNumber:o,blockTag:a=e.experimental_blockTag??"latest",data:i,to:l}=t,u=(()=>{if(s)return null;if(t.multicallAddress)return t.multicallAddress;if(e.chain)return Oo({blockNumber:o,chain:e.chain,contract:"multicall3"});throw new Vl})(),h=(typeof o=="bigint"?Z(o):void 0)||a,{schedule:f}=nu({id:`${e.uid}.${h}`,wait:r,shouldSplitBatch(m){return m.reduce((v,{data:x})=>v+(x.length-2),0)>n*2},fn:async m=>{const y=m.map(C=>({allowFailure:!0,callData:C.data,target:C.to})),v=Eo({abi:La,args:[y],functionName:"aggregate3"}),x=await e.request({method:"eth_call",params:[{...u===null?{data:su({code:Hy,data:v})}:{to:u,data:v}},h]});return No({abi:La,args:[y],functionName:"aggregate3",data:x||"0x"})}}),[{returnData:p,success:g}]=await f({data:i,to:l});if(!g)throw new Ql({data:p});return p==="0x"?{data:void 0}:{data:p}}function su(e){const{code:t,data:n}=e;return eu({abi:zl(["constructor(bytes, bytes)"]),bytecode:Vy,args:[t,n]})}function sv(e){const{data:t,factory:n,factoryData:s,to:r}=e;return eu({abi:zl(["constructor(address, bytes, address, bytes)"]),bytecode:By,args:[r,t,n,s]})}function ov(e){if(!(e instanceof k))return;const t=e.walk();return typeof t?.data=="object"?t.data?.data:t.data}async function dr(e,t){const{abi:n,address:s,args:r,functionName:o,...a}=t,i=Eo({abi:n,args:r,functionName:o});try{const{data:l}=await kr(e,ru,"call")({...a,data:i,to:s});return No({abi:n,args:r,functionName:o,data:l||"0x"})}catch(l){throw Dy(l,{abi:n,address:s,args:r,docsPath:"/docs/contract/readContract",functionName:o})}}class av extends k{constructor({data:t}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(t)}`],name:"EnsAvatarInvalidMetadataError"})}}class Ft extends k{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class Mo extends k{constructor({uri:t}){super(`Unable to resolve ENS avatar URI "${t}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class iv extends k{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const cv=/(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,lv=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/,uv=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,dv=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function fv(e){try{const t=await fetch(e,{method:"HEAD"});return t.status===200?t.headers.get("content-type")?.startsWith("image/"):!1}catch(t){return typeof t=="object"&&typeof t.response<"u"||!Object.hasOwn(globalThis,"Image")?!1:new Promise(n=>{const s=new Image;s.onload=()=>{n(!0)},s.onerror=()=>{n(!1)},s.src=e})}}function Ka(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function ou({uri:e,gatewayUrls:t}){const n=uv.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const s=Ka(t?.ipfs,"https://ipfs.io"),r=Ka(t?.arweave,"https://arweave.net"),o=e.match(cv),{protocol:a,subpath:i,target:l,subtarget:u=""}=o?.groups||{},d=a==="ipns:/"||i==="ipns/",h=a==="ipfs:/"||i==="ipfs/"||lv.test(e);if(e.startsWith("http")&&!d&&!h){let p=e;return t?.arweave&&(p=e.replace(/https:\/\/arweave.net/g,t?.arweave)),{uri:p,isOnChain:!1,isEncoded:!1}}if((d||h)&&l)return{uri:`${s}/${d?"ipns":"ipfs"}/${l}${u}`,isOnChain:!1,isEncoded:!1};if(a==="ar:/"&&l)return{uri:`${r}/${l}${u||""}`,isOnChain:!1,isEncoded:!1};let f=e.replace(dv,"");if(f.startsWith("<svg")&&(f=`data:image/svg+xml;base64,${btoa(f)}`),f.startsWith("data:")||f.startsWith("{"))return{uri:f,isOnChain:!0,isEncoded:!1};throw new Mo({uri:e})}function au(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new av({data:e});return e.image||e.image_url||e.image_data}async function hv({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(r=>r.json());return await To({gatewayUrls:e,uri:au(n)})}catch{throw new Mo({uri:t})}}async function To({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:s}=ou({uri:t,gatewayUrls:e});if(s||await fv(n))return n;throw new Mo({uri:t})}function pv(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[n,s,r]=t.split("/"),[o,a]=n.split(":"),[i,l]=s.split(":");if(!o||o.toLowerCase()!=="eip155")throw new Ft({reason:"Only EIP-155 supported"});if(!a)throw new Ft({reason:"Chain ID not found"});if(!l)throw new Ft({reason:"Contract address not found"});if(!r)throw new Ft({reason:"Token ID not found"});if(!i)throw new Ft({reason:"ERC namespace not found"});return{chainID:Number.parseInt(a,10),namespace:i.toLowerCase(),contractAddress:l,tokenID:r}}async function mv(e,{nft:t}){if(t.namespace==="erc721")return dr(e,{address:t.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(t.tokenID)]});if(t.namespace==="erc1155")return dr(e,{address:t.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(t.tokenID)]});throw new iv({namespace:t.namespace})}async function gv(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?bv(e,{gatewayUrls:t,record:n}):To({uri:n,gatewayUrls:t})}async function bv(e,{gatewayUrls:t,record:n}){const s=pv(n),r=await mv(e,{nft:s}),{uri:o,isOnChain:a,isEncoded:i}=ou({uri:r,gatewayUrls:t});if(a&&(o.includes("data:application/json;base64,")||o.startsWith("{"))){const u=i?atob(o.replace("data:application/json;base64,","")):o,d=JSON.parse(u);return To({uri:au(d),gatewayUrls:t})}let l=s.tokenID;return s.namespace==="erc1155"&&(l=l.replace("0x","").padStart(64,"0")),hv({gatewayUrls:t,uri:o.replace(/(?:0x)?{id}/,l)})}async function yv(e,t){const{blockNumber:n,blockTag:s,key:r,name:o,gatewayUrls:a,strict:i}=t,{chain:l}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!l)throw new Error("client chain not configured. universalResolverAddress is required.");return Oo({blockNumber:n,chain:l,contract:"ensUniversalResolver"})})(),d=l?.ensTlds;if(d&&!d.some(h=>o.endsWith(h)))return null;try{const h={address:u,abi:vb,args:[Cl(Oy(o)),Eo({abi:Fa,functionName:"text",args:[Py(o),r]}),a??[Dr]],functionName:"resolveWithGateways",blockNumber:n,blockTag:s},p=await kr(e,dr,"readContract")(h);if(p[0]==="0x")return null;const g=No({abi:Fa,functionName:"text",data:p[0]});return g===""?null:g}catch(h){if(i)throw h;if(Yl(h))return null;throw h}}async function vv(e,{blockNumber:t,blockTag:n,assetGatewayUrls:s,name:r,gatewayUrls:o,strict:a,universalResolverAddress:i}){const l=await kr(e,yv,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:r,universalResolverAddress:i,gatewayUrls:o,strict:a});if(!l)return null;try{return await gv(e,{record:l,gatewayUrls:s})}catch{return null}}async function xv(e,t){const{address:n,blockNumber:s,blockTag:r,coinType:o=60n,gatewayUrls:a,strict:i}=t,{chain:l}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!l)throw new Error("client chain not configured. universalResolverAddress is required.");return Oo({blockNumber:s,chain:l,contract:"ensUniversalResolver"})})();try{const d={address:u,abi:xb,args:[n,o,a??[Dr]],functionName:"reverseWithGateways",blockNumber:s,blockTag:r},h=kr(e,dr,"readContract"),[f]=await h(d);return f||null}catch(d){if(i)throw d;if(Yl(d))return null;throw d}}function wv(e,t){if(!De(e,{strict:!1}))throw new ot({address:e});if(!De(t,{strict:!1}))throw new ot({address:t});return e.toLowerCase()===t.toLowerCase()}const An=new xo(8192);function Cv(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(An.get(n))return An.get(n);const s=e().finally(()=>An.delete(n));return An.set(n,s),s}async function Sv(e){return new Promise(t=>setTimeout(t,e))}function iu(e,{delay:t=100,retryCount:n=2,shouldRetry:s=()=>!0}={}){return new Promise((r,o)=>{const a=async({count:i=0}={})=>{const l=async({error:u})=>{const d=typeof t=="function"?t({count:i,error:u}):t;d&&await Sv(d),a({count:i+1})};try{const u=await e();r(u)}catch(u){if(i<n&&await s({count:i,error:u}))return l({error:u});o(u)}};a()})}function jv(e,t={}){return async(n,s={})=>{const{dedupe:r=!1,methods:o,retryDelay:a=150,retryCount:i=3,uid:l}={...t,...s},{method:u}=n;if(o?.exclude?.includes(u))throw new Je(new Error("method not supported"),{method:u});if(o?.include&&!o.include.includes(u))throw new Je(new Error("method not supported"),{method:u});const d=r?bo(`${l}.${Me(n)}`):void 0;return Cv(()=>iu(async()=>{try{return await e(n)}catch(h){const f=h;switch(f.code){case Gt.code:throw new Gt(f);case Qt.code:throw new Qt(f);case Yt.code:throw new Yt(f,{method:n.method});case Kt.code:throw new Kt(f);case it.code:throw new it(f);case Xt.code:throw new Xt(f);case Jt.code:throw new Jt(f);case Ge.code:throw new Ge(f);case Zt.code:throw new Zt(f);case Je.code:throw new Je(f,{method:n.method});case Pt.code:throw new Pt(f);case en.code:throw new en(f);case he.code:throw new he(f);case tn.code:throw new tn(f);case nn.code:throw new nn(f);case rn.code:throw new rn(f);case sn.code:throw new sn(f);case ct.code:throw new ct(f);case on.code:throw new on(f);case an.code:throw new an(f);case cn.code:throw new cn(f);case ln.code:throw new ln(f);case un.code:throw new un(f);case dn.code:throw new dn(f);case fn.code:throw new fn(f);case 5e3:throw new he(f);default:throw h instanceof k?h:new My(f)}}},{delay:({count:h,error:f})=>{if(f&&f instanceof nt){const p=f?.headers?.get("Retry-After");if(p?.match(/\d/))return Number.parseInt(p,10)*1e3}return~~(1<<h)*a},retryCount:i,shouldRetry:({error:h})=>Pv(h)}),{enabled:r,id:d})}}function Pv(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===Pt.code||e.code===it.code:e instanceof nt&&e.status?e.status===403||e.status===408||e.status===413||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:!0}class Nv extends k{constructor({callbackSelector:t,cause:n,data:s,extraData:r,sender:o,urls:a}){super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],n.metaMessages?.length?"":[],"Offchain Gateway Call:",a&&[" Gateway URL(s):",...a.map(i=>` ${Sn(i)}`)],` Sender: ${o}`,` Data: ${s}`,` Callback selector: ${t}`,` Extra data: ${r}`].flat(),name:"OffchainLookupError"})}}class Ev extends k{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${Sn(n)}`,`Response: ${Me(t)}`],name:"OffchainLookupResponseMalformedError"})}}class Ov extends k{constructor({sender:t,to:n}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${n}`,`OffchainLookup sender address: ${t}`],name:"OffchainLookupSenderMismatchError"})}}const Iv="0x556f1830",cu={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function Mv(e,{blockNumber:t,blockTag:n,data:s,to:r}){const{args:o}=Hl({data:s,abi:[cu]}),[a,i,l,u,d]=o,{ccipRead:h}=e,f=h&&typeof h?.request=="function"?h.request:lu;try{if(!wv(r,a))throw new Ov({sender:a,to:r});const p=i.includes(Dr)?await Kl({data:l,ccipRequest:f}):await f({data:l,sender:a,urls:i}),{data:g}=await ru(e,{blockNumber:t,blockTag:n,data:Ke([u,xn([{type:"bytes"},{type:"bytes"}],[p,d])]),to:r});return g}catch(p){throw new Nv({callbackSelector:u,cause:p,data:s,extraData:d,sender:a,urls:i})}}async function lu({data:e,sender:t,urls:n}){let s=new Error("An unknown error occurred.");for(let r=0;r<n.length;r++){const o=n[r],a=o.includes("{data}")?"GET":"POST",i=a==="POST"?{data:e,sender:t}:void 0,l=a==="POST"?{"Content-Type":"application/json"}:{};try{const u=await fetch(o.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(i),headers:l,method:a});let d;if(u.headers.get("Content-Type")?.startsWith("application/json")?d=(await u.json()).data:d=await u.text(),!u.ok){s=new nt({body:i,details:d?.error?Me(d.error):u.statusText,headers:u.headers,status:u.status,url:o});continue}if(!ut(d)){s=new Ev({result:d,url:o});continue}return d}catch(u){s=new nt({body:i,details:u.message,url:o})}}throw s}const Tv=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:lu,offchainLookup:Mv,offchainLookupAbiItem:cu,offchainLookupSignature:Iv},Symbol.toStringTag,{value:"Module"}));function Dv(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}function uu(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:s}){return new Promise((r,o)=>{(async()=>{let a;try{const i=new AbortController;n>0&&(a=setTimeout(()=>{s?i.abort():o(t)},n)),r(await e({signal:i?.signal||null}))}catch(i){i?.name==="AbortError"&&o(t),o(i)}finally{clearTimeout(a)}})()})}function kv(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const Xa=kv();function Rv(e,t={}){return{async request(n){const{body:s,fetchFn:r=t.fetchFn??fetch,onRequest:o=t.onRequest,onResponse:a=t.onResponse,timeout:i=t.timeout??1e4}=n,l={...t.fetchOptions??{},...n.fetchOptions??{}},{headers:u,method:d,signal:h}=l;try{const f=await uu(async({signal:g})=>{const m={...l,body:Array.isArray(s)?Me(s.map(C=>({jsonrpc:"2.0",id:C.id??Xa.take(),...C}))):Me({jsonrpc:"2.0",id:s.id??Xa.take(),...s}),headers:{"Content-Type":"application/json",...u},method:d||"POST",signal:h||(i>0?g:null)},y=new Request(e,m),v=await o?.(y,m)??{...m,url:e};return await r(v.url??e,v)},{errorInstance:new Qa({body:s,url:e}),timeout:i,signal:!0});a&&await a(f);let p;if(f.headers.get("Content-Type")?.startsWith("application/json"))p=await f.json();else{p=await f.text();try{p=JSON.parse(p||"{}")}catch(g){if(f.ok)throw g;p={error:p}}}if(!f.ok)throw new nt({body:s,details:Me(p.error)||f.statusText,headers:f.headers,status:f.status,url:e});return p}catch(f){throw f instanceof nt||f instanceof Qa?f:new nt({body:s,cause:f,url:e})}}}}function du(e,t,n){const s=e[t.name];if(typeof s=="function")return s;const r=e[n];return typeof r=="function"?r:o=>t(e,o)}const Yn="2.22.1",Av=()=>`@wagmi/core@${Yn}`;var fu=function(e,t,n,s){if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?s:n==="a"?s.call(e):s?s.value:t.get(e)},fr,hu;let Do=class Ls extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return Av()}constructor(t,n={}){super(),fr.add(this),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiCoreError"});const s=n.cause instanceof Ls?n.cause.details:n.cause?.message?n.cause.message:n.details,r=n.cause instanceof Ls&&n.cause.docsPath||n.docsPath;this.message=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...r?[`Docs: ${this.docsBaseUrl}${r}.html${n.docsSlug?`#${n.docsSlug}`:""}`]:[],...s?[`Details: ${s}`]:[],`Version: ${this.version}`].join(`
44
+ `),n.cause&&(this.cause=n.cause),this.details=s,this.docsPath=r,this.metaMessages=n.metaMessages,this.shortMessage=t}walk(t){return fu(this,fr,"m",hu).call(this,this,t)}};fr=new WeakSet,hu=function e(t,n){return n?.(t)?t:t.cause?fu(this,fr,"m",e).call(this,t.cause,n):t};class Fs extends Do{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}const $s=256;let Ln=$s,Fn;function pu(e=11){if(!Fn||Ln+e>$s*2){Fn="",Ln=0;for(let t=0;t<$s;t++)Fn+=(256+Math.random()*256|0).toString(16).substring(1)}return Fn.substring(Ln,Ln+++e)}function Lv(e){const{batch:t,chain:n,ccipRead:s,key:r="base",name:o="Base Client",type:a="base"}=e,i=e.experimental_blockTag??(typeof n?.experimental_preconfirmationTime=="number"?"pending":void 0),l=n?.blockTime??12e3,u=Math.min(Math.max(Math.floor(l/2),500),4e3),d=e.pollingInterval??u,h=e.cacheTime??d,f=e.account?Tr(e.account):void 0,{config:p,request:g,value:m}=e.transport({chain:n,pollingInterval:d}),y={...p,...m},v={account:f,batch:t,cacheTime:h,ccipRead:s,chain:n,key:r,name:o,pollingInterval:d,request:g,transport:y,type:a,uid:pu(),...i?{experimental_blockTag:i}:{}};function x(C){return N=>{const w=N(C);for(const S in v)delete w[S];const j={...C,...w};return Object.assign(j,{extend:x(j)})}}return Object.assign(v,{extend:x(v)})}function Fv({key:e,methods:t,name:n,request:s,retryCount:r=3,retryDelay:o=150,timeout:a,type:i},l){const u=pu();return{config:{key:e,methods:t,name:n,request:s,retryCount:r,retryDelay:o,timeout:a,type:i},request:jv(s,{methods:t,retryCount:r,retryDelay:o,uid:u}),value:l}}class $v extends k{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function zv(e,t={}){const{batch:n,fetchFn:s,fetchOptions:r,key:o="http",methods:a,name:i="HTTP JSON-RPC",onFetchRequest:l,onFetchResponse:u,retryDelay:d,raw:h}=t;return({chain:f,retryCount:p,timeout:g})=>{const{batchSize:m=1e3,wait:y=0}=typeof n=="object"?n:{},v=t.retryCount??p,x=g??t.timeout??1e4,C=f?.rpcUrls.default.http[0];if(!C)throw new $v;const N=Rv(C,{fetchFn:s,fetchOptions:r,onRequest:l,onResponse:u,timeout:x});return Fv({key:o,methods:a,name:i,async request({method:w,params:j}){const S={method:w,params:j},{schedule:P}=nu({id:C,wait:y,shouldSplitBatch(D){return D.length>m},fn:D=>N.request({body:D}),sort:(D,R)=>D.id-R.id}),E=async D=>n?P(D):[await N.request({body:D})],[{error:T,result:I}]=await E(S);if(h)return{error:T,result:I};if(T)throw new Io({body:S,error:T,url:C});return I},retryCount:v,retryDelay:d,timeout:x,type:"http"},{fetchOptions:r,url:C})}}function Ja(e){return e.state.chainId}function _v(e,t){const{chainId:n,...s}=t,r=e.getClient({chainId:n});return du(r,vv,"getEnsAvatar")(s)}function Uv(e,t){const{chainId:n,...s}=t,r=e.getClient({chainId:n});return du(r,xv,"getEnsName")(s)}let ts=!1;async function Vv(e,t={}){if(ts)return[];ts=!0,e.setState(u=>({...u,status:u.current?"reconnecting":"connecting"}));const n=[];if(t.connectors?.length)for(const u of t.connectors){let d;typeof u=="function"?d=e._internal.connectors.setup(u):d=u,n.push(d)}else n.push(...e.connectors);let s;try{s=await e.storage?.getItem("recentConnectorId")}catch{}const r={};for(const[,u]of e.state.connections)r[u.connector.id]=1;s&&(r[s]=0);const o=Object.keys(r).length>0?[...n].sort((u,d)=>(r[u.id]??10)-(r[d.id]??10)):n;let a=!1;const i=[],l=[];for(const u of o){const d=await u.getProvider().catch(()=>{});if(!d||l.some(p=>p===d)||!await u.isAuthorized())continue;const f=await u.connect({isReconnecting:!0}).catch(()=>null);f&&(u.emitter.off("connect",e._internal.events.connect),u.emitter.on("change",e._internal.events.change),u.emitter.on("disconnect",e._internal.events.disconnect),e.setState(p=>{const g=new Map(a?p.connections:new Map).set(u.uid,{accounts:f.accounts,chainId:f.chainId,connector:u});return{...p,current:a?p.current:u.uid,connections:g}}),i.push({accounts:f.accounts,chainId:f.chainId,connector:u}),l.push(d),a=!0)}return(e.state.status==="reconnecting"||e.state.status==="connecting")&&(a?e.setState(u=>({...u,status:"connected"})):e.setState(u=>({...u,connections:new Map,current:null,status:"disconnected"}))),ts=!1,i}class ht extends Do{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}function Bv(e,t){const{onChange:n}=t;return e.subscribe(s=>s.chainId,n)}ko.type="injected";function ko(e={}){const{shimDisconnect:t=!0,unstable_shimAsyncInject:n}=e;function s(){const l=e.target;if(typeof l=="function"){const u=l();if(u)return u}return typeof l=="object"?l:typeof l=="string"?{...Hv[l]??{id:l,name:`${l[0].toUpperCase()}${l.slice(1)}`,provider:`is${l[0].toUpperCase()}${l.slice(1)}`}}:{id:"injected",name:"Injected",provider(u){return u?.ethereum}}}let r,o,a,i;return l=>({get icon(){return s().icon},get id(){return s().id},get name(){return s().name},get supportsSimulation(){return!0},type:ko.type,async setup(){const u=await this.getProvider();u?.on&&e.target&&(a||(a=this.onConnect.bind(this),u.on("connect",a)),r||(r=this.onAccountsChanged.bind(this),u.on("accountsChanged",r)))},async connect({chainId:u,isReconnecting:d,withCapabilities:h}={}){const f=await this.getProvider();if(!f)throw new ht;let p=[];if(d)p=await this.getAccounts().catch(()=>[]);else if(t)try{p=(await f.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}))[0]?.caveats?.[0]?.value?.map(m=>Rn(m)),p.length>0&&(p=await this.getAccounts())}catch(g){const m=g;if(m.code===he.code)throw new he(m);if(m.code===Ge.code)throw m}try{!p?.length&&!d&&(p=(await f.request({method:"eth_requestAccounts"})).map(y=>Rn(y))),a&&(f.removeListener("connect",a),a=void 0),r||(r=this.onAccountsChanged.bind(this),f.on("accountsChanged",r)),o||(o=this.onChainChanged.bind(this),f.on("chainChanged",o)),i||(i=this.onDisconnect.bind(this),f.on("disconnect",i));let g=await this.getChainId();return u&&g!==u&&(g=(await this.switchChain({chainId:u}).catch(y=>{if(y.code===he.code)throw y;return{id:g}}))?.id??g),t&&await l.storage?.removeItem(`${this.id}.disconnected`),e.target||await l.storage?.setItem("injected.connected",!0),{accounts:h?p.map(m=>({address:m,capabilities:{}})):p,chainId:g}}catch(g){const m=g;throw m.code===he.code?new he(m):m.code===Ge.code?new Ge(m):m}},async disconnect(){const u=await this.getProvider();if(!u)throw new ht;o&&(u.removeListener("chainChanged",o),o=void 0),i&&(u.removeListener("disconnect",i),i=void 0),a||(a=this.onConnect.bind(this),u.on("connect",a));try{await uu(()=>u.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}t&&await l.storage?.setItem(`${this.id}.disconnected`,!0),e.target||await l.storage?.removeItem("injected.connected")},async getAccounts(){const u=await this.getProvider();if(!u)throw new ht;return(await u.request({method:"eth_accounts"})).map(h=>Rn(h))},async getChainId(){const u=await this.getProvider();if(!u)throw new ht;const d=await u.request({method:"eth_chainId"});return Number(d)},async getProvider(){if(typeof window>"u")return;let u;const d=s();return typeof d.provider=="function"?u=d.provider(window):typeof d.provider=="string"?u=Kn(window,d.provider):u=d.provider,u&&!u.removeListener&&("off"in u&&typeof u.off=="function"?u.removeListener=u.off:u.removeListener=()=>{}),u},async isAuthorized(){try{if(t&&await l.storage?.getItem(`${this.id}.disconnected`)||!e.target&&!await l.storage?.getItem("injected.connected"))return!1;if(!await this.getProvider()){if(n!==void 0&&n!==!1){const f=async()=>(typeof window<"u"&&window.removeEventListener("ethereum#initialized",f),!!await this.getProvider()),p=typeof n=="number"?n:1e3;if(await Promise.race([...typeof window<"u"?[new Promise(m=>window.addEventListener("ethereum#initialized",()=>m(f()),{once:!0}))]:[],new Promise(m=>setTimeout(()=>m(f()),p))]))return!0}throw new ht}return!!(await iu(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:u,chainId:d}){const h=await this.getProvider();if(!h)throw new ht;const f=l.chains.find(g=>g.id===d);if(!f)throw new ct(new Fs);const p=new Promise(g=>{const m=(y=>{"chainId"in y&&y.chainId===d&&(l.emitter.off("change",m),g())});l.emitter.on("change",m)});try{return await Promise.all([h.request({method:"wallet_switchEthereumChain",params:[{chainId:Z(d)}]}).then(async()=>{await this.getChainId()===d&&l.emitter.emit("change",{chainId:d})}),p]),f}catch(g){const m=g;if(m.code===4902||m?.data?.originalError?.code===4902)try{const{default:y,...v}=f.blockExplorers??{};let x;u?.blockExplorerUrls?x=u.blockExplorerUrls:y&&(x=[y.url,...Object.values(v).map(w=>w.url)]);let C;u?.rpcUrls?.length?C=u.rpcUrls:C=[f.rpcUrls.default?.http[0]??""];const N={blockExplorerUrls:x,chainId:Z(d),chainName:u?.chainName??f.name,iconUrls:u?.iconUrls,nativeCurrency:u?.nativeCurrency??f.nativeCurrency,rpcUrls:C};return await Promise.all([h.request({method:"wallet_addEthereumChain",params:[N]}).then(async()=>{if(await this.getChainId()===d)l.emitter.emit("change",{chainId:d});else throw new he(new Error("User rejected switch after adding network."))}),p]),f}catch(y){throw new he(y)}throw m.code===he.code?new he(m):new ct(m)}},async onAccountsChanged(u){if(u.length===0)this.onDisconnect();else if(l.emitter.listenerCount("connect")){const d=(await this.getChainId()).toString();this.onConnect({chainId:d}),t&&await l.storage?.removeItem(`${this.id}.disconnected`)}else l.emitter.emit("change",{accounts:u.map(d=>Rn(d))})},onChainChanged(u){const d=Number(u);l.emitter.emit("change",{chainId:d})},async onConnect(u){const d=await this.getAccounts();if(d.length===0)return;const h=Number(u.chainId);l.emitter.emit("connect",{accounts:d,chainId:h});const f=await this.getProvider();f&&(a&&(f.removeListener("connect",a),a=void 0),r||(r=this.onAccountsChanged.bind(this),f.on("accountsChanged",r)),o||(o=this.onChainChanged.bind(this),f.on("chainChanged",o)),i||(i=this.onDisconnect.bind(this),f.on("disconnect",i)))},async onDisconnect(u){const d=await this.getProvider();u&&u.code===1013&&d&&(await this.getAccounts()).length||(l.emitter.emit("disconnect"),d&&(o&&(d.removeListener("chainChanged",o),o=void 0),i&&(d.removeListener("disconnect",i),i=void 0),a||(a=this.onConnect.bind(this),d.on("connect",a))))}})}const Hv={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(e){return e?.coinbaseWalletExtension?e.coinbaseWalletExtension:Kn(e,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(e){return Kn(e,t=>{if(!t.isMetaMask||t.isBraveWallet&&!t._events&&!t._state)return!1;const n=["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPhantom","isPortal","isRabby","isTokenPocket","isTokenary","isUniswapWallet","isZerion"];for(const s of n)if(t[s])return!1;return!0})}},phantom:{id:"phantom",name:"Phantom",provider(e){return e?.phantom?.ethereum?e.phantom?.ethereum:Kn(e,"isPhantom")}}};function Kn(e,t){function n(r){return typeof t=="function"?t(r):typeof t=="string"?r[t]:!0}const s=e.ethereum;if(s?.providers)return s.providers.find(r=>n(r));if(s&&n(s))return s}function Wv(e){if(typeof window>"u")return;const t=n=>e(n.detail);return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)}function qv(){const e=new Set;let t=[];const n=()=>Wv(r=>{t.some(({info:o})=>o.uuid===r.info.uuid)||(t=[...t,r],e.forEach(o=>o(t,{added:[r]})))});let s=n();return{_listeners(){return e},clear(){e.forEach(r=>r([],{removed:[...t]})),t=[]},destroy(){this.clear(),e.clear(),s?.()},findProvider({rdns:r}){return t.find(o=>o.info.rdns===r)},getProviders(){return t},reset(){this.clear(),s?.(),s=n()},subscribe(r,{emitImmediately:o}={}){return e.add(r),o&&r(t,{added:t}),()=>e.delete(r)}}}const Gv=e=>(t,n,s)=>{const r=s.subscribe;return s.subscribe=(a,i,l)=>{let u=a;if(i){const d=l?.equalityFn||Object.is;let h=a(s.getState());u=f=>{const p=a(f);if(!d(h,p)){const g=h;i(h=p,g)}},l?.fireImmediately&&i(h,h)}return r(u)},e(t,n,s)},Qv=Gv;function Yv(e,t){let n;try{n=e()}catch{return}return{getItem:r=>{var o;const a=l=>l===null?null:JSON.parse(l,void 0),i=(o=n.getItem(r))!=null?o:null;return i instanceof Promise?i.then(a):a(i)},setItem:(r,o)=>n.setItem(r,JSON.stringify(o,void 0)),removeItem:r=>n.removeItem(r)}}const zs=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(s){return zs(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return zs(s)(n)}}}},Kv=(e,t)=>(n,s,r)=>{let o={storage:Yv(()=>localStorage),partialize:m=>m,version:0,merge:(m,y)=>({...y,...m}),...t},a=!1;const i=new Set,l=new Set;let u=o.storage;if(!u)return e((...m)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...m)},s,r);const d=()=>{const m=o.partialize({...s()});return u.setItem(o.name,{state:m,version:o.version})},h=r.setState;r.setState=(m,y)=>{h(m,y),d()};const f=e((...m)=>{n(...m),d()},s,r);r.getInitialState=()=>f;let p;const g=()=>{var m,y;if(!u)return;a=!1,i.forEach(x=>{var C;return x((C=s())!=null?C:f)});const v=((y=o.onRehydrateStorage)==null?void 0:y.call(o,(m=s())!=null?m:f))||void 0;return zs(u.getItem.bind(u))(o.name).then(x=>{if(x)if(typeof x.version=="number"&&x.version!==o.version){if(o.migrate)return[!0,o.migrate(x.state,x.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,x.state];return[!1,void 0]}).then(x=>{var C;const[N,w]=x;if(p=o.merge(w,(C=s())!=null?C:f),n(p,!0),N)return d()}).then(()=>{v?.(p,void 0),p=s(),a=!0,l.forEach(x=>x(p))}).catch(x=>{v?.(void 0,x)})};return r.persist={setOptions:m=>{o={...o,...m},m.storage&&(u=m.storage)},clearStorage:()=>{u?.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>g(),hasHydrated:()=>a,onHydrate:m=>(i.add(m),()=>{i.delete(m)}),onFinishHydration:m=>(l.add(m),()=>{l.delete(m)})},o.skipHydration||g(),p||f},Xv=Kv,Za=e=>{let t;const n=new Set,s=(u,d)=>{const h=typeof u=="function"?u(t):u;if(!Object.is(h,t)){const f=t;t=d??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(p=>p(t,f))}},r=()=>t,i={setState:s,getState:r,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u))},l=t=e(s,r,i);return i},ns=e=>e?Za(e):Za;var rs={exports:{}},ei;function Jv(){return ei||(ei=1,(function(e){var t=Object.prototype.hasOwnProperty,n="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(n=!1));function r(l,u,d){this.fn=l,this.context=u,this.once=d||!1}function o(l,u,d,h,f){if(typeof d!="function")throw new TypeError("The listener must be a function");var p=new r(d,h||l,f),g=n?n+u:u;return l._events[g]?l._events[g].fn?l._events[g]=[l._events[g],p]:l._events[g].push(p):(l._events[g]=p,l._eventsCount++),l}function a(l,u){--l._eventsCount===0?l._events=new s:delete l._events[u]}function i(){this._events=new s,this._eventsCount=0}i.prototype.eventNames=function(){var u=[],d,h;if(this._eventsCount===0)return u;for(h in d=this._events)t.call(d,h)&&u.push(n?h.slice(1):h);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},i.prototype.listeners=function(u){var d=n?n+u:u,h=this._events[d];if(!h)return[];if(h.fn)return[h.fn];for(var f=0,p=h.length,g=new Array(p);f<p;f++)g[f]=h[f].fn;return g},i.prototype.listenerCount=function(u){var d=n?n+u:u,h=this._events[d];return h?h.fn?1:h.length:0},i.prototype.emit=function(u,d,h,f,p,g){var m=n?n+u:u;if(!this._events[m])return!1;var y=this._events[m],v=arguments.length,x,C;if(y.fn){switch(y.once&&this.removeListener(u,y.fn,void 0,!0),v){case 1:return y.fn.call(y.context),!0;case 2:return y.fn.call(y.context,d),!0;case 3:return y.fn.call(y.context,d,h),!0;case 4:return y.fn.call(y.context,d,h,f),!0;case 5:return y.fn.call(y.context,d,h,f,p),!0;case 6:return y.fn.call(y.context,d,h,f,p,g),!0}for(C=1,x=new Array(v-1);C<v;C++)x[C-1]=arguments[C];y.fn.apply(y.context,x)}else{var N=y.length,w;for(C=0;C<N;C++)switch(y[C].once&&this.removeListener(u,y[C].fn,void 0,!0),v){case 1:y[C].fn.call(y[C].context);break;case 2:y[C].fn.call(y[C].context,d);break;case 3:y[C].fn.call(y[C].context,d,h);break;case 4:y[C].fn.call(y[C].context,d,h,f);break;default:if(!x)for(w=1,x=new Array(v-1);w<v;w++)x[w-1]=arguments[w];y[C].fn.apply(y[C].context,x)}}return!0},i.prototype.on=function(u,d,h){return o(this,u,d,h,!1)},i.prototype.once=function(u,d,h){return o(this,u,d,h,!0)},i.prototype.removeListener=function(u,d,h,f){var p=n?n+u:u;if(!this._events[p])return this;if(!d)return a(this,p),this;var g=this._events[p];if(g.fn)g.fn===d&&(!f||g.once)&&(!h||g.context===h)&&a(this,p);else{for(var m=0,y=[],v=g.length;m<v;m++)(g[m].fn!==d||f&&!g[m].once||h&&g[m].context!==h)&&y.push(g[m]);y.length?this._events[p]=y.length===1?y[0]:y:a(this,p)}return this},i.prototype.removeAllListeners=function(u){var d;return u?(d=n?n+u:u,this._events[d]&&a(this,d)):(this._events=new s,this._eventsCount=0),this},i.prototype.off=i.prototype.removeListener,i.prototype.addListener=i.prototype.on,i.prefixed=n,i.EventEmitter=i,e.exports=i})(rs)),rs.exports}var Zv=Jv();const ex=Wi(Zv);class tx{constructor(t){Object.defineProperty(this,"uid",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:new ex})}on(t,n){this._emitter.on(t,n)}once(t,n){this._emitter.once(t,n)}off(t,n){this._emitter.off(t,n)}emit(t,...n){const s=n[0];this._emitter.emit(t,{uid:this.uid,...s})}listenerCount(t){return this._emitter.listenerCount(t)}}function nx(e){return new tx(e)}function rx(e,t){return JSON.parse(e,(n,s)=>{let r=s;return r?.__type==="bigint"&&(r=BigInt(r.value)),r?.__type==="Map"&&(r=new Map(r.value)),t?.(n,r)??r})}function ti(e,t){return e.slice(0,t).join(".")||"."}function ni(e,t){const{length:n}=e;for(let s=0;s<n;++s)if(e[s]===t)return s+1;return 0}function sx(e,t){const n=typeof e=="function",s=typeof t=="function",r=[],o=[];return function(i,l){if(typeof l=="object")if(r.length){const u=ni(r,this);u===0?r[r.length]=this:(r.splice(u),o.splice(u)),o[o.length]=i;const d=ni(r,l);if(d!==0)return s?t.call(this,i,l,ti(o,d)):`[ref=${ti(o,d)}]`}else r[0]=l,o[0]=i;return n?e.call(this,i,l):l}}function ox(e,t,n,s){return JSON.stringify(e,sx((r,o)=>{let a=o;return typeof a=="bigint"&&(a={__type:"bigint",value:o.toString()}),a instanceof Map&&(a={__type:"Map",value:Array.from(o.entries())}),t?.(r,a)??a},s),n??void 0)}function ax(e){const{deserialize:t=rx,key:n="wagmi",serialize:s=ox,storage:r=mu}=e;function o(a){return a instanceof Promise?a.then(i=>i).catch(()=>null):a}return{...r,key:n,async getItem(a,i){const l=r.getItem(`${n}.${a}`),u=await o(l);return u?t(u)??null:i??null},async setItem(a,i){const l=`${n}.${a}`;i===null?await o(r.removeItem(l)):await o(r.setItem(l,s(i)))},async removeItem(a){await o(r.removeItem(`${n}.${a}`))}}}const mu={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};function ix(){const e=typeof window<"u"&&window.localStorage?window.localStorage:mu;return{getItem(t){return e.getItem(t)},removeItem(t){e.removeItem(t)},setItem(t,n){try{e.setItem(t,n)}catch{}}}}const _s=256;let $n=_s,zn;function cx(e=11){if(!zn||$n+e>_s*2){zn="",$n=0;for(let t=0;t<_s;t++)zn+=(256+Math.random()*256|0).toString(16).substring(1)}return zn.substring($n,$n+++e)}function lx(e){const{multiInjectedProviderDiscovery:t=!0,storage:n=ax({storage:ix()}),syncConnectedChain:s=!0,ssr:r=!1,...o}=e,a=typeof window<"u"&&t?qv():void 0,i=ns(()=>o.chains),l=ns(()=>{const w=[],j=new Set;for(const S of o.connectors??[]){const P=u(S);if(w.push(P),!r&&P.rdns){const E=typeof P.rdns=="string"?[P.rdns]:P.rdns;for(const T of E)j.add(T)}}if(!r&&a){const S=a.getProviders();for(const P of S)j.has(P.info.rdns)||w.push(u(d(P)))}return w});function u(w){const j=nx(cx()),S={...w({emitter:j,chains:i.getState(),storage:n,transports:o.transports}),emitter:j,uid:j.uid};return j.on("connect",C),S.setup?.(),S}function d(w){const{info:j}=w,S=w.provider;return ko({target:{...j,id:j.rdns,provider:S}})}const h=new Map;function f(w={}){const j=w.chainId??y.getState().chainId,S=i.getState().find(E=>E.id===j);if(w.chainId&&!S)throw new Fs;{const E=h.get(y.getState().chainId);if(E&&!S)return E;if(!S)throw new Fs}{const E=h.get(j);if(E)return E}let P;if(o.client)P=o.client({chain:S});else{const E=S.id,T=i.getState().map(R=>R.id),I={},D=Object.entries(o);for(const[R,F]of D)if(!(R==="chains"||R==="client"||R==="connectors"||R==="transports"))if(typeof F=="object")if(E in F)I[R]=F[E];else{if(T.some(U=>U in F))continue;I[R]=F}else I[R]=F;P=Lv({...I,chain:S,batch:I.batch??{multicall:!0},transport:R=>o.transports[E]({...R,connectors:l})})}return h.set(j,P),P}function p(){return{chainId:i.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let g;const m="0.0.0-canary-";Yn.startsWith(m)?g=Number.parseInt(Yn.replace(m,""),10):g=Number.parseInt(Yn.split(".")[0]??"0",10);const y=ns(Qv(n?Xv(p,{migrate(w,j){if(j===g)return w;const S=p(),P=v(w,S.chainId);return{...S,chainId:P}},name:"store",partialize(w){return{connections:{__type:"Map",value:Array.from(w.connections.entries()).map(([j,S])=>{const{id:P,name:E,type:T,uid:I}=S.connector;return[j,{...S,connector:{id:P,name:E,type:T,uid:I}}]})},chainId:w.chainId,current:w.current}},merge(w,j){typeof w=="object"&&w&&"status"in w&&delete w.status;const S=v(w,j.chainId);return{...j,...w,chainId:S}},skipHydration:r,storage:n,version:g}):p));y.setState(p());function v(w,j){return w&&typeof w=="object"&&"chainId"in w&&typeof w.chainId=="number"&&i.getState().some(S=>S.id===w.chainId)?w.chainId:j}s&&y.subscribe(({connections:w,current:j})=>j?w.get(j)?.chainId:void 0,w=>{if(i.getState().some(S=>S.id===w))return y.setState(S=>({...S,chainId:w??S.chainId}))}),a?.subscribe(w=>{const j=new Set,S=new Set;for(const E of l.getState())if(j.add(E.id),E.rdns){const T=typeof E.rdns=="string"?[E.rdns]:E.rdns;for(const I of T)S.add(I)}const P=[];for(const E of w){if(S.has(E.info.rdns))continue;const T=u(d(E));j.has(T.id)||P.push(T)}n&&!y.persist.hasHydrated()||l.setState(E=>[...E,...P],!0)});function x(w){y.setState(j=>{const S=j.connections.get(w.uid);return S?{...j,connections:new Map(j.connections).set(w.uid,{accounts:w.accounts??S.accounts,chainId:w.chainId??S.chainId,connector:S.connector})}:j})}function C(w){y.getState().status==="connecting"||y.getState().status==="reconnecting"||y.setState(j=>{const S=l.getState().find(P=>P.uid===w.uid);return S?(S.emitter.listenerCount("connect")&&S.emitter.off("connect",x),S.emitter.listenerCount("change")||S.emitter.on("change",x),S.emitter.listenerCount("disconnect")||S.emitter.on("disconnect",N),{...j,connections:new Map(j.connections).set(w.uid,{accounts:w.accounts,chainId:w.chainId,connector:S}),current:w.uid,status:"connected"}):j})}function N(w){y.setState(j=>{const S=j.connections.get(w.uid);if(S){const E=S.connector;E.emitter.listenerCount("change")&&S.connector.emitter.off("change",x),E.emitter.listenerCount("disconnect")&&S.connector.emitter.off("disconnect",N),E.emitter.listenerCount("connect")||S.connector.emitter.on("connect",C)}if(j.connections.delete(w.uid),j.connections.size===0)return{...j,connections:new Map,current:null,status:"disconnected"};const P=j.connections.values().next().value;return{...j,connections:new Map(j.connections),current:P.connector.uid}})}return{get chains(){return i.getState()},get connectors(){return l.getState()},storage:n,getClient:f,get state(){return y.getState()},setState(w){let j;typeof w=="function"?j=w(y.getState()):j=w;const S=p();typeof j!="object"&&(j=S),Object.keys(S).some(E=>!(E in j))&&(j=S),y.setState(j,!0)},subscribe(w,j,S){return y.subscribe(w,j,S?{...S,fireImmediately:S.emitImmediately}:void 0)},_internal:{mipd:a,async revalidate(){const w=y.getState(),j=w.connections;let S=w.current;for(const[,P]of j){const E=P.connector;E.isAuthorized&&await E.isAuthorized()||(j.delete(E.uid),S===E.uid&&(S=null))}y.setState(P=>({...P,connections:j,current:S}))},store:y,ssr:!!r,syncConnectedChain:s,transports:o.transports,chains:{setState(w){const j=typeof w=="function"?w(i.getState()):w;if(j.length!==0)return i.setState(j,!0)},subscribe(w){return i.subscribe(w)}},connectors:{providerDetailToConnector:d,setup:u,setState(w){return l.setState(typeof w=="function"?w(l.getState()):w,!0)},subscribe(w){return l.subscribe(w)}},events:{change:x,connect:C,disconnect:N}}}}function ux(e,t){const{initialState:n,reconnectOnMount:s}=t;return n&&!e._internal.store.persist.hasHydrated()&&e.setState({...n,chainId:e.chains.some(r=>r.id===n.chainId)?n.chainId:e.chains[0].id,connections:s?n.connections:new Map,status:s?"reconnecting":"disconnected"}),{async onMount(){e._internal.ssr&&(await e._internal.store.persist.rehydrate(),e._internal.mipd&&e._internal.connectors.setState(r=>{const o=new Set;for(const l of r??[])if(l.rdns){const u=Array.isArray(l.rdns)?l.rdns:[l.rdns];for(const d of u)o.add(d)}const a=[],i=e._internal.mipd?.getProviders()??[];for(const l of i){if(o.has(l.info.rdns))continue;const u=e._internal.connectors.providerDetailToConnector(l),d=e._internal.connectors.setup(u);a.push(d)}return[...r,...a]})),s?Vv(e):e.storage&&e.setState(r=>({...r,connections:new Map}))}}}function dx(e){const{children:t,config:n,initialState:s,reconnectOnMount:r=!0}=e,{onMount:o}=ux(n,{initialState:s,reconnectOnMount:r});n._internal.ssr||o();const a=b.useRef(!0);return b.useEffect(()=>{if(a.current&&n._internal.ssr)return o(),()=>{a.current=!1}},[]),t}const gu=b.createContext(void 0);function fx(e){const{children:t,config:n}=e,s={value:n};return b.createElement(dx,e,b.createElement(gu.Provider,s,t))}const hx="2.19.2",px=()=>`wagmi@${hx}`;class mx extends Do{constructor(){super(...arguments),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiError"})}get docsBaseUrl(){return"https://wagmi.sh/react"}get version(){return px()}}class gx extends mx{constructor(){super("`useConfig` must be used within `WagmiProvider`.",{docsPath:"/api/WagmiProvider"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiProviderNotFoundError"})}}function Ro(e={}){const t=e.config??b.useContext(gu);if(!t)throw new gx;return t}var jn=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},bx={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},yx=class{#e=bx;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},Ze=new yx;function vx(e){setTimeout(e,0)}var lt=typeof window>"u"||"Deno"in globalThis;function me(){}function xx(e,t){return typeof e=="function"?e(t):e}function Us(e){return typeof e=="number"&&e>=0&&e!==1/0}function bu(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Qe(e,t){return typeof e=="function"?e(t):e}function we(e,t){return typeof e=="function"?e(t):e}function ri(e,t){const{type:n="all",exact:s,fetchStatus:r,predicate:o,queryKey:a,stale:i}=e;if(a){if(s){if(t.queryHash!==Ao(a,t.options))return!1}else if(!pn(t.queryKey,a))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof i=="boolean"&&t.isStale()!==i||r&&r!==t.state.fetchStatus||o&&!o(t))}function si(e,t){const{exact:n,status:s,predicate:r,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(hn(t.options.mutationKey)!==hn(o))return!1}else if(!pn(t.options.mutationKey,o))return!1}return!(s&&t.state.status!==s||r&&!r(t))}function Ao(e,t){return(t?.queryKeyHashFn||hn)(e)}function hn(e){return JSON.stringify(e,(t,n)=>Bs(n)?Object.keys(n).sort().reduce((s,r)=>(s[r]=n[r],s),{}):n)}function pn(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>pn(e[n],t[n])):!1}var wx=Object.prototype.hasOwnProperty;function yu(e,t){if(e===t)return e;const n=oi(e)&&oi(t);if(!n&&!(Bs(e)&&Bs(t)))return t;const r=(n?e:Object.keys(e)).length,o=n?t:Object.keys(t),a=o.length,i=n?new Array(a):{};let l=0;for(let u=0;u<a;u++){const d=n?u:o[u],h=e[d],f=t[d];if(h===f){i[d]=h,(n?u<r:wx.call(e,d))&&l++;continue}if(h===null||f===null||typeof h!="object"||typeof f!="object"){i[d]=f;continue}const p=yu(h,f);i[d]=p,p===h&&l++}return r===a&&l===r?e:i}function Vs(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function oi(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Bs(e){if(!ai(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!ai(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function ai(e){return Object.prototype.toString.call(e)==="[object Object]"}function Cx(e){return new Promise(t=>{Ze.setTimeout(t,e)})}function Hs(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?yu(e,t):t}function Sx(e,t,n=0){const s=[...e,t];return n&&s.length>n?s.slice(1):s}function jx(e,t,n=0){const s=[t,...e];return n&&s.length>n?s.slice(0,-1):s}var Lo=Symbol();function vu(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Lo?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Px(e,t){return typeof e=="function"?e(...t):!!e}var Nx=class extends jn{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!lt&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},Fo=new Nx;function Ws(){let e,t;const n=new Promise((r,o)=>{e=r,t=o});n.status="pending",n.catch(()=>{});function s(r){Object.assign(n,r),delete n.resolve,delete n.reject}return n.resolve=r=>{s({status:"fulfilled",value:r}),e(r)},n.reject=r=>{s({status:"rejected",reason:r}),t(r)},n}var Ex=vx;function Ox(){let e=[],t=0,n=i=>{i()},s=i=>{i()},r=Ex;const o=i=>{t?e.push(i):r(()=>{n(i)})},a=()=>{const i=e;e=[],i.length&&r(()=>{s(()=>{i.forEach(l=>{n(l)})})})};return{batch:i=>{let l;t++;try{l=i()}finally{t--,t||a()}return l},batchCalls:i=>(...l)=>{o(()=>{i(...l)})},schedule:o,setNotifyFunction:i=>{n=i},setBatchNotifyFunction:i=>{s=i},setScheduler:i=>{r=i}}}var ue=Ox(),Ix=class extends jn{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!lt&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#e}},hr=new Ix;function Mx(e){return Math.min(1e3*2**e,3e4)}function xu(e){return(e??"online")==="online"?hr.isOnline():!0}var qs=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function wu(e){let t=!1,n=0,s;const r=Ws(),o=()=>r.status!=="pending",a=m=>{if(!o()){const y=new qs(m);f(y),e.onCancel?.(y)}},i=()=>{t=!0},l=()=>{t=!1},u=()=>Fo.isFocused()&&(e.networkMode==="always"||hr.isOnline())&&e.canRun(),d=()=>xu(e.networkMode)&&e.canRun(),h=m=>{o()||(s?.(),r.resolve(m))},f=m=>{o()||(s?.(),r.reject(m))},p=()=>new Promise(m=>{s=y=>{(o()||u())&&m(y)},e.onPause?.()}).then(()=>{s=void 0,o()||e.onContinue?.()}),g=()=>{if(o())return;let m;const y=n===0?e.initialPromise:void 0;try{m=y??e.fn()}catch(v){m=Promise.reject(v)}Promise.resolve(m).then(h).catch(v=>{if(o())return;const x=e.retry??(lt?0:3),C=e.retryDelay??Mx,N=typeof C=="function"?C(n,v):C,w=x===!0||typeof x=="number"&&n<x||typeof x=="function"&&x(n,v);if(t||!w){f(v);return}n++,e.onFail?.(n,v),Cx(N).then(()=>u()?void 0:p()).then(()=>{t?f(v):g()})})};return{promise:r,status:()=>r.status,cancel:a,continue:()=>(s?.(),r),cancelRetry:i,continueRetry:l,canStart:d,start:()=>(d()?g():p().then(g),r)}}var Cu=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Us(this.gcTime)&&(this.#e=Ze.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(lt?1/0:300*1e3))}clearGcTimeout(){this.#e&&(Ze.clearTimeout(this.#e),this.#e=void 0)}},Tx=class extends Cu{#e;#t;#n;#s;#r;#i;#a;constructor(e){super(),this.#a=!1,this.#i=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#s=e.client,this.#n=this.#s.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=ci(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#r?.promise}setOptions(e){if(this.options={...this.#i,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=ci(this.options);t.data!==void 0&&(this.setState(ii(t.data,t.dataUpdatedAt)),this.#e=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const n=Hs(this.state.data,e,this.options);return this.#o({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#o({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#r?.promise;return this.#r?.cancel(e),t?t.then(me).catch(me):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>we(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Lo||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Qe(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!bu(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#r&&(this.#a?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#o({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(e&&this.setOptions(e),!this.options.queryFn){const i=this.observers.find(l=>l.options.queryFn);i&&this.setOptions(i.options)}const n=new AbortController,s=i=>{Object.defineProperty(i,"signal",{enumerable:!0,get:()=>(this.#a=!0,n.signal)})},r=()=>{const i=vu(this.options,t),u=(()=>{const d={client:this.#s,queryKey:this.queryKey,meta:this.meta};return s(d),d})();return this.#a=!1,this.options.persister?this.options.persister(i,u,this):i(u)},a=(()=>{const i={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#s,state:this.state,fetchFn:r};return s(i),i})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#o({type:"fetch",meta:a.fetchOptions?.meta}),this.#r=wu({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:i=>{i instanceof qs&&i.revert&&this.setState({...this.#t,fetchStatus:"idle"}),n.abort()},onFail:(i,l)=>{this.#o({type:"failed",failureCount:i,error:l})},onPause:()=>{this.#o({type:"pause"})},onContinue:()=>{this.#o({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{const i=await this.#r.start();if(i===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(i),this.#n.config.onSuccess?.(i,this),this.#n.config.onSettled?.(i,this.state.error,this),i}catch(i){if(i instanceof qs){if(i.silent)return this.#r.promise;if(i.revert){if(this.state.data===void 0)throw i;return this.state.data}}throw this.#o({type:"error",error:i}),this.#n.config.onError?.(i,this),this.#n.config.onSettled?.(this.state.data,i,this),i}finally{this.scheduleGc()}}#o(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...Su(n.data,this.options),fetchMeta:e.meta??null};case"success":const s={...n,...ii(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?s:void 0,s;case"error":const r=e.error;return{...n,error:r,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),ue.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function Su(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:xu(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function ii(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function ci(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,s=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Dx=class extends jn{constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.#a=Ws(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#s=void 0;#r;#i;#a;#o;#m;#f;#h;#l;#u;#c;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),li(this.#t,this.options)?this.#d():this.updateResult(),this.#v())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Gs(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Gs(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#w(),this.#t.removeObserver(this)}setOptions(e){const t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof we(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#C(),this.#t.setOptions(this.options),t._defaulted&&!Vs(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const s=this.hasListeners();s&&ui(this.#t,n,this.options,t)&&this.#d(),this.updateResult(),s&&(this.#t!==n||we(this.options.enabled,this.#t)!==we(t.enabled,this.#t)||Qe(this.options.staleTime,this.#t)!==Qe(t.staleTime,this.#t))&&this.#g();const r=this.#b();s&&(this.#t!==n||we(this.options.enabled,this.#t)!==we(t.enabled,this.#t)||r!==this.#c)&&this.#y(r)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Rx(this,n)&&(this.#s=n,this.#i=this.options,this.#r=this.#t.state),n}getCurrentResult(){return this.#s}trackResult(e,t){return new Proxy(e,{get:(n,s)=>(this.trackProp(s),t?.(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#a.status==="pending"&&this.#a.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,s))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#s))}#d(e){this.#C();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(me)),t}#g(){this.#x();const e=Qe(this.options.staleTime,this.#t);if(lt||this.#s.isStale||!Us(e))return;const n=bu(this.#s.dataUpdatedAt,e)+1;this.#l=Ze.setTimeout(()=>{this.#s.isStale||this.updateResult()},n)}#b(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#y(e){this.#w(),this.#c=e,!(lt||we(this.options.enabled,this.#t)===!1||!Us(this.#c)||this.#c===0)&&(this.#u=Ze.setInterval(()=>{(this.options.refetchIntervalInBackground||Fo.isFocused())&&this.#d()},this.#c))}#v(){this.#g(),this.#y(this.#b())}#x(){this.#l&&(Ze.clearTimeout(this.#l),this.#l=void 0)}#w(){this.#u&&(Ze.clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const n=this.#t,s=this.options,r=this.#s,o=this.#r,a=this.#i,l=e!==n?e.state:this.#n,{state:u}=e;let d={...u},h=!1,f;if(t._optimisticResults){const P=this.hasListeners(),E=!P&&li(e,t),T=P&&ui(e,n,t,s);(E||T)&&(d={...d,...Su(u.data,e.options)}),t._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:p,errorUpdatedAt:g,status:m}=d;f=d.data;let y=!1;if(t.placeholderData!==void 0&&f===void 0&&m==="pending"){let P;r?.isPlaceholderData&&t.placeholderData===a?.placeholderData?(P=r.data,y=!0):P=typeof t.placeholderData=="function"?t.placeholderData(this.#h?.state.data,this.#h):t.placeholderData,P!==void 0&&(m="success",f=Hs(r?.data,P,t),h=!0)}if(t.select&&f!==void 0&&!y)if(r&&f===o?.data&&t.select===this.#m)f=this.#f;else try{this.#m=t.select,f=t.select(f),f=Hs(r?.data,f,t),this.#f=f,this.#o=null}catch(P){this.#o=P}this.#o&&(p=this.#o,f=this.#f,g=Date.now(),m="error");const v=d.fetchStatus==="fetching",x=m==="pending",C=m==="error",N=x&&v,w=f!==void 0,S={status:m,fetchStatus:d.fetchStatus,isPending:x,isSuccess:m==="success",isError:C,isInitialLoading:N,isLoading:N,data:f,dataUpdatedAt:d.dataUpdatedAt,error:p,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:v,isRefetching:v&&!x,isLoadingError:C&&!w,isPaused:d.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:C&&w,isStale:$o(e,t),refetch:this.refetch,promise:this.#a,isEnabled:we(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const P=I=>{S.status==="error"?I.reject(S.error):S.data!==void 0&&I.resolve(S.data)},E=()=>{const I=this.#a=S.promise=Ws();P(I)},T=this.#a;switch(T.status){case"pending":e.queryHash===n.queryHash&&P(T);break;case"fulfilled":(S.status==="error"||S.data!==T.value)&&E();break;case"rejected":(S.status!=="error"||S.error!==T.reason)&&E();break}}return S}updateResult(){const e=this.#s,t=this.createResult(this.#t,this.options);if(this.#r=this.#t.state,this.#i=this.options,this.#r.data!==void 0&&(this.#h=this.#t),Vs(t,e))return;this.#s=t;const n=()=>{if(!e)return!0;const{notifyOnChangeProps:s}=this.options,r=typeof s=="function"?s():s;if(r==="all"||!r&&!this.#p.size)return!0;const o=new Set(r??this.#p);return this.options.throwOnError&&o.add("error"),Object.keys(this.#s).some(a=>{const i=a;return this.#s[i]!==e[i]&&o.has(i)})};this.#S({listeners:n()})}#C(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#v()}#S(e){ue.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#s)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function kx(e,t){return we(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function li(e,t){return kx(e,t)||e.state.data!==void 0&&Gs(e,t,t.refetchOnMount)}function Gs(e,t,n){if(we(t.enabled,e)!==!1&&Qe(t.staleTime,e)!=="static"){const s=typeof n=="function"?n(e):n;return s==="always"||s!==!1&&$o(e,t)}return!1}function ui(e,t,n,s){return(e!==t||we(s.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&$o(e,n)}function $o(e,t){return we(t.enabled,e)!==!1&&e.isStaleByTime(Qe(t.staleTime,e))}function Rx(e,t){return!Vs(e.getCurrentResult(),t)}function di(e){return{onFetch:(t,n)=>{const s=t.options,r=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],a=t.state.data?.pageParams||[];let i={pages:[],pageParams:[]},l=0;const u=async()=>{let d=!1;const h=g=>{Object.defineProperty(g,"signal",{enumerable:!0,get:()=>(t.signal.aborted?d=!0:t.signal.addEventListener("abort",()=>{d=!0}),t.signal)})},f=vu(t.options,t.fetchOptions),p=async(g,m,y)=>{if(d)return Promise.reject();if(m==null&&g.pages.length)return Promise.resolve(g);const x=(()=>{const j={client:t.client,queryKey:t.queryKey,pageParam:m,direction:y?"backward":"forward",meta:t.options.meta};return h(j),j})(),C=await f(x),{maxPages:N}=t.options,w=y?jx:Sx;return{pages:w(g.pages,C,N),pageParams:w(g.pageParams,m,N)}};if(r&&o.length){const g=r==="backward",m=g?Ax:fi,y={pages:o,pageParams:a},v=m(s,y);i=await p(y,v,g)}else{const g=e??o.length;do{const m=l===0?a[0]??s.initialPageParam:fi(s,i);if(l>0&&m==null)break;i=await p(i,m),l++}while(l<g)}return i};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=u}}}function fi(e,{pages:t,pageParams:n}){const s=t.length-1;return t.length>0?e.getNextPageParam(t[s],t,n[s],n):void 0}function Ax(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Lx=class extends Cu{#e;#t;#n;#s;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Fx(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#s?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#r({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#s=wu({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(o,a)=>{this.#r({type:"failed",failureCount:o,error:a})},onPause:()=>{this.#r({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const s=this.state.status==="pending",r=!this.#s.canStart();try{if(s)t();else{this.#r({type:"pending",variables:e,isPaused:r}),await this.#n.config.onMutate?.(e,this,n);const a=await this.options.onMutate?.(e,n);a!==this.state.context&&this.#r({type:"pending",context:a,variables:e,isPaused:r})}const o=await this.#s.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#r({type:"success",data:o}),o}catch(o){try{throw await this.#n.config.onError?.(o,e,this.state.context,this,n),await this.options.onError?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(void 0,o,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(void 0,o,e,this.state.context,n),o}finally{this.#r({type:"error",error:o})}}finally{this.#n.runNext(this)}}#r(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),ue.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function Fx(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var $x=class extends jn{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){const s=new Lx({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(s),s}add(e){this.#e.add(e);const t=_n(e);if(typeof t=="string"){const n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=_n(e);if(typeof t=="string"){const n=this.#t.get(t);if(n)if(n.length>1){const s=n.indexOf(e);s!==-1&&n.splice(s,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=_n(e);if(typeof t=="string"){const s=this.#t.get(t)?.find(r=>r.state.status==="pending");return!s||s===e}else return!0}runNext(e){const t=_n(e);return typeof t=="string"?this.#t.get(t)?.find(s=>s!==e&&s.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){ue.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>si(t,n))}findAll(e={}){return this.getAll().filter(t=>si(e,t))}notify(e){ue.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return ue.batch(()=>Promise.all(e.map(t=>t.continue().catch(me))))}};function _n(e){return e.options.scope?.id}var zx=class extends jn{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){const s=t.queryKey,r=t.queryHash??Ao(s,t);let o=this.get(r);return o||(o=new Tx({client:e,queryKey:s,queryHash:r,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(s)}),this.add(o)),o}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){ue.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>ri(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>ri(e,n)):t}notify(e){ue.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){ue.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ue.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},_x=class{#e;#t;#n;#s;#r;#i;#a;#o;constructor(e={}){this.#e=e.queryCache||new zx,this.#t=e.mutationCache||new $x,this.#n=e.defaultOptions||{},this.#s=new Map,this.#r=new Map,this.#i=0}mount(){this.#i++,this.#i===1&&(this.#a=Fo.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#o=hr.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#i--,this.#i===0&&(this.#a?.(),this.#a=void 0,this.#o?.(),this.#o=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#e.build(this,t),s=n.state.data;return s===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Qe(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(s))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:n})=>{const s=n.data;return[t,s]})}setQueryData(e,t,n){const s=this.defaultQueryOptions({queryKey:e}),o=this.#e.get(s.queryHash)?.state.data,a=xx(t,o);if(a!==void 0)return this.#e.build(this,s).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return ue.batch(()=>this.#e.findAll(e).map(({queryKey:s})=>[s,this.setQueryData(s,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;ue.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return ue.batch(()=>(n.findAll(e).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},s=ue.batch(()=>this.#e.findAll(e).map(r=>r.cancel(n)));return Promise.all(s).then(me).catch(me)}invalidateQueries(e,t={}){return ue.batch(()=>(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},s=ue.batch(()=>this.#e.findAll(e).filter(r=>!r.isDisabled()&&!r.isStatic()).map(r=>{let o=r.fetch(void 0,n);return n.throwOnError||(o=o.catch(me)),r.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(s).then(me)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime(Qe(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(me).catch(me)}fetchInfiniteQuery(e){return e.behavior=di(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(me).catch(me)}ensureInfiniteQueryData(e){return e.behavior=di(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return hr.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#s.set(hn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#s.values()],n={};return t.forEach(s=>{pn(e,s.queryKey)&&Object.assign(n,s.defaultOptions)}),n}setMutationDefaults(e,t){this.#r.set(hn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(s=>{pn(e,s.mutationKey)&&Object.assign(n,s.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ao(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Lo&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};function Ux(e){return JSON.stringify(e,(t,n)=>Vx(n)?Object.keys(n).sort().reduce((s,r)=>(s[r]=n[r],s),{}):typeof n=="bigint"?n.toString():n)}function Vx(e){if(!hi(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!hi(n)||!n.hasOwnProperty("isPrototypeOf"))}function hi(e){return Object.prototype.toString.call(e)==="[object Object]"}function ju(e){const{_defaulted:t,behavior:n,gcTime:s,initialData:r,initialDataUpdatedAt:o,maxPages:a,meta:i,networkMode:l,queryFn:u,queryHash:d,queryKey:h,queryKeyHashFn:f,retry:p,retryDelay:g,structuralSharing:m,getPreviousPageParam:y,getNextPageParam:v,initialPageParam:x,_optimisticResults:C,enabled:N,notifyOnChangeProps:w,placeholderData:j,refetchInterval:S,refetchIntervalInBackground:P,refetchOnMount:E,refetchOnReconnect:T,refetchOnWindowFocus:I,retryOnMount:D,select:R,staleTime:F,suspense:_,throwOnError:U,config:H,connector:G,query:W,...ee}=e;return ee}function Bx(e,t={}){return{async queryFn({queryKey:n}){const{name:s,scopeKey:r,...o}=n[1];if(!s)throw new Error("name is required");return _v(e,{...o,name:s})},queryKey:Hx(t)}}function Hx(e={}){return["ensAvatar",ju(e)]}function Wx(e,t={}){return{async queryFn({queryKey:n}){const{address:s,scopeKey:r,...o}=n[1];if(!s)throw new Error("address is required");return Uv(e,{...o,address:s})},queryKey:qx(t)}}function qx(e={}){return["ensName",ju(e)]}var Pu=b.createContext(void 0),Gx=e=>{const t=b.useContext(Pu);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Qx=({client:e,children:t})=>(b.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),c.jsx(Pu.Provider,{value:e,children:t})),Nu=b.createContext(!1),Yx=()=>b.useContext(Nu);Nu.Provider;function Kx(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Xx=b.createContext(Kx()),Jx=()=>b.useContext(Xx),Zx=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},e5=e=>{b.useEffect(()=>{e.clearReset()},[e])},t5=({result:e,errorResetBoundary:t,throwOnError:n,query:s,suspense:r})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(r&&e.data===void 0||Px(n,[e.error,s])),n5=e=>{if(e.suspense){const n=r=>r==="static"?r:Math.max(r??1e3,1e3),s=e.staleTime;e.staleTime=typeof s=="function"?(...r)=>n(s(...r)):n(s),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},r5=(e,t)=>e.isLoading&&e.isFetching&&!t,s5=(e,t)=>e?.suspense&&t.isPending,pi=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function o5(e,t,n){const s=Yx(),r=Jx(),o=Gx(),a=o.defaultQueryOptions(e);o.getDefaultOptions().queries?._experimental_beforeQuery?.(a),a._optimisticResults=s?"isRestoring":"optimistic",n5(a),Zx(a,r),e5(r);const i=!o.getQueryCache().get(a.queryHash),[l]=b.useState(()=>new t(o,a)),u=l.getOptimisticResult(a),d=!s&&e.subscribed!==!1;if(b.useSyncExternalStore(b.useCallback(h=>{const f=d?l.subscribe(ue.batchCalls(h)):me;return l.updateResult(),f},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),b.useEffect(()=>{l.setOptions(a)},[a,l]),s5(a,u))throw pi(a,l,r);if(t5({result:u,errorResetBoundary:r,throwOnError:a.throwOnError,query:o.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw u.error;return o.getDefaultOptions().queries?._experimental_afterQuery?.(a,u),a.experimental_prefetchInRender&&!lt&&r5(u,s)&&(i?pi(a,l,r):o.getQueryCache().get(a.queryHash)?.promise)?.catch(me).finally(()=>{l.updateResult()}),a.notifyOnChangeProps?u:l.trackResult(u)}function a5(e,t){return o5(e,Dx)}function Eu(e){const t=a5({...e,queryKeyHashFn:Ux});return t.queryKey=e.queryKey,t}function Ou(e={}){const t=Ro(e);return b.useSyncExternalStore(n=>Bv(t,{onChange:n}),()=>Ja(t),()=>Ja(t))}function i5(e={}){const{name:t,query:n={}}=e,s=Ro(e),r=Ou({config:s}),o=Bx(s,{...e,chainId:e.chainId??r}),a=!!(t&&(n.enabled??!0));return Eu({...n,...o,enabled:a})}function Iu(e={}){const{address:t,query:n={}}=e,s=Ro(e),r=Ou({config:s}),o=Wx(s,{...e,chainId:e.chainId??r}),a=!!(t&&(n.enabled??!0));return Eu({...n,...o,enabled:a})}const c5=new URL("/assets/powerhouse-rounded-CeKGGUG4.png",import.meta.url).href;function Mu(e){const{address:t,chainId:n=1,size:s="14px"}=e,r={width:s,height:s},o=Iu({address:t,chainId:n}),a=o.data??void 0,i=i5({name:a}),l=i.data??c5;return o.isLoading||i.isLoading?c.jsx("div",{className:"fade-out flex-none animate-pulse rounded-full bg-gray-400",style:r}):c.jsx("img",{alt:"ENS Avatar",className:"flex-none rounded-full object-contain",src:l,style:r})}const Tu=["RENAME","DELETE","DUPLICATE"],l5=[{value:"LOCAL",icon:c.jsx(O,{name:"Lock"}),description:"Only available to you"},{value:"CLOUD",icon:c.jsx(O,{name:"People"}),description:"Only available to people in this drive"},{value:"PUBLIC",icon:c.jsx(O,{name:"Globe"}),description:"Available to everyone",disabled:!0}],u5={CLOUD:{title:"Secure cloud",description:"End to end encryption between members.",icon:c.jsx(O,{name:"Lock"})},LOCAL:{title:"Local",description:"Private and only available to you.",icon:c.jsx(O,{name:"Hdd"})},SWITCHBOARD:{title:"Switchboard",description:"Public and available to everyone.",icon:c.jsx(O,{name:"Drive"})}},d5={ADD_TRIGGER:{label:"Add Trigger",icon:c.jsx(O,{className:"text-orange-900",name:"Plus"})},REMOVE_TRIGGER:{label:"Remove Trigger",icon:c.jsx(O,{className:"text-orange-900",name:"Xmark"})},ADD_INVALID_TRIGGER:{label:"Add Trigger",icon:c.jsx(O,{className:"text-orange-900",name:"Exclamation"})}},f5={DUPLICATE:{label:"Duplicate",icon:c.jsx(O,{name:"FilesEarmark"})},RENAME:{label:"Rename",icon:c.jsx(O,{name:"Pencil"})},DELETE:{label:"Delete",icon:c.jsx(O,{name:"Trash"}),className:"text-red-900"},SETTINGS:{label:"Settings",icon:c.jsx(O,{name:"Gear"})}},Du={...d5,...f5};function ku(e){const{node:t}=e,[n,s]=b.useState(!1),r=b.useCallback(a=>{a.dataTransfer.setData("UI_NODE",JSON.stringify(t))},[t]),o=b.useCallback(()=>{s(!1)},[]);return b.useMemo(()=>({isDragging:n,dragProps:{draggable:!0,onDragStart:r,onDragEnd:o}}),[n,o,r])}const Ru="powerhouse/budget-statement",zo="powerhouse/default",Au="makerdao/rwa-portfolio",h5=[Ru,zo,Au],p5=new URL("../../../../../assets/icons/budget.png",import.meta.url).href,m5=new URL("../../../../../assets/icons/rwa-report.png",import.meta.url).href,g5=new URL("../../../../../assets/icons/template.png",import.meta.url).href,mi={[Ru]:p5,[zo]:g5,[Au]:m5};function b5(e,t){return t||(h5.includes(e)?mi[e]:mi[zo])}const gi="SYNCING",bi="SUCCESS",yi="CONFLICT",vi="MISSING",xi="ERROR",wi="INITIAL_SYNC",y5={SYNCING:"Syncing",SUCCESS:"Synced",CONFLICT:"Error",MISSING:"Circle",ERROR:"Error",INITIAL_SYNC:"Syncing"};function v5(e){const{syncStatus:t,className:n,overrideSyncIcons:s={},...r}=e,o={...y5,...s};return{[wi]:c.jsx(O,{size:16,...r,className:M("text-blue-900",n),name:o[wi]}),[gi]:c.jsx(O,{size:16,...r,className:M("text-blue-900",n),name:o[gi]}),[bi]:c.jsx(O,{size:16,...r,className:M("text-green-900",n),name:o[bi]}),[yi]:c.jsx(O,{size:16,...r,className:M("text-orange-900",n),name:o[yi]}),[vi]:c.jsx(O,{size:16,...r,className:M("text-red-900",n),name:o[vi]}),[xi]:c.jsx(O,{size:16,...r,className:M("text-red-900",n),name:o[xi]})}[t]}function Ow(e){const{fileNode:t,className:n,customDocumentIconSrc:s}=e,[r,o]=b.useState("READ"),[a,i]=b.useState(!1),[l]=Li(),u=l?is(l):"LOCAL",{dragProps:d}=ku({node:t}),{isAllowedToCreateDocuments:h}=Js(),{onRenameNode:f,onRenameDriveNodes:p,onDuplicateNode:g}=br(),m=r==="READ",y=ad(t.id,u),v={DUPLICATE:()=>g(t),RENAME:()=>o("WRITE"),DELETE:()=>$i(t)},x=Object.entries(Du).map(([T,I])=>({...I,id:T})).filter(T=>Tu.includes(T.id));function C(T){Promise.all([f(T,t),p(T,t.id)]).catch(I=>{console.error(I)}).finally(()=>{o("READ")})}function N(){o("READ")}function w(T){const I=v[T];if(!I){console.error(`No handler found for dropdown menu item: ${T}`);return}I(),i(!1)}const j=b5(t.documentType,s),S=c.jsxs("div",{className:"relative",children:[c.jsx("img",{alt:"file icon",className:"max-w-none",height:34,src:j,width:32}),m&&y&&c.jsx("div",{className:"absolute bottom-[-2px] right-0 size-3 rounded-full bg-white",children:c.jsx("div",{className:"absolute left-[-2px] top-[-2px]",children:c.jsx(v5,{overrideSyncIcons:{SUCCESS:"CheckCircleFill"},syncStatus:y})})})]}),P=M("group flex h-12 cursor-pointer select-none items-center rounded-lg bg-gray-200 px-2 text-gray-600 hover:text-gray-800",n),E=m?c.jsxs("div",{className:"flex w-52 items-center justify-between",children:[c.jsxs("div",{className:"mr-2 truncate group-hover:mr-0",children:[c.jsx("div",{className:"max-h-6 truncate text-sm font-medium group-hover:text-gray-800",children:t.name}),c.jsx("div",{className:"max-h-6 truncate text-xs font-medium text-gray-600 group-hover:text-gray-800",children:t.documentType})]}),h?c.jsx(Ir,{items:x,onItemClick:w,onOpenChange:i,open:a,children:c.jsx("button",{className:M("hidden group-hover:block",a&&"block"),onClick:T=>{T.stopPropagation(),i(!0)},children:c.jsx(O,{className:"text-gray-600",name:"VerticalDots"})})}):null]}):c.jsx(Cr,{className:"ml-3 flex-1 font-medium",defaultValue:t.name,onCancel:N,onSubmit:C});return c.jsx("div",{className:"relative w-64",onClick:()=>xt(t),children:c.jsx("div",{...d,className:P,children:c.jsxs("div",{className:"flex items-center",children:[c.jsx("div",{className:"mr-1.5",children:S}),E]})})})}function Iw(e){const{folderNode:t,className:n}=e,{isAllowedToCreateDocuments:s}=Js(),[r,o]=b.useState("READ"),[a,i]=b.useState(!1),{dragProps:l}=ku({node:t}),{onRenameNode:u,onRenameDriveNodes:d,onDuplicateNode:h}=br(),{isDropTarget:f,dropProps:p}=dl({target:t}),g=r==="READ";function m(){o("READ")}function y(j){Promise.all([u(j,t),d(j,t.id)]).catch(S=>{console.error(S)}).finally(()=>{o("READ")})}const v={DUPLICATE:()=>h(t),RENAME:()=>o("WRITE"),DELETE:()=>$i(t)},x=Object.entries(Du).map(([j,S])=>({...S,id:j})).filter(j=>Tu.includes(j.id));function C(j){const S=v[j];if(!S){console.error(`No handler found for dropdown menu item: ${j}`);return}S(),i(!1)}const N=g||!s?c.jsx("div",{className:"ml-3 max-h-6 truncate font-medium text-gray-600 group-hover:text-gray-800",children:t.name}):c.jsx(Cr,{className:"ml-3 font-medium",defaultValue:t.name,onCancel:m,onSubmit:y}),w=M("group flex h-12 cursor-pointer select-none items-center rounded-lg bg-gray-200 px-2",n,f&&"bg-blue-100");return c.jsx("div",{className:"relative w-64",onClick:()=>xt(t),children:c.jsxs("div",{...l,...p,className:w,children:[c.jsxs("div",{className:"flex items-center overflow-hidden",children:[c.jsx("div",{className:"p-1",children:c.jsx("div",{className:"relative",children:c.jsx(O,{name:"FolderClose",size:24})})}),N]}),g&&s?c.jsx(Ir,{items:x,onItemClick:C,onOpenChange:i,open:a,children:c.jsx("button",{className:M("ml-auto hidden group-hover:block",a&&"block"),onClick:j=>{j.stopPropagation(),i(!0)},children:c.jsx(O,{className:"text-gray-600",name:"VerticalDots"})})}):null]})})}const Pn=b.forwardRef(function(t,n){const{icon:s,errorMessage:r,isDirty:o,containerClassName:a,inputClassName:i,errorMessageClassName:l,hideErrors:u=!1,...d}=t,h=t.type??"text",f=!!r;return c.jsxs("div",{children:[c.jsxs("div",{className:M("mb-1 flex gap-2 rounded-md border border-gray-200 bg-gray-50 p-3 text-black placeholder:text-gray-50",f&&"border-red-900",a),children:[s&&c.jsx("span",{className:eo((!o||f)&&"text-slate-200"),children:s}),c.jsx("input",{...d,className:M("w-full bg-transparent font-semibold outline-none",i),ref:n,type:h})]}),c.jsx("p",{className:M("hidden min-h-4 text-xs text-red-900",f&&"block",u&&"hidden",l),children:r})]})});function x5(e){return{value:e.id,displayValue:e.name,icon:c.jsx(O,{name:"PowerhouseLogoSmall"}),description:"Built by Powerhouse"}}function w5(e){const{control:t,appOptions:n,...s}=e,r=n.map(x5);return c.jsx(Ai,{control:t,name:"appId",render:({field:o})=>c.jsx(yt,{...s,...o,id:"appId",items:r})})}const C5=b.forwardRef(function(t,n){return c.jsxs("label",{className:"relative cursor-pointer items-center",htmlFor:t.id,children:[c.jsx("input",{className:"peer sr-only",ref:n,type:"checkbox",value:"",...t}),c.jsx("div",{className:"peer h-6 w-11 rounded-full bg-gray-500 after:absolute after:start-0.5 after:top-0.5 after:size-5 after:rounded-full after:border after:border-none after:bg-gray-50 after:transition-all peer-checked:bg-blue-900 peer-checked:after:translate-x-full peer-focus:outline-none"})]})}),_o=b.forwardRef(function(t,n){return c.jsxs("div",{className:"flex items-center rounded-md border border-gray-200 bg-gray-50 p-3 text-gray-900",children:[c.jsxs("div",{className:"flex-1",children:[c.jsx("label",{className:"font-medium text-gray-900",htmlFor:"availableOffline",children:"Make available offline"}),c.jsxs("p",{className:"text-xs text-gray-600",children:["Check this options if you keep a local backup",c.jsx("br",{}),"available at all times."]})]}),c.jsx(C5,{id:"availableOffline",ref:n,...t})]})});function Xn(e){const{children:t,className:n,...s}=e;return c.jsx("label",{...s,className:M("block font-semibold text-gray-500",n),children:t})}function Lu(e){const{control:t,...n}=e;return c.jsx(Ai,{control:t,name:"sharingType",render:({field:s})=>c.jsx(yt,{...n,...s,id:"sharingType",items:l5})})}function S5(e){const{register:t,handleSubmit:n,control:s,formState:{errors:r}}=Xs({defaultValues:{name:"",sharingType:"LOCAL",availableOffline:!1,appId:e.appOptions[0].id}});return c.jsx("form",{name:"add-local-drive",onSubmit:n(e.onSubmit),className:"flex flex-col gap-4",children:c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsxs("div",{children:[c.jsx(Xn,{htmlFor:"name",className:"text-sm font-medium text-gray-800",children:"Drive Name"}),c.jsx(Pn,{...t("name",{required:"Drive name is required"}),errorMessage:r.name?.message,placeholder:"Drive name"})]}),c.jsxs("div",{children:[c.jsx(Xn,{htmlFor:"driveApp",className:"text-sm font-medium text-gray-800",children:"Drive App"}),c.jsx(w5,{control:s,appOptions:e.appOptions})]}),c.jsxs("div",{children:[c.jsx(Xn,{htmlFor:"sharingType",className:"text-sm font-medium text-gray-800",children:"Location"}),c.jsx(Lu,{control:s})]}),c.jsx("div",{children:c.jsx(_o,{...t("availableOffline")})}),c.jsx(Pe,{className:"mt-2 w-full",type:"submit",children:"Create new drive"})]})})}function j5(e){return c.jsxs("div",{className:"flex gap-2 rounded-xl bg-gray-100 p-3 font-semibold text-gray-500",children:[c.jsx(O,{className:"text-gray-600",name:"Drive"}),e.driveName]})}function Fu(e){const{location:t,className:n,...s}=e,r=u5[t];return c.jsxs("div",{...s,className:M("my-3 flex items-center gap-2 rounded-xl border border-gray-100 p-3 text-gray-800 shadow",n),children:[r.icon,c.jsxs("div",{children:[c.jsx("p",{children:r.title}),c.jsx("p",{className:"text-xs text-slate-200",children:r.description})]})]})}function P5(e){const{sharingType:t="PUBLIC",requestPublicDrive:n}=e,[s,r]=b.useState(),[o,a]=b.useState(!1),[i,l]=b.useState(!0),[u,d]=b.useState(!1),[h,f]=b.useState(""),[p,g]=b.useState(""),[m,y]=Y0(p,500),{register:v,handleSubmit:x,setValue:C}=Xs({mode:"onBlur",defaultValues:{availableOffline:s?.availableOffline??!1}});b.useEffect(()=>{y(p)},[p]),b.useEffect(()=>{if(d(!1),m==="")return;w().catch(console.error);async function w(){try{const{id:j,name:S}=await n(m);r({id:j,name:S,sharingType:t,location:"SWITCHBOARD",availableOffline:!0}),C("availableOffline",!0),l(!0),f("")}catch(j){r(void 0),l(!1),f(j.message)}}},[m,C,t]);function N({availableOffline:w}){s&&e.onSubmit({...s,availableOffline:w,url:m})}return c.jsx("form",{onSubmit:x(N),children:u?c.jsxs(c.Fragment,{children:[c.jsx(j5,{driveName:s?.name??"New drive"}),c.jsx(mt,{className:"my-3"}),c.jsxs(ir,{isOpen:o,onOpenChange:()=>a(!o),title:"Location",children:[c.jsx(Fu,{location:"SWITCHBOARD"}),c.jsx(_o,{...v("availableOffline")})]}),c.jsx(Pe,{className:"mt-4 w-full",color:"dark",type:"submit",children:"Add new drive"})]}):c.jsxs(c.Fragment,{children:[c.jsx(Pn,{errorMessage:h,onChange:w=>g(w.target.value),placeholder:"Drive URL",required:!0,type:"url",value:p}),c.jsx(Pe,{className:"mt-4 w-full py-2 text-base",color:"dark",size:"small",disabled:!i||p==="",onClick:w=>{w.preventDefault(),d(!0)},type:"button",children:"Add drive"})]})})}const N5=new URL("/assets/home-bg-BRYzhkhi.avif",import.meta.url).href,E5=new URL("/assets/home-bg-BEhF9NuW.png",import.meta.url).href;function O5(){return c.jsxs("picture",{className:"pointer-events-none absolute inset-8 z-0 size-[calc(100%-32px)] object-contain",children:[c.jsx("source",{srcSet:N5,type:"image/avif"}),c.jsx("img",{src:E5,alt:"background",className:"object-contain"})]})}const I5=function(t){const{icon:n,title:s,description:r,containerClassName:o,shareable:a,onClick:i}=t;return c.jsxs("div",{className:M("hover-bg-transparent relative flex h-24 w-40 cursor-pointer flex-col items-center justify-center overflow-hidden rounded-md p-2 text-center text-sm text-black",o,i&&"cursor-pointer"),onClick:i,children:[c.jsx("div",{className:"mx-auto pb-2",children:n||c.jsx("div",{className:"size-8 items-center justify-center rounded-lg bg-black pt-1",children:c.jsx("span",{className:"text-6 w-6 text-white",children:s.slice(0,1).toUpperCase()})})}),c.jsxs("div",{className:"w-full max-w-full",children:[c.jsx("h3",{className:"w-full max-w-full truncate px-2",children:s}),r&&c.jsx("p",{className:"text-gray-500",children:r})]}),a&&c.jsx("div",{className:"absolute left-2 top-0 mb-2",children:c.jsx(O,{name:"PeopleFill",width:12,height:12})})]})},Mw=function(t){const{containerClassName:n}=t;return c.jsx(I5,{title:"Create New Drive",icon:c.jsx(O,{name:"PlusSquare",size:32}),onClick:()=>id({type:"addDrive"}),containerClassName:n})},Tw=function(t){const{children:n,containerClassName:s}=t;return c.jsx("div",{className:M("container relative mx-auto flex h-full flex-col",s),children:c.jsxs("div",{className:"m-8 flex flex-wrap justify-center gap-4 pt-12",children:[c.jsx(O5,{}),n]})})};function Dw(e){function t(){s(!1)}const{open:n,onOpenChange:s,onAddRemoteDrive:r,onAddLocalDrive:o,requestPublicDrive:a,modalProps:i,containerProps:l}=e;return c.jsx(_e,{...i,contentProps:{className:"rounded-2xl"},onOpenChange:s,open:n,children:c.jsx("div",{...l,className:M("w-[408px] rounded-2xl p-6",l?.className),children:c.jsxs(ll,{defaultValue:"Create Drive",children:[c.jsx(cr,{label:"Create Drive",description:"Create a new drive",children:c.jsx(S5,{onCancel:t,onSubmit:o,appOptions:e.appOptions})}),c.jsx(cr,{label:"Add Drive",description:"Add a drive",children:c.jsx(P5,{sharingType:"PUBLIC",onSubmit:r,onCancel:t,requestPublicDrive:a})})]})})})}const Ci="min-h-[48px] min-w-[142px] text-base font-semibold py-3 px-6 rounded-xl outline-none active:opacity-75 hover:scale-105 transform transition-all",Si=300;function kw(e){const{onOpenChange:t,onContinue:n,overlayProps:s,contentProps:r,...o}=e,[a,i]=b.useState(""),[l,u]=b.useState(!1),d=()=>{t?.(!1),setTimeout(()=>i(""),Si)},h=b.useCallback(()=>{l&&(n(a),setTimeout(()=>i(""),Si))},[l,a,n]),f=b.useCallback(p=>{p.preventDefault(),h()},[h]);return c.jsx(_e,{contentProps:{...r,className:M("rounded-3xl",r?.className)},onOpenChange:t,overlayProps:{...s,className:s?.className},...o,children:c.jsxs("form",{name:"create-document",className:"w-[400px] p-6 text-slate-300",onSubmit:f,children:[c.jsx("div",{className:"border-b border-slate-50 pb-2 text-2xl font-bold text-gray-800",children:"Create a new document"}),c.jsxs("div",{className:"my-6",children:[!l&&a&&c.jsx("div",{className:"mb-2 text-red-500",children:"Document name must be valid URL characters."}),c.jsx(Pn,{icon:c.jsx(O,{name:"BrickGlobe"}),onChange:p=>{const g=p.target.value;i(g),u(Rd(g))},placeholder:"Document name",required:!0,value:a})]}),c.jsxs("div",{className:"mt-8 flex justify-between gap-3",children:[c.jsx("button",{type:"button",className:M(Ci,"flex-1 bg-slate-50 text-slate-800"),onClick:d,children:"Cancel"}),c.jsx(Pe,{type:"submit",className:M(Ci,"flex-1 bg-gray-800 text-gray-50"),disabled:!l,children:"Create"})]})]})})}const Rw=e=>{const{inputPlaceholder:t,body:n,driveName:s,...r}=e,[o,a]=b.useState("");return c.jsx(fo,{bodyProps:{className:"p-0 bg-white my-0"},containerProps:{className:"w-[450px]"},continueButtonProps:{disabled:o!==s,className:o!==s?"bg-red-600 hover:scale-100 cursor-not-allowed active:opacity-100":"bg-red-900"},...r,children:c.jsxs("div",{children:[c.jsx("div",{className:"my-6 rounded-md bg-slate-50 p-4 text-center",children:n}),c.jsx("div",{children:c.jsx(Pn,{hideErrors:!0,icon:c.jsx(O,{name:"Lock"}),onChange:i=>a(i.target.value),placeholder:t,value:o})})]})})};function Aw(e){const{onDelete:t,deleteLabel:n,...s}=e;return c.jsx(fo,{...s,containerProps:{className:"w-[450px]"},continueButtonProps:{className:"bg-red-900"},continueLabel:n,onContinue:t})}const $u=b.forwardRef(function(t,n){return c.jsx(Pn,{...t,icon:t.icon??c.jsx(O,{name:"Drive"}),id:"driveName",placeholder:"Drive name",ref:n})});function M5(e){const{drive:t,handleDeleteDrive:n,onCancel:s}=e,[r,o]=b.useState(""),a=r===t.header.name;function i(){a&&n()}return c.jsxs("div",{children:[c.jsx("p",{className:"mb-2 rounded-md bg-slate-50 p-4 text-center text-slate-200",children:"Are you sure you want to delete this drive? All files and subfolders within it will be removed. Do you want to proceed?"}),c.jsx($u,{icon:c.jsx(O,{name:"Lock"}),onChange:l=>o(l.target.value),placeholder:"Enter drive name...",value:r}),c.jsxs("div",{className:"flex gap-3",children:[c.jsx(Pe,{className:"w-full",color:"light",onClick:s,children:"Cancel"}),c.jsx(Pe,{className:"w-full",color:"red",disabled:!a,onClick:i,children:"Delete"})]})]})}function T5(e){const{drive:t,sharingType:n,availableOffline:s,onSubmit:r,handleDeleteDrive:o}=e,a=t.header.name,[i,l]=b.useState(!1),[u,d]=b.useState(!1),[h,f]=b.useState(!1),{register:p,handleSubmit:g,control:m}=Xs({mode:"onBlur",defaultValues:{name:a,sharingType:n,availableOffline:s}}),y=n==="PUBLIC"?"SWITCHBOARD":n;return c.jsxs("form",{onSubmit:g(r),children:[c.jsx($u,{...p("name")}),c.jsx(mt,{className:"my-4"}),c.jsx(Xn,{htmlFor:"sharingType",children:"Sharing settings"}),c.jsx(Lu,{control:m}),c.jsx(mt,{className:"my-3"}),c.jsxs(ir,{isOpen:i,onOpenChange:()=>l(!i),title:"Location",children:[c.jsx(Fu,{location:y}),c.jsx(_o,{...p("availableOffline")})]}),c.jsx(mt,{className:"my-3"}),c.jsx(ir,{isOpen:u,onOpenChange:()=>d(!u),title:"Danger zone",children:c.jsxs("button",{className:"flex gap-2 py-3 font-semibold text-red-900 transition hover:brightness-125",onClick:()=>f(!0),type:"button",children:[c.jsx(O,{name:"Trash"}),"Delete drive"]})}),h&&u?c.jsx(M5,{drive:t,handleDeleteDrive:o,onCancel:()=>f(!1)}):c.jsxs(c.Fragment,{children:[c.jsx(mt,{className:"my-3"}),c.jsx(Pe,{className:"mb-4 w-full",type:"submit",children:"Confirm"})]})]})}function Lw(e){const{drive:t,open:n,sharingType:s,availableOffline:r,onOpenChange:o,onDeleteDrive:a,onRenameDrive:i,onChangeSharingType:l,onChangeAvailableOffline:u,modalProps:d,containerProps:h}=e,f=m=>{m.name!==t.header.name&&i(t,m.name),m.sharingType!==s&&l(t,m.sharingType),m.availableOffline!==r&&u(t,m.availableOffline),o(!1)};function p(){a(t),o(!1)}function g(){o(!1)}return c.jsx(_e,{...d,contentProps:{className:"rounded-2xl"},onOpenChange:o,open:n,children:c.jsxs("div",{...h,className:M("max-w-[408px] rounded-2xl p-6",h?.className),children:[c.jsxs("div",{className:"flex justify-between",children:[c.jsx("h1",{className:"text-xl font-bold",children:"Drive settings"}),c.jsx("button",{className:"flex size-8 items-center justify-center rounded-md bg-gray-100 text-gray-500 outline-none hover:text-gray-900",onClick:g,tabIndex:-1,children:c.jsx(O,{name:"XmarkLight",size:24})})]}),c.jsx(mt,{className:"my-4"}),c.jsx(T5,{handleCancel:g,handleDeleteDrive:p,onSubmit:f,drive:t,sharingType:s,availableOffline:r})]})})}function Qs(e,t=12){return e.length<=t?e:e.slice(0,t)+"..."}function zu({direction:e,active:t}){return t?c.jsx(O,{className:e==="asc"?"rotate-180":void 0,name:"TriangleDown",size:12}):c.jsx(O,{className:"opacity-0 group-hover:opacity-50",name:"CaretSort",size:12})}const D5=[{key:"id",label:"ID",width:"120px"},{key:"documentId",label:"Document ID",width:"150px"},{key:"branch",label:"Branch",width:"100px"},{key:"status",label:"Status",width:"150px"},{key:"opsCount",label:"Ops Count",width:"80px"}],k5=[{key:"id",label:"ID",width:"120px"},{key:"documentId",label:"Document ID",width:"150px"},{key:"branch",label:"Branch",width:"100px"},{key:"error",label:"Error",width:"200px"}];function R5(e){switch(e){case Fe.Unknown:return"Unknown";case Fe.TransportPending:return"Transport Pending";case Fe.ExecutionPending:return"Execution Pending";case Fe.Applied:return"Applied";case Fe.Error:return"Error";default:return"Unknown"}}function A5(e){switch(e){case Fe.TransportPending:case Fe.ExecutionPending:return c.jsx("span",{children:"⏳"});case Fe.Applied:return c.jsx("span",{children:"✅"});case Fe.Error:return c.jsx("span",{children:"❌"});default:return c.jsx("span",{children:"❓"})}}function pr(e){return e?e.error.message:""}function L5(e,t){const n=[...e];return t?n.sort((s,r)=>{let o=0;switch(t.column){case"id":o=s.id.localeCompare(r.id);break;case"documentId":o=s.documentId.localeCompare(r.documentId);break;case"branch":o=s.branch.localeCompare(r.branch);break;case"status":o=s.status-r.status;break;case"opsCount":o=s.operations.length-r.operations.length;break;case"error":o=pr(s.error).localeCompare(pr(r.error));break;default:return 0}return t.direction==="asc"?o:-o}):n}function ss({title:e,mailboxType:t,operations:n,sort:s,onSort:r,collapsed:o,onToggleCollapse:a}){const i=t==="deadLetter"?k5:D5,l=L5(n,s),u=d=>{r(t,d)};return c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsxs("button",{className:"flex items-center gap-2 text-left text-sm font-medium text-gray-700 hover:text-gray-900",onClick:a,type:"button",children:[c.jsx(O,{className:M("transition-transform",o&&"-rotate-90"),name:"ChevronDown",size:14}),e," (",n.length," item",n.length!==1?"s":"",")"]}),!o&&c.jsx("div",{className:"max-h-64 overflow-auto rounded-lg border border-gray-300",children:c.jsxs("table",{className:"w-full border-collapse",children:[c.jsx("thead",{className:"sticky top-0 bg-gray-100",children:c.jsx("tr",{children:i.map((d,h)=>{const f=s?.column===d.key,p=f?s.direction:"asc";return c.jsx("th",{className:M("group cursor-pointer px-3 py-2 text-left text-xs font-medium text-gray-600 hover:bg-gray-200 hover:text-gray-900",h>0&&"border-l border-gray-300"),onClick:()=>u(d.key),style:{width:d.width},children:c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("span",{className:"truncate",children:d.label}),c.jsx(zu,{active:f,direction:p})]})},d.key)})})}),c.jsx("tbody",{children:l.length===0?c.jsx("tr",{children:c.jsx("td",{className:"px-3 py-4 text-center text-sm text-gray-500",colSpan:i.length,children:"No operations"})}):l.map(d=>c.jsxs("tr",{className:"odd:bg-white even:bg-gray-50 hover:bg-blue-50",children:[c.jsx("td",{className:"px-3 py-2 text-xs text-gray-900",children:c.jsx("span",{className:"block truncate",title:d.id,children:Qs(d.id)})}),c.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:c.jsx("span",{className:"block truncate",title:d.documentId,children:Qs(d.documentId)})}),c.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:c.jsx("span",{className:"block truncate",title:d.branch,children:d.branch})}),t==="deadLetter"?c.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs",children:c.jsxs("span",{className:"block truncate text-red-600",title:pr(d.error),children:["❌ ",pr(d.error)||"Unknown error"]})}):c.jsxs(c.Fragment,{children:[c.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:c.jsxs("span",{className:"flex items-center gap-1",children:[A5(d.status),R5(d.status)]})}),c.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:d.operations.length})]})]},d.id))})]})})]})}function F5({remoteName:e,channel:t,onBack:n,onRefresh:s}){const[r,o]=b.useState({inbox:void 0,outbox:void 0,deadLetter:void 0}),[a,i]=b.useState({inbox:!1,outbox:!1,deadLetter:!1}),l=d=>{i(h=>({...h,[d]:!h[d]}))},u=(d,h)=>{o(f=>{const p=f[d],g=p?.column===h&&p.direction==="asc"?"desc":"asc";return{...f,[d]:{column:h,direction:g}}})};return c.jsxs("div",{className:"flex h-full flex-col gap-4 p-4",children:[c.jsxs("div",{className:"flex shrink-0 items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("button",{className:"flex items-center gap-1 rounded border border-gray-300 bg-white px-2 py-1 text-sm text-gray-700 hover:bg-gray-100",onClick:n,type:"button",children:[c.jsx(O,{className:"rotate-90",name:"ChevronDown",size:14}),"Back"]}),c.jsxs("h2",{className:"text-lg font-semibold text-gray-900",children:["Channel: ",e]})]}),s&&c.jsxs("button",{className:"flex items-center gap-1 rounded border border-gray-300 bg-white px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-100",onClick:s,type:"button",children:[c.jsx(O,{name:"Reload",size:14}),"Refresh"]})]}),c.jsxs("div",{className:"flex flex-1 flex-col gap-6 overflow-auto",children:[c.jsx(ss,{collapsed:a.inbox,mailboxType:"inbox",onSort:u,onToggleCollapse:()=>l("inbox"),operations:t.inbox.items,sort:r.inbox,title:"Inbox"}),c.jsx(ss,{collapsed:a.outbox,mailboxType:"outbox",onSort:u,onToggleCollapse:()=>l("outbox"),operations:t.outbox.items,sort:r.outbox,title:"Outbox"}),c.jsx(ss,{collapsed:a.deadLetter,mailboxType:"deadLetter",onSort:u,onToggleCollapse:()=>l("deadLetter"),operations:t.deadLetter.items,sort:r.deadLetter,title:"Dead Letter"})]})]})}const os=[{key:"id",label:"ID",width:"120px"},{key:"name",label:"Name",width:"150px"},{key:"collectionId",label:"Collection ID",width:"200px"},{key:"filter",label:"Filter",width:"200px"},{key:"channel",label:"Channel",width:"100px"}];function mr(e){const t=[];return e.branch&&t.push(`branch:${e.branch}`),e.documentId.length>0&&t.push(`${e.documentId.length} doc(s)`),e.scope.length>0&&t.push(`${e.scope.length} scope(s)`),t.length>0?t.join(", "):"-"}function $5(e,t){return t?[...e].sort((n,s)=>{let r,o;switch(t.column){case"id":r=n.id,o=s.id;break;case"name":r=n.name,o=s.name;break;case"collectionId":r=n.collectionId,o=s.collectionId;break;case"filter":r=mr(n.filter),o=mr(s.filter);break;default:return 0}const a=r.localeCompare(o);return t.direction==="asc"?a:-a}):e}function z5({getRemotes:e}){const[t,n]=b.useState([]),[s,r]=b.useState(!0),[o,a]=b.useState(),[i,l]=b.useState(),u=b.useCallback(async()=>{r(!0);const m=await e();n(m),r(!1)},[e]);b.useEffect(()=>{u()},[u]);const d=b.useCallback(async()=>{if(await u(),i){const m=t.find(y=>y.id===i.id);l(m)}},[u,i,t]),h=m=>{if(m==="channel")return;const y=o?.column===m&&o.direction==="asc"?"desc":"asc";a({column:m,direction:y})},f=m=>{l(m)},p=()=>{l(void 0)};if(i)return c.jsx(F5,{channel:i.channel,onBack:p,onRefresh:()=>void d(),remoteName:i.name});const g=$5(t,o);return c.jsxs("div",{className:"flex h-full flex-col gap-2 p-4",children:[c.jsxs("div",{className:"flex shrink-0 items-center justify-between",children:[c.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"Remotes Inspector"}),c.jsxs("button",{className:"flex items-center gap-1 rounded border border-gray-300 bg-white px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-100 disabled:opacity-50",disabled:s,onClick:()=>void d(),type:"button",children:[c.jsx(O,{name:"Reload",size:14}),"Refresh"]})]}),c.jsx("div",{className:"max-h-full overflow-auto rounded-lg border border-gray-300",children:c.jsxs("table",{className:"w-full border-collapse",children:[c.jsx("thead",{className:"sticky top-0 bg-gray-100",children:c.jsx("tr",{children:os.map((m,y)=>{const v=o?.column===m.key,x=v?o.direction:"asc",C=m.key!=="channel";return c.jsx("th",{className:M("group px-3 py-2 text-left text-xs font-medium text-gray-600",y>0&&"border-l border-gray-300",C&&"cursor-pointer hover:bg-gray-200 hover:text-gray-900"),onClick:()=>C&&h(m.key),style:{width:m.width},children:c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("span",{className:"truncate",children:m.label}),C&&c.jsx(zu,{active:v,direction:x})]})},m.key)})})}),c.jsx("tbody",{children:s&&g.length===0?c.jsx("tr",{children:c.jsx("td",{className:"px-3 py-8 text-center text-sm text-gray-500",colSpan:os.length,children:"Loading..."})}):g.length===0?c.jsx("tr",{children:c.jsx("td",{className:"px-3 py-8 text-center text-sm text-gray-500",colSpan:os.length,children:"No remotes configured"})}):g.map(m=>c.jsxs("tr",{className:"odd:bg-white even:bg-gray-50 hover:bg-blue-50",children:[c.jsx("td",{className:"px-3 py-2 text-xs text-gray-900",children:c.jsx("span",{className:"block truncate",title:m.id,children:Qs(m.id)})}),c.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:c.jsx("span",{className:"block truncate",title:m.name,children:m.name})}),c.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:c.jsx("span",{className:"block truncate",title:m.collectionId,children:m.collectionId})}),c.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:c.jsx("span",{className:"block truncate",title:mr(m.filter),children:mr(m.filter)})}),c.jsx("td",{className:"border-l border-gray-300 px-3 py-2",children:c.jsxs("button",{className:"flex items-center gap-1 rounded bg-blue-50 px-2 py-1 text-xs text-blue-700 hover:bg-blue-100",onClick:()=>f(m),type:"button",children:["View",c.jsx(O,{name:"CaretRight",size:12})]})})]},m.id))})]})}),c.jsxs("div",{className:"shrink-0 text-sm text-gray-600",children:["Showing ",g.length," remote(s)"]})]})}function Fw({open:e,onOpenChange:t,modalProps:n,containerProps:s,dbExplorerProps:r,remotesInspectorProps:o,defaultTab:a="Database"}){return c.jsx(_e,{...n,contentProps:{className:"rounded-2xl"},onOpenChange:t,open:e,children:c.jsxs("div",{...s,className:M("flex h-[600px] w-[900px] flex-col rounded-2xl",s?.className),children:[c.jsx("div",{className:"flex items-center justify-end p-4 pb-0",children:c.jsx("button",{className:"flex size-6 cursor-pointer items-center justify-center rounded-md text-gray-500 outline-none hover:text-gray-900",onClick:()=>t(!1),type:"button",children:c.jsx(O,{name:"XmarkLight",size:24})})}),c.jsx("div",{className:"flex flex-1 flex-col overflow-hidden p-4 pt-2",children:c.jsxs(ll,{defaultValue:a,children:[c.jsx(cr,{description:"Database explorer",label:"Database",children:c.jsx("div",{className:"h-[480px]",children:c.jsx($g,{...r})})}),c.jsx(cr,{description:"Remotes inspector",label:"Remotes",children:c.jsx("div",{className:"h-[480px]",children:c.jsx(z5,{...o})})})]})})]})})}const _5="min-h-[48px] min-w-[142px] text-base font-semibold py-3 px-6 rounded-xl outline-none active:opacity-75 hover:scale-105 transform transition-all";function $w(e){const{body:t,header:n,children:s,onOpenChange:r,onContinue:o,closeLabel:a,overlayProps:i,contentProps:l,bodyProps:u={},headerProps:d={},containerProps:h={},continueButtonProps:f={},buttonContainerProps:p={},...g}=e,[m,y]=b.useState(!0),v=b.useRef(null);return b.useEffect(()=>{const x=()=>{const N=v.current;N&&(N.scrollHeight>N.clientHeight?(y(!0),N.addEventListener("scroll",C)):y(!1))},C=()=>{const N=v.current;N&&N.scrollHeight-Math.ceil(N.scrollTop)===N.clientHeight&&y(!1)};return requestAnimationFrame(x),()=>{const N=v.current;N&&N.removeEventListener("scroll",C)}},[]),c.jsx(_e,{contentProps:{...l,className:M("rounded-3xl outline-none",l?.className)},onOpenChange:r,overlayProps:{...i,className:i?.className},...g,children:c.jsxs("div",{...ce(h,"w-[500px] p-6 text-slate-300"),children:[c.jsx("div",{...ce(d,"border-b border-slate-50 pb-2 text-2xl font-bold text-gray-800"),children:n}),c.jsxs("div",{ref:v,...ce(u,"my-6 max-h-[245px] overflow-scroll rounded-md bg-slate-50 p-4 text-center"),children:[t,s]}),c.jsx("div",{...ce(p,"mt-8 flex justify-between gap-3"),children:c.jsx("button",{disabled:m,onClick:o,...ce(f,M(_5,"flex-1 bg-gray-800 text-gray-50",m&&"cursor-not-allowed bg-gray-300 hover:scale-100")),children:a})})]})})}const U5=[/^@powerhousedao\/.+$/,"document-drive","document-model"],V5=Ad({version:Mt({message:"Missing version field in package.json"}),dependencies:qo(Mt(),Mt()).nullable(),devDependencies:qo(Mt(),Mt()).nullable()}).refine(e=>e.dependencies!=null||e.devDependencies!=null,"package.json must have either dependencies or devDependencies").transform(e=>{const t={...e.dependencies,...e.devDependencies};return{version:e.version,dependencies:Object.fromEntries(Object.entries(t).filter(([n])=>U5.some(s=>typeof s=="string"?s===n:s.test(n))))}});function B5(e){const t=V5.safeParse(e);return t.success?t.data:(console.error("Package.json validation failed:",t.error.format()),!1)}function H5(e){const[t,n]=b.useState(!1),{packageJson:s,phCliVersion:r}=e,o=B5(s);return o?c.jsx(ir,{isOpen:t,onOpenChange:()=>n(!t),title:`App version: ${o.version}`,toggleClassName:"text-gray-900 text-sm",children:c.jsxs("ul",{className:"text-sm text-gray-600",children:[Object.entries(o.dependencies).map(([a,i])=>c.jsxs("li",{className:"my-1 flex justify-between pr-1",children:[c.jsxs("span",{children:[a.replace("@powerhousedao/",""),":"]}),c.jsx("span",{className:"font-normal",children:i})]},a)),r&&c.jsxs("li",{className:"my-1 flex justify-between pr-1",children:[c.jsx("span",{children:"@powerhousedao/ph-cli:"}),c.jsx("span",{className:"font-normal",children:r})]},"ph-cli")]})}):(console.error("Failed to validate package.json data"),null)}function zw(e){const{packageJson:t,phCliVersion:n}=e;return c.jsxs("div",{className:"bg-white p-3",children:[c.jsx("h2",{className:"font-semibold",children:"About"}),c.jsx("p",{className:"text-sm font-normal text-gray-600",children:"Connect is the hub for your most important documents and processes translated into software. Easily capture data in a structured way with Connect."}),c.jsx("div",{className:"my-4",children:c.jsx(H5,{packageJson:t,phCliVersion:n})})]})}function _w(e){const{className:t,...n}=e;return c.jsxs("div",{className:Hi("h-full rounded-lg bg-white p-3",t),children:[c.jsx("h2",{className:"mb-4 font-semibold",children:"Modify Drives"}),c.jsx(W5,{...n}),c.jsx("h2",{className:"my-4 font-semibold",children:"Local Storage"}),c.jsx(Q5,{...n})]})}function W5(e){const{className:t,...n}=e;return c.jsx("div",{className:t,children:c.jsx(q5,{...n})})}function q5(e){const{className:t,...n}=e;return c.jsx("div",{className:t,children:e.drives.map(s=>c.jsx(G5,{drive:s,...n},s.header.id))})}function G5(e){const{drive:t,className:n,onDeleteDrive:s}=e,[r,o]=b.useState(!1),a=c.jsx(O,{name:"Hdd",size:16,className:"flex-none"}),i=c.jsx(O,{name:"Server",size:16,className:"flex-none"}),l=t.state.global.icon?c.jsx("img",{alt:"drive icon",className:"size-4 flex-none object-contain",src:t.state.global.icon}):c.jsx(O,{name:"M",size:16,className:"flex-none"});function u(){const h=is(t);return h==="PUBLIC"?l:h==="CLOUD"?i:a}const d=u();return c.jsxs("div",{className:Hi("mb-4 flex w-96 items-center gap-2 rounded-md border border-gray-200 bg-gray-50 px-3 py-2 shadow-sm last-of-type:mb-0",n),children:[d,c.jsxs("div",{children:[c.jsx("span",{className:"block text-sm font-medium leading-[18px]",children:Wo(t.header.name)}),c.jsxs("div",{className:"flex items-baseline gap-x-2 leading-[18px]",children:[c.jsxs("span",{className:"text-sm text-gray-600",children:[Wo(is(t))," App"]}),c.jsxs("a",{className:"group flex items-center gap-x-2 text-sm text-slate-500 transition-colors hover:text-[#9896FF]",children:["By Powerhouse",c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 12",className:"size-4 text-gray-400 transition-colors group-hover:text-inherit",children:c.jsx("path",{d:"M7.99365 11.9939C9.46632 11.9939 10.6603 10.7999 10.6603 9.32722V7.32722C10.6603 6.95922 10.3617 6.66056 9.99365 6.66056C9.62565 6.66056 9.32699 6.95922 9.32699 7.32722V9.32722C9.32699 10.0639 8.73032 10.6606 7.99365 10.6606H2.66032C1.92365 10.6606 1.32699 10.0639 1.32699 9.32722V3.99389C1.32699 3.25723 1.92365 2.66056 2.66032 2.66056H4.66032C5.02832 2.66056 5.32699 2.36189 5.32699 1.99389C5.32699 1.6259 5.02832 1.32723 4.66032 1.32723H2.66032C1.18765 1.32723 -0.00634766 2.52123 -0.00634766 3.99389V9.32722C-0.00634766 10.7999 1.18765 11.9939 2.66032 11.9939H7.99365ZM5.32699 7.32722C5.49765 7.32722 5.67565 7.26989 5.80632 7.13989L10.1396 2.80656L11.9937 4.66056V-0.00610352H7.32699L9.18099 1.8479L4.84766 6.18123C4.58766 6.4419 4.58766 6.87922 4.84766 7.13989C4.97832 7.26989 5.15632 7.32722 5.32699 7.32722Z",fill:"currentColor"})})]})]})]}),c.jsx(Ir,{items:[{id:"delete-drive",label:"Delete",icon:c.jsx(O,{name:"Trash"}),className:"text-red-900"}],onItemClick:h=>{h==="delete-drive"&&s(t)},onOpenChange:o,open:r,children:c.jsx("button",{className:"group ml-auto flex-none",onClick:h=>{h.stopPropagation(),o(!0)},children:c.jsx(O,{className:"text-gray-600 group-hover:text-gray-900",name:"VerticalDots",size:16})})})]})}function Q5(e){const{onClearStorage:t}=e;return c.jsx("div",{children:c.jsxs("button",{className:"flex items-center gap-x-2 rounded-md border border-gray-300 bg-transparent px-3 py-1 text-sm font-medium text-red-900 transition-colors hover:bg-gray-100",onClick:t,children:["Clear Storage ",c.jsx(O,{name:"Trash",size:16})]})})}function Uw(e){const{className:t,...n}=e;return c.jsx("div",{className:M("rounded-lg p-3",t),children:c.jsx(Y5,{...n})})}function Y5(e){const{documentModelEditor:t,setDocumentModelEditor:n,documentModelEditorOptions:s,className:r}=e;return c.jsxs("div",{children:[c.jsx("h3",{className:"mb-4 font-semibold text-gray-900",children:"Default Editor Selection"}),c.jsx(qi,{className:M("min-w-36 max-w-fit",r),name:"default-editor",required:!0,value:t,options:s,multiple:!1,onChange:o=>n(o)})]})}const K5={npm:{icon:"Npm"},github:{icon:"Github",size:28},local:{icon:"Hdd"}},X5=({packageName:e,provider:t})=>{const n=t&&K5[t];return c.jsxs("div",{className:"flex w-full items-center justify-between px-2 py-1",children:[c.jsx("p",{className:"font-medium",children:e}),n&&c.jsx(O,{name:n.icon,size:n.size})]})},J5=e=>{const{onInstall:t,packageOptions:n,className:s}=e,[r,o]=b.useState(""),[a,i]=b.useState(!1),[l,u]=b.useState(),d=b.useCallback(()=>{const g=t(r);g?(i(!0),g.then(()=>o("")).catch(u).finally(()=>i(!1))):(o(""),u(void 0))},[t,r]),h=b.useCallback(g=>{o(g.target.value)},[]),f=l?typeof l=="string"?l:l instanceof Error?l.message:l:" ",p=b.useMemo(()=>{const g=n?.map(m=>({...m,value:m.packageName}));return n?.length?{autoComplete:!0,initialOptions:g,fetchOptionsCallback:m=>g?.filter(y=>y.packageName.toLowerCase().includes(m.toLowerCase()))??[],renderOption:m=>c.jsx(X5,{...m})}:{autoComplete:!1}},[n]);return c.jsxs("div",{className:s,children:[c.jsx("h3",{className:"mb-4 font-semibold text-gray-900",children:"Install Package"}),c.jsxs("div",{className:"flex items-center gap-4",children:[n?.length?c.jsx(_d,{...p,onChange:o}):c.jsx(zd,{name:"package",className:"max-w-xs text-gray-700",value:r,onChange:h,onSubmit:d,disabled:a}),c.jsx(Pe,{className:"h-9 rounded-md text-sm",onClick:d,disabled:a,children:"Install"})]}),c.jsx("p",{className:"mb-3 ml-2 h-3 text-sm text-red-800",children:f})]})},Un=({label:e,value:t})=>c.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[c.jsxs("p",{className:"text-gray-600",children:[e,":"]}),c.jsx("p",{className:"text-gray-600",children:t})]}),Z5=e=>{const{package:{name:t,description:n,category:s,publisher:r,publisherUrl:o,modules:a,id:i,removable:l},mutable:u,onUninstall:d,className:h}=e,[f,p]=b.useState(!1);return c.jsxs("li",{className:M("relative flex flex-col items-start rounded-md border border-gray-200 p-3 text-sm leading-5 shadow-sm",h),children:[c.jsx("h3",{className:"font-semibold text-gray-900",children:t}),c.jsx(Un,{label:"Description",value:n}),c.jsx(Un,{label:"Category",value:s}),c.jsx(Un,{label:"Publisher",value:r}),c.jsx(Un,{label:"Publisher URL",value:c.jsx("a",{className:"underline",href:o,children:o})}),c.jsx("p",{className:"text-sm text-gray-600",children:"Modules included:"}),c.jsx("ul",{className:"list-disc pl-5",children:a.map(g=>c.jsx("li",{children:c.jsx("span",{className:"text-gray-600",children:g})},g))}),u&&l&&c.jsx(Ir,{items:[{id:"uninstall",label:"Uninstall",icon:c.jsx(O,{name:"Trash"}),className:"text-red-900"}],onItemClick:g=>{g==="uninstall"&&d(i)},onOpenChange:p,open:f,children:c.jsx("button",{className:"group absolute right-3 top-3",onClick:g=>{g.stopPropagation(),p(!0)},children:c.jsx(O,{className:"text-gray-600 group-hover:text-gray-900",name:"VerticalDots"})})})]})},e6=e=>{const{className:t,packages:n,onUninstall:s,mutable:r,...o}=e,a=b.useCallback(i=>{s(i)},[s]);return c.jsxs("div",{...o,className:M("flex max-h-[370px] flex-col items-stretch overflow-hidden",t),children:[c.jsx("h3",{className:"mb-4 font-semibold text-gray-900",children:"Installed Packages"}),c.jsx("div",{className:"flex-1 overflow-y-auto pr-2",children:c.jsx("ul",{className:"flex flex-col items-stretch gap-4 pr-2",children:n.map(i=>c.jsx(Z5,{package:i,onUninstall:a,mutable:r},i.id))})})]})},t6=e=>{const{reactorOptions:t,reactor:n,onReactorChange:s,...r}=e,o=b.useCallback(a=>{s(Array.isArray(a)?a.at(-1):a)},[s]);return c.jsxs("div",{...r,children:[c.jsx("h3",{className:"mb-4 font-semibold text-gray-900",children:"Select Reactor"}),c.jsx(qi,{className:"min-w-36 max-w-fit",name:"reactor",required:!0,value:n,options:t,multiple:!1,onChange:o})]})},Vw=e=>{const{className:t,reactorOptions:n,reactor:s,onReactorChange:r,onInstall:o,packages:a,onUninstall:i,mutable:l,packageOptions:u,...d}=e,h=b.useMemo(()=>u?.filter(f=>!a.find(p=>p.name===f.packageName)),[a,u]);return c.jsxs("div",{...d,className:M("flex h-full flex-1 flex-col rounded-lg p-3",t),children:[c.jsx(t6,{reactor:s,reactorOptions:n,onReactorChange:r,className:"mb-4"}),l&&c.jsx(J5,{onInstall:o,packageOptions:h}),c.jsx(e6,{packages:a,onUninstall:i,mutable:l})]})};function Bw(e){const{title:t,overlayProps:n,contentProps:s,onOpenChange:r,tabs:o,defaultTab:a,...i}=e,[l,u]=b.useState(a??o.at(0)?.id),d=o.map(p=>c.jsx("button",{type:"button",onClick:()=>u(p.id),children:c.jsxs("div",{className:M("flex h-9 w-48 cursor-pointer items-center gap-x-2 rounded-md pl-3 hover:bg-slate-50",l===p.id?"bg-slate-50":"bg-transparent"),children:[p.icon,c.jsx("span",{children:p.label})]})},p.id)),f=o.find(p=>p.id===l)?.content;return c.jsxs(_e,{contentProps:{...s,className:M("min-h-full w-full max-w-4xl rounded-xl",s?.className),style:{...s?.style,boxShadow:"0px 0px 16px 4px rgba(0, 0, 0, 0.04), 0px 33px 32px -16px rgba(0, 0, 0, 0.10)"}},onOpenChange:r,overlayProps:{...n,className:M("py-28",n?.className)},...i,children:[c.jsxs("div",{className:"flex justify-between border-b border-slate-50 p-4",children:[c.jsx("h1",{className:"text-center text-xl font-semibold",children:t}),c.jsx("button",{type:"button",className:"flex size-6 items-center justify-center rounded-md outline-none",onClick:()=>r?.(!1),children:c.jsx(O,{name:"XmarkLight",size:24})})]}),c.jsxs("div",{className:"flex flex-1",children:[c.jsx("div",{className:"flex flex-col gap-y-1 p-3 pt-6",children:d}),c.jsx("div",{className:"m-6 flex h-full flex-1 flex-col overflow-hidden rounded-lg border border-slate-50",children:typeof f=="function"?c.jsx(f,{}):f})]})]})}const ji="min-h-[48px] min-w-[142px] text-base font-semibold py-3 px-6 rounded-xl outline-none active:opacity-75 hover:scale-105 transform transition-all";function Hw(e){const{body:t,header:n,onOpenChange:s,onContinue:r,cancelLabel:o,continueLabel:a,overlayProps:i,contentProps:l,...u}=e;return c.jsx(_e,{contentProps:{...l,className:M("rounded-3xl",l?.className)},onOpenChange:s,overlayProps:{...i,className:i?.className},...u,children:c.jsxs("div",{className:"w-[400px] p-6 text-slate-300",children:[c.jsx("div",{className:"border-b border-slate-50 pb-2 text-2xl font-bold text-gray-800",children:n}),c.jsx("div",{className:"my-6 rounded-md bg-slate-50 p-4 text-center",children:t}),c.jsxs("div",{className:"mt-8 flex justify-between gap-3",children:[c.jsx("button",{className:M(ji,"flex-1 bg-slate-50 text-slate-800"),onClick:()=>s?.(!1),children:o}),c.jsx("button",{className:M(ji,"flex-1 bg-gray-800 text-gray-50"),onClick:r,children:a})]})]})})}function n6(e){const{branch:t="main"}=e;return c.jsxs("button",{className:"flex h-8 w-fit items-center gap-1 rounded-lg bg-slate-50 pl-1 pr-2 text-xs text-stone-300",children:[c.jsx(O,{name:"Branch"}),c.jsx("span",{children:"BRANCH"}),c.jsx("span",{className:"text-gray-900",children:t})]})}function r6(e){const{docId:t}=e,[,n]=wr();function s(r){return()=>{n(r).catch(o=>{console.error("Failed to copy!",o)})}}return c.jsxs("button",{className:"flex h-8 w-fit items-center gap-1 rounded-lg bg-slate-50 pl-1 pr-2 text-xs text-stone-300",onClick:s(t),children:[c.jsx(O,{name:"Link"}),"DOC ID",c.jsx("span",{className:"text-gray-900",children:t})]})}const s6=e=>{const{documentState:t,onCopyState:n}=e,[,s]=wr();function r(){const o=JSON.stringify(t,null,2);s(o).then(()=>{n?.()}).catch(a=>{console.error("Failed to copy document state!",a)})}return c.jsx("button",{className:"rounded-lg bg-slate-50 p-1 text-stone-300",onClick:r,children:c.jsx(O,{name:"CurlyBrackets"})})};function o6(e){const{value:t,onChange:n}=e,s=[{displayValue:"Global scope",value:"global"},{displayValue:"Local scope",value:"local"}];return c.jsx(yt,{absolutePositionMenu:!0,containerClassName:"bg-slate-50 text-gray-500 rounded-lg w-fit text-xs z-10",id:"scope select",itemClassName:"py-2 text-gray-500 grid grid-cols-[auto,auto] gap-1",items:s,menuClassName:"min-w-0 text-gray-500",onChange:n,value:t})}function a6(e){const{title:t,docId:n,scope:s,onChangeScope:r,onClose:o,className:a,documentState:i,onCopyState:l,...u}=e;return c.jsxs("header",{className:M("flex items-center justify-between bg-transparent",a),...u,children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("button",{name:"close-revision-history",className:"shadow-button rounded-lg bg-gray-50 p-1 text-stone-300",onClick:o,children:c.jsx(O,{name:"VariantArrowLeft"})}),c.jsx("h1",{className:"text-xs",children:t})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(r6,{docId:n}),i&&c.jsx(s6,{documentState:i,onCopyState:l}),c.jsx(n6,{}),c.jsx(o6,{onChange:r,value:s})]})]})}function pt(e,t,n){let s=n.initialDeps??[],r;function o(){var a,i,l,u;let d;n.key&&((a=n.debug)!=null&&a.call(n))&&(d=Date.now());const h=e();if(!(h.length!==s.length||h.some((g,m)=>s[m]!==g)))return r;s=h;let p;if(n.key&&((i=n.debug)!=null&&i.call(n))&&(p=Date.now()),r=t(...h),n.key&&((l=n.debug)!=null&&l.call(n))){const g=Math.round((Date.now()-d)*100)/100,m=Math.round((Date.now()-p)*100)/100,y=m/16,v=(x,C)=>{for(x=String(x);x.length<C;)x=" "+x;return x};console.info(`%c⏱ ${v(m,5)} /${v(g,5)} ms`,`
45
45
  font-size: .6rem;
46
46
  font-weight: bold;
47
- color: hsl(${Math.max(0,Math.min(120-120*y,120))}deg 100% 31%);`,n?.key)}return(u=n?.onChange)==null||u.call(n,r),r}return o.updateDeps=a=>{s=a},o}function Pi(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const i6=(e,t)=>Math.abs(e-t)<1.01,c6=(e,t,n)=>{let s;return function(...r){e.clearTimeout(s),s=e.setTimeout(()=>t.apply(this,r),n)}},Ei=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},l6=e=>e,u6=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),s=[];for(let r=t;r<=n;r++)s.push(r);return s},d6=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=e.targetWindow;if(!s)return;const r=a=>{const{width:i,height:l}=a;t({width:Math.round(i),height:Math.round(l)})};if(r(Ei(n)),!s.ResizeObserver)return()=>{};const o=new s.ResizeObserver(a=>{const i=()=>{const l=a[0];if(l?.borderBoxSize){const u=l.borderBoxSize[0];if(u){r({width:u.inlineSize,height:u.blockSize});return}}r(Ei(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()});return o.observe(n,{box:"border-box"}),()=>{o.unobserve(n)}},Ni={passive:!0},Oi=typeof window>"u"?!0:"onscrollend"in window,f6=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=e.targetWindow;if(!s)return;let r=0;const o=e.options.useScrollendEvent&&Oi?()=>{}:c6(s,()=>{t(r,!1)},e.options.isScrollingResetDelay),a=d=>()=>{const{horizontal:h,isRtl:f}=e.options;r=h?n.scrollLeft*(f&&-1||1):n.scrollTop,o(),t(r,d)},i=a(!0),l=a(!1);l(),n.addEventListener("scroll",i,Ni);const u=e.options.useScrollendEvent&&Oi;return u&&n.addEventListener("scrollend",l,Ni),()=>{n.removeEventListener("scroll",i),u&&n.removeEventListener("scrollend",l)}},h6=(e,t,n)=>{if(t?.borderBoxSize){const s=t.borderBoxSize[0];if(s)return Math.round(s[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},p6=(e,{adjustments:t=0,behavior:n},s)=>{var r,o;const a=e+t;(o=(r=s.scrollElement)==null?void 0:r.scrollTo)==null||o.call(r,{[s.options.horizontal?"left":"top"]:a,behavior:n})};class m6{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const s=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(r=>{r.forEach(o=>{const a=()=>{this._measureElement(o.target,o)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var r;(r=s())==null||r.disconnect(),n=null},observe:r=>{var o;return(o=s())==null?void 0:o.observe(r,{box:"border-box"})},unobserve:r=>{var o;return(o=s())==null?void 0:o.unobserve(r)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([s,r])=>{typeof r>"u"&&delete n[s]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:l6,rangeExtractor:u6,onChange:()=>{},measureElement:h6,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var s,r;(r=(s=this.options).onChange)==null||r.call(s,this,n)},this.maybeNotify=pt(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(r=>{this.observer.observe(r)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,r=>{this.scrollRect=r,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(r,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<r?"forward":"backward":null,this.scrollOffset=r,this.isScrolling=o,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,s)=>{const r=new Map,o=new Map;for(let a=s-1;a>=0;a--){const i=n[a];if(r.has(i.lane))continue;const l=o.get(i.lane);if(l==null||i.end>l.end?o.set(i.lane,i):i.end<l.end&&r.set(i.lane,!0),r.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((a,i)=>a.end===i.end?a.index-i.index:a.end-i.end)[0]:void 0},this.getMeasurementOptions=pt(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(n,s,r,o,a)=>(this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:s,scrollMargin:r,getItemKey:o,enabled:a}),{key:!1}),this.getMeasurements=pt(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:s,scrollMargin:r,getItemKey:o,enabled:a},i)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(d=>{this.itemSizeCache.set(d.key,d.size)}));const l=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const u=this.measurementsCache.slice(0,l);for(let d=l;d<n;d++){const h=o(d),f=this.options.lanes===1?u[d-1]:this.getFurthestMeasurement(u,d),p=f?f.end+this.options.gap:s+r,g=i.get(h),m=typeof g=="number"?g:this.options.estimateSize(d),y=p+m,v=f?f.lane:d%this.options.lanes;u[d]={index:d,start:p,size:m,end:y,key:h,lane:v}}return this.measurementsCache=u,u},{key:!1,debug:()=>this.options.debug}),this.calculateRange=pt(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,s,r,o)=>this.range=n.length>0&&s>0?g6({measurements:n,outerSize:s,scrollOffset:r,lanes:o}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=pt(()=>{let n=null,s=null;const r=this.calculateRange();return r&&(n=r.startIndex,s=r.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,s]},(n,s,r,o,a)=>o===null||a===null?[]:n({startIndex:o,endIndex:a,overscan:s,count:r}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const s=this.options.indexAttribute,r=n.getAttribute(s);return r?parseInt(r,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this._measureElement=(n,s)=>{const r=this.indexFromElement(n),o=this.measurementsCache[r];if(!o)return;const a=o.key,i=this.elementsCache.get(a);i!==n&&(i&&this.observer.unobserve(i),this.observer.observe(n),this.elementsCache.set(a,n)),n.isConnected&&this.resizeItem(r,this.options.measureElement(n,s,this))},this.resizeItem=(n,s)=>{const r=this.measurementsCache[n];if(!r)return;const o=this.itemSizeCache.get(r.key)??r.size,a=s-o;a!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(r,a,this):r.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(r.index),this.itemSizeCache=new Map(this.itemSizeCache.set(r.key,s)),this.notify(!1))},this.measureElement=n=>{if(!n){this.elementsCache.forEach((s,r)=>{s.isConnected||(this.observer.unobserve(s),this.elementsCache.delete(r))});return}this._measureElement(n,void 0)},this.getVirtualItems=pt(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,s)=>{const r=[];for(let o=0,a=n.length;o<a;o++){const i=n[o],l=s[i];r.push(l)}return r},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const s=this.getMeasurements();if(s.length!==0)return Pi(s[_u(0,s.length-1,r=>Pi(s[r]).start,n)])},this.getOffsetForAlignment=(n,s,r=0)=>{const o=this.getSize(),a=this.getScrollOffset();s==="auto"&&(s=n>=a+o?"end":"start"),s==="center"?n+=(r-o)/2:s==="end"&&(n-=o);const i=this.getTotalSize()+this.options.scrollMargin-o;return Math.max(Math.min(i,n),0)},this.getOffsetForIndex=(n,s="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const r=this.measurementsCache[n];if(!r)return;const o=this.getSize(),a=this.getScrollOffset();if(s==="auto")if(r.end>=a+o-this.options.scrollPaddingEnd)s="end";else if(r.start<=a+this.options.scrollPaddingStart)s="start";else return[a,s];const i=s==="end"?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,s,r.size),s]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(n,{align:s="start",behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,s),{adjustments:void 0,behavior:r})},this.scrollToIndex=(n,{align:s="auto",behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),n=Math.max(0,Math.min(n,this.options.count-1));let o=0;const a=10,i=u=>{if(!this.targetWindow)return;const d=this.getOffsetForIndex(n,u);if(!d){console.warn("Failed to get offset for index:",n);return}const[h,f]=d;this._scrollToOffset(h,{adjustments:void 0,behavior:r}),this.targetWindow.requestAnimationFrame(()=>{const p=this.getScrollOffset(),g=this.getOffsetForIndex(n,f);if(!g){console.warn("Failed to get offset for index:",n);return}i6(g[0],p)||l(f)})},l=u=>{this.targetWindow&&(o++,o<a?this.targetWindow.requestAnimationFrame(()=>i(u)):console.warn(`Failed to scroll to index ${n} after ${a} attempts.`))};i(s)},this.scrollBy=(n,{behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:s})},this.getTotalSize=()=>{var n;const s=this.getMeasurements();let r;if(s.length===0)r=this.options.paddingStart;else if(this.options.lanes===1)r=((n=s[s.length-1])==null?void 0:n.end)??0;else{const o=Array(this.options.lanes).fill(null);let a=s.length-1;for(;a>=0&&o.some(i=>i===null);){const i=s[a];o[i.lane]===null&&(o[i.lane]=i.end),a--}r=Math.max(...o.filter(i=>i!==null))}return Math.max(r-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:s,behavior:r})=>{this.options.scrollToFn(n,{behavior:r,adjustments:s},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(t)}}const _u=(e,t,n,s)=>{for(;e<=t;){const r=(e+t)/2|0,o=n(r);if(o<s)e=r+1;else if(o>s)t=r-1;else return r}return e>0?e-1:0};function g6({measurements:e,outerSize:t,scrollOffset:n,lanes:s}){const r=e.length-1,o=l=>e[l].start;if(e.length<=s)return{startIndex:0,endIndex:r};let a=_u(0,r,o,n),i=a;if(s===1)for(;i<r&&e[i].end<n+t;)i++;else if(s>1){const l=Array(s).fill(0);for(;i<r&&l.some(d=>d<n+t);){const d=e[i];l[d.lane]=d.end,i++}const u=Array(s).fill(n+t);for(;a>=0&&u.some(d=>d>=n);){const d=e[a];u[d.lane]=d.start,a--}a=Math.max(0,a-a%s),i=Math.min(r,i+(s-1-i%s))}return{startIndex:a,endIndex:i}}const Ii=typeof document<"u"?b.useLayoutEffect:b.useEffect;function b6(e){const t=b.useReducer(()=>({}),{})[1],n={...e,onChange:(r,o)=>{var a;o?Ri.flushSync(t):t(),(a=e.onChange)==null||a.call(e,r,o)}},[s]=b.useState(()=>new m6(n));return s.setOptions(n),Ii(()=>s._didMount(),[]),Ii(()=>s._willUpdate()),s}function y6(e){return b6({observeElementRect:d6,observeElementOffset:f6,scrollToFn:p6,...e})}function v6(e){return`${e.slice(0,7)}...${e.slice(-5)}`}function x6(e){const{address:t,chainId:n}=e,[,s]=xr();if(!t)return null;const r=v6(t);function o(i){return()=>{s(i).catch(l=>{console.error("Failed to copy!",l)})}}const a=c.jsxs("button",{className:"flex items-center gap-1",onClick:o(t),children:[t,c.jsx(O,{className:"inline-block text-gray-600",name:"FilesEarmark",size:16})]});return c.jsx(Ve,{content:a,children:c.jsxs("span",{className:"flex w-fit cursor-pointer items-center gap-1 rounded-lg bg-gray-100 p-1 text-xs text-slate-100",children:[c.jsx(vu,{address:t,chainId:n}),r]})})}function w6(e){const{errors:t}=e,n=!!t?.length,s=n?"text-red-800":"text-green-700",r=n?c.jsx(O,{name:"Exclamation",size:16}):c.jsx(O,{name:"Check",size:16}),o=n?`Error: ${t[0]}`:"No errors",a=c.jsxs("span",{className:M("flex w-fit items-center rounded-lg border border-gray-200 px-2 py-1 text-xs",s,n&&"cursor-pointer"),children:[r,c.jsx("span",{className:M("inline-block max-w-36 truncate"),children:o})]}),i=t?.map((l,u)=>c.jsxs("p",{className:"text-red-800",children:["Error: ",l]},u));return n?c.jsx(Ve,{content:i,children:a}):a}function C6(e){const{operationType:t,operationInput:n}=e,s=c.jsx("code",{children:c.jsx("pre",{children:JSON.stringify(n,null,2)})});return c.jsx(Ve,{content:s,children:c.jsxs("span",{className:"flex cursor-pointer items-center gap-2 text-xs",children:[t,c.jsx(O,{className:"text-gray-300",name:"Braces",size:16})]})})}function S6(e){const{operationIndex:t,eventId:n,stateHash:s}=e,[,r]=xr(),o=t+1,a=c.jsxs("button",{className:"flex items-center gap-1",onClick:i(s),children:["Revision ",o," - Event ID: ",n," - State Hash: ",s,c.jsx(O,{className:"inline-block text-gray-600",name:"FilesEarmark",size:16})]});function i(l){return()=>{r(l).catch(u=>{console.error("Failed to copy!",u)})}}return c.jsx(Ve,{content:a,children:c.jsxs("span",{className:"flex cursor-pointer items-center gap-2 text-xs text-gray-600",children:["Revision ",o,".",c.jsx("a",{children:c.jsx(O,{className:"cursor-pointer text-slate-100",name:"Ellipsis",size:14})})]})})}function j6(e){const{signatures:t}=e;if(!t?.length)return null;const n=c.jsxs("div",{className:"text-xs text-slate-300",children:[c.jsx("h3",{className:"mb-2",children:"Signature details:"}),t.map((s,r)=>c.jsxs("div",{className:"mb-2 last:mb-0",children:[c.jsxs("h4",{children:["Signature #",r+1," -"," ",s.isVerified?"verified":"unverified"]}),c.jsx("code",{children:c.jsx("pre",{children:JSON.stringify(s,null,2)})})]},s.hash))]});return c.jsx(Ve,{content:n,children:c.jsxs("span",{className:"flex w-fit cursor-pointer items-center gap-1 rounded-lg border border-gray-200 px-2 py-1",children:[c.jsx(P6,{signatures:t})," ",c.jsx(O,{className:"text-gray-300",name:"InfoSquare",size:16})]})})}function P6(e){const{signatures:t}=e;if(!t?.length)return null;const n=t.length,s=t.filter(i=>i.isVerified).length,o=`${s}/${n} ${n===1?"signature":"signatures"} verified`,a=s===0?"text-red-800":s===n?"text-green-700":"text-orange-700";return c.jsx("span",{className:`text-xs ${a}`,children:o})}function E6(e){const{timestampUtcMs:t}=e,n=typeof t=="string"&&!t.includes("-")?parseInt(t):t,s=new Date(n),r=tr(s,"HH:mm 'UTC'"),o=tr(s,"eee, dd MMM yyyy HH:mm:ss 'UTC'"),a=c.jsx("div",{children:o});return c.jsx(Ve,{content:a,children:c.jsxs("span",{className:"cursor-pointer text-xs",children:["committed at ",r]})})}function N6(e){return c.jsxs("article",{className:"flex items-center justify-between rounded-xl border border-gray-200 bg-white px-4 py-2",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(S6,{...e}),c.jsx(C6,{...e}),c.jsx(x6,{...e}),c.jsx(E6,{...e})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(j6,{...e}),c.jsx(w6,{...e})]})]})}const O6=b.memo(N6);function I6(e){const{operationIndex:t,skipCount:n}=e,s=t,r=n===1?`${s}`:`${s} - ${s+1-n}`;return c.jsxs("article",{className:"grid grid-cols-[1fr,auto,1fr] items-center py-2",children:[c.jsx("div",{className:"h-px rounded-full bg-slate-100"}),c.jsxs("div",{className:"mx-3 text-xs text-slate-100",children:["[Skipped Revision ",r,"]"]}),c.jsx("div",{className:"h-px rounded-full bg-slate-100"})]})}function M6(e){const t=[],n=new Set;for(const s of e){if(!s.timestampUtcMs)continue;const r=s.timestampUtcMs.split("T")[0];n.has(r)||(n.add(r),t.push({type:"day",height:32,timestampUtcMs:r})),t.push({type:"revision",height:46,operationIndex:s.index,eventId:s.id??"EVENT_ID_NOT_FOUND",stateHash:s.hash,operationType:s.action.type,operationInput:s.action.input??{},address:s.action?.context?.signer?.user.address,chainId:s.action?.context?.signer?.user.chainId,timestampUtcMs:s.timestampUtcMs,signatures:D6(s.action?.context?.signer?.signatures??[]),errors:s.error?[s.error]:void 0}),s.skip>0&&t.push({type:"skip",height:34,operationIndex:s.index,skipCount:s.skip,timestampUtcMs:s.timestampUtcMs})}return t}function T6(e){const[t,n,s,r]=e;return{signerAddress:t,hash:n,prevStateHash:s,signatureBytes:r,isVerified:!0}}function D6(e){return e?.map(T6)}function k6(e){const{timestampUtcMs:t}=e,n=tr(t,"MMM dd, yyyy");return c.jsxs("h2",{className:"-ml-6 flex items-center gap-1 bg-slate-50 py-2 text-xs text-slate-100",children:[c.jsx(O,{name:"Ring",size:16})," Changes on ",n]})}function R6(e){const{localOperations:t,globalOperations:n,scope:s}=e,r=s==="local"?t:n,o=100,a=b.useMemo(()=>M6(r),[r]),[i,l]=b.useState(0),[u,d]=b.useState(o),[h,f]=b.useState(()=>a.slice(0,u)),p=b.useRef(null),g=h.length<a.length,m=y6({count:h.length,getScrollElement:()=>p.current,estimateSize:v=>a[v].height,gap:8});b.useEffect(()=>{if(!g)return;const v=Math.floor(i/46),x=o+v;d(C=>x>C?x:C)},[i,g]),b.useEffect(()=>{f(a.slice(0,u))},[a,u]);const y=v=>{l(x=>{const C=x+v.deltaY;return C<0?0:C})};return b.useEffect(()=>(window.addEventListener("wheel",y),()=>{window.removeEventListener("wheel",y)}),[]),c.jsx("div",{className:"border-l border-slate-100",ref:p,style:{height:`${m.getTotalSize()}px`,width:"100%",position:"relative"},children:m.getVirtualItems().map(v=>{const x=h[v.index];return c.jsxs("div",{style:{position:"absolute",top:0,left:16,width:"100%",height:`${v.size}px`,transform:`translateY(${v.start}px)`},children:[x.type==="revision"&&b.createElement(O6,{...x,key:v.key}),x.type==="skip"&&c.jsx(I6,{...x},v.key),x.type==="day"&&c.jsx(k6,{...x},v.key)]},v.index)})})}function Ww(e){const{documentTitle:t,documentId:n,globalOperations:s,localOperations:r,onClose:o,itemsPerPage:a=100,documentState:i,onCopyState:l}=e,[u,d]=b.useState("global"),h=b.useMemo(()=>Dd(kd(u==="global"?s:r)).sort((T,I)=>I.index-T.index),[s,r,u]),{pageItems:f,pages:p,goToPage:g,goToNextPage:m,goToPreviousPage:y,goToFirstPage:v,goToLastPage:x,hiddenNextPages:C,isNextPageAvailable:E,isPreviousPageAvailable:w}=jd(h,{itemsPerPage:a});function j(N){v(),d(N)}const P=h.length>a?c.jsx("div",{className:"mt-4 flex w-full justify-end",children:c.jsx(Pd,{firstPageLabel:"First Page",goToFirstPage:v,goToLastPage:x,goToNextPage:m,goToPage:g,goToPreviousPage:y,hiddenNextPages:C,isNextPageAvailable:E,isPreviousPageAvailable:w,lastPageLabel:"Last Page",nextPageLabel:"Next",pages:p,previousPageLabel:"Previous"})}):c.jsx("hr",{className:"h-12 border-none"});return c.jsxs(Zc,{children:[c.jsx(a6,{docId:n,onChangeScope:j,onClose:o,scope:u,title:t,documentState:i,onCopyState:l}),P,c.jsx("div",{className:"mt-4 flex justify-center rounded-md bg-slate-50 p-4",children:h.length>0?c.jsx("div",{className:"grid grid-cols-[minmax(min-content,1018px)]",children:c.jsx(R6,{globalOperations:u==="global"?f:[],localOperations:u==="local"?f:[],scope:u})}):c.jsx("h3",{className:"my-40 text-gray-600",children:"This document has no recorded operations yet."})}),P]})}const A6=function(t){const{icon:n,title:s,description:r,containerClassName:o,active:a,onClick:i}=t;return c.jsx(Ve,{content:s,side:"right",sideOffset:12,className:"border-none bg-gray-800 px-3 py-2 text-sm text-white",children:c.jsxs("div",{className:M("group/sidebar-item relative flex cursor-pointer flex-col items-center justify-center text-center text-sm text-black",o,a&&"bg-white",i&&"cursor-pointer"),onClick:i,children:[a?c.jsx("div",{className:"absolute left-0 top-1/2 h-10 w-1 -translate-y-1/2 rounded-r-sm bg-violet-400"}):c.jsx("div",{className:"absolute left-0 top-1/2 h-6 w-1 -translate-y-1/2 rounded-r-sm bg-zinc-300 opacity-0 transition-opacity group-hover/sidebar-item:opacity-100"}),c.jsx("div",{className:"mx-auto py-4",children:n||c.jsx("div",{className:"flex size-8 items-center justify-center rounded-lg bg-black",children:c.jsx("span",{className:"text-sm font-medium text-white",children:s.slice(0,1).toUpperCase()})})})]})})},qw=function(t){const{containerClassName:n,onClick:s}=t;return c.jsx(A6,{title:"Create New Drive",icon:c.jsx(O,{name:"PlusSquare",size:32}),onClick:s,containerClassName:n})},L6=({onLogin:e})=>{const[t,n]=b.useState(!1),s=!t&&!!e,r=t?c.jsx(O,{name:"Reload",size:14,className:"animate-spin"}):c.jsx("span",{children:"Connect"}),o=()=>{e&&(n(!0),e())};return c.jsxs("div",{className:"p-4",children:[c.jsx("div",{className:"mb-4 flex justify-center",children:c.jsx("div",{className:"flex h-[22px] w-[83px] items-center justify-center overflow-hidden",children:c.jsx(O,{name:"RenownLight",size:83})})}),c.jsx("button",{onClick:s?o:void 0,className:M("mt-4 flex h-7 w-full cursor-pointer items-center justify-center rounded-lg border border-gray-300 bg-transparent text-sm active:opacity-70",s?"cursor-pointer":"cursor-wait"),type:"button",children:r})]})},F6=new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAACQCAYAAADnRuK4AAAACXBIWXMAACxLAAAsSwGlPZapAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAtmSURBVHgB7Z3dbtvmGcefl5LsqHYCq0C6tEUCZ0kDzAFqd0NTYAmweAfr0YD0CrpeQboriH0H6RUsu4ChAYodtCdJD3LQBGttILEBJ4tdJ2uzBoi0yIpsi+S790+ZDkmREilSHySfX6FKpkgliH5+nuf9pKAEkFLO1Bu7VzRNzEuiWfXzglDHSIgZYsYC9b1sCaEeJFZMU66WCnS7XC5vUUwE9Qmk2dndvar+ZpetB5NCxIr6Hr+II1NkgQ7FMeTnHGGygxLhRkGj5agiRRKo3mxeY3EyjkZLR8vl5bCnhxKo2WzOGqb4UpJcCDpH1T+E/wpKY+3gU4XoO0MyCaKyhvVsqifTNNWzVM8y8Hz1rW2pr3ExTDTq+Q3vNPc/lYZ+3S/qwI+iVlDSCJYlZcgDiVqGQdLXJVGTJD47NjV5s9vndP3W6429a8rZpY6LIE6hoB4aMenHMMxgkXqktECBguSBNHhwxMkWiEgt3SRDpbgOukjka8HLxt4VQeaX3uOlIkedrKPr7WjkRWiFv0yXJ/7ecdx7AAWzbsgfnDUPgs1EsWgVykz2QTTaa+melCZqRU1+4C2sO8KJSoe3vAXzZInlyRMoTxAw3MgZXbXEvee6BELdg6EI5zGkLa538gcCRkk1lNzIhXqjseQ8cmiGlbpM2nS+WdA0migViMkvKKx1V00kavr+5OlKRdTw02EEUqnrmvNCBJ1SkQvmvFMsauROQHKmOPHqc/sn6y2/6MMtLsams2X2OgpZhrQM92h6u6OQ5WHadItCliWqSL7quqDAdQ/jpqB5nBDaH6wnv/R1ZKLILS/GBbqEdvdarmP6/pGK5k1f1qg6y8N4gBHevsBSafeKOuSeoqGxPEwAXjcwvUfVQGLedZLGxTPjj9cNKWhWw/9cJ3EAYgLwuqHaZvM4Nus+zAYxAXSkMDGj9TiHYQ7pVEP1BxEzFL6+9T3tvGrS4u/fpzcrRykrcMU8BLb/85yePa/STmOX1h49oSzBAg2BJ0qgw9dPn1OWYIEGzH5LtyKQ8+dnv1QpK7BAA2ZbRRxI42T1wSZlBRZowKw/2u44hnpov9WiLMACDRCI8qK64/ve2sZTygIs0ABZvf848L31je1MRCEWaEA82vxZRaBa4Puoi1bvp78WYoEGxOra457nrD18kvoWGQs0AFYfPLY6DcOdm+4oxAIlzE6jSSsRpEChvbaR3t5pFihBUBR/fft7isq9lY3UpjIWKEHufLceOnV1XHtvzYpeaYMFSgjUPds/9T/OBfEQvdLWtGeBEgDyrCRQDFsS3UqXRCxQTJKSx+ZFbSdVErFAMbi38jBReWwg0Vff3E1FTcQC9YHV2lJRYm1jmwaFXRONu0Si3mi69qEqT5aICQb9NnfurvXd2uqHhfO/pvnzp2kcaHpWp7JAIUHUWX2wNdCo0403Z6Zp8eL7ND1VplHCAvXBuuopXlHFsndi2Cg4O/u2FY1GJRILFBJEnEebz2j94fZQ01UYpqeO0InjlZGIxAL1ADUOJsFjOsY4RJxenHr3OJ05/Tadeuc4DQMWKAC0dtqtnvGKNmGZKBXp4oU5S6hB4hWIm/EHoO8lrfIAa/XHT8NfMsQCHXDirYqqK9J7FytEoLmzp2jYcArzgCiEqRWYUTjuEQnSWPWPSlsoqocB10ARwIJATH7vNrd5FECc35w7SXPnTlmvhwkL1AdokY1DRBqlODYsUAzQmTiqOcwnVTP90kdzIxPHhgWKSXuQ819Di0YQ5sMPzlk90OMAC5QQd1c2rCGOQYIe548v/856Hhe8AvEGU31yYeGcFR0GldLQpbB4aX7kKasXLFAMMM0CJC3RGZWuLqle5TQwcoGGUUsMMgUkLVGa5AEjF+gf/7xDwwQyTb9RpomJIlVmpg96oON1wiUlEeb8pEkekLsUhohnRz10FNpfOiRCr26/rR1IhPGofgtriL14cZ7SBtdAB2AaBx5YZXF29p2+ppBCov/+UlMDs3WKyri1tsLCg6keEJ3QYYjU+mjr50jXosWEaadRW04fLryXSnkACxQARMLk+ah1DUSYP6iJwoDmOoYm0goL1ANEI4gUhTk1XhV2asjFC+cpzbBAIUAqiypRmCiEc9KaumxYoJBAoij7+PSaoAZxxmV8Kw4sUASwj8+LavgWVrcodEa19NIefQALFBGshw9LtyiUhegDWKCIWP1FEXYT84tCGK7IQvQBqe1IxBdwJuRvcbW6Qy/+V09s3A1Ne0SXMODWTugXcq4xO3s6G9EHpFcgNZ61EKG/BSQ1NRU9zVi5OlHqPXfKnvhuD3HYq0qzQq5SGH7z//ynj2LXH+077oSfaO9cNfqrDMkDclcD2Ss4464BQy0UFqS7k+8et0bbo0bNcSe3g6noAf7qm+/6Xv8eNQ3+UY2RZZHctsKsIjxGMVvtY8Q9i+S6GR9nR4s0r6NPklwLlKW7J4+KXAs07ise0gD3RDOxyLVAadiBbNzJtUAvYrSksjKWFZdcC/TvzWhznp1gKIXJsUDYEzFKb7KXSmWamBwLtP7waay+nCwNiMYhlwJh7VfcHedPvJXe/RSTJFcdIdbCwfubsVIXwDykMFM58kBqBdp51bSW3IShgY0zlTRJDT9kaUJYXNIrkJJhFNvNofbh+uc13BMdkYsp2z1j0LBAEcjCQsCkYYFCghmMC2Ny07dxggUKgXWzt0vp27tnGPB8hh6My/7M4wr/qwQAYbDJVJq3XhkGLJAPuJ0AVk9w1OkN10A+oJeZ5QkHC+QD7tCDladMb1L7a4be4I8Xfxv4fpwbo2Cm4trGU262hyCzESjuLZE4CoUjswLZ99bqFzsKMd3JdA3EUWjwZFogjkKDJ/OtMI5CgyXzAtkbPPULR6Hu5KIfaO69eMMRHIWCyYVA7W3l+p8Ez1EomNz0RM/H3BmMo5A/uRGo187xveAo5E+uxsI4CiVPrgTiKJQ8uRuN5yiULLkTiKNQsuRyPhDulBMHjkKvyaVAWJocZ30XR6HX5HZG4pmYtzvgKNQmtwLFHWTlKNQmtwLFneoBOArlfFI9R6H4iHqjKZ0HypO8cRITTHPPHXFVBJKuG19JSQzji58amiRR630awygzTLcbgmhLE0KsOA+a7A8TgFcNKZRAZJo/Og8apkkM44fpdcOUq0hhrggkuQhiAjA9bsAdzWjt3nSdpHIYO8R4QWAxPfWNUaDbWqVSqSmVbjvf0E2DGMaJ2VFAy5VKubzV7kiU9K3zTUPnOohx0zLcTphSfIFnSyBd373u7A+Ca7rBUYhpYyh5vLUx0heeLYGsNGa2jbLRdZNrIcYSxxt9BGk3kL7arw+oVqszxYnJTXXocLpesahRqVAgJr/s64YVgZzoGp22BTocTA2KQpzK8ouuxPHKo6qfZVseILwX1Ru7P6jAteA8NqlGrDVNEJMfkLp29933lBWq53n6jbJr27aO6Ry6Jj/xDrBi2gJ3MOYHQzXZ91rezCNrLUGL3nM7BEJ4klL81XWpesBGTmfZB2nLL2BIKnzmTF02vhPKjk2Xb5BJy97jLVUToajiaJQ9rNaW+m7x6MRcPjY1edPvuq6FTb3eXFKKXeu4SCXDYkGzHkz6QdTRffp62pjLR6emloKu7VkZv3zZuCIK4m/O5v3hxQciFVSBjddMeoAsuolWlgwQR9aEKmWmkY26EOpbrzabsyVJt9SfMxt0DlppmmiLhNf4YJZqPLAFQXGMEXW/gVEnmCPWEvITv5qn41yKQFBKY7KCtPoCjx4tL4W9InKIQDQqGOaSENqnxGSEtjj69JHrFeGd4tydvnNMWyS6rMLdVW/HI5MShBoQNejbfsR5/REJcCiTJZKYl4Jm1QfPEjMmyBoWT2AOj+rQ+REzCY2pIzf7lcbJ/wH9VD8KK3ri6QAAAABJRU5ErkJggg==",import.meta.url).href,$6=new URL("/assets/renown-short-hover-BiSLBV7L.png",import.meta.url).href,z6=({onLogin:e})=>{const t=c.jsx(L6,{onLogin:e});return c.jsx(fc,{content:t,children:c.jsxs("div",{className:M("group/sidebar-footer flex w-full items-baseline justify-start text-sm font-semibold leading-10 text-gray-600",e?"cursor-pointer":"cursor-wait"),children:[c.jsx("img",{width:42,height:42,loading:"lazy",className:"group-hover/sidebar-footer:hidden",src:F6,alt:"Renown Login"}),c.jsx("img",{width:42,height:42,loading:"lazy",className:"hidden group-hover/sidebar-footer:block",src:$6,alt:"Renown Login Hover"})]})})},_6=e=>`${e.slice(0,7)}...${e.slice(-5)}`,U6=({address:e,onDisconnect:t,etherscanUrl:n,username:s=""})=>{const[r,o]=b.useState(!1),a=b.useCallback(async i=>{try{await navigator.clipboard.writeText(i),o(!0),setTimeout(()=>o(!1),2e3)}catch(l){console.error("Failed to copy address:",l)}},[]);return c.jsxs("div",{className:"flex flex-col divide-y divide-gray-200 text-gray-900",children:[c.jsxs("div",{className:"px-3 py-2",children:[s&&c.jsx("div",{className:"text-sm font-medium",children:s}),c.jsx("div",{className:"mt-1 flex items-center gap-2",children:c.jsx(Pe,{size:"small",color:"light",onClick:a.bind(null,e),className:"w-full cursor-pointer bg-transparent p-0 active:opacity-70",type:"button",children:c.jsxs("div",{className:"relative flex w-full items-center gap-1",children:[c.jsxs("div",{className:`flex items-center gap-1 transition-opacity duration-150 ${r?"opacity-0":"opacity-100"}`,children:[c.jsx("span",{className:"text-xs",children:_6(e)}),c.jsx(O,{name:"FilesEarmark",color:"#9EA0A1",size:14})]}),c.jsx("div",{className:`absolute left-0 text-xs transition-opacity duration-150 ${r?"opacity-100":"opacity-0"}`,children:"Copied to clipboard!"})]})})})]}),n&&c.jsx("div",{className:"px-3 py-2",children:c.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-sm text-gray-900 hover:text-gray-600",children:[c.jsx(O,{name:"Ethscan",size:14}),"View on Etherscan"]})}),c.jsx("div",{className:"px-3 py-2",children:c.jsxs("button",{onClick:t,className:M("flex w-full items-center gap-2 text-sm text-red-900",t?"cursor-pointer hover:text-red-700":"pointer-events-none cursor-wait"),type:"button",children:[c.jsx(O,{name:"Disconnect",size:14,color:"#EA4335"}),"Disconnect"]})})]})},V6=({address:e,etherscanUrl:t,onDisconnect:n})=>{const{data:s}=yu({address:e}),r=s,o=c.jsx(U6,{address:e,username:r,onDisconnect:n,etherscanUrl:t});return c.jsx(fc,{content:o,children:c.jsx("div",{className:"flex items-center justify-center rounded-sm",children:c.jsx(vu,{address:e,size:"40px"})})})},B6=({address:e,className:t,onLogin:n,onClickSettings:s,onInspectorClick:r,onDisconnect:o,onHomeClick:a,showDebug:i,onDebugClick:l,etherscanUrl:u="",...d})=>c.jsxs(Ed,{...d,className:M("flex flex-col gap-2 border-t border-gray-300 px-2 py-4",t),children:[a&&c.jsx("button",{"aria-label":"Home",type:"button",className:"flex w-full cursor-pointer items-center justify-center outline-none",onClick:a,children:c.jsx(O,{className:"text-gray-600",name:"ConnectSmall",size:24})}),i&&l&&c.jsx("button",{"aria-label":"Debug Settings",type:"button",id:"connect-debug-button",className:"mt-3 flex w-full cursor-pointer items-center justify-center outline-none",onClick:l,children:c.jsx(O,{className:"text-gray-600",name:"Tube"})}),c.jsx("div",{className:a?"mt-3":"",children:e?c.jsx(V6,{address:e,onDisconnect:o,etherscanUrl:u}):c.jsx(z6,{onLogin:n})}),r&&c.jsx("button",{"aria-label":"Inspector",type:"button",className:"mt-3 flex w-full cursor-pointer items-center justify-center outline-none",onClick:r,children:c.jsx(O,{className:"text-gray-600",name:"CircleInfo"})}),c.jsxs("button",{"aria-label":"Settings",type:"button",className:M("mt-3 flex w-full items-center justify-center outline-none",s?"cursor-pointer":"cursor-wait"),onClick:s,children:[c.jsx(O,{className:"text-gray-600",name:"Settings"}),c.jsx("span",{className:"hidden text-sm font-semibold leading-6 text-gray-800",children:"Settings"})]})]}),H6=({className:e,children:t,...n})=>t?c.jsx(Nd,{...n,className:M("flex justify-center gap-4 border-b border-gray-300 py-4",e),children:t}):null,Gw=({onClick:e,address:t,headerContent:n,onClickSettings:s,onInspectorClick:r,maxWidth:o="304px",minWidth:a="58px",onLogin:i,onDisconnect:l,etherscanUrl:u,showDebug:d,onDebugClick:h,...f})=>c.jsxs(Od,{...f,maxWidth:o,minWidth:a,children:[c.jsxs(Id,{children:[c.jsx(H6,{children:n}),c.jsx("div",{className:"flex flex-col",children:f.children})]}),c.jsx(B6,{address:t,onClickSettings:s,onInspectorClick:r,onLogin:i,onDisconnect:l,etherscanUrl:u,onHomeClick:e,showDebug:d,onDebugClick:h})]}),mn=e=>typeof e=="number"&&!isNaN(e),rt=e=>typeof e=="string",ye=e=>typeof e=="function",Jn=e=>rt(e)||ye(e)?e:null,Gs=e=>b.isValidElement(e)||rt(e)||ye(e)||mn(e);function W6(e,t,n){n===void 0&&(n=300);const{scrollHeight:s,style:r}=e;requestAnimationFrame(()=>{r.minHeight="initial",r.height=s+"px",r.transition=`all ${n}ms`,requestAnimationFrame(()=>{r.height="0",r.padding="0",r.margin="0",setTimeout(t,n)})})}function Dr(e){let{enter:t,exit:n,appendPosition:s=!1,collapse:r=!0,collapseDuration:o=300}=e;return function(a){let{children:i,position:l,preventExitTransition:u,done:d,nodeRef:h,isIn:f,playToast:p}=a;const g=s?`${t}--${l}`:t,m=s?`${n}--${l}`:n,y=b.useRef(0);return b.useLayoutEffect(()=>{const v=h.current,x=g.split(" "),C=E=>{E.target===h.current&&(p(),v.removeEventListener("animationend",C),v.removeEventListener("animationcancel",C),y.current===0&&E.type!=="animationcancel"&&v.classList.remove(...x))};v.classList.add(...x),v.addEventListener("animationend",C),v.addEventListener("animationcancel",C)},[]),b.useEffect(()=>{const v=h.current,x=()=>{v.removeEventListener("animationend",x),r?W6(v,d,o):d()};f||(u?x():(y.current=1,v.className+=` ${m}`,v.addEventListener("animationend",x)))},[f]),Y.createElement(Y.Fragment,null,i)}}function Mi(e,t){return e!=null?{content:e.content,containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,status:t}:{}}const pe=new Map;let gn=[];const Qs=new Set,q6=e=>Qs.forEach(t=>t(e)),Uu=()=>pe.size>0;function Vu(e,t){var n;if(t)return!((n=pe.get(t))==null||!n.isToastActive(e));let s=!1;return pe.forEach(r=>{r.isToastActive(e)&&(s=!0)}),s}function Bu(e,t){Gs(e)&&(Uu()||gn.push({content:e,options:t}),pe.forEach(n=>{n.buildToast(e,t)}))}function Ti(e,t){pe.forEach(n=>{t!=null&&t!=null&&t.containerId?t?.containerId===n.id&&n.toggle(e,t?.id):n.toggle(e,t?.id)})}function G6(e){const{subscribe:t,getSnapshot:n,setProps:s}=b.useRef((function(o){const a=o.containerId||1;return{subscribe(i){const l=(function(d,h,f){let p=1,g=0,m=[],y=[],v=[],x=h;const C=new Map,E=new Set,w=()=>{v=Array.from(C.values()),E.forEach(P=>P())},j=P=>{y=P==null?[]:y.filter(N=>N!==P),w()},S=P=>{const{toastId:N,onOpen:T,updateId:I,children:D}=P.props,R=I==null;P.staleId&&C.delete(P.staleId),C.set(N,P),y=[...y,P.props.toastId].filter(F=>F!==P.staleId),w(),f(Mi(P,R?"added":"updated")),R&&ye(T)&&T(b.isValidElement(D)&&D.props)};return{id:d,props:x,observe:P=>(E.add(P),()=>E.delete(P)),toggle:(P,N)=>{C.forEach(T=>{N!=null&&N!==T.props.toastId||ye(T.toggle)&&T.toggle(P)})},removeToast:j,toasts:C,clearQueue:()=>{g-=m.length,m=[]},buildToast:(P,N)=>{if((U=>{let{containerId:A,toastId:B,updateId:te}=U;const ne=A?A!==d:d!==1,H=C.has(B)&&te==null;return ne||H})(N))return;const{toastId:T,updateId:I,data:D,staleId:R,delay:F}=N,$=()=>{j(T)},V=I==null;V&&g++;const W={...x,style:x.toastStyle,key:p++,...Object.fromEntries(Object.entries(N).filter(U=>{let[A,B]=U;return B!=null})),toastId:T,updateId:I,data:D,closeToast:$,isIn:!1,className:Jn(N.className||x.toastClassName),bodyClassName:Jn(N.bodyClassName||x.bodyClassName),progressClassName:Jn(N.progressClassName||x.progressClassName),autoClose:!N.isLoading&&(q=N.autoClose,Z=x.autoClose,q===!1||mn(q)&&q>0?q:Z),deleteToast(){const U=C.get(T),{onClose:A,children:B}=U.props;ye(A)&&A(b.isValidElement(B)&&B.props),f(Mi(U,"removed")),C.delete(T),g--,g<0&&(g=0),m.length>0?S(m.shift()):w()}};var q,Z;W.closeButton=x.closeButton,N.closeButton===!1||Gs(N.closeButton)?W.closeButton=N.closeButton:N.closeButton===!0&&(W.closeButton=!Gs(x.closeButton)||x.closeButton);let ee=P;b.isValidElement(P)&&!rt(P.type)?ee=b.cloneElement(P,{closeToast:$,toastProps:W,data:D}):ye(P)&&(ee=P({closeToast:$,toastProps:W,data:D}));const se={content:ee,props:W,staleId:R};x.limit&&x.limit>0&&g>x.limit&&V?m.push(se):mn(F)?setTimeout(()=>{S(se)},F):S(se)},setProps(P){x=P},setToggle:(P,N)=>{C.get(P).toggle=N},isToastActive:P=>y.some(N=>N===P),getSnapshot:()=>v}})(a,o,q6);pe.set(a,l);const u=l.observe(i);return gn.forEach(d=>Bu(d.content,d.options)),gn=[],()=>{u(),pe.delete(a)}},setProps(i){var l;(l=pe.get(a))==null||l.setProps(i)},getSnapshot(){var i;return(i=pe.get(a))==null?void 0:i.getSnapshot()}}})(e)).current;s(e);const r=b.useSyncExternalStore(t,n,n);return{getToastToRender:function(o){if(!r)return[];const a=new Map;return e.newestOnTop&&r.reverse(),r.forEach(i=>{const{position:l}=i.props;a.has(l)||a.set(l,[]),a.get(l).push(i)}),Array.from(a,i=>o(i[0],i[1]))},isToastActive:Vu,count:r?.length}}function Q6(e){const[t,n]=b.useState(!1),[s,r]=b.useState(!1),o=b.useRef(null),a=b.useRef({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:i,pauseOnHover:l,closeToast:u,onClick:d,closeOnClick:h}=e;var f,p;function g(){n(!0)}function m(){n(!1)}function y(C){const E=o.current;a.canDrag&&E&&(a.didMove=!0,t&&m(),a.delta=e.draggableDirection==="x"?C.clientX-a.start:C.clientY-a.start,a.start!==C.clientX&&(a.canCloseOnClick=!1),E.style.transform=`translate3d(${e.draggableDirection==="x"?`${a.delta}px, var(--y)`:`0, calc(${a.delta}px + var(--y))`},0)`,E.style.opacity=""+(1-Math.abs(a.delta/a.removalDistance)))}function v(){document.removeEventListener("pointermove",y),document.removeEventListener("pointerup",v);const C=o.current;if(a.canDrag&&a.didMove&&C){if(a.canDrag=!1,Math.abs(a.delta)>a.removalDistance)return r(!0),e.closeToast(),void e.collapseAll();C.style.transition="transform 0.2s, opacity 0.2s",C.style.removeProperty("transform"),C.style.removeProperty("opacity")}}(p=pe.get((f={id:e.toastId,containerId:e.containerId,fn:n}).containerId||1))==null||p.setToggle(f.id,f.fn),b.useEffect(()=>{if(e.pauseOnFocusLoss)return document.hasFocus()||m(),window.addEventListener("focus",g),window.addEventListener("blur",m),()=>{window.removeEventListener("focus",g),window.removeEventListener("blur",m)}},[e.pauseOnFocusLoss]);const x={onPointerDown:function(C){if(e.draggable===!0||e.draggable===C.pointerType){a.didMove=!1,document.addEventListener("pointermove",y),document.addEventListener("pointerup",v);const E=o.current;a.canCloseOnClick=!0,a.canDrag=!0,E.style.transition="none",e.draggableDirection==="x"?(a.start=C.clientX,a.removalDistance=E.offsetWidth*(e.draggablePercent/100)):(a.start=C.clientY,a.removalDistance=E.offsetHeight*(e.draggablePercent===80?1.5*e.draggablePercent:e.draggablePercent)/100)}},onPointerUp:function(C){const{top:E,bottom:w,left:j,right:S}=o.current.getBoundingClientRect();C.nativeEvent.type!=="touchend"&&e.pauseOnHover&&C.clientX>=j&&C.clientX<=S&&C.clientY>=E&&C.clientY<=w?m():g()}};return i&&l&&(x.onMouseEnter=m,e.stacked||(x.onMouseLeave=g)),h&&(x.onClick=C=>{d&&d(C),a.canCloseOnClick&&u()}),{playToast:g,pauseToast:m,isRunning:t,preventExitTransition:s,toastRef:o,eventHandlers:x}}function Y6(e){let{delay:t,isRunning:n,closeToast:s,type:r="default",hide:o,className:a,style:i,controlledProgress:l,progress:u,rtl:d,isIn:h,theme:f}=e;const p=o||l&&u===0,g={...i,animationDuration:`${t}ms`,animationPlayState:n?"running":"paused"};l&&(g.transform=`scaleX(${u})`);const m=We("Toastify__progress-bar",l?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${f}`,`Toastify__progress-bar--${r}`,{"Toastify__progress-bar--rtl":d}),y=ye(a)?a({rtl:d,type:r,defaultClassName:m}):We(m,a),v={[l&&u>=1?"onTransitionEnd":"onAnimationEnd"]:l&&u<1?null:()=>{h&&s()}};return Y.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":p},Y.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${f} Toastify__progress-bar--${r}`}),Y.createElement("div",{role:"progressbar","aria-hidden":p?"true":"false","aria-label":"notification timer",className:y,style:g,...v}))}let K6=1;const Hu=()=>""+K6++;function X6(e){return e&&(rt(e.toastId)||mn(e.toastId))?e.toastId:Hu()}function zt(e,t){return Bu(e,t),t.toastId}function gr(e,t){return{...t,type:t&&t.type||e,toastId:X6(t)}}function Vn(e){return(t,n)=>zt(t,gr(e,n))}function X(e,t){return zt(e,gr("default",t))}X.loading=(e,t)=>zt(e,gr("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...t})),X.promise=function(e,t,n){let s,{pending:r,error:o,success:a}=t;r&&(s=rt(r)?X.loading(r,n):X.loading(r.render,{...n,...r}));const i={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},l=(d,h,f)=>{if(h==null)return void X.dismiss(s);const p={type:d,...i,...n,data:f},g=rt(h)?{render:h}:h;return s?X.update(s,{...p,...g}):X(g.render,{...p,...g}),f},u=ye(e)?e():e;return u.then(d=>l("success",a,d)).catch(d=>l("error",o,d)),u},X.success=Vn("success"),X.info=Vn("info"),X.error=Vn("error"),X.warning=Vn("warning"),X.warn=X.warning,X.dark=(e,t)=>zt(e,gr("default",{theme:"dark",...t})),X.dismiss=function(e){(function(t){var n;if(Uu()){if(t==null||rt(n=t)||mn(n))pe.forEach(s=>{s.removeToast(t)});else if(t&&("containerId"in t||"id"in t)){const s=pe.get(t.containerId);s?s.removeToast(t.id):pe.forEach(r=>{r.removeToast(t.id)})}}else gn=gn.filter(s=>t!=null&&s.options.toastId!==t)})(e)},X.clearWaitingQueue=function(e){e===void 0&&(e={}),pe.forEach(t=>{!t.props.limit||e.containerId&&t.id!==e.containerId||t.clearQueue()})},X.isActive=Vu,X.update=function(e,t){t===void 0&&(t={});const n=((s,r)=>{var o;let{containerId:a}=r;return(o=pe.get(a||1))==null?void 0:o.toasts.get(s)})(e,t);if(n){const{props:s,content:r}=n,o={delay:100,...s,...t,toastId:t.toastId||e,updateId:Hu()};o.toastId!==e&&(o.staleId=e);const a=o.render||r;delete o.render,zt(a,o)}},X.done=e=>{X.update(e,{progress:1})},X.onChange=function(e){return Qs.add(e),()=>{Qs.delete(e)}},X.play=e=>Ti(!0,e),X.pause=e=>Ti(!1,e);const J6=typeof window<"u"?b.useLayoutEffect:b.useEffect,Bn=e=>{let{theme:t,type:n,isLoading:s,...r}=e;return Y.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:t==="colored"?"currentColor":`var(--toastify-icon-color-${n})`,...r})},ss={info:function(e){return Y.createElement(Bn,{...e},Y.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(e){return Y.createElement(Bn,{...e},Y.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(e){return Y.createElement(Bn,{...e},Y.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(e){return Y.createElement(Bn,{...e},Y.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return Y.createElement("div",{className:"Toastify__spinner"})}},Z6=e=>{const{isRunning:t,preventExitTransition:n,toastRef:s,eventHandlers:r,playToast:o}=Q6(e),{closeButton:a,children:i,autoClose:l,onClick:u,type:d,hideProgressBar:h,closeToast:f,transition:p,position:g,className:m,style:y,bodyClassName:v,bodyStyle:x,progressClassName:C,progressStyle:E,updateId:w,role:j,progress:S,rtl:P,toastId:N,deleteToast:T,isIn:I,isLoading:D,closeOnClick:R,theme:F}=e,$=We("Toastify__toast",`Toastify__toast-theme--${F}`,`Toastify__toast--${d}`,{"Toastify__toast--rtl":P},{"Toastify__toast--close-on-click":R}),V=ye(m)?m({rtl:P,position:g,type:d,defaultClassName:$}):We($,m),W=(function(se){let{theme:U,type:A,isLoading:B,icon:te}=se,ne=null;const H={theme:U,type:A};return te===!1||(ye(te)?ne=te({...H,isLoading:B}):b.isValidElement(te)?ne=b.cloneElement(te,H):B?ne=ss.spinner():(oe=>oe in ss)(A)&&(ne=ss[A](H))),ne})(e),q=!!S||!l,Z={closeToast:f,type:d,theme:F};let ee=null;return a===!1||(ee=ye(a)?a(Z):b.isValidElement(a)?b.cloneElement(a,Z):(function(se){let{closeToast:U,theme:A,ariaLabel:B="close"}=se;return Y.createElement("button",{className:`Toastify__close-button Toastify__close-button--${A}`,type:"button",onClick:te=>{te.stopPropagation(),U(te)},"aria-label":B},Y.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},Y.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))})(Z)),Y.createElement(p,{isIn:I,done:T,position:g,preventExitTransition:n,nodeRef:s,playToast:o},Y.createElement("div",{id:N,onClick:u,"data-in":I,className:V,...r,style:y,ref:s},Y.createElement("div",{...I&&{role:j},className:ye(v)?v({type:d}):We("Toastify__toast-body",v),style:x},W!=null&&Y.createElement("div",{className:We("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!D})},W),Y.createElement("div",null,i)),ee,Y.createElement(Y6,{...w&&!q?{key:`pb-${w}`}:{},rtl:P,theme:F,delay:l,isRunning:t,isIn:I,closeToast:f,hide:h,type:d,style:E,className:C,controlledProgress:q,progress:S||0})))},kr=function(e,t){return t===void 0&&(t=!1),{enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:t}},ew=Dr(kr("bounce",!0));Dr(kr("slide",!0));Dr(kr("zoom"));Dr(kr("flip"));const tw={position:"top-right",transition:ew,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};function nw(e){let t={...tw,...e};const n=e.stacked,[s,r]=b.useState(!0),o=b.useRef(null),{getToastToRender:a,isToastActive:i,count:l}=G6(t),{className:u,style:d,rtl:h,containerId:f}=t;function p(m){const y=We("Toastify__toast-container",`Toastify__toast-container--${m}`,{"Toastify__toast-container--rtl":h});return ye(u)?u({position:m,rtl:h,defaultClassName:y}):We(y,Jn(u))}function g(){n&&(r(!0),X.play())}return J6(()=>{if(n){var m;const y=o.current.querySelectorAll('[data-in="true"]'),v=12,x=(m=t.position)==null?void 0:m.includes("top");let C=0,E=0;Array.from(y).reverse().forEach((w,j)=>{const S=w;S.classList.add("Toastify__toast--stacked"),j>0&&(S.dataset.collapsed=`${s}`),S.dataset.pos||(S.dataset.pos=x?"top":"bot");const P=C*(s?.2:1)+(s?0:v*j);S.style.setProperty("--y",`${x?P:-1*P}px`),S.style.setProperty("--g",`${v}`),S.style.setProperty("--s",""+(1-(s?E:0))),C+=S.offsetHeight,E+=.025})}},[s,l,n]),Y.createElement("div",{ref:o,className:"Toastify",id:f,onMouseEnter:()=>{n&&(r(!1),X.pause())},onMouseLeave:g},a((m,y)=>{const v=y.length?{...d}:{...d,pointerEvents:"none"};return Y.createElement("div",{className:p(m),style:v,key:`container-${m}`},y.map(x=>{let{content:C,props:E}=x;return Y.createElement(Z6,{...E,stacked:n,collapseAll:g,isIn:i(E.toastId,E.containerId),style:E.style,key:`toast-${E.key}`},C)}))}))}function rw(e){return e==="connect-success"||e==="connect-warning"||e==="connect-loading"||e==="connect-deleted"}function sw(e){if(rw(e)){const t={};switch(e){case"connect-success":t.type="success",t.icon=c.jsx(O,{className:"text-green-800",name:"CheckCircleFill",size:24});break;case"connect-warning":t.type="warning",t.icon=c.jsx(O,{className:"text-gray-600",name:"WarningFill",size:24});break;case"connect-loading":t.type="default",t.icon=c.jsx(O,{className:"text-gray-600",name:"ClockFill",size:24});break;case"connect-deleted":t.type="error",t.icon=c.jsx(O,{className:"text-red-800",name:"TrashFill",size:24});break}return t}return{type:e}}function Qw(e,t){const{type:n="default",...s}=t||{},r=sw(n);return X(e,{...r,...s})}const ow=({closeToast:e})=>c.jsx("button",{className:"flex items-center text-gray-500 hover:text-gray-600",onClick:e,children:c.jsx(O,{name:"XmarkLight",size:16})}),Yw=e=>c.jsx(nw,{closeButton:ow,...e}),Di=Ev({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},blockTime:12e3,rpcUrls:{default:{http:["https://eth.merkle.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensUniversalResolver:{address:"0xeeeeeeee14d718c2b47d9923deab1335e144eeee",blockCreated:23085558},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),aw=rx({chains:[Di],transports:{[Di.id]:kv()}}),iw=new Rx;function Kw(e){const{children:t,wagmiProviderProps:n,queryClientProviderProps:s}=e,{config:r=aw,...o}=n??{},{client:a=iw,...i}=s??{};return c.jsx(ax,{config:r,...o,children:c.jsx(Vx,{client:a,...i,children:t})})}export{J0 as A,xw as B,ff as C,jw as D,_w as E,Ow as F,Uw as G,Tw as H,Vw as I,Bw as J,Hw as K,Fw as L,E5 as M,N5 as N,O5 as O,df as P,I5 as Q,lf as R,A6 as S,uf as T,Kw as W,cf as a,Q0 as b,Gw as c,Yw as d,Cw as e,Sw as f,Pw as g,Ww as h,y6 as i,el as j,Iw as k,Mw as l,S5 as m,qw as n,Dw as o,fo as p,$w as q,kw as r,ww as s,Qw as t,vw as u,Pn as v,Rw as w,Aw as x,Lw as y,zw as z};
47
+ color: hsl(${Math.max(0,Math.min(120-120*y,120))}deg 100% 31%);`,n?.key)}return(u=n?.onChange)==null||u.call(n,r),r}return o.updateDeps=a=>{s=a},o}function Pi(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const i6=(e,t)=>Math.abs(e-t)<1.01,c6=(e,t,n)=>{let s;return function(...r){e.clearTimeout(s),s=e.setTimeout(()=>t.apply(this,r),n)}},Ni=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},l6=e=>e,u6=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),s=[];for(let r=t;r<=n;r++)s.push(r);return s},d6=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=e.targetWindow;if(!s)return;const r=a=>{const{width:i,height:l}=a;t({width:Math.round(i),height:Math.round(l)})};if(r(Ni(n)),!s.ResizeObserver)return()=>{};const o=new s.ResizeObserver(a=>{const i=()=>{const l=a[0];if(l?.borderBoxSize){const u=l.borderBoxSize[0];if(u){r({width:u.inlineSize,height:u.blockSize});return}}r(Ni(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()});return o.observe(n,{box:"border-box"}),()=>{o.unobserve(n)}},Ei={passive:!0},Oi=typeof window>"u"?!0:"onscrollend"in window,f6=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=e.targetWindow;if(!s)return;let r=0;const o=e.options.useScrollendEvent&&Oi?()=>{}:c6(s,()=>{t(r,!1)},e.options.isScrollingResetDelay),a=d=>()=>{const{horizontal:h,isRtl:f}=e.options;r=h?n.scrollLeft*(f&&-1||1):n.scrollTop,o(),t(r,d)},i=a(!0),l=a(!1);l(),n.addEventListener("scroll",i,Ei);const u=e.options.useScrollendEvent&&Oi;return u&&n.addEventListener("scrollend",l,Ei),()=>{n.removeEventListener("scroll",i),u&&n.removeEventListener("scrollend",l)}},h6=(e,t,n)=>{if(t?.borderBoxSize){const s=t.borderBoxSize[0];if(s)return Math.round(s[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},p6=(e,{adjustments:t=0,behavior:n},s)=>{var r,o;const a=e+t;(o=(r=s.scrollElement)==null?void 0:r.scrollTo)==null||o.call(r,{[s.options.horizontal?"left":"top"]:a,behavior:n})};class m6{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const s=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(r=>{r.forEach(o=>{const a=()=>{this._measureElement(o.target,o)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var r;(r=s())==null||r.disconnect(),n=null},observe:r=>{var o;return(o=s())==null?void 0:o.observe(r,{box:"border-box"})},unobserve:r=>{var o;return(o=s())==null?void 0:o.unobserve(r)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([s,r])=>{typeof r>"u"&&delete n[s]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:l6,rangeExtractor:u6,onChange:()=>{},measureElement:h6,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var s,r;(r=(s=this.options).onChange)==null||r.call(s,this,n)},this.maybeNotify=pt(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(r=>{this.observer.observe(r)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,r=>{this.scrollRect=r,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(r,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<r?"forward":"backward":null,this.scrollOffset=r,this.isScrolling=o,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,s)=>{const r=new Map,o=new Map;for(let a=s-1;a>=0;a--){const i=n[a];if(r.has(i.lane))continue;const l=o.get(i.lane);if(l==null||i.end>l.end?o.set(i.lane,i):i.end<l.end&&r.set(i.lane,!0),r.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((a,i)=>a.end===i.end?a.index-i.index:a.end-i.end)[0]:void 0},this.getMeasurementOptions=pt(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(n,s,r,o,a)=>(this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:s,scrollMargin:r,getItemKey:o,enabled:a}),{key:!1}),this.getMeasurements=pt(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:s,scrollMargin:r,getItemKey:o,enabled:a},i)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(d=>{this.itemSizeCache.set(d.key,d.size)}));const l=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const u=this.measurementsCache.slice(0,l);for(let d=l;d<n;d++){const h=o(d),f=this.options.lanes===1?u[d-1]:this.getFurthestMeasurement(u,d),p=f?f.end+this.options.gap:s+r,g=i.get(h),m=typeof g=="number"?g:this.options.estimateSize(d),y=p+m,v=f?f.lane:d%this.options.lanes;u[d]={index:d,start:p,size:m,end:y,key:h,lane:v}}return this.measurementsCache=u,u},{key:!1,debug:()=>this.options.debug}),this.calculateRange=pt(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,s,r,o)=>this.range=n.length>0&&s>0?g6({measurements:n,outerSize:s,scrollOffset:r,lanes:o}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=pt(()=>{let n=null,s=null;const r=this.calculateRange();return r&&(n=r.startIndex,s=r.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,s]},(n,s,r,o,a)=>o===null||a===null?[]:n({startIndex:o,endIndex:a,overscan:s,count:r}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const s=this.options.indexAttribute,r=n.getAttribute(s);return r?parseInt(r,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this._measureElement=(n,s)=>{const r=this.indexFromElement(n),o=this.measurementsCache[r];if(!o)return;const a=o.key,i=this.elementsCache.get(a);i!==n&&(i&&this.observer.unobserve(i),this.observer.observe(n),this.elementsCache.set(a,n)),n.isConnected&&this.resizeItem(r,this.options.measureElement(n,s,this))},this.resizeItem=(n,s)=>{const r=this.measurementsCache[n];if(!r)return;const o=this.itemSizeCache.get(r.key)??r.size,a=s-o;a!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(r,a,this):r.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(r.index),this.itemSizeCache=new Map(this.itemSizeCache.set(r.key,s)),this.notify(!1))},this.measureElement=n=>{if(!n){this.elementsCache.forEach((s,r)=>{s.isConnected||(this.observer.unobserve(s),this.elementsCache.delete(r))});return}this._measureElement(n,void 0)},this.getVirtualItems=pt(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,s)=>{const r=[];for(let o=0,a=n.length;o<a;o++){const i=n[o],l=s[i];r.push(l)}return r},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const s=this.getMeasurements();if(s.length!==0)return Pi(s[_u(0,s.length-1,r=>Pi(s[r]).start,n)])},this.getOffsetForAlignment=(n,s,r=0)=>{const o=this.getSize(),a=this.getScrollOffset();s==="auto"&&(s=n>=a+o?"end":"start"),s==="center"?n+=(r-o)/2:s==="end"&&(n-=o);const i=this.getTotalSize()+this.options.scrollMargin-o;return Math.max(Math.min(i,n),0)},this.getOffsetForIndex=(n,s="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const r=this.measurementsCache[n];if(!r)return;const o=this.getSize(),a=this.getScrollOffset();if(s==="auto")if(r.end>=a+o-this.options.scrollPaddingEnd)s="end";else if(r.start<=a+this.options.scrollPaddingStart)s="start";else return[a,s];const i=s==="end"?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,s,r.size),s]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(n,{align:s="start",behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,s),{adjustments:void 0,behavior:r})},this.scrollToIndex=(n,{align:s="auto",behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),n=Math.max(0,Math.min(n,this.options.count-1));let o=0;const a=10,i=u=>{if(!this.targetWindow)return;const d=this.getOffsetForIndex(n,u);if(!d){console.warn("Failed to get offset for index:",n);return}const[h,f]=d;this._scrollToOffset(h,{adjustments:void 0,behavior:r}),this.targetWindow.requestAnimationFrame(()=>{const p=this.getScrollOffset(),g=this.getOffsetForIndex(n,f);if(!g){console.warn("Failed to get offset for index:",n);return}i6(g[0],p)||l(f)})},l=u=>{this.targetWindow&&(o++,o<a?this.targetWindow.requestAnimationFrame(()=>i(u)):console.warn(`Failed to scroll to index ${n} after ${a} attempts.`))};i(s)},this.scrollBy=(n,{behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:s})},this.getTotalSize=()=>{var n;const s=this.getMeasurements();let r;if(s.length===0)r=this.options.paddingStart;else if(this.options.lanes===1)r=((n=s[s.length-1])==null?void 0:n.end)??0;else{const o=Array(this.options.lanes).fill(null);let a=s.length-1;for(;a>=0&&o.some(i=>i===null);){const i=s[a];o[i.lane]===null&&(o[i.lane]=i.end),a--}r=Math.max(...o.filter(i=>i!==null))}return Math.max(r-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:s,behavior:r})=>{this.options.scrollToFn(n,{behavior:r,adjustments:s},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(t)}}const _u=(e,t,n,s)=>{for(;e<=t;){const r=(e+t)/2|0,o=n(r);if(o<s)e=r+1;else if(o>s)t=r-1;else return r}return e>0?e-1:0};function g6({measurements:e,outerSize:t,scrollOffset:n,lanes:s}){const r=e.length-1,o=l=>e[l].start;if(e.length<=s)return{startIndex:0,endIndex:r};let a=_u(0,r,o,n),i=a;if(s===1)for(;i<r&&e[i].end<n+t;)i++;else if(s>1){const l=Array(s).fill(0);for(;i<r&&l.some(d=>d<n+t);){const d=e[i];l[d.lane]=d.end,i++}const u=Array(s).fill(n+t);for(;a>=0&&u.some(d=>d>=n);){const d=e[a];u[d.lane]=d.start,a--}a=Math.max(0,a-a%s),i=Math.min(r,i+(s-1-i%s))}return{startIndex:a,endIndex:i}}const Ii=typeof document<"u"?b.useLayoutEffect:b.useEffect;function b6(e){const t=b.useReducer(()=>({}),{})[1],n={...e,onChange:(r,o)=>{var a;o?Ri.flushSync(t):t(),(a=e.onChange)==null||a.call(e,r,o)}},[s]=b.useState(()=>new m6(n));return s.setOptions(n),Ii(()=>s._didMount(),[]),Ii(()=>s._willUpdate()),s}function y6(e){return b6({observeElementRect:d6,observeElementOffset:f6,scrollToFn:p6,...e})}function v6(e){return`${e.slice(0,7)}...${e.slice(-5)}`}function x6(e){const{address:t,chainId:n}=e,[,s]=wr();if(!t)return null;const r=v6(t);function o(i){return()=>{s(i).catch(l=>{console.error("Failed to copy!",l)})}}const a=c.jsxs("button",{className:"flex items-center gap-1",onClick:o(t),children:[t,c.jsx(O,{className:"inline-block text-gray-600",name:"FilesEarmark",size:16})]});return c.jsx(Ve,{content:a,children:c.jsxs("span",{className:"flex w-fit cursor-pointer items-center gap-1 rounded-lg bg-gray-100 p-1 text-xs text-slate-100",children:[c.jsx(Mu,{address:t,chainId:n}),r]})})}function w6(e){const{errors:t}=e,n=!!t?.length,s=n?"text-red-800":"text-green-700",r=n?c.jsx(O,{name:"Exclamation",size:16}):c.jsx(O,{name:"Check",size:16}),o=n?`Error: ${t[0]}`:"No errors",a=c.jsxs("span",{className:M("flex w-fit items-center rounded-lg border border-gray-200 px-2 py-1 text-xs",s,n&&"cursor-pointer"),children:[r,c.jsx("span",{className:M("inline-block max-w-36 truncate"),children:o})]}),i=t?.map((l,u)=>c.jsxs("p",{className:"text-red-800",children:["Error: ",l]},u));return n?c.jsx(Ve,{content:i,children:a}):a}function C6(e){const{operationType:t,operationInput:n}=e,s=c.jsx("code",{children:c.jsx("pre",{children:JSON.stringify(n,null,2)})});return c.jsx(Ve,{content:s,children:c.jsxs("span",{className:"flex cursor-pointer items-center gap-2 text-xs",children:[t,c.jsx(O,{className:"text-gray-300",name:"Braces",size:16})]})})}function S6(e){const{operationIndex:t,eventId:n,stateHash:s}=e,[,r]=wr(),o=t+1,a=c.jsxs("button",{className:"flex items-center gap-1",onClick:i(s),children:["Revision ",o," - Event ID: ",n," - State Hash: ",s,c.jsx(O,{className:"inline-block text-gray-600",name:"FilesEarmark",size:16})]});function i(l){return()=>{r(l).catch(u=>{console.error("Failed to copy!",u)})}}return c.jsx(Ve,{content:a,children:c.jsxs("span",{className:"flex cursor-pointer items-center gap-2 text-xs text-gray-600",children:["Revision ",o,".",c.jsx("a",{children:c.jsx(O,{className:"cursor-pointer text-slate-100",name:"Ellipsis",size:14})})]})})}function j6(e){const{signatures:t}=e;if(!t?.length)return null;const n=c.jsxs("div",{className:"text-xs text-slate-300",children:[c.jsx("h3",{className:"mb-2",children:"Signature details:"}),t.map((s,r)=>c.jsxs("div",{className:"mb-2 last:mb-0",children:[c.jsxs("h4",{children:["Signature #",r+1," -"," ",s.isVerified?"verified":"unverified"]}),c.jsx("code",{children:c.jsx("pre",{children:JSON.stringify(s,null,2)})})]},s.hash))]});return c.jsx(Ve,{content:n,children:c.jsxs("span",{className:"flex w-fit cursor-pointer items-center gap-1 rounded-lg border border-gray-200 px-2 py-1",children:[c.jsx(P6,{signatures:t})," ",c.jsx(O,{className:"text-gray-300",name:"InfoSquare",size:16})]})})}function P6(e){const{signatures:t}=e;if(!t?.length)return null;const n=t.length,s=t.filter(i=>i.isVerified).length,o=`${s}/${n} ${n===1?"signature":"signatures"} verified`,a=s===0?"text-red-800":s===n?"text-green-700":"text-orange-700";return c.jsx("span",{className:`text-xs ${a}`,children:o})}function N6(e){const{timestampUtcMs:t}=e,n=typeof t=="string"&&!t.includes("-")?parseInt(t):t,s=new Date(n),r=tr(s,"HH:mm 'UTC'"),o=tr(s,"eee, dd MMM yyyy HH:mm:ss 'UTC'"),a=c.jsx("div",{children:o});return c.jsx(Ve,{content:a,children:c.jsxs("span",{className:"cursor-pointer text-xs",children:["committed at ",r]})})}function E6(e){return c.jsxs("article",{className:"flex items-center justify-between rounded-xl border border-gray-200 bg-white px-4 py-2",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(S6,{...e}),c.jsx(C6,{...e}),c.jsx(x6,{...e}),c.jsx(N6,{...e})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(j6,{...e}),c.jsx(w6,{...e})]})]})}const O6=b.memo(E6);function I6(e){const{operationIndex:t,skipCount:n}=e,s=t,r=n===1?`${s}`:`${s} - ${s+1-n}`;return c.jsxs("article",{className:"grid grid-cols-[1fr,auto,1fr] items-center py-2",children:[c.jsx("div",{className:"h-px rounded-full bg-slate-100"}),c.jsxs("div",{className:"mx-3 text-xs text-slate-100",children:["[Skipped Revision ",r,"]"]}),c.jsx("div",{className:"h-px rounded-full bg-slate-100"})]})}function M6(e){const t=[],n=new Set;for(const s of e){if(!s.timestampUtcMs)continue;const r=s.timestampUtcMs.split("T")[0];n.has(r)||(n.add(r),t.push({type:"day",height:32,timestampUtcMs:r})),t.push({type:"revision",height:46,operationIndex:s.index,eventId:s.id??"EVENT_ID_NOT_FOUND",stateHash:s.hash,operationType:s.action.type,operationInput:s.action.input??{},address:s.action?.context?.signer?.user.address,chainId:s.action?.context?.signer?.user.chainId,timestampUtcMs:s.timestampUtcMs,signatures:D6(s.action?.context?.signer?.signatures??[]),errors:s.error?[s.error]:void 0}),s.skip>0&&t.push({type:"skip",height:34,operationIndex:s.index,skipCount:s.skip,timestampUtcMs:s.timestampUtcMs})}return t}function T6(e){const[t,n,s,r]=e;return{signerAddress:t,hash:n,prevStateHash:s,signatureBytes:r,isVerified:!0}}function D6(e){return e?.map(T6)}function k6(e){const{timestampUtcMs:t}=e,n=tr(t,"MMM dd, yyyy");return c.jsxs("h2",{className:"-ml-6 flex items-center gap-1 bg-slate-50 py-2 text-xs text-slate-100",children:[c.jsx(O,{name:"Ring",size:16})," Changes on ",n]})}function R6(e){const{localOperations:t,globalOperations:n,scope:s}=e,r=s==="local"?t:n,o=100,a=b.useMemo(()=>M6(r),[r]),[i,l]=b.useState(0),[u,d]=b.useState(o),[h,f]=b.useState(()=>a.slice(0,u)),p=b.useRef(null),g=h.length<a.length,m=y6({count:h.length,getScrollElement:()=>p.current,estimateSize:v=>a[v].height,gap:8});b.useEffect(()=>{if(!g)return;const v=Math.floor(i/46),x=o+v;d(C=>x>C?x:C)},[i,g]),b.useEffect(()=>{f(a.slice(0,u))},[a,u]);const y=v=>{l(x=>{const C=x+v.deltaY;return C<0?0:C})};return b.useEffect(()=>(window.addEventListener("wheel",y),()=>{window.removeEventListener("wheel",y)}),[]),c.jsx("div",{className:"border-l border-slate-100",ref:p,style:{height:`${m.getTotalSize()}px`,width:"100%",position:"relative"},children:m.getVirtualItems().map(v=>{const x=h[v.index];return c.jsxs("div",{style:{position:"absolute",top:0,left:16,width:"100%",height:`${v.size}px`,transform:`translateY(${v.start}px)`},children:[x.type==="revision"&&b.createElement(O6,{...x,key:v.key}),x.type==="skip"&&c.jsx(I6,{...x},v.key),x.type==="day"&&c.jsx(k6,{...x},v.key)]},v.index)})})}function Ww(e){const{documentTitle:t,documentId:n,globalOperations:s,localOperations:r,onClose:o,itemsPerPage:a=100,documentState:i,onCopyState:l}=e,[u,d]=b.useState("global"),h=b.useMemo(()=>Dd(kd(u==="global"?s:r)).sort((T,I)=>I.index-T.index),[s,r,u]),{pageItems:f,pages:p,goToPage:g,goToNextPage:m,goToPreviousPage:y,goToFirstPage:v,goToLastPage:x,hiddenNextPages:C,isNextPageAvailable:N,isPreviousPageAvailable:w}=jd(h,{itemsPerPage:a});function j(E){v(),d(E)}const P=h.length>a?c.jsx("div",{className:"mt-4 flex w-full justify-end",children:c.jsx(Pd,{firstPageLabel:"First Page",goToFirstPage:v,goToLastPage:x,goToNextPage:m,goToPage:g,goToPreviousPage:y,hiddenNextPages:C,isNextPageAvailable:N,isPreviousPageAvailable:w,lastPageLabel:"Last Page",nextPageLabel:"Next",pages:p,previousPageLabel:"Previous"})}):c.jsx("hr",{className:"h-12 border-none"});return c.jsxs(ul,{children:[c.jsx(a6,{docId:n,onChangeScope:j,onClose:o,scope:u,title:t,documentState:i,onCopyState:l}),P,c.jsx("div",{className:"mt-4 flex justify-center rounded-md bg-slate-50 p-4",children:h.length>0?c.jsx("div",{className:"grid grid-cols-[minmax(min-content,1018px)]",children:c.jsx(R6,{globalOperations:u==="global"?f:[],localOperations:u==="local"?f:[],scope:u})}):c.jsx("h3",{className:"my-40 text-gray-600",children:"This document has no recorded operations yet."})}),P]})}const A6=function(t){const{icon:n,title:s,description:r,containerClassName:o,active:a,onClick:i}=t;return c.jsx(Ve,{content:s,side:"right",sideOffset:12,className:"border-none bg-gray-800 px-3 py-2 text-sm text-white",children:c.jsxs("div",{className:M("group/sidebar-item relative flex cursor-pointer flex-col items-center justify-center text-center text-sm text-black",o,a&&"bg-white",i&&"cursor-pointer"),onClick:i,children:[a?c.jsx("div",{className:"absolute left-0 top-1/2 h-10 w-1 -translate-y-1/2 rounded-r-sm bg-violet-400"}):c.jsx("div",{className:"absolute left-0 top-1/2 h-6 w-1 -translate-y-1/2 rounded-r-sm bg-zinc-300 opacity-0 transition-opacity group-hover/sidebar-item:opacity-100"}),c.jsx("div",{className:"mx-auto py-4",children:n||c.jsx("div",{className:"flex size-8 items-center justify-center rounded-lg bg-black",children:c.jsx("span",{className:"text-sm font-medium text-white",children:s.slice(0,1).toUpperCase()})})})]})})},qw=function(t){const{containerClassName:n,onClick:s}=t;return c.jsx(A6,{title:"Create New Drive",icon:c.jsx(O,{name:"PlusSquare",size:32}),onClick:s,containerClassName:n})},L6=({onLogin:e})=>{const[t,n]=b.useState(!1),s=!t&&!!e,r=t?c.jsx(O,{name:"Reload",size:14,className:"animate-spin"}):c.jsx("span",{children:"Connect"}),o=()=>{e&&(n(!0),e())};return c.jsxs("div",{className:"p-4",children:[c.jsx("div",{className:"mb-4 flex justify-center",children:c.jsx("div",{className:"flex h-[22px] w-[83px] items-center justify-center overflow-hidden",children:c.jsx(O,{name:"RenownLight",size:83})})}),c.jsx("button",{onClick:s?o:void 0,className:M("mt-4 flex h-7 w-full cursor-pointer items-center justify-center rounded-lg border border-gray-300 bg-transparent text-sm active:opacity-70",s?"cursor-pointer":"cursor-wait"),type:"button",children:r})]})},F6=new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAACQCAYAAADnRuK4AAAACXBIWXMAACxLAAAsSwGlPZapAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAtmSURBVHgB7Z3dbtvmGcefl5LsqHYCq0C6tEUCZ0kDzAFqd0NTYAmweAfr0YD0CrpeQboriH0H6RUsu4ChAYodtCdJD3LQBGttILEBJ4tdJ2uzBoi0yIpsi+S790+ZDkmREilSHySfX6FKpkgliH5+nuf9pKAEkFLO1Bu7VzRNzEuiWfXzglDHSIgZYsYC9b1sCaEeJFZMU66WCnS7XC5vUUwE9Qmk2dndvar+ZpetB5NCxIr6Hr+II1NkgQ7FMeTnHGGygxLhRkGj5agiRRKo3mxeY3EyjkZLR8vl5bCnhxKo2WzOGqb4UpJcCDpH1T+E/wpKY+3gU4XoO0MyCaKyhvVsqifTNNWzVM8y8Hz1rW2pr3ExTDTq+Q3vNPc/lYZ+3S/qwI+iVlDSCJYlZcgDiVqGQdLXJVGTJD47NjV5s9vndP3W6429a8rZpY6LIE6hoB4aMenHMMxgkXqktECBguSBNHhwxMkWiEgt3SRDpbgOukjka8HLxt4VQeaX3uOlIkedrKPr7WjkRWiFv0yXJ/7ecdx7AAWzbsgfnDUPgs1EsWgVykz2QTTaa+melCZqRU1+4C2sO8KJSoe3vAXzZInlyRMoTxAw3MgZXbXEvee6BELdg6EI5zGkLa538gcCRkk1lNzIhXqjseQ8cmiGlbpM2nS+WdA0migViMkvKKx1V00kavr+5OlKRdTw02EEUqnrmvNCBJ1SkQvmvFMsauROQHKmOPHqc/sn6y2/6MMtLsams2X2OgpZhrQM92h6u6OQ5WHadItCliWqSL7quqDAdQ/jpqB5nBDaH6wnv/R1ZKLILS/GBbqEdvdarmP6/pGK5k1f1qg6y8N4gBHevsBSafeKOuSeoqGxPEwAXjcwvUfVQGLedZLGxTPjj9cNKWhWw/9cJ3EAYgLwuqHaZvM4Nus+zAYxAXSkMDGj9TiHYQ7pVEP1BxEzFL6+9T3tvGrS4u/fpzcrRykrcMU8BLb/85yePa/STmOX1h49oSzBAg2BJ0qgw9dPn1OWYIEGzH5LtyKQ8+dnv1QpK7BAA2ZbRRxI42T1wSZlBRZowKw/2u44hnpov9WiLMACDRCI8qK64/ve2sZTygIs0ABZvf848L31je1MRCEWaEA82vxZRaBa4Puoi1bvp78WYoEGxOra457nrD18kvoWGQs0AFYfPLY6DcOdm+4oxAIlzE6jSSsRpEChvbaR3t5pFihBUBR/fft7isq9lY3UpjIWKEHufLceOnV1XHtvzYpeaYMFSgjUPds/9T/OBfEQvdLWtGeBEgDyrCRQDFsS3UqXRCxQTJKSx+ZFbSdVErFAMbi38jBReWwg0Vff3E1FTcQC9YHV2lJRYm1jmwaFXRONu0Si3mi69qEqT5aICQb9NnfurvXd2uqHhfO/pvnzp2kcaHpWp7JAIUHUWX2wNdCo0403Z6Zp8eL7ND1VplHCAvXBuuopXlHFsndi2Cg4O/u2FY1GJRILFBJEnEebz2j94fZQ01UYpqeO0InjlZGIxAL1ADUOJsFjOsY4RJxenHr3OJ05/Tadeuc4DQMWKAC0dtqtnvGKNmGZKBXp4oU5S6hB4hWIm/EHoO8lrfIAa/XHT8NfMsQCHXDirYqqK9J7FytEoLmzp2jYcArzgCiEqRWYUTjuEQnSWPWPSlsoqocB10ARwIJATH7vNrd5FECc35w7SXPnTlmvhwkL1AdokY1DRBqlODYsUAzQmTiqOcwnVTP90kdzIxPHhgWKSXuQ819Di0YQ5sMPzlk90OMAC5QQd1c2rCGOQYIe548v/856Hhe8AvEGU31yYeGcFR0GldLQpbB4aX7kKasXLFAMMM0CJC3RGZWuLqle5TQwcoGGUUsMMgUkLVGa5AEjF+gf/7xDwwQyTb9RpomJIlVmpg96oON1wiUlEeb8pEkekLsUhohnRz10FNpfOiRCr26/rR1IhPGofgtriL14cZ7SBtdAB2AaBx5YZXF29p2+ppBCov/+UlMDs3WKyri1tsLCg6keEJ3QYYjU+mjr50jXosWEaadRW04fLryXSnkACxQARMLk+ah1DUSYP6iJwoDmOoYm0goL1ANEI4gUhTk1XhV2asjFC+cpzbBAIUAqiypRmCiEc9KaumxYoJBAoij7+PSaoAZxxmV8Kw4sUASwj8+LavgWVrcodEa19NIefQALFBGshw9LtyiUhegDWKCIWP1FEXYT84tCGK7IQvQBqe1IxBdwJuRvcbW6Qy/+V09s3A1Ne0SXMODWTugXcq4xO3s6G9EHpFcgNZ61EKG/BSQ1NRU9zVi5OlHqPXfKnvhuD3HYq0qzQq5SGH7z//ynj2LXH+077oSfaO9cNfqrDMkDclcD2Ss4464BQy0UFqS7k+8et0bbo0bNcSe3g6noAf7qm+/6Xv8eNQ3+UY2RZZHctsKsIjxGMVvtY8Q9i+S6GR9nR4s0r6NPklwLlKW7J4+KXAs07ise0gD3RDOxyLVAadiBbNzJtUAvYrSksjKWFZdcC/TvzWhznp1gKIXJsUDYEzFKb7KXSmWamBwLtP7waay+nCwNiMYhlwJh7VfcHedPvJXe/RSTJFcdIdbCwfubsVIXwDykMFM58kBqBdp51bSW3IShgY0zlTRJDT9kaUJYXNIrkJJhFNvNofbh+uc13BMdkYsp2z1j0LBAEcjCQsCkYYFCghmMC2Ny07dxggUKgXWzt0vp27tnGPB8hh6My/7M4wr/qwQAYbDJVJq3XhkGLJAPuJ0AVk9w1OkN10A+oJeZ5QkHC+QD7tCDladMb1L7a4be4I8Xfxv4fpwbo2Cm4trGU262hyCzESjuLZE4CoUjswLZ99bqFzsKMd3JdA3EUWjwZFogjkKDJ/OtMI5CgyXzAtkbPPULR6Hu5KIfaO69eMMRHIWCyYVA7W3l+p8Ez1EomNz0RM/H3BmMo5A/uRGo187xveAo5E+uxsI4CiVPrgTiKJQ8uRuN5yiULLkTiKNQsuRyPhDulBMHjkKvyaVAWJocZ30XR6HX5HZG4pmYtzvgKNQmtwLFHWTlKNQmtwLFneoBOArlfFI9R6H4iHqjKZ0HypO8cRITTHPPHXFVBJKuG19JSQzji58amiRR630awygzTLcbgmhLE0KsOA+a7A8TgFcNKZRAZJo/Og8apkkM44fpdcOUq0hhrggkuQhiAjA9bsAdzWjt3nSdpHIYO8R4QWAxPfWNUaDbWqVSqSmVbjvf0E2DGMaJ2VFAy5VKubzV7kiU9K3zTUPnOohx0zLcTphSfIFnSyBd373u7A+Ca7rBUYhpYyh5vLUx0heeLYGsNGa2jbLRdZNrIcYSxxt9BGk3kL7arw+oVqszxYnJTXXocLpesahRqVAgJr/s64YVgZzoGp22BTocTA2KQpzK8ouuxPHKo6qfZVseILwX1Ru7P6jAteA8NqlGrDVNEJMfkLp29933lBWq53n6jbJr27aO6Ry6Jj/xDrBi2gJ3MOYHQzXZ91rezCNrLUGL3nM7BEJ4klL81XWpesBGTmfZB2nLL2BIKnzmTF02vhPKjk2Xb5BJy97jLVUToajiaJQ9rNaW+m7x6MRcPjY1edPvuq6FTb3eXFKKXeu4SCXDYkGzHkz6QdTRffp62pjLR6emloKu7VkZv3zZuCIK4m/O5v3hxQciFVSBjddMeoAsuolWlgwQR9aEKmWmkY26EOpbrzabsyVJt9SfMxt0DlppmmiLhNf4YJZqPLAFQXGMEXW/gVEnmCPWEvITv5qn41yKQFBKY7KCtPoCjx4tL4W9InKIQDQqGOaSENqnxGSEtjj69JHrFeGd4tydvnNMWyS6rMLdVW/HI5MShBoQNejbfsR5/REJcCiTJZKYl4Jm1QfPEjMmyBoWT2AOj+rQ+REzCY2pIzf7lcbJ/wH9VD8KK3ri6QAAAABJRU5ErkJggg==",import.meta.url).href,$6=new URL("/assets/renown-short-hover-BiSLBV7L.png",import.meta.url).href,z6=({onLogin:e})=>{const t=c.jsx(L6,{onLogin:e});return c.jsx(fc,{content:t,children:c.jsxs("div",{className:M("group/sidebar-footer flex w-full items-baseline justify-start text-sm font-semibold leading-10 text-gray-600",e?"cursor-pointer":"cursor-wait"),children:[c.jsx("img",{width:42,height:42,loading:"lazy",className:"group-hover/sidebar-footer:hidden",src:F6,alt:"Renown Login"}),c.jsx("img",{width:42,height:42,loading:"lazy",className:"hidden group-hover/sidebar-footer:block",src:$6,alt:"Renown Login Hover"})]})})},_6=e=>`${e.slice(0,7)}...${e.slice(-5)}`,U6=({address:e,onDisconnect:t,etherscanUrl:n,username:s=""})=>{const[r,o]=b.useState(!1),a=b.useCallback(async i=>{try{await navigator.clipboard.writeText(i),o(!0),setTimeout(()=>o(!1),2e3)}catch(l){console.error("Failed to copy address:",l)}},[]);return c.jsxs("div",{className:"flex flex-col divide-y divide-gray-200 text-gray-900",children:[c.jsxs("div",{className:"px-3 py-2",children:[s&&c.jsx("div",{className:"text-sm font-medium",children:s}),c.jsx("div",{className:"mt-1 flex items-center gap-2",children:c.jsx(Pe,{size:"small",color:"light",onClick:a.bind(null,e),className:"w-full cursor-pointer bg-transparent p-0 active:opacity-70",type:"button",children:c.jsxs("div",{className:"relative flex w-full items-center gap-1",children:[c.jsxs("div",{className:`flex items-center gap-1 transition-opacity duration-150 ${r?"opacity-0":"opacity-100"}`,children:[c.jsx("span",{className:"text-xs",children:_6(e)}),c.jsx(O,{name:"FilesEarmark",color:"#9EA0A1",size:14})]}),c.jsx("div",{className:`absolute left-0 text-xs transition-opacity duration-150 ${r?"opacity-100":"opacity-0"}`,children:"Copied to clipboard!"})]})})})]}),n&&c.jsx("div",{className:"px-3 py-2",children:c.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-sm text-gray-900 hover:text-gray-600",children:[c.jsx(O,{name:"Ethscan",size:14}),"View on Etherscan"]})}),c.jsx("div",{className:"px-3 py-2",children:c.jsxs("button",{onClick:t,className:M("flex w-full items-center gap-2 text-sm text-red-900",t?"cursor-pointer hover:text-red-700":"pointer-events-none cursor-wait"),type:"button",children:[c.jsx(O,{name:"Disconnect",size:14,color:"#EA4335"}),"Disconnect"]})})]})},V6=({address:e,etherscanUrl:t,onDisconnect:n})=>{const{data:s}=Iu({address:e}),r=s,o=c.jsx(U6,{address:e,username:r,onDisconnect:n,etherscanUrl:t});return c.jsx(fc,{content:o,children:c.jsx("div",{className:"flex items-center justify-center rounded-sm",children:c.jsx(Mu,{address:e,size:"40px"})})})},B6=({address:e,className:t,onLogin:n,onClickSettings:s,onInspectorClick:r,onDisconnect:o,onHomeClick:a,showDebug:i,onDebugClick:l,etherscanUrl:u="",...d})=>c.jsxs(Nd,{...d,className:M("flex flex-col gap-2 border-t border-gray-300 px-2 py-4",t),children:[a&&c.jsx("button",{"aria-label":"Home",type:"button",className:"flex w-full cursor-pointer items-center justify-center outline-none",onClick:a,children:c.jsx(O,{className:"text-gray-600",name:"ConnectSmall",size:24})}),i&&l&&c.jsx("button",{"aria-label":"Debug Settings",type:"button",id:"connect-debug-button",className:"mt-3 flex w-full cursor-pointer items-center justify-center outline-none",onClick:l,children:c.jsx(O,{className:"text-gray-600",name:"Tube"})}),c.jsx("div",{className:a?"mt-3":"",children:e?c.jsx(V6,{address:e,onDisconnect:o,etherscanUrl:u}):c.jsx(z6,{onLogin:n})}),r&&c.jsx("button",{"aria-label":"Inspector",type:"button",className:"mt-3 flex w-full cursor-pointer items-center justify-center outline-none",onClick:r,children:c.jsx(O,{className:"text-gray-600",name:"CircleInfo"})}),c.jsxs("button",{"aria-label":"Settings",type:"button",className:M("mt-3 flex w-full items-center justify-center outline-none",s?"cursor-pointer":"cursor-wait"),onClick:s,children:[c.jsx(O,{className:"text-gray-600",name:"Settings"}),c.jsx("span",{className:"hidden text-sm font-semibold leading-6 text-gray-800",children:"Settings"})]})]}),H6=({className:e,children:t,...n})=>t?c.jsx(Ed,{...n,className:M("flex justify-center gap-4 border-b border-gray-300 py-4",e),children:t}):null,Gw=({onClick:e,address:t,headerContent:n,onClickSettings:s,onInspectorClick:r,maxWidth:o="304px",minWidth:a="58px",onLogin:i,onDisconnect:l,etherscanUrl:u,showDebug:d,onDebugClick:h,...f})=>c.jsxs(Od,{...f,maxWidth:o,minWidth:a,children:[c.jsxs(Id,{children:[c.jsx(H6,{children:n}),c.jsx("div",{className:"flex flex-col",children:f.children})]}),c.jsx(B6,{address:t,onClickSettings:s,onInspectorClick:r,onLogin:i,onDisconnect:l,etherscanUrl:u,onHomeClick:e,showDebug:d,onDebugClick:h})]}),mn=e=>typeof e=="number"&&!isNaN(e),rt=e=>typeof e=="string",ye=e=>typeof e=="function",Jn=e=>rt(e)||ye(e)?e:null,Ys=e=>b.isValidElement(e)||rt(e)||ye(e)||mn(e);function W6(e,t,n){n===void 0&&(n=300);const{scrollHeight:s,style:r}=e;requestAnimationFrame(()=>{r.minHeight="initial",r.height=s+"px",r.transition=`all ${n}ms`,requestAnimationFrame(()=>{r.height="0",r.padding="0",r.margin="0",setTimeout(t,n)})})}function Rr(e){let{enter:t,exit:n,appendPosition:s=!1,collapse:r=!0,collapseDuration:o=300}=e;return function(a){let{children:i,position:l,preventExitTransition:u,done:d,nodeRef:h,isIn:f,playToast:p}=a;const g=s?`${t}--${l}`:t,m=s?`${n}--${l}`:n,y=b.useRef(0);return b.useLayoutEffect(()=>{const v=h.current,x=g.split(" "),C=N=>{N.target===h.current&&(p(),v.removeEventListener("animationend",C),v.removeEventListener("animationcancel",C),y.current===0&&N.type!=="animationcancel"&&v.classList.remove(...x))};v.classList.add(...x),v.addEventListener("animationend",C),v.addEventListener("animationcancel",C)},[]),b.useEffect(()=>{const v=h.current,x=()=>{v.removeEventListener("animationend",x),r?W6(v,d,o):d()};f||(u?x():(y.current=1,v.className+=` ${m}`,v.addEventListener("animationend",x)))},[f]),K.createElement(K.Fragment,null,i)}}function Mi(e,t){return e!=null?{content:e.content,containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,status:t}:{}}const pe=new Map;let gn=[];const Ks=new Set,q6=e=>Ks.forEach(t=>t(e)),Uu=()=>pe.size>0;function Vu(e,t){var n;if(t)return!((n=pe.get(t))==null||!n.isToastActive(e));let s=!1;return pe.forEach(r=>{r.isToastActive(e)&&(s=!0)}),s}function Bu(e,t){Ys(e)&&(Uu()||gn.push({content:e,options:t}),pe.forEach(n=>{n.buildToast(e,t)}))}function Ti(e,t){pe.forEach(n=>{t!=null&&t!=null&&t.containerId?t?.containerId===n.id&&n.toggle(e,t?.id):n.toggle(e,t?.id)})}function G6(e){const{subscribe:t,getSnapshot:n,setProps:s}=b.useRef((function(o){const a=o.containerId||1;return{subscribe(i){const l=(function(d,h,f){let p=1,g=0,m=[],y=[],v=[],x=h;const C=new Map,N=new Set,w=()=>{v=Array.from(C.values()),N.forEach(P=>P())},j=P=>{y=P==null?[]:y.filter(E=>E!==P),w()},S=P=>{const{toastId:E,onOpen:T,updateId:I,children:D}=P.props,R=I==null;P.staleId&&C.delete(P.staleId),C.set(E,P),y=[...y,P.props.toastId].filter(F=>F!==P.staleId),w(),f(Mi(P,R?"added":"updated")),R&&ye(T)&&T(b.isValidElement(D)&&D.props)};return{id:d,props:x,observe:P=>(N.add(P),()=>N.delete(P)),toggle:(P,E)=>{C.forEach(T=>{E!=null&&E!==T.props.toastId||ye(T.toggle)&&T.toggle(P)})},removeToast:j,toasts:C,clearQueue:()=>{g-=m.length,m=[]},buildToast:(P,E)=>{if((V=>{let{containerId:A,toastId:B,updateId:te}=V;const ne=A?A!==d:d!==1,q=C.has(B)&&te==null;return ne||q})(E))return;const{toastId:T,updateId:I,data:D,staleId:R,delay:F}=E,_=()=>{j(T)},U=I==null;U&&g++;const H={...x,style:x.toastStyle,key:p++,...Object.fromEntries(Object.entries(E).filter(V=>{let[A,B]=V;return B!=null})),toastId:T,updateId:I,data:D,closeToast:_,isIn:!1,className:Jn(E.className||x.toastClassName),bodyClassName:Jn(E.bodyClassName||x.bodyClassName),progressClassName:Jn(E.progressClassName||x.progressClassName),autoClose:!E.isLoading&&(G=E.autoClose,W=x.autoClose,G===!1||mn(G)&&G>0?G:W),deleteToast(){const V=C.get(T),{onClose:A,children:B}=V.props;ye(A)&&A(b.isValidElement(B)&&B.props),f(Mi(V,"removed")),C.delete(T),g--,g<0&&(g=0),m.length>0?S(m.shift()):w()}};var G,W;H.closeButton=x.closeButton,E.closeButton===!1||Ys(E.closeButton)?H.closeButton=E.closeButton:E.closeButton===!0&&(H.closeButton=!Ys(x.closeButton)||x.closeButton);let ee=P;b.isValidElement(P)&&!rt(P.type)?ee=b.cloneElement(P,{closeToast:_,toastProps:H,data:D}):ye(P)&&(ee=P({closeToast:_,toastProps:H,data:D}));const re={content:ee,props:H,staleId:R};x.limit&&x.limit>0&&g>x.limit&&U?m.push(re):mn(F)?setTimeout(()=>{S(re)},F):S(re)},setProps(P){x=P},setToggle:(P,E)=>{C.get(P).toggle=E},isToastActive:P=>y.some(E=>E===P),getSnapshot:()=>v}})(a,o,q6);pe.set(a,l);const u=l.observe(i);return gn.forEach(d=>Bu(d.content,d.options)),gn=[],()=>{u(),pe.delete(a)}},setProps(i){var l;(l=pe.get(a))==null||l.setProps(i)},getSnapshot(){var i;return(i=pe.get(a))==null?void 0:i.getSnapshot()}}})(e)).current;s(e);const r=b.useSyncExternalStore(t,n,n);return{getToastToRender:function(o){if(!r)return[];const a=new Map;return e.newestOnTop&&r.reverse(),r.forEach(i=>{const{position:l}=i.props;a.has(l)||a.set(l,[]),a.get(l).push(i)}),Array.from(a,i=>o(i[0],i[1]))},isToastActive:Vu,count:r?.length}}function Q6(e){const[t,n]=b.useState(!1),[s,r]=b.useState(!1),o=b.useRef(null),a=b.useRef({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:i,pauseOnHover:l,closeToast:u,onClick:d,closeOnClick:h}=e;var f,p;function g(){n(!0)}function m(){n(!1)}function y(C){const N=o.current;a.canDrag&&N&&(a.didMove=!0,t&&m(),a.delta=e.draggableDirection==="x"?C.clientX-a.start:C.clientY-a.start,a.start!==C.clientX&&(a.canCloseOnClick=!1),N.style.transform=`translate3d(${e.draggableDirection==="x"?`${a.delta}px, var(--y)`:`0, calc(${a.delta}px + var(--y))`},0)`,N.style.opacity=""+(1-Math.abs(a.delta/a.removalDistance)))}function v(){document.removeEventListener("pointermove",y),document.removeEventListener("pointerup",v);const C=o.current;if(a.canDrag&&a.didMove&&C){if(a.canDrag=!1,Math.abs(a.delta)>a.removalDistance)return r(!0),e.closeToast(),void e.collapseAll();C.style.transition="transform 0.2s, opacity 0.2s",C.style.removeProperty("transform"),C.style.removeProperty("opacity")}}(p=pe.get((f={id:e.toastId,containerId:e.containerId,fn:n}).containerId||1))==null||p.setToggle(f.id,f.fn),b.useEffect(()=>{if(e.pauseOnFocusLoss)return document.hasFocus()||m(),window.addEventListener("focus",g),window.addEventListener("blur",m),()=>{window.removeEventListener("focus",g),window.removeEventListener("blur",m)}},[e.pauseOnFocusLoss]);const x={onPointerDown:function(C){if(e.draggable===!0||e.draggable===C.pointerType){a.didMove=!1,document.addEventListener("pointermove",y),document.addEventListener("pointerup",v);const N=o.current;a.canCloseOnClick=!0,a.canDrag=!0,N.style.transition="none",e.draggableDirection==="x"?(a.start=C.clientX,a.removalDistance=N.offsetWidth*(e.draggablePercent/100)):(a.start=C.clientY,a.removalDistance=N.offsetHeight*(e.draggablePercent===80?1.5*e.draggablePercent:e.draggablePercent)/100)}},onPointerUp:function(C){const{top:N,bottom:w,left:j,right:S}=o.current.getBoundingClientRect();C.nativeEvent.type!=="touchend"&&e.pauseOnHover&&C.clientX>=j&&C.clientX<=S&&C.clientY>=N&&C.clientY<=w?m():g()}};return i&&l&&(x.onMouseEnter=m,e.stacked||(x.onMouseLeave=g)),h&&(x.onClick=C=>{d&&d(C),a.canCloseOnClick&&u()}),{playToast:g,pauseToast:m,isRunning:t,preventExitTransition:s,toastRef:o,eventHandlers:x}}function Y6(e){let{delay:t,isRunning:n,closeToast:s,type:r="default",hide:o,className:a,style:i,controlledProgress:l,progress:u,rtl:d,isIn:h,theme:f}=e;const p=o||l&&u===0,g={...i,animationDuration:`${t}ms`,animationPlayState:n?"running":"paused"};l&&(g.transform=`scaleX(${u})`);const m=We("Toastify__progress-bar",l?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${f}`,`Toastify__progress-bar--${r}`,{"Toastify__progress-bar--rtl":d}),y=ye(a)?a({rtl:d,type:r,defaultClassName:m}):We(m,a),v={[l&&u>=1?"onTransitionEnd":"onAnimationEnd"]:l&&u<1?null:()=>{h&&s()}};return K.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":p},K.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${f} Toastify__progress-bar--${r}`}),K.createElement("div",{role:"progressbar","aria-hidden":p?"true":"false","aria-label":"notification timer",className:y,style:g,...v}))}let K6=1;const Hu=()=>""+K6++;function X6(e){return e&&(rt(e.toastId)||mn(e.toastId))?e.toastId:Hu()}function zt(e,t){return Bu(e,t),t.toastId}function gr(e,t){return{...t,type:t&&t.type||e,toastId:X6(t)}}function Vn(e){return(t,n)=>zt(t,gr(e,n))}function J(e,t){return zt(e,gr("default",t))}J.loading=(e,t)=>zt(e,gr("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...t})),J.promise=function(e,t,n){let s,{pending:r,error:o,success:a}=t;r&&(s=rt(r)?J.loading(r,n):J.loading(r.render,{...n,...r}));const i={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},l=(d,h,f)=>{if(h==null)return void J.dismiss(s);const p={type:d,...i,...n,data:f},g=rt(h)?{render:h}:h;return s?J.update(s,{...p,...g}):J(g.render,{...p,...g}),f},u=ye(e)?e():e;return u.then(d=>l("success",a,d)).catch(d=>l("error",o,d)),u},J.success=Vn("success"),J.info=Vn("info"),J.error=Vn("error"),J.warning=Vn("warning"),J.warn=J.warning,J.dark=(e,t)=>zt(e,gr("default",{theme:"dark",...t})),J.dismiss=function(e){(function(t){var n;if(Uu()){if(t==null||rt(n=t)||mn(n))pe.forEach(s=>{s.removeToast(t)});else if(t&&("containerId"in t||"id"in t)){const s=pe.get(t.containerId);s?s.removeToast(t.id):pe.forEach(r=>{r.removeToast(t.id)})}}else gn=gn.filter(s=>t!=null&&s.options.toastId!==t)})(e)},J.clearWaitingQueue=function(e){e===void 0&&(e={}),pe.forEach(t=>{!t.props.limit||e.containerId&&t.id!==e.containerId||t.clearQueue()})},J.isActive=Vu,J.update=function(e,t){t===void 0&&(t={});const n=((s,r)=>{var o;let{containerId:a}=r;return(o=pe.get(a||1))==null?void 0:o.toasts.get(s)})(e,t);if(n){const{props:s,content:r}=n,o={delay:100,...s,...t,toastId:t.toastId||e,updateId:Hu()};o.toastId!==e&&(o.staleId=e);const a=o.render||r;delete o.render,zt(a,o)}},J.done=e=>{J.update(e,{progress:1})},J.onChange=function(e){return Ks.add(e),()=>{Ks.delete(e)}},J.play=e=>Ti(!0,e),J.pause=e=>Ti(!1,e);const J6=typeof window<"u"?b.useLayoutEffect:b.useEffect,Bn=e=>{let{theme:t,type:n,isLoading:s,...r}=e;return K.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:t==="colored"?"currentColor":`var(--toastify-icon-color-${n})`,...r})},as={info:function(e){return K.createElement(Bn,{...e},K.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(e){return K.createElement(Bn,{...e},K.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(e){return K.createElement(Bn,{...e},K.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(e){return K.createElement(Bn,{...e},K.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return K.createElement("div",{className:"Toastify__spinner"})}},Z6=e=>{const{isRunning:t,preventExitTransition:n,toastRef:s,eventHandlers:r,playToast:o}=Q6(e),{closeButton:a,children:i,autoClose:l,onClick:u,type:d,hideProgressBar:h,closeToast:f,transition:p,position:g,className:m,style:y,bodyClassName:v,bodyStyle:x,progressClassName:C,progressStyle:N,updateId:w,role:j,progress:S,rtl:P,toastId:E,deleteToast:T,isIn:I,isLoading:D,closeOnClick:R,theme:F}=e,_=We("Toastify__toast",`Toastify__toast-theme--${F}`,`Toastify__toast--${d}`,{"Toastify__toast--rtl":P},{"Toastify__toast--close-on-click":R}),U=ye(m)?m({rtl:P,position:g,type:d,defaultClassName:_}):We(_,m),H=(function(re){let{theme:V,type:A,isLoading:B,icon:te}=re,ne=null;const q={theme:V,type:A};return te===!1||(ye(te)?ne=te({...q,isLoading:B}):b.isValidElement(te)?ne=b.cloneElement(te,q):B?ne=as.spinner():(oe=>oe in as)(A)&&(ne=as[A](q))),ne})(e),G=!!S||!l,W={closeToast:f,type:d,theme:F};let ee=null;return a===!1||(ee=ye(a)?a(W):b.isValidElement(a)?b.cloneElement(a,W):(function(re){let{closeToast:V,theme:A,ariaLabel:B="close"}=re;return K.createElement("button",{className:`Toastify__close-button Toastify__close-button--${A}`,type:"button",onClick:te=>{te.stopPropagation(),V(te)},"aria-label":B},K.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},K.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))})(W)),K.createElement(p,{isIn:I,done:T,position:g,preventExitTransition:n,nodeRef:s,playToast:o},K.createElement("div",{id:E,onClick:u,"data-in":I,className:U,...r,style:y,ref:s},K.createElement("div",{...I&&{role:j},className:ye(v)?v({type:d}):We("Toastify__toast-body",v),style:x},H!=null&&K.createElement("div",{className:We("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!D})},H),K.createElement("div",null,i)),ee,K.createElement(Y6,{...w&&!G?{key:`pb-${w}`}:{},rtl:P,theme:F,delay:l,isRunning:t,isIn:I,closeToast:f,hide:h,type:d,style:N,className:C,controlledProgress:G,progress:S||0})))},Ar=function(e,t){return t===void 0&&(t=!1),{enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:t}},ew=Rr(Ar("bounce",!0));Rr(Ar("slide",!0));Rr(Ar("zoom"));Rr(Ar("flip"));const tw={position:"top-right",transition:ew,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};function nw(e){let t={...tw,...e};const n=e.stacked,[s,r]=b.useState(!0),o=b.useRef(null),{getToastToRender:a,isToastActive:i,count:l}=G6(t),{className:u,style:d,rtl:h,containerId:f}=t;function p(m){const y=We("Toastify__toast-container",`Toastify__toast-container--${m}`,{"Toastify__toast-container--rtl":h});return ye(u)?u({position:m,rtl:h,defaultClassName:y}):We(y,Jn(u))}function g(){n&&(r(!0),J.play())}return J6(()=>{if(n){var m;const y=o.current.querySelectorAll('[data-in="true"]'),v=12,x=(m=t.position)==null?void 0:m.includes("top");let C=0,N=0;Array.from(y).reverse().forEach((w,j)=>{const S=w;S.classList.add("Toastify__toast--stacked"),j>0&&(S.dataset.collapsed=`${s}`),S.dataset.pos||(S.dataset.pos=x?"top":"bot");const P=C*(s?.2:1)+(s?0:v*j);S.style.setProperty("--y",`${x?P:-1*P}px`),S.style.setProperty("--g",`${v}`),S.style.setProperty("--s",""+(1-(s?N:0))),C+=S.offsetHeight,N+=.025})}},[s,l,n]),K.createElement("div",{ref:o,className:"Toastify",id:f,onMouseEnter:()=>{n&&(r(!1),J.pause())},onMouseLeave:g},a((m,y)=>{const v=y.length?{...d}:{...d,pointerEvents:"none"};return K.createElement("div",{className:p(m),style:v,key:`container-${m}`},y.map(x=>{let{content:C,props:N}=x;return K.createElement(Z6,{...N,stacked:n,collapseAll:g,isIn:i(N.toastId,N.containerId),style:N.style,key:`toast-${N.key}`},C)}))}))}function rw(e){return e==="connect-success"||e==="connect-warning"||e==="connect-loading"||e==="connect-deleted"}function sw(e){if(rw(e)){const t={};switch(e){case"connect-success":t.type="success",t.icon=c.jsx(O,{className:"text-green-800",name:"CheckCircleFill",size:24});break;case"connect-warning":t.type="warning",t.icon=c.jsx(O,{className:"text-gray-600",name:"WarningFill",size:24});break;case"connect-loading":t.type="default",t.icon=c.jsx(O,{className:"text-gray-600",name:"ClockFill",size:24});break;case"connect-deleted":t.type="error",t.icon=c.jsx(O,{className:"text-red-800",name:"TrashFill",size:24});break}return t}return{type:e}}function Qw(e,t){const{type:n="default",...s}=t||{},r=sw(n);return J(e,{...r,...s})}const ow=({closeToast:e})=>c.jsx("button",{className:"flex items-center text-gray-500 hover:text-gray-600",onClick:e,children:c.jsx(O,{name:"XmarkLight",size:16})}),Yw=e=>c.jsx(nw,{closeButton:ow,...e}),Di=Dv({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},blockTime:12e3,rpcUrls:{default:{http:["https://eth.merkle.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensUniversalResolver:{address:"0xeeeeeeee14d718c2b47d9923deab1335e144eeee",blockCreated:23085558},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),aw=lx({chains:[Di],transports:{[Di.id]:zv()}}),iw=new _x;function Kw(e){const{children:t,wagmiProviderProps:n,queryClientProviderProps:s}=e,{config:r=aw,...o}=n??{},{client:a=iw,...i}=s??{};return c.jsx(fx,{config:r,...o,children:c.jsx(Qx,{client:a,...i,children:t})})}export{J0 as A,xw as B,ff as C,jw as D,zw as E,Ow as F,_w as G,Tw as H,Uw as I,Vw as J,Bw as K,Hw as L,Fw as M,Ug as N,Vg as O,df as P,Bg as Q,lf as R,A6 as S,uf as T,Hg as U,Kw as W,cf as a,Q0 as b,Gw as c,Yw as d,Cw as e,Sw as f,Pw as g,Ww as h,y6 as i,dl as j,Iw as k,Mw as l,I5 as m,ul as n,qw as o,Dw as p,fo as q,$w as r,kw as s,Qw as t,vw as u,ww as v,Pn as w,Rw as x,Aw as y,Lw as z};