@ouro.bot/cli 0.1.0-alpha.559 → 0.1.0-alpha.560

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.
@@ -58,4 +58,4 @@ Error generating stack: `+l.message+`
58
58
  * This source code is licensed under the MIT license found in the
59
59
  * LICENSE file in the root directory of this source tree.
60
60
  */var Ev;function qw(){if(Ev)return bf;Ev=1;var n=Mo();function a(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var s=typeof Object.is=="function"?Object.is:a,r=n.useSyncExternalStore,o=n.useRef,d=n.useEffect,h=n.useMemo,p=n.useDebugValue;return bf.useSyncExternalStoreWithSelector=function(m,g,x,y,S){var w=o(null);if(w.current===null){var j={hasValue:!1,value:null};w.current=j}else j=w.current;w=h(function(){function C(U){if(!z){if(z=!0,D=U,U=y(U),S!==void 0&&j.hasValue){var P=j.value;if(S(P,U))return R=P}return R=U}if(P=R,s(D,U))return P;var F=y(U);return S!==void 0&&S(P,F)?(D=U,P):(D=U,R=F)}var z=!1,D,R,k=x===void 0?null:x;return[function(){return C(g())},k===null?void 0:function(){return C(k())}]},[g,x,y,S]);var E=r(m,w[0],w[1]);return d(function(){j.hasValue=!0,j.value=E},[E]),p(E),E},bf}var Nv;function Yw(){return Nv||(Nv=1,yf.exports=qw()),yf.exports}var Gw=Yw();function kx(n,a,s=Ox){return Gw.useSyncExternalStoreWithSelector(Me(r=>n.subscribe(Xw,r)),Me(()=>n.state),Me(()=>n.state),Me(a),s)}function Xw(n){return n}function jl(n,a){let s=T.useId(),r=zx.get(a),[o,d]=kx(r,T.useCallback(h=>[r.selectors.isTop(h,s),r.selectors.inStack(h,s)],[r,s]));return Nt(()=>{if(n)return r.actions.push(s),()=>r.actions.pop(s)},[r,n,s]),n?d?o:!0:!1}let Pf=new Map,ul=new Map;function Av(n){var a;let s=(a=ul.get(n))!=null?a:0;return ul.set(n,s+1),s!==0?()=>Cv(n):(Pf.set(n,{"aria-hidden":n.getAttribute("aria-hidden"),inert:n.inert}),n.setAttribute("aria-hidden","true"),n.inert=!0,()=>Cv(n))}function Cv(n){var a;let s=(a=ul.get(n))!=null?a:1;if(s===1?ul.delete(n):ul.set(n,s-1),s!==1)return;let r=Pf.get(n);r&&(r["aria-hidden"]===null?n.removeAttribute("aria-hidden"):n.setAttribute("aria-hidden",r["aria-hidden"]),n.inert=r.inert,Pf.delete(n))}function Kw(n,{allowed:a,disallowed:s}={}){let r=jl(n,"inert-others");Nt(()=>{var o,d;if(!r)return;let h=Un();for(let m of(o=s==null?void 0:s())!=null?o:[])m&&h.add(Av(m));let p=(d=a==null?void 0:a())!=null?d:[];for(let m of p){if(!m)continue;let g=Wi(m);if(!g)continue;let x=m.parentElement;for(;x&&x!==g.body;){for(let y of x.children)p.some(S=>y.contains(S))||h.add(Av(y));x=x.parentElement}}return h.dispose},[r,a,s])}function Fw(n,a,s){let r=ei(o=>{let d=o.getBoundingClientRect();d.x===0&&d.y===0&&d.width===0&&d.height===0&&s()});T.useEffect(()=>{if(!n)return;let o=a===null?null:Ia(a)?a:a.current;if(!o)return;let d=Un();if(typeof ResizeObserver<"u"){let h=new ResizeObserver(()=>r.current(o));h.observe(o),d.add(()=>h.disconnect())}if(typeof IntersectionObserver<"u"){let h=new IntersectionObserver(()=>r.current(o));h.observe(o),d.add(()=>h.disconnect())}return()=>d.dispose()},[a,r,n])}let xo=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","details>summary","textarea:not([disabled])"].map(n=>`${n}:not([tabindex='-1'])`).join(","),Zw=["[data-autofocus]"].map(n=>`${n}:not([tabindex='-1'])`).join(",");var Ln=(n=>(n[n.First=1]="First",n[n.Previous=2]="Previous",n[n.Next=4]="Next",n[n.Last=8]="Last",n[n.WrapAround=16]="WrapAround",n[n.NoScroll=32]="NoScroll",n[n.AutoFocus=64]="AutoFocus",n))(Ln||{}),Jf=(n=>(n[n.Error=0]="Error",n[n.Overflow=1]="Overflow",n[n.Success=2]="Success",n[n.Underflow=3]="Underflow",n))(Jf||{}),Qw=(n=>(n[n.Previous=-1]="Previous",n[n.Next=1]="Next",n))(Qw||{});function Pw(n=document.body){return n==null?[]:Array.from(n.querySelectorAll(xo)).sort((a,s)=>Math.sign((a.tabIndex||Number.MAX_SAFE_INTEGER)-(s.tabIndex||Number.MAX_SAFE_INTEGER)))}function Jw(n=document.body){return n==null?[]:Array.from(n.querySelectorAll(Zw)).sort((a,s)=>Math.sign((a.tabIndex||Number.MAX_SAFE_INTEGER)-(s.tabIndex||Number.MAX_SAFE_INTEGER)))}var Lx=(n=>(n[n.Strict=0]="Strict",n[n.Loose=1]="Loose",n))(Lx||{});function Ww(n,a=0){var s;return n===((s=Wi(n))==null?void 0:s.body)?!1:_n(a,{0(){return n.matches(xo)},1(){let r=n;for(;r!==null;){if(r.matches(xo))return!0;r=r.parentElement}return!1}})}var Iw=(n=>(n[n.Keyboard=0]="Keyboard",n[n.Mouse=1]="Mouse",n))(Iw||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",n=>{n.metaKey||n.altKey||n.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",n=>{n.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:n.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function Vn(n){n==null||n.focus({preventScroll:!0})}let eT=["textarea","input"].join(",");function tT(n){var a,s;return(s=(a=n==null?void 0:n.matches)==null?void 0:a.call(n,eT))!=null?s:!1}function nT(n,a=s=>s){return n.slice().sort((s,r)=>{let o=a(s),d=a(r);if(o===null||d===null)return 0;let h=o.compareDocumentPosition(d);return h&Node.DOCUMENT_POSITION_FOLLOWING?-1:h&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function cl(n,a,{sorted:s=!0,relativeTo:r=null,skipElements:o=[]}={}){let d=Array.isArray(n)?n.length>0?Ff(n[0]):document:Ff(n),h=Array.isArray(n)?s?nT(n):n:a&64?Jw(n):Pw(n);o.length>0&&h.length>1&&(h=h.filter(w=>!o.some(j=>j!=null&&"current"in j?(j==null?void 0:j.current)===w:j===w))),r=r??(d==null?void 0:d.activeElement);let p=(()=>{if(a&5)return 1;if(a&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),m=(()=>{if(a&1)return 0;if(a&2)return Math.max(0,h.indexOf(r))-1;if(a&4)return Math.max(0,h.indexOf(r))+1;if(a&8)return h.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),g=a&32?{preventScroll:!0}:{},x=0,y=h.length,S;do{if(x>=y||x+y<=0)return 0;let w=m+x;if(a&16)w=(w+y)%y;else{if(w<0)return 3;if(w>=y)return 1}S=h[w],S==null||S.focus(g),x+=p}while(S!==bx(S));return a&6&&tT(S)&&S.select(),2}function Vx(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function aT(){return/Android/gi.test(window.navigator.userAgent)}function Mv(){return Vx()||aT()}function Jr(n,a,s,r){let o=ei(s);T.useEffect(()=>{if(!n)return;function d(h){o.current(h)}return document.addEventListener(a,d,r),()=>document.removeEventListener(a,d,r)},[n,a,r])}function _x(n,a,s,r){let o=ei(s);T.useEffect(()=>{if(!n)return;function d(h){o.current(h)}return window.addEventListener(a,d,r),()=>window.removeEventListener(a,d,r)},[n,a,r])}const Dv=30;function iT(n,a,s){let r=ei(s),o=T.useCallback(function(p,m){if(p.defaultPrevented)return;let g=m(p);if(g===null||!g.getRootNode().contains(g)||!g.isConnected)return;let x=(function y(S){return typeof S=="function"?y(S()):Array.isArray(S)||S instanceof Set?S:[S]})(a);for(let y of x)if(y!==null&&(y.contains(g)||p.composed&&p.composedPath().includes(y)))return;return!Ww(g,Lx.Loose)&&g.tabIndex!==-1&&p.preventDefault(),r.current(p,g)},[r,a]),d=T.useRef(null);Jr(n,"pointerdown",p=>{var m,g;Mv()||(d.current=((g=(m=p.composedPath)==null?void 0:m.call(p))==null?void 0:g[0])||p.target)},!0),Jr(n,"pointerup",p=>{if(Mv()||!d.current)return;let m=d.current;return d.current=null,o(p,()=>m)},!0);let h=T.useRef({x:0,y:0});Jr(n,"touchstart",p=>{h.current.x=p.touches[0].clientX,h.current.y=p.touches[0].clientY},!0),Jr(n,"touchend",p=>{let m={x:p.changedTouches[0].clientX,y:p.changedTouches[0].clientY};if(!(Math.abs(m.x-h.current.x)>=Dv||Math.abs(m.y-h.current.y)>=Dv))return o(p,()=>ma(p.target)?p.target:null)},!0),_x(n,"blur",p=>o(p,()=>ww(window.document.activeElement)?window.document.activeElement:null),!0)}function Md(...n){return T.useMemo(()=>Wi(...n),[...n])}function Ux(n,a,s,r){let o=ei(s);T.useEffect(()=>{n=n??window;function d(h){o.current(h)}return n.addEventListener(a,d,r),()=>n.removeEventListener(a,d,r)},[n,a,r])}function sT(n){return T.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot)}function lT(n,a){let s=n(),r=new Set;return{getSnapshot(){return s},subscribe(o){return r.add(o),()=>r.delete(o)},dispatch(o,...d){let h=a[o].call(s,...d);h&&(s=h,r.forEach(p=>p()))}}}function rT(){let n;return{before({doc:a}){var s;let r=a.documentElement,o=(s=a.defaultView)!=null?s:window;n=Math.max(0,o.innerWidth-r.clientWidth)},after({doc:a,d:s}){let r=a.documentElement,o=Math.max(0,r.clientWidth-r.offsetWidth),d=Math.max(0,n-o);s.style(r,"paddingRight",`${d}px`)}}}function oT(){return Vx()?{before({doc:n,d:a,meta:s}){function r(o){for(let d of s().containers)for(let h of d())if(h.contains(o))return!0;return!1}a.microTask(()=>{var o;if(window.getComputedStyle(n.documentElement).scrollBehavior!=="auto"){let p=Un();p.style(n.documentElement,"scrollBehavior","auto"),a.add(()=>a.microTask(()=>p.dispose()))}let d=(o=window.scrollY)!=null?o:window.pageYOffset,h=null;a.addEventListener(n,"click",p=>{if(ma(p.target))try{let m=p.target.closest("a");if(!m)return;let{hash:g}=new URL(m.href),x=n.querySelector(g);ma(x)&&!r(x)&&(h=x)}catch{}},!0),a.group(p=>{a.addEventListener(n,"touchstart",m=>{if(p.dispose(),ma(m.target)&&Sw(m.target))if(r(m.target)){let g=m.target;for(;g.parentElement&&r(g.parentElement);)g=g.parentElement;p.style(g,"overscrollBehavior","contain")}else p.style(m.target,"touchAction","none")})}),a.addEventListener(n,"touchmove",p=>{if(ma(p.target)){if(Tw(p.target))return;if(r(p.target)){let m=p.target;for(;m.parentElement&&m.dataset.headlessuiPortal!==""&&!(m.scrollHeight>m.clientHeight||m.scrollWidth>m.clientWidth);)m=m.parentElement;m.dataset.headlessuiPortal===""&&p.preventDefault()}else p.preventDefault()}},{passive:!1}),a.add(()=>{var p;let m=(p=window.scrollY)!=null?p:window.pageYOffset;d!==m&&window.scrollTo(0,d),h&&h.isConnected&&(h.scrollIntoView({block:"nearest"}),h=null)})})}}:{}}function uT(){return{before({doc:n,d:a}){a.style(n.documentElement,"overflow","hidden")}}}function Ov(n){let a={};for(let s of n)Object.assign(a,s(a));return a}let Fa=lT(()=>new Map,{PUSH(n,a){var s;let r=(s=this.get(n))!=null?s:{doc:n,count:0,d:Un(),meta:new Set,computedMeta:{}};return r.count++,r.meta.add(a),r.computedMeta=Ov(r.meta),this.set(n,r),this},POP(n,a){let s=this.get(n);return s&&(s.count--,s.meta.delete(a),s.computedMeta=Ov(s.meta)),this},SCROLL_PREVENT(n){let a={doc:n.doc,d:n.d,meta(){return n.computedMeta}},s=[oT(),rT(),uT()];s.forEach(({before:r})=>r==null?void 0:r(a)),s.forEach(({after:r})=>r==null?void 0:r(a))},SCROLL_ALLOW({d:n}){n.dispose()},TEARDOWN({doc:n}){this.delete(n)}});Fa.subscribe(()=>{let n=Fa.getSnapshot(),a=new Map;for(let[s]of n)a.set(s,s.documentElement.style.overflow);for(let s of n.values()){let r=a.get(s.doc)==="hidden",o=s.count!==0;(o&&!r||!o&&r)&&Fa.dispatch(s.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",s),s.count===0&&Fa.dispatch("TEARDOWN",s)}});function cT(n,a,s=()=>({containers:[]})){let r=sT(Fa),o=a?r.get(a):void 0,d=o?o.count>0:!1;return Nt(()=>{if(!(!a||!n))return Fa.dispatch("PUSH",a,s),()=>Fa.dispatch("POP",a,s)},[n,a]),d}function fT(n,a,s=()=>[document.body]){let r=jl(n,"scroll-lock");cT(r,a,o=>{var d;return{containers:[...(d=o.containers)!=null?d:[],s]}})}function dT(n=0){let[a,s]=T.useState(n),r=T.useCallback(m=>s(m),[]),o=T.useCallback(m=>s(g=>g|m),[]),d=T.useCallback(m=>(a&m)===m,[a]),h=T.useCallback(m=>s(g=>g&~m),[]),p=T.useCallback(m=>s(g=>g^m),[]);return{flags:a,setFlag:r,addFlag:o,hasFlag:d,removeFlag:h,toggleFlag:p}}var hT={},Rv,zv;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((Rv=process==null?void 0:hT)==null?void 0:Rv.NODE_ENV)==="test"&&typeof((zv=Element==null?void 0:Element.prototype)==null?void 0:zv.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
61
- `)),[]});var mT=(n=>(n[n.None=0]="None",n[n.Closed=1]="Closed",n[n.Enter=2]="Enter",n[n.Leave=4]="Leave",n))(mT||{});function pT(n){let a={};for(let s in n)n[s]===!0&&(a[`data-${s}`]="");return a}function gT(n,a,s,r){let[o,d]=T.useState(s),{hasFlag:h,addFlag:p,removeFlag:m}=dT(n&&o?3:0),g=T.useRef(!1),x=T.useRef(!1),y=wl();return Nt(()=>{var S;if(n){if(s&&d(!0),!a){s&&p(3);return}return(S=r==null?void 0:r.start)==null||S.call(r,s),vT(a,{inFlight:g,prepare(){x.current?x.current=!1:x.current=g.current,g.current=!0,!x.current&&(s?(p(3),m(4)):(p(4),m(2)))},run(){x.current?s?(m(3),p(4)):(m(4),p(3)):s?m(1):p(1)},done(){var w;x.current&&bT(a)||(g.current=!1,m(7),s||d(!1),(w=r==null?void 0:r.end)==null||w.call(r,s))}})}},[n,s,a,y]),n?[o,{closed:h(1),enter:h(2),leave:h(4),transition:h(2)||h(4)}]:[s,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function vT(n,{prepare:a,run:s,done:r,inFlight:o}){let d=Un();return yT(n,{prepare:a,inFlight:o}),d.nextFrame(()=>{s(),d.requestAnimationFrame(()=>{d.add(xT(n,r))})}),d.dispose}function xT(n,a){var s,r;let o=Un();if(!n)return o.dispose;let d=!1;o.add(()=>{d=!0});let h=(r=(s=n.getAnimations)==null?void 0:s.call(n).filter(p=>p instanceof CSSTransition))!=null?r:[];return h.length===0?(a(),o.dispose):(Promise.allSettled(h.map(p=>p.finished)).then(()=>{d||a()}),o.dispose)}function yT(n,{inFlight:a,prepare:s}){if(a!=null&&a.current){s();return}let r=n.style.transition;n.style.transition="none",s(),n.offsetHeight,n.style.transition=r}function bT(n){var a,s;return((s=(a=n.getAnimations)==null?void 0:a.call(n))!=null?s:[]).some(r=>r instanceof CSSTransition&&r.playState!=="finished")}function Dd(n,a){let s=T.useRef([]),r=Me(n);T.useEffect(()=>{let o=[...s.current];for(let[d,h]of a.entries())if(s.current[d]!==h){let p=r(a,o);return s.current=a,p}},[r,...a])}let Ro=T.createContext(null);Ro.displayName="OpenClosedContext";var an=(n=>(n[n.Open=1]="Open",n[n.Closed=2]="Closed",n[n.Closing=4]="Closing",n[n.Opening=8]="Opening",n))(an||{});function zo(){return T.useContext(Ro)}function ST({value:n,children:a}){return ce.createElement(Ro.Provider,{value:n},a)}function wT({children:n}){return ce.createElement(Ro.Provider,{value:null},n)}function TT(n){function a(){document.readyState!=="loading"&&(n(),document.removeEventListener("DOMContentLoaded",a))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",a),a())}let da=[];TT(()=>{function n(a){if(!ma(a.target)||a.target===document.body||da[0]===a.target)return;let s=a.target;s=s.closest(xo),da.unshift(s??a.target),da=da.filter(r=>r!=null&&r.isConnected),da.splice(10)}window.addEventListener("click",n,{capture:!0}),window.addEventListener("mousedown",n,{capture:!0}),window.addEventListener("focus",n,{capture:!0}),document.body.addEventListener("click",n,{capture:!0}),document.body.addEventListener("mousedown",n,{capture:!0}),document.body.addEventListener("focus",n,{capture:!0})});function Bx(n){let a=Me(n),s=T.useRef(!1);T.useEffect(()=>(s.current=!1,()=>{s.current=!0,Oo(()=>{s.current&&a()})}),[a])}let Hx=T.createContext(!1);function jT(){return T.useContext(Hx)}function kv(n){return ce.createElement(Hx.Provider,{value:n.force},n.children)}function ET(n){let a=jT(),s=T.useContext(qx),[r,o]=T.useState(()=>{var d;if(!a&&s!==null)return(d=s.current)!=null?d:null;if(hn.isServer)return null;let h=n==null?void 0:n.getElementById("headlessui-portal-root");if(h)return h;if(n===null)return null;let p=n.createElement("div");return p.setAttribute("id","headlessui-portal-root"),n.body.appendChild(p)});return T.useEffect(()=>{r!==null&&(n!=null&&n.body.contains(r)||n==null||n.body.appendChild(r))},[r,n]),T.useEffect(()=>{a||s!==null&&o(s.current)},[s,o,a]),r}let $x=T.Fragment,NT=dt(function(n,a){let{ownerDocument:s=null,...r}=n,o=T.useRef(null),d=gn(jw(S=>{o.current=S}),a),h=Md(o.current),p=s??h,m=ET(p),g=T.useContext(Wf),x=wl(),y=At();return Bx(()=>{var S;m&&m.childNodes.length<=0&&((S=m.parentElement)==null||S.removeChild(m))}),m?X2.createPortal(ce.createElement("div",{"data-headlessui-portal":"",ref:S=>{x.dispose(),g&&S&&x.add(g.register(S))}},y({ourProps:{ref:d},theirProps:r,slot:{},defaultTag:$x,name:"Portal"})),m):null});function AT(n,a){let s=gn(a),{enabled:r=!0,ownerDocument:o,...d}=n,h=At();return r?ce.createElement(NT,{...d,ownerDocument:o,ref:s}):h({ourProps:{ref:s},theirProps:d,slot:{},defaultTag:$x,name:"Portal"})}let CT=T.Fragment,qx=T.createContext(null);function MT(n,a){let{target:s,...r}=n,o={ref:gn(a)},d=At();return ce.createElement(qx.Provider,{value:s},d({ourProps:o,theirProps:r,defaultTag:CT,name:"Popover.Group"}))}let Wf=T.createContext(null);function DT(){let n=T.useContext(Wf),a=T.useRef([]),s=Me(d=>(a.current.push(d),n&&n.register(d),()=>r(d))),r=Me(d=>{let h=a.current.indexOf(d);h!==-1&&a.current.splice(h,1),n&&n.unregister(d)}),o=T.useMemo(()=>({register:s,unregister:r,portals:a}),[s,r,a]);return[a,T.useMemo(()=>function({children:d}){return ce.createElement(Wf.Provider,{value:o},d)},[o])]}let OT=dt(AT),Yx=dt(MT),RT=Object.assign(OT,{Group:Yx}),zT=T.Fragment;function kT(n,a){let{...s}=n,r=!1,{isFocusVisible:o,focusProps:d}=yx(),{isHovered:h,hoverProps:p}=xx({isDisabled:r}),{pressed:m,pressProps:g}=Sx({disabled:r}),x=Ad({ref:a},d,p,g),y=ti({hover:h,focus:o,active:m});return At()({ourProps:x,theirProps:s,slot:y,defaultTag:zT,name:"DataInteractive"})}let LT=dt(kT);function VT(n,a=typeof document<"u"?document.defaultView:null,s){let r=jl(n,"escape");Ux(a,"keydown",o=>{r&&(o.defaultPrevented||o.key===Nx.Escape&&s(o))})}function _T(){var n;let[a]=T.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[s,r]=T.useState((n=a==null?void 0:a.matches)!=null?n:!1);return Nt(()=>{if(!a)return;function o(d){r(d.matches)}return a.addEventListener("change",o),()=>a.removeEventListener("change",o)},[a]),s}function UT({defaultContainers:n=[],portals:a,mainTreeNode:s}={}){let r=Me(()=>{var o,d;let h=Wi(s),p=[];for(let m of n)m!==null&&(ga(m)?p.push(m):"current"in m&&ga(m.current)&&p.push(m.current));if(a!=null&&a.current)for(let m of a.current)p.push(m);for(let m of(o=h==null?void 0:h.querySelectorAll("html > *, body > *"))!=null?o:[])m!==document.body&&m!==document.head&&ga(m)&&m.id!=="headlessui-portal-root"&&(s&&(m.contains(s)||m.contains((d=s==null?void 0:s.getRootNode())==null?void 0:d.host))||p.some(g=>m.contains(g))||p.push(m));return p});return{resolveContainers:r,contains:Me(o=>r().some(d=>d.contains(o)))}}let Gx=T.createContext(null);function Lv({children:n,node:a}){let[s,r]=T.useState(null),o=Xx(a??s);return ce.createElement(Gx.Provider,{value:o},n,o===null&&ce.createElement(Qf,{features:vo.Hidden,ref:d=>{var h,p;if(d){for(let m of(p=(h=Wi(d))==null?void 0:h.querySelectorAll("html > *, body > *"))!=null?p:[])if(m!==document.body&&m!==document.head&&ga(m)&&m!=null&&m.contains(d)){r(m);break}}}}))}function Xx(n=null){var a;return(a=T.useContext(Gx))!=null?a:n}function BT(){let n=typeof document>"u";return"useSyncExternalStore"in mv?(a=>a.useSyncExternalStore)(mv)(()=>()=>{},()=>!1,()=>!n):!1}function ko(){let n=BT(),[a,s]=T.useState(hn.isHandoffComplete);return a&&hn.isHandoffComplete===!1&&s(!1),T.useEffect(()=>{a!==!0&&s(!0)},[a]),T.useEffect(()=>hn.handoff(),[]),n?!1:a}function Od(){let n=T.useRef(!1);return Nt(()=>(n.current=!0,()=>{n.current=!1}),[]),n}var al=(n=>(n[n.Forwards=0]="Forwards",n[n.Backwards=1]="Backwards",n))(al||{});function HT(){let n=T.useRef(0);return _x(!0,"keydown",a=>{a.key==="Tab"&&(n.current=a.shiftKey?1:0)},!0),n}function Kx(n){if(!n)return new Set;if(typeof n=="function")return new Set(n());let a=new Set;for(let s of n.current)ga(s.current)&&a.add(s.current);return a}let $T="div";var Ga=(n=>(n[n.None=0]="None",n[n.InitialFocus=1]="InitialFocus",n[n.TabLock=2]="TabLock",n[n.FocusLock=4]="FocusLock",n[n.RestoreFocus=8]="RestoreFocus",n[n.AutoFocus=16]="AutoFocus",n))(Ga||{});function qT(n,a){let s=T.useRef(null),r=gn(s,a),{initialFocus:o,initialFocusFallback:d,containers:h,features:p=15,...m}=n;ko()||(p=0);let g=Md(s.current);KT(p,{ownerDocument:g});let x=FT(p,{ownerDocument:g,container:s,initialFocus:o,initialFocusFallback:d});ZT(p,{ownerDocument:g,container:s,containers:h,previousActiveElement:x});let y=HT(),S=Me(D=>{if(!Ia(s.current))return;let R=s.current;(k=>k())(()=>{_n(y.current,{[al.Forwards]:()=>{cl(R,Ln.First,{skipElements:[D.relatedTarget,d]})},[al.Backwards]:()=>{cl(R,Ln.Last,{skipElements:[D.relatedTarget,d]})}})})}),w=jl(!!(p&2),"focus-trap#tab-lock"),j=wl(),E=T.useRef(!1),C={ref:r,onKeyDown(D){D.key=="Tab"&&(E.current=!0,j.requestAnimationFrame(()=>{E.current=!1}))},onBlur(D){if(!(p&4))return;let R=Kx(h);Ia(s.current)&&R.add(s.current);let k=D.relatedTarget;ma(k)&&k.dataset.headlessuiFocusGuard!=="true"&&(Fx(R,k)||(E.current?cl(s.current,_n(y.current,{[al.Forwards]:()=>Ln.Next,[al.Backwards]:()=>Ln.Previous})|Ln.WrapAround,{relativeTo:D.target}):ma(D.target)&&Vn(D.target)))}},z=At();return ce.createElement(ce.Fragment,null,w&&ce.createElement(Qf,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:S,features:vo.Focusable}),z({ourProps:C,theirProps:m,defaultTag:$T,name:"FocusTrap"}),w&&ce.createElement(Qf,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:S,features:vo.Focusable}))}let YT=dt(qT),GT=Object.assign(YT,{features:Ga});function XT(n=!0){let a=T.useRef(da.slice());return Dd(([s],[r])=>{r===!0&&s===!1&&Oo(()=>{a.current.splice(0)}),r===!1&&s===!0&&(a.current=da.slice())},[n,da,a]),Me(()=>{var s;return(s=a.current.find(r=>r!=null&&r.isConnected))!=null?s:null})}function KT(n,{ownerDocument:a}){let s=!!(n&8),r=XT(s);Dd(()=>{s||rw(a==null?void 0:a.body)&&Vn(r())},[s]),Bx(()=>{s&&Vn(r())})}function FT(n,{ownerDocument:a,container:s,initialFocus:r,initialFocusFallback:o}){let d=T.useRef(null),h=jl(!!(n&1),"focus-trap#initial-focus"),p=Od();return Dd(()=>{if(n===0)return;if(!h){o!=null&&o.current&&Vn(o.current);return}let m=s.current;m&&Oo(()=>{if(!p.current)return;let g=a==null?void 0:a.activeElement;if(r!=null&&r.current){if((r==null?void 0:r.current)===g){d.current=g;return}}else if(m.contains(g)){d.current=g;return}if(r!=null&&r.current)Vn(r.current);else{if(n&16){if(cl(m,Ln.First|Ln.AutoFocus)!==Jf.Error)return}else if(cl(m,Ln.First)!==Jf.Error)return;if(o!=null&&o.current&&(Vn(o.current),(a==null?void 0:a.activeElement)===o.current))return;console.warn("There are no focusable elements inside the <FocusTrap />")}d.current=a==null?void 0:a.activeElement})},[o,h,n]),d}function ZT(n,{ownerDocument:a,container:s,containers:r,previousActiveElement:o}){let d=Od(),h=!!(n&4);Ux(a==null?void 0:a.defaultView,"focus",p=>{if(!h||!d.current)return;let m=Kx(r);Ia(s.current)&&m.add(s.current);let g=o.current;if(!g)return;let x=p.target;Ia(x)?Fx(m,x)?(o.current=x,Vn(x)):(p.preventDefault(),p.stopPropagation(),Vn(g)):Vn(o.current)},!0)}function Fx(n,a){for(let s of n)if(s.contains(a))return!0;return!1}function Zx(n){var a;return!!(n.enter||n.enterFrom||n.enterTo||n.leave||n.leaveFrom||n.leaveTo)||!ol((a=n.as)!=null?a:Px)||ce.Children.count(n.children)===1}let Lo=T.createContext(null);Lo.displayName="TransitionContext";var QT=(n=>(n.Visible="visible",n.Hidden="hidden",n))(QT||{});function PT(){let n=T.useContext(Lo);if(n===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return n}function JT(){let n=T.useContext(Vo);if(n===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return n}let Vo=T.createContext(null);Vo.displayName="NestingContext";function _o(n){return"children"in n?_o(n.children):n.current.filter(({el:a})=>a.current!==null).filter(({state:a})=>a==="visible").length>0}function Qx(n,a){let s=ei(n),r=T.useRef([]),o=Od(),d=wl(),h=Me((w,j=ha.Hidden)=>{let E=r.current.findIndex(({el:C})=>C===w);E!==-1&&(_n(j,{[ha.Unmount](){r.current.splice(E,1)},[ha.Hidden](){r.current[E].state="hidden"}}),d.microTask(()=>{var C;!_o(r)&&o.current&&((C=s.current)==null||C.call(s))}))}),p=Me(w=>{let j=r.current.find(({el:E})=>E===w);return j?j.state!=="visible"&&(j.state="visible"):r.current.push({el:w,state:"visible"}),()=>h(w,ha.Unmount)}),m=T.useRef([]),g=T.useRef(Promise.resolve()),x=T.useRef({enter:[],leave:[]}),y=Me((w,j,E)=>{m.current.splice(0),a&&(a.chains.current[j]=a.chains.current[j].filter(([C])=>C!==w)),a==null||a.chains.current[j].push([w,new Promise(C=>{m.current.push(C)})]),a==null||a.chains.current[j].push([w,new Promise(C=>{Promise.all(x.current[j].map(([z,D])=>D)).then(()=>C())})]),j==="enter"?g.current=g.current.then(()=>a==null?void 0:a.wait.current).then(()=>E(j)):E(j)}),S=Me((w,j,E)=>{Promise.all(x.current[j].splice(0).map(([C,z])=>z)).then(()=>{var C;(C=m.current.shift())==null||C()}).then(()=>E(j))});return T.useMemo(()=>({children:r,register:p,unregister:h,onStart:y,onStop:S,wait:g,chains:x}),[p,h,r,y,S,x,g])}let Px=T.Fragment,Jx=go.RenderStrategy;function WT(n,a){var s,r;let{transition:o=!0,beforeEnter:d,afterEnter:h,beforeLeave:p,afterLeave:m,enter:g,enterFrom:x,enterTo:y,entered:S,leave:w,leaveFrom:j,leaveTo:E,...C}=n,[z,D]=T.useState(null),R=T.useRef(null),k=Zx(n),U=gn(...k?[R,a,D]:a===null?[]:[a]),P=(s=C.unmount)==null||s?ha.Unmount:ha.Hidden,{show:F,appear:W,initial:re}=PT(),[B,Z]=T.useState(F?"visible":"hidden"),ie=JT(),{register:le,unregister:Se}=ie;Nt(()=>le(R),[le,R]),Nt(()=>{if(P===ha.Hidden&&R.current){if(F&&B!=="visible"){Z("visible");return}return _n(B,{hidden:()=>Se(R),visible:()=>le(R)})}},[B,R,le,Se,F,P]);let De=ko();Nt(()=>{if(k&&De&&B==="visible"&&R.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[R,B,De,k]);let $=re&&!W,Q=W&&F&&re,J=T.useRef(!1),oe=Qx(()=>{J.current||(Z("hidden"),Se(R))},ie),me=Me(Te=>{J.current=!0;let Ze=Te?"enter":"leave";oe.onStart(R,Ze,Le=>{Le==="enter"?d==null||d():Le==="leave"&&(p==null||p())})}),A=Me(Te=>{let Ze=Te?"enter":"leave";J.current=!1,oe.onStop(R,Ze,Le=>{Le==="enter"?h==null||h():Le==="leave"&&(m==null||m())}),Ze==="leave"&&!_o(oe)&&(Z("hidden"),Se(R))});T.useEffect(()=>{k&&o||(me(F),A(F))},[F,k,o]);let G=!(!o||!k||!De||$),[,K]=gT(G,z,F,{start:me,end:A}),I=qa({ref:U,className:((r=Zf(C.className,Q&&g,Q&&x,K.enter&&g,K.enter&&K.closed&&x,K.enter&&!K.closed&&y,K.leave&&w,K.leave&&!K.closed&&j,K.leave&&K.closed&&E,!K.transition&&F&&S))==null?void 0:r.trim())||void 0,...pT(K)}),ue=0;B==="visible"&&(ue|=an.Open),B==="hidden"&&(ue|=an.Closed),F&&B==="hidden"&&(ue|=an.Opening),!F&&B==="visible"&&(ue|=an.Closing);let pe=At();return ce.createElement(Vo.Provider,{value:oe},ce.createElement(ST,{value:ue},pe({ourProps:I,theirProps:C,defaultTag:Px,features:Jx,visible:B==="visible",name:"Transition.Child"})))}function IT(n,a){let{show:s,appear:r=!1,unmount:o=!0,...d}=n,h=T.useRef(null),p=Zx(n),m=gn(...p?[h,a]:a===null?[]:[a]);ko();let g=zo();if(s===void 0&&g!==null&&(s=(g&an.Open)===an.Open),s===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[x,y]=T.useState(s?"visible":"hidden"),S=Qx(()=>{s||y("hidden")}),[w,j]=T.useState(!0),E=T.useRef([s]);Nt(()=>{w!==!1&&E.current[E.current.length-1]!==s&&(E.current.push(s),j(!1))},[E,s]);let C=T.useMemo(()=>({show:s,appear:r,initial:w}),[s,r,w]);Nt(()=>{s?y("visible"):!_o(S)&&h.current!==null&&y("hidden")},[s,S]);let z={unmount:o},D=Me(()=>{var U;w&&j(!1),(U=n.beforeEnter)==null||U.call(n)}),R=Me(()=>{var U;w&&j(!1),(U=n.beforeLeave)==null||U.call(n)}),k=At();return ce.createElement(Vo.Provider,{value:S},ce.createElement(Lo.Provider,{value:C},k({ourProps:{...z,as:T.Fragment,children:ce.createElement(Wx,{ref:m,...z,...d,beforeEnter:D,beforeLeave:R})},theirProps:{},defaultTag:T.Fragment,features:Jx,visible:x==="visible",name:"Transition"})))}function ej(n,a){let s=T.useContext(Lo)!==null,r=zo()!==null;return ce.createElement(ce.Fragment,null,!s&&r?ce.createElement(If,{ref:a,...n}):ce.createElement(Wx,{ref:a,...n}))}let If=dt(IT),Wx=dt(WT),Rd=dt(ej),tj=Object.assign(If,{Child:Rd,Root:If});var nj=(n=>(n[n.Open=0]="Open",n[n.Closed=1]="Closed",n))(nj||{}),aj=(n=>(n[n.SetTitleId=0]="SetTitleId",n))(aj||{});let ij={0(n,a){return n.titleId===a.id?n:{...n,titleId:a.id}}},zd=T.createContext(null);zd.displayName="DialogContext";function Uo(n){let a=T.useContext(zd);if(a===null){let s=new Error(`<${n} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(s,Uo),s}return a}function sj(n,a){return _n(a.type,ij,n,a)}let Vv=dt(function(n,a){let s=T.useId(),{id:r=`headlessui-dialog-${s}`,open:o,onClose:d,initialFocus:h,role:p="dialog",autoFocus:m=!0,__demoMode:g=!1,unmount:x=!1,...y}=n,S=T.useRef(!1);p=(function(){return p==="dialog"||p==="alertdialog"?p:(S.current||(S.current=!0,console.warn(`Invalid role [${p}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")})();let w=zo();o===void 0&&w!==null&&(o=(w&an.Open)===an.Open);let j=T.useRef(null),E=gn(j,a),C=Md(j.current),z=o?0:1,[D,R]=T.useReducer(sj,{titleId:null,descriptionId:null,panelRef:T.createRef()}),k=Me(()=>d(!1)),U=Me(K=>R({type:0,id:K})),P=ko()?z===0:!1,[F,W]=DT(),re={get current(){var K;return(K=D.panelRef.current)!=null?K:j.current}},B=Xx(),{resolveContainers:Z}=UT({mainTreeNode:B,portals:F,defaultContainers:[re]}),ie=w!==null?(w&an.Closing)===an.Closing:!1;Kw(g||ie?!1:P,{allowed:Me(()=>{var K,I;return[(I=(K=j.current)==null?void 0:K.closest("[data-headlessui-portal]"))!=null?I:null]}),disallowed:Me(()=>{var K;return[(K=B==null?void 0:B.closest("body > *:not(#headlessui-portal-root)"))!=null?K:null]})});let le=zx.get(null);Nt(()=>{if(P)return le.actions.push(r),()=>le.actions.pop(r)},[le,r,P]);let Se=kx(le,T.useCallback(K=>le.selectors.isTop(K,r),[le,r]));iT(Se,Z,K=>{K.preventDefault(),k()}),VT(Se,C==null?void 0:C.defaultView,K=>{K.preventDefault(),K.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),k()}),fT(g||ie?!1:P,C,Z),Fw(P,j,k);let[De,$]=Ew(),Q=T.useMemo(()=>[{dialogState:z,close:k,setTitleId:U,unmount:x},D],[z,k,U,x,D]),J=ti({open:z===0}),oe={ref:E,id:r,role:p,tabIndex:-1,"aria-modal":g?void 0:z===0?!0:void 0,"aria-labelledby":D.titleId,"aria-describedby":De,unmount:x},me=!_T(),A=Ga.None;P&&!g&&(A|=Ga.RestoreFocus,A|=Ga.TabLock,m&&(A|=Ga.AutoFocus),me&&(A|=Ga.InitialFocus));let G=At();return ce.createElement(wT,null,ce.createElement(kv,{force:!0},ce.createElement(RT,null,ce.createElement(zd.Provider,{value:Q},ce.createElement(Yx,{target:j},ce.createElement(kv,{force:!1},ce.createElement($,{slot:J},ce.createElement(W,null,ce.createElement(GT,{initialFocus:h,initialFocusFallback:j,containers:Z,features:A},ce.createElement(Ow,{value:k},G({ourProps:oe,theirProps:y,slot:J,defaultTag:lj,features:rj,visible:z===0,name:"Dialog"})))))))))))}),lj="div",rj=go.RenderStrategy|go.Static;function oj(n,a){let{transition:s=!1,open:r,...o}=n,d=zo(),h=n.hasOwnProperty("open")||d!==null,p=n.hasOwnProperty("onClose");if(!h&&!p)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!h)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!p)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!d&&typeof n.open!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${n.open}`);if(typeof n.onClose!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${n.onClose}`);return(r!==void 0||s)&&!o.static?ce.createElement(Lv,null,ce.createElement(tj,{show:r,transition:s,unmount:o.unmount},ce.createElement(Vv,{ref:a,...o}))):ce.createElement(Lv,null,ce.createElement(Vv,{ref:a,open:r,...o}))}let uj="div";function cj(n,a){let s=T.useId(),{id:r=`headlessui-dialog-panel-${s}`,transition:o=!1,...d}=n,[{dialogState:h,unmount:p},m]=Uo("Dialog.Panel"),g=gn(a,m.panelRef),x=ti({open:h===0}),y=Me(C=>{C.stopPropagation()}),S={ref:g,id:r,onClick:y},w=o?Rd:T.Fragment,j=o?{unmount:p}:{},E=At();return ce.createElement(w,{...j},E({ourProps:S,theirProps:d,slot:x,defaultTag:uj,name:"Dialog.Panel"}))}let fj="div";function dj(n,a){let{transition:s=!1,...r}=n,[{dialogState:o,unmount:d}]=Uo("Dialog.Backdrop"),h=ti({open:o===0}),p={ref:a,"aria-hidden":!0},m=s?Rd:T.Fragment,g=s?{unmount:d}:{},x=At();return ce.createElement(m,{...g},x({ourProps:p,theirProps:r,slot:h,defaultTag:fj,name:"Dialog.Backdrop"}))}let hj="h2";function mj(n,a){let s=T.useId(),{id:r=`headlessui-dialog-title-${s}`,...o}=n,[{dialogState:d,setTitleId:h}]=Uo("Dialog.Title"),p=gn(a);T.useEffect(()=>(h(r),()=>h(null)),[r,h]);let m=ti({open:d===0}),g={ref:p,id:r};return At()({ourProps:g,theirProps:o,slot:m,defaultTag:hj,name:"Dialog.Title"})}let pj=dt(oj),Ix=dt(cj),gj=dt(dj),vj=dt(mj),xj=Object.assign(pj,{Panel:Ix,Title:vj,Description:Mw});const yo=T.createContext({});function yj(n){const a=T.useRef(null);return a.current===null&&(a.current=n()),a.current}const bj=typeof window<"u",ey=bj?T.useLayoutEffect:T.useEffect,kd=T.createContext(null);function Ld(n,a){n.indexOf(a)===-1&&n.push(a)}function bo(n,a){const s=n.indexOf(a);s>-1&&n.splice(s,1)}const pn=(n,a,s)=>s>a?a:s<n?n:s;let Vd=()=>{};const va={},ty=n=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n);function ny(n){return typeof n=="object"&&n!==null}const ay=n=>/^0[^.\s]+$/u.test(n);function iy(n){let a;return()=>(a===void 0&&(a=n()),a)}const Jt=n=>n,Sj=(n,a)=>s=>a(n(s)),El=(...n)=>n.reduce(Sj),vl=(n,a,s)=>{const r=a-n;return r===0?1:(s-n)/r};class _d{constructor(){this.subscriptions=[]}add(a){return Ld(this.subscriptions,a),()=>bo(this.subscriptions,a)}notify(a,s,r){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](a,s,r);else for(let d=0;d<o;d++){const h=this.subscriptions[d];h&&h(a,s,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Ut=n=>n*1e3,Pt=n=>n/1e3;function sy(n,a){return a?n*(1e3/a):0}const ly=(n,a,s)=>(((1-3*s+3*a)*n+(3*s-6*a))*n+3*a)*n,wj=1e-7,Tj=12;function jj(n,a,s,r,o){let d,h,p=0;do h=a+(s-a)/2,d=ly(h,r,o)-n,d>0?s=h:a=h;while(Math.abs(d)>wj&&++p<Tj);return h}function Nl(n,a,s,r){if(n===a&&s===r)return Jt;const o=d=>jj(d,0,1,n,s);return d=>d===0||d===1?d:ly(o(d),a,r)}const ry=n=>a=>a<=.5?n(2*a)/2:(2-n(2*(1-a)))/2,oy=n=>a=>1-n(1-a),uy=Nl(.33,1.53,.69,.99),Ud=oy(uy),cy=ry(Ud),fy=n=>n>=1?1:(n*=2)<1?.5*Ud(n):.5*(2-Math.pow(2,-10*(n-1))),Bd=n=>1-Math.sin(Math.acos(n)),dy=oy(Bd),hy=ry(Bd),Ej=Nl(.42,0,1,1),Nj=Nl(0,0,.58,1),my=Nl(.42,0,.58,1),Aj=n=>Array.isArray(n)&&typeof n[0]!="number",py=n=>Array.isArray(n)&&typeof n[0]=="number",Cj={linear:Jt,easeIn:Ej,easeInOut:my,easeOut:Nj,circIn:Bd,circInOut:hy,circOut:dy,backIn:Ud,backInOut:cy,backOut:uy,anticipate:fy},Mj=n=>typeof n=="string",_v=n=>{if(py(n)){Vd(n.length===4);const[a,s,r,o]=n;return Nl(a,s,r,o)}else if(Mj(n))return Cj[n];return n},Wr=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Dj(n,a){let s=new Set,r=new Set,o=!1,d=!1;const h=new WeakSet;let p={delta:0,timestamp:0,isProcessing:!1};function m(x){h.has(x)&&(g.schedule(x),n()),x(p)}const g={schedule:(x,y=!1,S=!1)=>{const j=S&&o?s:r;return y&&h.add(x),j.add(x),x},cancel:x=>{r.delete(x),h.delete(x)},process:x=>{if(p=x,o){d=!0;return}o=!0;const y=s;s=r,r=y,s.forEach(m),s.clear(),o=!1,d&&(d=!1,g.process(x))}};return g}const Oj=40;function gy(n,a){let s=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},d=()=>s=!0,h=Wr.reduce((R,k)=>(R[k]=Dj(d),R),{}),{setup:p,read:m,resolveKeyframes:g,preUpdate:x,update:y,preRender:S,render:w,postRender:j}=h,E=()=>{const R=va.useManualTiming,k=R?o.timestamp:performance.now();s=!1,R||(o.delta=r?1e3/60:Math.max(Math.min(k-o.timestamp,Oj),1)),o.timestamp=k,o.isProcessing=!0,p.process(o),m.process(o),g.process(o),x.process(o),y.process(o),S.process(o),w.process(o),j.process(o),o.isProcessing=!1,s&&a&&(r=!1,n(E))},C=()=>{s=!0,r=!0,o.isProcessing||n(E)};return{schedule:Wr.reduce((R,k)=>{const U=h[k];return R[k]=(P,F=!1,W=!1)=>(s||C(),U.schedule(P,F,W)),R},{}),cancel:R=>{for(let k=0;k<Wr.length;k++)h[Wr[k]].cancel(R)},state:o,steps:h}}const{schedule:ke,cancel:xa,state:ct,steps:Sf}=gy(typeof requestAnimationFrame<"u"?requestAnimationFrame:Jt,!0);let lo;function Rj(){lo=void 0}const vt={now:()=>(lo===void 0&&vt.set(ct.isProcessing||va.useManualTiming?ct.timestamp:performance.now()),lo),set:n=>{lo=n,queueMicrotask(Rj)}},vy=n=>a=>typeof a=="string"&&a.startsWith(n),xy=vy("--"),zj=vy("var(--"),Hd=n=>zj(n)?kj.test(n.split("/*")[0].trim()):!1,kj=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Uv(n){return typeof n!="string"?!1:n.split("/*")[0].includes("var(--")}const Ii={test:n=>typeof n=="number",parse:parseFloat,transform:n=>n},xl={...Ii,transform:n=>pn(0,1,n)},Ir={...Ii,default:1},fl=n=>Math.round(n*1e5)/1e5,$d=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Lj(n){return n==null}const Vj=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,qd=(n,a)=>s=>!!(typeof s=="string"&&Vj.test(s)&&s.startsWith(n)||a&&!Lj(s)&&Object.prototype.hasOwnProperty.call(s,a)),yy=(n,a,s)=>r=>{if(typeof r!="string")return r;const[o,d,h,p]=r.match($d);return{[n]:parseFloat(o),[a]:parseFloat(d),[s]:parseFloat(h),alpha:p!==void 0?parseFloat(p):1}},_j=n=>pn(0,255,n),wf={...Ii,transform:n=>Math.round(_j(n))},Za={test:qd("rgb","red"),parse:yy("red","green","blue"),transform:({red:n,green:a,blue:s,alpha:r=1})=>"rgba("+wf.transform(n)+", "+wf.transform(a)+", "+wf.transform(s)+", "+fl(xl.transform(r))+")"};function Uj(n){let a="",s="",r="",o="";return n.length>5?(a=n.substring(1,3),s=n.substring(3,5),r=n.substring(5,7),o=n.substring(7,9)):(a=n.substring(1,2),s=n.substring(2,3),r=n.substring(3,4),o=n.substring(4,5),a+=a,s+=s,r+=r,o+=o),{red:parseInt(a,16),green:parseInt(s,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}}const ed={test:qd("#"),parse:Uj,transform:Za.transform},Al=n=>({test:a=>typeof a=="string"&&a.endsWith(n)&&a.split(" ").length===1,parse:parseFloat,transform:a=>`${a}${n}`}),ca=Al("deg"),mn=Al("%"),te=Al("px"),Bj=Al("vh"),Hj=Al("vw"),Bv={...mn,parse:n=>mn.parse(n)/100,transform:n=>mn.transform(n*100)},qi={test:qd("hsl","hue"),parse:yy("hue","saturation","lightness"),transform:({hue:n,saturation:a,lightness:s,alpha:r=1})=>"hsla("+Math.round(n)+", "+mn.transform(fl(a))+", "+mn.transform(fl(s))+", "+fl(xl.transform(r))+")"},Ie={test:n=>Za.test(n)||ed.test(n)||qi.test(n),parse:n=>Za.test(n)?Za.parse(n):qi.test(n)?qi.parse(n):ed.parse(n),transform:n=>typeof n=="string"?n:n.hasOwnProperty("red")?Za.transform(n):qi.transform(n),getAnimatableNone:n=>{const a=Ie.parse(n);return a.alpha=0,Ie.transform(a)}},$j=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function qj(n){var a,s;return isNaN(n)&&typeof n=="string"&&(((a=n.match($d))==null?void 0:a.length)||0)+(((s=n.match($j))==null?void 0:s.length)||0)>0}const by="number",Sy="color",Yj="var",Gj="var(",Hv="${}",Xj=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Zi(n){const a=n.toString(),s=[],r={color:[],number:[],var:[]},o=[];let d=0;const p=a.replace(Xj,m=>(Ie.test(m)?(r.color.push(d),o.push(Sy),s.push(Ie.parse(m))):m.startsWith(Gj)?(r.var.push(d),o.push(Yj),s.push(m)):(r.number.push(d),o.push(by),s.push(parseFloat(m))),++d,Hv)).split(Hv);return{values:s,split:p,indexes:r,types:o}}function Kj(n){return Zi(n).values}function wy({split:n,types:a}){const s=n.length;return r=>{let o="";for(let d=0;d<s;d++)if(o+=n[d],r[d]!==void 0){const h=a[d];h===by?o+=fl(r[d]):h===Sy?o+=Ie.transform(r[d]):o+=r[d]}return o}}function Fj(n){return wy(Zi(n))}const Zj=n=>typeof n=="number"?0:Ie.test(n)?Ie.getAnimatableNone(n):n,Qj=(n,a)=>typeof n=="number"?a!=null&&a.trim().endsWith("/")?n:0:Zj(n);function Pj(n){const a=Zi(n);return wy(a)(a.values.map((r,o)=>Qj(r,a.split[o])))}const sn={test:qj,parse:Kj,createTransformer:Fj,getAnimatableNone:Pj};function Tf(n,a,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?n+(a-n)*6*s:s<1/2?a:s<2/3?n+(a-n)*(2/3-s)*6:n}function Jj({hue:n,saturation:a,lightness:s,alpha:r}){n/=360,a/=100,s/=100;let o=0,d=0,h=0;if(!a)o=d=h=s;else{const p=s<.5?s*(1+a):s+a-s*a,m=2*s-p;o=Tf(m,p,n+1/3),d=Tf(m,p,n),h=Tf(m,p,n-1/3)}return{red:Math.round(o*255),green:Math.round(d*255),blue:Math.round(h*255),alpha:r}}function So(n,a){return s=>s>0?a:n}const He=(n,a,s)=>n+(a-n)*s,jf=(n,a,s)=>{const r=n*n,o=s*(a*a-r)+r;return o<0?0:Math.sqrt(o)},Wj=[ed,Za,qi],Ij=n=>Wj.find(a=>a.test(n));function $v(n){const a=Ij(n);if(!a)return!1;let s=a.parse(n);return a===qi&&(s=Jj(s)),s}const qv=(n,a)=>{const s=$v(n),r=$v(a);if(!s||!r)return So(n,a);const o={...s};return d=>(o.red=jf(s.red,r.red,d),o.green=jf(s.green,r.green,d),o.blue=jf(s.blue,r.blue,d),o.alpha=He(s.alpha,r.alpha,d),Za.transform(o))},td=new Set(["none","hidden"]);function eE(n,a){return td.has(n)?s=>s<=0?n:a:s=>s>=1?a:n}function tE(n,a){return s=>He(n,a,s)}function Yd(n){return typeof n=="number"?tE:typeof n=="string"?Hd(n)?So:Ie.test(n)?qv:iE:Array.isArray(n)?Ty:typeof n=="object"?Ie.test(n)?qv:nE:So}function Ty(n,a){const s=[...n],r=s.length,o=n.map((d,h)=>Yd(d)(d,a[h]));return d=>{for(let h=0;h<r;h++)s[h]=o[h](d);return s}}function nE(n,a){const s={...n,...a},r={};for(const o in s)n[o]!==void 0&&a[o]!==void 0&&(r[o]=Yd(n[o])(n[o],a[o]));return o=>{for(const d in r)s[d]=r[d](o);return s}}function aE(n,a){const s=[],r={color:0,var:0,number:0};for(let o=0;o<a.values.length;o++){const d=a.types[o],h=n.indexes[d][r[d]],p=n.values[h]??0;s[o]=p,r[d]++}return s}const iE=(n,a)=>{const s=sn.createTransformer(a),r=Zi(n),o=Zi(a);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?td.has(n)&&!o.values.length||td.has(a)&&!r.values.length?eE(n,a):El(Ty(aE(r,o),o.values),s):So(n,a)};function jy(n,a,s){return typeof n=="number"&&typeof a=="number"&&typeof s=="number"?He(n,a,s):Yd(n)(n,a)}const sE=n=>{const a=({timestamp:s})=>n(s);return{start:(s=!0)=>ke.update(a,s),stop:()=>xa(a),now:()=>ct.isProcessing?ct.timestamp:vt.now()}},Ey=(n,a,s=10)=>{let r="";const o=Math.max(Math.round(a/s),2);for(let d=0;d<o;d++)r+=Math.round(n(d/(o-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},wo=2e4;function Gd(n){let a=0;const s=50;let r=n.next(a);for(;!r.done&&a<wo;)a+=s,r=n.next(a);return a>=wo?1/0:a}function lE(n,a=100,s){const r=s({...n,keyframes:[0,a]}),o=Math.min(Gd(r),wo);return{type:"keyframes",ease:d=>r.next(o*d).value/a,duration:Pt(o)}}const Ge={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function nd(n,a){return n*Math.sqrt(1-a*a)}const rE=12;function oE(n,a,s){let r=s;for(let o=1;o<rE;o++)r=r-n(r)/a(r);return r}const Ef=.001;function uE({duration:n=Ge.duration,bounce:a=Ge.bounce,velocity:s=Ge.velocity,mass:r=Ge.mass}){let o,d,h=1-a;h=pn(Ge.minDamping,Ge.maxDamping,h),n=pn(Ge.minDuration,Ge.maxDuration,Pt(n)),h<1?(o=g=>{const x=g*h,y=x*n,S=x-s,w=nd(g,h),j=Math.exp(-y);return Ef-S/w*j},d=g=>{const y=g*h*n,S=y*s+s,w=Math.pow(h,2)*Math.pow(g,2)*n,j=Math.exp(-y),E=nd(Math.pow(g,2),h);return(-o(g)+Ef>0?-1:1)*((S-w)*j)/E}):(o=g=>{const x=Math.exp(-g*n),y=(g-s)*n+1;return-Ef+x*y},d=g=>{const x=Math.exp(-g*n),y=(s-g)*(n*n);return x*y});const p=5/n,m=oE(o,d,p);if(n=Ut(n),isNaN(m))return{stiffness:Ge.stiffness,damping:Ge.damping,duration:n};{const g=Math.pow(m,2)*r;return{stiffness:g,damping:h*2*Math.sqrt(r*g),duration:n}}}const cE=["duration","bounce"],fE=["stiffness","damping","mass"];function Yv(n,a){return a.some(s=>n[s]!==void 0)}function dE(n){let a={velocity:Ge.velocity,stiffness:Ge.stiffness,damping:Ge.damping,mass:Ge.mass,isResolvedFromDuration:!1,...n};if(!Yv(n,fE)&&Yv(n,cE))if(a.velocity=0,n.visualDuration){const s=n.visualDuration,r=2*Math.PI/(s*1.2),o=r*r,d=2*pn(.05,1,1-(n.bounce||0))*Math.sqrt(o);a={...a,mass:Ge.mass,stiffness:o,damping:d}}else{const s=uE({...n,velocity:0});a={...a,...s,mass:Ge.mass},a.isResolvedFromDuration=!0}return a}function To(n=Ge.visualDuration,a=Ge.bounce){const s=typeof n!="object"?{visualDuration:n,keyframes:[0,1],bounce:a}:n;let{restSpeed:r,restDelta:o}=s;const d=s.keyframes[0],h=s.keyframes[s.keyframes.length-1],p={done:!1,value:d},{stiffness:m,damping:g,mass:x,duration:y,velocity:S,isResolvedFromDuration:w}=dE({...s,velocity:-Pt(s.velocity||0)}),j=S||0,E=g/(2*Math.sqrt(m*x)),C=h-d,z=Pt(Math.sqrt(m/x)),D=Math.abs(C)<5;r||(r=D?Ge.restSpeed.granular:Ge.restSpeed.default),o||(o=D?Ge.restDelta.granular:Ge.restDelta.default);let R,k,U,P,F,W;if(E<1)U=nd(z,E),P=(j+E*z*C)/U,R=B=>{const Z=Math.exp(-E*z*B);return h-Z*(P*Math.sin(U*B)+C*Math.cos(U*B))},F=E*z*P+C*U,W=E*z*C-P*U,k=B=>Math.exp(-E*z*B)*(F*Math.sin(U*B)+W*Math.cos(U*B));else if(E===1){R=Z=>h-Math.exp(-z*Z)*(C+(j+z*C)*Z);const B=j+z*C;k=Z=>Math.exp(-z*Z)*(z*B*Z-j)}else{const B=z*Math.sqrt(E*E-1);R=Se=>{const De=Math.exp(-E*z*Se),$=Math.min(B*Se,300);return h-De*((j+E*z*C)*Math.sinh($)+B*C*Math.cosh($))/B};const Z=(j+E*z*C)/B,ie=E*z*Z-C*B,le=E*z*C-Z*B;k=Se=>{const De=Math.exp(-E*z*Se),$=Math.min(B*Se,300);return De*(ie*Math.sinh($)+le*Math.cosh($))}}const re={calculatedDuration:w&&y||null,velocity:B=>Ut(k(B)),next:B=>{if(!w&&E<1){const ie=Math.exp(-E*z*B),le=Math.sin(U*B),Se=Math.cos(U*B),De=h-ie*(P*le+C*Se),$=Ut(ie*(F*le+W*Se));return p.done=Math.abs($)<=r&&Math.abs(h-De)<=o,p.value=p.done?h:De,p}const Z=R(B);if(w)p.done=B>=y;else{const ie=Ut(k(B));p.done=Math.abs(ie)<=r&&Math.abs(h-Z)<=o}return p.value=p.done?h:Z,p},toString:()=>{const B=Math.min(Gd(re),wo),Z=Ey(ie=>re.next(B*ie).value,B,30);return B+"ms "+Z},toTransition:()=>{}};return re}To.applyToOptions=n=>{const a=lE(n,100,To);return n.ease=a.ease,n.duration=Ut(a.duration),n.type="keyframes",n};const hE=5;function Ny(n,a,s){const r=Math.max(a-hE,0);return sy(s-n(r),a-r)}function ad({keyframes:n,velocity:a=0,power:s=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:d=500,modifyTarget:h,min:p,max:m,restDelta:g=.5,restSpeed:x}){const y=n[0],S={done:!1,value:y},w=W=>p!==void 0&&W<p||m!==void 0&&W>m,j=W=>p===void 0?m:m===void 0||Math.abs(p-W)<Math.abs(m-W)?p:m;let E=s*a;const C=y+E,z=h===void 0?C:h(C);z!==C&&(E=z-y);const D=W=>-E*Math.exp(-W/r),R=W=>z+D(W),k=W=>{const re=D(W),B=R(W);S.done=Math.abs(re)<=g,S.value=S.done?z:B};let U,P;const F=W=>{w(S.value)&&(U=W,P=To({keyframes:[S.value,j(S.value)],velocity:Ny(R,W,S.value),damping:o,stiffness:d,restDelta:g,restSpeed:x}))};return F(0),{calculatedDuration:null,next:W=>{let re=!1;return!P&&U===void 0&&(re=!0,k(W),F(W)),U!==void 0&&W>=U?P.next(W-U):(!re&&k(W),S)}}}function mE(n,a,s){const r=[],o=s||va.mix||jy,d=n.length-1;for(let h=0;h<d;h++){let p=o(n[h],n[h+1]);if(a){const m=Array.isArray(a)?a[h]||Jt:a;p=El(m,p)}r.push(p)}return r}function pE(n,a,{clamp:s=!0,ease:r,mixer:o}={}){const d=n.length;if(Vd(d===a.length),d===1)return()=>a[0];if(d===2&&a[0]===a[1])return()=>a[1];const h=n[0]===n[1];n[0]>n[d-1]&&(n=[...n].reverse(),a=[...a].reverse());const p=mE(a,r,o),m=p.length,g=x=>{if(h&&x<n[0])return a[0];let y=0;if(m>1)for(;y<n.length-2&&!(x<n[y+1]);y++);const S=vl(n[y],n[y+1],x);return p[y](S)};return s?x=>g(pn(n[0],n[d-1],x)):g}function gE(n,a){const s=n[n.length-1];for(let r=1;r<=a;r++){const o=vl(0,a,r);n.push(He(s,1,o))}}function vE(n){const a=[0];return gE(a,n.length-1),a}function xE(n,a){return n.map(s=>s*a)}function yE(n,a){return n.map(()=>a||my).splice(0,n.length-1)}function dl({duration:n=300,keyframes:a,times:s,ease:r="easeInOut"}){const o=Aj(r)?r.map(_v):_v(r),d={done:!1,value:a[0]},h=xE(s&&s.length===a.length?s:vE(a),n),p=pE(h,a,{ease:Array.isArray(o)?o:yE(a,o)});return{calculatedDuration:n,next:m=>(d.value=p(m),d.done=m>=n,d)}}const bE=n=>n!==null;function Bo(n,{repeat:a,repeatType:s="loop"},r,o=1){const d=n.filter(bE),p=o<0||a&&s!=="loop"&&a%2===1?0:d.length-1;return!p||r===void 0?d[p]:r}const SE={decay:ad,inertia:ad,tween:dl,keyframes:dl,spring:To};function Ay(n){typeof n.type=="string"&&(n.type=SE[n.type])}class Xd{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(a=>{this.resolve=a})}notifyFinished(){this.resolve()}then(a,s){return this.finished.then(a,s)}}const wE=n=>n/100;class jo extends Xd{constructor(a){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var r,o;const{motionValue:s}=this.options;s&&s.updatedAt!==vt.now()&&this.tick(vt.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(o=(r=this.options).onStop)==null||o.call(r))},this.options=a,this.initAnimation(),this.play(),a.autoplay===!1&&this.pause()}initAnimation(){const{options:a}=this;Ay(a);const{type:s=dl,repeat:r=0,repeatDelay:o=0,repeatType:d,velocity:h=0}=a;let{keyframes:p}=a;const m=s||dl;m!==dl&&typeof p[0]!="number"&&(this.mixKeyframes=El(wE,jy(p[0],p[1])),p=[0,100]);const g=m({...a,keyframes:p});d==="mirror"&&(this.mirroredGenerator=m({...a,keyframes:[...p].reverse(),velocity:-h})),g.calculatedDuration===null&&(g.calculatedDuration=Gd(g));const{calculatedDuration:x}=g;this.calculatedDuration=x,this.resolvedDuration=x+o,this.totalDuration=this.resolvedDuration*(r+1)-o,this.generator=g}updateTime(a){const s=Math.round(a-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=s}tick(a,s=!1){const{generator:r,totalDuration:o,mixKeyframes:d,mirroredGenerator:h,resolvedDuration:p,calculatedDuration:m}=this;if(this.startTime===null)return r.next(0);const{delay:g=0,keyframes:x,repeat:y,repeatType:S,repeatDelay:w,type:j,onUpdate:E,finalKeyframe:C}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,a):this.speed<0&&(this.startTime=Math.min(a-o/this.speed,this.startTime)),s?this.currentTime=a:this.updateTime(a);const z=this.currentTime-g*(this.playbackSpeed>=0?1:-1),D=this.playbackSpeed>=0?z<0:z>o;this.currentTime=Math.max(z,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let R=this.currentTime,k=r;if(y){const W=Math.min(this.currentTime,o)/p;let re=Math.floor(W),B=W%1;!B&&W>=1&&(B=1),B===1&&re--,re=Math.min(re,y+1),!!(re%2)&&(S==="reverse"?(B=1-B,w&&(B-=w/p)):S==="mirror"&&(k=h)),R=pn(0,1,B)*p}let U;D?(this.delayState.value=x[0],U=this.delayState):U=k.next(R),d&&!D&&(U.value=d(U.value));let{done:P}=U;!D&&m!==null&&(P=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const F=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&P);return F&&j!==ad&&(U.value=Bo(x,this.options,C,this.speed)),E&&E(U.value),F&&this.finish(),U}then(a,s){return this.finished.then(a,s)}get duration(){return Pt(this.calculatedDuration)}get iterationDuration(){const{delay:a=0}=this.options||{};return this.duration+Pt(a)}get time(){return Pt(this.currentTime)}set time(a){a=Ut(a),this.currentTime=a,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=a:this.driver&&(this.startTime=this.driver.now()-a/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=a,this.tick(a))}getGeneratorVelocity(){const a=this.currentTime;if(a<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(a);const s=this.generator.next(a).value;return Ny(r=>this.generator.next(r).value,a,s)}get speed(){return this.playbackSpeed}set speed(a){const s=this.playbackSpeed!==a;s&&this.driver&&this.updateTime(vt.now()),this.playbackSpeed=a,s&&this.driver&&(this.time=Pt(this.currentTime))}play(){var o,d;if(this.isStopped)return;const{driver:a=sE,startTime:s}=this.options;this.driver||(this.driver=a(h=>this.tick(h))),(d=(o=this.options).onPlay)==null||d.call(o);const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=s??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(vt.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var a,s;this.notifyFinished(),this.teardown(),this.state="finished",(s=(a=this.options).onComplete)==null||s.call(a)}cancel(){var a,s;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(s=(a=this.options).onCancel)==null||s.call(a)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(a){return this.startTime=0,this.tick(a,!0)}attachTimeline(a){var s;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(s=this.driver)==null||s.stop(),a.observe(this)}}function TE(n){for(let a=1;a<n.length;a++)n[a]??(n[a]=n[a-1])}const Qa=n=>n*180/Math.PI,id=n=>{const a=Qa(Math.atan2(n[1],n[0]));return sd(a)},jE={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:n=>(Math.abs(n[0])+Math.abs(n[3]))/2,rotate:id,rotateZ:id,skewX:n=>Qa(Math.atan(n[1])),skewY:n=>Qa(Math.atan(n[2])),skew:n=>(Math.abs(n[1])+Math.abs(n[2]))/2},sd=n=>(n=n%360,n<0&&(n+=360),n),Gv=id,Xv=n=>Math.sqrt(n[0]*n[0]+n[1]*n[1]),Kv=n=>Math.sqrt(n[4]*n[4]+n[5]*n[5]),EE={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Xv,scaleY:Kv,scale:n=>(Xv(n)+Kv(n))/2,rotateX:n=>sd(Qa(Math.atan2(n[6],n[5]))),rotateY:n=>sd(Qa(Math.atan2(-n[2],n[0]))),rotateZ:Gv,rotate:Gv,skewX:n=>Qa(Math.atan(n[4])),skewY:n=>Qa(Math.atan(n[1])),skew:n=>(Math.abs(n[1])+Math.abs(n[4]))/2};function ld(n){return n.includes("scale")?1:0}function rd(n,a){if(!n||n==="none")return ld(a);const s=n.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,o;if(s)r=EE,o=s;else{const p=n.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=jE,o=p}if(!o)return ld(a);const d=r[a],h=o[1].split(",").map(AE);return typeof d=="function"?d(h):h[d]}const NE=(n,a)=>{const{transform:s="none"}=getComputedStyle(n);return rd(s,a)};function AE(n){return parseFloat(n.trim())}const es=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ts=new Set(es),Fv=n=>n===Ii||n===te,CE=new Set(["x","y","z"]),ME=es.filter(n=>!CE.has(n));function DE(n){const a=[];return ME.forEach(s=>{const r=n.getValue(s);r!==void 0&&(a.push([s,r.get()]),r.set(s.startsWith("scale")?1:0))}),a}const pa={width:({x:n},{paddingLeft:a="0",paddingRight:s="0",boxSizing:r})=>{const o=n.max-n.min;return r==="border-box"?o:o-parseFloat(a)-parseFloat(s)},height:({y:n},{paddingTop:a="0",paddingBottom:s="0",boxSizing:r})=>{const o=n.max-n.min;return r==="border-box"?o:o-parseFloat(a)-parseFloat(s)},top:(n,{top:a})=>parseFloat(a),left:(n,{left:a})=>parseFloat(a),bottom:({y:n},{top:a})=>parseFloat(a)+(n.max-n.min),right:({x:n},{left:a})=>parseFloat(a)+(n.max-n.min),x:(n,{transform:a})=>rd(a,"x"),y:(n,{transform:a})=>rd(a,"y")};pa.translateX=pa.x;pa.translateY=pa.y;const Pa=new Set;let od=!1,ud=!1,cd=!1;function Cy(){if(ud){const n=Array.from(Pa).filter(r=>r.needsMeasurement),a=new Set(n.map(r=>r.element)),s=new Map;a.forEach(r=>{const o=DE(r);o.length&&(s.set(r,o),r.render())}),n.forEach(r=>r.measureInitialState()),a.forEach(r=>{r.render();const o=s.get(r);o&&o.forEach(([d,h])=>{var p;(p=r.getValue(d))==null||p.set(h)})}),n.forEach(r=>r.measureEndState()),n.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}ud=!1,od=!1,Pa.forEach(n=>n.complete(cd)),Pa.clear()}function My(){Pa.forEach(n=>{n.readKeyframes(),n.needsMeasurement&&(ud=!0)})}function OE(){cd=!0,My(),Cy(),cd=!1}class Kd{constructor(a,s,r,o,d,h=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...a],this.onComplete=s,this.name=r,this.motionValue=o,this.element=d,this.isAsync=h}scheduleResolve(){this.state="scheduled",this.isAsync?(Pa.add(this),od||(od=!0,ke.read(My),ke.resolveKeyframes(Cy))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:a,name:s,element:r,motionValue:o}=this;if(a[0]===null){const d=o==null?void 0:o.get(),h=a[a.length-1];if(d!==void 0)a[0]=d;else if(r&&s){const p=r.readValue(s,h);p!=null&&(a[0]=p)}a[0]===void 0&&(a[0]=h),o&&d===void 0&&o.set(a[0])}TE(a)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(a=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,a),Pa.delete(this)}cancel(){this.state==="scheduled"&&(Pa.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const RE=n=>n.startsWith("--");function Dy(n,a,s){RE(a)?n.style.setProperty(a,s):n.style[a]=s}const zE={};function Oy(n,a){const s=iy(n);return()=>zE[a]??s()}const kE=Oy(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),Ry=Oy(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),il=([n,a,s,r])=>`cubic-bezier(${n}, ${a}, ${s}, ${r})`,Zv={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:il([0,.65,.55,1]),circOut:il([.55,0,1,.45]),backIn:il([.31,.01,.66,-.59]),backOut:il([.33,1.53,.69,.99])};function zy(n,a){if(n)return typeof n=="function"?Ry()?Ey(n,a):"ease-out":py(n)?il(n):Array.isArray(n)?n.map(s=>zy(s,a)||Zv.easeOut):Zv[n]}function LE(n,a,s,{delay:r=0,duration:o=300,repeat:d=0,repeatType:h="loop",ease:p="easeOut",times:m}={},g=void 0){const x={[a]:s};m&&(x.offset=m);const y=zy(p,o);Array.isArray(y)&&(x.easing=y);const S={delay:r,duration:o,easing:Array.isArray(y)?"linear":y,fill:"both",iterations:d+1,direction:h==="reverse"?"alternate":"normal"};return g&&(S.pseudoElement=g),n.animate(x,S)}function ky(n){return typeof n=="function"&&"applyToOptions"in n}function VE({type:n,...a}){return ky(n)&&Ry()?n.applyToOptions(a):(a.duration??(a.duration=300),a.ease??(a.ease="easeOut"),a)}class Ly extends Xd{constructor(a){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!a)return;const{element:s,name:r,keyframes:o,pseudoElement:d,allowFlatten:h=!1,finalKeyframe:p,onComplete:m}=a;this.isPseudoElement=!!d,this.allowFlatten=h,this.options=a,Vd(typeof a.type!="string");const g=VE(a);this.animation=LE(s,r,o,g,d),g.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!d){const x=Bo(o,this.options,p,this.speed);this.updateMotionValue&&this.updateMotionValue(x),Dy(s,r,x),this.animation.cancel()}m==null||m(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var a,s;(s=(a=this.animation).finish)==null||s.call(a)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:a}=this;a==="idle"||a==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var s,r,o;const a=(s=this.options)==null?void 0:s.element;!this.isPseudoElement&&(a!=null&&a.isConnected)&&((o=(r=this.animation).commitStyles)==null||o.call(r))}get duration(){var s,r;const a=((r=(s=this.animation.effect)==null?void 0:s.getComputedTiming)==null?void 0:r.call(s).duration)||0;return Pt(Number(a))}get iterationDuration(){const{delay:a=0}=this.options||{};return this.duration+Pt(a)}get time(){return Pt(Number(this.animation.currentTime)||0)}set time(a){const s=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Ut(a),s&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(a){a<0&&(this.finishedTime=null),this.animation.playbackRate=a}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(a){this.manualStartTime=this.animation.startTime=a}attachTimeline({timeline:a,rangeStart:s,rangeEnd:r,observe:o}){var d;return this.allowFlatten&&((d=this.animation.effect)==null||d.updateTiming({easing:"linear"})),this.animation.onfinish=null,a&&kE()?(this.animation.timeline=a,s&&(this.animation.rangeStart=s),r&&(this.animation.rangeEnd=r),Jt):o(this)}}const Vy={anticipate:fy,backInOut:cy,circInOut:hy};function _E(n){return n in Vy}function UE(n){typeof n.ease=="string"&&_E(n.ease)&&(n.ease=Vy[n.ease])}const Nf=10;class BE extends Ly{constructor(a){UE(a),Ay(a),super(a),a.startTime!==void 0&&a.autoplay!==!1&&(this.startTime=a.startTime),this.options=a}updateMotionValue(a){const{motionValue:s,onUpdate:r,onComplete:o,element:d,...h}=this.options;if(!s)return;if(a!==void 0){s.set(a);return}const p=new jo({...h,autoplay:!1}),m=Math.max(Nf,vt.now()-this.startTime),g=pn(0,Nf,m-Nf),x=p.sample(m).value,{name:y}=this.options;d&&y&&Dy(d,y,x),s.setWithVelocity(p.sample(Math.max(0,m-g)).value,x,g),p.stop()}}const Qv=(n,a)=>a==="zIndex"?!1:!!(typeof n=="number"||Array.isArray(n)||typeof n=="string"&&(sn.test(n)||n==="0")&&!n.startsWith("url("));function HE(n){const a=n[0];if(n.length===1)return!0;for(let s=0;s<n.length;s++)if(n[s]!==a)return!0}function $E(n,a,s,r){const o=n[0];if(o===null)return!1;if(a==="display"||a==="visibility")return!0;const d=n[n.length-1],h=Qv(o,a),p=Qv(d,a);return!h||!p?!1:HE(n)||(s==="spring"||ky(s))&&r}function fd(n){n.duration=0,n.type="keyframes"}const _y=new Set(["opacity","clipPath","filter","transform"]),qE=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function YE(n){for(let a=0;a<n.length;a++)if(typeof n[a]=="string"&&qE.test(n[a]))return!0;return!1}const GE=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),XE=iy(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function KE(n){var y;const{motionValue:a,name:s,repeatDelay:r,repeatType:o,damping:d,type:h,keyframes:p}=n;if(!(((y=a==null?void 0:a.owner)==null?void 0:y.current)instanceof HTMLElement))return!1;const{onUpdate:g,transformTemplate:x}=a.owner.getProps();return XE()&&s&&(_y.has(s)||GE.has(s)&&YE(p))&&(s!=="transform"||!x)&&!g&&!r&&o!=="mirror"&&d!==0&&h!=="inertia"}const FE=40;class ZE extends Xd{constructor({autoplay:a=!0,delay:s=0,type:r="keyframes",repeat:o=0,repeatDelay:d=0,repeatType:h="loop",keyframes:p,name:m,motionValue:g,element:x,...y}){var j;super(),this.stop=()=>{var E,C;this._animation&&(this._animation.stop(),(E=this.stopTimeline)==null||E.call(this)),(C=this.keyframeResolver)==null||C.cancel()},this.createdAt=vt.now();const S={autoplay:a,delay:s,type:r,repeat:o,repeatDelay:d,repeatType:h,name:m,motionValue:g,element:x,...y},w=(x==null?void 0:x.KeyframeResolver)||Kd;this.keyframeResolver=new w(p,(E,C,z)=>this.onKeyframesResolved(E,C,S,!z),m,g,x),(j=this.keyframeResolver)==null||j.scheduleResolve()}onKeyframesResolved(a,s,r,o){var z,D;this.keyframeResolver=void 0;const{name:d,type:h,velocity:p,delay:m,isHandoff:g,onUpdate:x}=r;this.resolvedAt=vt.now();let y=!0;$E(a,d,h,p)||(y=!1,(va.instantAnimations||!m)&&(x==null||x(Bo(a,r,s))),a[0]=a[a.length-1],fd(r),r.repeat=0);const w={startTime:o?this.resolvedAt?this.resolvedAt-this.createdAt>FE?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:s,...r,keyframes:a},j=y&&!g&&KE(w),E=(D=(z=w.motionValue)==null?void 0:z.owner)==null?void 0:D.current;let C;if(j)try{C=new BE({...w,element:E})}catch{C=new jo(w)}else C=new jo(w);C.finished.then(()=>{this.notifyFinished()}).catch(Jt),this.pendingTimeline&&(this.stopTimeline=C.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=C}get finished(){return this._animation?this.animation.finished:this._finished}then(a,s){return this.finished.finally(a).then(()=>{})}get animation(){var a;return this._animation||((a=this.keyframeResolver)==null||a.resume(),OE()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(a){this.animation.time=a}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(a){this.animation.speed=a}get startTime(){return this.animation.startTime}attachTimeline(a){return this._animation?this.stopTimeline=this.animation.attachTimeline(a):this.pendingTimeline=a,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var a;this._animation&&this.animation.cancel(),(a=this.keyframeResolver)==null||a.cancel()}}function Uy(n,a,s,r=0,o=1){const d=Array.from(n).sort((g,x)=>g.sortNodePosition(x)).indexOf(a),h=n.size,p=(h-1)*r;return typeof s=="function"?s(d,h):o===1?d*r:p-d*r}const QE=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function PE(n){const a=QE.exec(n);if(!a)return[,];const[,s,r,o]=a;return[`--${s??r}`,o]}function By(n,a,s=1){const[r,o]=PE(n);if(!r)return;const d=window.getComputedStyle(a).getPropertyValue(r);if(d){const h=d.trim();return ty(h)?parseFloat(h):h}return Hd(o)?By(o,a,s+1):o}const JE={type:"spring",stiffness:500,damping:25,restSpeed:10},WE=n=>({type:"spring",stiffness:550,damping:n===0?2*Math.sqrt(550):30,restSpeed:10}),IE={type:"keyframes",duration:.8},e5={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},t5=(n,{keyframes:a})=>a.length>2?IE:ts.has(n)?n.startsWith("scale")?WE(a[1]):JE:e5;function Hy(n,a){if(n!=null&&n.inherit&&a){const{inherit:s,...r}=n;return{...a,...r}}return n}function Fd(n,a){const s=(n==null?void 0:n[a])??(n==null?void 0:n.default)??n;return s!==n?Hy(s,n):s}const n5=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function a5(n){for(const a in n)if(!n5.has(a))return!0;return!1}const Zd=(n,a,s,r={},o,d)=>h=>{const p=Fd(r,n)||{},m=p.delay||r.delay||0;let{elapsed:g=0}=r;g=g-Ut(m);const x={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:a.getVelocity(),...p,delay:-g,onUpdate:S=>{a.set(S),p.onUpdate&&p.onUpdate(S)},onComplete:()=>{h(),p.onComplete&&p.onComplete()},name:n,motionValue:a,element:d?void 0:o};a5(p)||Object.assign(x,t5(n,x)),x.duration&&(x.duration=Ut(x.duration)),x.repeatDelay&&(x.repeatDelay=Ut(x.repeatDelay)),x.from!==void 0&&(x.keyframes[0]=x.from);let y=!1;if((x.type===!1||x.duration===0&&!x.repeatDelay)&&(fd(x),x.delay===0&&(y=!0)),(va.instantAnimations||va.skipAnimations||o!=null&&o.shouldSkipAnimations)&&(y=!0,fd(x),x.delay=0),x.allowFlatten=!p.type&&!p.ease,y&&!d&&a.get()!==void 0){const S=Bo(x.keyframes,p);if(S!==void 0){ke.update(()=>{x.onUpdate(S),x.onComplete()});return}}return p.isSync?new jo(x):new ZE(x)};function Pv(n){const a=[{},{}];return n==null||n.values.forEach((s,r)=>{a[0][r]=s.get(),a[1][r]=s.getVelocity()}),a}function Qd(n,a,s,r){if(typeof a=="function"){const[o,d]=Pv(r);a=a(s!==void 0?s:n.custom,o,d)}if(typeof a=="string"&&(a=n.variants&&n.variants[a]),typeof a=="function"){const[o,d]=Pv(r);a=a(s!==void 0?s:n.custom,o,d)}return a}function Ja(n,a,s){const r=n.getProps();return Qd(r,a,s!==void 0?s:r.custom,n)}const $y=new Set(["width","height","top","left","right","bottom",...es]),Jv=30,i5=n=>!isNaN(parseFloat(n));class s5{constructor(a,s={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{var d;const o=vt.now();if(this.updatedAt!==o&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&((d=this.events.change)==null||d.notify(this.current),this.dependents))for(const h of this.dependents)h.dirty()},this.hasAnimated=!1,this.setCurrent(a),this.owner=s.owner}setCurrent(a){this.current=a,this.updatedAt=vt.now(),this.canTrackVelocity===null&&a!==void 0&&(this.canTrackVelocity=i5(this.current))}setPrevFrameValue(a=this.current){this.prevFrameValue=a,this.prevUpdatedAt=this.updatedAt}onChange(a){return this.on("change",a)}on(a,s){this.events[a]||(this.events[a]=new _d);const r=this.events[a].add(s);return a==="change"?()=>{r(),ke.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const a in this.events)this.events[a].clear()}attach(a,s){this.passiveEffect=a,this.stopPassiveEffect=s}set(a){this.passiveEffect?this.passiveEffect(a,this.updateAndNotify):this.updateAndNotify(a)}setWithVelocity(a,s,r){this.set(s),this.prev=void 0,this.prevFrameValue=a,this.prevUpdatedAt=this.updatedAt-r}jump(a,s=!0){this.updateAndNotify(a),this.prev=a,this.prevUpdatedAt=this.prevFrameValue=void 0,s&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var a;(a=this.events.change)==null||a.notify(this.current)}addDependent(a){this.dependents||(this.dependents=new Set),this.dependents.add(a)}removeDependent(a){this.dependents&&this.dependents.delete(a)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const a=vt.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||a-this.updatedAt>Jv)return 0;const s=Math.min(this.updatedAt-this.prevUpdatedAt,Jv);return sy(parseFloat(this.current)-parseFloat(this.prevFrameValue),s)}start(a){return this.stop(),new Promise(s=>{this.hasAnimated=!0,this.animation=a(s),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var a,s;(a=this.dependents)==null||a.clear(),(s=this.events.destroy)==null||s.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Qi(n,a){return new s5(n,a)}const dd=n=>Array.isArray(n);function l5(n,a,s){n.hasValue(a)?n.getValue(a).set(s):n.addValue(a,Qi(s))}function r5(n){return dd(n)?n[n.length-1]||0:n}function o5(n,a){const s=Ja(n,a);let{transitionEnd:r={},transition:o={},...d}=s||{};d={...d,...r};for(const h in d){const p=r5(d[h]);l5(n,h,p)}}const ft=n=>!!(n&&n.getVelocity);function u5(n){return!!(ft(n)&&n.add)}function hd(n,a){const s=n.getValue("willChange");if(u5(s))return s.add(a);if(!s&&va.WillChange){const r=new va.WillChange("auto");n.addValue("willChange",r),r.add(a)}}function Pd(n){return n.replace(/([A-Z])/g,a=>`-${a.toLowerCase()}`)}const c5="framerAppearId",qy="data-"+Pd(c5);function Yy(n){return n.props[qy]}function f5({protectedKeys:n,needsAnimating:a},s){const r=n.hasOwnProperty(s)&&a[s]!==!0;return a[s]=!1,r}function Gy(n,a,{delay:s=0,transitionOverride:r,type:o}={}){let{transition:d,transitionEnd:h,...p}=a;const m=n.getDefaultTransition();d=d?Hy(d,m):m;const g=d==null?void 0:d.reduceMotion;r&&(d=r);const x=[],y=o&&n.animationState&&n.animationState.getState()[o];for(const S in p){const w=n.getValue(S,n.latestValues[S]??null),j=p[S];if(j===void 0||y&&f5(y,S))continue;const E={delay:s,...Fd(d||{},S)},C=w.get();if(C!==void 0&&!w.isAnimating()&&!Array.isArray(j)&&j===C&&!E.velocity){ke.update(()=>w.set(j));continue}let z=!1;if(window.MotionHandoffAnimation){const k=Yy(n);if(k){const U=window.MotionHandoffAnimation(k,S,ke);U!==null&&(E.startTime=U,z=!0)}}hd(n,S);const D=g??n.shouldReduceMotion;w.start(Zd(S,w,j,D&&$y.has(S)?{type:!1}:E,n,z));const R=w.animation;R&&x.push(R)}if(h){const S=()=>ke.update(()=>{h&&o5(n,h)});x.length?Promise.all(x).then(S):S()}return x}function md(n,a,s={}){var m;const r=Ja(n,a,s.type==="exit"?(m=n.presenceContext)==null?void 0:m.custom:void 0);let{transition:o=n.getDefaultTransition()||{}}=r||{};s.transitionOverride&&(o=s.transitionOverride);const d=r?()=>Promise.all(Gy(n,r,s)):()=>Promise.resolve(),h=n.variantChildren&&n.variantChildren.size?(g=0)=>{const{delayChildren:x=0,staggerChildren:y,staggerDirection:S}=o;return d5(n,a,g,x,y,S,s)}:()=>Promise.resolve(),{when:p}=o;if(p){const[g,x]=p==="beforeChildren"?[d,h]:[h,d];return g().then(()=>x())}else return Promise.all([d(),h(s.delay)])}function d5(n,a,s=0,r=0,o=0,d=1,h){const p=[];for(const m of n.variantChildren)m.notify("AnimationStart",a),p.push(md(m,a,{...h,delay:s+(typeof r=="function"?0:r)+Uy(n.variantChildren,m,r,o,d)}).then(()=>m.notify("AnimationComplete",a)));return Promise.all(p)}function h5(n,a,s={}){n.notify("AnimationStart",a);let r;if(Array.isArray(a)){const o=a.map(d=>md(n,d,s));r=Promise.all(o)}else if(typeof a=="string")r=md(n,a,s);else{const o=typeof a=="function"?Ja(n,a,s.custom):a;r=Promise.all(Gy(n,o,s))}return r.then(()=>{n.notify("AnimationComplete",a)})}const m5={test:n=>n==="auto",parse:n=>n},Xy=n=>a=>a.test(n),Ky=[Ii,te,mn,ca,Hj,Bj,m5],Wv=n=>Ky.find(Xy(n));function p5(n){return typeof n=="number"?n===0:n!==null?n==="none"||n==="0"||ay(n):!0}const g5=new Set(["brightness","contrast","saturate","opacity"]);function v5(n){const[a,s]=n.slice(0,-1).split("(");if(a==="drop-shadow")return n;const[r]=s.match($d)||[];if(!r)return n;const o=s.replace(r,"");let d=g5.has(a)?1:0;return r!==s&&(d*=100),a+"("+d+o+")"}const x5=/\b([a-z-]*)\(.*?\)/gu,pd={...sn,getAnimatableNone:n=>{const a=n.match(x5);return a?a.map(v5).join(" "):n}},gd={...sn,getAnimatableNone:n=>{const a=sn.parse(n);return sn.createTransformer(n)(a.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},Iv={...Ii,transform:Math.round},y5={rotate:ca,rotateX:ca,rotateY:ca,rotateZ:ca,scale:Ir,scaleX:Ir,scaleY:Ir,scaleZ:Ir,skew:ca,skewX:ca,skewY:ca,distance:te,translateX:te,translateY:te,translateZ:te,x:te,y:te,z:te,perspective:te,transformPerspective:te,opacity:xl,originX:Bv,originY:Bv,originZ:te},Jd={borderWidth:te,borderTopWidth:te,borderRightWidth:te,borderBottomWidth:te,borderLeftWidth:te,borderRadius:te,borderTopLeftRadius:te,borderTopRightRadius:te,borderBottomRightRadius:te,borderBottomLeftRadius:te,width:te,maxWidth:te,height:te,maxHeight:te,top:te,right:te,bottom:te,left:te,inset:te,insetBlock:te,insetBlockStart:te,insetBlockEnd:te,insetInline:te,insetInlineStart:te,insetInlineEnd:te,padding:te,paddingTop:te,paddingRight:te,paddingBottom:te,paddingLeft:te,paddingBlock:te,paddingBlockStart:te,paddingBlockEnd:te,paddingInline:te,paddingInlineStart:te,paddingInlineEnd:te,margin:te,marginTop:te,marginRight:te,marginBottom:te,marginLeft:te,marginBlock:te,marginBlockStart:te,marginBlockEnd:te,marginInline:te,marginInlineStart:te,marginInlineEnd:te,fontSize:te,backgroundPositionX:te,backgroundPositionY:te,...y5,zIndex:Iv,fillOpacity:xl,strokeOpacity:xl,numOctaves:Iv},b5={...Jd,color:Ie,backgroundColor:Ie,outlineColor:Ie,fill:Ie,stroke:Ie,borderColor:Ie,borderTopColor:Ie,borderRightColor:Ie,borderBottomColor:Ie,borderLeftColor:Ie,filter:pd,WebkitFilter:pd,mask:gd,WebkitMask:gd},Fy=n=>b5[n],S5=new Set([pd,gd]);function Zy(n,a){let s=Fy(n);return S5.has(s)||(s=sn),s.getAnimatableNone?s.getAnimatableNone(a):void 0}const w5=new Set(["auto","none","0"]);function T5(n,a,s){let r=0,o;for(;r<n.length&&!o;){const d=n[r];typeof d=="string"&&!w5.has(d)&&Zi(d).values.length&&(o=n[r]),r++}if(o&&s)for(const d of a)n[d]=Zy(s,o)}class j5 extends Kd{constructor(a,s,r,o,d){super(a,s,r,o,d,!0)}readKeyframes(){const{unresolvedKeyframes:a,element:s,name:r}=this;if(!s||!s.current)return;super.readKeyframes();for(let x=0;x<a.length;x++){let y=a[x];if(typeof y=="string"&&(y=y.trim(),Hd(y))){const S=By(y,s.current);S!==void 0&&(a[x]=S),x===a.length-1&&(this.finalKeyframe=y)}}if(this.resolveNoneKeyframes(),!$y.has(r)||a.length!==2)return;const[o,d]=a,h=Wv(o),p=Wv(d),m=Uv(o),g=Uv(d);if(m!==g&&pa[r]){this.needsMeasurement=!0;return}if(h!==p)if(Fv(h)&&Fv(p))for(let x=0;x<a.length;x++){const y=a[x];typeof y=="string"&&(a[x]=parseFloat(y))}else pa[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:a,name:s}=this,r=[];for(let o=0;o<a.length;o++)(a[o]===null||p5(a[o]))&&r.push(o);r.length&&T5(a,r,s)}measureInitialState(){const{element:a,unresolvedKeyframes:s,name:r}=this;if(!a||!a.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=pa[r](a.measureViewportBox(),window.getComputedStyle(a.current)),s[0]=this.measuredOrigin;const o=s[s.length-1];o!==void 0&&a.getValue(r,o).jump(o,!1)}measureEndState(){var p;const{element:a,name:s,unresolvedKeyframes:r}=this;if(!a||!a.current)return;const o=a.getValue(s);o&&o.jump(this.measuredOrigin,!1);const d=r.length-1,h=r[d];r[d]=pa[s](a.measureViewportBox(),window.getComputedStyle(a.current)),h!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=h),(p=this.removedTransforms)!=null&&p.length&&this.removedTransforms.forEach(([m,g])=>{a.getValue(m).set(g)}),this.resolveNoneKeyframes()}}function Qy(n,a,s){if(n==null)return[];if(n instanceof EventTarget)return[n];if(typeof n=="string"){let r=document;const o=(s==null?void 0:s[n])??r.querySelectorAll(n);return o?Array.from(o):[]}return Array.from(n).filter(r=>r!=null)}const Py=(n,a)=>a&&typeof n=="number"?a.transform(n):n;function E5(n){return ny(n)&&"offsetHeight"in n&&!("ownerSVGElement"in n)}const{schedule:Wd}=gy(queueMicrotask,!1),nn={x:!1,y:!1};function Jy(){return nn.x||nn.y}function N5(n){return n==="x"||n==="y"?nn[n]?null:(nn[n]=!0,()=>{nn[n]=!1}):nn.x||nn.y?null:(nn.x=nn.y=!0,()=>{nn.x=nn.y=!1})}function Wy(n,a){const s=Qy(n),r=new AbortController,o={passive:!0,...a,signal:r.signal};return[s,o,()=>r.abort()]}function A5(n){return!(n.pointerType==="touch"||Jy())}function C5(n,a,s={}){const[r,o,d]=Wy(n,s);return r.forEach(h=>{let p=!1,m=!1,g;const x=()=>{h.removeEventListener("pointerleave",j)},y=C=>{g&&(g(C),g=void 0),x()},S=C=>{p=!1,window.removeEventListener("pointerup",S),window.removeEventListener("pointercancel",S),m&&(m=!1,y(C))},w=()=>{p=!0,window.addEventListener("pointerup",S,o),window.addEventListener("pointercancel",S,o)},j=C=>{if(C.pointerType!=="touch"){if(p){m=!0;return}y(C)}},E=C=>{if(!A5(C))return;m=!1;const z=a(h,C);typeof z=="function"&&(g=z,h.addEventListener("pointerleave",j,o))};h.addEventListener("pointerenter",E,o),h.addEventListener("pointerdown",w,o)}),d}const Iy=(n,a)=>a?n===a?!0:Iy(n,a.parentElement):!1,Id=n=>n.pointerType==="mouse"?typeof n.button!="number"||n.button<=0:n.isPrimary!==!1,M5=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function D5(n){return M5.has(n.tagName)||n.isContentEditable===!0}const O5=new Set(["INPUT","SELECT","TEXTAREA"]);function R5(n){return O5.has(n.tagName)||n.isContentEditable===!0}const ro=new WeakSet;function e0(n){return a=>{a.key==="Enter"&&n(a)}}function Af(n,a){n.dispatchEvent(new PointerEvent("pointer"+a,{isPrimary:!0,bubbles:!0}))}const z5=(n,a)=>{const s=n.currentTarget;if(!s)return;const r=e0(()=>{if(ro.has(s))return;Af(s,"down");const o=e0(()=>{Af(s,"up")}),d=()=>Af(s,"cancel");s.addEventListener("keyup",o,a),s.addEventListener("blur",d,a)});s.addEventListener("keydown",r,a),s.addEventListener("blur",()=>s.removeEventListener("keydown",r),a)};function t0(n){return Id(n)&&!Jy()}const n0=new WeakSet;function k5(n,a,s={}){const[r,o,d]=Wy(n,s),h=p=>{const m=p.currentTarget;if(!t0(p)||n0.has(p))return;ro.add(m),s.stopPropagation&&n0.add(p);const g=a(m,p),x=(w,j)=>{window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",S),ro.has(m)&&ro.delete(m),t0(w)&&typeof g=="function"&&g(w,{success:j})},y=w=>{x(w,m===window||m===document||s.useGlobalTarget||Iy(m,w.target))},S=w=>{x(w,!1)};window.addEventListener("pointerup",y,o),window.addEventListener("pointercancel",S,o)};return r.forEach(p=>{(s.useGlobalTarget?window:p).addEventListener("pointerdown",h,o),E5(p)&&(p.addEventListener("focus",g=>z5(g,o)),!D5(p)&&!p.hasAttribute("tabindex")&&(p.tabIndex=0))}),d}function eh(n){return ny(n)&&"ownerSVGElement"in n}const oo=new WeakMap;let fa;const eb=(n,a,s)=>(r,o)=>o&&o[0]?o[0][n+"Size"]:eh(r)&&"getBBox"in r?r.getBBox()[a]:r[s],L5=eb("inline","width","offsetWidth"),V5=eb("block","height","offsetHeight");function _5({target:n,borderBoxSize:a}){var s;(s=oo.get(n))==null||s.forEach(r=>{r(n,{get width(){return L5(n,a)},get height(){return V5(n,a)}})})}function U5(n){n.forEach(_5)}function B5(){typeof ResizeObserver>"u"||(fa=new ResizeObserver(U5))}function H5(n,a){fa||B5();const s=Qy(n);return s.forEach(r=>{let o=oo.get(r);o||(o=new Set,oo.set(r,o)),o.add(a),fa==null||fa.observe(r)}),()=>{s.forEach(r=>{const o=oo.get(r);o==null||o.delete(a),o!=null&&o.size||fa==null||fa.unobserve(r)})}}const uo=new Set;let Yi;function $5(){Yi=()=>{const n={get width(){return window.innerWidth},get height(){return window.innerHeight}};uo.forEach(a=>a(n))},window.addEventListener("resize",Yi)}function q5(n){return uo.add(n),Yi||$5(),()=>{uo.delete(n),!uo.size&&typeof Yi=="function"&&(window.removeEventListener("resize",Yi),Yi=void 0)}}function a0(n,a){return typeof n=="function"?q5(n):H5(n,a)}function Y5(n){return eh(n)&&n.tagName==="svg"}const G5=[...Ky,Ie,sn],X5=n=>G5.find(Xy(n)),i0=()=>({translate:0,scale:1,origin:0,originPoint:0}),Gi=()=>({x:i0(),y:i0()}),s0=()=>({min:0,max:0}),nt=()=>({x:s0(),y:s0()}),K5=new WeakMap;function Ho(n){return n!==null&&typeof n=="object"&&typeof n.start=="function"}function yl(n){return typeof n=="string"||Array.isArray(n)}const th=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],nh=["initial",...th];function $o(n){return Ho(n.animate)||nh.some(a=>yl(n[a]))}function tb(n){return!!($o(n)||n.variants)}function F5(n,a,s){for(const r in a){const o=a[r],d=s[r];if(ft(o))n.addValue(r,o);else if(ft(d))n.addValue(r,Qi(o,{owner:n}));else if(d!==o)if(n.hasValue(r)){const h=n.getValue(r);h.liveStyle===!0?h.jump(o):h.hasAnimated||h.set(o)}else{const h=n.getStaticValue(r);n.addValue(r,Qi(h!==void 0?h:o,{owner:n}))}}for(const r in s)a[r]===void 0&&n.removeValue(r);return a}const vd={current:null},nb={current:!1},Z5=typeof window<"u";function Q5(){if(nb.current=!0,!!Z5)if(window.matchMedia){const n=window.matchMedia("(prefers-reduced-motion)"),a=()=>vd.current=n.matches;n.addEventListener("change",a),a()}else vd.current=!1}const l0=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Eo={};function ab(n){Eo=n}function P5(){return Eo}class J5{scrapeMotionValuesFromProps(a,s,r){return{}}constructor({parent:a,props:s,presenceContext:r,reducedMotionConfig:o,skipAnimations:d,blockInitialAnimation:h,visualState:p},m={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Kd,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const w=vt.now();this.renderScheduledAt<w&&(this.renderScheduledAt=w,ke.render(this.render,!1,!0))};const{latestValues:g,renderState:x}=p;this.latestValues=g,this.baseTarget={...g},this.initialValues=s.initial?{...g}:{},this.renderState=x,this.parent=a,this.props=s,this.presenceContext=r,this.depth=a?a.depth+1:0,this.reducedMotionConfig=o,this.skipAnimationsConfig=d,this.options=m,this.blockInitialAnimation=!!h,this.isControllingVariants=$o(s),this.isVariantNode=tb(s),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(a&&a.current);const{willChange:y,...S}=this.scrapeMotionValuesFromProps(s,{},this);for(const w in S){const j=S[w];g[w]!==void 0&&ft(j)&&j.set(g[w])}}mount(a){var s,r;if(this.hasBeenMounted)for(const o in this.initialValues)(s=this.values.get(o))==null||s.jump(this.initialValues[o]),this.latestValues[o]=this.initialValues[o];this.current=a,K5.set(a,this),this.projection&&!this.projection.instance&&this.projection.mount(a),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((o,d)=>this.bindToMotionValue(d,o)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(nb.current||Q5(),this.shouldReduceMotion=vd.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(r=this.parent)==null||r.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var a;this.projection&&this.projection.unmount(),xa(this.notifyUpdate),xa(this.render),this.valueSubscriptions.forEach(s=>s()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(a=this.parent)==null||a.removeChild(this);for(const s in this.events)this.events[s].clear();for(const s in this.features){const r=this.features[s];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(a){this.children.add(a),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(a)}removeChild(a){this.children.delete(a),this.enteringChildren&&this.enteringChildren.delete(a)}bindToMotionValue(a,s){if(this.valueSubscriptions.has(a)&&this.valueSubscriptions.get(a)(),s.accelerate&&_y.has(a)&&this.current instanceof HTMLElement){const{factory:h,keyframes:p,times:m,ease:g,duration:x}=s.accelerate,y=new Ly({element:this.current,name:a,keyframes:p,times:m,ease:g,duration:Ut(x)}),S=h(y);this.valueSubscriptions.set(a,()=>{S(),y.cancel()});return}const r=ts.has(a);r&&this.onBindTransform&&this.onBindTransform();const o=s.on("change",h=>{this.latestValues[a]=h,this.props.onUpdate&&ke.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let d;typeof window<"u"&&window.MotionCheckAppearSync&&(d=window.MotionCheckAppearSync(this,a,s)),this.valueSubscriptions.set(a,()=>{o(),d&&d(),s.owner&&s.stop()})}sortNodePosition(a){return!this.current||!this.sortInstanceNodePosition||this.type!==a.type?0:this.sortInstanceNodePosition(this.current,a.current)}updateFeatures(){let a="animation";for(a in Eo){const s=Eo[a];if(!s)continue;const{isEnabled:r,Feature:o}=s;if(!this.features[a]&&o&&r(this.props)&&(this.features[a]=new o(this)),this.features[a]){const d=this.features[a];d.isMounted?d.update():(d.mount(),d.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):nt()}getStaticValue(a){return this.latestValues[a]}setStaticValue(a,s){this.latestValues[a]=s}update(a,s){(a.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=a,this.prevPresenceContext=this.presenceContext,this.presenceContext=s;for(let r=0;r<l0.length;r++){const o=l0[r];this.propEventSubscriptions[o]&&(this.propEventSubscriptions[o](),delete this.propEventSubscriptions[o]);const d="on"+o,h=a[d];h&&(this.propEventSubscriptions[o]=this.on(o,h))}this.prevMotionValues=F5(this,this.scrapeMotionValuesFromProps(a,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(a){return this.props.variants?this.props.variants[a]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(a){const s=this.getClosestVariantNode();if(s)return s.variantChildren&&s.variantChildren.add(a),()=>s.variantChildren.delete(a)}addValue(a,s){const r=this.values.get(a);s!==r&&(r&&this.removeValue(a),this.bindToMotionValue(a,s),this.values.set(a,s),this.latestValues[a]=s.get())}removeValue(a){this.values.delete(a);const s=this.valueSubscriptions.get(a);s&&(s(),this.valueSubscriptions.delete(a)),delete this.latestValues[a],this.removeValueFromRenderState(a,this.renderState)}hasValue(a){return this.values.has(a)}getValue(a,s){if(this.props.values&&this.props.values[a])return this.props.values[a];let r=this.values.get(a);return r===void 0&&s!==void 0&&(r=Qi(s===null?void 0:s,{owner:this}),this.addValue(a,r)),r}readValue(a,s){let r=this.latestValues[a]!==void 0||!this.current?this.latestValues[a]:this.getBaseTargetFromProps(this.props,a)??this.readValueFromInstance(this.current,a,this.options);return r!=null&&(typeof r=="string"&&(ty(r)||ay(r))?r=parseFloat(r):!X5(r)&&sn.test(s)&&(r=Zy(a,s)),this.setBaseTarget(a,ft(r)?r.get():r)),ft(r)?r.get():r}setBaseTarget(a,s){this.baseTarget[a]=s}getBaseTarget(a){var d;const{initial:s}=this.props;let r;if(typeof s=="string"||typeof s=="object"){const h=Qd(this.props,s,(d=this.presenceContext)==null?void 0:d.custom);h&&(r=h[a])}if(s&&r!==void 0)return r;const o=this.getBaseTargetFromProps(this.props,a);return o!==void 0&&!ft(o)?o:this.initialValues[a]!==void 0&&r===void 0?void 0:this.baseTarget[a]}on(a,s){return this.events[a]||(this.events[a]=new _d),this.events[a].add(s)}notify(a,...s){this.events[a]&&this.events[a].notify(...s)}scheduleRenderMicrotask(){Wd.render(this.render)}}class ib extends J5{constructor(){super(...arguments),this.KeyframeResolver=j5}sortInstanceNodePosition(a,s){return a.compareDocumentPosition(s)&2?1:-1}getBaseTargetFromProps(a,s){const r=a.style;return r?r[s]:void 0}removeValueFromRenderState(a,{vars:s,style:r}){delete s[a],delete r[a]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:a}=this.props;ft(a)&&(this.childSubscription=a.on("change",s=>{this.current&&(this.current.textContent=`${s}`)}))}}class Sa{constructor(a){this.isMounted=!1,this.node=a}update(){}}function sb({top:n,left:a,right:s,bottom:r}){return{x:{min:a,max:s},y:{min:n,max:r}}}function W5({x:n,y:a}){return{top:a.min,right:n.max,bottom:a.max,left:n.min}}function I5(n,a){if(!a)return n;const s=a({x:n.left,y:n.top}),r=a({x:n.right,y:n.bottom});return{top:s.y,left:s.x,bottom:r.y,right:r.x}}function Cf(n){return n===void 0||n===1}function xd({scale:n,scaleX:a,scaleY:s}){return!Cf(n)||!Cf(a)||!Cf(s)}function Ya(n){return xd(n)||lb(n)||n.z||n.rotate||n.rotateX||n.rotateY||n.skewX||n.skewY}function lb(n){return r0(n.x)||r0(n.y)}function r0(n){return n&&n!=="0%"}function No(n,a,s){const r=n-s,o=a*r;return s+o}function o0(n,a,s,r,o){return o!==void 0&&(n=No(n,o,r)),No(n,s,r)+a}function yd(n,a=0,s=1,r,o){n.min=o0(n.min,a,s,r,o),n.max=o0(n.max,a,s,r,o)}function rb(n,{x:a,y:s}){yd(n.x,a.translate,a.scale,a.originPoint),yd(n.y,s.translate,s.scale,s.originPoint)}const u0=.999999999999,c0=1.0000000000001;function eN(n,a,s,r=!1){var p;const o=s.length;if(!o)return;a.x=a.y=1;let d,h;for(let m=0;m<o;m++){d=s[m],h=d.projectionDelta;const{visualElement:g}=d.options;g&&g.props.style&&g.props.style.display==="contents"||(r&&d.options.layoutScroll&&d.scroll&&d!==d.root&&(dn(n.x,-d.scroll.offset.x),dn(n.y,-d.scroll.offset.y)),h&&(a.x*=h.x.scale,a.y*=h.y.scale,rb(n,h)),r&&Ya(d.latestValues)&&co(n,d.latestValues,(p=d.layout)==null?void 0:p.layoutBox))}a.x<c0&&a.x>u0&&(a.x=1),a.y<c0&&a.y>u0&&(a.y=1)}function dn(n,a){n.min+=a,n.max+=a}function f0(n,a,s,r,o=.5){const d=He(n.min,n.max,o);yd(n,a,s,d,r)}function d0(n,a){return typeof n=="string"?parseFloat(n)/100*(a.max-a.min):n}function co(n,a,s){const r=s??n;f0(n.x,d0(a.x,r.x),a.scaleX,a.scale,a.originX),f0(n.y,d0(a.y,r.y),a.scaleY,a.scale,a.originY)}function ob(n,a){return sb(I5(n.getBoundingClientRect(),a))}function tN(n,a,s){const r=ob(n,s),{scroll:o}=a;return o&&(dn(r.x,o.offset.x),dn(r.y,o.offset.y)),r}const nN={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},aN=es.length;function iN(n,a,s){let r="",o=!0;for(let d=0;d<aN;d++){const h=es[d],p=n[h];if(p===void 0)continue;let m=!0;if(typeof p=="number")m=p===(h.startsWith("scale")?1:0);else{const g=parseFloat(p);m=h.startsWith("scale")?g===1:g===0}if(!m||s){const g=Py(p,Jd[h]);if(!m){o=!1;const x=nN[h]||h;r+=`${x}(${g}) `}s&&(a[h]=g)}}return r=r.trim(),s?r=s(a,o?"":r):o&&(r="none"),r}function ah(n,a,s){const{style:r,vars:o,transformOrigin:d}=n;let h=!1,p=!1;for(const m in a){const g=a[m];if(ts.has(m)){h=!0;continue}else if(xy(m)){o[m]=g;continue}else{const x=Py(g,Jd[m]);m.startsWith("origin")?(p=!0,d[m]=x):r[m]=x}}if(a.transform||(h||s?r.transform=iN(a,n.transform,s):r.transform&&(r.transform="none")),p){const{originX:m="50%",originY:g="50%",originZ:x=0}=d;r.transformOrigin=`${m} ${g} ${x}`}}function ub(n,{style:a,vars:s},r,o){const d=n.style;let h;for(h in a)d[h]=a[h];o==null||o.applyProjectionStyles(d,r);for(h in s)d.setProperty(h,s[h])}function h0(n,a){return a.max===a.min?0:n/(a.max-a.min)*100}const Js={correct:(n,a)=>{if(!a.target)return n;if(typeof n=="string")if(te.test(n))n=parseFloat(n);else return n;const s=h0(n,a.target.x),r=h0(n,a.target.y);return`${s}% ${r}%`}},sN={correct:(n,{treeScale:a,projectionDelta:s})=>{const r=n,o=sn.parse(n);if(o.length>5)return r;const d=sn.createTransformer(n),h=typeof o[0]!="number"?1:0,p=s.x.scale*a.x,m=s.y.scale*a.y;o[0+h]/=p,o[1+h]/=m;const g=He(p,m,.5);return typeof o[2+h]=="number"&&(o[2+h]/=g),typeof o[3+h]=="number"&&(o[3+h]/=g),d(o)}},bd={borderRadius:{...Js,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Js,borderTopRightRadius:Js,borderBottomLeftRadius:Js,borderBottomRightRadius:Js,boxShadow:sN};function cb(n,{layout:a,layoutId:s}){return ts.has(n)||n.startsWith("origin")||(a||s!==void 0)&&(!!bd[n]||n==="opacity")}function ih(n,a,s){var h;const r=n.style,o=a==null?void 0:a.style,d={};if(!r)return d;for(const p in r)(ft(r[p])||o&&ft(o[p])||cb(p,n)||((h=s==null?void 0:s.getValue(p))==null?void 0:h.liveStyle)!==void 0)&&(d[p]=r[p]);return d}function lN(n){return window.getComputedStyle(n)}class rN extends ib{constructor(){super(...arguments),this.type="html",this.renderInstance=ub}readValueFromInstance(a,s){var r;if(ts.has(s))return(r=this.projection)!=null&&r.isProjecting?ld(s):NE(a,s);{const o=lN(a),d=(xy(s)?o.getPropertyValue(s):o[s])||0;return typeof d=="string"?d.trim():d}}measureInstanceViewportBox(a,{transformPagePoint:s}){return ob(a,s)}build(a,s,r){ah(a,s,r.transformTemplate)}scrapeMotionValuesFromProps(a,s,r){return ih(a,s,r)}}const oN={offset:"stroke-dashoffset",array:"stroke-dasharray"},uN={offset:"strokeDashoffset",array:"strokeDasharray"};function cN(n,a,s=1,r=0,o=!0){n.pathLength=1;const d=o?oN:uN;n[d.offset]=`${-r}`,n[d.array]=`${a} ${s}`}const fN=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function fb(n,{attrX:a,attrY:s,attrScale:r,pathLength:o,pathSpacing:d=1,pathOffset:h=0,...p},m,g,x){if(ah(n,p,g),m){n.style.viewBox&&(n.attrs.viewBox=n.style.viewBox);return}n.attrs=n.style,n.style={};const{attrs:y,style:S}=n;y.transform&&(S.transform=y.transform,delete y.transform),(S.transform||y.transformOrigin)&&(S.transformOrigin=y.transformOrigin??"50% 50%",delete y.transformOrigin),S.transform&&(S.transformBox=(x==null?void 0:x.transformBox)??"fill-box",delete y.transformBox);for(const w of fN)y[w]!==void 0&&(S[w]=y[w],delete y[w]);a!==void 0&&(y.x=a),s!==void 0&&(y.y=s),r!==void 0&&(y.scale=r),o!==void 0&&cN(y,o,d,h,!1)}const db=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),hb=n=>typeof n=="string"&&n.toLowerCase()==="svg";function dN(n,a,s,r){ub(n,a,void 0,r);for(const o in a.attrs)n.setAttribute(db.has(o)?o:Pd(o),a.attrs[o])}function mb(n,a,s){const r=ih(n,a,s);for(const o in n)if(ft(n[o])||ft(a[o])){const d=es.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;r[d]=n[o]}return r}class hN extends ib{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=nt}getBaseTargetFromProps(a,s){return a[s]}readValueFromInstance(a,s){if(ts.has(s)){const r=Fy(s);return r&&r.default||0}return s=db.has(s)?s:Pd(s),a.getAttribute(s)}scrapeMotionValuesFromProps(a,s,r){return mb(a,s,r)}build(a,s,r){fb(a,s,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(a,s,r,o){dN(a,s,r,o)}mount(a){this.isSVGTag=hb(a.tagName),super.mount(a)}}const mN=nh.length;function pb(n){if(!n)return;if(!n.isControllingVariants){const s=n.parent?pb(n.parent)||{}:{};return n.props.initial!==void 0&&(s.initial=n.props.initial),s}const a={};for(let s=0;s<mN;s++){const r=nh[s],o=n.props[r];(yl(o)||o===!1)&&(a[r]=o)}return a}function gb(n,a){if(!Array.isArray(a))return!1;const s=a.length;if(s!==n.length)return!1;for(let r=0;r<s;r++)if(a[r]!==n[r])return!1;return!0}const pN=[...th].reverse(),gN=th.length;function vN(n){return a=>Promise.all(a.map(({animation:s,options:r})=>h5(n,s,r)))}function xN(n){let a=vN(n),s=m0(),r=!0,o=!1;const d=g=>(x,y)=>{var w;const S=Ja(n,y,g==="exit"?(w=n.presenceContext)==null?void 0:w.custom:void 0);if(S){const{transition:j,transitionEnd:E,...C}=S;x={...x,...C,...E}}return x};function h(g){a=g(n)}function p(g){const{props:x}=n,y=pb(n.parent)||{},S=[],w=new Set;let j={},E=1/0;for(let z=0;z<gN;z++){const D=pN[z],R=s[D],k=x[D]!==void 0?x[D]:y[D],U=yl(k),P=D===g?R.isActive:null;P===!1&&(E=z);let F=k===y[D]&&k!==x[D]&&U;if(F&&(r||o)&&n.manuallyAnimateOnMount&&(F=!1),R.protectedKeys={...j},!R.isActive&&P===null||!k&&!R.prevProp||Ho(k)||typeof k=="boolean")continue;if(D==="exit"&&R.isActive&&P!==!0){R.prevResolvedValues&&(j={...j,...R.prevResolvedValues});continue}const W=yN(R.prevProp,k);let re=W||D===g&&R.isActive&&!F&&U||z>E&&U,B=!1;const Z=Array.isArray(k)?k:[k];let ie=Z.reduce(d(D),{});P===!1&&(ie={});const{prevResolvedValues:le={}}=R,Se={...le,...ie},De=J=>{re=!0,w.has(J)&&(B=!0,w.delete(J)),R.needsAnimating[J]=!0;const oe=n.getValue(J);oe&&(oe.liveStyle=!1)};for(const J in Se){const oe=ie[J],me=le[J];if(j.hasOwnProperty(J))continue;let A=!1;dd(oe)&&dd(me)?A=!gb(oe,me):A=oe!==me,A?oe!=null?De(J):w.add(J):oe!==void 0&&w.has(J)?De(J):R.protectedKeys[J]=!0}R.prevProp=k,R.prevResolvedValues=ie,R.isActive&&(j={...j,...ie}),(r||o)&&n.blockInitialAnimation&&(re=!1);const $=F&&W;re&&(!$||B)&&S.push(...Z.map(J=>{const oe={type:D};if(typeof J=="string"&&(r||o)&&!$&&n.manuallyAnimateOnMount&&n.parent){const{parent:me}=n,A=Ja(me,J);if(me.enteringChildren&&A){const{delayChildren:G}=A.transition||{};oe.delay=Uy(me.enteringChildren,n,G)}}return{animation:J,options:oe}}))}if(w.size){const z={};if(typeof x.initial!="boolean"){const D=Ja(n,Array.isArray(x.initial)?x.initial[0]:x.initial);D&&D.transition&&(z.transition=D.transition)}w.forEach(D=>{const R=n.getBaseTarget(D),k=n.getValue(D);k&&(k.liveStyle=!0),z[D]=R??null}),S.push({animation:z})}let C=!!S.length;return r&&(x.initial===!1||x.initial===x.animate)&&!n.manuallyAnimateOnMount&&(C=!1),r=!1,o=!1,C?a(S):Promise.resolve()}function m(g,x){var S;if(s[g].isActive===x)return Promise.resolve();(S=n.variantChildren)==null||S.forEach(w=>{var j;return(j=w.animationState)==null?void 0:j.setActive(g,x)}),s[g].isActive=x;const y=p(g);for(const w in s)s[w].protectedKeys={};return y}return{animateChanges:p,setActive:m,setAnimateFunction:h,getState:()=>s,reset:()=>{s=m0(),o=!0}}}function yN(n,a){return typeof a=="string"?a!==n:Array.isArray(a)?!gb(a,n):!1}function $a(n=!1){return{isActive:n,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function m0(){return{animate:$a(!0),whileInView:$a(),whileHover:$a(),whileTap:$a(),whileDrag:$a(),whileFocus:$a(),exit:$a()}}function Sd(n,a){n.min=a.min,n.max=a.max}function tn(n,a){Sd(n.x,a.x),Sd(n.y,a.y)}function p0(n,a){n.translate=a.translate,n.scale=a.scale,n.originPoint=a.originPoint,n.origin=a.origin}const vb=1e-4,bN=1-vb,SN=1+vb,xb=.01,wN=0-xb,TN=0+xb;function xt(n){return n.max-n.min}function jN(n,a,s){return Math.abs(n-a)<=s}function g0(n,a,s,r=.5){n.origin=r,n.originPoint=He(a.min,a.max,n.origin),n.scale=xt(s)/xt(a),n.translate=He(s.min,s.max,n.origin)-n.originPoint,(n.scale>=bN&&n.scale<=SN||isNaN(n.scale))&&(n.scale=1),(n.translate>=wN&&n.translate<=TN||isNaN(n.translate))&&(n.translate=0)}function hl(n,a,s,r){g0(n.x,a.x,s.x,r?r.originX:void 0),g0(n.y,a.y,s.y,r?r.originY:void 0)}function v0(n,a,s,r=0){const o=r?He(s.min,s.max,r):s.min;n.min=o+a.min,n.max=n.min+xt(a)}function EN(n,a,s,r){v0(n.x,a.x,s.x,r==null?void 0:r.x),v0(n.y,a.y,s.y,r==null?void 0:r.y)}function x0(n,a,s,r=0){const o=r?He(s.min,s.max,r):s.min;n.min=a.min-o,n.max=n.min+xt(a)}function Ao(n,a,s,r){x0(n.x,a.x,s.x,r==null?void 0:r.x),x0(n.y,a.y,s.y,r==null?void 0:r.y)}function y0(n,a,s,r,o){return n-=a,n=No(n,1/s,r),o!==void 0&&(n=No(n,1/o,r)),n}function NN(n,a=0,s=1,r=.5,o,d=n,h=n){if(mn.test(a)&&(a=parseFloat(a),a=He(h.min,h.max,a/100)-h.min),typeof a!="number")return;let p=He(d.min,d.max,r);n===d&&(p-=a),n.min=y0(n.min,a,s,p,o),n.max=y0(n.max,a,s,p,o)}function b0(n,a,[s,r,o],d,h){NN(n,a[s],a[r],a[o],a.scale,d,h)}const AN=["x","scaleX","originX"],CN=["y","scaleY","originY"];function S0(n,a,s,r){b0(n.x,a,AN,s?s.x:void 0,r?r.x:void 0),b0(n.y,a,CN,s?s.y:void 0,r?r.y:void 0)}function w0(n){return n.translate===0&&n.scale===1}function yb(n){return w0(n.x)&&w0(n.y)}function T0(n,a){return n.min===a.min&&n.max===a.max}function MN(n,a){return T0(n.x,a.x)&&T0(n.y,a.y)}function j0(n,a){return Math.round(n.min)===Math.round(a.min)&&Math.round(n.max)===Math.round(a.max)}function bb(n,a){return j0(n.x,a.x)&&j0(n.y,a.y)}function E0(n){return xt(n.x)/xt(n.y)}function N0(n,a){return n.translate===a.translate&&n.scale===a.scale&&n.originPoint===a.originPoint}function fn(n){return[n("x"),n("y")]}function DN(n,a,s){let r="";const o=n.x.translate/a.x,d=n.y.translate/a.y,h=(s==null?void 0:s.z)||0;if((o||d||h)&&(r=`translate3d(${o}px, ${d}px, ${h}px) `),(a.x!==1||a.y!==1)&&(r+=`scale(${1/a.x}, ${1/a.y}) `),s){const{transformPerspective:g,rotate:x,rotateX:y,rotateY:S,skewX:w,skewY:j}=s;g&&(r=`perspective(${g}px) ${r}`),x&&(r+=`rotate(${x}deg) `),y&&(r+=`rotateX(${y}deg) `),S&&(r+=`rotateY(${S}deg) `),w&&(r+=`skewX(${w}deg) `),j&&(r+=`skewY(${j}deg) `)}const p=n.x.scale*a.x,m=n.y.scale*a.y;return(p!==1||m!==1)&&(r+=`scale(${p}, ${m})`),r||"none"}const Sb=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],ON=Sb.length,A0=n=>typeof n=="string"?parseFloat(n):n,C0=n=>typeof n=="number"||te.test(n);function RN(n,a,s,r,o,d){o?(n.opacity=He(0,s.opacity??1,zN(r)),n.opacityExit=He(a.opacity??1,0,kN(r))):d&&(n.opacity=He(a.opacity??1,s.opacity??1,r));for(let h=0;h<ON;h++){const p=Sb[h];let m=M0(a,p),g=M0(s,p);if(m===void 0&&g===void 0)continue;m||(m=0),g||(g=0),m===0||g===0||C0(m)===C0(g)?(n[p]=Math.max(He(A0(m),A0(g),r),0),(mn.test(g)||mn.test(m))&&(n[p]+="%")):n[p]=g}(a.rotate||s.rotate)&&(n.rotate=He(a.rotate||0,s.rotate||0,r))}function M0(n,a){return n[a]!==void 0?n[a]:n.borderRadius}const zN=wb(0,.5,dy),kN=wb(.5,.95,Jt);function wb(n,a,s){return r=>r<n?0:r>a?1:s(vl(n,a,r))}function LN(n,a,s){const r=ft(n)?n:Qi(n);return r.start(Zd("",r,a,s)),r.animation}function bl(n,a,s,r={passive:!0}){return n.addEventListener(a,s,r),()=>n.removeEventListener(a,s)}const VN=(n,a)=>n.depth-a.depth;class _N{constructor(){this.children=[],this.isDirty=!1}add(a){Ld(this.children,a),this.isDirty=!0}remove(a){bo(this.children,a),this.isDirty=!0}forEach(a){this.isDirty&&this.children.sort(VN),this.isDirty=!1,this.children.forEach(a)}}function UN(n,a){const s=vt.now(),r=({timestamp:o})=>{const d=o-s;d>=a&&(xa(r),n(d-a))};return ke.setup(r,!0),()=>xa(r)}function fo(n){return ft(n)?n.get():n}class BN{constructor(){this.members=[]}add(a){Ld(this.members,a);for(let s=this.members.length-1;s>=0;s--){const r=this.members[s];if(r===a||r===this.lead||r===this.prevLead)continue;const o=r.instance;(!o||o.isConnected===!1)&&!r.snapshot&&(bo(this.members,r),r.unmount())}a.scheduleRender()}remove(a){if(bo(this.members,a),a===this.prevLead&&(this.prevLead=void 0),a===this.lead){const s=this.members[this.members.length-1];s&&this.promote(s)}}relegate(a){var s;for(let r=this.members.indexOf(a)-1;r>=0;r--){const o=this.members[r];if(o.isPresent!==!1&&((s=o.instance)==null?void 0:s.isConnected)!==!1)return this.promote(o),!0}return!1}promote(a,s){var o;const r=this.lead;if(a!==r&&(this.prevLead=r,this.lead=a,a.show(),r)){r.updateSnapshot(),a.scheduleRender();const{layoutDependency:d}=r.options,{layoutDependency:h}=a.options;(d===void 0||d!==h)&&(a.resumeFrom=r,s&&(r.preserveOpacity=!0),r.snapshot&&(a.snapshot=r.snapshot,a.snapshot.latestValues=r.animationValues||r.latestValues),(o=a.root)!=null&&o.isUpdating&&(a.isLayoutDirty=!0)),a.options.crossfade===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(a=>{var s,r,o,d,h;(r=(s=a.options).onExitComplete)==null||r.call(s),(h=(o=a.resumingFrom)==null?void 0:(d=o.options).onExitComplete)==null||h.call(d)})}scheduleRender(){this.members.forEach(a=>a.instance&&a.scheduleRender(!1))}removeLeadSnapshot(){var a;(a=this.lead)!=null&&a.snapshot&&(this.lead.snapshot=void 0)}}const ho={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Mf=["","X","Y","Z"],HN=1e3;let $N=0;function Df(n,a,s,r){const{latestValues:o}=a;o[n]&&(s[n]=o[n],a.setStaticValue(n,0),r&&(r[n]=0))}function Tb(n){if(n.hasCheckedOptimisedAppear=!0,n.root===n)return;const{visualElement:a}=n.options;if(!a)return;const s=Yy(a);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:o,layoutId:d}=n.options;window.MotionCancelOptimisedAnimation(s,"transform",ke,!(o||d))}const{parent:r}=n;r&&!r.hasCheckedOptimisedAppear&&Tb(r)}function jb({attachResizeListener:n,defaultParent:a,measureScroll:s,checkIsScrollRoot:r,resetTransform:o}){return class{constructor(h={},p=a==null?void 0:a()){this.id=$N++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(GN),this.nodes.forEach(PN),this.nodes.forEach(JN),this.nodes.forEach(XN)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=h,this.root=p?p.root||p:this,this.path=p?[...p.path,p]:[],this.parent=p,this.depth=p?p.depth+1:0;for(let m=0;m<this.path.length;m++)this.path[m].shouldResetTransform=!0;this.root===this&&(this.nodes=new _N)}addEventListener(h,p){return this.eventHandlers.has(h)||this.eventHandlers.set(h,new _d),this.eventHandlers.get(h).add(p)}notifyListeners(h,...p){const m=this.eventHandlers.get(h);m&&m.notify(...p)}hasListeners(h){return this.eventHandlers.has(h)}mount(h){if(this.instance)return;this.isSVG=eh(h)&&!Y5(h),this.instance=h;const{layoutId:p,layout:m,visualElement:g}=this.options;if(g&&!g.current&&g.mount(h),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(m||p)&&(this.isLayoutDirty=!0),n){let x,y=0;const S=()=>this.root.updateBlockedByResize=!1;ke.read(()=>{y=window.innerWidth}),n(h,()=>{const w=window.innerWidth;w!==y&&(y=w,this.root.updateBlockedByResize=!0,x&&x(),x=UN(S,250),ho.hasAnimatedSinceResize&&(ho.hasAnimatedSinceResize=!1,this.nodes.forEach(R0)))})}p&&this.root.registerSharedNode(p,this),this.options.animate!==!1&&g&&(p||m)&&this.addEventListener("didUpdate",({delta:x,hasLayoutChanged:y,hasRelativeLayoutChanged:S,layout:w})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const j=this.options.transition||g.getDefaultTransition()||nA,{onLayoutAnimationStart:E,onLayoutAnimationComplete:C}=g.getProps(),z=!this.targetLayout||!bb(this.targetLayout,w),D=!y&&S;if(this.options.layoutRoot||this.resumeFrom||D||y&&(z||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const R={...Fd(j,"layout"),onPlay:E,onComplete:C};(g.shouldReduceMotion||this.options.layoutRoot)&&(R.delay=0,R.type=!1),this.startAnimation(R),this.setAnimationOrigin(x,D)}else y||R0(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=w})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const h=this.getStack();h&&h.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),xa(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(WN),this.animationId++)}getTransformTemplate(){const{visualElement:h}=this.options;return h&&h.getProps().transformTemplate}willUpdate(h=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Tb(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let x=0;x<this.path.length;x++){const y=this.path[x];y.shouldResetTransform=!0,(typeof y.latestValues.x=="string"||typeof y.latestValues.y=="string")&&(y.isLayoutDirty=!0),y.updateScroll("snapshot"),y.options.layoutRoot&&y.willUpdate(!1)}const{layoutId:p,layout:m}=this.options;if(p===void 0&&!m)return;const g=this.getTransformTemplate();this.prevTransformTemplateValue=g?g(this.latestValues,""):void 0,this.updateSnapshot(),h&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const m=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),m&&this.nodes.forEach(FN),this.nodes.forEach(D0);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(O0);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(ZN),this.nodes.forEach(QN),this.nodes.forEach(qN),this.nodes.forEach(YN)):this.nodes.forEach(O0),this.clearAllSnapshots();const p=vt.now();ct.delta=pn(0,1e3/60,p-ct.timestamp),ct.timestamp=p,ct.isProcessing=!0,Sf.update.process(ct),Sf.preRender.process(ct),Sf.render.process(ct),ct.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Wd.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(KN),this.sharedNodes.forEach(IN)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,ke.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){ke.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!xt(this.snapshot.measuredBox.x)&&!xt(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let m=0;m<this.path.length;m++)this.path[m].updateScroll();const h=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=nt()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:p}=this.options;p&&p.notify("LayoutMeasure",this.layout.layoutBox,h?h.layoutBox:void 0)}updateScroll(h="measure"){let p=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===h&&(p=!1),p&&this.instance){const m=r(this.instance);this.scroll={animationId:this.root.animationId,phase:h,isRoot:m,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:m}}}resetTransform(){if(!o)return;const h=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,p=this.projectionDelta&&!yb(this.projectionDelta),m=this.getTransformTemplate(),g=m?m(this.latestValues,""):void 0,x=g!==this.prevTransformTemplateValue;h&&this.instance&&(p||Ya(this.latestValues)||x)&&(o(this.instance,g),this.shouldResetTransform=!1,this.scheduleRender())}measure(h=!0){const p=this.measurePageBox();let m=this.removeElementScroll(p);return h&&(m=this.removeTransform(m)),aA(m),{animationId:this.root.animationId,measuredBox:p,layoutBox:m,latestValues:{},source:this.id}}measurePageBox(){var g;const{visualElement:h}=this.options;if(!h)return nt();const p=h.measureViewportBox();if(!(((g=this.scroll)==null?void 0:g.wasRoot)||this.path.some(iA))){const{scroll:x}=this.root;x&&(dn(p.x,x.offset.x),dn(p.y,x.offset.y))}return p}removeElementScroll(h){var m;const p=nt();if(tn(p,h),(m=this.scroll)!=null&&m.wasRoot)return p;for(let g=0;g<this.path.length;g++){const x=this.path[g],{scroll:y,options:S}=x;x!==this.root&&y&&S.layoutScroll&&(y.wasRoot&&tn(p,h),dn(p.x,y.offset.x),dn(p.y,y.offset.y))}return p}applyTransform(h,p=!1,m){var x,y;const g=m||nt();tn(g,h);for(let S=0;S<this.path.length;S++){const w=this.path[S];!p&&w.options.layoutScroll&&w.scroll&&w!==w.root&&(dn(g.x,-w.scroll.offset.x),dn(g.y,-w.scroll.offset.y)),Ya(w.latestValues)&&co(g,w.latestValues,(x=w.layout)==null?void 0:x.layoutBox)}return Ya(this.latestValues)&&co(g,this.latestValues,(y=this.layout)==null?void 0:y.layoutBox),g}removeTransform(h){var m;const p=nt();tn(p,h);for(let g=0;g<this.path.length;g++){const x=this.path[g];if(!Ya(x.latestValues))continue;let y;x.instance&&(xd(x.latestValues)&&x.updateSnapshot(),y=nt(),tn(y,x.measurePageBox())),S0(p,x.latestValues,(m=x.snapshot)==null?void 0:m.layoutBox,y)}return Ya(this.latestValues)&&S0(p,this.latestValues),p}setTargetDelta(h){this.targetDelta=h,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(h){this.options={...this.options,...h,crossfade:h.crossfade!==void 0?h.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==ct.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(h=!1){var w;const p=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=p.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=p.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=p.isSharedProjectionDirty);const m=!!this.resumingFrom||this!==p;if(!(h||m&&this.isSharedProjectionDirty||this.isProjectionDirty||(w=this.parent)!=null&&w.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:x,layoutId:y}=this.options;if(!this.layout||!(x||y))return;this.resolvedRelativeTargetAt=ct.timestamp;const S=this.getClosestProjectingParent();S&&this.linkedParentVersion!==S.layoutVersion&&!S.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&S&&S.layout?this.createRelativeTarget(S,this.layout.layoutBox,S.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=nt(),this.targetWithTransforms=nt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),EN(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):tn(this.target,this.layout.layoutBox),rb(this.target,this.targetDelta)):tn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&S&&!!S.resumingFrom==!!this.resumingFrom&&!S.options.layoutScroll&&S.target&&this.animationProgress!==1?this.createRelativeTarget(S,this.target,S.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||xd(this.parent.latestValues)||lb(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(h,p,m){this.relativeParent=h,this.linkedParentVersion=h.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=nt(),this.relativeTargetOrigin=nt(),Ao(this.relativeTargetOrigin,p,m,this.options.layoutAnchor||void 0),tn(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var j;const h=this.getLead(),p=!!this.resumingFrom||this!==h;let m=!0;if((this.isProjectionDirty||(j=this.parent)!=null&&j.isProjectionDirty)&&(m=!1),p&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(m=!1),this.resolvedRelativeTargetAt===ct.timestamp&&(m=!1),m)return;const{layout:g,layoutId:x}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(g||x))return;tn(this.layoutCorrected,this.layout.layoutBox);const y=this.treeScale.x,S=this.treeScale.y;eN(this.layoutCorrected,this.treeScale,this.path,p),h.layout&&!h.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(h.target=h.layout.layoutBox,h.targetWithTransforms=nt());const{target:w}=h;if(!w){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(p0(this.prevProjectionDelta.x,this.projectionDelta.x),p0(this.prevProjectionDelta.y,this.projectionDelta.y)),hl(this.projectionDelta,this.layoutCorrected,w,this.latestValues),(this.treeScale.x!==y||this.treeScale.y!==S||!N0(this.projectionDelta.x,this.prevProjectionDelta.x)||!N0(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",w))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(h=!0){var p;if((p=this.options.visualElement)==null||p.scheduleRender(),h){const m=this.getStack();m&&m.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Gi(),this.projectionDelta=Gi(),this.projectionDeltaWithTransform=Gi()}setAnimationOrigin(h,p=!1){const m=this.snapshot,g=m?m.latestValues:{},x={...this.latestValues},y=Gi();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!p;const S=nt(),w=m?m.source:void 0,j=this.layout?this.layout.source:void 0,E=w!==j,C=this.getStack(),z=!C||C.members.length<=1,D=!!(E&&!z&&this.options.crossfade===!0&&!this.path.some(tA));this.animationProgress=0;let R;this.mixTargetDelta=k=>{const U=k/1e3;z0(y.x,h.x,U),z0(y.y,h.y,U),this.setTargetDelta(y),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Ao(S,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),eA(this.relativeTarget,this.relativeTargetOrigin,S,U),R&&MN(this.relativeTarget,R)&&(this.isProjectionDirty=!1),R||(R=nt()),tn(R,this.relativeTarget)),E&&(this.animationValues=x,RN(x,g,this.latestValues,U,D,z)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=U},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(h){var p,m,g;this.notifyListeners("animationStart"),(p=this.currentAnimation)==null||p.stop(),(g=(m=this.resumingFrom)==null?void 0:m.currentAnimation)==null||g.stop(),this.pendingAnimation&&(xa(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ke.update(()=>{ho.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Qi(0)),this.motionValue.jump(0,!1),this.currentAnimation=LN(this.motionValue,[0,1e3],{...h,velocity:0,isSync:!0,onUpdate:x=>{this.mixTargetDelta(x),h.onUpdate&&h.onUpdate(x)},onStop:()=>{},onComplete:()=>{h.onComplete&&h.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const h=this.getStack();h&&h.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(HN),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const h=this.getLead();let{targetWithTransforms:p,target:m,layout:g,latestValues:x}=h;if(!(!p||!m||!g)){if(this!==h&&this.layout&&g&&Eb(this.options.animationType,this.layout.layoutBox,g.layoutBox)){m=this.target||nt();const y=xt(this.layout.layoutBox.x);m.x.min=h.target.x.min,m.x.max=m.x.min+y;const S=xt(this.layout.layoutBox.y);m.y.min=h.target.y.min,m.y.max=m.y.min+S}tn(p,m),co(p,x),hl(this.projectionDeltaWithTransform,this.layoutCorrected,p,x)}}registerSharedNode(h,p){this.sharedNodes.has(h)||this.sharedNodes.set(h,new BN),this.sharedNodes.get(h).add(p);const g=p.options.initialPromotionConfig;p.promote({transition:g?g.transition:void 0,preserveFollowOpacity:g&&g.shouldPreserveFollowOpacity?g.shouldPreserveFollowOpacity(p):void 0})}isLead(){const h=this.getStack();return h?h.lead===this:!0}getLead(){var p;const{layoutId:h}=this.options;return h?((p=this.getStack())==null?void 0:p.lead)||this:this}getPrevLead(){var p;const{layoutId:h}=this.options;return h?(p=this.getStack())==null?void 0:p.prevLead:void 0}getStack(){const{layoutId:h}=this.options;if(h)return this.root.sharedNodes.get(h)}promote({needsReset:h,transition:p,preserveFollowOpacity:m}={}){const g=this.getStack();g&&g.promote(this,m),h&&(this.projectionDelta=void 0,this.needsReset=!0),p&&this.setOptions({transition:p})}relegate(){const h=this.getStack();return h?h.relegate(this):!1}resetSkewAndRotation(){const{visualElement:h}=this.options;if(!h)return;let p=!1;const{latestValues:m}=h;if((m.z||m.rotate||m.rotateX||m.rotateY||m.rotateZ||m.skewX||m.skewY)&&(p=!0),!p)return;const g={};m.z&&Df("z",h,g,this.animationValues);for(let x=0;x<Mf.length;x++)Df(`rotate${Mf[x]}`,h,g,this.animationValues),Df(`skew${Mf[x]}`,h,g,this.animationValues);h.render();for(const x in g)h.setStaticValue(x,g[x]),this.animationValues&&(this.animationValues[x]=g[x]);h.scheduleRender()}applyProjectionStyles(h,p){if(!this.instance||this.isSVG)return;if(!this.isVisible){h.visibility="hidden";return}const m=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,h.visibility="",h.opacity="",h.pointerEvents=fo(p==null?void 0:p.pointerEvents)||"",h.transform=m?m(this.latestValues,""):"none";return}const g=this.getLead();if(!this.projectionDelta||!this.layout||!g.target){this.options.layoutId&&(h.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,h.pointerEvents=fo(p==null?void 0:p.pointerEvents)||""),this.hasProjected&&!Ya(this.latestValues)&&(h.transform=m?m({},""):"none",this.hasProjected=!1);return}h.visibility="";const x=g.animationValues||g.latestValues;this.applyTransformsToTarget();let y=DN(this.projectionDeltaWithTransform,this.treeScale,x);m&&(y=m(x,y)),h.transform=y;const{x:S,y:w}=this.projectionDelta;h.transformOrigin=`${S.origin*100}% ${w.origin*100}% 0`,g.animationValues?h.opacity=g===this?x.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:x.opacityExit:h.opacity=g===this?x.opacity!==void 0?x.opacity:"":x.opacityExit!==void 0?x.opacityExit:0;for(const j in bd){if(x[j]===void 0)continue;const{correct:E,applyTo:C,isCSSVariable:z}=bd[j],D=y==="none"?x[j]:E(x[j],g);if(C){const R=C.length;for(let k=0;k<R;k++)h[C[k]]=D}else z?this.options.visualElement.renderState.vars[j]=D:h[j]=D}this.options.layoutId&&(h.pointerEvents=g===this?fo(p==null?void 0:p.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(h=>{var p;return(p=h.currentAnimation)==null?void 0:p.stop()}),this.root.nodes.forEach(D0),this.root.sharedNodes.clear()}}}function qN(n){n.updateLayout()}function YN(n){var s;const a=((s=n.resumeFrom)==null?void 0:s.snapshot)||n.snapshot;if(n.isLead()&&n.layout&&a&&n.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:o}=n.layout,{animationType:d}=n.options,h=a.source!==n.layout.source;if(d==="size")fn(y=>{const S=h?a.measuredBox[y]:a.layoutBox[y],w=xt(S);S.min=r[y].min,S.max=S.min+w});else if(d==="x"||d==="y"){const y=d==="x"?"y":"x";Sd(h?a.measuredBox[y]:a.layoutBox[y],r[y])}else Eb(d,a.layoutBox,r)&&fn(y=>{const S=h?a.measuredBox[y]:a.layoutBox[y],w=xt(r[y]);S.max=S.min+w,n.relativeTarget&&!n.currentAnimation&&(n.isProjectionDirty=!0,n.relativeTarget[y].max=n.relativeTarget[y].min+w)});const p=Gi();hl(p,r,a.layoutBox);const m=Gi();h?hl(m,n.applyTransform(o,!0),a.measuredBox):hl(m,r,a.layoutBox);const g=!yb(p);let x=!1;if(!n.resumeFrom){const y=n.getClosestProjectingParent();if(y&&!y.resumeFrom){const{snapshot:S,layout:w}=y;if(S&&w){const j=n.options.layoutAnchor||void 0,E=nt();Ao(E,a.layoutBox,S.layoutBox,j);const C=nt();Ao(C,r,w.layoutBox,j),bb(E,C)||(x=!0),y.options.layoutRoot&&(n.relativeTarget=C,n.relativeTargetOrigin=E,n.relativeParent=y)}}}n.notifyListeners("didUpdate",{layout:r,snapshot:a,delta:m,layoutDelta:p,hasLayoutChanged:g,hasRelativeLayoutChanged:x})}else if(n.isLead()){const{onExitComplete:r}=n.options;r&&r()}n.options.transition=void 0}function GN(n){n.parent&&(n.isProjecting()||(n.isProjectionDirty=n.parent.isProjectionDirty),n.isSharedProjectionDirty||(n.isSharedProjectionDirty=!!(n.isProjectionDirty||n.parent.isProjectionDirty||n.parent.isSharedProjectionDirty)),n.isTransformDirty||(n.isTransformDirty=n.parent.isTransformDirty))}function XN(n){n.isProjectionDirty=n.isSharedProjectionDirty=n.isTransformDirty=!1}function KN(n){n.clearSnapshot()}function D0(n){n.clearMeasurements()}function FN(n){n.isLayoutDirty=!0,n.updateLayout()}function O0(n){n.isLayoutDirty=!1}function ZN(n){n.isAnimationBlocked&&n.layout&&!n.isLayoutDirty&&(n.snapshot=n.layout,n.isLayoutDirty=!0)}function QN(n){const{visualElement:a}=n.options;a&&a.getProps().onBeforeLayoutMeasure&&a.notify("BeforeLayoutMeasure"),n.resetTransform()}function R0(n){n.finishAnimation(),n.targetDelta=n.relativeTarget=n.target=void 0,n.isProjectionDirty=!0}function PN(n){n.resolveTargetDelta()}function JN(n){n.calcProjection()}function WN(n){n.resetSkewAndRotation()}function IN(n){n.removeLeadSnapshot()}function z0(n,a,s){n.translate=He(a.translate,0,s),n.scale=He(a.scale,1,s),n.origin=a.origin,n.originPoint=a.originPoint}function k0(n,a,s,r){n.min=He(a.min,s.min,r),n.max=He(a.max,s.max,r)}function eA(n,a,s,r){k0(n.x,a.x,s.x,r),k0(n.y,a.y,s.y,r)}function tA(n){return n.animationValues&&n.animationValues.opacityExit!==void 0}const nA={duration:.45,ease:[.4,0,.1,1]},L0=n=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(n),V0=L0("applewebkit/")&&!L0("chrome/")?Math.round:Jt;function _0(n){n.min=V0(n.min),n.max=V0(n.max)}function aA(n){_0(n.x),_0(n.y)}function Eb(n,a,s){return n==="position"||n==="preserve-aspect"&&!jN(E0(a),E0(s),.2)}function iA(n){var a;return n!==n.root&&((a=n.scroll)==null?void 0:a.wasRoot)}const sA=jb({attachResizeListener:(n,a)=>bl(n,"resize",a),measureScroll:()=>{var n,a;return{x:document.documentElement.scrollLeft||((n=document.body)==null?void 0:n.scrollLeft)||0,y:document.documentElement.scrollTop||((a=document.body)==null?void 0:a.scrollTop)||0}},checkIsScrollRoot:()=>!0}),lA=n=>!n.isLayoutDirty&&n.willUpdate(!1);function U0(){const n=new Set,a=new WeakMap,s=()=>n.forEach(lA);return{add:r=>{n.add(r),a.set(r,r.addEventListener("willUpdate",s))},remove:r=>{n.delete(r);const o=a.get(r);o&&(o(),a.delete(r)),s()},dirty:s}}const Of={current:void 0},Nb=jb({measureScroll:n=>({x:n.scrollLeft,y:n.scrollTop}),defaultParent:()=>{if(!Of.current){const n=new sA({});n.mount(window),n.setOptions({layoutScroll:!0}),Of.current=n}return Of.current},resetTransform:(n,a)=>{n.style.transform=a!==void 0?a:"none"},checkIsScrollRoot:n=>window.getComputedStyle(n).position==="fixed"}),Ab=T.createContext({transformPagePoint:n=>n,isStatic:!1,reducedMotion:"never"});function rA(n=!0){const a=T.useContext(kd);if(a===null)return[!0,null];const{isPresent:s,onExitComplete:r,register:o}=a,d=T.useId();T.useEffect(()=>{if(n)return o(d)},[n]);const h=T.useCallback(()=>n&&r&&r(d),[d,r,n]);return!s&&r?[!1,h]:[!0]}const oA=T.createContext(null);function uA(){const n=T.useRef(!1);return ey(()=>(n.current=!0,()=>{n.current=!1}),[]),n}function cA(){const n=uA(),[a,s]=T.useState(0),r=T.useCallback(()=>{n.current&&s(a+1)},[a]);return[T.useCallback(()=>ke.postRender(r),[r]),a]}const Cb=n=>n===!0,fA=n=>Cb(n===!0)||n==="id",Mb=({children:n,id:a,inherit:s=!0})=>{const r=T.useContext(yo),o=T.useContext(oA),[d,h]=cA(),p=T.useRef(null),m=r.id||o;p.current===null&&(fA(s)&&m&&(a=a?m+"-"+a:m),p.current={id:a,group:Cb(s)&&r.group||U0()});const g=T.useMemo(()=>({...p.current,forceRender:d}),[h]);return f.jsx(yo.Provider,{value:g,children:n})},Db=T.createContext({strict:!1}),B0={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let H0=!1;function dA(){if(H0)return;const n={};for(const a in B0)n[a]={isEnabled:s=>B0[a].some(r=>!!s[r])};ab(n),H0=!0}function Ob(){return dA(),P5()}function hA(n){const a=Ob();for(const s in n)a[s]={...a[s],...n[s]};ab(a)}const mA=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Co(n){return n.startsWith("while")||n.startsWith("drag")&&n!=="draggable"||n.startsWith("layout")||n.startsWith("onTap")||n.startsWith("onPan")||n.startsWith("onLayout")||mA.has(n)}let Rb=n=>!Co(n);function pA(n){typeof n=="function"&&(Rb=a=>a.startsWith("on")?!Co(a):n(a))}try{pA(require("@emotion/is-prop-valid").default)}catch{}function gA(n,a,s){const r={};for(const o in n)o==="values"&&typeof n.values=="object"||ft(n[o])||(Rb(o)||s===!0&&Co(o)||!a&&!Co(o)||n.draggable&&o.startsWith("onDrag"))&&(r[o]=n[o]);return r}const qo=T.createContext({});function vA(n,a){if($o(n)){const{initial:s,animate:r}=n;return{initial:s===!1||yl(s)?s:void 0,animate:yl(r)?r:void 0}}return n.inherit!==!1?a:{}}function xA(n){const{initial:a,animate:s}=vA(n,T.useContext(qo));return T.useMemo(()=>({initial:a,animate:s}),[$0(a),$0(s)])}function $0(n){return Array.isArray(n)?n.join(" "):n}const sh=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function zb(n,a,s){for(const r in a)!ft(a[r])&&!cb(r,s)&&(n[r]=a[r])}function yA({transformTemplate:n},a){return T.useMemo(()=>{const s=sh();return ah(s,a,n),Object.assign({},s.vars,s.style)},[a])}function bA(n,a){const s=n.style||{},r={};return zb(r,s,n),Object.assign(r,yA(n,a)),r}function SA(n,a){const s={},r=bA(n,a);return n.drag&&n.dragListener!==!1&&(s.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=n.drag===!0?"none":`pan-${n.drag==="x"?"y":"x"}`),n.tabIndex===void 0&&(n.onTap||n.onTapStart||n.whileTap)&&(s.tabIndex=0),s.style=r,s}const kb=()=>({...sh(),attrs:{}});function wA(n,a,s,r){const o=T.useMemo(()=>{const d=kb();return fb(d,a,hb(r),n.transformTemplate,n.style),{...d.attrs,style:{...d.style}}},[a]);if(n.style){const d={};zb(d,n.style,n),o.style={...d,...o.style}}return o}const TA=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function lh(n){return typeof n!="string"||n.includes("-")?!1:!!(TA.indexOf(n)>-1||/[A-Z]/u.test(n))}function jA(n,a,s,{latestValues:r},o,d=!1,h){const m=(h??lh(n)?wA:SA)(a,r,o,n),g=gA(a,typeof n=="string",d),x=n!==T.Fragment?{...g,...m,ref:s}:{},{children:y}=a,S=T.useMemo(()=>ft(y)?y.get():y,[y]);return T.createElement(n,{...x,children:S})}function EA({scrapeMotionValuesFromProps:n,createRenderState:a},s,r,o){return{latestValues:NA(s,r,o,n),renderState:a()}}function NA(n,a,s,r){const o={},d=r(n,{});for(const S in d)o[S]=fo(d[S]);let{initial:h,animate:p}=n;const m=$o(n),g=tb(n);a&&g&&!m&&n.inherit!==!1&&(h===void 0&&(h=a.initial),p===void 0&&(p=a.animate));let x=s?s.initial===!1:!1;x=x||h===!1;const y=x?p:h;if(y&&typeof y!="boolean"&&!Ho(y)){const S=Array.isArray(y)?y:[y];for(let w=0;w<S.length;w++){const j=Qd(n,S[w]);if(j){const{transitionEnd:E,transition:C,...z}=j;for(const D in z){let R=z[D];if(Array.isArray(R)){const k=x?R.length-1:0;R=R[k]}R!==null&&(o[D]=R)}for(const D in E)o[D]=E[D]}}}return o}const Lb=n=>(a,s)=>{const r=T.useContext(qo),o=T.useContext(kd),d=()=>EA(n,a,r,o);return s?d():yj(d)},AA=Lb({scrapeMotionValuesFromProps:ih,createRenderState:sh}),CA=Lb({scrapeMotionValuesFromProps:mb,createRenderState:kb}),MA=Symbol.for("motionComponentSymbol");function DA(n,a,s){const r=T.useRef(s);T.useInsertionEffect(()=>{r.current=s});const o=T.useRef(null);return T.useCallback(d=>{var p;d&&((p=n.onMount)==null||p.call(n,d));const h=r.current;if(typeof h=="function")if(d){const m=h(d);typeof m=="function"&&(o.current=m)}else o.current?(o.current(),o.current=null):h(d);else h&&(h.current=d);a&&(d?a.mount(d):a.unmount())},[a])}const Vb=T.createContext({});function $i(n){return n&&typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"current")}function OA(n,a,s,r,o,d){var R,k;const{visualElement:h}=T.useContext(qo),p=T.useContext(Db),m=T.useContext(kd),g=T.useContext(Ab),x=g.reducedMotion,y=g.skipAnimations,S=T.useRef(null),w=T.useRef(!1);r=r||p.renderer,!S.current&&r&&(S.current=r(n,{visualState:a,parent:h,props:s,presenceContext:m,blockInitialAnimation:m?m.initial===!1:!1,reducedMotionConfig:x,skipAnimations:y,isSVG:d}),w.current&&S.current&&(S.current.manuallyAnimateOnMount=!0));const j=S.current,E=T.useContext(Vb);j&&!j.projection&&o&&(j.type==="html"||j.type==="svg")&&RA(S.current,s,o,E);const C=T.useRef(!1);T.useInsertionEffect(()=>{j&&C.current&&j.update(s,m)});const z=s[qy],D=T.useRef(!!z&&typeof window<"u"&&!((R=window.MotionHandoffIsComplete)!=null&&R.call(window,z))&&((k=window.MotionHasOptimisedAnimation)==null?void 0:k.call(window,z)));return ey(()=>{w.current=!0,j&&(C.current=!0,window.MotionIsMounted=!0,j.updateFeatures(),j.scheduleRenderMicrotask(),D.current&&j.animationState&&j.animationState.animateChanges())}),T.useEffect(()=>{j&&(!D.current&&j.animationState&&j.animationState.animateChanges(),D.current&&(queueMicrotask(()=>{var U;(U=window.MotionHandoffMarkAsComplete)==null||U.call(window,z)}),D.current=!1),j.enteringChildren=void 0)}),j}function RA(n,a,s,r){const{layoutId:o,layout:d,drag:h,dragConstraints:p,layoutScroll:m,layoutRoot:g,layoutAnchor:x,layoutCrossfade:y}=a;n.projection=new s(n.latestValues,a["data-framer-portal-id"]?void 0:_b(n.parent)),n.projection.setOptions({layoutId:o,layout:d,alwaysMeasureLayout:!!h||p&&$i(p),visualElement:n,animationType:typeof d=="string"?d:"both",initialPromotionConfig:r,crossfade:y,layoutScroll:m,layoutRoot:g,layoutAnchor:x})}function _b(n){if(n)return n.options.allowProjection!==!1?n.projection:_b(n.parent)}function Rf(n,{forwardMotionProps:a=!1,type:s}={},r,o){r&&hA(r);const d=s?s==="svg":lh(n),h=d?CA:AA;function p(g,x){let y;const S={...T.useContext(Ab),...g,layoutId:zA(g)},{isStatic:w}=S,j=xA(g),E=h(g,w);if(!w&&typeof window<"u"){kA();const C=LA(S);y=C.MeasureLayout,j.visualElement=OA(n,E,S,o,C.ProjectionNode,d)}return f.jsxs(qo.Provider,{value:j,children:[y&&j.visualElement?f.jsx(y,{visualElement:j.visualElement,...S}):null,jA(n,g,DA(E,j.visualElement,x),E,w,a,d)]})}p.displayName=`motion.${typeof n=="string"?n:`create(${n.displayName??n.name??""})`}`;const m=T.forwardRef(p);return m[MA]=n,m}function zA({layoutId:n}){const a=T.useContext(yo).id;return a&&n!==void 0?a+"-"+n:n}function kA(n,a){T.useContext(Db).strict}function LA(n){const a=Ob(),{drag:s,layout:r}=a;if(!s&&!r)return{};const o={...s,...r};return{MeasureLayout:s!=null&&s.isEnabled(n)||r!=null&&r.isEnabled(n)?o.MeasureLayout:void 0,ProjectionNode:o.ProjectionNode}}function VA(n,a){if(typeof Proxy>"u")return Rf;const s=new Map,r=(d,h)=>Rf(d,h,n,a),o=(d,h)=>r(d,h);return new Proxy(o,{get:(d,h)=>h==="create"?r:(s.has(h)||s.set(h,Rf(h,void 0,n,a)),s.get(h))})}const _A=(n,a)=>a.isSVG??lh(n)?new hN(a):new rN(a,{allowProjection:n!==T.Fragment});class UA extends Sa{constructor(a){super(a),a.animationState||(a.animationState=xN(a))}updateAnimationControlsSubscription(){const{animate:a}=this.node.getProps();Ho(a)&&(this.unmountControls=a.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:a}=this.node.getProps(),{animate:s}=this.node.prevProps||{};a!==s&&this.updateAnimationControlsSubscription()}unmount(){var a;this.node.animationState.reset(),(a=this.unmountControls)==null||a.call(this)}}let BA=0;class HA extends Sa{constructor(){super(...arguments),this.id=BA++,this.isExitComplete=!1}update(){var d;if(!this.node.presenceContext)return;const{isPresent:a,onExitComplete:s}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||a===r)return;if(a&&r===!1){if(this.isExitComplete){const{initial:h,custom:p}=this.node.getProps();if(typeof h=="string"){const m=Ja(this.node,h,p);if(m){const{transition:g,transitionEnd:x,...y}=m;for(const S in y)(d=this.node.getValue(S))==null||d.jump(y[S])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const o=this.node.animationState.setActive("exit",!a);s&&!a&&o.then(()=>{this.isExitComplete=!0,s(this.id)})}mount(){const{register:a,onExitComplete:s}=this.node.presenceContext||{};s&&s(this.id),a&&(this.unmount=a(this.id))}unmount(){}}const $A={animation:{Feature:UA},exit:{Feature:HA}};function Cl(n){return{point:{x:n.pageX,y:n.pageY}}}const qA=n=>a=>Id(a)&&n(a,Cl(a));function ml(n,a,s,r){return bl(n,a,qA(s),r)}const Ub=({current:n})=>n?n.ownerDocument.defaultView:null,q0=(n,a)=>Math.abs(n-a);function YA(n,a){const s=q0(n.x,a.x),r=q0(n.y,a.y);return Math.sqrt(s**2+r**2)}const Y0=new Set(["auto","scroll"]);class Bb{constructor(a,s,{transformPagePoint:r,contextWindow:o=window,dragSnapToOrigin:d=!1,distanceThreshold:h=3,element:p}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=w=>{this.handleScroll(w.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=eo(this.lastRawMoveEventInfo,this.transformPagePoint));const w=zf(this.lastMoveEventInfo,this.history),j=this.startEvent!==null,E=YA(w.offset,{x:0,y:0})>=this.distanceThreshold;if(!j&&!E)return;const{point:C}=w,{timestamp:z}=ct;this.history.push({...C,timestamp:z});const{onStart:D,onMove:R}=this.handlers;j||(D&&D(this.lastMoveEvent,w),this.startEvent=this.lastMoveEvent),R&&R(this.lastMoveEvent,w)},this.handlePointerMove=(w,j)=>{this.lastMoveEvent=w,this.lastRawMoveEventInfo=j,this.lastMoveEventInfo=eo(j,this.transformPagePoint),ke.update(this.updatePoint,!0)},this.handlePointerUp=(w,j)=>{this.end();const{onEnd:E,onSessionEnd:C,resumeAnimation:z}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&z&&z(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const D=zf(w.type==="pointercancel"?this.lastMoveEventInfo:eo(j,this.transformPagePoint),this.history);this.startEvent&&E&&E(w,D),C&&C(w,D)},!Id(a))return;this.dragSnapToOrigin=d,this.handlers=s,this.transformPagePoint=r,this.distanceThreshold=h,this.contextWindow=o||window;const m=Cl(a),g=eo(m,this.transformPagePoint),{point:x}=g,{timestamp:y}=ct;this.history=[{...x,timestamp:y}];const{onSessionStart:S}=s;S&&S(a,zf(g,this.history)),this.removeListeners=El(ml(this.contextWindow,"pointermove",this.handlePointerMove),ml(this.contextWindow,"pointerup",this.handlePointerUp),ml(this.contextWindow,"pointercancel",this.handlePointerUp)),p&&this.startScrollTracking(p)}startScrollTracking(a){let s=a.parentElement;for(;s;){const r=getComputedStyle(s);(Y0.has(r.overflowX)||Y0.has(r.overflowY))&&this.scrollPositions.set(s,{x:s.scrollLeft,y:s.scrollTop}),s=s.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(a){const s=this.scrollPositions.get(a);if(!s)return;const r=a===window,o=r?{x:window.scrollX,y:window.scrollY}:{x:a.scrollLeft,y:a.scrollTop},d={x:o.x-s.x,y:o.y-s.y};d.x===0&&d.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=d.x,this.lastMoveEventInfo.point.y+=d.y):this.history.length>0&&(this.history[0].x-=d.x,this.history[0].y-=d.y),this.scrollPositions.set(a,o),ke.update(this.updatePoint,!0))}updateHandlers(a){this.handlers=a}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),xa(this.updatePoint)}}function eo(n,a){return a?{point:a(n.point)}:n}function G0(n,a){return{x:n.x-a.x,y:n.y-a.y}}function zf({point:n},a){return{point:n,delta:G0(n,Hb(a)),offset:G0(n,GA(a)),velocity:XA(a,.1)}}function GA(n){return n[0]}function Hb(n){return n[n.length-1]}function XA(n,a){if(n.length<2)return{x:0,y:0};let s=n.length-1,r=null;const o=Hb(n);for(;s>=0&&(r=n[s],!(o.timestamp-r.timestamp>Ut(a)));)s--;if(!r)return{x:0,y:0};r===n[0]&&n.length>2&&o.timestamp-r.timestamp>Ut(a)*2&&(r=n[1]);const d=Pt(o.timestamp-r.timestamp);if(d===0)return{x:0,y:0};const h={x:(o.x-r.x)/d,y:(o.y-r.y)/d};return h.x===1/0&&(h.x=0),h.y===1/0&&(h.y=0),h}function KA(n,{min:a,max:s},r){return a!==void 0&&n<a?n=r?He(a,n,r.min):Math.max(n,a):s!==void 0&&n>s&&(n=r?He(s,n,r.max):Math.min(n,s)),n}function X0(n,a,s){return{min:a!==void 0?n.min+a:void 0,max:s!==void 0?n.max+s-(n.max-n.min):void 0}}function FA(n,{top:a,left:s,bottom:r,right:o}){return{x:X0(n.x,s,o),y:X0(n.y,a,r)}}function K0(n,a){let s=a.min-n.min,r=a.max-n.max;return a.max-a.min<n.max-n.min&&([s,r]=[r,s]),{min:s,max:r}}function ZA(n,a){return{x:K0(n.x,a.x),y:K0(n.y,a.y)}}function QA(n,a){let s=.5;const r=xt(n),o=xt(a);return o>r?s=vl(a.min,a.max-r,n.min):r>o&&(s=vl(n.min,n.max-o,a.min)),pn(0,1,s)}function PA(n,a){const s={};return a.min!==void 0&&(s.min=a.min-n.min),a.max!==void 0&&(s.max=a.max-n.min),s}const wd=.35;function JA(n=wd){return n===!1?n=0:n===!0&&(n=wd),{x:F0(n,"left","right"),y:F0(n,"top","bottom")}}function F0(n,a,s){return{min:Z0(n,a),max:Z0(n,s)}}function Z0(n,a){return typeof n=="number"?n:n[a]||0}const WA=new WeakMap;class IA{constructor(a){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=nt(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=a}start(a,{snapToCursor:s=!1,distanceThreshold:r}={}){const{presenceContext:o}=this.visualElement;if(o&&o.isPresent===!1)return;const d=y=>{s&&this.snapToCursor(Cl(y).point),this.stopAnimation()},h=(y,S)=>{const{drag:w,dragPropagation:j,onDragStart:E}=this.getProps();if(w&&!j&&(this.openDragLock&&this.openDragLock(),this.openDragLock=N5(w),!this.openDragLock))return;this.latestPointerEvent=y,this.latestPanInfo=S,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),fn(z=>{let D=this.getAxisMotionValue(z).get()||0;if(mn.test(D)){const{projection:R}=this.visualElement;if(R&&R.layout){const k=R.layout.layoutBox[z];k&&(D=xt(k)*(parseFloat(D)/100))}}this.originPoint[z]=D}),E&&ke.update(()=>E(y,S),!1,!0),hd(this.visualElement,"transform");const{animationState:C}=this.visualElement;C&&C.setActive("whileDrag",!0)},p=(y,S)=>{this.latestPointerEvent=y,this.latestPanInfo=S;const{dragPropagation:w,dragDirectionLock:j,onDirectionLock:E,onDrag:C}=this.getProps();if(!w&&!this.openDragLock)return;const{offset:z}=S;if(j&&this.currentDirection===null){this.currentDirection=t3(z),this.currentDirection!==null&&E&&E(this.currentDirection);return}this.updateAxis("x",S.point,z),this.updateAxis("y",S.point,z),this.visualElement.render(),C&&ke.update(()=>C(y,S),!1,!0)},m=(y,S)=>{this.latestPointerEvent=y,this.latestPanInfo=S,this.stop(y,S),this.latestPointerEvent=null,this.latestPanInfo=null},g=()=>{const{dragSnapToOrigin:y}=this.getProps();(y||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:x}=this.getProps();this.panSession=new Bb(a,{onSessionStart:d,onStart:h,onMove:p,onSessionEnd:m,resumeAnimation:g},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:x,distanceThreshold:r,contextWindow:Ub(this.visualElement),element:this.visualElement.current})}stop(a,s){const r=a||this.latestPointerEvent,o=s||this.latestPanInfo,d=this.isDragging;if(this.cancel(),!d||!o||!r)return;const{velocity:h}=o;this.startAnimation(h);const{onDragEnd:p}=this.getProps();p&&ke.postRender(()=>p(r,o))}cancel(){this.isDragging=!1;const{projection:a,animationState:s}=this.visualElement;a&&(a.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),s&&s.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(a,s,r){const{drag:o}=this.getProps();if(!r||!to(a,o,this.currentDirection))return;const d=this.getAxisMotionValue(a);let h=this.originPoint[a]+r[a];this.constraints&&this.constraints[a]&&(h=KA(h,this.constraints[a],this.elastic[a])),d.set(h)}resolveConstraints(){var d;const{dragConstraints:a,dragElastic:s}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(d=this.visualElement.projection)==null?void 0:d.layout,o=this.constraints;a&&$i(a)?this.constraints||(this.constraints=this.resolveRefConstraints()):a&&r?this.constraints=FA(r.layoutBox,a):this.constraints=!1,this.elastic=JA(s),o!==this.constraints&&!$i(a)&&r&&this.constraints&&!this.hasMutatedConstraints&&fn(h=>{this.constraints!==!1&&this.getAxisMotionValue(h)&&(this.constraints[h]=PA(r.layoutBox[h],this.constraints[h]))})}resolveRefConstraints(){const{dragConstraints:a,onMeasureDragConstraints:s}=this.getProps();if(!a||!$i(a))return!1;const r=a.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const d=tN(r,o.root,this.visualElement.getTransformPagePoint());let h=ZA(o.layout.layoutBox,d);if(s){const p=s(W5(h));this.hasMutatedConstraints=!!p,p&&(h=sb(p))}return h}startAnimation(a){const{drag:s,dragMomentum:r,dragElastic:o,dragTransition:d,dragSnapToOrigin:h,onDragTransitionEnd:p}=this.getProps(),m=this.constraints||{},g=fn(x=>{if(!to(x,s,this.currentDirection))return;let y=m&&m[x]||{};(h===!0||h===x)&&(y={min:0,max:0});const S=o?200:1e6,w=o?40:1e7,j={type:"inertia",velocity:r?a[x]:0,bounceStiffness:S,bounceDamping:w,timeConstant:750,restDelta:1,restSpeed:10,...d,...y};return this.startAxisValueAnimation(x,j)});return Promise.all(g).then(p)}startAxisValueAnimation(a,s){const r=this.getAxisMotionValue(a);return hd(this.visualElement,a),r.start(Zd(a,r,0,s,this.visualElement,!1))}stopAnimation(){fn(a=>this.getAxisMotionValue(a).stop())}getAxisMotionValue(a){const s=`_drag${a.toUpperCase()}`,r=this.visualElement.getProps(),o=r[s];return o||this.visualElement.getValue(a,(r.initial?r.initial[a]:void 0)||0)}snapToCursor(a){fn(s=>{const{drag:r}=this.getProps();if(!to(s,r,this.currentDirection))return;const{projection:o}=this.visualElement,d=this.getAxisMotionValue(s);if(o&&o.layout){const{min:h,max:p}=o.layout.layoutBox[s],m=d.get()||0;d.set(a[s]-He(h,p,.5)+m)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:a,dragConstraints:s}=this.getProps(),{projection:r}=this.visualElement;if(!$i(s)||!r||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};fn(h=>{const p=this.getAxisMotionValue(h);if(p&&this.constraints!==!1){const m=p.get();o[h]=QA({min:m,max:m},this.constraints[h])}});const{transformTemplate:d}=this.visualElement.getProps();this.visualElement.current.style.transform=d?d({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),fn(h=>{if(!to(h,a,null))return;const p=this.getAxisMotionValue(h),{min:m,max:g}=this.constraints[h];p.set(He(m,g,o[h]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;WA.set(this.visualElement,this);const a=this.visualElement.current,s=ml(a,"pointerdown",g=>{const{drag:x,dragListener:y=!0}=this.getProps(),S=g.target,w=S!==a&&R5(S);x&&y&&!w&&this.start(g)});let r;const o=()=>{const{dragConstraints:g}=this.getProps();$i(g)&&g.current&&(this.constraints=this.resolveRefConstraints(),r||(r=e3(a,g.current,()=>this.scalePositionWithinConstraints())))},{projection:d}=this.visualElement,h=d.addEventListener("measure",o);d&&!d.layout&&(d.root&&d.root.updateScroll(),d.updateLayout()),ke.read(o);const p=bl(window,"resize",()=>this.scalePositionWithinConstraints()),m=d.addEventListener("didUpdate",(({delta:g,hasLayoutChanged:x})=>{this.isDragging&&x&&(fn(y=>{const S=this.getAxisMotionValue(y);S&&(this.originPoint[y]+=g[y].translate,S.set(S.get()+g[y].translate))}),this.visualElement.render())}));return()=>{p(),s(),h(),m&&m(),r&&r()}}getProps(){const a=this.visualElement.getProps(),{drag:s=!1,dragDirectionLock:r=!1,dragPropagation:o=!1,dragConstraints:d=!1,dragElastic:h=wd,dragMomentum:p=!0}=a;return{...a,drag:s,dragDirectionLock:r,dragPropagation:o,dragConstraints:d,dragElastic:h,dragMomentum:p}}}function Q0(n){let a=!0;return()=>{if(a){a=!1;return}n()}}function e3(n,a,s){const r=a0(n,Q0(s)),o=a0(a,Q0(s));return()=>{r(),o()}}function to(n,a,s){return(a===!0||a===n)&&(s===null||s===n)}function t3(n,a=10){let s=null;return Math.abs(n.y)>a?s="y":Math.abs(n.x)>a&&(s="x"),s}class n3 extends Sa{constructor(a){super(a),this.removeGroupControls=Jt,this.removeListeners=Jt,this.controls=new IA(a)}mount(){const{dragControls:a}=this.node.getProps();a&&(this.removeGroupControls=a.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Jt}update(){const{dragControls:a}=this.node.getProps(),{dragControls:s}=this.node.prevProps||{};a!==s&&(this.removeGroupControls(),a&&(this.removeGroupControls=a.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const kf=n=>(a,s)=>{n&&ke.update(()=>n(a,s),!1,!0)};class a3 extends Sa{constructor(){super(...arguments),this.removePointerDownListener=Jt}onPointerDown(a){this.session=new Bb(a,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Ub(this.node)})}createPanHandlers(){const{onPanSessionStart:a,onPanStart:s,onPan:r,onPanEnd:o}=this.node.getProps();return{onSessionStart:kf(a),onStart:kf(s),onMove:kf(r),onEnd:(d,h)=>{delete this.session,o&&ke.postRender(()=>o(d,h))}}}mount(){this.removePointerDownListener=ml(this.node.current,"pointerdown",a=>this.onPointerDown(a))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Lf=!1;class i3 extends T.Component{componentDidMount(){const{visualElement:a,layoutGroup:s,switchLayoutGroup:r,layoutId:o}=this.props,{projection:d}=a;d&&(s.group&&s.group.add(d),r&&r.register&&o&&r.register(d),Lf&&d.root.didUpdate(),d.addEventListener("animationComplete",()=>{this.safeToRemove()}),d.setOptions({...d.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),ho.hasEverUpdated=!0}getSnapshotBeforeUpdate(a){const{layoutDependency:s,visualElement:r,drag:o,isPresent:d}=this.props,{projection:h}=r;return h&&(h.isPresent=d,a.layoutDependency!==s&&h.setOptions({...h.options,layoutDependency:s}),Lf=!0,o||a.layoutDependency!==s||s===void 0||a.isPresent!==d?h.willUpdate():this.safeToRemove(),a.isPresent!==d&&(d?h.promote():h.relegate()||ke.postRender(()=>{const p=h.getStack();(!p||!p.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:a,layoutAnchor:s}=this.props,{projection:r}=a;r&&(r.options.layoutAnchor=s,r.root.didUpdate(),Wd.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:a,layoutGroup:s,switchLayoutGroup:r}=this.props,{projection:o}=a;Lf=!0,o&&(o.scheduleCheckAfterUnmount(),s&&s.group&&s.group.remove(o),r&&r.deregister&&r.deregister(o))}safeToRemove(){const{safeToRemove:a}=this.props;a&&a()}render(){return null}}function $b(n){const[a,s]=rA(),r=T.useContext(yo);return f.jsx(i3,{...n,layoutGroup:r,switchLayoutGroup:T.useContext(Vb),isPresent:a,safeToRemove:s})}const s3={pan:{Feature:a3},drag:{Feature:n3,ProjectionNode:Nb,MeasureLayout:$b}};function P0(n,a,s){const{props:r}=n;n.animationState&&r.whileHover&&n.animationState.setActive("whileHover",s==="Start");const o="onHover"+s,d=r[o];d&&ke.postRender(()=>d(a,Cl(a)))}class l3 extends Sa{mount(){const{current:a}=this.node;a&&(this.unmount=C5(a,(s,r)=>(P0(this.node,r,"Start"),o=>P0(this.node,o,"End"))))}unmount(){}}class r3 extends Sa{constructor(){super(...arguments),this.isActive=!1}onFocus(){let a=!1;try{a=this.node.current.matches(":focus-visible")}catch{a=!0}!a||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=El(bl(this.node.current,"focus",()=>this.onFocus()),bl(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function J0(n,a,s){const{props:r}=n;if(n.current instanceof HTMLButtonElement&&n.current.disabled)return;n.animationState&&r.whileTap&&n.animationState.setActive("whileTap",s==="Start");const o="onTap"+(s==="End"?"":s),d=r[o];d&&ke.postRender(()=>d(a,Cl(a)))}class o3 extends Sa{mount(){const{current:a}=this.node;if(!a)return;const{globalTapTarget:s,propagate:r}=this.node.props;this.unmount=k5(a,(o,d)=>(J0(this.node,d,"Start"),(h,{success:p})=>J0(this.node,h,p?"End":"Cancel")),{useGlobalTarget:s,stopPropagation:(r==null?void 0:r.tap)===!1})}unmount(){}}const Td=new WeakMap,Vf=new WeakMap,u3=n=>{const a=Td.get(n.target);a&&a(n)},c3=n=>{n.forEach(u3)};function f3({root:n,...a}){const s=n||document;Vf.has(s)||Vf.set(s,{});const r=Vf.get(s),o=JSON.stringify(a);return r[o]||(r[o]=new IntersectionObserver(c3,{root:n,...a})),r[o]}function d3(n,a,s){const r=f3(a);return Td.set(n,s),r.observe(n),()=>{Td.delete(n),r.unobserve(n)}}const h3={some:0,all:1};class m3 extends Sa{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var m;(m=this.stopObserver)==null||m.call(this);const{viewport:a={}}=this.node.getProps(),{root:s,margin:r,amount:o="some",once:d}=a,h={root:s?s.current:void 0,rootMargin:r,threshold:typeof o=="number"?o:h3[o]},p=g=>{const{isIntersecting:x}=g;if(this.isInView===x||(this.isInView=x,d&&!x&&this.hasEnteredView))return;x&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",x);const{onViewportEnter:y,onViewportLeave:S}=this.node.getProps(),w=x?y:S;w&&w(g)};this.stopObserver=d3(this.node.current,h,p)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:a,prevProps:s}=this.node;["amount","margin","root"].some(p3(a,s))&&this.startObserver()}unmount(){var a;(a=this.stopObserver)==null||a.call(this),this.hasEnteredView=!1,this.isInView=!1}}function p3({viewport:n={}},{viewport:a={}}={}){return s=>n[s]!==a[s]}const g3={inView:{Feature:m3},tap:{Feature:o3},focus:{Feature:r3},hover:{Feature:l3}},v3={layout:{ProjectionNode:Nb,MeasureLayout:$b}},x3={...$A,...g3,...s3,...v3},qb=VA(x3,_A),Yo=T.forwardRef(function(a,s){return f.jsx(LT,{children:f.jsx("a",{...a,ref:s})})}),Ws={base:["relative isolate inline-flex items-baseline justify-center gap-x-2 rounded-lg border text-base/6 font-semibold","px-[calc(--spacing(3.5)-1px)] py-[calc(--spacing(2.5)-1px)] sm:px-[calc(--spacing(3)-1px)] sm:py-[calc(--spacing(1.5)-1px)] sm:text-sm/6","focus:not-data-focus:outline-hidden data-focus:outline-2 data-focus:outline-offset-2 data-focus:outline-blue-500","data-disabled:opacity-50","*:data-[slot=icon]:-mx-0.5 *:data-[slot=icon]:my-0.5 *:data-[slot=icon]:size-5 *:data-[slot=icon]:shrink-0 *:data-[slot=icon]:self-center *:data-[slot=icon]:text-(--btn-icon) sm:*:data-[slot=icon]:my-1 sm:*:data-[slot=icon]:size-4 forced-colors:[--btn-icon:ButtonText] forced-colors:data-hover:[--btn-icon:ButtonText]"],solid:["border-transparent bg-(--btn-border)","dark:bg-(--btn-bg)","before:absolute before:inset-0 before:-z-10 before:rounded-[calc(var(--radius-lg)-1px)] before:bg-(--btn-bg)","before:shadow-sm","dark:before:hidden","dark:border-white/5","after:absolute after:inset-0 after:-z-10 after:rounded-[calc(var(--radius-lg)-1px)]","after:shadow-[inset_0_1px_--theme(--color-white/15%)]","data-active:after:bg-(--btn-hover-overlay) data-hover:after:bg-(--btn-hover-overlay)","dark:after:-inset-px dark:after:rounded-lg","data-disabled:before:shadow-none data-disabled:after:shadow-none"],outline:["border-zinc-950/10 text-zinc-950 data-active:bg-zinc-950/2.5 data-hover:bg-zinc-950/2.5","dark:border-white/15 dark:text-white dark:[--btn-bg:transparent] dark:data-active:bg-white/5 dark:data-hover:bg-white/5","[--btn-icon:var(--color-zinc-500)] data-active:[--btn-icon:var(--color-zinc-700)] data-hover:[--btn-icon:var(--color-zinc-700)] dark:data-active:[--btn-icon:var(--color-zinc-400)] dark:data-hover:[--btn-icon:var(--color-zinc-400)]"],plain:["border-transparent text-zinc-950 data-active:bg-zinc-950/5 data-hover:bg-zinc-950/5","dark:text-white dark:data-active:bg-white/10 dark:data-hover:bg-white/10","[--btn-icon:var(--color-zinc-500)] data-active:[--btn-icon:var(--color-zinc-700)] data-hover:[--btn-icon:var(--color-zinc-700)] dark:[--btn-icon:var(--color-zinc-500)] dark:data-active:[--btn-icon:var(--color-zinc-400)] dark:data-hover:[--btn-icon:var(--color-zinc-400)]"],colors:{"dark/zinc":["text-white [--btn-bg:var(--color-zinc-900)] [--btn-border:var(--color-zinc-950)]/90 [--btn-hover-overlay:var(--color-white)]/10","dark:text-white dark:[--btn-bg:var(--color-zinc-600)] dark:[--btn-hover-overlay:var(--color-white)]/5","[--btn-icon:var(--color-zinc-400)] data-active:[--btn-icon:var(--color-zinc-300)] data-hover:[--btn-icon:var(--color-zinc-300)]"],light:["text-zinc-950 [--btn-bg:white] [--btn-border:var(--color-zinc-950)]/10 [--btn-hover-overlay:var(--color-zinc-950)]/2.5 data-active:[--btn-border:var(--color-zinc-950)]/15 data-hover:[--btn-border:var(--color-zinc-950)]/15","dark:text-white dark:[--btn-hover-overlay:var(--color-white)]/5 dark:[--btn-bg:var(--color-zinc-800)]","[--btn-icon:var(--color-zinc-500)] data-active:[--btn-icon:var(--color-zinc-700)] data-hover:[--btn-icon:var(--color-zinc-700)] dark:[--btn-icon:var(--color-zinc-500)] dark:data-active:[--btn-icon:var(--color-zinc-400)] dark:data-hover:[--btn-icon:var(--color-zinc-400)]"],"dark/white":["text-white [--btn-bg:var(--color-zinc-900)] [--btn-border:var(--color-zinc-950)]/90 [--btn-hover-overlay:var(--color-white)]/10","dark:text-zinc-950 dark:[--btn-bg:white] dark:[--btn-hover-overlay:var(--color-zinc-950)]/5","[--btn-icon:var(--color-zinc-400)] data-active:[--btn-icon:var(--color-zinc-300)] data-hover:[--btn-icon:var(--color-zinc-300)] dark:[--btn-icon:var(--color-zinc-500)] dark:data-active:[--btn-icon:var(--color-zinc-400)] dark:data-hover:[--btn-icon:var(--color-zinc-400)]"],dark:["text-white [--btn-bg:var(--color-zinc-900)] [--btn-border:var(--color-zinc-950)]/90 [--btn-hover-overlay:var(--color-white)]/10","dark:[--btn-hover-overlay:var(--color-white)]/5 dark:[--btn-bg:var(--color-zinc-800)]","[--btn-icon:var(--color-zinc-400)] data-active:[--btn-icon:var(--color-zinc-300)] data-hover:[--btn-icon:var(--color-zinc-300)]"],white:["text-zinc-950 [--btn-bg:white] [--btn-border:var(--color-zinc-950)]/10 [--btn-hover-overlay:var(--color-zinc-950)]/2.5 data-active:[--btn-border:var(--color-zinc-950)]/15 data-hover:[--btn-border:var(--color-zinc-950)]/15","dark:[--btn-hover-overlay:var(--color-zinc-950)]/5","[--btn-icon:var(--color-zinc-400)] data-active:[--btn-icon:var(--color-zinc-500)] data-hover:[--btn-icon:var(--color-zinc-500)]"],zinc:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-zinc-600)] [--btn-border:var(--color-zinc-700)]/90","dark:[--btn-hover-overlay:var(--color-white)]/5","[--btn-icon:var(--color-zinc-400)] data-active:[--btn-icon:var(--color-zinc-300)] data-hover:[--btn-icon:var(--color-zinc-300)]"],indigo:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-indigo-500)] [--btn-border:var(--color-indigo-600)]/90","[--btn-icon:var(--color-indigo-300)] data-active:[--btn-icon:var(--color-indigo-200)] data-hover:[--btn-icon:var(--color-indigo-200)]"],cyan:["text-cyan-950 [--btn-bg:var(--color-cyan-300)] [--btn-border:var(--color-cyan-400)]/80 [--btn-hover-overlay:var(--color-white)]/25","[--btn-icon:var(--color-cyan-500)]"],red:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-red-600)] [--btn-border:var(--color-red-700)]/90","[--btn-icon:var(--color-red-300)] data-active:[--btn-icon:var(--color-red-200)] data-hover:[--btn-icon:var(--color-red-200)]"],orange:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-orange-500)] [--btn-border:var(--color-orange-600)]/90","[--btn-icon:var(--color-orange-300)] data-active:[--btn-icon:var(--color-orange-200)] data-hover:[--btn-icon:var(--color-orange-200)]"],amber:["text-amber-950 [--btn-hover-overlay:var(--color-white)]/25 [--btn-bg:var(--color-amber-400)] [--btn-border:var(--color-amber-500)]/80","[--btn-icon:var(--color-amber-600)]"],yellow:["text-yellow-950 [--btn-hover-overlay:var(--color-white)]/25 [--btn-bg:var(--color-yellow-300)] [--btn-border:var(--color-yellow-400)]/80","[--btn-icon:var(--color-yellow-600)] data-active:[--btn-icon:var(--color-yellow-700)] data-hover:[--btn-icon:var(--color-yellow-700)]"],lime:["text-lime-950 [--btn-hover-overlay:var(--color-white)]/25 [--btn-bg:var(--color-lime-300)] [--btn-border:var(--color-lime-400)]/80","[--btn-icon:var(--color-lime-600)] data-active:[--btn-icon:var(--color-lime-700)] data-hover:[--btn-icon:var(--color-lime-700)]"],green:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-green-600)] [--btn-border:var(--color-green-700)]/90","[--btn-icon:var(--color-white)]/60 data-active:[--btn-icon:var(--color-white)]/80 data-hover:[--btn-icon:var(--color-white)]/80"],emerald:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-emerald-600)] [--btn-border:var(--color-emerald-700)]/90","[--btn-icon:var(--color-white)]/60 data-active:[--btn-icon:var(--color-white)]/80 data-hover:[--btn-icon:var(--color-white)]/80"],teal:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-teal-600)] [--btn-border:var(--color-teal-700)]/90","[--btn-icon:var(--color-white)]/60 data-active:[--btn-icon:var(--color-white)]/80 data-hover:[--btn-icon:var(--color-white)]/80"],sky:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-sky-500)] [--btn-border:var(--color-sky-600)]/80","[--btn-icon:var(--color-white)]/60 data-active:[--btn-icon:var(--color-white)]/80 data-hover:[--btn-icon:var(--color-white)]/80"],blue:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-blue-600)] [--btn-border:var(--color-blue-700)]/90","[--btn-icon:var(--color-blue-400)] data-active:[--btn-icon:var(--color-blue-300)] data-hover:[--btn-icon:var(--color-blue-300)]"],violet:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-violet-500)] [--btn-border:var(--color-violet-600)]/90","[--btn-icon:var(--color-violet-300)] data-active:[--btn-icon:var(--color-violet-200)] data-hover:[--btn-icon:var(--color-violet-200)]"],purple:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-purple-500)] [--btn-border:var(--color-purple-600)]/90","[--btn-icon:var(--color-purple-300)] data-active:[--btn-icon:var(--color-purple-200)] data-hover:[--btn-icon:var(--color-purple-200)]"],fuchsia:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-fuchsia-500)] [--btn-border:var(--color-fuchsia-600)]/90","[--btn-icon:var(--color-fuchsia-300)] data-active:[--btn-icon:var(--color-fuchsia-200)] data-hover:[--btn-icon:var(--color-fuchsia-200)]"],pink:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-pink-500)] [--btn-border:var(--color-pink-600)]/90","[--btn-icon:var(--color-pink-300)] data-active:[--btn-icon:var(--color-pink-200)] data-hover:[--btn-icon:var(--color-pink-200)]"],rose:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-rose-500)] [--btn-border:var(--color-rose-600)]/90","[--btn-icon:var(--color-rose-300)] data-active:[--btn-icon:var(--color-rose-200)] data-hover:[--btn-icon:var(--color-rose-200)]"]}};T.forwardRef(function({color:a,outline:s,plain:r,className:o,children:d,...h},p){let m=Fe(o,Ws.base,s?Ws.outline:r?Ws.plain:Fe(Ws.solid,Ws.colors[a??"dark/zinc"]));return typeof h.href=="string"?f.jsx(Yo,{...h,className:m,ref:p,children:f.jsx(ya,{children:d})}):f.jsx(Tl,{...h,className:Fe(m,"cursor-default"),ref:p,children:f.jsx(ya,{children:d})})});function ya({children:n}){return f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"absolute top-1/2 left-1/2 size-[max(100%,2.75rem)] -translate-x-1/2 -translate-y-1/2 pointer-fine:hidden","aria-hidden":"true"}),n]})}function y3({className:n,...a}){return f.jsx("nav",{...a,className:Fe(n,"flex flex-1 items-center gap-4 py-2.5")})}function b3({className:n,...a}){let s=T.useId();return f.jsx(Mb,{id:s,children:f.jsx("div",{...a,className:Fe(n,"flex items-center gap-3")})})}function S3({className:n,...a}){return f.jsx("div",{"aria-hidden":"true",...a,className:Fe(n,"-ml-4 flex-1")})}const rh=T.forwardRef(function({current:a,className:s,children:r,...o},d){let h=Fe("relative flex min-w-0 items-center gap-3 rounded-lg p-2 text-left text-base/6 font-medium text-zinc-950 sm:text-sm/5","*:data-[slot=icon]:size-6 *:data-[slot=icon]:shrink-0 *:data-[slot=icon]:fill-zinc-500 sm:*:data-[slot=icon]:size-5","*:not-nth-2:last:data-[slot=icon]:ml-auto *:not-nth-2:last:data-[slot=icon]:size-5 sm:*:not-nth-2:last:data-[slot=icon]:size-4","*:data-[slot=avatar]:-m-0.5 *:data-[slot=avatar]:size-7 *:data-[slot=avatar]:[--avatar-radius:var(--radius-md)] sm:*:data-[slot=avatar]:size-6","data-hover:bg-zinc-950/5 data-hover:*:data-[slot=icon]:fill-zinc-950","data-active:bg-zinc-950/5 data-active:*:data-[slot=icon]:fill-zinc-950","dark:text-white dark:*:data-[slot=icon]:fill-zinc-400","dark:data-hover:bg-white/5 dark:data-hover:*:data-[slot=icon]:fill-white","dark:data-active:bg-white/5 dark:data-active:*:data-[slot=icon]:fill-white");return f.jsxs("span",{className:Fe(s,"relative"),children:[a&&f.jsx(qb.span,{layoutId:"current-indicator",className:"absolute inset-x-2 -bottom-2.5 h-0.5 rounded-full bg-zinc-950 dark:bg-white"}),typeof o.href=="string"?f.jsx(Yo,{...o,className:h,"data-current":a?"true":void 0,ref:d,children:f.jsx(ya,{children:r})}):f.jsx(Tl,{...o,className:Fe("cursor-default",h),"data-current":a?"true":void 0,ref:d,children:f.jsx(ya,{children:r})})]})});function w3(){return f.jsx("svg",{"data-slot":"icon",viewBox:"0 0 20 20","aria-hidden":"true",children:f.jsx("path",{d:"M2 6.75C2 6.33579 2.33579 6 2.75 6H17.25C17.6642 6 18 6.33579 18 6.75C18 7.16421 17.6642 7.5 17.25 7.5H2.75C2.33579 7.5 2 7.16421 2 6.75ZM2 13.25C2 12.8358 2.33579 12.5 2.75 12.5H17.25C17.6642 12.5 18 12.8358 18 13.25C18 13.6642 17.6642 14 17.25 14H2.75C2.33579 14 2 13.6642 2 13.25Z"})})}function T3(){return f.jsx("svg",{"data-slot":"icon",viewBox:"0 0 20 20","aria-hidden":"true",children:f.jsx("path",{d:"M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z"})})}function j3({open:n,close:a,children:s}){return f.jsxs(xj,{open:n,onClose:a,className:"lg:hidden",children:[f.jsx(gj,{transition:!0,className:"fixed inset-0 bg-black/30 transition data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in"}),f.jsx(Ix,{transition:!0,className:"fixed inset-y-0 w-full max-w-80 p-2 transition duration-300 ease-in-out data-closed:-translate-x-full",children:f.jsxs("div",{className:"flex h-full flex-col rounded-lg bg-ouro-deep shadow-xl ring-1 ring-ouro-moss/40",children:[f.jsx("div",{className:"-mb-3 px-4 pt-3",children:f.jsx(Cx,{as:rh,"aria-label":"Close navigation",children:f.jsx(T3,{})})}),s]})})]})}function E3({navbar:n,sidebar:a,children:s}){let[r,o]=T.useState(!1);return f.jsxs("div",{className:"relative isolate flex min-h-svh w-full bg-ouro-void max-lg:flex-col",children:[f.jsx("div",{className:"fixed inset-y-0 left-0 w-64 max-lg:hidden border-r border-zinc-200 dark:border-ouro-moss/30",children:a}),f.jsx(j3,{open:r,close:()=>o(!1),children:a}),f.jsxs("header",{className:"flex items-center px-4 lg:hidden",children:[f.jsx("div",{className:"py-2.5",children:f.jsx(rh,{onClick:()=>o(!0),"aria-label":"Open navigation",children:f.jsx(w3,{})})}),f.jsx("div",{className:"min-w-0 flex-1",children:n})]}),f.jsx("main",{className:"flex flex-1 flex-col lg:min-w-0 lg:pl-64",children:f.jsx("div",{className:"grow bg-ouro-deep p-4 lg:p-8",children:f.jsx("div",{className:"mx-auto max-w-6xl",children:s})})})]})}function N3({className:n,...a}){return f.jsx("nav",{...a,className:Fe(n,"flex h-full min-h-0 flex-col")})}function A3({className:n,...a}){return f.jsx("div",{...a,className:Fe(n,"flex flex-col border-b border-zinc-950/5 p-4 dark:border-white/5 [&>[data-slot=section]+[data-slot=section]]:mt-2.5")})}function C3({className:n,...a}){return f.jsx("div",{...a,className:Fe(n,"flex flex-1 flex-col overflow-y-auto p-4 [&>[data-slot=section]+[data-slot=section]]:mt-8")})}function M3({className:n,...a}){return f.jsx("div",{...a,className:Fe(n,"flex flex-col border-t border-zinc-950/5 p-4 dark:border-white/5 [&>[data-slot=section]+[data-slot=section]]:mt-2.5")})}function W0({className:n,...a}){let s=T.useId();return f.jsx(Mb,{id:s,children:f.jsx("div",{...a,"data-slot":"section",className:Fe(n,"flex flex-col gap-0.5")})})}function I0({className:n,...a}){return f.jsx("h3",{...a,className:Fe(n,"mb-1 px-2 text-xs/6 font-medium text-zinc-500 dark:text-zinc-400")})}const D3=T.forwardRef(function({current:a,className:s,children:r,...o},d){let h=Fe("flex w-full items-center gap-3 rounded-lg px-2 py-2.5 text-left text-base/6 font-medium text-zinc-950 sm:py-2 sm:text-sm/5","*:data-[slot=icon]:size-6 *:data-[slot=icon]:shrink-0 *:data-[slot=icon]:fill-zinc-500 sm:*:data-[slot=icon]:size-5","*:last:data-[slot=icon]:ml-auto *:last:data-[slot=icon]:size-5 sm:*:last:data-[slot=icon]:size-4","*:data-[slot=avatar]:-m-0.5 *:data-[slot=avatar]:size-7 sm:*:data-[slot=avatar]:size-6","data-hover:bg-zinc-950/5 data-hover:*:data-[slot=icon]:fill-zinc-950","data-active:bg-zinc-950/5 data-active:*:data-[slot=icon]:fill-zinc-950","data-current:*:data-[slot=icon]:fill-zinc-950","dark:text-white dark:*:data-[slot=icon]:fill-zinc-400","dark:data-hover:bg-white/5 dark:data-hover:*:data-[slot=icon]:fill-white","dark:data-active:bg-white/5 dark:data-active:*:data-[slot=icon]:fill-white","dark:data-current:*:data-[slot=icon]:fill-white");return f.jsxs("span",{className:Fe(s,"relative"),children:[a&&f.jsx(qb.span,{layoutId:"current-indicator",className:"absolute inset-y-2 -left-4 w-0.5 rounded-full bg-zinc-950 dark:bg-white"}),typeof o.href=="string"?f.jsx(Cx,{as:Yo,...o,className:h,"data-current":a?"true":void 0,ref:d,children:f.jsx(ya,{children:r})}):f.jsx(Tl,{...o,className:Fe("cursor-default",h),"data-current":a?"true":void 0,ref:d,children:f.jsx(ya,{children:r})})]})});function O3({className:n,...a}){return f.jsx("span",{...a,className:Fe(n,"truncate")})}const R3={red:"bg-red-500/15 text-red-700 group-data-hover:bg-red-500/25 dark:bg-red-500/10 dark:text-red-400 dark:group-data-hover:bg-red-500/20",orange:"bg-orange-500/15 text-orange-700 group-data-hover:bg-orange-500/25 dark:bg-orange-500/10 dark:text-orange-400 dark:group-data-hover:bg-orange-500/20",amber:"bg-amber-400/20 text-amber-700 group-data-hover:bg-amber-400/30 dark:bg-amber-400/10 dark:text-amber-400 dark:group-data-hover:bg-amber-400/15",yellow:"bg-yellow-400/20 text-yellow-700 group-data-hover:bg-yellow-400/30 dark:bg-yellow-400/10 dark:text-yellow-300 dark:group-data-hover:bg-yellow-400/15",lime:"bg-lime-400/20 text-lime-700 group-data-hover:bg-lime-400/30 dark:bg-lime-400/10 dark:text-lime-300 dark:group-data-hover:bg-lime-400/15",green:"bg-green-500/15 text-green-700 group-data-hover:bg-green-500/25 dark:bg-green-500/10 dark:text-green-400 dark:group-data-hover:bg-green-500/20",emerald:"bg-emerald-500/15 text-emerald-700 group-data-hover:bg-emerald-500/25 dark:bg-emerald-500/10 dark:text-emerald-400 dark:group-data-hover:bg-emerald-500/20",teal:"bg-teal-500/15 text-teal-700 group-data-hover:bg-teal-500/25 dark:bg-teal-500/10 dark:text-teal-300 dark:group-data-hover:bg-teal-500/20",cyan:"bg-cyan-400/20 text-cyan-700 group-data-hover:bg-cyan-400/30 dark:bg-cyan-400/10 dark:text-cyan-300 dark:group-data-hover:bg-cyan-400/15",sky:"bg-sky-500/15 text-sky-700 group-data-hover:bg-sky-500/25 dark:bg-sky-500/10 dark:text-sky-300 dark:group-data-hover:bg-sky-500/20",blue:"bg-blue-500/15 text-blue-700 group-data-hover:bg-blue-500/25 dark:text-blue-400 dark:group-data-hover:bg-blue-500/25",indigo:"bg-indigo-500/15 text-indigo-700 group-data-hover:bg-indigo-500/25 dark:text-indigo-400 dark:group-data-hover:bg-indigo-500/20",violet:"bg-violet-500/15 text-violet-700 group-data-hover:bg-violet-500/25 dark:text-violet-400 dark:group-data-hover:bg-violet-500/20",purple:"bg-purple-500/15 text-purple-700 group-data-hover:bg-purple-500/25 dark:text-purple-400 dark:group-data-hover:bg-purple-500/20",fuchsia:"bg-fuchsia-400/15 text-fuchsia-700 group-data-hover:bg-fuchsia-400/25 dark:bg-fuchsia-400/10 dark:text-fuchsia-400 dark:group-data-hover:bg-fuchsia-400/20",pink:"bg-pink-400/15 text-pink-700 group-data-hover:bg-pink-400/25 dark:bg-pink-400/10 dark:text-pink-400 dark:group-data-hover:bg-pink-400/20",rose:"bg-rose-400/15 text-rose-700 group-data-hover:bg-rose-400/25 dark:bg-rose-400/10 dark:text-rose-400 dark:group-data-hover:bg-rose-400/20",zinc:"bg-zinc-600/10 text-zinc-700 group-data-hover:bg-zinc-600/20 dark:bg-white/5 dark:text-zinc-400 dark:group-data-hover:bg-white/10"};function xe({color:n="zinc",className:a,...s}){return f.jsx("span",{...s,className:Fe(a,"inline-flex items-center gap-x-1.5 rounded-md px-1.5 py-0.5 text-sm/5 font-medium sm:text-xs/5 forced-colors:outline",R3[n])})}T.forwardRef(function({color:a="zinc",className:s,children:r,...o},d){let h=Fe(s,"group relative inline-flex rounded-md focus:not-data-focus:outline-hidden data-focus:outline-2 data-focus:outline-offset-2 data-focus:outline-blue-500");return typeof o.href=="string"?f.jsx(Yo,{...o,className:h,ref:d,children:f.jsx(ya,{children:f.jsx(xe,{color:a,children:r})})}):f.jsx(Tl,{...o,className:h,ref:d,children:f.jsx(ya,{children:f.jsx(xe,{color:a,children:r})})})});function z3(n){T.useEffect(()=>{if(!n)return;const a=n;function s(r){if(!(r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement))switch(r.key){case"1":a({tab:"overview"});break;case"2":a({tab:"mail"});break;case"3":a({tab:"sessions"});break;case"4":a({tab:"work"});break;case"5":a({tab:"connections"});break;case"6":a({tab:"inner"});break;case"7":a({tab:"notes"});break;case"8":a({tab:"runtime"});break;case"Escape":{document.activeElement instanceof HTMLElement&&document.activeElement.blur();break}}}return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[n])}const k3={"owed-reply":"red","blocking-obligation":"red","broken-return":"red","stale-delegation":"yellow","return-ready":"lime","overdue-habit":"yellow"},L3={"owed-reply":"owed reply","blocking-obligation":"blocking","broken-return":"broken return","stale-delegation":"stale","return-ready":"ready to return","overdue-habit":"overdue"},V3={"owed-reply":"Someone spoke last and is waiting for your response","blocking-obligation":"This obligation is open and blocking forward progress","broken-return":"Work was done but the result was never returned to the requester","stale-delegation":"This was delegated to you and hasn't been addressed","return-ready":"The result is ready — deliver it to close the loop","overdue-habit":"This routine is past its scheduled cadence"},_3=new Set(["stale-delegation"]),U3=new Set(["owed-reply","blocking-obligation","broken-return","return-ready","overdue-habit"]),B3=new Set(["spawning","running","waiting_input","stalled"]);function H3({view:n,deskPrefs:a,refreshGeneration:s}){const r=Pi(),[o,d]=T.useState(null),[h,p]=T.useState(null),[m,g]=T.useState(null),[x,y]=T.useState(null),[S,w]=T.useState(null),j=n.agent,E=n.work,C=n.inner,z=n.activity,D=j.degraded,R=j.attention,k=E.tasks,U=E.obligations,P=E.sessions,F=E.coding,W=j.senses,re=E.bridges;return T.useEffect(()=>{_e(`/agents/${encodeURIComponent(j.agentName)}/needs-me`).then(d),_e(`/agents/${encodeURIComponent(j.agentName)}/coding`).then(p),_e(`/agents/${encodeURIComponent(j.agentName)}/continuity`).then(g).catch(()=>{}),_e(`/agents/${encodeURIComponent(j.agentName)}/orientation`).then(y).catch(()=>{}),_e(`/agents/${encodeURIComponent(j.agentName)}/changes`).then(w).catch(()=>{})},[j.agentName,s]),f.jsxs("div",{className:"space-y-6",children:[o&&o.items.length>0&&(()=>{const B=o.items.filter(ie=>U3.has(ie.urgency)),Z=o.items.filter(ie=>_3.has(ie.urgency));return f.jsxs("div",{className:"space-y-3",children:[B.length>0&&f.jsxs("div",{className:"rounded-xl bg-ouro-fang/5 p-4 ring-1 ring-ouro-fang/15",children:[f.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-fang",children:["Action now (",B.length,")"]}),f.jsx("div",{className:"mt-2 space-y-1.5",children:B.map((ie,le)=>f.jsx(ex,{item:ie,nav:r,agentName:j.agentName,onDismiss:()=>{d(Se=>Se&&{items:Se.items.filter((De,$)=>o.items.indexOf(ie)!==$)})}},`action-${le}`))})]}),Z.length>0&&f.jsxs("div",{className:"rounded-xl bg-ouro-gold/5 p-4 ring-1 ring-ouro-gold/15",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-gold",children:["Stale (",Z.length,")"]}),f.jsx("button",{onClick:async()=>{var ie;for(const le of Z)(ie=le.ref)!=null&&ie.focus&&await fetch(`/api/agents/${encodeURIComponent(j.agentName)}/dismiss-obligation`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({obligationId:le.ref.focus})});_e(`/agents/${encodeURIComponent(j.agentName)}/needs-me`).then(d)},className:"text-xs text-ouro-gold underline underline-offset-2 hover:text-ouro-bone transition-colors",children:"Clear all stale"})]}),f.jsx("div",{className:"mt-2 space-y-1.5",children:Z.map((ie,le)=>f.jsx(ex,{item:ie,nav:r,agentName:j.agentName,onDismiss:()=>{_e(`/agents/${encodeURIComponent(j.agentName)}/needs-me`).then(d)}},`stale-${le}`))})]})]})})(),(a==null?void 0:a.carrying)&&f.jsxs("div",{className:"rounded-xl bg-ouro-moss/10 p-4 ring-1 ring-ouro-glow/8",children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-glow",children:"What I'm carrying"}),f.jsx("p",{className:"mt-1 text-sm leading-relaxed text-ouro-bone",children:a.carrying})]}),(()=>{const B=(a==null?void 0:a.pinnedConstellations)??[];return B.length===0?null:f.jsxs("div",{children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:"Pinned threads"}),f.jsx("div",{className:"mt-2 space-y-2",children:B.map((Z,ie)=>f.jsxs("div",{className:"rounded-lg bg-ouro-void/40 px-3 py-2.5 ring-1 ring-ouro-moss/15",children:[f.jsx("p",{className:"font-medium text-ouro-bone",children:Z.label}),f.jsxs("div",{className:"mt-1 flex flex-wrap gap-1.5",children:[Z.friendIds.map(le=>f.jsxs("button",{onClick:()=>r({tab:"sessions"}),className:"text-xs text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2",children:["friend:",le.slice(0,8),"…"]},le)),Z.taskRefs.map(le=>f.jsxs("button",{onClick:()=>r({tab:"work"}),className:"text-xs text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2",children:["task:",le]},le)),Z.bridgeIds.map(le=>f.jsxs("button",{onClick:()=>r({tab:"connections",focus:le}),className:"text-xs text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2",children:["bridge:",le.slice(0,8),"…"]},le))]})]},ie))})]})})(),f.jsxs("div",{className:"rounded-xl bg-ouro-moss/15 p-4 ring-1 ring-ouro-glow/10 sm:p-5",children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-glow",children:"Center of gravity"}),f.jsx("p",{className:"mt-1 font-display text-xl italic font-semibold text-ouro-bone sm:text-2xl",children:R.label}),f.jsxs("p",{className:"mt-2 text-sm leading-relaxed text-ouro-mist",children:[j.agentName," has"," ",f.jsxs(no,{tab:"work",children:[k.liveCount," live tasks"]}),","," ",f.jsxs(no,{tab:"work",children:[U.openCount," obligations"]}),","," ",f.jsxs(no,{tab:"work",children:[F.activeCount," coding lanes"]}),", and"," ",f.jsxs(no,{tab:"sessions",children:[P.liveCount," live sessions"]}),"."]}),D.status==="degraded"&&D.issues.length>0&&f.jsxs("div",{className:"mt-3 space-y-1",children:[D.issues.slice(0,5).map((B,Z)=>f.jsxs("button",{onClick:()=>r({tab:"runtime"}),className:"flex w-full items-start gap-2 rounded-lg bg-ouro-fang/5 px-3 py-2 text-left text-sm ring-1 ring-ouro-fang/10 hover:ring-ouro-fang/25 transition-colors",children:[f.jsx("span",{className:"mt-0.5 h-2 w-2 shrink-0 rounded-full bg-ouro-fang"}),f.jsxs("span",{className:"text-ouro-mist",children:[f.jsx("span",{className:"font-semibold text-ouro-fang",children:B.code}),f.jsxs("span",{className:"text-ouro-shadow",children:[" — ",pt(B.detail,80)]})]})]},Z)),D.issues.length>5&&f.jsxs("button",{onClick:()=>r({tab:"runtime"}),className:"text-xs text-ouro-glow underline underline-offset-2",children:["+",D.issues.length-5," more issues"]})]})]}),x&&f.jsxs("div",{className:"rounded-xl bg-ouro-moss/10 p-4 ring-1 ring-ouro-glow/8",children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-glow",children:"Orientation"}),(()=>{const B=x.currentSession;return B?f.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[f.jsx(xe,{color:"lime",children:"active session"}),f.jsxs("button",{onClick:()=>r({tab:"sessions",focus:`${B.friendId}/${B.channel}/${B.key}`}),className:"text-sm text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2",children:[B.channel,"/",B.key]}),B.lastActivityAt&&f.jsx("span",{className:"text-xs text-ouro-shadow",children:et(B.lastActivityAt)})]}):null})(),x.primaryObligation&&f.jsxs("div",{className:"mt-2 rounded-lg bg-ouro-void/40 px-3 py-2 ring-1 ring-ouro-moss/15",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(xe,{color:"yellow",children:x.primaryObligation.status}),f.jsx("span",{className:"text-sm font-medium text-ouro-bone",children:pt(x.primaryObligation.content,80)})]}),x.primaryObligation.nextAction&&f.jsxs("p",{className:"mt-1 text-xs text-ouro-mist",children:["Next: ",x.primaryObligation.nextAction]}),x.primaryObligation.waitingOn&&f.jsxs("p",{className:"mt-0.5 text-xs text-ouro-shadow",children:["Waiting on: ",x.primaryObligation.waitingOn]})]}),x.resumeHandle&&f.jsxs("div",{className:"mt-2 rounded-lg bg-ouro-void/40 px-3 py-2 ring-1 ring-ouro-moss/15",children:[f.jsx("p",{className:"font-mono text-[9px] uppercase tracking-wider text-ouro-shadow",children:"Resume handle"}),f.jsxs("div",{className:"mt-1 space-y-0.5 text-sm",children:[x.resumeHandle.lane&&f.jsxs("p",{className:"text-ouro-bone",children:["Lane: ",x.resumeHandle.lane]}),x.resumeHandle.artifact&&f.jsxs("p",{className:"text-ouro-mist",children:["Artifact: ",x.resumeHandle.artifact]}),x.resumeHandle.nextAction&&f.jsxs("p",{className:"text-ouro-mist",children:["Next: ",x.resumeHandle.nextAction]}),x.resumeHandle.blockerOrWaitingOn&&f.jsxs("p",{className:"text-ouro-shadow",children:["Blocked: ",x.resumeHandle.blockerOrWaitingOn]}),f.jsxs(xe,{color:x.resumeHandle.confidence==="high"?"lime":x.resumeHandle.confidence==="medium"?"yellow":"zinc",children:[x.resumeHandle.confidence," confidence"]})]})]}),x.otherActiveSessions.length>0&&f.jsxs("div",{className:"mt-2",children:[f.jsxs("p",{className:"text-[10px] uppercase tracking-wider text-ouro-shadow",children:["Other sessions (",x.otherActiveSessions.length,")"]}),f.jsx("div",{className:"mt-1 flex flex-wrap gap-1.5",children:x.otherActiveSessions.slice(0,5).map(B=>f.jsx("button",{onClick:()=>r({tab:"sessions",focus:`${B.friendId}/${B.channel}/${B.key}`}),className:"text-xs text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2",children:B.friendName},`${B.friendId}/${B.channel}/${B.key}`))})]})]}),S&&S.changeCount>0&&f.jsxs("div",{className:"rounded-xl bg-ouro-gold/5 p-4 ring-1 ring-ouro-gold/15",children:[f.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-gold",children:["What changed (",S.changeCount,")"]}),S.snapshotAge&&f.jsxs("p",{className:"mt-0.5 text-xs text-ouro-shadow",children:["Since ",et(S.snapshotAge)]}),f.jsxs("div",{className:"mt-2 space-y-1",children:[S.items.slice(0,8).map((B,Z)=>f.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[f.jsx(xe,{color:B.kind.includes("status")?"yellow":"zinc",children:B.kind.replace(/_/g," ")}),f.jsx("span",{className:"truncate text-ouro-mist",children:B.summary})]},Z)),S.items.length>8&&f.jsxs("p",{className:"text-xs text-ouro-shadow",children:["+",S.items.length-8," more changes"]})]})]}),m&&f.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[f.jsxs("div",{className:"rounded-xl bg-ouro-void/50 p-4 ring-1 ring-ouro-moss/20",children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-glow",children:"Presence"}),m.presence.self?f.jsxs("div",{className:"mt-2 space-y-1",children:[f.jsx("p",{className:"text-sm font-medium text-ouro-bone",children:m.presence.self.availability}),m.presence.self.lane&&f.jsxs("p",{className:"text-xs text-ouro-shadow",children:["Lane: ",m.presence.self.lane]}),m.presence.self.tempo&&f.jsxs("p",{className:"text-xs text-ouro-shadow",children:["Tempo: ",m.presence.self.tempo]})]}):f.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No presence data"}),m.presence.peers.length>0&&f.jsxs("div",{className:"mt-2 border-t border-ouro-moss/20 pt-2",children:[f.jsx("p",{className:"text-[10px] uppercase tracking-wider text-ouro-shadow",children:"Peers"}),f.jsx("div",{className:"mt-1 flex flex-wrap gap-1.5",children:m.presence.peers.map(B=>f.jsx(xe,{color:B.availability==="active"?"lime":"zinc",children:B.agentName},B.agentName))})]})]}),f.jsxs("div",{className:"rounded-xl bg-ouro-void/50 p-4 ring-1 ring-ouro-moss/20",children:[f.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-glow",children:["Cares (",m.cares.activeCount,")"]}),m.cares.items.length>0?f.jsx("div",{className:"mt-2 space-y-1.5",children:m.cares.items.slice(0,5).map(B=>f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(xe,{color:B.salience==="high"?"red":B.salience==="medium"?"yellow":"zinc",children:B.salience}),f.jsx("p",{className:"truncate text-sm text-ouro-bone",children:B.label})]},B.id))}):f.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No active cares"})]}),f.jsxs("div",{className:"rounded-xl bg-ouro-void/50 p-4 ring-1 ring-ouro-moss/20",children:[f.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-glow",children:["Episodes (",m.episodes.recentCount,")"]}),m.episodes.items.length>0?f.jsx("div",{className:"mt-2 space-y-1.5",children:m.episodes.items.slice(0,5).map(B=>f.jsxs("div",{className:"flex items-start gap-2",children:[f.jsx(xe,{color:"zinc",children:B.kind}),f.jsxs("div",{className:"min-w-0",children:[f.jsx("p",{className:"truncate text-sm text-ouro-bone",children:B.summary}),f.jsx("p",{className:"text-xs text-ouro-shadow",children:et(B.timestamp)})]})]},B.id))}):f.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No recent episodes"})]})]}),f.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[f.jsx(ao,{label:"Tasks",value:k.liveCount,sub:`${k.blockedCount} blocked`,onClick:()=>r({tab:"work"})}),f.jsx(ao,{label:"Obligations",value:U.openCount,sub:`${P.liveCount} sessions`,onClick:()=>r({tab:"work"})}),f.jsx(ao,{label:"Coding",value:F.activeCount,sub:`${F.blockedCount} blocked`,onClick:()=>r({tab:"work"})}),f.jsx(ao,{label:"Inner",value:C.status,sub:pt(C.summary??"",30),onClick:()=>r({tab:"inner"})})]}),h&&h.items.length>0&&(()=>{const B=h.items.filter(Z=>B3.has(Z.status));return B.length===0?null:f.jsx(Is,{title:`Active coding (${B.length})`,children:f.jsx("div",{className:"space-y-1.5",children:B.map(Z=>f.jsxs("button",{onClick:()=>r({tab:"work"}),className:"flex w-full items-center gap-2 rounded-lg bg-ouro-void/40 px-3 py-2 text-left ring-1 ring-ouro-moss/15 hover:ring-ouro-glow/20 transition-colors",children:[f.jsx(xe,{color:Z.status==="running"?"lime":Z.status==="waiting_input"?"yellow":"zinc",children:Z.status}),f.jsxs("span",{className:"truncate text-sm text-ouro-bone",children:[Z.runner," — ",pt(Z.workdir,40)]}),f.jsx("span",{className:"shrink-0 text-xs text-ouro-shadow",children:et(Z.lastActivityAt)})]},Z.id))})})})(),f.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[f.jsx(Is,{title:"Senses",children:W.length>0?f.jsx($3,{items:W}):f.jsx(_f,{children:"No active senses"})}),f.jsx(Is,{title:"Bridges",children:re.length>0?f.jsx("div",{className:"flex flex-wrap gap-1.5",children:re.map(B=>f.jsx("button",{onClick:()=>r({tab:"connections",focus:B}),children:f.jsx(xe,{color:"lime",children:B})},B))}):f.jsx(_f,{children:"No active bridges"})})]}),(()=>{const B=U.items.filter(Z=>Z.status==="fulfilled");return B.length===0?null:f.jsx(Is,{title:"Recently closed",children:f.jsx("div",{className:"space-y-1",children:B.slice(0,3).map((Z,ie)=>f.jsxs("div",{className:"flex items-center gap-2 rounded-lg px-3 py-2 bg-ouro-glow/5 ring-1 ring-ouro-glow/10",children:[f.jsx(xe,{color:"lime",children:"closed"}),f.jsx("p",{className:"text-sm text-ouro-mist truncate",children:pt(Z.content,80)}),f.jsx("span",{className:"shrink-0 text-xs text-ouro-shadow",children:et(Z.updatedAt)})]},ie))})})})(),f.jsx(Is,{title:"Recent activity",children:z.recent.length>0?f.jsx("div",{className:"space-y-1",children:z.recent.map((B,Z)=>{const ie=B.kind==="coding"||B.kind==="obligation"?"work":B.kind==="session"?"sessions":"inner";return f.jsxs("button",{onClick:()=>r({tab:ie}),className:"flex w-full flex-col gap-0.5 rounded-lg px-3 py-2.5 text-left hover:bg-ouro-moss/10 transition-colors",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(xe,{children:B.kind}),f.jsx("span",{className:"text-xs text-ouro-shadow",children:et(B.at)})]}),f.jsx("p",{className:"truncate text-sm font-medium text-ouro-bone",children:pt(B.label,100)}),f.jsx("p",{className:"truncate text-xs text-ouro-shadow",children:pt(B.detail,80)})]},Z)})}):f.jsx(_f,{children:"No recent activity yet."})})]})}function ex({item:n,nav:a,agentName:s,onDismiss:r}){var h;const o=n.urgency==="return-ready",d=(h=n.ref)==null?void 0:h.focus;return f.jsxs("div",{className:`flex w-full items-start gap-2.5 rounded-lg px-3 py-2.5 text-left ring-1 transition-colors ${o?"bg-ouro-glow/5 ring-ouro-glow/15":"bg-ouro-void/40 ring-ouro-moss/10"}`,children:[f.jsxs("button",{onClick:()=>n.ref&&a({tab:n.ref.tab,focus:n.ref.focus}),className:"flex min-w-0 flex-1 items-start gap-2.5",children:[f.jsx(xe,{color:k3[n.urgency]??"zinc",children:L3[n.urgency]??n.urgency}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("p",{className:`text-sm font-medium ${o?"text-ouro-glow":"text-ouro-bone"}`,children:n.label}),f.jsx("p",{className:"text-xs text-ouro-shadow truncate",children:n.detail}),f.jsx("p",{className:"text-[10px] italic text-ouro-shadow/60 mt-0.5",children:V3[n.urgency]??""})]}),n.ageMs!=null&&f.jsx("span",{className:"shrink-0 text-xs tabular-nums text-ouro-shadow",children:n.ageMs<36e5?`${Math.floor(n.ageMs/6e4)}m`:n.ageMs<864e5?`${Math.floor(n.ageMs/36e5)}h`:`${Math.floor(n.ageMs/864e5)}d`})]}),d&&f.jsx("button",{onClick:async p=>{p.stopPropagation(),await fetch(`/api/agents/${encodeURIComponent(s)}/dismiss-obligation`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({obligationId:d})}),r()},className:"shrink-0 text-xs text-ouro-shadow hover:text-ouro-fang transition-colors",title:"Dismiss",children:"✕"})]})}function no({tab:n,children:a}){const s=Pi();return f.jsx("button",{onClick:()=>s({tab:n}),className:"text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2 hover:decoration-ouro-glow transition-colors",children:a})}function ao({label:n,value:a,sub:s,onClick:r}){return f.jsxs("button",{onClick:r,className:"rounded-xl bg-ouro-void/50 p-3 text-left ring-1 ring-ouro-moss/20 hover:ring-ouro-glow/20 transition-all",children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-ouro-shadow",children:n}),f.jsx("p",{className:"mt-1 text-xl font-semibold tabular-nums text-ouro-bone",children:a}),f.jsx("p",{className:"mt-0.5 truncate text-xs text-ouro-shadow",children:s})]})}function Is({title:n,children:a}){return f.jsxs("div",{children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:n}),f.jsx("div",{className:"mt-2",children:a})]})}function $3({items:n}){return f.jsx("div",{className:"flex flex-wrap gap-1.5",children:n.map(a=>f.jsx(xe,{color:"lime",children:a},a))})}function _f({children:n}){return f.jsx("p",{className:"text-sm text-ouro-shadow",children:n})}function pl(n){return n.length>0?n.join(", "):"(unknown)"}function q3(n,a){if(a==="all")return!0;if(["imbox","screener","discarded","quarantine"].includes(a))return n.placement===a;if(a==="native"||a==="delegated")return n.compartmentKind===a;if(a.startsWith("source:")){const s=a.slice(7),r=s.indexOf(":");if(r===-1)return n.source===s;const o=s.slice(0,r),d=s.slice(r+1);return n.source===o&&(n.ownerEmail??"unknown-owner")===d}return!1}function Yb(n){return n.subject||"(no subject)"}function Y3(n,a){return{status:"error",agentName:n,mailboxAddress:null,generatedAt:new Date().toISOString(),store:null,folders:[],messages:[],screener:[],outbound:[],recovery:{discardedCount:0,quarantineCount:0,undecryptableCount:0,missingKeyIds:[]},accessLog:[],error:a}}function G3(n,a,s){return{status:"error",agentName:n,mailboxAddress:a,generatedAt:new Date().toISOString(),message:null,accessLog:[],error:s}}function Gb(n){return n.provenance.compartmentKind==="delegated"?`delegated human mailbox · ${n.provenance.ownerEmail??"unknown owner"} / ${n.provenance.source??"unknown source"}`:"native agent mailbox"}function X3(n){return n.mailboxRole==="delegated-human-mailbox"?`delegated human mailbox · ${n.ownerEmail??"unknown owner"} / ${n.source??"unknown source"}`:n.mailboxRole==="agent-native-mailbox"?"native agent mailbox":"mailbox"}function K3(n){return n.sendAuthority==="agent-native"?"native agent mailbox":n.mailboxRole}function F3(n){return n.transport??n.provider??"not sent"}function Z3(n){return n.deliveredAt??n.failedAt??n.acceptedAt??n.sentAt??n.submittedAt??n.updatedAt}function oh(n){return n==="screener"?"bg-[#fff7d6] text-[#6f5200] ring-[#e7c85c]":n==="discarded"||n==="quarantine"?"bg-[#ffe8e2] text-[#8a2f1f] ring-[#ef9a84]":n==="sent"?"bg-[#dff7ea] text-[#17613a] ring-[#82caa1]":n==="draft"?"bg-[#e7ecff] text-[#263f95] ring-[#a7b5f5]":"bg-[#e9f3ef] text-[#1e5840] ring-[#9fc7b5]"}function Q3(n){return(n==null?void 0:n.messages.length)??0}function P3({agentName:n,focus:a,onFocusConsumed:s,refreshGeneration:r}){var z;const[o,d]=T.useState(null),[h,p]=T.useState("all"),[m,g]=T.useState(a??null),[x,y]=T.useState(null),[S,w]=T.useState(!1);T.useEffect(()=>{p("all"),g(a??null),y(null)},[n]),T.useEffect(()=>{d(null),_e(`/agents/${encodeURIComponent(n)}/mail`).then(d).catch(()=>d(Y3(n,"mail unavailable")))},[n,r]),T.useEffect(()=>{a&&(g(a),s==null||s())},[a,s]),T.useEffect(()=>{if(!m){y(null);return}w(!0),_e(`/agents/${encodeURIComponent(n)}/mail/${encodeURIComponent(m)}`).then(y).catch(()=>y(G3(n,(o==null?void 0:o.mailboxAddress)??null,"message unavailable"))).finally(()=>w(!1))},[n,m,r]);const j=T.useMemo(()=>{const D=(o==null?void 0:o.folders)??[];return[{id:"all",label:"All",count:Q3(o)},...D]},[o]),E=T.useMemo(()=>((o==null?void 0:o.messages)??[]).filter(D=>q3(D,h)),[h,o]),C=T.useMemo(()=>h!=="draft"&&h!=="sent"?[]:((o==null?void 0:o.outbound)??[]).filter(D=>h==="draft"?D.status==="draft":D.status!=="draft"),[h,o]);return o?o.status!=="ready"?f.jsx("div",{className:"mailbox-shell grid min-h-[58vh] place-items-center rounded-md bg-[#f2f6ef] p-8 text-[#1f2720] ring-1 ring-black/10",children:f.jsxs("div",{className:"max-w-lg text-center",children:[f.jsx("p",{className:"text-sm font-semibold text-[#667067]",children:"Mailbox"}),f.jsx("h2",{className:"mt-2 text-2xl font-semibold",children:o.status==="auth-required"?"Locked":"Unavailable"}),f.jsx("p",{className:"mt-3 text-sm leading-6 text-[#59645c]",children:o.error})]})}):f.jsxs("div",{className:"mailbox-shell overflow-hidden rounded-md bg-[#f2f6ef] text-[#172018] ring-1 ring-black/10",children:[f.jsxs("header",{className:"flex flex-wrap items-center justify-between gap-3 border-b border-[#cbd8c8] bg-[#e4ecdf] px-4 py-3",children:[f.jsxs("div",{className:"min-w-0",children:[f.jsx("p",{className:"text-xs font-semibold text-[#687062]",children:"Agent mailbox"}),f.jsx("p",{className:"truncate text-sm text-[#2d3a30]",children:o.mailboxAddress})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(xe,{color:"zinc",children:"read-only"}),f.jsxs("span",{className:"text-xs tabular-nums text-[#687062]",children:[o.messages.length," messages"]}),f.jsxs("span",{className:"text-xs tabular-nums text-[#687062]",children:[o.outbound.length," outbound"]})]})]}),f.jsxs("div",{className:"grid min-h-[66vh] grid-cols-1 lg:grid-cols-[14.5rem_minmax(19rem,25rem)_minmax(0,1fr)]",children:[f.jsxs("aside",{className:"border-b border-[#cbd8c8] bg-[#e4ecdf] p-3 lg:border-b-0 lg:border-r",children:[f.jsx(J3,{folders:j,activeFolder:h,setActiveFolder:p}),f.jsx(W3,{discarded:o.recovery.discardedCount,quarantine:o.recovery.quarantineCount,undecryptable:o.recovery.undecryptableCount,missingKeyIds:o.recovery.missingKeyIds}),f.jsx(I3,{candidates:o.screener,onOpen:D=>{p("screener"),g(D)}}),f.jsx(eC,{entries:o.accessLog})]}),f.jsxs("section",{className:"border-b border-[#cbd8c8] bg-[#fbfdf8] lg:border-b-0 lg:border-r",children:[f.jsxs("div",{className:"border-b border-[#d8e2d4] px-4 py-3",children:[f.jsx("p",{className:"text-sm font-semibold text-[#172018]",children:((z=j.find(D=>D.id===h))==null?void 0:z.label)??"All"}),f.jsx("p",{className:"text-xs text-[#687062]",children:C.length>0?`${C.length} outbound records`:`${E.length} messages`})]}),f.jsxs("div",{className:"max-h-[66vh] overflow-y-auto",children:[C.map(D=>f.jsx(nC,{record:D},D.id)),C.length===0&&E.map(D=>f.jsx(tC,{message:D,selected:m===D.id,onSelect:()=>g(D.id)},D.id)),C.length===0&&E.length===0&&f.jsx("div",{className:"px-4 py-10 text-center text-sm text-[#687062]",children:"No records here."})]})]}),f.jsxs("main",{className:"min-w-0 bg-[#fbfdf8]",children:[!m&&f.jsx(iC,{}),m&&S&&f.jsx(tx,{label:"Opening message"}),m&&!S&&(x==null?void 0:x.status)!=="ready"&&f.jsx("div",{className:"grid min-h-[54vh] place-items-center p-8 text-center",children:f.jsxs("div",{children:[f.jsx("p",{className:"text-sm font-semibold text-[#172018]",children:"Message unavailable"}),f.jsx("p",{className:"mt-2 text-sm text-[#687062]",children:x==null?void 0:x.error})]})}),(x==null?void 0:x.status)==="ready"&&x.message&&f.jsx(aC,{detail:x})]})]})]}):f.jsx(tx,{label:"Opening mailbox"})}function J3({folders:n,activeFolder:a,setActiveFolder:s}){return f.jsx("div",{className:"space-y-1",children:n.map(r=>f.jsxs("button",{type:"button",onClick:()=>s(r.id),className:`flex h-9 w-full items-center justify-between rounded px-3 text-left text-sm transition-colors ${a===r.id?"bg-[#fbfdf8] text-[#172018] shadow-sm":"text-[#536157] hover:bg-[#fbfdf8]/65"}`,children:[f.jsx("span",{className:"truncate",children:r.label}),f.jsx("span",{className:"text-xs tabular-nums text-[#687062]",children:r.count})]},r.id))})}function W3({discarded:n,quarantine:a,undecryptable:s,missingKeyIds:r}){return f.jsxs("div",{className:"mt-5 border-t border-[#cbd8c8] pt-4",children:[f.jsx("p",{className:"text-[11px] font-semibold text-[#687062]",children:"Recovery drawers"}),f.jsxs("div",{className:"mt-2 grid grid-cols-3 gap-2",children:[f.jsxs("div",{className:"rounded border border-[#cbd8c8] bg-[#fbfdf8] px-3 py-2",children:[f.jsx("p",{className:"text-xs text-[#687062]",children:"Discarded"}),f.jsx("p",{className:"text-lg font-semibold tabular-nums text-[#172018]",children:n})]}),f.jsxs("div",{className:"rounded border border-[#cbd8c8] bg-[#fbfdf8] px-3 py-2",children:[f.jsx("p",{className:"text-xs text-[#687062]",children:"Quarantine"}),f.jsx("p",{className:"text-lg font-semibold tabular-nums text-[#172018]",children:a})]}),f.jsxs("div",{className:"rounded border border-[#cbd8c8] bg-[#fbfdf8] px-3 py-2",children:[f.jsx("p",{className:"text-xs text-[#687062]",children:"Undecryptable"}),f.jsx("p",{className:"text-lg font-semibold tabular-nums text-[#172018]",children:s})]})]}),s>0&&f.jsxs("p",{className:"mt-2 text-[11px] leading-4 text-[#687062]",children:["missing key ",r[0],r.length>1?` +${r.length-1} more`:""]})]})}function I3({candidates:n,onOpen:a}){return f.jsxs("div",{className:"mt-5 border-t border-[#cbd8c8] pt-4",children:[f.jsx("p",{className:"text-[11px] font-semibold text-[#687062]",children:"Screener"}),f.jsxs("div",{className:"mt-2 space-y-2",children:[n.slice(0,5).map(s=>f.jsxs("button",{type:"button",onClick:()=>a(s.messageId),className:"block w-full rounded border border-[#cbd8c8] bg-[#fbfdf8] px-3 py-2 text-left hover:border-[#9fb8a7]",children:[f.jsx("p",{className:"truncate text-xs font-semibold text-[#172018]",children:s.senderEmail}),f.jsx("p",{className:"mt-1 truncate text-xs text-[#687062]",children:s.trustReason})]},s.id)),n.length===0&&f.jsx("p",{className:"text-xs text-[#687062]",children:"No pending senders."})]})]})}function eC({entries:n}){return f.jsxs("div",{className:"mt-5 border-t border-[#cbd8c8] pt-4",children:[f.jsx("p",{className:"text-[11px] font-semibold text-[#687062]",children:"Access audit"}),f.jsxs("div",{className:"mt-2 space-y-2",children:[n.slice(0,4).map(a=>f.jsxs("div",{className:"text-xs leading-4 text-[#687062]",children:[f.jsx("p",{className:"truncate font-medium text-[#3f4b42]",children:a.tool}),f.jsx("p",{className:"truncate",children:X3(a)}),f.jsx("p",{className:"truncate",children:a.reason})]},a.id)),n.length===0&&f.jsx("p",{className:"text-xs text-[#687062]",children:"No reads yet."})]})]})}function tC({message:n,selected:a,onSelect:s}){return f.jsxs("button",{type:"button",onClick:s,className:`block w-full border-b border-[#d8e2d4] px-4 py-3 text-left transition-colors ${a?"bg-[#eaf4ee]":"hover:bg-[#eef4ec]"}`,children:[f.jsxs("div",{className:"flex items-start justify-between gap-3",children:[f.jsx("p",{className:"min-w-0 truncate text-sm font-semibold text-[#172018]",children:pl(n.from)}),f.jsx("span",{className:"shrink-0 text-xs tabular-nums text-[#687062]",children:et(n.receivedAt)})]}),f.jsx("p",{className:"mt-1 truncate text-sm text-[#26352a]",children:Yb(n)}),f.jsx("p",{className:"mt-1 line-clamp-2 text-xs leading-5 text-[#687062]",children:pt(n.snippet,150)}),f.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[f.jsx("span",{className:`rounded px-2 py-0.5 text-[11px] ring-1 ${oh(n.placement)}`,children:n.placement}),f.jsx("span",{className:"truncate text-[11px] text-[#687062]",children:Gb(n)})]})]})}function nC({record:n}){const a=n.deliveryEvents[n.deliveryEvents.length-1];return f.jsxs("div",{className:"border-b border-[#d8e2d4] px-4 py-3",children:[f.jsxs("div",{className:"flex items-start justify-between gap-3",children:[f.jsx("p",{className:"min-w-0 truncate text-sm font-semibold text-[#172018]",children:n.subject||"(no subject)"}),f.jsx("span",{className:`shrink-0 rounded px-2 py-0.5 text-[11px] ring-1 ${oh(n.status)}`,children:n.status})]}),f.jsxs("p",{className:"mt-1 truncate text-xs text-[#536157]",children:["to ",pl(n.to)]}),f.jsxs("p",{className:"mt-1 text-xs text-[#687062]",children:[F3(n)," · ",et(Z3(n))]}),f.jsxs("p",{className:"mt-1 truncate text-xs text-[#687062]",children:[K3(n)," · ",n.sendMode??"mode unknown",n.policyDecision?` · policy ${n.policyDecision.code} / ${n.policyDecision.fallback}`:""]}),(n.providerMessageId||n.providerRequestId)&&f.jsxs("p",{className:"mt-1 truncate text-xs text-[#687062]",children:["provider ",n.providerMessageId??"unknown",n.providerRequestId?` · request ${n.providerRequestId}`:""]}),a&&f.jsx("p",{className:"mt-1 line-clamp-2 text-xs leading-5 text-[#687062]",children:a.bodySafeSummary})]})}function aC({detail:n}){const a=n.message;return f.jsxs("article",{className:"min-h-[66vh]",children:[f.jsxs("header",{className:"border-b border-[#cbd8c8] bg-[#fbfdf8] px-6 py-5",children:[f.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[f.jsx("h2",{className:"min-w-0 text-xl font-semibold leading-tight text-[#172018]",children:Yb(a)}),f.jsx("span",{className:`rounded px-2 py-0.5 text-xs ring-1 ${oh(a.placement)}`,children:a.placement})]}),f.jsxs("div",{className:"mt-4 grid gap-1 text-sm text-[#536157]",children:[f.jsxs("p",{children:[f.jsx("span",{className:"font-medium text-[#172018]",children:"From:"})," ",pl(a.from)]}),f.jsxs("p",{children:[f.jsx("span",{className:"font-medium text-[#172018]",children:"To:"})," ",pl(a.to)]}),a.cc.length>0&&f.jsxs("p",{children:[f.jsx("span",{className:"font-medium text-[#172018]",children:"Cc:"})," ",pl(a.cc)]}),f.jsxs("p",{children:[f.jsx("span",{className:"font-medium text-[#172018]",children:"Received:"})," ",new Date(a.receivedAt).toLocaleString()]}),f.jsxs("p",{children:[f.jsx("span",{className:"font-medium text-[#172018]",children:"Provenance:"})," ",Gb(a)]})]})]}),f.jsx("div",{className:"border-b border-[#f0d0bd] bg-[#fff4e4] px-6 py-3 text-sm text-[#8a4a18]",children:a.untrustedContentWarning}),f.jsxs("div",{className:"px-6 py-6",children:[f.jsx("pre",{className:"whitespace-pre-wrap break-words font-body text-sm leading-7 text-[#26352a]",children:a.text||"(no text body)"}),a.bodyTruncated&&f.jsx("p",{className:"mt-4 text-xs text-[#687062]",children:"Body truncated in Mailbox."}),f.jsxs("div",{className:"mt-6 grid gap-3 border-t border-[#cbd8c8] pt-4 text-xs text-[#687062] md:grid-cols-2",children:[f.jsxs("p",{children:[f.jsx("span",{className:"font-medium text-[#172018]",children:"Read reason:"})," ",a.access.reason]}),f.jsxs("p",{children:[f.jsx("span",{className:"font-medium text-[#172018]",children:"Read at:"})," ",new Date(a.access.accessedAt).toLocaleString()]})]}),a.attachments.length>0&&f.jsxs("div",{className:"mt-6 border-t border-[#cbd8c8] pt-4",children:[f.jsx("p",{className:"text-xs font-semibold text-[#687062]",children:"Attachments"}),f.jsx("div",{className:"mt-2 space-y-2",children:a.attachments.map(s=>f.jsxs("div",{className:"rounded border border-[#cbd8c8] bg-[#fbfdf8] px-3 py-2 text-sm text-[#3f4b42]",children:[s.filename," · ",s.contentType," · ",s.size.toLocaleString()," bytes"]},`${s.filename}-${s.size}`))})]})]})]})}function iC(){return f.jsx("div",{className:"grid min-h-[54vh] place-items-center p-8 text-center",children:f.jsxs("div",{children:[f.jsx("p",{className:"text-sm font-semibold text-[#172018]",children:"No message selected"}),f.jsx("p",{className:"mt-2 text-sm text-[#687062]",children:"Reading pane idle."})]})})}function tx({label:n}){return f.jsxs("div",{className:"flex items-center gap-2 p-6",children:[f.jsx("div",{className:"h-2 w-2 animate-pulse rounded-full bg-[#2f8f4e]"}),f.jsxs("span",{className:"text-xs text-[#687062]",children:[n,"..."]})]})}function jd(n){const a=n.function.name,s=sC(n.function.arguments);return a==="settle"?{kind:"response",name:a,id:n.id,deliveredText:s.answer??null,delegatedThought:null,metadata:s.intent??null,rawArgs:null}:a==="ponder"?{kind:"delegation",name:a,id:n.id,deliveredText:s.say??null,delegatedThought:s.thought??null,metadata:null,rawArgs:null}:a==="rest"?{kind:"rest",name:a,id:n.id,deliveredText:null,delegatedThought:null,metadata:null,rawArgs:null}:a==="observe"?{kind:"observe",name:a,id:n.id,deliveredText:null,delegatedThought:null,metadata:s.reason??null,rawArgs:null}:a==="surface"?{kind:"surface",name:a,id:n.id,deliveredText:s.content??null,delegatedThought:null,metadata:s.delegationId??s.friendId??null,rawArgs:null}:{kind:"action",name:a,id:n.id,deliveredText:null,delegatedThought:null,metadata:null,rawArgs:n.function.arguments}}function sC(n){try{const a=JSON.parse(n);if(a&&typeof a=="object")return a}catch{}return{}}const lC=48;function rC(n){return n.scrollHeight-n.scrollTop-n.clientHeight<=lC}function Xb(n){const a=T.useRef(null),s=T.useRef(!0),r=T.useCallback(()=>{const d=a.current;d&&(s.current=rC(d))},[]),o=T.useCallback(()=>{s.current=!1},[]);return T.useEffect(()=>{const d=a.current;!d||!s.current||(d.scrollTop=d.scrollHeight)},[n]),{ref:a,onScroll:r,preserveScroll:o}}function oC(n){return typeof n=="string"?n:Array.isArray(n)?n.map(a=>a.type==="text"&&typeof a.text=="string"?a.text:"").filter(a=>a.length>0).join(""):""}function Ml(n){return oC(n.content)}function Kb(n){return n.time.authoredAt??n.time.observedAt??n.time.recordedAt}const nx={"needs-reply":{color:"red",label:"needs reply"},"on-hold":{color:"yellow",label:"on hold"},monitoring:{color:"zinc",label:"monitoring"},idle:{color:"zinc",label:"idle"}};function Fb(n){return n==="bluebubbles"?"iMessage":n==="teams"?"Teams":n==="cli"?"CLI":n==="mail"?"Mail":n}function uC(n){return n==="bluebubbles"?"imessage":n==="teams"?"teams":n==="cli"?"terminal":"default"}function cC(n){return n==="imessage"?"overflow-hidden rounded-xl bg-[#f5f5f7] text-[#1d1d1f] ring-1 ring-black/10":n==="teams"?"overflow-hidden rounded-xl bg-[#f7f5ff] text-[#242424] ring-1 ring-[#d8d1ff]":n==="terminal"?"overflow-hidden rounded-lg bg-[#050807] font-mono text-[#d1fae5] ring-1 ring-[#1f3a2c]":"overflow-hidden rounded-lg bg-ouro-void/60 text-ouro-bone ring-1 ring-ouro-moss/15"}function fC(n){return n==="imessage"?"border-b border-black/10 bg-[#fbfbfd] px-4 py-3 text-center":n==="teams"?"border-b border-[#d8d1ff] bg-[#4f3bb3] px-4 py-3 text-white":n==="terminal"?"border-b border-[#1f3a2c] bg-[#101815] px-4 py-2 text-[#86efac]":"border-b border-ouro-moss/15 px-4 py-3"}function dC(n){return n==="imessage"?"max-w-[85%] sm:max-w-[75%] rounded-2xl rounded-bl-md bg-[#e9e9eb] px-3.5 py-2 text-[#1d1d1f]":n==="teams"?"max-w-[85%] sm:max-w-[75%] rounded-md bg-white px-3.5 py-2 text-[#242424] shadow-sm ring-1 ring-[#e5e5e5]":n==="terminal"?"max-w-full rounded-none border-l-2 border-[#60a5fa] bg-transparent px-3 py-2 text-[#dbeafe]":"max-w-[85%] sm:max-w-[75%] rounded-2xl rounded-bl-sm bg-ouro-moss/25 px-3.5 py-2 ring-1 ring-ouro-moss/15"}function io(n,a="normal"){return n==="imessage"?"max-w-[85%] sm:max-w-[75%] rounded-2xl rounded-br-md bg-[#0a84ff] px-3.5 py-2 text-white":n==="teams"?"max-w-[85%] sm:max-w-[75%] rounded-md bg-[#ede9fe] px-3.5 py-2 text-[#242424] shadow-sm ring-1 ring-[#c4b5fd]":n==="terminal"?"max-w-full rounded-none border-l-2 border-[#22c55e] bg-transparent px-3 py-2 text-[#bbf7d0]":a==="surface"?"max-w-[85%] sm:max-w-[75%] rounded-2xl rounded-br-sm bg-ouro-scale/12 px-3.5 py-2 ring-1 ring-ouro-scale/15":"max-w-[85%] sm:max-w-[75%] rounded-2xl rounded-br-sm bg-ouro-glow/8 px-3.5 py-2 ring-1 ring-ouro-glow/12"}function sl(n,a){return n==="imessage"?a==="agent"?"font-mono text-[9px] text-white/70":"font-mono text-[9px] text-[#6b7280]":n==="teams"?"font-mono text-[9px] uppercase tracking-wider text-[#5b5fc7]":n==="terminal"?a==="agent"?"font-mono text-[11px] text-[#22c55e]":"font-mono text-[11px] text-[#60a5fa]":a==="surface"||a==="agent"?"font-mono text-[9px] uppercase tracking-wider text-ouro-glow/70":"font-mono text-[9px] uppercase tracking-wider text-ouro-gold/70"}function ll(n,a="agent"){return n==="imessage"?"text-sm leading-relaxed whitespace-pre-wrap break-words":n==="teams"?"text-sm leading-relaxed text-[#242424] whitespace-pre-wrap break-words":n==="terminal"?`font-mono text-[12px] leading-6 whitespace-pre-wrap break-words ${a==="agent"?"text-[#bbf7d0]":"text-[#dbeafe]"}`:"text-sm leading-relaxed text-ouro-bone whitespace-pre-wrap break-words"}function hC(n){return Kb(n)}function Xi(n){return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(hC(n)))}function mC({agentName:n,focus:a,onFocusConsumed:s,deskPrefs:r,refreshGeneration:o}){Pi();const[d,h]=T.useState(null),[p,m]=T.useState(null),[g,x]=T.useState(null),[y,S]=T.useState(!1),w=T.useRef(null);T.useEffect(()=>{_e(`/agents/${encodeURIComponent(n)}/sessions`).then(h)},[n,o]),T.useEffect(()=>{a&&(w.current=null,m(a),x(null),S(!0),s==null||s())},[n,a,s]),T.useEffect(()=>{if(!p)return;const k=`${p}:${o}`;if(w.current===k)return;w.current=k,S(!0);const[U,P,F]=p.split("/");_e(`/agents/${encodeURIComponent(n)}/sessions/${encodeURIComponent(U)}/${encodeURIComponent(P)}/${encodeURIComponent(F)}`).then(x).catch(()=>x(null)).finally(()=>S(!1))},[n,p,o,a]);function j(k){if(p===k){m(null),x(null),w.current=null;return}m(k),x(null),S(!0)}const E=new Set((r==null?void 0:r.starredFriends)??[]);if(!d)return f.jsx(Zb,{label:"Loading sessions"});const C=new Map;for(const k of d.items)C.has(k.friendId)||C.set(k.friendId,[]),C.get(k.friendId).push(k);const z=[...C.entries()].sort((k,U)=>{const P=E.has(k[0])?0:1,F=E.has(U[0])?0:1;return P!==F?P-F:U[1].length-k[1].length}),D=[],R=new Map;for(const[k,U]of z)R.set(D.length,{name:U[0].friendName,channels:U.length,starred:E.has(k)}),D.push(...U);return f.jsxs("div",{className:"space-y-3",children:[f.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:[d.totalCount," sessions · ",d.activeCount," active · ",d.staleCount," stale"]}),f.jsx("div",{className:"space-y-1.5",children:D.map((k,U)=>{var Se;const P=R.get(U),F=E.has(k.friendId),W=`${k.friendId}/${k.channel}/${k.key}`,re=p===W,B=nx[k.replyState]??nx.idle,Z=((Se=k.lastUsage)==null?void 0:Se.total_tokens)??k.estimatedTokens??0,le=Z>0?Math.min(100,Math.round(Z/8e4*100)):0;return f.jsxs("div",{children:[P&&P.channels>1&&f.jsxs("div",{className:"flex items-center gap-2 pt-3 pb-1",children:[P.starred&&f.jsx("span",{className:"text-ouro-gold text-sm",children:"★"}),f.jsx("span",{className:"font-medium text-ouro-bone text-sm",children:P.name}),f.jsxs("span",{className:"text-xs text-ouro-shadow",children:[P.channels," channels"]})]}),f.jsxs("button",{onClick:()=>j(W),className:`flex w-full flex-col gap-1.5 rounded-lg px-3 py-3 text-left transition-colors ring-1 ${re?"bg-ouro-moss/15 ring-ouro-glow/20":"ring-ouro-moss/15 hover:bg-ouro-moss/8"}`,children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[F&&f.jsx("span",{className:"text-ouro-gold",title:"Starred",children:"★"}),f.jsx("span",{className:"truncate font-medium text-ouro-bone",children:k.friendName}),f.jsxs("span",{className:"shrink-0 text-xs text-ouro-shadow",children:["via ",Fb(k.channel)]}),f.jsx(xe,{color:B.color,children:B.label})]}),f.jsx("span",{className:"shrink-0 text-xs tabular-nums text-ouro-shadow",children:et(k.lastActivityAt)})]}),k.latestUserExcerpt&&f.jsxs("p",{className:"truncate text-xs text-ouro-gold/70",children:[f.jsx("span",{className:"font-mono text-[9px] uppercase tracking-wider",children:"in:"})," ",pt(k.latestUserExcerpt,100)]}),k.latestAssistantExcerpt&&f.jsxs("p",{className:"truncate text-xs text-ouro-glow/60",children:[f.jsx("span",{className:"font-mono text-[9px] uppercase tracking-wider",children:"out:"})," ",pt(k.latestAssistantExcerpt,100)]}),f.jsxs("div",{className:"flex items-center gap-3 text-xs text-ouro-shadow",children:[f.jsxs("span",{className:"tabular-nums",children:[k.messageCount," msgs"]}),k.lastUsage&&f.jsxs("span",{className:"tabular-nums",children:[k.lastUsage.total_tokens.toLocaleString()," tok"]}),le>0&&f.jsxs("div",{className:"flex items-center gap-1.5 flex-1 max-w-32",title:"Context pressure — steady state oscillates between 80-100%",children:[f.jsx("div",{className:"h-1 flex-1 rounded-full bg-ouro-moss/20",children:f.jsx("div",{className:`h-1 rounded-full transition-all ${le>100?"bg-ouro-fang":le>80?"bg-ouro-gold":"bg-ouro-glow"}`,style:{width:`${Math.min(100,le)}%`}})}),f.jsxs("span",{className:"tabular-nums text-[10px]",children:[le,"%"]})]})]})]}),re&&f.jsx(pC,{loading:y,transcript:g})]},W)})})]})}function pC({loading:n,transcript:a}){var d;const s=((d=a==null?void 0:a.messages[a.messages.length-1])==null?void 0:d.id)??null,{ref:r,onScroll:o}=Xb(s);return f.jsxs("div",{ref:r,"data-testid":"session-transcript-scroll",onScroll:o,className:"mt-1 max-h-[70vh] overflow-y-auto rounded-lg",children:[n&&!a&&f.jsx(Zb,{label:"Loading transcript"}),a&&f.jsx(gC,{transcript:a})]})}function gC({transcript:n}){const{messages:a,lastUsage:s}=n,r=uC(n.channel),o=a.filter(g=>g.role==="system"),d=a.filter(g=>g.role!=="system"),[h,p]=T.useState(!1),m=new Map;for(const g of d)g.role==="tool"&&g.toolCallId&&m.set(g.toolCallId,g);return f.jsxs("div",{className:cC(r),children:[f.jsxs("div",{className:fC(r),children:[f.jsx("p",{className:r==="terminal"?"font-mono text-xs":"text-sm font-semibold",children:Fb(n.channel)}),f.jsxs("p",{className:r==="terminal"?"mt-0.5 font-mono text-[10px] text-[#6ee7b7]":"mt-0.5 text-xs opacity-70",children:[n.friendName," · ",n.messageCount," messages"]})]}),f.jsxs("div",{className:"space-y-0.5 p-3",children:[s&&f.jsxs("p",{className:r==="terminal"?"pb-2 font-mono text-[10px] text-[#6ee7b7]":"pb-2 font-mono text-[10px] opacity-60",children:[s.input_tokens.toLocaleString()," in · ",s.output_tokens.toLocaleString()," out · ",s.total_tokens.toLocaleString()," total"]}),o.length>0&&f.jsxs("div",{className:"pb-2 mb-2 border-b border-current/10",children:[f.jsxs("button",{onClick:()=>p(!h),className:"font-mono text-[10px] uppercase tracking-wider opacity-60 transition-opacity hover:opacity-90",children:[h?"▼":"▶"," system context (",o.length,")"]}),h&&o.map(g=>f.jsxs("div",{className:"mt-2 max-h-60 overflow-y-auto rounded bg-black/5 p-2 text-xs opacity-75 whitespace-pre-wrap break-words",children:[f.jsx("p",{className:"mb-1 font-mono text-[9px] opacity-70",children:Xi(g)}),Ml(g)]},g.id))]}),d.map(g=>g.role==="tool"?null:g.role==="user"?f.jsx(vC,{msg:g,surface:r},g.id):g.role==="assistant"?f.jsx(xC,{msg:g,toolResults:m,surface:r},g.id):null)]})]})}function vC({msg:n,surface:a}){const s=Ml(n);return f.jsx("div",{className:"flex justify-start py-1",children:f.jsxs("div",{className:dC(a),children:[f.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[f.jsx("p",{className:sl(a,"user"),children:a==="terminal"?"human $":"user"}),f.jsxs("span",{className:"font-mono text-[9px] text-ouro-shadow/40",children:["#",n.sequence]}),f.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:Xi(n)})]}),f.jsx("p",{className:ll(a,"user"),children:s})]})})}function xC({msg:n,toolResults:a,surface:s}){const r=Ml(n),o=(n.toolCalls??[]).map(jd),d=o.filter(m=>m.kind!=="action"),h=o.filter(m=>m.kind==="action"),p=[];for(const m of d)m.kind==="response"?p.push(f.jsx("div",{className:"flex justify-end py-1",children:f.jsxs("div",{className:io(s),children:[f.jsxs("div",{className:"mb-0.5 flex items-center gap-2",children:[f.jsx("p",{className:sl(s,"agent"),children:s==="terminal"?"agent >":"agent"}),f.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:Xi(n)})]}),f.jsx("p",{className:ll(s),children:m.deliveredText}),m.metadata&&m.metadata!=="complete"&&f.jsxs("p",{className:"mt-1 font-mono text-[9px] text-ouro-shadow",children:["intent: ",m.metadata]})]})},m.id)):m.kind==="delegation"?p.push(f.jsx("div",{className:"flex justify-end py-1",children:f.jsxs("div",{className:io(s),children:[f.jsxs("div",{className:"mb-0.5 flex items-center gap-2",children:[f.jsx("p",{className:sl(s,"agent"),children:s==="terminal"?"agent >":"agent"}),f.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:Xi(n)})]}),m.deliveredText&&f.jsx("p",{className:ll(s),children:m.deliveredText}),m.delegatedThought&&f.jsxs("div",{className:"mt-2 rounded bg-black/10 px-2.5 py-1.5 ring-1 ring-current/10",children:[f.jsx("p",{className:"font-mono text-[9px] uppercase tracking-wider opacity-70",children:"→ inner dialog"}),f.jsx("p",{className:"mt-0.5 text-xs opacity-80",children:m.delegatedThought})]})]})},m.id)):m.kind==="surface"?p.push(f.jsx("div",{className:"flex justify-end py-1",children:f.jsxs("div",{className:io(s,"surface"),children:[f.jsxs("div",{className:"mb-0.5 flex items-center gap-2",children:[f.jsx("p",{className:sl(s,"surface"),children:"surfaced"}),f.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:Xi(n)})]}),f.jsx("p",{className:ll(s),children:m.deliveredText}),m.metadata&&f.jsxs("p",{className:"mt-1 font-mono text-[9px] text-ouro-shadow",children:["→ ",m.metadata]})]})},m.id)):m.kind==="rest"?p.push(f.jsx("div",{className:"py-1 text-center font-mono text-[10px] text-ouro-shadow/50",children:"— resting —"},m.id)):m.kind==="observe"&&p.push(f.jsxs("div",{className:"py-1 text-center font-mono text-[10px] text-ouro-shadow/50",children:["— observed",m.metadata?`: ${m.metadata}`:""," —"]},m.id));return r&&d.length===0&&p.push(f.jsx("div",{className:"flex justify-end py-1",children:f.jsxs("div",{className:io(s),children:[f.jsxs("div",{className:"mb-0.5 flex items-center gap-2",children:[f.jsx("p",{className:sl(s,"agent"),children:s==="terminal"?"agent >":"agent"}),f.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:Xi(n)})]}),f.jsx("p",{className:ll(s),children:r})]})},`${n.id}-content`)),h.length>0&&p.push(f.jsx("div",{className:"flex justify-end py-1",children:f.jsx("div",{className:"max-w-[85%] sm:max-w-[75%] space-y-1",children:h.map(m=>f.jsx(yC,{call:m,result:a.get(m.id),surface:s},m.id))})},`${n.id}-tools`)),f.jsx(f.Fragment,{children:p})}function yC({call:n,result:a,surface:s}){const[r,o]=T.useState(!1),d=a?Ml(a):null;return f.jsxs("button",{onClick:()=>o(!r),className:`w-full text-left rounded px-2.5 py-1.5 text-sm transition-colors ${s==="terminal"?"bg-[#0f1a15] font-mono text-[#bbf7d0] ring-1 ring-[#1f3a2c] hover:ring-[#22c55e]/40":s==="teams"?"bg-white text-[#242424] ring-1 ring-[#d8d1ff] hover:ring-[#5b5fc7]/40":s==="imessage"?"bg-white text-[#1d1d1f] ring-1 ring-black/10 hover:ring-[#0a84ff]/30":"bg-ouro-moss/10 ring-1 ring-ouro-moss/12 hover:ring-ouro-glow/15"}`,children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{className:"font-mono text-xs text-ouro-glow",children:n.name}),!r&&f.jsx("span",{className:"text-[10px] text-ouro-shadow",children:"tap to inspect"})]}),r&&f.jsxs(f.Fragment,{children:[n.rawArgs&&f.jsx("pre",{className:"mt-1.5 max-h-24 overflow-y-auto rounded bg-ouro-void/40 p-1.5 font-mono text-[11px] text-ouro-shadow whitespace-pre-wrap break-words",children:n.rawArgs}),a&&f.jsxs("div",{className:"mt-1.5 border-t border-ouro-moss/15 pt-1.5",children:[f.jsx(xe,{children:"result"}),f.jsx("pre",{className:"mt-1 max-h-32 overflow-y-auto rounded bg-ouro-void/40 p-1.5 font-mono text-[11px] text-ouro-mist whitespace-pre-wrap break-words",children:d})]})]})]})}function Zb({label:n}){return f.jsxs("div",{className:"flex items-center gap-2 py-6",children:[f.jsx("div",{className:"h-2 w-2 animate-pulse rounded-full bg-ouro-glow"}),f.jsxs("span",{className:"font-mono text-xs text-ouro-shadow",children:[n,"…"]})]})}function bC({agentName:n,view:a,focus:s,onFocusConsumed:r,refreshGeneration:o}){var R,k;const d=Pi(),[h,p]=T.useState(null),[m,g]=T.useState(null),[x,y]=T.useState(null),S=a.work,w=S.obligations,j=S.tasks;T.useEffect(()=>{_e(`/agents/${encodeURIComponent(n)}/coding`).then(p),_e(`/agents/${encodeURIComponent(n)}/obligations`).then(g).catch(()=>{}),_e(`/agents/${encodeURIComponent(n)}/self-fix`).then(y).catch(()=>{})},[n,o]);const E=(m==null?void 0:m.items)??w.items,C=(m==null?void 0:m.openCount)??w.openCount,z=(h==null?void 0:h.items)??[],D=new Map;for(const U of z){const P=U.obligationId;if(P){const F=D.get(P);F?F.push(U):D.set(P,[U])}}return f.jsxs("div",{className:"space-y-8",children:[f.jsxs("section",{children:[f.jsx(so,{label:`Obligations (${C} open)`}),(m==null?void 0:m.primarySelectionReason)&&f.jsxs("p",{className:"mt-1 text-xs text-ouro-shadow",children:["Primary: ",m.primarySelectionReason]}),E.length>0?f.jsx("div",{className:"mt-3 space-y-3",children:E.map(U=>{const P=D.get(U.id)??[],F=SC(U)?U:null,W=(F==null?void 0:F.isPrimary)??!1,re=(F==null?void 0:F.meaning)??null,B=U.origin;return f.jsxs("div",{className:`rounded-lg px-3 py-3 ring-1 ${W?"bg-ouro-glow/5 ring-ouro-glow/20":"bg-ouro-void/40 ring-ouro-moss/15"}`,children:[f.jsxs("div",{className:"flex items-start gap-2",children:[W&&f.jsx(xe,{color:"lime",children:"primary"}),f.jsx(xe,{color:U.status==="pending"?"yellow":U.status==="fulfilled"?"lime":"zinc",children:U.status}),f.jsx("span",{className:"text-sm font-medium text-ouro-bone",children:pt(U.content,120)})]}),B&&f.jsxs("button",{onClick:()=>d({tab:"sessions",focus:`${B.friendId}/${B.channel}/${B.key}`}),className:"mt-2 flex w-full items-center gap-2 rounded-md bg-ouro-moss/8 px-2.5 py-1.5 text-left text-xs ring-1 ring-ouro-moss/10 hover:ring-ouro-glow/20 transition-colors",children:[f.jsx("span",{className:"text-ouro-shadow",children:"from"}),f.jsx("span",{className:"font-medium text-ouro-glow",children:B.channel}),f.jsx("span",{className:"text-ouro-shadow",children:"→"}),f.jsx("span",{className:"text-ouro-mist truncate",children:B.key}),f.jsx("span",{className:"ml-auto text-ouro-shadow",children:"open session →"})]}),U.currentSurface&&f.jsxs("div",{className:"mt-1 text-xs text-ouro-mist",children:["surface: ",f.jsx("span",{className:"text-ouro-bone",children:U.currentSurface.kind})," — ",U.currentSurface.label]}),(re==null?void 0:re.waitingOn)&&f.jsxs("p",{className:"mt-1 text-xs text-ouro-shadow",children:["Waiting on: ",re.waitingOn]}),P.length>0&&f.jsxs("div",{className:"mt-2 space-y-1",children:[f.jsx("p",{className:"font-mono text-[9px] uppercase tracking-wider text-ouro-shadow",children:"Linked coding"}),P.map(Z=>f.jsxs("div",{className:"flex items-center gap-2 rounded bg-ouro-moss/10 px-2 py-1 text-xs",children:[f.jsx(xe,{color:Z.status==="failed"?"red":Z.status==="running"?"lime":"zinc",children:Z.status}),f.jsxs("span",{className:"text-ouro-mist truncate",children:[Z.runner," — ",Z.workdir]})]},Z.id))]}),U.nextAction&&f.jsxs("p",{className:"mt-1.5 text-xs text-ouro-mist",children:["Next: ",U.nextAction]}),f.jsx("p",{className:"mt-1 text-xs text-ouro-shadow",children:et(U.updatedAt)})]},U.id)})}):f.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No open obligations."})]}),x&&x.steps.length>0&&f.jsxs("section",{children:[f.jsx(so,{label:`Self-fix ${x.active?"(active)":"(inactive)"}`}),x.currentStep&&f.jsxs("p",{className:"mt-1 text-xs text-ouro-glow",children:["Current: ",x.currentStep]}),f.jsx("div",{className:"mt-3 space-y-1.5",children:x.steps.map((U,P)=>f.jsxs("div",{className:`flex items-center gap-2.5 rounded-lg px-3 py-2 ring-1 ${U.status==="active"?"bg-ouro-glow/5 ring-ouro-glow/20":U.status==="done"?"bg-ouro-void/40 ring-ouro-glow/10":"bg-ouro-void/40 ring-ouro-moss/10"}`,children:[f.jsx(xe,{color:U.status==="done"?"lime":U.status==="active"?"yellow":(U.status==="skipped","zinc"),children:U.status}),f.jsx("span",{className:`text-sm ${U.status==="active"?"font-medium text-ouro-bone":"text-ouro-mist"}`,children:U.label}),U.detail&&f.jsx("span",{className:"ml-auto text-xs text-ouro-shadow",children:U.detail})]},P))})]}),f.jsxs("section",{children:[f.jsx(so,{label:`Coding lanes (${z.length})`}),z.length>0?f.jsx("div",{className:"mt-3 space-y-2",children:z.map(U=>{const P=U.status,F=P==="failed",W=U.failure,re=U.obligationId,B=U.originSession;return f.jsxs("div",{className:"rounded-lg bg-ouro-void/40 px-3 py-3 ring-1 ring-ouro-moss/15",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(xe,{color:F?"red":P==="running"?"lime":P==="completed"?"zinc":"yellow",children:P}),f.jsx("span",{className:"text-sm font-medium text-ouro-bone",children:U.runner}),f.jsx("span",{className:"truncate text-xs text-ouro-shadow",children:U.workdir})]}),f.jsxs("div",{className:"mt-1 flex flex-wrap gap-2",children:[re&&f.jsxs("button",{onClick:()=>d({tab:"work",focus:re}),className:"text-xs text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2 hover:decoration-ouro-glow",children:["obligation: ",re.slice(0,20),"…"]}),U.taskRef&&f.jsxs("span",{className:"text-xs text-ouro-glow",children:["task: ",U.taskRef]}),B&&f.jsx("button",{onClick:()=>{d({tab:"sessions",focus:`${B.friendId}/${B.channel}/${B.key}`})},className:"text-xs text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2 hover:decoration-ouro-glow",children:"origin session"})]}),U.checkpoint&&f.jsx("p",{className:"mt-1.5 text-xs text-ouro-mist",children:pt(U.checkpoint,100)}),f.jsxs("p",{className:"mt-1 text-xs text-ouro-shadow",children:["pid ",U.pid??"–"," · restarts ",U.restartCount," · ",et(U.lastActivityAt)]}),F&&W&&f.jsxs("div",{className:"mt-2 rounded bg-ouro-fang/5 p-2 text-xs ring-1 ring-ouro-fang/15",children:[f.jsx("span",{className:"font-semibold text-ouro-fang",children:"FAILURE:"})," ",f.jsxs("span",{className:"text-ouro-mist",children:[W.command," exited ",String(W.code??W.signal)]}),W.stderrTail&&f.jsx("pre",{className:"mt-1 max-h-20 overflow-y-auto font-mono text-[11px] text-ouro-shadow whitespace-pre-wrap",children:W.stderrTail})]})]},U.id)})}):f.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No coding sessions."})]}),f.jsxs("section",{children:[f.jsx(so,{label:`Tasks (${j.liveCount} live, ${j.blockedCount} blocked)`}),((R=j.liveTaskNames)==null?void 0:R.length)>0?f.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:j.liveTaskNames.map(U=>f.jsx(xe,{children:U},U))}):f.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No live tasks."}),((k=j.actionRequired)==null?void 0:k.length)>0&&f.jsxs("div",{className:"mt-3",children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-ouro-fang",children:"Action required"}),f.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:j.actionRequired.map(U=>f.jsx(xe,{color:"red",children:U},U))})]})]})]})}function so({label:n}){return f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:n})}function SC(n){return"isPrimary"in n}function wC({agentName:n,focus:a,onFocusConsumed:s,refreshGeneration:r}){const o=Pi(),[d,h]=T.useState(null),[p,m]=T.useState(null),[g,x]=T.useState(null);T.useEffect(()=>{const j=`/agents/${encodeURIComponent(n)}`;Promise.all([_e(`${j}/attention`).then(h),_e(`${j}/bridges`).then(m),_e(`${j}/friends`).then(x)])},[n,r]);const y=(d==null?void 0:d.queueItems)??[],S=(p==null?void 0:p.items)??[],w=(g==null?void 0:g.friends)??[];return f.jsxs("div",{className:"space-y-8",children:[f.jsxs("section",{children:[f.jsx(Uf,{label:`Who is waiting (${(d==null?void 0:d.queueLength)??0})`}),y.length>0?f.jsx("div",{className:"mt-3 space-y-2",children:y.map((j,E)=>{const C=j.bridgeId,z=j.obligationId;return f.jsxs("div",{className:"rounded-lg bg-ouro-void/40 px-3 py-3 ring-1 ring-ouro-moss/15",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("button",{onClick:()=>o({tab:"sessions"}),className:"font-medium text-ouro-bone hover:text-ouro-glow transition-colors",children:j.friendName}),f.jsxs("span",{className:"text-xs text-ouro-shadow",children:["via ",j.channel]}),f.jsxs(xe,{color:"yellow",children:["waiting ",et(new Date(j.timestamp).toISOString())]})]}),f.jsx("p",{className:"mt-1 text-sm text-ouro-mist",children:pt(j.delegatedContent,140)}),f.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-2 text-xs",children:[C&&f.jsxs("button",{onClick:()=>o({tab:"connections",focus:C}),className:"text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2 hover:decoration-ouro-glow",children:["bridge: ",C.slice(0,12),"…"]}),z&&f.jsxs("button",{onClick:()=>o({tab:"work",focus:z}),className:"text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2 hover:decoration-ouro-glow",children:["obligation: ",z.slice(0,16),"…"]})]})]},E)})}):f.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"Nobody waiting."})]}),f.jsxs("section",{children:[f.jsx(Uf,{label:`Bridges (${(p==null?void 0:p.totalCount)??0})`}),S.length>0?f.jsx("div",{className:"mt-3 space-y-3",children:S.map(j=>{const E=j.attachedSessions,C=j.task,z=j.lifecycle==="active";return f.jsxs("div",{className:`rounded-lg px-3 py-3 ring-1 ${z?"bg-ouro-moss/10 ring-ouro-glow/12":"bg-ouro-void/40 ring-ouro-moss/15"}`,children:[f.jsxs("div",{className:"flex items-start gap-2",children:[f.jsx(xe,{color:z?"lime":"zinc",children:j.lifecycle}),f.jsx("p",{className:"font-medium text-ouro-bone",children:j.objective})]}),j.summary&&f.jsx("p",{className:"mt-1 text-sm text-ouro-mist",children:pt(j.summary,160)}),E.length>0&&f.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:E.map((D,R)=>f.jsxs("button",{onClick:()=>o({tab:"sessions",focus:`${D.friendId}/${D.channel}/${D.key}`}),className:"rounded-md bg-ouro-moss/10 px-2 py-0.5 font-mono text-[11px] text-ouro-glow ring-1 ring-ouro-moss/12 hover:ring-ouro-glow/25 transition-colors",children:[D.friendId,"/",D.channel,"/",D.key]},R))}),C&&f.jsxs("p",{className:"mt-1.5 text-xs",children:[f.jsxs("button",{onClick:()=>o({tab:"work"}),className:"text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2 hover:decoration-ouro-glow",children:["task: ",C.taskName]}),f.jsxs("span",{className:"text-ouro-shadow",children:[" (",C.mode,")"]})]}),f.jsx("p",{className:"mt-1 text-xs text-ouro-shadow",children:et(j.updatedAt)})]},j.id)})}):f.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No bridges."})]}),f.jsxs("section",{children:[f.jsx(Uf,{label:`Friends (${(g==null?void 0:g.totalFriends)??0})`}),w.length>0?f.jsx("div",{className:"mt-3 space-y-1.5",children:w.map(j=>f.jsxs("div",{className:"flex items-center justify-between rounded-lg bg-ouro-void/40 px-3 py-2.5 ring-1 ring-ouro-moss/15",children:[f.jsxs("div",{className:"min-w-0",children:[f.jsx("button",{onClick:()=>o({tab:"sessions"}),className:"font-medium text-ouro-bone hover:text-ouro-glow transition-colors",children:j.friendName}),f.jsxs("p",{className:"text-xs text-ouro-shadow",children:[j.channels.join(", ")," · ",j.sessionCount," sessions",j.lastActivityAt&&f.jsxs(f.Fragment,{children:[" · ",et(j.lastActivityAt)]})]})]}),f.jsxs("div",{className:"shrink-0 text-right",children:[f.jsx("p",{className:"tabular-nums text-sm font-medium text-ouro-bone",children:j.totalTokens.toLocaleString()}),f.jsx("p",{className:"text-[10px] text-ouro-shadow",children:"tokens"})]})]},j.friendId))}):f.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No friends."})]})]})}function Uf({label:n}){return f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:n})}function TC(n){return Kb(n)}function el(n){return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(TC(n)))}function jC({agentName:n,view:a,refreshGeneration:s}){const r=Pi(),[o,d]=T.useState(null),[h,p]=T.useState(null),[m,g]=T.useState(!1),x=T.useRef(null),y=a.inner;T.useEffect(()=>{_e(`/agents/${encodeURIComponent(n)}/habits`).then(d)},[n,s]),T.useEffect(()=>{h&&x.current!==s&&(x.current=s,_e(`/agents/${encodeURIComponent(n)}/inner-transcript`).then(p))},[n,s,h!==null]);function S(){if(h){g(!m);return}_e(`/agents/${encodeURIComponent(n)}/inner-transcript`).then(k=>{x.current=s,p(k),g(!0)})}const w=(o==null?void 0:o.items)??[],j=w.filter(k=>k.isOverdue),E=w.filter(k=>k.status==="active"&&!k.isOverdue),C=w.filter(k=>k.status==="paused"),z=y.mode==="deep"?y.origin:null,D=y.mode==="deep"?y.obligationStatus:null,R=w.find(k=>k.name.toLowerCase()==="heartbeat");return f.jsxs("div",{className:"space-y-8",children:[R&&f.jsxs("section",{children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:"Heartbeat"}),f.jsx("div",{className:`mt-2 rounded-xl p-4 ring-1 ${R.isOverdue?"bg-ouro-fang/5 ring-ouro-fang/15":"bg-ouro-moss/10 ring-ouro-glow/10"}`,children:f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:`h-2.5 w-2.5 rounded-full ${R.isOverdue?"bg-ouro-fang animate-pulse":"bg-ouro-glow"}`}),f.jsx("span",{className:"font-medium text-ouro-bone",children:R.isOverdue?"Overdue":"Healthy"}),f.jsxs("span",{className:"text-xs text-ouro-shadow",children:["every ",R.cadence??"unknown"," · last ",R.lastRun?et(R.lastRun):"never"]})]})})]}),f.jsx("section",{children:f.jsxs("div",{className:"rounded-xl bg-ouro-moss/15 p-4 ring-1 ring-ouro-glow/10",children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-glow",children:"Inner work"}),f.jsx("p",{className:"mt-1 font-display text-xl italic font-semibold text-ouro-bone",children:y.status}),y.summary&&f.jsx("p",{className:"mt-2 text-sm leading-relaxed text-ouro-mist",children:y.summary}),f.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:y.hasPending?"Pending inner work queued.":"No pending inner work."}),z&&f.jsxs("div",{className:"mt-3",children:[f.jsx("p",{className:"font-mono text-[9px] uppercase tracking-wider text-ouro-shadow",children:"Triggered from"}),f.jsxs("button",{onClick:()=>{r({tab:"sessions",focus:`${z.friendId}/${z.channel}/${z.key}`})},className:"mt-1 text-xs text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2 hover:decoration-ouro-glow",children:[z.friendId.slice(0,8),"…/",z.channel,"/",z.key]}),D&&f.jsxs("button",{onClick:()=>r({tab:"work"}),className:"ml-2 text-xs text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2 hover:decoration-ouro-glow",children:["obligation: ",D]})]})]})}),f.jsxs("section",{children:[f.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:["Inner dialog ",h?`(${h.messages.length} total)`:""]}),h?f.jsx(EC,{messages:h.messages}):f.jsx("button",{onClick:S,className:"mt-2 w-full rounded-lg px-3 py-2.5 text-left font-mono text-xs text-ouro-glow ring-1 ring-ouro-moss/15 hover:ring-ouro-glow/20 transition-colors",children:"Load inner dialog"})]}),f.jsxs("section",{children:[f.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:["Habits (",(o==null?void 0:o.totalCount)??0,")"]}),j.length>0&&f.jsxs("div",{className:"mt-3",children:[f.jsxs("p",{className:"font-mono text-[9px] uppercase tracking-wider text-ouro-fang mb-1.5",children:["Overdue (",j.length,")"]}),f.jsx("div",{className:"space-y-1.5",children:j.map(k=>f.jsx(Bf,{h:k},k.name))})]}),E.length>0&&f.jsxs("div",{className:"mt-3",children:[f.jsxs("p",{className:"font-mono text-[9px] uppercase tracking-wider text-ouro-glow mb-1.5",children:["Running fine (",E.length,")"]}),f.jsx("div",{className:"space-y-1.5",children:E.map(k=>f.jsx(Bf,{h:k},k.name))})]}),C.length>0&&f.jsxs("div",{className:"mt-3",children:[f.jsxs("p",{className:"font-mono text-[9px] uppercase tracking-wider text-ouro-shadow mb-1.5",children:["Paused (",C.length,")"]}),f.jsx("div",{className:"space-y-1.5",children:C.map(k=>f.jsx(Bf,{h:k},k.name))})]}),w.length===0&&f.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No habits configured."})]})]})}function EC({messages:n}){var S;const a=n.filter(w=>w.role!=="system"&&w.role!=="tool"),[s,r]=T.useState(!1),o=s?a:a.slice(-30),d=a.length-o.length,h=((S=o[o.length-1])==null?void 0:S.id)??null,{ref:p,onScroll:m,preserveScroll:g}=Xb(h),x=[];for(const w of a){if(w.role!=="assistant")continue;const j=(w.toolCalls??[]).map(jd);for(const E of j)E.kind==="surface"&&x.push({index:w.sequence,kind:"surfaced",label:pt(E.deliveredText??"",40)}),E.kind==="rest"&&x.push({index:w.sequence,kind:"resting",label:"resting"}),E.kind==="delegation"&&x.push({index:w.sequence,kind:"delegated",label:"continued thinking"})}function y(w){var E;const j=(E=p.current)==null?void 0:E.querySelector(`[data-msg-index="${w}"]`);j&&j.scrollIntoView({behavior:"smooth",block:"center"})}return f.jsxs("div",{children:[x.length>0&&f.jsx("div",{className:"mt-2 mb-1 flex flex-wrap gap-1",children:x.map((w,j)=>f.jsxs("button",{onClick:()=>{g(),r(!0),setTimeout(()=>y(w.index),100)},className:`rounded-md px-2 py-0.5 text-[10px] font-mono ring-1 transition-colors ${w.kind==="surfaced"?"bg-ouro-scale/10 text-ouro-glow ring-ouro-scale/20 hover:ring-ouro-glow/30":w.kind==="resting"?"bg-ouro-void/40 text-ouro-shadow ring-ouro-moss/10":"bg-ouro-gold/5 text-ouro-gold ring-ouro-gold/10"}`,children:[w.kind==="surfaced"?"★":w.kind==="resting"?"—":"→"," #",w.index]},j))}),f.jsxs("div",{ref:p,"data-testid":"inner-transcript-scroll",onScroll:m,className:"max-h-[60vh] overflow-y-auto rounded-lg bg-ouro-void/60 p-3 ring-1 ring-ouro-moss/15 space-y-1",children:[d>0&&f.jsxs("button",{onClick:()=>{g(),r(!0)},className:"w-full rounded-lg px-3 py-2 text-center font-mono text-xs text-ouro-shadow hover:text-ouro-mist ring-1 ring-ouro-moss/10 hover:ring-ouro-moss/20 transition-colors mb-2",children:["Load ",d," earlier messages"]}),o.map(w=>{const j=Ml(w);if(w.role==="user"){const E=j.includes("[pending from")||j.includes("[delegated"),C=j.includes("waking up")||j.includes("world-state checkpoint");return f.jsx("div",{"data-msg-index":w.sequence,className:"flex justify-start py-1",children:f.jsxs("div",{className:`max-w-[85%] rounded-2xl rounded-bl-sm px-3 py-2 ring-1 ${E?"bg-ouro-gold/8 ring-ouro-gold/15":C?"bg-ouro-moss/20 ring-ouro-moss/15":"bg-ouro-moss/25 ring-ouro-moss/15"}`,children:[f.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[f.jsx("p",{className:"font-mono text-[9px] uppercase tracking-wider",style:{color:E?"var(--color-ouro-gold)":"var(--color-ouro-shadow)"},children:E?"★ delegated":C?"heartbeat":"prompt"}),f.jsxs("span",{className:"font-mono text-[9px] text-ouro-shadow/40",children:["#",w.sequence]}),f.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:el(w)})]}),f.jsx("p",{className:"text-sm leading-relaxed text-ouro-bone whitespace-pre-wrap break-words",children:j})]})},w.id)}if(w.role==="assistant"){const E=(w.toolCalls??[]).map(jd),C=E.filter(R=>R.kind==="surface"),z=E.filter(R=>R.kind==="rest"),D=E.filter(R=>R.kind==="delegation");return f.jsxs("div",{"data-msg-index":w.sequence,children:[C.map(R=>f.jsx("div",{className:"flex justify-end py-1",children:f.jsxs("div",{className:"max-w-[85%] rounded-2xl rounded-br-sm bg-ouro-scale/15 px-3 py-2 ring-1 ring-ouro-scale/20",children:[f.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[f.jsx("p",{className:"font-mono text-[9px] uppercase tracking-wider text-ouro-glow",children:"★ surfaced outward"}),f.jsxs("span",{className:"font-mono text-[9px] text-ouro-shadow/40",children:["#",w.sequence]}),f.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:el(w)})]}),f.jsx("p",{className:"text-sm leading-relaxed text-ouro-bone whitespace-pre-wrap break-words",children:R.deliveredText}),R.metadata&&f.jsxs("p",{className:"mt-1 font-mono text-[9px] text-ouro-shadow",children:["→ ",R.metadata]})]})},R.id)),D.length>0&&f.jsxs("div",{className:"py-1 text-center font-mono text-[10px] text-ouro-gold/50",children:["— still thinking — #",w.sequence," · ",el(w)]}),z.length>0&&f.jsxs("div",{className:"py-1 text-center font-mono text-[10px] text-ouro-shadow/40",children:["— resting — #",w.sequence," · ",el(w)]}),C.length===0&&z.length===0&&D.length===0&&j&&f.jsx("div",{className:"flex justify-end py-1",children:f.jsxs("div",{className:"max-w-[85%] rounded-2xl rounded-br-sm bg-ouro-glow/6 px-3 py-2 ring-1 ring-ouro-glow/8",children:[f.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[f.jsx("p",{className:"font-mono text-[9px] uppercase tracking-wider text-ouro-glow/50",children:"thinking"}),f.jsxs("span",{className:"font-mono text-[9px] text-ouro-shadow/40",children:["#",w.sequence]}),f.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:el(w)})]}),f.jsx("p",{className:"text-sm leading-relaxed text-ouro-mist whitespace-pre-wrap break-words",children:j})]})})]},w.id)}return null})]})]})}function Bf({h:n}){const a=n.isOverdue,s=n.isDegraded,r=n.status;return f.jsxs("div",{className:`rounded-lg px-3 py-2.5 ring-1 ${a?"bg-ouro-fang/5 ring-ouro-fang/15":s?"bg-ouro-gold/5 ring-ouro-gold/15":r==="paused"?"bg-ouro-void/30 ring-ouro-moss/10":"bg-ouro-void/40 ring-ouro-moss/15"}`,children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(xe,{color:a?"red":s?"yellow":r==="active"?"lime":"zinc",children:a?"overdue":s?"degraded":r}),f.jsx("span",{className:"font-medium text-ouro-bone",children:n.title})]}),f.jsxs("div",{className:"mt-1 flex flex-wrap gap-3 text-xs text-ouro-shadow",children:[n.cadence&&f.jsxs("span",{children:["every ",n.cadence]}),f.jsx("span",{children:n.lastRun?`last ${et(n.lastRun)}`:"never run"}),s&&n.degradedReason&&f.jsx("span",{className:"text-ouro-gold",children:n.degradedReason}),!a&&!s&&r==="active"&&n.lastRun&&f.jsx("span",{className:"text-ouro-glow",children:"on schedule"}),a&&n.overdueMs&&f.jsxs("span",{className:"text-ouro-fang",children:[Math.floor(n.overdueMs/6e4),"m overdue"]}),!n.lastRun&&r==="active"&&f.jsx("span",{className:"text-ouro-gold",children:"never fired — may be misconfigured"})]}),n.bodyExcerpt&&f.jsx("p",{className:"mt-1 text-xs text-ouro-shadow/70",children:n.bodyExcerpt})]})}function NC({agentName:n,refreshGeneration:a}){const[s,r]=T.useState(null),[o,d]=T.useState(null),[h,p]=T.useState("diary");if(T.useEffect(()=>{_e(`/agents/${encodeURIComponent(n)}/notes`).then(r),_e(`/agents/${encodeURIComponent(n)}/note-decisions`).then(d).catch(()=>{})},[n,a]),!s)return f.jsxs("div",{className:"flex items-center gap-2 py-6",children:[f.jsx("div",{className:"h-2 w-2 animate-pulse rounded-full bg-ouro-glow"}),f.jsx("span",{className:"font-mono text-xs text-ouro-shadow",children:"Loading…"})]});const m=s.recentDiaryEntries,g=s.recentJournalEntries;return f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsxs("button",{onClick:()=>p("diary"),className:`font-mono text-xs uppercase tracking-wider transition-colors ${h==="diary"?"text-ouro-glow":"text-ouro-shadow hover:text-ouro-mist"}`,children:["Diary (",s.diaryEntryCount,")"]}),f.jsx("span",{className:"text-ouro-shadow/30",children:"|"}),f.jsxs("button",{onClick:()=>p("journal"),className:`font-mono text-xs uppercase tracking-wider transition-colors ${h==="journal"?"text-ouro-glow":"text-ouro-shadow hover:text-ouro-mist"}`,children:["Journal (",s.journalEntryCount,")"]}),f.jsx("span",{className:"text-ouro-shadow/30",children:"|"}),f.jsxs("button",{onClick:()=>p("decisions"),className:`font-mono text-xs uppercase tracking-wider transition-colors ${h==="decisions"?"text-ouro-glow":"text-ouro-shadow hover:text-ouro-mist"}`,children:["Decisions (",(o==null?void 0:o.totalCount)??0,")"]})]}),h==="diary"&&f.jsx("div",{children:m.length>0?f.jsx("div",{className:"space-y-3",children:m.map(x=>f.jsxs("article",{className:"rounded-xl bg-ouro-void/40 px-4 py-3.5 ring-1 ring-ouro-moss/15",children:[f.jsx("p",{className:"text-sm leading-relaxed text-ouro-bone",children:x.text}),f.jsxs("div",{className:"mt-2 flex items-center gap-2 text-xs text-ouro-shadow",children:[f.jsx(xe,{children:x.source}),f.jsx("span",{children:et(x.createdAt)})]})]},x.id))}):f.jsx("p",{className:"text-sm text-ouro-shadow italic",children:"No diary entries yet. The agent hasn't written anything down."})}),h==="journal"&&f.jsx("div",{children:g.length>0?f.jsx("div",{className:"space-y-3",children:g.map(x=>f.jsxs("article",{className:"rounded-xl bg-ouro-void/40 px-4 py-3.5 ring-1 ring-ouro-moss/15",children:[f.jsx("p",{className:"font-medium text-ouro-bone",children:x.filename}),f.jsx("p",{className:"mt-1 text-sm leading-relaxed text-ouro-mist",children:x.preview})]},x.filename))}):f.jsx("p",{className:"text-sm text-ouro-shadow italic",children:"No journal entries yet."})}),h==="decisions"&&f.jsx("div",{children:o&&o.items.length>0?f.jsx("div",{className:"space-y-2",children:o.items.map((x,y)=>f.jsxs("div",{className:"rounded-xl bg-ouro-void/40 px-4 py-3 ring-1 ring-ouro-moss/15",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(xe,{color:x.decision==="saved"?"lime":"zinc",children:x.decision}),f.jsx(xe,{children:x.kind.replace(/_/g," ")}),f.jsx("span",{className:"text-xs text-ouro-shadow",children:et(x.timestamp)})]}),x.reason&&f.jsx("p",{className:"mt-1 text-sm text-ouro-mist",children:x.reason}),x.excerpt&&f.jsx("p",{className:"mt-0.5 text-xs text-ouro-shadow italic truncate",children:x.excerpt})]},y))}):f.jsx("p",{className:"text-sm text-ouro-shadow italic",children:"No note decisions logged yet."})})]})}function AC({agentName:n,view:a,refreshGeneration:s}){var j;const[r,o]=T.useState(null),[d,h]=T.useState(null),p=a.agent,m=p.degraded,g=p.freshness,x=((j=p.providers)==null?void 0:j.lanes)??[];T.useEffect(()=>{Promise.all([_e("/machine/health").then(o).catch(()=>null),_e("/machine/logs").then(h).catch(()=>null)])},[n,s]);const y=LC(r)?r:null,S=(y==null?void 0:y.degradedComponents)??[],w=(d==null?void 0:d.entries)??[];return f.jsxs("div",{className:"space-y-8",children:[m.status==="degraded"&&m.issues.length>0&&f.jsxs("section",{children:[f.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-fang",children:["Agent issues (",m.issues.length,")"]}),f.jsx("div",{className:"mt-3 space-y-1.5",children:m.issues.map((E,C)=>f.jsxs("div",{className:"rounded-lg bg-ouro-fang/5 px-3 py-2.5 ring-1 ring-ouro-fang/15",children:[f.jsx("p",{className:"font-mono text-xs font-semibold text-ouro-fang",children:E.code}),f.jsx("p",{className:"mt-0.5 text-xs text-ouro-mist break-all",children:E.detail})]},C))})]}),f.jsxs("section",{children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:"Agent config"}),f.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2 sm:grid-cols-3",children:[f.jsx(Hi,{label:"Provider lanes",value:CC(x)}),f.jsx(Hi,{label:"Enabled",value:p.enabled?"yes":"no"}),f.jsx(Hi,{label:"Freshness",value:`${g.status}${g.ageMs!=null?` (${Math.floor(g.ageMs/6e4)}m)`:""}`})]})]}),f.jsxs("section",{children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:"Provider lanes"}),x.length>0?f.jsx("div",{className:"mt-3 grid gap-2 lg:grid-cols-2",children:x.map(E=>{const C=RC(E);return f.jsxs("div",{className:"rounded-lg bg-ouro-void/40 px-3 py-3 ring-1 ring-ouro-moss/15",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx("p",{className:"font-mono text-xs font-semibold uppercase tracking-wider text-ouro-bone",children:E.lane}),f.jsx(xe,{color:zC(E),children:E.status}),f.jsx(xe,{color:kC(E.readiness.status),children:E.readiness.status})]}),f.jsx("p",{className:"mt-2 text-sm font-medium text-ouro-bone",children:MC(E)}),f.jsxs("div",{className:"mt-2 space-y-1 text-xs text-ouro-mist",children:[f.jsxs("p",{children:["source: ",E.source]}),f.jsxs("p",{children:["readiness: ",DC(E.readiness)]}),E.readiness.attempts!==void 0&&f.jsxs("p",{children:["attempts: ",E.readiness.attempts]}),E.readiness.checkedAt&&f.jsxs("p",{children:["checked: ",et(E.readiness.checkedAt)]}),f.jsxs("p",{children:["credentials: ",OC(E.credential)]}),E.credential.revision&&f.jsxs("p",{children:["revision: ",E.credential.revision]}),ax(E)&&f.jsxs("p",{children:["reason: ",ax(E)]}),C&&f.jsxs("p",{className:"break-all text-ouro-fang",children:["repair: ",C]}),E.warnings.map((z,D)=>f.jsxs("p",{className:"break-words text-ouro-gold",children:["warning: ",z]},D))]})]},E.lane)})}):f.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No provider lane data loaded."})]}),f.jsxs("section",{children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:"Daemon health"}),y?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2 sm:grid-cols-3",children:[f.jsx(Hi,{label:"Status",value:y.status}),f.jsx(Hi,{label:"Mode",value:y.mode}),f.jsx(Hi,{label:"Uptime",value:`${Math.floor(y.uptimeSeconds/60)}m`})]}),S.length>0&&f.jsxs("div",{className:"mt-3 space-y-1.5",children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-ouro-fang",children:"Degraded components"}),S.map((E,C)=>f.jsxs("div",{className:"rounded-lg bg-ouro-fang/5 px-3 py-2 ring-1 ring-ouro-fang/15",children:[f.jsx("p",{className:"text-xs font-semibold text-ouro-fang",children:E.component}),f.jsx("p",{className:"text-xs text-ouro-mist",children:E.reason})]},C))]})]}):f.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No health file found. This is normal when not running under the daemon."})]}),f.jsxs("section",{children:[f.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:["Recent logs (",(d==null?void 0:d.totalLines)??0," total)"]}),w.length>0?f.jsx("div",{className:"mt-3 max-h-96 overflow-y-auto rounded-lg bg-ouro-void/40 ring-1 ring-ouro-moss/15",children:[...w].reverse().slice(0,50).map((E,C)=>{const z=E.level;return f.jsxs("div",{className:"border-b border-ouro-moss/10 px-3 py-1.5 last:border-b-0",children:[f.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[f.jsx(xe,{color:z==="error"?"red":z==="warn"?"yellow":"zinc",children:z}),f.jsx("span",{className:"text-ouro-shadow",children:et(E.ts)}),f.jsx("span",{className:"font-mono text-ouro-glow",children:E.event})]}),f.jsx("p",{className:"truncate text-xs text-ouro-mist",children:E.message})]},C)})}):f.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No log entries."})]})]})}function Hi({label:n,value:a}){return f.jsxs("div",{className:"rounded-lg bg-ouro-void/40 px-3 py-2.5 ring-1 ring-ouro-moss/15",children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-ouro-shadow",children:n}),f.jsx("p",{className:"mt-1 text-sm font-medium text-ouro-bone",children:a})]})}function CC(n){return n.length===0?"none":`${n.filter(s=>s.status==="configured").length}/${n.length} configured`}function MC(n){return n.status==="unconfigured"?"unconfigured":`${n.provider} / ${n.model}`}function DC(n){return n.status==="failed"?n.error?`failed: ${n.error}`:"failed":n.status==="stale"?n.reason?`stale: ${n.reason}`:"stale":n.status==="unknown"?n.reason?`unknown: ${n.reason}`:"unknown":n.status}function OC(n){return n.status==="present"?n.source??"vault":n.status==="invalid-pool"?"vault unavailable":"missing"}function RC(n){return n.status==="unconfigured"?n.repairCommand:n.credential.repairCommand}function ax(n){return n.status==="unconfigured"?n.reason:n.readiness.reason}function zC(n){return n.status==="configured"?"green":"yellow"}function kC(n){return n==="ready"?"green":n==="failed"?"red":n==="stale"?"amber":"zinc"}function LC(n){return!!(n&&"degradedComponents"in n)}const Hf=[{id:"overview",label:"Overview"},{id:"mail",label:"Mailbox"},{id:"sessions",label:"Sessions"},{id:"work",label:"Work"},{id:"connections",label:"Connections"},{id:"inner",label:"Inner"},{id:"notes",label:"Diary & Journal"},{id:"runtime",label:"Runtime"}];function VC(n){return n==="degraded"||n==="blocked"?"red":n==="stale"?"yellow":n==="active"?"lime":"zinc"}function _C({agentName:n,view:a,deskPrefs:s,refreshGeneration:r,initialRoute:o}){const[d,h]=T.useState((o==null?void 0:o.tab)??"overview"),[p,m]=T.useState(o==null?void 0:o.focus),g=T.useRef(!1),x=T.useRef(n);T.useEffect(()=>{const C=x.current!==n;if(x.current=n,(o==null?void 0:o.agent)===n&&!g.current){g.current=!0,h(o.tab),m(o.focus);return}C&&(h("overview"),m(void 0))},[n,o==null?void 0:o.agent,o==null?void 0:o.focus,o==null?void 0:o.tab]);const y=T.useCallback(C=>{h(C.tab),m(C.focus),window.history.pushState(null,"",$f({agent:n,tab:C.tab,focus:C.focus}))},[n]),S=T.useCallback(C=>{h(C),m(void 0),window.history.pushState(null,"",$f({agent:n,tab:C,focus:void 0}))},[n]),w=T.useCallback(()=>m(void 0),[]);if(z3(y),!a||!n)return f.jsxs("div",{className:"flex flex-col items-center justify-center py-24 text-center",children:[f.jsx("p",{className:"font-display text-2xl italic text-ouro-bone",children:"Choose an agent"}),f.jsx("p",{className:"mt-2 text-sm text-ouro-mist",children:"Select an agent from the sidebar to inspect its state."})]});const E=a.agent.attention;return f.jsx(rx.Provider,{value:y,children:f.jsxs("div",{children:[f.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3 pb-4 border-b border-ouro-moss/30",children:[f.jsx("div",{className:"min-w-0",children:f.jsx("h1",{className:"font-display text-2xl italic font-semibold text-ouro-bone sm:text-3xl",children:n})}),f.jsx(xe,{color:VC(E.level),children:E.label})]}),f.jsx("nav",{className:"mt-4 flex gap-0.5 overflow-x-auto border-b border-ouro-moss/20 -mx-1",children:(()=>{const C=s==null?void 0:s.tabOrder;if(!C)return Hf;const z=C.map(R=>Hf.find(k=>k.id===R)).filter(R=>R!==void 0),D=Hf.filter(R=>!C.includes(R.id));return[...z,...D]})().map(C=>f.jsx("button",{type:"button",onClick:()=>S(C.id),className:`shrink-0 px-3 py-2 text-xs font-mono uppercase tracking-wider transition-colors rounded-t-md ${d===C.id?"bg-ouro-moss/20 text-ouro-glow border-b-2 border-ouro-glow":"text-ouro-shadow hover:text-ouro-mist hover:bg-ouro-moss/10"}`,children:C.label},C.id))}),f.jsxs("div",{className:"mt-6",children:[d==="overview"&&f.jsx(H3,{view:a,deskPrefs:s,refreshGeneration:r}),d==="mail"&&f.jsx(P3,{agentName:n,focus:p,onFocusConsumed:w,refreshGeneration:r}),d==="sessions"&&f.jsx(mC,{agentName:n,focus:p,onFocusConsumed:w,deskPrefs:s,refreshGeneration:r}),d==="work"&&f.jsx(bC,{agentName:n,view:a,focus:p,onFocusConsumed:w,refreshGeneration:r}),d==="connections"&&f.jsx(wC,{agentName:n,focus:p,onFocusConsumed:w,refreshGeneration:r}),d==="inner"&&f.jsx(jC,{agentName:n,view:a,refreshGeneration:r}),d==="notes"&&f.jsx(NC,{agentName:n,refreshGeneration:r}),d==="runtime"&&f.jsx(AC,{agentName:n,view:a,refreshGeneration:r})]})]})})}function ix(){return ox(window.location.hash)}function UC(n){return n==="degraded"||n==="blocked"?"red":n==="stale"?"yellow":n==="active"?"lime":"zinc"}function BC(){var C,z;const[n,a]=T.useState(null),[s,r]=T.useState(((C=ix())==null?void 0:C.agent)??""),[o,d]=T.useState(null),[h,p]=T.useState(0),m=T.useRef(0),g=T.useRef(ix()),x=T.useCallback(async()=>{var D;try{const R=await _e("/machine");if(a(R),!s&&R.agents.length>0){const k=((D=g.current)==null?void 0:D.agent)??R.agents[0].agentName;r(k)}}catch{}},[s]),[y,S]=T.useState(null),w=T.useCallback(async D=>{if(!D){d(null),S(null);return}try{const[R,k]=await Promise.all([_e(`/agents/${encodeURIComponent(D)}`),_e(`/agents/${encodeURIComponent(D)}/desk-prefs`)]);d(R),S(k)}catch{d(null),S(null)}},[]);T.useEffect(()=>{x()},[x]),T.useEffect(()=>{s&&w(s)},[s,w]),T.useEffect(()=>M2(()=>{const R=++m.current;x().then(async()=>{m.current===R&&(s&&(await w(s),m.current!==R)||p(k=>k+1))})}),[x,w,s]),T.useEffect(()=>{const D=()=>{const R=ox(window.location.hash);R&&r(R.agent)};return window.addEventListener("hashchange",D),()=>window.removeEventListener("hashchange",D)},[]);const j=T.useCallback(D=>{r(D),window.history.pushState(null,"",$f({agent:D,tab:"overview",focus:void 0}))},[]);if(!n)return f.jsx("div",{className:"flex h-screen items-center justify-center bg-ouro-void",children:f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"mx-auto mb-4 h-4 w-4 animate-pulse rounded-full bg-ouro-glow shadow-[0_0_20px_theme(--color-ouro-glow)]"}),f.jsx("p",{className:"font-mono text-sm text-ouro-mist",children:"Connecting to Mailbox…"})]})});const E=n.overview.totals;return f.jsx(E3,{navbar:f.jsxs(y3,{children:[f.jsx(S3,{}),f.jsx(b3,{children:f.jsx(rh,{children:f.jsx(xe,{color:n.overview.daemon.mode==="dev"?"yellow":"lime",children:n.overview.daemon.mode})})})]}),sidebar:f.jsxs(N3,{className:"bg-ouro-deep",children:[f.jsx(A3,{className:"border-ouro-moss/30",children:f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx("div",{className:"h-3 w-3 shrink-0 rounded-full bg-ouro-glow shadow-[0_0_16px_theme(--color-ouro-glow)]"}),f.jsx("div",{className:"min-w-0",children:f.jsx("p",{className:"truncate font-display text-lg italic font-semibold text-ouro-bone",children:"Ouro Mailbox"})})]})}),f.jsxs(C3,{className:"[&>[data-slot=section]+[data-slot=section]]:mt-4",children:[f.jsxs(W0,{children:[f.jsx(I0,{className:"text-ouro-mist/60",children:"Machine"}),f.jsx("div",{className:"grid grid-cols-3 gap-1.5 px-2",children:[{v:E.liveTasks??0,l:"Tasks",alert:(E.blockedTasks??0)>0},{v:E.openObligations??0,l:"Oblig."},{v:E.activeCodingAgents??0,l:"Coding"}].map(D=>f.jsxs("div",{className:"rounded-md bg-ouro-void/60 px-2 py-1.5 text-center ring-1 ring-ouro-moss/20",children:[f.jsx("div",{className:`text-base font-semibold tabular-nums ${D.alert?"text-ouro-fang":"text-ouro-bone"}`,children:D.v}),f.jsx("div",{className:"text-[9px] uppercase tracking-widest text-ouro-shadow",children:D.l})]},D.l))})]}),f.jsxs(W0,{children:[f.jsx(I0,{className:"text-ouro-mist/60",children:"Agents"}),n.agents.map(D=>f.jsx(D3,{current:D.agentName===s,onClick:()=>j(D.agentName),children:f.jsxs("div",{className:"flex min-w-0 flex-1 items-center justify-between gap-2",children:[f.jsxs("div",{className:"min-w-0",children:[f.jsx(O3,{className:"text-ouro-bone",children:D.agentName}),f.jsxs("p",{className:"truncate text-xs text-ouro-shadow",children:[D.tasks.liveCount,"t · ",D.obligations.openCount,"o · ",D.coding.activeCount,"c"]})]}),f.jsx(xe,{color:UC(D.attention.level),children:D.attention.label})]})},D.agentName))]})]}),f.jsx(M3,{className:"border-ouro-moss/30",children:f.jsxs("div",{className:"px-2 text-xs text-ouro-shadow",children:[f.jsx("p",{className:"font-mono",children:n.overview.runtime.version}),f.jsxs("p",{className:"mt-0.5",children:[n.overview.daemon.mode," · ",n.overview.freshness.status]})]})}),s&&o&&f.jsx("div",{className:"px-4 py-2 border-t border-ouro-moss/20",children:f.jsx("p",{className:"text-xs italic text-ouro-shadow/70",children:(()=>{const D=y==null?void 0:y.statusLine;if(D)return D;const R=o.inner;if(R.status==="running"||R.hasPending)return"thinking through something privately";const U=o.work.obligations.openCount;return U>2?"a few loose ends":U>0?"carrying something":"steady"})()})})]}),children:f.jsx(_C,{agentName:s,view:o,deskPrefs:y,refreshGeneration:h,initialRoute:((z=g.current)==null?void 0:z.agent)===s?g.current:void 0})})}C2.createRoot(document.getElementById("app")).render(f.jsx(T.StrictMode,{children:f.jsx(BC,{})}));
61
+ `)),[]});var mT=(n=>(n[n.None=0]="None",n[n.Closed=1]="Closed",n[n.Enter=2]="Enter",n[n.Leave=4]="Leave",n))(mT||{});function pT(n){let a={};for(let s in n)n[s]===!0&&(a[`data-${s}`]="");return a}function gT(n,a,s,r){let[o,d]=T.useState(s),{hasFlag:h,addFlag:p,removeFlag:m}=dT(n&&o?3:0),g=T.useRef(!1),x=T.useRef(!1),y=wl();return Nt(()=>{var S;if(n){if(s&&d(!0),!a){s&&p(3);return}return(S=r==null?void 0:r.start)==null||S.call(r,s),vT(a,{inFlight:g,prepare(){x.current?x.current=!1:x.current=g.current,g.current=!0,!x.current&&(s?(p(3),m(4)):(p(4),m(2)))},run(){x.current?s?(m(3),p(4)):(m(4),p(3)):s?m(1):p(1)},done(){var w;x.current&&bT(a)||(g.current=!1,m(7),s||d(!1),(w=r==null?void 0:r.end)==null||w.call(r,s))}})}},[n,s,a,y]),n?[o,{closed:h(1),enter:h(2),leave:h(4),transition:h(2)||h(4)}]:[s,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function vT(n,{prepare:a,run:s,done:r,inFlight:o}){let d=Un();return yT(n,{prepare:a,inFlight:o}),d.nextFrame(()=>{s(),d.requestAnimationFrame(()=>{d.add(xT(n,r))})}),d.dispose}function xT(n,a){var s,r;let o=Un();if(!n)return o.dispose;let d=!1;o.add(()=>{d=!0});let h=(r=(s=n.getAnimations)==null?void 0:s.call(n).filter(p=>p instanceof CSSTransition))!=null?r:[];return h.length===0?(a(),o.dispose):(Promise.allSettled(h.map(p=>p.finished)).then(()=>{d||a()}),o.dispose)}function yT(n,{inFlight:a,prepare:s}){if(a!=null&&a.current){s();return}let r=n.style.transition;n.style.transition="none",s(),n.offsetHeight,n.style.transition=r}function bT(n){var a,s;return((s=(a=n.getAnimations)==null?void 0:a.call(n))!=null?s:[]).some(r=>r instanceof CSSTransition&&r.playState!=="finished")}function Dd(n,a){let s=T.useRef([]),r=Me(n);T.useEffect(()=>{let o=[...s.current];for(let[d,h]of a.entries())if(s.current[d]!==h){let p=r(a,o);return s.current=a,p}},[r,...a])}let Ro=T.createContext(null);Ro.displayName="OpenClosedContext";var an=(n=>(n[n.Open=1]="Open",n[n.Closed=2]="Closed",n[n.Closing=4]="Closing",n[n.Opening=8]="Opening",n))(an||{});function zo(){return T.useContext(Ro)}function ST({value:n,children:a}){return ce.createElement(Ro.Provider,{value:n},a)}function wT({children:n}){return ce.createElement(Ro.Provider,{value:null},n)}function TT(n){function a(){document.readyState!=="loading"&&(n(),document.removeEventListener("DOMContentLoaded",a))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",a),a())}let da=[];TT(()=>{function n(a){if(!ma(a.target)||a.target===document.body||da[0]===a.target)return;let s=a.target;s=s.closest(xo),da.unshift(s??a.target),da=da.filter(r=>r!=null&&r.isConnected),da.splice(10)}window.addEventListener("click",n,{capture:!0}),window.addEventListener("mousedown",n,{capture:!0}),window.addEventListener("focus",n,{capture:!0}),document.body.addEventListener("click",n,{capture:!0}),document.body.addEventListener("mousedown",n,{capture:!0}),document.body.addEventListener("focus",n,{capture:!0})});function Bx(n){let a=Me(n),s=T.useRef(!1);T.useEffect(()=>(s.current=!1,()=>{s.current=!0,Oo(()=>{s.current&&a()})}),[a])}let Hx=T.createContext(!1);function jT(){return T.useContext(Hx)}function kv(n){return ce.createElement(Hx.Provider,{value:n.force},n.children)}function ET(n){let a=jT(),s=T.useContext(qx),[r,o]=T.useState(()=>{var d;if(!a&&s!==null)return(d=s.current)!=null?d:null;if(hn.isServer)return null;let h=n==null?void 0:n.getElementById("headlessui-portal-root");if(h)return h;if(n===null)return null;let p=n.createElement("div");return p.setAttribute("id","headlessui-portal-root"),n.body.appendChild(p)});return T.useEffect(()=>{r!==null&&(n!=null&&n.body.contains(r)||n==null||n.body.appendChild(r))},[r,n]),T.useEffect(()=>{a||s!==null&&o(s.current)},[s,o,a]),r}let $x=T.Fragment,NT=dt(function(n,a){let{ownerDocument:s=null,...r}=n,o=T.useRef(null),d=gn(jw(S=>{o.current=S}),a),h=Md(o.current),p=s??h,m=ET(p),g=T.useContext(Wf),x=wl(),y=At();return Bx(()=>{var S;m&&m.childNodes.length<=0&&((S=m.parentElement)==null||S.removeChild(m))}),m?X2.createPortal(ce.createElement("div",{"data-headlessui-portal":"",ref:S=>{x.dispose(),g&&S&&x.add(g.register(S))}},y({ourProps:{ref:d},theirProps:r,slot:{},defaultTag:$x,name:"Portal"})),m):null});function AT(n,a){let s=gn(a),{enabled:r=!0,ownerDocument:o,...d}=n,h=At();return r?ce.createElement(NT,{...d,ownerDocument:o,ref:s}):h({ourProps:{ref:s},theirProps:d,slot:{},defaultTag:$x,name:"Portal"})}let CT=T.Fragment,qx=T.createContext(null);function MT(n,a){let{target:s,...r}=n,o={ref:gn(a)},d=At();return ce.createElement(qx.Provider,{value:s},d({ourProps:o,theirProps:r,defaultTag:CT,name:"Popover.Group"}))}let Wf=T.createContext(null);function DT(){let n=T.useContext(Wf),a=T.useRef([]),s=Me(d=>(a.current.push(d),n&&n.register(d),()=>r(d))),r=Me(d=>{let h=a.current.indexOf(d);h!==-1&&a.current.splice(h,1),n&&n.unregister(d)}),o=T.useMemo(()=>({register:s,unregister:r,portals:a}),[s,r,a]);return[a,T.useMemo(()=>function({children:d}){return ce.createElement(Wf.Provider,{value:o},d)},[o])]}let OT=dt(AT),Yx=dt(MT),RT=Object.assign(OT,{Group:Yx}),zT=T.Fragment;function kT(n,a){let{...s}=n,r=!1,{isFocusVisible:o,focusProps:d}=yx(),{isHovered:h,hoverProps:p}=xx({isDisabled:r}),{pressed:m,pressProps:g}=Sx({disabled:r}),x=Ad({ref:a},d,p,g),y=ti({hover:h,focus:o,active:m});return At()({ourProps:x,theirProps:s,slot:y,defaultTag:zT,name:"DataInteractive"})}let LT=dt(kT);function VT(n,a=typeof document<"u"?document.defaultView:null,s){let r=jl(n,"escape");Ux(a,"keydown",o=>{r&&(o.defaultPrevented||o.key===Nx.Escape&&s(o))})}function _T(){var n;let[a]=T.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[s,r]=T.useState((n=a==null?void 0:a.matches)!=null?n:!1);return Nt(()=>{if(!a)return;function o(d){r(d.matches)}return a.addEventListener("change",o),()=>a.removeEventListener("change",o)},[a]),s}function UT({defaultContainers:n=[],portals:a,mainTreeNode:s}={}){let r=Me(()=>{var o,d;let h=Wi(s),p=[];for(let m of n)m!==null&&(ga(m)?p.push(m):"current"in m&&ga(m.current)&&p.push(m.current));if(a!=null&&a.current)for(let m of a.current)p.push(m);for(let m of(o=h==null?void 0:h.querySelectorAll("html > *, body > *"))!=null?o:[])m!==document.body&&m!==document.head&&ga(m)&&m.id!=="headlessui-portal-root"&&(s&&(m.contains(s)||m.contains((d=s==null?void 0:s.getRootNode())==null?void 0:d.host))||p.some(g=>m.contains(g))||p.push(m));return p});return{resolveContainers:r,contains:Me(o=>r().some(d=>d.contains(o)))}}let Gx=T.createContext(null);function Lv({children:n,node:a}){let[s,r]=T.useState(null),o=Xx(a??s);return ce.createElement(Gx.Provider,{value:o},n,o===null&&ce.createElement(Qf,{features:vo.Hidden,ref:d=>{var h,p;if(d){for(let m of(p=(h=Wi(d))==null?void 0:h.querySelectorAll("html > *, body > *"))!=null?p:[])if(m!==document.body&&m!==document.head&&ga(m)&&m!=null&&m.contains(d)){r(m);break}}}}))}function Xx(n=null){var a;return(a=T.useContext(Gx))!=null?a:n}function BT(){let n=typeof document>"u";return"useSyncExternalStore"in mv?(a=>a.useSyncExternalStore)(mv)(()=>()=>{},()=>!1,()=>!n):!1}function ko(){let n=BT(),[a,s]=T.useState(hn.isHandoffComplete);return a&&hn.isHandoffComplete===!1&&s(!1),T.useEffect(()=>{a!==!0&&s(!0)},[a]),T.useEffect(()=>hn.handoff(),[]),n?!1:a}function Od(){let n=T.useRef(!1);return Nt(()=>(n.current=!0,()=>{n.current=!1}),[]),n}var al=(n=>(n[n.Forwards=0]="Forwards",n[n.Backwards=1]="Backwards",n))(al||{});function HT(){let n=T.useRef(0);return _x(!0,"keydown",a=>{a.key==="Tab"&&(n.current=a.shiftKey?1:0)},!0),n}function Kx(n){if(!n)return new Set;if(typeof n=="function")return new Set(n());let a=new Set;for(let s of n.current)ga(s.current)&&a.add(s.current);return a}let $T="div";var Ga=(n=>(n[n.None=0]="None",n[n.InitialFocus=1]="InitialFocus",n[n.TabLock=2]="TabLock",n[n.FocusLock=4]="FocusLock",n[n.RestoreFocus=8]="RestoreFocus",n[n.AutoFocus=16]="AutoFocus",n))(Ga||{});function qT(n,a){let s=T.useRef(null),r=gn(s,a),{initialFocus:o,initialFocusFallback:d,containers:h,features:p=15,...m}=n;ko()||(p=0);let g=Md(s.current);KT(p,{ownerDocument:g});let x=FT(p,{ownerDocument:g,container:s,initialFocus:o,initialFocusFallback:d});ZT(p,{ownerDocument:g,container:s,containers:h,previousActiveElement:x});let y=HT(),S=Me(D=>{if(!Ia(s.current))return;let R=s.current;(k=>k())(()=>{_n(y.current,{[al.Forwards]:()=>{cl(R,Ln.First,{skipElements:[D.relatedTarget,d]})},[al.Backwards]:()=>{cl(R,Ln.Last,{skipElements:[D.relatedTarget,d]})}})})}),w=jl(!!(p&2),"focus-trap#tab-lock"),j=wl(),E=T.useRef(!1),C={ref:r,onKeyDown(D){D.key=="Tab"&&(E.current=!0,j.requestAnimationFrame(()=>{E.current=!1}))},onBlur(D){if(!(p&4))return;let R=Kx(h);Ia(s.current)&&R.add(s.current);let k=D.relatedTarget;ma(k)&&k.dataset.headlessuiFocusGuard!=="true"&&(Fx(R,k)||(E.current?cl(s.current,_n(y.current,{[al.Forwards]:()=>Ln.Next,[al.Backwards]:()=>Ln.Previous})|Ln.WrapAround,{relativeTo:D.target}):ma(D.target)&&Vn(D.target)))}},z=At();return ce.createElement(ce.Fragment,null,w&&ce.createElement(Qf,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:S,features:vo.Focusable}),z({ourProps:C,theirProps:m,defaultTag:$T,name:"FocusTrap"}),w&&ce.createElement(Qf,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:S,features:vo.Focusable}))}let YT=dt(qT),GT=Object.assign(YT,{features:Ga});function XT(n=!0){let a=T.useRef(da.slice());return Dd(([s],[r])=>{r===!0&&s===!1&&Oo(()=>{a.current.splice(0)}),r===!1&&s===!0&&(a.current=da.slice())},[n,da,a]),Me(()=>{var s;return(s=a.current.find(r=>r!=null&&r.isConnected))!=null?s:null})}function KT(n,{ownerDocument:a}){let s=!!(n&8),r=XT(s);Dd(()=>{s||rw(a==null?void 0:a.body)&&Vn(r())},[s]),Bx(()=>{s&&Vn(r())})}function FT(n,{ownerDocument:a,container:s,initialFocus:r,initialFocusFallback:o}){let d=T.useRef(null),h=jl(!!(n&1),"focus-trap#initial-focus"),p=Od();return Dd(()=>{if(n===0)return;if(!h){o!=null&&o.current&&Vn(o.current);return}let m=s.current;m&&Oo(()=>{if(!p.current)return;let g=a==null?void 0:a.activeElement;if(r!=null&&r.current){if((r==null?void 0:r.current)===g){d.current=g;return}}else if(m.contains(g)){d.current=g;return}if(r!=null&&r.current)Vn(r.current);else{if(n&16){if(cl(m,Ln.First|Ln.AutoFocus)!==Jf.Error)return}else if(cl(m,Ln.First)!==Jf.Error)return;if(o!=null&&o.current&&(Vn(o.current),(a==null?void 0:a.activeElement)===o.current))return;console.warn("There are no focusable elements inside the <FocusTrap />")}d.current=a==null?void 0:a.activeElement})},[o,h,n]),d}function ZT(n,{ownerDocument:a,container:s,containers:r,previousActiveElement:o}){let d=Od(),h=!!(n&4);Ux(a==null?void 0:a.defaultView,"focus",p=>{if(!h||!d.current)return;let m=Kx(r);Ia(s.current)&&m.add(s.current);let g=o.current;if(!g)return;let x=p.target;Ia(x)?Fx(m,x)?(o.current=x,Vn(x)):(p.preventDefault(),p.stopPropagation(),Vn(g)):Vn(o.current)},!0)}function Fx(n,a){for(let s of n)if(s.contains(a))return!0;return!1}function Zx(n){var a;return!!(n.enter||n.enterFrom||n.enterTo||n.leave||n.leaveFrom||n.leaveTo)||!ol((a=n.as)!=null?a:Px)||ce.Children.count(n.children)===1}let Lo=T.createContext(null);Lo.displayName="TransitionContext";var QT=(n=>(n.Visible="visible",n.Hidden="hidden",n))(QT||{});function PT(){let n=T.useContext(Lo);if(n===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return n}function JT(){let n=T.useContext(Vo);if(n===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return n}let Vo=T.createContext(null);Vo.displayName="NestingContext";function _o(n){return"children"in n?_o(n.children):n.current.filter(({el:a})=>a.current!==null).filter(({state:a})=>a==="visible").length>0}function Qx(n,a){let s=ei(n),r=T.useRef([]),o=Od(),d=wl(),h=Me((w,j=ha.Hidden)=>{let E=r.current.findIndex(({el:C})=>C===w);E!==-1&&(_n(j,{[ha.Unmount](){r.current.splice(E,1)},[ha.Hidden](){r.current[E].state="hidden"}}),d.microTask(()=>{var C;!_o(r)&&o.current&&((C=s.current)==null||C.call(s))}))}),p=Me(w=>{let j=r.current.find(({el:E})=>E===w);return j?j.state!=="visible"&&(j.state="visible"):r.current.push({el:w,state:"visible"}),()=>h(w,ha.Unmount)}),m=T.useRef([]),g=T.useRef(Promise.resolve()),x=T.useRef({enter:[],leave:[]}),y=Me((w,j,E)=>{m.current.splice(0),a&&(a.chains.current[j]=a.chains.current[j].filter(([C])=>C!==w)),a==null||a.chains.current[j].push([w,new Promise(C=>{m.current.push(C)})]),a==null||a.chains.current[j].push([w,new Promise(C=>{Promise.all(x.current[j].map(([z,D])=>D)).then(()=>C())})]),j==="enter"?g.current=g.current.then(()=>a==null?void 0:a.wait.current).then(()=>E(j)):E(j)}),S=Me((w,j,E)=>{Promise.all(x.current[j].splice(0).map(([C,z])=>z)).then(()=>{var C;(C=m.current.shift())==null||C()}).then(()=>E(j))});return T.useMemo(()=>({children:r,register:p,unregister:h,onStart:y,onStop:S,wait:g,chains:x}),[p,h,r,y,S,x,g])}let Px=T.Fragment,Jx=go.RenderStrategy;function WT(n,a){var s,r;let{transition:o=!0,beforeEnter:d,afterEnter:h,beforeLeave:p,afterLeave:m,enter:g,enterFrom:x,enterTo:y,entered:S,leave:w,leaveFrom:j,leaveTo:E,...C}=n,[z,D]=T.useState(null),R=T.useRef(null),k=Zx(n),U=gn(...k?[R,a,D]:a===null?[]:[a]),P=(s=C.unmount)==null||s?ha.Unmount:ha.Hidden,{show:F,appear:W,initial:re}=PT(),[B,Z]=T.useState(F?"visible":"hidden"),ie=JT(),{register:le,unregister:Se}=ie;Nt(()=>le(R),[le,R]),Nt(()=>{if(P===ha.Hidden&&R.current){if(F&&B!=="visible"){Z("visible");return}return _n(B,{hidden:()=>Se(R),visible:()=>le(R)})}},[B,R,le,Se,F,P]);let De=ko();Nt(()=>{if(k&&De&&B==="visible"&&R.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[R,B,De,k]);let $=re&&!W,Q=W&&F&&re,J=T.useRef(!1),oe=Qx(()=>{J.current||(Z("hidden"),Se(R))},ie),me=Me(Te=>{J.current=!0;let Ze=Te?"enter":"leave";oe.onStart(R,Ze,Le=>{Le==="enter"?d==null||d():Le==="leave"&&(p==null||p())})}),A=Me(Te=>{let Ze=Te?"enter":"leave";J.current=!1,oe.onStop(R,Ze,Le=>{Le==="enter"?h==null||h():Le==="leave"&&(m==null||m())}),Ze==="leave"&&!_o(oe)&&(Z("hidden"),Se(R))});T.useEffect(()=>{k&&o||(me(F),A(F))},[F,k,o]);let G=!(!o||!k||!De||$),[,K]=gT(G,z,F,{start:me,end:A}),I=qa({ref:U,className:((r=Zf(C.className,Q&&g,Q&&x,K.enter&&g,K.enter&&K.closed&&x,K.enter&&!K.closed&&y,K.leave&&w,K.leave&&!K.closed&&j,K.leave&&K.closed&&E,!K.transition&&F&&S))==null?void 0:r.trim())||void 0,...pT(K)}),ue=0;B==="visible"&&(ue|=an.Open),B==="hidden"&&(ue|=an.Closed),F&&B==="hidden"&&(ue|=an.Opening),!F&&B==="visible"&&(ue|=an.Closing);let pe=At();return ce.createElement(Vo.Provider,{value:oe},ce.createElement(ST,{value:ue},pe({ourProps:I,theirProps:C,defaultTag:Px,features:Jx,visible:B==="visible",name:"Transition.Child"})))}function IT(n,a){let{show:s,appear:r=!1,unmount:o=!0,...d}=n,h=T.useRef(null),p=Zx(n),m=gn(...p?[h,a]:a===null?[]:[a]);ko();let g=zo();if(s===void 0&&g!==null&&(s=(g&an.Open)===an.Open),s===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[x,y]=T.useState(s?"visible":"hidden"),S=Qx(()=>{s||y("hidden")}),[w,j]=T.useState(!0),E=T.useRef([s]);Nt(()=>{w!==!1&&E.current[E.current.length-1]!==s&&(E.current.push(s),j(!1))},[E,s]);let C=T.useMemo(()=>({show:s,appear:r,initial:w}),[s,r,w]);Nt(()=>{s?y("visible"):!_o(S)&&h.current!==null&&y("hidden")},[s,S]);let z={unmount:o},D=Me(()=>{var U;w&&j(!1),(U=n.beforeEnter)==null||U.call(n)}),R=Me(()=>{var U;w&&j(!1),(U=n.beforeLeave)==null||U.call(n)}),k=At();return ce.createElement(Vo.Provider,{value:S},ce.createElement(Lo.Provider,{value:C},k({ourProps:{...z,as:T.Fragment,children:ce.createElement(Wx,{ref:m,...z,...d,beforeEnter:D,beforeLeave:R})},theirProps:{},defaultTag:T.Fragment,features:Jx,visible:x==="visible",name:"Transition"})))}function ej(n,a){let s=T.useContext(Lo)!==null,r=zo()!==null;return ce.createElement(ce.Fragment,null,!s&&r?ce.createElement(If,{ref:a,...n}):ce.createElement(Wx,{ref:a,...n}))}let If=dt(IT),Wx=dt(WT),Rd=dt(ej),tj=Object.assign(If,{Child:Rd,Root:If});var nj=(n=>(n[n.Open=0]="Open",n[n.Closed=1]="Closed",n))(nj||{}),aj=(n=>(n[n.SetTitleId=0]="SetTitleId",n))(aj||{});let ij={0(n,a){return n.titleId===a.id?n:{...n,titleId:a.id}}},zd=T.createContext(null);zd.displayName="DialogContext";function Uo(n){let a=T.useContext(zd);if(a===null){let s=new Error(`<${n} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(s,Uo),s}return a}function sj(n,a){return _n(a.type,ij,n,a)}let Vv=dt(function(n,a){let s=T.useId(),{id:r=`headlessui-dialog-${s}`,open:o,onClose:d,initialFocus:h,role:p="dialog",autoFocus:m=!0,__demoMode:g=!1,unmount:x=!1,...y}=n,S=T.useRef(!1);p=(function(){return p==="dialog"||p==="alertdialog"?p:(S.current||(S.current=!0,console.warn(`Invalid role [${p}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")})();let w=zo();o===void 0&&w!==null&&(o=(w&an.Open)===an.Open);let j=T.useRef(null),E=gn(j,a),C=Md(j.current),z=o?0:1,[D,R]=T.useReducer(sj,{titleId:null,descriptionId:null,panelRef:T.createRef()}),k=Me(()=>d(!1)),U=Me(K=>R({type:0,id:K})),P=ko()?z===0:!1,[F,W]=DT(),re={get current(){var K;return(K=D.panelRef.current)!=null?K:j.current}},B=Xx(),{resolveContainers:Z}=UT({mainTreeNode:B,portals:F,defaultContainers:[re]}),ie=w!==null?(w&an.Closing)===an.Closing:!1;Kw(g||ie?!1:P,{allowed:Me(()=>{var K,I;return[(I=(K=j.current)==null?void 0:K.closest("[data-headlessui-portal]"))!=null?I:null]}),disallowed:Me(()=>{var K;return[(K=B==null?void 0:B.closest("body > *:not(#headlessui-portal-root)"))!=null?K:null]})});let le=zx.get(null);Nt(()=>{if(P)return le.actions.push(r),()=>le.actions.pop(r)},[le,r,P]);let Se=kx(le,T.useCallback(K=>le.selectors.isTop(K,r),[le,r]));iT(Se,Z,K=>{K.preventDefault(),k()}),VT(Se,C==null?void 0:C.defaultView,K=>{K.preventDefault(),K.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),k()}),fT(g||ie?!1:P,C,Z),Fw(P,j,k);let[De,$]=Ew(),Q=T.useMemo(()=>[{dialogState:z,close:k,setTitleId:U,unmount:x},D],[z,k,U,x,D]),J=ti({open:z===0}),oe={ref:E,id:r,role:p,tabIndex:-1,"aria-modal":g?void 0:z===0?!0:void 0,"aria-labelledby":D.titleId,"aria-describedby":De,unmount:x},me=!_T(),A=Ga.None;P&&!g&&(A|=Ga.RestoreFocus,A|=Ga.TabLock,m&&(A|=Ga.AutoFocus),me&&(A|=Ga.InitialFocus));let G=At();return ce.createElement(wT,null,ce.createElement(kv,{force:!0},ce.createElement(RT,null,ce.createElement(zd.Provider,{value:Q},ce.createElement(Yx,{target:j},ce.createElement(kv,{force:!1},ce.createElement($,{slot:J},ce.createElement(W,null,ce.createElement(GT,{initialFocus:h,initialFocusFallback:j,containers:Z,features:A},ce.createElement(Ow,{value:k},G({ourProps:oe,theirProps:y,slot:J,defaultTag:lj,features:rj,visible:z===0,name:"Dialog"})))))))))))}),lj="div",rj=go.RenderStrategy|go.Static;function oj(n,a){let{transition:s=!1,open:r,...o}=n,d=zo(),h=n.hasOwnProperty("open")||d!==null,p=n.hasOwnProperty("onClose");if(!h&&!p)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!h)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!p)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!d&&typeof n.open!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${n.open}`);if(typeof n.onClose!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${n.onClose}`);return(r!==void 0||s)&&!o.static?ce.createElement(Lv,null,ce.createElement(tj,{show:r,transition:s,unmount:o.unmount},ce.createElement(Vv,{ref:a,...o}))):ce.createElement(Lv,null,ce.createElement(Vv,{ref:a,open:r,...o}))}let uj="div";function cj(n,a){let s=T.useId(),{id:r=`headlessui-dialog-panel-${s}`,transition:o=!1,...d}=n,[{dialogState:h,unmount:p},m]=Uo("Dialog.Panel"),g=gn(a,m.panelRef),x=ti({open:h===0}),y=Me(C=>{C.stopPropagation()}),S={ref:g,id:r,onClick:y},w=o?Rd:T.Fragment,j=o?{unmount:p}:{},E=At();return ce.createElement(w,{...j},E({ourProps:S,theirProps:d,slot:x,defaultTag:uj,name:"Dialog.Panel"}))}let fj="div";function dj(n,a){let{transition:s=!1,...r}=n,[{dialogState:o,unmount:d}]=Uo("Dialog.Backdrop"),h=ti({open:o===0}),p={ref:a,"aria-hidden":!0},m=s?Rd:T.Fragment,g=s?{unmount:d}:{},x=At();return ce.createElement(m,{...g},x({ourProps:p,theirProps:r,slot:h,defaultTag:fj,name:"Dialog.Backdrop"}))}let hj="h2";function mj(n,a){let s=T.useId(),{id:r=`headlessui-dialog-title-${s}`,...o}=n,[{dialogState:d,setTitleId:h}]=Uo("Dialog.Title"),p=gn(a);T.useEffect(()=>(h(r),()=>h(null)),[r,h]);let m=ti({open:d===0}),g={ref:p,id:r};return At()({ourProps:g,theirProps:o,slot:m,defaultTag:hj,name:"Dialog.Title"})}let pj=dt(oj),Ix=dt(cj),gj=dt(dj),vj=dt(mj),xj=Object.assign(pj,{Panel:Ix,Title:vj,Description:Mw});const yo=T.createContext({});function yj(n){const a=T.useRef(null);return a.current===null&&(a.current=n()),a.current}const bj=typeof window<"u",ey=bj?T.useLayoutEffect:T.useEffect,kd=T.createContext(null);function Ld(n,a){n.indexOf(a)===-1&&n.push(a)}function bo(n,a){const s=n.indexOf(a);s>-1&&n.splice(s,1)}const pn=(n,a,s)=>s>a?a:s<n?n:s;let Vd=()=>{};const va={},ty=n=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n);function ny(n){return typeof n=="object"&&n!==null}const ay=n=>/^0[^.\s]+$/u.test(n);function iy(n){let a;return()=>(a===void 0&&(a=n()),a)}const Jt=n=>n,Sj=(n,a)=>s=>a(n(s)),El=(...n)=>n.reduce(Sj),vl=(n,a,s)=>{const r=a-n;return r===0?1:(s-n)/r};class _d{constructor(){this.subscriptions=[]}add(a){return Ld(this.subscriptions,a),()=>bo(this.subscriptions,a)}notify(a,s,r){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](a,s,r);else for(let d=0;d<o;d++){const h=this.subscriptions[d];h&&h(a,s,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Ut=n=>n*1e3,Pt=n=>n/1e3;function sy(n,a){return a?n*(1e3/a):0}const ly=(n,a,s)=>(((1-3*s+3*a)*n+(3*s-6*a))*n+3*a)*n,wj=1e-7,Tj=12;function jj(n,a,s,r,o){let d,h,p=0;do h=a+(s-a)/2,d=ly(h,r,o)-n,d>0?s=h:a=h;while(Math.abs(d)>wj&&++p<Tj);return h}function Nl(n,a,s,r){if(n===a&&s===r)return Jt;const o=d=>jj(d,0,1,n,s);return d=>d===0||d===1?d:ly(o(d),a,r)}const ry=n=>a=>a<=.5?n(2*a)/2:(2-n(2*(1-a)))/2,oy=n=>a=>1-n(1-a),uy=Nl(.33,1.53,.69,.99),Ud=oy(uy),cy=ry(Ud),fy=n=>n>=1?1:(n*=2)<1?.5*Ud(n):.5*(2-Math.pow(2,-10*(n-1))),Bd=n=>1-Math.sin(Math.acos(n)),dy=oy(Bd),hy=ry(Bd),Ej=Nl(.42,0,1,1),Nj=Nl(0,0,.58,1),my=Nl(.42,0,.58,1),Aj=n=>Array.isArray(n)&&typeof n[0]!="number",py=n=>Array.isArray(n)&&typeof n[0]=="number",Cj={linear:Jt,easeIn:Ej,easeInOut:my,easeOut:Nj,circIn:Bd,circInOut:hy,circOut:dy,backIn:Ud,backInOut:cy,backOut:uy,anticipate:fy},Mj=n=>typeof n=="string",_v=n=>{if(py(n)){Vd(n.length===4);const[a,s,r,o]=n;return Nl(a,s,r,o)}else if(Mj(n))return Cj[n];return n},Wr=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Dj(n,a){let s=new Set,r=new Set,o=!1,d=!1;const h=new WeakSet;let p={delta:0,timestamp:0,isProcessing:!1};function m(x){h.has(x)&&(g.schedule(x),n()),x(p)}const g={schedule:(x,y=!1,S=!1)=>{const j=S&&o?s:r;return y&&h.add(x),j.add(x),x},cancel:x=>{r.delete(x),h.delete(x)},process:x=>{if(p=x,o){d=!0;return}o=!0;const y=s;s=r,r=y,s.forEach(m),s.clear(),o=!1,d&&(d=!1,g.process(x))}};return g}const Oj=40;function gy(n,a){let s=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},d=()=>s=!0,h=Wr.reduce((R,k)=>(R[k]=Dj(d),R),{}),{setup:p,read:m,resolveKeyframes:g,preUpdate:x,update:y,preRender:S,render:w,postRender:j}=h,E=()=>{const R=va.useManualTiming,k=R?o.timestamp:performance.now();s=!1,R||(o.delta=r?1e3/60:Math.max(Math.min(k-o.timestamp,Oj),1)),o.timestamp=k,o.isProcessing=!0,p.process(o),m.process(o),g.process(o),x.process(o),y.process(o),S.process(o),w.process(o),j.process(o),o.isProcessing=!1,s&&a&&(r=!1,n(E))},C=()=>{s=!0,r=!0,o.isProcessing||n(E)};return{schedule:Wr.reduce((R,k)=>{const U=h[k];return R[k]=(P,F=!1,W=!1)=>(s||C(),U.schedule(P,F,W)),R},{}),cancel:R=>{for(let k=0;k<Wr.length;k++)h[Wr[k]].cancel(R)},state:o,steps:h}}const{schedule:ke,cancel:xa,state:ct,steps:Sf}=gy(typeof requestAnimationFrame<"u"?requestAnimationFrame:Jt,!0);let lo;function Rj(){lo=void 0}const vt={now:()=>(lo===void 0&&vt.set(ct.isProcessing||va.useManualTiming?ct.timestamp:performance.now()),lo),set:n=>{lo=n,queueMicrotask(Rj)}},vy=n=>a=>typeof a=="string"&&a.startsWith(n),xy=vy("--"),zj=vy("var(--"),Hd=n=>zj(n)?kj.test(n.split("/*")[0].trim()):!1,kj=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Uv(n){return typeof n!="string"?!1:n.split("/*")[0].includes("var(--")}const Ii={test:n=>typeof n=="number",parse:parseFloat,transform:n=>n},xl={...Ii,transform:n=>pn(0,1,n)},Ir={...Ii,default:1},fl=n=>Math.round(n*1e5)/1e5,$d=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Lj(n){return n==null}const Vj=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,qd=(n,a)=>s=>!!(typeof s=="string"&&Vj.test(s)&&s.startsWith(n)||a&&!Lj(s)&&Object.prototype.hasOwnProperty.call(s,a)),yy=(n,a,s)=>r=>{if(typeof r!="string")return r;const[o,d,h,p]=r.match($d);return{[n]:parseFloat(o),[a]:parseFloat(d),[s]:parseFloat(h),alpha:p!==void 0?parseFloat(p):1}},_j=n=>pn(0,255,n),wf={...Ii,transform:n=>Math.round(_j(n))},Za={test:qd("rgb","red"),parse:yy("red","green","blue"),transform:({red:n,green:a,blue:s,alpha:r=1})=>"rgba("+wf.transform(n)+", "+wf.transform(a)+", "+wf.transform(s)+", "+fl(xl.transform(r))+")"};function Uj(n){let a="",s="",r="",o="";return n.length>5?(a=n.substring(1,3),s=n.substring(3,5),r=n.substring(5,7),o=n.substring(7,9)):(a=n.substring(1,2),s=n.substring(2,3),r=n.substring(3,4),o=n.substring(4,5),a+=a,s+=s,r+=r,o+=o),{red:parseInt(a,16),green:parseInt(s,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}}const ed={test:qd("#"),parse:Uj,transform:Za.transform},Al=n=>({test:a=>typeof a=="string"&&a.endsWith(n)&&a.split(" ").length===1,parse:parseFloat,transform:a=>`${a}${n}`}),ca=Al("deg"),mn=Al("%"),te=Al("px"),Bj=Al("vh"),Hj=Al("vw"),Bv={...mn,parse:n=>mn.parse(n)/100,transform:n=>mn.transform(n*100)},qi={test:qd("hsl","hue"),parse:yy("hue","saturation","lightness"),transform:({hue:n,saturation:a,lightness:s,alpha:r=1})=>"hsla("+Math.round(n)+", "+mn.transform(fl(a))+", "+mn.transform(fl(s))+", "+fl(xl.transform(r))+")"},Ie={test:n=>Za.test(n)||ed.test(n)||qi.test(n),parse:n=>Za.test(n)?Za.parse(n):qi.test(n)?qi.parse(n):ed.parse(n),transform:n=>typeof n=="string"?n:n.hasOwnProperty("red")?Za.transform(n):qi.transform(n),getAnimatableNone:n=>{const a=Ie.parse(n);return a.alpha=0,Ie.transform(a)}},$j=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function qj(n){var a,s;return isNaN(n)&&typeof n=="string"&&(((a=n.match($d))==null?void 0:a.length)||0)+(((s=n.match($j))==null?void 0:s.length)||0)>0}const by="number",Sy="color",Yj="var",Gj="var(",Hv="${}",Xj=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Zi(n){const a=n.toString(),s=[],r={color:[],number:[],var:[]},o=[];let d=0;const p=a.replace(Xj,m=>(Ie.test(m)?(r.color.push(d),o.push(Sy),s.push(Ie.parse(m))):m.startsWith(Gj)?(r.var.push(d),o.push(Yj),s.push(m)):(r.number.push(d),o.push(by),s.push(parseFloat(m))),++d,Hv)).split(Hv);return{values:s,split:p,indexes:r,types:o}}function Kj(n){return Zi(n).values}function wy({split:n,types:a}){const s=n.length;return r=>{let o="";for(let d=0;d<s;d++)if(o+=n[d],r[d]!==void 0){const h=a[d];h===by?o+=fl(r[d]):h===Sy?o+=Ie.transform(r[d]):o+=r[d]}return o}}function Fj(n){return wy(Zi(n))}const Zj=n=>typeof n=="number"?0:Ie.test(n)?Ie.getAnimatableNone(n):n,Qj=(n,a)=>typeof n=="number"?a!=null&&a.trim().endsWith("/")?n:0:Zj(n);function Pj(n){const a=Zi(n);return wy(a)(a.values.map((r,o)=>Qj(r,a.split[o])))}const sn={test:qj,parse:Kj,createTransformer:Fj,getAnimatableNone:Pj};function Tf(n,a,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?n+(a-n)*6*s:s<1/2?a:s<2/3?n+(a-n)*(2/3-s)*6:n}function Jj({hue:n,saturation:a,lightness:s,alpha:r}){n/=360,a/=100,s/=100;let o=0,d=0,h=0;if(!a)o=d=h=s;else{const p=s<.5?s*(1+a):s+a-s*a,m=2*s-p;o=Tf(m,p,n+1/3),d=Tf(m,p,n),h=Tf(m,p,n-1/3)}return{red:Math.round(o*255),green:Math.round(d*255),blue:Math.round(h*255),alpha:r}}function So(n,a){return s=>s>0?a:n}const He=(n,a,s)=>n+(a-n)*s,jf=(n,a,s)=>{const r=n*n,o=s*(a*a-r)+r;return o<0?0:Math.sqrt(o)},Wj=[ed,Za,qi],Ij=n=>Wj.find(a=>a.test(n));function $v(n){const a=Ij(n);if(!a)return!1;let s=a.parse(n);return a===qi&&(s=Jj(s)),s}const qv=(n,a)=>{const s=$v(n),r=$v(a);if(!s||!r)return So(n,a);const o={...s};return d=>(o.red=jf(s.red,r.red,d),o.green=jf(s.green,r.green,d),o.blue=jf(s.blue,r.blue,d),o.alpha=He(s.alpha,r.alpha,d),Za.transform(o))},td=new Set(["none","hidden"]);function eE(n,a){return td.has(n)?s=>s<=0?n:a:s=>s>=1?a:n}function tE(n,a){return s=>He(n,a,s)}function Yd(n){return typeof n=="number"?tE:typeof n=="string"?Hd(n)?So:Ie.test(n)?qv:iE:Array.isArray(n)?Ty:typeof n=="object"?Ie.test(n)?qv:nE:So}function Ty(n,a){const s=[...n],r=s.length,o=n.map((d,h)=>Yd(d)(d,a[h]));return d=>{for(let h=0;h<r;h++)s[h]=o[h](d);return s}}function nE(n,a){const s={...n,...a},r={};for(const o in s)n[o]!==void 0&&a[o]!==void 0&&(r[o]=Yd(n[o])(n[o],a[o]));return o=>{for(const d in r)s[d]=r[d](o);return s}}function aE(n,a){const s=[],r={color:0,var:0,number:0};for(let o=0;o<a.values.length;o++){const d=a.types[o],h=n.indexes[d][r[d]],p=n.values[h]??0;s[o]=p,r[d]++}return s}const iE=(n,a)=>{const s=sn.createTransformer(a),r=Zi(n),o=Zi(a);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?td.has(n)&&!o.values.length||td.has(a)&&!r.values.length?eE(n,a):El(Ty(aE(r,o),o.values),s):So(n,a)};function jy(n,a,s){return typeof n=="number"&&typeof a=="number"&&typeof s=="number"?He(n,a,s):Yd(n)(n,a)}const sE=n=>{const a=({timestamp:s})=>n(s);return{start:(s=!0)=>ke.update(a,s),stop:()=>xa(a),now:()=>ct.isProcessing?ct.timestamp:vt.now()}},Ey=(n,a,s=10)=>{let r="";const o=Math.max(Math.round(a/s),2);for(let d=0;d<o;d++)r+=Math.round(n(d/(o-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},wo=2e4;function Gd(n){let a=0;const s=50;let r=n.next(a);for(;!r.done&&a<wo;)a+=s,r=n.next(a);return a>=wo?1/0:a}function lE(n,a=100,s){const r=s({...n,keyframes:[0,a]}),o=Math.min(Gd(r),wo);return{type:"keyframes",ease:d=>r.next(o*d).value/a,duration:Pt(o)}}const Ge={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function nd(n,a){return n*Math.sqrt(1-a*a)}const rE=12;function oE(n,a,s){let r=s;for(let o=1;o<rE;o++)r=r-n(r)/a(r);return r}const Ef=.001;function uE({duration:n=Ge.duration,bounce:a=Ge.bounce,velocity:s=Ge.velocity,mass:r=Ge.mass}){let o,d,h=1-a;h=pn(Ge.minDamping,Ge.maxDamping,h),n=pn(Ge.minDuration,Ge.maxDuration,Pt(n)),h<1?(o=g=>{const x=g*h,y=x*n,S=x-s,w=nd(g,h),j=Math.exp(-y);return Ef-S/w*j},d=g=>{const y=g*h*n,S=y*s+s,w=Math.pow(h,2)*Math.pow(g,2)*n,j=Math.exp(-y),E=nd(Math.pow(g,2),h);return(-o(g)+Ef>0?-1:1)*((S-w)*j)/E}):(o=g=>{const x=Math.exp(-g*n),y=(g-s)*n+1;return-Ef+x*y},d=g=>{const x=Math.exp(-g*n),y=(s-g)*(n*n);return x*y});const p=5/n,m=oE(o,d,p);if(n=Ut(n),isNaN(m))return{stiffness:Ge.stiffness,damping:Ge.damping,duration:n};{const g=Math.pow(m,2)*r;return{stiffness:g,damping:h*2*Math.sqrt(r*g),duration:n}}}const cE=["duration","bounce"],fE=["stiffness","damping","mass"];function Yv(n,a){return a.some(s=>n[s]!==void 0)}function dE(n){let a={velocity:Ge.velocity,stiffness:Ge.stiffness,damping:Ge.damping,mass:Ge.mass,isResolvedFromDuration:!1,...n};if(!Yv(n,fE)&&Yv(n,cE))if(a.velocity=0,n.visualDuration){const s=n.visualDuration,r=2*Math.PI/(s*1.2),o=r*r,d=2*pn(.05,1,1-(n.bounce||0))*Math.sqrt(o);a={...a,mass:Ge.mass,stiffness:o,damping:d}}else{const s=uE({...n,velocity:0});a={...a,...s,mass:Ge.mass},a.isResolvedFromDuration=!0}return a}function To(n=Ge.visualDuration,a=Ge.bounce){const s=typeof n!="object"?{visualDuration:n,keyframes:[0,1],bounce:a}:n;let{restSpeed:r,restDelta:o}=s;const d=s.keyframes[0],h=s.keyframes[s.keyframes.length-1],p={done:!1,value:d},{stiffness:m,damping:g,mass:x,duration:y,velocity:S,isResolvedFromDuration:w}=dE({...s,velocity:-Pt(s.velocity||0)}),j=S||0,E=g/(2*Math.sqrt(m*x)),C=h-d,z=Pt(Math.sqrt(m/x)),D=Math.abs(C)<5;r||(r=D?Ge.restSpeed.granular:Ge.restSpeed.default),o||(o=D?Ge.restDelta.granular:Ge.restDelta.default);let R,k,U,P,F,W;if(E<1)U=nd(z,E),P=(j+E*z*C)/U,R=B=>{const Z=Math.exp(-E*z*B);return h-Z*(P*Math.sin(U*B)+C*Math.cos(U*B))},F=E*z*P+C*U,W=E*z*C-P*U,k=B=>Math.exp(-E*z*B)*(F*Math.sin(U*B)+W*Math.cos(U*B));else if(E===1){R=Z=>h-Math.exp(-z*Z)*(C+(j+z*C)*Z);const B=j+z*C;k=Z=>Math.exp(-z*Z)*(z*B*Z-j)}else{const B=z*Math.sqrt(E*E-1);R=Se=>{const De=Math.exp(-E*z*Se),$=Math.min(B*Se,300);return h-De*((j+E*z*C)*Math.sinh($)+B*C*Math.cosh($))/B};const Z=(j+E*z*C)/B,ie=E*z*Z-C*B,le=E*z*C-Z*B;k=Se=>{const De=Math.exp(-E*z*Se),$=Math.min(B*Se,300);return De*(ie*Math.sinh($)+le*Math.cosh($))}}const re={calculatedDuration:w&&y||null,velocity:B=>Ut(k(B)),next:B=>{if(!w&&E<1){const ie=Math.exp(-E*z*B),le=Math.sin(U*B),Se=Math.cos(U*B),De=h-ie*(P*le+C*Se),$=Ut(ie*(F*le+W*Se));return p.done=Math.abs($)<=r&&Math.abs(h-De)<=o,p.value=p.done?h:De,p}const Z=R(B);if(w)p.done=B>=y;else{const ie=Ut(k(B));p.done=Math.abs(ie)<=r&&Math.abs(h-Z)<=o}return p.value=p.done?h:Z,p},toString:()=>{const B=Math.min(Gd(re),wo),Z=Ey(ie=>re.next(B*ie).value,B,30);return B+"ms "+Z},toTransition:()=>{}};return re}To.applyToOptions=n=>{const a=lE(n,100,To);return n.ease=a.ease,n.duration=Ut(a.duration),n.type="keyframes",n};const hE=5;function Ny(n,a,s){const r=Math.max(a-hE,0);return sy(s-n(r),a-r)}function ad({keyframes:n,velocity:a=0,power:s=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:d=500,modifyTarget:h,min:p,max:m,restDelta:g=.5,restSpeed:x}){const y=n[0],S={done:!1,value:y},w=W=>p!==void 0&&W<p||m!==void 0&&W>m,j=W=>p===void 0?m:m===void 0||Math.abs(p-W)<Math.abs(m-W)?p:m;let E=s*a;const C=y+E,z=h===void 0?C:h(C);z!==C&&(E=z-y);const D=W=>-E*Math.exp(-W/r),R=W=>z+D(W),k=W=>{const re=D(W),B=R(W);S.done=Math.abs(re)<=g,S.value=S.done?z:B};let U,P;const F=W=>{w(S.value)&&(U=W,P=To({keyframes:[S.value,j(S.value)],velocity:Ny(R,W,S.value),damping:o,stiffness:d,restDelta:g,restSpeed:x}))};return F(0),{calculatedDuration:null,next:W=>{let re=!1;return!P&&U===void 0&&(re=!0,k(W),F(W)),U!==void 0&&W>=U?P.next(W-U):(!re&&k(W),S)}}}function mE(n,a,s){const r=[],o=s||va.mix||jy,d=n.length-1;for(let h=0;h<d;h++){let p=o(n[h],n[h+1]);if(a){const m=Array.isArray(a)?a[h]||Jt:a;p=El(m,p)}r.push(p)}return r}function pE(n,a,{clamp:s=!0,ease:r,mixer:o}={}){const d=n.length;if(Vd(d===a.length),d===1)return()=>a[0];if(d===2&&a[0]===a[1])return()=>a[1];const h=n[0]===n[1];n[0]>n[d-1]&&(n=[...n].reverse(),a=[...a].reverse());const p=mE(a,r,o),m=p.length,g=x=>{if(h&&x<n[0])return a[0];let y=0;if(m>1)for(;y<n.length-2&&!(x<n[y+1]);y++);const S=vl(n[y],n[y+1],x);return p[y](S)};return s?x=>g(pn(n[0],n[d-1],x)):g}function gE(n,a){const s=n[n.length-1];for(let r=1;r<=a;r++){const o=vl(0,a,r);n.push(He(s,1,o))}}function vE(n){const a=[0];return gE(a,n.length-1),a}function xE(n,a){return n.map(s=>s*a)}function yE(n,a){return n.map(()=>a||my).splice(0,n.length-1)}function dl({duration:n=300,keyframes:a,times:s,ease:r="easeInOut"}){const o=Aj(r)?r.map(_v):_v(r),d={done:!1,value:a[0]},h=xE(s&&s.length===a.length?s:vE(a),n),p=pE(h,a,{ease:Array.isArray(o)?o:yE(a,o)});return{calculatedDuration:n,next:m=>(d.value=p(m),d.done=m>=n,d)}}const bE=n=>n!==null;function Bo(n,{repeat:a,repeatType:s="loop"},r,o=1){const d=n.filter(bE),p=o<0||a&&s!=="loop"&&a%2===1?0:d.length-1;return!p||r===void 0?d[p]:r}const SE={decay:ad,inertia:ad,tween:dl,keyframes:dl,spring:To};function Ay(n){typeof n.type=="string"&&(n.type=SE[n.type])}class Xd{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(a=>{this.resolve=a})}notifyFinished(){this.resolve()}then(a,s){return this.finished.then(a,s)}}const wE=n=>n/100;class jo extends Xd{constructor(a){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var r,o;const{motionValue:s}=this.options;s&&s.updatedAt!==vt.now()&&this.tick(vt.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(o=(r=this.options).onStop)==null||o.call(r))},this.options=a,this.initAnimation(),this.play(),a.autoplay===!1&&this.pause()}initAnimation(){const{options:a}=this;Ay(a);const{type:s=dl,repeat:r=0,repeatDelay:o=0,repeatType:d,velocity:h=0}=a;let{keyframes:p}=a;const m=s||dl;m!==dl&&typeof p[0]!="number"&&(this.mixKeyframes=El(wE,jy(p[0],p[1])),p=[0,100]);const g=m({...a,keyframes:p});d==="mirror"&&(this.mirroredGenerator=m({...a,keyframes:[...p].reverse(),velocity:-h})),g.calculatedDuration===null&&(g.calculatedDuration=Gd(g));const{calculatedDuration:x}=g;this.calculatedDuration=x,this.resolvedDuration=x+o,this.totalDuration=this.resolvedDuration*(r+1)-o,this.generator=g}updateTime(a){const s=Math.round(a-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=s}tick(a,s=!1){const{generator:r,totalDuration:o,mixKeyframes:d,mirroredGenerator:h,resolvedDuration:p,calculatedDuration:m}=this;if(this.startTime===null)return r.next(0);const{delay:g=0,keyframes:x,repeat:y,repeatType:S,repeatDelay:w,type:j,onUpdate:E,finalKeyframe:C}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,a):this.speed<0&&(this.startTime=Math.min(a-o/this.speed,this.startTime)),s?this.currentTime=a:this.updateTime(a);const z=this.currentTime-g*(this.playbackSpeed>=0?1:-1),D=this.playbackSpeed>=0?z<0:z>o;this.currentTime=Math.max(z,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let R=this.currentTime,k=r;if(y){const W=Math.min(this.currentTime,o)/p;let re=Math.floor(W),B=W%1;!B&&W>=1&&(B=1),B===1&&re--,re=Math.min(re,y+1),!!(re%2)&&(S==="reverse"?(B=1-B,w&&(B-=w/p)):S==="mirror"&&(k=h)),R=pn(0,1,B)*p}let U;D?(this.delayState.value=x[0],U=this.delayState):U=k.next(R),d&&!D&&(U.value=d(U.value));let{done:P}=U;!D&&m!==null&&(P=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const F=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&P);return F&&j!==ad&&(U.value=Bo(x,this.options,C,this.speed)),E&&E(U.value),F&&this.finish(),U}then(a,s){return this.finished.then(a,s)}get duration(){return Pt(this.calculatedDuration)}get iterationDuration(){const{delay:a=0}=this.options||{};return this.duration+Pt(a)}get time(){return Pt(this.currentTime)}set time(a){a=Ut(a),this.currentTime=a,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=a:this.driver&&(this.startTime=this.driver.now()-a/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=a,this.tick(a))}getGeneratorVelocity(){const a=this.currentTime;if(a<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(a);const s=this.generator.next(a).value;return Ny(r=>this.generator.next(r).value,a,s)}get speed(){return this.playbackSpeed}set speed(a){const s=this.playbackSpeed!==a;s&&this.driver&&this.updateTime(vt.now()),this.playbackSpeed=a,s&&this.driver&&(this.time=Pt(this.currentTime))}play(){var o,d;if(this.isStopped)return;const{driver:a=sE,startTime:s}=this.options;this.driver||(this.driver=a(h=>this.tick(h))),(d=(o=this.options).onPlay)==null||d.call(o);const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=s??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(vt.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var a,s;this.notifyFinished(),this.teardown(),this.state="finished",(s=(a=this.options).onComplete)==null||s.call(a)}cancel(){var a,s;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(s=(a=this.options).onCancel)==null||s.call(a)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(a){return this.startTime=0,this.tick(a,!0)}attachTimeline(a){var s;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(s=this.driver)==null||s.stop(),a.observe(this)}}function TE(n){for(let a=1;a<n.length;a++)n[a]??(n[a]=n[a-1])}const Qa=n=>n*180/Math.PI,id=n=>{const a=Qa(Math.atan2(n[1],n[0]));return sd(a)},jE={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:n=>(Math.abs(n[0])+Math.abs(n[3]))/2,rotate:id,rotateZ:id,skewX:n=>Qa(Math.atan(n[1])),skewY:n=>Qa(Math.atan(n[2])),skew:n=>(Math.abs(n[1])+Math.abs(n[2]))/2},sd=n=>(n=n%360,n<0&&(n+=360),n),Gv=id,Xv=n=>Math.sqrt(n[0]*n[0]+n[1]*n[1]),Kv=n=>Math.sqrt(n[4]*n[4]+n[5]*n[5]),EE={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Xv,scaleY:Kv,scale:n=>(Xv(n)+Kv(n))/2,rotateX:n=>sd(Qa(Math.atan2(n[6],n[5]))),rotateY:n=>sd(Qa(Math.atan2(-n[2],n[0]))),rotateZ:Gv,rotate:Gv,skewX:n=>Qa(Math.atan(n[4])),skewY:n=>Qa(Math.atan(n[1])),skew:n=>(Math.abs(n[1])+Math.abs(n[4]))/2};function ld(n){return n.includes("scale")?1:0}function rd(n,a){if(!n||n==="none")return ld(a);const s=n.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,o;if(s)r=EE,o=s;else{const p=n.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=jE,o=p}if(!o)return ld(a);const d=r[a],h=o[1].split(",").map(AE);return typeof d=="function"?d(h):h[d]}const NE=(n,a)=>{const{transform:s="none"}=getComputedStyle(n);return rd(s,a)};function AE(n){return parseFloat(n.trim())}const es=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ts=new Set(es),Fv=n=>n===Ii||n===te,CE=new Set(["x","y","z"]),ME=es.filter(n=>!CE.has(n));function DE(n){const a=[];return ME.forEach(s=>{const r=n.getValue(s);r!==void 0&&(a.push([s,r.get()]),r.set(s.startsWith("scale")?1:0))}),a}const pa={width:({x:n},{paddingLeft:a="0",paddingRight:s="0",boxSizing:r})=>{const o=n.max-n.min;return r==="border-box"?o:o-parseFloat(a)-parseFloat(s)},height:({y:n},{paddingTop:a="0",paddingBottom:s="0",boxSizing:r})=>{const o=n.max-n.min;return r==="border-box"?o:o-parseFloat(a)-parseFloat(s)},top:(n,{top:a})=>parseFloat(a),left:(n,{left:a})=>parseFloat(a),bottom:({y:n},{top:a})=>parseFloat(a)+(n.max-n.min),right:({x:n},{left:a})=>parseFloat(a)+(n.max-n.min),x:(n,{transform:a})=>rd(a,"x"),y:(n,{transform:a})=>rd(a,"y")};pa.translateX=pa.x;pa.translateY=pa.y;const Pa=new Set;let od=!1,ud=!1,cd=!1;function Cy(){if(ud){const n=Array.from(Pa).filter(r=>r.needsMeasurement),a=new Set(n.map(r=>r.element)),s=new Map;a.forEach(r=>{const o=DE(r);o.length&&(s.set(r,o),r.render())}),n.forEach(r=>r.measureInitialState()),a.forEach(r=>{r.render();const o=s.get(r);o&&o.forEach(([d,h])=>{var p;(p=r.getValue(d))==null||p.set(h)})}),n.forEach(r=>r.measureEndState()),n.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}ud=!1,od=!1,Pa.forEach(n=>n.complete(cd)),Pa.clear()}function My(){Pa.forEach(n=>{n.readKeyframes(),n.needsMeasurement&&(ud=!0)})}function OE(){cd=!0,My(),Cy(),cd=!1}class Kd{constructor(a,s,r,o,d,h=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...a],this.onComplete=s,this.name=r,this.motionValue=o,this.element=d,this.isAsync=h}scheduleResolve(){this.state="scheduled",this.isAsync?(Pa.add(this),od||(od=!0,ke.read(My),ke.resolveKeyframes(Cy))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:a,name:s,element:r,motionValue:o}=this;if(a[0]===null){const d=o==null?void 0:o.get(),h=a[a.length-1];if(d!==void 0)a[0]=d;else if(r&&s){const p=r.readValue(s,h);p!=null&&(a[0]=p)}a[0]===void 0&&(a[0]=h),o&&d===void 0&&o.set(a[0])}TE(a)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(a=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,a),Pa.delete(this)}cancel(){this.state==="scheduled"&&(Pa.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const RE=n=>n.startsWith("--");function Dy(n,a,s){RE(a)?n.style.setProperty(a,s):n.style[a]=s}const zE={};function Oy(n,a){const s=iy(n);return()=>zE[a]??s()}const kE=Oy(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),Ry=Oy(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),il=([n,a,s,r])=>`cubic-bezier(${n}, ${a}, ${s}, ${r})`,Zv={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:il([0,.65,.55,1]),circOut:il([.55,0,1,.45]),backIn:il([.31,.01,.66,-.59]),backOut:il([.33,1.53,.69,.99])};function zy(n,a){if(n)return typeof n=="function"?Ry()?Ey(n,a):"ease-out":py(n)?il(n):Array.isArray(n)?n.map(s=>zy(s,a)||Zv.easeOut):Zv[n]}function LE(n,a,s,{delay:r=0,duration:o=300,repeat:d=0,repeatType:h="loop",ease:p="easeOut",times:m}={},g=void 0){const x={[a]:s};m&&(x.offset=m);const y=zy(p,o);Array.isArray(y)&&(x.easing=y);const S={delay:r,duration:o,easing:Array.isArray(y)?"linear":y,fill:"both",iterations:d+1,direction:h==="reverse"?"alternate":"normal"};return g&&(S.pseudoElement=g),n.animate(x,S)}function ky(n){return typeof n=="function"&&"applyToOptions"in n}function VE({type:n,...a}){return ky(n)&&Ry()?n.applyToOptions(a):(a.duration??(a.duration=300),a.ease??(a.ease="easeOut"),a)}class Ly extends Xd{constructor(a){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!a)return;const{element:s,name:r,keyframes:o,pseudoElement:d,allowFlatten:h=!1,finalKeyframe:p,onComplete:m}=a;this.isPseudoElement=!!d,this.allowFlatten=h,this.options=a,Vd(typeof a.type!="string");const g=VE(a);this.animation=LE(s,r,o,g,d),g.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!d){const x=Bo(o,this.options,p,this.speed);this.updateMotionValue&&this.updateMotionValue(x),Dy(s,r,x),this.animation.cancel()}m==null||m(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var a,s;(s=(a=this.animation).finish)==null||s.call(a)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:a}=this;a==="idle"||a==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var s,r,o;const a=(s=this.options)==null?void 0:s.element;!this.isPseudoElement&&(a!=null&&a.isConnected)&&((o=(r=this.animation).commitStyles)==null||o.call(r))}get duration(){var s,r;const a=((r=(s=this.animation.effect)==null?void 0:s.getComputedTiming)==null?void 0:r.call(s).duration)||0;return Pt(Number(a))}get iterationDuration(){const{delay:a=0}=this.options||{};return this.duration+Pt(a)}get time(){return Pt(Number(this.animation.currentTime)||0)}set time(a){const s=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Ut(a),s&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(a){a<0&&(this.finishedTime=null),this.animation.playbackRate=a}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(a){this.manualStartTime=this.animation.startTime=a}attachTimeline({timeline:a,rangeStart:s,rangeEnd:r,observe:o}){var d;return this.allowFlatten&&((d=this.animation.effect)==null||d.updateTiming({easing:"linear"})),this.animation.onfinish=null,a&&kE()?(this.animation.timeline=a,s&&(this.animation.rangeStart=s),r&&(this.animation.rangeEnd=r),Jt):o(this)}}const Vy={anticipate:fy,backInOut:cy,circInOut:hy};function _E(n){return n in Vy}function UE(n){typeof n.ease=="string"&&_E(n.ease)&&(n.ease=Vy[n.ease])}const Nf=10;class BE extends Ly{constructor(a){UE(a),Ay(a),super(a),a.startTime!==void 0&&a.autoplay!==!1&&(this.startTime=a.startTime),this.options=a}updateMotionValue(a){const{motionValue:s,onUpdate:r,onComplete:o,element:d,...h}=this.options;if(!s)return;if(a!==void 0){s.set(a);return}const p=new jo({...h,autoplay:!1}),m=Math.max(Nf,vt.now()-this.startTime),g=pn(0,Nf,m-Nf),x=p.sample(m).value,{name:y}=this.options;d&&y&&Dy(d,y,x),s.setWithVelocity(p.sample(Math.max(0,m-g)).value,x,g),p.stop()}}const Qv=(n,a)=>a==="zIndex"?!1:!!(typeof n=="number"||Array.isArray(n)||typeof n=="string"&&(sn.test(n)||n==="0")&&!n.startsWith("url("));function HE(n){const a=n[0];if(n.length===1)return!0;for(let s=0;s<n.length;s++)if(n[s]!==a)return!0}function $E(n,a,s,r){const o=n[0];if(o===null)return!1;if(a==="display"||a==="visibility")return!0;const d=n[n.length-1],h=Qv(o,a),p=Qv(d,a);return!h||!p?!1:HE(n)||(s==="spring"||ky(s))&&r}function fd(n){n.duration=0,n.type="keyframes"}const _y=new Set(["opacity","clipPath","filter","transform"]),qE=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function YE(n){for(let a=0;a<n.length;a++)if(typeof n[a]=="string"&&qE.test(n[a]))return!0;return!1}const GE=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),XE=iy(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function KE(n){var y;const{motionValue:a,name:s,repeatDelay:r,repeatType:o,damping:d,type:h,keyframes:p}=n;if(!(((y=a==null?void 0:a.owner)==null?void 0:y.current)instanceof HTMLElement))return!1;const{onUpdate:g,transformTemplate:x}=a.owner.getProps();return XE()&&s&&(_y.has(s)||GE.has(s)&&YE(p))&&(s!=="transform"||!x)&&!g&&!r&&o!=="mirror"&&d!==0&&h!=="inertia"}const FE=40;class ZE extends Xd{constructor({autoplay:a=!0,delay:s=0,type:r="keyframes",repeat:o=0,repeatDelay:d=0,repeatType:h="loop",keyframes:p,name:m,motionValue:g,element:x,...y}){var j;super(),this.stop=()=>{var E,C;this._animation&&(this._animation.stop(),(E=this.stopTimeline)==null||E.call(this)),(C=this.keyframeResolver)==null||C.cancel()},this.createdAt=vt.now();const S={autoplay:a,delay:s,type:r,repeat:o,repeatDelay:d,repeatType:h,name:m,motionValue:g,element:x,...y},w=(x==null?void 0:x.KeyframeResolver)||Kd;this.keyframeResolver=new w(p,(E,C,z)=>this.onKeyframesResolved(E,C,S,!z),m,g,x),(j=this.keyframeResolver)==null||j.scheduleResolve()}onKeyframesResolved(a,s,r,o){var z,D;this.keyframeResolver=void 0;const{name:d,type:h,velocity:p,delay:m,isHandoff:g,onUpdate:x}=r;this.resolvedAt=vt.now();let y=!0;$E(a,d,h,p)||(y=!1,(va.instantAnimations||!m)&&(x==null||x(Bo(a,r,s))),a[0]=a[a.length-1],fd(r),r.repeat=0);const w={startTime:o?this.resolvedAt?this.resolvedAt-this.createdAt>FE?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:s,...r,keyframes:a},j=y&&!g&&KE(w),E=(D=(z=w.motionValue)==null?void 0:z.owner)==null?void 0:D.current;let C;if(j)try{C=new BE({...w,element:E})}catch{C=new jo(w)}else C=new jo(w);C.finished.then(()=>{this.notifyFinished()}).catch(Jt),this.pendingTimeline&&(this.stopTimeline=C.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=C}get finished(){return this._animation?this.animation.finished:this._finished}then(a,s){return this.finished.finally(a).then(()=>{})}get animation(){var a;return this._animation||((a=this.keyframeResolver)==null||a.resume(),OE()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(a){this.animation.time=a}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(a){this.animation.speed=a}get startTime(){return this.animation.startTime}attachTimeline(a){return this._animation?this.stopTimeline=this.animation.attachTimeline(a):this.pendingTimeline=a,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var a;this._animation&&this.animation.cancel(),(a=this.keyframeResolver)==null||a.cancel()}}function Uy(n,a,s,r=0,o=1){const d=Array.from(n).sort((g,x)=>g.sortNodePosition(x)).indexOf(a),h=n.size,p=(h-1)*r;return typeof s=="function"?s(d,h):o===1?d*r:p-d*r}const QE=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function PE(n){const a=QE.exec(n);if(!a)return[,];const[,s,r,o]=a;return[`--${s??r}`,o]}function By(n,a,s=1){const[r,o]=PE(n);if(!r)return;const d=window.getComputedStyle(a).getPropertyValue(r);if(d){const h=d.trim();return ty(h)?parseFloat(h):h}return Hd(o)?By(o,a,s+1):o}const JE={type:"spring",stiffness:500,damping:25,restSpeed:10},WE=n=>({type:"spring",stiffness:550,damping:n===0?2*Math.sqrt(550):30,restSpeed:10}),IE={type:"keyframes",duration:.8},e5={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},t5=(n,{keyframes:a})=>a.length>2?IE:ts.has(n)?n.startsWith("scale")?WE(a[1]):JE:e5;function Hy(n,a){if(n!=null&&n.inherit&&a){const{inherit:s,...r}=n;return{...a,...r}}return n}function Fd(n,a){const s=(n==null?void 0:n[a])??(n==null?void 0:n.default)??n;return s!==n?Hy(s,n):s}const n5=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function a5(n){for(const a in n)if(!n5.has(a))return!0;return!1}const Zd=(n,a,s,r={},o,d)=>h=>{const p=Fd(r,n)||{},m=p.delay||r.delay||0;let{elapsed:g=0}=r;g=g-Ut(m);const x={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:a.getVelocity(),...p,delay:-g,onUpdate:S=>{a.set(S),p.onUpdate&&p.onUpdate(S)},onComplete:()=>{h(),p.onComplete&&p.onComplete()},name:n,motionValue:a,element:d?void 0:o};a5(p)||Object.assign(x,t5(n,x)),x.duration&&(x.duration=Ut(x.duration)),x.repeatDelay&&(x.repeatDelay=Ut(x.repeatDelay)),x.from!==void 0&&(x.keyframes[0]=x.from);let y=!1;if((x.type===!1||x.duration===0&&!x.repeatDelay)&&(fd(x),x.delay===0&&(y=!0)),(va.instantAnimations||va.skipAnimations||o!=null&&o.shouldSkipAnimations)&&(y=!0,fd(x),x.delay=0),x.allowFlatten=!p.type&&!p.ease,y&&!d&&a.get()!==void 0){const S=Bo(x.keyframes,p);if(S!==void 0){ke.update(()=>{x.onUpdate(S),x.onComplete()});return}}return p.isSync?new jo(x):new ZE(x)};function Pv(n){const a=[{},{}];return n==null||n.values.forEach((s,r)=>{a[0][r]=s.get(),a[1][r]=s.getVelocity()}),a}function Qd(n,a,s,r){if(typeof a=="function"){const[o,d]=Pv(r);a=a(s!==void 0?s:n.custom,o,d)}if(typeof a=="string"&&(a=n.variants&&n.variants[a]),typeof a=="function"){const[o,d]=Pv(r);a=a(s!==void 0?s:n.custom,o,d)}return a}function Ja(n,a,s){const r=n.getProps();return Qd(r,a,s!==void 0?s:r.custom,n)}const $y=new Set(["width","height","top","left","right","bottom",...es]),Jv=30,i5=n=>!isNaN(parseFloat(n));class s5{constructor(a,s={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{var d;const o=vt.now();if(this.updatedAt!==o&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&((d=this.events.change)==null||d.notify(this.current),this.dependents))for(const h of this.dependents)h.dirty()},this.hasAnimated=!1,this.setCurrent(a),this.owner=s.owner}setCurrent(a){this.current=a,this.updatedAt=vt.now(),this.canTrackVelocity===null&&a!==void 0&&(this.canTrackVelocity=i5(this.current))}setPrevFrameValue(a=this.current){this.prevFrameValue=a,this.prevUpdatedAt=this.updatedAt}onChange(a){return this.on("change",a)}on(a,s){this.events[a]||(this.events[a]=new _d);const r=this.events[a].add(s);return a==="change"?()=>{r(),ke.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const a in this.events)this.events[a].clear()}attach(a,s){this.passiveEffect=a,this.stopPassiveEffect=s}set(a){this.passiveEffect?this.passiveEffect(a,this.updateAndNotify):this.updateAndNotify(a)}setWithVelocity(a,s,r){this.set(s),this.prev=void 0,this.prevFrameValue=a,this.prevUpdatedAt=this.updatedAt-r}jump(a,s=!0){this.updateAndNotify(a),this.prev=a,this.prevUpdatedAt=this.prevFrameValue=void 0,s&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var a;(a=this.events.change)==null||a.notify(this.current)}addDependent(a){this.dependents||(this.dependents=new Set),this.dependents.add(a)}removeDependent(a){this.dependents&&this.dependents.delete(a)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const a=vt.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||a-this.updatedAt>Jv)return 0;const s=Math.min(this.updatedAt-this.prevUpdatedAt,Jv);return sy(parseFloat(this.current)-parseFloat(this.prevFrameValue),s)}start(a){return this.stop(),new Promise(s=>{this.hasAnimated=!0,this.animation=a(s),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var a,s;(a=this.dependents)==null||a.clear(),(s=this.events.destroy)==null||s.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Qi(n,a){return new s5(n,a)}const dd=n=>Array.isArray(n);function l5(n,a,s){n.hasValue(a)?n.getValue(a).set(s):n.addValue(a,Qi(s))}function r5(n){return dd(n)?n[n.length-1]||0:n}function o5(n,a){const s=Ja(n,a);let{transitionEnd:r={},transition:o={},...d}=s||{};d={...d,...r};for(const h in d){const p=r5(d[h]);l5(n,h,p)}}const ft=n=>!!(n&&n.getVelocity);function u5(n){return!!(ft(n)&&n.add)}function hd(n,a){const s=n.getValue("willChange");if(u5(s))return s.add(a);if(!s&&va.WillChange){const r=new va.WillChange("auto");n.addValue("willChange",r),r.add(a)}}function Pd(n){return n.replace(/([A-Z])/g,a=>`-${a.toLowerCase()}`)}const c5="framerAppearId",qy="data-"+Pd(c5);function Yy(n){return n.props[qy]}function f5({protectedKeys:n,needsAnimating:a},s){const r=n.hasOwnProperty(s)&&a[s]!==!0;return a[s]=!1,r}function Gy(n,a,{delay:s=0,transitionOverride:r,type:o}={}){let{transition:d,transitionEnd:h,...p}=a;const m=n.getDefaultTransition();d=d?Hy(d,m):m;const g=d==null?void 0:d.reduceMotion;r&&(d=r);const x=[],y=o&&n.animationState&&n.animationState.getState()[o];for(const S in p){const w=n.getValue(S,n.latestValues[S]??null),j=p[S];if(j===void 0||y&&f5(y,S))continue;const E={delay:s,...Fd(d||{},S)},C=w.get();if(C!==void 0&&!w.isAnimating()&&!Array.isArray(j)&&j===C&&!E.velocity){ke.update(()=>w.set(j));continue}let z=!1;if(window.MotionHandoffAnimation){const k=Yy(n);if(k){const U=window.MotionHandoffAnimation(k,S,ke);U!==null&&(E.startTime=U,z=!0)}}hd(n,S);const D=g??n.shouldReduceMotion;w.start(Zd(S,w,j,D&&$y.has(S)?{type:!1}:E,n,z));const R=w.animation;R&&x.push(R)}if(h){const S=()=>ke.update(()=>{h&&o5(n,h)});x.length?Promise.all(x).then(S):S()}return x}function md(n,a,s={}){var m;const r=Ja(n,a,s.type==="exit"?(m=n.presenceContext)==null?void 0:m.custom:void 0);let{transition:o=n.getDefaultTransition()||{}}=r||{};s.transitionOverride&&(o=s.transitionOverride);const d=r?()=>Promise.all(Gy(n,r,s)):()=>Promise.resolve(),h=n.variantChildren&&n.variantChildren.size?(g=0)=>{const{delayChildren:x=0,staggerChildren:y,staggerDirection:S}=o;return d5(n,a,g,x,y,S,s)}:()=>Promise.resolve(),{when:p}=o;if(p){const[g,x]=p==="beforeChildren"?[d,h]:[h,d];return g().then(()=>x())}else return Promise.all([d(),h(s.delay)])}function d5(n,a,s=0,r=0,o=0,d=1,h){const p=[];for(const m of n.variantChildren)m.notify("AnimationStart",a),p.push(md(m,a,{...h,delay:s+(typeof r=="function"?0:r)+Uy(n.variantChildren,m,r,o,d)}).then(()=>m.notify("AnimationComplete",a)));return Promise.all(p)}function h5(n,a,s={}){n.notify("AnimationStart",a);let r;if(Array.isArray(a)){const o=a.map(d=>md(n,d,s));r=Promise.all(o)}else if(typeof a=="string")r=md(n,a,s);else{const o=typeof a=="function"?Ja(n,a,s.custom):a;r=Promise.all(Gy(n,o,s))}return r.then(()=>{n.notify("AnimationComplete",a)})}const m5={test:n=>n==="auto",parse:n=>n},Xy=n=>a=>a.test(n),Ky=[Ii,te,mn,ca,Hj,Bj,m5],Wv=n=>Ky.find(Xy(n));function p5(n){return typeof n=="number"?n===0:n!==null?n==="none"||n==="0"||ay(n):!0}const g5=new Set(["brightness","contrast","saturate","opacity"]);function v5(n){const[a,s]=n.slice(0,-1).split("(");if(a==="drop-shadow")return n;const[r]=s.match($d)||[];if(!r)return n;const o=s.replace(r,"");let d=g5.has(a)?1:0;return r!==s&&(d*=100),a+"("+d+o+")"}const x5=/\b([a-z-]*)\(.*?\)/gu,pd={...sn,getAnimatableNone:n=>{const a=n.match(x5);return a?a.map(v5).join(" "):n}},gd={...sn,getAnimatableNone:n=>{const a=sn.parse(n);return sn.createTransformer(n)(a.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},Iv={...Ii,transform:Math.round},y5={rotate:ca,rotateX:ca,rotateY:ca,rotateZ:ca,scale:Ir,scaleX:Ir,scaleY:Ir,scaleZ:Ir,skew:ca,skewX:ca,skewY:ca,distance:te,translateX:te,translateY:te,translateZ:te,x:te,y:te,z:te,perspective:te,transformPerspective:te,opacity:xl,originX:Bv,originY:Bv,originZ:te},Jd={borderWidth:te,borderTopWidth:te,borderRightWidth:te,borderBottomWidth:te,borderLeftWidth:te,borderRadius:te,borderTopLeftRadius:te,borderTopRightRadius:te,borderBottomRightRadius:te,borderBottomLeftRadius:te,width:te,maxWidth:te,height:te,maxHeight:te,top:te,right:te,bottom:te,left:te,inset:te,insetBlock:te,insetBlockStart:te,insetBlockEnd:te,insetInline:te,insetInlineStart:te,insetInlineEnd:te,padding:te,paddingTop:te,paddingRight:te,paddingBottom:te,paddingLeft:te,paddingBlock:te,paddingBlockStart:te,paddingBlockEnd:te,paddingInline:te,paddingInlineStart:te,paddingInlineEnd:te,margin:te,marginTop:te,marginRight:te,marginBottom:te,marginLeft:te,marginBlock:te,marginBlockStart:te,marginBlockEnd:te,marginInline:te,marginInlineStart:te,marginInlineEnd:te,fontSize:te,backgroundPositionX:te,backgroundPositionY:te,...y5,zIndex:Iv,fillOpacity:xl,strokeOpacity:xl,numOctaves:Iv},b5={...Jd,color:Ie,backgroundColor:Ie,outlineColor:Ie,fill:Ie,stroke:Ie,borderColor:Ie,borderTopColor:Ie,borderRightColor:Ie,borderBottomColor:Ie,borderLeftColor:Ie,filter:pd,WebkitFilter:pd,mask:gd,WebkitMask:gd},Fy=n=>b5[n],S5=new Set([pd,gd]);function Zy(n,a){let s=Fy(n);return S5.has(s)||(s=sn),s.getAnimatableNone?s.getAnimatableNone(a):void 0}const w5=new Set(["auto","none","0"]);function T5(n,a,s){let r=0,o;for(;r<n.length&&!o;){const d=n[r];typeof d=="string"&&!w5.has(d)&&Zi(d).values.length&&(o=n[r]),r++}if(o&&s)for(const d of a)n[d]=Zy(s,o)}class j5 extends Kd{constructor(a,s,r,o,d){super(a,s,r,o,d,!0)}readKeyframes(){const{unresolvedKeyframes:a,element:s,name:r}=this;if(!s||!s.current)return;super.readKeyframes();for(let x=0;x<a.length;x++){let y=a[x];if(typeof y=="string"&&(y=y.trim(),Hd(y))){const S=By(y,s.current);S!==void 0&&(a[x]=S),x===a.length-1&&(this.finalKeyframe=y)}}if(this.resolveNoneKeyframes(),!$y.has(r)||a.length!==2)return;const[o,d]=a,h=Wv(o),p=Wv(d),m=Uv(o),g=Uv(d);if(m!==g&&pa[r]){this.needsMeasurement=!0;return}if(h!==p)if(Fv(h)&&Fv(p))for(let x=0;x<a.length;x++){const y=a[x];typeof y=="string"&&(a[x]=parseFloat(y))}else pa[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:a,name:s}=this,r=[];for(let o=0;o<a.length;o++)(a[o]===null||p5(a[o]))&&r.push(o);r.length&&T5(a,r,s)}measureInitialState(){const{element:a,unresolvedKeyframes:s,name:r}=this;if(!a||!a.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=pa[r](a.measureViewportBox(),window.getComputedStyle(a.current)),s[0]=this.measuredOrigin;const o=s[s.length-1];o!==void 0&&a.getValue(r,o).jump(o,!1)}measureEndState(){var p;const{element:a,name:s,unresolvedKeyframes:r}=this;if(!a||!a.current)return;const o=a.getValue(s);o&&o.jump(this.measuredOrigin,!1);const d=r.length-1,h=r[d];r[d]=pa[s](a.measureViewportBox(),window.getComputedStyle(a.current)),h!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=h),(p=this.removedTransforms)!=null&&p.length&&this.removedTransforms.forEach(([m,g])=>{a.getValue(m).set(g)}),this.resolveNoneKeyframes()}}function Qy(n,a,s){if(n==null)return[];if(n instanceof EventTarget)return[n];if(typeof n=="string"){let r=document;const o=(s==null?void 0:s[n])??r.querySelectorAll(n);return o?Array.from(o):[]}return Array.from(n).filter(r=>r!=null)}const Py=(n,a)=>a&&typeof n=="number"?a.transform(n):n;function E5(n){return ny(n)&&"offsetHeight"in n&&!("ownerSVGElement"in n)}const{schedule:Wd}=gy(queueMicrotask,!1),nn={x:!1,y:!1};function Jy(){return nn.x||nn.y}function N5(n){return n==="x"||n==="y"?nn[n]?null:(nn[n]=!0,()=>{nn[n]=!1}):nn.x||nn.y?null:(nn.x=nn.y=!0,()=>{nn.x=nn.y=!1})}function Wy(n,a){const s=Qy(n),r=new AbortController,o={passive:!0,...a,signal:r.signal};return[s,o,()=>r.abort()]}function A5(n){return!(n.pointerType==="touch"||Jy())}function C5(n,a,s={}){const[r,o,d]=Wy(n,s);return r.forEach(h=>{let p=!1,m=!1,g;const x=()=>{h.removeEventListener("pointerleave",j)},y=C=>{g&&(g(C),g=void 0),x()},S=C=>{p=!1,window.removeEventListener("pointerup",S),window.removeEventListener("pointercancel",S),m&&(m=!1,y(C))},w=()=>{p=!0,window.addEventListener("pointerup",S,o),window.addEventListener("pointercancel",S,o)},j=C=>{if(C.pointerType!=="touch"){if(p){m=!0;return}y(C)}},E=C=>{if(!A5(C))return;m=!1;const z=a(h,C);typeof z=="function"&&(g=z,h.addEventListener("pointerleave",j,o))};h.addEventListener("pointerenter",E,o),h.addEventListener("pointerdown",w,o)}),d}const Iy=(n,a)=>a?n===a?!0:Iy(n,a.parentElement):!1,Id=n=>n.pointerType==="mouse"?typeof n.button!="number"||n.button<=0:n.isPrimary!==!1,M5=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function D5(n){return M5.has(n.tagName)||n.isContentEditable===!0}const O5=new Set(["INPUT","SELECT","TEXTAREA"]);function R5(n){return O5.has(n.tagName)||n.isContentEditable===!0}const ro=new WeakSet;function e0(n){return a=>{a.key==="Enter"&&n(a)}}function Af(n,a){n.dispatchEvent(new PointerEvent("pointer"+a,{isPrimary:!0,bubbles:!0}))}const z5=(n,a)=>{const s=n.currentTarget;if(!s)return;const r=e0(()=>{if(ro.has(s))return;Af(s,"down");const o=e0(()=>{Af(s,"up")}),d=()=>Af(s,"cancel");s.addEventListener("keyup",o,a),s.addEventListener("blur",d,a)});s.addEventListener("keydown",r,a),s.addEventListener("blur",()=>s.removeEventListener("keydown",r),a)};function t0(n){return Id(n)&&!Jy()}const n0=new WeakSet;function k5(n,a,s={}){const[r,o,d]=Wy(n,s),h=p=>{const m=p.currentTarget;if(!t0(p)||n0.has(p))return;ro.add(m),s.stopPropagation&&n0.add(p);const g=a(m,p),x=(w,j)=>{window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",S),ro.has(m)&&ro.delete(m),t0(w)&&typeof g=="function"&&g(w,{success:j})},y=w=>{x(w,m===window||m===document||s.useGlobalTarget||Iy(m,w.target))},S=w=>{x(w,!1)};window.addEventListener("pointerup",y,o),window.addEventListener("pointercancel",S,o)};return r.forEach(p=>{(s.useGlobalTarget?window:p).addEventListener("pointerdown",h,o),E5(p)&&(p.addEventListener("focus",g=>z5(g,o)),!D5(p)&&!p.hasAttribute("tabindex")&&(p.tabIndex=0))}),d}function eh(n){return ny(n)&&"ownerSVGElement"in n}const oo=new WeakMap;let fa;const eb=(n,a,s)=>(r,o)=>o&&o[0]?o[0][n+"Size"]:eh(r)&&"getBBox"in r?r.getBBox()[a]:r[s],L5=eb("inline","width","offsetWidth"),V5=eb("block","height","offsetHeight");function _5({target:n,borderBoxSize:a}){var s;(s=oo.get(n))==null||s.forEach(r=>{r(n,{get width(){return L5(n,a)},get height(){return V5(n,a)}})})}function U5(n){n.forEach(_5)}function B5(){typeof ResizeObserver>"u"||(fa=new ResizeObserver(U5))}function H5(n,a){fa||B5();const s=Qy(n);return s.forEach(r=>{let o=oo.get(r);o||(o=new Set,oo.set(r,o)),o.add(a),fa==null||fa.observe(r)}),()=>{s.forEach(r=>{const o=oo.get(r);o==null||o.delete(a),o!=null&&o.size||fa==null||fa.unobserve(r)})}}const uo=new Set;let Yi;function $5(){Yi=()=>{const n={get width(){return window.innerWidth},get height(){return window.innerHeight}};uo.forEach(a=>a(n))},window.addEventListener("resize",Yi)}function q5(n){return uo.add(n),Yi||$5(),()=>{uo.delete(n),!uo.size&&typeof Yi=="function"&&(window.removeEventListener("resize",Yi),Yi=void 0)}}function a0(n,a){return typeof n=="function"?q5(n):H5(n,a)}function Y5(n){return eh(n)&&n.tagName==="svg"}const G5=[...Ky,Ie,sn],X5=n=>G5.find(Xy(n)),i0=()=>({translate:0,scale:1,origin:0,originPoint:0}),Gi=()=>({x:i0(),y:i0()}),s0=()=>({min:0,max:0}),nt=()=>({x:s0(),y:s0()}),K5=new WeakMap;function Ho(n){return n!==null&&typeof n=="object"&&typeof n.start=="function"}function yl(n){return typeof n=="string"||Array.isArray(n)}const th=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],nh=["initial",...th];function $o(n){return Ho(n.animate)||nh.some(a=>yl(n[a]))}function tb(n){return!!($o(n)||n.variants)}function F5(n,a,s){for(const r in a){const o=a[r],d=s[r];if(ft(o))n.addValue(r,o);else if(ft(d))n.addValue(r,Qi(o,{owner:n}));else if(d!==o)if(n.hasValue(r)){const h=n.getValue(r);h.liveStyle===!0?h.jump(o):h.hasAnimated||h.set(o)}else{const h=n.getStaticValue(r);n.addValue(r,Qi(h!==void 0?h:o,{owner:n}))}}for(const r in s)a[r]===void 0&&n.removeValue(r);return a}const vd={current:null},nb={current:!1},Z5=typeof window<"u";function Q5(){if(nb.current=!0,!!Z5)if(window.matchMedia){const n=window.matchMedia("(prefers-reduced-motion)"),a=()=>vd.current=n.matches;n.addEventListener("change",a),a()}else vd.current=!1}const l0=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Eo={};function ab(n){Eo=n}function P5(){return Eo}class J5{scrapeMotionValuesFromProps(a,s,r){return{}}constructor({parent:a,props:s,presenceContext:r,reducedMotionConfig:o,skipAnimations:d,blockInitialAnimation:h,visualState:p},m={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Kd,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const w=vt.now();this.renderScheduledAt<w&&(this.renderScheduledAt=w,ke.render(this.render,!1,!0))};const{latestValues:g,renderState:x}=p;this.latestValues=g,this.baseTarget={...g},this.initialValues=s.initial?{...g}:{},this.renderState=x,this.parent=a,this.props=s,this.presenceContext=r,this.depth=a?a.depth+1:0,this.reducedMotionConfig=o,this.skipAnimationsConfig=d,this.options=m,this.blockInitialAnimation=!!h,this.isControllingVariants=$o(s),this.isVariantNode=tb(s),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(a&&a.current);const{willChange:y,...S}=this.scrapeMotionValuesFromProps(s,{},this);for(const w in S){const j=S[w];g[w]!==void 0&&ft(j)&&j.set(g[w])}}mount(a){var s,r;if(this.hasBeenMounted)for(const o in this.initialValues)(s=this.values.get(o))==null||s.jump(this.initialValues[o]),this.latestValues[o]=this.initialValues[o];this.current=a,K5.set(a,this),this.projection&&!this.projection.instance&&this.projection.mount(a),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((o,d)=>this.bindToMotionValue(d,o)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(nb.current||Q5(),this.shouldReduceMotion=vd.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(r=this.parent)==null||r.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var a;this.projection&&this.projection.unmount(),xa(this.notifyUpdate),xa(this.render),this.valueSubscriptions.forEach(s=>s()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(a=this.parent)==null||a.removeChild(this);for(const s in this.events)this.events[s].clear();for(const s in this.features){const r=this.features[s];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(a){this.children.add(a),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(a)}removeChild(a){this.children.delete(a),this.enteringChildren&&this.enteringChildren.delete(a)}bindToMotionValue(a,s){if(this.valueSubscriptions.has(a)&&this.valueSubscriptions.get(a)(),s.accelerate&&_y.has(a)&&this.current instanceof HTMLElement){const{factory:h,keyframes:p,times:m,ease:g,duration:x}=s.accelerate,y=new Ly({element:this.current,name:a,keyframes:p,times:m,ease:g,duration:Ut(x)}),S=h(y);this.valueSubscriptions.set(a,()=>{S(),y.cancel()});return}const r=ts.has(a);r&&this.onBindTransform&&this.onBindTransform();const o=s.on("change",h=>{this.latestValues[a]=h,this.props.onUpdate&&ke.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let d;typeof window<"u"&&window.MotionCheckAppearSync&&(d=window.MotionCheckAppearSync(this,a,s)),this.valueSubscriptions.set(a,()=>{o(),d&&d(),s.owner&&s.stop()})}sortNodePosition(a){return!this.current||!this.sortInstanceNodePosition||this.type!==a.type?0:this.sortInstanceNodePosition(this.current,a.current)}updateFeatures(){let a="animation";for(a in Eo){const s=Eo[a];if(!s)continue;const{isEnabled:r,Feature:o}=s;if(!this.features[a]&&o&&r(this.props)&&(this.features[a]=new o(this)),this.features[a]){const d=this.features[a];d.isMounted?d.update():(d.mount(),d.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):nt()}getStaticValue(a){return this.latestValues[a]}setStaticValue(a,s){this.latestValues[a]=s}update(a,s){(a.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=a,this.prevPresenceContext=this.presenceContext,this.presenceContext=s;for(let r=0;r<l0.length;r++){const o=l0[r];this.propEventSubscriptions[o]&&(this.propEventSubscriptions[o](),delete this.propEventSubscriptions[o]);const d="on"+o,h=a[d];h&&(this.propEventSubscriptions[o]=this.on(o,h))}this.prevMotionValues=F5(this,this.scrapeMotionValuesFromProps(a,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(a){return this.props.variants?this.props.variants[a]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(a){const s=this.getClosestVariantNode();if(s)return s.variantChildren&&s.variantChildren.add(a),()=>s.variantChildren.delete(a)}addValue(a,s){const r=this.values.get(a);s!==r&&(r&&this.removeValue(a),this.bindToMotionValue(a,s),this.values.set(a,s),this.latestValues[a]=s.get())}removeValue(a){this.values.delete(a);const s=this.valueSubscriptions.get(a);s&&(s(),this.valueSubscriptions.delete(a)),delete this.latestValues[a],this.removeValueFromRenderState(a,this.renderState)}hasValue(a){return this.values.has(a)}getValue(a,s){if(this.props.values&&this.props.values[a])return this.props.values[a];let r=this.values.get(a);return r===void 0&&s!==void 0&&(r=Qi(s===null?void 0:s,{owner:this}),this.addValue(a,r)),r}readValue(a,s){let r=this.latestValues[a]!==void 0||!this.current?this.latestValues[a]:this.getBaseTargetFromProps(this.props,a)??this.readValueFromInstance(this.current,a,this.options);return r!=null&&(typeof r=="string"&&(ty(r)||ay(r))?r=parseFloat(r):!X5(r)&&sn.test(s)&&(r=Zy(a,s)),this.setBaseTarget(a,ft(r)?r.get():r)),ft(r)?r.get():r}setBaseTarget(a,s){this.baseTarget[a]=s}getBaseTarget(a){var d;const{initial:s}=this.props;let r;if(typeof s=="string"||typeof s=="object"){const h=Qd(this.props,s,(d=this.presenceContext)==null?void 0:d.custom);h&&(r=h[a])}if(s&&r!==void 0)return r;const o=this.getBaseTargetFromProps(this.props,a);return o!==void 0&&!ft(o)?o:this.initialValues[a]!==void 0&&r===void 0?void 0:this.baseTarget[a]}on(a,s){return this.events[a]||(this.events[a]=new _d),this.events[a].add(s)}notify(a,...s){this.events[a]&&this.events[a].notify(...s)}scheduleRenderMicrotask(){Wd.render(this.render)}}class ib extends J5{constructor(){super(...arguments),this.KeyframeResolver=j5}sortInstanceNodePosition(a,s){return a.compareDocumentPosition(s)&2?1:-1}getBaseTargetFromProps(a,s){const r=a.style;return r?r[s]:void 0}removeValueFromRenderState(a,{vars:s,style:r}){delete s[a],delete r[a]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:a}=this.props;ft(a)&&(this.childSubscription=a.on("change",s=>{this.current&&(this.current.textContent=`${s}`)}))}}class Sa{constructor(a){this.isMounted=!1,this.node=a}update(){}}function sb({top:n,left:a,right:s,bottom:r}){return{x:{min:a,max:s},y:{min:n,max:r}}}function W5({x:n,y:a}){return{top:a.min,right:n.max,bottom:a.max,left:n.min}}function I5(n,a){if(!a)return n;const s=a({x:n.left,y:n.top}),r=a({x:n.right,y:n.bottom});return{top:s.y,left:s.x,bottom:r.y,right:r.x}}function Cf(n){return n===void 0||n===1}function xd({scale:n,scaleX:a,scaleY:s}){return!Cf(n)||!Cf(a)||!Cf(s)}function Ya(n){return xd(n)||lb(n)||n.z||n.rotate||n.rotateX||n.rotateY||n.skewX||n.skewY}function lb(n){return r0(n.x)||r0(n.y)}function r0(n){return n&&n!=="0%"}function No(n,a,s){const r=n-s,o=a*r;return s+o}function o0(n,a,s,r,o){return o!==void 0&&(n=No(n,o,r)),No(n,s,r)+a}function yd(n,a=0,s=1,r,o){n.min=o0(n.min,a,s,r,o),n.max=o0(n.max,a,s,r,o)}function rb(n,{x:a,y:s}){yd(n.x,a.translate,a.scale,a.originPoint),yd(n.y,s.translate,s.scale,s.originPoint)}const u0=.999999999999,c0=1.0000000000001;function eN(n,a,s,r=!1){var p;const o=s.length;if(!o)return;a.x=a.y=1;let d,h;for(let m=0;m<o;m++){d=s[m],h=d.projectionDelta;const{visualElement:g}=d.options;g&&g.props.style&&g.props.style.display==="contents"||(r&&d.options.layoutScroll&&d.scroll&&d!==d.root&&(dn(n.x,-d.scroll.offset.x),dn(n.y,-d.scroll.offset.y)),h&&(a.x*=h.x.scale,a.y*=h.y.scale,rb(n,h)),r&&Ya(d.latestValues)&&co(n,d.latestValues,(p=d.layout)==null?void 0:p.layoutBox))}a.x<c0&&a.x>u0&&(a.x=1),a.y<c0&&a.y>u0&&(a.y=1)}function dn(n,a){n.min+=a,n.max+=a}function f0(n,a,s,r,o=.5){const d=He(n.min,n.max,o);yd(n,a,s,d,r)}function d0(n,a){return typeof n=="string"?parseFloat(n)/100*(a.max-a.min):n}function co(n,a,s){const r=s??n;f0(n.x,d0(a.x,r.x),a.scaleX,a.scale,a.originX),f0(n.y,d0(a.y,r.y),a.scaleY,a.scale,a.originY)}function ob(n,a){return sb(I5(n.getBoundingClientRect(),a))}function tN(n,a,s){const r=ob(n,s),{scroll:o}=a;return o&&(dn(r.x,o.offset.x),dn(r.y,o.offset.y)),r}const nN={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},aN=es.length;function iN(n,a,s){let r="",o=!0;for(let d=0;d<aN;d++){const h=es[d],p=n[h];if(p===void 0)continue;let m=!0;if(typeof p=="number")m=p===(h.startsWith("scale")?1:0);else{const g=parseFloat(p);m=h.startsWith("scale")?g===1:g===0}if(!m||s){const g=Py(p,Jd[h]);if(!m){o=!1;const x=nN[h]||h;r+=`${x}(${g}) `}s&&(a[h]=g)}}return r=r.trim(),s?r=s(a,o?"":r):o&&(r="none"),r}function ah(n,a,s){const{style:r,vars:o,transformOrigin:d}=n;let h=!1,p=!1;for(const m in a){const g=a[m];if(ts.has(m)){h=!0;continue}else if(xy(m)){o[m]=g;continue}else{const x=Py(g,Jd[m]);m.startsWith("origin")?(p=!0,d[m]=x):r[m]=x}}if(a.transform||(h||s?r.transform=iN(a,n.transform,s):r.transform&&(r.transform="none")),p){const{originX:m="50%",originY:g="50%",originZ:x=0}=d;r.transformOrigin=`${m} ${g} ${x}`}}function ub(n,{style:a,vars:s},r,o){const d=n.style;let h;for(h in a)d[h]=a[h];o==null||o.applyProjectionStyles(d,r);for(h in s)d.setProperty(h,s[h])}function h0(n,a){return a.max===a.min?0:n/(a.max-a.min)*100}const Js={correct:(n,a)=>{if(!a.target)return n;if(typeof n=="string")if(te.test(n))n=parseFloat(n);else return n;const s=h0(n,a.target.x),r=h0(n,a.target.y);return`${s}% ${r}%`}},sN={correct:(n,{treeScale:a,projectionDelta:s})=>{const r=n,o=sn.parse(n);if(o.length>5)return r;const d=sn.createTransformer(n),h=typeof o[0]!="number"?1:0,p=s.x.scale*a.x,m=s.y.scale*a.y;o[0+h]/=p,o[1+h]/=m;const g=He(p,m,.5);return typeof o[2+h]=="number"&&(o[2+h]/=g),typeof o[3+h]=="number"&&(o[3+h]/=g),d(o)}},bd={borderRadius:{...Js,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Js,borderTopRightRadius:Js,borderBottomLeftRadius:Js,borderBottomRightRadius:Js,boxShadow:sN};function cb(n,{layout:a,layoutId:s}){return ts.has(n)||n.startsWith("origin")||(a||s!==void 0)&&(!!bd[n]||n==="opacity")}function ih(n,a,s){var h;const r=n.style,o=a==null?void 0:a.style,d={};if(!r)return d;for(const p in r)(ft(r[p])||o&&ft(o[p])||cb(p,n)||((h=s==null?void 0:s.getValue(p))==null?void 0:h.liveStyle)!==void 0)&&(d[p]=r[p]);return d}function lN(n){return window.getComputedStyle(n)}class rN extends ib{constructor(){super(...arguments),this.type="html",this.renderInstance=ub}readValueFromInstance(a,s){var r;if(ts.has(s))return(r=this.projection)!=null&&r.isProjecting?ld(s):NE(a,s);{const o=lN(a),d=(xy(s)?o.getPropertyValue(s):o[s])||0;return typeof d=="string"?d.trim():d}}measureInstanceViewportBox(a,{transformPagePoint:s}){return ob(a,s)}build(a,s,r){ah(a,s,r.transformTemplate)}scrapeMotionValuesFromProps(a,s,r){return ih(a,s,r)}}const oN={offset:"stroke-dashoffset",array:"stroke-dasharray"},uN={offset:"strokeDashoffset",array:"strokeDasharray"};function cN(n,a,s=1,r=0,o=!0){n.pathLength=1;const d=o?oN:uN;n[d.offset]=`${-r}`,n[d.array]=`${a} ${s}`}const fN=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function fb(n,{attrX:a,attrY:s,attrScale:r,pathLength:o,pathSpacing:d=1,pathOffset:h=0,...p},m,g,x){if(ah(n,p,g),m){n.style.viewBox&&(n.attrs.viewBox=n.style.viewBox);return}n.attrs=n.style,n.style={};const{attrs:y,style:S}=n;y.transform&&(S.transform=y.transform,delete y.transform),(S.transform||y.transformOrigin)&&(S.transformOrigin=y.transformOrigin??"50% 50%",delete y.transformOrigin),S.transform&&(S.transformBox=(x==null?void 0:x.transformBox)??"fill-box",delete y.transformBox);for(const w of fN)y[w]!==void 0&&(S[w]=y[w],delete y[w]);a!==void 0&&(y.x=a),s!==void 0&&(y.y=s),r!==void 0&&(y.scale=r),o!==void 0&&cN(y,o,d,h,!1)}const db=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),hb=n=>typeof n=="string"&&n.toLowerCase()==="svg";function dN(n,a,s,r){ub(n,a,void 0,r);for(const o in a.attrs)n.setAttribute(db.has(o)?o:Pd(o),a.attrs[o])}function mb(n,a,s){const r=ih(n,a,s);for(const o in n)if(ft(n[o])||ft(a[o])){const d=es.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;r[d]=n[o]}return r}class hN extends ib{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=nt}getBaseTargetFromProps(a,s){return a[s]}readValueFromInstance(a,s){if(ts.has(s)){const r=Fy(s);return r&&r.default||0}return s=db.has(s)?s:Pd(s),a.getAttribute(s)}scrapeMotionValuesFromProps(a,s,r){return mb(a,s,r)}build(a,s,r){fb(a,s,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(a,s,r,o){dN(a,s,r,o)}mount(a){this.isSVGTag=hb(a.tagName),super.mount(a)}}const mN=nh.length;function pb(n){if(!n)return;if(!n.isControllingVariants){const s=n.parent?pb(n.parent)||{}:{};return n.props.initial!==void 0&&(s.initial=n.props.initial),s}const a={};for(let s=0;s<mN;s++){const r=nh[s],o=n.props[r];(yl(o)||o===!1)&&(a[r]=o)}return a}function gb(n,a){if(!Array.isArray(a))return!1;const s=a.length;if(s!==n.length)return!1;for(let r=0;r<s;r++)if(a[r]!==n[r])return!1;return!0}const pN=[...th].reverse(),gN=th.length;function vN(n){return a=>Promise.all(a.map(({animation:s,options:r})=>h5(n,s,r)))}function xN(n){let a=vN(n),s=m0(),r=!0,o=!1;const d=g=>(x,y)=>{var w;const S=Ja(n,y,g==="exit"?(w=n.presenceContext)==null?void 0:w.custom:void 0);if(S){const{transition:j,transitionEnd:E,...C}=S;x={...x,...C,...E}}return x};function h(g){a=g(n)}function p(g){const{props:x}=n,y=pb(n.parent)||{},S=[],w=new Set;let j={},E=1/0;for(let z=0;z<gN;z++){const D=pN[z],R=s[D],k=x[D]!==void 0?x[D]:y[D],U=yl(k),P=D===g?R.isActive:null;P===!1&&(E=z);let F=k===y[D]&&k!==x[D]&&U;if(F&&(r||o)&&n.manuallyAnimateOnMount&&(F=!1),R.protectedKeys={...j},!R.isActive&&P===null||!k&&!R.prevProp||Ho(k)||typeof k=="boolean")continue;if(D==="exit"&&R.isActive&&P!==!0){R.prevResolvedValues&&(j={...j,...R.prevResolvedValues});continue}const W=yN(R.prevProp,k);let re=W||D===g&&R.isActive&&!F&&U||z>E&&U,B=!1;const Z=Array.isArray(k)?k:[k];let ie=Z.reduce(d(D),{});P===!1&&(ie={});const{prevResolvedValues:le={}}=R,Se={...le,...ie},De=J=>{re=!0,w.has(J)&&(B=!0,w.delete(J)),R.needsAnimating[J]=!0;const oe=n.getValue(J);oe&&(oe.liveStyle=!1)};for(const J in Se){const oe=ie[J],me=le[J];if(j.hasOwnProperty(J))continue;let A=!1;dd(oe)&&dd(me)?A=!gb(oe,me):A=oe!==me,A?oe!=null?De(J):w.add(J):oe!==void 0&&w.has(J)?De(J):R.protectedKeys[J]=!0}R.prevProp=k,R.prevResolvedValues=ie,R.isActive&&(j={...j,...ie}),(r||o)&&n.blockInitialAnimation&&(re=!1);const $=F&&W;re&&(!$||B)&&S.push(...Z.map(J=>{const oe={type:D};if(typeof J=="string"&&(r||o)&&!$&&n.manuallyAnimateOnMount&&n.parent){const{parent:me}=n,A=Ja(me,J);if(me.enteringChildren&&A){const{delayChildren:G}=A.transition||{};oe.delay=Uy(me.enteringChildren,n,G)}}return{animation:J,options:oe}}))}if(w.size){const z={};if(typeof x.initial!="boolean"){const D=Ja(n,Array.isArray(x.initial)?x.initial[0]:x.initial);D&&D.transition&&(z.transition=D.transition)}w.forEach(D=>{const R=n.getBaseTarget(D),k=n.getValue(D);k&&(k.liveStyle=!0),z[D]=R??null}),S.push({animation:z})}let C=!!S.length;return r&&(x.initial===!1||x.initial===x.animate)&&!n.manuallyAnimateOnMount&&(C=!1),r=!1,o=!1,C?a(S):Promise.resolve()}function m(g,x){var S;if(s[g].isActive===x)return Promise.resolve();(S=n.variantChildren)==null||S.forEach(w=>{var j;return(j=w.animationState)==null?void 0:j.setActive(g,x)}),s[g].isActive=x;const y=p(g);for(const w in s)s[w].protectedKeys={};return y}return{animateChanges:p,setActive:m,setAnimateFunction:h,getState:()=>s,reset:()=>{s=m0(),o=!0}}}function yN(n,a){return typeof a=="string"?a!==n:Array.isArray(a)?!gb(a,n):!1}function $a(n=!1){return{isActive:n,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function m0(){return{animate:$a(!0),whileInView:$a(),whileHover:$a(),whileTap:$a(),whileDrag:$a(),whileFocus:$a(),exit:$a()}}function Sd(n,a){n.min=a.min,n.max=a.max}function tn(n,a){Sd(n.x,a.x),Sd(n.y,a.y)}function p0(n,a){n.translate=a.translate,n.scale=a.scale,n.originPoint=a.originPoint,n.origin=a.origin}const vb=1e-4,bN=1-vb,SN=1+vb,xb=.01,wN=0-xb,TN=0+xb;function xt(n){return n.max-n.min}function jN(n,a,s){return Math.abs(n-a)<=s}function g0(n,a,s,r=.5){n.origin=r,n.originPoint=He(a.min,a.max,n.origin),n.scale=xt(s)/xt(a),n.translate=He(s.min,s.max,n.origin)-n.originPoint,(n.scale>=bN&&n.scale<=SN||isNaN(n.scale))&&(n.scale=1),(n.translate>=wN&&n.translate<=TN||isNaN(n.translate))&&(n.translate=0)}function hl(n,a,s,r){g0(n.x,a.x,s.x,r?r.originX:void 0),g0(n.y,a.y,s.y,r?r.originY:void 0)}function v0(n,a,s,r=0){const o=r?He(s.min,s.max,r):s.min;n.min=o+a.min,n.max=n.min+xt(a)}function EN(n,a,s,r){v0(n.x,a.x,s.x,r==null?void 0:r.x),v0(n.y,a.y,s.y,r==null?void 0:r.y)}function x0(n,a,s,r=0){const o=r?He(s.min,s.max,r):s.min;n.min=a.min-o,n.max=n.min+xt(a)}function Ao(n,a,s,r){x0(n.x,a.x,s.x,r==null?void 0:r.x),x0(n.y,a.y,s.y,r==null?void 0:r.y)}function y0(n,a,s,r,o){return n-=a,n=No(n,1/s,r),o!==void 0&&(n=No(n,1/o,r)),n}function NN(n,a=0,s=1,r=.5,o,d=n,h=n){if(mn.test(a)&&(a=parseFloat(a),a=He(h.min,h.max,a/100)-h.min),typeof a!="number")return;let p=He(d.min,d.max,r);n===d&&(p-=a),n.min=y0(n.min,a,s,p,o),n.max=y0(n.max,a,s,p,o)}function b0(n,a,[s,r,o],d,h){NN(n,a[s],a[r],a[o],a.scale,d,h)}const AN=["x","scaleX","originX"],CN=["y","scaleY","originY"];function S0(n,a,s,r){b0(n.x,a,AN,s?s.x:void 0,r?r.x:void 0),b0(n.y,a,CN,s?s.y:void 0,r?r.y:void 0)}function w0(n){return n.translate===0&&n.scale===1}function yb(n){return w0(n.x)&&w0(n.y)}function T0(n,a){return n.min===a.min&&n.max===a.max}function MN(n,a){return T0(n.x,a.x)&&T0(n.y,a.y)}function j0(n,a){return Math.round(n.min)===Math.round(a.min)&&Math.round(n.max)===Math.round(a.max)}function bb(n,a){return j0(n.x,a.x)&&j0(n.y,a.y)}function E0(n){return xt(n.x)/xt(n.y)}function N0(n,a){return n.translate===a.translate&&n.scale===a.scale&&n.originPoint===a.originPoint}function fn(n){return[n("x"),n("y")]}function DN(n,a,s){let r="";const o=n.x.translate/a.x,d=n.y.translate/a.y,h=(s==null?void 0:s.z)||0;if((o||d||h)&&(r=`translate3d(${o}px, ${d}px, ${h}px) `),(a.x!==1||a.y!==1)&&(r+=`scale(${1/a.x}, ${1/a.y}) `),s){const{transformPerspective:g,rotate:x,rotateX:y,rotateY:S,skewX:w,skewY:j}=s;g&&(r=`perspective(${g}px) ${r}`),x&&(r+=`rotate(${x}deg) `),y&&(r+=`rotateX(${y}deg) `),S&&(r+=`rotateY(${S}deg) `),w&&(r+=`skewX(${w}deg) `),j&&(r+=`skewY(${j}deg) `)}const p=n.x.scale*a.x,m=n.y.scale*a.y;return(p!==1||m!==1)&&(r+=`scale(${p}, ${m})`),r||"none"}const Sb=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],ON=Sb.length,A0=n=>typeof n=="string"?parseFloat(n):n,C0=n=>typeof n=="number"||te.test(n);function RN(n,a,s,r,o,d){o?(n.opacity=He(0,s.opacity??1,zN(r)),n.opacityExit=He(a.opacity??1,0,kN(r))):d&&(n.opacity=He(a.opacity??1,s.opacity??1,r));for(let h=0;h<ON;h++){const p=Sb[h];let m=M0(a,p),g=M0(s,p);if(m===void 0&&g===void 0)continue;m||(m=0),g||(g=0),m===0||g===0||C0(m)===C0(g)?(n[p]=Math.max(He(A0(m),A0(g),r),0),(mn.test(g)||mn.test(m))&&(n[p]+="%")):n[p]=g}(a.rotate||s.rotate)&&(n.rotate=He(a.rotate||0,s.rotate||0,r))}function M0(n,a){return n[a]!==void 0?n[a]:n.borderRadius}const zN=wb(0,.5,dy),kN=wb(.5,.95,Jt);function wb(n,a,s){return r=>r<n?0:r>a?1:s(vl(n,a,r))}function LN(n,a,s){const r=ft(n)?n:Qi(n);return r.start(Zd("",r,a,s)),r.animation}function bl(n,a,s,r={passive:!0}){return n.addEventListener(a,s,r),()=>n.removeEventListener(a,s)}const VN=(n,a)=>n.depth-a.depth;class _N{constructor(){this.children=[],this.isDirty=!1}add(a){Ld(this.children,a),this.isDirty=!0}remove(a){bo(this.children,a),this.isDirty=!0}forEach(a){this.isDirty&&this.children.sort(VN),this.isDirty=!1,this.children.forEach(a)}}function UN(n,a){const s=vt.now(),r=({timestamp:o})=>{const d=o-s;d>=a&&(xa(r),n(d-a))};return ke.setup(r,!0),()=>xa(r)}function fo(n){return ft(n)?n.get():n}class BN{constructor(){this.members=[]}add(a){Ld(this.members,a);for(let s=this.members.length-1;s>=0;s--){const r=this.members[s];if(r===a||r===this.lead||r===this.prevLead)continue;const o=r.instance;(!o||o.isConnected===!1)&&!r.snapshot&&(bo(this.members,r),r.unmount())}a.scheduleRender()}remove(a){if(bo(this.members,a),a===this.prevLead&&(this.prevLead=void 0),a===this.lead){const s=this.members[this.members.length-1];s&&this.promote(s)}}relegate(a){var s;for(let r=this.members.indexOf(a)-1;r>=0;r--){const o=this.members[r];if(o.isPresent!==!1&&((s=o.instance)==null?void 0:s.isConnected)!==!1)return this.promote(o),!0}return!1}promote(a,s){var o;const r=this.lead;if(a!==r&&(this.prevLead=r,this.lead=a,a.show(),r)){r.updateSnapshot(),a.scheduleRender();const{layoutDependency:d}=r.options,{layoutDependency:h}=a.options;(d===void 0||d!==h)&&(a.resumeFrom=r,s&&(r.preserveOpacity=!0),r.snapshot&&(a.snapshot=r.snapshot,a.snapshot.latestValues=r.animationValues||r.latestValues),(o=a.root)!=null&&o.isUpdating&&(a.isLayoutDirty=!0)),a.options.crossfade===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(a=>{var s,r,o,d,h;(r=(s=a.options).onExitComplete)==null||r.call(s),(h=(o=a.resumingFrom)==null?void 0:(d=o.options).onExitComplete)==null||h.call(d)})}scheduleRender(){this.members.forEach(a=>a.instance&&a.scheduleRender(!1))}removeLeadSnapshot(){var a;(a=this.lead)!=null&&a.snapshot&&(this.lead.snapshot=void 0)}}const ho={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Mf=["","X","Y","Z"],HN=1e3;let $N=0;function Df(n,a,s,r){const{latestValues:o}=a;o[n]&&(s[n]=o[n],a.setStaticValue(n,0),r&&(r[n]=0))}function Tb(n){if(n.hasCheckedOptimisedAppear=!0,n.root===n)return;const{visualElement:a}=n.options;if(!a)return;const s=Yy(a);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:o,layoutId:d}=n.options;window.MotionCancelOptimisedAnimation(s,"transform",ke,!(o||d))}const{parent:r}=n;r&&!r.hasCheckedOptimisedAppear&&Tb(r)}function jb({attachResizeListener:n,defaultParent:a,measureScroll:s,checkIsScrollRoot:r,resetTransform:o}){return class{constructor(h={},p=a==null?void 0:a()){this.id=$N++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(GN),this.nodes.forEach(PN),this.nodes.forEach(JN),this.nodes.forEach(XN)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=h,this.root=p?p.root||p:this,this.path=p?[...p.path,p]:[],this.parent=p,this.depth=p?p.depth+1:0;for(let m=0;m<this.path.length;m++)this.path[m].shouldResetTransform=!0;this.root===this&&(this.nodes=new _N)}addEventListener(h,p){return this.eventHandlers.has(h)||this.eventHandlers.set(h,new _d),this.eventHandlers.get(h).add(p)}notifyListeners(h,...p){const m=this.eventHandlers.get(h);m&&m.notify(...p)}hasListeners(h){return this.eventHandlers.has(h)}mount(h){if(this.instance)return;this.isSVG=eh(h)&&!Y5(h),this.instance=h;const{layoutId:p,layout:m,visualElement:g}=this.options;if(g&&!g.current&&g.mount(h),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(m||p)&&(this.isLayoutDirty=!0),n){let x,y=0;const S=()=>this.root.updateBlockedByResize=!1;ke.read(()=>{y=window.innerWidth}),n(h,()=>{const w=window.innerWidth;w!==y&&(y=w,this.root.updateBlockedByResize=!0,x&&x(),x=UN(S,250),ho.hasAnimatedSinceResize&&(ho.hasAnimatedSinceResize=!1,this.nodes.forEach(R0)))})}p&&this.root.registerSharedNode(p,this),this.options.animate!==!1&&g&&(p||m)&&this.addEventListener("didUpdate",({delta:x,hasLayoutChanged:y,hasRelativeLayoutChanged:S,layout:w})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const j=this.options.transition||g.getDefaultTransition()||nA,{onLayoutAnimationStart:E,onLayoutAnimationComplete:C}=g.getProps(),z=!this.targetLayout||!bb(this.targetLayout,w),D=!y&&S;if(this.options.layoutRoot||this.resumeFrom||D||y&&(z||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const R={...Fd(j,"layout"),onPlay:E,onComplete:C};(g.shouldReduceMotion||this.options.layoutRoot)&&(R.delay=0,R.type=!1),this.startAnimation(R),this.setAnimationOrigin(x,D)}else y||R0(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=w})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const h=this.getStack();h&&h.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),xa(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(WN),this.animationId++)}getTransformTemplate(){const{visualElement:h}=this.options;return h&&h.getProps().transformTemplate}willUpdate(h=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Tb(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let x=0;x<this.path.length;x++){const y=this.path[x];y.shouldResetTransform=!0,(typeof y.latestValues.x=="string"||typeof y.latestValues.y=="string")&&(y.isLayoutDirty=!0),y.updateScroll("snapshot"),y.options.layoutRoot&&y.willUpdate(!1)}const{layoutId:p,layout:m}=this.options;if(p===void 0&&!m)return;const g=this.getTransformTemplate();this.prevTransformTemplateValue=g?g(this.latestValues,""):void 0,this.updateSnapshot(),h&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const m=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),m&&this.nodes.forEach(FN),this.nodes.forEach(D0);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(O0);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(ZN),this.nodes.forEach(QN),this.nodes.forEach(qN),this.nodes.forEach(YN)):this.nodes.forEach(O0),this.clearAllSnapshots();const p=vt.now();ct.delta=pn(0,1e3/60,p-ct.timestamp),ct.timestamp=p,ct.isProcessing=!0,Sf.update.process(ct),Sf.preRender.process(ct),Sf.render.process(ct),ct.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Wd.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(KN),this.sharedNodes.forEach(IN)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,ke.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){ke.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!xt(this.snapshot.measuredBox.x)&&!xt(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let m=0;m<this.path.length;m++)this.path[m].updateScroll();const h=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=nt()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:p}=this.options;p&&p.notify("LayoutMeasure",this.layout.layoutBox,h?h.layoutBox:void 0)}updateScroll(h="measure"){let p=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===h&&(p=!1),p&&this.instance){const m=r(this.instance);this.scroll={animationId:this.root.animationId,phase:h,isRoot:m,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:m}}}resetTransform(){if(!o)return;const h=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,p=this.projectionDelta&&!yb(this.projectionDelta),m=this.getTransformTemplate(),g=m?m(this.latestValues,""):void 0,x=g!==this.prevTransformTemplateValue;h&&this.instance&&(p||Ya(this.latestValues)||x)&&(o(this.instance,g),this.shouldResetTransform=!1,this.scheduleRender())}measure(h=!0){const p=this.measurePageBox();let m=this.removeElementScroll(p);return h&&(m=this.removeTransform(m)),aA(m),{animationId:this.root.animationId,measuredBox:p,layoutBox:m,latestValues:{},source:this.id}}measurePageBox(){var g;const{visualElement:h}=this.options;if(!h)return nt();const p=h.measureViewportBox();if(!(((g=this.scroll)==null?void 0:g.wasRoot)||this.path.some(iA))){const{scroll:x}=this.root;x&&(dn(p.x,x.offset.x),dn(p.y,x.offset.y))}return p}removeElementScroll(h){var m;const p=nt();if(tn(p,h),(m=this.scroll)!=null&&m.wasRoot)return p;for(let g=0;g<this.path.length;g++){const x=this.path[g],{scroll:y,options:S}=x;x!==this.root&&y&&S.layoutScroll&&(y.wasRoot&&tn(p,h),dn(p.x,y.offset.x),dn(p.y,y.offset.y))}return p}applyTransform(h,p=!1,m){var x,y;const g=m||nt();tn(g,h);for(let S=0;S<this.path.length;S++){const w=this.path[S];!p&&w.options.layoutScroll&&w.scroll&&w!==w.root&&(dn(g.x,-w.scroll.offset.x),dn(g.y,-w.scroll.offset.y)),Ya(w.latestValues)&&co(g,w.latestValues,(x=w.layout)==null?void 0:x.layoutBox)}return Ya(this.latestValues)&&co(g,this.latestValues,(y=this.layout)==null?void 0:y.layoutBox),g}removeTransform(h){var m;const p=nt();tn(p,h);for(let g=0;g<this.path.length;g++){const x=this.path[g];if(!Ya(x.latestValues))continue;let y;x.instance&&(xd(x.latestValues)&&x.updateSnapshot(),y=nt(),tn(y,x.measurePageBox())),S0(p,x.latestValues,(m=x.snapshot)==null?void 0:m.layoutBox,y)}return Ya(this.latestValues)&&S0(p,this.latestValues),p}setTargetDelta(h){this.targetDelta=h,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(h){this.options={...this.options,...h,crossfade:h.crossfade!==void 0?h.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==ct.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(h=!1){var w;const p=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=p.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=p.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=p.isSharedProjectionDirty);const m=!!this.resumingFrom||this!==p;if(!(h||m&&this.isSharedProjectionDirty||this.isProjectionDirty||(w=this.parent)!=null&&w.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:x,layoutId:y}=this.options;if(!this.layout||!(x||y))return;this.resolvedRelativeTargetAt=ct.timestamp;const S=this.getClosestProjectingParent();S&&this.linkedParentVersion!==S.layoutVersion&&!S.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&S&&S.layout?this.createRelativeTarget(S,this.layout.layoutBox,S.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=nt(),this.targetWithTransforms=nt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),EN(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):tn(this.target,this.layout.layoutBox),rb(this.target,this.targetDelta)):tn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&S&&!!S.resumingFrom==!!this.resumingFrom&&!S.options.layoutScroll&&S.target&&this.animationProgress!==1?this.createRelativeTarget(S,this.target,S.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||xd(this.parent.latestValues)||lb(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(h,p,m){this.relativeParent=h,this.linkedParentVersion=h.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=nt(),this.relativeTargetOrigin=nt(),Ao(this.relativeTargetOrigin,p,m,this.options.layoutAnchor||void 0),tn(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var j;const h=this.getLead(),p=!!this.resumingFrom||this!==h;let m=!0;if((this.isProjectionDirty||(j=this.parent)!=null&&j.isProjectionDirty)&&(m=!1),p&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(m=!1),this.resolvedRelativeTargetAt===ct.timestamp&&(m=!1),m)return;const{layout:g,layoutId:x}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(g||x))return;tn(this.layoutCorrected,this.layout.layoutBox);const y=this.treeScale.x,S=this.treeScale.y;eN(this.layoutCorrected,this.treeScale,this.path,p),h.layout&&!h.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(h.target=h.layout.layoutBox,h.targetWithTransforms=nt());const{target:w}=h;if(!w){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(p0(this.prevProjectionDelta.x,this.projectionDelta.x),p0(this.prevProjectionDelta.y,this.projectionDelta.y)),hl(this.projectionDelta,this.layoutCorrected,w,this.latestValues),(this.treeScale.x!==y||this.treeScale.y!==S||!N0(this.projectionDelta.x,this.prevProjectionDelta.x)||!N0(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",w))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(h=!0){var p;if((p=this.options.visualElement)==null||p.scheduleRender(),h){const m=this.getStack();m&&m.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Gi(),this.projectionDelta=Gi(),this.projectionDeltaWithTransform=Gi()}setAnimationOrigin(h,p=!1){const m=this.snapshot,g=m?m.latestValues:{},x={...this.latestValues},y=Gi();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!p;const S=nt(),w=m?m.source:void 0,j=this.layout?this.layout.source:void 0,E=w!==j,C=this.getStack(),z=!C||C.members.length<=1,D=!!(E&&!z&&this.options.crossfade===!0&&!this.path.some(tA));this.animationProgress=0;let R;this.mixTargetDelta=k=>{const U=k/1e3;z0(y.x,h.x,U),z0(y.y,h.y,U),this.setTargetDelta(y),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Ao(S,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),eA(this.relativeTarget,this.relativeTargetOrigin,S,U),R&&MN(this.relativeTarget,R)&&(this.isProjectionDirty=!1),R||(R=nt()),tn(R,this.relativeTarget)),E&&(this.animationValues=x,RN(x,g,this.latestValues,U,D,z)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=U},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(h){var p,m,g;this.notifyListeners("animationStart"),(p=this.currentAnimation)==null||p.stop(),(g=(m=this.resumingFrom)==null?void 0:m.currentAnimation)==null||g.stop(),this.pendingAnimation&&(xa(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ke.update(()=>{ho.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Qi(0)),this.motionValue.jump(0,!1),this.currentAnimation=LN(this.motionValue,[0,1e3],{...h,velocity:0,isSync:!0,onUpdate:x=>{this.mixTargetDelta(x),h.onUpdate&&h.onUpdate(x)},onStop:()=>{},onComplete:()=>{h.onComplete&&h.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const h=this.getStack();h&&h.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(HN),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const h=this.getLead();let{targetWithTransforms:p,target:m,layout:g,latestValues:x}=h;if(!(!p||!m||!g)){if(this!==h&&this.layout&&g&&Eb(this.options.animationType,this.layout.layoutBox,g.layoutBox)){m=this.target||nt();const y=xt(this.layout.layoutBox.x);m.x.min=h.target.x.min,m.x.max=m.x.min+y;const S=xt(this.layout.layoutBox.y);m.y.min=h.target.y.min,m.y.max=m.y.min+S}tn(p,m),co(p,x),hl(this.projectionDeltaWithTransform,this.layoutCorrected,p,x)}}registerSharedNode(h,p){this.sharedNodes.has(h)||this.sharedNodes.set(h,new BN),this.sharedNodes.get(h).add(p);const g=p.options.initialPromotionConfig;p.promote({transition:g?g.transition:void 0,preserveFollowOpacity:g&&g.shouldPreserveFollowOpacity?g.shouldPreserveFollowOpacity(p):void 0})}isLead(){const h=this.getStack();return h?h.lead===this:!0}getLead(){var p;const{layoutId:h}=this.options;return h?((p=this.getStack())==null?void 0:p.lead)||this:this}getPrevLead(){var p;const{layoutId:h}=this.options;return h?(p=this.getStack())==null?void 0:p.prevLead:void 0}getStack(){const{layoutId:h}=this.options;if(h)return this.root.sharedNodes.get(h)}promote({needsReset:h,transition:p,preserveFollowOpacity:m}={}){const g=this.getStack();g&&g.promote(this,m),h&&(this.projectionDelta=void 0,this.needsReset=!0),p&&this.setOptions({transition:p})}relegate(){const h=this.getStack();return h?h.relegate(this):!1}resetSkewAndRotation(){const{visualElement:h}=this.options;if(!h)return;let p=!1;const{latestValues:m}=h;if((m.z||m.rotate||m.rotateX||m.rotateY||m.rotateZ||m.skewX||m.skewY)&&(p=!0),!p)return;const g={};m.z&&Df("z",h,g,this.animationValues);for(let x=0;x<Mf.length;x++)Df(`rotate${Mf[x]}`,h,g,this.animationValues),Df(`skew${Mf[x]}`,h,g,this.animationValues);h.render();for(const x in g)h.setStaticValue(x,g[x]),this.animationValues&&(this.animationValues[x]=g[x]);h.scheduleRender()}applyProjectionStyles(h,p){if(!this.instance||this.isSVG)return;if(!this.isVisible){h.visibility="hidden";return}const m=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,h.visibility="",h.opacity="",h.pointerEvents=fo(p==null?void 0:p.pointerEvents)||"",h.transform=m?m(this.latestValues,""):"none";return}const g=this.getLead();if(!this.projectionDelta||!this.layout||!g.target){this.options.layoutId&&(h.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,h.pointerEvents=fo(p==null?void 0:p.pointerEvents)||""),this.hasProjected&&!Ya(this.latestValues)&&(h.transform=m?m({},""):"none",this.hasProjected=!1);return}h.visibility="";const x=g.animationValues||g.latestValues;this.applyTransformsToTarget();let y=DN(this.projectionDeltaWithTransform,this.treeScale,x);m&&(y=m(x,y)),h.transform=y;const{x:S,y:w}=this.projectionDelta;h.transformOrigin=`${S.origin*100}% ${w.origin*100}% 0`,g.animationValues?h.opacity=g===this?x.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:x.opacityExit:h.opacity=g===this?x.opacity!==void 0?x.opacity:"":x.opacityExit!==void 0?x.opacityExit:0;for(const j in bd){if(x[j]===void 0)continue;const{correct:E,applyTo:C,isCSSVariable:z}=bd[j],D=y==="none"?x[j]:E(x[j],g);if(C){const R=C.length;for(let k=0;k<R;k++)h[C[k]]=D}else z?this.options.visualElement.renderState.vars[j]=D:h[j]=D}this.options.layoutId&&(h.pointerEvents=g===this?fo(p==null?void 0:p.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(h=>{var p;return(p=h.currentAnimation)==null?void 0:p.stop()}),this.root.nodes.forEach(D0),this.root.sharedNodes.clear()}}}function qN(n){n.updateLayout()}function YN(n){var s;const a=((s=n.resumeFrom)==null?void 0:s.snapshot)||n.snapshot;if(n.isLead()&&n.layout&&a&&n.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:o}=n.layout,{animationType:d}=n.options,h=a.source!==n.layout.source;if(d==="size")fn(y=>{const S=h?a.measuredBox[y]:a.layoutBox[y],w=xt(S);S.min=r[y].min,S.max=S.min+w});else if(d==="x"||d==="y"){const y=d==="x"?"y":"x";Sd(h?a.measuredBox[y]:a.layoutBox[y],r[y])}else Eb(d,a.layoutBox,r)&&fn(y=>{const S=h?a.measuredBox[y]:a.layoutBox[y],w=xt(r[y]);S.max=S.min+w,n.relativeTarget&&!n.currentAnimation&&(n.isProjectionDirty=!0,n.relativeTarget[y].max=n.relativeTarget[y].min+w)});const p=Gi();hl(p,r,a.layoutBox);const m=Gi();h?hl(m,n.applyTransform(o,!0),a.measuredBox):hl(m,r,a.layoutBox);const g=!yb(p);let x=!1;if(!n.resumeFrom){const y=n.getClosestProjectingParent();if(y&&!y.resumeFrom){const{snapshot:S,layout:w}=y;if(S&&w){const j=n.options.layoutAnchor||void 0,E=nt();Ao(E,a.layoutBox,S.layoutBox,j);const C=nt();Ao(C,r,w.layoutBox,j),bb(E,C)||(x=!0),y.options.layoutRoot&&(n.relativeTarget=C,n.relativeTargetOrigin=E,n.relativeParent=y)}}}n.notifyListeners("didUpdate",{layout:r,snapshot:a,delta:m,layoutDelta:p,hasLayoutChanged:g,hasRelativeLayoutChanged:x})}else if(n.isLead()){const{onExitComplete:r}=n.options;r&&r()}n.options.transition=void 0}function GN(n){n.parent&&(n.isProjecting()||(n.isProjectionDirty=n.parent.isProjectionDirty),n.isSharedProjectionDirty||(n.isSharedProjectionDirty=!!(n.isProjectionDirty||n.parent.isProjectionDirty||n.parent.isSharedProjectionDirty)),n.isTransformDirty||(n.isTransformDirty=n.parent.isTransformDirty))}function XN(n){n.isProjectionDirty=n.isSharedProjectionDirty=n.isTransformDirty=!1}function KN(n){n.clearSnapshot()}function D0(n){n.clearMeasurements()}function FN(n){n.isLayoutDirty=!0,n.updateLayout()}function O0(n){n.isLayoutDirty=!1}function ZN(n){n.isAnimationBlocked&&n.layout&&!n.isLayoutDirty&&(n.snapshot=n.layout,n.isLayoutDirty=!0)}function QN(n){const{visualElement:a}=n.options;a&&a.getProps().onBeforeLayoutMeasure&&a.notify("BeforeLayoutMeasure"),n.resetTransform()}function R0(n){n.finishAnimation(),n.targetDelta=n.relativeTarget=n.target=void 0,n.isProjectionDirty=!0}function PN(n){n.resolveTargetDelta()}function JN(n){n.calcProjection()}function WN(n){n.resetSkewAndRotation()}function IN(n){n.removeLeadSnapshot()}function z0(n,a,s){n.translate=He(a.translate,0,s),n.scale=He(a.scale,1,s),n.origin=a.origin,n.originPoint=a.originPoint}function k0(n,a,s,r){n.min=He(a.min,s.min,r),n.max=He(a.max,s.max,r)}function eA(n,a,s,r){k0(n.x,a.x,s.x,r),k0(n.y,a.y,s.y,r)}function tA(n){return n.animationValues&&n.animationValues.opacityExit!==void 0}const nA={duration:.45,ease:[.4,0,.1,1]},L0=n=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(n),V0=L0("applewebkit/")&&!L0("chrome/")?Math.round:Jt;function _0(n){n.min=V0(n.min),n.max=V0(n.max)}function aA(n){_0(n.x),_0(n.y)}function Eb(n,a,s){return n==="position"||n==="preserve-aspect"&&!jN(E0(a),E0(s),.2)}function iA(n){var a;return n!==n.root&&((a=n.scroll)==null?void 0:a.wasRoot)}const sA=jb({attachResizeListener:(n,a)=>bl(n,"resize",a),measureScroll:()=>{var n,a;return{x:document.documentElement.scrollLeft||((n=document.body)==null?void 0:n.scrollLeft)||0,y:document.documentElement.scrollTop||((a=document.body)==null?void 0:a.scrollTop)||0}},checkIsScrollRoot:()=>!0}),lA=n=>!n.isLayoutDirty&&n.willUpdate(!1);function U0(){const n=new Set,a=new WeakMap,s=()=>n.forEach(lA);return{add:r=>{n.add(r),a.set(r,r.addEventListener("willUpdate",s))},remove:r=>{n.delete(r);const o=a.get(r);o&&(o(),a.delete(r)),s()},dirty:s}}const Of={current:void 0},Nb=jb({measureScroll:n=>({x:n.scrollLeft,y:n.scrollTop}),defaultParent:()=>{if(!Of.current){const n=new sA({});n.mount(window),n.setOptions({layoutScroll:!0}),Of.current=n}return Of.current},resetTransform:(n,a)=>{n.style.transform=a!==void 0?a:"none"},checkIsScrollRoot:n=>window.getComputedStyle(n).position==="fixed"}),Ab=T.createContext({transformPagePoint:n=>n,isStatic:!1,reducedMotion:"never"});function rA(n=!0){const a=T.useContext(kd);if(a===null)return[!0,null];const{isPresent:s,onExitComplete:r,register:o}=a,d=T.useId();T.useEffect(()=>{if(n)return o(d)},[n]);const h=T.useCallback(()=>n&&r&&r(d),[d,r,n]);return!s&&r?[!1,h]:[!0]}const oA=T.createContext(null);function uA(){const n=T.useRef(!1);return ey(()=>(n.current=!0,()=>{n.current=!1}),[]),n}function cA(){const n=uA(),[a,s]=T.useState(0),r=T.useCallback(()=>{n.current&&s(a+1)},[a]);return[T.useCallback(()=>ke.postRender(r),[r]),a]}const Cb=n=>n===!0,fA=n=>Cb(n===!0)||n==="id",Mb=({children:n,id:a,inherit:s=!0})=>{const r=T.useContext(yo),o=T.useContext(oA),[d,h]=cA(),p=T.useRef(null),m=r.id||o;p.current===null&&(fA(s)&&m&&(a=a?m+"-"+a:m),p.current={id:a,group:Cb(s)&&r.group||U0()});const g=T.useMemo(()=>({...p.current,forceRender:d}),[h]);return f.jsx(yo.Provider,{value:g,children:n})},Db=T.createContext({strict:!1}),B0={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let H0=!1;function dA(){if(H0)return;const n={};for(const a in B0)n[a]={isEnabled:s=>B0[a].some(r=>!!s[r])};ab(n),H0=!0}function Ob(){return dA(),P5()}function hA(n){const a=Ob();for(const s in n)a[s]={...a[s],...n[s]};ab(a)}const mA=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Co(n){return n.startsWith("while")||n.startsWith("drag")&&n!=="draggable"||n.startsWith("layout")||n.startsWith("onTap")||n.startsWith("onPan")||n.startsWith("onLayout")||mA.has(n)}let Rb=n=>!Co(n);function pA(n){typeof n=="function"&&(Rb=a=>a.startsWith("on")?!Co(a):n(a))}try{pA(require("@emotion/is-prop-valid").default)}catch{}function gA(n,a,s){const r={};for(const o in n)o==="values"&&typeof n.values=="object"||ft(n[o])||(Rb(o)||s===!0&&Co(o)||!a&&!Co(o)||n.draggable&&o.startsWith("onDrag"))&&(r[o]=n[o]);return r}const qo=T.createContext({});function vA(n,a){if($o(n)){const{initial:s,animate:r}=n;return{initial:s===!1||yl(s)?s:void 0,animate:yl(r)?r:void 0}}return n.inherit!==!1?a:{}}function xA(n){const{initial:a,animate:s}=vA(n,T.useContext(qo));return T.useMemo(()=>({initial:a,animate:s}),[$0(a),$0(s)])}function $0(n){return Array.isArray(n)?n.join(" "):n}const sh=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function zb(n,a,s){for(const r in a)!ft(a[r])&&!cb(r,s)&&(n[r]=a[r])}function yA({transformTemplate:n},a){return T.useMemo(()=>{const s=sh();return ah(s,a,n),Object.assign({},s.vars,s.style)},[a])}function bA(n,a){const s=n.style||{},r={};return zb(r,s,n),Object.assign(r,yA(n,a)),r}function SA(n,a){const s={},r=bA(n,a);return n.drag&&n.dragListener!==!1&&(s.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=n.drag===!0?"none":`pan-${n.drag==="x"?"y":"x"}`),n.tabIndex===void 0&&(n.onTap||n.onTapStart||n.whileTap)&&(s.tabIndex=0),s.style=r,s}const kb=()=>({...sh(),attrs:{}});function wA(n,a,s,r){const o=T.useMemo(()=>{const d=kb();return fb(d,a,hb(r),n.transformTemplate,n.style),{...d.attrs,style:{...d.style}}},[a]);if(n.style){const d={};zb(d,n.style,n),o.style={...d,...o.style}}return o}const TA=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function lh(n){return typeof n!="string"||n.includes("-")?!1:!!(TA.indexOf(n)>-1||/[A-Z]/u.test(n))}function jA(n,a,s,{latestValues:r},o,d=!1,h){const m=(h??lh(n)?wA:SA)(a,r,o,n),g=gA(a,typeof n=="string",d),x=n!==T.Fragment?{...g,...m,ref:s}:{},{children:y}=a,S=T.useMemo(()=>ft(y)?y.get():y,[y]);return T.createElement(n,{...x,children:S})}function EA({scrapeMotionValuesFromProps:n,createRenderState:a},s,r,o){return{latestValues:NA(s,r,o,n),renderState:a()}}function NA(n,a,s,r){const o={},d=r(n,{});for(const S in d)o[S]=fo(d[S]);let{initial:h,animate:p}=n;const m=$o(n),g=tb(n);a&&g&&!m&&n.inherit!==!1&&(h===void 0&&(h=a.initial),p===void 0&&(p=a.animate));let x=s?s.initial===!1:!1;x=x||h===!1;const y=x?p:h;if(y&&typeof y!="boolean"&&!Ho(y)){const S=Array.isArray(y)?y:[y];for(let w=0;w<S.length;w++){const j=Qd(n,S[w]);if(j){const{transitionEnd:E,transition:C,...z}=j;for(const D in z){let R=z[D];if(Array.isArray(R)){const k=x?R.length-1:0;R=R[k]}R!==null&&(o[D]=R)}for(const D in E)o[D]=E[D]}}}return o}const Lb=n=>(a,s)=>{const r=T.useContext(qo),o=T.useContext(kd),d=()=>EA(n,a,r,o);return s?d():yj(d)},AA=Lb({scrapeMotionValuesFromProps:ih,createRenderState:sh}),CA=Lb({scrapeMotionValuesFromProps:mb,createRenderState:kb}),MA=Symbol.for("motionComponentSymbol");function DA(n,a,s){const r=T.useRef(s);T.useInsertionEffect(()=>{r.current=s});const o=T.useRef(null);return T.useCallback(d=>{var p;d&&((p=n.onMount)==null||p.call(n,d));const h=r.current;if(typeof h=="function")if(d){const m=h(d);typeof m=="function"&&(o.current=m)}else o.current?(o.current(),o.current=null):h(d);else h&&(h.current=d);a&&(d?a.mount(d):a.unmount())},[a])}const Vb=T.createContext({});function $i(n){return n&&typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"current")}function OA(n,a,s,r,o,d){var R,k;const{visualElement:h}=T.useContext(qo),p=T.useContext(Db),m=T.useContext(kd),g=T.useContext(Ab),x=g.reducedMotion,y=g.skipAnimations,S=T.useRef(null),w=T.useRef(!1);r=r||p.renderer,!S.current&&r&&(S.current=r(n,{visualState:a,parent:h,props:s,presenceContext:m,blockInitialAnimation:m?m.initial===!1:!1,reducedMotionConfig:x,skipAnimations:y,isSVG:d}),w.current&&S.current&&(S.current.manuallyAnimateOnMount=!0));const j=S.current,E=T.useContext(Vb);j&&!j.projection&&o&&(j.type==="html"||j.type==="svg")&&RA(S.current,s,o,E);const C=T.useRef(!1);T.useInsertionEffect(()=>{j&&C.current&&j.update(s,m)});const z=s[qy],D=T.useRef(!!z&&typeof window<"u"&&!((R=window.MotionHandoffIsComplete)!=null&&R.call(window,z))&&((k=window.MotionHasOptimisedAnimation)==null?void 0:k.call(window,z)));return ey(()=>{w.current=!0,j&&(C.current=!0,window.MotionIsMounted=!0,j.updateFeatures(),j.scheduleRenderMicrotask(),D.current&&j.animationState&&j.animationState.animateChanges())}),T.useEffect(()=>{j&&(!D.current&&j.animationState&&j.animationState.animateChanges(),D.current&&(queueMicrotask(()=>{var U;(U=window.MotionHandoffMarkAsComplete)==null||U.call(window,z)}),D.current=!1),j.enteringChildren=void 0)}),j}function RA(n,a,s,r){const{layoutId:o,layout:d,drag:h,dragConstraints:p,layoutScroll:m,layoutRoot:g,layoutAnchor:x,layoutCrossfade:y}=a;n.projection=new s(n.latestValues,a["data-framer-portal-id"]?void 0:_b(n.parent)),n.projection.setOptions({layoutId:o,layout:d,alwaysMeasureLayout:!!h||p&&$i(p),visualElement:n,animationType:typeof d=="string"?d:"both",initialPromotionConfig:r,crossfade:y,layoutScroll:m,layoutRoot:g,layoutAnchor:x})}function _b(n){if(n)return n.options.allowProjection!==!1?n.projection:_b(n.parent)}function Rf(n,{forwardMotionProps:a=!1,type:s}={},r,o){r&&hA(r);const d=s?s==="svg":lh(n),h=d?CA:AA;function p(g,x){let y;const S={...T.useContext(Ab),...g,layoutId:zA(g)},{isStatic:w}=S,j=xA(g),E=h(g,w);if(!w&&typeof window<"u"){kA();const C=LA(S);y=C.MeasureLayout,j.visualElement=OA(n,E,S,o,C.ProjectionNode,d)}return f.jsxs(qo.Provider,{value:j,children:[y&&j.visualElement?f.jsx(y,{visualElement:j.visualElement,...S}):null,jA(n,g,DA(E,j.visualElement,x),E,w,a,d)]})}p.displayName=`motion.${typeof n=="string"?n:`create(${n.displayName??n.name??""})`}`;const m=T.forwardRef(p);return m[MA]=n,m}function zA({layoutId:n}){const a=T.useContext(yo).id;return a&&n!==void 0?a+"-"+n:n}function kA(n,a){T.useContext(Db).strict}function LA(n){const a=Ob(),{drag:s,layout:r}=a;if(!s&&!r)return{};const o={...s,...r};return{MeasureLayout:s!=null&&s.isEnabled(n)||r!=null&&r.isEnabled(n)?o.MeasureLayout:void 0,ProjectionNode:o.ProjectionNode}}function VA(n,a){if(typeof Proxy>"u")return Rf;const s=new Map,r=(d,h)=>Rf(d,h,n,a),o=(d,h)=>r(d,h);return new Proxy(o,{get:(d,h)=>h==="create"?r:(s.has(h)||s.set(h,Rf(h,void 0,n,a)),s.get(h))})}const _A=(n,a)=>a.isSVG??lh(n)?new hN(a):new rN(a,{allowProjection:n!==T.Fragment});class UA extends Sa{constructor(a){super(a),a.animationState||(a.animationState=xN(a))}updateAnimationControlsSubscription(){const{animate:a}=this.node.getProps();Ho(a)&&(this.unmountControls=a.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:a}=this.node.getProps(),{animate:s}=this.node.prevProps||{};a!==s&&this.updateAnimationControlsSubscription()}unmount(){var a;this.node.animationState.reset(),(a=this.unmountControls)==null||a.call(this)}}let BA=0;class HA extends Sa{constructor(){super(...arguments),this.id=BA++,this.isExitComplete=!1}update(){var d;if(!this.node.presenceContext)return;const{isPresent:a,onExitComplete:s}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||a===r)return;if(a&&r===!1){if(this.isExitComplete){const{initial:h,custom:p}=this.node.getProps();if(typeof h=="string"){const m=Ja(this.node,h,p);if(m){const{transition:g,transitionEnd:x,...y}=m;for(const S in y)(d=this.node.getValue(S))==null||d.jump(y[S])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const o=this.node.animationState.setActive("exit",!a);s&&!a&&o.then(()=>{this.isExitComplete=!0,s(this.id)})}mount(){const{register:a,onExitComplete:s}=this.node.presenceContext||{};s&&s(this.id),a&&(this.unmount=a(this.id))}unmount(){}}const $A={animation:{Feature:UA},exit:{Feature:HA}};function Cl(n){return{point:{x:n.pageX,y:n.pageY}}}const qA=n=>a=>Id(a)&&n(a,Cl(a));function ml(n,a,s,r){return bl(n,a,qA(s),r)}const Ub=({current:n})=>n?n.ownerDocument.defaultView:null,q0=(n,a)=>Math.abs(n-a);function YA(n,a){const s=q0(n.x,a.x),r=q0(n.y,a.y);return Math.sqrt(s**2+r**2)}const Y0=new Set(["auto","scroll"]);class Bb{constructor(a,s,{transformPagePoint:r,contextWindow:o=window,dragSnapToOrigin:d=!1,distanceThreshold:h=3,element:p}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=w=>{this.handleScroll(w.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=eo(this.lastRawMoveEventInfo,this.transformPagePoint));const w=zf(this.lastMoveEventInfo,this.history),j=this.startEvent!==null,E=YA(w.offset,{x:0,y:0})>=this.distanceThreshold;if(!j&&!E)return;const{point:C}=w,{timestamp:z}=ct;this.history.push({...C,timestamp:z});const{onStart:D,onMove:R}=this.handlers;j||(D&&D(this.lastMoveEvent,w),this.startEvent=this.lastMoveEvent),R&&R(this.lastMoveEvent,w)},this.handlePointerMove=(w,j)=>{this.lastMoveEvent=w,this.lastRawMoveEventInfo=j,this.lastMoveEventInfo=eo(j,this.transformPagePoint),ke.update(this.updatePoint,!0)},this.handlePointerUp=(w,j)=>{this.end();const{onEnd:E,onSessionEnd:C,resumeAnimation:z}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&z&&z(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const D=zf(w.type==="pointercancel"?this.lastMoveEventInfo:eo(j,this.transformPagePoint),this.history);this.startEvent&&E&&E(w,D),C&&C(w,D)},!Id(a))return;this.dragSnapToOrigin=d,this.handlers=s,this.transformPagePoint=r,this.distanceThreshold=h,this.contextWindow=o||window;const m=Cl(a),g=eo(m,this.transformPagePoint),{point:x}=g,{timestamp:y}=ct;this.history=[{...x,timestamp:y}];const{onSessionStart:S}=s;S&&S(a,zf(g,this.history)),this.removeListeners=El(ml(this.contextWindow,"pointermove",this.handlePointerMove),ml(this.contextWindow,"pointerup",this.handlePointerUp),ml(this.contextWindow,"pointercancel",this.handlePointerUp)),p&&this.startScrollTracking(p)}startScrollTracking(a){let s=a.parentElement;for(;s;){const r=getComputedStyle(s);(Y0.has(r.overflowX)||Y0.has(r.overflowY))&&this.scrollPositions.set(s,{x:s.scrollLeft,y:s.scrollTop}),s=s.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(a){const s=this.scrollPositions.get(a);if(!s)return;const r=a===window,o=r?{x:window.scrollX,y:window.scrollY}:{x:a.scrollLeft,y:a.scrollTop},d={x:o.x-s.x,y:o.y-s.y};d.x===0&&d.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=d.x,this.lastMoveEventInfo.point.y+=d.y):this.history.length>0&&(this.history[0].x-=d.x,this.history[0].y-=d.y),this.scrollPositions.set(a,o),ke.update(this.updatePoint,!0))}updateHandlers(a){this.handlers=a}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),xa(this.updatePoint)}}function eo(n,a){return a?{point:a(n.point)}:n}function G0(n,a){return{x:n.x-a.x,y:n.y-a.y}}function zf({point:n},a){return{point:n,delta:G0(n,Hb(a)),offset:G0(n,GA(a)),velocity:XA(a,.1)}}function GA(n){return n[0]}function Hb(n){return n[n.length-1]}function XA(n,a){if(n.length<2)return{x:0,y:0};let s=n.length-1,r=null;const o=Hb(n);for(;s>=0&&(r=n[s],!(o.timestamp-r.timestamp>Ut(a)));)s--;if(!r)return{x:0,y:0};r===n[0]&&n.length>2&&o.timestamp-r.timestamp>Ut(a)*2&&(r=n[1]);const d=Pt(o.timestamp-r.timestamp);if(d===0)return{x:0,y:0};const h={x:(o.x-r.x)/d,y:(o.y-r.y)/d};return h.x===1/0&&(h.x=0),h.y===1/0&&(h.y=0),h}function KA(n,{min:a,max:s},r){return a!==void 0&&n<a?n=r?He(a,n,r.min):Math.max(n,a):s!==void 0&&n>s&&(n=r?He(s,n,r.max):Math.min(n,s)),n}function X0(n,a,s){return{min:a!==void 0?n.min+a:void 0,max:s!==void 0?n.max+s-(n.max-n.min):void 0}}function FA(n,{top:a,left:s,bottom:r,right:o}){return{x:X0(n.x,s,o),y:X0(n.y,a,r)}}function K0(n,a){let s=a.min-n.min,r=a.max-n.max;return a.max-a.min<n.max-n.min&&([s,r]=[r,s]),{min:s,max:r}}function ZA(n,a){return{x:K0(n.x,a.x),y:K0(n.y,a.y)}}function QA(n,a){let s=.5;const r=xt(n),o=xt(a);return o>r?s=vl(a.min,a.max-r,n.min):r>o&&(s=vl(n.min,n.max-o,a.min)),pn(0,1,s)}function PA(n,a){const s={};return a.min!==void 0&&(s.min=a.min-n.min),a.max!==void 0&&(s.max=a.max-n.min),s}const wd=.35;function JA(n=wd){return n===!1?n=0:n===!0&&(n=wd),{x:F0(n,"left","right"),y:F0(n,"top","bottom")}}function F0(n,a,s){return{min:Z0(n,a),max:Z0(n,s)}}function Z0(n,a){return typeof n=="number"?n:n[a]||0}const WA=new WeakMap;class IA{constructor(a){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=nt(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=a}start(a,{snapToCursor:s=!1,distanceThreshold:r}={}){const{presenceContext:o}=this.visualElement;if(o&&o.isPresent===!1)return;const d=y=>{s&&this.snapToCursor(Cl(y).point),this.stopAnimation()},h=(y,S)=>{const{drag:w,dragPropagation:j,onDragStart:E}=this.getProps();if(w&&!j&&(this.openDragLock&&this.openDragLock(),this.openDragLock=N5(w),!this.openDragLock))return;this.latestPointerEvent=y,this.latestPanInfo=S,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),fn(z=>{let D=this.getAxisMotionValue(z).get()||0;if(mn.test(D)){const{projection:R}=this.visualElement;if(R&&R.layout){const k=R.layout.layoutBox[z];k&&(D=xt(k)*(parseFloat(D)/100))}}this.originPoint[z]=D}),E&&ke.update(()=>E(y,S),!1,!0),hd(this.visualElement,"transform");const{animationState:C}=this.visualElement;C&&C.setActive("whileDrag",!0)},p=(y,S)=>{this.latestPointerEvent=y,this.latestPanInfo=S;const{dragPropagation:w,dragDirectionLock:j,onDirectionLock:E,onDrag:C}=this.getProps();if(!w&&!this.openDragLock)return;const{offset:z}=S;if(j&&this.currentDirection===null){this.currentDirection=t3(z),this.currentDirection!==null&&E&&E(this.currentDirection);return}this.updateAxis("x",S.point,z),this.updateAxis("y",S.point,z),this.visualElement.render(),C&&ke.update(()=>C(y,S),!1,!0)},m=(y,S)=>{this.latestPointerEvent=y,this.latestPanInfo=S,this.stop(y,S),this.latestPointerEvent=null,this.latestPanInfo=null},g=()=>{const{dragSnapToOrigin:y}=this.getProps();(y||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:x}=this.getProps();this.panSession=new Bb(a,{onSessionStart:d,onStart:h,onMove:p,onSessionEnd:m,resumeAnimation:g},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:x,distanceThreshold:r,contextWindow:Ub(this.visualElement),element:this.visualElement.current})}stop(a,s){const r=a||this.latestPointerEvent,o=s||this.latestPanInfo,d=this.isDragging;if(this.cancel(),!d||!o||!r)return;const{velocity:h}=o;this.startAnimation(h);const{onDragEnd:p}=this.getProps();p&&ke.postRender(()=>p(r,o))}cancel(){this.isDragging=!1;const{projection:a,animationState:s}=this.visualElement;a&&(a.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),s&&s.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(a,s,r){const{drag:o}=this.getProps();if(!r||!to(a,o,this.currentDirection))return;const d=this.getAxisMotionValue(a);let h=this.originPoint[a]+r[a];this.constraints&&this.constraints[a]&&(h=KA(h,this.constraints[a],this.elastic[a])),d.set(h)}resolveConstraints(){var d;const{dragConstraints:a,dragElastic:s}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(d=this.visualElement.projection)==null?void 0:d.layout,o=this.constraints;a&&$i(a)?this.constraints||(this.constraints=this.resolveRefConstraints()):a&&r?this.constraints=FA(r.layoutBox,a):this.constraints=!1,this.elastic=JA(s),o!==this.constraints&&!$i(a)&&r&&this.constraints&&!this.hasMutatedConstraints&&fn(h=>{this.constraints!==!1&&this.getAxisMotionValue(h)&&(this.constraints[h]=PA(r.layoutBox[h],this.constraints[h]))})}resolveRefConstraints(){const{dragConstraints:a,onMeasureDragConstraints:s}=this.getProps();if(!a||!$i(a))return!1;const r=a.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const d=tN(r,o.root,this.visualElement.getTransformPagePoint());let h=ZA(o.layout.layoutBox,d);if(s){const p=s(W5(h));this.hasMutatedConstraints=!!p,p&&(h=sb(p))}return h}startAnimation(a){const{drag:s,dragMomentum:r,dragElastic:o,dragTransition:d,dragSnapToOrigin:h,onDragTransitionEnd:p}=this.getProps(),m=this.constraints||{},g=fn(x=>{if(!to(x,s,this.currentDirection))return;let y=m&&m[x]||{};(h===!0||h===x)&&(y={min:0,max:0});const S=o?200:1e6,w=o?40:1e7,j={type:"inertia",velocity:r?a[x]:0,bounceStiffness:S,bounceDamping:w,timeConstant:750,restDelta:1,restSpeed:10,...d,...y};return this.startAxisValueAnimation(x,j)});return Promise.all(g).then(p)}startAxisValueAnimation(a,s){const r=this.getAxisMotionValue(a);return hd(this.visualElement,a),r.start(Zd(a,r,0,s,this.visualElement,!1))}stopAnimation(){fn(a=>this.getAxisMotionValue(a).stop())}getAxisMotionValue(a){const s=`_drag${a.toUpperCase()}`,r=this.visualElement.getProps(),o=r[s];return o||this.visualElement.getValue(a,(r.initial?r.initial[a]:void 0)||0)}snapToCursor(a){fn(s=>{const{drag:r}=this.getProps();if(!to(s,r,this.currentDirection))return;const{projection:o}=this.visualElement,d=this.getAxisMotionValue(s);if(o&&o.layout){const{min:h,max:p}=o.layout.layoutBox[s],m=d.get()||0;d.set(a[s]-He(h,p,.5)+m)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:a,dragConstraints:s}=this.getProps(),{projection:r}=this.visualElement;if(!$i(s)||!r||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};fn(h=>{const p=this.getAxisMotionValue(h);if(p&&this.constraints!==!1){const m=p.get();o[h]=QA({min:m,max:m},this.constraints[h])}});const{transformTemplate:d}=this.visualElement.getProps();this.visualElement.current.style.transform=d?d({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),fn(h=>{if(!to(h,a,null))return;const p=this.getAxisMotionValue(h),{min:m,max:g}=this.constraints[h];p.set(He(m,g,o[h]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;WA.set(this.visualElement,this);const a=this.visualElement.current,s=ml(a,"pointerdown",g=>{const{drag:x,dragListener:y=!0}=this.getProps(),S=g.target,w=S!==a&&R5(S);x&&y&&!w&&this.start(g)});let r;const o=()=>{const{dragConstraints:g}=this.getProps();$i(g)&&g.current&&(this.constraints=this.resolveRefConstraints(),r||(r=e3(a,g.current,()=>this.scalePositionWithinConstraints())))},{projection:d}=this.visualElement,h=d.addEventListener("measure",o);d&&!d.layout&&(d.root&&d.root.updateScroll(),d.updateLayout()),ke.read(o);const p=bl(window,"resize",()=>this.scalePositionWithinConstraints()),m=d.addEventListener("didUpdate",(({delta:g,hasLayoutChanged:x})=>{this.isDragging&&x&&(fn(y=>{const S=this.getAxisMotionValue(y);S&&(this.originPoint[y]+=g[y].translate,S.set(S.get()+g[y].translate))}),this.visualElement.render())}));return()=>{p(),s(),h(),m&&m(),r&&r()}}getProps(){const a=this.visualElement.getProps(),{drag:s=!1,dragDirectionLock:r=!1,dragPropagation:o=!1,dragConstraints:d=!1,dragElastic:h=wd,dragMomentum:p=!0}=a;return{...a,drag:s,dragDirectionLock:r,dragPropagation:o,dragConstraints:d,dragElastic:h,dragMomentum:p}}}function Q0(n){let a=!0;return()=>{if(a){a=!1;return}n()}}function e3(n,a,s){const r=a0(n,Q0(s)),o=a0(a,Q0(s));return()=>{r(),o()}}function to(n,a,s){return(a===!0||a===n)&&(s===null||s===n)}function t3(n,a=10){let s=null;return Math.abs(n.y)>a?s="y":Math.abs(n.x)>a&&(s="x"),s}class n3 extends Sa{constructor(a){super(a),this.removeGroupControls=Jt,this.removeListeners=Jt,this.controls=new IA(a)}mount(){const{dragControls:a}=this.node.getProps();a&&(this.removeGroupControls=a.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Jt}update(){const{dragControls:a}=this.node.getProps(),{dragControls:s}=this.node.prevProps||{};a!==s&&(this.removeGroupControls(),a&&(this.removeGroupControls=a.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const kf=n=>(a,s)=>{n&&ke.update(()=>n(a,s),!1,!0)};class a3 extends Sa{constructor(){super(...arguments),this.removePointerDownListener=Jt}onPointerDown(a){this.session=new Bb(a,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Ub(this.node)})}createPanHandlers(){const{onPanSessionStart:a,onPanStart:s,onPan:r,onPanEnd:o}=this.node.getProps();return{onSessionStart:kf(a),onStart:kf(s),onMove:kf(r),onEnd:(d,h)=>{delete this.session,o&&ke.postRender(()=>o(d,h))}}}mount(){this.removePointerDownListener=ml(this.node.current,"pointerdown",a=>this.onPointerDown(a))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Lf=!1;class i3 extends T.Component{componentDidMount(){const{visualElement:a,layoutGroup:s,switchLayoutGroup:r,layoutId:o}=this.props,{projection:d}=a;d&&(s.group&&s.group.add(d),r&&r.register&&o&&r.register(d),Lf&&d.root.didUpdate(),d.addEventListener("animationComplete",()=>{this.safeToRemove()}),d.setOptions({...d.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),ho.hasEverUpdated=!0}getSnapshotBeforeUpdate(a){const{layoutDependency:s,visualElement:r,drag:o,isPresent:d}=this.props,{projection:h}=r;return h&&(h.isPresent=d,a.layoutDependency!==s&&h.setOptions({...h.options,layoutDependency:s}),Lf=!0,o||a.layoutDependency!==s||s===void 0||a.isPresent!==d?h.willUpdate():this.safeToRemove(),a.isPresent!==d&&(d?h.promote():h.relegate()||ke.postRender(()=>{const p=h.getStack();(!p||!p.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:a,layoutAnchor:s}=this.props,{projection:r}=a;r&&(r.options.layoutAnchor=s,r.root.didUpdate(),Wd.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:a,layoutGroup:s,switchLayoutGroup:r}=this.props,{projection:o}=a;Lf=!0,o&&(o.scheduleCheckAfterUnmount(),s&&s.group&&s.group.remove(o),r&&r.deregister&&r.deregister(o))}safeToRemove(){const{safeToRemove:a}=this.props;a&&a()}render(){return null}}function $b(n){const[a,s]=rA(),r=T.useContext(yo);return f.jsx(i3,{...n,layoutGroup:r,switchLayoutGroup:T.useContext(Vb),isPresent:a,safeToRemove:s})}const s3={pan:{Feature:a3},drag:{Feature:n3,ProjectionNode:Nb,MeasureLayout:$b}};function P0(n,a,s){const{props:r}=n;n.animationState&&r.whileHover&&n.animationState.setActive("whileHover",s==="Start");const o="onHover"+s,d=r[o];d&&ke.postRender(()=>d(a,Cl(a)))}class l3 extends Sa{mount(){const{current:a}=this.node;a&&(this.unmount=C5(a,(s,r)=>(P0(this.node,r,"Start"),o=>P0(this.node,o,"End"))))}unmount(){}}class r3 extends Sa{constructor(){super(...arguments),this.isActive=!1}onFocus(){let a=!1;try{a=this.node.current.matches(":focus-visible")}catch{a=!0}!a||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=El(bl(this.node.current,"focus",()=>this.onFocus()),bl(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function J0(n,a,s){const{props:r}=n;if(n.current instanceof HTMLButtonElement&&n.current.disabled)return;n.animationState&&r.whileTap&&n.animationState.setActive("whileTap",s==="Start");const o="onTap"+(s==="End"?"":s),d=r[o];d&&ke.postRender(()=>d(a,Cl(a)))}class o3 extends Sa{mount(){const{current:a}=this.node;if(!a)return;const{globalTapTarget:s,propagate:r}=this.node.props;this.unmount=k5(a,(o,d)=>(J0(this.node,d,"Start"),(h,{success:p})=>J0(this.node,h,p?"End":"Cancel")),{useGlobalTarget:s,stopPropagation:(r==null?void 0:r.tap)===!1})}unmount(){}}const Td=new WeakMap,Vf=new WeakMap,u3=n=>{const a=Td.get(n.target);a&&a(n)},c3=n=>{n.forEach(u3)};function f3({root:n,...a}){const s=n||document;Vf.has(s)||Vf.set(s,{});const r=Vf.get(s),o=JSON.stringify(a);return r[o]||(r[o]=new IntersectionObserver(c3,{root:n,...a})),r[o]}function d3(n,a,s){const r=f3(a);return Td.set(n,s),r.observe(n),()=>{Td.delete(n),r.unobserve(n)}}const h3={some:0,all:1};class m3 extends Sa{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var m;(m=this.stopObserver)==null||m.call(this);const{viewport:a={}}=this.node.getProps(),{root:s,margin:r,amount:o="some",once:d}=a,h={root:s?s.current:void 0,rootMargin:r,threshold:typeof o=="number"?o:h3[o]},p=g=>{const{isIntersecting:x}=g;if(this.isInView===x||(this.isInView=x,d&&!x&&this.hasEnteredView))return;x&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",x);const{onViewportEnter:y,onViewportLeave:S}=this.node.getProps(),w=x?y:S;w&&w(g)};this.stopObserver=d3(this.node.current,h,p)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:a,prevProps:s}=this.node;["amount","margin","root"].some(p3(a,s))&&this.startObserver()}unmount(){var a;(a=this.stopObserver)==null||a.call(this),this.hasEnteredView=!1,this.isInView=!1}}function p3({viewport:n={}},{viewport:a={}}={}){return s=>n[s]!==a[s]}const g3={inView:{Feature:m3},tap:{Feature:o3},focus:{Feature:r3},hover:{Feature:l3}},v3={layout:{ProjectionNode:Nb,MeasureLayout:$b}},x3={...$A,...g3,...s3,...v3},qb=VA(x3,_A),Yo=T.forwardRef(function(a,s){return f.jsx(LT,{children:f.jsx("a",{...a,ref:s})})}),Ws={base:["relative isolate inline-flex items-baseline justify-center gap-x-2 rounded-lg border text-base/6 font-semibold","px-[calc(--spacing(3.5)-1px)] py-[calc(--spacing(2.5)-1px)] sm:px-[calc(--spacing(3)-1px)] sm:py-[calc(--spacing(1.5)-1px)] sm:text-sm/6","focus:not-data-focus:outline-hidden data-focus:outline-2 data-focus:outline-offset-2 data-focus:outline-blue-500","data-disabled:opacity-50","*:data-[slot=icon]:-mx-0.5 *:data-[slot=icon]:my-0.5 *:data-[slot=icon]:size-5 *:data-[slot=icon]:shrink-0 *:data-[slot=icon]:self-center *:data-[slot=icon]:text-(--btn-icon) sm:*:data-[slot=icon]:my-1 sm:*:data-[slot=icon]:size-4 forced-colors:[--btn-icon:ButtonText] forced-colors:data-hover:[--btn-icon:ButtonText]"],solid:["border-transparent bg-(--btn-border)","dark:bg-(--btn-bg)","before:absolute before:inset-0 before:-z-10 before:rounded-[calc(var(--radius-lg)-1px)] before:bg-(--btn-bg)","before:shadow-sm","dark:before:hidden","dark:border-white/5","after:absolute after:inset-0 after:-z-10 after:rounded-[calc(var(--radius-lg)-1px)]","after:shadow-[inset_0_1px_--theme(--color-white/15%)]","data-active:after:bg-(--btn-hover-overlay) data-hover:after:bg-(--btn-hover-overlay)","dark:after:-inset-px dark:after:rounded-lg","data-disabled:before:shadow-none data-disabled:after:shadow-none"],outline:["border-zinc-950/10 text-zinc-950 data-active:bg-zinc-950/2.5 data-hover:bg-zinc-950/2.5","dark:border-white/15 dark:text-white dark:[--btn-bg:transparent] dark:data-active:bg-white/5 dark:data-hover:bg-white/5","[--btn-icon:var(--color-zinc-500)] data-active:[--btn-icon:var(--color-zinc-700)] data-hover:[--btn-icon:var(--color-zinc-700)] dark:data-active:[--btn-icon:var(--color-zinc-400)] dark:data-hover:[--btn-icon:var(--color-zinc-400)]"],plain:["border-transparent text-zinc-950 data-active:bg-zinc-950/5 data-hover:bg-zinc-950/5","dark:text-white dark:data-active:bg-white/10 dark:data-hover:bg-white/10","[--btn-icon:var(--color-zinc-500)] data-active:[--btn-icon:var(--color-zinc-700)] data-hover:[--btn-icon:var(--color-zinc-700)] dark:[--btn-icon:var(--color-zinc-500)] dark:data-active:[--btn-icon:var(--color-zinc-400)] dark:data-hover:[--btn-icon:var(--color-zinc-400)]"],colors:{"dark/zinc":["text-white [--btn-bg:var(--color-zinc-900)] [--btn-border:var(--color-zinc-950)]/90 [--btn-hover-overlay:var(--color-white)]/10","dark:text-white dark:[--btn-bg:var(--color-zinc-600)] dark:[--btn-hover-overlay:var(--color-white)]/5","[--btn-icon:var(--color-zinc-400)] data-active:[--btn-icon:var(--color-zinc-300)] data-hover:[--btn-icon:var(--color-zinc-300)]"],light:["text-zinc-950 [--btn-bg:white] [--btn-border:var(--color-zinc-950)]/10 [--btn-hover-overlay:var(--color-zinc-950)]/2.5 data-active:[--btn-border:var(--color-zinc-950)]/15 data-hover:[--btn-border:var(--color-zinc-950)]/15","dark:text-white dark:[--btn-hover-overlay:var(--color-white)]/5 dark:[--btn-bg:var(--color-zinc-800)]","[--btn-icon:var(--color-zinc-500)] data-active:[--btn-icon:var(--color-zinc-700)] data-hover:[--btn-icon:var(--color-zinc-700)] dark:[--btn-icon:var(--color-zinc-500)] dark:data-active:[--btn-icon:var(--color-zinc-400)] dark:data-hover:[--btn-icon:var(--color-zinc-400)]"],"dark/white":["text-white [--btn-bg:var(--color-zinc-900)] [--btn-border:var(--color-zinc-950)]/90 [--btn-hover-overlay:var(--color-white)]/10","dark:text-zinc-950 dark:[--btn-bg:white] dark:[--btn-hover-overlay:var(--color-zinc-950)]/5","[--btn-icon:var(--color-zinc-400)] data-active:[--btn-icon:var(--color-zinc-300)] data-hover:[--btn-icon:var(--color-zinc-300)] dark:[--btn-icon:var(--color-zinc-500)] dark:data-active:[--btn-icon:var(--color-zinc-400)] dark:data-hover:[--btn-icon:var(--color-zinc-400)]"],dark:["text-white [--btn-bg:var(--color-zinc-900)] [--btn-border:var(--color-zinc-950)]/90 [--btn-hover-overlay:var(--color-white)]/10","dark:[--btn-hover-overlay:var(--color-white)]/5 dark:[--btn-bg:var(--color-zinc-800)]","[--btn-icon:var(--color-zinc-400)] data-active:[--btn-icon:var(--color-zinc-300)] data-hover:[--btn-icon:var(--color-zinc-300)]"],white:["text-zinc-950 [--btn-bg:white] [--btn-border:var(--color-zinc-950)]/10 [--btn-hover-overlay:var(--color-zinc-950)]/2.5 data-active:[--btn-border:var(--color-zinc-950)]/15 data-hover:[--btn-border:var(--color-zinc-950)]/15","dark:[--btn-hover-overlay:var(--color-zinc-950)]/5","[--btn-icon:var(--color-zinc-400)] data-active:[--btn-icon:var(--color-zinc-500)] data-hover:[--btn-icon:var(--color-zinc-500)]"],zinc:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-zinc-600)] [--btn-border:var(--color-zinc-700)]/90","dark:[--btn-hover-overlay:var(--color-white)]/5","[--btn-icon:var(--color-zinc-400)] data-active:[--btn-icon:var(--color-zinc-300)] data-hover:[--btn-icon:var(--color-zinc-300)]"],indigo:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-indigo-500)] [--btn-border:var(--color-indigo-600)]/90","[--btn-icon:var(--color-indigo-300)] data-active:[--btn-icon:var(--color-indigo-200)] data-hover:[--btn-icon:var(--color-indigo-200)]"],cyan:["text-cyan-950 [--btn-bg:var(--color-cyan-300)] [--btn-border:var(--color-cyan-400)]/80 [--btn-hover-overlay:var(--color-white)]/25","[--btn-icon:var(--color-cyan-500)]"],red:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-red-600)] [--btn-border:var(--color-red-700)]/90","[--btn-icon:var(--color-red-300)] data-active:[--btn-icon:var(--color-red-200)] data-hover:[--btn-icon:var(--color-red-200)]"],orange:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-orange-500)] [--btn-border:var(--color-orange-600)]/90","[--btn-icon:var(--color-orange-300)] data-active:[--btn-icon:var(--color-orange-200)] data-hover:[--btn-icon:var(--color-orange-200)]"],amber:["text-amber-950 [--btn-hover-overlay:var(--color-white)]/25 [--btn-bg:var(--color-amber-400)] [--btn-border:var(--color-amber-500)]/80","[--btn-icon:var(--color-amber-600)]"],yellow:["text-yellow-950 [--btn-hover-overlay:var(--color-white)]/25 [--btn-bg:var(--color-yellow-300)] [--btn-border:var(--color-yellow-400)]/80","[--btn-icon:var(--color-yellow-600)] data-active:[--btn-icon:var(--color-yellow-700)] data-hover:[--btn-icon:var(--color-yellow-700)]"],lime:["text-lime-950 [--btn-hover-overlay:var(--color-white)]/25 [--btn-bg:var(--color-lime-300)] [--btn-border:var(--color-lime-400)]/80","[--btn-icon:var(--color-lime-600)] data-active:[--btn-icon:var(--color-lime-700)] data-hover:[--btn-icon:var(--color-lime-700)]"],green:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-green-600)] [--btn-border:var(--color-green-700)]/90","[--btn-icon:var(--color-white)]/60 data-active:[--btn-icon:var(--color-white)]/80 data-hover:[--btn-icon:var(--color-white)]/80"],emerald:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-emerald-600)] [--btn-border:var(--color-emerald-700)]/90","[--btn-icon:var(--color-white)]/60 data-active:[--btn-icon:var(--color-white)]/80 data-hover:[--btn-icon:var(--color-white)]/80"],teal:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-teal-600)] [--btn-border:var(--color-teal-700)]/90","[--btn-icon:var(--color-white)]/60 data-active:[--btn-icon:var(--color-white)]/80 data-hover:[--btn-icon:var(--color-white)]/80"],sky:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-sky-500)] [--btn-border:var(--color-sky-600)]/80","[--btn-icon:var(--color-white)]/60 data-active:[--btn-icon:var(--color-white)]/80 data-hover:[--btn-icon:var(--color-white)]/80"],blue:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-blue-600)] [--btn-border:var(--color-blue-700)]/90","[--btn-icon:var(--color-blue-400)] data-active:[--btn-icon:var(--color-blue-300)] data-hover:[--btn-icon:var(--color-blue-300)]"],violet:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-violet-500)] [--btn-border:var(--color-violet-600)]/90","[--btn-icon:var(--color-violet-300)] data-active:[--btn-icon:var(--color-violet-200)] data-hover:[--btn-icon:var(--color-violet-200)]"],purple:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-purple-500)] [--btn-border:var(--color-purple-600)]/90","[--btn-icon:var(--color-purple-300)] data-active:[--btn-icon:var(--color-purple-200)] data-hover:[--btn-icon:var(--color-purple-200)]"],fuchsia:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-fuchsia-500)] [--btn-border:var(--color-fuchsia-600)]/90","[--btn-icon:var(--color-fuchsia-300)] data-active:[--btn-icon:var(--color-fuchsia-200)] data-hover:[--btn-icon:var(--color-fuchsia-200)]"],pink:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-pink-500)] [--btn-border:var(--color-pink-600)]/90","[--btn-icon:var(--color-pink-300)] data-active:[--btn-icon:var(--color-pink-200)] data-hover:[--btn-icon:var(--color-pink-200)]"],rose:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-rose-500)] [--btn-border:var(--color-rose-600)]/90","[--btn-icon:var(--color-rose-300)] data-active:[--btn-icon:var(--color-rose-200)] data-hover:[--btn-icon:var(--color-rose-200)]"]}};T.forwardRef(function({color:a,outline:s,plain:r,className:o,children:d,...h},p){let m=Fe(o,Ws.base,s?Ws.outline:r?Ws.plain:Fe(Ws.solid,Ws.colors[a??"dark/zinc"]));return typeof h.href=="string"?f.jsx(Yo,{...h,className:m,ref:p,children:f.jsx(ya,{children:d})}):f.jsx(Tl,{...h,className:Fe(m,"cursor-default"),ref:p,children:f.jsx(ya,{children:d})})});function ya({children:n}){return f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"absolute top-1/2 left-1/2 size-[max(100%,2.75rem)] -translate-x-1/2 -translate-y-1/2 pointer-fine:hidden","aria-hidden":"true"}),n]})}function y3({className:n,...a}){return f.jsx("nav",{...a,className:Fe(n,"flex flex-1 items-center gap-4 py-2.5")})}function b3({className:n,...a}){let s=T.useId();return f.jsx(Mb,{id:s,children:f.jsx("div",{...a,className:Fe(n,"flex items-center gap-3")})})}function S3({className:n,...a}){return f.jsx("div",{"aria-hidden":"true",...a,className:Fe(n,"-ml-4 flex-1")})}const rh=T.forwardRef(function({current:a,className:s,children:r,...o},d){let h=Fe("relative flex min-w-0 items-center gap-3 rounded-lg p-2 text-left text-base/6 font-medium text-zinc-950 sm:text-sm/5","*:data-[slot=icon]:size-6 *:data-[slot=icon]:shrink-0 *:data-[slot=icon]:fill-zinc-500 sm:*:data-[slot=icon]:size-5","*:not-nth-2:last:data-[slot=icon]:ml-auto *:not-nth-2:last:data-[slot=icon]:size-5 sm:*:not-nth-2:last:data-[slot=icon]:size-4","*:data-[slot=avatar]:-m-0.5 *:data-[slot=avatar]:size-7 *:data-[slot=avatar]:[--avatar-radius:var(--radius-md)] sm:*:data-[slot=avatar]:size-6","data-hover:bg-zinc-950/5 data-hover:*:data-[slot=icon]:fill-zinc-950","data-active:bg-zinc-950/5 data-active:*:data-[slot=icon]:fill-zinc-950","dark:text-white dark:*:data-[slot=icon]:fill-zinc-400","dark:data-hover:bg-white/5 dark:data-hover:*:data-[slot=icon]:fill-white","dark:data-active:bg-white/5 dark:data-active:*:data-[slot=icon]:fill-white");return f.jsxs("span",{className:Fe(s,"relative"),children:[a&&f.jsx(qb.span,{layoutId:"current-indicator",className:"absolute inset-x-2 -bottom-2.5 h-0.5 rounded-full bg-zinc-950 dark:bg-white"}),typeof o.href=="string"?f.jsx(Yo,{...o,className:h,"data-current":a?"true":void 0,ref:d,children:f.jsx(ya,{children:r})}):f.jsx(Tl,{...o,className:Fe("cursor-default",h),"data-current":a?"true":void 0,ref:d,children:f.jsx(ya,{children:r})})]})});function w3(){return f.jsx("svg",{"data-slot":"icon",viewBox:"0 0 20 20","aria-hidden":"true",children:f.jsx("path",{d:"M2 6.75C2 6.33579 2.33579 6 2.75 6H17.25C17.6642 6 18 6.33579 18 6.75C18 7.16421 17.6642 7.5 17.25 7.5H2.75C2.33579 7.5 2 7.16421 2 6.75ZM2 13.25C2 12.8358 2.33579 12.5 2.75 12.5H17.25C17.6642 12.5 18 12.8358 18 13.25C18 13.6642 17.6642 14 17.25 14H2.75C2.33579 14 2 13.6642 2 13.25Z"})})}function T3(){return f.jsx("svg",{"data-slot":"icon",viewBox:"0 0 20 20","aria-hidden":"true",children:f.jsx("path",{d:"M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z"})})}function j3({open:n,close:a,children:s}){return f.jsxs(xj,{open:n,onClose:a,className:"lg:hidden",children:[f.jsx(gj,{transition:!0,className:"fixed inset-0 bg-black/30 transition data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in"}),f.jsx(Ix,{transition:!0,className:"fixed inset-y-0 w-full max-w-80 p-2 transition duration-300 ease-in-out data-closed:-translate-x-full",children:f.jsxs("div",{className:"flex h-full flex-col rounded-lg bg-ouro-deep shadow-xl ring-1 ring-ouro-moss/40",children:[f.jsx("div",{className:"-mb-3 px-4 pt-3",children:f.jsx(Cx,{as:rh,"aria-label":"Close navigation",children:f.jsx(T3,{})})}),s]})})]})}function E3({navbar:n,sidebar:a,children:s}){let[r,o]=T.useState(!1);return f.jsxs("div",{className:"relative isolate flex min-h-svh w-full bg-ouro-void max-lg:flex-col",children:[f.jsx("div",{className:"fixed inset-y-0 left-0 w-64 max-lg:hidden border-r border-zinc-200 dark:border-ouro-moss/30",children:a}),f.jsx(j3,{open:r,close:()=>o(!1),children:a}),f.jsxs("header",{className:"flex items-center px-4 lg:hidden",children:[f.jsx("div",{className:"py-2.5",children:f.jsx(rh,{onClick:()=>o(!0),"aria-label":"Open navigation",children:f.jsx(w3,{})})}),f.jsx("div",{className:"min-w-0 flex-1",children:n})]}),f.jsx("main",{className:"flex flex-1 flex-col lg:min-w-0 lg:pl-64",children:f.jsx("div",{className:"grow bg-ouro-deep p-4 lg:p-8",children:f.jsx("div",{className:"mx-auto max-w-6xl",children:s})})})]})}function N3({className:n,...a}){return f.jsx("nav",{...a,className:Fe(n,"flex h-full min-h-0 flex-col")})}function A3({className:n,...a}){return f.jsx("div",{...a,className:Fe(n,"flex flex-col border-b border-zinc-950/5 p-4 dark:border-white/5 [&>[data-slot=section]+[data-slot=section]]:mt-2.5")})}function C3({className:n,...a}){return f.jsx("div",{...a,className:Fe(n,"flex flex-1 flex-col overflow-y-auto p-4 [&>[data-slot=section]+[data-slot=section]]:mt-8")})}function M3({className:n,...a}){return f.jsx("div",{...a,className:Fe(n,"flex flex-col border-t border-zinc-950/5 p-4 dark:border-white/5 [&>[data-slot=section]+[data-slot=section]]:mt-2.5")})}function W0({className:n,...a}){let s=T.useId();return f.jsx(Mb,{id:s,children:f.jsx("div",{...a,"data-slot":"section",className:Fe(n,"flex flex-col gap-0.5")})})}function I0({className:n,...a}){return f.jsx("h3",{...a,className:Fe(n,"mb-1 px-2 text-xs/6 font-medium text-zinc-500 dark:text-zinc-400")})}const D3=T.forwardRef(function({current:a,className:s,children:r,...o},d){let h=Fe("flex w-full items-center gap-3 rounded-lg px-2 py-2.5 text-left text-base/6 font-medium text-zinc-950 sm:py-2 sm:text-sm/5","*:data-[slot=icon]:size-6 *:data-[slot=icon]:shrink-0 *:data-[slot=icon]:fill-zinc-500 sm:*:data-[slot=icon]:size-5","*:last:data-[slot=icon]:ml-auto *:last:data-[slot=icon]:size-5 sm:*:last:data-[slot=icon]:size-4","*:data-[slot=avatar]:-m-0.5 *:data-[slot=avatar]:size-7 sm:*:data-[slot=avatar]:size-6","data-hover:bg-zinc-950/5 data-hover:*:data-[slot=icon]:fill-zinc-950","data-active:bg-zinc-950/5 data-active:*:data-[slot=icon]:fill-zinc-950","data-current:*:data-[slot=icon]:fill-zinc-950","dark:text-white dark:*:data-[slot=icon]:fill-zinc-400","dark:data-hover:bg-white/5 dark:data-hover:*:data-[slot=icon]:fill-white","dark:data-active:bg-white/5 dark:data-active:*:data-[slot=icon]:fill-white","dark:data-current:*:data-[slot=icon]:fill-white");return f.jsxs("span",{className:Fe(s,"relative"),children:[a&&f.jsx(qb.span,{layoutId:"current-indicator",className:"absolute inset-y-2 -left-4 w-0.5 rounded-full bg-zinc-950 dark:bg-white"}),typeof o.href=="string"?f.jsx(Cx,{as:Yo,...o,className:h,"data-current":a?"true":void 0,ref:d,children:f.jsx(ya,{children:r})}):f.jsx(Tl,{...o,className:Fe("cursor-default",h),"data-current":a?"true":void 0,ref:d,children:f.jsx(ya,{children:r})})]})});function O3({className:n,...a}){return f.jsx("span",{...a,className:Fe(n,"truncate")})}const R3={red:"bg-red-500/15 text-red-700 group-data-hover:bg-red-500/25 dark:bg-red-500/10 dark:text-red-400 dark:group-data-hover:bg-red-500/20",orange:"bg-orange-500/15 text-orange-700 group-data-hover:bg-orange-500/25 dark:bg-orange-500/10 dark:text-orange-400 dark:group-data-hover:bg-orange-500/20",amber:"bg-amber-400/20 text-amber-700 group-data-hover:bg-amber-400/30 dark:bg-amber-400/10 dark:text-amber-400 dark:group-data-hover:bg-amber-400/15",yellow:"bg-yellow-400/20 text-yellow-700 group-data-hover:bg-yellow-400/30 dark:bg-yellow-400/10 dark:text-yellow-300 dark:group-data-hover:bg-yellow-400/15",lime:"bg-lime-400/20 text-lime-700 group-data-hover:bg-lime-400/30 dark:bg-lime-400/10 dark:text-lime-300 dark:group-data-hover:bg-lime-400/15",green:"bg-green-500/15 text-green-700 group-data-hover:bg-green-500/25 dark:bg-green-500/10 dark:text-green-400 dark:group-data-hover:bg-green-500/20",emerald:"bg-emerald-500/15 text-emerald-700 group-data-hover:bg-emerald-500/25 dark:bg-emerald-500/10 dark:text-emerald-400 dark:group-data-hover:bg-emerald-500/20",teal:"bg-teal-500/15 text-teal-700 group-data-hover:bg-teal-500/25 dark:bg-teal-500/10 dark:text-teal-300 dark:group-data-hover:bg-teal-500/20",cyan:"bg-cyan-400/20 text-cyan-700 group-data-hover:bg-cyan-400/30 dark:bg-cyan-400/10 dark:text-cyan-300 dark:group-data-hover:bg-cyan-400/15",sky:"bg-sky-500/15 text-sky-700 group-data-hover:bg-sky-500/25 dark:bg-sky-500/10 dark:text-sky-300 dark:group-data-hover:bg-sky-500/20",blue:"bg-blue-500/15 text-blue-700 group-data-hover:bg-blue-500/25 dark:text-blue-400 dark:group-data-hover:bg-blue-500/25",indigo:"bg-indigo-500/15 text-indigo-700 group-data-hover:bg-indigo-500/25 dark:text-indigo-400 dark:group-data-hover:bg-indigo-500/20",violet:"bg-violet-500/15 text-violet-700 group-data-hover:bg-violet-500/25 dark:text-violet-400 dark:group-data-hover:bg-violet-500/20",purple:"bg-purple-500/15 text-purple-700 group-data-hover:bg-purple-500/25 dark:text-purple-400 dark:group-data-hover:bg-purple-500/20",fuchsia:"bg-fuchsia-400/15 text-fuchsia-700 group-data-hover:bg-fuchsia-400/25 dark:bg-fuchsia-400/10 dark:text-fuchsia-400 dark:group-data-hover:bg-fuchsia-400/20",pink:"bg-pink-400/15 text-pink-700 group-data-hover:bg-pink-400/25 dark:bg-pink-400/10 dark:text-pink-400 dark:group-data-hover:bg-pink-400/20",rose:"bg-rose-400/15 text-rose-700 group-data-hover:bg-rose-400/25 dark:bg-rose-400/10 dark:text-rose-400 dark:group-data-hover:bg-rose-400/20",zinc:"bg-zinc-600/10 text-zinc-700 group-data-hover:bg-zinc-600/20 dark:bg-white/5 dark:text-zinc-400 dark:group-data-hover:bg-white/10"};function xe({color:n="zinc",className:a,...s}){return f.jsx("span",{...s,className:Fe(a,"inline-flex items-center gap-x-1.5 rounded-md px-1.5 py-0.5 text-sm/5 font-medium sm:text-xs/5 forced-colors:outline",R3[n])})}T.forwardRef(function({color:a="zinc",className:s,children:r,...o},d){let h=Fe(s,"group relative inline-flex rounded-md focus:not-data-focus:outline-hidden data-focus:outline-2 data-focus:outline-offset-2 data-focus:outline-blue-500");return typeof o.href=="string"?f.jsx(Yo,{...o,className:h,ref:d,children:f.jsx(ya,{children:f.jsx(xe,{color:a,children:r})})}):f.jsx(Tl,{...o,className:h,ref:d,children:f.jsx(ya,{children:f.jsx(xe,{color:a,children:r})})})});function z3(n){T.useEffect(()=>{if(!n)return;const a=n;function s(r){if(!(r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement))switch(r.key){case"1":a({tab:"overview"});break;case"2":a({tab:"mail"});break;case"3":a({tab:"sessions"});break;case"4":a({tab:"work"});break;case"5":a({tab:"connections"});break;case"6":a({tab:"inner"});break;case"7":a({tab:"notes"});break;case"8":a({tab:"runtime"});break;case"Escape":{document.activeElement instanceof HTMLElement&&document.activeElement.blur();break}}}return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[n])}const k3={"owed-reply":"red","blocking-obligation":"red","broken-return":"red","stale-delegation":"yellow","return-ready":"lime","overdue-habit":"yellow"},L3={"owed-reply":"owed reply","blocking-obligation":"blocking","broken-return":"broken return","stale-delegation":"stale","return-ready":"ready to return","overdue-habit":"overdue"},V3={"owed-reply":"Someone spoke last and is waiting for your response","blocking-obligation":"This obligation is open and blocking forward progress","broken-return":"Work was done but the result was never returned to the requester","stale-delegation":"This was delegated to you and hasn't been addressed","return-ready":"The result is ready — deliver it to close the loop","overdue-habit":"This routine is past its scheduled cadence"},_3=new Set(["stale-delegation"]),U3=new Set(["owed-reply","blocking-obligation","broken-return","return-ready","overdue-habit"]),B3=new Set(["spawning","running","waiting_input","stalled"]);function H3({view:n,deskPrefs:a,refreshGeneration:s}){const r=Pi(),[o,d]=T.useState(null),[h,p]=T.useState(null),[m,g]=T.useState(null),[x,y]=T.useState(null),[S,w]=T.useState(null),j=n.agent,E=n.work,C=n.inner,z=n.activity,D=j.degraded,R=j.attention,k=E.tasks,U=E.obligations,P=E.sessions,F=E.coding,W=j.senses,re=E.bridges;return T.useEffect(()=>{_e(`/agents/${encodeURIComponent(j.agentName)}/needs-me`).then(d),_e(`/agents/${encodeURIComponent(j.agentName)}/coding`).then(p),_e(`/agents/${encodeURIComponent(j.agentName)}/continuity`).then(g).catch(()=>{}),_e(`/agents/${encodeURIComponent(j.agentName)}/orientation`).then(y).catch(()=>{}),_e(`/agents/${encodeURIComponent(j.agentName)}/changes`).then(w).catch(()=>{})},[j.agentName,s]),f.jsxs("div",{className:"space-y-6",children:[o&&o.items.length>0&&(()=>{const B=o.items.filter(ie=>U3.has(ie.urgency)),Z=o.items.filter(ie=>_3.has(ie.urgency));return f.jsxs("div",{className:"space-y-3",children:[B.length>0&&f.jsxs("div",{className:"rounded-xl bg-ouro-fang/5 p-4 ring-1 ring-ouro-fang/15",children:[f.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-fang",children:["Action now (",B.length,")"]}),f.jsx("div",{className:"mt-2 space-y-1.5",children:B.map((ie,le)=>f.jsx(ex,{item:ie,nav:r,agentName:j.agentName,onDismiss:()=>{d(Se=>Se&&{items:Se.items.filter((De,$)=>o.items.indexOf(ie)!==$)})}},`action-${le}`))})]}),Z.length>0&&f.jsxs("div",{className:"rounded-xl bg-ouro-gold/5 p-4 ring-1 ring-ouro-gold/15",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-gold",children:["Stale (",Z.length,")"]}),f.jsx("button",{onClick:async()=>{var ie;for(const le of Z)(ie=le.ref)!=null&&ie.focus&&await fetch(`/api/agents/${encodeURIComponent(j.agentName)}/dismiss-obligation`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({obligationId:le.ref.focus})});_e(`/agents/${encodeURIComponent(j.agentName)}/needs-me`).then(d)},className:"text-xs text-ouro-gold underline underline-offset-2 hover:text-ouro-bone transition-colors",children:"Clear all stale"})]}),f.jsx("div",{className:"mt-2 space-y-1.5",children:Z.map((ie,le)=>f.jsx(ex,{item:ie,nav:r,agentName:j.agentName,onDismiss:()=>{_e(`/agents/${encodeURIComponent(j.agentName)}/needs-me`).then(d)}},`stale-${le}`))})]})]})})(),(a==null?void 0:a.carrying)&&f.jsxs("div",{className:"rounded-xl bg-ouro-moss/10 p-4 ring-1 ring-ouro-glow/8",children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-glow",children:"What I'm carrying"}),f.jsx("p",{className:"mt-1 text-sm leading-relaxed text-ouro-bone",children:a.carrying})]}),(()=>{const B=(a==null?void 0:a.pinnedConstellations)??[];return B.length===0?null:f.jsxs("div",{children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:"Pinned threads"}),f.jsx("div",{className:"mt-2 space-y-2",children:B.map((Z,ie)=>f.jsxs("div",{className:"rounded-lg bg-ouro-void/40 px-3 py-2.5 ring-1 ring-ouro-moss/15",children:[f.jsx("p",{className:"font-medium text-ouro-bone",children:Z.label}),f.jsxs("div",{className:"mt-1 flex flex-wrap gap-1.5",children:[Z.friendIds.map(le=>f.jsxs("button",{onClick:()=>r({tab:"sessions"}),className:"text-xs text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2",children:["friend:",le.slice(0,8),"…"]},le)),Z.taskRefs.map(le=>f.jsxs("button",{onClick:()=>r({tab:"work"}),className:"text-xs text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2",children:["task:",le]},le)),Z.bridgeIds.map(le=>f.jsxs("button",{onClick:()=>r({tab:"connections",focus:le}),className:"text-xs text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2",children:["bridge:",le.slice(0,8),"…"]},le))]})]},ie))})]})})(),f.jsxs("div",{className:"rounded-xl bg-ouro-moss/15 p-4 ring-1 ring-ouro-glow/10 sm:p-5",children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-glow",children:"Center of gravity"}),f.jsx("p",{className:"mt-1 font-display text-xl italic font-semibold text-ouro-bone sm:text-2xl",children:R.label}),f.jsxs("p",{className:"mt-2 text-sm leading-relaxed text-ouro-mist",children:[j.agentName," has"," ",f.jsxs(no,{tab:"work",children:[k.liveCount," live tasks"]}),","," ",f.jsxs(no,{tab:"work",children:[U.openCount," obligations"]}),","," ",f.jsxs(no,{tab:"work",children:[F.activeCount," coding lanes"]}),", and"," ",f.jsxs(no,{tab:"sessions",children:[P.liveCount," live sessions"]}),"."]}),D.status==="degraded"&&D.issues.length>0&&f.jsxs("div",{className:"mt-3 space-y-1",children:[D.issues.slice(0,5).map((B,Z)=>f.jsxs("button",{onClick:()=>r({tab:"runtime"}),className:"flex w-full items-start gap-2 rounded-lg bg-ouro-fang/5 px-3 py-2 text-left text-sm ring-1 ring-ouro-fang/10 hover:ring-ouro-fang/25 transition-colors",children:[f.jsx("span",{className:"mt-0.5 h-2 w-2 shrink-0 rounded-full bg-ouro-fang"}),f.jsxs("span",{className:"text-ouro-mist",children:[f.jsx("span",{className:"font-semibold text-ouro-fang",children:B.code}),f.jsxs("span",{className:"text-ouro-shadow",children:[" — ",pt(B.detail,80)]})]})]},Z)),D.issues.length>5&&f.jsxs("button",{onClick:()=>r({tab:"runtime"}),className:"text-xs text-ouro-glow underline underline-offset-2",children:["+",D.issues.length-5," more issues"]})]})]}),x&&f.jsxs("div",{className:"rounded-xl bg-ouro-moss/10 p-4 ring-1 ring-ouro-glow/8",children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-glow",children:"Orientation"}),(()=>{const B=x.currentSession;return B?f.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[f.jsx(xe,{color:"lime",children:"active session"}),f.jsxs("button",{onClick:()=>r({tab:"sessions",focus:`${B.friendId}/${B.channel}/${B.key}`}),className:"text-sm text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2",children:[B.channel,"/",B.key]}),B.lastActivityAt&&f.jsx("span",{className:"text-xs text-ouro-shadow",children:et(B.lastActivityAt)})]}):null})(),x.primaryObligation&&f.jsxs("div",{className:"mt-2 rounded-lg bg-ouro-void/40 px-3 py-2 ring-1 ring-ouro-moss/15",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(xe,{color:"yellow",children:x.primaryObligation.status}),f.jsx("span",{className:"text-sm font-medium text-ouro-bone",children:pt(x.primaryObligation.content,80)})]}),x.primaryObligation.nextAction&&f.jsxs("p",{className:"mt-1 text-xs text-ouro-mist",children:["Next: ",x.primaryObligation.nextAction]}),x.primaryObligation.waitingOn&&f.jsxs("p",{className:"mt-0.5 text-xs text-ouro-shadow",children:["Waiting on: ",x.primaryObligation.waitingOn]})]}),x.resumeHandle&&f.jsxs("div",{className:"mt-2 rounded-lg bg-ouro-void/40 px-3 py-2 ring-1 ring-ouro-moss/15",children:[f.jsx("p",{className:"font-mono text-[9px] uppercase tracking-wider text-ouro-shadow",children:"Resume handle"}),f.jsxs("div",{className:"mt-1 space-y-0.5 text-sm",children:[x.resumeHandle.lane&&f.jsxs("p",{className:"text-ouro-bone",children:["Lane: ",x.resumeHandle.lane]}),x.resumeHandle.artifact&&f.jsxs("p",{className:"text-ouro-mist",children:["Artifact: ",x.resumeHandle.artifact]}),x.resumeHandle.nextAction&&f.jsxs("p",{className:"text-ouro-mist",children:["Next: ",x.resumeHandle.nextAction]}),x.resumeHandle.blockerOrWaitingOn&&f.jsxs("p",{className:"text-ouro-shadow",children:["Blocked: ",x.resumeHandle.blockerOrWaitingOn]}),f.jsxs(xe,{color:x.resumeHandle.confidence==="high"?"lime":x.resumeHandle.confidence==="medium"?"yellow":"zinc",children:[x.resumeHandle.confidence," confidence"]})]})]}),x.otherActiveSessions.length>0&&f.jsxs("div",{className:"mt-2",children:[f.jsxs("p",{className:"text-[10px] uppercase tracking-wider text-ouro-shadow",children:["Other sessions (",x.otherActiveSessions.length,")"]}),f.jsx("div",{className:"mt-1 flex flex-wrap gap-1.5",children:x.otherActiveSessions.slice(0,5).map(B=>f.jsx("button",{onClick:()=>r({tab:"sessions",focus:`${B.friendId}/${B.channel}/${B.key}`}),className:"text-xs text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2",children:B.friendName},`${B.friendId}/${B.channel}/${B.key}`))})]})]}),S&&S.changeCount>0&&f.jsxs("div",{className:"rounded-xl bg-ouro-gold/5 p-4 ring-1 ring-ouro-gold/15",children:[f.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-gold",children:["What changed (",S.changeCount,")"]}),S.snapshotAge&&f.jsxs("p",{className:"mt-0.5 text-xs text-ouro-shadow",children:["Since ",et(S.snapshotAge)]}),f.jsxs("div",{className:"mt-2 space-y-1",children:[S.items.slice(0,8).map((B,Z)=>f.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[f.jsx(xe,{color:B.kind.includes("status")?"yellow":"zinc",children:B.kind.replace(/_/g," ")}),f.jsx("span",{className:"truncate text-ouro-mist",children:B.summary})]},Z)),S.items.length>8&&f.jsxs("p",{className:"text-xs text-ouro-shadow",children:["+",S.items.length-8," more changes"]})]})]}),m&&f.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[f.jsxs("div",{className:"rounded-xl bg-ouro-void/50 p-4 ring-1 ring-ouro-moss/20",children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-glow",children:"Presence"}),m.presence.self?f.jsxs("div",{className:"mt-2 space-y-1",children:[f.jsx("p",{className:"text-sm font-medium text-ouro-bone",children:m.presence.self.availability}),m.presence.self.lane&&f.jsxs("p",{className:"text-xs text-ouro-shadow",children:["Lane: ",m.presence.self.lane]}),m.presence.self.tempo&&f.jsxs("p",{className:"text-xs text-ouro-shadow",children:["Tempo: ",m.presence.self.tempo]})]}):f.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No presence data"}),m.presence.peers.length>0&&f.jsxs("div",{className:"mt-2 border-t border-ouro-moss/20 pt-2",children:[f.jsx("p",{className:"text-[10px] uppercase tracking-wider text-ouro-shadow",children:"Peers"}),f.jsx("div",{className:"mt-1 flex flex-wrap gap-1.5",children:m.presence.peers.map(B=>f.jsx(xe,{color:B.availability==="active"?"lime":"zinc",children:B.agentName},B.agentName))})]})]}),f.jsxs("div",{className:"rounded-xl bg-ouro-void/50 p-4 ring-1 ring-ouro-moss/20",children:[f.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-glow",children:["Cares (",m.cares.activeCount,")"]}),m.cares.items.length>0?f.jsx("div",{className:"mt-2 space-y-1.5",children:m.cares.items.slice(0,5).map(B=>f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(xe,{color:B.salience==="high"?"red":B.salience==="medium"?"yellow":"zinc",children:B.salience}),f.jsx("p",{className:"truncate text-sm text-ouro-bone",children:B.label})]},B.id))}):f.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No active cares"})]}),f.jsxs("div",{className:"rounded-xl bg-ouro-void/50 p-4 ring-1 ring-ouro-moss/20",children:[f.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-glow",children:["Episodes (",m.episodes.recentCount,")"]}),m.episodes.items.length>0?f.jsx("div",{className:"mt-2 space-y-1.5",children:m.episodes.items.slice(0,5).map(B=>f.jsxs("div",{className:"flex items-start gap-2",children:[f.jsx(xe,{color:"zinc",children:B.kind}),f.jsxs("div",{className:"min-w-0",children:[f.jsx("p",{className:"truncate text-sm text-ouro-bone",children:B.summary}),f.jsx("p",{className:"text-xs text-ouro-shadow",children:et(B.timestamp)})]})]},B.id))}):f.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No recent episodes"})]})]}),f.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[f.jsx(ao,{label:"Tasks",value:k.liveCount,sub:`${k.blockedCount} blocked`,onClick:()=>r({tab:"work"})}),f.jsx(ao,{label:"Obligations",value:U.openCount,sub:`${P.liveCount} sessions`,onClick:()=>r({tab:"work"})}),f.jsx(ao,{label:"Coding",value:F.activeCount,sub:`${F.blockedCount} blocked`,onClick:()=>r({tab:"work"})}),f.jsx(ao,{label:"Inner",value:C.status,sub:pt(C.summary??"",30),onClick:()=>r({tab:"inner"})})]}),h&&h.items.length>0&&(()=>{const B=h.items.filter(Z=>B3.has(Z.status));return B.length===0?null:f.jsx(Is,{title:`Active coding (${B.length})`,children:f.jsx("div",{className:"space-y-1.5",children:B.map(Z=>f.jsxs("button",{onClick:()=>r({tab:"work"}),className:"flex w-full items-center gap-2 rounded-lg bg-ouro-void/40 px-3 py-2 text-left ring-1 ring-ouro-moss/15 hover:ring-ouro-glow/20 transition-colors",children:[f.jsx(xe,{color:Z.status==="running"?"lime":Z.status==="waiting_input"?"yellow":"zinc",children:Z.status}),f.jsxs("span",{className:"truncate text-sm text-ouro-bone",children:[Z.runner," — ",pt(Z.workdir,40)]}),f.jsx("span",{className:"shrink-0 text-xs text-ouro-shadow",children:et(Z.lastActivityAt)})]},Z.id))})})})(),f.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[f.jsx(Is,{title:"Senses",children:W.length>0?f.jsx($3,{items:W}):f.jsx(_f,{children:"No active senses"})}),f.jsx(Is,{title:"Bridges",children:re.length>0?f.jsx("div",{className:"flex flex-wrap gap-1.5",children:re.map(B=>f.jsx("button",{onClick:()=>r({tab:"connections",focus:B}),children:f.jsx(xe,{color:"lime",children:B})},B))}):f.jsx(_f,{children:"No active bridges"})})]}),(()=>{const B=U.items.filter(Z=>Z.status==="fulfilled");return B.length===0?null:f.jsx(Is,{title:"Recently closed",children:f.jsx("div",{className:"space-y-1",children:B.slice(0,3).map((Z,ie)=>f.jsxs("div",{className:"flex items-center gap-2 rounded-lg px-3 py-2 bg-ouro-glow/5 ring-1 ring-ouro-glow/10",children:[f.jsx(xe,{color:"lime",children:"closed"}),f.jsx("p",{className:"text-sm text-ouro-mist truncate",children:pt(Z.content,80)}),f.jsx("span",{className:"shrink-0 text-xs text-ouro-shadow",children:et(Z.updatedAt)})]},ie))})})})(),f.jsx(Is,{title:"Recent activity",children:z.recent.length>0?f.jsx("div",{className:"space-y-1",children:z.recent.map((B,Z)=>{const ie=B.kind==="coding"||B.kind==="obligation"?"work":B.kind==="session"?"sessions":"inner";return f.jsxs("button",{onClick:()=>r({tab:ie}),className:"flex w-full flex-col gap-0.5 rounded-lg px-3 py-2.5 text-left hover:bg-ouro-moss/10 transition-colors",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(xe,{children:B.kind}),f.jsx("span",{className:"text-xs text-ouro-shadow",children:et(B.at)})]}),f.jsx("p",{className:"truncate text-sm font-medium text-ouro-bone",children:pt(B.label,100)}),f.jsx("p",{className:"truncate text-xs text-ouro-shadow",children:pt(B.detail,80)})]},Z)})}):f.jsx(_f,{children:"No recent activity yet."})})]})}function ex({item:n,nav:a,agentName:s,onDismiss:r}){var h;const o=n.urgency==="return-ready",d=(h=n.ref)==null?void 0:h.focus;return f.jsxs("div",{className:`flex w-full items-start gap-2.5 rounded-lg px-3 py-2.5 text-left ring-1 transition-colors ${o?"bg-ouro-glow/5 ring-ouro-glow/15":"bg-ouro-void/40 ring-ouro-moss/10"}`,children:[f.jsxs("button",{onClick:()=>n.ref&&a({tab:n.ref.tab,focus:n.ref.focus}),className:"flex min-w-0 flex-1 items-start gap-2.5",children:[f.jsx(xe,{color:k3[n.urgency]??"zinc",children:L3[n.urgency]??n.urgency}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("p",{className:`text-sm font-medium ${o?"text-ouro-glow":"text-ouro-bone"}`,children:n.label}),f.jsx("p",{className:"text-xs text-ouro-shadow truncate",children:n.detail}),f.jsx("p",{className:"text-[10px] italic text-ouro-shadow/60 mt-0.5",children:V3[n.urgency]??""})]}),n.ageMs!=null&&f.jsx("span",{className:"shrink-0 text-xs tabular-nums text-ouro-shadow",children:n.ageMs<36e5?`${Math.floor(n.ageMs/6e4)}m`:n.ageMs<864e5?`${Math.floor(n.ageMs/36e5)}h`:`${Math.floor(n.ageMs/864e5)}d`})]}),d&&f.jsx("button",{onClick:async p=>{p.stopPropagation(),await fetch(`/api/agents/${encodeURIComponent(s)}/dismiss-obligation`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({obligationId:d})}),r()},className:"shrink-0 text-xs text-ouro-shadow hover:text-ouro-fang transition-colors",title:"Dismiss",children:"✕"})]})}function no({tab:n,children:a}){const s=Pi();return f.jsx("button",{onClick:()=>s({tab:n}),className:"text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2 hover:decoration-ouro-glow transition-colors",children:a})}function ao({label:n,value:a,sub:s,onClick:r}){return f.jsxs("button",{onClick:r,className:"rounded-xl bg-ouro-void/50 p-3 text-left ring-1 ring-ouro-moss/20 hover:ring-ouro-glow/20 transition-all",children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-ouro-shadow",children:n}),f.jsx("p",{className:"mt-1 text-xl font-semibold tabular-nums text-ouro-bone",children:a}),f.jsx("p",{className:"mt-0.5 truncate text-xs text-ouro-shadow",children:s})]})}function Is({title:n,children:a}){return f.jsxs("div",{children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:n}),f.jsx("div",{className:"mt-2",children:a})]})}function $3({items:n}){return f.jsx("div",{className:"flex flex-wrap gap-1.5",children:n.map(a=>f.jsx(xe,{color:"lime",children:a},a))})}function _f({children:n}){return f.jsx("p",{className:"text-sm text-ouro-shadow",children:n})}function pl(n){return n.length>0?n.join(", "):"(unknown)"}function q3(n,a){if(a==="all")return!0;if(["imbox","screener","discarded","quarantine"].includes(a))return n.placement===a;if(a==="native"||a==="delegated")return n.compartmentKind===a;if(a.startsWith("source:")){const s=a.slice(7),r=s.indexOf(":");if(r===-1)return n.source===s;const o=s.slice(0,r),d=s.slice(r+1);return n.source===o&&(n.ownerEmail??"unknown-owner")===d}return!1}function Yb(n){return n.subject||"(no subject)"}function Y3(n,a){return{status:"error",agentName:n,mailboxAddress:null,generatedAt:new Date().toISOString(),store:null,folders:[],messages:[],screener:[],outbound:[],recovery:{discardedCount:0,quarantineCount:0,undecryptableCount:0,missingKeyIds:[]},accessLog:[],error:a}}function G3(n,a,s){return{status:"error",agentName:n,mailboxAddress:a,generatedAt:new Date().toISOString(),message:null,accessLog:[],error:s}}function Gb(n){return n.provenance.compartmentKind==="delegated"?`delegated human mailbox · ${n.provenance.ownerEmail??"unknown owner"} / ${n.provenance.source??"unknown source"}`:"native agent mailbox"}function X3(n){return n.mailboxRole==="delegated-human-mailbox"?`delegated human mailbox · ${n.ownerEmail??"unknown owner"} / ${n.source??"unknown source"}`:n.mailboxRole==="agent-native-mailbox"?"native agent mailbox":"mailbox"}function K3(n){return n.sendAuthority==="agent-native"?"native agent mailbox":n.mailboxRole}function F3(n){return n.transport??n.provider??"not sent"}function Z3(n){return n.deliveredAt??n.failedAt??n.acceptedAt??n.sentAt??n.submittedAt??n.updatedAt}function oh(n){return n==="screener"?"bg-[#fff7d6] text-[#6f5200] ring-[#e7c85c]":n==="discarded"||n==="quarantine"?"bg-[#ffe8e2] text-[#8a2f1f] ring-[#ef9a84]":n==="sent"?"bg-[#dff7ea] text-[#17613a] ring-[#82caa1]":n==="draft"?"bg-[#e7ecff] text-[#263f95] ring-[#a7b5f5]":"bg-[#e9f3ef] text-[#1e5840] ring-[#9fc7b5]"}function Q3(n){return(n==null?void 0:n.messages.length)??0}function P3({agentName:n,focus:a,onFocusConsumed:s,refreshGeneration:r}){var z;const[o,d]=T.useState(null),[h,p]=T.useState("all"),[m,g]=T.useState(a??null),[x,y]=T.useState(null),[S,w]=T.useState(!1);T.useEffect(()=>{p("all"),g(a??null),y(null)},[n]),T.useEffect(()=>{d(null),_e(`/agents/${encodeURIComponent(n)}/mail`).then(d).catch(()=>d(Y3(n,"mail unavailable")))},[n,r]),T.useEffect(()=>{a&&(g(a),s==null||s())},[a,s]),T.useEffect(()=>{if(!m){y(null);return}w(!0),_e(`/agents/${encodeURIComponent(n)}/mail/${encodeURIComponent(m)}`).then(y).catch(()=>y(G3(n,(o==null?void 0:o.mailboxAddress)??null,"message unavailable"))).finally(()=>w(!1))},[n,m,r]);const j=T.useMemo(()=>{const D=(o==null?void 0:o.folders)??[];return[{id:"all",label:"All",count:Q3(o)},...D]},[o]),E=T.useMemo(()=>((o==null?void 0:o.messages)??[]).filter(D=>q3(D,h)),[h,o]),C=T.useMemo(()=>h!=="draft"&&h!=="sent"?[]:((o==null?void 0:o.outbound)??[]).filter(D=>h==="draft"?D.status==="draft":D.status!=="draft"),[h,o]);return o?o.status!=="ready"?f.jsx("div",{className:"mailbox-shell grid min-h-[58vh] place-items-center rounded-md bg-[#f2f6ef] p-8 text-[#1f2720] ring-1 ring-black/10",children:f.jsxs("div",{className:"max-w-lg text-center",children:[f.jsx("p",{className:"text-sm font-semibold text-[#667067]",children:"Mailbox"}),f.jsx("h2",{className:"mt-2 text-2xl font-semibold",children:o.status==="auth-required"?"Locked":"Unavailable"}),f.jsx("p",{className:"mt-3 text-sm leading-6 text-[#59645c]",children:o.error})]})}):f.jsxs("div",{className:"mailbox-shell overflow-hidden rounded-md bg-[#f2f6ef] text-[#172018] ring-1 ring-black/10",children:[f.jsxs("header",{className:"flex flex-wrap items-center justify-between gap-3 border-b border-[#cbd8c8] bg-[#e4ecdf] px-4 py-3",children:[f.jsxs("div",{className:"min-w-0",children:[f.jsx("p",{className:"text-xs font-semibold text-[#687062]",children:"Agent mailbox"}),f.jsx("p",{className:"truncate text-sm text-[#2d3a30]",children:o.mailboxAddress})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(xe,{color:"zinc",children:"read-only"}),f.jsxs("span",{className:"text-xs tabular-nums text-[#687062]",children:[o.messages.length," messages"]}),f.jsxs("span",{className:"text-xs tabular-nums text-[#687062]",children:[o.outbound.length," outbound"]})]})]}),f.jsxs("div",{className:"grid min-h-[66vh] grid-cols-1 lg:grid-cols-[14.5rem_minmax(19rem,25rem)_minmax(0,1fr)]",children:[f.jsxs("aside",{className:"border-b border-[#cbd8c8] bg-[#e4ecdf] p-3 lg:border-b-0 lg:border-r",children:[f.jsx(J3,{folders:j,activeFolder:h,setActiveFolder:p}),f.jsx(W3,{discarded:o.recovery.discardedCount,quarantine:o.recovery.quarantineCount,undecryptable:o.recovery.undecryptableCount,missingKeyIds:o.recovery.missingKeyIds}),f.jsx(I3,{candidates:o.screener,onOpen:D=>{p("screener"),g(D)}}),f.jsx(eC,{entries:o.accessLog})]}),f.jsxs("section",{className:"border-b border-[#cbd8c8] bg-[#fbfdf8] lg:border-b-0 lg:border-r",children:[f.jsxs("div",{className:"border-b border-[#d8e2d4] px-4 py-3",children:[f.jsx("p",{className:"text-sm font-semibold text-[#172018]",children:((z=j.find(D=>D.id===h))==null?void 0:z.label)??"All"}),f.jsx("p",{className:"text-xs text-[#687062]",children:C.length>0?`${C.length} outbound records`:`${E.length} messages`})]}),f.jsxs("div",{className:"max-h-[66vh] overflow-y-auto",children:[C.map(D=>f.jsx(nC,{record:D},D.id)),C.length===0&&E.map(D=>f.jsx(tC,{message:D,selected:m===D.id,onSelect:()=>g(D.id)},D.id)),C.length===0&&E.length===0&&f.jsx("div",{className:"px-4 py-10 text-center text-sm text-[#687062]",children:"No records here."})]})]}),f.jsxs("main",{className:"min-w-0 bg-[#fbfdf8]",children:[!m&&f.jsx(iC,{}),m&&S&&f.jsx(tx,{label:"Opening message"}),m&&!S&&(x==null?void 0:x.status)!=="ready"&&f.jsx("div",{className:"grid min-h-[54vh] place-items-center p-8 text-center",children:f.jsxs("div",{children:[f.jsx("p",{className:"text-sm font-semibold text-[#172018]",children:"Message unavailable"}),f.jsx("p",{className:"mt-2 text-sm text-[#687062]",children:x==null?void 0:x.error})]})}),(x==null?void 0:x.status)==="ready"&&x.message&&f.jsx(aC,{detail:x})]})]})]}):f.jsx(tx,{label:"Opening mailbox"})}function J3({folders:n,activeFolder:a,setActiveFolder:s}){return f.jsx("div",{className:"space-y-1",children:n.map(r=>f.jsxs("button",{type:"button",onClick:()=>s(r.id),className:`flex h-9 w-full items-center justify-between rounded px-3 text-left text-sm transition-colors ${a===r.id?"bg-[#fbfdf8] text-[#172018] shadow-sm":"text-[#536157] hover:bg-[#fbfdf8]/65"}`,children:[f.jsx("span",{className:"truncate",children:r.label}),f.jsx("span",{className:"text-xs tabular-nums text-[#687062]",children:r.count})]},r.id))})}function W3({discarded:n,quarantine:a,undecryptable:s,missingKeyIds:r}){return f.jsxs("div",{className:"mt-5 border-t border-[#cbd8c8] pt-4",children:[f.jsx("p",{className:"text-[11px] font-semibold text-[#687062]",children:"Recovery drawers"}),f.jsxs("div",{className:"mt-2 grid grid-cols-3 gap-2",children:[f.jsxs("div",{className:"rounded border border-[#cbd8c8] bg-[#fbfdf8] px-3 py-2",children:[f.jsx("p",{className:"text-xs text-[#687062]",children:"Discarded"}),f.jsx("p",{className:"text-lg font-semibold tabular-nums text-[#172018]",children:n})]}),f.jsxs("div",{className:"rounded border border-[#cbd8c8] bg-[#fbfdf8] px-3 py-2",children:[f.jsx("p",{className:"text-xs text-[#687062]",children:"Quarantine"}),f.jsx("p",{className:"text-lg font-semibold tabular-nums text-[#172018]",children:a})]}),f.jsxs("div",{className:"rounded border border-[#cbd8c8] bg-[#fbfdf8] px-3 py-2",children:[f.jsx("p",{className:"text-xs text-[#687062]",children:"Undecryptable"}),f.jsx("p",{className:"text-lg font-semibold tabular-nums text-[#172018]",children:s})]})]}),s>0&&f.jsxs("p",{className:"mt-2 text-[11px] leading-4 text-[#687062]",children:["missing key ",r[0],r.length>1?` +${r.length-1} more`:""]})]})}function I3({candidates:n,onOpen:a}){return f.jsxs("div",{className:"mt-5 border-t border-[#cbd8c8] pt-4",children:[f.jsx("p",{className:"text-[11px] font-semibold text-[#687062]",children:"Screener"}),f.jsxs("div",{className:"mt-2 space-y-2",children:[n.slice(0,5).map(s=>f.jsxs("button",{type:"button",onClick:()=>a(s.messageId),className:"block w-full rounded border border-[#cbd8c8] bg-[#fbfdf8] px-3 py-2 text-left hover:border-[#9fb8a7]",children:[f.jsx("p",{className:"truncate text-xs font-semibold text-[#172018]",children:s.senderEmail}),f.jsx("p",{className:"mt-1 truncate text-xs text-[#687062]",children:s.trustReason})]},s.id)),n.length===0&&f.jsx("p",{className:"text-xs text-[#687062]",children:"No pending senders."})]})]})}function eC({entries:n}){return f.jsxs("div",{className:"mt-5 border-t border-[#cbd8c8] pt-4",children:[f.jsx("p",{className:"text-[11px] font-semibold text-[#687062]",children:"Access audit"}),f.jsxs("div",{className:"mt-2 space-y-2",children:[n.slice(0,4).map(a=>f.jsxs("div",{className:"text-xs leading-4 text-[#687062]",children:[f.jsx("p",{className:"truncate font-medium text-[#3f4b42]",children:a.tool}),f.jsx("p",{className:"truncate",children:X3(a)}),f.jsx("p",{className:"truncate",children:a.reason})]},a.id)),n.length===0&&f.jsx("p",{className:"text-xs text-[#687062]",children:"No reads yet."})]})]})}function tC({message:n,selected:a,onSelect:s}){return f.jsxs("button",{type:"button",onClick:s,className:`block w-full border-b border-[#d8e2d4] px-4 py-3 text-left transition-colors ${a?"bg-[#eaf4ee]":"hover:bg-[#eef4ec]"}`,children:[f.jsxs("div",{className:"flex items-start justify-between gap-3",children:[f.jsx("p",{className:"min-w-0 truncate text-sm font-semibold text-[#172018]",children:pl(n.from)}),f.jsx("span",{className:"shrink-0 text-xs tabular-nums text-[#687062]",children:et(n.receivedAt)})]}),f.jsx("p",{className:"mt-1 truncate text-sm text-[#26352a]",children:Yb(n)}),f.jsx("p",{className:"mt-1 line-clamp-2 text-xs leading-5 text-[#687062]",children:pt(n.snippet,150)}),f.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[f.jsx("span",{className:`rounded px-2 py-0.5 text-[11px] ring-1 ${oh(n.placement)}`,children:n.placement}),f.jsx("span",{className:"truncate text-[11px] text-[#687062]",children:Gb(n)})]})]})}function nC({record:n}){const a=n.deliveryEvents[n.deliveryEvents.length-1];return f.jsxs("div",{className:"border-b border-[#d8e2d4] px-4 py-3",children:[f.jsxs("div",{className:"flex items-start justify-between gap-3",children:[f.jsx("p",{className:"min-w-0 truncate text-sm font-semibold text-[#172018]",children:n.subject||"(no subject)"}),f.jsx("span",{className:`shrink-0 rounded px-2 py-0.5 text-[11px] ring-1 ${oh(n.status)}`,children:n.status})]}),f.jsxs("p",{className:"mt-1 truncate text-xs text-[#536157]",children:["to ",pl(n.to)]}),f.jsxs("p",{className:"mt-1 text-xs text-[#687062]",children:[F3(n)," · ",et(Z3(n))]}),f.jsxs("p",{className:"mt-1 truncate text-xs text-[#687062]",children:[K3(n)," · ",n.sendMode??"mode unknown",n.policyDecision?` · policy ${n.policyDecision.code} / ${n.policyDecision.fallback}`:""]}),(n.providerMessageId||n.providerRequestId)&&f.jsxs("p",{className:"mt-1 truncate text-xs text-[#687062]",children:["provider ",n.providerMessageId??"unknown",n.providerRequestId?` · request ${n.providerRequestId}`:""]}),a&&f.jsx("p",{className:"mt-1 line-clamp-2 text-xs leading-5 text-[#687062]",children:a.bodySafeSummary})]})}function aC({detail:n}){const a=n.message;return f.jsxs("article",{className:"min-h-[66vh]",children:[f.jsxs("header",{className:"border-b border-[#cbd8c8] bg-[#fbfdf8] px-6 py-5",children:[f.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[f.jsx("h2",{className:"min-w-0 text-xl font-semibold leading-tight text-[#172018]",children:Yb(a)}),f.jsx("span",{className:`rounded px-2 py-0.5 text-xs ring-1 ${oh(a.placement)}`,children:a.placement})]}),f.jsxs("div",{className:"mt-4 grid gap-1 text-sm text-[#536157]",children:[f.jsxs("p",{children:[f.jsx("span",{className:"font-medium text-[#172018]",children:"From:"})," ",pl(a.from)]}),f.jsxs("p",{children:[f.jsx("span",{className:"font-medium text-[#172018]",children:"To:"})," ",pl(a.to)]}),a.cc.length>0&&f.jsxs("p",{children:[f.jsx("span",{className:"font-medium text-[#172018]",children:"Cc:"})," ",pl(a.cc)]}),f.jsxs("p",{children:[f.jsx("span",{className:"font-medium text-[#172018]",children:"Received:"})," ",new Date(a.receivedAt).toLocaleString()]}),f.jsxs("p",{children:[f.jsx("span",{className:"font-medium text-[#172018]",children:"Provenance:"})," ",Gb(a)]})]})]}),f.jsx("div",{className:"border-b border-[#f0d0bd] bg-[#fff4e4] px-6 py-3 text-sm text-[#8a4a18]",children:a.untrustedContentWarning}),f.jsxs("div",{className:"px-6 py-6",children:[f.jsx("pre",{className:"whitespace-pre-wrap break-words font-body text-sm leading-7 text-[#26352a]",children:a.text||"(no text body)"}),a.bodyTruncated&&f.jsx("p",{className:"mt-4 text-xs text-[#687062]",children:"Body truncated in Mailbox."}),f.jsxs("div",{className:"mt-6 grid gap-3 border-t border-[#cbd8c8] pt-4 text-xs text-[#687062] md:grid-cols-2",children:[f.jsxs("p",{children:[f.jsx("span",{className:"font-medium text-[#172018]",children:"Read reason:"})," ",a.access.reason]}),f.jsxs("p",{children:[f.jsx("span",{className:"font-medium text-[#172018]",children:"Read at:"})," ",new Date(a.access.accessedAt).toLocaleString()]})]}),a.attachments.length>0&&f.jsxs("div",{className:"mt-6 border-t border-[#cbd8c8] pt-4",children:[f.jsx("p",{className:"text-xs font-semibold text-[#687062]",children:"Attachments"}),f.jsx("div",{className:"mt-2 space-y-2",children:a.attachments.map(s=>f.jsxs("div",{className:"rounded border border-[#cbd8c8] bg-[#fbfdf8] px-3 py-2 text-sm text-[#3f4b42]",children:[s.filename," · ",s.contentType," · ",s.size.toLocaleString()," bytes"]},`${s.filename}-${s.size}`))})]})]})]})}function iC(){return f.jsx("div",{className:"grid min-h-[54vh] place-items-center p-8 text-center",children:f.jsxs("div",{children:[f.jsx("p",{className:"text-sm font-semibold text-[#172018]",children:"No message selected"}),f.jsx("p",{className:"mt-2 text-sm text-[#687062]",children:"Reading pane idle."})]})})}function tx({label:n}){return f.jsxs("div",{className:"flex items-center gap-2 p-6",children:[f.jsx("div",{className:"h-2 w-2 animate-pulse rounded-full bg-[#2f8f4e]"}),f.jsxs("span",{className:"text-xs text-[#687062]",children:[n,"..."]})]})}function jd(n){const a=n.function.name,s=sC(n.function.arguments);return a==="settle"?{kind:"response",name:a,id:n.id,deliveredText:s.answer??null,delegatedThought:null,metadata:s.intent??null,rawArgs:null}:a==="ponder"?{kind:"delegation",name:a,id:n.id,deliveredText:s.say??null,delegatedThought:s.thought??null,metadata:null,rawArgs:null}:a==="rest"?{kind:"rest",name:a,id:n.id,deliveredText:null,delegatedThought:null,metadata:null,rawArgs:null}:a==="observe"?{kind:"observe",name:a,id:n.id,deliveredText:null,delegatedThought:null,metadata:s.reason??null,rawArgs:null}:a==="surface"?{kind:"surface",name:a,id:n.id,deliveredText:s.content??null,delegatedThought:null,metadata:s.delegationId??s.friendId??null,rawArgs:null}:{kind:"action",name:a,id:n.id,deliveredText:null,delegatedThought:null,metadata:null,rawArgs:n.function.arguments}}function sC(n){try{const a=JSON.parse(n);if(a&&typeof a=="object")return a}catch{}return{}}const lC=48;function rC(n){return n.scrollHeight-n.scrollTop-n.clientHeight<=lC}function Xb(n){const a=T.useRef(null),s=T.useRef(!0),r=T.useCallback(()=>{const d=a.current;d&&(s.current=rC(d))},[]),o=T.useCallback(()=>{s.current=!1},[]);return T.useEffect(()=>{const d=a.current;!d||!s.current||(d.scrollTop=d.scrollHeight)},[n]),{ref:a,onScroll:r,preserveScroll:o}}function oC(n){return typeof n=="string"?n:Array.isArray(n)?n.map(a=>a.type==="text"&&typeof a.text=="string"?a.text:"").filter(a=>a.length>0).join(""):""}function Ml(n){return oC(n.content)}function Kb(n){return n.time.authoredAt??n.time.observedAt??n.time.recordedAt}const nx={"needs-reply":{color:"red",label:"needs reply"},"on-hold":{color:"yellow",label:"on hold"},monitoring:{color:"zinc",label:"monitoring"},idle:{color:"zinc",label:"idle"}};function Fb(n){return n==="bluebubbles"?"iMessage":n==="teams"?"Teams":n==="cli"?"CLI":n==="mail"?"Mail":n==="voice"?"Voice":n}function uC(n){return n==="bluebubbles"?"imessage":n==="teams"?"teams":n==="cli"?"terminal":"default"}function cC(n){return n==="imessage"?"overflow-hidden rounded-xl bg-[#f5f5f7] text-[#1d1d1f] ring-1 ring-black/10":n==="teams"?"overflow-hidden rounded-xl bg-[#f7f5ff] text-[#242424] ring-1 ring-[#d8d1ff]":n==="terminal"?"overflow-hidden rounded-lg bg-[#050807] font-mono text-[#d1fae5] ring-1 ring-[#1f3a2c]":"overflow-hidden rounded-lg bg-ouro-void/60 text-ouro-bone ring-1 ring-ouro-moss/15"}function fC(n){return n==="imessage"?"border-b border-black/10 bg-[#fbfbfd] px-4 py-3 text-center":n==="teams"?"border-b border-[#d8d1ff] bg-[#4f3bb3] px-4 py-3 text-white":n==="terminal"?"border-b border-[#1f3a2c] bg-[#101815] px-4 py-2 text-[#86efac]":"border-b border-ouro-moss/15 px-4 py-3"}function dC(n){return n==="imessage"?"max-w-[85%] sm:max-w-[75%] rounded-2xl rounded-bl-md bg-[#e9e9eb] px-3.5 py-2 text-[#1d1d1f]":n==="teams"?"max-w-[85%] sm:max-w-[75%] rounded-md bg-white px-3.5 py-2 text-[#242424] shadow-sm ring-1 ring-[#e5e5e5]":n==="terminal"?"max-w-full rounded-none border-l-2 border-[#60a5fa] bg-transparent px-3 py-2 text-[#dbeafe]":"max-w-[85%] sm:max-w-[75%] rounded-2xl rounded-bl-sm bg-ouro-moss/25 px-3.5 py-2 ring-1 ring-ouro-moss/15"}function io(n,a="normal"){return n==="imessage"?"max-w-[85%] sm:max-w-[75%] rounded-2xl rounded-br-md bg-[#0a84ff] px-3.5 py-2 text-white":n==="teams"?"max-w-[85%] sm:max-w-[75%] rounded-md bg-[#ede9fe] px-3.5 py-2 text-[#242424] shadow-sm ring-1 ring-[#c4b5fd]":n==="terminal"?"max-w-full rounded-none border-l-2 border-[#22c55e] bg-transparent px-3 py-2 text-[#bbf7d0]":a==="surface"?"max-w-[85%] sm:max-w-[75%] rounded-2xl rounded-br-sm bg-ouro-scale/12 px-3.5 py-2 ring-1 ring-ouro-scale/15":"max-w-[85%] sm:max-w-[75%] rounded-2xl rounded-br-sm bg-ouro-glow/8 px-3.5 py-2 ring-1 ring-ouro-glow/12"}function sl(n,a){return n==="imessage"?a==="agent"?"font-mono text-[9px] text-white/70":"font-mono text-[9px] text-[#6b7280]":n==="teams"?"font-mono text-[9px] uppercase tracking-wider text-[#5b5fc7]":n==="terminal"?a==="agent"?"font-mono text-[11px] text-[#22c55e]":"font-mono text-[11px] text-[#60a5fa]":a==="surface"||a==="agent"?"font-mono text-[9px] uppercase tracking-wider text-ouro-glow/70":"font-mono text-[9px] uppercase tracking-wider text-ouro-gold/70"}function ll(n,a="agent"){return n==="imessage"?"text-sm leading-relaxed whitespace-pre-wrap break-words":n==="teams"?"text-sm leading-relaxed text-[#242424] whitespace-pre-wrap break-words":n==="terminal"?`font-mono text-[12px] leading-6 whitespace-pre-wrap break-words ${a==="agent"?"text-[#bbf7d0]":"text-[#dbeafe]"}`:"text-sm leading-relaxed text-ouro-bone whitespace-pre-wrap break-words"}function hC(n){return Kb(n)}function Xi(n){return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(hC(n)))}function mC({agentName:n,focus:a,onFocusConsumed:s,deskPrefs:r,refreshGeneration:o}){Pi();const[d,h]=T.useState(null),[p,m]=T.useState(null),[g,x]=T.useState(null),[y,S]=T.useState(!1),w=T.useRef(null);T.useEffect(()=>{_e(`/agents/${encodeURIComponent(n)}/sessions`).then(h)},[n,o]),T.useEffect(()=>{a&&(w.current=null,m(a),x(null),S(!0),s==null||s())},[n,a,s]),T.useEffect(()=>{if(!p)return;const k=`${p}:${o}`;if(w.current===k)return;w.current=k,S(!0);const[U,P,F]=p.split("/");_e(`/agents/${encodeURIComponent(n)}/sessions/${encodeURIComponent(U)}/${encodeURIComponent(P)}/${encodeURIComponent(F)}`).then(x).catch(()=>x(null)).finally(()=>S(!1))},[n,p,o,a]);function j(k){if(p===k){m(null),x(null),w.current=null;return}m(k),x(null),S(!0)}const E=new Set((r==null?void 0:r.starredFriends)??[]);if(!d)return f.jsx(Zb,{label:"Loading sessions"});const C=new Map;for(const k of d.items)C.has(k.friendId)||C.set(k.friendId,[]),C.get(k.friendId).push(k);const z=[...C.entries()].sort((k,U)=>{const P=E.has(k[0])?0:1,F=E.has(U[0])?0:1;return P!==F?P-F:U[1].length-k[1].length}),D=[],R=new Map;for(const[k,U]of z)R.set(D.length,{name:U[0].friendName,channels:U.length,starred:E.has(k)}),D.push(...U);return f.jsxs("div",{className:"space-y-3",children:[f.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:[d.totalCount," sessions · ",d.activeCount," active · ",d.staleCount," stale"]}),f.jsx("div",{className:"space-y-1.5",children:D.map((k,U)=>{var Se;const P=R.get(U),F=E.has(k.friendId),W=`${k.friendId}/${k.channel}/${k.key}`,re=p===W,B=nx[k.replyState]??nx.idle,Z=((Se=k.lastUsage)==null?void 0:Se.total_tokens)??k.estimatedTokens??0,le=Z>0?Math.min(100,Math.round(Z/8e4*100)):0;return f.jsxs("div",{children:[P&&P.channels>1&&f.jsxs("div",{className:"flex items-center gap-2 pt-3 pb-1",children:[P.starred&&f.jsx("span",{className:"text-ouro-gold text-sm",children:"★"}),f.jsx("span",{className:"font-medium text-ouro-bone text-sm",children:P.name}),f.jsxs("span",{className:"text-xs text-ouro-shadow",children:[P.channels," channels"]})]}),f.jsxs("button",{onClick:()=>j(W),className:`flex w-full flex-col gap-1.5 rounded-lg px-3 py-3 text-left transition-colors ring-1 ${re?"bg-ouro-moss/15 ring-ouro-glow/20":"ring-ouro-moss/15 hover:bg-ouro-moss/8"}`,children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[F&&f.jsx("span",{className:"text-ouro-gold",title:"Starred",children:"★"}),f.jsx("span",{className:"truncate font-medium text-ouro-bone",children:k.friendName}),f.jsxs("span",{className:"shrink-0 text-xs text-ouro-shadow",children:["via ",Fb(k.channel)]}),f.jsx(xe,{color:B.color,children:B.label})]}),f.jsx("span",{className:"shrink-0 text-xs tabular-nums text-ouro-shadow",children:et(k.lastActivityAt)})]}),k.latestUserExcerpt&&f.jsxs("p",{className:"truncate text-xs text-ouro-gold/70",children:[f.jsx("span",{className:"font-mono text-[9px] uppercase tracking-wider",children:"in:"})," ",pt(k.latestUserExcerpt,100)]}),k.latestAssistantExcerpt&&f.jsxs("p",{className:"truncate text-xs text-ouro-glow/60",children:[f.jsx("span",{className:"font-mono text-[9px] uppercase tracking-wider",children:"out:"})," ",pt(k.latestAssistantExcerpt,100)]}),f.jsxs("div",{className:"flex items-center gap-3 text-xs text-ouro-shadow",children:[f.jsxs("span",{className:"tabular-nums",children:[k.messageCount," msgs"]}),k.lastUsage&&f.jsxs("span",{className:"tabular-nums",children:[k.lastUsage.total_tokens.toLocaleString()," tok"]}),le>0&&f.jsxs("div",{className:"flex items-center gap-1.5 flex-1 max-w-32",title:"Context pressure — steady state oscillates between 80-100%",children:[f.jsx("div",{className:"h-1 flex-1 rounded-full bg-ouro-moss/20",children:f.jsx("div",{className:`h-1 rounded-full transition-all ${le>100?"bg-ouro-fang":le>80?"bg-ouro-gold":"bg-ouro-glow"}`,style:{width:`${Math.min(100,le)}%`}})}),f.jsxs("span",{className:"tabular-nums text-[10px]",children:[le,"%"]})]})]})]}),re&&f.jsx(pC,{loading:y,transcript:g})]},W)})})]})}function pC({loading:n,transcript:a}){var d;const s=((d=a==null?void 0:a.messages[a.messages.length-1])==null?void 0:d.id)??null,{ref:r,onScroll:o}=Xb(s);return f.jsxs("div",{ref:r,"data-testid":"session-transcript-scroll",onScroll:o,className:"mt-1 max-h-[70vh] overflow-y-auto rounded-lg",children:[n&&!a&&f.jsx(Zb,{label:"Loading transcript"}),a&&f.jsx(gC,{transcript:a})]})}function gC({transcript:n}){const{messages:a,lastUsage:s}=n,r=uC(n.channel),o=a.filter(g=>g.role==="system"),d=a.filter(g=>g.role!=="system"),[h,p]=T.useState(!1),m=new Map;for(const g of d)g.role==="tool"&&g.toolCallId&&m.set(g.toolCallId,g);return f.jsxs("div",{className:cC(r),children:[f.jsxs("div",{className:fC(r),children:[f.jsx("p",{className:r==="terminal"?"font-mono text-xs":"text-sm font-semibold",children:Fb(n.channel)}),f.jsxs("p",{className:r==="terminal"?"mt-0.5 font-mono text-[10px] text-[#6ee7b7]":"mt-0.5 text-xs opacity-70",children:[n.friendName," · ",n.messageCount," messages"]})]}),f.jsxs("div",{className:"space-y-0.5 p-3",children:[s&&f.jsxs("p",{className:r==="terminal"?"pb-2 font-mono text-[10px] text-[#6ee7b7]":"pb-2 font-mono text-[10px] opacity-60",children:[s.input_tokens.toLocaleString()," in · ",s.output_tokens.toLocaleString()," out · ",s.total_tokens.toLocaleString()," total"]}),o.length>0&&f.jsxs("div",{className:"pb-2 mb-2 border-b border-current/10",children:[f.jsxs("button",{onClick:()=>p(!h),className:"font-mono text-[10px] uppercase tracking-wider opacity-60 transition-opacity hover:opacity-90",children:[h?"▼":"▶"," system context (",o.length,")"]}),h&&o.map(g=>f.jsxs("div",{className:"mt-2 max-h-60 overflow-y-auto rounded bg-black/5 p-2 text-xs opacity-75 whitespace-pre-wrap break-words",children:[f.jsx("p",{className:"mb-1 font-mono text-[9px] opacity-70",children:Xi(g)}),Ml(g)]},g.id))]}),d.map(g=>g.role==="tool"?null:g.role==="user"?f.jsx(vC,{msg:g,surface:r},g.id):g.role==="assistant"?f.jsx(xC,{msg:g,toolResults:m,surface:r},g.id):null)]})]})}function vC({msg:n,surface:a}){const s=Ml(n);return f.jsx("div",{className:"flex justify-start py-1",children:f.jsxs("div",{className:dC(a),children:[f.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[f.jsx("p",{className:sl(a,"user"),children:a==="terminal"?"human $":"user"}),f.jsxs("span",{className:"font-mono text-[9px] text-ouro-shadow/40",children:["#",n.sequence]}),f.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:Xi(n)})]}),f.jsx("p",{className:ll(a,"user"),children:s})]})})}function xC({msg:n,toolResults:a,surface:s}){const r=Ml(n),o=(n.toolCalls??[]).map(jd),d=o.filter(m=>m.kind!=="action"),h=o.filter(m=>m.kind==="action"),p=[];for(const m of d)m.kind==="response"?p.push(f.jsx("div",{className:"flex justify-end py-1",children:f.jsxs("div",{className:io(s),children:[f.jsxs("div",{className:"mb-0.5 flex items-center gap-2",children:[f.jsx("p",{className:sl(s,"agent"),children:s==="terminal"?"agent >":"agent"}),f.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:Xi(n)})]}),f.jsx("p",{className:ll(s),children:m.deliveredText}),m.metadata&&m.metadata!=="complete"&&f.jsxs("p",{className:"mt-1 font-mono text-[9px] text-ouro-shadow",children:["intent: ",m.metadata]})]})},m.id)):m.kind==="delegation"?p.push(f.jsx("div",{className:"flex justify-end py-1",children:f.jsxs("div",{className:io(s),children:[f.jsxs("div",{className:"mb-0.5 flex items-center gap-2",children:[f.jsx("p",{className:sl(s,"agent"),children:s==="terminal"?"agent >":"agent"}),f.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:Xi(n)})]}),m.deliveredText&&f.jsx("p",{className:ll(s),children:m.deliveredText}),m.delegatedThought&&f.jsxs("div",{className:"mt-2 rounded bg-black/10 px-2.5 py-1.5 ring-1 ring-current/10",children:[f.jsx("p",{className:"font-mono text-[9px] uppercase tracking-wider opacity-70",children:"→ inner dialog"}),f.jsx("p",{className:"mt-0.5 text-xs opacity-80",children:m.delegatedThought})]})]})},m.id)):m.kind==="surface"?p.push(f.jsx("div",{className:"flex justify-end py-1",children:f.jsxs("div",{className:io(s,"surface"),children:[f.jsxs("div",{className:"mb-0.5 flex items-center gap-2",children:[f.jsx("p",{className:sl(s,"surface"),children:"surfaced"}),f.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:Xi(n)})]}),f.jsx("p",{className:ll(s),children:m.deliveredText}),m.metadata&&f.jsxs("p",{className:"mt-1 font-mono text-[9px] text-ouro-shadow",children:["→ ",m.metadata]})]})},m.id)):m.kind==="rest"?p.push(f.jsx("div",{className:"py-1 text-center font-mono text-[10px] text-ouro-shadow/50",children:"— resting —"},m.id)):m.kind==="observe"&&p.push(f.jsxs("div",{className:"py-1 text-center font-mono text-[10px] text-ouro-shadow/50",children:["— observed",m.metadata?`: ${m.metadata}`:""," —"]},m.id));return r&&d.length===0&&p.push(f.jsx("div",{className:"flex justify-end py-1",children:f.jsxs("div",{className:io(s),children:[f.jsxs("div",{className:"mb-0.5 flex items-center gap-2",children:[f.jsx("p",{className:sl(s,"agent"),children:s==="terminal"?"agent >":"agent"}),f.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:Xi(n)})]}),f.jsx("p",{className:ll(s),children:r})]})},`${n.id}-content`)),h.length>0&&p.push(f.jsx("div",{className:"flex justify-end py-1",children:f.jsx("div",{className:"max-w-[85%] sm:max-w-[75%] space-y-1",children:h.map(m=>f.jsx(yC,{call:m,result:a.get(m.id),surface:s},m.id))})},`${n.id}-tools`)),f.jsx(f.Fragment,{children:p})}function yC({call:n,result:a,surface:s}){const[r,o]=T.useState(!1),d=a?Ml(a):null;return f.jsxs("button",{onClick:()=>o(!r),className:`w-full text-left rounded px-2.5 py-1.5 text-sm transition-colors ${s==="terminal"?"bg-[#0f1a15] font-mono text-[#bbf7d0] ring-1 ring-[#1f3a2c] hover:ring-[#22c55e]/40":s==="teams"?"bg-white text-[#242424] ring-1 ring-[#d8d1ff] hover:ring-[#5b5fc7]/40":s==="imessage"?"bg-white text-[#1d1d1f] ring-1 ring-black/10 hover:ring-[#0a84ff]/30":"bg-ouro-moss/10 ring-1 ring-ouro-moss/12 hover:ring-ouro-glow/15"}`,children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{className:"font-mono text-xs text-ouro-glow",children:n.name}),!r&&f.jsx("span",{className:"text-[10px] text-ouro-shadow",children:"tap to inspect"})]}),r&&f.jsxs(f.Fragment,{children:[n.rawArgs&&f.jsx("pre",{className:"mt-1.5 max-h-24 overflow-y-auto rounded bg-ouro-void/40 p-1.5 font-mono text-[11px] text-ouro-shadow whitespace-pre-wrap break-words",children:n.rawArgs}),a&&f.jsxs("div",{className:"mt-1.5 border-t border-ouro-moss/15 pt-1.5",children:[f.jsx(xe,{children:"result"}),f.jsx("pre",{className:"mt-1 max-h-32 overflow-y-auto rounded bg-ouro-void/40 p-1.5 font-mono text-[11px] text-ouro-mist whitespace-pre-wrap break-words",children:d})]})]})]})}function Zb({label:n}){return f.jsxs("div",{className:"flex items-center gap-2 py-6",children:[f.jsx("div",{className:"h-2 w-2 animate-pulse rounded-full bg-ouro-glow"}),f.jsxs("span",{className:"font-mono text-xs text-ouro-shadow",children:[n,"…"]})]})}function bC({agentName:n,view:a,focus:s,onFocusConsumed:r,refreshGeneration:o}){var R,k;const d=Pi(),[h,p]=T.useState(null),[m,g]=T.useState(null),[x,y]=T.useState(null),S=a.work,w=S.obligations,j=S.tasks;T.useEffect(()=>{_e(`/agents/${encodeURIComponent(n)}/coding`).then(p),_e(`/agents/${encodeURIComponent(n)}/obligations`).then(g).catch(()=>{}),_e(`/agents/${encodeURIComponent(n)}/self-fix`).then(y).catch(()=>{})},[n,o]);const E=(m==null?void 0:m.items)??w.items,C=(m==null?void 0:m.openCount)??w.openCount,z=(h==null?void 0:h.items)??[],D=new Map;for(const U of z){const P=U.obligationId;if(P){const F=D.get(P);F?F.push(U):D.set(P,[U])}}return f.jsxs("div",{className:"space-y-8",children:[f.jsxs("section",{children:[f.jsx(so,{label:`Obligations (${C} open)`}),(m==null?void 0:m.primarySelectionReason)&&f.jsxs("p",{className:"mt-1 text-xs text-ouro-shadow",children:["Primary: ",m.primarySelectionReason]}),E.length>0?f.jsx("div",{className:"mt-3 space-y-3",children:E.map(U=>{const P=D.get(U.id)??[],F=SC(U)?U:null,W=(F==null?void 0:F.isPrimary)??!1,re=(F==null?void 0:F.meaning)??null,B=U.origin;return f.jsxs("div",{className:`rounded-lg px-3 py-3 ring-1 ${W?"bg-ouro-glow/5 ring-ouro-glow/20":"bg-ouro-void/40 ring-ouro-moss/15"}`,children:[f.jsxs("div",{className:"flex items-start gap-2",children:[W&&f.jsx(xe,{color:"lime",children:"primary"}),f.jsx(xe,{color:U.status==="pending"?"yellow":U.status==="fulfilled"?"lime":"zinc",children:U.status}),f.jsx("span",{className:"text-sm font-medium text-ouro-bone",children:pt(U.content,120)})]}),B&&f.jsxs("button",{onClick:()=>d({tab:"sessions",focus:`${B.friendId}/${B.channel}/${B.key}`}),className:"mt-2 flex w-full items-center gap-2 rounded-md bg-ouro-moss/8 px-2.5 py-1.5 text-left text-xs ring-1 ring-ouro-moss/10 hover:ring-ouro-glow/20 transition-colors",children:[f.jsx("span",{className:"text-ouro-shadow",children:"from"}),f.jsx("span",{className:"font-medium text-ouro-glow",children:B.channel}),f.jsx("span",{className:"text-ouro-shadow",children:"→"}),f.jsx("span",{className:"text-ouro-mist truncate",children:B.key}),f.jsx("span",{className:"ml-auto text-ouro-shadow",children:"open session →"})]}),U.currentSurface&&f.jsxs("div",{className:"mt-1 text-xs text-ouro-mist",children:["surface: ",f.jsx("span",{className:"text-ouro-bone",children:U.currentSurface.kind})," — ",U.currentSurface.label]}),(re==null?void 0:re.waitingOn)&&f.jsxs("p",{className:"mt-1 text-xs text-ouro-shadow",children:["Waiting on: ",re.waitingOn]}),P.length>0&&f.jsxs("div",{className:"mt-2 space-y-1",children:[f.jsx("p",{className:"font-mono text-[9px] uppercase tracking-wider text-ouro-shadow",children:"Linked coding"}),P.map(Z=>f.jsxs("div",{className:"flex items-center gap-2 rounded bg-ouro-moss/10 px-2 py-1 text-xs",children:[f.jsx(xe,{color:Z.status==="failed"?"red":Z.status==="running"?"lime":"zinc",children:Z.status}),f.jsxs("span",{className:"text-ouro-mist truncate",children:[Z.runner," — ",Z.workdir]})]},Z.id))]}),U.nextAction&&f.jsxs("p",{className:"mt-1.5 text-xs text-ouro-mist",children:["Next: ",U.nextAction]}),f.jsx("p",{className:"mt-1 text-xs text-ouro-shadow",children:et(U.updatedAt)})]},U.id)})}):f.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No open obligations."})]}),x&&x.steps.length>0&&f.jsxs("section",{children:[f.jsx(so,{label:`Self-fix ${x.active?"(active)":"(inactive)"}`}),x.currentStep&&f.jsxs("p",{className:"mt-1 text-xs text-ouro-glow",children:["Current: ",x.currentStep]}),f.jsx("div",{className:"mt-3 space-y-1.5",children:x.steps.map((U,P)=>f.jsxs("div",{className:`flex items-center gap-2.5 rounded-lg px-3 py-2 ring-1 ${U.status==="active"?"bg-ouro-glow/5 ring-ouro-glow/20":U.status==="done"?"bg-ouro-void/40 ring-ouro-glow/10":"bg-ouro-void/40 ring-ouro-moss/10"}`,children:[f.jsx(xe,{color:U.status==="done"?"lime":U.status==="active"?"yellow":(U.status==="skipped","zinc"),children:U.status}),f.jsx("span",{className:`text-sm ${U.status==="active"?"font-medium text-ouro-bone":"text-ouro-mist"}`,children:U.label}),U.detail&&f.jsx("span",{className:"ml-auto text-xs text-ouro-shadow",children:U.detail})]},P))})]}),f.jsxs("section",{children:[f.jsx(so,{label:`Coding lanes (${z.length})`}),z.length>0?f.jsx("div",{className:"mt-3 space-y-2",children:z.map(U=>{const P=U.status,F=P==="failed",W=U.failure,re=U.obligationId,B=U.originSession;return f.jsxs("div",{className:"rounded-lg bg-ouro-void/40 px-3 py-3 ring-1 ring-ouro-moss/15",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(xe,{color:F?"red":P==="running"?"lime":P==="completed"?"zinc":"yellow",children:P}),f.jsx("span",{className:"text-sm font-medium text-ouro-bone",children:U.runner}),f.jsx("span",{className:"truncate text-xs text-ouro-shadow",children:U.workdir})]}),f.jsxs("div",{className:"mt-1 flex flex-wrap gap-2",children:[re&&f.jsxs("button",{onClick:()=>d({tab:"work",focus:re}),className:"text-xs text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2 hover:decoration-ouro-glow",children:["obligation: ",re.slice(0,20),"…"]}),U.taskRef&&f.jsxs("span",{className:"text-xs text-ouro-glow",children:["task: ",U.taskRef]}),B&&f.jsx("button",{onClick:()=>{d({tab:"sessions",focus:`${B.friendId}/${B.channel}/${B.key}`})},className:"text-xs text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2 hover:decoration-ouro-glow",children:"origin session"})]}),U.checkpoint&&f.jsx("p",{className:"mt-1.5 text-xs text-ouro-mist",children:pt(U.checkpoint,100)}),f.jsxs("p",{className:"mt-1 text-xs text-ouro-shadow",children:["pid ",U.pid??"–"," · restarts ",U.restartCount," · ",et(U.lastActivityAt)]}),F&&W&&f.jsxs("div",{className:"mt-2 rounded bg-ouro-fang/5 p-2 text-xs ring-1 ring-ouro-fang/15",children:[f.jsx("span",{className:"font-semibold text-ouro-fang",children:"FAILURE:"})," ",f.jsxs("span",{className:"text-ouro-mist",children:[W.command," exited ",String(W.code??W.signal)]}),W.stderrTail&&f.jsx("pre",{className:"mt-1 max-h-20 overflow-y-auto font-mono text-[11px] text-ouro-shadow whitespace-pre-wrap",children:W.stderrTail})]})]},U.id)})}):f.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No coding sessions."})]}),f.jsxs("section",{children:[f.jsx(so,{label:`Tasks (${j.liveCount} live, ${j.blockedCount} blocked)`}),((R=j.liveTaskNames)==null?void 0:R.length)>0?f.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:j.liveTaskNames.map(U=>f.jsx(xe,{children:U},U))}):f.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No live tasks."}),((k=j.actionRequired)==null?void 0:k.length)>0&&f.jsxs("div",{className:"mt-3",children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-ouro-fang",children:"Action required"}),f.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:j.actionRequired.map(U=>f.jsx(xe,{color:"red",children:U},U))})]})]})]})}function so({label:n}){return f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:n})}function SC(n){return"isPrimary"in n}function wC({agentName:n,focus:a,onFocusConsumed:s,refreshGeneration:r}){const o=Pi(),[d,h]=T.useState(null),[p,m]=T.useState(null),[g,x]=T.useState(null);T.useEffect(()=>{const j=`/agents/${encodeURIComponent(n)}`;Promise.all([_e(`${j}/attention`).then(h),_e(`${j}/bridges`).then(m),_e(`${j}/friends`).then(x)])},[n,r]);const y=(d==null?void 0:d.queueItems)??[],S=(p==null?void 0:p.items)??[],w=(g==null?void 0:g.friends)??[];return f.jsxs("div",{className:"space-y-8",children:[f.jsxs("section",{children:[f.jsx(Uf,{label:`Who is waiting (${(d==null?void 0:d.queueLength)??0})`}),y.length>0?f.jsx("div",{className:"mt-3 space-y-2",children:y.map((j,E)=>{const C=j.bridgeId,z=j.obligationId;return f.jsxs("div",{className:"rounded-lg bg-ouro-void/40 px-3 py-3 ring-1 ring-ouro-moss/15",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("button",{onClick:()=>o({tab:"sessions"}),className:"font-medium text-ouro-bone hover:text-ouro-glow transition-colors",children:j.friendName}),f.jsxs("span",{className:"text-xs text-ouro-shadow",children:["via ",j.channel]}),f.jsxs(xe,{color:"yellow",children:["waiting ",et(new Date(j.timestamp).toISOString())]})]}),f.jsx("p",{className:"mt-1 text-sm text-ouro-mist",children:pt(j.delegatedContent,140)}),f.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-2 text-xs",children:[C&&f.jsxs("button",{onClick:()=>o({tab:"connections",focus:C}),className:"text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2 hover:decoration-ouro-glow",children:["bridge: ",C.slice(0,12),"…"]}),z&&f.jsxs("button",{onClick:()=>o({tab:"work",focus:z}),className:"text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2 hover:decoration-ouro-glow",children:["obligation: ",z.slice(0,16),"…"]})]})]},E)})}):f.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"Nobody waiting."})]}),f.jsxs("section",{children:[f.jsx(Uf,{label:`Bridges (${(p==null?void 0:p.totalCount)??0})`}),S.length>0?f.jsx("div",{className:"mt-3 space-y-3",children:S.map(j=>{const E=j.attachedSessions,C=j.task,z=j.lifecycle==="active";return f.jsxs("div",{className:`rounded-lg px-3 py-3 ring-1 ${z?"bg-ouro-moss/10 ring-ouro-glow/12":"bg-ouro-void/40 ring-ouro-moss/15"}`,children:[f.jsxs("div",{className:"flex items-start gap-2",children:[f.jsx(xe,{color:z?"lime":"zinc",children:j.lifecycle}),f.jsx("p",{className:"font-medium text-ouro-bone",children:j.objective})]}),j.summary&&f.jsx("p",{className:"mt-1 text-sm text-ouro-mist",children:pt(j.summary,160)}),E.length>0&&f.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:E.map((D,R)=>f.jsxs("button",{onClick:()=>o({tab:"sessions",focus:`${D.friendId}/${D.channel}/${D.key}`}),className:"rounded-md bg-ouro-moss/10 px-2 py-0.5 font-mono text-[11px] text-ouro-glow ring-1 ring-ouro-moss/12 hover:ring-ouro-glow/25 transition-colors",children:[D.friendId,"/",D.channel,"/",D.key]},R))}),C&&f.jsxs("p",{className:"mt-1.5 text-xs",children:[f.jsxs("button",{onClick:()=>o({tab:"work"}),className:"text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2 hover:decoration-ouro-glow",children:["task: ",C.taskName]}),f.jsxs("span",{className:"text-ouro-shadow",children:[" (",C.mode,")"]})]}),f.jsx("p",{className:"mt-1 text-xs text-ouro-shadow",children:et(j.updatedAt)})]},j.id)})}):f.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No bridges."})]}),f.jsxs("section",{children:[f.jsx(Uf,{label:`Friends (${(g==null?void 0:g.totalFriends)??0})`}),w.length>0?f.jsx("div",{className:"mt-3 space-y-1.5",children:w.map(j=>f.jsxs("div",{className:"flex items-center justify-between rounded-lg bg-ouro-void/40 px-3 py-2.5 ring-1 ring-ouro-moss/15",children:[f.jsxs("div",{className:"min-w-0",children:[f.jsx("button",{onClick:()=>o({tab:"sessions"}),className:"font-medium text-ouro-bone hover:text-ouro-glow transition-colors",children:j.friendName}),f.jsxs("p",{className:"text-xs text-ouro-shadow",children:[j.channels.join(", ")," · ",j.sessionCount," sessions",j.lastActivityAt&&f.jsxs(f.Fragment,{children:[" · ",et(j.lastActivityAt)]})]})]}),f.jsxs("div",{className:"shrink-0 text-right",children:[f.jsx("p",{className:"tabular-nums text-sm font-medium text-ouro-bone",children:j.totalTokens.toLocaleString()}),f.jsx("p",{className:"text-[10px] text-ouro-shadow",children:"tokens"})]})]},j.friendId))}):f.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No friends."})]})]})}function Uf({label:n}){return f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:n})}function TC(n){return Kb(n)}function el(n){return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(TC(n)))}function jC({agentName:n,view:a,refreshGeneration:s}){const r=Pi(),[o,d]=T.useState(null),[h,p]=T.useState(null),[m,g]=T.useState(!1),x=T.useRef(null),y=a.inner;T.useEffect(()=>{_e(`/agents/${encodeURIComponent(n)}/habits`).then(d)},[n,s]),T.useEffect(()=>{h&&x.current!==s&&(x.current=s,_e(`/agents/${encodeURIComponent(n)}/inner-transcript`).then(p))},[n,s,h!==null]);function S(){if(h){g(!m);return}_e(`/agents/${encodeURIComponent(n)}/inner-transcript`).then(k=>{x.current=s,p(k),g(!0)})}const w=(o==null?void 0:o.items)??[],j=w.filter(k=>k.isOverdue),E=w.filter(k=>k.status==="active"&&!k.isOverdue),C=w.filter(k=>k.status==="paused"),z=y.mode==="deep"?y.origin:null,D=y.mode==="deep"?y.obligationStatus:null,R=w.find(k=>k.name.toLowerCase()==="heartbeat");return f.jsxs("div",{className:"space-y-8",children:[R&&f.jsxs("section",{children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:"Heartbeat"}),f.jsx("div",{className:`mt-2 rounded-xl p-4 ring-1 ${R.isOverdue?"bg-ouro-fang/5 ring-ouro-fang/15":"bg-ouro-moss/10 ring-ouro-glow/10"}`,children:f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:`h-2.5 w-2.5 rounded-full ${R.isOverdue?"bg-ouro-fang animate-pulse":"bg-ouro-glow"}`}),f.jsx("span",{className:"font-medium text-ouro-bone",children:R.isOverdue?"Overdue":"Healthy"}),f.jsxs("span",{className:"text-xs text-ouro-shadow",children:["every ",R.cadence??"unknown"," · last ",R.lastRun?et(R.lastRun):"never"]})]})})]}),f.jsx("section",{children:f.jsxs("div",{className:"rounded-xl bg-ouro-moss/15 p-4 ring-1 ring-ouro-glow/10",children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-ouro-glow",children:"Inner work"}),f.jsx("p",{className:"mt-1 font-display text-xl italic font-semibold text-ouro-bone",children:y.status}),y.summary&&f.jsx("p",{className:"mt-2 text-sm leading-relaxed text-ouro-mist",children:y.summary}),f.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:y.hasPending?"Pending inner work queued.":"No pending inner work."}),z&&f.jsxs("div",{className:"mt-3",children:[f.jsx("p",{className:"font-mono text-[9px] uppercase tracking-wider text-ouro-shadow",children:"Triggered from"}),f.jsxs("button",{onClick:()=>{r({tab:"sessions",focus:`${z.friendId}/${z.channel}/${z.key}`})},className:"mt-1 text-xs text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2 hover:decoration-ouro-glow",children:[z.friendId.slice(0,8),"…/",z.channel,"/",z.key]}),D&&f.jsxs("button",{onClick:()=>r({tab:"work"}),className:"ml-2 text-xs text-ouro-glow underline decoration-ouro-glow/30 underline-offset-2 hover:decoration-ouro-glow",children:["obligation: ",D]})]})]})}),f.jsxs("section",{children:[f.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:["Inner dialog ",h?`(${h.messages.length} total)`:""]}),h?f.jsx(EC,{messages:h.messages}):f.jsx("button",{onClick:S,className:"mt-2 w-full rounded-lg px-3 py-2.5 text-left font-mono text-xs text-ouro-glow ring-1 ring-ouro-moss/15 hover:ring-ouro-glow/20 transition-colors",children:"Load inner dialog"})]}),f.jsxs("section",{children:[f.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:["Habits (",(o==null?void 0:o.totalCount)??0,")"]}),j.length>0&&f.jsxs("div",{className:"mt-3",children:[f.jsxs("p",{className:"font-mono text-[9px] uppercase tracking-wider text-ouro-fang mb-1.5",children:["Overdue (",j.length,")"]}),f.jsx("div",{className:"space-y-1.5",children:j.map(k=>f.jsx(Bf,{h:k},k.name))})]}),E.length>0&&f.jsxs("div",{className:"mt-3",children:[f.jsxs("p",{className:"font-mono text-[9px] uppercase tracking-wider text-ouro-glow mb-1.5",children:["Running fine (",E.length,")"]}),f.jsx("div",{className:"space-y-1.5",children:E.map(k=>f.jsx(Bf,{h:k},k.name))})]}),C.length>0&&f.jsxs("div",{className:"mt-3",children:[f.jsxs("p",{className:"font-mono text-[9px] uppercase tracking-wider text-ouro-shadow mb-1.5",children:["Paused (",C.length,")"]}),f.jsx("div",{className:"space-y-1.5",children:C.map(k=>f.jsx(Bf,{h:k},k.name))})]}),w.length===0&&f.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No habits configured."})]})]})}function EC({messages:n}){var S;const a=n.filter(w=>w.role!=="system"&&w.role!=="tool"),[s,r]=T.useState(!1),o=s?a:a.slice(-30),d=a.length-o.length,h=((S=o[o.length-1])==null?void 0:S.id)??null,{ref:p,onScroll:m,preserveScroll:g}=Xb(h),x=[];for(const w of a){if(w.role!=="assistant")continue;const j=(w.toolCalls??[]).map(jd);for(const E of j)E.kind==="surface"&&x.push({index:w.sequence,kind:"surfaced",label:pt(E.deliveredText??"",40)}),E.kind==="rest"&&x.push({index:w.sequence,kind:"resting",label:"resting"}),E.kind==="delegation"&&x.push({index:w.sequence,kind:"delegated",label:"continued thinking"})}function y(w){var E;const j=(E=p.current)==null?void 0:E.querySelector(`[data-msg-index="${w}"]`);j&&j.scrollIntoView({behavior:"smooth",block:"center"})}return f.jsxs("div",{children:[x.length>0&&f.jsx("div",{className:"mt-2 mb-1 flex flex-wrap gap-1",children:x.map((w,j)=>f.jsxs("button",{onClick:()=>{g(),r(!0),setTimeout(()=>y(w.index),100)},className:`rounded-md px-2 py-0.5 text-[10px] font-mono ring-1 transition-colors ${w.kind==="surfaced"?"bg-ouro-scale/10 text-ouro-glow ring-ouro-scale/20 hover:ring-ouro-glow/30":w.kind==="resting"?"bg-ouro-void/40 text-ouro-shadow ring-ouro-moss/10":"bg-ouro-gold/5 text-ouro-gold ring-ouro-gold/10"}`,children:[w.kind==="surfaced"?"★":w.kind==="resting"?"—":"→"," #",w.index]},j))}),f.jsxs("div",{ref:p,"data-testid":"inner-transcript-scroll",onScroll:m,className:"max-h-[60vh] overflow-y-auto rounded-lg bg-ouro-void/60 p-3 ring-1 ring-ouro-moss/15 space-y-1",children:[d>0&&f.jsxs("button",{onClick:()=>{g(),r(!0)},className:"w-full rounded-lg px-3 py-2 text-center font-mono text-xs text-ouro-shadow hover:text-ouro-mist ring-1 ring-ouro-moss/10 hover:ring-ouro-moss/20 transition-colors mb-2",children:["Load ",d," earlier messages"]}),o.map(w=>{const j=Ml(w);if(w.role==="user"){const E=j.includes("[pending from")||j.includes("[delegated"),C=j.includes("waking up")||j.includes("world-state checkpoint");return f.jsx("div",{"data-msg-index":w.sequence,className:"flex justify-start py-1",children:f.jsxs("div",{className:`max-w-[85%] rounded-2xl rounded-bl-sm px-3 py-2 ring-1 ${E?"bg-ouro-gold/8 ring-ouro-gold/15":C?"bg-ouro-moss/20 ring-ouro-moss/15":"bg-ouro-moss/25 ring-ouro-moss/15"}`,children:[f.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[f.jsx("p",{className:"font-mono text-[9px] uppercase tracking-wider",style:{color:E?"var(--color-ouro-gold)":"var(--color-ouro-shadow)"},children:E?"★ delegated":C?"heartbeat":"prompt"}),f.jsxs("span",{className:"font-mono text-[9px] text-ouro-shadow/40",children:["#",w.sequence]}),f.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:el(w)})]}),f.jsx("p",{className:"text-sm leading-relaxed text-ouro-bone whitespace-pre-wrap break-words",children:j})]})},w.id)}if(w.role==="assistant"){const E=(w.toolCalls??[]).map(jd),C=E.filter(R=>R.kind==="surface"),z=E.filter(R=>R.kind==="rest"),D=E.filter(R=>R.kind==="delegation");return f.jsxs("div",{"data-msg-index":w.sequence,children:[C.map(R=>f.jsx("div",{className:"flex justify-end py-1",children:f.jsxs("div",{className:"max-w-[85%] rounded-2xl rounded-br-sm bg-ouro-scale/15 px-3 py-2 ring-1 ring-ouro-scale/20",children:[f.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[f.jsx("p",{className:"font-mono text-[9px] uppercase tracking-wider text-ouro-glow",children:"★ surfaced outward"}),f.jsxs("span",{className:"font-mono text-[9px] text-ouro-shadow/40",children:["#",w.sequence]}),f.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:el(w)})]}),f.jsx("p",{className:"text-sm leading-relaxed text-ouro-bone whitespace-pre-wrap break-words",children:R.deliveredText}),R.metadata&&f.jsxs("p",{className:"mt-1 font-mono text-[9px] text-ouro-shadow",children:["→ ",R.metadata]})]})},R.id)),D.length>0&&f.jsxs("div",{className:"py-1 text-center font-mono text-[10px] text-ouro-gold/50",children:["— still thinking — #",w.sequence," · ",el(w)]}),z.length>0&&f.jsxs("div",{className:"py-1 text-center font-mono text-[10px] text-ouro-shadow/40",children:["— resting — #",w.sequence," · ",el(w)]}),C.length===0&&z.length===0&&D.length===0&&j&&f.jsx("div",{className:"flex justify-end py-1",children:f.jsxs("div",{className:"max-w-[85%] rounded-2xl rounded-br-sm bg-ouro-glow/6 px-3 py-2 ring-1 ring-ouro-glow/8",children:[f.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[f.jsx("p",{className:"font-mono text-[9px] uppercase tracking-wider text-ouro-glow/50",children:"thinking"}),f.jsxs("span",{className:"font-mono text-[9px] text-ouro-shadow/40",children:["#",w.sequence]}),f.jsx("span",{className:"font-mono text-[9px] text-ouro-shadow/60",children:el(w)})]}),f.jsx("p",{className:"text-sm leading-relaxed text-ouro-mist whitespace-pre-wrap break-words",children:j})]})})]},w.id)}return null})]})]})}function Bf({h:n}){const a=n.isOverdue,s=n.isDegraded,r=n.status;return f.jsxs("div",{className:`rounded-lg px-3 py-2.5 ring-1 ${a?"bg-ouro-fang/5 ring-ouro-fang/15":s?"bg-ouro-gold/5 ring-ouro-gold/15":r==="paused"?"bg-ouro-void/30 ring-ouro-moss/10":"bg-ouro-void/40 ring-ouro-moss/15"}`,children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(xe,{color:a?"red":s?"yellow":r==="active"?"lime":"zinc",children:a?"overdue":s?"degraded":r}),f.jsx("span",{className:"font-medium text-ouro-bone",children:n.title})]}),f.jsxs("div",{className:"mt-1 flex flex-wrap gap-3 text-xs text-ouro-shadow",children:[n.cadence&&f.jsxs("span",{children:["every ",n.cadence]}),f.jsx("span",{children:n.lastRun?`last ${et(n.lastRun)}`:"never run"}),s&&n.degradedReason&&f.jsx("span",{className:"text-ouro-gold",children:n.degradedReason}),!a&&!s&&r==="active"&&n.lastRun&&f.jsx("span",{className:"text-ouro-glow",children:"on schedule"}),a&&n.overdueMs&&f.jsxs("span",{className:"text-ouro-fang",children:[Math.floor(n.overdueMs/6e4),"m overdue"]}),!n.lastRun&&r==="active"&&f.jsx("span",{className:"text-ouro-gold",children:"never fired — may be misconfigured"})]}),n.bodyExcerpt&&f.jsx("p",{className:"mt-1 text-xs text-ouro-shadow/70",children:n.bodyExcerpt})]})}function NC({agentName:n,refreshGeneration:a}){const[s,r]=T.useState(null),[o,d]=T.useState(null),[h,p]=T.useState("diary");if(T.useEffect(()=>{_e(`/agents/${encodeURIComponent(n)}/notes`).then(r),_e(`/agents/${encodeURIComponent(n)}/note-decisions`).then(d).catch(()=>{})},[n,a]),!s)return f.jsxs("div",{className:"flex items-center gap-2 py-6",children:[f.jsx("div",{className:"h-2 w-2 animate-pulse rounded-full bg-ouro-glow"}),f.jsx("span",{className:"font-mono text-xs text-ouro-shadow",children:"Loading…"})]});const m=s.recentDiaryEntries,g=s.recentJournalEntries;return f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsxs("button",{onClick:()=>p("diary"),className:`font-mono text-xs uppercase tracking-wider transition-colors ${h==="diary"?"text-ouro-glow":"text-ouro-shadow hover:text-ouro-mist"}`,children:["Diary (",s.diaryEntryCount,")"]}),f.jsx("span",{className:"text-ouro-shadow/30",children:"|"}),f.jsxs("button",{onClick:()=>p("journal"),className:`font-mono text-xs uppercase tracking-wider transition-colors ${h==="journal"?"text-ouro-glow":"text-ouro-shadow hover:text-ouro-mist"}`,children:["Journal (",s.journalEntryCount,")"]}),f.jsx("span",{className:"text-ouro-shadow/30",children:"|"}),f.jsxs("button",{onClick:()=>p("decisions"),className:`font-mono text-xs uppercase tracking-wider transition-colors ${h==="decisions"?"text-ouro-glow":"text-ouro-shadow hover:text-ouro-mist"}`,children:["Decisions (",(o==null?void 0:o.totalCount)??0,")"]})]}),h==="diary"&&f.jsx("div",{children:m.length>0?f.jsx("div",{className:"space-y-3",children:m.map(x=>f.jsxs("article",{className:"rounded-xl bg-ouro-void/40 px-4 py-3.5 ring-1 ring-ouro-moss/15",children:[f.jsx("p",{className:"text-sm leading-relaxed text-ouro-bone",children:x.text}),f.jsxs("div",{className:"mt-2 flex items-center gap-2 text-xs text-ouro-shadow",children:[f.jsx(xe,{children:x.source}),f.jsx("span",{children:et(x.createdAt)})]})]},x.id))}):f.jsx("p",{className:"text-sm text-ouro-shadow italic",children:"No diary entries yet. The agent hasn't written anything down."})}),h==="journal"&&f.jsx("div",{children:g.length>0?f.jsx("div",{className:"space-y-3",children:g.map(x=>f.jsxs("article",{className:"rounded-xl bg-ouro-void/40 px-4 py-3.5 ring-1 ring-ouro-moss/15",children:[f.jsx("p",{className:"font-medium text-ouro-bone",children:x.filename}),f.jsx("p",{className:"mt-1 text-sm leading-relaxed text-ouro-mist",children:x.preview})]},x.filename))}):f.jsx("p",{className:"text-sm text-ouro-shadow italic",children:"No journal entries yet."})}),h==="decisions"&&f.jsx("div",{children:o&&o.items.length>0?f.jsx("div",{className:"space-y-2",children:o.items.map((x,y)=>f.jsxs("div",{className:"rounded-xl bg-ouro-void/40 px-4 py-3 ring-1 ring-ouro-moss/15",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(xe,{color:x.decision==="saved"?"lime":"zinc",children:x.decision}),f.jsx(xe,{children:x.kind.replace(/_/g," ")}),f.jsx("span",{className:"text-xs text-ouro-shadow",children:et(x.timestamp)})]}),x.reason&&f.jsx("p",{className:"mt-1 text-sm text-ouro-mist",children:x.reason}),x.excerpt&&f.jsx("p",{className:"mt-0.5 text-xs text-ouro-shadow italic truncate",children:x.excerpt})]},y))}):f.jsx("p",{className:"text-sm text-ouro-shadow italic",children:"No note decisions logged yet."})})]})}function AC({agentName:n,view:a,refreshGeneration:s}){var j;const[r,o]=T.useState(null),[d,h]=T.useState(null),p=a.agent,m=p.degraded,g=p.freshness,x=((j=p.providers)==null?void 0:j.lanes)??[];T.useEffect(()=>{Promise.all([_e("/machine/health").then(o).catch(()=>null),_e("/machine/logs").then(h).catch(()=>null)])},[n,s]);const y=LC(r)?r:null,S=(y==null?void 0:y.degradedComponents)??[],w=(d==null?void 0:d.entries)??[];return f.jsxs("div",{className:"space-y-8",children:[m.status==="degraded"&&m.issues.length>0&&f.jsxs("section",{children:[f.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-fang",children:["Agent issues (",m.issues.length,")"]}),f.jsx("div",{className:"mt-3 space-y-1.5",children:m.issues.map((E,C)=>f.jsxs("div",{className:"rounded-lg bg-ouro-fang/5 px-3 py-2.5 ring-1 ring-ouro-fang/15",children:[f.jsx("p",{className:"font-mono text-xs font-semibold text-ouro-fang",children:E.code}),f.jsx("p",{className:"mt-0.5 text-xs text-ouro-mist break-all",children:E.detail})]},C))})]}),f.jsxs("section",{children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:"Agent config"}),f.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2 sm:grid-cols-3",children:[f.jsx(Hi,{label:"Provider lanes",value:CC(x)}),f.jsx(Hi,{label:"Enabled",value:p.enabled?"yes":"no"}),f.jsx(Hi,{label:"Freshness",value:`${g.status}${g.ageMs!=null?` (${Math.floor(g.ageMs/6e4)}m)`:""}`})]})]}),f.jsxs("section",{children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:"Provider lanes"}),x.length>0?f.jsx("div",{className:"mt-3 grid gap-2 lg:grid-cols-2",children:x.map(E=>{const C=RC(E);return f.jsxs("div",{className:"rounded-lg bg-ouro-void/40 px-3 py-3 ring-1 ring-ouro-moss/15",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx("p",{className:"font-mono text-xs font-semibold uppercase tracking-wider text-ouro-bone",children:E.lane}),f.jsx(xe,{color:zC(E),children:E.status}),f.jsx(xe,{color:kC(E.readiness.status),children:E.readiness.status})]}),f.jsx("p",{className:"mt-2 text-sm font-medium text-ouro-bone",children:MC(E)}),f.jsxs("div",{className:"mt-2 space-y-1 text-xs text-ouro-mist",children:[f.jsxs("p",{children:["source: ",E.source]}),f.jsxs("p",{children:["readiness: ",DC(E.readiness)]}),E.readiness.attempts!==void 0&&f.jsxs("p",{children:["attempts: ",E.readiness.attempts]}),E.readiness.checkedAt&&f.jsxs("p",{children:["checked: ",et(E.readiness.checkedAt)]}),f.jsxs("p",{children:["credentials: ",OC(E.credential)]}),E.credential.revision&&f.jsxs("p",{children:["revision: ",E.credential.revision]}),ax(E)&&f.jsxs("p",{children:["reason: ",ax(E)]}),C&&f.jsxs("p",{className:"break-all text-ouro-fang",children:["repair: ",C]}),E.warnings.map((z,D)=>f.jsxs("p",{className:"break-words text-ouro-gold",children:["warning: ",z]},D))]})]},E.lane)})}):f.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No provider lane data loaded."})]}),f.jsxs("section",{children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:"Daemon health"}),y?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2 sm:grid-cols-3",children:[f.jsx(Hi,{label:"Status",value:y.status}),f.jsx(Hi,{label:"Mode",value:y.mode}),f.jsx(Hi,{label:"Uptime",value:`${Math.floor(y.uptimeSeconds/60)}m`})]}),S.length>0&&f.jsxs("div",{className:"mt-3 space-y-1.5",children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-ouro-fang",children:"Degraded components"}),S.map((E,C)=>f.jsxs("div",{className:"rounded-lg bg-ouro-fang/5 px-3 py-2 ring-1 ring-ouro-fang/15",children:[f.jsx("p",{className:"text-xs font-semibold text-ouro-fang",children:E.component}),f.jsx("p",{className:"text-xs text-ouro-mist",children:E.reason})]},C))]})]}):f.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No health file found. This is normal when not running under the daemon."})]}),f.jsxs("section",{children:[f.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-ouro-glow",children:["Recent logs (",(d==null?void 0:d.totalLines)??0," total)"]}),w.length>0?f.jsx("div",{className:"mt-3 max-h-96 overflow-y-auto rounded-lg bg-ouro-void/40 ring-1 ring-ouro-moss/15",children:[...w].reverse().slice(0,50).map((E,C)=>{const z=E.level;return f.jsxs("div",{className:"border-b border-ouro-moss/10 px-3 py-1.5 last:border-b-0",children:[f.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[f.jsx(xe,{color:z==="error"?"red":z==="warn"?"yellow":"zinc",children:z}),f.jsx("span",{className:"text-ouro-shadow",children:et(E.ts)}),f.jsx("span",{className:"font-mono text-ouro-glow",children:E.event})]}),f.jsx("p",{className:"truncate text-xs text-ouro-mist",children:E.message})]},C)})}):f.jsx("p",{className:"mt-2 text-sm text-ouro-shadow",children:"No log entries."})]})]})}function Hi({label:n,value:a}){return f.jsxs("div",{className:"rounded-lg bg-ouro-void/40 px-3 py-2.5 ring-1 ring-ouro-moss/15",children:[f.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-ouro-shadow",children:n}),f.jsx("p",{className:"mt-1 text-sm font-medium text-ouro-bone",children:a})]})}function CC(n){return n.length===0?"none":`${n.filter(s=>s.status==="configured").length}/${n.length} configured`}function MC(n){return n.status==="unconfigured"?"unconfigured":`${n.provider} / ${n.model}`}function DC(n){return n.status==="failed"?n.error?`failed: ${n.error}`:"failed":n.status==="stale"?n.reason?`stale: ${n.reason}`:"stale":n.status==="unknown"?n.reason?`unknown: ${n.reason}`:"unknown":n.status}function OC(n){return n.status==="present"?n.source??"vault":n.status==="invalid-pool"?"vault unavailable":"missing"}function RC(n){return n.status==="unconfigured"?n.repairCommand:n.credential.repairCommand}function ax(n){return n.status==="unconfigured"?n.reason:n.readiness.reason}function zC(n){return n.status==="configured"?"green":"yellow"}function kC(n){return n==="ready"?"green":n==="failed"?"red":n==="stale"?"amber":"zinc"}function LC(n){return!!(n&&"degradedComponents"in n)}const Hf=[{id:"overview",label:"Overview"},{id:"mail",label:"Mailbox"},{id:"sessions",label:"Sessions"},{id:"work",label:"Work"},{id:"connections",label:"Connections"},{id:"inner",label:"Inner"},{id:"notes",label:"Diary & Journal"},{id:"runtime",label:"Runtime"}];function VC(n){return n==="degraded"||n==="blocked"?"red":n==="stale"?"yellow":n==="active"?"lime":"zinc"}function _C({agentName:n,view:a,deskPrefs:s,refreshGeneration:r,initialRoute:o}){const[d,h]=T.useState((o==null?void 0:o.tab)??"overview"),[p,m]=T.useState(o==null?void 0:o.focus),g=T.useRef(!1),x=T.useRef(n);T.useEffect(()=>{const C=x.current!==n;if(x.current=n,(o==null?void 0:o.agent)===n&&!g.current){g.current=!0,h(o.tab),m(o.focus);return}C&&(h("overview"),m(void 0))},[n,o==null?void 0:o.agent,o==null?void 0:o.focus,o==null?void 0:o.tab]);const y=T.useCallback(C=>{h(C.tab),m(C.focus),window.history.pushState(null,"",$f({agent:n,tab:C.tab,focus:C.focus}))},[n]),S=T.useCallback(C=>{h(C),m(void 0),window.history.pushState(null,"",$f({agent:n,tab:C,focus:void 0}))},[n]),w=T.useCallback(()=>m(void 0),[]);if(z3(y),!a||!n)return f.jsxs("div",{className:"flex flex-col items-center justify-center py-24 text-center",children:[f.jsx("p",{className:"font-display text-2xl italic text-ouro-bone",children:"Choose an agent"}),f.jsx("p",{className:"mt-2 text-sm text-ouro-mist",children:"Select an agent from the sidebar to inspect its state."})]});const E=a.agent.attention;return f.jsx(rx.Provider,{value:y,children:f.jsxs("div",{children:[f.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3 pb-4 border-b border-ouro-moss/30",children:[f.jsx("div",{className:"min-w-0",children:f.jsx("h1",{className:"font-display text-2xl italic font-semibold text-ouro-bone sm:text-3xl",children:n})}),f.jsx(xe,{color:VC(E.level),children:E.label})]}),f.jsx("nav",{className:"mt-4 flex gap-0.5 overflow-x-auto border-b border-ouro-moss/20 -mx-1",children:(()=>{const C=s==null?void 0:s.tabOrder;if(!C)return Hf;const z=C.map(R=>Hf.find(k=>k.id===R)).filter(R=>R!==void 0),D=Hf.filter(R=>!C.includes(R.id));return[...z,...D]})().map(C=>f.jsx("button",{type:"button",onClick:()=>S(C.id),className:`shrink-0 px-3 py-2 text-xs font-mono uppercase tracking-wider transition-colors rounded-t-md ${d===C.id?"bg-ouro-moss/20 text-ouro-glow border-b-2 border-ouro-glow":"text-ouro-shadow hover:text-ouro-mist hover:bg-ouro-moss/10"}`,children:C.label},C.id))}),f.jsxs("div",{className:"mt-6",children:[d==="overview"&&f.jsx(H3,{view:a,deskPrefs:s,refreshGeneration:r}),d==="mail"&&f.jsx(P3,{agentName:n,focus:p,onFocusConsumed:w,refreshGeneration:r}),d==="sessions"&&f.jsx(mC,{agentName:n,focus:p,onFocusConsumed:w,deskPrefs:s,refreshGeneration:r}),d==="work"&&f.jsx(bC,{agentName:n,view:a,focus:p,onFocusConsumed:w,refreshGeneration:r}),d==="connections"&&f.jsx(wC,{agentName:n,focus:p,onFocusConsumed:w,refreshGeneration:r}),d==="inner"&&f.jsx(jC,{agentName:n,view:a,refreshGeneration:r}),d==="notes"&&f.jsx(NC,{agentName:n,refreshGeneration:r}),d==="runtime"&&f.jsx(AC,{agentName:n,view:a,refreshGeneration:r})]})]})})}function ix(){return ox(window.location.hash)}function UC(n){return n==="degraded"||n==="blocked"?"red":n==="stale"?"yellow":n==="active"?"lime":"zinc"}function BC(){var C,z;const[n,a]=T.useState(null),[s,r]=T.useState(((C=ix())==null?void 0:C.agent)??""),[o,d]=T.useState(null),[h,p]=T.useState(0),m=T.useRef(0),g=T.useRef(ix()),x=T.useCallback(async()=>{var D;try{const R=await _e("/machine");if(a(R),!s&&R.agents.length>0){const k=((D=g.current)==null?void 0:D.agent)??R.agents[0].agentName;r(k)}}catch{}},[s]),[y,S]=T.useState(null),w=T.useCallback(async D=>{if(!D){d(null),S(null);return}try{const[R,k]=await Promise.all([_e(`/agents/${encodeURIComponent(D)}`),_e(`/agents/${encodeURIComponent(D)}/desk-prefs`)]);d(R),S(k)}catch{d(null),S(null)}},[]);T.useEffect(()=>{x()},[x]),T.useEffect(()=>{s&&w(s)},[s,w]),T.useEffect(()=>M2(()=>{const R=++m.current;x().then(async()=>{m.current===R&&(s&&(await w(s),m.current!==R)||p(k=>k+1))})}),[x,w,s]),T.useEffect(()=>{const D=()=>{const R=ox(window.location.hash);R&&r(R.agent)};return window.addEventListener("hashchange",D),()=>window.removeEventListener("hashchange",D)},[]);const j=T.useCallback(D=>{r(D),window.history.pushState(null,"",$f({agent:D,tab:"overview",focus:void 0}))},[]);if(!n)return f.jsx("div",{className:"flex h-screen items-center justify-center bg-ouro-void",children:f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"mx-auto mb-4 h-4 w-4 animate-pulse rounded-full bg-ouro-glow shadow-[0_0_20px_theme(--color-ouro-glow)]"}),f.jsx("p",{className:"font-mono text-sm text-ouro-mist",children:"Connecting to Mailbox…"})]})});const E=n.overview.totals;return f.jsx(E3,{navbar:f.jsxs(y3,{children:[f.jsx(S3,{}),f.jsx(b3,{children:f.jsx(rh,{children:f.jsx(xe,{color:n.overview.daemon.mode==="dev"?"yellow":"lime",children:n.overview.daemon.mode})})})]}),sidebar:f.jsxs(N3,{className:"bg-ouro-deep",children:[f.jsx(A3,{className:"border-ouro-moss/30",children:f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx("div",{className:"h-3 w-3 shrink-0 rounded-full bg-ouro-glow shadow-[0_0_16px_theme(--color-ouro-glow)]"}),f.jsx("div",{className:"min-w-0",children:f.jsx("p",{className:"truncate font-display text-lg italic font-semibold text-ouro-bone",children:"Ouro Mailbox"})})]})}),f.jsxs(C3,{className:"[&>[data-slot=section]+[data-slot=section]]:mt-4",children:[f.jsxs(W0,{children:[f.jsx(I0,{className:"text-ouro-mist/60",children:"Machine"}),f.jsx("div",{className:"grid grid-cols-3 gap-1.5 px-2",children:[{v:E.liveTasks??0,l:"Tasks",alert:(E.blockedTasks??0)>0},{v:E.openObligations??0,l:"Oblig."},{v:E.activeCodingAgents??0,l:"Coding"}].map(D=>f.jsxs("div",{className:"rounded-md bg-ouro-void/60 px-2 py-1.5 text-center ring-1 ring-ouro-moss/20",children:[f.jsx("div",{className:`text-base font-semibold tabular-nums ${D.alert?"text-ouro-fang":"text-ouro-bone"}`,children:D.v}),f.jsx("div",{className:"text-[9px] uppercase tracking-widest text-ouro-shadow",children:D.l})]},D.l))})]}),f.jsxs(W0,{children:[f.jsx(I0,{className:"text-ouro-mist/60",children:"Agents"}),n.agents.map(D=>f.jsx(D3,{current:D.agentName===s,onClick:()=>j(D.agentName),children:f.jsxs("div",{className:"flex min-w-0 flex-1 items-center justify-between gap-2",children:[f.jsxs("div",{className:"min-w-0",children:[f.jsx(O3,{className:"text-ouro-bone",children:D.agentName}),f.jsxs("p",{className:"truncate text-xs text-ouro-shadow",children:[D.tasks.liveCount,"t · ",D.obligations.openCount,"o · ",D.coding.activeCount,"c"]})]}),f.jsx(xe,{color:UC(D.attention.level),children:D.attention.label})]})},D.agentName))]})]}),f.jsx(M3,{className:"border-ouro-moss/30",children:f.jsxs("div",{className:"px-2 text-xs text-ouro-shadow",children:[f.jsx("p",{className:"font-mono",children:n.overview.runtime.version}),f.jsxs("p",{className:"mt-0.5",children:[n.overview.daemon.mode," · ",n.overview.freshness.status]})]})}),s&&o&&f.jsx("div",{className:"px-4 py-2 border-t border-ouro-moss/20",children:f.jsx("p",{className:"text-xs italic text-ouro-shadow/70",children:(()=>{const D=y==null?void 0:y.statusLine;if(D)return D;const R=o.inner;if(R.status==="running"||R.hasPending)return"thinking through something privately";const U=o.work.obligations.openCount;return U>2?"a few loose ends":U>0?"carrying something":"steady"})()})})]}),children:f.jsx(_C,{agentName:s,view:o,deskPrefs:y,refreshGeneration:h,initialRoute:((z=g.current)==null?void 0:z.agent)===s?g.current:void 0})})}C2.createRoot(document.getElementById("app")).render(f.jsx(T.StrictMode,{children:f.jsx(BC,{})}));