Files
oikos/web/dist/assets/index-B5w8gw75.js
dtoro d4d99a7473
Some checks failed
ci / build-test (push) Has been cancelled
ci / docker-build (push) Has been cancelled
feat: Phase 1 — extract the client (web SPA + desktop) to dtoro/oikos-web
Problem: the hexagonal refactor churns the backend tree for nine more
phases; the UI delivery stack (web/ SPA, cmd/desktop Wails wrapper,
compose/web image) must move to its own repo first so doc/layout
rewrites land once on a backend-only tree.

Change:
- New repo git.hubris.network/dtoro/oikos-web (v0.33.0): web/, desktop/
  (updateURL repointed to oikos-web releases), compose/, own CI (web +
  desktop jobs), own deploy script (CI-green gate, TOCTOU guard,
  version-tagged images, prune-to-3), own webhook receiver on :9798 +
  launchd unit, own compose project publishing the same 8091:80.
- Cutover executed on mac-mini in order: oikos stack's web service
  stopped+removed, oikos-web project brought up on 8091; outer Caddy
  untouched (targets the published port) — serving + Authentik flow +
  /wails 404 quirk verified post-cutover.
- Stripped from oikos: web/, cmd/desktop/, compose/web/, desktop CI
  workflow, ci.yml web job, Makefile ui/desktop/desktop-package/install
  targets, the compose web service, oikos-web from deploy.sh's fallback
  prune list; wails + go-keyring dropped from go.mod, vendor synced.
- README / CONTRIBUTING / AGENTS.md / .agents dev+operations docs now
  point at the new repo; mbse + mascot design docs carry a path note.

Risk: production SPA serving depends on the new pipeline now; rollback
is versioned-image re-up of the old web service from a pre-split
checkout (port 8091). Desktop builds installed before the split still
check dtoro/oikos releases — one manual reinstall, noted in the
oikos-web release notes.

Verification: go vet, make test (race), make generate-check, golangci
(no new findings; baseline down 400→365); post-cutover curls —
localhost:8091 200, /wails/runtime.js 404, outer Caddy 302 Authentik.
2026-08-15 22:27:52 +02:00

105 lines
738 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Overview-C_9Ji_NC.js","assets/DataTable-B-TAV_HV.js","assets/clone-bSRBQ4eT.js","assets/StatusBadgeRenderer-BEdJTFrn.js","assets/select-trigger-BFw7c3mx.js","assets/hidden-input-CbX2doyK.js","assets/on-mount-effect.svelte-Lpx0iWhb.js","assets/select-trigger-CV-KWLNP.css","assets/plus-B9zN-7mU.js","assets/KnowledgeBase-BNxdKIZ7.js","assets/KnowledgeBase-lo1lsvmk.css","assets/Ops-DAOK5ZEQ.js","assets/tabs-trigger-iqr7CeDz.js","assets/Signals-C_6d4rqi.js","assets/Knowledge-D0UZIpsu.js","assets/sparkles-DGJxKTzu.js","assets/Learning-C0EP82zq.js","assets/Settings-DIFH4bBX.js","assets/MascotLayer-D4qaTX9J.js","assets/MascotLayer-BBfoHdTX.css"])))=>i.map(i=>d[i]);
var dE=Object.defineProperty;var fE=Object.getPrototypeOf;var hE=Reflect.get;var mw=t=>{throw TypeError(t)};var pE=(t,e,n)=>e in t?dE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var we=(t,e,n)=>pE(t,typeof e!="symbol"?e+"":e,n),y0=(t,e,n)=>e.has(t)||mw("Cannot "+n);var v=(t,e,n)=>(y0(t,e,"read from private field"),n?n.call(t):e.get(t)),Y=(t,e,n)=>e.has(t)?mw("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),ye=(t,e,n,r)=>(y0(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),ze=(t,e,n)=>(y0(t,e,"access private method"),n);var vw=(t,e,n,r)=>({set _(i){ye(t,e,i,n)},get _(){return v(t,e,r)}}),bw=(t,e,n)=>hE(fE(t),n,e);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();const L2=!1;var Nm=Array.isArray,gE=Array.prototype.indexOf,fg=Array.prototype.includes,Im=Array.from,D2=Object.defineProperty,tl=Object.getOwnPropertyDescriptor,F2=Object.getOwnPropertyDescriptors,mE=Object.prototype,vE=Array.prototype,t1=Object.getPrototypeOf,yw=Object.isExtensible;function gd(t){return typeof t=="function"}const an=()=>{};function bE(t){return typeof(t==null?void 0:t.then)=="function"}function yE(t){return t()}function hg(t){for(var e=0;e<t.length;e++)t[e]()}function B2(){var t,e,n=new Promise((r,i)=>{t=r,e=i});return{promise:n,resolve:t,reject:e}}function j2(t,e){if(Array.isArray(t))return t;if(!(Symbol.iterator in t))return Array.from(t);const n=[];for(const r of t)if(n.push(r),n.length===e)break;return n}const li=2,Lu=4,Hh=8,n1=1<<24,Hs=16,Qs=32,ha=64,sv=128,Ss=512,Nr=1024,Zr=2048,Js=4096,Pi=8192,ts=16384,Ju=32768,ov=1<<25,pa=65536,pg=1<<17,wE=1<<18,cc=1<<19,U2=1<<20,Mo=1<<25,ec=65536,gg=1<<21,Jc=1<<22,nl=1<<23,Ao=Symbol("$state"),W2=Symbol("legacy props"),xE=Symbol(""),Vp=Symbol("attributes"),av=Symbol("class"),lv=Symbol("style"),zd=Symbol("text"),$p=Symbol("form reset"),zm=new class extends Error{constructor(){super(...arguments);we(this,"name","StaleReactionError");we(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};var O2;const Lm=!!((O2=globalThis.document)!=null&&O2.contentType)&&globalThis.document.contentType.includes("xml");function Vh(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function _E(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function SE(t,e,n){throw new Error("https://svelte.dev/e/each_key_duplicate")}function kE(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function ME(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function TE(t){throw new Error("https://svelte.dev/e/effect_orphan")}function EE(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function AE(t){throw new Error("https://svelte.dev/e/lifecycle_legacy_only")}function PE(t){throw new Error("https://svelte.dev/e/props_invalid_value")}function CE(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function OE(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function RE(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function NE(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const IE=1,zE=2,q2=4,LE=8,DE=16,FE=1,BE=2,jE=4,UE=8,WE=16,qE=1,HE=2,Tr=Symbol("uninitialized"),H2="http://www.w3.org/1999/xhtml",V2="http://www.w3.org/2000/svg",VE="http://www.w3.org/1998/Math/MathML",$2="@attach";function $E(){console.warn("https://svelte.dev/e/derived_inert")}function GE(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function YE(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function G2(t){return t===this.v}function r1(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function Y2(t){return!r1(t,this.v)}let ed=!1,KE=!1;function XE(){ed=!0}let En=null;function Du(t){En=t}function Fu(t){return Fm().get(t)}function Dm(t,e){return Fm().set(t,e),e}function i1(t){return Fm().has(t)}function ZE(){return Fm()}function Tt(t,e=!1,n){En={p:En,i:!1,c:null,e:null,s:t,x:null,r:bn,l:ed&&!e?{s:null,u:null,$:[]}:null}}function Et(t){var e=En,n=e.e;if(n!==null){e.e=null;for(var r of n)yS(r)}return e.i=!0,En=e.p,{}}function uc(){return!ed||En!==null&&En.l===null}function Fm(t){return En===null&&Vh(),En.c??(En.c=new Map(QE(En)||void 0))}function QE(t){let e=t.p;for(;e!==null;){const n=e.c;if(n!==null)return n;e=e.p}return null}let Rl=[];function K2(){var t=Rl;Rl=[],hg(t)}function Po(t){if(Rl.length===0&&!eu){var e=Rl;queueMicrotask(()=>{e===Rl&&K2()})}Rl.push(t)}function JE(){for(;Rl.length>0;)K2()}function X2(t){var e=bn;if(e===null)return kn.f|=nl,t;if((e.f&Ju)===0&&(e.f&Lu)===0)throw t;Za(t,e)}function Za(t,e){if(!(e!==null&&(e.f&ts)!==0)){for(;e!==null;){if((e.f&sv)!==0){if((e.f&Ju)===0)throw t;try{e.b.error(t);return}catch(n){t=n}}e=e.parent}throw t}}const eA=-7169;function xr(t,e){t.f=t.f&eA|e}function s1(t){(t.f&Ss)!==0||t.deps===null?xr(t,Nr):xr(t,Js)}function Z2(t){if(t!==null)for(const e of t)(e.f&li)===0||(e.f&ec)===0||(e.f^=ec,Z2(e.deps))}function Q2(t,e,n){(t.f&Zr)!==0?e.add(t):(t.f&Js)!==0&&n.add(t),Z2(t.deps),xr(t,Nr)}function o1(t,e,n){if(t==null)return e(void 0),n&&n(void 0),an;const r=br(()=>t.subscribe(e,n));return r.unsubscribe?()=>r.unsubscribe():r}const Ac=[];function J2(t,e){return{subscribe:dr(t,e).subscribe}}function dr(t,e=an){let n=null;const r=new Set;function i(a){if(r1(t,a)&&(t=a,n)){const l=!Ac.length;for(const c of r)c[1](),Ac.push(c,t);if(l){for(let c=0;c<Ac.length;c+=2)Ac[c][0](Ac[c+1]);Ac.length=0}}}function s(a){i(a(t))}function o(a,l=an){const c=[a,l];return r.add(c),r.size===1&&(n=e(i,s)||an),a(t),()=>{r.delete(c),r.size===0&&n&&(n(),n=null)}}return{set:i,update:s,subscribe:o}}function Es(t,e,n){const r=!Array.isArray(t),i=r?[t]:t;if(!i.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const s=e.length<2;return J2(n,(o,a)=>{let l=!1;const c=[];let u=0,f=an;const h=()=>{if(u)return;f();const g=e(r?c[0]:c,o,a);s?o(g):f=typeof g=="function"?g:an},p=i.map((g,m)=>o1(g,b=>{c[m]=b,u&=~(1<<m),l&&h()},()=>{u|=1<<m}));return l=!0,h(),function(){hg(p),f(),l=!1}})}function ki(t){let e;return o1(t,n=>e=n)(),e}let cv=!1,gp=!1,uv=Symbol("unmounted");function zn(t,e,n){const r=n[e]??(n[e]={store:null,source:es(void 0),unsubscribe:an});if(r.store!==t&&!(uv in n))if(r.unsubscribe(),r.store=t??null,t==null)r.source.v=void 0,r.unsubscribe=an;else{var i=!0;r.unsubscribe=o1(t,s=>{i?r.source.v=s:I(r.source,s)}),i=!1}return t&&uv in n?ki(t):d(r.source)}function Pc(t,e){return tA(t,e),e}function ro(){const t={};function e(){Gh(()=>{for(var n in t)t[n].unsubscribe();D2(t,uv,{enumerable:!1,value:!0})})}return[t,e]}function tA(t,e){cv=!0;try{t.set(e)}finally{cv=!1}}function nA(t){var e=gp;try{return gp=!1,[t(),gp]}finally{gp=e}}function Bm(t){let e=0,n=Io(0),r;return()=>{f1()&&(d(n),dc(()=>(e===0&&(r=br(()=>t(()=>So(n)))),e+=1,()=>{Po(()=>{e-=1,e===0&&(r==null||r(),r=void 0,So(n))})})))}}var rA=pa|cc;function iA(t,e,n,r){new sA(t,e,n,r)}var gs,e1,ms,Ll,Ni,vs,_i,Yi,Ho,Dl,Fa,ou,xf,_f,Vo,nm,Sr,oA,aA,lA,dv,Gp,Yp,fv,hv;class sA{constructor(e,n,r,i){Y(this,Sr);we(this,"parent");we(this,"is_pending",!1);we(this,"transform_error");Y(this,gs);Y(this,e1,null);Y(this,ms);Y(this,Ll);Y(this,Ni);Y(this,vs,null);Y(this,_i,null);Y(this,Yi,null);Y(this,Ho,null);Y(this,Dl,0);Y(this,Fa,0);Y(this,ou,!1);Y(this,xf,new Set);Y(this,_f,new Set);Y(this,Vo,null);Y(this,nm,Bm(()=>(ye(this,Vo,Io(v(this,Dl))),()=>{ye(this,Vo,null)})));var s;ye(this,gs,e),ye(this,ms,n),ye(this,Ll,o=>{var a=bn;a.b=this,a.f|=sv,r(o)}),this.parent=bn.b,this.transform_error=i??((s=this.parent)==null?void 0:s.transform_error)??(o=>o),ye(this,Ni,fl(()=>{ze(this,Sr,dv).call(this)},rA))}defer_effect(e){Q2(e,v(this,xf),v(this,_f))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!v(this,ms).pending}update_pending_count(e,n){ze(this,Sr,fv).call(this,e,n),ye(this,Dl,v(this,Dl)+e),!(!v(this,Vo)||v(this,ou))&&(ye(this,ou,!0),Po(()=>{ye(this,ou,!1),v(this,Vo)&&ca(v(this,Vo),v(this,Dl))}))}get_effect_pending(){return v(this,nm).call(this),d(v(this,Vo))}error(e){if(!v(this,ms).onerror&&!v(this,ms).failed)throw e;$t!=null&&$t.is_fork?(v(this,vs)&&$t.skip_effect(v(this,vs)),v(this,_i)&&$t.skip_effect(v(this,_i)),v(this,Yi)&&$t.skip_effect(v(this,Yi)),$t.oncommit(()=>{ze(this,Sr,hv).call(this,e)})):ze(this,Sr,hv).call(this,e)}}gs=new WeakMap,e1=new WeakMap,ms=new WeakMap,Ll=new WeakMap,Ni=new WeakMap,vs=new WeakMap,_i=new WeakMap,Yi=new WeakMap,Ho=new WeakMap,Dl=new WeakMap,Fa=new WeakMap,ou=new WeakMap,xf=new WeakMap,_f=new WeakMap,Vo=new WeakMap,nm=new WeakMap,Sr=new WeakSet,oA=function(){try{ye(this,vs,ji(()=>v(this,Ll).call(this,v(this,gs))))}catch(e){this.error(e)}},aA=function(e){const n=v(this,ms).failed;n&&ye(this,Yi,ji(()=>{n(v(this,gs),()=>e,()=>()=>{})}))},lA=function(){const e=v(this,ms).pending;e&&(this.is_pending=!0,ye(this,_i,ji(()=>e(v(this,gs)))),Po(()=>{var n=ye(this,Ho,document.createDocumentFragment()),r=Co();n.append(r),ye(this,vs,ze(this,Sr,Yp).call(this,()=>ji(()=>v(this,Ll).call(this,r)))),v(this,Fa)===0&&(v(this,gs).before(n),ye(this,Ho,null),Ql(v(this,_i),()=>{ye(this,_i,null)}),ze(this,Sr,Gp).call(this,$t))}))},dv=function(){try{if(this.is_pending=this.has_pending_snippet(),ye(this,Fa,0),ye(this,Dl,0),ye(this,vs,ji(()=>{v(this,Ll).call(this,v(this,gs))})),v(this,Fa)>0){var e=ye(this,Ho,document.createDocumentFragment());g1(v(this,vs),e);const n=v(this,ms).pending;ye(this,_i,ji(()=>n(v(this,gs))))}else ze(this,Sr,Gp).call(this,$t)}catch(n){this.error(n)}},Gp=function(e){this.is_pending=!1,e.transfer_effects(v(this,xf),v(this,_f))},Yp=function(e){var n=bn,r=kn,i=En;Ms(v(this,Ni)),ks(v(this,Ni)),Du(v(this,Ni).ctx);try{return ga.ensure(),e()}catch(s){return X2(s),null}finally{Ms(n),ks(r),Du(i)}},fv=function(e,n){var r;if(!this.has_pending_snippet()){this.parent&&ze(r=this.parent,Sr,fv).call(r,e,n);return}ye(this,Fa,v(this,Fa)+e),v(this,Fa)===0&&(ze(this,Sr,Gp).call(this,n),v(this,_i)&&Ql(v(this,_i),()=>{ye(this,_i,null)}),v(this,Ho)&&(v(this,gs).before(v(this,Ho)),ye(this,Ho,null)))},hv=function(e){v(this,vs)&&(Qr(v(this,vs)),ye(this,vs,null)),v(this,_i)&&(Qr(v(this,_i)),ye(this,_i,null)),v(this,Yi)&&(Qr(v(this,Yi)),ye(this,Yi,null));var n=v(this,ms).onerror;let r=v(this,ms).failed;var i=!1,s=!1;const o=()=>{if(i){YE();return}i=!0,s&&NE(),v(this,Yi)!==null&&Ql(v(this,Yi),()=>{ye(this,Yi,null)}),ze(this,Sr,Yp).call(this,()=>{ze(this,Sr,dv).call(this)})},a=l=>{try{s=!0,n==null||n(l,o),s=!1}catch(c){Za(c,v(this,Ni)&&v(this,Ni).parent)}r&&ye(this,Yi,ze(this,Sr,Yp).call(this,()=>{try{return ji(()=>{var c=bn;c.b=this,c.f|=sv,r(v(this,gs),()=>l,()=>o)})}catch(c){return Za(c,v(this,Ni).parent),null}}))};Po(()=>{var l;try{l=this.transform_error(e)}catch(c){Za(c,v(this,Ni)&&v(this,Ni).parent);return}l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(a,c=>Za(c,v(this,Ni)&&v(this,Ni).parent)):a(l)})};function eS(t,e,n,r){const i=uc()?Bu:a1;var s=t.filter(p=>!p.settled),o=e.map(i);if(n.length===0&&s.length===0){r(o);return}var a=bn,l=tS(),c=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(p=>p.promise)):null;function u(p){if((a.f&ts)===0){l();try{r([...o,...p])}catch(g){Za(g,a)}lf()}}var f=nS();if(n.length===0){c.then(()=>u([])).finally(f);return}function h(){Promise.all(n.map(p=>cA(p))).then(u).catch(p=>Za(p,a)).finally(f)}c?c.then(()=>{l(),h(),lf()}):h()}function tS(){var t=bn,e=kn,n=En,r=$t;return function(s=!0){Ms(t),ks(e),Du(n),s&&(t.f&ts)===0&&(r==null||r.activate(),r==null||r.apply())}}function lf(t=!0){Ms(null),ks(null),Du(null),t&&($t==null||$t.deactivate())}function nS(){var t=bn,e=t.b,n=$t,r=!!(e!=null&&e.is_rendered());return e==null||e.update_pending_count(1,n),n.increment(r,t),()=>{e==null||e.update_pending_count(-1,n),n.decrement(r,t)}}function Bu(t){var e=li|Zr;return bn!==null&&(bn.f|=cc),{ctx:En,deps:null,effects:null,equals:G2,f:e,fn:t,reactions:null,rv:0,v:Tr,wv:0,parent:bn,ac:null}}const Ld=Symbol("obsolete");function cA(t,e,n){let r=bn;r===null&&_E();var i=void 0,s=Io(Tr),o=!kn,a=new Set;return kA(()=>{var p,g;var l=bn,c=B2();i=c.promise;try{Promise.resolve(t()).then(c.resolve,m=>{m!==zm&&c.reject(m)}).finally(lf)}catch(m){c.reject(m),lf()}var u=$t;if(o){if((l.f&Ju)!==0)var f=nS();if((p=r.b)!=null&&p.is_rendered())(g=u.async_deriveds.get(l))==null||g.reject(Ld);else for(const m of a.values())m.reject(Ld);a.add(c),u.async_deriveds.set(l,c)}const h=(m,b=void 0)=>{f==null||f(),a.delete(c),b!==Ld&&(u.activate(),b?(s.f|=nl,ca(s,b)):((s.f&nl)!==0&&(s.f^=nl),ca(s,m)),u.deactivate())};c.promise.then(h,m=>h(null,m||"unknown"))}),Gh(()=>{for(const l of a)l.reject(Ld)}),new Promise(l=>{function c(u){function f(){u===i?l(s):c(i)}u.then(f,f)}c(i)})}function V(t){const e=Bu(t);return AS(e),e}function a1(t){const e=Bu(t);return e.equals=Y2,e}function uA(t){var e=t.effects;if(e!==null){t.effects=null;for(var n=0;n<e.length;n+=1)Qr(e[n])}}function l1(t){var e,n=bn,r=t.parent;if(!ma&&r!==null&&t.v!==Tr&&(r.f&(ts|Pi))!==0)return $E(),t.v;Ms(r);try{t.f&=~ec,uA(t),e=RS(t)}finally{Ms(n)}return e}function rS(t){var e=l1(t);if(!t.equals(e)&&(t.wv=CS(),(!($t!=null&&$t.is_fork)||t.deps===null)&&($t!==null?($t.capture(t,e,!0),Jd==null||Jd.capture(t,e,!0)):t.v=e,t.deps===null))){xr(t,Nr);return}ma||(oi!==null?(f1()||$t!=null&&$t.is_fork)&&oi.set(t,e):s1(t))}function dA(t){var e,n;if(t.effects!==null)for(const r of t.effects)(r.teardown||r.ac)&&((e=r.teardown)==null||e.call(r),(n=r.ac)==null||n.abort(zm),r.fn!==null&&(r.teardown=an),r.ac=null,cf(r,0),p1(r))}function iS(t){if(t.effects!==null)for(const e of t.effects)e.teardown&&e.fn!==null&&tc(e)}let w0=null,Cc=null,$t=null,Jd=null,oi=null,pv=null,eu=!1,x0=!1,Xc=null,Kp=null;var ww=0;let fA=1;var au,Ba,Fl,lu,cu,uu,$o,du,Ii,Sf,Go,Ds,bo,fu,Bl,Zn,gv,Dd,mv,sS,oS,Wc,hA,Fd;const rm=class rm{constructor(){Y(this,Zn);we(this,"id",fA++);Y(this,au,!1);we(this,"linked",!0);Y(this,Ba,null);Y(this,Fl,null);we(this,"async_deriveds",new Map);we(this,"current",new Map);we(this,"previous",new Map);Y(this,lu,new Set);Y(this,cu,new Set);Y(this,uu,0);Y(this,$o,new Map);Y(this,du,null);Y(this,Ii,[]);Y(this,Sf,[]);Y(this,Go,new Set);Y(this,Ds,new Set);Y(this,bo,new Map);Y(this,fu,new Set);we(this,"is_fork",!1);Y(this,Bl,!1);Cc===null?w0=Cc=this:(ye(Cc,Fl,this),ye(this,Ba,Cc)),Cc=this}skip_effect(e){v(this,bo).has(e)||v(this,bo).set(e,{d:[],m:[]}),v(this,fu).delete(e)}unskip_effect(e,n=r=>this.schedule(r)){var r=v(this,bo).get(e);if(r){v(this,bo).delete(e);for(var i of r.d)xr(i,Zr),n(i);for(i of r.m)xr(i,Js),n(i)}v(this,fu).add(e)}capture(e,n,r=!1){e.v!==Tr&&!this.previous.has(e)&&this.previous.set(e,e.v),(e.f&nl)===0&&(this.current.set(e,[n,r]),oi==null||oi.set(e,n)),this.is_fork||(e.v=n)}activate(){$t=this}deactivate(){$t=null,oi=null}flush(){try{x0=!0,$t=this,ze(this,Zn,Dd).call(this)}finally{ww=0,pv=null,Xc=null,Kp=null,x0=!1,$t=null,oi=null,Zl.clear()}}discard(){var e;for(const n of v(this,cu))n(this);v(this,cu).clear();for(const n of this.async_deriveds.values())n.reject(Ld);ze(this,Zn,Fd).call(this),(e=v(this,du))==null||e.resolve()}register_created_effect(e){v(this,Sf).push(e)}increment(e,n){if(ye(this,uu,v(this,uu)+1),e){let r=v(this,$o).get(n)??0;v(this,$o).set(n,r+1)}}decrement(e,n){if(ye(this,uu,v(this,uu)-1),e){let r=v(this,$o).get(n)??0;r===1?v(this,$o).delete(n):v(this,$o).set(n,r-1)}v(this,Bl)||(ye(this,Bl,!0),Po(()=>{ye(this,Bl,!1),this.linked&&this.flush()}))}transfer_effects(e,n){for(const r of e)v(this,Go).add(r);for(const r of n)v(this,Ds).add(r);e.clear(),n.clear()}oncommit(e){v(this,lu).add(e)}ondiscard(e){v(this,cu).add(e)}settled(){return(v(this,du)??ye(this,du,B2())).promise}static ensure(){if($t===null){const e=$t=new rm;!x0&&!eu&&Po(()=>{v(e,au)||e.flush()})}return $t}apply(){{oi=null;return}}schedule(e){var i;if(pv=e,(i=e.b)!=null&&i.is_pending&&(e.f&(Lu|Hh|n1))!==0&&(e.f&Ju)===0){e.b.defer_effect(e);return}for(var n=e;n.parent!==null;){n=n.parent;var r=n.f;if(Xc!==null&&n===bn&&(kn===null||(kn.f&li)===0)&&!cv)return;if((r&(ha|Qs))!==0){if((r&Nr)===0)return;n.f^=Nr}}v(this,Ii).push(n)}};au=new WeakMap,Ba=new WeakMap,Fl=new WeakMap,lu=new WeakMap,cu=new WeakMap,uu=new WeakMap,$o=new WeakMap,du=new WeakMap,Ii=new WeakMap,Sf=new WeakMap,Go=new WeakMap,Ds=new WeakMap,bo=new WeakMap,fu=new WeakMap,Bl=new WeakMap,Zn=new WeakSet,gv=function(){if(this.is_fork)return!0;for(const r of v(this,$o).keys()){for(var e=r,n=!1;e.parent!==null;){if(v(this,bo).has(e)){n=!0;break}e=e.parent}if(!n)return!0}return!1},Dd=function(){var l,c,u,f;ye(this,au,!0),ww++>1e3&&(ze(this,Zn,Fd).call(this),pA());for(const h of v(this,Go))v(this,Ds).delete(h),xr(h,Zr),this.schedule(h);for(const h of v(this,Ds))xr(h,Js),this.schedule(h);const e=v(this,Ii);ye(this,Ii,[]),this.apply();var n=Xc=[],r=[],i=Kp=[];for(const h of e)try{ze(this,Zn,mv).call(this,h,n,r)}catch(p){throw uS(h),ze(this,Zn,gv).call(this)||this.discard(),p}if($t=null,i.length>0){var s=rm.ensure();for(const h of i)s.schedule(h)}if(Xc=null,Kp=null,ze(this,Zn,gv).call(this)){ze(this,Zn,Wc).call(this,r),ze(this,Zn,Wc).call(this,n);for(const[h,p]of v(this,bo))cS(h,p);i.length>0&&ze(l=$t,Zn,Dd).call(l);return}const o=ze(this,Zn,sS).call(this);if(o){ze(this,Zn,Wc).call(this,r),ze(this,Zn,Wc).call(this,n),ze(c=o,Zn,oS).call(c,this);return}v(this,Go).clear(),v(this,Ds).clear();for(const h of v(this,lu))h(this);v(this,lu).clear(),Jd=this,xw(r),xw(n),Jd=null,(u=v(this,du))==null||u.resolve();var a=$t;if(v(this,uu)===0&&(v(this,Ii).length===0||a!==null)&&ze(this,Zn,Fd).call(this),v(this,Ii).length>0)if(a!==null){const h=a;v(h,Ii).push(...v(this,Ii).filter(p=>!v(h,Ii).includes(p)))}else a=this;a!==null&&ze(f=a,Zn,Dd).call(f)},mv=function(e,n,r){e.f^=Nr;for(var i=e.first;i!==null;){var s=i.f,o=(s&(Qs|ha))!==0,a=o&&(s&Nr)!==0,l=a||(s&Pi)!==0||v(this,bo).has(i);if(!l&&i.fn!==null){o?i.f^=Nr:(s&Lu)!==0?n.push(i):td(i)&&((s&Hs)!==0&&v(this,Ds).add(i),tc(i));var c=i.first;if(c!==null){i=c;continue}}for(;i!==null;){var u=i.next;if(u!==null){i=u;break}i=i.parent}}},sS=function(){for(var e=v(this,Ba);e!==null;){if(!e.is_fork){for(const[n,[,r]]of this.current)if(e.current.has(n)&&!r)return e}e=v(e,Ba)}return null},oS=function(e){var r;for(const[i,s]of e.current)!this.previous.has(i)&&e.previous.has(i)&&this.previous.set(i,e.previous.get(i)),this.current.set(i,s);for(const[i,s]of e.async_deriveds){const o=this.async_deriveds.get(i);o&&s.promise.then(o.resolve).catch(o.reject)}e.async_deriveds.clear(),this.transfer_effects(v(e,Go),v(e,Ds));const n=i=>{var s=i.reactions;if(s!==null)for(const l of s){var o=l.f;if((o&li)!==0)n(l);else{var a=l;o&(Jc|Hs)&&!this.async_deriveds.has(a)&&(v(this,Ds).delete(a),xr(a,Zr),this.schedule(a))}}};for(const i of this.current.keys())n(i);this.oncommit(()=>e.discard()),ze(r=e,Zn,Fd).call(r),$t=this,ze(this,Zn,Dd).call(this)},Wc=function(e){for(var n=0;n<e.length;n+=1)Q2(e[n],v(this,Go),v(this,Ds))},hA=function(){var f;for(let h=w0;h!==null;h=v(h,Fl)){var e=h.id<this.id,n=[];for(const[p,[g,m]]of this.current){if(h.current.has(p)){var r=h.current.get(p)[0];if(e&&g!==r)h.current.set(p,[g,m]);else continue}n.push(p)}if(e)for(const[p,g]of this.async_deriveds){const m=h.async_deriveds.get(p);m&&g.promise.then(m.resolve).catch(m.reject)}var i=[...h.current.keys()].filter(p=>!h.current.get(p)[1]);if(!(!v(h,au)||i.length===0)){var s=i.filter(p=>!this.current.has(p));if(s.length===0)e&&h.discard();else if(n.length>0){if(e)for(const p of v(this,fu))h.unskip_effect(p,g=>{var m;(g.f&(Hs|Jc))!==0?h.schedule(g):ze(m=h,Zn,Wc).call(m,[g])});h.activate();var o=new Set,a=new Map;for(var l of n)lS(l,s,o,a);a=new Map;var c=[...h.current].filter(([p,g])=>{const m=this.current.get(p);return m?m[0]!==g[0]||m[1]!==g[1]:!0}).map(([p])=>p);if(c.length>0)for(const p of v(this,Sf))(p.f&(ts|Pi|pg))===0&&c1(p,c,a)&&((p.f&(Jc|Hs))!==0?(xr(p,Zr),h.schedule(p)):v(h,Go).add(p));if(v(h,Ii).length>0&&!v(h,Bl)){h.apply();for(var u of v(h,Ii))ze(f=h,Zn,mv).call(f,u,[],[]);ye(h,Ii,[])}h.deactivate()}}}},Fd=function(){if(this.linked){var e=v(this,Ba),n=v(this,Fl);e===null?w0=n:ye(e,Fl,n),n===null?Cc=e:ye(n,Ba,e),this.linked=!1}};let ga=rm;function aS(t){var e=eu;eu=!0;try{for(var n;;){if(JE(),$t===null)return n;$t.flush()}}finally{eu=e}}function pA(){try{EE()}catch(t){Za(t,pv)}}let Ls=null;function xw(t){var e=t.length;if(e!==0){for(var n=0;n<e;){var r=t[n++];if((r.f&(ts|Pi))===0&&td(r)&&(Ls=new Set,tc(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&MS(r),(Ls==null?void 0:Ls.size)>0)){Zl.clear();for(const i of Ls){if((i.f&(ts|Pi))!==0)continue;const s=[i];let o=i.parent;for(;o!==null;)Ls.has(o)&&(Ls.delete(o),s.push(o)),o=o.parent;for(let a=s.length-1;a>=0;a--){const l=s[a];(l.f&(ts|Pi))===0&&tc(l)}}Ls.clear()}}Ls=null}}function lS(t,e,n,r){if(!n.has(t)&&(n.add(t),t.reactions!==null))for(const i of t.reactions){const s=i.f;(s&li)!==0?lS(i,e,n,r):(s&(Jc|Hs))!==0&&(s&Zr)===0&&c1(i,e,r)&&(xr(i,Zr),u1(i))}}function c1(t,e,n){const r=n.get(t);if(r!==void 0)return r;if(t.deps!==null)for(const i of t.deps){if(fg.call(e,i))return!0;if((i.f&li)!==0&&c1(i,e,n))return n.set(i,!0),!0}return n.set(t,!1),!1}function u1(t){$t.schedule(t)}function cS(t,e){if(!((t.f&Qs)!==0&&(t.f&Nr)!==0)){(t.f&Zr)!==0?e.d.push(t):(t.f&Js)!==0&&e.m.push(t),xr(t,Nr);for(var n=t.first;n!==null;)cS(n,e),n=n.next}}function uS(t){xr(t,Nr);for(var e=t.first;e!==null;)uS(e),e=e.next}let mg=new Set;const Zl=new Map;let dS=!1;function Io(t,e){var n={f:0,v:t,reactions:null,equals:G2,rv:0,wv:0};return n}function Se(t,e){const n=Io(t);return AS(n),n}function es(t,e=!1,n=!0){var i;const r=Io(t);return e||(r.equals=Y2),ed&&n&&En!==null&&En.l!==null&&((i=En.l).s??(i.s=[])).push(r),r}function I(t,e,n=!1){kn!==null&&(!Vs||(kn.f&pg)!==0)&&uc()&&(kn.f&(li|Hs|Jc|pg))!==0&&(Oo===null||!Oo.has(t))&&RE();let r=n?gn(e):e;return ca(t,r,Kp)}function ca(t,e,n=null){if(!t.equals(e)){Zl.set(t,ma?e:t.v);var r=ga.ensure();if(r.capture(t,e),(t.f&li)!==0){const i=t;(t.f&Zr)!==0&&l1(i),oi===null&&s1(i)}t.wv=CS(),fS(t,Zr,n),uc()&&bn!==null&&(bn.f&Nr)!==0&&(bn.f&(Qs|ha))===0&&(hs===null?TA([t]):hs.push(t)),!r.is_fork&&mg.size>0&&!dS&&gA()}return e}function gA(){dS=!1;for(const t of mg){(t.f&Nr)!==0&&xr(t,Js);let e;try{e=td(t)}catch{e=!0}e&&tc(t)}mg.clear()}function mA(t,e=1){var n=d(t),r=e===1?n++:n--;return I(t,n),r}function So(t){I(t,t.v+1)}function fS(t,e,n){var r=t.reactions;if(r!==null)for(var i=uc(),s=r.length,o=0;o<s;o++){var a=r[o],l=a.f;if(!(!i&&a===bn)){var c=(l&Zr)===0;if(c&&xr(a,e),(l&pg)!==0)mg.add(a);else if((l&li)!==0){var u=a;oi==null||oi.delete(u),(l&ec)===0&&(l&Ss&&(bn===null||(bn.f&gg)===0)&&(a.f|=ec),fS(u,Js,n))}else if(c){var f=a;(l&Hs)!==0&&Ls!==null&&Ls.add(f),n!==null?n.push(f):u1(f)}}}}function gn(t){if(typeof t!="object"||t===null||Ao in t)return t;const e=t1(t);if(e!==mE&&e!==vE)return t;var n=new Map,r=Nm(t),i=Se(0),s=ua,o=a=>{if(ua===s)return a();var l=kn,c=ua;ks(null),Mw(s);var u=a();return ks(l),Mw(c),u};return r&&n.set("length",Se(t.length)),new Proxy(t,{defineProperty(a,l,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&CE();var u=n.get(l);return u===void 0?o(()=>{var f=Se(c.value);return n.set(l,f),f}):I(u,c.value,!0),!0},deleteProperty(a,l){var c=n.get(l);if(c===void 0){if(l in a){const u=o(()=>Se(Tr));n.set(l,u),So(i)}}else I(c,Tr),So(i);return!0},get(a,l,c){var p;if(l===Ao)return t;var u=n.get(l),f=l in a;if(u===void 0&&(!f||(p=tl(a,l))!=null&&p.writable)&&(u=o(()=>{var g=gn(f?a[l]:Tr),m=Se(g);return m}),n.set(l,u)),u!==void 0){var h=d(u);return h===Tr?void 0:h}return Reflect.get(a,l,c)},getOwnPropertyDescriptor(a,l){var c=Reflect.getOwnPropertyDescriptor(a,l);if(c&&"value"in c){var u=n.get(l);u&&(c.value=d(u))}else if(c===void 0){var f=n.get(l),h=f==null?void 0:f.v;if(f!==void 0&&h!==Tr)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return c},has(a,l){var h;if(l===Ao)return!0;var c=n.get(l),u=c!==void 0&&c.v!==Tr||Reflect.has(a,l);if(c!==void 0||bn!==null&&(!u||(h=tl(a,l))!=null&&h.writable)){c===void 0&&(c=o(()=>{var p=u?gn(a[l]):Tr,g=Se(p);return g}),n.set(l,c));var f=d(c);if(f===Tr)return!1}return u},set(a,l,c,u){var k;var f=n.get(l),h=l in a;if(r&&l==="length")for(var p=c;p<f.v;p+=1){var g=n.get(p+"");g!==void 0?I(g,Tr):p in a&&(g=o(()=>Se(Tr)),n.set(p+"",g))}if(f===void 0)(!h||(k=tl(a,l))!=null&&k.writable)&&(f=o(()=>Se(void 0)),I(f,gn(c)),n.set(l,f));else{h=f.v!==Tr;var m=o(()=>gn(c));I(f,m)}var b=Reflect.getOwnPropertyDescriptor(a,l);if(b!=null&&b.set&&b.set.call(u,c),!h){if(r&&typeof l=="string"){var y=n.get("length"),_=Number(l);Number.isInteger(_)&&_>=y.v&&I(y,_+1)}So(i)}return!0},ownKeys(a){d(i);var l=Reflect.ownKeys(a).filter(f=>{var h=n.get(f);return h===void 0||h.v!==Tr});for(var[c,u]of n)u.v!==Tr&&!(c in a)&&l.push(c);return l},setPrototypeOf(){OE()}})}function _w(t){try{if(t!==null&&typeof t=="object"&&Ao in t)return t[Ao]}catch{}return t}function vA(t,e){return Object.is(_w(t),_w(e))}var vv,hS,pS,gS;function bA(){if(vv===void 0){vv=window,hS=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;pS=tl(e,"firstChild").get,gS=tl(e,"nextSibling").get,yw(t)&&(t[av]=void 0,t[Vp]=null,t[lv]=void 0,t.__e=void 0),yw(n)&&(n[zd]=void 0)}}function Co(t=""){return document.createTextNode(t)}function To(t){return pS.call(t)}function $h(t){return gS.call(t)}function j(t,e){return To(t)}function Me(t,e=!1){{var n=To(t);return n instanceof Comment&&n.data===""?$h(n):n}}function ee(t,e=1,n=!1){let r=t;for(;e--;)r=$h(r);return r}function yA(t){t.textContent=""}function mS(){return!1}function d1(t,e,n){return e==null||e===H2?document.createElement(t):document.createElementNS(e,t)}function wA(t,e){if(e){const n=document.body;t.autofocus=!0,Po(()=>{document.activeElement===n&&t.focus()})}}let Sw=!1;function xA(){Sw||(Sw=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{var e;if(!t.defaultPrevented)for(const n of t.target.elements)(e=n[$p])==null||e.call(n)})},{capture:!0}))}function jm(t){var e=kn,n=bn;ks(null),Ms(null);try{return t()}finally{ks(e),Ms(n)}}function vS(t,e,n,r=n){t.addEventListener(e,()=>jm(n));const i=t[$p];i?t[$p]=()=>{i(),r(!0)}:t[$p]=()=>r(!0),xA()}function bS(t){bn===null&&(kn===null&&TE(),ME()),ma&&kE()}function _A(t,e){var n=e.last;n===null?e.last=e.first=t:(n.next=t,t.prev=n,e.last=t)}function As(t,e){var n=bn;n!==null&&(n.f&Pi)!==0&&(t|=Pi);var r={ctx:En,deps:null,nodes:null,f:t|Zr|Ss,first:null,fn:e,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};$t==null||$t.register_created_effect(r);var i=r;if((t&Lu)!==0)Xc!==null?Xc.push(r):ga.ensure().schedule(r);else if(e!==null){try{tc(r)}catch(o){throw Qr(r),o}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&(i.f&cc)===0&&(i=i.first,(t&Hs)!==0&&(t&pa)!==0&&i!==null&&(i.f|=pa))}if(i!==null&&(i.parent=n,n!==null&&_A(i,n),kn!==null&&(kn.f&li)!==0&&(t&ha)===0)){var s=kn;(s.effects??(s.effects=[])).push(i)}return r}function f1(){return kn!==null&&!Vs}function Gh(t){const e=As(Hh,null);return xr(e,Nr),e.teardown=t,e}function Qt(t){bS();var e=bn.f,n=!kn&&(e&Qs)!==0&&En!==null&&!En.i;if(n){var r=En;(r.e??(r.e=[])).push(t)}else return yS(t)}function yS(t){return As(Lu|U2,t)}function h1(t){return bS(),As(Hh|U2,t)}function wS(t){ga.ensure();const e=As(ha|cc,t);return()=>{Qr(e)}}function SA(t){ga.ensure();const e=As(ha|cc,t);return(n={})=>new Promise(r=>{n.outro?Ql(e,()=>{Qr(e),r(void 0)}):(Qr(e),r(void 0))})}function Yh(t){return As(Lu,t)}function ef(t,e){var n=En,r={effect:null,ran:!1,deps:t};n.l.$.push(r),r.effect=dc(()=>{if(t(),!r.ran){r.ran=!0;var i=bn;try{Ms(i.parent),br(e)}finally{Ms(i)}}})}function xS(){var t=En;dc(()=>{for(var e of t.l.$){e.deps();var n=e.effect;(n.f&Nr)!==0&&n.deps!==null&&xr(n,Js),td(n)&&tc(n),e.ran=!1}})}function kA(t){return As(Jc|cc,t)}function dc(t,e=0){return As(Hh|e,t)}function De(t,e=[],n=[],r=[]){eS(r,e,n,i=>{As(Hh,()=>{t(...i.map(d))})})}function fl(t,e=0){var n=As(Hs|e,t);return n}function _S(t,e=0){var n=As(n1|e,t);return n}function ji(t){return As(Qs|cc,t)}function SS(t){var e=t.teardown;if(e!==null){const n=ma,r=kn;kw(!0),ks(null);try{e.call(null)}finally{kw(n),ks(r)}}}function p1(t,e=!1){var n=t.first;for(t.first=t.last=null;n!==null;){const i=n.ac;i!==null&&jm(()=>{i.abort(zm)});var r=n.next;(n.f&ha)!==0?n.parent=null:Qr(n,e),n=r}}function MA(t){for(var e=t.first;e!==null;){var n=e.next;(e.f&Qs)===0&&Qr(e),e=n}}function Qr(t,e=!0){var n=!1;(e||(t.f&wE)!==0)&&t.nodes!==null&&t.nodes.end!==null&&(kS(t.nodes.start,t.nodes.end),n=!0),t.f|=ov,p1(t,e&&!n),cf(t,0);var r=t.nodes&&t.nodes.t;if(r!==null)for(const s of r)s.stop();SS(t),t.f^=ov,t.f|=ts;var i=t.parent;i!==null&&i.first!==null&&MS(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=t.b=null}function kS(t,e){for(;t!==null;){var n=t===e?null:$h(t);t.remove(),t=n}}function MS(t){var e=t.parent,n=t.prev,r=t.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),e!==null&&(e.first===t&&(e.first=r),e.last===t&&(e.last=n))}function Ql(t,e,n=!0){var r=[];TS(t,r,!0);var i=()=>{n&&Qr(t),e&&e()},s=r.length;if(s>0){var o=()=>--s||i();for(var a of r)a.out(o)}else i()}function TS(t,e,n){if((t.f&Pi)===0){t.f^=Pi;var r=t.nodes&&t.nodes.t;if(r!==null)for(const a of r)(a.is_global||n)&&e.push(a);for(var i=t.first;i!==null;){var s=i.next;if((i.f&ha)===0){var o=(i.f&pa)!==0||(i.f&Qs)!==0&&(t.f&Hs)!==0;TS(i,e,o?n:!1)}i=s}}}function vg(t){ES(t,!0)}function ES(t,e){if((t.f&Pi)!==0){t.f^=Pi,(t.f&Nr)===0&&(xr(t,Zr),ga.ensure().schedule(t));for(var n=t.first;n!==null;){var r=n.next,i=(n.f&pa)!==0||(n.f&Qs)!==0;ES(n,i?e:!1),n=r}var s=t.nodes&&t.nodes.t;if(s!==null)for(const o of s)(o.is_global||e)&&o.in()}}function g1(t,e){if(t.nodes)for(var n=t.nodes.start,r=t.nodes.end;n!==null;){var i=n===r?null:$h(n);e.append(n),n=i}}let Xp=!1,ma=!1;function kw(t){ma=t}let kn=null,Vs=!1;function ks(t){kn=t}let bn=null;function Ms(t){bn=t}let Oo=null;function AS(t){kn!==null&&(Oo??(Oo=new Set)).add(t)}let Bi=null,$i=0,hs=null;function TA(t){hs=t}let PS=1,Nl=0,ua=Nl;function Mw(t){ua=t}function CS(){return++PS}function td(t){var e=t.f;if((e&Zr)!==0)return!0;if(e&li&&(t.f&=~ec),(e&Js)!==0){for(var n=t.deps,r=n.length,i=0;i<r;i++){var s=n[i];if(td(s)&&rS(s),s.wv>t.wv)return!0}(e&Ss)!==0&&oi===null&&xr(t,Nr)}return!1}function OS(t,e,n=!0){var r=t.reactions;if(r!==null&&!(Oo!==null&&Oo.has(t)))for(var i=0;i<r.length;i++){var s=r[i];(s.f&li)!==0?OS(s,e,!1):e===s&&(n?xr(s,Zr):(s.f&Nr)!==0&&xr(s,Js),u1(s))}}function RS(t){var m;var e=Bi,n=$i,r=hs,i=kn,s=Oo,o=En,a=Vs,l=ua,c=t.f;Bi=null,$i=0,hs=null,kn=(c&(Qs|ha))===0?t:null,Oo=null,Du(t.ctx),Vs=!1,ua=++Nl,t.ac!==null&&(jm(()=>{t.ac.abort(zm)}),t.ac=null);try{t.f|=gg;var u=t.fn,f=u();t.f|=Ju;var h=t.deps,p=$t==null?void 0:$t.is_fork;if(Bi!==null){var g;if(p||cf(t,$i),h!==null&&$i>0)for(h.length=$i+Bi.length,g=0;g<Bi.length;g++)h[$i+g]=Bi[g];else t.deps=h=Bi;if(f1()&&(t.f&Ss)!==0)for(g=$i;g<h.length;g++)((m=h[g]).reactions??(m.reactions=[])).push(t)}else!p&&h!==null&&$i<h.length&&(cf(t,$i),h.length=$i);if(uc()&&hs!==null&&!Vs&&h!==null&&(t.f&(li|Js|Zr))===0)for(g=0;g<hs.length;g++)OS(hs[g],t);if(i!==null&&i!==t){if(Nl++,i.deps!==null)for(let b=0;b<n;b+=1)i.deps[b].rv=Nl;if(e!==null)for(const b of e)b.rv=Nl;hs!==null&&(r===null?r=hs:r.push(...hs))}return(t.f&nl)!==0&&(t.f^=nl),f}catch(b){return X2(b)}finally{t.f^=gg,Bi=e,$i=n,hs=r,kn=i,Oo=s,Du(o),Vs=a,ua=l}}function EA(t,e){let n=e.reactions;if(n!==null){var r=gE.call(n,t);if(r!==-1){var i=n.length-1;i===0?n=e.reactions=null:(n[r]=n[i],n.pop())}}if(n===null&&(e.f&li)!==0&&(Bi===null||!fg.call(Bi,e))){var s=e;(s.f&Ss)!==0&&(s.f^=Ss,s.f&=~ec),s.v!==Tr&&s1(s),dA(s),cf(s,0)}}function cf(t,e){var n=t.deps;if(n!==null)for(var r=e;r<n.length;r++)EA(t,n[r])}function tc(t){var e=t.f;if((e&ts)===0){xr(t,Nr);var n=bn,r=Xp;bn=t,Xp=!0;try{(e&(Hs|n1))!==0?MA(t):p1(t),SS(t);var i=RS(t);t.teardown=typeof i=="function"?i:null,t.wv=PS;var s;L2&&KE&&(t.f&Zr)!==0&&t.deps}finally{Xp=r,bn=n}}}async function uf(){await Promise.resolve(),aS()}function d(t){var e=t.f,n=(e&li)!==0;if(kn!==null&&!Vs){var r=bn!==null&&(bn.f&ts)!==0;if(!r&&(Oo===null||!Oo.has(t))){var i=kn.deps;if((kn.f&gg)!==0)t.rv<Nl&&(t.rv=Nl,Bi===null&&i!==null&&i[$i]===t?$i++:Bi===null?Bi=[t]:Bi.push(t));else{kn.deps??(kn.deps=[]),fg.call(kn.deps,t)||kn.deps.push(t);var s=t.reactions;s===null?t.reactions=[kn]:fg.call(s,kn)||s.push(kn)}}}if(ma&&Zl.has(t))return Zl.get(t);if(n){var o=t;if(ma){var a=o.v;return((o.f&Nr)===0&&o.reactions!==null||IS(o))&&(a=l1(o)),Zl.set(o,a),a}var l=(o.f&Ss)===0&&!Vs&&kn!==null&&(Xp||(kn.f&Ss)!==0),c=(o.f&Ju)===0;td(o)&&(l&&(o.f|=Ss),rS(o)),l&&!c&&(iS(o),NS(o))}if(oi!=null&&oi.has(t))return oi.get(t);if((t.f&nl)!==0)throw t.v;return t.v}function NS(t){if(t.f|=Ss,t.deps!==null)for(const e of t.deps)(e.reactions??(e.reactions=[])).push(t),(e.f&li)!==0&&(e.f&Ss)===0&&(iS(e),NS(e))}function IS(t){if(t.v===Tr)return!0;if(t.deps===null)return!1;for(const e of t.deps)if(Zl.has(e)||(e.f&li)!==0&&IS(e))return!0;return!1}function br(t){var e=Vs;try{return Vs=!0,t()}finally{Vs=e}}function df(t){if(!(typeof t!="object"||!t||t instanceof EventTarget)){if(Ao in t)bv(t);else if(!Array.isArray(t))for(let e in t){const n=t[e];typeof n=="object"&&n&&Ao in n&&bv(n)}}}function bv(t,e=new Set){if(typeof t=="object"&&t!==null&&!(t instanceof EventTarget)&&!e.has(t)){e.add(t),t instanceof Date&&t.getTime();for(let r in t)try{bv(t[r],e)}catch{}const n=t1(t);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){const r=F2(n);for(let i in r){const s=r[i].get;if(s)try{s.call(t)}catch{}}}}}function AA(){return Symbol($2)}function PA(t){return t.endsWith("capture")&&t!=="gotpointercapture"&&t!=="lostpointercapture"}const CA=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function OA(t){return CA.includes(t)}const RA={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function NA(t){return t=t.toLowerCase(),RA[t]??t}const IA=["touchstart","touchmove"];function zA(t){return IA.includes(t)}const Il=Symbol("events"),zS=new Set,yv=new Set;function m1(t,e,n,r={}){function i(s){if(r.capture||wv.call(e,s),!s.cancelBubble)return jm(()=>n==null?void 0:n.call(this,s))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?Po(()=>{e.addEventListener(t,i,r)}):e.addEventListener(t,i,r),i}function Ar(t,e,n,r={}){var i=m1(e,t,n,r);return()=>{t.removeEventListener(e,i,r)}}function Mi(t,e,n,r,i){var s={capture:r,passive:i},o=m1(t,e,n,s);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&Gh(()=>{e.removeEventListener(t,o,s)})}function Ln(t,e,n){(e[Il]??(e[Il]={}))[t]=n}function Fo(t){for(var e=0;e<t.length;e++)zS.add(t[e]);for(var n of yv)n(t)}let Tw=null;function wv(t){var m,b;var e=this,n=e.ownerDocument,r=t.type,i=((m=t.composedPath)==null?void 0:m.call(t))||[],s=i[0]||t.target;Tw=t;var o=0,a=Tw===t&&t[Il];if(a){var l=i.indexOf(a);if(l!==-1&&(e===document||e===window)){t[Il]=e;return}var c=i.indexOf(e);if(c===-1)return;l<=c&&(o=l)}if(s=i[o]||t.target,s!==e){D2(t,"currentTarget",{configurable:!0,get(){return s||n}});var u=kn,f=bn;ks(null),Ms(null);try{for(var h,p=[];s!==null&&s!==e;){try{var g=(b=s[Il])==null?void 0:b[r];g!=null&&(!s.disabled||t.target===s)&&g.call(s,t)}catch(y){h?p.push(y):h=y}if(t.cancelBubble)break;o++,s=o<i.length?i[o]:null}if(h){for(let y of p)queueMicrotask(()=>{throw y});throw h}}finally{t[Il]=e,delete t.currentTarget,ks(u),Ms(f)}}}var R2;const _0=((R2=globalThis==null?void 0:globalThis.window)==null?void 0:R2.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:t=>t});function LA(t){return(_0==null?void 0:_0.createHTML(t))??t}function LS(t){var e=d1("template");return e.innerHTML=LA(t.replaceAll("<!>","<!---->")),e.content}function sl(t,e){var n=bn;n.nodes===null&&(n.nodes={start:t,end:e,a:null,t:null})}function ne(t,e){var n=(e&qE)!==0,r=(e&HE)!==0,i,s=!t.startsWith("<!>");return()=>{i===void 0&&(i=LS(s?t:"<!>"+t),n||(i=To(i)));var o=r||hS?document.importNode(i,!0):i.cloneNode(!0);if(n){var a=To(o),l=o.lastChild;sl(a,l)}else sl(o,o);return o}}function DA(t,e,n="svg"){var r=!t.startsWith("<!>"),i=`<${n}>${r?t:"<!>"+t}</${n}>`,s;return()=>{if(!s){var o=LS(i),a=To(o);s=To(a)}var l=s.cloneNode(!0);return sl(l,l),l}}function Ui(t,e){return DA(t,e,"svg")}function er(t=""){{var e=Co(t+"");return sl(e,e),e}}function qe(){var t=document.createDocumentFragment(),e=document.createComment(""),n=Co();return t.append(e,n),sl(e,n),t}function A(t,e){t!==null&&t.before(e)}function fc(){var t;return(t=window.__svelte??(window.__svelte={})).uid??(t.uid=1),`c${window.__svelte.uid++}`}function je(t,e){var n=e==null?"":typeof e=="object"?`${e}`:e;n!==(t[zd]??(t[zd]=t.nodeValue))&&(t[zd]=n,t.nodeValue=`${n}`)}function DS(t,e){return FA(t,e)}const mp=new Map;function FA(t,{target:e,anchor:n,props:r={},events:i,context:s,intro:o=!0,transformError:a}){bA();var l=void 0,c=SA(()=>{var u=n??e.appendChild(Co());iA(u,{pending:()=>{}},p=>{Tt({});var g=En;s&&(g.c=s),i&&(r.$$events=i),l=t(p,r)||{},Et()},a);var f=new Set,h=p=>{for(var g=0;g<p.length;g++){var m=p[g];if(!f.has(m)){f.add(m);var b=zA(m);for(const k of[e,document]){var y=mp.get(k);y===void 0&&(y=new Map,mp.set(k,y));var _=y.get(m);_===void 0?(k.addEventListener(m,wv,{passive:b}),y.set(m,1)):y.set(m,_+1)}}}};return h(Im(zS)),yv.add(h),()=>{var b;for(var p of f)for(const y of[e,document]){var g=mp.get(y),m=g.get(p);--m==0?(y.removeEventListener(p,wv),g.delete(p),g.size===0&&mp.delete(y)):g.set(p,m)}yv.delete(h),u!==n&&((b=u.parentNode)==null||b.removeChild(u))}});return xv.set(l,c),l}let xv=new WeakMap;function BA(t,e){const n=xv.get(t);return n?(xv.delete(t),n(e)):Promise.resolve()}var Fs,yo,Ki,jl,kf,Mf,im;class nd{constructor(e,n=!0){we(this,"anchor");Y(this,Fs,new Map);Y(this,yo,new Map);Y(this,Ki,new Map);Y(this,jl,new Set);Y(this,kf,!0);Y(this,Mf,e=>{if(v(this,Fs).has(e)){var n=v(this,Fs).get(e),r=v(this,yo).get(n);if(r)vg(r),v(this,jl).delete(n);else{var i=v(this,Ki).get(n);i&&(vg(i.effect),v(this,yo).set(n,i.effect),v(this,Ki).delete(n),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),r=i.effect)}for(const[s,o]of v(this,Fs)){if(v(this,Fs).delete(s),s===e)break;const a=v(this,Ki).get(o);a&&(Qr(a.effect),v(this,Ki).delete(o))}for(const[s,o]of v(this,yo)){if(s===n||v(this,jl).has(s))continue;const a=()=>{if(Array.from(v(this,Fs).values()).includes(s)){var c=document.createDocumentFragment();g1(o,c),c.append(Co()),v(this,Ki).set(s,{effect:o,fragment:c})}else Qr(o);v(this,jl).delete(s),v(this,yo).delete(s)};v(this,kf)||!r?(v(this,jl).add(s),Ql(o,a,!1)):a()}}});Y(this,im,e=>{v(this,Fs).delete(e);const n=Array.from(v(this,Fs).values());for(const[r,i]of v(this,Ki))n.includes(r)||(Qr(i.effect),v(this,Ki).delete(r))});this.anchor=e,ye(this,kf,n)}ensure(e,n){var r=$t,i=mS();if(n&&!v(this,yo).has(e)&&!v(this,Ki).has(e))if(i){var s=document.createDocumentFragment(),o=Co();s.append(o),v(this,Ki).set(e,{effect:ji(()=>n(o)),fragment:s})}else v(this,yo).set(e,ji(()=>n(this.anchor)));if(v(this,Fs).set(r,e),i){for(const[a,l]of v(this,yo))a===e?r.unskip_effect(l):r.skip_effect(l);for(const[a,l]of v(this,Ki))a===e?r.unskip_effect(l.effect):r.skip_effect(l.effect);r.oncommit(v(this,Mf)),r.ondiscard(v(this,im))}else v(this,Mf).call(this,r)}}Fs=new WeakMap,yo=new WeakMap,Ki=new WeakMap,jl=new WeakMap,kf=new WeakMap,Mf=new WeakMap,im=new WeakMap;const jA=0,Ew=1,UA=2;function WA(t,e,n,r,i){var s=uc(),o=Tr,a=s?Io(o):es(o,!1,!1),l=s?Io(o):es(o,!1,!1),c=new nd(t);fl(()=>{var u=$t,f=e(),h=!1;if(bE(f)){var p=tS(),g=!1;const m=b=>{if(!h){g=!0,p(!1),$t===u&&u.deactivate(),ga.ensure();try{b()}finally{lf(!1),eu||aS()}}};f.then(b=>{m(()=>{ca(a,b),c.ensure(Ew,r&&(y=>r(y,a)))})},b=>{m(()=>{if(ca(l,b),c.ensure(UA,i&&(y=>i(y,l))),!i)throw l.v})}),Po(()=>{g||m(()=>{c.ensure(jA,n)})})}else ca(a,f),c.ensure(Ew,r&&(m=>r(m,a)));return()=>{h=!0}})}function xe(t,e,n=!1){var r=new nd(t),i=n?pa:0;function s(o,a){r.ensure(o,a)}fl(()=>{var o=!1;e((a,l=0)=>{o=!0,s(l,a)}),o||s(-1,null)},i)}const qA=Symbol("NaN");function FS(t,e,n){var r=new nd(t),i=!uc();fl(()=>{var s=e();s!==s&&(s=qA),i&&s!==null&&typeof s=="object"&&(s={}),r.ensure(s,n)})}function $s(t,e){return e}function HA(t,e,n){for(var r=[],i=e.length,s,o=e.length,a=0;a<i;a++){let f=e[a];Ql(f,()=>{if(s){if(s.pending.delete(f),s.done.add(f),s.pending.size===0){var h=t.outrogroups;_v(t,Im(s.done)),h.delete(s),h.size===0&&(t.outrogroups=null)}}else o-=1},!1)}if(o===0){var l=r.length===0&&n!==null;if(l){var c=n,u=c.parentNode;yA(u),u.append(c),t.items.clear()}_v(t,e,!l)}else s={pending:new Set(e),done:new Set},(t.outrogroups??(t.outrogroups=new Set)).add(s)}function _v(t,e,n=!0){var r;if(t.pending.size>0){r=new Set;for(const o of t.pending.values())for(const a of o)r.add(t.items.get(a).e)}for(var i=0;i<e.length;i++){var s=e[i];if(r!=null&&r.has(s)){s.f|=Mo;const o=document.createDocumentFragment();g1(s,o)}else Qr(e[i],n)}}var Aw;function Rn(t,e,n,r,i,s=null){var o=t,a=new Map,l=(e&q2)!==0;if(l){var c=t;o=c.appendChild(Co())}var u=null,f=a1(()=>{var k=n();return Nm(k)?k:k==null?[]:Im(k)}),h,p=new Map,g=!0;function m(k){(_.effect.f&ts)===0&&(_.pending.delete(k),_.fallback=u,VA(_,h,o,e,r),u!==null&&(h.length===0?(u.f&Mo)===0?vg(u):(u.f^=Mo,Bd(u,null,o)):Ql(u,()=>{u=null})))}function b(k){_.pending.delete(k)}var y=fl(()=>{h=d(f);for(var k=h.length,S=new Set,E=$t,M=mS(),O=0;O<k;O+=1){var P=h[O],x=r(P,O),C=g?null:a.get(x);C?(C.v&&ca(C.v,P),C.i&&ca(C.i,O),M&&E.unskip_effect(C.e)):(C=$A(a,g?o:Aw??(Aw=Co()),P,x,O,i,e,n),g||(C.e.f|=Mo),a.set(x,C)),S.add(x)}if(k===0&&s&&!u&&(g?u=ji(()=>s(o)):(u=ji(()=>s(Aw??(Aw=Co()))),u.f|=Mo)),k>S.size&&SE(),!g)if(p.set(E,S),M){for(const[R,N]of a)S.has(R)||E.skip_effect(N.e);E.oncommit(m),E.ondiscard(b)}else m(E);d(f)}),_={effect:y,items:a,pending:p,outrogroups:null,fallback:u};g=!1}function md(t){for(;t!==null&&(t.f&Qs)===0;)t=t.next;return t}function VA(t,e,n,r,i){var C,R,N,B,z,H,X,G,Z;var s=(r&LE)!==0,o=e.length,a=t.items,l=md(t.effect.first),c,u=null,f,h=[],p=[],g,m,b,y;if(s)for(y=0;y<o;y+=1)g=e[y],m=i(g,y),b=a.get(m).e,(b.f&Mo)===0&&((R=(C=b.nodes)==null?void 0:C.a)==null||R.measure(),(f??(f=new Set)).add(b));for(y=0;y<o;y+=1){if(g=e[y],m=i(g,y),b=a.get(m).e,t.outrogroups!==null)for(const oe of t.outrogroups)oe.pending.delete(b),oe.done.delete(b);if((b.f&Pi)!==0&&(vg(b),s&&((B=(N=b.nodes)==null?void 0:N.a)==null||B.unfix(),(f??(f=new Set)).delete(b))),(b.f&Mo)!==0)if(b.f^=Mo,b===l)Bd(b,null,n);else{var _=u?u.next:l;b===t.effect.last&&(t.effect.last=b.prev),b.prev&&(b.prev.next=b.next),b.next&&(b.next.prev=b.prev),Ta(t,u,b),Ta(t,b,_),Bd(b,_,n),u=b,h=[],p=[],l=md(u.next);continue}if(b!==l){if(c!==void 0&&c.has(b)){if(h.length<p.length){var k=p[0],S;u=k.prev;var E=h[0],M=h[h.length-1];for(S=0;S<h.length;S+=1)Bd(h[S],k,n);for(S=0;S<p.length;S+=1)c.delete(p[S]);Ta(t,E.prev,M.next),Ta(t,u,E),Ta(t,M,k),l=k,u=M,y-=1,h=[],p=[]}else c.delete(b),Bd(b,l,n),Ta(t,b.prev,b.next),Ta(t,b,u===null?t.effect.first:u.next),Ta(t,u,b),u=b;continue}for(h=[],p=[];l!==null&&l!==b;)(c??(c=new Set)).add(l),p.push(l),l=md(l.next);if(l===null)continue}(b.f&Mo)===0&&h.push(b),u=b,l=md(b.next)}if(t.outrogroups!==null){for(const oe of t.outrogroups)oe.pending.size===0&&(_v(t,Im(oe.done)),(z=t.outrogroups)==null||z.delete(oe));t.outrogroups.size===0&&(t.outrogroups=null)}if(l!==null||c!==void 0){var O=[];if(c!==void 0)for(b of c)(b.f&Pi)===0&&O.push(b);for(;l!==null;)(l.f&Pi)===0&&l!==t.fallback&&O.push(l),l=md(l.next);var P=O.length;if(P>0){var x=(r&q2)!==0&&o===0?n:null;if(s){for(y=0;y<P;y+=1)(X=(H=O[y].nodes)==null?void 0:H.a)==null||X.measure();for(y=0;y<P;y+=1)(Z=(G=O[y].nodes)==null?void 0:G.a)==null||Z.fix()}HA(t,O,x)}}s&&Po(()=>{var oe,K;if(f!==void 0)for(b of f)(K=(oe=b.nodes)==null?void 0:oe.a)==null||K.apply()})}function $A(t,e,n,r,i,s,o,a){var l=(o&IE)!==0?(o&DE)===0?es(n,!1,!1):Io(n):null,c=(o&zE)!==0?Io(i):null;return{v:l,i:c,e:ji(()=>(s(e,l??n,c??i,a),()=>{t.delete(r)}))}}function Bd(t,e,n){if(t.nodes)for(var r=t.nodes.start,i=t.nodes.end,s=e&&(e.f&Mo)===0?e.nodes.start:n;r!==null;){var o=$h(r);if(s.before(r),r===i)return;r=o}}function Ta(t,e,n){e===null?t.effect.first=n:e.next=n,n===null?t.effect.last=e:n.prev=e}function BS(t,e,n=!1,r=!1,i=!1,s=!1){var o=t,a="";if(n)var l=t;De(()=>{var c=bn;if(a!==(a=e()??"")){if(n){c.nodes=null,l.innerHTML=a,a!==""&&sl(To(l),l.lastChild);return}if(c.nodes!==null&&(kS(c.nodes.start,c.nodes.end),c.nodes=null),a!==""){var u=r?V2:i?VE:void 0,f=d1(r?"svg":i?"math":"template",u);f.innerHTML=a;var h=r||i?f:f.content;if(sl(To(h),h.lastChild),r||i)for(;To(h);)o.before(To(h));else o.before(h)}}})}function bg(t,e,n,r,i){var a;var s=(a=e.$$slots)==null?void 0:a[n],o=!1;s===!0&&(s=e.children,o=!0),s===void 0||s(t,o?()=>r:r)}function Zt(t,e,...n){var r=new nd(t);fl(()=>{const i=e()??null;r.ensure(i,i&&(s=>i(s,...n)))},pa)}function Tn(t,e,n){var r=new nd(t);fl(()=>{var i=e()??null;r.ensure(i,i&&(s=>n(s,i)))},pa)}function jS(t,e,n,r,i,s){var o=null,a=t,l=new nd(a,!1);fl(()=>{const c=e()||null;var u=n||c==="svg"?V2:void 0;if(c===null){l.ensure(null,null);return}return l.ensure(c,f=>{if(c){if(o=d1(c,u),sl(o,o),r){var h=null,p=o.appendChild(Co());r(o,p),h==null||h.remove()}bn.nodes.end=o,f.before(o)}}),()=>{}},pa),Gh(()=>{})}function Pw(t,e,n){Yh(()=>{var r=br(()=>e(t,n==null?void 0:n())||{});if(n&&(r!=null&&r.update)){var i=!1,s={};dc(()=>{var o=n();df(o),i&&r1(s,o)&&(s=o,r.update(o))}),i=!0}if(r!=null&&r.destroy)return()=>r.destroy()})}function GA(t,e){var n=void 0,r;_S(()=>{n!==(n=e())&&(r&&(Qr(r),r=null),n&&(r=ji(()=>{Yh(()=>n(t))})))})}function US(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=US(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function tf(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=US(t))&&(r&&(r+=" "),r+=e);return r}function Xi(t){return typeof t=="object"?tf(t):t??""}const Cw=[...`
\r\f \v\uFEFF`];function YA(t,e,n){var r=t==null?"":""+t;if(e&&(r=r?r+" "+e:e),n){for(var i of Object.keys(n))if(n[i])r=r?r+" "+i:i;else if(r.length)for(var s=i.length,o=0;(o=r.indexOf(i,o))>=0;){var a=o+s;(o===0||Cw.includes(r[o-1]))&&(a===r.length||Cw.includes(r[a]))?r=(o===0?"":r.substring(0,o))+r.substring(a+1):o=a}}return r===""?null:r}function Ow(t,e=!1){var n=e?" !important;":";",r="";for(var i of Object.keys(t)){var s=t[i];s!=null&&s!==""&&(r+=" "+i+": "+s+n)}return r}function S0(t){return t[0]!=="-"||t[1]!=="-"?t.toLowerCase():t}function KA(t,e){if(e){var n="",r,i;if(Array.isArray(e)?(r=e[0],i=e[1]):r=e,t){t=String(t).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var s=!1,o=0,a=!1,l=[];r&&l.push(...Object.keys(r).map(S0)),i&&l.push(...Object.keys(i).map(S0));var c=0,u=-1;const m=t.length;for(var f=0;f<m;f++){var h=t[f];if(a?h==="/"&&t[f-1]==="*"&&(a=!1):s?s===h&&(s=!1):h==="/"&&t[f+1]==="*"?a=!0:h==='"'||h==="'"?s=h:h==="("?o++:h===")"&&o--,!a&&s===!1&&o===0){if(h===":"&&u===-1)u=f;else if(h===";"||f===m-1){if(u!==-1){var p=S0(t.substring(c,u).trim());if(!l.includes(p)){h!==";"&&f++;var g=t.substring(c,f).trim();n+=" "+g+";"}}c=f+1,u=-1}}}}return r&&(n+=Ow(r)),i&&(n+=Ow(i,!0)),n=n.trim(),n===""?null:n}return t==null?null:String(t)}function Gn(t,e,n,r,i,s){var o=t[av];if(o!==n||o===void 0){var a=YA(n,r,s);a==null?t.removeAttribute("class"):e?t.className=a:t.setAttribute("class",a),t[av]=n}else if(s&&i!==s)for(var l in s){var c=!!s[l];(i==null||c!==!!i[l])&&t.classList.toggle(l,c)}return s}function k0(t,e={},n,r){for(var i in n){var s=n[i];e[i]!==s&&(n[i]==null?t.style.removeProperty(i):t.style.setProperty(i,s,r))}}function Ks(t,e,n,r){var i=t[lv];if(i!==e){var s=KA(e,r);s==null?t.removeAttribute("style"):t.style.cssText=s,t[lv]=e}else r&&(Array.isArray(r)?(k0(t,n==null?void 0:n[0],r[0]),k0(t,n==null?void 0:n[1],r[1],"important")):k0(t,n,r));return r}function Sv(t,e,n=!1){if(t.multiple){if(e==null)return;if(!Nm(e))return GE();for(var r of t.options)r.selected=e.includes(Rw(r));return}for(r of t.options){var i=Rw(r);if(vA(i,e)){r.selected=!0;return}}(!n||e!==void 0)&&(t.selectedIndex=-1)}function XA(t){var e=new MutationObserver(()=>{Sv(t,t.__value)});e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Gh(()=>{e.disconnect()})}function Rw(t){return"__value"in t?t.__value:t.value}const vd=Symbol("class"),qc=Symbol("style"),WS=Symbol("is custom element"),qS=Symbol("is html"),ZA=Lm?"input":"INPUT",QA=Lm?"option":"OPTION",JA=Lm?"select":"SELECT",e3=Lm?"progress":"PROGRESS";function $W(t,e){var n=Um(t);n.value===(n.value=e??void 0)||t.value===e&&(e!==0||t.nodeName!==e3)||(t.value=e??"")}function GW(t,e){var n=Um(t);n.checked!==(n.checked=e??void 0)&&(t.checked=e)}function t3(t,e){e?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function ut(t,e,n,r){var i=Um(t);i[e]!==(i[e]=n)&&(e==="loading"&&(t[xE]=n),n==null?t.removeAttribute(e):typeof n!="string"&&HS(t).includes(e)?t[e]=n:t.setAttribute(e,n))}function n3(t,e,n,r,i=!1,s=!1){var o=Um(t),a=o[WS],l=!o[qS],c=e||{},u=t.nodeName===QA;for(var f in e)f in n||(n[f]=null);n.class?n.class=Xi(n.class):(r||n[vd])&&(n.class=null),n[qc]&&(n.style??(n.style=null));var h=HS(t);if(t.nodeName===ZA&&"type"in n&&("value"in n||"__value"in n)){var p=n.type;(p!==c.type||p===void 0&&t.hasAttribute("type"))&&(c.type=p,ut(t,"type",p))}for(const S in n){let E=n[S];if(u&&S==="value"&&E==null){t.value=t.__value="",c[S]=E;continue}if(S==="class"){var g=t.namespaceURI==="http://www.w3.org/1999/xhtml";Gn(t,g,E,r,e==null?void 0:e[vd],n[vd]),c[S]=E,c[vd]=n[vd];continue}if(S==="style"){Ks(t,E,e==null?void 0:e[qc],n[qc]),c[S]=E,c[qc]=n[qc];continue}var m=c[S];if(!(E===m&&!(E===void 0&&t.hasAttribute(S)))){c[S]=E;var b=S[0]+S[1];if(b!=="$$")if(b==="on"){const M={},O="$$"+S;let P=S.slice(2);var y=OA(P);if(PA(P)&&(P=P.slice(0,-7),M.capture=!0),!y&&m){if(E!=null)continue;t.removeEventListener(P,c[O],M),c[O]=null}if(y)Ln(P,t,E),Fo([P]);else if(E!=null){let x=function(C){c[S].call(this,C)};c[O]=m1(P,t,x,M)}}else if(S==="style")ut(t,S,E);else if(S==="autofocus")wA(t,!!E);else if(!a&&(S==="__value"||S==="value"&&E!=null))t.value=t.__value=E;else if(S==="selected"&&u)t3(t,E);else{var _=S;l||(_=NA(_));var k=_==="defaultValue"||_==="defaultChecked";if(E==null&&!a&&!k)if(o[S]=null,_==="value"||_==="checked"){let M=t;const O=e===void 0;if(_==="value"){let P=M.defaultValue;M.removeAttribute(_),M.defaultValue=P,M.value=M.__value=O?P:null}else{let P=M.defaultChecked;M.removeAttribute(_),M.defaultChecked=P,M.checked=O?P:!1}}else t.removeAttribute(S);else k||h.includes(_)&&(a||typeof E!="string")?(t[_]=E,_ in o&&(o[_]=Tr)):typeof E!="function"&&ut(t,_,E)}}}return c}function _r(t,e,n=[],r=[],i=[],s,o=!1,a=!1){eS(i,n,r,l=>{var c=void 0,u={},f=t.nodeName===JA,h=!1;if(_S(()=>{var g=e(...l.map(d)),m=n3(t,c,g,s,o,a);h&&f&&"value"in g&&Sv(t,g.value);for(let y of Object.getOwnPropertySymbols(u))g[y]||Qr(u[y]);for(let y of Object.getOwnPropertySymbols(g)){var b=g[y];y.description===$2&&(!c||b!==c[y])&&(u[y]&&Qr(u[y]),u[y]=ji(()=>GA(t,()=>b))),m[y]=b}c=m}),f){var p=t;Yh(()=>{Sv(p,c.value,!0),XA(p)})}h=!0})}function Um(t){return t[Vp]??(t[Vp]={[WS]:t.nodeName.includes("-"),[qS]:t.namespaceURI===H2})}var Nw=new Map;function HS(t){var e=t.getAttribute("is")||t.nodeName,n=Nw.get(e);if(n)return n;Nw.set(e,n=[]);for(var r,i=t,s=Element.prototype;s!==i;){r=F2(i);for(var o in r)r[o].set&&o!=="innerHTML"&&o!=="textContent"&&o!=="innerText"&&n.push(o);i=t1(i)}return n}function kv(t,e,n=e){var r=new WeakSet;vS(t,"input",async i=>{var s=i?t.defaultValue:t.value;if(s=M0(t)?T0(s):s,n(s),$t!==null&&r.add($t),await uf(),s!==(s=e())){var o=t.selectionStart,a=t.selectionEnd,l=t.value.length;if(t.value=s??"",a!==null){var c=t.value.length;o===a&&a===l&&c>l?(t.selectionStart=c,t.selectionEnd=c):(t.selectionStart=o,t.selectionEnd=Math.min(a,c))}}}),br(e)==null&&t.value&&(n(M0(t)?T0(t.value):t.value),$t!==null&&r.add($t)),dc(()=>{var i=e();if(t===document.activeElement){var s=$t;if(r.has(s))return}M0(t)&&i===T0(t.value)||t.type==="date"&&!i&&!t.value||i!==t.value&&(t.value=i??"")})}function M0(t){var e=t.type;return e==="number"||e==="range"}function T0(t){return t===""?null:+t}function r3(t,e,n=e){vS(t,"change",()=>{n(t.files)}),dc(()=>{t.files=e()})}var ja,hu,Tf,sm,VS;const om=class om{constructor(e){Y(this,sm);Y(this,ja,new WeakMap);Y(this,hu);Y(this,Tf);ye(this,Tf,e)}observe(e,n){var r=v(this,ja).get(e)||new Set;return r.add(n),v(this,ja).set(e,r),ze(this,sm,VS).call(this).observe(e,v(this,Tf)),()=>{var i=v(this,ja).get(e);i.delete(n),i.size===0&&(v(this,ja).delete(e),v(this,hu).unobserve(e))}}};ja=new WeakMap,hu=new WeakMap,Tf=new WeakMap,sm=new WeakSet,VS=function(){return v(this,hu)??ye(this,hu,new ResizeObserver(e=>{for(var n of e){om.entries.set(n.target,n);for(var r of v(this,ja).get(n.target)||[])r(n)}}))},we(om,"entries",new WeakMap);let Mv=om;var i3=new Mv({box:"border-box"});function s3(t,e,n){var r=i3.observe(t,()=>n(t[e]));Yh(()=>(br(()=>n(t[e])),r))}function E0(t,e){return t===e||(t==null?void 0:t[Ao])===e}function kr(t={},e,n,r){var i=En.r,s=bn;return Yh(()=>{var o,a;return dc(()=>{o=a,a=(r==null?void 0:r())||[],br(()=>{E0(n(...a),t)||(e(t,...a),o&&E0(n(...o),t)&&e(null,...o))})}),()=>{let l=s;for(;l!==i&&l.parent!==null&&l.parent.f&ov;)l=l.parent;const c=()=>{a&&E0(n(...a),t)&&e(null,...a)},u=l.teardown;l.teardown=()=>{c(),u==null||u()}}}),t}function v1(t=!1){const e=En,n=e.l.u;if(!n)return;let r=()=>df(e.s);if(t){let i=0,s={};const o=Bu(()=>{let a=!1;const l=e.s;for(const c in l)l[c]!==s[c]&&(s[c]=l[c],a=!0);return a&&i++,i});r=()=>d(o)}n.b.length&&h1(()=>{Iw(e,r),hg(n.b)}),Qt(()=>{const i=br(()=>n.m.map(yE));return()=>{for(const s of i)typeof s=="function"&&s()}}),n.a.length&&Qt(()=>{Iw(e,r),hg(n.a)})}function Iw(t,e){if(t.l.s)for(const n of t.l.s)d(n);e()}const o3={get(t,e){if(!t.exclude.has(e))return t.props[e]},set(t,e){return!1},getOwnPropertyDescriptor(t,e){if(!t.exclude.has(e)&&e in t.props)return{enumerable:!0,configurable:!0,value:t.props[e]}},has(t,e){return t.exclude.has(e)?!1:e in t.props},ownKeys(t){return Reflect.ownKeys(t.props).filter(e=>!t.exclude.has(e))}};function ht(t,e,n){return new Proxy({props:t,exclude:e},o3)}const a3={get(t,e){let n=t.props.length;for(;n--;){let r=t.props[n];if(gd(r)&&(r=r()),typeof r=="object"&&r!==null&&e in r)return r[e]}},set(t,e,n){let r=t.props.length;for(;r--;){let i=t.props[r];gd(i)&&(i=i());const s=tl(i,e);if(s&&s.set)return s.set(n),!0}return!1},getOwnPropertyDescriptor(t,e){let n=t.props.length;for(;n--;){let r=t.props[n];if(gd(r)&&(r=r()),typeof r=="object"&&r!==null&&e in r){const i=tl(r,e);return i&&!i.configurable&&(i.configurable=!0),i}}},has(t,e){if(e===Ao||e===W2)return!1;for(let n of t.props)if(gd(n)&&(n=n()),n!=null&&e in n)return!0;return!1},ownKeys(t){const e=[];for(let n of t.props)if(gd(n)&&(n=n()),!!n){for(const r in n)e.includes(r)||e.push(r);for(const r of Object.getOwnPropertySymbols(n))e.includes(r)||e.push(r)}return e}};function zt(...t){return new Proxy({props:t},a3)}function te(t,e,n,r){var S;var i=!ed||(n&BE)!==0,s=(n&UE)!==0,o=(n&WE)!==0,a=r,l=!0,c=void 0,u=()=>o&&i?(c??(c=Bu(r)),d(c)):(l&&(l=!1,a=o?br(r):r),a);let f;if(s){var h=Ao in t||W2 in t;f=((S=tl(t,e))==null?void 0:S.set)??(h&&e in t?E=>t[e]=E:void 0)}var p,g=!1;s?[p,g]=nA(()=>t[e]):p=t[e],p===void 0&&r!==void 0&&(p=u(),f&&(i&&PE(),f(p)));var m;if(i?m=()=>{var E=t[e];return E===void 0?u():(l=!0,E)}:m=()=>{var E=t[e];return E!==void 0&&(a=void 0),E===void 0?a:E},i&&(n&jE)===0)return m;if(f){var b=t.$$legacy;return(function(E,M){return arguments.length>0?((!i||!M||b||g)&&f(M?m():E),E):m()})}var y=!1,_=((n&FE)!==0?Bu:a1)(()=>(y=!1,m()));s&&d(_);var k=bn;return(function(E,M){if(arguments.length>0){const O=M?d(_):i&&s?gn(E):E;return I(_,O),y=!0,a!==void 0&&(a=O),E}return ma&&y||(k.f&ts)!==0?_.v:d(_)})}function os(t){En===null&&Vh(),ed&&En.l!==null?$S(En).m.push(t):Qt(()=>{const e=br(t);if(typeof e=="function")return e})}function Kh(t){En===null&&Vh(),os(()=>()=>br(t))}function l3(t,e,{bubbles:n=!1,cancelable:r=!1}={}){return new CustomEvent(t,{detail:e,bubbles:n,cancelable:r})}function c3(){const t=En;return t===null&&Vh(),(e,n,r)=>{var s;const i=(s=t.s.$$events)==null?void 0:s[e];if(i){const o=Nm(i)?i.slice():[i],a=l3(e,n,r);for(const l of o)l.call(t.x,a);return!a.defaultPrevented}return!0}}function u3(t){En===null&&Vh(),En.l===null&&AE(),$S(En).a.push(t)}function $S(t){var e=t.l;return e.u??(e.u={a:[],b:[],m:[]})}const d3="5";var N2;typeof window<"u"&&((N2=window.__svelte??(window.__svelte={})).v??(N2.v=new Set)).add(d3);const f3=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r<t.length;r++)n[r]=t[r];for(let r=0;r<e.length;r++)n[t.length+r]=e[r];return n},h3=(t,e)=>({classGroupId:t,validator:e}),GS=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),yg="-",zw=[],p3="arbitrary..",g3=t=>{const e=v3(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return m3(o);const a=o.split(yg),l=a[0]===""&&a.length>1?1:0;return YS(a,l,e)},getConflictingClassGroupIds:(o,a)=>{if(a){const l=r[o],c=n[o];return l?c?f3(c,l):l:c||zw}return n[o]||zw}}},YS=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const i=t[e],s=n.nextPart.get(i);if(s){const c=YS(t,e+1,s);if(c)return c}const o=n.validators;if(o===null)return;const a=e===0?t.join(yg):t.slice(e).join(yg),l=o.length;for(let c=0;c<l;c++){const u=o[c];if(u.validator(a))return u.classGroupId}},m3=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?p3+r:void 0})(),v3=t=>{const{theme:e,classGroups:n}=t;return b3(n,e)},b3=(t,e)=>{const n=GS();for(const r in t){const i=t[r];b1(i,n,r,e)}return n},b1=(t,e,n,r)=>{const i=t.length;for(let s=0;s<i;s++){const o=t[s];y3(o,e,n,r)}},y3=(t,e,n,r)=>{if(typeof t=="string"){w3(t,e,n);return}if(typeof t=="function"){x3(t,e,n,r);return}_3(t,e,n,r)},w3=(t,e,n)=>{const r=t===""?e:KS(e,t);r.classGroupId=n},x3=(t,e,n,r)=>{if(S3(t)){b1(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(h3(n,t))},_3=(t,e,n,r)=>{const i=Object.entries(t),s=i.length;for(let o=0;o<s;o++){const[a,l]=i[o];b1(l,KS(e,a),n,r)}},KS=(t,e)=>{let n=t;const r=e.split(yg),i=r.length;for(let s=0;s<i;s++){const o=r[s];let a=n.nextPart.get(o);a||(a=GS(),n.nextPart.set(o,a)),n=a}return n},S3=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,k3=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const i=(s,o)=>{n[s]=o,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(s){let o=n[s];if(o!==void 0)return o;if((o=r[s])!==void 0)return i(s,o),o},set(s,o){s in n?n[s]=o:i(s,o)}}},Tv="!",Lw=":",M3=[],Dw=(t,e,n,r,i)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),T3=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=i=>{const s=[];let o=0,a=0,l=0,c;const u=i.length;for(let m=0;m<u;m++){const b=i[m];if(o===0&&a===0){if(b===Lw){s.push(i.slice(l,m)),l=m+1;continue}if(b==="/"){c=m;continue}}b==="["?o++:b==="]"?o--:b==="("?a++:b===")"&&a--}const f=s.length===0?i:i.slice(l);let h=f,p=!1;f.endsWith(Tv)?(h=f.slice(0,-1),p=!0):f.startsWith(Tv)&&(h=f.slice(1),p=!0);const g=c&&c>l?c-l:void 0;return Dw(s,p,h,g)};if(e){const i=e+Lw,s=r;r=o=>o.startsWith(i)?s(o.slice(i.length)):Dw(M3,!1,o,void 0,!0)}if(n){const i=r;r=s=>n({className:s,parseClassName:i})}return r},E3=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let i=[];for(let s=0;s<n.length;s++){const o=n[s],a=o[0]==="[",l=e.has(o);a||l?(i.length>0&&(i.sort(),r.push(...i),i=[]),r.push(o)):i.push(o)}return i.length>0&&(i.sort(),r.push(...i)),r}},A3=t=>({cache:k3(t.cacheSize),parseClassName:T3(t),sortModifiers:E3(t),postfixLookupClassGroupIds:P3(t),...g3(t)}),P3=t=>{const e=Object.create(null),n=t.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)e[n[r]]=!0;return e},C3=/\s+/,O3=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s,postfixLookupClassGroupIds:o}=e,a=[],l=t.trim().split(C3);let c="";for(let u=l.length-1;u>=0;u-=1){const f=l[u],{isExternal:h,modifiers:p,hasImportantModifier:g,baseClassName:m,maybePostfixModifierPosition:b}=n(f);if(h){c=f+(c.length>0?" "+c:c);continue}let y=!!b,_;if(y){const O=m.substring(0,b);_=r(O);const P=_&&o[_]?r(m):void 0;P&&P!==_&&(_=P,y=!1)}else _=r(m);if(!_){if(!y){c=f+(c.length>0?" "+c:c);continue}if(_=r(m),!_){c=f+(c.length>0?" "+c:c);continue}y=!1}const k=p.length===0?"":p.length===1?p[0]:s(p).join(":"),S=g?k+Tv:k,E=S+_;if(a.indexOf(E)>-1)continue;a.push(E);const M=i(_,y);for(let O=0;O<M.length;++O){const P=M[O];a.push(S+P)}c=f+(c.length>0?" "+c:c)}return c},R3=(...t)=>{let e=0,n,r,i="";for(;e<t.length;)(n=t[e++])&&(r=XS(n))&&(i&&(i+=" "),i+=r);return i},XS=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=XS(t[r]))&&(n&&(n+=" "),n+=e);return n},Ev=(t,...e)=>{let n,r,i,s;const o=l=>{const c=e.reduce((u,f)=>f(u),t());return n=A3(c),r=n.cache.get,i=n.cache.set,s=a,a(l)},a=l=>{const c=r(l);if(c)return c;const u=O3(l,n);return i(l,u),u};return s=o,(...l)=>s(R3(...l))},N3=[],Lr=t=>{const e=n=>n[t]||N3;return e.isThemeGetter=!0,e},ZS=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,QS=/^\((?:(\w[\w-]*):)?(.+)\)$/i,I3=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,z3=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,L3=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,D3=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,F3=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,B3=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ea=t=>I3.test(t),wn=t=>!!t&&!Number.isNaN(Number(t)),co=t=>!!t&&Number.isInteger(Number(t)),A0=t=>t.endsWith("%")&&wn(t.slice(0,-1)),Wo=t=>z3.test(t),JS=()=>!0,j3=t=>L3.test(t)&&!D3.test(t),y1=()=>!1,U3=t=>F3.test(t),W3=t=>B3.test(t),q3=t=>!Ot(t)&&!It(t),H3=t=>t.startsWith("@container")&&(t[10]==="/"&&t[11]!==void 0||t[11]==="s"&&t[16]!==void 0&&t.startsWith("-size/",10)||t[11]==="n"&&t[18]!==void 0&&t.startsWith("-normal/",10)),V3=t=>hl(t,nk,y1),Ot=t=>ZS.test(t),yl=t=>hl(t,rk,j3),Fw=t=>hl(t,J3,wn),$3=t=>hl(t,sk,JS),G3=t=>hl(t,ik,y1),Bw=t=>hl(t,ek,y1),Y3=t=>hl(t,tk,W3),vp=t=>hl(t,ok,U3),It=t=>QS.test(t),bd=t=>hc(t,rk),K3=t=>hc(t,ik),jw=t=>hc(t,ek),X3=t=>hc(t,nk),Z3=t=>hc(t,tk),bp=t=>hc(t,ok,!0),Q3=t=>hc(t,sk,!0),hl=(t,e,n)=>{const r=ZS.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},hc=(t,e,n=!1)=>{const r=QS.exec(t);return r?r[1]?e(r[1]):n:!1},ek=t=>t==="position"||t==="percentage",tk=t=>t==="image"||t==="url",nk=t=>t==="length"||t==="size"||t==="bg-size",rk=t=>t==="length",J3=t=>t==="number",ik=t=>t==="family-name",sk=t=>t==="number"||t==="weight",ok=t=>t==="shadow",Av=()=>{const t=Lr("color"),e=Lr("font"),n=Lr("text"),r=Lr("font-weight"),i=Lr("tracking"),s=Lr("leading"),o=Lr("breakpoint"),a=Lr("container"),l=Lr("spacing"),c=Lr("radius"),u=Lr("shadow"),f=Lr("inset-shadow"),h=Lr("text-shadow"),p=Lr("drop-shadow"),g=Lr("blur"),m=Lr("perspective"),b=Lr("aspect"),y=Lr("ease"),_=Lr("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...S(),It,Ot],M=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto","contain","none"],P=()=>[It,Ot,l],x=()=>[Ea,"full","auto",...P()],C=()=>[co,"none","subgrid",It,Ot],R=()=>["auto",{span:["full",co,It,Ot]},co,It,Ot],N=()=>[co,"auto",It,Ot],B=()=>["auto","min","max","fr",It,Ot],z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],X=()=>["auto",...P()],G=()=>[Ea,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],Z=()=>[Ea,"screen","full","dvw","lvw","svw","min","max","fit",...P()],oe=()=>[Ea,"screen","full","lh","dvh","lvh","svh","min","max","fit",...P()],K=()=>[t,It,Ot],q=()=>[...S(),jw,Bw,{position:[It,Ot]}],W=()=>["no-repeat",{repeat:["","x","y","space","round"]}],J=()=>["auto","cover","contain",X3,V3,{size:[It,Ot]}],fe=()=>[A0,bd,yl],$=()=>["","none","full",c,It,Ot],de=()=>["",wn,bd,yl],Be=()=>["solid","dashed","dotted","double"],wt=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Je=()=>[wn,A0,jw,Bw],Ue=()=>["","none",g,It,Ot],ke=()=>["none",wn,It,Ot],ct=()=>["none",wn,It,Ot],Ee=()=>[wn,It,Ot],Ve=()=>[Ea,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Wo],breakpoint:[Wo],color:[JS],container:[Wo],"drop-shadow":[Wo],ease:["in","out","in-out"],font:[q3],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Wo],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Wo],shadow:[Wo],spacing:["px",wn],text:[Wo],"text-shadow":[Wo],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ea,Ot,It,b]}],container:["container"],"container-type":[{"@container":["","normal","size",It,Ot]}],"container-named":[H3],columns:[{columns:[wn,Ot,It,a]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:x()}],"inset-x":[{"inset-x":x()}],"inset-y":[{"inset-y":x()}],start:[{"inset-s":x(),start:x()}],end:[{"inset-e":x(),end:x()}],"inset-bs":[{"inset-bs":x()}],"inset-be":[{"inset-be":x()}],top:[{top:x()}],right:[{right:x()}],bottom:[{bottom:x()}],left:[{left:x()}],visibility:["visible","invisible","collapse"],z:[{z:[co,"auto",It,Ot]}],basis:[{basis:[Ea,"full","auto",a,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[wn,Ea,"auto","initial","none",Ot]}],grow:[{grow:["",wn,It,Ot]}],shrink:[{shrink:["",wn,It,Ot]}],order:[{order:[co,"first","last","none",It,Ot]}],"grid-cols":[{"grid-cols":C()}],"col-start-end":[{col:R()}],"col-start":[{"col-start":N()}],"col-end":[{"col-end":N()}],"grid-rows":[{"grid-rows":C()}],"row-start-end":[{row:R()}],"row-start":[{"row-start":N()}],"row-end":[{"row-end":N()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":B()}],"auto-rows":[{"auto-rows":B()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...z(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...z()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":z()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:P()}],px:[{px:P()}],py:[{py:P()}],ps:[{ps:P()}],pe:[{pe:P()}],pbs:[{pbs:P()}],pbe:[{pbe:P()}],pt:[{pt:P()}],pr:[{pr:P()}],pb:[{pb:P()}],pl:[{pl:P()}],m:[{m:X()}],mx:[{mx:X()}],my:[{my:X()}],ms:[{ms:X()}],me:[{me:X()}],mbs:[{mbs:X()}],mbe:[{mbe:X()}],mt:[{mt:X()}],mr:[{mr:X()}],mb:[{mb:X()}],ml:[{ml:X()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:G()}],"inline-size":[{inline:["auto",...Z()]}],"min-inline-size":[{"min-inline":["auto",...Z()]}],"max-inline-size":[{"max-inline":["none",...Z()]}],"block-size":[{block:["auto",...oe()]}],"min-block-size":[{"min-block":["auto",...oe()]}],"max-block-size":[{"max-block":["none",...oe()]}],w:[{w:[a,"screen",...G()]}],"min-w":[{"min-w":[a,"screen","none",...G()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...G()]}],h:[{h:["screen","lh",...G()]}],"min-h":[{"min-h":["screen","lh","none",...G()]}],"max-h":[{"max-h":["screen","lh",...G()]}],"font-size":[{text:["base",n,bd,yl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Q3,$3]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",A0,Ot]}],"font-family":[{font:[K3,G3,e]}],"font-features":[{"font-features":[Ot]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,It,Ot]}],"line-clamp":[{"line-clamp":[wn,"none",It,Fw]}],leading:[{leading:[s,...P()]}],"list-image":[{"list-image":["none",It,Ot]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",It,Ot]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:K()}],"text-color":[{text:K()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Be(),"wavy"]}],"text-decoration-thickness":[{decoration:[wn,"from-font","auto",It,yl]}],"text-decoration-color":[{decoration:K()}],"underline-offset":[{"underline-offset":[wn,"auto",It,Ot]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"tab-size":[{tab:[co,It,Ot]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",It,Ot]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",It,Ot]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:q()}],"bg-repeat":[{bg:W()}],"bg-size":[{bg:J()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},co,It,Ot],radial:["",It,Ot],conic:[co,It,Ot]},Z3,Y3]}],"bg-color":[{bg:K()}],"gradient-from-pos":[{from:fe()}],"gradient-via-pos":[{via:fe()}],"gradient-to-pos":[{to:fe()}],"gradient-from":[{from:K()}],"gradient-via":[{via:K()}],"gradient-to":[{to:K()}],rounded:[{rounded:$()}],"rounded-s":[{"rounded-s":$()}],"rounded-e":[{"rounded-e":$()}],"rounded-t":[{"rounded-t":$()}],"rounded-r":[{"rounded-r":$()}],"rounded-b":[{"rounded-b":$()}],"rounded-l":[{"rounded-l":$()}],"rounded-ss":[{"rounded-ss":$()}],"rounded-se":[{"rounded-se":$()}],"rounded-ee":[{"rounded-ee":$()}],"rounded-es":[{"rounded-es":$()}],"rounded-tl":[{"rounded-tl":$()}],"rounded-tr":[{"rounded-tr":$()}],"rounded-br":[{"rounded-br":$()}],"rounded-bl":[{"rounded-bl":$()}],"border-w":[{border:de()}],"border-w-x":[{"border-x":de()}],"border-w-y":[{"border-y":de()}],"border-w-s":[{"border-s":de()}],"border-w-e":[{"border-e":de()}],"border-w-bs":[{"border-bs":de()}],"border-w-be":[{"border-be":de()}],"border-w-t":[{"border-t":de()}],"border-w-r":[{"border-r":de()}],"border-w-b":[{"border-b":de()}],"border-w-l":[{"border-l":de()}],"divide-x":[{"divide-x":de()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":de()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Be(),"hidden","none"]}],"divide-style":[{divide:[...Be(),"hidden","none"]}],"border-color":[{border:K()}],"border-color-x":[{"border-x":K()}],"border-color-y":[{"border-y":K()}],"border-color-s":[{"border-s":K()}],"border-color-e":[{"border-e":K()}],"border-color-bs":[{"border-bs":K()}],"border-color-be":[{"border-be":K()}],"border-color-t":[{"border-t":K()}],"border-color-r":[{"border-r":K()}],"border-color-b":[{"border-b":K()}],"border-color-l":[{"border-l":K()}],"divide-color":[{divide:K()}],"outline-style":[{outline:[...Be(),"none","hidden"]}],"outline-offset":[{"outline-offset":[wn,It,Ot]}],"outline-w":[{outline:["",wn,bd,yl]}],"outline-color":[{outline:K()}],shadow:[{shadow:["","none",u,bp,vp]}],"shadow-color":[{shadow:K()}],"inset-shadow":[{"inset-shadow":["none",f,bp,vp]}],"inset-shadow-color":[{"inset-shadow":K()}],"ring-w":[{ring:de()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:K()}],"ring-offset-w":[{"ring-offset":[wn,yl]}],"ring-offset-color":[{"ring-offset":K()}],"inset-ring-w":[{"inset-ring":de()}],"inset-ring-color":[{"inset-ring":K()}],"text-shadow":[{"text-shadow":["none",h,bp,vp]}],"text-shadow-color":[{"text-shadow":K()}],opacity:[{opacity:[wn,It,Ot]}],"mix-blend":[{"mix-blend":[...wt(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":wt()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[wn]}],"mask-image-linear-from-pos":[{"mask-linear-from":Je()}],"mask-image-linear-to-pos":[{"mask-linear-to":Je()}],"mask-image-linear-from-color":[{"mask-linear-from":K()}],"mask-image-linear-to-color":[{"mask-linear-to":K()}],"mask-image-t-from-pos":[{"mask-t-from":Je()}],"mask-image-t-to-pos":[{"mask-t-to":Je()}],"mask-image-t-from-color":[{"mask-t-from":K()}],"mask-image-t-to-color":[{"mask-t-to":K()}],"mask-image-r-from-pos":[{"mask-r-from":Je()}],"mask-image-r-to-pos":[{"mask-r-to":Je()}],"mask-image-r-from-color":[{"mask-r-from":K()}],"mask-image-r-to-color":[{"mask-r-to":K()}],"mask-image-b-from-pos":[{"mask-b-from":Je()}],"mask-image-b-to-pos":[{"mask-b-to":Je()}],"mask-image-b-from-color":[{"mask-b-from":K()}],"mask-image-b-to-color":[{"mask-b-to":K()}],"mask-image-l-from-pos":[{"mask-l-from":Je()}],"mask-image-l-to-pos":[{"mask-l-to":Je()}],"mask-image-l-from-color":[{"mask-l-from":K()}],"mask-image-l-to-color":[{"mask-l-to":K()}],"mask-image-x-from-pos":[{"mask-x-from":Je()}],"mask-image-x-to-pos":[{"mask-x-to":Je()}],"mask-image-x-from-color":[{"mask-x-from":K()}],"mask-image-x-to-color":[{"mask-x-to":K()}],"mask-image-y-from-pos":[{"mask-y-from":Je()}],"mask-image-y-to-pos":[{"mask-y-to":Je()}],"mask-image-y-from-color":[{"mask-y-from":K()}],"mask-image-y-to-color":[{"mask-y-to":K()}],"mask-image-radial":[{"mask-radial":[It,Ot]}],"mask-image-radial-from-pos":[{"mask-radial-from":Je()}],"mask-image-radial-to-pos":[{"mask-radial-to":Je()}],"mask-image-radial-from-color":[{"mask-radial-from":K()}],"mask-image-radial-to-color":[{"mask-radial-to":K()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":S()}],"mask-image-conic-pos":[{"mask-conic":[wn]}],"mask-image-conic-from-pos":[{"mask-conic-from":Je()}],"mask-image-conic-to-pos":[{"mask-conic-to":Je()}],"mask-image-conic-from-color":[{"mask-conic-from":K()}],"mask-image-conic-to-color":[{"mask-conic-to":K()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:q()}],"mask-repeat":[{mask:W()}],"mask-size":[{mask:J()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",It,Ot]}],filter:[{filter:["","none",It,Ot]}],blur:[{blur:Ue()}],brightness:[{brightness:[wn,It,Ot]}],contrast:[{contrast:[wn,It,Ot]}],"drop-shadow":[{"drop-shadow":["","none",p,bp,vp]}],"drop-shadow-color":[{"drop-shadow":K()}],grayscale:[{grayscale:["",wn,It,Ot]}],"hue-rotate":[{"hue-rotate":[wn,It,Ot]}],invert:[{invert:["",wn,It,Ot]}],saturate:[{saturate:[wn,It,Ot]}],sepia:[{sepia:["",wn,It,Ot]}],"backdrop-filter":[{"backdrop-filter":["","none",It,Ot]}],"backdrop-blur":[{"backdrop-blur":Ue()}],"backdrop-brightness":[{"backdrop-brightness":[wn,It,Ot]}],"backdrop-contrast":[{"backdrop-contrast":[wn,It,Ot]}],"backdrop-grayscale":[{"backdrop-grayscale":["",wn,It,Ot]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[wn,It,Ot]}],"backdrop-invert":[{"backdrop-invert":["",wn,It,Ot]}],"backdrop-opacity":[{"backdrop-opacity":[wn,It,Ot]}],"backdrop-saturate":[{"backdrop-saturate":[wn,It,Ot]}],"backdrop-sepia":[{"backdrop-sepia":["",wn,It,Ot]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":P()}],"border-spacing-x":[{"border-spacing-x":P()}],"border-spacing-y":[{"border-spacing-y":P()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",It,Ot]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[wn,"initial",It,Ot]}],ease:[{ease:["linear","initial",y,It,Ot]}],delay:[{delay:[wn,It,Ot]}],animate:[{animate:["none",_,It,Ot]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,It,Ot]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:ke()}],"rotate-x":[{"rotate-x":ke()}],"rotate-y":[{"rotate-y":ke()}],"rotate-z":[{"rotate-z":ke()}],scale:[{scale:ct()}],"scale-x":[{"scale-x":ct()}],"scale-y":[{"scale-y":ct()}],"scale-z":[{"scale-z":ct()}],"scale-3d":["scale-3d"],skew:[{skew:Ee()}],"skew-x":[{"skew-x":Ee()}],"skew-y":[{"skew-y":Ee()}],transform:[{transform:[It,Ot,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ve()}],"translate-x":[{"translate-x":Ve()}],"translate-y":[{"translate-y":Ve()}],"translate-z":[{"translate-z":Ve()}],"translate-none":["translate-none"],zoom:[{zoom:[co,It,Ot]}],accent:[{accent:K()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:K()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",It,Ot]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":K()}],"scrollbar-track-color":[{"scrollbar-track":K()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mbs":[{"scroll-mbs":P()}],"scroll-mbe":[{"scroll-mbe":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pbs":[{"scroll-pbs":P()}],"scroll-pbe":[{"scroll-pbe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",It,Ot]}],fill:[{fill:["none",...K()]}],"stroke-w":[{stroke:[wn,bd,yl,Fw]}],stroke:[{stroke:["none",...K()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},eP=(t,{cacheSize:e,prefix:n,experimentalParseClassName:r,extend:i={},override:s={}})=>(Hc(t,"cacheSize",e),Hc(t,"prefix",n),Hc(t,"experimentalParseClassName",r),yp(t.theme,s.theme),yp(t.classGroups,s.classGroups),yp(t.conflictingClassGroups,s.conflictingClassGroups),yp(t.conflictingClassGroupModifiers,s.conflictingClassGroupModifiers),Hc(t,"postfixLookupClassGroups",s.postfixLookupClassGroups),Hc(t,"orderSensitiveModifiers",s.orderSensitiveModifiers),wp(t.theme,i.theme),wp(t.classGroups,i.classGroups),wp(t.conflictingClassGroups,i.conflictingClassGroups),wp(t.conflictingClassGroupModifiers,i.conflictingClassGroupModifiers),Pv(t,i,"postfixLookupClassGroups"),Pv(t,i,"orderSensitiveModifiers"),t),Hc=(t,e,n)=>{n!==void 0&&(t[e]=n)},yp=(t,e)=>{if(e)for(const n in e)Hc(t,n,e[n])},wp=(t,e)=>{if(e)for(const n in e)Pv(t,e,n)},Pv=(t,e,n)=>{const r=e[n];r!==void 0&&(t[n]=t[n]?t[n].concat(r):r)},tP=(t,...e)=>typeof t=="function"?Ev(Av,t,...e):Ev(()=>eP(Av(),t),...e),ak=Ev(Av);function ss(...t){return ak(tf(t))}function xp(t){if(!t)return"never";const e=Date.now()-new Date(t).getTime();if(e<0)return"just now";const n=Math.floor(e/1e3);if(n<60)return`${n}s ago`;const r=Math.floor(n/60);if(r<60)return`${r}m ago`;const i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function zl(t,e=36){if(t.length<=e)return t;const n=Math.floor((e-1)/2);return`${t.slice(0,n)}${t.slice(-n)}`}function YW(t,e=300){let n;return((...r)=>{clearTimeout(n),n=setTimeout(()=>t(...r),e)})}var nP=new Set(["$$slots","$$events","$$legacy","ref","value","type","files","class","data-slot"]),Uw=ne("<input/>");function Ww(t,e){Tt(e,!0);let n=te(e,"ref",15,null),r=te(e,"value",15),i=te(e,"files",15),s=te(e,"data-slot",3,"input"),o=ht(e,nP);var a=qe(),l=Me(a);{var c=f=>{var h=Uw();_r(h,p=>({"data-slot":s(),class:p,type:"file",...o}),[()=>ss("dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 h-9 rounded-md border bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] file:h-7 file:text-sm file:font-medium focus-visible:ring-3 aria-invalid:ring-3 md:text-sm file:text-foreground placeholder:text-muted-foreground w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",e.class)],void 0,void 0,void 0,!0),kr(h,p=>n(p),()=>n()),r3(h,i),kv(h,r),A(f,h)},u=f=>{var h=Uw();_r(h,p=>({"data-slot":s(),class:p,type:e.type,...o}),[()=>ss("dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 h-9 rounded-md border bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] file:h-7 file:text-sm file:font-medium focus-visible:ring-3 aria-invalid:ring-3 md:text-sm file:text-foreground placeholder:text-muted-foreground w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",e.class)],void 0,void 0,void 0,!0),kr(h,p=>n(p),()=>n()),kv(h,r),A(f,h)};xe(l,f=>{e.type==="file"?f(c):f(u,-1)})}A(t,a),Et()}function rP(t){return typeof t=="function"}function Xh(t){return t!==null&&typeof t=="object"}const iP=["string","number","bigint","boolean"];function Cv(t){return t==null||iP.includes(typeof t)?!0:Array.isArray(t)?t.every(e=>Cv(e)):typeof t=="object"?Object.getPrototypeOf(t)===Object.prototype:!1}const ju=Symbol("box"),Wm=Symbol("is-writable");function st(t,e){const n=V(t);return e?{[ju]:!0,[Wm]:!0,get current(){return d(n)},set current(r){e(r)}}:{[ju]:!0,get current(){return t()}}}function Zh(t){return Xh(t)&&ju in t}function w1(t){return Zh(t)&&Wm in t}function lk(t){return Zh(t)?t:rP(t)?st(t):Gs(t)}function sP(t){return Object.entries(t).reduce((e,[n,r])=>Zh(r)?(w1(r)?Object.defineProperty(e,n,{get(){return r.current},set(i){r.current=i}}):Object.defineProperty(e,n,{get(){return r.current}}),e):Object.assign(e,{[n]:r}),{})}function oP(t){return w1(t)?{[ju]:!0,get current(){return t.current}}:t}function Gs(t){let e=Se(gn(t));return{[ju]:!0,[Wm]:!0,get current(){return d(e)},set current(n){I(e,n,!0)}}}function pc(t){let e=Se(gn(t));return{[ju]:!0,[Wm]:!0,get current(){return d(e)},set current(n){I(e,n,!0)}}}pc.from=lk;pc.with=st;pc.flatten=sP;pc.readonly=oP;pc.isBox=Zh;pc.isWritableBox=w1;function ck(...t){return function(e){var n;for(const r of t)if(r){if(e.defaultPrevented)return;typeof r=="function"?r.call(this,e):(n=r.current)==null||n.call(this,e)}}}var qw=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,aP=/\n/g,lP=/^\s*/,cP=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,uP=/^:\s*/,dP=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,fP=/^[;\s]*/,hP=/^\s+|\s+$/g,pP=`
`,Hw="/",Vw="*",Pl="",gP="comment",mP="declaration";function vP(t,e){if(typeof t!="string")throw new TypeError("First argument must be a string");if(!t)return[];e=e||{};var n=1,r=1;function i(g){var m=g.match(aP);m&&(n+=m.length);var b=g.lastIndexOf(pP);r=~b?g.length-b:r+g.length}function s(){var g={line:n,column:r};return function(m){return m.position=new o(g),c(),m}}function o(g){this.start=g,this.end={line:n,column:r},this.source=e.source}o.prototype.content=t;function a(g){var m=new Error(e.source+":"+n+":"+r+": "+g);if(m.reason=g,m.filename=e.source,m.line=n,m.column=r,m.source=t,!e.silent)throw m}function l(g){var m=g.exec(t);if(m){var b=m[0];return i(b),t=t.slice(b.length),m}}function c(){l(lP)}function u(g){var m;for(g=g||[];m=f();)m!==!1&&g.push(m);return g}function f(){var g=s();if(!(Hw!=t.charAt(0)||Vw!=t.charAt(1))){for(var m=2;Pl!=t.charAt(m)&&(Vw!=t.charAt(m)||Hw!=t.charAt(m+1));)++m;if(m+=2,Pl===t.charAt(m-1))return a("End of comment missing");var b=t.slice(2,m-2);return r+=2,i(b),t=t.slice(m),r+=2,g({type:gP,comment:b})}}function h(){var g=s(),m=l(cP);if(m){if(f(),!l(uP))return a("property missing ':'");var b=l(dP),y=g({type:mP,property:$w(m[0].replace(qw,Pl)),value:b?$w(b[0].replace(qw,Pl)):Pl});return l(fP),y}}function p(){var g=[];u(g);for(var m;m=h();)m!==!1&&(g.push(m),u(g));return g}return c(),p()}function $w(t){return t?t.replace(hP,Pl):Pl}function bP(t,e){let n=null;if(!t||typeof t!="string")return n;const r=vP(t),i=typeof e=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:a}=s;i?e(o,a,s):a&&(n=n||{},n[o]=a)}),n}const yP=/\d/,wP=["-","_","/","."];function xP(t=""){if(!yP.test(t))return t!==t.toLowerCase()}function _P(t){const e=[];let n="",r,i;for(const s of t){const o=wP.includes(s);if(o===!0){e.push(n),n="",r=void 0;continue}const a=xP(s);if(i===!1){if(r===!1&&a===!0){e.push(n),n=s,r=a;continue}if(r===!0&&a===!1&&n.length>1){const l=n.at(-1);e.push(n.slice(0,Math.max(0,n.length-1))),n=l+s,r=a;continue}}n+=s,r=a,i=o}return e.push(n),e}function uk(t){return t?_P(t).map(e=>kP(e)).join(""):""}function SP(t){return MP(uk(t||""))}function kP(t){return t?t[0].toUpperCase()+t.slice(1):""}function MP(t){return t?t[0].toLowerCase()+t.slice(1):""}function jd(t){if(!t)return{};const e={};function n(r,i){if(r.startsWith("-moz-")||r.startsWith("-webkit-")||r.startsWith("-ms-")||r.startsWith("-o-")){e[uk(r)]=i;return}if(r.startsWith("--")){e[r]=i;return}e[SP(r)]=i}return bP(t,n),e}function tu(...t){return(...e)=>{for(const n of t)typeof n=="function"&&n(...e)}}function TP(t,e){const n=RegExp(t,"g");return r=>{if(typeof r!="string")throw new TypeError(`expected an argument of type string, but got ${typeof r}`);return r.match(n)?r.replace(n,e):r}}const EP=TP(/[A-Z]/,t=>`-${t.toLowerCase()}`);function AP(t){if(!t||typeof t!="object"||Array.isArray(t))throw new TypeError(`expected an argument of type object, but got ${typeof t}`);return Object.keys(t).map(e=>`${EP(e)}: ${t[e]};`).join(`
`)}function dk(t={}){return AP(t).replace(`
`," ")}const PP=["onabort","onanimationcancel","onanimationend","onanimationiteration","onanimationstart","onauxclick","onbeforeinput","onbeforetoggle","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncompositionend","oncompositionstart","oncompositionupdate","oncontextlost","oncontextmenu","oncontextrestored","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onfocusin","onfocusout","onformdata","ongotpointercapture","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onlostpointercapture","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onpaste","onpause","onplay","onplaying","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointermove","onpointerout","onpointerover","onpointerup","onprogress","onratechange","onreset","onresize","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onselectionchange","onselectstart","onslotchange","onstalled","onsubmit","onsuspend","ontimeupdate","ontoggle","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontransitioncancel","ontransitionend","ontransitionrun","ontransitionstart","onvolumechange","onwaiting","onwebkitanimationend","onwebkitanimationiteration","onwebkitanimationstart","onwebkittransitionend","onwheel"],CP=new Set(PP);function OP(t){return CP.has(t)}function Ci(...t){const e={...t[0]};for(let n=1;n<t.length;n++){const r=t[n];if(r){for(const i of Object.keys(r)){const s=e[i],o=r[i],a=typeof s=="function",l=typeof o=="function";if(a&&OP(i)){const c=s,u=o;e[i]=ck(c,u)}else if(a&&l)e[i]=tu(s,o);else if(i==="class"){const c=Cv(s),u=Cv(o);c&&u?e[i]=tf(s,o):c?e[i]=tf(s):u&&(e[i]=tf(o))}else if(i==="style"){const c=typeof s=="object",u=typeof o=="object",f=typeof s=="string",h=typeof o=="string";if(c&&u)e[i]={...s,...o};else if(c&&h){const p=jd(o);e[i]={...s,...p}}else if(f&&u){const p=jd(s);e[i]={...p,...o}}else if(f&&h){const p=jd(s),g=jd(o);e[i]={...p,...g}}else c?e[i]=s:u?e[i]=o:f?e[i]=s:h&&(e[i]=o)}else e[i]=o!==void 0?o:s}for(const i of Object.getOwnPropertySymbols(r)){const s=e[i],o=r[i];e[i]=o!==void 0?o:s}}}return typeof e.style=="object"&&(e.style=dk(e.style).replaceAll(`
`," ")),e.hidden===!1&&(e.hidden=void 0,delete e.hidden),e.disabled===!1&&(e.disabled=void 0,delete e.disabled),e}const fk=typeof window<"u"?window:void 0;function RP(t){let e=t.activeElement;for(;e!=null&&e.shadowRoot;){const n=e.shadowRoot.activeElement;if(n===e)break;e=n}return e}var wo,xo,Yo,am,Ys,Ud,Zp;const Iy=class Iy extends Map{constructor(n){super();Y(this,Ys);Y(this,wo,new Map);Y(this,xo,Se(0));Y(this,Yo,Se(0));Y(this,am,ua||-1);if(n){for(var[r,i]of n)super.set(r,i);v(this,Yo).v=super.size}}has(n){var r=v(this,wo),i=r.get(n);if(i===void 0)if(super.has(n))i=ze(this,Ys,Ud).call(this,0),r.set(n,i);else return d(v(this,xo)),!1;return d(i),!0}forEach(n,r){ze(this,Ys,Zp).call(this),super.forEach(n,r)}get(n){var r=v(this,wo),i=r.get(n);if(i===void 0)if(super.has(n))i=ze(this,Ys,Ud).call(this,0),r.set(n,i);else{d(v(this,xo));return}return d(i),super.get(n)}set(n,r){var f;var i=v(this,wo),s=i.get(n),o=super.get(n),a=super.set(n,r),l=v(this,xo);if(s===void 0)s=ze(this,Ys,Ud).call(this,0),i.set(n,s),I(v(this,Yo),super.size),So(l);else if(o!==r){So(s);var c=l.reactions===null?null:new Set(l.reactions),u=c===null||!((f=s.reactions)!=null&&f.every(h=>c.has(h)));u&&So(l)}return a}delete(n){var r=v(this,wo),i=r.get(n),s=super.delete(n);return i!==void 0&&(r.delete(n),I(i,-1)),s&&(I(v(this,Yo),super.size),So(v(this,xo))),s}clear(){if(super.size!==0){super.clear();var n=v(this,wo);I(v(this,Yo),0);for(var r of n.values())I(r,-1);So(v(this,xo)),n.clear()}}keys(){return d(v(this,xo)),super.keys()}values(){return ze(this,Ys,Zp).call(this),super.values()}entries(){return ze(this,Ys,Zp).call(this),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return d(v(this,Yo)),super.size}};wo=new WeakMap,xo=new WeakMap,Yo=new WeakMap,am=new WeakMap,Ys=new WeakSet,Ud=function(n){return ua===v(this,am)?Se(n):Io(n)},Zp=function(){d(v(this,xo));var n=v(this,wo);if(v(this,Yo).v!==n.size){for(var r of bw(Iy.prototype,this,"keys").call(this))if(!n.has(r)){var i=ze(this,Ys,Ud).call(this,0);n.set(r,i)}}for([,i]of v(this,wo))d(i)};let Ov=Iy;var pu,Ef,I2;let NP=(I2=class{constructor(e={}){Y(this,pu);Y(this,Ef);const{window:n=fk,document:r=n==null?void 0:n.document}=e;n!==void 0&&(ye(this,pu,r),ye(this,Ef,Bm(i=>{const s=Ar(n,"focusin",i),o=Ar(n,"focusout",i);return()=>{s(),o()}})))}get current(){var e;return(e=v(this,Ef))==null||e.call(this),v(this,pu)?RP(v(this,pu)):null}},pu=new WeakMap,Ef=new WeakMap,I2);new NP;function IP(t){return typeof t=="function"}var Af,Ko,z2;let pl=(z2=class{constructor(e){Y(this,Af);Y(this,Ko);ye(this,Af,e),ye(this,Ko,Symbol(e))}get key(){return v(this,Ko)}exists(){return i1(v(this,Ko))}get(){const e=Fu(v(this,Ko));if(e===void 0)throw new Error(`Context "${v(this,Af)}" not found`);return e}getOr(e){const n=Fu(v(this,Ko));return n===void 0?e:n}set(e){return Dm(v(this,Ko),e)}},Af=new WeakMap,Ko=new WeakMap,z2);function zP(t,e){switch(t){case"post":Qt(e);break;case"pre":h1(e);break}}function hk(t,e,n,r={}){const{lazy:i=!1}=r;let s=!i,o=Array.isArray(t)?[]:void 0;zP(e,()=>{const a=Array.isArray(t)?t.map(c=>c()):t();if(!s){s=!0,o=a;return}const l=br(()=>n(a,o));return o=a,l})}function Jr(t,e,n){hk(t,"post",e,n)}function LP(t,e,n){hk(t,"pre",e,n)}Jr.pre=LP;function Gw(t){return IP(t)?t():t}var Ua,gu,mu,vu,Wa,lm,cm,bu;class DP{constructor(e,n={box:"border-box"}){Y(this,Ua,{width:0,height:0});Y(this,gu,!1);Y(this,mu);Y(this,vu);Y(this,Wa);Y(this,lm,V(()=>{var e;return(e=d(v(this,bu)))==null||e(),this.getSize().width}));Y(this,cm,V(()=>{var e;return(e=d(v(this,bu)))==null||e(),this.getSize().height}));Y(this,bu,V(()=>{const e=Gw(v(this,vu));if(e)return Bm(n=>{if(!v(this,Wa))return;const r=new(v(this,Wa)).ResizeObserver(i=>{ye(this,gu,!0);for(const s of i){const o=v(this,mu).box==="content-box"?s.contentBoxSize:s.borderBoxSize,a=Array.isArray(o)?o:[o];v(this,Ua).width=a.reduce((l,c)=>Math.max(l,c.inlineSize),0),v(this,Ua).height=a.reduce((l,c)=>Math.max(l,c.blockSize),0)}n()});return r.observe(e),()=>{ye(this,gu,!1),r.disconnect()}})}));ye(this,Wa,n.window??fk),ye(this,mu,n),ye(this,vu,e),ye(this,Ua,{width:0,height:0})}calculateSize(){const e=Gw(v(this,vu));if(!e||!v(this,Wa))return;const n=e.offsetWidth,r=e.offsetHeight;if(v(this,mu).box==="border-box")return{width:n,height:r};const i=v(this,Wa).getComputedStyle(e),s=parseFloat(i.paddingLeft)+parseFloat(i.paddingRight),o=parseFloat(i.paddingTop)+parseFloat(i.paddingBottom),a=parseFloat(i.borderLeftWidth)+parseFloat(i.borderRightWidth),l=parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth),c=n-s-a,u=r-o-l;return{width:c,height:u}}getSize(){return v(this,gu)?v(this,Ua):this.calculateSize()??v(this,Ua)}get current(){var e;return(e=d(v(this,bu)))==null||e(),this.getSize()}get width(){return d(v(this,lm))}get height(){return d(v(this,cm))}}Ua=new WeakMap,gu=new WeakMap,mu=new WeakMap,vu=new WeakMap,Wa=new WeakMap,lm=new WeakMap,cm=new WeakMap,bu=new WeakMap;function wa(t){Qt(()=>()=>{t()})}function FP(t,e){return setTimeout(e,t)}function _s(t){uf().then(t)}const BP=1,jP=9,UP=11;function Rv(t){return Xh(t)&&t.nodeType===BP&&typeof t.nodeName=="string"}function pk(t){return Xh(t)&&t.nodeType===jP}function WP(t){var e;return Xh(t)&&((e=t.constructor)==null?void 0:e.name)==="VisualViewport"}function qP(t){return Xh(t)&&t.nodeType!==void 0}function gk(t){return qP(t)&&t.nodeType===UP&&"host"in t}function HP(t,e){var r;if(!t||!e||!Rv(t)||!Rv(e))return!1;const n=(r=e.getRootNode)==null?void 0:r.call(e);if(t===e||t.contains(e))return!0;if(n&&gk(n)){let i=e;for(;i;){if(t===i)return!0;i=i.parentNode||i.host}}return!1}function Qh(t){return pk(t)?t:WP(t)?t.document:(t==null?void 0:t.ownerDocument)??document}function wg(t){var e;return gk(t)?wg(t.host):pk(t)?t.defaultView??window:Rv(t)?((e=t.ownerDocument)==null?void 0:e.defaultView)??window:window}function VP(t){let e=t.activeElement;for(;e!=null&&e.shadowRoot;){const n=e.shadowRoot.activeElement;if(n===e)break;e=n}return e}var Pf;class x1{constructor(e){we(this,"element");Y(this,Pf,V(()=>this.element.current?this.element.current.getRootNode()??document:document));we(this,"getDocument",()=>Qh(this.root));we(this,"getWindow",()=>this.getDocument().defaultView??window);we(this,"getActiveElement",()=>VP(this.root));we(this,"isActiveElement",e=>e===this.getActiveElement());we(this,"querySelector",e=>this.root?this.root.querySelector(e):null);we(this,"querySelectorAll",e=>this.root?this.root.querySelectorAll(e):[]);we(this,"setTimeout",(e,n)=>this.getWindow().setTimeout(e,n));we(this,"clearTimeout",e=>this.getWindow().clearTimeout(e));typeof e=="function"?this.element=st(e):this.element=e}get root(){return d(v(this,Pf))}set root(e){I(v(this,Pf),e)}getElementById(e){return this.root.getElementById(e)}}Pf=new WeakMap;function ns(t,e){return{[AA()]:n=>Zh(t)?(t.current=n,br(()=>e==null?void 0:e(n)),()=>{"isConnected"in n&&n.isConnected||(t.current=null,e==null||e(null))}):(t(n),br(()=>e==null?void 0:e(n)),()=>{"isConnected"in n&&n.isConnected||(t(null),e==null||e(null))})}}function _1(t){return t?"true":"false"}function $P(t){return t?"true":void 0}function Jh(t){return t?"":void 0}function ZW(t){return t?!0:void 0}function rd(t){return t?"open":"closed"}function QW(t){return t?"checked":"unchecked"}function mk(t){return t==="starting"?{"data-starting-style":""}:t==="ending"?{"data-ending-style":""}:{}}function JW(t,e){return e?"mixed":t?"true":"false"}var yu,Cf;class GP{constructor(e){Y(this,yu);Y(this,Cf);we(this,"attrs");ye(this,yu,e.getVariant?e.getVariant():null),ye(this,Cf,v(this,yu)?`data-${v(this,yu)}-`:`data-${e.component}-`),this.getAttr=this.getAttr.bind(this),this.selector=this.selector.bind(this),this.attrs=Object.fromEntries(e.parts.map(n=>[n,this.getAttr(n)]))}getAttr(e,n){return n?`data-${n}-${e}`:`${v(this,Cf)}${e}`}selector(e,n){return`[${this.getAttr(e,n)}]`}}yu=new WeakMap,Cf=new WeakMap;function qm(t){const e=new GP(t);return{...e.attrs,selector:e.selector,getAttr:e.getAttr}}const xg="ArrowDown",ep="ArrowLeft",tp="ArrowRight",_g="ArrowUp",vk="End",bk="Enter",YP="Escape",yk="Home",KP="PageDown",XP="PageUp",Hm=" ",ZP="Tab";function QP(t){return window.getComputedStyle(t).getPropertyValue("direction")}function JP(t="ltr",e="horizontal"){return{horizontal:t==="rtl"?ep:tp,vertical:xg}[e]}function eC(t="ltr",e="horizontal"){return{horizontal:t==="rtl"?tp:ep,vertical:_g}[e]}function tC(t="ltr",e="horizontal"){return["ltr","rtl"].includes(t)||(t="ltr"),["horizontal","vertical"].includes(e)||(e="horizontal"),{nextKey:JP(t,e),prevKey:eC(t,e)}}const wk=typeof document<"u",Yw=nC();function nC(){var t,e;return wk&&((t=window==null?void 0:window.navigator)==null?void 0:t.userAgent)&&(/iP(ad|hone|od)/.test(window.navigator.userAgent)||((e=window==null?void 0:window.navigator)==null?void 0:e.maxTouchPoints)>2&&/iPad|Macintosh/.test(window==null?void 0:window.navigator.userAgent))}function va(t){return t instanceof HTMLElement}function nf(t){return t instanceof Element}function xk(t){return t instanceof Element||t instanceof SVGElement}function rC(t){return t!==null}function iC(t){return t instanceof HTMLInputElement&&"select"in t}var ui,Xo;class sC{constructor(e){Y(this,ui);Y(this,Xo,pc(null));ye(this,ui,e)}getCandidateNodes(){return v(this,ui).rootNode.current?v(this,ui).candidateSelector?Array.from(v(this,ui).rootNode.current.querySelectorAll(v(this,ui).candidateSelector)):v(this,ui).candidateAttr?Array.from(v(this,ui).rootNode.current.querySelectorAll(`[${v(this,ui).candidateAttr}]:not([data-disabled])`)):[]:[]}focusFirstCandidate(){var n;const e=this.getCandidateNodes();e.length&&((n=e[0])==null||n.focus())}handleKeydown(e,n,r=!1){var g,m;const i=v(this,ui).rootNode.current;if(!i||!e)return;const s=this.getCandidateNodes();if(!s.length)return;const o=s.indexOf(e),a=QP(i),{nextKey:l,prevKey:c}=tC(a,v(this,ui).orientation.current),u=v(this,ui).loop.current,f={[l]:o+1,[c]:o-1,[yk]:0,[vk]:s.length-1};if(r){const b=l===xg?tp:xg,y=c===_g?ep:_g;f[b]=o+1,f[y]=o-1}let h=f[n.key];if(h===void 0)return;n.preventDefault(),h<0&&u?h=s.length-1:h===s.length&&u&&(h=0);const p=s[h];if(p)return p.focus(),v(this,Xo).current=p.id,(m=(g=v(this,ui)).onCandidateFocus)==null||m.call(g,p),p}getTabIndex(e){const n=this.getCandidateNodes(),r=v(this,Xo).current!==null;return e&&!r&&n[0]===e?(v(this,Xo).current=e.id,0):(e==null?void 0:e.id)===v(this,Xo).current?0:-1}setCurrentTabStopId(e){v(this,Xo).current=e}focusCurrentTabStop(){var r;const e=v(this,Xo).current;if(!e)return;const n=(r=v(this,ui).rootNode.current)==null?void 0:r.querySelector(`#${e}`);!n||!va(n)||n.focus()}}ui=new WeakMap,Xo=new WeakMap;var Ul,_o,Zo,Qo,dl,Nv,Iv;class oC{constructor(e){Y(this,dl);Y(this,Ul);Y(this,_o,null);Y(this,Zo,null);Y(this,Qo,0);ye(this,Ul,e),wa(()=>ze(this,dl,Nv).call(this))}run(e){ze(this,dl,Nv).call(this);const n=v(this,Ul).ref.current;if(!n)return;if(typeof n.getAnimations!="function"){ze(this,dl,Iv).call(this,e);return}const r=v(this,Qo),i=()=>{r===v(this,Qo)&&ze(this,dl,Iv).call(this,e)},s=()=>{if(r!==v(this,Qo))return;const a=n.getAnimations();if(a.length===0){i();return}Promise.all(a.map(l=>l.finished)).then(()=>{i()}).catch(()=>{if(r!==v(this,Qo))return;if(n.getAnimations().some(u=>u.pending||u.playState!=="finished")){s();return}i()})},o=()=>{ye(this,_o,window.requestAnimationFrame(()=>{ye(this,_o,null),s()}))};if(!v(this,Ul).afterTick.current){o();return}ye(this,_o,window.requestAnimationFrame(()=>{ye(this,_o,null);const a="data-starting-style";if(!n.hasAttribute(a)){o();return}ye(this,Zo,new MutationObserver(()=>{var l;r===v(this,Qo)&&(n.hasAttribute(a)||((l=v(this,Zo))==null||l.disconnect(),ye(this,Zo,null),o()))})),v(this,Zo).observe(n,{attributes:!0,attributeFilter:[a]})}))}}Ul=new WeakMap,_o=new WeakMap,Zo=new WeakMap,Qo=new WeakMap,dl=new WeakSet,Nv=function(){var e;v(this,_o)!==null&&(window.cancelAnimationFrame(v(this,_o)),ye(this,_o,null)),(e=v(this,Zo))==null||e.disconnect(),ye(this,Zo,null),vw(this,Qo)._++},Iv=function(e){const n=()=>{e()};v(this,Ul).afterTick?_s(n):n()};var zi,Of,Rf,Jo,ea,Nf,qa,If,zv;class _k{constructor(e){Y(this,If);Y(this,zi);Y(this,Of);Y(this,Rf);Y(this,Jo,Se(!1));Y(this,ea,Se(void 0));Y(this,Nf,!1);Y(this,qa,null);ye(this,zi,e),I(v(this,Jo),e.open.current,!0),ye(this,Of,e.enabled??!0),ye(this,Rf,new oC({ref:v(this,zi).ref,afterTick:v(this,zi).open})),wa(()=>ze(this,If,zv).call(this)),Jr(()=>v(this,zi).open.current,n=>{var r,i,s,o,a,l;if(!v(this,Nf)){ye(this,Nf,!0);return}if(ze(this,If,zv).call(this),!n&&((i=(r=v(this,zi)).shouldSkipExitAnimation)!=null&&i.call(r))){I(v(this,Jo),!1),I(v(this,ea),void 0),(o=(s=v(this,zi)).onComplete)==null||o.call(s);return}if(n&&I(v(this,Jo),!0),I(v(this,ea),n?"starting":"ending",!0),n&&ye(this,qa,window.requestAnimationFrame(()=>{ye(this,qa,null),v(this,zi).open.current&&I(v(this,ea),void 0)})),!v(this,Of)){n||I(v(this,Jo),!1),I(v(this,ea),void 0),(l=(a=v(this,zi)).onComplete)==null||l.call(a);return}v(this,Rf).run(()=>{var c,u;n===v(this,zi).open.current&&(v(this,zi).open.current||I(v(this,Jo),!1),I(v(this,ea),void 0),(u=(c=v(this,zi)).onComplete)==null||u.call(c))})})}get shouldRender(){return d(v(this,Jo))}get transitionStatus(){return d(v(this,ea))}}zi=new WeakMap,Of=new WeakMap,Rf=new WeakMap,Jo=new WeakMap,ea=new WeakMap,Nf=new WeakMap,qa=new WeakMap,If=new WeakSet,zv=function(){v(this,qa)!==null&&(window.cancelAnimationFrame(v(this,qa)),ye(this,qa,null))};function vr(){}function gc(t,e){return`bits-${t}`}function aC(t,e){var n=qe(),r=Me(n);FS(r,()=>e.children,i=>{var s=qe(),o=Me(s);Zt(o,()=>e.children??an),A(i,s)}),A(t,n)}const lC=new pl("BitsConfig");function cC(){const t=new uC(null,{});return lC.getOr(t).opts}class uC{constructor(e,n){we(this,"opts");const r=dC(e,n);this.opts={defaultPortalTo:r(i=>i.defaultPortalTo),defaultLocale:r(i=>i.defaultLocale)}}}function dC(t,e){return n=>st(()=>{var s,o;const i=(s=n(e))==null?void 0:s.current;if(i!==void 0)return i;if(t!==null)return(o=n(t.opts))==null?void 0:o.current})}function fC(t,e){return n=>{const r=cC();return st(()=>{const i=n();if(i!==void 0)return i;const s=t(r).current;return s!==void 0?s:e})}}const hC=fC(t=>t.defaultPortalTo,"body");function pC(t,e){Tt(e,!0);const n=hC(()=>e.to),r=ZE();let i=V(s);function s(){if(!wk||e.disabled)return null;let f=null;return typeof n.current=="string"?f=document.querySelector(n.current):f=n.current,f}let o;function a(){o&&(BA(o),o=null)}Jr([()=>d(i),()=>e.disabled],([f,h])=>{if(!f||h){a();return}return o=DS(aC,{target:f,props:{children:e.children},context:r}),()=>{a()}});var l=qe(),c=Me(l);{var u=f=>{var h=qe(),p=Me(h);Zt(p,()=>e.children??an),A(f,h)};xe(c,f=>{e.disabled&&f(u)})}A(t,l),Et()}class gC{constructor(e,n={bubbles:!0,cancelable:!0}){we(this,"eventName");we(this,"options");this.eventName=e,this.options=n}createEvent(e){return new CustomEvent(this.eventName,{...this.options,detail:e})}dispatch(e,n){const r=this.createEvent(n);return e.dispatchEvent(r),r}listen(e,n,r){const i=s=>{n(s)};return Ar(e,this.eventName,i,r)}}function Kw(t,e=500){let n=null;const r=(...i)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{t(...i)},e)};return r.destroy=()=>{n!==null&&(clearTimeout(n),n=null)},r}function Sk(t,e){return t===e||t.contains(e)}function kk(t){return(t==null?void 0:t.ownerDocument)??document}function mC(t,e){const{clientX:n,clientY:r}=t,i=e.getBoundingClientRect();return n<i.left||n>i.right||r<i.top||r>i.bottom}const Lv=[bk,Hm],vC=[xg,XP,yk],Mk=[_g,KP,vk],bC=[...vC,...Mk],yC={ltr:[...Lv,tp],rtl:[...Lv,ep]},eq={ltr:[ep],rtl:[tp]};function Si(t){return t.pointerType==="mouse"}function wC(t,{select:e=!1}={}){if(!t||!t.focus)return;const n=Qh(t);if(n.activeElement===t)return;const r=n.activeElement;t.focus({preventScroll:!0}),t!==r&&iC(t)&&e&&t.select()}function xC(t,{select:e=!1}={},n){const r=n();for(const i of t)if(wC(i,{select:e}),n()!==r)return!0}let yd=Se(!1);const fs=class fs{constructor(){Qt(()=>(fs._refs===0&&(fs._cleanup=wS(()=>{const e=[],n=i=>{I(yd,!1)},r=i=>{I(yd,!0)};return e.push(Ar(document,"pointerdown",n,{capture:!0}),Ar(document,"pointermove",n,{capture:!0}),Ar(document,"keydown",r,{capture:!0})),tu(...e)})),fs._refs++,()=>{var e;fs._refs--,fs._refs===0&&(I(yd,!1),(e=fs._cleanup)==null||e.call(fs))}))}get current(){return d(yd)}set current(e){I(yd,e,!0)}};we(fs,"_refs",0),we(fs,"_cleanup");let Dv=fs;/*!
* tabbable 6.5.0
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
*/var Tk=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","area[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],Sg=Tk.join(","),Ek=typeof Element>"u",nc=Ek?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,kg=!Ek&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t==null?void 0:t.ownerDocument},Mg=function(e,n){var r;n===void 0&&(n=!0);var i=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),s=i===""||i==="true",o=s||n&&e&&(typeof e.closest=="function"?e.closest("[inert]"):Mg(e.parentNode));return o},_C=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},Ak=function(e,n,r){if(Mg(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(Sg));return n&&nc.call(e,Sg)&&i.unshift(e),i=i.filter(r),i},Tg=function(e,n,r){for(var i=[],s=Array.from(e);s.length;){var o=s.shift();if(!Mg(o,!1))if(o.tagName==="SLOT"){var a=o.assignedElements(),l=a.length?a:o.children,c=Tg(l,!0,r);r.flatten?i.push.apply(i,c):i.push({scopeParent:o,candidates:c})}else{var u=nc.call(o,Sg);u&&r.filter(o)&&(n||!e.includes(o))&&i.push(o);var f=o.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(o),h=!Mg(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(o));if(f&&h){var p=Tg(f===!0?o.children:f.children,!0,r);r.flatten?i.push.apply(i,p):i.push({scopeParent:o,candidates:p})}else s.unshift.apply(s,o.children)}}return i},Pk=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Ck=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||_C(e))&&!Pk(e)?0:e.tabIndex},SC=function(e,n){var r=Ck(e);return r<0&&n&&!Pk(e)?0:r},kC=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},Ok=function(e){return e.tagName==="INPUT"},MC=function(e){return Ok(e)&&e.type==="hidden"},TC=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},EC=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},AC=function(e){if(!e.name)return!0;var n=e.form||kg(e),r=function(a){return n.querySelectorAll('input[type="radio"][name="'+a+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=r(window.CSS.escape(e.name));else try{i=r(e.name)}catch(o){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",o.message),!1}var s=EC(i,e.form);return!s||s===e},PC=function(e){return Ok(e)&&e.type==="radio"},CC=function(e){return PC(e)&&!AC(e)},OC=function(e){var n,r=e&&kg(e),i=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==e){var o,a,l;for(s=!!((o=i)!==null&&o!==void 0&&(a=o.ownerDocument)!==null&&a!==void 0&&a.contains(i)||e!=null&&(l=e.ownerDocument)!==null&&l!==void 0&&l.contains(e));!s&&i;){var c,u,f;r=kg(i),i=(c=r)===null||c===void 0?void 0:c.host,s=!!((u=i)!==null&&u!==void 0&&(f=u.ownerDocument)!==null&&f!==void 0&&f.contains(i))}}return s},Xw=function(e){var n=e.getBoundingClientRect(),r=n.width,i=n.height;return r===0&&i===0},RC=function(e,n){var r=n.displayCheck,i=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in e){var s=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}var o=getComputedStyle(e),a=o.visibility;if(a==="hidden"||a==="collapse")return!0;var l=nc.call(e,"details>summary:first-of-type"),c=l?e.parentElement:e;if(nc.call(c,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof i=="function"){for(var u=e;e;){var f=e.parentElement,h=kg(e);if(f&&!f.shadowRoot&&i(f)===!0)return Xw(e);e.assignedSlot?e=e.assignedSlot:!f&&h!==e.ownerDocument?e=h.host:e=f}e=u}if(OC(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Xw(e);return!1},NC=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var i=n.children.item(r);if(i.tagName==="LEGEND")return nc.call(n,"fieldset[disabled] *")?!0:!i.contains(e)}return!0}n=n.parentElement}return!1},Eg=function(e,n){return!(n.disabled||MC(n)||RC(n,e)||TC(n)||NC(n))},Fv=function(e,n){return!(CC(n)||Ck(n)<0||!Eg(e,n))},IC=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Rk=function(e){var n=[],r=[];return e.forEach(function(i,s){var o=!!i.scopeParent,a=o?i.scopeParent:i,l=SC(a,o),c=o?Rk(i.candidates):a;l===0?o?n.push.apply(n,c):n.push(a):r.push({documentOrder:s,tabIndex:l,item:i,isScope:o,content:c})}),r.sort(kC).reduce(function(i,s){return s.isScope?i.push.apply(i,s.content):i.push(s.content),i},[]).concat(n)},Nk=function(e,n){n=n||{};var r;return n.getShadowRoot?r=Tg([e],n.includeContainer,{filter:Fv.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:IC}):r=Ak(e,n.includeContainer,Fv.bind(null,n)),Rk(r)},Ik=function(e,n){n=n||{};var r;return n.getShadowRoot?r=Tg([e],n.includeContainer,{filter:Eg.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=Ak(e,n.includeContainer,Eg.bind(null,n)),r},S1=function(e,n){if(n=n||{},!e)throw new Error("No node provided");return nc.call(e,Sg)===!1?!1:Fv(n,e)},zC=Tk.concat("iframe:not([inert]):not([inert] *)").join(","),zk=function(e,n){if(n=n||{},!e)throw new Error("No node provided");return nc.call(e,zC)===!1?!1:Eg(n,e)};function rf(){return{getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"}}function LC(t,e){if(!S1(t,rf()))return DC(t,e);const n=Qh(t),r=Nk(n.body,rf());e==="prev"&&r.reverse();const i=r.indexOf(t);return i===-1?n.body:r.slice(i+1)[0]}function DC(t,e){const n=Qh(t);if(!zk(t,rf()))return n.body;const r=Ik(n.body,rf());e==="prev"&&r.reverse();const i=r.indexOf(t);return i===-1?n.body:r.slice(i+1).find(o=>S1(o,rf()))??n.body}function tq(t,e){return t>=0&&t<e.length}function nq(t,e,n=!0){if(!(t.length===0||e<0||e>=t.length))return t.length===1&&e===0?t[0]:e===t.length-1?n?t[0]:void 0:t[e+1]}function rq(t,e,n=!0){if(!(t.length===0||e<0||e>=t.length))return t.length===1&&e===0?t[0]:e===0?n?t[t.length-1]:void 0:t[e-1]}function iq(t,e,n,r=!0){if(t.length===0||e<0||e>=t.length)return;let i=e+n;return r?i=(i%t.length+t.length)%t.length:i=Math.max(0,Math.min(i,t.length-1)),t[i]}function sq(t,e,n,r=!0){if(t.length===0||e<0||e>=t.length)return;let i=e-n;return r?i=(i%t.length+t.length)%t.length:i=Math.max(0,Math.min(i,t.length-1)),t[i]}function Lk(t,e,n){const r=e.toLowerCase();if(r.endsWith(" ")){const f=r.slice(0,-1);if(t.filter(m=>m.toLowerCase().startsWith(f)).length<=1)return Lk(t,f,n);const p=n==null?void 0:n.toLowerCase();if(p&&p.startsWith(f)&&p.charAt(f.length)===" "&&e.trim()===f)return n;const g=t.filter(m=>m.toLowerCase().startsWith(r));if(g.length>0){const m=n?t.indexOf(n):-1;return Zw(g,Math.max(m,0)).find(_=>_!==n)||n}}const s=e.length>1&&Array.from(e).every(f=>f===e[0])?e[0]:e,o=s.toLowerCase(),a=n?t.indexOf(n):-1;let l=Zw(t,Math.max(a,0));s.length===1&&(l=l.filter(f=>f!==n));const u=l.find(f=>f==null?void 0:f.toLowerCase().startsWith(o));return u!==n?u:void 0}function Zw(t,e){return t.map((n,r)=>t[(e+r)%t.length])}const FC={afterMs:1e4,onChange:vr};function BC(t,e){const{afterMs:n,onChange:r,getWindow:i}={...FC,...e};let s=null,o=Se(gn(t));function a(){return i().setTimeout(()=>{I(o,t,!0),r==null||r(t)},n)}return Qt(()=>()=>{s&&i().clearTimeout(s)}),st(()=>d(o),l=>{I(o,l,!0),r==null||r(l),s&&i().clearTimeout(s),s=a()})}var ta,na,um,dm;class jC{constructor(e){Y(this,ta);Y(this,na);Y(this,um,V(()=>v(this,ta).onMatch?v(this,ta).onMatch:e=>e.focus()));Y(this,dm,V(()=>v(this,ta).getCurrentItem?v(this,ta).getCurrentItem:v(this,ta).getActiveElement));ye(this,ta,e),ye(this,na,BC("",{afterMs:1e3,getWindow:e.getWindow})),this.handleTypeaheadSearch=this.handleTypeaheadSearch.bind(this),this.resetTypeahead=this.resetTypeahead.bind(this)}handleTypeaheadSearch(e,n){var l,c;if(!n.length)return;v(this,na).current=v(this,na).current+e;const r=d(v(this,dm))(),i=((c=(l=n.find(u=>u===r))==null?void 0:l.textContent)==null?void 0:c.trim())??"",s=n.map(u=>{var f;return((f=u.textContent)==null?void 0:f.trim())??""}),o=Lk(s,v(this,na).current,i),a=n.find(u=>{var f;return((f=u.textContent)==null?void 0:f.trim())===o});return a&&d(v(this,um))(a),a}resetTypeahead(){v(this,na).current=""}get search(){return v(this,na).current}}ta=new WeakMap,na=new WeakMap,um=new WeakMap,dm=new WeakMap;const k1="data-context-menu-trigger",UC="data-context-menu-content",Dk=new pl("Menu.Root"),Uu=new pl("Menu.Root | Menu.Sub"),M1=new pl("Menu.Content"),Fk=new gC("bitsmenuopen",{bubbles:!1,cancelable:!0}),WC=qm({component:"menu",parts:["trigger","content","sub-trigger","item","group","group-heading","checkbox-group","checkbox-item","radio-group","radio-item","separator","sub-content","arrow"]});var mr,Wl,Ha,Li,bs,ql,ra,wu,qt,Bk,Qp,Bv,jv,Uv,Va,Wd,Jp,qd,eg,jk,zf,Uk,tg,ng,Vc,rg;class qC{constructor(e){Y(this,qt);Y(this,mr);Y(this,Wl,null);Y(this,Ha,null);Y(this,Li,!1);Y(this,bs,null);Y(this,ql,null);Y(this,ra,null);Y(this,wu,null);Y(this,Va,null);Y(this,zf,e=>{if(!v(this,Li)||!v(this,bs)||!Si(e))return;const n=v(this,mr).triggerNode(),r=v(this,mr).contentNode();if(!n||!r){ze(this,qt,qd).call(this);return}ze(this,qt,Vc).call(this);const i={x:e.clientX,y:e.clientY};ye(this,ra,i);const s=n.getBoundingClientRect(),o=r.getBoundingClientRect();if(v(this,bs)==="content"&&Jw(i,o)){ze(this,qt,Wd).call(this);return}if(v(this,bs)==="trigger"&&HC(i,s,4)){ze(this,qt,Wd).call(this);return}if(ze(this,qt,jk).call(this,i)){ze(this,qt,ng).call(this);return}const a=ze(this,qt,Qp).call(this,i,v(this,bs));if(!a){ze(this,qt,qd).call(this);return}if(ze(this,qt,Bv).call(this,i,a.corridor,a.intent)){ze(this,qt,ng).call(this);return}ze(this,qt,qd).call(this)});ye(this,mr,e),Jr([e.triggerNode,e.contentNode,e.enabled],([n,r,i])=>{if(ze(this,qt,eg).call(this),!n||!r||!i)return;const s=f=>{Si(f)&&(ye(this,wu,{x:f.clientX,y:f.clientY}),v(this,Li)||ze(this,qt,jv).call(this,f,"content"))},o=f=>{Si(f)&&ze(this,qt,Uv).call(this,f,"content")},a=f=>{Si(f)&&(v(this,Li)||ze(this,qt,jv).call(this,f,"trigger"))},l=f=>{if(Si(f)){if(nf(f.relatedTarget)){const h=v(this,mr).subContentSelector(),p=f.relatedTarget.closest(h);if(p&&p!==r&&p.id&&!!r.querySelector(`[aria-controls="${p.id}"]`))return}ze(this,qt,Uv).call(this,f,"trigger")}},c=f=>{Si(f)&&ze(this,qt,Wd).call(this)},u=f=>{Si(f)&&ze(this,qt,Wd).call(this)};return n.addEventListener("pointermove",s),n.addEventListener("pointerleave",o),n.addEventListener("pointerenter",c),r.addEventListener("pointermove",a),r.addEventListener("pointerleave",l),r.addEventListener("pointerenter",u),()=>{n.removeEventListener("pointermove",s),n.removeEventListener("pointerleave",o),n.removeEventListener("pointerenter",c),r.removeEventListener("pointermove",a),r.removeEventListener("pointerleave",l),r.removeEventListener("pointerenter",u),ze(this,qt,eg).call(this)}}),wa(()=>{ze(this,qt,eg).call(this)})}}mr=new WeakMap,Wl=new WeakMap,Ha=new WeakMap,Li=new WeakMap,bs=new WeakMap,ql=new WeakMap,ra=new WeakMap,wu=new WeakMap,qt=new WeakSet,Bk=function(){var n;const e=v(this,mr).parentContentNode();return e?e.getBoundingClientRect():((n=v(this,mr).triggerNode())==null?void 0:n.getBoundingClientRect())??null},Qp=function(e,n){const r=v(this,mr).triggerNode(),i=v(this,mr).contentNode();if(!r||!i)return null;const s=r.getBoundingClientRect(),o=i.getBoundingClientRect(),a=VC(s,o);let l,c,u;return n==="content"?(l=v(this,Li)?v(this,ql)??e:e,c=o):(l=v(this,wu)??e,c=ze(this,qt,Bk).call(this)??s,u=o),ye(this,ql,l),{corridor:$C(s,o,a),intent:GC(l,c,a,n,u),targetRect:c,side:a}},Bv=function(e,n,r){return Qw(e,n)||Qw(e,r)},jv=function(e,n){const r={x:e.clientX,y:e.clientY};ze(this,qt,Qp).call(this,r,n)&&(ye(this,bs,n),ye(this,ra,r))},Uv=function(e,n){if(!v(this,mr).enabled())return;const r=v(this,mr).triggerNode(),i=v(this,mr).contentNode();if(!r||!i)return;const s=e.relatedTarget;if(nf(s)&&(n==="content"&&i.contains(s)||n==="trigger"&&r.contains(s)))return;const o={x:e.clientX,y:e.clientY},a=ze(this,qt,Qp).call(this,o,n);if(a){if(!Jw(o,a.targetRect)&&!ze(this,qt,Bv).call(this,o,a.corridor,a.intent)){ze(this,qt,rg).call(this);return}ye(this,Li,!0),ye(this,bs,n),ye(this,ra,o),v(this,mr).setIsPointerInTransit(!0),ze(this,qt,Uk).call(this),ze(this,qt,ng).call(this)}},Va=new WeakMap,Wd=function(){if(!v(this,Li))return;const e=v(this,bs)==="trigger";ze(this,qt,tg).call(this),ze(this,qt,Vc).call(this),ye(this,Li,!1),ze(this,qt,rg).call(this),e?(ze(this,qt,Jp).call(this),ye(this,Va,setTimeout(()=>{ye(this,Va,null),v(this,mr).setIsPointerInTransit(!1)},100))):v(this,mr).setIsPointerInTransit(!1)},Jp=function(){v(this,Va)!==null&&(clearTimeout(v(this,Va)),ye(this,Va,null))},qd=function(){const e=v(this,ra);ze(this,qt,tg).call(this),ze(this,qt,Vc).call(this),ze(this,qt,Jp).call(this),ye(this,Li,!1),v(this,mr).setIsPointerInTransit(!1),ze(this,qt,rg).call(this),v(this,mr).onIntentExit(e)},eg=function(){ze(this,qt,tg).call(this),ze(this,qt,Vc).call(this),ze(this,qt,Jp).call(this),v(this,Li)&&v(this,mr).setIsPointerInTransit(!1),ye(this,Li,!1),ye(this,bs,null),ye(this,ql,null),ye(this,ra,null),ye(this,wu,null)},jk=function(e){const n=v(this,mr).contentNode();if(!n)return!1;const i=n.ownerDocument.elementFromPoint(e.x,e.y);if(!i)return!1;const s=v(this,mr).subContentSelector(),o=i.closest(s);return!o||o===n?!1:o.id?!!n.querySelector(`[aria-controls="${o.id}"]`):!1},zf=new WeakMap,Uk=function(){if(v(this,Wl))return;const e=Qh(v(this,mr).triggerNode()??v(this,mr).contentNode());e&&(e.addEventListener("pointermove",v(this,zf),!0),ye(this,Wl,()=>{e.removeEventListener("pointermove",v(this,zf),!0),ye(this,Wl,null)}))},tg=function(){var e;(e=v(this,Wl))==null||e.call(this)},ng=function(){ze(this,qt,Vc).call(this),ye(this,Ha,setTimeout(()=>{ye(this,Ha,null),v(this,Li)&&ze(this,qt,qd).call(this)},500))},Vc=function(){v(this,Ha)!==null&&(clearTimeout(v(this,Ha)),ye(this,Ha,null))},rg=function(){ye(this,bs,null),ye(this,ql,null),ye(this,ra,null)};function Qw(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,o=e.length-1;s<e.length;o=s++){const a=e[s].x,l=e[s].y,c=e[o].x,u=e[o].y;l>r!=u>r&&n<(c-a)*(r-l)/(u-l)+a&&(i=!i)}return i}function Jw(t,e){return t.x>=e.left&&t.x<=e.right&&t.y>=e.top&&t.y<=e.bottom}function HC(t,e,n){return t.x>=e.left+n&&t.x<=e.right-n&&t.y>=e.top+n&&t.y<=e.bottom-n}function VC(t,e){const n=t.left+t.width/2,r=t.top+t.height/2,i=e.left+e.width/2,s=e.top+e.height/2,o=i-n,a=s-r;return Math.abs(o)>Math.abs(a)?o>0?"right":"left":a>0?"bottom":"top"}function $C(t,e,n){switch(n){case"top":return[{x:Math.min(t.left,e.left)-2,y:t.top},{x:Math.min(t.left,e.left)-2,y:e.bottom},{x:Math.max(t.right,e.right)+2,y:e.bottom},{x:Math.max(t.right,e.right)+2,y:t.top}];case"bottom":return[{x:Math.min(t.left,e.left)-2,y:t.bottom},{x:Math.min(t.left,e.left)-2,y:e.top},{x:Math.max(t.right,e.right)+2,y:e.top},{x:Math.max(t.right,e.right)+2,y:t.bottom}];case"left":return[{x:t.left,y:Math.min(t.top,e.top)-2},{x:e.right,y:Math.min(t.top,e.top)-2},{x:e.right,y:Math.max(t.bottom,e.bottom)+2},{x:t.left,y:Math.max(t.bottom,e.bottom)+2}];case"right":return[{x:t.right,y:Math.min(t.top,e.top)-2},{x:e.left,y:Math.min(t.top,e.top)-2},{x:e.left,y:Math.max(t.bottom,e.bottom)+2},{x:t.right,y:Math.max(t.bottom,e.bottom)+2}]}}function GC(t,e,n,r,i){const o=r==="trigger"?YC(n):n,a=i?Math.min(e.top,i.top)-8:e.top-8,l=i?Math.max(e.bottom,i.bottom)+8:e.bottom+8,c=i?Math.min(e.left,i.left)-8:e.left-8,u=i?Math.max(e.right,i.right)+8:e.right+8;switch(o){case"right":return[t,{x:e.left,y:a},{x:e.left,y:l}];case"left":return[t,{x:e.right,y:a},{x:e.right,y:l}];case"bottom":return[t,{x:c,y:e.top},{x:u,y:e.top}];case"top":return[t,{x:c,y:e.bottom},{x:u,y:e.bottom}]}}function YC(t){switch(t){case"top":return"bottom";case"bottom":return"top";case"left":return"right";case"right":return"left"}}var Lf,Df;const zy=class zy{constructor(e){we(this,"opts");we(this,"isUsingKeyboard",new Dv);Y(this,Lf,Se(!1));Y(this,Df,Se(!1));we(this,"getBitsAttr",e=>WC.getAttr(e,this.opts.variant.current));this.opts=e}static create(e){const n=new zy(e);return Dk.set(n)}get ignoreCloseAutoFocus(){return d(v(this,Lf))}set ignoreCloseAutoFocus(e){I(v(this,Lf),e,!0)}get isPointerInTransit(){return d(v(this,Df))}set isPointerInTransit(e){I(v(this,Df),e,!0)}};Lf=new WeakMap,Df=new WeakMap;let Wv=zy;var Ff,Bf;const Ly=class Ly{constructor(e,n,r){we(this,"opts");we(this,"root");we(this,"parentMenu");we(this,"contentId",st(()=>""));Y(this,Ff,Se(null));we(this,"contentPresence");Y(this,Bf,Se(null));this.opts=e,this.root=n,this.parentMenu=r,this.contentPresence=new _k({ref:st(()=>this.contentNode),open:this.opts.open,onComplete:()=>{this.opts.onOpenChangeComplete.current(this.opts.open.current)},shouldSkipExitAnimation:()=>{var i,s;return this.root.opts.variant.current!=="menubar"||this.parentMenu!==null?!1:((s=(i=this.root.opts).shouldSkipExitAnimation)==null?void 0:s.call(i))??!1}}),r&&Jr(()=>r.opts.open.current,()=>{r.opts.open.current||(this.opts.open.current=!1)})}static create(e,n){return Uu.set(new Ly(e,n,null))}get contentNode(){return d(v(this,Ff))}set contentNode(e){I(v(this,Ff),e,!0)}get triggerNode(){return d(v(this,Bf))}set triggerNode(e){I(v(this,Bf),e,!0)}toggleOpen(){this.opts.open.current=!this.opts.open.current}onOpen(){this.opts.open.current=!0}onClose(){this.opts.open.current=!1}};Ff=new WeakMap,Bf=new WeakMap;let Ag=Ly;var jf,Uf,Wf,qf,Hf,No,Wk,ig,qk,Vf,$f;const Dy=class Dy{constructor(e,n){Y(this,No);we(this,"opts");we(this,"parentMenu");we(this,"rovingFocusGroup");we(this,"domContext");we(this,"attachment");Y(this,jf,Se(""));Y(this,Uf,0);Y(this,Wf);Y(this,qf,Se(!1));Y(this,Hf);we(this,"onCloseAutoFocus",e=>{var n,r;if((r=(n=this.opts.onCloseAutoFocus).current)==null||r.call(n,e),!(e.defaultPrevented||v(this,Hf))){if(this.parentMenu.root.ignoreCloseAutoFocus){e.preventDefault();return}this.parentMenu.triggerNode&&S1(this.parentMenu.triggerNode)&&(e.preventDefault(),this.parentMenu.triggerNode.focus())}});Y(this,Vf,V(()=>({open:this.parentMenu.opts.open.current})));Y(this,$f,V(()=>({id:this.opts.id.current,role:"menu","aria-orientation":"vertical",[this.parentMenu.root.getBitsAttr("content")]:"","data-state":rd(this.parentMenu.opts.open.current),...mk(this.parentMenu.contentPresence.transitionStatus),onkeydown:this.onkeydown,onblur:this.onblur,onfocus:this.onfocus,dir:this.parentMenu.root.opts.dir.current,style:{pointerEvents:"auto",contain:"layout style"},...this.attachment})));we(this,"popperProps",{onCloseAutoFocus:e=>this.onCloseAutoFocus(e)});this.opts=e,this.parentMenu=n,this.domContext=new x1(e.ref),this.attachment=ns(this.opts.ref,r=>{this.parentMenu.contentNode!==r&&(this.parentMenu.contentNode=r)}),n.contentId=e.id,ye(this,Hf,e.isSub??!1),this.onkeydown=this.onkeydown.bind(this),this.onblur=this.onblur.bind(this),this.onfocus=this.onfocus.bind(this),this.handleInteractOutside=this.handleInteractOutside.bind(this),new qC({contentNode:()=>this.parentMenu.contentNode,triggerNode:()=>this.parentMenu.triggerNode,parentContentNode:()=>{var r;return((r=this.parentMenu.parentMenu)==null?void 0:r.contentNode)??null},subContentSelector:()=>`[${this.parentMenu.root.getBitsAttr("sub-content")}]`,enabled:()=>{var r;return this.parentMenu.opts.open.current&&!!((r=this.parentMenu.triggerNode)!=null&&r.hasAttribute(this.parentMenu.root.getBitsAttr("sub-trigger")))},onIntentExit:r=>{this.parentMenu.opts.open.current=!1,ze(this,No,qk).call(this,r)},setIsPointerInTransit:r=>{this.parentMenu.root.isPointerInTransit=r}}),ye(this,Wf,new jC({getActiveElement:()=>this.domContext.getActiveElement(),getWindow:()=>this.domContext.getWindow()}).handleTypeaheadSearch),this.rovingFocusGroup=new sC({rootNode:st(()=>this.parentMenu.contentNode),candidateAttr:this.parentMenu.root.getBitsAttr("item"),loop:this.opts.loop,orientation:st(()=>"vertical")}),Jr(()=>this.parentMenu.contentNode,r=>{if(!r)return;const i=()=>{_s(()=>{this.parentMenu.root.isUsingKeyboard.current&&this.rovingFocusGroup.focusFirstCandidate()})};return Fk.listen(r,i)}),Qt(()=>{this.parentMenu.opts.open.current||this.domContext.getWindow().clearTimeout(v(this,Uf))})}static create(e){return M1.set(new Dy(e,Uu.get()))}get search(){return d(v(this,jf))}set search(e){I(v(this,jf),e,!0)}get mounted(){return d(v(this,qf))}set mounted(e){I(v(this,qf),e,!0)}handleTabKeyDown(e){let n=this.parentMenu;for(;n.parentMenu!==null;)n=n.parentMenu;if(!n.triggerNode)return;e.preventDefault();const r=LC(n.triggerNode,e.shiftKey?"prev":"next");r?(this.parentMenu.root.ignoreCloseAutoFocus=!0,n.onClose(),_s(()=>{r.focus(),_s(()=>{this.parentMenu.root.ignoreCloseAutoFocus=!1})})):this.domContext.getDocument().body.focus()}onkeydown(e){var c,u;if(e.defaultPrevented)return;if(e.key===ZP){this.handleTabKeyDown(e);return}const n=e.target,r=e.currentTarget;if(!va(n)||!va(r))return;const i=((c=n.closest(`[${this.parentMenu.root.getBitsAttr("content")}]`))==null?void 0:c.id)===this.parentMenu.contentId.current,s=e.ctrlKey||e.altKey||e.metaKey,o=e.key.length===1;if(this.rovingFocusGroup.handleKeydown(n,e)||e.code==="Space")return;const l=ze(this,No,Wk).call(this);i&&!s&&o&&v(this,Wf).call(this,e.key,l),((u=e.target)==null?void 0:u.id)===this.parentMenu.contentId.current&&bC.includes(e.key)&&(e.preventDefault(),Mk.includes(e.key)&&l.reverse(),xC(l,{select:!1},()=>this.domContext.getActiveElement()))}onblur(e){var n,r;nf(e.currentTarget)&&nf(e.target)&&((r=(n=e.currentTarget).contains)!=null&&r.call(n,e.target)||(this.domContext.getWindow().clearTimeout(v(this,Uf)),this.search=""))}onfocus(e){this.parentMenu.root.isUsingKeyboard.current&&_s(()=>this.rovingFocusGroup.focusFirstCandidate())}onItemEnter(){return ze(this,No,ig).call(this)}onItemLeave(e){if(e.currentTarget.hasAttribute(this.parentMenu.root.getBitsAttr("sub-trigger"))||ze(this,No,ig).call(this)||this.parentMenu.root.isUsingKeyboard.current)return;const n=this.parentMenu.contentNode;n==null||n.focus({preventScroll:!0}),this.rovingFocusGroup.setCurrentTabStopId("")}onTriggerLeave(){return!!ze(this,No,ig).call(this)}handleInteractOutside(e){var r;if(!xk(e.target))return;const n=(r=this.parentMenu.triggerNode)==null?void 0:r.id;if(e.target.id===n){e.preventDefault();return}if(e.target.closest(`#${n}`)){e.preventDefault();return}this.parentMenu.root.ignoreCloseAutoFocus=!0,_s(()=>{this.parentMenu.root.ignoreCloseAutoFocus=!1})}get shouldRender(){return this.parentMenu.contentPresence.shouldRender}get snippetProps(){return d(v(this,Vf))}set snippetProps(e){I(v(this,Vf),e)}get props(){return d(v(this,$f))}set props(e){I(v(this,$f),e)}};jf=new WeakMap,Uf=new WeakMap,Wf=new WeakMap,qf=new WeakMap,Hf=new WeakMap,No=new WeakSet,Wk=function(){const e=this.parentMenu.contentNode;return e?Array.from(e.querySelectorAll(`[${this.parentMenu.root.getBitsAttr("item")}]:not([data-disabled])`)):[]},ig=function(){return this.parentMenu.root.isPointerInTransit},qk=function(e){var s;if(!e)return;const n=(s=this.parentMenu.parentMenu)==null?void 0:s.contentNode;if(!n)return;const r=this.domContext.getDocument().elementFromPoint(e.x,e.y);if(!nf(r))return;const i=r.closest(`[${this.parentMenu.root.getBitsAttr("sub-trigger")}]`);!i||!n.contains(i)||i!==this.parentMenu.triggerNode&&i.dispatchEvent(new PointerEvent("pointermove",{bubbles:!0,cancelable:!0,pointerType:"mouse",clientX:e.x,clientY:e.y}))},Vf=new WeakMap,$f=new WeakMap;let qv=Dy;var xu,Gf;class Hk{constructor(e,n){we(this,"opts");we(this,"content");we(this,"attachment");Y(this,xu,Se(!1));Y(this,Gf,V(()=>({id:this.opts.id.current,tabindex:-1,role:"menuitem","aria-disabled":_1(this.opts.disabled.current),"data-disabled":Jh(this.opts.disabled.current),"data-highlighted":d(v(this,xu))?"":void 0,[this.content.parentMenu.root.getBitsAttr("item")]:"",onpointermove:this.onpointermove,onpointerleave:this.onpointerleave,onfocus:this.onfocus,onblur:this.onblur,...this.attachment})));this.opts=e,this.content=n,this.attachment=ns(this.opts.ref),this.onpointermove=this.onpointermove.bind(this),this.onpointerleave=this.onpointerleave.bind(this),this.onfocus=this.onfocus.bind(this),this.onblur=this.onblur.bind(this)}onpointermove(e){if(!e.defaultPrevented&&Si(e))if(this.opts.disabled.current)this.content.onItemLeave(e);else{if(this.content.onItemEnter())return;const r=e.currentTarget;if(!va(r))return;r.focus({preventScroll:!0})}}onpointerleave(e){e.defaultPrevented||Si(e)&&this.content.onItemLeave(e)}onfocus(e){_s(()=>{e.defaultPrevented||this.opts.disabled.current||I(v(this,xu),!0)})}onblur(e){_s(()=>{e.defaultPrevented||I(v(this,xu),!1)})}get props(){return d(v(this,Gf))}set props(e){I(v(this,Gf),e)}}xu=new WeakMap,Gf=new WeakMap;var Yf,fm,Vk,Kf;const Fy=class Fy{constructor(e,n){Y(this,fm);we(this,"opts");we(this,"item");we(this,"root");Y(this,Yf,!1);Y(this,Kf,V(()=>Ci(this.item.props,{onclick:this.onclick,onpointerdown:this.onpointerdown,onpointerup:this.onpointerup,onkeydown:this.onkeydown})));this.opts=e,this.item=n,this.root=n.content.parentMenu.root,this.onkeydown=this.onkeydown.bind(this),this.onclick=this.onclick.bind(this),this.onpointerdown=this.onpointerdown.bind(this),this.onpointerup=this.onpointerup.bind(this)}static create(e){const n=new Hk(e,M1.get());return new Fy(e,n)}onkeydown(e){const n=this.item.content.search!=="";if(!(this.item.opts.disabled.current||n&&e.key===Hm)&&Lv.includes(e.key)){if(!va(e.currentTarget))return;e.currentTarget.click(),e.preventDefault()}}onclick(e){this.item.opts.disabled.current||ze(this,fm,Vk).call(this)}onpointerup(e){var n;if(!e.defaultPrevented&&!v(this,Yf)){if(!va(e.currentTarget))return;(n=e.currentTarget)==null||n.click()}}onpointerdown(e){ye(this,Yf,!0)}get props(){return d(v(this,Kf))}set props(e){I(v(this,Kf),e)}};Yf=new WeakMap,fm=new WeakSet,Vk=function(){if(this.item.opts.disabled.current)return;const e=new CustomEvent("menuitemselect",{bubbles:!0,cancelable:!0});if(this.opts.onSelect.current(e),e.defaultPrevented){this.item.content.parentMenu.root.isUsingKeyboard.current=!1;return}this.opts.closeOnSelect.current&&this.item.content.parentMenu.root.opts.onClose()},Kf=new WeakMap;let Hv=Fy;var ia,$a,$c,Xf;const By=class By{constructor(e,n,r,i){Y(this,$a);we(this,"opts");we(this,"item");we(this,"content");we(this,"submenu");we(this,"attachment");Y(this,ia,null);Y(this,Xf,V(()=>Ci({"aria-haspopup":"menu","aria-expanded":_1(this.submenu.opts.open.current),"data-state":rd(this.submenu.opts.open.current),"aria-controls":this.submenu.opts.open.current?this.submenu.contentId.current:void 0,[this.submenu.root.getBitsAttr("sub-trigger")]:"",onclick:this.onclick,onpointermove:this.onpointermove,onpointerleave:this.onpointerleave,onkeydown:this.onkeydown,...this.attachment},this.item.props)));this.opts=e,this.item=n,this.content=r,this.submenu=i,this.attachment=ns(this.opts.ref,s=>this.submenu.triggerNode=s),this.onpointerleave=this.onpointerleave.bind(this),this.onpointermove=this.onpointermove.bind(this),this.onkeydown=this.onkeydown.bind(this),this.onclick=this.onclick.bind(this),wa(()=>{ze(this,$a,$c).call(this)})}static create(e){const n=M1.get(),r=new Hk(e,n),i=Uu.get();return new By(e,r,n,i)}onpointermove(e){if(Si(e)){if(this.submenu.root.isPointerInTransit){v(this,ia)!==null&&ze(this,$a,$c).call(this);return}if(!this.item.opts.disabled.current&&!this.submenu.opts.open.current&&!v(this,ia)){const n=this.opts.openDelay.current;if(n<=0){this.submenu.onOpen();return}ye(this,ia,this.content.domContext.setTimeout(()=>{if(this.submenu.root.isPointerInTransit){ze(this,$a,$c).call(this);return}this.submenu.onOpen(),ze(this,$a,$c).call(this)},n))}}}onpointerleave(e){Si(e)&&ze(this,$a,$c).call(this)}onkeydown(e){const n=this.content.search!=="";this.item.opts.disabled.current||n&&e.key===Hm||yC[this.submenu.root.opts.dir.current].includes(e.key)&&(e.currentTarget.click(),e.preventDefault())}onclick(e){if(this.item.opts.disabled.current||!va(e.currentTarget))return;e.currentTarget.focus();const n=new CustomEvent("menusubtriggerselect",{bubbles:!0,cancelable:!0});this.opts.onSelect.current(n),this.submenu.opts.open.current||(this.submenu.onOpen(),_s(()=>{const r=this.submenu.contentNode;r&&Fk.dispatch(r)}))}get props(){return d(v(this,Xf))}set props(e){I(v(this,Xf),e)}};ia=new WeakMap,$a=new WeakSet,$c=function(){v(this,ia)!==null&&(this.content.domContext.getWindow().clearTimeout(v(this,ia)),ye(this,ia,null))},Xf=new WeakMap;let ex=By;var Zf;const jy=class jy{constructor(e,n){we(this,"opts");we(this,"root");we(this,"attachment");Y(this,Zf,V(()=>({id:this.opts.id.current,role:"group",[this.root.getBitsAttr("separator")]:"",...this.attachment})));this.opts=e,this.root=n,this.attachment=ns(this.opts.ref)}static create(e){return new jy(e,Dk.get())}get props(){return d(v(this,Zf))}set props(e){I(v(this,Zf),e)}};Zf=new WeakMap;let Vv=jy;var _u,Su,Qi,Na,Gv,Qf;const Uy=class Uy{constructor(e,n){Y(this,Qi);we(this,"opts");we(this,"parentMenu");we(this,"attachment");Y(this,_u,Se(gn({x:0,y:0})));we(this,"virtualElement",Gs({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...d(v(this,_u))})}));Y(this,Su,null);Y(this,Qf,V(()=>({id:this.opts.id.current,disabled:this.opts.disabled.current,"data-disabled":Jh(this.opts.disabled.current),"data-state":rd(this.parentMenu.opts.open.current),[k1]:"",tabindex:-1,onpointerdown:this.onpointerdown,onpointermove:this.onpointermove,onpointercancel:this.onpointercancel,onpointerup:this.onpointerup,oncontextmenu:this.oncontextmenu,...this.attachment})));this.opts=e,this.parentMenu=n,this.attachment=ns(this.opts.ref,r=>this.parentMenu.triggerNode=r),this.oncontextmenu=this.oncontextmenu.bind(this),this.onpointerdown=this.onpointerdown.bind(this),this.onpointermove=this.onpointermove.bind(this),this.onpointercancel=this.onpointercancel.bind(this),this.onpointerup=this.onpointerup.bind(this),Jr(()=>d(v(this,_u)),r=>{this.virtualElement.current={getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...r})}}),Jr(()=>this.opts.disabled.current,r=>{r&&ze(this,Qi,Na).call(this)}),wa(()=>ze(this,Qi,Na).call(this))}static create(e){return new Uy(e,Uu.get())}oncontextmenu(e){var n;e.defaultPrevented||this.opts.disabled.current||(ze(this,Qi,Na).call(this),ze(this,Qi,Gv).call(this,e),e.preventDefault(),(n=this.parentMenu.contentNode)==null||n.focus())}onpointerdown(e){this.opts.disabled.current||Si(e)||(ze(this,Qi,Na).call(this),ye(this,Su,wg(this.opts.ref.current).setTimeout(()=>ze(this,Qi,Gv).call(this,e),700)))}onpointermove(e){this.opts.disabled.current||Si(e)||ze(this,Qi,Na).call(this)}onpointercancel(e){this.opts.disabled.current||Si(e)||ze(this,Qi,Na).call(this)}onpointerup(e){this.opts.disabled.current||Si(e)||ze(this,Qi,Na).call(this)}get props(){return d(v(this,Qf))}set props(e){I(v(this,Qf),e)}};_u=new WeakMap,Su=new WeakMap,Qi=new WeakSet,Na=function(){v(this,Su)!==null&&wg(this.opts.ref.current).clearTimeout(v(this,Su))},Gv=function(e){I(v(this,_u),{x:e.clientX,y:e.clientY},!0),this.parentMenu.onOpen()},Qf=new WeakMap;let $v=Uy;class oq{static create(e){const n=Uu.get();return Uu.set(new Ag(e,n.root,n))}}globalThis.bitsDismissableLayers??(globalThis.bitsDismissableLayers=new Map);var ku,Hl,Ga,Mu,Tu,Ya,Jf,sa,hm,Qu,$k,pm,Eu,gm,mm,vm,bm,eh,Gk,ym,wm;const Wy=class Wy{constructor(e){Y(this,Qu);we(this,"opts");Y(this,ku);Y(this,Hl);Y(this,Ga,{pointerdown:!1});Y(this,Mu,!1);Y(this,Tu,!1);Y(this,Ya);Y(this,Jf);Y(this,sa,vr);Y(this,hm,e=>{e.defaultPrevented||this.opts.ref.current&&_s(()=>{var n,r;!this.opts.ref.current||v(this,bm).call(this,e.target)||e.target&&!v(this,Tu)&&((r=(n=v(this,Jf)).current)==null||r.call(n,e))})});Y(this,pm,e=>{let n=e;n.defaultPrevented&&(n=tx(e)),v(this,ku).current(e)});Y(this,Eu,Kw(e=>{if(!this.opts.ref.current){v(this,sa).call(this);return}const n=this.opts.isValidEvent.current(e,this.opts.ref.current)||ZC(e,this.opts.ref.current);if(!v(this,Mu)||ze(this,Qu,Gk).call(this)||!n){v(this,sa).call(this);return}let r=e;if(r.defaultPrevented&&(r=tx(r)),v(this,Hl).current!=="close"&&v(this,Hl).current!=="defer-otherwise-close"){v(this,sa).call(this);return}e.pointerType==="touch"?(v(this,sa).call(this),ye(this,sa,Ar(v(this,Ya),"click",v(this,pm),{once:!0}))):v(this,ku).current(r)},10));Y(this,gm,e=>{v(this,Ga)[e.type]=!0});Y(this,mm,e=>{v(this,Ga)[e.type]=!1});Y(this,vm,()=>{this.opts.ref.current&&ye(this,Mu,XC(this.opts.ref.current))});Y(this,bm,e=>this.opts.ref.current?Sk(this.opts.ref.current,e):!1);Y(this,eh,Kw(()=>{for(const e in v(this,Ga))v(this,Ga)[e]=!1;ye(this,Mu,!1)},20));Y(this,ym,()=>{ye(this,Tu,!0)});Y(this,wm,()=>{ye(this,Tu,!1)});we(this,"props",{onfocuscapture:v(this,ym),onblurcapture:v(this,wm)});this.opts=e,ye(this,Hl,e.interactOutsideBehavior),ye(this,ku,e.onInteractOutside),ye(this,Jf,e.onFocusOutside),Qt(()=>{ye(this,Ya,kk(this.opts.ref.current))});let n=vr;const r=()=>{v(this,eh).call(this),globalThis.bitsDismissableLayers.delete(this),v(this,Eu).destroy(),n()};Jr([()=>this.opts.enabled.current,()=>this.opts.ref.current],()=>{if(!(!this.opts.enabled.current||!this.opts.ref.current))return FP(1,()=>{this.opts.ref.current&&(globalThis.bitsDismissableLayers.set(this,v(this,Hl)),n(),n=ze(this,Qu,$k).call(this))}),r}),wa(()=>{v(this,eh).destroy(),globalThis.bitsDismissableLayers.delete(this),v(this,Eu).destroy(),v(this,sa).call(this),n()})}static create(e){return new Wy(e)}};ku=new WeakMap,Hl=new WeakMap,Ga=new WeakMap,Mu=new WeakMap,Tu=new WeakMap,Ya=new WeakMap,Jf=new WeakMap,sa=new WeakMap,hm=new WeakMap,Qu=new WeakSet,$k=function(){return tu(Ar(v(this,Ya),"pointerdown",tu(v(this,gm),v(this,vm)),{capture:!0}),Ar(v(this,Ya),"pointerdown",tu(v(this,mm),v(this,Eu))),Ar(v(this,Ya),"focusin",v(this,hm)))},pm=new WeakMap,Eu=new WeakMap,gm=new WeakMap,mm=new WeakMap,vm=new WeakMap,bm=new WeakMap,eh=new WeakMap,Gk=function(){return Object.values(v(this,Ga)).some(Boolean)},ym=new WeakMap,wm=new WeakMap;let Yv=Wy;function KC(t=[...globalThis.bitsDismissableLayers]){return t.findLast(([e,{current:n}])=>n==="close"||n==="ignore")}function XC(t){const e=[...globalThis.bitsDismissableLayers],n=KC(e);if(n)return n[0].opts.ref.current===t;const[r]=e[0];return r.opts.ref.current===t}function ZC(t,e){const n=t.target;if(!xk(n))return!1;const r=!!n.closest(`[${k1}]`),i=!!e.closest(`[${UC}]`);return"button"in t&&t.button>0&&!r?!1:"button"in t&&t.button===0&&r&&i?!0:r&&i?!1:kk(n).documentElement.contains(n)&&!Sk(e,n)&&mC(t,e)}function tx(t){const e=t.currentTarget,n=t.target;let r;t instanceof PointerEvent?r=new PointerEvent(t.type,t):r=new PointerEvent("pointerdown",t);let i=!1;return new Proxy(r,{get:(o,a)=>a==="currentTarget"?e:a==="target"?n:a==="preventDefault"?()=>{i=!0,typeof o.preventDefault=="function"&&o.preventDefault()}:a==="defaultPrevented"?i:a in o?o[a]:t[a]})}function QC(t,e){Tt(e,!0);let n=te(e,"interactOutsideBehavior",3,"close"),r=te(e,"onInteractOutside",3,vr),i=te(e,"onFocusOutside",3,vr),s=te(e,"isValidEvent",3,()=>!1);const o=Yv.create({id:st(()=>e.id),interactOutsideBehavior:st(()=>n()),onInteractOutside:st(()=>r()),enabled:st(()=>e.enabled),onFocusOutside:st(()=>i()),isValidEvent:st(()=>s()),ref:e.ref});var a=qe(),l=Me(a);Zt(l,()=>e.children??an,()=>({props:o.props})),A(t,a),Et()}globalThis.bitsEscapeLayers??(globalThis.bitsEscapeLayers=new Map);var xm,_m;const qy=class qy{constructor(e){we(this,"opts");we(this,"domContext");Y(this,xm,()=>Ar(this.domContext.getDocument(),"keydown",v(this,_m),{passive:!1}));Y(this,_m,e=>{if(e.key!==YP||!JC(this))return;const n=new KeyboardEvent(e.type,e);e.preventDefault();const r=this.opts.escapeKeydownBehavior.current;r!=="close"&&r!=="defer-otherwise-close"||this.opts.onEscapeKeydown.current(n)});this.opts=e,this.domContext=new x1(this.opts.ref);let n=vr;Jr(()=>e.enabled.current,r=>(r&&(globalThis.bitsEscapeLayers.set(this,e.escapeKeydownBehavior),n=v(this,xm).call(this)),()=>{n(),globalThis.bitsEscapeLayers.delete(this)}))}static create(e){return new qy(e)}};xm=new WeakMap,_m=new WeakMap;let Kv=qy;function JC(t){const e=[...globalThis.bitsEscapeLayers],n=e.findLast(([i,{current:s}])=>s==="close"||s==="ignore");if(n)return n[0]===t;const[r]=e[0];return r===t}function eO(t,e){Tt(e,!0);let n=te(e,"escapeKeydownBehavior",3,"close"),r=te(e,"onEscapeKeydown",3,vr);Kv.create({escapeKeydownBehavior:st(()=>n()),onEscapeKeydown:st(()=>r()),enabled:st(()=>e.enabled),ref:e.ref});var i=qe(),s=Me(i);Zt(s,()=>e.children??an),A(t,i),Et()}var oa,th,Vl;const Sm=class Sm{constructor(){Y(this,oa,Gs([]));Y(this,th,new WeakMap);Y(this,Vl,new WeakMap)}static getInstance(){return this.instance||(this.instance=new Sm),this.instance}register(e){const n=this.getActive();n&&n!==e&&n.pause();const r=document.activeElement;r&&r!==document.body&&v(this,Vl).set(e,r),v(this,oa).current=v(this,oa).current.filter(i=>i!==e),v(this,oa).current.unshift(e)}unregister(e){v(this,oa).current=v(this,oa).current.filter(r=>r!==e);const n=this.getActive();n&&n.resume()}getActive(){return v(this,oa).current[0]}setFocusMemory(e,n){v(this,th).set(e,n)}getFocusMemory(e){return v(this,th).get(e)}isActiveScope(e){return this.getActive()===e}setPreFocusMemory(e,n){v(this,Vl).set(e,n)}getPreFocusMemory(e){return v(this,Vl).get(e)}clearPreFocusMemory(e){v(this,Vl).delete(e)}};oa=new WeakMap,th=new WeakMap,Vl=new WeakMap,we(Sm,"instance");let Xv=Sm;var Ka,di,Di,$l,Xa,Ir,Yk,Kk,Xk,Zk,Qv,sg,Jv;const Hy=class Hy{constructor(e){Y(this,Ir);Y(this,Ka,!1);Y(this,di,null);Y(this,Di,Xv.getInstance());Y(this,$l,[]);Y(this,Xa);ye(this,Xa,e)}get paused(){return v(this,Ka)}pause(){ye(this,Ka,!0)}resume(){ye(this,Ka,!1)}mount(e){v(this,di)&&this.unmount(),ye(this,di,e),v(this,Di).register(this),ze(this,Ir,Zk).call(this),ze(this,Ir,Kk).call(this)}unmount(){v(this,di)&&(ze(this,Ir,Yk).call(this),ze(this,Ir,Xk).call(this),v(this,Di).unregister(this),v(this,Di).clearPreFocusMemory(this),ye(this,di,null))}static use(e){let n=null;return Jr([()=>e.ref.current,()=>e.enabled.current],([r,i])=>{r&&i?(n||(n=new Hy(e)),n.mount(r)):n&&(n.unmount(),n=null)}),wa(()=>{n==null||n.unmount()}),{get props(){return{tabindex:-1}}}}};Ka=new WeakMap,di=new WeakMap,Di=new WeakMap,$l=new WeakMap,Xa=new WeakMap,Ir=new WeakSet,Yk=function(){for(const e of v(this,$l))e();ye(this,$l,[])},Kk=function(){if(!v(this,di))return;const e=new CustomEvent("focusScope.onOpenAutoFocus",{bubbles:!1,cancelable:!0});v(this,Xa).onOpenAutoFocus.current(e),e.defaultPrevented||requestAnimationFrame(()=>{if(!v(this,di))return;const n=ze(this,Ir,sg).call(this);n?(n.focus(),v(this,Di).setFocusMemory(this,n)):v(this,di).focus()})},Xk=function(){var n,r;const e=new CustomEvent("focusScope.onCloseAutoFocus",{bubbles:!1,cancelable:!0});if((r=(n=v(this,Xa).onCloseAutoFocus).current)==null||r.call(n,e),!e.defaultPrevented){const i=v(this,Di).getPreFocusMemory(this);if(i&&document.contains(i))try{i.focus()}catch{document.body.focus()}}},Zk=function(){if(!v(this,di)||!v(this,Xa).trap.current)return;const e=v(this,di),n=e.ownerDocument,r=o=>{if(v(this,Ka)||!v(this,Di).isActiveScope(this))return;const a=o.target;if(!a)return;if(e.contains(a))v(this,Di).setFocusMemory(this,a);else{const c=v(this,Di).getFocusMemory(this);if(c&&e.contains(c)&&zk(c))o.preventDefault(),c.focus();else{const u=ze(this,Ir,sg).call(this),f=ze(this,Ir,Jv).call(this)[0];(u||f||e).focus()}}},i=o=>{if(!v(this,Xa).loop||v(this,Ka)||o.key!=="Tab"||!v(this,Di).isActiveScope(this))return;const a=ze(this,Ir,Qv).call(this);if(a.length===0)return;const l=a[0],c=a[a.length-1];!o.shiftKey&&n.activeElement===c?(o.preventDefault(),l.focus()):o.shiftKey&&n.activeElement===l&&(o.preventDefault(),c.focus())};v(this,$l).push(Ar(n,"focusin",r,{capture:!0}),Ar(e,"keydown",i));const s=new MutationObserver(()=>{const o=v(this,Di).getFocusMemory(this);if(o&&!e.contains(o)){const a=ze(this,Ir,sg).call(this),l=ze(this,Ir,Jv).call(this)[0],c=a||l;c?(c.focus(),v(this,Di).setFocusMemory(this,c)):e.focus()}});s.observe(e,{childList:!0,subtree:!0}),v(this,$l).push(()=>s.disconnect())},Qv=function(){return v(this,di)?Nk(v(this,di),{includeContainer:!1,getShadowRoot:!0}):[]},sg=function(){return ze(this,Ir,Qv).call(this)[0]||null},Jv=function(){return v(this,di)?Ik(v(this,di),{includeContainer:!1,getShadowRoot:!0}):[]};let Zv=Hy;function tO(t,e){Tt(e,!0);let n=te(e,"enabled",3,!1),r=te(e,"trapFocus",3,!1),i=te(e,"loop",3,!1),s=te(e,"onCloseAutoFocus",3,vr),o=te(e,"onOpenAutoFocus",3,vr);const a=Zv.use({enabled:st(()=>n()),trap:st(()=>r()),loop:i(),onCloseAutoFocus:st(()=>s()),onOpenAutoFocus:st(()=>o()),ref:e.ref});var l=qe(),c=Me(l);Zt(c,()=>e.focusScope??an,()=>({props:a.props})),A(t,l),Et()}const nx=()=>{};globalThis.bitsTextSelectionLayers??(globalThis.bitsTextSelectionLayers=new Map);var Au,Pu,nh,rh,km,Qk,Mm,Tm,ih;const Vy=class Vy{constructor(e){Y(this,km);we(this,"opts");we(this,"domContext");Y(this,Au,vr);Y(this,Pu,!1);Y(this,nh,nx);Y(this,rh,nx);Y(this,Mm,e=>{v(this,rh).call(this,e)});Y(this,Tm,e=>{const n=this.opts.ref.current,r=e.target;!va(n)||!va(r)||!v(this,Pu)||!rO(this)||!HP(n,r)||(v(this,nh).call(this,e),!e.defaultPrevented&&ye(this,Au,nO(n,this.domContext.getDocument().body)))});Y(this,ih,()=>{v(this,Au).call(this),ye(this,Au,vr)});this.opts=e,this.domContext=new x1(e.ref);let n=vr;Jr(()=>[this.opts.enabled.current,this.opts.onPointerDown.current,this.opts.onPointerUp.current],([r,i,s])=>(ye(this,Pu,r),ye(this,nh,i),ye(this,rh,s),r&&(globalThis.bitsTextSelectionLayers.set(this,this.opts.enabled),n(),n=ze(this,km,Qk).call(this)),()=>{ye(this,Pu,!1),n(),v(this,ih).call(this),globalThis.bitsTextSelectionLayers.delete(this)}))}static create(e){return new Vy(e)}};Au=new WeakMap,Pu=new WeakMap,nh=new WeakMap,rh=new WeakMap,km=new WeakSet,Qk=function(){return tu(Ar(this.domContext.getDocument(),"pointerdown",v(this,Tm)),Ar(this.domContext.getDocument(),"pointerup",ck(v(this,ih),v(this,Mm))))},Mm=new WeakMap,Tm=new WeakMap,ih=new WeakMap;let eb=Vy;const rx=t=>t.style.userSelect||t.style.webkitUserSelect;function nO(t,e){const n=rx(e),r=rx(t);return _p(e,"none"),_p(t,"text"),()=>{_p(e,n),_p(t,r)}}function _p(t,e){t.style.userSelect=e,t.style.webkitUserSelect=e}function rO(t){const e=[...globalThis.bitsTextSelectionLayers];if(!e.length)return!1;const n=e.at(-1);return n?n[0]===t:!1}function iO(t,e){Tt(e,!0);let n=te(e,"preventOverflowTextSelection",3,!0),r=te(e,"onPointerDown",3,vr),i=te(e,"onPointerUp",3,vr);eb.create({id:st(()=>e.id),onPointerDown:st(()=>r()),onPointerUp:st(()=>i()),enabled:st(()=>e.enabled&&n()),ref:e.ref});var s=qe(),o=Me(s);Zt(o,()=>e.children??an),A(t,s),Et()}globalThis.bitsIdCounter??(globalThis.bitsIdCounter={current:0});function np(t="bits"){return globalThis.bitsIdCounter.current++,`${t}-${globalThis.bitsIdCounter.current}`}var sh,Cu,Gl,Yl,Em,Jk;class sO{constructor(e){Y(this,Em);Y(this,sh);Y(this,Cu,0);Y(this,Gl,Se());Y(this,Yl);ye(this,sh,e)}get(...e){return ye(this,Cu,v(this,Cu)+1),d(v(this,Gl))===void 0&&ye(this,Yl,wS(()=>{I(v(this,Gl),v(this,sh).call(this,...e),!0)})),Qt(()=>()=>{ze(this,Em,Jk).call(this)}),d(v(this,Gl))}}sh=new WeakMap,Cu=new WeakMap,Gl=new WeakMap,Yl=new WeakMap,Em=new WeakSet,Jk=function(){ye(this,Cu,v(this,Cu)-1),v(this,Yl)&&v(this,Cu)<=0&&(v(this,Yl).call(this),I(v(this,Gl),void 0),ye(this,Yl,void 0))};const og=new Ov;let Sp=Se(null),wl=null,wd=null,xd=!1;const ix=st(()=>{for(const t of og.values())if(t)return!0;return!1});let P0=null;const oO=new sO(()=>{function t(){document.body.setAttribute("style",d(Sp)??""),document.body.style.removeProperty("--scrollbar-width"),Yw&&(wl==null||wl()),I(Sp,null)}function e(){wd!==null&&(window.clearTimeout(wd),wd=null)}function n(i,s){e(),xd=!0,P0=Date.now();const o=P0,a=()=>{wd=null,P0===o&&(eM(og)?xd=!1:(xd=!1,s()))},l=i===null?24:i;wd=window.setTimeout(a,l)}function r(){d(Sp)===null&&og.size===0&&!xd&&I(Sp,document.body.getAttribute("style"),!0)}return Jr(()=>ix.current,()=>{var u,f;if(!ix.current)return;r(),xd=!1;const i=getComputedStyle(document.documentElement),s=getComputedStyle(document.body),o=((u=i.scrollbarGutter)==null?void 0:u.includes("stable"))||((f=s.scrollbarGutter)==null?void 0:f.includes("stable")),a=window.innerWidth-document.documentElement.clientWidth,c={padding:Number.parseInt(s.paddingRight??"0",10)+a,margin:Number.parseInt(s.marginRight??"0",10)};a>0&&!o&&(document.body.style.paddingRight=`${c.padding}px`,document.body.style.marginRight=`${c.margin}px`,document.body.style.setProperty("--scrollbar-width",`${a}px`)),document.body.style.overflow="hidden",Yw&&(wl=Ar(document,"touchmove",h=>{h.target===document.documentElement&&(h.touches.length>1||h.preventDefault())},{passive:!1})),_s(()=>{document.body.style.pointerEvents="none",document.body.style.overflow="hidden"})}),wa(()=>()=>{wl==null||wl()}),{get lockMap(){return og},resetBodyStyle:t,scheduleCleanupIfNoNewLocks:n,cancelPendingCleanup:e,ensureInitialStyleCaptured:r}});var Kl,oh,ah,Fi;class aO{constructor(e,n=()=>null){Y(this,Kl,np());Y(this,oh);Y(this,ah,()=>null);Y(this,Fi);we(this,"locked");ye(this,oh,e),ye(this,ah,n),ye(this,Fi,oO.get()),v(this,Fi)&&(v(this,Fi).cancelPendingCleanup(),v(this,Fi).ensureInitialStyleCaptured(),v(this,Fi).lockMap.set(v(this,Kl),v(this,oh)??!1),this.locked=st(()=>v(this,Fi).lockMap.get(v(this,Kl))??!1,r=>v(this,Fi).lockMap.set(v(this,Kl),r)),wa(()=>{if(v(this,Fi).lockMap.delete(v(this,Kl)),eM(v(this,Fi).lockMap))return;const r=v(this,ah).call(this);v(this,Fi).scheduleCleanupIfNoNewLocks(r,()=>{v(this,Fi).resetBodyStyle()})}))}}Kl=new WeakMap,oh=new WeakMap,ah=new WeakMap,Fi=new WeakMap;function eM(t){for(const[e,n]of t)if(n)return!0;return!1}function sx(t,e){Tt(e,!0);let n=te(e,"preventScroll",3,!0),r=te(e,"restoreScrollDelay",3,null);n()&&new aO(n(),()=>r()),Et()}XE();const T1=qm({component:"collapsible",parts:["root","content","trigger"]}),E1=new pl("Collapsible.Root");var lh,ch,uh;const $y=class $y{constructor(e){we(this,"opts");we(this,"attachment");Y(this,lh,Se(null));we(this,"contentPresence");Y(this,ch,Se(void 0));Y(this,uh,V(()=>({id:this.opts.id.current,"data-state":rd(this.opts.open.current),"data-disabled":Jh(this.opts.disabled.current),[T1.root]:"",...this.attachment})));this.opts=e,this.toggleOpen=this.toggleOpen.bind(this),this.attachment=ns(this.opts.ref),this.contentPresence=new _k({ref:st(()=>this.contentNode),open:this.opts.open,onComplete:()=>{this.opts.onOpenChangeComplete.current(this.opts.open.current)}})}static create(e){return E1.set(new $y(e))}get contentNode(){return d(v(this,lh))}set contentNode(e){I(v(this,lh),e,!0)}get contentId(){return d(v(this,ch))}set contentId(e){I(v(this,ch),e,!0)}toggleOpen(){this.opts.open.current=!this.opts.open.current}get props(){return d(v(this,uh))}set props(e){I(v(this,uh),e)}};lh=new WeakMap,ch=new WeakMap,uh=new WeakMap;let tb=$y;var dh,Ou,Ru,Nu,Iu,fh,hh;const Gy=class Gy{constructor(e,n){we(this,"opts");we(this,"root");we(this,"attachment");Y(this,dh,V(()=>this.opts.hiddenUntilFound.current?this.root.opts.open.current:this.opts.forceMount.current||this.root.opts.open.current));Y(this,Ou);Y(this,Ru,Se(!1));Y(this,Nu,Se(0));Y(this,Iu,Se(0));Y(this,fh,V(()=>({open:this.root.opts.open.current})));Y(this,hh,V(()=>({id:this.opts.id.current,style:{"--bits-collapsible-content-height":d(v(this,Iu))?`${d(v(this,Iu))}px`:void 0,"--bits-collapsible-content-width":d(v(this,Nu))?`${d(v(this,Nu))}px`:void 0},hidden:this.opts.hiddenUntilFound.current&&!this.root.opts.open.current?"until-found":void 0,"data-state":rd(this.root.opts.open.current),...mk(this.root.contentPresence.transitionStatus),"data-disabled":Jh(this.root.opts.disabled.current),[T1.content]:"",...this.opts.hiddenUntilFound.current&&!this.shouldRender?{}:{hidden:this.opts.hiddenUntilFound.current?!this.shouldRender:this.opts.forceMount.current?void 0:!this.shouldRender},...this.attachment})));this.opts=e,this.root=n,I(v(this,Ru),n.opts.open.current,!0),this.root.contentId=this.opts.id.current,this.attachment=ns(this.opts.ref,r=>this.root.contentNode=r),Jr.pre(()=>this.opts.id.current,r=>{this.root.contentId=r}),h1(()=>{const r=requestAnimationFrame(()=>{I(v(this,Ru),!1)});return()=>{cancelAnimationFrame(r)}}),Jr.pre([()=>this.opts.ref.current,()=>this.opts.hiddenUntilFound.current],([r,i])=>!r||!i?void 0:Ar(r,"beforematch",()=>{this.root.opts.open.current||requestAnimationFrame(()=>{this.root.opts.open.current=!0})})),Jr([()=>this.opts.ref.current,()=>this.present],([r])=>{r&&_s(()=>{if(!this.opts.ref.current)return;ye(this,Ou,v(this,Ou)||{transitionDuration:r.style.transitionDuration,animationName:r.style.animationName}),r.style.transitionDuration="0s",r.style.animationName="none";const i=r.getBoundingClientRect();if(I(v(this,Iu),i.height,!0),I(v(this,Nu),i.width,!0),!d(v(this,Ru))){const{animationName:s,transitionDuration:o}=v(this,Ou);r.style.transitionDuration=o,r.style.animationName=s}})})}static create(e){return new Gy(e,E1.get())}get present(){return d(v(this,dh))}set present(e){I(v(this,dh),e)}get shouldRender(){return this.root.contentPresence.shouldRender}get snippetProps(){return d(v(this,fh))}set snippetProps(e){I(v(this,fh),e)}get props(){return d(v(this,hh))}set props(e){I(v(this,hh),e)}};dh=new WeakMap,Ou=new WeakMap,Ru=new WeakMap,Nu=new WeakMap,Iu=new WeakMap,fh=new WeakMap,hh=new WeakMap;let nb=Gy;var Xl,ph;const Yy=class Yy{constructor(e,n){we(this,"opts");we(this,"root");we(this,"attachment");Y(this,Xl,V(()=>this.opts.disabled.current||this.root.opts.disabled.current));Y(this,ph,V(()=>({id:this.opts.id.current,type:"button",disabled:d(v(this,Xl)),"aria-controls":this.root.contentId,"aria-expanded":_1(this.root.opts.open.current),"data-state":rd(this.root.opts.open.current),"data-disabled":Jh(d(v(this,Xl))),[T1.trigger]:"",onclick:this.onclick,onkeydown:this.onkeydown,...this.attachment})));this.opts=e,this.root=n,this.attachment=ns(this.opts.ref),this.onclick=this.onclick.bind(this),this.onkeydown=this.onkeydown.bind(this)}static create(e){return new Yy(e,E1.get())}onclick(e){if(!d(v(this,Xl))){if(e.button!==0)return e.preventDefault();this.root.toggleOpen()}}onkeydown(e){d(v(this,Xl))||(e.key===Hm||e.key===bk)&&(e.preventDefault(),this.root.toggleOpen())}get props(){return d(v(this,ph))}set props(e){I(v(this,ph),e)}};Xl=new WeakMap,ph=new WeakMap;let rb=Yy;var lO=new Set(["$$slots","$$events","$$legacy","children","child","id","ref","open","disabled","onOpenChange","onOpenChangeComplete"]),cO=ne("<div><!></div>");function uO(t,e){const n=fc();Tt(e,!0);let r=te(e,"id",19,()=>gc(n)),i=te(e,"ref",15,null),s=te(e,"open",15,!1),o=te(e,"disabled",3,!1),a=te(e,"onOpenChange",3,vr),l=te(e,"onOpenChangeComplete",3,vr),c=ht(e,lO);const u=tb.create({open:st(()=>s(),b=>{s(b),a()(b)}),disabled:st(()=>o()),id:st(()=>r()),ref:st(()=>i(),b=>i(b)),onOpenChangeComplete:st(()=>l())}),f=V(()=>Ci(c,u.props));var h=qe(),p=Me(h);{var g=b=>{var y=qe(),_=Me(y);Zt(_,()=>e.child,()=>({props:d(f)})),A(b,y)},m=b=>{var y=cO();_r(y,()=>({...d(f)}));var _=j(y);Zt(_,()=>e.children??an),A(b,y)};xe(p,b=>{e.child?b(g):b(m,-1)})}A(t,h),Et()}var dO=new Set(["$$slots","$$events","$$legacy","child","ref","forceMount","hiddenUntilFound","children","id"]),fO=ne("<div><!></div>");function hO(t,e){const n=fc();Tt(e,!0);let r=te(e,"ref",15,null),i=te(e,"forceMount",3,!1),s=te(e,"hiddenUntilFound",3,!1),o=te(e,"id",19,()=>gc(n)),a=ht(e,dO);const l=nb.create({id:st(()=>o()),forceMount:st(()=>i()),hiddenUntilFound:st(()=>s()),ref:st(()=>r(),g=>r(g))}),c=V(()=>Ci(a,l.props));var u=qe(),f=Me(u);{var h=g=>{var m=qe(),b=Me(m);{let y=V(()=>({...l.snippetProps,props:d(c)}));Zt(b,()=>e.child,()=>d(y))}A(g,m)},p=g=>{var m=fO();_r(m,()=>({...d(c)}));var b=j(m);Zt(b,()=>e.children??an),A(g,m)};xe(f,g=>{e.child?g(h):g(p,-1)})}A(t,u),Et()}var pO=new Set(["$$slots","$$events","$$legacy","children","child","ref","id","disabled"]),gO=ne("<button><!></button>");function mO(t,e){const n=fc();Tt(e,!0);let r=te(e,"ref",15,null),i=te(e,"id",19,()=>gc(n)),s=te(e,"disabled",3,!1),o=ht(e,pO);const a=rb.create({id:st(()=>i()),ref:st(()=>r(),p=>r(p)),disabled:st(()=>s())}),l=V(()=>Ci(o,a.props));var c=qe(),u=Me(c);{var f=p=>{var g=qe(),m=Me(g);Zt(m,()=>e.child,()=>({props:d(l)})),A(p,g)},h=p=>{var g=gO();_r(g,()=>({...d(l)}));var m=j(g);Zt(m,()=>e.children??an),A(p,g)};xe(u,p=>{e.child?p(f):p(h,-1)})}A(t,c),Et()}const vO=["top","right","bottom","left"],ol=Math.min,Ji=Math.max,Pg=Math.round,kp=Math.floor,Ro=t=>({x:t,y:t}),bO={left:"right",right:"left",bottom:"top",top:"bottom"};function ib(t,e,n){return Ji(t,ol(e,n))}function ba(t,e){return typeof t=="function"?t(e):t}function ya(t){return t.split("-")[0]}function id(t){return t.split("-")[1]}function A1(t){return t==="x"?"y":"x"}function P1(t){return t==="y"?"height":"width"}function Eo(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function C1(t){return A1(Eo(t))}function yO(t,e,n){n===void 0&&(n=!1);const r=id(t),i=C1(t),s=P1(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=Cg(o)),[o,Cg(o)]}function wO(t){const e=Cg(t);return[sb(t),e,sb(e)]}function sb(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const ox=["left","right"],ax=["right","left"],xO=["top","bottom"],_O=["bottom","top"];function SO(t,e,n){switch(t){case"top":case"bottom":return n?e?ax:ox:e?ox:ax;case"left":case"right":return e?xO:_O;default:return[]}}function kO(t,e,n,r){const i=id(t);let s=SO(ya(t),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(sb)))),s}function Cg(t){const e=ya(t);return bO[e]+t.slice(e.length)}function MO(t){return{top:0,right:0,bottom:0,left:0,...t}}function tM(t){return typeof t!="number"?MO(t):{top:t,right:t,bottom:t,left:t}}function Og(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function lx(t,e,n){let{reference:r,floating:i}=t;const s=Eo(e),o=C1(e),a=P1(o),l=ya(e),c=s==="y",u=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2;let p;switch(l){case"top":p={x:u,y:r.y-i.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-i.width,y:f};break;default:p={x:r.x,y:r.y}}switch(id(e)){case"start":p[o]-=h*(n&&c?-1:1);break;case"end":p[o]+=h*(n&&c?-1:1);break}return p}async function TO(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=ba(e,t),g=tM(p),b=a[h?f==="floating"?"reference":"floating":f],y=Og(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(b)))==null||n?b:b.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),_=f==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),S=await(s.isElement==null?void 0:s.isElement(k))?await(s.getScale==null?void 0:s.getScale(k))||{x:1,y:1}:{x:1,y:1},E=Og(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:_,offsetParent:k,strategy:l}):_);return{top:(y.top-E.top+g.top)/S.y,bottom:(E.bottom-y.bottom+g.bottom)/S.y,left:(y.left-E.left+g.left)/S.x,right:(E.right-y.right+g.right)/S.x}}const EO=50,AO=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:TO},l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:f}=lx(c,r,l),h=r,p=0;const g={};for(let m=0;m<s.length;m++){const b=s[m];if(!b)continue;const{name:y,fn:_}=b,{x:k,y:S,data:E,reset:M}=await _({x:u,y:f,initialPlacement:r,placement:h,strategy:i,middlewareData:g,rects:c,platform:a,elements:{reference:t,floating:e}});u=k??u,f=S??f,g[y]={...g[y],...E},M&&p<EO&&(p++,typeof M=="object"&&(M.placement&&(h=M.placement),M.rects&&(c=M.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:i}):M.rects),{x:u,y:f}=lx(c,h,l)),m=-1)}return{x:u,y:f,placement:h,strategy:i,middlewareData:g}},PO=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=ba(t,e)||{};if(c==null)return{};const f=tM(u),h={x:n,y:r},p=C1(i),g=P1(p),m=await o.getDimensions(c),b=p==="y",y=b?"top":"left",_=b?"bottom":"right",k=b?"clientHeight":"clientWidth",S=s.reference[g]+s.reference[p]-h[p]-s.floating[g],E=h[p]-s.reference[p],M=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let O=M?M[k]:0;(!O||!await(o.isElement==null?void 0:o.isElement(M)))&&(O=a.floating[k]||s.floating[g]);const P=S/2-E/2,x=O/2-m[g]/2-1,C=ol(f[y],x),R=ol(f[_],x),N=C,B=O-m[g]-R,z=O/2-m[g]/2+P,H=ib(N,z,B),X=!l.arrow&&id(i)!=null&&z!==H&&s.reference[g]/2-(z<N?C:R)-m[g]/2<0,G=X?z<N?z-N:z-B:0;return{[p]:h[p]+G,data:{[p]:H,centerOffset:z-H-G,...X&&{alignmentOffset:G}},reset:X}}}),CO=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:m=!0,...b}=ba(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=ya(i),_=Eo(a),k=ya(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(c.floating)),E=h||(k||!m?[Cg(a)]:wO(a)),M=g!=="none";!h&&M&&E.push(...kO(a,m,g,S));const O=[a,...E],P=await l.detectOverflow(e,b),x=[];let C=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&x.push(P[y]),f){const z=yO(i,o,S);x.push(P[z[0]],P[z[1]])}if(C=[...C,{placement:i,overflows:x}],!x.every(z=>z<=0)){var R,N;const z=(((R=s.flip)==null?void 0:R.index)||0)+1,H=O[z];if(H&&(!(f==="alignment"?_!==Eo(H):!1)||C.every(Z=>Eo(Z.placement)===_?Z.overflows[0]>0:!0)))return{data:{index:z,overflows:C},reset:{placement:H}};let X=(N=C.filter(G=>G.overflows[0]<=0).sort((G,Z)=>G.overflows[1]-Z.overflows[1])[0])==null?void 0:N.placement;if(!X)switch(p){case"bestFit":{var B;const G=(B=C.filter(Z=>{if(M){const oe=Eo(Z.placement);return oe===_||oe==="y"}return!0}).map(Z=>[Z.placement,Z.overflows.filter(oe=>oe>0).reduce((oe,K)=>oe+K,0)]).sort((Z,oe)=>Z[1]-oe[1])[0])==null?void 0:B[0];G&&(X=G);break}case"initialPlacement":X=a;break}if(i!==X)return{reset:{placement:X}}}return{}}}};function cx(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function ux(t){return vO.some(e=>t[e]>=0)}const OO=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:i="referenceHidden",...s}=ba(t,e);switch(i){case"referenceHidden":{const o=await r.detectOverflow(e,{...s,elementContext:"reference"}),a=cx(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:ux(a)}}}case"escaped":{const o=await r.detectOverflow(e,{...s,altBoundary:!0}),a=cx(o,n.floating);return{data:{escapedOffsets:a,escaped:ux(a)}}}default:return{}}}}},nM=new Set(["left","top"]);async function RO(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=ya(n),a=id(n),l=Eo(n)==="y",c=nM.has(o)?-1:1,u=s&&l?-1:1,f=ba(e,t);let{mainAxis:h,crossAxis:p,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof g=="number"&&(p=a==="end"?g*-1:g),l?{x:p*u,y:h*c}:{x:h*c,y:p*u}}const NO=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=e,l=await RO(e,t);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},IO=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i,platform:s}=e,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:y=>{let{x:_,y:k}=y;return{x:_,y:k}}},...c}=ba(t,e),u={x:n,y:r},f=await s.detectOverflow(e,c),h=Eo(ya(i)),p=A1(h);let g=u[p],m=u[h];if(o){const y=p==="y"?"top":"left",_=p==="y"?"bottom":"right",k=g+f[y],S=g-f[_];g=ib(k,g,S)}if(a){const y=h==="y"?"top":"left",_=h==="y"?"bottom":"right",k=m+f[y],S=m-f[_];m=ib(k,m,S)}const b=l.fn({...e,[p]:g,[h]:m});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[p]:o,[h]:a}}}}}},zO=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=ba(t,e),u={x:n,y:r},f=Eo(i),h=A1(f);let p=u[h],g=u[f];const m=ba(a,e),b=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const k=h==="y"?"height":"width",S=s.reference[h]-s.floating[k]+b.mainAxis,E=s.reference[h]+s.reference[k]-b.mainAxis;p<S?p=S:p>E&&(p=E)}if(c){var y,_;const k=h==="y"?"width":"height",S=nM.has(ya(i)),E=s.reference[f]-s.floating[k]+(S&&((y=o.offset)==null?void 0:y[f])||0)+(S?0:b.crossAxis),M=s.reference[f]+s.reference[k]+(S?0:((_=o.offset)==null?void 0:_[f])||0)-(S?b.crossAxis:0);g<E?g=E:g>M&&(g=M)}return{[h]:p,[f]:g}}}},LO=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:s,platform:o,elements:a}=e,{apply:l=()=>{},...c}=ba(t,e),u=await o.detectOverflow(e,c),f=ya(i),h=id(i),p=Eo(i)==="y",{width:g,height:m}=s.floating;let b,y;f==="top"||f==="bottom"?(b=f,y=h===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(y=f,b=h==="end"?"top":"bottom");const _=m-u.top-u.bottom,k=g-u.left-u.right,S=ol(m-u[b],_),E=ol(g-u[y],k),M=!e.middlewareData.shift;let O=S,P=E;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(P=k),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(O=_),M&&!h){const C=Ji(u.left,0),R=Ji(u.right,0),N=Ji(u.top,0),B=Ji(u.bottom,0);p?P=g-2*(C!==0||R!==0?C+R:Ji(u.left,u.right)):O=m-2*(N!==0||B!==0?N+B:Ji(u.top,u.bottom))}await l({...e,availableWidth:P,availableHeight:O});const x=await o.getDimensions(a.floating);return g!==x.width||m!==x.height?{reset:{rects:!0}}:{}}}};function Vm(){return typeof window<"u"}function sd(t){return rM(t)?(t.nodeName||"").toLowerCase():"#document"}function rs(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Bo(t){var e;return(e=(rM(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function rM(t){return Vm()?t instanceof Node||t instanceof rs(t).Node:!1}function eo(t){return Vm()?t instanceof Element||t instanceof rs(t).Element:!1}function xa(t){return Vm()?t instanceof HTMLElement||t instanceof rs(t).HTMLElement:!1}function dx(t){return!Vm()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof rs(t).ShadowRoot}function rp(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=to(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&i!=="inline"&&i!=="contents"}function DO(t){return/^(table|td|th)$/.test(sd(t))}function $m(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const FO=/transform|translate|scale|rotate|perspective|filter/,BO=/paint|layout|strict|content/,xl=t=>!!t&&t!=="none";let C0;function O1(t){const e=eo(t)?to(t):t;return xl(e.transform)||xl(e.translate)||xl(e.scale)||xl(e.rotate)||xl(e.perspective)||!R1()&&(xl(e.backdropFilter)||xl(e.filter))||FO.test(e.willChange||"")||BO.test(e.contain||"")}function jO(t){let e=al(t);for(;xa(e)&&!Wu(e);){if(O1(e))return e;if($m(e))return null;e=al(e)}return null}function R1(){return C0==null&&(C0=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),C0}function Wu(t){return/^(html|body|#document)$/.test(sd(t))}function to(t){return rs(t).getComputedStyle(t)}function Gm(t){return eo(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function al(t){if(sd(t)==="html")return t;const e=t.assignedSlot||t.parentNode||dx(t)&&t.host||Bo(t);return dx(e)?e.host:e}function iM(t){const e=al(t);return Wu(e)?t.ownerDocument?t.ownerDocument.body:t.body:xa(e)&&rp(e)?e:iM(e)}function ff(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=iM(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),o=rs(i);if(s){const a=ob(o);return e.concat(o,o.visualViewport||[],rp(i)?i:[],a&&n?ff(a):[])}else return e.concat(i,ff(i,[],n))}function ob(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function sM(t){const e=to(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=xa(t),s=i?t.offsetWidth:n,o=i?t.offsetHeight:r,a=Pg(n)!==s||Pg(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function N1(t){return eo(t)?t:t.contextElement}function nu(t){const e=N1(t);if(!xa(e))return Ro(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=sM(e);let o=(s?Pg(n.width):n.width)/r,a=(s?Pg(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const UO=Ro(0);function oM(t){const e=rs(t);return!R1()||!e.visualViewport?UO:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function WO(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==rs(t)?!1:e}function rc(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=N1(t);let o=Ro(1);e&&(r?eo(r)&&(o=nu(r)):o=nu(t));const a=WO(s,n,r)?oM(s):Ro(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,u=i.width/o.x,f=i.height/o.y;if(s){const h=rs(s),p=r&&eo(r)?rs(r):r;let g=h,m=ob(g);for(;m&&r&&p!==g;){const b=nu(m),y=m.getBoundingClientRect(),_=to(m),k=y.left+(m.clientLeft+parseFloat(_.paddingLeft))*b.x,S=y.top+(m.clientTop+parseFloat(_.paddingTop))*b.y;l*=b.x,c*=b.y,u*=b.x,f*=b.y,l+=k,c+=S,g=rs(m),m=ob(g)}}return Og({width:u,height:f,x:l,y:c})}function Ym(t,e){const n=Gm(t).scrollLeft;return e?e.left+n:rc(Bo(t)).left+n}function aM(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-Ym(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function qO(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",o=Bo(r),a=e?$m(e.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=Ro(1);const u=Ro(0),f=xa(r);if((f||!f&&!s)&&((sd(r)!=="body"||rp(o))&&(l=Gm(r)),f)){const p=rc(r);c=nu(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}const h=o&&!f&&!s?aM(o,l):Ro(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:n.y*c.y-l.scrollTop*c.y+u.y+h.y}}function HO(t){return Array.from(t.getClientRects())}function VO(t){const e=Bo(t),n=Gm(t),r=t.ownerDocument.body,i=Ji(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=Ji(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Ym(t);const a=-n.scrollTop;return to(r).direction==="rtl"&&(o+=Ji(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}const fx=25;function $O(t,e){const n=rs(t),r=Bo(t),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const u=R1();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const c=Ym(r);if(c<=0){const u=r.ownerDocument,f=u.body,h=getComputedStyle(f),p=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,g=Math.abs(r.clientWidth-f.clientWidth-p);g<=fx&&(s-=g)}else c<=fx&&(s+=c);return{width:s,height:o,x:a,y:l}}function GO(t,e){const n=rc(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=xa(t)?nu(t):Ro(1),o=t.clientWidth*s.x,a=t.clientHeight*s.y,l=i*s.x,c=r*s.y;return{width:o,height:a,x:l,y:c}}function hx(t,e,n){let r;if(e==="viewport")r=$O(t,n);else if(e==="document")r=VO(Bo(t));else if(eo(e))r=GO(e,n);else{const i=oM(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Og(r)}function lM(t,e){const n=al(t);return n===e||!eo(n)||Wu(n)?!1:to(n).position==="fixed"||lM(n,e)}function YO(t,e){const n=e.get(t);if(n)return n;let r=ff(t,[],!1).filter(a=>eo(a)&&sd(a)!=="body"),i=null;const s=to(t).position==="fixed";let o=s?al(t):t;for(;eo(o)&&!Wu(o);){const a=to(o),l=O1(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||rp(o)&&!l&&lM(t,o))?r=r.filter(u=>u!==o):i=a,o=al(o)}return e.set(t,r),r}function KO(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?$m(e)?[]:YO(e,this._c):[].concat(n),r],a=hx(e,o[0],i);let l=a.top,c=a.right,u=a.bottom,f=a.left;for(let h=1;h<o.length;h++){const p=hx(e,o[h],i);l=Ji(p.top,l),c=ol(p.right,c),u=ol(p.bottom,u),f=Ji(p.left,f)}return{width:c-f,height:u-l,x:f,y:l}}function XO(t){const{width:e,height:n}=sM(t);return{width:e,height:n}}function ZO(t,e,n){const r=xa(e),i=Bo(e),s=n==="fixed",o=rc(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=Ro(0);function c(){l.x=Ym(i)}if(r||!r&&!s)if((sd(e)!=="body"||rp(i))&&(a=Gm(e)),r){const p=rc(e,!0,s,e);l.x=p.x+e.clientLeft,l.y=p.y+e.clientTop}else i&&c();s&&!r&&i&&c();const u=i&&!r&&!s?aM(i,a):Ro(0),f=o.left+a.scrollLeft-l.x-u.x,h=o.top+a.scrollTop-l.y-u.y;return{x:f,y:h,width:o.width,height:o.height}}function O0(t){return to(t).position==="static"}function px(t,e){if(!xa(t)||to(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Bo(t)===n&&(n=n.ownerDocument.body),n}function cM(t,e){const n=rs(t);if($m(t))return n;if(!xa(t)){let i=al(t);for(;i&&!Wu(i);){if(eo(i)&&!O0(i))return i;i=al(i)}return n}let r=px(t,e);for(;r&&DO(r)&&O0(r);)r=px(r,e);return r&&Wu(r)&&O0(r)&&!O1(r)?n:r||jO(t)||n}const QO=async function(t){const e=this.getOffsetParent||cM,n=this.getDimensions,r=await n(t.floating);return{reference:ZO(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function JO(t){return to(t).direction==="rtl"}const eR={convertOffsetParentRelativeRectToViewportRelativeRect:qO,getDocumentElement:Bo,getClippingRect:KO,getOffsetParent:cM,getElementRects:QO,getClientRects:HO,getDimensions:XO,getScale:nu,isElement:eo,isRTL:JO};function uM(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function tR(t,e){let n=null,r;const i=Bo(t);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const c=t.getBoundingClientRect(),{left:u,top:f,width:h,height:p}=c;if(a||e(),!h||!p)return;const g=kp(f),m=kp(i.clientWidth-(u+h)),b=kp(i.clientHeight-(f+p)),y=kp(u),k={rootMargin:-g+"px "+-m+"px "+-b+"px "+-y+"px",threshold:Ji(0,ol(1,l))||1};let S=!0;function E(M){const O=M[0].intersectionRatio;if(O!==l){if(!S)return o();O?o(!1,O):r=setTimeout(()=>{o(!1,1e-7)},1e3)}O===1&&!uM(c,t.getBoundingClientRect())&&o(),S=!1}try{n=new IntersectionObserver(E,{...k,root:i.ownerDocument})}catch{n=new IntersectionObserver(E,k)}n.observe(t)}return o(!0),s}function nR(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=N1(t),u=i||s?[...c?ff(c):[],...e?ff(e):[]]:[];u.forEach(y=>{i&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const f=c&&a?tR(c,n):null;let h=-1,p=null;o&&(p=new ResizeObserver(y=>{let[_]=y;_&&_.target===c&&p&&e&&(p.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var k;(k=p)==null||k.observe(e)})),n()}),c&&!l&&p.observe(c),e&&p.observe(e));let g,m=l?rc(t):null;l&&b();function b(){const y=rc(t);m&&!uM(m,y)&&n(),m=y,g=requestAnimationFrame(b)}return n(),()=>{var y;u.forEach(_=>{i&&_.removeEventListener("scroll",n),s&&_.removeEventListener("resize",n)}),f==null||f(),(y=p)==null||y.disconnect(),p=null,l&&cancelAnimationFrame(g)}}const rR=NO,iR=IO,sR=CO,oR=LO,aR=OO,lR=PO,cR=zO,uR=(t,e,n)=>{const r=new Map,i={platform:eR,...n},s={...i.platform,_c:r};return AO(t,e,{...i,platform:s})};function _l(t){return typeof t=="function"?t():t}function dM(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function gx(t,e){const n=dM(t);return Math.round(e*n)/n}function mx(t){return{[`--bits-${t}-content-transform-origin`]:"var(--bits-floating-transform-origin)",[`--bits-${t}-content-available-width`]:"var(--bits-floating-available-width)",[`--bits-${t}-content-available-height`]:"var(--bits-floating-available-height)",[`--bits-${t}-anchor-width`]:"var(--bits-floating-anchor-width)",[`--bits-${t}-anchor-height`]:"var(--bits-floating-anchor-height)"}}function dR(t){const e=t.whileElementsMounted,n=V(()=>_l(t.open)??!0),r=V(()=>_l(t.middleware)),i=V(()=>_l(t.transform)??!0),s=V(()=>_l(t.placement)??"bottom"),o=V(()=>_l(t.strategy)??"absolute"),a=V(()=>_l(t.sideOffset)??0),l=V(()=>_l(t.alignOffset)??0),c=t.reference;let u=Se(0),f=Se(0);const h=Gs(null);let p=Se(gn(d(o))),g=Se(gn(d(s))),m=Se(gn({})),b=Se(!1),y=!1,_=0;const k=V(()=>{const C=h.current?gx(h.current,d(u)):d(u),R=h.current?gx(h.current,d(f)):d(f);return d(i)?{position:d(p),left:"0",top:"0",transform:`translate(${C}px, ${R}px)`,...h.current&&dM(h.current)>=1.5&&{willChange:"transform"}}:{position:d(p),left:`${C}px`,top:`${R}px`}});let S;function E(){if(c.current===null||h.current===null)return;const C=c.current,R=h.current,N=++_;uR(C,R,{middleware:d(r),placement:d(s),strategy:d(o)}).then(B=>{if(N!==_||c.current!==C||h.current!==R)return;if(fR(C)){I(m,{...d(m),hide:{...d(m).hide,referenceHidden:!0}},!0);return}if(!d(n)&&d(u)!==0&&d(f)!==0){const H=Math.max(Math.abs(d(a)),Math.abs(d(l)),15);if(B.x<=H&&B.y<=H)return}I(u,B.x,!0),I(f,B.y,!0),I(p,B.strategy,!0),I(g,B.placement,!0),I(m,B.middlewareData,!0),I(b,!0)})}function M(){typeof S=="function"&&(S(),S=void 0),_++}function O(){if(M(),e===void 0){E();return}d(n)&&(c.current===null||h.current===null||(S=e(c.current,h.current,E)))}function P(){!d(n)&&h.current===null&&I(b,!1)}function x(){return[d(r),d(s),d(o),d(a),d(l),d(n)]}return Qt(()=>{e===void 0&&d(n)&&E()}),Qt(O),Qt(()=>{if(e!==void 0){if(x(),!d(n)){y=!1;return}if(!d(b)){y=!1;return}if(!y){y=!0;return}E()}}),Qt(P),Qt(()=>M),{floating:h,reference:c,get strategy(){return d(p)},get placement(){return d(g)},get middlewareData(){return d(m)},get isPositioned(){return d(b)},get floatingStyles(){return d(k)},get update(){return E}}}function fR(t){return t instanceof Element?!t.isConnected||t instanceof HTMLElement&&t.hidden?!0:t.getClientRects().length===0:!1}const hR={top:"bottom",right:"left",bottom:"top",left:"right"},I1=new pl("Floating.Root"),vx=new pl("Floating.Content"),z1=new pl("Floating.Root");class Rg{constructor(){we(this,"anchorNode",Gs(null));we(this,"customAnchorNode",Gs(null));we(this,"triggerNode",Gs(null));Qt(()=>{this.customAnchorNode.current?typeof this.customAnchorNode.current=="string"?this.anchorNode.current=document.querySelector(this.customAnchorNode.current):this.anchorNode.current=this.customAnchorNode.current:this.anchorNode.current=this.triggerNode.current})}static create(e=!1){return e?z1.set(new Rg):I1.set(new Rg)}}var gh,mh,vh,Am,bh,Pm,yh,wh,xh,_h,Sh,kh,Mh,Th,Eh,Ah,Ph,Ch,Oh,Rh,Nh,Ih,zh,Lh;const Cm=class Cm{constructor(e,n){we(this,"opts");we(this,"root");we(this,"contentRef",Gs(null));we(this,"wrapperRef",Gs(null));we(this,"arrowRef",Gs(null));we(this,"contentAttachment",ns(this.contentRef));we(this,"wrapperAttachment",ns(this.wrapperRef));we(this,"arrowAttachment",ns(this.arrowRef));we(this,"arrowId",Gs(np()));Y(this,gh,V(()=>{if(typeof this.opts.style=="string")return jd(this.opts.style);if(!this.opts.style)return{}}));Y(this,mh);Y(this,vh,new DP(()=>this.arrowRef.current??void 0));Y(this,Am,V(()=>{var e;return((e=v(this,vh))==null?void 0:e.width)??0}));Y(this,bh,V(()=>{var e;return((e=v(this,vh))==null?void 0:e.height)??0}));Y(this,Pm,V(()=>{var e;return((e=this.opts.side)==null?void 0:e.current)+(this.opts.align.current!=="center"?`-${this.opts.align.current}`:"")}));Y(this,yh,V(()=>Array.isArray(this.opts.collisionBoundary.current)?this.opts.collisionBoundary.current:[this.opts.collisionBoundary.current]));Y(this,wh,V(()=>d(v(this,yh)).length>0));Y(this,xh,V(()=>({padding:this.opts.collisionPadding.current,boundary:d(v(this,yh)).filter(rC),altBoundary:this.hasExplicitBoundaries})));Y(this,_h,Se(void 0));Y(this,Sh,Se(void 0));Y(this,kh,Se(void 0));Y(this,Mh,Se(void 0));Y(this,Th,V(()=>[rR({mainAxis:this.opts.sideOffset.current+d(v(this,bh)),alignmentAxis:this.opts.alignOffset.current}),this.opts.avoidCollisions.current&&iR({mainAxis:!0,crossAxis:!1,limiter:this.opts.sticky.current==="partial"?cR():void 0,...this.detectOverflowOptions}),this.opts.avoidCollisions.current&&sR({...this.detectOverflowOptions}),oR({...this.detectOverflowOptions,apply:({rects:e,availableWidth:n,availableHeight:r})=>{const{width:i,height:s}=e.reference;I(v(this,_h),n,!0),I(v(this,Sh),r,!0),I(v(this,kh),i,!0),I(v(this,Mh),s,!0)}}),this.arrowRef.current&&lR({element:this.arrowRef.current,padding:this.opts.arrowPadding.current}),pR({arrowWidth:d(v(this,Am)),arrowHeight:d(v(this,bh))}),this.opts.hideWhenDetached.current&&aR({strategy:"referenceHidden",...this.detectOverflowOptions})].filter(Boolean)));we(this,"floating");Y(this,Eh,V(()=>gR(this.floating.placement)));Y(this,Ah,V(()=>mR(this.floating.placement)));Y(this,Ph,V(()=>{var e;return((e=this.floating.middlewareData.arrow)==null?void 0:e.x)??0}));Y(this,Ch,V(()=>{var e;return((e=this.floating.middlewareData.arrow)==null?void 0:e.y)??0}));Y(this,Oh,V(()=>{var e;return((e=this.floating.middlewareData.arrow)==null?void 0:e.centerOffset)!==0}));Y(this,Rh,Se());Y(this,Nh,V(()=>hR[this.placedSide]));Y(this,Ih,V(()=>{var e,n,r;return{id:this.opts.wrapperId.current,"data-bits-floating-content-wrapper":"",style:{...this.floating.floatingStyles,transform:this.floating.isPositioned?this.floating.floatingStyles.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:this.contentZIndex,"--bits-floating-transform-origin":`${(e=this.floating.middlewareData.transformOrigin)==null?void 0:e.x} ${(n=this.floating.middlewareData.transformOrigin)==null?void 0:n.y}`,"--bits-floating-available-width":`${d(v(this,_h))}px`,"--bits-floating-available-height":`${d(v(this,Sh))}px`,"--bits-floating-anchor-width":`${d(v(this,kh))}px`,"--bits-floating-anchor-height":`${d(v(this,Mh))}px`,...((r=this.floating.middlewareData.hide)==null?void 0:r.referenceHidden)&&{visibility:"hidden","pointer-events":"none"},...d(v(this,gh))},dir:this.opts.dir.current,...this.wrapperAttachment}}));Y(this,zh,V(()=>({"data-side":this.placedSide,"data-align":this.placedAlign,style:dk({...d(v(this,gh))}),...this.contentAttachment})));Y(this,Lh,V(()=>({position:"absolute",left:this.arrowX?`${this.arrowX}px`:void 0,top:this.arrowY?`${this.arrowY}px`:void 0,[this.arrowBaseSide]:0,"transform-origin":{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[this.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[this.placedSide],visibility:this.cannotCenterArrow?"hidden":void 0})));this.opts=e,this.root=n,ye(this,mh,e.updatePositionStrategy),e.customAnchor&&(this.root.customAnchorNode.current=e.customAnchor.current),Jr(()=>e.customAnchor.current,r=>{this.root.customAnchorNode.current=r}),this.floating=dR({strategy:()=>this.opts.strategy.current,placement:()=>d(v(this,Pm)),middleware:()=>this.middleware,reference:this.root.anchorNode,whileElementsMounted:(...r)=>{var s;return nR(...r,{animationFrame:((s=v(this,mh))==null?void 0:s.current)==="always"})},open:()=>this.opts.enabled.current,sideOffset:()=>this.opts.sideOffset.current,alignOffset:()=>this.opts.alignOffset.current}),Qt(()=>{var r;this.floating.isPositioned&&((r=this.opts.onPlaced)==null||r.current())}),Jr(()=>this.contentRef.current,r=>{if(!r||!this.opts.enabled.current)return;const i=wg(r),s=i.requestAnimationFrame(()=>{if(this.contentRef.current!==r||!this.opts.enabled.current)return;const o=i.getComputedStyle(r).zIndex;o!==this.contentZIndex&&(this.contentZIndex=o)});return()=>{i.cancelAnimationFrame(s)}}),Qt(()=>{this.floating.floating.current=this.wrapperRef.current})}static create(e,n=!1){return n?vx.set(new Cm(e,z1.get())):vx.set(new Cm(e,I1.get()))}get hasExplicitBoundaries(){return d(v(this,wh))}set hasExplicitBoundaries(e){I(v(this,wh),e)}get detectOverflowOptions(){return d(v(this,xh))}set detectOverflowOptions(e){I(v(this,xh),e)}get middleware(){return d(v(this,Th))}set middleware(e){I(v(this,Th),e)}get placedSide(){return d(v(this,Eh))}set placedSide(e){I(v(this,Eh),e)}get placedAlign(){return d(v(this,Ah))}set placedAlign(e){I(v(this,Ah),e)}get arrowX(){return d(v(this,Ph))}set arrowX(e){I(v(this,Ph),e)}get arrowY(){return d(v(this,Ch))}set arrowY(e){I(v(this,Ch),e)}get cannotCenterArrow(){return d(v(this,Oh))}set cannotCenterArrow(e){I(v(this,Oh),e)}get contentZIndex(){return d(v(this,Rh))}set contentZIndex(e){I(v(this,Rh),e,!0)}get arrowBaseSide(){return d(v(this,Nh))}set arrowBaseSide(e){I(v(this,Nh),e)}get wrapperProps(){return d(v(this,Ih))}set wrapperProps(e){I(v(this,Ih),e)}get props(){return d(v(this,zh))}set props(e){I(v(this,zh),e)}get arrowStyle(){return d(v(this,Lh))}set arrowStyle(e){I(v(this,Lh),e)}};gh=new WeakMap,mh=new WeakMap,vh=new WeakMap,Am=new WeakMap,bh=new WeakMap,Pm=new WeakMap,yh=new WeakMap,wh=new WeakMap,xh=new WeakMap,_h=new WeakMap,Sh=new WeakMap,kh=new WeakMap,Mh=new WeakMap,Th=new WeakMap,Eh=new WeakMap,Ah=new WeakMap,Ph=new WeakMap,Ch=new WeakMap,Oh=new WeakMap,Rh=new WeakMap,Nh=new WeakMap,Ih=new WeakMap,zh=new WeakMap,Lh=new WeakMap;let ab=Cm;class Ng{constructor(e,n){we(this,"opts");we(this,"root");this.opts=e,this.root=n,e.virtualEl&&e.virtualEl.current?n.triggerNode=lk(e.virtualEl.current):n.triggerNode=e.ref}static create(e,n=!1){return n?new Ng(e,z1.get()):new Ng(e,I1.get())}}function pR(t){return{name:"transformOrigin",options:t,fn(e){var b,y,_;const{placement:n,rects:r,middlewareData:i}=e,o=((b=i.arrow)==null?void 0:b.centerOffset)!==0,a=o?0:t.arrowWidth,l=o?0:t.arrowHeight,[c,u]=L1(n),f={start:"0%",center:"50%",end:"100%"}[u],h=(((y=i.arrow)==null?void 0:y.x)??0)+a/2,p=(((_=i.arrow)==null?void 0:_.y)??0)+l/2;let g="",m="";return c==="bottom"?(g=o?f:`${h}px`,m=`${-l}px`):c==="top"?(g=o?f:`${h}px`,m=`${r.floating.height+l}px`):c==="right"?(g=`${-l}px`,m=o?f:`${p}px`):c==="left"&&(g=`${r.floating.width+l}px`,m=o?f:`${p}px`),{data:{x:g,y:m}}}}}function L1(t){const[e,n="center"]=t.split("-");return[e,n]}function gR(t){return L1(t)[0]}function mR(t){return L1(t)[1]}function vR(t,e){Tt(e,!0);let n=te(e,"tooltip",3,!1);Rg.create(n());var r=qe(),i=Me(r);Zt(i,()=>e.children??an),A(t,r),Et()}function bR(t,e){Tt(e,!0);let n=te(e,"tooltip",3,!1);Ng.create({id:st(()=>e.id),virtualEl:st(()=>e.virtualEl),ref:e.ref},n());var r=qe(),i=Me(r);Zt(i,()=>e.children??an),A(t,r),Et()}function yR(t,e){Tt(e,!0);let n=te(e,"side",3,"bottom"),r=te(e,"sideOffset",3,0),i=te(e,"align",3,"center"),s=te(e,"alignOffset",3,0),o=te(e,"arrowPadding",3,0),a=te(e,"avoidCollisions",3,!0),l=te(e,"collisionBoundary",19,()=>[]),c=te(e,"collisionPadding",3,0),u=te(e,"hideWhenDetached",3,!1),f=te(e,"onPlaced",3,()=>{}),h=te(e,"sticky",3,"partial"),p=te(e,"updatePositionStrategy",3,"optimized"),g=te(e,"strategy",3,"fixed"),m=te(e,"dir",3,"ltr"),b=te(e,"style",19,()=>({})),y=te(e,"wrapperId",19,np),_=te(e,"customAnchor",3,null),k=te(e,"tooltip",3,!1);const S=ab.create({side:st(()=>n()),sideOffset:st(()=>r()),align:st(()=>i()),alignOffset:st(()=>s()),id:st(()=>e.id),arrowPadding:st(()=>o()),avoidCollisions:st(()=>a()),collisionBoundary:st(()=>l()),collisionPadding:st(()=>c()),hideWhenDetached:st(()=>u()),onPlaced:st(()=>f()),sticky:st(()=>h()),updatePositionStrategy:st(()=>p()),strategy:st(()=>g()),dir:st(()=>m()),style:st(()=>b()),enabled:st(()=>e.enabled),wrapperId:st(()=>y()),customAnchor:st(()=>_())},k()),E=V(()=>Ci(S.wrapperProps,{style:{pointerEvents:"auto"}}));var M=qe(),O=Me(M);Zt(O,()=>e.content??an,()=>({props:S.props,wrapperProps:d(E)})),A(t,M),Et()}function wR(t,e){Tt(e,!0),os(()=>{var i;(i=e.onPlaced)==null||i.call(e)});var n=qe(),r=Me(n);Zt(r,()=>e.content??an,()=>({props:{},wrapperProps:{}})),A(t,n),Et()}const xR=qm({component:"separator",parts:["root"]});var Dh;const Ky=class Ky{constructor(e){we(this,"opts");we(this,"attachment");Y(this,Dh,V(()=>({id:this.opts.id.current,role:this.opts.decorative.current?"none":"separator","aria-orientation":this.opts.orientation.current,"aria-hidden":$P(this.opts.decorative.current),"data-orientation":this.opts.orientation.current,[xR.root]:"",...this.attachment})));this.opts=e,this.attachment=ns(e.ref)}static create(e){return new Ky(e)}get props(){return d(v(this,Dh))}set props(e){I(v(this,Dh),e)}};Dh=new WeakMap;let lb=Ky;var _R=new Set(["$$slots","$$events","$$legacy","id","ref","child","children","decorative","orientation"]),SR=ne("<div><!></div>");function kR(t,e){const n=fc();Tt(e,!0);let r=te(e,"id",19,()=>gc(n)),i=te(e,"ref",15,null),s=te(e,"decorative",3,!1),o=te(e,"orientation",3,"horizontal"),a=ht(e,_R);const l=lb.create({ref:st(()=>i(),g=>i(g)),id:st(()=>r()),decorative:st(()=>s()),orientation:st(()=>o())}),c=V(()=>Ci(a,l.props));var u=qe(),f=Me(u);{var h=g=>{var m=qe(),b=Me(m);Zt(b,()=>e.child,()=>({props:d(c)})),A(g,m)},p=g=>{var m=SR();_r(m,()=>({...d(c)}));var b=j(m);Zt(b,()=>e.children??an),A(g,m)};xe(f,g=>{e.child?g(h):g(p,-1)})}A(t,u),Et()}var MR=new Set(["$$slots","$$events","$$legacy","content","isStatic","onPlaced"]);function TR(t,e){let n=te(e,"isStatic",3,!1),r=ht(e,MR);var i=qe(),s=Me(i);{var o=l=>{wR(l,{get content(){return e.content},get onPlaced(){return e.onPlaced}})},a=l=>{yR(l,zt({get content(){return e.content},get onPlaced(){return e.onPlaced}},()=>r))};xe(s,l=>{n()?l(o):l(a,-1)})}A(t,i)}var ER=new Set(["$$slots","$$events","$$legacy","popper","onEscapeKeydown","escapeKeydownBehavior","preventOverflowTextSelection","id","onPointerDown","onPointerUp","side","sideOffset","align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","sticky","hideWhenDetached","updatePositionStrategy","strategy","dir","preventScroll","wrapperId","style","onPlaced","onInteractOutside","onCloseAutoFocus","onOpenAutoFocus","onFocusOutside","interactOutsideBehavior","loop","trapFocus","isValidEvent","customAnchor","isStatic","enabled","ref","tooltip","contentPointerEvents"]),AR=ne("<!> <!>",1);function fM(t,e){Tt(e,!0);let n=te(e,"interactOutsideBehavior",3,"close"),r=te(e,"trapFocus",3,!0),i=te(e,"isValidEvent",3,()=>!1),s=te(e,"customAnchor",3,null),o=te(e,"isStatic",3,!1),a=te(e,"tooltip",3,!1),l=te(e,"contentPointerEvents",3,"auto"),c=ht(e,ER);const u=V(()=>e.preventScroll??!0),f=V(()=>e.strategy??(d(u)?"fixed":"absolute"));TR(t,{get isStatic(){return o()},get id(){return e.id},get side(){return e.side},get sideOffset(){return e.sideOffset},get align(){return e.align},get alignOffset(){return e.alignOffset},get arrowPadding(){return e.arrowPadding},get avoidCollisions(){return e.avoidCollisions},get collisionBoundary(){return e.collisionBoundary},get collisionPadding(){return e.collisionPadding},get sticky(){return e.sticky},get hideWhenDetached(){return e.hideWhenDetached},get updatePositionStrategy(){return e.updatePositionStrategy},get strategy(){return d(f)},get dir(){return e.dir},get wrapperId(){return e.wrapperId},get style(){return e.style},get onPlaced(){return e.onPlaced},get customAnchor(){return s()},get enabled(){return e.enabled},get tooltip(){return a()},content:(p,g)=>{let m=()=>(g==null?void 0:g()).props,b=()=>(g==null?void 0:g()).wrapperProps;var y=AR(),_=Me(y);{var k=M=>{sx(M,{get preventScroll(){return d(u)}})},S=M=>{sx(M,{get preventScroll(){return d(u)}})};xe(_,M=>{e.forceMount&&e.enabled?M(k):e.forceMount||M(S,1)})}var E=ee(_,2);tO(E,{get onOpenAutoFocus(){return e.onOpenAutoFocus},get onCloseAutoFocus(){return e.onCloseAutoFocus},get loop(){return e.loop},get enabled(){return e.enabled},get trapFocus(){return r()},get forceMount(){return e.forceMount},get ref(){return e.ref},focusScope:(O,P)=>{let x=()=>(P==null?void 0:P()).props;eO(O,{get onEscapeKeydown(){return e.onEscapeKeydown},get escapeKeydownBehavior(){return e.escapeKeydownBehavior},get enabled(){return e.enabled},get ref(){return e.ref},children:(C,R)=>{QC(C,{get id(){return e.id},get onInteractOutside(){return e.onInteractOutside},get onFocusOutside(){return e.onFocusOutside},get interactOutsideBehavior(){return n()},get isValidEvent(){return i()},get enabled(){return e.enabled},get ref(){return e.ref},children:(B,z)=>{let H=()=>(z==null?void 0:z()).props;iO(B,{get id(){return e.id},get preventOverflowTextSelection(){return e.preventOverflowTextSelection},get onPointerDown(){return e.onPointerDown},get onPointerUp(){return e.onPointerUp},get enabled(){return e.enabled},get ref(){return e.ref},children:(X,G)=>{var Z=qe(),oe=Me(Z);{let K=V(()=>({props:Ci(c,m(),H(),x(),{style:{pointerEvents:l()}}),wrapperProps:b()}));Zt(oe,()=>e.popper??an,()=>d(K))}A(X,Z)},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{focusScope:!0}}),A(p,y)},$$slots:{content:!0}}),Et()}var PR=new Set(["$$slots","$$events","$$legacy","popper","open","onEscapeKeydown","escapeKeydownBehavior","preventOverflowTextSelection","id","onPointerDown","onPointerUp","side","sideOffset","align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","sticky","hideWhenDetached","updatePositionStrategy","strategy","dir","preventScroll","wrapperId","style","onPlaced","onInteractOutside","onCloseAutoFocus","onOpenAutoFocus","onFocusOutside","interactOutsideBehavior","loop","trapFocus","isValidEvent","customAnchor","isStatic","ref","shouldRender"]);function CR(t,e){let n=te(e,"interactOutsideBehavior",3,"close"),r=te(e,"trapFocus",3,!0),i=te(e,"isValidEvent",3,()=>!1),s=te(e,"customAnchor",3,null),o=te(e,"isStatic",3,!1),a=ht(e,PR);var l=qe(),c=Me(l);{var u=f=>{fM(f,zt({get popper(){return e.popper},get onEscapeKeydown(){return e.onEscapeKeydown},get escapeKeydownBehavior(){return e.escapeKeydownBehavior},get preventOverflowTextSelection(){return e.preventOverflowTextSelection},get id(){return e.id},get onPointerDown(){return e.onPointerDown},get onPointerUp(){return e.onPointerUp},get side(){return e.side},get sideOffset(){return e.sideOffset},get align(){return e.align},get alignOffset(){return e.alignOffset},get arrowPadding(){return e.arrowPadding},get avoidCollisions(){return e.avoidCollisions},get collisionBoundary(){return e.collisionBoundary},get collisionPadding(){return e.collisionPadding},get sticky(){return e.sticky},get hideWhenDetached(){return e.hideWhenDetached},get updatePositionStrategy(){return e.updatePositionStrategy},get strategy(){return e.strategy},get dir(){return e.dir},get preventScroll(){return e.preventScroll},get wrapperId(){return e.wrapperId},get style(){return e.style},get onPlaced(){return e.onPlaced},get customAnchor(){return s()},get isStatic(){return o()},get enabled(){return e.open},get onInteractOutside(){return e.onInteractOutside},get onCloseAutoFocus(){return e.onCloseAutoFocus},get onOpenAutoFocus(){return e.onOpenAutoFocus},get interactOutsideBehavior(){return n()},get loop(){return e.loop},get trapFocus(){return r()},get isValidEvent(){return i()},get onFocusOutside(){return e.onFocusOutside},forceMount:!1,get ref(){return e.ref}},()=>a))};xe(c,f=>{e.shouldRender&&f(u)})}A(t,l)}var OR=new Set(["$$slots","$$events","$$legacy","popper","onEscapeKeydown","escapeKeydownBehavior","preventOverflowTextSelection","id","onPointerDown","onPointerUp","side","sideOffset","align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","sticky","hideWhenDetached","updatePositionStrategy","strategy","dir","preventScroll","wrapperId","style","onPlaced","onInteractOutside","onCloseAutoFocus","onOpenAutoFocus","onFocusOutside","interactOutsideBehavior","loop","trapFocus","isValidEvent","customAnchor","isStatic","enabled"]);function RR(t,e){let n=te(e,"interactOutsideBehavior",3,"close"),r=te(e,"trapFocus",3,!0),i=te(e,"isValidEvent",3,()=>!1),s=te(e,"customAnchor",3,null),o=te(e,"isStatic",3,!1),a=ht(e,OR);fM(t,zt({get popper(){return e.popper},get onEscapeKeydown(){return e.onEscapeKeydown},get escapeKeydownBehavior(){return e.escapeKeydownBehavior},get preventOverflowTextSelection(){return e.preventOverflowTextSelection},get id(){return e.id},get onPointerDown(){return e.onPointerDown},get onPointerUp(){return e.onPointerUp},get side(){return e.side},get sideOffset(){return e.sideOffset},get align(){return e.align},get alignOffset(){return e.alignOffset},get arrowPadding(){return e.arrowPadding},get avoidCollisions(){return e.avoidCollisions},get collisionBoundary(){return e.collisionBoundary},get collisionPadding(){return e.collisionPadding},get sticky(){return e.sticky},get hideWhenDetached(){return e.hideWhenDetached},get updatePositionStrategy(){return e.updatePositionStrategy},get strategy(){return e.strategy},get dir(){return e.dir},get preventScroll(){return e.preventScroll},get wrapperId(){return e.wrapperId},get style(){return e.style},get onPlaced(){return e.onPlaced},get customAnchor(){return s()},get isStatic(){return o()},get enabled(){return e.enabled},get onInteractOutside(){return e.onInteractOutside},get onCloseAutoFocus(){return e.onCloseAutoFocus},get onOpenAutoFocus(){return e.onOpenAutoFocus},get interactOutsideBehavior(){return n()},get loop(){return e.loop},get trapFocus(){return r()},get isValidEvent(){return i()},get onFocusOutside(){return e.onFocusOutside}},()=>a,{forceMount:!0}))}function NR(t,e){Tt(e,!0);let n=te(e,"open",15,!1),r=te(e,"dir",3,"ltr"),i=te(e,"onOpenChange",3,vr),s=te(e,"onOpenChangeComplete",3,vr);const o=Wv.create({variant:st(()=>"context-menu"),dir:st(()=>r()),onClose:()=>{var a;n(!1),(a=i())==null||a(!1)}});Ag.create({open:st(()=>n(),a=>{n(a),i()(a)}),onOpenChangeComplete:st(()=>s())},o),vR(t,{children:(a,l)=>{var c=qe(),u=Me(c);Zt(u,()=>e.children??an),A(a,c)},$$slots:{default:!0}}),Et()}var IR=new Set(["$$slots","$$events","$$legacy","child","children","ref","id","disabled","onSelect","closeOnSelect"]),zR=ne("<div><!></div>");function LR(t,e){const n=fc();Tt(e,!0);let r=te(e,"ref",15,null),i=te(e,"id",19,()=>gc(n)),s=te(e,"disabled",3,!1),o=te(e,"onSelect",3,vr),a=te(e,"closeOnSelect",3,!0),l=ht(e,IR);const c=Hv.create({id:st(()=>i()),disabled:st(()=>s()),onSelect:st(()=>o()),ref:st(()=>r(),m=>r(m)),closeOnSelect:st(()=>a())}),u=V(()=>Ci(l,c.props));var f=qe(),h=Me(f);{var p=m=>{var b=qe(),y=Me(b);Zt(y,()=>e.child,()=>({props:d(u)})),A(m,b)},g=m=>{var b=zR();_r(b,()=>({...d(u)}));var y=j(b);Zt(y,()=>e.children??an),A(m,b)};xe(h,m=>{e.child?m(p):m(g,-1)})}A(t,f),Et()}var DR=new Set(["$$slots","$$events","$$legacy","id","child","children","ref","loop","onInteractOutside","onCloseAutoFocus","onOpenAutoFocus","preventScroll","side","sideOffset","align","onEscapeKeydown","forceMount","trapFocus","style"]),bx=ne("<div><div><!></div></div>");function FR(t,e){Tt(e,!0);let n=te(e,"id",19,np),r=te(e,"ref",15,null),i=te(e,"loop",3,!0),s=te(e,"onInteractOutside",3,vr),o=te(e,"onCloseAutoFocus",3,vr),a=te(e,"onOpenAutoFocus",3,vr),l=te(e,"preventScroll",3,!0),c=te(e,"side",3,"right"),u=te(e,"sideOffset",3,2),f=te(e,"align",3,"start"),h=te(e,"onEscapeKeydown",3,vr),p=te(e,"forceMount",3,!1),g=te(e,"trapFocus",3,!1),m=ht(e,DR);const b=qv.create({id:st(()=>n()),loop:st(()=>i()),ref:st(()=>r(),x=>r(x)),onCloseAutoFocus:st(()=>o())}),y=V(()=>Ci(m,b.props,{side:c(),sideOffset:u(),align:f(),onOpenAutoFocus:a(),isValidEvent:S,trapFocus:g(),loop:i(),id:n(),ref:b.opts.ref,preventScroll:l(),onInteractOutside:_,onEscapeKeydown:k,shouldRender:b.shouldRender}));function _(x){if(s()(x),!x.defaultPrevented){if(x.target&&x.target instanceof Element){const C=`[${b.parentMenu.root.getBitsAttr("sub-content")}]`;if(x.target.closest(C))return}b.parentMenu.onClose()}}function k(x){h()(x),!x.defaultPrevented&&b.parentMenu.onClose()}function S(x){if("button"in x&&x.button===2){const C=x.target;return C?C.closest(`[${k1}]`)!==b.parentMenu.triggerNode:!1}return!1}var E=qe(),M=Me(E);{var O=x=>{RR(x,zt(()=>d(y),()=>b.popperProps,{get enabled(){return b.parentMenu.opts.open.current},popper:(R,N)=>{let B=()=>(N==null?void 0:N()).props,z=()=>(N==null?void 0:N()).wrapperProps;const H=V(()=>Ci(B(),{style:mx("context-menu")},{style:e.style}));var X=qe(),G=Me(X);{var Z=K=>{var q=qe(),W=Me(q);{let J=V(()=>({props:d(H),wrapperProps:z(),...b.snippetProps}));Zt(W,()=>e.child,()=>d(J))}A(K,q)},oe=K=>{var q=bx();_r(q,()=>({...z()}));var W=j(q);_r(W,()=>({...d(H)}));var J=j(W);Zt(J,()=>e.children??an),A(K,q)};xe(G,K=>{e.child?K(Z):K(oe,-1)})}A(R,X)},$$slots:{popper:!0}}))},P=x=>{CR(x,zt(()=>d(y),()=>b.popperProps,{get open(){return b.parentMenu.opts.open.current},popper:(R,N)=>{let B=()=>(N==null?void 0:N()).props,z=()=>(N==null?void 0:N()).wrapperProps;const H=V(()=>Ci(B(),{style:mx("context-menu")},{style:e.style}));var X=qe(),G=Me(X);{var Z=K=>{var q=qe(),W=Me(q);{let J=V(()=>({props:d(H),wrapperProps:z(),...b.snippetProps}));Zt(W,()=>e.child,()=>d(J))}A(K,q)},oe=K=>{var q=bx();_r(q,()=>({...z()}));var W=j(q);_r(W,()=>({...d(H)}));var J=j(W);Zt(J,()=>e.children??an),A(K,q)};xe(G,K=>{e.child?K(Z):K(oe,-1)})}A(R,X)},$$slots:{popper:!0}}))};xe(M,x=>{p()?x(O):p()||x(P,1)})}A(t,E),Et()}var BR=new Set(["$$slots","$$events","$$legacy","id","ref","child","children","disabled"]),jR=ne("<div><!></div>");function UR(t,e){Tt(e,!0);let n=te(e,"id",19,np),r=te(e,"ref",15,null),i=te(e,"disabled",3,!1),s=ht(e,BR);const o=$v.create({id:st(()=>n()),disabled:st(()=>i()),ref:st(()=>r(),u=>r(u))}),a=V(()=>Ci(s,o.props,{style:{pointerEvents:"auto"}},{style:e.style,tabindex:e.tabindex}));var l=qe(),c=Me(l);Tn(c,()=>bR,(u,f)=>{f(u,{get id(){return n()},get virtualEl(){return o.virtualElement},get ref(){return o.opts.ref},children:(h,p)=>{var g=qe(),m=Me(g);{var b=_=>{var k=qe(),S=Me(k);Zt(S,()=>e.child,()=>({props:d(a)})),A(_,k)},y=_=>{var k=jR();_r(k,()=>({...d(a)}));var S=j(k);Zt(S,()=>e.children??an),A(_,k)};xe(m,_=>{e.child?_(b):_(y,-1)})}A(h,g)},$$slots:{default:!0}})}),A(t,l),Et()}var WR=new Set(["$$slots","$$events","$$legacy","ref","id","child","children"]),qR=ne("<div><!></div>");function HR(t,e){const n=fc();Tt(e,!0);let r=te(e,"ref",15,null),i=te(e,"id",19,()=>gc(n)),s=ht(e,WR);const o=Vv.create({id:st(()=>i()),ref:st(()=>r(),h=>r(h))}),a=V(()=>Ci(s,o.props));var l=qe(),c=Me(l);{var u=h=>{var p=qe(),g=Me(p);Zt(g,()=>e.child,()=>({props:d(a)})),A(h,p)},f=h=>{var p=qR();_r(p,()=>({...d(a)}));var g=j(p);Zt(g,()=>e.children??an),A(h,p)};xe(c,h=>{e.child?h(u):h(f,-1)})}A(t,l),Et()}const VR=qm({component:"label",parts:["root"]});var Fh;const Xy=class Xy{constructor(e){we(this,"opts");we(this,"attachment");Y(this,Fh,V(()=>({id:this.opts.id.current,[VR.root]:"",onmousedown:this.onmousedown,...this.attachment})));this.opts=e,this.attachment=ns(this.opts.ref),this.onmousedown=this.onmousedown.bind(this)}static create(e){return new Xy(e)}onmousedown(e){e.detail>1&&e.preventDefault()}get props(){return d(v(this,Fh))}set props(e){I(v(this,Fh),e)}};Fh=new WeakMap;let cb=Xy;var $R=new Set(["$$slots","$$events","$$legacy","children","child","id","ref","for"]),GR=ne("<label><!></label>");function YR(t,e){const n=fc();Tt(e,!0);let r=te(e,"id",19,()=>gc(n)),i=te(e,"ref",15,null),s=ht(e,$R);const o=cb.create({id:st(()=>r()),ref:st(()=>i(),h=>i(h))}),a=V(()=>Ci(s,o.props,{for:e.for}));var l=qe(),c=Me(l);{var u=h=>{var p=qe(),g=Me(p);Zt(g,()=>e.child,()=>({props:d(a)})),A(h,p)},f=h=>{var p=GR();_r(p,()=>({...d(a),for:e.for}));var g=j(p);Zt(g,()=>e.children??an),A(h,p)};xe(c,h=>{e.child?h(u):h(f,-1)})}A(t,l),Et()}var KR=new Set(["$$slots","$$events","$$legacy","ref","class"]);function XR(t,e){Tt(e,!0);let n=te(e,"ref",15,null),r=ht(e,KR);var i=qe(),s=Me(i);{let o=V(()=>ss("gap-2 text-sm leading-none font-medium group-data-[disabled=true]:opacity-50 peer-disabled:opacity-50 flex items-center select-none group-data-[disabled=true]:pointer-events-none peer-disabled:cursor-not-allowed",e.class));Tn(s,()=>YR,(a,l)=>{l(a,zt({"data-slot":"label",get class(){return d(o)}},()=>r,{get ref(){return n()},set ref(c){n(c)}}))})}A(t,i),Et()}var ZR=/\s+/g,QR=t=>typeof t!="string"||!t?t:t.replace(ZR," ").trim(),Ig=(...t)=>{const e=[],n=r=>{if(!r&&r!==0&&r!==0n)return;if(Array.isArray(r)){for(let s=0,o=r.length;s<o;s++)n(r[s]);return}const i=typeof r;if(i==="string"||i==="number"||i==="bigint"){if(i==="number"&&r!==r)return;e.push(String(r))}else if(i==="object"){const s=Object.keys(r);for(let o=0,a=s.length;o<a;o++){const l=s[o];r[l]&&e.push(l)}}};for(let r=0,i=t.length;r<i;r++){const s=t[r];s!=null&&n(s)}return e.length>0?QR(e.join(" ")):void 0},yx=t=>t===!1?"false":t===!0?"true":t===0?"0":t,Ri=t=>{if(!t||typeof t!="object")return!0;for(const e in t)return!1;return!0},JR=(t,e)=>{if(t===e)return!0;if(!t||!e)return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let i=0;i<n.length;i++){const s=n[i];if(!r.includes(s)||t[s]!==e[s])return!1}return!0},e4=(t,e)=>{for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const r=e[n];n in t?t[n]=Ig(t[n],r):t[n]=r}return t},hM=(t,e)=>{for(let n=0;n<t.length;n++){const r=t[n];Array.isArray(r)?hM(r,e):r&&e.push(r)}},pM=(...t)=>{const e=[];hM(t,e);const n=[];for(let r=0;r<e.length;r++)e[r]&&n.push(e[r]);return n},ub=(t,e)=>{const n={};for(const r in t){const i=t[r];if(r in e){const s=e[r];Array.isArray(i)||Array.isArray(s)?n[r]=pM(s,i):typeof i=="object"&&typeof s=="object"&&i&&s?n[r]=ub(i,s):n[r]=s+" "+i}else n[r]=i}for(const r in e)r in t||(n[r]=e[r]);return n},t4={twMerge:!0,twMergeConfig:{}};function n4(){let t=null,e={},n=!1;return{get cachedTwMerge(){return t},set cachedTwMerge(r){t=r},get cachedTwMergeConfig(){return e},set cachedTwMergeConfig(r){e=r},get didTwMergeConfigChange(){return n},set didTwMergeConfigChange(r){n=r},reset(){t=null,e={},n=!1}}}var qo=n4(),r4=t=>{const e=(r,i)=>{const{extend:s=null,slots:o={},variants:a={},compoundVariants:l=[],compoundSlots:c=[],defaultVariants:u={}}=r,f={...t4,...i},h=s!=null&&s.base?Ig(s.base,r==null?void 0:r.base):r==null?void 0:r.base,p=s!=null&&s.variants&&!Ri(s.variants)?ub(a,s.variants):a,g=s!=null&&s.defaultVariants&&!Ri(s.defaultVariants)?{...s.defaultVariants,...u}:u;!Ri(f.twMergeConfig)&&!JR(f.twMergeConfig,qo.cachedTwMergeConfig)&&(qo.didTwMergeConfigChange=!0,qo.cachedTwMergeConfig=f.twMergeConfig);const m=Ri(s==null?void 0:s.slots),b=Ri(o)?{}:{base:Ig(r==null?void 0:r.base,m&&(s==null?void 0:s.base)),...o},y=m?b:e4({...s==null?void 0:s.slots},Ri(b)?{base:r==null?void 0:r.base}:b),_=Ri(s==null?void 0:s.compoundVariants)?l:pM(s==null?void 0:s.compoundVariants,l),k=E=>{if(Ri(p)&&Ri(o)&&m)return t(h,E==null?void 0:E.class,E==null?void 0:E.className)(f);if(_&&!Array.isArray(_))throw new TypeError(`The "compoundVariants" prop must be an array. Received: ${typeof _}`);if(c&&!Array.isArray(c))throw new TypeError(`The "compoundSlots" prop must be an array. Received: ${typeof c}`);const M=(z,H=p,X=null,G=null)=>{const Z=H[z];if(!Z||Ri(Z))return null;const oe=(G==null?void 0:G[z])??(E==null?void 0:E[z]);if(oe===null)return null;const K=yx(oe);if(typeof K=="object")return null;const q=g==null?void 0:g[z],W=K??yx(q);return Z[W||"false"]},O=()=>{if(!p)return null;const z=Object.keys(p),H=[];for(let X=0;X<z.length;X++){const G=M(z[X],p);G&&H.push(G)}return H},P=(z,H)=>{if(!p||typeof p!="object")return null;const X=[];for(const G in p){const Z=M(G,p,z,H),oe=z==="base"&&typeof Z=="string"?Z:Z&&Z[z];oe&&X.push(oe)}return X},x={};for(const z in E){const H=E[z];H!==void 0&&(x[z]=H)}const C=(z,H)=>{var G;const X=typeof(E==null?void 0:E[z])=="object"?{[z]:(G=E[z])==null?void 0:G.initial}:{};return{...g,...x,...X,...H}},R=(z=[],H)=>{const X=[],G=z.length;for(let Z=0;Z<G;Z++){const{class:oe,className:K,...q}=z[Z];let W=!0;const J=C(null,H);for(const fe in q){const $=q[fe],de=J[fe];if(Array.isArray($)){if(!$.includes(de)){W=!1;break}}else{if(($==null||$===!1)&&(de==null||de===!1))continue;if(de!==$){W=!1;break}}}W&&(oe&&X.push(oe),K&&X.push(K))}return X},N=z=>{const H=R(_,z);if(!Array.isArray(H))return H;const X={},G=t;for(let Z=0;Z<H.length;Z++){const oe=H[Z];if(typeof oe=="string")X.base=G(X.base,oe)(f);else if(typeof oe=="object")for(const K in oe)X[K]=G(X[K],oe[K])(f)}return X},B=z=>{if(c.length<1)return null;const H={},X=C(null,z);for(let G=0;G<c.length;G++){const{slots:Z=[],class:oe,className:K,...q}=c[G];if(!Ri(q)){let W=!0;for(const J in q){const fe=X[J],$=q[J];if(fe===void 0||(Array.isArray($)?!$.includes(fe):$!==fe)){W=!1;break}}if(!W)continue}for(let W=0;W<Z.length;W++){const J=Z[W];H[J]||(H[J]=[]),H[J].push([oe,K])}}return H};if(!Ri(o)||!m){const z={};if(typeof y=="object"&&!Ri(y)){const H=t;for(const X in y)z[X]=G=>{const Z=N(G),oe=B(G);return H(y[X],P(X,G),Z?Z[X]:void 0,oe?oe[X]:void 0,G==null?void 0:G.class,G==null?void 0:G.className)(f)}}return z}return t(h,O(),R(_),E==null?void 0:E.class,E==null?void 0:E.className)(f)},S=()=>{if(!(!p||typeof p!="object"))return Object.keys(p)};return k.variantKeys=S(),k.extend=s,k.base=h,k.slots=y,k.variants=p,k.defaultVariants=g,k.compoundSlots=c,k.compoundVariants=_,k};return{tv:e,createTV:r=>(i,s)=>e(i,s?ub(r,s):r)}},i4=t=>Ri(t)?ak:tP({...t,extend:{theme:t.theme,classGroups:t.classGroups,conflictingClassGroupModifiers:t.conflictingClassGroupModifiers,conflictingClassGroups:t.conflictingClassGroups,...t.extend}}),s4=(t,e)=>{const n=Ig(t);return!n||!((e==null?void 0:e.twMerge)??!0)?n:((!qo.cachedTwMerge||qo.didTwMergeConfigChange)&&(qo.didTwMergeConfigChange=!1,qo.cachedTwMerge=i4(qo.cachedTwMergeConfig)),qo.cachedTwMerge(n)||void 0)},o4=(...t)=>e=>s4(t,e),{tv:gM}=r4(o4);const wx=gM({base:"focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-md border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-3 active:not-aria-[haspopup]:translate-y-px aria-invalid:ring-3 [&_svg:not([class*='size-'])]:size-4 group/button inline-flex shrink-0 items-center justify-center whitespace-nowrap transition-all outline-none select-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground shadow-xs",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground",destructive:"bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",lg:"h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-9","icon-xs":"size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});var a4=new Set(["$$slots","$$events","$$legacy","class","variant","size","ref","href","type","disabled","children"]),l4=ne("<a><!></a>"),c4=ne("<button><!></button>");function Rr(t,e){Tt(e,!0);let n=te(e,"variant",3,"default"),r=te(e,"size",3,"default"),i=te(e,"ref",15,null),s=te(e,"href",3,void 0),o=te(e,"type",3,"button"),a=ht(e,a4);var l=qe(),c=Me(l);{var u=h=>{var p=l4();_r(p,m=>({"data-slot":"button",class:m,href:e.disabled?void 0:s(),"aria-disabled":e.disabled,role:e.disabled?"link":void 0,tabindex:e.disabled?-1:void 0,...a}),[()=>ss(wx({variant:n(),size:r()}),e.class)]);var g=j(p);Zt(g,()=>e.children??an),kr(p,m=>i(m),()=>i()),A(h,p)},f=h=>{var p=c4();_r(p,m=>({"data-slot":"button",class:m,type:o(),disabled:e.disabled,...a}),[()=>ss(wx({variant:n(),size:r()}),e.class)]);var g=j(p);Zt(g,()=>e.children??an),kr(p,m=>i(m),()=>i()),A(h,p)};xe(c,h=>{s()?h(u):h(f,-1)})}A(t,l),Et()}var u4=new Set(["$$slots","$$events","$$legacy","ref","class","data-slot"]);function xx(t,e){Tt(e,!0);let n=te(e,"ref",15,null),r=te(e,"data-slot",3,"separator"),i=ht(e,u4);var s=qe(),o=Me(s);{let a=V(()=>ss("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px","data-[orientation=vertical]:h-full",e.class));Tn(o,()=>kR,(l,c)=>{c(l,zt({get"data-slot"(){return r()},get class(){return d(a)}},()=>i,{get ref(){return n()},set ref(u){n(u)}}))})}A(t,s),Et()}/**
* @file
* @license @lucide/svelte v1.25.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const d4={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};/**
* @file
* @license @lucide/svelte v1.25.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const f4=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};/**
* @file
* @license @lucide/svelte v1.25.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const h4=Symbol("lucide-context"),p4=()=>Fu(h4);var g4=new Set(["$$slots","$$events","$$legacy","name","color","size","strokeWidth","absoluteStrokeWidth","iconNode","children"]),m4=Ui("<svg><!><!></svg>");function dn(t,e){Tt(e,!0);const n=p4()??{},r=te(e,"color",19,()=>n.color??"currentColor"),i=te(e,"size",19,()=>n.size??24),s=te(e,"strokeWidth",19,()=>n.strokeWidth??2),o=te(e,"absoluteStrokeWidth",19,()=>n.absoluteStrokeWidth??!1),a=te(e,"iconNode",19,()=>[]),l=ht(e,g4),c=V(()=>o()?Number(s())*24/Number(i()):s());var u=m4();_r(u,p=>({...d4,...p,...l,width:i(),height:i(),stroke:r(),"stroke-width":d(c),class:["lucide-icon lucide",n.class,e.name&&`lucide-${e.name}`,e.class]}),[()=>!e.children&&!f4(l)&&{"aria-hidden":"true"}]);var f=j(u);Rn(f,17,a,$s,(p,g)=>{var m=V(()=>j2(d(g),2));let b=()=>d(m)[0],y=()=>d(m)[1];var _=qe(),k=Me(_);jS(k,b,!0,(S,E)=>{_r(S,()=>({...y()}))}),A(p,_)});var h=ee(f);Zt(h,()=>e.children??an),A(t,u),Et()}var v4=new Set(["$$slots","$$events","$$legacy"]);function b4(t,e){let n=ht(e,v4);const r=[["path",{d:"M12 17V3"}],["path",{d:"m6 11 6 6 6-6"}],["path",{d:"M19 21H5"}]];dn(t,zt({name:"arrow-down-to-line"},()=>n,{get iconNode(){return r}}))}var y4=new Set(["$$slots","$$events","$$legacy"]);function w4(t,e){let n=ht(e,y4);const r=[["path",{d:"m5 12 7-7 7 7"}],["path",{d:"M12 19V5"}]];dn(t,zt({name:"arrow-up"},()=>n,{get iconNode(){return r}}))}var x4=new Set(["$$slots","$$events","$$legacy"]);function _4(t,e){let n=ht(e,x4);const r=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z"}],["path",{d:"m7 16.5-4.74-2.85"}],["path",{d:"m7 16.5 5-3"}],["path",{d:"M7 16.5v5.17"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z"}],["path",{d:"m17 16.5-5-3"}],["path",{d:"m17 16.5 4.74-2.85"}],["path",{d:"M17 16.5v5.17"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z"}],["path",{d:"M12 8 7.26 5.15"}],["path",{d:"m12 8 4.74-2.85"}],["path",{d:"M12 13.5V8"}]];dn(t,zt({name:"boxes"},()=>n,{get iconNode(){return r}}))}var S4=new Set(["$$slots","$$events","$$legacy"]);function k4(t,e){let n=ht(e,S4);const r=[["path",{d:"M12 18V5"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77"}]];dn(t,zt({name:"brain"},()=>n,{get iconNode(){return r}}))}var M4=new Set(["$$slots","$$events","$$legacy"]);function zg(t,e){let n=ht(e,M4);const r=[["path",{d:"M20 6 9 17l-5-5"}]];dn(t,zt({name:"check"},()=>n,{get iconNode(){return r}}))}var T4=new Set(["$$slots","$$events","$$legacy"]);function E4(t,e){let n=ht(e,T4);const r=[["path",{d:"m6 9 6 6 6-6"}]];dn(t,zt({name:"chevron-down"},()=>n,{get iconNode(){return r}}))}var A4=new Set(["$$slots","$$events","$$legacy"]);function D1(t,e){let n=ht(e,A4);const r=[["path",{d:"m9 18 6-6-6-6"}]];dn(t,zt({name:"chevron-right"},()=>n,{get iconNode(){return r}}))}var P4=new Set(["$$slots","$$events","$$legacy"]);function C4(t,e){let n=ht(e,P4);const r=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"m9 12 2 2 4-4"}]];dn(t,zt({name:"circle-check"},()=>n,{get iconNode(){return r}}))}var O4=new Set(["$$slots","$$events","$$legacy"]);function R4(t,e){let n=ht(e,O4);const r=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}],["path",{d:"M12 17h.01"}]];dn(t,zt({name:"circle-question-mark"},()=>n,{get iconNode(){return r}}))}var N4=new Set(["$$slots","$$events","$$legacy"]);function I4(t,e){let n=ht(e,N4);const r=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}]];dn(t,zt({name:"copy"},()=>n,{get iconNode(){return r}}))}var z4=new Set(["$$slots","$$events","$$legacy"]);function L4(t,e){let n=ht(e,z4);const r=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4"}],["path",{d:"m9 10-5 5 5 5"}]];dn(t,zt({name:"corner-down-left"},()=>n,{get iconNode(){return r}}))}var D4=new Set(["$$slots","$$events","$$legacy"]);function F4(t,e){let n=ht(e,D4);const r=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5"}],["path",{d:"M3 12A9 3 0 0 0 21 12"}]];dn(t,zt({name:"database"},()=>n,{get iconNode(){return r}}))}var B4=new Set(["$$slots","$$events","$$legacy"]);function j4(t,e){let n=ht(e,B4);const r=[["path",{d:"M12 2C8 2 4 8 4 14a8 8 0 0 0 16 0c0-6-4-12-8-12"}]];dn(t,zt({name:"egg"},()=>n,{get iconNode(){return r}}))}var U4=new Set(["$$slots","$$events","$$legacy"]);function W4(t,e){let n=ht(e,U4);const r=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 16v-4"}],["path",{d:"M12 8h.01"}]];dn(t,zt({name:"info"},()=>n,{get iconNode(){return r}}))}var q4=new Set(["$$slots","$$events","$$legacy"]);function H4(t,e){let n=ht(e,q4);const r=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"}]];dn(t,zt({name:"layers"},()=>n,{get iconNode(){return r}}))}var V4=new Set(["$$slots","$$events","$$legacy"]);function $4(t,e){let n=ht(e,V4);const r=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1"}]];dn(t,zt({name:"layout-grid"},()=>n,{get iconNode(){return r}}))}var G4=new Set(["$$slots","$$events","$$legacy"]);function Y4(t,e){let n=ht(e,G4);const r=[["path",{d:"M13 5h8"}],["path",{d:"M13 12h8"}],["path",{d:"M13 19h8"}],["path",{d:"m3 17 2 2 4-4"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1"}]];dn(t,zt({name:"list-todo"},()=>n,{get iconNode(){return r}}))}var K4=new Set(["$$slots","$$events","$$legacy"]);function db(t,e){let n=ht(e,K4);const r=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56"}]];dn(t,zt({name:"loader-circle"},()=>n,{get iconNode(){return r}}))}var X4=new Set(["$$slots","$$events","$$legacy"]);function Z4(t,e){let n=ht(e,X4);const r=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}]];dn(t,zt({name:"lock"},()=>n,{get iconNode(){return r}}))}var Q4=new Set(["$$slots","$$events","$$legacy"]);function J4(t,e){let n=ht(e,Q4);const r=[["path",{d:"m10 17 5-5-5-5"}],["path",{d:"M15 12H3"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4"}]];dn(t,zt({name:"log-in"},()=>n,{get iconNode(){return r}}))}var eN=new Set(["$$slots","$$events","$$legacy"]);function tN(t,e){let n=ht(e,eN);const r=[["path",{d:"M15 3h6v6"}],["path",{d:"m21 3-7 7"}],["path",{d:"m3 21 7-7"}],["path",{d:"M9 21H3v-6"}]];dn(t,zt({name:"maximize-2"},()=>n,{get iconNode(){return r}}))}var nN=new Set(["$$slots","$$events","$$legacy"]);function rN(t,e){let n=ht(e,nN);const r=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"}]];dn(t,zt({name:"message-square"},()=>n,{get iconNode(){return r}}))}var iN=new Set(["$$slots","$$events","$$legacy"]);function sN(t,e){let n=ht(e,iN);const r=[["path",{d:"M5 12h14"}]];dn(t,zt({name:"minus"},()=>n,{get iconNode(){return r}}))}var oN=new Set(["$$slots","$$events","$$legacy"]);function aN(t,e){let n=ht(e,oN);const r=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21"}]];dn(t,zt({name:"monitor"},()=>n,{get iconNode(){return r}}))}var lN=new Set(["$$slots","$$events","$$legacy"]);function cN(t,e){let n=ht(e,lN);const r=[["path",{d:"m15 9-6 6"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z"}],["path",{d:"m9 9 6 6"}]];dn(t,zt({name:"octagon-x"},()=>n,{get iconNode(){return r}}))}var uN=new Set(["$$slots","$$events","$$legacy"]);function dN(t,e){let n=ht(e,uN);const r=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor"}]];dn(t,zt({name:"palette"},()=>n,{get iconNode(){return r}}))}var fN=new Set(["$$slots","$$events","$$legacy"]);function hN(t,e){let n=ht(e,fN);const r=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1"}]];dn(t,zt({name:"pause"},()=>n,{get iconNode(){return r}}))}var pN=new Set(["$$slots","$$events","$$legacy"]);function gN(t,e){let n=ht(e,pN);const r=[["path",{d:"m15 14 5-5-5-5"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13"}]];dn(t,zt({name:"redo-2"},()=>n,{get iconNode(){return r}}))}var mN=new Set(["$$slots","$$events","$$legacy"]);function _x(t,e){let n=ht(e,mN);const r=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}],["path",{d:"M8 16H3v5"}]];dn(t,zt({name:"refresh-cw"},()=>n,{get iconNode(){return r}}))}var vN=new Set(["$$slots","$$events","$$legacy"]);function bN(t,e){let n=ht(e,vN);const r=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}],["path",{d:"M3 3v5h5"}]];dn(t,zt({name:"rotate-ccw"},()=>n,{get iconNode(){return r}}))}var yN=new Set(["$$slots","$$events","$$legacy"]);function wN(t,e){let n=ht(e,yN);const r=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M21 9H3"}],["path",{d:"M21 15H3"}]];dn(t,zt({name:"rows-3"},()=>n,{get iconNode(){return r}}))}var xN=new Set(["$$slots","$$events","$$legacy"]);function _N(t,e){let n=ht(e,xN);const r=[["path",{d:"m21 21-4.34-4.34"}],["circle",{cx:"11",cy:"11",r:"8"}]];dn(t,zt({name:"search"},()=>n,{get iconNode(){return r}}))}var SN=new Set(["$$slots","$$events","$$legacy"]);function kN(t,e){let n=ht(e,SN);const r=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18"}]];dn(t,zt({name:"server"},()=>n,{get iconNode(){return r}}))}var MN=new Set(["$$slots","$$events","$$legacy"]);function mM(t,e){let n=ht(e,MN);const r=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"}],["circle",{cx:"12",cy:"12",r:"3"}]];dn(t,zt({name:"settings"},()=>n,{get iconNode(){return r}}))}var TN=new Set(["$$slots","$$events","$$legacy"]);function EN(t,e){let n=ht(e,TN);const r=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"}],["path",{d:"m9 12 2 2 4-4"}]];dn(t,zt({name:"shield-check"},()=>n,{get iconNode(){return r}}))}var AN=new Set(["$$slots","$$events","$$legacy"]);function PN(t,e){let n=ht(e,AN);const r=[["path",{d:"M7 18v-6a5 5 0 1 1 10 0v6"}],["path",{d:"M5 21a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2z"}],["path",{d:"M21 12h1"}],["path",{d:"M18.5 4.5 18 5"}],["path",{d:"M2 12h1"}],["path",{d:"M12 2v1"}],["path",{d:"m4.929 4.929.707.707"}],["path",{d:"M12 12v6"}]];dn(t,zt({name:"siren"},()=>n,{get iconNode(){return r}}))}var CN=new Set(["$$slots","$$events","$$legacy"]);function ON(t,e){let n=ht(e,CN);const r=[["path",{d:"M22 2 2 22"}]];dn(t,zt({name:"slash"},()=>n,{get iconNode(){return r}}))}var RN=new Set(["$$slots","$$events","$$legacy"]);function NN(t,e){let n=ht(e,RN);const r=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}]];dn(t,zt({name:"square"},()=>n,{get iconNode(){return r}}))}var IN=new Set(["$$slots","$$events","$$legacy"]);function zN(t,e){let n=ht(e,IN);const r=[["path",{d:"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z"}],["path",{d:"M15 3v5a1 1 0 0 0 1 1h5"}]];dn(t,zt({name:"sticky-note"},()=>n,{get iconNode(){return r}}))}var LN=new Set(["$$slots","$$events","$$legacy"]);function DN(t,e){let n=ht(e,LN);const r=[["path",{d:"M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5"}],["path",{d:"M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244"}],["path",{d:"M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05"}]];dn(t,zt({name:"store"},()=>n,{get iconNode(){return r}}))}var FN=new Set(["$$slots","$$events","$$legacy"]);function BN(t,e){let n=ht(e,FN);const r=[["path",{d:"M16 7h6v6"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17"}]];dn(t,zt({name:"trending-up"},()=>n,{get iconNode(){return r}}))}var jN=new Set(["$$slots","$$events","$$legacy"]);function UN(t,e){let n=ht(e,jN);const r=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}],["path",{d:"M12 9v4"}],["path",{d:"M12 17h.01"}]];dn(t,zt({name:"triangle-alert"},()=>n,{get iconNode(){return r}}))}var WN=new Set(["$$slots","$$events","$$legacy"]);function qN(t,e){let n=ht(e,WN);const r=[["path",{d:"M9 14 4 9l5-5"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11"}]];dn(t,zt({name:"undo-2"},()=>n,{get iconNode(){return r}}))}var HN=new Set(["$$slots","$$events","$$legacy"]);function ru(t,e){let n=ht(e,HN);const r=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];dn(t,zt({name:"x"},()=>n,{get iconNode(){return r}}))}const F1="oidc_access_token",B1="oidc_expires_at",j1="oidc_refresh_token",U1="oidc_user",fb="oidc_pkce_verifier",hb="oidc_state",VN=3e4;let tr={config:null,accessToken:sessionStorage.getItem(F1),expiresAt:Number(sessionStorage.getItem(B1))||null,refreshToken:localStorage.getItem(j1),user:localStorage.getItem(U1),refreshing:null};async function W1(){try{const t=await fetch(sp("/api/v1/auth/oidc-config"));if(!t.ok)return null;const e=await t.json();return tr.config=e,e}catch{return null}}function vM(t){return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Sx(t){const e=new Uint8Array(t);return crypto.getRandomValues(e),vM(e)}async function $N(t){return crypto.subtle.digest("SHA-256",new TextEncoder().encode(t))}async function GN(){const t=tr.config??await W1();if(!t)throw new Error("OIDC not configured on server");const e=Sx(64),n=await $N(e),r=vM(n),i=Sx(32);sessionStorage.setItem(fb,e),sessionStorage.setItem(hb,i);const s=new URLSearchParams(location.search).has("desktop");let o,a;s?(o=(ll().apiUrl||location.origin).replace(/\/$/,"")+"/oidc-callback",a=i+"."+e):(o=(location.origin+location.pathname).replace(/\/$/,""),a=i);const l=new URLSearchParams({response_type:"code",client_id:t.client_id,redirect_uri:o,code_challenge:r,code_challenge_method:"S256",state:a,scope:"openid profile email"});if(s){const c=ll().apiUrl||"",u=encodeURIComponent(location.origin+location.pathname.replace(/\/$/,"")+"?desktop=1&apiUrl="+encodeURIComponent(c));location.href=`http://127.0.0.1:18901/oidc/start?apiUrl=${encodeURIComponent(c)}&ret=${u}`;return}location.href=`${t.authorization_endpoint.replace(/\/$/,"")}/?${l}`}async function YN(t,e){const n=sessionStorage.getItem(fb),r=sessionStorage.getItem(hb);if(sessionStorage.removeItem(fb),sessionStorage.removeItem(hb),!n||r!==e||!(tr.config??await W1()))return!1;const s=(location.origin+location.pathname).replace(/\/$/,"");try{const o=await fetch(sp("/api/v1/auth/oidc-token"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"authorization_code",code:t,code_verifier:n,redirect_uri:s})});if(!o.ok)return!1;const a=await o.json();if(!a.access_token)return!1;if(bM(a),a.id_token){const l=KN(a.id_token);l&&(tr.user=l,localStorage.setItem(U1,l))}return!0}catch{return!1}}function KN(t){try{const e=t.split(".")[1],n=JSON.parse(atob(e));return n.preferred_username||n.email||n.sub||null}catch{return null}}function bM(t){tr.accessToken=t.access_token;const e=t.expires_in??300;tr.expiresAt=Date.now()+e*1e3,sessionStorage.setItem(F1,t.access_token),sessionStorage.setItem(B1,String(tr.expiresAt)),t.refresh_token&&(tr.refreshToken=t.refresh_token,localStorage.setItem(j1,t.refresh_token))}function yM(){return tr.expiresAt!==null&&Date.now()>=tr.expiresAt-VN?null:tr.accessToken}function XN(){return tr.user}async function q1(){const t=yM();return t||(tr.refreshToken?ZN():null)}async function ZN(){return tr.refreshing?tr.refreshing:!(tr.config??await W1())||!tr.refreshToken?null:(tr.refreshing=(async()=>{try{const e=await fetch(sp("/api/v1/auth/oidc-token"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"refresh_token",refresh_token:tr.refreshToken})});if(!e.ok)return ag(),null;const n=await e.json();return n.access_token?(bM(n),n.access_token):(ag(),null)}catch{return ag(),null}finally{tr.refreshing=null}})(),tr.refreshing)}function ag(){tr.accessToken=null,tr.expiresAt=null,tr.refreshToken=null,tr.user=null,sessionStorage.removeItem(F1),sessionStorage.removeItem(B1),localStorage.removeItem(j1),localStorage.removeItem(U1)}function pb(){ag()}function ip(){return tr.refreshToken?!0:yM()!==null}async function QN(){return tr.refreshToken||tr.accessToken?await q1()!==null:!1}async function JN(){const t=new URLSearchParams(location.search),e=t.get("code"),n=t.get("state");if(!e||!n)return!1;const r=await YN(e,n),i=new URL(location.href);return i.searchParams.delete("code"),i.searchParams.delete("state"),history.replaceState(null,"",i.toString()),r}let ws;function Lg(t){ws=t??window.__OIKOS_CONFIG__,ws!=null&&ws.token&&(localStorage.setItem("oikos_token",ws.token),ws.apiUrl&&localStorage.setItem("oikos_api_url",ws.apiUrl))}function ll(){if(!ws){const t=localStorage.getItem("oikos_token"),e=localStorage.getItem("oikos_api_url");(t||e)&&(ws={apiUrl:e??"",token:t??void 0})}return ws??{apiUrl:""}}function gb(t){ws=t,t.token?localStorage.setItem("oikos_token",t.token):localStorage.removeItem("oikos_token"),t.apiUrl?localStorage.setItem("oikos_api_url",t.apiUrl):localStorage.removeItem("oikos_api_url")}function eI(){ws={apiUrl:""},localStorage.removeItem("oikos_token"),localStorage.removeItem("oikos_api_url")}function kx(){return!!ll().token||ip()}function sp(t){const e=ll();return e.apiUrl?`${e.apiUrl}${t}`:t}async function tI(){if(ip()){const e=await q1();if(e)return`Bearer ${e}`}const t=ll();return t.token?`Bearer ${t.token}`:null}async function Gt(t,e){const n={"Content-Type":"application/json",...(e==null?void 0:e.headers)??{}},r=await tI();r&&(n.Authorization=r);const i=await fetch(sp(t),{...e,headers:n});return i.status===401&&r&&ip()&&pb(),i}async function nI(t){const e=sp(t),n=ll();let r=null;if(ip()&&(r=await q1()),r||(r=n.token??null),!r)return e;const i=e.includes("?")?"&":"?";return`${e}${i}token=${encodeURIComponent(r)}`}const wM="oikos-theme";function xM(t){const e=document.documentElement;t==="dark"?e.classList.add("dark"):e.classList.remove("dark")}function rI(){if(typeof localStorage>"u")return"dark";const t=localStorage.getItem(wM);return t==="light"||t==="dark"?t:window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}const _M=rI();let H1=Se(gn(_M));xM(_M);function iI(t){I(H1,t,!0),xM(t),typeof localStorage<"u"&&localStorage.setItem(wM,t)}function qu(){return d(H1)}function sI(){const t=d(H1)==="dark"?"light":"dark";return iI(t),t}const Mx={light:"Light",dark:"Dark"};var oI=ne('<div class="absolute inset-0 overflow-hidden bg-background"><canvas class="h-full w-full"></canvas></div>');function aI(t,e){Tt(e,!0);const n=90,r=160,i=200,s=.012;let o=Se(null),a=Se(null),l=[],c={x:-500,y:-500},u=0,f=0,h=1,p=0;function g(){l=Array.from({length:n},()=>({x:Math.random()*u,y:Math.random()*f,vx:(Math.random()-.5)*.3,vy:(Math.random()-.5)*.3,r:1+Math.random()*2,phase:Math.random()*Math.PI*2,pulse:.4+Math.random()*.6}))}function m(){!d(o)||!d(a)||(h=Math.min(window.devicePixelRatio||1,2),u=d(o).clientWidth,f=d(o).clientHeight,d(a).width=Math.round(u*h),d(a).height=Math.round(f*h),l.length===0&&g())}function b(E){if(!d(o))return;const M=d(o).getBoundingClientRect();c.x=E.clientX-M.left,c.y=E.clientY-M.top}function y(){c.x=-500,c.y=-500}function _(E){if(p=setTimeout(()=>_(performance.now()),33),!d(a)||l.length===0)return;const M=d(a).getContext("2d");if(!M)return;const O=E/1e3,P=qu()!=="light";M.setTransform(h,0,0,h,0,0),M.clearRect(0,0,u,f);for(const B of l){B.vx+=Math.sin(O*.4+B.phase)*.003*.15,B.vy+=Math.cos(O*.35+B.phase)*.003*.15;const z=B.x-c.x,H=B.y-c.y,X=Math.sqrt(z*z+H*H);if(X<i&&X>0){const Z=(i-X)/i*s;B.vx+=z/X*Z*.6,B.vy+=H/X*Z*.6}B.vx*=.995,B.vy*=.995,Math.random()<.003&&(B.vx+=(Math.random()-.5)*.04,B.vy+=(Math.random()-.5)*.04),B.x+=B.vx,B.y+=B.vy,B.x<-40&&(B.x=u+40),B.x>u+40&&(B.x=-40),B.y<-40&&(B.y=f+40),B.y>f+40&&(B.y=-40);const G=B.pulse*(.35+.15*Math.sin(O*1.2+B.phase));M.fillStyle=P?`rgba(168,153,132,${G})`:`rgba(58,58,58,${G})`,M.beginPath(),M.arc(B.x,B.y,B.r,0,Math.PI*2),M.fill()}M.lineWidth=.6;for(let B=0;B<l.length;B++)for(let z=B+1;z<l.length;z++){const H=l[B],X=l[z],G=H.x-X.x,Z=H.y-X.y,oe=G*G+Z*Z;if(oe<r*r){const K=(1-Math.sqrt(oe)/r)*.18;M.strokeStyle=P?`rgba(168,153,132,${K})`:`rgba(58,58,58,${K})`,M.beginPath(),M.moveTo(H.x,H.y),M.lineTo(X.x,X.y),M.stroke()}}const x=u/2,C=f/2,R=M.createRadialGradient(x,C,0,x,C,Math.hypot(x,C)),N=P?"0,0,0":"239,229,192";R.addColorStop(0,`rgba(${N},0.72)`),R.addColorStop(.35,`rgba(${N},0.40)`),R.addColorStop(.65,`rgba(${N},0.08)`),R.addColorStop(1,"rgba(0,0,0,0)"),M.fillStyle=R,M.fillRect(0,0,u,f)}os(()=>{m(),g();const E=new ResizeObserver(()=>{m(),g()});return d(o)&&E.observe(d(o)),window.addEventListener("pointermove",b),window.addEventListener("pointerleave",y),p=setTimeout(()=>_(performance.now()),33),()=>{clearTimeout(p),E.disconnect(),window.removeEventListener("pointermove",b),window.removeEventListener("pointerleave",y)}});var k=oI(),S=j(k);kr(S,E=>I(a,E),()=>d(a)),kr(k,E=>I(o,E),()=>d(o)),A(t,k),Et()}var lI=ne('<div class="raster-skeleton svelte-1ny774u" aria-hidden="true"></div>'),cI=ne('<canvas role="img"></canvas>'),uI=ne("<div><!> <!> <img/></div>");function dI(t,e){Tt(e,!0);let n=te(e,"alt",3,""),r=te(e,"width",3,256),i=te(e,"class",3,""),s=te(e,"plain",3,!1),o=te(e,"bias",3,0),a=Se(null),l=Se(null),c=Se(!1),u=Se(!1),f=null;const h=V(()=>!d(c)),p=V(()=>d(c)&&!s()&&!d(u));function g(x){const R=getComputedStyle(document.documentElement).getPropertyValue(x).trim().match(/#([0-9a-fA-F]{6})/),N=R?R[1]:"000000";return[parseInt(N.slice(0,2),16),parseInt(N.slice(2,4),16),parseInt(N.slice(4,6),16)]}function m(){if(!f||!d(a))return;const x=d(a).getContext("2d");if(!x)return;const{bits:C,alpha:R,w:N,h:B}=f;d(a).width=N,d(a).height=B;const z=g("--foreground"),H=g("--background"),X=x.createImageData(N,B),G=X.data;for(let Z=0,oe=0;Z<N*B;Z++,oe+=4){if(R[Z]<64){G[oe+3]=0;continue}const K=C[Z]?H:z;G[oe]=K[0],G[oe+1]=K[1],G[oe+2]=K[2],G[oe+3]=255}x.putImageData(X,0,0)}function b(x){const C=x.naturalWidth||x.width,R=x.naturalHeight||x.height;if(!C||!R)return;const N=Math.max(1,Math.round(r())),B=Math.max(1,Math.round(N*R/C)),z=document.createElement("canvas");z.width=N,z.height=B;const H=z.getContext("2d",{willReadFrequently:!0});if(!H)return;H.drawImage(x,0,0,N,B);let X;try{X=H.getImageData(0,0,N,B).data}catch{I(u,!0);return}const G=N*B,Z=new Float32Array(G),oe=new Uint8Array(G);for(let W=0,J=0;W<G;W++,J+=4)Z[W]=.299*X[J]+.587*X[J+1]+.114*X[J+2],oe[W]=X[J+3];const K=128-o(),q=new Uint8Array(G);for(let W=0;W<B;W++)for(let J=0;J<N;J++){const fe=W*N+J,$=Z[fe],de=$<K?0:255;q[fe]=de===255?1:0;const Be=($-de)/8;J+1<N&&(Z[fe+1]+=Be),J+2<N&&(Z[fe+2]+=Be),W+1<B&&(J-1>=0&&(Z[fe+N-1]+=Be),Z[fe+N]+=Be,J+1<N&&(Z[fe+N+1]+=Be)),W+2<B&&(Z[fe+2*N]+=Be)}f={key:e.src+N,bits:q,alpha:oe,w:N,h:B},I(u,!1),m()}function y(){I(c,!0)}Qt(()=>{e.src,r(),s(),!(!d(c)||!d(l)||s()||d(u))&&d(l).complete&&d(l).naturalWidth>0&&b(d(l))}),os(()=>{const x=new MutationObserver(()=>{f&&!s()&&m()});return x.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme"]}),()=>x.disconnect()});var _=uI(),k=j(_);{var S=x=>{var C=lI();A(x,C)};xe(k,x=>{d(h)&&x(S)})}var E=ee(k,2);{var M=x=>{var C=cI();let R;kr(C,N=>I(a,N),()=>d(a)),De(()=>{R=Gn(C,1,"raster-canvas svelte-1ny774u",null,R,{hidden:!d(p)}),ut(C,"aria-label",n())}),A(x,C)};xe(E,x=>{s()||x(M)})}var O=ee(E,2);let P;kr(O,x=>I(l,x),()=>d(l)),De(()=>{Gn(_,1,`raster-wrap ${i()??""}`,"svelte-1ny774u"),Ks(_,`--rw:${r()??""}px`),ut(O,"src",e.src),ut(O,"alt",n()),P=Gn(O,1,"raster-fallback svelte-1ny774u",null,P,{hidden:d(p)})}),Mi("load",O,y),Mi("error",O,()=>{I(u,!0),I(c,!0)}),A(t,_),Et()}var fI=ne('<div class="flex flex-col items-center gap-3 border border-border bg-background/40 p-5"><p class="text-sm text-muted-foreground">Logged in as <span class="font-semibold text-foreground"> </span></p> <div class="flex w-full gap-2"><!> <!></div> <!></div>'),hI=ne("<!> ",1),pI=ne('<div class="flex w-full flex-col gap-3"><!> <div class="flex items-center gap-3"><!> <span class="text-[10px] font-medium uppercase tracking-widest text-muted-foreground/40">or use</span> <!></div> <form class="flex flex-col gap-2.5"><div class="relative"><!> <!></div> <!></form></div>'),gI=ne('<p class="rounded-lg bg-destructive/10 px-3 py-2 text-center text-sm text-destructive"> </p>'),mI=ne('<div class="flex items-center justify-center gap-2"><!> <!></div>'),vI=ne('<div class="relative h-svh overflow-hidden bg-background"><!> <div class="relative z-10 flex h-full items-center justify-center p-6"><div class="w-full max-w-[26rem] space-y-8 border border-border bg-card p-8 shadow-[3px_3px_0_0_var(--border)]"><div class="flex flex-col items-center gap-4"><!> <svg viewBox="0 0 91 100" class="h-12 w-12 fill-foreground/90" aria-hidden="true"><path d="m45.601 1q20.993 0 33.71 15.946 10.799 13.625 10.799 31.287 0 12.414-5.9548 25.131-5.9548 12.717-16.451 19.176-10.395 6.4592-23.213 6.4592-20.892 0-33.205-16.653-10.395-14.029-10.395-31.489 0-12.717 6.2577-25.232 6.3584-12.616 16.653-18.57 10.295-6.0556 21.801-6.0556zm-3.128 6.5605q-5.3492 0-10.799 3.2296-5.3492 3.1287-8.68 11.102-3.3305 7.9735-3.3305 20.488 0 20.185 7.973 34.82 8.0743 14.634 21.195 14.634 9.7896 0 16.149-8.0743 6.3584-8.0743 6.3584-27.755 0-24.627-10.597-38.756-7.1657-9.6888-18.268-9.6888z"></path></svg> <div class="text-center"><h1 class="text-2xl font-semibold tracking-tight text-foreground">Connect to Oikos</h1> <p class="mt-1.5 text-sm text-muted-foreground">Configure your control room connection</p></div></div> <div class="flex flex-col gap-1.5"><!> <div class="relative"><!> <!></div></div> <!> <!> <!></div></div></div>');function bI(t,e){Tt(e,!0);const n=ll();let r=Se(gn(n.apiUrl??"")),i=Se(gn(n.token??"")),s=Se(!1),o=Se(""),a=Se(!1),l=Se(gn(XN())),c=Se(gn(ip()));function u(){eI(),pb(),I(r,""),I(i,""),I(o,""),I(l,null),I(c,!1)}async function f(){if(I(o,""),!d(i).trim()){I(o,"Token is required");return}I(s,!0),gb({apiUrl:d(r).trim(),token:d(i).trim()}),Lg({apiUrl:d(r).trim(),token:d(i).trim()});try{const Z=await Gt("/api/v1/dashboard/summary");if(!Z.ok){I(o,Z.status===401?"Invalid token":`Server responded ${Z.status}`,!0);return}h(),e.onConnected()}catch{I(o,"Could not reach server — check the URL")}finally{I(s,!1)}}function h(){var oe;const Z=window.wails;if((oe=Z==null?void 0:Z.Call)!=null&&oe.ByName)try{Z.Call.ByName("SaveConfig",d(r).trim(),d(i).trim())}catch{}}async function p(){I(o,""),I(a,!0),gb({apiUrl:d(r).trim(),token:""}),Lg({apiUrl:d(r).trim(),token:""});try{await GN()}catch(Z){I(o,Z instanceof Error?Z.message:"OIDC login failed",!0),I(a,!1)}}function g(){pb(),I(l,null),I(c,!1)}let m=V(()=>d(c)&&d(l));var b=vI(),y=j(b);aI(y,{});var _=ee(y,2),k=j(_),S=j(k),E=j(S);dI(E,{src:"/mascot/egg-idle.png",alt:"",width:72,bias:16});var M=ee(S,2),O=j(M);XR(O,{for:"server-url",class:"text-xs font-medium",children:(Z,oe)=>{var K=er("Server URL");A(Z,K)},$$slots:{default:!0}});var P=ee(O,2),x=j(P);kN(x,{class:"pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground/50"});var C=ee(x,2);Ww(C,{id:"server-url",type:"url",placeholder:"https://oikos.hubris.network",class:"pl-9",get value(){return d(r)},set value(Z){I(r,Z,!0)}});var R=ee(M,2);{var N=Z=>{var oe=fI(),K=j(oe),q=ee(j(K)),W=j(q),J=ee(K,2),fe=j(J);Rr(fe,{type:"button",variant:"default",class:"flex-1",onclick:()=>e.onConnected(),children:(wt,Je)=>{var Ue=er("Continue to Dashboard");A(wt,Ue)},$$slots:{default:!0}});var $=ee(fe,2);{var de=wt=>{Rr(wt,{type:"button",variant:"outline",get onclick(){return e.onCancel},children:(Je,Ue)=>{var ke=er("Cancel");A(Je,ke)},$$slots:{default:!0}})};xe($,wt=>{e.onCancel&&wt(de)})}var Be=ee(J,2);Rr(Be,{type:"button",variant:"ghost",size:"sm",onclick:g,children:(wt,Je)=>{var Ue=er("Sign out");A(wt,Ue)},$$slots:{default:!0}}),De(()=>je(W,d(l))),A(Z,oe)},B=Z=>{var oe=pI(),K=j(oe);Rr(K,{type:"button",variant:"secondary",get disabled(){return d(a)},onclick:p,class:"w-full gap-2",children:(Je,Ue)=>{var ke=hI(),ct=Me(ke);J4(ct,{class:"size-4"});var Ee=ee(ct);De(()=>je(Ee,` ${d(a)?"Redirecting…":"Login with Authentik"}`)),A(Je,ke)},$$slots:{default:!0}});var q=ee(K,2),W=j(q);xx(W,{decorative:!0,class:"flex-1"});var J=ee(W,4);xx(J,{decorative:!0,class:"flex-1"});var fe=ee(q,2),$=j(fe),de=j($);Z4(de,{class:"pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground/50"});var Be=ee(de,2);Ww(Be,{type:"password",placeholder:"Bearer token",class:"pl-9",get value(){return d(i)},set value(Je){I(i,Je,!0)}});var wt=ee($,2);Rr(wt,{type:"submit",get disabled(){return d(s)},class:"w-full",children:(Je,Ue)=>{var ke=er();De(()=>je(ke,d(s)?"Connecting…":"Connect")),A(Je,ke)},$$slots:{default:!0}}),Mi("submit",fe,Je=>{Je.preventDefault(),f()}),A(Z,oe)};xe(R,Z=>{d(m)?Z(N):Z(B,-1)})}var z=ee(R,2);{var H=Z=>{var oe=gI(),K=j(oe);De(()=>je(K,d(o))),A(Z,oe)};xe(z,Z=>{d(o)&&Z(H)})}var X=ee(z,2);{var G=Z=>{var oe=mI(),K=j(oe);{var q=fe=>{Rr(fe,{type:"button",variant:"ghost",size:"sm",get onclick(){return e.onCancel},children:($,de)=>{var Be=er("Cancel");A($,Be)},$$slots:{default:!0}})};xe(K,fe=>{e.onCancel&&fe(q)})}var W=ee(K,2);{var J=fe=>{Rr(fe,{type:"button",variant:"ghost",size:"sm",onclick:u,children:($,de)=>{var Be=er("Forget saved connection");A($,Be)},$$slots:{default:!0}})};xe(W,fe=>{n.token&&fe(J)})}A(Z,oe)};xe(X,Z=>{!d(m)&&(e.onCancel||n.token)&&Z(G)})}A(t,b),Et()}const yI="modulepreload",wI=function(t){return"/"+t},Tx={},go=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(c){return Promise.all(c.map(u=>Promise.resolve(u).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=o(n.map(c=>{if(c=wI(c),c in Tx)return;Tx[c]=!0;const u=c.endsWith(".css"),f=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":yI,u||(h.as="script"),h.crossOrigin="",h.href=c,l&&h.setAttribute("nonce",l),document.head.appendChild(h),u)return new Promise((p,g)=>{h.addEventListener("load",p),h.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})},gl="/agent",hn="/api/v1";async function xI(){const t=await Gt(`${gl}/sessions`);return t.ok?(await t.json()).sessions??[]:[]}async function _I(t){const e=await Gt(`${gl}/sessions/${t}`);return e.ok?(await e.json()).messages??[]:[]}async function SI(t){const e=await Gt(`${gl}/sessions/${t}`);return e.status===404?null:e.ok?(await e.json()).messages??[]:[]}async function kI(t){return(await Gt(`${gl}/sessions/${t}/resume`,{method:"POST"})).ok}async function V1(t){const e=await Gt(`${gl}/sessions/${t}/plan`);return e.ok?(await e.json()).steps??[]:[]}async function SM(t){const e=await Gt(`${gl}/sessions/${t}/questions`);return e.ok?(await e.json()).questions??[]:[]}async function MI(t,e,n){return(await Gt(`${gl}/sessions/${t}/questions/${e}/answer`,{method:"POST",body:JSON.stringify({answer:n})})).ok}function kM(t,e,n,r,i){const s=new AbortController;return Gt(`${gl}/chat`,{method:"POST",body:JSON.stringify({message:t,session_id:e??void 0}),signal:s.signal}).then(async o=>{var u;if(!o.ok){r(`HTTP ${o.status}`);return}const a=(u=o.body)==null?void 0:u.getReader();if(!a){r("no response body");return}const l=new TextDecoder;let c="";for(;;){const{done:f,value:h}=await a.read();if(f)break;c+=l.decode(h,{stream:!0});const p=c.split(`
`);c=p.pop()??"";for(const g of p)if(g.startsWith("data: "))try{const m=JSON.parse(g.slice(6));n(m)}catch{}}}).catch(o=>{r(o.message)}).finally(()=>{i()}),s}async function TI(){const t=await Gt(`${hn}/dashboard/summary`);return t.ok?t.json():null}async function EI(t={}){const e=new URLSearchParams;t.type&&e.set("type",t.type),t.state&&e.set("state",t.state),t.domain&&e.set("domain",t.domain),t.layer&&e.set("layer",t.layer),t.q&&e.set("q",t.q),e.set("limit","200");const n=await Gt(`${hn}/entities?${e}`);return n.ok?(await n.json()).items??[]:[]}async function aq(){const t=[];let e;do{const n=new URLSearchParams({limit:"200"});e&&n.set("cursor",e);const r=await Gt(`${hn}/entities?${n}`);if(!r.ok)break;const i=await r.json();t.push(...i.items??[]),e=i.next_cursor??void 0}while(e);return t}async function lq(){const t=await Gt(`${hn}/ontology`);if(!t.ok)return{entityTypes:[],relationshipTypes:[]};const e=await t.json();return{entityTypes:e.entity_types??[],relationshipTypes:e.relationship_types??[]}}async function AI(t){const e=new URLSearchParams;t&&e.set("status",t),e.set("limit","200");const n=await Gt(`${hn}/approvals?${e}`);return n.ok?(await n.json()).items??[]:[]}async function cq(t,e,n){const r=await Gt(`${hn}/approvals/${t}/decision`,{method:"POST",body:JSON.stringify({decision:e,note:n})});return r.ok?r.json():null}async function uq(t){const e=await Gt(`${hn}/executions/${t}/cancel`,{method:"POST"});return e.ok?e.json():null}async function dq(t=50){const e=await Gt(`${hn}/activity/recent?limit=${t}`);return e.ok?(await e.json()).items??[]:[]}async function fq(){const t=await Gt(`${hn}/learning/timeline`);return t.ok?(await t.json()).items??[]:[]}async function hq(){const t=await Gt(`${hn}/learning/trend`);return t.ok?(await t.json()).items??[]:[]}async function pq(){const t=await Gt(`${hn}/patterns`);return t.ok?(await t.json()).items??[]:[]}async function gq(){const t=await Gt(`${hn}/skills`);return t.ok?(await t.json()).items??[]:[]}async function mq(t={}){const e=new URLSearchParams;t.state&&e.set("state",t.state),t.severity&&e.set("severity",t.severity),e.set("limit","200");const n=await Gt(`${hn}/signals?${e}`);return n.ok?(await n.json()).items??[]:[]}async function PI(t){const e=await Gt(`${hn}/signals/${t}/ack`,{method:"POST"});return e.ok?e.json():null}async function CI(t,e){const n=await Gt(`${hn}/signals/${t}/resolve`,{method:"POST",body:JSON.stringify({note:e})});return n.ok?n.json():null}async function OI(t,e,n){const r=await Gt(`${hn}/signals/${t}/mute`,{method:"POST",body:JSON.stringify({mute_until:e,note:n})});return r.ok?r.json():null}async function RI(t){const e=await Gt(`${hn}/entities/${encodeURIComponent(t)}/relations?direction=both`);return e.ok?(await e.json()).items??[]:[]}async function MM(t={}){const e=new URLSearchParams;t.root&&e.set("root",t.root),t.depth&&e.set("depth",String(t.depth));for(const r of t.relType??[])e.append("rel_type",r);t.includeStatus&&e.append("include","status");const n=await Gt(`${hn}/graph?${e}`);return n.ok?n.json():null}async function NI(t,e=2){const n=await Gt(`${hn}/entities/${encodeURIComponent(t)}/blast-radius?depth=${e}`);return n.ok?(await n.json()).items??[]:[]}async function II(t){const e=await Gt(`${hn}/entities/${encodeURIComponent(t)}`);return e.ok?e.json():null}async function zI(t){const e=new URLSearchParams({entity_id:t,rollup:"auto"}),n=await Gt(`${hn}/metrics?${e}`);return n.ok?(await n.json()).items??[]:[]}async function LI(t){const e=await Gt(`${hn}/knowledge/${t}`);return e.ok?(await e.json()).items??[]:[]}async function DI(t){const e=await Gt(`${hn}/knowledge/content/${encodeURIComponent(t)}`);return e.ok?e.json():null}class FI extends Error{constructor(n,r,i){super(r);we(this,"status");we(this,"detail");this.status=n,this.detail=i}}async function Ps(t){let e=`request failed (${t.status})`,n="";try{const r=await t.json();e=r.title??e,n=r.detail??""}catch{}throw new FI(t.status,e,n)}async function vq(){const t=await Gt(`${hn}/knowledge/list`);return t.ok?(await t.json()).items??[]:Ps(t)}async function bq(t){const e=await Gt(`${hn}/knowledge`,{method:"POST",body:JSON.stringify(t)});return e.ok?e.json():Ps(e)}async function yq(t,e){const n=await Gt(`${hn}/knowledge/content/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify(e)});return n.ok?n.json():Ps(n)}async function wq(t){const e=await Gt(`${hn}/knowledge/content/${encodeURIComponent(t)}`,{method:"DELETE"});if(!e.ok)return Ps(e)}async function xq(t){const e=await Gt(`${hn}/knowledge/restore/${encodeURIComponent(t)}`,{method:"POST"});if(!e.ok)return Ps(e)}async function _q(){const t=await Gt(`${hn}/knowledge/trash`);return t.ok?(await t.json()).items??[]:Ps(t)}async function Sq(t){const e=await Gt(`${hn}/knowledge/revisions/${encodeURIComponent(t)}`);return e.ok?(await e.json()).items??[]:Ps(e)}async function kq(){const t=await Gt(`${hn}/knowledge/tags`);return t.ok?(await t.json()).items??[]:Ps(t)}async function Mq(t,e){const n=await Gt(`${hn}/knowledge/tags/rename`,{method:"POST",body:JSON.stringify({from:t,to:e})});return n.ok?(await n.json()).notes_updated??0:Ps(n)}async function Tq(t){const n=await Gt(`${hn}/knowledge/duplicates`);return n.ok?(await n.json()).clusters??[]:Ps(n)}async function Eq(t){const n=await Gt(`${hn}/knowledge/orphans`);return n.ok?n.json():Ps(n)}async function Aq(t,e){const n=await Gt(`${hn}/knowledge/merge`,{method:"POST",body:JSON.stringify({target:t,sources:e})});return n.ok?n.json():Ps(n)}async function BI(t){const e=new URLSearchParams({entity_id:t,limit:"50"}),n=await Gt(`${hn}/events?${e}`);return n.ok?(await n.json()).items??[]:[]}async function Ex(t){const e=new URLSearchParams({entity_id:t,limit:"50"}),n=await Gt(`${hn}/signals?${e}`);return n.ok?(await n.json()).items??[]:[]}async function TM(t){const e=await Gt(`${hn}/executions/${t}/logs?limit=2000`);if(!e.ok)return{items:[],combined:""};const n=await e.json();return{items:n.items??[],combined:n.combined??""}}async function mb(t){const e=new URLSearchParams({target:t,limit:"50"}),n=await Gt(`${hn}/executions?${e}`);return n.ok?(await n.json()).items??[]:[]}async function jI(t){const[e,n]=await Promise.all([mb(t.id),EI({type:"task"})]),r=new Set(e.map(s=>s.id));return(await Promise.all(n.map(async s=>{const o=await MM({root:s.slug,depth:1});if(!o)return null;const a=o.edges.some(f=>f.type==="involves"&&f.target===t.slug),l=new Map(o.nodes.map(f=>[f.id,f.type])),c=new Map(o.nodes.map(f=>[f.slug,f.id])),u=o.edges.filter(f=>{if(f.type!=="involves")return!1;const h=c.get(f.target);return h!=null&&l.get(h)==="execution"&&r.has(h)}).length;return!a&&u===0?null:{task:s,executionCount:u}}))).filter(s=>s!==null)}async function Ax(t){const e=new URLSearchParams({target:t,limit:"50"}),n=await Gt(`${hn}/checks?${e}`);return n.ok?(await n.json()).items??[]:[]}async function UI(t,e,n){const r=await Gt(`${hn}/checks/${t}`,{method:"PATCH",headers:{"If-Match":`"${e}"`},body:JSON.stringify(n)});return r.ok?r.json():null}async function WI(t={}){const e=new URLSearchParams;t.agent_id&&e.set("agent_id",t.agent_id),t.activity_type&&e.set("activity_type",t.activity_type),t.entity_id&&e.set("entity_id",t.entity_id),e.set("limit",String(t.limit??200));const n=await Gt(`${hn}/agent-activity?${e}`);return n.ok?(await n.json()).items??[]:[]}async function qI(t={}){const e=new URLSearchParams;t.actor_type&&e.set("actor_type",t.actor_type),t.actor_id&&e.set("actor_id",t.actor_id),t.entity_id&&e.set("entity_id",t.entity_id),t.action&&e.set("action",t.action),t.correlation_id&&e.set("correlation_id",t.correlation_id),e.set("limit",String(t.limit??200));const n=await Gt(`${hn}/audit?${e}`);return n.ok?(await n.json()).items??[]:[]}const HI=200,mc=dr([]);let Qa=null,Zc=0,iu=null,Gc=0;const Px=dr(!0),VI=1e3,$I=3e4;async function EM(){if(Qa)return;const t=new EventSource(await nI("/api/v1/events/stream"));Qa=t,t.onopen=()=>{Gc=0,Px.set(!0)},t.onmessage=e=>{try{const n=JSON.parse(e.data);mc.update(r=>[n,...r].slice(0,HI))}catch{}},t.onerror=()=>{t.readyState===EventSource.CLOSED&&(Px.set(!1),Qa===t&&(Qa=null),t.close(),!(Zc===0||iu)&&(Gc=Gc?Math.min(Gc*2,$I):VI,iu=setTimeout(()=>{iu=null,Zc>0&&EM()},Gc)))}}function GI(){iu&&(clearTimeout(iu),iu=null),Gc=0,Qa==null||Qa.close(),Qa=null}function od(){return Zc++,Zc===1&&EM(),()=>{Zc--,Zc===0&&GI()}}const $1=dr(null);let Mp=0,Tp=null,_d=null,Sd=null,Cx=0;async function vb(){const[t]=await Promise.all([TI(),AI("pending")]);t&&$1.set(t)}function YI(t){t.id<=Cx||(Cx=t.id,(t.type.startsWith("approval.")||t.type.startsWith("signal.")||t.type.startsWith("execution.")&&t.type!=="execution.output"||t.type==="health.changed")&&vb())}function KI(){return Mp++,Mp===1&&(vb(),Tp=setInterval(vb,3e4),_d=od(),Sd=mc.subscribe(t=>{t[0]&&YI(t[0])})),()=>{Mp--,Mp===0&&(Tp&&clearInterval(Tp),Tp=null,_d==null||_d(),_d=null,Sd==null||Sd(),Sd=null)}}function XI(t){return t?Object.values(t.signals_by_severity).reduce((e,n)=>e+n,0):0}const ZI=[{manifest:{id:"notes",title:"Notes",description:"A scratchpad. Auto-saves to localStorage. Demo installable app.",version:"0.1.0",author:"oikos",permissions:["theme"],width:640,height:480,minWidth:360,minHeight:320},icon:zN,load:()=>go(()=>import("./Notes-zxrrML9t.js"),[])}],G1=new Map(ZI.map(t=>[t.manifest.id,t])),QI=[{id:"tasks",title:"Tasks",icon:Y4,component:()=>go(()=>import("./Overview-C_9Ji_NC.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8])),width:960,height:680,minWidth:480,minHeight:420,source:"builtin"},{id:"kb",title:"Fleet",icon:_4,component:()=>go(()=>import("./KnowledgeBase-BNxdKIZ7.js"),__vite__mapDeps([9,3,5,10])),width:1e3,height:700,minWidth:520,minHeight:420,source:"builtin"},{id:"ops",title:"Operations",icon:EN,component:()=>go(()=>import("./Ops-DAOK5ZEQ.js"),__vite__mapDeps([11,12,1,2,3,4,5,6,7])),width:860,height:620,minWidth:480,minHeight:360,badge:t=>(t==null?void 0:t.approvals_pending)??0,source:"builtin"},{id:"signals",title:"Signals",icon:PN,component:()=>go(()=>import("./Signals-C_6d4rqi.js"),__vite__mapDeps([13,12,4,5,6,7,1,2,3])),width:860,height:620,minWidth:480,minHeight:360,badge:t=>XI(t),source:"builtin"},{id:"knowledge",title:"Knowledge",icon:_N,component:()=>go(()=>import("./Knowledge-D0UZIpsu.js"),__vite__mapDeps([14,4,5,6,7,8,15,12])),width:800,height:600,minWidth:440,minHeight:340,source:"builtin"},{id:"learning",title:"Learning",icon:BN,component:()=>go(()=>import("./Learning-C0EP82zq.js"),__vite__mapDeps([16,15])),width:800,height:600,minWidth:440,minHeight:340,source:"builtin"},{id:"settings",title:"Settings",icon:mM,component:()=>go(()=>import("./Settings-DIFH4bBX.js"),__vite__mapDeps([17,2,5,6])),width:640,height:480,minWidth:480,minHeight:360,source:"builtin"},{id:"app-store",title:"App Store",icon:DN,component:()=>go(()=>import("./AppStore-4AihCKA5.js"),[]),width:720,height:560,minWidth:480,minHeight:360,source:"builtin"},{id:"mascot",title:"Cluck",icon:j4,component:()=>go(()=>import("./MascotLayer-D4qaTX9J.js"),__vite__mapDeps([18,19])),docked:!0,source:"builtin"}],AM="oikos-installed-apps";function JI(){if(typeof localStorage>"u")return[];try{const t=localStorage.getItem(AM);return t?JSON.parse(t).filter(n=>G1.has(n)):[]}catch{return[]}}const op=dr(JI()),Pq={subscribe:op.subscribe};function ez(t){typeof localStorage>"u"||localStorage.setItem(AM,JSON.stringify(t))}op.subscribe(ez);function tz(t){const e=t.manifest;return{id:e.id,title:e.title,icon:t.icon,component:t.load,docked:e.docked,noIcon:e.noIcon,width:e.width,height:e.height,minWidth:e.minWidth,minHeight:e.minHeight,source:"installed"}}const ap=Es(op,t=>{const e=t.map(n=>G1.get(n)).filter(n=>!!n).map(tz);return[...QI,...e]}),Y1=Es(ap,t=>new Map(t.map(e=>[e.id,e])));function Cq(t){G1.has(t)&&op.update(e=>e.includes(t)?e:[...e,t])}function Oq(t){op.update(e=>e.filter(n=>n!==t))}const bb="app:";function nz(t){return`${bb}${t}`}function sf(t){return t.startsWith(bb)?t.slice(bb.length):null}const Zi={cell:96,gap:12,padding:16},PM="oikos-desktop-icons";function rz(){if(typeof localStorage>"u")return{};try{const t=localStorage.getItem(PM);return t?JSON.parse(t):{}}catch{return{}}}const ic=dr(rz());function iz(t){typeof localStorage>"u"||localStorage.setItem(PM,JSON.stringify(t))}ic.subscribe(iz);function yb(t,e,n,r){return Object.entries(t).some(([i,s])=>i!==r&&s.col===e&&s.row===n)}function sz(t,e,n,r){if(!yb(t,e,n,r))return{col:Math.max(0,e),row:Math.max(0,n)};for(let i=1;i<64;i++)for(let s=-i;s<=i;s++)for(let o=-i;o<=i;o++){if(Math.max(Math.abs(s),Math.abs(o))!==i)continue;const a=e+s,l=n+o;if(!(a<0||l<0)&&!yb(t,a,l,r))return{col:a,row:l}}return{col:Math.max(0,e),row:Math.max(0,n)}}function oz(t,e,n){ic.update(r=>{const i=sz(r,e,n,t);return{...r,[t]:i}})}function Ox(t){return{x:Zi.padding+t.col*(Zi.cell+Zi.gap),y:Zi.padding+t.row*(Zi.cell+Zi.gap)}}function Rq(){return ki(ic)}function az(){ic.set(CM({},ki(ap)))}function CM(t,e){let n=null,r=0;for(const i of e)if(!t[i.id]){for(n||(n={...t});yb(n,0,r,i.id);)r++;n[i.id]={col:0,row:r},r++}return n??t}ap.subscribe(t=>{const e=ki(ic),n=CM(e,t);n!==e&&ic.set(n)});function lz(){const t=new Map;return{on(e,n){let r=t.get(e);return r||(r=new Set,t.set(e,r)),r.add(n),()=>{r.delete(n)}},emit(e,n){const r=t.get(e);if(r)for(const i of[...r])i(n)},clear(){t.clear()}}}function sc(t,e,n){return Math.min(Math.max(t,e),n)}function Rx(t,e,n){return{width:sc(t.width,e.width,n?n.width:Number.POSITIVE_INFINITY),height:sc(t.height,e.height,n?n.height:Number.POSITIVE_INFINITY)}}function Oc(t,e,n){if(e.width<=0||e.height<=0)return t;const r=sc(t.x,n-t.width,e.width-n),i=sc(t.y,0,Math.max(0,e.height-n));return r===t.x&&i===t.y?t:{...t,x:r,y:i}}function R0(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function lg(t,e){const n=e.width,r=e.height,i=Math.round(n/2),s=Math.round(r/2);switch(t){case"left":return{x:0,y:0,width:i,height:r};case"right":return{x:i,y:0,width:n-i,height:r};case"top":return{x:0,y:0,width:n,height:s};case"bottom":return{x:0,y:s,width:n,height:r-s};case"top-left":return{x:0,y:0,width:i,height:s};case"top-right":return{x:i,y:0,width:n-i,height:s};case"bottom-left":return{x:0,y:s,width:i,height:r-s};case"bottom-right":return{x:i,y:s,width:n-i,height:r-s}}}function cz(t,e,n,r={}){const i=r.threshold??12,s=r.cornerSize??64,o=n.width,a=n.height;if(o<=0||a<=0)return null;const l=t<=i,c=t>=o-i,u=e<=i,f=e>=a-i;if(l||c){const h=l?"left":"right";return e<=s?`top-${h}`:e>=a-s?`bottom-${h}`:h}return u?t<=s?"top-left":t>=o-s?"top-right":"top":f?t<=s?"bottom-left":t>=o-s?"bottom-right":"bottom":null}function Nx(t,e,n,r){return[n-t,r-t,n-e,r-e]}function uz(t,e,n){const r={x:t.x,y:t.y,snappedX:!1,snappedY:!1};if(n<=0||e.length===0)return r;let i=n+1,s=n+1;for(const o of e){for(const a of Nx(t.x,t.x+t.width,o.x,o.x+o.width))Math.abs(a)<=n&&Math.abs(a)<Math.abs(i)&&(i=a);for(const a of Nx(t.y,t.y+t.height,o.y,o.y+o.height))Math.abs(a)<=n&&Math.abs(a)<Math.abs(s)&&(s=a)}return Math.abs(i)<=n&&(r.x=t.x+i,r.snappedX=!0),Math.abs(s)<=n&&(r.y=t.y+s,r.snappedY=!0),r}var Ix={normal:0,floating:1,modal:2},zx=["normal","minimized","maximized","snapped"],dz=["normal","floating","modal"],fz=["left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"];function hz(t={}){const e=lz(),n=t.keepInViewport??!0,r=t.minVisible??48,i=t.defaultSize??{width:480,height:320},s=t.cascadeOffset??32,o=t.cascadeOrigin??{x:32,y:32},a=t.idPrefix??"wm",l=t.historyLimit??50;let c={},u=[],f=null,h=t.viewport??{width:0,height:0},p=0,g=0,m=0,b=null,y=0,_=!1;const k=[],S=[];let E=[],M=0,O=!1,P=!1,x=null;const C=new Map;function R(){return b||(b={windows:c,order:u,focusedId:f,viewport:h}),b}function N(){b=null,_=!0}function B(){for(;k.length>0;)for(const L of k.splice(0))L()}function z(L){k.push(L)}function H(L){c={...c,[L.id]:L}}function X(L){const{[L]:ie,...Te}=c;c=Te,u=u.filter(ft=>ft!==L)}function G(L){return Ix[c[L].layer]}function Z(L){return L.map((ie,Te)=>({id:ie,index:Te,rank:G(ie)})).sort((ie,Te)=>ie.rank!==Te.rank?ie.rank-Te.rank:ie.index-Te.index).map(ie=>ie.id)}function oe(L){const ie=c[L],Te=u.filter(Jt=>Jt!==L),ft=Ix[ie.layer];let rn=Te.length;for(let Jt=Te.length-1;Jt>=0&&G(Te[Jt])>ft;Jt-=1)rn=Jt;const yn=[...Te.slice(0,rn),L,...Te.slice(rn)],Ut=yn.length!==u.length||yn.some((Jt,bt)=>Jt!==u[bt]);return u=yn,Ut}function K(){for(let L=u.length-1;L>=0;L-=1){const ie=c[u[L]];if(ie.layer==="modal"&&ie.stage!=="minimized")return ie.id}return null}function q(){const L=K();return u.filter(ie=>{const Te=c[ie];return!(Te.stage==="minimized"||L&&Te.layer!=="modal")})}function W(){const L=q();f=L.length>0?L[L.length-1]:null}function J(L,ie){z(()=>e.emit("focus",{window:L,previous:ie}))}function fe(L,ie){return Rx(L,ie.minSize,ie.maxSize)}function $(L){if(L.x!==void 0&&L.y!==void 0)return{x:L.x,y:L.y};const ie=m%10*s;m+=1;const Te={x:o.x+ie,y:o.y+ie};return{x:L.x??Te.x,y:L.y??Te.y}}function de(L={}){let ie=L.id;if(ie===void 0)do ie=`${a}-${++g}`;while(c[ie]);if(c[ie])throw new Error(`wmkit: window id "${ie}" already exists`);const Te={width:L.minWidth??160,height:L.minHeight??100},ft=L.maxWidth!==void 0||L.maxHeight!==void 0?{width:L.maxWidth??Number.POSITIVE_INFINITY,height:L.maxHeight??Number.POSITIVE_INFINITY}:null,rn=Rx({width:L.width??i.width,height:L.height??i.height},Te,ft);let Ut={...$(L),...rn};n&&(Ut=Oc(Ut,h,r));const Jt=L.stage??"normal",bt=Jt==="snapped"?"normal":Jt;let pe={id:ie,title:L.title??"Window",bounds:Ut,restoreBounds:null,restoreStage:null,stage:"normal",snapZone:null,layer:L.layer??"normal",minSize:Te,maxSize:ft,openedSeq:++p,draggable:L.draggable??!0,resizable:L.resizable??!0,closable:L.closable??!0,minimizable:L.minimizable??!0,maximizable:L.maximizable??!0,snappable:L.snappable??!0,meta:L.meta??{}};bt==="maximized"?pe={...pe,stage:bt,restoreBounds:Ut,bounds:ct()}:bt==="minimized"&&(pe={...pe,stage:bt,restoreStage:"normal"}),H(pe),oe(ie);let Ze=null;if(bt!=="minimized"){const We=f;!K()||pe.layer==="modal"?(f=ie,Ze={window:pe,previous:We}):W()}if(z(()=>e.emit("open",{window:pe})),Ze){const We=Ze;z(()=>e.emit("focus",We))}return z(()=>e.emit("order",{order:u})),N(),pe}function Be(L){const ie=c[L];return ie?(X(L),z(()=>e.emit("close",{window:ie})),f===L&&(W(),f&&J(c[f],L)),z(()=>e.emit("order",{order:u})),N(),!0):!1}function wt(){for(const L of[...u])Be(L)}function Je(L){const ie=c[L];if(!ie)return!1;const Te=K();if(Te&&Te!==L&&ie.layer!=="modal"){const Ut=c[Te];return Ut&&z(()=>e.emit("modalblocked",{window:Ut})),N(),!1}if(ie.stage==="minimized")return _t(L),f===L;const ft=f,rn=oe(L),yn=f!==L||rn;return f=L,yn&&(J(ie,ft),rn&&z(()=>e.emit("order",{order:u})),N()),!0}function Ue(){f!==null&&(f=null,N())}function ke(L=1){const ie=q();if(ie.length===0)return null;const Te=f?ie.indexOf(f):-1,ft=Te===-1?L===1?0:ie.length-1:(Te+L+ie.length)%ie.length,rn=ie[ft];return Je(rn),rn}function ct(){return{x:0,y:0,width:h.width,height:h.height}}function Ee(L,ie){const Te=c[L];if(!Te)return!1;const ft=ie(Te);return ft?(H(ft),z(()=>e.emit("stage",{window:ft,previous:Te.stage})),N(),!0):!1}function Ve(L){const ie=Ee(L,Te=>Te.stage==="minimized"?null:{...Te,stage:"minimized",restoreStage:Te.stage});if(ie&&f===L){const Te=f;W(),f&&J(c[f],Te),N()}return ie}function be(L){const ie=Ee(L,Te=>{if(Te.stage==="maximized")return null;const ft=Te.stage==="normal"?Te.bounds:Te.restoreBounds;return{...Te,stage:"maximized",snapZone:null,restoreBounds:ft,restoreStage:null,bounds:ct()}});return ie&&Je(L),ie}function xt(L){const ie=c[L];return ie?ie.stage==="maximized"?_t(L):be(L):!1}function _t(L){const ie=Ee(L,Te=>{if(Te.stage==="minimized"){const rn=Te.restoreStage??"normal";return rn==="maximized"?{...Te,stage:"maximized",restoreStage:null,bounds:ct()}:rn==="snapped"&&Te.snapZone?{...Te,stage:"snapped",restoreStage:null,bounds:lg(Te.snapZone,h)}:{...Te,stage:"normal",restoreStage:null}}if(Te.stage==="normal")return null;const ft=Te.restoreBounds??Te.bounds;return{...Te,stage:"normal",snapZone:null,restoreBounds:null,restoreStage:null,bounds:n?Oc(ft,h,r):ft}});return ie&&Je(L),ie}function Yt(L,ie){const Te=Ee(L,ft=>{const rn=fe(ie,ft),yn={x:ie.x,y:ie.y,...rn};return{...ft,stage:"normal",snapZone:null,restoreBounds:null,restoreStage:null,bounds:n?Oc(yn,h,r):yn}});return Te&&Je(L),Te}function en(L,ie){const Te=Ee(L,ft=>{const rn=ft.stage==="normal"?ft.bounds:ft.restoreBounds;return{...ft,stage:"snapped",snapZone:ie,restoreBounds:rn,restoreStage:null,bounds:lg(ie,h)}});return Te&&Je(L),Te}function tn(L,ie,Te){const ft=c[L];if((ft==null?void 0:ft.stage)!=="normal")return!1;let rn={...ft.bounds,x:ie,y:Te};if(n&&(rn=Oc(rn,h,r)),R0(rn,ft.bounds))return!0;const yn={...ft,bounds:rn};return H(yn),z(()=>e.emit("move",{window:yn})),N(),!0}function Qn(L,ie,Te){const ft=c[L];return ft?tn(L,ft.bounds.x+ie,ft.bounds.y+Te):!1}function se(L,ie){const Te=c[L];if(!Te||Te.stage==="maximized"||Te.stage==="minimized")return!1;const ft={...Te.bounds,...ie},rn=fe(ft,Te);let yn={x:ft.x,y:ft.y,...rn};n&&(yn=Oc(yn,h,r));const Ut=Te.stage==="snapped";if(R0(yn,Te.bounds)&&!Ut)return!0;const Jt=Ut?{...Te,stage:"normal",snapZone:null,restoreBounds:null,bounds:yn}:{...Te,bounds:yn};return H(Jt),Ut&&z(()=>e.emit("stage",{window:Jt,previous:"snapped"})),z(()=>e.emit("resize",{window:Jt})),N(),!0}function _e(L,ie){const Te=c[L];if(!Te)return!1;const ft={...Te,title:ie.title??Te.title,layer:ie.layer??Te.layer,minSize:ie.minSize??Te.minSize,maxSize:ie.maxSize===void 0?Te.maxSize:ie.maxSize,draggable:ie.draggable??Te.draggable,resizable:ie.resizable??Te.resizable,closable:ie.closable??Te.closable,minimizable:ie.minimizable??Te.minimizable,maximizable:ie.maximizable??Te.maximizable,snappable:ie.snappable??Te.snappable,meta:ie.meta?{...Te.meta,...ie.meta}:Te.meta},rn=fe(ft.bounds,ft),yn=rn.width!==ft.bounds.width||rn.height!==ft.bounds.height,Ut=yn?{...ft,bounds:{...ft.bounds,...rn}}:ft;if(H(Ut),ie.layer&&ie.layer!==Te.layer&&(u=Z(u),z(()=>e.emit("order",{order:u})),ie.layer==="modal"&&K()===L&&f!==L)){const Jt=f;f=L,J(Ut,Jt)}return z(()=>e.emit("update",{window:Ut})),yn&&z(()=>e.emit("resize",{window:Ut})),N(),!0}function me(L){L.width===h.width&&L.height===h.height||(h={...L},ge(),b=null,_=!0)}function ve(){return Object.values(c).filter(L=>L.stage==="minimized").sort((L,ie)=>L.openedSeq-ie.openedSeq)}function Xe(){return{windows:c,order:u,focusedId:f}}function et(){if(P){P=!1;return}if(!(l<=0)){if(M>0){if(O)return;O=!0}S.push(x),S.length>l&&S.shift(),E=[]}}function dt(L){y===0&&(x=Xe()),y+=1;try{return L()}finally{y-=1,y===0&&(_&&(_=!1,et(),b=null,B(),e.emit("change",{state:R()})),x=null)}}function ge(){for(const L of u){const ie=c[L];if(ie.stage==="maximized"){const Te={...ie,bounds:ct()};H(Te),z(()=>e.emit("resize",{window:Te}))}else if(ie.stage==="snapped"&&ie.snapZone){const Te={...ie,bounds:lg(ie.snapZone,h)};H(Te),z(()=>e.emit("resize",{window:Te}))}else if(ie.stage==="normal"&&n){const Te=Oc(ie.bounds,h,r);if(!R0(Te,ie.bounds)){const ft={...ie,bounds:Te};H(ft),z(()=>e.emit("move",{window:ft}))}}}}function Ae(L){c=L.windows,u=[...L.order],f=L.focusedId,ge(),N()}function Ie(){const L=S.pop();return L?(E.push(Xe()),P=!0,Ae(L),!0):!1}function pt(){const L=E.pop();return L?(S.push(Xe()),P=!0,Ae(L),!0):!1}function Le(){M+=1,M===1&&(O=!1)}function gt(){M>0&&(M-=1)}function nn(){S.length=0,E=[]}function St(L){const ie=Ce();return C.set(L,structuredClone(ie)),ie}function Rt(L){const ie=C.get(L);return ie?Vt(structuredClone(ie)):!1}function re(L){const ie=C.get(L);return ie?structuredClone(ie):void 0}function ae(L,ie){return tt(ie)?(C.set(L,structuredClone(ie)),!0):!1}function he(L){return C.delete(L)}function le(){return[...C.keys()]}function Pe(L){const ie=u.filter(Ut=>c[Ut].stage!=="minimized");if(ie.length===0)return;if(L==="cascade"){ie.forEach((Ut,Jt)=>{const bt=c[Ut],pe=bt.restoreBounds??bt.bounds;Yt(Ut,{x:o.x+Jt%10*s,y:o.y+Jt%10*s,width:pe.width,height:pe.height})});return}const Te=Math.ceil(Math.sqrt(ie.length)),ft=Math.ceil(ie.length/Te),rn=Math.floor(h.width/Te),yn=Math.floor(h.height/ft);ie.forEach((Ut,Jt)=>{Yt(Ut,{x:Jt%Te*rn,y:Math.floor(Jt/Te)*yn,width:rn,height:yn})})}function Oe(){for(const L of[...u])Ve(L)}function Re(){for(const L of ve())_t(L.id)}function Ce(){return{version:1,windows:u.map(L=>c[L]).map(L=>({...L,bounds:{...L.bounds},restoreBounds:L.restoreBounds?{...L.restoreBounds}:null,minSize:{...L.minSize},maxSize:L.maxSize?{width:Number.isFinite(L.maxSize.width)?L.maxSize.width:null,height:Number.isFinite(L.maxSize.height)?L.maxSize.height:null}:null,meta:{...L.meta}})),order:[...u],focusedId:f}}function He(L){if(typeof L!="object"||L===null)return!1;const ie=L;return typeof ie.x=="number"&&typeof ie.y=="number"&&typeof ie.width=="number"&&typeof ie.height=="number"}function Ge(L){if(typeof L!="object"||L===null)return!1;const ie=L;return typeof ie.width=="number"&&typeof ie.height=="number"}function Ft(L){return L===null||typeof L=="number"}function jt(L){if(typeof L!="object"||L===null)return null;const ie=L;return!Ft(ie.width)||!Ft(ie.height)||ie.width===null&&ie.height===null?null:{width:ie.width??Number.POSITIVE_INFINITY,height:ie.height??Number.POSITIVE_INFINITY}}function nt(L){if(typeof L!="object"||L===null)return!1;const ie=L;return typeof ie.id=="string"&&ie.id.length>0&&He(ie.bounds)&&zx.includes(ie.stage)&&dz.includes(ie.layer)}function tt(L){return typeof L!="object"||L===null||L.version!==1||!Array.isArray(L.windows)||!L.windows.every(nt)?!1:new Set(L.windows.map(Te=>Te.id)).size===L.windows.length}function Vt(L){var bt;if(!tt(L))return!1;const ie=c,Te={};let ft=0;for(const pe of L.windows){if(Te[pe.id])return!1;const Ze={id:pe.id,title:typeof pe.title=="string"?pe.title:"Window",bounds:{...pe.bounds},restoreBounds:pe.restoreBounds&&He(pe.restoreBounds)?{...pe.restoreBounds}:null,restoreStage:zx.includes(pe.restoreStage)?pe.restoreStage:null,stage:pe.stage,snapZone:fz.includes(pe.snapZone)?pe.snapZone:null,layer:pe.layer,minSize:Ge(pe.minSize)?{...pe.minSize}:{width:160,height:100},maxSize:jt(pe.maxSize),openedSeq:typeof pe.openedSeq=="number"?pe.openedSeq:++ft,draggable:pe.draggable!==!1,resizable:pe.resizable!==!1,closable:pe.closable!==!1,minimizable:pe.minimizable!==!1,maximizable:pe.maximizable!==!1,snappable:pe.snappable!==!1,meta:pe.meta&&typeof pe.meta=="object"?pe.meta:{}};ft=Math.max(ft,Ze.openedSeq),Te[Ze.id]=Ze}const rn=Array.isArray(L.order)?L.order:[],yn=new Set,Ut=[];for(const pe of rn)typeof pe=="string"&&Te[pe]&&!yn.has(pe)&&(yn.add(pe),Ut.push(pe));for(const pe of Object.keys(Te))yn.has(pe)||Ut.push(pe);c=Te,u=Ut,u=Z(u),p=ft,f=L.focusedId&&c[L.focusedId]?L.focusedId:null,f&&((bt=c[f])==null?void 0:bt.stage)==="minimized"&&(f=null),f||W();const Jt=K();if(Jt){const pe=f?c[f]:null;(pe==null?void 0:pe.layer)!=="modal"&&(f=Jt)}for(const pe of Object.keys(ie))if(!c[pe]){const Ze=ie[pe];z(()=>e.emit("close",{window:Ze}))}for(const pe of u)if(!ie[pe]){const Ze=c[pe];z(()=>e.emit("open",{window:Ze}))}return z(()=>e.emit("order",{order:u})),nn(),P=!0,N(),!0}function In(){e.clear()}return{open:L=>dt(()=>de(L)),close:L=>dt(()=>Be(L)),closeAll:()=>dt(wt),focus:L=>dt(()=>Je(L)),blur:()=>dt(Ue),cycleFocus:L=>dt(()=>ke(L)),minimize:L=>dt(()=>Ve(L)),maximize:L=>dt(()=>be(L)),toggleMaximize:L=>dt(()=>xt(L)),restore:L=>dt(()=>_t(L)),restoreTo:(L,ie)=>dt(()=>Yt(L,ie)),snap:(L,ie)=>dt(()=>en(L,ie)),move:(L,ie,Te)=>dt(()=>tn(L,ie,Te)),moveBy:(L,ie,Te)=>dt(()=>Qn(L,ie,Te)),resize:(L,ie)=>dt(()=>se(L,ie)),update:(L,ie)=>dt(()=>_e(L,ie)),get:L=>c[L],getState:R,minimized:ve,setViewport:L=>dt(()=>me(L)),batch:L=>dt(L),serialize:Ce,hydrate:L=>dt(()=>Vt(L)),undo:()=>dt(Ie),redo:()=>dt(pt),canUndo:()=>S.length>0,canRedo:()=>E.length>0,beginInteraction:Le,endInteraction:gt,saveLayout:St,loadLayout:L=>dt(()=>Rt(L)),getLayout:re,setLayout:ae,deleteLayout:he,layoutNames:le,arrange:L=>dt(()=>Pe(L)),minimizeAll:()=>dt(Oe),restoreAll:()=>dt(Re),subscribe:L=>e.on("change",({state:ie})=>L(ie)),on:(L,ie)=>e.on(L,ie),destroy:In}}function OM(t){return t.matchMedia("(prefers-reduced-motion: reduce)").matches}function pz(t,e,n={}){const r=t.ownerDocument.defaultView;if(!r||OM(r)||typeof t.animate!="function")return;const i=e.getBoundingClientRect(),s=t.getBoundingClientRect();if(i.width===0||s.width===0)return;const o=t.ownerDocument.createElement("div"),a=r.getComputedStyle(t);o.style.cssText=`position:fixed;left:${s.left}px;top:${s.top}px;width:${s.width}px;height:${s.height}px;margin:0;pointer-events:none;z-index:2147483647;border-radius:${a.borderRadius};background:${a.backgroundColor};box-shadow:${a.boxShadow};transform-origin:top left;will-change:transform,opacity`,t.ownerDocument.body.append(o);const l=i.left+i.width/2-(s.left+s.width/2),c=i.top+i.height/2-(s.top+s.height/2),u=Math.max(i.width/s.width,.05),f=Math.max(i.height/s.height,.05),h=o.animate([{transform:`translate(${l}px, ${c}px) scale(${u}, ${f})`,opacity:.2},{transform:"translate(0, 0) scale(1, 1)",opacity:.9}],{duration:n.duration??260,easing:n.easing??"cubic-bezier(0.32, 0.72, 0, 1)"});h.onfinish=()=>o.remove(),h.oncancel=()=>o.remove()}function gz(t,e,n={}){const r=t.ownerDocument.defaultView;if(!r||OM(r)||typeof t.animate!="function")return;const i=t.getBoundingClientRect(),s=e.getBoundingClientRect();if(i.width===0||s.width===0)return;const o=t.ownerDocument.createElement("div"),a=r.getComputedStyle(t);o.style.cssText=`position:fixed;left:${i.left}px;top:${i.top}px;width:${i.width}px;height:${i.height}px;margin:0;pointer-events:none;z-index:2147483647;border-radius:${a.borderRadius};background:${a.backgroundColor};box-shadow:${a.boxShadow};transform-origin:top left;will-change:transform,opacity`,t.ownerDocument.body.append(o);const l=s.left+s.width/2-(i.left+i.width/2),c=s.top+s.height/2-(i.top+i.height/2),u=Math.max(s.width/i.width,.05),f=Math.max(s.height/i.height,.05),h=o.animate([{transform:"translate(0, 0) scale(1, 1)",opacity:.9},{transform:`translate(${l}px, ${c}px) scale(${u}, ${f})`,opacity:.2}],{duration:n.duration??260,easing:n.easing??"cubic-bezier(0.32, 0.72, 0, 1)"});h.onfinish=()=>o.remove(),h.oncancel=()=>o.remove()}var mz={opened:t=>`${t} window opened`,closed:t=>`${t} window closed`,minimized:t=>`${t} minimized`,restored:t=>`${t} restored`,maximized:t=>`${t} maximized`,snapped:(t,e)=>`${t} snapped to ${e.replace("-"," ")}`,focused:t=>`${t} focused`};function vz(t,e,n={}){const r={...mz,...n},i=e.ownerDocument.createElement("div");i.setAttribute("role","status"),i.setAttribute("aria-live","polite"),i.dataset.wmAnnouncer="",i.style.cssText="position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0",e.append(i);let s;function o(l){i.textContent=l,s!==void 0&&clearTimeout(s),s=setTimeout(()=>{i.textContent=""},2e3)}const a=[t.on("open",({window:l})=>o(r.opened(l.title))),t.on("close",({window:l})=>o(r.closed(l.title))),t.on("stage",({window:l,previous:c})=>{l.stage==="minimized"?o(r.minimized(l.title)):l.stage==="maximized"?o(r.maximized(l.title)):l.stage==="snapped"&&l.snapZone?o(r.snapped(l.title,l.snapZone)):l.stage==="normal"&&c!=="normal"&&o(r.restored(l.title))})];return{element:i,announce:o,destroy(){for(const l of a)l();s!==void 0&&clearTimeout(s),i.remove()}}}var wb="button, input, select, textarea, a[href], [contenteditable], [data-wm-close], [data-wm-minimize], [data-wm-maximize]";function bz(t){const e=t.ownerDocument.defaultView;if(!e)throw new Error("wmkit: desktop element is not attached to a document");return e}function yz(t){const{wm:e,doc:n,view:r}=t;return function(s,o,a){const l=e.get(s);if(!(l!=null&&l.draggable)||a.button!==0||t.currentDrag())return;const c=a.target;if(c!=null&&c.closest(wb))return;a.preventDefault();const u=t.trackRect(),f=t.toLocal(a),h=l.bounds,p={id:s,pointerId:a.pointerId,grabDX:f.x-h.x,grabDY:f.y-h.y,grabRatio:sc((f.x-h.x)/h.width,.05,.95),startBounds:h,startStage:l.stage,startZone:l.snapZone,startRestoreBounds:l.restoreBounds,restored:l.stage==="normal",moved:!1,zone:null,raf:0,pendingX:0,pendingY:0,hasPending:!1,finish:()=>{}},g=t.windowElement(s);function m(){if(!p.hasPending||t.currentDrag()!==p)return;p.hasPending=!1,p.raf=0;const E=e.get(s);if(!E)return;if(!p.restored){const P=E.restoreBounds??p.startBounds,x=P.width,C=P.height;e.restoreTo(s,{x:p.pendingX-x*p.grabRatio,y:p.pendingY-Math.min(p.grabDY,24),width:x,height:C}),p.restored=!0;const R=e.get(s);R&&(p.grabDX=p.pendingX-R.bounds.x,p.grabDY=p.pendingY-R.bounds.y);return}let M=p.pendingX-p.grabDX,O=p.pendingY-p.grabDY;if(t.magnetThreshold>0){const P=e.getState(),x=[{x:0,y:0,width:P.viewport.width,height:P.viewport.height}];for(const R of P.order){if(R===s)continue;const N=P.windows[R];N&&N.stage!=="minimized"&&x.push(N.bounds)}const C=uz({x:M,y:O,width:E.bounds.width,height:E.bounds.height},x,t.magnetThreshold);M=C.x,O=C.y}if(e.move(s,M,O),t.snapEnabled&&E.snappable){const P=e.getState().viewport,x=cz(p.pendingX,p.pendingY,P,t.snapDetect);let C=x;x==="top"&&(t.topEdge==="maximize"?C=E.maximizable?"maximize":null:t.topEdge==="none"&&(C=null)),p.zone=C,C?t.showPreview(C==="maximize"?{x:0,y:0,width:P.width,height:P.height}:lg(C,P)):t.hidePreview()}}function b(E){if(E.pointerId!==p.pointerId)return;const M=t.toLocal(E);if(!p.moved){if(Math.abs(M.x-(p.startBounds.x+p.grabDX))+Math.abs(M.y-(p.startBounds.y+p.grabDY))<3&&p.restored)return;p.moved=!0,g&&(g.dataset.wmDragging="",g.style.willChange="transform")}p.pendingX=M.x,p.pendingY=M.y,p.hasPending=!0,p.raf===0&&(p.raf=r.requestAnimationFrame(m))}function y(E){E.pointerId===p.pointerId&&S(!1)}function _(E){E.pointerId===p.pointerId&&S(!0)}function k(E){E.key==="Escape"&&(E.preventDefault(),S(!0))}function S(E){if(t.currentDrag()===p){if(p.raf!==0&&r.cancelAnimationFrame(p.raf),p.hasPending&&!E&&m(),t.releaseDrag(p),u(),o.removeEventListener("pointermove",b),o.removeEventListener("pointerup",y),o.removeEventListener("pointercancel",_),n.removeEventListener("keydown",k,!0),o.hasPointerCapture(p.pointerId)&&o.releasePointerCapture(p.pointerId),g&&(delete g.dataset.wmDragging,g.style.willChange=""),t.hidePreview(),E){p.moved&&p.restored&&(p.startStage==="maximized"?(e.restoreTo(s,p.startRestoreBounds??p.startBounds),e.maximize(s)):p.startStage==="snapped"&&p.startZone?(e.restoreTo(s,p.startRestoreBounds??p.startBounds),e.snap(s,p.startZone)):e.move(s,p.startBounds.x,p.startBounds.y)),e.endInteraction();return}p.moved&&p.zone&&(p.zone==="maximize"?e.maximize(s):e.snap(s,p.zone)),e.endInteraction()}}p.finish=S,e.beginInteraction(),t.claimDrag(p),o.setPointerCapture(a.pointerId),o.addEventListener("pointermove",b),o.addEventListener("pointerup",y),o.addEventListener("pointercancel",_),n.addEventListener("keydown",k,!0)}}var wz=["n","e","s","w","ne","nw","se","sw"],xz={n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize",ne:"nesw-resize",sw:"nesw-resize",nw:"nwse-resize",se:"nwse-resize"};function _z(t){const{wm:e,doc:n,view:r}=t;return function(s,o,a){const l=e.get(s);if(!(l!=null&&l.resizable)||a.button!==0||t.currentDrag())return;a.preventDefault(),a.stopPropagation();const c=a.currentTarget;e.beginInteraction();const u=t.trackRect(),f=t.toLocal(a),h=l.bounds,p=l.minSize,g=l.maxSize;let m=0,b=0,y=0,_=!1;const k=t.windowElement(s);k&&(k.dataset.wmResizing=o);function S(N){return sc(N,p.width,g?g.width:Number.POSITIVE_INFINITY)}function E(N){return sc(N,p.height,g?g.height:Number.POSITIVE_INFINITY)}function M(){if(!_)return;_=!1,m=0;const N=b-f.x,B=y-f.y,z={...h};o.includes("e")&&(z.width=S(h.width+N)),o.includes("s")&&(z.height=E(h.height+B)),o.includes("w")&&(z.width=S(h.width-N),z.x=h.x+(h.width-z.width)),o.includes("n")&&(z.height=E(h.height-B),z.y=h.y+(h.height-z.height)),e.resize(s,z)}function O(N){if(N.pointerId!==a.pointerId)return;const B=t.toLocal(N);b=B.x,y=B.y,_=!0,m===0&&(m=r.requestAnimationFrame(M))}function P(N){m!==0&&r.cancelAnimationFrame(m),_&&!N&&M(),u(),c.removeEventListener("pointermove",O),c.removeEventListener("pointerup",x),c.removeEventListener("pointercancel",C),n.removeEventListener("keydown",R,!0),c.hasPointerCapture(a.pointerId)&&c.releasePointerCapture(a.pointerId),k&&delete k.dataset.wmResizing,N&&e.resize(s,h),e.endInteraction()}function x(N){N.pointerId===a.pointerId&&P(!1)}function C(N){N.pointerId===a.pointerId&&P(!0)}function R(N){N.key==="Escape"&&(N.preventDefault(),P(!0))}c.setPointerCapture(a.pointerId),c.addEventListener("pointermove",O),c.addEventListener("pointerup",x),c.addEventListener("pointercancel",C),n.addEventListener("keydown",R,!0)}}function Sz(t,e,n){const r="position:absolute;touch-action:none;user-select:none;-webkit-user-select:none;",i={n:`top:${-e/2}px;left:${n}px;right:${n}px;height:${e}px`,s:`bottom:${-e/2}px;left:${n}px;right:${n}px;height:${e}px`,e:`right:${-e/2}px;top:${n}px;bottom:${n}px;width:${e}px`,w:`left:${-e/2}px;top:${n}px;bottom:${n}px;width:${e}px`,ne:`top:${-e/2}px;right:${-e/2}px;width:${n}px;height:${n}px`,nw:`top:${-e/2}px;left:${-e/2}px;width:${n}px;height:${n}px`,se:`bottom:${-e/2}px;right:${-e/2}px;width:${n}px;height:${n}px`,sw:`bottom:${-e/2}px;left:${-e/2}px;width:${n}px;height:${n}px`};return wz.map(s=>{const o=t.createElement("div");return o.dataset.wmResize=s,o.setAttribute("aria-hidden","true"),o.style.cssText=`${r}${i[s]};cursor:${xz[s]}`,{element:o,direction:s}})}function kz(t,e,n={}){var oe,K;const r=e.ownerDocument,i=bz(e),s=typeof i.matchMedia=="function"&&i.matchMedia("(pointer: coarse)").matches,o=n.snap!==!1,a=typeof n.snap=="object"?n.snap:{},l=a.preview!==!1,c=a.topEdge??"maximize",u=n.keyboard!==!1,f=typeof n.keyboard=="object"?n.keyboard:{},h=f.moveStep??16,p=f.cycle!==!1,g=((oe=n.hitAreas)==null?void 0:oe.edge)??(s?16:8),m=((K=n.hitAreas)==null?void 0:K.corner)??(s?24:12),b=n.magnetism===!1?0:(typeof n.magnetism=="object"?n.magnetism.threshold:void 0)??(s?12:8);e.dataset.wmDesktop="",i.getComputedStyle(e).position==="static"&&(e.style.position="relative");const y=new Map,_=[];let k=null,S=null,E=null,M=null,O=0,P=null;n.announce!==!1&&(P=vz(t,e,typeof n.announce=="object"?n.announce:{}),_.push(()=>P==null?void 0:P.destroy()));let x=null;function C(q){l&&(x||(x=r.createElement("div"),x.dataset.wmSnapPreview="",x.style.cssText="position:absolute;left:0;top:0;pointer-events:none;display:none;z-index:2147483646",e.append(x)),x.style.display="block",x.style.transform=`translate3d(${q.x}px, ${q.y}px, 0)`,x.style.width=`${q.width}px`,x.style.height=`${q.height}px`)}function R(){x&&(x.style.display="none")}const N={wm:t,doc:r,view:i,toLocal(q){const W=M??e.getBoundingClientRect();return{x:q.clientX-W.left,y:q.clientY-W.top}},trackRect(){if(O===0){const W=e.getBoundingClientRect();M={left:W.left,top:W.top}}O+=1;let q=!1;return()=>{q||(q=!0,O-=1,O===0&&(M=null))}},windowElement:q=>{var W;return(W=y.get(q))==null?void 0:W.element},showPreview:C,hidePreview:R,snapEnabled:o,snapDetect:{threshold:a.threshold??(s?20:12),cornerSize:a.cornerSize??(s?96:64)},topEdge:c,hitEdge:g,hitCorner:m,magnetThreshold:b,currentDrag:()=>E,claimDrag(q){E=q},releaseDrag(q){E===q&&(E=null)}},B=yz(N),z=_z(N);if(n.autoViewport!==!1){const q=()=>t.setViewport({width:e.clientWidth,height:e.clientHeight});q();const W=new ResizeObserver(q);W.observe(e),_.push(()=>W.disconnect())}function H(q,W,J){const fe=q.element,$=q.lastState===null;if($&&(fe.style.transition="none"),q.lastState!==W){fe.style.transform=`translate3d(${W.bounds.x}px, ${W.bounds.y}px, 0)`,fe.style.width=`${W.bounds.width}px`,fe.style.height=`${W.bounds.height}px`,fe.dataset.wmStage=W.stage,fe.dataset.wmLayer=W.layer,fe.hidden=W.stage==="minimized",fe.setAttribute("aria-label",W.title),W.layer==="modal"?fe.setAttribute("aria-modal","true"):fe.removeAttribute("aria-modal");for(const de of q.handles)de.style.display=W.resizable&&W.stage==="normal"?"":"none";q.lastState=W}q.lastZ!==J&&(fe.style.zIndex=String(J+1),q.lastZ=J),$&&(fe.offsetWidth,fe.style.transition="")}function X(){const q=t.getState(),W=q.order!==k;if(q.order.forEach((J,fe)=>{const $=y.get(J),de=q.windows[J];!$||!de||(W||$.lastState!==de)&&H($,de,fe)}),q.focusedId!==S){if(S){const J=y.get(S);J&&delete J.element.dataset.wmFocused}if(q.focusedId){const J=y.get(q.focusedId);J&&(J.element.dataset.wmFocused="")}S=q.focusedId}k=q.order}if(_.push(t.subscribe(X)),_.push(t.on("focus",({window:q})=>{const W=y.get(q.id);W&&(W.element.contains(r.activeElement)||W.element.focus({preventScroll:!0}))})),_.push(t.on("modalblocked",({window:q})=>{const W=y.get(q.id);W&&(delete W.element.dataset.wmFlash,W.element.offsetWidth,W.element.dataset.wmFlash="")})),_.push(t.on("stage",({window:q,previous:W})=>{var fe,$;const J=y.get(q.id);if(J){if(q.stage==="minimized"&&W!=="minimized"){const de=(fe=n.minimizeTarget)==null?void 0:fe.call(n,q);de&&gz(J.element,de)}else if(W==="minimized"&&q.stage!=="minimized"){const de=($=n.minimizeTarget)==null?void 0:$.call(n,q);de&&pz(J.element,de)}}})),u&&p){const q=W=>{W.key==="F6"&&(W.preventDefault(),t.cycleFocus(W.shiftKey?-1:1))};e.addEventListener("keydown",q),_.push(()=>e.removeEventListener("keydown",q))}function G(q){E&&E.finish(q)}function Z(q,W,J={}){if(!t.get(q))throw new Error(`wmkit: cannot attach unknown window "${q}"`);if(y.has(q))throw new Error(`wmkit: window "${q}" is already attached`);const $={element:W,handle:null,handles:[],lastState:null,lastZ:-1,cleanup:[]};W.dataset.wmWindow=q,W.setAttribute("role","dialog"),W.tabIndex=-1,W.style.position="absolute",W.style.left="0",W.style.top="0";const de=W.querySelector("[data-wm-title]");de&&(de.id||(de.id=`wmkit-title-${q}`),W.setAttribute("aria-labelledby",de.id));const Be=typeof J.handle=="string"?W.querySelector(J.handle):J.handle??W.querySelector("[data-wm-drag]");$.handle=Be;const wt=()=>{t.focus(q)};W.addEventListener("pointerdown",wt,!0),$.cleanup.push(()=>W.removeEventListener("pointerdown",wt,!0));const Je=Ee=>{const Ve=Ee.target;if(!Ve)return;const be=t.get(q);be&&(Ve.closest("[data-wm-close]")?be.closable&&t.close(q):Ve.closest("[data-wm-minimize]")?be.minimizable&&t.minimize(q):Ve.closest("[data-wm-maximize]")&&be.maximizable&&t.toggleMaximize(q))};if(W.addEventListener("click",Je),$.cleanup.push(()=>W.removeEventListener("click",Je)),Be){Be.style.touchAction="none";const Ee=be=>B(q,Be,be);Be.addEventListener("pointerdown",Ee),$.cleanup.push(()=>Be.removeEventListener("pointerdown",Ee));const Ve=be=>{const xt=be.target;if(xt!=null&&xt.closest(wb))return;const _t=t.get(q);_t!=null&&_t.maximizable&&t.toggleMaximize(q)};if(Be.addEventListener("dblclick",Ve),$.cleanup.push(()=>Be.removeEventListener("dblclick",Ve)),n.onTitlebarContextMenu){const be=xt=>{var Yt;const _t=t.get(q);_t&&(xt.preventDefault(),(Yt=n.onTitlebarContextMenu)==null||Yt.call(n,_t,xt))};Be.addEventListener("contextmenu",be),$.cleanup.push(()=>Be.removeEventListener("contextmenu",be))}}if(J.resizeHandles!==!1)for(const{element:Ee,direction:Ve}of Sz(r,g,m)){const be=xt=>z(q,Ve,xt);Ee.addEventListener("pointerdown",be),$.cleanup.push(()=>Ee.removeEventListener("pointerdown",be)),W.append(Ee),$.handles.push(Ee)}const Ue=Ee=>{const Ve=Ee.target;if(Ve!=null&&Ve.closest(wb))return;const be=t.get(q);if(!be)return;const _t={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[Ee.key];if(!_t||!u)return;Ee.preventDefault();const Yt=Ee.altKey?1:h,[en,tn]=_t;Ee.shiftKey?be.resizable&&t.resize(q,{width:be.bounds.width+en*Yt,height:be.bounds.height+tn*Yt}):be.draggable&&be.stage==="normal"&&t.moveBy(q,en*Yt,tn*Yt)};W.addEventListener("keydown",Ue),$.cleanup.push(()=>W.removeEventListener("keydown",Ue));const ke=Ee=>{if(Ee.key!=="Tab")return;const Ve=t.get(q);if((Ve==null?void 0:Ve.layer)!=="modal")return;const be=W.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(be.length===0)return;const xt=be[0],_t=be[be.length-1];!xt||!_t||(Ee.shiftKey&&r.activeElement===xt?(Ee.preventDefault(),_t.focus()):!Ee.shiftKey&&r.activeElement===_t&&(Ee.preventDefault(),xt.focus()))};W.addEventListener("keydown",ke),$.cleanup.push(()=>W.removeEventListener("keydown",ke));const ct=()=>{(E==null?void 0:E.id)===q&&G(!0);for(const Ee of $.cleanup)Ee();for(const Ee of $.handles)Ee.remove();y.delete(q)};if(J.removeOnClose){const Ee=t.on("close",({window:Ve})=>{Ve.id===q&&(ct(),W.remove())});$.cleanup.push(Ee)}return y.set(q,$),k=null,S=null,X(),ct}return{element:e,wm:t,attachWindow:Z,destroy(){G(!0);for(const[,q]of y){for(const W of q.cleanup)W();for(const W of q.handles)W.remove()}y.clear();for(const q of _)q();x==null||x.remove(),delete e.dataset.wmDesktop}}}function Mz(t,e={}){let n=null;const r=new Set;function i(s){n&&!s.detach&&t.get(s.id)&&(s.detach=n.attachWindow(s.id,s.element,s.options))}return t.on("open",({window:s})=>{for(const o of r)o.id===s.id&&i(o)}),{wm:t,controller:()=>n,bindDesktop(s){if(n)throw new Error("wmkit: desktop is already bound");n=kz(t,s,e);for(const o of r)i(o);return()=>{for(const o of r)o.detach=null;n==null||n.destroy(),n=null}},bindWindow(s,o,a){const l={id:s,element:o,options:a,detach:null};return r.add(l),i(l),()=>{var c;(c=l.detach)==null||c.call(l),l.detach=null,r.delete(l)}}}}function Tz(t){return hz(t)}function Ez(t){return{subscribe(e){return e(t.getState()),t.subscribe(e)}}}function Az(t,e){const n=Mz(t,e);return{binder:n,desktop(r){return{destroy:n.bindDesktop(r)}},window(r,i){let s=n.bindWindow(i.id,r,i);return{update(o){s(),s=n.bindWindow(o.id,r,o)},destroy(){s()}}}}}function Pz(){try{const t=globalThis.localStorage,e="__wmkit_probe__";return t.setItem(e,"1"),t.removeItem(e),t}catch{return null}}function Cz(t,e={}){const n=e.key??"wmkit",r=e.storage??Pz(),i=e.debounce??150;let s,o=!1;function a(){if(r)try{r.setItem(n,JSON.stringify(t.serialize()))}catch{}}function l(){if(!r)return!1;let f=null;try{f=r.getItem(n)}catch{return!1}if(!f)return!1;let h;try{h=JSON.parse(f)}catch{return!1}o=!0;const p=t.hydrate(h);return o=!1,p}function c(){if(r)try{r.removeItem(n)}catch{}}const u=t.subscribe(()=>{o||!r||(s!==void 0&&clearTimeout(s),s=setTimeout(a,i))});return e.autoRestore!==!1&&l(),{restore:l,save:a,clear:c,destroy(){u(),s!==void 0&&clearTimeout(s)}}}const RM="oikos-docked-apps";function Oz(){if(typeof localStorage>"u")return{};try{const t=localStorage.getItem(RM);return t?JSON.parse(t):{}}catch{return{}}}const K1=dr(Oz());function Rz(t){typeof localStorage>"u"||localStorage.setItem(RM,JSON.stringify(t))}K1.subscribe(Rz);const Nz={subscribe:K1.subscribe};function Iz(t){K1.update(e=>({...e,[t]:!(e[t]??!0)}))}const zz=/execution\s+([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i;function hf(t){const e=[];for(const n of t){if(n.type!=="tool_result")continue;const r=typeof n.result=="string"?n.result:JSON.stringify(n.result??"");if(!r.includes("requires approval"))continue;const i=r.match(zz);if(i){const s=n.args??{},o=typeof s.purpose=="string"?s.purpose:void 0;e.push({executionId:i[1],action:o?o.slice(0,60):typeof s.action=="string"?s.action:n.name,target:typeof s.target=="string"?s.target:"unknown",destructive:/\bDESTRUCTIVE\b/.test(r),command:typeof s.command=="string"?s.command:void 0,purpose:o})}}return e}function Dg(){return crypto.randomUUID()}function NM(t){t.update(e=>{const n=e[e.length-1];return n&&n.role==="assistant"&&n.text===""&&n.tools.length===0?e.slice(0,-1):e})}const IM=dr([]),X1=dr(!1),zM=dr("connected"),Hu=dr(null),lp=dr([]),cp=dr([]);function Lz(t){cp.update(e=>e.filter(n=>n.id!==t))}function LM(t,e,n){cp.update(r=>[...r,{id:crypto.randomUUID(),message:t,action:e,tag:n}])}const DM=new Set(["done","failed","abandoned","awaiting_input"]);function Fg(t){const e=t.toLowerCase();return e.includes("input stream")||e.includes("llm:")||e.includes("failed to fetch")||e.includes("network")||e.includes("econnreset")||e.includes("timeout")||/http 5\d\d/.test(e)?"The model connection dropped. The task keeps running in the background — it will catch up here automatically.":/http 401|http 403|unauthor|forbidden/.test(e)?"Your session expired. Reconnect to continue.":t}function FM(t){const e=xb.get(t);e&&(e.streaming.set(!1),e.connectionState.set("connected")),ki(Hu)===t&&(X1.set(!1),zM.set("connected")),cp.update(n=>n.filter(r=>r.tag!=="connection"))}let Lx=!1;function Dz(){Lx||(Lx=!0,od(),mc.subscribe(t=>{var i;const e=t[0];if(!e||e.type!=="task.status")return;const n=e.correlation_id;if(!n)return;const r=(i=e.data)==null?void 0:i.status;typeof r=="string"&&DM.has(r)&&FM(n)}))}const rl=new Map;async function Z1(){const t=await xI();lp.set(t)}function Fz(t){const e=new Map;for(const n of t??[]){const r=n.id??crypto.randomUUID(),i=e.get(r);e.set(r,i?{...i,...n,id:r}:{...n,id:r})}return Array.from(e.values())}function BM(t){return t.map(e=>{const n=typeof e.content=="string"?{text:e.content}:e.content,r=Fz(n==null?void 0:n.tool_calls);return{id:e.id,role:e.role,text:(n==null?void 0:n.text)??"",thinking:(n==null?void 0:n.thinking)??void 0,tools:r,pendingApprovals:hf(r),created_at:e.created_at}})}function Bz(t,e){if(t.length!==e.length)return!0;for(let n=0;n<t.length;n++)if(t[n].id!==e[n].id||t[n].role!==e[n].role||t[n].text!==e[n].text||t[n].tools.length!==e[n].tools.length)return!0;return!1}const xb=new Map,Bg=new Map;function Xs(t){Dz();let e=xb.get(t);return e||(e={messages:dr([]),streaming:dr(!1),connectionState:dr("connected"),error:dr(null),notFound:dr(!1)},xb.set(t,e)),e}function pf(t){const e=Bg.get(t);e&&clearInterval(e);const n=Xs(t);Bg.set(t,setInterval(async()=>{if(ki(n.streaming)&&ki(n.connectionState)==="connected")return;const r=await _I(t);if(ki(n.streaming))return;const i=BM(r);if(Bz(ki(n.messages),i)&&n.messages.set(i),ki(n.connectionState)!=="connected"){const s=ki(lp).find(o=>o.id===t);s!=null&&s.status&&DM.has(s.status)&&FM(t)}},3e3))}function jz(t){const e=Bg.get(t);e&&(clearInterval(e),Bg.delete(t))}async function Dx(t){const e=Xs(t);e.streaming.set(!1),e.connectionState.set("connected"),e.error.set(null),cp.update(r=>r.filter(i=>i.tag!=="connection"));const n=await SI(t);if(n===null){e.notFound.set(!0);return}e.messages.set(BM(n)),pf(t)}function Uz(t,e){const n=Xs(t);n.error.set(null),n.streaming.set(!0);const r={id:Dg(),role:"user",text:e,tools:[],pendingApprovals:[]};n.messages.update(l=>[...l,r]);const i={id:Dg(),role:"assistant",text:"",tools:[],pendingApprovals:[]};n.messages.update(l=>[...l,i]);const s=new Map;let o=!1;const a=kM(e,t,l=>{if(l.type!=="session"){if(l.type==="queued"){NM(n.messages);return}if(l.type==="tool_use"){const c={type:"tool_use",name:l.data.name,id:l.data.id,args:l.data.args};s.set(l.data.id,c),n.messages.update(u=>{const f=u[u.length-1];return f&&f.role==="assistant"&&(u[u.length-1]={...f,tools:[...f.tools,c]}),[...u]})}else if(l.type==="tool_result"){const c=s.get(l.data.id);if(c){const u={...c,type:"tool_result",result:l.data.result,error:l.data.error};s.set(l.data.id,u),n.messages.update(f=>{const h=f[f.length-1];if(h&&h.role==="assistant"){const p=h.tools.map(g=>g.id===l.data.id?u:g);f[f.length-1]={...h,tools:p,pendingApprovals:hf(p)}}return[...f]})}}else l.type==="text_delta"?n.messages.update(c=>{const u=c[c.length-1];return u&&u.role==="assistant"&&(c[c.length-1]={...u,text:u.text+l.data}),[...c]}):l.type==="text"?n.messages.update(c=>{const u=c[c.length-1];return u&&u.role==="assistant"&&(l.is_thinking?c[c.length-1]={...u,thinking:(u.thinking||"")+l.data,text:""}:c[c.length-1]={...u,text:l.data}),[...c]}):l.type==="done"?(o=!0,n.connectionState.set("connected"),n.messages.update(c=>{const u=c[c.length-1];return u&&u.role==="assistant"&&(c[c.length-1]={...u,pendingApprovals:hf(u.tools)}),[...c]}),pf(t)):l.type==="error"&&n.error.set(Fg(l.data))}},l=>{if(l==="AbortError"||l.includes("aborted")){n.streaming.set(!1);return}o?(n.error.set(Fg(l)),n.streaming.set(!1)):(n.connectionState.set("disconnected"),pf(t),LM("Connection to the agent dropped. The task keeps running — it will catch up here automatically.","Dismiss","connection"))},()=>{n.streaming.set(!1),rl.get(t)===a&&rl.delete(t),Z1()});rl.set(t,a)}function Wz(t){const e=rl.get(t);e&&(e.abort(),rl.delete(t),Xs(t).streaming.set(!1))}function jM(t,e){const n={id:Dg(),role:"user",text:t,tools:[],pendingApprovals:[]},r={id:Dg(),role:"assistant",text:"",tools:[],pendingApprovals:[]},i=new Map;let s=!1,o=null,a=null;const l=[];function c(f){const h=a;if(!(!h||!o)){if(f.type==="queued"){NM(h.messages);return}if(f.type==="tool_use"){const p={type:"tool_use",name:f.data.name,id:f.data.id,args:f.data.args};i.set(f.data.id,p),h.messages.update(g=>{const m=g[g.length-1];return m&&m.role==="assistant"&&(g[g.length-1]={...m,tools:[...m.tools,p]}),[...g]})}else if(f.type==="tool_result"){const p=i.get(f.data.id);if(p){const g={...p,type:"tool_result",result:f.data.result,error:f.data.error};i.set(f.data.id,g),h.messages.update(m=>{const b=m[m.length-1];if(b&&b.role==="assistant"){const y=b.tools.map(_=>_.id===f.data.id?g:_);m[m.length-1]={...b,tools:y,pendingApprovals:hf(y)}}return[...m]})}}else f.type==="text_delta"?h.messages.update(p=>{const g=p[p.length-1];return g&&g.role==="assistant"&&(p[p.length-1]={...g,text:g.text+f.data}),[...p]}):f.type==="text"?h.messages.update(p=>{const g=p[p.length-1];return g&&g.role==="assistant"&&(f.is_thinking?p[p.length-1]={...g,thinking:(g.thinking||"")+f.data,text:""}:p[p.length-1]={...g,text:f.data}),[...p]}):f.type==="done"?(s=!0,h.connectionState.set("connected"),h.messages.update(p=>{const g=p[p.length-1];return g&&g.role==="assistant"&&(p[p.length-1]={...g,pendingApprovals:hf(g.tools)}),[...p]}),pf(o)):f.type==="error"&&h.error.set(Fg(f.data))}}const u=kM(t,null,f=>{if(f.type==="session"){o=f.data,rl.set(o,u),a=Xs(o),a.streaming.set(!0),a.messages.update(h=>[...h,n,r]),e(o);for(const h of l.splice(0))c(h);return}if(!a){l.push(f);return}c(f)},f=>{if(a){if(f==="AbortError"||f.includes("aborted")){a.streaming.set(!1);return}!s&&o?(a.connectionState.set("disconnected"),pf(o),LM("Connection to the agent dropped. The task keeps running — it will catch up here automatically.","Dismiss","connection")):(a.error.set(Fg(f)),a.streaming.set(!1))}},()=>{a&&a.streaming.set(!1),o&&rl.get(o)===u&&rl.delete(o),Z1()})}function qz(t){switch(t.status){case"awaiting_input":return"input";case"done":return t.outcome==="failure"?"failed":"done";case"failed":return"failed";default:return"running"}}function Nq(t){switch(qz(t)){case"input":return{label:"Needs input",dot:"bg-warning",pulse:!0};case"done":return{label:t.outcome==="partial"?"Done · partial":"Done",dot:"bg-success",pulse:!1};case"failed":return{label:"Failed",dot:"bg-destructive",pulse:!1};default:return{label:"Running",dot:"bg-primary",pulse:!0}}}const Iq=[{id:"all",label:"All"},{id:"running",label:"Running"},{id:"input",label:"Needs input"},{id:"done",label:"Done"},{id:"failed",label:"Failed"}],zq=new Set(["task.status","goal.set","question.raised","question.answered"]);function Hz(t){return t.goal||t.title||"Untitled task"}const jg="session:",fn=Tz({defaultSize:{width:480,height:560}});function Km(t){const{viewport:e}=fn.getState();return e.width<=0||e.height<=0?t:{...t,width:t.width!==void 0?Math.min(t.width,e.width):void 0,height:t.height!==void 0?Math.min(t.height,e.height):void 0,maxWidth:Math.min(t.maxWidth??e.width,e.width),maxHeight:Math.min(t.maxHeight??e.height,e.height)}}const Rc=Az(fn,{snap:{topEdge:"maximize",preview:!0},keyboard:!0,magnetism:!0,minimizeTarget:t=>document.querySelector(`[data-taskbar-btn="${CSS.escape(t.id)}"]`)}),up=Ez(fn);let Ep=[];const Vz=Es(up,t=>{const e=Object.keys(t.windows);return e.length===Ep.length&&e.every((n,r)=>n===Ep[r])?Ep:(Ep=e,e)}),Lq=Es(up,t=>{var e;return(e=t.focusedId)!=null&&e.startsWith(jg)?t.focusedId.slice(jg.length):null});Cz(fn,{key:"oikos-windows",debounce:300,autoRestore:!0});lp.subscribe(t=>{for(const e of t){const n=`session:${e.id}`,r=fn.get(n);if(!r)continue;const i=Hz(e);r.title!==i&&fn.update(n,{title:i})}});function cg(){fn.getState().order.some(e=>{var n;return((n=fn.get(e))==null?void 0:n.stage)!=="minimized"})?fn.minimizeAll():fn.restoreAll()}function Q1(t){const e=ki(Y1).get(t);if(!e)return;if(e.docked){Iz(t);return}const n=nz(t);if(fn.get(n)){fn.restore(n),fn.focus(n);return}fn.open(Km({id:n,title:e.title,width:e.width,height:e.height,minWidth:e.minWidth,minHeight:e.minHeight}))}function J1(t){if(t){if(fn.get(t)){fn.restore(t),fn.focus(t);return}fn.open(Km({id:t,title:t}))}}const Qc="new-task";let _b="";function $z(){const t=_b;return _b="",t}function Gz(t=""){if(_b=t,fn.get(Qc)){fn.restore(Qc),fn.focus(Qc);return}fn.open(Km({id:Qc,title:"New task",width:900,height:640,minWidth:600,minHeight:400}))}function UM(t,e){if(!t)return;const n=`session:${t}`;if(fn.get(n)){fn.restore(n),fn.focus(n);return}fn.open(Km({id:n,title:e,width:900,height:640,minWidth:600,minHeight:400}))}function Vn(t,e){return`${Math.round(Math.max(.5,t*e)*10)/10}px`}const ey=[{id:"none",label:"None",css:()=>""},{id:"dots",label:"Dots",css:(t,e)=>`background-image: radial-gradient(${t} ${Vn(1.6,e)}, transparent ${Vn(1.6,e)}); background-size: ${Vn(18,e)} ${Vn(18,e)};`},{id:"bubbles",label:"Bubbles",css:(t,e)=>`background-image: radial-gradient(${t} 17%, transparent 18% 35%, transparent 36.5%), radial-gradient(${t} 17%, transparent 18% 35%, transparent 36.5%), radial-gradient(transparent 34%, ${t} 36% 68%, transparent 70%), repeating-linear-gradient(45deg, ${t} -12.5% 12.5%, transparent 0 37.5%); background-position: -${Vn(20,e)} -${Vn(20,e)}, ${Vn(20,e)} ${Vn(20,e)}, 0 0, 0 0; background-size: ${Vn(80,e)} ${Vn(80,e)}, ${Vn(80,e)} ${Vn(80,e)}, ${Vn(40,e)} ${Vn(40,e)}, ${Vn(80,e)} ${Vn(80,e)};`},{id:"grid",label:"Grid",css:(t,e)=>`background-image: linear-gradient(${t} 1px, transparent 1px), linear-gradient(90deg, ${t} 1px, transparent 1px); background-size: ${Vn(24,e)} ${Vn(24,e)};`},{id:"stripes",label:"Stripes",css:(t,e)=>`background-image: repeating-linear-gradient(45deg, ${t} 0 ${Vn(2,e)}, transparent ${Vn(2,e)} ${Vn(14,e)});`},{id:"checks",label:"Checks",css:(t,e)=>`background-image: conic-gradient(${t} 90deg, transparent 90deg 180deg, ${t} 180deg 270deg, transparent 270deg); background-size: ${Vn(24,e)} ${Vn(24,e)};`},{id:"zigzag",label:"Zigzag",css:(t,e)=>`background-image: linear-gradient(135deg, ${t} 25%, transparent 25%), linear-gradient(225deg, ${t} 25%, transparent 25%), linear-gradient(45deg, ${t} 25%, transparent 25%), linear-gradient(315deg, ${t} 25%, transparent 25%); background-position: ${Vn(20,e)} 0, ${Vn(20,e)} 0, 0 0, 0 0; background-size: ${Vn(40,e)} ${Vn(40,e)}; background-repeat: repeat;`},{id:"rings",label:"Rings",css:(t,e)=>`background-image: repeating-radial-gradient(circle at 50% 50%, ${t} 0, ${t} ${Vn(1,e)}, transparent ${Vn(1,e)}, transparent ${Vn(14,e)});`}],Yz=new Map(ey.map(t=>[t.id,t]));function Kz(t){return Yz.get(t)??ey[0]}function Xz(t,e,n=1){return Kz(t).css(e,n)}const WM="oikos-desktop-bg",Zz=new Set(ey.map(t=>t.id)),ys={pattern:"bubbles",color:"#444cf7",fillColor:null,opacity:.08,fade:0,scale:1,rotation:0};function Ug(t,e){const n=typeof t=="number"?t:Number(t);return Number.isFinite(n)?Math.min(1,Math.max(0,n)):e}function qM(t){const e=typeof t=="number"?t:Number(t);return Number.isFinite(e)?Math.min(3,Math.max(.4,e)):ys.scale}function HM(t){const e=typeof t=="number"?t:Number(t);return Number.isFinite(e)?(e%360+360)%360:ys.rotation}function Wg(t){return typeof t=="string"&&/^#[0-9a-fA-F]{6}$/.test(t)}function Qz(){if(typeof localStorage>"u")return ys;const t=localStorage.getItem(WM);if(!t)return ys;try{const e=JSON.parse(t);return{pattern:Zz.has(e.pattern)?e.pattern:ys.pattern,color:Wg(e.color)?e.color:ys.color,fillColor:e.fillColor===null?null:Wg(e.fillColor)?e.fillColor:ys.fillColor,opacity:Ug(e.opacity,ys.opacity),fade:Ug(e.fade,ys.fade),scale:qM(e.scale),rotation:HM(e.rotation)}}catch{return ys}}let gi=Se(gn(Qz()));function vc(){typeof localStorage<"u"&&localStorage.setItem(WM,JSON.stringify(d(gi)))}function N0(){return d(gi)}function Dq(t){I(gi,{...d(gi),pattern:t},!0),vc()}function Fq(t){Wg(t)&&(I(gi,{...d(gi),color:t},!0),vc())}function Bq(t){t!==null&&!Wg(t)||(I(gi,{...d(gi),fillColor:t},!0),vc())}function jq(t){I(gi,{...d(gi),opacity:Ug(t,ys.opacity)},!0),vc()}function Uq(t){I(gi,{...d(gi),fade:Ug(t,ys.fade)},!0),vc()}function Wq(t){I(gi,{...d(gi),scale:qM(t)},!0),vc()}function qq(t){I(gi,{...d(gi),rotation:HM(t)},!0),vc()}var Jz=ne('<span class="absolute -right-1.5 -top-1.5 flex h-4 min-w-4 items-center justify-center border border-background bg-destructive px-1 text-[10px] font-semibold text-destructive-foreground"> </span>'),e6=ne('<button type="button"><span><!> <!></span> <span class="max-w-full truncate text-[10px] uppercase tracking-wider text-muted-foreground transition-colors group-hover:text-foreground"> </span></button>');function t6(t,e){Tt(e,!0);let n=te(e,"badge",3,0);const r=5;let i=Se(!1),s=Se(null);function o(k,S){return{col:Math.round((k-Zi.padding)/(Zi.cell+Zi.gap)),row:Math.round((S-Zi.padding)/(Zi.cell+Zi.gap))}}function a(k){if(k.button!==0)return;const S=k.currentTarget,E=k.clientX,M=k.clientY,O=Ox(e.pos);let P=!1;S.setPointerCapture(k.pointerId);function x(R){const N=R.clientX-E,B=R.clientY-M;!P&&Math.hypot(N,B)>r&&(P=!0,I(i,!0)),P&&I(s,{x:O.x+N,y:O.y+B},!0)}function C(){if(S.removeEventListener("pointermove",x),S.removeEventListener("pointerup",C),P&&d(s)){const R=o(d(s).x,d(s).y);oz(e.app.id,R.col,R.row)}else e.onOpen();I(i,!1),I(s,null)}S.addEventListener("pointermove",x),S.addEventListener("pointerup",C)}function l(k){(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),e.onOpen())}const c=V(()=>Ox(e.pos)),u=V(()=>d(i)&&d(s)?d(s).x:d(c).x),f=V(()=>d(i)&&d(s)?d(s).y:d(c).y);var h=e6(),p=j(h),g=j(p);Tn(g,()=>e.app.icon,(k,S)=>{S(k,{class:"size-5 transition-colors"})});var m=ee(g,2);{var b=k=>{var S=Jz(),E=j(S);De(()=>je(E,n()>99?"99+":n())),A(k,S)};xe(m,k=>{n()>0&&k(b)})}var y=ee(p,2),_=j(y);De(()=>{Gn(h,1,`group absolute flex flex-col items-center gap-1.5 p-1.5 pointer-events-auto select-none transition-transform focus-visible:outline-2 focus-visible:outline-ring ${d(i)?"z-50 cursor-grabbing":"cursor-pointer hover:-translate-y-0.5"}`),Ks(h,`left: ${d(u)??""}px; top: ${d(f)??""}px; width: ${Zi.cell}px;`),ut(h,"title",e.app.title),Gn(p,1,`relative flex size-11 items-center justify-center border transition-all ${d(i)?"border-foreground bg-foreground text-background shadow-[4px_4px_0_0_var(--foreground)]":"border-border bg-card text-foreground group-hover:border-foreground group-hover:bg-foreground group-hover:text-background"}`),je(_,e.app.title)}),Ln("pointerdown",h,a),Ln("keydown",h,l),A(t,h),Et()}Fo(["pointerdown","keydown"]);var n6=new Set(["$$slots","$$events","$$legacy","ref","value","class","data-slot"]),r6=ne("<textarea></textarea>");function ty(t,e){Tt(e,!0);let n=te(e,"ref",15,null),r=te(e,"value",15),i=te(e,"data-slot",3,"textarea"),s=ht(e,n6);var o=r6();_r(o,a=>({"data-slot":i(),class:a,...s}),[()=>ss("border-input dark:bg-input/30 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-md border bg-transparent px-2.5 py-2 text-base shadow-xs transition-[color,box-shadow] focus-visible:ring-3 aria-invalid:ring-3 md:text-sm placeholder:text-muted-foreground flex field-sizing-content min-h-16 w-full outline-none disabled:cursor-not-allowed disabled:opacity-50",e.class)]),kr(o,a=>n(a),()=>n()),kv(o,r),A(t,o),Et()}var i6=ne('<h1 class="mb-1 text-2xl font-semibold tracking-tight">What should Nomos do?</h1> <p class="mb-4 text-sm text-muted-foreground">Describe a goal — Nomos will plan it, execute it, and report the outcome.</p>',1),s6=ne('<div class="w-full max-w-2xl text-center"><!> <form class="relative rounded-2xl border bg-card/70 shadow-lg backdrop-blur focus-within:border-primary/60"><!> <div class="flex items-center justify-between px-3 pb-3"><span class="text-[11px] text-muted-foreground">Enter to start · Shift+Enter for newline</span> <!></div></form></div>');function o6(t,e){Tt(e,!0);let n=te(e,"compact",3,!1),r=Se("");function i(){var g;const p=d(r).trim();p&&(I(r,""),jM(p,m=>UM(m,zl(p,60))),(g=e.onStarted)==null||g.call(e))}function s(p){p.key==="Enter"&&!p.shiftKey&&(p.preventDefault(),i())}var o=s6(),a=j(o);{var l=p=>{var g=i6();A(p,g)};xe(a,p=>{n()||p(l)})}var c=ee(a,2),u=j(c);{let p=V(()=>n()?2:3);ty(u,{onkeydown:s,placeholder:"e.g. Roll the staging database back to last night's snapshot and verify the app is healthy…",get rows(){return d(p)},class:"max-h-52 min-h-24 resize-none field-sizing-fixed border-0 bg-transparent px-4 py-3.5 text-base shadow-none focus-visible:ring-0",get value(){return d(r)},set value(g){I(r,g,!0)}})}var f=ee(u,2),h=ee(j(f),2);{let p=V(()=>!d(r).trim());Rr(h,{type:"submit",size:"icon",get disabled(){return d(p)},"aria-label":"Start task",children:(g,m)=>{w4(g,{})},$$slots:{default:!0}})}Mi("submit",c,p=>{p.preventDefault(),i()}),A(t,o),Et()}const a6=!0,qr="u-",l6="uplot",c6=qr+"hz",u6=qr+"vt",d6=qr+"title",f6=qr+"wrap",h6=qr+"under",p6=qr+"over",g6=qr+"axis",Cl=qr+"off",m6=qr+"select",v6=qr+"cursor-x",b6=qr+"cursor-y",y6=qr+"cursor-pt",w6=qr+"legend",x6=qr+"live",_6=qr+"inline",S6=qr+"series",k6=qr+"marker",Fx=qr+"label",M6=qr+"value",Hd="width",Vd="height",kd="top",Bx="bottom",Nc="left",I0="right",ny="#000",jx=ny+"0",z0="mousemove",Ux="mousedown",L0="mouseup",Wx="mouseenter",qx="mouseleave",Hx="dblclick",T6="resize",E6="scroll",Vx="change",qg="dppxchange",ry="--",ad=typeof window<"u",Sb=ad?document:null,su=ad?window:null,A6=ad?navigator:null;let Un,Ap;function kb(){let t=devicePixelRatio;Un!=t&&(Un=t,Ap&&Tb(Vx,Ap,kb),Ap=matchMedia(`(min-resolution: ${Un-.001}dppx) and (max-resolution: ${Un+.001}dppx)`),Jl(Vx,Ap,kb),su.dispatchEvent(new CustomEvent(qg)))}function Gi(t,e){if(e!=null){let n=t.classList;!n.contains(e)&&n.add(e)}}function Mb(t,e){let n=t.classList;n.contains(e)&&n.remove(e)}function ur(t,e,n){t.style[e]=n+"px"}function Is(t,e,n,r){let i=Sb.createElement(t);return e!=null&&Gi(i,e),n!=null&&n.insertBefore(i,r),i}function ds(t,e){return Is("div",t,e)}const $x=new WeakMap;function uo(t,e,n,r,i){let s="translate("+e+"px,"+n+"px)",o=$x.get(t);s!=o&&(t.style.transform=s,$x.set(t,s),e<0||n<0||e>r||n>i?Gi(t,Cl):Mb(t,Cl))}const Gx=new WeakMap;function Yx(t,e,n){let r=e+n,i=Gx.get(t);r!=i&&(Gx.set(t,r),t.style.background=e,t.style.borderColor=n)}const Kx=new WeakMap;function Xx(t,e,n,r){let i=e+""+n,s=Kx.get(t);i!=s&&(Kx.set(t,i),t.style.height=n+"px",t.style.width=e+"px",t.style.marginLeft=r?-e/2+"px":0,t.style.marginTop=r?-n/2+"px":0)}const iy={passive:!0},P6={...iy,capture:!0};function Jl(t,e,n,r){e.addEventListener(t,n,r?P6:iy)}function Tb(t,e,n,r){e.removeEventListener(t,n,iy)}ad&&kb();function Bs(t,e,n,r){let i;n=n||0,r=r||e.length-1;let s=r<=2147483647;for(;r-n>1;)i=s?n+r>>1:is((n+r)/2),e[i]<t?n=i:r=i;return t-e[n]<=e[r]-t?n:r}function VM(t){return(n,r,i)=>{let s=-1,o=-1;for(let a=r;a<=i;a++)if(t(n[a])){s=a;break}for(let a=i;a>=r;a--)if(t(n[a])){o=a;break}return[s,o]}}const $M=t=>t!=null,GM=t=>t!=null&&t>0,Xm=VM($M),C6=VM(GM);function O6(t,e,n,r=0,i=!1){let s=i?C6:Xm,o=i?GM:$M;[e,n]=s(t,e,n);let a=t[e],l=t[e];if(e>-1)if(r==1)a=t[e],l=t[n];else if(r==-1)a=t[n],l=t[e];else for(let c=e;c<=n;c++){let u=t[c];o(u)&&(u<a?a=u:u>l&&(l=u))}return[a??rr,l??-rr]}function Zm(t,e,n,r){let i=Jx(t),s=Jx(e);t==e&&(i==-1?(t*=n,e/=n):(t/=n,e*=n));let o=n==10?da:YM,a=i==1?is:xs,l=s==1?xs:is,c=a(o(Br(t))),u=l(o(Br(e))),f=Vu(n,c),h=Vu(n,u);return n==10&&(c<0&&(f=ir(f,-c)),u<0&&(h=ir(h,-u))),r||n==2?(t=f*i,e=h*s):(t=QM(t,f),e=Qm(e,h)),[t,e]}function sy(t,e,n,r){let i=Zm(t,e,n,r);return t==0&&(i[0]=0),e==0&&(i[1]=0),i}const oy=.1,Zx={mode:3,pad:oy},of={pad:0,soft:null,mode:0},R6={min:of,max:of};function Hg(t,e,n,r){return Jm(n)?Qx(t,e,n):(of.pad=n,of.soft=r?0:null,of.mode=r?3:0,Qx(t,e,R6))}function Fn(t,e){return t??e}function N6(t,e,n){for(e=Fn(e,0),n=Fn(n,t.length-1);e<=n;){if(t[e]!=null)return!0;e++}return!1}function Qx(t,e,n){let r=n.min,i=n.max,s=Fn(r.pad,0),o=Fn(i.pad,0),a=Fn(r.hard,-rr),l=Fn(i.hard,rr),c=Fn(r.soft,rr),u=Fn(i.soft,-rr),f=Fn(r.mode,0),h=Fn(i.mode,0),p=e-t,g=da(p),m=Ei(Br(t),Br(e)),b=da(m),y=Br(b-g);(p<1e-24||y>10)&&(p=0,(t==0||e==0)&&(p=1e-24,f==2&&c!=rr&&(s=0),h==2&&u!=-rr&&(o=0)));let _=p||m||1e3,k=da(_),S=Vu(10,is(k)),E=_*(p==0?t==0?.1:1:s),M=ir(QM(t-E,S/10),24),O=t>=c&&(f==1||f==3&&M<=c||f==2&&M>=c)?c:rr,P=Ei(a,M<O&&t>=O?O:qs(O,M)),x=_*(p==0?e==0?.1:1:o),C=ir(Qm(e+x,S/10),24),R=e<=u&&(h==1||h==3&&C>=u||h==2&&C<=u)?u:-rr,N=qs(l,C>R&&e<=R?R:Ei(R,C));return P==N&&P==0&&(N=100),[P,N]}const I6=new Intl.NumberFormat(ad?A6.language:"en-US"),ay=t=>I6.format(t),as=Math,ug=as.PI,Br=as.abs,is=as.floor,Fr=as.round,xs=as.ceil,qs=as.min,Ei=as.max,Vu=as.pow,Jx=as.sign,da=as.log10,YM=as.log2,z6=(t,e=1)=>as.sinh(t)*e,D0=(t,e=1)=>as.asinh(t/e),rr=1/0;function e_(t){return(da((t^t>>31)-(t>>31))|0)+1}function Eb(t,e,n){return qs(Ei(t,e),n)}function KM(t){return typeof t=="function"}function Mn(t){return KM(t)?t:()=>t}const L6=()=>{},XM=t=>t,ZM=(t,e)=>e,D6=t=>null,t_=t=>!0,n_=(t,e)=>t==e,F6=/\.\d*?(?=9{6,}|0{6,})/gm,oc=t=>{if(eT(t)||cl.has(t))return t;const e=`${t}`,n=e.match(F6);if(n==null)return t;let r=n[0].length-1;if(e.indexOf("e-")!=-1){let[i,s]=e.split("e");return+`${oc(i)}e${s}`}return ir(t,r)};function Ml(t,e){return oc(ir(oc(t/e))*e)}function Qm(t,e){return oc(xs(oc(t/e))*e)}function QM(t,e){return oc(is(oc(t/e))*e)}function ir(t,e=0){if(eT(t))return t;let n=10**e,r=t*n*(1+Number.EPSILON);return Fr(r)/n}const cl=new Map;function JM(t){return((""+t).split(".")[1]||"").length}function gf(t,e,n,r){let i=[],s=r.map(JM);for(let o=e;o<n;o++){let a=Br(o),l=ir(Vu(t,o),a);for(let c=0;c<r.length;c++){let u=t==10?+`${r[c]}e${o}`:r[c]*l,f=(o>=0?0:a)+(o>=s[c]?0:s[c]),h=t==10?u:ir(u,f);i.push(h),cl.set(h,f)}}return i}const af={},ly=[],$u=[null,null],Ia=Array.isArray,eT=Number.isInteger,B6=t=>t===void 0;function r_(t){return typeof t=="string"}function Jm(t){let e=!1;if(t!=null){let n=t.constructor;e=n==null||n==Object}return e}function j6(t){return t!=null&&typeof t=="object"}const U6=Object.getPrototypeOf(Uint8Array),tT="__proto__";function Gu(t,e=Jm){let n;if(Ia(t)){let r=t.find(i=>i!=null);if(Ia(r)||e(r)){n=Array(t.length);for(let i=0;i<t.length;i++)n[i]=Gu(t[i],e)}else n=t.slice()}else if(t instanceof U6)n=t.slice();else if(e(t)){n={};for(let r in t)r!=tT&&(n[r]=Gu(t[r],e))}else n=t;return n}function Or(t){let e=arguments;for(let n=1;n<e.length;n++){let r=e[n];for(let i in r)i!=tT&&(Jm(t[i])?Or(t[i],Gu(r[i])):t[i]=Gu(r[i]))}return t}const W6=0,q6=1,H6=2;function V6(t,e,n){for(let r=0,i,s=-1;r<e.length;r++){let o=e[r];if(o>s){for(i=o-1;i>=0&&t[i]==null;)t[i--]=null;for(i=o+1;i<n&&t[i]==null;)t[s=i++]=null}}}function $6(t,e){if(K6(t)){let o=t[0].slice();for(let a=1;a<t.length;a++)o.push(...t[a].slice(1));return X6(o[0])||(o=Y6(o)),o}let n=new Set;for(let o=0;o<t.length;o++){let l=t[o][0],c=l.length;for(let u=0;u<c;u++)n.add(l[u])}let r=[Array.from(n).sort((o,a)=>o-a)],i=r[0].length,s=new Map;for(let o=0;o<i;o++)s.set(r[0][o],o);for(let o=0;o<t.length;o++){let a=t[o],l=a[0];for(let c=1;c<a.length;c++){let u=a[c],f=Array(i).fill(void 0),h=e?e[o][c]:q6,p=[];for(let g=0;g<u.length;g++){let m=u[g],b=s.get(l[g]);m===null?h!=W6&&(f[b]=m,h==H6&&p.push(b)):f[b]=m}V6(f,p,i),r.push(f)}}return r}const G6=typeof queueMicrotask>"u"?t=>Promise.resolve().then(t):queueMicrotask;function Y6(t){let e=t[0],n=e.length,r=Array(n);for(let s=0;s<r.length;s++)r[s]=s;r.sort((s,o)=>e[s]-e[o]);let i=[];for(let s=0;s<t.length;s++){let o=t[s],a=Array(n);for(let l=0;l<n;l++)a[l]=o[r[l]];i.push(a)}return i}function K6(t){let e=t[0][0],n=e.length;for(let r=1;r<t.length;r++){let i=t[r][0];if(i.length!=n)return!1;if(i!=e){for(let s=0;s<n;s++)if(i[s]!=e[s])return!1}}return!0}function X6(t,e=100){const n=t.length;if(n<=1)return!0;let r=0,i=n-1;for(;r<=i&&t[r]==null;)r++;for(;i>=r&&t[i]==null;)i--;if(i<=r)return!0;const s=Ei(1,is((i-r+1)/e));for(let o=t[r],a=r+s;a<=i;a+=s){const l=t[a];if(l!=null){if(l<=o)return!1;o=l}}return!0}const nT=["January","February","March","April","May","June","July","August","September","October","November","December"],rT=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function iT(t){return t.slice(0,3)}const Z6=rT.map(iT),Q6=nT.map(iT),J6={MMMM:nT,MMM:Q6,WWWW:rT,WWW:Z6};function Md(t){return(t<10?"0":"")+t}function eL(t){return(t<10?"00":t<100?"0":"")+t}const tL={YYYY:t=>t.getFullYear(),YY:t=>(t.getFullYear()+"").slice(2),MMMM:(t,e)=>e.MMMM[t.getMonth()],MMM:(t,e)=>e.MMM[t.getMonth()],MM:t=>Md(t.getMonth()+1),M:t=>t.getMonth()+1,DD:t=>Md(t.getDate()),D:t=>t.getDate(),WWWW:(t,e)=>e.WWWW[t.getDay()],WWW:(t,e)=>e.WWW[t.getDay()],HH:t=>Md(t.getHours()),H:t=>t.getHours(),h:t=>{let e=t.getHours();return e==0?12:e>12?e-12:e},AA:t=>t.getHours()>=12?"PM":"AM",aa:t=>t.getHours()>=12?"pm":"am",a:t=>t.getHours()>=12?"p":"a",mm:t=>Md(t.getMinutes()),m:t=>t.getMinutes(),ss:t=>Md(t.getSeconds()),s:t=>t.getSeconds(),fff:t=>eL(t.getMilliseconds())};function cy(t,e){e=e||J6;let n=[],r=/\{([a-z]+)\}|[^{]+/gi,i;for(;i=r.exec(t);)n.push(i[0][0]=="{"?tL[i[1]]:i[0]);return s=>{let o="";for(let a=0;a<n.length;a++)o+=typeof n[a]=="string"?n[a]:n[a](s,e);return o}}const nL=new Intl.DateTimeFormat().resolvedOptions().timeZone;function rL(t,e){let n;return e=="UTC"||e=="Etc/UTC"?n=new Date(+t+t.getTimezoneOffset()*6e4):e==nL?n=t:(n=new Date(t.toLocaleString("en-US",{timeZone:e})),n.setMilliseconds(t.getMilliseconds())),n}const sT=t=>t%1==0,Vg=[1,2,2.5,5],iL=gf(10,-32,0,Vg),oT=gf(10,0,32,Vg),sL=oT.filter(sT),Tl=iL.concat(oT),uy=`
`,aT="{YYYY}",i_=uy+aT,lT="{M}/{D}",$d=uy+lT,Pp=$d+"/{YY}",cT="{aa}",oL="{h}:{mm}",Yc=oL+cT,s_=uy+Yc,o_=":{ss}",$n=null;function uT(t){let e=t*1e3,n=e*60,r=n*60,i=r*24,s=i*30,o=i*365,l=(t==1?gf(10,0,3,Vg).filter(sT):gf(10,-3,0,Vg)).concat([e,e*5,e*10,e*15,e*30,n,n*5,n*10,n*15,n*30,r,r*2,r*3,r*4,r*6,r*8,r*12,i,i*2,i*3,i*4,i*5,i*6,i*7,i*8,i*9,i*10,i*15,s,s*2,s*3,s*4,s*6,o,o*2,o*5,o*10,o*25,o*50,o*100]);const c=[[o,aT,$n,$n,$n,$n,$n,$n,1],[i*28,"{MMM}",i_,$n,$n,$n,$n,$n,1],[i,lT,i_,$n,$n,$n,$n,$n,1],[r,"{h}"+cT,Pp,$n,$d,$n,$n,$n,1],[n,Yc,Pp,$n,$d,$n,$n,$n,1],[e,o_,Pp+" "+Yc,$n,$d+" "+Yc,$n,s_,$n,1],[t,o_+".{fff}",Pp+" "+Yc,$n,$d+" "+Yc,$n,s_,$n,1]];function u(f){return(h,p,g,m,b,y)=>{let _=[],k=b>=o,S=b>=s&&b<o,E=f(g),M=ir(E*t,3),O=F0(E.getFullYear(),k?0:E.getMonth(),S||k?1:E.getDate()),P=ir(O*t,3);if(S||k){let x=S?b/s:0,C=k?b/o:0,R=M==P?M:ir(F0(O.getFullYear()+C,O.getMonth()+x,1)*t,3),N=new Date(Fr(R/t)),B=N.getFullYear(),z=N.getMonth();for(let H=0;R<=m;H++){let X=F0(B+C*H,z+x*H,1),G=X-f(ir(X*t,3));R=ir((+X+G)*t,3),R<=m&&_.push(R)}}else{let x=b>=i?i:b,C=is(g)-is(M),R=P+C+Qm(M-P,x);_.push(R);let N=f(R),B=N.getHours()+N.getMinutes()/n+N.getSeconds()/r,z=b/r,H=h.axes[p]._space,X=y/H;for(;R=ir(R+b,t==1?0:3),!(R>m);)if(z>1){let G=is(ir(B+z,6))%24,K=f(R).getHours()-G;K>1&&(K=-1),R-=K*r,B=(B+z)%24;let q=_[_.length-1];ir((R-q)/b,3)*X>=.7&&_.push(R)}else _.push(R)}return _}}return[l,c,u]}const[aL,lL,cL]=uT(1),[uL,dL,fL]=uT(.001);gf(2,-53,53,[1]);function a_(t,e){return t.map(n=>n.map((r,i)=>i==0||i==8||r==null?r:e(i==1||n[8]==0?r:n[1]+r)))}function l_(t,e){return(n,r,i,s,o)=>{let a=e.find(g=>o>=g[0])||e[e.length-1],l,c,u,f,h,p;return r.map(g=>{let m=t(g),b=m.getFullYear(),y=m.getMonth(),_=m.getDate(),k=m.getHours(),S=m.getMinutes(),E=m.getSeconds(),M=b!=l&&a[2]||y!=c&&a[3]||_!=u&&a[4]||k!=f&&a[5]||S!=h&&a[6]||E!=p&&a[7]||a[1];return l=b,c=y,u=_,f=k,h=S,p=E,M(m)})}}function hL(t,e){let n=cy(e);return(r,i,s,o,a)=>i.map(l=>n(t(l)))}function F0(t,e,n){return new Date(t,e,n)}function c_(t,e){return e(t)}const pL="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function u_(t,e){return(n,r,i,s)=>s==null?ry:e(t(r))}function gL(t,e){let n=t.series[e];return n.width?n.stroke(t,e):n.points.width?n.points.stroke(t,e):null}function mL(t,e){return t.series[e].fill(t,e)}const vL={show:!0,live:!0,isolate:!1,mount:L6,markers:{show:!0,width:2,stroke:gL,fill:mL,dash:"solid"},idx:null,idxs:null,values:[]};function bL(t,e){let n=t.cursor.points,r=ds(),i=n.size(t,e);ur(r,Hd,i),ur(r,Vd,i);let s=i/-2;ur(r,"marginLeft",s),ur(r,"marginTop",s);let o=n.width(t,e,i);return o&&ur(r,"borderWidth",o),r}function yL(t,e){let n=t.series[e].points;return n._fill||n._stroke}function wL(t,e){let n=t.series[e].points;return n._stroke||n._fill}function xL(t,e){return t.series[e].points.size}const B0=[0,0];function _L(t,e,n){return B0[0]=e,B0[1]=n,B0}function Cp(t,e,n,r=!0){return i=>{i.button==0&&(!r||i.target==e)&&n(i)}}function j0(t,e,n,r=!0){return i=>{(!r||i.target==e)&&n(i)}}const SL={show:!0,x:!0,y:!0,lock:!1,move:_L,points:{one:!1,show:bL,size:xL,width:0,stroke:wL,fill:yL},bind:{mousedown:Cp,mouseup:Cp,click:Cp,dblclick:Cp,mousemove:j0,mouseleave:j0,mouseenter:j0},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(t,e)=>{e.stopPropagation(),e.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(t,e,n,r,i)=>r-i,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},dT={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},dy=Or({},dT,{filter:ZM}),fT=Or({},dy,{size:10}),hT=Or({},dT,{show:!1}),fy='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',pT="bold "+fy,gT=1.5,d_={show:!0,scale:"x",stroke:ny,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:pT,side:2,grid:dy,ticks:fT,border:hT,font:fy,lineGap:gT,rotate:0},kL="Value",ML="Time",f_={show:!0,scale:"x",auto:!1,sorted:1,min:rr,max:-rr,idxs:[]};function TL(t,e,n,r,i){return e.map(s=>s==null?"":ay(s))}function EL(t,e,n,r,i,s,o){let a=[],l=cl.get(i)||0;n=o?n:ir(Qm(n,i),l);for(let c=n;c<=r;c=ir(c+i,l))a.push(Object.is(c,-0)?0:c);return a}function Ab(t,e,n,r,i,s,o){const a=[],l=t.scales[t.axes[e].scale].log,c=l==10?da:YM,u=is(c(n));i=Vu(l,u),l==10&&(i=Tl[Bs(i,Tl)]);let f=n,h=i*l;l==10&&(h=Tl[Bs(h,Tl)]);do a.push(f),f=f+i,l==10&&!cl.has(f)&&(f=ir(f,cl.get(i))),f>=h&&(i=f,h=i*l,l==10&&(h=Tl[Bs(h,Tl)]));while(f<=r);return a}function AL(t,e,n,r,i,s,o){let l=t.scales[t.axes[e].scale].asinh,c=r>l?Ab(t,e,Ei(l,n),r,i):[l],u=r>=0&&n<=0?[0]:[];return(n<-l?Ab(t,e,Ei(l,-r),-n,i):[l]).reverse().map(h=>-h).concat(u,c)}const mT=/./,PL=/[12357]/,CL=/[125]/,h_=/1/,Pb=(t,e,n,r)=>t.map((i,s)=>e==4&&i==0||s%r==0&&n.test(i.toExponential()[i<0?1:0])?i:null);function OL(t,e,n,r,i){let s=t.axes[n],o=s.scale,a=t.scales[o],l=t.valToPos,c=s._space,u=l(10,o),f=l(9,o)-u>=c?mT:l(7,o)-u>=c?PL:l(5,o)-u>=c?CL:h_;if(f==h_){let h=Br(l(1,o)-u);if(h<c)return Pb(e.slice().reverse(),a.distr,f,xs(c/h)).reverse()}return Pb(e,a.distr,f,1)}function RL(t,e,n,r,i){let s=t.axes[n],o=s.scale,a=s._space,l=t.valToPos,c=Br(l(1,o)-l(2,o));return c<a?Pb(e.slice().reverse(),3,mT,xs(a/c)).reverse():e}function NL(t,e,n,r){return r==null?ry:e==null?"":ay(e)}const p_={show:!0,scale:"y",stroke:ny,space:30,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:pT,side:3,grid:dy,ticks:fT,border:hT,font:fy,lineGap:gT,rotate:0};function IL(t,e){let n=3+(t||1)*2;return ir(n*e,3)}function zL(t,e){let{scale:n,idxs:r}=t.series[0],i=t._data[0],s=t.valToPos(i[r[0]],n,!0),o=t.valToPos(i[r[1]],n,!0),a=Br(o-s),l=t.series[e],c=a/(l.points.space*Un);return r[1]-r[0]<=c}const g_={scale:null,auto:!0,sorted:0,min:rr,max:-rr},vT=(t,e,n,r,i)=>i,m_={show:!0,auto:!0,sorted:0,gaps:vT,alpha:1,facets:[Or({},g_,{scale:"x"}),Or({},g_,{scale:"y"})]},v_={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:vT,alpha:1,points:{show:zL,filter:null},values:null,min:rr,max:-rr,idxs:[],path:null,clip:null};function LL(t,e,n,r,i){return n/10}const bT={time:a6,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},DL=Or({},bT,{time:!1,ori:1}),b_={};function yT(t,e){let n=b_[t];return n||(n={key:t,plots:[],sub(r){n.plots.push(r)},unsub(r){n.plots=n.plots.filter(i=>i!=r)},pub(r,i,s,o,a,l,c){for(let u=0;u<n.plots.length;u++)n.plots[u]!=i&&n.plots[u].pub(r,i,s,o,a,l,c)}},t!=null&&(b_[t]=n)),n}const Yu=1,Cb=2;function bc(t,e,n){const r=t.mode,i=t.series[e],s=r==2?t._data[e]:t._data,o=t.scales,a=t.bbox;let l=s[0],c=r==2?s[1]:s[e],u=r==2?o[i.facets[0].scale]:o[t.series[0].scale],f=r==2?o[i.facets[1].scale]:o[i.scale],h=a.left,p=a.top,g=a.width,m=a.height,b=t.valToPosH,y=t.valToPosV;return u.ori==0?n(i,l,c,u,f,b,y,h,p,g,m,t0,ld,r0,xT,ST):n(i,l,c,u,f,y,b,p,h,m,g,n0,cd,gy,_T,kT)}function hy(t,e){let n=0,r=0,i=Fn(t.bands,ly);for(let s=0;s<i.length;s++){let o=i[s];o.series[0]==e?n=o.dir:o.series[1]==e&&(o.dir==1?r|=1:r|=2)}return[n,r==1?-1:r==2?1:r==3?2:0]}function FL(t,e,n,r,i){let s=t.mode,o=t.series[e],a=s==2?o.facets[1].scale:o.scale,l=t.scales[a];return i==-1?l.min:i==1?l.max:l.distr==3?l.dir==1?l.min:l.max:0}function fa(t,e,n,r,i,s){return bc(t,e,(o,a,l,c,u,f,h,p,g,m,b)=>{let y=o.pxRound;const _=c.dir*(c.ori==0?1:-1),k=c.ori==0?ld:cd;let S,E;_==1?(S=n,E=r):(S=r,E=n);let M=y(f(a[S],c,m,p)),O=y(h(l[S],u,b,g)),P=y(f(a[E],c,m,p)),x=y(h(s==1?u.max:u.min,u,b,g)),C=new Path2D(i);return k(C,P,x),k(C,M,x),k(C,M,O),C})}function e0(t,e,n,r,i,s){let o=null;if(t.length>0){o=new Path2D;const a=e==0?r0:gy;let l=n;for(let f=0;f<t.length;f++){let h=t[f];if(h[1]>h[0]){let p=h[0]-l;p>0&&a(o,l,r,p,r+s),l=h[1]}}let c=n+i-l,u=10;c>0&&a(o,l,r-u/2,c,r+s+u)}return o}function BL(t,e,n){let r=t[t.length-1];r&&r[0]==e?r[1]=n:t.push([e,n])}function py(t,e,n,r,i,s,o){let a=[],l=t.length;for(let c=i==1?n:r;c>=n&&c<=r;c+=i)if(e[c]===null){let f=c,h=c;if(i==1)for(;++c<=r&&e[c]===null;)h=c;else for(;--c>=n&&e[c]===null;)h=c;let p=s(t[f]),g=h==f?p:s(t[h]),m=f-i;p=o<=0&&m>=0&&m<l?s(t[m]):p;let y=h+i;g=o>=0&&y>=0&&y<l?s(t[y]):g,g>=p&&a.push([p,g])}return a}function y_(t){return t==0?XM:t==1?Fr:e=>Ml(e,t)}function wT(t){let e=t==0?t0:n0,n=t==0?(i,s,o,a,l,c)=>{i.arcTo(s,o,a,l,c)}:(i,s,o,a,l,c)=>{i.arcTo(o,s,l,a,c)},r=t==0?(i,s,o,a,l)=>{i.rect(s,o,a,l)}:(i,s,o,a,l)=>{i.rect(o,s,l,a)};return(i,s,o,a,l,c=0,u=0)=>{c==0&&u==0?r(i,s,o,a,l):(c=qs(c,a/2,l/2),u=qs(u,a/2,l/2),e(i,s+c,o),n(i,s+a,o,s+a,o+l,c),n(i,s+a,o+l,s,o+l,u),n(i,s,o+l,s,o,u),n(i,s,o,s+a,o,c),i.closePath())}}const t0=(t,e,n)=>{t.moveTo(e,n)},n0=(t,e,n)=>{t.moveTo(n,e)},ld=(t,e,n)=>{t.lineTo(e,n)},cd=(t,e,n)=>{t.lineTo(n,e)},r0=wT(0),gy=wT(1),xT=(t,e,n,r,i,s)=>{t.arc(e,n,r,i,s)},_T=(t,e,n,r,i,s)=>{t.arc(n,e,r,i,s)},ST=(t,e,n,r,i,s,o)=>{t.bezierCurveTo(e,n,r,i,s,o)},kT=(t,e,n,r,i,s,o)=>{t.bezierCurveTo(n,e,i,r,o,s)};function MT(t){return(e,n,r,i,s)=>bc(e,n,(o,a,l,c,u,f,h,p,g,m,b)=>{let{pxRound:y,points:_}=o,k,S;c.ori==0?(k=t0,S=xT):(k=n0,S=_T);const E=ir(_.width*Un,3);let M=(_.size-_.width)/2*Un,O=ir(M*2,3),P=new Path2D,x=new Path2D,{left:C,top:R,width:N,height:B}=e.bbox;r0(x,C-O,R-O,N+O*2,B+O*2);const z=H=>{if(l[H]!=null){let X=y(f(a[H],c,m,p)),G=y(h(l[H],u,b,g));k(P,X+M,G),S(P,X,G,M,0,ug*2)}};if(s)s.forEach(z);else for(let H=r;H<=i;H++)z(H);return{stroke:E>0?P:null,fill:P,clip:x,flags:Yu|Cb}})}function TT(t){return(e,n,r,i,s,o)=>{r!=i&&(s!=r&&o!=r&&t(e,n,r),s!=i&&o!=i&&t(e,n,i),t(e,n,o))}}const jL=TT(ld),UL=TT(cd);function ET(t){const e=Fn(t==null?void 0:t.alignGaps,0);return(n,r,i,s)=>bc(n,r,(o,a,l,c,u,f,h,p,g,m,b)=>{[i,s]=Xm(l,i,s);let y=o.pxRound,_=B=>y(f(B,c,m,p)),k=B=>y(h(B,u,b,g)),S,E;c.ori==0?(S=ld,E=jL):(S=cd,E=UL);const M=c.dir*(c.ori==0?1:-1),O={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:Yu},P=O.stroke;let x=!1;if(s-i>=m*4){let B=J=>n.posToVal(J,c.key,!0),z=null,H=null,X,G,Z,oe=_(a[M==1?i:s]),K=_(a[i]),q=_(a[s]),W=B(M==1?K+1:q-1);for(let J=M==1?i:s;J>=i&&J<=s;J+=M){let fe=a[J],de=(M==1?fe<W:fe>W)?oe:_(fe),Be=l[J];de==oe?Be!=null?(G=Be,z==null?(S(P,de,k(G)),X=z=H=G):G<z?z=G:G>H&&(H=G)):Be===null&&(x=!0):(z!=null&&E(P,oe,k(z),k(H),k(X),k(G)),Be!=null?(G=Be,S(P,de,k(G)),z=H=X=G):(z=H=null,Be===null&&(x=!0)),oe=de,W=B(oe+M))}z!=null&&z!=H&&Z!=oe&&E(P,oe,k(z),k(H),k(X),k(G))}else for(let B=M==1?i:s;B>=i&&B<=s;B+=M){let z=l[B];z===null?x=!0:z!=null&&S(P,_(a[B]),k(z))}let[R,N]=hy(n,r);if(o.fill!=null||R!=0){let B=O.fill=new Path2D(P),z=o.fillTo(n,r,o.min,o.max,R),H=k(z),X=_(a[i]),G=_(a[s]);M==-1&&([G,X]=[X,G]),S(B,G,H),S(B,X,H)}if(!o.spanGaps){let B=[];x&&B.push(...py(a,l,i,s,M,_,e)),O.gaps=B=o.gaps(n,r,i,s,B),O.clip=e0(B,c.ori,p,g,m,b)}return N!=0&&(O.band=N==2?[fa(n,r,i,s,P,-1),fa(n,r,i,s,P,1)]:fa(n,r,i,s,P,N)),O})}function WL(t){const e=Fn(t.align,1),n=Fn(t.ascDesc,!1),r=Fn(t.alignGaps,0),i=Fn(t.extend,!1);return(s,o,a,l)=>bc(s,o,(c,u,f,h,p,g,m,b,y,_,k)=>{[a,l]=Xm(f,a,l);let S=c.pxRound,{left:E,width:M}=s.bbox,O=K=>S(g(K,h,_,b)),P=K=>S(m(K,p,k,y)),x=h.ori==0?ld:cd;const C={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:Yu},R=C.stroke,N=h.dir*(h.ori==0?1:-1);let B=P(f[N==1?a:l]),z=O(u[N==1?a:l]),H=z,X=z;i&&e==-1&&(X=E,x(R,X,B)),x(R,z,B);for(let K=N==1?a:l;K>=a&&K<=l;K+=N){let q=f[K];if(q==null)continue;let W=O(u[K]),J=P(q);e==1?x(R,W,B):x(R,H,J),x(R,W,J),B=J,H=W}let G=H;i&&e==1&&(G=E+M,x(R,G,B));let[Z,oe]=hy(s,o);if(c.fill!=null||Z!=0){let K=C.fill=new Path2D(R),q=c.fillTo(s,o,c.min,c.max,Z),W=P(q);x(K,G,W),x(K,X,W)}if(!c.spanGaps){let K=[];K.push(...py(u,f,a,l,N,O,r));let q=c.width*Un/2,W=n||e==1?q:-q,J=n||e==-1?-q:q;K.forEach(fe=>{fe[0]+=W,fe[1]+=J}),C.gaps=K=c.gaps(s,o,a,l,K),C.clip=e0(K,h.ori,b,y,_,k)}return oe!=0&&(C.band=oe==2?[fa(s,o,a,l,R,-1),fa(s,o,a,l,R,1)]:fa(s,o,a,l,R,oe)),C})}function w_(t,e,n,r,i,s,o=rr){if(t.length>1){let a=null;for(let l=0,c=1/0;l<t.length;l++)if(e[l]!==void 0){if(a!=null){let u=Br(t[l]-t[a]);u<c&&(c=u,o=Br(n(t[l],r,i,s)-n(t[a],r,i,s)))}a=l}}return o}function qL(t){t=t||af;const e=Fn(t.size,[.6,rr,1]),n=t.align||0,r=t.gap||0;let i=t.radius;i=i==null?[0,0]:typeof i=="number"?[i,0]:i;const s=Mn(i),o=1-e[0],a=Fn(e[1],rr),l=Fn(e[2],1),c=Fn(t.disp,af),u=Fn(t.each,p=>{}),{fill:f,stroke:h}=c;return(p,g,m,b)=>bc(p,g,(y,_,k,S,E,M,O,P,x,C,R)=>{let N=y.pxRound,B=n,z=r*Un,H=a*Un,X=l*Un,G,Z;S.ori==0?[G,Z]=s(p,g):[Z,G]=s(p,g);const oe=S.dir*(S.ori==0?1:-1);let K=S.ori==0?r0:gy,q=S.ori==0?u:(ve,Xe,et,dt,ge,Ae,Ie)=>{u(ve,Xe,et,ge,dt,Ie,Ae)},W=Fn(p.bands,ly).find(ve=>ve.series[0]==g),J=W!=null?W.dir:0,fe=y.fillTo(p,g,y.min,y.max,J),$=N(O(fe,E,R,x)),de,Be,wt,Je=C,Ue=N(y.width*Un),ke=!1,ct=null,Ee=null,Ve=null,be=null;f!=null&&(Ue==0||h!=null)&&(ke=!0,ct=f.values(p,g,m,b),Ee=new Map,new Set(ct).forEach(ve=>{ve!=null&&Ee.set(ve,new Path2D)}),Ue>0&&(Ve=h.values(p,g,m,b),be=new Map,new Set(Ve).forEach(ve=>{ve!=null&&be.set(ve,new Path2D)})));let{x0:xt,size:_t}=c;if(xt!=null&&_t!=null){B=1,_=xt.values(p,g,m,b),xt.unit==2&&(_=_.map(et=>p.posToVal(P+et*C,S.key,!0)));let ve=_t.values(p,g,m,b);_t.unit==2?Be=ve[0]*C:Be=M(ve[0],S,C,P)-M(0,S,C,P),Je=w_(_,k,M,S,C,P,Je),wt=Je-Be+z}else Je=w_(_,k,M,S,C,P,Je),wt=Je*o+z,Be=Je-wt;wt<1&&(wt=0),Ue>=Be/2&&(Ue=0),wt<5&&(N=XM);let Yt=wt>0,en=Je-wt-(Yt?Ue:0);Be=N(Eb(en,X,H)),de=(B==0?Be/2:B==oe?0:Be)-B*oe*((B==0?z/2:0)+(Yt?Ue/2:0));const tn={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},Qn=ke?null:new Path2D;let se=null;if(W!=null)se=p.data[W.series[1]];else{let{y0:ve,y1:Xe}=c;ve!=null&&Xe!=null&&(k=Xe.values(p,g,m,b),se=ve.values(p,g,m,b))}let _e=G*Be,me=Z*Be;for(let ve=oe==1?m:b;ve>=m&&ve<=b;ve+=oe){let Xe=k[ve];if(Xe==null)continue;if(se!=null){let gt=se[ve]??0;if(Xe-gt==0)continue;$=O(gt,E,R,x)}let et=S.distr!=2||c!=null?_[ve]:ve,dt=M(et,S,C,P),ge=O(Fn(Xe,fe),E,R,x),Ae=N(dt-de),Ie=N(Ei(ge,$)),pt=N(qs(ge,$)),Le=Ie-pt;if(Xe!=null){let gt=Xe<0?me:_e,nn=Xe<0?_e:me;ke?(Ue>0&&Ve[ve]!=null&&K(be.get(Ve[ve]),Ae,pt+is(Ue/2),Be,Ei(0,Le-Ue),gt,nn),ct[ve]!=null&&K(Ee.get(ct[ve]),Ae,pt+is(Ue/2),Be,Ei(0,Le-Ue),gt,nn)):K(Qn,Ae,pt+is(Ue/2),Be,Ei(0,Le-Ue),gt,nn),q(p,g,ve,Ae-Ue/2,pt,Be+Ue,Le)}}return Ue>0?tn.stroke=ke?be:Qn:ke||(tn._fill=y.width==0?y._fill:y._stroke??y._fill,tn.width=0),tn.fill=ke?Ee:Qn,tn})}function HL(t,e){const n=Fn(e==null?void 0:e.alignGaps,0);return(r,i,s,o)=>bc(r,i,(a,l,c,u,f,h,p,g,m,b,y)=>{[s,o]=Xm(c,s,o);let _=a.pxRound,k=G=>_(h(G,u,b,g)),S=G=>_(p(G,f,y,m)),E,M,O;u.ori==0?(E=t0,O=ld,M=ST):(E=n0,O=cd,M=kT);const P=u.dir*(u.ori==0?1:-1);let x=k(l[P==1?s:o]),C=x,R=[],N=[];for(let G=P==1?s:o;G>=s&&G<=o;G+=P)if(c[G]!=null){let oe=l[G],K=k(oe);R.push(C=K),N.push(S(c[G]))}const B={stroke:t(R,N,E,O,M,_),fill:null,clip:null,band:null,gaps:null,flags:Yu},z=B.stroke;let[H,X]=hy(r,i);if(a.fill!=null||H!=0){let G=B.fill=new Path2D(z),Z=a.fillTo(r,i,a.min,a.max,H),oe=S(Z);O(G,C,oe),O(G,x,oe)}if(!a.spanGaps){let G=[];G.push(...py(l,c,s,o,P,k,n)),B.gaps=G=a.gaps(r,i,s,o,G),B.clip=e0(G,u.ori,g,m,b,y)}return X!=0&&(B.band=X==2?[fa(r,i,s,o,z,-1),fa(r,i,s,o,z,1)]:fa(r,i,s,o,z,X)),B})}function VL(t){return HL($L,t)}function $L(t,e,n,r,i,s){const o=t.length;if(o<2)return null;const a=new Path2D;if(n(a,t[0],e[0]),o==2)r(a,t[1],e[1]);else{let l=Array(o),c=Array(o-1),u=Array(o-1),f=Array(o-1);for(let h=0;h<o-1;h++)u[h]=e[h+1]-e[h],f[h]=t[h+1]-t[h],c[h]=u[h]/f[h];l[0]=c[0];for(let h=1;h<o-1;h++)c[h]===0||c[h-1]===0||c[h-1]>0!=c[h]>0?l[h]=0:(l[h]=3*(f[h-1]+f[h])/((2*f[h]+f[h-1])/c[h-1]+(f[h]+2*f[h-1])/c[h]),isFinite(l[h])||(l[h]=0));l[o-1]=c[o-2];for(let h=0;h<o-1;h++)i(a,t[h]+f[h]/3,e[h]+l[h]*f[h]/3,t[h+1]-f[h]/3,e[h+1]-l[h+1]*f[h]/3,t[h+1],e[h+1])}return a}const Ob=new Set;function x_(){for(let t of Ob)t.syncRect(!0)}ad&&(Jl(T6,su,x_),Jl(E6,su,x_,!0),Jl(qg,su,()=>{hi.pxRatio=Un}));const GL=ET(),YL=MT();function __(t,e,n,r){return(r?[t[0],t[1]].concat(t.slice(2)):[t[0]].concat(t.slice(1))).map((s,o)=>Rb(s,o,e,n))}function KL(t,e){return t.map((n,r)=>r==0?{}:Or({},e,n))}function Rb(t,e,n,r){return Or({},e==0?n:r,t)}function AT(t,e,n){return e==null?$u:[e,n]}const XL=AT;function ZL(t,e,n){return e==null?$u:Hg(e,n,oy,!0)}function PT(t,e,n,r){return e==null?$u:Zm(e,n,t.scales[r].log,!1)}const QL=PT;function CT(t,e,n,r){return e==null?$u:sy(e,n,t.scales[r].log,!1)}const JL=CT;function eD(t,e,n,r,i){let s=Ei(e_(t),e_(e)),o=e-t,a=Bs(i/r*o,n);do{let l=n[a],c=r*l/o;if(c>=i&&s+(l<5?cl.get(l):0)<=17)return[l,c]}while(++a<n.length);return[0,0]}function S_(t){let e,n;return t=t.replace(/(\d+)px/,(r,i)=>(e=Fr((n=+i)*Un))+"px"),[t,e,n]}function tD(t){t.show&&[t.font,t.labelFont].forEach(e=>{let n=ir(e[2]*Un,1);e[0]=e[0].replace(/[0-9.]+px/,n+"px"),e[1]=n})}function hi(t,e,n){const r={mode:Fn(t.mode,1)},i=r.mode;function s(w,T,D,U){let Q=T.valToPct(w);return U+D*(T.dir==-1?1-Q:Q)}function o(w,T,D,U){let Q=T.valToPct(w);return U+D*(T.dir==-1?Q:1-Q)}function a(w,T,D,U){return T.ori==0?s(w,T,D,U):o(w,T,D,U)}r.valToPosH=s,r.valToPosV=o;let l=!1;r.status=0;const c=r.root=ds(l6);if(t.id!=null&&(c.id=t.id),Gi(c,t.class),t.title){let w=ds(d6,c);w.textContent=t.title}const u=Is("canvas"),f=r.ctx=u.getContext("2d"),h=ds(f6,c);Jl("click",h,w=>{w.target===g&&(or!=Sc||gr!=kc)&&ii.click(r,w)},!0);const p=r.under=ds(h6,h);h.appendChild(u);const g=r.over=ds(p6,h);t=Gu(t);const m=+Fn(t.pxAlign,1),b=y_(m);(t.plugins||[]).forEach(w=>{w.opts&&(t=w.opts(r,t)||t)});const y=t.ms||.001,_=r.series=i==1?__(t.series||[],f_,v_,!1):KL(t.series||[null],m_),k=r.axes=__(t.axes||[],d_,p_,!0),S=r.scales={},E=r.bands=t.bands||[];E.forEach(w=>{w.fill=Mn(w.fill||null),w.dir=Fn(w.dir,-1)});const M=i==2?_[1].facets[0].scale:_[0].scale,O={axes:Pr,series:ls},P=(t.drawOrder||["axes","series"]).map(w=>O[w]);function x(w){const T=w.distr==3?D=>da(D>0?D:w.clamp(r,D,w.min,w.max,w.key)):w.distr==4?D=>D0(D,w.asinh):w.distr==100?D=>w.fwd(D):D=>D;return D=>{let U=T(D),{_min:Q,_max:ce}=w,Fe=ce-Q;return(U-Q)/Fe}}function C(w){let T=S[w];if(T==null){let D=(t.scales||af)[w]||af;if(D.from!=null){C(D.from);let U=Or({},S[D.from],D,{key:w});U.valToPct=x(U),S[w]=U}else{T=S[w]=Or({},w==M?bT:DL,D),T.key=w;let U=T.time,Q=T.range,ce=Ia(Q);if((w!=M||i==2&&!U)&&(ce&&(Q[0]==null||Q[1]==null)&&(Q={min:Q[0]==null?Zx:{mode:1,hard:Q[0],soft:Q[0]},max:Q[1]==null?Zx:{mode:1,hard:Q[1],soft:Q[1]}},ce=!1),!ce&&Jm(Q))){let Fe=Q;Q=(Ke,it,yt)=>it==null?$u:Hg(it,yt,Fe)}T.range=Mn(Q||(U?XL:w==M?T.distr==3?QL:T.distr==4?JL:AT:T.distr==3?PT:T.distr==4?CT:ZL)),T.auto=Mn(ce?!1:T.auto),T.clamp=Mn(T.clamp||LL),T._min=T._max=null,T.valToPct=x(T)}}}C("x"),C("y"),i==1&&_.forEach(w=>{C(w.scale)}),k.forEach(w=>{C(w.scale)});for(let w in t.scales)C(w);const R=S[M],N=R.distr;let B,z;R.ori==0?(Gi(c,c6),B=s,z=o):(Gi(c,u6),B=o,z=s);const H={};for(let w in S){let T=S[w];(T.min!=null||T.max!=null)&&(H[w]={min:T.min,max:T.max},T.min=T.max=null)}const X=t.tzDate||(w=>new Date(Fr(w/y))),G=t.fmtDate||cy,Z=y==1?cL(X):fL(X),oe=l_(X,a_(y==1?lL:dL,G)),K=u_(X,c_(pL,G)),q=[],W=r.legend=Or({},vL,t.legend),J=r.cursor=Or({},SL,{drag:{y:i==2}},t.cursor),fe=W.show,$=J.show,de=W.markers;W.idxs=q,de.width=Mn(de.width),de.dash=Mn(de.dash),de.stroke=Mn(de.stroke),de.fill=Mn(de.fill);let Be,wt,Je,Ue=[],ke=[],ct,Ee=!1,Ve={};if(W.live){const w=_[1]?_[1].values:null;Ee=w!=null,ct=Ee?w(r,1,0):{_:0};for(let T in ct)Ve[T]=ry}if(fe)if(Be=Is("table",w6,c),Je=Is("tbody",null,Be),W.mount(r,Be),Ee){wt=Is("thead",null,Be,Je);let w=Is("tr",null,wt);Is("th",null,w);for(var be in ct)Is("th",Fx,w).textContent=be}else Gi(Be,_6),W.live&&Gi(Be,x6);const xt={show:!0},_t={show:!1};function Yt(w,T){if(T==0&&(Ee||!W.live||i==2))return $u;let D=[],U=Is("tr",S6,Je,Je.childNodes[T]);Gi(U,w.class),w.show||Gi(U,Cl);let Q=Is("th",null,U);if(de.show){let Ke=ds(k6,Q);if(T>0){let it=de.width(r,T);it&&(Ke.style.border=it+"px "+de.dash(r,T)+" "+de.stroke(r,T)),Ke.style.background=de.fill(r,T)}}let ce=ds(Fx,Q);w.label instanceof HTMLElement?ce.appendChild(w.label):ce.textContent=w.label,T>0&&(de.show||(ce.style.color=w.width>0?de.stroke(r,T):de.fill(r,T)),tn("click",Q,Ke=>{if(J._lock)return;jt(Ke);let it=_.indexOf(w);if((Ke.ctrlKey||Ke.metaKey)!=W.isolate){let yt=_.some((kt,Nt)=>Nt>0&&Nt!=it&&kt.show);_.forEach((kt,Nt)=>{Nt>0&&so(Nt,yt?Nt==it?xt:_t:xt,!0,Cr.setSeries)})}else so(it,{show:!w.show},!0,Cr.setSeries)},!1),Vt&&tn(Wx,Q,Ke=>{J._lock||(jt(Ke),so(_.indexOf(w),Tc,!0,Cr.setSeries))},!1));for(var Fe in ct){let Ke=Is("td",M6,U);Ke.textContent="--",D.push(Ke)}return[U,D]}const en=new Map;function tn(w,T,D,U=!0){const Q=en.get(T)||{},ce=J.bind[w](r,T,D,U);ce&&(Jl(w,T,Q[w]=ce),en.set(T,Q))}function Qn(w,T,D){const U=en.get(T)||{};for(let Q in U)(w==null||Q==w)&&(Tb(Q,T,U[Q]),delete U[Q]);w==null&&en.delete(T)}let se=0,_e=0,me=0,ve=0,Xe=0,et=0,dt=Xe,ge=et,Ae=me,Ie=ve,pt=0,Le=0,gt=0,nn=0;r.bbox={};let St=!1,Rt=!1,re=!1,ae=!1,he=!1,le=!1;function Pe(w,T,D){(D||w!=r.width||T!=r.height)&&Oe(w,T),nr(!1),re=!0,Rt=!0,wc()}function Oe(w,T){r.width=se=me=w,r.height=_e=ve=T,Xe=et=0,Ge(),Ft();let D=r.bbox;pt=D.left=Ml(Xe*Un,.5),Le=D.top=Ml(et*Un,.5),gt=D.width=Ml(me*Un,.5),nn=D.height=Ml(ve*Un,.5)}const Re=3;function Ce(){let w=!1,T=0;for(;!w;){T++;let D=pn(T),U=Cn(T);w=T==Re||D&&U,w||(Oe(r.width,r.height),Rt=!0)}}function He({width:w,height:T}){Pe(w,T)}r.setSize=He;function Ge(){let w=!1,T=!1,D=!1,U=!1;k.forEach((Q,ce)=>{if(Q.show&&Q._show){let{side:Fe,_size:Ke}=Q,it=Fe%2,yt=Q.label!=null?Q.labelSize:0,kt=Ke+yt;kt>0&&(it?(me-=kt,Fe==3?(Xe+=kt,U=!0):D=!0):(ve-=kt,Fe==0?(et+=kt,w=!0):T=!0))}}),Jt[0]=w,Jt[1]=D,Jt[2]=T,Jt[3]=U,me-=We[1]+We[3],Xe+=We[3],ve-=We[2]+We[0],et+=We[0]}function Ft(){let w=Xe+me,T=et+ve,D=Xe,U=et;function Q(ce,Fe){switch(ce){case 1:return w+=Fe,w-Fe;case 2:return T+=Fe,T-Fe;case 3:return D-=Fe,D+Fe;case 0:return U-=Fe,U+Fe}}k.forEach((ce,Fe)=>{if(ce.show&&ce._show){let Ke=ce.side;ce._pos=Q(Ke,ce._size),ce.label!=null&&(ce._lpos=Q(Ke,ce.labelSize))}})}if(J.dataIdx==null){let w=J.hover,T=w.skip=new Set(w.skip??[]);T.add(void 0);let D=w.prox=Mn(w.prox),U=w.bias??(w.bias=0);J.dataIdx=(Q,ce,Fe,Ke)=>{if(ce==0)return Fe;let it=Fe,yt=D(Q,ce,Fe,Ke)??rr,kt=yt>=0&&yt<rr,Nt=R.ori==0?me:ve,cn=J.left,jn=e[0],Dn=e[ce];if(T.has(Dn[Fe])){it=null;let Sn=null,Xt=null,Wt;if(U==0||U==-1)for(Wt=Fe;Sn==null&&Wt-- >0;)T.has(Dn[Wt])||(Sn=Wt);if(U==0||U==1)for(Wt=Fe;Xt==null&&Wt++<Dn.length;)T.has(Dn[Wt])||(Xt=Wt);if(Sn!=null||Xt!=null)if(kt){let lr=Sn==null?-1/0:B(jn[Sn],R,Nt,0),yr=Xt==null?1/0:B(jn[Xt],R,Nt,0),Kr=cn-lr,Jn=yr-cn;Kr<=Jn?Kr<=yt&&(it=Sn):Jn<=yt&&(it=Xt)}else it=Xt==null?Sn:Sn==null?Xt:Fe-Sn<=Xt-Fe?Sn:Xt}else kt&&Br(cn-B(jn[Fe],R,Nt,0))>yt&&(it=null);return it}}const jt=w=>{J.event=w};J.idxs=q,J._lock=!1;let nt=J.points;nt.show=Mn(nt.show),nt.size=Mn(nt.size),nt.stroke=Mn(nt.stroke),nt.width=Mn(nt.width),nt.fill=Mn(nt.fill);const tt=r.focus=Or({},t.focus||{alpha:.3},J.focus),Vt=tt.prox>=0,In=Vt&&nt.one;let L=[],ie=[],Te=[];function ft(w,T){let D=nt.show(r,T);if(D instanceof HTMLElement)return Gi(D,y6),Gi(D,w.class),uo(D,-10,-10,me,ve),g.insertBefore(D,L[T]),D}function rn(w,T){if(i==1||T>0){let D=i==1&&S[w.scale].time,U=w.value;w.value=D?r_(U)?u_(X,c_(U,G)):U||K:U||NL,w.label=w.label||(D?ML:kL)}if(In||T>0){w.width=w.width==null?1:w.width,w.paths=w.paths||GL||D6,w.fillTo=Mn(w.fillTo||FL),w.pxAlign=+Fn(w.pxAlign,m),w.pxRound=y_(w.pxAlign),w.stroke=Mn(w.stroke||null),w.fill=Mn(w.fill||null),w._stroke=w._fill=w._paths=w._focus=null;let D=IL(Ei(1,w.width),1),U=w.points=Or({},{size:D,width:Ei(1,D*.2),stroke:w.stroke,space:D*2,paths:YL,_stroke:null,_fill:null},w.points);U.show=Mn(U.show),U.filter=Mn(U.filter),U.fill=Mn(U.fill),U.stroke=Mn(U.stroke),U.paths=Mn(U.paths),U.pxAlign=w.pxAlign}if(fe){let D=Yt(w,T);Ue.splice(T,0,D[0]),ke.splice(T,0,D[1]),W.values.push(null)}if($){q.splice(T,0,null);let D=null;In?T==0&&(D=ft(w,T)):T>0&&(D=ft(w,T)),L.splice(T,0,D),ie.splice(T,0,0),Te.splice(T,0,0)}Yr("addSeries",T)}function yn(w,T){T=T??_.length,w=i==1?Rb(w,T,f_,v_):Rb(w,T,{},m_),_.splice(T,0,w),rn(_[T],T)}r.addSeries=yn;function Ut(w){if(_.splice(w,1),fe){W.values.splice(w,1),ke.splice(w,1);let T=Ue.splice(w,1)[0];Qn(null,T.firstChild),T.remove()}$&&(q.splice(w,1),L.splice(w,1)[0].remove(),ie.splice(w,1),Te.splice(w,1)),Yr("delSeries",w)}r.delSeries=Ut;const Jt=[!1,!1,!1,!1];function bt(w,T){if(w._show=w.show,w.show){let D=w.side%2,U=S[w.scale];U==null&&(w.scale=D?_[1].scale:M,U=S[w.scale]);let Q=U.time;w.size=Mn(w.size),w.space=Mn(w.space),w.rotate=Mn(w.rotate),Ia(w.incrs)&&w.incrs.forEach(Fe=>{!cl.has(Fe)&&cl.set(Fe,JM(Fe))}),w.incrs=Mn(w.incrs||(U.distr==2?sL:Q?y==1?aL:uL:Tl)),w.splits=Mn(w.splits||(Q&&U.distr==1?Z:U.distr==3?Ab:U.distr==4?AL:EL)),w.stroke=Mn(w.stroke),w.grid.stroke=Mn(w.grid.stroke),w.ticks.stroke=Mn(w.ticks.stroke),w.border.stroke=Mn(w.border.stroke);let ce=w.values;w.values=Ia(ce)&&!Ia(ce[0])?Mn(ce):Q?Ia(ce)?l_(X,a_(ce,G)):r_(ce)?hL(X,ce):ce||oe:ce||TL,w.filter=Mn(w.filter||(U.distr>=3&&U.log==10?OL:U.distr==3&&U.log==2?RL:ZM)),w.font=S_(w.font),w.labelFont=S_(w.labelFont),w._size=w.size(r,null,T,0),w._space=w._rotate=w._incrs=w._found=w._splits=w._values=null,w._size>0&&(Jt[T]=!0,w._el=ds(g6,h))}}function pe(w,T,D,U){let[Q,ce,Fe,Ke]=D,it=T%2,yt=0;return it==0&&(Ke||ce)&&(yt=T==0&&!Q||T==2&&!Fe?Fr(d_.size/3):0),it==1&&(Q||Fe)&&(yt=T==1&&!ce||T==3&&!Ke?Fr(p_.size/2):0),yt}const Ze=r.padding=(t.padding||[pe,pe,pe,pe]).map(w=>Mn(Fn(w,pe))),We=r._padding=Ze.map((w,T)=>w(r,T,Jt,0));let mt,rt=null,$e=null;const Bt=i==1?_[0].idxs:null;let At=null,vt=!1;function Pt(w,T){if(e=w??[],r.data=r._data=e,i==2){mt=0;for(let D=1;D<_.length;D++)mt+=e[D][0].length}else{e.length==0&&(r.data=r._data=e=[[]]),At=e[0],mt=At.length;let D=e;if(N==2){D=e.slice();let U=D[0]=Array(mt);for(let Q=0;Q<mt;Q++)U[Q]=Q}r._data=e=D}if(nr(!0),Yr("setData"),N==2&&(re=!0),T!==!1){let D=R;D.auto(r,vt)?Kt():Sa(M,D.min,D.max),ae=ae||J.left>=0,le=!0,wc()}}r.setData=Pt;function Kt(){vt=!0;let w,T;i==1&&(mt>0?(rt=Bt[0]=0,$e=Bt[1]=mt-1,w=e[0][rt],T=e[0][$e],N==2?(w=rt,T=$e):w==T&&(N==3?[w,T]=Zm(w,w,R.log,!1):N==4?[w,T]=sy(w,w,R.log,!1):R.time?T=w+Fr(86400/y):[w,T]=Hg(w,T,oy,!0))):(rt=Bt[0]=w=null,$e=Bt[1]=T=null)),Sa(M,w,T)}let Mt,Ct,Ht,_n,ln,sn,mn,Bn,qn,vn;function Vr(w,T,D,U,Q,ce){w??(w=jx),D??(D=ly),U??(U="butt"),Q??(Q=jx),ce??(ce="round"),w!=Mt&&(f.strokeStyle=Mt=w),Q!=Ct&&(f.fillStyle=Ct=Q),T!=Ht&&(f.lineWidth=Ht=T),ce!=ln&&(f.lineJoin=ln=ce),U!=sn&&(f.lineCap=sn=U),D!=_n&&f.setLineDash(_n=D)}function Pn(w,T,D,U){T!=Ct&&(f.fillStyle=Ct=T),w!=mn&&(f.font=mn=w),D!=Bn&&(f.textAlign=Bn=D),U!=qn&&(f.textBaseline=qn=U)}function Yn(w,T,D,U,Q=0){if(U.length>0&&w.auto(r,vt)&&(T==null||T.min==null)){let ce=Fn(rt,0),Fe=Fn($e,U.length-1),Ke=D.min==null?O6(U,ce,Fe,Q,w.distr==3):[D.min,D.max];w.min=qs(w.min,D.min=Ke[0]),w.max=Ei(w.max,D.max=Ke[1])}}const sr={min:null,max:null};function pr(){for(let U in S){let Q=S[U];H[U]==null&&(Q.min==null||H[M]!=null&&Q.auto(r,vt))&&(H[U]=sr)}for(let U in S){let Q=S[U];H[U]==null&&Q.from!=null&&H[Q.from]!=null&&(H[U]=sr)}H[M]!=null&&nr(!0);let w={};for(let U in H){let Q=H[U];if(Q!=null){let ce=w[U]=Gu(S[U],j6);if(Q.min!=null)Or(ce,Q);else if(U!=M||i==2)if(mt==0&&ce.from==null){let Fe=ce.range(r,null,null,U);ce.min=Fe[0],ce.max=Fe[1]}else ce.min=rr,ce.max=-rr}}if(mt>0){_.forEach((U,Q)=>{if(i==1){let ce=U.scale,Fe=H[ce];if(Fe==null)return;let Ke=w[ce];if(Q==0){let it=Ke.range(r,Ke.min,Ke.max,ce);Ke.min=it[0],Ke.max=it[1],rt=Bs(Ke.min,e[0]),$e=Bs(Ke.max,e[0]),$e-rt>1&&(e[0][rt]<Ke.min&&rt++,e[0][$e]>Ke.max&&$e--),U.min=At[rt],U.max=At[$e]}else U.show&&U.auto&&Yn(Ke,Fe,U,e[Q],U.sorted);U.idxs[0]=rt,U.idxs[1]=$e}else if(Q>0&&U.show&&U.auto){let[ce,Fe]=U.facets,Ke=ce.scale,it=Fe.scale,[yt,kt]=e[Q],Nt=w[Ke],cn=w[it];Nt!=null&&Yn(Nt,H[Ke],ce,yt,ce.sorted),cn!=null&&Yn(cn,H[it],Fe,kt,Fe.sorted),U.min=Fe.min,U.max=Fe.max}});for(let U in w){let Q=w[U],ce=H[U];if(Q.from==null&&(ce==null||ce.min==null)){let Fe=Q.range(r,Q.min==rr?null:Q.min,Q.max==-rr?null:Q.max,U);Q.min=Fe[0],Q.max=Fe[1]}}}for(let U in w){let Q=w[U];if(Q.from!=null){let ce=w[Q.from];if(ce.min==null)Q.min=Q.max=null;else{let Fe=Q.range(r,ce.min,ce.max,U);Q.min=Fe[0],Q.max=Fe[1]}}}let T={},D=!1;for(let U in w){let Q=w[U],ce=S[U];if(ce.min!=Q.min||ce.max!=Q.max){ce.min=Q.min,ce.max=Q.max;let Fe=ce.distr;ce._min=Fe==3?da(ce.min):Fe==4?D0(ce.min,ce.asinh):Fe==100?ce.fwd(ce.min):ce.min,ce._max=Fe==3?da(ce.max):Fe==4?D0(ce.max,ce.asinh):Fe==100?ce.fwd(ce.max):ce.max,T[U]=D=!0}}if(D){_.forEach((U,Q)=>{i==2?Q>0&&T.y&&(U._paths=null):T[U.scale]&&(U._paths=null)});for(let U in T)re=!0,Yr("setScale",U);$&&J.left>=0&&(ae=le=!0)}for(let U in H)H[U]=null}function mi(w){let T=Eb(rt-1,0,mt-1),D=Eb($e+1,0,mt-1);for(;w[T]==null&&T>0;)T--;for(;w[D]==null&&D<mt-1;)D++;return[T,D]}function ls(){if(mt>0){let w=_.some(T=>T._focus)&&vn!=tt.alpha;w&&(f.globalAlpha=vn=tt.alpha),_.forEach((T,D)=>{if(D>0&&T.show&&(io(D,!1),io(D,!0),T._paths==null)){let U=vn;vn!=T.alpha&&(f.globalAlpha=vn=T.alpha);let Q=i==2?[0,e[D][0].length-1]:mi(e[D]);T._paths=T.paths(r,D,Q[0],Q[1]),vn!=U&&(f.globalAlpha=vn=U)}}),_.forEach((T,D)=>{if(D>0&&T.show){let U=vn;vn!=T.alpha&&(f.globalAlpha=vn=T.alpha),T._paths!=null&&Os(D,!1);{let Q=T._paths!=null?T._paths.gaps:null,ce=T.points.show(r,D,rt,$e,Q),Fe=T.points.filter(r,D,ce,Q);(ce||Fe)&&(T.points._paths=T.points.paths(r,D,rt,$e,Fe),Os(D,!0))}vn!=U&&(f.globalAlpha=vn=U),Yr("drawSeries",D)}}),w&&(f.globalAlpha=vn=1)}}function io(w,T){let D=T?_[w].points:_[w];D._stroke=D.stroke(r,w),D._fill=D.fill(r,w)}function Os(w,T){let D=T?_[w].points:_[w],{stroke:U,fill:Q,clip:ce,flags:Fe,_stroke:Ke=D._stroke,_fill:it=D._fill,_width:yt=D.width}=D._paths;yt=ir(yt*Un,3);let kt=null,Nt=yt%2/2;T&&it==null&&(it=yt>0?"#fff":Ke);let cn=D.pxAlign==1&&Nt>0;if(cn&&f.translate(Nt,Nt),!T){let jn=pt-yt/2,Dn=Le-yt/2,Sn=gt+yt,Xt=nn+yt;kt=new Path2D,kt.rect(jn,Dn,Sn,Xt)}T?Ye(Ke,yt,D.dash,D.cap,it,U,Q,Fe,ce):Mr(w,Ke,yt,D.dash,D.cap,it,U,Q,Fe,kt,ce),cn&&f.translate(-Nt,-Nt)}function Mr(w,T,D,U,Q,ce,Fe,Ke,it,yt,kt){let Nt=!1;it!=0&&E.forEach((cn,jn)=>{if(cn.series[0]==w){let Dn=_[cn.series[1]],Sn=e[cn.series[1]],Xt=(Dn._paths||af).band;Ia(Xt)&&(Xt=cn.dir==1?Xt[0]:Xt[1]);let Wt,lr=null;Dn.show&&Xt&&N6(Sn,rt,$e)?(lr=cn.fill(r,jn)||ce,Wt=Dn._paths.clip):Xt=null,Ye(T,D,U,Q,lr,Fe,Ke,it,yt,kt,Wt,Xt),Nt=!0}}),Nt||Ye(T,D,U,Q,ce,Fe,Ke,it,yt,kt)}const Hn=Yu|Cb;function Ye(w,T,D,U,Q,ce,Fe,Ke,it,yt,kt,Nt){Vr(w,T,D,U,Q),(it||yt||Nt)&&(f.save(),it&&f.clip(it),yt&&f.clip(yt)),Nt?(Ke&Hn)==Hn?(f.clip(Nt),kt&&f.clip(kt),ue(Q,Fe),F(w,ce,T)):Ke&Cb?(ue(Q,Fe),f.clip(Nt),F(w,ce,T)):Ke&Yu&&(f.save(),f.clip(Nt),kt&&f.clip(kt),ue(Q,Fe),f.restore(),F(w,ce,T)):(ue(Q,Fe),F(w,ce,T)),(it||yt||Nt)&&f.restore()}function F(w,T,D){D>0&&(T instanceof Map?T.forEach((U,Q)=>{f.strokeStyle=Mt=Q,f.stroke(U)}):T!=null&&w&&f.stroke(T))}function ue(w,T){T instanceof Map?T.forEach((D,U)=>{f.fillStyle=Ct=U,f.fill(D)}):T!=null&&w&&f.fill(T)}function at(w,T,D,U){let Q=k[w],ce;if(U<=0)ce=[0,0];else{let Fe=Q._space=Q.space(r,w,T,D,U),Ke=Q._incrs=Q.incrs(r,w,T,D,U,Fe);ce=eD(T,D,Ke,U,Fe)}return Q._found=ce}function Lt(w,T,D,U,Q,ce,Fe,Ke,it,yt){let kt=Fe%2/2;m==1&&f.translate(kt,kt),Vr(Ke,Fe,it,yt,Ke),f.beginPath();let Nt,cn,jn,Dn,Sn=Q+(U==0||U==3?-ce:ce);D==0?(cn=Q,Dn=Sn):(Nt=Q,jn=Sn);for(let Xt=0;Xt<w.length;Xt++)T[Xt]!=null&&(D==0?Nt=jn=w[Xt]:cn=Dn=w[Xt],f.moveTo(Nt,cn),f.lineTo(jn,Dn));f.stroke(),m==1&&f.translate(-kt,-kt)}function pn(w){let T=!0;return k.forEach((D,U)=>{if(!D.show)return;let Q=S[D.scale];if(Q.min==null){D._show&&(T=!1,D._show=!1,nr(!1));return}else D._show||(T=!1,D._show=!0,nr(!1));let ce=D.side,Fe=ce%2,{min:Ke,max:it}=Q,[yt,kt]=at(U,Ke,it,Fe==0?me:ve);if(kt==0)return;let Nt=Q.distr==2,cn=D._splits=D.splits(r,U,Ke,it,yt,kt,Nt),jn=Q.distr==2?cn.map(Wt=>At[Wt]):cn,Dn=Q.distr==2?At[cn[1]]-At[cn[0]]:yt,Sn=D._values=D.values(r,D.filter(r,jn,U,kt,Dn),U,kt,Dn);D._rotate=ce==2?D.rotate(r,Sn,U,kt):0;let Xt=D._size;D._size=xs(D.size(r,Sn,U,w)),Xt!=null&&D._size!=Xt&&(T=!1)}),T}function Cn(w){let T=!0;return Ze.forEach((D,U)=>{let Q=D(r,U,Jt,w);Q!=We[U]&&(T=!1),We[U]=Q}),T}function Pr(){for(let w=0;w<k.length;w++){let T=k[w];if(!T.show||!T._show)continue;let D=T.side,U=D%2,Q,ce,Fe=T.stroke(r,w),Ke=D==0||D==3?-1:1,[it,yt]=T._found;if(T.label!=null){let yi=T.labelGap*Ke,Hi=Fr((T._lpos+yi)*Un);Pn(T.labelFont[0],Fe,"center",D==2?kd:Bx),f.save(),U==1?(Q=ce=0,f.translate(Hi,Fr(Le+nn/2)),f.rotate((D==3?-ug:ug)/2)):(Q=Fr(pt+gt/2),ce=Hi);let bl=KM(T.label)?T.label(r,w,it,yt):T.label;f.fillText(bl,Q,ce),f.restore()}if(yt==0)continue;let kt=S[T.scale],Nt=U==0?gt:nn,cn=U==0?pt:Le,jn=T._splits,Dn=kt.distr==2?jn.map(yi=>At[yi]):jn,Sn=kt.distr==2?At[jn[1]]-At[jn[0]]:it,Xt=T.ticks,Wt=T.border,lr=Xt.show?Xt.size:0,yr=Fr(lr*Un),Kr=Fr((T.alignTo==2?T._size-lr-T.gap:T.gap)*Un),Jn=T._rotate*-ug/180,wr=b(T._pos*Un),Wi=(yr+Kr)*Ke,bi=wr+Wi;ce=U==0?bi:0,Q=U==1?bi:0;let cs=T.font[0],Rs=T.align==1?Nc:T.align==2?I0:Jn>0?Nc:Jn<0?I0:U==0?"center":D==3?I0:Nc,ao=Jn||U==1?"middle":D==2?kd:Bx;Pn(cs,Fe,Rs,ao);let qi=T.font[1]*T.lineGap,us=jn.map(yi=>b(a(yi,kt,Nt,cn))),Ns=T._values;for(let yi=0;yi<Ns.length;yi++){let Hi=Ns[yi];if(Hi!=null){U==0?Q=us[yi]:ce=us[yi],Hi=""+Hi;let bl=Hi.indexOf(`
`)==-1?[Hi]:Hi.split(/\n/gm);for(let wi=0;wi<bl.length;wi++){let gw=bl[wi];Jn?(f.save(),f.translate(Q,ce+wi*qi),f.rotate(Jn),f.fillText(gw,0,0),f.restore()):f.fillText(gw,Q,ce+wi*qi)}}}Xt.show&&Lt(us,Xt.filter(r,Dn,w,yt,Sn),U,D,wr,yr,ir(Xt.width*Un,3),Xt.stroke(r,w),Xt.dash,Xt.cap);let lo=T.grid;lo.show&&Lt(us,lo.filter(r,Dn,w,yt,Sn),U,U==0?2:1,U==0?Le:pt,U==0?nn:gt,ir(lo.width*Un,3),lo.stroke(r,w),lo.dash,lo.cap),Wt.show&&Lt([wr],[1],U==0?1:0,U==0?1:2,U==1?Le:pt,U==1?nn:gt,ir(Wt.width*Un,3),Wt.stroke(r,w),Wt.dash,Wt.cap)}Yr("drawAxes")}function nr(w){_.forEach((T,D)=>{D>0&&(T._paths=null,w&&(i==1?(T.min=null,T.max=null):T.facets.forEach(U=>{U.min=null,U.max=null})))})}let ni=!1,vi=!1,jo=[];function ri(){vi=!1;for(let w=0;w<jo.length;w++)Yr(...jo[w]);jo.length=0}function wc(){ni||(G6(Zy),ni=!0)}function Q5(w,T=!1){ni=!0,vi=T,w(r),Zy(),T&&jo.length>0&&queueMicrotask(ri)}r.batch=Q5;function Zy(){if(St&&(pr(),St=!1),re&&(Ce(),re=!1),Rt){if(ur(p,Nc,Xe),ur(p,kd,et),ur(p,Hd,me),ur(p,Vd,ve),ur(g,Nc,Xe),ur(g,kd,et),ur(g,Hd,me),ur(g,Vd,ve),ur(h,Hd,se),ur(h,Vd,_e),u.width=Fr(se*Un),u.height=Fr(_e*Un),k.forEach(({_el:w,_show:T,_size:D,_pos:U,side:Q})=>{if(w!=null)if(T){let ce=Q===3||Q===0?D:0,Fe=Q%2==1;ur(w,Fe?"left":"top",U-ce),ur(w,Fe?"width":"height",D),ur(w,Fe?"top":"left",Fe?et:Xe),ur(w,Fe?"height":"width",Fe?ve:me),Mb(w,Cl)}else Gi(w,Cl)}),Mt=Ct=Ht=ln=sn=mn=Bn=qn=_n=null,vn=1,hd(!0),Xe!=dt||et!=ge||me!=Ae||ve!=Ie){nr(!1);let w=me/Ae,T=ve/Ie;if($&&!ae&&J.left>=0){J.left*=w,J.top*=T,xc&&uo(xc,Fr(J.left),0,me,ve),_c&&uo(_c,0,Fr(J.top),me,ve);for(let D=0;D<L.length;D++){let U=L[D];U!=null&&(ie[D]*=w,Te[D]*=T,uo(U,xs(ie[D]),xs(Te[D]),me,ve))}}if(ar.show&&!he&&ar.left>=0&&ar.width>0){ar.left*=w,ar.width*=w,ar.top*=T,ar.height*=T;for(let D in g0)ur(Mc,D,ar[D])}dt=Xe,ge=et,Ae=me,Ie=ve}Yr("setSize"),Rt=!1}se>0&&_e>0&&(f.clearRect(0,0,u.width,u.height),Yr("drawClear"),P.forEach(w=>w()),Yr("draw")),ar.show&&he&&(hp(ar),he=!1),$&&ae&&(vl(null,!0,!1),ae=!1),W.show&&W.live&&le&&(h0(),le=!1),l||(l=!0,r.status=1,Yr("ready")),vt=!1,ni=!1}r.redraw=(w,T)=>{re=T||!1,w!==!1?Sa(M,R.min,R.max):wc()};function u0(w,T){let D=S[w];if(D.from==null){if(mt==0){let U=D.range(r,T.min,T.max,w);T.min=U[0],T.max=U[1]}if(T.min>T.max){let U=T.min;T.min=T.max,T.max=U}if(mt>1&&T.min!=null&&T.max!=null&&T.max-T.min<1e-16)return;w==M&&D.distr==2&&mt>0&&(T.min=Bs(T.min,e[0]),T.max=Bs(T.max,e[0]),T.min==T.max&&T.max++),H[w]=T,St=!0,wc()}}r.setScale=u0;let d0,f0,xc,_c,Qy,Jy,Sc,kc,ew,tw,or,gr,_a=!1;const ii=J.drag;let $r=ii.x,Gr=ii.y;$&&(J.x&&(d0=ds(v6,g)),J.y&&(f0=ds(b6,g)),R.ori==0?(xc=d0,_c=f0):(xc=f0,_c=d0),or=J.left,gr=J.top);const ar=r.select=Or({show:!0,over:!0,left:0,width:0,top:0,height:0},t.select),Mc=ar.show?ds(m6,ar.over?g:p):null;function hp(w,T){if(ar.show){for(let D in w)ar[D]=w[D],D in g0&&ur(Mc,D,w[D]);T!==!1&&Yr("setSelect")}}r.setSelect=hp;function J5(w){if(_[w].show)fe&&Mb(Ue[w],Cl);else if(fe&&Gi(Ue[w],Cl),$){let D=In?L[0]:L[w];D!=null&&uo(D,-10,-10,me,ve)}}function Sa(w,T,D){u0(w,{min:T,max:D})}function so(w,T,D,U){T.focus!=null&&iE(w),T.show!=null&&_.forEach((Q,ce)=>{ce>0&&(w==ce||w==null)&&(Q.show=T.show,J5(ce),i==2?(Sa(Q.facets[0].scale,null,null),Sa(Q.facets[1].scale,null,null)):Sa(Q.scale,null,null),wc())}),D!==!1&&Yr("setSeries",w,T),U&&pd("setSeries",r,w,T)}r.setSeries=so;function eE(w,T){Or(E[w],T)}function tE(w,T){w.fill=Mn(w.fill||null),w.dir=Fn(w.dir,-1),T=T??E.length,E.splice(T,0,w)}function nE(w){w==null?E.length=0:E.splice(w,1)}r.addBand=tE,r.setBand=eE,r.delBand=nE;function rE(w,T){_[w].alpha=T,$&&L[w]!=null&&(L[w].style.opacity=T),fe&&Ue[w]&&(Ue[w].style.opacity=T)}let Uo,ka,ml;const Tc={focus:!0};function iE(w){if(w!=ml){let T=w==null,D=tt.alpha!=1;_.forEach((U,Q)=>{if(i==1||Q>0){let ce=T||Q==0||Q==w;U._focus=T?null:ce,D&&rE(Q,ce?1:tt.alpha)}}),ml=w,D&&wc()}}fe&&Vt&&tn(qx,Be,w=>{J._lock||(jt(w),ml!=null&&so(null,Tc,!0,Cr.setSeries))});function oo(w,T,D){let U=S[T];D&&(w=w/Un-(U.ori==1?et:Xe));let Q=me;U.ori==1&&(Q=ve,w=Q-w),U.dir==-1&&(w=Q-w);let ce=U._min,Fe=U._max,Ke=w/Q,it=ce+(Fe-ce)*Ke,yt=U.distr;return yt==3?Vu(10,it):yt==4?z6(it,U.asinh):yt==100?U.bwd(it):it}function sE(w,T){let D=oo(w,M,T);return Bs(D,e[0],rt,$e)}r.valToIdx=w=>Bs(w,e[0]),r.posToIdx=sE,r.posToVal=oo,r.valToPos=(w,T,D)=>S[T].ori==0?s(w,S[T],D?gt:me,D?pt:0):o(w,S[T],D?nn:ve,D?Le:0),r.setCursor=(w,T,D)=>{or=w.left,gr=w.top,vl(null,T,D)};function nw(w,T){ur(Mc,Nc,ar.left=w),ur(Mc,Hd,ar.width=T)}function rw(w,T){ur(Mc,kd,ar.top=w),ur(Mc,Vd,ar.height=T)}let dd=R.ori==0?nw:rw,fd=R.ori==1?nw:rw;function oE(){if(fe&&W.live)for(let w=i==2?1:0;w<_.length;w++){if(w==0&&Ee)continue;let T=W.values[w],D=0;for(let U in T)ke[w][D++].firstChild.nodeValue=T[U]}}function h0(w,T){if(w!=null&&(w.idxs?w.idxs.forEach((D,U)=>{q[U]=D}):B6(w.idx)||q.fill(w.idx),W.idx=q[0]),fe&&W.live){for(let D=0;D<_.length;D++)(D>0||i==1&&!Ee)&&aE(D,q[D]);oE()}le=!1,T!==!1&&Yr("setLegend")}r.setLegend=h0;function aE(w,T){let D=_[w],U=w==0&&N==2?At:e[w],Q;Ee?Q=D.values(r,w,T)??Ve:(Q=D.value(r,T==null?null:U[T],w,T),Q=Q==null?Ve:{_:Q}),W.values[w]=Q}function vl(w,T,D){ew=or,tw=gr,[or,gr]=J.move(r,or,gr),J.left=or,J.top=gr,$&&(xc&&uo(xc,Fr(or),0,me,ve),_c&&uo(_c,0,Fr(gr),me,ve));let U,Q=rt>$e;Uo=rr,ka=null;let ce=R.ori==0?me:ve,Fe=R.ori==1?me:ve;if(or<0||mt==0||Q){U=J.idx=null;for(let Ke=0;Ke<_.length;Ke++){let it=L[Ke];it!=null&&uo(it,-10,-10,me,ve)}Vt&&so(null,Tc,!0,w==null&&Cr.setSeries),W.live&&(q.fill(U),le=!0)}else{let Ke,it,yt;i==1&&(Ke=R.ori==0?or:gr,it=oo(Ke,M),U=J.idx=Bs(it,e[0],rt,$e),yt=B(e[0][U],R,ce,0));let kt=-10,Nt=-10,cn=0,jn=0,Dn=!0,Sn="",Xt="";for(let Wt=i==2?1:0;Wt<_.length;Wt++){let lr=_[Wt],yr=q[Wt],Kr=yr==null?null:i==1?e[Wt][yr]:e[Wt][1][yr],Jn=J.dataIdx(r,Wt,U,it),wr=Jn==null?null:i==1?e[Wt][Jn]:e[Wt][1][Jn];if(le=le||wr!=Kr||Jn!=yr,q[Wt]=Jn,Wt>0&&lr.show){let Wi=Jn==null?-10:Jn==U?yt:B(i==1?e[0][Jn]:e[Wt][0][Jn],R,ce,0),bi=wr==null?-10:z(wr,i==1?S[lr.scale]:S[lr.facets[1].scale],Fe,0);if(Vt&&wr!=null){let cs=R.ori==1?or:gr,Rs=Br(tt.dist(r,Wt,Jn,bi,cs));if(Rs<Uo){let ao=tt.bias;if(ao!=0){let qi=oo(cs,lr.scale),us=wr>=0?1:-1,Ns=qi>=0?1:-1;Ns==us&&(Ns==1?ao==1?wr>=qi:wr<=qi:ao==1?wr<=qi:wr>=qi)&&(Uo=Rs,ka=Wt)}else Uo=Rs,ka=Wt}}if(le||In){let cs,Rs;R.ori==0?(cs=Wi,Rs=bi):(cs=bi,Rs=Wi);let ao,qi,us,Ns,lo,yi,Hi=!0,bl=nt.bbox;if(bl!=null){Hi=!1;let wi=bl(r,Wt);us=wi.left,Ns=wi.top,ao=wi.width,qi=wi.height}else us=cs,Ns=Rs,ao=qi=nt.size(r,Wt);if(yi=nt.fill(r,Wt),lo=nt.stroke(r,Wt),In)Wt==ka&&Uo<=tt.prox&&(kt=us,Nt=Ns,cn=ao,jn=qi,Dn=Hi,Sn=yi,Xt=lo);else{let wi=L[Wt];wi!=null&&(ie[Wt]=us,Te[Wt]=Ns,Xx(wi,ao,qi,Hi),Yx(wi,yi,lo),uo(wi,xs(us),xs(Ns),me,ve))}}}}if(In){let Wt=tt.prox,lr=ml==null?Uo<=Wt:Uo>Wt||ka!=ml;if(le||lr){let yr=L[0];yr!=null&&(ie[0]=kt,Te[0]=Nt,Xx(yr,cn,jn,Dn),Yx(yr,Sn,Xt),uo(yr,xs(kt),xs(Nt),me,ve))}}}if(ar.show&&_a)if(w!=null){let[Ke,it]=Cr.scales,[yt,kt]=Cr.match,[Nt,cn]=w.cursor.sync.scales,jn=w.cursor.drag;if($r=jn._x,Gr=jn._y,$r||Gr){let{left:Dn,top:Sn,width:Xt,height:Wt}=w.select,lr=w.scales[Nt].ori,yr=w.posToVal,Kr,Jn,wr,Wi,bi,cs=Ke!=null&&yt(Ke,Nt),Rs=it!=null&&kt(it,cn);cs&&$r?(lr==0?(Kr=Dn,Jn=Xt):(Kr=Sn,Jn=Wt),wr=S[Ke],Wi=B(yr(Kr,Nt),wr,ce,0),bi=B(yr(Kr+Jn,Nt),wr,ce,0),dd(qs(Wi,bi),Br(bi-Wi))):dd(0,ce),Rs&&Gr?(lr==1?(Kr=Dn,Jn=Xt):(Kr=Sn,Jn=Wt),wr=S[it],Wi=z(yr(Kr,cn),wr,Fe,0),bi=z(yr(Kr+Jn,cn),wr,Fe,0),fd(qs(Wi,bi),Br(bi-Wi))):fd(0,Fe)}else m0()}else{let Ke=Br(ew-Qy),it=Br(tw-Jy);if(R.ori==1){let cn=Ke;Ke=it,it=cn}$r=ii.x&&Ke>=ii.dist,Gr=ii.y&&it>=ii.dist;let yt=ii.uni;yt!=null?$r&&Gr&&($r=Ke>=yt,Gr=it>=yt,!$r&&!Gr&&(it>Ke?Gr=!0:$r=!0)):ii.x&&ii.y&&($r||Gr)&&($r=Gr=!0);let kt,Nt;$r&&(R.ori==0?(kt=Sc,Nt=or):(kt=kc,Nt=gr),dd(qs(kt,Nt),Br(Nt-kt)),Gr||fd(0,Fe)),Gr&&(R.ori==1?(kt=Sc,Nt=or):(kt=kc,Nt=gr),fd(qs(kt,Nt),Br(Nt-kt)),$r||dd(0,ce)),!$r&&!Gr&&(dd(0,0),fd(0,0))}if(ii._x=$r,ii._y=Gr,w==null){if(D){if(pw!=null){let[Ke,it]=Cr.scales;Cr.values[0]=Ke!=null?oo(R.ori==0?or:gr,Ke):null,Cr.values[1]=it!=null?oo(R.ori==1?or:gr,it):null}pd(z0,r,or,gr,me,ve,U)}if(Vt){let Ke=D&&Cr.setSeries,it=tt.prox;ml==null?Uo<=it&&so(ka,Tc,!0,Ke):Uo>it?so(null,Tc,!0,Ke):ka!=ml&&so(ka,Tc,!0,Ke)}}le&&(W.idx=U,h0()),T!==!1&&Yr("setCursor")}let Ma=null;Object.defineProperty(r,"rect",{get(){return Ma==null&&hd(!1),Ma}});function hd(w=!1){w?Ma=null:(Ma=g.getBoundingClientRect(),Yr("syncRect",Ma))}function iw(w,T,D,U,Q,ce,Fe){J._lock||_a&&w!=null&&w.movementX==0&&w.movementY==0||(p0(w,T,D,U,Q,ce,Fe,!1,w!=null),w!=null?vl(null,!0,!0):vl(T,!0,!1))}function p0(w,T,D,U,Q,ce,Fe,Ke,it){if(Ma==null&&hd(!1),jt(w),w!=null)D=w.clientX-Ma.left,U=w.clientY-Ma.top;else{if(D<0||U<0){or=-10,gr=-10;return}let[yt,kt]=Cr.scales,Nt=T.cursor.sync,[cn,jn]=Nt.values,[Dn,Sn]=Nt.scales,[Xt,Wt]=Cr.match,lr=T.axes[0].side%2==1,yr=R.ori==0?me:ve,Kr=R.ori==1?me:ve,Jn=lr?ce:Q,wr=lr?Q:ce,Wi=lr?U:D,bi=lr?D:U;if(Dn!=null?D=Xt(yt,Dn)?a(cn,S[yt],yr,0):-10:D=yr*(Wi/Jn),Sn!=null?U=Wt(kt,Sn)?a(jn,S[kt],Kr,0):-10:U=Kr*(bi/wr),R.ori==1){let cs=D;D=U,U=cs}}it&&(T==null||T.cursor.event.type==z0)&&((D<=1||D>=me-1)&&(D=Ml(D,me)),(U<=1||U>=ve-1)&&(U=Ml(U,ve))),Ke?(Qy=D,Jy=U,[Sc,kc]=J.move(r,D,U)):(or=D,gr=U)}const g0={width:0,height:0,left:0,top:0};function m0(){hp(g0,!1)}let sw,ow,aw,lw;function cw(w,T,D,U,Q,ce,Fe){_a=!0,$r=Gr=ii._x=ii._y=!1,p0(w,T,D,U,Q,ce,Fe,!0,!1),w!=null&&(tn(L0,Sb,uw,!1),pd(Ux,r,Sc,kc,me,ve,null));let{left:Ke,top:it,width:yt,height:kt}=ar;sw=Ke,ow=it,aw=yt,lw=kt}function uw(w,T,D,U,Q,ce,Fe){_a=ii._x=ii._y=!1,p0(w,T,D,U,Q,ce,Fe,!1,!0);let{left:Ke,top:it,width:yt,height:kt}=ar,Nt=yt>0||kt>0,cn=sw!=Ke||ow!=it||aw!=yt||lw!=kt;if(Nt&&cn&&hp(ar),ii.setScale&&Nt&&cn){let jn=Ke,Dn=yt,Sn=it,Xt=kt;if(R.ori==1&&(jn=it,Dn=kt,Sn=Ke,Xt=yt),$r&&Sa(M,oo(jn,M),oo(jn+Dn,M)),Gr)for(let Wt in S){let lr=S[Wt];Wt!=M&&lr.from==null&&lr.min!=rr&&Sa(Wt,oo(Sn+Xt,Wt),oo(Sn,Wt))}m0()}else J.lock&&(J._lock=!J._lock,vl(T,!0,w!=null));w!=null&&(Qn(L0,Sb),pd(L0,r,or,gr,me,ve,null))}function lE(w,T,D,U,Q,ce,Fe){if(J._lock)return;jt(w);let Ke=_a;if(_a){let it=!0,yt=!0,kt=10,Nt,cn;R.ori==0?(Nt=$r,cn=Gr):(Nt=Gr,cn=$r),Nt&&cn&&(it=or<=kt||or>=me-kt,yt=gr<=kt||gr>=ve-kt),Nt&&it&&(or=or<Sc?0:me),cn&&yt&&(gr=gr<kc?0:ve),vl(null,!0,!0),_a=!1}or=-10,gr=-10,q.fill(null),vl(null,!0,!0),Ke&&(_a=Ke)}function dw(w,T,D,U,Q,ce,Fe){J._lock||(jt(w),Kt(),m0(),w!=null&&pd(Hx,r,or,gr,me,ve,null))}function fw(){k.forEach(tD),Pe(r.width,r.height,!0)}Jl(qg,su,fw);const Ec={};Ec.mousedown=cw,Ec.mousemove=iw,Ec.mouseup=uw,Ec.dblclick=dw,Ec.setSeries=(w,T,D,U)=>{let Q=Cr.match[2];D=Q(r,T,D),D!=-1&&so(D,U,!0,!1)},$&&(tn(Ux,g,cw),tn(z0,g,iw),tn(Wx,g,w=>{jt(w),hd(!1)}),tn(qx,g,lE),tn(Hx,g,dw),Ob.add(r),r.syncRect=hd);const pp=r.hooks=t.hooks||{};function Yr(w,T,D){vi?jo.push([w,T,D]):w in pp&&pp[w].forEach(U=>{U.call(null,r,T,D)})}(t.plugins||[]).forEach(w=>{for(let T in w.hooks)pp[T]=(pp[T]||[]).concat(w.hooks[T])});const hw=(w,T,D)=>D,Cr=Or({key:null,setSeries:!1,filters:{pub:t_,sub:t_},scales:[M,_[1]?_[1].scale:null],match:[n_,n_,hw],values:[null,null]},J.sync);Cr.match.length==2&&Cr.match.push(hw),J.sync=Cr;const pw=Cr.key,v0=yT(pw);function pd(w,T,D,U,Q,ce,Fe){Cr.filters.pub(w,T,D,U,Q,ce,Fe)&&v0.pub(w,T,D,U,Q,ce,Fe)}v0.sub(r);function cE(w,T,D,U,Q,ce,Fe){Cr.filters.sub(w,T,D,U,Q,ce,Fe)&&Ec[w](null,T,D,U,Q,ce,Fe)}r.pub=cE;function uE(){v0.unsub(r),Ob.delete(r),en.clear(),Tb(qg,su,fw),c.remove(),Be==null||Be.remove(),Yr("destroy")}r.destroy=uE;function b0(){Yr("init",t,e),Pt(e||t.data,!1),H[M]?u0(M,H[M]):Kt(),he=ar.show&&(ar.width>0||ar.height>0),ae=le=!0,Pe(t.width,t.height)}return _.forEach(rn),k.forEach(bt),n?n instanceof HTMLElement?(n.appendChild(c),b0()):n(r,b0):b0(),r}hi.assign=Or;hi.fmtNum=ay;hi.rangeNum=Hg;hi.rangeLog=Zm;hi.rangeAsinh=sy;hi.orient=bc;hi.pxRatio=Un;hi.join=$6;hi.fmtDate=cy,hi.tzDate=rL;hi.sync=yT;{hi.addGap=BL,hi.clipGaps=e0;let t=hi.paths={points:MT};t.linear=ET,t.stepped=WL,t.bars=qL,t.spline=VL}function my(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var yc=my();function OT(t){yc=t}var Ol={exec:()=>null};function Ic(t){let e=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=e[r];return i||(i=t(r),e[r]=i),i}}function Nn(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(fi.caret,"$1"),n=n.replace(i,o),r},getRegex:()=>new RegExp(n,e)};return r}var nD=((t="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+t)}catch{return!1}})(),fi={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Ic(t=>new RegExp(`^ {0,${t}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Ic(t=>new RegExp(`^ {0,${t}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Ic(t=>new RegExp(`^ {0,${t}}(?:\`\`\`|~~~)`)),headingBeginRegex:Ic(t=>new RegExp(`^ {0,${t}}#`)),htmlBeginRegex:Ic(t=>new RegExp(`^ {0,${t}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Ic(t=>new RegExp(`^ {0,${t}}>`))},rD=/^(?:[ \t]*(?:\n|$))+/,iD=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,sD=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,dp=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,oD=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,vy=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,RT=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,NT=Nn(RT).replace(/bull/g,vy).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),aD=Nn(RT).replace(/bull/g,vy).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),by=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,lD=/^[^\n]+/,yy=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,cD=Nn(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",yy).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),uD=Nn(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,vy).getRegex(),i0="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",wy=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,dD=Nn("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",wy).replace("tag",i0).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),IT=Nn(by).replace("hr",dp).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",i0).getRegex(),fD=Nn(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",IT).getRegex(),xy={blockquote:fD,code:iD,def:cD,fences:sD,heading:oD,hr:dp,html:dD,lheading:NT,list:uD,newline:rD,paragraph:IT,table:Ol,text:lD},k_=Nn("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",dp).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",i0).getRegex(),hD={...xy,lheading:aD,table:k_,paragraph:Nn(by).replace("hr",dp).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",k_).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",i0).getRegex()},pD={...xy,html:Nn(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",wy).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ol,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Nn(by).replace("hr",dp).replace("heading",` *#{1,6} *[^
]`).replace("lheading",NT).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},gD=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,mD=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,zT=/^( {2,}|\\)\n(?!\s*$)/,vD=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ud=/[\p{P}\p{S}]/u,s0=/[\s\p{P}\p{S}]/u,_y=/[^\s\p{P}\p{S}]/u,bD=Nn(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,s0).getRegex(),LT=/(?!~)[\p{P}\p{S}]/u,yD=/(?!~)[\s\p{P}\p{S}]/u,wD=/(?:[^\s\p{P}\p{S}]|~)/u,xD=Nn(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",nD?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),DT=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,_D=Nn(DT,"u").replace(/punct/g,ud).getRegex(),SD=Nn(DT,"u").replace(/punct/g,LT).getRegex(),FT="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",kD=Nn(FT,"gu").replace(/notPunctSpace/g,_y).replace(/punctSpace/g,s0).replace(/punct/g,ud).getRegex(),MD=Nn(FT,"gu").replace(/notPunctSpace/g,wD).replace(/punctSpace/g,yD).replace(/punct/g,LT).getRegex(),TD=Nn("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,_y).replace(/punctSpace/g,s0).replace(/punct/g,ud).getRegex(),ED=Nn(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,ud).getRegex(),AD="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",PD=Nn(AD,"gu").replace(/notPunctSpace/g,_y).replace(/punctSpace/g,s0).replace(/punct/g,ud).getRegex(),CD=Nn(/\\(punct)/,"gu").replace(/punct/g,ud).getRegex(),OD=Nn(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),RD=Nn(wy).replace("(?:-->|$)","-->").getRegex(),ND=Nn("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",RD).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),$g=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,ID=Nn(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",$g).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),BT=Nn(/^!?\[(label)\]\[(ref)\]/).replace("label",$g).replace("ref",yy).getRegex(),jT=Nn(/^!?\[(ref)\](?:\[\])?/).replace("ref",yy).getRegex(),zD=Nn("reflink|nolink(?!\\()","g").replace("reflink",BT).replace("nolink",jT).getRegex(),M_=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Sy={_backpedal:Ol,anyPunctuation:CD,autolink:OD,blockSkip:xD,br:zT,code:mD,del:Ol,delLDelim:Ol,delRDelim:Ol,emStrongLDelim:_D,emStrongRDelimAst:kD,emStrongRDelimUnd:TD,escape:gD,link:ID,nolink:jT,punctuation:bD,reflink:BT,reflinkSearch:zD,tag:ND,text:vD,url:Ol},LD={...Sy,link:Nn(/^!?\[(label)\]\((.*?)\)/).replace("label",$g).getRegex(),reflink:Nn(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",$g).getRegex()},Nb={...Sy,emStrongRDelimAst:MD,emStrongLDelim:SD,delLDelim:ED,delRDelim:PD,url:Nn(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",M_).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Nn(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",M_).getRegex()},DD={...Nb,br:Nn(zT).replace("{2,}","*").getRegex(),text:Nn(Nb.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Op={normal:xy,gfm:hD,pedantic:pD},Td={normal:Sy,gfm:Nb,breaks:DD,pedantic:LD},FD={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},T_=t=>FD[t];function mo(t,e){if(e){if(fi.escapeTest.test(t))return t.replace(fi.escapeReplace,T_)}else if(fi.escapeTestNoEncode.test(t))return t.replace(fi.escapeReplaceNoEncode,T_);return t}function E_(t){try{t=encodeURI(t).replace(fi.percentDecode,"%")}catch{return null}return t}function A_(t,e){var s;let n=t.replace(fi.findPipe,(o,a,l)=>{let c=!1,u=a;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),r=n.split(fi.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!((s=r.at(-1))!=null&&s.trim())&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(fi.slashPipe,"|");return r}function Aa(t,e,n){let r=t.length;if(r===0)return"";let i=0;for(;i<r&&t.charAt(r-i-1)===e;)i++;return t.slice(0,r-i)}function P_(t){let e=t.split(`
`),n=e.length-1;for(;n>=0&&fi.blankLine.test(e[n]);)n--;return e.length-n<=2?t:e.slice(0,n+1).join(`
`)}function BD(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let r=0;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&(n--,n<0))return r;return n>0?-2:-1}function jD(t,e=0){let n=e,r="";for(let i of t)if(i===" "){let s=4-n%4;r+=" ".repeat(s),n+=s}else r+=i,n++;return r}function C_(t,e,n,r,i){let s=e.href,o=e.title||null,a=t[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let l={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:s,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,l}function UD(t,e,n){let r=t.match(n.other.indentCodeCompensation);if(r===null)return e;let i=r[1];return e.split(`
`).map(s=>{let o=s.match(n.other.beginningSpace);if(o===null)return s;let[a]=o;return a.length>=i.length?s.slice(i.length):s}).join(`
`)}var Gg=class{constructor(t){we(this,"options");we(this,"rules");we(this,"lexer");this.options=t||yc}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let n=this.options.pedantic?e[0]:P_(e[0]),r=n.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n,codeBlockStyle:"indented",text:r}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],r=UD(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){let r=Aa(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:Aa(e[0],`
`),depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:Aa(e[0],`
`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=Aa(e[0],`
`).split(`
`),r="",i="",s=[];for(;n.length>0;){let o=!1,a=[],l;for(l=0;l<n.length;l++)if(this.rules.other.blockquoteStart.test(n[l]))a.push(n[l]),o=!0;else if(!o)a.push(n[l]);else break;n=n.slice(l);let c=a.join(`
`),u=c.replace(this.rules.other.blockquoteSetextReplace,`
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
${c}`:c,i=i?`${i}
${u}`:u;let f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,s,!0),this.lexer.state.top=f,n.length===0)break;let h=s.at(-1);if((h==null?void 0:h.type)==="code")break;if((h==null?void 0:h.type)==="blockquote"){let p=h,g=p.raw+`
`+n.join(`
`),m=this.blockquote(g);s[s.length-1]=m,r=r.substring(0,r.length-p.raw.length)+m.raw,i=i.substring(0,i.length-p.text.length)+m.text;break}else if((h==null?void 0:h.type)==="list"){let p=h,g=p.raw+`
`+n.join(`
`),m=this.list(g);s[s.length-1]=m,r=r.substring(0,r.length-h.raw.length)+m.raw,i=i.substring(0,i.length-p.raw.length)+m.raw,n=g.substring(s.at(-1).raw.length).split(`
`);continue}}return{type:"blockquote",raw:r,tokens:s,text:i}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=e[1].trim(),r=n.length>1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let s=this.rules.other.listItemRegex(n),o=!1;for(;t;){let l=!1,c="",u="";if(!(e=s.exec(t))||this.rules.block.hr.test(t))break;c=e[0],t=t.substring(c.length);let f=jD(e[2].split(`
`,1)[0],e[1].length),h=t.split(`
`,1)[0],p=!f.trim(),g=0;if(this.options.pedantic?(g=2,u=f.trimStart()):p?g=e[1].length+1:(g=f.search(this.rules.other.nonSpaceChar),g=g>4?1:g,u=f.slice(g),g+=e[1].length),p&&this.rules.other.blankLine.test(h)&&(c+=h+`
`,t=t.substring(h.length+1),l=!0),!l){let m=this.rules.other.nextBulletRegex(g),b=this.rules.other.hrRegex(g),y=this.rules.other.fencesBeginRegex(g),_=this.rules.other.headingBeginRegex(g),k=this.rules.other.htmlBeginRegex(g),S=this.rules.other.blockquoteBeginRegex(g);for(;t;){let E=t.split(`
`,1)[0],M;if(h=E,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),M=h):M=h.replace(this.rules.other.tabCharGlobal," "),y.test(h)||_.test(h)||k.test(h)||S.test(h)||m.test(h)||b.test(h))break;if(M.search(this.rules.other.nonSpaceChar)>=g||!h.trim())u+=`
`+M.slice(g);else{if(p||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||y.test(f)||_.test(f)||b.test(f))break;u+=`
`+h}p=!h.trim(),c+=E+`
`,t=t.substring(E.length+1),f=M.slice(g)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(o=!0)),i.items.push({type:"list_item",raw:c,task:!!this.options.gfm&&this.rules.other.listIsTask.test(u),loose:!1,text:u,tokens:[]}),i.raw+=c}let a=i.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let l of i.items){this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]);let c=l.tokens[0];if(l.task&&((c==null?void 0:c.type)==="text"||(c==null?void 0:c.type)==="paragraph")){l.text=l.text.replace(this.rules.other.listReplaceTask,""),c.raw=c.raw.replace(this.rules.other.listReplaceTask,""),c.text=c.text.replace(this.rules.other.listReplaceTask,"");for(let f=this.lexer.inlineQueue.length-1;f>=0;f--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[f].src)){this.lexer.inlineQueue[f].src=this.lexer.inlineQueue[f].src.replace(this.rules.other.listReplaceTask,"");break}let u=this.rules.other.listTaskCheckbox.exec(l.raw);if(u){let f={type:"checkbox",raw:u[0]+" ",checked:u[0]!=="[ ]"};l.checked=f.checked,i.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=f.raw+l.tokens[0].raw,l.tokens[0].text=f.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(f)):l.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):l.tokens.unshift(f)}}else l.task&&(l.task=!1);if(!i.loose){let u=l.tokens.filter(h=>h.type==="space"),f=u.length>0&&u.some(h=>this.rules.other.anyLine.test(h.raw));i.loose=f}}if(i.loose)for(let l of i.items){l.loose=!0;for(let c of l.tokens)c.type==="text"&&(c.type="paragraph")}return i}}html(t){let e=this.rules.block.html.exec(t);if(e){let n=P_(e[0]);return{type:"html",block:!0,raw:n,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:n}}}def(t){let e=this.rules.block.def.exec(t);if(e){let n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:Aa(e[0],`
`),href:r,title:i}}}table(t){var o;let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let n=A_(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
`):[],s={type:"table",raw:Aa(e[0],`
`),header:[],align:[],rows:[]};if(n.length===r.length){for(let a of r)this.rules.other.tableAlignRight.test(a)?s.align.push("right"):this.rules.other.tableAlignCenter.test(a)?s.align.push("center"):this.rules.other.tableAlignLeft.test(a)?s.align.push("left"):s.align.push(null);for(let a=0;a<n.length;a++)s.header.push({text:n[a],tokens:this.lexer.inline(n[a]),header:!0,align:s.align[a]});for(let a of i)s.rows.push(A_(a,s.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:s.align[c]})));return s}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let n=e[1].trim();return{type:"heading",raw:Aa(e[0],`
`),depth:e[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let n=e[1].charAt(e[1].length-1)===`
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let s=Aa(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{let s=BD(e[2],"()");if(s===-2)return;if(s>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let r=e[2],i="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],i=s[3])}else i=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),C_(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[r.toLowerCase()];if(!i){let s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return C_(n,i,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let r=this.rules.inline.emStrongLDelim.exec(t);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,s,o,a=i,l=0,c=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*t.length+i);(r=c.exec(e))!==null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(o=[...s].length,r[3]||r[4]){a+=o;continue}else if((r[5]||r[6])&&i%3&&!((i+o)%3)){l+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let u=[...r[0]][0].length,f=t.slice(0,i+r.index+u+o);if(Math.min(i,o)%2){let p=f.slice(1,-1);return{type:"em",raw:f,text:p,tokens:this.lexer.inlineTokens(p)}}let h=f.slice(2,-2);return{type:"strong",raw:f,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,n=""){let r=this.rules.inline.delLDelim.exec(t);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,s,o,a=i,l=this.rules.inline.delRDelim;for(l.lastIndex=0,e=e.slice(-1*t.length+i);(r=l.exec(e))!==null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s||(o=[...s].length,o!==i))continue;if(r[3]||r[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let c=[...r[0]][0].length,u=t.slice(0,i+r.index+c+o),f=u.slice(i,-i);return{type:"del",raw:u,text:f,tokens:this.lexer.inlineTokens(f)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let n,r;return e[2]==="@"?(n=e[1],r="mailto:"+n):(n=e[1],r=n),{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(t){var n;let e;if(e=this.rules.inline.url.exec(t)){let r,i;if(e[2]==="@")r=e[0],i="mailto:"+r;else{let s;do s=e[0],e[0]=((n=this.rules.inline._backpedal.exec(e[0]))==null?void 0:n[0])??"";while(s!==e[0]);r=e[0],e[1]==="www."?i="http://"+e[0]:i=e[0]}return{type:"link",raw:e[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},js=class Ib{constructor(e){we(this,"tokens");we(this,"options");we(this,"state");we(this,"inlineQueue");we(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||yc,this.options.tokenizer=this.options.tokenizer||new Gg,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:fi,block:Op.normal,inline:Td.normal};this.options.pedantic?(n.block=Op.pedantic,n.inline=Td.pedantic):this.options.gfm&&(n.block=Op.gfm,this.options.breaks?n.inline=Td.breaks:n.inline=Td.gfm),this.tokenizer.rules=n}static get rules(){return{block:Op,inline:Td}}static lex(e,n){return new Ib(n).lex(e)}static lexInline(e,n){return new Ib(n).inlineTokens(e)}lex(e){e=e.replace(fi.carriageReturn,`
`),this.blockTokens(e,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],r=!1){var s,o,a;this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(fi.tabCharGlobal," ").replace(fi.spaceLine,""));let i=1/0;for(;e;){if(e.length<i)i=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let l;if((o=(s=this.options.extensions)==null?void 0:s.block)!=null&&o.some(u=>(l=u.call({lexer:this},e,n))?(e=e.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.space(e)){e=e.substring(l.raw.length);let u=n.at(-1);l.raw.length===1&&u!==void 0?u.raw+=`
`:n.push(l);continue}if(l=this.tokenizer.code(e)){e=e.substring(l.raw.length);let u=n.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
`)?"":`
`)+l.raw,u.text+=`
`+l.text,this.inlineQueue.at(-1).src=u.text):n.push(l);continue}if(l=this.tokenizer.fences(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.heading(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.hr(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.blockquote(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.list(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.html(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.def(e)){e=e.substring(l.raw.length);let u=n.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
`)?"":`
`)+l.raw,u.text+=`
`+l.raw,this.inlineQueue.at(-1).src=u.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title},n.push(l));continue}if(l=this.tokenizer.table(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.lheading(e)){e=e.substring(l.raw.length),n.push(l);continue}let c=e;if((a=this.options.extensions)!=null&&a.startBlock){let u=1/0,f=e.slice(1),h;this.options.extensions.startBlock.forEach(p=>{h=p.call({lexer:this},f),typeof h=="number"&&h>=0&&(u=Math.min(u,h))}),u<1/0&&u>=0&&(c=e.substring(0,u+1))}if(this.state.top&&(l=this.tokenizer.paragraph(c))){let u=n.at(-1);r&&(u==null?void 0:u.type)==="paragraph"?(u.raw+=(u.raw.endsWith(`
`)?"":`
`)+l.raw,u.text+=`
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):n.push(l),r=c.length!==e.length,e=e.substring(l.raw.length);continue}if(l=this.tokenizer.text(e)){e=e.substring(l.raw.length);let u=n.at(-1);(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
`)?"":`
`)+l.raw,u.text+=`
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):n.push(l);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){var c,u,f,h,p;this.tokenizer.lexer=this;let r=e,i=null;if(this.tokens.links){let g=Object.keys(this.tokens.links);if(g.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!==null;)g.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(r))!==null;)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(r))!==null;)s=i[2]?i[2].length:0,r=r.slice(0,i.index+s)+"["+"a".repeat(i[0].length-s-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=((u=(c=this.options.hooks)==null?void 0:c.emStrongMask)==null?void 0:u.call({lexer:this},r))??r;let o=!1,a="",l=1/0;for(;e;){if(e.length<l)l=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}o||(a=""),o=!1;let g;if((h=(f=this.options.extensions)==null?void 0:f.inline)!=null&&h.some(b=>(g=b.call({lexer:this},e,n))?(e=e.substring(g.raw.length),n.push(g),!0):!1))continue;if(g=this.tokenizer.escape(e)){e=e.substring(g.raw.length),n.push(g);continue}if(g=this.tokenizer.tag(e)){e=e.substring(g.raw.length),n.push(g);continue}if(g=this.tokenizer.link(e)){e=e.substring(g.raw.length),n.push(g);continue}if(g=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(g.raw.length);let b=n.at(-1);g.type==="text"&&(b==null?void 0:b.type)==="text"?(b.raw+=g.raw,b.text+=g.text):n.push(g);continue}if(g=this.tokenizer.emStrong(e,r,a)){e=e.substring(g.raw.length),n.push(g);continue}if(g=this.tokenizer.codespan(e)){e=e.substring(g.raw.length),n.push(g);continue}if(g=this.tokenizer.br(e)){e=e.substring(g.raw.length),n.push(g);continue}if(g=this.tokenizer.del(e,r,a)){e=e.substring(g.raw.length),n.push(g);continue}if(g=this.tokenizer.autolink(e)){e=e.substring(g.raw.length),n.push(g);continue}if(!this.state.inLink&&(g=this.tokenizer.url(e))){e=e.substring(g.raw.length),n.push(g);continue}let m=e;if((p=this.options.extensions)!=null&&p.startInline){let b=1/0,y=e.slice(1),_;this.options.extensions.startInline.forEach(k=>{_=k.call({lexer:this},y),typeof _=="number"&&_>=0&&(b=Math.min(b,_))}),b<1/0&&b>=0&&(m=e.substring(0,b+1))}if(g=this.tokenizer.inlineText(m)){e=e.substring(g.raw.length),g.raw.slice(-1)!=="_"&&(a=g.raw.slice(-1)),o=!0;let b=n.at(-1);(b==null?void 0:b.type)==="text"?(b.raw+=g.raw,b.text+=g.text):n.push(g);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return n}infiniteLoopError(e){let n="Infinite loop on byte: "+e;if(this.options.silent)console.error(n);else throw new Error(n)}},Yg=class{constructor(e){we(this,"options");we(this,"parser");this.options=e||yc}space(e){return""}code({text:e,lang:n,escaped:r}){var o;let i=(o=(n||"").match(fi.notSpaceStart))==null?void 0:o[0],s=e.replace(fi.endingNewline,"")+`
`;return i?'<pre><code class="language-'+mo(i)+'">'+(r?s:mo(s,!0))+`</code></pre>
`:"<pre><code>"+(r?s:mo(s,!0))+`</code></pre>
`}blockquote({tokens:e}){return`<blockquote>
${this.parser.parse(e)}</blockquote>
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:n}){return`<h${n}>${this.parser.parseInline(e)}</h${n}>
`}hr(e){return`<hr>
`}list(e){let n=e.ordered,r=e.start,i="";for(let a=0;a<e.items.length;a++){let l=e.items[a];i+=this.listitem(l)}let s=n?"ol":"ul",o=n&&r!==1?' start="'+r+'"':"";return"<"+s+o+`>
`+i+"</"+s+`>
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
`}table(e){let n="",r="";for(let s=0;s<e.header.length;s++)r+=this.tablecell(e.header[s]);n+=this.tablerow({text:r});let i="";for(let s=0;s<e.rows.length;s++){let o=e.rows[s];r="";for(let a=0;a<o.length;a++)r+=this.tablecell(o[a]);i+=this.tablerow({text:r})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
<thead>
`+n+`</thead>
`+i+`</table>
`}tablerow({text:e}){return`<tr>
${e}</tr>
`}tablecell(e){let n=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+n+`</${r}>
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${mo(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:n,tokens:r}){let i=this.parser.parseInline(r),s=E_(e);if(s===null)return i;e=s;let o='<a href="'+e+'"';return n&&(o+=' title="'+mo(n)+'"'),o+=">"+i+"</a>",o}image({href:e,title:n,text:r,tokens:i}){i&&(r=this.parser.parseInline(i,this.parser.textRenderer));let s=E_(e);if(s===null)return mo(r);e=s;let o=`<img src="${e}" alt="${mo(r)}"`;return n&&(o+=` title="${mo(n)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:mo(e.text)}},ky=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},Us=class zb{constructor(e){we(this,"options");we(this,"renderer");we(this,"textRenderer");this.options=e||yc,this.options.renderer=this.options.renderer||new Yg,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ky}static parse(e,n){return new zb(n).parse(e)}static parseInline(e,n){return new zb(n).parseInline(e)}parse(e){var r,i;this.renderer.parser=this;let n="";for(let s=0;s<e.length;s++){let o=e[s];if((i=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&i[o.type]){let l=o,c=this.options.extensions.renderers[l.type].call({parser:this},l);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(l.type)){n+=c||"";continue}}let a=o;switch(a.type){case"space":{n+=this.renderer.space(a);break}case"hr":{n+=this.renderer.hr(a);break}case"heading":{n+=this.renderer.heading(a);break}case"code":{n+=this.renderer.code(a);break}case"table":{n+=this.renderer.table(a);break}case"blockquote":{n+=this.renderer.blockquote(a);break}case"list":{n+=this.renderer.list(a);break}case"checkbox":{n+=this.renderer.checkbox(a);break}case"html":{n+=this.renderer.html(a);break}case"def":{n+=this.renderer.def(a);break}case"paragraph":{n+=this.renderer.paragraph(a);break}case"text":{n+=this.renderer.text(a);break}default:{let l='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}parseInline(e,n=this.renderer){var i,s;this.renderer.parser=this;let r="";for(let o=0;o<e.length;o++){let a=e[o];if((s=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&s[a.type]){let c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){r+=c||"";continue}}let l=a;switch(l.type){case"escape":{r+=n.text(l);break}case"html":{r+=n.html(l);break}case"link":{r+=n.link(l);break}case"image":{r+=n.image(l);break}case"checkbox":{r+=n.checkbox(l);break}case"strong":{r+=n.strong(l);break}case"em":{r+=n.em(l);break}case"codespan":{r+=n.codespan(l);break}case"br":{r+=n.br(l);break}case"del":{r+=n.del(l);break}case"text":{r+=n.text(l);break}default:{let c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}},Hp,Gd=(Hp=class{constructor(t){we(this,"options");we(this,"block");this.options=t||yc}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(t=this.block){return t?js.lex:js.lexInline}provideParser(t=this.block){return t?Us.parse:Us.parseInline}},we(Hp,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),we(Hp,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Hp),WD=class{constructor(...t){we(this,"defaults",my());we(this,"options",this.setOptions);we(this,"parse",this.parseMarkdown(!0));we(this,"parseInline",this.parseMarkdown(!1));we(this,"Parser",Us);we(this,"Renderer",Yg);we(this,"TextRenderer",ky);we(this,"Lexer",js);we(this,"Tokenizer",Gg);we(this,"Hooks",Gd);this.use(...t)}walkTokens(t,e){var r,i;let n=[];for(let s of t)switch(n=n.concat(e.call(this,s)),s.type){case"table":{let o=s;for(let a of o.header)n=n.concat(this.walkTokens(a.tokens,e));for(let a of o.rows)for(let l of a)n=n.concat(this.walkTokens(l.tokens,e));break}case"list":{let o=s;n=n.concat(this.walkTokens(o.items,e));break}default:{let o=s;(i=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&i[o.type]?this.defaults.extensions.childTokens[o.type].forEach(a=>{let l=o[a].flat(1/0);n=n.concat(this.walkTokens(l,e))}):o.tokens&&(n=n.concat(this.walkTokens(o.tokens,e)))}}return n}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=e.renderers[i.name];s?e.renderers[i.name]=function(...o){let a=i.renderer.apply(this,o);return a===!1&&(a=s.apply(this,o)),a}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=e[i.level];s?s.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),r.extensions=e),n.renderer){let i=this.defaults.renderer||new Yg(this.defaults);for(let s in n.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let o=s,a=n.renderer[o],l=i[o];i[o]=(...c)=>{let u=a.apply(i,c);return u===!1&&(u=l.apply(i,c)),u||""}}r.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new Gg(this.defaults);for(let s in n.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let o=s,a=n.tokenizer[o],l=i[o];i[o]=(...c)=>{let u=a.apply(i,c);return u===!1&&(u=l.apply(i,c)),u}}r.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new Gd;for(let s in n.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let o=s,a=n.hooks[o],l=i[o];Gd.passThroughHooks.has(s)?i[o]=c=>{if(this.defaults.async&&Gd.passThroughHooksRespectAsync.has(s))return(async()=>{let f=await a.call(i,c);return l.call(i,f)})();let u=a.call(i,c);return l.call(i,u)}:i[o]=(...c)=>{if(this.defaults.async)return(async()=>{let f=await a.apply(i,c);return f===!1&&(f=await l.apply(i,c)),f})();let u=a.apply(i,c);return u===!1&&(u=l.apply(i,c)),u}}r.hooks=i}if(n.walkTokens){let i=this.defaults.walkTokens,s=n.walkTokens;r.walkTokens=function(o){let a=[];return a.push(s.call(this,o)),i&&(a=a.concat(i.call(this,o))),a}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return js.lex(t,e??this.defaults)}parser(t,e){return Us.parse(t,e??this.defaults)}parseMarkdown(t){return(e,n)=>{let r={...n},i={...this.defaults,...r},s=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=t),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(e):e,a=await(i.hooks?await i.hooks.provideLexer(t):t?js.lex:js.lexInline)(o,i),l=i.hooks?await i.hooks.processAllTokens(a):a;i.walkTokens&&await Promise.all(this.walkTokens(l,i.walkTokens));let c=await(i.hooks?await i.hooks.provideParser(t):t?Us.parse:Us.parseInline)(l,i);return i.hooks?await i.hooks.postprocess(c):c})().catch(s);try{i.hooks&&(e=i.hooks.preprocess(e));let o=(i.hooks?i.hooks.provideLexer(t):t?js.lex:js.lexInline)(e,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let a=(i.hooks?i.hooks.provideParser(t):t?Us.parse:Us.parseInline)(o,i);return i.hooks&&(a=i.hooks.postprocess(a)),a}catch(o){return s(o)}}}onError(t,e){return n=>{if(n.message+=`
Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error occurred:</p><pre>"+mo(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},ac=new WD;function Wn(t,e){return ac.parse(t,e)}Wn.options=Wn.setOptions=function(t){return ac.setOptions(t),Wn.defaults=ac.defaults,OT(Wn.defaults),Wn};Wn.getDefaults=my;Wn.defaults=yc;Wn.use=function(...t){return ac.use(...t),Wn.defaults=ac.defaults,OT(Wn.defaults),Wn};Wn.walkTokens=function(t,e){return ac.walkTokens(t,e)};Wn.parseInline=ac.parseInline;Wn.Parser=Us;Wn.parser=Us.parse;Wn.Renderer=Yg;Wn.TextRenderer=ky;Wn.Lexer=js;Wn.lexer=js.lex;Wn.Tokenizer=Gg;Wn.Hooks=Gd;Wn.parse=Wn;Wn.options;Wn.setOptions;Wn.use;Wn.walkTokens;Wn.parseInline;Us.parse;js.lex;/*! @license DOMPurify 3.4.11 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.11/LICENSE */function O_(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function qD(t){if(Array.isArray(t))return t}function HD(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(u){c=!0,i=u}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function VD(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $D(t,e){return qD(t)||HD(t,e)||GD(t,e)||VD()}function GD(t,e){if(t){if(typeof t=="string")return O_(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?O_(t,e):void 0}}const UT=Object.entries,R_=Object.setPrototypeOf,YD=Object.isFrozen,KD=Object.getPrototypeOf,XD=Object.getOwnPropertyDescriptor;let ai=Object.freeze,ci=Object.seal,Kc=Object.create,WT=typeof Reflect<"u"&&Reflect,Lb=WT.apply,Db=WT.construct;ai||(ai=function(e){return e});ci||(ci=function(e){return e});Lb||(Lb=function(e,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s];return e.apply(n,i)});Db||(Db=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return new e(...r)});const Ed=zr(Array.prototype.forEach),ZD=zr(Array.prototype.lastIndexOf),N_=zr(Array.prototype.pop),zc=zr(Array.prototype.push),QD=zr(Array.prototype.splice),za=Array.isArray,Yd=zr(String.prototype.toLowerCase),U0=zr(String.prototype.toString),I_=zr(String.prototype.match),Ad=zr(String.prototype.replace),z_=zr(String.prototype.indexOf),JD=zr(String.prototype.trim),e8=zr(Number.prototype.toString),t8=zr(Boolean.prototype.toString),L_=typeof BigInt>"u"?null:zr(BigInt.prototype.toString),D_=typeof Symbol>"u"?null:zr(Symbol.prototype.toString),Xr=zr(Object.prototype.hasOwnProperty),Pd=zr(Object.prototype.toString),si=zr(RegExp.prototype.test),Sl=n8(TypeError);function zr(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return Lb(t,e,r)}}function n8(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return Db(t,n)}}function On(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Yd;if(R_&&R_(t,null),!za(e))return t;let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){const s=n(i);s!==i&&(YD(e)||(e[r]=s),i=s)}t[i]=!0}return t}function r8(t){for(let e=0;e<t.length;e++)Xr(t,e)||(t[e]=null);return t}function xi(t){const e=Kc(null);for(const r of UT(t)){var n=$D(r,2);const i=n[0],s=n[1];Xr(t,i)&&(za(s)?e[i]=r8(s):s&&typeof s=="object"&&s.constructor===Object?e[i]=xi(s):e[i]=s)}return e}function i8(t){switch(typeof t){case"string":return t;case"number":return e8(t);case"boolean":return t8(t);case"bigint":return L_?L_(t):"0";case"symbol":return D_?D_(t):"Symbol()";case"undefined":return Pd(t);case"function":case"object":{if(t===null)return Pd(t);const e=t,n=vo(e,"toString");if(typeof n=="function"){const r=n(e);return typeof r=="string"?r:Pd(r)}return Pd(t)}default:return Pd(t)}}function vo(t,e){for(;t!==null;){const r=XD(t,e);if(r){if(r.get)return zr(r.get);if(typeof r.value=="function")return zr(r.value)}t=KD(t)}function n(){return null}return n}function s8(t){try{return si(t,""),!0}catch{return!1}}const F_=ai(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),W0=ai(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),q0=ai(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),o8=ai(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),H0=ai(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),a8=ai(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),B_=ai(["#text"]),j_=ai(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),V0=ai(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),U_=ai(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Rp=ai(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),l8=ci(/{{[\w\W]*|^[\w\W]*}}/g),c8=ci(/<%[\w\W]*|^[\w\W]*%>/g),u8=ci(/\${[\w\W]*/g),d8=ci(/^data-[\-\w.\u00B7-\uFFFF]+$/),f8=ci(/^aria-[\-\w]+$/),W_=ci(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),h8=ci(/^(?:\w+script|data):/i),p8=ci(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),g8=ci(/^html$/i),m8=ci(/^[a-z][.\w]*(-[.\w]+)+$/i),q_=ci(/<[/\w!]/g),v8=ci(/<[/\w]/g),b8=ci(/<\/no(script|embed|frames)/i),y8=ci(/\/>/i),fo={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},w8=function(){return typeof window>"u"?null:window},x8=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(r=n.getAttribute(i));const s="dompurify"+(r?"#"+r:"");try{return e.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},H_=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Pa=function(e,n,r,i){return Xr(e,n)&&za(e[n])?On(i.base?xi(i.base):{},e[n],i.transform):r};function qT(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:w8();const e=Ye=>qT(Ye);if(e.version="3.4.11",e.removed=[],!t||!t.document||t.document.nodeType!==fo.document||!t.Element)return e.isSupported=!1,e;let n=t.document;const r=n,i=r.currentScript;t.DocumentFragment;const s=t.HTMLTemplateElement,o=t.Node,a=t.Element,l=t.NodeFilter,c=t.NamedNodeMap;c===void 0&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const u=t.DOMParser,f=t.trustedTypes,h=a.prototype,p=vo(h,"cloneNode"),g=vo(h,"remove"),m=vo(h,"nextSibling"),b=vo(h,"childNodes"),y=vo(h,"parentNode"),_=vo(h,"shadowRoot"),k=vo(h,"attributes"),S=o&&o.prototype?vo(o.prototype,"nodeType"):null,E=o&&o.prototype?vo(o.prototype,"nodeName"):null;if(typeof s=="function"){const Ye=n.createElement("template");Ye.content&&Ye.content.ownerDocument&&(n=Ye.content.ownerDocument)}let M,O="",P,x=!1,C=0;const R=function(){if(C>0)throw Sl('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},N=function(F){R(),C++;try{return M.createHTML(F)}finally{C--}},B=function(F){R(),C++;try{return M.createScriptURL(F)}finally{C--}},z=function(){return x||(P=x8(f,i),x=!0),P},H=n,X=H.implementation,G=H.createNodeIterator,Z=H.createDocumentFragment,oe=H.getElementsByTagName,K=r.importNode;let q=H_();e.isSupported=typeof UT=="function"&&typeof y=="function"&&X&&X.createHTMLDocument!==void 0;const W=l8,J=c8,fe=u8,$=d8,de=f8,Be=h8,wt=p8,Je=m8;let Ue=W_,ke=null;const ct=On({},[...F_,...W0,...q0,...H0,...B_]);let Ee=null;const Ve=On({},[...j_,...V0,...U_,...Rp]);let be=Object.seal(Kc(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),xt=null,_t=null;const Yt=Object.seal(Kc(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let en=!0,tn=!0,Qn=!1,se=!0,_e=!1,me=!0,ve=!1,Xe=!1,et=null,dt=null,ge=!1,Ae=!1,Ie=!1,pt=!1,Le=!0,gt=!1;const nn="user-content-";let St=!0,Rt=!1,re={},ae=null;const he=On({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let le=null;const Pe=On({},["audio","video","img","source","image","track"]);let Oe=null;const Re=On({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ce="http://www.w3.org/1998/Math/MathML",He="http://www.w3.org/2000/svg",Ge="http://www.w3.org/1999/xhtml";let Ft=Ge,jt=!1,nt=null;const tt=On({},[Ce,He,Ge],U0),Vt=ai(["mi","mo","mn","ms","mtext"]);let In=On({},Vt);const L=ai(["annotation-xml"]);let ie=On({},L);const Te=On({},["title","style","font","a","script"]);let ft=null;const rn=["application/xhtml+xml","text/html"],yn="text/html";let Ut=null,Jt=null;const bt=n.createElement("form"),pe=function(F){return F instanceof RegExp||F instanceof Function},Ze=function(){let F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Jt&&Jt===F)return;(!F||typeof F!="object")&&(F={}),F=xi(F),ft=rn.indexOf(F.PARSER_MEDIA_TYPE)===-1?yn:F.PARSER_MEDIA_TYPE,Ut=ft==="application/xhtml+xml"?U0:Yd,ke=Pa(F,"ALLOWED_TAGS",ct,{transform:Ut}),Ee=Pa(F,"ALLOWED_ATTR",Ve,{transform:Ut}),nt=Pa(F,"ALLOWED_NAMESPACES",tt,{transform:U0}),Oe=Pa(F,"ADD_URI_SAFE_ATTR",Re,{transform:Ut,base:Re}),le=Pa(F,"ADD_DATA_URI_TAGS",Pe,{transform:Ut,base:Pe}),ae=Pa(F,"FORBID_CONTENTS",he,{transform:Ut}),xt=Pa(F,"FORBID_TAGS",xi({}),{transform:Ut}),_t=Pa(F,"FORBID_ATTR",xi({}),{transform:Ut}),re=Xr(F,"USE_PROFILES")?F.USE_PROFILES&&typeof F.USE_PROFILES=="object"?xi(F.USE_PROFILES):F.USE_PROFILES:!1,en=F.ALLOW_ARIA_ATTR!==!1,tn=F.ALLOW_DATA_ATTR!==!1,Qn=F.ALLOW_UNKNOWN_PROTOCOLS||!1,se=F.ALLOW_SELF_CLOSE_IN_ATTR!==!1,_e=F.SAFE_FOR_TEMPLATES||!1,me=F.SAFE_FOR_XML!==!1,ve=F.WHOLE_DOCUMENT||!1,Ae=F.RETURN_DOM||!1,Ie=F.RETURN_DOM_FRAGMENT||!1,pt=F.RETURN_TRUSTED_TYPE||!1,ge=F.FORCE_BODY||!1,Le=F.SANITIZE_DOM!==!1,gt=F.SANITIZE_NAMED_PROPS||!1,St=F.KEEP_CONTENT!==!1,Rt=F.IN_PLACE||!1,Ue=s8(F.ALLOWED_URI_REGEXP)?F.ALLOWED_URI_REGEXP:W_,Ft=typeof F.NAMESPACE=="string"?F.NAMESPACE:Ge,In=Xr(F,"MATHML_TEXT_INTEGRATION_POINTS")&&F.MATHML_TEXT_INTEGRATION_POINTS&&typeof F.MATHML_TEXT_INTEGRATION_POINTS=="object"?xi(F.MATHML_TEXT_INTEGRATION_POINTS):On({},Vt),ie=Xr(F,"HTML_INTEGRATION_POINTS")&&F.HTML_INTEGRATION_POINTS&&typeof F.HTML_INTEGRATION_POINTS=="object"?xi(F.HTML_INTEGRATION_POINTS):On({},L);const ue=Xr(F,"CUSTOM_ELEMENT_HANDLING")&&F.CUSTOM_ELEMENT_HANDLING&&typeof F.CUSTOM_ELEMENT_HANDLING=="object"?xi(F.CUSTOM_ELEMENT_HANDLING):Kc(null);if(be=Kc(null),Xr(ue,"tagNameCheck")&&pe(ue.tagNameCheck)&&(be.tagNameCheck=ue.tagNameCheck),Xr(ue,"attributeNameCheck")&&pe(ue.attributeNameCheck)&&(be.attributeNameCheck=ue.attributeNameCheck),Xr(ue,"allowCustomizedBuiltInElements")&&typeof ue.allowCustomizedBuiltInElements=="boolean"&&(be.allowCustomizedBuiltInElements=ue.allowCustomizedBuiltInElements),ci(be),_e&&(tn=!1),Ie&&(Ae=!0),re&&(ke=On({},B_),Ee=Kc(null),re.html===!0&&(On(ke,F_),On(Ee,j_)),re.svg===!0&&(On(ke,W0),On(Ee,V0),On(Ee,Rp)),re.svgFilters===!0&&(On(ke,q0),On(Ee,V0),On(Ee,Rp)),re.mathMl===!0&&(On(ke,H0),On(Ee,U_),On(Ee,Rp))),Yt.tagCheck=null,Yt.attributeCheck=null,Xr(F,"ADD_TAGS")&&(typeof F.ADD_TAGS=="function"?Yt.tagCheck=F.ADD_TAGS:za(F.ADD_TAGS)&&(ke===ct&&(ke=xi(ke)),On(ke,F.ADD_TAGS,Ut))),Xr(F,"ADD_ATTR")&&(typeof F.ADD_ATTR=="function"?Yt.attributeCheck=F.ADD_ATTR:za(F.ADD_ATTR)&&(Ee===Ve&&(Ee=xi(Ee)),On(Ee,F.ADD_ATTR,Ut))),Xr(F,"ADD_URI_SAFE_ATTR")&&za(F.ADD_URI_SAFE_ATTR)&&On(Oe,F.ADD_URI_SAFE_ATTR,Ut),Xr(F,"FORBID_CONTENTS")&&za(F.FORBID_CONTENTS)&&(ae===he&&(ae=xi(ae)),On(ae,F.FORBID_CONTENTS,Ut)),Xr(F,"ADD_FORBID_CONTENTS")&&za(F.ADD_FORBID_CONTENTS)&&(ae===he&&(ae=xi(ae)),On(ae,F.ADD_FORBID_CONTENTS,Ut)),St&&(ke["#text"]=!0),ve&&On(ke,["html","head","body"]),ke.table&&(On(ke,["tbody"]),delete xt.tbody),F.TRUSTED_TYPES_POLICY){if(typeof F.TRUSTED_TYPES_POLICY.createHTML!="function")throw Sl('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof F.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Sl('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const at=M;M=F.TRUSTED_TYPES_POLICY;try{O=N("")}catch(Lt){throw M=at,Lt}}else F.TRUSTED_TYPES_POLICY===null?(M=void 0,O=""):(M===void 0&&(M=z()),M&&typeof O=="string"&&(O=N("")));ai&&ai(F),Jt=F},We=On({},[...W0,...q0,...o8]),mt=On({},[...H0,...a8]),rt=function(F,ue,at){return ue.namespaceURI===Ge?F==="svg":ue.namespaceURI===Ce?F==="svg"&&(at==="annotation-xml"||In[at]):!!We[F]},$e=function(F,ue,at){return ue.namespaceURI===Ge?F==="math":ue.namespaceURI===He?F==="math"&&ie[at]:!!mt[F]},Bt=function(F,ue,at){return ue.namespaceURI===He&&!ie[at]||ue.namespaceURI===Ce&&!In[at]?!1:!mt[F]&&(Te[F]||!We[F])},At=function(F){let ue=y(F);(!ue||!ue.tagName)&&(ue={namespaceURI:Ft,tagName:"template"});const at=Yd(F.tagName),Lt=Yd(ue.tagName);return nt[F.namespaceURI]?F.namespaceURI===He?rt(at,ue,Lt):F.namespaceURI===Ce?$e(at,ue,Lt):F.namespaceURI===Ge?Bt(at,ue,Lt):!!(ft==="application/xhtml+xml"&&nt[F.namespaceURI]):!1},vt=function(F){zc(e.removed,{element:F});try{y(F).removeChild(F)}catch{if(g(F),!y(F))throw Sl("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Pt=function(F){const ue=b(F);if(ue){const Lt=[];Ed(ue,pn=>{zc(Lt,pn)}),Ed(Lt,pn=>{try{g(pn)}catch{}})}const at=k(F);if(at)for(let Lt=at.length-1;Lt>=0;--Lt){const pn=at[Lt],Cn=pn&&pn.name;if(typeof Cn=="string")try{F.removeAttribute(Cn)}catch{}}},Kt=function(F,ue){try{zc(e.removed,{attribute:ue.getAttributeNode(F),from:ue})}catch{zc(e.removed,{attribute:null,from:ue})}if(ue.removeAttribute(F),F==="is")if(Ae||Ie)try{vt(ue)}catch{}else try{ue.setAttribute(F,"")}catch{}},Mt=function(F){const ue=k(F);if(ue)for(let at=ue.length-1;at>=0;--at){const Lt=ue[at],pn=Lt&&Lt.name;if(!(typeof pn!="string"||Ee[Ut(pn)]))try{F.removeAttribute(pn)}catch{}}},Ct=function(F){const ue=[F];for(;ue.length>0;){const at=ue.pop();(S?S(at):at.nodeType)===fo.element&&Mt(at);const pn=b(at);if(pn)for(let Cn=pn.length-1;Cn>=0;--Cn)ue.push(pn[Cn])}},Ht=function(F){let ue=null,at=null;if(ge)F="<remove></remove>"+F;else{const Cn=I_(F,/^[\r\n\t ]+/);at=Cn&&Cn[0]}ft==="application/xhtml+xml"&&Ft===Ge&&(F='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+F+"</body></html>");const Lt=M?N(F):F;if(Ft===Ge)try{ue=new u().parseFromString(Lt,ft)}catch{}if(!ue||!ue.documentElement){ue=X.createDocument(Ft,"template",null);try{ue.documentElement.innerHTML=jt?O:Lt}catch{}}const pn=ue.body||ue.documentElement;return F&&at&&pn.insertBefore(n.createTextNode(at),pn.childNodes[0]||null),Ft===Ge?oe.call(ue,ve?"html":"body")[0]:ve?ue.documentElement:pn},_n=function(F){return G.call(F.ownerDocument||F,F,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},ln=function(F){return F=Ad(F,W," "),F=Ad(F,J," "),F=Ad(F,fe," "),F},sn=function(F){var ue;F.normalize();const at=G.call(F.ownerDocument||F,F,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let Lt=at.nextNode();for(;Lt;)Lt.data=ln(Lt.data),Lt=at.nextNode();const pn=(ue=F.querySelectorAll)===null||ue===void 0?void 0:ue.call(F,"template");pn&&Ed(pn,Cn=>{Bn(Cn.content)&&sn(Cn.content)})},mn=function(F){const ue=E?E(F):null;return typeof ue!="string"||Ut(ue)!=="form"?!1:typeof F.nodeName!="string"||typeof F.textContent!="string"||typeof F.removeChild!="function"||F.attributes!==k(F)||typeof F.removeAttribute!="function"||typeof F.setAttribute!="function"||typeof F.namespaceURI!="string"||typeof F.insertBefore!="function"||typeof F.hasChildNodes!="function"||F.nodeType!==S(F)||F.childNodes!==b(F)},Bn=function(F){if(!S||typeof F!="object"||F===null)return!1;try{return S(F)===fo.documentFragment}catch{return!1}},qn=function(F){if(!S||typeof F!="object"||F===null)return!1;try{return typeof S(F)=="number"}catch{return!1}};function vn(Ye,F,ue){Ye.length!==0&&Ed(Ye,at=>{at.call(e,F,ue,Jt)})}const Vr=function(F,ue){return!!(me&&F.hasChildNodes()&&!qn(F.firstElementChild)&&si(q_,F.textContent)&&si(q_,F.innerHTML)||me&&F.namespaceURI===Ge&&ue==="style"&&qn(F.firstElementChild)||F.nodeType===fo.processingInstruction||me&&F.nodeType===fo.comment&&si(v8,F.data))},Pn=function(F,ue){if(!xt[ue]&&mi(ue)&&(be.tagNameCheck instanceof RegExp&&si(be.tagNameCheck,ue)||be.tagNameCheck instanceof Function&&be.tagNameCheck(ue)))return!1;if(St&&!ae[ue]){const at=y(F),Lt=b(F);if(Lt&&at){const pn=Lt.length;for(let Cn=pn-1;Cn>=0;--Cn){const Pr=Rt?Lt[Cn]:p(Lt[Cn],!0);at.insertBefore(Pr,m(F))}}}return vt(F),!0},Yn=function(F){if(vn(q.beforeSanitizeElements,F,null),mn(F))return vt(F),!0;const ue=Ut(E?E(F):F.nodeName);if(vn(q.uponSanitizeElement,F,{tagName:ue,allowedTags:ke}),Vr(F,ue))return vt(F),!0;if(xt[ue]||!(Yt.tagCheck instanceof Function&&Yt.tagCheck(ue))&&!ke[ue])return Pn(F,ue);if((S?S(F):F.nodeType)===fo.element&&!At(F)||(ue==="noscript"||ue==="noembed"||ue==="noframes")&&si(b8,F.innerHTML))return vt(F),!0;if(_e&&F.nodeType===fo.text){const Lt=ln(F.textContent);F.textContent!==Lt&&(zc(e.removed,{element:F.cloneNode()}),F.textContent=Lt)}return vn(q.afterSanitizeElements,F,null),!1},sr=function(F,ue,at){if(_t[ue]||Le&&(ue==="id"||ue==="name")&&(at in n||at in bt))return!1;const Lt=Ee[ue]||Yt.attributeCheck instanceof Function&&Yt.attributeCheck(ue,F);if(!(tn&&si($,ue))){if(!(en&&si(de,ue))){if(Lt){if(!Oe[ue]){if(!si(Ue,Ad(at,wt,""))){if(!((ue==="src"||ue==="xlink:href"||ue==="href")&&F!=="script"&&z_(at,"data:")===0&&le[F])){if(!(Qn&&!si(Be,Ad(at,wt,"")))){if(at)return!1}}}}}else if(!(mi(F)&&(be.tagNameCheck instanceof RegExp&&si(be.tagNameCheck,F)||be.tagNameCheck instanceof Function&&be.tagNameCheck(F))&&(be.attributeNameCheck instanceof RegExp&&si(be.attributeNameCheck,ue)||be.attributeNameCheck instanceof Function&&be.attributeNameCheck(ue,F))||ue==="is"&&be.allowCustomizedBuiltInElements&&(be.tagNameCheck instanceof RegExp&&si(be.tagNameCheck,at)||be.tagNameCheck instanceof Function&&be.tagNameCheck(at))))return!1}}return!0},pr=On({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),mi=function(F){return!pr[Yd(F)]&&si(Je,F)},ls=function(F,ue,at,Lt){if(M&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!at)switch(f.getAttributeType(F,ue)){case"TrustedHTML":return N(Lt);case"TrustedScriptURL":return B(Lt)}return Lt},io=function(F,ue,at,Lt){try{at?F.setAttributeNS(at,ue,Lt):F.setAttribute(ue,Lt),mn(F)?vt(F):N_(e.removed)}catch{Kt(ue,F)}},Os=function(F){vn(q.beforeSanitizeAttributes,F,null);const ue=F.attributes;if(!ue||mn(F))return;const at={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ee,forceKeepAttr:void 0};let Lt=ue.length;const pn=Ut(F.nodeName);for(;Lt--;){const Cn=ue[Lt],Pr=Cn.name,nr=Cn.namespaceURI,ni=Cn.value,vi=Ut(Pr),jo=ni;let ri=Pr==="value"?jo:JD(jo);if(at.attrName=vi,at.attrValue=ri,at.keepAttr=!0,at.forceKeepAttr=void 0,vn(q.uponSanitizeAttribute,F,at),ri=at.attrValue,gt&&(vi==="id"||vi==="name")&&z_(ri,nn)!==0&&(Kt(Pr,F),ri=nn+ri),me&&si(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,ri)){Kt(Pr,F);continue}if(vi==="attributename"&&I_(ri,"href")){Kt(Pr,F);continue}if(!at.forceKeepAttr){if(!at.keepAttr){Kt(Pr,F);continue}if(!se&&si(y8,ri)){Kt(Pr,F);continue}if(_e&&(ri=ln(ri)),!sr(pn,vi,ri)){Kt(Pr,F);continue}ri=ls(pn,vi,nr,ri),ri!==jo&&io(F,Pr,nr,ri)}}vn(q.afterSanitizeAttributes,F,null)},Mr=function(F){let ue=null;const at=_n(F);for(vn(q.beforeSanitizeShadowDOM,F,null);ue=at.nextNode();)if(vn(q.uponSanitizeShadowNode,ue,null),Yn(ue),Os(ue),Bn(ue.content)&&Mr(ue.content),(S?S(ue):ue.nodeType)===fo.element){const pn=_(ue);Bn(pn)&&(Hn(pn),Mr(pn))}vn(q.afterSanitizeShadowDOM,F,null)},Hn=function(F){const ue=[{node:F,shadow:null}];for(;ue.length>0;){const at=ue.pop();if(at.shadow){Mr(at.shadow);continue}const Lt=at.node,Cn=(S?S(Lt):Lt.nodeType)===fo.element,Pr=b(Lt);if(Pr)for(let nr=Pr.length-1;nr>=0;--nr)ue.push({node:Pr[nr],shadow:null});if(Cn){const nr=E?E(Lt):null;if(typeof nr=="string"&&Ut(nr)==="template"){const ni=Lt.content;Bn(ni)&&ue.push({node:ni,shadow:null})}}if(Cn){const nr=_(Lt);Bn(nr)&&ue.push({node:null,shadow:nr},{node:nr,shadow:null})}}};return e.sanitize=function(Ye){let F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ue=null,at=null,Lt=null,pn=null;if(jt=!Ye,jt&&(Ye="<!-->"),typeof Ye!="string"&&!qn(Ye)&&(Ye=i8(Ye),typeof Ye!="string"))throw Sl("dirty is not a string, aborting");if(!e.isSupported)return Ye;Xe?(ke=et,Ee=dt):Ze(F),(q.uponSanitizeElement.length>0||q.uponSanitizeAttribute.length>0)&&(ke=xi(ke)),q.uponSanitizeAttribute.length>0&&(Ee=xi(Ee)),e.removed=[];const Cn=Rt&&typeof Ye!="string"&&qn(Ye);if(Cn){const ni=E?E(Ye):Ye.nodeName;if(typeof ni=="string"){const vi=Ut(ni);if(!ke[vi]||xt[vi])throw Sl("root node is forbidden and cannot be sanitized in-place")}if(mn(Ye))throw Sl("root node is clobbered and cannot be sanitized in-place");try{Hn(Ye)}catch(vi){throw Pt(Ye),vi}}else if(qn(Ye))ue=Ht("<!---->"),at=ue.ownerDocument.importNode(Ye,!0),at.nodeType===fo.element&&at.nodeName==="BODY"||at.nodeName==="HTML"?ue=at:ue.appendChild(at),Hn(at);else{if(!Ae&&!_e&&!ve&&Ye.indexOf("<")===-1)return M&&pt?N(Ye):Ye;if(ue=Ht(Ye),!ue)return Ae?null:pt?O:""}ue&&ge&&vt(ue.firstChild);const Pr=_n(Cn?Ye:ue);try{for(;Lt=Pr.nextNode();)Yn(Lt),Os(Lt),Bn(Lt.content)&&Mr(Lt.content)}catch(ni){throw Cn&&Pt(Ye),ni}if(Cn)return Ed(e.removed,ni=>{ni.element&&Ct(ni.element)}),_e&&sn(Ye),Ye;if(Ae){if(_e&&sn(ue),Ie)for(pn=Z.call(ue.ownerDocument);ue.firstChild;)pn.appendChild(ue.firstChild);else pn=ue;return(Ee.shadowroot||Ee.shadowrootmode)&&(pn=K.call(r,pn,!0)),pn}let nr=ve?ue.outerHTML:ue.innerHTML;return ve&&ke["!doctype"]&&ue.ownerDocument&&ue.ownerDocument.doctype&&ue.ownerDocument.doctype.name&&si(g8,ue.ownerDocument.doctype.name)&&(nr="<!DOCTYPE "+ue.ownerDocument.doctype.name+`>
`+nr),_e&&(nr=ln(nr)),M&&pt?N(nr):nr},e.setConfig=function(){let Ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ze(Ye),Xe=!0,et=ke,dt=Ee},e.clearConfig=function(){Jt=null,Xe=!1,et=null,dt=null,M=P,O=""},e.isValidAttribute=function(Ye,F,ue){Jt||Ze({});const at=Ut(Ye),Lt=Ut(F);return sr(at,Lt,ue)},e.addHook=function(Ye,F){typeof F=="function"&&Xr(q,Ye)&&zc(q[Ye],F)},e.removeHook=function(Ye,F){if(Xr(q,Ye)){if(F!==void 0){const ue=ZD(q[Ye],F);return ue===-1?void 0:QD(q[Ye],ue,1)[0]}return N_(q[Ye])}},e.removeHooks=function(Ye){Xr(q,Ye)&&(q[Ye]=[])},e.removeAllHooks=function(){q=H_()},e}var HT=qT();const _8=new Set(["health.changed","health.stale"]);function VT(t){return _8.has(t.type)}function $T(t){var n;if(!VT(t)||!t.entity_id)return null;const e=(n=t.data)==null?void 0:n.to;return typeof e=="string"?e:null}function Vq(t,e){const n=$T(e);if(!n)return t;const r=t.findIndex(s=>s.id===e.entity_id);if(r<0||t[r].health===n)return t;const i=t.slice();return i[r]={...i[r],health:n,last_check_at:e.ts},i}function S8(t,e){if(!t||e.entity_id!==t.id)return t;const n=$T(e);return!n||t.health===n?t:{...t,health:n,last_check_at:e.ts}}const k8={down:0,degraded:1,stale:2,unknown:3,healthy:4};function V_(t){return k8[t??"unknown"]??3}function GT(t){var n;const e=(n=t.config)==null?void 0:n.script;return typeof e=="string"&&e?e.replace(/\.sh$/,""):t.kind}function M8(t,e){var f;const n=e.filter(h=>h.enabled),r=n.filter(h=>h.last_health);if(!t)return{health:"unknown",reason:"",failing:[],passing:0,total:0};if(n.length===0)return{health:"unmonitored",reason:"no checks configured for this entity",failing:[],passing:0,total:0};const i=r.filter(h=>h.last_health&&h.last_health!=="healthy").sort((h,p)=>V_(h.last_health)-V_(p.last_health)),s=r.length-i.length,o=t.health??((f=i[0])==null?void 0:f.last_health)??"unknown";if(i.length===0){const h=n.length-r.length;return{health:o,reason:h>0?`${s} of ${n.length} checks passing, ${h} not yet run`:"",failing:i,passing:s,total:n.length}}const a=i.slice(0,2).map(GT),l=i.length-a.length,c=a.join(", ")+(l>0?` +${l} more`:""),u=i[0].last_health==="down"?"failing":i[0].last_health;return{health:o,reason:`${c} ${u} · ${s} of ${n.length} checks passing`,failing:i,passing:s,total:n.length}}const YT=new Set(["document","investigation","runbook"]),KT=new Set(["execution","signal","check","approval","classification","feedback","pattern","skill"]),T8=["status","impact","activity","metrics","reference"],E8=["content","impact","reference"],A8=["activity","reference"];function P8(t){return YT.has(t)?E8:KT.has(t)?A8:T8}function $_(t){return!YT.has(t)&&!KT.has(t)}function C8(t,e){return e.health==="unmonitored"?`${t.slug} has no checks configured. Work out what monitoring it should have and set it up.`:e.failing.length>0?`Investigate ${t.slug} — it reads ${e.health}: ${e.reason}. Find the cause and report what you find.`:`Give me a status summary of ${t.slug}: what it is, what depends on it, and anything that looks off.`}var O8=new Set(["$$slots","$$events","$$legacy","ref","open"]);function R8(t,e){Tt(e,!0);let n=te(e,"ref",15,null),r=te(e,"open",15,!1),i=ht(e,O8);var s=qe(),o=Me(s);Tn(o,()=>uO,(a,l)=>{l(a,zt({"data-slot":"collapsible"},()=>i,{get ref(){return n()},set ref(c){n(c)},get open(){return r()},set open(c){r(c)}}))}),A(t,s),Et()}var N8=new Set(["$$slots","$$events","$$legacy","ref"]);function I8(t,e){Tt(e,!0);let n=te(e,"ref",15,null),r=ht(e,N8);var i=qe(),s=Me(i);Tn(s,()=>mO,(o,a)=>{a(o,zt({"data-slot":"collapsible-trigger"},()=>r,{get ref(){return n()},set ref(l){n(l)}}))}),A(t,i),Et()}var z8=new Set(["$$slots","$$events","$$legacy","ref"]);function L8(t,e){Tt(e,!0);let n=te(e,"ref",15,null),r=ht(e,z8);var i=qe(),s=Me(i);Tn(s,()=>hO,(o,a)=>{a(o,zt({"data-slot":"collapsible-content"},()=>r,{get ref(){return n()},set ref(l){n(l)}}))}),A(t,i),Et()}var D8=ne('<span class="text-xs font-medium"> </span> <!>',1),F8=ne('<div class="border-t px-2 py-1.5"><!></div>'),B8=ne("<!> <!>",1);function j8(t,e){Tt(e,!0);let n=Se(!1);Qt(()=>{I(n,e.defaultOpen,!0)});var r=qe(),i=Me(r);Tn(i,()=>R8,(s,o)=>{o(s,{class:"rounded-md border bg-card",get open(){return d(n)},set open(a){I(n,a,!0)},children:(a,l)=>{var c=B8(),u=Me(c);Tn(u,()=>I8,(h,p)=>{p(h,{class:"flex w-full cursor-pointer select-none items-center justify-between gap-2 px-2 py-1 text-left hover:bg-muted/50",children:(g,m)=>{var b=D8(),y=Me(b),_=j(y),k=ee(y,2);{let S=V(()=>d(n)?"rotate-180":"");E4(k,{get class(){return`size-3.5 shrink-0 text-muted-foreground transition-transform duration-200 ${d(S)??""}`},"aria-hidden":"true"})}De(()=>je(_,`${e.title??""}${e.count!==void 0?` (${e.count})`:""}`)),A(g,b)},$$slots:{default:!0}})});var f=ee(u,2);Tn(f,()=>L8,(h,p)=>{p(h,{class:"overflow-hidden data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=open]:animate-in data-[state=open]:fade-in",children:(g,m)=>{var b=F8(),y=j(b);Zt(y,()=>e.children),A(g,b)},$$slots:{default:!0}})}),A(a,c)},$$slots:{default:!0}})}),A(t,r),Et()}const U8=gM({base:"h-5 gap-1 rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive group/badge inline-flex w-fit shrink-0 items-center justify-center overflow-hidden whitespace-nowrap transition-colors focus-visible:ring-[3px] [&>svg]:pointer-events-none",variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});var W8=new Set(["$$slots","$$events","$$legacy","ref","href","class","variant","children"]);function Ca(t,e){Tt(e,!0);let n=te(e,"ref",15,null),r=te(e,"variant",3,"default"),i=ht(e,W8);var s=qe(),o=Me(s);jS(o,()=>e.href?"a":"span",!1,(a,l)=>{kr(a,f=>n(f),()=>n()),_r(a,f=>({"data-slot":"badge",href:e.href,class:f,...i}),[()=>ss(U8({variant:r()}),e.class)]);var c=qe(),u=Me(c);Zt(u,()=>e.children??an),A(l,c)}),A(t,s),Et()}var q8=new Set(["$$slots","$$events","$$legacy","ref","class"]),H8=ne("<div></div>");function Np(t,e){Tt(e,!0);let n=te(e,"ref",15,null),r=ht(e,q8);var i=H8();_r(i,s=>({"data-slot":"skeleton",class:s,...r}),[()=>ss("bg-muted rounded-md animate-pulse",e.class)]),kr(i,s=>n(s),()=>n()),A(t,i),Et()}const V8=Array(12).fill(0);var $8=ne('<div class="sonner-loading-bar"></div>'),G8=ne('<div><div class="sonner-spinner"></div></div>');function Y8(t,e){Tt(e,!0);var n=G8(),r=j(n);Rn(r,23,()=>V8,(i,s)=>`spinner-bar-${s}`,(i,s)=>{var o=$8();A(i,o)}),De(i=>{Gn(n,1,i),ut(n,"data-visible",e.visible)},[()=>Xi(["sonner-loading-wrapper",e.class].filter(Boolean).join(" "))]),A(t,n),Et()}function ho(...t){return t.filter(Boolean).join(" ")}const K8=typeof document<"u",X8=typeof window<"u"?window:void 0;function Z8(t){let e=t.activeElement;for(;e!=null&&e.shadowRoot;){const n=e.shadowRoot.activeElement;if(n===e)break;e=n}return e}var zu,Bh;class Q8{constructor(e={}){Y(this,zu);Y(this,Bh);const{window:n=X8,document:r=n==null?void 0:n.document}=e;n!==void 0&&(ye(this,zu,r),ye(this,Bh,Bm(i=>{const s=Ar(n,"focusin",i),o=Ar(n,"focusout",i);return()=>{s(),o()}})))}get current(){var e;return(e=v(this,Bh))==null||e.call(this),v(this,zu)?Z8(v(this,zu)):null}}zu=new WeakMap,Bh=new WeakMap;new Q8;var jh,aa;class J8{constructor(e){Y(this,jh);Y(this,aa);ye(this,jh,e),ye(this,aa,Symbol(e))}get key(){return v(this,aa)}exists(){return i1(v(this,aa))}get(){const e=Fu(v(this,aa));if(e===void 0)throw new Error(`Context "${v(this,jh)}" not found`);return e}getOr(e){const n=Fu(v(this,aa));return n===void 0?e:n}set(e){return Dm(v(this,aa),e)}}jh=new WeakMap,aa=new WeakMap;const eF=new J8("<Toaster/>");let G_=0;var Uh,Wh,qh;class tF{constructor(){Y(this,Uh,Se(gn([])));Y(this,Wh,Se(gn([])));Y(this,qh,e=>{const n=this.toasts.findIndex(r=>r.id===e);return n===-1?null:n});we(this,"addToast",e=>{K8&&this.toasts.unshift(e)});we(this,"updateToast",({id:e,data:n,type:r,message:i})=>{const s=this.toasts.findIndex(a=>a.id===e),o=this.toasts[s];this.toasts[s]={...o,...n,id:e,title:i,type:r,updated:!0}});we(this,"create",e=>{var a;const{message:n,...r}=e,i=typeof(e==null?void 0:e.id)=="number"||e.id&&((a=e.id)==null?void 0:a.length)>0?e.id:G_++,s=e.dismissible!==void 0?e.dismissible:e.dismissable!==void 0?e.dismissable:!0,o=e.type===void 0?"default":e.type;return br(()=>{this.toasts.find(c=>c.id===i)?this.updateToast({id:i,data:e,type:o,message:n,dismissible:s}):this.addToast({...r,id:i,title:n,dismissible:s,type:o})}),i});we(this,"dismiss",e=>(br(()=>{if(e===void 0){this.toasts=this.toasts.map(r=>({...r,dismiss:!0}));return}const n=this.toasts.findIndex(r=>r.id===e);this.toasts[n]&&(this.toasts[n]={...this.toasts[n],dismiss:!0})}),e));we(this,"remove",e=>{if(e===void 0){this.toasts=[];return}const n=v(this,qh).call(this,e);if(n!==null)return this.toasts.splice(n,1),e});we(this,"message",(e,n)=>this.create({...n,type:"default",message:e}));we(this,"error",(e,n)=>this.create({...n,type:"error",message:e}));we(this,"success",(e,n)=>this.create({...n,type:"success",message:e}));we(this,"info",(e,n)=>this.create({...n,type:"info",message:e}));we(this,"warning",(e,n)=>this.create({...n,type:"warning",message:e}));we(this,"loading",(e,n)=>this.create({...n,type:"loading",message:e}));we(this,"promise",(e,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:e,type:"loading",message:typeof n.loading=="string"?n.loading:n.loading()}));const i=e instanceof Promise?e:e();let s=r!==void 0;return i.then(o=>{if(typeof o=="object"&&o&&"ok"in o&&typeof o.ok=="boolean"&&!o.ok){s=!1;const a=nF(o);this.create({id:r,type:"error",message:a})}else if(n.success!==void 0){s=!1;const a=typeof n.success=="function"?n.success(o):n.success;this.create({id:r,type:"success",message:a})}}).catch(o=>{if(n.error!==void 0){s=!1;const a=typeof n.error=="function"?n.error(o):n.error;this.create({id:r,type:"error",message:a})}}).finally(()=>{var o;s&&(this.dismiss(r),r=void 0),(o=n.finally)==null||o.call(n)}),r});we(this,"custom",(e,n)=>{const r=(n==null?void 0:n.id)||G_++;return this.create({component:e,id:r,...n}),r});we(this,"removeHeight",e=>{this.heights=this.heights.filter(n=>n.toastId!==e)});we(this,"setHeight",e=>{const n=v(this,qh).call(this,e.toastId);if(n===null){this.heights.push(e);return}this.heights[n]=e});we(this,"reset",()=>{this.toasts=[],this.heights=[]})}get toasts(){return d(v(this,Uh))}set toasts(e){I(v(this,Uh),e,!0)}get heights(){return d(v(this,Wh))}set heights(e){I(v(this,Wh),e,!0)}}Uh=new WeakMap,Wh=new WeakMap,qh=new WeakMap;function nF(t){return t&&typeof t=="object"&&"status"in t?`HTTP error! Status: ${t.status}`:`Error! ${t}`}const Kn=new tF;function rF(t,e){return Kn.create({message:t,...e})}var Om;class iF{constructor(){Y(this,Om,V(()=>Kn.toasts.filter(e=>!e.dismiss)))}get toasts(){return d(v(this,Om))}}Om=new WeakMap;const sF=rF,Oa=Object.assign(sF,{success:Kn.success,info:Kn.info,warning:Kn.warning,error:Kn.error,custom:Kn.custom,message:Kn.message,promise:Kn.promise,dismiss:Kn.dismiss,loading:Kn.loading,getActiveToasts:()=>Kn.toasts.filter(t=>!t.dismiss)});function Ip(t){return t.label!==void 0}function oF(){let t=Se(gn(typeof document<"u"?document.hidden:!1));return Qt(()=>Ar(document,"visibilitychange",()=>{I(t,document.hidden,!0)})),{get current(){return d(t)}}}const Y_=4e3,aF=14,lF=45,cF=200,uF=.05,dF={toast:"",title:"",description:"",loader:"",closeButton:"",cancelButton:"",actionButton:"",action:"",warning:"",error:"",success:"",default:"",info:"",loading:""};function fF(t){const[e,n]=t.split("-"),r=[];return e&&r.push(e),n&&r.push(n),r}function K_(t){return 1/(1.5+Math.abs(t)/20)}var hF=ne("<div><!></div>"),pF=ne('<button data-close-button=""><!></button>'),gF=ne('<div data-icon=""><!> <!></div>'),mF=ne('<div data-description=""><!></div>'),vF=ne('<button data-button="" data-cancel=""> </button>'),bF=ne('<button data-button=""> </button>'),yF=ne('<!> <div data-content=""><div data-title=""><!></div> <!></div> <!> <!>',1),wF=ne('<li aria-atomic="true" data-sonner-toast=""><!> <!></li>');function xF(t,e){Tt(e,!0);const n=se=>{var _e=qe(),me=Me(_e);{var ve=et=>{var dt=hF(),ge=j(dt);Zt(ge,()=>e.loadingIcon),De(Ae=>{Gn(dt,1,Ae),ut(dt,"data-visible",d(M)==="loading")},[()=>{var Ae,Ie,pt;return Xi(ho((Ae=d(oe))==null?void 0:Ae.loader,(pt=(Ie=e.toast)==null?void 0:Ie.classes)==null?void 0:pt.loader,"sonner-loader"))}]),A(et,dt)},Xe=et=>{{let dt=V(()=>{var Ae,Ie;return ho((Ae=d(oe))==null?void 0:Ae.loader,(Ie=e.toast.classes)==null?void 0:Ie.loader)}),ge=V(()=>d(M)==="loading");Y8(et,{get class(){return d(dt)},get visible(){return d(ge)}})}};xe(me,et=>{e.loadingIcon?et(ve):et(Xe,-1)})}A(se,_e)};let r=te(e,"cancelButtonStyle",3,""),i=te(e,"actionButtonStyle",3,""),s=te(e,"descriptionClass",3,""),o=te(e,"unstyled",3,!1),a=te(e,"defaultRichColors",3,!1);const l={...dF};let c=Se(!1),u=Se(!1),f=Se(!1),h=Se(!1),p=Se(!1),g=Se(0),m=Se(0),b=e.toast.duration||e.duration||Y_,y=Se(void 0),_=Se(null),k=Se(null);const S=V(()=>e.index===0),E=V(()=>e.index+1<=e.visibleToasts),M=V(()=>e.toast.type),O=V(()=>e.toast.dismissible!==void 0?e.toast.dismissible!==!1:e.toast.dismissable!==!1),P=V(()=>e.toast.class||""),x=V(()=>e.toast.descriptionClass||""),C=V(()=>Kn.heights.findIndex(se=>se.toastId===e.toast.id)||0),R=V(()=>e.toast.closeButton??e.closeButton),N=V(()=>e.toast.duration??e.duration??Y_);let B=null;const z=V(()=>e.position.split("-")),H=V(()=>Kn.heights.reduce((se,_e,me)=>me>=d(C)?se:se+_e.height,0)),X=oF(),G=V(()=>e.toast.invert||e.invert),Z=V(()=>d(M)==="loading"),oe=V(()=>({...l,...e.classes})),K=V(()=>e.toast.title),q=V(()=>e.toast.description);let W=Se(0),J=Se(0);const fe=V(()=>Math.round(d(C)*aF+d(H)));Qt(()=>{d(K),d(q);let se;e.expanded||e.expandByDefault?se=1:se=1-e.index*uF;const _e=br(()=>d(y));if(_e===void 0)return;_e.style.setProperty("height","auto");const me=_e.offsetHeight,ve=_e.getBoundingClientRect().height,Xe=Math.round(ve/se+Number.EPSILON&100)/100;_e.style.removeProperty("height");let et;Math.abs(Xe-me)<1?et=Xe:et=me,I(m,et,!0),Kn.setHeight({toastId:e.toast.id,height:et})});function $(){I(u,!0),I(g,d(fe),!0),Kn.removeHeight(e.toast.id),setTimeout(()=>{Kn.remove(e.toast.id)},cF)}let de;const Be=V(()=>e.toast.promise&&d(M)==="loading"||e.toast.duration===Number.POSITIVE_INFINITY);function wt(){I(W,new Date().getTime(),!0),de=setTimeout(()=>{var se,_e;(_e=(se=e.toast).onAutoClose)==null||_e.call(se,e.toast),$()},b)}function Je(){if(d(J)<d(W)){const se=new Date().getTime()-d(W);b=b-se}I(J,new Date().getTime(),!0)}Qt(()=>{e.toast.updated&&(clearTimeout(de),b=d(N),d(Be)||wt())}),Qt(()=>(d(Be)||(e.expanded||e.interacting||e.pauseWhenPageIsHidden&&X.current?Je():wt()),()=>clearTimeout(de))),os(()=>{var _e;I(c,!0);const se=(_e=d(y))==null?void 0:_e.getBoundingClientRect().height;return I(m,se,!0),Kn.setHeight({toastId:e.toast.id,height:se}),()=>{Kn.removeHeight(e.toast.id)}}),Qt(()=>{e.toast.delete&&br(()=>{var se,_e;$(),(_e=(se=e.toast).onDismiss)==null||_e.call(se,e.toast)})});const Ue=se=>{if(d(Z))return;I(g,d(fe),!0);const _e=se.target;_e.setPointerCapture(se.pointerId),_e.tagName!=="BUTTON"&&(I(f,!0),B={x:se.clientX,y:se.clientY})},ke=()=>{var et,dt,ge,Ae,Ie,pt;if(d(h)||!d(O))return;B=null;const se=Number(((et=d(y))==null?void 0:et.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),_e=Number(((dt=d(y))==null?void 0:dt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),me=new Date().getTime()-0,ve=d(_)==="x"?se:_e,Xe=Math.abs(ve)/me;if(Math.abs(ve)>=lF||Xe>.11){I(g,d(fe),!0),(Ae=(ge=e.toast).onDismiss)==null||Ae.call(ge,e.toast),d(_)==="x"?I(k,se>0?"right":"left",!0):I(k,_e>0?"down":"up",!0),$(),I(h,!0);return}else(Ie=d(y))==null||Ie.style.setProperty("--swipe-amount-x","0px"),(pt=d(y))==null||pt.style.setProperty("--swipe-amount-y","0px");I(p,!1),I(f,!1),I(_,null)},ct=se=>{var dt,ge,Ae;if(!B||!d(O)||(((dt=window.getSelection())==null?void 0:dt.toString().length)??-1)>0)return;const me=se.clientY-B.y,ve=se.clientX-B.x,Xe=e.swipeDirections??fF(e.position);!d(_)&&(Math.abs(ve)>1||Math.abs(me)>1)&&I(_,Math.abs(ve)>Math.abs(me)?"x":"y",!0);let et={x:0,y:0};if(d(_)==="y"){if(Xe.includes("top")||Xe.includes("bottom"))if(Xe.includes("top")&&me<0||Xe.includes("bottom")&&me>0)et.y=me;else{const Ie=me*K_(me);et.y=Math.abs(Ie)<Math.abs(me)?Ie:me}}else if(d(_)==="x"&&(Xe.includes("left")||Xe.includes("right")))if(Xe.includes("left")&&ve<0||Xe.includes("right")&&ve>0)et.x=ve;else{const Ie=ve*K_(ve);et.x=Math.abs(Ie)<Math.abs(ve)?Ie:ve}(Math.abs(et.x)>0||Math.abs(et.y)>0)&&I(p,!0),(ge=d(y))==null||ge.style.setProperty("--swipe-amount-x",`${et.x}px`),(Ae=d(y))==null||Ae.style.setProperty("--swipe-amount-y",`${et.y}px`)},Ee=()=>{I(f,!1),I(_,null),B=null},Ve=V(()=>e.toast.icon?e.toast.icon:d(M)==="success"?e.successIcon:d(M)==="error"?e.errorIcon:d(M)==="warning"?e.warningIcon:d(M)==="info"?e.infoIcon:d(M)==="loading"?e.loadingIcon:null);var be=wF();ut(be,"tabindex",0);let xt;var _t=j(be);{var Yt=se=>{var _e=pF(),me=j(_e);Zt(me,()=>e.closeIcon??an),De(ve=>{ut(_e,"aria-label",e.closeButtonAriaLabel),ut(_e,"data-disabled",d(Z)),Gn(_e,1,ve)},[()=>{var ve,Xe,et;return Xi(ho((ve=d(oe))==null?void 0:ve.closeButton,(et=(Xe=e.toast)==null?void 0:Xe.classes)==null?void 0:et.closeButton))}]),Ln("click",_e,()=>{var ve,Xe;d(Z)||!d(O)||($(),(Xe=(ve=e.toast).onDismiss)==null||Xe.call(ve,e.toast))}),A(se,_e)};xe(_t,se=>{d(R)&&!e.toast.component&&d(M)!=="loading"&&e.closeIcon!==null&&se(Yt)})}var en=ee(_t,2);{var tn=se=>{const _e=V(()=>e.toast.component);var me=qe(),ve=Me(me);Tn(ve,()=>d(_e),(Xe,et)=>{et(Xe,zt(()=>e.toast.componentProps,{closeToast:$}))}),A(se,me)},Qn=se=>{var _e=yF(),me=Me(_e);{var ve=St=>{var Rt=gF(),re=j(Rt);{var ae=Pe=>{var Oe=qe(),Re=Me(Oe);{var Ce=Ge=>{var Ft=qe(),jt=Me(Ft);Tn(jt,()=>e.toast.icon,(nt,tt)=>{tt(nt,{})}),A(Ge,Ft)},He=Ge=>{n(Ge)};xe(Re,Ge=>{e.toast.icon?Ge(Ce):Ge(He,-1)})}A(Pe,Oe)};xe(re,Pe=>{(e.toast.promise||d(M)==="loading")&&Pe(ae)})}var he=ee(re,2);{var le=Pe=>{var Oe=qe(),Re=Me(Oe);{var Ce=nt=>{var tt=qe(),Vt=Me(tt);Tn(Vt,()=>e.toast.icon,(In,L)=>{L(In,{})}),A(nt,tt)},He=nt=>{var tt=qe(),Vt=Me(tt);Zt(Vt,()=>e.successIcon??an),A(nt,tt)},Ge=nt=>{var tt=qe(),Vt=Me(tt);Zt(Vt,()=>e.errorIcon??an),A(nt,tt)},Ft=nt=>{var tt=qe(),Vt=Me(tt);Zt(Vt,()=>e.warningIcon??an),A(nt,tt)},jt=nt=>{var tt=qe(),Vt=Me(tt);Zt(Vt,()=>e.infoIcon??an),A(nt,tt)};xe(Re,nt=>{e.toast.icon?nt(Ce):d(M)==="success"?nt(He,1):d(M)==="error"?nt(Ge,2):d(M)==="warning"?nt(Ft,3):d(M)==="info"&&nt(jt,4)})}A(Pe,Oe)};xe(he,Pe=>{e.toast.type!=="loading"&&Pe(le)})}De(Pe=>Gn(Rt,1,Pe),[()=>{var Pe,Oe,Re;return Xi(ho((Pe=d(oe))==null?void 0:Pe.icon,(Re=(Oe=e.toast)==null?void 0:Oe.classes)==null?void 0:Re.icon))}]),A(St,Rt)};xe(me,St=>{(d(M)||e.toast.icon||e.toast.promise)&&e.toast.icon!==null&&(d(Ve)!==null||e.toast.icon)&&St(ve)})}var Xe=ee(me,2),et=j(Xe),dt=j(et);{var ge=St=>{var Rt=qe(),re=Me(Rt);{var ae=le=>{const Pe=V(()=>e.toast.title);var Oe=qe(),Re=Me(Oe);Tn(Re,()=>d(Pe),(Ce,He)=>{He(Ce,zt(()=>e.toast.componentProps))}),A(le,Oe)},he=le=>{var Pe=er();De(()=>je(Pe,e.toast.title)),A(le,Pe)};xe(re,le=>{typeof e.toast.title!="string"?le(ae):le(he,-1)})}A(St,Rt)};xe(dt,St=>{e.toast.title&&St(ge)})}var Ae=ee(et,2);{var Ie=St=>{var Rt=mF(),re=j(Rt);{var ae=le=>{const Pe=V(()=>e.toast.description);var Oe=qe(),Re=Me(Oe);Tn(Re,()=>d(Pe),(Ce,He)=>{He(Ce,zt(()=>e.toast.componentProps))}),A(le,Oe)},he=le=>{var Pe=er();De(()=>je(Pe,e.toast.description)),A(le,Pe)};xe(re,le=>{typeof e.toast.description!="string"?le(ae):le(he,-1)})}De(le=>Gn(Rt,1,le),[()=>{var le,Pe;return Xi(ho(s(),d(x),(le=d(oe))==null?void 0:le.description,(Pe=e.toast.classes)==null?void 0:Pe.description))}]),A(St,Rt)};xe(Ae,St=>{e.toast.description&&St(Ie)})}var pt=ee(Xe,2);{var Le=St=>{var Rt=qe(),re=Me(Rt);{var ae=Pe=>{var Oe=qe(),Re=Me(Oe);Tn(Re,()=>e.toast.cancel,(Ce,He)=>{He(Ce,{})}),A(Pe,Oe)},he=Pe=>{var Oe=vF(),Re=j(Oe);De(Ce=>{Ks(Oe,e.toast.cancelButtonStyle??r()),Gn(Oe,1,Ce),je(Re,e.toast.cancel.label)},[()=>{var Ce,He,Ge;return Xi(ho((Ce=d(oe))==null?void 0:Ce.cancelButton,(Ge=(He=e.toast)==null?void 0:He.classes)==null?void 0:Ge.cancelButton))}]),Ln("click",Oe,Ce=>{var He,Ge;Ip(e.toast.cancel)&&d(O)&&((Ge=(He=e.toast.cancel)==null?void 0:He.onClick)==null||Ge.call(He,Ce),$())}),A(Pe,Oe)},le=V(()=>Ip(e.toast.cancel));xe(re,Pe=>{typeof e.toast.cancel=="function"?Pe(ae):d(le)&&Pe(he,1)})}A(St,Rt)};xe(pt,St=>{e.toast.cancel&&St(Le)})}var gt=ee(pt,2);{var nn=St=>{var Rt=qe(),re=Me(Rt);{var ae=Pe=>{var Oe=qe(),Re=Me(Oe);Tn(Re,()=>e.toast.action,(Ce,He)=>{He(Ce,{})}),A(Pe,Oe)},he=Pe=>{var Oe=bF(),Re=j(Oe);De(Ce=>{Ks(Oe,e.toast.actionButtonStyle??i()),Gn(Oe,1,Ce),je(Re,e.toast.action.label)},[()=>{var Ce,He,Ge;return Xi(ho((Ce=d(oe))==null?void 0:Ce.actionButton,(Ge=(He=e.toast)==null?void 0:He.classes)==null?void 0:Ge.actionButton))}]),Ln("click",Oe,Ce=>{var He;Ip(e.toast.action)&&((He=e.toast.action)==null||He.onClick(Ce),!Ce.defaultPrevented&&$())}),A(Pe,Oe)},le=V(()=>Ip(e.toast.action));xe(re,Pe=>{typeof e.toast.action=="function"?Pe(ae):d(le)&&Pe(he,1)})}A(St,Rt)};xe(gt,St=>{e.toast.action&&St(nn)})}De((St,Rt)=>{Gn(Xe,1,St),Gn(et,1,Rt)},[()=>{var St,Rt,re;return Xi(ho((St=d(oe))==null?void 0:St.content,(re=(Rt=e.toast)==null?void 0:Rt.classes)==null?void 0:re.content))},()=>{var St,Rt,re;return Xi(ho((St=d(oe))==null?void 0:St.title,(re=(Rt=e.toast)==null?void 0:Rt.classes)==null?void 0:re.title))}]),A(se,_e)};xe(en,se=>{e.toast.component?se(tn):se(Qn,-1)})}kr(be,se=>I(y,se),()=>d(y)),De((se,_e,me)=>{Gn(be,1,se),ut(be,"aria-live",e.toast.important?"assertive":"polite"),ut(be,"data-rich-colors",e.toast.richColors??a()),ut(be,"data-styled",!(e.toast.component||e.toast.unstyled||o())),ut(be,"data-mounted",d(c)),ut(be,"data-promise",_e),ut(be,"data-swiped",d(p)),ut(be,"data-removed",d(u)),ut(be,"data-visible",d(E)),ut(be,"data-y-position",d(z)[0]),ut(be,"data-x-position",d(z)[1]),ut(be,"data-index",e.index),ut(be,"data-front",d(S)),ut(be,"data-swiping",d(f)),ut(be,"data-dismissible",d(O)),ut(be,"data-type",d(M)),ut(be,"data-invert",d(G)),ut(be,"data-swipe-out",d(h)),ut(be,"data-swipe-direction",d(k)),ut(be,"data-expanded",me),xt=Ks(be,`${e.style} ${e.toast.style}`,xt,{"--index":e.index,"--toasts-before":e.index,"--z-index":Kn.toasts.length-e.index,"--offset":`${d(u)?d(g):d(fe)}px`,"--initial-height":e.expandByDefault?"auto":`${d(m)}px`})},[()=>{var se,_e,me,ve,Xe,et;return Xi(ho(e.class,d(P),(se=d(oe))==null?void 0:se.toast,(me=(_e=e.toast)==null?void 0:_e.classes)==null?void 0:me.toast,(ve=d(oe))==null?void 0:ve[d(M)],(et=(Xe=e.toast)==null?void 0:Xe.classes)==null?void 0:et[d(M)]))},()=>!!e.toast.promise,()=>!!(e.expanded||e.expandByDefault&&d(c))]),Ln("pointermove",be,ct),Ln("pointerup",be,ke),Ln("pointerdown",be,Ue),Mi("dragend",be,Ee),A(t,be),Et()}Fo(["pointermove","pointerup","pointerdown","click"]);var _F=Ui('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" height="20" width="20" data-sonner-success-icon=""><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd"></path></svg>');function SF(t){var e=_F();A(t,e)}var kF=Ui('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" height="20" width="20" data-sonner-error-icon=""><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>');function MF(t){var e=kF();A(t,e)}var TF=Ui('<svg viewBox="0 0 64 64" fill="currentColor" height="20" width="20" data-sonner-warning-icon="" xmlns="http://www.w3.org/2000/svg"><path d="M32.427,7.987c2.183,0.124 4,1.165 5.096,3.281l17.936,36.208c1.739,3.66 -0.954,8.585 -5.373,8.656l-36.119,0c-4.022,-0.064 -7.322,-4.631 -5.352,-8.696l18.271,-36.207c0.342,-0.65 0.498,-0.838 0.793,-1.179c1.186,-1.375 2.483,-2.111 4.748,-2.063Zm-0.295,3.997c-0.687,0.034 -1.316,0.419 -1.659,1.017c-6.312,11.979 -12.397,24.081 -18.301,36.267c-0.546,1.225 0.391,2.797 1.762,2.863c12.06,0.195 24.125,0.195 36.185,0c1.325,-0.064 2.321,-1.584 1.769,-2.85c-5.793,-12.184 -11.765,-24.286 -17.966,-36.267c-0.366,-0.651 -0.903,-1.042 -1.79,-1.03Z"></path><path d="M33.631,40.581l-3.348,0l-0.368,-16.449l4.1,0l-0.384,16.449Zm-3.828,5.03c0,-0.609 0.197,-1.113 0.592,-1.514c0.396,-0.4 0.935,-0.601 1.618,-0.601c0.684,0 1.223,0.201 1.618,0.601c0.395,0.401 0.593,0.905 0.593,1.514c0,0.587 -0.193,1.078 -0.577,1.473c-0.385,0.395 -0.929,0.593 -1.634,0.593c-0.705,0 -1.249,-0.198 -1.634,-0.593c-0.384,-0.395 -0.576,-0.886 -0.576,-1.473Z"></path></svg>');function EF(t){var e=TF();A(t,e)}var AF=Ui('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" height="20" width="20" data-sonner-info-icon=""><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z" clip-rule="evenodd"></path></svg>');function PF(t){var e=AF();A(t,e)}var CF=Ui('<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" data-sonner-close-icon=""><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>');function OF(t){var e=CF();A(t,e)}const RF=3,XT="24px",ZT="16px",NF=4e3,IF=356,zF=14,$0="dark",zp="light";function LF(t,e){const n={};return[t,e].forEach((r,i)=>{const s=i===1,o=s?"--mobile-offset":"--offset",a=s?ZT:XT;function l(c){["top","right","bottom","left"].forEach(u=>{n[`${o}-${u}`]=typeof c=="number"?`${c}px`:c})}typeof r=="number"||typeof r=="string"?l(r):typeof r=="object"?["top","right","bottom","left"].forEach(c=>{const u=r[c];u===void 0?n[`${o}-${c}`]=a:n[`${o}-${c}`]=typeof u=="number"?`${u}px`:u}):l(a)}),n}var DF=new Set(["$$slots","$$events","$$legacy","invert","position","hotkey","expand","closeButton","offset","mobileOffset","theme","richColors","duration","visibleToasts","toastOptions","dir","gap","pauseWhenPageIsHidden","loadingIcon","successIcon","errorIcon","warningIcon","closeIcon","infoIcon","containerAriaLabel","class","closeButtonAriaLabel","onblur","onfocus","onmouseenter","onmousemove","onmouseleave","ondragend","onpointerdown","onpointerup"]),FF=ne("<ol></ol>"),BF=ne('<section aria-live="polite" aria-relevant="additions text" aria-atomic="false" class="svelte-nbs0zk"><!></section>');function jF(t,e){Tt(e,!0);function n($){return $!=="system"?$:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?$0:zp}let r=te(e,"invert",3,!1),i=te(e,"position",3,"bottom-right"),s=te(e,"hotkey",19,()=>["altKey","KeyT"]),o=te(e,"expand",3,!1),a=te(e,"closeButton",3,!1),l=te(e,"offset",3,XT),c=te(e,"mobileOffset",3,ZT),u=te(e,"theme",3,"light"),f=te(e,"richColors",3,!1),h=te(e,"duration",3,NF),p=te(e,"visibleToasts",3,RF),g=te(e,"toastOptions",19,()=>({})),m=te(e,"dir",7,"auto"),b=te(e,"gap",3,zF),y=te(e,"pauseWhenPageIsHidden",3,!1),_=te(e,"containerAriaLabel",3,"Notifications"),k=te(e,"closeButtonAriaLabel",3,"Close toast"),S=ht(e,DF);function E(){if(m()!=="auto")return m();if(typeof window>"u"||typeof document>"u")return"ltr";const $=document.documentElement.getAttribute("dir");return $==="auto"||!$?(br(()=>m(window.getComputedStyle(document.documentElement).direction??"ltr")),m()):(br(()=>m($)),$)}const M=V(()=>Array.from(new Set([i(),...Kn.toasts.filter($=>$.position).map($=>$.position)].filter(Boolean))));let O=Se(!1),P=Se(!1),x=Se(gn(n(u()))),C=Se(void 0),R=Se(null),N=Se(!1);const B=V(()=>s().join("+").replace(/Key/g,"").replace(/Digit/g,""));Qt(()=>{Kn.toasts.length<=1&&I(O,!1)}),Qt(()=>{const $=Kn.toasts.filter(de=>de.dismiss&&!de.delete);if($.length>0){const de=Kn.toasts.map(Be=>$.find(Je=>Je.id===Be.id)?{...Be,delete:!0}:Be);Kn.toasts=de}}),Qt(()=>()=>{d(C)&&d(R)&&(d(R).focus({preventScroll:!0}),I(R,null),I(N,!1))}),os(()=>(Kn.reset(),Ar(document,"keydown",de=>{var wt,Je;s().every(Ue=>de[Ue]||de.code===Ue)&&(I(O,!0),(wt=d(C))==null||wt.focus()),de.code==="Escape"&&(document.activeElement===d(C)||(Je=d(C))!=null&&Je.contains(document.activeElement))&&I(O,!1)}))),Qt(()=>{if(u()!=="system"&&I(x,u()),typeof window<"u"){u()==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?I(x,$0):I(x,zp));const $=window.matchMedia("(prefers-color-scheme: dark)"),de=({matches:Be})=>{u()==="system"&&I(x,Be?$0:zp,!0)};"addEventListener"in $?$.addEventListener("change",de):$.addListener(de)}});const z=$=>{var de;(de=e.onblur)==null||de.call(e,$),d(N)&&!$.currentTarget.contains($.relatedTarget)&&(I(N,!1),d(R)&&(d(R).focus({preventScroll:!0}),I(R,null)))},H=$=>{var Be;(Be=e.onfocus)==null||Be.call(e,$),!($.target instanceof HTMLElement&&$.target.dataset.dismissible==="false")&&(d(N)||(I(N,!0),I(R,$.relatedTarget,!0)))},X=$=>{var Be;(Be=e.onpointerdown)==null||Be.call(e,$),!($.target instanceof HTMLElement&&$.target.dataset.dismissible==="false")&&I(P,!0)},G=$=>{var de;(de=e.onmouseenter)==null||de.call(e,$),I(O,!0)},Z=$=>{var de;(de=e.onmouseleave)==null||de.call(e,$),d(P)||I(O,!1)},oe=$=>{var de;(de=e.onmousemove)==null||de.call(e,$),I(O,!0)},K=$=>{var de;(de=e.ondragend)==null||de.call(e,$),I(O,!1)},q=$=>{var de;(de=e.onpointerup)==null||de.call(e,$),I(P,!1)};eF.set(new iF);var W=BF();ut(W,"tabindex",-1);var J=j(W);{var fe=$=>{var de=qe(),Be=Me(de);Rn(Be,18,()=>d(M),wt=>wt,(wt,Je,Ue,ke)=>{const ct=V(()=>{const[be,xt]=Je.split("-");return{y:be,x:xt}}),Ee=V(()=>LF(l(),c()));var Ve=FF();_r(Ve,be=>{var xt;return{tabindex:-1,dir:be,class:e.class,"data-sonner-toaster":!0,"data-sonner-theme":d(x),"data-y-position":d(ct).y,"data-x-position":d(ct).x,style:e.style,onblur:z,onfocus:H,onmouseenter:G,onmousemove:oe,onmouseleave:Z,ondragend:K,onpointerdown:X,onpointerup:q,...S,[qc]:{"--front-toast-height":`${(xt=Kn.heights[0])==null?void 0:xt.height}px`,"--width":`${IF}px`,"--gap":`${b()}px`,"--offset-top":d(Ee)["--offset-top"],"--offset-right":d(Ee)["--offset-right"],"--offset-bottom":d(Ee)["--offset-bottom"],"--offset-left":d(Ee)["--offset-left"],"--mobile-offset-top":d(Ee)["--mobile-offset-top"],"--mobile-offset-right":d(Ee)["--mobile-offset-right"],"--mobile-offset-bottom":d(Ee)["--mobile-offset-bottom"],"--mobile-offset-left":d(Ee)["--mobile-offset-left"]}}},[()=>E()],void 0,void 0,"svelte-nbs0zk"),Rn(Ve,23,()=>Kn.toasts.filter(be=>!be.position&&d(Ue)===0||be.position===Je),be=>be.id,(be,xt,_t,Yt)=>{{const en=Le=>{var gt=qe(),nn=Me(gt);{var St=re=>{var ae=qe(),he=Me(ae);Zt(he,()=>e.successIcon??an),A(re,ae)},Rt=re=>{SF(re)};xe(nn,re=>{e.successIcon?re(St):e.successIcon!==null&&re(Rt,1)})}A(Le,gt)},tn=Le=>{var gt=qe(),nn=Me(gt);{var St=re=>{var ae=qe(),he=Me(ae);Zt(he,()=>e.errorIcon??an),A(re,ae)},Rt=re=>{MF(re)};xe(nn,re=>{e.errorIcon?re(St):e.errorIcon!==null&&re(Rt,1)})}A(Le,gt)},Qn=Le=>{var gt=qe(),nn=Me(gt);{var St=re=>{var ae=qe(),he=Me(ae);Zt(he,()=>e.warningIcon??an),A(re,ae)},Rt=re=>{EF(re)};xe(nn,re=>{e.warningIcon?re(St):e.warningIcon!==null&&re(Rt,1)})}A(Le,gt)},se=Le=>{var gt=qe(),nn=Me(gt);{var St=re=>{var ae=qe(),he=Me(ae);Zt(he,()=>e.infoIcon??an),A(re,ae)},Rt=re=>{PF(re)};xe(nn,re=>{e.infoIcon?re(St):e.infoIcon!==null&&re(Rt,1)})}A(Le,gt)},_e=Le=>{var gt=qe(),nn=Me(gt);{var St=re=>{var ae=qe(),he=Me(ae);Zt(he,()=>e.closeIcon??an),A(re,ae)},Rt=re=>{OF(re)};xe(nn,re=>{e.closeIcon?re(St):e.closeIcon!==null&&re(Rt,1)})}A(Le,gt)};let me=V(()=>{var Le;return((Le=g())==null?void 0:Le.duration)??h()}),ve=V(()=>{var Le;return((Le=g())==null?void 0:Le.class)??""}),Xe=V(()=>{var Le;return((Le=g())==null?void 0:Le.descriptionClass)||""}),et=V(()=>{var Le;return((Le=g())==null?void 0:Le.style)??""}),dt=V(()=>g().classes||{}),ge=V(()=>g().unstyled??!1),Ae=V(()=>{var Le;return((Le=g())==null?void 0:Le.cancelButtonStyle)??""}),Ie=V(()=>{var Le;return((Le=g())==null?void 0:Le.actionButtonStyle)??""}),pt=V(()=>{var Le;return((Le=g())==null?void 0:Le.closeButtonAriaLabel)??k()});xF(be,{get index(){return d(_t)},get toast(){return d(xt)},get defaultRichColors(){return f()},get duration(){return d(me)},get class(){return d(ve)},get descriptionClass(){return d(Xe)},get invert(){return r()},get visibleToasts(){return p()},get closeButton(){return a()},get interacting(){return d(P)},get position(){return Je},get style(){return d(et)},get classes(){return d(dt)},get unstyled(){return d(ge)},get cancelButtonStyle(){return d(Ae)},get actionButtonStyle(){return d(Ie)},get closeButtonAriaLabel(){return d(pt)},get expandByDefault(){return o()},get expanded(){return d(O)},get pauseWhenPageIsHidden(){return y()},get loadingIcon(){return e.loadingIcon},successIcon:en,errorIcon:tn,warningIcon:Qn,infoIcon:se,closeIcon:_e,$$slots:{successIcon:!0,errorIcon:!0,warningIcon:!0,infoIcon:!0,closeIcon:!0}})}}),kr(Ve,be=>I(C,be),()=>d(C)),De(()=>Ve.dir=Ve.dir),A(wt,Ve)}),A($,de)};xe(J,$=>{Kn.toasts.length>0&&$(fe)})}De(()=>ut(W,"aria-label",`${_()??""} ${d(B)??""}`)),A(t,W),Et()}var UF=ne("<!> <!> <!> <!>",1),WF=ne('<p class="text-sm text-muted-foreground"> </p>'),X_=ne('<div class="flex flex-col gap-1"></div>'),qF=ne('<div class="markdown-body max-w-none text-xs"></div>'),HF=ne('<p class="text-xs text-muted-foreground">No content.</p>'),VF=ne('<div class="flex flex-col gap-0.5"><p class="font-mono text-muted-foreground"> </p> <p class="whitespace-pre-wrap break-words rounded-md bg-muted/40 p-1.5"> </p></div>'),$F=ne('<span class="shrink-0 font-mono text-muted-foreground"> </span>'),GF=ne('<span class="font-medium"> </span>'),YF=ne('<p class="whitespace-pre-wrap break-words text-muted-foreground"> </p>'),KF=ne('<div class="rounded-sm border-l-2 border-muted-foreground/30 pl-1.5"><div class="flex items-baseline gap-1.5"><!> <!></div> <!></div>'),XF=ne('<div class="flex flex-col gap-0.5"><p class="font-mono text-muted-foreground"> </p> <div class="flex flex-col gap-1"></div></div>'),ZF=ne('<div class="flex items-start justify-between gap-3"><dt class="shrink-0 font-mono text-muted-foreground"> </dt> <dd class="min-w-0 flex-1 break-words text-right"> </dd></div>'),QF=ne('<div class="flex flex-col gap-0.5"><p class="font-mono text-muted-foreground"> </p> <dl class="flex flex-col gap-0.5 rounded-md bg-muted/40 p-1.5"></dl></div>'),JF=ne('<pre class="overflow-x-auto whitespace-pre-wrap break-words text-left"> </pre>'),e7=ne('<div class="flex items-start justify-between gap-3 border-b pb-1 last:border-0"><dt class="shrink-0 font-mono text-muted-foreground"> </dt> <dd class="min-w-0 flex-1 break-words text-right"><!></dd></div>'),t7=ne('<div class="flex flex-col gap-2 text-xs"></div>'),n7=ne('<p class="text-xs text-muted-foreground">No attributes.</p>'),r7=ne('<button type="button" class="min-w-0 flex-1 truncate text-left hover:underline hover:text-foreground"> </button> <span class="shrink-0 text-muted-foreground"> </span> <button type="button" class="min-w-0 flex-1 truncate text-left hover:underline hover:text-foreground"> </button>',1),i7=ne('<span class="min-w-0 flex-1 truncate"> </span> <span class="shrink-0 text-muted-foreground"> </span> <span class="min-w-0 flex-1 truncate"> </span>',1),s7=ne('<div class="flex min-w-0 items-center gap-1 font-mono text-xs"><!></div>'),o7=ne('<p class="text-xs text-muted-foreground">No direct relations.</p>'),Z_=ne('<div><div class="mb-1 text-[10px] font-medium tracking-wide text-muted-foreground uppercase"> </div> <div class="flex flex-col gap-1"></div></div>'),a7=ne('<button type="button" class="self-start text-[11px] text-muted-foreground underline-offset-2 hover:underline"> </button>'),l7=ne('<div class="flex flex-col gap-3"><!> <!> <!></div>'),c7=ne('<div><p class="mb-1 text-xs text-muted-foreground"> </p> <div></div></div>'),u7=ne('<div class="grid grid-cols-1 gap-4 @2xl:grid-cols-2"></div>'),d7=ne('<p class="text-xs text-muted-foreground">No metrics tracked.</p>'),f7=ne('<div class="flex justify-end gap-1.5"><!> <!> <!></div>'),h7=ne('<div class="flex flex-col gap-1 border-b pb-1.5 text-xs last:border-0 last:pb-0"><div class="flex items-center justify-between gap-2"><span> </span> <div class="flex items-center gap-1"><!> <!></div></div> <!></div>'),Q_=ne('<p class="text-xs text-muted-foreground">None.</p>'),J_=ne('<div class="flex flex-col gap-1.5"></div>'),e2=ne('<span class="text-muted-foreground"> </span>'),p7=ne('<pre class="mt-1 max-h-64 overflow-auto rounded bg-muted p-2 font-mono text-[11px] leading-snug whitespace-pre-wrap"> </pre>'),g7=ne('<p class="mt-1 text-xs text-muted-foreground italic">Waiting for output…</p>'),m7=ne('<div class="flex items-center gap-1.5 text-[11px] text-muted-foreground"><span class="size-1.5 animate-pulse rounded-full bg-warning"></span> <span> </span></div>'),v7=ne("<!> <!>",1),b7=ne('<div class="flex flex-col gap-1 border-b pb-1.5 text-xs last:border-0 last:pb-0"><div class="flex items-center justify-between gap-2"><button type="button" class="flex-1 truncate text-left font-mono hover:underline disabled:cursor-default disabled:no-underline"> </button> <div class="flex shrink-0 items-center gap-1"><!> <!></div></div> <div class="flex items-center gap-2 text-muted-foreground"><span> </span> <span>·</span> <span> </span></div> <!></div>'),y7=ne('<button type="button" class="min-w-0 flex-1 truncate text-left hover:underline hover:text-foreground"> </button>'),w7=ne('<span class="min-w-0 flex-1 truncate"> </span>'),x7=ne('<div class="flex items-center justify-between gap-2 border-b pb-1 text-xs last:border-0 last:pb-0"><!> <div class="flex shrink-0 items-center gap-1"><!> <!></div></div>'),_7=ne('<p class="text-xs text-muted-foreground">No tasks have acted on this entity.</p>'),S7=ne('<div class="text-xs"><!> </div>'),k7=ne('<p class="text-xs text-muted-foreground">None linked.</p>'),M7=ne('<div class="flex items-center justify-between gap-2 text-xs"><span class="font-mono text-muted-foreground"> </span> <span class="truncate"> </span></div>'),T7=ne('<p class="text-xs text-muted-foreground">No events yet.</p>'),t2=ne('<div class="flex max-h-72 flex-col gap-1 overflow-y-auto"></div>'),E7=ne('<div class="flex flex-col gap-0.5 border-b pb-1 text-xs last:border-0 last:pb-0"><div class="flex items-center justify-between gap-2"><span class="font-mono text-muted-foreground"> </span> <!></div> <span class="truncate text-muted-foreground"> </span></div>'),A7=ne('<p class="text-xs text-muted-foreground">No audit entries.</p>'),P7=ne('<div class="flex items-center justify-between gap-2 border-b pb-1.5 text-xs last:border-0 last:pb-0"><div class="flex min-w-0 items-center gap-2"><span></span> <span class="truncate font-mono"> </span></div> <div class="flex shrink-0 items-center gap-2 text-muted-foreground"><span> </span> <button type="button" class="rounded border px-1.5 py-0.5 hover:bg-muted" title="Disable this check">disable</button></div></div>'),C7=ne('<p class="text-xs text-muted-foreground">No checks configured. This entity is unmonitored — its health cannot be known.</p>'),O7=ne('<p class="pt-1 text-[11px] text-muted-foreground"> </p>'),R7=ne('<div class="flex flex-col gap-1.5"><!> <!></div>'),N7=ne('<button type="button" class="flex items-center justify-between gap-2 border-b pb-1 text-left last:border-0 last:pb-0 hover:text-foreground"><span class="truncate font-mono text-muted-foreground"> </span> <span class="shrink-0 text-muted-foreground"> </span></button>'),I7=ne(`<div class="flex flex-col gap-1"></div> <p class="text-[11px] text-muted-foreground">Reachable by following this entity's own dependencies. Does not yet include things that
point at it.</p>`,1),z7=ne('<p class="text-muted-foreground">Nothing downstream depends on this.</p>'),L7=ne('<div class="flex flex-col gap-2 text-xs"><!></div>'),D7=ne('<div class="flex flex-col gap-1"><h4 class="text-[11px] font-medium tracking-wide text-muted-foreground uppercase">Open signals</h4> <!></div>'),F7=ne('<div class="flex flex-col gap-1"><h4 class="text-[11px] font-medium tracking-wide text-muted-foreground uppercase">Executions</h4> <!></div>'),B7=ne('<div class="flex flex-col gap-1"><h4 class="text-[11px] font-medium tracking-wide text-muted-foreground uppercase">Tasks</h4> <!></div>'),j7=ne('<div class="flex flex-col gap-1"><h4 class="text-[11px] font-medium tracking-wide text-muted-foreground uppercase">Events</h4> <!></div>'),U7=ne('<p class="text-xs text-muted-foreground">Nothing has happened here yet.</p>'),W7=ne('<div class="flex flex-col gap-3"><!> <!> <!> <!> <!></div>'),q7=ne('<div class="flex flex-col gap-1"><h4 class="text-[11px] font-medium tracking-wide text-muted-foreground uppercase">Knowledge</h4> <!></div>'),H7=ne('<div class="flex flex-col gap-1"><h4 class="text-[11px] font-medium tracking-wide text-muted-foreground uppercase">Audit</h4> <!></div>'),V7=ne('<div class="flex flex-col gap-3"><div class="flex flex-col gap-1"><h4 class="text-[11px] font-medium tracking-wide text-muted-foreground uppercase">Relations</h4> <!></div> <div class="flex flex-col gap-1"><h4 class="text-[11px] font-medium tracking-wide text-muted-foreground uppercase">Attributes</h4> <!></div> <!> <!></div>'),$7=ne("<span>·</span><!>",1),G7=ne('<span class="text-xs text-muted-foreground"> </span>'),Y7=ne('<p class="text-xs text-muted-foreground"> </p>'),K7=ne('<p class="text-xs text-warning"> </p>'),X7=ne('<div class="flex flex-col gap-1"><div class="flex items-center gap-2 text-sm"><span></span> <span class="font-medium"> </span> <!></div> <!> <!></div>'),Z7=ne('<header class="flex flex-col gap-2 rounded-lg border bg-card px-3 py-2.5"><div class="flex items-start justify-between gap-3"><div class="flex min-w-0 flex-col gap-0.5"><h1 class="truncate font-mono text-sm font-semibold"> </h1> <div class="flex flex-wrap items-center gap-1.5 text-[11px] text-muted-foreground"><span> </span> <!></div></div> <!></div> <!></header> <!>',1),Q7=ne('<div class="flex h-full flex-col gap-1.5 overflow-y-auto p-2"><!></div>');function J7(t,e){Tt(e,!0);const n=()=>zn(mc,"$liveEvents",r),[r,i]=ro(),s=new Set(["document","investigation","runbook"]);let o=Se(null),a=Se(gn([])),l=Se(gn([])),c=Se(gn([])),u=Se(gn([])),f=Se(gn([])),h=Se(null),p=Se(""),g=Se(null),m=Se(!0),b=Se(gn([])),y=Se(gn([])),_=Se(null),k=Se(gn([])),S=Se(gn([])),E=Se(gn([])),M=Se(gn([])),O=Se(!1),P=Se(!0),x=Se(null),C={};const R=8,N=V(()=>Math.max(d(X).length-R,0)+Math.max(d(G).length-R,0)),B=V(()=>M8(d(o),d(k))),z=V(()=>d(u).filter(ge=>!["resolved","failed"].includes(ge.state)));function H(){d(o)&&Gz(C8(d(o),d(B)))}const X=V(()=>d(o)?d(a).filter(ge=>ge.source===d(o).slug):[]),G=V(()=>d(o)?d(a).filter(ge=>ge.target===d(o).slug&&ge.source!==d(o).slug):[]);async function Z(ge){if(I(P,!0),I(o,await II(ge),!0),!d(o)){I(P,!1);return}const[Ae,Ie,pt,Le,gt,nn,St,Rt,re,ae,he,le]=await Promise.all([RI(d(o).id),zI(d(o).id),BI(d(o).id),Ex(d(o).id),mb(d(o).id),jI(d(o)),LI(d(o).id),s.has(d(o).type)?DI(d(o).id):Promise.resolve(null),Ax(d(o).slug),WI({entity_id:d(o).id,limit:50}),qI({entity_id:d(o).id,limit:50}),$_(d(o).type)?NI(d(o).slug,2):Promise.resolve([])]);I(a,Ae,!0),I(l,Ie,!0),I(c,pt,!0),I(u,Le,!0),I(f,gt,!0),I(b,nn,!0),I(y,St,!0),I(_,Rt,!0),I(k,re,!0),I(S,ae,!0),I(E,he,!0),I(M,le,!0),I(P,!1),await uf(),ke()}async function oe(ge){I(x,ge,!0);const Ae=await PI(ge);I(x,null),Ae?(Oa.success("Signal acknowledged"),I(u,d(u).map(Ie=>Ie.id===ge?Ae:Ie),!0)):Oa.error("Acknowledge failed")}async function K(ge){I(x,ge,!0);const Ae=await CI(ge);I(x,null),Ae?(Oa.success("Signal resolved"),I(u,d(u).map(Ie=>Ie.id===ge?Ae:Ie),!0)):Oa.error("Resolve failed")}async function q(ge){I(x,ge,!0);const Ae=new Date(Date.now()+3600*1e3).toISOString(),Ie=await OI(ge,Ae);I(x,null),Ie?(Oa.success("Signal muted for 1h"),I(u,d(u).map(pt=>pt.id===ge?Ie:pt),!0)):Oa.error("Mute failed")}const W=new Set(["running","approved","executing","pending_approval"]);function J(ge){return W.has(ge.status)}async function fe(ge){const Ae=await TM(ge);d(h)===ge&&(I(p,Ae.combined,!0),d(m)&&(await uf(),d(g)&&(d(g).scrollTop=d(g).scrollHeight)))}async function $(ge){if(d(h)===ge.id){I(h,null),I(p,"");return}I(h,ge.id,!0),I(p,""),I(m,!0),await fe(ge.id)}function de(){d(g)&&I(m,d(g).scrollHeight-d(g).scrollTop-d(g).clientHeight<24)}Qt(()=>{const ge=n()[0];ge&&br(()=>Be(ge))});function Be(ge){if(ge.type.startsWith("execution.")){if(ge.type==="execution.output"){const Ae=d(h);Ae&&ge.entity_id===Ae&&fe(Ae);return}if(!d(o))return;d(f).some(Ae=>Ae.id===ge.entity_id)&&Ue();return}if(!(!d(o)||ge.entity_id!==d(o).id)){if(VT(ge)){I(o,S8(d(o),ge),!0),wt();return}(ge.type.startsWith("signal.")||ge.type.startsWith("coverage."))&&Je()}}async function wt(){var Ie;if(!d(o))return;const ge=d(o).slug,Ae=await Ax(ge);((Ie=d(o))==null?void 0:Ie.slug)===ge&&I(k,Ae,!0)}async function Je(){var Ie;if(!d(o))return;const ge=d(o).id,Ae=await Ex(ge);((Ie=d(o))==null?void 0:Ie.id)===ge&&I(u,Ae,!0)}async function Ue(){var Ie;if(!d(o))return;const ge=d(o).id,Ae=await mb(ge);((Ie=d(o))==null?void 0:Ie.id)===ge&&I(f,Ae,!0)}os(()=>(Z(e.slug),od())),Qt(()=>{e.slug&&Z(e.slug)});function ke(){for(const ge of d(l)){const Ae=C[ge.metric];if(!Ae)continue;Ae.innerHTML="";const Ie=ge.samples.map(Le=>new Date(Le.ts).getTime()/1e3),pt=ge.samples.map(Le=>Le.value??Le.avg??null);new hi({width:Ae.clientWidth||400,height:160,series:[{},{label:ge.metric,stroke:"#58a6ff",width:2}],axes:[{stroke:"#8b949e"},{stroke:"#8b949e"}],scales:{x:{time:!0}},legend:{show:!1}},[Ie,pt],Ae)}}function ct(ge){const Ae=ge.action.indexOf(":");if(Ae<0)return ge.action;const Ie=ge.action.slice(0,Ae),pt=ge.action.slice(Ae+1);try{const Le=JSON.parse(pt);if(typeof(Le==null?void 0:Le.command)=="string")return Le.command;if(typeof(Le==null?void 0:Le.purpose)=="string")return`${Ie}${Le.purpose}`}catch{return`${Ie} ${pt}`}return Ie}function Ee(ge){const Ae=ge.result;if(!Ae)return"";const Ie=[];return typeof Ae.error=="string"&&Ae.error&&Ie.push(Ae.error),typeof Ae.output=="string"&&Ae.output&&Ie.push(Ae.output),Ie.join(`
`).trim()}function Ve(ge){return ge==="failed"||ge==="denied"||ge==="revoked"?"destructive":ge==="completed"?"default":ge==="running"||ge==="pending_approval"?"secondary":"outline"}function be(ge){if(ge==null)return"—";if(ge<1e3)return`${ge}ms`;const Ae=Math.round(ge/1e3);return Ae<60?`${Ae}s`:`${Math.floor(Ae/60)}m ${Ae%60}s`}function xt(ge){return ge==="critical"?"destructive":ge==="warning"?"secondary":"default"}const _t={healthy:"bg-success",degraded:"bg-warning",down:"bg-destructive",stale:"bg-warning/50",unknown:"bg-muted-foreground/40"};async function Yt(ge){const Ae=await UI(ge.id,ge.version,{enabled:!ge.enabled});Ae?(I(k,d(k).map(Ie=>Ie.id===ge.id?Ae:Ie),!0),Oa.success(`${ge.slug} ${Ae.enabled?"enabled":"disabled"}`)):Oa.error("Failed to update check")}const en=new Set(["description","content","summary","notes","note","body","details"]);function tn(ge){return Array.isArray(ge)&&ge.length>0&&ge.every(Ae=>Ae&&typeof Ae=="object"&&!Array.isArray(Ae)&&("title"in Ae||"body"in Ae))}function Qn(ge){return!!ge&&typeof ge=="object"&&!Array.isArray(ge)&&Object.values(ge).every(Ae=>Ae===null||typeof Ae!="object")}function se(ge){return HT.sanitize(Wn.parse(ge,{async:!1}))}function _e(ge){return Object.entries(ge).map(([Ae,Ie])=>typeof Ie=="string"&&(en.has(Ae)||Ie.length>120)?{key:Ae,kind:"long-text",value:Ie}:tn(Ie)?{key:Ae,kind:"changelog",value:Ie}:Qn(Ie)?{key:Ae,kind:"flat-object",value:Ie}:{key:Ae,kind:"simple",value:Ie})}var me=Q7(),ve=j(me);{var Xe=ge=>{var Ae=UF(),Ie=Me(Ae);Np(Ie,{class:"h-6 w-48"});var pt=ee(Ie,2);Np(pt,{class:"h-8 w-full"});var Le=ee(pt,2);Np(Le,{class:"h-8 w-full"});var gt=ee(Le,2);Np(gt,{class:"h-8 w-full"}),A(ge,Ae)},et=ge=>{var Ae=WF(),Ie=j(Ae);De(()=>je(Ie,`Entity "${e.slug??""}" not found.`)),A(ge,Ae)},dt=ge=>{const Ae=bt=>{var pe=qe(),Ze=Me(pe);{var We=rt=>{var $e=qF();BS($e,()=>se(d(_).content),!0),A(rt,$e)},mt=rt=>{var $e=HF();A(rt,$e)};xe(Ze,rt=>{d(_)?rt(We):rt(mt,-1)})}A(bt,pe)},Ie=bt=>{var pe=qe(),Ze=Me(pe);{var We=$e=>{const Bt=V(()=>_e(d(o).attributes));var At=t7();Rn(At,21,()=>d(Bt),vt=>vt.key,(vt,Pt)=>{var Kt=qe(),Mt=Me(Kt);{var Ct=sn=>{var mn=VF(),Bn=j(mn),qn=j(Bn),vn=ee(Bn,2),Vr=j(vn);De(()=>{je(qn,d(Pt).key),je(Vr,d(Pt).value)}),A(sn,mn)},Ht=sn=>{var mn=XF(),Bn=j(mn),qn=j(Bn),vn=ee(Bn,2);Rn(vn,21,()=>d(Pt).value,$s,(Vr,Pn)=>{var Yn=KF(),sr=j(Yn),pr=j(sr);{var mi=Hn=>{var Ye=$F(),F=j(Ye);De(()=>je(F,d(Pn).date)),A(Hn,Ye)};xe(pr,Hn=>{d(Pn).date&&Hn(mi)})}var ls=ee(pr,2);{var io=Hn=>{var Ye=GF(),F=j(Ye);De(()=>je(F,d(Pn).title)),A(Hn,Ye)};xe(ls,Hn=>{d(Pn).title&&Hn(io)})}var Os=ee(sr,2);{var Mr=Hn=>{var Ye=YF(),F=j(Ye);De(()=>je(F,d(Pn).body)),A(Hn,Ye)};xe(Os,Hn=>{d(Pn).body&&Hn(Mr)})}A(Vr,Yn)}),De(()=>je(qn,`${d(Pt).key??""} (${d(Pt).value.length??""})`)),A(sn,mn)},_n=sn=>{var mn=QF(),Bn=j(mn),qn=j(Bn),vn=ee(Bn,2);Rn(vn,21,()=>Object.entries(d(Pt).value),$s,(Vr,Pn)=>{var Yn=V(()=>j2(d(Pn),2));let sr=()=>d(Yn)[0],pr=()=>d(Yn)[1];var mi=ZF(),ls=j(mi),io=j(ls),Os=ee(ls,2),Mr=j(Os);De(Hn=>{je(io,sr()),je(Mr,Hn)},[()=>String(pr())]),A(Vr,mi)}),De(()=>je(qn,d(Pt).key)),A(sn,mn)},ln=sn=>{var mn=e7(),Bn=j(mn),qn=j(Bn),vn=ee(Bn,2),Vr=j(vn);{var Pn=sr=>{var pr=JF(),mi=j(pr);De(ls=>je(mi,ls),[()=>JSON.stringify(d(Pt).value,null,2)]),A(sr,pr)},Yn=sr=>{var pr=er();De(mi=>je(pr,mi),[()=>String(d(Pt).value)]),A(sr,pr)};xe(Vr,sr=>{d(Pt).value!==null&&typeof d(Pt).value=="object"?sr(Pn):sr(Yn,-1)})}De(()=>je(qn,d(Pt).key)),A(sn,mn)};xe(Mt,sn=>{d(Pt).kind==="long-text"?sn(Ct):d(Pt).kind==="changelog"?sn(Ht,1):d(Pt).kind==="flat-object"?sn(_n,2):sn(ln,-1)})}A(vt,Kt)}),A($e,At)},mt=V(()=>d(o).attributes&&Object.keys(d(o).attributes).length),rt=$e=>{var Bt=n7();A($e,Bt)};xe(Ze,$e=>{d(mt)?$e(We):$e(rt,-1)})}A(bt,pe)},pt=(bt,pe=an)=>{var Ze=s7(),We=j(Ze);{var mt=$e=>{var Bt=r7(),At=Me(Bt),vt=j(At),Pt=ee(At,2),Kt=j(Pt),Mt=ee(Pt,2),Ct=j(Mt);De((Ht,_n)=>{ut(At,"title",pe().source),je(vt,Ht),je(Kt,`${pe().type??""}`),ut(Mt,"title",pe().target),je(Ct,_n)},[()=>zl(pe().source),()=>zl(pe().target)]),Ln("click",At,()=>e.onSelectEntity(pe().source)),Ln("click",Mt,()=>e.onSelectEntity(pe().target)),A($e,Bt)},rt=$e=>{var Bt=i7(),At=Me(Bt),vt=j(At),Pt=ee(At,2),Kt=j(Pt),Mt=ee(Pt,2),Ct=j(Mt);De((Ht,_n)=>{ut(At,"title",pe().source),je(vt,Ht),je(Kt,`${pe().type??""}`),ut(Mt,"title",pe().target),je(Ct,_n)},[()=>zl(pe().source),()=>zl(pe().target)]),A($e,Bt)};xe(We,$e=>{e.onSelectEntity?$e(mt):$e(rt,-1)})}A(bt,Ze)},Le=bt=>{var pe=qe(),Ze=Me(pe);{var We=rt=>{var $e=o7();A(rt,$e)},mt=rt=>{var $e=l7(),Bt=j($e);{var At=Ct=>{var Ht=Z_(),_n=j(Ht),ln=j(_n),sn=ee(_n,2);Rn(sn,21,()=>d(O)?d(X):d(X).slice(0,R),$s,(mn,Bn)=>{pt(mn,()=>d(Bn))}),De(()=>je(ln,`Outgoing (${d(X).length??""})`)),A(Ct,Ht)};xe(Bt,Ct=>{d(X).length&&Ct(At)})}var vt=ee(Bt,2);{var Pt=Ct=>{var Ht=Z_(),_n=j(Ht),ln=j(_n),sn=ee(_n,2);Rn(sn,21,()=>d(O)?d(G):d(G).slice(0,R),$s,(mn,Bn)=>{pt(mn,()=>d(Bn))}),De(()=>je(ln,`Incoming (${d(G).length??""})`)),A(Ct,Ht)};xe(vt,Ct=>{d(G).length&&Ct(Pt)})}var Kt=ee(vt,2);{var Mt=Ct=>{var Ht=a7(),_n=j(Ht);De(()=>je(_n,`Show ${d(N)??""} more`)),Ln("click",Ht,()=>I(O,!0)),A(Ct,Ht)};xe(Kt,Ct=>{!d(O)&&d(N)>0&&Ct(Mt)})}A(rt,$e)};xe(Ze,rt=>{d(X).length===0&&d(G).length===0?rt(We):rt(mt,-1)})}A(bt,pe)},gt=bt=>{var pe=qe(),Ze=Me(pe);{var We=rt=>{var $e=u7();Rn($e,21,()=>d(l),Bt=>Bt.metric,(Bt,At)=>{var vt=c7(),Pt=j(vt),Kt=j(Pt),Mt=ee(Pt,2);kr(Mt,(Ct,Ht)=>C[Ht.metric]=Ct,Ct=>C==null?void 0:C[Ct.metric],()=>[d(At)]),De(()=>je(Kt,`${d(At).metric??""} (${d(At).rollup??""})`)),A(Bt,vt)}),A(rt,$e)},mt=rt=>{var $e=d7();A(rt,$e)};xe(Ze,rt=>{d(l).length?rt(We):rt(mt,-1)})}A(bt,pe)},nn=bt=>{var pe=J_();Rn(pe,21,()=>d(u),Ze=>Ze.id,(Ze,We)=>{var mt=h7(),rt=j(mt),$e=j(rt),Bt=j($e),At=ee($e,2),vt=j(At);{let Ht=V(()=>xt(d(We).severity));Ca(vt,{get variant(){return d(Ht)},children:(_n,ln)=>{var sn=er();De(()=>je(sn,d(We).severity)),A(_n,sn)},$$slots:{default:!0}})}var Pt=ee(vt,2);Ca(Pt,{variant:"outline",children:(Ht,_n)=>{var ln=er();De(()=>je(ln,d(We).state)),A(Ht,ln)},$$slots:{default:!0}});var Kt=ee(rt,2);{var Mt=Ht=>{var _n=f7(),ln=j(_n);{var sn=qn=>{{let vn=V(()=>d(x)===d(We).id);Rr(qn,{size:"sm",variant:"outline",class:"h-6 px-2 text-xs",get disabled(){return d(vn)},onclick:()=>oe(d(We).id),children:(Vr,Pn)=>{var Yn=er("Ack");A(Vr,Yn)},$$slots:{default:!0}})}};xe(ln,qn=>{d(We).state==="raised"&&qn(sn)})}var mn=ee(ln,2);{let qn=V(()=>d(x)===d(We).id);Rr(mn,{size:"sm",variant:"outline",class:"h-6 px-2 text-xs",get disabled(){return d(qn)},onclick:()=>q(d(We).id),children:(vn,Vr)=>{var Pn=er("Mute 1h");A(vn,Pn)},$$slots:{default:!0}})}var Bn=ee(mn,2);{let qn=V(()=>d(x)===d(We).id);Rr(Bn,{size:"sm",class:"h-6 px-2 text-xs",get disabled(){return d(qn)},onclick:()=>K(d(We).id),children:(vn,Vr)=>{var Pn=er("Resolve");A(vn,Pn)},$$slots:{default:!0}})}A(Ht,_n)},Ct=V(()=>["raised","acknowledged","acting"].includes(d(We).state));xe(Kt,Ht=>{d(Ct)&&Ht(Mt)})}De(()=>je(Bt,d(We).kind)),A(Ze,mt)},Ze=>{var We=Q_();A(Ze,We)}),A(bt,pe)},St=bt=>{var pe=J_();Rn(pe,21,()=>d(f),Ze=>Ze.id,(Ze,We)=>{const mt=V(()=>Ee(d(We))),rt=V(()=>J(d(We))),$e=V(()=>d(h)===d(We).id);var Bt=b7(),At=j(Bt),vt=j(At),Pt=j(vt),Kt=ee(vt,2),Mt=j(Kt);{var Ct=Pn=>{var Yn=e2(),sr=j(Yn);De(pr=>je(sr,pr),[()=>be(d(We).duration_ms)]),A(Pn,Yn)},Ht=Pn=>{var Yn=e2(),sr=j(Yn);De(pr=>je(sr,pr),[()=>xp(d(We).started_at)]),A(Pn,Yn)};xe(Mt,Pn=>{d(We).duration_ms!=null?Pn(Ct):d(rt)&&d(We).started_at&&Pn(Ht,1)})}var _n=ee(Mt,2);{let Pn=V(()=>Ve(d(We).status));Ca(_n,{get variant(){return d(Pn)},children:(Yn,sr)=>{var pr=er();De(()=>je(pr,d(We).status)),A(Yn,pr)},$$slots:{default:!0}})}var ln=ee(At,2),sn=j(ln),mn=j(sn),Bn=ee(sn,4),qn=j(Bn),vn=ee(ln,2);{var Vr=Pn=>{const Yn=V(()=>d(rt)?d(p):d(p)||d(mt));var sr=v7(),pr=Me(sr);{var mi=Mr=>{var Hn=p7(),Ye=j(Hn);kr(Hn,F=>I(g,F),()=>d(g)),De(()=>je(Ye,d(Yn))),Mi("scroll",Hn,de),A(Mr,Hn)},ls=Mr=>{var Hn=g7();A(Mr,Hn)};xe(pr,Mr=>{d(Yn)?Mr(mi):d(rt)&&Mr(ls,1)})}var io=ee(pr,2);{var Os=Mr=>{var Hn=m7(),Ye=ee(j(Hn),2),F=j(Ye);De(()=>je(F,d(m)?"following output":"scrolled up — paused")),A(Mr,Hn)};xe(io,Mr=>{d(rt)&&Mr(Os)})}A(Pn,sr)};xe(vn,Pn=>{d($e)&&Pn(Vr)})}De((Pn,Yn)=>{vt.disabled=!d(mt)&&!d(rt),ut(vt,"title",d(mt)||d(rt)?"Show output":void 0),je(Pt,Pn),je(mn,Yn),je(qn,d(We).risk_class)},[()=>ct(d(We)),()=>xp(d(We).started_at??d(We).created_at)]),Ln("click",vt,()=>$(d(We))),A(Ze,Bt)},Ze=>{var We=Q_();A(Ze,We)}),A(bt,pe)},Rt=bt=>{var pe=X_();Rn(pe,21,()=>d(b),({task:Ze,executionCount:We})=>Ze.id,(Ze,We)=>{let mt=()=>d(We).task,rt=()=>d(We).executionCount;const $e=V(()=>{var ln;return typeof((ln=mt().attributes)==null?void 0:ln.title)=="string"?mt().attributes.title:mt().name}),Bt=V(()=>{var ln;return typeof((ln=mt().attributes)==null?void 0:ln.outcome)=="string"?mt().attributes.outcome:void 0});var At=x7(),vt=j(At);{var Pt=ln=>{var sn=y7(),mn=j(sn);De(()=>{ut(sn,"title",d($e)),je(mn,d($e))}),Ln("click",sn,()=>e.onSelectEntity(mt().slug)),A(ln,sn)},Kt=ln=>{var sn=w7(),mn=j(sn);De(()=>{ut(sn,"title",d($e)),je(mn,d($e))}),A(ln,sn)};xe(vt,ln=>{e.onSelectEntity?ln(Pt):ln(Kt,-1)})}var Mt=ee(vt,2),Ct=j(Mt);{var Ht=ln=>{{let sn=V(()=>d(Bt)==="success"?"default":"destructive");Ca(ln,{get variant(){return d(sn)},children:(mn,Bn)=>{var qn=er();De(()=>je(qn,d(Bt))),A(mn,qn)},$$slots:{default:!0}})}};xe(Ct,ln=>{d(Bt)&&ln(Ht)})}var _n=ee(Ct,2);Ca(_n,{variant:"outline",children:(ln,sn)=>{var mn=er();De(()=>je(mn,`${rt()??""} action${rt()===1?"":"s"}`)),A(ln,mn)},$$slots:{default:!0}}),A(Ze,At)},Ze=>{var We=_7();A(Ze,We)}),A(bt,pe)},re=bt=>{var pe=X_();Rn(pe,21,()=>d(y),Ze=>Ze.id,(Ze,We)=>{var mt=S7(),rt=j(mt);Ca(rt,{variant:"outline",class:"mr-1",children:(Bt,At)=>{var vt=er();De(()=>je(vt,d(We).type)),A(Bt,vt)},$$slots:{default:!0}});var $e=ee(rt,1,!0);De(()=>je($e,d(We).title)),A(Ze,mt)},Ze=>{var We=k7();A(Ze,We)}),A(bt,pe)},ae=bt=>{var pe=t2();Rn(pe,21,()=>d(c),Ze=>Ze.id,(Ze,We)=>{var mt=M7(),rt=j(mt),$e=j(rt),Bt=ee(rt,2),At=j(Bt);De(vt=>{je($e,vt),je(At,d(We).type)},[()=>new Date(d(We).ts).toLocaleString()]),A(Ze,mt)},Ze=>{var We=T7();A(Ze,We)}),A(bt,pe)},he=bt=>{var pe=t2();Rn(pe,21,()=>d(E),Ze=>Ze.id,(Ze,We)=>{var mt=E7(),rt=j(mt),$e=j(rt),Bt=j($e),At=ee($e,2);Ca(At,{variant:"outline",children:(Kt,Mt)=>{var Ct=er();De(()=>je(Ct,d(We).actor_type)),A(Kt,Ct)},$$slots:{default:!0}});var vt=ee(rt,2),Pt=j(vt);De(Kt=>{je(Bt,Kt),je(Pt,`${d(We).actor_id??"—"??""} · ${d(We).action??""}`)},[()=>new Date(d(We).ts).toLocaleString()]),A(Ze,mt)},Ze=>{var We=A7();A(Ze,We)}),A(bt,pe)},le=bt=>{var pe=R7(),Ze=j(pe);Rn(Ze,17,()=>d(k).filter($e=>$e.enabled),$e=>$e.id,($e,Bt)=>{var At=P7(),vt=j(At),Pt=j(vt),Kt=ee(Pt,2),Mt=j(Kt),Ct=ee(vt,2),Ht=j(Ct),_n=j(Ht),ln=ee(Ht,2);De((sn,mn)=>{Gn(Pt,1,`size-2 shrink-0 rounded-full ${(d(Bt).last_health?_t[d(Bt).last_health]??_t.unknown:"bg-muted-foreground/30")??""}`),je(Mt,sn),je(_n,mn)},[()=>GT(d(Bt)),()=>d(Bt).last_run_at?xp(d(Bt).last_run_at):"not yet run"]),Ln("click",ln,()=>Yt(d(Bt))),A($e,At)},$e=>{var Bt=C7();A($e,Bt)});var We=ee(Ze,2);{var mt=$e=>{var Bt=O7(),At=j(Bt);De(vt=>je(At,`${vt??""} disabled`),[()=>d(k).filter(vt=>!vt.enabled).length]),A($e,Bt)},rt=V(()=>d(k).some($e=>!$e.enabled));xe(We,$e=>{d(rt)&&$e(mt)})}A(bt,pe)},Pe=bt=>{var pe=L7(),Ze=j(pe);{var We=rt=>{var $e=I7(),Bt=Me($e);Rn(Bt,21,()=>d(M).filter(At=>At.depth>0).slice(0,12),At=>At.entity.id,(At,vt)=>{var Pt=N7(),Kt=j(Pt),Mt=j(Kt),Ct=ee(Kt,2),Ht=j(Ct);De(()=>{je(Mt,d(vt).entity.slug),je(Ht,`${d(vt).depth??""} hop${d(vt).depth===1?"":"s"}`)}),Ln("click",Pt,()=>{var _n;return(_n=e.onSelectEntity)==null?void 0:_n.call(e,d(vt).entity.slug)}),A(At,Pt)}),A(rt,$e)},mt=rt=>{var $e=z7();A(rt,$e)};xe(Ze,rt=>{d(M).length>1?rt(We):rt(mt,-1)})}A(bt,pe)},Oe=bt=>{var pe=W7(),Ze=j(pe);{var We=Mt=>{var Ct=D7(),Ht=ee(j(Ct),2);nn(Ht),A(Mt,Ct)};xe(Ze,Mt=>{d(z).length>0&&Mt(We)})}var mt=ee(Ze,2);{var rt=Mt=>{var Ct=F7(),Ht=ee(j(Ct),2);St(Ht),A(Mt,Ct)};xe(mt,Mt=>{d(f).length>0&&Mt(rt)})}var $e=ee(mt,2);{var Bt=Mt=>{var Ct=B7(),Ht=ee(j(Ct),2);Rt(Ht),A(Mt,Ct)};xe($e,Mt=>{d(b).length>0&&Mt(Bt)})}var At=ee($e,2);{var vt=Mt=>{var Ct=j7(),Ht=ee(j(Ct),2);ae(Ht),A(Mt,Ct)};xe(At,Mt=>{d(c).length>0&&Mt(vt)})}var Pt=ee(At,2);{var Kt=Mt=>{var Ct=U7();A(Mt,Ct)};xe(Pt,Mt=>{d(z).length+d(f).length+d(b).length+d(c).length===0&&Mt(Kt)})}A(bt,pe)},Re=bt=>{var pe=V7(),Ze=j(pe),We=ee(j(Ze),2);Le(We);var mt=ee(Ze,2),rt=ee(j(mt),2);Ie(rt);var $e=ee(mt,2);{var Bt=Pt=>{var Kt=q7(),Mt=ee(j(Kt),2);re(Mt),A(Pt,Kt)};xe($e,Pt=>{d(y).length>0&&Pt(Bt)})}var At=ee($e,2);{var vt=Pt=>{var Kt=H7(),Mt=ee(j(Kt),2);he(Mt),A(Pt,Kt)};xe(At,Pt=>{(d(S).length>0||d(E).length>0)&&Pt(vt)})}A(bt,pe)},Ce=V(()=>({content:d(_)?{title:"Content",count:1,content:Ae}:null,status:{title:"Status",count:d(k).filter(bt=>bt.enabled).length,content:le},impact:{title:"Impact",count:Math.max(d(M).length-1,0),content:Pe},activity:{title:"Activity",count:d(z).length+d(f).length+d(b).length,content:Oe},metrics:d(l).length?{title:"Metrics",count:d(l).length,content:gt}:null,reference:{title:"Reference",count:d(X).length+d(G).length,content:Re}}));var He=Z7(),Ge=Me(He),Ft=j(Ge),jt=j(Ft),nt=j(jt),tt=j(nt),Vt=ee(nt,2),In=j(Vt),L=j(In),ie=ee(In,2);{var Te=bt=>{var pe=$7(),Ze=ee(Me(pe));Ca(Ze,{variant:"outline",children:(We,mt)=>{var rt=er();De(()=>je(rt,d(o).state)),A(We,rt)},$$slots:{default:!0}}),A(bt,pe)};xe(ie,bt=>{d(o).state&&d(o).state!=="active"&&bt(Te)})}var ft=ee(jt,2);Rr(ft,{size:"sm",variant:"outline",class:"h-7 shrink-0 gap-1.5 text-xs",onclick:H,children:(bt,pe)=>{var Ze=er("Ask Nomos");A(bt,Ze)},$$slots:{default:!0}});var rn=ee(Ft,2);{var yn=bt=>{var pe=X7(),Ze=j(pe),We=j(Ze),mt=ee(We,2),rt=j(mt),$e=ee(mt,2);{var Bt=Mt=>{var Ct=G7(),Ht=j(Ct);De(_n=>je(Ht,`· checked ${_n??""}`),[()=>xp(d(o).last_check_at)]),A(Mt,Ct)};xe($e,Mt=>{d(o).last_check_at&&Mt(Bt)})}var At=ee(Ze,2);{var vt=Mt=>{var Ct=Y7(),Ht=j(Ct);De(()=>je(Ht,d(B).reason)),A(Mt,Ct)};xe(At,Mt=>{d(B).reason&&Mt(vt)})}var Pt=ee(At,2);{var Kt=Mt=>{var Ct=K7(),Ht=j(Ct);De(()=>je(Ht,`${d(z).length??""}
open signal${d(z).length===1?"":"s"}`)),A(Mt,Ct)};xe(Pt,Mt=>{d(z).length>0&&Mt(Kt)})}De(()=>{Gn(We,1,`size-2.5 shrink-0 rounded-full ${(d(B).health==="unmonitored"?"bg-muted-foreground/40":_t[d(B).health]??_t.unknown)??""}`),je(rt,d(B).health)}),A(bt,pe)},Ut=V(()=>$_(d(o).type));xe(rn,bt=>{d(Ut)&&bt(yn)})}var Jt=ee(Ge,2);Rn(Jt,16,()=>P8(d(o).type),bt=>bt,(bt,pe)=>{const Ze=V(()=>d(Ce)[pe]);var We=qe(),mt=Me(We);{var rt=$e=>{{let Bt=V(()=>pe==="status"||pe==="content"||pe==="activity"&&d(z).length>0);j8($e,{get title(){return d(Ze).title},get count(){return d(Ze).count},get defaultOpen(){return d(Bt)},children:(At,vt)=>{var Pt=qe(),Kt=Me(Pt);Zt(Kt,()=>d(Ze).content),A(At,Pt)},$$slots:{default:!0}})}};xe(mt,$e=>{d(Ze)&&$e(rt)})}A(bt,We)}),De(()=>{je(tt,d(o).slug),je(L,d(o).type)}),A(ge,He)};xe(ve,ge=>{d(P)?ge(Xe):d(o)?ge(dt,-1):ge(et,1)})}A(t,me),Et(),i()}Fo(["click"]);const QT={};function e9(t,e){Tt(e,!1),Dm(QT,!0),v1();var n=qe(),r=Me(n);bg(r,e,"default",{}),A(t,n),Et()}const la=typeof window<"u";function Lp(t){if(!(t!=null&&t.endsWith("px")))return;const e=parseFloat(t.slice(0,t.length-2));return isNaN(e)?void 0:e}const JT=t=>t?"height":"width",Fb=t=>window.getComputedStyle(t),Bb=t=>t.getBoundingClientRect(),t9=(t,e=!0)=>{if(t.getPropertyValue("box-sizing")==="border-box")return;const n=Lp(t.getPropertyValue("border-left-width"));if(n===void 0){console.error("Splitpanes Error: Fail to parse container `border-left-width`.");return}const r=Lp(t.getPropertyValue("border-top-width"));if(r===void 0){console.error("Splitpanes Error: Fail to parse container `border-top-width`.");return}const i={left:n,top:r};if(e){const s=Lp(t.getPropertyValue("border-right-width"));if(s===void 0){console.error("Splitpanes Error: Fail to parse container `border-right-width`.");return}const o=Lp(t.getPropertyValue("border-bottom-width"));if(o===void 0){console.error("Splitpanes Error: Fail to parse container `border-bottom-width`.");return}const a=i;a.right=s,a.bottom=o}return i};function n9(t,e){e||(e=Fb(t));const n=Bb(t),r=t9(e,!0)||{left:0,top:0,right:0,bottom:0};return{width:n.width-r.left-r.right,height:n.height-r.top-r.bottom,left:n.left+r.left,top:n.top+r.top}}const n2=(t,e)=>({left:t.left-e.left,top:t.top-e.top});function r2(t){const e=t,n=t,{clientX:r,clientY:i}="ontouchstart"in window&&n.touches?n.touches[0]:e;return{left:r,top:i}}function i2(t,e,n,r){let i=0;for(let s=e;s<n;s++)i+=r(t[s],s);return i}function Dp(t,e,n,r){for(let i=e;i<n;i++)r(t[i],i)}const e5={},r9=500,i9=100,Cd=.1,Lc=100,s2=(()=>{let t=!1;try{const e=Object.defineProperty({},"passive",{get(){return t={passive:!0},!0}});window.addEventListener("testpassive",e,e),window.remove("testpassive",e,e)}catch{}return t})();var s9=ne("<div><!> <!></div>");function t5(t,e){Tt(e,!1);const n=()=>zn(C,"$isHorizontal",i),r=()=>zn(N,"$veryFirstPaneKey",i),[i,s]=ro();let o=te(e,"id",8,void 0),a=te(e,"horizontal",8,!1),l=te(e,"pushOtherPanes",8,!0),c=te(e,"dblClickSplitter",8,!0),u=te(e,"rtl",8,"auto"),f=te(e,"firstSplitter",8,!1),h=te(e,"style",8,null),p=te(e,"theme",8,"default-theme"),g=te(e,"class",8,"");const m=c3();let b=es(),y=!1,_=!1,k=es(!1),S=es(!1),E=es(!1),M=-1,O=-1,P,x=new Array;const C=dr(a()),R=dr(f()),N=dr(void 0);let B,z,H=0,X=0,G=null,Z=null,oe=!1,K=[];function q(re){re===null?++X:H+=re}Dm(e5,{showFirstSplitter:R,veryFirstPaneKey:N,isHorizontal:C,ssrRegisterPaneSize:la?void 0:q,onPaneInit:re=>(r()===void 0&&Pc(N,re),{undefinedPaneInitSize:la?0:(Lc-H)/X}),clientOnly:la?{onPaneAdd:fe,onPaneRemove:$}:void 0});function J(re){var le;let ae=-1,he=(le=re.parentNode)==null?void 0:le.firstChild;for(;he&&(he.nodeType===Node.ELEMENT_NODE&&he.classList.contains("splitpanes__pane")&&ae++,he!==re);)he=he.nextSibling;return ae}function fe(re){const ae=J(re.element);ae===0&&Pc(N,re.key),x.splice(ae,0,re);for(let le=0;le<x.length;le++)x[le].index=le;y&&dt().then(()=>{re.isReady=!0,m("pane-add",{index:ae,panes:en()})});const he=(le,Pe=!0)=>Oe=>{(Pe||re.index>0)&&le(Oe,re)};return{onSplitterDown:he(Ve,!1),onSplitterClick:he(_t,!1),onSplitterDblClick:he(Yt),onPaneClick:he(de),reportGivenSizeChange:he(Be)}}async function $(re){const ae=x.findIndex(he=>he.key===re);if(ae>=0){const he=x.splice(ae,1)[0];for(let le=0;le<x.length;le++)x[le].index=le;ae===0&&Pc(N,x.length>0?x[0].key:void 0),y&&(await dt(),m("pane-remove",{removed:he,panes:en()}))}}function de(re,ae){m("pane-click",ae)}function Be(re,ae){ae.setSz(re),dt()}os(()=>{pt(),ge();for(let re=0;re<x.length;re++)x[re].isReady=!0;y=!0,m("ready"),setTimeout(()=>{I(k,!0)},0)}),la&&Kh(()=>{y&&Ue(),y=!1}),u3(()=>{pt()});function wt(re){if(u()==="auto")try{return(re??Fb(d(b))).direction==="rtl"}catch{}return u()===!0}function Je(){document.body.style.cursor=n()?"col-resize":"row-resize",document.addEventListener("mousemove",be,s2),document.addEventListener("mouseup",xt),"ontouchstart"in window&&(document.addEventListener("touchmove",be,s2),document.addEventListener("touchend",xt))}function Ue(){document.body.style.cursor="",document.removeEventListener("mousemove",be),document.removeEventListener("mouseup",xt),"ontouchstart"in window&&(document.removeEventListener("touchmove",be),document.removeEventListener("touchend",xt))}const ke=re=>re.nodeType===Node.ELEMENT_NODE&&re.classList.contains("splitpanes__splitter");function ct(re,ae,he){let le=re[a()?"top":"left"];return he&&!a()&&(le=ae-le),le}const Ee=()=>JT(a());function Ve(re,ae){I(S,!0),M=ae.index,ae.setSplitterActive(!0);let le=ae.element;for(;le&&(le=le.previousSibling,!(le&&ke(le))););if(le===null){console.error("Splitpane Error: Active splitter wasn't found!");return}B=le;const Pe=r2(re),Oe=Bb(B);G=Fb(d(b)),Z=n9(d(b),G),oe=wt(G),z=ct(n2(Pe,Oe),Oe[Ee()],oe),Je()}function be(re){if(d(S)&&Z){I(E,!0);const ae=r2(re),he=Z[Ee()],le=n2(ae,Z),Pe=ct(le,he,oe);Qn(Pe,he),m("resize",en())}}function xt(){d(E)&&m("resized",en()),I(S,!1),x[M].setSplitterActive(!1),G=null,Z=null,setTimeout(()=>{I(E,!1),Ue()},i9)}function _t(re,ae){if("ontouchstart"in window){const he=ae.index;c()&&(O===he?(P&&clearTimeout(P),P=null,Yt(re,ae),O=-1):(O=he,P=setTimeout(()=>{O=-1},r9)))}d(E)||m("splitter-click",ae)}function Yt(re,ae){if(c()){const he=ae.index;let le=0;for(let Re=0;Re<x.length;Re++){const Ce=x[Re];Re!==he&&(le+=Ce.min())}const Pe=Math.min(Math.max(0,Lc-le),ae.max()),Oe=le+Pe;if(Oe>=Lc)for(let Re=0;Re<x.length;Re++){const Ce=x[Re];Ce!==ae?Ce.setSz(Ce.min()):Ce.setSz(Lc-le)}else{let Re=Lc-Oe;ae.setSz(Pe);const Ce=He=>{const Ge=He.min(),Ft=He.max(),jt=Math.min(Math.max(0,Re),Ft-Ge);He.setSz(Ge+jt),Re-=jt};for(let He=he-1;He>=0;He--)Ce(x[He]);for(let He=he+1;He<x.length;He++)Ce(x[He]);Re!==0&&console.warn("Splitpanes: there is a left spare size after computation of splitter double click, which means there are issues on the size constains of the panes.")}m("pane-maximize",ae),m("resized",en())}I(S,!1)}const en=()=>x.map(re=>({min:re.min(),max:re.max(),size:re.sz(),snap:re.snap()}));function tn(re,ae){const he=Ft=>Bb(Ft)[Ee()],le=he(B);let Pe=0,Oe=B.previousSibling;for(;Oe;)ke(Oe)&&(Pe+=he(Oe)),Oe=Oe.previousSibling;let Re=0,Ce=B.nextSibling;for(;Ce;)ke(Ce)&&(Re+=he(Ce)),Ce=Ce.nextSibling;const He=Pe+z,Ge=Pe+le+Re;return(re-He)/(ae-Ge)*Lc}function Qn(re,ae){let he=M-1,le=x[he],Pe=M,Oe=x[Pe],Re={prevPanesSize:me(he),nextPanesSize:ve(Pe),prevReachedMinPanes:0,nextReachedMinPanes:0};const Ce=0+(l()?0:Re.prevPanesSize),He=100-(l()?0:Re.nextPanesSize),Ge=Math.max(Math.min(tn(re,ae),He),Ce),Ft=Re.prevPanesSize+le.min()+le.snap(),jt=100-(Re.nextPanesSize+Oe.min()+Oe.snap());let nt=Ge,tt=!1;Ge<=Ft?Ge>Re.prevPanesSize+le.min()&&(nt=Math.max(le.min()+Re.prevPanesSize,100-(Oe.max()+Re.nextPanesSize)),tt=!0):Ge>=jt&&Ge<100-Re.nextPanesSize-Oe.min()&&(nt=Math.min(100-(Oe.min()+Re.nextPanesSize),le.max()+Re.prevPanesSize),tt=!0);const Vt=le.max()<100&&nt>=le.max()+Re.prevPanesSize,In=Oe.max()<100&&nt<=100-(Oe.max()+Re.nextPanesSize);if(Vt||In)Vt?(le.setSz(le.max()),Oe.setSz(Math.max(100-le.max()-Re.prevPanesSize-Re.nextPanesSize,0))):(le.setSz(Math.max(100-Oe.max()-Re.prevPanesSize-Re.nextPanesSize,0)),Oe.setSz(Oe.max()));else{if(l()&&!tt){const L=se(Re,nt);if(!L)return;({sums:Re,paneBeforeIndex:he,paneAfterIndex:Pe}=L),le=x[he],Oe=x[Pe]}typeof he=="number"&&le.setSz(Math.min(Math.max(nt-Re.prevPanesSize-Re.prevReachedMinPanes,le.min()),le.max())),typeof Pe=="number"&&Oe.setSz(Math.min(Math.max(100-nt-Re.nextPanesSize-Re.nextReachedMinPanes,Oe.min()),Oe.max()))}}function se(re,ae){var Oe,Re;const he=M-1;let le=he,Pe=he+1;if(ae<re.prevPanesSize+x[le].min()){if(le=(Oe=Xe(he))==null?void 0:Oe.index,re.prevReachedMinPanes=0,le===void 0)return re.prevPanesSize=0,x[0].setSz(x[0].min()),Dp(x,1,he+1,Ce=>{Ce.setSz(Ce.min()),re.prevReachedMinPanes+=Ce.min()}),x[Pe].setSz(100-re.prevReachedMinPanes-x[0].min()-re.prevPanesSize-re.nextPanesSize),null;le<he&&Dp(x,le+1,he+1,Ce=>{Ce.setSz(Ce.min()),re.prevReachedMinPanes+=Ce.min()}),re.prevPanesSize=me(le)}if(ae>100-re.nextPanesSize-x[Pe].min())if(Pe=(Re=et(he))==null?void 0:Re.index,le===void 0&&console.log("Yep undefined paneAfterIndex"),re.nextReachedMinPanes=0,Pe===void 0){re.nextPanesSize=0;const Ce=x.length;return x[Ce-1].setSz(x[Ce-1].min()),Dp(x,he+1,Ce-1,He=>{He.setSz(He.min()),re.nextReachedMinPanes+=He.min()}),x[le].setSz(100-re.prevPanesSize-re.nextReachedMinPanes-x[Ce-1].min()-re.nextPanesSize),null}else Pe>he+1&&Dp(x,he+1,Pe,Ce=>{Ce.setSz(Ce.min()),re.nextReachedMinPanes+=Ce.min()}),re.nextPanesSize=ve(Pe);return{sums:re,paneBeforeIndex:le,paneAfterIndex:Pe}}const _e=re=>re.sz(),me=re=>i2(x,0,re,_e),ve=re=>i2(x,re+1,x.length,_e),Xe=re=>[...x].reverse().find(ae=>ae.index<re&&ae.sz()>ae.min()),et=re=>x.find(ae=>ae.index>re+1&&ae.sz()>ae.min());async function dt(){_=!0,await uf(),_&&(ge(),_=!1)}function ge(){Ae(),y&&m("resized",en())}function Ae(){if(x.length===0)return;const re=x.length;let ae=100,he=0,le=0,Pe=0;const Oe=[],Re=[];for(let jt=0;jt<re;jt++){const nt=x[jt],tt=nt.sz();nt.givenSize===null?nt.isReady?(Pe+=tt,tt>=nt.max()&&Oe.push(nt),tt<=nt.min()&&Re.push(nt)):le+=1:(ae-=tt,he++,Oe.push(nt),Re.push(nt))}const Ce=re-he,He=Ce-le;let Ge,Ft;if(He>0?(Ge=Pe/He,Ge>Cd&&ae>Cd?(Pe+=le*Ge,Ft=ae/Pe):(Ge=0,Ft=1)):(Ge=ae/Ce,Ft=1),ae+Pe>Cd){ae=100;for(let jt=0;jt<re;jt++){const nt=x[jt];if(typeof nt.givenSize!="number"){const tt=nt.isReady?nt.sz():Ge,Vt=Math.max(Math.min(tt*Ft,nt.max()),nt.min());nt.setSz(Vt)}ae-=nt.sz()}Math.abs(ae)>Cd&&(ae=Ie(ae,Oe,Re))}isFinite(ae)?Math.abs(ae)>Cd&&console.warn("Splitpanes: Could not resize panes correctly due to their constraints."):console.warn("Splitpanes: Internal error, sizes might be NaN as a result.")}function Ie(re,ae,he){const Pe=x.length-(re>0?ae.length:he.length);if(Pe<=0)return re;const Oe=re/Pe;if(x.length===1)x[0].setSz(100),re=0;else for(let Re=0;Re<x.length;Re++){const Ce=x[Re],He=Ce.sz();if(re>0&&!ae.includes(Ce)){const Ge=Math.max(Math.min(He+Oe,Ce.max()),Ce.min()),Ft=Ge-He;re-=Ft,Ce.setSz(Ge)}else if(!he.includes(Ce)){const Ge=Math.max(Math.min(He+Oe,Ce.max()),Ce.min()),Ft=Ge-He;re-=Ft,Ce.setSz(Ge)}}return re}function pt(){var le,Pe;if(!d(b))return;const{children:re}=d(b);if(re.length===K.length&&re.length>0&&re[0]===K[0]&&re[re.length-1]===K[re.length-1])return;let ae=0,he=!1;for(let Oe=0;Oe<re.length;Oe++){const Re=re.item(Oe),Ce=Re.classList.contains("splitpanes__pane"),He=Re.classList.contains("splitpanes__splitter");if(!Ce&&!He){(le=Re.parentNode)==null||le.removeChild(Re),console.warn("Splitpanes: Only <Pane> elements are allowed at the root of <Splitpanes>. One of your DOM nodes was removed."),K=Array.from(re);return}else Ce&&(!he&&((Pe=x[ae])==null?void 0:Pe.element)!==Re&&(he=!0),ae++)}if(he){const Oe=[];for(let Re=0;Re<re.length;Re++){const Ce=re.item(Re);if(Ce==null?void 0:Ce.classList.contains("splitpanes__pane")){const Ge=x.find(Ft=>Ft.element===Ce);Ge?(Ge.index=Oe.length,Oe.push(Ge)):console.warn("Splitpanes: Internal error - found a <Pane> elements which isn't tracked.")}}x=Oe,Pc(N,x.length>0?x[0].key:void 0)}K=Array.from(re)}ef(()=>df(a()),()=>{Pc(C,a())}),ef(()=>df(f()),()=>{Pc(R,f())}),xS(),v1();var Le=s9();let gt;var nn=j(Le);{var St=re=>{e9(re,{children:(ae,he)=>{var le=qe(),Pe=Me(le);bg(Pe,e,"default",{}),A(ae,le)},$$slots:{default:!0}})};xe(nn,re=>{la||re(St)})}var Rt=ee(nn,2);bg(Rt,e,"default",{}),kr(Le,re=>I(b,re),()=>d(b)),De(()=>{ut(Le,"id",o()),gt=Gn(Le,1,`splitpanes ${p()||""} ${g()||""}`,null,gt,{"splitpanes--horizontal":a(),"splitpanes--vertical":!a(),"splitpanes--dragging":d(S)||d(E),"splitpanes--freeze":!d(k)}),Ks(Le,h())}),A(t,Le),Et(),s()}const o9=(t,e)=>n=>{const r=t();r!==null&&r[e](n)},a9=t=>o9.bind(null,t);var l9=ne("<div></div>"),c9=ne("<!> <div><!></div>",1);function Kg(t,e){Tt(e,!1);const n=()=>zn(h,"$isHorizontal",s),r=()=>zn(g,"$veryFirstPaneKey",s),i=()=>zn(p,"$showFirstSplitter",s),[s,o]=ro(),a=es(),l=es(),{ssrRegisterPaneSize:c,onPaneInit:u,clientOnly:f,isHorizontal:h,showFirstSplitter:p,veryFirstPaneKey:g}=Fu(e5);let m=te(e,"size",12,null),b=te(e,"minSize",8,0),y=te(e,"maxSize",8,100),_=te(e,"snapSize",8,0),k=te(e,"class",8,"");const S={},E=!la&&i1(QT),{undefinedPaneInitSize:M}=E?{}:u(S);let O=es(),P=es(m()??M),x=es(!1),C;const R=la?a9(()=>C):void 0,N=X=>{C&&X!=d(P)&&(R==null||R("reportGivenSizeChange")(X))};E&&c?c(m()):la&&(os(()=>{const X={index:0,key:S,element:d(O),givenSize:m(),sz:()=>d(P),setSz:G=>{I(P,G),typeof m()=="number"&&m()!==d(P)&&m(d(P))},min:()=>b(),max:()=>y(),snap:()=>_(),setSplitterActive:G=>{I(x,G)},isReady:!1};C=f==null?void 0:f.onPaneAdd(X)}),Kh(()=>{f==null||f.onPaneRemove(S)})),ef(()=>df(m()),()=>{la&&typeof m()=="number"&&N(m())}),ef(()=>n(),()=>{I(a,JT(n()))}),ef(()=>(d(a),d(P)),()=>{I(l,`${d(a)}: ${d(P)}%;`)}),xS(),v1();var B=qe(),z=Me(B);{var H=X=>{var G=c9(),Z=Me(G);{var oe=J=>{var fe=l9(),$=V(()=>R==null?void 0:R("onSplitterDown")),de=V(()=>R==null?void 0:R("onSplitterDown")),Be=V(()=>R==null?void 0:R("onSplitterClick")),wt=V(()=>R==null?void 0:R("onSplitterDblClick"));De(()=>Gn(fe,1,`splitpanes__splitter ${d(x)?"splitpanes__splitter__active":""}`)),Mi("mousedown",fe,function(...Je){var Ue;(Ue=d($))==null||Ue.apply(this,Je)}),Mi("touchstart",fe,function(...Je){var Ue;(Ue=d(de))==null||Ue.apply(this,Je)}),Mi("click",fe,function(...Je){var Ue;(Ue=d(Be))==null||Ue.apply(this,Je)}),Mi("dblclick",fe,function(...Je){var Ue;(Ue=d(wt))==null||Ue.apply(this,Je)}),A(J,fe)};xe(Z,J=>{(r()!==S||i())&&J(oe)})}var K=ee(Z,2),q=V(()=>R==null?void 0:R("onPaneClick")),W=j(K);bg(W,e,"default",{}),kr(K,J=>I(O,J),()=>d(O)),De(()=>{Gn(K,1,`splitpanes__pane ${k()||""}`),Ks(K,d(l))}),Mi("click",K,function(...J){var fe;(fe=d(q))==null||fe.apply(this,J)}),A(X,G)};xe(z,X=>{E||X(H)})}A(t,B),Et(),o()}const u9=12,d9=6e3,f9=8e3;function n5(){const t=dr([]);return{planSteps:dr([]),questions:t,openQuestion:Es(t,e=>e.find(n=>n.status==="open")??null),touched:dr([]),healthDiffs:dr([])}}const jr=n5(),h9=jr.planSteps;jr.questions;jr.openQuestion;const p9=jr.touched,g9=jr.healthDiffs,My=Es([lp,Hu],([t,e])=>t.find(n=>n.id===e)??null),Ty=new Set(["goal.set","task.status","plan.proposed","question.raised","question.answered"]);let G0=null;function m9(){G0&&clearTimeout(G0),G0=setTimeout(()=>Z1(),300)}function v9(t,e){const n=e==null?void 0:e.step_id,r=e==null?void 0:e.seq;t.planSteps.update(i=>{const s=i.findIndex(a=>n&&a.id===n||r!=null&&a.seq===r);if(s===-1)return console.warn("plan step event matched no step on screen",{stepID:n,seq:r,status:e==null?void 0:e.status}),i;const o=[...i];return o[s]={...o[s],status:e.status??o[s].status,execution_id:e.execution_id??o[s].execution_id},o})}function r5(t,e,n){if(n.correlation_id!==e)return;const r=n.data??{};switch(Ty.has(n.type)&&m9(),n.type){case"plan.proposed":{const i=r;if(Array.isArray(i.steps)){const s=i.steps.map(o=>({id:o.id,seq:o.seq,title:o.title,detail:o.detail??"",status:"pending",target_slug:o.target_slug||void 0}));t.planSteps.update(o=>i.appended?[...o,...s]:s)}break}case"plan.step.started":case"plan.step.finished":v9(t,r);break;case"question.raised":{const i=r;t.questions.update(s=>[{id:i.question_id,prompt:i.prompt??"",context:{why:i.why,options:i.options,entities:i.entities},status:"open",created_at:new Date().toISOString()},...s.filter(o=>o.id!==i.question_id)]);break}case"question.answered":{const i=r;t.questions.update(s=>s.map(o=>o.id===i.question_id?{...o,status:"answered",answer:i.answer}:o));break}case"entity.touched":{const i=r;if(i.slug){const s=Date.now();t.touched.update(o=>[{slug:i.slug,tool:i.tool??"",ts:s},...o].slice(0,u9))}break}}}function i5(t,e){if(e.type!=="health.changed")return;const n=e.data??{};!n.slug||!ki(t.touched).some(i=>i.slug===n.slug)||t.healthDiffs.update(i=>[{slug:n.slug,from:n.from??"",to:n.to??"",ts:Date.now()},...i].slice(0,8))}let jb=null,Fp=null,Bp=null,Y0=0;async function b9(t){jb=t,jr.planSteps.set([]),jr.questions.set([]),jr.touched.set([]),jr.healthDiffs.set([]);const[e,n]=await Promise.all([V1(t),SM(t)]);ki(Hu)===t&&(jr.planSteps.set(e),jr.questions.set(n))}function y9(){Fp=od();const t=Hu.subscribe(e=>{e&&e!==jb&&b9(e),e||(jb=null,jr.planSteps.set([]),jr.questions.set([]),jr.touched.set([]),jr.healthDiffs.set([]))});return Bp=mc.subscribe(e=>{if(e.length===0)return;const n=e[0].id;if(n<=Y0)return;const r=e.filter(o=>o.id>Y0);Y0=n;const i=ki(Hu);if(!i)return;let s=!1;for(const o of r.slice().reverse())r5(jr,i,o),i5(jr,o),o.correlation_id===i&&Ty.has(o.type)&&(s=!0);s&&a5(jr,i)}),()=>{t(),Bp==null||Bp(),Fp==null||Fp()}}const Ub=new Map;function o0(t){let e=Ub.get(t);return e||(e=n5(),Ub.set(t,e)),e}function a0(t){return Es(lp,e=>e.find(n=>n.id===t)??null)}const w9=new Set(["planning","executing"]);function s5(t,e){return t||!!e&&!!e.status&&w9.has(e.status)}function o5(t){const e=Xs(t);return Es([e.streaming,a0(t)],([n,r])=>s5(n,r))}const x9=Es([X1,My],([t,e])=>s5(t,e));async function _9(t,e){const[n,r]=await Promise.all([V1(e),SM(e)]);t.planSteps.set(n),t.questions.set(r)}const K0=new Map;function a5(t,e){const n=K0.get(e);n&&clearTimeout(n),K0.set(e,setTimeout(async()=>{K0.delete(e);try{t.planSteps.set(await V1(e))}catch{}},400))}function S9(t){const e=o0(t),n=od();_9(e,t);let r=0;const i=mc.subscribe(s=>{if(s.length===0)return;const o=s[0].id;if(o<=r)return;const a=s.filter(c=>c.id>r);r=o;let l=!1;for(const c of a.slice().reverse())r5(e,t,c),i5(e,c),c.correlation_id===t&&Ty.has(c.type)&&(l=!0);l&&a5(e,t)});return()=>{i(),n()}}setInterval(()=>{const t=Date.now(),e=n=>{n.touched.update(r=>r.filter(i=>t-i.ts<d9)),n.healthDiffs.update(r=>r.filter(i=>t-i.ts<f9))};e(jr);for(const n of Ub.values())e(n)},1e3);const X0=new Map;function l5(t){const e=X0.get(t);if(e)return e;const n=J2(null,r=>{let i=null,s=!1,o=!1;async function a(u){if(s){o=!0;return}s=!0;try{const f=await TM(u);i===u&&r({executionId:u,output:f.combined})}finally{s=!1,o&&(o=!1,i&&a(i))}}const l=od(),c=mc.subscribe(u=>{const f=u[0];if(f){if(f.correlation_id===t&&(f.type==="execution.completed"||f.type==="execution.failed"||f.type==="execution.cancelled")){i=null,r(null);return}f.type==="execution.output"&&f.correlation_id===t&&f.entity_id&&(f.entity_id!==i&&(i=f.entity_id,r({executionId:i,output:""})),a(f.entity_id))}});return()=>{c(),l(),X0.delete(t)}});return X0.set(t,n),n}const o2=8e3;function a2(t){if(!(!t||typeof t!="object"||Array.isArray(t))&&Object.keys(t).length!==0)try{return JSON.stringify(t)}catch{return}}function l2(t){const e=typeof t=="string"?t:JSON.stringify(t??"");return e.length>o2?`${e.slice(0,o2)}
… truncated`:e}const k9=/[a-z]+:nomos\/[a-z0-9-]+/,M9=/^[a-z][a-z0-9_]*:[^\s]+$/;function c2(t){if(!t||typeof t!="object")return;const e=t==null?void 0:t.slug_or_id;if(typeof e=="string"&&M9.test(e))return{kind:"entity",slug:e}}function T9(t){const n=(typeof t=="string"?t:JSON.stringify(t??"")).match(k9);return n?{kind:"knowledge",slug:n[0]}:void 0}function c5(t,e,n,r){var b,y,_;const i=[],s=Date.now(),o=(k,S)=>{if(S&&S>0)return S;const E=r.get(k);return E!==void 0?E:(r.set(k,s),s)},a=k=>k&&new Date(k).getTime()||void 0;n!=null&&n.goal&&i.push({id:"goal",type:"goal",description:n.goal,timestamp:0,status:"done"});for(const k of e){if(k.status==="pending")continue;const S=k.title||`Step ${k.seq}`;i.push({id:k.id,type:k.status==="running"?"step_running":k.status==="done"?"step_done":"step_failed",description:`Step ${k.seq}: ${S}`,detail:k.detail||void 0,timestamp:o(k.id,a(k.started_at)),status:k.status==="running"?"running":k.status==="done"?"done":"failed"})}let l=-1,c=-1,u=0;for(let k=0;k<t.length;k++)for(let S=0;S<t[k].tools.length;S++)t[k].tools[S].name==="propose_plan"&&(u++,l=k,c=S);const f=u>1;let h=0,p=0,g=u===0,m=!1;for(let k=0;k<t.length;k++){const S=a(t[k].created_at);for(let E=0;E<t[k].tools.length;E++){const M=t[k].tools[E],O=k===l&&E===c;if(O&&(g=!0),g&&M.type==="tool_use"&&M.name==="update_plan_step"){const R=typeof((b=M.args)==null?void 0:b.seq)=="number"?M.args.seq:void 0,N=typeof((y=M.args)==null?void 0:y.status)=="string"?M.args.status:void 0;R&&N==="running"&&(h=R)}else(M.name==="set_goal"||M.name==="propose_plan"||M.name==="complete_task")&&(h=0);if(M.name==="propose_plan"&&!O){f&&!m&&(m=!0,i.push({id:`plan_revised_${k}_${E}`,type:"plan",description:"Earlier plan revised",timestamp:o(`plan_revised_${k}_${E}`,S),status:"done"}));continue}const P=d5(M),x=h>0?h:void 0,C=M.id??`tool_${k}_${p++}`;if(M.type==="tool_use")i.push({id:C,type:"tool_running",description:P,args:a2(M.args),timestamp:o(C,S),toolName:M.name,stepSeq:x,indent:x!=null,status:"running"});else if(M.type==="tool_result"){const R=i.find(N=>N.type==="tool_running"&&N.id===M.id&&N.status==="running");R&&M.error?(R.type="tool_error",R.status="failed",R.description=`${P}: ${M.error.slice(0,80)}`,R.detail=M.error):R?(R.type="tool_done",R.status="done",R.detail=l2(M.result),(M.name==="get_entity"||M.name==="get_entity_knowledge")&&(R.link=c2(M.args))):i.push({id:C,type:M.error?"tool_error":"tool_done",description:M.error?`${P}: ${M.error.slice(0,80)}`:P,detail:M.error?M.error:l2(M.result),args:a2(M.args),timestamp:o(C,S),toolName:M.name,stepSeq:x,indent:x!=null,status:M.error?"failed":"done",link:M.name==="get_entity"||M.name==="get_entity_knowledge"?c2(M.args):void 0})}}}for(let k=0;k<t.length;k++){const S=a(t[k].created_at);for(const E of t[k].tools)if(E.type==="tool_result"&&E.name==="upsert_knowledge"&&!E.error){const M=typeof((_=E.args)==null?void 0:_.title)=="string"?E.args.title:"",O=`knowledge_${k}_${E.id??""}`;i.push({id:O,type:"knowledge",description:M?`Recorded: ${M.slice(0,60)}`:"Recorded knowledge",timestamp:o(O,S),status:"done",link:T9(E.result)})}}return n!=null&&n.outcome&&i.push({id:"complete",type:"complete",description:n.summary||`Task ${n.outcome}`,timestamp:o("complete"),status:n.outcome==="failure"?"failed":"done"}),i.sort((k,S)=>k.timestamp-S.timestamp),i}const E9=new Map,A9=Es(Hu,(t,e)=>{if(!t){e(null);return}return l5(t).subscribe(e)},null),P9=Es([IM,h9,My,A9],([t,e,n,r])=>u5(c5(t,e,n,E9),r));function u5(t,e){if(!(e!=null&&e.output))return t;for(let n=t.length-1;n>=0;n--){const r=t[n];if(r.type==="tool_running"&&r.status==="running"&&r.toolName==="run"){t[n]={...r,liveOutput:e.output};break}}return t}const u2=new Map;function C9(t){const e=Xs(t),n=o0(t),r=a0(t),i=l5(t);let s=u2.get(t);return s||(s=new Map,u2.set(t,s)),Es([e.messages,n.planSteps,r,i],([o,a,l,c])=>u5(c5(o,a,l,s),c))}function d5(t){const e=t.args??{},n=r=>typeof r=="string"?r:"";switch(t.name){case"set_goal":return"Set goal";case"propose_plan":return"Proposed plan";case"search_knowledge":return`Research: ${n(e.query)}`;case"get_entity":return`Lookup: ${n(e.slug_or_id)}`;case"get_entity_knowledge":return"Check prior knowledge";case"get_relations":return"Check relationships";case"list_lxcs":return"List containers";case"list_entities":return"List entities";case"get_health_summary":return"Fleet health";case"get_state_snapshot":return"State snapshot";case"run":{const r=n(e.purpose),i=n(e.target);return r||(i?`Run on ${i}`:"Run command")}case"get_execution_status":return"Check execution";case"update_plan_step":return"Update plan";case"upsert_knowledge":return"Record knowledge";case"complete_task":return"Complete task";case"ping_service":return"Check service";case"ask_operator":return"Ask operator";default:return t.name.replace(/_/g," ").replace(/^./,r=>r.toUpperCase())}}function Dc(t){if(t==null)return"";if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}function Od(t,e=80){const n=t.split(/\r?\n/).map(r=>r.trim()).find(r=>r.length>0)??"";return n.length>e?`${n.slice(0,e-1)}`:n}function Rd(t){if(Array.isArray(t))return t;if(t&&typeof t=="object"){const e=t;for(const n of["entities","results","relations","steps","items","containers","docs","questions","signals","events","patterns","skills"])if(Array.isArray(e[n]))return e[n]}return null}function Z0(t){return typeof t=="number"&&Number.isFinite(t)?t:null}function Fc(t,e,n=`${e}s`){return`${t} ${t===1?e:n}`}function O9(t){if(t.type==="tool_use"||t.error)return"";const e=t.args??{},n=i=>typeof i=="string"?i:"",r=i=>i&&typeof i=="object"&&!Array.isArray(i)?i:null;switch(t.name){case"run":{const i=Dc(t.result),s=i.match(/exit (?:status )?(\d+)/i),o=s?`exit ${s[1]}`:/error/i.test(i)?"error":"ok",a=Od(i.replace(/[\s\S]*exit (?:status )?\d+/i,""),60);return a?`${o} · ${a}`:o}case"get_entity":{const i=r(t.result),s=n(i==null?void 0:i.slug)||n(e.slug_or_id),o=n(i==null?void 0:i.health)||n(i==null?void 0:i.state);return[s,o&&`(${o})`].filter(Boolean).join(" ")||"found"}case"get_relations":{const i=Rd(t.result);return i?Fc(i.length,"relation"):"done"}case"list_entities":case"list_lxcs":{const i=Rd(t.result);return i?t.name==="list_lxcs"?Fc(i.length,"container"):Fc(i.length,"entity","entities"):"done"}case"get_health_summary":{const i=r(t.result),s=(i==null?void 0:i.health)&&r(i.health)||i;if(s){const o=["healthy","degraded","down","unknown"].map(a=>{const l=Z0(s[a]);return l!=null?`${a} ${l}`:null}).filter(a=>a!=null);if(o.length)return o.join(" · ")}return"done"}case"get_state_snapshot":{const i=r(t.result),s=Z0((i==null?void 0:i.drift)??(i==null?void 0:i.drift_count));return s!=null?Fc(s,"drift"):"done"}case"search_knowledge":case"get_entity_knowledge":case"get_patterns":case"get_skills":{const i=Rd(t.result);return i?Fc(i.length,"result"):Od(Dc(t.result))||"done"}case"upsert_knowledge":{const i=Dc(t.result).match(/[a-z]+:nomos\/[a-z0-9-]+/);return i?`recorded ${i[0]}`:"recorded"}case"update_plan_step":{const i=Z0(e.seq),s=n(e.status);return i!=null&&s?`step ${i}${s}`:s||"updated"}case"propose_plan":{const i=Rd(t.result)??Rd(e.steps);return i?Fc(i.length,"step"):"planned"}case"set_goal":return"goal set";case"complete_task":return n(e.outcome)||"complete";case"ask_operator":return"asked";case"ping_service":{const i=Dc(t.result).toLowerCase();return/ok|reachable|up|healthy/.test(i)?"reachable":Od(i,40)||"done"}case"get_execution_status":{const i=r(t.result);return n(i==null?void 0:i.state)||Od(Dc(t.result),40)||"done"}default:return Od(Dc(t.result))||"done"}}var R9=ne('<span class="live-tag svelte-5pkxuk"><!> live</span>'),N9=ne('<span class="summary svelte-5pkxuk"> </span>'),I9=ne('<span class="summary err svelte-5pkxuk">error</span>'),z9=ne('<div class="live-output svelte-5pkxuk"><pre class="live"> </pre></div>'),L9=ne('<div class="khead svelte-5pkxuk">Args</div> <pre> </pre>',1),D9=ne('<div class="khead svelte-5pkxuk">Result</div> <pre> </pre>',1),F9=ne('<div class="khead err svelte-5pkxuk">Error</div> <pre class="err"> </pre>',1),B9=ne('<div class="detail svelte-5pkxuk"><!> <!> <!></div>'),j9=ne('<div class="tool-line svelte-5pkxuk"><button class="row svelte-5pkxuk"><span aria-hidden="true"><!></span> <span class="text min-w-0 flex-1 svelte-5pkxuk"><span> </span></span> <!> <!></button> <!> <!></div>');function U9(t,e){Tt(e,!0);let n=Se(!1),r=Se(null);const i=V(()=>e.tool.type==="tool_use"?"running":e.tool.error?"error":"done"),s=V(()=>d5(e.tool)),o=V(()=>O9(e.tool)),a=V(()=>d(n));Qt(()=>{e.tool.liveOutput&&d(r)&&(d(r).scrollTop=d(r).scrollHeight)});const l=V(()=>!!e.tool.args||e.tool.result!==void 0&&e.tool.result!==null||!!e.tool.error);function c(z){if(typeof z=="string")try{return JSON.stringify(JSON.parse(z),null,2)}catch{return z}try{return JSON.stringify(z,null,2)}catch{return String(z)}}var u=j9(),f=j(u),h=j(f),p=j(h);{var g=z=>{db(z,{class:"size-3 animate-spin"})},m=z=>{ru(z,{class:"size-3"})},b=z=>{zg(z,{class:"size-3"})};xe(p,z=>{d(i)==="running"?z(g):d(i)==="error"?z(m,1):z(b,-1)})}var y=ee(h,2),_=j(y),k=j(_),S=ee(y,2);{var E=z=>{var H=R9(),X=j(H);db(X,{class:"size-2.5 animate-spin"}),A(z,H)},M=z=>{var H=N9(),X=j(H);De(()=>je(X,d(o))),A(z,H)},O=z=>{var H=I9();A(z,H)};xe(S,z=>{d(i)==="running"&&e.tool.liveOutput?z(E):d(i)==="done"&&d(o)?z(M,1):d(i)==="error"&&z(O,2)})}var P=ee(S,2);{var x=z=>{{let H=V(()=>d(a)?"open":"");D1(z,{get class(){return`chev size-3 ${d(H)??""}`}})}};xe(P,z=>{(d(l)||e.tool.liveOutput)&&z(x)})}var C=ee(f,2);{var R=z=>{var H=z9(),X=j(H),G=j(X);kr(X,Z=>I(r,Z),()=>d(r)),De(()=>je(G,e.tool.liveOutput)),A(z,H)};xe(C,z=>{e.tool.liveOutput&&z(R)})}var N=ee(C,2);{var B=z=>{var H=B9(),X=j(H);{var G=W=>{var J=L9(),fe=ee(Me(J),2),$=j(fe);De(de=>je($,de),[()=>c(e.tool.args)]),A(W,J)};xe(X,W=>{e.tool.args&&W(G)})}var Z=ee(X,2);{var oe=W=>{var J=D9(),fe=ee(Me(J),2),$=j(fe);De(de=>{Gn(fe,1,Xi(d(i)==="error"?"err":"")),je($,de)},[()=>c(e.tool.result)]),A(W,J)};xe(Z,W=>{e.tool.result!==void 0&&e.tool.result!==null&&W(oe)})}var K=ee(Z,2);{var q=W=>{var J=F9(),fe=ee(Me(J),2),$=j(fe);De(()=>je($,e.tool.error)),A(W,J)};xe(K,W=>{e.tool.error&&W(q)})}A(z,H)};xe(N,z=>{d(a)&&z(B)})}De(()=>{ut(f,"aria-expanded",d(a)),f.disabled=!d(l)&&!e.tool.liveOutput,Gn(h,1,`icon ${d(i)??""}`,"svelte-5pkxuk"),Gn(_,1,`label ${d(i)==="done"?"done-text":""}`,"svelte-5pkxuk"),je(k,d(s))}),Ln("click",f,()=>I(n,!d(n))),A(t,u),Et()}Fo(["click"]);var W9=Ui('<rect x="11" y="1.5" width="2" height="6" rx="1" fill="currentColor" opacity="0.15"><animate attributeName="opacity" values="1;0.15" keyTimes="0;1" repeatCount="indefinite"></animate></rect>'),q9=Ui('<svg viewBox="0 0 24 24" fill="none" aria-hidden="true"></svg>');function Xg(t,e){Tt(e,!0);let n=te(e,"class",3,"");const r=8,i=.9;var s=q9();Rn(s,21,()=>Array.from({length:r}),$s,(o,a,l)=>{var c=W9();ut(c,"transform",`rotate(${l*(360/r)} 12 12)`);var u=j(c);ut(u,"dur","0.9s"),De(f=>ut(u,"begin",`${f??""}s`),[()=>-(l*(i/r)).toFixed(3)]),A(o,c)}),De(()=>Gn(s,0,Xi(n()))),A(t,s),Et()}var d2=ne('<!> <span class="plan-summary-text svelte-jke3x0"> </span>',1),H9=ne('<button class="plan-summary svelte-jke3x0"><!> <!></button>'),V9=ne('<span class="plan-elapsed svelte-jke3x0"> </span>'),$9=ne('<li><span aria-hidden="true"><!></span> <span class="plan-title svelte-jke3x0"> </span> <!></li>'),G9=ne('<div class="plan-head svelte-jke3x0"><span class="plan-head-label svelte-jke3x0">Plan</span> <span class="plan-head-count svelte-jke3x0"> </span></div> <ul class="plan-list svelte-jke3x0"></ul>',1),Y9=ne("<div><!></div>"),K9=ne('<div class="step-head svelte-jke3x0"> </div>'),X9=ne("<!> <!>",1),Z9=ne('<div class="tools svelte-jke3x0"></div>'),Q9=ne('<div class="thinking err svelte-jke3x0"><!> <span class="thinking-text svelte-jke3x0"> </span></div>'),J9=ne('<!> <div><!> <span class="thinking-text svelte-jke3x0">Working…</span></div> <!>',1);function eB(t,e){Tt(e,!0);let n=te(e,"tools",19,()=>[]),r=te(e,"status",3,"idle"),i=te(e,"label",3,null),s=te(e,"isLast",3,!1),o=te(e,"planSteps",19,()=>[]);const a=new Set(["done","failed","abandoned"]),l=V(()=>new Map(o().map(N=>[N.seq,N.title]))),c=V(()=>{var z;const N=[];let B=null;for(const H of n()){const X=H.stepSeq;(!B||(((z=B.step)==null?void 0:z.seq)??null)!==(X??null))&&(B={step:X!=null&&d(l).has(X)?{seq:X,title:d(l).get(X)}:null,tools:[]},N.push(B)),B.tools.push(H)}return N}),u=V(()=>n().length>0&&n()[n().length-1].type==="tool_use"),f=V(()=>r()==="running"&&!d(u)),h=V(()=>s()&&o().length>0),p=V(()=>!!e.taskStatus&&a.has(e.taskStatus));let g=Se(!1);const m=V(()=>o().filter(N=>N.status==="done").length),b=V(()=>o().find(N=>N.status==="failed"));let y=Se(gn(Date.now()));Qt(()=>{if(!o().some(z=>z.status==="running"))return;const B=setInterval(()=>{I(y,Date.now(),!0)},1e3);return()=>clearInterval(B)});function _(N){if(N.status!=="running"||!N.started_at)return"";const B=Math.max(0,Math.floor((d(y)-new Date(N.started_at).getTime())/1e3));return B<60?`${B}s`:B<3600?`${Math.floor(B/60)}m`:`${Math.floor(B/3600)}h ${Math.floor(B%3600/60)}m`}var k=J9(),S=Me(k);{var E=N=>{var B=Y9(),z=j(B);{var H=G=>{var Z=H9(),oe=j(Z);{var K=J=>{var fe=d2(),$=Me(fe);ru($,{class:"size-3 text-destructive"});var de=ee($,2),Be=j(de);De(()=>je(Be,`Plan failed — step ${d(b).seq??""}`)),A(J,fe)},q=J=>{var fe=d2(),$=Me(fe);zg($,{class:"size-3 text-primary"});var de=ee($,2),Be=j(de);De(()=>je(Be,`Plan complete — ${d(m)??""}/${o().length??""} steps`)),A(J,fe)};xe(oe,J=>{d(b)?J(K):J(q,-1)})}var W=ee(oe,2);D1(W,{class:"size-3 text-muted-foreground/60"}),Ln("click",Z,()=>I(g,!0)),A(G,Z)},X=G=>{var Z=G9(),oe=Me(Z),K=ee(j(oe),2),q=j(K),W=ee(oe,2);Rn(W,21,o,J=>J.id,(J,fe)=>{var $=$9(),de=j($),Be=j(de);{var wt=_t=>{Xg(_t,{class:"size-3 text-primary"})},Je=_t=>{zg(_t,{class:"size-2.5",strokeWidth:3.5})},Ue=_t=>{ru(_t,{class:"size-2.5",strokeWidth:3.5})},ke=_t=>{hN(_t,{class:"size-2",strokeWidth:3})},ct=_t=>{ON(_t,{class:"size-2",strokeWidth:3})};xe(Be,_t=>{d(fe).status==="running"?_t(wt):d(fe).status==="done"?_t(Je,1):d(fe).status==="failed"?_t(Ue,2):d(fe).status==="blocked"?_t(ke,3):(d(fe).status==="skipped"||d(fe).status==="replaced")&&_t(ct,4)})}var Ee=ee(de,2),Ve=j(Ee),be=ee(Ee,2);{var xt=_t=>{var Yt=V9(),en=j(Yt);De(tn=>je(en,tn),[()=>_(d(fe))]),A(_t,Yt)};xe(be,_t=>{d(fe).status==="running"&&_t(xt)})}De(()=>{Gn($,1,`plan-step ${d(fe).status==="running"?"running":""}`,"svelte-jke3x0"),Gn(de,1,`plan-node ${d(fe).status??""}`,"svelte-jke3x0"),ut(Ee,"title",d(fe).title),je(Ve,d(fe).title)}),A(J,$)}),De(()=>je(q,`${d(m)??""}/${o().length??""}`)),A(G,Z)};xe(z,G=>{d(p)&&!d(g)?G(H):G(X,-1)})}De(()=>Gn(B,1,`plan ${d(p)&&!d(g)?"plan-collapsed":""}`,"svelte-jke3x0")),A(N,B)};xe(S,N=>{d(h)&&N(E)})}var M=ee(S,2),O=j(M);Xg(O,{class:"size-3 shrink-0 text-primary"});var P=ee(M,2);{var x=N=>{var B=Z9();Rn(B,21,()=>d(c),$s,(z,H,X)=>{var G=X9(),Z=Me(G);{var oe=q=>{var W=K9(),J=j(W);De(()=>je(J,`Step ${d(H).step.seq??""} · ${d(H).step.title??""}`)),A(q,W)};xe(Z,q=>{d(H).step&&q(oe)})}var K=ee(Z,2);Rn(K,17,()=>d(H).tools,q=>q.id??`${X}-${q.name}`,(q,W)=>{U9(q,{get tool(){return d(W)}})}),A(z,G)}),A(N,B)},C=N=>{},R=N=>{var B=Q9(),z=j(B);ru(z,{class:"size-3 shrink-0 text-destructive"});var H=ee(z,2),X=j(H);De(()=>je(X,i()||"Turn ended with an error")),A(N,B)};xe(P,N=>{d(c).length>0?N(x):r()==="idle"&&n().length===0?N(C,1):r()==="error"&&N(R,2)})}De(()=>{Gn(M,1,`thinking ${d(f)?"":"thinking-hidden"}`,"svelte-jke3x0"),ut(M,"aria-hidden",!d(f))}),A(t,k),Et()}Fo(["click"]);var tB=ne('<div class="detail svelte-1mu9o59"><pre> </pre></div>'),nB=ne('<div class="thinking-block svelte-1mu9o59"><button class="row svelte-1mu9o59"><!> <span class="text min-w-0 flex-1 svelte-1mu9o59"><span class="label svelte-1mu9o59"> </span></span> <span class="summary svelte-1mu9o59"> </span> <!></button> <!></div>');function rB(t,e){Tt(e,!0);let n=Se(!1);var r=nB(),i=j(r),s=j(i);k4(s,{class:"icon size-3"});var o=ee(s,2),a=j(o),l=j(a),c=ee(o,2),u=j(c),f=ee(c,2);{let g=V(()=>d(n)?"open":"");D1(f,{get class(){return`chev size-3 ${d(g)??""}`}})}var h=ee(i,2);{var p=g=>{var m=tB(),b=j(m),y=j(b);De(()=>je(y,e.thinking)),A(g,m)};xe(h,g=>{d(n)&&g(p)})}De((g,m)=>{ut(i,"aria-expanded",d(n)),je(l,`Thought${g??""}`),je(u,`${m??""}${e.thinking.length>60?"…":""}`)},[()=>e.thinking.includes(`
`)?"s":"",()=>e.thinking.slice(0,60).replace(/\n/g," ")]),Ln("click",i,()=>I(n,!d(n))),A(t,r),Et()}Fo(["click"]);var iB=ne('<p class="mt-0.5 text-xs text-muted-foreground"> </p>'),sB=ne('<span class="rounded bg-muted px-1.5 py-0.5 font-mono text-[10px]"> </span>'),oB=ne('<div class="ml-6 flex flex-wrap gap-1"></div>'),aB=ne('<div class="ml-6 flex flex-wrap gap-1.5"></div>'),lB=ne('<div class="flex flex-col gap-2 rounded-2xl border border-warning/30 bg-warning/5 px-3.5 py-3"><div class="flex items-start gap-2"><!> <div class="min-w-0 flex-1"><p class="text-sm font-medium leading-snug"> </p> <!></div></div> <!> <!> <div class="ml-6 flex items-end gap-1.5"><!> <!></div></div>');function cB(t,e){Tt(e,!0);let n=Se(""),r=Se(!1);async function i(l){const c=e.sessionId,u=e.question;if(!c||!u||!l.trim()||d(r))return;I(r,!0);const f=await MI(c,u.id,l.trim());I(r,!1),f&&I(n,"")}var s=qe(),o=Me(s);{var a=l=>{const c=V(()=>e.question);var u=lB(),f=j(u),h=j(f);R4(h,{class:"mt-0.5 size-4 shrink-0 text-warning"});var p=ee(h,2),g=j(p),m=j(g),b=ee(g,2);{var y=x=>{var C=iB(),R=j(C);De(()=>je(R,d(c).context.why)),A(x,C)};xe(b,x=>{d(c).context.why&&x(y)})}var _=ee(f,2);{var k=x=>{var C=oB();Rn(C,21,()=>d(c).context.entities,$s,(R,N)=>{var B=sB(),z=j(B);De(()=>je(z,d(N))),A(R,B)}),A(x,C)};xe(_,x=>{var C;(C=d(c).context.entities)!=null&&C.length&&x(k)})}var S=ee(_,2);{var E=x=>{var C=aB();Rn(C,21,()=>d(c).context.options,$s,(R,N)=>{Rr(R,{size:"sm",variant:"outline",class:"h-7 px-2.5 text-xs",get disabled(){return d(r)},onclick:()=>i(d(N)),children:(B,z)=>{var H=er();De(()=>je(H,d(N))),A(B,H)},$$slots:{default:!0}})}),A(x,C)};xe(S,x=>{var C;(C=d(c).context.options)!=null&&C.length&&x(E)})}var M=ee(S,2),O=j(M);ty(O,{placeholder:"Or type an answer…",rows:1,class:"max-h-24 min-h-0 resize-none text-xs",get disabled(){return d(r)},onkeydown:x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),i(d(n)))},get value(){return d(n)},set value(x){I(n,x,!0)}});var P=ee(O,2);{let x=V(()=>!d(n).trim()||d(r));Rr(P,{size:"sm",class:"h-7 px-2.5 text-xs",get disabled(){return d(x)},onclick:()=>i(d(n)),children:(C,R)=>{var N=er("Send");A(C,N)},$$slots:{default:!0}})}De(()=>je(m,d(c).prompt)),A(l,u)};xe(o,l=>{e.question&&l(a)})}A(t,s),Et()}const Ur=Math.PI*2;function lt(t,e=0,n=1){return Number.isFinite(t)?t<e?e:t>n?n:t:Number.isFinite(e)?e:0}function Vi(t,e,n){return t+(e-t)*n}function Ts(t,e,n){if(!Number.isFinite(n))return 0;if(t===e)return n<t?0:1;const r=lt((n-t)/(e-t));return r*r*(3-2*r)}function Ja(t){return Number.isFinite(t)?t-Math.floor(t):0}const uB=Object.freeze([Object.freeze([0,48,12,60,3,51,15,63]),Object.freeze([32,16,44,28,35,19,47,31]),Object.freeze([8,56,4,52,11,59,7,55]),Object.freeze([40,24,36,20,43,27,39,23]),Object.freeze([2,50,14,62,1,49,13,61]),Object.freeze([34,18,46,30,33,17,45,29]),Object.freeze([10,58,6,54,9,57,5,53]),Object.freeze([42,26,38,22,41,25,37,21])]);function f2(t,e){const n=Number.isFinite(t)?Math.floor(t)&7:0,r=Number.isFinite(e)?Math.floor(e)&7:0;return(uB[r][n]+.5)/64}function h2(t=0){let e=2166136261;if(typeof t=="number"&&Number.isFinite(t))if(Number.isInteger(t))e^=t>>>0,e=Math.imul(e,16777619);else{const n=String(t);for(let r=0;r<n.length;r+=1)e^=n.charCodeAt(r),e=Math.imul(e,16777619)}else{const n=typeof t=="string"?t:String(t??0);for(let r=0;r<n.length;r+=1)e^=n.charCodeAt(r),e=Math.imul(e,16777619)}return e^=e>>>16,e=Math.imul(e,2146121005),e^=e>>>15,e=Math.imul(e,2221713035),e^=e>>>16,e>>>0}const un=Object.freeze({}),Wb=Math.SQRT2,zs=1/255;function Qe(t,e=0){return Number.isFinite(t)?t:e}function Ne(t,e,n,r=-1/0,i=1/0){if(!t)return n;const s=t[e];return Number.isFinite(s)?lt(s,r,i):n}function no(t,e,n,r,i){return Math.floor(Ne(t,e,n,r,i))}function ti(t,e){return lt((t-.5)*e+.5)}function kl(t){return t*t*t*(t*(t*6-15)+10)}function jp(t,e,n){switch(t&7){case 0:return e;case 1:return-e;case 2:return n;case 3:return-n;case 4:return(e+n)*Math.SQRT1_2;case 5:return(-e+n)*Math.SQRT1_2;case 6:return(e-n)*Math.SQRT1_2;default:return(-e-n)*Math.SQRT1_2}}function Ra(t,e,n,r){const i=t&15,s=i<8?e:n,o=i<4?n:i===12||i===14?e:r;return((i&1)===0?s:-s)+((i&2)===0?o:-o)}function Hr(t){return t instanceof fp?t:dB}class fp{constructor(e=0){const n=e&&typeof e=="object"&&"seed"in e?e.seed:e;this.seed=h2(n),this.permutation=new Uint8Array(512),this._cellF1=0,this._cellF2=0,this._cellHash=0,this._curlX=0,this._curlY=0,this._curlMagnitude=0,this._buildPermutation()}reseed(e=0){return this.seed=h2(e),this._buildPermutation(),this}setSeed(e=0){return this.reseed(e)}clone(){const e=new fp(0);return e.seed=this.seed,e.permutation.set(this.permutation),e}list(){return O5}has(e){return Q0(e)!==null}get(e){const n=Q0(e);return n===null?void 0:mf[n]}sample(e,n,r,i=0,s=un){const o=Q0(e);if(o===null)return 0;const a=mf[o](Qe(n),Qe(r),Qe(i),s||un,this);return lt(a)}hash2(e,n,r=0){const i=this.permutation,s=Qe(Math.floor(e))&255,o=Qe(Math.floor(n))&255,a=Qe(Math.floor(r))&255;return i[s+i[o+i[a]]]*zs}signedNoise2(e,n){return this._signedNoise2(Qe(e),Qe(n))}noise2(e,n){return this._signedNoise2(Qe(e),Qe(n))*.5+.5}signedNoise3(e,n,r){return this._signedNoise3(Qe(e),Qe(n),Qe(r))}noise3(e,n,r){return this._signedNoise3(Qe(e),Qe(n),Qe(r))*.5+.5}value2(e,n){e=Qe(e),n=Qe(n);const r=Math.floor(e),i=Math.floor(n),s=kl(e-r),o=kl(n-i),a=this.permutation,l=r&255,c=i&255,u=r+1&255,f=i+1&255,h=a[l+a[c]]*zs,p=a[u+a[c]]*zs,g=a[l+a[f]]*zs,m=a[u+a[f]]*zs;return lt(Vi(Vi(h,p,s),Vi(g,m,s),o))}fbmNoise(e,n,r=0,i=un){const s=no(i,"octaves",5,1,9),o=Ne(i,"lacunarity",2,1.01,4),a=Ne(i,"gain",.5,.05,.95);return this._fbmSigned(Qe(e),Qe(n),Qe(r),s,o,a)*.5+.5}ridgedNoise(e,n,r=0,i=un){return this._ridged(Qe(e),Qe(n),Qe(r),no(i,"octaves",5,1,9),Ne(i,"lacunarity",2.05,1.01,4),Ne(i,"gain",.52,.05,.95))}curl2(e,n,r=0,i=.0125,s){this._setCurl(Qe(e),Qe(n),Qe(r),lt(Qe(i,.0125),1e-4,.25));const o=s||new Float32Array(2);return o[0]=this._curlX,o[1]=this._curlY,o}cellular2(e,n,r=0,i=un){return this._setCellular(Qe(e),Qe(n),Qe(r),Ne(i,"jitter",.88,0,1),Ne(i,"motion",.1,0,.45)),lt(Math.sqrt(this._cellF1)/Wb)}voronoi2(e,n,r=0,i=un){return this._setCellular(Qe(e),Qe(n),Qe(r)+Ne(i,"phase",0,-1e4,1e4),Ne(i,"jitter",.88,0,1),Ne(i,"motion",.16,0,.45),Ne(i,"seedRate",.9,0,8)),lt((Math.sqrt(this._cellF2)-Math.sqrt(this._cellF1))/Wb)}fbm(e,n,r=0,i){return f5(e,n,r,i,this)}ridged(e,n,r=0,i){return h5(e,n,r,i,this)}domainWarp(e,n,r=0,i){return p5(e,n,r,i,this)}curl(e,n,r=0,i){return g5(e,n,r,i,this)}flow(e,n,r=0,i){return m5(e,n,r,i,this)}worley(e,n,r=0,i){return v5(e,n,r,i,this)}voronoi(e,n,r=0,i){return b5(e,n,r,i,this)}plasma(e,n,r=0,i){return y5(e,n,r,i,this)}interference(e,n,r=0,i){return w5(e,n,r,i,this)}vortex(e,n,r=0,i){return x5(e,n,r,i,this)}metaballs(e,n,r=0,i){return _5(e,n,r,i,this)}caustics(e,n,r=0,i){return S5(e,n,r,i,this)}strata(e,n,r=0,i){return k5(e,n,r,i,this)}radar(e,n,r=0,i){return M5(e,n,r,i,this)}constellation(e,n,r=0,i){return T5(e,n,r,i,this)}liquid(e,n,r=0,i){return E5(e,n,r,i,this)}electric(e,n,r=0,i){return A5(e,n,r,i,this)}ripple(e,n,r=0,i){return P5(e,n,r,i,this)}kaleidoscope(e,n,r=0,i){return C5(e,n,r,i,this)}_buildPermutation(){const e=this.permutation;for(let r=0;r<256;r+=1)e[r]=r;let n=this.seed||1831565813;for(let r=255;r>0;r-=1){n+=1831565813;let i=n;i=Math.imul(i^i>>>15,i|1),i^=i+Math.imul(i^i>>>7,i|61),i=(i^i>>>14)>>>0;const s=Math.floor(i/4294967296*(r+1)),o=e[r];e[r]=e[s],e[s]=o}for(let r=0;r<256;r+=1)e[r+256]=e[r]}_signedNoise2(e,n){const r=Math.floor(e),i=Math.floor(n),s=e-r,o=n-i,a=kl(s),l=kl(o),c=this.permutation,u=r&255,f=i&255,h=c[u+c[f]],p=c[u+1+c[f]],g=c[u+c[f+1]],m=c[u+1+c[f+1]],b=Vi(jp(h,s,o),jp(p,s-1,o),a),y=Vi(jp(g,s,o-1),jp(m,s-1,o-1),a);return lt(Vi(b,y,l)*1.55,-1,1)}_signedNoise3(e,n,r){const i=Math.floor(e),s=Math.floor(n),o=Math.floor(r),a=e-i,l=n-s,c=r-o,u=kl(a),f=kl(l),h=kl(c),p=this.permutation,g=i&255,m=s&255,b=o&255,y=p[g]+m,_=p[y]+b,k=p[y+1]+b,S=p[g+1]+m,E=p[S]+b,M=p[S+1]+b,O=Vi(Vi(Ra(p[_],a,l,c),Ra(p[E],a-1,l,c),u),Vi(Ra(p[k],a,l-1,c),Ra(p[M],a-1,l-1,c),u),f),P=Vi(Vi(Ra(p[_+1],a,l,c-1),Ra(p[E+1],a-1,l,c-1),u),Vi(Ra(p[k+1],a,l-1,c-1),Ra(p[M+1],a-1,l-1,c-1),u),f);return lt(Vi(O,P,h)*.94,-1,1)}_fbmSigned(e,n,r,i,s,o){let a=0,l=.5,c=0;for(let u=0;u<i;u+=1){a+=this._signedNoise3(e,n,r)*l,c+=l;const f=(e*.8-n*.6)*s+17.17;n=(e*.6+n*.8)*s-9.23,e=f,r=r*s+5.71,l*=o}return c>0?lt(a/c,-1,1):0}_ridged(e,n,r,i,s,o){let a=0,l=.5,c=0,u=1;for(let f=0;f<i;f+=1){let h=1-Math.abs(this._signedNoise3(e,n,r));h*=h,h*=u,u=lt(h*2.25),a+=h*l,c+=l;const p=(e*.764-n*.645)*s+11.37;n=(e*.645+n*.764)*s+3.19,e=p,r=r*s-4.31,l*=o}return c>0?lt(a/c):0}_setCurl(e,n,r,i){const s=(this._signedNoise3(e,n+i,r)-this._signedNoise3(e,n-i,r))/(i*2),o=(this._signedNoise3(e+i,n,r)-this._signedNoise3(e-i,n,r))/(i*2),a=s,l=-o,c=Math.hypot(a,l);this._curlMagnitude=Number.isFinite(c)?c:0,c>1e-9&&Number.isFinite(c)?(this._curlX=a/c,this._curlY=l/c):(this._curlX=0,this._curlY=0)}_setCellular(e,n,r,i,s,o){const a=Math.floor(e),l=Math.floor(n);let c=1/0,u=1/0,f=0;const h=this.permutation,p=o!==void 0&&s>0,g=p?r*o:0,m=Math.floor(g),b=p?Ja(g):0,y=b*b,_=y*b,k=(1-b)*(1-b)*(1-b)/6,S=(4-6*y+3*_)/6,E=(1+3*b+3*y-3*_)/6,M=_/6,O=p?h[m-1&255]:0,P=p?h[m&255]:0,x=p?h[m+1&255]:0,C=p?h[m+2&255]:0,R=p?Math.max(0,1-s*2):1;for(let N=-1;N<=1;N+=1){const B=l+N,z=B&255;for(let H=-1;H<=1;H+=1){const X=a+H,G=X&255,Z=h[G+h[z]],oe=h[G+h[z+71]],K=h[G+h[z+149]];let q=.5+(Z*zs-.5)*i*R,W=.5+(oe*zs-.5)*i*R;if(p){const de=(h[Z+O]*k+h[Z+P]*S+h[Z+x]*E+h[Z+C]*M)*zs*2-1,Be=(h[oe+O]*k+h[oe+P]*S+h[oe+x]*E+h[oe+C]*M)*zs*2-1;q+=de*s,W+=Be*s}else{const de=K*zs*Ur;q+=Math.sin(r+de)*s,W+=Math.cos(r*.91+de)*s}q=lt(q,.015,.985),W=lt(W,.015,.985);const J=X+q-e,fe=B+W-n,$=J*J+fe*fe;$<c?(u=c,c=$,f=K):$<u&&(u=$)}}this._cellF1=Number.isFinite(c)?c:0,this._cellF2=Number.isFinite(u)?u:this._cellF1,this._cellHash=f}}function f5(t,e,n=0,r=un,i){i=Hr(i),r=r||un;const s=Ne(r,"frequency",2.35,.001,256),o=Ne(r,"speed",.18,-20,20),a=i._fbmSigned(Qe(t)*s,Qe(e)*s,Qe(n)*o+Ne(r,"phase",0,-1e4,1e4),no(r,"octaves",5,1,9),Ne(r,"lacunarity",2,1.01,4),Ne(r,"gain",.5,.05,.95))*.5+.5;return ti(a,Ne(r,"contrast",1.08,0,8))}function h5(t,e,n=0,r=un,i){i=Hr(i),r=r||un;const s=Ne(r,"frequency",2.7,.001,256),o=i._ridged(Qe(t)*s,Qe(e)*s,Qe(n)*Ne(r,"speed",.22,-20,20),no(r,"octaves",5,1,9),Ne(r,"lacunarity",2.04,1.01,4),Ne(r,"gain",.53,.05,.95));return ti(o,Ne(r,"contrast",1.32,0,8))}function p5(t,e,n=0,r=un,i){i=Hr(i),r=r||un;const s=Ne(r,"frequency",2.1,.001,256),o=Ne(r,"speed",.2,-20,20),a=Ne(r,"warp",.72,0,6),l=Qe(t)*s,c=Qe(e)*s,u=Qe(n)*o,f=i._fbmSigned(l+5.2,c+1.3,u,3,2,.5),h=i._fbmSigned(l-2.8,c+8.1,u+3.4,3,2,.5),p=i._fbmSigned(l+f*a,c+h*a,u+(f-h)*.22,no(r,"octaves",5,1,9),Ne(r,"lacunarity",2.02,1.01,4),Ne(r,"gain",.5,.05,.95))*.5+.5;return ti(p,Ne(r,"contrast",1.18,0,8))}function g5(t,e,n=0,r=un,i){i=Hr(i),r=r||un;const s=Ne(r,"frequency",2.2,.001,256),o=Qe(t)*s,a=Qe(e)*s,l=Qe(n)*Ne(r,"speed",.18,-20,20);i._setCurl(o,a,l,Ne(r,"epsilon",.018,1e-4,.2));const c=1-Math.exp(-i._curlMagnitude*Ne(r,"strength",.72,.001,20)),u=i._fbmSigned(o*.63,a*.63,l+4.7,3,2,.5)*.5+.5;return ti(c*.74+u*.26,Ne(r,"contrast",1.2,0,8))}function m5(t,e,n=0,r=un,i){i=Hr(i),r=r||un;const s=Ne(r,"frequency",2.15,.001,256),o=Ne(r,"speed",.24,-20,20),a=Qe(t)*s,l=Qe(e)*s,c=Qe(n)*o;i._setCurl(a*.72,l*.72,c,.02);const u=Ne(r,"warp",.65,0,6),f=a+i._curlX*u,h=l+i._curlY*u,p=i._fbmSigned(f,h,c,4,2.03,.5),g=f*i._curlX*.37+h*i._curlY*.37+p*1.35,b=(.5+Math.sin(g*Ur-c*Ne(r,"travel",1.7,-20,20))*.5)*.72+(p*.5+.5)*.28;return ti(b,Ne(r,"contrast",1.28,0,8))}function v5(t,e,n=0,r=un,i){i=Hr(i),r=r||un;const s=Ne(r,"frequency",3.4,.001,256);i._setCellular(Qe(t)*s,Qe(e)*s,Qe(n)*Ne(r,"speed",.52,-20,20),Ne(r,"jitter",.9,0,1),Ne(r,"motion",.1,0,.45));const o=Math.sqrt(i._cellF1)/Wb,a=1-Ts(Ne(r,"inner",.035,0,1),Ne(r,"outer",.62,.001,2),o);return ti(a,Ne(r,"contrast",1.1,0,8))}function b5(t,e,n=0,r=un,i){i=Hr(i),r=r||un;const s=Ne(r,"frequency",3.25,.001,256);i._setCellular(Qe(t)*s,Qe(e)*s,Qe(n)*Ne(r,"speed",.43,-20,20)+Ne(r,"phase",0,-1e4,1e4),Ne(r,"jitter",.92,0,1),Ne(r,"motion",.16,0,.45),Ne(r,"seedRate",.9,0,8));const o=Math.sqrt(i._cellF2)-Math.sqrt(i._cellF1),a=Ne(r,"width",.085,.001,1),l=1-Ts(a,a*2.75,o);return ti(l,Ne(r,"contrast",1.32,0,8))}function y5(t,e,n=0,r=un,i){i=Hr(i),r=r||un;const s=Ne(r,"frequency",1.45,.001,256),o=Qe(t)*s,a=Qe(e)*s,l=Qe(n)*Ne(r,"speed",.62,-20,20)+Ne(r,"phase",0,-1e4,1e4),c=i._fbmSigned(o*.7,a*.7,l*.18,3,2,.5),u=Math.sin(o*Ur+l+c*1.6),f=Math.sin(a*Ur*1.13-l*1.17-c*1.35),h=Math.sin((o+a)*Ur*.61+l*.71+c*2.1),p=Math.sin(Math.hypot(o-.5,a-.5)*Ur*2.2-l);return ti(.5+(u+f+h+p)*.125,Ne(r,"contrast",1.12,0,8))}function w5(t,e,n=0,r=un,i){i=Hr(i),r=r||un;const s=Ne(r,"frequency",8.5,.01,256),o=Qe(n)*Ne(r,"speed",2.1,-50,50),a=Qe(t),l=Qe(e),c=o*.23+i.seed*1e-7,u=-o*.19+i.seed*17e-8,f=.24+Math.sin(c)*.09,h=.35+Math.cos(c*.87)*.11,p=.76+Math.cos(u)*.1,g=.64+Math.sin(u*1.09)*.09,m=Math.hypot(a-f,l-h),b=Math.hypot(a-p,l-g),y=Math.sin(m*s*Ur-o),_=Math.sin(b*s*Ur*1.037-o*1.11),k=Math.sin((m-b)*s*Ur*.53+o*.31);return ti(.5+(y+_)*.19+k*.12,Ne(r,"contrast",1.2,0,8))}function x5(t,e,n=0,r=un,i){i=Hr(i),r=r||un;const s=Ne(r,"centerX",0,-1e3,1e3),o=Ne(r,"centerY",0,-1e3,1e3),a=Ne(r,"frequency",1,.001,256),l=(Qe(t)-s)*a,c=(Qe(e)-o)*a,u=Math.hypot(l,c),f=Math.atan2(c,l),h=Qe(n)*Ne(r,"speed",1.4,-50,50),p=i._fbmSigned(l*2.1+4.2,c*2.1-3.7,h*.11,4,2,.5),g=no(r,"arms",4,1,16),m=Ne(r,"turns",3.8,-30,30),b=f*g+u*m*Ur+p*2.2-h,y=.5+Math.sin(b)*.5,_=Ne(r,"radius",1.15,.01,20),k=1-Ts(_*.72,_,u);return ti(y*(.58+k*.42),Ne(r,"contrast",1.25,0,8))}function _5(t,e,n=0,r=un,i){i=Hr(i),r=r||un;const s=Ne(r,"frequency",1,.001,256),o=Ja(Qe(t)*s),a=Ja(Qe(e)*s),l=Qe(n)*Ne(r,"speed",.7,-20,20),c=no(r,"count",6,2,16),u=Ne(r,"radius",.115,.005,.5),f=u*u;let h=0;for(let g=0;g<c;g+=1){const m=i.hash2(g,17,41),b=i.hash2(g,79,113),y=i.hash2(g,151,197)*Ur,_=Ja(m+Math.sin(l*(.52+b)+y)*.17),k=Ja(b+Math.cos(l*(.48+m)+y)*.17);let S=Math.abs(o-_),E=Math.abs(a-k);S=Math.min(S,1-S),E=Math.min(E,1-E);const M=S*S+E*E;h+=f/(M+f)}const p=Ne(r,"threshold",.72,.05,8);return ti(Ts(p*.55,p*1.35,h),Ne(r,"contrast",1.15,0,8))}function S5(t,e,n=0,r=un,i){i=Hr(i),r=r||un;const s=Ne(r,"frequency",4,.001,256),o=Qe(n)*Ne(r,"speed",.56,-20,20),a=Qe(t)*s,l=Qe(e)*s,c=i._fbmSigned(a*.41,l*.41,o*.2,3,2,.5),u=i._fbmSigned(a*.41+8.7,l*.41-2.4,o*.2,3,2,.5);i._setCellular(a+c*.42,l+u*.42,o,.96,.12);const f=Math.sqrt(i._cellF2)-Math.sqrt(i._cellF1),h=Ne(r,"width",.075,.001,.5),p=1-Ts(h,h*3.1,f),g=1-Ts(.04,.3,Math.abs(i._signedNoise3(a*.72+c,l*.72+u,o*.24)));return ti(Math.max(p,g*.68),Ne(r,"contrast",1.45,0,8))}function k5(t,e,n=0,r=un,i){i=Hr(i),r=r||un;const s=Ne(r,"frequency",1,.001,256),o=Qe(t)*s,a=Qe(e)*s,l=Qe(n)*Ne(r,"speed",.12,-20,20),c=i._fbmSigned(o*1.7,a*1.1,l,5,2,.5),u=i._signedNoise3(o*6.3,a*2.2,l*.7),f=Ne(r,"bands",8,.1,128),h=Ne(r,"slope",.12,-20,20),p=(a+o*h+c*Ne(r,"warp",.16,0,5)-l*.03)*f;let g=.5+Math.sin(p*Ur+u*.35)*.5;return g=Math.pow(g,Ne(r,"sharpness",1.5,.1,12)),g=g*.86+(u*.5+.5)*.14,ti(g,Ne(r,"contrast",1.18,0,8))}function M5(t,e,n=0,r=un,i){i=Hr(i),r=r||un;const s=Qe(t)-Ne(r,"centerX",0,-1e3,1e3),o=Qe(e)-Ne(r,"centerY",0,-1e3,1e3),a=Math.hypot(s,o),l=Math.atan2(o,s),c=Qe(n)*Ne(r,"speed",1.15,-50,50)+Ne(r,"phase",0,-1e4,1e4);let u=l-c;u=Math.atan2(Math.sin(u),Math.cos(u));const f=Ne(r,"beamWidth",.18,.005,Math.PI),h=Math.exp(-Math.abs(u)/f),p=Ne(r,"radius",1.05,.01,20),g=1-Ts(p*.86,p,a),m=Ne(r,"rings",5,1,64),b=Ja(a/p*m),y=Math.min(b,1-b),_=(1-Ts(Ne(r,"ringWidth",.025,.001,.49),.12,y))*g*.34;let k=0;const S=no(r,"targets",7,0,20);for(let E=0;E<S;E+=1){const M=i.hash2(E,31,97)*1.72-.86,O=i.hash2(E,83,181)*1.72-.86,P=Qe(t)-M,x=Qe(e)-O,C=Math.exp(-(P*P+x*x)/Ne(r,"blipSize",85e-5,1e-5,.1));C>k&&(k=C)}return lt(Math.max(h*g*.78,_,k*(.28+h*.72)))}function T5(t,e,n=0,r=un,i){i=Hr(i),r=r||un;const s=Ne(r,"frequency",4.2,.001,256),o=Qe(t)*s,a=Qe(e)*s,l=Qe(n)*Ne(r,"speed",1.7,-50,50);i._setCellular(o,a,0,Ne(r,"jitter",.96,0,1),0);const c=Math.sqrt(i._cellF1),u=Math.sqrt(i._cellF2)-c,f=Ne(r,"starSize",.12,.005,1),h=1-Ts(f*.16,f,c),p=.68+.32*Math.sin(l+i._cellHash*zs*Ur+c*8),g=Ne(r,"lineWidth",.035,.001,.5),m=(1-Ts(g,g*3.8,u))*Ne(r,"lineOpacity",.28,0,1);return ti(Math.max(h*p,m),Ne(r,"contrast",1.3,0,8))}function E5(t,e,n=0,r=un,i){i=Hr(i),r=r||un;const s=Ne(r,"frequency",2.3,.001,256),o=Qe(n)*Ne(r,"speed",.35,-20,20),a=Qe(t)*s,l=Qe(e)*s,c=i._fbmSigned(a*.72,l*.72,o,4,2,.52),u=i._fbmSigned(a*.72+6.2,l*.72-1.7,o+2.1,4,2,.52),f=Ne(r,"warp",.58,0,6),h=i._fbmSigned(a+c*f,l+u*f,o*.72,no(r,"octaves",5,1,9),2.03,.51),p=.5+Math.sin((l+c*.42)*Ur*1.35-o*2.4)*.5,g=Math.pow(1-Math.abs(i._signedNoise3(a*1.8+u,l*1.8,o)||0),5);return ti((h*.5+.5)*.52+p*.31+g*.17,Ne(r,"contrast",1.18,0,8))}function A5(t,e,n=0,r=un,i){i=Hr(i),r=r||un;const s=Ne(r,"frequency",1.6,.001,256),o=Ja(Qe(t)*s)-.5,a=Qe(e)*s,l=Qe(n)*Ne(r,"speed",1.8,-50,50),c=i._fbmSigned(a*.46,l*.17,l*.11,6,2.12,.54)*Ne(r,"wander",.26,0,.48),u=i._fbmSigned(a*.93+8.4,l*.23,l*.19,4,2,.5),f=Ne(r,"width",.025,.001,.3),h=Math.exp(-Math.abs(o-c)/f),p=.1+Math.abs(u)*.17,g=Ts(-.2,.65,u),m=Math.exp(-Math.abs(o-c-p)/(f*1.8))*g,b=Math.exp(-Math.abs(o-c+p)/(f*1.8))*(1-g),y=.67+.33*Math.sin(a*Ur*Ne(r,"travel",2.4,-30,30)-l*4.1),_=i._ridged(o*14,a*8,l*.5,3,2.2,.46);return ti(Math.max(h,m*.7,b*.7)*y*(.72+_*.28),Ne(r,"contrast",1.65,0,8))}function P5(t,e,n=0,r=un,i){i=Hr(i),r=r||un;const s=Ne(r,"centerX",0,-1e3,1e3),o=Ne(r,"centerY",0,-1e3,1e3),a=Qe(t)-s,l=Qe(e)-o,c=Qe(n)*Ne(r,"speed",1.5,-50,50),u=i._fbmSigned(a*4,l*4,c*.12,4,2,.5),f=Math.hypot(a,l)+u*Ne(r,"warp",.035,0,1),h=Ne(r,"frequency",11,.01,256),p=.5+Math.sin(f*h*Ur-c*Ur)*.5,g=1-Ts(Ne(r,"radius",1.15,.01,20)*.82,Ne(r,"radius",1.15,.01,20),f);return ti(Math.pow(p,Ne(r,"sharpness",2.1,.1,16))*g,Ne(r,"contrast",1.2,0,8))}function C5(t,e,n=0,r=un,i){i=Hr(i),r=r||un;const s=Qe(t)-Ne(r,"centerX",0,-1e3,1e3),o=Qe(e)-Ne(r,"centerY",0,-1e3,1e3),a=Math.hypot(s,o),l=no(r,"segments",8,2,32),c=Ur/l;let u=Math.atan2(o,s)+Qe(n)*Ne(r,"speed",.32,-20,20);u=Ja(u/c)*c,u=Math.abs(u-c*.5);const f=Math.cos(u)*a,h=Math.sin(u)*a,p=Ne(r,"frequency",7,.001,256),g=i._fbmSigned(f*p,h*p,Qe(n)*.16,no(r,"octaves",5,1,9),2.03,.5),m=.5+Math.sin(a*Ur*Ne(r,"rings",5,0,64)+g*2.3)*.5;return ti((g*.5+.5)*.58+m*.42,Ne(r,"contrast",1.24,0,8))}const mf=Object.freeze({fbm:f5,ridged:h5,"domain-warp":p5,curl:g5,flow:m5,worley:v5,voronoi:b5,plasma:y5,interference:w5,vortex:x5,metaballs:_5,caustics:S5,strata:k5,radar:M5,constellation:T5,liquid:E5,electric:A5,ripple:P5,kaleidoscope:C5}),O5=Object.freeze(Object.keys(mf)),Kd=Object.freeze({noise:"fbm",turbulence:"fbm",ridge:"ridged",domainWarp:"domain-warp",domain_warp:"domain-warp",warp:"domain-warp","curl-flow":"flow",curlFlow:"flow",cellular:"worley",cells:"voronoi",cell:"voronoi",water:"liquid",lightning:"electric",waves:"ripple",mandala:"kaleidoscope"});function Q0(t){if(typeof t!="string")return null;if(Object.prototype.hasOwnProperty.call(mf,t))return t;if(Object.prototype.hasOwnProperty.call(Kd,t))return Kd[t];const e=t.trim().toLowerCase().replace(/[\s_]+/g,"-");return Object.prototype.hasOwnProperty.call(mf,e)?e:Object.prototype.hasOwnProperty.call(Kd,e)?Kd[e]:null}const dB=new fp(0),fr=Math.PI*2,zo=Math.PI*.5,hr=Object.freeze({}),Zs=(t,e,n)=>Math.min(n,Math.max(e,t)),An=t=>Zs(t,0,1),xn=(t,e=0)=>Number.isFinite(Number(t))?Number(t):e,Lo=t=>t-Math.floor(t),Zg=t=>(t%fr+fr)%fr;function pi(t,e,n){if(t===e)return n<t?0:1;const r=An((n-t)/(e-t));return r*r*(3-2*r)}function Cs(t,e){return e!=null&&e.reducedMotion?xn(e.reducedPhase,.23)*fr:xn(t)}function R5(t){const e=xn(t==null?void 0:t.feather,-1);if(e>=0)return Zs(e,.006,.18);const n=Zs(xn((t==null?void 0:t.resolution)??(t==null?void 0:t.size),24),8,1024);return Zs(.86/n,.008,.085)}function on(t,e,n=1){const r=R5(e)*n;return 1-pi(-r,r,t)}function Wr(t,e,n){return Math.hypot(t,e)-n}function Do(t,e,n,r,i){const s=Math.min(i,n,r),o=Math.abs(t)-n+s,a=Math.abs(e)-r+s;return Math.hypot(Math.max(o,0),Math.max(a,0))+Math.min(Math.max(o,a),0)-s}function Xn(t,e,n,r,i,s,o){const a=i-n,l=s-r,c=a*a+l*l||1,u=An(((t-n)*a+(e-r)*l)/c);return Math.hypot(t-(n+a*u),e-(r+l*u))-o}function ei(t,e,n,r,i,s){const o=Zs(s,0,fr);if(o>=fr-1e-5||Zg(Math.atan2(e,t)-i)<=o)return Math.abs(Math.hypot(t,e)-n)-r;const l=i+o,c=Math.hypot(t-Math.cos(i)*n,e-Math.sin(i)*n)-r,u=Math.hypot(t-Math.cos(l)*n,e-Math.sin(l)*n)-r;return Math.min(c,u)}function ul(t,e,n){let r=!1,i=1/0,s=n.length-1;for(let o=0;o<n.length;o+=1){const a=n[s][0],l=n[s][1],c=n[o][0],u=n[o][1],f=c-a,h=u-l,p=f*f+h*h||1,g=An(((t-a)*f+(e-l)*h)/p),m=t-(a+f*g),b=e-(l+h*g);i=Math.min(i,m*m+b*b),l>e!=u>e&&t<(c-a)*(e-l)/(u-l||Number.EPSILON)+a&&(r=!r),s=o}return Math.sqrt(i)*(r?-1:1)}function Ku(t,e=0){return Lo(Math.sin(t*127.1+e*311.7)*43758.5453123)}function J0(t,e=0){let n=(Math.trunc(e)^Math.imul(t+1,2654435761))>>>0;return n=Math.imul(n^n>>>16,569420461),n=Math.imul(n^n>>>15,1935289751),((n^n>>>15)>>>0)/4294967296}function N5(t,e=hr,n=.5){const r=xn(e==null?void 0:e.seed,0),i=Zs(xn(n,.5),0,1),s=J0(701,r)*fr,o=1.14-i*.34;let a=0;for(let c=0;c<4;c+=1){const u=s+c*fr/4+(J0(733+c*29,r)-.5)*.54,f=(.32+J0(811+c*37,r)*.17)*o,h=Math.abs(Zg(t-u+Math.PI)-Math.PI),p=1-pi(f*.7,f,h);a=Math.max(a,p)}const l=.92+An(xn(e==null?void 0:e.random,.5))*.08;return An(a*l)}const fB=Object.freeze([Object.freeze([0,-.72]),Object.freeze([.69,.56]),Object.freeze([-.69,.56])]),qb=Object.freeze([Object.freeze([0,-.64]),Object.freeze([.62,0]),Object.freeze([0,.64]),Object.freeze([-.62,0])]),hB=Object.freeze([Object.freeze([-.25,-.34]),Object.freeze([.25,-.34]),Object.freeze([0,-.055])]),pB=Object.freeze([Object.freeze([0,.055]),Object.freeze([.25,.34]),Object.freeze([-.25,.34])]),gB=3.2,mB=Object.freeze([Object.freeze([-.57,-.2]),Object.freeze([-.32,-.2]),Object.freeze([.02,-.49]),Object.freeze([.02,.49]),Object.freeze([-.32,.2]),Object.freeze([-.57,.2])]),vB=Object.freeze(Array.from({length:10},(t,e)=>{const n=-zo+e*Math.PI/5,r=e%2===0?.67:.29;return Object.freeze([Math.cos(n)*r,Math.sin(n)*r])})),p2=Object.freeze({down:0,up:Math.PI,right:-zo,left:zo});function bB(t,e,n=0,r=hr){const i=r!=null&&r.reducedMotion?An(xn(r.reducedPhase,.18)):Number.isFinite(Number(r==null?void 0:r.timelinePhase))?Lo(Number(r.timelinePhase)):Lo(xn(n)/14.4),s=Math.sin(i*fr*2-zo),o=.67+s*.022,a=Math.hypot(t,e),l=t/o,c=e/o,u=Math.sqrt(Math.max(0,1-l*l-c*c)),f=i*fr-.72;let h=Math.cos(f),p=-.28,g=Math.sin(f)*.9;const m=Math.hypot(h,p,g)||1;h/=m,p/=m,g/=m;const b=l*h+c*p+u*g,y=R5(r),_=Math.pow(Math.max(0,b),1.25),k=pi(-.24-y,.26+y,b),S=An(_*.82+k*.28),E=.68+u*.32,M=on(Wr(t,e,o),r),O=M*S*E*(1+s*.035);if((r==null?void 0:r.orbBoundary)==="gestalt"){const R=2/Zs(xn((r==null?void 0:r.resolution)??(r==null?void 0:r.size),68),8,1024),N=Zs(R*3.1,.06,.2),B=N5(Math.atan2(e,t),r,r==null?void 0:r.gestaltOpenness),z=pi(o-N*1.16,o-N*.42,a)*M,H=An(S*E*(1+s*.035)),X=1-pi(.42,.74,H),G=z*B*(.34+S*.38+E*.08)*X;return An(Math.max(O,G))}const P=.038+(s+1)*.002,x=on(Math.abs(a-o)-P,r);return An(Math.max(x*.86,O))}function yB(t,e,n=0,r=hr){const i=Cs(n,r),s=An(xn(r.audioLevel??r.level??r.energy,.28)),o=Do(t,e+.09,.155,.34,.15),a=ei(t,e+.04,.39,.068,.05,Math.PI-.1),l=Xn(t,e,0,.43,0,.64,.062),c=Xn(t,e,-.2,.64,.2,.64,.062);let u=on(Math.min(o,a,l,c),r);const h=.47+Lo(i*.34)*.25,p=on(ei(t,e+.03,h,.038+s*.025,-.7,1.4),r),g=on(ei(t,e+.03,h,.038+s*.025,Math.PI-.7,1.4),r);return u=Math.max(u,(p+g)*.5*(.35+s)),An(u)}function wB(t,e,n=0,r=hr){const s=Cs(n,r)*.68-zo,o=.51;let a=ei(t,e,o,.052,s+.36,fr-.98);for(let c=0;c<3;c+=1){const u=s+c*fr/3,f=Wr(t-Math.cos(u)*o,e-Math.sin(u)*o,c===0?.115:.09);a=Math.min(a,f)}const l=Wr(t,e,.115);return on(Math.min(a,l),r)}function xB(t,e,n=0,r=hr){const i=Cs(n,r),s=i*.24-zo,o=-i*.37+.3,a=i*.52+1.1,l=ei(t,e,.62,.064,s,fr-1.02),c=ei(t,e,.4,.061,o,fr-1.16),u=ei(t,e,.21,.058,a,fr-1.32),f=s+fr-1.02,h=o+fr-1.16,p=Wr(t-Math.cos(f)*.62,e-Math.sin(f)*.62,.092),g=Wr(t-Math.cos(h)*.4,e-Math.sin(h)*.4,.078),m=Wr(t,e,.07+Math.sin(i*.8)*.012);return on(Math.min(l,c,u,p,g,m),r)}function _B(t,e,n=0,r=hr){const i=!!(r!=null&&r.reducedMotion),s=Math.max(0,xn((r==null?void 0:r.age)??(r==null?void 0:r.elapsed),xn(n))),o=Lo(s/gB),a=i?An(xn(r==null?void 0:r.reducedPhase,.46)):o>=1-1e-9?0:o,l=pi(.03,.48,a),c=pi(.5,.76,a),u=i?0:c*Math.PI,f=Math.cos(u),h=Math.sin(u),p=t*f+e*h,g=-t*h+e*f,m=Xn(p,g,-.32,-.43,.32,-.43,.06),b=Xn(p,g,-.32,.43,.32,.43,.06),y=Xn(p,g,-.29,-.37,-.075,0,.055),_=Xn(p,g,-.075,0,-.29,.37,.055),k=Xn(p,g,.29,-.37,.075,0,.055),S=Xn(p,g,.075,0,.29,.37,.055),E=on(Math.min(m,b,y,_,k,S),r),M=-.34+l*.285,O=.34-l*.285,P=on(Math.max(ul(p,g,hB),M-g),r,.82),x=on(Math.max(ul(p,g,pB),O-g),r,.82),C=Math.sin(l*Math.PI),R=on(Xn(p,g,0,-.08,0,.17,.026),r)*C,N=on(Wr(p,g-(-.03+l*.25),.036),r)*C,B=-.44,z=.78,H=ei(p,g,.67,.036,B,z),X=ei(p,g,.67,.036,B+Math.PI,z),G=B+z,Z=G+Math.PI,oe=Math.min(Wr(p-Math.cos(G)*.67,g-Math.sin(G)*.67,.065),Wr(p-Math.cos(Z)*.67,g-Math.sin(Z)*.67,.065)),K=on(Math.min(H,X,oe),r)*.68;return An(Math.max(E,P,x,R,N,K))}function SB(t,e,n=0,r=hr){const i=Cs(n,r),s=Zs(Math.round(xn(r.segments,8)),6,12),o=Zg(i*xn(r.rotationSpeed,1.35));let a=0;for(let l=0;l<s;l+=1){const c=l/s*fr-zo,u=fr/s*.56,f=on(ei(t,e,.53,.09,c,u),r),h=Zg(o-(c+u*.5)),p=Math.exp(-h*.68);a=Math.max(a,f*(.56+p*.44))}return An(a)}function kB(t,e,n=0,r=hr){const i=An(xn(r.progress??r.value,.62)),s=on(Math.abs(Math.hypot(t,e)-.54)-.075,r),o=i<=0?0:Math.max(.012,fr*i),a=i<=0?0:on(ei(t,e,.54,.105,-zo,o),r),l=-zo+o,c=i<=0?0:on(Wr(t-Math.cos(l)*.54,e-Math.sin(l)*.54,.105),r);let u=Math.max(s*.4,a,c);return i>=.995&&(u=Math.max(u,on(Math.min(Xn(t,e,-.27,.01,-.07,.22,.085),Xn(t,e,-.07,.22,.33,-.25,.085)),r))),An(u)}function MB(t,e,n=0,r=hr){const i=Cs(n,r),s=An(xn(r.progress??r.value,.48));let o=on(Math.max(ul(t,e,qb),-ul(t,e,qb)-.105),r);const a=Math.min(Xn(t,e,-.25,0,.25,0,.058),Xn(t,e,0,-.25,0,.25,.058));o=Math.max(o,on(a,r));const l=r.targetGlyph;if(typeof l=="string"&&z5(l)!=="generating"){const u=typeof r.glyphSampler=="function"?r.glyphSampler(l,t,e,n,r):L5(l)(t,e,n,r);o=Math.max(o*(1-s*.7),u*s)}const c=xn(r.seed,0);for(let u=0;u<5;u+=1){const f=Lo(i*(.11+u*.009)+Ku(u,c)),h=Ku(u+19,c)*fr+i*.19,p=.78-f*.57,g=Math.cos(h)*p,m=Math.sin(h)*p,b=on(Wr(t-g,e-m,.045+f*.025),r);o=Math.max(o,b*(.35+s*.65))}return An(o)}function TB(t,e,n=0,r=hr){const i=Cs(n,r),s=t+.1,o=e+.11,a=Math.abs(Math.hypot(s,o)-.4)-.085,l=Xn(t,e,.21,.2,.59,.58,.095),c=i*1.12-zo,u=Xn(s,o,0,0,Math.cos(c)*.34,Math.sin(c)*.34,.047);let f=on(Math.min(a,l),r);f=Math.max(f,on(u,r)*.72);const h=Zs(Math.round(xn(r.hits,2)),0,8);for(let p=0;p<h;p+=1){const g=Ku(p+7,xn(r.seed,0))*fr,m=.12+Ku(p+13,xn(r.seed,0))*.18,b=on(Wr(s-Math.cos(g)*m,o-Math.sin(g)*m,.045),r);f=Math.max(f,b)}return An(f)}function EB(t,e,n=0,r=hr){const i=Cs(n,r),s=Math.max(1,Math.round(xn(r.steps,12))),o=r.reducedMotion?xn(r.reducedPhase,.125)*fr:Math.floor(i*1.8*s)/s,a=Math.cos(o),l=Math.sin(o),c=t*a+e*l,u=-t*l+e*a,f=Math.hypot(c,u),h=Math.cos(Math.atan2(u,c)*8),p=pi(.18,.55,h)*.105,g=f-(.5+p),m=f-.275,b=Math.max(g,-m),y=Math.abs(f-.125)-.043,_=Math.min(Do(c,u,.38,.044,.025),Do(c,u,.044,.38,.025)),k=Math.max(_,.165-f,f-.41);return on(Math.min(b,y,k),r)}function AB(t,e,n=0,r=hr){const i=Cs(n,r),s=.34+Math.max(0,Math.sin(i*5.1))*.32+Math.max(0,Math.sin(i*7.7+1.3))*.2,o=An(xn(r.audioLevel??r.level,s));let a=on(ul(t,e,mB),r);const l=on(ei(t-.01,e,.36,.065,-.72,1.44),r),c=on(ei(t-.01,e,.59,.065,-.68,1.36),r);return a=Math.max(a,l*(.42+o*.58)),a=Math.max(a,c*pi(.18,.78,o)),An(a)}function PB(t,e,n=0,r=hr){const i=r!=null&&r.reducedMotion?An(xn(r.reducedPhase,.44)):Number.isFinite(Number(r==null?void 0:r.timelinePhase))?Lo(Number(r.timelinePhase)):Lo(xn(n)/10.8),s=i*10.8,o=1-pi(.18,.5,Math.abs(s-.64)),a=(1-pi(.16,.46,Math.abs(s-1.42)))*.76,l=An(xn((r==null?void 0:r.acknowledgement)??(r==null?void 0:r.acknowledged),0)),c=Math.max(o,a)*(1-l),u=Zs(xn((r==null?void 0:r.resolution)??(r==null?void 0:r.size),68),8,1024),f=An((28-u)/12),h=Math.hypot(t,e),p=Math.atan2(e,t),g=i*fr,m=.65+c*.014-l*.008,b=on(Math.abs(h-m)-(.027+f*.01+c*.005),r),y=.755+t*e*.035,_=1-pi(.008,.034,Math.abs(h-y));let k=Math.max(0,Math.cos(p*7+Math.sin(g)*.42+t*1.1-e*.65));k*=k,k*=k,k*=k,k*=k;const S=.82+(t-e)*.06,E=An(_*k*(S+c*.24+l*.12)),M=.055+f*.008,O=Math.min(ei(t+.04,e+.18,.24,M,-2.72,3.58),Xn(t,e,.117,.002,.005,.145,M-.001),Xn(t,e,.005,.145,.005,.235,M-.001),Wr(t-.005,e-.405,.066+f*.014+c*.01)),P=on(O,r);return An(Math.max(P,b*(.52+f*.26+c*.28+l*.14),E))}function CB(t,e,n=0,r=hr){const i=Math.max(0,xn(r.age??r.elapsed,n)),s=Xn(t,e,-.48,.02,-.13,.34,.105),o=Xn(t,e,-.13,.34,.49,-.38,.105);let a=on(Math.min(s,o),r);if(!r.reducedMotion&&i<.72){const l=.5+pi(0,.72,i)*.28,c=on(Math.abs(Math.hypot(t,e)-l)-.04,r);a=Math.max(a,c*(1-pi(.2,.72,i)))}return An(a)}function OB(t,e,n=0,r=hr){const i=ul(t,e,fB),s=Math.abs(i)-.075,o=Do(t,e+.08,.077,.245,.055),a=Wr(t,e-.36,.087);return on(Math.min(s,o,a),r)}function RB(t,e,n=0,r=hr){const i=Math.max(0,xn(r.age??r.elapsed,n)),s=r.reducedMotion||i>.44?0:Math.sin(i*54)*.065*(1-i/.44),o=Xn(t-s,e,-.43,-.43,.43,.43,.105),a=Xn(t-s,e,.43,-.43,-.43,.43,.105);return on(Math.min(o,a),r)}function NB(t,e,n=0,r=hr){const i=Do(t+.22,e,.105,.5,.055),s=Do(t-.22,e,.105,.5,.055);return on(Math.min(i,s),r)}function IB(t,e,n=0,r=hr){const i=Cs(n,r),o=.39+(1-(r.reducedMotion?1:pi(0,.36,Math.max(0,xn(r.age,i)))))*.12,a=Do(t,e,o,o,.075),l=Do(t,e,o-.13,o-.13,.04),c=Math.max(a,-l);return on(Math.min(c,Wr(t,e,.095)),r)}function zB(t,e,n=0,r=hr){const i=Cs(n,r),s=ei(t,e,.54,.075,-2.92,2.28),o=ei(t,e,.54,.075,.22,2.28),a=Xn(t,e,-.49,-.49,.49,.49,.09);let l=on(Math.min(s,o,a),r);const c=An(xn(r.retry??r.signalStrength,.25)),f=-2.92+Lo(i*(.19+c*.16))*2.28,h=on(Wr(t-Math.cos(f)*.54,e-Math.sin(f)*.54,.07),r);return l=Math.max(l,h*(.28+c*.72)),An(l)}function LB(t,e,n=0,r=hr){const i=String(r.direction??"down").toLowerCase(),s=An(xn(r.progress??r.value,.54));if(i==="sync"){const S=Cs(n,r)*.85,E=ei(t,e,.5,.08,S,2.35),M=ei(t,e,.5,.08,S+Math.PI,2.35),O=Math.cos(S+2.35)*.5,P=Math.sin(S+2.35)*.5,x=Math.cos(S+Math.PI+2.35)*.5,C=Math.sin(S+Math.PI+2.35)*.5,R=Xn(t,e,O,P,O-.17,P-.03,.07),N=Xn(t,e,x,C,x+.17,C+.03,.07);return on(Math.min(E,M,R,N),r)}const o=p2[i]??p2.down,a=Math.cos(o),l=Math.sin(o),c=t*a-e*l,u=t*l+e*a,f=Do(c,u+.13,.1,.43,.05),h=Xn(c,u,0,.48,-.32,.14,.09),p=Xn(c,u,0,.48,.32,.14,.09),g=-.58+s*1.16,m=u-g,b=Math.min(f,h,p),y=on(b,r)*.58,_=on(Math.max(b,m),r);return An(Math.max(y,_))}function DB(t,e,n=0,r=hr){const i=Cs(n,r),s=!!(r.accepted??r.handoffAccepted),o=Math.abs(Math.hypot(t+.52,e)-.16)-.057,a=Math.abs(Math.hypot(t-.52,e)-.16)-.057,l=Xn(t,e,-.3,0,.29,0,.057),c=Xn(t,e,.29,0,.1,-.15,.06),u=Xn(t,e,.29,0,.1,.15,.06);let f=on(Math.min(o,a,l,c,u),r);const p=-.29+(s?1:Lo(i*.34))*.58,m=on(Wr(t-p,e-0,s?.09:.06),r);return f=Math.max(f,m),An(f)}function FB(t,e,n=0,r=hr){const i=Math.max(0,xn(r.age??r.elapsed,n));let s=on(ul(t,e,vB),r);if(r.reducedMotion)return s;const o=1-pi(.42,.84,i),a=xn(r.seed,0);for(let l=0;l<7;l+=1){const c=Ku(l+31,a)*fr,u=.47+Ku(l+47,a)*.36,f=Math.min(i,.84)*u+.45,h=Math.cos(c)*f,p=Math.sin(c)*f,g=l%2===0?Wr(t-h,e-p,.04):Do(t-h,e-p,.038,.075,.015);s=Math.max(s,on(g,r)*o)}return An(s)}function I5(t,e,n=0,r=hr){const i=(r==null?void 0:r.customSampler)??(r==null?void 0:r.glyphSampler)??(r==null?void 0:r.sampler);if(typeof i=="function"&&i!==I5){const a=Number(i(t,e,n,r));if(Number.isFinite(a))return An(a)}const s=Math.abs(ul(t,e,qb))-.085,o=Wr(t,e,.12);return on(Math.min(s,o),r)}const Ey=Object.freeze({idle:bB,listening:yB,thinking:wB,"thinking-deep":xB,"still-working":_B,loading:SB,progress:kB,generating:MB,searching:TB,"tool-use":EB,speaking:AB,"awaiting-input":PB,success:CB,warning:OB,error:RB,paused:NB,cancelled:IB,offline:zB,transfer:LB,handoff:DB,celebration:FB,custom:I5});Object.freeze(Object.keys(Ey));const BB=Object.freeze({ready:"idle",listen:"listening",reasoning:"thinking","deep-thinking":"thinking-deep",working:"still-working",spinner:"loading",determinate:"progress",generate:"generating",search:"searching",tool:"tool-use",voice:"speaking",prompt:"awaiting-input",check:"success",alert:"warning",failure:"error",pause:"paused",cancel:"cancelled",disconnected:"offline",sync:"transfer",star:"celebration","ai.idle":"idle","ai.listening":"listening","ai.thinking":"thinking","ai.thinking-deep":"thinking-deep","ai.still-working":"still-working","ai.loading":"loading","ai.progress":"progress","ai.generating":"generating","ai.searching":"searching","ai.tool-use":"tool-use","ai.speaking":"speaking","ai.awaiting-input":"awaiting-input","status.success":"success","status.warning":"warning","status.error":"error","status.paused":"paused","status.cancelled":"cancelled","status.offline":"offline","transfer.active":"transfer","workflow.handoff":"handoff","status.celebration":"celebration"});function z5(t){const e=String(t??"custom").trim().toLowerCase();return Object.prototype.hasOwnProperty.call(Ey,e)?e:BB[e]??"custom"}function L5(t){return Ey[z5(t)]}function jB(t,e,n,r=0,i=hr){const s=i&&typeof i=="object"?i:hr,a=L5(t)(xn(e),xn(n),xn(r),s);return An(Number.isFinite(a)?a:0)}const UB=68,WB=8,qB=96,HB=.075;function Hb(t,e){return Number.isFinite(Number(t))?Number(t):e}function Vb(t){return t==="actual"?"actual":"fit"}function VB(t){return Math.min(qB,Math.max(WB,Math.round(Hb(t,UB))))}function $B(t,e){const n=Vb(t),r=VB(e);return{mode:n,resolution:r,cellSize:n==="actual"?1:null,footprint:n==="actual"?r:null}}function GB(t,e,n,r){const i=$B(t,e),s=Math.max(1,Hb(n,i.resolution)),o=Math.max(1,Hb(r,i.resolution));if(i.mode==="actual"){const u=i.resolution;return{...i,stageSize:u,cellSize:1,offsetX:Math.round((s-u)/2),offsetY:Math.round((o-u)/2)}}const a=Math.min(s,o),l=a*HB,c=a-l*2;return{...i,stageSize:c,cellSize:c/i.resolution,offsetX:(s-c)/2,offsetY:(o-c)/2}}const l0=(t,e=new WeakSet)=>{if(t===null||typeof t!="object"&&typeof t!="function"||e.has(t))return t;e.add(t);for(const n of Object.values(t))l0(n,e);return Object.freeze(t)},YB=Object.freeze(["fbm","ridged","domain-warp","curl","flow","worley","voronoi","plasma","interference","vortex","metaballs","caustics","strata","radar","constellation","liquid","electric","ripple","kaleidoscope"]),D5=new Set(YB),KB={neutral:{name:"neutral",background:"#07090c",shadow:"#1b222b",ink:"#eef3f8",accent:"#93cfff"},info:{name:"info",background:"#071019",shadow:"#15344a",ink:"#edf8ff",accent:"#4fc3ff"},success:{name:"success",background:"#07110e",shadow:"#16392d",ink:"#f0fff9",accent:"#54d99b"},warning:{name:"warning",background:"#151006",shadow:"#493514",ink:"#fff9e9",accent:"#f5b94c"},danger:{name:"danger",background:"#15090b",shadow:"#4c1c25",ink:"#fff2f4",accent:"#ff647c"},celebration:{name:"celebration",background:"#100a19",shadow:"#352052",ink:"#fff7ff",accent:"#cf86ff"}},g2=l0(KB);function Dt(t,e,n,r="add",i={}){if(!D5.has(t))throw new TypeError(`Unknown field "${t}" in built-in sprite recipe.`);return{field:t,weight:e,scale:n,blend:r,...Number.isFinite(i.segments)?{segments:Math.round(i.segments)}:{},phase:i.phase??0,speed:i.speed??1,contrast:i.contrast??1,warp:i.warp??0}}const XB={enabled:!0,minSize:20,effect:"steer-light",strength:.16,reducedMotion:!1},ZB={enabled:!0,effect:"spring-compress",strength:.07,durationMs:180};function cr({id:t,category:e,meaning:n,glyph:r,field:i,fieldMix:s,composition:o={},palette:a="neutral",threshold:l=.5,density:c=.72,speed:u=1,pixelShape:f="rounded-square",pixelGap:h=.12,pixelScale:p=.94,silhouetteFloor:g=.38,pixelSwitch:m={},timeline:b={},transition:y={},interactions:_={},reducedMotion:k={},labels:S,terminal:E=!1,urgency:M="normal"}){if(!D5.has(i))throw new TypeError(`Unknown primary field "${i}" for "${t}".`);if(!(S!=null&&S.default))throw new TypeError(`Sprite "${t}" must define labels.default.`);const O=s!=null&&s.length?s:[Dt(i,1,1,"replace")],P=O.reduce((R,N)=>R+N.weight,0),x=typeof o=="string"?{mode:o}:o&&typeof o=="object"?o:{},C={schemaVersion:1,id:t,semantic:{category:e,meaning:n,terminal:E,urgency:M,announce:S.live??(M==="high"?"assertive":"polite"),decorativeCanvas:!0,monochromeSafe:!0,minimumReadableSize:16},glyph:r,field:i,composition:{mode:"glyph",...x},fieldMix:O.map(R=>({...R,weight:P>0?R.weight/P:0})),palette:g2[a]??g2.neutral,threshold:l,density:c,speed:u,pixel:{shape:f,gap:h,scale:p,quantize:"1bit",silhouetteFloor:g},pixelSwitch:{mode:m.mode??"threshold-hysteresis",dither:m.dither??"bayer8",hysteresis:m.hysteresis??.055,temporalRate:m.temporalRate??u,neighborhood:m.neighborhood??0,direction:m.direction??"field",monotonic:m.monotonic??!1,maxContrastFlashesPerSecond:m.maxContrastFlashesPerSecond??3},timeline:{mode:b.mode??"loop",durationMs:b.durationMs??Math.round(1e3/Math.max(u,.01)),macroCycleMs:b.macroCycleMs??null,holdMs:b.holdMs??0,replay:b.replay??"continuous",next:b.next??null},transition:{enter:y.enter??"field-morph",exit:y.exit??"field-morph",durationMs:y.durationMs??360,exitDurationMs:y.exitDurationMs??y.durationMs??360,preservePhase:y.preservePhase??!0,preserveBuffer:y.preserveBuffer??!1,interruptible:y.interruptible??!0},interactions:{pointer:{...XB,..._.pointer??{}},press:{...ZB,..._.press??{}},signals:_.signals??[]},reducedMotion:{mode:k.mode??"representative-phase",phase:k.phase??.25,speed:0,transition:k.transition??"crossfade",transitionMs:k.transitionMs??120,pointer:!1,spatialMotion:!1,representation:k.representation??`static ${S.default.toLowerCase()} glyph`,dataUpdates:k.dataUpdates??"discrete"},labels:{default:S.default,aria:S.aria??S.default,live:S.live??(M==="high"?"assertive":"polite"),value:S.value??null,variants:S.variants??null}};return l0(C)}const Ay=[cr({id:"ai.idle",category:"presence",meaning:"ready and available",glyph:"idle",field:"fbm",composition:{gestaltBoundary:!0,gestaltOpenness:.58},fieldMix:[Dt("fbm",.72,1.15,"replace",{speed:.2,contrast:.9}),Dt("caustics",.28,1.7,"soft-light",{speed:-.09,phase:.19})],palette:"neutral",threshold:.51,density:.68,speed:.14,pixelShape:"rounded-square",pixelSwitch:{mode:"ordered-dither",dither:"bayer8",hysteresis:.045,temporalRate:.1,direction:"field"},timeline:{durationMs:7200,macroCycleMs:14400,replay:"continuous"},transition:{enter:"field-morph",exit:"field-morph",durationMs:520,preservePhase:!0},interactions:{pointer:{effect:"steer-highlight",strength:.14},press:{effect:"spring-compress",strength:.055}},reducedMotion:{phase:.18,representation:"static side-lit lunar sphere with a persistent rim"},labels:{default:"Ready",live:"polite"}}),cr({id:"ai.ambient-idle",category:"ambient",meaning:"calm field-only presence",glyph:"idle",field:"fbm",composition:{mode:"field-orb",gestaltBoundary:!0,gestaltOpenness:.46,lighting:"crescent",radius:.88,fieldContrast:1.26,fieldDetail:.86,lightOrbit:.1,breathe:.045,rim:.055},fieldMix:[Dt("fbm",.62,1.14,"replace",{speed:.18,contrast:1.24}),Dt("caustics",.38,2.05,"soft-light",{speed:-.11,contrast:1.08,phase:.31})],palette:"neutral",threshold:.49,density:.76,speed:.22,pixelShape:"rounded-square",pixelScale:.9,pixelSwitch:{mode:"ordered-dither",dither:"bayer8",hysteresis:.045,temporalRate:.18,direction:"surface-drift"},timeline:{durationMs:7200,macroCycleMs:14400,replay:"continuous"},transition:{enter:"field-morph",exit:"field-morph",durationMs:520,preservePhase:!0},interactions:{pointer:{effect:"steer-light",strength:.18},press:{effect:"surface-ripple",strength:.09}},reducedMotion:{phase:.18,representation:"static side-lit dithered field orb"},labels:{default:"Ambient ready",live:"polite"}}),cr({id:"ai.ambient-thinking",category:"ambient",meaning:"reasoning expressed only through an animated field",glyph:"thinking",field:"domain-warp",composition:{mode:"field-orb",gestaltBoundary:!0,gestaltOpenness:.62,lighting:"sphere",radius:.84,fieldContrast:1.48,fieldDetail:.96,lightOrbit:.2,breathe:.09,rim:.045},fieldMix:[Dt("domain-warp",.46,1.08,"replace",{speed:.52,contrast:1.34,warp:.7}),Dt("curl",.32,1.52,"add",{speed:-.38,contrast:1.22}),Dt("ridged",.22,2.18,"soft-light",{speed:.24,contrast:1.36})],palette:"info",threshold:.5,density:.8,speed:.72,pixelShape:"rounded-square",pixelScale:.89,pixelSwitch:{mode:"temporal-blue-noise",dither:"blue-noise64",hysteresis:.048,temporalRate:.68,direction:"counter-flow"},timeline:{durationMs:4600,macroCycleMs:9200,replay:"continuous"},transition:{enter:"radial-cascade",exit:"field-morph",durationMs:460,preservePhase:!0},interactions:{pointer:{effect:"bend-flow-and-light",strength:.16},press:{effect:"damped-vortex",strength:.18,durationMs:460},signals:[{name:"reasoning.depth",mapsTo:"shellEnergy",range:[0,1]}]},reducedMotion:{phase:.34,representation:"static front-lit dithered reasoning field"},labels:{default:"Ambient thinking",live:"polite"}}),cr({id:"ai.ambient-thinking-symmetric",category:"ambient",meaning:"reasoning expressed through a clean, symmetrical animated field",glyph:"thinking",field:"kaleidoscope",composition:{mode:"field-orb",lighting:"flat",radius:.87,fieldContrast:1.32,fieldDetail:.84,lightOrbit:0,breathe:.045,rim:.04},fieldMix:[Dt("kaleidoscope",.74,.82,"replace",{segments:8,speed:.2,contrast:1.25}),Dt("kaleidoscope",.26,1.42,"soft-light",{segments:8,speed:-.12,contrast:1.08})],palette:"info",threshold:.5,density:.78,speed:.5,pixelShape:"square",pixelGap:.14,pixelScale:.9,pixelSwitch:{mode:"threshold-hysteresis",dither:"bayer8",hysteresis:.058,temporalRate:.34,direction:"radial"},timeline:{durationMs:6400,macroCycleMs:12800,replay:"continuous"},transition:{enter:"radial-cascade",exit:"field-morph",durationMs:500,preservePhase:!0},interactions:{pointer:{enabled:!1},press:{enabled:!1},signals:[{name:"reasoning.depth",mapsTo:"shellEnergy",range:[0,1]}]},reducedMotion:{phase:.25,representation:"static symmetrical reasoning field"},labels:{default:"Ambient thinking — symmetric",live:"polite"}}),cr({id:"ai.ambient-speaking",category:"ambient",meaning:"voice output expressed only through an animated field",glyph:"speaking",field:"interference",composition:{mode:"field-orb",gestaltBoundary:!0,gestaltOpenness:.5,lighting:"gibbous",radius:.87,fieldContrast:1.38,fieldDetail:.92,lightOrbit:.13,breathe:.065,voice:.2,rim:.05},fieldMix:[Dt("interference",.46,1.26,"replace",{speed:1.05,contrast:1.28}),Dt("plasma",.34,1.7,"screen",{speed:-.72,contrast:1.18}),Dt("ripple",.2,1.12,"add",{speed:.82,contrast:1.24})],palette:"info",threshold:.48,density:.82,speed:1.02,pixelShape:"circle",pixelScale:.9,pixelSwitch:{mode:"ordered-dither",dither:"bayer8",hysteresis:.042,temporalRate:.96,direction:"audio-surface"},timeline:{mode:"signal-reactive",durationMs:1900,macroCycleMs:5700},transition:{enter:"radial-cascade",exit:"field-morph",durationMs:300,preservePhase:!0},interactions:{pointer:{effect:"steer-light",strength:.13},press:{enabled:!1},signals:[{name:"audio.level",mapsTo:"envelope",range:[0,1],decayMs:220},{name:"audio.syllable",mapsTo:"bandEnergy",range:[0,1]}]},reducedMotion:{mode:"data-step",phase:.38,representation:"static gibbous field with discrete audio levels",dataUpdates:"three-level-step"},labels:{default:"Ambient speaking",live:"polite"}}),cr({id:"ai.listening",category:"activity",meaning:"capturing voice or input",glyph:"listening",field:"interference",fieldMix:[Dt("interference",.46,1.4,"replace",{speed:.68,contrast:1.18}),Dt("radar",.32,1.05,"add",{speed:-.46}),Dt("liquid",.22,1.8,"soft-light",{speed:.3})],palette:"info",threshold:.48,density:.77,speed:.78,pixelShape:"circle",pixelSwitch:{mode:"radial-cascade",dither:"bayer8",hysteresis:.05,direction:"inward"},timeline:{durationMs:2400,macroCycleMs:4800},transition:{enter:"sdf-wavefront",exit:"radial-cascade",durationMs:340,preservePhase:!0},interactions:{pointer:{effect:"ripple-bias",strength:.12},press:{effect:"emit-inbound-ripple",strength:.18},signals:[{name:"audio.level",mapsTo:"energy",range:[0,1],decayMs:90},{name:"input.pulse",mapsTo:"ripple",range:[0,1]}]},reducedMotion:{phase:.36,representation:"static listening ring with discrete level steps",dataUpdates:"three-level-step"},labels:{default:"Listening",live:"polite"}}),cr({id:"ai.thinking",category:"activity",meaning:"reasoning",glyph:"thinking",field:"flow",fieldMix:[Dt("flow",.47,1.35,"replace",{speed:.82,contrast:1.08}),Dt("vortex",.35,1.05,"add",{speed:-.62,warp:.22}),Dt("fbm",.18,2.1,"soft-light",{speed:.25})],palette:"info",threshold:.5,density:.74,speed:.92,pixelShape:"rounded-square",pixelSwitch:{mode:"temporal-blue-noise",dither:"blue-noise64",hysteresis:.062,temporalRate:.82},timeline:{durationMs:3100,macroCycleMs:6200},transition:{enter:"field-morph",exit:"field-morph",durationMs:430,preservePhase:!0},interactions:{pointer:{effect:"bend-flow",strength:.13},press:{effect:"damped-vortex",strength:.2,durationMs:460}},reducedMotion:{phase:.3,representation:"static faceted spiral"},labels:{default:"Thinking",live:"polite"}}),cr({id:"ai.thinking-deep",category:"activity",meaning:"deliberate extended reasoning",glyph:"thinking-deep",field:"domain-warp",fieldMix:[Dt("domain-warp",.46,.95,"replace",{speed:.34,warp:.48}),Dt("ridged",.31,1.8,"multiply",{speed:.18,contrast:1.24}),Dt("vortex",.23,.72,"add",{speed:-.27})],palette:"info",threshold:.52,density:.79,speed:.38,pixelShape:"diamond",pixelGap:.1,pixelSwitch:{mode:"neighbor-propagation",dither:"bayer8",hysteresis:.07,temporalRate:.36,neighborhood:8,direction:"shell-to-shell"},timeline:{durationMs:9600,macroCycleMs:19200,replay:"continuous"},transition:{enter:"field-morph",exit:"field-morph",durationMs:680,preservePhase:!0},interactions:{pointer:{effect:"separate-shells",strength:.09},press:{effect:"pinch-core",strength:.16,durationMs:520},signals:[{name:"reasoning.depth",mapsTo:"shellEnergy",range:[0,1]}]},reducedMotion:{phase:.42,representation:"static nested rings with a brighter inner core"},labels:{default:"Reasoning deeply",live:"polite"}}),cr({id:"ai.still-working",category:"activity",meaning:"work is taking longer than expected",glyph:"still-working",field:"strata",fieldMix:[Dt("strata",.44,1.2,"replace",{speed:.21,contrast:1.08}),Dt("radar",.34,.82,"add",{speed:.17}),Dt("flow",.22,1.55,"soft-light",{speed:.18})],palette:"neutral",threshold:.5,density:.71,speed:.24,pixelShape:"rounded-square",pixelSwitch:{mode:"radial-cascade",dither:"bayer8",hysteresis:.055,temporalRate:.62,direction:"outward-beacon"},timeline:{durationMs:3200,macroCycleMs:3200,replay:"continuous"},transition:{enter:"field-morph",exit:"field-morph",durationMs:560,preservePhase:!1},interactions:{pointer:{effect:"expand-beacon",strength:.1},press:{effect:"host-action",strength:.05},signals:[{name:"latency.elapsed",mapsTo:"beaconEnergy",range:[0,1]}]},reducedMotion:{phase:.46,representation:"upright hourglass with settled sand and flip guides"},labels:{default:"Still working",live:"polite"}}),cr({id:"ai.loading",category:"activity",meaning:"indeterminate startup or wait",glyph:"loading",field:"plasma",fieldMix:[Dt("plasma",.58,1.15,"replace",{speed:1.15,contrast:1.16}),Dt("flow",.42,1.65,"add",{speed:.88})],palette:"info",threshold:.52,density:.7,speed:1.38,pixelShape:"square",pixelSwitch:{mode:"ordered-dither",dither:"bayer8",hysteresis:.052,temporalRate:1.3,direction:"radial-tail"},timeline:{durationMs:1440,macroCycleMs:5760},transition:{enter:"radial-cascade",exit:"field-morph",durationMs:280,preservePhase:!0},interactions:{pointer:{effect:"steer-highlight",strength:.08},press:{enabled:!1}},reducedMotion:{phase:.63,representation:"static segmented loading ring"},labels:{default:"Loading",live:"polite"}}),cr({id:"ai.progress",category:"activity",meaning:"determinate completion progress",glyph:"progress",field:"strata",fieldMix:[Dt("strata",.54,1.25,"replace",{speed:.25,contrast:1.1}),Dt("constellation",.46,1.9,"add",{speed:.1,phase:.37})],palette:"info",threshold:.47,density:.84,speed:.32,pixelShape:"circle",pixelSwitch:{mode:"temporal-blue-noise",dither:"blue-noise64",hysteresis:.045,temporalRate:.28,direction:"contour-forward",monotonic:!0},timeline:{mode:"data-driven",durationMs:240,replay:"on-update"},transition:{enter:"contour-trace",exit:"path-draw",durationMs:320,preservePhase:!0},interactions:{pointer:{effect:"reveal-value",strength:0},press:{effect:"spring-compress",strength:.045},signals:[{name:"progress",mapsTo:"progress",range:[0,1],monotonic:!0}]},reducedMotion:{mode:"data-step",phase:0,representation:"static progress contour updated from data",dataUpdates:"discrete-monotonic"},labels:{default:"In progress",value:"{percent}% complete",live:"polite"}}),cr({id:"ai.generating",category:"activity",meaning:"producing content",glyph:"generating",field:"electric",fieldMix:[Dt("electric",.4,1.75,"replace",{speed:.84,contrast:1.23}),Dt("metaballs",.34,1.1,"add",{speed:.54,warp:.18}),Dt("constellation",.26,2.05,"screen",{speed:.38})],palette:"info",threshold:.5,density:.78,speed:.88,pixelShape:"diamond",pixelSwitch:{mode:"curl-advect",dither:"blue-noise64",hysteresis:.058,temporalRate:.8,neighborhood:4,direction:"core-to-target"},timeline:{mode:"signal-reactive",durationMs:3600,macroCycleMs:7200},transition:{enter:"seeded-dissolve",exit:"field-morph",durationMs:460,preservePhase:!0},interactions:{pointer:{effect:"attract-unlocked-pixels",strength:.11},press:{effect:"core-pulse",strength:.08},signals:[{name:"token",mapsTo:"spark",range:[0,1],bounded:!0},{name:"chunk",mapsTo:"spark",range:[0,1],bounded:!0},{name:"frame",mapsTo:"spark",range:[0,1],bounded:!0},{name:"stream.energy",mapsTo:"activity",range:[0,1]}]},reducedMotion:{mode:"data-step",phase:.72,representation:"target glyph filled in non-moving chunks",dataUpdates:"chunked-fill"},labels:{default:"Generating",live:"polite"}}),cr({id:"ai.searching",category:"activity",meaning:"searching or retrieving information",glyph:"searching",field:"radar",fieldMix:[Dt("radar",.53,.95,"replace",{speed:.72,contrast:1.18}),Dt("worley",.29,1.62,"add",{speed:.2}),Dt("caustics",.18,2.1,"screen",{speed:.16})],palette:"info",threshold:.49,density:.73,speed:.74,pixelShape:"circle",pixelSwitch:{mode:"sdf-wavefront",dither:"bayer8",hysteresis:.057,temporalRate:.72,direction:"radar-sweep"},timeline:{durationMs:3300,macroCycleMs:6600},transition:{enter:"radial-cascade",exit:"field-morph",durationMs:380,preservePhase:!0},interactions:{pointer:{effect:"bias-decorative-beam",strength:.1},press:{enabled:!1},signals:[{name:"search.hit",mapsTo:"worleyBloom",range:[0,1],decayMs:620},{name:"search.results",mapsTo:"hitCount",range:[0,8]}]},reducedMotion:{phase:.2,representation:"static magnifier with discrete result dots",dataUpdates:"result-dot"},labels:{default:"Searching",live:"polite"}}),cr({id:"ai.tool-use",category:"activity",meaning:"executing a tool or action",glyph:"tool-use",field:"strata",fieldMix:[Dt("strata",.43,1.3,"replace",{speed:.46,contrast:1.12}),Dt("electric",.34,1.8,"add",{speed:.68}),Dt("voronoi",.23,1.05,"multiply",{speed:.22})],palette:"neutral",threshold:.52,density:.8,speed:.68,pixelShape:"square",pixelSwitch:{mode:"neighbor-propagation",dither:"bayer8",hysteresis:.062,temporalRate:.62,neighborhood:6,direction:"gear-step"},timeline:{mode:"signal-reactive",durationMs:2400,macroCycleMs:7200},transition:{enter:"axis-flip",exit:"field-morph",durationMs:420,preservePhase:!0},interactions:{pointer:{effect:"tilt-light",strength:.13},press:{effect:"mechanism-compress",strength:.09},signals:[{name:"tool.step",mapsTo:"toothPulse",range:[0,1]},{name:"tool.wait",mapsTo:"stepHold",range:[0,1]},{name:"tool.result",mapsTo:"coreState",range:[0,1]}]},reducedMotion:{phase:.125,representation:"static gear with data-driven step dots",dataUpdates:"step-dot"},labels:{default:"Using a tool",live:"polite"}}),cr({id:"ai.speaking",category:"activity",meaning:"producing voice output",glyph:"speaking",field:"interference",fieldMix:[Dt("interference",.44,1.2,"replace",{speed:1.05,contrast:1.16}),Dt("plasma",.33,1.62,"add",{speed:.74}),Dt("liquid",.23,.92,"soft-light",{speed:.55,warp:.2})],palette:"info",threshold:.47,density:.81,speed:1.08,pixelShape:"circle",pixelSwitch:{mode:"radial-cascade",dither:"bayer8",hysteresis:.05,temporalRate:1.02,direction:"outward-audio"},timeline:{mode:"signal-reactive",durationMs:1900,macroCycleMs:5700},transition:{enter:"sdf-wavefront",exit:"radial-cascade",durationMs:260,preservePhase:!0},interactions:{pointer:{effect:"steer-light",strength:.11},press:{enabled:!1},signals:[{name:"audio.level",mapsTo:"envelope",range:[0,1],decayMs:240},{name:"audio.syllable",mapsTo:"bandEnergy",range:[0,1]}]},reducedMotion:{mode:"data-step",phase:.38,representation:"static speaker with three discrete level states",dataUpdates:"three-level-step"},labels:{default:"Speaking",live:"polite"}}),cr({id:"ai.awaiting-input",category:"activity",meaning:"user action is required",glyph:"awaiting-input",field:"fbm",fieldMix:[Dt("fbm",.72,.92,"replace",{speed:.18,contrast:.94}),Dt("caustics",.28,1.55,"soft-light",{speed:.1,contrast:.9})],palette:"info",threshold:.48,density:.8,speed:.22,pixelShape:"rounded-square",pixelSwitch:{mode:"threshold-hysteresis",dither:"bayer8",hysteresis:.052,temporalRate:.08,direction:"focus"},timeline:{mode:"hold",durationMs:1800,macroCycleMs:10800,replay:"two-pulses-then-hold"},transition:{enter:"radial-cascade",exit:"field-morph",durationMs:420,preservePhase:!1},interactions:{pointer:{effect:"turn-aperture",strength:.1},press:{effect:"acknowledge",strength:.06,durationMs:160,emits:"activate"},signals:[{name:"activate",mapsTo:"acknowledgement",range:[0,1]}]},reducedMotion:{phase:.44,representation:"static question mark inside a firefly focus ring"},labels:{default:"Your input is needed",live:"polite"}}),cr({id:"status.success",category:"status",meaning:"completed successfully",glyph:"success",field:"caustics",fieldMix:[Dt("caustics",.57,1.3,"replace",{speed:.72,contrast:1.15}),Dt("constellation",.43,1.75,"screen",{speed:.35})],palette:"success",threshold:.46,density:.9,speed:.82,pixelShape:"rounded-square",pixelSwitch:{mode:"path-draw",dither:"blue-noise64",hysteresis:.042,temporalRate:1,direction:"tail-to-head",monotonic:!1},timeline:{mode:"one-shot",durationMs:500,holdMs:800,replay:"on-enter"},transition:{enter:"path-draw",exit:"field-morph",durationMs:500,exitDurationMs:300,preservePhase:!1},interactions:{pointer:{effect:"edge-sparkle",strength:.04},press:{enabled:!1}},reducedMotion:{mode:"static",phase:1,representation:"static checkmark",transitionMs:120},labels:{default:"Completed",aria:"Completed successfully",live:"polite"},terminal:!0}),cr({id:"status.warning",category:"status",meaning:"attention is needed for a nonfatal issue",glyph:"warning",field:"strata",fieldMix:[Dt("strata",.58,1.18,"replace",{speed:.38,contrast:1.22}),Dt("interference",.42,1.55,"add",{speed:.33})],palette:"warning",threshold:.49,density:.86,speed:.42,pixelShape:"diamond",pixelSwitch:{mode:"contour-trace",dither:"bayer8",hysteresis:.065,temporalRate:.38,direction:"bottom-to-contour"},timeline:{mode:"one-shot-hold",durationMs:1100,holdMs:1600,replay:"two-pulses-then-hold"},transition:{enter:"sdf-wavefront",exit:"field-morph",durationMs:430,preservePhase:!1},interactions:{pointer:{effect:"lean-highlight",strength:.08},press:{effect:"contained-ripple",strength:.08}},reducedMotion:{mode:"static",phase:1,representation:"static outlined triangle and exclamation"},labels:{default:"Warning",live:"polite"},urgency:"medium"}),cr({id:"status.error",category:"status",meaning:"operation failed",glyph:"error",field:"electric",fieldMix:[Dt("electric",.61,1.4,"replace",{speed:.82,contrast:1.3}),Dt("ridged",.39,1.85,"multiply",{speed:.35,contrast:1.22})],palette:"danger",threshold:.51,density:.88,speed:.78,pixelShape:"square",pixelSwitch:{mode:"axis-flip",dither:"bayer8",hysteresis:.055,temporalRate:.9,direction:"diagonal-fracture"},timeline:{mode:"one-shot-hold",durationMs:410,holdMs:1200,replay:"on-enter"},transition:{enter:"axis-flip",exit:"seeded-dissolve",durationMs:410,preservePhase:!1},interactions:{pointer:{effect:"edge-repel",strength:.055},press:{enabled:!1}},reducedMotion:{mode:"static",phase:1,representation:"static X",transitionMs:100},labels:{default:"Error",aria:"Operation failed",live:"assertive"},terminal:!0,urgency:"high"}),cr({id:"status.paused",category:"status",meaning:"work is suspended and can resume",glyph:"paused",field:"fbm",fieldMix:[Dt("fbm",.55,1.1,"replace",{speed:0}),Dt("strata",.45,1.4,"multiply",{speed:0})],palette:"neutral",threshold:.5,density:.9,speed:0,pixelShape:"rounded-square",pixelSwitch:{mode:"axis-flip",dither:"bayer8",hysteresis:.08,temporalRate:0,direction:"columns"},timeline:{mode:"hold",durationMs:1,replay:"resume-reversible"},transition:{enter:"axis-flip",exit:"axis-flip",durationMs:280,preservePhase:!0,preserveBuffer:!0},interactions:{pointer:{effect:"steer-light-only",strength:.06},press:{effect:"bar-squeeze",strength:.045},signals:[{name:"resume",mapsTo:"reverseTransition",range:[0,1]}]},reducedMotion:{mode:"static",phase:1,representation:"static pause bars"},labels:{default:"Paused",live:"polite"}}),cr({id:"status.cancelled",category:"status",meaning:"operation was stopped",glyph:"cancelled",field:"vortex",fieldMix:[Dt("vortex",.57,.88,"replace",{speed:-.68,contrast:1.12}),Dt("metaballs",.43,1.25,"add",{speed:-.42})],palette:"neutral",threshold:.52,density:.85,speed:.62,pixelShape:"square",pixelSwitch:{mode:"seeded-dissolve",dither:"blue-noise64",hysteresis:.065,temporalRate:.72,direction:"reverse-to-center"},timeline:{mode:"one-shot-hold",durationMs:360,holdMs:900,replay:"on-enter"},transition:{enter:"seeded-dissolve",exit:"seeded-dissolve",durationMs:360,preservePhase:!1},interactions:{pointer:{enabled:!1},press:{effect:"spring-compress",strength:.035}},reducedMotion:{mode:"static",phase:1,representation:"static stop square"},labels:{default:"Cancelled",live:"polite"},terminal:!0}),cr({id:"status.offline",category:"status",meaning:"disconnected or unavailable",glyph:"offline",field:"radar",fieldMix:[Dt("radar",.56,.72,"replace",{speed:.16,contrast:1.16}),Dt("electric",.44,1.55,"add",{speed:.11})],palette:"neutral",threshold:.53,density:.72,speed:.18,pixelShape:"rounded-square",pixelSwitch:{mode:"path-draw",dither:"bayer8",hysteresis:.075,temporalRate:.16,direction:"bridge-and-retreat"},timeline:{mode:"signal-reactive",durationMs:4200,macroCycleMs:8400,replay:"continuous"},transition:{enter:"contour-trace",exit:"field-morph",durationMs:480,preservePhase:!0},interactions:{pointer:{effect:"weak-echo",strength:.045},press:{effect:"host-retry",strength:.04},signals:[{name:"network.retry",mapsTo:"retryEnergy",range:[0,1]},{name:"network.strength",mapsTo:"signalStrength",range:[0,1]}]},reducedMotion:{phase:.31,representation:"static broken ring with a diagonal disconnect mark",dataUpdates:"retry-dot"},labels:{default:"Offline",live:"polite"},urgency:"medium"}),cr({id:"transfer.active",category:"workflow",meaning:"uploading, downloading, or synchronizing data",glyph:"transfer",field:"flow",fieldMix:[Dt("flow",.46,1.15,"replace",{speed:.88,contrast:1.14}),Dt("liquid",.31,1.55,"add",{speed:.65}),Dt("strata",.23,1.9,"multiply",{speed:.44})],palette:"info",threshold:.48,density:.79,speed:.9,pixelShape:"square",pixelSwitch:{mode:"axis-flip",dither:"blue-noise64",hysteresis:.052,temporalRate:.85,direction:"data-direction",monotonic:!1},timeline:{mode:"data-or-loop",durationMs:2200,macroCycleMs:6600},transition:{enter:"axis-flip",exit:"field-morph",durationMs:380,preservePhase:!0},interactions:{pointer:{effect:"lateral-wind",strength:.07,minSize:28},press:{effect:"spring-compress",strength:.045},signals:[{name:"progress",mapsTo:"progress",range:[0,1],monotonic:!0},{name:"direction",mapsTo:"direction",values:["up","down","sync"]}]},reducedMotion:{mode:"data-step",phase:.5,representation:"static directional arrow with data-driven fill",dataUpdates:"discrete-monotonic"},labels:{default:"Transferring",live:"polite",value:"{percent}% transferred",variants:{up:"Uploading",down:"Downloading",sync:"Syncing"}}}),cr({id:"workflow.handoff",category:"workflow",meaning:"passing work to another agent or person",glyph:"handoff",field:"flow",fieldMix:[Dt("flow",.44,1.02,"replace",{speed:.66,contrast:1.1}),Dt("constellation",.34,1.6,"screen",{speed:.31}),Dt("metaballs",.22,.85,"add",{speed:.38})],palette:"info",threshold:.49,density:.77,speed:.68,pixelShape:"circle",pixelSwitch:{mode:"path-draw",dither:"blue-noise64",hysteresis:.055,temporalRate:.62,direction:"source-to-destination"},timeline:{mode:"signal-reactive",durationMs:3e3,macroCycleMs:6e3,replay:"loop-until-accepted"},transition:{enter:"field-morph",exit:"path-draw",durationMs:460,preservePhase:!0},interactions:{pointer:{effect:"bend-path-midpoint",strength:.09},press:{enabled:!1},signals:[{name:"handoff.accepted",mapsTo:"accepted",range:[0,1],latches:!0}]},reducedMotion:{phase:.58,representation:"two static nodes joined by a directional arrow",dataUpdates:"destination-highlight"},labels:{default:"Handing off",live:"polite"}}),cr({id:"status.celebration",category:"status",meaning:"a milestone or high-value success",glyph:"celebration",field:"constellation",fieldMix:[Dt("constellation",.45,1.45,"replace",{speed:.92,contrast:1.2}),Dt("caustics",.31,1.9,"screen",{speed:.62}),Dt("electric",.24,2.2,"add",{speed:.74})],palette:"celebration",threshold:.45,density:.88,speed:1,pixelShape:"diamond",pixelSwitch:{mode:"radial-cascade",dither:"blue-noise64",hysteresis:.045,temporalRate:1.1,direction:"bounded-burst"},timeline:{mode:"one-shot",durationMs:700,holdMs:900,replay:"on-enter-once",next:"status.success"},transition:{enter:"radial-cascade",exit:"field-morph",durationMs:700,preservePhase:!1},interactions:{pointer:{effect:"push-fragments",strength:.06,minSize:32},press:{enabled:!1}},reducedMotion:{mode:"static",phase:1,representation:"static star with a central success mark",transitionMs:120},labels:{default:"Milestone completed",aria:"Milestone completed successfully",live:"polite"},terminal:!0})],Py=l0(Object.fromEntries(Ay.map(t=>[t.id,t]))),QB=Object.freeze(Ay.map(t=>t.id)),JB=Object.freeze([...Ay]),F5=Object.freeze({idle:"ai.idle",ready:"ai.idle",ambient:"ai.ambient-idle","ambient-idle":"ai.ambient-idle","field-idle":"ai.ambient-idle","ambient-thinking":"ai.ambient-thinking","field-thinking":"ai.ambient-thinking","ambient-thinking-symmetric":"ai.ambient-thinking-symmetric","field-thinking-symmetric":"ai.ambient-thinking-symmetric","symmetric-thinking":"ai.ambient-thinking-symmetric","ambient-speaking":"ai.ambient-speaking","field-speaking":"ai.ambient-speaking",listening:"ai.listening",thinking:"ai.thinking","thinking-deep":"ai.thinking-deep","deep-thinking":"ai.thinking-deep","still-working":"ai.still-working",working:"ai.still-working",loading:"ai.loading",progress:"ai.progress",generating:"ai.generating",searching:"ai.searching","tool-use":"ai.tool-use",tool:"ai.tool-use",speaking:"ai.speaking","awaiting-input":"ai.awaiting-input",prompt:"ai.awaiting-input",success:"status.success",warning:"status.warning",error:"status.error",paused:"status.paused",cancelled:"status.cancelled",offline:"status.offline",transfer:"transfer.active",upload:"transfer.active",download:"transfer.active",sync:"transfer.active",handoff:"workflow.handoff",celebration:"status.celebration"});function ej(t){const e=String(t??"").trim().toLowerCase();return Object.prototype.hasOwnProperty.call(Py,e)?e:F5[e]}function ev(t){const e=ej(t);return e?Py[e]:void 0}function tj(){return JB}const nj=Object.freeze(["field-morph","seeded-dissolve","radial-cascade","angular-sweep","scanline","contour-trace","path-draw","axis-flip","cluster-dissolve","neighbor-ignite","glitch-bands","instant"]),rj=Object.freeze(["ordered-dither","temporal-blue-noise","threshold-hysteresis","sdf-wavefront","contour-trace","curl-advect","neighbor-propagation","radial-cascade","path-draw","axis-flip","seeded-dissolve","field-morph"]),ij=Object.freeze(["disc","square","diamond","capsule","line","ring","cross","square-cross","square-cross-ring"]),sj=Object.freeze({dissolve:"seeded-dissolve",radial:"radial-cascade",bloom:"radial-cascade",spiral:"angular-sweep",wave:"scanline",shutter:"axis-flip",glitch:"glitch-bands","sdf-wavefront":"contour-trace","neighbor-propagation":"neighbor-ignite"}),oj=Object.freeze({"cluster-dissolve":"seeded-dissolve","neighbor-ignite":"neighbor-propagation"}),aj=Object.freeze({circle:"disc","rounded-square":"square",dot:"disc"}),m2=Object.freeze(["ariaLive","autoResize","autoplay","background","canvas","contrast","density","direction","dprMax","field","fieldMode","fps","gridSize","interactive","nonErrorPalette","offPixels","orbBoundary","orbBackgroundColor","orbBackgroundMode","package","palette","paletteOverride","pixelShape","pixelSwitch","previewMode","progress","quality","reducedMotion","seed","speed","sprite","targetGlyph","transition","version"]),lj=Object.freeze({contrast:{minimum:.25,maximum:2},density:{minimum:.35,maximum:1.6},dprMax:{minimum:.25,maximum:8},fps:{minimum:1,maximum:120,integer:!0},gridSize:{minimum:8,maximum:96,integer:!0},progress:{minimum:0,maximum:1},speed:{minimum:.05,maximum:5}}),cj=Object.freeze(["autoResize","autoplay","background","interactive","offPixels"]),vf=t=>String(t??"").trim().toLowerCase().replace(/[\s_]+/g,"-");function uj(t,e){const n=[...String(t)],r=[...String(e)],i=Array.from({length:r.length+1},(o,a)=>a),s=new Array(r.length+1);for(let o=1;o<=n.length;o+=1){s[0]=o;for(let a=1;a<=r.length;a+=1)s[a]=Math.min(s[a-1]+1,i[a]+1,i[a-1]+(n[o-1]===r[a-1]?0:1));for(let a=0;a<=r.length;a+=1)i[a]=s[a]}return i[r.length]}function Cy(t,e,n={}){const r=vf(t);if(!r||!Array.isArray(e)||e.length===0)return null;let i=null,s=1/0;for(const a of e){const l=uj(r,vf(a));l<s&&(i=a,s=l)}const o=n.maxDistance??Math.max(2,Math.floor(r.length*.34));return s<=o?i:null}class Er extends RangeError{constructor(e,n={}){super(e),this.name="JoanConfigurationError",this.code=n.code||"invalid_configuration",this.path=n.path||null,this.value=n.value,this.suggestion=n.suggestion||null,this.allowed=n.allowed?[...n.allowed]:null}toIssue(){return{code:this.code,message:this.message,path:this.path,value:this.value,suggestion:this.suggestion,severity:"error"}}}function dj(t){return new Map(Object.entries(t||{}).map(([e,n])=>[vf(e),n]))}function ko(t,e,n={}){const r=n.label||"value",i=n.path||r,s=vf(t),o=new Map(e.map(f=>[vf(f),f]));if(o.has(s))return o.get(s);const a=dj(n.aliases);if(a.has(s))return a.get(s);const l=[...e,...Object.keys(n.aliases||{})],c=Cy(t,l),u=c?` Did you mean "${c}"?`:"";throw new Er(`Unknown ${r} "${String(t)}".${u}`,{code:`unknown_${r.replaceAll(" ","_")}`,path:i,value:t,suggestion:c,allowed:e})}const $b=t=>ko(t,QB,{aliases:F5,label:"sprite",path:"sprite"}),Qg=t=>ko(t,O5,{aliases:Kd,label:"field",path:"field"}),Xu=t=>ko(typeof t=="string"?t:(t==null?void 0:t.name)||(t==null?void 0:t.type)||(t==null?void 0:t.enter),nj,{aliases:sj,label:"transition",path:"transition"}),Jg=t=>ko(typeof t=="string"?t:(t==null?void 0:t.shape)||(t==null?void 0:t.name),ij,{aliases:aj,label:"pixel shape",path:"pixelShape"}),bf=t=>ko(typeof t=="string"?t:(t==null?void 0:t.mode)||(t==null?void 0:t.name)||(t==null?void 0:t.type),rj,{aliases:oj,label:"pixel switch",path:"pixelSwitch"});function fj(t,e){return t instanceof Er?t.toIssue():{code:"invalid_configuration",message:(t==null?void 0:t.message)||"Invalid engine configuration.",path:e||null,value:void 0,suggestion:null,severity:"error"}}function hj(t,e,n,r){if(!r&&typeof e!="number")throw new Er(`${t} must be a number.`,{code:"invalid_type",path:t,value:e});let i=r?Number(e):e;if(!Number.isFinite(i))throw new Er(`${t} must be a finite number.`,{code:"invalid_number",path:t,value:e});if(n.integer&&!r&&!Number.isInteger(i))throw new Er(`${t} must be an integer.`,{code:"invalid_number",path:t,value:e});if(n.integer&&(i=Math.round(i)),i<n.minimum||i>n.maximum){if(!r)throw new Er(`${t} must be between ${n.minimum} and ${n.maximum}.`,{code:"out_of_range",path:t,value:e});i=Math.min(Math.max(i,n.minimum),n.maximum)}return i}function B5(t,e,{allowVariants:n=!0}={}){if(t===null)return null;if(!t||typeof t!="object"||Array.isArray(t))throw new Er(`${e} must be a palette object or null.`,{code:"invalid_type",path:e,value:t});const r=new Set(["name","background","shadow","off","ink","accent","glow",...n?["variants"]:[]]),i={};for(const[s,o]of Object.entries(t)){if(!r.has(s)){const a=Cy(s,[...r]);throw new Er(`Unknown ${e} channel "${s}".${a?` Did you mean "${a}"?`:""}`,{code:"unknown_palette_channel",path:`${e}.${s}`,value:o,suggestion:a})}if(s==="variants"){if(!o||typeof o!="object"||Array.isArray(o))throw new Er(`${e}.variants must be an object.`,{code:"invalid_type",path:`${e}.variants`,value:o});i.variants=Object.fromEntries(Object.entries(o).map(([a,l])=>[a,B5(l,`${e}.variants.${a}`,{allowVariants:!1})]));continue}if(typeof o!="string"||!o.trim())throw new Er(`${e}.${s} must be a CSS color string.`,{code:"invalid_type",path:`${e}.${s}`,value:o});i[s]=o.trim()}return i}const pj=new Set(["aqua","black","blue","fuchsia","gray","green","grey","lime","maroon","navy","olive","orange","purple","red","silver","teal","transparent","white","yellow"]);function gj(t,e){if(t===null)return null;if(typeof t!="string"||!t.trim())throw new Er(`${e} must be a CSS color string or null.`,{code:"invalid_type",path:e,value:t});const n=t.trim();if(n.toLowerCase()==="transparent")return null;const r=/^(rgb|rgba|hsl|hsla)\(([\d\s.,%+/-]+)\)$/i.exec(n);if(!(/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i.test(n)||pj.has(n.toLowerCase())||!!r&&/\d/.test(r[2])))throw new Er(`${e} must be a portable CSS color (hex, rgb, hsl, a supported keyword) or null.`,{code:"invalid_color",path:e,value:t});return n}function mj(t,e={}){const n=e.coerce!==!1;if(!t||typeof t!="object"||Array.isArray(t)){const a=new Er("Engine options must be an object.",{code:"invalid_type",path:"options",value:t});return{ok:!1,value:{},issues:[a.toIssue()]}}const r={...t},i=[],s=new Set(m2);if(e.allowUnknown!==!0)for(const a of Object.keys(r)){if(s.has(a))continue;const l=Cy(a,m2);i.push({code:"unknown_option",message:`Unknown engine option "${a}".${l?` Did you mean "${l}"?`:""}`,path:a,value:r[a],suggestion:l,severity:"error"}),delete r[a]}const o=(a,l)=>{if(!(!Object.hasOwn(r,a)||r[a]===void 0))try{r[a]=l(r[a])}catch(c){i.push(fj(c,a)),delete r[a]}};o("sprite",a=>a&&typeof a=="object"?Gb(a):$b(a)),o("field",a=>a===null?null:Qg(a)),o("transition",a=>a===null?null:a&&typeof a=="object"?{...a,name:Xu(a.name||a.type||a.enter)}:Xu(a)),o("pixelShape",a=>a===null?null:Jg(a)),o("pixelSwitch",a=>a===null?null:a&&typeof a=="object"?{...a,mode:bf(a.mode||a.name||a.type)}:bf(a)),o("fieldMode",a=>ko(a,["recipe","override"],{label:"field mode",path:"fieldMode"})),o("quality",a=>ko(a,["low","balanced","high","auto"],{label:"quality",path:"quality"})),o("previewMode",a=>ko(a,["fit","actual"],{label:"preview mode",path:"previewMode"})),o("orbBoundary",a=>ko(a,["defined","gestalt"],{label:"orb boundary",path:"orbBoundary"})),o("orbBackgroundColor",a=>gj(a,"orbBackgroundColor")),o("orbBackgroundMode",a=>ko(a,["none","solid","pixelated"],{label:"orb background mode",path:"orbBackgroundMode"})),o("reducedMotion",a=>{if(typeof a=="boolean"||a==="system")return a;throw new Er('reducedMotion must be true, false, or "system".',{code:"invalid_type",path:"reducedMotion",value:a})});for(const[a,l]of Object.entries(lj))o(a,c=>hj(a,c,l,n));for(const a of cj)o(a,l=>{if(typeof l=="boolean")return l;if(n&&(l==="true"||l==="false"))return l==="true";throw new Er(`${a} must be a boolean.`,{code:"invalid_type",path:a,value:l})});for(const a of["palette","paletteOverride","nonErrorPalette"])o(a,l=>B5(l,a));return{ok:i.length===0,value:r,issues:i}}function v2(t,e={}){const n=e.strict!==!1,r=mj(t,{...e,coerce:e.coerce??!n});if(!r.ok&&n){const i=r.issues[0];throw new Er(i.message,i)}return r.value}function Gb(t){var n,r;if(!t||typeof t!="object"||Array.isArray(t))throw new Er("A recipe must be an object.",{code:"invalid_type",path:"recipe",value:t});if(typeof t.id!="string"||!t.id.trim())throw new Er("A recipe requires a non-empty id.",{code:"missing_recipe_id",path:"recipe.id",value:t.id});if(typeof t.glyph!="string"||!t.glyph.trim())throw new Er("A recipe requires a glyph id.",{code:"missing_recipe_glyph",path:"recipe.glyph",value:t.glyph});const e={...t,id:t.id.trim(),glyph:t.glyph.trim()};if(e.field!==void 0&&(e.field=Qg(e.field)),Array.isArray(e.fieldMix))e.fieldMix=e.fieldMix.map((i,s)=>{if(!i||typeof i!="object")throw new Er(`recipe.fieldMix[${s}] must be an object.`,{code:"invalid_type",path:`recipe.fieldMix[${s}]`,value:i});return{...i,field:Qg(i.field)}});else if(!e.field)throw new Er("A recipe requires field or fieldMix.",{code:"missing_recipe_field",path:"recipe.field",value:e.field});if(e.pixelShape!==void 0&&(e.pixelShape=Jg(e.pixelShape)),((n=e.pixel)==null?void 0:n.shape)!==void 0&&(e.pixel={...e.pixel,shape:Jg(e.pixel.shape)}),e.pixelSwitch!==void 0&&(typeof e.pixelSwitch=="string"?e.pixelSwitch=bf(e.pixelSwitch):((r=e.pixelSwitch)==null?void 0:r.mode)!==void 0&&(e.pixelSwitch={...e.pixelSwitch,mode:bf(e.pixelSwitch.mode)})),e.transition!==void 0){if(typeof e.transition=="string")e.transition=Xu(e.transition);else if(e.transition&&typeof e.transition=="object"){const i={...e.transition};for(const s of["name","type","enter","exit"])i[s]!==void 0&&(i[s]=Xu(i[s]));e.transition=i}}return e}const El=Math.PI*2,La=Object.freeze({background:"#07080b",off:"#20232b",ink:"#f1f3f7",accent:"#8f9dff",glow:"#6678ff"}),vj=Object.freeze({"steer-light":{warp:.28,light:1,surface:.35},"steer-light-only":{warp:0,light:1,surface:0},"steer-highlight":{warp:.4,light:.9,surface:.72},"bend-flow":{warp:1,light:.35,surface:.6},"bend-flow-and-light":{warp:1,light:.9,surface:.58},"bend-path-midpoint":{warp:.82,light:.45,surface:.7},"bias-decorative-beam":{warp:.22,light:.75,surface:.45},"edge-repel":{warp:-.64,light:.4,surface:-.3},"edge-sparkle":{warp:.12,light:.9,surface:.82},"expand-beacon":{warp:-.36,light:.7,surface:.62},"lateral-wind":{warp:.88,light:.3,surface:.44},"lean-highlight":{warp:.3,light:.85,surface:.48},"push-fragments":{warp:-.72,light:.5,surface:.38},"reveal-value":{warp:0,light:.4,surface:1},"ripple-bias":{warp:.5,light:.5,surface:.72},"separate-shells":{warp:-.42,light:.55,surface:.5},"tilt-light":{warp:.08,light:1,surface:.15},"turn-aperture":{warp:.55,light:.72,surface:.36},"weak-echo":{warp:.18,light:.35,surface:.2}}),bj=Object.freeze({acknowledge:{surface:.4},"bar-squeeze":{surface:-.38},"contained-ripple":{surface:.78},"core-pulse":{surface:.9},"damped-vortex":{surface:.68},"emit-inbound-ripple":{surface:.86},"host-action":{surface:.18},"host-retry":{surface:.28},"mechanism-compress":{surface:-.34},"pinch-core":{surface:-.5},"spring-compress":{surface:.62},"surface-ripple":{surface:.82}}),yj=Object.freeze(["field-morph","seeded-dissolve","radial-cascade","angular-sweep","scanline","contour-trace","path-draw","axis-flip","cluster-dissolve","neighbor-ignite","glitch-bands","instant"]),wj=Object.freeze(["ordered-dither","temporal-blue-noise","threshold-hysteresis","sdf-wavefront","contour-trace","curl-advect","neighbor-propagation","radial-cascade","path-draw","axis-flip","seeded-dissolve","field-morph"]),xj=Object.freeze(["disc","square","diamond","capsule","line","ring","cross","square-cross","square-cross-ring"]),_j=Object.freeze({sprite:"ai.idle",seed:"joan-v5",gridSize:68,speed:1,density:1,contrast:1,fps:60,pixelShape:null,pixelSwitch:null,transition:null,palette:null,nonErrorPalette:null,orbBoundary:"defined",orbBackgroundColor:null,orbBackgroundMode:"none",previewMode:"fit",background:!0,offPixels:!0,interactive:!0,autoplay:!0,autoResize:!0,dprMax:2,reducedMotion:"system",quality:"auto",ariaLive:null}),ot=t=>lt(t,0,1),ps=t=>t-Math.floor(t),Al=t=>{const e=ot(t);return e*e*(3-2*e)},Bc=(t,e,n)=>t===e?n<t?0:1:Al((n-t)/(e-t)),po=(t,e,n,r)=>t+(e-t)*(1-Math.exp(-n/Math.max(.001,r)));function b2(t){let e=2166136261;const n=String(t);for(let r=0;r<n.length;r+=1)e^=n.charCodeAt(r),e=Math.imul(e,16777619);return e>>>0}function Up(t){let e=t|0;return e^=e>>>16,e=Math.imul(e,2146121005),e^=e>>>15,e=Math.imul(e,2221713035),e^=e>>>16,(e>>>0)/4294967296}function j5(t){const e=typeof t=="string"?t:(t==null?void 0:t.name)||(t==null?void 0:t.type)||(t==null?void 0:t.enter),n={dissolve:"seeded-dissolve",radial:"radial-cascade",bloom:"radial-cascade",spiral:"angular-sweep",wave:"scanline",shutter:"axis-flip",glitch:"glitch-bands","sdf-wavefront":"contour-trace","neighbor-propagation":"neighbor-ignite"};return yj.includes(e)?e:n[e]||"field-morph"}function Wp(t){const e=typeof t=="string"?t:(t==null?void 0:t.name)||(t==null?void 0:t.type)||(t==null?void 0:t.mode),r={"cluster-dissolve":"seeded-dissolve","neighbor-ignite":"neighbor-propagation"}[e]||e;return wj.includes(r)?r:"ordered-dither"}function tv(t){const n={circle:"disc","rounded-square":"square",dot:"disc"}[t]||t;return xj.includes(n)?n:"disc"}const U5=Object.freeze({"square-cross":Object.freeze(["square","cross"]),"square-cross-ring":Object.freeze(["square","cross","ring"])});function Yb(t,e){const n=U5[t];if(!n)return t;const r=Math.min(8,Math.floor(ot(Number(e)||0)*8.999));return n.length===2?r<=4?n[0]:n[1]:r<=4?n[0]:r<=6?n[1]:n[2]}function yf(t,e){var s;const n=typeof t=="string"?t.trim():e,r=/^#([\da-f]{3}|[\da-f]{6})$/i.exec(n);if(r){const o=r[1].length===3?r[1].split("").map(a=>a+a).join(""):r[1];return[Number.parseInt(o.slice(0,2),16),Number.parseInt(o.slice(2,4),16),Number.parseInt(o.slice(4,6),16)]}const i=(s=n==null?void 0:n.match)==null?void 0:s.call(n,/[\d.]+/g);return(i==null?void 0:i.length)>=3?i.slice(0,3).map(Number):yf(e,"#ffffff")}function Ws(t,e,n,r=1){const i=ot(n),s=yf(t,"#ffffff"),o=yf(e,"#ffffff");return`rgba(${Math.round(s[0]+(o[0]-s[0])*i)},${Math.round(s[1]+(o[1]-s[1])*i)},${Math.round(s[2]+(o[2]-s[2])*i)},${ot(r).toFixed(3)})`}function Sj(t,e,n){const r=ot(n),i=String(t).trim().toLowerCase()==="transparent",s=String(e).trim().toLowerCase()==="transparent";if(i&&s)return"transparent";if(i){const o=yf(e,"#ffffff");return`rgba(${o[0]},${o[1]},${o[2]},${r.toFixed(3)})`}if(s){const o=yf(t,"#ffffff");return`rgba(${o[0]},${o[1]},${o[2]},${(1-r).toFixed(3)})`}return Ws(t,e,r,1)}function kj(t){let e="";for(const n of String(t)){const r=n.codePointAt(0);r===9||r===10||r===13||r>=32&&r<=55295||r>=57344&&r<=65533||r>=65536&&r<=1114111?e+=n:e+="<22>"}return e}function Kb(t){return kj(t).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;")}function Dr(t){return Kb(t).replaceAll(" ","&#9;").replaceAll(`
`,"&#10;").replaceAll("\r","&#13;")}const Mj=new Set(["aqua","black","blue","fuchsia","gray","green","grey","lime","maroon","navy","olive","orange","purple","red","silver","teal","transparent","white","yellow"]);function Da(t,e){const n=typeof t=="string"?t.trim():"",r=n.toLowerCase(),i=/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i.test(n),s=/^(rgb|rgba|hsl|hsla)\(([\d\s.,%+/-]+)\)$/i.exec(n),o=!!s&&/\d/.test(s[2]);return i||Mj.has(r)||o?n:e}const il=128;function Oy(t,e,n){const r=Math.max(1,Math.round(Number(t)||1)),i=Math.max(0,Number(e)||0),s=-1+(n+.5)*2/r;if(Math.abs(s)>i)return 0;const o=Math.sqrt(Math.max(0,i**2-s**2)),a=Math.max(0,Math.ceil((1-o)*r/2-.5)),l=Math.min(r-1,Math.floor((1+o)*r/2-.5));return l<a?0:a*il+(l-a+1)}function Tj(t,e,n,r,i,s){for(let o=0;o<e;o+=1){const a=Oy(e,n,o),l=a%il;if(!l)continue;const c=(a-l)/il;t.fillRect(r+c*s,i+o*s,l*s,s)}}function Ej(t,e,n,r,i){const s=[];for(let o=0;o<t;o+=1){const a=Oy(t,e,o),l=a%il;if(!l)continue;const c=(a-l)/il;s.push(`<rect x="${(n+c*r).toFixed(3)}" y="${(n+o*r).toFixed(3)}" width="${(l*r).toFixed(3)}" height="${r.toFixed(3)}"/>`)}return s.length?`<g data-joan-layer="orb-background" data-joan-mode="pixelated" fill="${Dr(i)}" shape-rendering="crispEdges">${s.join("")}</g>`:""}function Aj(t,e,n,r,i,s,o){const a=[];for(let l=0;l<t;l+=1){const c=Array.from(e,h=>Oy(t,h,l));if(!c.some(Boolean))continue;const u=c.map(h=>{const p=h%il,g=p?(h-p)/il:t/2;return(n+g*r).toFixed(3)}),f=c.map(h=>(h%il*r).toFixed(3));a.push(`<rect x="${u[0]}" y="${(n+l*r).toFixed(3)}" width="${f[0]}" height="${r.toFixed(3)}"><animate attributeName="x" values="${u.join(";")}" keyTimes="${s}" dur="${o}s" calcMode="discrete" repeatCount="indefinite"/><animate attributeName="width" values="${f.join(";")}" keyTimes="${s}" dur="${o}s" calcMode="discrete" repeatCount="indefinite"/></rect>`)}return a.length?`<g data-joan-layer="orb-background" data-joan-mode="pixelated" fill="${Dr(i)}" shape-rendering="crispEdges">${a.join("")}</g>`:""}function Pj(t,e){const n=W5(t,e);return{background:Da(n.background,La.background),off:Da(n.off,La.off),ink:Da(n.ink,La.ink),accent:Da(n.accent,La.accent),glow:Da(n.glow,La.glow)}}function Xb(t,e,n,r,i,s="",o="",a=0,l=null){const c=Number(e),u=Number(n),f=Number(r),h=Number(i),p=s?` ${s}`:"";if(t==="square")return`<rect x="${(c-f/2).toFixed(2)}" y="${(u-h/2).toFixed(2)}" width="${f.toFixed(2)}" height="${h.toFixed(2)}"${p}>${o}</rect>`;if(t==="diamond"){const g=f*.52;return`<path d="M ${c.toFixed(2)} ${(u-g).toFixed(2)} L ${(c+g).toFixed(2)} ${u.toFixed(2)} L ${c.toFixed(2)} ${(u+g).toFixed(2)} L ${(c-g).toFixed(2)} ${u.toFixed(2)} Z"${p}>${o}</path>`}if(t==="capsule")return`<rect x="${(c-f/2).toFixed(2)}" y="${(u-h*.32).toFixed(2)}" width="${f.toFixed(2)}" height="${(h*.64).toFixed(2)}" rx="${(h*.32).toFixed(2)}"${p}>${o}</rect>`;if(t==="line")return`<rect x="${(c-f/2).toFixed(2)}" y="${(u-h*.11).toFixed(2)}" width="${f.toFixed(2)}" height="${(h*.22).toFixed(2)}" transform="rotate(${a.toFixed(2)} ${c.toFixed(2)} ${u.toFixed(2)})"${p}>${o}</rect>`;if(t==="ring"){const g=Number.isFinite(Number(l))?Number(l):Math.max(.12,Math.min(f,h)*.14);return`<ellipse cx="${c.toFixed(2)}" cy="${u.toFixed(2)}" rx="${(f/2).toFixed(2)}" ry="${(h/2).toFixed(2)}" fill="none" stroke-width="${g.toFixed(3)}" vector-effect="non-scaling-stroke"${p}>${o}</ellipse>`}return t==="cross"?`<g${p}><rect x="${(c-f/2).toFixed(2)}" y="${(u-h*.1).toFixed(2)}" width="${f.toFixed(2)}" height="${(h*.2).toFixed(2)}"/><rect x="${(c-f*.1).toFixed(2)}" y="${(u-h/2).toFixed(2)}" width="${(f*.2).toFixed(2)}" height="${h.toFixed(2)}"/>${o}</g>`:`<circle cx="${c.toFixed(2)}" cy="${u.toFixed(2)}" r="${(f/2).toFixed(2)}"${p}>${o}</circle>`}function Cj(t,e,n,r,i,s,o=0,a=[]){const l=Number(a[0])||null,c=a.length?`<animate attributeName="stroke-width" values="${a.join(";")}" keyTimes="${i}" dur="${s}s" calcMode="discrete" repeatCount="indefinite"/>`:"",u=U5[t];if(!u)return Xb(t,0,0,e,n,"",t==="ring"?c:"",o,l);const f=Array.from(r,p=>Yb(t,p)),h=u.map(p=>{const g=f.map(b=>b===p?"1":"0"),m=g.join(";");return`<g data-joan-shape="${p}" opacity="${g[0]}"><animate attributeName="opacity" values="${m}" keyTimes="${i}" dur="${s}s" calcMode="discrete" repeatCount="indefinite"/>${Xb(p,0,0,e,n,"",p==="ring"?c:"",o,l)}</g>`});return`<g data-joan-composite="${t}">${h.join("")}</g>`}function Xd(t,e,n){var i,s,o,a;const r=t==null?void 0:t[e];return r!==void 0?r:((i=t==null?void 0:t.render)==null?void 0:i[e])!==void 0?t.render[e]:((s=t==null?void 0:t.pixel)==null?void 0:s[e])!==void 0?t.pixel[e]:e==="pixelShape"&&((o=t==null?void 0:t.pixel)==null?void 0:o.shape)!==void 0?t.pixel.shape:e==="pixelScale"&&((a=t==null?void 0:t.pixel)==null?void 0:a.scale)!==void 0?t.pixel.scale:n}function W5(t,e){const n=(t==null?void 0:t.palette)||{};return{...La,...n,off:n.off||n.shadow||La.off,glow:n.glow||n.accent||La.glow,...e||{}}}function y2(t,e){var o;if(!e||typeof e!="object")return null;const{variants:n,...r}=e,i=(o=t==null?void 0:t.palette)==null?void 0:o.name,s=i&&n&&typeof n=="object"&&n[i]&&typeof n[i]=="object"?n[i]:null;return s?{...s,...r}:r}function q5(t,e){const n=y2(t,e==null?void 0:e.palette),r=(t==null?void 0:t.id)!=="status.error"&&(e!=null&&e.nonErrorPalette)&&typeof e.nonErrorPalette=="object"?y2(t,e.nonErrorPalette):null;return n?r?{...n,...r}:n:r}function qp(t,e){return W5(t,q5(t,e))}function w2(t,e){return Pj(t,q5(t,e))}function Oj(t,e,n){const r=ot(n);return{background:Ws(t.background,e.background,r,1),off:Ws(t.off,e.off,r,1),ink:Ws(t.ink,e.ink,r,1),accent:Ws(t.accent,e.accent,r,1),glow:Sj(t.glow,e.glow,r)}}function nv(t,e){return e&&typeof e=="object"?{...e,mode:Wp(e)}:e?{mode:Wp(e)}:t!=null&&t.pixelSwitch&&typeof t.pixelSwitch=="object"?{...t.pixelSwitch,mode:Wp(t.pixelSwitch)}:{mode:Wp(t==null?void 0:t.pixelSwitch)}}function Nd(t){var r;const e=lt(Number(Xd(t,"pixelScale",.76)),.24,1.12),n=lt(Number((r=t==null?void 0:t.pixel)==null?void 0:r.gap)||0,0,.72);return e*(1-n)}function jc(t){var e,n,r;return((e=t==null?void 0:t.semantic)==null?void 0:e.label)||((n=t==null?void 0:t.labels)==null?void 0:n.aria)||((r=t==null?void 0:t.labels)==null?void 0:r.default)||(t==null?void 0:t.label)||(t==null?void 0:t.id)||"Procedural AI glyph"}function Rj(t,e={}){if(Array.isArray(e.results))return e.results.length;if(t==="search.results"&&Number.isFinite(Number(e.results)))return Number(e.results);if(t==="handoff.accepted"&&e.accepted!==void 0)return e.accepted?1:0;if(t==="tool.wait"&&e.waiting!==void 0)return e.waiting?1:0;const n=[e.value,e.energy,e.count,e.depth,e.wait,e.strength];for(const r of n){const i=Number(r);if(Number.isFinite(i))return i}return .7}function rv(t,e,n=t.recipeSource){return{recipe:e,recipeSource:n,phase:t.phase,stateElapsed:t.stateElapsed,values:t.values.slice(),velocities:t.velocities.slice(),targets:t.targets.slice(),luminance:t.luminance.slice(),gates:t.gates.slice(),dwell:t.dwell.slice(),afterglow:t.afterglow.slice(),neighborBuffer:t.neighborBuffer.slice()}}function iv(t,e){return{...t,field:e,fieldMix:[{field:e,weight:1,scale:1,blend:"replace",phase:0,speed:1,contrast:1}]}}function Nj(t,e,n,r=.5,i={x:0,y:0}){const s=j5(t),o=ot((e+1)*.5),a=ot((n+1)*.5),l=ot(Math.hypot(e-i.x,n-i.y)/Math.SQRT2),c=ps((Math.atan2(n-i.y,e-i.x)+Math.PI)/El);switch(s){case"seeded-dissolve":return r;case"radial-cascade":return ot(l*.86+r*.14);case"angular-sweep":return ot(c*.78+l*.16+r*.06);case"scanline":return ot(a*.82+Math.sin(e*9)*.05+r*.13);case"contour-trace":return ot(Math.abs(l-.52)*1.65+r*.08);case"path-draw":return ot((o*.42+a*.58)*.9+r*.1);case"axis-flip":return ot(Math.floor(o*12)%2*.18+a*.72+r*.1);case"cluster-dissolve":return ot(ps(Math.sin(Math.floor(e*5)*91.7+Math.floor(n*5)*43.1)*991.31)*.72+r*.28);case"neighbor-ignite":return ot(l*.58+(o+a)*.16+r*.1);case"glitch-bands":return ot(ps(Math.floor(a*11)*.381+r*.29));case"instant":return 0;case"field-morph":default:return ot(r*.42+l*.28+a*.3)}}const Rm=class Rm extends EventTarget{static listSprites(){return tj()}constructor(e,n={}){if(super(),!(e!=null&&e.getContext))throw new TypeError("JoanGlyphEngine requires a canvas element.");if(this.canvas=e,this.context=e.getContext("2d",{alpha:!0,desynchronized:!0}),!this.context)throw new Error("Canvas 2D is not available.");const r=v2(n,{strict:!0,coerce:!1,allowUnknown:!1});this.options={..._j,...r},Object.hasOwn(r,"orbBackgroundMode")||(this.options.orbBackgroundMode=this.options.orbBackgroundColor?"solid":"none"),Object.hasOwn(n,"paletteOverride")&&(this.options.palette=n.paletteOverride&&typeof n.paletteOverride=="object"?{...n.paletteOverride}:null),this.options.nonErrorPalette&&typeof this.options.nonErrorPalette=="object"&&(this.options.nonErrorPalette={...this.options.nonErrorPalette}),this.options.gridSize=Math.round(lt(Number(this.options.gridSize)||68,8,96)),this.options.speed=lt(Number(this.options.speed)||1,.05,5),this.options.density=lt(Number(this.options.density)||1,.35,1.6),this.options.previewMode=Vb(this.options.previewMode),this.seed=String(this.options.seed),this.seedHash=b2(this.seed),this.fieldKit=new fp(this.seed),this.customGlyphs=new Map,this.glyphSampler=(i,s,o,a,l)=>this.sampleCustomGlyph(i,s,o,a,l),this.fieldOptionsScratch={},this.recipeMetadataCache=new WeakMap,this.semanticEnvelopeCache=new WeakMap,this.paintColorCache={key:null,off:null,source:null,target:null,steady:null,transition:null},this.pixelSwitchCache={recipe:null,override:null,value:null},this.clock=0,this.phase=0,this.stateElapsed=0,this.progress=ot(Number(this.options.progress)||0),this.audioLevel=0,this.audioTarget=0,this.activityEnergy=0,this.press=0,this.running=!1,this.destroyed=!1,this.visible=!0,this.documentVisible=!0,this.intersectionVisible=!0,this.frameHandle=null,this.frameTick=null,this.lastFrameTime=null,this.lastPaintTime=-1/0,this.simulationAccumulator=0,this.simulationStep=1/Math.min(60,lt(Number(this.options.fps)||60,1,120)),this.maxSimulationSteps=12,this.maxCatchUpSeconds=.2,this.qualitySamplePhase=0,this.transitionElapsed=1/0,this.transitionDuration=0,this.transitionName="instant",this.transitionSerial=0,this.completedTransitionSerial=0,this.pendingSpriteTransition=null,this.preservedTransition=null,this.reducedCrossfade=null,this.reducedFrameHandle=null,this.configurationBatchDepth=0,this.configurationNeedsRender=!1,this.pendingConfigurationDetail=null,this.impulses=[],this.signals=new Map,this.semanticSignals=new Map,this.semanticContext=Object.create(null),this.signalState={accepted:!1,direction:this.options.direction||"down",hits:0,retry:0,rotationSpeed:1,segments:8,signalStrength:0,steps:12,targetGlyph:this.options.targetGlyph||null,toolPhase:0},this.listeners=[],this.interactionListeners=[],this.qualityTier=this.options.quality==="auto"?"high":this.options.quality,this.qualityPressure=0,this.qualityRecovery=0,this.stats={fps:0,activePixels:0,frameMs:0,resolution:0,simulationSteps:0,sampledPixels:0,quality:this.qualityTier},this.fpsAccumulator={time:0,frames:0},this.pointerSampleScratch={x:0,y:0,speed:0},this.sampleContextScratch=Object.create(null),this.sampleToScratch=Object.create(null),this.sampleFromScratch=Object.create(null),this.pointer={x:0,y:0,targetX:0,targetY:0,speed:0,inside:!1,down:!1,lastX:0,lastY:0,lastTime:0},this.reducedMotion=this.resolveReducedMotion(),this.currentRecipe=this.resolveRecipe(this.options.sprite),this.recipeSource=this.currentRecipe,this.fieldOverride=this.options.fieldMode==="recipe"?null:this.options.field||null,this.fieldOverride&&(this.currentRecipe=iv(this.currentRecipe,this.fieldOverride)),this.previousRecipe=this.currentRecipe,this.allocate(this.options.gridSize),this.bindCanvas(),this.observe(),this.resize(!0),this.updateAria(),this.renderFrame(0,0,!0),this.options.autoplay&&!this.reducedMotion&&this.play()}resolveReducedMotion(){var e,n;return this.options.reducedMotion===!0?!0:this.options.reducedMotion===!1?!1:!!(typeof window<"u"&&((n=(e=window.matchMedia)==null?void 0:e.call(window,"(prefers-reduced-motion: reduce)"))!=null&&n.matches))}resolveRecipe(e){if(e&&typeof e=="object")return Gb(e);const n=$b(e??"ai.idle");return ev(n)}allocate(e){const n=e*e;this.gridSize=e,this.values=new Float32Array(n),this.velocities=new Float32Array(n),this.targets=new Float32Array(n),this.luminance=new Float32Array(n),this.gates=new Uint8Array(n),this.dwell=new Float32Array(n),this.afterglow=new Float32Array(n),this.random=new Float32Array(n),this.xs=new Float32Array(n),this.ys=new Float32Array(n),this.neighborBuffer=new Float32Array(n),this.transitionMixes=new Float32Array(n),this.transitionMixes.fill(1);for(let r=0;r<e;r+=1)for(let i=0;i<e;i+=1){const s=r*e+i;this.xs[s]=(i+.5)/e*2-1,this.ys[s]=(r+.5)/e*2-1,this.random[s]=Up(s^this.seedHash),this.dwell[s]=this.random[s]*.08}this.stats.resolution=e}bind(e,n,r,i){var s;(s=e==null?void 0:e.addEventListener)==null||s.call(e,n,r,i),this.listeners.push(()=>{var o;return(o=e==null?void 0:e.removeEventListener)==null?void 0:o.call(e,n,r,i)})}bindInteraction(e,n,r,i){var s;(s=e==null?void 0:e.addEventListener)==null||s.call(e,n,r,i),this.interactionListeners.push(()=>{var o;return(o=e==null?void 0:e.removeEventListener)==null?void 0:o.call(e,n,r,i)})}activate(e={}){var o,a;const n=lt(Number(e.x)||0,-1,1),r=lt(Number(e.y)||0,-1,1),i=e.source||"programmatic",s=((a=(o=this.currentRecipe)==null?void 0:o.interactions)==null?void 0:a.press)||{};if(s.enabled!==!1){this.press=1;const l=lt(Number(s.strength??.07),0,1);this.emitImpulse("press",{x:n,y:r,energy:ot(e.energy===void 0?.42+l*6.8:Number(e.energy)),life:lt(e.life===void 0?Number(s.durationMs)/1e3||.18:Number(e.life),.1,4)})}return typeof s.emits=="string"&&s.emits&&this.signal(s.emits,{value:1,x:n,y:r,source:i}),this.emit("activate",{sprite:this.currentRecipe.id,x:n,y:r,source:i,key:e.key||null}),this.renderWhenPaused(),this}bindCanvas(){if(!this.options.interactive)return;const e=a=>{const l=this.canvas.getBoundingClientRect();if(!l.width||!l.height)return;const c=a.timeStamp/1e3||performance.now()/1e3,u=lt((a.clientX-l.left)/l.width*2-1,-1,1),f=lt((a.clientY-l.top)/l.height*2-1,-1,1),h=Math.max(1/240,c-(this.pointer.lastTime||c)),p=Math.hypot(u-this.pointer.lastX,f-this.pointer.lastY);this.pointer.speed=Math.min(2,this.pointer.speed*.5+p/h*.035),this.pointer.targetX=u,this.pointer.targetY=f,this.pointer.lastX=u,this.pointer.lastY=f,this.pointer.lastTime=c,this.pointer.inside=!0},n=a=>{this.pointer.inside=!0,e(a)},r=()=>{this.pointer.inside=!1,this.pointer.down=!1,this.pointer.targetX=0,this.pointer.targetY=0},i=a=>{var l,c;e(a),this.pointer.down=!0,this.activate({x:this.pointer.targetX,y:this.pointer.targetY,source:"pointer"}),(c=(l=this.canvas).setPointerCapture)==null||c.call(l,a.pointerId)},s=a=>{var l,c;this.pointer.down=!1,(c=(l=this.canvas).releasePointerCapture)==null||c.call(l,a.pointerId)},o=a=>{var u;const l=a.key==="Enter",c=a.key===" "||a.key==="Spacebar";!l&&!c||a.repeat||(c&&((u=a.preventDefault)==null||u.call(a)),this.activate({source:"keyboard",key:l?"Enter":"Space"}))};this.bindInteraction(this.canvas,"pointermove",e,{passive:!0}),this.bindInteraction(this.canvas,"pointerenter",n,{passive:!0}),this.bindInteraction(this.canvas,"pointerleave",r,{passive:!0}),this.bindInteraction(this.canvas,"pointerdown",i,{passive:!0}),this.bindInteraction(this.canvas,"pointerup",s,{passive:!0}),this.bindInteraction(this.canvas,"pointercancel",s,{passive:!0}),this.bindInteraction(this.canvas,"keydown",o)}observe(){var e;if(typeof document<"u"&&(this.documentVisible=!document.hidden,this.visible=this.documentVisible&&this.intersectionVisible),this.options.autoResize&&typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(()=>this.resize()),this.resizeObserver.observe(this.canvas)),typeof IntersectionObserver<"u"&&(this.intersectionObserver=new IntersectionObserver(n=>{var i;const r=this.visible;this.intersectionVisible=((i=n[0])==null?void 0:i.isIntersecting)!==!1,this.visible=this.documentVisible&&this.intersectionVisible,this.visible!==r&&(this.lastFrameTime=null,this.simulationAccumulator=0,this.visible?this.scheduleFrame():this.cancelScheduledFrame())}),this.intersectionObserver.observe(this.canvas)),typeof window<"u"){const n=(e=window.matchMedia)==null?void 0:e.call(window,"(prefers-reduced-motion: reduce)");if(n){this.motionMedia=n;const r=()=>{this.options.reducedMotion==="system"&&(this.reducedMotion=n.matches,this.reducedMotion?(this.pause(),this.renderFrame(this.clock,0,!0)):this.options.autoplay&&this.play())};this.bind(n,"change",r)}this.bind(document,"visibilitychange",()=>{const r=this.visible;this.documentVisible=!document.hidden,this.visible=this.documentVisible&&this.intersectionVisible,this.lastFrameTime=null,this.visible!==r&&(this.simulationAccumulator=0,this.visible?this.scheduleFrame():this.cancelScheduledFrame())})}}resize(e=!1){var l,c;const n=((c=(l=this.canvas).getBoundingClientRect)==null?void 0:c.call(l))||{},r=Math.max(1,Number(n.width||this.canvas.clientWidth||this.canvas.width||512)),i=Math.max(1,Number(n.height||this.canvas.clientHeight||this.canvas.height||512)),s=Math.min(this.options.dprMax,typeof window<"u"&&window.devicePixelRatio||1),o=Math.round(r*s),a=Math.round(i*s);(e||this.canvas.width!==o||this.canvas.height!==a||this.width!==r||this.height!==i)&&(this.canvas.width=o,this.canvas.height=a,this.width=r,this.height=i,this.dpr=s,this.renderScaleX=o/r,this.renderScaleY=a/i,this.context.setTransform(this.renderScaleX,0,0,this.renderScaleY,0,0),this.context.imageSmoothingEnabled=!1,this.paint())}updateAria(){var n,r,i,s,o,a,l,c,u,f,h,p,g,m,b,y;const e=jc(this.currentRecipe);if(this.options.interactive?((r=(n=this.canvas).setAttribute)==null||r.call(n,"role","button"),(s=(i=this.canvas).setAttribute)==null||s.call(i,"tabindex","0")):((a=(o=this.canvas).setAttribute)==null||a.call(o,"role","img"),(c=(l=this.canvas).removeAttribute)==null||c.call(l,"tabindex")),(f=(u=this.canvas).setAttribute)==null||f.call(u,"aria-label",`${e} — animated procedural glyph`),this.options.ariaLive){const _=((p=(h=this.currentRecipe)==null?void 0:h.semantic)==null?void 0:p.announce)||((m=(g=this.currentRecipe)==null?void 0:g.labels)==null?void 0:m.live)||"polite";["polite","assertive","off"].includes(_)&&((y=(b=this.options.ariaLive).setAttribute)==null||y.call(b,"aria-live",_)),this.options.ariaLive.textContent=e}}emit(e,n){if(e==="configchange"&&this.configurationBatchDepth>0){this.pendingConfigurationDetail={...this.pendingConfigurationDetail||{},...n||{}};return}let r;typeof CustomEvent=="function"?r=new CustomEvent(e,{detail:n}):(r=new Event(e),Object.defineProperty(r,"detail",{value:n})),this.dispatchEvent(r)}on(e,n,r){return this.addEventListener(e,n,r),()=>this.removeEventListener(e,n,r)}isTransitionActive(){return this.transitionDuration>0&&this.transitionElapsed<this.transitionDuration&&this.previousRecipe!==this.currentRecipe}finishTransition(e="completed"){var i,s,o,a,l,c;const n=this.transitionSerial;if(!n||this.completedTransitionSerial===n)return this.previousRecipe=this.currentRecipe,(s=(i=this.transitionMixes)==null?void 0:i.fill)==null||s.call(i,1),null;const r={from:((o=this.previousRecipe)==null?void 0:o.id)||null,to:((a=this.currentRecipe)==null?void 0:a.id)||null,duration:this.transitionDuration,elapsed:Math.min(this.transitionElapsed,this.transitionDuration),transition:this.transitionName,status:e==="interrupted"?"interrupted":"completed",reason:e,serial:n};return this.transitionElapsed=this.transitionDuration,this.previousRecipe=this.currentRecipe,(c=(l=this.transitionMixes)==null?void 0:l.fill)==null||c.call(l,1),this.completedTransitionSerial=n,this.emit("transitioncomplete",r),r}whenTransitionComplete(e={}){var i,s;const n=e.signal;if(!this.isTransitionActive())return Promise.resolve({from:((i=this.previousRecipe)==null?void 0:i.id)||null,to:((s=this.currentRecipe)==null?void 0:s.id)||null,duration:this.transitionDuration,elapsed:this.transitionElapsed,transition:this.transitionName,status:"completed",reason:"already-settled",serial:this.transitionSerial});const r=this.transitionSerial;return new Promise((o,a)=>{var f;const l=()=>{u();const h=new Error("Transition wait was aborted.");h.name="AbortError",a(h)},c=h=>{var p;((p=h.detail)==null?void 0:p.serial)===r&&(u(),o(h.detail))},u=()=>{var h;this.removeEventListener("transitioncomplete",c),(h=n==null?void 0:n.removeEventListener)==null||h.call(n,"abort",l)};if(n!=null&&n.aborted){l();return}this.addEventListener("transitioncomplete",c),(f=n==null?void 0:n.addEventListener)==null||f.call(n,"abort",l,{once:!0})})}transitionTo(e,n={}){const r=typeof e=="string"?$b(e):Gb(e),i=typeof r=="string"?r:r.id,s=n.signal;return new Promise((o,a)=>{var f;const l=()=>{u();const h=new Error(`Transition to "${i}" was aborted.`);h.name="AbortError",a(h)},c=h=>{var p;((p=h.detail)==null?void 0:p.to)===i&&(u(),o(h.detail))},u=()=>{var h;this.removeEventListener("transitioncomplete",c),(h=s==null?void 0:s.removeEventListener)==null||h.call(s,"abort",l)};if(s!=null&&s.aborted){l();return}this.addEventListener("transitioncomplete",c),(f=s==null?void 0:s.addEventListener)==null||f.call(s,"abort",l,{once:!0});try{const{signal:h,...p}=n;this.setSprite(r,p)}catch(h){u(),a(h)}})}clearSemanticSignals(){this.semanticSignals.clear(),this.semanticContext=Object.create(null),this.sampleContextScratch=Object.create(null),this.signalState.accepted=!1,this.signalState.hits=0,this.signalState.retry=0,this.signalState.signalStrength=0,this.signalState.steps=12}applyRecipeSignal(e,n,r){var a,l,c,u;const i=(u=(c=(l=(a=this.currentRecipe)==null?void 0:a.interactions)==null?void 0:l.signals)==null?void 0:c.find)==null?void 0:u.call(c,f=>f.name===e);if(!(i!=null&&i.mapsTo))return null;let s;if(Array.isArray(i.values)){const f=String(n.value??n.direction??r).toLowerCase();s=i.values.includes(f)?f:i.values[0]}else{const[f=0,h=1]=i.range||[0,1];s=lt(Number(r),Number(f),Number(h));const p=Number(this.semanticContext[i.mapsTo]);i.monotonic&&Number.isFinite(p)&&(s=Math.max(p,s)),i.latches&&Number.isFinite(p)&&p>0&&(s=Math.max(p,s))}const o={declaration:i,value:s,decaySeconds:Math.max(0,Number(i.decayMs)||0)/1e3};switch(this.semanticSignals.set(i.mapsTo,o),this.semanticContext[i.mapsTo]=s,i.mapsTo){case"hitCount":this.signalState.hits=Math.max(0,Math.round(Number(s)||0));break;case"accepted":this.signalState.accepted=Number(s)>0;break;case"retryEnergy":this.signalState.retry=ot(Number(s)||0);break;case"signalStrength":this.signalState.signalStrength=ot(Number(s)||0);break;case"direction":this.signalState.direction=String(s);break}return o}restorePixelBuffer(e){var n;return!e||((n=e.values)==null?void 0:n.length)!==this.values.length?!1:(this.values.set(e.values),this.velocities.set(e.velocities),this.targets.set(e.targets),this.luminance.set(e.luminance),this.gates.set(e.gates),this.dwell.set(e.dwell),this.afterglow.set(e.afterglow),this.neighborBuffer.set(e.neighborBuffer),this.phase=e.phase,this.stateElapsed=e.stateElapsed,!0)}cancelReducedCrossfade(){this.reducedFrameHandle!==null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this.reducedFrameHandle),this.reducedFrameHandle=null,this.reducedCrossfade=null}startReducedCrossfade(e){var s,o;if(!e||((o=(s=this.currentRecipe)==null?void 0:s.reducedMotion)==null?void 0:o.transition)==="instant"||typeof requestAnimationFrame!="function")return!1;this.settleGrid(this.clock,{completeTransition:!1});const n=rv(this,this.currentRecipe,this.recipeSource);this.restorePixelBuffer(e),this.previousRecipe=e.recipe||this.previousRecipe,this.transitionElapsed=0,this.transitionMixes.fill(0);const r={source:e,target:n,startedAt:null,duration:Math.max(.001,this.transitionDuration)};this.reducedCrossfade=r;const i=a=>{if(this.destroyed||this.reducedCrossfade!==r)return;r.startedAt===null&&(r.startedAt=a);const l=Al((a-r.startedAt)/1e3/r.duration);let c=0;for(let u=0;u<this.values.length;u+=1)this.values[u]=r.source.values[u]+(r.target.values[u]-r.source.values[u])*l,this.luminance[u]=r.source.luminance[u]+(r.target.luminance[u]-r.source.luminance[u])*l,this.transitionMixes[u]=l,this.values[u]>.32&&(c+=1);if(this.transitionElapsed=l*r.duration,this.stats.activePixels=c,this.paint(),l<1){this.reducedFrameHandle=requestAnimationFrame(i);return}this.restorePixelBuffer(r.target),this.reducedCrossfade=null,this.reducedFrameHandle=null,this.transitionElapsed=this.transitionDuration,this.finishTransition("reduced-motion-crossfade"),this.paint()};return this.reducedFrameHandle=requestAnimationFrame(i),!0}resume(e={}){var a,l,c,u;if(((a=this.currentRecipe)==null?void 0:a.id)!=="status.paused")return this;const n=this.currentRecipe,r=this.preservedTransition,i=e.sprite||(r==null?void 0:r.recipeSource)||(r==null?void 0:r.recipe)||ev("ai.idle"),s=Number((l=n==null?void 0:n.transition)==null?void 0:l.exitDurationMs)/1e3||Number((c=n==null?void 0:n.transition)==null?void 0:c.durationMs)/1e3||.28;this.setSprite(i,{duration:e.duration??s,transition:e.transition||((u=n==null?void 0:n.transition)==null?void 0:u.exit)||"axis-flip",preservePhase:!0,forceTransition:!0,skipPreserveCapture:!0,skipPausedRender:!0});const o=this.restorePixelBuffer(r);return this.previousRecipe=n,this.transitionElapsed=0,this.preservedTransition=null,this.paint(),this.emit("resume",{from:n.id,to:this.currentRecipe.id,restoredBuffer:o,source:e.source||"signal"}),this}setSprite(e,n={}){var b,y,_,k;const r=this.isTransitionActive();if(r&&((y=(b=this.currentRecipe)==null?void 0:b.transition)==null?void 0:y.interruptible)===!1&&!n.forceTransition)return this.pendingSpriteTransition={sprite:e,options:{...n}},this.emit("transitionqueued",{from:(_=this.currentRecipe)==null?void 0:_.id,to:typeof e=="string"?e:e==null?void 0:e.id}),this;this.reducedCrossfade&&this.cancelReducedCrossfade(),r&&this.finishTransition("interrupted");const i=e===this.currentRecipe&&this.recipeSource?this.recipeSource:this.resolveRecipe(e);if(!i)throw new RangeError(`Unknown sprite: ${e}`);n.useRecipeFields&&(this.fieldOverride=null);const s=this.recipeSource||this.currentRecipe;this.recipeSource=i;const o=this.fieldOverride?iv(i,this.fieldOverride):i,a=this.currentRecipe,l=this.reducedMotion&&a?rv(this,a,s):null,c=o.transition||{},u=n.preserveBuffer??c.preserveBuffer??!1;u&&a&&!n.skipPreserveCapture?this.preservedTransition=rv(this,a,s):n.skipPreserveCapture||(this.preservedTransition=null),this.previousRecipe=a||o,this.currentRecipe=o,this.transitionSerial+=1,this.stateElapsed=0,this.clearSemanticSignals(),this.transitionElapsed=0;const f=n.transition||this.options.transition,h=f&&typeof f=="object"?f:{};this.transitionDuration=this.reducedMotion?lt(Number(n.duration)||Number((k=o==null?void 0:o.reducedMotion)==null?void 0:k.transitionMs)/1e3||.12,0,.2):lt(Number(n.duration)||Number(h.duration)||Number(h.durationMs)/1e3||Number(c.duration)||Number(c.durationMs)/1e3||.42,0,3);const p=f&&typeof f=="object"?f.name||f.type||f.enter:f;this.transitionName=j5((p?Xu(p):null)||c.name||c.type||c),n.immediate&&(this.transitionElapsed=this.transitionDuration,this.transitionName="instant"),this.transitionMixes.fill(!n.immediate&&this.transitionDuration>0&&this.previousRecipe!==this.currentRecipe?0:1),(n.preservePhase??h.preservePhase??c.preservePhase??!0)||(this.phase=0);const m=this.reducedMotion&&!n.immediate&&this.transitionDuration>0&&this.startReducedCrossfade(l);return this.updateAria(),this.emit("spritechange",{from:a==null?void 0:a.id,to:o.id,label:jc(o)}),this.running||(this.configurationBatchDepth>0?this.configurationNeedsRender=!0:m||u||n.skipPausedRender?this.paint():this.renderFrame(this.clock,1/60,!0)),this.configurationBatchDepth===0&&!this.isTransitionActive()&&!m&&this.finishTransition(n.immediate?"immediate":"settled"),this}setField(e){const n=Qg(e);return this.fieldOverride=n,this.currentRecipe=iv(this.recipeSource||this.currentRecipe,n),this.emit("configchange",{field:n}),!this.running&&this.configurationBatchDepth===0?this.renderFrame(this.clock,1/60,!0):this.configurationBatchDepth>0&&(this.configurationNeedsRender=!0),this}useRecipeFields(){return this.fieldOverride?(this.fieldOverride=null,this.setSprite(this.recipeSource||this.currentRecipe,{transition:"field-morph",preservePhase:!0,useRecipeFields:!0}),this.emit("configchange",{field:null,fieldMode:"recipe"}),this):this}setPixelSwitch(e){const n=typeof e=="string"?e:(e==null?void 0:e.name)||(e==null?void 0:e.type)||(e==null?void 0:e.mode),r=bf(n);return this.options.pixelSwitch=e&&typeof e=="object"?{...e,mode:r}:r,this.emit("configchange",{pixelSwitch:this.options.pixelSwitch}),this.renderWhenPaused(),this}setPixelShape(e){const n=Jg(e);return this.options.pixelShape=n,this.emit("configchange",{pixelShape:n}),this.renderWhenPaused(),this}setResolution(e){const n=Math.round(lt(Number(e)||this.gridSize,8,96));return n!==this.gridSize&&(this.options.gridSize=n,this.allocate(n),this.emit("configchange",{gridSize:n}),this.configurationBatchDepth>0?this.configurationNeedsRender=!0:this.renderFrame(this.clock,1/60,!0)),this}setSeed(e){var n,r;this.seed=String(e||"joan-v5"),this.seedHash=b2(this.seed),(r=(n=this.fieldKit).reseed)==null||r.call(n,this.seed);for(let i=0;i<this.random.length;i+=1)this.random[i]=Up(i^this.seedHash);return this.emit("configchange",{seed:this.seed}),this.renderWhenPaused(),this}setProgress(e){return this.progress=ot(Number(e)||0),this.signal("progress",{value:this.progress}),this}setAudioLevel(e){return this.audioTarget=ot(Number(e)||0),this.running||(this.audioLevel=this.audioTarget),this.renderWhenPaused(),this}setNonErrorPalette(e,n={}){return this.options.nonErrorPalette=e&&typeof e=="object"?{...e}:null,n.render!==!1&&this.renderWhenPaused(),this}configure(e={},n={}){const r=n.strict!==!1,i=v2(e,{strict:r,coerce:!r,allowUnknown:!1}),s=!!this.options.interactive,o=this.reducedMotion;this.configurationBatchDepth+=1,this.configurationNeedsRender=!0;try{i.seed!==void 0&&this.setSeed(i.seed),i.gridSize!==void 0&&this.setResolution(i.gridSize),i.fieldMode==="recipe"||Object.hasOwn(i,"field")&&i.field===null?(this.fieldOverride=null,this.emit("configchange",{field:null,fieldMode:"recipe"})):i.field!==void 0&&this.setField(i.field),Object.hasOwn(i,"pixelShape")&&(i.pixelShape===null?(this.options.pixelShape=null,this.emit("configchange",{pixelShape:null})):this.setPixelShape(i.pixelShape)),Object.hasOwn(i,"pixelSwitch")&&(i.pixelSwitch===null?(this.options.pixelSwitch=null,this.emit("configchange",{pixelSwitch:null})):this.setPixelSwitch(i.pixelSwitch));const l=["ariaLive","autoResize","autoplay","background","contrast","density","direction","dprMax","fps","interactive","offPixels","orbBoundary","orbBackgroundColor","orbBackgroundMode","previewMode","quality","reducedMotion","speed","targetGlyph","transition"];for(const c of l)Object.hasOwn(i,c)&&(this.options[c]=i[c]);if(Object.hasOwn(i,"orbBackgroundColor")&&!Object.hasOwn(i,"orbBackgroundMode")&&(this.options.orbBackgroundMode=i.orbBackgroundColor?this.options.orbBackgroundMode==="pixelated"?"pixelated":"solid":"none"),Object.hasOwn(i,"reducedMotion")&&(this.reducedMotion=this.resolveReducedMotion()),this.options.previewMode=Vb(this.options.previewMode),Object.hasOwn(i,"palette")&&(this.options.palette=i.palette?{...i.palette}:null),Object.hasOwn(i,"paletteOverride")&&(this.options.palette=i.paletteOverride?{...i.paletteOverride}:null),Object.hasOwn(i,"nonErrorPalette")&&(this.options.nonErrorPalette=i.nonErrorPalette?{...i.nonErrorPalette}:null),Object.hasOwn(i,"progress")&&(this.progress=i.progress),i.sprite!==void 0?this.setSprite(i.sprite,{transition:i.transition||void 0,preservePhase:!0,useRecipeFields:i.fieldMode==="recipe"}):!this.fieldOverride&&i.fieldMode==="recipe"&&(this.currentRecipe=this.recipeSource||this.currentRecipe),i.interactive!==void 0&&!!this.options.interactive!==s){for(const c of this.interactionListeners.splice(0))c();this.options.interactive&&this.bindCanvas(),this.updateAria()}i.autoResize===!1&&this.resizeObserver?(this.resizeObserver.disconnect(),this.resizeObserver=null):i.autoResize===!0&&!this.resizeObserver&&typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(()=>this.resize()),this.resizeObserver.observe(this.canvas)),Object.hasOwn(i,"quality")&&(this.qualityTier=i.quality==="auto"?"high":i.quality,this.stats.quality=this.qualityTier),(Object.hasOwn(i,"quality")||Object.hasOwn(i,"fps"))&&(this.qualityPressure=0,this.qualityRecovery=0,this.qualitySamplePhase=0),Object.hasOwn(i,"fps")&&(this.simulationStep=1/Math.min(60,lt(Number(this.options.fps)||60,1,120)),this.simulationAccumulator=0)}finally{this.configurationBatchDepth-=1}const a={...this.pendingConfigurationDetail||{},configured:Object.keys(i)};return this.pendingConfigurationDetail=null,this.configurationBatchDepth===0&&this.configurationNeedsRender&&(this.configurationNeedsRender=!1,this.running?this.paint():this.renderFrame(this.clock,1/60,!0)),this.emit("configchange",a),this.updateAria(),this.reducedMotion||i.autoplay===!1?this.pause():(i.autoplay===!0||o&&Object.hasOwn(i,"reducedMotion"))&&this.play(),this}setOptions(e={}){return this.configure(e,{strict:!1})}signal(e,n={}){const r=Rj(e,n),i=ot(r),s=this.applyRecipeSignal(e,n,r);if(e==="audio.level")this.audioTarget=i,this.running||(this.audioLevel=i);else if(e==="progress")this.progress=ot(Number((s==null?void 0:s.value)??n.value)||0);else{this.activityEnergy=Math.max(this.activityEnergy,i);const o=lt(Number(n.life)||1.2,.1,12);this.signals.set(e,{age:0,life:o,value:i,payload:{...n}}),e==="search.hit"?this.signalState.hits=Math.min(8,this.signalState.hits+1):e==="search.results"?this.signalState.hits=Math.max(0,Math.round(Number((s==null?void 0:s.value)??r)||0)):e==="network.retry"?this.signalState.retry=i:e==="tool.step"?this.signalState.steps=Math.max(1,Math.round(Number(n.steps??n.step)||this.signalState.steps+1)):e==="handoff.accepted"?this.signalState.accepted=n.accepted!==!1:(e==="transfer.direction"||e==="direction")&&(this.signalState.direction=String(n.direction||n.value||"down")),n.direction&&(this.signalState.direction=String(n.direction)),n.targetGlyph&&(this.signalState.targetGlyph=n.targetGlyph),n.segments&&(this.signalState.segments=Math.max(1,Math.round(Number(n.segments)))),n.rotationSpeed&&(this.signalState.rotationSpeed=Number(n.rotationSpeed)||1),this.signalState.signalStrength=Math.max(this.signalState.signalStrength,i),this.emitImpulse(e,{x:Number(n.x??this.pointer.x),y:Number(n.y??this.pointer.y),energy:i,life:Number(n.life)||1.2})}return this.emit("signal",{type:e,payload:n}),e==="resume"&&i>0?(this.resume({source:n.source||"signal"}),this):(this.renderWhenPaused(),this)}renderWhenPaused(){if(this.configurationBatchDepth>0){this.configurationNeedsRender=!0;return}!this.running&&!this.destroyed&&this.renderOnce(this.clock)}emitImpulse(e,n={}){this.impulses.push({type:e,x:lt(Number(n.x)||0,-1,1),y:lt(Number(n.y)||0,-1,1),age:0,life:lt(Number(n.life)||1,.1,4),energy:ot(Number(n.energy)||.7)}),this.impulses.length>12&&this.impulses.shift()}registerGlyph(e,n,r={}){var l;if(!e||!n&&n!==0)throw new TypeError("registerGlyph requires an id and sampler or bitmap.");if(typeof n=="function")return this.customGlyphs.set(e,n),this;const i=Array.isArray(n)&&Array.isArray(n[0])?n:null,s=Math.max(1,r.width||((l=i==null?void 0:i[0])==null?void 0:l.length)||1),o=Math.max(1,r.height||(i==null?void 0:i.length)||1),a=i?i.flat():Array.from(n);return this.customGlyphs.set(e,(c,u)=>{const f=Math.round(ot((c+1)*.5)*(s-1)),h=Math.round(ot((u+1)*.5)*(o-1));return ot(Number(a[h*s+f])||0)}),this}async loadGlyphFile(e,n={}){if(typeof document>"u")throw new Error("Image glyph loading requires a browser.");const r=n.id||"custom",i=Math.round(lt(n.resolution||48,8,128)),s=URL.createObjectURL(e);try{const o=await new Promise((m,b)=>{const y=new Image;y.onload=()=>m(y),y.onerror=()=>b(new Error("The glyph image could not be decoded.")),y.src=s}),a=document.createElement("canvas");a.width=i,a.height=i;const l=a.getContext("2d",{willReadFrequently:!0}),c=Math.min(i/o.width,i/o.height)*.84,u=o.width*c,f=o.height*c;l.clearRect(0,0,i,i),l.drawImage(o,(i-u)/2,(i-f)/2,u,f);const h=l.getImageData(0,0,i,i).data,p=new Float32Array(i*i);for(let m=0;m<p.length;m+=1){const b=m*4,y=(h[b]*.2126+h[b+1]*.7152+h[b+2]*.0722)/255;p[m]=h[b+3]/255*Math.max(.3,y)}this.registerGlyph(r,p,{width:i,height:i});const g=ev(n.baseSprite||"ai.generating")||this.currentRecipe;return this.setSprite({...g,id:r,glyph:r,label:n.label||"Custom glyph",semantic:{...g.semantic||{},label:n.label||"Custom glyph",category:"custom"}},{transition:n.transition||"field-morph"}),r}finally{URL.revokeObjectURL(s)}}sampleCustomGlyph(e,n,r,i,s){const o=this.customGlyphs.get(e);return o?ot(Number(o(n,r,i,s))||0):jB(e,n,r,i,s)}scheduleFrame(){!this.running||this.destroyed||!this.visible||this.frameHandle!==null||typeof requestAnimationFrame!="function"||(this.frameHandle=requestAnimationFrame(this.frameTick))}cancelScheduledFrame(){this.frameHandle!==null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this.frameHandle),this.frameHandle=null}play(){return this.running||this.destroyed||this.reducedMotion?this:(this.running=!0,this.lastFrameTime=null,this.frameTick||(this.frameTick=e=>{if(this.frameHandle=null,!this.running||this.destroyed||!this.visible)return;const n=e/1e3;if(this.lastFrameTime===null){this.lastFrameTime=n,this.scheduleFrame();return}const r=1/lt(Number(this.options.fps)||60,1,120);if(n-this.lastPaintTime+.002>=r){const s=Math.max(0,n-this.lastFrameTime);this.lastFrameTime=n,this.lastPaintTime=n,this.renderFrame(n,s)}this.scheduleFrame()}),this.scheduleFrame(),this.emit("play",{sprite:this.currentRecipe.id}),this)}pause(){return this.running?(this.running=!1,this.cancelScheduledFrame(),this.emit("pause",{sprite:this.currentRecipe.id}),this):this}toggle(){return this.running?this.pause():this.play()}updateDynamics(e){var c,u,f,h,p;const n=this.options.speed;this.clock+=e,this.phase+=e*n;const r=ot(Number(this.semanticContext.stepHold)||0);this.signalState.toolPhase+=e*n*(1-r),this.stateElapsed+=e,this.transitionElapsed+=e,this.pointer.x=po(this.pointer.x,this.pointer.inside?this.pointer.targetX:0,e,.13),this.pointer.y=po(this.pointer.y,this.pointer.inside?this.pointer.targetY:0,e,.13),this.pointer.speed=po(this.pointer.speed,0,e,.2);const i=((u=(c=this.currentRecipe)==null?void 0:c.interactions)==null?void 0:u.press)||{},s=lt(Number(i.strength??.07),0,1),o=lt(Number(i.durationMs)/1e3||.18,.08,1.2);if(this.press=po(this.press,this.pointer.down?lt(.2+s*3.6,.2,1):0,e,o*.72),this.audioLevel=po(this.audioLevel,this.audioTarget,e,.09),this.audioTarget=po(this.audioTarget,0,e,.28),this.activityEnergy=po(this.activityEnergy,0,e,.5),this.signalState.retry=po(this.signalState.retry,0,e,.75),this.signalState.signalStrength=po(this.signalState.signalStrength,0,e,.5),this.impulses.length){for(const g of this.impulses)g.age+=e;this.impulses=this.impulses.filter(g=>g.age<g.life)}for(const[g,m]of this.signals)m.age+=e,m.age>=m.life&&this.signals.delete(g);for(const[g,m]of this.semanticSignals)m.decaySeconds>0&&typeof m.value=="number"&&(m.value=po(m.value,0,e,m.decaySeconds),Math.abs(m.value)<.001&&(m.value=0),this.semanticContext[g]=m.value);if(this.previousRecipe!==this.currentRecipe&&this.completedTransitionSerial!==this.transitionSerial&&this.transitionElapsed>=this.transitionDuration&&this.finishTransition("completed"),this.pendingSpriteTransition&&this.transitionElapsed>=this.transitionDuration){const g=this.pendingSpriteTransition;this.pendingSpriteTransition=null,this.setSprite(g.sprite,{...g.options,forceTransition:!0})}const a=(f=this.currentRecipe)==null?void 0:f.timeline,l=(Number(a==null?void 0:a.durationMs)+Number((a==null?void 0:a.holdMs)||0))/1e3;if(a!=null&&a.next&&Number.isFinite(l)&&l>0&&this.stateElapsed>=l){const g=this.currentRecipe;this.setSprite(a.next,{duration:Number((h=g==null?void 0:g.transition)==null?void 0:h.exitDurationMs)/1e3||void 0,transition:((p=g==null?void 0:g.transition)==null?void 0:p.exit)||"field-morph",forceTransition:!0}),this.emit("timelinecomplete",{from:g.id,to:this.currentRecipe.id})}}recipeMetadata(e){var a,l,c;const n=e&&typeof e=="object"?e:this.currentRecipe,r=this.recipeMetadataCache.get(n);if(r)return r;const i=String(((a=n==null?void 0:n.semantic)==null?void 0:a.meaning)||"").toLowerCase(),s=String(((l=n==null?void 0:n.semantic)==null?void 0:l.category)||"").toLowerCase(),o={meaning:i,category:s,toolAction:/executing a tool|tool action/.test(i),deliberateReasoning:/deliberate.*reasoning/.test(i),voiceOutput:/voice output|speaking/.test(i)||Number((c=n==null?void 0:n.composition)==null?void 0:c.voice)>0,listening:/capturing voice|listening/.test(i),presence:s==="presence"||/calm.*presence|ready and available/.test(i),ambientReasoning:s==="ambient"&&/reasoning/.test(i)};return this.recipeMetadataCache.set(n,o),o}resolvedPixelSwitch(e=this.currentRecipe){const n=this.options.pixelSwitch;return(this.pixelSwitchCache.recipe!==e||this.pixelSwitchCache.override!==n)&&(this.pixelSwitchCache.recipe=e,this.pixelSwitchCache.override=n,this.pixelSwitchCache.value=nv(e,n)),this.pixelSwitchCache.value}semanticEnvelope(e,n,r=this.recipeMetadata(e)){const i=e&&typeof e=="object"?e:this.currentRecipe;let s=this.semanticEnvelopeCache.get(i);if((s==null?void 0:s.time)===n&&s.audioLevel===this.audioLevel)return s.value;const o=.6*Math.sin(n*.9)+.4*Math.sin(n*.333+1.3),a=.5+.5*Math.sin(n*9)*Math.sin(n*3.7+1.1),l=Math.max(0,Math.sin(n*2.3)+.35*Math.sin(n*5.9)),c=(.25+.75*a)*Math.min(1,l);let u;if(r.voiceOutput)u=ot(this.audioLevel||c*.8);else if(r.listening)u=ot(this.audioLevel*.8+.2);else if(r.presence)u=.5+o*.14;else if(r.deliberateReasoning||r.ambientReasoning){const f=ps(n*.22);u=f<.45?.5-.5*Math.cos(Math.PI*(f/.45)):.5+.5*Math.cos(Math.PI*((f-.45)/.55))}else u=.5+o*.08;return s?(s.time=n,s.value=u,s.audioLevel=this.audioLevel):(s={time:n,value:u,audioLevel:this.audioLevel},this.semanticEnvelopeCache.set(i,s)),u}orbVisualRadius(e,n=this.clock){var l,c,u;const r=(e==null?void 0:e.composition)||{};if(r.gestaltBoundary!==!0)return 0;if(r.mode==="field-orb"){const f=lt(Number(r.radius)||.86,.45,.98),h=lt(Number(r.breathe)||0,0,.22),p=this.semanticEnvelope(e,n,this.recipeMetadata(e));return f*(1+(p-.5)*h*.7)}const i=Number((l=e==null?void 0:e.timeline)==null?void 0:l.macroCycleMs)||Number((c=e==null?void 0:e.timeline)==null?void 0:c.durationMs)||14400,s=this.reducedMotion?ot(Number((u=e==null?void 0:e.reducedMotion)==null?void 0:u.phase)||.18):ps(n/Math.max(.001,i/1e3)),o=Math.sin(s*El*2-Math.PI/2);return lt(Number(r.radius)||.67,.45,.98)+o*.022}orbBackgroundRadius(e,n=this.clock){const r=this.orbVisualRadius(e,n);if(r<=0)return 0;const i=(e==null?void 0:e.composition)||{},s=2/Math.max(1,this.gridSize),o=s*Nd(e)*(Math.SQRT2/2),a=s*.25,l=i.mode==="field-orb"?lt(Number(i.radius)||.86,.45,.98)*lt(Number(i.breathe)||0,0,.22)*.7:(e==null?void 0:e.glyph)==="idle"?.044:0;return Math.min(1.1,r+l+o+a)}impulseAt(e,n){let r=0;for(const i of this.impulses){const s=Math.hypot(e-i.x,n-i.y),o=1-i.age/i.life,a=Math.exp(-Math.abs(s-i.age*(.7+i.energy*.5))*18);r+=a*o*i.energy}return ot(r)}recipeSample(e,n,r,i,s,o=null){var tn,Qn,se,_e,me,ve,Xe,et,dt,ge,Ae,Ie,pt,Le,gt,nn,St,Rt,re,ae,he;const a=ot(Number(this.semanticContext.shellEnergy)||0),l=this.recipeMetadata(e),c=l.toolAction?this.signalState.toolPhase:i,u=l.deliberateReasoning?1+a*.55:1,f=c*lt(Number(e==null?void 0:e.speed)||1,.02,8)*u,h=(tn=e==null?void 0:e.interactions)==null?void 0:tn.pointer,p=this.options.interactive&&this.gridSize>=Number((h==null?void 0:h.minSize)??20)&&!this.reducedMotion&&(e==null?void 0:e.interactions)!==!1&&(h==null?void 0:h.enabled)!==!1,g=lt(Number((h==null?void 0:h.strength)??.16),0,1),m=(h==null?void 0:h.effect)||"steer-light",b=vj[m]||{warp:.35,light:.5,surface:.45},y=this.pointerSampleScratch;y.x=p?this.pointer.x:0,y.y=p?this.pointer.y:0,y.speed=p?this.pointer.speed:0;const _=this.semanticEnvelope(e,i,l),k=Math.hypot(n-y.x,r-y.y),S=p&&this.pointer.inside?Math.max(0,1-k/1.15):0,E=S*g*(.075+y.speed*.15)*b.warp,M=n-(n-y.x)*E,O=r-(r-y.y)*E,P=this.impulseAt(n,r),x=this.sampleContextScratch;x.accepted=this.signalState.accepted,x.age=this.stateElapsed,x.audioLevel=this.audioLevel,x.direction=this.signalState.direction,x.motionDirection=((Qn=e==null?void 0:e.pixelSwitch)==null?void 0:Qn.direction)||"field",x.elapsed=this.stateElapsed,x.energy=ot(this.activityEnergy+P),x.envelope=_,x.handoffAccepted=this.signalState.accepted,x.hits=this.signalState.hits,x.glyphSampler=this.glyphSampler,x.pointer=y,x.pointerEffect=m,x.pointerInfluence=S,x.press=this.press,x.pressEffect=((_e=(se=e==null?void 0:e.interactions)==null?void 0:se.press)==null?void 0:_e.effect)||"spring-compress",x.progress=this.progress,x.random=this.random[s],x.retry=this.signalState.retry,x.rotationSpeed=this.signalState.rotationSpeed,x.resolution=this.gridSize,x.segments=this.signalState.segments,x.size=this.gridSize,x.seed=this.seedHash,x.signalStrength=this.signalState.signalStrength,x.signals=this.signals,x.steps=this.signalState.steps,x.targetGlyph=this.signalState.targetGlyph,x.reducedMotion=this.reducedMotion,x.reducedPhase=(me=e==null?void 0:e.reducedMotion)==null?void 0:me.phase;const C=Number((ve=e==null?void 0:e.timeline)==null?void 0:ve.macroCycleMs)||Number((Xe=e==null?void 0:e.timeline)==null?void 0:Xe.durationMs)||1e3;x.timelinePhase=this.reducedMotion?ot(Number((et=e==null?void 0:e.reducedMotion)==null?void 0:et.phase)||.25):ps(i/Math.max(.001,C/1e3)),Object.assign(x,this.semanticContext);const R=(e==null?void 0:e.composition)||{},N=R.mode||"glyph",B=R.gestaltBoundary===!0&&this.options.orbBoundary==="gestalt";x.orbBoundary=B?"gestalt":"defined";const z=Number(R.gestaltOpenness);x.gestaltOpenness=lt(Number.isFinite(z)?z:.5,0,1);const H=Math.hypot(M,O),X=lt(Number(R.radius)||.86,.45,.98),G=lt(Number(R.breathe)||0,0,.22),Z=X*(1+(_-.5)*G*.7),oe=lt(1.15/this.gridSize,.022,.095),K=1-Bc(Z-oe,Z+oe,H),q=(e==null?void 0:e.glyph)||"idle",W=N==="field-orb"?K:this.sampleCustomGlyph(q,M,O,f,x),J=ot(W),fe=Array.isArray(e==null?void 0:e.fieldMix)&&e.fieldMix.length?e.fieldMix:[{field:(e==null?void 0:e.field)||((ge=(dt=e==null?void 0:e.fields)==null?void 0:dt[0])==null?void 0:ge.id)||((Ie=(Ae=e==null?void 0:e.fields)==null?void 0:Ae[0])==null?void 0:Ie.type)||"fbm",weight:1,scale:1,speed:1,phase:0,contrast:1,blend:"replace"}];let $=.5,de=0;for(let le=0;le<fe.length;le+=1){const Pe=fe[le],Oe=lt(Number(Pe.weight)||0,0,1),Re=lt(Number(Pe.scale)||1,.05,24),Ce=f,He=Object.assign(this.fieldOptionsScratch,x,Pe);let Ge=this.fieldKit.sample(Pe.field||Pe.id||Pe.type||(e==null?void 0:e.field)||"fbm",M*Re,O*Re,Ce,He);Ge=ot(Ge);const Ft=Pe.blend||"add";if(de===0)$=Ge;else if(Ft==="replace")$=$*(1-Oe)+Ge*Oe;else if(Ft==="screen"){const jt=1-(1-$)*(1-Ge);$=$*(1-Oe)+jt*Oe}else if(Ft==="multiply"){const jt=$*Ge;$=$*(1-Oe)+jt*Oe}else if(Ft==="max"||Ft==="lighten")$=$*(1-Oe)+Math.max($,Ge)*Oe;else if(Ft==="soft-light"){const jt=Ge<.5?$-(1-2*Ge)*$*(1-$):$+(2*Ge-1)*(Math.sqrt(Math.max(0,$))-$);$=$*(1-Oe)+jt*Oe}else $+=(Ge-.5)*Oe*1.35;de+=Oe}const Be=lt(Number(R.fieldContrast)||Number(e==null?void 0:e.fieldContrast)||1.16,.5,3);$=ot(($-.5)*Be+.5);const wt=ot((1.12-H)/.22),Je=lt(Number((e==null?void 0:e.ambientMix)??((Le=(pt=e==null?void 0:e.fields)==null?void 0:pt[0])==null?void 0:Le.mix)??.055+(Number(e==null?void 0:e.density)||.72)*.1),0,.4),Ue=lt(Number(R.fieldDetail??(e==null?void 0:e.detail)??((nn=(gt=e==null?void 0:e.fields)==null?void 0:gt[0])==null?void 0:nn.detail)??.68),0,1.5),ke=lt(Number(((Rt=(St=e==null?void 0:e.interactions)==null?void 0:St.press)==null?void 0:Rt.strength)??.07),0,1),ct=((ae=(re=e==null?void 0:e.interactions)==null?void 0:re.press)==null?void 0:ae.effect)||"spring-compress",Ee=bj[ct]||{surface:.55},Ve=P*wt*lt(ke*6.85,0,1)*Ee.surface+S*g*.22*b.surface,be=lt(Number(e==null?void 0:e.threshold)||.5,0,1),xt=lt(Number(e==null?void 0:e.density)||.72,0,1.4),_t=(.5-be)*.32+(xt-.72)*.1;let Yt;if(N==="field-orb"){const le=M/Math.max(.001,Z),Pe=O/Math.max(.001,Z),Oe=Math.sqrt(Math.max(0,1-le*le-Pe*Pe)),Re=R.lighting||"sphere";let Ce=0;if(Re!=="flat"){let nt=Re==="crescent"?-.92:Re==="gibbous"?-.55:-.42,tt=Re==="crescent"?-.24:Re==="gibbous"?-.3:-.48,Vt=Re==="crescent"?.32:Re==="gibbous"?.82:.76;const In=lt(Number(R.lightOrbit)||0,0,.8);if(nt+=Math.cos(f*.6)*In,tt+=Math.sin(f*.43)*In,p&&this.pointer.inside){const ie=lt(g/.16,0,2)*.28*b.light;nt+=y.x*ie,tt+=y.y*ie}const L=Math.hypot(nt,tt,Vt)||1;nt/=L,tt/=L,Vt/=L,Ce=Math.max(0,le*nt+Pe*tt+Oe*Vt),Ce=Math.pow(Ce,Re==="crescent"?1.58:.88)}const He=($-.5)*Ue,Ge=lt(Number(R.voice)||0,0,.5)*_*.62,Ft=G*(_-.5)*.52,jt=Re==="flat"?.5+He*.92+Ge+Ft:Re==="crescent"?Ce*(.76+He*1.08+Ge)+Ft:.15+Ce*.58+He*.72+Ge+Ft;if(B){const nt=2/this.gridSize,tt=lt(nt*3.05,.055,.2),Vt=N5(Math.atan2(O,M),x,x.gestaltOpenness),In=Bc(Z-tt*1.14,Z-tt*.4,H)*K,L=jt*K,ie=1-Bc(.42,.74,ot(jt+_t)),Te=In*Vt*(.47+$*.14+Ce*.05)*ie;Yt=ot(Math.max(L,Te)+Ve+_t)}else{const nt=Number(R.rim),tt=lt(Number.isFinite(nt)?nt:.045,.012,.12),Vt=Math.abs(H-Z),L=(1-Bc(tt,tt+oe,Vt))*(.46+$*.18);Yt=ot(Math.max(jt*K,L)+Ve+_t)}}else{const le=Bc(.16,.76,J),Pe=lt(Number((he=e==null?void 0:e.pixel)==null?void 0:he.silhouetteFloor)||.38,.12,.72),Oe=s%this.gridSize,Re=Math.floor(s/this.gridSize),Ce=f2(Oe+(this.seedHash&7),Re+(this.seedHash>>>3&7)),He=Bc(.56,.9,J),Ge=Ce<Pe?He*(.9+$*.08):0,Ft=ot(.1+$*(.82+Ue*.32)),jt=Math.min(J,.5)*(.68+$*.18),nt=Math.max(jt,le*Ft,Ge),tt=$*wt*Je*(1-le*.82)*(.72+_*.24+P*.5);Yt=ot(Math.max(nt,tt)+Ve+_t)}const en=o||{};return en.raw=Yt,en.field=$,en.glyph=J,en.envelope=_,en.impulse=P,en.pointerInfluence=S,en}directionalThreshold(e,n,r,i){switch(e){case"inward":case"reverse-to-center":return 1-ot(Math.hypot(n,r)/Math.SQRT2);case"radial":case"radial-tail":case"outward-audio":case"outward-beacon":case"bounded-burst":case"core-to-target":case"shell-to-shell":return ot(Math.hypot(n,r)/Math.SQRT2);case"radar-sweep":return ps(ps((Math.atan2(r,n)+Math.PI)/El)-i*.12);case"bottom-to-contour":return 1-ot((r+1)*.5);case"diagonal-fracture":case"source-to-destination":case"tail-to-head":return(ot((n+1)*.5)+ot((r+1)*.5))*.5;case"counter-flow":return 1-ot((n+1)*.5);case"columns":case"gear-step":return ps(ot((n+1)*.5)*8);case"aperture":case"bridge-and-retreat":return Math.abs(ot((n+1)*.5)-.5)*2;case"data-direction":return this.signalState.direction==="up"?ot((r+1)*.5):this.signalState.direction==="left"?ot((n+1)*.5):this.signalState.direction==="right"?1-ot((n+1)*.5):1-ot((r+1)*.5);case"audio-surface":case"contour-forward":case"surface-drift":return ps(ot((n+1)*.5)*.55+ot((r+1)*.5)*.3-i*.08);case"field":default:return .5}}switchThreshold(e,n,r,i,s,o){const a=e.mode;if(a==="threshold-hysteresis")return .5;const l=this.random[n];if(a==="seeded-dissolve")return l;const c=this.gridSize,u=n%c,f=Math.floor(n/c),h=lt(Number(e.temporalRate??1),0,8),p=Math.floor(s*12*h)&15,g=String(e.dither||"bayer8"),m=g==="blue-noise64"?Up(u+f*64^this.seedHash^(g.startsWith("temporal")?p*2654435769:0)):f2(u,f),b=this.directionalThreshold(e.direction||"field",r,i,s),y=ot(m*.86+b*.14);switch(a){case"temporal-blue-noise":return ot(y*.52+Up(n^this.seedHash^p*2654435769)*.48);case"sdf-wavefront":return ot(y*.78+Math.abs(Math.hypot(r,i)/Math.SQRT2-ps(s*.35*h))*.22);case"contour-trace":return ot(y*.82+Math.abs(ps(o*4)-.5)*.18);case"curl-advect":return ot(y+Math.sin(r*8+i*5-s*2*h)*.09);case"neighbor-propagation":return ot(y-this.neighborBuffer[n]*.16);case"radial-cascade":return ot(y*.8+Math.hypot(r,i)/Math.SQRT2*.2);case"path-draw":return ot(y*.78+(r+i+2)*.25*.22);case"axis-flip":return ot(y*.86+u%2*.08);case"field-morph":return ot(y*.68+l*.32);case"ordered-dither":default:return y}}updateNeighborBuffer(e=4){const n=this.gridSize,r=lt((Number(e)-4)/4,0,1);for(let i=0;i<n;i+=1)for(let s=0;s<n;s+=1){const o=i*n+s;let a=0,l=0;s>0&&(a+=this.gates[o-1],l+=1),s<n-1&&(a+=this.gates[o+1],l+=1),i>0&&(a+=this.gates[o-n],l+=1),i<n-1&&(a+=this.gates[o+n],l+=1),r>0&&(s>0&&i>0&&(a+=this.gates[o-n-1]*r,l+=r),s<n-1&&i>0&&(a+=this.gates[o-n+1]*r,l+=r),s>0&&i<n-1&&(a+=this.gates[o+n-1]*r,l+=r),s<n-1&&i<n-1&&(a+=this.gates[o+n+1]*r,l+=r)),this.neighborBuffer[o]=l?a/l:0}}evaluateGrid(e,n={}){var k,S,E,M;const r=this.currentRecipe,i=this.previousRecipe||r,s=n.forceFull?1:this.qualityTier==="low"?3:this.qualityTier==="balanced"?2:1,o=s===1?0:this.qualitySamplePhase%s;s>1?this.qualitySamplePhase=(o+1)%s:this.qualitySamplePhase=0;const a=this.transitionDuration<=0?1:ot(this.transitionElapsed/this.transitionDuration),l=this.resolvedPixelSwitch(r),c=(this.options.density-1)*.17,u=this.options.contrast,f=lt(Number((r==null?void 0:r.hysteresis)??((k=r==null?void 0:r.pixelSwitch)==null?void 0:k.hysteresis)??((S=r==null?void 0:r.pixel)==null?void 0:S.hysteresis)??.055),.005,.2),h=lt(Number((r==null?void 0:r.rise)??((E=r==null?void 0:r.pixel)==null?void 0:E.rise)??.075),.025,.5),p=lt(Number((r==null?void 0:r.fall)??((M=r==null?void 0:r.pixel)==null?void 0:M.fall)??.14),.025,.7),g=this.pointer.inside&&!this.reducedMotion?{x:this.pointer.x,y:this.pointer.y}:{x:0,y:0};l.mode==="neighbor-propagation"&&this.updateNeighborBuffer(l.neighborhood);const b=.5/lt(Number(l.maxContrastFlashesPerSecond??3),.5,12);let y=0,_=0;for(let O=0;O<this.values.length;O+=1){if(this.dwell[O]=Math.max(0,this.dwell[O]-e),s===1||O%s===o){_+=1;const N=this.xs[O],B=this.ys[O],z=this.recipeSample(r,N,B,this.phase,O,this.sampleToScratch);let H=z.raw,X=z.field,G=1;if(a<1&&i!==r){const K=this.recipeSample(i,N,B,this.phase,O,this.sampleFromScratch),q=Nj(this.transitionName,N,B,this.random[O],g);G=this.reducedMotion?Al(a):Al((a-q*.58)/.42),H=K.raw+(z.raw-K.raw)*G,X=K.field+(z.field-K.field)*G}this.transitionMixes[O]=G,H=ot((H-.5)*u+.5+c),this.luminance[O]=ot(X*.45+H*.55);const Z=this.switchThreshold(l,O,N,B,this.phase,H),oe=this.gates[O];this.dwell[O]<=0&&(!oe&&H>Z+f?(this.gates[O]=1,this.dwell[O]=.045+this.random[O]*.075,this.afterglow[O]=1):oe&&!l.monotonic&&H<Z-f&&(this.gates[O]=0,this.dwell[O]=Math.max(b,.06+this.random[O]*.1)))}this.afterglow[O]=Math.max(this.gates[O],this.afterglow[O]*Math.exp(-e/p));const P=this.gates[O]?1:this.afterglow[O]*.18;this.targets[O]=P;const x=P>this.values[O]?h:p,C=1-Math.exp(-e/x),R=Math.exp(-e*(P>this.values[O]?11:8));this.velocities[O]=(this.velocities[O]+(P-this.values[O])*C*22)*R,this.values[O]=ot(this.values[O]+this.velocities[O]*e),this.values[O]>.32&&(y+=1)}this.stats.activePixels=y,this.stats.sampledPixels=_}settleGrid(e=this.clock,n={}){var o,a,l,c,u,f;const r=Number.isFinite(Number(e))?Number(e):this.clock;let i=r;if(this.reducedMotion&&r===0){const h=lt(Number((a=(o=this.currentRecipe)==null?void 0:o.reducedMotion)==null?void 0:a.phase)||.25,0,1);i=(Number((c=(l=this.currentRecipe)==null?void 0:l.timeline)==null?void 0:c.macroCycleMs)||Number((f=(u=this.currentRecipe)==null?void 0:u.timeline)==null?void 0:f.durationMs)||4e3)/1e3*h}this.clock=r,this.phase=i*this.options.speed,this.transitionElapsed=this.transitionDuration,this.dwell.fill(0),this.evaluateGrid(1/60,{forceFull:!0});let s=0;for(let h=0;h<this.values.length;h+=1){const p=this.gates[h]?1:0;this.values[h]=p,this.targets[h]=p,this.velocities[h]=0,this.afterglow[h]=p,p&&(s+=1)}this.stats.activePixels=s,n.completeTransition!==!1&&this.finishTransition("settled")}drawPixel(e,n,r,i,s,o,a,l=0){var h;const c=.18+a*.82,u=s*c/2,f=o*c/2;switch(e){case"square":n.fillRect(r-u,i-f,u*2,f*2);break;case"diamond":n.save(),n.translate(r,i),n.rotate(Math.PI/4),n.fillRect(-u*.74,-f*.74,u*1.48,f*1.48),n.restore();break;case"capsule":{const p=Math.min(u,f);n.beginPath(),(h=n.roundRect)==null||h.call(n,r-u,i-f*.64,u*2,f*1.28,p),n.roundRect||n.ellipse(r,i,u,f*.64,0,0,El),n.fill();break}case"line":n.save(),n.translate(r,i),l&&n.rotate(l),n.fillRect(-u,-f*.22,u*2,f*.44),n.restore();break;case"ring":n.lineWidth=Math.max(.12,Math.min(s,o)*.14),n.beginPath(),n.ellipse(r,i,u,f,0,0,El),n.stroke();break;case"cross":n.fillRect(r-u,i-f*.2,u*2,f*.4),n.fillRect(r-u*.2,i-f,u*.4,f*2);break;case"disc":default:n.beginPath(),n.ellipse(r,i,u,f,0,0,El),n.fill();break}}paint(){var O;const e=this.context,n=this.width||this.canvas.width/(this.dpr||1),r=this.height||this.canvas.height/(this.dpr||1),i=this.isTransitionActive(),s=i?Al(this.transitionElapsed/Math.max(.001,this.transitionDuration)):1,o=qp(this.currentRecipe,this.options),a=i?qp(this.previousRecipe||this.currentRecipe,this.options):o,l=i?Oj(a,o,s):o,c=tv(this.options.pixelShape||Xd(this.currentRecipe,"pixelShape","disc")),u=this.resolvedPixelSwitch(this.currentRecipe).mode,{stageSize:f,offsetX:h,offsetY:p,cellSize:g}=GB(this.options.previewMode,this.gridSize,n,r),m=Nd(this.currentRecipe),b=i?Nd(this.previousRecipe||this.currentRecipe):m,y=g*(b+(m-b)*s);e.save(),e.setTransform(this.renderScaleX||this.dpr||1,0,0,this.renderScaleY||this.dpr||1,0,0),e.clearRect(0,0,n,r),this.options.background&&l.background!=="transparent"&&(e.fillStyle=l.background,e.fillRect(0,0,n,r)),e.imageSmoothingEnabled=!1;const _=Da(this.options.orbBackgroundColor,"transparent");if(this.options.orbBackgroundMode!=="none"&&_!=="transparent"){const P=i?this.previousRecipe||this.currentRecipe:this.currentRecipe,x=this.orbBackgroundRadius(P,this.clock),C=this.orbBackgroundRadius(this.currentRecipe,this.clock),R=x>0,N=C>0,B=i?(R?1-s:0)+(N?s:0):N?1:0,z=R&&N?x+(C-x)*s:N?C:x;B>.001&&z>0&&(e.globalAlpha=ot(B),e.fillStyle=_,this.options.orbBackgroundMode==="pixelated"?Tj(e,this.gridSize,z,h,p,g):(e.beginPath(),e.arc(h+f/2,p+f/2,f*z/2,0,El),e.fill()),e.globalAlpha=1)}if(this.options.offPixels){const P=`${l.off}|${l.ink}`;((O=this.paintColorCache.off)==null?void 0:O.key)!==P&&(this.paintColorCache.off={key:P,value:Ws(l.off,l.ink,.05,.58)}),e.fillStyle=this.paintColorCache.off.value;const x=Math.max(.16,y*.18);for(let C=0;C<this.values.length;C+=1){const R=C%this.gridSize,N=Math.floor(C/this.gridSize),B=h+(R+.5)*g,z=p+(N+.5)*g;e.fillRect(B-x/2,z-x/2,x,x)}}const k=[a.ink,a.accent,o.ink,o.accent].join("|");if(this.paintColorCache.key!==k){const P=Array.from({length:9},(C,R)=>Ws(a.ink,a.accent,R/8,1)),x=Array.from({length:9},(C,R)=>Ws(o.ink,o.accent,R/8,1));this.paintColorCache.key=k,this.paintColorCache.source=P,this.paintColorCache.target=x,this.paintColorCache.steady=[x],this.paintColorCache.transition=null}if(i&&!this.paintColorCache.transition){const P=this.paintColorCache.source,x=this.paintColorCache.target;this.paintColorCache.transition=Array.from({length:9},(C,R)=>Array.from({length:9},(N,B)=>Ws(P[B],x[B],R/8,1)))}const S=i?this.paintColorCache.transition:this.paintColorCache.steady,E=lt((72-this.gridSize)/24,0,1);if(this.qualityTier!=="low"&&this.gridSize<=48&&E>.04&&Xd(this.currentRecipe,"glow",!0)!==!1&&String(l.glow).trim().toLowerCase()!=="transparent"){e.shadowColor=l.glow;const P=this.qualityTier==="balanced"?.58:1;e.shadowBlur=Math.max(.25,g*.52*E*P)}for(let P=0;P<this.values.length;P+=1){const x=this.values[P];if(x<.035)continue;const C=P%this.gridSize,R=Math.floor(P/this.gridSize),N=h+(C+.5)*g,B=p+(R+.5)*g,z=this.luminance[P],H=Yb(c,z),X=Math.min(8,Math.floor(z*8.999)),G=ot(x*(.72+z*.28));e.globalAlpha=G;const Z=i?Math.min(8,Math.round(this.transitionMixes[P]*8)):0,oe=S[Z][X];e.fillStyle=oe,e.strokeStyle=oe;let K=1,q=1;u==="axis-flip"||i&&this.transitionName==="axis-flip"?q=Math.max(.07,Math.sin(x*Math.PI*.5)):u==="path-draw"?K=.35+x*.65:u==="radial-cascade"&&(K=q=.55+x*.45);const W=H==="line"?Math.atan2(this.ys[P],this.xs[P])+Math.PI/2:0;this.drawPixel(H,e,N,B,y*K,y*q,x,W)}e.globalAlpha=1,e.shadowBlur=0,e.restore()}updateAdaptiveQuality(e){if(this.options.quality!=="auto"){this.qualityTier=this.options.quality,this.stats.quality=this.qualityTier;return}const n=1e3/lt(Number(this.options.fps)||60,1,120);e>n*1.12?(this.qualityPressure+=1,this.qualityRecovery=Math.max(0,this.qualityRecovery-2)):e<n*.62?(this.qualityRecovery+=1,this.qualityPressure=Math.max(0,this.qualityPressure-1)):(this.qualityPressure=Math.max(0,this.qualityPressure-.25),this.qualityRecovery=Math.max(0,this.qualityRecovery-.5));let r=this.qualityTier;if(this.qualityPressure>=18?(r=r==="high"?"balanced":"low",this.qualityPressure=0,this.qualityRecovery=0):this.qualityRecovery>=180&&(r=r==="low"?"balanced":"high",this.qualityPressure=0,this.qualityRecovery=0),r!==this.qualityTier){const i=this.qualityTier;this.qualityTier=r,this.emit("qualitychange",{from:i,to:r,frameMs:e,budgetMs:n})}this.stats.quality=this.qualityTier}renderFrame(e=0,n=1/60,r=!1){if(this.destroyed)return this.stats;const i=typeof performance<"u"?performance.now():Date.now(),s=this.reducedMotion&&!r?0:lt(Number(n)||0,0,this.maxCatchUpSeconds);let o=0,a=0;if(r)this.simulationAccumulator=0,this.settleGrid(e);else{for(this.simulationAccumulator=Math.min(this.maxCatchUpSeconds,this.simulationAccumulator+s);this.simulationAccumulator+1e-9>=this.simulationStep&&o<this.maxSimulationSteps;)this.updateDynamics(this.simulationStep),this.simulationAccumulator-=this.simulationStep,o+=1,a+=this.simulationStep;o===this.maxSimulationSteps&&(this.simulationAccumulator%=this.simulationStep),o>0?this.evaluateGrid(a):this.stats.sampledPixels=0}this.stats.simulationSteps=o,this.paint();const l=typeof performance<"u"?performance.now():Date.now();return this.stats.frameMs=l-i,this.updateAdaptiveQuality(this.stats.frameMs),this.fpsAccumulator.time+=s,this.fpsAccumulator.frames+=1,this.fpsAccumulator.time>=.5&&(this.stats.fps=Math.round(this.fpsAccumulator.frames/this.fpsAccumulator.time),this.fpsAccumulator.time=0,this.fpsAccumulator.frames=0,this.emit("stats",{...this.stats})),{...this.stats}}renderOnce(e=this.clock){return this.renderFrame(e,0,!0)}inspect(){var n,r,i,s,o,a,l;const e=this.transitionDuration<=0?1:ot(this.transitionElapsed/this.transitionDuration);return{sprite:((n=this.currentRecipe)==null?void 0:n.id)||null,recipeSource:((r=this.recipeSource)==null?void 0:r.id)||null,previousSprite:((i=this.previousRecipe)==null?void 0:i.id)||null,fieldMode:this.fieldOverride?"override":"recipe",field:this.fieldOverride||((s=this.currentRecipe)==null?void 0:s.field)||null,running:this.running,visible:this.visible,destroyed:this.destroyed,reducedMotion:this.reducedMotion,transition:{active:this.isTransitionActive(),name:this.transitionName,progress:e,elapsed:this.transitionElapsed,duration:this.transitionDuration,pending:typeof((o=this.pendingSpriteTransition)==null?void 0:o.sprite)=="string"?this.pendingSpriteTransition.sprite:((l=(a=this.pendingSpriteTransition)==null?void 0:a.sprite)==null?void 0:l.id)||null},signals:Array.from(this.signals,([c,u])=>({type:c,value:u.value,age:u.age,life:u.life})),semanticSignals:Object.fromEntries(Array.from(this.semanticSignals,([c,u])=>[c,u.value])),palette:{...qp(this.currentRecipe,this.options)},orbBoundary:this.options.orbBoundary,orbBackgroundColor:this.options.orbBackgroundColor,orbBackgroundMode:this.options.orbBackgroundMode,quality:{requested:this.options.quality,effective:this.qualityTier},stats:{...this.stats}}}exportConfig(){return{package:"@joan/procedural-glyph-engine",version:"5.0.0",sprite:this.currentRecipe.id,seed:this.seed,gridSize:this.gridSize,speed:this.options.speed,density:this.options.density,contrast:this.options.contrast,fps:this.options.fps,field:this.currentRecipe.field,fieldMode:this.fieldOverride?"override":"recipe",pixelShape:this.options.pixelShape||null,pixelSwitch:this.options.pixelSwitch&&typeof this.options.pixelSwitch=="object"?{...this.options.pixelSwitch}:this.options.pixelSwitch||null,transition:this.options.transition&&typeof this.options.transition=="object"?{...this.options.transition,name:Xu(this.options.transition)}:this.options.transition||null,palette:qp(this.currentRecipe,this.options),paletteOverride:this.options.palette&&typeof this.options.palette=="object"?{...this.options.palette}:null,nonErrorPalette:this.options.nonErrorPalette&&typeof this.options.nonErrorPalette=="object"?{...this.options.nonErrorPalette}:null,orbBoundary:this.options.orbBoundary,orbBackgroundColor:this.options.orbBackgroundColor,orbBackgroundMode:this.options.orbBackgroundMode,progress:this.progress,background:this.options.background,offPixels:this.options.offPixels,interactive:this.options.interactive,autoplay:this.options.autoplay,autoResize:this.options.autoResize,dprMax:this.options.dprMax,quality:this.options.quality,reducedMotion:this.options.reducedMotion,direction:this.options.direction||null,targetGlyph:this.options.targetGlyph||null}}toSVG(e={}){const n=Math.round(lt(Number(e.size)||512,64,4096)),r=w2(this.currentRecipe,this.options),i=tv(this.options.pixelShape||Xd(this.currentRecipe,"pixelShape","disc")),s=n*.075,o=n-s*2,a=o/this.gridSize,l=a*Nd(this.currentRecipe),c=nv(this.currentRecipe,this.options.pixelSwitch).mode,u=[`<svg xmlns="http://www.w3.org/2000/svg" width="${n}" height="${n}" viewBox="0 0 ${n} ${n}" role="img" aria-label="${Dr(jc(this.currentRecipe))}">`,`<title>${Kb(jc(this.currentRecipe))}</title>`];e.background!==!1&&r.background!=="transparent"&&u.push(`<rect width="${n}" height="${n}" fill="${Dr(r.background)}"/>`);const f=Da(this.options.orbBackgroundColor,"transparent"),h=this.orbBackgroundRadius(this.currentRecipe,this.clock);if(this.options.orbBackgroundMode!=="none"&&f!=="transparent"&&h>0&&(this.options.orbBackgroundMode==="pixelated"?u.push(Ej(this.gridSize,h,s,a,f)):u.push(`<circle data-joan-layer="orb-background" data-joan-mode="solid" cx="${(n/2).toFixed(2)}" cy="${(n/2).toFixed(2)}" r="${(o*h/2).toFixed(2)}" fill="${Dr(f)}"/>`)),e.offPixels??this.options.offPixels){const p=Math.max(.16,l*.18);u.push(`<g fill="${Dr(r.off)}" opacity=".58"><g data-joan-layer="off-pixels">`);for(let g=0;g<this.values.length;g+=1){const m=g%this.gridSize,b=Math.floor(g/this.gridSize),y=s+(m+.5)*a,_=s+(b+.5)*a;u.push(`<rect x="${(y-p/2).toFixed(2)}" y="${(_-p/2).toFixed(2)}" width="${p.toFixed(2)}" height="${p.toFixed(2)}"/>`)}u.push("</g></g>")}u.push(`<g data-joan-layer="active-pixels" fill="${Dr(r.ink)}" stroke="${Dr(r.ink)}">`);for(let p=0;p<this.values.length;p+=1){const g=this.values[p];if(g<.035)continue;const m=p%this.gridSize,b=Math.floor(p/this.gridSize),y=s+(m+.5)*a,_=s+(b+.5)*a,k=.18+g*.82;let S=1,E=1;c==="axis-flip"?E=Math.max(.07,Math.sin(g*Math.PI*.5)):c==="path-draw"?S=.35+g*.65:c==="radial-cascade"&&(S=E=.55+g*.45);const M=l*k*S,O=l*k*E,P=ot(g*(.72+this.luminance[p]*.28)),x=Math.min(8,Math.floor(this.luminance[p]*8.999)),C=Ws(r.ink,r.accent,x/8,1),R=`opacity="${P.toFixed(3)}"`,N=Yb(i,this.luminance[p]),B=N==="ring"?Math.max(.12,Math.min(l*S,l*E)*.14):null,z=N==="line"?(Math.atan2(this.ys[p],this.xs[p])+Math.PI/2)*180/Math.PI:0;u.push(`<g data-joan-cell="${p}" data-joan-shape="${N}" fill="${Dr(C)}" stroke="${Dr(C)}">${Xb(N,y,_,M,O,R,"",z,B)}</g>`)}return u.push("</g></svg>"),u.join("")}async toAnimatedSVG(e={}){if(typeof document>"u")throw new Error("Animated SVG export requires a browser canvas.");const n=lt(Number(e.duration)||2.4,.5,8),r=Math.round(lt(Number(e.fps)||12,4,30)),i=Math.ceil(n*r),s=i+1,o=Math.min(this.gridSize,Math.round(lt(Number(e.maxGridSize)||48,12,64))),a=document.createElement("canvas");a.width=512,a.height=512;const l=new Rm(a,{...this.exportConfig(),sprite:this.currentRecipe,gridSize:o,autoplay:!1,autoResize:!1,interactive:!1,reducedMotion:!1,dprMax:1,quality:"low"});l.customGlyphs=new Map(this.customGlyphs),l.progress=this.progress,l.audioLevel=this.audioLevel;const c=Array.from({length:o*o},()=>new Float32Array(s)),u=Array.from({length:o*o},()=>new Float32Array(s)),f=new Float32Array(s);try{for(let x=0;x<i;x+=1){x>0&&l.renderFrame(x/r,1/r,!1),f[x]=l.orbBackgroundRadius(l.currentRecipe,x/r);for(let C=0;C<l.values.length;C+=1)c[C][x]=l.values[C],u[C][x]=l.luminance[C];x%8===7&&await new Promise(C=>setTimeout(C,0))}const h=Math.min(3,Math.max(1,Math.floor(i*.12)));for(let x=Math.max(1,i-h);x<i;x+=1){const C=Al((x-(i-h))/h);f[x]+=(f[0]-f[x])*C}f[i]=f[0];for(let x=0;x<c.length;x+=1){for(let C=Math.max(1,i-h);C<i;C+=1){const R=Al((C-(i-h))/h);c[x][C]+=(c[x][0]-c[x][C])*R,u[x][C]+=(u[x][0]-u[x][C])*R}c[x][i]=c[x][0],u[x][i]=u[x][0]}const p=Math.round(lt(Number(e.size)||512,64,2048)),g=w2(this.currentRecipe,this.options),m=p*.075,b=p-m*2,y=b/o,_=y*Nd(this.currentRecipe),k=tv(this.options.pixelShape||Xd(this.currentRecipe,"pixelShape","disc")),S=nv(this.currentRecipe,this.options.pixelSwitch).mode,E=Array.from({length:s},(x,C)=>(C/Math.max(1,s-1)).toFixed(4)).join(";"),M=[`<svg xmlns="http://www.w3.org/2000/svg" width="${p}" height="${p}" viewBox="0 0 ${p} ${p}" role="img" aria-label="${Dr(`${jc(this.currentRecipe)} animation`)}">`,`<title>${Kb(jc(this.currentRecipe))}</title>`];e.background!==!1&&g.background!=="transparent"&&M.push(`<rect width="${p}" height="${p}" fill="${Dr(g.background)}"/>`);const O=Da(this.options.orbBackgroundColor,"transparent"),P=Math.max(...f);if(this.options.orbBackgroundMode!=="none"&&O!=="transparent"&&P>0)if(this.options.orbBackgroundMode==="pixelated")M.push(Aj(o,f,m,y,O,E,n));else{const x=Array.from(f,C=>(b*C/2).toFixed(3)).join(";");M.push(`<circle data-joan-layer="orb-background" data-joan-mode="solid" cx="${(p/2).toFixed(2)}" cy="${(p/2).toFixed(2)}" r="${(b*f[0]/2).toFixed(3)}" fill="${Dr(O)}"><animate attributeName="r" values="${x}" keyTimes="${E}" dur="${n}s" calcMode="linear" repeatCount="indefinite"/></circle>`)}if(e.offPixels??this.options.offPixels){const x=Math.max(.16,_*.18);M.push(`<g data-joan-layer="off-pixels" fill="${Dr(g.off)}" opacity=".58">`);for(let C=0;C<c.length;C+=1){const R=C%o,N=Math.floor(C/o),B=m+(R+.5)*y,z=m+(N+.5)*y;M.push(`<rect x="${(B-x/2).toFixed(2)}" y="${(z-x/2).toFixed(2)}" width="${x.toFixed(2)}" height="${x.toFixed(2)}"/>`)}M.push("</g>")}M.push(`<g data-joan-layer="active-pixels" fill="${Dr(g.ink)}" stroke="${Dr(g.ink)}">`);for(let x=0;x<c.length;x+=1){const C=c[x],R=u[x];let N=0;for(let Ue=0;Ue<s;Ue+=1)N=Math.max(N,C[Ue]);if(N<.03)continue;const B=x%o,z=Math.floor(x/o),H=m+(B+.5)*y,X=m+(z+.5)*y,G=Array.from(C,(Ue,ke)=>ot(Ue*(.72+R[ke]*.28)).toFixed(3)),Z=G.join(";"),oe=[],K=Array.from(C,Ue=>{const ke=.18+ot(Ue)*.82;let ct=1,Ee=1;return S==="axis-flip"?Ee=Math.max(.07,Math.sin(ot(Ue)*Math.PI*.5)):S==="path-draw"?ct=.35+ot(Ue)*.65:S==="radial-cascade"&&(ct=Ee=.55+ot(Ue)*.45),oe.push(Math.max(.12,Math.min(_*ct,_*Ee)*.14).toFixed(3)),`${(ke*ct).toFixed(3)} ${(ke*Ee).toFixed(3)}`}).join(";"),q=K.split(";")[0].split(" "),W=Array.from(R,Ue=>Ws(g.ink,g.accent,Ue,1)),J=W.map(Ue=>Dr(Ue)).join(";"),fe=k==="line"?(Math.atan2(z+.5-o/2,B+.5-o/2)+Math.PI/2)*180/Math.PI:0,$=`<animate attributeName="opacity" values="${Z}" keyTimes="${E}" dur="${n}s" calcMode="discrete" repeatCount="indefinite"/>`,de=`<animateTransform attributeName="transform" type="scale" values="${K}" keyTimes="${E}" dur="${n}s" calcMode="discrete" repeatCount="indefinite"/>`,Be=`<animate attributeName="fill" values="${J}" keyTimes="${E}" dur="${n}s" calcMode="discrete" repeatCount="indefinite"/>`,wt=`<animate attributeName="stroke" values="${J}" keyTimes="${E}" dur="${n}s" calcMode="discrete" repeatCount="indefinite"/>`,Je=Cj(k,_,_,R,E,n,fe,oe);M.push(`<g data-joan-cell="${x}" data-joan-pixel-shape="${k}" transform="translate(${H.toFixed(2)} ${X.toFixed(2)})" fill="${Dr(W[0])}" stroke="${Dr(W[0])}" opacity="${G[0]}">${$}${Be}${wt}<g transform="scale(${q[0]} ${q[1]})">${de}${Je}</g></g>`)}return M.push("</g></svg>"),M.join("")}finally{l.destroy()}}async downloadSVG(e=`${this.currentRecipe.id.replaceAll(".","-")}.svg`,n){const r=this.toSVG(n);if(typeof document>"u")return r;const i=new Blob([r],{type:"image/svg+xml"}),s=URL.createObjectURL(i);try{const o=document.createElement("a");o.href=s,o.download=e,o.click()}finally{URL.revokeObjectURL(s)}return r}async downloadAnimatedSVG(e=`${this.currentRecipe.id.replaceAll(".","-")}.animated.svg`,n){const r=await this.toAnimatedSVG(n),i=new Blob([r],{type:"image/svg+xml"}),s=URL.createObjectURL(i);try{const o=document.createElement("a");o.href=s,o.download=e,o.click()}finally{URL.revokeObjectURL(s)}return r}toDataURL(e="image/png",n){return this.canvas.toDataURL(e,n)}toBlob(e="image/png",n){return new Promise((r,i)=>{var s,o;(o=(s=this.canvas).toBlob)==null||o.call(s,a=>a?r(a):i(new Error("Canvas export failed.")),e,n)})}async downloadPNG(e=`${this.currentRecipe.id.replaceAll(".","-")}.png`){if(typeof document>"u")return this.toBlob();const n=await this.toBlob(),r=URL.createObjectURL(n);try{const i=document.createElement("a");i.href=r,i.download=e,i.click()}finally{URL.revokeObjectURL(r)}return n}destroy(){var e,n;if(!this.destroyed){this.pause(),this.cancelReducedCrossfade(),this.destroyed=!0;for(const r of this.listeners.splice(0))r();for(const r of this.interactionListeners.splice(0))r();(e=this.resizeObserver)==null||e.disconnect(),(n=this.intersectionObserver)==null||n.disconnect(),this.customGlyphs.clear(),this.impulses.length=0,this.emit("destroy",{})}}};we(Rm,"sprites",Py);let Zb=Rm;function Ij(t,e={}){const n=typeof t=="string"?typeof document<"u"?document.querySelector(t):null:t;if(!n)throw new TypeError(`No canvas matched "${String(t)}".`);return new Zb(n,e)}var zj=ne('<canvas width="96" height="96" class="glyph svelte-140vcel" aria-hidden="true"></canvas>');function Lj(t,e){Tt(e,!0);let n=te(e,"seed",3,"oikos"),r=te(e,"size",3,96),i=te(e,"opacity",3,1),s=Se(null),o=Se(null);function a(c){return{background:"transparent",off:c==="dark"?"#1a1a1a":"#e6dcc0",ink:c==="dark"?"#efe5c0":"#000000",accent:c==="dark"?"#a89984":"#3a3a3a",glow:"transparent"}}os(()=>{const c=Ij(d(s),{sprite:e.sprite,seed:n(),gridSize:96,palette:a(qu()),background:!1,orbBackgroundColor:"transparent",orbBackgroundMode:"none"});I(o,c,!0);const u=new MutationObserver(()=>{c.configure({palette:a(qu())})});return u.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>u.disconnect()}),Kh(()=>{var c;(c=d(o))==null||c.destroy()}),Qt(()=>{d(o)&&e.sprite&&d(o).transitionTo(e.sprite)});var l=zj();kr(l,c=>I(s,c),()=>d(s)),De(()=>Ks(l,`max-width:${r()??""}px;opacity:${i()??""}`)),A(t,l),Et()}var Dj=ne('<div class="grid w-full max-w-md grid-cols-1 gap-2 sm:grid-cols-2 svelte-unk70i"></div>'),Fj=ne('<div class="flex flex-1 flex-col items-center justify-center gap-6 p-8 text-center svelte-unk70i"><div class="svelte-unk70i"><h2 class="text-xl font-semibold svelte-unk70i">Nomos</h2> <p class="mt-1 text-sm text-muted-foreground svelte-unk70i">Your resident operator. Ask about the fleet, or tell it to act.</p></div> <!></div>'),x2=ne('<div class="msg-time svelte-unk70i"> </div>'),Bj=ne('<div class="queued-hint svelte-unk70i">Queued — runs when Nomos finishes the current step.</div>'),jj=ne('<div class="user-text whitespace-pre-wrap text-sm leading-relaxed svelte-unk70i"> </div> <!> <!>',1),Uj=ne('<span class="stream-cursor svelte-unk70i" aria-hidden="true"></span>'),Wj=ne('<div class="markdown-body prose-chat max-w-none text-sm leading-relaxed svelte-unk70i"><!> <!></div> <!>',1),qj=ne("<!> <!> <!>",1),Hj=ne('<div class="msg-row relative flex gap-3 py-3 svelte-unk70i"><div class="msg-role svelte-unk70i" aria-hidden="true"> </div> <div class="msg-body min-w-0 flex-1 svelte-unk70i"><!></div> <button class="msg-action svelte-unk70i" title="Copy message" aria-label="Copy message"><!></button></div>'),Vj=ne('<div class="py-3 svelte-unk70i"><!></div>'),$j=ne('<button class="jump-bottom svelte-unk70i" aria-label="Jump to latest"><!></button>'),Gj=ne(`<div class="mx-auto w-full max-w-3xl px-4 svelte-unk70i"><div class="mb-2 flex items-center gap-2 rounded-md border border-warning/50 bg-warning/10 px-3 py-2 text-xs svelte-unk70i"><!> <span class="text-warning-foreground flex-1 svelte-unk70i">Connection dropped — the task is still running and will catch up here automatically.
Reconnect to refresh now.</span> <!></div></div>`),Yj=ne('<div class="mx-auto w-full max-w-3xl px-4 svelte-unk70i"><div class="mb-2 flex items-center gap-2 rounded-md border bg-muted/50 px-3 py-2 text-xs svelte-unk70i"><!> <span class="text-muted-foreground flex-1 svelte-unk70i">Reconnecting to agent…</span></div></div>'),Kj=ne('<div class="mx-auto w-full max-w-3xl px-4 svelte-unk70i"><div class="mb-2 rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2 text-xs text-destructive svelte-unk70i"> </div></div>'),Xj=ne('<div class="mx-auto w-full max-w-3xl px-4 svelte-unk70i"><div class="mb-2 flex items-center gap-2 rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-xs text-destructive svelte-unk70i"><span class="flex-1 svelte-unk70i"> </span> <!> <button class="ml-1 text-muted-foreground hover:text-foreground svelte-unk70i" aria-label="Dismiss">×</button> ></div></div>'),Zj=ne('<div class="composer-status composer-status-stuck mb-2 svelte-unk70i"><span class="composer-status-label stuck-label svelte-unk70i">Stuck</span> <span class="composer-status-text svelte-unk70i"> </span> <!></div>'),Qj=ne('<div class="composer-status mb-2 svelte-unk70i"><!> <span class="composer-status-label svelte-unk70i">Working</span> <span class="composer-status-text svelte-unk70i"> </span></div>'),Jj=ne('<div class="mx-auto w-full max-w-3xl px-4 svelte-unk70i"><!></div>'),eU=ne('<div class="relative min-h-0 flex-1 svelte-unk70i"><div class="glyph-backdrop svelte-unk70i" aria-hidden="true"><!></div> <div class="relative z-[1] h-full overflow-y-auto svelte-unk70i"><div class="mx-auto flex min-h-full max-w-3xl flex-col divide-y divide-border px-4 svelte-unk70i"><!> <!> <!></div></div> <!></div> <!> <!> <!> <!>',1),tU=ne('<div class="flex h-full min-h-0 flex-col border-t bg-background p-3 input-ornament relative svelte-unk70i"><form class="relative mx-auto flex h-full w-full max-w-3xl svelte-unk70i"><!> <!></form></div>'),nU=ne("<!> <!>",1),rU=ne('<div class="flex h-full min-h-0 min-w-0 flex-col svelte-unk70i"><!></div>');function H5(t,e){Tt(e,!0);const n=()=>zn(c(),"$activityLogProp",r),[r,i]=ro();let s=te(e,"working",3,!1),o=te(e,"error",3,null),a=te(e,"chatErrors",19,()=>[]),l=te(e,"suggestions",19,()=>[]),c=te(e,"activityLog",3,P9),u=te(e,"sessionId",3,null),f=te(e,"question",3,null),h=te(e,"initialDraft",3,""),p=te(e,"planSteps",19,()=>[]),g=Se(gn(typeof h()=="string"?h():"")),m=Se(!1),b=Se(null),y=Se(!1),_=Se(!1);Qt(()=>{if(s()&&(I(y,!1),I(_,!0)),!s()&&d(_)){I(y,!0);const ke=setTimeout(()=>{I(y,!1),I(_,!1)},3e3);return()=>clearTimeout(ke)}});const k=V(()=>{if(o())return o();if(!s()&&d(y))return"Done";const ke=n().find(Ee=>Ee.type==="step_running");if(ke)return ke.description;const ct=n().find(Ee=>Ee.type==="tool_running");return ct?ct.description:"Agent is thinking…"});let S=Se(!1),E=Se(gn(Date.now()));Qt(()=>{if(!s())return;const ke=setInterval(()=>{I(E,Date.now(),!0)},1e3);return()=>clearInterval(ke)});const M=V(()=>s()&&e.lastActiveAt?Math.max(0,Math.floor((d(E)-new Date(e.lastActiveAt).getTime())/1e3)):0),O=V(()=>s()&&!e.streaming&&d(M)>300);function P(ke){return ke<60?`${ke}s`:ke<3600?`${Math.floor(ke/60)}m`:`${Math.floor(ke/3600)}h ${Math.floor(ke%3600/60)}m`}async function x(){if(!(!u()||d(S))){I(S,!0);try{await kI(u())}finally{I(S,!1)}}}const C=V(()=>e.connectionState!=="connected"?"status.offline":e.taskStatus==="failed"?"status.error":e.taskStatus==="abandoned"?"status.cancelled":e.taskStatus==="done"?"status.success":e.taskStatus==="awaiting_input"?"ai.listening":d(O)?"status.warning":e.streaming?"ai.speaking":s()?"ai.still-working":e.taskStatus==="planning"?"ai.thinking":"ai.idle");let R=Se(0),N=Se(null),B=Se(null),z=Se(64);Qt(()=>{if(!d(N)||!d(B))return;const ke=getComputedStyle(d(N)),ct=parseFloat(ke.lineHeight);if(!Number.isFinite(ct))return;const Ee=parseFloat(ke.paddingTop)+parseFloat(ke.paddingBottom)+parseFloat(ke.borderTopWidth)+parseFloat(ke.borderBottomWidth),Ve=getComputedStyle(d(B)),be=parseFloat(Ve.paddingTop)+parseFloat(Ve.paddingBottom)+parseFloat(Ve.borderTopWidth)+parseFloat(Ve.borderBottomWidth);I(z,ct+Ee+be)});const H=V(()=>d(R)>0?d(z)/d(R)*100:12);let X=Se(12),G=!1;Qt(()=>{G||I(X,d(H),!0)});function Z(){if(!d(b))return!0;const{scrollTop:ke,scrollHeight:ct,clientHeight:Ee}=d(b);return ct-ke-Ee<80}function oe(){I(m,!Z())}Qt(()=>{if(e.messages,f(),e.streaming||!d(m)){const ke=e.streaming?"auto":"smooth";requestAnimationFrame(()=>{var ct;(ct=d(b))==null||ct.scrollTo({top:d(b).scrollHeight,behavior:ke})})}});function K(ke){const ct=new Wn.Renderer;return ct.code=function({text:Ee,lang:Ve}){const be=Ee.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return`<div class="code-block-wrapper relative group"><pre><code class="language-${Ve||"plaintext"}">${be}</code></pre><button class="code-copy-btn" onclick="navigator.clipboard.writeText(this.parentElement.querySelector('pre code').textContent)" title="Copy" aria-label="Copy code"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg></button></div>`},ct.table=function(Ee){const Ve=Ee.header.map(xt=>`<th>${xt.text}</th>`).join(""),be=Ee.rows.map(xt=>`<tr>${xt.map(_t=>`<td>${_t.text}</td>`).join("")}</tr>`).join("");return`<div class="table-wrapper"><table><thead><tr>${Ve}</tr></thead><tbody>${be}</tbody></table></div>`},HT.sanitize(Wn.parse(ke,{async:!1,renderer:ct}))}function q(ke){try{return new Date(ke).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}function W(){const ke=d(g).trim();!ke||e.streaming||(I(g,""),I(m,!1),e.onSend(ke))}function J(ke){ke.key==="Enter"&&!ke.shiftKey&&(ke.preventDefault(),W())}function fe(ke){e.streaming||e.onSend(ke)}let $=Se(null);async function de(ke){try{await navigator.clipboard.writeText(ke.text),I($,ke.id,!0),setTimeout(()=>{d($)===ke.id&&I($,null)},1400)}catch{}}function Be(){var ke;(ke=d(b))==null||ke.scrollTo({top:d(b).scrollHeight,behavior:"smooth"}),I(m,!1)}function wt(ke,ct){const Ee=new Map;for(const Ve of ct){if(!Ve.id)continue;const be=Ee.get(Ve.id)??{};Ve.liveOutput&&(be.liveOutput=Ve.liveOutput),Ve.stepSeq!=null&&(be.stepSeq=Ve.stepSeq),Ee.set(Ve.id,be)}return Ee.size===0?ke:ke.map(Ve=>{if(!Ve.id)return Ve;const be=Ee.get(Ve.id);if(!be)return Ve;const xt={...Ve};return be.liveOutput&&(xt.liveOutput=be.liveOutput),be.stepSeq!=null&&(xt.stepSeq=be.stepSeq),xt})}var Je=rU(),Ue=j(Je);t5(Ue,{horizontal:!0,theme:"oikos-theme",dblClickSplitter:!1,class:"min-h-0 flex-1",$$events:{resize:()=>G=!0},children:(ke,ct)=>{var Ee=nU(),Ve=Me(Ee);Kg(Ve,{class:"flex flex-col",children:(xt,_t)=>{var Yt=eU(),en=Me(Yt),tn=j(en),Qn=j(tn);{let ae=V(()=>u()??"oikos");Lj(Qn,{get sprite(){return d(C)},get seed(){return d(ae)},size:640,opacity:.07})}var se=ee(tn,2),_e=j(se),me=j(_e);{var ve=ae=>{var he=Fj(),le=ee(j(he),2);{var Pe=Oe=>{var Re=Dj();Rn(Re,21,l,$s,(Ce,He)=>{Rr(Ce,{variant:"outline",size:"sm",class:"h-auto justify-start whitespace-normal py-2 text-left text-xs",onclick:()=>fe(d(He)),children:(Ge,Ft)=>{var jt=er();De(()=>je(jt,d(He))),A(Ge,jt)},$$slots:{default:!0}})}),A(Oe,Re)};xe(le,Oe=>{l().length&&Oe(Pe)})}A(ae,he)};xe(me,ae=>{e.messages.length===0&&ae(ve)})}var Xe=ee(me,2);Rn(Xe,19,()=>e.messages,ae=>ae.id,(ae,he,le)=>{const Pe=V(()=>d(le)===e.messages.length-1);var Oe=Hj(),Re=j(Oe),Ce=j(Re),He=ee(Re,2),Ge=j(He);{var Ft=L=>{var ie=jj(),Te=Me(ie),ft=j(Te),rn=ee(Te,2);{var yn=bt=>{var pe=x2(),Ze=j(pe);De(We=>je(Ze,We),[()=>q(d(he).created_at)]),A(bt,pe)};xe(rn,bt=>{d(he).created_at&&bt(yn)})}var Ut=ee(rn,2);{var Jt=bt=>{var pe=Bj();A(bt,pe)};xe(Ut,bt=>{d(Pe)&&s()&&!e.streaming&&bt(Jt)})}De(()=>je(ft,d(he).text)),A(L,ie)},jt=L=>{const ie=V(()=>d(Pe)?o()?"error":s()?"running":d(y)?"done":"idle":"idle");var Te=qj(),ft=Me(Te);{var rn=pe=>{{let Ze=V(()=>wt(d(he).tools,n())),We=V(()=>d(ie)==="idle"?null:d(k)),mt=V(()=>d(Pe)?p():[]);eB(pe,{get tools(){return d(Ze)},get status(){return d(ie)},get label(){return d(We)},get isLast(){return d(Pe)},get planSteps(){return d(mt)},get taskStatus(){return e.taskStatus}})}};xe(ft,pe=>{(d(he).tools.length>0||d(ie)!=="idle")&&pe(rn)})}var yn=ee(ft,2);{var Ut=pe=>{rB(pe,{get thinking(){return d(he).thinking}})};xe(yn,pe=>{d(he).thinking&&pe(Ut)})}var Jt=ee(yn,2);{var bt=pe=>{var Ze=Wj(),We=Me(Ze),mt=j(We);BS(mt,()=>K(d(he).text));var rt=ee(mt,2);{var $e=vt=>{var Pt=Uj();A(vt,Pt)};xe(rt,vt=>{d(Pe)&&e.streaming&&vt($e)})}var Bt=ee(We,2);{var At=vt=>{var Pt=x2(),Kt=j(Pt);De(Mt=>je(Kt,Mt),[()=>q(d(he).created_at)]),A(vt,Pt)};xe(Bt,vt=>{d(he).created_at&&vt(At)})}A(pe,Ze)};xe(Jt,pe=>{d(he).text&&pe(bt)})}A(L,Te)};xe(Ge,L=>{d(he).role==="user"?L(Ft):L(jt,-1)})}var nt=ee(He,2),tt=j(nt);{var Vt=L=>{zg(L,{class:"size-3.5"})},In=L=>{I4(L,{class:"size-3.5"})};xe(tt,L=>{d($)===d(he).id?L(Vt):L(In,-1)})}De(()=>je(Ce,d(he).role==="user"?"YOU":"NOMOS")),Ln("click",nt,()=>de(d(he))),A(ae,Oe)});var et=ee(Xe,2);{var dt=ae=>{var he=Vj(),le=j(he);cB(le,{get sessionId(){return u()},get question(){return f()}}),A(ae,he)};xe(et,ae=>{f()&&ae(dt)})}kr(se,ae=>I(b,ae),()=>d(b));var ge=ee(se,2);{var Ae=ae=>{var he=$j(),le=j(he);b4(le,{class:"size-4"}),Ln("click",he,Be),A(ae,he)};xe(ge,ae=>{d(m)&&e.messages.length>0&&ae(Ae)})}var Ie=ee(en,2);{var pt=ae=>{var he=Gj(),le=j(he),Pe=j(le);_x(Pe,{class:"size-3 shrink-0 animate-spin text-warning","aria-hidden":"true"});var Oe=ee(Pe,4);Rr(Oe,{size:"xs",variant:"outline",class:"h-6 text-[11px]",get onclick(){return e.onReconnect},children:(Re,Ce)=>{var He=er("Reconnect");A(Re,He)},$$slots:{default:!0}}),A(ae,he)},Le=ae=>{var he=Yj(),le=j(he),Pe=j(le);_x(Pe,{class:"size-3 shrink-0 animate-spin text-muted-foreground","aria-hidden":"true"}),A(ae,he)};xe(Ie,ae=>{e.connectionState==="disconnected"?ae(pt):e.connectionState==="reconnecting"&&ae(Le,1)})}var gt=ee(Ie,2);{var nn=ae=>{var he=Kj(),le=j(he),Pe=j(le);De(()=>je(Pe,o())),A(ae,he)};xe(gt,ae=>{o()&&ae(nn)})}var St=ee(gt,2);Rn(St,17,a,ae=>ae.id,(ae,he)=>{var le=Xj(),Pe=j(le),Oe=j(Pe),Re=j(Oe),Ce=ee(Oe,2);{var He=Ft=>{Rr(Ft,{size:"xs",variant:"ghost",class:"h-6 text-[11px]",onclick:()=>e.onDismissError(d(he).id),children:(jt,nt)=>{var tt=er();De(()=>je(tt,d(he).action)),A(jt,tt)},$$slots:{default:!0}})};xe(Ce,Ft=>{d(he).action&&Ft(He)})}var Ge=ee(Ce,2);De(()=>je(Re,d(he).message)),Ln("click",Ge,()=>e.onDismissError(d(he).id)),A(ae,le)});var Rt=ee(St,2);{var re=ae=>{var he=Jj(),le=j(he);{var Pe=Re=>{var Ce=Zj(),He=ee(j(Ce),2),Ge=j(He),Ft=ee(He,2);Rr(Ft,{size:"xs",variant:"outline",class:"h-6 text-[11px]",onclick:x,get disabled(){return d(S)},children:(jt,nt)=>{var tt=er();De(()=>je(tt,d(S)?"Resuming…":"Resume")),A(jt,tt)},$$slots:{default:!0}}),De(jt=>je(Ge,`no activity for ${jt??""}`),[()=>P(d(M))]),A(Re,Ce)},Oe=Re=>{var Ce=Qj(),He=j(Ce);Xg(He,{class:"size-3 shrink-0 text-primary"});var Ge=ee(He,4),Ft=j(Ge);De(jt=>je(Ft,jt),[()=>P(d(M))]),A(Re,Ce)};xe(le,Re=>{d(O)?Re(Pe):Re(Oe,-1)})}A(ae,he)};xe(Rt,ae=>{s()&&!e.streaming&&ae(re)})}Mi("scroll",se,oe),A(xt,Yt)},$$slots:{default:!0}});var be=ee(Ve,2);Kg(be,{get minSize(){return d(H)},maxSize:45,class:"flex flex-col",get size(){return d(X)},set size(xt){I(X,xt,!0)},children:(xt,_t)=>{var Yt=tU(),en=j(Yt),tn=j(en);ty(tn,{onkeydown:J,placeholder:"Ask Nomos anything…",class:"h-full max-h-none min-h-0 resize-none px-4 py-3 pr-12 field-sizing-fixed",get disabled(){return e.streaming},get ref(){return d(N)},set ref(me){I(N,me,!0)},get value(){return d(g)},set value(me){I(g,me,!0)}});var Qn=ee(tn,2);{var se=me=>{Rr(me,{type:"button",size:"icon-sm",variant:"secondary",class:"absolute right-2 bottom-2",get onclick(){return e.onCancel},"aria-label":"Stop",children:(ve,Xe)=>{NN(ve,{class:"size-3.5"})},$$slots:{default:!0}})},_e=me=>{{let ve=V(()=>!d(g).trim());Rr(me,{type:"submit",size:"icon-sm",variant:"secondary",class:"absolute right-2 bottom-2",get disabled(){return d(ve)},"aria-label":"Send",children:(Xe,et)=>{L4(Xe,{class:"size-3.5"})},$$slots:{default:!0}})}};xe(Qn,me=>{e.streaming?me(se):me(_e,-1)})}kr(Yt,me=>I(B,me),()=>d(B)),Mi("submit",en,me=>{me.preventDefault(),W()}),A(xt,Yt)},$$slots:{default:!0}}),A(ke,Ee)},$$slots:{default:!0}}),s3(Je,"clientHeight",ke=>I(R,ke)),A(t,Je),Et(),i()}Fo(["click"]);function _2(t,e){var n,r=1;t==null&&(t=0),e==null&&(e=0);function i(){var s,o=n.length,a,l=0,c=0;for(s=0;s<o;++s)a=n[s],l+=a.x,c+=a.y;for(l=(l/o-t)*r,c=(c/o-e)*r,s=0;s<o;++s)a=n[s],a.x-=l,a.y-=c}return i.initialize=function(s){n=s},i.x=function(s){return arguments.length?(t=+s,i):t},i.y=function(s){return arguments.length?(e=+s,i):e},i.strength=function(s){return arguments.length?(r=+s,i):r},i}function iU(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return V5(this.cover(e,n),e,n,t)}function V5(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,s=t._root,o={data:r},a=t._x0,l=t._y0,c=t._x1,u=t._y1,f,h,p,g,m,b,y,_;if(!s)return t._root=o,t;for(;s.length;)if((m=e>=(f=(a+c)/2))?a=f:c=f,(b=n>=(h=(l+u)/2))?l=h:u=h,i=s,!(s=s[y=b<<1|m]))return i[y]=o,t;if(p=+t._x.call(null,s.data),g=+t._y.call(null,s.data),e===p&&n===g)return o.next=s,i?i[y]=o:t._root=o,t;do i=i?i[y]=new Array(4):t._root=new Array(4),(m=e>=(f=(a+c)/2))?a=f:c=f,(b=n>=(h=(l+u)/2))?l=h:u=h;while((y=b<<1|m)===(_=(g>=h)<<1|p>=f));return i[_]=s,i[y]=o,t}function sU(t){var e,n,r=t.length,i,s,o=new Array(r),a=new Array(r),l=1/0,c=1/0,u=-1/0,f=-1/0;for(n=0;n<r;++n)isNaN(i=+this._x.call(null,e=t[n]))||isNaN(s=+this._y.call(null,e))||(o[n]=i,a[n]=s,i<l&&(l=i),i>u&&(u=i),s<c&&(c=s),s>f&&(f=s));if(l>u||c>f)return this;for(this.cover(l,c).cover(u,f),n=0;n<r;++n)V5(this,o[n],a[n],t[n]);return this}function oU(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,i=this._x1,s=this._y1;if(isNaN(n))i=(n=Math.floor(t))+1,s=(r=Math.floor(e))+1;else{for(var o=i-n||1,a=this._root,l,c;n>t||t>=i||r>e||e>=s;)switch(c=(e<r)<<1|t<n,l=new Array(4),l[c]=a,a=l,o*=2,c){case 0:i=n+o,s=r+o;break;case 1:n=i-o,s=r+o;break;case 2:i=n+o,r=s-o;break;case 3:n=i-o,r=s-o;break}this._root&&this._root.length&&(this._root=a)}return this._x0=n,this._y0=r,this._x1=i,this._y1=s,this}function aU(){var t=[];return this.visit(function(e){if(!e.length)do t.push(e.data);while(e=e.next)}),t}function lU(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function Ti(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function cU(t,e,n){var r,i=this._x0,s=this._y0,o,a,l,c,u=this._x1,f=this._y1,h=[],p=this._root,g,m;for(p&&h.push(new Ti(p,i,s,u,f)),n==null?n=1/0:(i=t-n,s=e-n,u=t+n,f=e+n,n*=n);g=h.pop();)if(!(!(p=g.node)||(o=g.x0)>u||(a=g.y0)>f||(l=g.x1)<i||(c=g.y1)<s))if(p.length){var b=(o+l)/2,y=(a+c)/2;h.push(new Ti(p[3],b,y,l,c),new Ti(p[2],o,y,b,c),new Ti(p[1],b,a,l,y),new Ti(p[0],o,a,b,y)),(m=(e>=y)<<1|t>=b)&&(g=h[h.length-1],h[h.length-1]=h[h.length-1-m],h[h.length-1-m]=g)}else{var _=t-+this._x.call(null,p.data),k=e-+this._y.call(null,p.data),S=_*_+k*k;if(S<n){var E=Math.sqrt(n=S);i=t-E,s=e-E,u=t+E,f=e+E,r=p.data}}return r}function uU(t){if(isNaN(u=+this._x.call(null,t))||isNaN(f=+this._y.call(null,t)))return this;var e,n=this._root,r,i,s,o=this._x0,a=this._y0,l=this._x1,c=this._y1,u,f,h,p,g,m,b,y;if(!n)return this;if(n.length)for(;;){if((g=u>=(h=(o+l)/2))?o=h:l=h,(m=f>=(p=(a+c)/2))?a=p:c=p,e=n,!(n=n[b=m<<1|g]))return this;if(!n.length)break;(e[b+1&3]||e[b+2&3]||e[b+3&3])&&(r=e,y=b)}for(;n.data!==t;)if(i=n,!(n=n.next))return this;return(s=n.next)&&delete n.next,i?(s?i.next=s:delete i.next,this):e?(s?e[b]=s:delete e[b],(n=e[0]||e[1]||e[2]||e[3])&&n===(e[3]||e[2]||e[1]||e[0])&&!n.length&&(r?r[y]=n:this._root=n),this):(this._root=s,this)}function dU(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this}function fU(){return this._root}function hU(){var t=0;return this.visit(function(e){if(!e.length)do++t;while(e=e.next)}),t}function pU(t){var e=[],n,r=this._root,i,s,o,a,l;for(r&&e.push(new Ti(r,this._x0,this._y0,this._x1,this._y1));n=e.pop();)if(!t(r=n.node,s=n.x0,o=n.y0,a=n.x1,l=n.y1)&&r.length){var c=(s+a)/2,u=(o+l)/2;(i=r[3])&&e.push(new Ti(i,c,u,a,l)),(i=r[2])&&e.push(new Ti(i,s,u,c,l)),(i=r[1])&&e.push(new Ti(i,c,o,a,u)),(i=r[0])&&e.push(new Ti(i,s,o,c,u))}return this}function gU(t){var e=[],n=[],r;for(this._root&&e.push(new Ti(this._root,this._x0,this._y0,this._x1,this._y1));r=e.pop();){var i=r.node;if(i.length){var s,o=r.x0,a=r.y0,l=r.x1,c=r.y1,u=(o+l)/2,f=(a+c)/2;(s=i[0])&&e.push(new Ti(s,o,a,u,f)),(s=i[1])&&e.push(new Ti(s,u,a,l,f)),(s=i[2])&&e.push(new Ti(s,o,f,u,c)),(s=i[3])&&e.push(new Ti(s,u,f,l,c))}n.push(r)}for(;r=n.pop();)t(r.node,r.x0,r.y0,r.x1,r.y1);return this}function mU(t){return t[0]}function vU(t){return arguments.length?(this._x=t,this):this._x}function bU(t){return t[1]}function yU(t){return arguments.length?(this._y=t,this):this._y}function Ry(t,e,n){var r=new Ny(e??mU,n??bU,NaN,NaN,NaN,NaN);return t==null?r:r.addAll(t)}function Ny(t,e,n,r,i,s){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=s,this._root=void 0}function S2(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var Oi=Ry.prototype=Ny.prototype;Oi.copy=function(){var t=new Ny(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,n,r;if(!e)return t;if(!e.length)return t._root=S2(e),t;for(n=[{source:e,target:t._root=new Array(4)}];e=n.pop();)for(var i=0;i<4;++i)(r=e.source[i])&&(r.length?n.push({source:r,target:e.target[i]=new Array(4)}):e.target[i]=S2(r));return t};Oi.add=iU;Oi.addAll=sU;Oi.cover=oU;Oi.data=aU;Oi.extent=lU;Oi.find=cU;Oi.remove=uU;Oi.removeAll=dU;Oi.root=fU;Oi.size=hU;Oi.visit=pU;Oi.visitAfter=gU;Oi.x=vU;Oi.y=yU;function Ai(t){return function(){return t}}function el(t){return(t()-.5)*1e-6}function wU(t){return t.x+t.vx}function xU(t){return t.y+t.vy}function _U(t){var e,n,r,i=1,s=1;typeof t!="function"&&(t=Ai(t==null?1:+t));function o(){for(var c,u=e.length,f,h,p,g,m,b,y=0;y<s;++y)for(f=Ry(e,wU,xU).visitAfter(a),c=0;c<u;++c)h=e[c],m=n[h.index],b=m*m,p=h.x+h.vx,g=h.y+h.vy,f.visit(_);function _(k,S,E,M,O){var P=k.data,x=k.r,C=m+x;if(P){if(P.index>h.index){var R=p-P.x-P.vx,N=g-P.y-P.vy,B=R*R+N*N;B<C*C&&(R===0&&(R=el(r),B+=R*R),N===0&&(N=el(r),B+=N*N),B=(C-(B=Math.sqrt(B)))/B*i,h.vx+=(R*=B)*(C=(x*=x)/(b+x)),h.vy+=(N*=B)*C,P.vx-=R*(C=1-C),P.vy-=N*C)}return}return S>p+C||M<p-C||E>g+C||O<g-C}}function a(c){if(c.data)return c.r=n[c.data.index];for(var u=c.r=0;u<4;++u)c[u]&&c[u].r>c.r&&(c.r=c[u].r)}function l(){if(e){var c,u=e.length,f;for(n=new Array(u),c=0;c<u;++c)f=e[c],n[f.index]=+t(f,c,e)}}return o.initialize=function(c,u){e=c,r=u,l()},o.iterations=function(c){return arguments.length?(s=+c,o):s},o.strength=function(c){return arguments.length?(i=+c,o):i},o.radius=function(c){return arguments.length?(t=typeof c=="function"?c:Ai(+c),l(),o):t},o}function SU(t){return t.index}function k2(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}function kU(t){var e=SU,n=f,r,i=Ai(30),s,o,a,l,c,u=1;t==null&&(t=[]);function f(b){return 1/Math.min(a[b.source.index],a[b.target.index])}function h(b){for(var y=0,_=t.length;y<u;++y)for(var k=0,S,E,M,O,P,x,C;k<_;++k)S=t[k],E=S.source,M=S.target,O=M.x+M.vx-E.x-E.vx||el(c),P=M.y+M.vy-E.y-E.vy||el(c),x=Math.sqrt(O*O+P*P),x=(x-s[k])/x*b*r[k],O*=x,P*=x,M.vx-=O*(C=l[k]),M.vy-=P*C,E.vx+=O*(C=1-C),E.vy+=P*C}function p(){if(o){var b,y=o.length,_=t.length,k=new Map(o.map((E,M)=>[e(E,M,o),E])),S;for(b=0,a=new Array(y);b<_;++b)S=t[b],S.index=b,typeof S.source!="object"&&(S.source=k2(k,S.source)),typeof S.target!="object"&&(S.target=k2(k,S.target)),a[S.source.index]=(a[S.source.index]||0)+1,a[S.target.index]=(a[S.target.index]||0)+1;for(b=0,l=new Array(_);b<_;++b)S=t[b],l[b]=a[S.source.index]/(a[S.source.index]+a[S.target.index]);r=new Array(_),g(),s=new Array(_),m()}}function g(){if(o)for(var b=0,y=t.length;b<y;++b)r[b]=+n(t[b],b,t)}function m(){if(o)for(var b=0,y=t.length;b<y;++b)s[b]=+i(t[b],b,t)}return h.initialize=function(b,y){o=b,c=y,p()},h.links=function(b){return arguments.length?(t=b,p(),h):t},h.id=function(b){return arguments.length?(e=b,h):e},h.iterations=function(b){return arguments.length?(u=+b,h):u},h.strength=function(b){return arguments.length?(n=typeof b=="function"?b:Ai(+b),g(),h):n},h.distance=function(b){return arguments.length?(i=typeof b=="function"?b:Ai(+b),m(),h):i},h}var MU={value:()=>{}};function $5(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new dg(n)}function dg(t){this._=t}function TU(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}dg.prototype=$5.prototype={constructor:dg,on:function(t,e){var n=this._,r=TU(t+"",n),i,s=-1,o=r.length;if(arguments.length<2){for(;++s<o;)if((i=(t=r[s]).type)&&(i=EU(n[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<o;)if(i=(t=r[s]).type)n[i]=M2(n[i],t.name,e);else if(e==null)for(i in n)n[i]=M2(n[i],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new dg(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,s;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=this._[t],r=0,i=s.length;r<i;++r)s[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,s=r.length;i<s;++i)r[i].value.apply(e,n)}};function EU(t,e){for(var n=0,r=t.length,i;n<r;++n)if((i=t[n]).name===e)return i.value}function M2(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=MU,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var Zu=0,Zd=0,Id=0,G5=1e3,em,Qd,tm=0,lc=0,c0=0,wf=typeof performance=="object"&&performance.now?performance:Date,Y5=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function K5(){return lc||(Y5(AU),lc=wf.now()+c0)}function AU(){lc=0}function Qb(){this._call=this._time=this._next=null}Qb.prototype=X5.prototype={constructor:Qb,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?K5():+n)+(e==null?0:+e),!this._next&&Qd!==this&&(Qd?Qd._next=this:em=this,Qd=this),this._call=t,this._time=n,Jb()},stop:function(){this._call&&(this._call=null,this._time=1/0,Jb())}};function X5(t,e,n){var r=new Qb;return r.restart(t,e,n),r}function PU(){K5(),++Zu;for(var t=em,e;t;)(e=lc-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Zu}function T2(){lc=(tm=wf.now())+c0,Zu=Zd=0;try{PU()}finally{Zu=0,OU(),lc=0}}function CU(){var t=wf.now(),e=t-tm;e>G5&&(c0-=e,tm=t)}function OU(){for(var t,e=em,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:em=n);Qd=t,Jb(r)}function Jb(t){if(!Zu){Zd&&(Zd=clearTimeout(Zd));var e=t-lc;e>24?(t<1/0&&(Zd=setTimeout(T2,t-wf.now()-c0)),Id&&(Id=clearInterval(Id))):(Id||(tm=wf.now(),Id=setInterval(CU,G5)),Zu=1,Y5(T2))}}const RU=1664525,NU=1013904223,E2=4294967296;function IU(){let t=1;return()=>(t=(RU*t+NU)%E2)/E2}function zU(t){return t.x}function LU(t){return t.y}var DU=10,FU=Math.PI*(3-Math.sqrt(5));function BU(t){var e,n=1,r=.001,i=1-Math.pow(r,1/300),s=0,o=.6,a=new Map,l=X5(f),c=$5("tick","end"),u=IU();t==null&&(t=[]);function f(){h(),c.call("tick",e),n<r&&(l.stop(),c.call("end",e))}function h(m){var b,y=t.length,_;m===void 0&&(m=1);for(var k=0;k<m;++k)for(n+=(s-n)*i,a.forEach(function(S){S(n)}),b=0;b<y;++b)_=t[b],_.fx==null?_.x+=_.vx*=o:(_.x=_.fx,_.vx=0),_.fy==null?_.y+=_.vy*=o:(_.y=_.fy,_.vy=0);return e}function p(){for(var m=0,b=t.length,y;m<b;++m){if(y=t[m],y.index=m,y.fx!=null&&(y.x=y.fx),y.fy!=null&&(y.y=y.fy),isNaN(y.x)||isNaN(y.y)){var _=DU*Math.sqrt(.5+m),k=m*FU;y.x=_*Math.cos(k),y.y=_*Math.sin(k)}(isNaN(y.vx)||isNaN(y.vy))&&(y.vx=y.vy=0)}}function g(m){return m.initialize&&m.initialize(t,u),m}return p(),e={tick:h,restart:function(){return l.restart(f),e},stop:function(){return l.stop(),e},nodes:function(m){return arguments.length?(t=m,p(),a.forEach(g),e):t},alpha:function(m){return arguments.length?(n=+m,e):n},alphaMin:function(m){return arguments.length?(r=+m,e):r},alphaDecay:function(m){return arguments.length?(i=+m,e):+i},alphaTarget:function(m){return arguments.length?(s=+m,e):s},velocityDecay:function(m){return arguments.length?(o=1-m,e):1-o},randomSource:function(m){return arguments.length?(u=m,a.forEach(g),e):u},force:function(m,b){return arguments.length>1?(b==null?a.delete(m):a.set(m,g(b)),e):a.get(m)},find:function(m,b,y){var _=0,k=t.length,S,E,M,O,P;for(y==null?y=1/0:y*=y,_=0;_<k;++_)O=t[_],S=m-O.x,E=b-O.y,M=S*S+E*E,M<y&&(P=O,y=M);return P},on:function(m,b){return arguments.length>1?(c.on(m,b),e):c.on(m)}}}function jU(){var t,e,n,r,i=Ai(-30),s,o=1,a=1/0,l=.81;function c(p){var g,m=t.length,b=Ry(t,zU,LU).visitAfter(f);for(r=p,g=0;g<m;++g)e=t[g],b.visit(h)}function u(){if(t){var p,g=t.length,m;for(s=new Array(g),p=0;p<g;++p)m=t[p],s[m.index]=+i(m,p,t)}}function f(p){var g=0,m,b,y=0,_,k,S;if(p.length){for(_=k=S=0;S<4;++S)(m=p[S])&&(b=Math.abs(m.value))&&(g+=m.value,y+=b,_+=b*m.x,k+=b*m.y);p.x=_/y,p.y=k/y}else{m=p,m.x=m.data.x,m.y=m.data.y;do g+=s[m.data.index];while(m=m.next)}p.value=g}function h(p,g,m,b){if(!p.value)return!0;var y=p.x-e.x,_=p.y-e.y,k=b-g,S=y*y+_*_;if(k*k/l<S)return S<a&&(y===0&&(y=el(n),S+=y*y),_===0&&(_=el(n),S+=_*_),S<o&&(S=Math.sqrt(o*S)),e.vx+=y*p.value*r/S,e.vy+=_*p.value*r/S),!0;if(p.length||S>=a)return;(p.data!==e||p.next)&&(y===0&&(y=el(n),S+=y*y),_===0&&(_=el(n),S+=_*_),S<o&&(S=Math.sqrt(o*S)));do p.data!==e&&(k=s[p.data.index]*r/S,e.vx+=y*k,e.vy+=_*k);while(p=p.next)}return c.initialize=function(p,g){t=p,n=g,u()},c.strength=function(p){return arguments.length?(i=typeof p=="function"?p:Ai(+p),u(),c):i},c.distanceMin=function(p){return arguments.length?(o=p*p,c):Math.sqrt(o)},c.distanceMax=function(p){return arguments.length?(a=p*p,c):Math.sqrt(a)},c.theta=function(p){return arguments.length?(l=p*p,c):Math.sqrt(l)},c}function A2(t){var e=Ai(.1),n,r,i;typeof t!="function"&&(t=Ai(t==null?0:+t));function s(a){for(var l=0,c=n.length,u;l<c;++l)u=n[l],u.vx+=(i[l]-u.x)*r[l]*a}function o(){if(n){var a,l=n.length;for(r=new Array(l),i=new Array(l),a=0;a<l;++a)r[a]=isNaN(i[a]=+t(n[a],a,n))?0:+e(n[a],a,n)}}return s.initialize=function(a){n=a,o()},s.strength=function(a){return arguments.length?(e=typeof a=="function"?a:Ai(+a),o(),s):e},s.x=function(a){return arguments.length?(t=typeof a=="function"?a:Ai(+a),o(),s):t},s}function P2(t){var e=Ai(.1),n,r,i;typeof t!="function"&&(t=Ai(t==null?0:+t));function s(a){for(var l=0,c=n.length,u;l<c;++l)u=n[l],u.vy+=(i[l]-u.y)*r[l]*a}function o(){if(n){var a,l=n.length;for(r=new Array(l),i=new Array(l),a=0;a<l;++a)r[a]=isNaN(i[a]=+t(n[a],a,n))?0:+e(n[a],a,n)}}return s.initialize=function(a){n=a,o()},s.strength=function(a){return arguments.length?(e=typeof a=="function"?a:Ai(+a),o(),s):e},s.y=function(a){return arguments.length?(t=typeof a=="function"?a:Ai(+a),o(),s):t},s}var UU=ne('<div class="flex shrink-0 items-center gap-1.5 border-b bg-primary/5 px-3 py-1.5 text-[11px] text-primary"><span class="size-1.5 animate-pulse rounded-full bg-primary"></span> Now touching <code class="font-mono"> </code></div>'),WU=ne('<div class="pointer-events-none absolute inset-0 flex flex-col items-center justify-center gap-4 px-6 text-center"><svg viewBox="0 0 120 120" class="size-24 text-muted-foreground/40" fill="none"><circle cx="60" cy="60" r="6" fill="currentColor"><animate attributeName="opacity" values="0.4;1;0.4" dur="2.4s" repeatCount="indefinite"></animate></circle><g stroke="currentColor" stroke-width="1" opacity="0.5"><line x1="60" y1="60" x2="26" y2="34"><animate attributeName="opacity" values="0.1;0.5;0.1" dur="3s" repeatCount="indefinite"></animate></line><line x1="60" y1="60" x2="96" y2="40"><animate attributeName="opacity" values="0.1;0.5;0.1" dur="3.4s" repeatCount="indefinite"></animate></line><line x1="60" y1="60" x2="34" y2="92"><animate attributeName="opacity" values="0.1;0.5;0.1" dur="2.8s" repeatCount="indefinite"></animate></line><line x1="60" y1="60" x2="92" y2="90"><animate attributeName="opacity" values="0.1;0.5;0.1" dur="3.1s" repeatCount="indefinite"></animate></line></g><g fill="currentColor"><circle cx="26" cy="34" r="3.5"><animate attributeName="opacity" values="0.2;0.7;0.2" dur="3s" repeatCount="indefinite"></animate></circle><circle cx="96" cy="40" r="3.5"><animate attributeName="opacity" values="0.2;0.7;0.2" dur="3.4s" repeatCount="indefinite"></animate></circle><circle cx="34" cy="92" r="3.5"><animate attributeName="opacity" values="0.2;0.7;0.2" dur="2.8s" repeatCount="indefinite"></animate></circle><circle cx="92" cy="90" r="3.5"><animate attributeName="opacity" values="0.2;0.7;0.2" dur="3.1s" repeatCount="indefinite"></animate></circle></g></svg> <p class="max-w-[16rem] text-xs leading-relaxed text-muted-foreground">Entities Nomos explores in this conversation appear here, wired up by their relationships.</p></div>'),qU=Ui('<path fill="none" stroke="var(--muted-foreground)"><title> </title></path>'),HU=Ui('<circle opacity="0.25"></circle>'),VU=Ui('<circle fill="none" stroke="var(--primary)" stroke-width="1.5" opacity="0.8"><animate attributeName="r" dur="1.6s" repeatCount="indefinite"></animate><animate attributeName="opacity" values="0.8;0.1;0.8" dur="1.6s" repeatCount="indefinite"></animate></circle>'),$U=Ui('<text text-anchor="middle" font-size="8" fill="var(--warning)" paint-order="stroke" stroke="var(--background)" stroke-width="2.5" class="pointer-events-none"> </text>'),GU=Ui('<g class="cursor-pointer" role="button" tabindex="0"><!><!><circle></circle><text text-anchor="middle" font-size="9" paint-order="stroke" stroke="var(--background)" stroke-width="2.5" class="pointer-events-none"> </text><!></g>'),YU=Ui('<svg class="h-full w-full touch-none select-none" role="application" aria-label="Session entity graph"><defs><pattern width="12" height="12" patternUnits="userSpaceOnUse"><circle cx="2" cy="2" r="0.8" fill="var(--border)" opacity="0.75"></circle></pattern></defs><rect></rect><g><g></g><g></g></g></svg>'),KU=ne('<aside class="flex h-full min-h-0 flex-col bg-card"><!> <div class="relative min-h-0 flex-1 overflow-hidden"><!></div></aside>');function XU(t,e){Tt(e,!0);const n=()=>zn(up,"$wmState",r),[r,i]=ro(),s=`dot-grid-${crypto.randomUUID().slice(0,8)}`,o=new Set(["check","execution"]),a=/\b[a-z][a-z-]*:[a-z0-9][a-z0-9._/-]*(?::[a-z0-9._/-]+)*/g;let l=Se(gn([])),c=Se(gn([])),u=Se(null),f=null;const h=new Map,p=[],g=new Set,m=new Set;let b=Se(0),y=Se(null),_=Se(300),k=Se(300),S=Se(0),E=Se(0),M=Se(1),O=Se(!1);const P=V(()=>`translate(${d(S)},${d(E)}) scale(${d(M)})`);function x(se,_e){if(typeof se=="string"){const me=se.match(a);if(me)for(const ve of me)_e.add(ve.replace(/[.,;)\]]+$/,""))}else if(Array.isArray(se))for(const me of se)x(me,_e);else if(se&&typeof se=="object")for(const me of Object.values(se))x(me,_e)}const C=V(()=>{const se=new Set;for(const _e of e.messages){x(_e.text,se);for(const me of _e.tools)x(me.args,se)}return se});async function R(se){const _e=se.filter(me=>!h.has(me)&&!m.has(me));if(_e.length){for(const me of _e)m.add(me);await Promise.all(_e.map(async me=>{try{const ve=await MM({root:me,depth:1}),Xe=(ve==null?void 0:ve.nodes.find(et=>et.slug===me))??null;if(h.set(me,Xe?{...Xe,degree:0}:null),ve&&Xe)for(const et of ve.edges){const dt=`${et.source}|${et.target}|${et.type}`;g.has(dt)||(g.add(dt),p.push({source:et.source,target:et.target,type:et.type}))}}catch{h.set(me,null)}finally{m.delete(me)}})),mA(b)}}function N(se){const _e=[],me=new Set;for(const Le of se){const gt=h.get(Le);gt&&!o.has(gt.type)&&!me.has(gt.slug)&&(me.add(gt.slug),_e.push(gt))}const ve=new Set(_e.map(Le=>Le.slug)),Xe=d(l),et=new Set(Xe.map(Le=>Le.slug));let dt=ve.size!==et.size;if(!dt){for(const Le of ve)if(!et.has(Le)){dt=!0;break}}if(!dt)return;const ge=new Map(Xe.map(Le=>[Le.slug,Le])),Ae=p.filter(Le=>ve.has(Le.source)&&ve.has(Le.target)).map(Le=>({...Le})),Ie=new Map;for(const Le of Ae)Ie.set(Le.source,(Ie.get(Le.source)??0)+1),Ie.set(Le.target,(Ie.get(Le.target)??0)+1);const pt=_e.map(Le=>{const gt=ge.get(Le.slug);return{...Le,x:gt==null?void 0:gt.x,y:gt==null?void 0:gt.y,vx:gt==null?void 0:gt.vx,vy:gt==null?void 0:gt.vy,degree:Ie.get(Le.slug)??0}});I(l,pt,!0),I(c,Ae,!0),d(u)&&!ve.has(d(u).slug)&&I(u,null),B()}Qt(()=>{const se=d(C);d(b);const _e=[...se].filter(me=>!h.has(me));_e.length&&R(_e),br(()=>N(se))});function B(){if(f==null||f.stop(),!d(l).length){f=null;return}f=BU(d(l)).force("link",kU(d(c)).id(se=>se.slug).distance(48).strength(.5)).force("charge",jU().strength(-150).distanceMax(240)).force("center",_2(d(_)/2,d(k)/2)).force("collide",_U(se=>X(se)+6)).force("x",A2(d(_)/2).strength(.06)).force("y",P2(d(k)/2).strength(.06)).velocityDecay(.34).alphaDecay(.045).on("tick",()=>{I(l,[...d(l)],!0),d(O)||Z()})}Qt(()=>{const se=d(_),_e=d(k);f&&(f.force("center",_2(se/2,_e/2)),f.force("x",A2(se/2).strength(.06)),f.force("y",P2(_e/2).strength(.06)),f.alpha(.3).restart())}),Qt(()=>{if(!d(y))return;const se=new ResizeObserver(_e=>{const me=_e[0].contentRect;I(_,Math.max(me.width,1),!0),I(k,Math.max(me.height,1),!0)});return se.observe(d(y)),()=>se.disconnect()}),Qt(()=>{d(u)&&!n().windows[d(u).slug]&&I(u,null)}),Kh(()=>f==null?void 0:f.stop());const z={healthy:"var(--success)",degraded:"var(--warning)",down:"var(--destructive)",stale:"var(--warning)",unknown:"var(--muted-foreground)"};function H(se){return se.health?z[se.health]??"var(--muted-foreground)":"var(--muted-foreground)"}function X(se){return 6+Math.min(Math.sqrt(se.degree)*1.5,6)}function G(se){return se.split(":").pop()??se}function Z(){if(!d(l).length||d(_)<=1||d(k)<=1)return;let se=1/0,_e=1/0,me=-1/0,ve=-1/0;for(const Ie of d(l)){if(Ie.x==null||Ie.y==null)continue;const pt=X(Ie)+12;se=Math.min(se,Ie.x-pt),_e=Math.min(_e,Ie.y-pt),me=Math.max(me,Ie.x+pt),ve=Math.max(ve,Ie.y+pt)}if(!Number.isFinite(se))return;const Xe=16,et=Math.max(me-se,1),dt=Math.max(ve-_e,1),ge=Math.min((d(_)-Xe*2)/et,(d(k)-Xe*2)/dt),Ae=Math.max(.2,Math.min(2.5,Number.isFinite(ge)?ge:1));I(M,Ae,!0),I(S,(d(_)-et*Ae)/2-se*Ae),I(E,(d(k)-dt*Ae)/2-_e*Ae)}let oe="";Qt(()=>{const se=d(l).map(_e=>_e.slug).sort().join("|");se!==oe&&(oe=se,I(O,!1))});const K=V(()=>{const se={};for(const _e of e.touched)se[_e.slug]=!0;return se}),q=V(()=>{const se={};for(const _e of e.healthDiffs)_e.slug in se||(se[_e.slug]=_e);return se}),W=V(()=>e.touched[0]??null);function J(se){return typeof se=="object"?se:d(l).find(_e=>_e.slug===se)}function fe(se){return typeof se=="object"?se.slug:se}let $=null,de=null;function Be(se,_e){const me=d(y).getBoundingClientRect();return{x:(se-me.left-d(S))/d(M),y:(_e-me.top-d(E))/d(M)}}function wt(se,_e){se.stopPropagation(),se.currentTarget.setPointerCapture(se.pointerId),$={node:_e,moved:!1},f==null||f.alphaTarget(.2).restart()}function Je(se){de={x:se.clientX-d(S),y:se.clientY-d(E)},se.currentTarget.setPointerCapture(se.pointerId)}function Ue(se){if($){const _e=Be(se.clientX,se.clientY);$.node.fx=_e.x,$.node.fy=_e.y,$.moved=!0,I(l,[...d(l)],!0);return}de&&(I(S,se.clientX-de.x),I(E,se.clientY-de.y),I(O,!0))}function ke(se){I(u,se,!0),J1(se.slug)}function ct(){if($){const{node:se,moved:_e}=$;se.fx=null,se.fy=null,f==null||f.alphaTarget(0),$=null,_e||ke(se);return}de=null}function Ee(){I(O,!1),Z()}const Ve=V(()=>d(u)?d(c).filter(se=>fe(se.source)===d(u).slug||fe(se.target)===d(u).slug).map(se=>{const _e=fe(se.source)===d(u).slug;return{dir:_e?"→":"←",type:se.type,other:fe(_e?se.target:se.source)}}):[]);var be=KU(),xt=j(be);{var _t=se=>{var _e=UU(),me=ee(j(_e),2),ve=j(me);De(()=>je(ve,d(W).slug)),A(se,_e)};xe(xt,se=>{d(W)&&se(_t)})}var Yt=ee(xt,2),en=j(Yt);{var tn=se=>{var _e=WU();A(se,_e)},Qn=se=>{var _e=YU(),me=j(_e),ve=j(me),Xe=ee(me),et=ee(Xe),dt=j(et);Rn(dt,21,()=>d(c),$s,(Ae,Ie)=>{const pt=V(()=>J(d(Ie).source)),Le=V(()=>J(d(Ie).target));var gt=qe(),nn=Me(gt);{var St=Rt=>{const re=V(()=>d(u)&&(d(pt).slug===d(u).slug||d(Le).slug===d(u).slug)),ae=V(()=>d(Le).x-d(pt).x),he=V(()=>d(Le).y-d(pt).y),le=V(()=>Math.max(Math.hypot(d(ae),d(he)),1)),Pe=V(()=>Math.min(d(le)*.15,40)),Oe=V(()=>(d(pt).x+d(Le).x)/2-d(he)/d(le)*d(Pe)),Re=V(()=>(d(pt).y+d(Le).y)/2+d(ae)/d(le)*d(Pe));var Ce=qU(),He=j(Ce),Ge=j(He);De(()=>{ut(Ce,"d",`M ${d(pt).x??""},${d(pt).y??""} Q ${d(Oe)??""},${d(Re)??""} ${d(Le).x??""},${d(Le).y??""}`),ut(Ce,"stroke-width",d(re)?1.6:1),ut(Ce,"opacity",d(u)?d(re)?.7:.12:.35),je(Ge,d(Ie).type)}),A(Rt,Ce)};xe(nn,Rt=>{var re,ae,he,le;((re=d(pt))==null?void 0:re.x)!=null&&((ae=d(Le))==null?void 0:ae.x)!=null&&((he=d(pt))==null?void 0:he.y)!=null&&((le=d(Le))==null?void 0:le.y)!=null&&Rt(St)})}A(Ae,gt)});var ge=ee(dt);Rn(ge,21,()=>d(l),Ae=>Ae.slug,(Ae,Ie)=>{var pt=qe(),Le=Me(pt);{var gt=nn=>{const St=V(()=>X(d(Ie))),Rt=V(()=>{var tt;return((tt=d(u))==null?void 0:tt.slug)===d(Ie).slug}),re=V(()=>d(u)&&!d(Rt)&&!d(Ve).some(tt=>tt.other===d(Ie).slug)),ae=V(()=>d(Ie).slug in d(K)),he=V(()=>d(q)[d(Ie).slug]);var le=GU(),Pe=j(le);{var Oe=tt=>{var Vt=HU();De(In=>{ut(Vt,"r",d(St)+5),ut(Vt,"fill",In)},[()=>H(d(Ie))]),A(tt,Vt)};xe(Pe,tt=>{d(Rt)&&tt(Oe)})}var Re=ee(Pe);{var Ce=tt=>{var Vt=VU(),In=j(Vt);De(()=>{ut(Vt,"r",d(St)+4),ut(In,"values",`${d(St)+3};${d(St)+8};${d(St)+3}`)}),A(tt,Vt)};xe(Re,tt=>{d(ae)&&tt(Ce)})}var He=ee(Re),Ge=ee(He),Ft=j(Ge),jt=ee(Ge);{var nt=tt=>{var Vt=$U(),In=j(Vt);De(()=>{ut(Vt,"y",-d(St)-6),je(In,`${d(he).from??""}${d(he).to??""}`)}),A(tt,Vt)};xe(jt,tt=>{d(he)&&tt(nt)})}De((tt,Vt)=>{ut(le,"transform",`translate(${d(Ie).x??""},${d(Ie).y??""})`),ut(le,"opacity",d(re)?.35:1),ut(He,"r",d(St)),ut(He,"fill",tt),ut(He,"stroke",d(Rt)?"var(--foreground)":"var(--background)"),ut(He,"stroke-width",d(Rt)?2:1.5),ut(Ge,"y",d(St)+10),ut(Ge,"fill",d(Rt)?"var(--foreground)":"var(--muted-foreground)"),je(Ft,Vt)},[()=>H(d(Ie)),()=>G(d(Ie).slug)]),Ln("pointerdown",le,tt=>wt(tt,d(Ie))),Ln("keydown",le,tt=>tt.key==="Enter"&&ke(d(Ie))),A(nn,le)};xe(Le,nn=>{d(Ie).x!=null&&d(Ie).y!=null&&nn(gt)})}A(Ae,pt)}),De(()=>{ut(_e,"width",d(_)),ut(_e,"height",d(k)),ut(_e,"viewBox",`0 0 ${d(_)??""} ${d(k)??""}`),ut(ve,"id",s),ut(Xe,"width",d(_)),ut(Xe,"height",d(k)),ut(Xe,"fill",`url(#${s})`),ut(et,"transform",d(P))}),Ln("pointerdown",_e,Je),Ln("pointermove",_e,Ue),Ln("pointerup",_e,ct),Mi("pointercancel",_e,ct),Ln("dblclick",_e,Ee),A(se,_e)};xe(en,se=>{d(l).length===0?se(tn):se(Qn,-1)})}kr(Yt,se=>I(y,se),()=>d(y)),A(t,be),Et(),i()}Fo(["pointerdown","pointermove","pointerup","dblclick","keydown"]);var ZU=ne('<div class="flex h-full min-h-0 flex-col"><div class="shrink-0" style="aspect-ratio: 1; width: 100%;"><!></div></div>');function QU(t,e){Tt(e,!0);const n=()=>zn(g,"$taskWorkingStore",o),r=()=>zn(d(p),"$messagesStore",o),i=()=>zn(d(u),"$touchedStore",o),s=()=>zn(d(f),"$healthDiffsStore",o),[o,a]=ro();let l=te(e,"sessionId",3,null);os(()=>l()?void 0:y9());const c=V(()=>l()?o0(l()):null),u=V(()=>d(c)?d(c).touched:p9),f=V(()=>d(c)?d(c).healthDiffs:g9),h=V(()=>l()?Xs(l()):null),p=V(()=>d(h)?d(h).messages:IM),g=l()?o5(l()):x9;l()&&Xs(l()).streaming,l()&&Xs(l()).connectionState,l()&&a0(l());let m=Se(gn(Date.now()));Qt(()=>{if(!n())return;const k=setInterval(()=>{I(m,Date.now(),!0)},1e3);return()=>clearInterval(k)});var b=ZU(),y=j(b),_=j(y);XU(_,{get messages(){return r()},get touched(){return i()},get healthDiffs(){return s()}}),A(t,b),Et(),a()}var JU=ne('<div class="flex flex-1 items-center justify-center text-xs text-muted-foreground">Loading…</div>'),eW=ne('<div class="flex flex-1 flex-col items-center justify-center gap-1 p-6 text-center"><p class="text-sm text-muted-foreground">Task not found.</p> <p class="text-xs text-muted-foreground/70">It may have been deleted.</p></div>'),tW=ne("<!> <!>",1),nW=ne('<div class="flex h-full min-h-0"><!></div>');function rW(t,e){Tt(e,!0);const n=()=>zn(S,"$chatNotFound",h),r=()=>zn(m,"$chatMessages",h),i=()=>zn(b,"$chatStreaming",h),s=()=>zn(y,"$chatWorking",h),o=()=>zn(_,"$chatConnectionState",h),a=()=>zn(k,"$chatError",h),l=()=>zn(cp,"$chatErrors",h),c=()=>zn(x,"$openQuestion",h),u=()=>zn(O,"$planSteps",h),f=()=>zn(P,"$chatTask",h),[h,p]=ro(),g=Xs(e.sessionId),m=g.messages,b=g.streaming,y=o5(e.sessionId),_=g.connectionState,k=g.error,S=g.notFound,E=C9(e.sessionId),M=o0(e.sessionId),O=M.planSteps,P=a0(e.sessionId),x=M.openQuestion;let C=Se(!0);const R=S9(e.sessionId);os(async()=>{await Dx(e.sessionId),I(C,!1)}),Kh(()=>{jz(e.sessionId),R()});let N=Se(32);var B=nW(),z=j(B);{var H=Z=>{var oe=JU();A(Z,oe)},X=Z=>{var oe=eW();A(Z,oe)},G=Z=>{t5(Z,{theme:"oikos-theme",dblClickSplitter:!1,children:(oe,K)=>{var q=tW(),W=Me(q);Kg(W,{children:(fe,$)=>{{let de=V(()=>{var wt;return(wt=f())==null?void 0:wt.status}),Be=V(()=>{var wt;return(wt=f())==null?void 0:wt.last_active_at});H5(fe,{get messages(){return r()},get streaming(){return i()},get working(){return s()},get connectionState(){return o()},get error(){return a()},get chatErrors(){return l()},get activityLog(){return E},get sessionId(){return e.sessionId},get question(){return c()},get planSteps(){return u()},get taskStatus(){return d(de)},get lastActiveAt(){return d(Be)},onSend:wt=>Uz(e.sessionId,wt),onCancel:()=>Wz(e.sessionId),onReconnect:()=>Dx(e.sessionId),get onDismissError(){return Lz}})}},$$slots:{default:!0}});var J=ee(W,2);Kg(J,{minSize:24,maxSize:60,get size(){return d(N)},set size(fe){I(N,fe,!0)},children:(fe,$)=>{QU(fe,{get sessionId(){return e.sessionId}})},$$slots:{default:!0}}),A(oe,q)},$$slots:{default:!0}})};xe(z,Z=>{d(C)?Z(H):n()?Z(X,1):Z(G,-1)})}A(t,B),Et(),p()}function iW(t,e){Tt(e,!0);let n=te(e,"initialDraft",3,"");function r(i){jM(i,s=>{UM(s,zl(i,60)),fn.close(Qc)})}H5(t,{get initialDraft(){return n()},messages:[],streaming:!1,working:!1,connectionState:"connected",onSend:r,onCancel:()=>{},onReconnect:()=>{},onDismissError:()=>{}}),Et()}var sW=ne('<div class="flex h-full min-h-0 items-center justify-center p-4 text-center text-sm text-destructive"> </div>'),oW=ne('<div class="flex h-full min-h-0 items-center justify-center text-muted-foreground"><!></div>');function Z5(t,e){Tt(e,!0);const n=br(()=>e.load());var r=qe(),i=Me(r);WA(i,()=>n,s=>{var o=oW(),a=j(o);Xg(a,{class:"size-5"}),A(s,o)},(s,o)=>{const a=V(()=>d(o).default);var l=qe(),c=Me(l);Tn(c,()=>d(a),(u,f)=>{f(u,{})}),A(s,l)},(s,o)=>{var a=sW(),l=j(a);De(()=>je(l,`Failed to load app: ${d(o).message??""}`)),A(s,a)}),A(t,r),Et()}var aW=ne('<section class="min-w-0"><header data-wm-drag="" class="flex h-9 shrink-0 cursor-move items-center justify-between gap-2 overflow-hidden border-b border-border bg-background px-3"><span data-wm-title="" class="min-w-0 flex-1 truncate font-mono text-xs font-medium"> </span> <div class="flex shrink-0 items-center gap-1"><button type="button" data-wm-minimize="" class="win-ctrl flex size-6"><!></button> <button type="button" data-wm-maximize="" class="win-ctrl flex size-6"><!></button> <button type="button" data-wm-close="" class="win-ctrl flex size-6"><!></button></div></header> <div data-wm-content="" class="min-h-0 flex-1 overflow-hidden"><!></div></section>'),lW=ne('<div class="absolute inset-0 z-40 pointer-events-none"></div>');function cW(t,e){Tt(e,!0);const n=()=>zn(Y1,"$appById",s),r=()=>zn(up,"$wmState",s),i=()=>zn(Vz,"$windowKeys",s),[s,o]=ro();Qt(()=>{const l=n();for(const c of r().order){const u=sf(c);u&&!l.has(u)&&fn.close(c)}}),Qt(()=>{var c;const l=n();for(const u of r().order){const f=sf(u),h=f?l.get(f):void 0;h&&((c=r().windows[u])==null?void 0:c.title)!==h.title&&fn.update(u,{title:h.title})}});var a=lW();Rn(a,5,i,l=>l,(l,c)=>{const u=V(()=>r().windows[d(c)]),f=V(()=>sf(d(c))),h=V(()=>d(f)?n().get(d(f)):void 0);var p=qe(),g=Me(p);{var m=b=>{var y=aW(),_=j(y),k=j(_),S=j(k),E=ee(k,2),M=j(E),O=j(M);sN(O,{class:"size-3.5"});var P=ee(M,2),x=j(P);tN(x,{class:"size-3.5"});var C=ee(P,2),R=j(C);ru(R,{class:"size-3.5"});var N=ee(_,2),B=j(N);FS(B,()=>d(c),z=>{var H=qe(),X=Me(H);{var G=W=>{{let J=V(()=>d(c).slice(jg.length));rW(W,{get sessionId(){return d(J)}})}},Z=V(()=>d(c).startsWith(jg)),oe=W=>{{let J=V($z);iW(W,{get initialDraft(){return d(J)}})}},K=W=>{Z5(W,{get load(){return d(h).component}})},q=W=>{J7(W,{get slug(){return d(c)},get onSelectEntity(){return J1}})};xe(X,W=>{d(Z)?W(G):d(c)===Qc?W(oe,1):d(h)?W(K,2):W(q,-1)})}A(z,H)}),Pw(y,(z,H)=>{var X;return(X=Rc.window)==null?void 0:X.call(Rc,z,H)},()=>({id:d(c)})),De(()=>{ut(y,"aria-label",d(u).title),je(S,d(u).title),ut(M,"aria-label",`Minimize ${d(u).title??""}`),ut(P,"aria-label",`Maximize ${d(u).title??""}`),ut(C,"aria-label",`Close ${d(u).title??""}`)}),A(b,y)};xe(g,b=>{d(u)&&(!d(f)||d(h))&&b(m)})}A(l,p)}),Pw(a,l=>{var c;return(c=Rc.desktop)==null?void 0:c.call(Rc,l)}),A(t,a),Et(),o()}var uW=ne('<div class="pointer-events-none absolute inset-0 z-45"></div>');function dW(t,e){Tt(e,!0);const n=()=>zn(ap,"$apps",i),r=()=>zn(Nz,"$dockedVisibility",i),[i,s]=ro(),o=V(()=>n().filter(l=>l.docked));var a=uW();Rn(a,21,()=>d(o),l=>l.id,(l,c)=>{var u=qe(),f=Me(u);{var h=p=>{Z5(p,{get load(){return d(c).component}})};xe(f,p=>{(r()[d(c).id]??!0)&&p(h)})}A(l,u)}),A(t,a),Et(),s()}const fW="v0.19.0";var hW=ne('<span class="flex h-3.5 min-w-3.5 shrink-0 items-center justify-center border border-background bg-destructive px-1 text-[9px] font-semibold text-destructive-foreground"> </span>'),pW=ne('<div class="group/tb relative flex shrink-0"><button type="button"><!> <span class="min-w-0 truncate"> </span> <!></button> <button type="button" class="win-ctrl absolute -top-1.5 -right-1.5 hidden size-4 group-hover/tb:flex"><!></button></div>'),gW=ne('<div class="flex h-11 shrink-0 items-center gap-1.5 border-t border-border bg-background px-2"><button type="button" class="flex shrink-0 items-center justify-center border border-border p-1.5 text-muted-foreground transition-colors hover:border-foreground hover:bg-foreground hover:text-background" title="Show desktop"><!></button> <div class="h-6 w-px shrink-0 bg-border"></div> <div class="flex min-w-0 flex-1 items-center gap-1 overflow-x-auto py-1.5"></div> <div class="h-6 w-px shrink-0 bg-border"></div> <div class="flex shrink-0 items-center gap-0.5"><button type="button" class="flex items-center justify-center border border-border p-1.5 text-muted-foreground transition-colors hover:border-foreground hover:bg-foreground hover:text-background"><!></button> <button type="button" class="flex items-center justify-center border border-border p-1.5 text-muted-foreground transition-colors hover:border-foreground hover:bg-foreground hover:text-background" title="Settings"><!></button> <span class="px-1.5 font-mono text-[11px] text-muted-foreground select-none"> </span></div></div>');function mW(t,e){Tt(e,!0);const n=()=>zn(up,"$wmState",s),r=()=>zn(Y1,"$appById",s),i=()=>zn($1,"$summary",s),[s,o]=ro(),a="session:",l=V(()=>[...n().order].map(O=>n().windows[O]).filter(O=>!!O).sort((O,P)=>O.openedSeq-P.openedSeq));function c(O){var x;const P=sf(O);return P?(x=r().get(P))==null?void 0:x.icon:O.startsWith(a)?rN:F4}function u(O){var C;const P=sf(O),x=P?r().get(P):void 0;return((C=x==null?void 0:x.badge)==null?void 0:C.call(x,i()))??0}function f(O,P){P.stage==="minimized"?(fn.restore(O),fn.focus(O)):n().focusedId===O?fn.minimize(O):fn.focus(O)}var h=gW(),p=j(h),g=j(p);$4(g,{class:"size-4"});var m=ee(p,4);Rn(m,21,()=>d(l),O=>O.id,(O,P)=>{const x=V(()=>c(d(P).id)),C=V(()=>u(d(P).id));var R=pW(),N=j(R),B=j(N);{var z=q=>{var W=qe(),J=Me(W);Tn(J,()=>d(x),(fe,$)=>{$(fe,{class:"size-3.5 shrink-0"})}),A(q,W)};xe(B,q=>{d(x)&&q(z)})}var H=ee(B,2),X=j(H),G=ee(H,2);{var Z=q=>{var W=hW(),J=j(W);De(()=>je(J,d(C)>99?"99+":d(C))),A(q,W)};xe(G,q=>{d(C)>0&&q(Z)})}var oe=ee(N,2),K=j(oe);ru(K,{class:"size-2.5"}),De(q=>{ut(N,"data-taskbar-btn",d(P).id),Gn(N,1,`flex h-8 max-w-56 items-center gap-1.5 border px-2 font-mono text-xs transition-colors ${n().focusedId===d(P).id&&d(P).stage!=="minimized"?"border-foreground bg-foreground text-background":"border-border bg-background text-muted-foreground hover:border-foreground hover:bg-foreground hover:text-background"} ${d(P).stage==="minimized"?"opacity-50":""}`),ut(N,"title",d(P).title),je(X,q),ut(oe,"aria-label",`Close ${d(P).title??""}`)},[()=>zl(d(P).title,26)]),Ln("click",N,()=>f(d(P).id,d(P))),Ln("click",oe,q=>{q.stopPropagation(),fn.close(d(P).id)}),A(O,R)});var b=ee(m,4),y=j(b),_=j(y);dN(_,{class:"size-4"});var k=ee(y,2),S=j(k);mM(S,{class:"size-4"});var E=ee(k,2),M=j(E);De((O,P)=>{ut(y,"title",`Cycle theme (${O??""})`),ut(y,"aria-label",`Cycle theme, currently ${P??""}`),je(M,fW)},[()=>Mx[qu()],()=>Mx[qu()]]),Ln("click",p,function(...O){cg==null||cg.apply(this,O)}),Ln("click",y,()=>sI()),Ln("click",k,()=>Q1("settings")),A(t,h),Et(),o()}Fo(["click"]);var vW=new Set(["$$slots","$$events","$$legacy","open"]);function bW(t,e){Tt(e,!0);let n=te(e,"open",15,!1),r=ht(e,vW);var i=qe(),s=Me(i);Tn(s,()=>NR,(o,a)=>{a(o,zt(()=>r,{get open(){return n()},set open(l){n(l)}}))}),A(t,i),Et()}var yW=new Set(["$$slots","$$events","$$legacy"]);function wW(t,e){let n=ht(e,yW);var r=qe(),i=Me(r);Tn(i,()=>pC,(s,o)=>{o(s,zt(()=>n))}),A(t,r)}var xW=new Set(["$$slots","$$events","$$legacy","ref","class"]);function _W(t,e){Tt(e,!0);let n=te(e,"ref",15,null),r=ht(e,xW);var i=qe(),s=Me(i);{let o=V(()=>ss("cn-context-menu-trigger select-none",e.class));Tn(s,()=>UR,(a,l)=>{l(a,zt({"data-slot":"context-menu-trigger",get class(){return d(o)}},()=>r,{get ref(){return n()},set ref(c){n(c)}}))})}A(t,i),Et()}var SW=new Set(["$$slots","$$events","$$legacy","ref","class","inset","variant"]);function Uc(t,e){Tt(e,!0);let n=te(e,"ref",15,null),r=te(e,"variant",3,"default"),i=ht(e,SW);var s=qe(),o=Me(s);{let a=V(()=>ss("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive focus:*:[svg]:text-accent-foreground gap-2 rounded-sm px-2 py-1.5 text-sm data-inset:pl-8 [&_svg:not([class*='size-'])]:size-4 group/context-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",e.class));Tn(o,()=>LR,(l,c)=>{c(l,zt({"data-slot":"context-menu-item",get"data-inset"(){return e.inset},get"data-variant"(){return r()},get class(){return d(a)}},()=>i,{get ref(){return n()},set ref(u){n(u)}}))})}A(t,s),Et()}var kW=new Set(["$$slots","$$events","$$legacy","ref","portalProps","class"]);function MW(t,e){Tt(e,!0);let n=te(e,"ref",15,null),r=ht(e,kW);wW(t,zt(()=>e.portalProps,{children:(i,s)=>{var o=qe(),a=Me(o);{let l=V(()=>ss("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-36 rounded-md p-1 shadow-md ring-1 duration-100 z-50 overflow-x-hidden overflow-y-auto outline-none",e.class));Tn(a,()=>FR,(c,u)=>{u(c,zt({"data-slot":"context-menu-content",get class(){return d(l)}},()=>r,{get ref(){return n()},set ref(f){n(f)}}))})}A(i,o)},$$slots:{default:!0}})),Et()}var TW=new Set(["$$slots","$$events","$$legacy","ref","class"]);function C2(t,e){Tt(e,!0);let n=te(e,"ref",15,null),r=ht(e,TW);var i=qe(),s=Me(i);{let o=V(()=>ss("bg-border -mx-1 my-1 h-px",e.class));Tn(s,()=>HR,(a,l)=>{l(a,zt({"data-slot":"context-menu-separator",get class(){return d(o)}},()=>r,{get ref(){return n()},set ref(c){n(c)}}))})}A(t,i),Et()}var EW=ne('<div class="pointer-events-none absolute inset-0 z-0 overflow-hidden" aria-hidden="true"><div class="absolute"></div></div>'),AW=ne("<!> Cascade windows",1),PW=ne("<!> Tile windows",1),CW=ne("<!> Show desktop",1),OW=ne("<!> Reset icon layout",1),RW=ne("<!> Undo",1),NW=ne("<!> Redo",1),IW=ne("<!> <!> <!> <!> <!> <!> <!> <!>",1),zW=ne("<!> <!>",1),LW=ne('<div class="fixed inset-0 flex flex-col"><div class="relative min-h-0 flex-1 overflow-hidden" role="presentation"><!> <!> <div class="pointer-events-none absolute inset-0 z-0"></div> <div class="pointer-events-none absolute inset-0 z-10 flex items-center justify-center p-6"><div class="pointer-events-auto"><!></div></div> <!> <!></div> <!></div>');function DW(t,e){Tt(e,!0);const n=()=>zn(ap,"$apps",s),r=()=>zn(ic,"$iconPositions",s),i=()=>zn($1,"$summary",s),[s,o]=ro();let a=Se(!1),l=Se(!1);function c(C){C&&(I(a,fn.canUndo(),!0),I(l,fn.canRedo(),!0))}function u(C){const R=C.target;R&&(R.tagName==="INPUT"||R.tagName==="TEXTAREA"||R.isContentEditable)||!(C.metaKey||C.ctrlKey)||C.key.toLowerCase()!=="z"||(C.preventDefault(),C.shiftKey?fn.redo():fn.undo())}const f=V(()=>{const C=N0();return C.pattern!=="none"||C.fillColor!==null}),h=V(()=>{const C=N0();if(C.fade<=0)return"";const N=`radial-gradient(circle at 50% 50%, black 0%, black ${Math.round(100-C.fade*70)}%, transparent 100%)`;return`mask-image:${N};-webkit-mask-image:${N};`}),p=V(()=>{const C=N0(),R=Xz(C.pattern,C.color,C.scale);return`inset:-50%;width:200%;height:200%;opacity:${C.opacity};background-color:${C.fillColor??"transparent"};transform:rotate(${C.rotation}deg);${R}`});var g=LW();Mi("keydown",vv,u);var m=j(g),b=j(m);{var y=C=>{var R=EW(),N=j(R);De(()=>{Ks(R,d(h)),Ks(N,d(p))}),A(C,R)};xe(b,C=>{d(f)&&C(y)})}var _=ee(b,2);Tn(_,()=>bW,(C,R)=>{R(C,{onOpenChange:c,children:(N,B)=>{var z=zW(),H=Me(z);Tn(H,()=>_W,(G,Z)=>{Z(G,{class:"absolute inset-0 z-0",onclick:()=>fn.blur()})});var X=ee(H,2);Tn(X,()=>MW,(G,Z)=>{Z(G,{class:"min-w-48",children:(oe,K)=>{var q=IW(),W=Me(q);Tn(W,()=>Uc,(Ue,ke)=>{ke(Ue,{onSelect:()=>fn.arrange("cascade"),children:(ct,Ee)=>{var Ve=AW(),be=Me(Ve);H4(be,{class:"size-4"}),A(ct,Ve)},$$slots:{default:!0}})});var J=ee(W,2);Tn(J,()=>Uc,(Ue,ke)=>{ke(Ue,{onSelect:()=>fn.arrange("tile"),children:(ct,Ee)=>{var Ve=PW(),be=Me(Ve);wN(be,{class:"size-4"}),A(ct,Ve)},$$slots:{default:!0}})});var fe=ee(J,2);Tn(fe,()=>Uc,(Ue,ke)=>{ke(Ue,{get onSelect(){return cg},children:(ct,Ee)=>{var Ve=CW(),be=Me(Ve);aN(be,{class:"size-4"}),A(ct,Ve)},$$slots:{default:!0}})});var $=ee(fe,2);Tn($,()=>C2,(Ue,ke)=>{ke(Ue,{})});var de=ee($,2);Tn(de,()=>Uc,(Ue,ke)=>{ke(Ue,{get onSelect(){return az},children:(ct,Ee)=>{var Ve=OW(),be=Me(Ve);bN(be,{class:"size-4"}),A(ct,Ve)},$$slots:{default:!0}})});var Be=ee(de,2);Tn(Be,()=>C2,(Ue,ke)=>{ke(Ue,{})});var wt=ee(Be,2);{let Ue=V(()=>!d(a));Tn(wt,()=>Uc,(ke,ct)=>{ct(ke,{get disabled(){return d(Ue)},onSelect:()=>fn.undo(),children:(Ee,Ve)=>{var be=RW(),xt=Me(be);qN(xt,{class:"size-4"}),A(Ee,be)},$$slots:{default:!0}})})}var Je=ee(wt,2);{let Ue=V(()=>!d(l));Tn(Je,()=>Uc,(ke,ct)=>{ct(ke,{get disabled(){return d(Ue)},onSelect:()=>fn.redo(),children:(Ee,Ve)=>{var be=NW(),xt=Me(be);gN(xt,{class:"size-4"}),A(Ee,be)},$$slots:{default:!0}})})}A(oe,q)},$$slots:{default:!0}})}),A(N,z)},$$slots:{default:!0}})});var k=ee(_,2);Rn(k,5,n,C=>C.id,(C,R)=>{const N=V(()=>r()[d(R).id]??{col:0,row:0}),B=V(()=>{var z,H;return((H=(z=d(R)).badge)==null?void 0:H.call(z,i()))??0});t6(C,{get app(){return d(R)},get pos(){return d(N)},get badge(){return d(B)},onOpen:()=>Q1(d(R).id)})});var S=ee(k,2),E=j(S),M=j(E);o6(M,{});var O=ee(S,2);cW(O,{});var P=ee(O,2);dW(P,{});var x=ee(m,2);mW(x,{}),A(t,g),Et(),o()}var FW=new Set(["$$slots","$$events","$$legacy"]);function BW(t,e){Tt(e,!0);let n=ht(e,FW);{const r=c=>{db(c,{class:"size-4 animate-spin"})},i=c=>{C4(c,{class:"size-4"})},s=c=>{cN(c,{class:"size-4"})},o=c=>{W4(c,{class:"size-4"})},a=c=>{UN(c,{class:"size-4"})};let l=V(()=>qu()==="light"?"light":"dark");jF(t,zt({get theme(){return d(l)},class:"toaster group",style:"--normal-bg: var(--color-popover); --normal-text: var(--color-popover-foreground); --normal-border: var(--color-border);"},()=>n,{loadingIcon:r,successIcon:i,errorIcon:s,infoIcon:o,warningIcon:a,$$slots:{loadingIcon:!0,successIcon:!0,errorIcon:!0,infoIcon:!0,warningIcon:!0}}))}Et()}var jW=ne("<!> <!>",1);function UW(t,e){Tt(e,!0);let n=Se(gn(kx()));const r={overview:"tasks",chat:"tasks",kb:"kb",entities:"kb",graph:"kb",ops:"ops",signals:"signals",knowledge:"knowledge",learning:"learning"};function i(){const c=location.hash.slice(2);if(!c)return;const[u,...f]=c.split("/");u==="entity"&&f.length?J1(f.join("/")):r[u]&&Q1(r[u]),history.replaceState(null,"",location.pathname+location.search)}os(async()=>{await JN()?I(n,!0):d(n)||await QN()&&I(n,!0),i()}),Qt(()=>{if(d(n))return KI()});var s=qe(),o=Me(s);{var a=c=>{{let u=V(()=>kx()?()=>I(n,!0):void 0);bI(c,{onConnected:()=>I(n,!0),get onCancel(){return d(u)}})}},l=c=>{var u=jW(),f=Me(u);BW(f,{});var h=ee(f,2);DW(h,{}),A(c,u)};xe(o,c=>{d(n)?c(l,-1):c(a)})}A(t,s),Et()}function WW(){const t=new URLSearchParams(location.search),e=t.get("token");if(e&&new URLSearchParams(location.search).has("desktop")){const n=t.get("apiUrl")||ll().apiUrl||"";gb({apiUrl:n,token:e,isDesktop:!0}),Lg({apiUrl:n,token:e,isDesktop:!0}),t.delete("token");const r=t.toString();return history.replaceState(null,"",location.pathname+(r?"?"+r:"")),!0}return!1}function qW(){Lg(),WW(),DS(UW,{target:document.getElementById("app")})}qW();export{_r as $,lp as A,Rr as B,Ln as C,I as D,$s as E,Iq as F,pl as G,ns as H,bk as I,Jh as J,QW as K,_1 as L,JW as M,ZW as N,qm as O,v1 as P,qe as Q,xe as R,Hm as S,zq as T,zt as U,fc as V,te as W,gc as X,vr as Y,st as Z,Zt as _,A as a,R8 as a$,an as a0,Ci as a1,ht as a2,dn as a3,ss as a4,kr as a5,gn as a6,Tn as a7,er as a8,Np as a9,uq as aA,Oa as aB,cq as aC,mq as aD,CI as aE,OI as aF,PI as aG,_N as aH,Xi as aI,ru as aJ,YW as aK,xp as aL,w4 as aM,mk as aN,Jr as aO,_k as aP,wa as aQ,rd as aR,tO as aS,eO as aT,QC as aU,iO as aV,sx as aW,HT as aX,Wn as aY,I8 as aZ,L8 as a_,Ks as aa,Ca as ab,ut as ac,D1 as ad,E4 as ae,Qt as af,br as ag,VT as ah,$T as ai,Vq as aj,Kh as ak,MM as al,UN as am,Mi as an,j2 as ao,Ui as ap,bN as aq,Z4 as ar,Ww as as,aq as at,lq as au,up as av,XR as aw,J1 as ax,AI as ay,dq as az,Et as b,xk as b$,pC as b0,DI as b1,wq as b2,FI as b3,ty as b4,BS as b5,Sq as b6,yq as b7,j8 as b8,I4 as b9,vk as bA,nq as bB,rq as bC,iq as bD,sq as bE,mx as bF,Yw as bG,Ar as bH,$P as bI,_s as bJ,h1 as bK,FP as bL,RR as bM,CR as bN,vR as bO,bR as bP,BN as bQ,fq as bR,hq as bS,pq as bT,gq as bU,uf as bV,hi as bW,va as bX,ep as bY,tp as bZ,tu as b_,GW as ba,zg as bb,Tq as bc,Aq as bd,kq as be,Mq as bf,Eq as bg,_q as bh,xq as bi,bq as bj,vq as bk,t5 as bl,Kg as bm,Ov as bn,sC as bo,gM as bp,BC as bq,Lk as br,x1 as bs,jC as bt,_g as bu,xg as bv,ZP as bw,XP as bx,yk as by,KP as bz,j as c,tq as c0,sN as c1,ll as c2,N0 as c3,dN as c4,fW as c5,kN as c6,J4 as c7,xx as c8,qu as c9,Oq as cA,Cq as cB,Pq as cC,oq as cD,qv as cE,Fk as cF,eq as cG,ex as cH,vv as cI,Rq as cJ,Ox as cK,Zi as cL,FS as cM,Uc as cN,Lq as cO,Xs as cP,o0 as cQ,C9 as cR,Es as cS,_W as cT,MW as cU,bW as cV,Mx as ca,Dq as cb,ey as cc,jq as cd,Uq as ce,Wq as cf,qq as cg,$W as ch,Fq as ci,XN as cj,gb as ck,Lg as cl,GN as cm,ip as cn,Gt as co,iI as cp,Xz as cq,Bq as cr,eI as cs,pb as ct,Nm as cu,t1 as cv,mE as cw,dk as cx,kv as cy,ZI as cz,Gn as d,je as e,ne as f,d as g,Nq as h,Rn as i,Me as j,Gz as k,Hz as l,ro as m,UM as n,os as o,Tt as p,qz as q,Z1 as r,ee as s,De as t,V as u,od as v,mc as w,Fo as x,Se as y,zn as z};