@kky42/pievo-server 2.1.0 → 2.3.0

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 (89) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/LoopView-DjVHUyrR.js +59 -0
  3. package/.output/public/assets/{Modal-B3xpEtcf.js → Modal-CCRvx959.js} +1 -1
  4. package/.output/public/assets/{SignIn-9vsaKv_p.js → SignIn-Qxw5zDFq.js} +1 -1
  5. package/.output/public/assets/{actionUi-DDDfD0WX.js → actionUi-CXxhzYe2.js} +1 -1
  6. package/.output/public/assets/app-D1cij_NJ.css +2 -0
  7. package/.output/public/assets/{artifactView-BV-yQVrj.js → artifactView-Cd5wWPil.js} +1 -1
  8. package/.output/public/assets/index-BRN_CQ8U.js +12 -0
  9. package/.output/public/assets/{invite._token-5zhVSA26.js → invite._token-BIxr8DlP.js} +1 -1
  10. package/.output/public/assets/{invite._token-C3t4JfAY.js → invite._token-j2BTCeG1.js} +1 -1
  11. package/.output/public/assets/lifecycleUi-Qy_8beQK.js +1 -0
  12. package/.output/public/assets/{loopApi-C_Dtw-nL.js → loopApi-CT1mMhlb.js} +1 -1
  13. package/.output/public/assets/loops._loopId-BRBQzioy.js +4 -0
  14. package/.output/public/assets/loops._loopId_.runs._runId-CMnOJkem.js +3 -0
  15. package/.output/public/assets/{notifyFns-CF12Yboc.js → notifyFns-DYD4EKaG.js} +1 -1
  16. package/.output/public/assets/{preload-helper--VCqDT5m.js → preload-helper-DFkkpP6W.js} +1 -1
  17. package/.output/public/assets/{routes-DsdcURfk.js → routes-3nuEJGdo.js} +1 -1
  18. package/.output/public/assets/{routes-WVPuW976.js → routes-DORLim-C.js} +1 -1
  19. package/.output/public/assets/{t._teamId-BdVLnwih.js → t._teamId-F5f4K8kd.js} +1 -1
  20. package/.output/public/assets/{t._teamId-C9uEyAh_.js → t._teamId-XfE_S1Fo.js} +1 -1
  21. package/.output/public/assets/ui-Dhsx6SW0.js +1 -0
  22. package/.output/server/_libs/d3-shape.mjs +130 -1
  23. package/.output/server/_libs/react-is.mjs +48 -0
  24. package/.output/server/_libs/recharts+victory-vendor.mjs +2210 -782
  25. package/.output/server/_ssr/{DashboardView-DJMpoucm.mjs → DashboardView-BF7PciP7.mjs} +11 -8
  26. package/.output/server/_ssr/{LoopPlaybook-WFNer22Y.mjs → LoopPlaybook-DC7QVvPY.mjs} +2 -2
  27. package/.output/server/_ssr/{LoopView-Dsc6oik9.mjs → LoopView-DwSrm9Ja.mjs} +418 -224
  28. package/.output/server/_ssr/{Modal-Bc_5TYGr.mjs → Modal-MaCG52Pv.mjs} +2 -2
  29. package/.output/server/_ssr/{SignIn-2qr-vtR5.mjs → SignIn-RmpWm9uy.mjs} +3 -3
  30. package/.output/server/_ssr/{actionUi-BKF6xI3d.mjs → actionUi-BN55TNYE.mjs} +2 -2
  31. package/.output/server/_ssr/{adapters-Bwuh6uek.mjs → adapters-BoLkOf1T.mjs} +12 -6
  32. package/.output/server/_ssr/{artifactFiles-Cp1IBHne.mjs → artifactFiles-BCaIIrrT.mjs} +3 -3
  33. package/.output/server/_ssr/{artifactView-DX4P3Krh.mjs → artifactView-iuPsp5aa.mjs} +2 -2
  34. package/.output/server/_ssr/artifacts-jQ-bfdhI.mjs +2 -0
  35. package/.output/server/_ssr/{auth-uQ19WsD1.mjs → auth-30Z4lV1w.mjs} +9 -9
  36. package/.output/server/_ssr/{boot-DPoPmSLh.mjs → boot-3BNKujyp.mjs} +392 -193
  37. package/.output/server/_ssr/boot-CsEFT53K.mjs +2 -0
  38. package/.output/server/_ssr/{bun-sqlite-dialect-BW9W1_Ps-CqcLCApi.mjs → bun-sqlite-dialect-BW9W1_Ps-_7tfuNRi.mjs} +2 -2
  39. package/.output/server/_ssr/{d1-sqlite-dialect-BLC8LXE6-AuWb61y8.mjs → d1-sqlite-dialect-BLC8LXE6-ucDUbeBk.mjs} +2 -2
  40. package/.output/server/_ssr/db-CXownd1H.mjs +2 -0
  41. package/.output/server/_ssr/{dist-CtYTvPCD.mjs → dist-Cd6nlLlO.mjs} +2 -2
  42. package/.output/server/_ssr/{factory-BtqxMS8a.mjs → factory-CWWwV7XZ.mjs} +2 -2
  43. package/.output/server/_ssr/{invite._token-DtAfQyfP.mjs → invite._token-BKlz0R2f.mjs} +5 -5
  44. package/.output/server/_ssr/{invite._token-BlbVjz-o.mjs → invite._token-CWl6kipD.mjs} +2 -2
  45. package/.output/server/_ssr/{invite._token-DBttmaDb.mjs → invite._token-SdWXemIc.mjs} +6 -6
  46. package/.output/server/_ssr/{kysely-adapter-bSpTlW7Z.mjs → kysely-adapter-C8iS51DB.mjs} +1 -1
  47. package/.output/server/_ssr/{lifecycleUi-Djb44Aj3.mjs → lifecycleUi-DgBQAYzp.mjs} +2 -1
  48. package/.output/server/_ssr/logger-Gy-47z3k.mjs +2 -0
  49. package/.output/server/_ssr/{loopApi-7MTSs6hy.mjs → loopApi-8_KgBapr.mjs} +6 -2
  50. package/.output/server/_ssr/{loopApi-BXRBFGWh.mjs → loopApi-ABi9SgWS.mjs} +23 -13
  51. package/.output/server/_ssr/{loops._loopId-6Q0DMXU0.mjs → loops._loopId-SON_t43g.mjs} +4 -4
  52. package/.output/server/_ssr/{loops._loopId-C0x0SE8F.mjs → loops._loopId-p1KWsvMM.mjs} +13 -18
  53. package/.output/server/_ssr/{loops._loopId_.runs._runId-CkM0-ckn.mjs → loops._loopId_.runs._runId-PUGBrD5q.mjs} +22 -16
  54. package/.output/server/_ssr/{loops._loopId_.runs._runId-BOJBJu_a.mjs → loops._loopId_.runs._runId-Ymy4lwee.mjs} +4 -4
  55. package/.output/server/_ssr/{machineFns-CQuvvdXx.mjs → machineFns-BZ9puxDt.mjs} +3 -3
  56. package/.output/server/_ssr/{node-sqlite-dialect-ZOyD6D7F.mjs → node-sqlite-dialect-D_3JmkMo.mjs} +2 -2
  57. package/.output/server/_ssr/{notifyFns-BOeYZDRp.mjs → notifyFns-BUCePuF3.mjs} +3 -3
  58. package/.output/server/_ssr/{notifyFns-UFZ2j7Fv.mjs → notifyFns-DuPR1zd7.mjs} +6 -6
  59. package/.output/server/_ssr/{router-jnPelPNh.mjs → router-Czxvra6l.mjs} +44 -37
  60. package/.output/server/_ssr/{routes-CXnbFjB_.mjs → routes-ClZEdsnB.mjs} +6 -6
  61. package/.output/server/_ssr/{routes-Bx0bRxt9.mjs → routes-ComqHvCL.mjs} +2 -2
  62. package/.output/server/_ssr/{routes-CMAUcUsZ.mjs → routes-D5jJJ-30.mjs} +5 -5
  63. package/.output/server/_ssr/runDiff--qLtU4FI.mjs +2 -0
  64. package/.output/server/_ssr/ssr.mjs +52 -48
  65. package/.output/server/_ssr/store-40eVzW1S.mjs +2 -0
  66. package/.output/server/_ssr/{t._teamId-Bsm4WrJl.mjs → t._teamId-BgHV_KFP.mjs} +6 -6
  67. package/.output/server/_ssr/{t._teamId-D9nCEa2h.mjs → t._teamId-DDERNgfn.mjs} +2 -2
  68. package/.output/server/_ssr/{t._teamId-36z-mmyw.mjs → t._teamId-DRJvKHZn.mjs} +5 -5
  69. package/.output/server/_ssr/{teamFns-DAx4a1z4.mjs → teamFns-Bp81UO-x.mjs} +3 -3
  70. package/.output/server/_ssr/{teamFns-BBIbatdZ.mjs → teamFns-bm82twd5.mjs} +2 -2
  71. package/.output/server/_ssr/tokens-CbfoRC_s.mjs +2 -0
  72. package/.output/server/_ssr/{ui-B6mE5-5v.mjs → ui-Ww2tTM2u.mjs} +9 -2
  73. package/.output/server/{_tanstack-start-manifest_v-5iQOchGB.mjs → _tanstack-start-manifest_v-DwKENYCN.mjs} +28 -28
  74. package/.output/server/index.mjs +114 -114
  75. package/package.json +1 -1
  76. package/.output/public/assets/LoopView-Pbp2YtUu.js +0 -55
  77. package/.output/public/assets/app-CStTBRt2.css +0 -2
  78. package/.output/public/assets/index-DT_reRxT.js +0 -12
  79. package/.output/public/assets/lifecycleUi-CMFw5Nlj.js +0 -1
  80. package/.output/public/assets/loops._loopId-6JlPOCsY.js +0 -4
  81. package/.output/public/assets/loops._loopId_.runs._runId-wFUMHN9w.js +0 -3
  82. package/.output/public/assets/ui-Gb1413-F.js +0 -1
  83. package/.output/server/_ssr/artifacts-9G_Ai7vO.mjs +0 -2
  84. package/.output/server/_ssr/boot-Zz5AJgfy.mjs +0 -2
  85. package/.output/server/_ssr/db-BMANvbZu.mjs +0 -2
  86. package/.output/server/_ssr/logger-CR1a0flR.mjs +0 -2
  87. package/.output/server/_ssr/runDiff-CDPvl_cY.mjs +0 -2
  88. package/.output/server/_ssr/store-DDOk2Ty_.mjs +0 -2
  89. package/.output/server/_ssr/tokens-7KEKpLnu.mjs +0 -2
