@powerhousedao/connect 6.0.0-dev.42 → 6.0.0-dev.44

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 (45) hide show
  1. package/.env +1 -1
  2. package/dist/assets/{AddDriveModal-DOxE2fNY.js → AddDriveModal-BfbPGU02.js} +1 -1
  3. package/dist/assets/{ClearStorageModal-gj73u-Rx.js → ClearStorageModal-Coerg9zi.js} +1 -1
  4. package/dist/assets/{CookiesPolicyModal-rr5kuHWU.js → CookiesPolicyModal-BeKWZ4pV.js} +1 -1
  5. package/dist/assets/CreateDocumentModal-DJ0ZYujG.js +1 -0
  6. package/dist/assets/{DebugSettingsModal-mvwJvPUT.js → DebugSettingsModal-hDpzKe0t.js} +1 -1
  7. package/dist/assets/{DeleteDriveModal-A8CihHw9.js → DeleteDriveModal-TGKxgbIJ.js} +1 -1
  8. package/dist/assets/DeleteItemModal-K4sAhdtC.js +1 -0
  9. package/dist/assets/DisclaimerModal-Cw0GAVyN.js +1 -0
  10. package/dist/assets/DriveSettingsModal-DZvGgDDF.js +1 -0
  11. package/dist/assets/{ExportDocumentWithErrorsModal-BZ-NH--x.js → ExportDocumentWithErrorsModal-CwguhKnx.js} +1 -1
  12. package/dist/assets/{SettingsModal-BzIh0laQ.js → SettingsModal-CGrGAdPi.js} +1 -1
  13. package/dist/assets/{UpgradeDriveModal-CFecCBX5.js → UpgradeDriveModal-DRhYtiiv.js} +1 -1
  14. package/dist/assets/{design_system-9zAlUcxC.js → design_system-Cvyob7tr.js} +1 -1
  15. package/dist/assets/design_system_connect-SoJPzAdw.js +47 -0
  16. package/dist/assets/{design_system_ui-C63f6sYC.js → design_system_ui-B4c9YVjt.js} +1 -1
  17. package/dist/assets/{document_engineering-D1EIFQF6.js → document_engineering-BRBrBeC4.js} +1 -1
  18. package/dist/assets/{document_model_editor-CXOtJQjx.js → document_model_editor-B_fRFi56.js} +4 -4
  19. package/dist/assets/{drive_explorer-BvWzWshq.js → drive_explorer-DxDLfh8c.js} +2 -2
  20. package/dist/assets/{editor-Db7FmiMh.js → editor-c6MJYwpz.js} +1 -1
  21. package/dist/assets/{graphql-editor-1KFB0OGG.js → graphql-editor-Dmu_u3eu.js} +1 -1
  22. package/dist/assets/{hooks-Bw58tnLh.js → hooks-B_h20cQW.js} +1 -1
  23. package/dist/assets/index-2R4Z5JTm.js +18 -0
  24. package/dist/assets/{index-bp1jaoP_.js → index-CnEJ-s0j.js} +2 -2
  25. package/dist/assets/{json-editor-DEm989M4.js → json-editor-uCosJyIt.js} +1 -1
  26. package/dist/assets/{nodefs-B636J7ht.js → nodefs-CmAFMswm.js} +1 -1
  27. package/dist/assets/opfs-ahp-DaW-nidg.js +3 -0
  28. package/dist/assets/{reactor_browser-C8LcQC6c.js → reactor_browser-CI14TYlI.js} +69 -65
  29. package/dist/assets/{state-schemas-BzujPfjq.js → state-schemas-c_e3kwg4.js} +2 -2
  30. package/dist/index.html +7 -7
  31. package/lib/package.copy.json +2 -1
  32. package/lib/src/components/drive-icon.js +1 -1
  33. package/lib/src/components/drive-icon.js.map +1 -1
  34. package/lib/src/components/modal/modals/DriveSettingsModal.js +1 -1
  35. package/lib/src/components/modal/modals/DriveSettingsModal.js.map +1 -1
  36. package/lib/tsconfig.tsbuildinfo +1 -1
  37. package/package.copy.json +2 -1
  38. package/package.json +12 -11
  39. package/dist/assets/CreateDocumentModal-DnLm9Vbw.js +0 -1
  40. package/dist/assets/DeleteItemModal-BLmMkZpK.js +0 -1
  41. package/dist/assets/DisclaimerModal-VKMQpq51.js +0 -1
  42. package/dist/assets/DriveSettingsModal-CPHsLtYA.js +0 -1
  43. package/dist/assets/design_system_connect-B8m_K7YO.js +0 -47
  44. package/dist/assets/index-B5Ouv1pS.js +0 -18
  45. package/dist/assets/opfs-ahp-DXdh-H0x.js +0 -3
@@ -0,0 +1,47 @@
1
+ import{j as i,u as zi,r as Vi,C as Ui,b as ta,a as qe}from"./document_model_editor-B_fRFi56.js";import{r as m,R as Qa,a as J}from"./sentry_react-CVx4Qq7f.js";import{c as na,d as Bi,e as _i,f as cd,s as ld,g as Ct,h as ud,i as dd,j as fd,k as vr,l as hd,m as pd,n as md,o as gd,p as bd,q as yd,r as xd,t as vd,v as wd,w as Hi,x as Cd,S as Ve,G as Sd,I as jd}from"./reactor_browser-CI14TYlI.js";import{P as Ot,a as Wi,b as Gi,u as qi,d as Qi,R as Nd,A as Ed,e as $e,f as ra,g as Pd,D as Od,C as Id,h as kd,i as Md,j as Td,I,k as Ad,m as le,l as Ee,M as De,n as Rd,o as Yi,p as Dd,q as Ld,r as Fd,s as $d,t as zd,v as Vd,c as Ji,w as Ud,x as Bd,S as _d,y as Hd,z as Wd,B as Gd}from"./design_system-Cvyob7tr.js";import{t as M,a as sa}from"./tailwind_merge-CXl88Wxt.js";import{W as qd,X as Qd,S as Ya,Y as Yd,Z as Jd}from"./document_model-C-Ne8Zoy.js";import{c as kn,g as Ki}from"./react-D_vzfE_e.js";import{l as ds,m as Kd}from"./document_drive-B4eFu84b.js";import{_ as Xi}from"./drive_explorer-DxDLfh8c.js";import{o as Xd,r as Ja,s as Tt}from"./zod-Cc38s6JG.js";import{P as Zd,a as ef,b as tf,S as Zi,I as nf,c as rf}from"./design_system_ui-B4c9YVjt.js";var sf=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"}),af="VisuallyHidden",ec=m.forwardRef((e,t)=>i.jsx(Ot.span,{...e,ref:t,style:{...sf,...e.style}}));ec.displayName=af;var of=ec,[wr]=Wi("Tooltip",[Gi]),Cr=Gi(),tc="TooltipProvider",cf=700,fs="tooltip.open",[lf,aa]=wr(tc),nc=e=>{const{__scopeTooltip:t,delayDuration:n=cf,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:a}=e,o=m.useRef(!0),c=m.useRef(!1),l=m.useRef(0);return m.useEffect(()=>{const u=l.current;return()=>window.clearTimeout(u)},[]),i.jsx(lf,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:m.useCallback(()=>{window.clearTimeout(l.current),o.current=!1},[]),onClose:m.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:m.useCallback(u=>{c.current=u},[]),disableHoverableContent:s,children:a})};nc.displayName=tc;var _t="Tooltip",[uf,vn]=wr(_t),rc=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:a,disableHoverableContent:o,delayDuration:c}=e,l=aa(_t,e.__scopeTooltip),u=Cr(t),[d,h]=m.useState(null),f=qi(),p=m.useRef(0),g=o??l.disableHoverableContent,b=c??l.delayDuration,y=m.useRef(!1),[x,v]=Qi({prop:r,defaultProp:s??!1,onChange:S=>{S?(l.onOpen(),document.dispatchEvent(new CustomEvent(fs))):l.onClose(),a?.(S)},caller:_t}),w=m.useMemo(()=>x?y.current?"delayed-open":"instant-open":"closed",[x]),E=m.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y.current=!1,v(!0)},[v]),C=m.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),j=m.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{y.current=!0,v(!0),p.current=0},b)},[b,v]);return m.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),i.jsx(Nd,{...u,children:i.jsx(uf,{scope:t,contentId:f,open:x,stateAttribute:w,trigger:d,onTriggerChange:h,onTriggerEnter:m.useCallback(()=>{l.isOpenDelayedRef.current?j():E()},[l.isOpenDelayedRef,j,E]),onTriggerLeave:m.useCallback(()=>{g?C():(window.clearTimeout(p.current),p.current=0)},[C,g]),onOpen:E,onClose:C,disableHoverableContent:g,children:n})})};rc.displayName=_t;var hs="TooltipTrigger",sc=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=vn(hs,n),a=aa(hs,n),o=Cr(n),c=m.useRef(null),l=zi(t,c,s.onTriggerChange),u=m.useRef(!1),d=m.useRef(!1),h=m.useCallback(()=>u.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),i.jsx(Ed,{asChild:!0,...o,children:i.jsx(Ot.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:l,onPointerMove:$e(e.onPointerMove,f=>{f.pointerType!=="touch"&&!d.current&&!a.isPointerInTransitRef.current&&(s.onTriggerEnter(),d.current=!0)}),onPointerLeave:$e(e.onPointerLeave,()=>{s.onTriggerLeave(),d.current=!1}),onPointerDown:$e(e.onPointerDown,()=>{s.open&&s.onClose(),u.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:$e(e.onFocus,()=>{u.current||s.onOpen()}),onBlur:$e(e.onBlur,s.onClose),onClick:$e(e.onClick,s.onClose)})})});sc.displayName=hs;var oa="TooltipPortal",[df,ff]=wr(oa,{forceMount:void 0}),ac=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:s}=e,a=vn(oa,t);return i.jsx(df,{scope:t,forceMount:n,children:i.jsx(ra,{present:n||a.open,children:i.jsx(Pd,{asChild:!0,container:s,children:r})})})};ac.displayName=oa;var St="TooltipContent",oc=m.forwardRef((e,t)=>{const n=ff(St,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...a}=e,o=vn(St,e.__scopeTooltip);return i.jsx(ra,{present:r||o.open,children:o.disableHoverableContent?i.jsx(ic,{side:s,...a,ref:t}):i.jsx(hf,{side:s,...a,ref:t})})}),hf=m.forwardRef((e,t)=>{const n=vn(St,e.__scopeTooltip),r=aa(St,e.__scopeTooltip),s=m.useRef(null),a=zi(t,s),[o,c]=m.useState(null),{trigger:l,onClose:u}=n,d=s.current,{onPointerInTransitChange:h}=r,f=m.useCallback(()=>{c(null),h(!1)},[h]),p=m.useCallback((g,b)=>{const y=g.currentTarget,x={x:g.clientX,y:g.clientY},v=yf(x,y.getBoundingClientRect()),w=xf(x,v),E=vf(b.getBoundingClientRect()),C=Cf([...w,...E]);c(C),h(!0)},[h]);return m.useEffect(()=>()=>f(),[f]),m.useEffect(()=>{if(l&&d){const g=y=>p(y,d),b=y=>p(y,l);return l.addEventListener("pointerleave",g),d.addEventListener("pointerleave",b),()=>{l.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",b)}}},[l,d,p,f]),m.useEffect(()=>{if(o){const g=b=>{const y=b.target,x={x:b.clientX,y:b.clientY},v=l?.contains(y)||d?.contains(y),w=!wf(x,o);v?f():w&&(f(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[l,d,o,u,f]),i.jsx(ic,{...e,ref:a})}),[pf,mf]=wr(_t,{isInside:!1}),gf=kd("TooltipContent"),ic=m.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:a,onPointerDownOutside:o,...c}=e,l=vn(St,n),u=Cr(n),{onClose:d}=l;return m.useEffect(()=>(document.addEventListener(fs,d),()=>document.removeEventListener(fs,d)),[d]),m.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]),i.jsx(Od,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:i.jsxs(Id,{"data-state":l.stateAttribute,...u,...c,ref:t,style:{...c.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:[i.jsx(gf,{children:r}),i.jsx(pf,{scope:n,isInside:!0,children:i.jsx(of,{id:l.contentId,role:"tooltip",children:s||r})})]})})});oc.displayName=St;var cc="TooltipArrow",bf=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Cr(n);return mf(cc,n).isInside?null:i.jsx(Md,{...s,...r,ref:t})});bf.displayName=cc;function yf(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,s,a)){case a:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function xf(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function vf(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}function wf(e,t){const{x:n,y:r}=e;let s=!1;for(let a=0,o=t.length-1;a<t.length;o=a++){const c=t[a],l=t[o],u=c.x,d=c.y,h=l.x,f=l.y;d>r!=f>r&&n<(h-u)*(r-d)/(f-d)+u&&(s=!s)}return s}function Cf(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),Sf(t)}function Sf(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const s=e[r];for(;t.length>=2;){const a=t[t.length-1],o=t[t.length-2];if((a.x-o.x)*(s.y-o.y)>=(a.y-o.y)*(s.x-o.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const a=n[n.length-1],o=n[n.length-2];if((a.x-o.x)*(s.y-o.y)>=(a.y-o.y)*(s.x-o.x))n.pop();else break}n.push(s)}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 jf=nc,Nf=rc,Ef=sc,Pf=ac,Of=oc;const lc=6048e5,If=864e5,uc=6e4,dc=36e5,Mn=43200,Ka=1440,Xa=Symbol.for("constructDateFrom");function Ae(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&Xa in e?e[Xa](t):e instanceof Date?new e.constructor(t):new Date(t)}function ce(e,t){return Ae(t||e,e)}let kf={};function wn(){return kf}function Ht(e,t){const n=wn(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=ce(e,t?.in),a=s.getDay(),o=(a<r?7:0)+a-r;return s.setDate(s.getDate()-o),s.setHours(0,0,0,0),s}function nr(e,t){return Ht(e,{...t,weekStartsOn:1})}function fc(e,t){const n=ce(e,t?.in),r=n.getFullYear(),s=Ae(n,0);s.setFullYear(r+1,0,4),s.setHours(0,0,0,0);const a=nr(s),o=Ae(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);const c=nr(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=c.getTime()?r:r-1}function rr(e){const t=ce(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 Sr(e,...t){const n=Ae.bind(null,e||t.find(r=>typeof r=="object"));return t.map(n)}function Za(e,t){const n=ce(e,t?.in);return n.setHours(0,0,0,0),n}function Mf(e,t,n){const[r,s]=Sr(n?.in,e,t),a=Za(r),o=Za(s),c=+a-rr(a),l=+o-rr(o);return Math.round((c-l)/If)}function Tf(e,t){const n=fc(e,t),r=Ae(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),nr(r)}function qn(e,t){const n=+ce(e)-+ce(t);return n<0?-1:n>0?1:n}function Af(e){return Ae(e,Date.now())}function Rf(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Df(e){return!(!Rf(e)&&typeof e!="number"||isNaN(+ce(e)))}function Lf(e,t,n){const[r,s]=Sr(n?.in,e,t),a=r.getFullYear()-s.getFullYear(),o=r.getMonth()-s.getMonth();return a*12+o}function Ff(e){return t=>{const r=(e?Math[e]:Math.trunc)(t);return r===0?0:r}}function $f(e,t){return+ce(e)-+ce(t)}function zf(e,t){const n=ce(e,t?.in);return n.setHours(23,59,59,999),n}function Vf(e,t){const n=ce(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function Uf(e,t){const n=ce(e,t?.in);return+zf(n,t)==+Vf(n,t)}function Bf(e,t,n){const[r,s,a]=Sr(n?.in,e,e,t),o=qn(s,a),c=Math.abs(Lf(s,a));if(c<1)return 0;s.getMonth()===1&&s.getDate()>27&&s.setDate(30),s.setMonth(s.getMonth()-o*c);let l=qn(s,a)===-o;Uf(r)&&c===1&&qn(r,a)===1&&(l=!1);const u=o*(c-+l);return u===0?0:u}function _f(e,t,n){const r=$f(e,t)/1e3;return Ff(n?.roundingMethod)(r)}function Hf(e,t){const n=ce(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const Wf={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"}},Gf=(e,t,n)=>{let r;const s=Wf[e];return typeof s=="string"?r=s:t===1?r=s.one:r=s.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function zr(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const qf={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Qf={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Yf={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Jf={date:zr({formats:qf,defaultWidth:"full"}),time:zr({formats:Qf,defaultWidth:"full"}),dateTime:zr({formats:Yf,defaultWidth:"full"})},Kf={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Xf=(e,t,n,r)=>Kf[e];function At(e){return(t,n)=>{const r=n?.context?String(n.context):"standalone";let s;if(r==="formatting"&&e.formattingValues){const o=e.defaultFormattingWidth||e.defaultWidth,c=n?.width?String(n.width):o;s=e.formattingValues[c]||e.formattingValues[o]}else{const o=e.defaultWidth,c=n?.width?String(n.width):e.defaultWidth;s=e.values[c]||e.values[o]}const a=e.argumentCallback?e.argumentCallback(t):t;return s[a]}}const Zf={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},e0={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},t0={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"]},n0={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"]},r0={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"}},s0={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"}},a0=(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},o0={ordinalNumber:a0,era:At({values:Zf,defaultWidth:"wide"}),quarter:At({values:e0,defaultWidth:"wide",argumentCallback:e=>e-1}),month:At({values:t0,defaultWidth:"wide"}),day:At({values:n0,defaultWidth:"wide"}),dayPeriod:At({values:r0,defaultWidth:"wide",formattingValues:s0,defaultFormattingWidth:"wide"})};function Rt(e){return(t,n={})=>{const r=n.width,s=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(s);if(!a)return null;const o=a[0],c=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(c)?c0(c,h=>h.test(o)):i0(c,h=>h.test(o));let u;u=e.valueCallback?e.valueCallback(l):l,u=n.valueCallback?n.valueCallback(u):u;const d=t.slice(o.length);return{value:u,rest:d}}}function i0(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function c0(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function l0(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const s=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;const c=t.slice(s.length);return{value:o,rest:c}}}const u0=/^(\d+)(th|st|nd|rd)?/i,d0=/\d+/i,f0={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},h0={any:[/^b/i,/^(a|c)/i]},p0={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},m0={any:[/1/i,/2/i,/3/i,/4/i]},g0={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},b0={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]},y0={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},x0={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]},v0={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},w0={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}},C0={ordinalNumber:l0({matchPattern:u0,parsePattern:d0,valueCallback:e=>parseInt(e,10)}),era:Rt({matchPatterns:f0,defaultMatchWidth:"wide",parsePatterns:h0,defaultParseWidth:"any"}),quarter:Rt({matchPatterns:p0,defaultMatchWidth:"wide",parsePatterns:m0,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Rt({matchPatterns:g0,defaultMatchWidth:"wide",parsePatterns:b0,defaultParseWidth:"any"}),day:Rt({matchPatterns:y0,defaultMatchWidth:"wide",parsePatterns:x0,defaultParseWidth:"any"}),dayPeriod:Rt({matchPatterns:v0,defaultMatchWidth:"any",parsePatterns:w0,defaultParseWidth:"any"})},hc={code:"en-US",formatDistance:Gf,formatLong:Jf,formatRelative:Xf,localize:o0,match:C0,options:{weekStartsOn:0,firstWeekContainsDate:1}};function S0(e,t){const n=ce(e,t?.in);return Mf(n,Hf(n))+1}function j0(e,t){const n=ce(e,t?.in),r=+nr(n)-+Tf(n);return Math.round(r/lc)+1}function pc(e,t){const n=ce(e,t?.in),r=n.getFullYear(),s=wn(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,o=Ae(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);const c=Ht(o,t),l=Ae(t?.in||e,0);l.setFullYear(r,0,a),l.setHours(0,0,0,0);const u=Ht(l,t);return+n>=+c?r+1:+n>=+u?r:r-1}function N0(e,t){const n=wn(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=pc(e,t),a=Ae(t?.in||e,0);return a.setFullYear(s,0,r),a.setHours(0,0,0,0),Ht(a,t)}function E0(e,t){const n=ce(e,t?.in),r=+Ht(n,t)-+N0(n,t);return Math.round(r/lc)+1}function X(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const Ge={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return X(t==="yy"?r%100:r,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];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,r=e.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return X(s,t.length)}},ht={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},eo={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),s=r>0?r:1-r;return n.ordinalNumber(s,{unit:"year"})}return Ge.y(e,t)},Y:function(e,t,n,r){const s=pc(e,r),a=s>0?s:1-s;if(t==="YY"){const o=a%100;return X(o,2)}return t==="Yo"?n.ordinalNumber(a,{unit:"year"}):X(a,t.length)},R:function(e,t){const n=fc(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 r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return X(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return X(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return Ge.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return X(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const s=E0(e,r);return t==="wo"?n.ordinalNumber(s,{unit:"week"}):X(s,t.length)},I:function(e,t,n){const r=j0(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):X(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):Ge.d(e,t)},D:function(e,t,n){const r=S0(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):X(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":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"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const s=e.getDay(),a=(s-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(a);case"ee":return X(a,2);case"eo":return n.ordinalNumber(a,{unit:"day"});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"});default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const s=e.getDay(),a=(s-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(a);case"cc":return X(a,t.length);case"co":return n.ordinalNumber(a,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),s=r===0?7:r;switch(t){case"i":return String(s);case"ii":return X(s,t.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const s=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let s;switch(r===12?s=ht.noon:r===0?s=ht.midnight:s=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let s;switch(r>=17?s=ht.evening:r>=12?s=ht.afternoon:r>=4?s=ht.morning:s=ht.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Ge.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):Ge.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):X(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):X(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):Ge.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):Ge.s(e,t)},S:function(e,t){return Ge.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return no(r);case"XXXX":case"XX":return Ze(r);default:return Ze(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return no(r);case"xxxx":case"xx":return Ze(r);default:return Ze(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+to(r,":");default:return"GMT"+Ze(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+to(r,":");default:return"GMT"+Ze(r,":")}},t:function(e,t,n){const r=Math.trunc(+e/1e3);return X(r,t.length)},T:function(e,t,n){return X(+e,t.length)}};function to(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),s=Math.trunc(r/60),a=r%60;return a===0?n+String(s):n+String(s)+t+X(a,2)}function no(e,t){return e%60===0?(e>0?"-":"+")+X(Math.abs(e)/60,2):Ze(e,t)}function Ze(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),s=X(Math.trunc(r/60),2),a=X(r%60,2);return n+s+t+a}const ro=(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"});default:return t.date({width:"full"})}},mc=(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"});default:return t.time({width:"full"})}},P0=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return ro(e,t);let a;switch(r){case"P":a=t.dateTime({width:"short"});break;case"PP":a=t.dateTime({width:"medium"});break;case"PPP":a=t.dateTime({width:"long"});break;default:a=t.dateTime({width:"full"});break}return a.replace("{{date}}",ro(r,t)).replace("{{time}}",mc(s,t))},O0={p:mc,P:P0},I0=/^D+$/,k0=/^Y+$/,M0=["D","DD","YY","YYYY"];function T0(e){return I0.test(e)}function A0(e){return k0.test(e)}function R0(e,t,n){const r=D0(e,t,n);if(console.warn(r),M0.includes(e))throw new RangeError(r)}function D0(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const L0=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,F0=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,$0=/^'([^]*?)'?$/,z0=/''/g,V0=/[a-zA-Z]/;function sr(e,t,n){const r=wn(),s=r.locale??hc,a=r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=r.weekStartsOn??r.locale?.options?.weekStartsOn??0,c=ce(e,n?.in);if(!Df(c))throw new RangeError("Invalid time value");let l=t.match(F0).map(d=>{const h=d[0];if(h==="p"||h==="P"){const f=O0[h];return f(d,s.formatLong)}return d}).join("").match(L0).map(d=>{if(d==="''")return{isToken:!1,value:"'"};const h=d[0];if(h==="'")return{isToken:!1,value:U0(d)};if(eo[h])return{isToken:!0,value:d};if(h.match(V0))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");return{isToken:!1,value:d}});s.localize.preprocessor&&(l=s.localize.preprocessor(c,l));const u={firstWeekContainsDate:a,weekStartsOn:o,locale:s};return l.map(d=>{if(!d.isToken)return d.value;const h=d.value;(A0(h)||T0(h))&&R0(h,t,String(e));const f=eo[h[0]];return f(c,h,s.localize,u)}).join("")}function U0(e){const t=e.match($0);return t?t[1].replace(z0,"'"):e}function B0(e,t,n){const r=wn(),s=n?.locale??r.locale??hc,a=2520,o=qn(e,t);if(isNaN(o))throw new RangeError("Invalid time value");const c=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:o}),[l,u]=Sr(n?.in,...o>0?[t,e]:[e,t]),d=_f(u,l),h=(rr(u)-rr(l))/1e3,f=Math.round((d-h)/60);let p;if(f<2)return n?.includeSeconds?d<5?s.formatDistance("lessThanXSeconds",5,c):d<10?s.formatDistance("lessThanXSeconds",10,c):d<20?s.formatDistance("lessThanXSeconds",20,c):d<40?s.formatDistance("halfAMinute",0,c):d<60?s.formatDistance("lessThanXMinutes",1,c):s.formatDistance("xMinutes",1,c):f===0?s.formatDistance("lessThanXMinutes",1,c):s.formatDistance("xMinutes",f,c);if(f<45)return s.formatDistance("xMinutes",f,c);if(f<90)return s.formatDistance("aboutXHours",1,c);if(f<Ka){const g=Math.round(f/60);return s.formatDistance("aboutXHours",g,c)}else{if(f<a)return s.formatDistance("xDays",1,c);if(f<Mn){const g=Math.round(f/Ka);return s.formatDistance("xDays",g,c)}else if(f<Mn*2)return p=Math.round(f/Mn),s.formatDistance("aboutXMonths",p,c)}if(p=Bf(u,l),p<12){const g=Math.round(f/Mn);return s.formatDistance("xMonths",g,c)}else{const g=p%12,b=Math.trunc(p/12);return g<3?s.formatDistance("aboutXYears",b,c):g<9?s.formatDistance("overXYears",b,c):s.formatDistance("almostXYears",b+1,c)}}function _0(e,t){return B0(e,Af(e),t)}function H0(e,t){const n=()=>Ae(t?.in,NaN),s=Q0(e);let a;if(s.date){const u=Y0(s.date,2);a=J0(u.restDateString,u.year)}if(!a||isNaN(+a))return n();const o=+a;let c=0,l;if(s.time&&(c=K0(s.time),isNaN(c)))return n();if(s.timezone){if(l=X0(s.timezone),isNaN(l))return n()}else{const u=new Date(o+c),d=ce(0,t?.in);return d.setFullYear(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()),d.setHours(u.getUTCHours(),u.getUTCMinutes(),u.getUTCSeconds(),u.getUTCMilliseconds()),d}return ce(o+c+l,t?.in)}const Tn={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},W0=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,G0=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,q0=/^([+-])(\d{2})(?::?(\d{2}))?$/;function Q0(e){const t={},n=e.split(Tn.dateTimeDelimiter);let r;if(n.length>2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],Tn.timeZoneDelimiter.test(t.date)&&(t.date=e.split(Tn.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){const s=Tn.timezone.exec(r);s?(t.time=r.replace(s[1],""),t.timezone=s[1]):t.time=r}return t}function Y0(e,t){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),r=e.match(n);if(!r)return{year:NaN,restDateString:""};const s=r[1]?parseInt(r[1]):null,a=r[2]?parseInt(r[2]):null;return{year:a===null?s:a*100,restDateString:e.slice((r[1]||r[2]).length)}}function J0(e,t){if(t===null)return new Date(NaN);const n=e.match(W0);if(!n)return new Date(NaN);const r=!!n[4],s=Dt(n[1]),a=Dt(n[2])-1,o=Dt(n[3]),c=Dt(n[4]),l=Dt(n[5])-1;if(r)return rh(t,c,l)?Z0(t,c,l):new Date(NaN);{const u=new Date(0);return!th(t,a,o)||!nh(t,s)?new Date(NaN):(u.setUTCFullYear(t,a,Math.max(s,o)),u)}}function Dt(e){return e?parseInt(e):1}function K0(e){const t=e.match(G0);if(!t)return NaN;const n=Vr(t[1]),r=Vr(t[2]),s=Vr(t[3]);return sh(n,r,s)?n*dc+r*uc+s*1e3:NaN}function Vr(e){return e&&parseFloat(e.replace(",","."))||0}function X0(e){if(e==="Z")return 0;const t=e.match(q0);if(!t)return 0;const n=t[1]==="+"?-1:1,r=parseInt(t[2]),s=t[3]&&parseInt(t[3])||0;return ah(r,s)?n*(r*dc+s*uc):NaN}function Z0(e,t,n){const r=new Date(0);r.setUTCFullYear(e,0,4);const s=r.getUTCDay()||7,a=(t-1)*7+n+1-s;return r.setUTCDate(r.getUTCDate()+a),r}const eh=[31,null,31,30,31,30,31,31,30,31,30,31];function gc(e){return e%400===0||e%4===0&&e%100!==0}function th(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(eh[t]||(gc(e)?29:28))}function nh(e,t){return t>=1&&t<=(gc(e)?366:365)}function rh(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function sh(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function ah(e,t){return t>=0&&t<=59}var Ur,so;function oh(){if(so)return Ur;so=1;var e="Expected a function",t=NaN,n="[object Symbol]",r=/^\s+|\s+$/g,s=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,c=parseInt,l=typeof kn=="object"&&kn&&kn.Object===Object&&kn,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,b=function(){return d.Date.now()};function y(C,j,S){var N,P,k,O,T,R,D=0,V=!1,U=!1,H=!0;if(typeof C!="function")throw new TypeError(e);j=E(j)||0,x(S)&&(V=!!S.leading,U="maxWait"in S,k=U?p(E(S.maxWait)||0,j):k,H="trailing"in S?!!S.trailing:H);function q(G){var oe=N,Pe=P;return N=P=void 0,D=G,O=C.apply(Pe,oe),O}function W(G){return D=G,T=setTimeout(B,j),V?q(G):O}function te(G){var oe=G-R,Pe=G-D,In=j-oe;return U?g(In,k-Pe):In}function se(G){var oe=G-R,Pe=G-D;return R===void 0||oe>=j||oe<0||U&&Pe>=k}function B(){var G=b();if(se(G))return L(G);T=setTimeout(B,te(G))}function L(G){return T=void 0,H&&N?q(G):(N=P=void 0,O)}function _(){T!==void 0&&clearTimeout(T),D=0,N=R=P=T=void 0}function ne(){return T===void 0?O:L(b())}function re(){var G=b(),oe=se(G);if(N=arguments,P=this,R=G,oe){if(T===void 0)return W(R);if(U)return T=setTimeout(B,j),q(R)}return T===void 0&&(T=setTimeout(B,j)),O}return re.cancel=_,re.flush=ne,re}function x(C){var j=typeof C;return!!C&&(j=="object"||j=="function")}function v(C){return!!C&&typeof C=="object"}function w(C){return typeof C=="symbol"||v(C)&&f.call(C)==n}function E(C){if(typeof C=="number")return C;if(w(C))return t;if(x(C)){var j=typeof C.valueOf=="function"?C.valueOf():C;C=x(j)?j+"":j}if(typeof C!="string")return C===0?C:+C;C=C.replace(r,"");var S=a.test(C);return S||o.test(C)?c(C.slice(2),S?2:8):s.test(C)?t:+C}return Ur=y,Ur}var ih=oh();const ao=Ki(ih);var bc=typeof window<"u"?m.useLayoutEffect:m.useEffect;function yc(e,t,n,r){const s=m.useRef(t);bc(()=>{s.current=t},[t]),m.useEffect(()=>{const a=window;if(!(a&&a.addEventListener))return;const o=c=>{s.current(c)};return a.addEventListener(e,o,r),()=>{a.removeEventListener(e,o,r)}},[e,n,r])}function jr(){const[e,t]=m.useState(null),n=m.useCallback(async r=>{if(!navigator?.clipboard)return console.warn("Clipboard not supported"),!1;try{return await navigator.clipboard.writeText(r),t(r),!0}catch(s){return console.warn("Copy failed",s),t(null),!1}},[]);return[e,n]}var ch=typeof window>"u";function a2(e,{defaultValue:t=!1,initializeWithValue:n=!0}={}){const r=c=>ch?t:window.matchMedia(c).matches,[s,a]=m.useState(()=>n?r(e):t);function o(){a(r(e))}return bc(()=>{const c=window.matchMedia(e);return o(),c.addListener?c.addListener(o):c.addEventListener("change",o),()=>{c.removeListener?c.removeListener(o):c.removeEventListener("change",o)}},[e]),s}function lh(e){const t=m.useRef(e);t.current=e,m.useEffect(()=>()=>{t.current()},[])}function uh(e,t=500,n){const r=m.useRef();lh(()=>{r.current&&r.current.cancel()});const s=m.useMemo(()=>{const a=ao(e,t,n),o=(...c)=>a(...c);return o.cancel=()=>{a.cancel()},o.isPending=()=>!!r.current,o.flush=()=>a.flush(),o},[e,t,n]);return m.useEffect(()=>{r.current=ao(e,t,n)},[e,t,n]),s}function dh(e,t,n){const r=((u,d)=>u===d),s=e instanceof Function?e():e,[a,o]=m.useState(s),c=m.useRef(s),l=uh(o,t,n);return r(c.current,s)||(l(s),c.current=s),[a,l]}function fh(e,t,n="mousedown",r={}){yc(n,s=>{const a=s.target;if(!a||!a.isConnected)return;(Array.isArray(e)?e.filter(c=>!!c.current).every(c=>c.current&&!c.current.contains(a)):e.current&&!e.current.contains(a))&&t(s)},void 0,r)}const hh=e=>typeof e=="boolean"||e instanceof Boolean,ph=e=>typeof e=="number"||e instanceof Number,mh=e=>typeof e=="bigint"||e instanceof BigInt,xc=e=>!!e&&e instanceof Date,gh=e=>typeof e=="string"||e instanceof String,bh=e=>Array.isArray(e),vc=e=>typeof e=="object"&&e!==null,wc=e=>!!e&&e instanceof Object&&typeof e=="function";function ar(e,t){return t===void 0&&(t=!1),!e||t?`"${e}"`:e}function yh(e,t,n){return n?JSON.stringify(e):t?`"${e}"`:e}function Cc(e){let{field:t,value:n,data:r,lastElement:s,openBracket:a,closeBracket:o,level:c,style:l,shouldExpandNode:u,clickToExpandNode:d,outerRef:h,beforeExpandChange:f}=e;const p=m.useRef(!1),[g,b]=m.useState(()=>u(c,n,t)),y=m.useRef(null);m.useEffect(()=>{p.current?b(u(c,n,t)):p.current=!0},[u]);const x=m.useId();if(r.length===0)return xh({field:t,openBracket:a,closeBracket:o,lastElement:s,style:l});const v=g?l.collapseIcon:l.expandIcon,w=g?l.ariaLables.collapseJson:l.ariaLables.expandJson,E=c+1,C=r.length-1,j=P=>{g!==P&&(!f||f({level:c,value:n,field:t,newExpandValue:P}))&&b(P)},S=P=>{if(P.key==="ArrowRight"||P.key==="ArrowLeft")P.preventDefault(),j(P.key==="ArrowRight");else if(P.key==="ArrowUp"||P.key==="ArrowDown"){P.preventDefault();const k=P.key==="ArrowUp"?-1:1;if(!h.current)return;const O=h.current.querySelectorAll("[role=button]");let T=-1;for(let D=0;D<O.length;D++)if(O[D].tabIndex===0){T=D;break}if(T<0)return;const R=(T+k+O.length)%O.length;O[T].tabIndex=-1,O[R].tabIndex=0,O[R].focus()}},N=()=>{var P;j(!g);const k=y.current;if(!k)return;const O=(P=h.current)===null||P===void 0?void 0:P.querySelector('[role=button][tabindex="0"]');O&&(O.tabIndex=-1),k.tabIndex=0,k.focus()};return m.createElement("div",{className:l.basicChildStyle,role:"treeitem","aria-expanded":g,"aria-selected":void 0},m.createElement("span",{className:v,onClick:N,onKeyDown:S,role:"button","aria-label":w,"aria-expanded":g,"aria-controls":g?x:void 0,ref:y,tabIndex:c===0?0:-1}),(t||t==="")&&(d?m.createElement("span",{className:l.clickableLabel,onClick:N,onKeyDown:S},ar(t,l.quotesForFieldNames),":"):m.createElement("span",{className:l.label},ar(t,l.quotesForFieldNames),":")),m.createElement("span",{className:l.punctuation},a),g?m.createElement("ul",{id:x,role:"group",className:l.childFieldsContainer},r.map((P,k)=>m.createElement(ps,{key:P[0]||k,field:P[0],value:P[1],style:l,lastElement:k===C,level:E,shouldExpandNode:u,clickToExpandNode:d,beforeExpandChange:f,outerRef:h}))):m.createElement("span",{className:l.collapsedContent,onClick:N,onKeyDown:S}),m.createElement("span",{className:l.punctuation},o),!s&&m.createElement("span",{className:l.punctuation},","))}function xh(e){let{field:t,openBracket:n,closeBracket:r,lastElement:s,style:a}=e;return m.createElement("div",{className:a.basicChildStyle,role:"treeitem","aria-selected":void 0},(t||t==="")&&m.createElement("span",{className:a.label},ar(t,a.quotesForFieldNames),":"),m.createElement("span",{className:a.punctuation},n),m.createElement("span",{className:a.punctuation},r),!s&&m.createElement("span",{className:a.punctuation},","))}function vh(e){let{field:t,value:n,style:r,lastElement:s,shouldExpandNode:a,clickToExpandNode:o,level:c,outerRef:l,beforeExpandChange:u}=e;return Cc({field:t,value:n,lastElement:s||!1,level:c,openBracket:"{",closeBracket:"}",style:r,shouldExpandNode:a,clickToExpandNode:o,data:Object.keys(n).map(d=>[d,n[d]]),outerRef:l,beforeExpandChange:u})}function wh(e){let{field:t,value:n,style:r,lastElement:s,level:a,shouldExpandNode:o,clickToExpandNode:c,outerRef:l,beforeExpandChange:u}=e;return Cc({field:t,value:n,lastElement:s||!1,level:a,openBracket:"[",closeBracket:"]",style:r,shouldExpandNode:o,clickToExpandNode:c,data:n.map(d=>[void 0,d]),outerRef:l,beforeExpandChange:u})}function Ch(e){let{field:t,value:n,style:r,lastElement:s}=e,a,o=r.otherValue;return n===null?(a="null",o=r.nullValue):n===void 0?(a="undefined",o=r.undefinedValue):gh(n)?(a=yh(n,!r.noQuotesForStringValues,r.stringifyStringValues),o=r.stringValue):hh(n)?(a=n?"true":"false",o=r.booleanValue):ph(n)?(a=n.toString(),o=r.numberValue):mh(n)?(a=`${n.toString()}n`,o=r.numberValue):xc(n)?a=n.toISOString():wc(n)?a="function() { }":a=n.toString(),m.createElement("div",{className:r.basicChildStyle,role:"treeitem","aria-selected":void 0},(t||t==="")&&m.createElement("span",{className:r.label},ar(t,r.quotesForFieldNames),":"),m.createElement("span",{className:o},a),!s&&m.createElement("span",{className:r.punctuation},","))}function ps(e){const t=e.value;return bh(t)?m.createElement(wh,Object.assign({},e)):vc(t)&&!xc(t)&&!wc(t)?m.createElement(vh,Object.assign({},e)):m.createElement(Ch,Object.assign({},e))}var K={"container-light":"_2IvMF _GzYRV","basic-element-style":"_2bkNM","child-fields-container":"_1BXBN","label-light":"_1MGIk","clickable-label-light":"_2YKJg _1MGIk _1MFti","punctuation-light":"_3uHL6 _3eOF8","value-null-light":"_2T6PJ","value-undefined-light":"_1Gho6","value-string-light":"_vGjyY","value-number-light":"_1bQdo","value-boolean-light":"_3zQKs","value-other-light":"_1xvuR","collapse-icon-light":"_oLqym _f10Tu _1MFti _1LId0","expand-icon-light":"_2AXVT _f10Tu _1MFti _1UmXx","collapsed-content-light":"_2KJWg _1pNG9 _1MFti","container-dark":"_11RoI _GzYRV","expand-icon-dark":"_17H2C _f10Tu _1MFti _1UmXx","collapse-icon-dark":"_3QHg2 _f10Tu _1MFti _1LId0","collapsed-content-dark":"_3fDAz _1pNG9 _1MFti","label-dark":"_2bSDX","clickable-label-dark":"_1RQEj _2bSDX _1MFti","punctuation-dark":"_gsbQL _3eOF8","value-null-dark":"_LaAZe","value-undefined-dark":"_GTKgm","value-string-dark":"_Chy1W","value-number-dark":"_2bveF","value-boolean-dark":"_2vRm-","value-other-dark":"_1prJR"};const Sc={collapseJson:"collapse JSON",expandJson:"expand JSON"},Oe={container:K["container-light"],basicChildStyle:K["basic-element-style"],childFieldsContainer:K["child-fields-container"],label:K["label-light"],clickableLabel:K["clickable-label-light"],nullValue:K["value-null-light"],undefinedValue:K["value-undefined-light"],stringValue:K["value-string-light"],booleanValue:K["value-boolean-light"],numberValue:K["value-number-light"],otherValue:K["value-other-light"],punctuation:K["punctuation-light"],collapseIcon:K["collapse-icon-light"],expandIcon:K["expand-icon-light"],collapsedContent:K["collapsed-content-light"],noQuotesForStringValues:!1,quotesForFieldNames:!1,ariaLables:Sc,stringifyStringValues:!1},Sh={container:K["container-dark"],basicChildStyle:K["basic-element-style"],childFieldsContainer:K["child-fields-container"],label:K["label-dark"],clickableLabel:K["clickable-label-dark"],nullValue:K["value-null-dark"],undefinedValue:K["value-undefined-dark"],stringValue:K["value-string-dark"],booleanValue:K["value-boolean-dark"],numberValue:K["value-number-dark"],otherValue:K["value-other-dark"],punctuation:K["punctuation-dark"],collapseIcon:K["collapse-icon-dark"],expandIcon:K["expand-icon-dark"],collapsedContent:K["collapsed-content-dark"],noQuotesForStringValues:!1,quotesForFieldNames:!1,ariaLables:Sc,stringifyStringValues:!1},ia=()=>!0,jh=e=>e<1,Nh=e=>{let{data:t,style:n=Oe,shouldExpandNode:r=ia,clickToExpandNode:s=!1,beforeExpandChange:a,compactTopLevel:o,...c}=e;const l=m.useRef(null);return m.createElement("div",Object.assign({"aria-label":"JSON view"},c,{className:n.container,ref:l,role:"tree"}),o&&vc(t)?Object.entries(t).map(u=>{let[d,h]=u;return m.createElement(ps,{key:d,field:d,value:h,style:{...Oe,...n},lastElement:!0,level:1,shouldExpandNode:r,clickToExpandNode:s,beforeExpandChange:a,outerRef:l})}):m.createElement(ps,{value:t,style:{...Oe,...n},lastElement:!0,level:0,shouldExpandNode:r,clickToExpandNode:s,outerRef:l,beforeExpandChange:a}))},Eh=Object.freeze(Object.defineProperty({__proto__:null,JsonView:Nh,allExpanded:ia,collapseAllNested:jh,darkStyles:Sh,defaultStyles:Oe},Symbol.toStringTag,{value:"Module"})),Ph={...Oe,container:`${Oe.container} !bg-transparent`,label:`${Oe.label} !text-gray-600`,punctuation:`${Oe.punctuation} !text-gray-700 !font-semibold`,collapseIcon:`${Oe.collapseIcon} !text-gray-600`,stringValue:`${Oe.stringValue} !text-gray-600`},Oh=m.lazy(()=>Xi(()=>Promise.resolve().then(()=>Eh),void 0).then(e=>({default:e.JsonView})));function Ih(e){return i.jsx(m.Suspense,{children:i.jsx(Oh,{...e,shouldExpandNode:e.shouldExpandNode??ia,style:e.style??Ph})})}const jc=({children:e,content:t})=>i.jsxs(Zd,{children:[i.jsx(ef,{asChild:!0,children:i.jsx("button",{type:"button","aria-label":"Open Account",className:"cursor-pointer",children:e})}),i.jsx(tf,{className:"w-52 p-0",align:"start",children:t})]}),kh=new URL("/assets/connect-loader-CvOC68Ih.mp4",import.meta.url).href;function Mh(e){const{style:t,size:n=100,...r}=e,s=Td(n),a={objectFit:"contain",pointerEvents:"none",...s,...t},o=s.width?.replace("px",""),c=s.height?.replace("px","");return i.jsx("video",{autoPlay:!0,height:c,loop:!0,muted:!0,playsInline:!0,width:o,...r,style:a,children:i.jsx("source",{src:kh,type:"video/mp4"})})}function Nr(e){const{onSubmit:t,onCancel:n,defaultValue:r,className:s,minLength:a=1,...o}=e,[c,l]=m.useState(r??""),u=m.useRef(null);fh(u,d),yc("keyup",h=>{h.key==="Enter"&&d(),h.key==="Escape"&&n()}),m.useLayoutEffect(()=>{setTimeout(()=>{u.current?.focus(),u.current?.select(),u.current?.scroll({left:9999})},100)},[]);function d(){c.length>=a&&t(c)}return i.jsx("input",{...o,autoFocus:!0,className:M("bg-inherit text-inherit outline-none",s),minLength:a,onChange:h=>l(h.target.value),ref:u,required:!0,type:"text",value:c})}function o2(){const{isAllowedToCreateDocuments:e}=na(),[t]=Bi(),n=_i(),r=cd(),[s,a]=m.useState(!1);function o(){a(!0)}function c(h){!e||!n||ud(n,h,r.at(-1)?.id).then(f=>{Ct(f)}).catch(f=>{console.error(f)}).finally(()=>{a(!1)})}function l(){a(!1)}const u=!!t,d=!!r.length;return i.jsxs("div",{className:"flex h-9 flex-row items-center gap-2 p-6 text-gray-500",children:[u&&i.jsxs(i.Fragment,{children:[i.jsx(oo,{name:t.state.global.name,onClick:()=>ld(t)}),i.jsx("span",{children:"/"})]}),d&&r.map(h=>i.jsxs(m.Fragment,{children:[i.jsx(oo,{name:h.name,onClick:()=>Ct(h)}),i.jsx("span",{children:"/"})]},h.id)),e&&(s?i.jsx(Nr,{className:"text-gray-800",defaultValue:"New Folder",onCancel:l,onSubmit:c,placeholder:"New Folder"}):i.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:o,children:[i.jsx(I,{name:"Plus",size:14}),"Add new"]}))]})}function oo(e){const{name:t,onClick:n}=e;return i.jsx("div",{className:"transition-colors last-of-type:text-gray-800 hover:text-gray-800",onClick:n,role:"button",children:t})}function ot(e){"@babel/helpers - typeof";return ot=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},ot(e)}function Th(e,t){if(ot(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ot(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Nc(e){var t=Th(e,"string");return ot(t)=="symbol"?t:t+""}function Vt(e,t,n){return(t=Nc(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function io(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function $(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?io(Object(n),!0).forEach(function(r){Vt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):io(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ah(e){if(Array.isArray(e))return e}function Rh(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,s,a,o,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(d){u=!0,s=d}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return c}}function ms(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ec(e,t){if(e){if(typeof e=="string")return ms(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)?ms(e,t):void 0}}function Dh(){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 Ue(e,t){return Ah(e)||Rh(e,t)||Ec(e,t)||Dh()}function Lh(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function _e(e,t){if(e==null)return{};var n,r,s=Lh(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var Fh=["defaultInputValue","defaultMenuIsOpen","defaultValue","inputValue","menuIsOpen","onChange","onInputChange","onMenuClose","onMenuOpen","value"];function $h(e){var t=e.defaultInputValue,n=t===void 0?"":t,r=e.defaultMenuIsOpen,s=r===void 0?!1:r,a=e.defaultValue,o=a===void 0?null:a,c=e.inputValue,l=e.menuIsOpen,u=e.onChange,d=e.onInputChange,h=e.onMenuClose,f=e.onMenuOpen,p=e.value,g=_e(e,Fh),b=m.useState(c!==void 0?c:n),y=Ue(b,2),x=y[0],v=y[1],w=m.useState(l!==void 0?l:s),E=Ue(w,2),C=E[0],j=E[1],S=m.useState(p!==void 0?p:o),N=Ue(S,2),P=N[0],k=N[1],O=m.useCallback(function(q,W){typeof u=="function"&&u(q,W),k(q)},[u]),T=m.useCallback(function(q,W){var te;typeof d=="function"&&(te=d(q,W)),v(te!==void 0?te:q)},[d]),R=m.useCallback(function(){typeof f=="function"&&f(),j(!0)},[f]),D=m.useCallback(function(){typeof h=="function"&&h(),j(!1)},[h]),V=c!==void 0?c:x,U=l!==void 0?l:C,H=p!==void 0?p:P;return $($({},g),{},{inputValue:V,menuIsOpen:U,onChange:O,onInputChange:T,onMenuClose:D,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 r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},z.apply(null,arguments)}function zh(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function co(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Nc(r.key),r)}}function Vh(e,t,n){return t&&co(e.prototype,t),n&&co(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function gs(e,t){return gs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},gs(e,t)}function Uh(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&&gs(e,t)}function or(e){return or=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},or(e)}function Pc(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Pc=function(){return!!e})()}function Bh(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _h(e,t){if(t&&(ot(t)=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Bh(e)}function Hh(e){var t=Pc();return function(){var n,r=or(e);if(t){var s=or(this).constructor;n=Reflect.construct(r,arguments,s)}else n=r.apply(this,arguments);return _h(this,n)}}function Wh(e){if(Array.isArray(e))return ms(e)}function Gh(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function qh(){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 ca(e){return Wh(e)||Gh(e)||Ec(e)||qh()}function Qh(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 Yh(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 Jh=(function(){function e(n){var r=this;this._insertTag=function(s){var a;r.tags.length===0?r.insertionPoint?a=r.insertionPoint.nextSibling:r.prepend?a=r.container.firstChild:a=r.before:a=r.tags[r.tags.length-1].nextSibling,r.container.insertBefore(s,a),r.tags.push(s)},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(r){r.forEach(this._insertTag)},t.insert=function(r){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(Yh(this));var s=this.tags[this.tags.length-1];if(this.isSpeedy){var a=Qh(s);try{a.insertRule(r,a.cssRules.length)}catch{}}else s.appendChild(document.createTextNode(r));this.ctr++},t.flush=function(){this.tags.forEach(function(r){var s;return(s=r.parentNode)==null?void 0:s.removeChild(r)}),this.tags=[],this.ctr=0},e})(),fe="-ms-",ir="-moz-",Q="-webkit-",Oc="comm",la="rule",ua="decl",Kh="@import",Ic="@keyframes",Xh="@layer",Zh=Math.abs,Er=String.fromCharCode,ep=Object.assign;function tp(e,t){return ue(e,0)^45?(((t<<2^ue(e,0))<<2^ue(e,1))<<2^ue(e,2))<<2^ue(e,3):0}function kc(e){return e.trim()}function np(e,t){return(e=t.exec(e))?e[0]:e}function Y(e,t,n){return e.replace(t,n)}function bs(e,t){return e.indexOf(t)}function ue(e,t){return e.charCodeAt(t)|0}function Wt(e,t,n){return e.slice(t,n)}function Ie(e){return e.length}function da(e){return e.length}function An(e,t){return t.push(e),e}function rp(e,t){return e.map(t).join("")}var Pr=1,jt=1,Mc=0,be=0,ie=0,It="";function Or(e,t,n,r,s,a,o){return{value:e,root:t,parent:n,type:r,props:s,children:a,line:Pr,column:jt,length:o,return:""}}function Lt(e,t){return ep(Or("",null,null,"",null,null,0),e,{length:-e.length},t)}function sp(){return ie}function ap(){return ie=be>0?ue(It,--be):0,jt--,ie===10&&(jt=1,Pr--),ie}function ve(){return ie=be<Mc?ue(It,be++):0,jt++,ie===10&&(jt=1,Pr++),ie}function Me(){return ue(It,be)}function Qn(){return be}function Cn(e,t){return Wt(It,e,t)}function Gt(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 Tc(e){return Pr=jt=1,Mc=Ie(It=e),be=0,[]}function Ac(e){return It="",e}function Yn(e){return kc(Cn(be-1,ys(e===91?e+2:e===40?e+1:e)))}function op(e){for(;(ie=Me())&&ie<33;)ve();return Gt(e)>2||Gt(ie)>3?"":" "}function ip(e,t){for(;--t&&ve()&&!(ie<48||ie>102||ie>57&&ie<65||ie>70&&ie<97););return Cn(e,Qn()+(t<6&&Me()==32&&ve()==32))}function ys(e){for(;ve();)switch(ie){case e:return be;case 34:case 39:e!==34&&e!==39&&ys(ie);break;case 40:e===41&&ys(e);break;case 92:ve();break}return be}function cp(e,t){for(;ve()&&e+ie!==57;)if(e+ie===84&&Me()===47)break;return"/*"+Cn(t,be-1)+"*"+Er(e===47?e:ve())}function lp(e){for(;!Gt(Me());)ve();return Cn(e,be)}function up(e){return Ac(Jn("",null,null,null,[""],e=Tc(e),0,[0],e))}function Jn(e,t,n,r,s,a,o,c,l){for(var u=0,d=0,h=o,f=0,p=0,g=0,b=1,y=1,x=1,v=0,w="",E=s,C=a,j=r,S=w;y;)switch(g=v,v=ve()){case 40:if(g!=108&&ue(S,h-1)==58){bs(S+=Y(Yn(v),"&","&\f"),"&\f")!=-1&&(x=-1);break}case 34:case 39:case 91:S+=Yn(v);break;case 9:case 10:case 13:case 32:S+=op(g);break;case 92:S+=ip(Qn()-1,7);continue;case 47:switch(Me()){case 42:case 47:An(dp(cp(ve(),Qn()),t,n),l);break;default:S+="/"}break;case 123*b:c[u++]=Ie(S)*x;case 125*b:case 59:case 0:switch(v){case 0:case 125:y=0;case 59+d:x==-1&&(S=Y(S,/\f/g,"")),p>0&&Ie(S)-h&&An(p>32?uo(S+";",r,n,h-1):uo(Y(S," ","")+";",r,n,h-2),l);break;case 59:S+=";";default:if(An(j=lo(S,t,n,u,d,s,c,w,E=[],C=[],h),a),v===123)if(d===0)Jn(S,t,j,j,E,a,h,c,C);else switch(f===99&&ue(S,3)===110?100:f){case 100:case 108:case 109:case 115:Jn(e,j,j,r&&An(lo(e,j,j,0,0,s,c,w,s,E=[],h),C),s,C,h,c,r?E:C);break;default:Jn(S,j,j,j,[""],C,0,c,C)}}u=d=p=0,b=x=1,w=S="",h=o;break;case 58:h=1+Ie(S),p=g;default:if(b<1){if(v==123)--b;else if(v==125&&b++==0&&ap()==125)continue}switch(S+=Er(v),v*b){case 38:x=d>0?1:(S+="\f",-1);break;case 44:c[u++]=(Ie(S)-1)*x,x=1;break;case 64:Me()===45&&(S+=Yn(ve())),f=Me(),d=h=Ie(w=S+=lp(Qn())),v++;break;case 45:g===45&&Ie(S)==2&&(b=0)}}return a}function lo(e,t,n,r,s,a,o,c,l,u,d){for(var h=s-1,f=s===0?a:[""],p=da(f),g=0,b=0,y=0;g<r;++g)for(var x=0,v=Wt(e,h+1,h=Zh(b=o[g])),w=e;x<p;++x)(w=kc(b>0?f[x]+" "+v:Y(v,/&\f/g,f[x])))&&(l[y++]=w);return Or(e,t,n,s===0?la:c,l,u,d)}function dp(e,t,n){return Or(e,t,n,Oc,Er(sp()),Wt(e,2,-2),0)}function uo(e,t,n,r){return Or(e,t,n,ua,Wt(e,0,r),Wt(e,r+1,-1),r)}function xt(e,t){for(var n="",r=da(e),s=0;s<r;s++)n+=t(e[s],s,e,t)||"";return n}function fp(e,t,n,r){switch(e.type){case Xh:if(e.children.length)break;case Kh:case ua:return e.return=e.return||e.value;case Oc:return"";case Ic:return e.return=e.value+"{"+xt(e.children,r)+"}";case la:e.value=e.props.join(",")}return Ie(n=xt(e.children,r))?e.return=e.value+"{"+n+"}":""}function hp(e){var t=da(e);return function(n,r,s,a){for(var o="",c=0;c<t;c++)o+=e[c](n,r,s,a)||"";return o}}function pp(e){return function(t){t.root||(t=t.return)&&e(t)}}function mp(e){var t=Object.create(null);return function(n){return t[n]===void 0&&(t[n]=e(n)),t[n]}}var gp=function(t,n,r){for(var s=0,a=0;s=a,a=Me(),s===38&&a===12&&(n[r]=1),!Gt(a);)ve();return Cn(t,be)},bp=function(t,n){var r=-1,s=44;do switch(Gt(s)){case 0:s===38&&Me()===12&&(n[r]=1),t[r]+=gp(be-1,n,r);break;case 2:t[r]+=Yn(s);break;case 4:if(s===44){t[++r]=Me()===58?"&\f":"",n[r]=t[r].length;break}default:t[r]+=Er(s)}while(s=ve());return t},yp=function(t,n){return Ac(bp(Tc(t),n))},fo=new WeakMap,xp=function(t){if(!(t.type!=="rule"||!t.parent||t.length<1)){for(var n=t.value,r=t.parent,s=t.column===r.column&&t.line===r.line;r.type!=="rule";)if(r=r.parent,!r)return;if(!(t.props.length===1&&n.charCodeAt(0)!==58&&!fo.get(r))&&!s){fo.set(t,!0);for(var a=[],o=yp(n,a),c=r.props,l=0,u=0;l<o.length;l++)for(var d=0;d<c.length;d++,u++)t.props[u]=a[l]?o[l].replace(/&\f/g,c[d]):c[d]+" "+o[l]}}},vp=function(t){if(t.type==="decl"){var n=t.value;n.charCodeAt(0)===108&&n.charCodeAt(2)===98&&(t.return="",t.value="")}};function Rc(e,t){switch(tp(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+ir+e+fe+e+e;case 6828:case 4268:return Q+e+fe+e+e;case 6165:return Q+e+fe+"flex-"+e+e;case 5187:return Q+e+Y(e,/(\w+).+(:[^]+)/,Q+"box-$1$2"+fe+"flex-$1$2")+e;case 5443:return Q+e+fe+"flex-item-"+Y(e,/flex-|-self/,"")+e;case 4675:return Q+e+fe+"flex-line-pack"+Y(e,/align-content|flex-|-self/,"")+e;case 5548:return Q+e+fe+Y(e,"shrink","negative")+e;case 5292:return Q+e+fe+Y(e,"basis","preferred-size")+e;case 6060:return Q+"box-"+Y(e,"-grow","")+Q+e+fe+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"+fe+"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(Ie(e)-1-t>6)switch(ue(e,t+1)){case 109:if(ue(e,t+4)!==45)break;case 102:return Y(e,/(.+:)(.+)-([^]+)/,"$1"+Q+"$2-$3$1"+ir+(ue(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~bs(e,"stretch")?Rc(Y(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(ue(e,t+1)!==115)break;case 6444:switch(ue(e,Ie(e)-3-(~bs(e,"!important")&&10))){case 107:return Y(e,":",":"+Q)+e;case 101:return Y(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Q+(ue(e,14)===45?"inline-":"")+"box$3$1"+Q+"$2$3$1"+fe+"$2box$3")+e}break;case 5936:switch(ue(e,t+11)){case 114:return Q+e+fe+Y(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Q+e+fe+Y(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Q+e+fe+Y(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Q+e+fe+e+e}return e}var wp=function(t,n,r,s){if(t.length>-1&&!t.return)switch(t.type){case ua:t.return=Rc(t.value,t.length);break;case Ic:return xt([Lt(t,{value:Y(t.value,"@","@"+Q)})],s);case la:if(t.length)return rp(t.props,function(a){switch(np(a,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return xt([Lt(t,{props:[Y(a,/:(read-\w+)/,":"+ir+"$1")]})],s);case"::placeholder":return xt([Lt(t,{props:[Y(a,/:(plac\w+)/,":"+Q+"input-$1")]}),Lt(t,{props:[Y(a,/:(plac\w+)/,":"+ir+"$1")]}),Lt(t,{props:[Y(a,/:(plac\w+)/,fe+"input-$1")]})],s)}return""})}},Cp=[wp],Sp=function(t){var n=t.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(b){var y=b.getAttribute("data-emotion");y.indexOf(" ")!==-1&&(document.head.appendChild(b),b.setAttribute("data-s",""))})}var s=t.stylisPlugins||Cp,a={},o,c=[];o=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(b){for(var y=b.getAttribute("data-emotion").split(" "),x=1;x<y.length;x++)a[y[x]]=!0;c.push(b)});var l,u=[xp,vp];{var d,h=[fp,pp(function(b){d.insert(b)})],f=hp(u.concat(s,h)),p=function(y){return xt(up(y),f)};l=function(y,x,v,w){d=v,p(y?y+"{"+x.styles+"}":x.styles),w&&(g.inserted[x.name]=!0)}}var g={key:n,sheet:new Jh({key:n,container:o,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:a,registered:{},insert:l};return g.sheet.hydrate(c),g},jp=!0;function Np(e,t,n){var r="";return n.split(" ").forEach(function(s){e[s]!==void 0?t.push(e[s]+";"):s&&(r+=s+" ")}),r}var Dc=function(t,n,r){var s=t.key+"-"+n.name;(r===!1||jp===!1)&&t.registered[s]===void 0&&(t.registered[s]=n.styles)},Ep=function(t,n,r){Dc(t,n,r);var s=t.key+"-"+n.name;if(t.inserted[n.name]===void 0){var a=n;do t.insert(n===a?"."+s:"",a,t.sheet,!0),a=a.next;while(a!==void 0)}};function Pp(e){for(var t=0,n,r=0,s=e.length;s>=4;++r,s-=4)n=e.charCodeAt(r)&255|(e.charCodeAt(++r)&255)<<8|(e.charCodeAt(++r)&255)<<16|(e.charCodeAt(++r)&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(s){case 3:t^=(e.charCodeAt(r+2)&255)<<16;case 2:t^=(e.charCodeAt(r+1)&255)<<8;case 1:t^=e.charCodeAt(r)&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 Op={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},Ip=/[A-Z]|^ms/g,kp=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Lc=function(t){return t.charCodeAt(1)===45},ho=function(t){return t!=null&&typeof t!="boolean"},Br=mp(function(e){return Lc(e)?e:e.replace(Ip,"-$&").toLowerCase()}),po=function(t,n){switch(t){case"animation":case"animationName":if(typeof n=="string")return n.replace(kp,function(r,s,a){return ke={name:s,styles:a,next:ke},s})}return Op[t]!==1&&!Lc(t)&&typeof n=="number"&&n!==0?n+"px":n};function qt(e,t,n){if(n==null)return"";var r=n;if(r.__emotion_styles!==void 0)return r;switch(typeof n){case"boolean":return"";case"object":{var s=n;if(s.anim===1)return ke={name:s.name,styles:s.styles,next:ke},s.name;var a=n;if(a.styles!==void 0){var o=a.next;if(o!==void 0)for(;o!==void 0;)ke={name:o.name,styles:o.styles,next:ke},o=o.next;var c=a.styles+";";return c}return Mp(e,t,n)}case"function":{if(e!==void 0){var l=ke,u=n(e);return ke=l,qt(e,t,u)}break}}var d=n;return d}function Mp(e,t,n){var r="";if(Array.isArray(n))for(var s=0;s<n.length;s++)r+=qt(e,t,n[s])+";";else for(var a in n){var o=n[a];if(typeof o!="object"){var c=o;ho(c)&&(r+=Br(a)+":"+po(a,c)+";")}else if(Array.isArray(o)&&typeof o[0]=="string"&&t==null)for(var l=0;l<o.length;l++)ho(o[l])&&(r+=Br(a)+":"+po(a,o[l])+";");else{var u=qt(e,t,o);switch(a){case"animation":case"animationName":{r+=Br(a)+":"+u+";";break}default:r+=a+"{"+u+"}"}}}return r}var mo=/label:\s*([^\s;{]+)\s*(;|$)/g,ke;function Fc(e,t,n){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var r=!0,s="";ke=void 0;var a=e[0];if(a==null||a.raw===void 0)r=!1,s+=qt(n,t,a);else{var o=a;s+=o[0]}for(var c=1;c<e.length;c++)if(s+=qt(n,t,e[c]),r){var l=a;s+=l[c]}mo.lastIndex=0;for(var u="",d;(d=mo.exec(s))!==null;)u+="-"+d[1];var h=Pp(s)+u;return{name:h,styles:s,next:ke}}var Tp=function(t){return t()},Ap=Qa.useInsertionEffect?Qa.useInsertionEffect:!1,Rp=Ap||Tp,$c=m.createContext(typeof HTMLElement<"u"?Sp({key:"css"}):null);$c.Provider;var Dp=function(t){return m.forwardRef(function(n,r){var s=m.useContext($c);return t(n,s,r)})},Lp=m.createContext({}),fa={}.hasOwnProperty,xs="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",Fp=function(t,n){var r={};for(var s in n)fa.call(n,s)&&(r[s]=n[s]);return r[xs]=t,r},$p=function(t){var n=t.cache,r=t.serialized,s=t.isStringTag;return Dc(n,r,s),Rp(function(){return Ep(n,r,s)}),null},zp=Dp(function(e,t,n){var r=e.css;typeof r=="string"&&t.registered[r]!==void 0&&(r=t.registered[r]);var s=e[xs],a=[r],o="";typeof e.className=="string"?o=Np(t.registered,a,e.className):e.className!=null&&(o=e.className+" ");var c=Fc(a,void 0,m.useContext(Lp));o+=t.key+"-"+c.name;var l={};for(var u in e)fa.call(e,u)&&u!=="css"&&u!==xs&&(l[u]=e[u]);return l.className=o,n&&(l.ref=n),m.createElement(m.Fragment,null,m.createElement($p,{cache:t,serialized:c,isStringTag:typeof s=="string"}),m.createElement(s,l))}),Vp=zp,F=function(t,n){var r=arguments;if(n==null||!fa.call(n,"css"))return m.createElement.apply(void 0,r);var s=r.length,a=new Array(s);a[0]=Vp,a[1]=Fp(t,n);for(var o=2;o<s;o++)a[o]=r[o];return m.createElement.apply(null,a)};(function(e){var t;t||(t=e.JSX||(e.JSX={}))})(F||(F={}));function ha(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Fc(t)}function Up(){var e=ha.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 Bp(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var vs=m.useLayoutEffect,_p=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"],cr=function(){};function Hp(e,t){return t?t[0]==="-"?e+t:e+"__"+t:e}function Wp(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),s=2;s<n;s++)r[s-2]=arguments[s];var a=[].concat(r);if(t&&e)for(var o in t)t.hasOwnProperty(o)&&t[o]&&a.push("".concat(Hp(e,o)));return a.filter(function(c){return c}).map(function(c){return String(c).trim()}).join(" ")}var go=function(t){return em(t)?t.filter(Boolean):ot(t)==="object"&&t!==null?[t]:[]},zc=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=_e(t,_p);return $({},n)},ae=function(t,n,r){var s=t.cx,a=t.getStyles,o=t.getClassNames,c=t.className;return{css:a(n,t),className:s(r??{},o(n,t),c)}};function Ir(e){return[document.documentElement,document.body,window].indexOf(e)>-1}function Gp(e){return Ir(e)?window.innerHeight:e.clientHeight}function Vc(e){return Ir(e)?window.pageYOffset:e.scrollTop}function lr(e,t){if(Ir(e)){window.scrollTo(0,t);return}e.scrollTop=t}function qp(e){var t=getComputedStyle(e),n=t.position==="absolute",r=/(auto|scroll)/;if(t.position==="fixed")return document.documentElement;for(var s=e;s=s.parentElement;)if(t=getComputedStyle(s),!(n&&t.position==="static")&&r.test(t.overflow+t.overflowY+t.overflowX))return s;return document.documentElement}function Qp(e,t,n,r){return n*((e=e/r-1)*e*e+1)+t}function Rn(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:200,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:cr,s=Vc(e),a=t-s,o=10,c=0;function l(){c+=o;var u=Qp(c,s,a,n);lr(e,u),c<n?window.requestAnimationFrame(l):r(e)}l()}function bo(e,t){var n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),s=t.offsetHeight/3;r.bottom+s>n.bottom?lr(e,Math.min(t.offsetTop+t.clientHeight-e.offsetHeight+s,e.scrollHeight)):r.top-s<n.top&&lr(e,Math.max(t.offsetTop-s,0))}function Yp(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 yo(){try{return document.createEvent("TouchEvent"),!0}catch{return!1}}function Jp(){try{return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}catch{return!1}}var Uc=!1,Kp={get passive(){return Uc=!0}},Dn=typeof window<"u"?window:{};Dn.addEventListener&&Dn.removeEventListener&&(Dn.addEventListener("p",cr,Kp),Dn.removeEventListener("p",cr,!1));var Xp=Uc;function Zp(e){return e!=null}function em(e){return Array.isArray(e)}function Ln(e,t,n){return e?t:n}var tm=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];var a=Object.entries(t).filter(function(o){var c=Ue(o,1),l=c[0];return!r.includes(l)});return a.reduce(function(o,c){var l=Ue(c,2),u=l[0],d=l[1];return o[u]=d,o},{})},nm=["children","innerProps"],rm=["children","innerProps"];function sm(e){var t=e.maxHeight,n=e.menuEl,r=e.minHeight,s=e.placement,a=e.shouldScroll,o=e.isFixedPosition,c=e.controlHeight,l=qp(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,b=f.top,y=n.offsetParent.getBoundingClientRect(),x=y.top,v=o?window.innerHeight:Gp(l),w=Vc(l),E=parseInt(getComputedStyle(n).marginBottom,10),C=parseInt(getComputedStyle(n).marginTop,10),j=x-C,S=v-b,N=j+w,P=h-w-b,k=p-v+w+E,O=w+b-C,T=160;switch(s){case"auto":case"bottom":if(S>=g)return{placement:"bottom",maxHeight:t};if(P>=g&&!o)return a&&Rn(l,k,T),{placement:"bottom",maxHeight:t};if(!o&&P>=r||o&&S>=r){a&&Rn(l,k,T);var R=o?S-E:P-E;return{placement:"bottom",maxHeight:R}}if(s==="auto"||o){var D=t,V=o?j:N;return V>=r&&(D=Math.min(V-E-c,t)),{placement:"top",maxHeight:D}}if(s==="bottom")return a&&lr(l,k),{placement:"bottom",maxHeight:t};break;case"top":if(j>=g)return{placement:"top",maxHeight:t};if(N>=g&&!o)return a&&Rn(l,O,T),{placement:"top",maxHeight:t};if(!o&&N>=r||o&&j>=r){var U=t;return(!o&&N>=r||o&&j>=r)&&(U=o?j-C:N-C),a&&Rn(l,O,T),{placement:"top",maxHeight:U}}return{placement:"bottom",maxHeight:t};default:throw new Error('Invalid placement provided "'.concat(s,'".'))}return u}function am(e){var t={bottom:"top",top:"bottom"};return e?t[e]:"bottom"}var Bc=function(t){return t==="auto"?"bottom":t},om=function(t,n){var r,s=t.placement,a=t.theme,o=a.borderRadius,c=a.spacing,l=a.colors;return $((r={label:"menu"},Vt(r,am(s),"100%"),Vt(r,"position","absolute"),Vt(r,"width","100%"),Vt(r,"zIndex",1),r),n?{}:{backgroundColor:l.neutral0,borderRadius:o,boxShadow:"0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",marginBottom:c.menuGutter,marginTop:c.menuGutter})},_c=m.createContext(null),im=function(t){var n=t.children,r=t.minMenuHeight,s=t.maxMenuHeight,a=t.menuPlacement,o=t.menuPosition,c=t.menuShouldScrollIntoView,l=t.theme,u=m.useContext(_c)||{},d=u.setPortalPlacement,h=m.useRef(null),f=m.useState(s),p=Ue(f,2),g=p[0],b=p[1],y=m.useState(null),x=Ue(y,2),v=x[0],w=x[1],E=l.spacing.controlHeight;return vs(function(){var C=h.current;if(C){var j=o==="fixed",S=c&&!j,N=sm({maxHeight:s,menuEl:C,minHeight:r,placement:a,shouldScroll:S,isFixedPosition:j,controlHeight:E});b(N.maxHeight),w(N.placement),d?.(N.placement)}},[s,a,o,c,r,d,E]),n({ref:h,placerProps:$($({},t),{},{placement:v||Bc(a),maxHeight:g})})},cm=function(t){var n=t.children,r=t.innerRef,s=t.innerProps;return F("div",z({},ae(t,"menu",{menu:!0}),{ref:r},s),n)},lm=cm,um=function(t,n){var r=t.maxHeight,s=t.theme.spacing.baseUnit;return $({maxHeight:r,overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},n?{}:{paddingBottom:s,paddingTop:s})},dm=function(t){var n=t.children,r=t.innerProps,s=t.innerRef,a=t.isMulti;return F("div",z({},ae(t,"menuList",{"menu-list":!0,"menu-list--is-multi":a}),{ref:s},r),n)},Hc=function(t,n){var r=t.theme,s=r.spacing.baseUnit,a=r.colors;return $({textAlign:"center"},n?{}:{color:a.neutral40,padding:"".concat(s*2,"px ").concat(s*3,"px")})},fm=Hc,hm=Hc,pm=function(t){var n=t.children,r=n===void 0?"No options":n,s=t.innerProps,a=_e(t,nm);return F("div",z({},ae($($({},a),{},{children:r,innerProps:s}),"noOptionsMessage",{"menu-notice":!0,"menu-notice--no-options":!0}),s),r)},mm=function(t){var n=t.children,r=n===void 0?"Loading...":n,s=t.innerProps,a=_e(t,rm);return F("div",z({},ae($($({},a),{},{children:r,innerProps:s}),"loadingMessage",{"menu-notice":!0,"menu-notice--loading":!0}),s),r)},gm=function(t){var n=t.rect,r=t.offset,s=t.position;return{left:n.left,position:s,top:r,width:n.width,zIndex:1}},bm=function(t){var n=t.appendTo,r=t.children,s=t.controlElement,a=t.innerProps,o=t.menuPlacement,c=t.menuPosition,l=m.useRef(null),u=m.useRef(null),d=m.useState(Bc(o)),h=Ue(d,2),f=h[0],p=h[1],g=m.useMemo(function(){return{setPortalPlacement:p}},[]),b=m.useState(null),y=Ue(b,2),x=y[0],v=y[1],w=m.useCallback(function(){if(s){var S=Yp(s),N=c==="fixed"?0:window.pageYOffset,P=S[f]+N;(P!==x?.offset||S.left!==x?.rect.left||S.width!==x?.rect.width)&&v({offset:P,rect:S})}},[s,c,f,x?.offset,x?.rect.left,x?.rect.width]);vs(function(){w()},[w]);var E=m.useCallback(function(){typeof u.current=="function"&&(u.current(),u.current=null),s&&l.current&&(u.current=Ad(s,l.current,w,{elementResize:"ResizeObserver"in window}))},[s,w]);vs(function(){E()},[E]);var C=m.useCallback(function(S){l.current=S,E()},[E]);if(!n&&c!=="fixed"||!x)return null;var j=F("div",z({ref:C},ae($($({},t),{},{offset:x.offset,position:c,rect:x.rect}),"menuPortal",{"menu-portal":!0}),a),r);return F(_c.Provider,{value:g},n?Vi.createPortal(j,n):j)},ym=function(t){var n=t.isDisabled,r=t.isRtl;return{label:"container",direction:r?"rtl":void 0,pointerEvents:n?"none":void 0,position:"relative"}},xm=function(t){var n=t.children,r=t.innerProps,s=t.isDisabled,a=t.isRtl;return F("div",z({},ae(t,"container",{"--is-disabled":s,"--is-rtl":a}),r),n)},vm=function(t,n){var r=t.theme.spacing,s=t.isMulti,a=t.hasValue,o=t.selectProps.controlShouldRenderValue;return $({alignItems:"center",display:s&&a&&o?"flex":"grid",flex:1,flexWrap:"wrap",WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"},n?{}:{padding:"".concat(r.baseUnit/2,"px ").concat(r.baseUnit*2,"px")})},wm=function(t){var n=t.children,r=t.innerProps,s=t.isMulti,a=t.hasValue;return F("div",z({},ae(t,"valueContainer",{"value-container":!0,"value-container--is-multi":s,"value-container--has-value":a}),r),n)},Cm=function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},Sm=function(t){var n=t.children,r=t.innerProps;return F("div",z({},ae(t,"indicatorsContainer",{indicators:!0}),r),n)},xo,jm=["size"],Nm=["innerProps","isRtl","size"],Em={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},Wc=function(t){var n=t.size,r=_e(t,jm);return F("svg",z({height:n,width:n,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:Em},r))},pa=function(t){return F(Wc,z({size:20},t),F("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"}))},Gc=function(t){return F(Wc,z({size:20},t),F("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"}))},qc=function(t,n){var r=t.isFocused,s=t.theme,a=s.spacing.baseUnit,o=s.colors;return $({label:"indicatorContainer",display:"flex",transition:"color 150ms"},n?{}:{color:r?o.neutral60:o.neutral20,padding:a*2,":hover":{color:r?o.neutral80:o.neutral40}})},Pm=qc,Om=function(t){var n=t.children,r=t.innerProps;return F("div",z({},ae(t,"dropdownIndicator",{indicator:!0,"dropdown-indicator":!0}),r),n||F(Gc,null))},Im=qc,km=function(t){var n=t.children,r=t.innerProps;return F("div",z({},ae(t,"clearIndicator",{indicator:!0,"clear-indicator":!0}),r),n||F(pa,null))},Mm=function(t,n){var r=t.isDisabled,s=t.theme,a=s.spacing.baseUnit,o=s.colors;return $({label:"indicatorSeparator",alignSelf:"stretch",width:1},n?{}:{backgroundColor:r?o.neutral10:o.neutral20,marginBottom:a*2,marginTop:a*2})},Tm=function(t){var n=t.innerProps;return F("span",z({},n,ae(t,"indicatorSeparator",{"indicator-separator":!0})))},Am=Up(xo||(xo=Bp([`
4
+ 0%, 80%, 100% { opacity: 0; }
5
+ 40% { opacity: 1; }
6
+ `]))),Rm=function(t,n){var r=t.isFocused,s=t.size,a=t.theme,o=a.colors,c=a.spacing.baseUnit;return $({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:s,lineHeight:1,marginRight:s,textAlign:"center",verticalAlign:"middle"},n?{}:{color:r?o.neutral60:o.neutral20,padding:c*2})},_r=function(t){var n=t.delay,r=t.offset;return F("span",{css:ha({animation:"".concat(Am," 1s ease-in-out ").concat(n,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:r?"1em":void 0,height:"1em",verticalAlign:"top",width:"1em"},"","")})},Dm=function(t){var n=t.innerProps,r=t.isRtl,s=t.size,a=s===void 0?4:s,o=_e(t,Nm);return F("div",z({},ae($($({},o),{},{innerProps:n,isRtl:r,size:a}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),n),F(_r,{delay:0,offset:r}),F(_r,{delay:160,offset:!0}),F(_r,{delay:320,offset:!r}))},Lm=function(t,n){var r=t.isDisabled,s=t.isFocused,a=t.theme,o=a.colors,c=a.borderRadius,l=a.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:r?o.neutral5:o.neutral0,borderColor:r?o.neutral10:s?o.primary:o.neutral20,borderRadius:c,borderStyle:"solid",borderWidth:1,boxShadow:s?"0 0 0 1px ".concat(o.primary):void 0,"&:hover":{borderColor:s?o.primary:o.neutral30}})},Fm=function(t){var n=t.children,r=t.isDisabled,s=t.isFocused,a=t.innerRef,o=t.innerProps,c=t.menuIsOpen;return F("div",z({ref:a},ae(t,"control",{control:!0,"control--is-disabled":r,"control--is-focused":s,"control--menu-is-open":c}),o,{"aria-disabled":r||void 0}),n)},$m=Fm,zm=["data"],Vm=function(t,n){var r=t.theme.spacing;return n?{}:{paddingBottom:r.baseUnit*2,paddingTop:r.baseUnit*2}},Um=function(t){var n=t.children,r=t.cx,s=t.getStyles,a=t.getClassNames,o=t.Heading,c=t.headingProps,l=t.innerProps,u=t.label,d=t.theme,h=t.selectProps;return F("div",z({},ae(t,"group",{group:!0}),l),F(o,z({},c,{selectProps:h,theme:d,getStyles:s,getClassNames:a,cx:r}),u),F("div",null,n))},Bm=function(t,n){var r=t.theme,s=r.colors,a=r.spacing;return $({label:"group",cursor:"default",display:"block"},n?{}:{color:s.neutral40,fontSize:"75%",fontWeight:500,marginBottom:"0.25em",paddingLeft:a.baseUnit*3,paddingRight:a.baseUnit*3,textTransform:"uppercase"})},_m=function(t){var n=zc(t);n.data;var r=_e(n,zm);return F("div",z({},ae(t,"groupHeading",{"group-heading":!0}),r))},Hm=Um,Wm=["innerRef","isDisabled","isHidden","inputClassName"],Gm=function(t,n){var r=t.isDisabled,s=t.value,a=t.theme,o=a.spacing,c=a.colors;return $($({visibility:r?"hidden":"visible",transform:s?"translateZ(0)":""},qm),n?{}:{margin:o.baseUnit/2,paddingBottom:o.baseUnit/2,paddingTop:o.baseUnit/2,color:c.neutral80})},Qc={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},qm={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"},Qc)},Qm=function(t){return $({label:"input",color:"inherit",background:0,opacity:t?0:1,width:"100%"},Qc)},Ym=function(t){var n=t.cx,r=t.value,s=zc(t),a=s.innerRef,o=s.isDisabled,c=s.isHidden,l=s.inputClassName,u=_e(s,Wm);return F("div",z({},ae(t,"input",{"input-container":!0}),{"data-value":r||""}),F("input",z({className:n({input:!0},l),ref:a,style:Qm(c),disabled:o},u)))},Jm=Ym,Km=function(t,n){var r=t.theme,s=r.spacing,a=r.borderRadius,o=r.colors;return $({label:"multiValue",display:"flex",minWidth:0},n?{}:{backgroundColor:o.neutral10,borderRadius:a/2,margin:s.baseUnit/2})},Xm=function(t,n){var r=t.theme,s=r.borderRadius,a=r.colors,o=t.cropWithEllipsis;return $({overflow:"hidden",textOverflow:o||o===void 0?"ellipsis":void 0,whiteSpace:"nowrap"},n?{}:{borderRadius:s/2,color:a.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},Zm=function(t,n){var r=t.theme,s=r.spacing,a=r.borderRadius,o=r.colors,c=t.isFocused;return $({alignItems:"center",display:"flex"},n?{}:{borderRadius:a/2,backgroundColor:c?o.dangerLight:void 0,paddingLeft:s.baseUnit,paddingRight:s.baseUnit,":hover":{backgroundColor:o.dangerLight,color:o.danger}})},Yc=function(t){var n=t.children,r=t.innerProps;return F("div",r,n)},eg=Yc,tg=Yc;function ng(e){var t=e.children,n=e.innerProps;return F("div",z({role:"button"},n),t||F(pa,{size:14}))}var rg=function(t){var n=t.children,r=t.components,s=t.data,a=t.innerProps,o=t.isDisabled,c=t.removeProps,l=t.selectProps,u=r.Container,d=r.Label,h=r.Remove;return F(u,{data:s,innerProps:$($({},ae(t,"multiValue",{"multi-value":!0,"multi-value--is-disabled":o})),a),selectProps:l},F(d,{data:s,innerProps:$({},ae(t,"multiValueLabel",{"multi-value__label":!0})),selectProps:l},n),F(h,{data:s,innerProps:$($({},ae(t,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(n||"option")},c),selectProps:l}))},sg=rg,ag=function(t,n){var r=t.isDisabled,s=t.isFocused,a=t.isSelected,o=t.theme,c=o.spacing,l=o.colors;return $({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},n?{}:{backgroundColor:a?l.primary:s?l.primary25:"transparent",color:r?l.neutral20:a?l.neutral0:"inherit",padding:"".concat(c.baseUnit*2,"px ").concat(c.baseUnit*3,"px"),":active":{backgroundColor:r?void 0:a?l.primary:l.primary50}})},og=function(t){var n=t.children,r=t.isDisabled,s=t.isFocused,a=t.isSelected,o=t.innerRef,c=t.innerProps;return F("div",z({},ae(t,"option",{option:!0,"option--is-disabled":r,"option--is-focused":s,"option--is-selected":a}),{ref:o,"aria-disabled":r},c),n)},ig=og,cg=function(t,n){var r=t.theme,s=r.spacing,a=r.colors;return $({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},n?{}:{color:a.neutral50,marginLeft:s.baseUnit/2,marginRight:s.baseUnit/2})},lg=function(t){var n=t.children,r=t.innerProps;return F("div",z({},ae(t,"placeholder",{placeholder:!0}),r),n)},ug=lg,dg=function(t,n){var r=t.isDisabled,s=t.theme,a=s.spacing,o=s.colors;return $({label:"singleValue",gridArea:"1 / 1 / 2 / 3",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},n?{}:{color:r?o.neutral40:o.neutral80,marginLeft:a.baseUnit/2,marginRight:a.baseUnit/2})},fg=function(t){var n=t.children,r=t.isDisabled,s=t.innerProps;return F("div",z({},ae(t,"singleValue",{"single-value":!0,"single-value--is-disabled":r}),s),n)},hg=fg,kr={ClearIndicator:km,Control:$m,DropdownIndicator:Om,DownChevron:Gc,CrossIcon:pa,Group:Hm,GroupHeading:_m,IndicatorsContainer:Sm,IndicatorSeparator:Tm,Input:Jm,LoadingIndicator:Dm,Menu:lm,MenuList:dm,MenuPortal:bm,LoadingMessage:mm,NoOptionsMessage:pm,MultiValue:sg,MultiValueContainer:eg,MultiValueLabel:tg,MultiValueRemove:ng,Option:ig,Placeholder:ug,SelectContainer:xm,SingleValue:hg,ValueContainer:wm},pg=function(t){return $($({},kr),t.components)},vo=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function mg(e,t){return!!(e===t||vo(e)&&vo(t))}function gg(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!mg(e[n],t[n]))return!1;return!0}function bg(e,t){t===void 0&&(t=gg);var n=null;function r(){for(var s=[],a=0;a<arguments.length;a++)s[a]=arguments[a];if(n&&n.lastThis===this&&t(s,n.lastArgs))return n.lastResult;var o=e.apply(this,s);return n={lastResult:o,lastArgs:s,lastThis:this},o}return r.clear=function(){n=null},r}var yg={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"},xg=function(t){return F("span",z({css:yg},t))},wo=xg,vg={guidance:function(t){var n=t.isSearchable,r=t.isMulti,s=t.tabSelectsValue,a=t.context,o=t.isInitialFocus;switch(a){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(s?", press Tab to select the option and exit the menu":"",".");case"input":return o?"".concat(t["aria-label"]||"Select"," is focused ").concat(n?",type to refine list":"",", press Down to open the menu, ").concat(r?" 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,r=t.label,s=r===void 0?"":r,a=t.labels,o=t.isDisabled;switch(n){case"deselect-option":case"pop-value":case"remove-value":return"option ".concat(s,", deselected.");case"clear":return"All selected options have been cleared.";case"initial-input-focus":return"option".concat(a.length>1?"s":""," ").concat(a.join(","),", selected.");case"select-option":return o?"option ".concat(s," is disabled. Select another option."):"option ".concat(s,", selected.");default:return""}},onFocus:function(t){var n=t.context,r=t.focused,s=t.options,a=t.label,o=a===void 0?"":a,c=t.selectValue,l=t.isDisabled,u=t.isSelected,d=t.isAppleDevice,h=function(b,y){return b&&b.length?"".concat(b.indexOf(y)+1," of ").concat(b.length):""};if(n==="value"&&c)return"value ".concat(o," focused, ").concat(h(c,r),".");if(n==="menu"&&d){var f=l?" disabled":"",p="".concat(u?" selected":"").concat(f);return"".concat(o).concat(p,", ").concat(h(s,r),".")}return""},onFilter:function(t){var n=t.inputValue,r=t.resultsMessage;return"".concat(r).concat(n?" for search term "+n:"",".")}},wg=function(t){var n=t.ariaSelection,r=t.focusedOption,s=t.focusedValue,a=t.focusableOptions,o=t.isFocused,c=t.selectValue,l=t.selectProps,u=t.id,d=t.isAppleDevice,h=l.ariaLiveMessages,f=l.getOptionLabel,p=l.inputValue,g=l.isMulti,b=l.isOptionDisabled,y=l.isSearchable,x=l.menuIsOpen,v=l.options,w=l.screenReaderStatus,E=l.tabSelectsValue,C=l.isLoading,j=l["aria-label"],S=l["aria-live"],N=m.useMemo(function(){return $($({},vg),h||{})},[h]),P=m.useMemo(function(){var V="";if(n&&N.onChange){var U=n.option,H=n.options,q=n.removedValue,W=n.removedValues,te=n.value,se=function(oe){return Array.isArray(oe)?null:oe},B=q||U||se(te),L=B?f(B):"",_=H||W||void 0,ne=_?_.map(f):[],re=$({isDisabled:B&&b(B,c),label:L,labels:ne},n);V=N.onChange(re)}return V},[n,N,b,c,f]),k=m.useMemo(function(){var V="",U=r||s,H=!!(r&&c&&c.includes(r));if(U&&N.onFocus){var q={focused:U,label:f(U),isDisabled:b(U,c),isSelected:H,options:a,context:U===r?"menu":"value",selectValue:c,isAppleDevice:d};V=N.onFocus(q)}return V},[r,s,f,b,N,a,c,d]),O=m.useMemo(function(){var V="";if(x&&v.length&&!C&&N.onFilter){var U=w({count:a.length});V=N.onFilter({inputValue:p,resultsMessage:U})}return V},[a,p,x,N,v,w,C]),T=n?.action==="initial-input-focus",R=m.useMemo(function(){var V="";if(N.guidance){var U=s?"value":x?"menu":"input";V=N.guidance({"aria-label":j,context:U,isDisabled:r&&b(r,c),isMulti:g,isSearchable:y,tabSelectsValue:E,isInitialFocus:T})}return V},[j,r,s,g,b,y,x,N,c,E,T]),D=F(m.Fragment,null,F("span",{id:"aria-selection"},P),F("span",{id:"aria-focused"},k),F("span",{id:"aria-results"},O),F("span",{id:"aria-guidance"},R));return F(m.Fragment,null,F(wo,{id:u},T&&D),F(wo,{"aria-live":S,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},o&&!T&&D))},Cg=wg,ws=[{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źẑżžẓẕƶȥɀⱬꝣ"}],Sg=new RegExp("["+ws.map(function(e){return e.letters}).join("")+"]","g"),Jc={};for(var Hr=0;Hr<ws.length;Hr++)for(var Wr=ws[Hr],Gr=0;Gr<Wr.letters.length;Gr++)Jc[Wr.letters[Gr]]=Wr.base;var Kc=function(t){return t.replace(Sg,function(n){return Jc[n]})},jg=bg(Kc),Co=function(t){return t.replace(/^\s+|\s+$/g,"")},Ng=function(t){return"".concat(t.label," ").concat(t.value)},Eg=function(t){return function(n,r){if(n.data.__isNew__)return!0;var s=$({ignoreCase:!0,ignoreAccents:!0,stringify:Ng,trim:!0,matchFrom:"any"},t),a=s.ignoreCase,o=s.ignoreAccents,c=s.stringify,l=s.trim,u=s.matchFrom,d=l?Co(r):r,h=l?Co(c(n)):c(n);return a&&(d=d.toLowerCase(),h=h.toLowerCase()),o&&(d=jg(d),h=Kc(h)),u==="start"?h.substr(0,d.length)===d:h.indexOf(d)>-1}},Pg=["innerRef"];function Og(e){var t=e.innerRef,n=_e(e,Pg),r=tm(n,"onExited","in","enter","exit","appear");return F("input",z({ref:t},r,{css:ha({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 Ig=function(t){t.cancelable&&t.preventDefault(),t.stopPropagation()};function kg(e){var t=e.isEnabled,n=e.onBottomArrive,r=e.onBottomLeave,s=e.onTopArrive,a=e.onTopLeave,o=m.useRef(!1),c=m.useRef(!1),l=m.useRef(0),u=m.useRef(null),d=m.useCallback(function(y,x){if(u.current!==null){var v=u.current,w=v.scrollTop,E=v.scrollHeight,C=v.clientHeight,j=u.current,S=x>0,N=E-C-w,P=!1;N>x&&o.current&&(r&&r(y),o.current=!1),S&&c.current&&(a&&a(y),c.current=!1),S&&x>N?(n&&!o.current&&n(y),j.scrollTop=E,P=!0,o.current=!0):!S&&-x>w&&(s&&!c.current&&s(y),j.scrollTop=0,P=!0,c.current=!0),P&&Ig(y)}},[n,r,s,a]),h=m.useCallback(function(y){d(y,y.deltaY)},[d]),f=m.useCallback(function(y){l.current=y.changedTouches[0].clientY},[]),p=m.useCallback(function(y){var x=l.current-y.changedTouches[0].clientY;d(y,x)},[d]),g=m.useCallback(function(y){if(y){var x=Xp?{passive:!1}:!1;y.addEventListener("wheel",h,x),y.addEventListener("touchstart",f,x),y.addEventListener("touchmove",p,x)}},[p,f,h]),b=m.useCallback(function(y){y&&(y.removeEventListener("wheel",h,!1),y.removeEventListener("touchstart",f,!1),y.removeEventListener("touchmove",p,!1))},[p,f,h]);return m.useEffect(function(){if(t){var y=u.current;return g(y),function(){b(y)}}},[t,g,b]),function(y){u.current=y}}var So=["boxSizing","height","overflow","paddingRight","position"],jo={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function No(e){e.cancelable&&e.preventDefault()}function Eo(e){e.stopPropagation()}function Po(){var e=this.scrollTop,t=this.scrollHeight,n=e+this.offsetHeight;e===0?this.scrollTop=1:n===t&&(this.scrollTop=e-1)}function Oo(){return"ontouchstart"in window||navigator.maxTouchPoints}var Io=!!(typeof window<"u"&&window.document&&window.document.createElement),Ft=0,pt={capture:!1,passive:!1};function Mg(e){var t=e.isEnabled,n=e.accountForScrollbars,r=n===void 0?!0:n,s=m.useRef({}),a=m.useRef(null),o=m.useCallback(function(l){if(Io){var u=document.body,d=u&&u.style;if(r&&So.forEach(function(g){var b=d&&d[g];s.current[g]=b}),r&&Ft<1){var h=parseInt(s.current.paddingRight,10)||0,f=document.body?document.body.clientWidth:0,p=window.innerWidth-f+h||0;Object.keys(jo).forEach(function(g){var b=jo[g];d&&(d[g]=b)}),d&&(d.paddingRight="".concat(p,"px"))}u&&Oo()&&(u.addEventListener("touchmove",No,pt),l&&(l.addEventListener("touchstart",Po,pt),l.addEventListener("touchmove",Eo,pt))),Ft+=1}},[r]),c=m.useCallback(function(l){if(Io){var u=document.body,d=u&&u.style;Ft=Math.max(Ft-1,0),r&&Ft<1&&So.forEach(function(h){var f=s.current[h];d&&(d[h]=f)}),u&&Oo()&&(u.removeEventListener("touchmove",No,pt),l&&(l.removeEventListener("touchstart",Po,pt),l.removeEventListener("touchmove",Eo,pt)))}},[r]);return m.useEffect(function(){if(t){var l=a.current;return o(l),function(){c(l)}}},[t,o,c]),function(l){a.current=l}}var Tg=function(t){var n=t.target;return n.ownerDocument.activeElement&&n.ownerDocument.activeElement.blur()},Ag={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function Rg(e){var t=e.children,n=e.lockEnabled,r=e.captureEnabled,s=r===void 0?!0:r,a=e.onBottomArrive,o=e.onBottomLeave,c=e.onTopArrive,l=e.onTopLeave,u=kg({isEnabled:s,onBottomArrive:a,onBottomLeave:o,onTopArrive:c,onTopLeave:l}),d=Mg({isEnabled:n}),h=function(p){u(p),d(p)};return F(m.Fragment,null,n&&F("div",{onClick:Tg,css:Ag}),t(h))}var Dg={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},Lg=function(t){var n=t.name,r=t.onFocus;return F("input",{required:!0,name:n,tabIndex:-1,"aria-hidden":"true",onFocus:r,css:Dg,value:"",onChange:function(){}})},Fg=Lg;function ma(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 $g(){return ma(/^iPhone/i)}function Xc(){return ma(/^Mac/i)}function zg(){return ma(/^iPad/i)||Xc()&&navigator.maxTouchPoints>1}function Vg(){return $g()||zg()}function Ug(){return Xc()||Vg()}var Bg=function(t){return t.label},_g=function(t){return t.label},Hg=function(t){return t.value},Wg=function(t){return!!t.isDisabled},Gg={clearIndicator:Im,container:ym,control:Lm,dropdownIndicator:Pm,group:Vm,groupHeading:Bm,indicatorsContainer:Cm,indicatorSeparator:Mm,input:Gm,loadingIndicator:Rm,loadingMessage:hm,menu:om,menuList:um,menuPortal:gm,multiValue:Km,multiValueLabel:Xm,multiValueRemove:Zm,noOptionsMessage:fm,option:ag,placeholder:cg,singleValue:dg,valueContainer:vm},qg={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%)"},Qg=4,Zc=4,Yg=38,Jg=Zc*2,Kg={baseUnit:Zc,controlHeight:Yg,menuGutter:Jg},qr={borderRadius:Qg,colors:qg,spacing:Kg},Xg={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:yo(),captureMenuScroll:!yo(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:Eg(),formatGroupLabel:Bg,getOptionLabel:_g,getOptionValue:Hg,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:Wg,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!Jp(),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 ko(e,t,n,r){var s=nl(e,t,n),a=rl(e,t,n),o=tl(e,t),c=ur(e,t);return{type:"option",data:t,isDisabled:s,isSelected:a,label:o,value:c,index:r}}function Kn(e,t){return e.options.map(function(n,r){if("options"in n){var s=n.options.map(function(o,c){return ko(e,o,t,c)}).filter(function(o){return To(e,o)});return s.length>0?{type:"group",data:n,options:s,index:r}:void 0}var a=ko(e,n,t,r);return To(e,a)?a:void 0}).filter(Zp)}function el(e){return e.reduce(function(t,n){return n.type==="group"?t.push.apply(t,ca(n.options.map(function(r){return r.data}))):t.push(n.data),t},[])}function Mo(e,t){return e.reduce(function(n,r){return r.type==="group"?n.push.apply(n,ca(r.options.map(function(s){return{data:s.data,id:"".concat(t,"-").concat(r.index,"-").concat(s.index)}}))):n.push({data:r.data,id:"".concat(t,"-").concat(r.index)}),n},[])}function Zg(e,t){return el(Kn(e,t))}function To(e,t){var n=e.inputValue,r=n===void 0?"":n,s=t.data,a=t.isSelected,o=t.label,c=t.value;return(!al(e)||!a)&&sl(e,{label:o,value:c,data:s},r)}function eb(e,t){var n=e.focusedValue,r=e.selectValue,s=r.indexOf(n);if(s>-1){var a=t.indexOf(n);if(a>-1)return n;if(s<t.length)return t[s]}return null}function tb(e,t){var n=e.focusedOption;return n&&t.indexOf(n)>-1?n:t[0]}var Qr=function(t,n){var r,s=(r=t.find(function(a){return a.data===n}))===null||r===void 0?void 0:r.id;return s||null},tl=function(t,n){return t.getOptionLabel(n)},ur=function(t,n){return t.getOptionValue(n)};function nl(e,t,n){return typeof e.isOptionDisabled=="function"?e.isOptionDisabled(t,n):!1}function rl(e,t,n){if(n.indexOf(t)>-1)return!0;if(typeof e.isOptionSelected=="function")return e.isOptionSelected(t,n);var r=ur(e,t);return n.some(function(s){return ur(e,s)===r})}function sl(e,t,n){return e.filterOption?e.filterOption(t,n):!0}var al=function(t){var n=t.hideSelectedOptions,r=t.isMulti;return n===void 0?r:n},nb=1,ol=(function(e){Uh(n,e);var t=Hh(n);function n(r){var s;if(zh(this,n),s=t.call(this,r),s.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},s.blockOptionHover=!1,s.isComposing=!1,s.commonProps=void 0,s.initialTouchX=0,s.initialTouchY=0,s.openAfterFocus=!1,s.scrollToFocusedOptionOnUpdate=!1,s.userIsDragging=void 0,s.controlRef=null,s.getControlRef=function(l){s.controlRef=l},s.focusedOptionRef=null,s.getFocusedOptionRef=function(l){s.focusedOptionRef=l},s.menuListRef=null,s.getMenuListRef=function(l){s.menuListRef=l},s.inputRef=null,s.getInputRef=function(l){s.inputRef=l},s.focus=s.focusInput,s.blur=s.blurInput,s.onChange=function(l,u){var d=s.props,h=d.onChange,f=d.name;u.name=f,s.ariaOnChange(l,u),h(l,u)},s.setValue=function(l,u,d){var h=s.props,f=h.closeMenuOnSelect,p=h.isMulti,g=h.inputValue;s.onInputChange("",{action:"set-value",prevInputValue:g}),f&&(s.setState({inputIsHiddenAfterUpdate:!p}),s.onMenuClose()),s.setState({clearFocusValueOnUpdate:!0}),s.onChange(l,{action:u,option:d})},s.selectOption=function(l){var u=s.props,d=u.blurInputOnSelect,h=u.isMulti,f=u.name,p=s.state.selectValue,g=h&&s.isOptionSelected(l,p),b=s.isOptionDisabled(l,p);if(g){var y=s.getOptionValue(l);s.setValue(p.filter(function(x){return s.getOptionValue(x)!==y}),"deselect-option",l)}else if(!b)h?s.setValue([].concat(ca(p),[l]),"select-option",l):s.setValue(l,"select-option");else{s.ariaOnChange(l,{action:"select-option",option:l,name:f});return}d&&s.blurInput()},s.removeValue=function(l){var u=s.props.isMulti,d=s.state.selectValue,h=s.getOptionValue(l),f=d.filter(function(g){return s.getOptionValue(g)!==h}),p=Ln(u,f,f[0]||null);s.onChange(p,{action:"remove-value",removedValue:l}),s.focusInput()},s.clearValue=function(){var l=s.state.selectValue;s.onChange(Ln(s.props.isMulti,[],null),{action:"clear",removedValues:l})},s.popValue=function(){var l=s.props.isMulti,u=s.state.selectValue,d=u[u.length-1],h=u.slice(0,u.length-1),f=Ln(l,h,h[0]||null);d&&s.onChange(f,{action:"pop-value",removedValue:d})},s.getFocusedOptionId=function(l){return Qr(s.state.focusableOptionsWithIds,l)},s.getFocusableOptionsWithIds=function(){return Mo(Kn(s.props,s.state.selectValue),s.getElementId("option"))},s.getValue=function(){return s.state.selectValue},s.cx=function(){for(var l=arguments.length,u=new Array(l),d=0;d<l;d++)u[d]=arguments[d];return Wp.apply(void 0,[s.props.classNamePrefix].concat(u))},s.getOptionLabel=function(l){return tl(s.props,l)},s.getOptionValue=function(l){return ur(s.props,l)},s.getStyles=function(l,u){var d=s.props.unstyled,h=Gg[l](u,d);h.boxSizing="border-box";var f=s.props.styles[l];return f?f(h,u):h},s.getClassNames=function(l,u){var d,h;return(d=(h=s.props.classNames)[l])===null||d===void 0?void 0:d.call(h,u)},s.getElementId=function(l){return"".concat(s.state.instancePrefix,"-").concat(l)},s.getComponents=function(){return pg(s.props)},s.buildCategorizedOptions=function(){return Kn(s.props,s.state.selectValue)},s.getCategorizedOptions=function(){return s.props.menuIsOpen?s.buildCategorizedOptions():[]},s.buildFocusableOptions=function(){return el(s.buildCategorizedOptions())},s.getFocusableOptions=function(){return s.props.menuIsOpen?s.buildFocusableOptions():[]},s.ariaOnChange=function(l,u){s.setState({ariaSelection:$({value:l},u)})},s.onMenuMouseDown=function(l){l.button===0&&(l.stopPropagation(),l.preventDefault(),s.focusInput())},s.onMenuMouseMove=function(l){s.blockOptionHover=!1},s.onControlMouseDown=function(l){if(!l.defaultPrevented){var u=s.props.openMenuOnClick;s.state.isFocused?s.props.menuIsOpen?l.target.tagName!=="INPUT"&&l.target.tagName!=="TEXTAREA"&&s.onMenuClose():u&&s.openMenu("first"):(u&&(s.openAfterFocus=!0),s.focusInput()),l.target.tagName!=="INPUT"&&l.target.tagName!=="TEXTAREA"&&l.preventDefault()}},s.onDropdownIndicatorMouseDown=function(l){if(!(l&&l.type==="mousedown"&&l.button!==0)&&!s.props.isDisabled){var u=s.props,d=u.isMulti,h=u.menuIsOpen;s.focusInput(),h?(s.setState({inputIsHiddenAfterUpdate:!d}),s.onMenuClose()):s.openMenu("first"),l.preventDefault()}},s.onClearIndicatorMouseDown=function(l){l&&l.type==="mousedown"&&l.button!==0||(s.clearValue(),l.preventDefault(),s.openAfterFocus=!1,l.type==="touchend"?s.focusInput():setTimeout(function(){return s.focusInput()}))},s.onScroll=function(l){typeof s.props.closeMenuOnScroll=="boolean"?l.target instanceof HTMLElement&&Ir(l.target)&&s.props.onMenuClose():typeof s.props.closeMenuOnScroll=="function"&&s.props.closeMenuOnScroll(l)&&s.props.onMenuClose()},s.onCompositionStart=function(){s.isComposing=!0},s.onCompositionEnd=function(){s.isComposing=!1},s.onTouchStart=function(l){var u=l.touches,d=u&&u.item(0);d&&(s.initialTouchX=d.clientX,s.initialTouchY=d.clientY,s.userIsDragging=!1)},s.onTouchMove=function(l){var u=l.touches,d=u&&u.item(0);if(d){var h=Math.abs(d.clientX-s.initialTouchX),f=Math.abs(d.clientY-s.initialTouchY),p=5;s.userIsDragging=h>p||f>p}},s.onTouchEnd=function(l){s.userIsDragging||(s.controlRef&&!s.controlRef.contains(l.target)&&s.menuListRef&&!s.menuListRef.contains(l.target)&&s.blurInput(),s.initialTouchX=0,s.initialTouchY=0)},s.onControlTouchEnd=function(l){s.userIsDragging||s.onControlMouseDown(l)},s.onClearIndicatorTouchEnd=function(l){s.userIsDragging||s.onClearIndicatorMouseDown(l)},s.onDropdownIndicatorTouchEnd=function(l){s.userIsDragging||s.onDropdownIndicatorMouseDown(l)},s.handleInputChange=function(l){var u=s.props.inputValue,d=l.currentTarget.value;s.setState({inputIsHiddenAfterUpdate:!1}),s.onInputChange(d,{action:"input-change",prevInputValue:u}),s.props.menuIsOpen||s.onMenuOpen()},s.onInputFocus=function(l){s.props.onFocus&&s.props.onFocus(l),s.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(s.openAfterFocus||s.props.openMenuOnFocus)&&s.openMenu("first"),s.openAfterFocus=!1},s.onInputBlur=function(l){var u=s.props.inputValue;if(s.menuListRef&&s.menuListRef.contains(document.activeElement)){s.inputRef.focus();return}s.props.onBlur&&s.props.onBlur(l),s.onInputChange("",{action:"input-blur",prevInputValue:u}),s.onMenuClose(),s.setState({focusedValue:null,isFocused:!1})},s.onOptionHover=function(l){if(!(s.blockOptionHover||s.state.focusedOption===l)){var u=s.getFocusableOptions(),d=u.indexOf(l);s.setState({focusedOption:l,focusedOptionId:d>-1?s.getFocusedOptionId(l):null})}},s.shouldHideSelectedOptions=function(){return al(s.props)},s.onValueInputFocus=function(l){l.preventDefault(),l.stopPropagation(),s.focus()},s.onKeyDown=function(l){var u=s.props,d=u.isMulti,h=u.backspaceRemovesValue,f=u.escapeClearsValue,p=u.inputValue,g=u.isClearable,b=u.isDisabled,y=u.menuIsOpen,x=u.onKeyDown,v=u.tabSelectsValue,w=u.openMenuOnFocus,E=s.state,C=E.focusedOption,j=E.focusedValue,S=E.selectValue;if(!b&&!(typeof x=="function"&&(x(l),l.defaultPrevented))){switch(s.blockOptionHover=!0,l.key){case"ArrowLeft":if(!d||p)return;s.focusValue("previous");break;case"ArrowRight":if(!d||p)return;s.focusValue("next");break;case"Delete":case"Backspace":if(p)return;if(j)s.removeValue(j);else{if(!h)return;d?s.popValue():g&&s.clearValue()}break;case"Tab":if(s.isComposing||l.shiftKey||!y||!v||!C||w&&s.isOptionSelected(C,S))return;s.selectOption(C);break;case"Enter":if(l.keyCode===229)break;if(y){if(!C||s.isComposing)return;s.selectOption(C);break}return;case"Escape":y?(s.setState({inputIsHiddenAfterUpdate:!1}),s.onInputChange("",{action:"menu-close",prevInputValue:p}),s.onMenuClose()):g&&f&&s.clearValue();break;case" ":if(p)return;if(!y){s.openMenu("first");break}if(!C)return;s.selectOption(C);break;case"ArrowUp":y?s.focusOption("up"):s.openMenu("last");break;case"ArrowDown":y?s.focusOption("down"):s.openMenu("first");break;case"PageUp":if(!y)return;s.focusOption("pageup");break;case"PageDown":if(!y)return;s.focusOption("pagedown");break;case"Home":if(!y)return;s.focusOption("first");break;case"End":if(!y)return;s.focusOption("last");break;default:return}l.preventDefault()}},s.state.instancePrefix="react-select-"+(s.props.instanceId||++nb),s.state.selectValue=go(r.value),r.menuIsOpen&&s.state.selectValue.length){var a=s.getFocusableOptionsWithIds(),o=s.buildFocusableOptions(),c=o.indexOf(s.state.selectValue[0]);s.state.focusableOptionsWithIds=a,s.state.focusedOption=o[c],s.state.focusedOptionId=Qr(a,o[c])}return s}return Vh(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&&bo(this.menuListRef,this.focusedOptionRef),Ug()&&this.setState({isAppleDevice:!0})}},{key:"componentDidUpdate",value:function(s){var a=this.props,o=a.isDisabled,c=a.menuIsOpen,l=this.state.isFocused;(l&&!o&&s.isDisabled||l&&c&&!s.menuIsOpen)&&this.focusInput(),l&&o&&!s.isDisabled?this.setState({isFocused:!1},this.onMenuClose):!l&&!o&&s.isDisabled&&this.inputRef===document.activeElement&&this.setState({isFocused:!0}),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(bo(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(s,a){this.props.onInputChange(s,a)}},{key:"focusInput",value:function(){this.inputRef&&this.inputRef.focus()}},{key:"blurInput",value:function(){this.inputRef&&this.inputRef.blur()}},{key:"openMenu",value:function(s){var a=this,o=this.state,c=o.selectValue,l=o.isFocused,u=this.buildFocusableOptions(),d=s==="first"?0:u.length-1;if(!this.props.isMulti){var h=u.indexOf(c[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 a.onMenuOpen()})}},{key:"focusValue",value:function(s){var a=this.state,o=a.selectValue,c=a.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var l=o.indexOf(c);c||(l=-1);var u=o.length-1,d=-1;if(o.length){switch(s){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:o[d]})}}}},{key:"focusOption",value:function(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"first",a=this.props.pageSize,o=this.state.focusedOption,c=this.getFocusableOptions();if(c.length){var l=0,u=c.indexOf(o);o||(u=-1),s==="up"?l=u>0?u-1:c.length-1:s==="down"?l=(u+1)%c.length:s==="pageup"?(l=u-a,l<0&&(l=0)):s==="pagedown"?(l=u+a,l>c.length-1&&(l=c.length-1)):s==="last"&&(l=c.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:c[l],focusedValue:null,focusedOptionId:this.getFocusedOptionId(c[l])})}}},{key:"getTheme",value:(function(){return this.props.theme?typeof this.props.theme=="function"?this.props.theme(qr):$($({},qr),this.props.theme):qr})},{key:"getCommonProps",value:function(){var s=this.clearValue,a=this.cx,o=this.getStyles,c=this.getClassNames,l=this.getValue,u=this.selectOption,d=this.setValue,h=this.props,f=h.isMulti,p=h.isRtl,g=h.options,b=this.hasValue();return{clearValue:s,cx:a,getStyles:o,getClassNames:c,getValue:l,hasValue:b,isMulti:f,isRtl:p,options:g,selectOption:u,selectProps:h,setValue:d,theme:this.getTheme()}}},{key:"hasValue",value:function(){var s=this.state.selectValue;return s.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var s=this.props,a=s.isClearable,o=s.isMulti;return a===void 0?o:a}},{key:"isOptionDisabled",value:function(s,a){return nl(this.props,s,a)}},{key:"isOptionSelected",value:function(s,a){return rl(this.props,s,a)}},{key:"filterOption",value:function(s,a){return sl(this.props,s,a)}},{key:"formatOptionLabel",value:function(s,a){if(typeof this.props.formatOptionLabel=="function"){var o=this.props.inputValue,c=this.state.selectValue;return this.props.formatOptionLabel(s,{context:a,inputValue:o,selectValue:c})}else return this.getOptionLabel(s)}},{key:"formatGroupLabel",value:function(s){return this.props.formatGroupLabel(s)}},{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 s=this.props,a=s.isDisabled,o=s.isSearchable,c=s.inputId,l=s.inputValue,u=s.tabIndex,d=s.form,h=s.menuIsOpen,f=s.required,p=this.getComponents(),g=p.Input,b=this.state,y=b.inputIsHidden,x=b.ariaSelection,v=this.commonProps,w=c||this.getElementId("input"),E=$($($({"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")}),!o&&{"aria-readonly":!0}),this.hasValue()?x?.action==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return o?m.createElement(g,z({},v,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:w,innerRef:this.getInputRef,isDisabled:a,isHidden:y,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:u,form:d,type:"text",value:l},E)):m.createElement(Og,z({id:w,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:cr,onFocus:this.onInputFocus,disabled:a,tabIndex:u,inputMode:"none",form:d,value:""},E))})},{key:"renderPlaceholderOrValue",value:function(){var s=this,a=this.getComponents(),o=a.MultiValue,c=a.MultiValueContainer,l=a.MultiValueLabel,u=a.MultiValueRemove,d=a.SingleValue,h=a.Placeholder,f=this.commonProps,p=this.props,g=p.controlShouldRenderValue,b=p.isDisabled,y=p.isMulti,x=p.inputValue,v=p.placeholder,w=this.state,E=w.selectValue,C=w.focusedValue,j=w.isFocused;if(!this.hasValue()||!g)return x?null:m.createElement(h,z({},f,{key:"placeholder",isDisabled:b,isFocused:j,innerProps:{id:this.getElementId("placeholder")}}),v);if(y)return E.map(function(N,P){var k=N===C,O="".concat(s.getOptionLabel(N),"-").concat(s.getOptionValue(N));return m.createElement(o,z({},f,{components:{Container:c,Label:l,Remove:u},isFocused:k,isDisabled:b,key:O,index:P,removeProps:{onClick:function(){return s.removeValue(N)},onTouchEnd:function(){return s.removeValue(N)},onMouseDown:function(R){R.preventDefault()}},data:N}),s.formatOptionLabel(N,"value"))});if(x)return null;var S=E[0];return m.createElement(d,z({},f,{data:S,isDisabled:b}),this.formatOptionLabel(S,"value"))}},{key:"renderClearIndicator",value:function(){var s=this.getComponents(),a=s.ClearIndicator,o=this.commonProps,c=this.props,l=c.isDisabled,u=c.isLoading,d=this.state.isFocused;if(!this.isClearable()||!a||l||!this.hasValue()||u)return null;var h={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return m.createElement(a,z({},o,{innerProps:h,isFocused:d}))}},{key:"renderLoadingIndicator",value:function(){var s=this.getComponents(),a=s.LoadingIndicator,o=this.commonProps,c=this.props,l=c.isDisabled,u=c.isLoading,d=this.state.isFocused;if(!a||!u)return null;var h={"aria-hidden":"true"};return m.createElement(a,z({},o,{innerProps:h,isDisabled:l,isFocused:d}))}},{key:"renderIndicatorSeparator",value:function(){var s=this.getComponents(),a=s.DropdownIndicator,o=s.IndicatorSeparator;if(!a||!o)return null;var c=this.commonProps,l=this.props.isDisabled,u=this.state.isFocused;return m.createElement(o,z({},c,{isDisabled:l,isFocused:u}))}},{key:"renderDropdownIndicator",value:function(){var s=this.getComponents(),a=s.DropdownIndicator;if(!a)return null;var o=this.commonProps,c=this.props.isDisabled,l=this.state.isFocused,u={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return m.createElement(a,z({},o,{innerProps:u,isDisabled:c,isFocused:l}))}},{key:"renderMenu",value:function(){var s=this,a=this.getComponents(),o=a.Group,c=a.GroupHeading,l=a.Menu,u=a.MenuList,d=a.MenuPortal,h=a.LoadingMessage,f=a.NoOptionsMessage,p=a.Option,g=this.commonProps,b=this.state.focusedOption,y=this.props,x=y.captureMenuScroll,v=y.inputValue,w=y.isLoading,E=y.loadingMessage,C=y.minMenuHeight,j=y.maxMenuHeight,S=y.menuIsOpen,N=y.menuPlacement,P=y.menuPosition,k=y.menuPortalTarget,O=y.menuShouldBlockScroll,T=y.menuShouldScrollIntoView,R=y.noOptionsMessage,D=y.onMenuScrollToTop,V=y.onMenuScrollToBottom;if(!S)return null;var U=function(L,_){var ne=L.type,re=L.data,G=L.isDisabled,oe=L.isSelected,Pe=L.label,In=L.value,Wa=b===re,Ga=G?void 0:function(){return s.onOptionHover(re)},od=G?void 0:function(){return s.selectOption(re)},qa="".concat(s.getElementId("option"),"-").concat(_),id={id:qa,onClick:od,onMouseMove:Ga,onMouseOver:Ga,tabIndex:-1,role:"option","aria-selected":s.state.isAppleDevice?void 0:oe};return m.createElement(p,z({},g,{innerProps:id,data:re,isDisabled:G,isSelected:oe,key:qa,label:Pe,type:ne,value:In,isFocused:Wa,innerRef:Wa?s.getFocusedOptionRef:void 0}),s.formatOptionLabel(L.data,"menu"))},H;if(this.hasOptions())H=this.getCategorizedOptions().map(function(B){if(B.type==="group"){var L=B.data,_=B.options,ne=B.index,re="".concat(s.getElementId("group"),"-").concat(ne),G="".concat(re,"-heading");return m.createElement(o,z({},g,{key:re,data:L,options:_,Heading:c,headingProps:{id:G,data:B.data},label:s.formatGroupLabel(B.data)}),B.options.map(function(oe){return U(oe,"".concat(ne,"-").concat(oe.index))}))}else if(B.type==="option")return U(B,"".concat(B.index))});else if(w){var q=E({inputValue:v});if(q===null)return null;H=m.createElement(h,g,q)}else{var W=R({inputValue:v});if(W===null)return null;H=m.createElement(f,g,W)}var te={minMenuHeight:C,maxMenuHeight:j,menuPlacement:N,menuPosition:P,menuShouldScrollIntoView:T},se=m.createElement(im,z({},g,te),function(B){var L=B.ref,_=B.placerProps,ne=_.placement,re=_.maxHeight;return m.createElement(l,z({},g,te,{innerRef:L,innerProps:{onMouseDown:s.onMenuMouseDown,onMouseMove:s.onMenuMouseMove},isLoading:w,placement:ne}),m.createElement(Rg,{captureEnabled:x,onTopArrive:D,onBottomArrive:V,lockEnabled:O},function(G){return m.createElement(u,z({},g,{innerRef:function(Pe){s.getMenuListRef(Pe),G(Pe)},innerProps:{role:"listbox","aria-multiselectable":g.isMulti,id:s.getElementId("listbox")},isLoading:w,maxHeight:re,focusedOption:b}),H)}))});return k||P==="fixed"?m.createElement(d,z({},g,{appendTo:k,controlElement:this.controlRef,menuPlacement:N,menuPosition:P}),se):se}},{key:"renderFormField",value:function(){var s=this,a=this.props,o=a.delimiter,c=a.isDisabled,l=a.isMulti,u=a.name,d=a.required,h=this.state.selectValue;if(d&&!this.hasValue()&&!c)return m.createElement(Fg,{name:u,onFocus:this.onValueInputFocus});if(!(!u||c))if(l)if(o){var f=h.map(function(b){return s.getOptionValue(b)}).join(o);return m.createElement("input",{name:u,type:"hidden",value:f})}else{var p=h.length>0?h.map(function(b,y){return m.createElement("input",{key:"i-".concat(y),name:u,type:"hidden",value:s.getOptionValue(b)})}):m.createElement("input",{name:u,type:"hidden",value:""});return m.createElement("div",null,p)}else{var g=h[0]?this.getOptionValue(h[0]):"";return m.createElement("input",{name:u,type:"hidden",value:g})}}},{key:"renderLiveRegion",value:function(){var s=this.commonProps,a=this.state,o=a.ariaSelection,c=a.focusedOption,l=a.focusedValue,u=a.isFocused,d=a.selectValue,h=this.getFocusableOptions();return m.createElement(Cg,z({},s,{id:this.getElementId("live-region"),ariaSelection:o,focusedOption:c,focusedValue:l,isFocused:u,selectValue:d,focusableOptions:h,isAppleDevice:this.state.isAppleDevice}))}},{key:"render",value:function(){var s=this.getComponents(),a=s.Control,o=s.IndicatorsContainer,c=s.SelectContainer,l=s.ValueContainer,u=this.props,d=u.className,h=u.id,f=u.isDisabled,p=u.menuIsOpen,g=this.state.isFocused,b=this.commonProps=this.getCommonProps();return m.createElement(c,z({},b,{className:d,innerProps:{id:h,onKeyDown:this.onKeyDown},isDisabled:f,isFocused:g}),this.renderLiveRegion(),m.createElement(a,z({},b,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:f,isFocused:g,menuIsOpen:p}),m.createElement(l,z({},b,{isDisabled:f}),this.renderPlaceholderOrValue(),this.renderInput()),m.createElement(o,z({},b,{isDisabled:f}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(s,a){var o=a.prevProps,c=a.clearFocusValueOnUpdate,l=a.inputIsHiddenAfterUpdate,u=a.ariaSelection,d=a.isFocused,h=a.prevWasFocused,f=a.instancePrefix,p=s.options,g=s.value,b=s.menuIsOpen,y=s.inputValue,x=s.isMulti,v=go(g),w={};if(o&&(g!==o.value||p!==o.options||b!==o.menuIsOpen||y!==o.inputValue)){var E=b?Zg(s,v):[],C=b?Mo(Kn(s,v),"".concat(f,"-option")):[],j=c?eb(a,v):null,S=tb(a,E),N=Qr(C,S);w={selectValue:v,focusedOption:S,focusedOptionId:N,focusableOptionsWithIds:C,focusedValue:j,clearFocusValueOnUpdate:!1}}var P=l!=null&&s!==o?{inputIsHidden:l,inputIsHiddenAfterUpdate:void 0}:{},k=u,O=d&&h;return d&&!O&&(k={value:Ln(x,v,v[0]||null),options:v,action:"initial-input-focus"},O=!h),u?.action==="initial-input-focus"&&(k=null),$($($({},w),P),{},{prevProps:s,ariaSelection:k,prevWasFocused:O})}}]),n})(m.Component);ol.defaultProps=Xg;var rb=m.forwardRef(function(e,t){var n=$h(e);return m.createElement(ol,z({ref:t},n))}),sb=rb;function ab(e){return i.jsx(kr.DropdownIndicator,{...e,children:i.jsx(I,{name:"ChevronDown",size:16})})}function ob(e){return i.jsx(kr.ClearIndicator,{...e,children:i.jsx(I,{name:"Xmark",size:16})})}function ib(e){const{label:t,onClick:n,...r}=e,s=!!t&&!!n;return i.jsxs(kr.MenuList,{...r,children:[e.children,s?i.jsx("button",{className:"w-full px-2 py-3 hover:bg-slate-50",onClick:n,children:t}):null]})}function i2(e){const t=e["aria-invalid"]==="true",{addItemButtonProps:n,...r}=e;return i.jsx(sb,{...r,components:{DropdownIndicator:ab,ClearIndicator:ob,MenuList:s=>ib({...s,...n})},styles:{dropdownIndicator:()=>({label:"indicatorContainer",display:"flex",transition:"color 150ms",color:"var(color-gray-900)",padding:8,boxSizing:"border-box"}),clearIndicator:s=>({...s,color:"var(color-gray-900)"}),container:s=>({...s,borderColor:"var(color-gray-200)",fontSize:12}),placeholder:s=>({...s,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:(s,a)=>({...s,backgroundColor:a.isSelected?"var(--color-slate-50)":"var(--color-white)",color:"var(--color-gray-800)",":hover":{backgroundColor:"var(--color-slate-50)"}}),menuList:s=>({...s,padding:0,borderRadius:"6px"})},theme:s=>({...s,colors:{...s.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 c2=e=>{const{children:t,cookies:n,submitLabel:r,rejectLabel:s,onSubmit:a=()=>{},onReject:o=()=>{},...c}=e,[l,u]=m.useState(n),d=f=>{const{id:p,checked:g}=f.target;u(b=>b.map(y=>y.id===p?{...y,value:g}:y))},h="min-w-64 h-8 text-base";return i.jsxs("div",{...le(c,"flex flex-col items-center"),children:[i.jsx("div",{className:"text-center",children:t}),i.jsx("div",{className:"my-8 flex gap-x-16 text-sm font-medium",children:l.map((f,p)=>i.jsxs("div",{className:"cursor-pointer",children:[i.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"}),i.jsx("label",{className:"cursor-pointer select-none",htmlFor:f.id,children:f.label})]},p))}),i.jsxs("div",{className:"flex gap-x-8",children:[i.jsx(Ee,{className:h,color:"light",onClick:()=>o(),size:"small",children:s},"button-reject"),i.jsx(Ee,{className:h,onClick:()=>a(l),size:"small",children:r},"button-submit")]})]})},Ao="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 ga(e){const{body:t,header:n,children:r,onCancel:s,onOpenChange:a,onContinue:o,cancelLabel:c,continueLabel:l,overlayProps:u,contentProps:d,bodyProps:h={},headerProps:f={},containerProps:p={},cancelButtonProps:g={},continueButtonProps:b={},buttonContainerProps:y={},...x}=e;return i.jsx(De,{contentProps:{...d,className:M("rounded-3xl",d?.className)},onOpenChange:a,overlayProps:{...u,className:u?.className},...x,children:i.jsxs("div",{...le(p,"w-[400px] p-6 text-slate-300"),children:[i.jsx("div",{...le(f,"border-b border-slate-50 pb-2 text-2xl font-bold text-gray-800"),children:n}),i.jsxs("div",{...le(h,"my-6 rounded-md bg-slate-50 p-4 text-center"),children:[t,r]}),i.jsxs("div",{...le(y,"mt-8 flex justify-between gap-3"),children:[i.jsx("button",{onClick:s,...le(g,M(Ao,"flex-1 bg-slate-50 text-slate-800")),children:c}),i.jsx("button",{onClick:o,...le(b,M(Ao,"flex-1 bg-gray-800 text-gray-50")),children:l})]})]})})}const il=16;function Ro({label:e,depth:t,expanded:n,selected:r,hasChildren:s,icon:a,onToggle:o,onClick:c,children:l}){const u=d=>{d.stopPropagation(),o?.()};return i.jsxs("div",{children:[i.jsxs("div",{className:M("flex cursor-pointer items-center gap-1 py-1 pr-2 text-sm hover:bg-gray-100",r&&"bg-blue-50"),style:{paddingLeft:t*il+4},onClick:c,children:[s?i.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:i.jsx(I,{className:M("transition-transform",n&&"rotate-90"),name:"CaretRight",size:12})}):i.jsx("span",{className:"w-4 shrink-0"}),a&&i.jsx("span",{className:"shrink-0 text-gray-500",children:a}),i.jsx("span",{className:"min-w-0 flex-1 truncate text-gray-700",children:e}),r&&i.jsx("span",{className:"ml-auto h-2 w-2 shrink-0 rounded-full bg-blue-500"})]}),n&&l]})}function cb({column:e,depth:t}){const n=e.dataType.length>10?e.dataType.slice(0,10)+"…":e.dataType;return i.jsxs("div",{className:"flex items-center gap-1 py-0.5 pr-2 text-xs text-gray-500",style:{paddingLeft:t*il+4},children:[i.jsx("span",{className:"w-4 shrink-0"}),i.jsx("span",{className:"truncate",children:e.name}),i.jsxs("span",{className:"ml-auto shrink-0 text-gray-400",children:["(",n,")"]})]})}function lb({schema:e,tables:t,selectedTable:n,onSelectTable:r,onRefresh:s,loading:a}){const[o,c]=m.useState({[e]:!0}),l=f=>{c(p=>({...p,[f]:!p[f]}))},u=f=>{r(f),c(p=>({...p,[f]:!p[f]}))},d=o[e]??!1,h=f=>{f.stopPropagation(),s?.()};return i.jsx("div",{className:"flex flex-col overflow-auto pt-4 text-sm",children:i.jsx(Ro,{depth:0,expanded:d,hasChildren:t.length>0,icon:i.jsx(I,{name:d?"FolderOpen":"FolderClose",size:16}),label:i.jsxs("div",{className:"flex flex-1 items-center",children:[i.jsx("span",{className:"truncate",children:e}),s&&i.jsx("button",{className:"ml-auto p-0.5 text-gray-400 hover:text-gray-600",onClick:h,type:"button",disabled:a,children:i.jsx(I,{name:"Reload",size:14,className:a?"animate-spin":void 0})})]}),onClick:()=>l(e),onToggle:()=>l(e),children:t.map(f=>{const p=o[f.name]??!1,g=n===f.name;return i.jsx(Ro,{depth:1,expanded:p,hasChildren:f.columns.length>0,icon:i.jsx(I,{name:"TreeViewSlash",size:16}),label:f.name,selected:g,onClick:()=>u(f.name),onToggle:()=>l(f.name),children:f.columns.map(b=>i.jsx(cb,{column:b,depth:2},b.name))},f.name)})})})}function ub(e){return m.forwardRef(e)}const vt=ub(function(t,n){const{items:r,value:s,id:a,onChange:o,containerClassName:c,menuClassName:l,itemClassName:u,absolutePositionMenu:d=!1,borderRadius:h="6px"}=t,[f,p]=m.useState(!1),g=y(s)??r[0];function b(v){v.disabled||(o(v.value),p(!1))}function y(v){return r.find(w=>w.value===v)}const x=r.filter(v=>v.value!==s);return i.jsxs("div",{className:M("border border-gray-200 bg-gray-50 text-gray-800 transition-[border-radius]",d&&"relative",c),"data-open":f,ref:n,style:{borderRadius:h},children:[i.jsxs("div",{className:M("flex min-w-[360px] cursor-pointer items-center justify-between pr-3 text-gray-800 outline-none",l),id:a,onClick:()=>p(!f),children:[i.jsx(Do,{...g,className:u}),i.jsx(I,{className:sa("transition",f?"":"-rotate-90"),name:"ChevronDown"})]}),i.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:x.map(v=>i.jsx(Do,{...v,className:u,onItemClick:()=>b(v)},v.value))})]})});function Do(e){const{className:t,disabled:n,onItemClick:r,icon:s,displayValue:a,value:o,description:c}=e;return i.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:r,children:[s,i.jsxs("div",{children:[i.jsx("p",{className:"capitalize text-inherit",children:a??o.toLowerCase()}),i.jsx("p",{className:"text-xs text-gray-600",children:c})]})]})}function Lo(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 db(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 fb({clause:e,columns:t,onUpdate:n,onRemove:r,showConnector:s,connector:a,onConnectorChange:o}){const c=t.find(x=>x.name===e.column),l=c?Lo(c):["=","!="],u=c?db(c,e.operator):"text",d=e.operator!=="IS NULL"&&e.operator!=="IS NOT NULL",h=m.useMemo(()=>t.map(x=>({value:x.name,displayValue:x.name})),[t]),f=m.useMemo(()=>l.map(x=>({value:x,displayValue:x})),[l]),p=m.useMemo(()=>[{value:"AND",displayValue:"AND"},{value:"OR",displayValue:"OR"}],[]),g=m.useCallback(x=>{const v=t.find(C=>C.name===x);if(!v)return;const w=Lo(v),E=w.includes(e.operator)?e.operator:w[0];n({...e,column:x,operator:E,value:""})},[e,t,n]),b=m.useCallback(x=>{n({...e,operator:x,value:x==="IS NULL"||x==="IS NOT NULL"?"":e.value})},[e,n]),y=m.useCallback(x=>{n({...e,value:x})},[e,n]);return i.jsxs("div",{className:"flex items-center gap-2",children:[s&&i.jsx(vt,{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:a,onChange:o}),i.jsx(vt,{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}),i.jsx(vt,{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:b}),d&&i.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:x=>y(x.target.value)}),i.jsx("button",{className:"flex items-center justify-center rounded p-1 text-gray-500 hover:bg-gray-200 hover:text-gray-700",onClick:r,title:"Remove filter",type:"button",children:i.jsx(I,{name:"Xmark",size:14})})]})}function hb({columns:e,filters:t,onFiltersChange:n}){const[r,s]=m.useState(!1),a=m.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:[]}),s(!0)},[e,t,n]),o=m.useCallback((d,h)=>{if(!t)return;const f=[...t.clauses];f[d]=h,n({...t,clauses:f})},[t,n]),c=m.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=m.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 i.jsxs("div",{className:"flex shrink-0 flex-col gap-2 rounded-lg border border-gray-300 bg-white p-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("button",{className:"flex items-center gap-1 text-xs text-gray-700 hover:text-gray-900",onClick:()=>s(!r),type:"button",children:[i.jsx(I,{className:M("transition-transform",r&&"rotate-90"),name:"ChevronDown",size:12}),i.jsx("span",{children:"Filters"}),u&&i.jsx("span",{className:"rounded bg-blue-100 px-1.5 py-0.5 text-xs text-blue-700",children:t.clauses.length})]}),i.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:a,type:"button",children:[i.jsx(I,{name:"Plus",size:12}),"Add Filter"]})]}),r&&u&&i.jsx("div",{className:"flex flex-col gap-2",children:t.clauses.map((d,h)=>i.jsx(fb,{clause:d,columns:e,connector:h>0?t.connectors[h-1]??"AND":"AND",onConnectorChange:f=>l(h-1,f),onRemove:()=>c(h),onUpdate:f=>o(h,f),showConnector:h>0},d.id))})]})}function Cs(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 cl(e){return e.includes(",")||e.includes(`
7
+ `)||e.includes('"')?`"${e.replace(/"/g,'""')}"`:e}function ll(e,t){return t.map(n=>{const r=Cs(e[n.name]);return cl(r)}).join(",")}function ul(e,t){const n=t.map(s=>cl(s.name)).join(","),r=e.map(s=>ll(s,t));return[n,...r].join(`
8
+ `)}async function Fo(e){await navigator.clipboard.writeText(e)}function pb({direction:e,active:t}){return t?i.jsx(I,{className:e==="asc"?"rotate-180":void 0,name:"TriangleDown",size:12}):i.jsx(I,{className:"opacity-0 group-hover:opacity-50",name:"CaretSort",size:12})}function mb({columns:e,rows:t,pagination:n,onPageChange:r,onSort:s,currentSort:a,loading:o=!1,filters:c,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,b=f===0?0:d+1,y=f!==null?Math.min(d+h,f):d+t.length,x=O=>{r(O*h)},v=O=>{if(!s)return;const T=a?.column===O&&a.direction==="asc"?"desc":"asc";s({column:O,direction:T})},E=(()=>{if(g<=3)return Array.from({length:g},(V,U)=>U);const T=Math.max(0,Math.min(p-1,g-3)),R=Math.min(g-1,T+3-1),D=[];for(let V=T;V<=R;V++)D.push(V);return D})(),[C,j]=m.useState(!1),[S,N]=m.useState(null),P=async()=>{if(t.length!==0){j(!0);try{const O=u?await u():ul(t,e);await Fo(O),setTimeout(()=>j(!1),1e3)}catch(O){console.error("Failed to copy to clipboard:",O),j(!1)}}},k=async O=>{if(!(O<0||O>=t.length)){N(O);try{const T=ll(t[O],e);await Fo(T),setTimeout(()=>N(null),1e3)}catch(T){console.error("Failed to copy to clipboard:",T),N(null)}}};return i.jsxs("div",{className:"flex h-full flex-col gap-2",children:[l&&i.jsx(hb,{columns:e,filters:c,onFiltersChange:l}),i.jsxs("div",{className:"flex shrink-0 items-center justify-between text-sm",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-gray-600",children:o?"Loading...":f!==null?`Showing ${b.toLocaleString()}-${y.toLocaleString()} of ${f.toLocaleString()}`:`Showing ${t.length.toLocaleString()} rows`}),t.length>0&&i.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:o||C,onClick:P,title:"Copy all rows as CSV",type:"button",children:[i.jsx(I,{name:C?"Check":"Copy",size:14}),C?"Copied!":"Copy All"]})]}),f!==null&&f>h&&i.jsxs("div",{className:"flex gap-1",children:[i.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:()=>x(0),type:"button",children:"First"}),i.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:()=>x(p-1),type:"button",children:i.jsx(I,{className:"rotate-90",name:"ChevronDown",size:14})}),E[0]>0&&i.jsx("span",{className:"flex items-center px-1 text-xs text-gray-500",children:"..."}),E.map(O=>i.jsx("button",{className:M("min-w-8 rounded border px-2 py-1 text-xs",O===p?"border-blue-500 bg-blue-50 text-blue-700":"border-gray-300 bg-white text-gray-700 hover:bg-gray-100"),onClick:()=>x(O),type:"button",children:O+1},O)),E[E.length-1]<g-1&&i.jsx("span",{className:"flex items-center px-1 text-xs text-gray-500",children:"..."}),i.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:()=>x(p+1),type:"button",children:i.jsx(I,{className:"-rotate-90",name:"ChevronDown",size:14})}),i.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:()=>x(g-1),type:"button",children:"Last"})]})]}),i.jsx("div",{className:M("max-h-full overflow-auto rounded-lg border border-gray-300 transition-opacity",o&&"pointer-events-none opacity-50"),children:i.jsxs("table",{className:"w-full border-collapse",children:[i.jsx("thead",{className:"sticky top-0 bg-gray-100",children:i.jsxs("tr",{children:[i.jsx("th",{className:"w-12 px-2 py-2 text-center text-xs font-medium text-gray-600",children:i.jsx("span",{className:"sr-only",children:"Copy"})}),e.map((O,T)=>{const R=a?.column===O.name,D=R?a.direction:"asc";return i.jsx("th",{className:M("group px-3 py-2 text-left text-xs font-medium text-gray-600",T>0&&"border-l border-gray-300",s&&"cursor-pointer hover:bg-gray-200 hover:text-gray-900"),onClick:()=>s&&v(O.name),children:i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"truncate",children:O.name}),s&&i.jsx(pb,{active:R,direction:D})]})},O.name)})]})}),i.jsx("tbody",{children:t.length===0?i.jsx("tr",{children:i.jsx("td",{className:"px-3 py-8 text-center text-sm text-gray-500",colSpan:e.length+1,children:"No data"})}):t.map((O,T)=>i.jsxs("tr",{className:"odd:bg-white even:bg-gray-50 hover:bg-blue-50",children:[i.jsx("td",{className:"px-2 py-2 text-center",children:i.jsx("button",{className:"flex items-center justify-center rounded p-1 text-gray-500 hover:bg-gray-200 hover:text-gray-700",onClick:()=>{k(T)},title:"Copy row as CSV",type:"button",children:i.jsx(I,{name:S===T?"Check":"Copy",size:14})})}),e.map((R,D)=>i.jsx("td",{className:M("px-3 py-2 text-xs text-gray-900",D>0&&"border-l border-gray-300"),children:i.jsx("span",{className:M("block truncate",O[R.name]===null&&"italic text-gray-400"),title:Cs(O[R.name]),children:Cs(O[R.name])})},R.name))]},T))})]})})]})}const gb=50;function bb({schema:e,getTables:t,getTableRows:n,getDefaultSort:r,pageSize:s=gb,onImportDb:a,onExportDb:o}){const c=m.useRef(null),[l,u]=m.useState([]),[d,h]=m.useState(!0),[f,p]=m.useState(),[g,b]=m.useState(null),[y,x]=m.useState({offset:0,limit:s,total:null}),[v,w]=m.useState(),[E,C]=m.useState(),[j,S]=m.useState(!1),[N,P]=m.useState(null),k=l.find(L=>L.name===f)?.columns??[],O=m.useCallback(async()=>{if(!f)return;S(!0);const L=await n(f,{schema:e,limit:y.limit,offset:y.offset,sort:v,filters:E});b(L),x(_=>({..._,total:L.total})),S(!1)},[f,e,y.limit,y.offset,v,E,n]),T=m.useCallback(async()=>{if(!f)return"";const L=y.total??1e6,_=await n(f,{schema:e,limit:L,offset:0,sort:v,filters:E});return ul(_.rows,k)},[f,e,y.total,v,E,n,k]),R=m.useCallback(async()=>{h(!0);const L=await t();return u(L),h(!1),L},[t]),D=m.useCallback(async()=>{const L=await R();if(f&&!L.some(_=>_.name===f)){p(void 0),b(null);return}f&&await O()},[R,f,O]);m.useEffect(()=>{R()},[R]),m.useEffect(()=>{f&&O()},[f,y.offset,v,E,O]);const V=L=>{L!==f&&(p(L),x(_=>({..._,offset:0,total:null})),w(r?.(L)),C(void 0),b(null))},U=L=>{x(_=>({..._,offset:L}))},H=L=>{w(L),x(_=>({..._,offset:0}))},q=()=>{c.current?.click()},W=L=>{const _=L.target.files?.[0];_&&(_.text().then(ne=>{P(ne)}),L.target.value="")},te=async()=>{N&&(p(void 0),b(null),await a?.(N),P(null),await R())},se=()=>{P(null)},B=()=>{o?.()};return i.jsxs("div",{className:"flex h-full",children:[i.jsx("input",{ref:c,type:"file",accept:".sql,.txt,text/plain",className:"hidden",onChange:W}),i.jsx(ga,{open:!!N,onOpenChange:L=>!L&&P(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:()=>{te()},continueButtonProps:{className:"bg-red-900 text-white hover:bg-red-800"}}),i.jsxs("div",{className:"flex w-64 shrink-0 flex-col border-r border-gray-200",children:[i.jsx("div",{className:"flex-1 overflow-auto",children:i.jsx(lb,{schema:e,tables:l,selectedTable:f,onSelectTable:V,onRefresh:D,loading:d||j})}),(a||o)&&i.jsxs("div",{className:"flex shrink-0 flex-col gap-2 border-t border-gray-200 p-2",children:[a&&i.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"}),o&&i.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:B,type:"button",children:"Export DB"})]})]}),i.jsx("div",{className:"flex-1 overflow-auto p-4",children:f?!g&&j?i.jsx("div",{className:"text-sm text-gray-500",children:"Loading..."}):g?i.jsx(mb,{columns:k,rows:g.rows,pagination:y,onPageChange:U,onSort:H,currentSort:v,loading:j,filters:E,onFiltersChange:L=>{C(L),x(_=>({..._,offset:0}))},onCopyAll:T}):null:i.jsx("div",{className:"text-sm text-gray-500",children:"Select a table to view data"})})]})}function l2(e){const{message:t="Loading editor",...n}=e;return i.jsx("div",{className:"grid h-full place-items-center",...n,children:i.jsxs("div",{className:"-mt-20 grid place-items-center",children:[i.jsx("h3",{className:"mb-4 text-xl",children:t}),i.jsx(Mh,{})]})})}function dr(e){const{title:t,isOpen:n,onOpenChange:r,children:s,containerClassName:a,toggleClassName:o,contentClassName:c}=e;return i.jsxs("div",{className:M(a),children:[i.jsxs("div",{className:M("flex cursor-pointer justify-between text-gray-500",o),onClick:r,children:[i.jsx("h2",{className:"font-semibold text-inherit",children:t}),i.jsx(I,{className:sa("transition",n?"":"-rotate-90"),size:16,name:"ChevronDown"})]}),i.jsx("div",{className:M("max-h-0 overflow-hidden transition-[max-height] duration-300 ease-in-out",n&&"max-h-screen",c),children:s})]})}function bt(e){return i.jsx("div",{...e,className:M("h-px bg-gray-200",e.className)})}function Ut(e){const{label:t,children:n}=e;return i.jsx("div",{className:"h-full",children:n})}var Mr="Tabs",[yb]=Wi(Mr,[Yi]),dl=Yi(),[xb,ba]=yb(Mr),fl=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:a,orientation:o="horizontal",dir:c,activationMode:l="automatic",...u}=e,d=Rd(c),[h,f]=Qi({prop:r,onChange:s,defaultProp:a??"",caller:Mr});return i.jsx(xb,{scope:n,baseId:qi(),value:h,onValueChange:f,orientation:o,dir:d,activationMode:l,children:i.jsx(Ot.div,{dir:d,"data-orientation":o,...u,ref:t})})});fl.displayName=Mr;var hl="TabsList",pl=m.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...s}=e,a=ba(hl,n),o=dl(n);return i.jsx(Dd,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:i.jsx(Ot.div,{role:"tablist","aria-orientation":a.orientation,...s,ref:t})})});pl.displayName=hl;var ml="TabsTrigger",gl=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...a}=e,o=ba(ml,n),c=dl(n),l=xl(o.baseId,r),u=vl(o.baseId,r),d=r===o.value;return i.jsx(Ld,{asChild:!0,...c,focusable:!s,active:d,children:i.jsx(Ot.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:l,...a,ref:t,onMouseDown:$e(e.onMouseDown,h=>{!s&&h.button===0&&h.ctrlKey===!1?o.onValueChange(r):h.preventDefault()}),onKeyDown:$e(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&o.onValueChange(r)}),onFocus:$e(e.onFocus,()=>{const h=o.activationMode!=="manual";!d&&!s&&h&&o.onValueChange(r)})})})});gl.displayName=ml;var bl="TabsContent",yl=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:s,children:a,...o}=e,c=ba(bl,n),l=xl(c.baseId,r),u=vl(c.baseId,r),d=r===c.value,h=m.useRef(d);return m.useEffect(()=>{const f=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(f)},[]),i.jsx(ra,{present:s||d,children:({present:f})=>i.jsx(Ot.div,{"data-state":d?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":l,hidden:!f,id:u,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:f&&a})})});yl.displayName=bl;function xl(e,t){return`${e}-trigger-${t}`}function vl(e,t){return`${e}-content-${t}`}var vb=fl,wb=pl,Cb=gl,Sb=yl;function wl({children:e,defaultValue:t}){return i.jsxs(vb,{defaultValue:t,className:"flex min-h-0 flex-1 flex-col gap-2",children:[i.jsx("div",{className:"flex w-full shrink-0 justify-between",children:i.jsx(wb,{className:"flex w-full gap-x-2 rounded-xl bg-slate-50 p-1 text-sm font-semibold text-gray-600 outline-none",children:J.Children.map(e,(n,r)=>{if(!J.isValidElement(n))return;const{label:s,disabled:a}=n.props;return i.jsx(Cb,{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:s,disabled:a??!1,children:s},s)})})}),i.jsx("div",{className:"mt-3 min-h-0 flex-1 rounded-md bg-white",children:J.Children.map(e,(n,r)=>{if(!J.isValidElement(n))return;const{label:s}=n.props;return i.jsx(Sb,{className:"h-full",value:s,children:n},r)})})]})}function He(e){const{children:t,content:n,open:r,defaultOpen:s,onOpenChange:a,className:o,side:c="top",sideOffset:l=5,delayDuration:u,...d}=e;return i.jsxs(Nf,{defaultOpen:s,delayDuration:u,onOpenChange:a,open:r,children:[i.jsx(Ef,{asChild:!0,children:t}),i.jsx(Pf,{children:i.jsx(Of,{...d,side:c,sideOffset:l,className:M("shadow-tooltip rounded-lg border border-gray-200 bg-white p-2 text-xs",o),children:n})})]})}const Cl=jf,jb=e=>{const{className:t,timestampUtcMs:n,title:r,subtitle:s,onClick:a,isSelected:o=!1}=e,[c,l]=m.useState(!1),u=!!r||!!s||!!n;m.useEffect(()=>{c&&(l(!1),setTimeout(()=>u&&l(!0),50))},[r,s,n,u]);const d=g=>{if(!g)return"";try{return _0(new Date(g),{addSuffix:!0})}catch{return g}},h=i.jsxs("div",{className:"flex flex-col text-xs",children:[!!r&&i.jsx("div",{children:r}),!!s&&i.jsx("div",{className:"text-gray-300",children:s}),!!n&&i.jsx("div",{children:d(n)})]}),f=()=>{u&&l(!0)},p=()=>{l(!1)};return i.jsxs("div",{className:"relative",onMouseEnter:f,onMouseLeave:p,children:[o&&i.jsx(I,{name:"TimelineCaret",color:"#4EA9FF",size:10,className:"absolute top-[-11px] z-40"}),i.jsx(He,{className:"rounded-md bg-gray-900 text-white",content:h,open:c&&u,onOpenChange:l,delayDuration:0,side:"bottom",sideOffset:5,children:i.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",o&&"bg-blue-300",t),onClick:a,"data-title":r,"data-subtitle":s,"data-timestamp":n,children:i.jsx("div",{className:"h-0.5 w-1 rounded-full bg-gray-500"})})})]})},$o=(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]"}},Nb=e=>{if(!e)return"";try{const t=H0(e);return sr(t,"HH:mm, dd, MMMM")}catch{return e}},Eb=({onClick:e,className:t,timestampUtcMs:n,additions:r,deletions:s,addSize:a=0,delSize:o=0,isSelected:c=!1})=>{const[l,u]=m.useState(!1),d=a===0&&o===0,h=$o(a),f=$o(o),p=i.jsxs("div",{className:"flex flex-col text-xs",children:[i.jsx("div",{children:Nb(n)}),i.jsx("div",{className:"text-green-900",children:`${r} additions +`}),i.jsx("div",{className:"text-red-700",children:`${s} deletions -`})]}),g=()=>{d||u(!0)},b=()=>{u(!1)};return i.jsxs("div",{className:"relative",onMouseEnter:g,onMouseLeave:b,children:[c&&i.jsx(I,{name:"TimelineCaret",color:"#4EA9FF",size:10,className:"absolute left-[-2px] top-[-11px] z-40"}),d?i.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:i.jsx("div",{className:"size-[3px] rounded-full bg-gray-500"})}):i.jsx(He,{className:"rounded-md bg-gray-900 text-white",content:p,open:l,onOpenChange:u,delayDuration:0,side:"bottom",sideOffset:5,children:i.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,c&&"bg-blue-300"),"data-timestamp":n,onClick:e,children:[i.jsx("div",{className:"flex h-3 w-0.5 items-end",children:i.jsx("div",{className:M("h-3 w-0.5 rounded-t-full bg-green-600",h)})}),i.jsx("div",{className:"flex h-3 w-0.5 items-start",children:i.jsx("div",{className:M("h-3 w-0.5 rounded-b-full bg-red-600",f)})})]})})]})},zo={id:"default",type:"bar",addSize:0,delSize:0},Pb=e=>{const{timeline:t=[],onItemClick:n}=e,[r,s]=m.useState(null),a=m.useRef(null),o=p=>{p.id===r||p.id===zo.id?(n?.(null),s(null)):(n?.(p),s(p.id))},c=[...t,zo],[l,u]=m.useMemo(()=>{const p=c.findIndex(g=>g.id===r);return p===-1?[c,[]]:[c.slice(0,p),c.slice(p)]},[c,r]),d=m.useCallback(p=>p.map(g=>{if(g.type==="divider"){const{timestampUtcMs:b,title:y,subtitle:x}=g;return i.jsx(jb,{timestampUtcMs:b,title:y,subtitle:x,onClick:()=>o(g),isSelected:g.id===r},g.id)}return i.jsx(Eb,{timestampUtcMs:g.timestampUtcMs,addSize:g.addSize,delSize:g.delSize,additions:g.additions,deletions:g.deletions,isSelected:g.id===r,onClick:()=>o(g)},g.id)}),[o,r]),h=m.useMemo(()=>d(l),[l,d]),f=m.useMemo(()=>d(u),[u,d]);return m.useEffect(()=>{a.current&&(a.current.scrollLeft=a.current.scrollWidth)},[]),i.jsx(Cl,{delayDuration:0,skipDelayDuration:0,children:i.jsxs("div",{className:"relative h-[36px] w-full",children:[i.jsx("div",{className:"absolute left-[0px] z-[20] h-[17px] w-[6px] bg-white",children:i.jsx("div",{className:"mt-[11px] h-[6px] w-[6px] rounded-tl-md bg-slate-50"})}),i.jsx("div",{className:"absolute right-[0px] top-[11px] z-[20] h-[6px] w-[6px] bg-white",children:i.jsx("div",{className:"h-[6px] w-[6px] rounded-tr-md bg-slate-50"})}),i.jsx("div",{className:"absolute inset-x-0 bottom-0 h-[25px] rounded-md bg-slate-50"}),i.jsx("div",{className:"absolute inset-x-0 bottom-0 h-[36px]",children:i.jsx("div",{ref:a,className:"h-full overflow-x-auto rounded-md",children:i.jsxs("div",{className:"ml-auto flex h-[36px] w-max items-end px-2 pb-0",children:[i.jsx("div",{className:"flex",children:h}),i.jsx("div",{className:"flex rounded-sm bg-blue-200",children:f})]})})}),i.jsx("div",{className:"pointer-events-none absolute bottom-0 left-0 z-10 h-[25px] w-2 rounded-l-md bg-slate-50"}),i.jsx("div",{className:"pointer-events-none absolute bottom-0 right-0 z-10 h-[25px] w-2 rounded-r-md bg-slate-50"})]})})};function Ob(e){const[t,n]=dd(e),r=t?.header.revision.global??0,s=t?.header.revision.local??0,a=r>0||s>0,o=!!t?.clipboard.length;return{undo:()=>{n(Qd())},redo:()=>{n(qd())},canUndo:a,canRedo:o}}function Ib(e){return[]}const u2=e=>{const{onClose:t,children:n,onExport:r,className:s,document:a,onSwitchboardLinkClick:o,enabledControls:c=["undo","redo","export","history"],defaultTimelineVisible:l=!0,disableRevisionHistory:u=!1,initialTimelineVisible:d=!1,...h}=e,[f]=fd(),p=a??f,{onRenameNode:g,onRenameDriveNodes:b}=vr(),y=p?.header.name||void 0,[x,v]=m.useState(!1),w=hd(p?.header.id),E=t??(()=>Ct(w)),C=async W=>{W&&(r?r(W):await bd(W))},j=Ob(p?.header.id),S=!j.canUndo,N=!j.canRedo,P=Ib(p?.header.id),[k,O]=m.useState(d),T=pd(p),D=o??(T?async()=>{if(T)try{const W=await T();window.open(W,"_blank")}catch(W){console.error("Error opening switchboard link:",W)}}:void 0),V=!p,U=!D,H=P.length===0;m.useEffect(()=>{typeof d=="boolean"&&O(d)},[d]);const q=()=>{H||O(!k)};return i.jsxs("div",{className:"flex w-full flex-col",...h,children:[i.jsxs("div",{className:M("flex h-12 w-full items-center justify-between rounded-xl border border-gray-200 bg-slate-50 px-4",s),children:[i.jsxs("div",{className:"flex items-center gap-x-2",children:[c.includes("undo")&&i.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:i.jsx(I,{name:"ArrowCouterclockwise",size:16,className:S?"text-gray-500":"text-gray-900"})}),c.includes("redo")&&i.jsx("button",{className:M("grid size-8 place-items-center rounded-lg border border-gray-200 bg-white",N?"cursor-not-allowed":"cursor-pointer active:opacity-70"),onClick:j.redo,disabled:N,children:i.jsx("div",{className:"-scale-x-100",children:i.jsx(I,{name:"ArrowCouterclockwise",size:16,className:N?"text-gray-500":"text-gray-900"})})}),c.includes("export")&&i.jsx("button",{className:M("flex h-8 items-center rounded-lg border border-gray-200 bg-white px-3 text-sm",V?"cursor-not-allowed":"cursor-pointer active:opacity-70"),onClick:()=>{C(p)},disabled:V,children:i.jsx("span",{className:V?"text-gray-500":"text-gray-900",children:"Export"})})]}),i.jsx("div",{className:"flex items-center",children:x&&p?i.jsx(Nr,{defaultValue:y,className:"text-center text-sm font-medium text-gray-500","aria-label":"Document name",onCancel:()=>v(!1),onSubmit:W=>{const te={id:p.header.id};Promise.all([g(W,te),b(W,p.header.id)]).then(()=>v(!1)).catch(se=>{console.error("Failed to rename document:",se),v(!1)})}}):i.jsx("h1",{className:M("text-sm font-medium text-gray-500",p&&"cursor-pointer hover:text-gray-700"),onDoubleClick:p?()=>v(!0):void 0,title:p?"Double-click to edit":void 0,children:y})}),i.jsxs("div",{className:"flex items-center gap-x-2",children:[!U&&i.jsx("button",{className:M("grid size-8 place-items-center rounded-lg border border-gray-200 bg-white","cursor-pointer active:opacity-70"),onClick:D,disabled:U,children:i.jsx(I,{name:"Drive",size:16,className:"text-gray-900"})}),c.includes("history")&&i.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:md,disabled:u,children:i.jsx(I,{name:"History",size:16,className:u?"text-gray-500":"text-gray-900"})}),c.includes("timeline")&&l&&i.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:q,disabled:H,"aria-pressed":k,children:i.jsx(I,{name:"Timeline",size:16,className:M("text-gray-900",H&&"opacity-50",k&&"text-blue-600")})}),i.jsx("button",{id:"close-document-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:E,children:i.jsx(I,{name:"XmarkLight",size:16,className:"text-gray-900"})})]})]}),k&&i.jsx("div",{className:"mt-2 w-full",children:i.jsx(Pb,{timeline:P,onItemClick:gd})}),n]})};function Sl(e){const{target:t,onAddFileOverride:n,trackNestedDrag:r=!1,acceptedFileExtensions:s}=e??{},[a,o]=m.useState(!1),c=m.useRef(0),{onMoveNode:l,onCopyNode:u,onAddFile:d}=vr(),h=n??d,f=m.useCallback(v=>{if(!s||s.length===0||v.types.includes("UI_NODE"))return!0;if(v.types.includes("Files")){const w=Array.from(v.items);return w.length===0?!0:w.some(E=>{if(E.kind==="file"){if(E.type==="application/zip"||E.type==="application/x-zip-compressed")return s.includes(".zip");if(E.type===""||E.type==="application/octet-stream")return!0}return!1})}return!1},[s]),p=m.useCallback(v=>{v.preventDefault(),v.stopPropagation(),f(v.dataTransfer)?o(!0):v.dataTransfer.dropEffect="none"},[f]),g=m.useCallback(v=>{v.preventDefault(),v.stopPropagation(),f(v.dataTransfer)&&(c.current+=1,o(!0))},[f]),b=m.useCallback(v=>{v.preventDefault(),v.stopPropagation(),c.current=Math.max(0,c.current-1),c.current===0&&o(!1)},[]),y=m.useCallback(()=>{o(!1)},[]),x=m.useCallback(async v=>{v.preventDefault();const E=v.target.closest("[data-drop-zone]"),C=t?.id||"root";if((E?.getAttribute("data-drop-zone")||"root")!==C){o(!1);return}try{let S=kb(v.dataTransfer.items).filter(Boolean);if(s&&s.length>0&&(S=S.filter(O=>{if(!O)return!1;const T=O.name.toLowerCase();return s.some(R=>T.endsWith(R.toLowerCase()))})),S.length){for(const O of S)O&&await h(O,t);return}const N=v.getModifierState("Alt"),P=v.dataTransfer.getData("UI_NODE"),k=JSON.parse(P);N?await u(k,t):await l(k,t)}catch(S){console.error(S)}finally{r&&(c.current=0),o(!1)}},[h,u,l,t,r]);return m.useMemo(()=>{const v={onDragOver:p,onDrop:x,"data-drop-zone":t?.id||"root"};return r?(v.onDragEnter=g,v.onDragLeave=b):v.onDragLeave=y,{isDropTarget:a,dropProps:v}},[a,t?.id,g,b,y,p,x,r])}function kb(e){return Array.from(e).map(n=>n.kind==="file"?n.getAsFile():null).filter(Boolean)}const Vo="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 Mb(e){const{title:t="Document Already Exists",fileName:n,message:r,children:s,onReplace:a,onOpenChange:o,onDuplicate:c,replaceLabel:l="Replace",duplicateLabel:u="Create Copy",overlayProps:d,contentProps:h,bodyProps:f={},headerProps:p={},containerProps:g={},replaceButtonProps:b={},duplicateButtonProps:y={},buttonContainerProps:x={},...v}=e,w=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 i.jsx(De,{contentProps:{...h,className:M("rounded-3xl",h?.className)},onOpenChange:o,overlayProps:{...d,className:d?.className},...v,children:i.jsxs("div",{...le(g,"w-[450px] p-6 text-slate-300"),children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-slate-50 pb-2",children:[i.jsx("div",{...le(p,"text-2xl font-bold text-gray-800"),children:t}),i.jsx("button",{type:"button",className:"flex size-6 items-center justify-center rounded-md outline-none hover:bg-slate-100",onClick:()=>o?.(!1),children:i.jsx(I,{name:"XmarkLight",size:24})})]}),i.jsxs("div",{...le(f,"my-6 rounded-md bg-slate-50 p-4 text-center"),children:[r||w,s]}),i.jsxs("div",{...le(x,"mt-8 flex justify-between gap-3"),children:[i.jsx("button",{onClick:a,...le(b,M(Vo,"flex-1 bg-slate-50 text-slate-800")),children:l}),i.jsx("button",{onClick:c,...le(y,M(Vo,"flex-1 bg-gray-800 text-gray-50")),children:u})]})]})})}function Tb(e){const{status:t,errorDetails:n}=e;return(t==="failed"||t==="unsupported-document-type")&&n?i.jsx("div",{className:"break-words text-xs leading-[18px] text-gray-500",children:n}):null}function Ab(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 Rb(e){const{fileName:t,fileSize:n,documentType:r,onClose:s,...a}=e;return i.jsxs("div",{className:"flex items-center gap-2",...a,children:[i.jsx("div",{className:"flex h-9 w-7 flex-shrink-0 items-center justify-center",children:i.jsx(I,{name:Ab(r),size:48,className:"text-gray-600"})}),i.jsxs("div",{className:"flex flex-1 flex-col gap-0.5",children:[i.jsx("div",{className:"text-xs font-medium leading-[18px] text-gray-900",children:t}),i.jsx("div",{className:"text-xs font-medium leading-[18px] text-gray-500",children:n})]}),s&&i.jsx("div",{className:"flex h-9 w-[18px] flex-shrink-0 items-start justify-center",children:i.jsx("button",{type:"button",onClick:s,className:"flex h-[18px] w-[18px] items-center justify-center text-gray-600 hover:text-gray-800","aria-label":"Close",children:i.jsx(I,{name:"XmarkLight",size:18})})})]})}function Db(e){const{status:t,progress:n=0}=e;if(t!=="uploading")return null;const r=Math.min(100,Math.max(0,n));return i.jsx("div",{className:"h-2 w-full overflow-hidden rounded-sm bg-gray-200",children:i.jsx("div",{className:"h-full bg-blue-900 transition-all duration-300 ease-out",style:{width:`${r}%`}})})}function Lb(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 Fb(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 $b(e,t,n){return e==="success"&&!!t||e==="pending"&&!!n||e==="conflict"&&!!n}function zb(e){return e==="success"?"Open Document":e==="pending"||e==="conflict"?"Find resolution":""}function Vb(e){const{status:t,progress:n=0,onOpenDocument:r,onFindResolution:s}=e,a=()=>{t==="success"&&r?r():(t==="pending"||t==="conflict")&&s&&s()};return i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("div",{className:M("text-xs leading-[18px]",Fb(t)),children:Lb(t)}),t==="uploading"&&i.jsxs("div",{className:"text-xs font-medium leading-[18px] text-gray-900",children:[Math.round(n),"%"]}),$b(t,r,s)&&i.jsx("button",{type:"button",onClick:a,className:"text-xs leading-[18px] text-blue-900 hover:opacity-80",children:zb(t)})]})}const Ub=m.forwardRef(function(t,n){const{fileName:r,fileSize:s,status:a,documentType:o,progress:c=0,errorDetails:l,onClose:u,onOpenDocument:d,onFindResolution:h,className:f,...p}=t;return i.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:[i.jsx(Rb,{fileName:r,fileSize:s,documentType:o,onClose:u}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx(Vb,{status:a,progress:c,onOpenDocument:d,onFindResolution:h}),i.jsx(Db,{status:a,progress:c}),i.jsx(Tb,{status:a,errorDetails:l})]})]})});function Bb(e,t){return t||`Uploading ${e} document${e===1?"":"s"}`}function _b(e){const{items:t,title:n,defaultCollapsed:r=!1,onClose:s,className:a,...o}=e,[c,l]=m.useState(r),u=m.useMemo(()=>Bb(t.length,n),[t.length,n]);return i.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)]",a),...o,children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("button",{type:"button","aria-expanded":!c,"aria-label":c?"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}),i.jsxs("div",{className:"flex shrink-0 items-center gap-4",children:[i.jsx("button",{type:"button","aria-label":c?"Expand":"Collapse",onClick:()=>l(d=>!d),className:"text-gray-900 hover:opacity-80",children:i.jsx("span",{className:M("inline-block h-4 w-4 select-none transition-transform",c?"-rotate-90":"rotate-0"),children:i.jsx(I,{name:"CaretDown",size:16,"aria-hidden":"true"})})}),s&&i.jsx("button",{type:"button","aria-label":"Close",onClick:s,className:"text-gray-900 hover:opacity-80",children:i.jsx("span",{className:"inline-block h-4 w-4 select-none",children:i.jsx(I,{name:"XmarkLight",size:16,"aria-hidden":"true"})})})]})]}),!c&&i.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)=>i.jsx(Ub,{...d},`${d.fileName}-${h}`))})]})}function Hb(){return`upload_${Date.now()}_${Math.random().toString(36).substring(2,9)}`}function Wb(e){if(e===0)return"0 Bytes";const t=1024,n=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,r)).toFixed(2))} ${n[r]}`}function Gb(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 qb(e,t,n,r){return e.filter(s=>s!==void 0).map(s=>({fileName:s.fileName,fileSize:s.fileSize,status:s.status,progress:s.progress,errorDetails:s.errorDetails,documentType:s.documentType,onClose:()=>{t(s.id)},onOpenDocument:s.status==="success"?()=>{s.fileNode&&n?n(s.fileNode):console.error("Opening document for upload:",s.id,"- fileNode not available or setSelectedNode not provided")}:void 0,onFindResolution:s.status==="failed"?()=>{console.log("Finding resolution for upload:",s.id)}:s.status==="conflict"?()=>{console.log("Finding conflict resolution for upload:",s.id),r?.(s.id)}:void 0}))}function Qb(e){const{uploadsArray:t,uploadsCount:n,removeUpload:r,clearAllUploads:s,setSelectedNode:a,onClose:o,onConflictResolution:c,className:l,...u}=e;if(n===0)return null;const d=qb(t,r,a,c),h=o??s;return i.jsx("div",{className:M("fixed bottom-4 right-4 z-[1001]",l),...u,children:i.jsx(_b,{items:d,onClose:h})})}function Yb(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:Gb(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,...r}=e;return r}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[r,s]of Object.entries(e))s&&s.status!=="conflict"&&(n[r]=s);return n}default:return e}}function Jb(e=!1,t){const n=m.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]),[r,s]=m.useReducer(Yb,n());m.useEffect(()=>{if(e&&t)try{localStorage.setItem(`uploadTracker_${t}`,JSON.stringify(r))}catch(f){console.error("Failed to save upload tracker to localStorage:",f)}},[r,e,t]);const a=m.useCallback(f=>{if(f)return async(p,g)=>{const b=Hb();s({type:"ADD_UPLOAD",payload:{id:b,fileName:p.name,fileSize:Wb(p.size)}});const y=x=>{s({type:"UPDATE_PROGRESS",payload:{id:b,progress:x}}),x.stage==="conflict"&&s({type:"SET_CONFLICT_DATA",payload:{id:b,file:p,parentNode:g}})};try{const x=await f(p,g,y);s({type:"SET_FILE_NODE",payload:{id:b,fileNode:x||void 0}})}catch(x){s({type:"SET_ERROR",payload:{id:b,error:x instanceof Error?x.message:"Unknown error"}})}}},[]),o=m.useCallback(f=>{s({type:"REMOVE_UPLOAD",payload:{id:f}})},[]),c=m.useCallback(()=>{s({type:"CLEAR_ALL_UPLOADS"})},[]),l=m.useCallback(()=>{s({type:"CLEAR_CONFLICTED_UPLOADS"})},[]),u=m.useCallback(()=>Object.values(r),[r]),d=m.useCallback(()=>Object.keys(r).length,[r]),h=m.useCallback((f,p,g)=>{const b=r[f];if(!b?.file||!g){console.error("Cannot resolve conflict: missing upload data or onAddFile function");return}const y=v=>{s({type:"UPDATE_PROGRESS",payload:{id:f,progress:v}})},x=g(b.file,b.parentNode,y,p);Promise.resolve(x).then(v=>{v&&s({type:"SET_FILE_NODE",payload:{id:f,fileNode:v}})}).catch(v=>{s({type:"SET_ERROR",payload:{id:f,error:v instanceof Error?v.message:"Unknown error"}})})},[r]);return{uploads:r,uploadsArray:u(),uploadsCount:d(),createUploadHandler:a,removeUpload:o,clearAllUploads:c,clearConflictedUploads:l,resolveConflict:h}}function Kb(e){const{title:t="Drag your documents",subtitle:n="to drop them in the currently selected folder.",node:r,enable:s=!0,children:a,onAddFile:o,useLocalStorage:c=!1,driveId:l,acceptedFileExtensions:u=[".zip",".phd",".phdm"],className:d,...h}=e,[f,p]=m.useState(!1),[g,b]=m.useState(null),{uploadsArray:y,uploadsCount:x,createUploadHandler:v,clearAllUploads:w,clearConflictedUploads:E,removeUpload:C,resolveConflict:j}=Jb(c,l);m.useEffect(()=>{E()},[]);const S=v(o)??(async()=>{}),N=D=>{b(D),p(!0)},P=()=>{g&&o&&j(g,"replace",o),p(!1),b(null)},k=()=>{g&&o&&j(g,"duplicate",o),p(!1),b(null)},O=()=>{p(!1),b(null)},{isDropTarget:T,dropProps:R}=Sl({target:r,onAddFileOverride:S,trackNestedDrag:!0,acceptedFileExtensions:u});return i.jsxs("div",{className:M("relative",d),...s?R:{},...h,children:[a,s&&T&&i.jsx("div",{className:"fixed inset-0 z-[1000] flex min-h-screen w-screen items-center justify-center bg-black/50",children:i.jsx("div",{className:"rounded-[24px] bg-white p-6 shadow-[1px_4px_15px_rgba(74,88,115,0.25)]",children:i.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:[i.jsx("div",{className:"text-center text-base leading-5 text-zinc-500",children:t}),i.jsx("div",{className:"text-center text-base leading-5 text-zinc-500",children:n}),i.jsx("span",{className:"pointer-events-none absolute -bottom-16 left-1/2 z-10 -translate-x-1/2",children:i.jsx(I,{name:"DocumentIcons",size:144,"aria-hidden":"true"})})]})})}),i.jsx(Qb,{uploadsArray:y,uploadsCount:x,removeUpload:C,clearAllUploads:w,setSelectedNode:Ct,onConflictResolution:N}),i.jsx(Mb,{open:f,onOpenChange:O,fileName:g?y.find(D=>D?.id===g)?.fileName:void 0,onReplace:P,onDuplicate:k})]})}function d2({children:e,...t}){const n=yd(),r=_i(),s=xd(),a=async(o,c,l,u)=>await s(o,l,u);return!n||!r?i.jsx(i.Fragment,{children:e}):i.jsx(Kb,{onAddFile:a,driveId:r,useLocalStorage:!0,...t,children:e})}function Tr(e){const{children:t,items:n,open:r,onItemClick:s,onOpenChange:a,menuClassName:o}=e;return i.jsxs(Fd,{onOpenChange:a,open:r,children:[i.jsx($d,{asChild:!0,className:"outline-none",children:t}),i.jsx(zd,{className:M("modal-shadow cursor-pointer rounded-2xl bg-white text-sm font-medium text-slate-500",o),children:n.map(({id:c,label:l,icon:u,className:d})=>i.jsxs(Vd,{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:()=>s(c),children:[u?i.jsx("span",{className:"mr-2 inline-block",children:u}):null,l]},c))})]})}const Uo=[{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"}],Ss=[{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"}]}],jl=[{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"}],Xb=[...jl,{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"}]}],Zb=[...jl,{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"}]}],Bo=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}];function Ke(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new dy(e.type);return`${e.name}(${ya(e.inputs,{includeName:t})})`}function ya(e,{includeName:t=!1}={}){return e?e.map(n=>ey(n,{includeName:t})).join(t?", ":","):""}function ey(e,{includeName:t}){return e.type.startsWith("tuple")?`(${ya(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function ft(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function he(e){return ft(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const Nl="2.38.6";let Yr={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${Nl}`},A=class js extends Error{constructor(t,n={}){const r=n.cause instanceof js?n.cause.details:n.cause?.message?n.cause.message:n.details,s=n.cause instanceof js&&n.cause.docsPath||n.docsPath,a=Yr.getDocsUrl?.({...n,docsPath:s}),o=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...a?[`Docs: ${a}`]:[],...r?[`Details: ${r}`]:[],...Yr.version?[`Version: ${Yr.version}`]:[]].join(`
9
+ `);super(o,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=Nl}walk(t){return El(this,t)}};function El(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?El(e.cause,t):t?null:e}class ty extends A{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
+ `),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class _o extends A{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 ny extends A{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
12
+ `),{metaMessages:[`Params: (${ya(n,{includeName:!0})})`,`Data: ${t} (${r} 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=r}}class xa extends A{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class ry extends A{constructor({expectedLength:t,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
13
+ `),{name:"AbiEncodingArrayLengthMismatchError"})}}class sy extends A{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${he(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class ay extends A{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 oy extends A{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
+ `),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}}class Ho extends A{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 Pl extends A{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
+ `),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}}class Nt extends A{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 A{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 iy extends A{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 cy extends A{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${Ke(t.abiItem)}\`, and`,`\`${n.type}\` in \`${Ke(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class ly extends A{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 uy extends A{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 Il extends A{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
23
+ `),{name:"InvalidArrayError"})}}class dy extends A{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
24
+ `),{name:"InvalidDefinitionTypeError"})}}class it extends A{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 kl extends A{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}}let Ml=class extends A{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}};class Wo extends A{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${t} ${r} long.`,{name:"InvalidBytesLengthError"})}}function kt(e,{dir:t,size:n=32}={}){return typeof e=="string"?Qe(e,{dir:t,size:n}):fy(e,{dir:t,size:n})}function Qe(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new Ml({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function fy(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new Ml({size:e.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let s=0;s<n;s++){const a=t==="right";r[a?s:n-s-1]=e[a?s:e.length-s-1]}return r}let Tl=class extends A{constructor({max:t,min:n,signed:r,size:s,value:a}){super(`Number "${a}" is not in safe ${s?`${s*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}};class hy extends A{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 py extends A{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function va(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,r=0;for(let s=0;s<n.length-1&&n[t==="left"?s:n.length-s-1].toString()==="0";s++)r++;return n=t==="left"?n.slice(r):n.slice(0,n.length-r),typeof e=="string"?(n.length===1&&t==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}function Le(e,{size:t}){if(he(e)>t)throw new py({givenSize:he(e),maxSize:t})}function Al(e,t={}){const{signed:n}=t;t.size&&Le(e,{size:t.size});const r=BigInt(e);if(!n)return r;const s=(e.length-2)/2,a=(1n<<BigInt(s)*8n-1n)-1n;return r<=a?r:r-BigInt(`0x${"f".padStart(s*2,"f")}`)-1n}function my(e,t={}){return Number(Al(e,t))}const gy=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Rl(e,t={}){return typeof e=="number"||typeof e=="bigint"?ee(e,t):typeof e=="string"?wa(e,t):typeof e=="boolean"?Dl(e,t):Se(e,t)}function Dl(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(Le(n,{size:t.size}),kt(n,{size:t.size})):n}function Se(e,t={}){let n="";for(let s=0;s<e.length;s++)n+=gy[e[s]];const r=`0x${n}`;return typeof t.size=="number"?(Le(r,{size:t.size}),kt(r,{dir:"right",size:t.size})):r}function ee(e,t={}){const{signed:n,size:r}=t,s=BigInt(e);let a;r?n?a=(1n<<BigInt(r)*8n-1n)-1n:a=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(a=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof a=="bigint"&&n?-a-1n:0;if(a&&s>a||s<o){const l=typeof e=="bigint"?"n":"";throw new Tl({max:a?`${a}${l}`:void 0,min:`${o}${l}`,signed:n,size:r,value:`${e}${l}`})}const c=`0x${(n&&s<0?(1n<<BigInt(r*8))+BigInt(s):s).toString(16)}`;return r?kt(c,{size:r}):c}const by=new TextEncoder;function wa(e,t={}){const n=by.encode(e);return Se(n,t)}const yy=new TextEncoder;function Ca(e,t={}){return typeof e=="number"||typeof e=="bigint"?vy(e,t):typeof e=="boolean"?xy(e,t):ft(e)?Sa(e,t):nt(e,t)}function xy(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(Le(n,{size:t.size}),kt(n,{size:t.size})):n}const Fe={zero:48,nine:57,A:65,F:70,a:97,f:102};function Go(e){if(e>=Fe.zero&&e<=Fe.nine)return e-Fe.zero;if(e>=Fe.A&&e<=Fe.F)return e-(Fe.A-10);if(e>=Fe.a&&e<=Fe.f)return e-(Fe.a-10)}function Sa(e,t={}){let n=e;t.size&&(Le(n,{size:t.size}),n=kt(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const s=r.length/2,a=new Uint8Array(s);for(let o=0,c=0;o<s;o++){const l=Go(r.charCodeAt(c++)),u=Go(r.charCodeAt(c++));if(l===void 0||u===void 0)throw new A(`Invalid byte sequence ("${r[c-2]}${r[c-1]}" in "${r}").`);a[o]=l*16+u}return a}function vy(e,t){const n=ee(e,t);return Sa(n)}function nt(e,t={}){const n=yy.encode(e);return typeof t.size=="number"?(Le(n,{size:t.size}),kt(n,{dir:"right",size:t.size})):n}function Qt(e,t){const n=t||"hex",r=vd(ft(e,{strict:!1})?Ca(e):e);return n==="bytes"?r:Rl(r)}class ja 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 r=this.keys().next().value;r&&this.delete(r)}return this}}const wy=/^0x[a-fA-F0-9]{40}$/,Jr=new ja(8192);function Re(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(Jr.has(r))return Jr.get(r);const s=wy.test(e)?e.toLowerCase()===e?!0:n?Na(e)===e:!0:!1;return Jr.set(r,s),s}const Kr=new ja(8192);function Na(e,t){if(Kr.has(`${e}.${t}`))return Kr.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=Qt(nt(n),"bytes"),s=n.split("");for(let o=0;o<40;o+=2)r[o>>1]>>4>=8&&s[o]&&(s[o]=s[o].toUpperCase()),(r[o>>1]&15)>=8&&s[o+1]&&(s[o+1]=s[o+1].toUpperCase());const a=`0x${s.join("")}`;return Kr.set(`${e}.${t}`,a),a}function Fn(e,t){if(!Re(e,{strict:!1}))throw new it({address:e});return Na(e,t)}class qo extends A{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class Cy extends A{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}}class Sy extends A{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}const jy={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 Sy({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Cy({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new qo({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 qo({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 Ny(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(jy);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function Et(e,t,n,{strict:r}={}){return ft(e,{strict:!1})?Ey(e,t,n,{strict:r}):$l(e,t,n,{strict:r})}function Ll(e,t){if(typeof t=="number"&&t>0&&t>he(e)-1)throw new kl({offset:t,position:"start",size:he(e)})}function Fl(e,t,n){if(typeof t=="number"&&typeof n=="number"&&he(e)!==n-t)throw new kl({offset:n,position:"end",size:he(e)})}function $l(e,t,n,{strict:r}={}){Ll(e,t);const s=e.slice(t,n);return r&&Fl(s,t,n),s}function Ey(e,t,n,{strict:r}={}){Ll(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&Fl(s,t,n),s}function Py(e,t={}){typeof t.size<"u"&&Le(e,{size:t.size});const n=Se(e,t);return Al(n,t)}function Oy(e,t={}){let n=e;if(typeof t.size<"u"&&(Le(n,{size:t.size}),n=va(n)),n.length>1||n[0]>1)throw new hy(n);return!!n[0]}function Be(e,t={}){typeof t.size<"u"&&Le(e,{size:t.size});const n=Se(e,t);return my(n,t)}function Iy(e,t={}){let n=e;return typeof t.size<"u"&&(Le(n,{size:t.size}),n=va(n,{dir:"right"})),new TextDecoder().decode(n)}function Xe(e){return typeof e[0]=="string"?Ar(e):ky(e)}function ky(e){let t=0;for(const s of e)t+=s.length;const n=new Uint8Array(t);let r=0;for(const s of e)n.set(s,r),r+=s.length;return n}function Ar(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}const My=/^(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 Sn(e,t){if(e.length!==t.length)throw new ay({expectedLength:e.length,givenLength:t.length});const n=Ty({params:e,values:t}),r=Pa(n);return r.length===0?"0x":r}function Ty({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(Ea({param:e[r],value:t[r]}));return n}function Ea({param:e,value:t}){const n=Oa(e.type);if(n){const[r,s]=n;return Ry(t,{length:r,param:{...e,type:s}})}if(e.type==="tuple")return zy(t,{param:e});if(e.type==="address")return Ay(t);if(e.type==="bool")return Ly(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,s="256"]=My.exec(e.type)??[];return Fy(t,{signed:r,size:Number(s)})}if(e.type.startsWith("bytes"))return Dy(t,{param:e});if(e.type==="string")return $y(t);throw new ly(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Pa(e){let t=0;for(let a=0;a<e.length;a++){const{dynamic:o,encoded:c}=e[a];o?t+=32:t+=he(c)}const n=[],r=[];let s=0;for(let a=0;a<e.length;a++){const{dynamic:o,encoded:c}=e[a];o?(n.push(ee(t+s,{size:32})),r.push(c),s+=he(c)):n.push(c)}return Xe([...n,...r])}function Ay(e){if(!Re(e))throw new it({address:e});return{dynamic:!1,encoded:Qe(e.toLowerCase())}}function Ry(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new Il(e);if(!r&&e.length!==t)throw new ry({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let s=!1;const a=[];for(let o=0;o<e.length;o++){const c=Ea({param:n,value:e[o]});c.dynamic&&(s=!0),a.push(c)}if(r||s){const o=Pa(a);if(r){const c=ee(a.length,{size:32});return{dynamic:!0,encoded:a.length>0?Xe([c,o]):c}}if(s)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:Xe(a.map(({encoded:o})=>o))}}function Dy(e,{param:t}){const[,n]=t.type.split("bytes"),r=he(e);if(!n){let s=e;return r%32!==0&&(s=Qe(s,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:Xe([Qe(ee(r,{size:32})),s])}}if(r!==Number.parseInt(n,10))throw new sy({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:Qe(e,{dir:"right"})}}function Ly(e){if(typeof e!="boolean")throw new A(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Qe(Dl(e))}}function Fy(e,{signed:t,size:n=256}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,s=t?-r-1n:0n;if(e>r||e<s)throw new Tl({max:r.toString(),min:s.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:ee(e,{size:32,signed:t})}}function $y(e){const t=wa(e),n=Math.ceil(he(t)/32),r=[];for(let s=0;s<n;s++)r.push(Qe(Et(t,s*32,(s+1)*32),{dir:"right"}));return{dynamic:!0,encoded:Xe([Qe(ee(he(t),{size:32})),...r])}}function zy(e,{param:t}){let n=!1;const r=[];for(let s=0;s<t.components.length;s++){const a=t.components[s],o=Array.isArray(e)?s:a.name,c=Ea({param:a,value:e[o]});r.push(c),c.dynamic&&(n=!0)}return{dynamic:n,encoded:n?Pa(r):Xe(r.map(({encoded:s})=>s))}}function Oa(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function Ia(e,t){const n=typeof t=="string"?Sa(t):t,r=Ny(n);if(he(n)===0&&e.length>0)throw new xa;if(he(t)&&he(t)<32)throw new ny({data:typeof t=="string"?t:Se(t),params:e,size:he(t)});let s=0;const a=[];for(let o=0;o<e.length;++o){const c=e[o];r.setPosition(s);const[l,u]=wt(r,c,{staticPosition:0});s+=u,a.push(l)}return a}function wt(e,t,{staticPosition:n}){const r=Oa(t.type);if(r){const[s,a]=r;return Uy(e,{...t,type:a},{length:s,staticPosition:n})}if(t.type==="tuple")return Wy(e,t,{staticPosition:n});if(t.type==="address")return Vy(e);if(t.type==="bool")return By(e);if(t.type.startsWith("bytes"))return _y(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return Hy(e,t);if(t.type==="string")return Gy(e,{staticPosition:n});throw new uy(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const Qo=32,Ns=32;function Vy(e){const t=e.readBytes(32);return[Na(Se($l(t,-20))),32]}function Uy(e,t,{length:n,staticPosition:r}){if(!n){const o=Be(e.readBytes(Ns)),c=r+o,l=c+Qo;e.setPosition(c);const u=Be(e.readBytes(Qo)),d=Yt(t);let h=0;const f=[];for(let p=0;p<u;++p){e.setPosition(l+(d?p*32:h));const[g,b]=wt(e,t,{staticPosition:l});h+=b,f.push(g)}return e.setPosition(r+32),[f,32]}if(Yt(t)){const o=Be(e.readBytes(Ns)),c=r+o,l=[];for(let u=0;u<n;++u){e.setPosition(c+u*32);const[d]=wt(e,t,{staticPosition:c});l.push(d)}return e.setPosition(r+32),[l,32]}let s=0;const a=[];for(let o=0;o<n;++o){const[c,l]=wt(e,t,{staticPosition:r+s});s+=l,a.push(c)}return[a,s]}function By(e){return[Oy(e.readBytes(32),{size:32}),32]}function _y(e,t,{staticPosition:n}){const[r,s]=t.type.split("bytes");if(!s){const o=Be(e.readBytes(32));e.setPosition(n+o);const c=Be(e.readBytes(32));if(c===0)return e.setPosition(n+32),["0x",32];const l=e.readBytes(c);return e.setPosition(n+32),[Se(l),32]}return[Se(e.readBytes(Number.parseInt(s,10),32)),32]}function Hy(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),s=e.readBytes(32);return[r>48?Py(s,{signed:n}):Be(s,{signed:n}),32]}function Wy(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:o})=>!o),s=r?[]:{};let a=0;if(Yt(t)){const o=Be(e.readBytes(Ns)),c=n+o;for(let l=0;l<t.components.length;++l){const u=t.components[l];e.setPosition(c+a);const[d,h]=wt(e,u,{staticPosition:c});a+=h,s[r?l:u?.name]=d}return e.setPosition(n+32),[s,32]}for(let o=0;o<t.components.length;++o){const c=t.components[o],[l,u]=wt(e,c,{staticPosition:n});s[r?o:c?.name]=l,a+=u}return[s,a]}function Gy(e,{staticPosition:t}){const n=Be(e.readBytes(32)),r=t+n;e.setPosition(r);const s=Be(e.readBytes(32));if(s===0)return e.setPosition(t+32),["",32];const a=e.readBytes(s,32),o=Iy(va(a));return e.setPosition(t+32),[o,32]}function Yt(e){const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return e.components?.some(Yt);const n=Oa(e.type);return!!(n&&Yt({...e,type:n[1]}))}const qy=e=>Qt(Ca(e));function Qy(e){return qy(e)}const Yy="1.1.0";let je=class Es extends Error{constructor(t,n={}){const r=n.cause instanceof Es?n.cause.details:n.cause?.message?n.cause.message:n.details,s=n.cause instanceof Es&&n.cause.docsPath||n.docsPath,a=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: https://abitype.dev${s}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${Yy}`].join(`
25
+ `);super(a),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=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.shortMessage=t}};function We(e,t){return e.exec(t)?.groups}const zl=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Vl=/^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)?$/,Ul=/^\(.+?\).*?$/,Yo=/^tuple(?<array>(\[(\d*)\])*)$/;function Ps(e){let t=e.type;if(Yo.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let s=0;s<n;s++){const a=e.components[s];t+=Ps(a),s<n-1&&(t+=", ")}const r=We(Yo,e.type);return t+=`)${r?.array??""}`,Ps({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function $t(e){let t="";const n=e.length;for(let r=0;r<n;r++){const s=e[r];t+=Ps(s),r!==n-1&&(t+=", ")}return t}function Jy(e){return e.type==="function"?`function ${e.name}(${$t(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${e.outputs?.length?` returns (${$t(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${$t(e.inputs)})`:e.type==="error"?`error ${e.name}(${$t(e.inputs)})`:e.type==="constructor"?`constructor(${$t(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const Bl=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Ky(e){return Bl.test(e)}function Xy(e){return We(Bl,e)}const _l=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Zy(e){return _l.test(e)}function e1(e){return We(_l,e)}const Hl=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function t1(e){return Hl.test(e)}function n1(e){return We(Hl,e)}const Wl=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function Gl(e){return Wl.test(e)}function r1(e){return We(Wl,e)}const ql=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function s1(e){return ql.test(e)}function a1(e){return We(ql,e)}const Ql=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function o1(e){return Ql.test(e)}function i1(e){return We(Ql,e)}const c1=/^receive\(\) external payable$/;function l1(e){return c1.test(e)}const u1=new Set(["indexed"]),Os=new Set(["calldata","memory","storage"]);class d1 extends je{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 f1 extends je{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 h1 extends je{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class p1 extends je{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 je{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class g1 extends je{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class b1 extends je{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 Mt extends je{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class y1 extends je{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class x1 extends je{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 v1 extends je{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 w1 extends je{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 C1(e,t,n){let r="";if(n)for(const s of Object.entries(n)){if(!s)continue;let a="";for(const o of s[1])a+=`[${o.type}${o.name?`:${o.name}`:""}]`;r+=`(${s[0]}{${a}})`}return t?`${t}:${e}${r}`:e}const Xr=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 S1(e,t={}){if(t1(e))return j1(e,t);if(Zy(e))return N1(e,t);if(Ky(e))return E1(e,t);if(s1(e))return P1(e,t);if(o1(e))return O1(e);if(l1(e))return{type:"receive",stateMutability:"payable"};throw new y1({signature:e})}function j1(e,t={}){const n=n1(e);if(!n)throw new Mt({signature:e,type:"function"});const r=Ne(n.parameters),s=[],a=r.length;for(let c=0;c<a;c++)s.push(ct(r[c],{modifiers:Os,structs:t,type:"function"}));const o=[];if(n.returns){const c=Ne(n.returns),l=c.length;for(let u=0;u<l;u++)o.push(ct(c[u],{modifiers:Os,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:s,outputs:o}}function N1(e,t={}){const n=e1(e);if(!n)throw new Mt({signature:e,type:"event"});const r=Ne(n.parameters),s=[],a=r.length;for(let o=0;o<a;o++)s.push(ct(r[o],{modifiers:u1,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:s}}function E1(e,t={}){const n=Xy(e);if(!n)throw new Mt({signature:e,type:"error"});const r=Ne(n.parameters),s=[],a=r.length;for(let o=0;o<a;o++)s.push(ct(r[o],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:s}}function P1(e,t={}){const n=a1(e);if(!n)throw new Mt({signature:e,type:"constructor"});const r=Ne(n.parameters),s=[],a=r.length;for(let o=0;o<a;o++)s.push(ct(r[o],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:s}}function O1(e){const t=i1(e);if(!t)throw new Mt({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const I1=/^(?<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$_]*))?$/,k1=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,M1=/^u?int$/;function ct(e,t){const n=C1(e,t?.type,t?.structs);if(Xr.has(n))return Xr.get(n);const r=Ul.test(e),s=We(r?k1:I1,e);if(!s)throw new h1({param:e});if(s.name&&A1(s.name))throw new p1({param:e,name:s.name});const a=s.name?{name:s.name}:{},o=s.modifier==="indexed"?{indexed:!0}:{},c=t?.structs??{};let l,u={};if(r){l="tuple";const h=Ne(s.type),f=[],p=h.length;for(let g=0;g<p;g++)f.push(ct(h[g],{structs:c}));u={components:f}}else if(s.type in c)l="tuple",u={components:c[s.type]};else if(M1.test(s.type))l=`${s.type}256`;else if(s.type==="address payable")l="address";else if(l=s.type,t?.type!=="struct"&&!Yl(l))throw new f1({type:l});if(s.modifier){if(!t?.modifiers?.has?.(s.modifier))throw new m1({param:e,type:t?.type,modifier:s.modifier});if(Os.has(s.modifier)&&!R1(l,!!s.array))throw new g1({param:e,type:t?.type,modifier:s.modifier})}const d={type:`${l}${s.array??""}`,...a,...o,...u};return Xr.set(n,d),d}function Ne(e,t=[],n="",r=0){const s=e.trim().length;for(let a=0;a<s;a++){const o=e[a],c=e.slice(a+1);switch(o){case",":return r===0?Ne(c,[...t,n.trim()]):Ne(c,t,`${n}${o}`,r);case"(":return Ne(c,t,`${n}${o}`,r+1);case")":return Ne(c,t,`${n}${o}`,r-1);default:return Ne(c,t,`${n}${o}`,r)}}if(n==="")return t;if(r!==0)throw new w1({current:n,depth:r});return t.push(n.trim()),t}function Yl(e){return e==="address"||e==="bool"||e==="function"||e==="string"||zl.test(e)||Vl.test(e)}const T1=/^(?: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 A1(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||zl.test(e)||Vl.test(e)||T1.test(e)}function R1(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function D1(e){const t={},n=e.length;for(let o=0;o<n;o++){const c=e[o];if(!Gl(c))continue;const l=r1(c);if(!l)throw new Mt({signature:c,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 b=ct(g,{type:"struct"});d.push(b)}if(!d.length)throw new x1({signature:c});t[l.name]=d}const r={},s=Object.entries(t),a=s.length;for(let o=0;o<a;o++){const[c,l]=s[o];r[c]=Jl(l,t)}return r}const L1=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function Jl(e,t,n=new Set){const r=[],s=e.length;for(let a=0;a<s;a++){const o=e[a];if(Ul.test(o.type))r.push(o);else{const l=We(L1,o.type);if(!l?.type)throw new b1({abiParameter:o});const{array:u,type:d}=l;if(d in t){if(n.has(d))throw new v1({type:d});r.push({...o,type:`tuple${u??""}`,components:Jl(t[d]??[],t,new Set([...n,d]))})}else if(Yl(d))r.push(o);else throw new d1({type:d})}}return r}function Kl(e){const t=D1(e),n=[],r=e.length;for(let s=0;s<r;s++){const a=e[s];Gl(a)||n.push(S1(a,t))}return n}function F1(e){let t=!0,n="",r=0,s="",a=!1;for(let o=0;o<e.length;o++){const c=e[o];if(["(",")",","].includes(c)&&(t=!0),c==="("&&r++,c===")"&&r--,!!t){if(r===0){if(c===" "&&["event","function",""].includes(s))s="";else if(s+=c,c===")"){a=!0;break}continue}if(c===" "){e[o-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}s+=c,n+=c}}if(!a)throw new A("Unable to normalize signature.");return s}const $1=e=>{const t=typeof e=="string"?e:Jy(e);return F1(t)};function Xl(e){return Qy($1(e))}const z1=Xl,jn=e=>Et(Xl(e),0,4);function Nn(e){const{abi:t,args:n=[],name:r}=e,s=ft(r,{strict:!1}),a=t.filter(c=>s?c.type==="function"?jn(c)===r:c.type==="event"?z1(c)===r:!1:"name"in c&&c.name===r);if(a.length===0)return;if(a.length===1)return a[0];let o;for(const c of a){if(!("inputs"in c))continue;if(!n||n.length===0){if(!c.inputs||c.inputs.length===0)return c;continue}if(!c.inputs||c.inputs.length===0||c.inputs.length!==n.length)continue;if(n.every((u,d)=>{const h="inputs"in c&&c.inputs[d];return h?Is(u,h):!1})){if(o&&"inputs"in o&&o.inputs){const u=Zl(c.inputs,o.inputs,n);if(u)throw new cy({abiItem:c,type:u[0]},{abiItem:o,type:u[1]})}o=c}}return o||a[0]}function Is(e,t){const n=typeof e,r=t.type;switch(r){case"address":return Re(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((s,a)=>Is(Object.values(e)[a],s)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(e)&&e.every(s=>Is(s,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Zl(e,t,n){for(const r in e){const s=e[r],a=t[r];if(s.type==="tuple"&&a.type==="tuple"&&"components"in s&&"components"in a)return Zl(s.components,a.components,n[r]);const o=[s.type,a.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?Re(n[r],{strict:!1}):o.includes("address")&&o.includes("bytes")?Re(n[r],{strict:!1}):!1)return o}}const Zr="/docs/contract/decodeFunctionResult";function ka(e){const{abi:t,args:n,functionName:r,data:s}=e;let a=t[0];if(r){const c=Nn({abi:t,args:n,name:r});if(!c)throw new Nt(r,{docsPath:Zr});a=c}if(a.type!=="function")throw new Nt(void 0,{docsPath:Zr});if(!a.outputs)throw new Ol(a.name,{docsPath:Zr});const o=Ia(a.outputs,s);if(o&&o.length>1)return o;if(o&&o.length===1)return o[0]}const Jo="/docs/contract/encodeFunctionData";function V1(e){const{abi:t,args:n,functionName:r}=e;let s=t[0];if(r){const a=Nn({abi:t,args:n,name:r});if(!a)throw new Nt(r,{docsPath:Jo});s=a}if(s.type!=="function")throw new Nt(void 0,{docsPath:Jo});return{abi:[s],functionName:jn(Ke(s))}}function Ma(e){const{args:t}=e,{abi:n,functionName:r}=e.abi.length===1&&e.functionName?.startsWith("0x")?e:V1(e),s=n[0],a=r,o="inputs"in s&&s.inputs?Sn(s.inputs,t??[]):void 0;return Ar([a,o??"0x"])}class ks extends A{constructor({blockNumber:t,chain:n,contract:r}){super(`Chain "${n.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...t&&r.blockCreated&&r.blockCreated>t?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${t}).`]:[`- The chain does not have the contract "${r.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class eu extends A{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}function Ta({blockNumber:e,chain:t,contract:n}){const r=t?.contracts?.[n];if(!r)throw new ks({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new ks({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function Rr(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const U1={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."},tu={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},B1={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function nu(e){const{abi:t,data:n}=e,r=Et(n,0,4);if(r==="0x")throw new xa;const a=[...t||[],tu,B1].find(o=>o.type==="error"&&r===jn(Ke(o)));if(!a)throw new Pl(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:a,args:"inputs"in a&&a.inputs&&a.inputs.length>0?Ia(a.inputs,Et(n,4)):void 0,errorName:a.name}}const Te=(e,t,n)=>JSON.stringify(e,(r,s)=>typeof s=="bigint"?s.toString():s,n);function ru({abiItem:e,args:t,includeFunctionName:n=!0,includeName:r=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${n?e.name:""}(${e.inputs.map((s,a)=>`${r&&s.name?`${s.name}: `:""}${typeof t[a]=="object"?Te(t[a]):t[a]}`).join(", ")})`}const _1={gwei:9,wei:18},H1={ether:-9,wei:9};function su(e,t){let n=e.toString();const r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(t,"0");let[s,a]=[n.slice(0,n.length-t),n.slice(n.length-t)];return a=a.replace(/(0+)$/,""),`${r?"-":""}${s||"0"}${a?`.${a}`:""}`}function W1(e,t="wei"){return su(e,_1[t])}function rt(e,t="wei"){return su(e,H1[t])}class G1 extends A{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class q1 extends A{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Ko(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
26
+ `,"")}function Q1(e){return e.reduce((t,{address:n,...r})=>{let s=`${t} ${n}:
27
+ `;return r.nonce&&(s+=` nonce: ${r.nonce}
28
+ `),r.balance&&(s+=` balance: ${r.balance}
29
+ `),r.code&&(s+=` code: ${r.code}
30
+ `),r.state&&(s+=` state:
31
+ `,s+=Ko(r.state)),r.stateDiff&&(s+=` stateDiff:
32
+ `,s+=Ko(r.stateDiff)),s},` State Override:
33
+ `).slice(0,-1)}function au(e){const t=Object.entries(e).map(([r,s])=>s===void 0||s===!1?null:[r,s]).filter(Boolean),n=t.reduce((r,[s])=>Math.max(r,s.length),0);return t.map(([r,s])=>` ${`${r}:`.padEnd(n+1)} ${s}`).join(`
34
+ `)}class Y1 extends A{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 J1=e=>e,En=e=>e;class K1 extends A{constructor(t,{account:n,docsPath:r,chain:s,data:a,gas:o,gasPrice:c,maxFeePerGas:l,maxPriorityFeePerGas:u,nonce:d,to:h,value:f,stateOverride:p}){const g=n?Rr(n):void 0;let b=au({from:g?.address,to:h,value:typeof f<"u"&&`${W1(f)} ${s?.nativeCurrency?.symbol||"ETH"}`,data:a,gas:o,gasPrice:typeof c<"u"&&`${rt(c)} gwei`,maxFeePerGas:typeof l<"u"&&`${rt(l)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${rt(u)} gwei`,nonce:d});p&&(b+=`
36
+ ${Q1(p)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",b].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class X1 extends A{constructor(t,{abi:n,args:r,contractAddress:s,docsPath:a,functionName:o,sender:c}){const l=Nn({abi:n,args:r,name:o}),u=l?ru({abiItem:l,args:r,includeFunctionName:!1,includeName:!1}):void 0,d=l?Ke(l,{includeName:!0}):void 0,h=au({address:s&&J1(s),function:d,args:u&&u!=="()"&&`${[...Array(o?.length??0).keys()].map(()=>" ").join("")}${u}`,sender:c});super(t.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:t,docsPath:a,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=r,this.cause=t,this.contractAddress=s,this.functionName=o,this.sender=c}}class Ms extends A{constructor({abi:t,data:n,functionName:r,message:s}){let a,o,c,l;if(n&&n!=="0x")try{o=nu({abi:t,data:n});const{abiItem:d,errorName:h,args:f}=o;if(h==="Error")l=f[0];else if(h==="Panic"){const[p]=f;l=U1[p]}else{const p=d?Ke(d,{includeName:!0}):void 0,g=d&&f?ru({abiItem:d,args:f,includeFunctionName:!1,includeName:!1}):void 0;c=[p?`Error: ${p}`:"",g&&g!=="()"?` ${[...Array(h?.length??0).keys()].map(()=>" ").join("")}${g}`:""]}}catch(d){a=d}else s&&(l=s);let u;a instanceof Pl&&(u=a.signature,c=[`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 "${r}" reverted with the following ${u?"signature":"reason"}:`,l||u].join(`
37
+ `):`The contract function "${r}" reverted.`,{cause:a,metaMessages:c,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=o,this.raw=n,this.reason=l,this.signature=u}}class Z1 extends A{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 ex extends A{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 ou extends A{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 iu(e){if(!(e instanceof A))return!1;const t=e.walk(n=>n instanceof Ms);return t instanceof Ms?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 tx(e){const{abi:t,data:n}=e,r=Et(n,0,4),s=t.find(a=>a.type==="function"&&r===jn(Ke(a)));if(!s)throw new iy(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:s.name,args:"inputs"in s&&s.inputs&&s.inputs.length>0?Ia(s.inputs,Et(n,4)):void 0}}const es="/docs/contract/encodeErrorResult";function Xo(e){const{abi:t,errorName:n,args:r}=e;let s=t[0];if(n){const l=Nn({abi:t,args:r,name:n});if(!l)throw new Ho(n,{docsPath:es});s=l}if(s.type!=="error")throw new Ho(void 0,{docsPath:es});const a=Ke(s),o=jn(a);let c="0x";if(r&&r.length>0){if(!s.inputs)throw new oy(s.name,{docsPath:es});c=Sn(s.inputs,r)}return Ar([o,c])}const ts="/docs/contract/encodeFunctionResult";function nx(e){const{abi:t,functionName:n,result:r}=e;let s=t[0];if(n){const o=Nn({abi:t,name:n});if(!o)throw new Nt(n,{docsPath:ts});s=o}if(s.type!=="function")throw new Nt(void 0,{docsPath:ts});if(!s.outputs)throw new Ol(s.name,{docsPath:ts});const a=(()=>{if(s.outputs.length===0)return[];if(s.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new Il(r)})();return Sn(s.outputs,a)}const Dr="x-batch-gateway:true";async function cu(e){const{data:t,ccipRequest:n}=e,{args:[r]}=tx({abi:Ss,data:t}),s=[],a=[];return await Promise.all(r.map(async(o,c)=>{try{a[c]=o.urls.includes(Dr)?await cu({data:o.data,ccipRequest:n}):await n(o),s[c]=!1}catch(l){s[c]=!0,a[c]=rx(l)}})),nx({abi:Ss,functionName:"query",result:[s,a]})}function rx(e){return e.name==="HttpRequestError"&&e.status?Xo({abi:Ss,errorName:"HttpError",args:[e.status,e.shortMessage]}):Xo({abi:[tu],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function lu(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return ft(t)?t:null}function sx(e){let t=new Uint8Array(32).fill(0);if(!e)return Se(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const s=lu(n[r]),a=s?Ca(s):Qt(nt(n[r]),"bytes");t=Qt(Xe([t,a]),"bytes")}return Se(t)}function ax(e){return`[${e.slice(2)}]`}function ox(e){const t=new Uint8Array(32).fill(0);return e?lu(e)||Qt(nt(e)):Se(t)}function ix(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(nt(t).byteLength+2);let r=0;const s=t.split(".");for(let a=0;a<s.length;a++){let o=nt(s[a]);o.byteLength>255&&(o=nt(ax(ox(s[a])))),n[r]=o.length,n.set(o,r+1),r+=o.length+1}return n.byteLength!==r+1?n.slice(0,r+1):n}function Lr(e,t,n){const r=e[t.name];if(typeof r=="function")return r;const s=e[n];return typeof s=="function"?s:a=>t(e,a)}class st extends A{constructor({body:t,cause:n,details:r,headers:s,status:a,url:o}){super("HTTP request failed.",{cause:n,details:r,metaMessages:[a&&`Status: ${a}`,`URL: ${En(o)}`,t&&`Request body: ${Te(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=s,this.status=a,this.url=o}}class Aa extends A{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${En(r)}`,`Request body: ${Te(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 Zo extends A{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${En(n)}`,`Request body: ${Te(t)}`],name:"TimeoutError"})}}const cx=-1;class ye extends A{constructor(t,{code:n,docsPath:r,metaMessages:s,name:a,shortMessage:o}){super(o,{cause:t,docsPath:r,metaMessages:s||t?.metaMessages,name:a||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=a||t.name,this.code=t instanceof Aa?t.code:n??cx}}class we extends ye{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class Jt extends ye{constructor(t){super(t,{code:Jt.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Jt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class Kt extends ye{constructor(t){super(t,{code:Kt.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(Kt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class Xt extends ye{constructor(t,{method:n}={}){super(t,{code:Xt.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(Xt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class Zt extends ye{constructor(t){super(t,{code:Zt.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
38
+ `)})}}Object.defineProperty(Zt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class lt extends ye{constructor(t){super(t,{code:lt.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(lt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class en extends ye{constructor(t){super(t,{code:en.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
39
+ `)})}}Object.defineProperty(en,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class tn extends ye{constructor(t){super(t,{code:tn.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(tn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Ye extends ye{constructor(t){super(t,{code:Ye.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Ye,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class nn extends ye{constructor(t){super(t,{code:nn.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(nn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class et extends ye{constructor(t,{method:n}={}){super(t,{code:et.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(et,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Pt extends ye{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 rn extends ye{constructor(t){super(t,{code:rn.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(rn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class pe extends we{constructor(t){super(t,{code:pe.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(pe,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class sn extends we{constructor(t){super(t,{code:sn.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(sn,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class an extends we{constructor(t,{method:n}={}){super(t,{code:an.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(an,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class on extends we{constructor(t){super(t,{code:on.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(on,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class cn extends we{constructor(t){super(t,{code:cn.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(cn,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class ut extends we{constructor(t){super(t,{code:ut.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(ut,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class ln extends we{constructor(t){super(t,{code:ln.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(ln,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class un extends we{constructor(t){super(t,{code:un.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(un,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class dn extends we{constructor(t){super(t,{code:dn.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(dn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class fn extends we{constructor(t){super(t,{code:fn.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(fn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class hn extends we{constructor(t){super(t,{code:hn.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(hn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class pn extends we{constructor(t){super(t,{code:pn.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(pn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class mn extends we{constructor(t){super(t,{code:mn.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(mn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class lx extends ye{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const ux=3;function dx(e,{abi:t,address:n,args:r,docsPath:s,functionName:a,sender:o}){const c=e instanceof ou?e:e instanceof A?e.walk(g=>"data"in g)||e.walk():{},{code:l,data:u,details:d,message:h,shortMessage:f}=c,p=e instanceof xa?new Z1({functionName:a}):[ux,lt.code].includes(l)&&(u||d||h||f)?new Ms({abi:t,data:typeof u=="object"?u.data:u,functionName:a,message:c instanceof Aa?d:f??h}):e;return new X1(p,{abi:t,args:r,contractAddress:n,docsPath:s,functionName:a,sender:o})}const fx="0.1.1";function hx(){return fx}let uu=class Ts extends Error{constructor(t,n={}){const r=(()=>{if(n.cause instanceof Ts){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})(),s=n.cause instanceof Ts&&n.cause.docsPath||n.docsPath,o=`https://oxlib.sh${s??""}`,c=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||s?["",r?`Details: ${r}`:void 0,s?`See: ${o}`:void 0]:[]].filter(l=>typeof l=="string").join(`
40
+ `);super(c,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@${hx()}`}),this.cause=n.cause,this.details=r,this.docs=o,this.docsPath=s,this.shortMessage=t}walk(t){return du(this,t)}};function du(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?du(e.cause,t):t?null:e}function px(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;const s=e.replace("0x","");if(s.length>r*2)throw new bx({size:Math.ceil(s.length/2),targetSize:r,type:"Hex"});return`0x${s[n==="right"?"padEnd":"padStart"](r*2,"0")}`}function ze(e,t={}){const{signed:n,size:r}=t,s=BigInt(e);let a;r?n?a=(1n<<BigInt(r)*8n-1n)-1n:a=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(a=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof a=="bigint"&&n?-a-1n:0;if(a&&s>a||s<o){const u=typeof e=="bigint"?"n":"";throw new gx({max:a?`${a}${u}`:void 0,min:`${o}${u}`,signed:n,size:r,value:`${e}${u}`})}const l=`0x${(n&&s<0?(1n<<BigInt(r*8))+BigInt(s):s).toString(16)}`;return r?mx(l,r):l}function mx(e,t){return px(e,{dir:"left",size:t})}class gx extends uu{constructor({max:t,min:n,signed:r,size:s,value:a}){super(`Number \`${a}\` is not in safe${s?` ${s*8}-bit`:""}${r?" signed":" unsigned"} integer range ${t?`(\`${n}\` to \`${t}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}class bx extends uu{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}function yx(e){return{address:e.address,amount:ze(e.amount),index:ze(e.index),validatorIndex:ze(e.validatorIndex)}}function xx(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:ze(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:ze(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:ze(e.gasLimit)},...typeof e.number=="bigint"&&{number:ze(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:ze(e.prevRandao)},...typeof e.time=="bigint"&&{time:ze(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(yx)}}}const vx="0x82ad56cb",wx="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",Cx="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",Sx="0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033",ns="/docs/contract/encodeDeployData";function fu(e){const{abi:t,args:n,bytecode:r}=e;if(!n||n.length===0)return r;const s=t.find(o=>"type"in o&&o.type==="constructor");if(!s)throw new ty({docsPath:ns});if(!("inputs"in s))throw new _o({docsPath:ns});if(!s.inputs||s.inputs.length===0)throw new _o({docsPath:ns});const a=Sn(s.inputs,n);return Ar([r,a])}class yt extends A{constructor({cause:t,message:n}={}){const r=n?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}}Object.defineProperty(yt,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(yt,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class fr extends A{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${rt(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(fr,"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 As extends A{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${rt(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(As,"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 Rs extends A{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(Rs,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Ds extends A{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(Ds,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class Ls extends A{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}}Object.defineProperty(Ls,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class Fs extends A{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(Fs,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class $s extends A{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($s,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class zs extends A{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(zs,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class Vs extends A{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(Vs,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class hr extends A{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${rt(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${rt(r)} gwei`:""}).`].join(`
43
+ `),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(hr,"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 hu extends A{constructor({cause:t}){super(`An error occurred while executing: ${t?.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function jx(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof A?e.walk(s=>s?.code===yt.code):e;return r instanceof A?new yt({cause:e,message:r.details}):yt.nodeMessage.test(n)?new yt({cause:e,message:e.details}):fr.nodeMessage.test(n)?new fr({cause:e,maxFeePerGas:t?.maxFeePerGas}):As.nodeMessage.test(n)?new As({cause:e,maxFeePerGas:t?.maxFeePerGas}):Rs.nodeMessage.test(n)?new Rs({cause:e,nonce:t?.nonce}):Ds.nodeMessage.test(n)?new Ds({cause:e,nonce:t?.nonce}):Ls.nodeMessage.test(n)?new Ls({cause:e,nonce:t?.nonce}):Fs.nodeMessage.test(n)?new Fs({cause:e}):$s.nodeMessage.test(n)?new $s({cause:e,gas:t?.gas}):zs.nodeMessage.test(n)?new zs({cause:e,gas:t?.gas}):Vs.nodeMessage.test(n)?new Vs({cause:e}):hr.nodeMessage.test(n)?new hr({cause:e,maxFeePerGas:t?.maxFeePerGas,maxPriorityFeePerGas:t?.maxPriorityFeePerGas}):new hu({cause:e})}function Nx(e,{docsPath:t,...n}){const r=(()=>{const s=jx(e,n);return s instanceof hu?e:s})();return new K1(r,{docsPath:t,...n})}function Ex(e,{format:t}){if(!t)return{};const n={};function r(a){const o=Object.keys(a);for(const c of o)c in e&&(n[c]=e[c]),a[c]&&typeof a[c]=="object"&&!Array.isArray(a[c])&&r(a[c])}const s=t(e||{});return r(s),n}const Px={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Ox(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=Ix(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(r=>Se(r)):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=ee(e.gas)),typeof e.gasPrice<"u"&&(n.gasPrice=ee(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(n.maxFeePerBlobGas=ee(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(n.maxFeePerGas=ee(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(n.maxPriorityFeePerGas=ee(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(n.nonce=ee(e.nonce)),typeof e.to<"u"&&(n.to=e.to),typeof e.type<"u"&&(n.type=Px[e.type]),typeof e.value<"u"&&(n.value=ee(e.value)),n}function Ix(e){return e.map(t=>({address:t.address,r:t.r?ee(BigInt(t.r)):t.r,s:t.s?ee(BigInt(t.s)):t.s,chainId:ee(t.chainId),nonce:ee(t.nonce),...typeof t.yParity<"u"?{yParity:ee(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:ee(t.v)}:{}}))}function kx(){let e=()=>{},t=()=>{};return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}const rs=new Map;function pu({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:s}){const a=async()=>{const d=l();o();const h=d.map(({args:f})=>f);h.length!==0&&e(h).then(f=>{s&&Array.isArray(f)&&f.sort(s);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)}})},o=()=>rs.delete(t),c=()=>l().map(({args:d})=>d),l=()=>rs.get(t)||[],u=d=>rs.set(t,[...l(),d]);return{flush:o,async schedule(d){const{promise:h,resolve:f,reject:p}=kx();return n?.([...c(),d])&&a(),l().length>0?(u({args:d,resolve:f,reject:p}),h):(u({args:d,resolve:f,reject:p}),setTimeout(a,r),h)}}}function ei(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new Wo({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new Wo({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function Mx(e){const{balance:t,nonce:n,state:r,stateDiff:s,code:a}=e,o={};if(a!==void 0&&(o.code=a),t!==void 0&&(o.balance=ee(t)),n!==void 0&&(o.nonce=ee(n)),r!==void 0&&(o.state=ei(r)),s!==void 0){if(o.state)throw new q1;o.stateDiff=ei(s)}return o}function Tx(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!Re(n,{strict:!1}))throw new it({address:n});if(t[n])throw new G1({address:n});t[n]=Mx(r)}return t}const Ax=2n**256n-1n;function Rx(e){const{account:t,gasPrice:n,maxFeePerGas:r,maxPriorityFeePerGas:s,to:a}=e,o=t?Rr(t):void 0;if(o&&!Re(o.address))throw new it({address:o.address});if(a&&!Re(a))throw new it({address:a});if(typeof n<"u"&&(typeof r<"u"||typeof s<"u"))throw new Y1;if(r&&r>Ax)throw new fr({maxFeePerGas:r});if(s&&r&&s>r)throw new hr({maxFeePerGas:r,maxPriorityFeePerGas:s})}async function mu(e,t){const{account:n=e.account,authorizationList:r,batch:s=!!e.batch?.multicall,blockNumber:a,blockTag:o=e.experimental_blockTag??"latest",accessList:c,blobs:l,blockOverrides:u,code:d,data:h,factory:f,factoryData:p,gas:g,gasPrice:b,maxFeePerBlobGas:y,maxFeePerGas:x,maxPriorityFeePerGas:v,nonce:w,to:E,value:C,stateOverride:j,...S}=t,N=n?Rr(n):void 0;if(d&&(f||p))throw new A("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(d&&E)throw new A("Cannot provide both `code` & `to` as parameters.");const P=d&&h,k=f&&p&&E&&h,O=P||k,T=P?gu({code:d,data:h}):k?Fx({data:h,factory:f,factoryData:p,to:E}):h;try{Rx(t);const D=(typeof a=="bigint"?ee(a):void 0)||o,V=u?xx(u):void 0,U=Tx(j),H=e.chain?.formatters?.transactionRequest?.format,W=(H||Ox)({...Ex(S,{format:H}),accessList:c,account:N,authorizationList:r,blobs:l,data:T,gas:g,gasPrice:b,maxFeePerBlobGas:y,maxFeePerGas:x,maxPriorityFeePerGas:v,nonce:w,to:O?void 0:E,value:C},"call");if(s&&Dx({request:W})&&!U&&!V)try{return await Lx(e,{...W,blockNumber:a,blockTag:o})}catch(B){if(!(B instanceof eu)&&!(B instanceof ks))throw B}const te=(()=>{const B=[W,D];return U&&V?[...B,U,V]:U?[...B,U]:V?[...B,{},V]:B})(),se=await e.request({method:"eth_call",params:te});return se==="0x"?{data:void 0}:{data:se}}catch(R){const D=$x(R),{offchainLookup:V,offchainLookupSignature:U}=await Xi(async()=>{const{offchainLookup:H,offchainLookupSignature:q}=await Promise.resolve().then(()=>uv);return{offchainLookup:H,offchainLookupSignature:q}},void 0);if(e.ccipRead!==!1&&D?.slice(0,10)===U&&E)return{data:await V(e,{data:D,to:E})};throw O&&D?.slice(0,10)==="0x101bb98d"?new ex({factory:f}):Nx(R,{...t,account:N,chain:e.chain})}}function Dx({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(vx)||!n||Object.values(r).filter(s=>typeof s<"u").length>0)}async function Lx(e,t){const{batchSize:n=1024,deployless:r=!1,wait:s=0}=typeof e.batch?.multicall=="object"?e.batch.multicall:{},{blockNumber:a,blockTag:o=e.experimental_blockTag??"latest",data:c,to:l}=t,u=(()=>{if(r)return null;if(t.multicallAddress)return t.multicallAddress;if(e.chain)return Ta({blockNumber:a,chain:e.chain,contract:"multicall3"});throw new eu})(),h=(typeof a=="bigint"?ee(a):void 0)||o,{schedule:f}=pu({id:`${e.uid}.${h}`,wait:s,shouldSplitBatch(b){return b.reduce((x,{data:v})=>x+(v.length-2),0)>n*2},fn:async b=>{const y=b.map(w=>({allowFailure:!0,callData:w.data,target:w.to})),x=Ma({abi:Uo,args:[y],functionName:"aggregate3"}),v=await e.request({method:"eth_call",params:[{...u===null?{data:gu({code:Sx,data:x})}:{to:u,data:x}},h]});return ka({abi:Uo,args:[y],functionName:"aggregate3",data:v||"0x"})}}),[{returnData:p,success:g}]=await f({data:c,to:l});if(!g)throw new ou({data:p});return p==="0x"?{data:void 0}:{data:p}}function gu(e){const{code:t,data:n}=e;return fu({abi:Kl(["constructor(bytes, bytes)"]),bytecode:wx,args:[t,n]})}function Fx(e){const{data:t,factory:n,factoryData:r,to:s}=e;return fu({abi:Kl(["constructor(address, bytes, address, bytes)"]),bytecode:Cx,args:[s,t,n,r]})}function $x(e){if(!(e instanceof A))return;const t=e.walk();return typeof t?.data=="object"?t.data?.data:t.data}async function pr(e,t){const{abi:n,address:r,args:s,functionName:a,...o}=t,c=Ma({abi:n,args:s,functionName:a});try{const{data:l}=await Lr(e,mu,"call")({...o,data:c,to:r});return ka({abi:n,args:s,functionName:a,data:l||"0x"})}catch(l){throw dx(l,{abi:n,address:r,args:s,docsPath:"/docs/contract/readContract",functionName:a})}}class zx extends A{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 zt extends A{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class Ra extends A{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 Vx extends A{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const Ux=/(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,Bx=/^(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>\/.*)?$/,_x=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,Hx=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function Wx(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 r=new Image;r.onload=()=>{n(!0)},r.onerror=()=>{n(!1)},r.src=e})}}function ti(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function bu({uri:e,gatewayUrls:t}){const n=_x.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=ti(t?.ipfs,"https://ipfs.io"),s=ti(t?.arweave,"https://arweave.net"),a=e.match(Ux),{protocol:o,subpath:c,target:l,subtarget:u=""}=a?.groups||{},d=o==="ipns:/"||c==="ipns/",h=o==="ipfs:/"||c==="ipfs/"||Bx.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:`${r}/${d?"ipns":"ipfs"}/${l}${u}`,isOnChain:!1,isEncoded:!1};if(o==="ar:/"&&l)return{uri:`${s}/${l}${u||""}`,isOnChain:!1,isEncoded:!1};let f=e.replace(Hx,"");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 Ra({uri:e})}function yu(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new zx({data:e});return e.image||e.image_url||e.image_data}async function Gx({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(s=>s.json());return await Da({gatewayUrls:e,uri:yu(n)})}catch{throw new Ra({uri:t})}}async function Da({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=bu({uri:t,gatewayUrls:e});if(r||await Wx(n))return n;throw new Ra({uri:t})}function qx(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[n,r,s]=t.split("/"),[a,o]=n.split(":"),[c,l]=r.split(":");if(!a||a.toLowerCase()!=="eip155")throw new zt({reason:"Only EIP-155 supported"});if(!o)throw new zt({reason:"Chain ID not found"});if(!l)throw new zt({reason:"Contract address not found"});if(!s)throw new zt({reason:"Token ID not found"});if(!c)throw new zt({reason:"ERC namespace not found"});return{chainID:Number.parseInt(o,10),namespace:c.toLowerCase(),contractAddress:l,tokenID:s}}async function Qx(e,{nft:t}){if(t.namespace==="erc721")return pr(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 pr(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 Vx({namespace:t.namespace})}async function Yx(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?Jx(e,{gatewayUrls:t,record:n}):Da({uri:n,gatewayUrls:t})}async function Jx(e,{gatewayUrls:t,record:n}){const r=qx(n),s=await Qx(e,{nft:r}),{uri:a,isOnChain:o,isEncoded:c}=bu({uri:s,gatewayUrls:t});if(o&&(a.includes("data:application/json;base64,")||a.startsWith("{"))){const u=c?atob(a.replace("data:application/json;base64,","")):a,d=JSON.parse(u);return Da({uri:yu(d),gatewayUrls:t})}let l=r.tokenID;return r.namespace==="erc1155"&&(l=l.replace("0x","").padStart(64,"0")),Gx({gatewayUrls:t,uri:a.replace(/(?:0x)?{id}/,l)})}async function Kx(e,t){const{blockNumber:n,blockTag:r,key:s,name:a,gatewayUrls:o,strict:c}=t,{chain:l}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!l)throw new Error("client chain not configured. universalResolverAddress is required.");return Ta({blockNumber:n,chain:l,contract:"ensUniversalResolver"})})(),d=l?.ensTlds;if(d&&!d.some(h=>a.endsWith(h)))return null;try{const h={address:u,abi:Xb,args:[Rl(ix(a)),Ma({abi:Bo,functionName:"text",args:[sx(a),s]}),o??[Dr]],functionName:"resolveWithGateways",blockNumber:n,blockTag:r},p=await Lr(e,pr,"readContract")(h);if(p[0]==="0x")return null;const g=ka({abi:Bo,functionName:"text",data:p[0]});return g===""?null:g}catch(h){if(c)throw h;if(iu(h))return null;throw h}}async function Xx(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:s,gatewayUrls:a,strict:o,universalResolverAddress:c}){const l=await Lr(e,Kx,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:s,universalResolverAddress:c,gatewayUrls:a,strict:o});if(!l)return null;try{return await Yx(e,{record:l,gatewayUrls:r})}catch{return null}}async function Zx(e,t){const{address:n,blockNumber:r,blockTag:s,coinType:a=60n,gatewayUrls:o,strict:c}=t,{chain:l}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!l)throw new Error("client chain not configured. universalResolverAddress is required.");return Ta({blockNumber:r,chain:l,contract:"ensUniversalResolver"})})();try{const d={address:u,abi:Zb,args:[n,a,o??[Dr]],functionName:"reverseWithGateways",blockNumber:r,blockTag:s},h=Lr(e,pr,"readContract"),[f]=await h(d);return f||null}catch(d){if(c)throw d;if(iu(d))return null;throw d}}function ev(e,t){if(!Re(e,{strict:!1}))throw new it({address:e});if(!Re(t,{strict:!1}))throw new it({address:t});return e.toLowerCase()===t.toLowerCase()}const $n=new ja(8192);function tv(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if($n.get(n))return $n.get(n);const r=e().finally(()=>$n.delete(n));return $n.set(n,r),r}async function nv(e){return new Promise(t=>setTimeout(t,e))}function xu(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((s,a)=>{const o=async({count:c=0}={})=>{const l=async({error:u})=>{const d=typeof t=="function"?t({count:c,error:u}):t;d&&await nv(d),o({count:c+1})};try{const u=await e();s(u)}catch(u){if(c<n&&await r({count:c,error:u}))return l({error:u});a(u)}};o()})}function rv(e,t={}){return async(n,r={})=>{const{dedupe:s=!1,methods:a,retryDelay:o=150,retryCount:c=3,uid:l}={...t,...r},{method:u}=n;if(a?.exclude?.includes(u))throw new et(new Error("method not supported"),{method:u});if(a?.include&&!a.include.includes(u))throw new et(new Error("method not supported"),{method:u});const d=s?wa(`${l}.${Te(n)}`):void 0;return tv(()=>xu(async()=>{try{return await e(n)}catch(h){const f=h;switch(f.code){case Jt.code:throw new Jt(f);case Kt.code:throw new Kt(f);case Xt.code:throw new Xt(f,{method:n.method});case Zt.code:throw new Zt(f);case lt.code:throw new lt(f);case en.code:throw new en(f);case tn.code:throw new tn(f);case Ye.code:throw new Ye(f);case nn.code:throw new nn(f);case et.code:throw new et(f,{method:n.method});case Pt.code:throw new Pt(f);case rn.code:throw new rn(f);case pe.code:throw new pe(f);case sn.code:throw new sn(f);case an.code:throw new an(f);case on.code:throw new on(f);case cn.code:throw new cn(f);case ut.code:throw new ut(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 hn.code:throw new hn(f);case pn.code:throw new pn(f);case mn.code:throw new mn(f);case 5e3:throw new pe(f);default:throw h instanceof A?h:new lx(f)}}},{delay:({count:h,error:f})=>{if(f&&f instanceof st){const p=f?.headers?.get("Retry-After");if(p?.match(/\d/))return Number.parseInt(p,10)*1e3}return~~(1<<h)*o},retryCount:c,shouldRetry:({error:h})=>sv(h)}),{enabled:s,id:d})}}function sv(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===Pt.code||e.code===lt.code:e instanceof st&&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 av extends A{constructor({callbackSelector:t,cause:n,data:r,extraData:s,sender:a,urls:o}){super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],n.metaMessages?.length?"":[],"Offchain Gateway Call:",o&&[" Gateway URL(s):",...o.map(c=>` ${En(c)}`)],` Sender: ${a}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${s}`].flat(),name:"OffchainLookupError"})}}class ov extends A{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${En(n)}`,`Response: ${Te(t)}`],name:"OffchainLookupResponseMalformedError"})}}class iv extends A{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 cv="0x556f1830",vu={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 lv(e,{blockNumber:t,blockTag:n,data:r,to:s}){const{args:a}=nu({data:r,abi:[vu]}),[o,c,l,u,d]=a,{ccipRead:h}=e,f=h&&typeof h?.request=="function"?h.request:wu;try{if(!ev(s,o))throw new iv({sender:o,to:s});const p=c.includes(Dr)?await cu({data:l,ccipRequest:f}):await f({data:l,sender:o,urls:c}),{data:g}=await mu(e,{blockNumber:t,blockTag:n,data:Xe([u,Sn([{type:"bytes"},{type:"bytes"}],[p,d])]),to:s});return g}catch(p){throw new av({callbackSelector:u,cause:p,data:r,extraData:d,sender:o,urls:c})}}async function wu({data:e,sender:t,urls:n}){let r=new Error("An unknown error occurred.");for(let s=0;s<n.length;s++){const a=n[s],o=a.includes("{data}")?"GET":"POST",c=o==="POST"?{data:e,sender:t}:void 0,l=o==="POST"?{"Content-Type":"application/json"}:{};try{const u=await fetch(a.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(c),headers:l,method:o});let d;if(u.headers.get("Content-Type")?.startsWith("application/json")?d=(await u.json()).data:d=await u.text(),!u.ok){r=new st({body:c,details:d?.error?Te(d.error):u.statusText,headers:u.headers,status:u.status,url:a});continue}if(!ft(d)){r=new ov({result:d,url:a});continue}return d}catch(u){r=new st({body:c,details:u.message,url:a})}}throw r}const uv=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:wu,offchainLookup:lv,offchainLookupAbiItem:vu,offchainLookupSignature:cv},Symbol.toStringTag,{value:"Module"}));function dv(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}function Cu(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:r}){return new Promise((s,a)=>{(async()=>{let o;try{const c=new AbortController;n>0&&(o=setTimeout(()=>{r?c.abort():a(t)},n)),s(await e({signal:c?.signal||null}))}catch(c){c?.name==="AbortError"&&a(t),a(c)}finally{clearTimeout(o)}})()})}function fv(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const ni=fv();function hv(e,t={}){return{async request(n){const{body:r,fetchFn:s=t.fetchFn??fetch,onRequest:a=t.onRequest,onResponse:o=t.onResponse,timeout:c=t.timeout??1e4}=n,l={...t.fetchOptions??{},...n.fetchOptions??{}},{headers:u,method:d,signal:h}=l;try{const f=await Cu(async({signal:g})=>{const b={...l,body:Array.isArray(r)?Te(r.map(w=>({jsonrpc:"2.0",id:w.id??ni.take(),...w}))):Te({jsonrpc:"2.0",id:r.id??ni.take(),...r}),headers:{"Content-Type":"application/json",...u},method:d||"POST",signal:h||(c>0?g:null)},y=new Request(e,b),x=await a?.(y,b)??{...b,url:e};return await s(x.url??e,x)},{errorInstance:new Zo({body:r,url:e}),timeout:c,signal:!0});o&&await o(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 st({body:r,details:Te(p.error)||f.statusText,headers:f.headers,status:f.status,url:e});return p}catch(f){throw f instanceof st||f instanceof Zo?f:new st({body:r,cause:f,url:e})}}}}function Su(e,t,n){const r=e[t.name];if(typeof r=="function")return r;const s=e[n];return typeof s=="function"?s:a=>t(e,a)}const Xn="2.22.1",pv=()=>`@wagmi/core@${Xn}`;var ju=function(e,t,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(e):r?r.value:t.get(e)},mr,Nu;let La=class Us extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return pv()}constructor(t,n={}){super(),mr.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 r=n.cause instanceof Us?n.cause.details:n.cause?.message?n.cause.message:n.details,s=n.cause instanceof Us&&n.cause.docsPath||n.docsPath;this.message=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${this.docsBaseUrl}${s}.html${n.docsSlug?`#${n.docsSlug}`:""}`]:[],...r?[`Details: ${r}`]:[],`Version: ${this.version}`].join(`
44
+ `),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.shortMessage=t}walk(t){return ju(this,mr,"m",Nu).call(this,this,t)}};mr=new WeakSet,Nu=function e(t,n){return n?.(t)?t:t.cause?ju(this,mr,"m",e).call(this,t.cause,n):t};class Bs extends La{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}const _s=256;let zn=_s,Vn;function Eu(e=11){if(!Vn||zn+e>_s*2){Vn="",zn=0;for(let t=0;t<_s;t++)Vn+=(256+Math.random()*256|0).toString(16).substring(1)}return Vn.substring(zn,zn+++e)}function mv(e){const{batch:t,chain:n,ccipRead:r,key:s="base",name:a="Base Client",type:o="base"}=e,c=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?Rr(e.account):void 0,{config:p,request:g,value:b}=e.transport({chain:n,pollingInterval:d}),y={...p,...b},x={account:f,batch:t,cacheTime:h,ccipRead:r,chain:n,key:s,name:a,pollingInterval:d,request:g,transport:y,type:o,uid:Eu(),...c?{experimental_blockTag:c}:{}};function v(w){return E=>{const C=E(w);for(const S in x)delete C[S];const j={...w,...C};return Object.assign(j,{extend:v(j)})}}return Object.assign(x,{extend:v(x)})}function gv({key:e,methods:t,name:n,request:r,retryCount:s=3,retryDelay:a=150,timeout:o,type:c},l){const u=Eu();return{config:{key:e,methods:t,name:n,request:r,retryCount:s,retryDelay:a,timeout:o,type:c},request:rv(r,{methods:t,retryCount:s,retryDelay:a,uid:u}),value:l}}class bv extends A{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 yv(e,t={}){const{batch:n,fetchFn:r,fetchOptions:s,key:a="http",methods:o,name:c="HTTP JSON-RPC",onFetchRequest:l,onFetchResponse:u,retryDelay:d,raw:h}=t;return({chain:f,retryCount:p,timeout:g})=>{const{batchSize:b=1e3,wait:y=0}=typeof n=="object"?n:{},x=t.retryCount??p,v=g??t.timeout??1e4,w=f?.rpcUrls.default.http[0];if(!w)throw new bv;const E=hv(w,{fetchFn:r,fetchOptions:s,onRequest:l,onResponse:u,timeout:v});return gv({key:a,methods:o,name:c,async request({method:C,params:j}){const S={method:C,params:j},{schedule:N}=pu({id:w,wait:y,shouldSplitBatch(T){return T.length>b},fn:T=>E.request({body:T}),sort:(T,R)=>T.id-R.id}),P=async T=>n?N(T):[await E.request({body:T})],[{error:k,result:O}]=await P(S);if(h)return{error:k,result:O};if(k)throw new Aa({body:S,error:k,url:w});return O},retryCount:x,retryDelay:d,timeout:v,type:"http"},{fetchOptions:s,url:w})}}function ri(e){return e.state.chainId}function xv(e,t){const{chainId:n,...r}=t,s=e.getClient({chainId:n});return Su(s,Xx,"getEnsAvatar")(r)}function vv(e,t){const{chainId:n,...r}=t,s=e.getClient({chainId:n});return Su(s,Zx,"getEnsName")(r)}let ss=!1;async function wv(e,t={}){if(ss)return[];ss=!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 r;try{r=await e.storage?.getItem("recentConnectorId")}catch{}const s={};for(const[,u]of e.state.connections)s[u.connector.id]=1;r&&(s[r]=0);const a=Object.keys(s).length>0?[...n].sort((u,d)=>(s[u.id]??10)-(s[d.id]??10)):n;let o=!1;const c=[],l=[];for(const u of a){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(o?p.connections:new Map).set(u.uid,{accounts:f.accounts,chainId:f.chainId,connector:u});return{...p,current:o?p.current:u.uid,connections:g}}),c.push({accounts:f.accounts,chainId:f.chainId,connector:u}),l.push(d),o=!0)}return(e.state.status==="reconnecting"||e.state.status==="connecting")&&(o?e.setState(u=>({...u,status:"connected"})):e.setState(u=>({...u,connections:new Map,current:null,status:"disconnected"}))),ss=!1,c}class mt extends La{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}function Cv(e,t){const{onChange:n}=t;return e.subscribe(r=>r.chainId,n)}Fa.type="injected";function Fa(e={}){const{shimDisconnect:t=!0,unstable_shimAsyncInject:n}=e;function r(){const l=e.target;if(typeof l=="function"){const u=l();if(u)return u}return typeof l=="object"?l:typeof l=="string"?{...Sv[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 s,a,o,c;return l=>({get icon(){return r().icon},get id(){return r().id},get name(){return r().name},get supportsSimulation(){return!0},type:Fa.type,async setup(){const u=await this.getProvider();u?.on&&e.target&&(o||(o=this.onConnect.bind(this),u.on("connect",o)),s||(s=this.onAccountsChanged.bind(this),u.on("accountsChanged",s)))},async connect({chainId:u,isReconnecting:d,withCapabilities:h}={}){const f=await this.getProvider();if(!f)throw new mt;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(b=>Fn(b)),p.length>0&&(p=await this.getAccounts())}catch(g){const b=g;if(b.code===pe.code)throw new pe(b);if(b.code===Ye.code)throw b}try{!p?.length&&!d&&(p=(await f.request({method:"eth_requestAccounts"})).map(y=>Fn(y))),o&&(f.removeListener("connect",o),o=void 0),s||(s=this.onAccountsChanged.bind(this),f.on("accountsChanged",s)),a||(a=this.onChainChanged.bind(this),f.on("chainChanged",a)),c||(c=this.onDisconnect.bind(this),f.on("disconnect",c));let g=await this.getChainId();return u&&g!==u&&(g=(await this.switchChain({chainId:u}).catch(y=>{if(y.code===pe.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(b=>({address:b,capabilities:{}})):p,chainId:g}}catch(g){const b=g;throw b.code===pe.code?new pe(b):b.code===Ye.code?new Ye(b):b}},async disconnect(){const u=await this.getProvider();if(!u)throw new mt;a&&(u.removeListener("chainChanged",a),a=void 0),c&&(u.removeListener("disconnect",c),c=void 0),o||(o=this.onConnect.bind(this),u.on("connect",o));try{await Cu(()=>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 mt;return(await u.request({method:"eth_accounts"})).map(h=>Fn(h))},async getChainId(){const u=await this.getProvider();if(!u)throw new mt;const d=await u.request({method:"eth_chainId"});return Number(d)},async getProvider(){if(typeof window>"u")return;let u;const d=r();return typeof d.provider=="function"?u=d.provider(window):typeof d.provider=="string"?u=Zn(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(b=>window.addEventListener("ethereum#initialized",()=>b(f()),{once:!0}))]:[],new Promise(b=>setTimeout(()=>b(f()),p))]))return!0}throw new mt}return!!(await xu(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:u,chainId:d}){const h=await this.getProvider();if(!h)throw new mt;const f=l.chains.find(g=>g.id===d);if(!f)throw new ut(new Bs);const p=new Promise(g=>{const b=(y=>{"chainId"in y&&y.chainId===d&&(l.emitter.off("change",b),g())});l.emitter.on("change",b)});try{return await Promise.all([h.request({method:"wallet_switchEthereumChain",params:[{chainId:ee(d)}]}).then(async()=>{await this.getChainId()===d&&l.emitter.emit("change",{chainId:d})}),p]),f}catch(g){const b=g;if(b.code===4902||b?.data?.originalError?.code===4902)try{const{default:y,...x}=f.blockExplorers??{};let v;u?.blockExplorerUrls?v=u.blockExplorerUrls:y&&(v=[y.url,...Object.values(x).map(C=>C.url)]);let w;u?.rpcUrls?.length?w=u.rpcUrls:w=[f.rpcUrls.default?.http[0]??""];const E={blockExplorerUrls:v,chainId:ee(d),chainName:u?.chainName??f.name,iconUrls:u?.iconUrls,nativeCurrency:u?.nativeCurrency??f.nativeCurrency,rpcUrls:w};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 pe(new Error("User rejected switch after adding network."))}),p]),f}catch(y){throw new pe(y)}throw b.code===pe.code?new pe(b):new ut(b)}},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=>Fn(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&&(o&&(f.removeListener("connect",o),o=void 0),s||(s=this.onAccountsChanged.bind(this),f.on("accountsChanged",s)),a||(a=this.onChainChanged.bind(this),f.on("chainChanged",a)),c||(c=this.onDisconnect.bind(this),f.on("disconnect",c)))},async onDisconnect(u){const d=await this.getProvider();u&&u.code===1013&&d&&(await this.getAccounts()).length||(l.emitter.emit("disconnect"),d&&(a&&(d.removeListener("chainChanged",a),a=void 0),c&&(d.removeListener("disconnect",c),c=void 0),o||(o=this.onConnect.bind(this),d.on("connect",o))))}})}const Sv={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(e){return e?.coinbaseWalletExtension?e.coinbaseWalletExtension:Zn(e,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(e){return Zn(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 r of n)if(t[r])return!1;return!0})}},phantom:{id:"phantom",name:"Phantom",provider(e){return e?.phantom?.ethereum?e.phantom?.ethereum:Zn(e,"isPhantom")}}};function Zn(e,t){function n(s){return typeof t=="function"?t(s):typeof t=="string"?s[t]:!0}const r=e.ethereum;if(r?.providers)return r.providers.find(s=>n(s));if(r&&n(r))return r}function jv(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 Nv(){const e=new Set;let t=[];const n=()=>jv(s=>{t.some(({info:a})=>a.uuid===s.info.uuid)||(t=[...t,s],e.forEach(a=>a(t,{added:[s]})))});let r=n();return{_listeners(){return e},clear(){e.forEach(s=>s([],{removed:[...t]})),t=[]},destroy(){this.clear(),e.clear(),r?.()},findProvider({rdns:s}){return t.find(a=>a.info.rdns===s)},getProviders(){return t},reset(){this.clear(),r?.(),r=n()},subscribe(s,{emitImmediately:a}={}){return e.add(s),a&&s(t,{added:t}),()=>e.delete(s)}}}const Ev=e=>(t,n,r)=>{const s=r.subscribe;return r.subscribe=(o,c,l)=>{let u=o;if(c){const d=l?.equalityFn||Object.is;let h=o(r.getState());u=f=>{const p=o(f);if(!d(h,p)){const g=h;c(h=p,g)}},l?.fireImmediately&&c(h,h)}return s(u)},e(t,n,r)},Pv=Ev;function Ov(e,t){let n;try{n=e()}catch{return}return{getItem:s=>{var a;const o=l=>l===null?null:JSON.parse(l,void 0),c=(a=n.getItem(s))!=null?a:null;return c instanceof Promise?c.then(o):o(c)},setItem:(s,a)=>n.setItem(s,JSON.stringify(a,void 0)),removeItem:s=>n.removeItem(s)}}const Hs=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return Hs(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return Hs(r)(n)}}}},Iv=(e,t)=>(n,r,s)=>{let a={storage:Ov(()=>localStorage),partialize:b=>b,version:0,merge:(b,y)=>({...y,...b}),...t},o=!1;const c=new Set,l=new Set;let u=a.storage;if(!u)return e((...b)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...b)},r,s);const d=()=>{const b=a.partialize({...r()});return u.setItem(a.name,{state:b,version:a.version})},h=s.setState;s.setState=(b,y)=>{h(b,y),d()};const f=e((...b)=>{n(...b),d()},r,s);s.getInitialState=()=>f;let p;const g=()=>{var b,y;if(!u)return;o=!1,c.forEach(v=>{var w;return v((w=r())!=null?w:f)});const x=((y=a.onRehydrateStorage)==null?void 0:y.call(a,(b=r())!=null?b:f))||void 0;return Hs(u.getItem.bind(u))(a.name).then(v=>{if(v)if(typeof v.version=="number"&&v.version!==a.version){if(a.migrate)return[!0,a.migrate(v.state,v.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,v.state];return[!1,void 0]}).then(v=>{var w;const[E,C]=v;if(p=a.merge(C,(w=r())!=null?w:f),n(p,!0),E)return d()}).then(()=>{x?.(p,void 0),p=r(),o=!0,l.forEach(v=>v(p))}).catch(v=>{x?.(void 0,v)})};return s.persist={setOptions:b=>{a={...a,...b},b.storage&&(u=b.storage)},clearStorage:()=>{u?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>g(),hasHydrated:()=>o,onHydrate:b=>(c.add(b),()=>{c.delete(b)}),onFinishHydration:b=>(l.add(b),()=>{l.delete(b)})},a.skipHydration||g(),p||f},kv=Iv,si=e=>{let t;const n=new Set,r=(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))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u))},l=t=e(r,s,c);return c},as=e=>e?si(e):si;var os={exports:{}},ai;function Mv(){return ai||(ai=1,(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function s(l,u,d){this.fn=l,this.context=u,this.once=d||!1}function a(l,u,d,h,f){if(typeof d!="function")throw new TypeError("The listener must be a function");var p=new s(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 o(l,u){--l._eventsCount===0?l._events=new r:delete l._events[u]}function c(){this._events=new r,this._eventsCount=0}c.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},c.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},c.prototype.listenerCount=function(u){var d=n?n+u:u,h=this._events[d];return h?h.fn?1:h.length:0},c.prototype.emit=function(u,d,h,f,p,g){var b=n?n+u:u;if(!this._events[b])return!1;var y=this._events[b],x=arguments.length,v,w;if(y.fn){switch(y.once&&this.removeListener(u,y.fn,void 0,!0),x){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(w=1,v=new Array(x-1);w<x;w++)v[w-1]=arguments[w];y.fn.apply(y.context,v)}else{var E=y.length,C;for(w=0;w<E;w++)switch(y[w].once&&this.removeListener(u,y[w].fn,void 0,!0),x){case 1:y[w].fn.call(y[w].context);break;case 2:y[w].fn.call(y[w].context,d);break;case 3:y[w].fn.call(y[w].context,d,h);break;case 4:y[w].fn.call(y[w].context,d,h,f);break;default:if(!v)for(C=1,v=new Array(x-1);C<x;C++)v[C-1]=arguments[C];y[w].fn.apply(y[w].context,v)}}return!0},c.prototype.on=function(u,d,h){return a(this,u,d,h,!1)},c.prototype.once=function(u,d,h){return a(this,u,d,h,!0)},c.prototype.removeListener=function(u,d,h,f){var p=n?n+u:u;if(!this._events[p])return this;if(!d)return o(this,p),this;var g=this._events[p];if(g.fn)g.fn===d&&(!f||g.once)&&(!h||g.context===h)&&o(this,p);else{for(var b=0,y=[],x=g.length;b<x;b++)(g[b].fn!==d||f&&!g[b].once||h&&g[b].context!==h)&&y.push(g[b]);y.length?this._events[p]=y.length===1?y[0]:y:o(this,p)}return this},c.prototype.removeAllListeners=function(u){var d;return u?(d=n?n+u:u,this._events[d]&&o(this,d)):(this._events=new r,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=n,c.EventEmitter=c,e.exports=c})(os)),os.exports}var Tv=Mv();const Av=Ki(Tv);class Rv{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 Av})}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 r=n[0];this._emitter.emit(t,{uid:this.uid,...r})}listenerCount(t){return this._emitter.listenerCount(t)}}function Dv(e){return new Rv(e)}function Lv(e,t){return JSON.parse(e,(n,r)=>{let s=r;return s?.__type==="bigint"&&(s=BigInt(s.value)),s?.__type==="Map"&&(s=new Map(s.value)),t?.(n,s)??s})}function oi(e,t){return e.slice(0,t).join(".")||"."}function ii(e,t){const{length:n}=e;for(let r=0;r<n;++r)if(e[r]===t)return r+1;return 0}function Fv(e,t){const n=typeof e=="function",r=typeof t=="function",s=[],a=[];return function(c,l){if(typeof l=="object")if(s.length){const u=ii(s,this);u===0?s[s.length]=this:(s.splice(u),a.splice(u)),a[a.length]=c;const d=ii(s,l);if(d!==0)return r?t.call(this,c,l,oi(a,d)):`[ref=${oi(a,d)}]`}else s[0]=l,a[0]=c;return n?e.call(this,c,l):l}}function $v(e,t,n,r){return JSON.stringify(e,Fv((s,a)=>{let o=a;return typeof o=="bigint"&&(o={__type:"bigint",value:a.toString()}),o instanceof Map&&(o={__type:"Map",value:Array.from(a.entries())}),t?.(s,o)??o},r),n??void 0)}function zv(e){const{deserialize:t=Lv,key:n="wagmi",serialize:r=$v,storage:s=Pu}=e;function a(o){return o instanceof Promise?o.then(c=>c).catch(()=>null):o}return{...s,key:n,async getItem(o,c){const l=s.getItem(`${n}.${o}`),u=await a(l);return u?t(u)??null:c??null},async setItem(o,c){const l=`${n}.${o}`;c===null?await a(s.removeItem(l)):await a(s.setItem(l,r(c)))},async removeItem(o){await a(s.removeItem(`${n}.${o}`))}}}const Pu={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};function Vv(){const e=typeof window<"u"&&window.localStorage?window.localStorage:Pu;return{getItem(t){return e.getItem(t)},removeItem(t){e.removeItem(t)},setItem(t,n){try{e.setItem(t,n)}catch{}}}}const Ws=256;let Un=Ws,Bn;function Uv(e=11){if(!Bn||Un+e>Ws*2){Bn="",Un=0;for(let t=0;t<Ws;t++)Bn+=(256+Math.random()*256|0).toString(16).substring(1)}return Bn.substring(Un,Un+++e)}function Bv(e){const{multiInjectedProviderDiscovery:t=!0,storage:n=zv({storage:Vv()}),syncConnectedChain:r=!0,ssr:s=!1,...a}=e,o=typeof window<"u"&&t?Nv():void 0,c=as(()=>a.chains),l=as(()=>{const C=[],j=new Set;for(const S of a.connectors??[]){const N=u(S);if(C.push(N),!s&&N.rdns){const P=typeof N.rdns=="string"?[N.rdns]:N.rdns;for(const k of P)j.add(k)}}if(!s&&o){const S=o.getProviders();for(const N of S)j.has(N.info.rdns)||C.push(u(d(N)))}return C});function u(C){const j=Dv(Uv()),S={...C({emitter:j,chains:c.getState(),storage:n,transports:a.transports}),emitter:j,uid:j.uid};return j.on("connect",w),S.setup?.(),S}function d(C){const{info:j}=C,S=C.provider;return Fa({target:{...j,id:j.rdns,provider:S}})}const h=new Map;function f(C={}){const j=C.chainId??y.getState().chainId,S=c.getState().find(P=>P.id===j);if(C.chainId&&!S)throw new Bs;{const P=h.get(y.getState().chainId);if(P&&!S)return P;if(!S)throw new Bs}{const P=h.get(j);if(P)return P}let N;if(a.client)N=a.client({chain:S});else{const P=S.id,k=c.getState().map(R=>R.id),O={},T=Object.entries(a);for(const[R,D]of T)if(!(R==="chains"||R==="client"||R==="connectors"||R==="transports"))if(typeof D=="object")if(P in D)O[R]=D[P];else{if(k.some(U=>U in D))continue;O[R]=D}else O[R]=D;N=mv({...O,chain:S,batch:O.batch??{multicall:!0},transport:R=>a.transports[P]({...R,connectors:l})})}return h.set(j,N),N}function p(){return{chainId:c.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let g;const b="0.0.0-canary-";Xn.startsWith(b)?g=Number.parseInt(Xn.replace(b,""),10):g=Number.parseInt(Xn.split(".")[0]??"0",10);const y=as(Pv(n?kv(p,{migrate(C,j){if(j===g)return C;const S=p(),N=x(C,S.chainId);return{...S,chainId:N}},name:"store",partialize(C){return{connections:{__type:"Map",value:Array.from(C.connections.entries()).map(([j,S])=>{const{id:N,name:P,type:k,uid:O}=S.connector;return[j,{...S,connector:{id:N,name:P,type:k,uid:O}}]})},chainId:C.chainId,current:C.current}},merge(C,j){typeof C=="object"&&C&&"status"in C&&delete C.status;const S=x(C,j.chainId);return{...j,...C,chainId:S}},skipHydration:s,storage:n,version:g}):p));y.setState(p());function x(C,j){return C&&typeof C=="object"&&"chainId"in C&&typeof C.chainId=="number"&&c.getState().some(S=>S.id===C.chainId)?C.chainId:j}r&&y.subscribe(({connections:C,current:j})=>j?C.get(j)?.chainId:void 0,C=>{if(c.getState().some(S=>S.id===C))return y.setState(S=>({...S,chainId:C??S.chainId}))}),o?.subscribe(C=>{const j=new Set,S=new Set;for(const P of l.getState())if(j.add(P.id),P.rdns){const k=typeof P.rdns=="string"?[P.rdns]:P.rdns;for(const O of k)S.add(O)}const N=[];for(const P of C){if(S.has(P.info.rdns))continue;const k=u(d(P));j.has(k.id)||N.push(k)}n&&!y.persist.hasHydrated()||l.setState(P=>[...P,...N],!0)});function v(C){y.setState(j=>{const S=j.connections.get(C.uid);return S?{...j,connections:new Map(j.connections).set(C.uid,{accounts:C.accounts??S.accounts,chainId:C.chainId??S.chainId,connector:S.connector})}:j})}function w(C){y.getState().status==="connecting"||y.getState().status==="reconnecting"||y.setState(j=>{const S=l.getState().find(N=>N.uid===C.uid);return S?(S.emitter.listenerCount("connect")&&S.emitter.off("connect",v),S.emitter.listenerCount("change")||S.emitter.on("change",v),S.emitter.listenerCount("disconnect")||S.emitter.on("disconnect",E),{...j,connections:new Map(j.connections).set(C.uid,{accounts:C.accounts,chainId:C.chainId,connector:S}),current:C.uid,status:"connected"}):j})}function E(C){y.setState(j=>{const S=j.connections.get(C.uid);if(S){const P=S.connector;P.emitter.listenerCount("change")&&S.connector.emitter.off("change",v),P.emitter.listenerCount("disconnect")&&S.connector.emitter.off("disconnect",E),P.emitter.listenerCount("connect")||S.connector.emitter.on("connect",w)}if(j.connections.delete(C.uid),j.connections.size===0)return{...j,connections:new Map,current:null,status:"disconnected"};const N=j.connections.values().next().value;return{...j,connections:new Map(j.connections),current:N.connector.uid}})}return{get chains(){return c.getState()},get connectors(){return l.getState()},storage:n,getClient:f,get state(){return y.getState()},setState(C){let j;typeof C=="function"?j=C(y.getState()):j=C;const S=p();typeof j!="object"&&(j=S),Object.keys(S).some(P=>!(P in j))&&(j=S),y.setState(j,!0)},subscribe(C,j,S){return y.subscribe(C,j,S?{...S,fireImmediately:S.emitImmediately}:void 0)},_internal:{mipd:o,async revalidate(){const C=y.getState(),j=C.connections;let S=C.current;for(const[,N]of j){const P=N.connector;P.isAuthorized&&await P.isAuthorized()||(j.delete(P.uid),S===P.uid&&(S=null))}y.setState(N=>({...N,connections:j,current:S}))},store:y,ssr:!!s,syncConnectedChain:r,transports:a.transports,chains:{setState(C){const j=typeof C=="function"?C(c.getState()):C;if(j.length!==0)return c.setState(j,!0)},subscribe(C){return c.subscribe(C)}},connectors:{providerDetailToConnector:d,setup:u,setState(C){return l.setState(typeof C=="function"?C(l.getState()):C,!0)},subscribe(C){return l.subscribe(C)}},events:{change:v,connect:w,disconnect:E}}}}function _v(e,t){const{initialState:n,reconnectOnMount:r}=t;return n&&!e._internal.store.persist.hasHydrated()&&e.setState({...n,chainId:e.chains.some(s=>s.id===n.chainId)?n.chainId:e.chains[0].id,connections:r?n.connections:new Map,status:r?"reconnecting":"disconnected"}),{async onMount(){e._internal.ssr&&(await e._internal.store.persist.rehydrate(),e._internal.mipd&&e._internal.connectors.setState(s=>{const a=new Set;for(const l of s??[])if(l.rdns){const u=Array.isArray(l.rdns)?l.rdns:[l.rdns];for(const d of u)a.add(d)}const o=[],c=e._internal.mipd?.getProviders()??[];for(const l of c){if(a.has(l.info.rdns))continue;const u=e._internal.connectors.providerDetailToConnector(l),d=e._internal.connectors.setup(u);o.push(d)}return[...s,...o]})),r?wv(e):e.storage&&e.setState(s=>({...s,connections:new Map}))}}}function Hv(e){const{children:t,config:n,initialState:r,reconnectOnMount:s=!0}=e,{onMount:a}=_v(n,{initialState:r,reconnectOnMount:s});n._internal.ssr||a();const o=m.useRef(!0);return m.useEffect(()=>{if(o.current&&n._internal.ssr)return a(),()=>{o.current=!1}},[]),t}const Ou=m.createContext(void 0);function Wv(e){const{children:t,config:n}=e,r={value:n};return m.createElement(Hv,e,m.createElement(Ou.Provider,r,t))}const Gv="2.19.2",qv=()=>`wagmi@${Gv}`;class Qv extends La{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 qv()}}class Yv extends Qv{constructor(){super("`useConfig` must be used within `WagmiProvider`.",{docsPath:"/api/WagmiProvider"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiProviderNotFoundError"})}}function $a(e={}){const t=e.config??m.useContext(Ou);if(!t)throw new Yv;return t}var Pn=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(){}},Jv={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Kv=class{#e=Jv;#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)}},tt=new Kv;function Xv(e){setTimeout(e,0)}var dt=typeof window>"u"||"Deno"in globalThis;function ge(){}function Zv(e,t){return typeof e=="function"?e(t):e}function Gs(e){return typeof e=="number"&&e>=0&&e!==1/0}function Iu(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Je(e,t){return typeof e=="function"?e(t):e}function Ce(e,t){return typeof e=="function"?e(t):e}function ci(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:a,queryKey:o,stale:c}=e;if(o){if(r){if(t.queryHash!==za(o,t.options))return!1}else if(!bn(t.queryKey,o))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof c=="boolean"&&t.isStale()!==c||s&&s!==t.state.fetchStatus||a&&!a(t))}function li(e,t){const{exact:n,status:r,predicate:s,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(gn(t.options.mutationKey)!==gn(a))return!1}else if(!bn(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function za(e,t){return(t?.queryKeyHashFn||gn)(e)}function gn(e){return JSON.stringify(e,(t,n)=>Qs(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function bn(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>bn(e[n],t[n])):!1}var e5=Object.prototype.hasOwnProperty;function ku(e,t){if(e===t)return e;const n=ui(e)&&ui(t);if(!n&&!(Qs(e)&&Qs(t)))return t;const s=(n?e:Object.keys(e)).length,a=n?t:Object.keys(t),o=a.length,c=n?new Array(o):{};let l=0;for(let u=0;u<o;u++){const d=n?u:a[u],h=e[d],f=t[d];if(h===f){c[d]=h,(n?u<s:e5.call(e,d))&&l++;continue}if(h===null||f===null||typeof h!="object"||typeof f!="object"){c[d]=f;continue}const p=ku(h,f);c[d]=p,p===h&&l++}return s===o&&l===s?e:c}function qs(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 ui(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Qs(e){if(!di(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!di(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function di(e){return Object.prototype.toString.call(e)==="[object Object]"}function t5(e){return new Promise(t=>{tt.setTimeout(t,e)})}function Ys(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?ku(e,t):t}function n5(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function r5(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Va=Symbol();function Mu(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Va?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function s5(e,t){return typeof e=="function"?e(...t):!!e}var a5=class extends Pn{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!dt&&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"}},Ua=new a5;function Js(){let e,t;const n=new Promise((s,a)=>{e=s,t=a});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var o5=Xv;function i5(){let e=[],t=0,n=c=>{c()},r=c=>{c()},s=o5;const a=c=>{t?e.push(c):s(()=>{n(c)})},o=()=>{const c=e;e=[],c.length&&s(()=>{r(()=>{c.forEach(l=>{n(l)})})})};return{batch:c=>{let l;t++;try{l=c()}finally{t--,t||o()}return l},batchCalls:c=>(...l)=>{a(()=>{c(...l)})},schedule:a,setNotifyFunction:c=>{n=c},setBatchNotifyFunction:c=>{r=c},setScheduler:c=>{s=c}}}var de=i5(),c5=class extends Pn{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!dt&&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}},gr=new c5;function l5(e){return Math.min(1e3*2**e,3e4)}function Tu(e){return(e??"online")==="online"?gr.isOnline():!0}var Ks=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Au(e){let t=!1,n=0,r;const s=Js(),a=()=>s.status!=="pending",o=b=>{if(!a()){const y=new Ks(b);f(y),e.onCancel?.(y)}},c=()=>{t=!0},l=()=>{t=!1},u=()=>Ua.isFocused()&&(e.networkMode==="always"||gr.isOnline())&&e.canRun(),d=()=>Tu(e.networkMode)&&e.canRun(),h=b=>{a()||(r?.(),s.resolve(b))},f=b=>{a()||(r?.(),s.reject(b))},p=()=>new Promise(b=>{r=y=>{(a()||u())&&b(y)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),g=()=>{if(a())return;let b;const y=n===0?e.initialPromise:void 0;try{b=y??e.fn()}catch(x){b=Promise.reject(x)}Promise.resolve(b).then(h).catch(x=>{if(a())return;const v=e.retry??(dt?0:3),w=e.retryDelay??l5,E=typeof w=="function"?w(n,x):w,C=v===!0||typeof v=="number"&&n<v||typeof v=="function"&&v(n,x);if(t||!C){f(x);return}n++,e.onFail?.(n,x),t5(E).then(()=>u()?void 0:p()).then(()=>{t?f(x):g()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r?.(),s),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?g():p().then(g),s)}}var Ru=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Gs(this.gcTime)&&(this.#e=tt.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(dt?1/0:300*1e3))}clearGcTimeout(){this.#e&&(tt.clearTimeout(this.#e),this.#e=void 0)}},u5=class extends Ru{#e;#t;#n;#s;#r;#i;#o;constructor(e){super(),this.#o=!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=hi(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=hi(this.options);t.data!==void 0&&(this.setState(fi(t.data,t.dataUpdatedAt)),this.#e=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const n=Ys(this.state.data,e,this.options);return this.#a({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#a({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#r?.promise;return this.#r?.cancel(e),t?t.then(ge).catch(ge):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>Ce(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Va||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Je(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:!Iu(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.#o?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.#a({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 c=this.observers.find(l=>l.options.queryFn);c&&this.setOptions(c.options)}const n=new AbortController,r=c=>{Object.defineProperty(c,"signal",{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},s=()=>{const c=Mu(this.options,t),u=(()=>{const d={client:this.#s,queryKey:this.queryKey,meta:this.meta};return r(d),d})();return this.#o=!1,this.options.persister?this.options.persister(c,u,this):c(u)},o=(()=>{const c={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#s,state:this.state,fetchFn:s};return r(c),c})();this.options.behavior?.onFetch(o,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#a({type:"fetch",meta:o.fetchOptions?.meta}),this.#r=Au({initialPromise:t?.initialPromise,fn:o.fetchFn,onCancel:c=>{c instanceof Ks&&c.revert&&this.setState({...this.#t,fetchStatus:"idle"}),n.abort()},onFail:(c,l)=>{this.#a({type:"failed",failureCount:c,error:l})},onPause:()=>{this.#a({type:"pause"})},onContinue:()=>{this.#a({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{const c=await this.#r.start();if(c===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(c),this.#n.config.onSuccess?.(c,this),this.#n.config.onSettled?.(c,this.state.error,this),c}catch(c){if(c instanceof Ks){if(c.silent)return this.#r.promise;if(c.revert){if(this.state.data===void 0)throw c;return this.state.data}}throw this.#a({type:"error",error:c}),this.#n.config.onError?.(c,this),this.#n.config.onSettled?.(this.state.data,c,this),c}finally{this.scheduleGc()}}#a(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,...Du(n.data,this.options),fetchMeta:e.meta??null};case"success":const r={...n,...fi(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?r:void 0,r;case"error":const s=e.error;return{...n,error:s,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),de.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function Du(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Tu(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function fi(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function hi(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var d5=class extends Pn{constructor(e,t){super(),this.options=t,this.#e=e,this.#a=null,this.#o=Js(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#s=void 0;#r;#i;#o;#a;#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),pi(this.#t,this.options)?this.#d():this.updateResult(),this.#x())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Xs(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Xs(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#v(),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 Ce(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&&!qs(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&mi(this.#t,n,this.options,t)&&this.#d(),this.updateResult(),r&&(this.#t!==n||Ce(this.options.enabled,this.#t)!==Ce(t.enabled,this.#t)||Je(this.options.staleTime,this.#t)!==Je(t.staleTime,this.#t))&&this.#g();const s=this.#b();r&&(this.#t!==n||Ce(this.options.enabled,this.#t)!==Ce(t.enabled,this.#t)||s!==this.#c)&&this.#y(s)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return h5(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,r)=>(this.trackProp(r),t?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#o.status==="pending"&&this.#o.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,r))})}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(ge)),t}#g(){this.#v();const e=Je(this.options.staleTime,this.#t);if(dt||this.#s.isStale||!Gs(e))return;const n=Iu(this.#s.dataUpdatedAt,e)+1;this.#l=tt.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,!(dt||Ce(this.options.enabled,this.#t)===!1||!Gs(this.#c)||this.#c===0)&&(this.#u=tt.setInterval(()=>{(this.options.refetchIntervalInBackground||Ua.isFocused())&&this.#d()},this.#c))}#x(){this.#g(),this.#y(this.#b())}#v(){this.#l&&(tt.clearTimeout(this.#l),this.#l=void 0)}#w(){this.#u&&(tt.clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const n=this.#t,r=this.options,s=this.#s,a=this.#r,o=this.#i,l=e!==n?e.state:this.#n,{state:u}=e;let d={...u},h=!1,f;if(t._optimisticResults){const N=this.hasListeners(),P=!N&&pi(e,t),k=N&&mi(e,n,t,r);(P||k)&&(d={...d,...Du(u.data,e.options)}),t._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:p,errorUpdatedAt:g,status:b}=d;f=d.data;let y=!1;if(t.placeholderData!==void 0&&f===void 0&&b==="pending"){let N;s?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(N=s.data,y=!0):N=typeof t.placeholderData=="function"?t.placeholderData(this.#h?.state.data,this.#h):t.placeholderData,N!==void 0&&(b="success",f=Ys(s?.data,N,t),h=!0)}if(t.select&&f!==void 0&&!y)if(s&&f===a?.data&&t.select===this.#m)f=this.#f;else try{this.#m=t.select,f=t.select(f),f=Ys(s?.data,f,t),this.#f=f,this.#a=null}catch(N){this.#a=N}this.#a&&(p=this.#a,f=this.#f,g=Date.now(),b="error");const x=d.fetchStatus==="fetching",v=b==="pending",w=b==="error",E=v&&x,C=f!==void 0,S={status:b,fetchStatus:d.fetchStatus,isPending:v,isSuccess:b==="success",isError:w,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:x,isRefetching:x&&!v,isLoadingError:w&&!C,isPaused:d.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:w&&C,isStale:Ba(e,t),refetch:this.refetch,promise:this.#o,isEnabled:Ce(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const N=O=>{S.status==="error"?O.reject(S.error):S.data!==void 0&&O.resolve(S.data)},P=()=>{const O=this.#o=S.promise=Js();N(O)},k=this.#o;switch(k.status){case"pending":e.queryHash===n.queryHash&&N(k);break;case"fulfilled":(S.status==="error"||S.data!==k.value)&&P();break;case"rejected":(S.status!=="error"||S.error!==k.reason)&&P();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),qs(t,e))return;this.#s=t;const n=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,s=typeof r=="function"?r():r;if(s==="all"||!s&&!this.#p.size)return!0;const a=new Set(s??this.#p);return this.options.throwOnError&&a.add("error"),Object.keys(this.#s).some(o=>{const c=o;return this.#s[c]!==e[c]&&a.has(c)})};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.#x()}#S(e){de.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#s)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function f5(e,t){return Ce(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function pi(e,t){return f5(e,t)||e.state.data!==void 0&&Xs(e,t,t.refetchOnMount)}function Xs(e,t,n){if(Ce(t.enabled,e)!==!1&&Je(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Ba(e,t)}return!1}function mi(e,t,n,r){return(e!==t||Ce(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Ba(e,n)}function Ba(e,t){return Ce(t.enabled,e)!==!1&&e.isStaleByTime(Je(t.staleTime,e))}function h5(e,t){return!qs(e.getCurrentResult(),t)}function gi(e){return{onFetch:(t,n)=>{const r=t.options,s=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[];let c={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=Mu(t.options,t.fetchOptions),p=async(g,b,y)=>{if(d)return Promise.reject();if(b==null&&g.pages.length)return Promise.resolve(g);const v=(()=>{const j={client:t.client,queryKey:t.queryKey,pageParam:b,direction:y?"backward":"forward",meta:t.options.meta};return h(j),j})(),w=await f(v),{maxPages:E}=t.options,C=y?r5:n5;return{pages:C(g.pages,w,E),pageParams:C(g.pageParams,b,E)}};if(s&&a.length){const g=s==="backward",b=g?p5:bi,y={pages:a,pageParams:o},x=b(r,y);c=await p(y,x,g)}else{const g=e??a.length;do{const b=l===0?o[0]??r.initialPageParam:bi(r,c);if(l>0&&b==null)break;c=await p(c,b),l++}while(l<g)}return c};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 bi(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function p5(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var m5=class extends Ru{#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||g5(),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=Au({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(a,o)=>{this.#r({type:"failed",failureCount:a,error:o})},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 r=this.state.status==="pending",s=!this.#s.canStart();try{if(r)t();else{this.#r({type:"pending",variables:e,isPaused:s}),await this.#n.config.onMutate?.(e,this,n);const o=await this.options.onMutate?.(e,n);o!==this.state.context&&this.#r({type:"pending",context:o,variables:e,isPaused:s})}const a=await this.#s.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#r({type:"success",data:a}),a}catch(a){try{throw await this.#n.config.onError?.(a,e,this.state.context,this,n),await this.options.onError?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(void 0,a,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(void 0,a,e,this.state.context,n),a}finally{this.#r({type:"error",error:a})}}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),de.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function g5(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var b5=class extends Pn{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 r=new m5({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}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 r=n.indexOf(e);r!==-1&&n.splice(r,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 r=this.#t.get(t)?.find(s=>s.state.status==="pending");return!r||r===e}else return!0}runNext(e){const t=_n(e);return typeof t=="string"?this.#t.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){de.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=>li(t,n))}findAll(e={}){return this.getAll().filter(t=>li(e,t))}notify(e){de.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return de.batch(()=>Promise.all(e.map(t=>t.continue().catch(ge))))}};function _n(e){return e.options.scope?.id}var y5=class extends Pn{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){const r=t.queryKey,s=t.queryHash??za(r,t);let a=this.get(s);return a||(a=new u5({client:e,queryKey:r,queryHash:s,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}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(){de.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=>ci(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>ci(e,n)):t}notify(e){de.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){de.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){de.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},x5=class{#e;#t;#n;#s;#r;#i;#o;#a;constructor(e={}){this.#e=e.queryCache||new y5,this.#t=e.mutationCache||new b5,this.#n=e.defaultOptions||{},this.#s=new Map,this.#r=new Map,this.#i=0}mount(){this.#i++,this.#i===1&&(this.#o=Ua.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#a=gr.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#i--,this.#i===0&&(this.#o?.(),this.#o=void 0,this.#a?.(),this.#a=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),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Je(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),a=this.#e.get(r.queryHash)?.state.data,o=Zv(t,a);if(o!==void 0)return this.#e.build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return de.batch(()=>this.#e.findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;de.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return de.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=de.batch(()=>this.#e.findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(ge).catch(ge)}invalidateQueries(e,t={}){return de.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},r=de.batch(()=>this.#e.findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let a=s.fetch(void 0,n);return n.throwOnError||(a=a.catch(ge)),s.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(r).then(ge)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime(Je(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ge).catch(ge)}fetchInfiniteQuery(e){return e.behavior=gi(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ge).catch(ge)}ensureInfiniteQueryData(e){return e.behavior=gi(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return gr.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(gn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#s.values()],n={};return t.forEach(r=>{bn(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#r.set(gn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(r=>{bn(e,r.mutationKey)&&Object.assign(n,r.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=za(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===Va&&(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 v5(e){return JSON.stringify(e,(t,n)=>w5(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):typeof n=="bigint"?n.toString():n)}function w5(e){if(!yi(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!yi(n)||!n.hasOwnProperty("isPrototypeOf"))}function yi(e){return Object.prototype.toString.call(e)==="[object Object]"}function Lu(e){const{_defaulted:t,behavior:n,gcTime:r,initialData:s,initialDataUpdatedAt:a,maxPages:o,meta:c,networkMode:l,queryFn:u,queryHash:d,queryKey:h,queryKeyHashFn:f,retry:p,retryDelay:g,structuralSharing:b,getPreviousPageParam:y,getNextPageParam:x,initialPageParam:v,_optimisticResults:w,enabled:E,notifyOnChangeProps:C,placeholderData:j,refetchInterval:S,refetchIntervalInBackground:N,refetchOnMount:P,refetchOnReconnect:k,refetchOnWindowFocus:O,retryOnMount:T,select:R,staleTime:D,suspense:V,throwOnError:U,config:H,connector:q,query:W,...te}=e;return te}function C5(e,t={}){return{async queryFn({queryKey:n}){const{name:r,scopeKey:s,...a}=n[1];if(!r)throw new Error("name is required");return xv(e,{...a,name:r})},queryKey:S5(t)}}function S5(e={}){return["ensAvatar",Lu(e)]}function j5(e,t={}){return{async queryFn({queryKey:n}){const{address:r,scopeKey:s,...a}=n[1];if(!r)throw new Error("address is required");return vv(e,{...a,address:r})},queryKey:N5(t)}}function N5(e={}){return["ensName",Lu(e)]}var Fu=m.createContext(void 0),E5=e=>{const t=m.useContext(Fu);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},P5=({client:e,children:t})=>(m.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),i.jsx(Fu.Provider,{value:e,children:t})),$u=m.createContext(!1),O5=()=>m.useContext($u);$u.Provider;function I5(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var k5=m.createContext(I5()),M5=()=>m.useContext(k5),T5=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},A5=e=>{m.useEffect(()=>{e.clearReset()},[e])},R5=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||s5(n,[e.error,r])),D5=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},L5=(e,t)=>e.isLoading&&e.isFetching&&!t,F5=(e,t)=>e?.suspense&&t.isPending,xi=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function $5(e,t,n){const r=O5(),s=M5(),a=E5(),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o),o._optimisticResults=r?"isRestoring":"optimistic",D5(o),T5(o,s),A5(s);const c=!a.getQueryCache().get(o.queryHash),[l]=m.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&e.subscribed!==!1;if(m.useSyncExternalStore(m.useCallback(h=>{const f=d?l.subscribe(de.batchCalls(h)):ge;return l.updateResult(),f},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),m.useEffect(()=>{l.setOptions(o)},[o,l]),F5(o,u))throw xi(o,l,s);if(R5({result:u,errorResetBoundary:s,throwOnError:o.throwOnError,query:a.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw u.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!dt&&L5(u,r)&&(c?xi(o,l,s):a.getQueryCache().get(o.queryHash)?.promise)?.catch(ge).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?u:l.trackResult(u)}function z5(e,t){return $5(e,d5)}function zu(e){const t=z5({...e,queryKeyHashFn:v5});return t.queryKey=e.queryKey,t}function Vu(e={}){const t=$a(e);return m.useSyncExternalStore(n=>Cv(t,{onChange:n}),()=>ri(t),()=>ri(t))}function V5(e={}){const{name:t,query:n={}}=e,r=$a(e),s=Vu({config:r}),a=C5(r,{...e,chainId:e.chainId??s}),o=!!(t&&(n.enabled??!0));return zu({...n,...a,enabled:o})}function Uu(e={}){const{address:t,query:n={}}=e,r=$a(e),s=Vu({config:r}),a=j5(r,{...e,chainId:e.chainId??s}),o=!!(t&&(n.enabled??!0));return zu({...n,...a,enabled:o})}const U5=new URL("/assets/powerhouse-rounded-CeKGGUG4.png",import.meta.url).href;function Bu(e){const{address:t,chainId:n=1,size:r="14px"}=e,s={width:r,height:r},a=Uu({address:t,chainId:n}),o=a.data??void 0,c=V5({name:o}),l=c.data??U5;return a.isLoading||c.isLoading?i.jsx("div",{className:"fade-out flex-none animate-pulse rounded-full bg-gray-400",style:s}):i.jsx("img",{alt:"ENS Avatar",className:"flex-none rounded-full object-contain",src:l,style:s})}const _u=["RENAME","DELETE","DUPLICATE"],B5=[{value:"LOCAL",icon:i.jsx(I,{name:"Lock",size:16}),description:"Only available to you"},{value:"CLOUD",icon:i.jsx(I,{name:"People",size:16}),description:"Only available to people in this drive"},{value:"PUBLIC",icon:i.jsx(I,{name:"Globe",size:16}),description:"Available to everyone",disabled:!0}],_5={CLOUD:{title:"Secure cloud",description:"End to end encryption between members.",icon:i.jsx(I,{name:"Lock",size:16})},LOCAL:{title:"Local",description:"Private and only available to you.",icon:i.jsx(I,{name:"Hdd",size:16})},SWITCHBOARD:{title:"Switchboard",description:"Public and available to everyone.",icon:i.jsx(I,{name:"Drive",size:16})}},H5={ADD_TRIGGER:{label:"Add Trigger",icon:i.jsx(I,{className:"text-orange-900",name:"Plus",size:16})},REMOVE_TRIGGER:{label:"Remove Trigger",icon:i.jsx(I,{className:"text-orange-900",name:"Xmark",size:16})},ADD_INVALID_TRIGGER:{label:"Add Trigger",icon:i.jsx(I,{className:"text-orange-900",name:"Exclamation",size:16})}},W5={DUPLICATE:{label:"Duplicate",icon:i.jsx(I,{name:"FilesEarmark",size:16})},RENAME:{label:"Rename",icon:i.jsx(I,{name:"Pencil",size:16})},DELETE:{label:"Delete",icon:i.jsx(I,{name:"Trash",size:16}),className:"text-red-900"},SETTINGS:{label:"Settings",icon:i.jsx(I,{name:"Gear",size:16})}},Hu={...H5,...W5};function Wu(e){const{node:t}=e,[n,r]=m.useState(!1),s=m.useCallback(o=>{o.dataTransfer.setData("UI_NODE",JSON.stringify(t))},[t]),a=m.useCallback(()=>{r(!1)},[]);return m.useMemo(()=>({isDragging:n,dragProps:{draggable:!0,onDragStart:s,onDragEnd:a}}),[n,a,s])}const Gu="powerhouse/budget-statement",_a="powerhouse/default",qu="makerdao/rwa-portfolio",G5=[Gu,_a,qu],q5=new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGwAAAB4CAYAAAAXIRdAAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAzWSURBVHgB7V1dbBXHFZ5d/wI1WMhuVBUJq1GlAg9QlZSngNU2D9BIreoYGikKUdVKjaoSklSRWol4TdWmUgs0SFVTVaqUELUKhDTlIUFqiDA8lKQ8QCvMS5PaVRAN14kMjrGN7TuZb5izPne89/r+7HrXvvNJ17s7O3v3er89Z845M3PGE+XDw58j372+Pi8bv+3n5WZV0i2l1y6EbBfLFNKT/U8fvycQGYFXznkppTi8O7fXF95eKWS3qDN4irQnM0LaPMIUOWGZ53ni0O7r3Z5o+JOQokvUMYyk9dOhSAkFhHGyfvXg/9pbVq7oU7tP8DotqzzRsb5R3Lu1Sazb2CTaOnxdtpxw9OGPI8st0nSRWGT4dgGk6je7P+xSZL0tGFkgZVvPCvHY8+2i50Cb2LKzVRHXsOzIKgVPen1HdufwEosgCPCPL/o/79n7v+79f1eD57/NVeCWnS2KrJV1Q04xCSOol7p//ysd/Xi5LSQucY1Qg3Tj57453G6Ttf3RlVqaHOagnlnf4T03sNtvnfJgoKnnmRhxPn9LdJvFyHrgh6scWUUA9Xho94d988rN8+T2QJwI27BDvTf2CtZmQbI27GgRDsURRRokTGjeIGzxkxYSpl6M8MYbtrc4ySoTNmlcwrAfN2masMMPXX+MVOHqTl9se2iFcCgfUZJG7VjcpN2VMK9xHxVAukCaQ2WwSANZBQEIEZML4MOMV9+/hQpcu1U9GGnaWjS+mt6atq32exzak9vv5eURHHxha7N48OnPiHrHQn7YQkBEZGzj7w8qokKWjLkvajX7fV+KHXSwbmOjcKgdkLS2wcefLSgzxkiEs10RfMn8rk4VanKIB8VMfjL7qzVElEjJLjpAUNdBiDZldI3l8qJWmNijuLnxdwf18V3fTJh9Mv0rUo8wB8POx3oK5JbC6s74NA3CWGuUeuzr6+PEhCZ/pXD2ewTWbYhX0yhBQuyxD9YiSFJbPzxVoWp0hEVgy674ozxkiIA0Zj16lUqZIywCLSs98XnVORs3QNqawR8diDxVpqQ5wooAPRVJtOmKmKBYlL8c0hxhRaBjqj3JxFTJ5C8S/ShJmiOsBNBjkSRpv90z8iwnrZz2zBG2ANBzgb7BpNQj98OMQVLyRt7h3hvhBfv+slY4ROOWcqTfeXVCXD03JeLEUyc+61OcEWD7kfrShTbKBNq0Bx5fpSXu/Yt3xHsXp8XI8IyYGq89Ct/f3w+GyvoiR1iFAHFo22rpka+lN8C1YRkAOdIUCRFWByiHIyxD4BGQYnUcYSmDzHqyDi3fTI8u5g61IyxlQAeCLBPNl9wA4V0xwkidIyxlKLK0KjRE0RgQzUtEX5nnrMQMAJKkCNP7fByImD+7yElY2oCE8ZAUb8t41IMsSCdhGYEiBGMSwmFxRh3ysJXedxKWMiBhCjA8fDaOURaLKToJywAMabTVkma1ZSGchGUExlpcsBPTEZYyGFHyypUrHh/kYdSiLOgzq7fulWuD0+LCycmSkXaM59i4vTmxeQY8+Ku6VxpIJYKwTZs2UVxR8m4XQl1J2DsnJ8TJn49p0kp1i+D8318Y1/UXAR4RxsnSJyyy6soPuzowpTsgK4HusByIt8PSRm9vb2S57YNhCwLrhrDBc3dENaj2unIBqYKE0chgZubP88GAuiEMbVY1gHpMEmi3sEUskQwQBfLDwn4yql83flgcXflJgVuKZjY7BX5DR5rqOrM+ZZw4cUISYZAy1aZFDt8mKXORjpRBFiIA9QgCTTk3OiRJmSMsZXCSYICoT9hHFlXfqcSUociCaa9VIYspenxCO6+/ZCQMRsOl05NiUPlFxWZHYggaohTbelpjnZSXJLgkQbpYmTY6eLcLsCQk7FZuVvz5pze1I1tqKitG58LRfU1FM3DNUgBUIkmR2Q/nQZsqBRK2JAhDOKmSOccgDqQtFRijIrQYjU8WEmUI1L5Z5gmD41rNBHGQ9kHCTm8cQBtG4BYjV5U0agplmScsN1y9ars2WF10YzERZQ1aE9gLkHmjI8sRijhAISge7aBym0w3aioDoGg9GRyeN9eHac/QrKtofVZB0XoW4cBGS5dJEbH0rMTlDJIsFqkHiqpFR1hGwC1Ec8zJCklbFKMjC+Mosg5LykKyDHEhgYkThnER5XTNg1R8bo3kE5u5n0XAD7NVot3bzHMsJqoSszqOIsugHmiAgsDc+EhUwmoZR1EvqpHMekgXDXOj6IclaXn18ROVsKyOo8giSB0iylEsQw5IS5Sw5R6liANMmrQvxh3nCGQ/+LvcwaxBO/gbzhNjEpf94G+9ICicwRIGgCFtZjqtPnRjOlIGWYXUF0bHMOPZMAE3zC0rQBsGy5DGdFBsEaDRUtwIcRKWMmDWG4K4CR8mCQvmps9qOAlLGTRqyrLlJVmKLvibMYAQMudtSzEKjrCUQQRBwniPszk3b8qRa8NSBhFGs1d46qIgYspRohIWR9rVuFK3ZnXVC2a60/G8pCq8XqIShrVcqokL8kV7OmpYwKej4Htq/y1JgKxE5oNJK4UsVKW/KBKGIdPVgGf7xGrs1ST9x7Dte+9rjvW3JAE+LpHNceap+LxFc5zX6XHulXVGor7dtYKk/20VLPMIsr5zYHUivyVuMD+Md2RGTkoHErcSkdQYD7yUlKB9wXnUi1owFQT0KAKwPmcp4tpMPl6QFbWOZxy/JW7waH3A5joTyGikIPCiWIl4S2t9UymrdRZ+S5ygDkwTmuK5fgtTkxppc35YBkAxRDqWd6H3KTzl/LCMwYxPLGi7WDwxNEYcYSmDulUUJE9dBLBVacPVaZ1KzAjsGKKVoDkkzRGWMqgfLGDj66OSgrk2LCOwMgeQpIVp95jRIZXJ71Y3SgNW+r1Gu88LvlixkVNOJaYMPpCUtjToJioA7FRixsBDU5bkaZXoJCwDCIr0MvOwlDBLCDvCUgb3u2ziuElP6tERljKMBciP57VdHK4NSxm8A5NgIvZewBI1owx1HGEpg/wwgIjzIhYtJbXoVGJGQWoRJj71hQVLIRNOPSCYn0WAz3GWPHrvCEsZlPaBEBQZTArSnFmfIfAgMElX1ExMZ3SkDPLDeBCYLENrQW493M1JWEbA1SC1WcaUDyfzOaMjo+CqMHCzV7KFoHDCg97avcwAbRVh3ihd4Gb9J4+p2wXPeDQq0gHYo6aIvEbhyVHVrLXjJNIGda5aGtmolypGhgpylwwbo4MbFxrWyrPhaCpfitlzdKIeE5osNgpT4sohSA9fzqMYQpWoDMhLVPjexWSXXnIQBYmj854cCExG7Yhoh0bA1g4D/Lw3dopOjgzNisnxyjNYO5SHmzdmxfsX5wibuJM7xZOBwXnGNmCrQhhCw5G//jOvfHFIcT2AAzSIl96cFA7xAyrtakGyNHn5zOiPh/l0I5ZGVlpkhekffFgpMj/7El10+c0pJ2UxAw9ar1pxjqUVlPnnOzs7pb2kYmDlTAzYItza6ADDF/z9L6r9IRRCypCzsEhGMYcKQc/x3ZNzy5DgWZ8aefgY1WEkFVwbRGTCwao62o7/qjiyo0E0n6ET9z+yQmzZ1WpukM35wVkHkYVm5vwxluhTzn7vqVc/p7WaHckwy1Pl7e+ZN93oXfHkgMznj9Lx+ZfvZga1sok5lAl6bliNiZMlZf7oP7x9YRNkRzqOHz8+rz1iycG0w6YlDLr0yzMH21sb1yop8zZThfsfaRWbd7YWhEscosFfbOxfPl1Iliodzn387688d+YbOrqEZw7HmWat0OJvZi3M0Erk9wglDG3Zz/66YXTGv9VD7Rlw/uVJ8dYL48okndE/Ip/Ph2+P+0R/Jj6ZFeeO3S4gS73mQ6Jp8mv/WfuHkCz27MMuFl2XpS0KrBFUYNA3JzWbYPm+6V92NTWveUvdu4sqtnX44kvbm9SnWaxW+7ak8eOo2Rc2eJ2o+nYZHZdTt1JUe70tUTDYIFX/On3HihnKyzPTt3qeeR0uVHHJ4hfY9yJ+NFnkvKEwl8t5+OKJ6Y+2Qt/SBWMqzvjP16bEsf1j4o0j47oh/eDKtH6bSPLoYx9HfXidqPrFvrOcupV+qr0e/3vuvzP6Wbz+i0/0s8Ez4mRJOXN0cmbo62+M/mDYJoBS7VH6PVMe+VKQtKGSz8Mi3POGmjzUc22v39B0gEubw8KACrwjJ75/0fvJWSojJ5nUIUkVyCLyqP0i2O2YNuvZtE0yK8MLuru7vbNnz8rDe64/KvL+E9wgcYjEgPSmX7og97/ICYLmUs8yH6H+eAwxckIfJ01LGF1EWxJP3ATeOPZxc5C3654/rm/Ir/qWumyH8rvXe8Jbr5radlGHUP/7qFKmN1XTMaC6qS7fnh7/2wHVnNBLbkcxAHssPUlXqTlhAJH4Kc1sL4jISlnaAAAAAElFTkSuQmCC",import.meta.url).href,Q5=new URL("/assets/rwa-report-Bb0W5-ac.png",import.meta.url).href,Y5=new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGwAAAB4CAYAAAAXIRdAAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAzzSURBVHgB7V1dbFxHFT5zdwNt+lCTJq1EItkPBKmJlCK1JW+JBTzQgkTAtUPlKAGUhzit0ki88JL4biseeCEiLQG1AqlpEaqdP/riIBFk961VHwhVUkErYUsND7FjuT9J1Nq+0zmzc8Znx/fau/buvbP2fNJm7996N/e758w538ycEVA/BP4jj/+0Ez6X+yBKHgEputWRDnW4A9YsREWcGYrBE4h6zkspAZ7pO6T2DoGEblhviBRpL/lB2iLCFDn2mBACZo/2dZcB/qzOdME6RqIsrXRmqGJ2JRSEGsI4WR8f/WHH/WLjoNp8ruYT994HcmsnyF2PAXxjB8gHNutjawmlY09nnNHuscIO5E7cIsLQqu4e7u2656twQf2cb9mTSFT39yHpfmLNEeQimzAg91iJ41ioFxKWK2nC3ZbP9nZBIv7JXaBUJCVP9Kx5oghLEoZQpMGLb1Tw4XbQcvLKZFWImYEfdCwi6ycHq1YVsIBEDsIz+3Gr4pwRGKCp+9ky4iL+lFTbLEZW/5FAVibk4PzRvkH3KN1PHg80E5H9+qO9h4AFGNqydu+FgGxEKaTpFEjzhsbWfNKihU1hv1ju3hMsq064pHELw+1mk6YJmxt46mfWFW7aogKMpyCgfiBp0rE0aseaTZomrBSJY3QArQtJC2gUNaQhWTUCBCyvKtWFCHMunm+Fdms1sO5RR4uYq+FRfDdt26oh5MD+4yCSU/rrlHqRHP4lrHcsm4ctC1GpPLjjeZNYa5hwH1Yb9keKMmtSUklNAc2AHDxx8/pJfoSCkZRkuyEgYV12T2mEAc1BWiCC1kVh/0oDkbJqv7rsH9wWCENIFXSJ6UlYPRRpz/ZBZfOO53HP5GZgtin0b8g9YpS40Pm4TrTCZdHMKFnJWINT108ODg5yYmzI3ygiCFgEuf1haCqq2uMgRotIknqn+96wGhIIS4HsfhKaD2VpKhBh3TII0aiVBcLScO/GFkXMmrQTKSfqDkICYRlIDhxpUZsu4yyVvx7SAmFZ0JpqD7QCJBhnqB9i6c8GZAJ72mULSVOByElOWj3tWSBsGWDPRaL6BlvlHnkeZgKSJVkTquPSfmD+9F8hIAMqkY5GzoF4+y1oJsSZ4Yh0RgTbTvWXZQioD9im9Q8AKIsT/363+roxAXD3NqwWlUoFGapL8QiENQpFnG7bVtEjv5regNCGeQBKpEkJAacDlCMQ5hG4ApJ1TSCsYFBYT9Ghk5vhsRoVJBBWMNAHIllGzZc8AOFdMWCsLhBWMBRZ2hUaomgMiOYlpa9MhCjRA6AlKcL0Nh8HAosnqwQLKxpoYVyS4m0ZVz0oggwW5gkUIQksuEQaOsBlK70dLKxgoIUpYOARsXGMMktTLNTCxB0l63z4PogPrwPcuQPNBo6z1DNF+XcaWQk2Vjsp3fNFwJBG79rSnLbMojDCxMh5iEZHmqLFZUFP53UJuTEO4p2x6m/A70eNcPfelnWj1AsTLYIK75ccNpC7SxS3JqH0m19p5buVZNUNo8KX4mP6t+UNIgpH41y7dk1wtoxblDyZzpUwvCHRiy+op3wCvMO0+W0FPERImMnDiEC9bZLpGovLl7DL5/WN8RZI2iu/hZwhqA3buXMnicCp4xZzzcPE22P65TswABIfXIe80Nvbm3rczcHwHQnMkbDm9tS2EhgQ5QW0KhNskHXpn8CjRL6dC2HYdunQvU2gf2tObRkGGviObRgFIICDPUzAgTvc2vIJ630MMpYB5moyp8mNPFI0s9lJ+LWJNF2bj0tUuU/b4W7zE/k0DA8PSyIMrUy1aal5GFmZN1oiJq6ygVkjOjhoZbuYk0ukCBGB7hEJNMd50CHJyrwgbCXVdtBdia1dEF04C+0MThIGIOpl+8jSrvdC/F1pTRC5BibQK7IwtNeukGmKgk9o59f74RLR/axgZK0Wj9sc3JLQutgxHXTwbheEFxYWnX8NVgJxsb3dIQJdIlmR2bbzoM0l/lkYquclFURg4cx6LU28964f4nETYIIK3JQULfJ2jMJ87DPzp8dZ6XjCZ52xRcA2jLlCe5y7Sho1hcdCj3PBSIsGnQnsNQhjOgoGSVBc7aDjLplh1JQHILWeAg4hFvow3RmaXo2a8k7pyAksWeZJs6BAxLW0oHQUDFI6yCVStIj/pLnFoHR4Ah4hmn1OVs5q/XJYYT61FpQOQlw71M2SZYIS4ZVaj0qHrovRINaC0oF5mOMOwe1t5jUWg9LhGUwPdE0Xi1E5tNUFpaNgUFiP1oVkYdSIVmeOcUtLUJoKeZgnIHeIKkdWhRwkLRBWMJg16eECPHFOgQiEFQwWDbrir50nxizOnzZsvSodBB7Wx2acopGqrN4IvkyZXe9KB76T2kH7FBnidpz7MLdlsN7HdGBkSGM6aCQwwuiJNUFIGNNRMDCs5/ohgoYJkDvk1QTCmI6CQaOmnFheUqToir9B6SgY1I1iCqzURIppyIewekjwTenIqYY/EcTG1XPrqhGB85Om2nGJkJx+MxFGI6V46aI4ZcpRLm2Y3NbVdqtOyO35LBzEQnfaX1RUhV+Xk0vcCHLXo22T6OpF73ICRYksB5NOCVk9HjFXC0O00zKNef5W0hIRbI4zL8VX0JgOrIehFA3flQldryPHJSXRwvhA0piN+E0TgXPNw1pZB74ZwN+Wtyfgaj1piPw8pWckAueeh+ENwackz4nf9aCoFeGpA9NIU7zWb21pUmNthSgdSNp8fLrauBcZParvRqvH31LkutWkIdK+rEJvkzyVb5SYBqoD3w/Vuhg4p7jJyoVOJ9xjux6HRKn8upy5RysSmpG/NW0X0xNtMOJH98r2HBdLVQmx9CiRp24VBUljOugcW5XWTjkKPc6ewNUQnQLNlrRAWMGgfjAa04HH+FoshOLbsAANp3IAWZotu8eCDqlC/rC6URHga6+IM8Nlt88Lc7GskVPBJRYMPpCU3lntxEUCcHCJnoFLU47laZcYLMwDxBm9zFyWAlOZNBBWMHje5RLHQ3pyj4GwgmEiQL6/qO3iCFFiAeBRYt8klJnaoYFRohkyIB2lI+RhRYPyMATlYSJl0VJyi8Elegpyi2hp1BcWh0o4fsBRORB8eJvk6n0grGBQQRVCnDGYFEkLYb1H4CJwzKq4uQhBR8GgPIyLwBQROgty6+FuwcI8AXeD1GaZSX220GUIOjwFd4Wxj6WL1jPi2nLn+t3tZUbQOxI2Yz+9BguVeIfaBQxm+FBtDnfUFJGngg6hCJMd+uz0FMDW9pq00G4QH43bbXX/J0zQwYOL6nW1K8/a0VRRIsHOUMhzGaZ1C7YOjbr/42g9vPxeFhZcooR/2T+Ai3kGtBbMKBIQY/FCIctU1xiztcMQ0aeJeJNOihvjINdQSTvvcOsmRO8tGMXU3BdvUpkHBCbP+B6zVSEMoXbkb9Tx8hvjytjG9CdUg6hXfg1oOnQyzObHqd2r+/87M8GnG7GFcqRDli3/EGGUMpckdg5QNDYSrKzJ0O0PzuF+Z4GwBOTvtmzZIt0lFWOnZmLMFuHWQQcy3H8relXtjusr0cpGzkFGRbGABmGDhZHzbNK9GP/e+1O21gUfMcURp1TCwVV1Srhx9gHYe08EV+hE8uMDkHQ/Wb1oiYWgA7JhcynVzJQuLtQimZfyF+U/nNNezVUyTNHmxP07i6YbHbwFYwkkp2k/uvi6XhXWqSYWUCfovuE95GQpV3j66SlhmyBX6RgaGkrcv0XjFBG4oS0MfempB+c6vg7lK0LCI3TB/L4Deu4Ul0sC0sEfbB0gjF2uIUudnfjPZ9OPPnz2ilaXzHRZO2uFSqJTrY54qTLo2JZt+/3FmU9mox7bnimULr0O0V/+CHLqpv4RSZLYpye8Ml63P4Powms1ZCmMfy43fOfk3U2WLHbvbRcLvvOyRbEzggoZjMxJzSay/MrXZrvuL3/lH+qZ6LJPx6bNMP/4HpDf3qO3XUvj+2mzL1zwa9Kud4/Rfj3XNoqVft61KAzYSsqqorcug2CaoRRw9ZPZ2Z6Oly+N436WZfE/7X4X8aPJouQND05OTgr8wzfE7GPob+kDQumM5b9fgA0vHIfyn04BqIZUfnBNP01kefRy99Ne/Jq067P+Zj3XNvpa6ef1//2j/+l7UX7p1/relNQ94mThPfw/zH13n8q5XAKo1B6V3zPHUx8Ksja8KOKyCM+80U1+caTn0IaodIJbW0BdGL89Lw//fFqM0gFKkskdklUhWUQetV8Etx3TYT0fyGjM036gu7tbjI6OyrmB/QejKHmOByQBi4Gq0ZwQZ/tvylc5Qei51L1MUtwf1xBTJ/Rx0rSF0YfoncwTvwSzcdzGL0fyLn3zoc77RPIjEcHeKIJORWCnOt0B6xMz6uZ8rNzemJwXV6fl7N8eUs0JPeSuioFwx9KTdS01JwxBJH4JoOdEKaNKcdAAAAAASUVORK5CYII=",import.meta.url).href,vi={[Gu]:q5,[_a]:Y5,[qu]:Q5};function J5(e,t){return t||(G5.includes(e)?vi[e]:vi[_a])}const wi="SYNCING",Ci="SUCCESS",Si="CONFLICT",ji="MISSING",Ni="ERROR",Ei="INITIAL_SYNC",K5={SYNCING:"Syncing",SUCCESS:"Synced",CONFLICT:"Error",MISSING:"Circle",ERROR:"Error",INITIAL_SYNC:"Syncing"};function X5(e){const{syncStatus:t,className:n,overrideSyncIcons:r={},...s}=e,a={...K5,...r};return{[Ei]:i.jsx(I,{size:16,...s,className:M("text-blue-900",n),name:a[Ei]}),[wi]:i.jsx(I,{size:16,...s,className:M("text-blue-900",n),name:a[wi]}),[Ci]:i.jsx(I,{size:16,...s,className:M("text-green-900",n),name:a[Ci]}),[Si]:i.jsx(I,{size:16,...s,className:M("text-orange-900",n),name:a[Si]}),[ji]:i.jsx(I,{size:16,...s,className:M("text-red-900",n),name:a[ji]}),[Ni]:i.jsx(I,{size:16,...s,className:M("text-red-900",n),name:a[Ni]})}[t]}function p2(e){const{fileNode:t,className:n,customDocumentIconSrc:r}=e,[s,a]=m.useState("READ"),[o,c]=m.useState(!1),[l]=Bi(),u=l?ds(l):"LOCAL",{dragProps:d}=Wu({node:t}),{isAllowedToCreateDocuments:h}=na(),{onRenameNode:f,onRenameDriveNodes:p,onDuplicateNode:g}=vr(),b=s==="READ",y=wd(t.id,u),x={DUPLICATE:()=>g(t),RENAME:()=>a("WRITE"),DELETE:()=>Hi(t)},v=Object.entries(Hu).map(([k,O])=>({...O,id:k})).filter(k=>_u.includes(k.id));function w(k){Promise.all([f(k,t),p(k,t.id)]).catch(O=>{console.error(O)}).finally(()=>{a("READ")})}function E(){a("READ")}function C(k){const O=x[k];if(!O){console.error(`No handler found for dropdown menu item: ${k}`);return}O(),c(!1)}const j=J5(t.documentType,r),S=i.jsxs("div",{className:"relative",children:[i.jsx("img",{alt:"file icon",className:"max-w-none",height:34,src:j,width:32}),b&&y&&i.jsx("div",{className:"absolute bottom-[-2px] right-0 size-3 rounded-full bg-white",children:i.jsx("div",{className:"absolute left-[-2px] top-[-2px]",children:i.jsx(X5,{overrideSyncIcons:{SUCCESS:"CheckCircleFill"},syncStatus:y})})})]}),N=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=b?i.jsxs("div",{className:"flex w-52 items-center justify-between",children:[i.jsxs("div",{className:"mr-2 truncate group-hover:mr-0",children:[i.jsx("div",{className:"max-h-6 truncate text-sm font-medium group-hover:text-gray-800",children:t.name}),i.jsx("div",{className:"max-h-6 truncate text-xs font-medium text-gray-600 group-hover:text-gray-800",children:t.documentType})]}),h?i.jsx(Tr,{items:v,onItemClick:C,onOpenChange:c,open:o,children:i.jsx("button",{className:M("hidden group-hover:block",o&&"block"),onClick:k=>{k.stopPropagation(),c(!0)},children:i.jsx(I,{className:"text-gray-600",name:"VerticalDots"})})}):null]}):i.jsx(Nr,{className:"ml-3 flex-1 font-medium",defaultValue:t.name,onCancel:E,onSubmit:w});return i.jsx("div",{className:"relative w-64",onClick:b?()=>Ct(t):void 0,children:i.jsx("div",{...d,className:N,children:i.jsxs("div",{className:"flex items-center",children:[i.jsx("div",{className:"mr-1.5",children:S}),P]})})})}function m2(e){const{folderNode:t,className:n}=e,{isAllowedToCreateDocuments:r}=na(),[s,a]=m.useState("READ"),[o,c]=m.useState(!1),{dragProps:l}=Wu({node:t}),{onRenameNode:u,onRenameDriveNodes:d,onDuplicateNode:h}=vr(),{isDropTarget:f,dropProps:p}=Sl({target:t}),g=s==="READ";function b(){a("READ")}function y(j){Promise.all([u(j,t),d(j,t.id)]).catch(S=>{console.error(S)}).finally(()=>{a("READ")})}const x={DUPLICATE:()=>h(t),RENAME:()=>a("WRITE"),DELETE:()=>Hi(t)},v=Object.entries(Hu).map(([j,S])=>({...S,id:j})).filter(j=>_u.includes(j.id));function w(j){const S=x[j];if(!S){console.error(`No handler found for dropdown menu item: ${j}`);return}S(),c(!1)}const E=g||!r?i.jsx("div",{className:"ml-3 max-h-6 truncate font-medium text-gray-600 group-hover:text-gray-800",children:t.name}):i.jsx(Nr,{className:"ml-3 font-medium",defaultValue:t.name,onCancel:b,onSubmit:y}),C=M("group flex h-12 cursor-pointer select-none items-center rounded-lg bg-gray-200 px-2",n,f&&"bg-blue-100");return i.jsx("div",{className:"relative w-64",onClick:g?()=>Ct(t):void 0,children:i.jsxs("div",{...l,...p,className:C,children:[i.jsxs("div",{className:"flex items-center overflow-hidden",children:[i.jsx("div",{className:"p-1",children:i.jsx("div",{className:"relative",children:i.jsx(I,{name:"FolderClose",size:24})})}),E]}),g&&r?i.jsx(Tr,{items:v,onItemClick:w,onOpenChange:c,open:o,children:i.jsx("button",{className:M("ml-auto hidden group-hover:block",o&&"block"),onClick:j=>{j.stopPropagation(),c(!0)},children:i.jsx(I,{className:"text-gray-600",name:"VerticalDots"})})}):null]})})}const On=m.forwardRef(function(t,n){const{icon:r,errorMessage:s,isDirty:a,containerClassName:o,inputClassName:c,errorMessageClassName:l,hideErrors:u=!1,...d}=t,h=t.type??"text",f=!!s;return i.jsxs("div",{children:[i.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",o),children:[r&&i.jsx("span",{className:sa((!a||f)&&"text-slate-200"),children:r}),i.jsx("input",{...d,className:M("w-full bg-transparent font-semibold outline-none",c),ref:n,type:h})]}),i.jsx("p",{className:M("hidden min-h-4 text-xs text-red-900",f&&"block",u&&"hidden",l),children:s})]})});function Z5(e){return{value:e.id,displayValue:e.name,icon:i.jsx(I,{name:"PowerhouseLogoSmall"}),description:"Built by Powerhouse"}}function ew(e){const{control:t,appOptions:n,...r}=e,s=n.map(Z5);return i.jsx(Ui,{control:t,name:"appId",render:({field:a})=>i.jsx(vt,{...r,...a,id:"appId",items:s})})}const tw=m.forwardRef(function(t,n){return i.jsxs("label",{className:"relative cursor-pointer items-center",htmlFor:t.id,children:[i.jsx("input",{className:"peer sr-only",ref:n,type:"checkbox",value:"",...t}),i.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"})]})}),Ha=m.forwardRef(function(t,n){return i.jsxs("div",{className:"flex items-center rounded-md border border-gray-200 bg-gray-50 p-3 text-gray-900",children:[i.jsxs("div",{className:"flex-1",children:[i.jsx("label",{className:"font-medium text-gray-900",htmlFor:"availableOffline",children:"Make available offline"}),i.jsxs("p",{className:"text-xs text-gray-600",children:["Check this options if you keep a local backup",i.jsx("br",{}),"available at all times."]})]}),i.jsx(tw,{id:"availableOffline",ref:n,...t})]})});function er(e){const{children:t,className:n,...r}=e;return i.jsx("label",{...r,className:M("block font-semibold text-gray-500",n),children:t})}function Qu(e){const{control:t,...n}=e;return i.jsx(Ui,{control:t,name:"sharingType",render:({field:r})=>i.jsx(vt,{...n,...r,id:"sharingType",items:B5})})}function nw(e){const{register:t,handleSubmit:n,control:r,formState:{errors:s}}=ta({defaultValues:{name:"",sharingType:"LOCAL",availableOffline:!1,appId:e.appOptions[0].id}});return i.jsx("form",{name:"add-local-drive",onSubmit:n(e.onSubmit),className:"flex flex-col gap-4",children:i.jsxs("div",{className:"flex flex-col gap-4",children:[i.jsxs("div",{children:[i.jsx(er,{htmlFor:"name",className:"text-sm font-medium text-gray-800",children:"Drive Name"}),i.jsx(On,{...t("name",{required:"Drive name is required"}),errorMessage:s.name?.message,placeholder:"Drive name"})]}),i.jsxs("div",{children:[i.jsx(er,{htmlFor:"driveApp",className:"text-sm font-medium text-gray-800",children:"Drive App"}),i.jsx(ew,{control:r,appOptions:e.appOptions})]}),i.jsxs("div",{children:[i.jsx(er,{htmlFor:"sharingType",className:"text-sm font-medium text-gray-800",children:"Location"}),i.jsx(Qu,{control:r})]}),i.jsx("div",{children:i.jsx(Ha,{...t("availableOffline")})}),i.jsx(Ee,{className:"mt-2 w-full",type:"submit",children:"Create new drive"})]})})}function rw(e){return i.jsxs("div",{className:"flex gap-2 rounded-xl bg-gray-100 p-3 font-semibold text-gray-500",children:[i.jsx(I,{className:"text-gray-600",name:"Drive"}),e.driveName]})}function Yu(e){const{location:t,className:n,...r}=e,s=_5[t];return i.jsxs("div",{...r,className:M("my-3 flex items-center gap-2 rounded-xl border border-gray-100 p-3 text-gray-800 shadow",n),children:[s.icon,i.jsxs("div",{children:[i.jsx("p",{children:s.title}),i.jsx("p",{className:"text-xs text-slate-200",children:s.description})]})]})}function sw(e){const{sharingType:t="PUBLIC",requestPublicDrive:n}=e,[r,s]=m.useState(),[a,o]=m.useState(!1),[c,l]=m.useState(!0),[u,d]=m.useState(!1),[h,f]=m.useState(""),[p,g]=m.useState(""),[b,y]=dh(p,500),{register:x,handleSubmit:v,setValue:w}=ta({mode:"onBlur",defaultValues:{availableOffline:r?.availableOffline??!1}});m.useEffect(()=>{y(p)},[p]),m.useEffect(()=>{if(d(!1),b==="")return;C().catch(console.error);async function C(){try{const{id:j,name:S}=await n(b);s({id:j,name:S,sharingType:t,location:"SWITCHBOARD",availableOffline:!0}),w("availableOffline",!0),l(!0),f("")}catch(j){s(void 0),l(!1),f(j.message)}}},[b,w,t]);function E({availableOffline:C}){r&&e.onSubmit({...r,availableOffline:C,url:b})}return i.jsx("form",{onSubmit:v(E),children:u?i.jsxs(i.Fragment,{children:[i.jsx(rw,{driveName:r?.name??"New drive"}),i.jsx(bt,{className:"my-3"}),i.jsxs(dr,{isOpen:a,onOpenChange:()=>o(!a),title:"Location",children:[i.jsx(Yu,{location:"SWITCHBOARD"}),i.jsx(Ha,{...x("availableOffline")})]}),i.jsx(Ee,{className:"mt-4 w-full",color:"dark",type:"submit",children:"Add new drive"})]}):i.jsxs(i.Fragment,{children:[i.jsx(On,{errorMessage:h,onChange:C=>g(C.target.value),placeholder:"Drive URL",required:!0,type:"url",value:p}),i.jsx(Ee,{className:"mt-4 w-full py-2 text-base",color:"dark",size:"small",disabled:!c||p==="",onClick:C=>{C.preventDefault(),d(!0)},type:"button",children:"Add drive"})]})})}const aw=new URL("/assets/home-bg-BRYzhkhi.avif",import.meta.url).href,ow=new URL("/assets/home-bg-BEhF9NuW.png",import.meta.url).href;function iw(){return i.jsxs("picture",{className:"pointer-events-none absolute inset-8 z-0 size-[calc(100%-32px)] object-contain",children:[i.jsx("source",{srcSet:aw,type:"image/avif"}),i.jsx("img",{src:ow,alt:"background",className:"object-contain"})]})}const cw=function(t){const{icon:n,title:r,description:s,containerClassName:a,shareable:o,onClick:c}=t;return i.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",a,c&&"cursor-pointer"),onClick:c,children:[i.jsx("div",{className:"mx-auto pb-2",children:n||i.jsx("div",{className:"size-8 items-center justify-center rounded-lg bg-black pt-1",children:i.jsx("span",{className:"text-6 w-6 text-white",children:r.slice(0,1).toUpperCase()})})}),i.jsxs("div",{className:"w-full max-w-full",children:[i.jsx("h3",{className:"w-full max-w-full truncate px-2",children:r}),s&&i.jsx("p",{className:"text-gray-500",children:s})]}),o&&i.jsx("div",{className:"absolute left-2 top-0 mb-2",children:i.jsx(I,{name:"PeopleFill",width:12,height:12})})]})},g2=function(t){const{containerClassName:n}=t;return i.jsx(cw,{title:"Create New Drive",icon:i.jsx(I,{name:"PlusSquare",size:32}),onClick:()=>Cd({type:"addDrive"}),containerClassName:n})},b2=function(t){const{children:n,containerClassName:r}=t;return i.jsx("div",{className:M("container relative mx-auto flex h-full flex-col",r),children:i.jsxs("div",{className:"m-8 flex flex-wrap justify-center gap-4 pt-12",children:[i.jsx(iw,{}),n]})})};function y2(e){function t(){r(!1)}const{open:n,onOpenChange:r,onAddRemoteDrive:s,onAddLocalDrive:a,requestPublicDrive:o,modalProps:c,containerProps:l}=e;return i.jsx(De,{...c,overlayProps:{className:"items-start pt-[15vh]"},contentProps:{className:"rounded-2xl"},onOpenChange:r,open:n,children:i.jsx("div",{...l,className:M("w-[408px] rounded-2xl p-6",l?.className),children:i.jsxs(wl,{defaultValue:"Create Drive",children:[i.jsx(Ut,{label:"Create Drive",description:"Create a new drive",children:i.jsx(nw,{onCancel:t,onSubmit:a,appOptions:e.appOptions})}),i.jsx(Ut,{label:"Add Drive",description:"Add a drive",children:i.jsx(sw,{sharingType:"PUBLIC",onSubmit:s,onCancel:t,requestPublicDrive:o})})]})})})}const Pi="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",Oi=300;function x2(e){const{onOpenChange:t,onContinue:n,overlayProps:r,contentProps:s,...a}=e,[o,c]=m.useState(""),[l,u]=m.useState(!1),d=()=>{t?.(!1),setTimeout(()=>c(""),Oi)},h=m.useCallback(()=>{l&&(n(o),setTimeout(()=>c(""),Oi))},[l,o,n]),f=m.useCallback(p=>{p.preventDefault(),h()},[h]);return i.jsx(De,{contentProps:{...s,className:M("rounded-3xl",s?.className)},onOpenChange:t,overlayProps:{...r,className:r?.className},...a,children:i.jsxs("form",{name:"create-document",className:"w-[400px] p-6 text-slate-300",onSubmit:f,children:[i.jsx("div",{className:"border-b border-slate-50 pb-2 text-2xl font-bold text-gray-800",children:"Create a new document"}),i.jsxs("div",{className:"my-6",children:[!l&&o&&i.jsx("div",{className:"mb-2 text-red-500",children:"Document name must be valid URL characters."}),i.jsx(On,{icon:i.jsx(I,{name:"BrickGlobe"}),onChange:p=>{const g=p.target.value;c(g),u(Kd(g))},placeholder:"Document name",required:!0,value:o})]}),i.jsxs("div",{className:"mt-8 flex justify-between gap-3",children:[i.jsx("button",{type:"button",className:M(Pi,"flex-1 bg-slate-50 text-slate-800"),onClick:d,children:"Cancel"}),i.jsx(Ee,{type:"submit",className:M(Pi,"flex-1 bg-gray-800 text-gray-50"),disabled:!l,children:"Create"})]})]})})}const v2=e=>{const{inputPlaceholder:t,body:n,driveName:r,...s}=e,[a,o]=m.useState("");return i.jsx(ga,{bodyProps:{className:"p-0 bg-white my-0"},containerProps:{className:"w-[450px]"},continueButtonProps:{disabled:a!==r,className:a!==r?"bg-red-600 hover:scale-100 cursor-not-allowed active:opacity-100":"bg-red-900"},...s,children:i.jsxs("div",{children:[i.jsx("div",{className:"my-6 rounded-md bg-slate-50 p-4 text-center",children:n}),i.jsx("div",{children:i.jsx(On,{hideErrors:!0,icon:i.jsx(I,{name:"Lock"}),onChange:c=>o(c.target.value),placeholder:t,value:a})})]})})};function w2(e){const{onDelete:t,deleteLabel:n,...r}=e;return i.jsx(ga,{...r,containerProps:{className:"w-[450px]"},continueButtonProps:{className:"bg-red-900"},continueLabel:n,onContinue:t})}const Ju=m.forwardRef(function(t,n){return i.jsx(On,{...t,icon:t.icon??i.jsx(I,{name:"Drive"}),id:"driveName",placeholder:"Drive name",ref:n})});function lw(e){const{drive:t,handleDeleteDrive:n,onCancel:r}=e,[s,a]=m.useState(""),o=s===t.header.name;function c(){o&&n()}return i.jsxs("div",{children:[i.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?"}),i.jsx(Ju,{icon:i.jsx(I,{name:"Lock"}),onChange:l=>a(l.target.value),placeholder:"Enter drive name...",value:s}),i.jsxs("div",{className:"flex gap-3",children:[i.jsx(Ee,{className:"w-full",color:"light",onClick:r,children:"Cancel"}),i.jsx(Ee,{className:"w-full",color:"red",disabled:!o,onClick:c,children:"Delete"})]})]})}function uw(e){const{drive:t,sharingType:n,availableOffline:r,onSubmit:s,handleDeleteDrive:a}=e,o=t.header.name,[c,l]=m.useState(!1),[u,d]=m.useState(!1),[h,f]=m.useState(!1),{register:p,handleSubmit:g,control:b}=ta({mode:"onBlur",defaultValues:{name:o,sharingType:n,availableOffline:r}}),y=n==="PUBLIC"?"SWITCHBOARD":n;return i.jsxs("form",{onSubmit:g(s),children:[i.jsx(Ju,{...p("name")}),i.jsx(bt,{className:"my-4"}),i.jsx(er,{htmlFor:"sharingType",children:"Sharing settings"}),i.jsx(Qu,{control:b}),i.jsx(bt,{className:"my-3"}),i.jsxs(dr,{isOpen:c,onOpenChange:()=>l(!c),title:"Location",children:[i.jsx(Yu,{location:y}),i.jsx(Ha,{...p("availableOffline")})]}),i.jsx(bt,{className:"my-3"}),i.jsx(dr,{isOpen:u,onOpenChange:()=>d(!u),title:"Danger zone",children:i.jsxs("button",{className:"flex gap-2 py-3 font-semibold text-red-900 transition hover:brightness-125",onClick:()=>f(!0),type:"button",children:[i.jsx(I,{name:"Trash"}),"Delete drive"]})}),h&&u?i.jsx(lw,{drive:t,handleDeleteDrive:a,onCancel:()=>f(!1)}):i.jsxs(i.Fragment,{children:[i.jsx(bt,{className:"my-3"}),i.jsx(Ee,{className:"mb-4 w-full",type:"submit",children:"Confirm"})]})]})}function C2(e){const{drive:t,open:n,sharingType:r,availableOffline:s,onOpenChange:a,onDeleteDrive:o,onRenameDrive:c,onChangeSharingType:l,onChangeAvailableOffline:u,modalProps:d,containerProps:h}=e,f=b=>{b.name!==t.header.name&&c(t,b.name),b.sharingType!==r&&l(t,b.sharingType),b.availableOffline!==s&&u(t,b.availableOffline),a(!1)};function p(){o(t),a(!1)}function g(){a(!1)}return i.jsx(De,{...d,contentProps:{className:"rounded-2xl"},onOpenChange:a,open:n,children:i.jsxs("div",{...h,className:M("max-w-[408px] rounded-2xl p-6",h?.className),children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("h1",{className:"text-xl font-bold",children:"Drive settings"}),i.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:i.jsx(I,{name:"XmarkLight",size:24})})]}),i.jsx(bt,{className:"my-4"}),i.jsx(uw,{handleCancel:g,handleDeleteDrive:p,onSubmit:f,drive:t,sharingType:r,availableOffline:s})]})})}function dw(e){return JSON.parse(JSON.stringify(e,(t,n)=>typeof n=="function"?"[Function]":typeof n=="symbol"?"[Symbol]":n instanceof Error?{name:n.name,message:n.message}:n))}function Ku({open:e,onOpenChange:t,title:n,object:r}){const s=r?dw(r):null;return i.jsx(De,{contentProps:{className:"rounded-2xl",style:{height:"80vh",width:"80vw",maxWidth:"900px"}},onOpenChange:t,open:e,title:n,children:i.jsxs("div",{className:"flex h-full w-full flex-col",children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-gray-200 px-4 py-3",children:[i.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:n}),i.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:i.jsx(I,{name:"XmarkLight",size:24})})]}),i.jsx("div",{className:"flex-1 overflow-auto p-4",children:s?i.jsx(Ih,{data:s}):i.jsx("p",{className:"text-gray-500",children:"No data to display"})})]})})}const fw={key:"view",label:"",width:"60px"},is=[fw,{key:"id",label:"ID",width:"120px"},{key:"kind",label:"Kind",width:"80px"},{key:"documentId",label:"Document ID",width:"150px"},{key:"scope",label:"Scope",width:"100px"},{key:"branch",label:"Branch",width:"100px"},{key:"createdAt",label:"Created At",width:"160px"},{key:"retryCount",label:"Retries",width:"70px"},{key:"status",label:"Status",width:"100px"}];function Ii(e,t=12){return e.length<=t?e:e.slice(0,t)+"..."}function hw(e){return new Date(e).toLocaleString()}function pw(e,t){return t?[...e].sort((n,r)=>{let s=0;switch(t.column){case"id":s=n.id.localeCompare(r.id);break;case"kind":s=n.kind.localeCompare(r.kind);break;case"documentId":s=n.documentId.localeCompare(r.documentId);break;case"scope":s=n.scope.localeCompare(r.scope);break;case"branch":s=n.branch.localeCompare(r.branch);break;case"createdAt":s=n.createdAt.localeCompare(r.createdAt);break;case"retryCount":s=(n.retryCount??0)-(r.retryCount??0);break;case"status":s=n.status.localeCompare(r.status);break;default:return 0}return t.direction==="asc"?s:-s}):e}function mw({direction:e,active:t}){return t?i.jsx(I,{className:e==="asc"?"rotate-180":void 0,name:"TriangleDown",size:12}):i.jsx(I,{className:"opacity-0 group-hover:opacity-50",name:"CaretSort",size:12})}function gw({getQueueState:e,onPause:t,onResume:n}){const[r,s]=m.useState({isPaused:!1,pendingJobs:[],executingJobs:[],totalPending:0,totalExecuting:0}),[a,o]=m.useState(!0),[c,l]=m.useState(),[u,d]=m.useState(!1),[h,f]=m.useState(null),p=m.useCallback(async()=>{const w=await e();s(w),o(!1)},[e]);m.useEffect(()=>{p();const w=setInterval(()=>{p()},2e3);return()=>clearInterval(w)},[p]);const g=m.useCallback(async()=>{o(!0),await p()},[p]),b=m.useCallback(async()=>{d(!0),r.isPaused?await n():await t(),await p(),d(!1)},[r.isPaused,t,n,p]),y=w=>{const E=c?.column===w&&c.direction==="asc"?"desc":"asc";l({column:w,direction:E})},x=[...r.executingJobs.map(w=>({...w,status:"executing"})),...r.pendingJobs.map(w=>({...w,status:"pending"}))],v=pw(x,c);return i.jsxs("div",{className:"flex h-full flex-col gap-2",children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between",children:[i.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"Queue Inspector"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("button",{className:M("flex items-center gap-1 rounded border px-3 py-1.5 text-sm disabled:opacity-50",r.isPaused?"border-green-300 bg-green-50 text-green-700 hover:bg-green-100":"border-yellow-300 bg-yellow-50 text-yellow-700 hover:bg-yellow-100"),disabled:u,onClick:()=>{b()},type:"button",children:[i.jsx(I,{name:r.isPaused?"ArrowFilledRight":"Ellipsis",size:14}),r.isPaused?"Resume":"Pause"]}),i.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:a,onClick:()=>{g()},type:"button",children:[i.jsx(I,{name:"Reload",size:14}),"Refresh"]})]})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-4 rounded-lg bg-gray-100 px-4 py-2 text-sm",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:M("size-2 rounded-full",r.isPaused?"bg-yellow-500":"bg-green-500")}),i.jsx("span",{className:"font-medium text-gray-700",children:r.isPaused?"Paused":"Running"})]}),i.jsxs("div",{className:"text-gray-600",children:["Pending: ",i.jsx("span",{className:"font-medium",children:r.totalPending})]}),i.jsxs("div",{className:"text-gray-600",children:["Executing: ",i.jsx("span",{className:"font-medium",children:r.totalExecuting})]})]}),i.jsx("div",{className:"max-h-full overflow-auto rounded-lg border border-gray-300",children:i.jsxs("table",{className:"w-full border-collapse",children:[i.jsx("thead",{className:"sticky top-0 bg-gray-100",children:i.jsx("tr",{children:is.map((w,E)=>{const C=c?.column===w.key,j=C?c.direction:"asc";return i.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",E>0&&"border-l border-gray-300"),onClick:()=>y(w.key),style:{width:w.width},children:i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"truncate",children:w.label}),i.jsx(mw,{active:C,direction:j})]})},w.key)})})}),i.jsx("tbody",{children:a&&v.length===0?i.jsx("tr",{children:i.jsx("td",{className:"px-3 py-8 text-center text-sm text-gray-500",colSpan:is.length,children:"Loading..."})}):v.length===0?i.jsx("tr",{children:i.jsx("td",{className:"px-3 py-8 text-center text-sm text-gray-500",colSpan:is.length,children:"No jobs in queue"})}):v.map(w=>i.jsxs("tr",{className:"odd:bg-white even:bg-gray-50 hover:bg-blue-50",children:[i.jsx("td",{className:"px-3 py-2 text-xs",children:i.jsx("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(w),type:"button",children:"View"})}),i.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:i.jsx("span",{className:"block truncate",title:w.id,children:Ii(w.id)})}),i.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:i.jsx("span",{className:M("inline-block rounded px-1.5 py-0.5",w.kind==="mutation"?"bg-purple-100 text-purple-700":"bg-blue-100 text-blue-700"),children:w.kind})}),i.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:i.jsx("span",{className:"block truncate",title:w.documentId,children:Ii(w.documentId)})}),i.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:i.jsx("span",{className:"block truncate",title:w.scope,children:w.scope})}),i.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:i.jsx("span",{className:"block truncate",title:w.branch,children:w.branch})}),i.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:i.jsx("span",{className:"block truncate",title:w.createdAt,children:hw(w.createdAt)})}),i.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:w.retryCount??0}),i.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs",children:i.jsxs("span",{className:M("inline-flex items-center gap-1 rounded px-1.5 py-0.5",w.status==="executing"?"bg-green-100 text-green-700":"bg-gray-100 text-gray-600"),children:[w.status==="executing"&&i.jsx("span",{className:"inline-block size-1.5 animate-pulse rounded-full bg-green-500"}),w.status]})})]},w.id))})]})}),i.jsxs("div",{className:"shrink-0 text-sm text-gray-600",children:["Showing ",v.length," job(s)"]}),i.jsx(Ku,{object:h,onOpenChange:w=>!w&&f(null),open:h!==null,title:"Job"})]})}function Xu(e,t=12){return e.length<=t?e:e.slice(0,t)+"..."}function Zu({direction:e,active:t}){return t?i.jsx(I,{className:e==="asc"?"rotate-180":void 0,name:"TriangleDown",size:12}):i.jsx(I,{className:"opacity-0 group-hover:opacity-50",name:"CaretSort",size:12})}const ed={key:"view",label:"",width:"60px"},bw=[ed,{key:"documentId",label:"Document ID",width:"150px"},{key:"branch",label:"Branch",width:"100px"},{key:"scopes",label:"Scopes",width:"100px"},{key:"status",label:"Status",width:"150px"},{key:"opsCount",label:"Ops Count",width:"80px"}],yw=[ed,{key:"documentId",label:"Document ID",width:"150px"},{key:"branch",label:"Branch",width:"100px"},{key:"scopes",label:"Scopes",width:"100px"},{key:"error",label:"Error",width:"200px"}];function xw(e){return JSON.parse(JSON.stringify(e,(t,n)=>typeof n=="function"?"[Function]":typeof n=="symbol"?"[Symbol]":n instanceof Error?{name:n.name,message:n.message}:n))}function vw(e){switch(e){case Ve.Unknown:return"Unknown";case Ve.TransportPending:return"Transport Pending";case Ve.ExecutionPending:return"Execution Pending";case Ve.Applied:return"Applied";case Ve.Error:return"Error";default:return"Unknown"}}function ww(e){switch(e){case Ve.TransportPending:case Ve.ExecutionPending:return i.jsx("span",{children:"⏳"});case Ve.Applied:return i.jsx("span",{children:"✅"});case Ve.Error:return i.jsx("span",{children:"❌"});default:return i.jsx("span",{children:"❓"})}}function br(e){return e?e.error.message:""}function Cw(e,t){const n=[...e];return t?n.sort((r,s)=>{let a=0;switch(t.column){case"documentId":a=r.documentId.localeCompare(s.documentId);break;case"branch":a=r.branch.localeCompare(s.branch);break;case"scopes":a=r.scopes.join(",").localeCompare(s.scopes.join(","));break;case"status":a=r.status-s.status;break;case"opsCount":a=r.operations.length-s.operations.length;break;case"error":a=br(r.error).localeCompare(br(s.error));break;default:return 0}return t.direction==="asc"?a:-a}):n}function cs({title:e,mailboxType:t,operations:n,sort:r,onSort:s,collapsed:a,onToggleCollapse:o}){const[c,l]=m.useState(null),u=t==="deadLetter"?yw:bw,d=Cw(n,r),h=p=>{s(t,p)},f=async()=>{const p=xw(n),g=JSON.stringify(p,null,2);await navigator.clipboard.writeText(g)};return i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("button",{className:"flex items-center gap-2 text-left text-sm font-medium text-gray-700 hover:text-gray-900",onClick:o,type:"button",children:[i.jsx(I,{className:M("transition-transform",a&&"-rotate-90"),name:"ChevronDown",size:14}),e," (",n.length," item",n.length!==1?"s":"",")"]}),n.length>0&&i.jsxs("button",{className:"flex items-center gap-1 rounded bg-gray-100 px-2 py-1 text-xs text-gray-700 hover:bg-gray-200",onClick:()=>{f()},type:"button",children:[i.jsx(I,{name:"Copy",size:12}),"Copy All"]})]}),!a&&i.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-300",children:i.jsxs("table",{className:"w-full border-collapse",children:[i.jsx("thead",{className:"sticky top-0 bg-gray-100",children:i.jsx("tr",{children:u.map((p,g)=>{const b=r?.column===p.key,y=b?r.direction:"asc";return i.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",g>0&&"border-l border-gray-300"),onClick:()=>h(p.key),style:{width:p.width},children:i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"truncate",children:p.label}),i.jsx(Zu,{active:b,direction:y})]})},p.key)})})}),i.jsx("tbody",{children:d.length===0?i.jsx("tr",{children:i.jsx("td",{className:"px-3 py-4 text-center text-sm text-gray-500",colSpan:u.length,children:"No operations"})}):d.map(p=>i.jsxs("tr",{className:"odd:bg-white even:bg-gray-50 hover:bg-blue-50",children:[i.jsx("td",{className:"px-3 py-2 text-xs",children:i.jsx("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:()=>l(p),type:"button",children:"View"})}),i.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:i.jsx("span",{className:"block truncate",title:p.documentId,children:Xu(p.documentId)})}),i.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:i.jsx("span",{className:"block truncate",title:p.branch,children:p.branch})}),i.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:i.jsx("span",{className:"block truncate",title:p.scopes.join(", "),children:p.scopes.join(", ")})}),t==="deadLetter"?i.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs",children:i.jsx("span",{className:"block truncate text-red-600",title:br(p.error),children:br(p.error)||"Unknown error"})}):i.jsxs(i.Fragment,{children:[i.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:i.jsxs("span",{className:"flex items-center gap-1",children:[ww(p.status),vw(p.status)]})}),i.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:p.operations.length})]})]},p.id))})]})}),i.jsx(Ku,{object:c,onOpenChange:p=>!p&&l(null),open:c!==null,title:"Sync Operation"})]})}function Sw({remoteName:e,channel:t,onBack:n,onRefresh:r}){const[s,a]=m.useState({inbox:void 0,outbox:void 0,deadLetter:void 0}),[o,c]=m.useState({inbox:!1,outbox:!1,deadLetter:!1}),l=j=>{c(S=>({...S,[j]:!S[j]}))},u=(j,S)=>{a(N=>{const P=N[j],k=P?.column===S&&P.direction==="asc"?"desc":"asc";return{...N,[j]:{column:S,direction:k}}})},h=m.useCallback(()=>{if(!(t instanceof Sd))return null;const j=t.poller;return j instanceof jd?j:null},[t])(),[f,p]=m.useState(()=>({isPaused:h?.isPaused()??!1,isRunning:h?.isRunning()??!1})),[g,b]=m.useState(()=>({inbox:{isPaused:t.inbox.isPaused()},outbox:{isPaused:t.outbox.isPaused()}})),y=m.useCallback(()=>{h&&(h.pause(),p({isPaused:h.isPaused(),isRunning:h.isRunning()}))},[h]),x=m.useCallback(()=>{h&&(h.resume(),p({isPaused:h.isPaused(),isRunning:h.isRunning()}))},[h]),v=m.useCallback(()=>{h&&h.triggerNow()},[h]),w=m.useCallback(j=>{const S=j==="inbox"?t.inbox:t.outbox;S.pause(),b(N=>({...N,[j]:{isPaused:S.isPaused()}}))},[t]),E=m.useCallback(j=>{const S=j==="inbox"?t.inbox:t.outbox;S.resume(),b(N=>({...N,[j]:{isPaused:S.isPaused()}}))},[t]),C=m.useCallback(j=>{(j==="inbox"?t.inbox:t.outbox).flush(),r?.()},[t,r]);return i.jsxs("div",{className:"flex h-full flex-col gap-3 overflow-auto",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.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:[i.jsx(I,{className:"rotate-90",name:"ChevronDown",size:14}),"Back"]}),i.jsxs("h2",{className:"text-lg font-semibold text-gray-900",children:["Channel: ",e]})]}),r&&i.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:r,type:"button",children:[i.jsx(I,{name:"Reload",size:14}),"Refresh"]})]}),h&&i.jsxs("div",{className:"rounded border border-gray-200 bg-white p-4",children:[i.jsx("h3",{className:"mb-3 text-sm font-semibold text-gray-900",children:"Poller"}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"text-sm text-gray-600",children:["Status:"," ",i.jsx("span",{className:f.isPaused?"text-yellow-600":"text-green-600",children:f.isPaused?"Paused":"Running"})]}),i.jsxs("div",{className:"flex gap-2",children:[f.isPaused?i.jsx("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:x,type:"button",children:"Resume"}):i.jsx("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:y,type:"button",children:"Pause"}),i.jsx("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:cursor-not-allowed disabled:opacity-50",disabled:!f.isPaused,onClick:v,type:"button",children:"Poll Now"})]})]})]}),i.jsxs("div",{className:"rounded border border-gray-200 bg-white p-4",children:[i.jsx("h3",{className:"mb-3 text-sm font-semibold text-gray-900",children:"Mailbox Processing"}),i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"text-sm text-gray-600",children:["Inbox:"," ",i.jsx("span",{className:g.inbox.isPaused?"text-yellow-600":"text-green-600",children:g.inbox.isPaused?"Paused":"Active"})]}),i.jsxs("div",{className:"flex gap-2",children:[g.inbox.isPaused?i.jsx("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:()=>E("inbox"),type:"button",children:"Resume"}):i.jsx("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:()=>w("inbox"),type:"button",children:"Pause"}),i.jsx("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:cursor-not-allowed disabled:opacity-50",disabled:!g.inbox.isPaused,onClick:()=>C("inbox"),type:"button",children:"Flush"})]})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"text-sm text-gray-600",children:["Outbox:"," ",i.jsx("span",{className:g.outbox.isPaused?"text-yellow-600":"text-green-600",children:g.outbox.isPaused?"Paused":"Active"})]}),i.jsxs("div",{className:"flex gap-2",children:[g.outbox.isPaused?i.jsx("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:()=>E("outbox"),type:"button",children:"Resume"}):i.jsx("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:()=>w("outbox"),type:"button",children:"Pause"}),i.jsx("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:cursor-not-allowed disabled:opacity-50",disabled:!g.outbox.isPaused,onClick:()=>C("outbox"),type:"button",children:"Flush"})]})]})]})]}),i.jsxs("div",{className:"flex flex-col gap-6",children:[i.jsx(cs,{collapsed:o.inbox,mailboxType:"inbox",onSort:u,onToggleCollapse:()=>l("inbox"),operations:t.inbox.items,sort:s.inbox,title:"Inbox"}),i.jsx(cs,{collapsed:o.outbox,mailboxType:"outbox",onSort:u,onToggleCollapse:()=>l("outbox"),operations:t.outbox.items,sort:s.outbox,title:"Outbox"}),i.jsx(cs,{collapsed:o.deadLetter,mailboxType:"deadLetter",onSort:u,onToggleCollapse:()=>l("deadLetter"),operations:t.deadLetter.items,sort:s.deadLetter,title:"Dead Letter"})]})]})}const ls=[{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 yr(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 jw(e,t){return t?[...e].sort((n,r)=>{let s,a;switch(t.column){case"id":s=n.id,a=r.id;break;case"name":s=n.name,a=r.name;break;case"collectionId":s=n.collectionId,a=r.collectionId;break;case"filter":s=yr(n.filter),a=yr(r.filter);break;default:return 0}const o=s.localeCompare(a);return t.direction==="asc"?o:-o}):e}function Nw({getRemotes:e}){const[t,n]=m.useState([]),[r,s]=m.useState(!0),[a,o]=m.useState(),[c,l]=m.useState(),u=m.useCallback(async()=>{s(!0);const b=await e();n(b),s(!1)},[e]);m.useEffect(()=>{u()},[u]);const d=m.useCallback(async()=>{if(await u(),c){const b=t.find(y=>y.id===c.id);l(b)}},[u,c,t]),h=b=>{if(b==="channel")return;const y=a?.column===b&&a.direction==="asc"?"desc":"asc";o({column:b,direction:y})},f=b=>{l(b)},p=()=>{l(void 0)};if(c)return i.jsx(Sw,{channel:c.channel,onBack:p,onRefresh:()=>{d()},remoteName:c.name});const g=jw(t,a);return i.jsxs("div",{className:"flex h-full flex-col gap-2",children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between",children:[i.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"Remotes Inspector"}),i.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:r,onClick:()=>{d()},type:"button",children:[i.jsx(I,{name:"Reload",size:14}),"Refresh"]})]}),i.jsx("div",{className:"max-h-full overflow-auto rounded-lg border border-gray-300",children:i.jsxs("table",{className:"w-full border-collapse",children:[i.jsx("thead",{className:"sticky top-0 bg-gray-100",children:i.jsx("tr",{children:ls.map((b,y)=>{const x=a?.column===b.key,v=x?a.direction:"asc",w=b.key!=="channel";return i.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",w&&"cursor-pointer hover:bg-gray-200 hover:text-gray-900"),onClick:()=>w&&h(b.key),style:{width:b.width},children:i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"truncate",children:b.label}),w&&i.jsx(Zu,{active:x,direction:v})]})},b.key)})})}),i.jsx("tbody",{children:r&&g.length===0?i.jsx("tr",{children:i.jsx("td",{className:"px-3 py-8 text-center text-sm text-gray-500",colSpan:ls.length,children:"Loading..."})}):g.length===0?i.jsx("tr",{children:i.jsx("td",{className:"px-3 py-8 text-center text-sm text-gray-500",colSpan:ls.length,children:"No remotes configured"})}):g.map(b=>i.jsxs("tr",{className:"odd:bg-white even:bg-gray-50 hover:bg-blue-50",children:[i.jsx("td",{className:"px-3 py-2 text-xs text-gray-900",children:i.jsx("span",{className:"block truncate",title:b.id,children:Xu(b.id)})}),i.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:i.jsx("span",{className:"block truncate",title:b.name,children:b.name})}),i.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:i.jsx("span",{className:"block truncate",title:b.collectionId,children:b.collectionId})}),i.jsx("td",{className:"border-l border-gray-300 px-3 py-2 text-xs text-gray-900",children:i.jsx("span",{className:"block truncate",title:yr(b.filter),children:yr(b.filter)})}),i.jsx("td",{className:"border-l border-gray-300 px-3 py-2",children:i.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(b),type:"button",children:["View",i.jsx(I,{name:"CaretRight",size:12})]})})]},b.id))})]})}),i.jsxs("div",{className:"shrink-0 text-sm text-gray-600",children:["Showing ",g.length," remote(s)"]})]})}function S2({open:e,onOpenChange:t,modalProps:n,containerProps:r,dbExplorerProps:s,remotesInspectorProps:a,queueInspectorProps:o,defaultTab:c="Database"}){return i.jsx(De,{...n,contentProps:{className:"rounded-2xl",style:{height:"90vh",width:"90vw",maxWidth:"1400px"}},onOpenChange:t,open:e,children:i.jsxs("div",{...r,className:M("flex h-full w-full flex-col",r?.className),children:[i.jsx("div",{className:"flex shrink-0 items-center justify-end px-3 pt-3",children:i.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:i.jsx(I,{name:"XmarkLight",size:24})})}),i.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden px-3 pb-3",children:i.jsxs(wl,{defaultValue:c,children:[i.jsx(Ut,{description:"Database explorer",label:"Database",children:i.jsx("div",{className:"h-full",children:i.jsx(bb,{...s})})}),i.jsx(Ut,{description:"Remotes inspector",label:"Remotes",children:i.jsx("div",{className:"h-full",children:i.jsx(Nw,{...a})})}),o&&i.jsx(Ut,{description:"Queue inspector",label:"Queue",children:i.jsx("div",{className:"h-full",children:i.jsx(gw,{...o})})})]})})]})})}const Ew="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 j2(e){const{body:t,header:n,children:r,onOpenChange:s,onContinue:a,closeLabel:o,overlayProps:c,contentProps:l,bodyProps:u={},headerProps:d={},containerProps:h={},continueButtonProps:f={},buttonContainerProps:p={},...g}=e,[b,y]=m.useState(!0),x=m.useRef(null);return m.useEffect(()=>{const v=()=>{const E=x.current;E&&(E.scrollHeight>E.clientHeight?(y(!0),E.addEventListener("scroll",w)):y(!1))},w=()=>{const E=x.current;E&&E.scrollHeight-Math.ceil(E.scrollTop)===E.clientHeight&&y(!1)};return requestAnimationFrame(v),()=>{const E=x.current;E&&E.removeEventListener("scroll",w)}},[]),i.jsx(De,{contentProps:{...l,className:M("rounded-3xl outline-none",l?.className)},onOpenChange:s,overlayProps:{...c,className:c?.className},...g,children:i.jsxs("div",{...le(h,"w-[500px] p-6 text-slate-300"),children:[i.jsx("div",{...le(d,"border-b border-slate-50 pb-2 text-2xl font-bold text-gray-800"),children:n}),i.jsxs("div",{ref:x,...le(u,"my-6 max-h-[245px] overflow-scroll rounded-md bg-slate-50 p-4 text-center"),children:[t,r]}),i.jsx("div",{...le(p,"mt-8 flex justify-between gap-3"),children:i.jsx("button",{disabled:b,onClick:a,...le(f,M(Ew,"flex-1 bg-gray-800 text-gray-50",b&&"cursor-not-allowed bg-gray-300 hover:scale-100")),children:o})})]})})}const Pw=[/^@powerhousedao\/.+$/,"document-drive","document-model"],Ow=Xd({version:Tt({message:"Missing version field in package.json"}),dependencies:Ja(Tt(),Tt()).nullable(),devDependencies:Ja(Tt(),Tt()).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])=>Pw.some(r=>typeof r=="string"?r===n:r.test(n))))}});function Iw(e){const t=Ow.safeParse(e);return t.success?t.data:(console.error("Package.json validation failed:",t.error.format()),!1)}function kw(e){const[t,n]=m.useState(!1),{packageJson:r,phCliVersion:s}=e,a=Iw(r);return a?i.jsx(dr,{isOpen:t,onOpenChange:()=>n(!t),title:`App version: ${a.version}`,toggleClassName:"text-gray-900 text-sm",children:i.jsxs("ul",{className:"text-sm text-gray-600",children:[Object.entries(a.dependencies).map(([o,c])=>i.jsxs("li",{className:"my-1 flex justify-between pr-1",children:[i.jsxs("span",{children:[o.replace("@powerhousedao/",""),":"]}),i.jsx("span",{className:"font-normal",children:c})]},o)),s&&i.jsxs("li",{className:"my-1 flex justify-between pr-1",children:[i.jsx("span",{children:"@powerhousedao/ph-cli:"}),i.jsx("span",{className:"font-normal",children:s})]},"ph-cli")]})}):(console.error("Failed to validate package.json data"),null)}function N2(e){const{packageJson:t,phCliVersion:n}=e;return i.jsxs("div",{className:"bg-white p-3",children:[i.jsx("h2",{className:"font-semibold",children:"About"}),i.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."}),i.jsx("div",{className:"my-4",children:i.jsx(kw,{packageJson:t,phCliVersion:n})})]})}function E2(e){const{className:t,...n}=e;return i.jsxs("div",{className:Ji("h-full rounded-lg bg-white p-3",t),children:[i.jsx("h2",{className:"mb-4 font-semibold",children:"Modify Drives"}),i.jsx(Mw,{...n}),i.jsx("h2",{className:"my-4 font-semibold",children:"Local Storage"}),i.jsx(Rw,{...n})]})}function Mw(e){const{className:t,...n}=e;return i.jsx("div",{className:t,children:i.jsx(Tw,{...n})})}function Tw(e){const{className:t,...n}=e;return i.jsx("div",{className:t,children:e.drives.map(r=>i.jsx(Aw,{drive:r,...n},r.header.id))})}function Aw(e){const{drive:t,className:n,onDeleteDrive:r}=e,[s,a]=m.useState(!1),o=i.jsx(I,{name:"Hdd",size:16,className:"flex-none"}),c=i.jsx(I,{name:"Server",size:16,className:"flex-none"}),l=t.state.global.icon?i.jsx("img",{alt:"drive icon",className:"size-4 flex-none object-contain",src:t.state.global.icon}):i.jsx(I,{name:"M",size:16,className:"flex-none"});function u(){const h=ds(t);return h==="PUBLIC"?l:h==="CLOUD"?c:o}const d=u();return i.jsxs("div",{className:Ji("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,i.jsxs("div",{children:[i.jsx("span",{className:"block text-sm font-medium leading-[18px]",children:Ya(t.header.name)}),i.jsxs("div",{className:"flex items-baseline gap-x-2 leading-[18px]",children:[i.jsxs("span",{className:"text-sm text-gray-600",children:[Ya(ds(t))," App"]}),i.jsxs("a",{className:"group flex items-center gap-x-2 text-sm text-slate-500 transition-colors hover:text-[#9896FF]",children:["By Powerhouse",i.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:i.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"})})]})]})]}),i.jsx(Tr,{items:[{id:"delete-drive",label:"Delete",icon:i.jsx(I,{name:"Trash"}),className:"text-red-900"}],onItemClick:h=>{h==="delete-drive"&&r(t)},onOpenChange:a,open:s,children:i.jsx("button",{className:"group ml-auto flex-none",onClick:h=>{h.stopPropagation(),a(!0)},children:i.jsx(I,{className:"text-gray-600 group-hover:text-gray-900",name:"VerticalDots",size:16})})})]})}function Rw(e){const{onClearStorage:t}=e;return i.jsx("div",{children:i.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 ",i.jsx(I,{name:"Trash",size:16})]})})}function P2(e){const{className:t,...n}=e;return i.jsx("div",{className:M("rounded-lg p-3",t),children:i.jsx(Dw,{...n})})}function Dw(e){const{documentModelEditor:t,setDocumentModelEditor:n,documentModelEditorOptions:r,className:s}=e;return i.jsxs("div",{children:[i.jsx("h3",{className:"mb-4 font-semibold text-gray-900",children:"Default Editor Selection"}),i.jsx(Zi,{className:M("min-w-36 max-w-fit",s),name:"default-editor",required:!0,value:t,options:r,multiple:!1,onChange:a=>n(a)})]})}const Lw={npm:{icon:"Npm"},github:{icon:"Github",size:28},local:{icon:"Hdd"}},Fw=({packageName:e,provider:t})=>{const n=t&&Lw[t];return i.jsxs("div",{className:"flex w-full items-center justify-between px-2 py-1",children:[i.jsx("p",{className:"font-medium",children:e}),n&&i.jsx(I,{name:n.icon,size:n.size})]})},$w=e=>{const{onInstall:t,packageOptions:n,className:r}=e,[s,a]=m.useState(""),[o,c]=m.useState(!1),[l,u]=m.useState(),d=m.useCallback(()=>{const g=t(s);g?(c(!0),g.then(()=>a("")).catch(u).finally(()=>c(!1))):(a(""),u(void 0))},[t,s]),h=m.useCallback(g=>{a(g.target.value)},[]),f=l?typeof l=="string"?l:l instanceof Error?l.message:l:" ",p=m.useMemo(()=>{const g=n?.map(b=>({...b,value:b.packageName}));return n?.length?{autoComplete:!0,initialOptions:g,fetchOptionsCallback:b=>g?.filter(y=>y.packageName.toLowerCase().includes(b.toLowerCase()))??[],renderOption:b=>i.jsx(Fw,{...b})}:{autoComplete:!1}},[n]);return i.jsxs("div",{className:r,children:[i.jsx("h3",{className:"mb-4 font-semibold text-gray-900",children:"Install Package"}),i.jsxs("div",{className:"flex items-center gap-4",children:[n?.length?i.jsx(rf,{...p,onChange:a}):i.jsx(nf,{name:"package",className:"max-w-xs text-gray-700",value:s,onChange:h,onSubmit:d,disabled:o}),i.jsx(Ee,{className:"h-9 rounded-md text-sm",onClick:d,disabled:o,children:"Install"})]}),i.jsx("p",{className:"mb-3 ml-2 h-3 text-sm text-red-800",children:f})]})},Hn=({label:e,value:t})=>i.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[i.jsxs("p",{className:"text-gray-600",children:[e,":"]}),i.jsx("p",{className:"text-gray-600",children:t})]}),zw=e=>{const{package:{name:t,description:n,category:r,publisher:s,publisherUrl:a,modules:o,id:c,removable:l},mutable:u,onUninstall:d,className:h}=e,[f,p]=m.useState(!1);return i.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:[i.jsx("h3",{className:"font-semibold text-gray-900",children:t}),i.jsx(Hn,{label:"Description",value:n}),i.jsx(Hn,{label:"Category",value:r}),i.jsx(Hn,{label:"Publisher",value:s}),i.jsx(Hn,{label:"Publisher URL",value:i.jsx("a",{className:"underline",href:a,children:a})}),i.jsx("p",{className:"text-sm text-gray-600",children:"Modules included:"}),i.jsx("ul",{className:"list-disc pl-5",children:o.map(g=>i.jsx("li",{children:i.jsx("span",{className:"text-gray-600",children:g})},g))}),u&&l&&i.jsx(Tr,{items:[{id:"uninstall",label:"Uninstall",icon:i.jsx(I,{name:"Trash"}),className:"text-red-900"}],onItemClick:g=>{g==="uninstall"&&d(c)},onOpenChange:p,open:f,children:i.jsx("button",{className:"group absolute right-3 top-3",onClick:g=>{g.stopPropagation(),p(!0)},children:i.jsx(I,{className:"text-gray-600 group-hover:text-gray-900",name:"VerticalDots"})})})]})},Vw=e=>{const{className:t,packages:n,onUninstall:r,mutable:s,...a}=e,[o,c]=m.useState();m.useLayoutEffect(()=>{const u=()=>{const h=window.innerHeight-516;c(Math.max(200,h))};return u(),window.addEventListener("resize",u),()=>window.removeEventListener("resize",u)},[]);const l=m.useCallback(u=>{r(u)},[r]);return i.jsxs("div",{...a,className:M("flex flex-col items-stretch overflow-hidden",t),style:{maxHeight:o},children:[i.jsx("h3",{className:"mb-4 font-semibold text-gray-900",children:"Installed Packages"}),i.jsx("div",{className:"flex-1 overflow-y-auto pr-2",children:i.jsx("ul",{className:"flex flex-col items-stretch gap-4 pr-2",children:n.map(u=>i.jsx(zw,{package:u,onUninstall:l,mutable:s},u.id))})})]})},Uw=e=>{const{reactorOptions:t,reactor:n,onReactorChange:r,...s}=e,a=m.useCallback(o=>{r(Array.isArray(o)?o.at(-1):o)},[r]);return i.jsxs("div",{...s,children:[i.jsx("h3",{className:"mb-4 font-semibold text-gray-900",children:"Select Reactor"}),i.jsx(Zi,{className:"min-w-36 max-w-fit",name:"reactor",required:!0,value:n,options:t,multiple:!1,onChange:a})]})},O2=e=>{const{className:t,reactorOptions:n,reactor:r,onReactorChange:s,onInstall:a,packages:o,onUninstall:c,mutable:l,packageOptions:u,...d}=e,h=m.useMemo(()=>u?.filter(f=>!o.find(p=>p.name===f.packageName)),[o,u]);return i.jsxs("div",{...d,className:M("flex h-full flex-1 flex-col rounded-lg p-3",t),children:[i.jsx(Uw,{reactor:r,reactorOptions:n,onReactorChange:s,className:"mb-4"}),l&&i.jsx($w,{onInstall:a,packageOptions:h}),i.jsx(Vw,{packages:o,onUninstall:c,mutable:l})]})};function I2(e){const{title:t,overlayProps:n,contentProps:r,onOpenChange:s,tabs:a,defaultTab:o,...c}=e,[l,u]=m.useState(o??a.at(0)?.id),d=a.map(p=>i.jsx("button",{type:"button",onClick:()=>u(p.id),children:i.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,i.jsx("span",{children:p.label})]})},p.id)),f=a.find(p=>p.id===l)?.content;return i.jsxs(De,{contentProps:{...r,className:M("min-h-full w-full max-w-4xl rounded-xl",r?.className),style:{...r?.style,boxShadow:"0px 0px 16px 4px rgba(0, 0, 0, 0.04), 0px 33px 32px -16px rgba(0, 0, 0, 0.10)"}},onOpenChange:s,overlayProps:{...n,className:M("py-28",n?.className)},...c,children:[i.jsxs("div",{className:"flex justify-between border-b border-slate-50 p-4",children:[i.jsx("h1",{className:"text-center text-xl font-semibold",children:t}),i.jsx("button",{type:"button",className:"flex size-6 items-center justify-center rounded-md outline-none",onClick:()=>s?.(!1),children:i.jsx(I,{name:"XmarkLight",size:24})})]}),i.jsxs("div",{className:"flex flex-1",children:[i.jsx("div",{className:"flex flex-col gap-y-1 p-3 pt-6",children:d}),i.jsx("div",{className:"m-6 flex h-full flex-1 flex-col overflow-hidden rounded-lg border border-slate-50",children:typeof f=="function"?i.jsx(f,{}):f})]})]})}const ki="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 k2(e){const{body:t,header:n,onOpenChange:r,onContinue:s,cancelLabel:a,continueLabel:o,overlayProps:c,contentProps:l,...u}=e;return i.jsx(De,{contentProps:{...l,className:M("rounded-3xl",l?.className)},onOpenChange:r,overlayProps:{...c,className:c?.className},...u,children:i.jsxs("div",{className:"w-[400px] p-6 text-slate-300",children:[i.jsx("div",{className:"border-b border-slate-50 pb-2 text-2xl font-bold text-gray-800",children:n}),i.jsx("div",{className:"my-6 rounded-md bg-slate-50 p-4 text-center",children:t}),i.jsxs("div",{className:"mt-8 flex justify-between gap-3",children:[i.jsx("button",{className:M(ki,"flex-1 bg-slate-50 text-slate-800"),onClick:()=>r?.(!1),children:a}),i.jsx("button",{className:M(ki,"flex-1 bg-gray-800 text-gray-50"),onClick:s,children:o})]})]})})}function Bw(e){const{branch:t="main"}=e;return i.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:[i.jsx(I,{name:"Branch"}),i.jsx("span",{children:"BRANCH"}),i.jsx("span",{className:"text-gray-900",children:t})]})}function _w(e){const{docId:t,onCopy:n}=e,[,r]=jr();function s(a){return()=>{r(a).then(()=>{n?.()}).catch(o=>{console.error("Failed to copy!",o)})}}return i.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:[i.jsx(I,{name:"Link"}),"DOC ID",i.jsx("span",{className:"text-gray-900",children:t})]})}const Hw=e=>{const{documentState:t,onCopyState:n}=e,[,r]=jr();function s(){const a=JSON.stringify(t,null,2);r(a).then(()=>{n?.()}).catch(o=>{console.error("Failed to copy document state!",o)})}return i.jsx("button",{className:"rounded-lg bg-slate-50 p-1 text-stone-300",onClick:s,children:i.jsx(I,{name:"CurlyBrackets"})})};function Ww(e){const{value:t,onChange:n}=e,r=[{displayValue:"Global scope",value:"global"},{displayValue:"Local scope",value:"local"}];return i.jsx(vt,{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:r,menuClassName:"min-w-0 text-gray-500",onChange:n,value:t})}function Gw(e){const{title:t,docId:n,scope:r,onChangeScope:s,onClose:a,className:o,documentState:c,onCopyState:l,onCopyDocId:u,...d}=e;return i.jsxs("header",{className:M("flex items-center justify-between bg-transparent",o),...d,children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{name:"close-revision-history",className:"shadow-button rounded-lg bg-gray-50 p-1 text-stone-300",onClick:a,children:i.jsx(I,{name:"VariantArrowLeft"})}),i.jsx("h1",{className:"text-xs",children:t})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(_w,{docId:n,onCopy:u}),c&&i.jsx(Hw,{documentState:c,onCopyState:l}),i.jsx(Bw,{}),i.jsx(Ww,{onChange:s,value:r})]})]})}function gt(e,t,n){let r=n.initialDeps??[],s;function a(){var o,c,l,u;let d;n.key&&((o=n.debug)!=null&&o.call(n))&&(d=Date.now());const h=e();if(!(h.length!==r.length||h.some((g,b)=>r[b]!==g)))return s;r=h;let p;if(n.key&&((c=n.debug)!=null&&c.call(n))&&(p=Date.now()),s=t(...h),n.key&&((l=n.debug)!=null&&l.call(n))){const g=Math.round((Date.now()-d)*100)/100,b=Math.round((Date.now()-p)*100)/100,y=b/16,x=(v,w)=>{for(v=String(v);v.length<w;)v=" "+v;return v};console.info(`%c⏱ ${x(b,5)} /${x(g,5)} ms`,`
45
+ font-size: .6rem;
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,s),s}return a.updateDeps=o=>{r=o},a}function Mi(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const qw=(e,t)=>Math.abs(e-t)<1.01,Qw=(e,t,n)=>{let r;return function(...s){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,s),n)}},Ti=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Yw=e=>e,Jw=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let s=t;s<=n;s++)r.push(s);return r},Kw=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const s=o=>{const{width:c,height:l}=o;t({width:Math.round(c),height:Math.round(l)})};if(s(Ti(n)),!r.ResizeObserver)return()=>{};const a=new r.ResizeObserver(o=>{const c=()=>{const l=o[0];if(l?.borderBoxSize){const u=l.borderBoxSize[0];if(u){s({width:u.inlineSize,height:u.blockSize});return}}s(Ti(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()});return a.observe(n,{box:"border-box"}),()=>{a.unobserve(n)}},Ai={passive:!0},Ri=typeof window>"u"?!0:"onscrollend"in window,Xw=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let s=0;const a=e.options.useScrollendEvent&&Ri?()=>{}:Qw(r,()=>{t(s,!1)},e.options.isScrollingResetDelay),o=d=>()=>{const{horizontal:h,isRtl:f}=e.options;s=h?n.scrollLeft*(f&&-1||1):n.scrollTop,a(),t(s,d)},c=o(!0),l=o(!1);l(),n.addEventListener("scroll",c,Ai);const u=e.options.useScrollendEvent&&Ri;return u&&n.addEventListener("scrollend",l,Ai),()=>{n.removeEventListener("scroll",c),u&&n.removeEventListener("scrollend",l)}},Zw=(e,t,n)=>{if(t?.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},e6=(e,{adjustments:t=0,behavior:n},r)=>{var s,a;const o=e+t;(a=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||a.call(s,{[r.options.horizontal?"left":"top"]:o,behavior:n})};class t6{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 r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(s=>{s.forEach(a=>{const o=()=>{this._measureElement(a.target,a)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var s;(s=r())==null||s.disconnect(),n=null},observe:s=>{var a;return(a=r())==null?void 0:a.observe(s,{box:"border-box"})},unobserve:s=>{var a;return(a=r())==null?void 0:a.unobserve(s)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,s])=>{typeof s>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Yw,rangeExtractor:Jw,onChange:()=>{},measureElement:Zw,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 r,s;(s=(r=this.options).onChange)==null||s.call(r,this,n)},this.maybeNotify=gt(()=>(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 r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,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(s=>{this.observer.observe(s)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,a)=>{this.scrollAdjustments=0,this.scrollDirection=a?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=a,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,r)=>{const s=new Map,a=new Map;for(let o=r-1;o>=0;o--){const c=n[o];if(s.has(c.lane))continue;const l=a.get(c.lane);if(l==null||c.end>l.end?a.set(c.lane,c):c.end<l.end&&s.set(c.lane,!0),s.size===this.options.lanes)break}return a.size===this.options.lanes?Array.from(a.values()).sort((o,c)=>o.end===c.end?o.index-c.index:o.end-c.end)[0]:void 0},this.getMeasurementOptions=gt(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(n,r,s,a,o)=>(this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:s,getItemKey:a,enabled:o}),{key:!1}),this.getMeasurements=gt(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:s,getItemKey:a,enabled:o},c)=>{if(!o)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=a(d),f=this.options.lanes===1?u[d-1]:this.getFurthestMeasurement(u,d),p=f?f.end+this.options.gap:r+s,g=c.get(h),b=typeof g=="number"?g:this.options.estimateSize(d),y=p+b,x=f?f.lane:d%this.options.lanes;u[d]={index:d,start:p,size:b,end:y,key:h,lane:x}}return this.measurementsCache=u,u},{key:!1,debug:()=>this.options.debug}),this.calculateRange=gt(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,s,a)=>this.range=n.length>0&&r>0?n6({measurements:n,outerSize:r,scrollOffset:s,lanes:a}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=gt(()=>{let n=null,r=null;const s=this.calculateRange();return s&&(n=s.startIndex,r=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,s,a,o)=>a===null||o===null?[]:n({startIndex:a,endIndex:o,overscan:r,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,s=n.getAttribute(r);return s?parseInt(s,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(n,r)=>{const s=this.indexFromElement(n),a=this.measurementsCache[s];if(!a)return;const o=a.key,c=this.elementsCache.get(o);c!==n&&(c&&this.observer.unobserve(c),this.observer.observe(n),this.elementsCache.set(o,n)),n.isConnected&&this.resizeItem(s,this.options.measureElement(n,r,this))},this.resizeItem=(n,r)=>{const s=this.measurementsCache[n];if(!s)return;const a=this.itemSizeCache.get(s.key)??s.size,o=r-a;o!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(s,o,this):s.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=o,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(s.index),this.itemSizeCache=new Map(this.itemSizeCache.set(s.key,r)),this.notify(!1))},this.measureElement=n=>{if(!n){this.elementsCache.forEach((r,s)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(s))});return}this._measureElement(n,void 0)},this.getVirtualItems=gt(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const s=[];for(let a=0,o=n.length;a<o;a++){const c=n[a],l=r[c];s.push(l)}return s},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return Mi(r[td(0,r.length-1,s=>Mi(r[s]).start,n)])},this.getOffsetForAlignment=(n,r,s=0)=>{const a=this.getSize(),o=this.getScrollOffset();r==="auto"&&(r=n>=o+a?"end":"start"),r==="center"?n+=(s-a)/2:r==="end"&&(n-=a);const c=this.getTotalSize()+this.options.scrollMargin-a;return Math.max(Math.min(c,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const s=this.measurementsCache[n];if(!s)return;const a=this.getSize(),o=this.getScrollOffset();if(r==="auto")if(s.end>=o+a-this.options.scrollPaddingEnd)r="end";else if(s.start<=o+this.options.scrollPaddingStart)r="start";else return[o,r];const c=r==="end"?s.end+this.options.scrollPaddingEnd:s.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(c,r,s.size),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(n,{align:r="start",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,r),{adjustments:void 0,behavior:s})},this.scrollToIndex=(n,{align:r="auto",behavior:s}={})=>{s==="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 a=0;const o=10,c=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:s}),this.targetWindow.requestAnimationFrame(()=>{const p=this.getScrollOffset(),g=this.getOffsetForIndex(n,f);if(!g){console.warn("Failed to get offset for index:",n);return}qw(g[0],p)||l(f)})},l=u=>{this.targetWindow&&(a++,a<o?this.targetWindow.requestAnimationFrame(()=>c(u)):console.warn(`Failed to scroll to index ${n} after ${o} attempts.`))};c(r)},this.scrollBy=(n,{behavior:r}={})=>{r==="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:r})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1)s=((n=r[r.length-1])==null?void 0:n.end)??0;else{const a=Array(this.options.lanes).fill(null);let o=r.length-1;for(;o>=0&&a.some(c=>c===null);){const c=r[o];a[c.lane]===null&&(a[c.lane]=c.end),o--}s=Math.max(...a.filter(c=>c!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:s})=>{this.options.scrollToFn(n,{behavior:s,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(t)}}const td=(e,t,n,r)=>{for(;e<=t;){const s=(e+t)/2|0,a=n(s);if(a<r)e=s+1;else if(a>r)t=s-1;else return s}return e>0?e-1:0};function n6({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){const s=e.length-1,a=l=>e[l].start;if(e.length<=r)return{startIndex:0,endIndex:s};let o=td(0,s,a,n),c=o;if(r===1)for(;c<s&&e[c].end<n+t;)c++;else if(r>1){const l=Array(r).fill(0);for(;c<s&&l.some(d=>d<n+t);){const d=e[c];l[d.lane]=d.end,c++}const u=Array(r).fill(n+t);for(;o>=0&&u.some(d=>d>=n);){const d=e[o];u[d.lane]=d.start,o--}o=Math.max(0,o-o%r),c=Math.min(s,c+(r-1-c%r))}return{startIndex:o,endIndex:c}}const Di=typeof document<"u"?m.useLayoutEffect:m.useEffect;function r6(e){const t=m.useReducer(()=>({}),{})[1],n={...e,onChange:(s,a)=>{var o;a?Vi.flushSync(t):t(),(o=e.onChange)==null||o.call(e,s,a)}},[r]=m.useState(()=>new t6(n));return r.setOptions(n),Di(()=>r._didMount(),[]),Di(()=>r._willUpdate()),r}function s6(e){return r6({observeElementRect:Kw,observeElementOffset:Xw,scrollToFn:e6,...e})}function a6(e){return`${e.slice(0,7)}...${e.slice(-5)}`}function o6(e){const{address:t,chainId:n}=e,[,r]=jr();if(!t)return null;const s=a6(t);function a(c){return()=>{r(c).catch(l=>{console.error("Failed to copy!",l)})}}const o=i.jsxs("button",{className:"flex items-center gap-1",onClick:a(t),children:[t,i.jsx(I,{className:"inline-block text-gray-600",name:"FilesEarmark",size:16})]});return i.jsx(He,{content:o,children:i.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:[i.jsx(Bu,{address:t,chainId:n}),s]})})}function i6(e){const{errors:t}=e,n=!!t?.length,r=n?"text-red-800":"text-green-700",s=n?i.jsx(I,{name:"Exclamation",size:16}):i.jsx(I,{name:"Check",size:16}),a=n?`Error: ${t[0]}`:"No errors",o=i.jsxs("span",{className:M("flex w-fit items-center rounded-lg border border-gray-200 px-2 py-1 text-xs",r,n&&"cursor-pointer"),children:[s,i.jsx("span",{className:M("inline-block max-w-36 truncate"),children:a})]}),c=t?.map((l,u)=>i.jsxs("p",{className:"text-red-800",children:["Error: ",l]},u));return n?i.jsx(He,{content:c,children:o}):o}function c6(e){const{operationType:t,operationInput:n}=e,r=i.jsx("code",{children:i.jsx("pre",{children:JSON.stringify(n,null,2)})});return i.jsx(He,{content:r,children:i.jsxs("span",{className:"flex cursor-pointer items-center gap-2 text-xs",children:[t,i.jsx(I,{className:"text-gray-300",name:"Braces",size:16})]})})}function l6(e){const{operationIndex:t,eventId:n,stateHash:r}=e,[,s]=jr(),a=t+1,o=i.jsxs("button",{className:"flex items-center gap-1",onClick:c(r),children:["Revision ",a," - Event ID: ",n," - State Hash: ",r,i.jsx(I,{className:"inline-block text-gray-600",name:"FilesEarmark",size:16})]});function c(l){return()=>{s(l).catch(u=>{console.error("Failed to copy!",u)})}}return i.jsx(He,{content:o,children:i.jsxs("span",{className:"flex cursor-pointer items-center gap-2 text-xs text-gray-600",children:["Revision ",a,".",i.jsx("a",{children:i.jsx(I,{className:"cursor-pointer text-slate-100",name:"Ellipsis",size:14})})]})})}function u6(e){const{signatures:t}=e;if(!t?.length)return null;const n=i.jsxs("div",{className:"text-xs text-slate-300",children:[i.jsx("h3",{className:"mb-2",children:"Signature details:"}),t.map((r,s)=>i.jsxs("div",{className:"mb-2 last:mb-0",children:[i.jsxs("h4",{children:["Signature #",s+1," -"," ",r.isVerified?"verified":"unverified"]}),i.jsx("code",{children:i.jsx("pre",{children:JSON.stringify(r,null,2)})})]},r.hash))]});return i.jsx(He,{content:n,children:i.jsxs("span",{className:"flex w-fit cursor-pointer items-center gap-1 rounded-lg border border-gray-200 px-2 py-1",children:[i.jsx(d6,{signatures:t})," ",i.jsx(I,{className:"text-gray-300",name:"InfoSquare",size:16})]})})}function d6(e){const{signatures:t}=e;if(!t?.length)return null;const n=t.length,r=t.filter(c=>c.isVerified).length,a=`${r}/${n} ${n===1?"signature":"signatures"} verified`,o=r===0?"text-red-800":r===n?"text-green-700":"text-orange-700";return i.jsx("span",{className:`text-xs ${o}`,children:a})}function f6(e){const{timestampUtcMs:t}=e,n=typeof t=="string"&&!t.includes("-")?parseInt(t):t,r=new Date(n),s=sr(r,"HH:mm 'UTC'"),a=sr(r,"eee, dd MMM yyyy HH:mm:ss 'UTC'"),o=i.jsx("div",{children:a});return i.jsx(He,{content:o,children:i.jsxs("span",{className:"cursor-pointer text-xs",children:["committed at ",s]})})}function h6(e){return i.jsxs("article",{className:"flex items-center justify-between rounded-xl border border-gray-200 bg-white px-4 py-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(l6,{...e}),i.jsx(c6,{...e}),i.jsx(o6,{...e}),i.jsx(f6,{...e})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx(u6,{...e}),i.jsx(i6,{...e})]})]})}const p6=m.memo(h6);function m6(e){const{operationIndex:t,skipCount:n}=e,r=t,s=n===1?`${r}`:`${r} - ${r+1-n}`;return i.jsxs("article",{className:"grid grid-cols-[1fr,auto,1fr] items-center py-2",children:[i.jsx("div",{className:"h-px rounded-full bg-slate-100"}),i.jsxs("div",{className:"mx-3 text-xs text-slate-100",children:["[Skipped Revision ",s,"]"]}),i.jsx("div",{className:"h-px rounded-full bg-slate-100"})]})}function g6(e){const t=[],n=new Set;for(const r of e){if(!r.timestampUtcMs)continue;const s=r.timestampUtcMs.split("T")[0];n.has(s)||(n.add(s),t.push({type:"day",height:32,timestampUtcMs:s})),t.push({type:"revision",height:46,operationIndex:r.index,eventId:r.id??"EVENT_ID_NOT_FOUND",stateHash:r.hash,operationType:r.action.type,operationInput:r.action.input??{},address:r.action?.context?.signer?.user.address,chainId:r.action?.context?.signer?.user.chainId,timestampUtcMs:r.timestampUtcMs,signatures:y6(r.action?.context?.signer?.signatures??[]),errors:r.error?[r.error]:void 0}),r.skip>0&&t.push({type:"skip",height:34,operationIndex:r.index,skipCount:r.skip,timestampUtcMs:r.timestampUtcMs})}return t}function b6(e){const[t,n,r,s]=e;return{signerAddress:t,hash:n,prevStateHash:r,signatureBytes:s,isVerified:!0}}function y6(e){return e?.map(b6)}function x6(e){const{timestampUtcMs:t}=e,n=sr(t,"MMM dd, yyyy");return i.jsxs("h2",{className:"-ml-6 flex items-center gap-1 bg-slate-50 py-2 text-xs text-slate-100",children:[i.jsx(I,{name:"Ring",size:16})," Changes on ",n]})}function v6(e){const{localOperations:t,globalOperations:n,scope:r}=e,s=r==="local"?t:n,a=100,o=m.useMemo(()=>g6(s),[s]),[c,l]=m.useState(0),[u,d]=m.useState(a),[h,f]=m.useState(()=>o.slice(0,u)),p=m.useRef(null),g=h.length<o.length,b=s6({count:h.length,getScrollElement:()=>p.current,estimateSize:x=>o[x].height,gap:8});m.useEffect(()=>{if(!g)return;const x=Math.floor(c/46),v=a+x;d(w=>v>w?v:w)},[c,g]),m.useEffect(()=>{f(o.slice(0,u))},[o,u]);const y=x=>{l(v=>{const w=v+x.deltaY;return w<0?0:w})};return m.useEffect(()=>(window.addEventListener("wheel",y),()=>{window.removeEventListener("wheel",y)}),[]),i.jsx("div",{className:"border-l border-slate-100",ref:p,style:{height:`${b.getTotalSize()}px`,width:"100%",position:"relative"},children:b.getVirtualItems().map(x=>{const v=h[x.index];return i.jsxs("div",{style:{position:"absolute",top:0,left:16,width:"100%",height:`${x.size}px`,transform:`translateY(${x.start}px)`},children:[v.type==="revision"&&m.createElement(p6,{...v,key:x.key}),v.type==="skip"&&i.jsx(m6,{...v},x.key),v.type==="day"&&i.jsx(x6,{...v},x.key)]},x.index)})})}function M2(e){const{documentTitle:t,documentId:n,globalOperations:r,localOperations:s,onClose:a,itemsPerPage:o=100,documentState:c,onCopyState:l,onCopyDocId:u}=e,[d,h]=m.useState("global"),f=m.useMemo(()=>Yd(Jd(d==="global"?r:s)).sort((O,T)=>T.index-O.index),[r,s,d]),{pageItems:p,pages:g,goToPage:b,goToNextPage:y,goToPreviousPage:x,goToFirstPage:v,goToLastPage:w,hiddenNextPages:E,isNextPageAvailable:C,isPreviousPageAvailable:j}=Ud(f,{itemsPerPage:o});function S(k){v(),h(k)}const P=f.length>o?i.jsx("div",{className:"mt-4 flex w-full justify-end",children:i.jsx(Bd,{firstPageLabel:"First Page",goToFirstPage:v,goToLastPage:w,goToNextPage:y,goToPage:b,goToPreviousPage:x,hiddenNextPages:E,isNextPageAvailable:C,isPreviousPageAvailable:j,lastPageLabel:"Last Page",nextPageLabel:"Next",pages:g,previousPageLabel:"Previous"})}):i.jsx("hr",{className:"h-12 border-none"});return i.jsx(Cl,{children:i.jsxs("div",{className:"p-6",children:[i.jsx(Gw,{docId:n,onChangeScope:S,onClose:a,scope:d,title:t,documentState:c,onCopyState:l,onCopyDocId:u}),P,i.jsx("div",{className:"mt-4 flex justify-center rounded-md bg-slate-50 p-4",children:f.length>0?i.jsx("div",{className:"grid grid-cols-[minmax(min-content,1018px)]",children:i.jsx(v6,{globalOperations:d==="global"?p:[],localOperations:d==="local"?p:[],scope:d})}):i.jsx("h3",{className:"my-40 text-gray-600",children:"This document has no recorded operations yet."})}),P]})})}const w6=function(t){const{icon:n,title:r,description:s,containerClassName:a,active:o,onClick:c}=t;return i.jsx(He,{content:r,side:"right",sideOffset:12,className:"border-none bg-gray-800 px-3 py-2 text-sm text-white",children:i.jsxs("div",{className:M("group/sidebar-item relative flex cursor-pointer flex-col items-center justify-center text-center text-sm text-black",a,o&&"bg-white",c&&"cursor-pointer"),onClick:c,children:[o?i.jsx("div",{className:"absolute left-0 top-1/2 h-10 w-1 -translate-y-1/2 rounded-r-sm bg-violet-400"}):i.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"}),i.jsx("div",{className:"mx-auto py-4",children:n||i.jsx("div",{className:"flex size-8 items-center justify-center rounded-lg bg-black",children:i.jsx("span",{className:"text-sm font-medium text-white",children:r.slice(0,1).toUpperCase()})})})]})})},T2=function(t){const{containerClassName:n,onClick:r}=t;return i.jsx(w6,{title:"Create New Drive",icon:i.jsx(I,{name:"PlusSquare",size:32}),onClick:r,containerClassName:n})},C6=({onLogin:e})=>{const[t,n]=m.useState(!1),r=!t&&!!e,s=t?i.jsx(I,{name:"Reload",size:14,className:"animate-spin"}):i.jsx("span",{children:"Connect"}),a=()=>{e&&(n(!0),e())};return i.jsxs("div",{className:"p-4",children:[i.jsx("div",{className:"mb-4 flex justify-center",children:i.jsx("div",{className:"flex h-[22px] w-[83px] items-center justify-center overflow-hidden",children:i.jsx(I,{name:"RenownLight",size:83})})}),i.jsx("button",{onClick:r?a: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",r?"cursor-pointer":"cursor-wait"),type:"button",children:s})]})},S6=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,j6=new URL("/assets/renown-short-hover-BiSLBV7L.png",import.meta.url).href,N6=({onLogin:e})=>{const t=i.jsx(C6,{onLogin:e});return i.jsx(jc,{content:t,children:i.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:[i.jsx("img",{width:42,height:42,loading:"lazy",className:"group-hover/sidebar-footer:hidden",src:S6,alt:"Renown Login"}),i.jsx("img",{width:42,height:42,loading:"lazy",className:"hidden group-hover/sidebar-footer:block",src:j6,alt:"Renown Login Hover"})]})})},E6=e=>`${e.slice(0,7)}...${e.slice(-5)}`,P6=({address:e,onDisconnect:t,etherscanUrl:n,username:r=""})=>{const[s,a]=m.useState(!1),o=m.useCallback(async c=>{try{await navigator.clipboard.writeText(c),a(!0),setTimeout(()=>a(!1),2e3)}catch(l){console.error("Failed to copy address:",l)}},[]);return i.jsxs("div",{className:"flex flex-col divide-y divide-gray-200 text-gray-900",children:[i.jsxs("div",{className:"px-3 py-2",children:[r&&i.jsx("div",{className:"text-sm font-medium",children:r}),i.jsx("div",{className:"mt-1 flex items-center gap-2",children:i.jsx(Ee,{size:"small",color:"light",onClick:o.bind(null,e),className:"w-full cursor-pointer bg-transparent p-0 active:opacity-70",type:"button",children:i.jsxs("div",{className:"relative flex w-full items-center gap-1",children:[i.jsxs("div",{className:`flex items-center gap-1 transition-opacity duration-150 ${s?"opacity-0":"opacity-100"}`,children:[i.jsx("span",{className:"text-xs",children:E6(e)}),i.jsx(I,{name:"FilesEarmark",color:"#9EA0A1",size:14})]}),i.jsx("div",{className:`absolute left-0 text-xs transition-opacity duration-150 ${s?"opacity-100":"opacity-0"}`,children:"Copied to clipboard!"})]})})})]}),n&&i.jsx("div",{className:"px-3 py-2",children:i.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:[i.jsx(I,{name:"Ethscan",size:14}),"View on Etherscan"]})}),i.jsx("div",{className:"px-3 py-2",children:i.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:[i.jsx(I,{name:"Disconnect",size:14,color:"#EA4335"}),"Disconnect"]})})]})},O6=({address:e,etherscanUrl:t,onDisconnect:n})=>{const{data:r}=Uu({address:e}),s=r,a=i.jsx(P6,{address:e,username:s,onDisconnect:n,etherscanUrl:t});return i.jsx(jc,{content:a,children:i.jsx("div",{className:"flex items-center justify-center rounded-sm",children:i.jsx(Bu,{address:e,size:"40px"})})})},I6=({address:e,className:t,onLogin:n,onClickSettings:r,onInspectorClick:s,onDisconnect:a,onHomeClick:o,showDebug:c,onDebugClick:l,etherscanUrl:u="",...d})=>i.jsxs(_d,{...d,className:M("flex flex-col gap-2 border-t border-gray-300 px-2 py-4",t),children:[o&&i.jsx("button",{"aria-label":"Home",type:"button",className:"flex w-full cursor-pointer items-center justify-center outline-none",onClick:o,children:i.jsx(I,{className:"text-gray-600",name:"ConnectSmall",size:24})}),c&&l&&i.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:i.jsx(I,{className:"text-gray-600",name:"Tube"})}),i.jsx("div",{className:o?"mt-3":"",children:e?i.jsx(O6,{address:e,onDisconnect:a,etherscanUrl:u}):i.jsx(N6,{onLogin:n})}),s&&i.jsx("button",{"aria-label":"Inspector",type:"button",className:"mt-3 flex w-full cursor-pointer items-center justify-center outline-none",onClick:s,children:i.jsx(I,{className:"text-gray-600",name:"CircleInfo"})}),i.jsxs("button",{"aria-label":"Settings",type:"button",className:M("mt-3 flex w-full items-center justify-center outline-none",r?"cursor-pointer":"cursor-wait"),onClick:r,children:[i.jsx(I,{className:"text-gray-600",name:"Settings"}),i.jsx("span",{className:"hidden text-sm font-semibold leading-6 text-gray-800",children:"Settings"})]})]}),k6=({className:e,children:t,...n})=>t?i.jsx(Hd,{...n,className:M("flex justify-center gap-4 border-b border-gray-300 py-4",e),children:t}):null,A2=({onClick:e,address:t,headerContent:n,onClickSettings:r,onInspectorClick:s,maxWidth:a="304px",minWidth:o="58px",onLogin:c,onDisconnect:l,etherscanUrl:u,showDebug:d,onDebugClick:h,...f})=>i.jsxs(Wd,{...f,maxWidth:a,minWidth:o,children:[i.jsxs(Gd,{children:[i.jsx(k6,{children:n}),i.jsx("div",{className:"flex flex-col",children:f.children})]}),i.jsx(I6,{address:t,onClickSettings:r,onInspectorClick:s,onLogin:c,onDisconnect:l,etherscanUrl:u,onHomeClick:e,showDebug:d,onDebugClick:h})]}),yn=e=>typeof e=="number"&&!isNaN(e),at=e=>typeof e=="string",xe=e=>typeof e=="function",tr=e=>at(e)||xe(e)?e:null,Zs=e=>m.isValidElement(e)||at(e)||xe(e)||yn(e);function M6(e,t,n){n===void 0&&(n=300);const{scrollHeight:r,style:s}=e;requestAnimationFrame(()=>{s.minHeight="initial",s.height=r+"px",s.transition=`all ${n}ms`,requestAnimationFrame(()=>{s.height="0",s.padding="0",s.margin="0",setTimeout(t,n)})})}function Fr(e){let{enter:t,exit:n,appendPosition:r=!1,collapse:s=!0,collapseDuration:a=300}=e;return function(o){let{children:c,position:l,preventExitTransition:u,done:d,nodeRef:h,isIn:f,playToast:p}=o;const g=r?`${t}--${l}`:t,b=r?`${n}--${l}`:n,y=m.useRef(0);return m.useLayoutEffect(()=>{const x=h.current,v=g.split(" "),w=E=>{E.target===h.current&&(p(),x.removeEventListener("animationend",w),x.removeEventListener("animationcancel",w),y.current===0&&E.type!=="animationcancel"&&x.classList.remove(...v))};x.classList.add(...v),x.addEventListener("animationend",w),x.addEventListener("animationcancel",w)},[]),m.useEffect(()=>{const x=h.current,v=()=>{x.removeEventListener("animationend",v),s?M6(x,d,a):d()};f||(u?v():(y.current=1,x.className+=` ${b}`,x.addEventListener("animationend",v)))},[f]),J.createElement(J.Fragment,null,c)}}function Li(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 me=new Map;let xn=[];const ea=new Set,T6=e=>ea.forEach(t=>t(e)),nd=()=>me.size>0;function rd(e,t){var n;if(t)return!((n=me.get(t))==null||!n.isToastActive(e));let r=!1;return me.forEach(s=>{s.isToastActive(e)&&(r=!0)}),r}function sd(e,t){Zs(e)&&(nd()||xn.push({content:e,options:t}),me.forEach(n=>{n.buildToast(e,t)}))}function Fi(e,t){me.forEach(n=>{t!=null&&t!=null&&t.containerId?t?.containerId===n.id&&n.toggle(e,t?.id):n.toggle(e,t?.id)})}function A6(e){const{subscribe:t,getSnapshot:n,setProps:r}=m.useRef((function(a){const o=a.containerId||1;return{subscribe(c){const l=(function(d,h,f){let p=1,g=0,b=[],y=[],x=[],v=h;const w=new Map,E=new Set,C=()=>{x=Array.from(w.values()),E.forEach(N=>N())},j=N=>{y=N==null?[]:y.filter(P=>P!==N),C()},S=N=>{const{toastId:P,onOpen:k,updateId:O,children:T}=N.props,R=O==null;N.staleId&&w.delete(N.staleId),w.set(P,N),y=[...y,N.props.toastId].filter(D=>D!==N.staleId),C(),f(Li(N,R?"added":"updated")),R&&xe(k)&&k(m.isValidElement(T)&&T.props)};return{id:d,props:v,observe:N=>(E.add(N),()=>E.delete(N)),toggle:(N,P)=>{w.forEach(k=>{P!=null&&P!==k.props.toastId||xe(k.toggle)&&k.toggle(N)})},removeToast:j,toasts:w,clearQueue:()=>{g-=b.length,b=[]},buildToast:(N,P)=>{if((B=>{let{containerId:L,toastId:_,updateId:ne}=B;const re=L?L!==d:d!==1,G=w.has(_)&&ne==null;return re||G})(P))return;const{toastId:k,updateId:O,data:T,staleId:R,delay:D}=P,V=()=>{j(k)},U=O==null;U&&g++;const H={...v,style:v.toastStyle,key:p++,...Object.fromEntries(Object.entries(P).filter(B=>{let[L,_]=B;return _!=null})),toastId:k,updateId:O,data:T,closeToast:V,isIn:!1,className:tr(P.className||v.toastClassName),bodyClassName:tr(P.bodyClassName||v.bodyClassName),progressClassName:tr(P.progressClassName||v.progressClassName),autoClose:!P.isLoading&&(q=P.autoClose,W=v.autoClose,q===!1||yn(q)&&q>0?q:W),deleteToast(){const B=w.get(k),{onClose:L,children:_}=B.props;xe(L)&&L(m.isValidElement(_)&&_.props),f(Li(B,"removed")),w.delete(k),g--,g<0&&(g=0),b.length>0?S(b.shift()):C()}};var q,W;H.closeButton=v.closeButton,P.closeButton===!1||Zs(P.closeButton)?H.closeButton=P.closeButton:P.closeButton===!0&&(H.closeButton=!Zs(v.closeButton)||v.closeButton);let te=N;m.isValidElement(N)&&!at(N.type)?te=m.cloneElement(N,{closeToast:V,toastProps:H,data:T}):xe(N)&&(te=N({closeToast:V,toastProps:H,data:T}));const se={content:te,props:H,staleId:R};v.limit&&v.limit>0&&g>v.limit&&U?b.push(se):yn(D)?setTimeout(()=>{S(se)},D):S(se)},setProps(N){v=N},setToggle:(N,P)=>{w.get(N).toggle=P},isToastActive:N=>y.some(P=>P===N),getSnapshot:()=>x}})(o,a,T6);me.set(o,l);const u=l.observe(c);return xn.forEach(d=>sd(d.content,d.options)),xn=[],()=>{u(),me.delete(o)}},setProps(c){var l;(l=me.get(o))==null||l.setProps(c)},getSnapshot(){var c;return(c=me.get(o))==null?void 0:c.getSnapshot()}}})(e)).current;r(e);const s=m.useSyncExternalStore(t,n,n);return{getToastToRender:function(a){if(!s)return[];const o=new Map;return e.newestOnTop&&s.reverse(),s.forEach(c=>{const{position:l}=c.props;o.has(l)||o.set(l,[]),o.get(l).push(c)}),Array.from(o,c=>a(c[0],c[1]))},isToastActive:rd,count:s?.length}}function R6(e){const[t,n]=m.useState(!1),[r,s]=m.useState(!1),a=m.useRef(null),o=m.useRef({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:c,pauseOnHover:l,closeToast:u,onClick:d,closeOnClick:h}=e;var f,p;function g(){n(!0)}function b(){n(!1)}function y(w){const E=a.current;o.canDrag&&E&&(o.didMove=!0,t&&b(),o.delta=e.draggableDirection==="x"?w.clientX-o.start:w.clientY-o.start,o.start!==w.clientX&&(o.canCloseOnClick=!1),E.style.transform=`translate3d(${e.draggableDirection==="x"?`${o.delta}px, var(--y)`:`0, calc(${o.delta}px + var(--y))`},0)`,E.style.opacity=""+(1-Math.abs(o.delta/o.removalDistance)))}function x(){document.removeEventListener("pointermove",y),document.removeEventListener("pointerup",x);const w=a.current;if(o.canDrag&&o.didMove&&w){if(o.canDrag=!1,Math.abs(o.delta)>o.removalDistance)return s(!0),e.closeToast(),void e.collapseAll();w.style.transition="transform 0.2s, opacity 0.2s",w.style.removeProperty("transform"),w.style.removeProperty("opacity")}}(p=me.get((f={id:e.toastId,containerId:e.containerId,fn:n}).containerId||1))==null||p.setToggle(f.id,f.fn),m.useEffect(()=>{if(e.pauseOnFocusLoss)return document.hasFocus()||b(),window.addEventListener("focus",g),window.addEventListener("blur",b),()=>{window.removeEventListener("focus",g),window.removeEventListener("blur",b)}},[e.pauseOnFocusLoss]);const v={onPointerDown:function(w){if(e.draggable===!0||e.draggable===w.pointerType){o.didMove=!1,document.addEventListener("pointermove",y),document.addEventListener("pointerup",x);const E=a.current;o.canCloseOnClick=!0,o.canDrag=!0,E.style.transition="none",e.draggableDirection==="x"?(o.start=w.clientX,o.removalDistance=E.offsetWidth*(e.draggablePercent/100)):(o.start=w.clientY,o.removalDistance=E.offsetHeight*(e.draggablePercent===80?1.5*e.draggablePercent:e.draggablePercent)/100)}},onPointerUp:function(w){const{top:E,bottom:C,left:j,right:S}=a.current.getBoundingClientRect();w.nativeEvent.type!=="touchend"&&e.pauseOnHover&&w.clientX>=j&&w.clientX<=S&&w.clientY>=E&&w.clientY<=C?b():g()}};return c&&l&&(v.onMouseEnter=b,e.stacked||(v.onMouseLeave=g)),h&&(v.onClick=w=>{d&&d(w),o.canCloseOnClick&&u()}),{playToast:g,pauseToast:b,isRunning:t,preventExitTransition:r,toastRef:a,eventHandlers:v}}function D6(e){let{delay:t,isRunning:n,closeToast:r,type:s="default",hide:a,className:o,style:c,controlledProgress:l,progress:u,rtl:d,isIn:h,theme:f}=e;const p=a||l&&u===0,g={...c,animationDuration:`${t}ms`,animationPlayState:n?"running":"paused"};l&&(g.transform=`scaleX(${u})`);const b=qe("Toastify__progress-bar",l?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${f}`,`Toastify__progress-bar--${s}`,{"Toastify__progress-bar--rtl":d}),y=xe(o)?o({rtl:d,type:s,defaultClassName:b}):qe(b,o),x={[l&&u>=1?"onTransitionEnd":"onAnimationEnd"]:l&&u<1?null:()=>{h&&r()}};return J.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":p},J.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${f} Toastify__progress-bar--${s}`}),J.createElement("div",{role:"progressbar","aria-hidden":p?"true":"false","aria-label":"notification timer",className:y,style:g,...x}))}let L6=1;const ad=()=>""+L6++;function F6(e){return e&&(at(e.toastId)||yn(e.toastId))?e.toastId:ad()}function Bt(e,t){return sd(e,t),t.toastId}function xr(e,t){return{...t,type:t&&t.type||e,toastId:F6(t)}}function Wn(e){return(t,n)=>Bt(t,xr(e,n))}function Z(e,t){return Bt(e,xr("default",t))}Z.loading=(e,t)=>Bt(e,xr("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...t})),Z.promise=function(e,t,n){let r,{pending:s,error:a,success:o}=t;s&&(r=at(s)?Z.loading(s,n):Z.loading(s.render,{...n,...s}));const c={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},l=(d,h,f)=>{if(h==null)return void Z.dismiss(r);const p={type:d,...c,...n,data:f},g=at(h)?{render:h}:h;return r?Z.update(r,{...p,...g}):Z(g.render,{...p,...g}),f},u=xe(e)?e():e;return u.then(d=>l("success",o,d)).catch(d=>l("error",a,d)),u},Z.success=Wn("success"),Z.info=Wn("info"),Z.error=Wn("error"),Z.warning=Wn("warning"),Z.warn=Z.warning,Z.dark=(e,t)=>Bt(e,xr("default",{theme:"dark",...t})),Z.dismiss=function(e){(function(t){var n;if(nd()){if(t==null||at(n=t)||yn(n))me.forEach(r=>{r.removeToast(t)});else if(t&&("containerId"in t||"id"in t)){const r=me.get(t.containerId);r?r.removeToast(t.id):me.forEach(s=>{s.removeToast(t.id)})}}else xn=xn.filter(r=>t!=null&&r.options.toastId!==t)})(e)},Z.clearWaitingQueue=function(e){e===void 0&&(e={}),me.forEach(t=>{!t.props.limit||e.containerId&&t.id!==e.containerId||t.clearQueue()})},Z.isActive=rd,Z.update=function(e,t){t===void 0&&(t={});const n=((r,s)=>{var a;let{containerId:o}=s;return(a=me.get(o||1))==null?void 0:a.toasts.get(r)})(e,t);if(n){const{props:r,content:s}=n,a={delay:100,...r,...t,toastId:t.toastId||e,updateId:ad()};a.toastId!==e&&(a.staleId=e);const o=a.render||s;delete a.render,Bt(o,a)}},Z.done=e=>{Z.update(e,{progress:1})},Z.onChange=function(e){return ea.add(e),()=>{ea.delete(e)}},Z.play=e=>Fi(!0,e),Z.pause=e=>Fi(!1,e);const $6=typeof window<"u"?m.useLayoutEffect:m.useEffect,Gn=e=>{let{theme:t,type:n,isLoading:r,...s}=e;return J.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:t==="colored"?"currentColor":`var(--toastify-icon-color-${n})`,...s})},us={info:function(e){return J.createElement(Gn,{...e},J.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 J.createElement(Gn,{...e},J.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 J.createElement(Gn,{...e},J.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 J.createElement(Gn,{...e},J.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 J.createElement("div",{className:"Toastify__spinner"})}},z6=e=>{const{isRunning:t,preventExitTransition:n,toastRef:r,eventHandlers:s,playToast:a}=R6(e),{closeButton:o,children:c,autoClose:l,onClick:u,type:d,hideProgressBar:h,closeToast:f,transition:p,position:g,className:b,style:y,bodyClassName:x,bodyStyle:v,progressClassName:w,progressStyle:E,updateId:C,role:j,progress:S,rtl:N,toastId:P,deleteToast:k,isIn:O,isLoading:T,closeOnClick:R,theme:D}=e,V=qe("Toastify__toast",`Toastify__toast-theme--${D}`,`Toastify__toast--${d}`,{"Toastify__toast--rtl":N},{"Toastify__toast--close-on-click":R}),U=xe(b)?b({rtl:N,position:g,type:d,defaultClassName:V}):qe(V,b),H=(function(se){let{theme:B,type:L,isLoading:_,icon:ne}=se,re=null;const G={theme:B,type:L};return ne===!1||(xe(ne)?re=ne({...G,isLoading:_}):m.isValidElement(ne)?re=m.cloneElement(ne,G):_?re=us.spinner():(oe=>oe in us)(L)&&(re=us[L](G))),re})(e),q=!!S||!l,W={closeToast:f,type:d,theme:D};let te=null;return o===!1||(te=xe(o)?o(W):m.isValidElement(o)?m.cloneElement(o,W):(function(se){let{closeToast:B,theme:L,ariaLabel:_="close"}=se;return J.createElement("button",{className:`Toastify__close-button Toastify__close-button--${L}`,type:"button",onClick:ne=>{ne.stopPropagation(),B(ne)},"aria-label":_},J.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},J.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)),J.createElement(p,{isIn:O,done:k,position:g,preventExitTransition:n,nodeRef:r,playToast:a},J.createElement("div",{id:P,onClick:u,"data-in":O,className:U,...s,style:y,ref:r},J.createElement("div",{...O&&{role:j},className:xe(x)?x({type:d}):qe("Toastify__toast-body",x),style:v},H!=null&&J.createElement("div",{className:qe("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!T})},H),J.createElement("div",null,c)),te,J.createElement(D6,{...C&&!q?{key:`pb-${C}`}:{},rtl:N,theme:D,delay:l,isRunning:t,isIn:O,closeToast:f,hide:h,type:d,style:E,className:w,controlledProgress:q,progress:S||0})))},$r=function(e,t){return t===void 0&&(t=!1),{enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:t}},V6=Fr($r("bounce",!0));Fr($r("slide",!0));Fr($r("zoom"));Fr($r("flip"));const U6={position:"top-right",transition:V6,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};function B6(e){let t={...U6,...e};const n=e.stacked,[r,s]=m.useState(!0),a=m.useRef(null),{getToastToRender:o,isToastActive:c,count:l}=A6(t),{className:u,style:d,rtl:h,containerId:f}=t;function p(b){const y=qe("Toastify__toast-container",`Toastify__toast-container--${b}`,{"Toastify__toast-container--rtl":h});return xe(u)?u({position:b,rtl:h,defaultClassName:y}):qe(y,tr(u))}function g(){n&&(s(!0),Z.play())}return $6(()=>{if(n){var b;const y=a.current.querySelectorAll('[data-in="true"]'),x=12,v=(b=t.position)==null?void 0:b.includes("top");let w=0,E=0;Array.from(y).reverse().forEach((C,j)=>{const S=C;S.classList.add("Toastify__toast--stacked"),j>0&&(S.dataset.collapsed=`${r}`),S.dataset.pos||(S.dataset.pos=v?"top":"bot");const N=w*(r?.2:1)+(r?0:x*j);S.style.setProperty("--y",`${v?N:-1*N}px`),S.style.setProperty("--g",`${x}`),S.style.setProperty("--s",""+(1-(r?E:0))),w+=S.offsetHeight,E+=.025})}},[r,l,n]),J.createElement("div",{ref:a,className:"Toastify",id:f,onMouseEnter:()=>{n&&(s(!1),Z.pause())},onMouseLeave:g},o((b,y)=>{const x=y.length?{...d}:{...d,pointerEvents:"none"};return J.createElement("div",{className:p(b),style:x,key:`container-${b}`},y.map(v=>{let{content:w,props:E}=v;return J.createElement(z6,{...E,stacked:n,collapseAll:g,isIn:c(E.toastId,E.containerId),style:E.style,key:`toast-${E.key}`},w)}))}))}function _6(e){return e==="connect-success"||e==="connect-warning"||e==="connect-loading"||e==="connect-deleted"}function H6(e){if(_6(e)){const t={};switch(e){case"connect-success":t.type="success",t.icon=i.jsx(I,{className:"text-green-800",name:"CheckCircleFill",size:24});break;case"connect-warning":t.type="warning",t.icon=i.jsx(I,{className:"text-gray-600",name:"WarningFill",size:24});break;case"connect-loading":t.type="default",t.icon=i.jsx(I,{className:"text-gray-600",name:"ClockFill",size:24});break;case"connect-deleted":t.type="error",t.icon=i.jsx(I,{className:"text-red-800",name:"TrashFill",size:24});break}return t}return{type:e}}function R2(e,t){const{type:n="default",...r}=t||{},s=H6(n);return Z(e,{...s,...r})}const W6=({closeToast:e})=>i.jsx("button",{className:"flex items-center text-gray-500 hover:text-gray-600",onClick:e,children:i.jsx(I,{name:"XmarkLight",size:16})}),D2=e=>i.jsx(B6,{closeButton:W6,...e}),$i=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}}}),G6=Bv({chains:[$i],transports:{[$i.id]:yv()}}),q6=new x5;function L2(e){const{children:t,wagmiProviderProps:n,queryClientProviderProps:r}=e,{config:s=G6,...a}=n??{},{client:o=q6,...c}=r??{};return i.jsx(Wv,{config:s,...a,children:i.jsx(P5,{client:o,...c,children:t})})}export{Mh as A,I2 as B,Of as C,u2 as D,k2 as E,On as F,s6 as G,b2 as H,S2 as I,p2 as J,Sl as K,m2 as L,o2 as M,vb as N,wb as O,Pf as P,Cb as Q,Nf as R,w6 as S,Ef as T,Sb as U,L2 as W,jf as a,uh as b,A2 as c,D2 as d,c2 as e,l2 as f,d2 as g,M2 as h,g2 as i,cw as j,Cl as k,T2 as l,y2 as m,ga as n,j2 as o,x2 as p,i2 as q,v2 as r,w2 as s,R2 as t,a2 as u,C2 as v,N2 as w,E2 as x,P2 as y,O2 as z};