durable-actors-observer 0.7.11 → 0.7.13

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.
package/dist/client.d.ts CHANGED
@@ -85,6 +85,7 @@ export interface RequestTrace {
85
85
  startedAtMs: number;
86
86
  durationMs: number;
87
87
  queueWaitMs: number | null;
88
+ hostState: "cold" | "warm";
88
89
  outcome: "completed" | "failed" | "rejected" | "rerouted" | "interrupted";
89
90
  }
90
91
  export interface RequestHistoryQuery {
package/dist/index.js CHANGED
@@ -1636,6 +1636,10 @@ function At({ record: e, timing: t }) {
1636
1636
  Time: new Date(e.startedAtMs).toLocaleString(),
1637
1637
  Transport: e.kind === "method" ? "Method" : "WebSocket",
1638
1638
  Outcome: e.outcome,
1639
+ "Host state": {
1640
+ cold: "Cold",
1641
+ warm: "Warm"
1642
+ }[e.hostState],
1639
1643
  Total: B(e.durationMs),
1640
1644
  "Queue wait": e.queueWaitMs === null ? "Did not begin processing" : B(e.queueWaitMs),
1641
1645
  ...t ? {
@@ -4298,7 +4302,7 @@ function Nr(e) {
4298
4302
  "rejected",
4299
4303
  "rerouted",
4300
4304
  "interrupted"
4301
- ].includes(t.outcome) && (t.connectionId === null || typeof t.connectionId == "string") && Number.isFinite(t.durationMs) && t.durationMs >= 0 && (t.queueWaitMs === null || Number.isFinite(t.queueWaitMs) && t.queueWaitMs >= 0 && t.queueWaitMs <= t.durationMs);
4305
+ ].includes(t.outcome) && (t.connectionId === null || typeof t.connectionId == "string") && ["cold", "warm"].includes(t.hostState) && Number.isFinite(t.durationMs) && t.durationMs >= 0 && (t.queueWaitMs === null || Number.isFinite(t.queueWaitMs) && t.queueWaitMs >= 0 && t.queueWaitMs <= t.durationMs);
4302
4306
  }
4303
4307
  //#endregion
4304
4308
  export { Xt as ActorObserver, U as Badge, z as Button, Ve as Calendar, He as CalendarDayButton, he as Command, ve as CommandEmpty, ye as CommandGroup, ge as CommandInput, xe as CommandItem, _e as CommandList, be as CommandSeparator, Se as CommandShortcut, br as ConsoleApp, ut as Drawer, pt as DrawerClose, ht as DrawerContent, yt as DrawerDescription, _t as DrawerFooter, gt as DrawerHeader, mt as DrawerOverlay, ft as DrawerPortal, vt as DrawerTitle, dt as DrawerTrigger, Ce as FilterCombobox, Er as HttpObserverClient, V as Input, Sn as Overview, Ue as Popover, Ke as PopoverAnchor, Ge as PopoverContent, Ye as PopoverDescription, qe as PopoverHeader, Je as PopoverTitle, We as PopoverTrigger, Ot as RequestObserver, Ie as RequestTimeline, or as Sheet, lr as SheetContent, cr as SheetDescription, sr as SheetTitle, Kn as SocketTimeline, G as Table, q as TableBody, St as TableCaption, X as TableCell, xt as TableFooter, Y as TableHead, K as TableHeader, J as TableRow, nt as TimeRangePicker, dr as WebSocketObserver, lt as badgeVariants, Te as buttonVariants, Ze as defaultTimeRange, $e as rangeLabel, Qe as resolveRange };
@@ -48,7 +48,7 @@ Error generating stack: `+e.message+`
48
48
  .allow-interactivity-${e} {pointer-events: all;}
49
49
  `},fi=0,pi=[];function mi(e){var t=O.useRef([]),n=O.useRef([0,0]),r=O.useRef(),i=O.useState(fi++)[0],a=O.useState(Ir)[0],o=O.useRef(e);O.useEffect(function(){o.current=e},[e]),O.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=fr([e.lockRef.current],(e.shards||[]).map(li),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=O.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=si(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=ei(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=ei(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return oi(h,t,e,h===`h`?s:c,!0)},[]),c=O.useCallback(function(e){var n=e;if(pi.length&&pi[pi.length-1]===a){var r=`deltaY`in n?ci(n):si(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&ui(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(li).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=O.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:hi(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=O.useCallback(function(e){n.current=si(e),r.current=void 0},[]),d=O.useCallback(function(t){l(t.type,ci(t),t.target,s(t,e.lockRef.current))},[]),f=O.useCallback(function(t){l(t.type,si(t),t.target,s(t,e.lockRef.current))},[]);O.useEffect(function(){return pi.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Yr),document.addEventListener(`touchmove`,c,Yr),document.addEventListener(`touchstart`,u,Yr),function(){pi=pi.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Yr),document.removeEventListener(`touchmove`,c,Yr),document.removeEventListener(`touchstart`,u,Yr)}},[]);var p=e.removeScrollBar,m=e.inert;return O.createElement(O.Fragment,null,m?O.createElement(a,{styles:di(i)}):null,p?O.createElement(Kr,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function hi(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var gi=Er(Dr,mi),_i=O.forwardRef(function(e,t){return O.createElement(kr,ur({},e,{ref:t,sideCar:gi}))});_i.classNames=kr.classNames;var vi=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},yi=new WeakMap,bi=new WeakMap,xi={},Si=0,Ci=function(e){return e&&(e.host||Ci(e.parentNode))},wi=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Ci(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Ti=function(e,t,n,r){var i=wi(t,Array.isArray(e)?e:[e]);xi[n]||(xi[n]=new WeakMap);var a=xi[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(yi.get(e)||0)+1,l=(a.get(e)||0)+1;yi.set(e,c),a.set(e,l),o.push(e),c===1&&i&&bi.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Si++,function(){o.forEach(function(e){var t=yi.get(e)-1,i=a.get(e)-1;yi.set(e,t),a.set(e,i),t||(bi.has(e)||e.removeAttribute(r),bi.delete(e)),i||e.removeAttribute(n)}),Si--,Si||(yi=new WeakMap,yi=new WeakMap,bi=new WeakMap,xi={})}},Ei=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||vi(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Ti(r,i,n,`aria-hidden`)):function(){return null}},Di=Object.defineProperty,Oi=(e,t)=>Di(e,`name`,{value:t,configurable:!0}),ki=`Dialog`,[Ai,ji]=wt(ki),[Mi,Ni]=Ai(ki),Pi=Oi(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=O.useRef(null),c=O.useRef(null),[l,u]=Bt({prop:r,defaultProp:i??!1,onChange:a,caller:ki}),[d,f]=O.useState(0),[p,m]=O.useState(0);return(0,R.jsx)(Mi,{scope:t,triggerRef:s,contentRef:c,contentId:jt(),titleId:jt(),descriptionId:jt(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:O.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),Fi=`DialogTrigger`,Ii=O.forwardRef(Oi(function(e,t){let{__scopeDialog:n,...r}=e,i=Ni(Fi,n),a=bt(t,i.triggerRef);return(0,R.jsx)(un.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":na(i.open),...r,ref:a,onClick:dt(e.onClick,i.onOpenToggle)})},`DialogTrigger`)),Li=`DialogPortal`,[Ri,zi]=Ai(Li,{forceMount:void 0}),Bi=Oi(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Ni(Li,t);return(0,R.jsx)(Ri,{scope:t,forceMount:n,children:O.Children.map(r,e=>(0,R.jsx)(Zn,{present:n||a.open,children:(0,R.jsx)(qn,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),Vi=`DialogOverlay`,Hi=O.forwardRef(Oi(function(e,t){let n=zi(Vi,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Ni(Vi,e.__scopeDialog);return a.modal?(0,R.jsx)(Zn,{present:r||a.open,children:(0,R.jsx)(Wi,{...i,ref:t})}):null},`DialogOverlay`)),Ui=qt(`DialogOverlay.RemoveScroll`),Wi=O.forwardRef(Oi(function(e,t){let{__scopeDialog:n,...r}=e,i=Ni(Vi,n),a=bt(t,Cn());return(0,R.jsx)(_i,{as:Ui,allowPinchZoom:!0,shards:[i.contentRef],children:(0,R.jsx)(un.div,{"data-state":na(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Gi=`DialogContent`,Ki=O.forwardRef(Oi(function(e,t){let n=zi(Gi,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Ni(Gi,e.__scopeDialog);return(0,R.jsx)(Zn,{present:r||a.open,children:a.modal?(0,R.jsx)(qi,{...i,ref:t}):(0,R.jsx)(Ji,{...i,ref:t})})},`DialogContent`)),qi=O.forwardRef(Oi(function(e,t){let n=Ni(Gi,e.__scopeDialog),r=O.useRef(null),i=bt(t,n.contentRef,r);return O.useEffect(()=>{let e=r.current;if(e)return Ei(e)},[]),(0,R.jsx)(Yi,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:dt(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:dt(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:dt(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Ji=O.forwardRef(Oi(function(e,t){let n=Ni(Gi,e.__scopeDialog),r=O.useRef(!1),i=O.useRef(!1);return(0,R.jsx)(Yi,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),Yi=O.forwardRef(Oi(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Ni(Gi,n);return cr(),(0,R.jsx)(R.Fragment,{children:(0,R.jsx)(Pn,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,R.jsx)(Sn,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":na(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),Xi=`DialogTitle`,Zi=O.forwardRef(Oi(function(e,t){let{__scopeDialog:n,...r}=e,i=Ni(Xi,n),{setTitleCount:a}=i;return Et(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,R.jsx)(un.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),Qi=`DialogDescription`,$i=O.forwardRef(Oi(function(e,t){let{__scopeDialog:n,...r}=e,i=Ni(Qi,n),{setDescriptionCount:a}=i;return Et(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,R.jsx)(un.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),ea=`DialogClose`,ta=O.forwardRef(Oi(function(e,t){let{__scopeDialog:n,...r}=e,i=Ni(ea,n);return(0,R.jsx)(un.button,{type:`button`,...r,ref:t,onClick:dt(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function na(e){return e?`open`:`closed`}Oi(na,`getState`);var ra=`[cmdk-group=""]`,ia=`[cmdk-group-items=""]`,B=`[cmdk-group-heading=""]`,aa=`[cmdk-item=""]`,oa=`${aa}:not([aria-disabled="true"])`,sa=`cmdk-item-select`,ca=`data-value`,la=(e,t,n)=>st(e,t,n),ua=O.createContext(void 0),da=()=>O.useContext(ua),fa=O.createContext(void 0),pa=()=>O.useContext(fa),ma=O.createContext(void 0),ha=O.forwardRef((e,t)=>{let n=ka(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=ka(()=>new Set),i=ka(()=>new Map),a=ka(()=>new Map),o=ka(()=>new Set),s=Da(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=jt(),y=jt(),b=jt(),x=O.useRef(null),S=Ma();Oa(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),Oa(()=>{S(6,A)},[]);let C=O.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)k(),E(),S(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=j()?.id,C.emit()}),r||S(5,A),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=O.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),S(2,()=>{E(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{k(),E(),n.current.value||D(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=j();S(4,()=>{k(),t?.getAttribute(`id`)===e&&D(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function T(e,t){let r=s.current?.filter??la;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;M().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(ia);t?t.appendChild(e.parentElement===t?e:e.closest(`${ia} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${ia} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${ra}[${ca}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=M().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(ca);C.setState(`value`,e||void 0)}function k(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=T(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function A(){var e;let t=j();t&&(t.parentElement?.firstChild===t&&((e=t.closest(ra)?.querySelector(B))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function j(){return x.current?.querySelector(`${aa}[aria-selected="true"]`)}function M(){return Array.from(x.current?.querySelectorAll(oa)||[])}function N(e){let t=M()[e];t&&C.setState(`value`,t.getAttribute(ca))}function ee(e){var t;let n=j(),r=M(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(ca))}function te(e){let t=j()?.closest(ra),n;for(;t&&!n;)t=e>0?Ta(t,ra):Ea(t,ra),n=t?.querySelector(oa);n?C.setState(`value`,n.getAttribute(ca)):ee(e)}let P=()=>N(M().length-1),ne=e=>{e.preventDefault(),e.metaKey?P():e.altKey?te(1):ee(1)},re=e=>{e.preventDefault(),e.metaKey?N(0):e.altKey?te(-1):ee(-1)};return O.createElement(un.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&ne(e);break;case`ArrowDown`:ne(e);break;case`p`:case`k`:g&&e.ctrlKey&&re(e);break;case`ArrowUp`:re(e);break;case`Home`:e.preventDefault(),N(0);break;case`End`:e.preventDefault(),P();break;case`Enter`:{e.preventDefault();let t=j();if(t){let e=new Event(sa);t.dispatchEvent(e)}}}}},O.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:Fa},c),Pa(e,e=>O.createElement(fa.Provider,{value:C},O.createElement(ua.Provider,{value:w},e))))}),ga=O.forwardRef((e,t)=>{let n=jt(),r=O.useRef(null),i=O.useContext(ma),a=da(),o=Da(e),s=o.current?.forceMount??i?.forceMount;Oa(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=ja(n,r,[e.value,e.children,r],e.keywords),l=pa(),u=Aa(e=>e.value&&e.value===c.current),d=Aa(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);O.useEffect(()=>{let t=r.current;if(t&&!e.disabled)return t.addEventListener(sa,f),()=>t.removeEventListener(sa,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return O.createElement(un.div,{ref:yt(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),_a=O.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=jt(),s=O.useRef(null),c=O.useRef(null),l=jt(),u=da(),d=Aa(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));Oa(()=>u.group(o),[]),ja(o,s,[e.value,e.heading,c]);let f=O.useMemo(()=>({id:o,forceMount:i}),[i]);return O.createElement(un.div,{ref:yt(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!d||void 0},n&&O.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),Pa(e,e=>O.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},O.createElement(ma.Provider,{value:f},e))))}),va=O.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=O.useRef(null),a=Aa(e=>!e.search);return!n&&!a?null:O.createElement(un.div,{ref:yt(i,t),...r,"cmdk-separator":``,role:`separator`})}),ya=O.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=pa(),o=Aa(e=>e.search),s=Aa(e=>e.selectedItemId),c=da();return O.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),O.createElement(un.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),ba=O.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=O.useRef(null),o=O.useRef(null),s=Aa(e=>e.selectedItemId),c=da();return O.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),O.createElement(un.div,{ref:yt(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},Pa(e,e=>O.createElement(`div`,{ref:yt(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),xa=O.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return O.createElement(Pi,{open:n,onOpenChange:r},O.createElement(Bi,{container:o},O.createElement(Hi,{"cmdk-overlay":``,className:i}),O.createElement(Ki,{"aria-label":e.label,"cmdk-dialog":``,className:a},O.createElement(ha,{ref:t,...s}))))}),Sa=O.forwardRef((e,t)=>Aa(e=>e.filtered.count===0)?O.createElement(un.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),Ca=O.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return O.createElement(un.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Pa(e,e=>O.createElement(`div`,{"aria-hidden":!0},e)))}),wa=Object.assign(ha,{List:ba,Item:ga,Input:ya,Group:_a,Separator:va,Dialog:xa,Empty:Sa,Loading:Ca});function Ta(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Ea(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Da(e){let t=O.useRef(e);return Oa(()=>{t.current=e}),t}var Oa=typeof window>`u`?O.useEffect:O.useLayoutEffect;function ka(e){let t=O.useRef();return t.current===void 0&&(t.current=e()),t}function Aa(e){let t=pa(),n=()=>e(t.snapshot());return O.useSyncExternalStore(t.subscribe,n,n)}function ja(e,t,n,r=[]){let i=O.useRef(),a=da();return Oa(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(ca,s),i.current=s}),i}var Ma=()=>{let[e,t]=O.useState(),n=ka(()=>new Map);return Oa(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Na(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function Pa({asChild:e,children:t},n){return e&&O.isValidElement(t)?O.cloneElement(Na(t),{ref:t.ref},n(t.props.children)):n(t)}var Fa={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function Ia(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Ia(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function La(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Ia(e))&&(r&&(r+=` `),r+=t);return r}var Ra=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},za=(e,t)=>({classGroupId:e,validator:t}),Ba=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Va=`-`,Ha=[],Ua=`arbitrary..`,Wa=e=>{let t=qa(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Ka(e);let n=e.split(Va);return Ga(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Ra(i,t):t:i||Ha}return n[e]||Ha}}},Ga=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Ga(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Va):e.slice(t).join(Va),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Ka=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Ua+r:void 0})(),qa=e=>{let{theme:t,classGroups:n}=e;return Ja(n,t)},Ja=(e,t)=>{let n=Ba();for(let r in e){let i=e[r];Ya(i,n,r,t)}return n},Ya=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Xa(i,t,n,r)}},Xa=(e,t,n,r)=>{if(typeof e==`string`){Za(e,t,n);return}if(typeof e==`function`){Qa(e,t,n,r);return}$a(e,t,n,r)},Za=(e,t,n)=>{let r=e===``?t:eo(t,e);r.classGroupId=n},Qa=(e,t,n,r)=>{if(to(e)){Ya(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(za(n,e))},$a=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Ya(o,eo(t,a),n,r)}},eo=(e,t)=>{let n=e,r=t.split(Va),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Ba(),n.nextPart.set(t,i)),n=i}return n},to=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,no=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},ro=`!`,io=`:`,ao=[],oo=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),so=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===io){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(ro)?(c=s.slice(0,-1),l=!0):s.startsWith(ro)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return oo(t,l,c,u)};if(t){let e=t+io,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):oo(ao,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},co=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},lo=e=>({cache:no(e.cacheSize),parseClassName:so(e),sortModifiers:co(e),postfixLookupClassGroupIds:uo(e),...Wa(e)}),uo=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},fo=/\s+/,po=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(fo),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+ro:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},mo=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=ho(n))&&(i&&(i+=` `),i+=r);return i},ho=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=ho(e[r]))&&(n&&(n+=` `),n+=t);return n},go=(e,...t)=>{let n,r,i,a,o=o=>(n=lo(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=po(e,n);return i(e,a),a};return a=o,(...e)=>a(mo(...e))},_o=[],vo=e=>{let t=t=>t[e]||_o;return t.isThemeGetter=!0,t.themeKey=e,t},yo=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,bo=/^\((?:(\w[\w-]*):)?(.+)\)$/i,xo=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,So=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Co=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,wo=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,To=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Eo=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Do=e=>xo.test(e),V=e=>!!e&&!Number.isNaN(Number(e)),Oo=e=>!!e&&Number.isInteger(Number(e)),ko=e=>e.endsWith(`%`)&&V(e.slice(0,-1)),Ao=e=>So.test(e),jo=()=>!0,Mo=e=>Co.test(e)&&!wo.test(e),No=()=>!1,Po=e=>To.test(e),Fo=e=>Eo.test(e),Io=e=>!H(e)&&!W(e),Lo=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),Ro=e=>Qo(e,ns,No),H=e=>yo.test(e),zo=e=>Qo(e,rs,Mo),Bo=e=>Qo(e,is,V),U=e=>Qo(e,os,jo),Vo=e=>Qo(e,as,No),Ho=e=>Qo(e,es,No),Uo=e=>Qo(e,ts,Fo),Wo=e=>Qo(e,ss,Po),W=e=>bo.test(e),Go=e=>$o(e,rs),Ko=e=>$o(e,as),qo=e=>$o(e,es),Jo=e=>$o(e,ns),Yo=e=>$o(e,ts),Xo=e=>$o(e,ss,!0),Zo=e=>$o(e,os,!0),Qo=(e,t,n)=>{let r=yo.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},$o=(e,t,n=!1)=>{let r=bo.exec(e);return r?r[1]?t(r[1]):n:!1},es=e=>e===`position`||e===`percentage`,ts=e=>e===`image`||e===`url`,ns=e=>e===`length`||e===`size`||e===`bg-size`,rs=e=>e===`length`,is=e=>e===`number`,as=e=>e===`family-name`,os=e=>e===`number`||e===`weight`,ss=e=>e===`shadow`,cs=()=>{let e=vo(`color`),t=vo(`font`),n=vo(`text`),r=vo(`font-weight`),i=vo(`tracking`),a=vo(`leading`),o=vo(`breakpoint`),s=vo(`container`),c=vo(`spacing`),l=vo(`radius`),u=vo(`shadow`),d=vo(`inset-shadow`),f=vo(`text-shadow`),p=vo(`drop-shadow`),m=vo(`blur`),h=vo(`perspective`),g=vo(`aspect`),_=vo(`ease`),v=vo(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),W,H],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[W,H,c],T=()=>[Do,`full`,`auto`,...w()],E=()=>[Oo,`none`,`subgrid`,W,H],D=()=>[`auto`,{span:[`full`,Oo,W,H]},Oo,W,H],O=()=>[Oo,`auto`,W,H],k=()=>[`auto`,`min`,`max`,`fr`,W,H],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Do,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ee=()=>[s,Do,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],te=()=>[Do,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[e,W,H],ne=()=>[...b(),qo,Ho,{position:[W,H]}],re=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ie=()=>[`auto`,`cover`,`contain`,Jo,Ro,{size:[W,H]}],ae=()=>[ko,Go,zo],oe=()=>[``,`none`,`full`,l,W,H],se=()=>[``,V,Go,zo],ce=()=>[`solid`,`dashed`,`dotted`,`double`],le=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],ue=()=>[V,ko,qo,Ho],de=()=>[``,`none`,m,W,H],fe=()=>[`none`,V,W,H],pe=()=>[`none`,V,W,H],F=()=>[V,W,H],me=()=>[Do,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Ao],breakpoint:[Ao],color:[jo],container:[Ao],"drop-shadow":[Ao],ease:[`in`,`out`,`in-out`],font:[Io],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Ao],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Ao],shadow:[Ao],spacing:[`px`,V],text:[Ao],"text-shadow":[Ao],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Do,H,W,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,W,H]}],"container-named":[Lo],columns:[{columns:[V,`auto`,H,W,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Oo,`auto`,W,H]}],basis:[{basis:[Do,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[V,Do,`auto`,`initial`,`none`,H]}],grow:[{grow:[``,V,W,H]}],shrink:[{shrink:[``,V,W,H]}],order:[{order:[Oo,`first`,`last`,`none`,W,H]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...ee()]}],"min-inline-size":[{"min-inline":[`auto`,...ee()]}],"max-inline-size":[{"max-inline":[`none`,...ee()]}],"block-size":[{block:[`auto`,...te()]}],"min-block-size":[{"min-block":[`auto`,...te()]}],"max-block-size":[{"max-block":[`none`,...te()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,`none`,...N()]}],"font-size":[{text:[`base`,n,Go,zo]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Zo,U]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,ko,H]}],"font-family":[{font:[Ko,Vo,t]}],"font-features":[{"font-features":[H]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,W,H]}],"line-clamp":[{"line-clamp":[V,`none`,W,Bo]}],leading:[{leading:[`none`,a,...w()]}],"list-image":[{"list-image":[`none`,W,H]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,W,H]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...ce(),`wavy`]}],"text-decoration-thickness":[{decoration:[V,`from-font`,`auto`,W,zo]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[V,`auto`,W,H]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[Oo,W,H]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,W,H]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,W,H]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:ne()}],"bg-repeat":[{bg:re()}],"bg-size":[{bg:ie()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Oo,W,H],radial:[``,W,H],conic:[``,Oo,W,H]},Yo,Uo]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:ae()}],"gradient-via-pos":[{via:ae()}],"gradient-to-pos":[{to:ae()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:oe()}],"rounded-s":[{"rounded-s":oe()}],"rounded-e":[{"rounded-e":oe()}],"rounded-t":[{"rounded-t":oe()}],"rounded-r":[{"rounded-r":oe()}],"rounded-b":[{"rounded-b":oe()}],"rounded-l":[{"rounded-l":oe()}],"rounded-ss":[{"rounded-ss":oe()}],"rounded-se":[{"rounded-se":oe()}],"rounded-ee":[{"rounded-ee":oe()}],"rounded-es":[{"rounded-es":oe()}],"rounded-tl":[{"rounded-tl":oe()}],"rounded-tr":[{"rounded-tr":oe()}],"rounded-br":[{"rounded-br":oe()}],"rounded-bl":[{"rounded-bl":oe()}],"border-w":[{border:se()}],"border-w-x":[{"border-x":se()}],"border-w-y":[{"border-y":se()}],"border-w-s":[{"border-s":se()}],"border-w-e":[{"border-e":se()}],"border-w-bs":[{"border-bs":se()}],"border-w-be":[{"border-be":se()}],"border-w-t":[{"border-t":se()}],"border-w-r":[{"border-r":se()}],"border-w-b":[{"border-b":se()}],"border-w-l":[{"border-l":se()}],"divide-x":[{"divide-x":se()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":se()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...ce(),`hidden`,`none`]}],"divide-style":[{divide:[...ce(),`hidden`,`none`]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-bs":[{"border-bs":P()}],"border-color-be":[{"border-be":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...ce(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[V,W,H]}],"outline-w":[{outline:[``,V,Go,zo]}],"outline-color":[{outline:P()}],shadow:[{shadow:[``,`inner`,`none`,u,Xo,Wo]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":[`none`,d,Xo,Wo]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:se()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[V,zo]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":se()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":[`none`,f,Xo,Wo]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[V,W,H]}],"mix-blend":[{"mix-blend":[...le(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":le()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[V]}],"mask-image-linear-from-pos":[{"mask-linear-from":ue()}],"mask-image-linear-to-pos":[{"mask-linear-to":ue()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":ue()}],"mask-image-t-to-pos":[{"mask-t-to":ue()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":ue()}],"mask-image-r-to-pos":[{"mask-r-to":ue()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":ue()}],"mask-image-b-to-pos":[{"mask-b-to":ue()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":ue()}],"mask-image-l-to-pos":[{"mask-l-to":ue()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":ue()}],"mask-image-x-to-pos":[{"mask-x-to":ue()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":ue()}],"mask-image-y-to-pos":[{"mask-y-to":ue()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[W,H]}],"mask-image-radial-from-pos":[{"mask-radial-from":ue()}],"mask-image-radial-to-pos":[{"mask-radial-to":ue()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[V]}],"mask-image-conic-from-pos":[{"mask-conic-from":ue()}],"mask-image-conic-to-pos":[{"mask-conic-to":ue()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:ne()}],"mask-repeat":[{mask:re()}],"mask-size":[{mask:ie()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,W,H]}],filter:[{filter:[``,`none`,W,H]}],blur:[{blur:de()}],brightness:[{brightness:[V,W,H]}],contrast:[{contrast:[V,W,H]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Xo,Wo]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:[``,V,W,H]}],"hue-rotate":[{"hue-rotate":[V,W,H]}],invert:[{invert:[``,V,W,H]}],saturate:[{saturate:[V,W,H]}],sepia:[{sepia:[``,V,W,H]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,W,H]}],"backdrop-blur":[{"backdrop-blur":de()}],"backdrop-brightness":[{"backdrop-brightness":[V,W,H]}],"backdrop-contrast":[{"backdrop-contrast":[V,W,H]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,V,W,H]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[V,W,H]}],"backdrop-invert":[{"backdrop-invert":[``,V,W,H]}],"backdrop-opacity":[{"backdrop-opacity":[V,W,H]}],"backdrop-saturate":[{"backdrop-saturate":[V,W,H]}],"backdrop-sepia":[{"backdrop-sepia":[``,V,W,H]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,W,H]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[V,`initial`,W,H]}],ease:[{ease:[`linear`,`initial`,_,W,H]}],delay:[{delay:[V,W,H]}],animate:[{animate:[`none`,v,W,H]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,W,H]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:fe()}],"rotate-x":[{"rotate-x":fe()}],"rotate-y":[{"rotate-y":fe()}],"rotate-z":[{"rotate-z":fe()}],scale:[{scale:pe()}],"scale-x":[{"scale-x":pe()}],"scale-y":[{"scale-y":pe()}],"scale-z":[{"scale-z":pe()}],"scale-3d":[`scale-3d`],skew:[{skew:F()}],"skew-x":[{"skew-x":F()}],"skew-y":[{"skew-y":F()}],transform:[{transform:[W,H,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:me()}],"translate-x":[{"translate-x":me()}],"translate-y":[{"translate-y":me()}],"translate-z":[{"translate-z":me()}],"translate-none":[`translate-none`],zoom:[{zoom:[Oo,W,H]}],accent:[{accent:P()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,W,H]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":P()}],"scrollbar-track-color":[{"scrollbar-track":P()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,W,H]}],fill:[{fill:[`none`,...P()]}],"stroke-w":[{stroke:[V,Go,zo,Bo]}],stroke:[{stroke:[`none`,...P()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`start`,`end`,`right`,`left`],"inset-y":[`inset-bs`,`inset-be`,`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`ps`,`pe`,`pr`,`pl`],py:[`pbs`,`pbe`,`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`ms`,`me`,`mr`,`ml`],my:[`mbs`,`mbe`,`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-s`,`border-w-e`,`border-w-r`,`border-w-l`],"border-w-y":[`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-s`,`border-color-e`,`border-color-r`,`border-color-l`],"border-color-y":[`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-ms`,`scroll-me`,`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-ps`,`scroll-pe`,`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}},ls=(e,{cacheSize:t,prefix:n,experimentalParseClassName:r,extend:i={},override:a={}})=>(us(e,`cacheSize`,t),us(e,`prefix`,n),us(e,`experimentalParseClassName`,r),ds(e.theme,a.theme),ds(e.classGroups,a.classGroups),ds(e.conflictingClassGroups,a.conflictingClassGroups),ds(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),us(e,`postfixLookupClassGroups`,a.postfixLookupClassGroups),us(e,`orderSensitiveModifiers`,a.orderSensitiveModifiers),fs(e.theme,i.theme),fs(e.classGroups,i.classGroups),fs(e.conflictingClassGroups,i.conflictingClassGroups),fs(e.conflictingClassGroupModifiers,i.conflictingClassGroupModifiers),ps(e,i,`postfixLookupClassGroups`),ps(e,i,`orderSensitiveModifiers`),e),us=(e,t,n)=>{n!==void 0&&(e[t]=n)},ds=(e,t)=>{if(t)for(let n in t)us(e,n,t[n])},fs=(e,t)=>{if(t)for(let n in t)ps(e,t,n)},ps=(e,t,n)=>{let r=t[n];r!==void 0&&(e[n]=e[n]?e[n].concat(r):r)},ms=((e,...t)=>typeof e==`function`?go(cs,e,...t):go(()=>ls(cs(),e),...t))({prefix:`la`});function G(...e){return ms(La(e))}function hs({className:e,...t}){return(0,R.jsx)(wa,{"data-slot":`command`,className:G(`la:flex la:h-full la:w-full la:flex-col la:overflow-hidden la:rounded-md la:bg-popover la:text-popover-foreground`,e),...t})}function gs({className:e,...t}){return(0,R.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`la:flex la:h-9 la:items-center la:gap-2 la:border-b la:px-3`,children:[(0,R.jsx)(Me,{className:`la:size-4 la:shrink-0 la:opacity-50`}),(0,R.jsx)(wa.Input,{"data-slot":`command-input`,className:G(`la:flex la:h-10 la:w-full la:rounded-md la:bg-transparent la:py-3 la:text-sm la:outline-hidden la:placeholder:text-muted-foreground la:disabled:cursor-not-allowed la:disabled:opacity-50`,e),...t})]})}function _s({className:e,...t}){return(0,R.jsx)(wa.List,{"data-slot":`command-list`,className:G(`la:max-h-[300px] la:scroll-py-1 la:overflow-x-hidden la:overflow-y-auto`,e),...t})}function vs({className:e,...t}){return(0,R.jsx)(wa.Group,{"data-slot":`command-group`,className:G(`la:overflow-hidden la:p-1 la:text-foreground la:[&_[cmdk-group-heading]]:px-2 la:[&_[cmdk-group-heading]]:py-1.5 la:[&_[cmdk-group-heading]]:text-xs la:[&_[cmdk-group-heading]]:font-medium la:[&_[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function ys({className:e,...t}){return(0,R.jsx)(wa.Item,{"data-slot":`command-item`,className:G(`la:relative la:flex la:cursor-default la:items-center la:gap-2 la:rounded-sm la:px-2 la:py-1.5 la:text-sm la:outline-hidden la:select-none la:data-[disabled=true]:pointer-events-none la:data-[disabled=true]:opacity-50 la:data-[selected=true]:bg-accent la:data-[selected=true]:text-accent-foreground la:[&_svg]:pointer-events-none la:[&_svg]:shrink-0 la:[&_svg:not([class*='size-'])]:size-4 la:[&_svg:not([class*='text-'])]:text-muted-foreground`,e),...t})}function bs({label:e,placeholder:t,value:n,onChange:r,onSelectSuggestion:i,suggestions:a,limit:o=8,className:s}){let[c,l]=(0,O.useState)(!1),u=xs(a,n,o,!!i),d=u.reduce((e,t)=>e.set(t.group,[...e.get(t.group)??[],t]),new Map),f=c&&u.length>0;return(0,R.jsxs)(hs,{label:e,shouldFilter:!1,loop:!0,className:G(`la-combobox la:relative la:overflow-visible la:bg-transparent`,s),onKeyDown:e=>{e.key===`Escape`&&l(!1),e.key===`ArrowDown`&&l(!0)},children:[(0,R.jsx)(gs,{placeholder:t,value:n,onValueChange:e=>{r(e),l(!0)},onFocus:()=>l(!0),onBlur:()=>l(!1)}),f&&(0,R.jsx)(_s,{label:`${e} suggestions`,className:`la:absolute la:top-full la:right-0 la:left-0 la:z-20 la:mt-1.5 la:rounded-md la:border la:bg-popover la:text-popover-foreground la:shadow-md`,onMouseDown:e=>e.preventDefault(),children:[...d].map(([e,t])=>(0,R.jsx)(vs,{heading:e,children:t.map(t=>(0,R.jsxs)(ys,{value:t.id??`${e}:${t.value}`,onSelect:()=>{i?i(t):r(t.value),l(!1)},children:[(0,R.jsx)(`span`,{className:`la:truncate la:font-mono la:text-xs`,children:t.value}),t.hint&&(0,R.jsx)(`span`,{className:`la:ml-auto la:text-xs la:text-muted-foreground`,children:t.hint})]},t.id??`${e}:${t.value}`))},e))})]})}function xs(e,t,n,r=!1){let i=t.trim().toLocaleLowerCase(),a=i.split(/\s+/u).filter(Boolean),o=new Set,s=[];for(let t of e){let e=t.id??`${t.group}:${t.value}`,n=[t.value,...t.keywords??[]].join(` `).toLocaleLowerCase(),c=t.value.toLocaleLowerCase()===i&&!t.keywords?.length;o.has(e)||c&&!r||!a.every(e=>n.includes(e))||(o.add(e),s.push(t))}return s.sort((e,t)=>Number(t.value.toLocaleLowerCase().startsWith(i))-Number(e.value.toLocaleLowerCase().startsWith(i))).slice(0,n)}var Ss=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Cs=La,ws=(e,t)=>n=>{if(t?.variants==null)return Cs(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Ss(t)||Ss(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Cs(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Ts=ws(`la:inline-flex la:shrink-0 la:items-center la:justify-center la:gap-2 la:whitespace-nowrap la:rounded-md la:text-sm la:font-medium la:outline-none la:transition-[background-color,border-color,color,box-shadow,transform] la:duration-150 la:ease-out la:active:translate-y-px la:disabled:pointer-events-none la:disabled:translate-y-0 la:disabled:opacity-45 la:focus-visible:ring-2 la:focus-visible:ring-ring la:focus-visible:ring-offset-2 la:focus-visible:ring-offset-background la:aria-invalid:border-destructive la:aria-invalid:ring-destructive/25 la:[&_svg]:pointer-events-none la:[&_svg]:shrink-0 la:[&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`la:bg-primary la:text-primary-foreground la:shadow-[var(--shadow-control)] la:hover:bg-primary/88`,destructive:`la:bg-destructive la:text-white la:hover:bg-destructive/90 la:focus-visible:ring-destructive/20 la:dark:focus-visible:ring-destructive/40 la:dark:bg-destructive/60`,outline:`la:border la:border-input la:bg-card la:hover:border-foreground/20 la:hover:bg-accent la:hover:text-accent-foreground la:dark:bg-card`,secondary:`la:bg-secondary la:text-secondary-foreground la:hover:bg-secondary/80`,ghost:`la:bg-transparent la:hover:bg-accent la:hover:text-accent-foreground la:dark:hover:bg-accent/50`,link:`la:bg-transparent la:text-primary la:underline-offset-4 la:hover:underline`},size:{default:`la:h-9 la:px-4 la:py-2 la:max-md:min-h-11 la:has-[>svg]:px-3`,sm:`la:h-8 la:gap-1.5 la:px-3 la:max-md:min-h-11 la:has-[>svg]:px-2.5`,lg:`la:h-10 la:px-5 la:max-md:min-h-11 la:has-[>svg]:px-4`,icon:`la:size-9 la:max-md:size-11`,"icon-sm":`la:size-8 la:max-md:size-11`,"icon-lg":`la:size-10 la:max-md:size-11`}},defaultVariants:{variant:`default`,size:`default`}});function K({className:e,variant:t,size:n,asChild:r=!1,...i}){return(0,R.jsx)(r?Jt:`button`,{"data-slot":`button`,className:G(Ts({variant:t,size:n,className:e})),...i})}function Es(e){let t=[...e].sort((e,t)=>e.startedAtMs-t.startedAtMs||e.sequence-t.sequence),n=t[0]?.startedAtMs??0,r=n,i=new Map,a=t.map(e=>{let t=JSON.stringify([e.projectId,e.actorName,e.actorId]),a=i.get(t),o=e.startedAtMs+e.durationMs;return i.set(t,Math.max(a??o,o)),r=Math.max(r,o),{record:e,offsetMs:e.startedAtMs-n,gapMs:a===void 0?null:e.startedAtMs-a}});return{start:n,span:r-n,calls:a,rows:Ds(a)}}function Ds(e){let t=new Map;for(let n of e){let{record:e}=n,r=JSON.stringify([e.projectId,e.actorName,e.actorId,e.kind,e.operation]),i=t.get(r);i||(i={key:r,record:e,calls:[]},t.set(r,i)),i.calls.push(n)}return[...t.values()]}function Os(e){return e>=6e4?`${(e/6e4).toLocaleString(void 0,{maximumFractionDigits:2})} min`:e>=1e3?`${(e/1e3).toLocaleString(void 0,{maximumFractionDigits:2})} s`:`${e.toLocaleString(void 0,{maximumFractionDigits:1})} ms`}function ks(e){return e===null?`First in view`:e<0?`Overlapping`:e===0?`No gap`:`${Os(e)} gap`}var As=[0,.25,.5,.75,1];function js(e){let[t,n]=(0,O.useState)(null),r=t!==null&&(t.end<=e.start||t.start>=e.end),i=t!==null&&!r,a=i?t:e;return(0,O.useEffect)(()=>{r&&n(null)},[r]),{range:a,zoomed:i,setWindow:t=>{let r=t&&Ps(t,e);n(r?.start===e.start&&r.end===e.end?null:r)}}}function Ms({bounds:e,range:t,zoomed:n,count:r,onChange:i}){let a=t.end-t.start,o=e=>{let n=(t.start+t.end)/2;i({start:n-a*e/2,end:n+a*e/2})},s=e=>i({start:t.start+e*a/2,end:t.end+e*a/2});return(0,R.jsxs)(`div`,{className:`request-waterfall-zoom`,children:[(0,R.jsxs)(`div`,{role:`group`,"aria-label":`Timeline zoom`,children:[(0,R.jsx)(K,{variant:`outline`,size:`icon-sm`,"aria-label":`Zoom in`,title:`Zoom in`,disabled:a<=1,onClick:()=>o(.5),children:(0,R.jsx)(He,{"aria-hidden":`true`})}),(0,R.jsx)(K,{variant:`outline`,size:`icon-sm`,"aria-label":`Zoom out`,title:`Zoom out`,disabled:!n,onClick:()=>o(2),children:(0,R.jsx)(Be,{"aria-hidden":`true`})}),(0,R.jsx)(K,{variant:`outline`,size:`icon-sm`,"aria-label":`Pan earlier`,title:`Pan earlier`,disabled:t.start<=e.start,onClick:()=>s(-1),children:(0,R.jsx)(pe,{"aria-hidden":`true`})}),(0,R.jsx)(K,{variant:`outline`,size:`icon-sm`,"aria-label":`Pan later`,title:`Pan later`,disabled:t.end>=e.end,onClick:()=>s(1),children:(0,R.jsx)(me,{"aria-hidden":`true`})}),(0,R.jsxs)(K,{variant:`ghost`,size:`sm`,"aria-label":`Reset zoom`,disabled:!n,onClick:()=>i(null),children:[(0,R.jsx)(Ae,{"aria-hidden":`true`}),`Reset`]})]}),(0,R.jsxs)(`span`,{role:`status`,children:[Os(a),` window · `,r.toLocaleString(),` `,r===1?`call`:`calls`,` in view`]}),(0,R.jsx)(`span`,{children:`Drag across the time axis to zoom`})]})}function Ns({start:e,range:t,onChange:n}){let[r,i]=(0,O.useState)(null),a=(0,O.useRef)(null),o=t.end-t.start,s=e=>{if(e.button!==0||!e.isPrimary||o<=1)return;let{left:n,width:r}=e.currentTarget.getBoundingClientRect();r&&(a.current={pointerId:e.pointerId,x:e.clientX,left:n,width:r,range:t},e.currentTarget.setPointerCapture(e.pointerId),i({from:Fs(e.clientX,n,r),to:Fs(e.clientX,n,r)}))},c=e=>{let t=a.current;t&&t.pointerId===e.pointerId&&i({from:Fs(t.x,t.left,t.width),to:Fs(e.clientX,t.left,t.width)})},l=e=>{let t=a.current;if(!t||t.pointerId!==e.pointerId||(a.current=null,i(null),e.currentTarget.releasePointerCapture(e.pointerId),Math.abs(e.clientX-t.x)<4))return;let r=Fs(t.x,t.left,t.width),o=Fs(e.clientX,t.left,t.width),s=t.range.end-t.range.start;n({start:t.range.start+Math.min(r,o)*s,end:t.range.start+Math.max(r,o)*s})},u=()=>{a.current=null,i(null)};return(0,R.jsxs)(`div`,{className:`request-waterfall-axis`,children:[(0,R.jsx)(`span`,{children:`Operation / instance`}),(0,R.jsxs)(`div`,{role:`group`,"aria-label":`Select time range`,onPointerDown:s,onPointerMove:c,onPointerUp:l,onPointerCancel:u,onLostPointerCapture:u,children:[As.map(n=>(0,R.jsx)(`span`,{style:{left:`${n*100}%`},children:Is(t.start-e+o*n,o)},n)),r&&(0,R.jsx)(`i`,{className:`request-waterfall-selection`,style:{left:`${Math.min(r.from,r.to)*100}%`,width:`${Math.abs(r.to-r.from)*100}%`}})]}),(0,R.jsx)(`span`,{children:`Calls / total`})]})}function Ps(e,t){let n=Math.min(t.end-t.start,Math.max(1,e.end-e.start)),r=Math.max(t.start,Math.min(e.start,t.end-n));return{start:r,end:r+n}}function Fs(e,t,n){return Math.max(0,Math.min(1,(e-t)/n))}function Is(e,t){return t>=6e4?Os(e):e>=1e3?`${(e/1e3).toLocaleString(void 0,{maximumFractionDigits:5})} s`:`${e.toLocaleString(void 0,{maximumFractionDigits:2})} ms`}function Ls({records:e,selected:t,onSelect:n}){let{start:r,span:i,rows:a}=Es(e),o={start:r,end:r+Math.max(1,i)},{range:s,zoomed:c,setWindow:l}=js(o),u=a.map(e=>({...e,calls:e.calls.filter(e=>Vs(e.record,s))})).filter(e=>e.calls.length>0);return(0,R.jsxs)(`div`,{className:`request-waterfall`,role:`group`,"aria-label":`Invocation waterfall`,children:[(0,R.jsx)(Rs,{count:e.length,span:i}),(0,R.jsx)(Ms,{bounds:o,range:s,zoomed:c,count:u.reduce((e,t)=>e+t.calls.length,0),onChange:l}),(0,R.jsxs)(`div`,{className:`request-waterfall-scroll`,tabIndex:0,"aria-label":`Invocation timeline, scroll for more calls`,children:[(0,R.jsx)(Ns,{start:r,range:s,onChange:l}),u.map(e=>(0,R.jsx)(zs,{row:e,range:s,selected:t,onSelect:n},e.key)),!u.length&&(0,R.jsx)(`div`,{className:`la-request-empty`,children:`No calls in this time range. Pan or zoom out to find calls.`})]}),(0,R.jsxs)(`div`,{className:`request-waterfall-caption`,children:[(0,R.jsxs)(`span`,{children:[`Relative to `,(0,R.jsx)(`time`,{dateTime:new Date(r).toISOString(),children:new Date(r).toLocaleString([],{hour12:!1})})]}),(0,R.jsx)(`span`,{children:`Gaps use preceding loaded calls on the same instance.`})]})]})}function Rs({count:e,span:t}){return(0,R.jsxs)(`div`,{className:`request-waterfall-heading`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`strong`,{children:`Invocation waterfall`}),(0,R.jsxs)(`span`,{children:[e.toLocaleString(),` calls · `,Os(t),` elapsed`]})]}),(0,R.jsxs)(`ul`,{className:`request-waterfall-legend`,"aria-label":`Timing legend`,children:[(0,R.jsxs)(`li`,{children:[(0,R.jsx)(`i`,{className:`request-waterfall-method`}),`Method`]}),(0,R.jsxs)(`li`,{children:[(0,R.jsx)(`i`,{className:`request-waterfall-websocket`}),`WebSocket`]}),(0,R.jsxs)(`li`,{children:[(0,R.jsx)(`i`,{className:`request-waterfall-queue`}),`Queue wait`]}),(0,R.jsxs)(`li`,{children:[(0,R.jsx)(`i`,{className:`request-waterfall-failed`}),`Failed / rejected`]}),(0,R.jsxs)(`li`,{children:[(0,R.jsx)(`i`,{className:`request-waterfall-interrupted`}),`Interrupted / rerouted`]})]})]})}function zs({row:{record:e,calls:t},range:n,selected:r,onSelect:i}){return(0,R.jsxs)(`div`,{className:`request-waterfall-row`,role:`group`,"aria-label":`${e.operation} ${e.kind} calls on ${e.actorName} / ${e.actorId}`,"data-state":t.some(e=>e.record===r)?`selected`:void 0,children:[(0,R.jsxs)(`span`,{className:`request-waterfall-label`,children:[(0,R.jsx)(`strong`,{children:e.operation}),(0,R.jsxs)(`span`,{children:[e.actorName,` / `,e.actorId]})]}),(0,R.jsxs)(`span`,{className:`request-waterfall-track`,children:[As.map(e=>(0,R.jsx)(`i`,{className:`request-waterfall-gridline`,"aria-hidden":`true`,style:{left:`${e*100}%`}},e)),t.map(e=>(0,R.jsx)(Bs,{call:e,range:n,selected:r===e.record,onSelect:i},e.record.eventId??e.record.sequence))]}),(0,R.jsxs)(`span`,{className:`request-waterfall-timing`,children:[(0,R.jsxs)(`strong`,{children:[t.length.toLocaleString(),` `,t.length===1?`call`:`calls`]}),(0,R.jsxs)(`span`,{children:[Os(t.reduce((e,t)=>e+t.record.durationMs,0)),` total`]})]})]})}function Bs({call:{record:e,offsetMs:t,gapMs:n},range:r,selected:i,onSelect:a}){let o=r.end-r.start,s=Math.max(r.start,e.startedAtMs),c=Math.min(r.end,e.startedAtMs+e.durationMs),l=Math.max(0,Math.min(c,e.startedAtMs+(e.queueWaitMs??0))-s),u=Math.max(r.start,e.startedAtMs-(n??0)),d=Math.min(r.end,e.startedAtMs);return(0,R.jsxs)(R.Fragment,{children:[d>u&&(0,R.jsx)(`span`,{className:`request-waterfall-gap`,"aria-hidden":`true`,style:{left:`${(u-r.start)/o*100}%`,width:`${(d-u)/o*100}%`}}),(0,R.jsx)(`button`,{type:`button`,className:`request-waterfall-bar request-waterfall-${e.kind} request-waterfall-${e.outcome}`,style:{left:`${(s-r.start)/o*100}%`,width:`${(c-s)/o*100}%`},"data-state":i?`selected`:void 0,"aria-label":`Inspect ${e.operation} request on ${e.actorName} / ${e.actorId}, ${e.outcome}, ${Os(e.durationMs)}, starts +${Os(t)}, ${ks(n)}`,"aria-haspopup":`dialog`,title:`${e.actorName} / ${e.actorId}\n${e.operation} · ${e.outcome}\nStart: ${new Date(e.startedAtMs).toLocaleString()} (+${Os(t)})\nTotal: ${Os(e.durationMs)}\nQueue wait: ${e.queueWaitMs===null?`Did not begin processing`:Os(e.queueWaitMs)}\n${ks(n)}${n===null?``:` relative to preceding calls on this instance`}`,onClick:t=>a(e,t.currentTarget),children:l>0&&(0,R.jsx)(`span`,{className:`request-waterfall-queue`,style:{width:`${l/(c-s)*100}%`}})})]})}function Vs(e,t){return e.durationMs===0?e.startedAtMs>=t.start&&e.startedAtMs<=t.end:e.startedAtMs<t.end&&e.startedAtMs+e.durationMs>t.start}function Hs(e,t,n=`long`){return new Intl.DateTimeFormat(`en-US`,{hour:`numeric`,timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(` `)}var Us={},Ws={};function Gs(e,t){try{let n=(Us[e]||=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`longOffset`}).format)(t).split(`GMT`)[1];return n in Ws?Ws[n]:qs(n,n.split(`:`))}catch{if(e in Ws)return Ws[e];let t=e?.match(Ks);return t?qs(e,t.slice(1)):NaN}}var Ks=/([+-]\d\d):?(\d\d)?/;function qs(e,t){let n=+(t[0]||0),r=+(t[1]||0),i=(t[2]||0)/60;return Ws[e]=n*60+r>0?n*60+r+i:n*60-r-i}var Js=class e extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]==`string`&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(Gs(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]==`number`&&(e.length===1||e.length===2&&typeof e[1]!=`number`)?this.setTime(e[0]):typeof e[0]==`string`?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),Qs(this,e)):this.setTime(Date.now())}static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}withTimeZone(t){return new e(+this,t)}getTimezoneOffset(){let e=-Gs(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),Xs(this),+this}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},Ys=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!Ys.test(e))return;let t=e.replace(Ys,`$1UTC`);Js.prototype[t]&&(e.startsWith(`get`)?Js.prototype[e]=function(){return this.internal[t]()}:(Js.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),Zs(this),+this},Js.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),Xs(this),+this}))});function Xs(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-Gs(e.timeZone,e)*60))}function Zs(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),Qs(e)}function Qs(e,t){let n=Array.isArray(t)?$s(t):+e.internal,r=Gs(e.timeZone,e),i=r>0?Math.floor(r):Math.ceil(r),a=new Date(+e);a.setUTCHours(a.getUTCHours()-1);let o=-new Date(+e).getTimezoneOffset(),s=-new Date(+a).getTimezoneOffset(),c=o-s,l=o;if(c&&o!==i&&Date.prototype.getHours.apply(e)!==(Array.isArray(t)?t[3]||0:e.internal.getUTCHours())){let t=new Date(+e),n=o-i;n&&t.setUTCMinutes(t.getUTCMinutes()+n);let r=Gs(e.timeZone,t);(r>0?Math.floor(r):Math.ceil(r))===i&&(l=s)}let u=l-i;u&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+u);let d=new Date(+e);d.setUTCSeconds(0);let f=o>0?d.getSeconds():(d.getSeconds()-60)%60,p=Math.round(-(Gs(e.timeZone,e)*60))%60;(p||f)&&Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+p+f);let m=Gs(e.timeZone,e),h=m>0?Math.floor(m):Math.ceil(m),g=-new Date(+e).getTimezoneOffset()-h,_=h!==i,v=g-u,y=h-i,b=n-h*60*1e3,x=y>0&&ec(e)-n===y*60*1e3&&ec(e,b)!==n;if(_&&v&&!x){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+v);let t=Gs(e.timeZone,e),n=h-(t>0?Math.floor(t):Math.ceil(t));n&&v<0&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+n)}Xs(e);let S=(t?n:n+p*1e3)-+e.internal;S&&Math.abs(S)<18e5&&(Date.prototype.setTime.call(e,+e+S),Xs(e))}function $s(e){return Date.UTC(e[0],e.length>1?e[1]:0,e.length>2?e[2]:1,...e.slice(3))}function ec(e,t){let n=new Date(t??+e);return n.setUTCSeconds(n.getUTCSeconds()-Math.round(-Gs(e.timeZone,n)*60)),+n}var tc=class e extends Js{static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}toISOString(){let[e,t,n]=this.tzComponents(),r=`${e}${t}:${n}`;return this.internal.toISOString().slice(0,-1)+r}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){let[e,t,n,r]=this.internal.toUTCString().split(` `);return`${e?.slice(0,-1)} ${n} ${t} ${r}`}toTimeString(){let e=this.internal.toUTCString().split(` `)[4],[t,n,r]=this.tzComponents();return`${e} GMT${t}${n}${r} (${Hs(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}tzComponents(){let e=this.getTimezoneOffset();return[e>0?`-`:`+`,String(Math.floor(Math.abs(e)/60)).padStart(2,`0`),String(Math.abs(e)%60).padStart(2,`0`)]}withTimeZone(t){return new e(+this,t)}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},nc=365.2425,rc=6048e5,ic=864e5,ac=86400;ac*7,ac*nc/12*3;var oc=Symbol.for(`constructDateFrom`);function sc(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&oc in e?e[oc](t):e instanceof Date?new e.constructor(t):new Date(t)}function cc(e,t){return sc(t||e,e)}function lc(e,t,n){let r=cc(e,n?.in);return isNaN(t)?sc(n?.in||e,NaN):(t&&r.setDate(r.getDate()+t),r)}function uc(e,t,n){let r=cc(e,n?.in);if(isNaN(t))return sc(n?.in||e,NaN);if(!t)return r;let i=r.getDate(),a=sc(n?.in||e,r.getTime());return a.setMonth(r.getMonth()+t+1,0),i>=a.getDate()?a:(r.setFullYear(a.getFullYear(),a.getMonth(),i),r)}var dc={};function fc(){return dc}function pc(e,t){let n=fc(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=cc(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function mc(e,t){return pc(e,{...t,weekStartsOn:1})}function hc(e,t){let n=cc(e,t?.in),r=n.getFullYear(),i=sc(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=mc(i),o=sc(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=mc(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function gc(e){let t=cc(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-n}function _c(e,...t){let n=sc.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function vc(e,t){let n=cc(e,t?.in);return n.setHours(0,0,0,0),n}function yc(e,t,n){let[r,i]=_c(n?.in,e,t),a=vc(r),o=vc(i),s=+a-gc(a),c=+o-gc(o);return Math.round((s-c)/ic)}function bc(e,t){let n=hc(e,t),r=sc(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),mc(r)}function xc(e,t,n){return lc(e,t*7,n)}function Sc(e,t,n){return uc(e,t*12,n)}function Cc(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=sc.bind(null,e));let t=cc(e,r);(!n||n<t||isNaN(+t))&&(n=t)}),sc(r,n||NaN)}function wc(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=sc.bind(null,e));let t=cc(e,r);(!n||n>t||isNaN(+t))&&(n=t)}),sc(r,n||NaN)}function Tc(e,t,n){let[r,i]=_c(n?.in,e,t);return+vc(r)==+vc(i)}function Ec(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function Dc(e){return!(!Ec(e)&&typeof e!=`number`||isNaN(+cc(e)))}function Oc(e,t,n){let[r,i]=_c(n?.in,e,t),a=r.getFullYear()-i.getFullYear(),o=r.getMonth()-i.getMonth();return a*12+o}function kc(e,t){let n=cc(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function Ac(e,t){let[n,r]=_c(e,t.start,t.end);return{start:n,end:r}}function jc(e,t){let{start:n,end:r}=Ac(t?.in,e),i=+n>+r,a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0),o.setDate(1);let s=t?.step??1;if(!s)return[];s<0&&(s=-s,i=!i);let c=[];for(;+o<=a;)c.push(sc(n,o)),o.setMonth(o.getMonth()+s);return i?c.reverse():c}function Mc(e,t){let n=cc(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function Nc(e,t){let n=cc(e,t?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function Pc(e,t){let n=cc(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Fc(e,t){let{start:n,end:r}=Ac(t?.in,e),i=+n>+r,a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0),o.setMonth(0,1);let s=t?.step??1;if(!s)return[];s<0&&(s=-s,i=!i);let c=[];for(;+o<=a;)c.push(sc(n,o)),o.setFullYear(o.getFullYear()+s);return i?c.reverse():c}function Ic(e,t){let n=fc(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=cc(e,t?.in),a=i.getDay(),o=(a<r?-7:0)+6-(a-r);return i.setDate(i.getDate()+o),i.setHours(23,59,59,999),i}function Lc(e,t){return Ic(e,{...t,weekStartsOn:1})}var Rc={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},zc=(e,t,n)=>{let r,i=Rc[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function Bc(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var Vc={date:Bc({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:Bc({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:Bc({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},Hc={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},Uc=(e,t,n,r)=>Hc[e];function Wc(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var Gc={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:Wc({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:Wc({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Wc({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:Wc({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:Wc({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function Kc(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?Jc(s,e=>e.test(o)):qc(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function qc(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function Jc(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function Yc(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var Xc={code:`en-US`,formatDistance:zc,formatLong:Vc,formatRelative:Uc,localize:Gc,match:{ordinalNumber:Yc({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:Kc({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:Kc({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Kc({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:Kc({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:Kc({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function Zc(e,t){let n=cc(e,t?.in);return yc(n,Pc(n))+1}function Qc(e,t){let n=cc(e,t?.in),r=+mc(n)-bc(n);return Math.round(r/rc)+1}function $c(e,t){let n=cc(e,t?.in),r=n.getFullYear(),i=fc(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=sc(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=pc(o,t),c=sc(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=pc(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function el(e,t){let n=fc(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=$c(e,t),a=sc(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),pc(a,t)}function tl(e,t){let n=cc(e,t?.in),r=+pc(n,t)-el(n,t);return Math.round(r/rc)+1}function nl(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var rl={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return nl(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):nl(n+1,2)},d(e,t){return nl(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return nl(e.getHours()%12||12,t.length)},H(e,t){return nl(e.getHours(),t.length)},m(e,t){return nl(e.getMinutes(),t.length)},s(e,t){return nl(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return nl(Math.trunc(r*10**(n-3)),t.length)}},il={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},al={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return rl.y(e,t)},Y:function(e,t,n,r){let i=$c(e,r),a=i>0?i:1-i;return t===`YY`?nl(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):nl(a,t.length)},R:function(e,t){return nl(hc(e),t.length)},u:function(e,t){return nl(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return nl(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return nl(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return rl.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return nl(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=tl(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):nl(i,t.length)},I:function(e,t,n){let r=Qc(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):nl(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):rl.d(e,t)},D:function(e,t,n){let r=Zc(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):nl(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return nl(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return nl(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return nl(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?il.noon:r===0?il.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?il.evening:r>=12?il.afternoon:r>=4?il.morning:il.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return rl.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):rl.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):nl(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):nl(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):rl.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):rl.s(e,t)},S:function(e,t){return rl.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return sl(r);case`XXXX`:case`XX`:return cl(r);default:return cl(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return sl(r);case`xxxx`:case`xx`:return cl(r);default:return cl(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+ol(r,`:`);default:return`GMT`+cl(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+ol(r,`:`);default:return`GMT`+cl(r,`:`)}},t:function(e,t,n){return nl(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return nl(+e,t.length)}};function ol(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+nl(a,2)}function sl(e,t){return e%60==0?(e>0?`-`:`+`)+nl(Math.abs(e)/60,2):cl(e,t)}function cl(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=nl(Math.trunc(r/60),2),a=nl(r%60,2);return n+i+t+a}var ll=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},ul=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},dl={p:ul,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return ll(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`})}return a.replace(`{{date}}`,ll(r,t)).replace(`{{time}}`,ul(i,t))}},fl=/^D+$/,pl=/^Y+$/,ml=[`D`,`DD`,`YY`,`YYYY`];function hl(e){return fl.test(e)}function gl(e){return pl.test(e)}function _l(e,t,n){let r=vl(e,t,n);if(console.warn(r),ml.includes(e))throw RangeError(r)}function vl(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var yl=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,bl=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,xl=/^'([^]*?)'?$/,Sl=/''/g,Cl=/[a-zA-Z]/;function wl(e,t,n){let r=fc(),i=n?.locale??r.locale??Xc,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=cc(e,n?.in);if(!Dc(s))throw RangeError(`Invalid time value`);let c=t.match(bl).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=dl[t];return n(e,i.formatLong)}return e}).join(``).match(yl).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:Tl(e)};if(al[t])return{isToken:!0,value:e};if(t.match(Cl))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&gl(a)||!n?.useAdditionalDayOfYearTokens&&hl(a))&&_l(a,t,String(e));let o=al[a[0]];return o(s,a,i.localize,l)}).join(``)}function Tl(e){let t=e.match(xl);return t?t[1].replace(Sl,`'`):e}function El(e,t){let n=cc(e,t?.in),r=n.getFullYear(),i=n.getMonth(),a=sc(n,0);return a.setFullYear(r,i+1,0),a.setHours(0,0,0,0),a.getDate()}function Dl(e,t){return cc(e,t?.in).getMonth()}function Ol(e,t){return cc(e,t?.in).getFullYear()}function kl(e,t){return+cc(e)>+cc(t)}function Al(e,t){return+cc(e)<+cc(t)}function jl(e,t,n){let[r,i]=_c(n?.in,e,t);return r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()}function Ml(e,t,n){let[r,i]=_c(n?.in,e,t);return r.getFullYear()===i.getFullYear()}function Nl(e,t,n){let r=cc(e,n?.in),i=r.getFullYear(),a=r.getDate(),o=sc(n?.in||e,0);o.setFullYear(i,t,15),o.setHours(0,0,0,0);let s=El(o);return r.setMonth(t,Math.min(a,s)),r}function Pl(e,t,n){let r=cc(e,n?.in);return isNaN(+r)?sc(n?.in||e,NaN):(r.setFullYear(t),r)}var Fl=5,Il=4;function Ll(e,t){let n=t.startOfMonth(e),r=n.getDay()>0?n.getDay():7,i=t.addDays(e,-r+1),a=t.addDays(i,34);return t.getMonth(e)===t.getMonth(a)?Fl:Il}function Rl(e,t){let n=t.startOfMonth(e),r=n.getDay();return r===1?n:r===0?t.addDays(n,-6):t.addDays(n,-1*(r-1))}function zl(e,t){let n=Rl(e,t),r=Ll(e,t);return t.addDays(n,r*7-1)}var Bl={...Xc,labels:{labelDayButton:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>wl(e,t,{locale:Xc,...n});let a=i(e,`PPPP`);return t.today&&(a=`Today, ${a}`),t.selected&&(a=`${a}, selected`),a},labelMonthDropdown:`Choose the Month`,labelNext:`Go to the Next Month`,labelPrevious:`Go to the Previous Month`,labelWeekNumber:e=>`Week ${e}`,labelYearDropdown:`Choose the Year`,labelGrid:(e,t,n)=>{let r;return r=n&&typeof n.format==`function`?n.format.bind(n):(e,n)=>wl(e,n,{locale:Xc,...t}),r(e,`LLLL yyyy`)},labelGridcell:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>wl(e,t,{locale:Xc,...n});let a=i(e,`PPPP`);return t?.today&&(a=`Today, ${a}`),a},labelNav:`Navigation bar`,labelWeekNumberHeader:`Week Number`,labelWeekday:(e,t,n)=>{let r;return r=n&&typeof n.format==`function`?n.format.bind(n):(e,n)=>wl(e,n,{locale:Xc,...t}),r(e,`cccc`)}}},Vl=class e{constructor(e,t){this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?tc.tz(this.options.timeZone):new(this.options.Date??Date),this.newDate=(e,t,n)=>this.overrides?.newDate?this.overrides.newDate(e,t,n):this.options.timeZone?new tc(e,t,n,this.options.timeZone):new Date(e,t,n),this.addDays=(e,t)=>this.overrides?.addDays?this.overrides.addDays(e,t):lc(e,t),this.addMonths=(e,t)=>this.overrides?.addMonths?this.overrides.addMonths(e,t):uc(e,t),this.addWeeks=(e,t)=>this.overrides?.addWeeks?this.overrides.addWeeks(e,t):xc(e,t),this.addYears=(e,t)=>this.overrides?.addYears?this.overrides.addYears(e,t):Sc(e,t),this.differenceInCalendarDays=(e,t)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(e,t):yc(e,t),this.differenceInCalendarMonths=(e,t)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(e,t):Oc(e,t),this.eachMonthOfInterval=e=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(e):jc(e),this.eachYearOfInterval=e=>{let t=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(e):Fc(e),n=new Set(t.map(e=>this.getYear(e)));if(n.size===t.length)return t;let r=[];return n.forEach(e=>{r.push(new Date(e,0,1))}),r},this.endOfBroadcastWeek=e=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(e):zl(e,this),this.endOfISOWeek=e=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(e):Lc(e),this.endOfMonth=e=>this.overrides?.endOfMonth?this.overrides.endOfMonth(e):kc(e),this.endOfWeek=(e,t)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(e,t):Ic(e,this.options),this.endOfYear=e=>this.overrides?.endOfYear?this.overrides.endOfYear(e):Nc(e),this.format=(e,t,n)=>{let r=this.overrides?.format?this.overrides.format(e,t,this.options):wl(e,t,this.options);return this.options.numerals&&this.options.numerals!==`latn`?this.replaceDigits(r):r},this.getISOWeek=e=>this.overrides?.getISOWeek?this.overrides.getISOWeek(e):Qc(e),this.getMonth=(e,t)=>this.overrides?.getMonth?this.overrides.getMonth(e,this.options):Dl(e,this.options),this.getYear=(e,t)=>this.overrides?.getYear?this.overrides.getYear(e,this.options):Ol(e,this.options),this.getWeek=(e,t)=>this.overrides?.getWeek?this.overrides.getWeek(e,this.options):tl(e,this.options),this.isAfter=(e,t)=>this.overrides?.isAfter?this.overrides.isAfter(e,t):kl(e,t),this.isBefore=(e,t)=>this.overrides?.isBefore?this.overrides.isBefore(e,t):Al(e,t),this.isDate=e=>this.overrides?.isDate?this.overrides.isDate(e):Ec(e),this.isSameDay=(e,t)=>this.overrides?.isSameDay?this.overrides.isSameDay(e,t):Tc(e,t),this.isSameMonth=(e,t)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(e,t):jl(e,t),this.isSameYear=(e,t)=>this.overrides?.isSameYear?this.overrides.isSameYear(e,t):Ml(e,t),this.max=e=>this.overrides?.max?this.overrides.max(e):Cc(e),this.min=e=>this.overrides?.min?this.overrides.min(e):wc(e),this.setMonth=(e,t)=>this.overrides?.setMonth?this.overrides.setMonth(e,t):Nl(e,t),this.setYear=(e,t)=>this.overrides?.setYear?this.overrides.setYear(e,t):Pl(e,t),this.startOfBroadcastWeek=(e,t)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(e,this):Rl(e,this),this.startOfDay=e=>this.overrides?.startOfDay?this.overrides.startOfDay(e):vc(e),this.startOfISOWeek=e=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(e):mc(e),this.startOfMonth=e=>this.overrides?.startOfMonth?this.overrides.startOfMonth(e):Mc(e),this.startOfWeek=(e,t)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(e,this.options):pc(e,this.options),this.startOfYear=e=>this.overrides?.startOfYear?this.overrides.startOfYear(e):Pc(e),this.options={locale:Bl,...e},this.overrides=t}getDigitMap(){let{numerals:e=`latn`}=this.options,t=new Intl.NumberFormat(`en-US`,{numberingSystem:e}),n={};for(let e=0;e<10;e++)n[e.toString()]=t.format(e);return n}replaceDigits(e){let t=this.getDigitMap();return e.replace(/\d/g,e=>t[e]||e)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){let t=this.options.locale?.code;return t&&e.yearFirstLocales.has(t)?`year-first`:`month-first`}formatMonthYear(t){let{locale:n,timeZone:r,numerals:i}=this.options,a=n?.code;if(a&&e.yearFirstLocales.has(a))try{return new Intl.DateTimeFormat(a,{month:`long`,year:`numeric`,timeZone:r,numberingSystem:i}).format(t)}catch{}let o=this.getMonthYearOrder()===`year-first`?`y LLLL`:`LLLL y`;return this.format(t,o)}};Vl.yearFirstLocales=new Set([`eu`,`hu`,`ja`,`ja-Hira`,`ja-JP`,`ko`,`ko-KR`,`lt`,`lt-LT`,`lv`,`lv-LV`,`mn`,`mn-MN`,`zh`,`zh-CN`,`zh-HK`,`zh-TW`]);var Hl=new Vl,Ul=class{constructor(e,t,n=Hl){this.date=e,this.displayMonth=t,this.outside=!(!t||n.isSameMonth(e,t)),this.dateLib=n,this.isoDate=n.format(e,`yyyy-MM-dd`),this.displayMonthId=n.format(t,`yyyy-MM`),this.dateMonthId=n.format(e,`yyyy-MM`)}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}},Wl=class{constructor(e,t){this.date=e,this.weeks=t}},Gl=class{constructor(e,t){this.days=t,this.weekNumber=e}};function Kl(e){return O.createElement(`span`,{...e})}function ql(e){let{size:t=24,orientation:n=`left`,className:r,style:i}=e;return O.createElement(`svg`,{className:r,style:i,width:t,height:t,viewBox:`0 0 24 24`},n===`up`&&O.createElement(`polygon`,{points:`6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28`}),n===`down`&&O.createElement(`polygon`,{points:`6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72`}),n===`left`&&O.createElement(`polygon`,{points:`16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20`}),n===`right`&&O.createElement(`polygon`,{points:`8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20`}))}function Jl(e){let{day:t,modifiers:n,...r}=e;return O.createElement(`td`,{...r})}function Yl(e){let{day:t,modifiers:n,...r}=e,i=O.useRef(null);return O.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),O.createElement(`button`,{ref:i,...r})}var q;(function(e){e.Root=`root`,e.Chevron=`chevron`,e.Day=`day`,e.DayButton=`day_button`,e.CaptionLabel=`caption_label`,e.Dropdowns=`dropdowns`,e.Dropdown=`dropdown`,e.DropdownRoot=`dropdown_root`,e.Footer=`footer`,e.MonthGrid=`month_grid`,e.MonthCaption=`month_caption`,e.MonthsDropdown=`months_dropdown`,e.Month=`month`,e.Months=`months`,e.Nav=`nav`,e.NextMonthButton=`button_next`,e.PreviousMonthButton=`button_previous`,e.Week=`week`,e.Weeks=`weeks`,e.Weekday=`weekday`,e.Weekdays=`weekdays`,e.WeekNumber=`week_number`,e.WeekNumberHeader=`week_number_header`,e.YearsDropdown=`years_dropdown`})(q||={});var Xl;(function(e){e.disabled=`disabled`,e.hidden=`hidden`,e.outside=`outside`,e.focused=`focused`,e.today=`today`})(Xl||={});var Zl;(function(e){e.range_end=`range_end`,e.range_middle=`range_middle`,e.range_start=`range_start`,e.selected=`selected`})(Zl||={});var Ql;(function(e){e.weeks_before_enter=`weeks_before_enter`,e.weeks_before_exit=`weeks_before_exit`,e.weeks_after_enter=`weeks_after_enter`,e.weeks_after_exit=`weeks_after_exit`,e.caption_after_enter=`caption_after_enter`,e.caption_after_exit=`caption_after_exit`,e.caption_before_enter=`caption_before_enter`,e.caption_before_exit=`caption_before_exit`})(Ql||={});var $l=(0,O.createContext)(void 0);function eu(){let e=(0,O.useContext)($l);if(e===void 0)throw Error(`useDayPicker() must be used within a custom component.`);return e}function tu(e){let{options:t,className:n,...r}=e,{classNames:i,components:a,styles:o}=eu(),s=[i[q.Dropdown],n].join(` `),c=t?.find(({value:e})=>e===r.value);return O.createElement(`span`,{"data-disabled":r.disabled,className:i[q.DropdownRoot],style:o?.[q.DropdownRoot]},O.createElement(a.Select,{className:s,...r},t?.map(({value:e,label:t,disabled:n})=>O.createElement(a.Option,{key:e,value:e,disabled:n},t))),O.createElement(`span`,{className:i[q.CaptionLabel],style:o?.[q.CaptionLabel],"aria-hidden":!0},c?.label,O.createElement(a.Chevron,{orientation:`down`,size:18,className:i[q.Chevron],style:o?.[q.Chevron]})))}function nu(e){return O.createElement(`div`,{...e})}function ru(e){return O.createElement(`div`,{...e})}function iu(e){let{calendarMonth:t,displayIndex:n,...r}=e;return O.createElement(`div`,{...r},e.children)}function au(e){let{calendarMonth:t,displayIndex:n,...r}=e;return O.createElement(`div`,{...r})}function ou(e){return O.createElement(`table`,{...e})}function su(e){return O.createElement(`div`,{...e})}function cu(e){let{components:t}=eu();return O.createElement(t.Dropdown,{...e})}function lu(e){let{onPreviousClick:t,onNextClick:n,previousMonth:r,nextMonth:i,...a}=e,{components:o,classNames:s,styles:c,labels:{labelPrevious:l,labelNext:u}}=eu(),d=(0,O.useCallback)(e=>{i&&n?.(e)},[i,n]),f=(0,O.useCallback)(e=>{r&&t?.(e)},[r,t]);return O.createElement(`nav`,{...a},O.createElement(o.PreviousMonthButton,{type:`button`,className:s[q.PreviousMonthButton],style:c?.[q.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":!r||void 0,"aria-label":l(r),onClick:f},O.createElement(o.Chevron,{disabled:!r||void 0,className:s[q.Chevron],style:c?.[q.Chevron],orientation:`left`})),O.createElement(o.NextMonthButton,{type:`button`,className:s[q.NextMonthButton],style:c?.[q.NextMonthButton],tabIndex:i?void 0:-1,"aria-disabled":!i||void 0,"aria-label":u(i),onClick:d},O.createElement(o.Chevron,{disabled:!i||void 0,orientation:`right`,className:s[q.Chevron],style:c?.[q.Chevron]})))}function uu(e){return O.createElement(`button`,{...e})}function du(e){return O.createElement(`option`,{...e})}function fu(e){return O.createElement(`button`,{...e})}function pu(e){let{rootRef:t,...n}=e;return O.createElement(`div`,{...n,ref:t})}function mu(e){return O.createElement(`select`,{...e})}function hu(e){let{week:t,...n}=e;return O.createElement(`tr`,{...n})}function gu(e){return O.createElement(`th`,{...e})}function _u(e){return O.createElement(`thead`,{"aria-hidden":!0},O.createElement(`tr`,{...e}))}function vu(e){let{week:t,...n}=e;return O.createElement(`th`,{...n})}function yu(e){return O.createElement(`th`,{...e})}function bu(e){return O.createElement(`tbody`,{...e})}function xu(e){let{components:t}=eu();return O.createElement(t.Dropdown,{...e})}var Su=s({CaptionLabel:()=>Kl,Chevron:()=>ql,Day:()=>Jl,DayButton:()=>Yl,Dropdown:()=>tu,DropdownNav:()=>nu,Footer:()=>ru,Month:()=>iu,MonthCaption:()=>au,MonthGrid:()=>ou,Months:()=>su,MonthsDropdown:()=>cu,Nav:()=>lu,NextMonthButton:()=>uu,Option:()=>du,PreviousMonthButton:()=>fu,Root:()=>pu,Select:()=>mu,Week:()=>hu,WeekNumber:()=>vu,WeekNumberHeader:()=>yu,Weekday:()=>gu,Weekdays:()=>_u,Weeks:()=>bu,YearsDropdown:()=>xu});function Cu(e,t,n=!1,r=Hl){let{from:i,to:a}=e,{differenceInCalendarDays:o,isSameDay:s}=r;return i&&a?(o(a,i)<0&&([i,a]=[a,i]),o(t,i)>=+!!n&&o(a,t)>=+!!n):!n&&a?s(a,t):!n&&i?s(i,t):!1}function wu(e){return!!(e&&typeof e==`object`&&`before`in e&&`after`in e)}function Tu(e){return!!(e&&typeof e==`object`&&`from`in e)}function Eu(e){return!!(e&&typeof e==`object`&&`after`in e)}function Du(e){return!!(e&&typeof e==`object`&&`before`in e)}function Ou(e){return!!(e&&typeof e==`object`&&`dayOfWeek`in e)}function ku(e,t){return Array.isArray(e)&&e.every(t.isDate)}function Au(e,t,n=Hl){let r=Array.isArray(t)?t:[t],{isSameDay:i,differenceInCalendarDays:a,isAfter:o}=n;return r.some(t=>{if(typeof t==`boolean`)return t;if(n.isDate(t))return i(e,t);if(ku(t,n))return t.some(t=>i(e,t));if(Tu(t))return Cu(t,e,!1,n);if(Ou(t))return Array.isArray(t.dayOfWeek)?t.dayOfWeek.includes(e.getDay()):t.dayOfWeek===e.getDay();if(wu(t)){let n=a(t.before,e),r=a(t.after,e),i=n>0,s=r<0;return o(t.before,t.after)?s&&i:i||s}return Eu(t)?a(e,t.after)>0:Du(t)?a(t.before,e)>0:typeof t==`function`&&t(e)})}function ju(e,t,n,r,i){let{disabled:a,hidden:o,modifiers:s,showOutsideDays:c,broadcastCalendar:l,today:u=i.today()}=t,{isSameDay:d,isSameMonth:f,startOfMonth:p,isBefore:m,endOfMonth:h,isAfter:g}=i,_=n&&p(n),v=r&&h(r),y={[Xl.focused]:[],[Xl.outside]:[],[Xl.disabled]:[],[Xl.hidden]:[],[Xl.today]:[]},b={};for(let t of e){let{date:e,displayMonth:n}=t,r=!(!n||f(e,n)),p=!!(_&&m(e,_)),h=!!(v&&g(e,v)),x=!!(a&&Au(e,a,i)),S=!!(o&&Au(e,o,i))||p||h||!l&&!c&&r||l&&c===!1&&r,C=d(e,u);r&&y.outside.push(t),x&&y.disabled.push(t),S&&y.hidden.push(t),C&&y.today.push(t),s&&Object.keys(s).forEach(n=>{let r=s?.[n];r&&Au(e,r,i)&&(b[n]?b[n].push(t):b[n]=[t])})}return e=>{let t={[Xl.focused]:!1,[Xl.disabled]:!1,[Xl.hidden]:!1,[Xl.outside]:!1,[Xl.today]:!1},n={};for(let n in y)t[n]=y[n].some(t=>t===e);for(let t in b)n[t]=b[t].some(t=>t===e);return{...t,...n}}}function Mu(e,t,n={}){return Object.entries(e).filter(([,e])=>e===!0).reduce((e,[r])=>(n[r]?e.push(n[r]):t[Xl[r]]?e.push(t[Xl[r]]):t[Zl[r]]&&e.push(t[Zl[r]]),e),[t[q.Day]])}function Nu(e){return{...Su,...e}}function Pu(e){let t={"data-mode":e.mode??void 0,"data-required":`required`in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([e,n])=>{e.startsWith(`data-`)&&(t[e]=n)}),t}function Fu(){let e={};for(let t in q)e[q[t]]=`rdp-${q[t]}`;for(let t in Xl)e[Xl[t]]=`rdp-${Xl[t]}`;for(let t in Zl)e[Zl[t]]=`rdp-${Zl[t]}`;for(let t in Ql)e[Ql[t]]=`rdp-${Ql[t]}`;return e}function Iu(e,t,n){return(n??new Vl(t)).formatMonthYear(e)}function Lu(e,t,n){return(n??new Vl(t)).format(e,`d`)}function Ru(e,t=Hl){return t.format(e,`LLLL`)}function zu(e,t,n){return(n??new Vl(t)).format(e,`cccccc`)}function Bu(e,t=Hl){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function Vu(){return``}function Hu(e,t=Hl){return t.format(e,`yyyy`)}var Uu=s({formatCaption:()=>Iu,formatDay:()=>Lu,formatMonthDropdown:()=>Ru,formatWeekNumber:()=>Bu,formatWeekNumberHeader:()=>Vu,formatWeekdayName:()=>zu,formatYearDropdown:()=>Hu});function Wu(e){return{...Uu,...e}}function Gu(e,t,n,r){let i=(r??new Vl(n)).format(e,`PPPP`);return t.today&&(i=`Today, ${i}`),t.selected&&(i=`${i}, selected`),i}function Ku(e,t,n){return(n??new Vl(t)).formatMonthYear(e)}function qu(e,t,n,r){let i=(r??new Vl(n)).format(e,`PPPP`);return t?.today&&(i=`Today, ${i}`),i}function Ju(e){return`Choose the Month`}function Yu(){return``}var Xu=`Go to the Next Month`;function Zu(e,t){return Xu}function Qu(e){return`Go to the Previous Month`}function $u(e,t,n){return(n??new Vl(t)).format(e,`cccc`)}function J(e,t){return`Week ${e}`}function Y(e){return`Week Number`}function ed(e){return`Choose the Year`}var td=s({labelDayButton:()=>Gu,labelGrid:()=>Ku,labelGridcell:()=>qu,labelMonthDropdown:()=>Ju,labelNav:()=>Yu,labelNext:()=>Zu,labelPrevious:()=>Qu,labelWeekNumber:()=>J,labelWeekNumberHeader:()=>Y,labelWeekday:()=>$u,labelYearDropdown:()=>ed}),nd=(e,t,n)=>t||(n?typeof n==`function`?n:(...e)=>n:e);function rd(e,t){let n=t.locale?.labels??{};return{...td,...e??{},labelDayButton:nd(Gu,e?.labelDayButton,n.labelDayButton),labelMonthDropdown:nd(Ju,e?.labelMonthDropdown,n.labelMonthDropdown),labelNext:nd(Zu,e?.labelNext,n.labelNext),labelPrevious:nd(Qu,e?.labelPrevious,n.labelPrevious),labelWeekNumber:nd(J,e?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:nd(ed,e?.labelYearDropdown,n.labelYearDropdown),labelGrid:nd(Ku,e?.labelGrid,n.labelGrid),labelGridcell:nd(qu,e?.labelGridcell,n.labelGridcell),labelNav:nd(Yu,e?.labelNav,n.labelNav),labelWeekNumberHeader:nd(Y,e?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:nd($u,e?.labelWeekday,n.labelWeekday)}}function id(e,t,n,r,i){let{startOfMonth:a,startOfYear:o,endOfYear:s,eachMonthOfInterval:c,getMonth:l}=i;return c({start:o(e),end:s(e)}).map(e=>{let o=r.formatMonthDropdown(e,i);return{value:l(e),label:o,disabled:t&&e<a(t)||n&&e>a(n)||!1}})}function ad(e,t={},n={}){let r={...t?.[q.Day]};return Object.entries(e).filter(([,e])=>e===!0).forEach(([e])=>{r={...r,...n?.[e]}}),r}function od(e,t,n,r){let i=r??e.today(),a=n?e.startOfBroadcastWeek(i,e):t?e.startOfISOWeek(i):e.startOfWeek(i),o=[];for(let t=0;t<7;t++){let n=e.addDays(a,t);o.push(n)}return o}function sd(e,t,n,r,i=!1){if(!e||!t)return;let{startOfYear:a,endOfYear:o,eachYearOfInterval:s,getYear:c}=r,l=s({start:a(e),end:o(t)});return i&&l.reverse(),l.map(e=>{let t=n.formatYearDropdown(e,r);return{value:c(e),label:t,disabled:!1}})}function cd(e,t={}){let{weekStartsOn:n,locale:r}=t,i=n??r?.options?.weekStartsOn??0,a=t=>{let n=typeof t==`number`||typeof t==`string`?new Date(t):t;return new tc(n.getFullYear(),n.getMonth(),n.getDate(),12,0,0,e)},o=e=>{let t=a(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0)};return{today:()=>a(tc.tz(e)),newDate:(t,n,r)=>new tc(t,n,r,12,0,0,e),startOfDay:e=>a(e),startOfWeek:(e,t)=>{let n=a(e),r=t?.weekStartsOn??i,o=(n.getDay()-r+7)%7;return n.setDate(n.getDate()-o),n},startOfISOWeek:e=>{let t=a(e),n=(t.getDay()-1+7)%7;return t.setDate(t.getDate()-n),t},startOfMonth:e=>{let t=a(e);return t.setDate(1),t},startOfYear:e=>{let t=a(e);return t.setMonth(0,1),t},endOfWeek:(e,t)=>{let n=a(e),r=(((t?.weekStartsOn??i)+6)%7-n.getDay()+7)%7;return n.setDate(n.getDate()+r),n},endOfISOWeek:e=>{let t=a(e),n=(7-t.getDay())%7;return t.setDate(t.getDate()+n),t},endOfMonth:e=>{let t=a(e);return t.setMonth(t.getMonth()+1,0),t},endOfYear:e=>{let t=a(e);return t.setMonth(11,31),t},eachMonthOfInterval:t=>{let n=a(t.start),r=a(t.end),i=[],o=new tc(n.getFullYear(),n.getMonth(),1,12,0,0,e),s=r.getFullYear()*12+r.getMonth();for(;o.getFullYear()*12+o.getMonth()<=s;)i.push(new tc(o,e)),o.setMonth(o.getMonth()+1,1);return i},addDays:(e,t)=>{let n=a(e);return n.setDate(n.getDate()+t),n},addWeeks:(e,t)=>{let n=a(e);return n.setDate(n.getDate()+t*7),n},addMonths:(e,t)=>{let n=a(e);return n.setMonth(n.getMonth()+t),n},addYears:(e,t)=>{let n=a(e);return n.setFullYear(n.getFullYear()+t),n},eachYearOfInterval:t=>{let n=a(t.start),r=a(t.end),i=[],o=new tc(n.getFullYear(),0,1,12,0,0,e);for(;o.getFullYear()<=r.getFullYear();)i.push(new tc(o,e)),o.setFullYear(o.getFullYear()+1,0,1);return i},getWeek:(e,t)=>tl(o(e),{weekStartsOn:t?.weekStartsOn??i,firstWeekContainsDate:t?.firstWeekContainsDate??r?.options?.firstWeekContainsDate??1}),getISOWeek:e=>Qc(o(e)),differenceInCalendarDays:(e,t)=>yc(o(e),o(t)),differenceInCalendarMonths:(e,t)=>Oc(o(e),o(t))}}var ld=e=>e instanceof HTMLElement?e:null,ud=e=>[...e.querySelectorAll(`[data-animated-month]`)??[]],dd=e=>ld(e.querySelector(`[data-animated-month]`)),fd=e=>ld(e.querySelector(`[data-animated-caption]`)),pd=e=>ld(e.querySelector(`[data-animated-weeks]`)),md=e=>ld(e.querySelector(`[data-animated-nav]`)),hd=e=>ld(e.querySelector(`[data-animated-weekdays]`));function gd(e,t,{classNames:n,months:r,focused:i,dateLib:a}){let o=(0,O.useRef)(null),s=(0,O.useRef)(r),c=(0,O.useRef)(!1);(0,O.useLayoutEffect)(()=>{let l=s.current;if(s.current=r,!t||!e.current||!(e.current instanceof HTMLElement)||r.length===0||l.length===0||r.length!==l.length)return;let u=a.isSameMonth(r[0].date,l[0].date),d=a.isAfter(r[0].date,l[0].date),f=d?n[Ql.caption_after_enter]:n[Ql.caption_before_enter],p=d?n[Ql.weeks_after_enter]:n[Ql.weeks_before_enter],m=o.current,h=e.current.cloneNode(!0);if(h instanceof HTMLElement?(ud(h).forEach(e=>{if(!(e instanceof HTMLElement))return;let t=dd(e);t&&e.contains(t)&&e.removeChild(t);let n=fd(e);n&&n.classList.remove(f);let r=pd(e);r&&r.classList.remove(p)}),o.current=h):o.current=null,c.current||u||i)return;let g=m instanceof HTMLElement?ud(m):[],_=ud(e.current);if(_?.every(e=>e instanceof HTMLElement)&&g?.every(e=>e instanceof HTMLElement)){c.current=!0;let t=[];e.current.style.isolation=`isolate`;let r=md(e.current);r&&(r.style.zIndex=`1`),_.forEach((i,a)=>{let o=g[a];if(!o)return;i.style.position=`relative`,i.style.overflow=`hidden`;let s=fd(i);s&&s.classList.add(f);let l=pd(i);l&&l.classList.add(p);let u=()=>{c.current=!1,e.current&&(e.current.style.isolation=``),r&&(r.style.zIndex=``),s&&s.classList.remove(f),l&&l.classList.remove(p),i.style.position=``,i.style.overflow=``,i.contains(o)&&i.removeChild(o)};t.push(u),o.style.pointerEvents=`none`,o.style.position=`absolute`,o.style.overflow=`hidden`,o.setAttribute(`aria-hidden`,`true`);let m=hd(o);m&&(m.style.opacity=`0`);let h=fd(o);h&&(h.classList.add(d?n[Ql.caption_before_exit]:n[Ql.caption_after_exit]),h.addEventListener(`animationend`,u));let _=pd(o);_&&_.classList.add(d?n[Ql.weeks_before_exit]:n[Ql.weeks_after_exit]),i.insertBefore(o,i.firstChild)})}})}function _d(e,t,n,r){let i=e[0],a=e[e.length-1],{ISOWeek:o,fixedWeeks:s,broadcastCalendar:c}=n??{},{addDays:l,differenceInCalendarDays:u,differenceInCalendarMonths:d,endOfBroadcastWeek:f,endOfISOWeek:p,endOfMonth:m,endOfWeek:h,isAfter:g,startOfBroadcastWeek:_,startOfISOWeek:v,startOfWeek:y}=r,b=c?_(i,r):o?v(i):y(i),x=c?f(a):o?p(m(a)):h(m(a)),S=t&&(c?f(t):o?p(t):h(t)),C=u(S&&g(x,S)?S:x,b),w=d(a,i)+1,T=[];for(let e=0;e<=C;e++){let t=l(b,e);T.push(t)}let E=(c?35:42)*w;if(s&&T.length<E){let e=E-T.length;for(let t=0;t<e;t++){let e=l(T[T.length-1],1);T.push(e)}}return T}function vd(e){let t=[];return e.reduce((e,n)=>{let r=n.weeks.reduce((e,t)=>e.concat(t.days.slice()),t.slice());return e.concat(r.slice())},t.slice())}function yd(e,t,n,r){let{numberOfMonths:i=1}=n,a=[];for(let n=0;n<i;n++){let i=r.addMonths(e,n);if(t&&i>t)break;a.push(i)}return a}function bd(e,t,n,r){let{month:i,defaultMonth:a,today:o=r.today(),numberOfMonths:s=1}=e,c=i||a||o,{differenceInCalendarMonths:l,addMonths:u,startOfMonth:d}=r;return n&&l(n,c)<s-1&&(c=u(n,-1*(s-1))),t&&l(c,t)<0&&(c=t),d(c)}function xd(e,t,n,r){let{addDays:i,endOfBroadcastWeek:a,endOfISOWeek:o,endOfMonth:s,endOfWeek:c,getISOWeek:l,getWeek:u,startOfBroadcastWeek:d,startOfISOWeek:f,startOfWeek:p}=r,m=e.reduce((e,m)=>{let h=n.broadcastCalendar?d(m,r):n.ISOWeek?f(m):p(m),g=n.broadcastCalendar?a(m):n.ISOWeek?o(s(m)):c(s(m)),_=t.filter(e=>e>=h&&e<=g),v=n.broadcastCalendar?35:42;if(n.fixedWeeks&&_.length<v){let e=t.filter(e=>{let t=v-_.length;return e>g&&e<=i(g,t)});_.push(...e)}let y=new Wl(m,_.reduce((e,t)=>{let i=n.ISOWeek?l(t):u(t),a=e.find(e=>e.weekNumber===i),o=new Ul(t,m,r);return a?a.days.push(o):e.push(new Gl(i,[o])),e},[]));return e.push(y),e},[]);return n.reverseMonths?m.reverse():m}function Sd(e,t){let{startMonth:n,endMonth:r}=e,{startOfYear:i,startOfDay:a,startOfMonth:o,endOfMonth:s,addYears:c,endOfYear:l,today:u}=t,d=e.captionLayout===`dropdown`||e.captionLayout===`dropdown-years`;return n?n=o(n):!n&&d&&(n=i(c(e.today??u(),-100))),r?r=s(r):!r&&d&&(r=l(e.today??u())),[n&&a(n),r&&a(r)]}function Cd(e,t,n,r){if(n.disableNavigation)return;let{pagedNavigation:i,numberOfMonths:a=1}=n,{startOfMonth:o,addMonths:s,differenceInCalendarMonths:c}=r,l=i?a:1,u=o(e);if(!t||!(c(t,e)<a))return s(u,l)}function wd(e,t,n,r){if(n.disableNavigation)return;let{pagedNavigation:i,numberOfMonths:a}=n,{startOfMonth:o,addMonths:s,differenceInCalendarMonths:c}=r,l=i?a??1:1,u=o(e);if(!t||!(c(u,t)<=0))return s(u,-l)}function Td(e){return e.reduce((e,t)=>e.concat(t.weeks.slice()),[].slice())}function Ed(e,t){let[n,r]=(0,O.useState)(e);return[t===void 0?n:t,r]}function Dd(e,t){let[n,r]=Sd(e,t),{startOfMonth:i,endOfMonth:a}=t,o=bd(e,n,r,t),[s,c]=Ed(o,e.month?o:void 0);(0,O.useEffect)(()=>{let i=bd(e,n,r,t);c(i)},[e.timeZone]);let{months:l,weeks:u,days:d,previousMonth:f,nextMonth:p}=(0,O.useMemo)(()=>{let i=yd(s,r,{numberOfMonths:e.numberOfMonths},t),o=xd(i,_d(i,e.endMonth?a(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t);return{months:o,weeks:Td(o),days:vd(o),previousMonth:wd(s,n,e,t),nextMonth:Cd(s,r,e,t)}},[t,s.getTime(),r?.getTime(),n?.getTime(),e.disableNavigation,e.broadcastCalendar,e.endMonth?.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:m,onMonthChange:h}=e,g=e=>u.some(t=>t.days.some(t=>t.isEqualTo(e))),_=e=>{if(m)return;let t=i(e);n&&t<i(n)&&(t=i(n)),r&&t>i(r)&&(t=i(r)),c(t),h?.(t)};return{months:l,weeks:u,days:d,navStart:n,navEnd:r,previousMonth:f,nextMonth:p,goToMonth:_,goToDay:e=>{g(e)||_(e.date)}}}var Od;(function(e){e[e.Today=0]=`Today`,e[e.Selected=1]=`Selected`,e[e.LastFocused=2]=`LastFocused`,e[e.FocusedModifier=3]=`FocusedModifier`})(Od||={});function kd(e){return!e[Xl.disabled]&&!e[Xl.hidden]&&!e[Xl.outside]}function Ad(e,t,n,r){let i,a=-1;for(let o of e){let e=t(o);kd(e)&&(e[Xl.focused]&&a<Od.FocusedModifier?(i=o,a=Od.FocusedModifier):r?.isEqualTo(o)&&a<Od.LastFocused?(i=o,a=Od.LastFocused):n(o.date)&&a<Od.Selected?(i=o,a=Od.Selected):e[Xl.today]&&a<Od.Today&&(i=o,a=Od.Today))}return i||=e.find(e=>kd(t(e))),i}function jd(e,t,n,r,i,a,o){let{ISOWeek:s,broadcastCalendar:c}=a,{addDays:l,addMonths:u,addWeeks:d,addYears:f,endOfBroadcastWeek:p,endOfISOWeek:m,endOfWeek:h,max:g,min:_,startOfBroadcastWeek:v,startOfISOWeek:y,startOfWeek:b}=o,x={day:l,week:d,month:u,year:f,startOfWeek:e=>c?v(e,o):s?y(e):b(e),endOfWeek:e=>c?p(e):s?m(e):h(e)}[e](n,t===`after`?1:-1);return t===`before`&&r?x=g([r,x]):t===`after`&&i&&(x=_([i,x])),x}function Md(e,t,n,r,i,a,o,s=0){if(s>365)return;let c=jd(e,t,n.date,r,i,a,o),l=!!(a.disabled&&Au(c,a.disabled,o)),u=!!(a.hidden&&Au(c,a.hidden,o)),d=new Ul(c,c,o);return!l&&!u?d:Md(e,t,d,r,i,a,o,s+1)}function Nd(e,t,n,r,i){let{autoFocus:a}=e,[o,s]=(0,O.useState)(),c=Ad(t.days,n,r||(()=>!1),o),[l,u]=(0,O.useState)(a?c:void 0);return{isFocusTarget:e=>!!c?.isEqualTo(e),setFocused:u,focused:l,blur:()=>{s(l),u(void 0)},moveFocus:(n,r)=>{if(!l)return;let a=Md(n,r,l,t.navStart,t.navEnd,e,i);a&&(!e.disableNavigation||t.days.some(e=>e.isEqualTo(a)))&&(t.goToDay(a),u(a))}}}function Pd(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=Ed(n,i?n:void 0),s=i?n:a,{isSameDay:c}=t,l=e=>s?.some(t=>c(t,e))??!1,{min:u,max:d}=e;return{selected:s,select:(e,t,n)=>{let a=[...s??[]];if(l(e)){if(s?.length===u||r&&s?.length===1)return;a=s?.filter(t=>!c(t,e))}else a=s?.length===d?[e]:[...a,e];return i||o(a),i?.(a,e,t,n),a},isSelected:l}}function Fd(e,t,n=0,r=0,i=!1,a=Hl){let{from:o,to:s}=t||{},{isSameDay:c,isAfter:l,isBefore:u}=a,d;if(!o&&!s)d={from:e,to:n>0?void 0:e};else if(o&&!s)d=c(o,e)?n===0?{from:o,to:e}:i?{from:o,to:void 0}:void 0:u(e,o)?{from:e,to:o}:{from:o,to:e};else if(o&&s){if(c(o,e)&&c(s,e))d=i?{from:o,to:s}:void 0;else if(c(o,e))d={from:o,to:n>0?void 0:e};else if(c(s,e))d={from:e,to:n>0?void 0:e};else if(u(e,o))d={from:e,to:s};else if(l(e,o))d={from:o,to:e};else if(l(e,s))d={from:o,to:e};else throw Error(`Invalid range`)}if(d?.from&&d?.to){let t=a.differenceInCalendarDays(d.to,d.from);(r>0&&t>r||n>1&&t<n)&&(d={from:e,to:void 0})}return d}function Id(e,t,n=Hl){let r=Array.isArray(t)?t:[t],i=e.from,a=n.differenceInCalendarDays(e.to,e.from),o=Math.min(a,6);for(let e=0;e<=o;e++){if(r.includes(i.getDay()))return!0;i=n.addDays(i,1)}return!1}function Ld(e,t,n=Hl){return Cu(e,t.from,!1,n)||Cu(e,t.to,!1,n)||Cu(t,e.from,!1,n)||Cu(t,e.to,!1,n)}function Rd(e,t,n=Hl){let r=Array.isArray(t)?t:[t];if(r.filter(e=>typeof e!=`function`).some(t=>typeof t==`boolean`?t:n.isDate(t)?Cu(e,t,!1,n):ku(t,n)?t.some(t=>Cu(e,t,!1,n)):Tu(t)?t.from&&t.to?Ld(e,{from:t.from,to:t.to},n):!1:Ou(t)?Id(e,t.dayOfWeek,n):wu(t)?n.isAfter(t.before,t.after)?Ld(e,{from:n.addDays(t.after,1),to:n.addDays(t.before,-1)},n):Au(e.from,t,n)||Au(e.to,t,n):Eu(t)||Du(t)?Au(e.from,t,n)||Au(e.to,t,n):!1))return!0;let i=r.filter(e=>typeof e==`function`);if(i.length){let t=e.from,r=n.differenceInCalendarDays(e.to,e.from);for(let e=0;e<=r;e++){if(i.some(e=>e(t)))return!0;t=n.addDays(t,1)}}return!1}function zd(e,t){let{disabled:n,excludeDisabled:r,resetOnSelect:i,selected:a,required:o,onSelect:s}=e,[c,l]=Ed(a,s?a:void 0),u=s?a:c;return{selected:u,select:(a,c,d)=>{let{min:f,max:p}=e,m;if(a){let e=u?.from,n=u?.to,r=!!e&&!!n,s=!!e&&!!n&&t.isSameDay(e,n)&&t.isSameDay(a,e);m=i&&(r||!u?.from)?!o&&s?void 0:{from:a,to:void 0}:Fd(a,u,f,p,o,t)}return r&&n&&m?.from&&m.to&&Rd({from:m.from,to:m.to},n,t)&&(m.from=a,m.to=void 0),s||l(m),s?.(m,a,c,d),m},isSelected:e=>u&&Cu(u,e,!1,t)}}function Bd(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=Ed(n,i?n:void 0),s=i?n:a,{isSameDay:c}=t;return{selected:s,select:(e,t,n)=>{let a=e;return!r&&s&&s&&c(e,s)&&(a=void 0),i||o(a),i?.(a,e,t,n),a},isSelected:e=>s?c(s,e):!1}}function Vd(e,t){let n=Bd(e,t),r=Pd(e,t),i=zd(e,t);switch(e.mode){case`single`:return n;case`multiple`:return r;case`range`:return i;default:return}}function Hd(e,t){return e instanceof tc&&e.timeZone===t?e:new tc(e,t)}function Ud(e,t,n){if(!n)return Hd(e,t);let r=Hd(e,t),i=new tc(r.getFullYear(),r.getMonth(),r.getDate(),12,0,0,t);return new Date(i.getTime())}function Wd(e,t,n){return typeof e==`boolean`||typeof e==`function`?e:e instanceof Date?Ud(e,t,n):Array.isArray(e)?e.map(e=>e instanceof Date?Ud(e,t,n):e):Tu(e)?{...e,from:e.from?Hd(e.from,t):e.from,to:e.to?Hd(e.to,t):e.to}:wu(e)?{before:Ud(e.before,t,n),after:Ud(e.after,t,n)}:Eu(e)?{after:Ud(e.after,t,n)}:Du(e)?{before:Ud(e.before,t,n)}:e}function Gd(e,t,n){return e&&(Array.isArray(e)?e.map(e=>Wd(e,t,n)):Wd(e,t,n))}function Kd(e){let t=e,n=t.timeZone;if(n&&(t={...e,timeZone:n},t.today&&(t.today=Hd(t.today,n)),t.month&&(t.month=Hd(t.month,n)),t.defaultMonth&&(t.defaultMonth=Hd(t.defaultMonth,n)),t.startMonth&&(t.startMonth=Hd(t.startMonth,n)),t.endMonth&&(t.endMonth=Hd(t.endMonth,n)),t.mode===`single`&&t.selected?t.selected=Hd(t.selected,n):t.mode===`multiple`&&t.selected?t.selected=t.selected?.map(e=>Hd(e,n)):t.mode===`range`&&t.selected&&(t.selected={from:t.selected.from?Hd(t.selected.from,n):t.selected.from,to:t.selected.to?Hd(t.selected.to,n):t.selected.to}),t.disabled!==void 0&&(t.disabled=Gd(t.disabled,n)),t.hidden!==void 0&&(t.hidden=Gd(t.hidden,n)),t.modifiers)){let e={};Object.keys(t.modifiers).forEach(r=>{e[r]=Gd(t.modifiers?.[r],n)}),t.modifiers=e}let{components:r,formatters:i,labels:a,dateLib:o,locale:s,classNames:c}=(0,O.useMemo)(()=>{let e={...Bl,...t.locale},n=t.broadcastCalendar?1:t.weekStartsOn,r=t.noonSafe&&t.timeZone?cd(t.timeZone,{weekStartsOn:n,locale:e}):void 0,i=t.dateLib&&r?{...r,...t.dateLib}:t.dateLib??r,a=new Vl({locale:e,weekStartsOn:n,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},i);return{dateLib:a,components:Nu(t.components),formatters:Wu(t.formatters),labels:rd(t.labels,a.options),locale:e,classNames:{...Fu(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.noonSafe,t.components,t.formatters,t.labels,t.classNames]);t.today||(t={...t,today:o.today()});let{captionLayout:l,mode:u,navLayout:d,numberOfMonths:f=1,onDayBlur:p,onDayClick:m,onDayFocus:h,onDayKeyDown:g,onDayMouseEnter:_,onDayMouseLeave:v,onNextClick:y,onPrevClick:b,showWeekNumber:x,styles:S}=t,{formatCaption:C,formatDay:w,formatMonthDropdown:T,formatWeekNumber:E,formatWeekNumberHeader:D,formatWeekdayName:k,formatYearDropdown:A}=i,j=Dd(t,o),{days:M,months:N,navStart:ee,navEnd:te,previousMonth:P,nextMonth:ne,goToMonth:re}=j,ie=ju(M,t,ee,te,o),{isSelected:ae,select:oe,selected:se}=Vd(t,o)??{},{blur:ce,focused:le,isFocusTarget:ue,moveFocus:de,setFocused:fe}=Nd(t,j,ie,ae??(()=>!1),o),{labelDayButton:pe,labelGridcell:F,labelGrid:me,labelMonthDropdown:I,labelNav:L,labelPrevious:he,labelNext:ge,labelWeekday:_e,labelWeekNumber:ve,labelWeekNumberHeader:ye,labelYearDropdown:be}=a,xe=(0,O.useMemo)(()=>od(o,t.ISOWeek,t.broadcastCalendar,t.today),[o,t.ISOWeek,t.broadcastCalendar,t.today]),Se=u!==void 0||m!==void 0,Ce=(0,O.useCallback)(()=>{P&&(re(P),b?.(P))},[P,re,b]),we=(0,O.useCallback)(()=>{ne&&(re(ne),y?.(ne))},[re,ne,y]),Te=(0,O.useCallback)((e,t)=>n=>{n.preventDefault(),n.stopPropagation(),fe(e),!t.disabled&&(oe?.(e.date,t,n),m?.(e.date,t,n))},[oe,m,fe]),Ee=(0,O.useCallback)((e,t)=>n=>{fe(e),h?.(e.date,t,n)},[h,fe]),De=(0,O.useCallback)((e,t)=>n=>{ce(),p?.(e.date,t,n)},[ce,p]),Oe=(0,O.useCallback)((e,n)=>r=>{let i={ArrowLeft:[r.shiftKey?`month`:`day`,t.dir===`rtl`?`after`:`before`],ArrowRight:[r.shiftKey?`month`:`day`,t.dir===`rtl`?`before`:`after`],ArrowDown:[r.shiftKey?`year`:`week`,`after`],ArrowUp:[r.shiftKey?`year`:`week`,`before`],PageUp:[r.shiftKey?`year`:`month`,`before`],PageDown:[r.shiftKey?`year`:`month`,`after`],Home:[`startOfWeek`,`before`],End:[`endOfWeek`,`after`]};if(i[r.key]){r.preventDefault(),r.stopPropagation();let[e,t]=i[r.key];de(e,t)}g?.(e.date,n,r)},[de,g,t.dir]),ke=(0,O.useCallback)((e,t)=>n=>{_?.(e.date,t,n)},[_]),Ae=(0,O.useCallback)((e,t)=>n=>{v?.(e.date,t,n)},[v]),je=(0,O.useCallback)((e,t)=>n=>{let r=Number(n.target.value),i=o.setMonth(o.startOfMonth(e),r);re(o.addMonths(i,-t))},[o,re]),Me=(0,O.useCallback)((e,t)=>n=>{let r=Number(n.target.value),i=o.setYear(o.startOfMonth(e),r);re(o.addMonths(i,-t))},[o,re]),{className:Ne,style:Pe}=(0,O.useMemo)(()=>({className:[c[q.Root],t.className].filter(Boolean).join(` `),style:{...S?.[q.Root],...t.style}}),[c,t.className,t.style,S]),Fe=Pu(t),Ie=e=>{let t=S?.[q.Dropdown],n=S?.[e];if(t||n)return{...t,...n}},Le=(0,O.useRef)(null);gd(Le,!!t.animate,{classNames:c,months:N,focused:le,dateLib:o});let Re={dayPickerProps:t,selected:se,select:oe,isSelected:ae,months:N,nextMonth:ne,previousMonth:P,goToMonth:re,getModifiers:ie,components:r,classNames:c,styles:S,labels:a,formatters:i};return O.createElement($l.Provider,{value:Re},O.createElement(r.Root,{rootRef:t.animate?Le:void 0,className:Ne,style:Pe,dir:t.dir,id:t.id,lang:t.lang??s.code,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t[`aria-label`],"aria-labelledby":t[`aria-labelledby`],...Fe},O.createElement(r.Months,{className:c[q.Months],style:S?.[q.Months]},!t.hideNavigation&&!d&&O.createElement(r.Nav,{"data-animated-nav":t.animate?`true`:void 0,className:c[q.Nav],style:S?.[q.Nav],"aria-label":L(),onPreviousClick:Ce,onNextClick:we,previousMonth:P,nextMonth:ne}),N.map((e,n)=>{let a=t.reverseMonths?N.length-1-n:n;return O.createElement(r.Month,{"data-animated-month":t.animate?`true`:void 0,className:c[q.Month],style:S?.[q.Month],key:n,displayIndex:n,calendarMonth:e},d===`around`&&!t.hideNavigation&&n===0&&O.createElement(r.PreviousMonthButton,{type:`button`,className:c[q.PreviousMonthButton],style:S?.[q.PreviousMonthButton],tabIndex:P?void 0:-1,"aria-disabled":!P||void 0,"aria-label":he(P),onClick:Ce,"data-animated-button":t.animate?`true`:void 0},O.createElement(r.Chevron,{disabled:!P||void 0,className:c[q.Chevron],style:S?.[q.Chevron],orientation:t.dir===`rtl`?`right`:`left`})),O.createElement(r.MonthCaption,{"data-animated-caption":t.animate?`true`:void 0,className:c[q.MonthCaption],style:S?.[q.MonthCaption],calendarMonth:e,displayIndex:n},l?.startsWith(`dropdown`)?O.createElement(r.DropdownNav,{className:c[q.Dropdowns],style:S?.[q.Dropdowns]},(()=>{let n=l===`dropdown`||l===`dropdown-months`?O.createElement(r.MonthsDropdown,{key:`month`,className:c[q.MonthsDropdown],"aria-label":I(),disabled:!!t.disableNavigation,onChange:je(e.date,a),options:id(e.date,ee,te,i,o),style:Ie(q.MonthsDropdown),value:o.getMonth(e.date)}):O.createElement(`span`,{key:`month`},T(e.date,o)),s=l===`dropdown`||l===`dropdown-years`?O.createElement(r.YearsDropdown,{key:`year`,className:c[q.YearsDropdown],"aria-label":be(o.options),disabled:!!t.disableNavigation,onChange:Me(e.date,a),options:sd(ee,te,i,o,!!t.reverseYears),style:Ie(q.YearsDropdown),value:o.getYear(e.date)}):O.createElement(`span`,{key:`year`},A(e.date,o));return o.getMonthYearOrder()===`year-first`?[s,n]:[n,s]})(),O.createElement(`span`,{role:`status`,"aria-live":`polite`,style:{border:0,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`,wordWrap:`normal`}},C(e.date,o.options,o))):O.createElement(r.CaptionLabel,{className:c[q.CaptionLabel],style:S?.[q.CaptionLabel],role:`status`,"aria-live":`polite`},C(e.date,o.options,o))),d===`around`&&!t.hideNavigation&&n===f-1&&O.createElement(r.NextMonthButton,{type:`button`,className:c[q.NextMonthButton],style:S?.[q.NextMonthButton],tabIndex:ne?void 0:-1,"aria-disabled":!ne||void 0,"aria-label":ge(ne),onClick:we,"data-animated-button":t.animate?`true`:void 0},O.createElement(r.Chevron,{disabled:!ne||void 0,className:c[q.Chevron],style:S?.[q.Chevron],orientation:t.dir===`rtl`?`left`:`right`})),n===f-1&&d===`after`&&!t.hideNavigation&&O.createElement(r.Nav,{"data-animated-nav":t.animate?`true`:void 0,className:c[q.Nav],style:S?.[q.Nav],"aria-label":L(),onPreviousClick:Ce,onNextClick:we,previousMonth:P,nextMonth:ne}),O.createElement(r.MonthGrid,{role:`grid`,"aria-multiselectable":u===`multiple`||u===`range`,"aria-label":me(e.date,o.options,o)||void 0,className:c[q.MonthGrid],style:S?.[q.MonthGrid]},!t.hideWeekdays&&O.createElement(r.Weekdays,{"data-animated-weekdays":t.animate?`true`:void 0,className:c[q.Weekdays],style:S?.[q.Weekdays]},x&&O.createElement(r.WeekNumberHeader,{"aria-label":ye(o.options),className:c[q.WeekNumberHeader],style:S?.[q.WeekNumberHeader],scope:`col`},D()),xe.map(e=>O.createElement(r.Weekday,{"aria-label":_e(e,o.options,o),className:c[q.Weekday],key:String(e),style:S?.[q.Weekday],scope:`col`},k(e,o.options,o)))),O.createElement(r.Weeks,{"data-animated-weeks":t.animate?`true`:void 0,className:c[q.Weeks],style:S?.[q.Weeks]},e.weeks.map(e=>O.createElement(r.Week,{className:c[q.Week],key:e.weekNumber,style:S?.[q.Week],week:e},x&&O.createElement(r.WeekNumber,{week:e,style:S?.[q.WeekNumber],"aria-label":ve(e.weekNumber,{locale:s}),className:c[q.WeekNumber],scope:`row`,role:`rowheader`},E(e.weekNumber,o)),e.days.map(e=>{let{date:n}=e,i=ie(e);if(i[Xl.focused]=!i.hidden&&!!le?.isEqualTo(e),i[Zl.selected]=ae?.(n)||i.selected,Tu(se)){let{from:e,to:t}=se;i[Zl.range_start]=!!(e&&t&&o.isSameDay(n,e)),i[Zl.range_end]=!!(e&&t&&o.isSameDay(n,t)),i[Zl.range_middle]=Cu(se,n,!0,o)}let a=ad(i,S,t.modifiersStyles),s=Mu(i,c,t.modifiersClassNames),l=!Se&&!i.hidden?F(n,i,o.options,o):void 0;return O.createElement(r.Day,{key:`${e.isoDate}_${e.displayMonthId}`,day:e,modifiers:i,className:s.join(` `),style:a,role:`gridcell`,"aria-selected":i.selected||void 0,"aria-label":l,"data-day":e.isoDate,"data-month":e.outside?e.dateMonthId:void 0,"data-selected":i.selected||void 0,"data-disabled":i.disabled||void 0,"data-hidden":i.hidden||void 0,"data-outside":e.outside||void 0,"data-focused":i.focused||void 0,"data-today":i.today||void 0},!i.hidden&&Se?O.createElement(r.DayButton,{className:c[q.DayButton],style:S?.[q.DayButton],type:`button`,day:e,modifiers:i,disabled:!i.focused&&i.disabled||void 0,"aria-disabled":i.focused&&i.disabled||void 0,tabIndex:ue(e)?0:-1,"aria-label":pe(n,i,o.options,o),onClick:Te(e,i),onBlur:De(e,i),onFocus:Ee(e,i),onKeyDown:Oe(e,i),onMouseEnter:ke(e,i),onMouseLeave:Ae(e,i)},w(n,o.options,o)):!i.hidden&&w(e.date,o.options,o))}))))))})),t.footer&&O.createElement(r.Footer,{className:c[q.Footer],style:S?.[q.Footer],role:`status`,"aria-live":`polite`},t.footer)))}function qd({className:e,classNames:t,showOutsideDays:n=!0,captionLayout:r=`label`,buttonVariant:i=`ghost`,formatters:a,components:o,...s}){let c=Fu();return(0,R.jsx)(Kd,{showOutsideDays:n,className:G(`la:group/calendar la:bg-background la:p-3 la:[--cell-size:--spacing(8)] la:[[data-slot=card-content]_&]:bg-transparent la:[[data-slot=popover-content]_&]:bg-transparent`,e),captionLayout:r,formatters:{formatMonthDropdown:e=>e.toLocaleString(`default`,{month:`short`}),...a},classNames:{root:G(`la:w-fit`,c.root),months:G(`la:relative la:flex la:flex-col la:gap-4 la:md:flex-row`,c.months),month:G(`la:flex la:w-full la:flex-col la:gap-4`,c.month),nav:G(`la:absolute la:inset-x-0 la:top-0 la:flex la:w-full la:items-center la:justify-between la:gap-1`,c.nav),button_previous:G(Ts({variant:i}),`la:size-(--cell-size) la:p-0 la:select-none la:aria-disabled:opacity-50`,c.button_previous),button_next:G(Ts({variant:i}),`la:size-(--cell-size) la:p-0 la:select-none la:aria-disabled:opacity-50`,c.button_next),month_caption:G(`la:flex la:h-(--cell-size) la:w-full la:items-center la:justify-center la:px-(--cell-size)`,c.month_caption),dropdowns:G(`la:flex la:h-(--cell-size) la:w-full la:items-center la:justify-center la:gap-1.5 la:text-sm la:font-medium`,c.dropdowns),dropdown_root:G(`la:relative la:rounded-md la:border la:border-input la:shadow-xs la:has-focus:border-ring la:has-focus:ring-[3px] la:has-focus:ring-ring/50`,c.dropdown_root),dropdown:G(`la:absolute la:inset-0 la:bg-popover la:opacity-0`,c.dropdown),caption_label:G(`la:font-medium la:select-none`,r===`label`?`la:text-sm`:`la:flex la:h-8 la:items-center la:gap-1 la:rounded-md la:pr-1 la:pl-2 la:text-sm la:[&>svg]:size-3.5 la:[&>svg]:text-muted-foreground`,c.caption_label),month_grid:G(`la:w-full la:border-collapse`,c.month_grid),weekdays:G(`la:flex`,c.weekdays),weekday:G(`la:flex-1 la:rounded-md la:text-[0.8rem] la:font-normal la:text-muted-foreground la:select-none`,c.weekday),week:G(`la:mt-2 la:flex la:w-full`,c.week),week_number_header:G(`la:w-(--cell-size) la:select-none`,c.week_number_header),week_number:G(`la:text-[0.8rem] la:text-muted-foreground la:select-none`,c.week_number),day:G(`la:group/day la:relative la:aspect-square la:h-full la:w-full la:p-0 la:text-center la:select-none la:[&:last-child[data-selected=true]_button]:rounded-r-md`,s.showWeekNumber?`la:[&:nth-child(2)[data-selected=true]_button]:rounded-l-md`:`la:[&:first-child[data-selected=true]_button]:rounded-l-md`,c.day),range_start:G(`la:rounded-l-md la:bg-accent`,c.range_start),range_middle:G(`la:rounded-none`,c.range_middle),range_end:G(`la:rounded-r-md la:bg-accent`,c.range_end),today:G(`la:rounded-md la:bg-accent la:text-accent-foreground la:data-[selected=true]:rounded-none`,c.today),outside:G(`la:text-muted-foreground la:aria-selected:text-muted-foreground`,c.outside),disabled:G(`la:text-muted-foreground la:opacity-50`,c.disabled),hidden:G(`la:invisible`,c.hidden),...t},components:{Root:({className:e,rootRef:t,...n})=>(0,R.jsx)(`div`,{"data-slot":`calendar`,ref:t,className:G(e),...n}),Chevron:({className:e,orientation:t,...n})=>t===`left`?(0,R.jsx)(pe,{className:G(`la:size-4`,e),...n}):t===`right`?(0,R.jsx)(me,{className:G(`la:size-4`,e),...n}):(0,R.jsx)(de,{className:G(`la:size-4`,e),...n}),DayButton:Jd,WeekNumber:({children:e,...t})=>(0,R.jsx)(`td`,{...t,children:(0,R.jsx)(`div`,{className:`la:flex la:size-(--cell-size) la:items-center la:justify-center la:text-center`,children:e})}),...o},...s})}function Jd({className:e,day:t,modifiers:n,...r}){let i=Fu(),a=O.useRef(null);return O.useEffect(()=>{n.focused&&a.current?.focus()},[n.focused]),(0,R.jsx)(K,{ref:a,variant:`ghost`,size:`icon`,"data-day":t.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:G(`la:flex la:aspect-square la:size-auto la:w-full la:min-w-(--cell-size) la:flex-col la:gap-1 la:leading-none la:font-normal la:group-data-[focused=true]/day:relative la:group-data-[focused=true]/day:z-10 la:group-data-[focused=true]/day:border-ring la:group-data-[focused=true]/day:ring-[3px] la:group-data-[focused=true]/day:ring-ring/50 la:data-[range-end=true]:rounded-md la:data-[range-end=true]:rounded-r-md la:data-[range-end=true]:bg-primary la:data-[range-end=true]:text-primary-foreground la:data-[range-middle=true]:rounded-none la:data-[range-middle=true]:bg-accent la:data-[range-middle=true]:text-accent-foreground la:data-[range-start=true]:rounded-md la:data-[range-start=true]:rounded-l-md la:data-[range-start=true]:bg-primary la:data-[range-start=true]:text-primary-foreground la:data-[selected-single=true]:bg-primary la:data-[selected-single=true]:text-primary-foreground la:dark:hover:text-accent-foreground la:[&>span]:text-xs la:[&>span]:opacity-70`,i.day,e),...r})}function Yd({className:e,type:t,...n}){return(0,R.jsx)(`input`,{type:t,"data-slot":`input`,className:G(`la:flex la:h-9 la:w-full la:min-w-0 la:rounded-md la:border la:border-input la:bg-card la:px-3 la:py-1 la:text-sm la:text-foreground la:outline-none la:transition-colors la:placeholder:text-muted-foreground la:focus-visible:border-ring la:focus-visible:ring-2 la:focus-visible:ring-ring/20 la:disabled:cursor-not-allowed la:disabled:opacity-50 la:max-md:min-h-11`,e),...n})}var Xd=[`top`,`right`,`bottom`,`left`],Zd=Math.min,Qd=Math.max,$d=Math.round,ef=Math.floor,tf=e=>({x:e,y:e}),nf={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function rf(e,t,n){return Qd(e,Zd(t,n))}function af(e,t){return typeof e==`function`?e(t):e}function of(e){return e.split(`-`)[0]}function sf(e){return e.split(`-`)[1]}function cf(e){return e===`x`?`y`:`x`}function lf(e){return e===`y`?`height`:`width`}function uf(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function df(e){return cf(uf(e))}function ff(e,t,n){n===void 0&&(n=!1);let r=sf(e),i=df(e),a=lf(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=xf(o)),[o,xf(o)]}function pf(e){let t=xf(e);return[mf(e),t,mf(t)]}function mf(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var hf=[`left`,`right`],gf=[`right`,`left`],_f=[`top`,`bottom`],vf=[`bottom`,`top`];function yf(e,t,n){switch(e){case`top`:case`bottom`:return n?t?gf:hf:t?hf:gf;case`left`:case`right`:return t?_f:vf;default:return[]}}function bf(e,t,n,r){let i=sf(e),a=yf(of(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(mf)))),a}function xf(e){let t=of(e);return nf[t]+e.slice(t.length)}function Sf(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Cf(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Sf(e)}function wf(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Tf(e,t,n){let{reference:r,floating:i}=e,a=uf(t),o=df(t),s=lf(o),c=of(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=sf(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Ef(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=af(t,e),p=Cf(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=wf(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=wf(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Df=50,Of=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Ef},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Tf(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<Df&&(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}=Tf(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},kf=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:u=0}=af(e,t)||{};if(l==null)return{};let d=Cf(u),f={x:n,y:r},p=df(i),m=lf(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Zd(d[_],T),D=Zd(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=rf(E,k,O),j=!c.arrow&&sf(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),Af=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}=af(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=of(r),_=uf(o),v=of(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[xf(o)]:pf(o)),x=p!==`none`;!d&&x&&b.push(...bf(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=ff(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===uf(t)||T.every(e=>uf(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.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=T.filter(e=>{if(x){let t=uf(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}if(r!==n)return{reset:{placement:n}}}return{}}}};function jf(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Mf(e){return Xd.some(t=>e[t]>=0)}var Nf=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=af(e,t);switch(i){case`referenceHidden`:{let e=jf(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Mf(e)}}}case`escaped`:{let e=jf(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Mf(e)}}}default:return{}}}}},Pf=new Set([`left`,`top`]);async function Ff(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=of(n),s=sf(n),c=uf(n)===`y`,l=Pf.has(o)?-1:1,u=a&&c?-1:1,d=af(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var If=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 Ff(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}}}}},Lf=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}=af(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=uf(i),p=cf(f),m=u[p],h=u[f],g=(e,t)=>rf(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Rf=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}=af(e,t),u={x:n,y:r},d=uf(i),f=cf(d),p=u[f],m=u[d],h=af(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};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=Pf.has(of(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}}}},zf=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=af(e,t),c=await i.detectOverflow(t,s),l=of(n),u=sf(n),d=uf(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=Zd(p-c[m],g),y=Zd(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*Qd(c.left,c.right):S=p-2*Qd(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Bf(){return typeof window<`u`}function Vf(e){return X(e)?(e.nodeName||``).toLowerCase():`#document`}function Hf(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Uf(e){return((X(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function X(e){return Bf()?e instanceof Node||e instanceof Hf(e).Node:!1}function Wf(e){return Bf()?e instanceof Element||e instanceof Hf(e).Element:!1}function Gf(e){return Bf()?e instanceof HTMLElement||e instanceof Hf(e).HTMLElement:!1}function Kf(e){return!Bf()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Hf(e).ShadowRoot}function qf(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=rp(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Jf(e){return/^(table|td|th)$/.test(Vf(e))}function Yf(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Xf=/transform|translate|scale|rotate|perspective|filter/,Zf=/paint|layout|strict|content/,Qf=e=>!!e&&e!==`none`,$f;function ep(e){let t=Wf(e)?rp(e):e;return Qf(t.transform)||Qf(t.translate)||Qf(t.scale)||Qf(t.rotate)||Qf(t.perspective)||!np()&&(Qf(t.backdropFilter)||Qf(t.filter))||Xf.test(t.willChange||``)||Zf.test(t.contain||``)}function tp(e){let t=ap(e);for(;Gf(t)&&!Z(t);){if(ep(t))return t;if(Yf(t))return null;t=ap(t)}return null}function np(){return $f??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),$f}function Z(e){return/^(html|body|#document)$/.test(Vf(e))}function rp(e){return Hf(e).getComputedStyle(e)}function ip(e){return Wf(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ap(e){if(Vf(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Kf(e)&&e.host||Uf(e);return Kf(t)?t.host:t}function op(e){let t=ap(e);return Z(t)?(e.ownerDocument||e).body:Gf(t)&&qf(t)?t:op(t)}function sp(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=op(e),i=r===e.ownerDocument?.body,a=Hf(r);if(i){let e=cp(a);return t.concat(a,a.visualViewport||[],qf(r)?r:[],e&&n?sp(e):[])}return t.concat(r,sp(r,[],n))}function cp(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function lp(e){let t=rp(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Gf(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=$d(n)!==a||$d(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function up(e){return Wf(e)?e:e.contextElement}function dp(e){let t=up(e);if(!Gf(t))return tf(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=lp(t),o=(a?$d(n.width):n.width)/r,s=(a?$d(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var fp=tf(0);function pp(e){let t=Hf(e);return!np()||!t.visualViewport?fp:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function mp(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Hf(e)}function hp(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=up(e),o=tf(1);t&&(r?Wf(r)&&(o=dp(r)):o=dp(e));let s=mp(a,n,r)?pp(a):tf(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Hf(a),t=Wf(r)?Hf(r):r,n=e,i=cp(n);for(;i&&t!==n;){let e=dp(i),t=i.getBoundingClientRect(),r=rp(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Hf(i),i=cp(n)}}return wf({width:u,height:d,x:c,y:l})}function gp(e,t){let n=ip(e).scrollLeft;return t?t.left+n:hp(Uf(e)).left+n}function _p(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-gp(e,n),y:n.top+t.scrollTop}}function vp(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Uf(r),s=t?Yf(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=tf(1),u=tf(0),d=Gf(r);if((d||!a)&&((Vf(r)!==`body`||qf(o))&&(c=ip(r)),d)){let e=hp(r);l=dp(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?_p(o,c):tf(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 yp(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function bp(e){let t=ip(e),n=e.ownerDocument.body,r=Qd(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Qd(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+gp(e),o=-t.scrollTop;return rp(n).direction===`rtl`&&(a+=Qd(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var xp=25;function Sp(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Hf(e),a=Uf(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!np()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(gp(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=xp&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Cp(e,t){let n=hp(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=dp(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function wp(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Sp(e,n,t);else if(t===`document`)r=bp(Uf(e));else if(Wf(t))r=Cp(t,n);else{let n=pp(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return wf(r)}function Tp(e,t){let n=t.get(e);if(n)return n;let r=sp(e,[],!1).filter(e=>Wf(e)&&Vf(e)!==`body`),i=null,a=rp(e).position===`fixed`,o=a?ap(e):e;for(;Wf(o)&&!Z(o);){let e=rp(o),t=ep(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=ap(o)}return t.set(e,r),r}function Ep(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Yf(t)?[]:Tp(t,this._c):[].concat(n),r],o=wp(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=wp(t,a[e],i);s=Qd(n.top,s),c=Zd(n.right,c),l=Zd(n.bottom,l),u=Qd(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Dp(e){let{width:t,height:n}=lp(e);return{width:t,height:n}}function Op(e,t,n){let r=Gf(t),i=Uf(t),a=n===`fixed`,o=hp(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=tf(0);if((r||!a)&&((Vf(t)!==`body`||qf(i))&&(s=ip(t)),r)){let e=hp(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=gp(i));let l=i&&!r&&!a?_p(i,s):tf(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function kp(e){return rp(e).position===`static`}function Ap(e,t){if(!Gf(e)||rp(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Uf(e)===n&&(n=n.ownerDocument.body),n}function jp(e,t){let n=Hf(e);if(Yf(e))return n;if(!Gf(e)){let t=ap(e);for(;t&&!Z(t);){if(Wf(t)&&!kp(t))return t;t=ap(t)}return n}let r=Ap(e,t);for(;r&&Jf(r)&&kp(r);)r=Ap(r,t);return r&&Z(r)&&kp(r)&&!ep(r)?n:r||tp(e)||n}var Mp=async function(e){let t=this.getOffsetParent||jp,n=this.getDimensions,r=await n(e.floating);return{reference:Op(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Np(e){return rp(e).direction===`rtl`}var Pp={convertOffsetParentRelativeRectToViewportRelativeRect:vp,getDocumentElement:Uf,getClippingRect:Ep,getOffsetParent:jp,getElementRects:Mp,getClientRects:yp,getDimensions:Dp,getScale:dp,isElement:Wf,isRTL:Np};function Fp(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ip(e,t,n){let r=null,i,a=Uf(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=ef(d),h=ef(a.clientWidth-(u+f)),g=ef(a.clientHeight-(d+p)),_=ef(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Qd(0,Zd(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Fp(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Hf(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Lp(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=up(e),u=i||a?[...l?sp(l):[],...t?sp(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Ip(l,n,a):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?hp(e):null;c&&g();function g(){let t=hp(e);h&&!Fp(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 Rp=If,zp=Lf,Bp=Af,Vp=zf,Hp=Nf,Up=kf,Wp=Rf,Gp=(e,t,n)=>{let r=new Map,i=n??{},a={...Pp,...i.platform,_c:r};return Of(e,t,{...i,platform:a})},Kp=typeof document<`u`?O.useLayoutEffect:function(){};function qp(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(!qp(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)&&!qp(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Jp(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Yp(e,t){let n=Jp(e);return Math.round(t*n)/n}function Xp(e){let t=O.useRef(e);return Kp(()=>{t.current=e}),t}function Zp(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]=O.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=O.useState(r);qp(f,r)||p(r);let[m,h]=O.useState(null),[g,_]=O.useState(null),v=O.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=O.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=O.useRef(null),C=O.useRef(null),w=O.useRef(u),T=c!=null,E=Xp(c),D=Xp(i),k=Xp(l),A=O.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Gp(S.current,C.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!qp(w.current,t)&&(w.current=t,Gt.flushSync(()=>{d(t)}))})},[f,t,n,D,k]);Kp(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=O.useRef(!1);Kp(()=>(j.current=!0,()=>{j.current=!1}),[]),Kp(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,A);A()}},[b,x,A,E,T]);let M=O.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),N=O.useMemo(()=>({reference:b,floating:x}),[b,x]),ee=O.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=Yp(N.floating,u.x),r=Yp(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Jp(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return O.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:ee}),[u,A,M,N,ee])}var Qp=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Up({element:r.current,padding:i}).fn(n):r?Up({element:r,padding:i}).fn(n):{}}}},$p=(e,t)=>{let n=Rp(e);return{name:n.name,fn:n.fn,options:[e,t]}},em=(e,t)=>{let n=zp(e);return{name:n.name,fn:n.fn,options:[e,t]}},tm=(e,t)=>({fn:Wp(e).fn,options:[e,t]}),nm=(e,t)=>{let n=Bp(e);return{name:n.name,fn:n.fn,options:[e,t]}},rm=(e,t)=>{let n=Vp(e);return{name:n.name,fn:n.fn,options:[e,t]}},im=(e,t)=>{let n=Hp(e);return{name:n.name,fn:n.fn,options:[e,t]}},am=(e,t)=>{let n=Qp(e);return{name:n.name,fn:n.fn,options:[e,t]}},om=Object.defineProperty,sm=(e,t)=>om(e,`name`,{value:t,configurable:!0});function cm(e){let[t,n]=O.useState(void 0);return Et(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}sm(cm,`useSize`);var lm=Object.defineProperty,um=(e,t)=>lm(e,`name`,{value:t,configurable:!0}),dm=`Popper`,[fm,pm]=wt(dm),[mm,hm]=fm(dm),gm=um(e=>{let{__scopePopper:t,children:n}=e,[r,i]=O.useState(null),[a,o]=O.useState(void 0);return(0,R.jsx)(mm,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),_m=`PopperAnchor`,vm=O.forwardRef(um(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=hm(_m,n),o=O.useRef(null),s=a.onAnchorChange,c=bt(t,O.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=O.useRef(null);O.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&Tm(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,R.jsx)(un.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),ym=`PopperContent`,[bm,xm]=fm(ym),Sm=O.forwardRef(um(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=hm(ym,n),[_,v]=O.useState(null),y=bt(t,v),[b,x]=O.useState(null),S=cm(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],k=D.length>0,A={padding:E,boundary:D.filter(Cm),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:ee,middlewareData:te}=Zp({strategy:`fixed`,placement:T,whileElementsMounted:um((...e)=>Lp(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:g.anchor},middleware:[$p({mainAxis:i+w,alignmentAxis:o}),c&&em({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?tm():void 0,...A}),c&&nm({...A}),rm({...A,apply:um(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),b&&am({element:b,padding:s}),wm({arrowWidth:C,arrowHeight:w}),f&&im({strategy:`referenceHidden`,...A,boundary:k?A.boundary:void 0})]}),P=g.setPlacementState;Et(()=>(P(N),()=>{P(void 0)}),[N,P]);let[ne,re]=Tm(N),ie=mn(m);Et(()=>{ee&&ie?.()},[ee,ie]);let ae=te.arrow?.x,oe=te.arrow?.y,se=te.arrow?.centerOffset!==0,[ce,le]=O.useState();return Et(()=>{_&&le(window.getComputedStyle(_).zIndex)},[_]),(0,R.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:ee?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ce,"--radix-popper-transform-origin":[te.transformOrigin?.x,te.transformOrigin?.y].join(` `),...te.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,R.jsx)(bm,{scope:n,placedSide:ne,placedAlign:re,onArrowChange:x,arrowX:ae,arrowY:oe,shouldHideArrow:se,children:(0,R.jsx)(un.div,{"data-side":ne,"data-align":re,...h,ref:y,style:{...h.style,animation:ee?h.style?.animation:`none`}})})})},`PopperContent`));function Cm(e){return e!==null}um(Cm,`isNotNull`);var wm=um(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Tm(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function Tm(e){let[t,n=`center`]=e.split(`-`);return[t,n]}um(Tm,`getSideAndAlignFromPlacement`);var Em=gm,Dm=vm,Om=Sm,km=Object.defineProperty,Am=(e,t)=>km(e,`name`,{value:t,configurable:!0}),jm=`Popover`,[Mm,Nm]=wt(jm,[pm]),Pm=pm(),[Fm,Im]=Mm(jm),Lm=Am(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Pm(t),c=O.useRef(null),[l,u]=O.useState(!1),[d,f]=Bt({prop:r,defaultProp:i??!1,onChange:a,caller:jm});return(0,R.jsx)(Em,{...s,children:(0,R.jsx)(Fm,{scope:t,contentId:jt(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:O.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:O.useCallback(()=>u(!0),[]),onCustomAnchorRemove:O.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),Rm=`PopoverTrigger`,zm=O.forwardRef(Am(function(e,t){let{__scopePopover:n,...r}=e,i=Im(Rm,n),a=Pm(n),o=bt(t,i.triggerRef),s=(0,R.jsx)(un.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Xm(i.open),...r,ref:o,onClick:dt(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,R.jsx)(Dm,{asChild:!0,...a,children:s})},`PopoverTrigger`)),Bm=`PopoverPortal`,[Vm,Hm]=Mm(Bm,{forceMount:void 0}),Um=Am(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Im(Bm,t);return(0,R.jsx)(Vm,{scope:t,forceMount:n,children:(0,R.jsx)(Zn,{present:n||a.open,children:(0,R.jsx)(qn,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),Wm=`PopoverContent`,Gm=O.forwardRef(Am(function(e,t){let n=Hm(Wm,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Im(Wm,e.__scopePopover);return(0,R.jsx)(Zn,{present:r||a.open,children:a.modal?(0,R.jsx)(qm,{...i,ref:t}):(0,R.jsx)(Jm,{...i,ref:t})})},`PopoverContent`)),Km=qt(`PopoverContent.RemoveScroll`),qm=O.forwardRef(Am(function(e,t){let n=Im(Wm,e.__scopePopover),r=O.useRef(null),i=bt(t,r),a=O.useRef(!1);return O.useEffect(()=>{let e=r.current;if(e)return Ei(e)},[]),(0,R.jsx)(_i,{as:Km,allowPinchZoom:!0,children:(0,R.jsx)(Ym,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:dt(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:dt(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:dt(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),Jm=O.forwardRef(Am(function(e,t){let n=Im(Wm,e.__scopePopover),r=O.useRef(!1),i=O.useRef(!1);return(0,R.jsx)(Ym,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),Ym=O.forwardRef(Am(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=Im(Wm,n),p=Pm(n);return cr(),(0,R.jsx)(Pn,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,R.jsx)(Sn,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,R.jsx)(Om,{"data-state":Xm(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})},`PopoverContentImpl`));function Xm(e){return e?`open`:`closed`}Am(Xm,`getState`);var Zm=Lm,Qm=zm,$m=Um,eh=Gm;function th({...e}){return(0,R.jsx)(Zm,{"data-slot":`popover`,...e})}function nh({...e}){return(0,R.jsx)(Qm,{"data-slot":`popover-trigger`,...e})}function rh({className:e,align:t=`center`,sideOffset:n=4,...r}){return(0,R.jsx)($m,{children:(0,R.jsx)(eh,{"data-slot":`popover-content`,align:t,sideOffset:n,className:G(`la:z-50 la:w-72 la:origin-(--radix-popover-content-transform-origin) la:rounded-md la:border la:bg-popover la:p-4 la:text-popover-foreground la:shadow-md la:outline-hidden`,e),...r})})}var ih=[{minutes:5,label:`Last 5 minutes`},{minutes:15,label:`Last 15 minutes`},{minutes:60,label:`Last hour`},{minutes:360,label:`Last 6 hours`},{minutes:1440,label:`Last 24 hours`},{minutes:10080,label:`Last 7 days`}],ah={kind:`relative`,minutes:60};function oh(e,t){switch(e.kind){case`relative`:return{fromMs:Math.floor((t-e.minutes*6e4)/6e4)*6e4};case`absolute`:return{fromMs:e.fromMs,toMs:e.toMs};case`all`:return{}}}function sh(e){switch(e.kind){case`relative`:return ih.find(t=>t.minutes===e.minutes)?.label??`Last ${e.minutes} minutes`;case`absolute`:return`${uh(e.fromMs,e.toMs)} – ${uh(e.toMs,e.fromMs)}`;case`all`:return`All retained`}}function ch(e){switch(e.kind){case`relative`:return`in the ${sh(e).toLocaleLowerCase()}`;case`absolute`:return`between ${sh(e)}`;case`all`:return`in retained history`}}function lh(e,t){return e.kind===t.kind&&(e.kind!==`relative`||e.minutes===t.minutes)&&(e.kind!==`absolute`||e.fromMs===t.fromMs&&e.toMs===t.toMs)}function uh(e,t){let n=new Date(e),r=n.toDateString()===new Date(t).toDateString(),i=n.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hour12:!1});return r&&e>t?i:`${n.toLocaleDateString([],{month:`short`,day:`numeric`})} ${i}`}function dh({value:e,onChange:t,allowAll:n=!0,className:r,align:i=`end`}){let[a,o]=(0,O.useState)(!1),[s,c]=(0,O.useState)(()=>ph(e)),[l,u]=(0,O.useState)(!1),d=e=>{t(e),o(!1)};return(0,R.jsxs)(th,{open:a,onOpenChange:t=>{t&&(c(ph(e)),u(!1)),o(t)},children:[(0,R.jsx)(nh,{asChild:!0,children:(0,R.jsxs)(K,{type:`button`,variant:`outline`,className:r,"aria-label":`Time range: ${sh(e)}`,children:[(0,R.jsx)(se,{"aria-hidden":`true`}),(0,R.jsx)(`span`,{className:`la:truncate la:tabular-nums`,children:sh(e)}),(0,R.jsx)(de,{"aria-hidden":`true`,className:`la:text-muted-foreground`})]})}),(0,R.jsxs)(rh,{align:i,"aria-label":`Time range`,className:`la:flex la:w-auto la:p-0 la:text-sm`,children:[(0,R.jsxs)(`div`,{className:`la:flex la:flex-col la:gap-0.5 la:border-r la:p-2`,role:`group`,"aria-label":`Preset ranges`,children:[ih.map(t=>(0,R.jsx)(fh,{label:t.label,selected:lh(e,{kind:`relative`,minutes:t.minutes}),onSelect:()=>d({kind:`relative`,minutes:t.minutes})},t.minutes)),n&&(0,R.jsx)(fh,{label:`All retained`,selected:e.kind===`all`,onSelect:()=>d({kind:`all`})})]}),(0,R.jsxs)(`form`,{className:`la:flex la:w-[22rem] la:flex-col`,"aria-label":`Custom range`,onSubmit:e=>{e.preventDefault();let t=mh(s);if(!t){u(!0);return}u(!1),d(t)},children:[(0,R.jsx)(qd,{mode:`range`,numberOfMonths:1,defaultMonth:s.dates?.to??s.dates?.from,selected:s.dates,onSelect:e=>c(t=>({...t,dates:e})),disabled:{after:new Date}}),(0,R.jsxs)(`div`,{className:`la:flex la:items-end la:gap-2 la:border-t la:px-3 la:py-3`,children:[(0,R.jsxs)(`label`,{className:`la:grid la:gap-1 la:text-xs la:text-muted-foreground`,children:[`From`,(0,R.jsx)(Yd,{type:`time`,name:`from`,required:!0,className:`la:h-8 la:w-24 la:tabular-nums`,value:s.fromTime,onChange:e=>c({...s,fromTime:e.target.value}),"aria-invalid":l||void 0})]}),(0,R.jsxs)(`label`,{className:`la:grid la:gap-1 la:text-xs la:text-muted-foreground`,children:[`To`,(0,R.jsx)(Yd,{type:`time`,name:`to`,required:!0,className:`la:h-8 la:w-24 la:tabular-nums`,value:s.toTime,onChange:e=>c({...s,toTime:e.target.value}),"aria-invalid":l||void 0})]}),(0,R.jsx)(K,{type:`submit`,variant:`outline`,size:`sm`,className:`la:ml-auto`,disabled:!s.dates?.from,children:`Apply range`})]}),l&&(0,R.jsx)(`p`,{className:`la:px-3 la:pb-3 la:text-xs la:text-danger`,role:`alert`,children:`From must be before To.`})]})]})]})}function fh({label:e,selected:t,onSelect:n}){return(0,R.jsx)(K,{type:`button`,variant:t?`secondary`:`ghost`,size:`sm`,className:`la:justify-start la:font-normal la:aria-pressed:font-semibold`,"aria-pressed":t,onClick:n,children:e})}function ph(e){let t=Date.now(),n=oh(e,t),r=new Date(n.fromMs??t-36e5),i=new Date(n.toMs??t);return{dates:{from:hh(r),to:hh(i)},fromTime:gh(r),toTime:gh(i)}}function mh(e){let t=e.dates?.from,n=e.dates?.to??t;if(!t||!n)return null;let r=_h(t,e.fromTime),i=_h(n,e.toTime);return Number.isFinite(r)&&Number.isFinite(i)&&r<i?{kind:`absolute`,fromMs:r,toMs:i}:null}function hh(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function gh(e){return`${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}`}function _h(e,t){let[n,r]=t.split(`:`).map(Number);return new Date(e.getFullYear(),e.getMonth(),e.getDate(),n??0,r??0).getTime()}var vh=ws(`la:inline-flex la:items-center la:justify-center la:gap-1.5 la:rounded-md la:border la:px-2 la:py-0.5 la:text-xs la:font-medium la:whitespace-nowrap`,{variants:{variant:{default:`la:border-transparent la:bg-muted la:text-muted-foreground`,outline:`la:border-border la:text-muted-foreground`}},defaultVariants:{variant:`default`}});function yh({className:e,variant:t,...n}){return(0,R.jsx)(`span`,{"data-slot":`badge`,className:G(vh({variant:t}),e),...n})}function bh(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var xh=O.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:`bottom`,shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),Sh=()=>{let e=O.useContext(xh);if(!e)throw Error(`useDrawerContext must be used within a Drawer.Root`);return e};bh(`[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(
50
50
  [data-state=closed]
51
- ){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function Ch(){let e=navigator.userAgent;return typeof window<`u`&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function wh(){return kh(/^Mac/)}function Th(){return kh(/^iPhone/)}function Eh(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Dh(){return kh(/^iPad/)||wh()&&navigator.maxTouchPoints>1}function Oh(){return Th()||Dh()}function kh(e){return typeof window<`u`&&window.navigator!=null?e.test(window.navigator.platform):void 0}var Ah=24,jh=typeof window<`u`?O.useLayoutEffect:O.useEffect;function Mh(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}var Nh=typeof document<`u`&&window.visualViewport;function Ph(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function Fh(e){for(Ph(e)&&(e=e.parentElement);e&&!Ph(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}var Ih=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]),Lh=0,Rh;function zh(e={}){let{isDisabled:t}=e;jh(()=>{if(!t)return Lh++,Lh===1&&Oh()&&(Rh=Bh()),()=>{Lh--,Lh===0&&Rh?.()}},[t])}function Bh(){let e,t=0,n=n=>{e=Fh(n.target),(e!==document.documentElement||e!==document.body)&&(t=n.changedTouches[0].pageY)},r=n=>{if(!e||e===document.documentElement||e===document.body){n.preventDefault();return}let r=n.changedTouches[0].pageY,i=e.scrollTop,a=e.scrollHeight-e.clientHeight;a!==0&&((i<=0&&r>t||i>=a&&r<t)&&n.preventDefault(),t=r)},i=e=>{let t=e.target;Wh(t)&&t!==document.activeElement&&(e.preventDefault(),t.style.transform=`translateY(-2000px)`,t.focus(),requestAnimationFrame(()=>{t.style.transform=``}))},a=e=>{let t=e.target;Wh(t)&&(t.style.transform=`translateY(-2000px)`,requestAnimationFrame(()=>{t.style.transform=``,Nh&&(Nh.height<window.innerHeight?requestAnimationFrame(()=>{Uh(t)}):Nh.addEventListener(`resize`,()=>Uh(t),{once:!0}))}))},o=()=>{window.scrollTo(0,0)},s=window.pageXOffset,c=window.pageYOffset,l=Mh(Vh(document.documentElement,`paddingRight`,`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let u=Mh(Hh(document,`touchstart`,n,{passive:!1,capture:!0}),Hh(document,`touchmove`,r,{passive:!1,capture:!0}),Hh(document,`touchend`,i,{passive:!1,capture:!0}),Hh(document,`focus`,a,!0),Hh(window,`scroll`,o));return()=>{l(),u(),window.scrollTo(s,c)}}function Vh(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function Hh(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Uh(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let t=Fh(e);if(t!==document.documentElement&&t!==document.body&&t!==e){let n=t.getBoundingClientRect().top,r=e.getBoundingClientRect().top;e.getBoundingClientRect().bottom>t.getBoundingClientRect().bottom+Ah&&(t.scrollTop+=r-n)}e=t.parentElement}}function Wh(e){return e instanceof HTMLInputElement&&!Ih.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function Gh(e,t){typeof e==`function`?e(t):e!=null&&(e.current=t)}function Kh(...e){return t=>e.forEach(e=>Gh(e,t))}function qh(...e){return O.useCallback(Kh(...e),e)}var Jh=new WeakMap;function Yh(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([t,n])=>{if(t.startsWith(`--`)){e.style.setProperty(t,n);return}r[t]=e.style[t],e.style[t]=n}),!n&&Jh.set(e,r)}function Xh(e,t){if(!e||!(e instanceof HTMLElement))return;let n=Jh.get(e);n&&(e.style[t]=n[t])}var Zh=e=>{switch(e){case`top`:case`bottom`:return!0;case`left`:case`right`:return!1;default:return e}};function Qh(e,t){if(!e)return null;let n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform,i=r.match(/^matrix3d\((.+)\)$/);return i?parseFloat(i[1].split(`, `)[Zh(t)?13:12]):(i=r.match(/^matrix\((.+)\)$/),i?parseFloat(i[1].split(`, `)[Zh(t)?5:4]):null)}function $h(e){return 8*(Math.log(e+1)-2)}function eg(e,t){if(!e)return()=>{};let n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}var tg={DURATION:.5,EASE:[.32,.72,0,1]},ng=.4,rg=.25,ig=100,ag=8,og=16,sg=26,cg=`vaul-dragging`;function lg(e){let t=O.useRef(e);return O.useEffect(()=>{t.current=e}),O.useMemo(()=>(...e)=>t.current==null?void 0:t.current.call(t,...e),[])}function ug({defaultProp:e,onChange:t}){let n=O.useState(e),[r]=n,i=O.useRef(r),a=lg(t);return O.useEffect(()=>{i.current!==r&&(a(r),i.current=r)},[r,i,a]),n}function dg({prop:e,defaultProp:t,onChange:n=()=>{}}){let[r,i]=ug({defaultProp:t,onChange:n}),a=e!==void 0,o=a?e:r,s=lg(n);return[o,O.useCallback(t=>{if(a){let n=typeof t==`function`?t(e):t;n!==e&&s(n)}else i(t)},[a,e,i,s])]}function fg({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:r,overlayRef:i,fadeFromIndex:a,onSnapPointChange:o,direction:s=`bottom`,container:c,snapToSequentialPoint:l}){let[u,d]=dg({prop:e,defaultProp:n?.[0],onChange:t}),[f,p]=O.useState(typeof window<`u`?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);O.useEffect(()=>{function e(){p({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let m=O.useMemo(()=>u===n?.[n.length-1]||null,[n,u]),h=O.useMemo(()=>n?.findIndex(e=>e===u)??null,[n,u]),g=n&&n.length>0&&(a||a===0)&&!Number.isNaN(a)&&n[a]===u||!n,_=O.useMemo(()=>{let e=c?{width:c.getBoundingClientRect().width,height:c.getBoundingClientRect().height}:typeof window<`u`?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};return n?.map(t=>{let n=typeof t==`string`,r=0;if(n&&(r=parseInt(t,10)),Zh(s)){let i=n?r:f?t*e.height:0;return f?s===`bottom`?e.height-i:-e.height+i:i}let i=n?r:f?t*e.width:0;return f?s===`right`?e.width-i:-e.width+i:i})??[]},[n,f,c]),v=O.useMemo(()=>h===null?null:_?.[h],[_,h]),y=O.useCallback(e=>{let t=_?.findIndex(t=>t===e)??null;o(t),Yh(r.current,{transition:`transform ${tg.DURATION}s cubic-bezier(${tg.EASE.join(`,`)})`,transform:Zh(s)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`}),_&&t!==_.length-1&&a!==void 0&&t!==a&&t<a?Yh(i.current,{transition:`opacity ${tg.DURATION}s cubic-bezier(${tg.EASE.join(`,`)})`,opacity:`0`}):Yh(i.current,{transition:`opacity ${tg.DURATION}s cubic-bezier(${tg.EASE.join(`,`)})`,opacity:`1`}),d(n?.[Math.max(t,0)])},[r.current,n,_,a,i,d]);O.useEffect(()=>{if(u||e){let t=n?.findIndex(t=>t===e||t===u)??-1;_&&t!==-1&&typeof _[t]==`number`&&y(_[t])}},[u,e,n,_,y]);function b({draggedDistance:e,closeDrawer:t,velocity:r,dismissible:o}){if(a===void 0)return;let c=s===`bottom`||s===`right`?(v??0)-e:(v??0)+e,u=h===a-1,d=h===0,f=e>0;if(u&&Yh(i.current,{transition:`opacity ${tg.DURATION}s cubic-bezier(${tg.EASE.join(`,`)})`}),!l&&r>2&&!f){o?t():y(_[0]);return}if(!l&&r>2&&f&&_&&n){y(_[n.length-1]);return}let p=_?.reduce((e,t)=>typeof e!=`number`||typeof t!=`number`?e:Math.abs(t-c)<Math.abs(e-c)?t:e),g=Zh(s)?window.innerHeight:window.innerWidth;if(r>ng&&Math.abs(e)<g*.4){let e=f?1:-1;if(e>0&&m&&n){y(_[n.length-1]);return}if(d&&e<0&&o&&t(),h===null)return;y(_[h+e]);return}y(p)}function x({draggedDistance:e}){if(v===null)return;let t=s===`bottom`||s===`right`?v-e:v+e;(s===`bottom`||s===`right`)&&t<_[_.length-1]||(s===`top`||s===`left`)&&t>_[_.length-1]||Yh(r.current,{transform:Zh(s)?`translate3d(0, ${t}px, 0)`:`translate3d(${t}px, 0, 0)`})}function S(e,t){if(!n||typeof h!=`number`||!_||a===void 0)return null;let r=h===a-1;if(h>=a&&t)return 0;if(r&&!t)return 1;if(!g&&!r)return null;let i=r?h+1:h-1,o=r?_[i]-_[i-1]:_[i+1]-_[i],s=e/Math.abs(o);return r?1-s:s}return{isLastSnapPoint:m,activeSnapPoint:u,shouldFade:g,getPercentageDragged:S,setActiveSnapPoint:d,activeSnapPointIndex:h,onRelease:b,onDrag:x,snapPointsOffset:_}}function pg(){let{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:i}=Sh(),a=O.useRef(null),o=(0,O.useMemo)(()=>document.body.style.backgroundColor,[]);function s(){return(window.innerWidth-sg)/window.innerWidth}O.useEffect(()=>{if(t&&n){a.current&&clearTimeout(a.current);let t=document.querySelector(`[data-vaul-drawer-wrapper]`)||document.querySelector(`[vaul-drawer-wrapper]`);if(!t)return;r&&!i&&eg(document.body,{background:`black`}),eg(t,{transformOrigin:Zh(e)?`top`:`left`,transitionProperty:`transform, border-radius`,transitionDuration:`${tg.DURATION}s`,transitionTimingFunction:`cubic-bezier(${tg.EASE.join(`,`)})`});let n=eg(t,{borderRadius:`${ag}px`,overflow:`hidden`,...Zh(e)?{transform:`scale(${s()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${s()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{n(),a.current=window.setTimeout(()=>{o?document.body.style.background=o:document.body.style.removeProperty(`background`)},tg.DURATION*1e3)}}},[t,n,o])}var mg=null;function hg({isOpen:e,modal:t,nested:n,hasBeenOpened:r,preventScrollRestoration:i,noBodyStyles:a}){let[o,s]=O.useState(()=>typeof window<`u`?window.location.href:``),c=O.useRef(0),l=O.useCallback(()=>{if(Eh()&&mg===null&&e&&!a){mg={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:`unset`};let{scrollX:e,innerHeight:t}=window;document.body.style.setProperty(`position`,`fixed`,`important`),Object.assign(document.body.style,{top:`${-c.current}px`,left:`${-e}px`,right:`0px`,height:`auto`}),window.setTimeout(()=>window.requestAnimationFrame(()=>{let e=t-window.innerHeight;e&&c.current>=t&&(document.body.style.top=`${-(c.current+e)}px`)}),300)}},[e]),u=O.useCallback(()=>{if(Eh()&&mg!==null&&!a){let e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);Object.assign(document.body.style,mg),window.requestAnimationFrame(()=>{if(i&&o!==window.location.href){s(window.location.href);return}window.scrollTo(t,e)}),mg=null}},[o]);return O.useEffect(()=>{function e(){c.current=window.scrollY}return e(),window.addEventListener(`scroll`,e),()=>{window.removeEventListener(`scroll`,e)}},[]),O.useEffect(()=>{if(t)return()=>{typeof document>`u`||document.querySelector(`[data-vaul-drawer]`)||u()}},[t,u]),O.useEffect(()=>{!n&&r&&(e?(!window.matchMedia(`(display-mode: standalone)`).matches&&l(),t||window.setTimeout(()=>{u()},500)):u())},[e,r,o,t,n,l,u]),{restorePositionSetting:u}}function gg({open:e,onOpenChange:t,children:n,onDrag:r,onRelease:i,snapPoints:a,shouldScaleBackground:o=!1,setBackgroundColorOnScale:s=!0,closeThreshold:c=rg,scrollLockTimeout:l=ig,dismissible:u=!0,handleOnly:d=!1,fadeFromIndex:f=a&&a.length-1,activeSnapPoint:p,setActiveSnapPoint:m,fixed:h,modal:g=!0,onClose:_,nested:v,noBodyStyles:y=!1,direction:b=`bottom`,defaultOpen:x=!1,disablePreventScroll:S=!0,snapToSequentialPoint:C=!1,preventScrollRestoration:w=!1,repositionInputs:T=!0,onAnimationEnd:E,container:D,autoFocus:k=!1}){let[A=!1,j]=dg({defaultProp:x,prop:e,onChange:e=>{t?.(e),!e&&!v&&Ce(),setTimeout(()=>{E?.(e)},tg.DURATION*1e3),e&&!g&&typeof window<`u`&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents=`auto`}),e||(document.body.style.pointerEvents=`auto`)}}),[M,N]=O.useState(!1),[ee,te]=O.useState(!1),[P,ne]=O.useState(!1),re=O.useRef(null),ie=O.useRef(null),ae=O.useRef(null),oe=O.useRef(null),se=O.useRef(null),ce=O.useRef(!1),le=O.useRef(null),ue=O.useRef(0),de=O.useRef(!1),fe=O.useRef(!x),pe=O.useRef(0),F=O.useRef(null),me=O.useRef(F.current?.getBoundingClientRect().height||0),I=O.useRef(F.current?.getBoundingClientRect().width||0),L=O.useRef(0),{activeSnapPoint:he,activeSnapPointIndex:ge,setActiveSnapPoint:_e,onRelease:ve,snapPointsOffset:ye,onDrag:be,shouldFade:xe,getPercentageDragged:Se}=fg({snapPoints:a,activeSnapPointProp:p,setActiveSnapPointProp:m,drawerRef:F,fadeFromIndex:f,overlayRef:re,onSnapPointChange:O.useCallback(e=>{a&&e===ye.length-1&&(ie.current=new Date)},[]),direction:b,container:D,snapToSequentialPoint:C});zh({isDisabled:!A||ee||!g||P||!M||!T||!S});let{restorePositionSetting:Ce}=hg({isOpen:A,modal:g,nested:v??!1,hasBeenOpened:M,preventScrollRestoration:w,noBodyStyles:y});function we(){return(window.innerWidth-sg)/window.innerWidth}function Te(e){(u||a)&&(!F.current||F.current.contains(e.target))&&(me.current=F.current?.getBoundingClientRect().height||0,I.current=F.current?.getBoundingClientRect().width||0,te(!0),ae.current=new Date,Oh()&&window.addEventListener(`touchend`,()=>ce.current=!1,{once:!0}),e.target.setPointerCapture(e.pointerId),ue.current=Zh(b)?e.pageY:e.pageX)}function Ee(e,t){let n=e,r=window.getSelection()?.toString(),i=F.current?Qh(F.current,b):null,a=new Date;if(n.tagName===`SELECT`||n.hasAttribute(`data-vaul-no-drag`)||n.closest(`[data-vaul-no-drag]`))return!1;if(b===`right`||b===`left`)return!0;if(ie.current&&a.getTime()-ie.current.getTime()<500)return!1;if(i!==null&&(b===`bottom`?i>0:i<0))return!0;if(r&&r.length>0)return!1;if(se.current&&a.getTime()-se.current.getTime()<l&&i===0||t)return se.current=a,!1;for(;n;){if(n.scrollHeight>n.clientHeight){if(n.scrollTop!==0)return se.current=new Date,!1;if(n.getAttribute(`role`)===`dialog`)return!0}n=n.parentNode}return!0}function De(e){if(F.current&&ee){let t=b===`bottom`||b===`right`?1:-1,n=(ue.current-(Zh(b)?e.pageY:e.pageX))*t,i=n>0,s=a&&!u&&!i;if(s&&ge===0)return;let c=Math.abs(n),l=document.querySelector(`[data-vaul-drawer-wrapper]`),d=c/(b===`bottom`||b===`top`?me.current:I.current),p=Se(c,i);if(p!==null&&(d=p),s&&d>=1||!ce.current&&!Ee(e.target,i))return;if(F.current.classList.add(cg),ce.current=!0,Yh(F.current,{transition:`none`}),Yh(re.current,{transition:`none`}),a&&be({draggedDistance:n}),i&&!a){let e=$h(n),r=Math.min(e*-1,0)*t;Yh(F.current,{transform:Zh(b)?`translate3d(0, ${r}px, 0)`:`translate3d(${r}px, 0, 0)`});return}let m=1-d;if((xe||f&&ge===f-1)&&(r?.(e,d),Yh(re.current,{opacity:`${m}`,transition:`none`},!0)),l&&re.current&&o){let e=Math.min(we()+d*(1-we()),1),t=8-d*8,n=Math.max(0,14-d*14);Yh(l,{borderRadius:`${t}px`,transform:Zh(b)?`scale(${e}) translate3d(0, ${n}px, 0)`:`scale(${e}) translate3d(${n}px, 0, 0)`,transition:`none`},!0)}if(!a){let e=c*t;Yh(F.current,{transform:Zh(b)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})}}}O.useEffect(()=>{window.requestAnimationFrame(()=>{fe.current=!0})},[]),O.useEffect(()=>{var e;function t(){if(!F.current||!T)return;let e=document.activeElement;if(Wh(e)||de.current){let e=window.visualViewport?.height||0,t=window.innerHeight,n=t-e,r=F.current.getBoundingClientRect().height||0,i=r>t*.8;L.current||=r;let o=F.current.getBoundingClientRect().top;if(Math.abs(pe.current-n)>60&&(de.current=!de.current),a&&a.length>0&&ye&&ge){let e=ye[ge]||0;n+=e}if(pe.current=n,r>e||de.current){let t=F.current.getBoundingClientRect().height,r=t;t>e&&(r=e-(i?o:sg)),h?F.current.style.height=`${t-Math.max(n,0)}px`:F.current.style.height=`${Math.max(r,e-o)}px`}else Ch()||(F.current.style.height=`${L.current}px`);a&&a.length>0&&!de.current?F.current.style.bottom=`0px`:F.current.style.bottom=`${Math.max(n,0)}px`}}return(e=window.visualViewport)==null||e.addEventListener(`resize`,t),()=>window.visualViewport?.removeEventListener(`resize`,t)},[ge,a,ye]);function Oe(e){Ae(),_?.(),e||j(!1),setTimeout(()=>{a&&_e(a[0])},tg.DURATION*1e3)}function ke(){if(!F.current)return;let e=document.querySelector(`[data-vaul-drawer-wrapper]`),t=Qh(F.current,b);Yh(F.current,{transform:`translate3d(0, 0, 0)`,transition:`transform ${tg.DURATION}s cubic-bezier(${tg.EASE.join(`,`)})`}),Yh(re.current,{transition:`opacity ${tg.DURATION}s cubic-bezier(${tg.EASE.join(`,`)})`,opacity:`1`}),o&&t&&t>0&&A&&Yh(e,{borderRadius:`${ag}px`,overflow:`hidden`,...Zh(b)?{transform:`scale(${we()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:`top`}:{transform:`scale(${we()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:`left`},transitionProperty:`transform, border-radius`,transitionDuration:`${tg.DURATION}s`,transitionTimingFunction:`cubic-bezier(${tg.EASE.join(`,`)})`},!0)}function Ae(){ee&&F.current&&(F.current.classList.remove(cg),ce.current=!1,te(!1),oe.current=new Date)}function je(e){if(!ee||!F.current)return;F.current.classList.remove(cg),ce.current=!1,te(!1),oe.current=new Date;let t=Qh(F.current,b);if(!e||!Ee(e.target,!1)||!t||Number.isNaN(t)||ae.current===null)return;let n=oe.current.getTime()-ae.current.getTime(),r=ue.current-(Zh(b)?e.pageY:e.pageX),o=Math.abs(r)/n;if(o>.05&&(ne(!0),setTimeout(()=>{ne(!1)},200)),a){ve({draggedDistance:r*(b===`bottom`||b===`right`?1:-1),closeDrawer:Oe,velocity:o,dismissible:u}),i?.(e,!0);return}if(b===`bottom`||b===`right`?r>0:r<0){ke(),i?.(e,!0);return}if(o>ng){Oe(),i?.(e,!1);return}let s=Math.min(F.current.getBoundingClientRect().height??0,window.innerHeight),l=Math.min(F.current.getBoundingClientRect().width??0,window.innerWidth);if(Math.abs(t)>=(b===`left`||b===`right`?l:s)*c){Oe(),i?.(e,!1);return}i?.(e,!0),ke()}O.useEffect(()=>(A&&(Yh(document.documentElement,{scrollBehavior:`auto`}),ie.current=new Date),()=>{Xh(document.documentElement,`scrollBehavior`)}),[A]);function Me(e){let t=e?(window.innerWidth-og)/window.innerWidth:1,n=e?-16:0;le.current&&window.clearTimeout(le.current),Yh(F.current,{transition:`transform ${tg.DURATION}s cubic-bezier(${tg.EASE.join(`,`)})`,transform:Zh(b)?`scale(${t}) translate3d(0, ${n}px, 0)`:`scale(${t}) translate3d(${n}px, 0, 0)`}),!e&&F.current&&(le.current=setTimeout(()=>{let e=Qh(F.current,b);Yh(F.current,{transition:`none`,transform:Zh(b)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})},500))}function Ne(e,t){if(t<0)return;let n=(window.innerWidth-og)/window.innerWidth,r=n+t*(1-n),i=-16+t*og;Yh(F.current,{transform:Zh(b)?`scale(${r}) translate3d(0, ${i}px, 0)`:`scale(${r}) translate3d(${i}px, 0, 0)`,transition:`none`})}function Pe(e,t){let n=Zh(b)?window.innerHeight:window.innerWidth,r=t?(n-og)/n:1,i=t?-16:0;t&&Yh(F.current,{transition:`transform ${tg.DURATION}s cubic-bezier(${tg.EASE.join(`,`)})`,transform:Zh(b)?`scale(${r}) translate3d(0, ${i}px, 0)`:`scale(${r}) translate3d(${i}px, 0, 0)`})}return O.useEffect(()=>{g||window.requestAnimationFrame(()=>{document.body.style.pointerEvents=`auto`})},[g]),O.createElement(Pi,{defaultOpen:x,onOpenChange:e=>{(u||e)&&(e?N(!0):Oe(!0),j(e))},open:A},O.createElement(xh.Provider,{value:{activeSnapPoint:he,snapPoints:a,setActiveSnapPoint:_e,drawerRef:F,overlayRef:re,onOpenChange:t,onPress:Te,onRelease:je,onDrag:De,dismissible:u,shouldAnimate:fe,handleOnly:d,isOpen:A,isDragging:ee,shouldFade:xe,closeDrawer:Oe,onNestedDrag:Ne,onNestedOpenChange:Me,onNestedRelease:Pe,keyboardIsOpen:de,modal:g,snapPointsOffset:ye,activeSnapPointIndex:ge,direction:b,shouldScaleBackground:o,setBackgroundColorOnScale:s,noBodyStyles:y,container:D,autoFocus:k}},n))}var _g=O.forwardRef(function({...e},t){let{overlayRef:n,snapPoints:r,onRelease:i,shouldFade:a,isOpen:o,modal:s,shouldAnimate:c}=Sh(),l=qh(t,n),u=r&&r.length>0;if(!s)return null;let d=O.useCallback(e=>i(e),[i]);return O.createElement(Hi,{onMouseUp:d,ref:l,"data-vaul-overlay":``,"data-vaul-snap-points":o&&u?`true`:`false`,"data-vaul-snap-points-overlay":o&&a?`true`:`false`,"data-vaul-animate":c?.current?`true`:`false`,...e})});_g.displayName=`Drawer.Overlay`;var vg=O.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...r},i){let{drawerRef:a,onPress:o,onRelease:s,onDrag:c,keyboardIsOpen:l,snapPointsOffset:u,activeSnapPointIndex:d,modal:f,isOpen:p,direction:m,snapPoints:h,container:g,handleOnly:_,shouldAnimate:v,autoFocus:y}=Sh(),[b,x]=O.useState(!1),S=qh(i,a),C=O.useRef(null),w=O.useRef(null),T=O.useRef(!1),E=h&&h.length>0;pg();let D=(e,t,n=0)=>{if(T.current)return!0;let r=Math.abs(e.y),i=Math.abs(e.x),a=i>r,o=[`bottom`,`right`].includes(t)?1:-1;if(t===`left`||t===`right`){if(!(e.x*o<0)&&i>=0&&i<=n)return a}else if(!(e.y*o<0)&&r>=0&&r<=n)return!a;return T.current=!0,!0};O.useEffect(()=>{E&&window.requestAnimationFrame(()=>{x(!0)})},[]);function k(e){C.current=null,T.current=!1,s(e)}return O.createElement(Ki,{"data-vaul-drawer-direction":m,"data-vaul-drawer":``,"data-vaul-delayed-snap-points":b?`true`:`false`,"data-vaul-snap-points":p&&E?`true`:`false`,"data-vaul-custom-container":g?`true`:`false`,"data-vaul-animate":v?.current?`true`:`false`,...r,ref:S,style:u&&u.length>0?{"--snap-point-height":`${u[d??0]}px`,...t}:t,onPointerDown:e=>{_||(r.onPointerDown==null||r.onPointerDown.call(r,e),C.current={x:e.pageX,y:e.pageY},o(e))},onOpenAutoFocus:e=>{n?.(e),y||e.preventDefault()},onPointerDownOutside:t=>{if(e?.(t),!f||t.defaultPrevented){t.preventDefault();return}l.current&&=!1},onFocusOutside:e=>{if(!f){e.preventDefault();return}},onPointerMove:e=>{if(w.current=e,_||(r.onPointerMove==null||r.onPointerMove.call(r,e),!C.current))return;let t=e.pageY-C.current.y,n=e.pageX-C.current.x,i=e.pointerType===`touch`?10:2;D({x:n,y:t},m,i)?c(e):(Math.abs(n)>i||Math.abs(t)>i)&&(C.current=null)},onPointerUp:e=>{r.onPointerUp==null||r.onPointerUp.call(r,e),C.current=null,T.current=!1,s(e)},onPointerOut:e=>{r.onPointerOut==null||r.onPointerOut.call(r,e),k(w.current)},onContextMenu:e=>{r.onContextMenu==null||r.onContextMenu.call(r,e),w.current&&k(w.current)}})});vg.displayName=`Drawer.Content`;var yg=250,bg=120,xg=O.forwardRef(function({preventCycle:e=!1,children:t,...n},r){let{closeDrawer:i,isDragging:a,snapPoints:o,activeSnapPoint:s,setActiveSnapPoint:c,dismissible:l,handleOnly:u,isOpen:d,onPress:f,onDrag:p}=Sh(),m=O.useRef(null),h=O.useRef(!1);function g(){if(h.current){y();return}window.setTimeout(()=>{_()},bg)}function _(){if(a||e||h.current){y();return}if(y(),!o||o.length===0){l||i();return}if(s===o[o.length-1]&&l){i();return}let t=o.findIndex(e=>e===s);if(t===-1)return;let n=o[t+1];c(n)}function v(){m.current=window.setTimeout(()=>{h.current=!0},yg)}function y(){m.current&&window.clearTimeout(m.current),h.current=!1}return O.createElement(`div`,{onClick:g,onPointerCancel:y,onPointerDown:e=>{u&&f(e),v()},onPointerMove:e=>{u&&p(e)},ref:r,"data-vaul-drawer-visible":d?`true`:`false`,"data-vaul-handle":``,"aria-hidden":`true`,...n},O.createElement(`span`,{"data-vaul-handle-hitarea":``,"aria-hidden":`true`},t))});xg.displayName=`Drawer.Handle`;function Sg({onDrag:e,onOpenChange:t,open:n,...r}){let{onNestedDrag:i,onNestedOpenChange:a,onNestedRelease:o}=Sh();if(!i)throw Error(`Drawer.NestedRoot must be placed in another drawer`);return O.createElement(gg,{nested:!0,open:n,onClose:()=>{a(!1)},onDrag:(t,n)=>{i(t,n),e?.(t,n)},onOpenChange:e=>{e&&a(e),t?.(e)},onRelease:o,...r})}function Cg(e){let t=Sh(),{container:n=t.container,...r}=e;return O.createElement(Bi,{container:n,...r})}var wg={Root:gg,NestedRoot:Sg,Content:vg,Overlay:_g,Trigger:Ii,Portal:Cg,Handle:xg,Close:ta,Title:Zi,Description:$i};function Tg({...e}){return(0,R.jsx)(wg.Root,{"data-slot":`drawer`,...e})}function Eg({...e}){return(0,R.jsx)(wg.Portal,{"data-slot":`drawer-portal`,...e})}function Dg({...e}){return(0,R.jsx)(wg.Close,{"data-slot":`drawer-close`,...e})}function Og({className:e,...t}){return(0,R.jsx)(wg.Overlay,{"data-slot":`drawer-overlay`,className:G(`la:fixed la:inset-0 la:z-50 la:bg-black/50 la:data-[state=closed]:animate-out la:data-[state=closed]:fade-out-0 la:data-[state=open]:animate-in la:data-[state=open]:fade-in-0`,e),...t})}function kg({className:e,children:t,container:n,...r}){return(0,R.jsxs)(Eg,{container:n,children:[(0,R.jsx)(Og,{}),(0,R.jsxs)(wg.Content,{"data-slot":`drawer-content`,className:G(`la-observer la:group/drawer-content la:fixed la:z-50 la:flex la:h-auto la:flex-col la:bg-background`,`la:data-[vaul-drawer-direction=top]:inset-x-0 la:data-[vaul-drawer-direction=top]:top-0 la:data-[vaul-drawer-direction=top]:mb-24 la:data-[vaul-drawer-direction=top]:max-h-[80vh] la:data-[vaul-drawer-direction=top]:rounded-b-lg la:data-[vaul-drawer-direction=top]:border-b`,`la:data-[vaul-drawer-direction=bottom]:inset-x-0 la:data-[vaul-drawer-direction=bottom]:bottom-0 la:data-[vaul-drawer-direction=bottom]:mt-24 la:data-[vaul-drawer-direction=bottom]:max-h-[80vh] la:data-[vaul-drawer-direction=bottom]:rounded-t-lg la:data-[vaul-drawer-direction=bottom]:border-t`,`la:data-[vaul-drawer-direction=right]:inset-y-0 la:data-[vaul-drawer-direction=right]:right-0 la:data-[vaul-drawer-direction=right]:w-3/4 la:data-[vaul-drawer-direction=right]:border-l la:data-[vaul-drawer-direction=right]:sm:max-w-sm`,`la:data-[vaul-drawer-direction=left]:inset-y-0 la:data-[vaul-drawer-direction=left]:left-0 la:data-[vaul-drawer-direction=left]:w-3/4 la:data-[vaul-drawer-direction=left]:border-r la:data-[vaul-drawer-direction=left]:sm:max-w-sm`,e),...r,children:[(0,R.jsx)(`div`,{className:`la:mx-auto la:mt-4 la:hidden la:h-2 la:w-[100px] la:shrink-0 la:rounded-full la:bg-muted la:group-data-[vaul-drawer-direction=bottom]/drawer-content:block`}),t]})]})}function Ag({className:e,...t}){return(0,R.jsx)(`div`,{"data-slot":`drawer-header`,className:G(`la:flex la:flex-col la:gap-0.5 la:p-4 la:group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center la:group-data-[vaul-drawer-direction=top]/drawer-content:text-center la:md:gap-1.5 la:md:text-left`,e),...t})}function jg({className:e,...t}){return(0,R.jsx)(wg.Title,{"data-slot":`drawer-title`,className:G(`la:font-semibold la:text-foreground`,e),...t})}function Mg({className:e,...t}){return(0,R.jsx)(wg.Description,{"data-slot":`drawer-description`,className:G(`la:text-sm la:text-muted-foreground`,e),...t})}function Ng({className:e,size:t=`default`,...n}){return(0,R.jsxs)(`div`,{className:`la:group/native-select la:relative la:w-fit la:has-[select:disabled]:opacity-50`,"data-slot":`native-select-wrapper`,children:[(0,R.jsx)(`select`,{"data-slot":`native-select`,"data-size":t,className:G(`la:h-9 la:w-full la:min-w-0 la:appearance-none la:rounded-md la:border la:border-input la:bg-transparent la:px-3 la:py-2 la:pr-9 la:text-sm la:shadow-xs la:outline-none la:transition-[color,box-shadow] la:selection:bg-primary la:selection:text-primary-foreground la:disabled:pointer-events-none la:disabled:cursor-not-allowed la:data-[size=sm]:h-8 la:data-[size=sm]:py-1 la:focus-visible:border-ring la:focus-visible:ring-[3px] la:focus-visible:ring-ring/50 la:aria-invalid:border-destructive la:aria-invalid:ring-destructive/20 la:dark:bg-input/30 la:dark:hover:bg-input/50 la:dark:aria-invalid:ring-destructive/40`,e),...n}),(0,R.jsx)(de,{className:`la:pointer-events-none la:absolute la:top-1/2 la:right-3.5 la:size-4 la:-translate-y-1/2 la:text-muted-foreground la:opacity-50 la:select-none`,"aria-hidden":`true`,"data-slot":`native-select-icon`})]})}function Pg({className:e,...t}){return(0,R.jsx)(`option`,{"data-slot":`native-select-option`,className:G(`la:bg-[Canvas] la:text-[CanvasText]`,e),...t})}function Fg({className:e,containerProps:t,...n}){return(0,R.jsx)(`div`,{...t,"data-slot":`table-container`,className:G(`la:relative la:w-full la:overflow-x-auto`,t?.className),children:(0,R.jsx)(`table`,{"data-slot":`table`,className:G(`la:w-full la:caption-bottom la:text-sm la:tabular-nums`,e),...n})})}function Ig({className:e,...t}){return(0,R.jsx)(`thead`,{"data-slot":`table-header`,className:G(`la:[&_tr]:border-b`,e),...t})}function Lg({className:e,...t}){return(0,R.jsx)(`tbody`,{"data-slot":`table-body`,className:G(`la:[&_tr:last-child]:border-0`,e),...t})}function Rg({className:e,...t}){return(0,R.jsx)(`tr`,{"data-slot":`table-row`,className:G(`la:border-b la:transition-colors la:duration-150 la:hover:bg-muted/60 la:data-[state=selected]:bg-muted`,e),...t})}function Q({className:e,...t}){return(0,R.jsx)(`th`,{"data-slot":`table-head`,className:G(`la:h-10 la:whitespace-nowrap la:px-3 la:text-left la:align-middle la:text-xs la:font-medium la:text-muted-foreground la:[&:has([role=checkbox])]:pr-0 la:[&>[role=checkbox]]:translate-y-[2px]`,e),...t})}function $({className:e,...t}){return(0,R.jsx)(`td`,{"data-slot":`table-cell`,className:G(`la:whitespace-nowrap la:px-3 la:py-2.5 la:align-middle la:[&:has([role=checkbox])]:pr-0 la:[&>[role=checkbox]]:translate-y-[2px]`,e),...t})}function zg(e){let[t,n]=(0,O.useState)(0),[r,i]=(0,O.useState)(),[a,o]=(0,O.useState)(!0),[s,c]=(0,O.useState)(!1);return(0,O.useEffect)(()=>{let t=new AbortController,n,r=1e3;return c(!1),o(!0),s(),()=>{t.abort(),clearTimeout(n)};function a(n){t.signal.aborted||(i({client:e,inventory:n,updatedAt:Date.now()}),c(!1),o(!1),r=1e3)}async function s(){try{if(e.watchActors){if(await e.watchActors(a,t.signal),!t.signal.aborted)throw Error(`Stream ended`)}else o(!0),a(await e.listActors(t.signal))}catch{t.signal.aborted||c(!0)}finally{t.signal.aborted||(o(!1),n=setTimeout(s,e.watchActors?r:5e3),r=Math.min(r*2,1e4))}}},[e,t]),{updatedAt:r?.client===e?r.updatedAt:void 0,inventory:r?.client===e?r.inventory:void 0,loading:a,failed:s,retry:()=>n(e=>e+1)}}function Bg(e,t=!0){let[n,r]=(0,O.useState)(),[i,a]=(0,O.useState)(!1),[o,s]=(0,O.useState)(0);return(0,O.useEffect)(()=>r(void 0),[e]),(0,O.useEffect)(()=>{if(!t)return;let n,i=new AbortController,o,s=1e3;async function c(){try{if(!e.watchRequests)throw Error(`Request traces unavailable`);if(await e.watchRequests(e=>{i.signal.aborted||(n=e.resumeCursor,r(t=>Vg(t,e)),a(!1),s=1e3)},i.signal,n),!i.signal.aborted)throw Error(`Request stream disconnected`)}catch{i.signal.aborted||a(!0)}finally{i.signal.aborted||(o=setTimeout(c,s),s=Math.min(s*2,1e4))}}return a(!1),c(),()=>{i.abort(),clearTimeout(o)}},[e,o,t]),{page:n,failed:i,retry:()=>s(e=>e+1)}}function Vg(e,t){let n=new Map((e?.epoch===t.epoch&&!t.reset?e.records:[]).map(e=>[e.eventId??e.sequence,e]));for(let e of t.records)n.set(e.eventId??e.sequence,e);return{...t,reset:t.reset||e?.epoch===t.epoch&&e.reset,records:[...n.values()].sort((e,t)=>t.sequence-e.sequence).slice(0,t.capacity)}}function Hg(e,t,n,r=1e4){let i=n?JSON.stringify(t):void 0,[a,o]=(0,O.useState)(0),[s,c]=(0,O.useState)(),[l,u]=(0,O.useState)(!1),[d,f]=(0,O.useState)(!1);(0,O.useEffect)(()=>{if(!i)return;let t=new AbortController,a;return u(!1),f(!0),o(),()=>{t.abort(),clearTimeout(a)};async function o(){try{let r=await n.call(e,JSON.parse(i),t.signal);if(t.signal.aborted)return;c({client:e,key:i,value:r,updatedAt:Date.now()}),u(!1)}catch{t.signal.aborted||u(!0)}finally{t.signal.aborted||(f(!1),a=setTimeout(o,r))}}},[e,n,i,a,r]);let p=s&&s.client===e&&s.key===i?s:void 0;return{supported:!!n,value:p?.value,updatedAt:p?.updatedAt,loading:d,failed:l,retry:()=>o(e=>e+1)}}function Ug(e,t){let[n,r]=(0,O.useState)(),[i,a]=(0,O.useState)(!1),[o,s]=(0,O.useState)(!1),c=(0,O.useRef)(()=>{});return(0,O.useEffect)(()=>{if(r(void 0),s(!1),a(!1),!t)return;let n=new AbortController,i=!1;c.current=e=>{i||n.signal.aborted||(i=!0,a(!0),s(!1),o(e))};async function o(o){try{if(!e.listRequests)throw Error(`History is unavailable`);let i=await e.listRequests({...t,cursor:o},n.signal);if(n.signal.aborted)return;r(e=>{if(!o||!e||i.reset||e.epoch!==i.epoch)return i;let t=new Map(e.records.map(e=>[e.eventId??e.sequence,e]));for(let e of i.records)t.set(e.eventId??e.sequence,e);return{...i,reset:e.reset||i.reset,records:[...t.values()]}})}catch{n.signal.aborted||s(!0)}finally{i=!1,n.signal.aborted||a(!1)}}return c.current(),()=>n.abort()},[e,t]),{page:n,loading:i,failed:o,loadOlder:()=>c.current(n?.nextCursor??void 0),retry:()=>c.current(n?.nextCursor??void 0)}}function Wg({client:e,actor:t,timeRange:n,onTimeRangeChange:r,focus:i}){let[a,o]=(0,O.useState)(),[s,c]=(0,O.useState)(ah),l=n??s,u=r??c,d=Ug(e,(0,O.useMemo)(()=>a?{...a,...t,...a.requestId||a.connectionId?{}:oh(l,Date.now())}:void 0,[a,t?.actorName,t?.actorId,l])),{page:f,failed:p,retry:m}=Bg(e),[h,g]=(0,O.useState)(),[_,v]=(0,O.useState)(),[y,b]=(0,O.useState)(`waterfall`),x=(0,O.useRef)(null),S=(0,O.useRef)(null),C=t?`h3`:`h1`,w=a?d.page:h??f,T=f??d.page,E=(w?.records??[]).filter(e=>!t||e.actorName===t.actorName&&e.actorId===t.actorId);return(0,O.useEffect)(()=>{g(void 0),o(void 0)},[e,t?.actorName,t?.actorId]),(0,O.useEffect)(()=>{i&&o(i)},[i]),(0,O.useEffect)(()=>v(void 0),[e,f?.epoch,a,t?.actorName,t?.actorId]),(0,R.jsxs)(`section`,{ref:x,className:`la-observer la-requests`,"aria-label":`Request observer`,children:[(a?.requestId||a?.connectionId)&&(0,R.jsxs)(`p`,{children:[`Showing `,a.requestId?`request ${a.requestId}`:`connection ${a?.connectionId}`,` `,(0,R.jsx)(K,{variant:`link`,onClick:()=>o(void 0),children:`Clear filter`})]}),(0,R.jsxs)(`div`,{className:`la-observer-toolbar`,children:[(0,R.jsxs)(`div`,{className:t?`la:sr-only`:void 0,children:[(0,R.jsx)(C,{children:`Requests`}),(0,R.jsx)(`p`,{children:t?`Method calls and WebSocket events for this instance.`:`Method calls and WebSocket events, with time spent waiting and processing.`})]}),(0,R.jsxs)(`div`,{className:`la-request-actions`,children:[(0,R.jsxs)(`div`,{className:`request-view-toggle`,role:`group`,"aria-label":`Request view`,children:[(0,R.jsxs)(K,{variant:y===`waterfall`?`secondary`:`ghost`,"aria-pressed":y===`waterfall`,onClick:()=>b(`waterfall`),children:[(0,R.jsx)(le,{"aria-hidden":`true`}),`Waterfall`]}),(0,R.jsxs)(K,{variant:y===`table`?`secondary`:`ghost`,"aria-pressed":y===`table`,onClick:()=>b(`table`),children:[(0,R.jsx)(Se,{"aria-hidden":`true`}),`Table`]})]}),e.listRequests&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(K,{variant:a?`outline`:`secondary`,"aria-pressed":!a,onClick:()=>{o(void 0),g(void 0)},children:`Live`}),(0,R.jsx)(K,{variant:a?`secondary`:`outline`,"aria-pressed":!!a,onClick:()=>{a||o({})},children:`History`})]}),!a&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(K,{variant:`outline`,disabled:!w,onClick:()=>g(h?void 0:f),children:[h?(0,R.jsx)(Ee,{"aria-hidden":`true`}):(0,R.jsx)(we,{"aria-hidden":`true`}),h?`Resume`:`Pause`]}),p&&(0,R.jsxs)(K,{variant:`outline`,onClick:m,children:[(0,R.jsx)(Oe,{"aria-hidden":`true`}),`Retry`]})]})]})]}),a&&(0,R.jsx)(Gg,{query:a,range:l,onRangeChange:u,loading:d.loading,onSearch:o,scoped:!!t}),a&&d.failed&&(0,R.jsxs)(`div`,{className:`la-observer-error`,role:`alert`,children:[`Request history unavailable.`,` `,(0,R.jsx)(K,{variant:`outline`,onClick:d.retry,children:`Retry history`})]}),!a&&p&&(0,R.jsxs)(`div`,{className:`la-observer-error`,role:`alert`,children:[`Request stream disconnected. Reconnecting… `,f?`Showing the last received requests.`:`Check your connection and runtime version.`]}),!!T?.dropped&&(0,R.jsxs)(`div`,{className:`la-observer-error`,role:`alert`,children:[T.dropped.toLocaleString(),` request traces were not delivered. This history is incomplete.`]}),T?.persistenceFailed&&(0,R.jsx)(`div`,{className:`la-observer-error`,role:`alert`,children:`Some request events could not be saved. This history may be incomplete.`}),w?.reset&&(0,R.jsx)(`div`,{className:`la-observer-error`,role:`alert`,children:`Some older events are no longer retained. Showing available history.`}),y===`waterfall`&&E.length>0&&(0,R.jsx)(Ls,{records:E,selected:_,onSelect:(e,t)=>{S.current=t,v(e)}}),(0,R.jsxs)(`div`,{className:y===`table`||!E.length?`la-observer-table-frame`:void 0,children:[y===`table`&&(0,R.jsxs)(Fg,{"aria-label":a?`Saved requests`:`Recent requests`,className:`la-request-table`,children:[(0,R.jsx)(Ig,{children:(0,R.jsxs)(Rg,{children:[(0,R.jsx)(Q,{scope:`col`,children:`Time`}),(0,R.jsx)(Q,{scope:`col`,children:`Request`}),(0,R.jsx)(Q,{scope:`col`,children:`Instance`}),(0,R.jsx)(Q,{scope:`col`,children:`Transport`}),(0,R.jsx)(Q,{scope:`col`,children:`Outcome`}),(0,R.jsx)(Q,{scope:`col`,children:`Total`}),(0,R.jsx)(Q,{scope:`col`,children:`Queue wait`}),(0,R.jsx)(Q,{scope:`col`,children:(0,R.jsx)(`span`,{className:`la:sr-only`,children:`Details`})})]})}),(0,R.jsx)(Lg,{children:E.map(e=>(0,R.jsxs)(Rg,{className:`la-clickable-row`,"data-state":_===e?`selected`:void 0,onClick:t=>{S.current=t.currentTarget.querySelector(`button`),v(e)},children:[(0,R.jsx)($,{children:(0,R.jsx)(`time`,{dateTime:new Date(e.startedAtMs).toISOString(),title:new Date(e.startedAtMs).toLocaleString(),children:a?new Date(e.startedAtMs).toLocaleString([],{hour12:!1}):new Date(e.startedAtMs).toLocaleTimeString([],{hour12:!1})})}),(0,R.jsx)($,{children:(0,R.jsx)(`span`,{className:`la-request-operation`,title:e.operation,children:e.operation})}),(0,R.jsx)($,{children:(0,R.jsxs)(`span`,{className:`la-request-actor`,title:`${e.actorName} / ${e.actorId}`,children:[e.actorName,` / `,e.actorId]})}),(0,R.jsx)($,{children:e.kind===`method`?`Method`:`WebSocket`}),(0,R.jsx)($,{children:(0,R.jsx)(yh,{variant:`outline`,className:`la-request-outcome-${e.outcome}`,children:e.outcome[0].toUpperCase()+e.outcome.slice(1)})}),(0,R.jsx)($,{children:Os(e.durationMs)}),(0,R.jsx)($,{children:e.queueWaitMs===null?(0,R.jsx)(`span`,{title:`Request did not begin processing`,children:`—`}):Os(e.queueWaitMs)}),(0,R.jsx)($,{children:(0,R.jsx)(K,{variant:`ghost`,size:`sm`,"aria-label":`Inspect ${e.operation} request`,"aria-haspopup":`dialog`,children:`Details`})})]},e.eventId??`${w.epoch}-${e.sequence}`))})]}),!E.length&&(0,R.jsxs)(`div`,{className:`la-request-empty`,role:`status`,children:[(0,R.jsx)(`strong`,{children:a?d.loading?`Loading history…`:d.failed?`History unavailable`:`No saved requests in this range`:w?`No requests yet`:p?`Requests unavailable`:`Connecting to requests…`}),(0,R.jsx)(`p`,{children:a?`Try a wider time range or fewer filters. Local history retains the latest 10,000 events.`:`Call an actor method or send a WebSocket message to see its timings.`})]})]}),a&&w?.nextCursor&&(0,R.jsx)(K,{className:`la-request-load-older`,variant:`outline`,disabled:d.loading,onClick:d.loadOlder,children:d.loading?`Loading…`:`Load older`}),(0,R.jsxs)(`div`,{className:`la-observer-footnote`,children:[(0,R.jsxs)(`span`,{className:`la-observer-refresh-status`,children:[!a&&(0,R.jsx)(`span`,{className:`la-observer-dot ${p?`la-observer-dot-unknown`:`la-observer-dot-live`}`}),a?`Saved history`:h?`Display paused · collection continues`:p?`Reconnecting…`:f?`Live updates`:`Connecting…`]}),(0,R.jsx)(`span`,{children:a?`${E.length.toLocaleString()} saved requests shown`:t?`${E.length} matching requests from the latest ${w?.capacity??500} on this control plane.`:`Latest ${w?.capacity??500} requests on this control plane.`})]}),!a&&!!w?.evicted&&(0,R.jsxs)(`p`,{className:`la-request-note`,children:[w.evicted.toLocaleString(),` older records have left this history window.`]}),(0,R.jsx)(`p`,{className:`la-request-note`,children:`Total includes queue wait, actor processing, and persistence. Queue wait includes the WebSocket message queue. Timings exclude the caller’s network round trip.`}),(0,R.jsx)(Tg,{direction:`right`,autoFocus:!0,open:!!_,onOpenChange:e=>{e||v(void 0)},children:(0,R.jsxs)(kg,{container:x.current,className:`la:data-[vaul-drawer-direction=right]:w-full la:data-[vaul-drawer-direction=right]:sm:max-w-[480px]`,onCloseAutoFocus:e=>{e.preventDefault(),S.current?.focus()},children:[(0,R.jsxs)(Ag,{className:`la:relative la:shrink-0 la:gap-2 la:p-6 la:pr-16`,children:[(0,R.jsx)(jg,{children:`Request details`}),(0,R.jsx)(Mg,{children:`Full identifiers and timings for this request.`}),(0,R.jsx)(Dg,{asChild:!0,children:(0,R.jsx)(K,{className:`la:absolute la:top-4 la:right-4`,variant:`ghost`,size:`icon`,"aria-label":`Close`,children:(0,R.jsx)(Re,{"aria-hidden":`true`})})})]}),(0,R.jsx)(`div`,{className:`la:min-h-0 la:flex-1 la:overflow-y-auto la:px-6 la:pb-6`,children:_&&(0,R.jsx)(Kg,{record:_,timing:Es(E).calls.find(e=>e.record===_)})})]})})]})}function Gg({query:e,range:t,onRangeChange:n,loading:r,onSearch:i,scoped:a}){let o=(0,O.useId)(),s=(0,O.useId)();return(0,R.jsxs)(`form`,{className:`la-request-history-filters`,onSubmit:e=>{e.preventDefault();let t=new FormData(e.currentTarget);i({actorId:String(t.get(`actorId`)||``).trim()||void 0,outcome:String(t.get(`outcome`)||``)||void 0})},children:[(0,R.jsxs)(`div`,{className:`la-request-history-range`,children:[(0,R.jsx)(`span`,{children:`Time range`}),(0,R.jsx)(dh,{value:t,onChange:n,align:`start`})]}),!a&&(0,R.jsxs)(`div`,{className:`la-request-history-field`,children:[(0,R.jsx)(`label`,{htmlFor:o,children:`Actor ID`}),(0,R.jsx)(Yd,{id:o,name:`actorId`,placeholder:`All actors`,maxLength:256,defaultValue:e.actorId})]}),(0,R.jsxs)(`div`,{className:`la-request-history-field`,children:[(0,R.jsx)(`label`,{htmlFor:s,children:`Outcome`}),(0,R.jsxs)(Ng,{id:s,className:`la-observer-select`,name:`outcome`,defaultValue:e.outcome??``,children:[(0,R.jsx)(Pg,{value:``,children:`All outcomes`}),[`completed`,`failed`,`rejected`,`rerouted`,`interrupted`].map(e=>(0,R.jsx)(Pg,{value:e,children:e[0].toUpperCase()+e.slice(1)},e))]})]}),(0,R.jsx)(K,{type:`submit`,variant:`outline`,disabled:r,children:`Search`})]})}function Kg({record:e,timing:t}){let n={Operation:e.operation,"Actor class":e.actorName,"Instance ID":e.actorId,"Request ID":e.requestId,Time:new Date(e.startedAtMs).toLocaleString(),Transport:e.kind===`method`?`Method`:`WebSocket`,Outcome:e.outcome,Total:Os(e.durationMs),"Queue wait":e.queueWaitMs===null?`Did not begin processing`:Os(e.queueWaitMs),...t?{"Start offset in view":Os(t.offsetMs),"Gap from preceding calls":ks(t.gapMs)}:{},Host:e.hostId,...e.connectionId?{Connection:e.connectionId}:{}};return(0,R.jsx)(`dl`,{className:`la-request-details`,children:Object.entries(n).map(([e,t])=>(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{children:e}),(0,R.jsx)(`dd`,{children:t})]},e))})}var qg=e=>typeof e==`boolean`||e instanceof Boolean,Jg=e=>typeof e==`number`||e instanceof Number,Yg=e=>typeof e==`bigint`||e instanceof BigInt,Xg=e=>!!e&&e instanceof Date,Zg=e=>typeof e==`string`||e instanceof String,Qg=e=>Array.isArray(e),$g=e=>typeof e==`object`&&!!e,e_=e=>!!e&&e instanceof Object&&typeof e==`function`;function t_(e,t){return t===void 0&&(t=!1),!e||t?`"${e}"`:e}function n_(e,t,n){return n?JSON.stringify(e):t?`"${e}"`:e}function r_(e){let{field:t,value:n,data:r,lastElement:i,openBracket:a,closeBracket:o,level:s,style:c,shouldExpandNode:l,clickToExpandNode:u,outerRef:d,beforeExpandChange:f}=e,p=(0,O.useRef)(!1),[m,h]=(0,O.useState)(()=>l(s,n,t)),g=(0,O.useRef)(null);(0,O.useEffect)(()=>{p.current?h(l(s,n,t)):p.current=!0},[l]);let _=(0,O.useId)();if(r.length===0)return i_({field:t,openBracket:a,closeBracket:o,lastElement:i,style:c});let v=m?c.collapseIcon:c.expandIcon,y=m?c.ariaLables.collapseJson:c.ariaLables.expandJson,b=s+1,x=r.length-1,S=e=>{m!==e&&(!f||f({level:s,value:n,field:t,newExpandValue:e}))&&h(e)},C=e=>{if(e.key===`ArrowRight`||e.key===`ArrowLeft`)e.preventDefault(),S(e.key===`ArrowRight`);else if(e.key===`ArrowUp`||e.key===`ArrowDown`){e.preventDefault();let t=e.key===`ArrowUp`?-1:1;if(!d.current)return;let n=d.current.querySelectorAll(`[role=button]`),r=-1;for(let e=0;e<n.length;e++)if(n[e].tabIndex===0){r=e;break}if(r<0)return;let i=(r+t+n.length)%n.length;n[r].tabIndex=-1,n[i].tabIndex=0,n[i].focus()}},w=()=>{S(!m);let e=g.current;if(!e)return;let t=d.current?.querySelector(`[role=button][tabindex="0"]`);t&&(t.tabIndex=-1),e.tabIndex=0,e.focus()};return(0,O.createElement)(`div`,{className:c.basicChildStyle,role:`treeitem`,"aria-expanded":m,"aria-selected":void 0},(0,O.createElement)(`span`,{className:v,onClick:w,onKeyDown:C,role:`button`,"aria-label":y,"aria-expanded":m,"aria-controls":m?_:void 0,ref:g,tabIndex:s===0?0:-1}),(t||t===``)&&(u?(0,O.createElement)(`span`,{className:c.clickableLabel,onClick:w,onKeyDown:C},t_(t,c.quotesForFieldNames),`:`):(0,O.createElement)(`span`,{className:c.label},t_(t,c.quotesForFieldNames),`:`)),(0,O.createElement)(`span`,{className:c.punctuation},a),m?(0,O.createElement)(`ul`,{id:_,role:`group`,className:c.childFieldsContainer},r.map((e,t)=>(0,O.createElement)(c_,{key:e[0]||t,field:e[0],value:e[1],style:c,lastElement:t===x,level:b,shouldExpandNode:l,clickToExpandNode:u,beforeExpandChange:f,outerRef:d}))):(0,O.createElement)(`span`,{className:c.collapsedContent,onClick:w,onKeyDown:C}),(0,O.createElement)(`span`,{className:c.punctuation},o),!i&&(0,O.createElement)(`span`,{className:c.punctuation},`,`))}function i_(e){let{field:t,openBracket:n,closeBracket:r,lastElement:i,style:a}=e;return(0,O.createElement)(`div`,{className:a.basicChildStyle,role:`treeitem`,"aria-selected":void 0},(t||t===``)&&(0,O.createElement)(`span`,{className:a.label},t_(t,a.quotesForFieldNames),`:`),(0,O.createElement)(`span`,{className:a.punctuation},n),(0,O.createElement)(`span`,{className:a.punctuation},r),!i&&(0,O.createElement)(`span`,{className:a.punctuation},`,`))}function a_(e){let{field:t,value:n,style:r,lastElement:i,shouldExpandNode:a,clickToExpandNode:o,level:s,outerRef:c,beforeExpandChange:l}=e;return r_({field:t,value:n,lastElement:i||!1,level:s,openBracket:`{`,closeBracket:`}`,style:r,shouldExpandNode:a,clickToExpandNode:o,data:Object.keys(n).map(e=>[e,n[e]]),outerRef:c,beforeExpandChange:l})}function o_(e){let{field:t,value:n,style:r,lastElement:i,level:a,shouldExpandNode:o,clickToExpandNode:s,outerRef:c,beforeExpandChange:l}=e;return r_({field:t,value:n,lastElement:i||!1,level:a,openBracket:`[`,closeBracket:`]`,style:r,shouldExpandNode:o,clickToExpandNode:s,data:n.map(e=>[void 0,e]),outerRef:c,beforeExpandChange:l})}function s_(e){let{field:t,value:n,style:r,lastElement:i}=e,a,o=r.otherValue;return n===null?(a=`null`,o=r.nullValue):n===void 0?(a=`undefined`,o=r.undefinedValue):Zg(n)?(a=n_(n,!r.noQuotesForStringValues,r.stringifyStringValues),o=r.stringValue):qg(n)?(a=n?`true`:`false`,o=r.booleanValue):Jg(n)?(a=n.toString(),o=r.numberValue):Yg(n)?(a=`${n.toString()}n`,o=r.numberValue):a=Xg(n)?n.toISOString():e_(n)?`function() { }`:n.toString(),(0,O.createElement)(`div`,{className:r.basicChildStyle,role:`treeitem`,"aria-selected":void 0},(t||t===``)&&(0,O.createElement)(`span`,{className:r.label},t_(t,r.quotesForFieldNames),`:`),(0,O.createElement)(`span`,{className:o},a),!i&&(0,O.createElement)(`span`,{className:r.punctuation},`,`))}function c_(e){let t=e.value;return Qg(t)?(0,O.createElement)(o_,Object.assign({},e)):$g(t)&&!Xg(t)&&!e_(t)?(0,O.createElement)(a_,Object.assign({},e)):(0,O.createElement)(s_,Object.assign({},e))}var l_={"container-base":`_GzYRV`,"punctuation-base":`_3eOF8`,pointer:`_1MFti`,"expander-base":`_f10Tu _1MFti`,"expand-icon":`_1UmXx`,"collapse-icon":`_1LId0`,"collapsed-content-base":`_1pNG9 _1MFti`,"container-light":`_2IvMF _GzYRV`,"basic-element-style":`_2bkNM`,"child-fields-container":`_1BXBN`,"label-light":`_1MGIk`,"clickable-label-light":`_2YKJg _1MGIk _1MFti`,"punctuation-light":`_3uHL6 _3eOF8`,"value-null-light":`_2T6PJ`,"value-undefined-light":`_1Gho6`,"value-string-light":`_vGjyY`,"value-number-light":`_1bQdo`,"value-boolean-light":`_3zQKs`,"value-other-light":`_1xvuR`,"collapse-icon-light":`_oLqym _f10Tu _1MFti _1LId0`,"expand-icon-light":`_2AXVT _f10Tu _1MFti _1UmXx`,"collapsed-content-light":`_2KJWg _1pNG9 _1MFti`,"container-dark":`_11RoI _GzYRV`,"expand-icon-dark":`_17H2C _f10Tu _1MFti _1UmXx`,"collapse-icon-dark":`_3QHg2 _f10Tu _1MFti _1LId0`,"collapsed-content-dark":`_3fDAz _1pNG9 _1MFti`,"label-dark":`_2bSDX`,"clickable-label-dark":`_1RQEj _2bSDX _1MFti`,"punctuation-dark":`_gsbQL _3eOF8`,"value-null-dark":`_LaAZe`,"value-undefined-dark":`_GTKgm`,"value-string-dark":`_Chy1W`,"value-number-dark":`_2bveF`,"value-boolean-dark":`_2vRm-`,"value-other-dark":`_1prJR`},u_={container:l_[`container-light`],basicChildStyle:l_[`basic-element-style`],childFieldsContainer:l_[`child-fields-container`],label:l_[`label-light`],clickableLabel:l_[`clickable-label-light`],nullValue:l_[`value-null-light`],undefinedValue:l_[`value-undefined-light`],stringValue:l_[`value-string-light`],booleanValue:l_[`value-boolean-light`],numberValue:l_[`value-number-light`],otherValue:l_[`value-other-light`],punctuation:l_[`punctuation-light`],collapseIcon:l_[`collapse-icon-light`],expandIcon:l_[`expand-icon-light`],collapsedContent:l_[`collapsed-content-light`],noQuotesForStringValues:!1,quotesForFieldNames:!1,ariaLables:{collapseJson:`collapse JSON`,expandJson:`expand JSON`},stringifyStringValues:!1};l_[`container-dark`],l_[`basic-element-style`],l_[`child-fields-container`],l_[`label-dark`],l_[`clickable-label-dark`],l_[`value-null-dark`],l_[`value-undefined-dark`],l_[`value-string-dark`],l_[`value-boolean-dark`],l_[`value-number-dark`],l_[`value-other-dark`],l_[`punctuation-dark`],l_[`collapse-icon-dark`],l_[`expand-icon-dark`],l_[`collapsed-content-dark`];var d_=()=>!0,f_=e=>{let{data:t,style:n=u_,shouldExpandNode:r=d_,clickToExpandNode:i=!1,beforeExpandChange:a,compactTopLevel:o,...s}=e,c=(0,O.useRef)(null);return(0,O.createElement)(`div`,Object.assign({"aria-label":`JSON view`},s,{className:n.container,ref:c,role:`tree`}),o&&$g(t)?Object.entries(t).map(e=>{let[t,o]=e;return(0,O.createElement)(c_,{key:t,field:t,value:o,style:{...u_,...n},lastElement:!0,level:1,shouldExpandNode:r,clickToExpandNode:i,beforeExpandChange:a,outerRef:c})}):(0,O.createElement)(c_,{value:t,style:{...u_,...n},lastElement:!0,level:0,shouldExpandNode:r,clickToExpandNode:i,outerRef:c,beforeExpandChange:a}))};function p_(e){let t=/^\/(.*)\/([gimyu]*)$/.exec(e.toString());if(!t)throw Error(`Invalid RegExp`);return new RegExp(t[1]??``,t[2])}function m_(e){if(typeof e!=`object`)return e;if(e===null)return null;if(Array.isArray(e))return e.map(m_);if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return p_(e);let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=m_(e[n]));return t}function h_(e,t){if(e.length===0)throw Error(t||`Expected a non-empty array`)}function g_(e,t){if(e.length<2)throw Error(t||`Expected an array with at least 2 items`)}var __=e=>e[e.length-1],v_=class{setResult(e){return this.result=e,this.hasResult=!0,this}exit(){return this.exiting=!0,this}push(e,t){return e.parent=this,t!==void 0&&(e.childName=t),e.root=this.root||this,e.options=e.options||this.options,this.children?(h_(this.children),__(this.children).next=e,this.children.push(e)):(this.children=[e],this.nextAfterChildren=this.next||null,this.next=e),e.next=this,this}},y_=class extends v_{constructor(e,t){super(),this.left=e,this.right=t,this.pipe=`diff`}prepareDeltaResult(e){if(typeof e==`object`&&(this.options?.omitRemovedValues&&Array.isArray(e)&&e.length>1&&(e.length===2||e[2]===0||e[2]===3)&&(e[0]=0),this.options?.cloneDiffValues)){let t=typeof this.options?.cloneDiffValues==`function`?this.options?.cloneDiffValues:m_;typeof e[0]==`object`&&(e[0]=t(e[0])),typeof e[1]==`object`&&(e[1]=t(e[1]))}return e}setResult(e){return this.prepareDeltaResult(e),super.setResult(e)}},b_=class extends v_{constructor(e,t){super(),this.left=e,this.delta=t,this.pipe=`patch`}},x_=class extends v_{constructor(e){super(),this.delta=e,this.pipe=`reverse`}},S_=class{constructor(e){this.name=e,this.filters=[]}process(e){if(!this.processor)throw Error(`add this pipe to a processor before using it`);let t=this.debug,n=this.filters.length,r=e;for(let e=0;e<n;e++){let n=this.filters[e];if(n&&(t&&this.log(`filter: ${n.filterName}`),n(r),typeof r==`object`&&r.exiting)){r.exiting=!1;break}}!r.next&&this.resultCheck&&this.resultCheck(r)}log(e){console.log(`[jsondiffpatch] ${this.name} pipe, ${e}`)}append(...e){return this.filters.push(...e),this}prepend(...e){return this.filters.unshift(...e),this}indexOf(e){if(!e)throw Error(`a filter name is required`);for(let t=0;t<this.filters.length;t++)if(this.filters[t]?.filterName===e)return t;throw Error(`filter not found: ${e}`)}list(){return this.filters.map(e=>e.filterName)}after(e,...t){let n=this.indexOf(e);return this.filters.splice(n+1,0,...t),this}before(e,...t){let n=this.indexOf(e);return this.filters.splice(n,0,...t),this}replace(e,...t){let n=this.indexOf(e);return this.filters.splice(n,1,...t),this}remove(e){let t=this.indexOf(e);return this.filters.splice(t,1),this}clear(){return this.filters.length=0,this}shouldHaveResult(e){return e===!1?(this.resultCheck=null,this):(this.resultCheck||=e=>{if(!e.hasResult){console.log(e);let t=Error(`${this.name} failed`);throw t.noResult=!0,t}},this)}},C_=class{constructor(e){this.selfOptions=e||{},this.pipes={}}options(e){return e&&(this.selfOptions=e),this.selfOptions}pipe(e,t){let n=t;if(typeof e==`string`){if(n===void 0)return this.pipes[e];this.pipes[e]=n}if(e&&e.name){if(n=e,n.processor===this)return n;this.pipes[n.name]=n}if(!n)throw Error(`pipe is not defined: ${e}`);return n.processor=this,n}process(e,t){let n=e;n.options=this.options();let r=t||e.pipe||`default`,i;for(;r;)n.nextAfterChildren!==void 0&&(n.next=n.nextAfterChildren,n.nextAfterChildren=null),typeof r==`string`&&(r=this.pipe(r)),r.process(n),i=r,r=null,n&&n.next&&(n=n.next,r=n.pipe||i);return n.hasResult?n.result:void 0}},w_=(e,t,n,r)=>e[n]===t[r],T_=(e,t,n,r)=>{let i=e.length,a=t.length,o,s,c=Array(i+1);for(o=0;o<i+1;o++){let e=Array(a+1);for(s=0;s<a+1;s++)e[s]=0;c[o]=e}for(c.match=n,o=1;o<i+1;o++){let i=c[o];if(i===void 0)throw Error(`LCS matrix row is undefined`);let l=c[o-1];if(l===void 0)throw Error(`LCS matrix row is undefined`);for(s=1;s<a+1;s++)n(e,t,o-1,s-1,r)?i[s]=(l[s-1]??0)+1:i[s]=Math.max(l[s]??0,i[s-1]??0)}return c},E_=(e,t,n,r)=>{let i=t.length,a=n.length,o={sequence:[],indices1:[],indices2:[]};for(;i!==0&&a!==0;){if(e.match===void 0)throw Error(`LCS matrix match function is undefined`);if(e.match(t,n,i-1,a-1,r))o.sequence.unshift(t[i-1]),o.indices1.unshift(i-1),o.indices2.unshift(a-1),--i,--a;else{let t=e[i];if(t===void 0)throw Error(`LCS matrix row is undefined`);let n=t[a-1];if(n===void 0)throw Error(`LCS matrix value is undefined`);let r=e[i-1];if(r===void 0)throw Error(`LCS matrix row is undefined`);let o=r[a];if(o===void 0)throw Error(`LCS matrix value is undefined`);n>o?--a:--i}}return o},D_={get:(e,t,n,r)=>{let i=r||{};return E_(T_(e,t,n||w_,i),e,t,i)}},O_=3;function k_(e,t,n,r){for(let i=0;i<n;i++){let n=e[i];for(let e=0;e<r;e++){let r=t[e];if(i!==e&&n===r)return!0}}return!1}function A_(e,t,n,r,i){let a=e[n],o=t[r];if(a===o)return!0;if(typeof a!=`object`||typeof o!=`object`)return!1;let s=i.objectHash;if(!s)return i.matchByPosition&&n===r;i.hashCache1=i.hashCache1||[];let c=i.hashCache1[n];if(c===void 0&&(i.hashCache1[n]=c=s(a,n)),c===void 0)return!1;i.hashCache2=i.hashCache2||[];let l=i.hashCache2[r];return l===void 0&&(i.hashCache2[r]=l=s(o,r)),l!==void 0&&c===l}var j_=function(e){if(!e.leftIsArray)return;let t={objectHash:e.options?.objectHash,matchByPosition:e.options?.matchByPosition},n=0,r=0,i,a,o,s=e.left,c=e.right,l=s.length,u=c.length,d;for(l>0&&u>0&&!t.objectHash&&typeof t.matchByPosition!=`boolean`&&(t.matchByPosition=!k_(s,c,l,u));n<l&&n<u&&A_(s,c,n,n,t);)i=n,d=new y_(s[i],c[i]),e.push(d,i),n++;for(;r+n<l&&r+n<u&&A_(s,c,l-1-r,u-1-r,t);)a=l-1-r,o=u-1-r,d=new y_(s[a],c[o]),e.push(d,o),r++;let f;if(n+r===l){if(l===u){e.setResult(void 0).exit();return}for(f||={_t:`a`},i=n;i<u-r;i++)f[i]=[c[i]],e.prepareDeltaResult(f[i]);e.setResult(f).exit();return}if(n+r===u){for(f||={_t:`a`},i=n;i<l-r;i++){let t=`_${i}`;f[t]=[s[i],0,0],e.prepareDeltaResult(f[t])}e.setResult(f).exit();return}t.hashCache1=void 0,t.hashCache2=void 0;let p=s.slice(n,l-r),m=c.slice(n,u-r),h=D_.get(p,m,A_,t),g=[];for(f||={_t:`a`},i=n;i<l-r;i++)if(h.indices1.indexOf(i-n)<0){let t=`_${i}`;f[t]=[s[i],0,0],e.prepareDeltaResult(f[t]),g.push(i)}let _=!0;e.options?.arrays&&e.options.arrays.detectMove===!1&&(_=!1);let v=!1;e.options?.arrays?.includeValueOnMove&&(v=!0);let y=g.length;for(i=n;i<u-r;i++){let r=h.indices2.indexOf(i-n);if(r<0){let r=!1;if(_&&y>0)for(let l=0;l<y;l++){a=g[l];let u=a===void 0?void 0:f[`_${a}`];if(a!==void 0&&u&&A_(p,m,a-n,i-n,t)){u.splice(1,2,i,O_),u.splice(1,2,i,O_),v||(u[0]=``),o=i,d=new y_(s[a],c[o]),e.push(d,o),g.splice(l,1),r=!0;break}}r||(f[i]=[c[i]],e.prepareDeltaResult(f[i]))}else{if(h.indices1[r]===void 0)throw Error(`Invalid indexOnArray2: ${r}, seq.indices1: ${h.indices1}`);if(a=h.indices1[r]+n,h.indices2[r]===void 0)throw Error(`Invalid indexOnArray2: ${r}, seq.indices2: ${h.indices2}`);o=h.indices2[r]+n,d=new y_(s[a],c[o]),e.push(d,o)}}e.setResult(f).exit()};j_.filterName=`arrays`;var M_={numerically(e,t){return e-t},numericallyBy(e){return(t,n)=>t[e]-n[e]}},N_=function(e){if(!e.nested)return;let t=e.delta;if(t._t!==`a`)return;let n,r,i=t,a=e.left,o=[],s=[],c=[];for(n in i)if(n!==`_t`){if(n[0]===`_`){let e=n;if(i[e]!==void 0&&(i[e][2]===0||i[e][2]===O_))o.push(Number.parseInt(n.slice(1),10));else throw Error(`only removal or move can be applied at original array indices, invalid diff type: ${i[e]?.[2]}`)}else{let e=n;i[e].length===1?s.push({index:Number.parseInt(e,10),value:i[e][0]}):c.push({index:Number.parseInt(e,10),delta:i[e]})}}for(o=o.sort(M_.numerically),n=o.length-1;n>=0;n--){if(r=o[n],r===void 0)continue;let e=i[`_${r}`],t=a.splice(r,1)[0];e?.[2]===O_&&s.push({index:e[1],value:t})}s=s.sort(M_.numericallyBy(`index`));let l=s.length;for(n=0;n<l;n++){let e=s[n];e!==void 0&&a.splice(e.index,0,e.value)}let u=c.length;if(u>0)for(n=0;n<u;n++){let t=c[n];if(t===void 0)continue;let r=new b_(a[t.index],t.delta);e.push(r,t.index)}if(!e.children){e.setResult(a).exit();return}e.exit()};N_.filterName=`arrays`;var P_=function(e){if(!e||!e.children||e.delta._t!==`a`)return;let t=e.left,n=e.children.length;for(let r=0;r<n;r++){let n=e.children[r];if(n===void 0)continue;let i=n.childName;t[i]=n.result}e.setResult(t).exit()};P_.filterName=`arraysCollectChildren`;var F_=function(e){if(!e.nested){let t=e.delta;if(t[2]===O_){let n=t;e.newName=`_${n[1]}`,e.setResult([n[0],Number.parseInt(e.childName.substring(1),10),O_]).exit()}return}let t=e.delta;if(t._t!==`a`)return;let n=t;for(let t in n){if(t===`_t`)continue;let r=new x_(n[t]);e.push(r,t)}e.exit()};F_.filterName=`arrays`;var I_=(e,t,n)=>{if(typeof t==`string`&&t[0]===`_`)return Number.parseInt(t.substring(1),10);if(Array.isArray(n)&&n[2]===0)return`_${t}`;let r=+t;for(let n in e){let i=e[n];if(Array.isArray(i)){if(i[2]===O_){let e=Number.parseInt(n.substring(1),10),a=i[1];if(a===+t)return e;e<=r&&a>r?r++:e>=r&&a<r&&r--}else i[2]===0?Number.parseInt(n.substring(1),10)<=r&&r++:i.length===1&&Number.parseInt(n,10)<=r&&r--}}return r},L_=e=>{if(!e||!e.children)return;let t=e.delta;if(t._t!==`a`)return;let n=t,r=e.children.length,i={_t:`a`};for(let t=0;t<r;t++){let r=e.children[t];if(r===void 0)continue;let a=r.newName;if(a===void 0){if(r.childName===void 0)throw Error(`child.childName is undefined`);a=I_(n,r.childName,r.result)}i[a]!==r.result&&(i[a]=r.result)}e.setResult(i).exit()};L_.filterName=`arraysCollectChildren`;var R_=function(e){e.left instanceof Date?(e.right instanceof Date&&e.left.getTime()===e.right.getTime()?e.setResult(void 0):e.setResult([e.left,e.right]),e.exit()):e.right instanceof Date&&e.setResult([e.left,e.right]).exit()};R_.filterName=`dates`;var z_=new Set([`__proto__`]),B_=e=>{if(!e||!e.children)return;let t=e.children.length,n=e.result;for(let r=0;r<t;r++){let t=e.children[r];if(t!==void 0&&t.result!==void 0){if(n||={},t.childName===void 0)throw Error(`diff child.childName is undefined`);n[t.childName]=t.result}}n&&e.leftIsArray&&(n._t=`a`),e.setResult(n).exit()};B_.filterName=`collectChildren`;var V_=e=>{if(e.leftIsArray||e.leftType!==`object`)return;let t=e.left,n=e.right,r=e.options?.propertyFilter;for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i)||r&&!r(i,e))continue;let a=new y_(t[i],n[i]);e.push(a,i)}for(let i in n)if(Object.prototype.hasOwnProperty.call(n,i)&&(!r||r(i,e))&&t[i]===void 0){let t=new y_(void 0,n[i]);e.push(t,i)}if(!e.children||e.children.length===0){e.setResult(void 0).exit();return}e.exit()};V_.filterName=`objects`;var H_=function(e){if(!e.nested)return;let t=e.delta;if(t._t)return;let n=t,r=!1;for(let t in n){if(z_.has(t)||!Object.prototype.hasOwnProperty.call(n,t))continue;let i=e.left,a=new b_(typeof i==`object`&&i&&Object.prototype.hasOwnProperty.call(i,t)?i[t]:void 0,n[t]);e.push(a,t),r=!0}if(!r){e.setResult(e.left).exit();return}e.exit()};H_.filterName=`objects`;var U_=function(e){if(!e||!e.children||e.delta._t)return;if(e.left===null||typeof e.left!=`object`){e.setResult(e.left).exit();return}let t=e.left,n=e.children.length;for(let r=0;r<n;r++){let n=e.children[r];if(n===void 0)continue;let i=n.childName;z_.has(i)||(Object.prototype.hasOwnProperty.call(e.left,i)&&n.result===void 0?delete t[i]:t[i]!==n.result&&(t[i]=n.result))}e.setResult(t).exit()};U_.filterName=`collectChildren`;var W_=function(e){if(!e.nested||e.delta._t)return;let t=e.delta,n=!1;for(let r in t){if(z_.has(r)||!Object.prototype.hasOwnProperty.call(t,r))continue;let i=new x_(t[r]);e.push(i,r),n=!0}if(!n){e.setResult({}).exit();return}e.exit()};W_.filterName=`objects`;var G_=e=>{if(!e||!e.children||e.delta._t)return;let t=e.children.length,n={};for(let r=0;r<t;r++){let t=e.children[r];if(t===void 0)continue;let i=t.childName;z_.has(i)||n[i]!==t.result&&(n[i]=t.result)}e.setResult(n).exit()};G_.filterName=`collectChildren`;var K_=2,q_=60,J_=null;function Y_(e,t){if(!J_){let n;if(e?.textDiff?.diffMatchPatch)n=new e.textDiff.diffMatchPatch;else{if(!t)return null;let e=Error("The diff-match-patch library was not provided. Pass the library in through the options or use the `jsondiffpatch/with-text-diffs` entry-point.");throw e.diff_match_patch_not_found=!0,e}J_={diff:(e,t)=>n.patch_toText(n.patch_make(e,t)),patch:(e,t)=>{let r=n.patch_apply(n.patch_fromText(t),e);for(let e of r[1])if(!e){let e=Error(`text patch failed`);throw e.textPatchFailed=!0,e}return r[0]}}}return J_}var X_=function(e){if(e.leftType!==`string`)return;let t=e.left,n=e.right,r=e.options?.textDiff?.minLength||q_;if(t.length<r||n.length<r){e.setResult([t,n]).exit();return}let i=Y_(e.options);if(!i){e.setResult([t,n]).exit();return}let a=i.diff;e.setResult([a(t,n),0,K_]).exit()};X_.filterName=`texts`;var Z_=function(e){if(e.nested)return;let t=e.delta;if(t[2]!==K_)return;let n=t,r=Y_(e.options,!0).patch;e.setResult(r(e.left,n[0])).exit()};Z_.filterName=`texts`;var Q_=e=>{let t=/^@@ +-(\d+),(\d+) +\+(\d+),(\d+) +@@$/,n=e.split(`
51
+ ){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function Ch(){let e=navigator.userAgent;return typeof window<`u`&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function wh(){return kh(/^Mac/)}function Th(){return kh(/^iPhone/)}function Eh(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Dh(){return kh(/^iPad/)||wh()&&navigator.maxTouchPoints>1}function Oh(){return Th()||Dh()}function kh(e){return typeof window<`u`&&window.navigator!=null?e.test(window.navigator.platform):void 0}var Ah=24,jh=typeof window<`u`?O.useLayoutEffect:O.useEffect;function Mh(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}var Nh=typeof document<`u`&&window.visualViewport;function Ph(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function Fh(e){for(Ph(e)&&(e=e.parentElement);e&&!Ph(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}var Ih=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]),Lh=0,Rh;function zh(e={}){let{isDisabled:t}=e;jh(()=>{if(!t)return Lh++,Lh===1&&Oh()&&(Rh=Bh()),()=>{Lh--,Lh===0&&Rh?.()}},[t])}function Bh(){let e,t=0,n=n=>{e=Fh(n.target),(e!==document.documentElement||e!==document.body)&&(t=n.changedTouches[0].pageY)},r=n=>{if(!e||e===document.documentElement||e===document.body){n.preventDefault();return}let r=n.changedTouches[0].pageY,i=e.scrollTop,a=e.scrollHeight-e.clientHeight;a!==0&&((i<=0&&r>t||i>=a&&r<t)&&n.preventDefault(),t=r)},i=e=>{let t=e.target;Wh(t)&&t!==document.activeElement&&(e.preventDefault(),t.style.transform=`translateY(-2000px)`,t.focus(),requestAnimationFrame(()=>{t.style.transform=``}))},a=e=>{let t=e.target;Wh(t)&&(t.style.transform=`translateY(-2000px)`,requestAnimationFrame(()=>{t.style.transform=``,Nh&&(Nh.height<window.innerHeight?requestAnimationFrame(()=>{Uh(t)}):Nh.addEventListener(`resize`,()=>Uh(t),{once:!0}))}))},o=()=>{window.scrollTo(0,0)},s=window.pageXOffset,c=window.pageYOffset,l=Mh(Vh(document.documentElement,`paddingRight`,`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let u=Mh(Hh(document,`touchstart`,n,{passive:!1,capture:!0}),Hh(document,`touchmove`,r,{passive:!1,capture:!0}),Hh(document,`touchend`,i,{passive:!1,capture:!0}),Hh(document,`focus`,a,!0),Hh(window,`scroll`,o));return()=>{l(),u(),window.scrollTo(s,c)}}function Vh(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function Hh(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Uh(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let t=Fh(e);if(t!==document.documentElement&&t!==document.body&&t!==e){let n=t.getBoundingClientRect().top,r=e.getBoundingClientRect().top;e.getBoundingClientRect().bottom>t.getBoundingClientRect().bottom+Ah&&(t.scrollTop+=r-n)}e=t.parentElement}}function Wh(e){return e instanceof HTMLInputElement&&!Ih.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function Gh(e,t){typeof e==`function`?e(t):e!=null&&(e.current=t)}function Kh(...e){return t=>e.forEach(e=>Gh(e,t))}function qh(...e){return O.useCallback(Kh(...e),e)}var Jh=new WeakMap;function Yh(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([t,n])=>{if(t.startsWith(`--`)){e.style.setProperty(t,n);return}r[t]=e.style[t],e.style[t]=n}),!n&&Jh.set(e,r)}function Xh(e,t){if(!e||!(e instanceof HTMLElement))return;let n=Jh.get(e);n&&(e.style[t]=n[t])}var Zh=e=>{switch(e){case`top`:case`bottom`:return!0;case`left`:case`right`:return!1;default:return e}};function Qh(e,t){if(!e)return null;let n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform,i=r.match(/^matrix3d\((.+)\)$/);return i?parseFloat(i[1].split(`, `)[Zh(t)?13:12]):(i=r.match(/^matrix\((.+)\)$/),i?parseFloat(i[1].split(`, `)[Zh(t)?5:4]):null)}function $h(e){return 8*(Math.log(e+1)-2)}function eg(e,t){if(!e)return()=>{};let n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}var tg={DURATION:.5,EASE:[.32,.72,0,1]},ng=.4,rg=.25,ig=100,ag=8,og=16,sg=26,cg=`vaul-dragging`;function lg(e){let t=O.useRef(e);return O.useEffect(()=>{t.current=e}),O.useMemo(()=>(...e)=>t.current==null?void 0:t.current.call(t,...e),[])}function ug({defaultProp:e,onChange:t}){let n=O.useState(e),[r]=n,i=O.useRef(r),a=lg(t);return O.useEffect(()=>{i.current!==r&&(a(r),i.current=r)},[r,i,a]),n}function dg({prop:e,defaultProp:t,onChange:n=()=>{}}){let[r,i]=ug({defaultProp:t,onChange:n}),a=e!==void 0,o=a?e:r,s=lg(n);return[o,O.useCallback(t=>{if(a){let n=typeof t==`function`?t(e):t;n!==e&&s(n)}else i(t)},[a,e,i,s])]}function fg({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:r,overlayRef:i,fadeFromIndex:a,onSnapPointChange:o,direction:s=`bottom`,container:c,snapToSequentialPoint:l}){let[u,d]=dg({prop:e,defaultProp:n?.[0],onChange:t}),[f,p]=O.useState(typeof window<`u`?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);O.useEffect(()=>{function e(){p({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let m=O.useMemo(()=>u===n?.[n.length-1]||null,[n,u]),h=O.useMemo(()=>n?.findIndex(e=>e===u)??null,[n,u]),g=n&&n.length>0&&(a||a===0)&&!Number.isNaN(a)&&n[a]===u||!n,_=O.useMemo(()=>{let e=c?{width:c.getBoundingClientRect().width,height:c.getBoundingClientRect().height}:typeof window<`u`?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};return n?.map(t=>{let n=typeof t==`string`,r=0;if(n&&(r=parseInt(t,10)),Zh(s)){let i=n?r:f?t*e.height:0;return f?s===`bottom`?e.height-i:-e.height+i:i}let i=n?r:f?t*e.width:0;return f?s===`right`?e.width-i:-e.width+i:i})??[]},[n,f,c]),v=O.useMemo(()=>h===null?null:_?.[h],[_,h]),y=O.useCallback(e=>{let t=_?.findIndex(t=>t===e)??null;o(t),Yh(r.current,{transition:`transform ${tg.DURATION}s cubic-bezier(${tg.EASE.join(`,`)})`,transform:Zh(s)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`}),_&&t!==_.length-1&&a!==void 0&&t!==a&&t<a?Yh(i.current,{transition:`opacity ${tg.DURATION}s cubic-bezier(${tg.EASE.join(`,`)})`,opacity:`0`}):Yh(i.current,{transition:`opacity ${tg.DURATION}s cubic-bezier(${tg.EASE.join(`,`)})`,opacity:`1`}),d(n?.[Math.max(t,0)])},[r.current,n,_,a,i,d]);O.useEffect(()=>{if(u||e){let t=n?.findIndex(t=>t===e||t===u)??-1;_&&t!==-1&&typeof _[t]==`number`&&y(_[t])}},[u,e,n,_,y]);function b({draggedDistance:e,closeDrawer:t,velocity:r,dismissible:o}){if(a===void 0)return;let c=s===`bottom`||s===`right`?(v??0)-e:(v??0)+e,u=h===a-1,d=h===0,f=e>0;if(u&&Yh(i.current,{transition:`opacity ${tg.DURATION}s cubic-bezier(${tg.EASE.join(`,`)})`}),!l&&r>2&&!f){o?t():y(_[0]);return}if(!l&&r>2&&f&&_&&n){y(_[n.length-1]);return}let p=_?.reduce((e,t)=>typeof e!=`number`||typeof t!=`number`?e:Math.abs(t-c)<Math.abs(e-c)?t:e),g=Zh(s)?window.innerHeight:window.innerWidth;if(r>ng&&Math.abs(e)<g*.4){let e=f?1:-1;if(e>0&&m&&n){y(_[n.length-1]);return}if(d&&e<0&&o&&t(),h===null)return;y(_[h+e]);return}y(p)}function x({draggedDistance:e}){if(v===null)return;let t=s===`bottom`||s===`right`?v-e:v+e;(s===`bottom`||s===`right`)&&t<_[_.length-1]||(s===`top`||s===`left`)&&t>_[_.length-1]||Yh(r.current,{transform:Zh(s)?`translate3d(0, ${t}px, 0)`:`translate3d(${t}px, 0, 0)`})}function S(e,t){if(!n||typeof h!=`number`||!_||a===void 0)return null;let r=h===a-1;if(h>=a&&t)return 0;if(r&&!t)return 1;if(!g&&!r)return null;let i=r?h+1:h-1,o=r?_[i]-_[i-1]:_[i+1]-_[i],s=e/Math.abs(o);return r?1-s:s}return{isLastSnapPoint:m,activeSnapPoint:u,shouldFade:g,getPercentageDragged:S,setActiveSnapPoint:d,activeSnapPointIndex:h,onRelease:b,onDrag:x,snapPointsOffset:_}}function pg(){let{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:i}=Sh(),a=O.useRef(null),o=(0,O.useMemo)(()=>document.body.style.backgroundColor,[]);function s(){return(window.innerWidth-sg)/window.innerWidth}O.useEffect(()=>{if(t&&n){a.current&&clearTimeout(a.current);let t=document.querySelector(`[data-vaul-drawer-wrapper]`)||document.querySelector(`[vaul-drawer-wrapper]`);if(!t)return;r&&!i&&eg(document.body,{background:`black`}),eg(t,{transformOrigin:Zh(e)?`top`:`left`,transitionProperty:`transform, border-radius`,transitionDuration:`${tg.DURATION}s`,transitionTimingFunction:`cubic-bezier(${tg.EASE.join(`,`)})`});let n=eg(t,{borderRadius:`${ag}px`,overflow:`hidden`,...Zh(e)?{transform:`scale(${s()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${s()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{n(),a.current=window.setTimeout(()=>{o?document.body.style.background=o:document.body.style.removeProperty(`background`)},tg.DURATION*1e3)}}},[t,n,o])}var mg=null;function hg({isOpen:e,modal:t,nested:n,hasBeenOpened:r,preventScrollRestoration:i,noBodyStyles:a}){let[o,s]=O.useState(()=>typeof window<`u`?window.location.href:``),c=O.useRef(0),l=O.useCallback(()=>{if(Eh()&&mg===null&&e&&!a){mg={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:`unset`};let{scrollX:e,innerHeight:t}=window;document.body.style.setProperty(`position`,`fixed`,`important`),Object.assign(document.body.style,{top:`${-c.current}px`,left:`${-e}px`,right:`0px`,height:`auto`}),window.setTimeout(()=>window.requestAnimationFrame(()=>{let e=t-window.innerHeight;e&&c.current>=t&&(document.body.style.top=`${-(c.current+e)}px`)}),300)}},[e]),u=O.useCallback(()=>{if(Eh()&&mg!==null&&!a){let e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);Object.assign(document.body.style,mg),window.requestAnimationFrame(()=>{if(i&&o!==window.location.href){s(window.location.href);return}window.scrollTo(t,e)}),mg=null}},[o]);return O.useEffect(()=>{function e(){c.current=window.scrollY}return e(),window.addEventListener(`scroll`,e),()=>{window.removeEventListener(`scroll`,e)}},[]),O.useEffect(()=>{if(t)return()=>{typeof document>`u`||document.querySelector(`[data-vaul-drawer]`)||u()}},[t,u]),O.useEffect(()=>{!n&&r&&(e?(!window.matchMedia(`(display-mode: standalone)`).matches&&l(),t||window.setTimeout(()=>{u()},500)):u())},[e,r,o,t,n,l,u]),{restorePositionSetting:u}}function gg({open:e,onOpenChange:t,children:n,onDrag:r,onRelease:i,snapPoints:a,shouldScaleBackground:o=!1,setBackgroundColorOnScale:s=!0,closeThreshold:c=rg,scrollLockTimeout:l=ig,dismissible:u=!0,handleOnly:d=!1,fadeFromIndex:f=a&&a.length-1,activeSnapPoint:p,setActiveSnapPoint:m,fixed:h,modal:g=!0,onClose:_,nested:v,noBodyStyles:y=!1,direction:b=`bottom`,defaultOpen:x=!1,disablePreventScroll:S=!0,snapToSequentialPoint:C=!1,preventScrollRestoration:w=!1,repositionInputs:T=!0,onAnimationEnd:E,container:D,autoFocus:k=!1}){let[A=!1,j]=dg({defaultProp:x,prop:e,onChange:e=>{t?.(e),!e&&!v&&Ce(),setTimeout(()=>{E?.(e)},tg.DURATION*1e3),e&&!g&&typeof window<`u`&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents=`auto`}),e||(document.body.style.pointerEvents=`auto`)}}),[M,N]=O.useState(!1),[ee,te]=O.useState(!1),[P,ne]=O.useState(!1),re=O.useRef(null),ie=O.useRef(null),ae=O.useRef(null),oe=O.useRef(null),se=O.useRef(null),ce=O.useRef(!1),le=O.useRef(null),ue=O.useRef(0),de=O.useRef(!1),fe=O.useRef(!x),pe=O.useRef(0),F=O.useRef(null),me=O.useRef(F.current?.getBoundingClientRect().height||0),I=O.useRef(F.current?.getBoundingClientRect().width||0),L=O.useRef(0),{activeSnapPoint:he,activeSnapPointIndex:ge,setActiveSnapPoint:_e,onRelease:ve,snapPointsOffset:ye,onDrag:be,shouldFade:xe,getPercentageDragged:Se}=fg({snapPoints:a,activeSnapPointProp:p,setActiveSnapPointProp:m,drawerRef:F,fadeFromIndex:f,overlayRef:re,onSnapPointChange:O.useCallback(e=>{a&&e===ye.length-1&&(ie.current=new Date)},[]),direction:b,container:D,snapToSequentialPoint:C});zh({isDisabled:!A||ee||!g||P||!M||!T||!S});let{restorePositionSetting:Ce}=hg({isOpen:A,modal:g,nested:v??!1,hasBeenOpened:M,preventScrollRestoration:w,noBodyStyles:y});function we(){return(window.innerWidth-sg)/window.innerWidth}function Te(e){(u||a)&&(!F.current||F.current.contains(e.target))&&(me.current=F.current?.getBoundingClientRect().height||0,I.current=F.current?.getBoundingClientRect().width||0,te(!0),ae.current=new Date,Oh()&&window.addEventListener(`touchend`,()=>ce.current=!1,{once:!0}),e.target.setPointerCapture(e.pointerId),ue.current=Zh(b)?e.pageY:e.pageX)}function Ee(e,t){let n=e,r=window.getSelection()?.toString(),i=F.current?Qh(F.current,b):null,a=new Date;if(n.tagName===`SELECT`||n.hasAttribute(`data-vaul-no-drag`)||n.closest(`[data-vaul-no-drag]`))return!1;if(b===`right`||b===`left`)return!0;if(ie.current&&a.getTime()-ie.current.getTime()<500)return!1;if(i!==null&&(b===`bottom`?i>0:i<0))return!0;if(r&&r.length>0)return!1;if(se.current&&a.getTime()-se.current.getTime()<l&&i===0||t)return se.current=a,!1;for(;n;){if(n.scrollHeight>n.clientHeight){if(n.scrollTop!==0)return se.current=new Date,!1;if(n.getAttribute(`role`)===`dialog`)return!0}n=n.parentNode}return!0}function De(e){if(F.current&&ee){let t=b===`bottom`||b===`right`?1:-1,n=(ue.current-(Zh(b)?e.pageY:e.pageX))*t,i=n>0,s=a&&!u&&!i;if(s&&ge===0)return;let c=Math.abs(n),l=document.querySelector(`[data-vaul-drawer-wrapper]`),d=c/(b===`bottom`||b===`top`?me.current:I.current),p=Se(c,i);if(p!==null&&(d=p),s&&d>=1||!ce.current&&!Ee(e.target,i))return;if(F.current.classList.add(cg),ce.current=!0,Yh(F.current,{transition:`none`}),Yh(re.current,{transition:`none`}),a&&be({draggedDistance:n}),i&&!a){let e=$h(n),r=Math.min(e*-1,0)*t;Yh(F.current,{transform:Zh(b)?`translate3d(0, ${r}px, 0)`:`translate3d(${r}px, 0, 0)`});return}let m=1-d;if((xe||f&&ge===f-1)&&(r?.(e,d),Yh(re.current,{opacity:`${m}`,transition:`none`},!0)),l&&re.current&&o){let e=Math.min(we()+d*(1-we()),1),t=8-d*8,n=Math.max(0,14-d*14);Yh(l,{borderRadius:`${t}px`,transform:Zh(b)?`scale(${e}) translate3d(0, ${n}px, 0)`:`scale(${e}) translate3d(${n}px, 0, 0)`,transition:`none`},!0)}if(!a){let e=c*t;Yh(F.current,{transform:Zh(b)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})}}}O.useEffect(()=>{window.requestAnimationFrame(()=>{fe.current=!0})},[]),O.useEffect(()=>{var e;function t(){if(!F.current||!T)return;let e=document.activeElement;if(Wh(e)||de.current){let e=window.visualViewport?.height||0,t=window.innerHeight,n=t-e,r=F.current.getBoundingClientRect().height||0,i=r>t*.8;L.current||=r;let o=F.current.getBoundingClientRect().top;if(Math.abs(pe.current-n)>60&&(de.current=!de.current),a&&a.length>0&&ye&&ge){let e=ye[ge]||0;n+=e}if(pe.current=n,r>e||de.current){let t=F.current.getBoundingClientRect().height,r=t;t>e&&(r=e-(i?o:sg)),h?F.current.style.height=`${t-Math.max(n,0)}px`:F.current.style.height=`${Math.max(r,e-o)}px`}else Ch()||(F.current.style.height=`${L.current}px`);a&&a.length>0&&!de.current?F.current.style.bottom=`0px`:F.current.style.bottom=`${Math.max(n,0)}px`}}return(e=window.visualViewport)==null||e.addEventListener(`resize`,t),()=>window.visualViewport?.removeEventListener(`resize`,t)},[ge,a,ye]);function Oe(e){Ae(),_?.(),e||j(!1),setTimeout(()=>{a&&_e(a[0])},tg.DURATION*1e3)}function ke(){if(!F.current)return;let e=document.querySelector(`[data-vaul-drawer-wrapper]`),t=Qh(F.current,b);Yh(F.current,{transform:`translate3d(0, 0, 0)`,transition:`transform ${tg.DURATION}s cubic-bezier(${tg.EASE.join(`,`)})`}),Yh(re.current,{transition:`opacity ${tg.DURATION}s cubic-bezier(${tg.EASE.join(`,`)})`,opacity:`1`}),o&&t&&t>0&&A&&Yh(e,{borderRadius:`${ag}px`,overflow:`hidden`,...Zh(b)?{transform:`scale(${we()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:`top`}:{transform:`scale(${we()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:`left`},transitionProperty:`transform, border-radius`,transitionDuration:`${tg.DURATION}s`,transitionTimingFunction:`cubic-bezier(${tg.EASE.join(`,`)})`},!0)}function Ae(){ee&&F.current&&(F.current.classList.remove(cg),ce.current=!1,te(!1),oe.current=new Date)}function je(e){if(!ee||!F.current)return;F.current.classList.remove(cg),ce.current=!1,te(!1),oe.current=new Date;let t=Qh(F.current,b);if(!e||!Ee(e.target,!1)||!t||Number.isNaN(t)||ae.current===null)return;let n=oe.current.getTime()-ae.current.getTime(),r=ue.current-(Zh(b)?e.pageY:e.pageX),o=Math.abs(r)/n;if(o>.05&&(ne(!0),setTimeout(()=>{ne(!1)},200)),a){ve({draggedDistance:r*(b===`bottom`||b===`right`?1:-1),closeDrawer:Oe,velocity:o,dismissible:u}),i?.(e,!0);return}if(b===`bottom`||b===`right`?r>0:r<0){ke(),i?.(e,!0);return}if(o>ng){Oe(),i?.(e,!1);return}let s=Math.min(F.current.getBoundingClientRect().height??0,window.innerHeight),l=Math.min(F.current.getBoundingClientRect().width??0,window.innerWidth);if(Math.abs(t)>=(b===`left`||b===`right`?l:s)*c){Oe(),i?.(e,!1);return}i?.(e,!0),ke()}O.useEffect(()=>(A&&(Yh(document.documentElement,{scrollBehavior:`auto`}),ie.current=new Date),()=>{Xh(document.documentElement,`scrollBehavior`)}),[A]);function Me(e){let t=e?(window.innerWidth-og)/window.innerWidth:1,n=e?-16:0;le.current&&window.clearTimeout(le.current),Yh(F.current,{transition:`transform ${tg.DURATION}s cubic-bezier(${tg.EASE.join(`,`)})`,transform:Zh(b)?`scale(${t}) translate3d(0, ${n}px, 0)`:`scale(${t}) translate3d(${n}px, 0, 0)`}),!e&&F.current&&(le.current=setTimeout(()=>{let e=Qh(F.current,b);Yh(F.current,{transition:`none`,transform:Zh(b)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})},500))}function Ne(e,t){if(t<0)return;let n=(window.innerWidth-og)/window.innerWidth,r=n+t*(1-n),i=-16+t*og;Yh(F.current,{transform:Zh(b)?`scale(${r}) translate3d(0, ${i}px, 0)`:`scale(${r}) translate3d(${i}px, 0, 0)`,transition:`none`})}function Pe(e,t){let n=Zh(b)?window.innerHeight:window.innerWidth,r=t?(n-og)/n:1,i=t?-16:0;t&&Yh(F.current,{transition:`transform ${tg.DURATION}s cubic-bezier(${tg.EASE.join(`,`)})`,transform:Zh(b)?`scale(${r}) translate3d(0, ${i}px, 0)`:`scale(${r}) translate3d(${i}px, 0, 0)`})}return O.useEffect(()=>{g||window.requestAnimationFrame(()=>{document.body.style.pointerEvents=`auto`})},[g]),O.createElement(Pi,{defaultOpen:x,onOpenChange:e=>{(u||e)&&(e?N(!0):Oe(!0),j(e))},open:A},O.createElement(xh.Provider,{value:{activeSnapPoint:he,snapPoints:a,setActiveSnapPoint:_e,drawerRef:F,overlayRef:re,onOpenChange:t,onPress:Te,onRelease:je,onDrag:De,dismissible:u,shouldAnimate:fe,handleOnly:d,isOpen:A,isDragging:ee,shouldFade:xe,closeDrawer:Oe,onNestedDrag:Ne,onNestedOpenChange:Me,onNestedRelease:Pe,keyboardIsOpen:de,modal:g,snapPointsOffset:ye,activeSnapPointIndex:ge,direction:b,shouldScaleBackground:o,setBackgroundColorOnScale:s,noBodyStyles:y,container:D,autoFocus:k}},n))}var _g=O.forwardRef(function({...e},t){let{overlayRef:n,snapPoints:r,onRelease:i,shouldFade:a,isOpen:o,modal:s,shouldAnimate:c}=Sh(),l=qh(t,n),u=r&&r.length>0;if(!s)return null;let d=O.useCallback(e=>i(e),[i]);return O.createElement(Hi,{onMouseUp:d,ref:l,"data-vaul-overlay":``,"data-vaul-snap-points":o&&u?`true`:`false`,"data-vaul-snap-points-overlay":o&&a?`true`:`false`,"data-vaul-animate":c?.current?`true`:`false`,...e})});_g.displayName=`Drawer.Overlay`;var vg=O.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...r},i){let{drawerRef:a,onPress:o,onRelease:s,onDrag:c,keyboardIsOpen:l,snapPointsOffset:u,activeSnapPointIndex:d,modal:f,isOpen:p,direction:m,snapPoints:h,container:g,handleOnly:_,shouldAnimate:v,autoFocus:y}=Sh(),[b,x]=O.useState(!1),S=qh(i,a),C=O.useRef(null),w=O.useRef(null),T=O.useRef(!1),E=h&&h.length>0;pg();let D=(e,t,n=0)=>{if(T.current)return!0;let r=Math.abs(e.y),i=Math.abs(e.x),a=i>r,o=[`bottom`,`right`].includes(t)?1:-1;if(t===`left`||t===`right`){if(!(e.x*o<0)&&i>=0&&i<=n)return a}else if(!(e.y*o<0)&&r>=0&&r<=n)return!a;return T.current=!0,!0};O.useEffect(()=>{E&&window.requestAnimationFrame(()=>{x(!0)})},[]);function k(e){C.current=null,T.current=!1,s(e)}return O.createElement(Ki,{"data-vaul-drawer-direction":m,"data-vaul-drawer":``,"data-vaul-delayed-snap-points":b?`true`:`false`,"data-vaul-snap-points":p&&E?`true`:`false`,"data-vaul-custom-container":g?`true`:`false`,"data-vaul-animate":v?.current?`true`:`false`,...r,ref:S,style:u&&u.length>0?{"--snap-point-height":`${u[d??0]}px`,...t}:t,onPointerDown:e=>{_||(r.onPointerDown==null||r.onPointerDown.call(r,e),C.current={x:e.pageX,y:e.pageY},o(e))},onOpenAutoFocus:e=>{n?.(e),y||e.preventDefault()},onPointerDownOutside:t=>{if(e?.(t),!f||t.defaultPrevented){t.preventDefault();return}l.current&&=!1},onFocusOutside:e=>{if(!f){e.preventDefault();return}},onPointerMove:e=>{if(w.current=e,_||(r.onPointerMove==null||r.onPointerMove.call(r,e),!C.current))return;let t=e.pageY-C.current.y,n=e.pageX-C.current.x,i=e.pointerType===`touch`?10:2;D({x:n,y:t},m,i)?c(e):(Math.abs(n)>i||Math.abs(t)>i)&&(C.current=null)},onPointerUp:e=>{r.onPointerUp==null||r.onPointerUp.call(r,e),C.current=null,T.current=!1,s(e)},onPointerOut:e=>{r.onPointerOut==null||r.onPointerOut.call(r,e),k(w.current)},onContextMenu:e=>{r.onContextMenu==null||r.onContextMenu.call(r,e),w.current&&k(w.current)}})});vg.displayName=`Drawer.Content`;var yg=250,bg=120,xg=O.forwardRef(function({preventCycle:e=!1,children:t,...n},r){let{closeDrawer:i,isDragging:a,snapPoints:o,activeSnapPoint:s,setActiveSnapPoint:c,dismissible:l,handleOnly:u,isOpen:d,onPress:f,onDrag:p}=Sh(),m=O.useRef(null),h=O.useRef(!1);function g(){if(h.current){y();return}window.setTimeout(()=>{_()},bg)}function _(){if(a||e||h.current){y();return}if(y(),!o||o.length===0){l||i();return}if(s===o[o.length-1]&&l){i();return}let t=o.findIndex(e=>e===s);if(t===-1)return;let n=o[t+1];c(n)}function v(){m.current=window.setTimeout(()=>{h.current=!0},yg)}function y(){m.current&&window.clearTimeout(m.current),h.current=!1}return O.createElement(`div`,{onClick:g,onPointerCancel:y,onPointerDown:e=>{u&&f(e),v()},onPointerMove:e=>{u&&p(e)},ref:r,"data-vaul-drawer-visible":d?`true`:`false`,"data-vaul-handle":``,"aria-hidden":`true`,...n},O.createElement(`span`,{"data-vaul-handle-hitarea":``,"aria-hidden":`true`},t))});xg.displayName=`Drawer.Handle`;function Sg({onDrag:e,onOpenChange:t,open:n,...r}){let{onNestedDrag:i,onNestedOpenChange:a,onNestedRelease:o}=Sh();if(!i)throw Error(`Drawer.NestedRoot must be placed in another drawer`);return O.createElement(gg,{nested:!0,open:n,onClose:()=>{a(!1)},onDrag:(t,n)=>{i(t,n),e?.(t,n)},onOpenChange:e=>{e&&a(e),t?.(e)},onRelease:o,...r})}function Cg(e){let t=Sh(),{container:n=t.container,...r}=e;return O.createElement(Bi,{container:n,...r})}var wg={Root:gg,NestedRoot:Sg,Content:vg,Overlay:_g,Trigger:Ii,Portal:Cg,Handle:xg,Close:ta,Title:Zi,Description:$i};function Tg({...e}){return(0,R.jsx)(wg.Root,{"data-slot":`drawer`,...e})}function Eg({...e}){return(0,R.jsx)(wg.Portal,{"data-slot":`drawer-portal`,...e})}function Dg({...e}){return(0,R.jsx)(wg.Close,{"data-slot":`drawer-close`,...e})}function Og({className:e,...t}){return(0,R.jsx)(wg.Overlay,{"data-slot":`drawer-overlay`,className:G(`la:fixed la:inset-0 la:z-50 la:bg-black/50 la:data-[state=closed]:animate-out la:data-[state=closed]:fade-out-0 la:data-[state=open]:animate-in la:data-[state=open]:fade-in-0`,e),...t})}function kg({className:e,children:t,container:n,...r}){return(0,R.jsxs)(Eg,{container:n,children:[(0,R.jsx)(Og,{}),(0,R.jsxs)(wg.Content,{"data-slot":`drawer-content`,className:G(`la-observer la:group/drawer-content la:fixed la:z-50 la:flex la:h-auto la:flex-col la:bg-background`,`la:data-[vaul-drawer-direction=top]:inset-x-0 la:data-[vaul-drawer-direction=top]:top-0 la:data-[vaul-drawer-direction=top]:mb-24 la:data-[vaul-drawer-direction=top]:max-h-[80vh] la:data-[vaul-drawer-direction=top]:rounded-b-lg la:data-[vaul-drawer-direction=top]:border-b`,`la:data-[vaul-drawer-direction=bottom]:inset-x-0 la:data-[vaul-drawer-direction=bottom]:bottom-0 la:data-[vaul-drawer-direction=bottom]:mt-24 la:data-[vaul-drawer-direction=bottom]:max-h-[80vh] la:data-[vaul-drawer-direction=bottom]:rounded-t-lg la:data-[vaul-drawer-direction=bottom]:border-t`,`la:data-[vaul-drawer-direction=right]:inset-y-0 la:data-[vaul-drawer-direction=right]:right-0 la:data-[vaul-drawer-direction=right]:w-3/4 la:data-[vaul-drawer-direction=right]:border-l la:data-[vaul-drawer-direction=right]:sm:max-w-sm`,`la:data-[vaul-drawer-direction=left]:inset-y-0 la:data-[vaul-drawer-direction=left]:left-0 la:data-[vaul-drawer-direction=left]:w-3/4 la:data-[vaul-drawer-direction=left]:border-r la:data-[vaul-drawer-direction=left]:sm:max-w-sm`,e),...r,children:[(0,R.jsx)(`div`,{className:`la:mx-auto la:mt-4 la:hidden la:h-2 la:w-[100px] la:shrink-0 la:rounded-full la:bg-muted la:group-data-[vaul-drawer-direction=bottom]/drawer-content:block`}),t]})]})}function Ag({className:e,...t}){return(0,R.jsx)(`div`,{"data-slot":`drawer-header`,className:G(`la:flex la:flex-col la:gap-0.5 la:p-4 la:group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center la:group-data-[vaul-drawer-direction=top]/drawer-content:text-center la:md:gap-1.5 la:md:text-left`,e),...t})}function jg({className:e,...t}){return(0,R.jsx)(wg.Title,{"data-slot":`drawer-title`,className:G(`la:font-semibold la:text-foreground`,e),...t})}function Mg({className:e,...t}){return(0,R.jsx)(wg.Description,{"data-slot":`drawer-description`,className:G(`la:text-sm la:text-muted-foreground`,e),...t})}function Ng({className:e,size:t=`default`,...n}){return(0,R.jsxs)(`div`,{className:`la:group/native-select la:relative la:w-fit la:has-[select:disabled]:opacity-50`,"data-slot":`native-select-wrapper`,children:[(0,R.jsx)(`select`,{"data-slot":`native-select`,"data-size":t,className:G(`la:h-9 la:w-full la:min-w-0 la:appearance-none la:rounded-md la:border la:border-input la:bg-transparent la:px-3 la:py-2 la:pr-9 la:text-sm la:shadow-xs la:outline-none la:transition-[color,box-shadow] la:selection:bg-primary la:selection:text-primary-foreground la:disabled:pointer-events-none la:disabled:cursor-not-allowed la:data-[size=sm]:h-8 la:data-[size=sm]:py-1 la:focus-visible:border-ring la:focus-visible:ring-[3px] la:focus-visible:ring-ring/50 la:aria-invalid:border-destructive la:aria-invalid:ring-destructive/20 la:dark:bg-input/30 la:dark:hover:bg-input/50 la:dark:aria-invalid:ring-destructive/40`,e),...n}),(0,R.jsx)(de,{className:`la:pointer-events-none la:absolute la:top-1/2 la:right-3.5 la:size-4 la:-translate-y-1/2 la:text-muted-foreground la:opacity-50 la:select-none`,"aria-hidden":`true`,"data-slot":`native-select-icon`})]})}function Pg({className:e,...t}){return(0,R.jsx)(`option`,{"data-slot":`native-select-option`,className:G(`la:bg-[Canvas] la:text-[CanvasText]`,e),...t})}function Fg({className:e,containerProps:t,...n}){return(0,R.jsx)(`div`,{...t,"data-slot":`table-container`,className:G(`la:relative la:w-full la:overflow-x-auto`,t?.className),children:(0,R.jsx)(`table`,{"data-slot":`table`,className:G(`la:w-full la:caption-bottom la:text-sm la:tabular-nums`,e),...n})})}function Ig({className:e,...t}){return(0,R.jsx)(`thead`,{"data-slot":`table-header`,className:G(`la:[&_tr]:border-b`,e),...t})}function Lg({className:e,...t}){return(0,R.jsx)(`tbody`,{"data-slot":`table-body`,className:G(`la:[&_tr:last-child]:border-0`,e),...t})}function Rg({className:e,...t}){return(0,R.jsx)(`tr`,{"data-slot":`table-row`,className:G(`la:border-b la:transition-colors la:duration-150 la:hover:bg-muted/60 la:data-[state=selected]:bg-muted`,e),...t})}function Q({className:e,...t}){return(0,R.jsx)(`th`,{"data-slot":`table-head`,className:G(`la:h-10 la:whitespace-nowrap la:px-3 la:text-left la:align-middle la:text-xs la:font-medium la:text-muted-foreground la:[&:has([role=checkbox])]:pr-0 la:[&>[role=checkbox]]:translate-y-[2px]`,e),...t})}function $({className:e,...t}){return(0,R.jsx)(`td`,{"data-slot":`table-cell`,className:G(`la:whitespace-nowrap la:px-3 la:py-2.5 la:align-middle la:[&:has([role=checkbox])]:pr-0 la:[&>[role=checkbox]]:translate-y-[2px]`,e),...t})}function zg(e){let[t,n]=(0,O.useState)(0),[r,i]=(0,O.useState)(),[a,o]=(0,O.useState)(!0),[s,c]=(0,O.useState)(!1);return(0,O.useEffect)(()=>{let t=new AbortController,n,r=1e3;return c(!1),o(!0),s(),()=>{t.abort(),clearTimeout(n)};function a(n){t.signal.aborted||(i({client:e,inventory:n,updatedAt:Date.now()}),c(!1),o(!1),r=1e3)}async function s(){try{if(e.watchActors){if(await e.watchActors(a,t.signal),!t.signal.aborted)throw Error(`Stream ended`)}else o(!0),a(await e.listActors(t.signal))}catch{t.signal.aborted||c(!0)}finally{t.signal.aborted||(o(!1),n=setTimeout(s,e.watchActors?r:5e3),r=Math.min(r*2,1e4))}}},[e,t]),{updatedAt:r?.client===e?r.updatedAt:void 0,inventory:r?.client===e?r.inventory:void 0,loading:a,failed:s,retry:()=>n(e=>e+1)}}function Bg(e,t=!0){let[n,r]=(0,O.useState)(),[i,a]=(0,O.useState)(!1),[o,s]=(0,O.useState)(0);return(0,O.useEffect)(()=>r(void 0),[e]),(0,O.useEffect)(()=>{if(!t)return;let n,i=new AbortController,o,s=1e3;async function c(){try{if(!e.watchRequests)throw Error(`Request traces unavailable`);if(await e.watchRequests(e=>{i.signal.aborted||(n=e.resumeCursor,r(t=>Vg(t,e)),a(!1),s=1e3)},i.signal,n),!i.signal.aborted)throw Error(`Request stream disconnected`)}catch{i.signal.aborted||a(!0)}finally{i.signal.aborted||(o=setTimeout(c,s),s=Math.min(s*2,1e4))}}return a(!1),c(),()=>{i.abort(),clearTimeout(o)}},[e,o,t]),{page:n,failed:i,retry:()=>s(e=>e+1)}}function Vg(e,t){let n=new Map((e?.epoch===t.epoch&&!t.reset?e.records:[]).map(e=>[e.eventId??e.sequence,e]));for(let e of t.records)n.set(e.eventId??e.sequence,e);return{...t,reset:t.reset||e?.epoch===t.epoch&&e.reset,records:[...n.values()].sort((e,t)=>t.sequence-e.sequence).slice(0,t.capacity)}}function Hg(e,t,n,r=1e4){let i=n?JSON.stringify(t):void 0,[a,o]=(0,O.useState)(0),[s,c]=(0,O.useState)(),[l,u]=(0,O.useState)(!1),[d,f]=(0,O.useState)(!1);(0,O.useEffect)(()=>{if(!i)return;let t=new AbortController,a;return u(!1),f(!0),o(),()=>{t.abort(),clearTimeout(a)};async function o(){try{let r=await n.call(e,JSON.parse(i),t.signal);if(t.signal.aborted)return;c({client:e,key:i,value:r,updatedAt:Date.now()}),u(!1)}catch{t.signal.aborted||u(!0)}finally{t.signal.aborted||(f(!1),a=setTimeout(o,r))}}},[e,n,i,a,r]);let p=s&&s.client===e&&s.key===i?s:void 0;return{supported:!!n,value:p?.value,updatedAt:p?.updatedAt,loading:d,failed:l,retry:()=>o(e=>e+1)}}function Ug(e,t){let[n,r]=(0,O.useState)(),[i,a]=(0,O.useState)(!1),[o,s]=(0,O.useState)(!1),c=(0,O.useRef)(()=>{});return(0,O.useEffect)(()=>{if(r(void 0),s(!1),a(!1),!t)return;let n=new AbortController,i=!1;c.current=e=>{i||n.signal.aborted||(i=!0,a(!0),s(!1),o(e))};async function o(o){try{if(!e.listRequests)throw Error(`History is unavailable`);let i=await e.listRequests({...t,cursor:o},n.signal);if(n.signal.aborted)return;r(e=>{if(!o||!e||i.reset||e.epoch!==i.epoch)return i;let t=new Map(e.records.map(e=>[e.eventId??e.sequence,e]));for(let e of i.records)t.set(e.eventId??e.sequence,e);return{...i,reset:e.reset||i.reset,records:[...t.values()]}})}catch{n.signal.aborted||s(!0)}finally{i=!1,n.signal.aborted||a(!1)}}return c.current(),()=>n.abort()},[e,t]),{page:n,loading:i,failed:o,loadOlder:()=>c.current(n?.nextCursor??void 0),retry:()=>c.current(n?.nextCursor??void 0)}}function Wg({client:e,actor:t,timeRange:n,onTimeRangeChange:r,focus:i}){let[a,o]=(0,O.useState)(),[s,c]=(0,O.useState)(ah),l=n??s,u=r??c,d=Ug(e,(0,O.useMemo)(()=>a?{...a,...t,...a.requestId||a.connectionId?{}:oh(l,Date.now())}:void 0,[a,t?.actorName,t?.actorId,l])),{page:f,failed:p,retry:m}=Bg(e),[h,g]=(0,O.useState)(),[_,v]=(0,O.useState)(),[y,b]=(0,O.useState)(`waterfall`),x=(0,O.useRef)(null),S=(0,O.useRef)(null),C=t?`h3`:`h1`,w=a?d.page:h??f,T=f??d.page,E=(w?.records??[]).filter(e=>!t||e.actorName===t.actorName&&e.actorId===t.actorId);return(0,O.useEffect)(()=>{g(void 0),o(void 0)},[e,t?.actorName,t?.actorId]),(0,O.useEffect)(()=>{i&&o(i)},[i]),(0,O.useEffect)(()=>v(void 0),[e,f?.epoch,a,t?.actorName,t?.actorId]),(0,R.jsxs)(`section`,{ref:x,className:`la-observer la-requests`,"aria-label":`Request observer`,children:[(a?.requestId||a?.connectionId)&&(0,R.jsxs)(`p`,{children:[`Showing `,a.requestId?`request ${a.requestId}`:`connection ${a?.connectionId}`,` `,(0,R.jsx)(K,{variant:`link`,onClick:()=>o(void 0),children:`Clear filter`})]}),(0,R.jsxs)(`div`,{className:`la-observer-toolbar`,children:[(0,R.jsxs)(`div`,{className:t?`la:sr-only`:void 0,children:[(0,R.jsx)(C,{children:`Requests`}),(0,R.jsx)(`p`,{children:t?`Method calls and WebSocket events for this instance.`:`Method calls and WebSocket events, with time spent waiting and processing.`})]}),(0,R.jsxs)(`div`,{className:`la-request-actions`,children:[(0,R.jsxs)(`div`,{className:`request-view-toggle`,role:`group`,"aria-label":`Request view`,children:[(0,R.jsxs)(K,{variant:y===`waterfall`?`secondary`:`ghost`,"aria-pressed":y===`waterfall`,onClick:()=>b(`waterfall`),children:[(0,R.jsx)(le,{"aria-hidden":`true`}),`Waterfall`]}),(0,R.jsxs)(K,{variant:y===`table`?`secondary`:`ghost`,"aria-pressed":y===`table`,onClick:()=>b(`table`),children:[(0,R.jsx)(Se,{"aria-hidden":`true`}),`Table`]})]}),e.listRequests&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(K,{variant:a?`outline`:`secondary`,"aria-pressed":!a,onClick:()=>{o(void 0),g(void 0)},children:`Live`}),(0,R.jsx)(K,{variant:a?`secondary`:`outline`,"aria-pressed":!!a,onClick:()=>{a||o({})},children:`History`})]}),!a&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(K,{variant:`outline`,disabled:!w,onClick:()=>g(h?void 0:f),children:[h?(0,R.jsx)(Ee,{"aria-hidden":`true`}):(0,R.jsx)(we,{"aria-hidden":`true`}),h?`Resume`:`Pause`]}),p&&(0,R.jsxs)(K,{variant:`outline`,onClick:m,children:[(0,R.jsx)(Oe,{"aria-hidden":`true`}),`Retry`]})]})]})]}),a&&(0,R.jsx)(Gg,{query:a,range:l,onRangeChange:u,loading:d.loading,onSearch:o,scoped:!!t}),a&&d.failed&&(0,R.jsxs)(`div`,{className:`la-observer-error`,role:`alert`,children:[`Request history unavailable.`,` `,(0,R.jsx)(K,{variant:`outline`,onClick:d.retry,children:`Retry history`})]}),!a&&p&&(0,R.jsxs)(`div`,{className:`la-observer-error`,role:`alert`,children:[`Request stream disconnected. Reconnecting… `,f?`Showing the last received requests.`:`Check your connection and runtime version.`]}),!!T?.dropped&&(0,R.jsxs)(`div`,{className:`la-observer-error`,role:`alert`,children:[T.dropped.toLocaleString(),` request traces were not delivered. This history is incomplete.`]}),T?.persistenceFailed&&(0,R.jsx)(`div`,{className:`la-observer-error`,role:`alert`,children:`Some request events could not be saved. This history may be incomplete.`}),w?.reset&&(0,R.jsx)(`div`,{className:`la-observer-error`,role:`alert`,children:`Some older events are no longer retained. Showing available history.`}),y===`waterfall`&&E.length>0&&(0,R.jsx)(Ls,{records:E,selected:_,onSelect:(e,t)=>{S.current=t,v(e)}}),(0,R.jsxs)(`div`,{className:y===`table`||!E.length?`la-observer-table-frame`:void 0,children:[y===`table`&&(0,R.jsxs)(Fg,{"aria-label":a?`Saved requests`:`Recent requests`,className:`la-request-table`,children:[(0,R.jsx)(Ig,{children:(0,R.jsxs)(Rg,{children:[(0,R.jsx)(Q,{scope:`col`,children:`Time`}),(0,R.jsx)(Q,{scope:`col`,children:`Request`}),(0,R.jsx)(Q,{scope:`col`,children:`Instance`}),(0,R.jsx)(Q,{scope:`col`,children:`Transport`}),(0,R.jsx)(Q,{scope:`col`,children:`Outcome`}),(0,R.jsx)(Q,{scope:`col`,children:`Total`}),(0,R.jsx)(Q,{scope:`col`,children:`Queue wait`}),(0,R.jsx)(Q,{scope:`col`,children:(0,R.jsx)(`span`,{className:`la:sr-only`,children:`Details`})})]})}),(0,R.jsx)(Lg,{children:E.map(e=>(0,R.jsxs)(Rg,{className:`la-clickable-row`,"data-state":_===e?`selected`:void 0,onClick:t=>{S.current=t.currentTarget.querySelector(`button`),v(e)},children:[(0,R.jsx)($,{children:(0,R.jsx)(`time`,{dateTime:new Date(e.startedAtMs).toISOString(),title:new Date(e.startedAtMs).toLocaleString(),children:a?new Date(e.startedAtMs).toLocaleString([],{hour12:!1}):new Date(e.startedAtMs).toLocaleTimeString([],{hour12:!1})})}),(0,R.jsx)($,{children:(0,R.jsx)(`span`,{className:`la-request-operation`,title:e.operation,children:e.operation})}),(0,R.jsx)($,{children:(0,R.jsxs)(`span`,{className:`la-request-actor`,title:`${e.actorName} / ${e.actorId}`,children:[e.actorName,` / `,e.actorId]})}),(0,R.jsx)($,{children:e.kind===`method`?`Method`:`WebSocket`}),(0,R.jsx)($,{children:(0,R.jsx)(yh,{variant:`outline`,className:`la-request-outcome-${e.outcome}`,children:e.outcome[0].toUpperCase()+e.outcome.slice(1)})}),(0,R.jsx)($,{children:Os(e.durationMs)}),(0,R.jsx)($,{children:e.queueWaitMs===null?(0,R.jsx)(`span`,{title:`Request did not begin processing`,children:`—`}):Os(e.queueWaitMs)}),(0,R.jsx)($,{children:(0,R.jsx)(K,{variant:`ghost`,size:`sm`,"aria-label":`Inspect ${e.operation} request`,"aria-haspopup":`dialog`,children:`Details`})})]},e.eventId??`${w.epoch}-${e.sequence}`))})]}),!E.length&&(0,R.jsxs)(`div`,{className:`la-request-empty`,role:`status`,children:[(0,R.jsx)(`strong`,{children:a?d.loading?`Loading history…`:d.failed?`History unavailable`:`No saved requests in this range`:w?`No requests yet`:p?`Requests unavailable`:`Connecting to requests…`}),(0,R.jsx)(`p`,{children:a?`Try a wider time range or fewer filters. Local history retains the latest 10,000 events.`:`Call an actor method or send a WebSocket message to see its timings.`})]})]}),a&&w?.nextCursor&&(0,R.jsx)(K,{className:`la-request-load-older`,variant:`outline`,disabled:d.loading,onClick:d.loadOlder,children:d.loading?`Loading…`:`Load older`}),(0,R.jsxs)(`div`,{className:`la-observer-footnote`,children:[(0,R.jsxs)(`span`,{className:`la-observer-refresh-status`,children:[!a&&(0,R.jsx)(`span`,{className:`la-observer-dot ${p?`la-observer-dot-unknown`:`la-observer-dot-live`}`}),a?`Saved history`:h?`Display paused · collection continues`:p?`Reconnecting…`:f?`Live updates`:`Connecting…`]}),(0,R.jsx)(`span`,{children:a?`${E.length.toLocaleString()} saved requests shown`:t?`${E.length} matching requests from the latest ${w?.capacity??500} on this control plane.`:`Latest ${w?.capacity??500} requests on this control plane.`})]}),!a&&!!w?.evicted&&(0,R.jsxs)(`p`,{className:`la-request-note`,children:[w.evicted.toLocaleString(),` older records have left this history window.`]}),(0,R.jsx)(`p`,{className:`la-request-note`,children:`Total includes queue wait, actor processing, and persistence. Queue wait includes the WebSocket message queue. Timings exclude the caller’s network round trip.`}),(0,R.jsx)(Tg,{direction:`right`,autoFocus:!0,open:!!_,onOpenChange:e=>{e||v(void 0)},children:(0,R.jsxs)(kg,{container:x.current,className:`la:data-[vaul-drawer-direction=right]:w-full la:data-[vaul-drawer-direction=right]:sm:max-w-[480px]`,onCloseAutoFocus:e=>{e.preventDefault(),S.current?.focus()},children:[(0,R.jsxs)(Ag,{className:`la:relative la:shrink-0 la:gap-2 la:p-6 la:pr-16`,children:[(0,R.jsx)(jg,{children:`Request details`}),(0,R.jsx)(Mg,{children:`Full identifiers and timings for this request.`}),(0,R.jsx)(Dg,{asChild:!0,children:(0,R.jsx)(K,{className:`la:absolute la:top-4 la:right-4`,variant:`ghost`,size:`icon`,"aria-label":`Close`,children:(0,R.jsx)(Re,{"aria-hidden":`true`})})})]}),(0,R.jsx)(`div`,{className:`la:min-h-0 la:flex-1 la:overflow-y-auto la:px-6 la:pb-6`,children:_&&(0,R.jsx)(Kg,{record:_,timing:Es(E).calls.find(e=>e.record===_)})})]})})]})}function Gg({query:e,range:t,onRangeChange:n,loading:r,onSearch:i,scoped:a}){let o=(0,O.useId)(),s=(0,O.useId)();return(0,R.jsxs)(`form`,{className:`la-request-history-filters`,onSubmit:e=>{e.preventDefault();let t=new FormData(e.currentTarget);i({actorId:String(t.get(`actorId`)||``).trim()||void 0,outcome:String(t.get(`outcome`)||``)||void 0})},children:[(0,R.jsxs)(`div`,{className:`la-request-history-range`,children:[(0,R.jsx)(`span`,{children:`Time range`}),(0,R.jsx)(dh,{value:t,onChange:n,align:`start`})]}),!a&&(0,R.jsxs)(`div`,{className:`la-request-history-field`,children:[(0,R.jsx)(`label`,{htmlFor:o,children:`Actor ID`}),(0,R.jsx)(Yd,{id:o,name:`actorId`,placeholder:`All actors`,maxLength:256,defaultValue:e.actorId})]}),(0,R.jsxs)(`div`,{className:`la-request-history-field`,children:[(0,R.jsx)(`label`,{htmlFor:s,children:`Outcome`}),(0,R.jsxs)(Ng,{id:s,className:`la-observer-select`,name:`outcome`,defaultValue:e.outcome??``,children:[(0,R.jsx)(Pg,{value:``,children:`All outcomes`}),[`completed`,`failed`,`rejected`,`rerouted`,`interrupted`].map(e=>(0,R.jsx)(Pg,{value:e,children:e[0].toUpperCase()+e.slice(1)},e))]})]}),(0,R.jsx)(K,{type:`submit`,variant:`outline`,disabled:r,children:`Search`})]})}function Kg({record:e,timing:t}){let n={Operation:e.operation,"Actor class":e.actorName,"Instance ID":e.actorId,"Request ID":e.requestId,Time:new Date(e.startedAtMs).toLocaleString(),Transport:e.kind===`method`?`Method`:`WebSocket`,Outcome:e.outcome,"Host state":{cold:`Cold`,warm:`Warm`}[e.hostState],Total:Os(e.durationMs),"Queue wait":e.queueWaitMs===null?`Did not begin processing`:Os(e.queueWaitMs),...t?{"Start offset in view":Os(t.offsetMs),"Gap from preceding calls":ks(t.gapMs)}:{},Host:e.hostId,...e.connectionId?{Connection:e.connectionId}:{}};return(0,R.jsx)(`dl`,{className:`la-request-details`,children:Object.entries(n).map(([e,t])=>(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{children:e}),(0,R.jsx)(`dd`,{children:t})]},e))})}var qg=e=>typeof e==`boolean`||e instanceof Boolean,Jg=e=>typeof e==`number`||e instanceof Number,Yg=e=>typeof e==`bigint`||e instanceof BigInt,Xg=e=>!!e&&e instanceof Date,Zg=e=>typeof e==`string`||e instanceof String,Qg=e=>Array.isArray(e),$g=e=>typeof e==`object`&&!!e,e_=e=>!!e&&e instanceof Object&&typeof e==`function`;function t_(e,t){return t===void 0&&(t=!1),!e||t?`"${e}"`:e}function n_(e,t,n){return n?JSON.stringify(e):t?`"${e}"`:e}function r_(e){let{field:t,value:n,data:r,lastElement:i,openBracket:a,closeBracket:o,level:s,style:c,shouldExpandNode:l,clickToExpandNode:u,outerRef:d,beforeExpandChange:f}=e,p=(0,O.useRef)(!1),[m,h]=(0,O.useState)(()=>l(s,n,t)),g=(0,O.useRef)(null);(0,O.useEffect)(()=>{p.current?h(l(s,n,t)):p.current=!0},[l]);let _=(0,O.useId)();if(r.length===0)return i_({field:t,openBracket:a,closeBracket:o,lastElement:i,style:c});let v=m?c.collapseIcon:c.expandIcon,y=m?c.ariaLables.collapseJson:c.ariaLables.expandJson,b=s+1,x=r.length-1,S=e=>{m!==e&&(!f||f({level:s,value:n,field:t,newExpandValue:e}))&&h(e)},C=e=>{if(e.key===`ArrowRight`||e.key===`ArrowLeft`)e.preventDefault(),S(e.key===`ArrowRight`);else if(e.key===`ArrowUp`||e.key===`ArrowDown`){e.preventDefault();let t=e.key===`ArrowUp`?-1:1;if(!d.current)return;let n=d.current.querySelectorAll(`[role=button]`),r=-1;for(let e=0;e<n.length;e++)if(n[e].tabIndex===0){r=e;break}if(r<0)return;let i=(r+t+n.length)%n.length;n[r].tabIndex=-1,n[i].tabIndex=0,n[i].focus()}},w=()=>{S(!m);let e=g.current;if(!e)return;let t=d.current?.querySelector(`[role=button][tabindex="0"]`);t&&(t.tabIndex=-1),e.tabIndex=0,e.focus()};return(0,O.createElement)(`div`,{className:c.basicChildStyle,role:`treeitem`,"aria-expanded":m,"aria-selected":void 0},(0,O.createElement)(`span`,{className:v,onClick:w,onKeyDown:C,role:`button`,"aria-label":y,"aria-expanded":m,"aria-controls":m?_:void 0,ref:g,tabIndex:s===0?0:-1}),(t||t===``)&&(u?(0,O.createElement)(`span`,{className:c.clickableLabel,onClick:w,onKeyDown:C},t_(t,c.quotesForFieldNames),`:`):(0,O.createElement)(`span`,{className:c.label},t_(t,c.quotesForFieldNames),`:`)),(0,O.createElement)(`span`,{className:c.punctuation},a),m?(0,O.createElement)(`ul`,{id:_,role:`group`,className:c.childFieldsContainer},r.map((e,t)=>(0,O.createElement)(c_,{key:e[0]||t,field:e[0],value:e[1],style:c,lastElement:t===x,level:b,shouldExpandNode:l,clickToExpandNode:u,beforeExpandChange:f,outerRef:d}))):(0,O.createElement)(`span`,{className:c.collapsedContent,onClick:w,onKeyDown:C}),(0,O.createElement)(`span`,{className:c.punctuation},o),!i&&(0,O.createElement)(`span`,{className:c.punctuation},`,`))}function i_(e){let{field:t,openBracket:n,closeBracket:r,lastElement:i,style:a}=e;return(0,O.createElement)(`div`,{className:a.basicChildStyle,role:`treeitem`,"aria-selected":void 0},(t||t===``)&&(0,O.createElement)(`span`,{className:a.label},t_(t,a.quotesForFieldNames),`:`),(0,O.createElement)(`span`,{className:a.punctuation},n),(0,O.createElement)(`span`,{className:a.punctuation},r),!i&&(0,O.createElement)(`span`,{className:a.punctuation},`,`))}function a_(e){let{field:t,value:n,style:r,lastElement:i,shouldExpandNode:a,clickToExpandNode:o,level:s,outerRef:c,beforeExpandChange:l}=e;return r_({field:t,value:n,lastElement:i||!1,level:s,openBracket:`{`,closeBracket:`}`,style:r,shouldExpandNode:a,clickToExpandNode:o,data:Object.keys(n).map(e=>[e,n[e]]),outerRef:c,beforeExpandChange:l})}function o_(e){let{field:t,value:n,style:r,lastElement:i,level:a,shouldExpandNode:o,clickToExpandNode:s,outerRef:c,beforeExpandChange:l}=e;return r_({field:t,value:n,lastElement:i||!1,level:a,openBracket:`[`,closeBracket:`]`,style:r,shouldExpandNode:o,clickToExpandNode:s,data:n.map(e=>[void 0,e]),outerRef:c,beforeExpandChange:l})}function s_(e){let{field:t,value:n,style:r,lastElement:i}=e,a,o=r.otherValue;return n===null?(a=`null`,o=r.nullValue):n===void 0?(a=`undefined`,o=r.undefinedValue):Zg(n)?(a=n_(n,!r.noQuotesForStringValues,r.stringifyStringValues),o=r.stringValue):qg(n)?(a=n?`true`:`false`,o=r.booleanValue):Jg(n)?(a=n.toString(),o=r.numberValue):Yg(n)?(a=`${n.toString()}n`,o=r.numberValue):a=Xg(n)?n.toISOString():e_(n)?`function() { }`:n.toString(),(0,O.createElement)(`div`,{className:r.basicChildStyle,role:`treeitem`,"aria-selected":void 0},(t||t===``)&&(0,O.createElement)(`span`,{className:r.label},t_(t,r.quotesForFieldNames),`:`),(0,O.createElement)(`span`,{className:o},a),!i&&(0,O.createElement)(`span`,{className:r.punctuation},`,`))}function c_(e){let t=e.value;return Qg(t)?(0,O.createElement)(o_,Object.assign({},e)):$g(t)&&!Xg(t)&&!e_(t)?(0,O.createElement)(a_,Object.assign({},e)):(0,O.createElement)(s_,Object.assign({},e))}var l_={"container-base":`_GzYRV`,"punctuation-base":`_3eOF8`,pointer:`_1MFti`,"expander-base":`_f10Tu _1MFti`,"expand-icon":`_1UmXx`,"collapse-icon":`_1LId0`,"collapsed-content-base":`_1pNG9 _1MFti`,"container-light":`_2IvMF _GzYRV`,"basic-element-style":`_2bkNM`,"child-fields-container":`_1BXBN`,"label-light":`_1MGIk`,"clickable-label-light":`_2YKJg _1MGIk _1MFti`,"punctuation-light":`_3uHL6 _3eOF8`,"value-null-light":`_2T6PJ`,"value-undefined-light":`_1Gho6`,"value-string-light":`_vGjyY`,"value-number-light":`_1bQdo`,"value-boolean-light":`_3zQKs`,"value-other-light":`_1xvuR`,"collapse-icon-light":`_oLqym _f10Tu _1MFti _1LId0`,"expand-icon-light":`_2AXVT _f10Tu _1MFti _1UmXx`,"collapsed-content-light":`_2KJWg _1pNG9 _1MFti`,"container-dark":`_11RoI _GzYRV`,"expand-icon-dark":`_17H2C _f10Tu _1MFti _1UmXx`,"collapse-icon-dark":`_3QHg2 _f10Tu _1MFti _1LId0`,"collapsed-content-dark":`_3fDAz _1pNG9 _1MFti`,"label-dark":`_2bSDX`,"clickable-label-dark":`_1RQEj _2bSDX _1MFti`,"punctuation-dark":`_gsbQL _3eOF8`,"value-null-dark":`_LaAZe`,"value-undefined-dark":`_GTKgm`,"value-string-dark":`_Chy1W`,"value-number-dark":`_2bveF`,"value-boolean-dark":`_2vRm-`,"value-other-dark":`_1prJR`},u_={container:l_[`container-light`],basicChildStyle:l_[`basic-element-style`],childFieldsContainer:l_[`child-fields-container`],label:l_[`label-light`],clickableLabel:l_[`clickable-label-light`],nullValue:l_[`value-null-light`],undefinedValue:l_[`value-undefined-light`],stringValue:l_[`value-string-light`],booleanValue:l_[`value-boolean-light`],numberValue:l_[`value-number-light`],otherValue:l_[`value-other-light`],punctuation:l_[`punctuation-light`],collapseIcon:l_[`collapse-icon-light`],expandIcon:l_[`expand-icon-light`],collapsedContent:l_[`collapsed-content-light`],noQuotesForStringValues:!1,quotesForFieldNames:!1,ariaLables:{collapseJson:`collapse JSON`,expandJson:`expand JSON`},stringifyStringValues:!1};l_[`container-dark`],l_[`basic-element-style`],l_[`child-fields-container`],l_[`label-dark`],l_[`clickable-label-dark`],l_[`value-null-dark`],l_[`value-undefined-dark`],l_[`value-string-dark`],l_[`value-boolean-dark`],l_[`value-number-dark`],l_[`value-other-dark`],l_[`punctuation-dark`],l_[`collapse-icon-dark`],l_[`expand-icon-dark`],l_[`collapsed-content-dark`];var d_=()=>!0,f_=e=>{let{data:t,style:n=u_,shouldExpandNode:r=d_,clickToExpandNode:i=!1,beforeExpandChange:a,compactTopLevel:o,...s}=e,c=(0,O.useRef)(null);return(0,O.createElement)(`div`,Object.assign({"aria-label":`JSON view`},s,{className:n.container,ref:c,role:`tree`}),o&&$g(t)?Object.entries(t).map(e=>{let[t,o]=e;return(0,O.createElement)(c_,{key:t,field:t,value:o,style:{...u_,...n},lastElement:!0,level:1,shouldExpandNode:r,clickToExpandNode:i,beforeExpandChange:a,outerRef:c})}):(0,O.createElement)(c_,{value:t,style:{...u_,...n},lastElement:!0,level:0,shouldExpandNode:r,clickToExpandNode:i,outerRef:c,beforeExpandChange:a}))};function p_(e){let t=/^\/(.*)\/([gimyu]*)$/.exec(e.toString());if(!t)throw Error(`Invalid RegExp`);return new RegExp(t[1]??``,t[2])}function m_(e){if(typeof e!=`object`)return e;if(e===null)return null;if(Array.isArray(e))return e.map(m_);if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return p_(e);let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=m_(e[n]));return t}function h_(e,t){if(e.length===0)throw Error(t||`Expected a non-empty array`)}function g_(e,t){if(e.length<2)throw Error(t||`Expected an array with at least 2 items`)}var __=e=>e[e.length-1],v_=class{setResult(e){return this.result=e,this.hasResult=!0,this}exit(){return this.exiting=!0,this}push(e,t){return e.parent=this,t!==void 0&&(e.childName=t),e.root=this.root||this,e.options=e.options||this.options,this.children?(h_(this.children),__(this.children).next=e,this.children.push(e)):(this.children=[e],this.nextAfterChildren=this.next||null,this.next=e),e.next=this,this}},y_=class extends v_{constructor(e,t){super(),this.left=e,this.right=t,this.pipe=`diff`}prepareDeltaResult(e){if(typeof e==`object`&&(this.options?.omitRemovedValues&&Array.isArray(e)&&e.length>1&&(e.length===2||e[2]===0||e[2]===3)&&(e[0]=0),this.options?.cloneDiffValues)){let t=typeof this.options?.cloneDiffValues==`function`?this.options?.cloneDiffValues:m_;typeof e[0]==`object`&&(e[0]=t(e[0])),typeof e[1]==`object`&&(e[1]=t(e[1]))}return e}setResult(e){return this.prepareDeltaResult(e),super.setResult(e)}},b_=class extends v_{constructor(e,t){super(),this.left=e,this.delta=t,this.pipe=`patch`}},x_=class extends v_{constructor(e){super(),this.delta=e,this.pipe=`reverse`}},S_=class{constructor(e){this.name=e,this.filters=[]}process(e){if(!this.processor)throw Error(`add this pipe to a processor before using it`);let t=this.debug,n=this.filters.length,r=e;for(let e=0;e<n;e++){let n=this.filters[e];if(n&&(t&&this.log(`filter: ${n.filterName}`),n(r),typeof r==`object`&&r.exiting)){r.exiting=!1;break}}!r.next&&this.resultCheck&&this.resultCheck(r)}log(e){console.log(`[jsondiffpatch] ${this.name} pipe, ${e}`)}append(...e){return this.filters.push(...e),this}prepend(...e){return this.filters.unshift(...e),this}indexOf(e){if(!e)throw Error(`a filter name is required`);for(let t=0;t<this.filters.length;t++)if(this.filters[t]?.filterName===e)return t;throw Error(`filter not found: ${e}`)}list(){return this.filters.map(e=>e.filterName)}after(e,...t){let n=this.indexOf(e);return this.filters.splice(n+1,0,...t),this}before(e,...t){let n=this.indexOf(e);return this.filters.splice(n,0,...t),this}replace(e,...t){let n=this.indexOf(e);return this.filters.splice(n,1,...t),this}remove(e){let t=this.indexOf(e);return this.filters.splice(t,1),this}clear(){return this.filters.length=0,this}shouldHaveResult(e){return e===!1?(this.resultCheck=null,this):(this.resultCheck||=e=>{if(!e.hasResult){console.log(e);let t=Error(`${this.name} failed`);throw t.noResult=!0,t}},this)}},C_=class{constructor(e){this.selfOptions=e||{},this.pipes={}}options(e){return e&&(this.selfOptions=e),this.selfOptions}pipe(e,t){let n=t;if(typeof e==`string`){if(n===void 0)return this.pipes[e];this.pipes[e]=n}if(e&&e.name){if(n=e,n.processor===this)return n;this.pipes[n.name]=n}if(!n)throw Error(`pipe is not defined: ${e}`);return n.processor=this,n}process(e,t){let n=e;n.options=this.options();let r=t||e.pipe||`default`,i;for(;r;)n.nextAfterChildren!==void 0&&(n.next=n.nextAfterChildren,n.nextAfterChildren=null),typeof r==`string`&&(r=this.pipe(r)),r.process(n),i=r,r=null,n&&n.next&&(n=n.next,r=n.pipe||i);return n.hasResult?n.result:void 0}},w_=(e,t,n,r)=>e[n]===t[r],T_=(e,t,n,r)=>{let i=e.length,a=t.length,o,s,c=Array(i+1);for(o=0;o<i+1;o++){let e=Array(a+1);for(s=0;s<a+1;s++)e[s]=0;c[o]=e}for(c.match=n,o=1;o<i+1;o++){let i=c[o];if(i===void 0)throw Error(`LCS matrix row is undefined`);let l=c[o-1];if(l===void 0)throw Error(`LCS matrix row is undefined`);for(s=1;s<a+1;s++)n(e,t,o-1,s-1,r)?i[s]=(l[s-1]??0)+1:i[s]=Math.max(l[s]??0,i[s-1]??0)}return c},E_=(e,t,n,r)=>{let i=t.length,a=n.length,o={sequence:[],indices1:[],indices2:[]};for(;i!==0&&a!==0;){if(e.match===void 0)throw Error(`LCS matrix match function is undefined`);if(e.match(t,n,i-1,a-1,r))o.sequence.unshift(t[i-1]),o.indices1.unshift(i-1),o.indices2.unshift(a-1),--i,--a;else{let t=e[i];if(t===void 0)throw Error(`LCS matrix row is undefined`);let n=t[a-1];if(n===void 0)throw Error(`LCS matrix value is undefined`);let r=e[i-1];if(r===void 0)throw Error(`LCS matrix row is undefined`);let o=r[a];if(o===void 0)throw Error(`LCS matrix value is undefined`);n>o?--a:--i}}return o},D_={get:(e,t,n,r)=>{let i=r||{};return E_(T_(e,t,n||w_,i),e,t,i)}},O_=3;function k_(e,t,n,r){for(let i=0;i<n;i++){let n=e[i];for(let e=0;e<r;e++){let r=t[e];if(i!==e&&n===r)return!0}}return!1}function A_(e,t,n,r,i){let a=e[n],o=t[r];if(a===o)return!0;if(typeof a!=`object`||typeof o!=`object`)return!1;let s=i.objectHash;if(!s)return i.matchByPosition&&n===r;i.hashCache1=i.hashCache1||[];let c=i.hashCache1[n];if(c===void 0&&(i.hashCache1[n]=c=s(a,n)),c===void 0)return!1;i.hashCache2=i.hashCache2||[];let l=i.hashCache2[r];return l===void 0&&(i.hashCache2[r]=l=s(o,r)),l!==void 0&&c===l}var j_=function(e){if(!e.leftIsArray)return;let t={objectHash:e.options?.objectHash,matchByPosition:e.options?.matchByPosition},n=0,r=0,i,a,o,s=e.left,c=e.right,l=s.length,u=c.length,d;for(l>0&&u>0&&!t.objectHash&&typeof t.matchByPosition!=`boolean`&&(t.matchByPosition=!k_(s,c,l,u));n<l&&n<u&&A_(s,c,n,n,t);)i=n,d=new y_(s[i],c[i]),e.push(d,i),n++;for(;r+n<l&&r+n<u&&A_(s,c,l-1-r,u-1-r,t);)a=l-1-r,o=u-1-r,d=new y_(s[a],c[o]),e.push(d,o),r++;let f;if(n+r===l){if(l===u){e.setResult(void 0).exit();return}for(f||={_t:`a`},i=n;i<u-r;i++)f[i]=[c[i]],e.prepareDeltaResult(f[i]);e.setResult(f).exit();return}if(n+r===u){for(f||={_t:`a`},i=n;i<l-r;i++){let t=`_${i}`;f[t]=[s[i],0,0],e.prepareDeltaResult(f[t])}e.setResult(f).exit();return}t.hashCache1=void 0,t.hashCache2=void 0;let p=s.slice(n,l-r),m=c.slice(n,u-r),h=D_.get(p,m,A_,t),g=[];for(f||={_t:`a`},i=n;i<l-r;i++)if(h.indices1.indexOf(i-n)<0){let t=`_${i}`;f[t]=[s[i],0,0],e.prepareDeltaResult(f[t]),g.push(i)}let _=!0;e.options?.arrays&&e.options.arrays.detectMove===!1&&(_=!1);let v=!1;e.options?.arrays?.includeValueOnMove&&(v=!0);let y=g.length;for(i=n;i<u-r;i++){let r=h.indices2.indexOf(i-n);if(r<0){let r=!1;if(_&&y>0)for(let l=0;l<y;l++){a=g[l];let u=a===void 0?void 0:f[`_${a}`];if(a!==void 0&&u&&A_(p,m,a-n,i-n,t)){u.splice(1,2,i,O_),u.splice(1,2,i,O_),v||(u[0]=``),o=i,d=new y_(s[a],c[o]),e.push(d,o),g.splice(l,1),r=!0;break}}r||(f[i]=[c[i]],e.prepareDeltaResult(f[i]))}else{if(h.indices1[r]===void 0)throw Error(`Invalid indexOnArray2: ${r}, seq.indices1: ${h.indices1}`);if(a=h.indices1[r]+n,h.indices2[r]===void 0)throw Error(`Invalid indexOnArray2: ${r}, seq.indices2: ${h.indices2}`);o=h.indices2[r]+n,d=new y_(s[a],c[o]),e.push(d,o)}}e.setResult(f).exit()};j_.filterName=`arrays`;var M_={numerically(e,t){return e-t},numericallyBy(e){return(t,n)=>t[e]-n[e]}},N_=function(e){if(!e.nested)return;let t=e.delta;if(t._t!==`a`)return;let n,r,i=t,a=e.left,o=[],s=[],c=[];for(n in i)if(n!==`_t`){if(n[0]===`_`){let e=n;if(i[e]!==void 0&&(i[e][2]===0||i[e][2]===O_))o.push(Number.parseInt(n.slice(1),10));else throw Error(`only removal or move can be applied at original array indices, invalid diff type: ${i[e]?.[2]}`)}else{let e=n;i[e].length===1?s.push({index:Number.parseInt(e,10),value:i[e][0]}):c.push({index:Number.parseInt(e,10),delta:i[e]})}}for(o=o.sort(M_.numerically),n=o.length-1;n>=0;n--){if(r=o[n],r===void 0)continue;let e=i[`_${r}`],t=a.splice(r,1)[0];e?.[2]===O_&&s.push({index:e[1],value:t})}s=s.sort(M_.numericallyBy(`index`));let l=s.length;for(n=0;n<l;n++){let e=s[n];e!==void 0&&a.splice(e.index,0,e.value)}let u=c.length;if(u>0)for(n=0;n<u;n++){let t=c[n];if(t===void 0)continue;let r=new b_(a[t.index],t.delta);e.push(r,t.index)}if(!e.children){e.setResult(a).exit();return}e.exit()};N_.filterName=`arrays`;var P_=function(e){if(!e||!e.children||e.delta._t!==`a`)return;let t=e.left,n=e.children.length;for(let r=0;r<n;r++){let n=e.children[r];if(n===void 0)continue;let i=n.childName;t[i]=n.result}e.setResult(t).exit()};P_.filterName=`arraysCollectChildren`;var F_=function(e){if(!e.nested){let t=e.delta;if(t[2]===O_){let n=t;e.newName=`_${n[1]}`,e.setResult([n[0],Number.parseInt(e.childName.substring(1),10),O_]).exit()}return}let t=e.delta;if(t._t!==`a`)return;let n=t;for(let t in n){if(t===`_t`)continue;let r=new x_(n[t]);e.push(r,t)}e.exit()};F_.filterName=`arrays`;var I_=(e,t,n)=>{if(typeof t==`string`&&t[0]===`_`)return Number.parseInt(t.substring(1),10);if(Array.isArray(n)&&n[2]===0)return`_${t}`;let r=+t;for(let n in e){let i=e[n];if(Array.isArray(i)){if(i[2]===O_){let e=Number.parseInt(n.substring(1),10),a=i[1];if(a===+t)return e;e<=r&&a>r?r++:e>=r&&a<r&&r--}else i[2]===0?Number.parseInt(n.substring(1),10)<=r&&r++:i.length===1&&Number.parseInt(n,10)<=r&&r--}}return r},L_=e=>{if(!e||!e.children)return;let t=e.delta;if(t._t!==`a`)return;let n=t,r=e.children.length,i={_t:`a`};for(let t=0;t<r;t++){let r=e.children[t];if(r===void 0)continue;let a=r.newName;if(a===void 0){if(r.childName===void 0)throw Error(`child.childName is undefined`);a=I_(n,r.childName,r.result)}i[a]!==r.result&&(i[a]=r.result)}e.setResult(i).exit()};L_.filterName=`arraysCollectChildren`;var R_=function(e){e.left instanceof Date?(e.right instanceof Date&&e.left.getTime()===e.right.getTime()?e.setResult(void 0):e.setResult([e.left,e.right]),e.exit()):e.right instanceof Date&&e.setResult([e.left,e.right]).exit()};R_.filterName=`dates`;var z_=new Set([`__proto__`]),B_=e=>{if(!e||!e.children)return;let t=e.children.length,n=e.result;for(let r=0;r<t;r++){let t=e.children[r];if(t!==void 0&&t.result!==void 0){if(n||={},t.childName===void 0)throw Error(`diff child.childName is undefined`);n[t.childName]=t.result}}n&&e.leftIsArray&&(n._t=`a`),e.setResult(n).exit()};B_.filterName=`collectChildren`;var V_=e=>{if(e.leftIsArray||e.leftType!==`object`)return;let t=e.left,n=e.right,r=e.options?.propertyFilter;for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i)||r&&!r(i,e))continue;let a=new y_(t[i],n[i]);e.push(a,i)}for(let i in n)if(Object.prototype.hasOwnProperty.call(n,i)&&(!r||r(i,e))&&t[i]===void 0){let t=new y_(void 0,n[i]);e.push(t,i)}if(!e.children||e.children.length===0){e.setResult(void 0).exit();return}e.exit()};V_.filterName=`objects`;var H_=function(e){if(!e.nested)return;let t=e.delta;if(t._t)return;let n=t,r=!1;for(let t in n){if(z_.has(t)||!Object.prototype.hasOwnProperty.call(n,t))continue;let i=e.left,a=new b_(typeof i==`object`&&i&&Object.prototype.hasOwnProperty.call(i,t)?i[t]:void 0,n[t]);e.push(a,t),r=!0}if(!r){e.setResult(e.left).exit();return}e.exit()};H_.filterName=`objects`;var U_=function(e){if(!e||!e.children||e.delta._t)return;if(e.left===null||typeof e.left!=`object`){e.setResult(e.left).exit();return}let t=e.left,n=e.children.length;for(let r=0;r<n;r++){let n=e.children[r];if(n===void 0)continue;let i=n.childName;z_.has(i)||(Object.prototype.hasOwnProperty.call(e.left,i)&&n.result===void 0?delete t[i]:t[i]!==n.result&&(t[i]=n.result))}e.setResult(t).exit()};U_.filterName=`collectChildren`;var W_=function(e){if(!e.nested||e.delta._t)return;let t=e.delta,n=!1;for(let r in t){if(z_.has(r)||!Object.prototype.hasOwnProperty.call(t,r))continue;let i=new x_(t[r]);e.push(i,r),n=!0}if(!n){e.setResult({}).exit();return}e.exit()};W_.filterName=`objects`;var G_=e=>{if(!e||!e.children||e.delta._t)return;let t=e.children.length,n={};for(let r=0;r<t;r++){let t=e.children[r];if(t===void 0)continue;let i=t.childName;z_.has(i)||n[i]!==t.result&&(n[i]=t.result)}e.setResult(n).exit()};G_.filterName=`collectChildren`;var K_=2,q_=60,J_=null;function Y_(e,t){if(!J_){let n;if(e?.textDiff?.diffMatchPatch)n=new e.textDiff.diffMatchPatch;else{if(!t)return null;let e=Error("The diff-match-patch library was not provided. Pass the library in through the options or use the `jsondiffpatch/with-text-diffs` entry-point.");throw e.diff_match_patch_not_found=!0,e}J_={diff:(e,t)=>n.patch_toText(n.patch_make(e,t)),patch:(e,t)=>{let r=n.patch_apply(n.patch_fromText(t),e);for(let e of r[1])if(!e){let e=Error(`text patch failed`);throw e.textPatchFailed=!0,e}return r[0]}}}return J_}var X_=function(e){if(e.leftType!==`string`)return;let t=e.left,n=e.right,r=e.options?.textDiff?.minLength||q_;if(t.length<r||n.length<r){e.setResult([t,n]).exit();return}let i=Y_(e.options);if(!i){e.setResult([t,n]).exit();return}let a=i.diff;e.setResult([a(t,n),0,K_]).exit()};X_.filterName=`texts`;var Z_=function(e){if(e.nested)return;let t=e.delta;if(t[2]!==K_)return;let n=t,r=Y_(e.options,!0).patch;e.setResult(r(e.left,n[0])).exit()};Z_.filterName=`texts`;var Q_=e=>{let t=/^@@ +-(\d+),(\d+) +\+(\d+),(\d+) +@@$/,n=e.split(`
52
52
  `);for(let e=0;e<n.length;e++){let r=n[e];if(r===void 0)continue;let i=r.slice(0,1);if(i===`@`){let i=t.exec(r);if(i!==null){let t=e;n[t]=`@@ -${i[3]},${i[4]} +${i[1]},${i[2]} @@`}}else if(i===`+`){if(n[e]=`-${n[e]?.slice(1)}`,n[e-1]?.slice(0,1)===`+`){let t=n[e];n[e]=n[e-1],n[e-1]=t}}else i===`-`&&(n[e]=`+${n[e]?.slice(1)}`)}return n.join(`
53
53
  `)},$_=function(e){if(e.nested)return;let t=e.delta;if(t[2]!==K_)return;let n=t;e.setResult([Q_(n[0]),0,K_]).exit()};$_.filterName=`texts`;var ev=function(e){if(e.left===e.right){e.setResult(void 0).exit();return}if(e.left===void 0){if(typeof e.right==`function`)throw Error(`functions are not supported`);e.setResult([e.right]).exit();return}if(e.right===void 0){e.setResult([e.left,0,0]).exit();return}if(typeof e.left==`function`||typeof e.right==`function`)throw Error(`functions are not supported`);if(e.leftType=e.left===null?`null`:typeof e.left,e.rightType=e.right===null?`null`:typeof e.right,e.leftType!==e.rightType){e.setResult([e.left,e.right]).exit();return}if(e.leftType===`boolean`||e.leftType===`number`){e.setResult([e.left,e.right]).exit();return}if(e.leftType===`object`&&(e.leftIsArray=Array.isArray(e.left)),e.rightType===`object`&&(e.rightIsArray=Array.isArray(e.right)),e.leftIsArray!==e.rightIsArray){e.setResult([e.left,e.right]).exit();return}e.left instanceof RegExp&&(e.right instanceof RegExp?e.setResult([e.left.toString(),e.right.toString()]).exit():e.setResult([e.left,e.right]).exit())};ev.filterName=`trivial`;var tv=function(e){if(e.delta===void 0){e.setResult(e.left).exit();return}if(e.nested=!Array.isArray(e.delta),e.nested)return;let t=e.delta;if(t.length===1){e.setResult(t[0]).exit();return}if(t.length===2){if(e.left instanceof RegExp){let n=/^\/(.*)\/([gimyu]+)$/.exec(t[1]);if(n?.[1]){e.setResult(new RegExp(n[1],n[2])).exit();return}}e.setResult(t[1]).exit();return}t.length===3&&t[2]===0&&e.setResult(void 0).exit()};tv.filterName=`trivial`;var nv=function(e){if(e.delta===void 0){e.setResult(e.delta).exit();return}if(e.nested=!Array.isArray(e.delta),e.nested)return;let t=e.delta;if(t.length===1){e.setResult([t[0],0,0]).exit();return}if(t.length===2){e.setResult([t[1],t[0]]).exit();return}t.length===3&&t[2]===0&&e.setResult([t[0]]).exit()};nv.filterName=`trivial`;var rv=class{constructor(e){this.processor=new C_(e),this.processor.pipe(new S_(`diff`).append(B_,ev,R_,X_,V_,j_).shouldHaveResult()),this.processor.pipe(new S_(`patch`).append(U_,P_,tv,Z_,H_,N_).shouldHaveResult()),this.processor.pipe(new S_(`reverse`).append(G_,L_,nv,$_,W_,F_).shouldHaveResult())}options(e){return this.processor.options(e)}diff(e,t){return this.processor.process(new y_(e,t))}patch(e,t){return this.processor.process(new b_(e,t))}reverse(e){return this.processor.process(new x_(e))}unpatch(e,t){return this.patch(e,this.reverse(t))}clone(e){return m_(e)}};function iv(e){return new rv(e)}var av=class{format(e,t){let n={};this.prepareContext(n);let r=n;return this.recurse(r,e,t),this.finalize(r)}prepareContext(e){e.buffer=[],e.out=function(...e){if(!this.buffer)throw Error(`context buffer is not initialized`);this.buffer.push(...e)}}typeFormattterNotFound(e,t){throw Error(`cannot format delta type: ${t}`)}typeFormattterErrorFormatter(e,t,n,r,i,a,o){}finalize({buffer:e}){return Array.isArray(e)?e.join(``):``}recurse(e,t,n,r,i,a,o){let s=t&&a?a.value:n;if(t===void 0&&r===void 0)return;let c=this.getDeltaType(t,a),l=c===`node`?t._t===`a`?`array`:`object`:``;r===void 0?this.rootBegin(e,c,l):this.nodeBegin(e,r,i,c,l,o??!1);let u;try{u=c===`unknown`?this.typeFormattterNotFound(e,c):this[`format_${c}`],u.call(this,e,t,s,r,i,a)}catch(n){this.typeFormattterErrorFormatter(e,n,t,s,r,i,a),typeof console<`u`&&console.error&&console.error(n.stack)}r===void 0?this.rootEnd(e,c,l):this.nodeEnd(e,r,i,c,l,o??!1)}formatDeltaChildren(e,t,n){this.forEachDeltaKey(t,n,(r,i,a,o)=>{this.recurse(e,t[r],n?n[i]:void 0,r,i,a,o)})}forEachDeltaKey(e,t,n){let r=[];if(e._t!==`a`){let i=Object.keys(e);typeof t==`object`&&t&&r.push(...Object.keys(t));for(let e of i)r.indexOf(e)>=0||r.push(e);for(let e=0;e<r.length;e++){let t=r[e];t!==void 0&&n(t,t,void 0,e===r.length-1)}return}let i={};for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=e[t];if(Array.isArray(n)&&n[2]===3){let e=n;i[e[1]]=Number.parseInt(t.substring(1))}}let a=e,o=0,s=0,c=Array.isArray(t)?t:void 0,l=c?c.length:Object.keys(a).reduce((e,t)=>{if(t===`_t`)return e;if(t.substring(0,1)===`_`){let n=a[t],r=Number.parseInt(t.substring(1)),i=Array.isArray(n)&&n.length>=3&&n[2]===3?n[1]:void 0,o=Math.max(r,i??0);return o>e?o:e}let n=Number.parseInt(t),r=i[n],o=Math.max(r??0,n??0);return o>e?o:e},0)+1,u=l,d,f=(...e)=>{d&&n(...d),d=e},p=()=>{d&&n(d[0],d[1],d[2],!0)};for(;o<l||s<u||`${s}`in a;){let e=!1,t=`_${o}`,n=`${s}`,r=s in i?i[s]:void 0;if(t in a){e=!0;let n=a[t];f(t,r??o,r?{key:`_${r}`,value:c?c[r]:void 0}:void 0,!1),Array.isArray(n)?n[2]===0?(u--,o++):(n[2],o++):o++}if(n in a){e=!0;let t=a[n],i=Array.isArray(t)&&t.length===1;f(n,r??o,r?{key:`_${r}`,value:c?c[r]:void 0}:void 0,!1),i?(u++,s++):(r===void 0&&o++,s++)}e||((c&&r===void 0||this.includeMoveDestinations!==!1)&&f(n,r??o,r?{key:`_${r}`,value:c?c[r]:void 0}:void 0,!1),r===void 0&&o++,s++)}p()}getDeltaType(e,t){if(e===void 0)return t===void 0?`unchanged`:`movedestination`;if(Array.isArray(e)){if(e.length===1)return`added`;if(e.length===2)return`modified`;if(e.length===3&&e[2]===0)return`deleted`;if(e.length===3&&e[2]===2)return`textdiff`;if(e.length===3&&e[2]===3)return`moved`}else if(typeof e==`object`)return`node`;return`unknown`}parseTextDiff(e){let t=[],n=e.split(`
54
54
  @@ `);for(let e of n){let n={pieces:[]},r=/^(?:@@ )?[-+]?(\d+),(\d+)/.exec(e)?.slice(1);if(!r)throw Error(`invalid text diff format`);g_(r),n.location={line:r[0],chr:r[1]};let i=e.split(`
@@ -72,4 +72,4 @@ Error generating stack: `+e.message+`
72
72
  `,t);continue}let r=e.charCodeAt(t);if(lb(e,t,r)){let r=e.charCodeAt(t+5)===ob?t+6:t+5,o=e.slice(r,n);if(f===0&&e.charCodeAt(n+1)===ib){u!==void 0&&a?.(u),i?.({id:u,event:p,data:o}),u=void 0,d=``,p=void 0,t=n+2,n=e.indexOf(`
73
73
  `,t);continue}d=f===0?o:`${d}\n${o}`,f++}else ub(e,t,r)?p=e.slice(e.charCodeAt(t+6)===ob?t+7:t+6,n)||void 0:C(e,t,n);t=n+1,n=e.indexOf(`
74
74
  `,t)}return e.slice(t)}for(;t<e.length;){let n=e.indexOf(`\r`,t),r=e.indexOf(`
75
- `,t),i=-1;if(n!==-1&&r!==-1?i=n<r?n:r:n===-1?r!==-1&&(i=r):i=n===e.length-1?-1:n,i===-1)break;C(e,t,i),t=i+1,e.charCodeAt(t-1)===ab&&e.charCodeAt(t)===ib&&t++}return e.slice(t)}function C(e,t,r){if(t===r){T();return}let i=e.charCodeAt(t);if(lb(e,t,i)){let n=e.charCodeAt(t+5)===ob?t+6:t+5,i=e.slice(n,r);d=f===0?i:`${d}\n${i}`,f++;return}if(ub(e,t,i)){p=e.slice(e.charCodeAt(t+6)===ob?t+7:t+6,r)||void 0;return}if(i===105&&e.charCodeAt(t+1)===100&&e.charCodeAt(t+2)===58){let n=e.slice(e.charCodeAt(t+3)===ob?t+4:t+3,r);n.includes(`\0`)||(u=n);return}if(i===58){if(n){let i=e.slice(t,r);n(i.slice(e.charCodeAt(t+1)===ob?2:1))}return}let a=e.slice(t,r),o=a.indexOf(`:`);if(o===-1){w(a,``,a);return}let s=a.slice(0,o),c=a.charCodeAt(o+1)===ob?2:1;w(s,a.slice(o+c),a)}function w(e,t,n){switch(e){case`event`:p=t||void 0;break;case`data`:d=f===0?t:`${d}\n${t}`,f++;break;case`id`:t.includes(`\0`)||(u=t);break;case`retry`:/^\d+$/.test(t)?o?.(parseInt(t,10)):r?.(new rb(`Invalid \`retry\` value: "${t}"`,{type:`invalid-retry`,value:t,line:n}));break;default:r?.(new rb(`Unknown field "${e.length>20?`${e.slice(0,20)}…`:e}"`,{type:`unknown-field`,field:e,value:t,line:n}))}}function T(){u!==void 0&&a?.(u),f>0&&i?.({id:u,event:p,data:d}),u=void 0,d=``,f=0,p=void 0}function E(e={}){if(e.consume&&s.length>0){let e=s.join(``);C(e,0,e.length)}l=``,u=void 0,d=``,f=0,p=void 0,s.length=0,c=0,m=!1,h=!1,g=!1}return{feed:_,reset:E}}function lb(e,t,n){return n===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function ub(e,t,n){return n===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}function db(e,t){let n=1;for(;n<e.length&&n<t.length;){if(e.charCodeAt(n)!==t.charCodeAt(n))return!1;n++}return e.length<=t.length||e.charCodeAt(t.length)===58}function fb(e){if(!gb(e)||!(e.snapshot===null||mb(e.snapshot)&&gb(e.snapshot)&&gb(e.snapshot.state))||!(e.schema===null||gb(e.schema)))throw Error(`Invalid state response`);return e}function pb(e){if(!gb(e)||!Array.isArray(e.records)||!e.records.every(mb)||!(e.nextBefore===null||hb(e.nextBefore)))throw Error(`Invalid state history`);return e}function mb(e){if(!gb(e)||!hb(e.stateVersion)||!hb(e.ownerEpoch)||typeof e.requestId!=`string`)return!1;let t=e.attribution;return t===null||gb(t)&&typeof t.operation==`string`&&(t.connectionId===null||typeof t.connectionId==`string`)&&typeof t.committedAtMs==`number`&&Number.isSafeInteger(t.committedAtMs)&&t.committedAtMs>=0&&typeof t.interleaved==`boolean`}function hb(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>0}function gb(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}var _b=class{baseUrl;request;constructor(e=`/api/observe`,t=globalThis.fetch.bind(globalThis)){this.baseUrl=e,this.request=t}async getState(e,t){return fb(await this.get(`state${vb(e)}`,t))}async listStateHistory(e,t){return pb(await this.get(`state/history${vb(e)}`,t))}async getMetrics(e,t){return $v(await this.get(`metrics${vb(e)}`,t))}async listQueueWaits(e,t){return wv(await this.get(`queue-waits${vb(e)}`,t))}async listWebSockets(e,t){return fy(await this.get(`websockets${vb(e)}`,t))}async listActors(e){let t=await this.get(`actors`,e);if(!yb(t))throw Error(`Invalid actor inventory response.`);return t}async watchActors(e,t){return this.watch(`events`,`inventory`,yb,e,t)}async watchRequests(e,t,n){let r=n?`?${new URLSearchParams({after:n})}`:``;return this.watch(`requests/events${r}`,`requests`,Sb,e,t)}async listRequests(e,t){let n=await this.get(`requests${vb(e)}`,t);if(!Sb(n))throw Error(`Invalid request history response`);return n}async watch(e,t,n,r,i){let a=await this.request(`${this.baseUrl.replace(/\/$/u,``)}/${e}`,{signal:i,credentials:`same-origin`,redirect:`error`,headers:{accept:`text/event-stream`}});if(!a.ok||!a.headers.get(`content-type`)?.startsWith(`text/event-stream`)||!a.body)throw await a.body?.cancel(),Error(`Live inventory is unavailable`);let o=a.body.getReader(),s=new TextDecoder,c=cb({onEvent(e){if(i.aborted)return;if(e.event===`error`)throw Error(`Live inventory is unavailable`);if(e.event!==t)return;let a=JSON.parse(e.data);if(!n(a))throw Error(`Invalid observer response`);r(a)}}),l=()=>{o.cancel().catch(()=>{})};i.addEventListener(`abort`,l,{once:!0});try{for(;!i.aborted;){let{value:e,done:t}=await o.read();if(t)break;c.feed(s.decode(e,{stream:!0}))}if(!i.aborted)throw Error(`Live inventory disconnected`)}finally{i.removeEventListener(`abort`,l),await o.cancel().catch(()=>{}),o.releaseLock()}}async checkConnection(e){let t=await this.get(`connection`,e);if(!t||typeof t!=`object`||!(`connected`in t)||t.connected!==!0)throw Error(`Invalid connection response.`)}async get(e,t){let n=await this.request(`${this.baseUrl.replace(/\/$/u,``)}/${e}`,{method:`GET`,credentials:`same-origin`,redirect:`error`,signal:t,headers:{accept:`application/json`}});if(!n.ok)throw Error(`Connection check failed (HTTP ${n.status}).`);return n.json()}};function vb(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!==void 0&&t.set(n,String(r));return t.size?`?${t}`:``}function yb(e){return!e||typeof e!=`object`||!(`actors`in e)||!Array.isArray(e.actors)||!(`connectionsComplete`in e)||typeof e.connectionsComplete!=`boolean`?!1:e.actors.every(e=>e&&typeof e.actorName==`string`&&[e.live,e.dormant,e.unknown].every(e=>Number.isSafeInteger(e)&&e>=0)&&Array.isArray(e.instances)&&e.instances.every(bb))}function bb(e){return!!e&&typeof e==`object`&&`actorId`in e&&typeof e.actorId==`string`&&`status`in e&&[`live`,`dormant`,`unknown`].includes(String(e.status))&&`connections`in e&&Array.isArray(e.connections)&&e.connections.every(xb)&&(!(`waiting`in e)||e.waiting==null||Array.isArray(e.waiting)&&e.waiting.every(e=>!!e&&typeof e==`object`&&typeof e.id==`string`&&typeof e.operation==`string`))}function xb(e){return!!e&&typeof e==`object`&&`id`in e&&typeof e.id==`string`&&`metadata`in e}function Sb(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.epoch==`string`&&[t.cursor,t.capacity,t.evicted,t.dropped].every(Cb)&&(t.persistenceFailed===void 0||typeof t.persistenceFailed==`boolean`)&&(t.nextCursor==null||typeof t.nextCursor==`string`)&&(t.resumeCursor===void 0||typeof t.resumeCursor==`string`)&&(t.reset===void 0||typeof t.reset==`boolean`)&&t.capacity>0&&t.capacity<=500&&Array.isArray(t.records)&&t.records.length<=t.capacity&&t.records.every(e=>wb(e)&&e.sequence<=t.cursor)}function Cb(e){return Number.isSafeInteger(e)&&Number(e)>=0}function wb(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.projectId==`string`&&/^[A-Za-z0-9._-]{1,64}$/u.test(t.projectId)&&[t.requestId,t.hostId,t.sessionId,t.actorName,t.actorId,t.operation].every(e=>typeof e==`string`)&&(t.eventId===void 0||typeof t.eventId==`string`&&t.eventId.length>0)&&Cb(t.sequence)&&Cb(t.startedAtMs)&&t.startedAtMs<=864e13&&[`method`,`websocket`].includes(t.kind)&&[`completed`,`failed`,`rejected`,`rerouted`,`interrupted`].includes(t.outcome)&&(t.connectionId===null||typeof t.connectionId==`string`)&&Number.isFinite(t.durationMs)&&t.durationMs>=0&&(t.queueWaitMs===null||Number.isFinite(t.queueWaitMs)&&t.queueWaitMs>=0&&t.queueWaitMs<=t.durationMs)}var Tb=new _b,Eb=window.matchMedia(`(prefers-color-scheme: dark)`),Db=!1,Ob=()=>{Db||document.documentElement.classList.toggle(`dark`,Eb.matches)};Ob(),Eb.addEventListener(`change`,Ob);function kb(){Db=!0,document.documentElement.classList.toggle(`dark`)}(0,Ge.createRoot)(document.getElementById(`root`)).render((0,R.jsx)(nb,{client:Tb,toggleTheme:kb}));
75
+ `,t),i=-1;if(n!==-1&&r!==-1?i=n<r?n:r:n===-1?r!==-1&&(i=r):i=n===e.length-1?-1:n,i===-1)break;C(e,t,i),t=i+1,e.charCodeAt(t-1)===ab&&e.charCodeAt(t)===ib&&t++}return e.slice(t)}function C(e,t,r){if(t===r){T();return}let i=e.charCodeAt(t);if(lb(e,t,i)){let n=e.charCodeAt(t+5)===ob?t+6:t+5,i=e.slice(n,r);d=f===0?i:`${d}\n${i}`,f++;return}if(ub(e,t,i)){p=e.slice(e.charCodeAt(t+6)===ob?t+7:t+6,r)||void 0;return}if(i===105&&e.charCodeAt(t+1)===100&&e.charCodeAt(t+2)===58){let n=e.slice(e.charCodeAt(t+3)===ob?t+4:t+3,r);n.includes(`\0`)||(u=n);return}if(i===58){if(n){let i=e.slice(t,r);n(i.slice(e.charCodeAt(t+1)===ob?2:1))}return}let a=e.slice(t,r),o=a.indexOf(`:`);if(o===-1){w(a,``,a);return}let s=a.slice(0,o),c=a.charCodeAt(o+1)===ob?2:1;w(s,a.slice(o+c),a)}function w(e,t,n){switch(e){case`event`:p=t||void 0;break;case`data`:d=f===0?t:`${d}\n${t}`,f++;break;case`id`:t.includes(`\0`)||(u=t);break;case`retry`:/^\d+$/.test(t)?o?.(parseInt(t,10)):r?.(new rb(`Invalid \`retry\` value: "${t}"`,{type:`invalid-retry`,value:t,line:n}));break;default:r?.(new rb(`Unknown field "${e.length>20?`${e.slice(0,20)}…`:e}"`,{type:`unknown-field`,field:e,value:t,line:n}))}}function T(){u!==void 0&&a?.(u),f>0&&i?.({id:u,event:p,data:d}),u=void 0,d=``,f=0,p=void 0}function E(e={}){if(e.consume&&s.length>0){let e=s.join(``);C(e,0,e.length)}l=``,u=void 0,d=``,f=0,p=void 0,s.length=0,c=0,m=!1,h=!1,g=!1}return{feed:_,reset:E}}function lb(e,t,n){return n===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function ub(e,t,n){return n===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}function db(e,t){let n=1;for(;n<e.length&&n<t.length;){if(e.charCodeAt(n)!==t.charCodeAt(n))return!1;n++}return e.length<=t.length||e.charCodeAt(t.length)===58}function fb(e){if(!gb(e)||!(e.snapshot===null||mb(e.snapshot)&&gb(e.snapshot)&&gb(e.snapshot.state))||!(e.schema===null||gb(e.schema)))throw Error(`Invalid state response`);return e}function pb(e){if(!gb(e)||!Array.isArray(e.records)||!e.records.every(mb)||!(e.nextBefore===null||hb(e.nextBefore)))throw Error(`Invalid state history`);return e}function mb(e){if(!gb(e)||!hb(e.stateVersion)||!hb(e.ownerEpoch)||typeof e.requestId!=`string`)return!1;let t=e.attribution;return t===null||gb(t)&&typeof t.operation==`string`&&(t.connectionId===null||typeof t.connectionId==`string`)&&typeof t.committedAtMs==`number`&&Number.isSafeInteger(t.committedAtMs)&&t.committedAtMs>=0&&typeof t.interleaved==`boolean`}function hb(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>0}function gb(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}var _b=class{baseUrl;request;constructor(e=`/api/observe`,t=globalThis.fetch.bind(globalThis)){this.baseUrl=e,this.request=t}async getState(e,t){return fb(await this.get(`state${vb(e)}`,t))}async listStateHistory(e,t){return pb(await this.get(`state/history${vb(e)}`,t))}async getMetrics(e,t){return $v(await this.get(`metrics${vb(e)}`,t))}async listQueueWaits(e,t){return wv(await this.get(`queue-waits${vb(e)}`,t))}async listWebSockets(e,t){return fy(await this.get(`websockets${vb(e)}`,t))}async listActors(e){let t=await this.get(`actors`,e);if(!yb(t))throw Error(`Invalid actor inventory response.`);return t}async watchActors(e,t){return this.watch(`events`,`inventory`,yb,e,t)}async watchRequests(e,t,n){let r=n?`?${new URLSearchParams({after:n})}`:``;return this.watch(`requests/events${r}`,`requests`,Sb,e,t)}async listRequests(e,t){let n=await this.get(`requests${vb(e)}`,t);if(!Sb(n))throw Error(`Invalid request history response`);return n}async watch(e,t,n,r,i){let a=await this.request(`${this.baseUrl.replace(/\/$/u,``)}/${e}`,{signal:i,credentials:`same-origin`,redirect:`error`,headers:{accept:`text/event-stream`}});if(!a.ok||!a.headers.get(`content-type`)?.startsWith(`text/event-stream`)||!a.body)throw await a.body?.cancel(),Error(`Live inventory is unavailable`);let o=a.body.getReader(),s=new TextDecoder,c=cb({onEvent(e){if(i.aborted)return;if(e.event===`error`)throw Error(`Live inventory is unavailable`);if(e.event!==t)return;let a=JSON.parse(e.data);if(!n(a))throw Error(`Invalid observer response`);r(a)}}),l=()=>{o.cancel().catch(()=>{})};i.addEventListener(`abort`,l,{once:!0});try{for(;!i.aborted;){let{value:e,done:t}=await o.read();if(t)break;c.feed(s.decode(e,{stream:!0}))}if(!i.aborted)throw Error(`Live inventory disconnected`)}finally{i.removeEventListener(`abort`,l),await o.cancel().catch(()=>{}),o.releaseLock()}}async checkConnection(e){let t=await this.get(`connection`,e);if(!t||typeof t!=`object`||!(`connected`in t)||t.connected!==!0)throw Error(`Invalid connection response.`)}async get(e,t){let n=await this.request(`${this.baseUrl.replace(/\/$/u,``)}/${e}`,{method:`GET`,credentials:`same-origin`,redirect:`error`,signal:t,headers:{accept:`application/json`}});if(!n.ok)throw Error(`Connection check failed (HTTP ${n.status}).`);return n.json()}};function vb(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!==void 0&&t.set(n,String(r));return t.size?`?${t}`:``}function yb(e){return!e||typeof e!=`object`||!(`actors`in e)||!Array.isArray(e.actors)||!(`connectionsComplete`in e)||typeof e.connectionsComplete!=`boolean`?!1:e.actors.every(e=>e&&typeof e.actorName==`string`&&[e.live,e.dormant,e.unknown].every(e=>Number.isSafeInteger(e)&&e>=0)&&Array.isArray(e.instances)&&e.instances.every(bb))}function bb(e){return!!e&&typeof e==`object`&&`actorId`in e&&typeof e.actorId==`string`&&`status`in e&&[`live`,`dormant`,`unknown`].includes(String(e.status))&&`connections`in e&&Array.isArray(e.connections)&&e.connections.every(xb)&&(!(`waiting`in e)||e.waiting==null||Array.isArray(e.waiting)&&e.waiting.every(e=>!!e&&typeof e==`object`&&typeof e.id==`string`&&typeof e.operation==`string`))}function xb(e){return!!e&&typeof e==`object`&&`id`in e&&typeof e.id==`string`&&`metadata`in e}function Sb(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.epoch==`string`&&[t.cursor,t.capacity,t.evicted,t.dropped].every(Cb)&&(t.persistenceFailed===void 0||typeof t.persistenceFailed==`boolean`)&&(t.nextCursor==null||typeof t.nextCursor==`string`)&&(t.resumeCursor===void 0||typeof t.resumeCursor==`string`)&&(t.reset===void 0||typeof t.reset==`boolean`)&&t.capacity>0&&t.capacity<=500&&Array.isArray(t.records)&&t.records.length<=t.capacity&&t.records.every(e=>wb(e)&&e.sequence<=t.cursor)}function Cb(e){return Number.isSafeInteger(e)&&Number(e)>=0}function wb(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.projectId==`string`&&/^[A-Za-z0-9._-]{1,64}$/u.test(t.projectId)&&[t.requestId,t.hostId,t.sessionId,t.actorName,t.actorId,t.operation].every(e=>typeof e==`string`)&&(t.eventId===void 0||typeof t.eventId==`string`&&t.eventId.length>0)&&Cb(t.sequence)&&Cb(t.startedAtMs)&&t.startedAtMs<=864e13&&[`method`,`websocket`].includes(t.kind)&&[`completed`,`failed`,`rejected`,`rerouted`,`interrupted`].includes(t.outcome)&&(t.connectionId===null||typeof t.connectionId==`string`)&&[`cold`,`warm`].includes(t.hostState)&&Number.isFinite(t.durationMs)&&t.durationMs>=0&&(t.queueWaitMs===null||Number.isFinite(t.queueWaitMs)&&t.queueWaitMs>=0&&t.queueWaitMs<=t.durationMs)}var Tb=new _b,Eb=window.matchMedia(`(prefers-color-scheme: dark)`),Db=!1,Ob=()=>{Db||document.documentElement.classList.toggle(`dark`,Eb.matches)};Ob(),Eb.addEventListener(`change`,Ob);function kb(){Db=!0,document.documentElement.classList.toggle(`dark`)}(0,Ge.createRoot)(document.getElementById(`root`)).render((0,R.jsx)(nb,{client:Tb,toggleTheme:kb}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "durable-actors-observer",
3
- "version": "0.7.11",
3
+ "version": "0.7.13",
4
4
  "description": "Embeddable React observer for Durable Actors",
5
5
  "type": "module",
6
6
  "license": "MIT",