@@ -1 +1 @@
1
- import{n as e,s as t,t as n}from"./jsx-runtime-BseJUIpC.js";import{D as r,I as i,c as a,w as o}from"./loopApi-C_Dtw-nL.js";import{$ as s,A as c,At as l,B as u,Bt as d,C as f,Ct as p,D as m,Dt as h,E as g,Et as _,F as v,Ft as y,G as b,Gt as x,H as S,Ht as C,I as w,It as T,J as E,Jt as D,K as O,Kt as k,L as A,Lt as j,M,Mt as N,N as P,Nt as F,O as I,Ot as L,P as ee,Pt as R,Q as te,R as z,Rt as ne,S as re,St as ie,T as ae,Tt as oe,U as se,Ut as ce,V as le,Vt as ue,W as de,Wt as fe,X as B,Xt as pe,Y as V,Yt as me,Z as H,_ as he,_t as ge,a as _e,at as ve,b as ye,bt as be,c as xe,ct as Se,d as Ce,dt as we,et as Te,f as Ee,ft as De,g as Oe,gt as ke,h as Ae,ht as je,i as Me,it as U,j as Ne,jt as W,k as Pe,kt as Fe,l as Ie,m as Le,mt as Re,n as ze,nt as Be,o as Ve,ot as G,p as He,pt as K,q as Ue,qt as q,r as We,rt as J,s as Ge,st as Y,t as Ke,tt as qe,u as Je,ut as Ye,v as Xe,vt as Ze,w as Qe,wt as $e,x as et,xt as X,y as tt,yt as nt,z as rt,zt as it}from"./Modal-B3xpEtcf.js";import{A as at,C as ot,M as st,S as ct,T as lt,c as ut,h as dt,l as ft,m as pt,o as mt,p as ht,t as gt,w as _t,x as vt,y as yt}from"./ui-Gb1413-F.js";import{n as bt}from"./lifecycleUi-CMFw5Nlj.js";var xt=t(i(),1),Z=n(),Q=t(e(),1),St=Q.createContext(void 0);function Ct(e){let t=Q.useContext(St);if(t===void 0&&!e)throw Error(k(72));return t}function wt(e,t){return t!=null&&!d(t)?0:typeof e==`function`?e():e}function Tt(e,t,n){let r=wt(e,n);return typeof r==`number`?r:r?.[t]}function Et(e){return typeof e==`function`?e():e}function Dt(e,t){return t||e===`click`||e===`mousedown`}function Ot(e){return e?.includes(`mouse`)&&e!==`mousedown`}var kt=Q.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new ce,currentIdRef:{current:null},currentContextRef:{current:null}});function At(e,t){e.current=t.current}function jt(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=Q.useRef(n),a=Q.useRef(n),o=Q.useRef(null),s=Q.useRef(null),c=fe();return q(()=>{if(a.current=n,!o.current){i.current=n;return}i.current={open:Tt(i.current,`open`),close:Tt(n,`close`)}},[n,o,i,a]),(0,Z.jsx)(kt.Provider,{value:Q.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function Mt(e,t={open:!1}){let{open:n}=t,r=`rootStore`in e?e.rootStore:e,i=r.useState(`floatingId`),{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:d}=Q.useContext(kt),[f,p]=Q.useState(!1),m=Q.useRef(n),h=Q.useRef(!1);return q(()=>{m.current=n},[n]),q(()=>()=>{h.current=!0},[]),q(()=>{function e(){h.current||p(!1),l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current,d.clear()}if(a.current&&!n&&a.current===i){if(p(!1),s){let t=i;return d.start(s,()=>{r.select(`open`)||a.current&&a.current!==t||e()}),()=>{(m.current||a.current!==t)&&d.clear()}}e()}},[n,i,a,o,s,c,l,d,r]),q(()=>{if(!n)return;let e=l.current,t=a.current;d.clear(),l.current={onOpenChange:r.setOpen,setIsInstantPhase:p},a.current=i,o.current={open:0,close:Tt(c.current,`close`)},t!==null&&t!==i?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,Y(we))):(p(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,c,l,d]),q(()=>()=>{if(a.current===i){if(l.current=null,!m.current)return;a.current=null,At(o,c),d.clear()}},[l,a,o,i,c,d]),Q.useMemo(()=>({hasProvider:u,delayRef:o,isInstantPhase:f}),[u,o,f])}function Nt(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function Pt(e){return e!=null&&e.clientX!=null}function Ft(e,t={}){let{enabled:n=!0,axis:r=`both`}=t,i=`rootStore`in e?e.rootStore:e,a=i.useState(`open`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.context.dataRef,l=Q.useRef(!1),u=Q.useRef(null),[f,p]=Q.useState(),[m,h]=Q.useState([]),g=J(e=>{i.set(`positionReference`,e)}),_=J((e,t,n)=>{l.current||c.current.openEvent&&!Pt(c.current.openEvent)||i.set(`positionReference`,Nt(n??s,{x:e,y:t,axis:r,dataRef:c,pointerType:f}))}),v=J(e=>{a?u.current||(_(e.clientX,e.clientY,e.currentTarget),h([])):_(e.clientX,e.clientY,e.currentTarget)}),y=d(f)?o:a;Q.useEffect(()=>{if(!n){g(s);return}if(!y)return;function e(){u.current?.(),u.current=null}let t=W(o);function r(t){X(o,ie(t))?e():_(t.clientX,t.clientY)}return!c.current.openEvent||Pt(c.current.openEvent)?u.current=G(t,`mousemove`,r):g(s),e},[y,n,o,c,s,i,_,g,m]),Q.useEffect(()=>()=>{i.set(`positionReference`,null)},[i]),Q.useEffect(()=>{n&&!o&&(l.current=!1)},[n,o]),Q.useEffect(()=>{!n&&a&&(l.current=!0)},[n,a]);let b=Q.useMemo(()=>{function e(e){p(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:v,onMouseEnter:v}},[v]);return Q.useMemo(()=>n?{reference:b,trigger:b}:{},[n,b])}function It(e,t,n){let{reference:r,floating:i}=e,a=B(t),o=le(t),s=se(o),c=V(t),l=a===`y`,d=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,p=r[s]/2-i[s]/2,m;switch(c){case`top`:m={x:d,y:r.y-i.height};break;case`bottom`:m={x:d,y:r.y+r.height};break;case`right`:m={x:r.x+r.width,y:f};break;case`left`:m={x:r.x-i.width,y:f};break;default:m={x:r.x,y:r.y}}switch(u(t)){case`start`:m[o]-=p*(n&&l?-1:1);break;case`end`:m[o]+=p*(n&&l?-1:1);break}return m}async function Lt(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:c}=e,{boundary:l=`clippingAncestors`,rootBoundary:u=`viewport`,elementContext:d=`floating`,altBoundary:f=!1,padding:p=0}=z(t,e),m=E(p),h=o[f?d===`floating`?`reference`:`floating`:d],g=s(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(h))??!0?h:h.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:l,rootBoundary:u,strategy:c})),_=d===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,v=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),y=await(i.isElement==null?void 0:i.isElement(v))&&await(i.getScale==null?void 0:i.getScale(v))||{x:1,y:1},b=s(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:_,offsetParent:v,strategy:c}):_);return{top:(g.top-b.top+m.top)/y.y,bottom:(b.bottom-g.bottom+m.bottom)/y.y,left:(g.left-b.left+m.left)/y.x,right:(b.right-g.right+m.right)/y.x}}var Rt=50,zt=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Lt},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=It(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Rt&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=It(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Bt=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=z(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=V(r),_=B(o),v=V(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Ue(o)]:de(o)),x=p!==`none`;!d&&x&&b.push(...O(o,m,p,y));let C=[o,...b],w=await s.detectOverflow(t,h),T=[],E=i.flip?.overflows||[];if(l&&T.push(w[g]),u){let e=S(r,a,y);T.push(w[e[0]],w[e[1]])}if(E=[...E,{placement:r,overflows:T}],!T.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=C[e];if(t&&(!(u===`alignment`&&_!==B(t))||E.every(e=>B(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:E},reset:{placement:t}};let n=E.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=E.filter(e=>{if(x){let t=B(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Vt(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ht(e){return qe.some(t=>e[t]>=0)}var Ut=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=z(e,t);switch(i){case`referenceHidden`:{let e=Vt(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Ht(e)}}}case`escaped`:{let e=Vt(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Ht(e)}}}default:return{}}}}},Wt=new Set([`left`,`top`]);async function Gt(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=V(n),s=u(n),c=B(n)===`y`,l=Wt.has(o)?-1:1,d=a&&c?-1:1,f=z(t,e),{mainAxis:p,crossAxis:m,alignmentAxis:h}=typeof f==`number`?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return s&&typeof h==`number`&&(m=s===`end`?h*-1:h),c?{x:m*d,y:p*l}:{x:p*l,y:m*d}}var Kt=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Gt(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},qt=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=z(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=B(V(i)),p=b(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=w(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=w(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Jt=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=z(e,t),u={x:n,y:r},d=B(i),f=b(d),p=u[f],m=u[d],h=z(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Wt.has(V(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Yt=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=z(e,t),d=await o.detectOverflow(t,l),f=V(i),p=u(i),m=B(i)===`y`,{width:h,height:g}=a.floating,_,v;f===`top`||f===`bottom`?(_=f,v=p===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(v=f,_=p===`end`?`top`:`bottom`);let y=g-d.top-d.bottom,b=h-d.left-d.right,x=te(g-d[_],y),S=te(h-d[v],b),C=!t.middlewareData.shift,w=x,T=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=b),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(w=y),C&&!p){let e=H(d.left,0),t=H(d.right,0),n=H(d.top,0),r=H(d.bottom,0);m?T=h-2*(e!==0||t!==0?e+t:H(d.left,d.right)):w=g-2*(n!==0||r!==0?n+r:H(d.top,d.bottom))}await c({...t,availableWidth:T,availableHeight:w});let E=await o.getDimensions(s.floating);return h!==E.width||g!==E.height?{reset:{rects:!0}}:{}}}};function Xt(e){let t=p(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=R(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Te(n)!==a||Te(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Zt(e){return F(e)?e:e.contextElement}function Qt(e){let t=Zt(e);if(!R(t))return A(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Xt(t),o=(a?Te(n.width):n.width)/r,s=(a?Te(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var $t=A(0);function en(e){let t=W(e);return!it()||!t.visualViewport?$t:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function tn(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==W(e)?!1:t}function nn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Zt(e),o=A(1);t&&(r?F(r)&&(o=Qt(r)):o=Qt(e));let c=tn(a,n,r)?en(a):A(0),l=(i.left+c.x)/o.x,u=(i.top+c.y)/o.y,d=i.width/o.x,f=i.height/o.y;if(a){let e=W(a),t=r&&F(r)?W(r):r,n=e,i=_(n);for(;i&&r&&t!==n;){let e=Qt(i),t=i.getBoundingClientRect(),r=p(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,u*=e.y,d*=e.x,f*=e.y,l+=a,u+=o,n=W(i),i=_(n)}}return s({width:d,height:f,x:l,y:u})}function rn(e,t){let n=L(e).scrollLeft;return t?t.left+n:nn(oe(e)).left+n}function an(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-rn(e,n),y:n.top+t.scrollTop}}function on(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=oe(r),s=t?ne(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=A(1),u=A(0),d=R(r);if((d||!d&&!a)&&((h(r)!==`body`||T(o))&&(c=L(r)),d)){let e=nn(r);l=Qt(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?an(o,c):A(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function sn(e){return Array.from(e.getClientRects())}function cn(e){let t=oe(e),n=L(e),r=e.ownerDocument.body,i=H(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=H(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+rn(e),s=-n.scrollTop;return p(r).direction===`rtl`&&(o+=H(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var ln=25;function un(e,t){let n=W(e),r=oe(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=it();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=rn(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=ln&&(a-=o)}else l<=ln&&(a+=l);return{width:a,height:o,x:s,y:c}}function dn(e,t){let n=nn(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=R(e)?Qt(e):A(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function fn(e,t,n){let r;if(t===`viewport`)r=un(e,n);else if(t===`document`)r=cn(oe(e));else if(F(t))r=dn(t,n);else{let n=en(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return s(r)}function pn(e,t){let n=l(e);return n===t||!F(n)||y(n)?!1:p(n).position===`fixed`||pn(n,t)}function mn(e,t){let n=t.get(e);if(n)return n;let r=Fe(e,[],!1).filter(e=>F(e)&&h(e)!==`body`),i=null,a=p(e).position===`fixed`,o=a?l(e):e;for(;F(o)&&!y(o);){let t=p(o),n=N(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||T(o)&&!n&&pn(e,o))?r=r.filter(e=>e!==o):i=t,o=l(o)}return t.set(e,r),r}function hn(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ne(t)?[]:mn(t,this._c):[].concat(n),r],o=fn(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=fn(t,a[e],i);s=H(n.top,s),c=te(n.right,c),l=te(n.bottom,l),u=H(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function gn(e){let{width:t,height:n}=Xt(e);return{width:t,height:n}}function _n(e,t,n){let r=R(t),i=oe(t),a=n===`fixed`,o=nn(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=A(0);function l(){c.x=rn(i)}if(r||!r&&!a)if((h(t)!==`body`||T(i))&&(s=L(t)),r){let e=nn(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?an(i,s):A(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function vn(e){return p(e).position===`static`}function yn(e,t){if(!R(e)||p(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return oe(e)===n&&(n=n.ownerDocument.body),n}function bn(e,t){let n=W(e);if(ne(e))return n;if(!R(e)){let t=l(e);for(;t&&!y(t);){if(F(t)&&!vn(t))return t;t=l(t)}return n}let r=yn(e,t);for(;r&&j(r)&&vn(r);)r=yn(r,t);return r&&y(r)&&vn(r)&&!N(r)?n:r||$e(e)||n}var xn=async function(e){let t=this.getOffsetParent||bn,n=this.getDimensions,r=await n(e.floating);return{reference:_n(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Sn(e){return p(e).direction===`rtl`}var Cn={convertOffsetParentRelativeRectToViewportRelativeRect:on,getDocumentElement:oe,getClippingRect:hn,getOffsetParent:bn,getElementRects:xn,getClientRects:sn,getDimensions:gn,getScale:Qt,isElement:F,isRTL:Sn};function wn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Tn(e,t){let n=null,r,i=oe(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=rt(d),h=rt(i.clientWidth-(u+f)),g=rt(i.clientHeight-(d+p)),_=rt(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:H(0,te(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!wn(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function En(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Zt(e),u=i||a?[...l?Fe(l):[],...t?Fe(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Tn(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?nn(e):null;c&&g();function g(){let t=nn(e);h&&!wn(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Dn=Kt,On=qt,kn=Bt,An=Yt,jn=Ut,Mn=Jt,Nn=(e,t,n)=>{let r=new Map,i={platform:Cn,...n},a={...i.platform,_c:r};return zt(e,t,{...i,platform:a})},Pn=typeof document<`u`?Q.useLayoutEffect:function(){};function Fn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Fn(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Fn(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function In(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ln(e,t){let n=In(e);return Math.round(t*n)/n}function Rn(e){let t=Q.useRef(e);return Pn(()=>{t.current=e}),t}function zn(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=Q.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=Q.useState(r);Fn(f,r)||p(r);let[m,h]=Q.useState(null),[g,_]=Q.useState(null),v=Q.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=Q.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=Q.useRef(null),C=Q.useRef(null),w=Q.useRef(u),T=c!=null,E=Rn(c),D=Rn(i),O=Rn(l),k=Q.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Nn(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!Fn(w.current,t)&&(w.current=t,xt.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Pn(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=Q.useRef(!1);Pn(()=>(A.current=!0,()=>{A.current=!1}),[]),Pn(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=Q.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=Q.useMemo(()=>({reference:b,floating:x}),[b,x]),N=Q.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=Ln(M.floating,u.x),r=Ln(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...In(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return Q.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var Bn=(e,t)=>{let n=Dn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vn=(e,t)=>{let n=On(e);return{name:n.name,fn:n.fn,options:[e,t]}},Hn=(e,t)=>({fn:Mn(e).fn,options:[e,t]}),Un=(e,t)=>{let n=kn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wn=(e,t)=>{let n=An(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gn=(e,t)=>{let n=jn(e);return{name:n.name,fn:n.fn,options:[e,t]}};function Kn(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=P(),a=g()!=null,o=pe(()=>new re({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Ce,floatingId:i,syncOnly:!1,nested:a})).current;return q(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=F(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function qn(e={}){let{nodeId:t,externalTree:n}=e,r=Kn(e),i=e.rootContext||r,a=i.useState(`referenceElement`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.useState(`open`),l=i.useState(`floatingId`),[u,d]=Q.useState(null),[f,p]=Q.useState(void 0),[h,g]=Q.useState(void 0),_=Q.useRef(null),v=m(n),y=Q.useMemo(()=>({reference:a,floating:o,domReference:s}),[a,o,s]),b=zn({...e,elements:{...y,...u&&{reference:u}}}),x=F(f)?f:null,S=h===void 0?i.state.floatingElement:h;i.useSyncedValue(`referenceElement`,f??null),i.useSyncedValue(`domReferenceElement`,f===void 0?s:x),i.useSyncedValue(`floatingElement`,S);let C=Q.useCallback(e=>{let t=F(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;d(t),b.refs.setReference(t)},[b.refs]),w=Q.useCallback(e=>{(F(e)||e===null)&&(_.current=e,p(e)),(F(b.refs.reference.current)||b.refs.reference.current===null||e!==null&&!F(e))&&b.refs.setReference(e)},[b.refs,p]),T=Q.useCallback(e=>{g(e),b.refs.setFloating(e)},[b.refs]),E=Q.useMemo(()=>({...b.refs,setReference:w,setFloating:T,setPositionReference:C,domReference:_}),[b.refs,w,T,C]),D=Q.useMemo(()=>({...b.elements,domReference:s}),[b.elements,s]),O=Q.useMemo(()=>({...b,dataRef:i.context.dataRef,open:c,onOpenChange:i.setOpen,events:i.context.events,floatingId:l,refs:E,elements:D,nodeId:t,rootStore:i}),[b,E,D,t,i,c,l]);return q(()=>{s&&(_.current=s)},[s]),q(()=>{i.context.dataRef.current.floatingContext=O;let e=v?.nodesRef.current.find(e=>e.id===t);e&&(e.context=O)}),Q.useMemo(()=>({...b,context:O,refs:E,elements:D,rootStore:i}),[b,E,D,O,i])}var Jn=C&&ue;function Yn(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=Q.useRef(!1),c=Q.useRef(null),l=Q.useRef(!0),u=fe();Q.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=W(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&R(e)&&e===be(Be(e))&&(s.current=!0)}function a(){l.current=!0}function o(){l.current=!1}return ve(G(t,`blur`,r),Jn&&G(t,`keydown`,a,!0),Jn&&G(t,`pointerdown`,o,!0))},[i,n]),Q.useEffect(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);F(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let d=Q.useMemo(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=ie(t.nativeEvent);if(F(a)){if(Jn&&!t.relatedTarget){if(!l.current&&!Ze(a))return}else if(!nt(a))return}let o=ge(t.relatedTarget,i.context.triggerElements),{nativeEvent:d,currentTarget:f}=t,p=typeof r==`function`?r():r;if(i.select(`open`)&&o||p===0||p===void 0){i.setOpen(!0,Y(De,d,f));return}u.start(p,()=>{s.current||i.setOpen(!0,Y(De,d,f))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=F(n)&&n.hasAttribute(ee(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=be(Be(e));!n&&t===e||X(o.current.floatingContext?.refs.floating.current,t)||X(e,t)||a||ge(n??t,i.context.triggerElements)||i.setOpen(!1,Y(De,r))})}}},[o,r,i,u]);return Q.useMemo(()=>n?{reference:d,trigger:d}:{},[n,d])}var Xn=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new ce,this.restTimeout=new ce,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},Zn=new WeakMap;function Qn(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&Zn.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),Zn.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function $n(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=Zn.get(n);a&&a!==e&&Qn(a),Qn(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,Zn.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function er(e){let t=e.context.dataRef.current,n=pe(()=>t.hoverInteractionState??Xn.create()).current;return t.hoverInteractionState||=n,x(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function tr(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),{dataRef:l}=a.context,u=m(),d=g(),f=er(a),p=fe(),h=J(()=>Dt(l.current.openEvent?.type,f.interactedInside)),_=J(()=>Ot(l.current.openEvent?.type)),y=J(()=>{Qn(f)});q(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,y())},[o,f,y]),Q.useEffect(()=>y,[y]),q(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&_()&&F(c)&&s){let e=c,t=s,n=Be(s),r=u?.nodesRef.current.find(e=>e.id===d)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=f.pointerEventsScopeElement===t?null:f.pointerEventsScopeElement,a=r===t?null:r;return $n(f,{scopeElement:f.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body,referenceElement:e,floatingElement:t}),()=>{y()}}},[n,o,c,s,f,_,u,d,y]),Q.useEffect(()=>{if(!n)return;function e(){return!!(u&&d&&v(u.nodesRef.current,d).length>0)}function t(e){let t=Tt(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,Y(K,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=ie(e);if(!ke(t)){f.interactedInside=!1;return}f.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function c(){f.openChangeTimeout.clear(),p.clear(),u?.events.off(`floating.closed`,g),y()}function m(n){if(e()&&u){u.events.on(`floating.closed`,g);return}if(ge(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(u&&r&&F(o)&&v(u.nodesRef.current,r,!1).some(e=>X(e.context?.elements.floating,o)))){if(f.handler){f.handler(n);return}y(),_()&&!h()&&t(n)}}function g(t){!u||!d||e()||p.start(0,()=>{u.events.off(`floating.closed`,g),a.setOpen(!1,Y(K,t)),u.events.emit(`floating.closed`,t)})}let b=s;return ve(b&&G(b,`mouseenter`,c),b&&G(b,`mouseleave`,m),b&&G(b,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,g)})},[n,s,a,l,r,i,_,h,y,f,u,d,p])}var nr={current:null};function rr(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=nr,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:f,isClosing:p,shouldOpen:h}=t,g=`rootStore`in e?e.rootStore:e,{dataRef:_,events:v}=g.context,y=m(l),b=er(g),x=Q.useRef(!1),S=U(i),C=U(r),w=U(o),T=U(n),E=U(h),D=U(p),O=J(()=>Dt(_.current.openEvent?.type,b.interactedInside)),k=J(()=>E.current?.()!==!1),A=J((e,t,n)=>{let r=g.context.triggerElements;if(r.hasElement(t))return!e||!X(e,t);if(!F(n))return!1;let i=n;return r.hasMatchingElement(e=>X(e,i))&&(!e||!X(e,i))}),j=J(()=>{b.handler&&=(Be(g.select(`domReferenceElement`)).removeEventListener(`mousemove`,b.handler),void 0)}),M=J(()=>{Qn(b)});return u&&(b.handleCloseOptions=S.current?.__options),Q.useEffect(()=>j,[j]),Q.useEffect(()=>{if(!n)return;function e(e){e.open?x.current=!1:(x.current=e.reason===K,j(),b.openChangeTimeout.clear(),b.restTimeout.clear(),b.blockMouseMove=!0,b.restTimeoutPending=!1)}return v.on(`openchange`,e),()=>{v.off(`openchange`,e)}},[n,v,b,j]),Q.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=Tt(C.current,`close`,b.pointerType);n?b.openChangeTimeout.start(n,()=>{g.setOpen(!1,Y(K,e)),y?.events.emit(`floating.closed`,e)}):t&&(b.openChangeTimeout.clear(),g.setOpen(!1,Y(K,e)),y?.events.emit(`floating.closed`,e))}let t=c.current??(u?g.select(`domReferenceElement`):null);if(!F(t))return;function r(e){if(b.openChangeTimeout.clear(),b.blockMouseMove=!1,a&&!d(b.pointerType))return;let t=Et(w.current),n=Tt(C.current,`open`,b.pointerType),r=ie(e),i=e.currentTarget??null,o=g.select(`domReferenceElement`),s=i;if(F(r)&&!g.context.triggerElements.hasElement(r)){for(let e of g.context.triggerElements.elements())if(X(e,r)){s=e;break}}F(i)&&F(o)&&!g.context.triggerElements.hasElement(i)&&X(i,o)&&(s=o);let c=s==null?!1:A(o,s,r),l=g.select(`open`),u=D.current?.()??g.select(`transitionStatus`)===`ending`,f=!l&&u&&x.current,p=!c&&F(s)&&F(o)&&X(o,s)&&f,m=t>0&&!n,h=c&&(l||f)||p,_=!l||c;if(h){k()&&g.setOpen(!0,Y(K,e,s));return}m||(n?b.openChangeTimeout.start(n,()=>{_&&k()&&g.setOpen(!0,Y(K,e,s))}):_&&k()&&g.setOpen(!0,Y(K,e,s)))}function i(t){if(O()){M();return}j();let n=Be(g.select(`domReferenceElement`));b.restTimeout.clear(),b.restTimeoutPending=!1;let r=_.current.floatingContext??f?.();if(!ge(t.relatedTarget,g.context.triggerElements)){if(S.current&&r){g.select(`open`)||b.openChangeTimeout.clear();let i=c.current;b.handler=S.current({...r,tree:y,x:t.clientX,y:t.clientY,onClose(){M(),j(),T.current&&!O()&&i===g.select(`domReferenceElement`)&&e(t,!0)}}),n.addEventListener(`mousemove`,b.handler),b.handler(t);return}(b.pointerType!==`touch`||!X(g.select(`floatingElement`),t.relatedTarget))&&e(t)}}return s?ve(G(t,`mousemove`,r,{once:!0}),G(t,`mouseenter`,r),G(t,`mouseleave`,i)):ve(G(t,`mouseenter`,r),G(t,`mouseleave`,i))},[j,M,_,C,g,n,S,b,u,A,O,a,s,w,c,y,T,f,D,k]),Q.useMemo(()=>{if(!n)return;function e(e){b.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=g.select(`domReferenceElement`),i=g.select(`open`),o=A(r,n,e.target);if(a&&!d(b.pointerType))return;if(i&&o&&b.handleCloseOptions?.blockPointerEvents){let e=g.select(`floatingElement`);e&&$n(b,{scopeElement:b.handleCloseOptions?.getScope?.()??n.ownerDocument.body,referenceElement:n,floatingElement:e})}let s=Et(w.current);if(i&&!o||s===0||!o&&b.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;b.restTimeout.clear();function c(){if(b.restTimeoutPending=!1,O())return;let e=g.select(`open`);!b.blockMouseMove&&(!e||o)&&k()&&g.setOpen(!0,Y(K,t,n))}b.pointerType===`touch`?xt.flushSync(()=>{c()}):o&&i?c():(b.restTimeoutPending=!0,b.restTimeout.start(s,c))}}},[n,b,O,A,a,g,w,k])}var ir=.1,ar=ir*ir,$=.5;function or(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function sr(e,t,n,r,i,a,o,s,c,l){let u=!1;return or(e,t,n,r,i,a)&&(u=!u),or(e,t,i,a,o,s)&&(u=!u),or(e,t,o,s,c,l)&&(u=!u),or(e,t,c,l,n,r)&&(u=!u),u}function cr(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function lr(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function ur(e={}){let{blockPointerEvents:t=!1}=e,n=new ce,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*ar;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=ie(r),g=r.type===`mouseleave`,_=X(u,h),y=X(a,h);if(_&&(l=!0,!g))return;if(y&&(l=!1,!g)){l=!0;return}if(g&&F(r.relatedTarget)&&X(u,r.relatedTarget))return;function b(){return!!(s&&v(s.nodesRef.current,o).length>0)}function x(){b()||m()}if(b())return;let S=a.getBoundingClientRect(),C=u.getBoundingClientRect(),w=e>C.right-C.width/2,T=t>C.bottom-C.height/2,E=C.width>S.width,D=C.height>S.height,O=(E?S:C).left,k=(E?S:C).right,A=(D?S:C).top,j=(D?S:C).bottom;if(c===`top`&&t>=S.bottom-1||c===`bottom`&&t<=S.top+1||c===`left`&&e>=S.right-1||c===`right`&&e<=S.left+1){x();return}let M=!1;switch(c){case`top`:M=lr(d,f,O,S.top+1,k,C.bottom-1);break;case`bottom`:M=lr(d,f,O,C.top+1,k,S.bottom-1);break;case`left`:M=lr(d,f,C.right-1,j,S.left+1,A);break;case`right`:M=lr(d,f,S.right-1,j,C.left+1,A);break;default:}if(M)return;if(l&&!cr(d,f,S)){x();return}if(!g&&p(d,f)){x();return}let N=!1;switch(c){case`top`:{let n=E?$/2:$*4,r=E||w?e+n:e-n,i=E?e-n:w?e+n:e-n,a=t+$+1,o=w||E?C.bottom-$:C.top,s=w?E?C.bottom-$:C.top:C.bottom-$;N=sr(d,f,r,a,i,a,C.left,o,C.right,s);break}case`bottom`:{let n=E?$/2:$*4,r=E||w?e+n:e-n,i=E?e-n:w?e+n:e-n,a=t-$,o=w||E?C.top+$:C.bottom,s=w?E?C.top+$:C.bottom:C.top+$;N=sr(d,f,r,a,i,a,C.left,o,C.right,s);break}case`left`:{let n=D?$/2:$*4,r=D||T?t+n:t-n,i=D?t-n:T?t+n:t-n,a=e+$+1,o=T||D?C.right-$:C.left,s=T?D?C.right-$:C.left:C.right-$;N=sr(d,f,o,C.top,s,C.bottom,a,r,a,i);break}case`right`:{let n=D?$/2:$*4,r=D||T?t+n:t-n,i=D?t-n:T?t+n:t-n,a=e-$,o=T||D?C.left+$:C.right,s=T?D?C.left+$:C.right:C.left+$;N=sr(d,f,a,r,a,i,o,C.top,s,C.bottom);break}default:}N?l||n.start(40,x):x()}};return r.__options={...e,blockPointerEvents:t},r}var dr={...Je,disabled:Qe(e=>e.disabled),instantType:Qe(e=>e.instantType),isInstantPhase:Qe(e=>e.isInstantPhase),trackCursorAxis:Qe(e=>e.trackCursorAxis),disableHoverablePopup:Qe(e=>e.disableHoverablePopup),lastOpenChangeReason:Qe(e=>e.openChangeReason),closeOnClick:Qe(e=>e.closeOnClick),closeDelay:Qe(e=>e.closeDelay),hasViewport:Qe(e=>e.hasViewport)},fr=class e extends f{constructor(e,t,n=!1){let r=new Ce,i={...pr(),...e};i.floatingRootContext=Ie(r,t,n),super(i,{popupRef:Q.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:r},dr)}setOpen=(e,t)=>{He(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,Y(Re,e))}static useStore(t,n){return Xe(t,(t,r)=>new e(n,t,r)).store}};function pr(){return{...xe(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}var mr=D(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=fr.useStore(l?.store,{open:n,openProp:r,activeTriggerId:d,triggerIdProp:u});Ae(p,r,n,d),p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`mounted`),v=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i}),p.useSyncedValue(`disabled`,t),Le(p,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:y,transitionStatus:b}=Oe(h,p),x=p.useState(`isInstantPhase`),S=p.useState(`instantType`),C=p.useState(`lastOpenChangeReason`),w=Q.useRef(null);q(()=>{m&&t&&p.setOpen(!1,Y(Se))},[m,t,p]),q(()=>{b===`ending`&&C===`none`||b!==`ending`&&x?(S!==`delay`&&(w.current=S),p.set(`instantType`,`delay`)):w.current!==null&&(p.set(`instantType`,w.current),w.current=null)},[b,x,C,S,p]),q(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]);let T=Q.useCallback(()=>{p.setOpen(!1,Y(Ye))},[p]);Q.useImperativeHandle(o,()=>({unmount:y,close:T}),[y,T]);let E=h||_||!t&&a!==`none`;return(0,Z.jsxs)(St.Provider,{value:p,children:[E&&(0,Z.jsx)(hr,{store:p,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:v}):f]})});function hr({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=ae(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=Ft(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n});return he(e,{activeTriggerProps:Q.useMemo(()=>M(a.reference,i.reference),[a.reference,i.reference]),inactiveTriggerProps:Q.useMemo(()=>M(a.trigger,i.trigger),[a.trigger,i.trigger]),popupProps:Q.useMemo(()=>M(Ee,a.floating,i.floating),[a.floating,i.floating])}),null}var gr=Q.createContext(void 0);function _r(){return Q.useContext(gr)}var vr=function(e){return e[e.popupOpen=_e.popupOpen]=`popupOpen`,e.triggerDisabled=`data-trigger-disabled`,e}({}),yr=`data-base-ui-tooltip-trigger`;function br(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;e<t.length;e+=1){let n=t[e];if(F(n))return n}}let t=e.target;return F(t)?t:null}function xr(e){let t=e;for(;t;){if(t.hasAttribute(yr))return t;let e=t.parentElement;if(e){t=e;continue}let n=t.getRootNode();t=`host`in n&&F(n.host)?n.host:null}return null}var Sr=me(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:u,id:f,...p}=e,m=Ct(!0),h=a?.store??m;if(!h)throw Error(k(82));let g=Me(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`isOpenedByTrigger`,g),y=h.useState(`floatingRootContext`),b=Q.useRef(null),x=c??600,S=u??0,{registerTrigger:C,isMountedByThisTrigger:w}=tt(g,b,h,{payload:o,closeOnClick:l,closeDelay:S}),T=_r(),{delayRef:E,isInstantPhase:D,hasProvider:O}=Mt(y,{open:v}),A=er(y);h.useSyncedValue(`isInstantPhase`,D);let j=h.useState(`disabled`),M=s??j,N=U(M),P=h.useState(`trackCursorAxis`),F=h.useState(`disableHoverablePopup`),I=Q.useRef(!1),L=fe(),ee=Q.useRef(void 0);function R(){let e=T?.delay,t=typeof E.current==`object`?E.current.open:void 0,n=x;return O&&(n=t===0?0:c??e??x),n}function te(e){let t=b.current;if(!t||!e)return!1;let n=xr(e);return n!==null&&n!==t&&X(t,n)}function z(e){let t=te(e);return I.current=t,t&&(A.openChangeTimeout.clear(),A.restTimeout.clear(),A.restTimeoutPending=!1,L.clear()),t}let ne=rr(y,{enabled:!M,mouseOnly:!0,move:!1,handleClose:!F&&P!==`both`?ur():null,restMs:R,delay(){let e=typeof E.current==`object`?E.current.close:void 0,t=S;return u==null&&O&&(t=e),{close:t}},triggerElementRef:b,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`,shouldOpen(){return!I.current}}),re=Yn(y,{enabled:!M}).reference,ie=e=>{let t=I.current,n=br(e),r=z(n),i=b.current,a=i&&n&&X(i,n);if(r&&h.select(`open`)&&h.select(`lastOpenChangeReason`)===`trigger-hover`){h.setOpen(!1,Y(K,e));return}if(t&&!r&&a&&!N.current&&!h.select(`open`)&&i&&d(ee.current)){let t=()=>{!I.current&&!N.current&&!h.select(`open`)&&h.setOpen(!0,Y(K,e,i))},n=R();n===0?(L.clear(),t()):L.start(n,t)}},ae=h.useState(`triggerProps`,w);return Ne(`button`,e,{state:{open:v},ref:[t,C,b],props:[ne,re,w||P!==`none`?ae:void 0,{onMouseOver(e){ie(e.nativeEvent)},onFocus(e){te(br(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){I.current=!1,L.clear(),ee.current=void 0},onPointerEnter(e){ee.current=e.pointerType},onPointerDown(e){ee.current=e.pointerType,h.set(`closeOnClick`,l),l&&!h.select(`open`)&&h.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!h.select(`open`)&&h.cancelPendingOpen(e.nativeEvent)},id:g,[vr.triggerDisabled]:M?``:void 0,[yr]:M?void 0:``},p],stateAttributesMapping:Ge})}),Cr=Q.createContext(void 0);function wr(){let e=Q.useContext(Cr);if(e===void 0)throw Error(k(70));return e}var Tr=Q.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{portalNode:c,portalSubtree:l}=I({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,Z.jsxs)(Q.Fragment,{children:[l,c&&xt.createPortal(n,c)]})}),Er=Q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return Ct().useState(`mounted`)||n?(0,Z.jsx)(Cr.Provider,{value:n,children:(0,Z.jsx)(Tr,{ref:t,...r})}):null}),Dr=Q.createContext(void 0);function Or(){let e=Q.useContext(Dr);if(e===void 0)throw Error(k(71));return e}var kr=Q.createContext(void 0);function Ar(){return Q.useContext(kr)?.direction??`ltr`}var jr=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:d=0,offsetParent:f=`real`}=z(e,t)||{};if(l==null)return{};let p=E(d),m={x:n,y:r},h=le(i),g=se(h),_=await o.getDimensions(l),v=h===`y`,y=v?`top`:`left`,b=v?`bottom`:`right`,x=v?`clientHeight`:`clientWidth`,S=a.reference[g]+a.reference[h]-m[h]-a.floating[g],C=m[h]-a.reference[h],T=f===`real`?await o.getOffsetParent?.(l):s.floating,D=s.floating[x]||a.floating[g];(!D||!await o.isElement?.(T))&&(D=s.floating[x]||a.floating[g]);let O=S/2-C/2,k=D/2-_[g]/2-1,A=Math.min(p[y],k),j=Math.min(p[b],k),M=A,N=D-_[g]-j,P=D/2-_[g]/2+O,F=w(M,P,N),I=!c.arrow&&u(i)!=null&&P!==F&&a.reference[g]/2-(P<M?A:j)-_[g]/2<0,L=I?P<M?P-M:P-N:0;return{[h]:m[h]+L,data:{[h]:F,centerOffset:P-F-L,...I&&{alignmentOffset:L}},reset:I}}}),Mr=(e,t)=>({...jr(e),options:[e,t]}),Nr=Gn().fn,Pr={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await Nr(e)).data?.referenceHidden||a}}}},Fr={sideX:`left`,sideY:`top`},Ir={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=W(i),l=c.getComputedStyle(i);if(!(l.transitionDuration!==`0s`&&l.transitionDuration!==``))return{x:t,y:n,data:Fr};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=Be(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=V(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:Fr.sideX,g=f===`top`?`bottom`:Fr.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}};function Lr(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function Rr(e,t,n){let{rects:r,placement:i}=e;return{side:Lr(t,V(i),n),align:u(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function zr(e){let{anchor:t,positionMethod:n=`absolute`,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,collisionBoundary:s,collisionPadding:c=5,sticky:l=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shiftCrossAxis:v=!1,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,[C,w]=Q.useState(null);!g&&C!==null&&w(null);let T=_.side||`flip`,E=_.align||`flip`,D=_.fallbackAxisSide||`end`,O=typeof t==`function`?t:void 0,k=J(O),A=O?k:t,j=U(t),M=U(g),N=Ar()===`rtl`,P=C||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":N?`left`:`right`,"inline-start":N?`right`:`left`}[r],F=a===`center`?P:`${P}-${a}`,I=c,L=+(r===`bottom`),ee=+(r===`top`),R=+(r===`right`),te=+(r===`left`);typeof I==`number`?I={top:I+L,right:I+te,bottom:I+ee,left:I+R}:I&&={top:(I.top||0)+L,right:(I.right||0)+te,bottom:(I.bottom||0)+ee,left:(I.left||0)+R};let z={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:I},ne=Q.useRef(null),re=U(i),ie=U(o),ae=typeof i==`function`?0:i,oe=typeof o==`function`?0:o,se=[];p&&se.push(p),se.push(Bn(e=>{let t=Rr(e,r,N),n=typeof re.current==`function`?re.current(t):re.current,i=typeof ie.current==`function`?ie.current(t):ie.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[ae,oe,N,r]));let ce=E===`none`&&T!==`shift`,le=!ce&&(l||v||T===`shift`),ue=T===`none`?null:Un({...z,padding:{top:I.top+1,right:I.right+1,bottom:I.bottom+1,left:I.left+1},mainAxis:!v&&T===`flip`,crossAxis:E===`flip`?`alignment`:!1,fallbackAxisSideDirection:D}),de=ce?null:Vn(e=>{let t=Be(e.elements.floating).documentElement;return{...z,rootBoundary:v?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:E!==`none`,crossAxis:le,limiter:l||v?void 0:Hn(e=>{if(!ne.current)return{};let{width:t,height:n}=ne.current.getBoundingClientRect(),r=B(V(e.placement)),i=r===`y`?t:n,a=r===`y`?I.left+I.right:I.top+I.bottom;return{offset:i/2+a/2}})}},[z,l,v,I,E]);T===`shift`||E===`shift`||a===`center`?se.push(de,ue):se.push(ue,de),se.push(Wn({...z,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!M.current)return;let i=e.style;i.setProperty(`--available-width`,`${t}px`),i.setProperty(`--available-height`,`${n}px`);let a=W(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),Mr(e=>({element:ne.current||Be(e.elements.floating).createElement(`div`),padding:d,offsetParent:`floating`}),[d]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=V(a),l=B(c),u=ne.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof i==`function`?i(Rr(e,r,N)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,le&&l===`y`&&b?S:x),{}}},Pr,b),q(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let fe=Q.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:pe,elements:me,x:H,y:he,middlewareData:ge,update:_e,placement:ve,context:ye,isPositioned:be,floatingStyles:xe}=qn({rootContext:h,open:m?g:void 0,placement:F,middleware:se,strategy:n,whileElementsMounted:m?void 0:(...e)=>En(...e,fe),nodeId:y,externalTree:S}),{sideX:Se,sideY:Ce}=ge.adaptiveOrigin||Fr,we=be?n:`fixed`,Te=Q.useMemo(()=>{let e=b?{position:we,[Se]:H,[Ce]:he}:{position:we,...xe};return be||(e.opacity=0),e},[b,we,Se,H,Ce,he,xe,be]),Ee=Q.useRef(null);q(()=>{if(!g)return;let e=j.current,t=typeof e==`function`?e():e,n=(Br(t)?t.current:t)||null;n!==Ee.current&&(pe.setPositionReference(n),Ee.current=n)},[g,pe,A,j]),Q.useEffect(()=>{if(!g)return;let e=j.current;typeof e!=`function`&&Br(e)&&e.current!==Ee.current&&(pe.setPositionReference(e.current),Ee.current=e.current)},[g,pe,A,j]),Q.useEffect(()=>{if(m&&g&&me.reference&&me.floating)return En(me.reference,me.floating,_e,fe)},[m,g,me,_e,fe]);let De=V(ve),Oe=Lr(r,De,N),ke=u(ve)||`center`,Ae=!!ge.hide?.referenceHidden;q(()=>{x&&g&&be&&w(De)},[x,g,be,De]);let je=Q.useMemo(()=>({position:`absolute`,top:ge.arrow?.y,left:ge.arrow?.x}),[ge.arrow]),Me=ge.arrow?.centerOffset!==0;return Q.useMemo(()=>({positionerStyles:Te,arrowStyles:je,arrowRef:ne,arrowUncentered:Me,side:Oe,align:ke,physicalSide:De,anchorHidden:Ae,refs:pe,context:ye,isPositioned:be,update:_e}),[Te,je,ne,Me,Oe,ke,De,Ae,pe,ye,be,_e])}function Br(e){return e!=null&&`current`in e}function Vr(e){return e===`starting`?Pe:je}function Hr(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),Ne(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},Vr(r),i],stateAttributesMapping:Ve})}var Ur=Q.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:l=0,alignOffset:u=0,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:h=!1,collisionAvoidance:g=c,style:_,...v}=e,y=Ct(),b=wr(),x=y.useState(`open`),S=y.useState(`mounted`),C=y.useState(`trackCursorAxis`),w=y.useState(`disableHoverablePopup`),T=y.useState(`floatingRootContext`),E=y.useState(`instantType`),D=y.useState(`transitionStatus`),O=zr({anchor:i,positionMethod:a,floatingRootContext:T,mounted:S,side:o,sideOffset:l,align:s,alignOffset:u,collisionBoundary:d,collisionPadding:f,sticky:m,arrowPadding:p,disableAnchorTracking:h,keepMounted:b,collisionAvoidance:g,adaptiveOrigin:y.useState(`hasViewport`)?Ir:void 0}),k=Hr(e,Q.useMemo(()=>({open:x,side:O.side,align:O.align,anchorHidden:O.anchorHidden,instant:C===`none`?E:`tracking-cursor`}),[x,O.side,O.align,O.anchorHidden,C,E]),{styles:O.positionerStyles,transitionStatus:D,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!S,inert:!x||C===`both`||w});return(0,Z.jsx)(Dr.Provider,{value:O,children:k})}),Wr={...Ve,...et},Gr=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Ct(),{side:s,align:c}=Or(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`disabled`),h=o.useState(`closeDelay`);ye({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),tr(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return Ne(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[f,Vr(d),a],stateAttributesMapping:Wr})}),Kr=o({method:`GET`}).handler(r(`aa46310016bb8a58b273a648ffd498c87f1f450d12827e30110a3b83ba6a27d9`)),qr=o({method:`POST`}).handler(r(`ed679b4e1e05e903a5d4ba4a70d9b9d883991ab22ed59b4d2d69078941818415`)),Jr=o({method:`GET`}).handler(r(`169566e7637a22599b4eb32ee3775574e99677406922bbef7482a102036c33dd`)),Yr=o({method:`POST`}).handler(r(`27d7eba0b6a2257949392fdd56057275a5c5366484ae01faf3b5897a225ecd83`)),Xr=o({method:`POST`}).handler(r(`a6384dc7154d9930422d29396f5de64b3ac69c62ad3824bc4a22d745fc07b293`));function Zr(e,t){let n=new Set,r=[];for(let i of[...e,...t])n.has(i.id)||(n.add(i.id),r.push(i));return r.sort((e,t)=>e.ts<t.ts?-1:+(e.ts>t.ts)),r}var Qr=16,$r=`rounded-[4px]`,ei=`h-5 w-[18px] shrink-0 ${$r}`;function ti({run:e,onClick:t}){let n=e.error||e.message||``,r=e.durationMs?` · ${_t(e.durationMs)}`:``;return(0,Z.jsxs)(mr,{children:[(0,Z.jsx)(Sr,{render:(0,Z.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),t()},"aria-label":ct(e),className:`${ei} cursor-pointer transition-opacity hover:opacity-70`,style:{background:vt(e),opacity:ot(e),...e.running?dt:{}}})}),(0,Z.jsx)(Er,{children:(0,Z.jsx)(Ur,{sideOffset:8,children:(0,Z.jsxs)(Gr,{className:`glass-strong pointer-events-none max-w-[340px] rounded-control px-3.5 py-2.5 text-meta leading-snug text-primary`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,Z.jsx)(`span`,{className:`size-2 shrink-0 rounded-[2px]`,style:{background:vt(e)}}),ct(e),(0,Z.jsxs)(`span`,{className:`ml-auto whitespace-nowrap pl-3 font-mono text-caption font-normal text-secondary`,children:[lt(e.ts),r]})]}),n&&(0,Z.jsx)(`div`,{className:`mt-1.5 max-h-[150px] overflow-hidden whitespace-pre-wrap ${e.error?`text-accent`:`text-secondary`}`,children:n})]})})})]})}function ni({count:e,onClick:t,loading:n}){return e?(0,Z.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),t()},className:`flex h-5 w-[18px] shrink-0 items-center justify-center overflow-hidden border border-wire px-0 font-mono text-[9px] leading-none text-disabled transition-colors hover:border-display hover:text-primary ${$r} ${n?`animate-pulse`:`cursor-pointer`}`,title:`${e} more - click to reveal`,children:n?`…`:e}):null}function ri({job:e,runs:t,total:n,onLoadMore:r,onPickRun:i}){let a=t,o=e.enabled,s=a.length,c=Math.max(0,n-s),l=yt(),[u,d]=(0,Q.useState)(-1),[f,p]=(0,Q.useState)(!1),m=Math.max(0,s-16),h=u<0?m:Math.min(u,m),g=Math.min(h+16,s),_=a.slice(h,g),v=c+h,y=s-g,b=y===0,x=async()=>{let e=h-Qr;if(e<0&&c>0&&!f){p(!0);let e=await r().catch(()=>0);p(!1),d(Math.max(0,h+e-Qr));return}d(Math.max(0,e))},S=()=>{let e=h+Qr;d(e>=m?-1:e)},C=!!(e.running||e.queued)&&b,w=b&&o&&!!e.nextRun&&!C;return(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-[3px] overflow-x-auto`,children:[(0,Z.jsx)(ni,{count:v,onClick:x,loading:f}),_.map(e=>(0,Z.jsx)(ti,{run:e,onClick:()=>i(e)},e.id)),w?(0,Z.jsxs)(`div`,{className:`ml-1 flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`w-12 border-t border-dashed border-wire`}),(0,Z.jsx)(`span`,{className:`size-[11px] shrink-0 rounded-full border border-wire`,title:l?`Next scheduled run · ${lt(e.nextRun)}`:void 0}),(0,Z.jsx)(`span`,{className:`text-caption text-disabled`,children:l?st(e.nextRun):``})]}):!b&&(0,Z.jsx)(ni,{count:y,onClick:S})]})}function ii(e,t,n=Date.now()){let r=t?Date.parse(t):NaN;if(!Number.isFinite(r))return`offline`;let i=n-r;return e&&i<3e4?`online`:i<216e5?`asleep`:`offline`}function ai(e){let t=/^\s*v?(\d+)\.(\d+)\.(\d+)/.exec(e);return t?[Number(t[1]),Number(t[2]),Number(t[3])]:null}function oi(e){return/^\s*v?\d+\.\d+\.\d+-/.test(e)}function si(e,t){if(!e||!t)return!1;let n=ai(e),r=ai(t);if(!n||!r)return!1;for(let e=0;e<3;e++){let t=n[e],i=r[e];if(t<i)return!0;if(t>i)return!1}return oi(e)&&!oi(t)}function ci(e,t,n,r){let i=`${n} daemon start --server-url ${e} --connect-key ${t}`;return r?i:`npm install -g @kky42/pievo@latest && ${i}`}function li(e,t){let n=`${e} daemon restart`;return t?n:`npm install -g @kky42/pievo@latest && ${n}`}function ui(e,t,n){return ci(typeof window<`u`?window.location.origin:`http://127.0.0.1:3000`,e,t,n)}function di({text:e}){let[t,n]=(0,Q.useState)(!1);return(0,Z.jsx)(`button`,{className:mt,onClick:()=>{navigator.clipboard?.writeText(e),n(!0),setTimeout(()=>n(!1),1400)},children:t?`Copied ✓`:`Copy`})}function fi({open:e,onClose:t,teamId:n}){let[r,i]=(0,Q.useState)([]),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{if(!e){h(null);return}let t=!0;return _(null),y(!1),a().then(e=>{t&&_(e)}).catch(()=>{t&&y(!0)}),()=>{t=!1}},[e]);let b=(0,Q.useCallback)(async()=>{try{i(await Kr({data:n}))}catch{}},[n]),x=(0,Q.useRef)(e);x.current=e,(0,Q.useEffect)(()=>{if(!e||o)return;b();let t=setInterval(()=>x.current&&void b(),3e3);return()=>clearInterval(t)},[e,o,b]),(0,Q.useEffect)(()=>{if(!o)return;let e=!0,t=async()=>{let t=await Jr({data:o.id}).catch(()=>void 0);!e||t===void 0||(l(t),t?.online&&t.hostname&&d(e=>e||t.hostname||``))};t();let n=setInterval(t,2e3);return()=>{e=!1,clearInterval(n)}},[o]);async function S(){p(!0),h(null);try{let e=await qr({data:n});if(`error`in e){h(e.error);return}l(null),d(``),s(e)}finally{p(!1)}}async function C(){o&&await Xr({data:o.id}),s(null),l(null),await b()}async function w(){o&&u.trim()&&await Yr({data:{id:o.id,name:u.trim()}}),s(null),l(null),await b()}async function T(e){h(null);let t=await Xr({data:e});if(!t.ok){h(t.error??`Could not delete this machine.`),await b();return}await b()}let E=!!c?.online;return o?(0,Z.jsxs)(Ke,{open:e,onClose:C,children:[(0,Z.jsx)(ze,{title:E?`Computer connected`:`Connect computer`}),E?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`mt-5 flex items-center gap-3 rounded-control border border-hairline bg-success-soft px-4 py-3`,children:[(0,Z.jsx)(`span`,{className:`text-xl text-success`,children:`✓`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-[15px] font-medium text-display`,children:`Computer connected successfully!`}),(0,Z.jsxs)(`div`,{className:`text-label text-secondary`,children:[c?.hostname??`unknown`,c?.platform?` - ${c.platform} ${c.arch??``}`:``]})]})]}),(0,Z.jsxs)(`div`,{className:`mt-5`,children:[(0,Z.jsx)(`label`,{className:pt,children:`Computer name`}),(0,Z.jsx)(`input`,{className:ht,value:u,onChange:e=>d(e.target.value),placeholder:c?.hostname??`My computer`}),(0,Z.jsx)(`div`,{className:`mt-1 text-label text-secondary`,children:`A friendly name for this computer.`})]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`mt-5 text-body font-medium text-display`,children:`Run this command on your computer to connect:`}),g?(0,Z.jsxs)(`div`,{className:`mt-2 flex items-start gap-2`,children:[(0,Z.jsx)(`pre`,{className:`flex-1 overflow-x-auto whitespace-pre-wrap break-all rounded-control bg-display p-4 font-mono text-label leading-relaxed text-paper`,children:ui(o.token,g.pievoCli,g.customCli)}),(0,Z.jsx)(di,{text:ui(o.token,g.pievoCli,g.customCli)})]}):(0,Z.jsx)(`div`,{className:`mt-2 text-body text-secondary`,children:v?`Could not load the connection command. Close and try again.`:`Loading connection command…`}),(0,Z.jsxs)(`div`,{className:`mt-4 flex items-center gap-2.5 rounded-control border border-hairline bg-warn-soft px-4 py-3`,children:[(0,Z.jsx)(`span`,{className:`inline-block h-2.5 w-2.5 animate-pulse rounded-full bg-rubik-orange`}),(0,Z.jsx)(`span`,{className:`text-[14px] font-medium text-warn`,children:`Waiting for computer to connect…`})]})]}),(0,Z.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,Z.jsx)(`button`,{className:mt,onClick:()=>void C(),children:`Cancel`}),(0,Z.jsx)(`button`,{className:ft,disabled:!E||!u.trim(),onClick:()=>void w(),children:`Done`})]})]}):(0,Z.jsxs)(Ke,{open:e,onClose:t,children:[(0,Z.jsx)(ze,{title:`Machines`,sub:`Each machine runs a pievo daemon that executes your loops via your local coding agent.`}),(0,Z.jsx)(We,{children:`Connected machines`}),m&&(0,Z.jsx)(gt,{message:m,onDismiss:()=>h(null)}),r.length===0&&(0,Z.jsx)(`div`,{className:`py-3 text-body text-secondary`,children:`No machines yet.`}),(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2`,children:r.map(e=>{let t=ii(e.online,e.lastSeen),n=t===`online`?`bg-rubik-green`:t===`asleep`?`bg-rubik-yellow`:`bg-disabled`,r=t===`online`?`online`:t===`asleep`?`asleep${e.lastSeen?` · seen ${at(e.lastSeen)}`:``}`:e.lastSeen?`offline · seen ${at(e.lastSeen)}`:`offline`;return(0,Z.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-control border border-hairline bg-surface px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,Z.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full ${n}`,title:t}),(0,Z.jsx)(`span`,{className:`text-[15px] font-medium text-display`,children:e.name}),(0,Z.jsxs)(`span`,{className:`text-label text-secondary`,children:[r,e.platform?` · ${e.platform} ${e.arch??``}`:``,e.loopCount>0?` · ${e.loopCount} loop${e.loopCount===1?``:`s`}`:``]})]}),(0,Z.jsx)(`button`,{className:ut,disabled:e.loopCount>0,title:e.loopCount>0?`Delete its loops first`:void 0,onClick:()=>void T(e.id),children:`Delete`})]}),(0,Z.jsx)(`div`,{className:`text-label text-secondary`,children:bt(e.daemonProtocol).label}),!bt(e.daemonProtocol).supported&&(0,Z.jsx)(`div`,{className:`text-label text-accent`,children:`Daemon upgrade required to stop a running process`}),!e.online&&!e.token&&(0,Z.jsx)(`div`,{className:`text-label text-secondary`,children:`Reconnect command available from the machine owner's account.`}),!e.online&&e.token&&!g&&(0,Z.jsx)(`div`,{className:`text-label text-secondary`,children:v?`Could not load the reconnect command. Close and try again.`:`Loading reconnect command…`}),!e.online&&e.token&&g&&(0,Z.jsxs)(`details`,{children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer select-none text-label font-medium text-secondary marker:content-[''] hover:text-display`,children:`Reconnect command`}),(0,Z.jsxs)(`div`,{className:`mt-2 flex items-start gap-2`,children:[(0,Z.jsx)(`pre`,{className:`flex-1 overflow-x-auto whitespace-pre-wrap break-all rounded-control bg-display p-3 font-mono text-caption leading-relaxed text-paper`,children:ui(e.token,g.pievoCli,g.customCli)}),(0,Z.jsx)(di,{text:ui(e.token,g.pievoCli,g.customCli)})]})]}),e.needsUpdate&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 rounded-control border border-warn/40 bg-warn/10 p-3`,children:[(0,Z.jsx)(`div`,{className:`text-label font-medium text-primary`,children:`Daemon needs update before this server will dispatch runs.`}),(0,Z.jsxs)(`div`,{className:`text-label text-secondary`,children:[`running `,e.daemonVersion?`v${e.daemonVersion}`:`unknown version`,` · required v`,e.requiredDaemonVersion]}),g?(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Z.jsx)(`pre`,{className:`flex-1 overflow-x-auto whitespace-pre-wrap break-all rounded-control bg-display p-3 font-mono text-caption leading-relaxed text-paper`,children:li(g.pievoCli,g.customCli)}),(0,Z.jsx)(di,{text:li(g.pievoCli,g.customCli)})]}):(0,Z.jsx)(`div`,{className:`text-label text-secondary`,children:v?`Could not load the upgrade command. Close and try again.`:`Loading upgrade command…`})]}),!e.needsUpdate&&si(e.daemonVersion,e.latestDaemonVersion)&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsxs)(`div`,{className:`text-label text-secondary`,children:[`daemon v`,e.daemonVersion,` · upgrade available (v`,e.latestDaemonVersion,`)`]}),g?(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Z.jsx)(`pre`,{className:`flex-1 overflow-x-auto whitespace-pre-wrap break-all rounded-control bg-display p-3 font-mono text-caption leading-relaxed text-paper`,children:li(g.pievoCli,g.customCli)}),(0,Z.jsx)(di,{text:li(g.pievoCli,g.customCli)})]}):(0,Z.jsx)(`div`,{className:`text-label text-secondary`,children:v?`Could not load the upgrade command. Close and try again.`:`Loading upgrade command…`})]})]},e.id)})}),(0,Z.jsx)(`div`,{className:`mt-6`,children:(0,Z.jsx)(`button`,{className:ft,disabled:f,onClick:()=>void S(),children:f?`Preparing…`:`+ Connect computer`})})]})}var pi=o({method:`GET`}).handler(r(`ced5641f28e3e64d3b8773ea4c875b78ee305bd08caba90a2207e86ef1ab3327`)),mi=o({method:`POST`}).handler(r(`d6cb1ea6f7fdaf940fbbe91d6b0898a0d5ac2308f8bc572dc3b856824a1f4581`)),hi=o({method:`POST`}).handler(r(`9defc1b5d0f4316d61621e2c4614a70dc052ad6b7a3aa2ead00836f7d5cb5b4c`)),gi=o({method:`POST`}).handler(r(`a4e3ae06af7087a3dc291236cf6d5ad272e2f754884c1f948e75a18a4ebada93`));export{fi as a,Kr as c,gi as i,gr as l,hi as n,ri as o,pi as r,Zr as s,mi as t,jt as u};
1
+ import{n as e,s as t,t as n}from"./jsx-runtime-BseJUIpC.js";import{L as r,O as i,T as a,l as o}from"./loopApi-CT1mMhlb.js";import{$ as s,A as c,At as l,B as u,Bt as d,C as f,Ct as p,D as m,Dt as h,E as g,Et as _,F as v,Ft as y,G as b,Gt as x,H as S,Ht as C,I as w,It as T,J as E,Jt as D,K as O,Kt as k,L as A,Lt as j,M,Mt as N,N as P,Nt as F,O as I,Ot as L,P as ee,Pt as R,Q as te,R as z,Rt as ne,S as re,St as ie,T as ae,Tt as oe,U as se,Ut as ce,V as le,Vt as ue,W as de,Wt as fe,X as B,Xt as pe,Y as V,Yt as me,Z as H,_ as he,_t as ge,a as _e,at as ve,b as ye,bt as be,c as xe,ct as Se,d as Ce,dt as we,et as Te,f as Ee,ft as De,g as Oe,gt as ke,h as Ae,ht as je,i as Me,it as U,j as Ne,jt as W,k as Pe,kt as Fe,l as Ie,m as Le,mt as Re,n as ze,nt as Be,o as Ve,ot as G,p as He,pt as K,q as Ue,qt as q,r as We,rt as J,s as Ge,st as Y,t as Ke,tt as qe,u as Je,ut as Ye,v as Xe,vt as Ze,w as Qe,wt as $e,x as et,xt as X,y as tt,yt as nt,z as rt,zt as it}from"./Modal-CCRvx959.js";import{A as at,C as ot,M as st,S as ct,T as lt,c as ut,h as dt,l as ft,m as pt,o as mt,p as ht,t as gt,w as _t,x as vt,y as yt}from"./ui-Dhsx6SW0.js";import{n as bt}from"./lifecycleUi-Qy_8beQK.js";var xt=t(r(),1),Z=n(),Q=t(e(),1),St=Q.createContext(void 0);function Ct(e){let t=Q.useContext(St);if(t===void 0&&!e)throw Error(k(72));return t}function wt(e,t){return t!=null&&!d(t)?0:typeof e==`function`?e():e}function Tt(e,t,n){let r=wt(e,n);return typeof r==`number`?r:r?.[t]}function Et(e){return typeof e==`function`?e():e}function Dt(e,t){return t||e===`click`||e===`mousedown`}function Ot(e){return e?.includes(`mouse`)&&e!==`mousedown`}var kt=Q.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new ce,currentIdRef:{current:null},currentContextRef:{current:null}});function At(e,t){e.current=t.current}function jt(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=Q.useRef(n),a=Q.useRef(n),o=Q.useRef(null),s=Q.useRef(null),c=fe();return q(()=>{if(a.current=n,!o.current){i.current=n;return}i.current={open:Tt(i.current,`open`),close:Tt(n,`close`)}},[n,o,i,a]),(0,Z.jsx)(kt.Provider,{value:Q.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function Mt(e,t={open:!1}){let{open:n}=t,r=`rootStore`in e?e.rootStore:e,i=r.useState(`floatingId`),{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:d}=Q.useContext(kt),[f,p]=Q.useState(!1),m=Q.useRef(n),h=Q.useRef(!1);return q(()=>{m.current=n},[n]),q(()=>()=>{h.current=!0},[]),q(()=>{function e(){h.current||p(!1),l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current,d.clear()}if(a.current&&!n&&a.current===i){if(p(!1),s){let t=i;return d.start(s,()=>{r.select(`open`)||a.current&&a.current!==t||e()}),()=>{(m.current||a.current!==t)&&d.clear()}}e()}},[n,i,a,o,s,c,l,d,r]),q(()=>{if(!n)return;let e=l.current,t=a.current;d.clear(),l.current={onOpenChange:r.setOpen,setIsInstantPhase:p},a.current=i,o.current={open:0,close:Tt(c.current,`close`)},t!==null&&t!==i?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,Y(we))):(p(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,c,l,d]),q(()=>()=>{if(a.current===i){if(l.current=null,!m.current)return;a.current=null,At(o,c),d.clear()}},[l,a,o,i,c,d]),Q.useMemo(()=>({hasProvider:u,delayRef:o,isInstantPhase:f}),[u,o,f])}function Nt(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function Pt(e){return e!=null&&e.clientX!=null}function Ft(e,t={}){let{enabled:n=!0,axis:r=`both`}=t,i=`rootStore`in e?e.rootStore:e,a=i.useState(`open`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.context.dataRef,l=Q.useRef(!1),u=Q.useRef(null),[f,p]=Q.useState(),[m,h]=Q.useState([]),g=J(e=>{i.set(`positionReference`,e)}),_=J((e,t,n)=>{l.current||c.current.openEvent&&!Pt(c.current.openEvent)||i.set(`positionReference`,Nt(n??s,{x:e,y:t,axis:r,dataRef:c,pointerType:f}))}),v=J(e=>{a?u.current||(_(e.clientX,e.clientY,e.currentTarget),h([])):_(e.clientX,e.clientY,e.currentTarget)}),y=d(f)?o:a;Q.useEffect(()=>{if(!n){g(s);return}if(!y)return;function e(){u.current?.(),u.current=null}let t=W(o);function r(t){X(o,ie(t))?e():_(t.clientX,t.clientY)}return!c.current.openEvent||Pt(c.current.openEvent)?u.current=G(t,`mousemove`,r):g(s),e},[y,n,o,c,s,i,_,g,m]),Q.useEffect(()=>()=>{i.set(`positionReference`,null)},[i]),Q.useEffect(()=>{n&&!o&&(l.current=!1)},[n,o]),Q.useEffect(()=>{!n&&a&&(l.current=!0)},[n,a]);let b=Q.useMemo(()=>{function e(e){p(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:v,onMouseEnter:v}},[v]);return Q.useMemo(()=>n?{reference:b,trigger:b}:{},[n,b])}function It(e,t,n){let{reference:r,floating:i}=e,a=B(t),o=le(t),s=se(o),c=V(t),l=a===`y`,d=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,p=r[s]/2-i[s]/2,m;switch(c){case`top`:m={x:d,y:r.y-i.height};break;case`bottom`:m={x:d,y:r.y+r.height};break;case`right`:m={x:r.x+r.width,y:f};break;case`left`:m={x:r.x-i.width,y:f};break;default:m={x:r.x,y:r.y}}switch(u(t)){case`start`:m[o]-=p*(n&&l?-1:1);break;case`end`:m[o]+=p*(n&&l?-1:1);break}return m}async function Lt(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:c}=e,{boundary:l=`clippingAncestors`,rootBoundary:u=`viewport`,elementContext:d=`floating`,altBoundary:f=!1,padding:p=0}=z(t,e),m=E(p),h=o[f?d===`floating`?`reference`:`floating`:d],g=s(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(h))??!0?h:h.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:l,rootBoundary:u,strategy:c})),_=d===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,v=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),y=await(i.isElement==null?void 0:i.isElement(v))&&await(i.getScale==null?void 0:i.getScale(v))||{x:1,y:1},b=s(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:_,offsetParent:v,strategy:c}):_);return{top:(g.top-b.top+m.top)/y.y,bottom:(b.bottom-g.bottom+m.bottom)/y.y,left:(g.left-b.left+m.left)/y.x,right:(b.right-g.right+m.right)/y.x}}var Rt=50,zt=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Lt},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=It(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Rt&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=It(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Bt=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=z(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=V(r),_=B(o),v=V(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Ue(o)]:de(o)),x=p!==`none`;!d&&x&&b.push(...O(o,m,p,y));let C=[o,...b],w=await s.detectOverflow(t,h),T=[],E=i.flip?.overflows||[];if(l&&T.push(w[g]),u){let e=S(r,a,y);T.push(w[e[0]],w[e[1]])}if(E=[...E,{placement:r,overflows:T}],!T.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=C[e];if(t&&(!(u===`alignment`&&_!==B(t))||E.every(e=>B(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:E},reset:{placement:t}};let n=E.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=E.filter(e=>{if(x){let t=B(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Vt(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ht(e){return qe.some(t=>e[t]>=0)}var Ut=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=z(e,t);switch(i){case`referenceHidden`:{let e=Vt(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Ht(e)}}}case`escaped`:{let e=Vt(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Ht(e)}}}default:return{}}}}},Wt=new Set([`left`,`top`]);async function Gt(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=V(n),s=u(n),c=B(n)===`y`,l=Wt.has(o)?-1:1,d=a&&c?-1:1,f=z(t,e),{mainAxis:p,crossAxis:m,alignmentAxis:h}=typeof f==`number`?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return s&&typeof h==`number`&&(m=s===`end`?h*-1:h),c?{x:m*d,y:p*l}:{x:p*l,y:m*d}}var Kt=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Gt(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},qt=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=z(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=B(V(i)),p=b(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=w(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=w(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Jt=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=z(e,t),u={x:n,y:r},d=B(i),f=b(d),p=u[f],m=u[d],h=z(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Wt.has(V(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Yt=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=z(e,t),d=await o.detectOverflow(t,l),f=V(i),p=u(i),m=B(i)===`y`,{width:h,height:g}=a.floating,_,v;f===`top`||f===`bottom`?(_=f,v=p===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(v=f,_=p===`end`?`top`:`bottom`);let y=g-d.top-d.bottom,b=h-d.left-d.right,x=te(g-d[_],y),S=te(h-d[v],b),C=!t.middlewareData.shift,w=x,T=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=b),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(w=y),C&&!p){let e=H(d.left,0),t=H(d.right,0),n=H(d.top,0),r=H(d.bottom,0);m?T=h-2*(e!==0||t!==0?e+t:H(d.left,d.right)):w=g-2*(n!==0||r!==0?n+r:H(d.top,d.bottom))}await c({...t,availableWidth:T,availableHeight:w});let E=await o.getDimensions(s.floating);return h!==E.width||g!==E.height?{reset:{rects:!0}}:{}}}};function Xt(e){let t=p(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=R(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Te(n)!==a||Te(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Zt(e){return F(e)?e:e.contextElement}function Qt(e){let t=Zt(e);if(!R(t))return A(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Xt(t),o=(a?Te(n.width):n.width)/r,s=(a?Te(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var $t=A(0);function en(e){let t=W(e);return!it()||!t.visualViewport?$t:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function tn(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==W(e)?!1:t}function nn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Zt(e),o=A(1);t&&(r?F(r)&&(o=Qt(r)):o=Qt(e));let c=tn(a,n,r)?en(a):A(0),l=(i.left+c.x)/o.x,u=(i.top+c.y)/o.y,d=i.width/o.x,f=i.height/o.y;if(a){let e=W(a),t=r&&F(r)?W(r):r,n=e,i=_(n);for(;i&&r&&t!==n;){let e=Qt(i),t=i.getBoundingClientRect(),r=p(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,u*=e.y,d*=e.x,f*=e.y,l+=a,u+=o,n=W(i),i=_(n)}}return s({width:d,height:f,x:l,y:u})}function rn(e,t){let n=L(e).scrollLeft;return t?t.left+n:nn(oe(e)).left+n}function an(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-rn(e,n),y:n.top+t.scrollTop}}function on(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=oe(r),s=t?ne(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=A(1),u=A(0),d=R(r);if((d||!d&&!a)&&((h(r)!==`body`||T(o))&&(c=L(r)),d)){let e=nn(r);l=Qt(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?an(o,c):A(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function sn(e){return Array.from(e.getClientRects())}function cn(e){let t=oe(e),n=L(e),r=e.ownerDocument.body,i=H(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=H(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+rn(e),s=-n.scrollTop;return p(r).direction===`rtl`&&(o+=H(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var ln=25;function un(e,t){let n=W(e),r=oe(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=it();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=rn(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=ln&&(a-=o)}else l<=ln&&(a+=l);return{width:a,height:o,x:s,y:c}}function dn(e,t){let n=nn(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=R(e)?Qt(e):A(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function fn(e,t,n){let r;if(t===`viewport`)r=un(e,n);else if(t===`document`)r=cn(oe(e));else if(F(t))r=dn(t,n);else{let n=en(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return s(r)}function pn(e,t){let n=l(e);return n===t||!F(n)||y(n)?!1:p(n).position===`fixed`||pn(n,t)}function mn(e,t){let n=t.get(e);if(n)return n;let r=Fe(e,[],!1).filter(e=>F(e)&&h(e)!==`body`),i=null,a=p(e).position===`fixed`,o=a?l(e):e;for(;F(o)&&!y(o);){let t=p(o),n=N(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||T(o)&&!n&&pn(e,o))?r=r.filter(e=>e!==o):i=t,o=l(o)}return t.set(e,r),r}function hn(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ne(t)?[]:mn(t,this._c):[].concat(n),r],o=fn(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=fn(t,a[e],i);s=H(n.top,s),c=te(n.right,c),l=te(n.bottom,l),u=H(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function gn(e){let{width:t,height:n}=Xt(e);return{width:t,height:n}}function _n(e,t,n){let r=R(t),i=oe(t),a=n===`fixed`,o=nn(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=A(0);function l(){c.x=rn(i)}if(r||!r&&!a)if((h(t)!==`body`||T(i))&&(s=L(t)),r){let e=nn(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?an(i,s):A(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function vn(e){return p(e).position===`static`}function yn(e,t){if(!R(e)||p(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return oe(e)===n&&(n=n.ownerDocument.body),n}function bn(e,t){let n=W(e);if(ne(e))return n;if(!R(e)){let t=l(e);for(;t&&!y(t);){if(F(t)&&!vn(t))return t;t=l(t)}return n}let r=yn(e,t);for(;r&&j(r)&&vn(r);)r=yn(r,t);return r&&y(r)&&vn(r)&&!N(r)?n:r||$e(e)||n}var xn=async function(e){let t=this.getOffsetParent||bn,n=this.getDimensions,r=await n(e.floating);return{reference:_n(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Sn(e){return p(e).direction===`rtl`}var Cn={convertOffsetParentRelativeRectToViewportRelativeRect:on,getDocumentElement:oe,getClippingRect:hn,getOffsetParent:bn,getElementRects:xn,getClientRects:sn,getDimensions:gn,getScale:Qt,isElement:F,isRTL:Sn};function wn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Tn(e,t){let n=null,r,i=oe(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=rt(d),h=rt(i.clientWidth-(u+f)),g=rt(i.clientHeight-(d+p)),_=rt(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:H(0,te(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!wn(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function En(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Zt(e),u=i||a?[...l?Fe(l):[],...t?Fe(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Tn(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?nn(e):null;c&&g();function g(){let t=nn(e);h&&!wn(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Dn=Kt,On=qt,kn=Bt,An=Yt,jn=Ut,Mn=Jt,Nn=(e,t,n)=>{let r=new Map,i={platform:Cn,...n},a={...i.platform,_c:r};return zt(e,t,{...i,platform:a})},Pn=typeof document<`u`?Q.useLayoutEffect:function(){};function Fn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Fn(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Fn(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function In(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ln(e,t){let n=In(e);return Math.round(t*n)/n}function Rn(e){let t=Q.useRef(e);return Pn(()=>{t.current=e}),t}function zn(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=Q.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=Q.useState(r);Fn(f,r)||p(r);let[m,h]=Q.useState(null),[g,_]=Q.useState(null),v=Q.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=Q.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=Q.useRef(null),C=Q.useRef(null),w=Q.useRef(u),T=c!=null,E=Rn(c),D=Rn(i),O=Rn(l),k=Q.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Nn(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!Fn(w.current,t)&&(w.current=t,xt.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Pn(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=Q.useRef(!1);Pn(()=>(A.current=!0,()=>{A.current=!1}),[]),Pn(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=Q.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=Q.useMemo(()=>({reference:b,floating:x}),[b,x]),N=Q.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=Ln(M.floating,u.x),r=Ln(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...In(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return Q.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var Bn=(e,t)=>{let n=Dn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vn=(e,t)=>{let n=On(e);return{name:n.name,fn:n.fn,options:[e,t]}},Hn=(e,t)=>({fn:Mn(e).fn,options:[e,t]}),Un=(e,t)=>{let n=kn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wn=(e,t)=>{let n=An(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gn=(e,t)=>{let n=jn(e);return{name:n.name,fn:n.fn,options:[e,t]}};function Kn(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=P(),a=g()!=null,o=pe(()=>new re({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Ce,floatingId:i,syncOnly:!1,nested:a})).current;return q(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=F(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function qn(e={}){let{nodeId:t,externalTree:n}=e,r=Kn(e),i=e.rootContext||r,a=i.useState(`referenceElement`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.useState(`open`),l=i.useState(`floatingId`),[u,d]=Q.useState(null),[f,p]=Q.useState(void 0),[h,g]=Q.useState(void 0),_=Q.useRef(null),v=m(n),y=Q.useMemo(()=>({reference:a,floating:o,domReference:s}),[a,o,s]),b=zn({...e,elements:{...y,...u&&{reference:u}}}),x=F(f)?f:null,S=h===void 0?i.state.floatingElement:h;i.useSyncedValue(`referenceElement`,f??null),i.useSyncedValue(`domReferenceElement`,f===void 0?s:x),i.useSyncedValue(`floatingElement`,S);let C=Q.useCallback(e=>{let t=F(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;d(t),b.refs.setReference(t)},[b.refs]),w=Q.useCallback(e=>{(F(e)||e===null)&&(_.current=e,p(e)),(F(b.refs.reference.current)||b.refs.reference.current===null||e!==null&&!F(e))&&b.refs.setReference(e)},[b.refs,p]),T=Q.useCallback(e=>{g(e),b.refs.setFloating(e)},[b.refs]),E=Q.useMemo(()=>({...b.refs,setReference:w,setFloating:T,setPositionReference:C,domReference:_}),[b.refs,w,T,C]),D=Q.useMemo(()=>({...b.elements,domReference:s}),[b.elements,s]),O=Q.useMemo(()=>({...b,dataRef:i.context.dataRef,open:c,onOpenChange:i.setOpen,events:i.context.events,floatingId:l,refs:E,elements:D,nodeId:t,rootStore:i}),[b,E,D,t,i,c,l]);return q(()=>{s&&(_.current=s)},[s]),q(()=>{i.context.dataRef.current.floatingContext=O;let e=v?.nodesRef.current.find(e=>e.id===t);e&&(e.context=O)}),Q.useMemo(()=>({...b,context:O,refs:E,elements:D,rootStore:i}),[b,E,D,O,i])}var Jn=C&&ue;function Yn(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=Q.useRef(!1),c=Q.useRef(null),l=Q.useRef(!0),u=fe();Q.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=W(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&R(e)&&e===be(Be(e))&&(s.current=!0)}function a(){l.current=!0}function o(){l.current=!1}return ve(G(t,`blur`,r),Jn&&G(t,`keydown`,a,!0),Jn&&G(t,`pointerdown`,o,!0))},[i,n]),Q.useEffect(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);F(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let d=Q.useMemo(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=ie(t.nativeEvent);if(F(a)){if(Jn&&!t.relatedTarget){if(!l.current&&!Ze(a))return}else if(!nt(a))return}let o=ge(t.relatedTarget,i.context.triggerElements),{nativeEvent:d,currentTarget:f}=t,p=typeof r==`function`?r():r;if(i.select(`open`)&&o||p===0||p===void 0){i.setOpen(!0,Y(De,d,f));return}u.start(p,()=>{s.current||i.setOpen(!0,Y(De,d,f))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=F(n)&&n.hasAttribute(ee(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=be(Be(e));!n&&t===e||X(o.current.floatingContext?.refs.floating.current,t)||X(e,t)||a||ge(n??t,i.context.triggerElements)||i.setOpen(!1,Y(De,r))})}}},[o,r,i,u]);return Q.useMemo(()=>n?{reference:d,trigger:d}:{},[n,d])}var Xn=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new ce,this.restTimeout=new ce,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},Zn=new WeakMap;function Qn(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&Zn.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),Zn.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function $n(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=Zn.get(n);a&&a!==e&&Qn(a),Qn(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,Zn.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function er(e){let t=e.context.dataRef.current,n=pe(()=>t.hoverInteractionState??Xn.create()).current;return t.hoverInteractionState||=n,x(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function tr(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),{dataRef:l}=a.context,u=m(),d=g(),f=er(a),p=fe(),h=J(()=>Dt(l.current.openEvent?.type,f.interactedInside)),_=J(()=>Ot(l.current.openEvent?.type)),y=J(()=>{Qn(f)});q(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,y())},[o,f,y]),Q.useEffect(()=>y,[y]),q(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&_()&&F(c)&&s){let e=c,t=s,n=Be(s),r=u?.nodesRef.current.find(e=>e.id===d)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=f.pointerEventsScopeElement===t?null:f.pointerEventsScopeElement,a=r===t?null:r;return $n(f,{scopeElement:f.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body,referenceElement:e,floatingElement:t}),()=>{y()}}},[n,o,c,s,f,_,u,d,y]),Q.useEffect(()=>{if(!n)return;function e(){return!!(u&&d&&v(u.nodesRef.current,d).length>0)}function t(e){let t=Tt(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,Y(K,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=ie(e);if(!ke(t)){f.interactedInside=!1;return}f.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function c(){f.openChangeTimeout.clear(),p.clear(),u?.events.off(`floating.closed`,g),y()}function m(n){if(e()&&u){u.events.on(`floating.closed`,g);return}if(ge(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(u&&r&&F(o)&&v(u.nodesRef.current,r,!1).some(e=>X(e.context?.elements.floating,o)))){if(f.handler){f.handler(n);return}y(),_()&&!h()&&t(n)}}function g(t){!u||!d||e()||p.start(0,()=>{u.events.off(`floating.closed`,g),a.setOpen(!1,Y(K,t)),u.events.emit(`floating.closed`,t)})}let b=s;return ve(b&&G(b,`mouseenter`,c),b&&G(b,`mouseleave`,m),b&&G(b,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,g)})},[n,s,a,l,r,i,_,h,y,f,u,d,p])}var nr={current:null};function rr(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=nr,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:f,isClosing:p,shouldOpen:h}=t,g=`rootStore`in e?e.rootStore:e,{dataRef:_,events:v}=g.context,y=m(l),b=er(g),x=Q.useRef(!1),S=U(i),C=U(r),w=U(o),T=U(n),E=U(h),D=U(p),O=J(()=>Dt(_.current.openEvent?.type,b.interactedInside)),k=J(()=>E.current?.()!==!1),A=J((e,t,n)=>{let r=g.context.triggerElements;if(r.hasElement(t))return!e||!X(e,t);if(!F(n))return!1;let i=n;return r.hasMatchingElement(e=>X(e,i))&&(!e||!X(e,i))}),j=J(()=>{b.handler&&=(Be(g.select(`domReferenceElement`)).removeEventListener(`mousemove`,b.handler),void 0)}),M=J(()=>{Qn(b)});return u&&(b.handleCloseOptions=S.current?.__options),Q.useEffect(()=>j,[j]),Q.useEffect(()=>{if(!n)return;function e(e){e.open?x.current=!1:(x.current=e.reason===K,j(),b.openChangeTimeout.clear(),b.restTimeout.clear(),b.blockMouseMove=!0,b.restTimeoutPending=!1)}return v.on(`openchange`,e),()=>{v.off(`openchange`,e)}},[n,v,b,j]),Q.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=Tt(C.current,`close`,b.pointerType);n?b.openChangeTimeout.start(n,()=>{g.setOpen(!1,Y(K,e)),y?.events.emit(`floating.closed`,e)}):t&&(b.openChangeTimeout.clear(),g.setOpen(!1,Y(K,e)),y?.events.emit(`floating.closed`,e))}let t=c.current??(u?g.select(`domReferenceElement`):null);if(!F(t))return;function r(e){if(b.openChangeTimeout.clear(),b.blockMouseMove=!1,a&&!d(b.pointerType))return;let t=Et(w.current),n=Tt(C.current,`open`,b.pointerType),r=ie(e),i=e.currentTarget??null,o=g.select(`domReferenceElement`),s=i;if(F(r)&&!g.context.triggerElements.hasElement(r)){for(let e of g.context.triggerElements.elements())if(X(e,r)){s=e;break}}F(i)&&F(o)&&!g.context.triggerElements.hasElement(i)&&X(i,o)&&(s=o);let c=s==null?!1:A(o,s,r),l=g.select(`open`),u=D.current?.()??g.select(`transitionStatus`)===`ending`,f=!l&&u&&x.current,p=!c&&F(s)&&F(o)&&X(o,s)&&f,m=t>0&&!n,h=c&&(l||f)||p,_=!l||c;if(h){k()&&g.setOpen(!0,Y(K,e,s));return}m||(n?b.openChangeTimeout.start(n,()=>{_&&k()&&g.setOpen(!0,Y(K,e,s))}):_&&k()&&g.setOpen(!0,Y(K,e,s)))}function i(t){if(O()){M();return}j();let n=Be(g.select(`domReferenceElement`));b.restTimeout.clear(),b.restTimeoutPending=!1;let r=_.current.floatingContext??f?.();if(!ge(t.relatedTarget,g.context.triggerElements)){if(S.current&&r){g.select(`open`)||b.openChangeTimeout.clear();let i=c.current;b.handler=S.current({...r,tree:y,x:t.clientX,y:t.clientY,onClose(){M(),j(),T.current&&!O()&&i===g.select(`domReferenceElement`)&&e(t,!0)}}),n.addEventListener(`mousemove`,b.handler),b.handler(t);return}(b.pointerType!==`touch`||!X(g.select(`floatingElement`),t.relatedTarget))&&e(t)}}return s?ve(G(t,`mousemove`,r,{once:!0}),G(t,`mouseenter`,r),G(t,`mouseleave`,i)):ve(G(t,`mouseenter`,r),G(t,`mouseleave`,i))},[j,M,_,C,g,n,S,b,u,A,O,a,s,w,c,y,T,f,D,k]),Q.useMemo(()=>{if(!n)return;function e(e){b.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=g.select(`domReferenceElement`),i=g.select(`open`),o=A(r,n,e.target);if(a&&!d(b.pointerType))return;if(i&&o&&b.handleCloseOptions?.blockPointerEvents){let e=g.select(`floatingElement`);e&&$n(b,{scopeElement:b.handleCloseOptions?.getScope?.()??n.ownerDocument.body,referenceElement:n,floatingElement:e})}let s=Et(w.current);if(i&&!o||s===0||!o&&b.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;b.restTimeout.clear();function c(){if(b.restTimeoutPending=!1,O())return;let e=g.select(`open`);!b.blockMouseMove&&(!e||o)&&k()&&g.setOpen(!0,Y(K,t,n))}b.pointerType===`touch`?xt.flushSync(()=>{c()}):o&&i?c():(b.restTimeoutPending=!0,b.restTimeout.start(s,c))}}},[n,b,O,A,a,g,w,k])}var ir=.1,ar=ir*ir,$=.5;function or(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function sr(e,t,n,r,i,a,o,s,c,l){let u=!1;return or(e,t,n,r,i,a)&&(u=!u),or(e,t,i,a,o,s)&&(u=!u),or(e,t,o,s,c,l)&&(u=!u),or(e,t,c,l,n,r)&&(u=!u),u}function cr(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function lr(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function ur(e={}){let{blockPointerEvents:t=!1}=e,n=new ce,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*ar;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=ie(r),g=r.type===`mouseleave`,_=X(u,h),y=X(a,h);if(_&&(l=!0,!g))return;if(y&&(l=!1,!g)){l=!0;return}if(g&&F(r.relatedTarget)&&X(u,r.relatedTarget))return;function b(){return!!(s&&v(s.nodesRef.current,o).length>0)}function x(){b()||m()}if(b())return;let S=a.getBoundingClientRect(),C=u.getBoundingClientRect(),w=e>C.right-C.width/2,T=t>C.bottom-C.height/2,E=C.width>S.width,D=C.height>S.height,O=(E?S:C).left,k=(E?S:C).right,A=(D?S:C).top,j=(D?S:C).bottom;if(c===`top`&&t>=S.bottom-1||c===`bottom`&&t<=S.top+1||c===`left`&&e>=S.right-1||c===`right`&&e<=S.left+1){x();return}let M=!1;switch(c){case`top`:M=lr(d,f,O,S.top+1,k,C.bottom-1);break;case`bottom`:M=lr(d,f,O,C.top+1,k,S.bottom-1);break;case`left`:M=lr(d,f,C.right-1,j,S.left+1,A);break;case`right`:M=lr(d,f,S.right-1,j,C.left+1,A);break;default:}if(M)return;if(l&&!cr(d,f,S)){x();return}if(!g&&p(d,f)){x();return}let N=!1;switch(c){case`top`:{let n=E?$/2:$*4,r=E||w?e+n:e-n,i=E?e-n:w?e+n:e-n,a=t+$+1,o=w||E?C.bottom-$:C.top,s=w?E?C.bottom-$:C.top:C.bottom-$;N=sr(d,f,r,a,i,a,C.left,o,C.right,s);break}case`bottom`:{let n=E?$/2:$*4,r=E||w?e+n:e-n,i=E?e-n:w?e+n:e-n,a=t-$,o=w||E?C.top+$:C.bottom,s=w?E?C.top+$:C.bottom:C.top+$;N=sr(d,f,r,a,i,a,C.left,o,C.right,s);break}case`left`:{let n=D?$/2:$*4,r=D||T?t+n:t-n,i=D?t-n:T?t+n:t-n,a=e+$+1,o=T||D?C.right-$:C.left,s=T?D?C.right-$:C.left:C.right-$;N=sr(d,f,o,C.top,s,C.bottom,a,r,a,i);break}case`right`:{let n=D?$/2:$*4,r=D||T?t+n:t-n,i=D?t-n:T?t+n:t-n,a=e-$,o=T||D?C.left+$:C.right,s=T?D?C.left+$:C.right:C.left+$;N=sr(d,f,a,r,a,i,o,C.top,s,C.bottom);break}default:}N?l||n.start(40,x):x()}};return r.__options={...e,blockPointerEvents:t},r}var dr={...Je,disabled:Qe(e=>e.disabled),instantType:Qe(e=>e.instantType),isInstantPhase:Qe(e=>e.isInstantPhase),trackCursorAxis:Qe(e=>e.trackCursorAxis),disableHoverablePopup:Qe(e=>e.disableHoverablePopup),lastOpenChangeReason:Qe(e=>e.openChangeReason),closeOnClick:Qe(e=>e.closeOnClick),closeDelay:Qe(e=>e.closeDelay),hasViewport:Qe(e=>e.hasViewport)},fr=class e extends f{constructor(e,t,n=!1){let r=new Ce,i={...pr(),...e};i.floatingRootContext=Ie(r,t,n),super(i,{popupRef:Q.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:r},dr)}setOpen=(e,t)=>{He(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,Y(Re,e))}static useStore(t,n){return Xe(t,(t,r)=>new e(n,t,r)).store}};function pr(){return{...xe(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}var mr=D(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=fr.useStore(l?.store,{open:n,openProp:r,activeTriggerId:d,triggerIdProp:u});Ae(p,r,n,d),p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`mounted`),v=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i}),p.useSyncedValue(`disabled`,t),Le(p,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:y,transitionStatus:b}=Oe(h,p),x=p.useState(`isInstantPhase`),S=p.useState(`instantType`),C=p.useState(`lastOpenChangeReason`),w=Q.useRef(null);q(()=>{m&&t&&p.setOpen(!1,Y(Se))},[m,t,p]),q(()=>{b===`ending`&&C===`none`||b!==`ending`&&x?(S!==`delay`&&(w.current=S),p.set(`instantType`,`delay`)):w.current!==null&&(p.set(`instantType`,w.current),w.current=null)},[b,x,C,S,p]),q(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]);let T=Q.useCallback(()=>{p.setOpen(!1,Y(Ye))},[p]);Q.useImperativeHandle(o,()=>({unmount:y,close:T}),[y,T]);let E=h||_||!t&&a!==`none`;return(0,Z.jsxs)(St.Provider,{value:p,children:[E&&(0,Z.jsx)(hr,{store:p,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:v}):f]})});function hr({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=ae(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=Ft(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n});return he(e,{activeTriggerProps:Q.useMemo(()=>M(a.reference,i.reference),[a.reference,i.reference]),inactiveTriggerProps:Q.useMemo(()=>M(a.trigger,i.trigger),[a.trigger,i.trigger]),popupProps:Q.useMemo(()=>M(Ee,a.floating,i.floating),[a.floating,i.floating])}),null}var gr=Q.createContext(void 0);function _r(){return Q.useContext(gr)}var vr=function(e){return e[e.popupOpen=_e.popupOpen]=`popupOpen`,e.triggerDisabled=`data-trigger-disabled`,e}({}),yr=`data-base-ui-tooltip-trigger`;function br(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;e<t.length;e+=1){let n=t[e];if(F(n))return n}}let t=e.target;return F(t)?t:null}function xr(e){let t=e;for(;t;){if(t.hasAttribute(yr))return t;let e=t.parentElement;if(e){t=e;continue}let n=t.getRootNode();t=`host`in n&&F(n.host)?n.host:null}return null}var Sr=me(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:u,id:f,...p}=e,m=Ct(!0),h=a?.store??m;if(!h)throw Error(k(82));let g=Me(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`isOpenedByTrigger`,g),y=h.useState(`floatingRootContext`),b=Q.useRef(null),x=c??600,S=u??0,{registerTrigger:C,isMountedByThisTrigger:w}=tt(g,b,h,{payload:o,closeOnClick:l,closeDelay:S}),T=_r(),{delayRef:E,isInstantPhase:D,hasProvider:O}=Mt(y,{open:v}),A=er(y);h.useSyncedValue(`isInstantPhase`,D);let j=h.useState(`disabled`),M=s??j,N=U(M),P=h.useState(`trackCursorAxis`),F=h.useState(`disableHoverablePopup`),I=Q.useRef(!1),L=fe(),ee=Q.useRef(void 0);function R(){let e=T?.delay,t=typeof E.current==`object`?E.current.open:void 0,n=x;return O&&(n=t===0?0:c??e??x),n}function te(e){let t=b.current;if(!t||!e)return!1;let n=xr(e);return n!==null&&n!==t&&X(t,n)}function z(e){let t=te(e);return I.current=t,t&&(A.openChangeTimeout.clear(),A.restTimeout.clear(),A.restTimeoutPending=!1,L.clear()),t}let ne=rr(y,{enabled:!M,mouseOnly:!0,move:!1,handleClose:!F&&P!==`both`?ur():null,restMs:R,delay(){let e=typeof E.current==`object`?E.current.close:void 0,t=S;return u==null&&O&&(t=e),{close:t}},triggerElementRef:b,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`,shouldOpen(){return!I.current}}),re=Yn(y,{enabled:!M}).reference,ie=e=>{let t=I.current,n=br(e),r=z(n),i=b.current,a=i&&n&&X(i,n);if(r&&h.select(`open`)&&h.select(`lastOpenChangeReason`)===`trigger-hover`){h.setOpen(!1,Y(K,e));return}if(t&&!r&&a&&!N.current&&!h.select(`open`)&&i&&d(ee.current)){let t=()=>{!I.current&&!N.current&&!h.select(`open`)&&h.setOpen(!0,Y(K,e,i))},n=R();n===0?(L.clear(),t()):L.start(n,t)}},ae=h.useState(`triggerProps`,w);return Ne(`button`,e,{state:{open:v},ref:[t,C,b],props:[ne,re,w||P!==`none`?ae:void 0,{onMouseOver(e){ie(e.nativeEvent)},onFocus(e){te(br(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){I.current=!1,L.clear(),ee.current=void 0},onPointerEnter(e){ee.current=e.pointerType},onPointerDown(e){ee.current=e.pointerType,h.set(`closeOnClick`,l),l&&!h.select(`open`)&&h.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!h.select(`open`)&&h.cancelPendingOpen(e.nativeEvent)},id:g,[vr.triggerDisabled]:M?``:void 0,[yr]:M?void 0:``},p],stateAttributesMapping:Ge})}),Cr=Q.createContext(void 0);function wr(){let e=Q.useContext(Cr);if(e===void 0)throw Error(k(70));return e}var Tr=Q.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{portalNode:c,portalSubtree:l}=I({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,Z.jsxs)(Q.Fragment,{children:[l,c&&xt.createPortal(n,c)]})}),Er=Q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return Ct().useState(`mounted`)||n?(0,Z.jsx)(Cr.Provider,{value:n,children:(0,Z.jsx)(Tr,{ref:t,...r})}):null}),Dr=Q.createContext(void 0);function Or(){let e=Q.useContext(Dr);if(e===void 0)throw Error(k(71));return e}var kr=Q.createContext(void 0);function Ar(){return Q.useContext(kr)?.direction??`ltr`}var jr=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:d=0,offsetParent:f=`real`}=z(e,t)||{};if(l==null)return{};let p=E(d),m={x:n,y:r},h=le(i),g=se(h),_=await o.getDimensions(l),v=h===`y`,y=v?`top`:`left`,b=v?`bottom`:`right`,x=v?`clientHeight`:`clientWidth`,S=a.reference[g]+a.reference[h]-m[h]-a.floating[g],C=m[h]-a.reference[h],T=f===`real`?await o.getOffsetParent?.(l):s.floating,D=s.floating[x]||a.floating[g];(!D||!await o.isElement?.(T))&&(D=s.floating[x]||a.floating[g]);let O=S/2-C/2,k=D/2-_[g]/2-1,A=Math.min(p[y],k),j=Math.min(p[b],k),M=A,N=D-_[g]-j,P=D/2-_[g]/2+O,F=w(M,P,N),I=!c.arrow&&u(i)!=null&&P!==F&&a.reference[g]/2-(P<M?A:j)-_[g]/2<0,L=I?P<M?P-M:P-N:0;return{[h]:m[h]+L,data:{[h]:F,centerOffset:P-F-L,...I&&{alignmentOffset:L}},reset:I}}}),Mr=(e,t)=>({...jr(e),options:[e,t]}),Nr=Gn().fn,Pr={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await Nr(e)).data?.referenceHidden||a}}}},Fr={sideX:`left`,sideY:`top`},Ir={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=W(i),l=c.getComputedStyle(i);if(!(l.transitionDuration!==`0s`&&l.transitionDuration!==``))return{x:t,y:n,data:Fr};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=Be(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=V(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:Fr.sideX,g=f===`top`?`bottom`:Fr.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}};function Lr(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function Rr(e,t,n){let{rects:r,placement:i}=e;return{side:Lr(t,V(i),n),align:u(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function zr(e){let{anchor:t,positionMethod:n=`absolute`,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,collisionBoundary:s,collisionPadding:c=5,sticky:l=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shiftCrossAxis:v=!1,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,[C,w]=Q.useState(null);!g&&C!==null&&w(null);let T=_.side||`flip`,E=_.align||`flip`,D=_.fallbackAxisSide||`end`,O=typeof t==`function`?t:void 0,k=J(O),A=O?k:t,j=U(t),M=U(g),N=Ar()===`rtl`,P=C||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":N?`left`:`right`,"inline-start":N?`right`:`left`}[r],F=a===`center`?P:`${P}-${a}`,I=c,L=+(r===`bottom`),ee=+(r===`top`),R=+(r===`right`),te=+(r===`left`);typeof I==`number`?I={top:I+L,right:I+te,bottom:I+ee,left:I+R}:I&&={top:(I.top||0)+L,right:(I.right||0)+te,bottom:(I.bottom||0)+ee,left:(I.left||0)+R};let z={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:I},ne=Q.useRef(null),re=U(i),ie=U(o),ae=typeof i==`function`?0:i,oe=typeof o==`function`?0:o,se=[];p&&se.push(p),se.push(Bn(e=>{let t=Rr(e,r,N),n=typeof re.current==`function`?re.current(t):re.current,i=typeof ie.current==`function`?ie.current(t):ie.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[ae,oe,N,r]));let ce=E===`none`&&T!==`shift`,le=!ce&&(l||v||T===`shift`),ue=T===`none`?null:Un({...z,padding:{top:I.top+1,right:I.right+1,bottom:I.bottom+1,left:I.left+1},mainAxis:!v&&T===`flip`,crossAxis:E===`flip`?`alignment`:!1,fallbackAxisSideDirection:D}),de=ce?null:Vn(e=>{let t=Be(e.elements.floating).documentElement;return{...z,rootBoundary:v?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:E!==`none`,crossAxis:le,limiter:l||v?void 0:Hn(e=>{if(!ne.current)return{};let{width:t,height:n}=ne.current.getBoundingClientRect(),r=B(V(e.placement)),i=r===`y`?t:n,a=r===`y`?I.left+I.right:I.top+I.bottom;return{offset:i/2+a/2}})}},[z,l,v,I,E]);T===`shift`||E===`shift`||a===`center`?se.push(de,ue):se.push(ue,de),se.push(Wn({...z,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!M.current)return;let i=e.style;i.setProperty(`--available-width`,`${t}px`),i.setProperty(`--available-height`,`${n}px`);let a=W(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),Mr(e=>({element:ne.current||Be(e.elements.floating).createElement(`div`),padding:d,offsetParent:`floating`}),[d]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=V(a),l=B(c),u=ne.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof i==`function`?i(Rr(e,r,N)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,le&&l===`y`&&b?S:x),{}}},Pr,b),q(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let fe=Q.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:pe,elements:me,x:H,y:he,middlewareData:ge,update:_e,placement:ve,context:ye,isPositioned:be,floatingStyles:xe}=qn({rootContext:h,open:m?g:void 0,placement:F,middleware:se,strategy:n,whileElementsMounted:m?void 0:(...e)=>En(...e,fe),nodeId:y,externalTree:S}),{sideX:Se,sideY:Ce}=ge.adaptiveOrigin||Fr,we=be?n:`fixed`,Te=Q.useMemo(()=>{let e=b?{position:we,[Se]:H,[Ce]:he}:{position:we,...xe};return be||(e.opacity=0),e},[b,we,Se,H,Ce,he,xe,be]),Ee=Q.useRef(null);q(()=>{if(!g)return;let e=j.current,t=typeof e==`function`?e():e,n=(Br(t)?t.current:t)||null;n!==Ee.current&&(pe.setPositionReference(n),Ee.current=n)},[g,pe,A,j]),Q.useEffect(()=>{if(!g)return;let e=j.current;typeof e!=`function`&&Br(e)&&e.current!==Ee.current&&(pe.setPositionReference(e.current),Ee.current=e.current)},[g,pe,A,j]),Q.useEffect(()=>{if(m&&g&&me.reference&&me.floating)return En(me.reference,me.floating,_e,fe)},[m,g,me,_e,fe]);let De=V(ve),Oe=Lr(r,De,N),ke=u(ve)||`center`,Ae=!!ge.hide?.referenceHidden;q(()=>{x&&g&&be&&w(De)},[x,g,be,De]);let je=Q.useMemo(()=>({position:`absolute`,top:ge.arrow?.y,left:ge.arrow?.x}),[ge.arrow]),Me=ge.arrow?.centerOffset!==0;return Q.useMemo(()=>({positionerStyles:Te,arrowStyles:je,arrowRef:ne,arrowUncentered:Me,side:Oe,align:ke,physicalSide:De,anchorHidden:Ae,refs:pe,context:ye,isPositioned:be,update:_e}),[Te,je,ne,Me,Oe,ke,De,Ae,pe,ye,be,_e])}function Br(e){return e!=null&&`current`in e}function Vr(e){return e===`starting`?Pe:je}function Hr(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),Ne(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},Vr(r),i],stateAttributesMapping:Ve})}var Ur=Q.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:l=0,alignOffset:u=0,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:h=!1,collisionAvoidance:g=c,style:_,...v}=e,y=Ct(),b=wr(),x=y.useState(`open`),S=y.useState(`mounted`),C=y.useState(`trackCursorAxis`),w=y.useState(`disableHoverablePopup`),T=y.useState(`floatingRootContext`),E=y.useState(`instantType`),D=y.useState(`transitionStatus`),O=zr({anchor:i,positionMethod:a,floatingRootContext:T,mounted:S,side:o,sideOffset:l,align:s,alignOffset:u,collisionBoundary:d,collisionPadding:f,sticky:m,arrowPadding:p,disableAnchorTracking:h,keepMounted:b,collisionAvoidance:g,adaptiveOrigin:y.useState(`hasViewport`)?Ir:void 0}),k=Hr(e,Q.useMemo(()=>({open:x,side:O.side,align:O.align,anchorHidden:O.anchorHidden,instant:C===`none`?E:`tracking-cursor`}),[x,O.side,O.align,O.anchorHidden,C,E]),{styles:O.positionerStyles,transitionStatus:D,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!S,inert:!x||C===`both`||w});return(0,Z.jsx)(Dr.Provider,{value:O,children:k})}),Wr={...Ve,...et},Gr=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Ct(),{side:s,align:c}=Or(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`disabled`),h=o.useState(`closeDelay`);ye({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),tr(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return Ne(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[f,Vr(d),a],stateAttributesMapping:Wr})}),Kr=a({method:`GET`}).handler(i(`aa46310016bb8a58b273a648ffd498c87f1f450d12827e30110a3b83ba6a27d9`)),qr=a({method:`POST`}).handler(i(`ed679b4e1e05e903a5d4ba4a70d9b9d883991ab22ed59b4d2d69078941818415`)),Jr=a({method:`GET`}).handler(i(`169566e7637a22599b4eb32ee3775574e99677406922bbef7482a102036c33dd`)),Yr=a({method:`POST`}).handler(i(`27d7eba0b6a2257949392fdd56057275a5c5366484ae01faf3b5897a225ecd83`)),Xr=a({method:`POST`}).handler(i(`a6384dc7154d9930422d29396f5de64b3ac69c62ad3824bc4a22d745fc07b293`));function Zr(e,t){let n=new Set,r=[];for(let i of[...e,...t])n.has(i.id)||(n.add(i.id),r.push(i));return r.sort((e,t)=>e.ts<t.ts?-1:+(e.ts>t.ts)),r}var Qr=16,$r=`rounded-[4px]`,ei=`h-5 w-[18px] shrink-0 ${$r}`;function ti({run:e,onClick:t}){let n=e.error||e.message||``,r=e.durationMs?` · ${_t(e.durationMs)}`:``;return(0,Z.jsxs)(mr,{children:[(0,Z.jsx)(Sr,{render:(0,Z.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),t()},"aria-label":ct(e),className:`${ei} cursor-pointer transition-opacity hover:opacity-70`,style:{background:vt(e),opacity:ot(e),...e.running?dt:{}}})}),(0,Z.jsx)(Er,{children:(0,Z.jsx)(Ur,{sideOffset:8,children:(0,Z.jsxs)(Gr,{className:`glass-strong pointer-events-none max-w-[340px] rounded-control px-3.5 py-2.5 text-meta leading-snug text-primary`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,Z.jsx)(`span`,{className:`size-2 shrink-0 rounded-[2px]`,style:{background:vt(e)}}),ct(e),(0,Z.jsxs)(`span`,{className:`ml-auto whitespace-nowrap pl-3 font-mono text-caption font-normal text-secondary`,children:[lt(e.ts),r]})]}),n&&(0,Z.jsx)(`div`,{className:`mt-1.5 max-h-[150px] overflow-hidden whitespace-pre-wrap ${e.error?`text-accent`:`text-secondary`}`,children:n})]})})})]})}function ni({count:e,onClick:t,loading:n}){return e?(0,Z.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),t()},className:`flex h-5 w-[18px] shrink-0 items-center justify-center overflow-hidden border border-wire px-0 font-mono text-[9px] leading-none text-disabled transition-colors hover:border-display hover:text-primary ${$r} ${n?`animate-pulse`:`cursor-pointer`}`,title:`${e} more - click to reveal`,children:n?`…`:e}):null}function ri({job:e,runs:t,total:n,onLoadMore:r,onPickRun:i}){let a=t,o=e.enabled,s=a.length,c=Math.max(0,n-s),l=yt(),[u,d]=(0,Q.useState)(-1),[f,p]=(0,Q.useState)(!1),m=Math.max(0,s-16),h=u<0?m:Math.min(u,m),g=Math.min(h+16,s),_=a.slice(h,g),v=c+h,y=s-g,b=y===0,x=async()=>{let e=h-Qr;if(e<0&&c>0&&!f){p(!0);let e=await r().catch(()=>0);p(!1),d(Math.max(0,h+e-Qr));return}d(Math.max(0,e))},S=()=>{let e=h+Qr;d(e>=m?-1:e)},C=!!(e.running||e.queued)&&b,w=b&&o&&!!e.nextRun&&!C;return(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-[3px] overflow-x-auto`,children:[(0,Z.jsx)(ni,{count:v,onClick:x,loading:f}),_.map(e=>(0,Z.jsx)(ti,{run:e,onClick:()=>i(e)},e.id)),w?(0,Z.jsxs)(`div`,{className:`ml-1 flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`w-12 border-t border-dashed border-wire`}),(0,Z.jsx)(`span`,{className:`size-[11px] shrink-0 rounded-full border border-wire`,title:l?`Next scheduled run · ${lt(e.nextRun)}`:void 0}),(0,Z.jsx)(`span`,{className:`text-caption text-disabled`,children:l?st(e.nextRun):``})]}):!b&&(0,Z.jsx)(ni,{count:y,onClick:S})]})}function ii(e,t,n=Date.now()){let r=t?Date.parse(t):NaN;if(!Number.isFinite(r))return`offline`;let i=n-r;return e&&i<3e4?`online`:i<216e5?`asleep`:`offline`}function ai(e){let t=/^\s*v?(\d+)\.(\d+)\.(\d+)/.exec(e);return t?[Number(t[1]),Number(t[2]),Number(t[3])]:null}function oi(e){return/^\s*v?\d+\.\d+\.\d+-/.test(e)}function si(e,t){if(!e||!t)return!1;let n=ai(e),r=ai(t);if(!n||!r)return!1;for(let e=0;e<3;e++){let t=n[e],i=r[e];if(t<i)return!0;if(t>i)return!1}return oi(e)&&!oi(t)}function ci(e,t,n,r){let i=`${n} daemon start --server-url ${e} --connect-key ${t}`;return r?i:`npm install -g @kky42/pievo@latest && ${i}`}function li(e,t){let n=`${e} daemon restart`;return t?n:`npm install -g @kky42/pievo@latest && ${n}`}function ui(e,t,n){return ci(typeof window<`u`?window.location.origin:`http://127.0.0.1:3000`,e,t,n)}function di({text:e}){let[t,n]=(0,Q.useState)(!1);return(0,Z.jsx)(`button`,{className:mt,onClick:()=>{navigator.clipboard?.writeText(e),n(!0),setTimeout(()=>n(!1),1400)},children:t?`Copied ✓`:`Copy`})}function fi({open:e,onClose:t,teamId:n}){let[r,i]=(0,Q.useState)([]),[a,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{if(!e){h(null);return}let t=!0;return _(null),y(!1),o().then(e=>{t&&_(e)}).catch(()=>{t&&y(!0)}),()=>{t=!1}},[e]);let b=(0,Q.useCallback)(async()=>{try{i(await Kr({data:n}))}catch{}},[n]),x=(0,Q.useRef)(e);x.current=e,(0,Q.useEffect)(()=>{if(!e||a)return;b();let t=setInterval(()=>x.current&&void b(),3e3);return()=>clearInterval(t)},[e,a,b]),(0,Q.useEffect)(()=>{if(!a)return;let e=!0,t=async()=>{let t=await Jr({data:a.id}).catch(()=>void 0);!e||t===void 0||(l(t),t?.online&&t.hostname&&d(e=>e||t.hostname||``))};t();let n=setInterval(t,2e3);return()=>{e=!1,clearInterval(n)}},[a]);async function S(){p(!0),h(null);try{let e=await qr({data:n});if(`error`in e){h(e.error);return}l(null),d(``),s(e)}finally{p(!1)}}async function C(){a&&await Xr({data:a.id}),s(null),l(null),await b()}async function w(){a&&u.trim()&&await Yr({data:{id:a.id,name:u.trim()}}),s(null),l(null),await b()}async function T(e){h(null);let t=await Xr({data:e});if(!t.ok){h(t.error??`Could not delete this machine.`),await b();return}await b()}let E=!!c?.online;return a?(0,Z.jsxs)(Ke,{open:e,onClose:C,children:[(0,Z.jsx)(ze,{title:E?`Computer connected`:`Connect computer`}),E?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`mt-5 flex items-center gap-3 rounded-control border border-hairline bg-success-soft px-4 py-3`,children:[(0,Z.jsx)(`span`,{className:`text-xl text-success`,children:`✓`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-[15px] font-medium text-display`,children:`Computer connected successfully!`}),(0,Z.jsxs)(`div`,{className:`text-label text-secondary`,children:[c?.hostname??`unknown`,c?.platform?` - ${c.platform} ${c.arch??``}`:``]})]})]}),(0,Z.jsxs)(`div`,{className:`mt-5`,children:[(0,Z.jsx)(`label`,{className:pt,children:`Computer name`}),(0,Z.jsx)(`input`,{className:ht,value:u,onChange:e=>d(e.target.value),placeholder:c?.hostname??`My computer`}),(0,Z.jsx)(`div`,{className:`mt-1 text-label text-secondary`,children:`A friendly name for this computer.`})]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`mt-5 text-body font-medium text-display`,children:`Run this command on your computer to connect:`}),g?(0,Z.jsxs)(`div`,{className:`mt-2 flex items-start gap-2`,children:[(0,Z.jsx)(`pre`,{className:`flex-1 overflow-x-auto whitespace-pre-wrap break-all rounded-control bg-display p-4 font-mono text-label leading-relaxed text-paper`,children:ui(a.token,g.pievoCli,g.customCli)}),(0,Z.jsx)(di,{text:ui(a.token,g.pievoCli,g.customCli)})]}):(0,Z.jsx)(`div`,{className:`mt-2 text-body text-secondary`,children:v?`Could not load the connection command. Close and try again.`:`Loading connection command…`}),(0,Z.jsxs)(`div`,{className:`mt-4 flex items-center gap-2.5 rounded-control border border-hairline bg-warn-soft px-4 py-3`,children:[(0,Z.jsx)(`span`,{className:`inline-block h-2.5 w-2.5 animate-pulse rounded-full bg-rubik-orange`}),(0,Z.jsx)(`span`,{className:`text-[14px] font-medium text-warn`,children:`Waiting for computer to connect…`})]})]}),(0,Z.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,Z.jsx)(`button`,{className:mt,onClick:()=>void C(),children:`Cancel`}),(0,Z.jsx)(`button`,{className:ft,disabled:!E||!u.trim(),onClick:()=>void w(),children:`Done`})]})]}):(0,Z.jsxs)(Ke,{open:e,onClose:t,children:[(0,Z.jsx)(ze,{title:`Machines`,sub:`Each machine runs a pievo daemon that executes your loops via your local coding agent.`}),(0,Z.jsx)(We,{children:`Connected machines`}),m&&(0,Z.jsx)(gt,{message:m,onDismiss:()=>h(null)}),r.length===0&&(0,Z.jsx)(`div`,{className:`py-3 text-body text-secondary`,children:`No machines yet.`}),(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2`,children:r.map(e=>{let t=ii(e.online,e.lastSeen),n=t===`online`?`bg-rubik-green`:t===`asleep`?`bg-rubik-yellow`:`bg-disabled`,r=t===`online`?`online`:t===`asleep`?`asleep${e.lastSeen?` · seen ${at(e.lastSeen)}`:``}`:e.lastSeen?`offline · seen ${at(e.lastSeen)}`:`offline`;return(0,Z.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-control border border-hairline bg-surface px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,Z.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full ${n}`,title:t}),(0,Z.jsx)(`span`,{className:`text-[15px] font-medium text-display`,children:e.name}),(0,Z.jsxs)(`span`,{className:`text-label text-secondary`,children:[r,e.platform?` · ${e.platform} ${e.arch??``}`:``,e.loopCount>0?` · ${e.loopCount} loop${e.loopCount===1?``:`s`}`:``]})]}),(0,Z.jsx)(`button`,{className:ut,disabled:e.loopCount>0,title:e.loopCount>0?`Delete its loops first`:void 0,onClick:()=>void T(e.id),children:`Delete`})]}),(0,Z.jsx)(`div`,{className:`text-label text-secondary`,children:bt(e.daemonProtocol).label}),!bt(e.daemonProtocol).supported&&(0,Z.jsx)(`div`,{className:`text-label text-accent`,children:`Daemon upgrade required to stop a running process`}),!e.online&&!e.token&&(0,Z.jsx)(`div`,{className:`text-label text-secondary`,children:`Reconnect command available from the machine owner's account.`}),!e.online&&e.token&&!g&&(0,Z.jsx)(`div`,{className:`text-label text-secondary`,children:v?`Could not load the reconnect command. Close and try again.`:`Loading reconnect command…`}),!e.online&&e.token&&g&&(0,Z.jsxs)(`details`,{children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer select-none text-label font-medium text-secondary marker:content-[''] hover:text-display`,children:`Reconnect command`}),(0,Z.jsxs)(`div`,{className:`mt-2 flex items-start gap-2`,children:[(0,Z.jsx)(`pre`,{className:`flex-1 overflow-x-auto whitespace-pre-wrap break-all rounded-control bg-display p-3 font-mono text-caption leading-relaxed text-paper`,children:ui(e.token,g.pievoCli,g.customCli)}),(0,Z.jsx)(di,{text:ui(e.token,g.pievoCli,g.customCli)})]})]}),e.needsUpdate&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 rounded-control border border-warn/40 bg-warn/10 p-3`,children:[(0,Z.jsx)(`div`,{className:`text-label font-medium text-primary`,children:`Daemon needs update before this server will dispatch runs.`}),(0,Z.jsxs)(`div`,{className:`text-label text-secondary`,children:[`running `,e.daemonVersion?`v${e.daemonVersion}`:`unknown version`,` · required v`,e.requiredDaemonVersion]}),g?(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Z.jsx)(`pre`,{className:`flex-1 overflow-x-auto whitespace-pre-wrap break-all rounded-control bg-display p-3 font-mono text-caption leading-relaxed text-paper`,children:li(g.pievoCli,g.customCli)}),(0,Z.jsx)(di,{text:li(g.pievoCli,g.customCli)})]}):(0,Z.jsx)(`div`,{className:`text-label text-secondary`,children:v?`Could not load the upgrade command. Close and try again.`:`Loading upgrade command…`})]}),!e.needsUpdate&&si(e.daemonVersion,e.latestDaemonVersion)&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsxs)(`div`,{className:`text-label text-secondary`,children:[`daemon v`,e.daemonVersion,` · upgrade available (v`,e.latestDaemonVersion,`)`]}),g?(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Z.jsx)(`pre`,{className:`flex-1 overflow-x-auto whitespace-pre-wrap break-all rounded-control bg-display p-3 font-mono text-caption leading-relaxed text-paper`,children:li(g.pievoCli,g.customCli)}),(0,Z.jsx)(di,{text:li(g.pievoCli,g.customCli)})]}):(0,Z.jsx)(`div`,{className:`text-label text-secondary`,children:v?`Could not load the upgrade command. Close and try again.`:`Loading upgrade command…`})]})]},e.id)})}),(0,Z.jsx)(`div`,{className:`mt-6`,children:(0,Z.jsx)(`button`,{className:ft,disabled:f,onClick:()=>void S(),children:f?`Preparing…`:`+ Connect computer`})})]})}var pi=a({method:`GET`}).handler(i(`ced5641f28e3e64d3b8773ea4c875b78ee305bd08caba90a2207e86ef1ab3327`)),mi=a({method:`POST`}).handler(i(`d6cb1ea6f7fdaf940fbbe91d6b0898a0d5ac2308f8bc572dc3b856824a1f4581`)),hi=a({method:`POST`}).handler(i(`9defc1b5d0f4316d61621e2c4614a70dc052ad6b7a3aa2ead00836f7d5cb5b4c`)),gi=a({method:`POST`}).handler(i(`a4e3ae06af7087a3dc291236cf6d5ad272e2f754884c1f948e75a18a4ebada93`));export{fi as a,Kr as c,gi as i,gr as l,hi as n,ri as o,pi as r,Zr as s,mi as t,jt as u};
@@ -1,3 +1,3 @@
1
- import{n as e,s as t,t as n}from"./jsx-runtime-BseJUIpC.js";import{A as r,I as i,P as a,T as o}from"./loopApi-C_Dtw-nL.js";import{t as s}from"./useRouter-DsjH8G0p.js";function c(e){return e[e.length-1]}function l(e){return typeof e==`function`}function u(e,t){return l(e)?e(t):e}var d=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable;function p(e){for(let t in e)if(d.call(e,t))return!0;return!1}var m=()=>Object.create(null),h=(e,t)=>g(e,t,m);function g(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=b(e)&&b(i);if(!a&&!(v(e)&&v(i)))return i;let o=a?e:_(e);if(!o)return i;let s=a?i:_(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),f=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],p=i[o];if(l===p){u[o]=l,(a?t<c:d.call(e,o))&&f++;continue}if(l===null||p===null||typeof l!=`object`||typeof p!=`object`){u[o]=p;continue}let m=g(l,p,n,r+1);u[o]=m,m===l&&f++}return c===l&&f===c?e:u}function _(e){let t=Object.getOwnPropertyNames(e);for(let n of t)if(!f.call(e,n))return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;let r=t;for(let t of n){if(!f.call(e,t))return!1;r.push(t)}return r}function v(e){if(!y(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!y(n)||!n.hasOwnProperty(`isPrototypeOf`))}function y(e){return Object.prototype.toString.call(e)===`[object Object]`}function b(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function x(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!x(e[r],t[r],n))return!1;return!0}if(v(e)&&v(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!x(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!x(e[o],t[o],n)))return!1;return i===a}return!1}function S(e){let t,n,r=new Promise((e,r)=>{t=e,n=r});return r.status=`pending`,r.resolve=n=>{r.status=`resolved`,r.value=n,t(n),e?.(n)},r.reject=e=>{r.status=`rejected`,n(e)},r}function ee(e){return typeof e?.message==`string`?e.message.startsWith(`Failed to fetch dynamically imported module`)||e.message.startsWith(`error loading dynamically imported module`)||e.message.startsWith(`Importing a module script failed`):!1}function te(e){return!!(e&&typeof e==`object`&&typeof e.then==`function`)}function ne(e){return e.replace(/[\x00-\x1f\x7f]/g,``)}function re(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return ne(t)}var ie=[`http:`,`https:`,`mailto:`,`tel:`];function ae(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}var oe={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},se=/[&><\u2028\u2029]/g;function ce(e){return e.replace(se,e=>oe[e])}function le(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=re(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=re(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function ue(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function de(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function fe(e){let t=new Map,n,r,i=e=>{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var C=4,pe=5;function me(e){let t=e.indexOf(`{`);if(t===-1)return null;let n=e.indexOf(`}`,t);return n===-1||t+1>=e.length?null:[t,n]}function he(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=me(a);if(o){let[r,s]=o,c=a.charCodeAt(r+1);if(c===45){if(r+2<a.length&&a.charCodeAt(r+2)===36){let e=r+3,a=s;if(e<a)return n[0]=3,n[1]=t+r,n[2]=t+e,n[3]=t+a,n[4]=t+s+1,n[5]=i,n}}else if(c===36){let a=r+1,o=r+2;return o===s?(n[0]=2,n[1]=t+r,n[2]=t+a,n[3]=t+o,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+r,n[2]=t+o,n[3]=t+s,n[4]=t+s+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function ge(e,t,n,r,i,a,o){o?.(n);let s=r;{let r=n.fullPath??n.from,o=r.length,c=n.options?.caseSensitive??e,l=n.options?.params?.parse??n.options?.parseParams;for(;s<o;){let e=he(r,s,t),o,u=s,d=e[5];switch(s=d+1,a++,e[0]){case 0:{let t=r.substring(e[2],e[3]);if(c){let e=i.static?.get(t);if(e)o=e;else{i.static??=new Map;let e=E(n.fullPath??n.from);e.parent=i,e.depth=a,o=e,i.static.set(t,e)}}else{let e=t.toLowerCase(),r=i.staticInsensitive?.get(e);if(r)o=r;else{i.staticInsensitive??=new Map;let t=E(n.fullPath??n.from);t.parent=i,t.depth=a,o=t,i.staticInsensitive.set(e,t)}}break}case 1:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.dynamic?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=D(1,n.fullPath??n.from,f,p,m);o=e,e.depth=a,e.parent=i,i.dynamic??=[],i.dynamic.push(e)}break}case 3:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.optional?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=D(3,n.fullPath??n.from,f,p,m);o=e,e.parent=i,e.depth=a,i.optional??=[],i.optional.push(e)}break}case 2:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),l=c&&!!(t||s),f=t?l?t:t.toLowerCase():void 0,p=s?l?s:s.toLowerCase():void 0,m=D(2,n.fullPath??n.from,l,f,p);o=m,m.parent=i,m.depth=a,i.wildcard??=[],i.wildcard.push(m)}}i=o}if(l&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=E(n.fullPath??n.from);e.kind=pe,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let u=(n.path||!n.children)&&!n.isRoot;if(u&&r.endsWith(`/`)){let e=E(n.fullPath??n.from);e.kind=C,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=l??null,i.priority=n.options?.params?.priority??0,u&&!i.route&&(i.route=n,i.fullPath=n.fullPath??n.from)}if(n.children)for(let r of n.children)ge(e,t,r,s,i,a,o)}function w(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function T(e){if(e.pathless)for(let t of e.pathless)T(t);if(e.static)for(let t of e.static.values())T(t);if(e.staticInsensitive)for(let t of e.staticInsensitive.values())T(t);if(e.dynamic?.length){e.dynamic.sort(w);for(let t of e.dynamic)T(t)}if(e.optional?.length){e.optional.sort(w);for(let t of e.optional)T(t)}if(e.wildcard?.length){e.wildcard.sort(w);for(let t of e.wildcard)T(t)}}function E(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function D(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function O(e,t){let n=E(`/`),r=new Uint16Array(6);for(let t of e)ge(!1,r,t,1,n,0);T(n),t.masksTree=n,t.flatCache=fe(1e3)}function _e(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=j(e,t.masksTree);return t.flatCache.set(e,r),r}function ve(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=E(`/`),ge(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),j(r,o,n)}function k(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=j(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=be(a.route)),t.matchCache.set(r,a),a}function A(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function ye(e,t=!1,n){let r=E(e.fullPath),i=new Uint16Array(6),o={},s={},c=0;return ge(t,i,e,1,r,0,e=>{if(n?.(e,c),e.id in o&&a(),o[e.id]=e,c!==0&&e.path){let t=A(e.fullPath);(!s[t]||e.fullPath.endsWith(`/`))&&(s[t]=e)}c++}),T(r),{processedTree:{segmentTree:r,singleCache:fe(1e3),matchCache:fe(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:s}}function j(e,t,n=!1){let r=e.split(`/`),i=Se(e,r,t,n);if(!i)return null;let[a]=M(e,r,i);return{route:i.node.route,rawParams:a}}function M(e,t,n){let r=xe(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s<r.length;o++,s++,c++,l++){let u=r[s];if(u.kind===C)break;if(u.kind===pe){l--,o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1){i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0;if(e.charCodeAt(t)===123){let n=u.suffix?.length??0,r=e.substring(t+2,e.length-n-1),i=d.substring(t,d.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<s){o--,c=f-1;continue}i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0,r=u.suffix?.length??0,p=e.substring(t+3,e.length-r-1),m=u.suffix||u.prefix?d.substring(t,d.length-r):d;m&&(a[p]=decodeURIComponent(m))}else if(u.kind===2){let t=u,n=e.substring(f+(t.prefix?.length??0),e.length-(t.suffix?.length??0)),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,segment:l}]}function be(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function xe(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Se(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!c(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}],l=null,u=null;for(;s.length;){let n=s.pop(),{node:i,index:c,skipped:d,depth:f,statics:p,dynamics:m,optionals:h}=n,{extract:g,rawParams:_}=n;if(i.kind===2&&i.route&&!F(u,n))continue;if(i.parse){if(!P(e,t,n))continue;_=n.rawParams,g=n.extract}r&&i.route&&i.kind!==C&&F(l,n)&&(l=n);let v=c===o;if(v&&(i.route&&(!a||i.kind===C||i.kind===2)&&F(u,n)&&(u=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let y=v?void 0:t[c],b;if(v&&i.index){let n={node:i.index,index:c,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_},r=!0;if(i.index.parse&&(P(e,t,n)||(r=!1)),r){if(!m&&!h&&!d&&Ce(p,o))return n;F(u,n)&&(u=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!(r&&(v||!(n.caseSensitive?y:b??=y.toLowerCase()).startsWith(r)))){if(a){if(v)continue;let e=t.slice(c).join(`/`).slice(-a.length);if((n.caseSensitive?e:e.toLowerCase())!==a)continue}s.push({node:n,index:o,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}if(i.optional){let e=d|1<<f,t=f+1;for(let n=i.optional.length-1;n>=0;n--){let r=i.optional[n];s.push({node:r,index:c,skipped:e,depth:t,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v)for(let e=i.optional.length-1;e>=0;e--){let n=i.optional[e],{prefix:r,suffix:a}=n;if(r||a){let e=n.caseSensitive?y:b??=y.toLowerCase();if(r&&!e.startsWith(r)||a&&!e.endsWith(a))continue}s.push({node:n,index:c+1,skipped:d,depth:t,statics:p,dynamics:m,optionals:h+N(o,c),extract:g,rawParams:_})}}if(!v&&i.dynamic&&y)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?y:b??=y.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:c+1,skipped:d,depth:f+1,statics:p,dynamics:m+N(o,c),optionals:h,extract:g,rawParams:_})}if(!v&&i.staticInsensitive){let e=i.staticInsensitive.get(b??=y.toLowerCase());e&&s.push({node:e,index:c+1,skipped:d,depth:f+1,statics:p+N(o,c),dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v&&i.static){let e=i.static.get(y);e&&s.push({node:e,index:c+1,skipped:d,depth:f+1,statics:p+N(o,c),dynamics:m,optionals:h,extract:g,rawParams:_})}if(i.pathless){let e=f+1;for(let t=i.pathless.length-1;t>=0;t--){let n=i.pathless[t];s.push({node:n,index:c,skipped:d,depth:e,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}}if(u)return u;if(r&&l){let n=l.index;for(let e=0;e<l.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return l.rawParams??=Object.create(null),l.rawParams[`**`]=decodeURIComponent(r),l}return null}function N(e,t){return 2**(e-t-1)}function Ce(e,t){return e===2**(t-1)-1}function P(e,t,n){let r,i;try{[r,i]=M(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function F(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===C)>(e.node.kind===C)||t.node.kind===C==(e.node.kind===C)&&t.depth>e.depth))):!0}function I(e){return we(e.filter(e=>e!==void 0).join(`/`))}function we(e){return e.replace(/\/{2,}/g,`/`)}function Te(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function Ee(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function De(e){return Ee(Te(e))}function Oe(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function ke(e,t,n){return Oe(e,n)===Oe(t,n)}function Ae({base:e,to:t,trailingSlash:n=`never`,cache:r}){let i=t.startsWith(`/`),a=!i&&t===`.`,o;if(r){o=i?t:a?e:e+`\0`+t;let n=r.get(o);if(n)return n}let s;if(a)s=e.split(`/`);else if(i)s=t.split(`/`);else{for(s=e.split(`/`);s.length>1&&c(s)===``;)s.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&s.push(r):s=[r]:r===`..`?s.pop():r===`.`||s.push(r)}}s.length>1&&(c(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let l=we(s.join(`/`))||`/`;return o&&r&&r.set(o,l),l}function je(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function Me(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>Pe(e,n)).join(`/`):Pe(r,n):r}function Ne({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s<o;){let r=s;c=he(e,r,c);let o=c[5];if(s=o+1,r===o)continue;let u=c[0];if(u===0){l+=`/`+e.substring(r,o);continue}if(u===2){let s=t._splat;a._splat=s,a[`*`]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o);if(!s){i=!0,(u||d)&&(l+=`/`+u+d);continue}let f=Me(`_splat`,t,n);l+=`/`+u+f+d;continue}if(u===1){let s=e.substring(c[2],c[3]);!i&&!(s in t)&&(i=!0),a[s]=t[s];let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=Me(s,t,n)??`undefined`;l+=`/`+u+f+d;continue}if(u===3){let i=e.substring(c[2],c[3]),s=t[i];if(s==null)continue;a[i]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=Me(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function Pe(e,t){let n=encodeURIComponent(e);return t?.(n)??n}var Fe=`__root__`,Ie=`Error preloading route! ☝️`,Le=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=Fe:this.parentRoute||a();let r=n?Fe:t?.path;r&&r!==`/`&&(r=Te(r));let i=t?.id||r,o=n?Fe:I([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),o!==`__root__`&&(o=I([`/`,o]));let s=o===`__root__`?`/`:I([this.parentRoute.fullPath,r]);this._path=r,this._id=o,this._fullPath=s,this._to=Ee(s)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>r({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},Re=class extends Le{constructor(e){super(e)}},L=t(e(),1),ze=L.use,Be=typeof window<`u`?L.useLayoutEffect:L.useEffect;function Ve(e){let t=L.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function He(e,t,n={},r={}){L.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!=`function`)return;let i=new IntersectionObserver(([e])=>{t(e)},n);return i.observe(e.current),()=>{i.disconnect()}},[t,n,r.disabled,e])}function Ue(e){let t=L.useRef(null);return L.useImperativeHandle(e,()=>t.current,[]),t}var R=n();function We({children:e,fallback:t=null}){return Ge()?(0,R.jsx)(L.Fragment,{children:e}):(0,R.jsx)(L.Fragment,{children:t})}function Ge(){return L.useSyncExternalStore(Ke,()=>!0,()=>!1)}function Ke(){return()=>{}}var qe=L.createContext(void 0),Je=L.createContext(void 0),Ye=o();function Xe(e,t){return e===t}function Ze(e,t,n=Xe){let r=(0,L.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,L.useCallback)(()=>e?.get(),[e]);return(0,Ye.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var Qe={get(){},subscribe(){return{unsubscribe(){}}}};function $e(e,t){let n=L.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=g(n.current,i):i}}function z(e){let t=s(),n=L.useContext(e.from?Je:qe),r=e.from?t.stores.getRouteMatchStore(e.from):t.stores.matchStores.get(n),i=$e(e,t),o=Ze(r??Qe,e=>e?i(e):Qe);if(o!==Qe)return o;(e.shouldThrow??!0)&&a()}function et(e){return z({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function tt(e){let{select:t,...n}=e;return z({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function nt(e){return z({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function rt(e){return z({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function it(e){let t=s();return L.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function at(e){return z({...e,select:t=>e.select?e.select(t.context):t.context})}var ot=t(i(),1);function st(e,t){let n=s(),r=Ue(t),{activeProps:i,inactiveProps:a,activeOptions:o,to:c,preload:l,preloadDelay:d,preloadIntentProximity:f,hashScrollIntoView:p,replace:m,startTransition:h,resetScroll:g,viewTransition:_,children:v,target:y,disabled:b,style:S,className:ee,onClick:te,onBlur:ne,onFocus:re,onMouseEnter:ie,onMouseLeave:oe,onTouchStart:se,ignoreBlocker:ce,params:le,search:ue,hash:de,state:fe,mask:C,reloadDocument:pe,unsafeRelative:me,from:he,_fromLocation:ge,...w}=e,T=Ge(),E=L.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),D=Ze(n.stores.location,e=>e,(e,t)=>e.href===t.href),O=L.useMemo(()=>{let e={_fromLocation:D,...E};return n.buildLocation(e)},[n,D,E]),_e=O.maskedLocation?O.maskedLocation.publicHref:O.publicHref,ve=O.maskedLocation?O.maskedLocation.external:O.external,k=L.useMemo(()=>mt(_e,ve,n.history,b),[b,ve,_e,n.history]),A=L.useMemo(()=>{if(k?.external)return ae(k.href,n.protocolAllowlist)?void 0:k.href;if(!ht(c)&&!(typeof c!=`string`||c.indexOf(`:`)===-1))try{return new URL(c),ae(c,n.protocolAllowlist)?void 0:c}catch{}},[c,k,n.protocolAllowlist]),ye=L.useMemo(()=>{if(A)return!1;if(o?.exact){if(!ke(D.pathname,O.pathname,n.basepath))return!1}else{let e=Oe(D.pathname,n.basepath),t=Oe(O.pathname,n.basepath);if(!(e.startsWith(t)&&(e.length===t.length||e[t.length]===`/`)))return!1}return(o?.includeSearch??!0)&&!x(D.search,O.search,{partial:!o?.exact,ignoreUndefined:!o?.explicitUndefined})?!1:o?.includeHash?T&&D.hash===O.hash:!0},[o?.exact,o?.explicitUndefined,o?.includeHash,o?.includeSearch,D,A,T,O.hash,O.pathname,O.search,n.basepath]),j=ye?u(i,{})??lt:ct,M=ye?ct:u(a,{})??ct,be=[ee,j.className,M.className].filter(Boolean).join(` `),xe=(S||j.style||M.style)&&{...S,...j.style,...M.style},[Se,N]=L.useState(!1),Ce=L.useRef(!1),P=e.reloadDocument||A?!1:l??n.options.defaultPreload,F=d??n.options.defaultPreloadDelay??0,I=L.useCallback(()=>{n.preloadRoute({...E,_builtLocation:O}).catch(e=>{console.warn(e),console.warn(Ie)})},[n,E,O]);He(r,L.useCallback(e=>{e?.isIntersecting&&I()},[I]),pt,{disabled:!!b||P!==`viewport`}),L.useEffect(()=>{Ce.current||!b&&P===`render`&&(I(),Ce.current=!0)},[b,I,P]);let we=e=>{let t=e.currentTarget.getAttribute(`target`),r=y===void 0?t:y;if(!b&&!_t(e)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0){e.preventDefault(),(0,ot.flushSync)(()=>{N(!0)});let t=n.subscribe(`onResolved`,()=>{t(),N(!1)});n.navigate({...E,replace:m,resetScroll:g,hashScrollIntoView:p,startTransition:h,viewTransition:_,ignoreBlocker:ce})}};if(A)return{...w,ref:r,href:A,...v&&{children:v},...y&&{target:y},...b&&{disabled:b},...S&&{style:S},...ee&&{className:ee},...te&&{onClick:te},...ne&&{onBlur:ne},...re&&{onFocus:re},...ie&&{onMouseEnter:ie},...oe&&{onMouseLeave:oe},...se&&{onTouchStart:se}};let Te=e=>{if(b||P!==`intent`)return;if(!F){I();return}let t=e.currentTarget;if(B.has(t))return;let n=setTimeout(()=>{B.delete(t),I()},F);B.set(t,n)},Ee=e=>{b||P!==`intent`||I()},De=e=>{if(b||!P||!F)return;let t=e.currentTarget,n=B.get(t);n&&(clearTimeout(n),B.delete(t))};return{...w,...j,...M,href:k?.href,ref:r,onClick:V([te,we]),onBlur:V([ne,De]),onFocus:V([re,Te]),onMouseEnter:V([ie,Te]),onMouseLeave:V([oe,De]),onTouchStart:V([se,Ee]),disabled:!!b,target:y,...xe&&{style:xe},...be&&{className:be},...b&&ut,...ye&&dt,...T&&Se&&ft}}var ct={},lt={className:`active`},ut={role:`link`,"aria-disabled":!0},dt={"data-status":`active`,"aria-current":`page`},ft={"data-transitioning":`transitioning`},B=new WeakMap,pt={rootMargin:`100px`},V=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function mt(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function ht(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var gt=L.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=st(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return L.createElement(`a`,t,o)}return L.createElement(n,a,o)});function _t(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var vt=class extends Le{constructor(e){super(e),this.useMatch=e=>z({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>at({...e,from:this.id}),this.useSearch=e=>rt({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>nt({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>tt({...e,from:this.id}),this.useLoaderData=e=>et({...e,from:this.id}),this.useNavigate=()=>it({from:this.fullPath}),this.Link=L.forwardRef((e,t)=>(0,R.jsx)(gt,{ref:t,from:this.fullPath,...e}))}};function yt(e){return new vt(e)}var bt=class extends Re{constructor(e){super(e),this.useMatch=e=>z({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>at({...e,from:this.id}),this.useSearch=e=>rt({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>nt({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>tt({...e,from:this.id}),this.useLoaderData=e=>et({...e,from:this.id}),this.useNavigate=()=>it({from:this.fullPath}),this.Link=L.forwardRef((e,t)=>(0,R.jsx)(gt,{ref:t,from:this.fullPath,...e}))}};function xt(e){return new bt(e)}function St(e){return new Ct(e,{silent:!0}).createRoute}var Ct=class{constructor(e,t){this.path=e,this.createRoute=e=>{let t=yt(e);return t.isRoot=!1,t},this.silent=t?.silent}};function wt(e,t){let n,r,i,a,o=()=>(n||=e().then(e=>{n=void 0,r=e[t??`default`]}).catch(e=>{if(i=e,ee(i)&&i instanceof Error&&typeof window<`u`&&typeof sessionStorage<`u`){let e=`tanstack_router_reload:${i.message}`;sessionStorage.getItem(e)||(sessionStorage.setItem(e,`1`),a=!0)}}),n),s=function(e){if(a)throw window.location.reload(),new Promise(()=>{});if(i)throw i;if(!r)if(ze)ze(o());else throw o();return L.createElement(r,e)};return s.preload=o,s}var Tt=Object.create(null),H=e=>({}),U=new Proxy(Tt,{get(e,t){return H()[t]??Tt[t]},has(e,t){return t in H()||t in Tt},set(e,t,n){let r=H(!0);return r[t]=n,!0},deleteProperty(e,t){if(!t)return!1;let n=H(!0);return delete n[t],!0},ownKeys(){let e=H(!0);return Object.keys(e)}});U.NODE_ENV;function W(e,t){return typeof process<`u`?{}[e]??t:typeof Deno<`u`?Deno.env.get(e)??t:typeof Bun<`u`?Bun.env[e]??t:t}Object.freeze({get BETTER_AUTH_SECRET(){return W(`BETTER_AUTH_SECRET`)},get AUTH_SECRET(){return W(`AUTH_SECRET`)},get BETTER_AUTH_TELEMETRY(){return W(`BETTER_AUTH_TELEMETRY`)},get BETTER_AUTH_TELEMETRY_ID(){return W(`BETTER_AUTH_TELEMETRY_ID`)},get NODE_ENV(){return W(`NODE_ENV`,`development`)},get PACKAGE_VERSION(){return W(`PACKAGE_VERSION`,`0.0.0`)},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return W(`BETTER_AUTH_TELEMETRY_ENDPOINT`,``)}});function Et(){let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):Object.prototype.hasOwnProperty.call(e,`writable`)?e.writable:e.set!==void 0}function Dt(e){let t=e.split(`
1
+ import{n as e,s as t,t as n}from"./jsx-runtime-BseJUIpC.js";import{E as r,F as i,L as a,j as o}from"./loopApi-CT1mMhlb.js";import{t as s}from"./useRouter-DsjH8G0p.js";function c(e){return e[e.length-1]}function l(e){return typeof e==`function`}function u(e,t){return l(e)?e(t):e}var d=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable;function p(e){for(let t in e)if(d.call(e,t))return!0;return!1}var m=()=>Object.create(null),h=(e,t)=>g(e,t,m);function g(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=b(e)&&b(i);if(!a&&!(v(e)&&v(i)))return i;let o=a?e:_(e);if(!o)return i;let s=a?i:_(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),f=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],p=i[o];if(l===p){u[o]=l,(a?t<c:d.call(e,o))&&f++;continue}if(l===null||p===null||typeof l!=`object`||typeof p!=`object`){u[o]=p;continue}let m=g(l,p,n,r+1);u[o]=m,m===l&&f++}return c===l&&f===c?e:u}function _(e){let t=Object.getOwnPropertyNames(e);for(let n of t)if(!f.call(e,n))return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;let r=t;for(let t of n){if(!f.call(e,t))return!1;r.push(t)}return r}function v(e){if(!y(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!y(n)||!n.hasOwnProperty(`isPrototypeOf`))}function y(e){return Object.prototype.toString.call(e)===`[object Object]`}function b(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function x(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!x(e[r],t[r],n))return!1;return!0}if(v(e)&&v(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!x(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!x(e[o],t[o],n)))return!1;return i===a}return!1}function S(e){let t,n,r=new Promise((e,r)=>{t=e,n=r});return r.status=`pending`,r.resolve=n=>{r.status=`resolved`,r.value=n,t(n),e?.(n)},r.reject=e=>{r.status=`rejected`,n(e)},r}function ee(e){return typeof e?.message==`string`?e.message.startsWith(`Failed to fetch dynamically imported module`)||e.message.startsWith(`error loading dynamically imported module`)||e.message.startsWith(`Importing a module script failed`):!1}function te(e){return!!(e&&typeof e==`object`&&typeof e.then==`function`)}function ne(e){return e.replace(/[\x00-\x1f\x7f]/g,``)}function re(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return ne(t)}var ie=[`http:`,`https:`,`mailto:`,`tel:`];function ae(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}var oe={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},se=/[&><\u2028\u2029]/g;function ce(e){return e.replace(se,e=>oe[e])}function le(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=re(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=re(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function ue(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function de(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function fe(e){let t=new Map,n,r,i=e=>{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var C=4,pe=5;function me(e){let t=e.indexOf(`{`);if(t===-1)return null;let n=e.indexOf(`}`,t);return n===-1||t+1>=e.length?null:[t,n]}function he(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=me(a);if(o){let[r,s]=o,c=a.charCodeAt(r+1);if(c===45){if(r+2<a.length&&a.charCodeAt(r+2)===36){let e=r+3,a=s;if(e<a)return n[0]=3,n[1]=t+r,n[2]=t+e,n[3]=t+a,n[4]=t+s+1,n[5]=i,n}}else if(c===36){let a=r+1,o=r+2;return o===s?(n[0]=2,n[1]=t+r,n[2]=t+a,n[3]=t+o,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+r,n[2]=t+o,n[3]=t+s,n[4]=t+s+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function ge(e,t,n,r,i,a,o){o?.(n);let s=r;{let r=n.fullPath??n.from,o=r.length,c=n.options?.caseSensitive??e,l=n.options?.params?.parse??n.options?.parseParams;for(;s<o;){let e=he(r,s,t),o,u=s,d=e[5];switch(s=d+1,a++,e[0]){case 0:{let t=r.substring(e[2],e[3]);if(c){let e=i.static?.get(t);if(e)o=e;else{i.static??=new Map;let e=E(n.fullPath??n.from);e.parent=i,e.depth=a,o=e,i.static.set(t,e)}}else{let e=t.toLowerCase(),r=i.staticInsensitive?.get(e);if(r)o=r;else{i.staticInsensitive??=new Map;let t=E(n.fullPath??n.from);t.parent=i,t.depth=a,o=t,i.staticInsensitive.set(e,t)}}break}case 1:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.dynamic?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=D(1,n.fullPath??n.from,f,p,m);o=e,e.depth=a,e.parent=i,i.dynamic??=[],i.dynamic.push(e)}break}case 3:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.optional?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=D(3,n.fullPath??n.from,f,p,m);o=e,e.parent=i,e.depth=a,i.optional??=[],i.optional.push(e)}break}case 2:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),l=c&&!!(t||s),f=t?l?t:t.toLowerCase():void 0,p=s?l?s:s.toLowerCase():void 0,m=D(2,n.fullPath??n.from,l,f,p);o=m,m.parent=i,m.depth=a,i.wildcard??=[],i.wildcard.push(m)}}i=o}if(l&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=E(n.fullPath??n.from);e.kind=pe,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let u=(n.path||!n.children)&&!n.isRoot;if(u&&r.endsWith(`/`)){let e=E(n.fullPath??n.from);e.kind=C,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=l??null,i.priority=n.options?.params?.priority??0,u&&!i.route&&(i.route=n,i.fullPath=n.fullPath??n.from)}if(n.children)for(let r of n.children)ge(e,t,r,s,i,a,o)}function w(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function T(e){if(e.pathless)for(let t of e.pathless)T(t);if(e.static)for(let t of e.static.values())T(t);if(e.staticInsensitive)for(let t of e.staticInsensitive.values())T(t);if(e.dynamic?.length){e.dynamic.sort(w);for(let t of e.dynamic)T(t)}if(e.optional?.length){e.optional.sort(w);for(let t of e.optional)T(t)}if(e.wildcard?.length){e.wildcard.sort(w);for(let t of e.wildcard)T(t)}}function E(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function D(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function O(e,t){let n=E(`/`),r=new Uint16Array(6);for(let t of e)ge(!1,r,t,1,n,0);T(n),t.masksTree=n,t.flatCache=fe(1e3)}function _e(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=j(e,t.masksTree);return t.flatCache.set(e,r),r}function ve(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=E(`/`),ge(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),j(r,o,n)}function k(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=j(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=be(a.route)),t.matchCache.set(r,a),a}function A(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function ye(e,t=!1,n){let r=E(e.fullPath),a=new Uint16Array(6),o={},s={},c=0;return ge(t,a,e,1,r,0,e=>{if(n?.(e,c),e.id in o&&i(),o[e.id]=e,c!==0&&e.path){let t=A(e.fullPath);(!s[t]||e.fullPath.endsWith(`/`))&&(s[t]=e)}c++}),T(r),{processedTree:{segmentTree:r,singleCache:fe(1e3),matchCache:fe(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:s}}function j(e,t,n=!1){let r=e.split(`/`),i=Se(e,r,t,n);if(!i)return null;let[a]=M(e,r,i);return{route:i.node.route,rawParams:a}}function M(e,t,n){let r=xe(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s<r.length;o++,s++,c++,l++){let u=r[s];if(u.kind===C)break;if(u.kind===pe){l--,o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1){i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0;if(e.charCodeAt(t)===123){let n=u.suffix?.length??0,r=e.substring(t+2,e.length-n-1),i=d.substring(t,d.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<s){o--,c=f-1;continue}i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0,r=u.suffix?.length??0,p=e.substring(t+3,e.length-r-1),m=u.suffix||u.prefix?d.substring(t,d.length-r):d;m&&(a[p]=decodeURIComponent(m))}else if(u.kind===2){let t=u,n=e.substring(f+(t.prefix?.length??0),e.length-(t.suffix?.length??0)),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,segment:l}]}function be(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function xe(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Se(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!c(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}],l=null,u=null;for(;s.length;){let n=s.pop(),{node:i,index:c,skipped:d,depth:f,statics:p,dynamics:m,optionals:h}=n,{extract:g,rawParams:_}=n;if(i.kind===2&&i.route&&!F(u,n))continue;if(i.parse){if(!P(e,t,n))continue;_=n.rawParams,g=n.extract}r&&i.route&&i.kind!==C&&F(l,n)&&(l=n);let v=c===o;if(v&&(i.route&&(!a||i.kind===C||i.kind===2)&&F(u,n)&&(u=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let y=v?void 0:t[c],b;if(v&&i.index){let n={node:i.index,index:c,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_},r=!0;if(i.index.parse&&(P(e,t,n)||(r=!1)),r){if(!m&&!h&&!d&&Ce(p,o))return n;F(u,n)&&(u=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!(r&&(v||!(n.caseSensitive?y:b??=y.toLowerCase()).startsWith(r)))){if(a){if(v)continue;let e=t.slice(c).join(`/`).slice(-a.length);if((n.caseSensitive?e:e.toLowerCase())!==a)continue}s.push({node:n,index:o,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}if(i.optional){let e=d|1<<f,t=f+1;for(let n=i.optional.length-1;n>=0;n--){let r=i.optional[n];s.push({node:r,index:c,skipped:e,depth:t,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v)for(let e=i.optional.length-1;e>=0;e--){let n=i.optional[e],{prefix:r,suffix:a}=n;if(r||a){let e=n.caseSensitive?y:b??=y.toLowerCase();if(r&&!e.startsWith(r)||a&&!e.endsWith(a))continue}s.push({node:n,index:c+1,skipped:d,depth:t,statics:p,dynamics:m,optionals:h+N(o,c),extract:g,rawParams:_})}}if(!v&&i.dynamic&&y)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?y:b??=y.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:c+1,skipped:d,depth:f+1,statics:p,dynamics:m+N(o,c),optionals:h,extract:g,rawParams:_})}if(!v&&i.staticInsensitive){let e=i.staticInsensitive.get(b??=y.toLowerCase());e&&s.push({node:e,index:c+1,skipped:d,depth:f+1,statics:p+N(o,c),dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v&&i.static){let e=i.static.get(y);e&&s.push({node:e,index:c+1,skipped:d,depth:f+1,statics:p+N(o,c),dynamics:m,optionals:h,extract:g,rawParams:_})}if(i.pathless){let e=f+1;for(let t=i.pathless.length-1;t>=0;t--){let n=i.pathless[t];s.push({node:n,index:c,skipped:d,depth:e,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}}if(u)return u;if(r&&l){let n=l.index;for(let e=0;e<l.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return l.rawParams??=Object.create(null),l.rawParams[`**`]=decodeURIComponent(r),l}return null}function N(e,t){return 2**(e-t-1)}function Ce(e,t){return e===2**(t-1)-1}function P(e,t,n){let r,i;try{[r,i]=M(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function F(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===C)>(e.node.kind===C)||t.node.kind===C==(e.node.kind===C)&&t.depth>e.depth))):!0}function I(e){return we(e.filter(e=>e!==void 0).join(`/`))}function we(e){return e.replace(/\/{2,}/g,`/`)}function Te(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function Ee(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function De(e){return Ee(Te(e))}function Oe(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function ke(e,t,n){return Oe(e,n)===Oe(t,n)}function Ae({base:e,to:t,trailingSlash:n=`never`,cache:r}){let i=t.startsWith(`/`),a=!i&&t===`.`,o;if(r){o=i?t:a?e:e+`\0`+t;let n=r.get(o);if(n)return n}let s;if(a)s=e.split(`/`);else if(i)s=t.split(`/`);else{for(s=e.split(`/`);s.length>1&&c(s)===``;)s.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&s.push(r):s=[r]:r===`..`?s.pop():r===`.`||s.push(r)}}s.length>1&&(c(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let l=we(s.join(`/`))||`/`;return o&&r&&r.set(o,l),l}function je(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function Me(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>Pe(e,n)).join(`/`):Pe(r,n):r}function Ne({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s<o;){let r=s;c=he(e,r,c);let o=c[5];if(s=o+1,r===o)continue;let u=c[0];if(u===0){l+=`/`+e.substring(r,o);continue}if(u===2){let s=t._splat;a._splat=s,a[`*`]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o);if(!s){i=!0,(u||d)&&(l+=`/`+u+d);continue}let f=Me(`_splat`,t,n);l+=`/`+u+f+d;continue}if(u===1){let s=e.substring(c[2],c[3]);!i&&!(s in t)&&(i=!0),a[s]=t[s];let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=Me(s,t,n)??`undefined`;l+=`/`+u+f+d;continue}if(u===3){let i=e.substring(c[2],c[3]),s=t[i];if(s==null)continue;a[i]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=Me(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function Pe(e,t){let n=encodeURIComponent(e);return t?.(n)??n}var Fe=`__root__`,Ie=`Error preloading route! ☝️`,Le=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=Fe:this.parentRoute||i();let r=n?Fe:t?.path;r&&r!==`/`&&(r=Te(r));let a=t?.id||r,o=n?Fe:I([this.parentRoute.id===`__root__`?``:this.parentRoute.id,a]);r===`__root__`&&(r=`/`),o!==`__root__`&&(o=I([`/`,o]));let s=o===`__root__`?`/`:I([this.parentRoute.fullPath,r]);this._path=r,this._id=o,this._fullPath=s,this._to=Ee(s)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>o({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},Re=class extends Le{constructor(e){super(e)}},L=t(e(),1),ze=L.use,Be=typeof window<`u`?L.useLayoutEffect:L.useEffect;function Ve(e){let t=L.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function He(e,t,n={},r={}){L.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!=`function`)return;let i=new IntersectionObserver(([e])=>{t(e)},n);return i.observe(e.current),()=>{i.disconnect()}},[t,n,r.disabled,e])}function Ue(e){let t=L.useRef(null);return L.useImperativeHandle(e,()=>t.current,[]),t}var R=n();function We({children:e,fallback:t=null}){return Ge()?(0,R.jsx)(L.Fragment,{children:e}):(0,R.jsx)(L.Fragment,{children:t})}function Ge(){return L.useSyncExternalStore(Ke,()=>!0,()=>!1)}function Ke(){return()=>{}}var qe=L.createContext(void 0),Je=L.createContext(void 0),Ye=r();function Xe(e,t){return e===t}function Ze(e,t,n=Xe){let r=(0,L.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,L.useCallback)(()=>e?.get(),[e]);return(0,Ye.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var Qe={get(){},subscribe(){return{unsubscribe(){}}}};function $e(e,t){let n=L.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=g(n.current,i):i}}function z(e){let t=s(),n=L.useContext(e.from?Je:qe),r=e.from?t.stores.getRouteMatchStore(e.from):t.stores.matchStores.get(n),a=$e(e,t),o=Ze(r??Qe,e=>e?a(e):Qe);if(o!==Qe)return o;(e.shouldThrow??!0)&&i()}function et(e){return z({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function tt(e){let{select:t,...n}=e;return z({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function nt(e){return z({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function rt(e){return z({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function it(e){let t=s();return L.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function at(e){return z({...e,select:t=>e.select?e.select(t.context):t.context})}var ot=t(a(),1);function st(e,t){let n=s(),r=Ue(t),{activeProps:i,inactiveProps:a,activeOptions:o,to:c,preload:l,preloadDelay:d,preloadIntentProximity:f,hashScrollIntoView:p,replace:m,startTransition:h,resetScroll:g,viewTransition:_,children:v,target:y,disabled:b,style:S,className:ee,onClick:te,onBlur:ne,onFocus:re,onMouseEnter:ie,onMouseLeave:oe,onTouchStart:se,ignoreBlocker:ce,params:le,search:ue,hash:de,state:fe,mask:C,reloadDocument:pe,unsafeRelative:me,from:he,_fromLocation:ge,...w}=e,T=Ge(),E=L.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),D=Ze(n.stores.location,e=>e,(e,t)=>e.href===t.href),O=L.useMemo(()=>{let e={_fromLocation:D,...E};return n.buildLocation(e)},[n,D,E]),_e=O.maskedLocation?O.maskedLocation.publicHref:O.publicHref,ve=O.maskedLocation?O.maskedLocation.external:O.external,k=L.useMemo(()=>mt(_e,ve,n.history,b),[b,ve,_e,n.history]),A=L.useMemo(()=>{if(k?.external)return ae(k.href,n.protocolAllowlist)?void 0:k.href;if(!ht(c)&&!(typeof c!=`string`||c.indexOf(`:`)===-1))try{return new URL(c),ae(c,n.protocolAllowlist)?void 0:c}catch{}},[c,k,n.protocolAllowlist]),ye=L.useMemo(()=>{if(A)return!1;if(o?.exact){if(!ke(D.pathname,O.pathname,n.basepath))return!1}else{let e=Oe(D.pathname,n.basepath),t=Oe(O.pathname,n.basepath);if(!(e.startsWith(t)&&(e.length===t.length||e[t.length]===`/`)))return!1}return(o?.includeSearch??!0)&&!x(D.search,O.search,{partial:!o?.exact,ignoreUndefined:!o?.explicitUndefined})?!1:o?.includeHash?T&&D.hash===O.hash:!0},[o?.exact,o?.explicitUndefined,o?.includeHash,o?.includeSearch,D,A,T,O.hash,O.pathname,O.search,n.basepath]),j=ye?u(i,{})??lt:ct,M=ye?ct:u(a,{})??ct,be=[ee,j.className,M.className].filter(Boolean).join(` `),xe=(S||j.style||M.style)&&{...S,...j.style,...M.style},[Se,N]=L.useState(!1),Ce=L.useRef(!1),P=e.reloadDocument||A?!1:l??n.options.defaultPreload,F=d??n.options.defaultPreloadDelay??0,I=L.useCallback(()=>{n.preloadRoute({...E,_builtLocation:O}).catch(e=>{console.warn(e),console.warn(Ie)})},[n,E,O]);He(r,L.useCallback(e=>{e?.isIntersecting&&I()},[I]),pt,{disabled:!!b||P!==`viewport`}),L.useEffect(()=>{Ce.current||!b&&P===`render`&&(I(),Ce.current=!0)},[b,I,P]);let we=e=>{let t=e.currentTarget.getAttribute(`target`),r=y===void 0?t:y;if(!b&&!_t(e)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0){e.preventDefault(),(0,ot.flushSync)(()=>{N(!0)});let t=n.subscribe(`onResolved`,()=>{t(),N(!1)});n.navigate({...E,replace:m,resetScroll:g,hashScrollIntoView:p,startTransition:h,viewTransition:_,ignoreBlocker:ce})}};if(A)return{...w,ref:r,href:A,...v&&{children:v},...y&&{target:y},...b&&{disabled:b},...S&&{style:S},...ee&&{className:ee},...te&&{onClick:te},...ne&&{onBlur:ne},...re&&{onFocus:re},...ie&&{onMouseEnter:ie},...oe&&{onMouseLeave:oe},...se&&{onTouchStart:se}};let Te=e=>{if(b||P!==`intent`)return;if(!F){I();return}let t=e.currentTarget;if(B.has(t))return;let n=setTimeout(()=>{B.delete(t),I()},F);B.set(t,n)},Ee=e=>{b||P!==`intent`||I()},De=e=>{if(b||!P||!F)return;let t=e.currentTarget,n=B.get(t);n&&(clearTimeout(n),B.delete(t))};return{...w,...j,...M,href:k?.href,ref:r,onClick:V([te,we]),onBlur:V([ne,De]),onFocus:V([re,Te]),onMouseEnter:V([ie,Te]),onMouseLeave:V([oe,De]),onTouchStart:V([se,Ee]),disabled:!!b,target:y,...xe&&{style:xe},...be&&{className:be},...b&&ut,...ye&&dt,...T&&Se&&ft}}var ct={},lt={className:`active`},ut={role:`link`,"aria-disabled":!0},dt={"data-status":`active`,"aria-current":`page`},ft={"data-transitioning":`transitioning`},B=new WeakMap,pt={rootMargin:`100px`},V=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function mt(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function ht(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var gt=L.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=st(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return L.createElement(`a`,t,o)}return L.createElement(n,a,o)});function _t(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var vt=class extends Le{constructor(e){super(e),this.useMatch=e=>z({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>at({...e,from:this.id}),this.useSearch=e=>rt({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>nt({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>tt({...e,from:this.id}),this.useLoaderData=e=>et({...e,from:this.id}),this.useNavigate=()=>it({from:this.fullPath}),this.Link=L.forwardRef((e,t)=>(0,R.jsx)(gt,{ref:t,from:this.fullPath,...e}))}};function yt(e){return new vt(e)}var bt=class extends Re{constructor(e){super(e),this.useMatch=e=>z({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>at({...e,from:this.id}),this.useSearch=e=>rt({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>nt({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>tt({...e,from:this.id}),this.useLoaderData=e=>et({...e,from:this.id}),this.useNavigate=()=>it({from:this.fullPath}),this.Link=L.forwardRef((e,t)=>(0,R.jsx)(gt,{ref:t,from:this.fullPath,...e}))}};function xt(e){return new bt(e)}function St(e){return new Ct(e,{silent:!0}).createRoute}var Ct=class{constructor(e,t){this.path=e,this.createRoute=e=>{let t=yt(e);return t.isRoot=!1,t},this.silent=t?.silent}};function wt(e,t){let n,r,i,a,o=()=>(n||=e().then(e=>{n=void 0,r=e[t??`default`]}).catch(e=>{if(i=e,ee(i)&&i instanceof Error&&typeof window<`u`&&typeof sessionStorage<`u`){let e=`tanstack_router_reload:${i.message}`;sessionStorage.getItem(e)||(sessionStorage.setItem(e,`1`),a=!0)}}),n),s=function(e){if(a)throw window.location.reload(),new Promise(()=>{});if(i)throw i;if(!r)if(ze)ze(o());else throw o();return L.createElement(r,e)};return s.preload=o,s}var Tt=Object.create(null),H=e=>({}),U=new Proxy(Tt,{get(e,t){return H()[t]??Tt[t]},has(e,t){return t in H()||t in Tt},set(e,t,n){let r=H(!0);return r[t]=n,!0},deleteProperty(e,t){if(!t)return!1;let n=H(!0);return delete n[t],!0},ownKeys(){let e=H(!0);return Object.keys(e)}});U.NODE_ENV;function W(e,t){return typeof process<`u`?{}[e]??t:typeof Deno<`u`?Deno.env.get(e)??t:typeof Bun<`u`?Bun.env[e]??t:t}Object.freeze({get BETTER_AUTH_SECRET(){return W(`BETTER_AUTH_SECRET`)},get AUTH_SECRET(){return W(`AUTH_SECRET`)},get BETTER_AUTH_TELEMETRY(){return W(`BETTER_AUTH_TELEMETRY`)},get BETTER_AUTH_TELEMETRY_ID(){return W(`BETTER_AUTH_TELEMETRY_ID`)},get NODE_ENV(){return W(`NODE_ENV`,`development`)},get PACKAGE_VERSION(){return W(`PACKAGE_VERSION`,`0.0.0`)},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return W(`BETTER_AUTH_TELEMETRY_ENDPOINT`,``)}});function Et(){let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):Object.prototype.hasOwnProperty.call(e,`writable`)?e.writable:e.set!==void 0}function Dt(e){let t=e.split(`
2
2
  at `);return t.length<=1?e:(t.splice(1,1),t.join(`
3
3
  at `))}function Ot(e,t){class n extends e{#e;constructor(...e){if(Et()){let t=Error.stackTraceLimit;Error.stackTraceLimit=0,super(...e),Error.stackTraceLimit=t}else super(...e);let t=Error().stack;t&&(this.#e=Dt(t.replace(/^Error/,this.name)))}get errorStack(){return this.#e}}return Object.defineProperty(n.prototype,"constructor",{get(){return t},enumerable:!1,configurable:!0}),n}var kt={OK:200,CREATED:201,ACCEPTED:202,NO_CONTENT:204,MULTIPLE_CHOICES:300,MOVED_PERMANENTLY:301,FOUND:302,SEE_OTHER:303,NOT_MODIFIED:304,TEMPORARY_REDIRECT:307,BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_ALLOWED:405,NOT_ACCEPTABLE:406,PROXY_AUTHENTICATION_REQUIRED:407,REQUEST_TIMEOUT:408,CONFLICT:409,GONE:410,LENGTH_REQUIRED:411,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,URI_TOO_LONG:414,UNSUPPORTED_MEDIA_TYPE:415,RANGE_NOT_SATISFIABLE:416,EXPECTATION_FAILED:417,"I'M_A_TEAPOT":418,MISDIRECTED_REQUEST:421,UNPROCESSABLE_ENTITY:422,LOCKED:423,FAILED_DEPENDENCY:424,TOO_EARLY:425,UPGRADE_REQUIRED:426,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,REQUEST_HEADER_FIELDS_TOO_LARGE:431,UNAVAILABLE_FOR_LEGAL_REASONS:451,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,HTTP_VERSION_NOT_SUPPORTED:505,VARIANT_ALSO_NEGOTIATES:506,INSUFFICIENT_STORAGE:507,LOOP_DETECTED:508,NOT_EXTENDED:510,NETWORK_AUTHENTICATION_REQUIRED:511};Ot(class extends Error{constructor(e=`INTERNAL_SERVER_ERROR`,t=void 0,n={},r=typeof e==`number`?e:kt[e]){super(t?.message,t?.cause?{cause:t.cause}:void 0),this.status=e,this.body=t,this.headers=n,this.statusCode=r,this.name=`APIError`,this.status=e,this.headers=n,this.statusCode=r,this.body=t}},Error);var G=class extends Error{constructor(e,t){super(e,t),this.name=`BetterAuthError`,this.message=e,this.stack=``}},At=47;function jt(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===At;)t--;return t===e.length?e:e.slice(0,t)}function Mt(e){try{return(jt(new URL(e).pathname)||`/`)!==`/`}catch{throw new G(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function Nt(e){try{let t=new URL(e);if(t.protocol!==`http:`&&t.protocol!==`https:`)throw new G(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){throw t instanceof G?t:new G(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}}function K(e,t=`/api/auth`){if(Nt(e),Mt(e))return e;let n=jt(e);return!t||t===`/`?n:(t=t.startsWith(`/`)?t:`/${t}`,`${n}${t}`)}function Pt(e,t){return!e||e.trim()===``?!1:t===`proto`?e===`http`||e===`https`:t===`host`?[/\.\./,/\0/,/[\s]/,/^[.]/,/[<>'"]/,/javascript:/i,/file:/i,/data:/i].some(t=>t.test(e))?!1:/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/.test(e)||/^(\d{1,3}\.){3}\d{1,3}(:[0-9]{1,5})?$/.test(e)||/^\[[0-9a-fA-F:]+\](:[0-9]{1,5})?$/.test(e)||/^localhost(:[0-9]{1,5})?$/i.test(e):!1}function Ft(e,t,n,r,i){if(e)return K(e,t);if(r!==!1){let e=U.BETTER_AUTH_URL||U.NEXT_PUBLIC_BETTER_AUTH_URL||U.PUBLIC_BETTER_AUTH_URL||U.NUXT_PUBLIC_BETTER_AUTH_URL||U.NUXT_PUBLIC_AUTH_URL||(U.BASE_URL===`/`?void 0:U.BASE_URL);if(e)return K(e,t)}let a=n?.headers.get(`x-forwarded-host`),o=n?.headers.get(`x-forwarded-proto`);if(a&&o&&i&&Pt(o,`proto`)&&Pt(a,`host`))try{return K(`${o}://${a}`,t)}catch{}if(n){let e=It(n.url);if(!e)throw new G(`Could not get origin from request. Please provide a valid base URL.`);return K(e,t)}if(typeof window<`u`&&window.location)return K(window.location.origin,t)}function It(e){try{let t=new URL(e);return t.origin===`null`?null:t.origin}catch{return null}}var Lt={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},Rt=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,zt={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:1/0,"-infinity":-1/0},Bt=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function Vt(e){return e instanceof Date&&!isNaN(e.getTime())}function Ht(e){let t=Bt.exec(e);if(!t)return null;let[,n,r,i,a,o,s,c,l,u,d]=t,f=new Date(Date.UTC(parseInt(n,10),parseInt(r,10)-1,parseInt(i,10),parseInt(a,10),parseInt(o,10),parseInt(s,10),c?parseInt(c.padEnd(3,`0`),10):0));if(l){let e=(parseInt(u,10)*60+parseInt(d,10))*(l===`+`?-1:1);f.setUTCMinutes(f.getUTCMinutes()+e)}return Vt(f)?f:null}function Ut(e,t={}){let{strict:n=!1,warnings:r=!1,reviver:i,parseDates:a=!0}=t;if(typeof e!=`string`)return e;let o=e.trim(),s=o.toLowerCase();if(s.length<=9&&s in zt)return zt[s];if(!Rt.test(o)){if(n)throw SyntaxError(`[better-json] Invalid JSON`);return e}if(Object.entries(Lt).some(([e,t])=>{let n=t.test(o);return n&&r&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${e} pattern`),n})&&n)throw Error(`[better-json] Potential prototype pollution attempt detected`);try{return JSON.parse(o,(e,t)=>{if(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){r&&console.warn(`[better-json] Dropping "${e}" key to prevent prototype pollution`);return}if(a&&typeof t==`string`){let e=Ht(t);if(e)return e}return i?i(e,t):t})}catch(t){if(n)throw t;return e}}function Wt(e,t={strict:!0}){return Ut(e,t)}var Gt=[`javascript:`,`data:`,`vbscript:`];function Kt(e){let t;try{t=new URL(e)}catch{return!0}return!Gt.includes(t.protocol)}var qt={id:`redirect`,name:`Redirect`,hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&Kt(e.data.url)&&typeof window<`u`&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}},q=[],J=0,Jt=4,Yt=globalThis.nanostoresGlobal||={epoch:0},Xt=e=>{let t=[],n={get(){return n.lc||n.listen(()=>{})(),n.value},init:e,lc:0,listen(e){return n.lc=t.push(e),()=>{for(let t=J+Jt;t<q.length;)q[t]===e?q.splice(t,Jt):t+=Jt;let r=t.indexOf(e);~r&&(t.splice(r,1),--n.lc||n.off())}},notify(e,r){Yt.epoch++;let i=!q.length;for(let i of t)q.push(i,n.value,e,r);if(i){for(J=0;J<q.length;J+=Jt)q[J](q[J+1],q[J+2],q[J+3]);q.length=0}},off(){},set(e){let t=n.value;t!==e&&(n.value=e,n.notify(t))},subscribe(e){let t=n.listen(e);return e(n.value),t},value:e};return n},Zt=2,Qt=5,$t=6,en=10,tn=(e,t,n,r)=>(e.events=e.events||{},e.events[n+en]||(e.events[n+en]=r(t=>{e.events[n].reduceRight((e,t)=>(t(e),e),{shared:{},...t})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let r=e.events[n],i=r.indexOf(t);r.splice(i,1),r.length||(delete e.events[n],e.events[n+en](),delete e.events[n+en])}),nn=(e,t)=>tn(e,t,Zt,t=>{let n=e.set,r=e.setKey;return e.setKey&&=(n,i)=>{let a;if(t({abort:()=>{a=!0},changed:n,newValue:{...e.value,[n]:i}}),!a)return r(n,i)},e.set=e=>{let r;if(t({abort:()=>{r=!0},newValue:e}),!r)return n(e)},()=>{e.set=n,e.setKey=r}}),rn=1e3,an=(e,t)=>tn(e,n=>{let r=t(n);r&&e.events[$t].push(r)},Qt,t=>{let n=e.listen;e.listen=(...r)=>(!e.lc&&!e.active&&(e.active=!0,t()),n(...r));let r=e.off;return e.events[$t]=[],e.off=()=>{r(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let t of e.events[$t])t();e.events[$t]=[]}},rn)},()=>{e.listen=n,e.off=r}});function on(e,t,n){let r=new Set(t).add(void 0);return e.listen((e,t,i)=>{r.has(i)&&n(e,t,i)})}function sn(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function cn(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!cn(e[n],t[n]))return!1;return!0}if(sn(e)&&sn(t)){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!(r in t)||!cn(e[r],t[r]))return!1;return!0}return!1}function ln(e,t){return nn(e,({newValue:n,abort:r})=>{t(e.value,n)&&r()})}var un=Symbol.for(`better-auth:broadcast-channel`),dn=()=>Math.floor(Date.now()/1e3),fn=class{listeners=new Set;name;constructor(e=`better-auth.message`){this.name=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}post(e){if(!(typeof window>`u`))try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:dn()}))}catch{}}setup(){if(typeof window>`u`||window.addEventListener===void 0)return()=>{};let e=e=>{if(e.key!==this.name)return;let t=JSON.parse(e.newValue??`{}`);t?.event!==`session`||!t?.data||this.listeners.forEach(e=>e(t))};return window.addEventListener(`storage`,e),()=>{window.removeEventListener(`storage`,e)}}};function pn(e=`better-auth.message`){return globalThis[un]||(globalThis[un]=new fn(e)),globalThis[un]}var mn=Symbol.for(`better-auth:focus-manager`),hn=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setFocused(e){this.listeners.forEach(t=>t(e))}setup(){if(typeof window>`u`||typeof document>`u`||window.addEventListener===void 0)return()=>{};let e=()=>{document.visibilityState===`visible`&&this.setFocused(!0)};return document.addEventListener(`visibilitychange`,e,!1),()=>{document.removeEventListener(`visibilitychange`,e,!1)}}};function gn(){return globalThis[mn]||(globalThis[mn]=new hn),globalThis[mn]}var _n=Symbol.for(`better-auth:online-manager`),vn=class{listeners=new Set;isOnline=typeof navigator<`u`?navigator.onLine:!0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOnline(e){this.isOnline=e,this.listeners.forEach(t=>t(e))}setup(){if(typeof window>`u`||window.addEventListener===void 0)return()=>{};let e=()=>this.setOnline(!0),t=()=>this.setOnline(!1);return window.addEventListener(`online`,e,!1),window.addEventListener(`offline`,t,!1),()=>{window.removeEventListener(`online`,e,!1),window.removeEventListener(`offline`,t,!1)}}};function yn(){return globalThis[_n]||(globalThis[_n]=new vn),globalThis[_n]}var bn=()=>Math.floor(Date.now()/1e3),xn=5;function Sn(e){let{fetchSession:t,shouldPollSession:n=()=>!0,sessionSignal:r,options:i={}}=e,a=i.sessionOptions?.refetchInterval??0,o=i.sessionOptions?.refetchOnWindowFocus??!0,s=i.sessionOptions?.refetchWhenOffline??!1,c={isInitialized:!1,lastSessionRequest:0},l=()=>s||yn().isOnline,u=e=>{if(l()){if(e?.event===`storage`){t();return}if(e?.event===`poll`){c.lastSessionRequest=bn(),t();return}if(e?.event===`visibilitychange`){if(bn()-c.lastSessionRequest<xn)return;c.lastSessionRequest=bn(),t();return}t()}},d=e=>{pn().post({event:`session`,data:{trigger:e},clientId:Math.random().toString(36).substring(7)})},f=()=>{a&&a>0&&(c.pollInterval=setInterval(()=>{n()&&u({event:`poll`})},a*1e3))},p=()=>{c.unsubscribeBroadcast=pn().subscribe(()=>{u({event:`storage`})})},m=()=>{o&&(c.unsubscribeFocus=gn().subscribe(()=>{u({event:`visibilitychange`})}))},h=()=>{c.unsubscribeOnline=yn().subscribe(e=>{e&&u({event:`visibilitychange`})})},g=()=>{c.unsubscribeSignal=r.listen(()=>{t()})};return{init:()=>{c.isInitialized||(c.isInitialized=!0,f(),p(),m(),h(),g(),c.cleanupBroadcastSetup=pn().setup(),c.cleanupFocusSetup=gn().setup(),c.cleanupOnlineSetup=yn().setup())},cleanup:()=>{c.isInitialized&&(c.pollInterval&&=(clearInterval(c.pollInterval),void 0),c.unsubscribeBroadcast&&=(c.unsubscribeBroadcast(),void 0),c.unsubscribeFocus&&=(c.unsubscribeFocus(),void 0),c.unsubscribeOnline&&=(c.unsubscribeOnline(),void 0),c.unsubscribeSignal&&=(c.unsubscribeSignal(),void 0),c.cleanupBroadcastSetup&&=(c.cleanupBroadcastSetup(),void 0),c.cleanupFocusSetup&&=(c.cleanupFocusSetup(),void 0),c.cleanupOnlineSetup&&=(c.cleanupOnlineSetup(),void 0),c.isInitialized=!1,c.lastSessionRequest=0)},triggerRefetch:u,broadcastSessionUpdate:d}}var Cn=()=>typeof window>`u`;function wn(e){return typeof e==`object`&&e&&`data`in e&&`error`in e?e:{data:e,error:null}}function Tn(e){return!e||e.session===null&&e.user===null?null:e}function En(e,t){return cn(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}function Dn(e,t){let n=Xt(!1),r,i=e=>s(e),a=Xt({data:null,error:null,isPending:!0,isRefetching:!1,refetch:i});ln(a,En);let o=e=>{if(r!==e)return;let t=a.get();r=void 0,!(!t.isPending&&!t.isRefetching)&&a.set({...t,isPending:!1,isRefetching:!1,refetch:i})},s=async t=>{r?.abort();let n=new AbortController;r=n;let s=a.get();a.set({...s,isPending:s.data===null,isRefetching:!0,error:null,refetch:i});try{let r=await e(`/get-session`,{method:`GET`,query:t?.query,signal:n.signal});if(n.signal.aborted){o(n);return}let{data:s,error:c}=wn(r);if(s?.needsRefresh)try{let t=await e(`/get-session`,{method:`POST`,signal:n.signal});if(n.signal.aborted){o(n);return}({data:s,error:c}=wn(t))}catch{if(n.signal.aborted){o(n);return}}if(c){let e=a.get(),t=c?.status===401;a.set({data:t?null:e.data,error:c,isPending:!1,isRefetching:!1,refetch:i});return}let l=Tn(s),u=a.get(),d=u.data!=null&&l!=null&&cn(u.data,l)?u.data:l;a.set({data:d,error:null,isPending:!1,isRefetching:!1,refetch:i})}catch(e){if(n.signal.aborted){o(n);return}let t=a.get();a.set({data:t.data,error:e,isPending:!1,isRefetching:!1,refetch:i})}},c=()=>{};return an(a,()=>{let e;Cn()||(e=setTimeout(()=>{s()},0));let i=Sn({fetchSession:s,shouldPollSession:()=>a.get().data!=null,sessionSignal:n,options:t});return i.init(),c=i.broadcastSessionUpdate,()=>{e&&clearTimeout(e);let t=r;t?.abort(),t&&o(t),i.cleanup()}}),{session:a,$sessionSignal:n,broadcastSessionUpdate:e=>c(e)}}function On(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)===`[object Module]`:!0}function kn(e,t,n=`.`,r){if(!On(t))return kn(e,{},n,r);let i={...t};for(let t of Object.keys(e)){if(t===`__proto__`||t===`constructor`)continue;let a=e[t];a!=null&&(r&&r(i,t,a,n)||(Array.isArray(a)&&Array.isArray(i[t])?i[t]=[...a,...i[t]]:On(a)&&On(i[t])?i[t]=kn(a,i[t],(n?`${n}.`:``)+t.toString(),r):i[t]=a))}return i}function An(e){return(...t)=>t.reduce((t,n)=>kn(t,n,``,e),{})}var jn=An(),Mn=Object.defineProperty,Nn=Object.defineProperties,Pn=Object.getOwnPropertyDescriptors,Fn=Object.getOwnPropertySymbols,In=Object.prototype.hasOwnProperty,Ln=Object.prototype.propertyIsEnumerable,Rn=(e,t,n)=>t in e?Mn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Y=(e,t)=>{for(var n in t||={})In.call(t,n)&&Rn(e,n,t[n]);if(Fn)for(var n of Fn(t))Ln.call(t,n)&&Rn(e,n,t[n]);return e},X=(e,t)=>Nn(e,Pn(t)),zn=class extends Error{constructor(e,t,n){super(t||e.toString(),{cause:n}),this.status=e,this.statusText=t,this.error=n,Error.captureStackTrace(this,this.constructor)}},Bn=async(e,t)=>{let n=t||{},r={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:n,hooks:r};for(let i of t?.plugins||[]){if(i.init){let r=await i.init?.call(i,e.toString(),t);n=r.options||n,e=r.url}r.onRequest.push(i.hooks?.onRequest),r.onResponse.push(i.hooks?.onResponse),r.onSuccess.push(i.hooks?.onSuccess),r.onError.push(i.hooks?.onError),r.onRetry.push(i.hooks?.onRetry)}return{url:e,options:n,hooks:r}},Vn=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},Hn=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function Un(e){if(typeof e==`number`)return new Vn({type:`linear`,attempts:e,delay:1e3});switch(e.type){case`linear`:return new Vn(e);case`exponential`:return new Hn(e);default:throw Error(`Invalid retry strategy`)}}var Wn=async e=>{let t={},n=async e=>typeof e==`function`?await e():e;if(e?.auth){if(e.auth.type===`Bearer`){let r=await n(e.auth.token);if(!r)return t;t.authorization=`Bearer ${r}`}else if(e.auth.type===`Basic`){let[r,i]=await Promise.all([n(e.auth.username),n(e.auth.password)]);if(!r||!i)return t;t.authorization=`Basic ${btoa(`${r}:${i}`)}`}else if(e.auth.type===`Custom`){let[r,i]=await Promise.all([n(e.auth.prefix),n(e.auth.value)]);if(!i)return t;t.authorization=`${r??``} ${i}`}}return t},Gn=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function Kn(e){let t=e.headers.get(`content-type`),n=new Set([`image/svg`,`application/xml`,`application/xhtml`,`application/html`]);if(!t)return`json`;let r=t.split(`;`).shift()||``;return Gn.test(r)?`json`:n.has(r)||r.startsWith(`text/`)?`text`:`blob`}function qn(e){try{return JSON.parse(e),!0}catch{return!1}}function Jn(e){if(e===void 0)return!1;let t=typeof e;return t===`string`||t===`number`||t===`boolean`||t===null?!0:t===`object`?Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name===`Object`||typeof e.toJSON==`function`:!1}function Yn(e){try{return JSON.parse(e)}catch{return e}}function Xn(e){return typeof e==`function`}function Zn(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<`u`&&Xn(globalThis.fetch))return globalThis.fetch;if(typeof window<`u`&&Xn(window.fetch))return window.fetch;throw Error(`No fetch implementation found`)}function Qn(...e){let t={};for(let n of e)if(n)if(n instanceof Headers)n.forEach((e,n)=>{t[n]=e});else{let e=Array.isArray(n)?n:Object.entries(n);for(let[n,r]of e)r!=null&&(t[n]=r)}return t}async function $n(e){let t=new Headers(Qn(e?.headers,await Wn(e)));if(!t.has(`content-type`)){let n=er(e?.body);n&&t.set(`content-type`,n)}return t}function er(e){return Jn(e)?`application/json`:null}function tr(e){let t=e.get(`content-type`);return t?t.split(`;`)[0].trim().toLowerCase():null}function nr(e,t){let{body:n}=e;return n?!Jn(n)||typeof n==`string`?n:tr(t)===`application/x-www-form-urlencoded`?new URLSearchParams(n).toString():JSON.stringify(n):null}function rr(e,t){if(t?.method)return t.method.toUpperCase();if(e.startsWith(`@`)){let n=e.split(`@`)[1]?.split(`/`)[0];return or.includes(n)?n.toUpperCase():t?.body?`POST`:`GET`}return t?.body?`POST`:`GET`}function ir(e,t){let n;return!e?.signal&&e?.timeout&&(n=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:n,clearTimeout:()=>{n&&clearTimeout(n)}}}var ar=class e extends Error{constructor(t,n){super(n||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,e.prototype)}};async function Z(e,t){let n=await e[`~standard`].validate(t);if(n.issues)throw new ar(n.issues);return n.value}var or=[`get`,`post`,`put`,`patch`,`delete`],sr=e=>({id:`apply-schema`,name:`Apply Schema`,version:`1.0.0`,async init(t,n){let r=e.plugins?.find(e=>e.schema?.config?t.startsWith(e.schema.config.baseURL||``)||t.startsWith(e.schema.config.prefix||``):!1)?.schema||e.schema;if(r){let e=t;r.config?.prefix&&e.startsWith(r.config.prefix)&&(e=e.replace(r.config.prefix,``),r.config.baseURL&&(t=t.replace(r.config.prefix,r.config.baseURL))),r.config?.baseURL&&e.startsWith(r.config.baseURL)&&(e=e.replace(r.config.baseURL,``)),e.startsWith(`/`)&&e.charAt(1)===`@`&&(e=e.substring(1));let i=r.schema[e];if(i){let e=n?.headers;if(i.headers&&!n?.disableValidation){let t={};if(n?.headers){if(n.headers instanceof Headers)n.headers.forEach((e,n)=>{t[n.toLowerCase()]=e});else if(typeof n.headers==`object`)for(let[e,r]of Object.entries(n.headers))r!=null&&(t[e.toLowerCase()]=r)}let r=await Z(i.headers,t),a={};for(let[e,t]of Object.entries(r))a[e.toLowerCase()]=t;e=a}let r=X(Y({},n),{method:i.method,output:i.output,headers:e});return n?.disableValidation||(r=X(Y({},r),{body:i.input?await Z(i.input,n?.body):n?.body,params:i.params?await Z(i.params,n?.params):n?.params,query:i.query?await Z(i.query,n?.query):n?.query})),{url:t,options:r}}}return{url:t,options:n}}}),cr=e=>{async function t(t,n){let r=X(Y(Y({},e),n),{headers:Qn(e?.headers,n?.headers),plugins:[...e?.plugins||[],sr(e||{}),...n?.plugins||[]]});if(e?.catchAllError)try{return await fr(t,r)}catch(e){return{data:null,error:{status:500,statusText:`Fetch Error`,message:`Fetch related error. Captured by catchAllError option. See error property for more details.`,error:e}}}return await fr(t,r)}return t},lr=e=>e===`.`||e===`..`;function ur(e,t){let n=e;for(let[e,r]of t)n=n.replace(e,r);if(lr(n))throw TypeError(`Path parameters cannot be reserved path segments`);return encodeURIComponent(n)}function dr(e,t){let{baseURL:n,params:r,query:i}=t||{query:{},params:{},baseURL:``},a=e.startsWith(`http`)?e.split(`/`).slice(0,3).join(`/`):n||``;if(e.startsWith(`@`)){let t=e.toString().split(`@`)[1].split(`/`)[0];or.includes(t)&&(e=e.replace(`@${t}/`,`/`))}a.endsWith(`/`)||(a+=`/`);let[o,s]=e.replace(a,``).split(`?`),c=new URLSearchParams(s);for(let[e,t]of Object.entries(i||{})){if(t==null)continue;let n;if(typeof t==`string`)n=t;else if(Array.isArray(t)){for(let n of t)c.append(e,n);continue}else n=JSON.stringify(t);c.set(e,n)}let l=new Map;if(r)if(Array.isArray(r)){let e=o.split(`/`).filter(e=>e.startsWith(`:`));for(let[t,n]of e.entries()){let e=r[t];l.set(n,String(e))}}else for(let[e,t]of Object.entries(r))l.set(`:${e}`,String(t));o=o.split(`/`).map(e=>ur(e,l)).join(`/`),o=o.replace(/^\/+/,``);let u=c.toString();return u=u.length>0?`?${u}`.replace(/\+/g,`%20`):``,a.startsWith(`http`)?new URL(`${o}${u}`,a):`${a}${o}${u}`}var fr=async(e,t)=>{let{hooks:n,url:r,options:i}=await Bn(e,t),a=Zn(i),o=new AbortController,s=i.signal??o.signal,c=dr(r,i),l=await $n(i),u=nr(i,l),d=rr(r,i),f=X(Y({},i),{url:c,headers:l,body:u,method:d,signal:s});for(let e of n.onRequest)if(e){let t=await e(f);typeof t==`object`&&t&&Object.assign(f,t)}(`pipeTo`in f&&typeof f.pipeTo==`function`||typeof t?.body?.pipe==`function`)&&(`duplex`in f||(f.duplex=`half`));let{clearTimeout:p}=ir(i,o),m=await a(f.url,f);p();let h={response:m,request:f};for(let e of n.onResponse)if(e){let n=await e(X(Y({},h),{response:t?.hookOptions?.cloneResponse?m.clone():m}));n instanceof Response?m=n:typeof n==`object`&&n&&(m=n.response)}if(m.ok){if(f.method===`HEAD`)return{data:``,error:null};let e=Kn(m),r={data:null,response:m,request:f};if(e===`json`||e===`text`){let e=await m.text();r.data=await(f.jsonParser??Yn)(e)}else r.data=await m[e]();f?.output&&f.output&&!f.disableValidation&&(r.data=await Z(f.output,r.data));for(let e of n.onSuccess)e&&await e(X(Y({},r),{response:t?.hookOptions?.cloneResponse?m.clone():m}));return t?.throw?r.data:{data:r.data,error:null}}let g=t?.jsonParser??Yn,_=await m.text(),v=qn(_),y=v?await g(_):null,b={response:m,responseText:_,request:f,error:X(Y({},y),{status:m.status,statusText:m.statusText})};for(let e of n.onError)e&&await e(X(Y({},b),{response:t?.hookOptions?.cloneResponse?m.clone():m}));if(t?.retry){let r=Un(t.retry),i=t.retryAttempt??0;if(await r.shouldAttemptRetry(i,m)){for(let e of n.onRetry)e&&await e(h);let a=r.getDelay(i);return await new Promise(e=>setTimeout(e,a)),await fr(e,X(Y({},t),{retryAttempt:i+1}))}}if(t?.throw)throw new zn(m.status,m.statusText,v?y:_);return{data:null,error:X(Y({},y),{status:m.status,statusText:m.statusText})}},pr=e=>{if(typeof process>`u`)return;let t=e??`/api/auth`;if({}.NEXT_PUBLIC_AUTH_URL)return{}.NEXT_PUBLIC_AUTH_URL;if(typeof window>`u`){if({}.NEXTAUTH_URL)try{return{}.NEXTAUTH_URL}catch{}if({}.VERCEL_URL)try{let e={}.VERCEL_URL.startsWith(`http`)?``:`https://`;return`${new URL(`${e}${{}.VERCEL_URL}`).origin}${t}`}catch{}}},mr=(e,t)=>{let n=`credentials`in Request.prototype,r=Ft(e?.baseURL,e?.basePath,void 0,t)??pr(e?.basePath)??`/api/auth`,i=e?.plugins?.flatMap(e=>e.fetchPlugins).filter(e=>e!==void 0)||[],a={id:`lifecycle-hooks`,name:`lifecycle-hooks`,hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:o,onError:s,onRequest:c,onResponse:l,...u}=e?.fetchOptions||{},d=cr({baseURL:r,...n?{credentials:`include`}:{},method:`GET`,jsonParser(e){return e?Wt(e,{strict:!1}):null},customFetchImpl:fetch,...u,plugins:[a,...u.plugins||[],...e?.disableDefaultFetchPlugins?[]:[qt],...i]}),{$sessionSignal:f,session:p,broadcastSessionUpdate:m}=Dn(d,e),h=e?.plugins||[],g={},_={$sessionSignal:f,session:p},v={"/sign-out":`POST`,"/revoke-sessions":`POST`,"/revoke-other-sessions":`POST`,"/delete-user":`POST`},y=[{signal:`$sessionSignal`,matcher(e){return e===`/sign-out`||e===`/update-user`||e===`/update-session`||e===`/sign-up/email`||e===`/sign-in/email`||e===`/delete-user`||e===`/verify-email`||e===`/revoke-sessions`||e===`/revoke-session`||e===`/revoke-other-sessions`||e===`/change-email`||e===`/change-password`},callback(e){e===`/sign-out`?m(`signout`):(e===`/update-user`||e===`/update-session`)&&m(`updateUser`)}}];for(let e of h)e.getAtoms&&Object.assign(_,e.getAtoms?.(d)),e.pathMethods&&Object.assign(v,e.pathMethods),e.atomListeners&&y.push(...e.atomListeners);let b={notify:e=>{_[e].set(!_[e].get())},listen:(e,t)=>{_[e].subscribe(t)},atoms:_};for(let t of h)t.getActions&&(g=jn(t.getActions?.(d,b,e)??{},g));return{get baseURL(){return r},pluginsActions:g,pluginsAtoms:_,pluginPathMethods:v,atomListeners:y,$fetch:d,$store:b}};function hr(e){return typeof e==`object`&&!!e&&`get`in e&&typeof e.get==`function`&&`lc`in e&&typeof e.lc==`number`}function gr(e){return e.charAt(0).toUpperCase()+e.slice(1)}var _r=/[\p{Ll}\d]+|\p{Lu}+(?!\p{Ll})|\p{Lu}[\p{Ll}\d]+|\p{Lo}+/gu,vr=/['\u2019]/g;function yr(e){return e.replace(vr,``).match(_r)??[]}function br(e){return yr(e).map(e=>e.toLowerCase()).join(`-`)}function xr(e,t,n){let r=t[e],{fetchOptions:i,query:a,...o}=n||{};return r||(i?.method?i.method:o&&Object.keys(o).length>0?`POST`:`GET`)}function Sr(e,t,n,r,i){function a(o=[]){return new Proxy(function(){},{get(t,n){if(typeof n!=`string`||n===`then`||n===`catch`||n===`finally`)return;let r=[...o,n],i=e;for(let e of r)if(i&&typeof i==`object`&&e in i)i=i[e];else{i=void 0;break}return typeof i==`function`||hr(i)?i:a(r)},apply:async(e,a,s)=>{let c=`/`+o.map(br).join(`/`),l=s[0]||{},u=s[1]||{},{query:d,fetchOptions:f,...p}=l,m={...u,...f},h=xr(c,n,l);return await t(c,{...m,body:h===`GET`?void 0:{...p,...m?.body||{}},query:d||m?.query,method:h,async onSuccess(e){if(await m?.onSuccess?.(e),!i||m.disableSignal)return;let t=i.filter(e=>e.matcher(c));if(!t.length)return;let n=new Set;for(let e of t){let t=r[e.signal];if(!t)return;if(n.has(e.signal))continue;n.add(e.signal);let i=t.get();setTimeout(()=>{t.set(!i)},10),e.callback?.(c)}}})}})}return a()}function Cr(e,t={}){let n=(0,L.useRef)(e.get()),{keys:r,deps:i=[e,r]}=t,a=(0,L.useCallback)(t=>{let i=e=>{n.current!==e&&(n.current=e,t())};return i(e.value),r?.length?on(e,r,i):e.listen(i)},i),o=()=>n.current;return(0,L.useSyncExternalStore)(a,o,o)}function wr(e){return`use${gr(e)}`}function Tr(e){let{pluginPathMethods:t,pluginsActions:n,pluginsAtoms:r,$fetch:i,$store:a,atomListeners:o}=mr(e),s={};for(let[e,t]of Object.entries(r))s[wr(e)]=()=>Cr(t);return Sr({...n,...s,$fetch:i,$store:a},i,t,r,o)}var Er=Tr(),{signIn:Dr,useSession:Or}=Er,kr=[[9,9],[37,9],[65,9],[65,37],[65,65],[37,65],[9,65],[9,37]];function Ar({size:e=24,plate:t=!1,trail:n=!1,animated:r=!1}){let i=e=>{let t=[`ring-cell`,`rc${e}`];return e===0?t.push(`ring-runner`):n&&e===7?t.push(`ring-trail-1`):n&&e===6&&t.push(`ring-trail-2`),t.join(` `)};return(0,R.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 96 96`,role:`img`,"aria-label":`Pievo`,className:[`ring-logo`,t&&`ring-logo-plate`,r&&`ring-logo-animated`].filter(Boolean).join(` `),children:[t&&(0,R.jsx)(`rect`,{width:`96`,height:`96`,rx:`15`,fill:`#0b0b0b`}),kr.map(([e,t],n)=>(0,R.jsx)(`rect`,{x:e,y:t,width:22,height:22,rx:6,className:i(n)},n))]})}function jr({size:e=56}){return(0,R.jsx)(Ar,{size:e,plate:!0,animated:!0})}var Mr=`https://github.com/kky42/pievo`;function Nr({className:e}){return(0,R.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":!0,className:e,children:(0,R.jsx)(`path`,{d:`M12 .5C5.65.5.5 5.65.5 12c0 5.08 3.29 9.39 7.86 10.91.58.11.79-.25.79-.55 0-.27-.01-1.17-.02-2.12-3.2.7-3.88-1.36-3.88-1.36-.52-1.33-1.28-1.68-1.28-1.68-1.04-.71.08-.7.08-.7 1.15.08 1.76 1.19 1.76 1.19 1.03 1.75 2.69 1.25 3.34.95.1-.74.4-1.25.72-1.54-2.55-.29-5.24-1.28-5.24-5.68 0-1.26.45-2.28 1.19-3.09-.12-.29-.52-1.46.11-3.05 0 0 .97-.31 3.18 1.18a11.1 11.1 0 0 1 5.8 0c2.2-1.49 3.17-1.18 3.17-1.18.63 1.59.23 2.76.11 3.05.74.81 1.19 1.83 1.19 3.09 0 4.41-2.69 5.38-5.25 5.67.41.35.77 1.05.77 2.12 0 1.53-.01 2.76-.01 3.14 0 .3.2.66.8.55A11.51 11.51 0 0 0 23.5 12C23.5 5.65 18.35.5 12 .5z`})})}function Pr({onStart:e}){return(0,R.jsxs)(`section`,{className:`mt-24 border-t border-hairline pt-16`,children:[(0,R.jsxs)(`div`,{className:`text-center`,children:[(0,R.jsx)(`div`,{className:`font-pixel text-label uppercase tracking-[0.18em] text-secondary`,children:`The loop playbook`}),(0,R.jsx)(`h2`,{className:`mx-auto mt-3 max-w-[620px] font-pixel text-[clamp(24px,4vw,34px)] leading-[1.15] text-display`,children:`Anatomy of good loops`}),(0,R.jsx)(`p`,{className:`mx-auto mt-4 max-w-[520px] text-body leading-relaxed text-secondary`,children:`That is the easy 5%. The real work is the structure that lets you walk away while it runs. Every good loop we have seen follows the same playbook.`})]}),(0,R.jsx)(Fr,{num:`01`,title:`Four parts of a good loop`}),(0,R.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,R.jsx)(Ir,{title:`Contract`,caption:`One file the agent re-reads every run: the goal, the boundary fence, the steps. The fence decides whether you can walk away.`,children:(0,R.jsx)(Lr,{name:`contract.md`,lines:[{h:`## Goal`},{skel:`w-4/5`},{h:`## Boundaries`},{hot:`ship it yourself vs ask a human`},{skel:`w-3/5`},{h:`## SOP`},{skel:`w-4/6`}]})}),(0,R.jsx)(Ir,{title:`Memory + logs`,caption:`Durable memory across runs, so it never re-does work and every lesson sticks. Month three is smarter than week one.`,children:(0,R.jsx)(Lr,{name:`memory.md`,lines:[{h:`## Memory`},{t:`hypothesis: credit-wall users reply 3x`},{t:`skip: known-noise fingerprints`},{h:`## Logs`},{t:`07-08 fixed null-team, PR #1027`},{t:`07-07 nothing new, clean stop`}]})}),(0,R.jsx)(Ir,{title:`Verifier`,caption:`Work loops with verify until there is evidence a human can glance at. No proof, not done.`,children:(0,R.jsx)(Rr,{})}),(0,R.jsx)(Ir,{title:`Trigger`,caption:`Pick the cheapest trigger that fits: a push toward a goal, a schedule, or an event gate so empty runs cost nothing.`,children:(0,R.jsxs)(`div`,{className:`flex h-full flex-col justify-center gap-2`,children:[(0,R.jsx)(zr,{code:`while (goal not met)`,label:`continuous push`}),(0,R.jsx)(zr,{code:`0 6 * * *`,label:`cron schedule`}),(0,R.jsx)(zr,{code:`on: new ticket`,label:`event, gated`})]})})]}),(0,R.jsx)(Fr,{num:`02`,title:`Serious loops split into three roles`}),(0,R.jsx)(`p`,{className:`mx-auto -mt-3 mb-8 max-w-[590px] text-center text-body text-secondary`,children:`Simple loops are one agent doing the whole job. Once a loop ships real work to real people, it splits: one agent finds the work, one does it in an isolated lane, one proves it. You approve evidence, not diffs.`}),(0,R.jsx)(Kr,{}),(0,R.jsx)(Fr,{num:`03`,title:`Evolve, or the loop stays as dumb as day one`}),(0,R.jsxs)(`div`,{className:`rounded-card border border-hairline bg-surface p-6 sm:p-8`,children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-1 gap-x-10 gap-y-3 sm:grid-cols-2`,children:[(0,R.jsx)(`p`,{className:`text-body leading-relaxed text-primary`,children:`Fragile systems break on a bad run. Robust ones survive it. An antifragile loop gets stronger from it: a periodic evolve pass starts with bounded history aggregates, then drills into only the decisive runs to ask where money was wasted, which boundary is too loose, and which mistake keeps repeating.`}),(0,R.jsx)(`p`,{className:`text-body leading-relaxed text-secondary`,children:`Its output is not product work. It is changes to the loop itself: a tighter contract, a cheaper trigger, mechanical steps folded into scripts and skills. A loop that improves the loop.`})]}),(0,R.jsx)(`div`,{className:`mt-6 border-t border-hairline pt-6`,children:(0,R.jsx)(Qr,{})})]}),(0,R.jsxs)(`div`,{className:`mt-4 rounded-card border border-hairline bg-surface p-6 sm:p-8`,children:[(0,R.jsxs)(`div`,{className:`mx-auto max-w-[580px] text-center`,children:[(0,R.jsx)(`div`,{className:`font-pixel text-[clamp(15px,2vw,19px)] leading-snug text-display`,children:`Every run compiles a cheaper, smarter next run`}),(0,R.jsx)(`p`,{className:`mt-2.5 text-body leading-relaxed text-secondary`,children:`The payoff shows up on the bill and in the work. Each pass folds what the loop learned into scripts, skills and a tighter contract, so the next run reasons less, misses less, and costs less. Born agentic, it graduates to a cheap script, and the agent only wakes back up when something surprising happens.`})]}),(0,R.jsx)(`div`,{className:`mt-6`,children:(0,R.jsx)(Yr,{})})]}),(0,R.jsxs)(`div`,{className:`mt-16 rounded-card bg-display px-6 py-10 text-center sm:px-10`,children:[(0,R.jsx)(`div`,{className:`font-pixel text-label uppercase tracking-[0.18em] text-paper/60`,children:`Built in`}),(0,R.jsx)(`h3`,{className:`mx-auto mt-3 max-w-[560px] font-pixel text-[clamp(21px,3vw,28px)] leading-[1.2] text-paper`,children:`Pievo ships the guardrails by default`}),(0,R.jsxs)(`ul`,{className:`mx-auto mt-7 grid max-w-[760px] grid-cols-1 gap-x-8 gap-y-2.5 text-left sm:grid-cols-2`,children:[(0,R.jsx)($,{children:`Contract, state and logs born with every loop`}),(0,R.jsx)($,{children:`Boundaries re-read at the top of every run`}),(0,R.jsx)($,{children:`Missed fires caught up, failed runs recovered`}),(0,R.jsx)($,{children:`Time, event and gated triggers: empty runs cost nothing`}),(0,R.jsx)($,{children:`An evolve pass that reviews its own run history`}),(0,R.jsx)($,{children:`A purpose-built dashboard per loop, not a log to scroll`})]}),(0,R.jsxs)(`button`,{onClick:e,className:`mt-9 inline-flex cursor-pointer items-center gap-1.5 rounded-full bg-paper px-6 py-2.5 text-body font-medium text-display transition-opacity hover:opacity-85`,children:[`Start a loop`,(0,R.jsx)(`span`,{"aria-hidden":!0,children:`→`})]}),(0,R.jsx)(`div`,{className:`mt-3 text-caption text-paper/55`,children:`Describe the job. The playbook is the default, not homework.`}),(0,R.jsx)(`div`,{className:`mt-7 flex items-center justify-center`,children:(0,R.jsxs)(`a`,{href:Mr,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 text-caption text-paper/60 transition-colors hover:text-paper`,children:[(0,R.jsx)(Nr,{className:`size-4`}),` Open source on GitHub`]})})]})]})}function Fr({num:e,title:t}){return(0,R.jsxs)(`div`,{className:`mb-6 mt-16 flex items-baseline justify-center gap-3`,children:[(0,R.jsx)(`span`,{className:`font-pixel text-meta text-secondary`,children:e}),(0,R.jsx)(`h3`,{className:`font-pixel text-[clamp(17px,2.4vw,21px)] text-display`,children:t})]})}function Ir({title:e,caption:t,children:n}){return(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col rounded-card border border-hairline bg-surface p-4 shadow-card`,children:[(0,R.jsx)(`div`,{className:`text-body font-semibold text-display`,children:e}),(0,R.jsx)(`div`,{className:`mt-3 flex min-h-[150px] flex-1 flex-col justify-center`,children:n}),(0,R.jsx)(`div`,{className:`mt-3 text-caption leading-snug text-secondary`,children:t})]})}function Lr({name:e,lines:t}){return(0,R.jsxs)(`div`,{className:`overflow-hidden rounded-control border border-hairline bg-raised`,children:[(0,R.jsx)(`div`,{className:`border-b border-hairline px-2.5 py-1 font-mono text-micro text-secondary`,children:e}),(0,R.jsx)(`div`,{className:`space-y-1.5 px-2.5 py-2.5`,children:t.map((e,t)=>e.h?(0,R.jsx)(`div`,{className:`font-mono text-micro font-semibold text-primary`,children:e.h},t):e.hot?(0,R.jsx)(`div`,{className:`rounded-[4px] bg-interactive-soft px-1.5 py-0.5 font-mono text-micro text-interactive`,children:e.hot},t):e.t?(0,R.jsx)(`div`,{className:`truncate font-mono text-micro text-secondary`,children:e.t},t):(0,R.jsx)(`div`,{className:`h-1.5 rounded-full bg-wire/60 ${e.skel??`w-full`}`},t))})]})}function Rr(){return(0,R.jsxs)(`svg`,{viewBox:`0 0 220 168`,role:`img`,"aria-label":`Work and verify loop until proof`,className:`mx-auto w-full max-w-[210px]`,children:[(0,R.jsxs)(`defs`,{children:[(0,R.jsx)(`marker`,{id:`lp-a`,markerWidth:`8`,markerHeight:`8`,refX:`6`,refY:`4`,orient:`auto`,children:(0,R.jsx)(`path`,{d:`M0,0 L8,4 L0,8 z`,fill:`var(--color-secondary)`})}),(0,R.jsx)(`marker`,{id:`lp-g`,markerWidth:`8`,markerHeight:`8`,refX:`6`,refY:`4`,orient:`auto`,children:(0,R.jsx)(`path`,{d:`M0,0 L8,4 L0,8 z`,fill:`var(--color-success)`})})]}),(0,R.jsx)(`path`,{d:`M62,96 Q22,70 62,44`,fill:`none`,stroke:`var(--color-accent)`,strokeWidth:`1.6`,markerEnd:`url(#lp-a)`}),(0,R.jsx)(`text`,{x:`16`,y:`66`,fontSize:`9`,fill:`var(--color-accent)`,fontFamily:`var(--font-mono)`,children:`fail`}),(0,R.jsx)(`text`,{x:`16`,y:`77`,fontSize:`9`,fill:`var(--color-accent)`,fontFamily:`var(--font-mono)`,children:`fix`}),(0,R.jsx)(`path`,{d:`M110,52 L110,84`,fill:`none`,stroke:`var(--color-secondary)`,strokeWidth:`1.6`,markerEnd:`url(#lp-a)`}),(0,R.jsx)(`path`,{d:`M110,120 L110,138`,fill:`none`,stroke:`var(--color-success)`,strokeWidth:`1.6`,markerEnd:`url(#lp-g)`}),(0,R.jsx)(`rect`,{x:`60`,y:`18`,width:`100`,height:`34`,rx:`8`,fill:`var(--color-surface)`,stroke:`var(--color-wire)`,strokeWidth:`1.3`}),(0,R.jsx)(`text`,{x:`110`,y:`39`,textAnchor:`middle`,fontSize:`11`,fill:`var(--color-primary)`,fontFamily:`var(--font-mono)`,children:`work`}),(0,R.jsx)(`rect`,{x:`60`,y:`86`,width:`100`,height:`34`,rx:`8`,fill:`var(--color-surface)`,stroke:`var(--color-wire)`,strokeWidth:`1.3`}),(0,R.jsx)(`text`,{x:`110`,y:`107`,textAnchor:`middle`,fontSize:`11`,fill:`var(--color-primary)`,fontFamily:`var(--font-mono)`,children:`verify`}),(0,R.jsx)(`rect`,{x:`48`,y:`140`,width:`124`,height:`24`,rx:`12`,fill:`var(--color-success-soft)`,stroke:`var(--color-success)`,strokeWidth:`1.2`}),(0,R.jsx)(`text`,{x:`110`,y:`156`,textAnchor:`middle`,fontSize:`9.5`,fill:`var(--color-success)`,fontFamily:`var(--font-mono)`,children:`✓ proof → PR`})]})}function zr({code:e,label:t}){return(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,R.jsx)(`code`,{className:`shrink-0 rounded-[5px] bg-raised px-1.5 py-0.5 font-mono text-micro text-primary`,children:e}),(0,R.jsx)(`span`,{className:`truncate text-caption text-secondary`,children:t})]})}var Br=[`row-start-2`,`row-start-3`,`row-start-4`];function Q(e,t){return{"--lpb-i":e,"--lpb-c":`var(--color-${t})`}}var Vr={warn:`bg-warn-soft text-warn`,interactive:`bg-interactive-soft text-interactive`,success:`bg-success-soft text-success`};function Hr({tone:e,children:t}){return(0,R.jsx)(`span`,{"aria-hidden":!0,className:`flex size-6 shrink-0 items-center justify-center rounded-[7px] ${Vr[e]}`,children:t})}function Ur(){return(0,R.jsxs)(`svg`,{viewBox:`0 0 16 16`,className:`size-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:[(0,R.jsx)(`circle`,{cx:`8`,cy:`8.6`,r:`1.7`,fill:`currentColor`,stroke:`none`}),(0,R.jsx)(`path`,{d:`M8 6.4 V2.6 M9.7 9.8 L12.9 12 M6.3 9.8 L3.1 12`}),(0,R.jsx)(`path`,{d:`M4.9 3.4 A5.4 5.4 0 0 1 11.1 3.4`,opacity:`0.45`})]})}function Wr(){return(0,R.jsxs)(`svg`,{viewBox:`0 0 16 16`,className:`size-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinejoin:`round`,children:[(0,R.jsx)(`path`,{d:`M8 1.8 L14 4.8 V11.2 L8 14.2 L2 11.2 V4.8 Z`}),(0,R.jsx)(`path`,{d:`M2 4.8 L8 7.8 L14 4.8 M8 7.8 V14.2`})]})}function Gr(){return(0,R.jsxs)(`svg`,{viewBox:`0 0 16 16`,className:`size-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`path`,{d:`M8 1.5 L13.5 3.5 V8 C13.5 11.2 11.2 13.6 8 14.5 C4.8 13.6 2.5 11.2 2.5 8 V3.5 Z`}),(0,R.jsx)(`path`,{d:`M5.6 8.2 L7.3 9.9 L10.6 6.3`})]})}function Kr(){return(0,R.jsxs)(`div`,{className:`rounded-card border border-hairline bg-surface p-5 shadow-card sm:p-7`,children:[(0,R.jsxs)(`div`,{className:`mb-5 grid grid-cols-1 gap-4 border-b border-hairline pb-5 sm:grid-cols-3`,children:[(0,R.jsx)(Jr,{name:`Orchestrator`,tone:`warn`,stage:0,icon:(0,R.jsx)(Ur,{}),line:`Wakes on the trigger and finds the task: reads what changed, picks the single most worthwhile thing this run. It never does the work itself.`}),(0,R.jsx)(Jr,{name:`Executor`,tone:`interactive`,stage:1,icon:(0,R.jsx)(Wr,{}),line:`Does the work in an isolated box, a fresh git worktree per task, so lanes never touch your checkout or each other.`}),(0,R.jsx)(Jr,{name:`Verifier`,tone:`success`,stage:2,icon:(0,R.jsx)(Gr,{}),line:`Independently proves each result and attaches the evidence: a screenshot, a video, a fact-check. That proof is what you review.`})]}),(0,R.jsx)(`div`,{className:`-m-2 overflow-x-auto p-2`,children:(0,R.jsxs)(`div`,{role:`img`,"aria-label":`A trigger fires the orchestrator, which dispatches tasks to parallel executor and verifier lanes; each lane ends in a PR with proof, and every run reports back into state and logs`,className:`grid min-w-[900px] grid-cols-[216px_72px_minmax(150px,1fr)_56px_minmax(170px,1fr)_56px_180px] grid-rows-[auto_repeat(3,84px)_auto] gap-y-3`,children:[(0,R.jsxs)(`div`,{className:`col-start-1 row-start-1 flex flex-col items-center`,children:[(0,R.jsxs)(`div`,{className:`lpb-stage inline-flex items-center gap-1.5 rounded-full border border-wire bg-surface px-4 py-1.5 font-mono text-label text-primary`,style:Q(0,`warn`),children:[(0,R.jsx)(`span`,{"aria-hidden":!0,children:`⏰`}),` trigger fires`]}),(0,R.jsxs)(`svg`,{"aria-hidden":!0,className:`-mb-4 h-8 w-3`,viewBox:`0 0 12 32`,children:[(0,R.jsx)(`line`,{x1:`6`,y1:`0`,x2:`6`,y2:`24`,stroke:`var(--color-warn)`,strokeWidth:`1.5`}),(0,R.jsx)(`path`,{d:`M1.5,23 L6,31 L10.5,23 z`,fill:`var(--color-warn)`})]})]}),(0,R.jsxs)(`div`,{className:`lpb-stage relative col-start-1 row-span-3 row-start-2 flex flex-col overflow-hidden rounded-control border border-wire bg-surface p-4 pl-5 shadow-card`,style:Q(0,`warn`),children:[(0,R.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-y-2 left-0 w-1 rounded-r-full bg-rubik-orange`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(Hr,{tone:`warn`,children:(0,R.jsx)(Ur,{})}),(0,R.jsx)(`span`,{className:`font-pixel text-[15px] text-display`,children:`Orchestrator`})]}),(0,R.jsx)(`div`,{className:`mt-1.5 font-mono text-micro text-secondary`,children:`find the work, don't do it`}),(0,R.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-1.5`,children:[`🐛 errors`,`📥 inbox`,`📈 metrics`,`🔀 PRs`].map(e=>(0,R.jsx)(`span`,{className:`rounded-[6px] bg-raised px-1.5 py-1 text-center font-mono text-micro text-secondary`,children:e},e))}),(0,R.jsx)(`div`,{className:`mt-3 rounded-control border border-warn/50 bg-warn-soft px-2 py-1.5 text-center font-mono text-label font-medium text-warn`,children:`prioritise → dispatch`}),(0,R.jsxs)(`div`,{className:`mt-2 text-center font-mono text-micro leading-snug text-secondary`,children:[`one task per lane,`,(0,R.jsx)(`br`,{}),`lanes never touch`]}),(0,R.jsx)(`div`,{className:`lpb-stage mt-auto rounded-control border border-success/40 bg-success-soft px-2 py-1.5 text-center font-mono text-micro text-success`,style:Q(4,`success`),children:`✍ writes memory + logs`})]}),(0,R.jsxs)(`svg`,{"aria-hidden":!0,className:`lpb-flow col-start-2 row-span-3 row-start-2 h-full w-full`,style:Q(1,`warn`),viewBox:`0 0 72 276`,preserveAspectRatio:`none`,children:[(0,R.jsx)(`defs`,{children:(0,R.jsx)(`marker`,{id:`rf-warn`,markerWidth:`8`,markerHeight:`8`,refX:`6.5`,refY:`4`,orient:`auto`,children:(0,R.jsx)(`path`,{d:`M0,0 L8,4 L0,8 z`,fill:`var(--color-warn)`})})}),(0,R.jsx)(`path`,{d:`M2,138 C42,138 28,42 62,42`,fill:`none`,stroke:`var(--color-warn)`,strokeWidth:`1.5`,markerEnd:`url(#rf-warn)`}),(0,R.jsx)(`path`,{d:`M2,138 L62,138`,fill:`none`,stroke:`var(--color-warn)`,strokeWidth:`1.5`,markerEnd:`url(#rf-warn)`}),(0,R.jsx)(`path`,{d:`M2,138 C42,138 28,234 62,234`,fill:`none`,stroke:`var(--color-warn)`,strokeWidth:`1.5`,markerEnd:`url(#rf-warn)`})]}),[`A`,`B`,`C`].map((e,t)=>{let n=Br[t],r=e===`B`;return(0,R.jsxs)(L.Fragment,{children:[(0,R.jsx)(`div`,{className:`col-start-3 ${n}`,children:(0,R.jsxs)(`div`,{className:`lpb-stage relative flex h-full flex-col items-center justify-center rounded-control border border-wire bg-surface shadow-card`,style:Q(1,`interactive`),children:[(0,R.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-1.5 rounded-[7px] border border-dashed border-interactive/40`}),(0,R.jsxs)(`span`,{className:`absolute -top-2 left-3 rounded bg-surface px-1.5 font-mono text-micro text-warn`,children:[`task `,e]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(Hr,{tone:`interactive`,children:(0,R.jsx)(Wr,{})}),(0,R.jsx)(`span`,{className:`text-meta font-semibold text-display`,children:`Executor`})]}),(0,R.jsx)(`div`,{className:`mt-1.5 font-mono text-micro text-interactive`,children:`isolated worktree`})]})}),(0,R.jsxs)(`div`,{className:`lpb-flow relative col-start-4 ${n} flex items-center px-1`,style:Q(2,`warn`),children:[(0,R.jsx)(qr,{tone:`warn`}),r&&(0,R.jsxs)(`div`,{className:`absolute inset-x-1 top-[calc(50%+12px)] flex flex-col items-center`,children:[(0,R.jsx)(qr,{tone:`warn`,dashed:!0,flip:!0}),(0,R.jsx)(`span`,{className:`mt-0.5 font-mono text-micro text-warn`,children:`fail→fix`})]})]}),(0,R.jsx)(`div`,{className:`col-start-5 ${n}`,children:(0,R.jsxs)(`div`,{className:`lpb-stage relative flex h-full flex-col items-center justify-center overflow-hidden rounded-control border border-wire bg-surface shadow-card`,style:Q(2,`success`),children:[(0,R.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-y-2 right-0 w-1 rounded-l-full bg-rubik-green`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(Hr,{tone:`success`,children:(0,R.jsx)(Gr,{})}),(0,R.jsx)(`span`,{className:`text-meta font-semibold text-display`,children:`Verifier`})]}),(0,R.jsx)(`div`,{className:`mt-1.5 font-mono text-micro text-secondary`,children:`drive the app · 📸 evidence`})]})}),(0,R.jsx)(`div`,{className:`lpb-flow col-start-6 ${n} flex items-center px-1`,style:Q(3,`success`),children:(0,R.jsx)(qr,{tone:`success`})}),(0,R.jsx)(`div`,{className:`col-start-7 ${n} flex items-center`,children:(0,R.jsxs)(`div`,{className:`lpb-stage flex h-[64px] w-full flex-col items-center justify-center rounded-control border border-success/40 bg-success-soft`,style:Q(3,`success`),children:[(0,R.jsx)(`div`,{className:`font-mono text-label font-semibold text-success`,children:`✓ PR + proof`}),(0,R.jsx)(`div`,{className:`mt-1 font-mono text-micro text-success/80`,children:`approve in seconds`})]})})]},e)}),(0,R.jsxs)(`div`,{className:`lpb-flow relative col-span-full row-start-5 h-10`,style:Q(4,`success`),children:[(0,R.jsx)(`span`,{"aria-hidden":!0,className:`absolute right-[90px] top-[-22px] bottom-1/2 border-r border-dashed border-success/70`}),(0,R.jsx)(`span`,{"aria-hidden":!0,className:`absolute left-[107px] top-[-9px] bottom-1/2 border-l border-dashed border-success/70`}),(0,R.jsx)(`svg`,{"aria-hidden":!0,className:`absolute left-[102px] top-[-15px] h-2 w-[11px]`,viewBox:`0 0 11 8`,children:(0,R.jsx)(`path`,{d:`M0,8 L5.5,0 L11,8 z`,fill:`var(--color-success)`})}),(0,R.jsx)(`span`,{"aria-hidden":!0,className:`absolute left-[107px] right-[90px] top-1/2 border-t border-dashed border-success/70`}),(0,R.jsx)(`span`,{className:`absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 whitespace-nowrap bg-surface px-2.5 font-mono text-micro text-success`,children:`every run reports back → orchestrator writes memory + logs`})]})]})})]})}function qr({tone:e,dashed:t,flip:n}){let r=e===`warn`?`var(--color-warn)`:`var(--color-success)`;return(0,R.jsxs)(`svg`,{"aria-hidden":!0,className:`h-3 w-full ${n?`rotate-180`:``}`,viewBox:`0 0 56 12`,preserveAspectRatio:`none`,children:[(0,R.jsx)(`line`,{x1:`2`,y1:`6`,x2:`45`,y2:`6`,stroke:r,strokeWidth:`1.5`,strokeDasharray:t?`4 4`:void 0}),(0,R.jsx)(`path`,{d:`M44,1.5 L54,6 L44,10.5 z`,fill:r})]})}function Jr({name:e,line:t,tone:n,stage:r,icon:i}){return(0,R.jsxs)(`div`,{className:`lpb-stage -m-2 min-w-0 rounded-control p-2`,style:Q(r,n),children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(Hr,{tone:n,children:i}),(0,R.jsx)(`span`,{className:`text-meta font-semibold text-display`,children:e})]}),(0,R.jsx)(`p`,{className:`mt-1.5 text-caption leading-snug text-secondary`,children:t})]})}function Yr(){return(0,R.jsxs)(`svg`,{viewBox:`0 0 980 372`,width:`100%`,className:`mx-auto block max-w-[880px]`,role:`img`,"aria-label":`Compute per run over a loop's lifetime: high while born agentic, flat after graduating to a cheap script, spiking briefly when a tripwire trips and at a scheduled re-audit`,children:[(0,R.jsx)(`defs`,{children:(0,R.jsxs)(`linearGradient`,{id:`lp-cc-fill`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,R.jsx)(`stop`,{offset:`0%`,stopColor:`var(--color-rubik-orange)`,stopOpacity:`0.2`}),(0,R.jsx)(`stop`,{offset:`100%`,stopColor:`var(--color-rubik-orange)`,stopOpacity:`0`})]})}),(0,R.jsx)(`line`,{x1:`70`,y1:`40`,x2:`70`,y2:`312`,stroke:`var(--color-wire)`,strokeWidth:`1.2`}),(0,R.jsx)(`line`,{x1:`70`,y1:`312`,x2:`912`,y2:`312`,stroke:`var(--color-wire)`,strokeWidth:`1.2`}),(0,R.jsx)(`text`,{x:`70`,y:`26`,fontFamily:`var(--font-mono)`,fontSize:`12`,fill:`var(--color-secondary)`,children:`compute / run`}),(0,R.jsx)(`text`,{x:`912`,y:`340`,textAnchor:`end`,fontFamily:`var(--font-mono)`,fontSize:`12`,fill:`var(--color-secondary)`,children:`loop lifetime →`}),(0,R.jsx)(`path`,{d:`M70,72 C150,66 210,96 260,160 C300,210 330,256 372,262 L520,262 C544,262 560,108 580,104 C600,100 620,254 648,262 L772,262 C786,262 796,176 810,173 C824,170 836,256 854,262 L912,262 L912,312 L70,312 Z`,fill:`url(#lp-cc-fill)`}),(0,R.jsx)(`path`,{d:`M70,72 C150,66 210,96 260,160 C300,210 330,256 372,262 L520,262 C544,262 560,108 580,104 C600,100 620,254 648,262 L772,262 C786,262 796,176 810,173 C824,170 836,256 854,262 L912,262`,fill:`none`,stroke:`var(--color-warn)`,strokeWidth:`2.4`}),(0,R.jsxs)(`g`,{fontFamily:`var(--font-mono)`,children:[(0,R.jsx)(`text`,{x:`150`,y:`58`,fontSize:`13`,fontWeight:`600`,fill:`var(--color-display)`,children:`Born agentic`}),(0,R.jsx)(`text`,{x:`150`,y:`76`,fontSize:`11.5`,fill:`var(--color-secondary)`,children:`learns the pattern`}),(0,R.jsx)(`line`,{x1:`372`,y1:`262`,x2:`372`,y2:`300`,stroke:`var(--color-success)`,strokeWidth:`1.2`,strokeDasharray:`4 4`}),(0,R.jsx)(`text`,{x:`430`,y:`292`,textAnchor:`middle`,fontSize:`12.5`,fontWeight:`600`,fill:`var(--color-success)`,children:`Graduates → cheap script`}),(0,R.jsx)(`circle`,{cx:`580`,cy:`104`,r:`4`,fill:`var(--color-warn)`}),(0,R.jsx)(`text`,{x:`580`,y:`92`,textAnchor:`middle`,fontSize:`12`,fontWeight:`600`,fill:`var(--color-warn)`,children:`tripwire trips`}),(0,R.jsx)(`text`,{x:`580`,y:`76`,textAnchor:`middle`,fontSize:`11`,fill:`var(--color-secondary)`,children:`agent re-wakes`}),(0,R.jsx)(`circle`,{cx:`810`,cy:`173`,r:`4`,fill:`var(--color-rubik-yellow)`}),(0,R.jsx)(`text`,{x:`812`,y:`158`,textAnchor:`middle`,fontSize:`11`,fontWeight:`600`,fill:`var(--color-running)`,children:`scheduled re-audit`})]})]})}var Xr=[{c:`var(--color-success)`,status:`resolved`,note:`fixed the null-team crash, PR #1027 + video proof`},{c:`var(--color-secondary)`,status:`no update`,note:`docs still match the code, clean stop ($0.03)`},{c:`var(--color-success)`,status:`resolved`,note:`4 tickets answered, export-friction signal filed`},{c:`var(--color-accent)`,status:`error`,note:`verify failed on a flaky selector, lesson saved to state`},{c:`var(--color-success)`,status:`resolved`,note:`2 dependency patches tested in a worktree, merged`},{c:`var(--color-success)`,status:`resolved`,note:`worst prod error root-caused, fingerprint now watched`}],Zr=[`📜 contract sharpened`,`🚧 boundaries redrawn`,`⚙️ repeated steps → script`,`⏰ trigger re-tuned`,`📊 dashboard updated`];function Qr(){let[e,t]=(0,L.useState)(0),[n,r]=(0,L.useState)(!1),i=(0,L.useRef)(null),a=(0,L.useRef)(null),o=()=>{a.current&&clearInterval(a.current),t(0),a.current=setInterval(()=>{t(e=>Math.min(e+1,14))},500)};(0,L.useEffect)(()=>{e>=14&&a.current&&(clearInterval(a.current),a.current=null)},[e]),(0,L.useEffect)(()=>{if(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches){r(!0);return}let e=i.current;if(!e)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(t.disconnect(),o())},{threshold:.35});return t.observe(e),()=>{t.disconnect(),a.current&&clearInterval(a.current)}},[]);let s=t=>n||e>=t,c=!n&&e===8,l=!n&&e>=1&&e<=6?e-1:-1,u=n||e>=14,d=n?{c:`var(--color-success)`,head:``,text:`the next run starts one step smarter, and cheaper`}:e===0?{c:`var(--color-wire)`,head:``,text:`a loop, run by run…`}:e<=6?{c:Xr[e-1].c,head:Xr[e-1].status,text:Xr[e-1].note}:e<=8?{c:`var(--color-interactive)`,head:`evolve`,text:`reading all six runs: where was money wasted? which boundary is too loose?`}:e<=13?{c:`var(--color-interactive)`,head:`evolve`,text:`rewriting the loop itself:`}:{c:`var(--color-success)`,head:``,text:`the next run starts one step smarter, and cheaper`};return(0,R.jsxs)(`div`,{ref:i,className:`relative py-2`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:o,tabIndex:u&&!n?0:-1,"aria-hidden":!(u&&!n),className:`absolute -top-1 right-0 inline-flex cursor-pointer items-center gap-1.5 rounded-full border border-hairline px-3 py-1 font-mono text-caption text-secondary transition-opacity duration-300 hover:bg-raised hover:text-display ${u&&!n?`opacity-100`:`pointer-events-none opacity-0`}`,children:[(0,R.jsx)(`span`,{"aria-hidden":!0,children:`↺`}),` replay`]}),(0,R.jsxs)(`div`,{className:`-mx-2 flex min-w-0 items-center justify-center gap-2 overflow-x-auto px-2 py-2`,children:[Xr.map((e,t)=>(0,R.jsx)(`span`,{title:`${e.status} · ${e.note}`,className:`h-10 w-9 shrink-0 rounded-[7px] transition-all duration-300 ${s(t+1)?`scale-100 opacity-100`:`scale-50 opacity-0`}`,style:{background:e.c,boxShadow:l===t?`0 0 0 2px var(--color-surface), 0 0 0 4px ${e.c}`:c?`0 0 0 2px var(--color-surface), 0 0 0 4px var(--color-interactive)`:void 0,transitionDelay:c?`${(Xr.length-1-t)*70}ms`:`0ms`}},t)),(0,R.jsx)(`span`,{"aria-hidden":!0,className:`w-8 shrink-0 border-t-2 border-dashed border-wire transition-opacity duration-300 ${s(7)?`opacity-100`:`opacity-0`}`}),(0,R.jsx)(`span`,{className:`flex h-10 shrink-0 items-center rounded-[7px] bg-interactive px-3.5 font-mono text-label font-medium text-white transition-all duration-300 ${s(7)?`scale-100 opacity-100`:`scale-50 opacity-0`} ${c?`animate-pulse`:``}`,children:`evolve`}),(0,R.jsxs)(`span`,{"aria-hidden":!0,className:`flex shrink-0 items-center gap-2.5 transition-opacity duration-500 ${s(14)?`opacity-100`:`opacity-0`}`,children:[(0,R.jsx)(`span`,{className:`w-10 border-t-2 border-dashed border-wire`}),(0,R.jsx)(`span`,{className:`size-[15px] rounded-full border-2 border-wire`})]})]}),(0,R.jsxs)(`div`,{className:`mt-4 flex h-6 min-w-0 items-center justify-center gap-2`,children:[(0,R.jsx)(`span`,{"aria-hidden":!0,className:`size-2.5 shrink-0 rounded-[3px] transition-colors duration-300`,style:{background:d.c}}),(0,R.jsxs)(`span`,{className:`truncate font-mono text-label text-primary`,children:[d.head&&(0,R.jsxs)(`span`,{className:`font-medium`,style:{color:d.c},children:[d.head,` · `]}),d.text]})]}),(0,R.jsx)(`div`,{className:`mt-4 flex flex-wrap items-center justify-center gap-2`,children:Zr.map((e,t)=>(0,R.jsx)(`span`,{className:`rounded-full border border-interactive/40 bg-interactive-soft px-3 py-1.5 font-mono text-caption text-interactive transition-all duration-300 ${s(9+t)?`translate-y-0 opacity-100`:`-translate-y-1.5 opacity-0`}`,children:e},e))}),(0,R.jsx)(`div`,{className:`mt-4 text-center font-mono text-caption text-disabled transition-opacity duration-500 ${s(14)?`opacity-100`:`opacity-0`}`,children:`next run, one step smarter`})]})}function $({children:e}){return(0,R.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2 text-body text-paper/85`,children:[(0,R.jsx)(`span`,{"aria-hidden":!0,className:`mt-px shrink-0 text-rubik-green`,children:`✓`}),(0,R.jsx)(`span`,{children:e})]})}var $r=`modulepreload`,ei=function(e){return`/`+e},ti={},ni=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=ei(t,n),t in ti)return;ti[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:$r,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};export{_e as A,x as B,je as C,De as D,Ae as E,fe as F,ae as G,ce as H,ie as I,h as J,te as K,de as L,ve as M,O as N,Ee as O,ye as P,S as R,we as S,I as T,u as U,ue as V,p as W,g as Y,Ge as _,jr as a,Ve as b,Or as c,xt as d,gt as f,We as g,qe as h,Nr as i,k as j,be as k,wt as l,Ze as m,Pr as n,Er as o,it as p,c as q,Mr as r,Dr as s,ni as t,St as u,ze as v,Ne as w,Fe as x,Be as y,le as z};