sessiongraph 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/PRIVACY.md +51 -0
- package/README.md +84 -2
- package/bin/sessiongraph.mjs +43 -0
- package/dist/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/dist/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/dist/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/dist/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/dist/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/dist/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
- package/dist/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
- package/dist/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
- package/dist/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
- package/dist/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
- package/dist/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
- package/dist/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
- package/dist/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
- package/dist/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
- package/dist/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
- package/dist/assets/index-8ZjQU4Q7.js +1 -0
- package/dist/assets/index-BiBqLNvd.js +166 -0
- package/dist/assets/index-DCPujd4X.css +1 -0
- package/dist/assets/scene-CjvdEe_z.js +49 -0
- package/dist/assets/three-B4kj4iLH.js +4394 -0
- package/dist/assets/worker-YMPBjASm.js +2 -0
- package/dist/favicon.svg +1 -0
- package/dist/index.html +19 -0
- package/dist/sources/NOTICE.txt +4 -0
- package/dist/sources/claude.svg +1 -0
- package/dist/sources/cursor.svg +1 -0
- package/dist/sources/generic.svg +1 -0
- package/dist/sources/openai.svg +1 -0
- package/dist/sources/opencode.svg +1 -0
- package/dist-server/server.mjs +32827 -0
- package/docs/guide.md +223 -0
- package/docs/releases.md +34 -0
- package/docs/v1.0.0.md +31 -0
- package/package.json +72 -4
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/scene-CjvdEe_z.js","assets/three-B4kj4iLH.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&s(i)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}})();const Pc="modulepreload",Vc=function(e){return"/"+e},pi={},Oa=function(t,n,s){let r=Promise.resolve();if(n&&n.length>0){let d=function(l){return Promise.all(l.map(f=>Promise.resolve(f).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),a=i?.nonce||i?.getAttribute("nonce");r=d(n.map(l=>{if(l=Vc(l),l in pi)return;pi[l]=!0;const f=l.endsWith(".css"),u=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${u}`))return;const h=document.createElement("link");if(h.rel=f?"stylesheet":Pc,f||(h.as="script"),h.crossOrigin="",h.href=l,a&&h.setAttribute("nonce",a),document.head.appendChild(h),f)return new Promise((p,m)=>{h.addEventListener("load",p),h.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${l}`)))})}))}function o(i){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i}return r.then(i=>{for(const a of i||[])a.status==="rejected"&&o(a.reason);return t().catch(o)})};const Ma=(e,t,n=[])=>{const s=document.createElementNS("http://www.w3.org/2000/svg",e);return Object.keys(t).forEach(r=>{s.setAttribute(r,String(t[r]))}),n.length&&n.forEach(r=>{const o=Ma(...r);s.appendChild(o)}),s};var Da=([e,t,n])=>Ma(e,t,n);const Nc=e=>Array.from(e.attributes).reduce((t,n)=>(t[n.name]=n.value,t),{}),Fc=e=>typeof e=="string"?e:!e||!e.class?"":e.class&&typeof e.class=="string"?e.class.split(" "):e.class&&Array.isArray(e.class)?e.class:"",Hc=e=>e.flatMap(Fc).map(n=>n.trim()).filter(Boolean).filter((n,s,r)=>r.indexOf(n)===s).join(" "),_c=e=>e.replace(/(\w)(\w*)(_|-|\s*)/g,(t,n,s)=>n.toUpperCase()+s.toLowerCase()),gi=(e,{nameAttr:t,icons:n,attrs:s})=>{const r=e.getAttribute(t);if(r==null)return;const o=_c(r),i=n[o];if(!i)return console.warn(`${e.outerHTML} icon name was not found in the provided icons object.`);const a=Nc(e),[d,l,f]=i,u={...l,"data-lucide":r,...s,...a},h=Hc(["lucide",`lucide-${r}`,a,s]);h&&Object.assign(u,{class:h});const p=Da([d,u,f]);return e.parentNode?.replaceChild(p,e)};const Y={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"};const Bc=["svg",Y,[["path",{d:"M5 12h14"}],["path",{d:"m12 5 7 7-7 7"}]]];const Wc=["svg",Y,[["path",{d:"M7 7h10v10"}],["path",{d:"M7 17 17 7"}]]];const jc=["svg",Y,[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}],["path",{d:"m3.3 7 8.7 5 8.7-5"}],["path",{d:"M12 22V12"}]]];const Uc=["svg",Y,[["path",{d:"m6 9 6 6 6-6"}]]];const qc=["svg",Y,[["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"}]]];const Gc=["svg",Y,[["circle",{cx:"12",cy:"12",r:"10"}],["polyline",{points:"12 6 12 12 16 14"}]]];const Yc=["svg",Y,[["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"}]]];const Kc=["svg",Y,[["circle",{cx:"12",cy:"12",r:"10"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18"}]]];const zc=["svg",Y,[["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"}]]];const Zc=["svg",Y,[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}],["path",{d:"m5 12-3 3 3 3"}],["path",{d:"m9 18 3-3-3-3"}]]];const Jc=["svg",Y,[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"}]]];const Xc=["svg",Y,[["line",{x1:"6",x2:"6",y1:"3",y2:"15"}],["circle",{cx:"18",cy:"6",r:"3"}],["circle",{cx:"6",cy:"18",r:"3"}],["path",{d:"M18 9a9 9 0 0 1-9 9"}]]];const Qc=["svg",Y,[["circle",{cx:"12",cy:"18",r:"3"}],["circle",{cx:"6",cy:"6",r:"3"}],["circle",{cx:"18",cy:"6",r:"3"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9"}],["path",{d:"M12 12v3"}]]];const ed=["svg",Y,[["circle",{cx:"12",cy:"5",r:"1"}],["circle",{cx:"19",cy:"5",r:"1"}],["circle",{cx:"5",cy:"5",r:"1"}],["circle",{cx:"12",cy:"12",r:"1"}],["circle",{cx:"19",cy:"12",r:"1"}],["circle",{cx:"5",cy:"12",r:"1"}],["circle",{cx:"12",cy:"19",r:"1"}],["circle",{cx:"19",cy:"19",r:"1"}],["circle",{cx:"5",cy:"19",r:"1"}]]];const td=["svg",Y,[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56"}]]];const nd=["svg",Y,[["circle",{cx:"12",cy:"16",r:"1"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3"}]]];const sd=["svg",Y,[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"}],["path",{d:"M12 12V8"}]]];const rd=["svg",Y,[["circle",{cx:"12",cy:"12",r:"3"}],["circle",{cx:"19",cy:"5",r:"2"}],["circle",{cx:"5",cy:"19",r:"2"}],["path",{d:"M10.4 21.9a10 10 0 0 0 9.941-15.416"}],["path",{d:"M13.5 2.1a10 10 0 0 0-9.841 15.416"}]]];const od=["svg",Y,[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M15 3v18"}]]];const id=["svg",Y,[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M3 9h18"}],["path",{d:"M9 21V9"}]]];const ad=["svg",Y,[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1"}]]];const ld=["svg",Y,[["polygon",{points:"6 3 20 12 6 21 6 3"}]]];const cd=["svg",Y,[["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"}]]];const dd=["svg",Y,[["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"}]]];const ud=["svg",Y,[["circle",{cx:"11",cy:"11",r:"8"}],["path",{d:"m21 21-4.3-4.3"}]]];const fd=["svg",Y,[["path",{d:"M20 7h-9"}],["path",{d:"M14 17H5"}],["circle",{cx:"17",cy:"17",r:"3"}],["circle",{cx:"7",cy:"7",r:"3"}]]];const hd=["svg",Y,[["line",{x1:"21",x2:"14",y1:"4",y2:"4"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22"}]]];const Ra=["svg",Y,[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"}],["path",{d:"M20 3v4"}],["path",{d:"M22 5h-4"}],["path",{d:"M4 17v2"}],["path",{d:"M5 18H3"}]]];const pd=["svg",Y,[["polyline",{points:"4 17 10 11 4 5"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19"}]]];const Pa=["svg",Y,[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z"}],["path",{d:"M16 9a5 5 0 0 1 0 6"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728"}]]];const gd=["svg",Y,[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15"}]]];const md=["svg",Y,[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]]];const vd=({icons:e={},nameAttr:t="data-lucide",attrs:n={}}={})=>{if(!Object.values(e).length)throw new Error(`Please provide an icons object.
|
|
3
|
+
If you want to use all the icons you can import it like:
|
|
4
|
+
\`import { createIcons, icons } from 'lucide';
|
|
5
|
+
lucide.createIcons({icons});\``);if(typeof document>"u")throw new Error("`createIcons()` only works in a browser environment.");const s=document.querySelectorAll(`[${t}]`);if(Array.from(s).forEach(r=>gi(r,{nameAttr:t,icons:e,attrs:n})),t==="data-lucide"){const r=document.querySelectorAll("[icon-name]");r.length>0&&(console.warn("[Lucide] Some icons were found with the now deprecated icon-name attribute. These will still be replaced for backwards compatibility, but will no longer be supported in v1.0 and you should switch to data-lucide"),Array.from(r).forEach(o=>gi(o,{nameAttr:"icon-name",icons:e,attrs:n})))}},mi=["#b0e9d6","#8eaff4","#d7a1f1","#eac594","#8cdbdf","#e7a3b8","#a8ca91"];function $n(e){let t=2166136261;for(let n=0;n<e.length;n++)t=Math.imul(t^e.charCodeAt(n),16777619);return t=Math.imul(t^t>>>16,2246822507),t=Math.imul(t^t>>>13,3266489909),t^=t>>>16,(t>>>0)/4294967295}function jn(e){return e.replace(/\/$/,"").split("/").at(-1)||"/"}const sn=e=>Math.max(e.created,e.activity?.lastMessageAt||e.created),vi=(e,t)=>(e-t.start)/Math.max(1,t.end-t.start)*300-150,Va=(e,t)=>[t,e.position[1],e.position[2]],xv=(e,t)=>[Va(e,Math.max(e.startPosition[0],Math.min(t.startPosition[0],e.position[0]))),t.startPosition];function yd(e,t){if(!e.length)return{nodes:[],edges:[],lanes:[],start:0,end:0};const n=[...e].sort((m,c)=>m.created-c.created||m.id.localeCompare(c.id)),s=n[0].created,r=n.reduce((m,c)=>Math.max(m,sn(c)),s+36e5),o=new Map;for(const m of n){const c=`${m.projectID}:${m.directory}`,g=o.get(c)||[];g.push(m),o.set(c,g)}const i=[...o].sort((m,c)=>c[1].length-m[1].length||m[0].localeCompare(c[0])),a=[],d=[];i.forEach(([m,c],g)=>{const b=g*2.399963,w=g===0?0:15+Math.sqrt(g)*14,A=Math.cos(b)*w,D=Math.sin(b)*w*.7,M=mi[g%mi.length],$=t.find(T=>T.id===c[0].projectID),v=c[0].directory,S={key:m,label:jn(v),color:M,kind:$?.worktrees.includes(v)?"worktree":"directory",y:A,z:D,nodes:[]};for(const T of c){const L=vi(sn(T),{start:s,end:r}),E=vi(T.created,{start:s,end:r}),O=$n(T.id),V=!!(T.parentID||T.forkID)?12:6,H=Math.sin((E+150)/65+g*.7)*3.5,K={session:T,position:[L,A+H+(O-.5)*V,D+($n(T.id+"z")-.5)*V],startPosition:[E,0,0],color:M,radius:.35+Math.min(.65,Math.log10(1+(T.tokens||0))*.08)};d.push(K),S.nodes.push(K)}a.push(S)});const l=new Set(n.map(m=>m.id)),f=[];for(const m of n)m.forkID&&l.has(m.forkID)?f.push({from:m.forkID,to:m.id,kind:"fork"}):m.parentID&&l.has(m.parentID)&&f.push({from:m.parentID,to:m.id,kind:"child"});const u=new Map(d.map(m=>[m.session.id,m])),h=new Set;function p(m,c=new Set){const g=m.session.id;if(h.has(g)||c.has(g))return;c.add(g);const b=m.session.forkID||m.session.parentID,w=b?u.get(b):void 0;if(w&&w.session.directory===m.session.directory){p(w,c);const A=$n(g+"branch")>.5?1:-1;m.position[1]=w.position[1]+A*(9+$n(g)*15),m.position[2]=w.position[2]+($n(g+"depth")-.5)*18}h.add(g)}return n.forEach(m=>p(u.get(m.id))),d.forEach(m=>{m.startPosition=Va(m,m.startPosition[0])}),{nodes:d,edges:f,lanes:a,start:s,end:r}}function bd(){const e=new AbortController,t={signal:e.signal};let n,s=innerWidth<760;function r(l,f,u){const h=Math.max(12,Math.min(f,innerWidth-l.offsetWidth-12)),p=Math.max(72,Math.min(u,innerHeight-l.offsetHeight-12));Object.assign(l.style,{left:`${h}px`,top:`${p}px`,right:"auto",bottom:"auto",transform:"none"}),l.dataset.positioned="true"}function o(){if(!n)return;const{panel:l,handle:f,pointerID:u}=n;n=void 0,l.classList.remove("dragging"),f.hasPointerCapture(u)&&f.releasePointerCapture(u)}document.addEventListener("pointerdown",l=>{if(l.button!==0)return;const f=l.target,u=f.closest(".floating-panel");if(!u)return;document.querySelectorAll(".floating-panel").forEach(m=>m.classList.toggle("front",m===u));const h=f.closest("[data-drag-panel]");if(!h)return;u.querySelectorAll(".custom-dates[open]").forEach(m=>{m.open=!1}),l.preventDefault(),h.focus({preventScroll:!0});const p=u.getBoundingClientRect();n={panel:u,handle:h,pointerID:l.pointerId,x:l.clientX,y:l.clientY,left:p.left,top:p.top},h.setPointerCapture(l.pointerId),u.classList.add("dragging")},t),document.addEventListener("pointermove",l=>{!n||l.pointerId!==n.pointerID||r(n.panel,n.left+l.clientX-n.x,n.top+l.clientY-n.y)},t),document.addEventListener("pointerup",o,t),document.addEventListener("pointercancel",o,t),document.addEventListener("lostpointercapture",o,t),document.addEventListener("keydown",l=>{const u=l.target.closest("[data-drag-panel]")?.closest(".floating-panel");if(!u||!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(l.key))return;l.preventDefault();const h=u.getBoundingClientRect(),p=l.shiftKey?40:10;r(u,h.left+(l.key==="ArrowLeft"?-p:l.key==="ArrowRight"?p:0),h.top+(l.key==="ArrowUp"?-p:l.key==="ArrowDown"?p:0))},t);const i=[...document.querySelectorAll(".floating-panel")],a=l=>{if(l.hidden||!l.dataset.positioned)return;const f=l.getBoundingClientRect();r(l,f.left,f.top)},d=new ResizeObserver(l=>l.forEach(f=>a(f.target)));return i.forEach(l=>d.observe(l)),window.addEventListener("resize",()=>{o(),s!==innerWidth<760?(s=innerWidth<760,i.forEach(l=>{l.removeAttribute("style"),delete l.dataset.positioned})):i.forEach(a)},t),()=>{o(),e.abort(),d.disconnect()}}const wd=2,yi=e=>JSON.stringify([wd,e.revision,e.updated,e.created,e.projectID,e.directory]),rn=e=>e.normalize("NFKD").replace(new RegExp("\\p{M}","gu"),"").toLowerCase(),To=e=>rn(e).match(/[\p{L}\p{N}]+/gu)||[],Ed=e=>To(e).join(" ");function Sd(e){const t={text:"",terms:[],phrases:[],filters:[]},n=[];for(const s of e.slice(0,300).match(/(?:[^\s"]+|"[^"]*")+/g)||[]){const r=/^(source|project|dir|model|is|after|before|in):(.+)$/i.exec(s);if(r){const i=r[1].toLowerCase(),a=rn(r[2].replace(/^"|"$/g,""));if(i==="in"){const d={title:["title"],files:["files"],messages:["body"],tools:["tools"]};t.fields=d[a],t.fields||(t.error="Use in:title, in:files, in:messages, or in:tools.")}else i==="is"&&!["fork","child","root","archived"].includes(a)?t.error="Use is:fork, is:child, is:root, or is:archived.":["after","before"].includes(i)&&(!/^\d{4}-\d{2}-\d{2}$/.test(a)||!Number.isFinite(Date.parse(a))||new Date(a).toISOString().slice(0,10)!==a)?t.error="Use a valid date in YYYY-MM-DD format.":t.filters.push([i,a]);continue}const o=s.replace(/^"|"$/g,"");s.startsWith('"')&&s.endsWith('"')&&t.phrases.push(Ed(o)),n.push(o)}return t.text=n.join(" "),t.terms=To(t.text).slice(0,12),t.text=t.terms.join(" "),t}function xd(e,t,n=220){const s=rn(e),r=t.reduce((i,a)=>{const d=s.indexOf(a);return d<0?i:Math.min(i,d)},1/0),o=Number.isFinite(r)?Math.max(0,r-55):0;return`${o?"…":""}${e.slice(o,o+n).replace(/\s+/g," ").trim()}${e.length>o+n?"…":""}`}const je=e=>({opencode:"OpenCode","claude-code":"Claude Code",codex:"Codex",cursor:"Cursor",gemini:"Gemini CLI","qwen-code":"Qwen Code",pi:"Pi",copilot:"GitHub Copilot CLI",cline:"Cline","roo-code":"Roo Code","kilo-code":"Kilo Code",continue:"Continue"})[e||"opencode"]||e||"Unknown",Ue=e=>{const t={opencode:"opencode","claude-code":"claude",codex:"openai",cursor:"cursor"}[e||""]||"generic";return`<span class="source-icon source-icon-${t}" aria-hidden="true" style="--source-icon:url('/sources/${t}.svg')"></span>`},Na=e=>[...e].sort((t,n)=>Number(n.selected||n.available||n.sessions>0)-Number(t.selected||t.available||t.sessions>0)||t.name.localeCompare(n.name)),$e=e=>e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]);function In(e,t){const n=new Set(t.map(rn));let s=0,r="";for(const o of e.matchAll(/[\p{L}\p{N}]+/gu)){r+=$e(e.slice(s,o.index));const i=rn(o[0]),a=[...n].some(d=>i.startsWith(d));r+=a?`<mark>${$e(o[0])}</mark>`:$e(o[0]),s=o.index+o[0].length}return r+$e(e.slice(s))}function $d(e,t=()=>{},n){const s=new Worker(new URL("/assets/worker-YMPBjASm.js",import.meta.url),{type:"module"}),r=new AbortController,o={signal:r.signal},i=document.createElement("dialog");i.className="search-dialog",i.setAttribute("aria-label","Search sessions"),i.innerHTML=`
|
|
6
|
+
<div class="search-command"><span class="search-command-icon" aria-hidden="true">⌕</span><input id="session-query" type="search" placeholder="Search sessions, messages, files…" autocomplete="off" spellcheck="false" role="combobox" aria-label="Search all sessions" aria-autocomplete="list" aria-expanded="true" aria-controls="search-results"/><button class="icon-button search-close" aria-label="Close search" title="Close (Esc)">×</button></div>
|
|
7
|
+
<div class="search-options"><select id="search-scope" aria-label="Search scope" title="Switch scope (Alt+S)"><option value="all">All history</option><option value="view">Current view</option></select><button id="search-conversations" class="search-chip" aria-label="Index conversations" aria-pressed="true" title="Pause or resume background indexing. Indexed messages, tools, and files remain searchable.">Conversations</button><span id="search-index-state" role="status">Loading index…</span></div>
|
|
8
|
+
<div class="search-body"><div id="search-results" class="search-results" role="listbox" aria-label="Matching sessions"><div class="search-results-inner"></div></div><aside id="search-preview" class="search-preview" aria-label="Session preview"></aside></div>
|
|
9
|
+
<div class="search-footer"><span id="search-result-status" role="status">Loading sessions…</span><button id="search-more" hidden>More results</button><details class="search-syntax"><summary title="Search filters and cache">Filters</summary><div><code>project:sessiongraph</code><code>model:claude</code><code>in:files package.json</code><code>is:fork</code><code>after:2026-09-01</code><code>"exact phrase"</code><button id="search-clear-cache" title="Clear saved search text and pause indexing. Titles remain searchable; enable Conversations to rebuild.">Clear saved index</button></div></details><span class="search-keys"><kbd>↑↓</kbd> navigate <kbd>↵</kbd> open</span></div>`,document.body.append(i);const a=y=>i.querySelector(y),d=a("#session-query"),l=a("#search-results"),f=a(".search-results-inner"),u=a("#search-preview"),h=a("#search-scope");let p=new Map,m=new Map,c,g=[],b=0,w=0,A=0,D=80,M=0,$=0,v=0,S=!1,T=!1,L=!0,E,O=null,R,V=0,H="",K="",se=!1;const Z=new Map,z=86,Se=y=>s.postMessage(y);function Sn(){if(!E)return;const y=a("#search-index-state");y.textContent=E.storage==="restoring"?"Restoring saved index…":E.complete===E.total&&E.total?`Conversations ready${E.storage==="local"?" · saved locally":""}`:`${E.indexed.toLocaleString()} / ${E.total.toLocaleString()} conversations${L?E.active?" · indexing":" · partial":" · paused"}`,y.title=`Titles and metadata cover all ${E.total.toLocaleString()} imported sessions. ${E.complete.toLocaleString()} conversations have all supported text indexed. ${E.failed?`${E.failed} unavailable; toggle Conversations to retry. `:""}${E.limited?"Large histories are sampled; missing matches may be in unindexed text. ":""}${E.storage==="memory"?"Saving unavailable; search continues in memory.":`Saved in local SQLite. ${E.restored.toLocaleString()} conversations restored; unchanged pages are reused. Clear saved index under Filters. Imported sessions remain saved.`}`}function Ye(){if(f.style.height=`${g.length*z}px`,!g.length){f.innerHTML=`<div class="search-empty">${$e(K||(S?"Searching…":d.value?"No matching sessions":"No sessions available"))}</div>`,d.removeAttribute("aria-activedescendant");return}const y=Math.max(0,Math.floor(l.scrollTop/z)-3),I=Math.min(g.length,y+Math.ceil(l.clientHeight/z)+7);f.innerHTML=g.slice(y,I).map((N,Q)=>{const B=y+Q,j=p.get(N.id);if(!j)return"";const ie=`${je(j.source)} · ${m.get(j.projectID)||j.directory.split("/").at(-1)||"Global"} · ${new Date(j.updated).toLocaleDateString(void 0,{month:"short",day:"numeric"})}`;return`<div id="search-hit-${B}" class="search-result ${B===b?"active":""}" role="option" aria-selected="${B===b}" aria-posinset="${B+1}" aria-setsize="${w}" data-result-index="${B}" style="top:${B*z}px"><div class="search-result-title">${In(j.title,N.terms)}</div><div class="search-result-meta"><span>${Ue(j.source)}${$e(ie)}</span><span class="match-kind">${$e(N.source)}</span></div>${N.excerpt?`<div class="search-result-excerpt">${In(N.excerpt,N.terms)}</div>`:`<div class="search-result-excerpt">${$e(j.model)}</div>`}</div>`}).join(""),b>=y&&b<I?d.setAttribute("aria-activedescendant",`search-hit-${b}`):d.removeAttribute("aria-activedescendant")}function Ke(y,I=!1,N=!1){const Q=g[b],B=Q&&p.get(Q.id);if(!B){u.innerHTML="";return}const j=Q.terms.length?Q.terms:To(Sd(d.value).text),ie=y?.fragments.filter(re=>{const Ne=rn(re.text);return j.length&&j.every(Fe=>Ne.includes(Fe))}).slice(0,4)||[],Me=y?.fragments.filter(re=>["You","Assistant"].includes(re.kind)).slice(0,5).reverse()||[],Ve=ie.length?ie:Me;if(u.innerHTML=`<div class="search-preview-heading"><span>${$e(m.get(B.projectID)||"Session")}</span><h2>${In(B.title,j)}</h2><p>${$e(B.model)} · ${new Date(B.created).toLocaleDateString()}</p><button class="secondary-button search-open">Explore session <span aria-hidden="true">↗</span></button></div>${Q.excerpt?`<section class="search-preview-section"><h3>Matching passage</h3><p>${In(Q.excerpt,j)}</p></section>`:""}<section class="search-preview-section"><h3>${ie.length?"Matching context":"Recent conversation"}</h3>${I?'<p class="preview-loading">Loading preview…</p>':N?'<p>Preview unavailable.</p><button class="text-button preview-retry">Retry</button>':Ve.length?Ve.map(re=>`<article><span>${$e(re.kind)}</span><p>${In(xd(re.text,j,360),j)}</p></article>`).join(""):"<p>No conversation text in this batch.</p>"}${y&&(y.nextCursor||y.truncated)?'<p class="preview-coverage">Recent messages · partial preview</p>':""}</section>`,u.querySelector(".search-open")?.addEventListener("click",xn,o),n){const re=document.createElement("button");re.className="text-button search-launch",re.innerHTML=`${Ue(B.source)}Open in ${$e(je(B.source))} ↗`,re.addEventListener("click",()=>n(B),o),u.querySelector(".search-preview-heading")?.append(re)}u.querySelector(".preview-retry")?.addEventListener("click",()=>{H="",kt()},o)}function kt(){const y=g[b],I=y&&p.get(y.id),N=I?`${I.id}:${yi(I)}:${d.value}`:"";if(N===H)return;if(H=N,window.clearTimeout(V),R?.abort(),!I){Ke();return}const Q=`${I.id}:${yi(I)}`,B=Z.get(Q);if(B){Ke(B);return}Ke(void 0,!0),V=window.setTimeout(async()=>{const j=new AbortController;R=j;try{const ie=await fetch(`/api/sessiongraph/session/${encodeURIComponent(I.id)}/content?updated=${I.updated}`,{signal:j.signal});if(!ie.ok)throw new Error("Preview unavailable");const Me=await ie.json();if(j.signal.aborted||N!==H)return;Z.size>=25&&Z.delete(Z.keys().next().value),Z.set(Q,Me),Ke(Me)}catch{!j.signal.aborted&&N===H&&Ke(void 0,!1,!0)}},90)}function Ut(){cancelAnimationFrame(M),S=!0,d.setAttribute("aria-busy","true");const y=++A;$=performance.now(),M=requestAnimationFrame(()=>Se({type:"query",request:y,text:d.value,viewOnly:h.value==="view",limit:D}))}function yt(){b=0,se=!1,D=80,l.scrollTop=0,H="",Ut()}function At(y){if(!g.length)return;se=!0,b=Math.max(0,Math.min(g.length-1,b+y));const I=b*z;I<l.scrollTop?l.scrollTop=I:I+z>l.scrollTop+l.clientHeight&&(l.scrollTop=I+z-l.clientHeight),Ye(),kt()}function bt(){i.close(),t(!1),R?.abort(),window.clearTimeout(V),H="",O?.focus({preventScroll:!0})}function xn(){const y=g[b];!y||S||(bt(),e(y.id))}function C(){i.open||(O=document.activeElement,i.showModal()),t(!0),d.focus({preventScroll:!0}),d.select(),Ut(),L&&Se({type:"warm",enabled:!0})}s.onmessage=y=>{const I=y.data;if(I.type==="status"){E=I.status,Sn();return}if(I.type==="error"){K=I.message,S=!1,d.setAttribute("aria-busy","false"),Ye();return}if(I.request!==A)return;const N=g[b]?.id;v=S?performance.now()-$:v,S=!1,d.setAttribute("aria-busy","false"),g=I.hits,w=I.total,K=I.error||"",b=Math.max(0,Math.min(g.length-1,se&&N?g.findIndex(Q=>Q.id===N):0)),a("#search-result-status").textContent=K||`${w.toLocaleString()} ${d.value?"matches":"sessions"} · ${Math.round(I.elapsed)} ms`,a("#search-more").hidden=g.length>=w||D>=250,i.open&&(Ye(),kt())},s.onerror=()=>{K="Search could not start. Reload to retry.",S=!1,Ye()},d.addEventListener("input",()=>{T||yt()},o),d.addEventListener("compositionstart",()=>{T=!0},o),d.addEventListener("compositionend",()=>{T=!1,yt()},o),h.addEventListener("change",yt,o),l.addEventListener("scroll",Ye,o),l.addEventListener("click",y=>{const I=y.target.closest("[data-result-index]");I&&(b=Number(I.dataset.resultIndex),se=!0,Ye(),kt(),d.focus())},o),l.addEventListener("dblclick",xn,o),a("#search-more").addEventListener("click",()=>{D=Math.min(250,D+80),Ut()},o),a("#search-conversations").addEventListener("click",()=>{L=!L,a("#search-conversations").setAttribute("aria-pressed",String(L)),Se({type:"warm",enabled:L}),Sn()},o),a("#search-clear-cache").addEventListener("click",()=>{L=!1,a("#search-conversations").setAttribute("aria-pressed","false"),Z.clear(),H="",R?.abort(),window.clearTimeout(V),a(".search-syntax").open=!1,Se({type:"clear-cache"}),d.focus()},o),a(".search-close").addEventListener("click",bt,o),i.addEventListener("cancel",y=>{y.preventDefault(),bt()},o),i.addEventListener("keydown",y=>{y.stopPropagation(),!(T||y.isComposing)&&((y.key==="ArrowDown"||y.key==="ArrowUp")&&(y.preventDefault(),At(y.key==="ArrowDown"?1:-1)),(y.key==="PageDown"||y.key==="PageUp")&&(y.preventDefault(),At((y.key==="PageDown"?1:-1)*Math.max(1,Math.floor(l.clientHeight/z)))),y.key==="Enter"&&y.target===d&&(y.preventDefault(),xn()),y.key==="Escape"&&(y.preventDefault(),bt()),y.key.toLowerCase()==="s"&&y.altKey&&(y.preventDefault(),h.value=h.value==="view"?"all":"view",h.dispatchEvent(new Event("change",{bubbles:!0}))))},o),document.addEventListener("keydown",y=>{if(i.open||document.querySelector("dialog[open]"))return;const I=y.target,N=I.isContentEditable||I.closest('input:not([type="range"]):not([type="checkbox"]):not([type="radio"]), textarea, select');(y.key==="/"&&!N&&!y.ctrlKey&&!y.metaKey&&!y.altKey||y.key.toLowerCase()==="k"&&(y.metaKey||y.ctrlKey))&&(y.preventDefault(),C())},o);const x=new ResizeObserver(()=>{i.open&&Ye()});return x.observe(l),{open:C,setData(y){c!==y.sourceID&&(Z.clear(),H="",R?.abort(),window.clearTimeout(V)),c=y.sourceID,p=new Map(y.sessions.map(I=>[I.id,I])),m=new Map(y.projects.map(I=>[I.id,I.name])),Se({type:"data",sessions:y.sessions,projects:y.projects,sourceID:c})},setScope(y){Se({type:"scope",ids:y})},diagnostics:()=>({open:i.open,query:d.value,matches:w,renderedRows:f.querySelectorAll('[role="option"]').length,roundTripMs:v,pending:S,index:E}),dispose(){s.terminate(),r.abort(),x.disconnect(),R?.abort(),window.clearTimeout(V),cancelAnimationFrame(M),i.remove()}}}const Vn=[{id:"opencode",name:"OpenCode",command:"opencode"},{id:"claude-code",name:"Claude Code",command:"claude"},{id:"codex",name:"Codex",command:"codex"},{id:"cursor",name:"Cursor Agent",command:"cursor-agent"},{id:"gemini",name:"Gemini CLI",command:"gemini"},{id:"qwen-code",name:"Qwen Code",command:"qwen"},{id:"pi",name:"Pi",command:"pi"},{id:"copilot",name:"GitHub Copilot CLI",command:"copilot"}],br=e=>Vn.some(t=>t.id===e),Fa=e=>/^ses[a-zA-Z0-9_-]+$/.test(e);function Id(e,t){if(!Fa(t))throw new Error("Invalid session ID.");const n=new URL(e);if(!["http:","https:"].includes(n.protocol)||n.username||n.password)throw new Error("Invalid OpenCode URL.");const s=btoa(String.fromCharCode(...new TextEncoder().encode(n.origin))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return`${n.origin}/server/${s}/session/${encodeURIComponent(t)}`}var Jt=(e,t=[])=>({parts:(...n)=>{if(Td(t))return Jt(e,n);throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?")},extendWith:(...n)=>Jt(e,[...t,...n]),omit:(...n)=>Jt(e,t.filter(s=>!n.includes(s))),rename:n=>Jt(n,t),keys:()=>t,build:()=>[...new Set(t)].reduce((n,s)=>Object.assign(n,{[s]:{selector:[`&[data-scope="${qt(e)}"][data-part="${qt(s)}"]`,`& [data-scope="${qt(e)}"][data-part="${qt(s)}"]`].join(", "),attrs:{"data-scope":qt(e),"data-part":qt(s)}}}),{})}),qt=e=>e.replace(/([A-Z])([A-Z])/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),Td=e=>e.length===0,Cd=Jt("select").parts("label","positioner","trigger","indicator","clearTrigger","item","itemText","itemIndicator","itemGroup","itemGroupLabel","list","content","root","control","valueText"),pe=Cd.build(),kd=Object.defineProperty,Ad=(e,t,n)=>t in e?kd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_=(e,t,n)=>Ad(e,typeof t!="symbol"?t+"":t,n);function Ld(e){return e==null?[]:Array.isArray(e)?e:[e]}var Od=e=>e[e.length-1],Md=(e,t)=>e.indexOf(t)!==-1,Dd=(e,...t)=>e.concat(t),Rd=(e,...t)=>e.filter(n=>!t.includes(n)),bi=(e,t)=>Md(e,t)?Rd(e,t):Dd(e,t);function wi(e,t){return e.reduce((n,s,r)=>(r%t===0?n.push([s]):Od(n)?.push(s),n),[])}var Ei=e=>e?.constructor.name==="Array",Pd=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!mn(e[n],t[n]))return!1;return!0},mn=(e,t)=>{if(Object.is(e,t))return!0;if(e==null&&t!=null||e!=null&&t==null)return!1;if(typeof e?.isEqual=="function"&&typeof t?.isEqual=="function")return e.isEqual(t);if(typeof e=="function"&&typeof t=="function")return e.toString()===t.toString();if(Ei(e)&&Ei(t))return Pd(Array.from(e),Array.from(t));if(typeof e!="object"||typeof t!="object")return!1;const n=Object.keys(t??Object.create(null)),s=n.length;if(Object.keys(e).length!==s)return!1;for(let r=0;r<s;r++)if(!Reflect.has(e,n[r]))return!1;for(let r=0;r<s;r++){const o=n[r];if(!mn(e[o],t[o]))return!1}return!0},Vd=e=>Array.isArray(e),Ha=e=>e!=null&&typeof e=="object",wr=e=>Ha(e)&&!Vd(e),Nd=e=>typeof e=="string",Je=e=>typeof e=="function",Fd=e=>e==null,Cs=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Hd=e=>Object.prototype.toString.call(e),_a=Function.prototype.toString,_d=_a.call(Object),Nn=e=>{if(!Ha(e)||Hd(e)!="[object Object]"||jd(e))return!1;const t=Object.getPrototypeOf(e);if(t===null)return!0;const n=Cs(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&_a.call(n)==_d},Bd=e=>typeof e=="object"&&e!==null&&"$$typeof"in e&&"props"in e,Wd=e=>typeof e=="object"&&e!==null&&"__v_isVNode"in e,jd=e=>Bd(e)||Wd(e),Si=(e,...t)=>(typeof e=="function"?e(...t):e)??void 0,Ud=e=>e(),Ba=()=>{},Hs=(...e)=>(...t)=>{e.forEach(function(n){n?.(...t)})};function zr(e,t,...n){if(e in t){const r=t[e];return Je(r)?r(...n):r}const s=new Error(`No matching key: ${JSON.stringify(e)} in ${JSON.stringify(Object.keys(t))}`);throw Error.captureStackTrace?.(s,zr),s}var{min:qd,max:Gd}=Math,Yd=e=>Number.isNaN(e),Wa=e=>Yd(e)?0:e,Er=(e,t,n)=>{const s=Wa(e),r=t==null||s>=t,o=n==null||s<=n;return r&&o},Kd=(e,t,n)=>qd(Gd(Wa(e),t),n);function Co(e){if(!Nn(e)||e===void 0)return e;const t=Reflect.ownKeys(e).filter(s=>typeof s=="string"),n={};for(const s of t){const r=e[s];r!==void 0&&(n[s]=Co(r))}return n}function ja(e,t){if(!t)return e;const n={...e},s=t;for(const r in s){const o=s[r];o!==void 0&&(n[r]=o)}return n}function ks(...e){e.length===1?e[0]:e[1],e.length===2&&e[0]}function xi(...e){e.length===1?e[0]:e[1],e.length===2&&e[0]}function Qs(e,t){if(e==null)throw new Error(t())}var As={itemToValue(e){return typeof e=="string"?e:wr(e)&&Cs(e,"value")?e.value:""},itemToString(e){return typeof e=="string"?e:wr(e)&&Cs(e,"label")?e.label:As.itemToValue(e)},isItemDisabled(e){return wr(e)&&Cs(e,"disabled")?!!e.disabled:!1}},Ua=class qa{constructor(t){_(this,"options",t),_(this,"items"),_(this,"indexMap",null),_(this,"copy",n=>new qa({...this.options,items:n??[...this.items]})),_(this,"isEqual",n=>mn(this.items,n.items)),_(this,"setItems",n=>this.copy(n)),_(this,"getValues",(n=this.items)=>{const s=[];for(const r of n){const o=this.getItemValue(r);o!=null&&s.push(o)}return s}),_(this,"find",n=>{if(n==null)return null;const s=this.indexOf(n);return s!==-1?this.at(s):null}),_(this,"findMany",n=>{const s=[];for(const r of n){const o=this.find(r);o!=null&&s.push(o)}return s}),_(this,"at",n=>{if(!this.options.groupBy&&!this.options.groupSort)return this.items[n]??null;let s=0;const r=this.group();for(const[,o]of r)for(const i of o){if(s===n)return i;s++}return null}),_(this,"sortFn",(n,s)=>{const r=this.indexOf(n),o=this.indexOf(s);return(r??0)-(o??0)}),_(this,"sort",n=>[...n].sort(this.sortFn.bind(this))),_(this,"getItemValue",n=>n==null?null:this.options.itemToValue?.(n)??As.itemToValue(n)),_(this,"getItemDisabled",n=>n==null?!1:this.options.isItemDisabled?.(n)??As.isItemDisabled(n)),_(this,"stringifyItem",n=>n==null?null:this.options.itemToString?.(n)??As.itemToString(n)),_(this,"stringify",n=>n==null?null:this.stringifyItem(this.find(n))),_(this,"stringifyItems",(n,s=", ")=>{const r=[];for(const o of n){const i=this.stringifyItem(o);i!=null&&r.push(i)}return r.join(s)}),_(this,"stringifyMany",(n,s)=>this.stringifyItems(this.findMany(n),s)),_(this,"has",n=>this.indexOf(n)!==-1),_(this,"hasItem",n=>n==null?!1:this.has(this.getItemValue(n))),_(this,"group",()=>{const{groupBy:n,groupSort:s}=this.options;if(!n)return[["",[...this.items]]];const r=new Map;this.items.forEach((i,a)=>{const d=n(i,a);r.has(d)||r.set(d,[]),r.get(d).push(i)});let o=Array.from(r.entries());return s&&o.sort(([i],[a])=>{if(typeof s=="function")return s(i,a);if(Array.isArray(s)){const d=s.indexOf(i),l=s.indexOf(a);return d===-1?1:l===-1?-1:d-l}return s==="asc"?i.localeCompare(a):s==="desc"?a.localeCompare(i):0}),o}),_(this,"getNextValue",(n,s=1,r=!1)=>{let o=this.indexOf(n);if(o===-1)return null;for(o=r?Math.min(o+s,this.size-1):o+s;o<=this.size&&this.getItemDisabled(this.at(o));)o++;return this.getItemValue(this.at(o))}),_(this,"getPreviousValue",(n,s=1,r=!1)=>{let o=this.indexOf(n);if(o===-1)return null;for(o=r?Math.max(o-s,0):o-s;o>=0&&this.getItemDisabled(this.at(o));)o--;return this.getItemValue(this.at(o))}),_(this,"indexOf",n=>{if(n==null)return-1;if(!this.options.groupBy&&!this.options.groupSort)return this.items.findIndex(s=>this.getItemValue(s)===n);if(!this.indexMap){this.indexMap=new Map;let s=0;const r=this.group();for(const[,o]of r)for(const i of o){const a=this.getItemValue(i);a!=null&&this.indexMap.set(a,s),s++}}return this.indexMap.get(n)??-1}),_(this,"getByText",(n,s)=>{const r=s!=null?this.indexOf(s):-1,o=n.length===1;for(let i=0;i<this.items.length;i++){const a=this.items[(r+i+1)%this.items.length];if(!(o&&this.getItemValue(a)===s)&&!this.getItemDisabled(a)&&zd(this.stringifyItem(a),n))return a}}),_(this,"search",(n,s)=>{const{state:r,currentValue:o,timeout:i=350}=s,a=r.keysSoFar+n,l=a.length>1&&Array.from(a).every(m=>m===a[0])?a[0]:a,f=this.getByText(l,o),u=this.getItemValue(f);function h(){clearTimeout(r.timer),r.timer=-1}function p(m){r.keysSoFar=m,h(),m!==""&&(r.timer=+setTimeout(()=>{p(""),h()},i))}return p(a),u}),_(this,"update",(n,s)=>{let r=this.indexOf(n);return r===-1?this:this.copy([...this.items.slice(0,r),s,...this.items.slice(r+1)])}),_(this,"upsert",(n,s,r="append")=>{let o=this.indexOf(n);return o===-1?(r==="append"?this.append:this.prepend)(s):this.copy([...this.items.slice(0,o),s,...this.items.slice(o+1)])}),_(this,"insert",(n,...s)=>this.copy(Tn(this.items,n,...s))),_(this,"insertBefore",(n,...s)=>{let r=this.indexOf(n);if(r===-1)if(this.items.length===0)r=0;else return this;return this.copy(Tn(this.items,r,...s))}),_(this,"insertAfter",(n,...s)=>{let r=this.indexOf(n);if(r===-1)if(this.items.length===0)r=0;else return this;return this.copy(Tn(this.items,r+1,...s))}),_(this,"prepend",(...n)=>this.copy(Tn(this.items,0,...n))),_(this,"append",(...n)=>this.copy(Tn(this.items,this.items.length,...n))),_(this,"filter",n=>{const s=this.items.filter((r,o)=>n(this.stringifyItem(r),o,r));return this.copy(s)}),_(this,"remove",(...n)=>{const s=n.map(r=>typeof r=="string"?r:this.getItemValue(r));return this.copy(this.items.filter(r=>{const o=this.getItemValue(r);return o==null?!1:!s.includes(o)}))}),_(this,"move",(n,s)=>{const r=this.indexOf(n);return r===-1?this:this.copy(as(this.items,[r],s))}),_(this,"moveBefore",(n,...s)=>{let r=this.items.findIndex(i=>this.getItemValue(i)===n);if(r===-1)return this;let o=s.map(i=>this.items.findIndex(a=>this.getItemValue(a)===i)).sort((i,a)=>i-a);return this.copy(as(this.items,o,r))}),_(this,"moveAfter",(n,...s)=>{let r=this.items.findIndex(i=>this.getItemValue(i)===n);if(r===-1)return this;let o=s.map(i=>this.items.findIndex(a=>this.getItemValue(a)===i)).sort((i,a)=>i-a);return this.copy(as(this.items,o,r+1))}),_(this,"reorder",(n,s)=>this.copy(as(this.items,[n],s))),_(this,"compareValue",(n,s)=>{const r=this.indexOf(n),o=this.indexOf(s);return r<o?-1:r>o?1:0}),_(this,"range",(n,s)=>{let r=[],o=n;for(;o!=null;){if(this.find(o)&&r.push(o),o===s)return r;o=this.getNextValue(o)}return[]}),_(this,"getValueRange",(n,s)=>n&&s?this.compareValue(n,s)<=0?this.range(n,s):this.range(s,n):[]),_(this,"toString",()=>{let n="";for(const s of this.items){const r=this.getItemValue(s),o=this.stringifyItem(s),i=this.getItemDisabled(s),a=[r,o,i].filter(Boolean).join(":");n+=a+","}return n}),_(this,"toJSON",()=>({size:this.size,first:this.firstValue,last:this.lastValue})),this.items=[...t.items]}get size(){return this.items.length}get firstValue(){let t=0;for(;this.getItemDisabled(this.at(t));)t++;return this.getItemValue(this.at(t))}get lastValue(){let t=this.size-1;for(;this.getItemDisabled(this.at(t));)t--;return this.getItemValue(this.at(t))}*[Symbol.iterator](){yield*this.items}},zd=(e,t)=>!!e?.toLowerCase().startsWith(t.toLowerCase());function Tn(e,t,...n){return[...e.slice(0,t),...n,...e.slice(t)]}function as(e,t,n){t=[...t].sort((r,o)=>r-o);const s=t.map(r=>e[r]);for(let r=t.length-1;r>=0;r--)e=[...e.slice(0,t[r]),...e.slice(t[r]+1)];return n=Math.max(0,n-t.filter(r=>r<n).length),[...e.slice(0,n),...s,...e.slice(n)]}function Ga({values:e,collection:t,selectedItemMap:n}){const s=[];for(const r of e){const o=t.find(r)??n.get(r);o!=null&&s.push(o)}return s}function Ya({selectedItemMap:e,values:t,selectedItems:n,collection:s}){const r=new Map(e);for(const i of n){const a=s.getItemValue(i);a!=null&&r.set(a,i)}const o=new Set(t);for(const i of r.keys())o.has(i)||r.delete(i);return r}function ls({values:e,collection:t,selectedItemMap:n}){const s=Ga({values:e,collection:t,selectedItemMap:n}),r=Ya({selectedItemMap:n,values:e,selectedItems:s,collection:t});return{selectedItems:s,nextSelectedItemMap:r}}function Zd({selectedItems:e,collection:t}){return Ya({selectedItemMap:new Map,values:e.map(n=>t.getItemValue(n)).filter(Boolean),selectedItems:e,collection:t})}var _s=e=>new Ua(e);_s.empty=()=>new Ua({items:[]});var Jd=Object.defineProperty,Xd=(e,t,n)=>t in e?Jd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Sr=(e,t,n)=>Xd(e,typeof t!="symbol"?t+"":t,n),Qd=(e,t)=>e.map((n,s)=>e[(Math.max(t,0)+s)%e.length]),Bs=()=>{},er=e=>typeof e=="object"&&e!==null,P=e=>e?"":void 0,ue=e=>e?"true":void 0,eu=1,tu=9,nu=11,ce=e=>er(e)&&e.nodeType===eu&&typeof e.nodeName=="string",ko=e=>er(e)&&e.nodeType===tu,su=e=>er(e)&&e===e.window,Ka=e=>ce(e)?e.localName||"":"#document";function ru(e){return["html","body","#document"].includes(Ka(e))}var za=e=>er(e)&&e.nodeType!==void 0,on=e=>za(e)&&e.nodeType===nu&&"host"in e,Za=e=>ce(e)&&e.localName==="input",ou=e=>ce(e)?e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0:!1;function Zr(e){if(!e)return!1;const t=e.getRootNode();return tr(t)===e}var iu=/(textarea|select)/;function au(e){if(e==null||!ce(e))return!1;try{return Za(e)&&e.selectionStart!=null||iu.test(e.localName)||e.isContentEditable||e.getAttribute("contenteditable")==="true"||e.getAttribute("contenteditable")===""}catch{return!1}}function an(e,t){if(!e||!t||!ce(e)||!za(t))return!1;if(ce(t)&&e===t||e.contains(t))return!0;const n=t.getRootNode?.();if(n&&on(n)){let s=t;for(;s;){if(e===s)return!0;s=s.parentNode||s.host}}return!1}function Oe(e){return ko(e)?e:su(e)?e.document:e?.ownerDocument??document}function lu(e){return Oe(e).documentElement}function he(e){return on(e)?he(e.host):ko(e)?e.defaultView??window:ce(e)?e.ownerDocument?.defaultView??window:window}function tr(e){let t=e.activeElement;for(;t?.shadowRoot;){const n=t.shadowRoot.activeElement;if(!n||n===t)break;t=n}return t}function $i(e,t){return!e||e===Oe(e).body?!1:!t.some(n=>an(n,e))}function cu(e){if(Ka(e)==="html")return e;const t=e.assignedSlot||e.parentNode||on(e)&&e.host||lu(e);return on(t)?t.host:t}function du(e){let t;try{if(t=e.getRootNode({composed:!0}),ko(t)||on(t))return t}catch{}return e.ownerDocument??document}var xr=new WeakMap;function Ja(e){return xr.has(e)||xr.set(e,he(e).getComputedStyle(e)),xr.get(e)}var Ao=()=>typeof document<"u";function uu(){return navigator.userAgentData?.platform??navigator.platform}function fu(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}var Lo=e=>Ao()&&e.test(uu()),hu=e=>Ao()&&e.test(fu()),pu=/^iPhone/i,gu=/^iPad/i,mu=/^Mac/i,vu=/Android/i,Ii=()=>Ao()&&!!navigator.maxTouchPoints,yu=()=>Lo(pu),bu=()=>Lo(gu)||Oo()&&navigator.maxTouchPoints>1,Xa=()=>yu()||bu(),Oo=()=>Lo(mu),wu=()=>hu(vu),Eu=new Set(["menu","listbox","dialog","grid","tree","region","application"]),Su=e=>Eu.has(e),xu=e=>e.getAttribute("aria-controls")?.split(" ")||[];function $u(e,t){const n=new Set,s=du(e),r=o=>{const i=o.querySelectorAll("[aria-controls]");for(const a of i){if(a.getAttribute("aria-expanded")!=="true")continue;const d=xu(a);for(const l of d){if(!l||n.has(l))continue;n.add(l);const f=s.getElementById(l);if(f){const u=f.getAttribute("role"),h=f.getAttribute("aria-modal")==="true";if(u&&Su(u)&&!h&&(f===t||f.contains(t)||r(f)))return!0}}}return!1};return r(e)}function Iu(e){return e.composedPath?.()??e.nativeEvent?.composedPath?.()}function ut(e){return Iu(e)?.[0]??e.target}function Tu(e){return Mo(e).isComposing||e.keyCode===229}function Cu(e){return e.pointerType===""&&e.isTrusted?!0:wu()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}var ku=e=>e.button===2||Oo()&&e.ctrlKey&&e.button===0,Au={Up:"ArrowUp",Down:"ArrowDown",Esc:"Escape"," ":"Space",",":"Comma",Left:"ArrowLeft",Right:"ArrowRight"},Ti={ArrowLeft:"ArrowRight",ArrowRight:"ArrowLeft"};function Jr(e,t={}){const{dir:n="ltr",orientation:s="horizontal"}=t;let r=e.key;return r=Au[r]??r,n==="rtl"&&s==="horizontal"&&r in Ti&&(r=Ti[r]),r}function Mo(e){return e.nativeEvent??e}var Ls=(e,t,n,s)=>{const r=typeof e=="function"?e():e;return r?.addEventListener(t,n,s),()=>{r?.removeEventListener(t,n,s)}};function Lu(e,t){const{type:n="HTMLInputElement",property:s="value"}=t,r=he(e)[n].prototype;return Object.getOwnPropertyDescriptor(r,s)??{}}function Ou(e){if(e.localName==="input")return"HTMLInputElement";if(e.localName==="textarea")return"HTMLTextAreaElement";if(e.localName==="select")return"HTMLSelectElement"}function cs(e,t,n="value"){if(!e)return;const s=Ou(e);s&&Lu(e,{type:s,property:n}).set?.call(e,t),e.setAttribute(n,t)}function Mu(e){return e.matches("textarea, input, select, button")}function Du(e,t){if(!e)return;const n=Mu(e)?e.form:e.closest("form"),s=r=>{r.defaultPrevented||t()};return n?.addEventListener("reset",s,{passive:!0}),()=>n?.removeEventListener("reset",s)}function Ru(e,t){const n=e?.closest("fieldset");if(!n)return;t(n.disabled);const s=he(n),r=new s.MutationObserver(()=>t(n.disabled));return r.observe(n,{attributes:!0,attributeFilter:["disabled"]}),()=>r.disconnect()}function Pu(e,t){if(!e)return;const{onFieldsetDisabledChange:n,onFormReset:s}=t,r=[Du(e,s),Ru(e,n)];return()=>r.forEach(o=>o?.())}var Qa=Symbol.for("zag.changeEvent");function el(e){return Object.prototype.hasOwnProperty.call(e,Qa)}function Vu(e){return el(e)||Object.defineProperty(e,Qa,{value:!0}),e}var Nu=e=>ce(e)&&e.tagName==="IFRAME";function Fu(e){const t=e.getAttribute("tabindex");return t?parseInt(t,10):NaN}var Hu=e=>Fu(e)<0;function _u(e){return Za(e)&&e.type==="radio"}function Bu(e){if(!_u(e)||!e.name||e.checked)return!0;const t=`input[type="radio"][name="${CSS.escape(e.name)}"]`,n=e.form??e.ownerDocument,s=Array.from(n.querySelectorAll(t)).filter(o=>o.form===e.form&&nr(o)),r=s.find(o=>o.checked);return r?r===e:s[0]===e}function Wu(e,t){if(!t)return null;if(t===!0)return e.shadowRoot||null;const n=t(e);return(n===!0?e.shadowRoot:n)||null}function ju(e,t,n){const s=[...e],r=[...e],o=new Set,i=new Map;e.forEach((d,l)=>i.set(d,l));let a=0;for(;a<r.length;){const d=r[a++];if(!d||o.has(d))continue;o.add(d);const l=Wu(d,t);if(l){const f=Array.from(l.querySelectorAll(Do)).filter(n),u=i.get(d);if(u!==void 0){const h=u+1;s.splice(h,0,...f),f.forEach((p,m)=>{i.set(p,h+m)});for(let p=h+f.length;p<s.length;p++)i.set(s[p],p)}else{const h=s.length;s.push(...f),f.forEach((p,m)=>{i.set(p,h+m)})}r.push(...f)}}return s}var Do="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false']), details > summary:first-of-type";function nr(e){return!ce(e)||e.closest("[inert]")?!1:e.matches(Do)&&ou(e)}function Ro(e,t={}){if(!e)return[];const{includeContainer:n,getShadowRoot:s}=t,r=Array.from(e.querySelectorAll(Do));n&&$r(e)&&r.unshift(e);const o=[];for(const i of r)if($r(i)){if(Nu(i)&&i.contentDocument){const a=i.contentDocument.body;o.push(...Ro(a,{getShadowRoot:s}));continue}o.push(i)}if(s){const i=ju(o,s,$r);return!i.length&&n?r:i}return!o.length&&n?r:o}function $r(e){return ce(e)&&e.tabIndex>0?!0:!nr(e)||Hu(e)?!1:Bu(e)}function Uu(e,t={}){const n=Ro(e,t),s=n[0]||null,r=n[n.length-1]||null;return[s,r]}function qu(e){const{root:t,getInitialEl:n,filter:s,enabled:r=!0}=e;if(!r)return!1;let o=typeof n=="function"?n():n;return o===!1?!1:(o||(o=t?.matches("[data-autofocus],[autofocus]")?t:t?.querySelector("[data-autofocus],[autofocus]")),o||(o=Ro(t).filter(a=>s?s(a):!0).find(a=>!a.hasAttribute("data-no-autofocus"))),o||t||void 0)}function Gu(e){const t=e.currentTarget;if(!t)return!1;const[n,s]=Uu(t);return!(Zr(n)&&e.shiftKey||Zr(s)&&!e.shiftKey||!n&&!s)}var tl=class nl{constructor(){Sr(this,"id",null),Sr(this,"fn_cleanup"),Sr(this,"cleanup",()=>{this.cancel()})}static create(){return new nl}request(t){this.cancel(),this.id=globalThis.requestAnimationFrame(()=>{this.id=null,this.fn_cleanup=t?.()})}cancel(){this.id!==null&&(globalThis.cancelAnimationFrame(this.id),this.id=null),this.fn_cleanup?.(),this.fn_cleanup=void 0}isActive(){return this.id!==null}};function fe(e){const t=tl.create();return t.request(e),t.cleanup}function sl(e){const t=new Set;function n(s){const r=globalThis.requestAnimationFrame(s);t.add(()=>globalThis.cancelAnimationFrame(r))}return n(()=>n(e)),function(){t.forEach(r=>r())}}var Ir=new WeakMap;function Yu(e){const t={childList:!0,subtree:!0,attributes:e.attributes??(e.attributeOldValue!==void 0||e.attributeFilter!==void 0),characterData:e.characterData??e.characterDataOldValue!==void 0,attributeOldValue:!!e.attributeOldValue,characterDataOldValue:!!e.characterDataOldValue};return e.attributeFilter!==void 0&&(t.attributeFilter=[...new Set(e.attributeFilter)].sort()),t}function Ku(e){const t=Yu(e),n=JSON.stringify(t);return{observe(s,r){const o=he(s);if(typeof o.MutationObserver!="function")return Bs;const i=Ir.get(s)??new Map;let a=i.get(n);if(!a){const l=new Set,f=new o.MutationObserver(u=>{for(const h of[...l])if(l.has(h))try{h(u)}catch(p){o.queueMicrotask(()=>{throw p})}});f.observe(s,t),a={observer:f,listeners:l},i.set(n,a),Ir.set(s,i)}const d=l=>r(l);return a.listeners.add(d),()=>{!a.listeners.delete(d)||a.listeners.size>0||(a.observer.disconnect(),i.delete(n),i.size===0&&Ir.delete(s))}}}}function zu(e,t){if(!e)return;const{attributes:n,callback:s}=t,r=e.ownerDocument.defaultView||window,o=new r.MutationObserver(i=>{for(const a of i)a.type==="attributes"&&a.attributeName&&n.includes(a.attributeName)&&s(a)});return o.observe(e,{attributes:!0,attributeFilter:n}),()=>o.disconnect()}function Zu(e,t){const n=fe,s=[];return s.push(n(()=>{const r=typeof e=="function"?e():e;s.push(zu(r,t))})),()=>{s.forEach(r=>r?.())}}function Xr(e){const t=cu(e);return ru(t)?Oe(t).body:ce(t)&&Qu(t)?t:Xr(t)}var Ju=/auto|scroll|overlay|hidden|clip/,Xu=new Set(["inline","contents"]);function Qu(e){const t=he(e),{overflow:n,overflowX:s,overflowY:r,display:o}=t.getComputedStyle(e);return Ju.test(n+r+s)&&!Xu.has(o)}var Ci=/auto|scroll|overlay|hidden/;function ef(e,t={}){const{axis:n}=t,{overflowX:s,overflowY:r}=he(e).getComputedStyle(e),o=n!=="y"&&Ci.test(s)&&e.scrollWidth>e.clientWidth,i=n!=="x"&&Ci.test(r)&&e.scrollHeight>e.clientHeight;return o||i}var Xt="default",Qr="",Os=new WeakMap;function tf(e={}){const{target:t,doc:n}=e,s=n??document,r=s.documentElement;return Xa()?(Xt==="default"&&(Qr=r.style.webkitUserSelect,r.style.webkitUserSelect="none"),Xt="disabled"):t&&(Os.set(t,t.style.userSelect),t.style.userSelect="none"),()=>rl({target:t,doc:s})}function rl(e={}){const{target:t,doc:n}=e,r=(n??document).documentElement;if(Xa()){if(Xt!=="disabled")return;Xt="restoring",setTimeout(()=>{sl(()=>{Xt==="restoring"&&(r.style.webkitUserSelect==="none"&&(r.style.webkitUserSelect=Qr||""),Qr="",Xt="default")})},300)}else if(t&&Os.has(t)){const o=Os.get(t);t.style.userSelect==="none"&&(t.style.userSelect=o??""),t.getAttribute("style")===""&&t.removeAttribute("style"),Os.delete(t)}}function nf(e={}){const{defer:t,target:n,...s}=e,r=t?fe:i=>i(),o=[];return o.push(r(()=>{const i=typeof n=="function"?n():n;o.push(tf({...s,target:i}))})),()=>{o.forEach(i=>i?.())}}function sf(e,t){return Array.from(e?.querySelectorAll(t)??[])}function rf(e,t){return e?.querySelector(t)??null}var Po=e=>e.id;function of(e,t,n=Po){return e.find(s=>n(s)===t)}function af(e,t,n=Po){const s=of(e,t,n);return s?e.indexOf(s):-1}function lf(e,t){const{rootEl:n,...s}=t||{};!e||!n||ef(n)&&e.scrollIntoView(s)}var ki,cf=()=>ki??(ki=new Intl.Collator(void 0,{usage:"search",sensitivity:"base"})),df=e=>e.normalize("NFC").trim(),uf=e=>df(e.dataset?.valuetext??e.textContent??""),ff=(e,t)=>{const n=t.normalize("NFC");return cf().compare(e.slice(0,n.length),n)===0};function hf(e,t,n,s=Po){const r=n?af(e,n,s):-1;let o=n?Qd(e,r):e;return t.length===1&&(o=o.filter(a=>s(a)!==n)),o.find(a=>ff(uf(a),t))}function pf(e,t){if(!e)return Bs;const n=Object.keys(t).reduce((s,r)=>(s[r]=e.style.getPropertyValue(r),s),{});return gf(n,t)?Bs:(Object.assign(e.style,t),()=>{Object.assign(e.style,n),e.style.length===0&&e.removeAttribute("style")})}function gf(e,t){return Object.keys(e).every(n=>e[n]===t[n])}function mf(e,t){const{state:n,activeId:s,key:r,timeout:o=350,itemToId:i}=t,a=n.keysSoFar+r,l=a.length>1&&Array.from(a).every(m=>m===a[0])?a[0]:a;let f=e.slice();const u=hf(f,l,s,i);function h(){clearTimeout(n.timer),n.timer=-1}function p(m){n.keysSoFar=m,h(),m!==""&&(n.timer=+setTimeout(()=>{p(""),h()},o))}return p(a),u}var eo=Object.assign(mf,{defaultOptions:{keysSoFar:"",timer:-1},isValidEvent:vf});function vf(e){return e.key.length===1&&!e.ctrlKey&&!e.metaKey}var yf={border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"};function bf(e,t,n){const{signal:s}=t;return[new Promise((i,a)=>{const d=setTimeout(()=>{a(new Error(`Timeout of ${n}ms exceeded`))},n);s.addEventListener("abort",()=>{clearTimeout(d),a(new DOMException("Promise aborted","AbortError"))}),e.then(l=>{s.aborted||(clearTimeout(d),i(l))}).catch(l=>{s.aborted||(clearTimeout(d),a(l))})}),()=>t.abort()]}function wf(e,t){const{timeout:n,rootNode:s}=t,r=he(s),o=Oe(s),i=new r.AbortController;let a;const d=bf(new Promise(f=>{const u=e();if(u){f(u);return}a=new r.MutationObserver(()=>{const h=e();h&&h.isConnected&&(a?.disconnect(),f(h))}),a.observe(o.body,{childList:!0,subtree:!0})}),i,n),l=()=>a?.disconnect();return d[0].then(l,l),d}var Ef=Ku({});function Sf(e,t,n={}){const{defer:s,onMissing:r,getRootNode:o}=n,i=()=>typeof e=="function"?e():e,a=[],d=l=>{if(!l)return r?.();a.push(t(l))};if(!s)d(i());else{let l=!1;a.push(()=>{l=!0}),queueMicrotask(()=>{if(l)return;const f=i();if(f){d(f);return}let u=!1;const h=g=>{l||u||(u=!0,m(),c(),d(g))},p=o?.(),m=p?Ef.observe(p,()=>{const g=i();g&&h(g)}):Bs,c=fe(()=>h(i()));a.push(m,c)})}return()=>{a.forEach(l=>l?.())}}function xf(e){return!(e.metaKey||!Oo()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}var $f=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),If=["a[href]","audio[controls]","button","details","embed","iframe","img[controls]","img[usemap]","input","select","textarea","video[controls]"].join(",");function Tf(e,t,n){const s=n?ut(n):null,r=Oe(s),o=he(s),i=tr(r);return e=e||i instanceof o.HTMLInputElement&&!$f.has(i?.type)||i instanceof o.HTMLTextAreaElement||i instanceof o.HTMLElement&&i.isContentEditable,!(e&&t==="keyboard"&&n instanceof o.KeyboardEvent&&!Reflect.has(kf,n.key))}var ft=null,to=new Set,Ws=new Map,Nt=!1,St=null,no=!1,Tr=null,Cf=!1,kf={Tab:!0,Escape:!0};function sr(e,t){for(let n of to)n(e,t)}function js(e){St=null,Nt=!0,xf(e)&&(ft="keyboard",sr("keyboard",e))}function Ie(e){(e.type==="pointermove"||e.type==="mousemove")&&e.isTrusted&&Tr?.x===e.clientX&&Tr?.y===e.clientY||(Tr={x:e.clientX,y:e.clientY},ft="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(St=null,Nt=!0,sr("pointer",e)))}function ol(e){if(Cu(e)){St=null,Nt=!0,ft="virtual";return}St=null;const t=ut(e),n=t?.closest("label"),s=n?.control;if(!n||!s||s.matches(":disabled"))return;const r=t?.closest(If);r&&n.contains(r)&&r!==s||s!==tr(n.ownerDocument)&&(St=s)}function il(e){const t=ut(e),n=t===St;t===he(t)||t===Oe(t)||Cf||!e.isTrusted||(!Nt&&!n&&!no&&(ft="virtual",sr("virtual",e)),Nt=!1,St=null,no=!1)}function al(){Nt=!1,St=null,no=!0}function Af(e){try{return e.focus}catch{return}}function Lf(e){const t=e.HTMLElement.prototype;try{let s=function(){Nt=!0,(r??i.call(this)).apply(this,arguments)};var n=s;const r=Af(t),o=r?void 0:Object.getOwnPropertyDescriptor(t,"focus"),i=o?.get;return!r&&!i?{focus:void 0}:(Object.defineProperty(e.HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:s}),{focus:r,descriptor:o})}catch{return{focus:void 0}}}function Of(e){if(typeof window>"u"||Ws.get(he(e)))return;const t=he(e),n=Oe(e),s=Lf(t);n.addEventListener("keydown",js,!0),n.addEventListener("keyup",js,!0),n.addEventListener("click",ol,!0),t.addEventListener("focus",il,!0),t.addEventListener("blur",al,!1),typeof t.PointerEvent<"u"?(n.addEventListener("pointerdown",Ie,!0),n.addEventListener("pointermove",Ie,!0),n.addEventListener("pointerup",Ie,!0)):(n.addEventListener("mousedown",Ie,!0),n.addEventListener("mousemove",Ie,!0),n.addEventListener("mouseup",Ie,!0)),t.addEventListener("beforeunload",()=>{Mf(e)},{once:!0}),Ws.set(t,s)}var Mf=(e,t)=>{const n=he(e),s=Oe(e),r=Ws.get(n);if(r){if(r.focus||r.descriptor)try{Object.defineProperty(n.HTMLElement.prototype,"focus",r.descriptor??{configurable:!0,writable:!0,value:r.focus})}catch{}s.removeEventListener("keydown",js,!0),s.removeEventListener("keyup",js,!0),s.removeEventListener("click",ol,!0),n.removeEventListener("focus",il,!0),n.removeEventListener("blur",al,!1),typeof n.PointerEvent<"u"?(s.removeEventListener("pointerdown",Ie,!0),s.removeEventListener("pointermove",Ie,!0),s.removeEventListener("pointerup",Ie,!0)):(s.removeEventListener("mousedown",Ie,!0),s.removeEventListener("mousemove",Ie,!0),s.removeEventListener("mouseup",Ie,!0)),Ws.delete(n)}};function so(){return ft}function Df(e){ft=e,sr(e,null)}function Ai(){return ft==="keyboard"||ft==="virtual"}function Rf(e={}){const{isTextInput:t,autoFocus:n,onChange:s,root:r}=e;Of(r),s?.({isFocusVisible:n||Ai(),modality:ft});const o=(i,a)=>{Tf(!!t,i,a)&&s?.({isFocusVisible:Ai(),modality:i})};return to.add(o),()=>{to.delete(o)}}const Pf=["top","right","bottom","left"],$t=Math.min,st=Math.max,Us=Math.round,ds=Math.floor,rt=e=>({x:e,y:e}),Vf={left:"right",right:"left",bottom:"top",top:"bottom"};function ll(e,t,n){return st(e,$t(t,n))}function ht(e,t){return typeof e=="function"?e(t):e}function It(e){return e.split("-")[0]}function vn(e){return e.split("-")[1]}function Vo(e){return e==="x"?"y":"x"}function No(e){return e==="y"?"height":"width"}function _e(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Fo(e){return Vo(_e(e))}function Nf(e,t,n){n===void 0&&(n=!1);const s=vn(e),r=Fo(e),o=No(r);let i=r==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=qs(i)),[i,qs(i)]}function Ff(e){const t=qs(e);return[ro(e),t,ro(t)]}function ro(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Li=["left","right"],Oi=["right","left"],Hf=["top","bottom"],_f=["bottom","top"];function Bf(e,t,n){switch(e){case"top":case"bottom":return n?t?Oi:Li:t?Li:Oi;case"left":case"right":return t?Hf:_f;default:return[]}}function Wf(e,t,n,s){const r=vn(e);let o=Bf(It(e),n==="start",s);return r&&(o=o.map(i=>i+"-"+r),t&&(o=o.concat(o.map(ro)))),o}function qs(e){const t=It(e);return Vf[t]+e.slice(t.length)}function jf(e){var t,n,s,r;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(s=e.bottom)!=null?s:0,left:(r=e.left)!=null?r:0}}function cl(e){return typeof e!="number"?jf(e):{top:e,right:e,bottom:e,left:e}}function Gs(e){const{x:t,y:n,width:s,height:r}=e;return{width:s,height:r,top:n,left:t,right:t+s,bottom:n+r,x:t,y:n}}function Mi(e,t,n){let{reference:s,floating:r}=e;const o=_e(t),i=Fo(t),a=No(i),d=It(t),l=o==="y",f=s.x+s.width/2-r.width/2,u=s.y+s.height/2-r.height/2,h=s[a]/2-r[a]/2;let p;switch(d){case"top":p={x:f,y:s.y-r.height};break;case"bottom":p={x:f,y:s.y+s.height};break;case"right":p={x:s.x+s.width,y:u};break;case"left":p={x:s.x-r.width,y:u};break;default:p={x:s.x,y:s.y}}const m=vn(t);return m&&(p[i]+=h*(m==="end"?1:-1)*(n&&l?-1:1)),p}async function Uf(e,t){var n;t===void 0&&(t={});const{x:s,y:r,platform:o,rects:i,elements:a,strategy:d}=e,{boundary:l="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:h=!1,padding:p=0}=ht(t,e),m=cl(p),g=a[h?u==="floating"?"reference":"floating":u],b=Gs(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(g)))==null||n?g:g.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:l,rootBoundary:f,strategy:d})),w=u==="floating"?{x:s,y:r,width:i.floating.width,height:i.floating.height}:i.reference,A=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),D=await(o.isElement==null?void 0:o.isElement(A))&&await(o.getScale==null?void 0:o.getScale(A))||{x:1,y:1},M=Gs(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:A,strategy:d}):w);return{top:(b.top-M.top+m.top)/D.y,bottom:(M.bottom-b.bottom+m.bottom)/D.y,left:(b.left-M.left+m.left)/D.x,right:(M.right-b.right+m.right)/D.x}}const qf=50,Gf=async(e,t,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:o=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:Uf},d=await(i.isRTL==null?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:f,y:u}=Mi(l,s,d),h=s,p=0;const m={};for(let c=0;c<o.length;c++){const g=o[c];if(!g)continue;const{name:b,fn:w}=g,{x:A,y:D,data:M,reset:$}=await w({x:f,y:u,initialPlacement:s,placement:h,strategy:r,middlewareData:m,rects:l,platform:a,elements:{reference:e,floating:t}});f=A??f,u=D??u,m[b]={...m[b],...M},$&&p<qf&&(p++,typeof $=="object"&&($.placement&&(h=$.placement),$.rects&&(l=$.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):$.rects),{x:f,y:u}=Mi(l,h,d)),c=-1)}return{x:f,y:u,placement:h,strategy:r,middlewareData:m}},Yf=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:r,rects:o,platform:i,elements:a,middlewareData:d}=t,{element:l,padding:f=0}=ht(e,t)||{};if(l==null)return{};const u=cl(f),h={x:n,y:s},p=Fo(r),m=No(p),c=await i.getDimensions(l),g=p==="y",b=g?"top":"left",w=g?"bottom":"right",A=g?"clientHeight":"clientWidth",D=o.reference[m]+o.reference[p]-h[p]-o.floating[m],M=h[p]-o.reference[p],$=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l));let v=$?$[A]:0;(!v||!await(i.isElement==null?void 0:i.isElement($)))&&(v=a.floating[A]||o.floating[m]);const S=D/2-M/2,T=v/2-c[m]/2-1,L=$t(u[b],T),E=$t(u[w],T),O=v-c[m]-E,R=v/2-c[m]/2+S,V=ll(L,R,O),H=!d.arrow&&vn(r)!=null&&R!==V&&o.reference[m]/2-(R<L?L:E)-c[m]/2<0,K=H?R<L?R-L:R-O:0;return{[p]:h[p]+K,data:{[p]:V,centerOffset:R-V-K,...H&&{alignmentOffset:K}},reset:H}}}),Kf=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:r,middlewareData:o,rects:i,initialPlacement:a,platform:d,elements:l}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:c=!0,...g}=ht(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const b=It(r),w=_e(a),A=It(a)===a,D=await(d.isRTL==null?void 0:d.isRTL(l.floating)),M=h||(A||!c?[qs(a)]:Ff(a)),$=m!=="none";!h&&$&&M.push(...Wf(a,c,m,D));const v=[a,...M],S=await d.detectOverflow(t,g),T=[];let L=((s=o.flip)==null?void 0:s.overflows)||[];if(f&&T.push(S[b]),u){const V=Nf(r,i,D);T.push(S[V[0]],S[V[1]])}if(L=[...L,{placement:r,overflows:T}],!T.every(V=>V<=0)){var E,O;const V=(((E=o.flip)==null?void 0:E.index)||0)+1,H=v[V];if(H&&(!(u==="alignment"?w!==_e(H):!1)||L.every(Z=>_e(Z.placement)===w?Z.overflows[0]>0:!0)))return{data:{index:V,overflows:L},reset:{placement:H}};let K=(O=L.filter(se=>se.overflows[0]<=0).sort((se,Z)=>se.overflows[1]-Z.overflows[1])[0])==null?void 0:O.placement;if(!K)switch(p){case"bestFit":{var R;const se=(R=L.filter(Z=>{if($){const z=_e(Z.placement);return z===w||z==="y"}return!0}).map(Z=>[Z.placement,Z.overflows.filter(z=>z>0).reduce((z,Se)=>z+Se,0)]).sort((Z,z)=>Z[1]-z[1])[0])==null?void 0:R[0];se&&(K=se);break}case"initialPlacement":K=a;break}if(r!==K)return{reset:{placement:K}}}return{}}}};function Di(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ri(e){return Pf.some(t=>e[t]>=0)}const zf=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:r="referenceHidden",...o}=ht(e,t);switch(r){case"referenceHidden":{const i=await s.detectOverflow(t,{...o,elementContext:"reference"}),a=Di(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Ri(a)}}}case"escaped":{const i=await s.detectOverflow(t,{...o,altBoundary:!0}),a=Di(i,n.floating);return{data:{escapedOffsets:a,escaped:Ri(a)}}}default:return{}}}}},dl=new Set(["left","top"]);async function Zf(e,t){const{placement:n,platform:s,elements:r}=e,o=await(s.isRTL==null?void 0:s.isRTL(r.floating)),i=It(n),a=vn(n),d=_e(n)==="y",l=dl.has(i)?-1:1,f=o&&d?-1:1,u=ht(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:m}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof m=="number"&&(p=a==="end"?m*-1:m),d?{x:p*f,y:h*l}:{x:h*l,y:p*f}}const Jf=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:r,y:o,placement:i,middlewareData:a}=t,d=await Zf(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:r+d.x,y:o+d.y,data:{...d,placement:i}}}}},Xf=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:r,platform:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:d={fn:w=>{let{x:A,y:D}=w;return{x:A,y:D}}},...l}=ht(e,t),f={x:n,y:s},u=await o.detectOverflow(t,l),h=_e(r),p=Vo(h);let m=f[p],c=f[h];const g=(w,A)=>ll(A+u[w==="y"?"top":"left"],A,A-u[w==="y"?"bottom":"right"]);i&&(m=g(p,m)),a&&(c=g(h,c));const b=d.fn({...t,[p]:m,[h]:c});return{...b,data:{x:b.x-n,y:b.y-s,enabled:{[p]:i,[h]:a}}}}}},Qf=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,s;const{x:r,y:o,placement:i,rects:a,middlewareData:d}=t,{offset:l=0,mainAxis:f=!0,crossAxis:u=!0}=ht(e,t),h={x:r,y:o},p=_e(i),m=Vo(p);let c=h[m],g=h[p];const b=ht(l,t),w=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:(n=b.mainAxis)!=null?n:0,crossAxis:(s=b.crossAxis)!=null?s:0};if(f){const M=m==="y"?"height":"width",$=a.reference[m]-a.floating[M]+w.mainAxis,v=a.reference[m]+a.reference[M]-w.mainAxis;c<$?c=$:c>v&&(c=v)}if(u){var A,D;const M=m==="y"?"width":"height",$=dl.has(It(i)),v=a.reference[p]-a.floating[M]+($&&((A=d.offset)==null?void 0:A[p])||0)+($?0:w.crossAxis),S=a.reference[p]+a.reference[M]+($?0:((D=d.offset)==null?void 0:D[p])||0)-($?w.crossAxis:0);g<v?g=v:g>S&&(g=S)}return{[m]:c,[p]:g}}}},eh=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:s,platform:r,elements:o}=t,{apply:i=()=>{},...a}=ht(e,t),d=await r.detectOverflow(t,a),l=It(n),f=vn(n),u=_e(n)==="y",{width:h,height:p}=s.floating;let m,c;l==="top"||l==="bottom"?(m=l,c=f===(await(r.isRTL==null?void 0:r.isRTL(o.floating))?"start":"end")?"left":"right"):(c=l,m=f==="end"?"top":"bottom");const g=p-d.top-d.bottom,b=h-d.left-d.right,w=$t(p-d[m],g),A=$t(h-d[c],b),D=t.middlewareData.shift,M=!D;let $=w,v=A;D!=null&&D.enabled.x&&(v=b),D!=null&&D.enabled.y&&($=g),M&&!f&&(u?v=h-2*st(d.left,d.right):$=p-2*st(d.top,d.bottom)),await i({...t,availableWidth:v,availableHeight:$});const S=await r.getDimensions(o.floating);return h!==S.width||p!==S.height?{reset:{rects:!0}}:{}}}};function rr(){return typeof window<"u"}function yn(e){return ul(e)?(e.nodeName||"").toLowerCase():"#document"}function be(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function mt(e){var t;return(t=(ul(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ul(e){return rr()?e instanceof Node||e instanceof be(e).Node:!1}function qe(e){return rr()?e instanceof Element||e instanceof be(e).Element:!1}function Tt(e){return rr()?e instanceof HTMLElement||e instanceof be(e).HTMLElement:!1}function Pi(e){return!rr()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof be(e).ShadowRoot}function or(e){const{overflow:t,overflowX:n,overflowY:s,display:r}=Ge(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&r!=="inline"&&r!=="contents"}function th(e){return/^(table|td|th)$/.test(yn(e))}function ir(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const nh=/transform|translate|scale|rotate|perspective|filter/,sh=/paint|layout|strict|content/,Lt=e=>!!e&&e!=="none";let Cr;function Ho(e){const t=qe(e)?Ge(e):e;return Lt(t.transform)||Lt(t.translate)||Lt(t.scale)||Lt(t.rotate)||Lt(t.perspective)||!_o()&&(Lt(t.backdropFilter)||Lt(t.filter))||nh.test(t.willChange||"")||sh.test(t.contain||"")}function rh(e){let t=Ft(e);for(;Tt(t)&&!Gn(t);){if(Ho(t))return t;if(ir(t))return null;t=Ft(t)}return null}function _o(){return Cr==null&&(Cr=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Cr}function Gn(e){return/^(html|body|#document)$/.test(yn(e))}function Ge(e){return be(e).getComputedStyle(e)}function ar(e){return qe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ft(e){if(yn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Pi(e)&&e.host||mt(e);return Pi(t)?t.host:t}function fl(e){const t=Ft(e);return Gn(t)?(e.ownerDocument||e).body:Tt(t)&&or(t)?t:fl(t)}function Yn(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=fl(e),o=r===((s=e.ownerDocument)==null?void 0:s.body),i=be(r);if(o){const a=oo(i);return t.concat(i,i.visualViewport||[],or(r)?r:[],a&&n?Yn(a):[])}else return t.concat(r,Yn(r,[],n))}function oo(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function hl(e){const t=Ge(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const r=Tt(e),o=r?e.offsetWidth:n,i=r?e.offsetHeight:s,a=Us(n)!==o||Us(s)!==i;return a&&(n=o,s=i),{width:n,height:s,$:a}}function Bo(e){return qe(e)?e:e.contextElement}function en(e){const t=Bo(e);if(!Tt(t))return rt(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:o}=hl(t);let i=(o?Us(n.width):n.width)/s,a=(o?Us(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const oh=rt(0);function pl(e){const t=be(e);return!_o()||!t.visualViewport?oh:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ih(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===be(e)}function Ht(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=Bo(e);let i=rt(1);t&&(s?qe(s)&&(i=en(s)):i=en(e));const a=ih(o,n,s)?pl(o):rt(0);let d=(r.left+a.x)/i.x,l=(r.top+a.y)/i.y,f=r.width/i.x,u=r.height/i.y;if(o&&s){const h=be(o),p=qe(s)?be(s):s;let m=h,c=oo(m);for(;c&&p!==m;){const g=en(c),b=c.getBoundingClientRect(),w=Ge(c),A=b.left+(c.clientLeft+parseFloat(w.paddingLeft))*g.x,D=b.top+(c.clientTop+parseFloat(w.paddingTop))*g.y;d*=g.x,l*=g.y,f*=g.x,u*=g.y,d+=A,l+=D,m=be(c),c=oo(m)}}return Gs({width:f,height:u,x:d,y:l})}function lr(e,t){const n=ar(e).scrollLeft;return t?t.left+n:Ht(mt(e)).left+n}function gl(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-lr(e,n),r=n.top+t.scrollTop;return{x:s,y:r}}function ah(e){let{elements:t,rect:n,offsetParent:s,strategy:r}=e;const o=r==="fixed",i=mt(s),a=t?ir(t.floating):!1;if(s===i||a&&o)return n;let d={scrollLeft:0,scrollTop:0},l=rt(1);const f=rt(0),u=Tt(s);if((u||!o)&&((yn(s)!=="body"||or(i))&&(d=ar(s)),u)){const p=Ht(s);l=en(s),f.x=p.x+s.clientLeft,f.y=p.y+s.clientTop}const h=i&&!u&&!o?gl(i,d):rt(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-d.scrollLeft*l.x+f.x+h.x,y:n.y*l.y-d.scrollTop*l.y+f.y+h.y}}function lh(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function ch(e){const t=ar(e),n=e.ownerDocument.body,s=st(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=st(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let o=-t.scrollLeft+lr(e);const i=-t.scrollTop;return Ge(n).direction==="rtl"&&(o+=st(e.clientWidth,n.clientWidth)-s),{width:s,height:r,x:o,y:i}}const dh=25;function uh(e,t,n){n===void 0&&(n="viewport");const s=n==="layoutViewport",r=be(e),o=mt(e),i=r.visualViewport;let a=o.clientWidth,d=o.clientHeight,l=0,f=0;if(i){const h=!_o()||t==="fixed";s?h||(l=-i.offsetLeft,f=-i.offsetTop):(a=i.width,d=i.height,h&&(l=i.offsetLeft,f=i.offsetTop))}if(lr(o)<=0){const h=o.ownerDocument,p=h.body,m=getComputedStyle(p),c=h.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,g=Math.abs(o.clientWidth-p.clientWidth-c),b=getComputedStyle(o).scrollbarGutter==="stable both-edges"?g/2:g;b<=dh&&(a-=b)}return{width:a,height:d,x:l,y:f}}function fh(e,t){const n=Ht(e,!0,t==="fixed"),s=n.top+e.clientTop,r=n.left+e.clientLeft,o=en(e),i=e.clientWidth*o.x,a=e.clientHeight*o.y,d=r*o.x,l=s*o.y;return{width:i,height:a,x:d,y:l}}function Vi(e,t,n){let s;if(t==="viewport"||t==="layoutViewport")s=uh(e,n,t);else if(t==="document")s=ch(mt(e));else if(qe(t))s=fh(t,n);else{const r=pl(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Gs(s)}function hh(e,t){const n=t.get(e);if(n)return n;let s=Yn(e,[],!1).filter(a=>qe(a)&&yn(a)!=="body"),r=null;const o=Ge(e).position==="fixed";let i=o?Ft(e):e;for(;qe(i)&&!Gn(i);){const a=Ge(i),d=Ho(i),l=r?r.position:o?"fixed":"";!d&&(l==="fixed"||l==="absolute"&&a.position==="static")?s=s.filter(u=>u!==i):r=a,i=Ft(i)}return t.set(e,s),s}function ph(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const i=[...n==="clippingAncestors"?ir(t)?[]:hh(t,this._c):[].concat(n),s],a=Vi(t,i[0],r);let d=a.top,l=a.right,f=a.bottom,u=a.left;for(let h=1;h<i.length;h++){const p=Vi(t,i[h],r);d=st(p.top,d),l=$t(p.right,l),f=$t(p.bottom,f),u=st(p.left,u)}return{width:l-u,height:f-d,x:u,y:d}}function gh(e){const{width:t,height:n}=hl(e);return{width:t,height:n}}function mh(e,t,n){const s=Tt(t),r=mt(t),o=n==="fixed",i=Ht(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const d=rt(0);if((s||!o)&&((yn(t)!=="body"||or(r))&&(a=ar(t)),s)){const h=Ht(t,!0,o,t);d.x=h.x+t.clientLeft,d.y=h.y+t.clientTop}!s&&r&&(d.x=lr(r));const l=r&&!s&&!o?gl(r,a):rt(0),f=i.left+a.scrollLeft-d.x-l.x,u=i.top+a.scrollTop-d.y-l.y;return{x:f,y:u,width:i.width,height:i.height}}function kr(e){return Ge(e).position==="static"}function Ni(e,t){if(!Tt(e)||Ge(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return mt(e)===n&&(n=n.ownerDocument.body),n}function ml(e,t){const n=be(e);if(ir(e))return n;if(!Tt(e)){let r=Ft(e);for(;r&&!Gn(r);){if(qe(r)&&!kr(r))return r;r=Ft(r)}return n}let s=Ni(e,t);for(;s&&th(s)&&kr(s);)s=Ni(s,t);return s&&Gn(s)&&kr(s)&&!Ho(s)?n:s||rh(e)||n}const vh=async function(e){const t=this.getOffsetParent||ml,n=this.getDimensions,s=await n(e.floating);return{reference:mh(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function yh(e){return Ge(e).direction==="rtl"}const bh={convertOffsetParentRelativeRectToViewportRelativeRect:ah,getDocumentElement:mt,getClippingRect:ph,getOffsetParent:ml,getElementRects:vh,getClientRects:lh,getDimensions:gh,getScale:en,isElement:qe,isRTL:yh};function vl(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function wh(e,t,n){let s=null,r;const o=mt(e);function i(){var f;clearTimeout(r),(f=s)==null||f.disconnect(),s=null}function a(f,u){f===void 0&&(f=!1),u===void 0&&(u=1),i();const h=e.getBoundingClientRect(),{left:p,top:m,width:c,height:g}=h;if(f||t(),!c||!g)return;const b=ds(m),w=ds(o.clientWidth-(p+c)),A=ds(o.clientHeight-(m+g)),D=ds(p),$={rootMargin:-b+"px "+-w+"px "+-A+"px "+-D+"px",threshold:st(0,$t(1,u))||1};let v=!0;function S(T){const L=T[0].intersectionRatio;if(!vl(h,e.getBoundingClientRect()))return a();if(L!==u){if(!v)return a();L?a(!1,L):r=setTimeout(()=>{a(!1,1e-7)},1e3)}v=!1}try{s=new IntersectionObserver(S,{...$,root:o.ownerDocument})}catch{s=new IntersectionObserver(S,$)}s.observe(e)}const d=be(e),l=()=>a(n);return d.addEventListener("resize",l),a(!0),()=>{d.removeEventListener("resize",l),i()}}function Eh(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:r=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:d=!1}=s,l=Bo(e),f=r||o?[...l?Yn(l):[],...t?Yn(t):[]]:[];f.forEach(b=>{r&&b.addEventListener("scroll",n),o&&b.addEventListener("resize",n)});const u=l&&a?wh(l,n,o):null;let h=-1,p=null;i&&(p=new ResizeObserver(b=>{let[w]=b;w&&w.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var A;(A=p)==null||A.observe(t)})),n()}),l&&!d&&p.observe(l),t&&p.observe(t));let m,c=d?Ht(e):null;d&&g();function g(){const b=Ht(e);c&&!vl(c,b)&&n(),c=b,m=requestAnimationFrame(g)}return n(),()=>{var b;f.forEach(w=>{r&&w.removeEventListener("scroll",n),o&&w.removeEventListener("resize",n)}),u?.(),(b=p)==null||b.disconnect(),p=null,d&&cancelAnimationFrame(m)}}const Sh=Jf,xh=Xf,$h=Kf,Ih=eh,Th=zf,Ch=Yf,kh=Qf,Ah=(e,t,n)=>{const s=new Map,r=n??{},o={...bh,...r.platform,_c:s};return Gf(e,t,{...r,platform:o})};function Fi(e=0,t=0,n=0,s=0){if(typeof DOMRect=="function")return new DOMRect(e,t,n,s);const r={x:e,y:t,width:n,height:s,top:t,right:e+n,bottom:t+s,left:e};return{...r,toJSON:()=>r}}function Lh(e){if(!e)return Fi();const{x:t,y:n,width:s,height:r}=e;return Fi(t,n,s,r)}function Oh(e,t){return{contextElement:ce(e)?e:e?.contextElement,getBoundingClientRect:()=>{const n=e,s=t?.(n);return s||!n?Lh(s):n.getBoundingClientRect()}}}var Cn=e=>({variable:e,reference:`var(${e})`}),Xe={arrowSize:Cn("--arrow-size"),arrowSizeHalf:Cn("--arrow-size-half"),arrowBg:Cn("--arrow-background"),transformOrigin:Cn("--transform-origin"),arrowOffset:Cn("--arrow-offset")},Mh=e=>e==="top"||e==="bottom"?"y":"x";function Dh(e,t){return{name:"transformOrigin",fn(n){const{elements:s,middlewareData:r,placement:o,rects:i,y:a}=n,d=o.split("-")[0],l=Mh(d),f=r.arrow?.x||0,u=r.arrow?.y||0,h=t?.clientWidth||0,p=t?.clientHeight||0,m=f+h/2,c=u+p/2,g=Math.abs(r.shift?.y||0),b=i.reference.height/2,w=p/2,A=e.offset?.mainAxis??e.gutter,D=typeof A=="number"?A+w:A??w,M=g>D,$={top:`${m}px calc(100% + ${D}px)`,bottom:`${m}px ${-D}px`,left:`calc(100% + ${D}px) ${c}px`,right:`${-D}px ${c}px`}[d],v=`${m}px ${i.reference.y+b-a}px`,S=!!e.overlap&&l==="y"&&M;return s.floating.style.setProperty(Xe.transformOrigin.variable,S?v:$),{data:{transformOrigin:S?v:$}}}}}var Rh={name:"rects",fn({rects:e}){return{data:e}}},Ph=e=>{if(e)return{name:"shiftArrow",fn({placement:t,middlewareData:n}){if(!n.arrow)return{};const{x:s,y:r}=n.arrow,o=t.split("-")[0];return Object.assign(e.style,{left:s!=null?`${s}px`:"",top:r!=null?`${r}px`:"",[o]:`calc(100% + ${Xe.arrowOffset.reference})`}),{}}}};function Vh(e){const[t,n]=e.split("-");return{side:t,align:n,hasAlign:n!=null}}function yl(e){return e.split("-")[0]}var Nh={strategy:"absolute",placement:"bottom",listeners:!0,restoreStyles:!1,applyStyles:!0,gutter:8,flip:!0,slide:!0,overlap:!1,sameWidth:!1,fitViewport:!1,overflowPadding:8,arrowPadding:4};function Hi(e,t){const n=e.devicePixelRatio||1;return Math.round(t*n)/n}function Qt(e,t){return e!=null&&Math.abs(e-t)<.5}function cr(e){return typeof e=="function"?e():e==="clipping-ancestors"?"clippingAncestors":e}function Fh(e,t,n){const s=e||t.createElement("div");return Ch({element:s,padding:n.arrowPadding})}function Hh(e,t){if(!Fd(t.offset??t.gutter))return Sh(({placement:n})=>{const s=(e?.clientHeight||0)/2,r=t.offset?.mainAxis??t.gutter,o=typeof r=="number"?r+s:r??s,{hasAlign:i}=Vh(n),a=i?void 0:t.shift,d=t.offset?.crossAxis??a;return Co({crossAxis:d,mainAxis:o,alignmentAxis:t.shift})})}function _h(e){if(e.flip)return $h(()=>{const t=cr(e.boundary);return{...t?{boundary:t}:void 0,padding:e.overflowPadding,fallbackPlacements:e.flip===!0?void 0:e.flip}})}function Bh(e){if(!(!e.slide&&!e.overlap))return xh(()=>{const t=cr(e.boundary);return{...t?{boundary:t}:void 0,mainAxis:e.slide,crossAxis:e.overlap,padding:e.overflowPadding,limiter:kh()}})}function Wh(e){if(e.sizeMiddleware===!1&&!e.sameWidth&&!e.fitViewport)return;let t,n,s,r;return Ih(()=>{const o=cr(e.boundary);return{padding:e.overflowPadding,...o?{boundary:o}:void 0,apply({elements:i,rects:a,availableHeight:d,availableWidth:l}){const f=i.floating,u=Math.round(a.reference.width),h=Math.round(a.reference.height);l=Math.floor(l),d=Math.floor(d),Qt(t,u)||(f.style.setProperty("--reference-width",`${u}px`),t=u),Qt(n,h)||(f.style.setProperty("--reference-height",`${h}px`),n=h),Qt(s,l)||(f.style.setProperty("--available-width",`${l}px`),s=l),Qt(r,d)||(f.style.setProperty("--available-height",`${d}px`),r=d)}}})}function jh(e){if(e.hideWhenDetached)return Th(()=>({strategy:"referenceHidden",boundary:cr(e.boundary)??"clippingAncestors"}))}function Uh(e){return e?e===!0?{ancestorResize:!0,ancestorScroll:!0,elementResize:!0,layoutShift:!0}:e:{}}var qh=["transform","visibility","pointer-events","--x","--y","--z-index","z-index","--reference-width","--reference-height","--available-width","--available-height","--transform-origin"],Gh=["top","right","bottom","left"],Fn=new WeakSet;function Yh(e,t){const n=e.style.getPropertyValue("z-index"),s=Fn.has(e),r=s&&n==="var(--z-index)";s&&!r&&Fn.delete(e);const o=Ja(t).zIndex;if(o==="auto"){r&&(e.style.removeProperty("z-index"),Fn.delete(e));return}n&&!r||(e.style.setProperty("--z-index",o),e.style.setProperty("z-index","var(--z-index)"),Fn.add(e))}function _i(e,t){if(!e)return Ba;const n=new Map(t.map(s=>[s,e.style.getPropertyValue(s)]));return()=>{n.forEach((s,r)=>{s?e.style.setProperty(r,s):e.style.removeProperty(r)}),e.style.length===0&&e.removeAttribute("style")}}function Bi(e){return e==null?null:ce(e)?e:typeof e=="object"&&e&&"contextElement"in e&&e.contextElement?e.contextElement:e}function Kh(e,t,n={}){const s=()=>(typeof t=="function"?t():t)??null,r=()=>{const L=typeof e=="function"?e():e;return n.getAnchorElement?.()??L},o=()=>{const L=r();return!L&&!n.getAnchorRect?null:Oh(L,n.getAnchorRect)},i=Object.assign({},Nh,n);let a=[],d=null,l,f;function u(L){if(l?.(),f?.(),d=L,i.restoreStyles){const O=_i(L,qh);l=()=>{O(),Fn.delete(L)}}else l=void 0;const E=L.querySelector("[data-part=arrow]");f=i.restoreStyles?_i(E,Gh):void 0,a=[Hh(E,i),_h(i),Bh(i),Fh(E,L.ownerDocument,i),Ph(E),Dh({gutter:i.gutter,offset:i.offset,overlap:i.overlap},E),Wh(i),jh(i),Rh]}const{placement:h,strategy:p,onComplete:m,onPositioned:c}=i;let g,b,w=!1,A,D,M=Ba;const $=Uh(i.listeners);function v(){if(!i.listeners)return;const L=r(),E=o(),O=s();if(!E||!O)return;(Bi(L)!==Bi(A)||O!==D)&&(M(),A=L,D=O,M=Eh(E,O,T,$))}async function S(){v();const L=s();if(!L)return;L!==d&&(u(L),w=!1);const E=o();if(!E)return;const O=await Ah(E,L,{placement:h,middleware:a,strategy:p}),R=he(L),V=Hi(R,O.x),H=Hi(R,O.y);if(m?.({...O,x:V,y:H}),i.applyStyles!==!1&&(Qt(g,V)||(L.style.setProperty("--x",`${V}px`),g=V),Qt(b,H)||(L.style.setProperty("--y",`${H}px`),b=H),i.hideWhenDetached&&(O.middlewareData.hide?.referenceHidden?(L.style.setProperty("visibility","hidden"),L.style.setProperty("pointer-events","none")):(L.style.removeProperty("visibility"),L.style.removeProperty("pointer-events"))),!w)){const K=L.firstElementChild;K&&(Yh(L,K),w=!0)}}async function T(){n.updatePosition?(await n.updatePosition({updatePosition:S,floatingElement:s()}),c?.({placed:!0})):await S()}return T(),()=>{M(),f?.(),l?.(),c?.({placed:!1})}}function io(e,t,n={}){const{defer:s,...r}=n,o=s?fe:a=>a(),i=[];return i.push(o(()=>{i.push(Kh(e,t,r))})),()=>{i.forEach(a=>a?.())}}var zh={bottom:"rotate(45deg)",left:"rotate(135deg)",top:"rotate(225deg)",right:"rotate(315deg)"};function bl(e={}){const{placement:t,sameWidth:n,fitViewport:s,strategy:r="absolute",applyStyles:o=!0}=e;return{arrow:{position:"absolute",width:Xe.arrowSize.reference,height:Xe.arrowSize.reference,[Xe.arrowSizeHalf.variable]:`calc(${Xe.arrowSize.reference} / 2)`,[Xe.arrowOffset.variable]:`calc(${Xe.arrowSizeHalf.reference} * -1)`},arrowTip:{transform:t?zh[t.split("-")[0]]:void 0,background:Xe.arrowBg.reference,top:"0",left:"0",width:"100%",height:"100%",position:"absolute",zIndex:"inherit"},floating:{position:r,isolation:"isolate",minWidth:n?void 0:"max-content",width:n?"var(--reference-width)":void 0,maxWidth:s?"var(--available-width)":void 0,maxHeight:s?"var(--available-height)":void 0,pointerEvents:t?void 0:"none",top:"0px",left:"0px",transform:t?"translate3d(var(--x, 0), var(--y, -100vh), 0)":"translate3d(0, -100vh, 0)",zIndex:o===!1?"var(--z-index)":void 0}}}var Zh=e=>e.ids?.root??`select:${e.id}`,ao=e=>e.ids?.content??`select:${e.id}:content`,lo=e=>e.ids?.trigger??`select:${e.id}:trigger`,wl=e=>e.ids?.clearTrigger??`select:${e.id}:clear-trigger`,us=e=>e.ids?.label??`select:${e.id}:label`,Jh=e=>e.ids?.control??`select:${e.id}:control`,co=(e,t)=>e.ids?.item?.(t)??`select:${e.id}:option:${t}`,uo=e=>e.ids?.hiddenSelect??`select:${e.id}:select`,El=e=>e.ids?.positioner??`select:${e.id}:positioner`,Xh=(e,t)=>e.ids?.itemGroup?.(t)??`select:${e.id}:optgroup:${t}`,Wi=(e,t)=>e.ids?.itemGroupLabel?.(t)??`select:${e.id}:optgroup-label:${t}`,Ar=e=>e.getById(uo(e)),kn=e=>e.getById(ao(e)),Rt=e=>e.getById(lo(e)),Qh=e=>e.getById(wl(e)),Lr=e=>e.getById(El(e)),Or=(e,t)=>t==null?null:e.getById(co(e,t)),ep={clearTriggerLabel:"Clear value"};function tp(e,t){const{context:n,prop:s,scope:r,state:o,computed:i,send:a}=e,d=ja(ep,s("translations")),l=s("disabled")||n.get("fieldsetDisabled"),f=!!s("invalid"),u=!!s("required"),h=!!s("readOnly"),p=s("composite"),m=s("collection"),c=o.hasTag("open"),g=o.matches("focused"),b=n.get("highlightedValue"),w=n.get("highlightedItem"),A=i("selectedItems"),D=n.get("currentPlacement"),M=D?yl(D):void 0,$=i("isTypingAhead"),v=i("isInteractive"),S=b?co(r,b):void 0;function T(E){const O=m.getItemDisabled(E.item),R=m.getItemValue(E.item);return Qs(R,()=>`[zag-js] No value found for item ${JSON.stringify(E.item)}`),{value:R,disabled:!!(l||O),highlighted:b===R,selected:n.get("value").includes(R)}}const L=bl({...s("positioning"),placement:D});return{open:c,focused:g,empty:n.get("value").length===0,highlightedItem:w,highlightedValue:b,selectedItems:A,hasSelectedItems:i("hasSelectedItems"),value:n.get("value"),valueAsString:i("valueAsString"),collection:m,multiple:!!s("multiple"),disabled:!!l,reposition(E={}){a({type:"POSITIONING.SET",options:E})},focus(){Rt(r)?.focus({preventScroll:!0})},setOpen(E){a({type:E?"OPEN":"CLOSE",replaces:"open"})},selectValue(E){a({type:"ITEM.SELECT",value:E})},setValue(E){a({type:"VALUE.SET",value:E})},selectAll(){a({type:"VALUE.SET",value:m.getValues()})},setHighlightValue(E){a({type:"HIGHLIGHTED_VALUE.SET",value:E})},clearHighlightValue(){a({type:"HIGHLIGHTED_VALUE.CLEAR"})},clearValue(E){a(E?{type:"ITEM.CLEAR",value:E}:{type:"VALUE.CLEAR"})},getItemState:T,getRootProps(){return t.element({...pe.root.attrs,dir:s("dir"),id:Zh(r),"data-invalid":P(f),"data-readonly":P(h)})},getLabelProps(){return t.label({dir:s("dir"),id:us(r),...pe.label.attrs,"data-disabled":P(l),"data-invalid":P(f),"data-readonly":P(h),"data-required":P(u),htmlFor:uo(r),onClick(E){E.defaultPrevented||l||Rt(r)?.focus({preventScroll:!0})}})},getControlProps(){return t.element({...pe.control.attrs,dir:s("dir"),id:Jh(r),"data-state":c?"open":"closed","data-focus":P(g),"data-disabled":P(l),"data-invalid":P(f)})},getValueTextProps(){return t.element({...pe.valueText.attrs,dir:s("dir"),"data-disabled":P(l),"data-invalid":P(f),"data-focus":P(g)})},getTriggerProps(){return t.button({id:lo(r),disabled:l,dir:s("dir"),type:"button",role:"combobox","aria-controls":ao(r),"aria-expanded":c,"aria-haspopup":"listbox","data-state":c?"open":"closed","aria-invalid":f,"aria-required":u,"aria-labelledby":us(r),...pe.trigger.attrs,"data-disabled":P(l),"data-invalid":P(f),"data-readonly":P(h),"data-placement":D,"data-side":M,"data-placeholder-shown":P(!i("hasSelectedItems")),onClick(E){v&&(E.defaultPrevented||a({type:"TRIGGER.CLICK"}))},onFocus(){a({type:"TRIGGER.FOCUS"})},onBlur(){a({type:"TRIGGER.BLUR"})},onKeyDown(E){if(E.defaultPrevented||!v)return;const R={ArrowUp(){a({type:"TRIGGER.ARROW_UP"})},ArrowDown(V){a({type:V.altKey?"OPEN":"TRIGGER.ARROW_DOWN"})},ArrowLeft(){a({type:"TRIGGER.ARROW_LEFT"})},ArrowRight(){a({type:"TRIGGER.ARROW_RIGHT"})},Home(){a({type:"TRIGGER.HOME"})},End(){a({type:"TRIGGER.END"})},Enter(){a({type:"TRIGGER.ENTER"})},Space(V){a($?{type:"TRIGGER.TYPEAHEAD",key:V.key}:{type:"TRIGGER.ENTER"})}}[Jr(E,{dir:s("dir"),orientation:"vertical"})];if(R){R(E),E.preventDefault();return}eo.isValidEvent(E)&&(a({type:"TRIGGER.TYPEAHEAD",key:E.key}),E.preventDefault())}})},getIndicatorProps(){return t.element({...pe.indicator.attrs,dir:s("dir"),"aria-hidden":!0,"data-state":c?"open":"closed","data-disabled":P(l),"data-invalid":P(f),"data-readonly":P(h)})},getItemProps(E){const O=T(E);return t.element({id:co(r,O.value),role:"option",...pe.item.attrs,dir:s("dir"),"data-value":O.value,"aria-selected":O.selected,"data-state":O.selected?"checked":"unchecked","data-highlighted":P(O.highlighted),"data-disabled":P(O.disabled),"aria-disabled":ue(O.disabled),onPointerMove(R){O.disabled||R.pointerType!=="mouse"||so()==="pointer"&&O.value!==b&&a({type:"ITEM.POINTER_MOVE",value:O.value})},onClick(R){R.defaultPrevented||O.disabled||a({type:"ITEM.CLICK",src:"pointerup",value:O.value})},onPointerLeave(R){O.disabled||E.persistFocus||R.pointerType==="mouse"&&so()==="pointer"&&a({type:"ITEM.POINTER_LEAVE"})}})},getItemTextProps(E){const O=T(E);return t.element({...pe.itemText.attrs,"data-state":O.selected?"checked":"unchecked","data-disabled":P(O.disabled),"data-highlighted":P(O.highlighted)})},getItemIndicatorProps(E){const O=T(E);return t.element({"aria-hidden":!0,...pe.itemIndicator.attrs,"data-state":O.selected?"checked":"unchecked",hidden:!O.selected})},getItemGroupLabelProps(E){const{htmlFor:O}=E;return t.element({...pe.itemGroupLabel.attrs,id:Wi(r,O),dir:s("dir"),role:"presentation"})},getItemGroupProps(E){const{id:O}=E;return t.element({...pe.itemGroup.attrs,"data-disabled":P(l),id:Xh(r,O),"aria-labelledby":Wi(r,O),role:"group",dir:s("dir")})},getClearTriggerProps(){return t.button({...pe.clearTrigger.attrs,id:wl(r),type:"button","aria-label":d.clearTriggerLabel,"data-invalid":P(f),disabled:l,hidden:!i("hasSelectedItems"),dir:s("dir"),onClick(E){E.defaultPrevented||a({type:"CLEAR.CLICK"})}})},getHiddenSelectProps(){const E=n.get("value"),O=s("multiple")?E:E?.[0],R=V=>{const H=Mo(V);el(H)||a({type:"VALUE.SET",value:np(V.currentTarget)})};return t.select({name:s("name"),form:s("form"),disabled:l,multiple:s("multiple"),required:s("required"),"aria-hidden":!0,id:uo(r),defaultValue:O,style:yf,tabIndex:-1,autoComplete:s("autoComplete"),onChange:R,onInput:R,onFocus(){Rt(r)?.focus({preventScroll:!0})},"aria-labelledby":us(r)})},getPositionerProps(){return t.element({...pe.positioner.attrs,dir:s("dir"),id:El(r),style:L.floating})},getContentProps(){return t.element({hidden:!c,dir:s("dir"),id:ao(r),role:p?"listbox":"dialog",...pe.content.attrs,"data-state":c?"open":"closed","data-placement":D,"data-side":M,"data-activedescendant":S,"aria-activedescendant":p?S:void 0,"aria-multiselectable":s("multiple")&&p?!0:void 0,"aria-labelledby":us(r),tabIndex:0,onKeyDown(E){if(!v||!an(E.currentTarget,ut(E)))return;if(E.key==="Tab"&&!Gu(E)){E.preventDefault();return}const O={ArrowUp(){a({type:"CONTENT.ARROW_UP"})},ArrowDown(){a({type:"CONTENT.ARROW_DOWN"})},Home(){a({type:"CONTENT.HOME"})},End(){a({type:"CONTENT.END"})},Enter(){a({type:"ITEM.CLICK",src:"keydown.enter"})},Space(H){$?a({type:"CONTENT.TYPEAHEAD",key:H.key}):O.Enter?.()}},R=O[Jr(E)];if(R){R(E),E.preventDefault();return}const V=ut(E);au(V)||eo.isValidEvent(E)&&(a({type:"CONTENT.TYPEAHEAD",key:E.key}),E.preventDefault())}})},getListProps(){return t.element({...pe.list.attrs,tabIndex:0,role:p?void 0:"listbox","aria-labelledby":lo(r),"aria-activedescendant":p?void 0:S,"aria-multiselectable":!p&&s("multiple")?!0:void 0})}}}var np=e=>e.multiple?Array.from(e.selectedOptions,t=>t.value):e.value?[e.value]:[];function sp(e,t,n){let s=[],r;return o=>{const i=e(o);return(i.length!==s.length||i.some((d,l)=>!mn(s[l],d)))&&(s=i,r=t(i,o)),r}}function rp(){const e=new Map;return{claim(t){const n=Symbol(t);return e.set(t,n),n},isReplaced(t,n){return e.get(t)!==n}}}var Ct=".",Sl="#",ji=new WeakMap,xl=new WeakMap;function fo(e){return e.join(Ct)}function op(e){return e.includes(Ct)}function $l(e){return e.startsWith(Sl)}function ip(e){return e.startsWith(Ct)}function ap(e){return $l(e)?e.slice(Sl.length):e}function ho(e,t){return e?`${e}${Ct}${t}`:t}function lp(e){const t=new Map,n=new Map,s=(r,o)=>{t.set(r,o);const i=o.id;i&&(n.has(i)&&xi(`[zag-js] Duplicate state id: "${i}"`),n.set(i,r));const a=o.states;if(a){Qs(o.initial,()=>`[zag-js] Compound state "${r}" has child states but no "initial" property`),o.initial in a||xi(`[zag-js] Compound state "${r}" has initial "${String(o.initial)}" which is not a child state`);for(const[d,l]of Object.entries(a)){if(!l)continue;const f=ho(r,d);s(f,l)}}};for(const[r,o]of Object.entries(e.states))o&&s(r,o);return{index:t,idIndex:n}}function Xn(e){const t=ji.get(e);if(t)return t;const{index:n,idIndex:s}=lp(e);return ji.set(e,n),xl.set(e,s),n}function cp(e,t){return Xn(e),xl.get(e)?.get(t)}function Wo(e){return e?String(e).split(Ct).filter(Boolean):[]}function Ys(e,t){if(!t)return[];const n=Xn(e),s=Wo(t),r=[],o=[];for(const i of s){o.push(i);const a=fo(o),d=n.get(a);if(!d)break;r.push({path:a,state:d})}return r}function An(e,t){const n=Xn(e),s=Wo(t);if(!s.length)return t;const r=[];for(const a of s){r.push(a);const d=fo(r);if(!n.has(d))return t}let o=fo(r),i=n.get(o);for(;i?.initial;){const a=`${o}${Ct}${i.initial}`,d=n.get(a);if(!d)break;o=a,i=d}return o}function Ui(e,t){return Xn(e).has(t)}function qi(e,t,n){const s=String(t);if($l(s)){const r=ap(s),o=cp(e,r);return Qs(o,()=>`[zag-js] Unknown state id: "${r}"`),An(e,o)}if(ip(s)&&n){const r=ho(n,s.slice(1));return An(e,r)}if(!op(s)&&n){const r=Wo(n);for(let o=r.length-1;o>=1;o--){const i=r.slice(0,o).join(Ct),a=ho(i,s);if(Ui(e,a))return An(e,a)}if(Ui(e,s))return An(e,s)}return An(e,s)}function dp(e,t,n){const s=Ys(e,t);for(let o=s.length-1;o>=0;o--){const a=s[o]?.state.on?.[n];if(a)return{transitions:a,source:s[o]?.path}}return{transitions:e.on?.[n],source:void 0}}function up(e,t,n,s){const r=t?Ys(e,t):[],o=Ys(e,n);let i=0;for(;i<r.length&&i<o.length&&r[i]?.path===o[i]?.path;)i+=1;let a=r.slice(i).reverse(),d=o.slice(i);const l=r[r.length-1]?.path===o[o.length-1]?.path;return s&&l&&(a=r.slice().reverse(),d=o),{exiting:a,entering:d}}function fp(e,t){return e?e===t||e.startsWith(`${t}${Ct}`):!1}function hp(e,t,n){return Ys(e,t).some(s=>s.state.tags?.includes(n))}function Il(){return{and:(...e)=>function(n){return e.every(s=>n.guard(s))},or:(...e)=>function(n){return e.some(s=>n.guard(s))},not:e=>function(n){return!n.guard(e)}}}function Tl(e){return Xn(e),e}var Hn=(e=>(e.NotStarted="Not Started",e.Started="Started",e.Stopped="Stopped",e))(Hn||{}),fs="__init__";function pp(e){const t=()=>e.getRootNode?.()??document,n=()=>Oe(t());return{...e,getRootNode:t,getDoc:n,getWin:()=>n().defaultView??window,getActiveElement:()=>tr(t()),isActiveElement:Zr,getById:i=>t().getElementById(i)}}function gp(e){const t={each(n){for(let s=0;s<e.frames?.length;s+=1){const r=e.frames[s];r&&n(r)}},addEventListener(n,s,r){return t.each(o=>{try{o.document.addEventListener(n,s,r)}catch{}}),()=>{try{t.removeEventListener(n,s,r)}catch{}}},removeEventListener(n,s,r){t.each(o=>{try{o.document.removeEventListener(n,s,r)}catch{}})}};return t}function mp(e){const t=e.frameElement!=null?e.parent:null;return{addEventListener:(n,s,r)=>{try{t?.addEventListener(n,s,r)}catch{}return()=>{try{t?.removeEventListener(n,s,r)}catch{}}},removeEventListener:(n,s,r)=>{try{t?.removeEventListener(n,s,r)}catch{}}}}var Gi="pointerdown.outside",Yi="focus.outside";function vp(e){for(const t of e)if(ce(t)&&nr(t))return!0;return!1}var Cl=e=>"clientY"in e;function yp(e,t){if(!Cl(t)||!e)return!1;const n=e.getBoundingClientRect();return n.width===0||n.height===0?!1:n.top<=t.clientY&&t.clientY<=n.top+n.height&&n.left<=t.clientX&&t.clientX<=n.left+n.width}function bp(e,t){return e.y<=t.y&&t.y<=e.y+e.height&&e.x<=t.x&&t.x<=e.x+e.width}function Ki(e,t){if(!t||!Cl(e))return!1;const n=t.scrollHeight>t.clientHeight,s=n&&e.clientX>t.offsetLeft+t.clientWidth,r=t.scrollWidth>t.clientWidth,o=r&&e.clientY>t.offsetTop+t.clientHeight,i={x:t.offsetLeft,y:t.offsetTop,width:t.clientWidth+(n?16:0),height:t.clientHeight+(r?16:0)},a={x:e.clientX,y:e.clientY};return bp(i,a)?s||o:!1}function wp(e,t){const{exclude:n,onFocusOutside:s,onPointerDownOutside:r,onInteractOutside:o,defer:i,followControlledElements:a=!0}=t;if(!e)return;const d=Oe(e),l=he(e),f=gp(l),u=mp(l);function h(M,$){if(!ce($)||!$.isConnected||an(e,$)||yp(e,M)||a&&$u(e,$))return!1;const v=d.querySelector(`[aria-controls="${e.id}"]`);if(v){const T=Xr(v);if(Ki(M,T))return!1}const S=Xr(e);return Ki(M,S)?!1:!n?.($)}const p=new Set,m=on(e?.getRootNode());let c=!1;function g(M){c=!0;const $=()=>{c=!1};d.addEventListener("pointerup",$,{once:!0}),l.addEventListener("pointerup",$,{once:!0});function v(S){const T=i&&!Ii()?fe:O=>O(),L=S??M,E=L?.composedPath?.()??[L?.target];T(()=>{const O=m?E[0]:ut(M);if(!(!e||!h(M,O))){if(r||o){const R=Hs(r,o);e.addEventListener(Gi,R,{once:!0})}zi(e,Gi,{bubbles:!1,cancelable:!0,detail:{originalEvent:L,contextmenu:ku(L),focusable:vp(E),target:O}})}})}M.pointerType==="touch"?(p.forEach(S=>S()),p.add(Ls(d,"click",v,{once:!0})),p.add(u.addEventListener("click",v,{once:!0})),p.add(f.addEventListener("click",v,{once:!0}))):v()}const b=new Set,w=setTimeout(()=>{b.add(Ls(d,"pointerdown",g,!0)),b.add(u.addEventListener("pointerdown",g,!0)),b.add(f.addEventListener("pointerdown",g,!0))},0),A=tl.create();function D(M){if(c)return;(i?v=>A.request(v):v=>v())(()=>{const v=M?.composedPath?.()??[M?.target],S=m?v[0]:ut(M);if(!(!e||!h(M,S))){if(s||o){const T=Hs(s,o);e.addEventListener(Yi,T,{once:!0})}zi(e,Yi,{bubbles:!1,cancelable:!0,detail:{originalEvent:M,contextmenu:!1,focusable:nr(S),target:S}})}})}return Ii()||(b.add(Ls(d,"focusin",D,!0)),b.add(u.addEventListener("focusin",D,!0)),b.add(f.addEventListener("focusin",D,!0))),()=>{clearTimeout(w),A.cancel(),p.forEach(M=>M()),b.forEach(M=>M())}}function Ep(e,t){const{defer:n}=t,s=n?fe:o=>o(),r=[];return r.push(s(()=>{const o=typeof e=="function"?e():e;r.push(wp(o,t))})),()=>{r.forEach(o=>o?.())}}function zi(e,t,n){const s=e.ownerDocument.defaultView||window,r=new s.CustomEvent(t,n);return e.dispatchEvent(r)}function Sp(e,t){const n=s=>{s.key==="Escape"&&(s.isComposing||t?.(s))};return Ls(Oe(e),"keydown",n,{capture:!0})}var Zi="layer:request-dismiss",ye={layers:[],branches:[],recentlyRemoved:new Set,count(){return this.layers.length},pointerBlockingLayers(){return this.layers.filter(e=>e.pointerBlocking)},topMostPointerBlockingLayer(){return[...this.pointerBlockingLayers()].slice(-1)[0]},hasPointerBlockingLayer(){return this.pointerBlockingLayers().length>0},isBelowPointerBlockingLayer(e){const t=this.indexOf(e),n=this.topMostPointerBlockingLayer()?this.indexOf(this.topMostPointerBlockingLayer()?.node):-1;return t<n},isTopMost(e){return this.layers[this.count()-1]?.node===e},getNestedLayers(e){return Array.from(this.layers).slice(this.indexOf(e)+1)},getLayersByType(e){return this.layers.filter(t=>t.type===e)},getNestedLayersByType(e,t){const n=this.indexOf(e);return n===-1?[]:this.layers.slice(n+1).filter(s=>s.type===t)},getParentLayerOfType(e,t){const n=this.indexOf(e);if(!(n<=0))return this.layers.slice(0,n).reverse().find(s=>s.type===t)},countNestedLayersOfType(e,t){return this.getNestedLayersByType(e,t).length},isInNestedLayer(e,t){return!!(this.getNestedLayers(e).some(s=>an(s.node,t))||this.recentlyRemoved.size>0)},isInBranch(e){return Array.from(this.branches).some(t=>an(t,e))},add(e){const t=this.indexOf(e.node);t!==-1&&this.layers.splice(t,1),this.layers.push(e),this.syncLayers()},addBranch(e){this.branches.push(e)},remove(e){const t=this.indexOf(e);if(t<0)return;this.layers[t].styleTargets?.forEach(s=>{const r=s();r&&xp(r)}),this.recentlyRemoved.add(e),sl(()=>this.recentlyRemoved.delete(e)),t<this.count()-1&&this.getNestedLayers(e).forEach(r=>ye.dismiss(r.node,e)),this.layers.splice(t,1),this.syncLayers()},removeBranch(e){const t=this.branches.indexOf(e);t>=0&&this.branches.splice(t,1)},syncLayers(){this.layers.forEach((e,t)=>{Ji(e,t,e.node),e.styleTargets?.forEach(n=>{const s=n();if(!s||s===e.node)return;Ji(e,t,s);const{zIndex:r}=Ja(e.node);s.style.setProperty("--z-index",r)})})},indexOf(e){return this.layers.findIndex(t=>t.node===e)},dismiss(e,t){const n=this.indexOf(e);if(n===-1)return;const s=this.layers[n];Ip(e,Zi,r=>{s.requestDismiss?.(r),r.defaultPrevented||s?.dismiss()}),$p(e,Zi,{originalLayer:e,targetLayer:t,originalIndex:n,targetIndex:t?this.indexOf(t):-1}),this.syncLayers()},clear(){this.remove(this.layers[0].node)}};function Ji(e,t,n){n.style.setProperty("--layer-index",`${t}`),n.removeAttribute("data-nested"),n.removeAttribute("data-has-nested"),ye.getParentLayerOfType(e.node,e.type)&&n.setAttribute("data-nested",e.type);const r=ye.countNestedLayersOfType(e.node,e.type);r>0&&n.setAttribute("data-has-nested",e.type),n.style.setProperty("--nested-layer-count",`${r}`)}function xp(e){e.style.removeProperty("--layer-index"),e.style.removeProperty("--nested-layer-count"),e.removeAttribute("data-nested"),e.removeAttribute("data-has-nested")}function $p(e,t,n){const s=e.ownerDocument.defaultView||window,r=new s.CustomEvent(t,{cancelable:!0,bubbles:!0,detail:n});return e.dispatchEvent(r)}function Ip(e,t,n){e.addEventListener(t,n,{once:!0})}var Mr=new WeakMap,Un=new WeakMap;function Tp(e){return ye.isBelowPointerBlockingLayer(e)?"none":"auto"}function kl(e){const t=Tp(e);e.style.pointerEvents!==t&&(e.style.pointerEvents=t)}function Cp(e){if(Un.has(e))return;const t=he(e);if(typeof t.MutationObserver>"u")return;const n=new t.MutationObserver(()=>{Un.has(e)&&kl(e)});n.observe(e,{attributes:!0,attributeFilter:["style"]}),Un.set(e,n)}function Xi(){ye.layers.forEach(({node:e})=>{kl(e),Cp(e)})}function kp(e){const t=Un.get(e);t&&(t.disconnect(),Un.delete(e)),e.style.pointerEvents=""}function Ap(e,t){const n=Oe(e),s=[];return ye.hasPointerBlockingLayer()&&!n.body.hasAttribute("data-inert")&&(Mr.set(n.body,n.body.style.pointerEvents),queueMicrotask(()=>{const r=n.body;r&&(r.style.pointerEvents="none",r.setAttribute("data-inert",""))})),t?.forEach(r=>{const[o,i]=wf(()=>{const a=r();return ce(a)?a:null},{timeout:1e3});o.then(a=>s.push(pf(a,{pointerEvents:"auto"}))),s.push(i)}),()=>{ye.hasPointerBlockingLayer()||(queueMicrotask(()=>{const r=n.body;if(!r)return;const o=Mr.get(r);o!==void 0&&(r.style.pointerEvents=o,Mr.delete(r)),r.removeAttribute("data-inert"),r.style.length===0&&r.removeAttribute("style")}),s.forEach(r=>r()))}}function Lp(e,t){const{onDismiss:n,onRequestDismiss:s,pointerBlocking:r,exclude:o,debug:i,type:a="dialog",layerStyleTargets:d}=t,l={dismiss:n,node:e,type:a,pointerBlocking:r,requestDismiss:s,styleTargets:d};ye.add(l),Xi();function f(c){const g=ut(c.detail.originalEvent);ye.isBelowPointerBlockingLayer(e)||ye.isInBranch(g)||(t.onPointerDownOutside?.(c),t.onInteractOutside?.(c),!c.defaultPrevented&&(i&&console.log("onPointerDownOutside:",c.detail.originalEvent),n?.(c)))}function u(c){const g=ut(c.detail.originalEvent);ye.isInBranch(g)||(t.onFocusOutside?.(c),t.onInteractOutside?.(c),!c.defaultPrevented&&(i&&console.log("onFocusOutside:",c.detail.originalEvent),n?.(c)))}function h(c){ye.isTopMost(e)&&(t.onEscapeKeyDown?.(c),!c.defaultPrevented&&n&&(c.preventDefault(),n(c)))}function p(c){const g=typeof o=="function"?o():o,b=Array.isArray(g)?g:[g],w=t.persistentElements?.map(A=>A()).filter(ce);return w&&b.push(...w),b.some(A=>an(A,c))||ye.isInNestedLayer(e,c)}const m=[r?Ap(e,t.persistentElements):void 0,Sp(e,h),Ep(e,{exclude:p,onFocusOutside:u,onPointerDownOutside:f,defer:t.defer})];return()=>{ye.remove(e),Xi(),kp(e),m.forEach(c=>c?.())}}function Al(e,t){const{warnOnMissingNode:n=!0}=t;return Sf(e,s=>Lp(s,t),{defer:t.defer,getRootNode:t.getRootNode,onMissing:n?()=>ks("[@zag-js/dismissable] node is `null` or `undefined`"):void 0})}var{and:Ln,not:Ot,or:Op}=Il(),Mp=Tl({props({props:e}){return{loopFocus:!1,closeOnSelect:!e.multiple,composite:!0,defaultValue:[],...e,collection:e.collection??_s.empty(),positioning:{placement:"bottom-start",gutter:8,...e.positioning}}},context({prop:e,bindable:t,getContext:n}){const s=e("value")??e("defaultValue")??[],r=e("collection").findMany(s);return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:mn,onChange(o){const i=n(),a=e("collection"),d=i.get("selectedItemMap"),l=ls({values:o,collection:a,selectedItemMap:d}),f=e("value")??o,u=f===o?l:ls({values:f,collection:a,selectedItemMap:l.nextSelectedItemMap});return i.set("selectedItemMap",u.nextSelectedItemMap),e("onValueChange")?.({value:o,items:l.selectedItems})}})),highlightedValue:t(()=>({defaultValue:e("defaultHighlightedValue")||null,value:e("highlightedValue"),onChange(o){e("onHighlightChange")?.({highlightedValue:o,highlightedItem:e("collection").find(o),highlightedIndex:e("collection").indexOf(o)})}})),currentPlacement:t(()=>({defaultValue:void 0})),fieldsetDisabled:t(()=>({defaultValue:!1})),highlightedItem:t(()=>({defaultValue:null})),selectedItemMap:t(()=>({defaultValue:Zd({selectedItems:r,collection:e("collection")})}))}},refs(){return{typeahead:{...eo.defaultOptions}}},computed:{hasSelectedItems:({context:e})=>e.get("value").length>0,isTypingAhead:({refs:e})=>e.get("typeahead").keysSoFar!=="",isDisabled:({prop:e,context:t})=>!!e("disabled")||!!t.get("fieldsetDisabled"),isInteractive:({prop:e})=>!(e("disabled")||e("readOnly")),selectedItems:({context:e,prop:t})=>Ga({values:e.get("value"),collection:t("collection"),selectedItemMap:e.get("selectedItemMap")}),valueAsString:({computed:e,prop:t})=>t("collection").stringifyItems(e("selectedItems"))},initialState({prop:e}){return e("open")||e("defaultOpen")?"open":"idle"},entry:["syncSelectElement"],watch({context:e,prop:t,track:n,action:s}){n([()=>e.get("value").toString()],()=>{s(["syncSelectedItems","syncSelectElement","dispatchChangeEvent"])}),n([()=>t("open")],()=>{s(["toggleVisibility"])}),n([()=>e.get("highlightedValue")],()=>{s(["syncHighlightedItem"])}),n([()=>t("collection").toString()],()=>{s(["syncCollection"])})},on:{"HIGHLIGHTED_VALUE.SET":{actions:["setHighlightedItem"]},"HIGHLIGHTED_VALUE.CLEAR":{actions:["clearHighlightedItem"]},"ITEM.SELECT":{actions:["selectItem"]},"ITEM.CLEAR":{actions:["clearItem"]},"VALUE.SET":{actions:["setSelectedItems"]},"VALUE.CLEAR":{actions:["clearSelectedItems"]},"CLEAR.CLICK":{actions:["clearSelectedItems","focusTriggerEl"]}},effects:["trackFormControlState"],states:{idle:{tags:["closed"],on:{"CONTROLLED.OPEN":[{guard:"isTriggerClickEvent",target:"open",actions:["setInitialFocus","highlightFirstSelectedItem"]},{target:"open",actions:["setInitialFocus"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen","setInitialFocus","highlightFirstSelectedItem"]}],"TRIGGER.FOCUS":{target:"focused"},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen"]}]}},focused:{tags:["closed"],on:{"CONTROLLED.OPEN":[{guard:"isTriggerClickEvent",target:"open",actions:["setInitialFocus","highlightFirstSelectedItem"]},{guard:"isTriggerArrowUpEvent",target:"open",actions:["setInitialFocus","highlightComputedLastItem"]},{guard:Op("isTriggerArrowDownEvent","isTriggerEnterEvent"),target:"open",actions:["setInitialFocus","highlightComputedFirstItem"]},{target:"open",actions:["setInitialFocus"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen"]}],"TRIGGER.BLUR":{target:"idle"},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightFirstSelectedItem"]}],"TRIGGER.ENTER":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightComputedFirstItem"]}],"TRIGGER.ARROW_UP":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightComputedLastItem"]}],"TRIGGER.ARROW_DOWN":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightComputedFirstItem"]}],"TRIGGER.ARROW_LEFT":[{guard:Ln(Ot("multiple"),"hasSelectedItems"),actions:["selectPreviousItem"]},{guard:Ot("multiple"),actions:["selectLastItem"]}],"TRIGGER.ARROW_RIGHT":[{guard:Ln(Ot("multiple"),"hasSelectedItems"),actions:["selectNextItem"]},{guard:Ot("multiple"),actions:["selectFirstItem"]}],"TRIGGER.HOME":{guard:Ot("multiple"),actions:["selectFirstItem"]},"TRIGGER.END":{guard:Ot("multiple"),actions:["selectLastItem"]},"TRIGGER.TYPEAHEAD":{guard:Ot("multiple"),actions:["selectMatchingItem"]}}},open:{tags:["open"],exit:["scrollContentToTop"],effects:["trackDismissableElement","trackFocusVisible","computePlacement","scrollToHighlightedItem"],on:{"CONTROLLED.CLOSE":[{guard:"restoreFocus",target:"focused",actions:["focusTriggerEl","clearHighlightedItem"]},{target:"idle",actions:["clearHighlightedItem"]}],CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{guard:"restoreFocus",target:"focused",actions:["invokeOnClose","focusTriggerEl","clearHighlightedItem"]},{target:"idle",actions:["invokeOnClose","clearHighlightedItem"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose","clearHighlightedItem"]}],"ITEM.CLICK":[{guard:Ln("closeOnSelect","isOpenControlled"),actions:["selectHighlightedItem","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectHighlightedItem","invokeOnClose","focusTriggerEl","clearHighlightedItem"]},{actions:["selectHighlightedItem"]}],"CONTENT.HOME":{actions:["highlightFirstItem"]},"CONTENT.END":{actions:["highlightLastItem"]},"CONTENT.ARROW_DOWN":[{guard:Ln("hasHighlightedItem","loop","isLastItemHighlighted"),actions:["highlightFirstItem"]},{guard:"hasHighlightedItem",actions:["highlightNextItem"]},{actions:["highlightFirstItem"]}],"CONTENT.ARROW_UP":[{guard:Ln("hasHighlightedItem","loop","isFirstItemHighlighted"),actions:["highlightLastItem"]},{guard:"hasHighlightedItem",actions:["highlightPreviousItem"]},{actions:["highlightLastItem"]}],"CONTENT.TYPEAHEAD":{actions:["highlightMatchingItem"]},"ITEM.POINTER_MOVE":{actions:["highlightItem"]},"ITEM.POINTER_LEAVE":{actions:["clearHighlightedItem"]},"POSITIONING.SET":{actions:["reposition"]}}}},implementations:{guards:{loop:({prop:e})=>!!e("loopFocus"),multiple:({prop:e})=>!!e("multiple"),hasSelectedItems:({computed:e})=>!!e("hasSelectedItems"),hasHighlightedItem:({context:e})=>e.get("highlightedValue")!=null,isFirstItemHighlighted:({context:e,prop:t})=>e.get("highlightedValue")===t("collection").firstValue,isLastItemHighlighted:({context:e,prop:t})=>e.get("highlightedValue")===t("collection").lastValue,closeOnSelect:({prop:e,event:t})=>!!(t.closeOnSelect??e("closeOnSelect")),restoreFocus:({event:e})=>Qi(e),isOpenControlled:({prop:e})=>e("open")!==void 0,isTriggerClickEvent:({event:e})=>e.previousEvent?.type==="TRIGGER.CLICK",isTriggerEnterEvent:({event:e})=>e.previousEvent?.type==="TRIGGER.ENTER",isTriggerArrowUpEvent:({event:e})=>e.previousEvent?.type==="TRIGGER.ARROW_UP",isTriggerArrowDownEvent:({event:e})=>e.previousEvent?.type==="TRIGGER.ARROW_DOWN"},effects:{trackFocusVisible({scope:e}){return Rf({root:e.getRootNode?.()})},trackFormControlState({context:e,scope:t}){return Pu(Ar(t),{onFieldsetDisabledChange(n){e.set("fieldsetDisabled",n)},onFormReset(){const n=e.initial("value");e.set("value",n)}})},trackDismissableElement({scope:e,send:t,prop:n}){const s=()=>kn(e);let r=!0;return Al(s,{type:"listbox",defer:!0,getRootNode:e.getRootNode,layerStyleTargets:[()=>Lr(e)],exclude:[Rt(e),Qh(e)],onFocusOutside:n("onFocusOutside"),onPointerDownOutside:n("onPointerDownOutside"),onInteractOutside(o){n("onInteractOutside")?.(o),r=!(o.detail.focusable||o.detail.contextmenu)},onDismiss(o){t({type:"CLOSE",src:"interact-outside",restoreFocus:r,focusVisible:o?.type==="keydown"})}})},computePlacement({context:e,prop:t,scope:n}){const s=t("positioning");return e.set("currentPlacement",s.placement),io(()=>Rt(n),()=>Lr(n),{defer:!0,...s,onComplete(i){e.set("currentPlacement",i.placement)}})},scrollToHighlightedItem({context:e,prop:t,scope:n}){const s=a=>{const d=e.get("highlightedValue");if(d==null||so()==="pointer")return;const f=kn(n),u=t("scrollToIndexFn");if(u){const p=t("collection").indexOf(d);u?.({index:p,immediate:a,getElement:()=>Or(n,d)});return}const h=Or(n,d);lf(h,{rootEl:f,block:"nearest"})},r=fe(()=>{Df("virtual"),s(!0)}),i=Zu(()=>kn(n),{attributes:["data-activedescendant"],callback(){s(!1)}});return()=>{r(),i()}}},actions:{reposition({context:e,prop:t,scope:n,event:s}){const r=()=>Lr(n);io(Rt(n),r,{...t("positioning"),...s.options,defer:!0,listeners:!1,onComplete(o){e.set("currentPlacement",o.placement)}})},toggleVisibility({send:e,prop:t,event:n}){e({type:t("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:n})},highlightPreviousItem({context:e,prop:t}){const n=e.get("highlightedValue");if(n==null)return;const s=t("collection").getPreviousValue(n,1,t("loopFocus"));s!=null&&e.set("highlightedValue",s)},highlightNextItem({context:e,prop:t}){const n=e.get("highlightedValue");if(n==null)return;const s=t("collection").getNextValue(n,1,t("loopFocus"));s!=null&&e.set("highlightedValue",s)},highlightFirstItem({context:e,prop:t}){const n=t("collection").firstValue;e.set("highlightedValue",n)},highlightLastItem({context:e,prop:t}){const n=t("collection").lastValue;e.set("highlightedValue",n)},setInitialFocus({scope:e}){fe(()=>{const t=qu({root:kn(e)});t&&t.focus({preventScroll:!0})})},focusTriggerEl({event:e,scope:t}){if(!Qi(e))return;const n=Dp(e);fe(()=>{Rt(t)?.focus(n)})},selectHighlightedItem({context:e,prop:t,event:n}){let s=n.value??e.get("highlightedValue");if(s==null||!t("collection").has(s))return;t("onSelect")?.({value:s}),s=t("deselectable")&&!t("multiple")&&e.get("value").includes(s)?null:s,e.set("value",o=>s==null?[]:t("multiple")?bi(o,s):[s])},highlightComputedFirstItem({context:e,prop:t,computed:n}){const s=t("collection"),r=n("hasSelectedItems")?s.sort(e.get("value"))[0]:s.firstValue;e.set("highlightedValue",r)},highlightComputedLastItem({context:e,prop:t,computed:n}){const s=t("collection"),r=n("hasSelectedItems")?s.sort(e.get("value"))[0]:s.lastValue;e.set("highlightedValue",r)},highlightFirstSelectedItem({context:e,prop:t,computed:n}){if(!n("hasSelectedItems"))return;const s=t("collection").sort(e.get("value"))[0];e.set("highlightedValue",s)},highlightItem({context:e,event:t}){e.set("highlightedValue",t.value)},highlightMatchingItem({context:e,prop:t,event:n,refs:s}){const r=t("collection").search(n.key,{state:s.get("typeahead"),currentValue:e.get("highlightedValue")});r!=null&&e.set("highlightedValue",r)},setHighlightedItem({context:e,event:t}){e.set("highlightedValue",t.value)},clearHighlightedItem({context:e}){e.set("highlightedValue",null)},selectItem({context:e,prop:t,event:n}){t("onSelect")?.({value:n.value});const r=t("deselectable")&&!t("multiple")&&e.get("value").includes(n.value)?null:n.value;e.set("value",o=>r==null?[]:t("multiple")?bi(o,r):[r])},clearItem({context:e,event:t}){e.set("value",n=>n.filter(s=>s!==t.value))},setSelectedItems({context:e,event:t}){e.set("value",t.value)},clearSelectedItems({context:e}){e.set("value",[])},selectPreviousItem({context:e,prop:t}){const[n]=e.get("value"),s=t("collection").getPreviousValue(n);s&&e.set("value",[s])},selectNextItem({context:e,prop:t}){const[n]=e.get("value"),s=t("collection").getNextValue(n);s&&e.set("value",[s])},selectFirstItem({context:e,prop:t}){const n=t("collection").firstValue;n&&e.set("value",[n])},selectLastItem({context:e,prop:t}){const n=t("collection").lastValue;n&&e.set("value",[n])},selectMatchingItem({context:e,prop:t,event:n,refs:s}){const r=t("collection").search(n.key,{state:s.get("typeahead"),currentValue:e.get("value")[0]});r!=null&&e.set("value",[r])},scrollContentToTop({prop:e,scope:t}){if(e("scrollToIndexFn")){const n=e("collection").firstValue;e("scrollToIndexFn")?.({index:0,immediate:!0,getElement:()=>Or(t,n)})}else kn(t)?.scrollTo(0,0)},invokeOnOpen({prop:e,context:t}){e("onOpenChange")?.({open:!0,value:t.get("value")})},invokeOnClose({prop:e,context:t}){e("onOpenChange")?.({open:!1,value:t.get("value")})},syncSelectElement({context:e,prop:t,scope:n}){const s=Ar(n);if(s){if(e.get("value").length===0&&!t("multiple")){s.selectedIndex=-1;return}for(const r of s.options)r.selected=e.get("value").includes(r.value)}},syncCollection({context:e,prop:t}){const n=t("collection"),s=n.find(e.get("highlightedValue"));s&&e.set("highlightedItem",s);const r=ls({values:e.get("value"),collection:n,selectedItemMap:e.get("selectedItemMap")});e.set("selectedItemMap",r.nextSelectedItemMap)},syncSelectedItems({context:e,prop:t}){const n=ls({values:e.get("value"),collection:t("collection"),selectedItemMap:e.get("selectedItemMap")});e.set("selectedItemMap",n.nextSelectedItemMap)},syncHighlightedItem({context:e,prop:t}){const n=t("collection"),s=e.get("highlightedValue"),r=s?n.find(s):null;e.set("highlightedItem",r)},dispatchChangeEvent({scope:e}){queueMicrotask(()=>{const t=Ar(e);if(!t)return;const n=e.getWin(),s=new n.Event("change",{bubbles:!0,composed:!0});t.dispatchEvent(Vu(s))})}}}});function Qi(e){const t=e.restoreFocus??e.previousEvent?.restoreFocus;return t==null||!!t}function Dp(e){return e.focusVisible??e.previousEvent?.focusVisible?{preventScroll:!0,focusVisible:!0}:{preventScroll:!0}}function Rp(e){return new Proxy({},{get(t,n){return n==="style"?s=>e({style:s}).style:e}})}var Pp=Object.defineProperty,Vp=(e,t,n)=>t in e?Pp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,U=(e,t,n)=>Vp(e,typeof t!="symbol"?t+"":t,n),ea={onFocus:"onFocusin",onBlur:"onFocusout",onChange:"onInput",onDoubleClick:"onDblclick",htmlFor:"for",className:"class",defaultValue:"value",defaultChecked:"checked"},Np=new Set(["viewBox","preserveAspectRatio"]),Ll=Rp(e=>Object.entries(e).reduce((t,[n,s])=>{if(s===void 0)return t;n in ea&&(n=ea[n]);const r=Np.has(n)?n:n.toLowerCase();return t[r]=s,t},{})),hs=new WeakMap,ta=new Set(["value","checked","selected"]),Fp=new Set(["viewBox","preserveAspectRatio","clipPath","clipRule","fillRule","strokeWidth","strokeLinecap","strokeLinejoin","strokeDasharray","strokeDashoffset","strokeMiterlimit"]),Hp=e=>e.tagName==="svg"||e.namespaceURI==="http://www.w3.org/2000/svg",ps=(e,t)=>Hp(e)&&Fp.has(t)?t:t.toLowerCase(),Dr=e=>e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),na=(e,t,n)=>{if(typeof n=="string"){e.setAttribute("style",n);return}if(n==null&&typeof t=="string"){e.removeAttribute("style");return}const s=e.style;if(s!=null){for(const r in t)n?.[r]==null&&s.removeProperty(Dr(r));for(const r in n){const o=n[r];o==null?s.removeProperty(Dr(r)):s.setProperty(Dr(r),String(o))}}};function ne(e,t,n){const s="default";let r=hs.get(e);r||(r=new Map,hs.set(e,r));const o=r.get(s)||{},i=Object.keys(t),a=(c,g)=>{e.addEventListener(c.toLowerCase(),g)},d=(c,g)=>{e.removeEventListener(c.toLowerCase(),g)},l=c=>c.startsWith("on"),f=c=>!c.startsWith("on"),u=c=>a(c.substring(2),t[c]),h=c=>d(c.substring(2),t[c]),p=c=>{const g=t[c],b=o[c];if(g!==b){if(c==="class"){e.className=g??"";return}if(c==="style"){na(e,b,g);return}if(ta.has(c)){e[c]=g??"";return}if(typeof g=="boolean"&&!c.includes("aria-")){e.toggleAttribute(ps(e,c),g);return}if(c==="children"){e.innerHTML=g;return}if(g!=null){e.setAttribute(ps(e,c),g);return}e.removeAttribute(ps(e,c))}};for(const c in o)t[c]==null&&(c==="class"?e.className="":c==="style"?na(e,o[c],void 0):ta.has(c)?e[c]="":e.removeAttribute(ps(e,c)));return Object.keys(o).filter(l).forEach(c=>{d(c.substring(2),o[c])}),i.filter(l).forEach(u),i.filter(f).forEach(p),r.set(s,t),function(){i.filter(l).forEach(h);const g=hs.get(e);g&&(g.delete(s),g.size===0&&hs.delete(e))}}function _p(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global}function Ol(e,t){const n=_p();return n?(n[e]||(n[e]=t()),n[e]):t()}var Ms=Ol("__zag__refSet",()=>new WeakSet),Bp=e=>typeof e=="object"&&e!==null&&"$$typeof"in e&&"props"in e,Wp=e=>typeof e=="object"&&e!==null&&"__v_isVNode"in e,jp=e=>typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeName=="string",Up=e=>Bp(e)||Wp(e)||jp(e),po=e=>e!==null&&typeof e=="object",sa=e=>po(e)&&!Ms.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!Up(e)&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof Error)&&!(e instanceof Number)&&!(e instanceof Date)&&!(e instanceof String)&&!(e instanceof RegExp)&&!(e instanceof ArrayBuffer)&&!(e instanceof Promise)&&!(e instanceof File)&&!(e instanceof Blob)&&!(e instanceof AbortController);const qp=Symbol(),ra=Object.getPrototypeOf,go=new WeakMap,Gp=e=>e&&(go.has(e)?go.get(e):ra(e)===Object.prototype||ra(e)===Array.prototype),Yp=e=>Gp(e)&&e[qp]||null,oa=(e,t=!0)=>{go.set(e,t)};var Dt=Ol("__zag__proxyStateMap",()=>new WeakMap),Kp=(e=Object.is,t=(a,d)=>new Proxy(a,d),n=new WeakMap,s=(a,d)=>{const l=n.get(a);if(l?.[0]===d)return l[1];const f=Array.isArray(a)?[]:Object.create(Object.getPrototypeOf(a));return oa(f,!0),n.set(a,[d,f]),Reflect.ownKeys(a).forEach(u=>{const h=Reflect.get(a,u);Ms.has(h)?(oa(h,!1),f[u]=h):Dt.has(h)?f[u]=Zp(h):f[u]=h}),Object.freeze(f)},r=new WeakMap,o=[1,1],i=a=>{if(!po(a))throw new Error("object required");const d=r.get(a);if(d)return d;let l=o[0];const f=new Set,u=(v,S=++o[0])=>{l!==S&&(l=S,f.forEach(T=>T(v,S)))};let h=o[1];const p=(v=++o[1])=>(h!==v&&!f.size&&(h=v,c.forEach(([S])=>{const T=S[1](v);T>l&&(l=T)})),l),m=v=>(S,T)=>{const L=[...S];L[1]=[v,...L[1]],u(L,T)},c=new Map,g=(v,S)=>{if(f.size){const T=S[3](m(v));c.set(v,[S,T])}else c.set(v,[S])},b=v=>{const S=c.get(v);S&&(c.delete(v),S[1]?.())},w=v=>(f.add(v),f.size===1&&c.forEach(([T,L],E)=>{const O=T[3](m(E));c.set(E,[T,O])}),()=>{f.delete(v),f.size===0&&c.forEach(([T,L],E)=>{L&&(L(),c.set(E,[T]))})}),A=Array.isArray(a)?[]:Object.create(Object.getPrototypeOf(a)),M=t(A,{deleteProperty(v,S){const T=Reflect.get(v,S);b(S);const L=Reflect.deleteProperty(v,S);return L&&u(["delete",[S],T]),L},set(v,S,T,L){const E=Reflect.has(v,S),O=Reflect.get(v,S,L);if(E&&(e(O,T)||r.has(T)&&e(O,r.get(T))))return!0;b(S),po(T)&&(T=Yp(T)||T);let R=T;if(!Object.getOwnPropertyDescriptor(v,S)?.set){!Dt.has(T)&&sa(T)&&(R=Ml(T));const V=!Ms.has(R)&&Dt.get(R);V&&g(S,V)}return Reflect.set(v,S,R,L),u(["set",[S],T,O]),!0}});r.set(a,M);const $=[A,p,s,w];return Dt.set(M,$),Reflect.ownKeys(a).forEach(v=>{const S=Object.getOwnPropertyDescriptor(a,v);S.get||S.set?Object.defineProperty(A,v,S):M[v]=a[v]}),M})=>[i,Dt,Ms,e,t,sa,n,s,r,o],[zp]=Kp();function Ml(e={}){return zp(e)}function ia(e,t,n){const s=Dt.get(e);let r;const o=[],i=s[3];let a=!1;const l=i(f=>{o.push(f),r||(r=Promise.resolve().then(()=>{r=void 0,a&&t(o.splice(0))}))});return a=!0,()=>{a=!1,l()}}function Zp(e){const t=Dt.get(e),[n,s,r]=t;return r(n,s())}function Ks(e){const t=e().value??e().defaultValue;e().debug&&console.log(`[bindable > ${e().debug}] initial`,t);const n=e().isEqual??Object.is,s=Ml({value:t}),r=()=>e().value!==void 0;return{initial:t,ref:s,get(){return r()?e().value:s.value},set(o){const i=r()?e().value:s.value,a=Je(o)?o(i):o;e().debug&&console.log(`[bindable > ${e().debug}] setValue`,{next:a,prev:i}),r()||(s.value=a),n(a,i)||e().onChange?.(a,i)},invoke(o,i){e().onChange?.(o,i)},hash(o){return e().hash?.(o)??String(o)}}}Ks.cleanup=e=>{};Ks.ref=e=>{let t=e;return{get:()=>t,set:n=>{t=n}}};function Jp(e){const t={current:e};return{get(n){return t.current[n]},set(n,s){t.current[n]=s}}}var{defineProperty:Xp,getOwnPropertyDescriptor:Qp,getOwnPropertyDescriptors:aa}=Object;function _n(e,t){if(Object.is(e,t))return e;if(!Nn(e)||!Nn(t))return t===void 0?e:t;let n=e;const s=(r,o)=>{n===e&&(n=Object.defineProperties({},aa(e))),Xp(n,r,o)};for(const[r,o]of Object.entries(aa(t))){if(!o.enumerable)continue;if(o.get){s(r,o);continue}const i=o.value;if(i===void 0)continue;const a=!!Qp(e,r)?.get,d=e[r],l=Nn(d)&&Nn(i)?_n(d,i):i;!a&&Object.is(d,l)||s(r,{value:l,writable:!0,enumerable:!0,configurable:!0})}return n}var Dl=class{constructor(e,t={}){U(this,"machine",e),U(this,"scope"),U(this,"context"),U(this,"prop"),U(this,"state"),U(this,"refs"),U(this,"computed"),U(this,"event",{type:""}),U(this,"previousEvent",{type:""}),U(this,"effects",new Map),U(this,"replaceTracker",rp()),U(this,"transition",null),U(this,"cleanups",[]),U(this,"subscriptions",[]),U(this,"userProps"),U(this,"userPropsSources",[]),U(this,"getUserProps",()=>{let u=this.userProps;for(const h of this.userPropsSources){const p=Si(h);u=u?_n(u,p):p}return u}),U(this,"getEvent",()=>({...this.event,current:()=>this.event,previous:()=>this.previousEvent})),U(this,"getState",()=>({...this.state,matches:(...u)=>u.some(h=>fp(this.state.get(),h)),hasTag:u=>hp(this.machine,this.state.get(),u)})),U(this,"debug",(...u)=>{this.machine.debug&&console.log(...u)}),U(this,"notify",()=>{this.publish()}),U(this,"send",u=>{if(this.status!==Hn.Started)return;const h=u?.replaces,p=h?this.replaceTracker.claim(h):void 0;queueMicrotask(()=>{if(!u||h&&p&&this.replaceTracker.isReplaced(h,p))return;this.previousEvent=this.event,this.event=u,this.debug("send",u);let m=this.state.get();const c=u.type,{transitions:g,source:b}=dp(this.machine,m,c),w=this.choose(g);if(!w)return;this.transition=w;const A=qi(this.machine,w.target??m,b);this.debug("transition",w),A!==m?this.state.set(A):w.reenter?this.state.invoke(m,m):this.action(w.actions)})}),U(this,"action",u=>{const h=Je(u)?u(this.getParams()):u;if(!h)return;const p=h.map(m=>{const c=this.machine.implementations?.actions?.[m];return c||ks(`[zag-js] No implementation found for action "${JSON.stringify(m)}"`),c});for(const m of p)m?.(this.getParams())}),U(this,"guard",u=>{if(Je(u))return u(this.getParams());const h=this.machine.implementations?.guards?.[u];return h||ks(`[zag-js] No implementation found for guard "${JSON.stringify(u)}"`),h?.(this.getParams())}),U(this,"effect",u=>{const h=Je(u)?u(this.getParams()):u;if(!h)return;const p=h.map(c=>{const g=this.machine.implementations?.effects?.[c];return g||ks(`[zag-js] No implementation found for effect "${JSON.stringify(c)}"`),g}),m=[];for(const c of p){const g=c?.(this.getParams());g&&m.push(g)}return()=>m.forEach(c=>c?.())}),U(this,"choose",u=>Ld(u).find(h=>{let p=!h.guard;return Nd(h.guard)?p=!!this.guard(h.guard):Je(h.guard)&&(p=h.guard(this.getParams())),p})),U(this,"subscribe",u=>(this.subscriptions.push(u),()=>{const h=this.subscriptions.indexOf(u);h>-1&&this.subscriptions.splice(h,1)})),U(this,"status",Hn.NotStarted),U(this,"publish",()=>{this.callTrackers(),this.subscriptions.forEach(u=>u(this.service))}),U(this,"trackers",[]),U(this,"setupTrackers",()=>{this.machine.watch?.(this.getParams())}),U(this,"callTrackers",()=>{this.trackers.forEach(({deps:u,fn:h})=>{const p=u.map(m=>m());mn(h.prev,p)||(h(),h.prev=p)})}),U(this,"getParams",()=>({state:this.getState(),context:this.context,event:this.getEvent(),prop:this.prop,send:this.send,action:this.action,guard:this.guard,track:(u,h)=>{h.prev=u.map(p=>p()),this.trackers.push({deps:u,fn:h})},refs:this.refs,computed:this.computed,flush:Ud,scope:this.scope,choose:this.choose})),Je(t)?this.userPropsSources.push(t):this.userProps=t;const{id:n,ids:s,getRootNode:r}=Si(t);this.scope=pp({id:n,ids:s,getRootNode:r});const o=u=>{const h=this.getUserProps();return(e.props?.({props:Co(h),scope:this.scope})??h)[u]};this.prop=o;const i=e.context?.({prop:o,bindable:Ks,scope:this.scope,flush(u){queueMicrotask(u)},getContext(){return a},getComputed(){return d},getRefs(){return l},getEvent:this.getEvent.bind(this)});i&&Object.values(i).forEach(u=>{const h=ia(u.ref,()=>this.notify());this.cleanups.push(h)});const a={get(u){return i?.[u].get()},set(u,h){i?.[u].set(h)},initial(u){return i?.[u].initial},hash(u){const h=i?.[u].get();return i?.[u].hash(h)}};this.context=a;const d=u=>(Qs(e.computed,()=>"[zag-js] No computed object found on machine"),e.computed[u]({context:a,event:this.getEvent(),prop:o,refs:this.refs,scope:this.scope,computed:d}));this.computed=d;const l=Jp(e.refs?.({prop:o,context:a})??{});this.refs=l;const f=Ks(()=>({defaultValue:qi(e,e.initialState({prop:o})),onChange:(u,h)=>{const{exiting:p,entering:m}=up(this.machine,h,u,this.transition?.reenter);if(p.forEach(c=>{this.effects.get(c.path)?.(),this.effects.delete(c.path)}),p.forEach(c=>{this.action(c.state?.exit)}),this.action(this.transition?.actions),m.forEach(c=>{const g=this.effect(c.state?.effects);if(g){const b=this.effects.get(c.path);this.effects.set(c.path,b?Hs(b,g):g)}}),h===fs){this.action(e.entry);const c=this.effect(e.effects);if(c){const g=this.effects.get(fs);this.effects.set(fs,g?Hs(g,c):c)}}m.forEach(c=>{this.action(c.state?.entry)})}}));this.state=f,this.cleanups.push(ia(this.state.ref,()=>this.notify()))}updateProps(e){const t=this.userPropsSources;if(Je(e))t.push(e);else if(t.length===0)this.userProps=_n(this.userProps,e);else{const n=t.length-1,s=t[n];if(Je(s)){const r=_n({},e);r&&Object.keys(r).length>0&&t.push(r)}else t[n]=_n(s,e)}this.notify()}start(){this.status=Hn.Started,this.debug("initializing..."),this.state.invoke(this.state.initial,fs),this.setupTrackers()}stop(){this.effects.forEach(e=>e?.()),this.effects.clear(),this.transition=null,this.action(this.machine.exit),this.cleanups.forEach(e=>e()),this.cleanups=[],this.subscriptions=[],this.status=Hn.Stopped,this.debug("unmounting...")}get service(){return{state:this.getState(),send:this.send,context:this.context,prop:this.prop,scope:this.scope,refs:this.refs,computed:this.computed,event:this.getEvent(),getStatus:()=>this.status}}};const eg='<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m4 6 4 4 4-4"/></svg>',wt=new Map;let tg=0;function ng(e){const t=document.createElement("span");t.className="ui-select",t.innerHTML=`<button type="button" class="ui-select-trigger"><span></span>${eg}</button><div class="ui-select-positioner" popover="manual"><div class="ui-select-menu"></div></div>`,e.after(t),e.hidden=!0;const n=t.querySelector("button"),s=n.querySelector("span"),r=t.querySelector(".ui-select-positioner"),o=t.querySelector(".ui-select-menu");let i=[],a="",d=e.value,l=e.disabled;const f=new Dl(Mp,{id:`select-${++tg}`,collection:_s({items:i}),defaultValue:[d],disabled:l,positioning:{placement:"bottom-start",strategy:"fixed",sameWidth:!0,gutter:6},onValueChange({value:c}){e.value!==c[0]&&(d=e.value=c[0]??"",e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})))}}),u=()=>tp(f.service,Ll);function h(){const c=u();ne(t,c.getRootProps()),ne(n,{...c.getTriggerProps(),"aria-label":e.getAttribute("aria-label")||e.labels?.[0]?.textContent?.trim(),"aria-labelledby":void 0}),ne(r,c.getPositionerProps()),ne(o,{...c.getContentProps(),"aria-label":e.getAttribute("aria-label"),"aria-labelledby":void 0});const g=e.selectedOptions[0]?.textContent||"Choose…";s.textContent!==g&&(s.textContent=g),i.forEach((b,w)=>{const A=o.children[w];ne(A,c.getItemProps({item:b}))}),r.hidden=!c.open,c.open&&!r.matches(":popover-open")&&r.showPopover?.(),!c.open&&r.matches(":popover-open")&&r.hidePopover?.()}function p(){const c=Array.from(e.options,b=>({value:b.value,label:b.text,disabled:b.disabled})),g=JSON.stringify(c);g!==a&&(a=g,i=c,o.replaceChildren(...i.map(b=>{const w=document.createElement("div");return w.className="ui-select-option",w.textContent=b.label,w})),f.updateProps({collection:_s({items:i})})),d!==e.value&&(d=e.value,u().setValue([d])),l!==e.disabled&&(l=e.disabled,f.updateProps({disabled:l})),h()}t.addEventListener("keydown",c=>c.stopPropagation()),e.addEventListener("change",p);const m=f.subscribe(h);return f.start(),p(),{sync:p,focus:()=>n.focus(),dispose(){e.removeEventListener("change",p),m(),f.stop(),t.remove(),e.hidden=!1}}}function ln(e=document){for(const[t,n]of wt)t.isConnected||(n.dispose(),wt.delete(t));for(const t of e.querySelectorAll("select:not([data-native])"))wt.has(t)?wt.get(t).sync():wt.set(t,ng(t))}function sg(e){ln(e.parentElement),wt.get(e)?.focus()}function rg(){const e=new MutationObserver(t=>{t.some(n=>n.target instanceof Element&&(n.target.matches("select, option")||[...n.addedNodes,...n.removedNodes].some(s=>s instanceof Element&&(s.matches("select")||s.querySelector("select")))))&&ln()});return e.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["disabled"]}),ln(),()=>{e.disconnect();for(const t of wt.values())t.dispose();wt.clear()}}function og(e){const t=document.createElement("dialog");t.className="launch-dialog",t.setAttribute("aria-labelledby","launch-heading"),t.innerHTML=`
|
|
10
|
+
<button class="icon-button dialog-close" aria-label="Close open session">×</button>
|
|
11
|
+
<h2 id="launch-heading">Open session</h2><p class="launch-title"></p>
|
|
12
|
+
<label class="launch-destination">Open in<select aria-label="Open in">
|
|
13
|
+
${Vn.map(E=>`<option value="${E.id}">${E.name}</option>`).join("")}
|
|
14
|
+
<option value="web">OpenCode · Web browser</option>
|
|
15
|
+
</select></label>
|
|
16
|
+
<section class="launch-web" hidden>
|
|
17
|
+
<a class="primary-button launch-web-link" target="_blank" rel="noopener noreferrer" hidden>Open in browser ↗</a>
|
|
18
|
+
<details class="launch-pairing"><summary>First time connecting?</summary><p>Run <code>opencode pair</code> in your terminal and open its pairing link once. Then open this session again.</p><button class="text-button launch-copy-pair">Copy pairing command</button></details>
|
|
19
|
+
</section>
|
|
20
|
+
<section class="launch-cli">
|
|
21
|
+
<label class="launch-directory-label">Working directory<input class="launch-directory" aria-label="Working directory" spellcheck="false" autocomplete="off"/></label>
|
|
22
|
+
<div class="launch-summary" hidden><strong class="launch-mode"></strong><p class="launch-hint"></p>
|
|
23
|
+
<details class="launch-context" hidden><summary>Saved context</summary><p class="launch-coverage"></p><code class="launch-context-path"></code></details>
|
|
24
|
+
</div>
|
|
25
|
+
<input class="launch-command" aria-label="CLI command" readonly spellcheck="false" placeholder="Preparing command…"/>
|
|
26
|
+
<div class="launch-actions"><button class="primary-button launch-terminal" disabled>Open Terminal ↗</button><button class="secondary-button launch-copy" disabled>Copy command</button></div>
|
|
27
|
+
<p class="launch-availability"></p>
|
|
28
|
+
</section>
|
|
29
|
+
<p class="launch-status" role="status"></p>`,document.body.append(t);const n=new AbortController,s={signal:n.signal},r=E=>t.querySelector(E),o=r("select"),i=r(".launch-directory"),a=r(".launch-web-link"),d=r(".launch-command"),l=r(".launch-terminal"),f=r(".launch-copy"),u=r(".launch-status");let h,p=0,m=0,c,g,b,w,A,D=null;function M(){m++,g?.abort(),clearTimeout(A),b=void 0,d.value="",l.disabled=f.disabled=!0,r(".launch-summary").hidden=!0,r(".launch-availability").textContent=""}function $(){t.close(),p++,c?.abort(),M(),e(),D?.focus({preventScroll:!0})}async function v(E){try{await navigator.clipboard.writeText(E),u.textContent="Command copied."}catch{u.textContent=`Copy this command: ${E}`,E===d.value&&(d.focus(),d.select())}}function S(){if(a.hidden=!0,a.removeAttribute("href"),h&&w?.webBaseUrl)try{a.href=Id(w.webBaseUrl,h.nativeID||h.id),a.hidden=!1}catch{}u.textContent=w?a.hidden?"OpenCode is unavailable. Choose another app to use the saved conversation.":"":"Finding OpenCode…"}function T(E){const O=Vn.find(R=>R.id===o.value)?.name||je(o.value);d.value=E.command,f.disabled=!1,l.disabled=!E.terminalAvailable,l.textContent=`${E.mode==="resume"?"Resume in":"Open in"} ${O} ↗`,r(".launch-summary").hidden=!1,r(".launch-mode").textContent=E.mode==="resume"?"Resume original session":"New session · saved context",r(".launch-hint").textContent=E.mode==="resume"?`Continue this conversation in ${O}.`:`${O} will read the saved conversation, recap where you left off, and ask what to do next.${E.context?.partial?" Some history is missing or shortened.":""}`,r(".launch-context").hidden=!E.context,r(".launch-coverage").textContent=E.context?.note||"",r(".launch-context-path").textContent=E.context?.path||"",r(".launch-availability").textContent=E.targetAvailable?E.terminalAvailable?"":"Automatic terminal opening is unavailable. Run the copied command in your terminal.":`${O} CLI was not found. Install it, then run the copied command.`,u.textContent=""}async function L(){if(M(),!h||!t.open)return;const E=o.value==="web";if(r(".launch-web").hidden=!E,r(".launch-cli").hidden=E,E){S();return}if(!br(o.value))return;const O=m;g=new AbortController,u.textContent="Preparing command…";try{const R=await fetch(`/api/sessiongraph/session/${encodeURIComponent(h.id)}/prepare-launch`,{method:"POST",signal:g.signal,headers:{"Content-Type":"application/json","X-SessionGraph-Action":"prepare-launch"},body:JSON.stringify({target:o.value,directory:i.value})}),V=await R.json();if(!R.ok)throw new Error(V.error||"Could not prepare this session.");if(m!==O)return;b=V,T(b)}catch(R){m===O&&(d.placeholder="Command unavailable",u.textContent=R instanceof Error?R.message:"Could not prepare this session.")}}return o.addEventListener("change",()=>{try{localStorage.setItem("sessiongraph.open-target",o.value)}catch{}L()},s),i.addEventListener("input",()=>{M(),u.textContent="Checking working directory…",A=setTimeout(()=>{L()},300)},s),i.addEventListener("change",()=>{L()},s),r(".dialog-close").addEventListener("click",$,s),t.addEventListener("cancel",E=>{E.preventDefault(),$()},s),t.addEventListener("keydown",E=>{E.stopPropagation()},s),f.addEventListener("click",()=>{b&&v(b.command)},s),r(".launch-copy-pair").addEventListener("click",()=>{v("opencode pair")},s),l.addEventListener("click",async()=>{if(!h||!b||l.disabled)return;const E=p;l.disabled=o.disabled=i.disabled=!0,u.textContent="Opening Terminal…";try{const O=await fetch(`/api/sessiongraph/session/${encodeURIComponent(h.id)}/open-terminal`,{method:"POST",headers:{"Content-Type":"application/json","X-SessionGraph-Action":"open-terminal"},body:JSON.stringify({target:o.value,directory:b.directory})}),R=await O.json();if(!O.ok)throw new Error(R.error||"Could not open Terminal.");p===E&&(u.textContent="Session sent to Terminal.")}catch(O){p===E&&(u.textContent=O instanceof Error?O.message:"Could not open Terminal. Copy the command instead.")}finally{p===E&&(o.disabled=i.disabled=!1,l.disabled=!b?.terminalAvailable)}},s),{async open(E){h=E;const O=++p;c?.abort(),c=new AbortController,w=void 0,M(),t.open||(D=document.activeElement),r(".launch-title").textContent=`${je(E.source)} · ${E.title}`,i.value=E.directory,i.disabled=o.disabled=!1,o.value=br(E.source)?E.source:"opencode";const R=(!E.source||E.source==="opencode")&&Fa(E.nativeID||E.id);o.querySelector('[value="web"]').disabled=!R;for(const V of Vn)o.querySelector(`[value="${V.id}"]`).textContent=V.name;try{const V=localStorage.getItem("sessiongraph.open-target")||localStorage.getItem("session-atlas.open-target")||localStorage.getItem("atlas.open-target");(br(V)||V==="web"&&R)&&(o.value=V)}catch{}d.placeholder="Preparing command…",r(".launch-context").open=!1,t.open||t.showModal(),e(),sg(o),L();try{const V=await fetch(`/api/sessiongraph/session/${encodeURIComponent(E.id)}/connection`,{signal:c.signal});if(!V.ok)throw new Error("Connection unavailable");const H=await V.json();if(p!==O)return;w=H;for(const K of Vn){const se=H.targets.some(Z=>Z.id===K.id&&Z.available);o.querySelector(`[value="${K.id}"]`).textContent=`${K.name}${se?"":" · CLI not found"}`}o.value==="web"&&S()}catch{p===O&&o.value==="web"&&(u.textContent="OpenCode is unavailable. Choose another app to use the saved conversation.")}},dispose(){p++,c?.abort(),M(),n.abort(),t.remove()}}}const On=e=>e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]);function ig(e,t){const n=document.createElement("dialog");n.className="imports-dialog",n.setAttribute("aria-labelledby","imports-heading"),n.innerHTML='<button class="icon-button dialog-close" aria-label="Close sources">×</button><span class="eyebrow">SessionGraph</span><h2 id="imports-heading">Explore & visualize all your LLM sessions</h2><p class="imports-intro">Your history stays local. Choose the apps to read; import, search, and visualization run on this computer. No account, cloud sync, or telemetry.</p><details class="privacy-disclosure"><summary>Local data & network access</summary><p>Imports are read-only and never start an AI agent. Desktop update checks contact GitHub without session content. Explicitly continuing a session opens another harness, which may contact its model provider.</p><p>Saved history and handoff files are not encrypted by SessionGraph. Your device permissions and backups affect who can access them.</p></details><div class="import-sources"></div><div class="imports-progress" role="status"></div><details class="imports-notes" hidden><summary>Import details</summary><div></div></details><footer><span>Saved locally in SQLite</span><button class="primary-button import-start">Import sessions <span>↗</span></button></footer>',document.body.append(n);const s=document.createElement("input");s.type="search",s.className="source-search",s.placeholder="Find a source…",s.setAttribute("aria-label","Find a session source"),n.querySelector(".import-sources").before(s),s.addEventListener("input",()=>n.querySelectorAll(".import-source").forEach($=>{$.hidden=!$.textContent.toLowerCase().includes(s.value.trim().toLowerCase())}));const r=$=>n.querySelector($);let o=!1,i=0,a=!1,d=null,l=!1,f=!1,u=!1;const h=new AbortController;let p=!1,m=0,c;async function g($,v){const S=await fetch(`/api/sessiongraph/${$}`,{...v,signal:AbortSignal.any([h.signal,AbortSignal.timeout(3e4)])}),T=await S.json();if(S.status===409&&$==="import"&&v?.method==="POST")return g("import");if(!S.ok)throw new Error(T.error||"Import unavailable.");return T}function b($){o=$.running,r(".import-start").disabled=o,n.querySelectorAll("input").forEach(S=>{S.disabled=o}),r(".imports-progress").textContent=o?`${je($.source)} · ${$.imported.toLocaleString()} imported · ${$.unchanged.toLocaleString()} unchanged${$.discovered?` / ${$.discovered.toLocaleString()} found`:" · discovering…"}`:`${$.imported.toLocaleString()} imported · ${$.unchanged.toLocaleString()} already up to date${$.failed?` · ${$.failed} unavailable`:""}`,r(".import-start").textContent=o?"Importing…":"Import updates ↗",r(".imports-notes").hidden=!$.errors.length;const v=new Map;$.errors.forEach(S=>v.set(S,(v.get(S)||0)+1)),r(".imports-notes div").innerHTML=[...v].map(([S,T])=>`<p>${On(S)}${T>1?` (${T} occurrences)`:""}</p>`).join(""),document.dispatchEvent(new CustomEvent("sessiongraph-import-status",{detail:$}))}async function w(){if(!(a||f)){i=0,f=!0;try{const $=await g("import");if(a)return;if(b($),$.running)i=window.setTimeout(w,1e3);else{const v=c;c=void 0,await e(u),!a&&v===m&&n.open&&!$.failed&&!$.errors.length&&n.close()}}catch($){A($)}finally{f=!1}}}function A($){if(a)return;c=void 0;const v=$ instanceof Error?$.message:"Import unavailable.";b({running:!1,discovered:0,imported:0,unchanged:0,failed:1,errors:[v]}),r(".imports-progress").textContent=v}async function D($,v=!1){if(!(a||v&&n.open)){if(o||l||f||i){!v&&!n.open&&M();return}l=!0,u=v,o=!0,r(".import-start").disabled=!0,c=p&&n.open&&$!==void 0?m:void 0;try{const S=await g("import",{method:"POST",headers:{"Content-Type":"application/json","X-SessionGraph-Action":"import"},body:JSON.stringify(v?{automatic:!0}:{sources:$})});if(a)return;b(S),window.clearTimeout(i),i=window.setTimeout(w,100)}catch(S){A(S)}finally{l=!1}}}async function M($=!1){p=$,m++,d=document.activeElement,r("#imports-heading").textContent=$?"Explore & visualize all your LLM sessions":"Your session sources.",n.open||n.showModal(),t(),r(".import-sources").textContent="Finding local session sources…",s.value="";try{const v=await g("sources");r(".import-sources").innerHTML=Na(v.sources).map(T=>`<label class="import-source" data-source="${On(T.id)}"><input type="checkbox" value="${On(T.id)}" ${T.selected||$&&T.available?"checked":""} ${o?"disabled":""}/><span class="source-symbol">${Ue(T.id)}</span><span><strong>${On(T.name)}</strong><small>${On(T.description)}</small><small class="source-imported">${T.sessions?`${T.sessions.toLocaleString()} saved · `:""}${T.lastImport?`Last import ${new Date(T.lastImport).toLocaleString()}`:"Not imported yet"}</small></span><span class="source-detected ${T.available?"detected":""}">${T.available?"Detected":"Not found"}</span></label>`).join("");const S=await g("import");S.running?(b(S),window.clearTimeout(i),i=window.setTimeout(w,1e3)):$||b(S)}catch(v){r(".import-sources").textContent=v instanceof Error?v.message:"Could not detect sources."}}return r(".import-start").addEventListener("click",()=>{D([...n.querySelectorAll("input:checked")].map($=>$.value))}),r(".dialog-close").addEventListener("click",()=>n.close()),n.addEventListener("close",()=>{m++,c=void 0,t(),d?.focus()}),n.addEventListener("keydown",$=>$.stopPropagation()),{open:M,sources:async()=>(await g("sources")).sources,select:$=>D($),get busy(){return o||l||f||!!i},refresh:($=!1)=>D(void 0,$),resume:()=>{u=!0,o=!0,window.clearTimeout(i),w()},dispose:()=>{a=!0,h.abort(),window.clearTimeout(i),n.remove()}}}const ag=6e4,lg=3e4;class cg{constructor(t,n=Date.now){this.options=t,this.now=n}options;now;lastActivity=-1/0;checking=!1;disposed=!1;activity(){this.lastActivity=this.now()}async check(){if(!(this.disposed||this.checking||!this.options.eligible()||this.options.busy()||this.now()-this.lastActivity<lg)){this.checking=!0,this.activity();try{await this.options.refresh()}finally{this.checking=!1}}}dispose(){this.disposed=!0}}class dg{constructor(t,n){this.write=t,this.changed=n}write;changed;revision=0;state="saved";queued;task;disposed=!1;get pending(){return!!(this.queued||this.task)}set(t){this.state=t,this.disposed||this.changed(t)}save(t){this.disposed||(this.revision++,this.queued={...this.queued,...t},this.set("saving"),this.flush())}flush(){if(this.task)return this.task;if(this.disposed||!this.queued)return Promise.resolve();const t=this.queued;return this.queued=void 0,this.set("saving"),this.task=Promise.resolve().then(()=>this.write(t)).then(()=>{if(this.task=void 0,this.queued)return this.flush();this.set("saved")},()=>{this.queued={...t,...this.queued},this.task=void 0,this.set("error")}),this.task}dispose(){this.disposed=!0}}const ug=Object.freeze({sourceID:"",projectID:"",directory:"",days:90,fromDate:"",toDate:"",includeChildren:!0,includeArchived:!0}),fg=e=>typeof e=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(e)&&Number.isFinite(Date.parse(e))&&new Date(e).toISOString().slice(0,10)===e;function hg(e){const t={...ug};if(!e||typeof e!="object"||Array.isArray(e))return t;const n=e;for(const s of["sourceID","projectID","directory"])typeof n[s]=="string"&&n[s].length<=4096&&(t[s]=n[s]);[0,7,30,90].includes(n.days)&&(t.days=n.days);for(const s of["includeChildren","includeArchived"])typeof n[s]=="boolean"&&(t[s]=n[s]);for(const s of["fromDate","toDate"])fg(n[s])&&(t[s]=n[s]);return t.fromDate&&t.toDate&&t.fromDate>t.toDate&&(t.fromDate="",t.toDate=""),t}const dr=Object.freeze({autoImport:!0,muted:!1,clickSounds:!0,clickVolume:35,motion:"system",view:"3d",density:"comfortable",panelOpacity:90,quality:"balanced",bloom:32,stars:!0,labels:!0,nodeScale:100,focusDimming:!0,trails:"all",trailOpacity:34,trailFlow:!1,trailSpeed:25,relationships:!0,messageDots:!0,playbackSpeed:1}),jo="sessiongraph.preferences",la={motion:["system","on","off"],view:["3d","2d"],density:["comfortable","compact"],quality:["performance","balanced","high"],trails:["all","selected","off"]},ca={clickVolume:[0,100],panelOpacity:[55,100],bloom:[0,75],nodeScale:[60,180],trailOpacity:[0,100],trailSpeed:[10,100],playbackSpeed:[.25,3]};function ur(e){const t={...dr};if(!e||typeof e!="object"||Array.isArray(e))return t;const n=e;for(const s of Object.keys(t)){const r=n[s];if(s in la)la[s].includes(r)&&Object.assign(t,{[s]:r});else if(s in ca){const[o,i]=ca[s];typeof r=="number"&&Number.isFinite(r)&&Object.assign(t,{[s]:Math.max(o,Math.min(i,r))})}else typeof r=="boolean"&&Object.assign(t,{[s]:r})}return t}function Rl(e){try{const t=JSON.parse(e.getItem(jo)||e.getItem("session-atlas.preferences")||"null");return ur(t?.version===1?t.values:void 0)}catch{return{...dr}}}function Pl(e,t){try{return e.setItem(jo,JSON.stringify({version:1,values:ur(t)})),!0}catch{return!1}}const mo=(e,t)=>e.motion==="on"||e.motion==="system"&&!t,ze=[["interface","Interface",id],["sources","Sources",zc],["audio","Sound",Pa],["graphics","Graphics",Ra],["trails","Trails & playback",rd],["privacy","Privacy",nd]],gs=e=>e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]),Ze=(e,t,n)=>`<label class="setting-row"><span><strong>${t}</strong><small>${n}</small></span><input type="checkbox" role="switch" data-pref="${e}" aria-label="${t}"/></label>`,Mt=(e,t,n,s,r,o="%",i=1)=>`<label class="setting-row setting-range"><span><strong>${t}</strong><small>${n}</small></span><span class="setting-slider"><input type="range" data-pref="${e}" aria-label="${t}" min="${s}" max="${r}" step="${i}"/><output data-output="${e}" data-unit="${o}"></output></span></label>`,Mn=(e,t,n,s)=>`<label class="setting-row"><span><strong>${t}</strong><small>${n}</small></span><select data-pref="${e}" aria-label="${t}">${s.map(([r,o])=>`<option value="${r}">${o}</option>`).join("")}</select></label>`;function pg(e){const t=document.createElement("dialog");t.className="settings-dialog",t.setAttribute("aria-labelledby","settings-title"),t.innerHTML=`<header class="settings-heading"><div><h2 id="settings-title">Settings</h2><p>Import, appearance, and playback preferences.</p></div><button class="icon-button settings-close" aria-label="Close settings">×</button></header>
|
|
30
|
+
<div class="settings-layout"><nav class="settings-tabs" role="tablist" aria-label="Settings categories">${ze.map(([c,g,b],w)=>`<button role="tab" id="settings-tab-${c}" aria-controls="settings-${c}" aria-selected="${!w}" tabindex="${w?-1:0}" data-tab="${c}">${Da([b[0],{...b[1],"aria-hidden":"true","stroke-width":1.5},b[2]]).outerHTML}${g}</button>`).join("")}</nav>
|
|
31
|
+
<div class="settings-content">
|
|
32
|
+
<section id="settings-interface" role="tabpanel" aria-labelledby="settings-tab-interface"><h3>Interface</h3><p class="settings-description">View preferences and filters are saved with your library.</p>
|
|
33
|
+
${Mn("view","Default view","Switch between depth and a flat timeline.",[["3d","3D galaxy"],["2d","2D timeline"]])}
|
|
34
|
+
${Mn("motion","Motion","Camera transitions, reveals, and ambient movement.",[["system","Follow system"],["on","On"],["off","Off"]])}
|
|
35
|
+
${Mn("density","Session list","Adjust spacing between sessions.",[["comfortable","Comfortable"],["compact","Compact"]])}
|
|
36
|
+
${Mt("panelOpacity","Panel opacity","Adjust panel background transparency.",55,100)}
|
|
37
|
+
<div class="settings-note"><span>Restore the default panel layout.</span><button class="secondary-button settings-reset-panels">Reset panel positions</button></div>
|
|
38
|
+
</section>
|
|
39
|
+
<section id="settings-sources" role="tabpanel" aria-labelledby="settings-tab-sources" hidden><h3>Sources</h3><p class="settings-description">Choose the local apps to import. Importing is read-only.</p>
|
|
40
|
+
${Ze("autoImport","Auto-import sessions","Check selected sources on startup, on return, and every minute while visible.")}
|
|
41
|
+
<input type="search" class="source-search" placeholder="Find a source…" aria-label="Find a session source"/>
|
|
42
|
+
<div class="settings-sources-list import-sources"></div>
|
|
43
|
+
<div class="settings-import-progress" role="status"></div>
|
|
44
|
+
<div class="settings-note"><span>Source changes apply when you import. Previously saved history is kept.</span><button class="secondary-button settings-import" disabled>Import selected sources</button></div>
|
|
45
|
+
</section>
|
|
46
|
+
<section id="settings-audio" role="tabpanel" aria-labelledby="settings-tab-audio" hidden><h3>Sound</h3><p class="settings-description">Interaction sounds are synthesized locally.</p>
|
|
47
|
+
${Ze("muted","Mute all sound","Silence everything. Your volume levels are kept.")}
|
|
48
|
+
${Ze("clickSounds","Interaction sounds","A soft tick for controls; a chime for sessions.")}
|
|
49
|
+
${Mt("clickVolume","Interaction volume","Adjust interaction sound volume.",0,100)}
|
|
50
|
+
<div class="settings-note"><span class="settings-audio-status" role="status">Sound starts after your first interaction.</span><button class="secondary-button settings-preview" data-sound="none">Preview chime</button></div>
|
|
51
|
+
<p class="settings-footnote">Audio pauses while this tab is hidden. The speaker button on the map is a quick mute.</p>
|
|
52
|
+
</section>
|
|
53
|
+
<section id="settings-graphics" role="tabpanel" aria-labelledby="settings-tab-graphics" hidden><h3>Graphics</h3><p class="settings-description">Adjust rendering quality and map appearance.</p>
|
|
54
|
+
${Mn("quality","Render quality","Performance uses 1× resolution and skips post-process effects.",[["performance","Performance"],["balanced","Balanced"],["high","High fidelity"]])}
|
|
55
|
+
${Mt("bloom","Glow strength","Soft light around bright nodes; disabled in Performance.",0,75)}
|
|
56
|
+
${Mt("nodeScale","Node size","Scale the lights without changing their positions.",60,180)}
|
|
57
|
+
${Ze("stars","Starfield","A faint field of stars behind the timeline.")}
|
|
58
|
+
${Ze("labels","Map labels","Directory names and the selected session title.")}
|
|
59
|
+
${Ze("focusDimming","Focus dimming","Dim surrounding nodes when a session is selected.")}
|
|
60
|
+
</section>
|
|
61
|
+
<section id="settings-trails" role="tabpanel" aria-labelledby="settings-tab-trails" hidden><h3>Trails & playback</h3><p class="settings-description">Trails start at creation and end at the latest recorded message.</p>
|
|
62
|
+
${Mn("trails","Session trails","Choose how much history to draw on the map.",[["all","All sessions"],["selected","Selected session"],["off","Hidden"]])}
|
|
63
|
+
${Mt("trailOpacity","Trail brightness","Fade lifetime trails into the background.",0,100)}
|
|
64
|
+
${Ze("trailFlow","Flowing trails","A decorative pulse along each lifetime; respects Motion.")}
|
|
65
|
+
${Mt("trailSpeed","Flow speed","How quickly the light travels along the trails.",10,100)}
|
|
66
|
+
${Ze("relationships","Relationship links","Show recorded fork and child connections.")}
|
|
67
|
+
${Ze("messageDots","Message & event dots","Clickable user, assistant, tool, and event markers on the selected trail.")}
|
|
68
|
+
${Mt("playbackSpeed","Playback speed","1× plays the full timeline in 30 seconds.",.25,3,"×",.25)}
|
|
69
|
+
<p class="settings-footnote">Flow is decorative. Message dots reflect saved timestamps; visual settings never alter your history.</p>
|
|
70
|
+
</section>
|
|
71
|
+
<section id="settings-privacy" role="tabpanel" aria-labelledby="settings-tab-privacy" hidden><h3>Privacy</h3><p class="settings-description">Local storage and network access.</p>
|
|
72
|
+
<div class="setting-row"><span><strong>Processed on this computer</strong><small>Importing, indexing, search, and visualization run locally. Imports read your selected sources without changing them or starting an AI agent.</small></span></div>
|
|
73
|
+
<div class="setting-row"><span><strong>Update checks use the internet</strong><small>Desktop update checks and downloads contact GitHub without session content. npm installation contacts its registry. These services receive ordinary connection metadata, including your public IP address.</small></span></div>
|
|
74
|
+
<div class="setting-row"><span><strong>Continuing a session is your choice</strong><small>Explicitly launching another harness lets it read the selected context. It may contact its model provider under its own privacy settings.</small></span></div>
|
|
75
|
+
<div class="setting-row"><span><strong>Local storage is not encrypted by SessionGraph</strong><small>Saved conversations, search text, and handoff files rely on your device's access controls. Disk encryption and backup or sync settings affect confidentiality. Deselecting a source keeps previously imported history.</small></span></div>
|
|
76
|
+
</section>
|
|
77
|
+
</div></div><footer class="settings-footer"><span class="settings-save-status" role="status">Changes save automatically on this device.</span><button class="text-button settings-reset">Restore defaults</button><button class="primary-button settings-done">Done</button></footer>`,document.body.append(t);const n=new AbortController,s={signal:n.signal},r=t.querySelector(".source-search"),o=()=>t.querySelectorAll(".import-source").forEach(c=>{c.hidden=!c.textContent.toLowerCase().includes(r.value.trim().toLowerCase())});r.addEventListener("input",o,s);let i=null,a=0,d=!1,l=!1,f="interface";const u=()=>{t.querySelectorAll(".settings-source, .settings-import").forEach(c=>{c.disabled=d||l}),t.querySelector(".settings-source")||(t.querySelector(".settings-import").disabled=!0)};async function h(){const c=++a;d=!0,u();const g=t.querySelector(".settings-sources-list");g.textContent="Finding local session sources…";try{const b=await e.getSources();if(n.signal.aborted||c!==a)return;g.innerHTML=Na(b).map(w=>`<label class="import-source"><input class="settings-source" type="checkbox" value="${gs(w.id)}" ${w.selected?"checked":""}/><span class="source-symbol">${Ue(w.id)}</span><span><strong>${gs(w.name)}</strong><small>${gs(w.description)}</small><small class="source-imported">${w.sessions.toLocaleString()} saved${w.error?` · ${gs(w.error)}`:""}</small></span><span class="source-detected ${w.available?"detected":""}">${w.available?"Detected":"Not found"}</span></label>`).join(""),o()}catch(b){if(n.signal.aborted||c!==a)return;g.textContent=b instanceof Error?b.message:"Could not detect sources.";const w=document.createElement("button");w.className="secondary-button",w.textContent="Retry",w.addEventListener("click",()=>{h()},s),g.append(w)}finally{c===a&&!n.signal.aborted&&(d=!1,u(),t.querySelector(".settings-import").disabled||=!g.querySelector("input"))}}t.querySelector(".settings-import").addEventListener("click",async()=>{const c=[...t.querySelectorAll(".settings-source:checked")].map(g=>g.value);l=!0,u(),t.querySelector(".settings-import-progress").textContent="Starting import…";try{await e.importSources(c)}catch(g){l=!1,u(),t.querySelector(".settings-import-progress").textContent=g instanceof Error?g.message:"Import unavailable."}},s);const p=()=>t.close();for(const c of[".settings-close",".settings-done"])t.querySelector(c).addEventListener("click",p,s);t.addEventListener("close",()=>{e.visibility(),i?.focus({preventScroll:!0})},s),t.addEventListener("keydown",c=>{c.stopPropagation()},s);function m(c){f=c;for(const[g]of ze){const b=t.querySelector(`[data-tab="${g}"]`);b.setAttribute("aria-selected",String(g===c)),b.tabIndex=g===c?0:-1,t.querySelector(`#settings-${g}`).hidden=g!==c}t.querySelector(".settings-content").scrollTop=0,f==="sources"&&h()}for(const c of t.querySelectorAll("[data-tab]"))c.addEventListener("click",()=>m(c.dataset.tab),s),c.addEventListener("keydown",g=>{const b=ze.findIndex(([A])=>A===c.dataset.tab),w=g.key==="Home"?0:g.key==="End"?ze.length-1:["ArrowRight","ArrowDown"].includes(g.key)?(b+1)%ze.length:["ArrowLeft","ArrowUp"].includes(g.key)?(b+ze.length-1)%ze.length:-1;w<0||(g.preventDefault(),m(ze[w][0]),t.querySelector(`[data-tab="${ze[w][0]}"]`).focus())},s);return t.addEventListener("input",c=>{const g=c.target,b=g.dataset.pref;if(!b)return;const w=g.type==="checkbox"?g.checked:g.type==="range"?Number(g.value):g.value;e.change({[b]:w})},s),t.querySelector(".settings-preview").addEventListener("click",e.previewSound,s),t.querySelector(".settings-reset").addEventListener("click",()=>e.change({...dr}),s),t.querySelector(".settings-reset-panels").addEventListener("click",e.resetPanels,s),{open(){t.open||(i=document.activeElement,t.showModal(),e.visibility(),t.querySelector('[aria-selected="true"]').focus(),f==="sources"&&h())},importStatus(c){const g=l;l=c.running,u(),t.querySelector(".settings-import-progress").textContent=c.running?`Importing · ${c.imported.toLocaleString()} saved`:`${c.imported.toLocaleString()} imported · ${c.unchanged.toLocaleString()} unchanged${c.failed?` · ${c.failed} unavailable`:""}${c.errors.length?` · ${c.errors[0]}`:""}`,g&&!c.running&&t.open&&f==="sources"&&h()},render(c,g,b="saved"){for(const w of t.querySelectorAll("[data-pref]")){const A=w.dataset.pref;w.type==="checkbox"?w.checked=!!c[A]:w.value=String(c[A]);const D=t.querySelector(`[data-output="${A}"]`);D&&(D.value=`${c[A]}${D.dataset.unit}`),w.disabled=A==="bloom"&&c.quality==="performance"||A==="trailSpeed"&&(!c.trailFlow||c.trails==="off"||c.motion==="off")}t.querySelector(".settings-save-status").textContent=b==="saving"?"Saving preferences…":b==="error"?"Changes applied; could not save to the local library.":g?"Saved on this device · changes apply live.":"Applied for this visit; storage is unavailable.",t.querySelector(".settings-preview").disabled=c.muted||!c.clickSounds||!c.clickVolume,ln(t)},audioStatus(c){t.querySelector(".settings-audio-status").textContent=c},dispose(){n.abort(),t.remove()}}}class gg{constructor(t,n){this.preferences=t,this.status=n;const s={signal:this.events.signal};document.addEventListener("click",r=>{if(!r.isTrusted)return;const o=r.target?.closest('button, a[href], summary, input[type="checkbox"], [role="option"]');!o||o.matches(":disabled")||o.closest('[data-sound="none"], [data-drag-panel]')||this.play(o.matches('[data-session], [data-related], [role="option"]')?"select":"click")},s),document.addEventListener("change",r=>{r.isTrusted&&r.target?.matches('select, input[type="range"]')&&this.play("click")},s),document.addEventListener("pointerdown",r=>{r.isTrusted&&(this.interacted=!0,this.unlock())},{...s,passive:!0}),document.addEventListener("keydown",r=>{r.isTrusted&&!r.repeat&&["Enter"," ","ArrowUp","ArrowDown"].includes(r.key)&&(this.interacted=!0,this.unlock())},s),document.addEventListener("visibilitychange",()=>this.sync(),s),window.addEventListener("pagehide",()=>{this.active=!1,this.sync()},s),window.addEventListener("pageshow",()=>{this.active=!0,this.sync()},s)}preferences;status;context;master;analyser;voices=new Set;events=new AbortController;disposed=!1;unavailable=!1;clicks=0;lastClick=0;suspendTimer;active=!0;interacted=!1;enabled(){return!this.preferences.muted&&this.preferences.clickSounds&&this.preferences.clickVolume>0}async unlock(){if(!(this.disposed||document.hidden||!this.active||!this.enabled()))try{if(!this.context){this.context=new AudioContext,this.master=this.context.createGain(),this.master.gain.value=0;const t=this.context.createDynamicsCompressor();t.threshold.value=-12,t.ratio.value=6,this.analyser=this.context.createAnalyser(),this.analyser.fftSize=256,this.master.connect(t).connect(this.analyser).connect(this.context.destination),this.context.addEventListener("statechange",()=>this.report(),{signal:this.events.signal})}this.context.state==="suspended"&&await this.context.resume(),this.disposed||this.sync()}catch{this.unavailable=!0,this.report()}}ramp(t,n,s=.15){const r=this.context.currentTime;t.cancelScheduledValues(r),t.setTargetAtTime(n,r,s)}cleanup(t){t.nodes.forEach(n=>n.disconnect()),this.voices.delete(t)}sync(){clearTimeout(this.suspendTimer);const t=this.context;if(!t||this.disposed){this.report();return}const n=this.enabled()&&!document.hidden&&this.active;if(n&&t.state==="suspended"&&t.resume().catch(()=>{this.unavailable=!0,this.report()}),this.ramp(this.master.gain,n?.7:0,.035),!n){const s=()=>{for(const r of this.voices)r.sources.forEach(o=>{try{o.stop()}catch{}}),this.cleanup(r);t.suspend().catch(()=>{})};document.hidden||!this.active?s():this.suspendTimer=setTimeout(s,180)}this.report()}report(){this.status(this.unavailable?"Audio is unavailable in this browser.":this.preferences.muted?"All sound is muted.":document.hidden||!this.active?"Audio paused while the app is hidden.":this.context?.state==="running"?"Audio is ready · pauses automatically in the background.":"Click a control or preview to start audio.")}configure(t){this.preferences=t,this.sync(),!this.context&&this.interacted&&this.unlock()}async play(t="click"){await this.unlock();const n=this.context;if(this.disposed||!n||n.state!=="running"||document.hidden||!this.active||this.preferences.muted||!this.preferences.clickSounds||!this.preferences.clickVolume||performance.now()-this.lastClick<45)return;this.lastClick=performance.now(),this.clicks++;const s=n.createGain(),r=n.createOscillator(),o=n.currentTime;r.type="sine",r.frequency.setValueAtTime(t==="select"?660:900,o),r.frequency.exponentialRampToValueAtTime(t==="select"?990:420,o+.065),s.gain.setValueAtTime(0,o),s.gain.linearRampToValueAtTime(this.preferences.clickVolume/100*.12,o+.004),s.gain.exponentialRampToValueAtTime(1e-4,o+(t==="select"?.19:.065)),r.connect(s).connect(this.master);const i={gain:s,sources:[r],nodes:[r,s]};this.voices.add(i),r.onended=()=>this.cleanup(i),r.start(),r.stop(o+.22)}diagnostics(){const t=new Float32Array(256);return this.analyser?.getFloatTimeDomainData(t),{state:this.context?.state||"unstarted",muted:this.preferences.muted,voices:this.voices.size,clicks:this.clicks,rms:Math.sqrt(t.reduce((n,s)=>n+s*s,0)/t.length)}}dispose(){this.disposed=!0,this.events.abort(),clearTimeout(this.suspendTimer);for(const t of this.voices)t.sources.forEach(n=>{try{n.stop()}catch{}}),this.cleanup(t);this.context?.close().catch(()=>{})}}const Vl=e=>e.kind==="message"?e.role==="user"?"#b0e9d6":"#9bbcff":e.kind.startsWith("tool_")?"#eac594":"#d7a1f1",Nl=e=>e.kind==="message"?e.role==="user"?"You":e.role==="assistant"?"Assistant":"Message":{tool_call:"Tool call",tool_result:"Tool result",reasoning:"Reasoning",compaction:"Compaction",file_change:"File change",error:"Error",event:"Event"}[e.kind],de=e=>e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]),mg=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"medium"}),Rr=e=>e===null?"Time not recorded":mg.format(e),Pr=e=>`<span class="event-badge" style="--event-color:${Vl(e)}">${Nl(e)}</span>`;function vg(e,t,n){const s=document.createElement("aside");s.className="event-panel glass",s.id="message-panel",s.hidden=!0,s.setAttribute("aria-labelledby","event-title"),s.innerHTML=`<header class="event-heading"><h2 id="event-title">Messages & events</h2><button class="icon-button event-close" aria-label="Close message details">×</button></header>
|
|
78
|
+
<div class="event-detail-nav"><button class="secondary-button" data-step="previous" aria-label="Previous event" title="Previous event (← / ↑)">← Previous</button><span class="event-position" role="status"></span><button class="secondary-button" data-step="next" aria-label="Next event" title="Next event (→ / ↓)">Next →</button></div>
|
|
79
|
+
<div class="event-scroll"><article class="event-content" aria-label="Event details" tabindex="0"></article>
|
|
80
|
+
<details class="event-browser"><summary>Browse saved events <span class="event-count"></span></summary>
|
|
81
|
+
<div class="event-toolbar"><label>Show <select aria-label="Event filter"><option value="all">All activity</option><option value="messages">Messages</option><option value="tools">Tool calls & results</option><option value="events">Other events</option><option value="untimed">Without timestamps</option></select></label></div>
|
|
82
|
+
<nav class="event-list" aria-label="Session events"></nav><div class="event-pagination"><button class="secondary-button" data-page="previous">← Earlier page</button><button class="secondary-button" data-page="next">Later page →</button></div>
|
|
83
|
+
</details>
|
|
84
|
+
</div><footer class="event-footer"><details><summary>History coverage</summary><p class="event-coverage"></p></details><button class="text-button event-reload">Reload</button></footer>`,e.append(s);const r=v=>s.querySelector(v),o=new AbortController;let i,a,d,l="all",f,u=!1,h,p,m={};const c=v=>`<button class="event-row" data-event="${de(v.id)}" aria-current="${d?.selected?.id===v.id?"true":"false"}"><span class="event-row-top">${Pr(v)}<small>#${v.ordinal+1}${v.status==="failed"?" · failed":""}</small></span><strong>${de(v.name)}</strong><span class="event-preview">${de(v.preview||"No text recorded")}</span><time>${Rr(v.time)}</time></button>`;function g(){!d||!r(".event-browser").open||(r(".event-list").innerHTML=d.items.map(c).join("")||'<p class="event-empty">No saved items in this view.</p>')}function b(){if(!d)return;ln(s),r(".event-count").textContent=`${d.total.toLocaleString()} items${d.partial?" · partial coverage":""}`,g();for(const T of["previous","next"])r(`[data-page="${T}"]`).disabled=!d[`${T}Cursor`];r(".event-coverage").textContent=d.note||(d.partial?"Saved history is incomplete or still awaiting import.":"Saved local history. Missing timestamps are never inferred.");const v=d.selected;r(".event-position").textContent=v?`#${v.ordinal+1}`:"No items";for(const T of["previous","next"])r(`[data-step="${T}"]`).disabled=!d[`${T}Item`];if(!v){r(".event-content").innerHTML='<div class="event-empty"><h3>Nothing here yet.</h3><p>Choose another filter or refresh the source import.</p></div>',n.select(null);return}n.select(v);const S=(T,L)=>L?`<section class="event-payload"><h4>${T}</h4><pre>${de(L)}</pre></section>`:"";r(".event-content").innerHTML=`<div class="event-detail-heading">${Pr(v)}${v.status?`<span class="event-status ${v.status==="failed"?"failed":""}">${de(v.status)}</span>`:""}<h3>${de(v.name)}</h3><p>${Rr(v.time)}${v.timeSource==="message"?" · parent message timestamp":""}</p>${v.endTime?`<p>Completed ${Rr(v.endTime)}</p>`:""}${v.time===null?"<p>No timestamp · this item has no map position.</p>":v.time<a.created||v.time>Math.max(a.created,a.activity?.lastMessageAt||a.created)?"<p>Outside this session’s plotted lifetime.</p>":""}</div>
|
|
85
|
+
${v.partial?'<p class="event-warning">Some content is shortened, missing, or unsupported in this import.</p>':""}
|
|
86
|
+
${S("Message / event",v.text)}${S("Input",v.input)}${S("Output",v.output)}
|
|
87
|
+
${!v.text&&!v.input&&!v.output?'<p class="event-empty">No text payload was recorded.</p>':""}
|
|
88
|
+
${v.kind==="tool_call"||v.kind==="tool_result"?`<section class="event-correlations"><h4>Linked tool activity</h4>${d.related.length?d.related.map(T=>`<button class="event-link" data-linked="${de(T.id)}">${Pr(T)}<span>${de(T.name)}</span><small>#${T.ordinal+1} →</small></button>`).join(""):"<p>No matching call or result was saved. A call alone does not confirm execution.</p>"}${d.relatedPartial?"<p>Showing the first 20 linked items.</p>":""}</section>`:""}
|
|
89
|
+
<details class="event-provenance"><summary>Source details</summary><dl><dt>Source</dt><dd>${de(je(a?.source))}</dd><dt>Message ID</dt><dd>${de(v.messageID)}</dd>${v.nativeID?`<dt>Native event ID</dt><dd>${de(v.nativeID)}</dd>`:""}${v.nativeType?`<dt>Native type</dt><dd>${de(v.nativeType)}</dd>`:""}${v.callID?`<dt>Tool correlation ID</dt><dd>${de(v.callID)}</dd>`:""}${v.parentID?`<dt>Native parent reference</dt><dd>${de(v.parentID)}</dd>`:""}<dt>Timestamp source</dt><dd>${de(v.timeSource)}</dd></dl></details>`}async function w(v={}){if(!a)return;clearTimeout(p),i?.abort();const S=new AbortController;i=S,m=v,u=!0,s.setAttribute("aria-busy","true"),r(".event-position").textContent="Loading…";for(const R of s.querySelectorAll("[data-step], [data-page]"))R.disabled=!0;const T=r(".event-list").scrollTop,L=d?.offset,E=document.activeElement,O=E instanceof HTMLElement?E.dataset:void 0;try{const R=await t.read(a.id,{filter:l,...v,...f?{revision:f}:{}},S.signal);if(S.signal.aborted)return;d=R,f=d.revision,b(),r(".event-list").scrollTop=d.offset===L?T:0,r(".event-scroll").scrollTop=0;const V=O?.event?`[data-event="${O.event}"]`:"";V&&(document.activeElement===E||!E?.isConnected&&document.activeElement===document.body)&&s.querySelector(V)?.focus({preventScroll:!0}),clearTimeout(p),p=setTimeout(()=>{h?.abort(),h=new AbortController;for(const H of[d?.previousItem,d?.nextItem])H&&t.read(a.id,{item:H,filter:l,revision:f},h.signal).catch(()=>{})},60)}catch(R){if(S.signal.aborted)return;d=void 0,r(".event-position").textContent="Unavailable",r(".event-content").innerHTML=`<div class="event-empty"><h3>Could not load this history.</h3><p>${de(R instanceof Error?R.message:"Please retry.")}</p><button class="secondary-button" data-retry>Retry</button> <button class="secondary-button" data-reload>Reload current history</button></div>`}finally{i===S&&(u=!1,s.removeAttribute("aria-busy"))}}const A=()=>{t.clear(),f=void 0,d=void 0,w()},D=()=>!s.hidden&&!e.hidden,M=()=>{clearTimeout(p),h?.abort(),i?.abort(),i=void 0,u=!1,d=void 0,s.hidden=!0,s.removeAttribute("aria-busy"),e.classList.remove("has-events"),n.select(null)},$=v=>{if(u)return;const S=v==="next"?d?.nextItem:d?.previousItem;S&&w({item:S})};return s.addEventListener("click",v=>{const S=v.target.closest("button");if(S){if(S.dataset.event&&w({item:S.dataset.event}),S.dataset.linked&&(l="all",r("select").value=l,w({item:S.dataset.linked})),S.dataset.step&&$(S.dataset.step==="next"?"next":"previous"),S.dataset.page){const T=S.dataset.page==="next"?d?.nextCursor:d?.previousCursor;T&&w({cursor:T})}S.hasAttribute("data-retry")&&w(m),(S.hasAttribute("data-reload")||S.classList.contains("event-reload"))&&A(),S.classList.contains("event-close")&&(M(),document.querySelector("#scene canvas")?.focus({preventScroll:!0}))}},{signal:o.signal}),r("select").addEventListener("change",()=>{l=r("select").value,w()},{signal:o.signal}),r(".event-browser").addEventListener("toggle",g,{signal:o.signal}),{close:M,handleKey(v){return!D()||v.defaultPrevented||v.metaKey||v.ctrlKey||v.altKey||v.shiftKey||document.querySelector("dialog[open]")||v.target.closest('input, select, textarea, [contenteditable="true"], [data-drag-panel], #explorer')?!1:v.key==="Escape"?(v.preventDefault(),M(),document.querySelector("#scene canvas")?.focus({preventScroll:!0}),!0):["ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].includes(v.key)?(v.preventDefault(),$(v.key==="ArrowLeft"||v.key==="ArrowUp"?"previous":"next"),!0):!1},open(v,S,T){clearTimeout(p),h?.abort();const L=a?.id===v.id;a=v,f=T,d=void 0,l="all",r("select").value=l,r(".event-list").replaceChildren(),r(".event-content").innerHTML='<p class="event-empty">Loading saved history…</p>',r(".event-coverage").textContent="Loading coverage…",L||(r(".event-browser").open=!1),s.hidden=!1,e.classList.add("has-events"),w(S?{item:S}:{})},dispose(){clearTimeout(p),h?.abort(),i?.abort(),o.abort(),s.remove()}}}function yg(e,t,n){const s=new Map;let r,o,i,a,d=0,l=0,f=1;const u=document.createElement("strong"),h=document.createElement("pre"),p=document.createElement("span"),m=()=>{clearTimeout(i),o?.abort(),o=void 0,r=void 0,a=void 0,e.hidden=!0,e.classList.remove("message-tooltip")};function c(b,w){if(!a)return;const A=`${Nl(a)} · ${a.name}`,D=b||"No text recorded.",M=[w,f>1?`${f} nearby items`:"","Click to focus and read · ← / → to navigate"].filter(Boolean).join(" · ");u.textContent!==A&&(u.textContent=A),h.textContent!==D&&(h.textContent=D),p.textContent!==M&&(p.textContent=M),u.parentElement!==e&&e.replaceChildren(u,h,p),e.classList.add("message-tooltip"),e.hidden=!1,e.style.setProperty("--event-color",Vl(a));const $=e.offsetWidth,v=e.offsetHeight,S=t.getBoundingClientRect(),T=[...document.querySelectorAll(".floating-panel:not([hidden]), .app-header, .map-controls")].map(O=>O.getBoundingClientRect()),E=[l+18,l-v-18].flatMap(O=>[d+18,d-$-18].map(R=>{R=Math.max(8,Math.min(R,t.clientWidth-$-8)),O=Math.max(8,Math.min(O,t.clientHeight-v-8));const V=S.left+R,H=S.top+O,K=T.reduce((se,Z)=>se+Math.max(0,Math.min(V+$,Z.right+8)-Math.max(V,Z.left-8))*Math.max(0,Math.min(H+v,Z.bottom+8)-Math.max(H,Z.top-8)),0);return{left:R,top:O,overlap:K}})).reduce((O,R)=>R.overlap<O.overlap?R:O);e.style.left=`${E.left}px`,e.style.top=`${E.top}px`}function g(b){const w=[b.text,b.input?`Input
|
|
90
|
+
${b.input}`:"",b.output?`Output
|
|
91
|
+
${b.output}`:""].filter(Boolean).join(`
|
|
92
|
+
|
|
93
|
+
`);return{text:w.slice(0,1800),shortened:w.length>1800||!!b.partial}}return{clear:m,show(b,w,A,D,M,$){const v=`${w}:${A}:${b.id}`,S=r!==v;S&&m(),r=v,a=b,d=M,l=$,f=D;const T=s.get(v);c(T?.text||b.preview,T?T.shortened?"Content preview":"":"Loading message…"),!(!S||T)&&(i=setTimeout(async()=>{const L=new AbortController;o=L;try{const E=await n.read(w,{item:b.id,revision:A},L.signal);if(L.signal.aborted||r!==v||E.selected?.id!==b.id)return;const O=g(E.selected);s.set(v,O),s.size>20&&s.delete(s.keys().next().value),c(O.text,O.shortened?"Content preview":"")}catch{!L.signal.aborted&&r===v&&c(b.preview,"Saved excerpt · open for details")}},120))},dispose(){m(),s.clear()}}}class bg{constructor(t=(...n)=>fetch(...n)){this.request=t}request;pages=new Map;pending=new Map;characters=0;generation=0;clear(){this.generation++,this.pages.clear(),this.characters=0;for(const t of this.pending.values())t.controller.abort();this.pending.clear()}read(t,n={},s){if(s?.aborted)return Promise.reject(s.reason);const r=n.filter||"all",o=JSON.stringify([t,n.revision,r,n.item,n.cursor]),i=n.revision?this.pages.get(o):void 0;if(i)return this.pages.delete(o),this.pages.set(o,i),Promise.resolve(i.page);let a=this.pending.get(o);if(!a){const l=new AbortController,f=this.generation,u=new URLSearchParams({filter:r,...n}),h=this.request(`/api/sessiongraph/session/${encodeURIComponent(t)}/events?${u}`,{signal:AbortSignal.any([l.signal,AbortSignal.timeout(3e4)])}).then(async c=>{const g=await c.json();if(!c.ok)throw c.status===409&&this.clear(),new Error(g.error||"Could not load events.");if(l.signal.aborted||f!==this.generation)throw new DOMException("Request cancelled","AbortError");if(g.sessionID!==t||n.revision&&g.revision!==n.revision)throw new Error("Saved history changed. Reload the event explorer.");const b=JSON.stringify([t,g.revision,r,n.item,n.cursor]),w=JSON.stringify(g).length;for(this.characters-=this.pages.get(b)?.characters||0,this.pages.delete(b),this.pages.set(b,{page:g,characters:w}),this.characters+=w;this.pages.size>20||this.characters>2e6;){const A=this.pages.keys().next().value;this.characters-=this.pages.get(A).characters,this.pages.delete(A)}return g});a={controller:l,promise:h,readers:0},this.pending.set(o,a);const p=a,m=()=>{this.pending.get(o)===p&&this.pending.delete(o)};h.then(m,m)}const d=a;return d.readers++,new Promise((l,f)=>{const u=()=>{p(),f(s.reason)};let h=!1;const p=()=>{h||(h=!0,s?.removeEventListener("abort",u),--d.readers===0&&this.pending.get(o)===d&&(this.pending.delete(o),d.controller.abort()))};s?.addEventListener("abort",u,{once:!0}),d.promise.then(m=>{h||(p(),l(m))},m=>{h||(p(),f(m))})})}}function oe(e,t,n,s){if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?s:n==="a"?s.call(e):s?s.value:t.get(e)}function zt(e,t,n,s,r){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var ms,Gt,xe,Yt,vs,Vr,ys;const da="__TAURI_TO_IPC_KEY__";function wg(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}class $v{constructor(t){ms.add(this),Gt.set(this,void 0),xe.set(this,0),Yt.set(this,[]),vs.set(this,void 0),zt(this,Gt,t||(()=>{})),this.id=wg(n=>{const s=n.index;if("end"in n){s==oe(this,xe,"f")?this.cleanupCallback():zt(this,vs,s);return}const r=n.message;if(s==oe(this,xe,"f")){for(oe(this,ms,"m",Vr).call(this,r),zt(this,xe,oe(this,xe,"f")+1);oe(this,xe,"f")in oe(this,Yt,"f");){const o=oe(this,Yt,"f")[oe(this,xe,"f")];oe(this,ms,"m",Vr).call(this,o),delete oe(this,Yt,"f")[oe(this,xe,"f")],zt(this,xe,oe(this,xe,"f")+1)}oe(this,xe,"f")===oe(this,vs,"f")&&this.cleanupCallback()}else oe(this,Yt,"f")[s]=r})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(t){zt(this,Gt,t)}get onmessage(){return oe(this,Gt,"f")}[(Gt=new WeakMap,xe=new WeakMap,Yt=new WeakMap,vs=new WeakMap,ms=new WeakSet,Vr=function(n){try{oe(this,Gt,"f").call(this,n)}catch(s){queueMicrotask(()=>{throw s})}},da)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[da]()}}async function Fl(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}class Iv{get rid(){return oe(this,ys,"f")}constructor(t){ys.set(this,void 0),zt(this,ys,t)}async close(){return Fl("plugin:resources|close",{rid:this.rid})}async[(ys=new WeakMap,Symbol.asyncDispose)](){await this.close()}}function Eg(){return!!(globalThis||window).isTauri}async function Sg(){await Fl("plugin:process|restart")}class xg{constructor(t,n,s=Date.now){this.backend=t,this.changed=n,this.now=s}backend;changed;now;state={phase:"hidden"};release;busy=!1;disposed=!1;downloaded=!1;installed=!1;lastCheck=-1/0;set(t){this.disposed||(this.state=t,this.changed(t))}async close(){const t=this.release;this.release=void 0,await t?.close().catch(()=>{})}async check(){if(!(this.disposed||this.busy||this.release||this.now()-this.lastCheck<5*6e4)){this.busy=!0,this.lastCheck=this.now();try{this.release=await this.backend.check()||void 0,this.release&&this.set({phase:"available",version:this.release.version})}catch{}finally{this.busy=!1,this.disposed&&await this.close()}}}async activate(){if(this.disposed||this.busy||!this.release)return;this.busy=!0;const{version:t}=this.release;let n=this.installed?"restart":this.downloaded?"install":"download";try{if(!this.downloaded){let s,r=0;this.set({phase:"downloading",version:t}),await this.release.download(o=>{o.event==="Started"&&(s=o.data.contentLength,r=0),o.event==="Progress"&&(r+=o.data.chunkLength),this.set({phase:"downloading",version:t,progress:s&&s>0?Math.min(99,Math.floor(r/s*100)):void 0})}),this.downloaded=!0,this.set({phase:"ready",version:t});return}if(this.installed||(this.set({phase:"installing",version:t}),await this.release.install(),this.installed=!0),this.disposed)return;n="restart",this.set({phase:"restarting",version:t}),await this.backend.restart()}catch(s){this.set({phase:"error",version:t,retry:n,error:String(s instanceof Error?s.message:s).slice(0,300)})}finally{this.busy=!1,this.disposed&&await this.close()}}dispose(){this.disposed=!0,this.busy||this.close()}}const $g='<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" aria-hidden="true"><path d="M8 2v9m-3-3 3 3 3-3M3 13h10"/></svg>',Ig='<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" aria-hidden="true"><path d="M13 7a5 5 0 1 0-.8 4M13 2v5H8"/></svg>';function Tg(e){const t=document.createElement("button");t.className="desktop-update glass",t.hidden=!0,t.type="button";const n=document.createElement("span");n.className="sr-only",n.role="status",n.setAttribute("aria-live","polite"),document.querySelector("#app").append(t,n);let s="";const r=l=>{const f=["downloading","installing","restarting"].includes(l.phase),u=l.phase==="ready"||l.phase==="error"&&l.retry!=="download",h=l.phase==="downloading"?l.progress===void 0?"Downloading":`${l.progress}%`:l.phase==="installing"?"Installing":l.phase==="restarting"?"Restarting":u?"Restart":l.phase==="error"?"Retry update":"Update",p=l.phase==="error"?`${l.retry==="restart"?"Could not restart SessionGraph.":`Could not ${l.retry==="download"?"download or verify":"install"} the update.`} ${l.error||""} Click to try again.`:l.phase==="restarting"?`Restarting SessionGraph ${l.version}`:u?`Restart to install SessionGraph ${l.version}`:`Update to SessionGraph ${l.version}`;t.hidden=l.phase==="hidden",t.disabled=f,t.dataset.phase=l.phase,t.setAttribute("aria-busy",String(f)),t.setAttribute("aria-label",p),t.title=p;const m=`${u||l.phase==="restarting"?Ig:$g}<span>${h}</span>`;t.innerHTML!==m&&(t.innerHTML=m);const c=l.phase==="hidden"?"":l.phase==="downloading"?`Downloading SessionGraph ${l.version}`:p;c!==s&&(n.textContent=c,s=c)},o=new xg(e,r);t.addEventListener("click",()=>{o.activate()});const i=()=>{document.visibilityState==="visible"&&navigator.onLine&&o.check()},a=window.setTimeout(i,1e4),d=window.setInterval(i,240*6e4);return document.addEventListener("visibilitychange",i),window.addEventListener("online",i),{check:()=>o.check(),dispose(){clearTimeout(a),clearInterval(d),o.dispose(),t.remove(),n.remove(),document.removeEventListener("visibilitychange",i),window.removeEventListener("online",i)}}}function Cg(){return Eg()?Tg({async check(){const{check:e}=await Oa(async()=>{const{check:n}=await import("./index-8ZjQU4Q7.js");return{check:n}},[]),t=await e({timeout:15e3});return t&&{version:t.version,download:n=>t.download(n,{timeout:10*6e4}),install:()=>t.install({restartAfterInstall:!0}),close:()=>t.close()}},async restart(){await Sg()}}):{dispose(){}}}var kg=Jt("date-picker").parts("clearTrigger","content","control","input","label","monthSelect","nextTrigger","positioner","presetTrigger","prevTrigger","rangeText","root","table","tableBody","tableCell","tableCellTrigger","tableHead","tableHeader","tableRow","trigger","view","viewControl","viewTrigger","yearSelect"),J=kg.build();function Nr(e,t){return e-t*Math.floor(e/t)}const Hl=1721426;function bs(e,t,n,s){t=Uo(e,t);let r=t-1,o=-2;return n<=2?o=0:Ds(t)&&(o=-1),Hl-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*n-362)/12+o+s)}function Ds(e){return e%4===0&&(e%100!==0||e%400===0)}function Uo(e,t){return e==="BC"?1-t:t}function Ag(e){let t="AD";return e<=0&&(t="BC",e=1-e),[t,e]}const Lg={standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]};class cn{fromJulianDay(t){let n=t,s=n-Hl,r=Math.floor(s/146097),o=Nr(s,146097),i=Math.floor(o/36524),a=Nr(o,36524),d=Math.floor(a/1461),l=Nr(a,1461),f=Math.floor(l/365),u=r*400+i*100+d*4+f+(i!==4&&f!==4?1:0),[h,p]=Ag(u),m=n-bs(h,p,1,1),c=2;n<bs(h,p,3,1)?c=0:Ds(p)&&(c=1);let g=Math.floor(((m+c)*12+373)/367),b=n-bs(h,p,g,1)+1;return new Pe(h,p,g,b)}toJulianDay(t){return bs(t.era,t.year,t.month,t.day)}getDaysInMonth(t){return Lg[Ds(t.year)?"leapyear":"standard"][t.month-1]}getMonthsInYear(t){return 12}getDaysInYear(t){return Ds(t.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(t){return 9999}getEras(){return["BC","AD"]}isInverseEra(t){return t.era==="BC"}balanceDate(t){t.year<=0&&(t.era=t.era==="BC"?"AD":"BC",t.year=1-t.year)}constructor(){this.identifier="gregory"}}const Og={"001":1,AD:1,AE:6,AF:6,AI:1,AL:1,AM:1,AN:1,AR:1,AT:1,AU:1,AX:1,AZ:1,BA:1,BE:1,BG:1,BH:6,BM:1,BN:1,BY:1,CH:1,CL:1,CM:1,CN:1,CR:1,CY:1,CZ:1,DE:1,DJ:6,DK:1,DZ:6,EC:1,EE:1,EG:6,ES:1,FI:1,FJ:1,FO:1,FR:1,GB:1,GE:1,GF:1,GP:1,GR:1,HR:1,HU:1,IE:1,IQ:6,IR:6,IS:1,IT:1,JO:6,KG:1,KW:6,KZ:1,LB:1,LI:1,LK:1,LT:1,LU:1,LV:1,LY:6,MC:1,MD:1,ME:1,MK:1,MN:1,MQ:1,MV:5,MY:1,NL:1,NO:1,NZ:1,OM:6,PL:1,QA:6,RE:1,RO:1,RS:1,RU:1,SD:6,SE:1,SI:1,SK:1,SM:1,SY:6,TJ:1,TM:1,TR:1,UA:1,UY:1,UZ:1,VA:1,VN:1,XK:1};function we(e,t){return t=le(t,e.calendar),e.era===t.era&&e.year===t.year&&e.month===t.month&&e.day===t.day}function Mg(e,t){return t=le(t,e.calendar),e=et(e),t=et(t),e.era===t.era&&e.year===t.year&&e.month===t.month}function Dg(e,t){return t=le(t,e.calendar),e=Kn(e),t=Kn(t),e.era===t.era&&e.year===t.year}function Rg(e,t){return fr(e.calendar,t.calendar)&&we(e,t)}function Dn(e,t){return fr(e.calendar,t.calendar)&&Mg(e,t)}function Rn(e,t){return fr(e.calendar,t.calendar)&&Dg(e,t)}function fr(e,t){return e.isEqual?.(t)??t.isEqual?.(e)??e.identifier===t.identifier}function Pg(e,t){return we(e,hr(t))}const Vg={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6};function _l(e,t,n){let s=e.calendar.toJulianDay(e),r=n?Vg[n]:_g(t),o=Math.ceil(s+1-r)%7;return o<0&&(o+=7),o}function Bl(e){return tt(Date.now(),e)}function hr(e){return Pt(Bl(e))}function Wl(e,t){return e.calendar.toJulianDay(e)-t.calendar.toJulianDay(t)}function Ng(e,t){return ua(e)-ua(t)}function ua(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let Fr=null,Fg=!1;function qo(){return Fr==null&&(Fr=new Intl.DateTimeFormat().resolvedOptions().timeZone),Fr}function jl(){return Fg}function et(e){return e.subtract({days:e.day-1})}function vo(e){return e.add({days:e.calendar.getDaysInMonth(e)-e.day})}function Kn(e){return et(e.subtract({months:e.month-1}))}function Hg(e){return vo(e.add({months:e.calendar.getMonthsInYear(e)-e.month}))}function xt(e,t,n){let s=_l(e,t,n);return e.subtract({days:s})}function fa(e,t,n){return xt(e,t,n).add({days:6})}const ha=new Map,Hr=new Map;function Ul(e){if(Intl.Locale){let n=ha.get(e);return n||(n=new Intl.Locale(e).maximize().region,n&&ha.set(e,n)),n}let t=e.split("-")[1];return t==="u"?void 0:t}function _g(e){let t=Hr.get(e);if(!t){if(Intl.Locale){let s=new Intl.Locale(e);if("getWeekInfo"in s&&(t=s.getWeekInfo(),t))return Hr.set(e,t),t.firstDay}let n=Ul(e);if(e.includes("-fw-")){let s=e.split("-fw-")[1].split("-")[0];s==="mon"?t={firstDay:1}:s==="tue"?t={firstDay:2}:s==="wed"?t={firstDay:3}:s==="thu"?t={firstDay:4}:s==="fri"?t={firstDay:5}:s==="sat"?t={firstDay:6}:t={firstDay:0}}else e.includes("-ca-iso8601")?t={firstDay:1}:t={firstDay:n&&Og[n]||0};Hr.set(e,t)}return t.firstDay}function Bg(e,t,n){let s=e.calendar.getDaysInMonth(e);return Math.ceil((_l(et(e),t,n)+s)/7)}function ql(e,t){return e&&t?e.compare(t)<=0?e:t:e||t}function Gl(e,t){return e&&t?e.compare(t)>=0?e:t:e||t}const Wg={AF:[4,5],AE:[5,6],BH:[5,6],DZ:[5,6],EG:[5,6],IL:[5,6],IQ:[5,6],IR:[5,5],JO:[5,6],KW:[5,6],LY:[5,6],OM:[5,6],QA:[5,6],SA:[5,6],SD:[5,6],SY:[5,6],YE:[5,6]};function jg(e,t){let n=e.calendar.toJulianDay(e),s=Math.ceil(n+1)%7;s<0&&(s+=7);let r=Ul(t),[o,i]=Wg[r]||[6,0];return s===o||s===i}function dn(e){e=le(e,new cn);let t=Uo(e.era,e.year);return Yl(t,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function Yl(e,t,n,s,r,o,i){let a=new Date;return a.setUTCHours(s,r,o,i),a.setUTCFullYear(e,t-1,n),a.getTime()}function yo(e,t){if(t==="UTC")return 0;if(e>0&&t===qo()&&!jl())return new Date(e).getTimezoneOffset()*-6e4;let{year:n,month:s,day:r,hour:o,minute:i,second:a}=Kl(e,t);return Yl(n,s,r,o,i,a,0)-Math.floor(e/1e3)*1e3}const pa=new Map;function Kl(e,t){let n=pa.get(t);n||(n=new Intl.DateTimeFormat("en-US",{timeZone:t,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),pa.set(t,n));let s=n.formatToParts(new Date(e)),r={};for(let o of s)o.type!=="literal"&&(r[o.type]=o.value);return{year:r.era==="BC"||r.era==="B"?-r.year+1:+r.year,month:+r.month,day:+r.day,hour:r.hour==="24"?0:+r.hour,minute:+r.minute,second:+r.second}}const ga=864e5;function Ug(e,t,n,s){return(n===s?[n]:[n,s]).filter(o=>qg(e,t,o))}function qg(e,t,n){let s=Kl(n,t);return e.year===s.year&&e.month===s.month&&e.day===s.day&&e.hour===s.hour&&e.minute===s.minute&&e.second===s.second}function Qe(e,t,n="compatible"){let s=Ae(e);if(t==="UTC")return dn(s);if(t===qo()&&n==="compatible"&&!jl()){s=le(s,new cn);let d=new Date,l=Uo(s.era,s.year);return d.setFullYear(l,s.month-1,s.day),d.setHours(s.hour,s.minute,s.second,s.millisecond),d.getTime()}let r=dn(s),o=yo(r-ga,t),i=yo(r+ga,t),a=Ug(s,t,r-o,r-i);if(a.length===1)return a[0];if(a.length>1)switch(n){case"compatible":case"earlier":return a[0];case"later":return a[a.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(n){case"earlier":return Math.min(r-o,r-i);case"compatible":case"later":return Math.max(r-o,r-i);case"reject":throw new RangeError("No such absolute time found")}}function zl(e,t,n="compatible"){return new Date(Qe(e,t,n))}function tt(e,t){let n=yo(e,t),s=new Date(e+n),r=s.getUTCFullYear(),o=s.getUTCMonth()+1,i=s.getUTCDate(),a=s.getUTCHours(),d=s.getUTCMinutes(),l=s.getUTCSeconds(),f=s.getUTCMilliseconds();return new zn(r<1?"BC":"AD",r<1?-r+1:r,o,i,t,n,a,d,l,f)}function Pt(e){return new Pe(e.calendar,e.era,e.year,e.month,e.day)}function Ae(e,t){let n=0,s=0,r=0,o=0;if("timeZone"in e)({hour:n,minute:s,second:r,millisecond:o}=e);else if("hour"in e&&!t)return e;return t&&({hour:n,minute:s,second:r,millisecond:o}=t),new Zs(e.calendar,e.era,e.year,e.month,e.day,n,s,r,o)}function le(e,t){if(fr(e.calendar,t))return e;let n=t.fromJulianDay(e.calendar.toJulianDay(e)),s=e.copy();return s.calendar=t,s.era=n.era,s.year=n.year,s.month=n.month,s.day=n.day,_t(s),s}function Zl(e,t,n){if(e instanceof zn)return e.timeZone===t?e:Yg(e,t);let s=Qe(e,t,n);return tt(s,t)}function Gg(e){let t=dn(e)-e.offset;return new Date(t)}function Yg(e,t){let n=dn(e)-e.offset;return le(tt(n,t),e.calendar)}const Pn=36e5;function pr(e,t){let n=e.copy(),s="hour"in n?Jg(n,t):0;bo(n,t.years||0),n.calendar.balanceYearMonth&&n.calendar.balanceYearMonth(n,e),n.month+=t.months||0,wo(n),Jl(n),n.day+=(t.weeks||0)*7,n.day+=t.days||0,n.day+=s,Kg(n),n.calendar.balanceDate&&n.calendar.balanceDate(n),n.year<1&&(n.year=1,n.month=1,n.day=1);let r=n.calendar.getYearsInEra(n);if(n.year>r){let i=n.calendar.isInverseEra?.(n);n.year=r,n.month=i?1:n.calendar.getMonthsInYear(n),n.day=i?1:n.calendar.getDaysInMonth(n)}n.month<1&&(n.month=1,n.day=1);let o=n.calendar.getMonthsInYear(n);return n.month>o&&(n.month=o,n.day=n.calendar.getDaysInMonth(n)),n.day=Math.max(1,Math.min(n.calendar.getDaysInMonth(n),n.day)),n}function bo(e,t){e.calendar.isInverseEra?.(e)&&(t=-t),e.year+=t}function wo(e){for(;e.month<1;)bo(e,-1),e.month+=e.calendar.getMonthsInYear(e);let t=0;for(;e.month>(t=e.calendar.getMonthsInYear(e));)e.month-=t,bo(e,1)}function Kg(e){for(;e.day<1;)e.month--,wo(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,wo(e)}function Jl(e){e.month=Math.max(1,Math.min(e.calendar.getMonthsInYear(e),e.month)),e.day=Math.max(1,Math.min(e.calendar.getDaysInMonth(e),e.day))}function _t(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),Jl(e)}function Xl(e){let t={};for(let n in e)typeof e[n]=="number"&&(t[n]=-e[n]);return t}function Ql(e,t){return pr(e,Xl(t))}function Go(e,t){let n=e.copy();return t.era!=null&&(n.era=t.era),t.year!=null&&(n.year=t.year),t.month!=null&&(n.month=t.month),t.day!=null&&(n.day=t.day),_t(n),n}function zs(e,t){let n=e.copy();return t.hour!=null&&(n.hour=t.hour),t.minute!=null&&(n.minute=t.minute),t.second!=null&&(n.second=t.second),t.millisecond!=null&&(n.millisecond=t.millisecond),Zg(n),n}function zg(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=ws(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=ws(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=ws(e.minute,60);let t=Math.floor(e.hour/24);return e.hour=ws(e.hour,24),t}function Zg(e){e.millisecond=Math.max(0,Math.min(e.millisecond,999)),e.second=Math.max(0,Math.min(e.second,59)),e.minute=Math.max(0,Math.min(e.minute,59)),e.hour=Math.max(0,Math.min(e.hour,23))}function ws(e,t){let n=e%t;return n<0&&(n+=t),n}function Jg(e,t){return e.hour+=t.hours||0,e.minute+=t.minutes||0,e.second+=t.seconds||0,e.millisecond+=t.milliseconds||0,zg(e)}function Yo(e,t,n,s){let r=e.copy();switch(t){case"era":{let o=e.calendar.getEras(),i=o.indexOf(e.era);if(i<0)throw new Error("Invalid era: "+e.era);i=nt(i,n,0,o.length-1,s?.round),r.era=o[i],_t(r);break}case"year":r.calendar.isInverseEra?.(r)&&(n=-n),r.year=nt(e.year,n,-1/0,9999,s?.round),r.year===-1/0&&(r.year=1),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e);break;case"month":r.month=nt(e.month,n,1,e.calendar.getMonthsInYear(e),s?.round);break;case"day":r.day=nt(e.day,n,1,e.calendar.getDaysInMonth(e),s?.round);break;default:throw new Error("Unsupported field "+t)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),_t(r),r}function ec(e,t,n,s){let r=e.copy();switch(t){case"hour":{let o=e.hour,i=0,a=23;if(s?.hourCycle===12){let d=o>=12;i=d?12:0,a=d?23:11}r.hour=nt(o,n,i,a,s?.round);break}case"minute":r.minute=nt(e.minute,n,0,59,s?.round);break;case"second":r.second=nt(e.second,n,0,59,s?.round);break;case"millisecond":r.millisecond=nt(e.millisecond,n,0,999,s?.round);break;default:throw new Error("Unsupported field "+t)}return r}function nt(e,t,n,s,r=!1){if(r){e+=Math.sign(t),e<n&&(e=s);let o=Math.abs(t);t>0?e=Math.ceil(e/o)*o:e=Math.floor(e/o)*o,e>s&&(e=n)}else e+=t,e<n?e=s-(n-e-1):e>s&&(e=n+(e-s-1));return e}function tc(e,t){let n;if(t.years!=null&&t.years!==0||t.months!=null&&t.months!==0||t.weeks!=null&&t.weeks!==0||t.days!=null&&t.days!==0){let r=pr(Ae(e),{years:t.years,months:t.months,weeks:t.weeks,days:t.days});n=Qe(r,e.timeZone)}else n=dn(e)-e.offset;n+=t.milliseconds||0,n+=(t.seconds||0)*1e3,n+=(t.minutes||0)*6e4,n+=(t.hours||0)*36e5;let s=tt(n,e.timeZone);return le(s,e.calendar)}function Xg(e,t){return tc(e,Xl(t))}function Qg(e,t,n,s){switch(t){case"hour":{let r=0,o=23;if(s?.hourCycle===12){let m=e.hour>=12;r=m?12:0,o=m?23:11}let i=Ae(e),a=le(zs(i,{hour:r}),new cn),d=[Qe(a,e.timeZone,"earlier"),Qe(a,e.timeZone,"later")].filter(m=>tt(m,e.timeZone).day===a.day)[0],l=le(zs(i,{hour:o}),new cn),f=[Qe(l,e.timeZone,"earlier"),Qe(l,e.timeZone,"later")].filter(m=>tt(m,e.timeZone).day===l.day).pop(),u=dn(e)-e.offset,h=Math.floor(u/Pn),p=u%Pn;return u=nt(h,n,Math.floor(d/Pn),Math.floor(f/Pn),s?.round)*Pn+p,le(tt(u,e.timeZone),e.calendar)}case"minute":case"second":case"millisecond":return ec(e,t,n,s);case"era":case"year":case"month":case"day":{let r=Yo(Ae(e),t,n,s),o=Qe(r,e.timeZone);return le(tt(o,e.timeZone),e.calendar)}default:throw new Error("Unsupported field "+t)}}function em(e,t,n){let s=Ae(e),r=zs(Go(s,t),t);if(r.compare(s)===0)return e;let o=Qe(r,e.timeZone,n);return le(tt(o,e.timeZone),e.calendar)}const tm=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,nm=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function sm(e){let t=e.match(tm);if(!t)throw nm.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let n=new Pe(_r(t[1],0,9999),_r(t[2],1,12),1);return n.day=_r(t[3],1,n.calendar.getDaysInMonth(n)),n}function _r(e,t,n){let s=Number(e);if(s<t||s>n)throw new RangeError(`Value out of range: ${t} <= ${s} <= ${n}`);return s}function rm(e){return`${String(e.hour).padStart(2,"0")}:${String(e.minute).padStart(2,"0")}:${String(e.second).padStart(2,"0")}${e.millisecond?String(e.millisecond/1e3).slice(1):""}`}function nc(e){let t=le(e,new cn),n;return t.era==="BC"?n=t.year===1?"0000":"-"+String(Math.abs(1-t.year)).padStart(6,"00"):n=String(t.year).padStart(4,"0"),`${n}-${String(t.month).padStart(2,"0")}-${String(t.day).padStart(2,"0")}`}function sc(e){return`${nc(e)}T${rm(e)}`}function om(e){let t=Math.sign(e)<0?"-":"+";e=Math.abs(e);let n=Math.floor(e/36e5),s=Math.floor(e%36e5/6e4),r=Math.floor(e%36e5%6e4/1e3),o=`${t}${String(n).padStart(2,"0")}:${String(s).padStart(2,"0")}`;return r!==0&&(o+=`:${String(r).padStart(2,"0")}`),o}function im(e){return`${sc(e)}${om(e.offset)}[${e.timeZone}]`}function Ko(e){let t=typeof e[0]=="object"?e.shift():new cn,n;if(typeof e[0]=="string")n=e.shift();else{let i=t.getEras();n=i[i.length-1]}let s=e.shift(),r=e.shift(),o=e.shift();return[t,n,s,r,o]}class Pe{#e;constructor(...t){let[n,s,r,o,i]=Ko(t);this.calendar=n,this.era=s,this.year=r,this.month=o,this.day=i,_t(this)}copy(){return this.era?new Pe(this.calendar,this.era,this.year,this.month,this.day):new Pe(this.calendar,this.year,this.month,this.day)}add(t){return pr(this,t)}subtract(t){return Ql(this,t)}set(t){return Go(this,t)}cycle(t,n,s){return Yo(this,t,n,s)}toDate(t){return zl(this,t)}toString(){return nc(this)}compare(t){return Wl(this,t)}}class Zs{#e;constructor(...t){let[n,s,r,o,i]=Ko(t);this.calendar=n,this.era=s,this.year=r,this.month=o,this.day=i,this.hour=t.shift()||0,this.minute=t.shift()||0,this.second=t.shift()||0,this.millisecond=t.shift()||0,_t(this)}copy(){return this.era?new Zs(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new Zs(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(t){return pr(this,t)}subtract(t){return Ql(this,t)}set(t){return Go(zs(this,t),t)}cycle(t,n,s){switch(t){case"era":case"year":case"month":case"day":return Yo(this,t,n,s);default:return ec(this,t,n,s)}}toDate(t,n){return zl(this,t,n)}toString(){return sc(this)}compare(t){let n=Wl(this,t);return n===0?Ng(this,Ae(t)):n}}class zn{#e;constructor(...t){let[n,s,r,o,i]=Ko(t),a=t.shift(),d=t.shift();this.calendar=n,this.era=s,this.year=r,this.month=o,this.day=i,this.timeZone=a,this.offset=d,this.hour=t.shift()||0,this.minute=t.shift()||0,this.second=t.shift()||0,this.millisecond=t.shift()||0,_t(this)}copy(){return this.era?new zn(this.calendar,this.era,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond):new zn(this.calendar,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond)}add(t){return tc(this,t)}subtract(t){return Xg(this,t)}set(t,n){return em(this,t,n)}cycle(t,n,s){return Qg(this,t,n,s)}toDate(){return Gg(this)}toString(){return im(this)}toAbsoluteString(){return this.toDate().toISOString()}compare(t){return this.toDate().getTime()-Zl(t,this.timeZone).toDate().getTime()}}let Br=new Map;class Ce{constructor(t,n={}){this.formatter=rc(t,n),this.options=n}format(t){return this.formatter.format(t)}formatToParts(t){return this.formatter.formatToParts(t)}formatRange(t,n){if(typeof this.formatter.formatRange=="function")return this.formatter.formatRange(t,n);if(n<t)throw new RangeError("End date must be >= start date");return`${this.formatter.format(t)} – ${this.formatter.format(n)}`}formatRangeToParts(t,n){if(typeof this.formatter.formatRangeToParts=="function")return this.formatter.formatRangeToParts(t,n);if(n<t)throw new RangeError("End date must be >= start date");let s=this.formatter.formatToParts(t),r=this.formatter.formatToParts(n);return[...s.map(o=>({...o,source:"startRange"})),{type:"literal",value:" – ",source:"shared"},...r.map(o=>({...o,source:"endRange"}))]}resolvedOptions(){let t=this.formatter.resolvedOptions();return cm()&&(this.resolvedHourCycle||(this.resolvedHourCycle=dm(t.locale,this.options)),t.hourCycle=this.resolvedHourCycle,t.hour12=this.resolvedHourCycle==="h11"||this.resolvedHourCycle==="h12"),t.calendar==="ethiopic-amete-alem"&&(t.calendar="ethioaa"),t}}const am={true:{ja:"h11"},false:{}};function rc(e,t={}){if(typeof t.hour12=="boolean"&&lm()){t={...t};let r=am[String(t.hour12)][e.split("-")[0]],o=t.hour12?"h12":"h23";t.hourCycle=r??o,delete t.hour12}let n=e+(t?Object.entries(t).sort((r,o)=>r[0]<o[0]?-1:1).join():"");if(Br.has(n))return Br.get(n);let s=new Intl.DateTimeFormat(e,t);return Br.set(n,s),s}let Wr=null;function lm(){return Wr==null&&(Wr=new Intl.DateTimeFormat("en-US",{hour:"numeric",hour12:!1}).format(new Date(2020,2,3,0))==="24"),Wr}let jr=null;function cm(){return jr==null&&(jr=new Intl.DateTimeFormat("fr",{hour:"numeric",hour12:!1}).resolvedOptions().hourCycle==="h12"),jr}function dm(e,t){if(!t.timeStyle&&!t.hour)return;e=e.replace(/(-u-)?-nu-[a-zA-Z0-9]+/,""),e+=(e.includes("-u-")?"":"-u")+"-nu-latn";let n=rc(e,{...t,timeZone:void 0}),s=parseInt(n.formatToParts(new Date(2020,2,3,0)).find(o=>o.type==="hour").value,10),r=parseInt(n.formatToParts(new Date(2020,2,3,23)).find(o=>o.type==="hour").value,10);if(s===0&&r===23)return"h23";if(s===24&&r===23)return"h24";if(s===0&&r===11)return"h11";if(s===12&&r===11)return"h12";throw new Error("Unexpected hour cycle result")}function um(e,t,n,s,r){const o={};for(let a in t){const d=a,l=t[d];l!=null&&(o[d]=Math.floor(l/2),o[d]>0&&l%2===0&&o[d]--)}const i=jt(e,t,n).subtract(o);return Qn(e,i,t,n,s,r)}function jt(e,t,n,s,r){let o=e;return t.years?o=Kn(e):t.months?o=et(e):t.weeks&&(o=xt(e,n)),Qn(e,o,t,n,s,r)}function zo(e,t,n,s,r){let o={...t};o.days?o.days--:o.weeks?o.weeks--:o.months?o.months--:o.years&&o.years--;let i=jt(e,t,n).subtract(o);return Qn(e,i,t,n,s,r)}function Qn(e,t,n,s,r,o){return r&&e.compare(r)>=0&&(t=Gl(t,jt(Pt(r),n,s))),o&&e.compare(o)<=0&&(t=ql(t,zo(Pt(o),n,s))),t}function Te(e,t,n){const s=Pt(e),r=t?Pt(t):void 0,o=n?Pt(n):void 0;let i=s;return r&&(i=Gl(i,r)),o&&(i=ql(i,o)),i.compare(s)===0?e:"hour"in e?e.set({year:i.year,month:i.month,day:i.day}):i}function ma(e,t,n,s,r,o){switch(t){case"start":return jt(e,n,s,r,o);case"end":return zo(e,n,s,r,o);default:return um(e,n,s,r,o)}}function Et(e,t){return e==null||t==null?e===t:!("hour"in e)&&!("hour"in t)?we(e,t):Ae(e).compare(Ae(t))===0}function va(e,t,n,s,r){return e?t?.(e,n)?!0:He(e,s,r):!1}function He(e,t,n){return t!=null&&e.compare(t)<0||n!=null&&e.compare(n)>0}function fm(e,t,n){const s=e.subtract({days:1});return we(s,e)||He(s,t,n)}function hm(e,t,n){const s=e.add({days:1});return we(s,e)||He(s,t,n)}function Zo(e){let t={...e};for(let n in t)t[n]=1;return t}function oc(e,t){let n={...t};return n.days?n.days--:n.days=-1,e.add(n)}function ic(e){if(!e)return;const t=e.calendar.identifier;return t==="gregory"||t==="iso8601"?e.era==="BC"?"short":void 0:"short"}function ac(e,t,n){const s=n??Ae(hr(t));return new Ce(e,{weekday:"long",month:"long",year:"numeric",day:"numeric",era:ic(s),calendar:s.calendar.identifier,timeZone:t})}function ya(e,t,n){const s=n??hr(t);return new Ce(e,{month:"long",year:"numeric",era:ic(s),calendar:s.calendar.identifier,timeZone:t})}function pm(e,t,n,s,r){let o=n.formatRangeToParts(e.toDate(r),t.toDate(r)),i=-1;for(let l=0;l<o.length;l++){let f=o[l];if(f.source==="shared"&&f.type==="literal")i=l;else if(f.source==="endRange")break}let a="",d="";for(let l=0;l<o.length;l++)l<i?a+=o[l].value:l>i&&(d+=o[l].value);return s(a,d)}function Es(e,t,n,s){if(!e)return"";let r=e,o=t??e,i=ac(n,s);return we(r,o)?i.format(r.toDate(s)):pm(r,o,i,(a,d)=>`${a} – ${d}`,s)}var gm=["sun","mon","tue","wed","thu","fri","sat"];function lc(e){return e!=null?gm[e]:void 0}function cc(e,t,n){const s=lc(n);return xt(e,t,s)}function dc(e,t,n,s){const r=t.add({weeks:e}),o=[];let i=cc(r,n,s);for(;o.length<7;){o.push(i);let a=i.add({days:1});if(we(i,a))break;i=a}return o}function mm(e,t,n,s){const r=lc(s),o=n??Bg(e,t,r);return[...new Array(o).keys()].map(a=>dc(a,e,t,s))}function vm(e,t){const n=new Ce(e,{weekday:"long",timeZone:t}),s=new Ce(e,{weekday:"short",timeZone:t}),r=new Ce(e,{weekday:"narrow",timeZone:t});return o=>{const i=o instanceof Date?o:o.toDate(t);return{value:o,short:s.format(i),long:n.format(i),narrow:r.format(i)}}}function ym(e,t,n,s){const r=cc(e,s,t),o=[...new Array(7).keys()],i=vm(s,n);return o.map(a=>i(r.add({days:a})))}function bm(e,t="long",n){if(!n||n.calendar.identifier==="gregory"||n.calendar.identifier==="iso8601"){const i=new Date(2021,0,1),a=[];for(let d=0;d<12;d++)a.push(i.toLocaleString(e,{month:t})),i.setMonth(i.getMonth()+1);return a}const s=n.calendar.getMonthsInYear(n),r=new Ce(e,{month:t,calendar:n.calendar.identifier}),o=[];for(let i=1;i<=s;i++){const a=n.set({month:i});o.push(r.format(a.toDate("UTC")))}return o}function ba(e,t){const n=xt(e,t,"mon"),s=n.year,r=n.set({month:1,day:4}),o=xt(r,t,"mon"),i=n.calendar.toJulianDay(n),a=o.calendar.toJulianDay(o);if(i>=a)return 1+Math.floor((i-a)/7);const d=n.set({year:s-1,month:1,day:4}),l=xt(d,t,"mon"),f=l.calendar.toJulianDay(l);return 1+Math.floor((i-f)/7)}function wm(e){const t=[];for(let n=e.from;n<=e.to;n+=1)t.push(n);return t}var Em=1900,Sm=2099;function xm(e,t,n){const s=e.calendar,r=t?.year??le(new Pe(Em,1,1),s).year,o=n?.year??le(new Pe(Sm,12,31),s).year;return{from:r,to:o}}var $m=10;function Im(e){if(e){if(e.length===3)return e.padEnd(4,"0");if(e.length===2){const t=new Date().getFullYear(),n=Math.floor(t/100)*100,s=parseInt(e.slice(-2),10),r=n+s;return r>t+$m?(r-100).toString():r.toString()}return e}}function tn(e){const t=e-e%10,n=[];for(let s=0;s<10;s+=1){const r=t+s;n.push(r)}return n}function qn(e,t){const n=hr(e??qo());return t?le(n,t):n}function es(e,t,n,s){return function(o){const{startDate:i,focusedDate:a}=o,d=oc(i,e);return He(a,n,s)?{startDate:i,focusedDate:Te(a,n,s),endDate:d}:a.compare(i)<0?{startDate:zo(a,e,t,n,s),focusedDate:Te(a,n,s),endDate:d}:a.compare(d)>0?{startDate:jt(a,e,t,n,s),endDate:d,focusedDate:Te(a,n,s)}:{startDate:i,endDate:d,focusedDate:Te(a,n,s)}}}function uc(e,t,n,s,r,o){const i=es(n,s,r,o),a=t.add(n);return i({focusedDate:e.add(n),startDate:jt(Qn(e,a,n,s,r,o),n,s)})}function fc(e,t,n,s,r,o){const i=es(n,s,r,o);let a=t.subtract(n);return i({focusedDate:e.subtract(n),startDate:jt(Qn(e,a,n,s,r,o),n,s)})}function Tm(e,t,n,s,r,o,i){const a=es(s,r,o,i);if(!n&&!s.days)return a({focusedDate:e.add(Zo(s)),startDate:t});if(s.days)return uc(e,t,s,r,o,i);if(s.weeks)return a({focusedDate:e.add({months:1}),startDate:t});if(s.months||s.years)return a({focusedDate:e.add({years:1}),startDate:t})}function Cm(e,t,n,s,r,o,i){const a=es(s,r,o,i);if(!n&&!s.days)return a({focusedDate:e.subtract(Zo(s)),startDate:t});if(s.days)return fc(e,t,s,r,o,i);if(s.weeks)return a({focusedDate:e.subtract({months:1}),startDate:t});if(s.months||s.years)return a({focusedDate:e.subtract({years:1}),startDate:t})}var wa=new Map;function km(e){let t=wa.get(e);return t!=null||(t="0123456789"+new Intl.NumberFormat(e,{useGrouping:!1}).format(1234567890),wa.set(e,t)),t}var Am=(e,t)=>t?km(t).includes(e):/\d/.test(e),hc=(e,t,n)=>!e||e.length!==1?!0:Am(e,n)||t.includes(e),Lm=(e,t,n)=>e.split("").filter(s=>hc(s,t,n)).join(""),Ea=new Map;function Om(e){let t=Ea.get(e);if(t!=null)return t;const s=new Intl.DateTimeFormat(e).formatToParts(new Date).find(r=>r.type==="literal");return t=s?s.value:"/",Ea.set(e,t),t}var Sa=e=>e!=null&&e.length===4,Mm=e=>e!=null&&parseFloat(e)<=12,Dm=e=>e!=null&&parseFloat(e)<=31;function Rm(e,t,n){const s=Pm(t,n);let{year:r,month:o,day:i}=Vm(s,e)??{};if(r!=null||o!=null||i!=null){const l=new Date;r||(r=l.getFullYear().toString()),o||(o=(l.getMonth()+1).toString()),i||(i=l.getDate().toString())}if(Sa(r)||(r=Im(r)),Sa(r)&&Mm(o)&&Dm(i))return new Pe(+r,+o,+i);const d=Date.parse(e);if(!isNaN(d)){const l=new Date(d);return new Pe(l.getFullYear(),l.getMonth()+1,l.getDate())}}function Pm(e,t){return new Ce(e,{day:"numeric",month:"numeric",year:"numeric",timeZone:t}).formatToParts(new Date(2e3,11,25)).map(({type:r,value:o})=>r==="literal"?`${o}?`:`((?!=<${r}>)\\d+)?`).join("")}function Vm(e,t){const n=t.match(e);return e.toString().match(/<(.+?)>/g)?.map(s=>{const r=s.match(/<(.+)>/);return!r||r.length<=0?null:s.match(/<(.+)>/)?.[1]}).reduce((s,r,o)=>(r&&(n&&n.length>o?s[r]=n[o+1]:s[r]=null),s),{})}function xa(e,t,n){const s=Pt(Bl(n));switch(e){case"thisWeek":return[xt(s,t),fa(s,t)];case"thisMonth":return[et(s),s];case"thisQuarter":return[et(s).add({months:-((s.month-1)%3)}),s];case"thisYear":return[Kn(s),s];case"last3Days":return[s.add({days:-2}),s];case"last7Days":return[s.add({days:-6}),s];case"last14Days":return[s.add({days:-13}),s];case"last30Days":return[s.add({days:-29}),s];case"last90Days":return[s.add({days:-89}),s];case"lastMonth":return[et(s.add({months:-1})),vo(s.add({months:-1}))];case"lastQuarter":return[et(s.add({months:-((s.month-1)%3)-3})),vo(s.add({months:-((s.month-1)%3)-1}))];case"lastWeek":return[xt(s,t).add({weeks:-1}),fa(s,t).add({weeks:-1})];case"lastYear":return[Kn(s.add({years:-1})),Hg(s.add({years:-1}))];default:throw new Error(`Invalid date range preset: ${e}`)}}var Nm=(e,t)=>e.ids?.label?.(t)??`datepicker:${e.id}:label:${t}`,Fm=e=>e.ids?.root??`datepicker:${e.id}`,Hm=(e,t)=>e.ids?.table?.(t)??`datepicker:${e.id}:table:${t}`,Eo=e=>e.ids?.content??`datepicker:${e.id}:content`,Ur=(e,t)=>e.ids?.cellTrigger?.(t)??`datepicker:${e.id}:cell-trigger:${t}`,_m=(e,t)=>e.ids?.prevTrigger?.(t)??`datepicker:${e.id}:prev:${t}`,Bm=(e,t)=>e.ids?.nextTrigger?.(t)??`datepicker:${e.id}:next:${t}`,Wm=(e,t)=>e.ids?.viewTrigger?.(t)??`datepicker:${e.id}:view:${t}`,pc=e=>e.ids?.clearTrigger??`datepicker:${e.id}:clear`,gc=e=>e.ids?.control??`datepicker:${e.id}:control`,$a=(e,t)=>e.ids?.input?.(t)??`datepicker:${e.id}:input:${t}`,mc=e=>e.ids?.trigger??`datepicker:${e.id}:trigger`,vc=e=>e.ids?.positioner??`datepicker:${e.id}:positioner`,yc=e=>e.ids?.monthSelect??`datepicker:${e.id}:month-select`,bc=e=>e.ids?.yearSelect??`datepicker:${e.id}:year-select`,Ia=(e,t)=>rf(Zt(e),`[data-part=table-cell-trigger][data-view=${t}][data-focus]:not([data-outside-range])`),Rs=e=>e.getById(mc(e)),Zt=e=>e.getById(Eo(e)),Bn=e=>sf(wc(e),"[data-part=input]"),jm=e=>e.getById(bc(e)),Um=e=>e.getById(yc(e)),qm=e=>e.getById(pc(e)),Ta=e=>e.getById(vc(e)),wc=e=>e.getById(gc(e)),Ca=e=>{const t=Bn(e);if(t.length===0){Rs(e)?.focus({preventScroll:!0});return}const n=t.findLastIndex(o=>o.value!==""),s=Math.max(n,0),r=t[s];r?.focus({preventScroll:!0}),r?.setSelectionRange(r.value.length,r.value.length)};function Ps(e){const[t,n]=e;let s;return!t||!n?s=e:s=t.compare(n)<=0?e:[n,t],s}function Kt(e,t){const[n,s]=t;return!n||!s?!1:n.compare(e)<=0&&s.compare(e)>=0}function Ss(e){return e.slice().filter(t=>t!=null).sort((t,n)=>t.compare(n))}function Gm(e,t){return new Ce(e).formatToParts(new Date).map(n=>t[n.type]??n.value).join("")}var ka=e=>!Number.isNaN(e.day)&&!Number.isNaN(e.month)&&!Number.isNaN(e.year),Ym={dayCell(e){return e.unavailable?`Not available. ${e.valueText}`:e.firstInRange?`Starting range from ${e.valueText}`:e.lastInRange?`Range ending at ${e.valueText}`:e.inRange?`In range. ${e.valueText}`:e.selected?`Selected date. ${e.valueText}`:`Choose ${e.valueText}`},trigger(e){return e?"Close calendar":"Open calendar"},viewTrigger(e,t){return t?`Switch to ${t} view`:`${e} view`},presetTrigger(e){const[t="",n=""]=e;return`select ${t} to ${n}`},prevTrigger(e){return zr(e,{year:"Switch to previous decade",month:"Switch to previous year",day:"Switch to previous month"})},nextTrigger(e){return zr(e,{year:"Switch to next decade",month:"Switch to next year",day:"Switch to next month"})},placeholder(){return{day:"dd",month:"mm",year:"yyyy"}},content:"calendar",monthSelect:"Select month",yearSelect:"Select year",clearTrigger:"Clear selected dates",weekColumnHeader:"Wk",weekNumberCell(e){return`Week ${e}`}};function ot(e,t){return e?e==="day"?0:e==="month"?1:2:t||0}function Jo(e){return e===0?"day":e===1?"month":"year"}function Xo(e,t,n){return Jo(Kd(ot(e,0),ot(t,0),ot(n,2)))}function Km(e,t){return ot(e,0)>ot(t,0)}function zm(e,t){return ot(e,0)<ot(t,0)}function Ec(e,t,n){const s=ot(e,0)+1;return Xo(Jo(s),t,n)}function Zm(e,t,n){const s=ot(e,0)-1;return Xo(Jo(s),t,n)}var Jm=["day","month","year"];function Xm(e){Jm.forEach(t=>e(t))}var Qm=sp(e=>[e.view,e.startValue.toString(),e.endValue.toString(),e.locale,e.timeZone,e.selectionMode],([e],t)=>{const{startValue:n,endValue:s,locale:r,timeZone:o,selectionMode:i}=t;if(e==="year"){const u=tn(n.year),h=u.at(0).toString(),p=u.at(-1).toString();return{start:h,end:p,formatted:`${h} - ${p}`}}if(e==="month"){const u=new Ce(r,{year:"numeric",timeZone:o,calendar:n.calendar.identifier}),h=u.format(n.toDate(o)),p=u.format(s.toDate(o)),m=i==="range"?`${h} - ${p}`:h;return{start:h,end:p,formatted:m}}const a=new Ce(r,{month:"long",year:"numeric",timeZone:o,calendar:n.calendar.identifier}),d=a.format(n.toDate(o)),l=a.format(s.toDate(o)),f=i==="range"?`${d} - ${l}`:d;return{start:d,end:l,formatted:f}});function ev(e,t){const{state:n,context:s,prop:r,send:o,computed:i,scope:a}=e,d=s.get("startValue"),l=i("endValue"),f=s.get("value"),u=s.get("focusedValue"),h=s.get("hoveredValue"),p=h?Ps([f[0],h]):[],m=!!r("disabled"),c=!!r("readOnly"),g=!!r("invalid"),b=i("isInteractive"),w=f.length===0,A=r("min"),D=r("max"),M=r("locale"),$=r("timeZone"),v=r("startOfWeek"),S=n.matches("focused"),T=n.matches("open"),L=r("selectionMode")==="range",E=r("selectionMode")==="multiple",O=r("isDateUnavailable"),R=r("maxSelectedDates"),V=E&&R!=null&&f.length>=R,H=s.get("currentPlacement"),K=H?yl(H):void 0,se=bl({...r("positioning"),placement:H}),Z=Om(M),z=ja(Ym,r("translations"));function Se(C=d){const x=r("fixedWeeks")?6:void 0;return mm(C,M,x,v)}function Sn(C={}){const{format:x}=C;return bm(M,x,u).map((y,I)=>{const N=I+1,Q=u.set({month:N}),B=He(Q,A,D);return{label:y,value:N,disabled:B}})}function Ye(){const C=xm(u,A,D);return wm(C).map(y=>({label:y.toString(),value:y,disabled:!Er(y,A?.year,D?.year)}))}function Ke(C){return va(C,O,M,A,D)}function kt(C){const x=d??qn($,u.calendar);o({type:"FOCUS.SET",value:x.set({month:C})})}function Ut(C){const x=d??qn($,u.calendar);o({type:"FOCUS.SET",value:x.set({year:C})})}function yt(C){const{value:x,disabled:y}=C,I=u.set({year:x}),Q=!tn(d.year).includes(x),B=Er(x,A?.year,D?.year),j=L&&Kt(I,f),ie=L&&f[0]&&Rn(I,f[0]),Me=L&&f[1]&&Rn(I,f[1]),Ve=L&&p.length>0,re=Ve&&Kt(I,p),Ne=Ve&&p[0]&&Rn(I,p[0]),Fe=Ve&&p[1]&&Rn(I,p[1]),rs={focused:u.year===C.value,selectable:B,outsideRange:Q,selected:!!f.find(os=>os&&os.year===x),valueText:x.toString(),inRange:j||re,firstInRange:!!ie,lastInRange:!!Me,inHoveredRange:!!re,firstInHoveredRange:!!Ne,lastInHoveredRange:!!Fe,value:I,get disabled(){return y||!rs.selectable}};return rs}function At(C){const{value:x,disabled:y}=C,I=u.set({month:x}),N=ya(M,$,u),Q=L&&Kt(I,f),B=L&&f[0]&&Dn(I,f[0]),j=L&&f[1]&&Dn(I,f[1]),ie=L&&p.length>0,Me=ie&&Kt(I,p),Ve=ie&&p[0]&&Dn(I,p[0]),re=ie&&p[1]&&Dn(I,p[1]),Ne={focused:u.month===C.value,selectable:!He(I,A,D),selected:!!f.find(Fe=>Fe&&Fe.month===x&&Fe.year===u.year),valueText:N.format(I.toDate($)),inRange:Q||Me,firstInRange:!!B,lastInRange:!!j,inHoveredRange:!!Me,firstInHoveredRange:!!Ve,lastInHoveredRange:!!re,outsideRange:!1,value:I,get disabled(){return y||!Ne.selectable}};return Ne}function bt(C){const{value:x,disabled:y,visibleRange:I=i("visibleRange")}=C,N=ac(M,$,u),Q=Zo(i("visibleDuration")),B=r("outsideDaySelectable"),j=I.start.add(Q).subtract({days:1}),ie=He(x,I.start,j),Me=L&&Kt(x,f),Ve=L&&f[0]&&we(x,f[0]),re=L&&f[1]&&we(x,f[1]),Ne=L&&p.length>0,Fe=Ne&&Kt(x,p),rs=Ne&&p[0]&&we(x,p[0]),os=Ne&&p[1]&&we(x,p[1]),fi=f.some(hi=>hi!=null&&we(x,hi)),is={invalid:He(x,A,D),disabled:y||!B&&ie||He(x,A,D)||V&&!fi,selected:fi,unavailable:va(x,O,M,A,D)&&!y,outsideRange:ie,today:Pg(x,$),weekend:jg(x,M),value:x,valueText:N.format(x.toDate($)),get focused(){return u!=null&&we(x,u)&&(!is.outsideRange||B)},get selectable(){return!is.disabled&&!is.unavailable},inRange:Me||Fe,firstInRange:Ve,lastInRange:re,inHoveredRange:Fe,firstInHoveredRange:rs,lastInHoveredRange:os};return is}function xn(C){const{view:x="day",id:y}=C;return[x,y].filter(Boolean).join(" ")}return{focused:S,open:T,disabled:m,invalid:g,readOnly:c,inline:!!r("inline"),numOfMonths:r("numOfMonths"),showWeekNumbers:!!r("showWeekNumbers"),selectionMode:r("selectionMode"),maxSelectedDates:R,isMaxSelected:V,view:s.get("view"),getRangePresetValue(C){return xa(C,M,$)},getWeekNumber(C){const x=C[0];return x?ba(x,M):0},getDaysInWeek(C,x=d){return dc(C,x,M,v)},getOffset(C){const x=d.add(C),y=l.add(C),I=ya(M,$,u);return{visibleRange:{start:x,end:y},weeks:Se(x),visibleRangeText:{start:I.format(x.toDate($)),end:I.format(y.toDate($))}}},getMonthWeeks:Se,isUnavailable:Ke,weeks:Se(),weekDays:ym(d,v,$,M),visibleRangeText:i("visibleRangeText"),value:f,valueAsDate:f.filter(C=>C!=null).map(C=>C.toDate($)),valueAsString:i("valueAsString"),focusedValue:u,focusedValueAsDate:u?.toDate($),focusedValueAsString:r("format")(u,{locale:M,timeZone:$}),visibleRange:i("visibleRange"),selectToday(){const C=Te(qn($,u.calendar),A,D);o({type:"VALUE.SET",value:[C]})},setValue(C){const x=C.map(y=>Te(y,A,D));o({type:"VALUE.SET",value:x})},setTime(C,x=0){const y=Array.from(f);let I=y[x];I&&("hour"in I||(I=Ae(I)),I=I.set({hour:C.hour??("hour"in I?I.hour:0),minute:C.minute??("minute"in I?I.minute:0),second:C.second??("second"in I?I.second:0),millisecond:C.millisecond??("millisecond"in I?I.millisecond:0)}),y[x]=Te(I,A,D),o({type:"VALUE.SET",value:y}))},clearValue(C={}){const{focus:x=!0}=C;o({type:"VALUE.CLEAR",focus:x})},setFocusedValue(C){o({type:"FOCUS.SET",value:C})},setOpen(C){r("inline")||o({type:C?"OPEN":"CLOSE",replaces:"open"})},focusMonth:kt,focusYear:Ut,getYears:Ye,getMonths:Sn,getYearsGrid(C={}){const{columns:x=1}=C,y=tn(d.year).map(I=>({label:I.toString(),value:I,disabled:!Er(I,A?.year,D?.year)}));return wi(y,x)},getDecade(){const C=tn(d.year);return{start:C.at(0),end:C.at(-1)}},getMonthsGrid(C={}){const{columns:x=1,format:y}=C;return wi(Sn({format:y}),x)},format(C,x={month:"long",year:"numeric"}){return new Ce(M,{...x,calendar:C.calendar.identifier}).format(C.toDate($))},setView(C){o({type:"VIEW.SET",view:C})},goToNext(){o({type:"GOTO.NEXT",view:s.get("view")})},goToPrev(){o({type:"GOTO.PREV",view:s.get("view")})},getRootProps(){return t.element({...J.root.attrs,dir:r("dir"),id:Fm(a),"data-state":T?"open":"closed","data-disabled":P(m),"data-readonly":P(c),"data-empty":P(w)})},getLabelProps(C={}){const{index:x=0}=C;return t.label({...J.label.attrs,id:Nm(a,x),dir:r("dir"),htmlFor:$a(a,x),"data-state":T?"open":"closed","data-index":x,"data-disabled":P(m),"data-readonly":P(c),"data-invalid":P(g)})},getControlProps(){return t.element({...J.control.attrs,dir:r("dir"),id:gc(a),"data-disabled":P(m),"data-placeholder-shown":P(w),"data-invalid":P(g)})},getRangeTextProps(){return t.element({...J.rangeText.attrs,dir:r("dir")})},getContentProps(){return t.element({...J.content.attrs,hidden:!T,dir:r("dir"),"data-state":T?"open":"closed","data-placement":H,"data-side":K,"data-inline":P(r("inline")),id:Eo(a),tabIndex:-1,role:"application","aria-label":z.content})},getTableProps(C={}){const{view:x="day",columns:y=x==="day"?7:4}=C,I=xn(C);return t.element({...J.table.attrs,role:"grid","data-columns":y,"aria-label":i("visibleRangeText").formatted,id:Hm(a,I),"aria-readonly":ue(c),"aria-disabled":ue(m),"aria-multiselectable":ue(r("selectionMode")!=="single"),"data-view":x,dir:r("dir"),tabIndex:-1,onKeyDown(N){if(N.defaultPrevented||m)return;const Q={Enter(){b&&(x==="day"&&Ke(u)||x==="month"&&!At({value:u.month}).selectable||x==="year"&&!yt({value:u.year}).selectable||o({type:"TABLE.ENTER",view:x,columns:y,focus:!0}))},Space(j){Q.Enter?.()},ArrowLeft(){o({type:"TABLE.ARROW_LEFT",view:x,columns:y,focus:!0})},ArrowRight(){o({type:"TABLE.ARROW_RIGHT",view:x,columns:y,focus:!0})},ArrowUp(){o({type:"TABLE.ARROW_UP",view:x,columns:y,focus:!0})},ArrowDown(){o({type:"TABLE.ARROW_DOWN",view:x,columns:y,focus:!0})},PageUp(j){o({type:"TABLE.PAGE_UP",larger:j.shiftKey,view:x,columns:y,focus:!0})},PageDown(j){o({type:"TABLE.PAGE_DOWN",larger:j.shiftKey,view:x,columns:y,focus:!0})},Home(){o({type:"TABLE.HOME",view:x,columns:y,focus:!0})},End(){o({type:"TABLE.END",view:x,columns:y,focus:!0})}},B=Q[Jr(N,{dir:r("dir")})];B&&(B(N),N.preventDefault(),N.stopPropagation())},onPointerLeave(){o({type:"TABLE.POINTER_LEAVE"})},onPointerDown(){o({type:"TABLE.POINTER_DOWN",view:x})},onPointerUp(){o({type:"TABLE.POINTER_UP",view:x})}})},getTableHeadProps(C={}){const{view:x="day"}=C;return t.element({...J.tableHead.attrs,"aria-hidden":!0,dir:r("dir"),"data-view":x,"data-disabled":P(m)})},getTableHeaderProps(C={}){const{view:x="day"}=C;return t.element({...J.tableHeader.attrs,dir:r("dir"),"data-view":x,"data-disabled":P(m)})},getTableBodyProps(C={}){const{view:x="day"}=C;return t.element({...J.tableBody.attrs,"data-view":x,"data-disabled":P(m)})},getTableRowProps(C={}){const{view:x="day"}=C;return t.element({...J.tableRow.attrs,"aria-disabled":ue(m),"data-disabled":P(m),"data-view":x})},getWeekNumberHeaderCellProps(C={}){const{view:x="day"}=C;return t.element({...J.tableCell.attrs,scope:"col","aria-label":z.weekColumnHeader,"data-view":x,"data-type":"week-number","data-disabled":P(m)})},getWeekNumberCellProps(C){const{weekIndex:x,week:y}=C,I=y[0]?ba(y[0],M):0;return t.element({...J.tableCell.attrs,role:"rowheader","aria-label":z.weekNumberCell?.(I),"data-view":"day","data-week-index":x,"data-type":"week-number","data-disabled":P(m)})},getDayTableCellState:bt,getDayTableCellProps(C){const{value:x}=C,y=bt(C);return t.element({...J.tableCell.attrs,role:"gridcell","aria-disabled":ue(!y.selectable),"aria-selected":y.selected||y.inRange,"aria-invalid":ue(y.invalid),"aria-current":y.today?"date":void 0,"data-value":x.toString()})},getDayTableCellTriggerProps(C){const{value:x}=C,y=bt(C);return t.element({...J.tableCellTrigger.attrs,id:Ur(a,x.toString()),role:"button",dir:r("dir"),tabIndex:m?-1:y.focused?0:-1,"aria-label":z.dayCell(y),"aria-disabled":ue(!y.selectable),"aria-invalid":ue(y.invalid),"data-disabled":P(!y.selectable),"data-selectable":P(y.selectable),"data-selected":P(y.selected),"data-value":x.toString(),"data-view":"day","data-today":P(y.today),"data-focus":P(y.focused),"data-unavailable":P(y.unavailable),"data-range-start":P(y.firstInRange),"data-range-end":P(y.lastInRange),"data-in-range":P(y.inRange),"data-outside-range":P(y.outsideRange),"data-weekend":P(y.weekend),"data-in-hover-range":P(y.inHoveredRange),"data-hover-range-start":P(y.firstInHoveredRange),"data-hover-range-end":P(y.lastInHoveredRange),onClick(I){I.defaultPrevented||b&&y.selectable&&o({type:"CELL.CLICK",cell:"day",value:x})},onPointerMove:L?I=>{if(I.pointerType==="touch"||!y.selectable)return;const N=!a.isActiveElement(I.currentTarget);h&&Rg(x,h)||o({type:"CELL.POINTER_MOVE",cell:"day",value:x,focus:N,outsideRange:y.outsideRange})}:void 0})},getMonthTableCellState:At,getMonthTableCellProps(C){const{value:x,columns:y}=C,I=At(C);return t.element({...J.tableCell.attrs,dir:r("dir"),colSpan:y,role:"gridcell","aria-selected":ue(I.selected||I.inRange),"data-selected":P(I.selected),"aria-disabled":ue(!I.selectable),"data-value":x})},getMonthTableCellTriggerProps(C){const{value:x}=C,y=At(C);return t.element({...J.tableCellTrigger.attrs,id:Ur(a,x.toString()),role:"button",dir:r("dir"),tabIndex:m?-1:y.focused?0:-1,"aria-label":y.valueText,"aria-disabled":ue(!y.selectable),"data-disabled":P(!y.selectable),"data-selectable":P(y.selectable),"data-selected":P(y.selected),"data-value":x,"data-view":"month","data-focus":P(y.focused),"data-outside-range":P(y.outsideRange),"data-range-start":P(y.firstInRange),"data-range-end":P(y.lastInRange),"data-in-range":P(y.inRange),"data-in-hover-range":P(y.inHoveredRange),"data-hover-range-start":P(y.firstInHoveredRange),"data-hover-range-end":P(y.lastInHoveredRange),onClick(I){I.defaultPrevented||b&&y.selectable&&o({type:"CELL.CLICK",cell:"month",value:x})},onPointerMove:L?I=>{if(I.pointerType==="touch"||!y.selectable)return;const N=!a.isActiveElement(I.currentTarget);h&&y.value&&Dn(y.value,h)||o({type:"CELL.POINTER_MOVE",cell:"month",value:y.value,focus:N})}:void 0})},getYearTableCellState:yt,getYearTableCellProps(C){const{value:x,columns:y}=C,I=yt(C);return t.element({...J.tableCell.attrs,dir:r("dir"),colSpan:y,role:"gridcell","aria-selected":ue(I.selected||I.inRange),"data-selected":P(I.selected),"aria-disabled":ue(!I.selectable),"data-value":x})},getYearTableCellTriggerProps(C){const{value:x}=C,y=yt(C);return t.element({...J.tableCellTrigger.attrs,id:Ur(a,x.toString()),role:"button",dir:r("dir"),tabIndex:m?-1:y.focused?0:-1,"aria-label":y.valueText,"aria-disabled":ue(!y.selectable),"data-disabled":P(!y.selectable),"data-selectable":P(y.selectable),"data-selected":P(y.selected),"data-value":x,"data-view":"year","data-focus":P(y.focused),"data-outside-range":P(y.outsideRange),"data-range-start":P(y.firstInRange),"data-range-end":P(y.lastInRange),"data-in-range":P(y.inRange),"data-in-hover-range":P(y.inHoveredRange),"data-hover-range-start":P(y.firstInHoveredRange),"data-hover-range-end":P(y.lastInHoveredRange),onClick(I){I.defaultPrevented||b&&y.selectable&&o({type:"CELL.CLICK",cell:"year",value:x})},onPointerMove:L?I=>{if(I.pointerType==="touch"||!y.selectable||y.outsideRange)return;const N=!a.isActiveElement(I.currentTarget);h&&y.value&&Rn(y.value,h)||o({type:"CELL.POINTER_MOVE",cell:"year",value:y.value,focus:N})}:void 0})},getNextTriggerProps(C={}){const{view:x="day"}=C,y=m||!i("isNextVisibleRangeValid");return t.button({...J.nextTrigger.attrs,dir:r("dir"),id:Bm(a,x),type:"button","aria-label":z.nextTrigger(x),disabled:y,"data-disabled":P(y),onClick(I){I.defaultPrevented||o({type:"GOTO.NEXT",view:x})}})},getPrevTriggerProps(C={}){const{view:x="day"}=C,y=m||!i("isPrevVisibleRangeValid");return t.button({...J.prevTrigger.attrs,dir:r("dir"),id:_m(a,x),type:"button","aria-label":z.prevTrigger(x),disabled:y,"data-disabled":P(y),onClick(I){I.defaultPrevented||o({type:"GOTO.PREV",view:x})}})},getClearTriggerProps(){return t.button({...J.clearTrigger.attrs,id:pc(a),dir:r("dir"),type:"button","aria-label":z.clearTrigger,hidden:!f.length,onClick(C){C.defaultPrevented||b&&o({type:"VALUE.CLEAR"})}})},getTriggerProps(){return t.button({...J.trigger.attrs,id:mc(a),dir:r("dir"),type:"button","data-placement":H,"data-side":K,"aria-label":z.trigger(T),"aria-controls":Eo(a),"aria-expanded":T,"data-state":T?"open":"closed","data-placeholder-shown":P(w),"aria-haspopup":"grid",disabled:m,onClick(C){C.defaultPrevented||b&&o({type:"TRIGGER.CLICK"})}})},getViewProps(C={}){const{view:x="day"}=C;return t.element({...J.view.attrs,"data-view":x,hidden:s.get("view")!==x})},getViewTriggerProps(C={}){const{view:x="day"}=C,y=Ec(x,r("minView"),r("maxView")),I=y!==x,N=m||!I;return t.button({...J.viewTrigger.attrs,"data-view":x,dir:r("dir"),id:Wm(a,x),type:"button",disabled:N,"data-disabled":P(N),"aria-label":z.viewTrigger(x,I?y:void 0),onClick(Q){Q.defaultPrevented||b&&o({type:"VIEW.TOGGLE",src:"viewTrigger"})}})},getViewControlProps(C={}){const{view:x="day"}=C;return t.element({...J.viewControl.attrs,"data-view":x,dir:r("dir")})},getInputProps(C={}){const{index:x=0,fixOnBlur:y=!0}=C;return t.input({...J.input.attrs,id:$a(a,x),autoComplete:"off",autoCorrect:"off",spellCheck:"false",dir:r("dir"),name:r("name"),"data-index":x,"data-state":T?"open":"closed","data-placeholder-shown":P(w),readOnly:c,disabled:m,required:r("required"),"aria-invalid":ue(g),"data-invalid":P(g),placeholder:r("placeholder")||Gm(M,z.placeholder(M)),defaultValue:i("valueAsString")[x],onBeforeInput(I){const{data:N}=Mo(I);hc(N,Z,M)||I.preventDefault()},onClick(I){I.defaultPrevented||r("openOnClick")&&b&&o({type:"OPEN",src:"input.click"})},onFocus(){o({type:"INPUT.FOCUS",index:x})},onBlur(I){const N=I.currentTarget.value.trim();o({type:"INPUT.BLUR",value:N,index:x,fixOnBlur:y})},onKeyDown(I){if(I.defaultPrevented||!b)return;const Q={Enter(B){Tu(B)||Ke(u)||B.currentTarget.value.trim()!==""&&o({type:"INPUT.ENTER",value:B.currentTarget.value,index:x})}}[I.key];Q&&(Q(I),I.preventDefault())},onInput(I){const N=I.currentTarget.value;o({type:"INPUT.CHANGE",value:Lm(N,Z,M),index:x})}})},getMonthSelectProps(){return t.select({...J.monthSelect.attrs,id:yc(a),"aria-label":z.monthSelect,disabled:m,dir:r("dir"),defaultValue:d.month,onChange(C){kt(Number(C.currentTarget.value))}})},getYearSelectProps(){return t.select({...J.yearSelect.attrs,id:bc(a),disabled:m,"aria-label":z.yearSelect,dir:r("dir"),defaultValue:d.year,onChange(C){Ut(Number(C.currentTarget.value))}})},getPositionerProps(){return t.element({id:vc(a),...J.positioner.attrs,dir:r("dir"),style:se.floating})},getPresetTriggerProps(C){const x=Array.isArray(C.value)?C.value:xa(C.value,M,$),y=x.filter(I=>I!=null).map(I=>I.toDate($).toDateString());return t.button({...J.presetTrigger.attrs,"aria-label":z.presetTrigger(y),type:"button",onClick(I){I.defaultPrevented||b&&o({type:"PRESET.CLICK",value:x})}})}}}var qr="__live-region-debug__",tv="position:fixed;inset-inline:0;bottom:0;z-index:2147483647;padding:12px 16px;background:black;color:white;font-size:14px;line-height:20px;text-align:center;pointer-events:none;",nv=100,sv=200,rv={border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"};function ov(e={}){const{level:t="polite",document:n=document,root:s,delay:r=0,debug:o=!1}=e,i=n.defaultView??window,a=()=>(typeof s=="function"?s():s)??n.body;let d;function l(){if(!o)return;let g=n.getElementById(qr);return g||(g=n.createElement("div"),g.id=qr,g.dataset.liveAnnouncerDebug="true",g.setAttribute("aria-hidden","true"),g.style.cssText=tv,a().appendChild(g),g)}function f(){const g=n.createElement("span");return g.dataset.liveAnnouncer="true",g.setAttribute("aria-live",t),g.setAttribute("aria-atomic","true"),g.setAttribute("role",t==="assertive"?"alert":"status"),Object.assign(g.style,rv),a().appendChild(g),u=Date.now()+sv,g}let u=0,h=f();function p(){i.clearTimeout(d),d=void 0}function m(g,b=r){p(),h?.isConnected||(h=f());const w=h;w.textContent="",d=i.setTimeout(()=>{d=void 0,w.textContent=g;const A=l();A&&(A.textContent=g)},Math.max(b,nv,u-Date.now()))}function c(){p(),h?.remove(),h=null,o&&n.getElementById(qr)?.remove()}return{announce:m,cancel:p,destroy:c,toJSON(){return"live-region"}}}var{and:ge}=Il();function iv(e,t){if(e?.length!==t?.length)return!1;const n=Math.max(e.length,t.length);for(let s=0;s<n;s++)if(!Et(e[s],t[s]))return!1;return!0}function xs(e,t){return e.map(n=>n==null?"":t("format")(n,{locale:t("locale"),timeZone:t("timeZone")}))}var av=Tl({props({props:e}){const t=e.locale||"en-US",n=e.timeZone||"UTC",s=e.selectionMode||"single",r=e.numOfMonths||1;let o;if(e.createCalendar){const m=new Intl.DateTimeFormat(t).resolvedOptions().calendar;m!=="gregory"&&m!=="iso8601"&&(o=e.createCalendar(m))}const i=p=>!o||p.calendar.identifier===o.identifier?p:le(p,o),a=e.defaultValue?Ss(e.defaultValue).map(p=>Te(i(p),e.min,e.max)):void 0,d=e.value?Ss(e.value).map(p=>Te(i(p),e.min,e.max)):void 0;let l=e.focusedValue||e.defaultFocusedValue||d?.[0]||a?.[0]||qn(n,o);l=Te(i(l),e.min,e.max);const f=e.minView||"day",u=e.maxView||"year",h=Xo(e.defaultView||e.view||f,f,u);return{locale:t,numOfMonths:r,timeZone:n,selectionMode:s,minView:f,maxView:u,outsideDaySelectable:!1,closeOnSelect:!0,format(p,{locale:m,timeZone:c}){return new Ce(m,{timeZone:c,day:"2-digit",month:"2-digit",year:"numeric",calendar:o?.identifier}).format(p.toDate(c))},parse(p,{locale:m,timeZone:c}){return Rm(p,m,c)},...e,focusedValue:typeof e.focusedValue>"u"?void 0:l,defaultFocusedValue:l,value:d,defaultValue:a??[],defaultView:h,positioning:{placement:"bottom",...e.positioning}}},initialState({prop:e}){return e("inline")||(e("open")??e("defaultOpen"))?"open":"idle"},refs(){return{announcer:void 0}},context({prop:e,bindable:t,getContext:n}){return{focusedValue:t(()=>({defaultValue:e("defaultFocusedValue"),value:e("focusedValue"),isEqual:Et,hash:s=>s.toString(),sync:!0,onChange(s){const r=n(),o=r.get("view"),i=r.get("value"),a=xs(i,e);e("onFocusChange")?.({value:i,valueAsString:a,view:o,focusedValue:s})}})),value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:iv,hash:s=>s.map(r=>r?.toString()??"").join(","),onChange(s){const r=n(),o=xs(s,e);e("onValueChange")?.({value:s,valueAsString:o,view:r.get("view")})}})),inputValue:t(()=>({defaultValue:""})),activeIndex:t(()=>({defaultValue:0,sync:!0})),hoveredValue:t(()=>({defaultValue:null,isEqual:Et})),view:t(()=>({defaultValue:e("defaultView"),value:e("view"),onChange(s){e("onViewChange")?.({view:s})}})),startValue:t(()=>{const s=e("focusedValue")||e("defaultFocusedValue");return{defaultValue:ma(s,"start",{months:e("numOfMonths")},e("locale")),isEqual:Et,hash:r=>r.toString()}}),currentPlacement:t(()=>({defaultValue:void 0})),restoreFocus:t(()=>({defaultValue:!1}))}},computed:{isInteractive:({prop:e})=>!e("disabled")&&!e("readOnly"),visibleDuration:({prop:e})=>({months:e("numOfMonths")}),endValue:({context:e,computed:t})=>oc(e.get("startValue"),t("visibleDuration")),visibleRange:({context:e,computed:t})=>({start:e.get("startValue"),end:t("endValue")}),visibleRangeText:({context:e,prop:t,computed:n})=>Qm({view:e.get("view"),startValue:e.get("startValue"),endValue:n("endValue"),locale:t("locale"),timeZone:t("timeZone"),selectionMode:t("selectionMode")}),isPrevVisibleRangeValid:({context:e,prop:t})=>!fm(e.get("startValue"),t("min"),t("max")),isNextVisibleRangeValid:({prop:e,computed:t})=>!hm(t("endValue"),e("min"),e("max")),valueAsString:({context:e,prop:t})=>xs(e.get("value"),t)},effects:["setupLiveRegion"],watch({track:e,prop:t,context:n,action:s,computed:r}){e([()=>t("locale")],()=>{s(["setStartValue","syncInputElement"])}),e([()=>n.hash("focusedValue")],()=>{s(["setStartValue","focusActiveCellIfNeeded","setHoveredValueIfKeyboard"])}),e([()=>n.hash("startValue")],()=>{s(["syncMonthSelectElement","syncYearSelectElement","invokeOnVisibleRangeChange"])}),e([()=>n.get("inputValue")],()=>{s(["syncInputValue"])}),e([()=>n.hash("value")],()=>{s(["syncInputElement"])}),e([()=>r("valueAsString").toString()],()=>{s(["announceValueText"])}),e([()=>n.get("view")],()=>{s(["focusActiveCell"])}),e([()=>t("open")],()=>{s(["toggleVisibility"])})},on:{"VALUE.SET":{actions:["setDateValue","setFocusedDate"]},"VIEW.SET":{actions:["setView"]},"FOCUS.SET":{actions:["setFocusedDate"]},"VALUE.CLEAR":{actions:["clearDateValue","clearFocusedDate","setActiveIndexToStart","clearHoveredDate","focusFirstInputElement"]},"INPUT.CHANGE":[{guard:"isInputValueEmpty",actions:["setInputValue","clearDateValue","clearFocusedDate"]},{actions:["setInputValue","focusParsedDate"]}],"INPUT.ENTER":{actions:["focusParsedDate","selectFocusedDate"]},"INPUT.FOCUS":{actions:["setActiveIndex"]},"INPUT.BLUR":[{guard:"shouldFixOnBlur",actions:["setActiveIndexToStart","selectParsedDate"]},{actions:["setActiveIndexToStart"]}],"PRESET.CLICK":[{guard:"isOpenControlled",actions:["setDateValue","setFocusedDate","invokeOnClose"]},{target:"focused",actions:["setDateValue","setFocusedDate","focusInputElement"]}],"GOTO.NEXT":[{guard:"isYearView",actions:["focusNextDecade","announceVisibleRange"]},{guard:"isMonthView",actions:["focusNextYear","announceVisibleRange"]},{actions:["focusNextPage"]}],"GOTO.PREV":[{guard:"isYearView",actions:["focusPreviousDecade","announceVisibleRange"]},{guard:"isMonthView",actions:["focusPreviousYear","announceVisibleRange"]},{actions:["focusPreviousPage"]}]},states:{idle:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell"]},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}]}},focused:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell"]},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}]}},open:{tags:["open"],entry:["resumeRangeSelection"],effects:["trackDismissableElement","trackPositioning"],exit:["clearHoveredDate"],on:{"CONTROLLED.CLOSE":[{guard:ge("shouldRestoreFocus","isInteractOutsideEvent"),target:"focused",actions:["restoreFocusToTrigger"]},{guard:"shouldRestoreFocus",target:"focused",actions:["restoreFocusToInput"]},{target:"idle"}],"CELL.CLICK":[{guard:"isAboveMinView",actions:["setFocusedValueForView","setPreviousView"]},{guard:ge("isRangePicker","hasSelectedRange"),actions:["setActiveIndexToStart","resetSelection","setActiveIndexToEnd"]},{guard:ge("isRangePicker","isSelectingEndDate","closeOnSelect","isOpenControlled"),actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","setRestoreFocus"]},{guard:ge("isRangePicker","isSelectingEndDate","closeOnSelect"),target:"focused",actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","restoreFocusToInput"]},{guard:ge("isRangePicker","isSelectingEndDate"),actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate"]},{guard:"isRangePicker",actions:["setFocusedDate","setSelectedDate","setActiveIndexToEnd"]},{guard:ge("isMultiPicker","canSelectDate"),actions:["setFocusedDate","toggleSelectedDate"]},{guard:"isMultiPicker",actions:["setFocusedDate"]},{guard:ge("closeOnSelect","isOpenControlled"),actions:["setFocusedDate","setSelectedDate","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["setFocusedDate","setSelectedDate","invokeOnClose","restoreFocusToInput"]},{actions:["setFocusedDate","setSelectedDate"]}],"CELL.POINTER_MOVE":[{guard:ge("isRangePicker","isSelectingEndDate","isDayPointerMoveOutsideVisibleMonth"),actions:["setHoveredDate"]},{guard:ge("isRangePicker","isSelectingEndDate"),actions:["setHoveredDate","setFocusedDate"]}],"TABLE.POINTER_LEAVE":{guard:"isRangePicker",actions:["clearHoveredDate"]},"TABLE.POINTER_DOWN":{actions:["disableTextSelection"]},"TABLE.POINTER_UP":{actions:["enableTextSelection"]},"TABLE.ESCAPE":[{guard:"isOpenControlled",actions:["focusFirstSelectedDate","invokeOnClose"]},{target:"focused",actions:["focusFirstSelectedDate","invokeOnClose","restoreFocusToTrigger"]}],"TABLE.ENTER":[{guard:"isAboveMinView",actions:["setPreviousView"]},{guard:ge("isRangePicker","hasSelectedRange"),actions:["setActiveIndexToStart","resetSelection","setActiveIndexToEnd","focusNextDay"]},{guard:ge("isRangePicker","isSelectingEndDate","closeOnSelect","isOpenControlled"),actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose"]},{guard:ge("isRangePicker","isSelectingEndDate","closeOnSelect"),target:"focused",actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","restoreFocusToInput"]},{guard:ge("isRangePicker","isSelectingEndDate"),actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate"]},{guard:"isRangePicker",actions:["setSelectedDate","setActiveIndexToEnd","focusNextDay"]},{guard:ge("isMultiPicker","canSelectDate"),actions:["toggleSelectedDate"]},{guard:"isMultiPicker"},{guard:ge("closeOnSelect","isOpenControlled"),actions:["selectFocusedDate","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectFocusedDate","invokeOnClose","restoreFocusToInput"]},{actions:["selectFocusedDate"]}],"TABLE.ARROW_RIGHT":[{guard:"isMonthView",actions:["focusNextMonth"]},{guard:"isYearView",actions:["focusNextYear"]},{actions:["focusNextDay","setHoveredDate"]}],"TABLE.ARROW_LEFT":[{guard:"isMonthView",actions:["focusPreviousMonth"]},{guard:"isYearView",actions:["focusPreviousYear"]},{actions:["focusPreviousDay"]}],"TABLE.ARROW_UP":[{guard:"isMonthView",actions:["focusPreviousMonthColumn"]},{guard:"isYearView",actions:["focusPreviousYearColumn"]},{actions:["focusPreviousWeek"]}],"TABLE.ARROW_DOWN":[{guard:"isMonthView",actions:["focusNextMonthColumn"]},{guard:"isYearView",actions:["focusNextYearColumn"]},{actions:["focusNextWeek"]}],"TABLE.PAGE_UP":{actions:["focusPreviousSection"]},"TABLE.PAGE_DOWN":{actions:["focusNextSection"]},"TABLE.HOME":[{guard:"isMonthView",actions:["focusFirstMonth"]},{guard:"isYearView",actions:["focusFirstYear"]},{actions:["focusSectionStart"]}],"TABLE.END":[{guard:"isMonthView",actions:["focusLastMonth"]},{guard:"isYearView",actions:["focusLastYear"]},{actions:["focusSectionEnd"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose"]}],"VIEW.TOGGLE":{actions:["setNextView"]},INTERACT_OUTSIDE:[{guard:"isOpenControlled",actions:["setActiveIndexToStart","invokeOnClose"]},{guard:"shouldRestoreFocus",target:"focused",actions:["setActiveIndexToStart","invokeOnClose","restoreFocusToTrigger"]},{target:"idle",actions:["setActiveIndexToStart","invokeOnClose"]}],CLOSE:[{guard:"isOpenControlled",actions:["setActiveIndexToStart","invokeOnClose"]},{target:"idle",actions:["setActiveIndexToStart","invokeOnClose"]}]}}},implementations:{guards:{isAboveMinView:({context:e,prop:t})=>Km(e.get("view"),t("minView")),isDayView:({context:e,event:t})=>(t.view||e.get("view"))==="day",isMonthView:({context:e,event:t})=>(t.view||e.get("view"))==="month",isYearView:({context:e,event:t})=>(t.view||e.get("view"))==="year",isRangePicker:({prop:e})=>e("selectionMode")==="range",hasSelectedRange:({context:e})=>e.get("value").length===2,isMultiPicker:({prop:e})=>e("selectionMode")==="multiple",canSelectDate:e=>{const{context:t,prop:n,event:s}=e,r=n("maxSelectedDates");if(r==null)return!0;const o=t.get("value"),i=Wn(e,s.value??t.get("focusedValue"));return o.some(d=>Et(d,i))?!0:o.length<r},shouldRestoreFocus:({context:e})=>!!e.get("restoreFocus"),isSelectingEndDate:({context:e})=>e.get("activeIndex")===1,closeOnSelect:({prop:e})=>!!e("closeOnSelect"),isOpenControlled:({prop:e})=>e("open")!=null||!!e("inline"),isInteractOutsideEvent:({event:e})=>e.previousEvent?.type==="INTERACT_OUTSIDE",isInputValueEmpty:({event:e})=>e.value.trim()==="",shouldFixOnBlur:({event:e})=>!!e.fixOnBlur,isDayPointerMoveOutsideVisibleMonth:({event:e})=>e.cell==="day"&&e.outsideRange===!0},effects:{trackPositioning({context:e,prop:t,scope:n}){if(t("inline"))return;e.get("currentPlacement")||e.set("currentPlacement",t("positioning").placement);const s=wc(n);return io(s,()=>Ta(n),{...t("positioning"),defer:!0,onComplete(o){e.set("currentPlacement",o.placement)}})},setupLiveRegion({scope:e,refs:t}){const n=e.getDoc();return t.set("announcer",ov({level:"assertive",document:n})),()=>t.get("announcer")?.destroy?.()},trackDismissableElement({scope:e,send:t,context:n,prop:s}){return s("inline")?void 0:Al(()=>Zt(e),{type:"popover",defer:!0,getRootNode:e.getRootNode,layerStyleTargets:[()=>Ta(e)],exclude:[...Bn(e),Rs(e),qm(e)],onInteractOutside(o){n.set("restoreFocus",!o.detail.focusable)},onDismiss(){t({type:"INTERACT_OUTSIDE"})},onEscapeKeyDown(o){o.preventDefault(),t({type:"TABLE.ESCAPE",src:"dismissable",focusVisible:!0})}})}},actions:{setNextView({context:e,prop:t}){const n=Ec(e.get("view"),t("minView"),t("maxView"));e.set("view",n)},setPreviousView({context:e,prop:t}){const n=Zm(e.get("view"),t("minView"),t("maxView"));e.set("view",n)},setView({context:e,event:t}){e.set("view",t.view)},setRestoreFocus({context:e}){e.set("restoreFocus",!0)},announceValueText({context:e,prop:t,refs:n}){const s=e.get("value"),r=t("locale"),o=t("timeZone");let i;if(t("selectionMode")==="range"){const[a,d]=s;a&&d?i=Es(a,d,r,o):a?i=Es(a,null,r,o):d?i=Es(d,null,r,o):i=""}else i=s.map(a=>Es(a,null,r,o)).filter(Boolean).join(",");n.get("announcer")?.announce(i,3e3)},announceVisibleRange({computed:e,refs:t}){const{formatted:n}=e("visibleRangeText");t.get("announcer")?.announce(n)},disableTextSelection({scope:e}){nf({target:Zt(e),doc:e.getDoc()})},enableTextSelection({scope:e}){rl({doc:e.getDoc(),target:Zt(e)})},focusFirstSelectedDate(e){const{context:t}=e;t.get("value").length&&te(e,t.get("value")[0])},syncInputElement({scope:e,computed:t}){fe(()=>{Bn(e).forEach((s,r)=>{cs(s,t("valueAsString")[r]||"")})})},setFocusedDate(e){const{event:t}=e,n=Array.isArray(t.value)?t.value[0]:t.value;te(e,n)},setFocusedValueForView(e){const{context:t,event:n}=e;te(e,t.get("focusedValue").set({[t.get("view")]:n.value}))},focusNextMonth(e){const{context:t}=e;te(e,t.get("focusedValue").add({months:1}))},focusPreviousMonth(e){const{context:t}=e;te(e,t.get("focusedValue").subtract({months:1}))},setDateValue({context:e,event:t,prop:n}){if(!Array.isArray(t.value))return;const s=t.value.map(r=>Te(r,n("min"),n("max")));e.set("value",s)},clearDateValue({context:e}){e.set("value",[])},setSelectedDate(e){const{context:t,event:n}=e,s=Array.from(t.get("value")),r=t.get("activeIndex"),o=s[r],i=Wn(e,n.value??t.get("focusedValue"));s[r]=$s(o,i),t.set("value",Ps(s))},resetSelection(e){const{context:t,event:n}=e,s=t.get("value")[0],r=Wn(e,n.value??t.get("focusedValue"));t.set("value",[$s(s,r)])},toggleSelectedDate(e){const{context:t,event:n}=e,s=Wn(e,n.value??t.get("focusedValue")),r=t.get("value"),o=r.findIndex(i=>Et(i,s));if(o===-1){const i=[...r,s];t.set("value",Ss(i))}else{const i=Array.from(r);i.splice(o,1),t.set("value",Ss(i))}},setHoveredDate({context:e,event:t}){e.set("hoveredValue",t.value)},clearHoveredDate({context:e}){e.set("hoveredValue",null)},selectFocusedDate({context:e,computed:t}){const n=Array.from(e.get("value")),s=e.get("activeIndex"),r=n[s],o=e.get("focusedValue").copy();n[s]=$s(r,o),e.set("value",Ps(n));const i=t("valueAsString");e.set("inputValue",i[s])},focusPreviousDay(e){const{context:t}=e,n=t.get("focusedValue").subtract({days:1});te(e,n)},focusNextDay(e){const{context:t}=e,n=t.get("focusedValue").add({days:1});te(e,n)},focusPreviousWeek(e){const{context:t}=e,n=t.get("focusedValue").subtract({weeks:1});te(e,n)},focusNextWeek(e){const{context:t}=e,n=t.get("focusedValue").add({weeks:1});te(e,n)},focusNextPage(e){const{context:t,computed:n,prop:s}=e,r=uc(t.get("focusedValue"),t.get("startValue"),n("visibleDuration"),s("locale"),s("min"),s("max"));Is(e,r)},focusPreviousPage(e){const{context:t,computed:n,prop:s}=e,r=fc(t.get("focusedValue"),t.get("startValue"),n("visibleDuration"),s("locale"),s("min"),s("max"));Is(e,r)},focusSectionStart(e){const{context:t}=e;te(e,t.get("startValue").copy())},focusSectionEnd(e){const{computed:t}=e;te(e,t("endValue").copy())},focusNextSection(e){const{context:t,event:n,computed:s,prop:r}=e,o=Tm(t.get("focusedValue"),t.get("startValue"),n.larger,s("visibleDuration"),r("locale"),r("min"),r("max"));o&&Is(e,o)},focusPreviousSection(e){const{context:t,event:n,computed:s,prop:r}=e,o=Cm(t.get("focusedValue"),t.get("startValue"),n.larger,s("visibleDuration"),r("locale"),r("min"),r("max"));o&&Is(e,o)},focusNextYear(e){const{context:t}=e,n=t.get("focusedValue").add({years:1});te(e,n)},focusPreviousYear(e){const{context:t}=e,n=t.get("focusedValue").subtract({years:1});te(e,n)},focusNextDecade(e){const{context:t}=e,n=t.get("focusedValue").add({years:10});te(e,n)},focusPreviousDecade(e){const{context:t}=e,n=t.get("focusedValue").subtract({years:10});te(e,n)},clearFocusedDate(e){const{context:t,prop:n}=e,s=t.get("focusedValue").calendar;te(e,qn(n("timeZone"),s))},focusPreviousMonthColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").subtract({months:n.columns});te(e,s)},focusNextMonthColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").add({months:n.columns});te(e,s)},focusPreviousYearColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").subtract({years:n.columns});te(e,s)},focusNextYearColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").add({years:n.columns});te(e,s)},focusFirstMonth(e){const{context:t}=e,n=t.get("focusedValue"),s=n.calendar.getMinimumMonthInYear?.(n)??1;te(e,n.set({month:s}))},focusLastMonth(e){const{context:t}=e,n=t.get("focusedValue"),s=n.calendar.getMonthsInYear(n);te(e,n.set({month:s}))},focusFirstYear(e){const{context:t}=e,n=tn(t.get("focusedValue").year),s=t.get("focusedValue").set({year:n[0]});te(e,s)},focusLastYear(e){const{context:t}=e,n=tn(t.get("focusedValue").year),s=t.get("focusedValue").set({year:n[n.length-1]});te(e,s)},setActiveIndex({context:e,event:t}){e.set("activeIndex",t.index)},setActiveIndexToEnd({context:e}){e.set("activeIndex",1)},setActiveIndexToStart({context:e}){e.set("activeIndex",0)},resumeRangeSelection({context:e,prop:t}){t("selectionMode")==="range"&&e.get("value").length===1&&e.set("activeIndex",1)},focusActiveCell({scope:e,context:t,event:n}){n.src!=="input.click"&&fe(()=>{const s=t.get("view");Ia(e,s)?.focus({preventScroll:!0})})},focusActiveCellIfNeeded({scope:e,context:t,event:n}){n.focus&&fe(()=>{const s=t.get("view");Ia(e,s)?.focus({preventScroll:!0})})},setHoveredValueIfKeyboard({context:e,event:t,prop:n}){!(t.type.startsWith("TABLE.ARROW")||["TABLE.ENTER","TABLE.HOME","TABLE.END","TABLE.PAGE_UP","TABLE.PAGE_DOWN"].includes(t.type))||n("selectionMode")!=="range"||e.get("activeIndex")===0||e.set("hoveredValue",e.get("focusedValue").copy())},restoreFocusToTrigger({scope:e,event:t}){const n=Zt(e),s=lv(t);fe(()=>{$i(e.getActiveElement(),[n])||Rs(e)?.focus(s)})},focusFirstInputElement({scope:e,event:t}){t.focus!==!1&&fe(()=>{const[n]=Bn(e);(n??Rs(e))?.focus({preventScroll:!0})})},focusInputElement({scope:e}){fe(()=>Ca(e))},restoreFocusToInput({scope:e}){const t=Zt(e);fe(()=>{$i(e.getActiveElement(),[t])||Ca(e)})},syncMonthSelectElement({scope:e,context:t}){const n=Um(e);cs(n,t.get("startValue").month.toString())},syncYearSelectElement({scope:e,context:t}){const n=jm(e);cs(n,t.get("startValue").year.toString())},setInputValue({context:e,event:t}){e.get("activeIndex")===t.index&&e.set("inputValue",t.value)},syncInputValue({scope:e,context:t,event:n}){queueMicrotask(()=>{const s=Bn(e),r=n.index??t.get("activeIndex");cs(s[r],t.get("inputValue"))})},focusParsedDate(e){const{event:t,prop:n}=e;if(t.index==null)return;const r=n("parse")(t.value,{locale:n("locale"),timeZone:n("timeZone")});!r||!ka(r)||te(e,r)},selectParsedDate({context:e,event:t,prop:n}){if(t.index==null)return;let r=n("parse")(t.value,{locale:n("locale"),timeZone:n("timeZone")});if((!r||!ka(r))&&t.value&&(r=e.get("focusedValue").copy()),!r)return;r=Te(r,n("min"),n("max"));const o=Array.from(e.get("value"));o[t.index]=$s(o[t.index],r);const i=Ps(o);e.set("value",i);const a=xs(i,n);e.set("inputValue",a[t.index])},resetView({context:e}){e.set("view",e.initial("view"))},setStartValue({context:e,computed:t,prop:n}){const s=e.get("focusedValue");if(!He(s,e.get("startValue"),t("endValue")))return;const o=ma(s,"start",{months:n("numOfMonths")},n("locale"));e.set("startValue",o)},invokeOnOpen({prop:e,context:t}){e("inline")||e("onOpenChange")?.({open:!0,value:t.get("value")})},invokeOnClose({prop:e,context:t}){e("inline")||e("onOpenChange")?.({open:!1,value:t.get("value")})},invokeOnVisibleRangeChange({prop:e,context:t,computed:n}){e("onVisibleRangeChange")?.({view:t.get("view"),visibleRange:n("visibleRange")})},toggleVisibility({event:e,send:t,prop:n}){t({type:n("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:e})}}}}),Wn=(e,t)=>{const{context:n,prop:s}=e,r=n.get("view");let o=typeof t=="number"?n.get("focusedValue").set({[r]:t}):t;return Xm(i=>{zm(i,s("minView"))&&(o=o.set({[i]:i==="day"?1:0}))}),o},$s=(e,t)=>{if(!e||!("hour"in e))return t;const n="timeZone"in e;let s=t;return"hour"in t||(n?s=Zl(Ae(t),e.timeZone):s=Ae(t)),s.set({hour:e.hour,minute:e.minute,second:e.second,millisecond:e.millisecond})};function te(e,t){const{context:n,prop:s,computed:r}=e;if(!t)return;const o=Wn(e,t);if(Et(n.get("focusedValue"),o))return;const a=es(r("visibleDuration"),s("locale"),s("min"),s("max"))({focusedDate:o,startDate:n.get("startValue")});n.set("startValue",a.startDate),n.set("focusedValue",a.focusedDate)}function Is(e,t){const{context:n}=e;n.set("startValue",t.startDate);const s=n.get("focusedValue");Et(s,t.focusedDate)||n.set("focusedValue",t.focusedDate)}function lv(e){return e.focusVisible??e.previousEvent?.focusVisible?{preventScroll:!0,focusVisible:!0}:{preventScroll:!0}}function Sc(e){return Array.isArray(e)?e.map(t=>Sc(t)):e instanceof Date?new Pe(e.getFullYear(),e.getMonth()+1,e.getDate()):sm(e)}const Gr=e=>`<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="${e==="left"?"m10 4-4 4 4 4":"m6 4 4 4-4 4"}"/></svg>`,Yr=e=>{try{return/^\d{4}-\d{2}-\d{2}$/.test(e)?Sc(e):void 0}catch{return}};function cv(e,t,n){e.innerHTML=`<div class="date-control"><button class="icon-button date-trigger" type="button" aria-label="Custom date range" title="Custom date range"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><rect x="3" y="5" width="18" height="16" rx="3"/><path d="M7 3v4m10-4v4M3 11h18m-12 5h4"/></svg></button></div>
|
|
94
|
+
<div class="date-positioner" popover="manual"><section class="date-popover">
|
|
95
|
+
<header class="date-heading"><div><span class="eyebrow">FOCUS YOUR TIMELINE</span><h2>Date range</h2></div><button type="button" class="icon-button date-close" aria-label="Close date range">×</button></header>
|
|
96
|
+
<div class="date-fields"><label>From<input id="from-date" aria-label="From date" autocomplete="off" spellcheck="false" placeholder="YYYY-MM-DD"/></label><span aria-hidden="true">→</span><label>To<input id="to-date" aria-label="To date" autocomplete="off" spellcheck="false" placeholder="YYYY-MM-DD"/></label></div>
|
|
97
|
+
<div class="date-presets"><button type="button" data-preset="last7Days">Last 7 days</button><button type="button" data-preset="last30Days">Last 30 days</button><button type="button" data-preset="thisMonth">This month</button></div>
|
|
98
|
+
<div class="date-calendar"><div class="date-navigation"><button type="button" class="icon-button date-prev">${Gr("left")}</button><button type="button" class="date-view"></button><button type="button" class="icon-button date-next">${Gr("right")}</button></div><div class="date-grids"></div></div>
|
|
99
|
+
<footer class="date-footer"><span class="date-status" role="status"></span><button id="apply-dates" class="primary-button" type="button">Apply range ${Gr("right")}</button></footer>
|
|
100
|
+
</section></div>`;const s=c=>e.querySelector(c),r=s(".date-trigger"),o=s(".date-positioner"),i=s(".date-popover"),a=[s("#from-date"),s("#to-date")],d=s("#apply-dates"),l=new Dl(av,{id:"timeline-dates",selectionMode:"range",closeOnSelect:!1,fixedWeeks:!0,outsideDaySelectable:!0,locale:navigator.language,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,format:c=>c.toString(),parse:Yr,placeholder:"YYYY-MM-DD",positioning:{placement:"top-end",strategy:"fixed",gutter:12,slide:!0},onOpenChange({open:c}){c&&n()}}),f=()=>ev(l.service,Ll),u=["day","month","year"].map(c=>{const g=document.createElement("table");g.dataset.calendarView=c;const b=g.createTHead(),w=b.insertRow();if(c==="day")for(let $=0;$<7;$++)w.append(document.createElement("th"));const A=g.createTBody(),D=c==="day"?6:4,M=c==="day"?7:3;for(let $=0;$<D;$++){const v=A.insertRow();for(let S=0;S<M;S++){const T=document.createElement("button");T.type="button",v.insertCell().append(T)}}return s(".date-grids").append(g),{view:c,table:g,head:b,body:A}});function h(){const c=a.map(w=>Yr(w.value)),g=!!(c[0]&&c[1]&&c[0].compare(c[1])<=0);d.disabled=!g;for(const[w,A]of a.entries())A.setAttribute("aria-invalid",String(!!A.value&&!c[w]));const b=g?"Both dates included":"Choose a start and end date";s(".date-status").textContent!==b&&(s(".date-status").textContent=b)}function p(){const c=f();ne(e,c.getRootProps()),ne(s(".date-control"),c.getControlProps()),ne(r,{...c.getTriggerProps(),"aria-label":"Custom date range"}),ne(o,c.getPositionerProps()),ne(i,{...c.getContentProps(),"aria-label":"Custom date range"}),a.forEach((w,A)=>ne(w,{...c.getInputProps({index:A}),"aria-label":A?"To date":"From date"})),ne(s(".date-prev"),c.getPrevTriggerProps({view:c.view})),ne(s(".date-next"),c.getNextTriggerProps({view:c.view}));const g=c.view==="day"?c.visibleRangeText.start:c.view==="month"?String(c.visibleRange.start.year):`${c.getDecade().start} – ${c.getDecade().end}`,b=s(".date-view");ne(b,c.getViewTriggerProps({view:c.view})),b.textContent!==g&&(b.textContent=g);for(const{view:w,table:A,head:D,body:M}of u){A.hidden=c.view!==w,ne(A,c.getTableProps({view:w,columns:w==="day"?7:3})),ne(D,c.getTableHeaderProps({view:w})),ne(M,c.getTableBodyProps({view:w})),w==="day"&&c.weekDays.forEach((v,S)=>{const T=D.rows[0].cells[S];T.scope="col",T.setAttribute("aria-label",v.long),T.textContent!==v.short&&(T.textContent=v.short)});const $=w==="day"?c.weeks:w==="month"?c.getMonthsGrid({columns:3,format:"short"}):c.getYearsGrid({columns:3});Array.from(M.rows).forEach((v,S)=>{ne(v,c.getTableRowProps({view:w})),Array.from(v.cells).forEach((T,L)=>{const E=$[S]?.[L],O=T.firstElementChild;if(T.hidden=!E,!!E)if(w==="day"){const R=c.weeks[S][L];ne(T,c.getDayTableCellProps({value:R})),ne(O,c.getDayTableCellTriggerProps({value:R})),O.textContent!==String(R.day)&&(O.textContent=String(R.day))}else{const R=E;ne(T,w==="month"?c.getMonthTableCellProps({...R,columns:3}):c.getYearTableCellProps({...R,columns:3})),ne(O,w==="month"?c.getMonthTableCellTriggerProps({...R}):c.getYearTableCellTriggerProps({...R})),O.textContent!==R.label&&(O.textContent=R.label)}})})}o.hidden=!c.open,c.open&&!o.matches(":popover-open")&&o.showPopover?.(),!c.open&&o.matches(":popover-open")&&o.hidePopover?.(),r.classList.toggle("active",c.open),h()}s(".date-close").addEventListener("click",()=>f().setOpen(!1));for(const c of e.querySelectorAll("[data-preset]"))c.addEventListener("click",()=>{const g=f(),b=g.getRangePresetValue(c.dataset.preset);g.setValue(b),g.setFocusedValue(b[0]),g.setView("day")});d.addEventListener("click",()=>{h(),d.disabled||(t(a[0].value,a[1].value),f().setOpen(!1))}),i.addEventListener("input",h),e.addEventListener("keydown",c=>c.stopPropagation());const m=l.subscribe(p);return l.start(),p(),{setRange(c,g){const b=[c,g].map(Yr).filter(w=>w!==void 0);f().setValue(b),b[0]&&f().setFocusedValue(b[0])},dispose(){m(),l.stop(),e.replaceChildren()}}}const dv={Search:ud,GitFork:Qc,GitBranch:Xc,Folder:Jc,ArrowUpRight:Wc,ArrowRight:Bc,X:md,Box:jc,RotateCcw:dd,RefreshCw:cd,Play:ld,Pause:ad,ChevronDown:Uc,FileCode2:Zc,Terminal:pd,Copy:Yc,Crosshair:Kc,CircleHelp:qc,SlidersHorizontal:hd,LoaderCircle:td,Network:sd,Clock:Gc,Sparkles:Ra,Grip:ed,PanelRight:od,Settings2:fd,Volume2:Pa,VolumeX:gd},Le=()=>{vd({icons:dv,attrs:{"stroke-width":1.5}}),ln()},F=(e,t="")=>`<i data-lucide="${e}" class="${t}" aria-hidden="true"></i>`,k=e=>document.querySelector(e),G=e=>e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]),uv=e=>Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}).format(e),Be=e=>e.toLocaleString("en"),fv=[new Intl.DateTimeFormat("en",{month:"short",day:"numeric"}),new Intl.DateTimeFormat("en",{month:"short",day:"numeric",year:"numeric"})],hv=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}),pv=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit"}),un=(e,t=!1)=>fv[Number(t)].format(e),fn=e=>hv.format(e),Aa=e=>{const t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`};let X,ae={nodes:[],edges:[],lanes:[],start:0,end:0},De=[],Qo=[],xc=new Set,Vs=new Map,Zn=new Map,$c=new Map,ee,Ic=!0,Ts,W=new URLSearchParams(location.search).get("session"),Ee,Re,Ns=0,pt="",it="",We="",at=90,lt="",ct="",hn=!0,pn=!0,nn=60,Fs=0,So,xo,ei=0,gn=!1,me=1,$o=0;const gv=3e4;let q={...dr},Bt=!0,gr,dt,Jn=!1,Io="";try{q=Rl(localStorage)}catch{Bt=!1}const Js=matchMedia("(prefers-reduced-motion: reduce)");k("#app").innerHTML=`
|
|
101
|
+
<main class="map" aria-label="Session map">
|
|
102
|
+
<h1 class="sr-only">SessionGraph — Explore & visualize all your LLM sessions</h1>
|
|
103
|
+
<div id="scene"></div>
|
|
104
|
+
<div class="canvas-vignette"></div>
|
|
105
|
+
<div id="graph-message" class="graph-message"><div class="loading-orbit"><span></span><span></span><span></span></div><h3>Loading sessions…</h3></div>
|
|
106
|
+
<div id="tooltip" class="node-tooltip" hidden></div>
|
|
107
|
+
</main>
|
|
108
|
+
<header class="app-header glass">
|
|
109
|
+
<a class="brand" href="/" aria-label="SessionGraph home" title="Explore & visualize all your LLM sessions"><img src="/favicon.svg" alt=""/><span>SessionGraph<span class="brand-dot">.</span></span></a>
|
|
110
|
+
<span class="connection" role="status" title="Connecting"><span class="status-dot"></span><span id="connection-label" class="sr-only">Connecting</span></span>
|
|
111
|
+
<span class="toolbar-divider"></span>
|
|
112
|
+
<button class="toolbar-button" id="toggle-explorer" aria-label="Toggle sessions" aria-controls="explorer" aria-expanded="true" title="Sessions">${F("search")}<span>Sessions</span></button>
|
|
113
|
+
</header>
|
|
114
|
+
<nav class="map-controls glass" aria-label="Map controls">
|
|
115
|
+
<div class="view-switch" role="group" aria-label="View mode"><button id="view-3d" class="active" aria-pressed="true">3D</button><button id="view-2d" aria-pressed="false">2D</button></div>
|
|
116
|
+
<span class="toolbar-divider"></span>
|
|
117
|
+
<button class="icon-button" id="reset-camera" aria-label="Fit view" title="Fit view (F)">${F("crosshair")}</button>
|
|
118
|
+
<button class="icon-button" id="toggle-timeline" aria-label="Toggle timeline" aria-controls="timeline" aria-expanded="true" title="Timeline">${F("clock")}</button>
|
|
119
|
+
<button class="icon-button" id="toggle-inspector" aria-label="Toggle session details" aria-controls="inspector" aria-expanded="false" title="Session details" hidden>${F("panel-right")}</button>
|
|
120
|
+
<button class="icon-button" id="help" aria-label="Help" title="Help">${F("circle-help")}</button>
|
|
121
|
+
<button class="icon-button" id="mute-audio" aria-label="Mute sound" title="Mute sound" aria-pressed="false" data-sound="none">${F("volume-2")}</button>
|
|
122
|
+
<button class="icon-button" id="open-settings" aria-label="Settings" title="Settings" aria-haspopup="dialog">${F("settings-2")}</button>
|
|
123
|
+
</nav>
|
|
124
|
+
<aside class="sidebar floating-panel glass" id="explorer" aria-label="Sessions">
|
|
125
|
+
<div class="panel-heading"><button class="panel-handle" data-drag-panel="explorer" aria-label="Move sessions panel" title="Drag to move · Arrow keys to reposition">${F("grip")}<span>Sessions</span><span class="small-badge" id="list-count">—</span></button><button class="icon-button" id="refresh" aria-label="Refresh sessions" title="Refresh sessions">${F("refresh-cw")}</button><button class="icon-button" id="close-explorer" aria-label="Close sessions">${F("x")}</button></div>
|
|
126
|
+
<button class="search-box search-trigger" id="search" aria-label="Search all sessions">${F("search")}<span>Search everything…</span><kbd>/</kbd></button>
|
|
127
|
+
<div class="filters">
|
|
128
|
+
<div class="filter-row"><div class="select-wrap"><span id="source-filter-icon">${Ue()}</span><select id="source" aria-label="Session source"><option value="">All sources</option></select>${F("chevron-down")}</div><button class="icon-button" id="manage-sources" aria-label="Manage sources" title="Import sources">${F("sliders-horizontal")}</button></div>
|
|
129
|
+
<div class="select-wrap">${F("folder")}<select id="project" aria-label="Project"><option value="">All projects</option></select>${F("chevron-down")}</div>
|
|
130
|
+
<div class="select-wrap">${F("git-branch")}<select id="directory" aria-label="Worktree or directory"><option value="">All directories</option></select>${F("chevron-down")}</div>
|
|
131
|
+
<div class="filter-toggles"><label><input type="checkbox" id="children" checked/><span>Child sessions</span></label><label><input type="checkbox" id="archived" checked/><span>Archived</span></label></div>
|
|
132
|
+
</div>
|
|
133
|
+
<nav class="session-list" id="session-list" aria-label="Sessions"><div class="list-loading">${[0,1,2,3,4].map(()=>'<div class="skeleton"></div>').join("")}</div></nav>
|
|
134
|
+
</aside>
|
|
135
|
+
<div class="inspector-stack floating-panel" id="inspector" hidden><aside class="inspector glass" id="session-inspector" aria-label="Session details"></aside></div>
|
|
136
|
+
<section class="timeline-panel floating-panel glass" id="timeline" aria-label="Timeline controls">
|
|
137
|
+
<div class="timeline-top"><button class="panel-handle" data-drag-panel="timeline" aria-label="Move timeline panel" title="Drag to move · Arrow keys to reposition">${F("grip")}<span id="date-label">Timeline</span></button><div class="range-buttons" role="group" aria-label="Date range"><button data-days="7">7D</button><button data-days="30">30D</button><button data-days="90" class="active">90D</button><button data-days="0">All</button></div><div class="custom-dates"></div><button class="icon-button" id="close-timeline" aria-label="Close timeline">${F("x")}</button></div>
|
|
138
|
+
<div class="timeline-track"><button id="play" class="play-button" aria-label="Play timeline">${F("play")}</button><div class="histogram-wrap"><div id="histogram" class="histogram"></div><input id="scrubber" type="range" min="0" max="1000" value="1000" aria-label="Timeline playback position"/><div class="timeline-cursor" id="timeline-cursor"></div></div><div class="playback-date" id="playback-date">—</div></div>
|
|
139
|
+
</section>
|
|
140
|
+
<dialog id="help-dialog" aria-labelledby="help-title"><button class="icon-button dialog-close" id="close-help" aria-label="Close help">${F("x")}</button><h2 id="help-title">Explore the map</h2><div class="help-rows"><div><span>Orbit</span><kbd>Drag</kbd></div><div><span>Zoom</span><kbd>Scroll / pinch</kbd></div><div><span>Pan</span><kbd>Right-drag</kbd></div><div><span>Fit view</span><kbd>F</kbd></div><div><span>Search everything</span><kbd>/ · ⌘/Ctrl K</kbd></div><div><span>Hide / restore panels</span><kbd>H</kbd></div><div><span>Clear selection</span><kbd>Esc</kbd></div></div>
|
|
141
|
+
<div class="graph-legend"><span><i class="legend-node"></i>Latest message</span><span><i class="legend-node message"></i>Message / event</span><span><i class="legend-line lane"></i>Session lifetime</span><span><i class="legend-line fork"></i>Fork</span><span><i class="legend-line child"></i>Child</span><span id="file-legend" hidden><i class="legend-file"></i>File</span></div>
|
|
142
|
+
<p>Time runs left to right. A session's trail begins at creation and ends at its latest saved message. Select it to reveal clickable messages, tools, and events. Untimed items remain available in the event explorer. Directory colors group sessions; only fork and child links represent ancestry.</p><button class="secondary-button motion-button" id="motion" aria-pressed="true">${F("sparkles")}Animate map</button></dialog>
|
|
143
|
+
<div id="toast" class="toast" role="status" hidden></div>
|
|
144
|
+
<aside class="shortcut-hints" aria-label="Keyboard shortcuts"><span><kbd>/</kbd>Search</span><span><kbd>F</kbd>Fit view</span><span><kbd>H</kbd>Panels</span><span><kbd>Esc</kbd>Clear selection</span></aside>
|
|
145
|
+
`;Le();bd();Cg();rg();const Tc=cv(k(".custom-dates"),(e,t)=>{lt=e,ct=t,vt(!0)},ve),bn=()=>{const e=!!document.querySelector("dialog[open]");e&&gn&&ve(),ee?.setSuspended(e)},ti=new bg,Vt=yg(k("#tooltip"),k("#scene"),ti),mr=vg(k("#inspector"),ti,{select:e=>{Vt.clear(),ee?.selectEvent(e?.id||null),e&&(ve(),me=1,wn(),ee?.focusEvent(e))}});function ni(e){const t=X?.sessions.find(n=>n.id===W);t&&(Vt.clear(),ve(),ke("inspector",!0),mr.open(t,e,e?Re?.revision:void 0))}const ts=pg({change:vr,visibility:bn,previewSound:()=>{Xs.play("select")},getSources:()=>gt.sources(),importSources:e=>gt.select(e),resetPanels:()=>{document.querySelectorAll(".floating-panel").forEach(e=>{e.removeAttribute("style"),delete e.dataset.positioned})}}),Xs=new gg(q,ts.audioStatus);function ns(){ee?.applyPreferences(q),Xs.configure(q),document.documentElement.dataset.density=q.density,document.documentElement.dataset.motion=String(mo(q,Js.matches)),document.documentElement.style.setProperty("--panel-opacity",`${q.panelOpacity}%`),k("#motion").setAttribute("aria-pressed",String(mo(q,Js.matches)));for(const t of["2d","3d"]){const n=k(`#view-${t}`);n.classList.toggle("active",q.view===t),n.setAttribute("aria-pressed",String(q.view===t))}const e=k("#mute-audio");e.setAttribute("aria-pressed",String(q.muted)),e.setAttribute("aria-label",q.muted?"Unmute sound":"Mute sound"),e.title=q.muted?"Unmute sound":"Mute sound",e.innerHTML=F(q.muted?"volume-x":"volume-2"),ts.render(q,Bt||Jn,dt?.state||"saved"),Le()}function vr(e){const t=e.autoImport!==void 0&&e.autoImport!==q.autoImport;q=ur({...q,...e});try{Bt=Pl(localStorage,q)}catch{Bt=!1}ns(),si({preferences:{...q},...t?{autoImport:q.autoImport}:{}})}function si(e){dt?.save(e)}function mv(){return{sourceID:it,projectID:pt,directory:We,days:at,fromDate:lt,toDate:ct,includeChildren:hn,includeArchived:pn}}k("#open-settings").addEventListener("click",ts.open);k("#mute-audio").addEventListener("click",()=>vr({muted:!q.muted}));const vv=()=>ns();Js.addEventListener("change",vv);const yv=e=>{if(e.key===jo)try{q={...Rl(localStorage),autoImport:q.autoImport},ns()}catch{}};window.addEventListener("storage",yv);ns();dt=new dg(async e=>{if(!(await fetch("/api/sessiongraph/settings",{method:"POST",headers:{"Content-Type":"application/json","X-SessionGraph-Action":"settings"},body:JSON.stringify(e),signal:AbortSignal.timeout(15e3),keepalive:!0})).ok)throw new Error("Could not save library settings.")},e=>{ts.render(q,Bt||Jn,e),e==="error"&&Wt("Changes applied, but could not save to the local library. Retrying when you return."),e==="saved"&&gr?.check()});const Cc=og(bn),gt=ig(e=>li(e),bn);gr=new cg({eligible:()=>q.autoImport&&!dt?.pending&&document.visibilityState==="visible"&&!!(X&&!X.onboarding&&X.sources?.some(e=>e.selected)),busy:()=>gt.busy||!!document.querySelector("dialog[open]"),refresh:()=>gt.refresh(!0)});const ri=new AbortController,ss=()=>{document.visibilityState==="visible"&&(dt?.state==="error"&&dt.flush(),gr?.check())};window.addEventListener("focus",ss,{signal:ri.signal});document.addEventListener("visibilitychange",ss,{signal:ri.signal});window.setInterval(ss,ag);k("#manage-sources").addEventListener("click",()=>{gt.open()});document.addEventListener("sessiongraph-import-status",e=>{const t=e.detail;gr?.activity(),ts.importStatus(t),k("#refresh").classList.toggle("spinning",t.running),k(".connection").title=t.running?`Importing ${je(t.source)} · ${t.imported} sessions saved`:t.failed?"Import unavailable · open Manage sources for details":"Local library · SQLite"},{signal:ri.signal});const oi=$d(En,bn,e=>{Cc.open(e)});k("#search").addEventListener("click",oi.open);function ke(e,t){const n=k(`#${e}`);n.hidden=!t,e==="timeline"&&!t&&gn&&ve(),k(`#toggle-${e}`).setAttribute("aria-expanded",String(t)),t&&innerWidth<760&&e!=="timeline"&&ke(e==="explorer"?"inspector":"explorer",!1)}ke("explorer",innerWidth>=760);let Kr=[];for(const e of["explorer","timeline","inspector"])k(`#toggle-${e}`).addEventListener("click",()=>ke(e,k(`#${e}`).hidden));k("#close-explorer").addEventListener("click",()=>{ke("explorer",!1),k("#toggle-explorer").focus()});k("#close-timeline").addEventListener("click",()=>{ve(),ke("timeline",!1),k("#toggle-timeline").focus()});function Wt(e){k("#toast").textContent=e,k("#toast").hidden=!1,window.setTimeout(()=>{k("#toast").hidden=!0},3500)}function ii(){ke("inspector",!1),mr.close(),Vt.clear(),k("#session-inspector").replaceChildren(),k("#toggle-inspector").hidden=!0}ii();async function bv(){try{const{TimelineScene:e}=await Oa(async()=>{const{TimelineScene:t}=await import("./scene-CjvdEe_z.js");return{TimelineScene:t}},__vite__mapDeps([0,1]));ee=new e(k("#scene"),{onSelect:t=>{Xs.play("select"),En(t)},onPlaybackInterrupt:ve,onEvent:t=>{Xs.play("select"),ni(t)},onEventHover:(t,n,s,r)=>{Ts=void 0,t&&W&&Re?Vt.show(t,W,Re.revision,n,s,r):Vt.clear()},onHover:(t,n,s)=>{const r=k("#tooltip");r.classList.contains("message-tooltip")&&(Vt.clear(),Ts=void 0),r.hidden!==!t&&(r.hidden=!t),t&&(Ts!==t.session&&(Ts=t.session,r.innerHTML=`<strong>${G(t.session.title)}</strong><span>${G(je(t.session.source))} · ${t.session.activity?.lastMessageAt?`Last message ${fn(t.session.activity.lastMessageAt)}`:"Message time unavailable"}<br>Started ${fn(t.session.created)}</span>`),r.style.left=`${Math.min(n+18,k("#scene").clientWidth-280)}px`,r.style.top=`${Math.max(8,Math.min(s-32,k("#scene").clientHeight-110))}px`)}}),ee.applyPreferences(q),X&&(ee.setGraph(ae,!0),W&&(ee.select(W),ee.focus(W)),Ee&&ee.setFiles(Ee.files),Re&&ee.setEvents(Re.items))}catch(e){console.error("[sessiongraph] Graphics initialization failed",e),Wt("3D requires WebGL. You can still browse sessions in the list.")}finally{Ic=!1,X&&kc()}}bv();k("#scene").addEventListener("scene-error",e=>Wt(e.detail));async function ai(e,t){const n=AbortSignal.timeout(18e4),s=await fetch(e,{signal:t?AbortSignal.any([t,n]):n}),r=await s.json();if(!s.ok)throw new Error(r.error||"Request failed.");return r}async function li(e=!1){const t=k("#refresh");t.disabled=!0,t.classList.add("spinning");try{const n=dt?.revision,s=await ai("/api/sessiongraph"),r=X,o=W?Vs.get(W):void 0;if(X=s,!dt?.pending&&n===dt?.revision){q={...ur(s.preferences||q),autoImport:s.autoImport!==!1};try{Bt=Pl(localStorage,q)}catch{Bt=!1}if(!Jn){const a=hg(s.viewState);({sourceID:it,projectID:pt,directory:We,days:at,fromDate:lt,toDate:ct,includeChildren:hn,includeArchived:pn}=a),k("#children").checked=hn,k("#archived").checked=pn,Io=JSON.stringify(a),s.preferences||si({preferences:{...q}})}ns()}if(Jn=!0,e&&r&&JSON.stringify(r.sessions)===JSON.stringify(s.sessions)&&JSON.stringify(r.projects)===JSON.stringify(s.projects))return;ti.clear(),Vs=new Map(X.sessions.map(a=>[a.id,a])),k("#source").innerHTML='<option value="">All sources</option>'+(X.sources||[]).map(a=>`<option value="${G(a.id)}">${G(a.name)} · ${a.sessions.toLocaleString()}</option>`).join(""),k("#source").value=it,k("#source-filter-icon").innerHTML=Ue(it),oi.setData(X),k("#connection-label").textContent="Local library",k(".connection").classList.add("connected"),k(".connection").title=`Connected · ${Be(X.sessions.length)} sessions`;const i=new Map;if(X.sessions.forEach(a=>i.set(a.projectID,(i.get(a.projectID)||0)+1)),k("#project").innerHTML='<option value="">All projects</option>'+[...X.projects].filter(a=>i.has(a.id)).sort((a,d)=>(i.get(d.id)||0)-(i.get(a.id)||0)).map(a=>`<option value="${G(a.id)}">${G(a.name)} · ${Be(i.get(a.id)||0)}</option>`).join(""),k("#project").value=pt,ci(),W&&!e){const a=X.sessions.find(d=>d.id===W);a&&a.created<Date.now()-at*864e5&&(at=0)}if(vt(!e,e),W&&!e)En(W);else if(W){const a=Vs.get(W);if(a&&JSON.stringify(o)!==JSON.stringify(a)){const d=k(".detail-scroll")?.scrollTop||0;Ee=void 0,Re=void 0,Dc(a,!1),k(".detail-scroll").scrollTop=d,yr(a.id),ui(a)}}else ii();!e&&X.warnings.length&&Wt(X.warnings.join(" ")),!e&&X.onboarding&>.open(!0)}catch(n){if(e&&X){k(".connection").title="Library refresh unavailable · retry with Refresh sessions";return}k("#connection-label").textContent="Connection unavailable",k(".connection").title="Connection unavailable",k(".connection").classList.remove("connected"),k("#graph-message").hidden=!1,k("#graph-message").innerHTML=`${F("terminal")}<h3>Local library unavailable</h3><p>${G(n instanceof Error?n.message:"Unable to connect.")}</p><button class="primary-button" id="retry">Retry ${F("arrow-right")}</button>`,k("#retry").addEventListener("click",()=>{li().then(ss)}),X||(k("#session-list").innerHTML='<p class="empty-list">Your sessions will appear here once connected.</p>',k("#list-count").textContent="Offline"),Le()}finally{t.disabled=!1,t.classList.remove("spinning")}}function ci(){const e=X?.sessions.filter(s=>!pt||s.projectID===pt)||[],t=[...new Set(e.map(s=>s.directory))].sort((s,r)=>jn(s).localeCompare(jn(r))),n=new Set(X?.projects.flatMap(s=>s.worktrees));k("#directory").innerHTML='<option value="">All directories</option>'+t.map(s=>`<option value="${G(s)}">${n.has(s)?"⑂ ":""}${G(jn(s))}</option>`).join(""),t.includes(We)||(We=""),k("#directory").value=We}function vt(e=!1,t=!1){if(!X)return;t||(ve(),me=1,nn=60);const n=k("#session-list").scrollTop,s=document.activeElement?.closest("[data-session]")?.dataset.session,r=Date.now(),o=lt?new Date(`${lt}T00:00:00`).getTime():at?r-at*864e5:0,i=ct?new Date(`${ct}T23:59:59.999`).getTime():1/0;De=X.sessions.filter(l=>(!it||l.source===it)&&(!pt||l.projectID===pt)&&(!We||l.directory===We)&&(hn||!l.parentID||!!l.forkID)&&(pn||!l.archived)&&l.created>=o&&l.created<=i),Qo=[...De].sort((l,f)=>sn(f)-sn(l)),xc=new Set(De.map(l=>l.id)),oi.setScope(De.map(l=>l.id)),ae=yd(De,X.projects),$c=new Map(ae.nodes.map(l=>[l.session.id,l.color])),ee?.setCutoff(me),ee?.setGraph(ae,e),kc(),document.querySelectorAll("[data-days]").forEach(l=>l.classList.toggle("active",!lt&&!ct&&Number(l.dataset.days)===at)),di(),t&&(k("#session-list").scrollTop=n,s&&Zn.get(s)?.focus({preventScroll:!0})),wv(),W&&!De.some(l=>l.id===W)?Mc():W&&Ee&&ee?.setFiles(Ee.files),W&&Re&&ee?.setEvents(Re.items),Le();const a=mv(),d=JSON.stringify(a);Jn&&d!==Io&&(Io=d,si({viewState:a}))}function kc(){const e=k("#graph-message");e.hidden=!!(De.length&&ee),De.length?ee||(e.innerHTML=Ic?"<h3>Preparing the map…</h3>":`${F("box")}<h3>WebGL is unavailable.</h3><p>You can explore every session and its file details in the list.</p>`):e.innerHTML=`${F("search")}<h3>No matching sessions</h3><button class="text-button" id="clear-filters">Reset filters ${F("rotate-ccw")}</button>`,k("#clear-filters")?.addEventListener("click",Ac),Le()}function Ac(){it="",k("#source").value="",k("#source-filter-icon").innerHTML=Ue(),pt="",We="",at=0,lt="",ct="",hn=!0,pn=!0,k("#project").value="",k("#children").checked=!0,k("#archived").checked=!0,Tc.setRange("",""),ci(),vt(!0)}function di(){k("#list-count").textContent=Be(De.length);const e=Qo;let t="";k("#session-list").innerHTML=e.slice(0,nn).map(n=>{const s=sn(n),r=un(s),o=r!==t?`<div class="list-date">${r}<span>${new Date(s).getFullYear()}</span></div>`:"";return t=r,`${o}<button class="session-card ${W===n.id?"selected":""}" data-session="${G(n.id)}" aria-pressed="${W===n.id}" title="${G(n.title)}"><span class="session-dot" style="--node-color:${$c.get(n.id)}"></span><span class="session-card-body"><span class="session-title">${G(n.title)}</span><span class="session-meta">${n.forkID?F("git-fork"):n.parentID?F("network"):""}<span class="source-badge" data-source="${G(n.source||"opencode")}">${Ue(n.source)}${G(je(n.source))}</span><span title="${n.activity?.lastMessageAt?"Latest saved message":"Session created; message time unavailable"}">${pv.format(s)}</span></span></span></button>`}).join("")+(e.length>nn?`<button id="more-sessions" class="load-more">Show more sessions ${F("chevron-down")}</button>`:e.length?"":'<p class="empty-list">No sessions match your filters.</p>'),k("#more-sessions")?.addEventListener("click",()=>{nn+=100;const n=k("#session-list").scrollTop;di(),k("#session-list").scrollTop=n,Le()}),Zn=new Map([...k("#session-list").querySelectorAll(".session-card")].map(n=>[n.dataset.session,n])),Le()}function Lc(e){for(const t of[e,W]){const n=t?Zn.get(t):void 0;n&&(n.classList.toggle("selected",t===W),n.setAttribute("aria-pressed",String(t===W)))}}function wv(){const e=new Array(70).fill(0),t=Math.max(1,ae.end-ae.start);for(const s of De)e[Math.min(69,Math.floor((sn(s)-ae.start)/t*70))]++;const n=Math.max(...e,1);k("#histogram").innerHTML=e.map(s=>`<span style="height:${Math.max(4,s/n*100)}%;opacity:${s?.8:.15}" title="${s} session endpoints"></span>`).join(""),k("#date-label").textContent=ae.start?`${un(ae.start)} — ${un(ae.end,!0)}`:"No sessions",ae.start&&Tc.setRange(lt||Aa(ae.start),ct||Aa(ae.end)),wn()}function wn(){k("#scrubber").value=String(Math.round(me*1e3)),k("#timeline-cursor").style.left=`${me*100}%`,k("#histogram").style.setProperty("--progress",`${me*100}%`),k("#playback-date").textContent=ae.start?un(ae.start+(ae.end-ae.start)*me):"—",ee?.setCutoff(me)}function ve(){gn=!1,ee?.setPlaying(!1),cancelAnimationFrame(ei),k("#play").innerHTML=F("play"),k("#play").setAttribute("aria-label","Play timeline"),Le()}function Oc(e){if(!gn)return;const t=Math.min(e-$o,100);$o=e,document.hidden||(me=Math.min(1,me+t*q.playbackSpeed/gv)),wn(),me>=1?ve():ei=requestAnimationFrame(Oc)}function Mc(){const e=W;So?.abort(),xo?.abort(),k("#file-legend").hidden=!0,Fs++,Ns++,W=null,Ee=void 0,Re=void 0,ee?.select(null),history.replaceState(null,"",location.pathname),ii(),Lc(e)}function Ev(e){const t=e.forkID?[{id:e.forkID,label:"Forked from",kind:"git-fork"}]:e.parentID?[{id:e.parentID,label:"Parent",kind:"network"}]:[],n=X.sessions.filter(r=>r.forkID===e.id||!r.forkID&&r.parentID===e.id),s=[...t,...n.map(r=>({id:r.id,label:r.forkID?"Fork":"Child",kind:r.forkID?"git-fork":"network"}))];return s.length?`<section class="detail-section"><div class="section-label">Connections<span>${s.length}</span></div>${s.map(r=>{const o=X.sessions.find(i=>i.id===r.id);return`<button class="relation" data-related="${G(r.id)}" ${o?"":"disabled"}>${F(r.kind)}<span><small>${r.label}</small><strong>${G(o?.title||"Session no longer available")}</strong></span>${F("arrow-up-right")}</button>`}).join("")}</section>`:""}function Dc(e,t=!0){const n=X.projects.find(o=>o.id===e.projectID),s=e.forkID?"Fork":e.parentID?"Child session":"Session",r=n?.worktrees.includes(e.directory);k("#session-inspector").innerHTML=`
|
|
146
|
+
<div class="panel-heading"><button class="panel-handle" data-drag-panel="inspector" aria-label="Move session details panel" title="Drag to move · Arrow keys to reposition">${F("grip")}<span>${s}</span></button><button id="close-inspector" class="icon-button" aria-label="Close session details">${F("x")}</button></div>
|
|
147
|
+
<div class="detail-scroll">
|
|
148
|
+
<div class="detail-title"><span class="source-badge" data-source="${G(e.source||"opencode")}">${Ue(e.source)}${G(je(e.source))}</span><h2>${G(e.title)}</h2><span class="detail-date">${fn(e.created)}</span></div>
|
|
149
|
+
<div class="detail-actions"><button id="open-session" class="secondary-button">${F("arrow-up-right")}Open session</button><button id="focus-session" class="icon-button" title="Focus node" aria-label="Focus node">${F("crosshair")}</button><button id="copy-id" class="icon-button" title="Copy session ID" aria-label="Copy session ID">${F("copy")}</button></div>
|
|
150
|
+
<section id="message-detail" class="detail-section"></section>
|
|
151
|
+
<div id="file-detail"><section class="detail-section"><div class="section-label">Changed files</div><div class="detail-loading">${F("loader-circle","spinning")}Loading changes…</div></section></div>
|
|
152
|
+
${Ev(e)}
|
|
153
|
+
<details class="more-details detail-section"><summary>Session info ${F("chevron-down")}</summary><dl class="metadata"><div><dt>Project</dt><dd>${G(n?.name||"Unknown")}</dd></div><div><dt>Model</dt><dd>${G(e.model)}</dd></div><div><dt>Agent</dt><dd>${G(e.agent||"Unknown")}</dd></div><div><dt>Tokens incl. cache</dt><dd>${e.tokens===null?"Not recorded":uv(e.tokens)}</dd></div><div><dt>Recorded cost</dt><dd>${e.cost===null?"Not recorded":`$${e.cost.toFixed(2)}`}</dd></div><div><dt>Updated</dt><dd>${un(e.updated)}</dd></div><div><dt>Imported</dt><dd>${e.coverage?.importedAt?un(e.coverage.importedAt):"Pending"}</dd></div></dl><div class="directory-card"><span>${r?"Worktree":"Directory"}</span><code>${G(e.directory)}</code></div></details>
|
|
154
|
+
</div>
|
|
155
|
+
`,k("#toggle-inspector").hidden=!1,t&&ke("inspector",!0),k("#close-inspector").addEventListener("click",()=>{ke("inspector",!1),k("#toggle-inspector").focus()}),k("#focus-session").addEventListener("click",()=>{ve(),ee?.focus(e.id)}),k("#open-session").addEventListener("click",()=>{Cc.open(e)}),k("#copy-id").addEventListener("click",async()=>{try{await navigator.clipboard.writeText(e.nativeID||e.id),Wt("Session ID copied")}catch{Wt(e.nativeID||e.id)}}),Rc(e),Le()}function Rc(e,t){const n=t?.items.filter(r=>r.kind==="message"&&r.time===e.activity?.lastMessageAt).length||0,s=t?[`${Be(t.items.length-n)} of ${Be(t.total)} saved events plotted. Click a dot to explore.`,n?"The session sphere represents the latest message; read it in the explorer.":"",t.untimed?`${Be(t.untimed)} have no recorded timestamp; browse them in the explorer.`:"",t.outsideLifetime?`${Be(t.outsideLifetime)} fall outside this lifetime; available in the explorer.`:"",t.limited?"Map shows the latest 2,000 timed events. The explorer pages through all saved items.":"",t.partial?"Partial history.":"","Nearby items can overlap; use Previous / Next in the explorer."].filter(Boolean):["Loading message & event markers…"];k("#message-detail").innerHTML=`<div class="section-label">Session timeline</div><dl class="metadata">
|
|
156
|
+
<div><dt>Trail starts</dt><dd>${fn(e.created)}</dd></div>
|
|
157
|
+
<div><dt>Node · last message</dt><dd>${e.activity?.lastMessageAt?fn(e.activity.lastMessageAt):"Unknown · at session start"}</dd></div>
|
|
158
|
+
</dl><div class="event-key"><span style="--event-color:#fff"><i></i>Messages & events · hover to preview</span></div><p class="coverage-note">${s.map(G).join("<br>")}</p><button class="secondary-button explore-events">Explore messages & events ${F("arrow-right")}</button>${t?.note?`<details class="more-details history-coverage"><summary>History coverage ${F("chevron-down")}</summary><p class="coverage-note">${G(t.note)}</p></details>`:""}`,k(".explore-events").addEventListener("click",()=>ni()),Le()}async function ui(e){const t=++Ns;xo?.abort();const n=new AbortController;xo=n;try{const s=await ai(`/api/sessiongraph/session/${encodeURIComponent(e.id)}/event-markers`,n.signal);if(n.signal.aborted||t!==Ns||W!==e.id)return;Re=s,ee?.setEvents(s.items),Rc(e,s)}catch{if(n.signal.aborted||t!==Ns||W!==e.id)return;k("#message-detail").innerHTML='<div class="section-label">Session timeline</div><p class="coverage-note">Event timing unavailable.</p><button class="secondary-button explore-events">Explore messages & events</button><button class="load-more" id="retry-timeline">Retry event markers</button>',k(".explore-events").addEventListener("click",()=>ni()),k("#retry-timeline").addEventListener("click",()=>{ui(e)})}}function Sv(e,t){const n=new Map(e.files.map(r=>[r.path,{...r}]));for(const r of t.files){const o=n.get(r.path);n.set(r.path,{...r,steps:(o?.steps||0)+r.steps,source:o?.source==="snapshot"?"snapshot":r.source})}const s=new Map(e.tools.map(r=>[r.name,r.count]));return t.tools.forEach(r=>s.set(r.name,(s.get(r.name)||0)+r.count)),{...t,files:[...n.values()].sort((r,o)=>o.steps-r.steps||r.path.localeCompare(o.path)),tools:[...s].map(([r,o])=>({name:r,count:o})).sort((r,o)=>o.count-r.count),locations:[...e.locations,...t.locations],messagesScanned:e.messagesScanned+t.messagesScanned,snapshotSteps:e.snapshotSteps+t.snapshotSteps}}function La(e){const t=e.files;k("#file-legend").hidden=!t.length,k("#file-detail").innerHTML=`
|
|
159
|
+
<section class="detail-section"><div class="section-label">Changed files<span>${Be(t.length)}${e.partial?"+":""}</span></div>
|
|
160
|
+
${t.length?`<ul class="file-list">${t.map(n=>`<li title="${G(n.path)} · ${n.source}">${F("file-code-2")}<div><strong>${G(jn(n.path))}</strong>${n.path.includes("/")?`<span>${G(n.path.slice(0,n.path.lastIndexOf("/")))}</span>`:""}</div><small>${n.steps}×</small></li>`).join("")}</ul>`:'<div class="no-files"><p>No file changes found.</p></div>'}
|
|
161
|
+
<p class="coverage-note">${Be(e.messagesScanned)} messages · ${e.partial?"Partial history":"Imported history"}${e.snapshotSteps?"":"<br>No snapshots; recorded tool/file-change evidence only."}${t.length>80?"<br>80 files shown on the map.":""}</p>
|
|
162
|
+
${e.note?`<p class="coverage-note">${G(e.note)}</p>`:""}
|
|
163
|
+
${e.nextCursor?`<button id="load-earlier" class="load-more">Load earlier messages ${F("arrow-right")}</button>`:""}</section>
|
|
164
|
+
${e.locations.length?`<details class="more-details detail-section"><summary>Directory moves ${F("chevron-down")}</summary>${e.locations.map(n=>`<div class="location-entry"><span>${fn(n.time)}</span><code>${G(n.directory)}</code></div>`).join("")}</details>`:""}
|
|
165
|
+
${e.tools.length?`<details class="more-details detail-section"><summary>Tools used <span>${Be(e.tools.reduce((n,s)=>n+s.count,0))}</span>${F("chevron-down")}</summary><div class="tools-list">${e.tools.slice(0,12).map(n=>`<div><span>${G(n.name)}</span><strong>${n.count}</strong></div>`).join("")}</div></details>`:""}
|
|
166
|
+
`,k("#load-earlier")?.addEventListener("click",()=>yr(e.id,e.nextCursor||void 0)),ee?.setFiles(t),Le()}async function yr(e,t){const n=++Fs;So?.abort();const s=new AbortController;So=s;const r=k("#load-earlier");r&&(r.disabled=!0,r.textContent="Scanning earlier messages…");try{const o=await ai(`/api/sessiongraph/session/${encodeURIComponent(e)}${t?`?cursor=${encodeURIComponent(t)}`:""}`,s.signal);if(s.signal.aborted||n!==Fs||W!==e)return;Ee=t&&Ee?Sv(Ee,o):o,La(Ee)}catch(o){if(s.signal.aborted||n!==Fs||W!==e)return;Ee?(La(Ee),Wt("Could not load earlier history. Try again.")):(k("#file-detail").innerHTML=`<section class="detail-section"><div class="section-label">Changed files</div><p class="coverage-note">${G(o instanceof Error?o.message:"Details unavailable.")}</p><button class="load-more" id="retry-detail">Retry file details</button></section>`,k("#retry-detail").addEventListener("click",()=>yr(e)))}}function En(e){const t=Vs.get(e);if(!t)return;const n=W;mr.close(),Vt.clear(),xc.has(e)||Ac(),ve(),me=1,wn(),W=e,Ee=void 0,Re=void 0,k("#file-legend").hidden=!0,history.replaceState(null,"",`?session=${encodeURIComponent(e)}`),ee?.select(e),Dc(t),ee?.focus(e),Lc(n),yr(e),ui(t)}k("#session-list").addEventListener("click",e=>{const t=e.target.closest("[data-session]");t?.dataset.session&&En(t.dataset.session)});k("#inspector").addEventListener("click",e=>{const t=e.target.closest("[data-related]");t?.dataset.related&&En(t.dataset.related)});k("#project").addEventListener("change",e=>{pt=e.target.value,We="",ci(),vt(!0)});k("#source").addEventListener("change",e=>{it=e.target.value,k("#source-filter-icon").innerHTML=Ue(it),vt(!0)});k("#directory").addEventListener("change",e=>{We=e.target.value,vt(!0)});k("#children").addEventListener("change",e=>{hn=e.target.checked,vt()});k("#archived").addEventListener("change",e=>{pn=e.target.checked,vt()});document.querySelectorAll("[data-days]").forEach(e=>e.addEventListener("click",()=>{at=Number(e.dataset.days),lt="",ct="",vt(!0)}));k("#reset-camera").addEventListener("click",()=>{ve(),ee?.reset()});k("#refresh").addEventListener("click",()=>{X?.onboarding?gt.open(!0):gt.refresh()});k("#scrubber").addEventListener("input",e=>{ve(),me=Number(e.target.value)/1e3,wn()});k("#play").addEventListener("click",()=>{if(De.length){if(gn)return ve();me>=1&&(me=0),wn(),gn=!0,ee?.setPlaying(!0),$o=performance.now(),k("#play").innerHTML=F("pause"),k("#play").setAttribute("aria-label","Pause timeline"),Le(),ei=requestAnimationFrame(Oc)}});for(const e of[!1,!0])k(`#view-${e?"2d":"3d"}`).addEventListener("click",()=>vr({view:e?"2d":"3d"}));k("#motion").addEventListener("click",()=>vr({motion:mo(q,Js.matches)?"off":"on"}));k("#help").addEventListener("click",()=>{k("#help-dialog").showModal(),bn()});k("#help-dialog").addEventListener("close",bn);k("#close-help").addEventListener("click",()=>k("#help-dialog").close());document.addEventListener("keydown",e=>{if(!e.defaultPrevented&&!document.querySelector("dialog[open]")&&!mr.handleKey(e)){if(e.key==="Escape"){W?Mc():ke("explorer",!1);return}if(!(e.target.matches("input, select, textarea")||e.metaKey||e.ctrlKey||e.altKey)){if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key)&&!e.target.closest('[data-drag-panel], [contenteditable="true"]')){const t=e.target;if(t.matches("canvas, body, .session-card")||t.closest(".session-card")){const n=Qo,s=n.findIndex(i=>i.id===W),r=e.key==="ArrowLeft"||e.key==="ArrowUp"?-1:1,o=n[Math.max(0,Math.min(n.length-1,s+r))];o&&(e.preventDefault(),En(o.id),t.closest(".session-card")&&(Zn.has(o.id)||(nn=Math.min(n.length,nn+100),di()),Zn.get(o.id)?.focus({preventScroll:!0})));return}}if(e.key.toLowerCase()==="f"&&(ve(),ee?.reset()),e.key.toLowerCase()==="h"){const t=["explorer","timeline","inspector"].filter(n=>!k(`#${n}`).hidden);t.length?(Kr=t,t.forEach(n=>ke(n,!1))):(Kr.length?Kr:["explorer","timeline"]).forEach(n=>{(n!=="inspector"||W)&&ke(n,!0)})}}}});li().then(()=>{X?.importing?gt.resume():ss()});export{$v as C,dr as D,Zc as F,Iv as R,ud as S,pd as T,xv as a,Va as b,Da as c,Y as d,$n as h,Fl as i,mo as m,vi as t};
|