sessiongraph-app-darwin-arm64 1.0.5 → 1.0.7

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.
@@ -1,12 +1,12 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/scene-CEalI0mr.js","assets/three-D_1Qt16u.js","assets/share-BydK_UaB.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 td="modulepreload",nd=function(e){return"/"+e},Li={},No=function(t,n,s){let r=Promise.resolve();if(n&&n.length>0){let l=function(c){return Promise.all(c.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=l(n.map(c=>{if(c=nd(c),c in Li)return;Li[c]=!0;const f=c.endsWith(".css"),u=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const h=document.createElement("link");if(h.rel=f?"stylesheet":td,f||(h.as="script"),h.crossOrigin="",h.href=c,a&&h.setAttribute("nonce",a),document.head.appendChild(h),f)return new Promise((p,g)=>{h.addEventListener("load",p),h.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${c}`)))})}))}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 Ka=(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=Ka(...r);s.appendChild(o)}),s};var za=([e,t,n])=>Ka(e,t,n);const sd=e=>Array.from(e.attributes).reduce((t,n)=>(t[n.name]=n.value,t),{}),rd=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:"",od=e=>e.flatMap(rd).map(n=>n.trim()).filter(Boolean).filter((n,s,r)=>r.indexOf(n)===s).join(" "),id=e=>e.replace(/(\w)(\w*)(_|-|\s*)/g,(t,n,s)=>n.toUpperCase()+s.toLowerCase()),Oi=(e,{nameAttr:t,icons:n,attrs:s})=>{const r=e.getAttribute(t);if(r==null)return;const o=id(r),i=n[o];if(!i)return console.warn(`${e.outerHTML} icon name was not found in the provided icons object.`);const a=sd(e),[l,c,f]=i,u={...c,"data-lucide":r,...s,...a},h=od(["lucide",`lucide-${r}`,a,s]);h&&Object.assign(u,{class:h});const p=za([l,u,f]);return e.parentNode?.replaceChild(p,e)};const K={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 ad=["svg",K,[["path",{d:"M5 12h14"}],["path",{d:"m12 5 7 7-7 7"}]]];const cd=["svg",K,[["path",{d:"M7 7h10v10"}],["path",{d:"M7 17 17 7"}]]];const ld=["svg",K,[["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 dd=["svg",K,[["path",{d:"m6 9 6 6 6-6"}]]];const ud=["svg",K,[["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 fd=["svg",K,[["circle",{cx:"12",cy:"12",r:"10"}],["polyline",{points:"12 6 12 12 16 14"}]]];const hd=["svg",K,[["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 pd=["svg",K,[["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 gd=["svg",K,[["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 md=["svg",K,[["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 vd=["svg",K,[["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 yd=["svg",K,[["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 bd=["svg",K,[["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 wd=["svg",K,[["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 Ed=["svg",K,[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56"}]]];const xd=["svg",K,[["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",K,[["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 $d=["svg",K,[["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 Id=["svg",K,[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M15 3v18"}]]];const Td=["svg",K,[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M3 9h18"}],["path",{d:"M9 21V9"}]]];const Cd=["svg",K,[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1"}]]];const kd=["svg",K,[["polygon",{points:"6 3 20 12 6 21 6 3"}]]];const Ad=["svg",K,[["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 Ld=["svg",K,[["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 Od=["svg",K,[["circle",{cx:"11",cy:"11",r:"8"}],["path",{d:"m21 21-4.3-4.3"}]]];const Md=["svg",K,[["path",{d:"M20 7h-9"}],["path",{d:"M14 17H5"}],["circle",{cx:"17",cy:"17",r:"3"}],["circle",{cx:"7",cy:"7",r:"3"}]]];const Dd=["svg",K,[["circle",{cx:"18",cy:"5",r:"3"}],["circle",{cx:"6",cy:"12",r:"3"}],["circle",{cx:"18",cy:"19",r:"3"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49"}]]];const Rd=["svg",K,[["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 Za=["svg",K,[["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",K,[["polyline",{points:"4 17 10 11 4 5"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19"}]]];const Ja=["svg",K,[["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 Vd=["svg",K,[["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 Nd=["svg",K,[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]]];const Fd=({icons:e={},nameAttr:t="data-lucide",attrs:n={}}={})=>{if(!Object.values(e).length)throw new Error(`Please provide an icons object.
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/scene-BGmgWBAw.js","assets/three-D_1Qt16u.js","assets/share-CLYxMZI8.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 td="modulepreload",nd=function(e){return"/"+e},Li={},No=function(t,n,s){let r=Promise.resolve();if(n&&n.length>0){let l=function(c){return Promise.all(c.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=l(n.map(c=>{if(c=nd(c),c in Li)return;Li[c]=!0;const f=c.endsWith(".css"),u=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const h=document.createElement("link");if(h.rel=f?"stylesheet":td,f||(h.as="script"),h.crossOrigin="",h.href=c,a&&h.setAttribute("nonce",a),document.head.appendChild(h),f)return new Promise((p,g)=>{h.addEventListener("load",p),h.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${c}`)))})}))}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 Ka=(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=Ka(...r);s.appendChild(o)}),s};var za=([e,t,n])=>Ka(e,t,n);const sd=e=>Array.from(e.attributes).reduce((t,n)=>(t[n.name]=n.value,t),{}),rd=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:"",od=e=>e.flatMap(rd).map(n=>n.trim()).filter(Boolean).filter((n,s,r)=>r.indexOf(n)===s).join(" "),id=e=>e.replace(/(\w)(\w*)(_|-|\s*)/g,(t,n,s)=>n.toUpperCase()+s.toLowerCase()),Oi=(e,{nameAttr:t,icons:n,attrs:s})=>{const r=e.getAttribute(t);if(r==null)return;const o=id(r),i=n[o];if(!i)return console.warn(`${e.outerHTML} icon name was not found in the provided icons object.`);const a=sd(e),[l,c,f]=i,u={...c,"data-lucide":r,...s,...a},h=od(["lucide",`lucide-${r}`,a,s]);h&&Object.assign(u,{class:h});const p=za([l,u,f]);return e.parentNode?.replaceChild(p,e)};const K={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 ad=["svg",K,[["path",{d:"M5 12h14"}],["path",{d:"m12 5 7 7-7 7"}]]];const cd=["svg",K,[["path",{d:"M7 7h10v10"}],["path",{d:"M7 17 17 7"}]]];const ld=["svg",K,[["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 dd=["svg",K,[["path",{d:"m6 9 6 6 6-6"}]]];const ud=["svg",K,[["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 fd=["svg",K,[["circle",{cx:"12",cy:"12",r:"10"}],["polyline",{points:"12 6 12 12 16 14"}]]];const hd=["svg",K,[["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 pd=["svg",K,[["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 gd=["svg",K,[["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 md=["svg",K,[["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 vd=["svg",K,[["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 yd=["svg",K,[["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 bd=["svg",K,[["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 wd=["svg",K,[["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 Ed=["svg",K,[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56"}]]];const xd=["svg",K,[["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",K,[["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 $d=["svg",K,[["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 Id=["svg",K,[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M15 3v18"}]]];const Cd=["svg",K,[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M3 9h18"}],["path",{d:"M9 21V9"}]]];const Td=["svg",K,[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1"}]]];const kd=["svg",K,[["polygon",{points:"6 3 20 12 6 21 6 3"}]]];const Ad=["svg",K,[["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 Ld=["svg",K,[["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 Od=["svg",K,[["circle",{cx:"11",cy:"11",r:"8"}],["path",{d:"m21 21-4.3-4.3"}]]];const Md=["svg",K,[["path",{d:"M20 7h-9"}],["path",{d:"M14 17H5"}],["circle",{cx:"17",cy:"17",r:"3"}],["circle",{cx:"7",cy:"7",r:"3"}]]];const Dd=["svg",K,[["circle",{cx:"18",cy:"5",r:"3"}],["circle",{cx:"6",cy:"12",r:"3"}],["circle",{cx:"18",cy:"19",r:"3"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49"}]]];const Rd=["svg",K,[["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 Za=["svg",K,[["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",K,[["polyline",{points:"4 17 10 11 4 5"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19"}]]];const Ja=["svg",K,[["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 Vd=["svg",K,[["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 Nd=["svg",K,[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]]];const Fd=({icons:e={},nameAttr:t="data-lucide",attrs:n={}}={})=>{if(!Object.values(e).length)throw new Error(`Please provide an icons object.
3
3
  If you want to use all the icons you can import it like:
4
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=>Oi(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=>Oi(o,{nameAttr:"icon-name",icons:e,attrs:n})))}},Mi=["#b0e9d6","#8eaff4","#d7a1f1","#eac594","#8cdbdf","#e7a3b8","#a8ca91"];function In(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 Yn(e){return Us(e).split("/").at(-1)||"/"}const Us=e=>(/^(?:[a-z]:[\\/]|\\\\)/i.test(e)?e.replace(/\\/g,"/"):e).replace(/\/+$/,"")||(e.startsWith("/")?"/":""),Tn=e=>e.directory?JSON.stringify(["directory",Us(e.directory)]):JSON.stringify(["project",e.source||"opencode",e.projectID||e.id]),dn=e=>Math.max(e.created,e.activity?.lastMessageAt||e.created),ro=(e,t)=>{const n=t.timeFrame||t;return(e-n.start)/Math.max(1,n.end-n.start)*300-150},Zv=(e,t)=>ro(t.start+(t.end-t.start)*e,t),Fo=(e,t)=>[t,e.position[1],e.position[2]],Hd=(e,t)=>Fo(e,Math.max(e.startPosition[0],Math.min(t,e.position[0]))),Jv=(e,t,n,s=0,r=[1,0,0])=>{const o=Hd(e,t);return[o[0]+r[0]*(n+s),o[1]+r[1]*(n+s),o[2]+r[2]*(n+s)]},Xv=(e,t)=>[Fo(e,Math.max(e.startPosition[0],Math.min(t.startPosition[0],e.position[0]))),t.startPosition];function _d(e,t,n){if(!e.length)return{nodes:[],edges:[],lanes:[],start:0,end:0};const s=[...e].sort((w,M)=>w.created-M.created||w.id.localeCompare(M.id)),r=s[0].created,o=s.reduce((w,M)=>Math.max(w,dn(M)),r+36e5),i=n?.nodes.length?n.timeFrame||{start:n.start,end:n.end}:{start:r,end:o},a=new Map;for(const w of s){const M=Tn(w),O=a.get(M)||[];O.push(w),a.set(M,O)}const l=[...a].sort((w,M)=>M[1].length-w[1].length||w[0].localeCompare(M[0])),c=new Map(n?.lanes.map((w,M)=>[w.key,w.slot??M]));let f=Math.max(-1,...c.values())+1;for(const[w]of l)c.has(w)||c.set(w,f++);l.sort((w,M)=>c.get(w[0])-c.get(M[0]));const u=[],h=[],p=new Set(t.flatMap(w=>w.worktrees.map(Us)));l.forEach(([w,M])=>{const O=c.get(w),R=O*2.399963,E=O===0?0:15+Math.sqrt(O)*14,T=Math.cos(R)*E,x=Math.sin(R)*E*.7,C=Mi[O%Mi.length],b=t.find(V=>V.id===M[0].projectID),A=M[0].directory,D={key:w,slot:O,label:A?Yn(A):b?.name||M[0].projectID||"Unknown directory",color:C,kind:A&&p.has(Us(A))?"worktree":"directory",y:T,z:x,nodes:[]};for(const V of M){const H=ro(dn(V),i),z=ro(V.created,i),re=In(V.id),W=!!(V.parentID||V.forkID)?12:6,be=Math.sin((z+150)/65+O*.7)*3.5,Mt=typeof V.tokens=="number"&&Number.isFinite(V.tokens)?Math.max(0,V.tokens):0,$e={session:V,position:[H,T+be+(re-.5)*W,x+(In(V.id+"z")-.5)*W],startPosition:[z,0,0],color:C,radius:.35+Math.min(.9,Math.log10(1+Mt)*.11)};h.push($e),D.nodes.push($e)}u.push(D)});const g=new Set(s.map(w=>w.id)),d=[];for(const w of s)w.forkID&&g.has(w.forkID)?d.push({from:w.forkID,to:w.id,kind:"fork"}):w.parentID&&g.has(w.parentID)&&d.push({from:w.parentID,to:w.id,kind:"child"});const m=new Map(h.map(w=>[w.session.id,w])),y=new Set;for(const w of n?.nodes||[]){const M=m.get(w.session.id);M&&Tn(M.session)===Tn(w.session)&&(M.position[1]=w.position[1],M.position[2]=w.position[2],y.add(M.session.id))}function $(w,M=new Set){const O=w.session.id;if(y.has(O)||M.has(O))return;M.add(O);const R=w.session.forkID||w.session.parentID,E=R?m.get(R):void 0;if(E&&Tn(E.session)===Tn(w.session)){$(E,M);const T=In(O+"branch")>.5?1:-1;w.position[1]=E.position[1]+T*(9+In(O)*15),w.position[2]=E.position[2]+(In(O+"depth")-.5)*18}y.add(O)}return s.forEach(w=>$(m.get(w.id))),h.forEach(w=>{w.startPosition=Fo(w,w.startPosition[0])}),{nodes:h,edges:d,lanes:u,start:r,end:o,timeFrame:i}}function Bd(){const e=new AbortController,t={signal:e.signal};let n,s=innerWidth<760;function r(c,f,u){const h=Math.max(12,Math.min(f,innerWidth-c.offsetWidth-12)),p=Math.max(72,Math.min(u,innerHeight-c.offsetHeight-12));Object.assign(c.style,{left:`${h}px`,top:`${p}px`,right:"auto",bottom:"auto",transform:"none"}),c.dataset.positioned="true"}function o(){if(!n)return;const{panel:c,handle:f,pointerID:u}=n;n=void 0,c.classList.remove("dragging"),f.hasPointerCapture(u)&&f.releasePointerCapture(u)}document.addEventListener("pointerdown",c=>{if(c.button!==0)return;const f=c.target,u=f.closest(".floating-panel");if(!u)return;document.querySelectorAll(".floating-panel").forEach(g=>g.classList.toggle("front",g===u));const h=f.closest("[data-drag-panel]");if(!h)return;u.querySelectorAll(".custom-dates[open]").forEach(g=>{g.open=!1}),c.preventDefault(),h.focus({preventScroll:!0});const p=u.getBoundingClientRect();n={panel:u,handle:h,pointerID:c.pointerId,x:c.clientX,y:c.clientY,left:p.left,top:p.top},h.setPointerCapture(c.pointerId),u.classList.add("dragging")},t),document.addEventListener("pointermove",c=>{!n||c.pointerId!==n.pointerID||r(n.panel,n.left+c.clientX-n.x,n.top+c.clientY-n.y)},t),document.addEventListener("pointerup",o,t),document.addEventListener("pointercancel",o,t),document.addEventListener("lostpointercapture",o,t),document.addEventListener("keydown",c=>{const u=c.target.closest("[data-drag-panel]")?.closest(".floating-panel");if(!u||!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(c.key))return;c.preventDefault();const h=u.getBoundingClientRect(),p=c.shiftKey?40:10;r(u,h.left+(c.key==="ArrowLeft"?-p:c.key==="ArrowRight"?p:0),h.top+(c.key==="ArrowUp"?-p:c.key==="ArrowDown"?p:0))},t);const i=[...document.querySelectorAll(".floating-panel")],a=c=>{if(c.hidden||!c.dataset.positioned)return;const f=c.getBoundingClientRect();r(c,f.left,f.top)},l=new ResizeObserver(c=>c.forEach(f=>a(f.target)));return i.forEach(c=>l.observe(c)),window.addEventListener("resize",()=>{o(),s!==innerWidth<760?(s=innerWidth<760,i.forEach(c=>{c.removeAttribute("style"),delete c.dataset.positioned})):i.forEach(a)},t),()=>{o(),e.abort(),l.disconnect()}}const jd=2,Di=e=>JSON.stringify([jd,e.revision,e.updated,e.created,e.projectID,e.directory]),un=e=>e.normalize("NFKD").replace(new RegExp("\\p{M}","gu"),"").toLowerCase(),Ho=e=>un(e).match(/[\p{L}\p{N}]+/gu)||[],Wd=e=>Ho(e).join(" ");function Ud(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=un(r[2].replace(/^"|"$/g,""));if(i==="in"){const l={title:["title"],files:["files"],messages:["body"],tools:["tools"]};t.fields=l[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(Wd(o)),n.push(o)}return t.text=n.join(" "),t.terms=Ho(t.text).slice(0,12),t.text=t.terms.join(" "),t}function qd(e,t,n=220){const s=un(e),r=t.reduce((i,a)=>{const l=s.indexOf(a);return l<0?i:Math.min(i,l)},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 Xa={opencode:{name:"OpenCode",icon:"opencode"},"claude-code":{name:"Claude Code",icon:"claude"},codex:{name:"Codex",icon:"openai"},"t3-code":{name:"T3 Code",icon:"t3"},cursor:{name:"Cursor",icon:"cursor"},gemini:{name:"Gemini CLI",icon:"gemini"},"qwen-code":{name:"Qwen Code",icon:"qwen"},pi:{name:"Pi",icon:"pi"},copilot:{name:"GitHub Copilot CLI",icon:"copilot"},cline:{name:"Cline",icon:"cline"},"roo-code":{name:"Roo Code",icon:"roo"},"kilo-code":{name:"Kilo Code",icon:"kilo"},continue:{name:"Continue",icon:"continue"},"prime-agent":{name:"Prime Agent",icon:"prime"},omp:{name:"Oh My Pi",icon:"pi"},senpi:{name:"Senpi / OmO Native",icon:"senpi"},kimchi:{name:"Kimchi",icon:"kimchi"},gajae:{name:"Gajae-Code",icon:"gajae"},openclaw:{name:"OpenClaw",icon:"openclaw"},hermes:{name:"Hermes Agent",icon:"hermes"},amp:{name:"Amp",icon:"amp"},droid:{name:"Factory Droid",icon:"droid"},codebuff:{name:"Codebuff",icon:"codebuff"},freebuff:{name:"Freebuff",icon:"freebuff"},kimi:{name:"Kimi CLI / Code",icon:"kimi"},grok:{name:"Grok Build",icon:"grok"},jcode:{name:"Jcode",icon:"jcode"},"cherry-studio":{name:"Cherry Studio",icon:"cherry"},"command-code":{name:"Command Code",icon:"commandcode"},zcode:{name:"ZCode",icon:"zcode"},codebuddy:{name:"CodeBuddy",icon:"codebuddy"},workbuddy:{name:"WorkBuddy",icon:"codebuddy"},proma:{name:"Proma",icon:"proma"},"deepseek-harness":{name:"DeepSeek Harness",icon:"deepseek"},aside:{name:"Aside",icon:"aside"},vibe:{name:"Mistral Vibe",icon:"mistral"},muse:{name:"Muse Code",icon:"muse"},junie:{name:"Junie",icon:"junie"},augment:{name:"Augment Code",icon:"augment"},fx:{name:"Fx",icon:"fx"},"minimax-code":{name:"MiniMax Code",icon:"minimax"},opencodereview:{name:"OpenCodeReview",icon:"opencode"},goose:{name:"Goose",icon:"goose"},zed:{name:"Zed Agent",icon:"zed"},devin:{name:"Devin CLI",icon:"devin"},"devin-desktop":{name:"Devin Desktop",icon:"devin"},crush:{name:"Crush",icon:"crush"},octofriend:{name:"Octofriend",icon:"octofriend"},"kilo-cli":{name:"Kilo CLI",icon:"kilo"},"mimo-code":{name:"MiMo Code",icon:"mimo"},"mimo-desktop":{name:"Xiaomi MiMo AI",icon:"mimo"},unsloth:{name:"Unsloth Studio",icon:"unsloth"},kiro:{name:"Kiro",icon:"kiro"},mux:{name:"Mux",icon:"mux"},antigravity:{name:"Antigravity",icon:"antigravity"},"antigravity-cli":{name:"Antigravity CLI",icon:"antigravity"},"antigravity-extension":{name:"Antigravity IDE Extension",icon:"antigravity"},reasonix:{name:"Reasonix",icon:"reasonix"},trae:{name:"Trae / Trae Solo",icon:"trae"},warp:{name:"Warp / Oz",icon:"warp"},"lm-studio":{name:"LM Studio",icon:"lmstudio"},hindsight:{name:"Hindsight",icon:"hindsight"}},Ue=e=>Xa[e||"opencode"]?.name||e||"Unknown",ut=e=>{const t=Xa[e||""]?.icon||"generic";return`<span class="source-icon source-icon-${t}" aria-hidden="true" style="--source-icon:url('/sources/${t}.svg')"></span>`},Qa=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)),Pt=e=>e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]);function ec(e,{checked:t=e.selected,disabled:n=!1,settings:s=!1}={}){const r=e.available?"Detected":"Not detected",o=e.capabilities.history?"":e.description.startsWith("Detection only")?"Detection only":"Metadata only",i=[e.description,e.lastImport?`Last import ${new Date(e.lastImport).toLocaleString()}`:"Not imported yet",e.error].filter(Boolean).join(" · ");return`<label class="import-source" data-source="${Pt(e.id)}" title="${Pt(i)}"><input ${s?'class="settings-source"':""} type="checkbox" value="${Pt(e.id)}" aria-label="${Pt(e.name)}" aria-description="${Pt(`${r}. ${e.sessions.toLocaleString()} saved sessions. ${i}`)}" ${t?"checked":""} ${n?"disabled":""}/><span class="source-symbol">${ut(e.id)}</span><span class="source-copy"><strong>${Pt(e.name)}</strong><small class="source-meta"><span class="source-detected ${e.available?"detected":""}">${r}</span><span>${e.sessions.toLocaleString()} saved</span>${o?`<span>${o}</span>`:""}</small>${e.error?`<small class="source-error">${Pt(e.error)}</small>`:""}</span></label>`}const Te=e=>e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]);function Cn(e,t){const n=new Set(t.map(un));let s=0,r="";for(const o of e.matchAll(/[\p{L}\p{N}]+/gu)){r+=Te(e.slice(s,o.index));const i=un(o[0]),a=[...n].some(l=>i.startsWith(l));r+=a?`<mark>${Te(o[0])}</mark>`:Te(o[0]),s=o.index+o[0].length}return r+Te(e.slice(s))}function Gd(e,t=()=>{},n){const s=new Worker(new URL("/assets/worker-DwqxiDWY.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=`
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=>Oi(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=>Oi(o,{nameAttr:"icon-name",icons:e,attrs:n})))}},Mi=["#b0e9d6","#8eaff4","#d7a1f1","#eac594","#8cdbdf","#e7a3b8","#a8ca91"];function In(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 Yn(e){return Us(e).split("/").at(-1)||"/"}const Us=e=>(/^(?:[a-z]:[\\/]|\\\\)/i.test(e)?e.replace(/\\/g,"/"):e).replace(/\/+$/,"")||(e.startsWith("/")?"/":""),Cn=e=>e.directory?JSON.stringify(["directory",Us(e.directory)]):JSON.stringify(["project",e.source||"opencode",e.projectID||e.id]),dn=e=>Math.max(e.created,e.activity?.lastMessageAt||e.created),ro=(e,t)=>{const n=t.timeFrame||t;return(e-n.start)/Math.max(1,n.end-n.start)*300-150},Zv=(e,t)=>ro(t.start+(t.end-t.start)*e,t),Fo=(e,t)=>[t,e.position[1],e.position[2]],Hd=(e,t)=>Fo(e,Math.max(e.startPosition[0],Math.min(t,e.position[0]))),Jv=(e,t,n,s=0,r=[1,0,0])=>{const o=Hd(e,t);return[o[0]+r[0]*(n+s),o[1]+r[1]*(n+s),o[2]+r[2]*(n+s)]},Xv=(e,t)=>[Fo(e,Math.max(e.startPosition[0],Math.min(t.startPosition[0],e.position[0]))),t.startPosition];function _d(e,t,n){if(!e.length)return{nodes:[],edges:[],lanes:[],start:0,end:0};const s=[...e].sort((w,M)=>w.created-M.created||w.id.localeCompare(M.id)),r=s[0].created,o=s.reduce((w,M)=>Math.max(w,dn(M)),r+36e5),i=n?.nodes.length?n.timeFrame||{start:n.start,end:n.end}:{start:r,end:o},a=new Map;for(const w of s){const M=Cn(w),O=a.get(M)||[];O.push(w),a.set(M,O)}const l=[...a].sort((w,M)=>M[1].length-w[1].length||w[0].localeCompare(M[0])),c=new Map(n?.lanes.map((w,M)=>[w.key,w.slot??M]));let f=Math.max(-1,...c.values())+1;for(const[w]of l)c.has(w)||c.set(w,f++);l.sort((w,M)=>c.get(w[0])-c.get(M[0]));const u=[],h=[],p=new Set(t.flatMap(w=>w.worktrees.map(Us)));l.forEach(([w,M])=>{const O=c.get(w),R=O*2.399963,E=O===0?0:15+Math.sqrt(O)*14,C=Math.cos(R)*E,x=Math.sin(R)*E*.7,T=Mi[O%Mi.length],b=t.find(V=>V.id===M[0].projectID),A=M[0].directory,D={key:w,slot:O,label:A?Yn(A):b?.name||M[0].projectID||"Unknown directory",color:T,kind:A&&p.has(Us(A))?"worktree":"directory",y:C,z:x,nodes:[]};for(const V of M){const H=ro(dn(V),i),z=ro(V.created,i),re=In(V.id),W=!!(V.parentID||V.forkID)?12:6,be=Math.sin((z+150)/65+O*.7)*3.5,Mt=typeof V.tokens=="number"&&Number.isFinite(V.tokens)?Math.max(0,V.tokens):0,$e={session:V,position:[H,C+be+(re-.5)*W,x+(In(V.id+"z")-.5)*W],startPosition:[z,0,0],color:T,radius:.35+Math.min(.9,Math.log10(1+Mt)*.11)};h.push($e),D.nodes.push($e)}u.push(D)});const g=new Set(s.map(w=>w.id)),d=[];for(const w of s)w.forkID&&g.has(w.forkID)?d.push({from:w.forkID,to:w.id,kind:"fork"}):w.parentID&&g.has(w.parentID)&&d.push({from:w.parentID,to:w.id,kind:"child"});const m=new Map(h.map(w=>[w.session.id,w])),y=new Set;for(const w of n?.nodes||[]){const M=m.get(w.session.id);M&&Cn(M.session)===Cn(w.session)&&(M.position[1]=w.position[1],M.position[2]=w.position[2],y.add(M.session.id))}function $(w,M=new Set){const O=w.session.id;if(y.has(O)||M.has(O))return;M.add(O);const R=w.session.forkID||w.session.parentID,E=R?m.get(R):void 0;if(E&&Cn(E.session)===Cn(w.session)){$(E,M);const C=In(O+"branch")>.5?1:-1;w.position[1]=E.position[1]+C*(9+In(O)*15),w.position[2]=E.position[2]+(In(O+"depth")-.5)*18}y.add(O)}return s.forEach(w=>$(m.get(w.id))),h.forEach(w=>{w.startPosition=Fo(w,w.startPosition[0])}),{nodes:h,edges:d,lanes:u,start:r,end:o,timeFrame:i}}function Bd(){const e=new AbortController,t={signal:e.signal};let n,s=innerWidth<760;function r(c,f,u){const h=Math.max(12,Math.min(f,innerWidth-c.offsetWidth-12)),p=Math.max(72,Math.min(u,innerHeight-c.offsetHeight-12));Object.assign(c.style,{left:`${h}px`,top:`${p}px`,right:"auto",bottom:"auto",transform:"none"}),c.dataset.positioned="true"}function o(){if(!n)return;const{panel:c,handle:f,pointerID:u}=n;n=void 0,c.classList.remove("dragging"),f.hasPointerCapture(u)&&f.releasePointerCapture(u)}document.addEventListener("pointerdown",c=>{if(c.button!==0)return;const f=c.target,u=f.closest(".floating-panel");if(!u)return;document.querySelectorAll(".floating-panel").forEach(g=>g.classList.toggle("front",g===u));const h=f.closest("[data-drag-panel]");if(!h)return;u.querySelectorAll(".custom-dates[open]").forEach(g=>{g.open=!1}),c.preventDefault(),h.focus({preventScroll:!0});const p=u.getBoundingClientRect();n={panel:u,handle:h,pointerID:c.pointerId,x:c.clientX,y:c.clientY,left:p.left,top:p.top},h.setPointerCapture(c.pointerId),u.classList.add("dragging")},t),document.addEventListener("pointermove",c=>{!n||c.pointerId!==n.pointerID||r(n.panel,n.left+c.clientX-n.x,n.top+c.clientY-n.y)},t),document.addEventListener("pointerup",o,t),document.addEventListener("pointercancel",o,t),document.addEventListener("lostpointercapture",o,t),document.addEventListener("keydown",c=>{const u=c.target.closest("[data-drag-panel]")?.closest(".floating-panel");if(!u||!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(c.key))return;c.preventDefault();const h=u.getBoundingClientRect(),p=c.shiftKey?40:10;r(u,h.left+(c.key==="ArrowLeft"?-p:c.key==="ArrowRight"?p:0),h.top+(c.key==="ArrowUp"?-p:c.key==="ArrowDown"?p:0))},t);const i=[...document.querySelectorAll(".floating-panel")],a=c=>{if(c.hidden||!c.dataset.positioned)return;const f=c.getBoundingClientRect();r(c,f.left,f.top)},l=new ResizeObserver(c=>c.forEach(f=>a(f.target)));return i.forEach(c=>l.observe(c)),window.addEventListener("resize",()=>{o(),s!==innerWidth<760?(s=innerWidth<760,i.forEach(c=>{c.removeAttribute("style"),delete c.dataset.positioned})):i.forEach(a)},t),()=>{o(),e.abort(),l.disconnect()}}const jd=2,Di=e=>JSON.stringify([jd,e.revision,e.updated,e.created,e.projectID,e.directory]),un=e=>e.normalize("NFKD").replace(new RegExp("\\p{M}","gu"),"").toLowerCase(),Ho=e=>un(e).match(/[\p{L}\p{N}]+/gu)||[],Wd=e=>Ho(e).join(" ");function Ud(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=un(r[2].replace(/^"|"$/g,""));if(i==="in"){const l={title:["title"],files:["files"],messages:["body"],tools:["tools"]};t.fields=l[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(Wd(o)),n.push(o)}return t.text=n.join(" "),t.terms=Ho(t.text).slice(0,12),t.text=t.terms.join(" "),t}function qd(e,t,n=220){const s=un(e),r=t.reduce((i,a)=>{const l=s.indexOf(a);return l<0?i:Math.min(i,l)},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 Xa={opencode:{name:"OpenCode",icon:"opencode"},"claude-code":{name:"Claude Code",icon:"claude"},codex:{name:"Codex",icon:"openai"},"t3-code":{name:"T3 Code",icon:"t3"},cursor:{name:"Cursor",icon:"cursor"},gemini:{name:"Gemini CLI",icon:"gemini"},"qwen-code":{name:"Qwen Code",icon:"qwen"},pi:{name:"Pi",icon:"pi"},copilot:{name:"GitHub Copilot CLI",icon:"copilot"},"copilot-chat":{name:"GitHub Copilot Chat (VS Code)",icon:"copilot"},cline:{name:"Cline",icon:"cline"},"roo-code":{name:"Roo Code",icon:"roo"},"kilo-code":{name:"Kilo Code",icon:"kilo"},continue:{name:"Continue",icon:"continue"},"prime-agent":{name:"Prime Agent",icon:"prime"},omp:{name:"Oh My Pi",icon:"pi"},senpi:{name:"Senpi / OmO Native",icon:"senpi"},kimchi:{name:"Kimchi",icon:"kimchi"},gajae:{name:"Gajae-Code",icon:"gajae"},openclaw:{name:"OpenClaw",icon:"openclaw"},hermes:{name:"Hermes Agent",icon:"hermes"},amp:{name:"Amp",icon:"amp"},droid:{name:"Factory Droid",icon:"droid"},codebuff:{name:"Codebuff",icon:"codebuff"},freebuff:{name:"Freebuff",icon:"freebuff"},kimi:{name:"Kimi CLI / Code",icon:"kimi"},grok:{name:"Grok Build",icon:"grok"},jcode:{name:"Jcode",icon:"jcode"},"cherry-studio":{name:"Cherry Studio",icon:"cherry"},"command-code":{name:"Command Code",icon:"commandcode"},zcode:{name:"ZCode",icon:"zcode"},codebuddy:{name:"CodeBuddy",icon:"codebuddy"},workbuddy:{name:"WorkBuddy",icon:"codebuddy"},proma:{name:"Proma",icon:"proma"},"deepseek-harness":{name:"DeepSeek Harness",icon:"deepseek"},aside:{name:"Aside",icon:"aside"},vibe:{name:"Mistral Vibe",icon:"mistral"},muse:{name:"Muse Code",icon:"muse"},junie:{name:"Junie",icon:"junie"},augment:{name:"Augment Code",icon:"augment"},fx:{name:"Fx",icon:"fx"},"minimax-code":{name:"MiniMax Code",icon:"minimax"},opencodereview:{name:"OpenCodeReview",icon:"opencode"},goose:{name:"Goose",icon:"goose"},zed:{name:"Zed Agent",icon:"zed"},devin:{name:"Devin CLI",icon:"devin"},"devin-desktop":{name:"Devin Desktop",icon:"devin"},crush:{name:"Crush",icon:"crush"},octofriend:{name:"Octofriend",icon:"octofriend"},"kilo-cli":{name:"Kilo CLI",icon:"kilo"},"mimo-code":{name:"MiMo Code",icon:"mimo"},"mimo-desktop":{name:"Xiaomi MiMo AI",icon:"mimo"},unsloth:{name:"Unsloth Studio",icon:"unsloth"},kiro:{name:"Kiro",icon:"kiro"},mux:{name:"Mux",icon:"mux"},antigravity:{name:"Antigravity",icon:"antigravity"},"antigravity-cli":{name:"Antigravity CLI",icon:"antigravity"},"antigravity-extension":{name:"Antigravity IDE Extension",icon:"antigravity"},reasonix:{name:"Reasonix",icon:"reasonix"},trae:{name:"Trae / Trae Solo",icon:"trae"},warp:{name:"Warp / Oz",icon:"warp"},"lm-studio":{name:"LM Studio",icon:"lmstudio"},hindsight:{name:"Hindsight",icon:"hindsight"}},Ue=e=>Xa[e||"opencode"]?.name||e||"Unknown",ut=e=>{const t=Xa[e||""]?.icon||"generic";return`<span class="source-icon source-icon-${t}" aria-hidden="true" style="--source-icon:url('/sources/${t}.svg')"></span>`},Qa=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)),Pt=e=>e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]);function ec(e,{checked:t=e.selected,disabled:n=!1,settings:s=!1}={}){const r=e.available?"Detected":"Not detected",o=e.capabilities.history?"":e.description.startsWith("Detection only")?"Detection only":"Metadata only",i=[e.description,e.lastImport?`Last import ${new Date(e.lastImport).toLocaleString()}`:"Not imported yet",e.error].filter(Boolean).join(" · ");return`<label class="import-source" data-source="${Pt(e.id)}" title="${Pt(i)}"><input ${s?'class="settings-source"':""} type="checkbox" value="${Pt(e.id)}" aria-label="${Pt(e.name)}" aria-description="${Pt(`${r}. ${e.sessions.toLocaleString()} saved sessions. ${i}`)}" ${t?"checked":""} ${n?"disabled":""}/><span class="source-symbol">${ut(e.id)}</span><span class="source-copy"><strong>${Pt(e.name)}</strong><small class="source-meta"><span class="source-detected ${e.available?"detected":""}">${r}</span><span>${e.sessions.toLocaleString()} saved</span>${o?`<span>${o}</span>`:""}</small>${e.error?`<small class="source-error">${Pt(e.error)}</small>`:""}</span></label>`}const Ce=e=>e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]);function Tn(e,t){const n=new Set(t.map(un));let s=0,r="";for(const o of e.matchAll(/[\p{L}\p{N}]+/gu)){r+=Ce(e.slice(s,o.index));const i=un(o[0]),a=[...n].some(l=>i.startsWith(l));r+=a?`<mark>${Ce(o[0])}</mark>`:Ce(o[0]),s=o.index+o[0].length}return r+Ce(e.slice(s))}function Gd(e,t=()=>{},n){const s=new Worker(new URL("/assets/worker-DwqxiDWY.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
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
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
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=v=>i.querySelector(v),l=a("#session-query"),c=a("#search-results"),f=a(".search-results-inner"),u=a("#search-preview"),h=a("#search-scope");let p=new Map,g=new Map,d,m=[],y=0,$=0,w=0,M=80,O=0,R=0,E=0,T=!1,x=!1,C=!0,b,A=null,D,V=0,H="",z="",re=!1;const Z=new Map,W=86,be=v=>s.postMessage(v);function Mt(){if(!b)return;const v=a("#search-index-state");v.textContent=b.storage==="restoring"?"Restoring saved index…":b.complete===b.total&&b.total?`Conversations ready${b.storage==="local"?" · saved locally":""}`:`${b.indexed.toLocaleString()} / ${b.total.toLocaleString()} conversations${C?b.active?" · indexing":" · partial":" · paused"}`,v.title=`Titles and metadata cover all ${b.total.toLocaleString()} imported sessions. ${b.complete.toLocaleString()} conversations have all supported text indexed. ${b.failed?`${b.failed} unavailable; toggle Conversations to retry. `:""}${b.limited?"Large histories are sampled; missing matches may be in unindexed text. ":""}${b.storage==="memory"?"Saving unavailable; search continues in memory.":`Saved in local SQLite. ${b.restored.toLocaleString()} conversations restored; unchanged pages are reused. Clear saved index under Filters. Imported sessions remain saved.`}`}function $e(){if(f.style.height=`${m.length*W}px`,!m.length){f.innerHTML=`<div class="search-empty">${Te(z||(T?"Searching…":l.value?"No matching sessions":"No sessions available"))}</div>`,l.removeAttribute("aria-activedescendant");return}const v=Math.max(0,Math.floor(c.scrollTop/W)-3),I=Math.min(m.length,v+Math.ceil(c.clientHeight/W)+7);f.innerHTML=m.slice(v,I).map((F,Q)=>{const U=v+Q,G=p.get(F.id);if(!G)return"";const ce=`${Ue(G.source)} · ${g.get(G.projectID)||G.directory.split("/").at(-1)||"Global"} · ${new Date(G.updated).toLocaleDateString(void 0,{month:"short",day:"numeric"})}`;return`<div id="search-hit-${U}" class="search-result ${U===y?"active":""}" role="option" aria-selected="${U===y}" aria-posinset="${U+1}" aria-setsize="${$}" data-result-index="${U}" style="top:${U*W}px"><div class="search-result-title">${Cn(G.title,F.terms)}</div><div class="search-result-meta"><span>${ut(G.source)}${Te(ce)}</span><span class="match-kind">${Te(F.source)}</span></div>${F.excerpt?`<div class="search-result-excerpt">${Cn(F.excerpt,F.terms)}</div>`:`<div class="search-result-excerpt">${Te(G.model)}</div>`}</div>`}).join(""),y>=v&&y<I?l.setAttribute("aria-activedescendant",`search-hit-${y}`):l.removeAttribute("aria-activedescendant")}function Ke(v,I=!1,F=!1){const Q=m[y],U=Q&&p.get(Q.id);if(!U){u.innerHTML="";return}const G=Q.terms.length?Q.terms:Ho(Ud(l.value).text),ce=v?.fragments.filter(ie=>{const Fe=un(ie.text);return G.length&&G.every(He=>Fe.includes(He))}).slice(0,4)||[],De=v?.fragments.filter(ie=>["You","Assistant"].includes(ie.kind)).slice(0,5).reverse()||[],Ne=ce.length?ce:De;if(u.innerHTML=`<div class="search-preview-heading"><span>${Te(g.get(U.projectID)||"Session")}</span><h2>${Cn(U.title,G)}</h2><p>${Te(U.model)} · ${new Date(U.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>${Cn(Q.excerpt,G)}</p></section>`:""}<section class="search-preview-section"><h3>${ce.length?"Matching context":"Recent conversation"}</h3>${I?'<p class="preview-loading">Loading preview…</p>':F?'<p>Preview unavailable.</p><button class="text-button preview-retry">Retry</button>':Ne.length?Ne.map(ie=>`<article><span>${Te(ie.kind)}</span><p>${Cn(qd(ie.text,G,360),G)}</p></article>`).join(""):"<p>No conversation text in this batch.</p>"}${v&&(v.nextCursor||v.truncated)?'<p class="preview-coverage">Recent messages · partial preview</p>':""}</section>`,u.querySelector(".search-open")?.addEventListener("click",$n,o),n){const ie=document.createElement("button");ie.className="text-button search-launch",ie.innerHTML=`${ut(U.source)}Open in ${Te(Ue(U.source))} ↗`,ie.addEventListener("click",()=>n(U),o),u.querySelector(".search-preview-heading")?.append(ie)}u.querySelector(".preview-retry")?.addEventListener("click",()=>{H="",Dt()},o)}function Dt(){const v=m[y],I=v&&p.get(v.id),F=I?`${I.id}:${Di(I)}:${l.value}`:"";if(F===H)return;if(H=F,window.clearTimeout(V),D?.abort(),!I){Ke();return}const Q=`${I.id}:${Di(I)}`,U=Z.get(Q);if(U){Ke(U);return}Ke(void 0,!0),V=window.setTimeout(async()=>{const G=new AbortController;D=G;try{const ce=await fetch(`/api/sessiongraph/session/${encodeURIComponent(I.id)}/content?updated=${I.updated}`,{signal:G.signal});if(!ce.ok)throw new Error("Preview unavailable");const De=await ce.json();if(G.signal.aborted||F!==H)return;Z.size>=25&&Z.delete(Z.keys().next().value),Z.set(Q,De),Ke(De)}catch{!G.signal.aborted&&F===H&&Ke(void 0,!1,!0)}},90)}function Zt(){cancelAnimationFrame(O),T=!0,l.setAttribute("aria-busy","true");const v=++w;R=performance.now(),O=requestAnimationFrame(()=>be({type:"query",request:v,text:l.value,viewOnly:h.value==="view",limit:M}))}function vt(){y=0,re=!1,M=80,c.scrollTop=0,H="",Zt()}function Rt(v){if(!m.length)return;re=!0,y=Math.max(0,Math.min(m.length-1,y+v));const I=y*W;I<c.scrollTop?c.scrollTop=I:I+W>c.scrollTop+c.clientHeight&&(c.scrollTop=I+W-c.clientHeight),$e(),Dt()}function yt(){i.close(),t(!1),D?.abort(),window.clearTimeout(V),H="",A?.focus({preventScroll:!0})}function $n(){const v=m[y];!v||T||(yt(),e(v.id))}function L(){i.open||(A=document.activeElement,i.showModal()),t(!0),l.focus({preventScroll:!0}),l.select(),Zt(),C&&be({type:"warm",enabled:!0})}s.onmessage=v=>{const I=v.data;if(I.type==="status"){b=I.status,Mt();return}if(I.type==="error"){z=I.message,T=!1,l.setAttribute("aria-busy","false"),$e();return}if(I.request!==w)return;const F=m[y]?.id;E=T?performance.now()-R:E,T=!1,l.setAttribute("aria-busy","false"),m=I.hits,$=I.total,z=I.error||"",y=Math.max(0,Math.min(m.length-1,re&&F?m.findIndex(Q=>Q.id===F):0)),a("#search-result-status").textContent=z||`${$.toLocaleString()} ${l.value?"matches":"sessions"} · ${Math.round(I.elapsed)} ms`,a("#search-more").hidden=m.length>=$||M>=250,i.open&&($e(),Dt())},s.onerror=()=>{z="Search could not start. Reload to retry.",T=!1,$e()},l.addEventListener("input",()=>{x||vt()},o),l.addEventListener("compositionstart",()=>{x=!0},o),l.addEventListener("compositionend",()=>{x=!1,vt()},o),h.addEventListener("change",vt,o),c.addEventListener("scroll",$e,o),c.addEventListener("click",v=>{const I=v.target.closest("[data-result-index]");I&&(y=Number(I.dataset.resultIndex),re=!0,$e(),Dt(),l.focus())},o),c.addEventListener("dblclick",$n,o),a("#search-more").addEventListener("click",()=>{M=Math.min(250,M+80),Zt()},o),a("#search-conversations").addEventListener("click",()=>{C=!C,a("#search-conversations").setAttribute("aria-pressed",String(C)),be({type:"warm",enabled:C}),Mt()},o),a("#search-clear-cache").addEventListener("click",()=>{C=!1,a("#search-conversations").setAttribute("aria-pressed","false"),Z.clear(),H="",D?.abort(),window.clearTimeout(V),a(".search-syntax").open=!1,be({type:"clear-cache"}),l.focus()},o),a(".search-close").addEventListener("click",yt,o),i.addEventListener("cancel",v=>{v.preventDefault(),yt()},o),i.addEventListener("keydown",v=>{v.stopPropagation(),!(x||v.isComposing)&&((v.key==="ArrowDown"||v.key==="ArrowUp")&&(v.preventDefault(),Rt(v.key==="ArrowDown"?1:-1)),(v.key==="PageDown"||v.key==="PageUp")&&(v.preventDefault(),Rt((v.key==="PageDown"?1:-1)*Math.max(1,Math.floor(c.clientHeight/W)))),v.key==="Enter"&&v.target===l&&(v.preventDefault(),$n()),v.key==="Escape"&&(v.preventDefault(),yt()),v.key.toLowerCase()==="s"&&v.altKey&&(v.preventDefault(),h.value=h.value==="view"?"all":"view",h.dispatchEvent(new Event("change",{bubbles:!0}))))},o),document.addEventListener("keydown",v=>{if(i.open||document.querySelector("dialog[open]"))return;const I=v.target,F=I.isContentEditable||I.closest('input:not([type="range"]):not([type="checkbox"]):not([type="radio"]), textarea, select');(v.key==="/"&&!F&&!v.ctrlKey&&!v.metaKey&&!v.altKey||v.key.toLowerCase()==="k"&&(v.metaKey||v.ctrlKey))&&(v.preventDefault(),L())},o);const S=new ResizeObserver(()=>{i.open&&$e()});return S.observe(c),{open:L,setData(v){d!==v.sourceID&&(Z.clear(),H="",D?.abort(),window.clearTimeout(V)),d=v.sourceID,p=new Map(v.sessions.map(I=>[I.id,I])),g=new Map(v.projects.map(I=>[I.id,I.name])),be({type:"data",sessions:v.sessions,projects:v.projects,sourceID:d})},setScope(v){be({type:"scope",ids:v})},diagnostics:()=>({open:i.open,query:l.value,matches:$,renderedRows:f.querySelectorAll('[role="option"]').length,roundTripMs:E,pending:T,index:b}),dispose(){s.terminate(),r.abort(),S.disconnect(),D?.abort(),window.clearTimeout(V),cancelAnimationFrame(O),i.remove()}}}const Hn=[{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"}],Ar=e=>Hn.some(t=>t.id===e),tc=e=>/^ses[a-zA-Z0-9_-]+$/.test(e);function Yd(e,t){if(!tc(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 sn=(e,t=[])=>({parts:(...n)=>{if(Kd(t))return sn(e,n);throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?")},extendWith:(...n)=>sn(e,[...t,...n]),omit:(...n)=>sn(e,t.filter(s=>!n.includes(s))),rename:n=>sn(n,t),keys:()=>t,build:()=>[...new Set(t)].reduce((n,s)=>Object.assign(n,{[s]:{selector:[`&[data-scope="${Jt(e)}"][data-part="${Jt(s)}"]`,`& [data-scope="${Jt(e)}"][data-part="${Jt(s)}"]`].join(", "),attrs:{"data-scope":Jt(e),"data-part":Jt(s)}}}),{})}),Jt=e=>e.replace(/([A-Z])([A-Z])/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),Kd=e=>e.length===0,zd=sn("select").parts("label","positioner","trigger","indicator","clearTrigger","item","itemText","itemIndicator","itemGroup","itemGroupLabel","list","content","root","control","valueText"),ve=zd.build(),Zd=Object.defineProperty,Jd=(e,t,n)=>t in e?Zd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_=(e,t,n)=>Jd(e,typeof t!="symbol"?t+"":t,n);function Xd(e){return e==null?[]:Array.isArray(e)?e:[e]}var Qd=e=>e[e.length-1],eu=(e,t)=>e.indexOf(t)!==-1,tu=(e,...t)=>e.concat(t),nu=(e,...t)=>e.filter(n=>!t.includes(n)),Ri=(e,t)=>eu(e,t)?nu(e,t):tu(e,t);function Pi(e,t){return e.reduce((n,s,r)=>(r%t===0?n.push([s]):Qd(n)?.push(s),n),[])}var Vi=e=>e?.constructor.name==="Array",su=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!bn(e[n],t[n]))return!1;return!0},bn=(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(Vi(e)&&Vi(t))return su(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(!bn(e[o],t[o]))return!1}return!0},ru=e=>Array.isArray(e),nc=e=>e!=null&&typeof e=="object",Lr=e=>nc(e)&&!ru(e),ou=e=>typeof e=="string",Xe=e=>typeof e=="function",iu=e=>e==null,Os=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),au=e=>Object.prototype.toString.call(e),sc=Function.prototype.toString,cu=sc.call(Object),_n=e=>{if(!nc(e)||au(e)!="[object Object]"||uu(e))return!1;const t=Object.getPrototypeOf(e);if(t===null)return!0;const n=Os(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&sc.call(n)==cu},lu=e=>typeof e=="object"&&e!==null&&"$$typeof"in e&&"props"in e,du=e=>typeof e=="object"&&e!==null&&"__v_isVNode"in e,uu=e=>lu(e)||du(e),Ni=(e,...t)=>(typeof e=="function"?e(...t):e)??void 0,fu=e=>e(),rc=()=>{},qs=(...e)=>(...t)=>{e.forEach(function(n){n?.(...t)})};function oo(e,t,...n){if(e in t){const r=t[e];return Xe(r)?r(...n):r}const s=new Error(`No matching key: ${JSON.stringify(e)} in ${JSON.stringify(Object.keys(t))}`);throw Error.captureStackTrace?.(s,oo),s}var{min:hu,max:pu}=Math,gu=e=>Number.isNaN(e),oc=e=>gu(e)?0:e,Or=(e,t,n)=>{const s=oc(e),r=t==null||s>=t,o=n==null||s<=n;return r&&o},mu=(e,t,n)=>hu(pu(oc(e),t),n);function _o(e){if(!_n(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]=_o(r))}return n}function ic(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 Ms(...e){e.length===1?e[0]:e[1],e.length===2&&e[0]}function Fi(...e){e.length===1?e[0]:e[1],e.length===2&&e[0]}function cr(e,t){if(e==null)throw new Error(t())}var Ds={itemToValue(e){return typeof e=="string"?e:Lr(e)&&Os(e,"value")?e.value:""},itemToString(e){return typeof e=="string"?e:Lr(e)&&Os(e,"label")?e.label:Ds.itemToValue(e)},isItemDisabled(e){return Lr(e)&&Os(e,"disabled")?!!e.disabled:!1}},ac=class cc{constructor(t){_(this,"options",t),_(this,"items"),_(this,"indexMap",null),_(this,"copy",n=>new cc({...this.options,items:n??[...this.items]})),_(this,"isEqual",n=>bn(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)??Ds.itemToValue(n)),_(this,"getItemDisabled",n=>n==null?!1:this.options.isItemDisabled?.(n)??Ds.isItemDisabled(n)),_(this,"stringifyItem",n=>n==null?null:this.options.itemToString?.(n)??Ds.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 l=n(i,a);r.has(l)||r.set(l,[]),r.get(l).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 l=s.indexOf(i),c=s.indexOf(a);return l===-1?1:c===-1?-1:l-c}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)&&vu(this.stringifyItem(a),n))return a}}),_(this,"search",(n,s)=>{const{state:r,currentValue:o,timeout:i=350}=s,a=r.keysSoFar+n,c=a.length>1&&Array.from(a).every(g=>g===a[0])?a[0]:a,f=this.getByText(c,o),u=this.getItemValue(f);function h(){clearTimeout(r.timer),r.timer=-1}function p(g){r.keysSoFar=g,h(),g!==""&&(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(kn(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(kn(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(kn(this.items,r+1,...s))}),_(this,"prepend",(...n)=>this.copy(kn(this.items,0,...n))),_(this,"append",(...n)=>this.copy(kn(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(hs(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(hs(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(hs(this.items,o,r+1))}),_(this,"reorder",(n,s)=>this.copy(hs(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}},vu=(e,t)=>!!e?.toLowerCase().startsWith(t.toLowerCase());function kn(e,t,...n){return[...e.slice(0,t),...n,...e.slice(t)]}function hs(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 lc({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 dc({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 ps({values:e,collection:t,selectedItemMap:n}){const s=lc({values:e,collection:t,selectedItemMap:n}),r=dc({selectedItemMap:n,values:e,selectedItems:s,collection:t});return{selectedItems:s,nextSelectedItemMap:r}}function yu({selectedItems:e,collection:t}){return dc({selectedItemMap:new Map,values:e.map(n=>t.getItemValue(n)).filter(Boolean),selectedItems:e,collection:t})}var Gs=e=>new ac(e);Gs.empty=()=>new ac({items:[]});var bu=Object.defineProperty,wu=(e,t,n)=>t in e?bu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mr=(e,t,n)=>wu(e,typeof t!="symbol"?t+"":t,n),Eu=(e,t)=>e.map((n,s)=>e[(Math.max(t,0)+s)%e.length]),Ys=()=>{},lr=e=>typeof e=="object"&&e!==null,P=e=>e?"":void 0,he=e=>e?"true":void 0,xu=1,Su=9,$u=11,fe=e=>lr(e)&&e.nodeType===xu&&typeof e.nodeName=="string",Bo=e=>lr(e)&&e.nodeType===Su,Iu=e=>lr(e)&&e===e.window,uc=e=>fe(e)?e.localName||"":"#document";function Tu(e){return["html","body","#document"].includes(uc(e))}var fc=e=>lr(e)&&e.nodeType!==void 0,fn=e=>fc(e)&&e.nodeType===$u&&"host"in e,hc=e=>fe(e)&&e.localName==="input",Cu=e=>fe(e)?e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0:!1;function io(e){if(!e)return!1;const t=e.getRootNode();return dr(t)===e}var ku=/(textarea|select)/;function Au(e){if(e==null||!fe(e))return!1;try{return hc(e)&&e.selectionStart!=null||ku.test(e.localName)||e.isContentEditable||e.getAttribute("contenteditable")==="true"||e.getAttribute("contenteditable")===""}catch{return!1}}function hn(e,t){if(!e||!t||!fe(e)||!fc(t))return!1;if(fe(t)&&e===t||e.contains(t))return!0;const n=t.getRootNode?.();if(n&&fn(n)){let s=t;for(;s;){if(e===s)return!0;s=s.parentNode||s.host}}return!1}function Me(e){return Bo(e)?e:Iu(e)?e.document:e?.ownerDocument??document}function Lu(e){return Me(e).documentElement}function me(e){return fn(e)?me(e.host):Bo(e)?e.defaultView??window:fe(e)?e.ownerDocument?.defaultView??window:window}function dr(e){let t=e.activeElement;for(;t?.shadowRoot;){const n=t.shadowRoot.activeElement;if(!n||n===t)break;t=n}return t}function Hi(e,t){return!e||e===Me(e).body?!1:!t.some(n=>hn(n,e))}function Ou(e){if(uc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||fn(e)&&e.host||Lu(e);return fn(t)?t.host:t}function Mu(e){let t;try{if(t=e.getRootNode({composed:!0}),Bo(t)||fn(t))return t}catch{}return e.ownerDocument??document}var Dr=new WeakMap;function pc(e){return Dr.has(e)||Dr.set(e,me(e).getComputedStyle(e)),Dr.get(e)}var jo=()=>typeof document<"u";function Du(){return navigator.userAgentData?.platform??navigator.platform}function Ru(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}var Wo=e=>jo()&&e.test(Du()),Pu=e=>jo()&&e.test(Ru()),Vu=/^iPhone/i,Nu=/^iPad/i,Fu=/^Mac/i,Hu=/Android/i,_i=()=>jo()&&!!navigator.maxTouchPoints,_u=()=>Wo(Vu),Bu=()=>Wo(Nu)||Uo()&&navigator.maxTouchPoints>1,gc=()=>_u()||Bu(),Uo=()=>Wo(Fu),ju=()=>Pu(Hu),Wu=new Set(["menu","listbox","dialog","grid","tree","region","application"]),Uu=e=>Wu.has(e),qu=e=>e.getAttribute("aria-controls")?.split(" ")||[];function Gu(e,t){const n=new Set,s=Mu(e),r=o=>{const i=o.querySelectorAll("[aria-controls]");for(const a of i){if(a.getAttribute("aria-expanded")!=="true")continue;const l=qu(a);for(const c of l){if(!c||n.has(c))continue;n.add(c);const f=s.getElementById(c);if(f){const u=f.getAttribute("role"),h=f.getAttribute("aria-modal")==="true";if(u&&Uu(u)&&!h&&(f===t||f.contains(t)||r(f)))return!0}}}return!1};return r(e)}function Yu(e){return e.composedPath?.()??e.nativeEvent?.composedPath?.()}function ft(e){return Yu(e)?.[0]??e.target}function Ku(e){return qo(e).isComposing||e.keyCode===229}function zu(e){return e.pointerType===""&&e.isTrusted?!0:ju()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}var Zu=e=>e.button===2||Uo()&&e.ctrlKey&&e.button===0,Ju={Up:"ArrowUp",Down:"ArrowDown",Esc:"Escape"," ":"Space",",":"Comma",Left:"ArrowLeft",Right:"ArrowRight"},Bi={ArrowLeft:"ArrowRight",ArrowRight:"ArrowLeft"};function ao(e,t={}){const{dir:n="ltr",orientation:s="horizontal"}=t;let r=e.key;return r=Ju[r]??r,n==="rtl"&&s==="horizontal"&&r in Bi&&(r=Bi[r]),r}function qo(e){return e.nativeEvent??e}var Rs=(e,t,n,s)=>{const r=typeof e=="function"?e():e;return r?.addEventListener(t,n,s),()=>{r?.removeEventListener(t,n,s)}};function Xu(e,t){const{type:n="HTMLInputElement",property:s="value"}=t,r=me(e)[n].prototype;return Object.getOwnPropertyDescriptor(r,s)??{}}function Qu(e){if(e.localName==="input")return"HTMLInputElement";if(e.localName==="textarea")return"HTMLTextAreaElement";if(e.localName==="select")return"HTMLSelectElement"}function gs(e,t,n="value"){if(!e)return;const s=Qu(e);s&&Xu(e,{type:s,property:n}).set?.call(e,t),e.setAttribute(n,t)}function ef(e){return e.matches("textarea, input, select, button")}function tf(e,t){if(!e)return;const n=ef(e)?e.form:e.closest("form"),s=r=>{r.defaultPrevented||t()};return n?.addEventListener("reset",s,{passive:!0}),()=>n?.removeEventListener("reset",s)}function nf(e,t){const n=e?.closest("fieldset");if(!n)return;t(n.disabled);const s=me(n),r=new s.MutationObserver(()=>t(n.disabled));return r.observe(n,{attributes:!0,attributeFilter:["disabled"]}),()=>r.disconnect()}function sf(e,t){if(!e)return;const{onFieldsetDisabledChange:n,onFormReset:s}=t,r=[tf(e,s),nf(e,n)];return()=>r.forEach(o=>o?.())}var mc=Symbol.for("zag.changeEvent");function vc(e){return Object.prototype.hasOwnProperty.call(e,mc)}function rf(e){return vc(e)||Object.defineProperty(e,mc,{value:!0}),e}var of=e=>fe(e)&&e.tagName==="IFRAME";function af(e){const t=e.getAttribute("tabindex");return t?parseInt(t,10):NaN}var cf=e=>af(e)<0;function lf(e){return hc(e)&&e.type==="radio"}function df(e){if(!lf(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&&ur(o)),r=s.find(o=>o.checked);return r?r===e:s[0]===e}function uf(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 ff(e,t,n){const s=[...e],r=[...e],o=new Set,i=new Map;e.forEach((l,c)=>i.set(l,c));let a=0;for(;a<r.length;){const l=r[a++];if(!l||o.has(l))continue;o.add(l);const c=uf(l,t);if(c){const f=Array.from(c.querySelectorAll(Go)).filter(n),u=i.get(l);if(u!==void 0){const h=u+1;s.splice(h,0,...f),f.forEach((p,g)=>{i.set(p,h+g)});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,g)=>{i.set(p,h+g)})}r.push(...f)}}return s}var Go="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 ur(e){return!fe(e)||e.closest("[inert]")?!1:e.matches(Go)&&Cu(e)}function Yo(e,t={}){if(!e)return[];const{includeContainer:n,getShadowRoot:s}=t,r=Array.from(e.querySelectorAll(Go));n&&Rr(e)&&r.unshift(e);const o=[];for(const i of r)if(Rr(i)){if(of(i)&&i.contentDocument){const a=i.contentDocument.body;o.push(...Yo(a,{getShadowRoot:s}));continue}o.push(i)}if(s){const i=ff(o,s,Rr);return!i.length&&n?r:i}return!o.length&&n?r:o}function Rr(e){return fe(e)&&e.tabIndex>0?!0:!ur(e)||cf(e)?!1:df(e)}function hf(e,t={}){const n=Yo(e,t),s=n[0]||null,r=n[n.length-1]||null;return[s,r]}function pf(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=Yo(t).filter(a=>s?s(a):!0).find(a=>!a.hasAttribute("data-no-autofocus"))),o||t||void 0)}function gf(e){const t=e.currentTarget;if(!t)return!1;const[n,s]=hf(t);return!(io(n)&&e.shiftKey||io(s)&&!e.shiftKey||!n&&!s)}var yc=class bc{constructor(){Mr(this,"id",null),Mr(this,"fn_cleanup"),Mr(this,"cleanup",()=>{this.cancel()})}static create(){return new bc}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 pe(e){const t=yc.create();return t.request(e),t.cleanup}function wc(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 Pr=new WeakMap;function mf(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 vf(e){const t=mf(e),n=JSON.stringify(t);return{observe(s,r){const o=me(s);if(typeof o.MutationObserver!="function")return Ys;const i=Pr.get(s)??new Map;let a=i.get(n);if(!a){const c=new Set,f=new o.MutationObserver(u=>{for(const h of[...c])if(c.has(h))try{h(u)}catch(p){o.queueMicrotask(()=>{throw p})}});f.observe(s,t),a={observer:f,listeners:c},i.set(n,a),Pr.set(s,i)}const l=c=>r(c);return a.listeners.add(l),()=>{!a.listeners.delete(l)||a.listeners.size>0||(a.observer.disconnect(),i.delete(n),i.size===0&&Pr.delete(s))}}}}function yf(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 bf(e,t){const n=pe,s=[];return s.push(n(()=>{const r=typeof e=="function"?e():e;s.push(yf(r,t))})),()=>{s.forEach(r=>r?.())}}function co(e){const t=Ou(e);return Tu(t)?Me(t).body:fe(t)&&xf(t)?t:co(t)}var wf=/auto|scroll|overlay|hidden|clip/,Ef=new Set(["inline","contents"]);function xf(e){const t=me(e),{overflow:n,overflowX:s,overflowY:r,display:o}=t.getComputedStyle(e);return wf.test(n+r+s)&&!Ef.has(o)}var ji=/auto|scroll|overlay|hidden/;function Sf(e,t={}){const{axis:n}=t,{overflowX:s,overflowY:r}=me(e).getComputedStyle(e),o=n!=="y"&&ji.test(s)&&e.scrollWidth>e.clientWidth,i=n!=="x"&&ji.test(r)&&e.scrollHeight>e.clientHeight;return o||i}var rn="default",lo="",Ps=new WeakMap;function $f(e={}){const{target:t,doc:n}=e,s=n??document,r=s.documentElement;return gc()?(rn==="default"&&(lo=r.style.webkitUserSelect,r.style.webkitUserSelect="none"),rn="disabled"):t&&(Ps.set(t,t.style.userSelect),t.style.userSelect="none"),()=>Ec({target:t,doc:s})}function Ec(e={}){const{target:t,doc:n}=e,r=(n??document).documentElement;if(gc()){if(rn!=="disabled")return;rn="restoring",setTimeout(()=>{wc(()=>{rn==="restoring"&&(r.style.webkitUserSelect==="none"&&(r.style.webkitUserSelect=lo||""),lo="",rn="default")})},300)}else if(t&&Ps.has(t)){const o=Ps.get(t);t.style.userSelect==="none"&&(t.style.userSelect=o??""),t.getAttribute("style")===""&&t.removeAttribute("style"),Ps.delete(t)}}function If(e={}){const{defer:t,target:n,...s}=e,r=t?pe:i=>i(),o=[];return o.push(r(()=>{const i=typeof n=="function"?n():n;o.push($f({...s,target:i}))})),()=>{o.forEach(i=>i?.())}}function Tf(e,t){return Array.from(e?.querySelectorAll(t)??[])}function Cf(e,t){return e?.querySelector(t)??null}var Ko=e=>e.id;function kf(e,t,n=Ko){return e.find(s=>n(s)===t)}function Af(e,t,n=Ko){const s=kf(e,t,n);return s?e.indexOf(s):-1}function Lf(e,t){const{rootEl:n,...s}=t||{};!e||!n||Sf(n)&&e.scrollIntoView(s)}var Wi,Of=()=>Wi??(Wi=new Intl.Collator(void 0,{usage:"search",sensitivity:"base"})),Mf=e=>e.normalize("NFC").trim(),Df=e=>Mf(e.dataset?.valuetext??e.textContent??""),Rf=(e,t)=>{const n=t.normalize("NFC");return Of().compare(e.slice(0,n.length),n)===0};function Pf(e,t,n,s=Ko){const r=n?Af(e,n,s):-1;let o=n?Eu(e,r):e;return t.length===1&&(o=o.filter(a=>s(a)!==n)),o.find(a=>Rf(Df(a),t))}function Vf(e,t){if(!e)return Ys;const n=Object.keys(t).reduce((s,r)=>(s[r]=e.style.getPropertyValue(r),s),{});return Nf(n,t)?Ys:(Object.assign(e.style,t),()=>{Object.assign(e.style,n),e.style.length===0&&e.removeAttribute("style")})}function Nf(e,t){return Object.keys(e).every(n=>e[n]===t[n])}function Ff(e,t){const{state:n,activeId:s,key:r,timeout:o=350,itemToId:i}=t,a=n.keysSoFar+r,c=a.length>1&&Array.from(a).every(g=>g===a[0])?a[0]:a;let f=e.slice();const u=Pf(f,c,s,i);function h(){clearTimeout(n.timer),n.timer=-1}function p(g){n.keysSoFar=g,h(),g!==""&&(n.timer=+setTimeout(()=>{p(""),h()},o))}return p(a),u}var uo=Object.assign(Ff,{defaultOptions:{keysSoFar:"",timer:-1},isValidEvent:Hf});function Hf(e){return e.key.length===1&&!e.ctrlKey&&!e.metaKey}var _f={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 l=setTimeout(()=>{a(new Error(`Timeout of ${n}ms exceeded`))},n);s.addEventListener("abort",()=>{clearTimeout(l),a(new DOMException("Promise aborted","AbortError"))}),e.then(c=>{s.aborted||(clearTimeout(l),i(c))}).catch(c=>{s.aborted||(clearTimeout(l),a(c))})}),()=>t.abort()]}function jf(e,t){const{timeout:n,rootNode:s}=t,r=me(s),o=Me(s),i=new r.AbortController;let a;const l=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),c=()=>a?.disconnect();return l[0].then(c,c),l}var Wf=vf({});function Uf(e,t,n={}){const{defer:s,onMissing:r,getRootNode:o}=n,i=()=>typeof e=="function"?e():e,a=[],l=c=>{if(!c)return r?.();a.push(t(c))};if(!s)l(i());else{let c=!1;a.push(()=>{c=!0}),queueMicrotask(()=>{if(c)return;const f=i();if(f){l(f);return}let u=!1;const h=m=>{c||u||(u=!0,g(),d(),l(m))},p=o?.(),g=p?Wf.observe(p,()=>{const m=i();m&&h(m)}):Ys,d=pe(()=>h(i()));a.push(g,d)})}return()=>{a.forEach(c=>c?.())}}function qf(e){return!(e.metaKey||!Uo()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}var Gf=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),Yf=["a[href]","audio[controls]","button","details","embed","iframe","img[controls]","img[usemap]","input","select","textarea","video[controls]"].join(",");function Kf(e,t,n){const s=n?ft(n):null,r=Me(s),o=me(s),i=dr(r);return e=e||i instanceof o.HTMLInputElement&&!Gf.has(i?.type)||i instanceof o.HTMLTextAreaElement||i instanceof o.HTMLElement&&i.isContentEditable,!(e&&t==="keyboard"&&n instanceof o.KeyboardEvent&&!Reflect.has(Zf,n.key))}var ht=null,fo=new Set,Ks=new Map,jt=!1,xt=null,ho=!1,Vr=null,zf=!1,Zf={Tab:!0,Escape:!0};function fr(e,t){for(let n of fo)n(e,t)}function zs(e){xt=null,jt=!0,qf(e)&&(ht="keyboard",fr("keyboard",e))}function Ce(e){(e.type==="pointermove"||e.type==="mousemove")&&e.isTrusted&&Vr?.x===e.clientX&&Vr?.y===e.clientY||(Vr={x:e.clientX,y:e.clientY},ht="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(xt=null,jt=!0,fr("pointer",e)))}function xc(e){if(zu(e)){xt=null,jt=!0,ht="virtual";return}xt=null;const t=ft(e),n=t?.closest("label"),s=n?.control;if(!n||!s||s.matches(":disabled"))return;const r=t?.closest(Yf);r&&n.contains(r)&&r!==s||s!==dr(n.ownerDocument)&&(xt=s)}function Sc(e){const t=ft(e),n=t===xt;t===me(t)||t===Me(t)||zf||!e.isTrusted||(!jt&&!n&&!ho&&(ht="virtual",fr("virtual",e)),jt=!1,xt=null,ho=!1)}function $c(){jt=!1,xt=null,ho=!0}function Jf(e){try{return e.focus}catch{return}}function Xf(e){const t=e.HTMLElement.prototype;try{let s=function(){jt=!0,(r??i.call(this)).apply(this,arguments)};var n=s;const r=Jf(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 Qf(e){if(typeof window>"u"||Ks.get(me(e)))return;const t=me(e),n=Me(e),s=Xf(t);n.addEventListener("keydown",zs,!0),n.addEventListener("keyup",zs,!0),n.addEventListener("click",xc,!0),t.addEventListener("focus",Sc,!0),t.addEventListener("blur",$c,!1),typeof t.PointerEvent<"u"?(n.addEventListener("pointerdown",Ce,!0),n.addEventListener("pointermove",Ce,!0),n.addEventListener("pointerup",Ce,!0)):(n.addEventListener("mousedown",Ce,!0),n.addEventListener("mousemove",Ce,!0),n.addEventListener("mouseup",Ce,!0)),t.addEventListener("beforeunload",()=>{eh(e)},{once:!0}),Ks.set(t,s)}var eh=(e,t)=>{const n=me(e),s=Me(e),r=Ks.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",zs,!0),s.removeEventListener("keyup",zs,!0),s.removeEventListener("click",xc,!0),n.removeEventListener("focus",Sc,!0),n.removeEventListener("blur",$c,!1),typeof n.PointerEvent<"u"?(s.removeEventListener("pointerdown",Ce,!0),s.removeEventListener("pointermove",Ce,!0),s.removeEventListener("pointerup",Ce,!0)):(s.removeEventListener("mousedown",Ce,!0),s.removeEventListener("mousemove",Ce,!0),s.removeEventListener("mouseup",Ce,!0)),Ks.delete(n)}};function po(){return ht}function th(e){ht=e,fr(e,null)}function Ui(){return ht==="keyboard"||ht==="virtual"}function nh(e={}){const{isTextInput:t,autoFocus:n,onChange:s,root:r}=e;Qf(r),s?.({isFocusVisible:n||Ui(),modality:ht});const o=(i,a)=>{Kf(!!t,i,a)&&s?.({isFocusVisible:Ui(),modality:i})};return fo.add(o),()=>{fo.delete(o)}}const sh=["top","right","bottom","left"],Tt=Math.min,rt=Math.max,Zs=Math.round,ms=Math.floor,ot=e=>({x:e,y:e}),rh={left:"right",right:"left",bottom:"top",top:"bottom"};function Ic(e,t,n){return rt(e,Tt(t,n))}function pt(e,t){return typeof e=="function"?e(t):e}function Ct(e){return e.split("-")[0]}function wn(e){return e.split("-")[1]}function zo(e){return e==="x"?"y":"x"}function Zo(e){return e==="y"?"height":"width"}function Be(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Jo(e){return zo(Be(e))}function oh(e,t,n){n===void 0&&(n=!1);const s=wn(e),r=Jo(e),o=Zo(r);let i=r==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=Js(i)),[i,Js(i)]}function ih(e){const t=Js(e);return[go(e),t,go(t)]}function go(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const qi=["left","right"],Gi=["right","left"],ah=["top","bottom"],ch=["bottom","top"];function lh(e,t,n){switch(e){case"top":case"bottom":return n?t?Gi:qi:t?qi:Gi;case"left":case"right":return t?ah:ch;default:return[]}}function dh(e,t,n,s){const r=wn(e);let o=lh(Ct(e),n==="start",s);return r&&(o=o.map(i=>i+"-"+r),t&&(o=o.concat(o.map(go)))),o}function Js(e){const t=Ct(e);return rh[t]+e.slice(t.length)}function uh(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 Tc(e){return typeof e!="number"?uh(e):{top:e,right:e,bottom:e,left:e}}function Xs(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 Yi(e,t,n){let{reference:s,floating:r}=e;const o=Be(t),i=Jo(t),a=Zo(i),l=Ct(t),c=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(l){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 g=wn(t);return g&&(p[i]+=h*(g==="end"?1:-1)*(n&&c?-1:1)),p}async function fh(e,t){var n;t===void 0&&(t={});const{x:s,y:r,platform:o,rects:i,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:h=!1,padding:p=0}=pt(t,e),g=Tc(p),m=a[h?u==="floating"?"reference":"floating":u],y=Xs(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(m)))==null||n?m:m.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:f,strategy:l})),$=u==="floating"?{x:s,y:r,width:i.floating.width,height:i.floating.height}:i.reference,w=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),M=await(o.isElement==null?void 0:o.isElement(w))&&await(o.getScale==null?void 0:o.getScale(w))||{x:1,y:1},O=Xs(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:$,offsetParent:w,strategy:l}):$);return{top:(y.top-O.top+g.top)/M.y,bottom:(O.bottom-y.bottom+g.bottom)/M.y,left:(y.left-O.left+g.left)/M.x,right:(O.right-y.right+g.right)/M.x}}const hh=50,ph=async(e,t,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:o=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:fh},l=await(i.isRTL==null?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:f,y:u}=Yi(c,s,l),h=s,p=0;const g={};for(let d=0;d<o.length;d++){const m=o[d];if(!m)continue;const{name:y,fn:$}=m,{x:w,y:M,data:O,reset:R}=await $({x:f,y:u,initialPlacement:s,placement:h,strategy:r,middlewareData:g,rects:c,platform:a,elements:{reference:e,floating:t}});f=w??f,u=M??u,g[y]={...g[y],...O},R&&p<hh&&(p++,typeof R=="object"&&(R.placement&&(h=R.placement),R.rects&&(c=R.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):R.rects),{x:f,y:u}=Yi(c,h,l)),d=-1)}return{x:f,y:u,placement:h,strategy:r,middlewareData:g}},gh=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:r,rects:o,platform:i,elements:a,middlewareData:l}=t,{element:c,padding:f=0}=pt(e,t)||{};if(c==null)return{};const u=Tc(f),h={x:n,y:s},p=Jo(r),g=Zo(p),d=await i.getDimensions(c),m=p==="y",y=m?"top":"left",$=m?"bottom":"right",w=m?"clientHeight":"clientWidth",M=o.reference[g]+o.reference[p]-h[p]-o.floating[g],O=h[p]-o.reference[p],R=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c));let E=R?R[w]:0;(!E||!await(i.isElement==null?void 0:i.isElement(R)))&&(E=a.floating[w]||o.floating[g]);const T=M/2-O/2,x=E/2-d[g]/2-1,C=Tt(u[y],x),b=Tt(u[$],x),A=E-d[g]-b,D=E/2-d[g]/2+T,V=Ic(C,D,A),H=!l.arrow&&wn(r)!=null&&D!==V&&o.reference[g]/2-(D<C?C:b)-d[g]/2<0,z=H?D<C?D-C:D-A:0;return{[p]:h[p]+z,data:{[p]:V,centerOffset:D-V-z,...H&&{alignmentOffset:z}},reset:H}}}),mh=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:l,elements:c}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:d=!0,...m}=pt(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const y=Ct(r),$=Be(a),w=Ct(a)===a,M=await(l.isRTL==null?void 0:l.isRTL(c.floating)),O=h||(w||!d?[Js(a)]:ih(a)),R=g!=="none";!h&&R&&O.push(...dh(a,d,g,M));const E=[a,...O],T=await l.detectOverflow(t,m),x=[];let C=((s=o.flip)==null?void 0:s.overflows)||[];if(f&&x.push(T[y]),u){const V=oh(r,i,M);x.push(T[V[0]],T[V[1]])}if(C=[...C,{placement:r,overflows:x}],!x.every(V=>V<=0)){var b,A;const V=(((b=o.flip)==null?void 0:b.index)||0)+1,H=E[V];if(H&&(!(u==="alignment"?$!==Be(H):!1)||C.every(Z=>Be(Z.placement)===$?Z.overflows[0]>0:!0)))return{data:{index:V,overflows:C},reset:{placement:H}};let z=(A=C.filter(re=>re.overflows[0]<=0).sort((re,Z)=>re.overflows[1]-Z.overflows[1])[0])==null?void 0:A.placement;if(!z)switch(p){case"bestFit":{var D;const re=(D=C.filter(Z=>{if(R){const W=Be(Z.placement);return W===$||W==="y"}return!0}).map(Z=>[Z.placement,Z.overflows.filter(W=>W>0).reduce((W,be)=>W+be,0)]).sort((Z,W)=>Z[1]-W[1])[0])==null?void 0:D[0];re&&(z=re);break}case"initialPlacement":z=a;break}if(r!==z)return{reset:{placement:z}}}return{}}}};function Ki(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function zi(e){return sh.some(t=>e[t]>=0)}const vh=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:r="referenceHidden",...o}=pt(e,t);switch(r){case"referenceHidden":{const i=await s.detectOverflow(t,{...o,elementContext:"reference"}),a=Ki(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:zi(a)}}}case"escaped":{const i=await s.detectOverflow(t,{...o,altBoundary:!0}),a=Ki(i,n.floating);return{data:{escapedOffsets:a,escaped:zi(a)}}}default:return{}}}}},Cc=new Set(["left","top"]);async function yh(e,t){const{placement:n,platform:s,elements:r}=e,o=await(s.isRTL==null?void 0:s.isRTL(r.floating)),i=Ct(n),a=wn(n),l=Be(n)==="y",c=Cc.has(i)?-1:1,f=o&&l?-1:1,u=pt(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:g}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof g=="number"&&(p=a==="end"?g*-1:g),l?{x:p*f,y:h*c}:{x:h*c,y:p*f}}const bh=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,l=await yh(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:r+l.x,y:o+l.y,data:{...l,placement:i}}}}},wh=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:l={fn:$=>{let{x:w,y:M}=$;return{x:w,y:M}}},...c}=pt(e,t),f={x:n,y:s},u=await o.detectOverflow(t,c),h=Be(r),p=zo(h);let g=f[p],d=f[h];const m=($,w)=>Ic(w+u[$==="y"?"top":"left"],w,w-u[$==="y"?"bottom":"right"]);i&&(g=m(p,g)),a&&(d=m(h,d));const y=l.fn({...t,[p]:g,[h]:d});return{...y,data:{x:y.x-n,y:y.y-s,enabled:{[p]:i,[h]:a}}}}}},Eh=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,s;const{x:r,y:o,placement:i,rects:a,middlewareData:l}=t,{offset:c=0,mainAxis:f=!0,crossAxis:u=!0}=pt(e,t),h={x:r,y:o},p=Be(i),g=zo(p);let d=h[g],m=h[p];const y=pt(c,t),$=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:(n=y.mainAxis)!=null?n:0,crossAxis:(s=y.crossAxis)!=null?s:0};if(f){const O=g==="y"?"height":"width",R=a.reference[g]-a.floating[O]+$.mainAxis,E=a.reference[g]+a.reference[O]-$.mainAxis;d<R?d=R:d>E&&(d=E)}if(u){var w,M;const O=g==="y"?"width":"height",R=Cc.has(Ct(i)),E=a.reference[p]-a.floating[O]+(R&&((w=l.offset)==null?void 0:w[p])||0)+(R?0:$.crossAxis),T=a.reference[p]+a.reference[O]+(R?0:((M=l.offset)==null?void 0:M[p])||0)-(R?$.crossAxis:0);m<E?m=E:m>T&&(m=T)}return{[g]:d,[p]:m}}}},xh=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}=pt(e,t),l=await r.detectOverflow(t,a),c=Ct(n),f=wn(n),u=Be(n)==="y",{width:h,height:p}=s.floating;let g,d;c==="top"||c==="bottom"?(g=c,d=f===(await(r.isRTL==null?void 0:r.isRTL(o.floating))?"start":"end")?"left":"right"):(d=c,g=f==="end"?"top":"bottom");const m=p-l.top-l.bottom,y=h-l.left-l.right,$=Tt(p-l[g],m),w=Tt(h-l[d],y),M=t.middlewareData.shift,O=!M;let R=$,E=w;M!=null&&M.enabled.x&&(E=y),M!=null&&M.enabled.y&&(R=m),O&&!f&&(u?E=h-2*rt(l.left,l.right):R=p-2*rt(l.top,l.bottom)),await i({...t,availableWidth:E,availableHeight:R});const T=await r.getDimensions(o.floating);return h!==T.width||p!==T.height?{reset:{rects:!0}}:{}}}};function hr(){return typeof window<"u"}function En(e){return kc(e)?(e.nodeName||"").toLowerCase():"#document"}function Ee(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function mt(e){var t;return(t=(kc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function kc(e){return hr()?e instanceof Node||e instanceof Ee(e).Node:!1}function qe(e){return hr()?e instanceof Element||e instanceof Ee(e).Element:!1}function Lt(e){return hr()?e instanceof HTMLElement||e instanceof Ee(e).HTMLElement:!1}function Zi(e){return!hr()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ee(e).ShadowRoot}function pr(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 Sh(e){return/^(table|td|th)$/.test(En(e))}function gr(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const $h=/transform|translate|scale|rotate|perspective|filter/,Ih=/paint|layout|strict|content/,Vt=e=>!!e&&e!=="none";let Nr;function Xo(e){const t=qe(e)?Ge(e):e;return Vt(t.transform)||Vt(t.translate)||Vt(t.scale)||Vt(t.rotate)||Vt(t.perspective)||!Qo()&&(Vt(t.backdropFilter)||Vt(t.filter))||$h.test(t.willChange||"")||Ih.test(t.contain||"")}function Th(e){let t=Wt(e);for(;Lt(t)&&!Jn(t);){if(Xo(t))return t;if(gr(t))return null;t=Wt(t)}return null}function Qo(){return Nr==null&&(Nr=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Nr}function Jn(e){return/^(html|body|#document)$/.test(En(e))}function Ge(e){return Ee(e).getComputedStyle(e)}function mr(e){return qe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Wt(e){if(En(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Zi(e)&&e.host||mt(e);return Zi(t)?t.host:t}function Ac(e){const t=Wt(e);return Jn(t)?(e.ownerDocument||e).body:Lt(t)&&pr(t)?t:Ac(t)}function Xn(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=Ac(e),o=r===((s=e.ownerDocument)==null?void 0:s.body),i=Ee(r);if(o){const a=mo(i);return t.concat(i,i.visualViewport||[],pr(r)?r:[],a&&n?Xn(a):[])}else return t.concat(r,Xn(r,[],n))}function mo(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Lc(e){const t=Ge(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const r=Lt(e),o=r?e.offsetWidth:n,i=r?e.offsetHeight:s,a=Zs(n)!==o||Zs(s)!==i;return a&&(n=o,s=i),{width:n,height:s,$:a}}function ei(e){return qe(e)?e:e.contextElement}function an(e){const t=ei(e);if(!Lt(t))return ot(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:o}=Lc(t);let i=(o?Zs(n.width):n.width)/s,a=(o?Zs(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const Ch=ot(0);function Oc(e){const t=Ee(e);return!Qo()||!t.visualViewport?Ch:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function kh(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Ee(e)}function Ut(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=ei(e);let i=ot(1);t&&(s?qe(s)&&(i=an(s)):i=an(e));const a=kh(o,n,s)?Oc(o):ot(0);let l=(r.left+a.x)/i.x,c=(r.top+a.y)/i.y,f=r.width/i.x,u=r.height/i.y;if(o&&s){const h=Ee(o),p=qe(s)?Ee(s):s;let g=h,d=mo(g);for(;d&&p!==g;){const m=an(d),y=d.getBoundingClientRect(),$=Ge(d),w=y.left+(d.clientLeft+parseFloat($.paddingLeft))*m.x,M=y.top+(d.clientTop+parseFloat($.paddingTop))*m.y;l*=m.x,c*=m.y,f*=m.x,u*=m.y,l+=w,c+=M,g=Ee(d),d=mo(g)}}return Xs({width:f,height:u,x:l,y:c})}function vr(e,t){const n=mr(e).scrollLeft;return t?t.left+n:Ut(mt(e)).left+n}function Mc(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-vr(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?gr(t.floating):!1;if(s===i||a&&o)return n;let l={scrollLeft:0,scrollTop:0},c=ot(1);const f=ot(0),u=Lt(s);if((u||!o)&&((En(s)!=="body"||pr(i))&&(l=mr(s)),u)){const p=Ut(s);c=an(s),f.x=p.x+s.clientLeft,f.y=p.y+s.clientTop}const h=i&&!u&&!o?Mc(i,l):ot(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+f.x+h.x,y:n.y*c.y-l.scrollTop*c.y+f.y+h.y}}function Lh(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Oh(e){const t=mr(e),n=e.ownerDocument.body,s=rt(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=rt(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let o=-t.scrollLeft+vr(e);const i=-t.scrollTop;return Ge(n).direction==="rtl"&&(o+=rt(e.clientWidth,n.clientWidth)-s),{width:s,height:r,x:o,y:i}}const Mh=25;function Dh(e,t,n){n===void 0&&(n="viewport");const s=n==="layoutViewport",r=Ee(e),o=mt(e),i=r.visualViewport;let a=o.clientWidth,l=o.clientHeight,c=0,f=0;if(i){const h=!Qo()||t==="fixed";s?h||(c=-i.offsetLeft,f=-i.offsetTop):(a=i.width,l=i.height,h&&(c=i.offsetLeft,f=i.offsetTop))}if(vr(o)<=0){const h=o.ownerDocument,p=h.body,g=getComputedStyle(p),d=h.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,m=Math.abs(o.clientWidth-p.clientWidth-d),y=getComputedStyle(o).scrollbarGutter==="stable both-edges"?m/2:m;y<=Mh&&(a-=y)}return{width:a,height:l,x:c,y:f}}function Rh(e,t){const n=Ut(e,!0,t==="fixed"),s=n.top+e.clientTop,r=n.left+e.clientLeft,o=an(e),i=e.clientWidth*o.x,a=e.clientHeight*o.y,l=r*o.x,c=s*o.y;return{width:i,height:a,x:l,y:c}}function Ji(e,t,n){let s;if(t==="viewport"||t==="layoutViewport")s=Dh(e,n,t);else if(t==="document")s=Oh(mt(e));else if(qe(t))s=Rh(t,n);else{const r=Oc(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Xs(s)}function Ph(e,t){const n=t.get(e);if(n)return n;let s=Xn(e,[],!1).filter(a=>qe(a)&&En(a)!=="body"),r=null;const o=Ge(e).position==="fixed";let i=o?Wt(e):e;for(;qe(i)&&!Jn(i);){const a=Ge(i),l=Xo(i),c=r?r.position:o?"fixed":"";!l&&(c==="fixed"||c==="absolute"&&a.position==="static")?s=s.filter(u=>u!==i):r=a,i=Wt(i)}return t.set(e,s),s}function Vh(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const i=[...n==="clippingAncestors"?gr(t)?[]:Ph(t,this._c):[].concat(n),s],a=Ji(t,i[0],r);let l=a.top,c=a.right,f=a.bottom,u=a.left;for(let h=1;h<i.length;h++){const p=Ji(t,i[h],r);l=rt(p.top,l),c=Tt(p.right,c),f=Tt(p.bottom,f),u=rt(p.left,u)}return{width:c-u,height:f-l,x:u,y:l}}function Nh(e){const{width:t,height:n}=Lc(e);return{width:t,height:n}}function Fh(e,t,n){const s=Lt(t),r=mt(t),o=n==="fixed",i=Ut(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=ot(0);if((s||!o)&&((En(t)!=="body"||pr(r))&&(a=mr(t)),s)){const h=Ut(t,!0,o,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}!s&&r&&(l.x=vr(r));const c=r&&!s&&!o?Mc(r,a):ot(0),f=i.left+a.scrollLeft-l.x-c.x,u=i.top+a.scrollTop-l.y-c.y;return{x:f,y:u,width:i.width,height:i.height}}function Fr(e){return Ge(e).position==="static"}function Xi(e,t){if(!Lt(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 Dc(e,t){const n=Ee(e);if(gr(e))return n;if(!Lt(e)){let r=Wt(e);for(;r&&!Jn(r);){if(qe(r)&&!Fr(r))return r;r=Wt(r)}return n}let s=Xi(e,t);for(;s&&Sh(s)&&Fr(s);)s=Xi(s,t);return s&&Jn(s)&&Fr(s)&&!Xo(s)?n:s||Th(e)||n}const Hh=async function(e){const t=this.getOffsetParent||Dc,n=this.getDimensions,s=await n(e.floating);return{reference:Fh(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function _h(e){return Ge(e).direction==="rtl"}const Bh={convertOffsetParentRelativeRectToViewportRelativeRect:Ah,getDocumentElement:mt,getClippingRect:Vh,getOffsetParent:Dc,getElementRects:Hh,getClientRects:Lh,getDimensions:Nh,getScale:an,isElement:qe,isRTL:_h};function Rc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function jh(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:g,width:d,height:m}=h;if(f||t(),!d||!m)return;const y=ms(g),$=ms(o.clientWidth-(p+d)),w=ms(o.clientHeight-(g+m)),M=ms(p),R={rootMargin:-y+"px "+-$+"px "+-w+"px "+-M+"px",threshold:rt(0,Tt(1,u))||1};let E=!0;function T(x){const C=x[0].intersectionRatio;if(!Rc(h,e.getBoundingClientRect()))return a();if(C!==u){if(!E)return a();C?a(!1,C):r=setTimeout(()=>{a(!1,1e-7)},1e3)}E=!1}try{s=new IntersectionObserver(T,{...R,root:o.ownerDocument})}catch{s=new IntersectionObserver(T,R)}s.observe(e)}const l=Ee(e),c=()=>a(n);return l.addEventListener("resize",c),a(!0),()=>{l.removeEventListener("resize",c),i()}}function Wh(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:l=!1}=s,c=ei(e),f=r||o?[...c?Xn(c):[],...t?Xn(t):[]]:[];f.forEach(y=>{r&&y.addEventListener("scroll",n),o&&y.addEventListener("resize",n)});const u=c&&a?jh(c,n,o):null;let h=-1,p=null;i&&(p=new ResizeObserver(y=>{let[$]=y;$&&$.target===c&&p&&t&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(t)})),n()}),c&&!l&&p.observe(c),t&&p.observe(t));let g,d=l?Ut(e):null;l&&m();function m(){const y=Ut(e);d&&!Rc(d,y)&&n(),d=y,g=requestAnimationFrame(m)}return n(),()=>{var y;f.forEach($=>{r&&$.removeEventListener("scroll",n),o&&$.removeEventListener("resize",n)}),u?.(),(y=p)==null||y.disconnect(),p=null,l&&cancelAnimationFrame(g)}}const Uh=bh,qh=wh,Gh=mh,Yh=xh,Kh=vh,zh=gh,Zh=Eh,Jh=(e,t,n)=>{const s=new Map,r=n??{},o={...Bh,...r.platform,_c:s};return ph(e,t,{...r,platform:o})};function Qi(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 Xh(e){if(!e)return Qi();const{x:t,y:n,width:s,height:r}=e;return Qi(t,n,s,r)}function Qh(e,t){return{contextElement:fe(e)?e:e?.contextElement,getBoundingClientRect:()=>{const n=e,s=t?.(n);return s||!n?Xh(s):n.getBoundingClientRect()}}}var An=e=>({variable:e,reference:`var(${e})`}),Qe={arrowSize:An("--arrow-size"),arrowSizeHalf:An("--arrow-size-half"),arrowBg:An("--arrow-background"),transformOrigin:An("--transform-origin"),arrowOffset:An("--arrow-offset")},ep=e=>e==="top"||e==="bottom"?"y":"x";function tp(e,t){return{name:"transformOrigin",fn(n){const{elements:s,middlewareData:r,placement:o,rects:i,y:a}=n,l=o.split("-")[0],c=ep(l),f=r.arrow?.x||0,u=r.arrow?.y||0,h=t?.clientWidth||0,p=t?.clientHeight||0,g=f+h/2,d=u+p/2,m=Math.abs(r.shift?.y||0),y=i.reference.height/2,$=p/2,w=e.offset?.mainAxis??e.gutter,M=typeof w=="number"?w+$:w??$,O=m>M,R={top:`${g}px calc(100% + ${M}px)`,bottom:`${g}px ${-M}px`,left:`calc(100% + ${M}px) ${d}px`,right:`${-M}px ${d}px`}[l],E=`${g}px ${i.reference.y+y-a}px`,T=!!e.overlap&&c==="y"&&O;return s.floating.style.setProperty(Qe.transformOrigin.variable,T?E:R),{data:{transformOrigin:T?E:R}}}}}var np={name:"rects",fn({rects:e}){return{data:e}}},sp=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% + ${Qe.arrowOffset.reference})`}),{}}}};function rp(e){const[t,n]=e.split("-");return{side:t,align:n,hasAlign:n!=null}}function Pc(e){return e.split("-")[0]}var op={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 ea(e,t){const n=e.devicePixelRatio||1;return Math.round(t*n)/n}function on(e,t){return e!=null&&Math.abs(e-t)<.5}function yr(e){return typeof e=="function"?e():e==="clipping-ancestors"?"clippingAncestors":e}function ip(e,t,n){const s=e||t.createElement("div");return zh({element:s,padding:n.arrowPadding})}function ap(e,t){if(!iu(t.offset??t.gutter))return Uh(({placement:n})=>{const s=(e?.clientHeight||0)/2,r=t.offset?.mainAxis??t.gutter,o=typeof r=="number"?r+s:r??s,{hasAlign:i}=rp(n),a=i?void 0:t.shift,l=t.offset?.crossAxis??a;return _o({crossAxis:l,mainAxis:o,alignmentAxis:t.shift})})}function cp(e){if(e.flip)return Gh(()=>{const t=yr(e.boundary);return{...t?{boundary:t}:void 0,padding:e.overflowPadding,fallbackPlacements:e.flip===!0?void 0:e.flip}})}function lp(e){if(!(!e.slide&&!e.overlap))return qh(()=>{const t=yr(e.boundary);return{...t?{boundary:t}:void 0,mainAxis:e.slide,crossAxis:e.overlap,padding:e.overflowPadding,limiter:Zh()}})}function dp(e){if(e.sizeMiddleware===!1&&!e.sameWidth&&!e.fitViewport)return;let t,n,s,r;return Yh(()=>{const o=yr(e.boundary);return{padding:e.overflowPadding,...o?{boundary:o}:void 0,apply({elements:i,rects:a,availableHeight:l,availableWidth:c}){const f=i.floating,u=Math.round(a.reference.width),h=Math.round(a.reference.height);c=Math.floor(c),l=Math.floor(l),on(t,u)||(f.style.setProperty("--reference-width",`${u}px`),t=u),on(n,h)||(f.style.setProperty("--reference-height",`${h}px`),n=h),on(s,c)||(f.style.setProperty("--available-width",`${c}px`),s=c),on(r,l)||(f.style.setProperty("--available-height",`${l}px`),r=l)}}})}function up(e){if(e.hideWhenDetached)return Kh(()=>({strategy:"referenceHidden",boundary:yr(e.boundary)??"clippingAncestors"}))}function fp(e){return e?e===!0?{ancestorResize:!0,ancestorScroll:!0,elementResize:!0,layoutShift:!0}:e:{}}var hp=["transform","visibility","pointer-events","--x","--y","--z-index","z-index","--reference-width","--reference-height","--available-width","--available-height","--transform-origin"],pp=["top","right","bottom","left"],Bn=new WeakSet;function gp(e,t){const n=e.style.getPropertyValue("z-index"),s=Bn.has(e),r=s&&n==="var(--z-index)";s&&!r&&Bn.delete(e);const o=pc(t).zIndex;if(o==="auto"){r&&(e.style.removeProperty("z-index"),Bn.delete(e));return}n&&!r||(e.style.setProperty("--z-index",o),e.style.setProperty("z-index","var(--z-index)"),Bn.add(e))}function ta(e,t){if(!e)return rc;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 na(e){return e==null?null:fe(e)?e:typeof e=="object"&&e&&"contextElement"in e&&e.contextElement?e.contextElement:e}function mp(e,t,n={}){const s=()=>(typeof t=="function"?t():t)??null,r=()=>{const C=typeof e=="function"?e():e;return n.getAnchorElement?.()??C},o=()=>{const C=r();return!C&&!n.getAnchorRect?null:Qh(C,n.getAnchorRect)},i=Object.assign({},op,n);let a=[],l=null,c,f;function u(C){if(c?.(),f?.(),l=C,i.restoreStyles){const A=ta(C,hp);c=()=>{A(),Bn.delete(C)}}else c=void 0;const b=C.querySelector("[data-part=arrow]");f=i.restoreStyles?ta(b,pp):void 0,a=[ap(b,i),cp(i),lp(i),ip(b,C.ownerDocument,i),sp(b),tp({gutter:i.gutter,offset:i.offset,overlap:i.overlap},b),dp(i),up(i),np]}const{placement:h,strategy:p,onComplete:g,onPositioned:d}=i;let m,y,$=!1,w,M,O=rc;const R=fp(i.listeners);function E(){if(!i.listeners)return;const C=r(),b=o(),A=s();if(!b||!A)return;(na(C)!==na(w)||A!==M)&&(O(),w=C,M=A,O=Wh(b,A,x,R))}async function T(){E();const C=s();if(!C)return;C!==l&&(u(C),$=!1);const b=o();if(!b)return;const A=await Jh(b,C,{placement:h,middleware:a,strategy:p}),D=me(C),V=ea(D,A.x),H=ea(D,A.y);if(g?.({...A,x:V,y:H}),i.applyStyles!==!1&&(on(m,V)||(C.style.setProperty("--x",`${V}px`),m=V),on(y,H)||(C.style.setProperty("--y",`${H}px`),y=H),i.hideWhenDetached&&(A.middlewareData.hide?.referenceHidden?(C.style.setProperty("visibility","hidden"),C.style.setProperty("pointer-events","none")):(C.style.removeProperty("visibility"),C.style.removeProperty("pointer-events"))),!$)){const z=C.firstElementChild;z&&(gp(C,z),$=!0)}}async function x(){n.updatePosition?(await n.updatePosition({updatePosition:T,floatingElement:s()}),d?.({placed:!0})):await T()}return x(),()=>{O(),f?.(),c?.(),d?.({placed:!1})}}function vo(e,t,n={}){const{defer:s,...r}=n,o=s?pe:a=>a(),i=[];return i.push(o(()=>{i.push(mp(e,t,r))})),()=>{i.forEach(a=>a?.())}}var vp={bottom:"rotate(45deg)",left:"rotate(135deg)",top:"rotate(225deg)",right:"rotate(315deg)"};function Vc(e={}){const{placement:t,sameWidth:n,fitViewport:s,strategy:r="absolute",applyStyles:o=!0}=e;return{arrow:{position:"absolute",width:Qe.arrowSize.reference,height:Qe.arrowSize.reference,[Qe.arrowSizeHalf.variable]:`calc(${Qe.arrowSize.reference} / 2)`,[Qe.arrowOffset.variable]:`calc(${Qe.arrowSizeHalf.reference} * -1)`},arrowTip:{transform:t?vp[t.split("-")[0]]:void 0,background:Qe.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 yp=e=>e.ids?.root??`select:${e.id}`,yo=e=>e.ids?.content??`select:${e.id}:content`,bo=e=>e.ids?.trigger??`select:${e.id}:trigger`,Nc=e=>e.ids?.clearTrigger??`select:${e.id}:clear-trigger`,vs=e=>e.ids?.label??`select:${e.id}:label`,bp=e=>e.ids?.control??`select:${e.id}:control`,wo=(e,t)=>e.ids?.item?.(t)??`select:${e.id}:option:${t}`,Eo=e=>e.ids?.hiddenSelect??`select:${e.id}:select`,Fc=e=>e.ids?.positioner??`select:${e.id}:positioner`,wp=(e,t)=>e.ids?.itemGroup?.(t)??`select:${e.id}:optgroup:${t}`,sa=(e,t)=>e.ids?.itemGroupLabel?.(t)??`select:${e.id}:optgroup-label:${t}`,Hr=e=>e.getById(Eo(e)),Ln=e=>e.getById(yo(e)),_t=e=>e.getById(bo(e)),Ep=e=>e.getById(Nc(e)),_r=e=>e.getById(Fc(e)),Br=(e,t)=>t==null?null:e.getById(wo(e,t)),xp={clearTriggerLabel:"Clear value"};function Sp(e,t){const{context:n,prop:s,scope:r,state:o,computed:i,send:a}=e,l=ic(xp,s("translations")),c=s("disabled")||n.get("fieldsetDisabled"),f=!!s("invalid"),u=!!s("required"),h=!!s("readOnly"),p=s("composite"),g=s("collection"),d=o.hasTag("open"),m=o.matches("focused"),y=n.get("highlightedValue"),$=n.get("highlightedItem"),w=i("selectedItems"),M=n.get("currentPlacement"),O=M?Pc(M):void 0,R=i("isTypingAhead"),E=i("isInteractive"),T=y?wo(r,y):void 0;function x(b){const A=g.getItemDisabled(b.item),D=g.getItemValue(b.item);return cr(D,()=>`[zag-js] No value found for item ${JSON.stringify(b.item)}`),{value:D,disabled:!!(c||A),highlighted:y===D,selected:n.get("value").includes(D)}}const C=Vc({...s("positioning"),placement:M});return{open:d,focused:m,empty:n.get("value").length===0,highlightedItem:$,highlightedValue:y,selectedItems:w,hasSelectedItems:i("hasSelectedItems"),value:n.get("value"),valueAsString:i("valueAsString"),collection:g,multiple:!!s("multiple"),disabled:!!c,reposition(b={}){a({type:"POSITIONING.SET",options:b})},focus(){_t(r)?.focus({preventScroll:!0})},setOpen(b){a({type:b?"OPEN":"CLOSE",replaces:"open"})},selectValue(b){a({type:"ITEM.SELECT",value:b})},setValue(b){a({type:"VALUE.SET",value:b})},selectAll(){a({type:"VALUE.SET",value:g.getValues()})},setHighlightValue(b){a({type:"HIGHLIGHTED_VALUE.SET",value:b})},clearHighlightValue(){a({type:"HIGHLIGHTED_VALUE.CLEAR"})},clearValue(b){a(b?{type:"ITEM.CLEAR",value:b}:{type:"VALUE.CLEAR"})},getItemState:x,getRootProps(){return t.element({...ve.root.attrs,dir:s("dir"),id:yp(r),"data-invalid":P(f),"data-readonly":P(h)})},getLabelProps(){return t.label({dir:s("dir"),id:vs(r),...ve.label.attrs,"data-disabled":P(c),"data-invalid":P(f),"data-readonly":P(h),"data-required":P(u),htmlFor:Eo(r),onClick(b){b.defaultPrevented||c||_t(r)?.focus({preventScroll:!0})}})},getControlProps(){return t.element({...ve.control.attrs,dir:s("dir"),id:bp(r),"data-state":d?"open":"closed","data-focus":P(m),"data-disabled":P(c),"data-invalid":P(f)})},getValueTextProps(){return t.element({...ve.valueText.attrs,dir:s("dir"),"data-disabled":P(c),"data-invalid":P(f),"data-focus":P(m)})},getTriggerProps(){return t.button({id:bo(r),disabled:c,dir:s("dir"),type:"button",role:"combobox","aria-controls":yo(r),"aria-expanded":d,"aria-haspopup":"listbox","data-state":d?"open":"closed","aria-invalid":f,"aria-required":u,"aria-labelledby":vs(r),...ve.trigger.attrs,"data-disabled":P(c),"data-invalid":P(f),"data-readonly":P(h),"data-placement":M,"data-side":O,"data-placeholder-shown":P(!i("hasSelectedItems")),onClick(b){E&&(b.defaultPrevented||a({type:"TRIGGER.CLICK"}))},onFocus(){a({type:"TRIGGER.FOCUS"})},onBlur(){a({type:"TRIGGER.BLUR"})},onKeyDown(b){if(b.defaultPrevented||!E)return;const D={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(R?{type:"TRIGGER.TYPEAHEAD",key:V.key}:{type:"TRIGGER.ENTER"})}}[ao(b,{dir:s("dir"),orientation:"vertical"})];if(D){D(b),b.preventDefault();return}uo.isValidEvent(b)&&(a({type:"TRIGGER.TYPEAHEAD",key:b.key}),b.preventDefault())}})},getIndicatorProps(){return t.element({...ve.indicator.attrs,dir:s("dir"),"aria-hidden":!0,"data-state":d?"open":"closed","data-disabled":P(c),"data-invalid":P(f),"data-readonly":P(h)})},getItemProps(b){const A=x(b);return t.element({id:wo(r,A.value),role:"option",...ve.item.attrs,dir:s("dir"),"data-value":A.value,"aria-selected":A.selected,"data-state":A.selected?"checked":"unchecked","data-highlighted":P(A.highlighted),"data-disabled":P(A.disabled),"aria-disabled":he(A.disabled),onPointerMove(D){A.disabled||D.pointerType!=="mouse"||po()==="pointer"&&A.value!==y&&a({type:"ITEM.POINTER_MOVE",value:A.value})},onClick(D){D.defaultPrevented||A.disabled||a({type:"ITEM.CLICK",src:"pointerup",value:A.value})},onPointerLeave(D){A.disabled||b.persistFocus||D.pointerType==="mouse"&&po()==="pointer"&&a({type:"ITEM.POINTER_LEAVE"})}})},getItemTextProps(b){const A=x(b);return t.element({...ve.itemText.attrs,"data-state":A.selected?"checked":"unchecked","data-disabled":P(A.disabled),"data-highlighted":P(A.highlighted)})},getItemIndicatorProps(b){const A=x(b);return t.element({"aria-hidden":!0,...ve.itemIndicator.attrs,"data-state":A.selected?"checked":"unchecked",hidden:!A.selected})},getItemGroupLabelProps(b){const{htmlFor:A}=b;return t.element({...ve.itemGroupLabel.attrs,id:sa(r,A),dir:s("dir"),role:"presentation"})},getItemGroupProps(b){const{id:A}=b;return t.element({...ve.itemGroup.attrs,"data-disabled":P(c),id:wp(r,A),"aria-labelledby":sa(r,A),role:"group",dir:s("dir")})},getClearTriggerProps(){return t.button({...ve.clearTrigger.attrs,id:Nc(r),type:"button","aria-label":l.clearTriggerLabel,"data-invalid":P(f),disabled:c,hidden:!i("hasSelectedItems"),dir:s("dir"),onClick(b){b.defaultPrevented||a({type:"CLEAR.CLICK"})}})},getHiddenSelectProps(){const b=n.get("value"),A=s("multiple")?b:b?.[0],D=V=>{const H=qo(V);vc(H)||a({type:"VALUE.SET",value:$p(V.currentTarget)})};return t.select({name:s("name"),form:s("form"),disabled:c,multiple:s("multiple"),required:s("required"),"aria-hidden":!0,id:Eo(r),defaultValue:A,style:_f,tabIndex:-1,autoComplete:s("autoComplete"),onChange:D,onInput:D,onFocus(){_t(r)?.focus({preventScroll:!0})},"aria-labelledby":vs(r)})},getPositionerProps(){return t.element({...ve.positioner.attrs,dir:s("dir"),id:Fc(r),style:C.floating})},getContentProps(){return t.element({hidden:!d,dir:s("dir"),id:yo(r),role:p?"listbox":"dialog",...ve.content.attrs,"data-state":d?"open":"closed","data-placement":M,"data-side":O,"data-activedescendant":T,"aria-activedescendant":p?T:void 0,"aria-multiselectable":s("multiple")&&p?!0:void 0,"aria-labelledby":vs(r),tabIndex:0,onKeyDown(b){if(!E||!hn(b.currentTarget,ft(b)))return;if(b.key==="Tab"&&!gf(b)){b.preventDefault();return}const A={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){R?a({type:"CONTENT.TYPEAHEAD",key:H.key}):A.Enter?.()}},D=A[ao(b)];if(D){D(b),b.preventDefault();return}const V=ft(b);Au(V)||uo.isValidEvent(b)&&(a({type:"CONTENT.TYPEAHEAD",key:b.key}),b.preventDefault())}})},getListProps(){return t.element({...ve.list.attrs,tabIndex:0,role:p?void 0:"listbox","aria-labelledby":bo(r),"aria-activedescendant":p?void 0:T,"aria-multiselectable":!p&&s("multiple")?!0:void 0})}}}var $p=e=>e.multiple?Array.from(e.selectedOptions,t=>t.value):e.value?[e.value]:[];function Ip(e,t,n){let s=[],r;return o=>{const i=e(o);return(i.length!==s.length||i.some((l,c)=>!bn(s[c],l)))&&(s=i,r=t(i,o)),r}}function Tp(){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 Ot=".",Hc="#",ra=new WeakMap,_c=new WeakMap;function xo(e){return e.join(Ot)}function Cp(e){return e.includes(Ot)}function Bc(e){return e.startsWith(Hc)}function kp(e){return e.startsWith(Ot)}function Ap(e){return Bc(e)?e.slice(Hc.length):e}function So(e,t){return e?`${e}${Ot}${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)&&Fi(`[zag-js] Duplicate state id: "${i}"`),n.set(i,r));const a=o.states;if(a){cr(o.initial,()=>`[zag-js] Compound state "${r}" has child states but no "initial" property`),o.initial in a||Fi(`[zag-js] Compound state "${r}" has initial "${String(o.initial)}" which is not a child state`);for(const[l,c]of Object.entries(a)){if(!c)continue;const f=So(r,l);s(f,c)}}};for(const[r,o]of Object.entries(e.states))o&&s(r,o);return{index:t,idIndex:n}}function rs(e){const t=ra.get(e);if(t)return t;const{index:n,idIndex:s}=Lp(e);return ra.set(e,n),_c.set(e,s),n}function Op(e,t){return rs(e),_c.get(e)?.get(t)}function ti(e){return e?String(e).split(Ot).filter(Boolean):[]}function Qs(e,t){if(!t)return[];const n=rs(e),s=ti(t),r=[],o=[];for(const i of s){o.push(i);const a=xo(o),l=n.get(a);if(!l)break;r.push({path:a,state:l})}return r}function On(e,t){const n=rs(e),s=ti(t);if(!s.length)return t;const r=[];for(const a of s){r.push(a);const l=xo(r);if(!n.has(l))return t}let o=xo(r),i=n.get(o);for(;i?.initial;){const a=`${o}${Ot}${i.initial}`,l=n.get(a);if(!l)break;o=a,i=l}return o}function oa(e,t){return rs(e).has(t)}function ia(e,t,n){const s=String(t);if(Bc(s)){const r=Ap(s),o=Op(e,r);return cr(o,()=>`[zag-js] Unknown state id: "${r}"`),On(e,o)}if(kp(s)&&n){const r=So(n,s.slice(1));return On(e,r)}if(!Cp(s)&&n){const r=ti(n);for(let o=r.length-1;o>=1;o--){const i=r.slice(0,o).join(Ot),a=So(i,s);if(oa(e,a))return On(e,a)}if(oa(e,s))return On(e,s)}return On(e,s)}function Mp(e,t,n){const s=Qs(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 Dp(e,t,n,s){const r=t?Qs(e,t):[],o=Qs(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(),l=o.slice(i);const c=r[r.length-1]?.path===o[o.length-1]?.path;return s&&c&&(a=r.slice().reverse(),l=o),{exiting:a,entering:l}}function Rp(e,t){return e?e===t||e.startsWith(`${t}${Ot}`):!1}function Pp(e,t,n){return Qs(e,t).some(s=>s.state.tags?.includes(n))}function jc(){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 Wc(e){return rs(e),e}var jn=(e=>(e.NotStarted="Not Started",e.Started="Started",e.Stopped="Stopped",e))(jn||{}),ys="__init__";function Vp(e){const t=()=>e.getRootNode?.()??document,n=()=>Me(t());return{...e,getRootNode:t,getDoc:n,getWin:()=>n().defaultView??window,getActiveElement:()=>dr(t()),isActiveElement:io,getById:i=>t().getElementById(i)}}function Np(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 Fp(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 aa="pointerdown.outside",ca="focus.outside";function Hp(e){for(const t of e)if(fe(t)&&ur(t))return!0;return!1}var Uc=e=>"clientY"in e;function _p(e,t){if(!Uc(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 la(e,t){if(!t||!Uc(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 jp(e,t){const{exclude:n,onFocusOutside:s,onPointerDownOutside:r,onInteractOutside:o,defer:i,followControlledElements:a=!0}=t;if(!e)return;const l=Me(e),c=me(e),f=Np(c),u=Fp(c);function h(O,R){if(!fe(R)||!R.isConnected||hn(e,R)||_p(e,O)||a&&Gu(e,R))return!1;const E=l.querySelector(`[aria-controls="${e.id}"]`);if(E){const x=co(E);if(la(O,x))return!1}const T=co(e);return la(O,T)?!1:!n?.(R)}const p=new Set,g=fn(e?.getRootNode());let d=!1;function m(O){d=!0;const R=()=>{d=!1};l.addEventListener("pointerup",R,{once:!0}),c.addEventListener("pointerup",R,{once:!0});function E(T){const x=i&&!_i()?pe:A=>A(),C=T??O,b=C?.composedPath?.()??[C?.target];x(()=>{const A=g?b[0]:ft(O);if(!(!e||!h(O,A))){if(r||o){const D=qs(r,o);e.addEventListener(aa,D,{once:!0})}da(e,aa,{bubbles:!1,cancelable:!0,detail:{originalEvent:C,contextmenu:Zu(C),focusable:Hp(b),target:A}})}})}O.pointerType==="touch"?(p.forEach(T=>T()),p.add(Rs(l,"click",E,{once:!0})),p.add(u.addEventListener("click",E,{once:!0})),p.add(f.addEventListener("click",E,{once:!0}))):E()}const y=new Set,$=setTimeout(()=>{y.add(Rs(l,"pointerdown",m,!0)),y.add(u.addEventListener("pointerdown",m,!0)),y.add(f.addEventListener("pointerdown",m,!0))},0),w=yc.create();function M(O){if(d)return;(i?E=>w.request(E):E=>E())(()=>{const E=O?.composedPath?.()??[O?.target],T=g?E[0]:ft(O);if(!(!e||!h(O,T))){if(s||o){const x=qs(s,o);e.addEventListener(ca,x,{once:!0})}da(e,ca,{bubbles:!1,cancelable:!0,detail:{originalEvent:O,contextmenu:!1,focusable:ur(T),target:T}})}})}return _i()||(y.add(Rs(l,"focusin",M,!0)),y.add(u.addEventListener("focusin",M,!0)),y.add(f.addEventListener("focusin",M,!0))),()=>{clearTimeout($),w.cancel(),p.forEach(O=>O()),y.forEach(O=>O())}}function Wp(e,t){const{defer:n}=t,s=n?pe:o=>o(),r=[];return r.push(s(()=>{const o=typeof e=="function"?e():e;r.push(jp(o,t))})),()=>{r.forEach(o=>o?.())}}function da(e,t,n){const s=e.ownerDocument.defaultView||window,r=new s.CustomEvent(t,n);return e.dispatchEvent(r)}function Up(e,t){const n=s=>{s.key==="Escape"&&(s.isComposing||t?.(s))};return Rs(Me(e),"keydown",n,{capture:!0})}var ua="layer:request-dismiss",we={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=>hn(s.node,t))||this.recentlyRemoved.size>0)},isInBranch(e){return Array.from(this.branches).some(t=>hn(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&&qp(r)}),this.recentlyRemoved.add(e),wc(()=>this.recentlyRemoved.delete(e)),t<this.count()-1&&this.getNestedLayers(e).forEach(r=>we.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)=>{fa(e,t,e.node),e.styleTargets?.forEach(n=>{const s=n();if(!s||s===e.node)return;fa(e,t,s);const{zIndex:r}=pc(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];Yp(e,ua,r=>{s.requestDismiss?.(r),r.defaultPrevented||s?.dismiss()}),Gp(e,ua,{originalLayer:e,targetLayer:t,originalIndex:n,targetIndex:t?this.indexOf(t):-1}),this.syncLayers()},clear(){this.remove(this.layers[0].node)}};function fa(e,t,n){n.style.setProperty("--layer-index",`${t}`),n.removeAttribute("data-nested"),n.removeAttribute("data-has-nested"),we.getParentLayerOfType(e.node,e.type)&&n.setAttribute("data-nested",e.type);const r=we.countNestedLayersOfType(e.node,e.type);r>0&&n.setAttribute("data-has-nested",e.type),n.style.setProperty("--nested-layer-count",`${r}`)}function qp(e){e.style.removeProperty("--layer-index"),e.style.removeProperty("--nested-layer-count"),e.removeAttribute("data-nested"),e.removeAttribute("data-has-nested")}function Gp(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 Yp(e,t,n){e.addEventListener(t,n,{once:!0})}var jr=new WeakMap,Kn=new WeakMap;function Kp(e){return we.isBelowPointerBlockingLayer(e)?"none":"auto"}function qc(e){const t=Kp(e);e.style.pointerEvents!==t&&(e.style.pointerEvents=t)}function zp(e){if(Kn.has(e))return;const t=me(e);if(typeof t.MutationObserver>"u")return;const n=new t.MutationObserver(()=>{Kn.has(e)&&qc(e)});n.observe(e,{attributes:!0,attributeFilter:["style"]}),Kn.set(e,n)}function ha(){we.layers.forEach(({node:e})=>{qc(e),zp(e)})}function Zp(e){const t=Kn.get(e);t&&(t.disconnect(),Kn.delete(e)),e.style.pointerEvents=""}function Jp(e,t){const n=Me(e),s=[];return we.hasPointerBlockingLayer()&&!n.body.hasAttribute("data-inert")&&(jr.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]=jf(()=>{const a=r();return fe(a)?a:null},{timeout:1e3});o.then(a=>s.push(Vf(a,{pointerEvents:"auto"}))),s.push(i)}),()=>{we.hasPointerBlockingLayer()||(queueMicrotask(()=>{const r=n.body;if(!r)return;const o=jr.get(r);o!==void 0&&(r.style.pointerEvents=o,jr.delete(r)),r.removeAttribute("data-inert"),r.style.length===0&&r.removeAttribute("style")}),s.forEach(r=>r()))}}function Xp(e,t){const{onDismiss:n,onRequestDismiss:s,pointerBlocking:r,exclude:o,debug:i,type:a="dialog",layerStyleTargets:l}=t,c={dismiss:n,node:e,type:a,pointerBlocking:r,requestDismiss:s,styleTargets:l};we.add(c),ha();function f(d){const m=ft(d.detail.originalEvent);we.isBelowPointerBlockingLayer(e)||we.isInBranch(m)||(t.onPointerDownOutside?.(d),t.onInteractOutside?.(d),!d.defaultPrevented&&(i&&console.log("onPointerDownOutside:",d.detail.originalEvent),n?.(d)))}function u(d){const m=ft(d.detail.originalEvent);we.isInBranch(m)||(t.onFocusOutside?.(d),t.onInteractOutside?.(d),!d.defaultPrevented&&(i&&console.log("onFocusOutside:",d.detail.originalEvent),n?.(d)))}function h(d){we.isTopMost(e)&&(t.onEscapeKeyDown?.(d),!d.defaultPrevented&&n&&(d.preventDefault(),n(d)))}function p(d){const m=typeof o=="function"?o():o,y=Array.isArray(m)?m:[m],$=t.persistentElements?.map(w=>w()).filter(fe);return $&&y.push(...$),y.some(w=>hn(w,d))||we.isInNestedLayer(e,d)}const g=[r?Jp(e,t.persistentElements):void 0,Up(e,h),Wp(e,{exclude:p,onFocusOutside:u,onPointerDownOutside:f,defer:t.defer})];return()=>{we.remove(e),ha(),Zp(e),g.forEach(d=>d?.())}}function Gc(e,t){const{warnOnMissingNode:n=!0}=t;return Uf(e,s=>Xp(s,t),{defer:t.defer,getRootNode:t.getRootNode,onMissing:n?()=>Ms("[@zag-js/dismissable] node is `null` or `undefined`"):void 0})}var{and:Mn,not:Nt,or:Qp}=jc(),eg=Wc({props({props:e}){return{loopFocus:!1,closeOnSelect:!e.multiple,composite:!0,defaultValue:[],...e,collection:e.collection??Gs.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:bn,onChange(o){const i=n(),a=e("collection"),l=i.get("selectedItemMap"),c=ps({values:o,collection:a,selectedItemMap:l}),f=e("value")??o,u=f===o?c:ps({values:f,collection:a,selectedItemMap:c.nextSelectedItemMap});return i.set("selectedItemMap",u.nextSelectedItemMap),e("onValueChange")?.({value:o,items:c.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:yu({selectedItems:r,collection:e("collection")})}))}},refs(){return{typeahead:{...uo.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})=>lc({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:Qp("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:Mn(Nt("multiple"),"hasSelectedItems"),actions:["selectPreviousItem"]},{guard:Nt("multiple"),actions:["selectLastItem"]}],"TRIGGER.ARROW_RIGHT":[{guard:Mn(Nt("multiple"),"hasSelectedItems"),actions:["selectNextItem"]},{guard:Nt("multiple"),actions:["selectFirstItem"]}],"TRIGGER.HOME":{guard:Nt("multiple"),actions:["selectFirstItem"]},"TRIGGER.END":{guard:Nt("multiple"),actions:["selectLastItem"]},"TRIGGER.TYPEAHEAD":{guard:Nt("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:Mn("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:Mn("hasHighlightedItem","loop","isLastItemHighlighted"),actions:["highlightFirstItem"]},{guard:"hasHighlightedItem",actions:["highlightNextItem"]},{actions:["highlightFirstItem"]}],"CONTENT.ARROW_UP":[{guard:Mn("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})=>pa(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 nh({root:e.getRootNode?.()})},trackFormControlState({context:e,scope:t}){return sf(Hr(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=()=>Ln(e);let r=!0;return Gc(s,{type:"listbox",defer:!0,getRootNode:e.getRootNode,layerStyleTargets:[()=>_r(e)],exclude:[_t(e),Ep(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),vo(()=>_t(n),()=>_r(n),{defer:!0,...s,onComplete(i){e.set("currentPlacement",i.placement)}})},scrollToHighlightedItem({context:e,prop:t,scope:n}){const s=a=>{const l=e.get("highlightedValue");if(l==null||po()==="pointer")return;const f=Ln(n),u=t("scrollToIndexFn");if(u){const p=t("collection").indexOf(l);u?.({index:p,immediate:a,getElement:()=>Br(n,l)});return}const h=Br(n,l);Lf(h,{rootEl:f,block:"nearest"})},r=pe(()=>{th("virtual"),s(!0)}),i=bf(()=>Ln(n),{attributes:["data-activedescendant"],callback(){s(!1)}});return()=>{r(),i()}}},actions:{reposition({context:e,prop:t,scope:n,event:s}){const r=()=>_r(n);vo(_t(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}){pe(()=>{const t=pf({root:Ln(e)});t&&t.focus({preventScroll:!0})})},focusTriggerEl({event:e,scope:t}){if(!pa(e))return;const n=tg(e);pe(()=>{_t(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")?Ri(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")?Ri(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:()=>Br(t,n)})}else Ln(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=Hr(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=ps({values:e.get("value"),collection:n,selectedItemMap:e.get("selectedItemMap")});e.set("selectedItemMap",r.nextSelectedItemMap)},syncSelectedItems({context:e,prop:t}){const n=ps({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=Hr(e);if(!t)return;const n=e.getWin(),s=new n.Event("change",{bubbles:!0,composed:!0});t.dispatchEvent(rf(s))})}}}});function pa(e){const t=e.restoreFocus??e.previousEvent?.restoreFocus;return t==null||!!t}function tg(e){return e.focusVisible??e.previousEvent?.focusVisible?{preventScroll:!0,focusVisible:!0}:{preventScroll:!0}}function ng(e){return new Proxy({},{get(t,n){return n==="style"?s=>e({style:s}).style:e}})}var sg=Object.defineProperty,rg=(e,t,n)=>t in e?sg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Y=(e,t,n)=>rg(e,typeof t!="symbol"?t+"":t,n),ga={onFocus:"onFocusin",onBlur:"onFocusout",onChange:"onInput",onDoubleClick:"onDblclick",htmlFor:"for",className:"class",defaultValue:"value",defaultChecked:"checked"},og=new Set(["viewBox","preserveAspectRatio"]),Yc=ng(e=>Object.entries(e).reduce((t,[n,s])=>{if(s===void 0)return t;n in ga&&(n=ga[n]);const r=og.has(n)?n:n.toLowerCase();return t[r]=s,t},{})),bs=new WeakMap,ma=new Set(["value","checked","selected"]),ig=new Set(["viewBox","preserveAspectRatio","clipPath","clipRule","fillRule","strokeWidth","strokeLinecap","strokeLinejoin","strokeDasharray","strokeDashoffset","strokeMiterlimit"]),ag=e=>e.tagName==="svg"||e.namespaceURI==="http://www.w3.org/2000/svg",ws=(e,t)=>ag(e)&&ig.has(t)?t:t.toLowerCase(),Wr=e=>e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),va=(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(Wr(r));for(const r in n){const o=n[r];o==null?s.removeProperty(Wr(r)):s.setProperty(Wr(r),String(o))}}};function se(e,t,n){const s="default";let r=bs.get(e);r||(r=new Map,bs.set(e,r));const o=r.get(s)||{},i=Object.keys(t),a=(d,m)=>{e.addEventListener(d.toLowerCase(),m)},l=(d,m)=>{e.removeEventListener(d.toLowerCase(),m)},c=d=>d.startsWith("on"),f=d=>!d.startsWith("on"),u=d=>a(d.substring(2),t[d]),h=d=>l(d.substring(2),t[d]),p=d=>{const m=t[d],y=o[d];if(m!==y){if(d==="class"){e.className=m??"";return}if(d==="style"){va(e,y,m);return}if(ma.has(d)){e[d]=m??"";return}if(typeof m=="boolean"&&!d.includes("aria-")){e.toggleAttribute(ws(e,d),m);return}if(d==="children"){e.innerHTML=m;return}if(m!=null){e.setAttribute(ws(e,d),m);return}e.removeAttribute(ws(e,d))}};for(const d in o)t[d]==null&&(d==="class"?e.className="":d==="style"?va(e,o[d],void 0):ma.has(d)?e[d]="":e.removeAttribute(ws(e,d)));return Object.keys(o).filter(c).forEach(d=>{l(d.substring(2),o[d])}),i.filter(c).forEach(u),i.filter(f).forEach(p),r.set(s,t),function(){i.filter(c).forEach(h);const m=bs.get(e);m&&(m.delete(s),m.size===0&&bs.delete(e))}}function cg(){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 Kc(e,t){const n=cg();return n?(n[e]||(n[e]=t()),n[e]):t()}var Vs=Kc("__zag__refSet",()=>new WeakSet),lg=e=>typeof e=="object"&&e!==null&&"$$typeof"in e&&"props"in e,dg=e=>typeof e=="object"&&e!==null&&"__v_isVNode"in e,ug=e=>typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeName=="string",fg=e=>lg(e)||dg(e)||ug(e),$o=e=>e!==null&&typeof e=="object",ya=e=>$o(e)&&!Vs.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!fg(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 hg=Symbol(),ba=Object.getPrototypeOf,Io=new WeakMap,pg=e=>e&&(Io.has(e)?Io.get(e):ba(e)===Object.prototype||ba(e)===Array.prototype),gg=e=>pg(e)&&e[hg]||null,wa=(e,t=!0)=>{Io.set(e,t)};var Ht=Kc("__zag__proxyStateMap",()=>new WeakMap),mg=(e=Object.is,t=(a,l)=>new Proxy(a,l),n=new WeakMap,s=(a,l)=>{const c=n.get(a);if(c?.[0]===l)return c[1];const f=Array.isArray(a)?[]:Object.create(Object.getPrototypeOf(a));return wa(f,!0),n.set(a,[l,f]),Reflect.ownKeys(a).forEach(u=>{const h=Reflect.get(a,u);Vs.has(h)?(wa(h,!1),f[u]=h):Ht.has(h)?f[u]=yg(h):f[u]=h}),Object.freeze(f)},r=new WeakMap,o=[1,1],i=a=>{if(!$o(a))throw new Error("object required");const l=r.get(a);if(l)return l;let c=o[0];const f=new Set,u=(E,T=++o[0])=>{c!==T&&(c=T,f.forEach(x=>x(E,T)))};let h=o[1];const p=(E=++o[1])=>(h!==E&&!f.size&&(h=E,d.forEach(([T])=>{const x=T[1](E);x>c&&(c=x)})),c),g=E=>(T,x)=>{const C=[...T];C[1]=[E,...C[1]],u(C,x)},d=new Map,m=(E,T)=>{if(f.size){const x=T[3](g(E));d.set(E,[T,x])}else d.set(E,[T])},y=E=>{const T=d.get(E);T&&(d.delete(E),T[1]?.())},$=E=>(f.add(E),f.size===1&&d.forEach(([x,C],b)=>{const A=x[3](g(b));d.set(b,[x,A])}),()=>{f.delete(E),f.size===0&&d.forEach(([x,C],b)=>{C&&(C(),d.set(b,[x]))})}),w=Array.isArray(a)?[]:Object.create(Object.getPrototypeOf(a)),O=t(w,{deleteProperty(E,T){const x=Reflect.get(E,T);y(T);const C=Reflect.deleteProperty(E,T);return C&&u(["delete",[T],x]),C},set(E,T,x,C){const b=Reflect.has(E,T),A=Reflect.get(E,T,C);if(b&&(e(A,x)||r.has(x)&&e(A,r.get(x))))return!0;y(T),$o(x)&&(x=gg(x)||x);let D=x;if(!Object.getOwnPropertyDescriptor(E,T)?.set){!Ht.has(x)&&ya(x)&&(D=zc(x));const V=!Vs.has(D)&&Ht.get(D);V&&m(T,V)}return Reflect.set(E,T,D,C),u(["set",[T],x,A]),!0}});r.set(a,O);const R=[w,p,s,$];return Ht.set(O,R),Reflect.ownKeys(a).forEach(E=>{const T=Object.getOwnPropertyDescriptor(a,E);T.get||T.set?Object.defineProperty(w,E,T):O[E]=a[E]}),O})=>[i,Ht,Vs,e,t,ya,n,s,r,o],[vg]=mg();function zc(e={}){return vg(e)}function Ea(e,t,n){const s=Ht.get(e);let r;const o=[],i=s[3];let a=!1;const c=i(f=>{o.push(f),r||(r=Promise.resolve().then(()=>{r=void 0,a&&t(o.splice(0))}))});return a=!0,()=>{a=!1,c()}}function yg(e){const t=Ht.get(e),[n,s,r]=t;return r(n,s())}function er(e){const t=e().value??e().defaultValue;e().debug&&console.log(`[bindable > ${e().debug}] initial`,t);const n=e().isEqual??Object.is,s=zc({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=Xe(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)}}}er.cleanup=e=>{};er.ref=e=>{let t=e;return{get:()=>t,set:n=>{t=n}}};function bg(e){const t={current:e};return{get(n){return t.current[n]},set(n,s){t.current[n]=s}}}var{defineProperty:wg,getOwnPropertyDescriptor:Eg,getOwnPropertyDescriptors:xa}=Object;function Wn(e,t){if(Object.is(e,t))return e;if(!_n(e)||!_n(t))return t===void 0?e:t;let n=e;const s=(r,o)=>{n===e&&(n=Object.defineProperties({},xa(e))),wg(n,r,o)};for(const[r,o]of Object.entries(xa(t))){if(!o.enumerable)continue;if(o.get){s(r,o);continue}const i=o.value;if(i===void 0)continue;const a=!!Eg(e,r)?.get,l=e[r],c=_n(l)&&_n(i)?Wn(l,i):i;!a&&Object.is(l,c)||s(r,{value:c,writable:!0,enumerable:!0,configurable:!0})}return n}var Zc=class{constructor(e,t={}){Y(this,"machine",e),Y(this,"scope"),Y(this,"context"),Y(this,"prop"),Y(this,"state"),Y(this,"refs"),Y(this,"computed"),Y(this,"event",{type:""}),Y(this,"previousEvent",{type:""}),Y(this,"effects",new Map),Y(this,"replaceTracker",Tp()),Y(this,"transition",null),Y(this,"cleanups",[]),Y(this,"subscriptions",[]),Y(this,"userProps"),Y(this,"userPropsSources",[]),Y(this,"getUserProps",()=>{let u=this.userProps;for(const h of this.userPropsSources){const p=Ni(h);u=u?Wn(u,p):p}return u}),Y(this,"getEvent",()=>({...this.event,current:()=>this.event,previous:()=>this.previousEvent})),Y(this,"getState",()=>({...this.state,matches:(...u)=>u.some(h=>Rp(this.state.get(),h)),hasTag:u=>Pp(this.machine,this.state.get(),u)})),Y(this,"debug",(...u)=>{this.machine.debug&&console.log(...u)}),Y(this,"notify",()=>{this.publish()}),Y(this,"send",u=>{if(this.status!==jn.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 g=this.state.get();const d=u.type,{transitions:m,source:y}=Mp(this.machine,g,d),$=this.choose(m);if(!$)return;this.transition=$;const w=ia(this.machine,$.target??g,y);this.debug("transition",$),w!==g?this.state.set(w):$.reenter?this.state.invoke(g,g):this.action($.actions)})}),Y(this,"action",u=>{const h=Xe(u)?u(this.getParams()):u;if(!h)return;const p=h.map(g=>{const d=this.machine.implementations?.actions?.[g];return d||Ms(`[zag-js] No implementation found for action "${JSON.stringify(g)}"`),d});for(const g of p)g?.(this.getParams())}),Y(this,"guard",u=>{if(Xe(u))return u(this.getParams());const h=this.machine.implementations?.guards?.[u];return h||Ms(`[zag-js] No implementation found for guard "${JSON.stringify(u)}"`),h?.(this.getParams())}),Y(this,"effect",u=>{const h=Xe(u)?u(this.getParams()):u;if(!h)return;const p=h.map(d=>{const m=this.machine.implementations?.effects?.[d];return m||Ms(`[zag-js] No implementation found for effect "${JSON.stringify(d)}"`),m}),g=[];for(const d of p){const m=d?.(this.getParams());m&&g.push(m)}return()=>g.forEach(d=>d?.())}),Y(this,"choose",u=>Xd(u).find(h=>{let p=!h.guard;return ou(h.guard)?p=!!this.guard(h.guard):Xe(h.guard)&&(p=h.guard(this.getParams())),p})),Y(this,"subscribe",u=>(this.subscriptions.push(u),()=>{const h=this.subscriptions.indexOf(u);h>-1&&this.subscriptions.splice(h,1)})),Y(this,"status",jn.NotStarted),Y(this,"publish",()=>{this.callTrackers(),this.subscriptions.forEach(u=>u(this.service))}),Y(this,"trackers",[]),Y(this,"setupTrackers",()=>{this.machine.watch?.(this.getParams())}),Y(this,"callTrackers",()=>{this.trackers.forEach(({deps:u,fn:h})=>{const p=u.map(g=>g());bn(h.prev,p)||(h(),h.prev=p)})}),Y(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:fu,scope:this.scope,choose:this.choose})),Xe(t)?this.userPropsSources.push(t):this.userProps=t;const{id:n,ids:s,getRootNode:r}=Ni(t);this.scope=Vp({id:n,ids:s,getRootNode:r});const o=u=>{const h=this.getUserProps();return(e.props?.({props:_o(h),scope:this.scope})??h)[u]};this.prop=o;const i=e.context?.({prop:o,bindable:er,scope:this.scope,flush(u){queueMicrotask(u)},getContext(){return a},getComputed(){return l},getRefs(){return c},getEvent:this.getEvent.bind(this)});i&&Object.values(i).forEach(u=>{const h=Ea(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 l=u=>(cr(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:l}));this.computed=l;const c=bg(e.refs?.({prop:o,context:a})??{});this.refs=c;const f=er(()=>({defaultValue:ia(e,e.initialState({prop:o})),onChange:(u,h)=>{const{exiting:p,entering:g}=Dp(this.machine,h,u,this.transition?.reenter);if(p.forEach(d=>{this.effects.get(d.path)?.(),this.effects.delete(d.path)}),p.forEach(d=>{this.action(d.state?.exit)}),this.action(this.transition?.actions),g.forEach(d=>{const m=this.effect(d.state?.effects);if(m){const y=this.effects.get(d.path);this.effects.set(d.path,y?qs(y,m):m)}}),h===ys){this.action(e.entry);const d=this.effect(e.effects);if(d){const m=this.effects.get(ys);this.effects.set(ys,m?qs(m,d):d)}}g.forEach(d=>{this.action(d.state?.entry)})}}));this.state=f,this.cleanups.push(Ea(this.state.ref,()=>this.notify()))}updateProps(e){const t=this.userPropsSources;if(Xe(e))t.push(e);else if(t.length===0)this.userProps=Wn(this.userProps,e);else{const n=t.length-1,s=t[n];if(Xe(s)){const r=Wn({},e);r&&Object.keys(r).length>0&&t.push(r)}else t[n]=Wn(s,e)}this.notify()}start(){this.status=jn.Started,this.debug("initializing..."),this.state.invoke(this.state.initial,ys),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=jn.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 xg='<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 Sg=0;function $g(e){const t=document.createElement("span");t.className="ui-select",t.innerHTML=`<button type="button" class="ui-select-trigger"><span></span>${xg}</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="",l=e.value,c=e.disabled;const f=new Zc(eg,{id:`select-${++Sg}`,collection:Gs({items:i}),defaultValue:[l],disabled:c,positioning:{placement:"bottom-start",strategy:"fixed",sameWidth:!0,gutter:6},onValueChange({value:d}){e.value!==d[0]&&(l=e.value=d[0]??"",e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})))}}),u=()=>Sp(f.service,Yc);function h(){const d=u();se(t,d.getRootProps()),se(n,{...d.getTriggerProps(),"aria-label":e.getAttribute("aria-label")||e.labels?.[0]?.textContent?.trim(),"aria-labelledby":void 0}),se(r,d.getPositionerProps()),se(o,{...d.getContentProps(),"aria-label":e.getAttribute("aria-label"),"aria-labelledby":void 0});const m=e.selectedOptions[0]?.textContent||"Choose…";s.textContent!==m&&(s.textContent=m),i.forEach((y,$)=>{const w=o.children[$];se(w,d.getItemProps({item:y}))}),r.hidden=!d.open,d.open&&!r.matches(":popover-open")&&r.showPopover?.(),!d.open&&r.matches(":popover-open")&&r.hidePopover?.()}function p(){const d=Array.from(e.options,y=>({value:y.value,label:y.text,disabled:y.disabled})),m=JSON.stringify(d);m!==a&&(a=m,i=d,o.replaceChildren(...i.map(y=>{const $=document.createElement("div");return $.className="ui-select-option",$.textContent=y.label,$})),f.updateProps({collection:Gs({items:i})})),l!==e.value&&(l=e.value,u().setValue([l])),c!==e.disabled&&(c=e.disabled,f.updateProps({disabled:c})),h()}t.addEventListener("keydown",d=>d.stopPropagation()),e.addEventListener("change",p);const g=f.subscribe(h);return f.start(),p(),{sync:p,focus:()=>n.focus(),dispose(){e.removeEventListener("change",p),g(),f.stop(),t.remove(),e.hidden=!1}}}function Qn(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,$g(t))}function Ig(e){Qn(e.parentElement),wt.get(e)?.focus()}function Tg(){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")))))&&Qn()});return e.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["disabled"]}),Qn(),()=>{e.disconnect();for(const t of wt.values())t.dispose();wt.clear()}}function Cg(e){const t=document.createElement("dialog");t.className="launch-dialog",t.setAttribute("aria-labelledby","launch-heading"),t.innerHTML=`
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=v=>i.querySelector(v),l=a("#session-query"),c=a("#search-results"),f=a(".search-results-inner"),u=a("#search-preview"),h=a("#search-scope");let p=new Map,g=new Map,d,m=[],y=0,$=0,w=0,M=80,O=0,R=0,E=0,C=!1,x=!1,T=!0,b,A=null,D,V=0,H="",z="",re=!1;const Z=new Map,W=86,be=v=>s.postMessage(v);function Mt(){if(!b)return;const v=a("#search-index-state");v.textContent=b.storage==="restoring"?"Restoring saved index…":b.complete===b.total&&b.total?`Conversations ready${b.storage==="local"?" · saved locally":""}`:`${b.indexed.toLocaleString()} / ${b.total.toLocaleString()} conversations${T?b.active?" · indexing":" · partial":" · paused"}`,v.title=`Titles and metadata cover all ${b.total.toLocaleString()} imported sessions. ${b.complete.toLocaleString()} conversations have all supported text indexed. ${b.failed?`${b.failed} unavailable; toggle Conversations to retry. `:""}${b.limited?"Large histories are sampled; missing matches may be in unindexed text. ":""}${b.storage==="memory"?"Saving unavailable; search continues in memory.":`Saved in local SQLite. ${b.restored.toLocaleString()} conversations restored; unchanged pages are reused. Clear saved index under Filters. Imported sessions remain saved.`}`}function $e(){if(f.style.height=`${m.length*W}px`,!m.length){f.innerHTML=`<div class="search-empty">${Ce(z||(C?"Searching…":l.value?"No matching sessions":"No sessions available"))}</div>`,l.removeAttribute("aria-activedescendant");return}const v=Math.max(0,Math.floor(c.scrollTop/W)-3),I=Math.min(m.length,v+Math.ceil(c.clientHeight/W)+7);f.innerHTML=m.slice(v,I).map((F,Q)=>{const U=v+Q,G=p.get(F.id);if(!G)return"";const ce=`${Ue(G.source)} · ${g.get(G.projectID)||G.directory.split("/").at(-1)||"Global"} · ${new Date(G.updated).toLocaleDateString(void 0,{month:"short",day:"numeric"})}`;return`<div id="search-hit-${U}" class="search-result ${U===y?"active":""}" role="option" aria-selected="${U===y}" aria-posinset="${U+1}" aria-setsize="${$}" data-result-index="${U}" style="top:${U*W}px"><div class="search-result-title">${Tn(G.title,F.terms)}</div><div class="search-result-meta"><span>${ut(G.source)}${Ce(ce)}</span><span class="match-kind">${Ce(F.source)}</span></div>${F.excerpt?`<div class="search-result-excerpt">${Tn(F.excerpt,F.terms)}</div>`:`<div class="search-result-excerpt">${Ce(G.model)}</div>`}</div>`}).join(""),y>=v&&y<I?l.setAttribute("aria-activedescendant",`search-hit-${y}`):l.removeAttribute("aria-activedescendant")}function Ke(v,I=!1,F=!1){const Q=m[y],U=Q&&p.get(Q.id);if(!U){u.innerHTML="";return}const G=Q.terms.length?Q.terms:Ho(Ud(l.value).text),ce=v?.fragments.filter(ie=>{const Fe=un(ie.text);return G.length&&G.every(He=>Fe.includes(He))}).slice(0,4)||[],De=v?.fragments.filter(ie=>["You","Assistant"].includes(ie.kind)).slice(0,5).reverse()||[],Ne=ce.length?ce:De;if(u.innerHTML=`<div class="search-preview-heading"><span>${Ce(g.get(U.projectID)||"Session")}</span><h2>${Tn(U.title,G)}</h2><p>${Ce(U.model)} · ${new Date(U.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>${Tn(Q.excerpt,G)}</p></section>`:""}<section class="search-preview-section"><h3>${ce.length?"Matching context":"Recent conversation"}</h3>${I?'<p class="preview-loading">Loading preview…</p>':F?'<p>Preview unavailable.</p><button class="text-button preview-retry">Retry</button>':Ne.length?Ne.map(ie=>`<article><span>${Ce(ie.kind)}</span><p>${Tn(qd(ie.text,G,360),G)}</p></article>`).join(""):"<p>No conversation text in this batch.</p>"}${v&&(v.nextCursor||v.truncated)?'<p class="preview-coverage">Recent messages · partial preview</p>':""}</section>`,u.querySelector(".search-open")?.addEventListener("click",$n,o),n){const ie=document.createElement("button");ie.className="text-button search-launch",ie.innerHTML=`${ut(U.source)}Open in ${Ce(Ue(U.source))} ↗`,ie.addEventListener("click",()=>n(U),o),u.querySelector(".search-preview-heading")?.append(ie)}u.querySelector(".preview-retry")?.addEventListener("click",()=>{H="",Dt()},o)}function Dt(){const v=m[y],I=v&&p.get(v.id),F=I?`${I.id}:${Di(I)}:${l.value}`:"";if(F===H)return;if(H=F,window.clearTimeout(V),D?.abort(),!I){Ke();return}const Q=`${I.id}:${Di(I)}`,U=Z.get(Q);if(U){Ke(U);return}Ke(void 0,!0),V=window.setTimeout(async()=>{const G=new AbortController;D=G;try{const ce=await fetch(`/api/sessiongraph/session/${encodeURIComponent(I.id)}/content?updated=${I.updated}`,{signal:G.signal});if(!ce.ok)throw new Error("Preview unavailable");const De=await ce.json();if(G.signal.aborted||F!==H)return;Z.size>=25&&Z.delete(Z.keys().next().value),Z.set(Q,De),Ke(De)}catch{!G.signal.aborted&&F===H&&Ke(void 0,!1,!0)}},90)}function Zt(){cancelAnimationFrame(O),C=!0,l.setAttribute("aria-busy","true");const v=++w;R=performance.now(),O=requestAnimationFrame(()=>be({type:"query",request:v,text:l.value,viewOnly:h.value==="view",limit:M}))}function vt(){y=0,re=!1,M=80,c.scrollTop=0,H="",Zt()}function Rt(v){if(!m.length)return;re=!0,y=Math.max(0,Math.min(m.length-1,y+v));const I=y*W;I<c.scrollTop?c.scrollTop=I:I+W>c.scrollTop+c.clientHeight&&(c.scrollTop=I+W-c.clientHeight),$e(),Dt()}function yt(){i.close(),t(!1),D?.abort(),window.clearTimeout(V),H="",A?.focus({preventScroll:!0})}function $n(){const v=m[y];!v||C||(yt(),e(v.id))}function L(){i.open||(A=document.activeElement,i.showModal()),t(!0),l.focus({preventScroll:!0}),l.select(),Zt(),T&&be({type:"warm",enabled:!0})}s.onmessage=v=>{const I=v.data;if(I.type==="status"){b=I.status,Mt();return}if(I.type==="error"){z=I.message,C=!1,l.setAttribute("aria-busy","false"),$e();return}if(I.request!==w)return;const F=m[y]?.id;E=C?performance.now()-R:E,C=!1,l.setAttribute("aria-busy","false"),m=I.hits,$=I.total,z=I.error||"",y=Math.max(0,Math.min(m.length-1,re&&F?m.findIndex(Q=>Q.id===F):0)),a("#search-result-status").textContent=z||`${$.toLocaleString()} ${l.value?"matches":"sessions"} · ${Math.round(I.elapsed)} ms`,a("#search-more").hidden=m.length>=$||M>=250,i.open&&($e(),Dt())},s.onerror=()=>{z="Search could not start. Reload to retry.",C=!1,$e()},l.addEventListener("input",()=>{x||vt()},o),l.addEventListener("compositionstart",()=>{x=!0},o),l.addEventListener("compositionend",()=>{x=!1,vt()},o),h.addEventListener("change",vt,o),c.addEventListener("scroll",$e,o),c.addEventListener("click",v=>{const I=v.target.closest("[data-result-index]");I&&(y=Number(I.dataset.resultIndex),re=!0,$e(),Dt(),l.focus())},o),c.addEventListener("dblclick",$n,o),a("#search-more").addEventListener("click",()=>{M=Math.min(250,M+80),Zt()},o),a("#search-conversations").addEventListener("click",()=>{T=!T,a("#search-conversations").setAttribute("aria-pressed",String(T)),be({type:"warm",enabled:T}),Mt()},o),a("#search-clear-cache").addEventListener("click",()=>{T=!1,a("#search-conversations").setAttribute("aria-pressed","false"),Z.clear(),H="",D?.abort(),window.clearTimeout(V),a(".search-syntax").open=!1,be({type:"clear-cache"}),l.focus()},o),a(".search-close").addEventListener("click",yt,o),i.addEventListener("cancel",v=>{v.preventDefault(),yt()},o),i.addEventListener("keydown",v=>{v.stopPropagation(),!(x||v.isComposing)&&((v.key==="ArrowDown"||v.key==="ArrowUp")&&(v.preventDefault(),Rt(v.key==="ArrowDown"?1:-1)),(v.key==="PageDown"||v.key==="PageUp")&&(v.preventDefault(),Rt((v.key==="PageDown"?1:-1)*Math.max(1,Math.floor(c.clientHeight/W)))),v.key==="Enter"&&v.target===l&&(v.preventDefault(),$n()),v.key==="Escape"&&(v.preventDefault(),yt()),v.key.toLowerCase()==="s"&&v.altKey&&(v.preventDefault(),h.value=h.value==="view"?"all":"view",h.dispatchEvent(new Event("change",{bubbles:!0}))))},o),document.addEventListener("keydown",v=>{if(i.open||document.querySelector("dialog[open]"))return;const I=v.target,F=I.isContentEditable||I.closest('input:not([type="range"]):not([type="checkbox"]):not([type="radio"]), textarea, select');(v.key==="/"&&!F&&!v.ctrlKey&&!v.metaKey&&!v.altKey||v.key.toLowerCase()==="k"&&(v.metaKey||v.ctrlKey))&&(v.preventDefault(),L())},o);const S=new ResizeObserver(()=>{i.open&&$e()});return S.observe(c),{open:L,setData(v){d!==v.sourceID&&(Z.clear(),H="",D?.abort(),window.clearTimeout(V)),d=v.sourceID,p=new Map(v.sessions.map(I=>[I.id,I])),g=new Map(v.projects.map(I=>[I.id,I.name])),be({type:"data",sessions:v.sessions,projects:v.projects,sourceID:d})},setScope(v){be({type:"scope",ids:v})},diagnostics:()=>({open:i.open,query:l.value,matches:$,renderedRows:f.querySelectorAll('[role="option"]').length,roundTripMs:E,pending:C,index:b}),dispose(){s.terminate(),r.abort(),S.disconnect(),D?.abort(),window.clearTimeout(V),cancelAnimationFrame(O),i.remove()}}}const Hn=[{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"}],Ar=e=>Hn.some(t=>t.id===e),tc=e=>/^ses[a-zA-Z0-9_-]+$/.test(e);function Yd(e,t){if(!tc(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 sn=(e,t=[])=>({parts:(...n)=>{if(Kd(t))return sn(e,n);throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?")},extendWith:(...n)=>sn(e,[...t,...n]),omit:(...n)=>sn(e,t.filter(s=>!n.includes(s))),rename:n=>sn(n,t),keys:()=>t,build:()=>[...new Set(t)].reduce((n,s)=>Object.assign(n,{[s]:{selector:[`&[data-scope="${Jt(e)}"][data-part="${Jt(s)}"]`,`& [data-scope="${Jt(e)}"][data-part="${Jt(s)}"]`].join(", "),attrs:{"data-scope":Jt(e),"data-part":Jt(s)}}}),{})}),Jt=e=>e.replace(/([A-Z])([A-Z])/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),Kd=e=>e.length===0,zd=sn("select").parts("label","positioner","trigger","indicator","clearTrigger","item","itemText","itemIndicator","itemGroup","itemGroupLabel","list","content","root","control","valueText"),ve=zd.build(),Zd=Object.defineProperty,Jd=(e,t,n)=>t in e?Zd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_=(e,t,n)=>Jd(e,typeof t!="symbol"?t+"":t,n);function Xd(e){return e==null?[]:Array.isArray(e)?e:[e]}var Qd=e=>e[e.length-1],eu=(e,t)=>e.indexOf(t)!==-1,tu=(e,...t)=>e.concat(t),nu=(e,...t)=>e.filter(n=>!t.includes(n)),Ri=(e,t)=>eu(e,t)?nu(e,t):tu(e,t);function Pi(e,t){return e.reduce((n,s,r)=>(r%t===0?n.push([s]):Qd(n)?.push(s),n),[])}var Vi=e=>e?.constructor.name==="Array",su=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!bn(e[n],t[n]))return!1;return!0},bn=(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(Vi(e)&&Vi(t))return su(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(!bn(e[o],t[o]))return!1}return!0},ru=e=>Array.isArray(e),nc=e=>e!=null&&typeof e=="object",Lr=e=>nc(e)&&!ru(e),ou=e=>typeof e=="string",Xe=e=>typeof e=="function",iu=e=>e==null,Os=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),au=e=>Object.prototype.toString.call(e),sc=Function.prototype.toString,cu=sc.call(Object),_n=e=>{if(!nc(e)||au(e)!="[object Object]"||uu(e))return!1;const t=Object.getPrototypeOf(e);if(t===null)return!0;const n=Os(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&sc.call(n)==cu},lu=e=>typeof e=="object"&&e!==null&&"$$typeof"in e&&"props"in e,du=e=>typeof e=="object"&&e!==null&&"__v_isVNode"in e,uu=e=>lu(e)||du(e),Ni=(e,...t)=>(typeof e=="function"?e(...t):e)??void 0,fu=e=>e(),rc=()=>{},qs=(...e)=>(...t)=>{e.forEach(function(n){n?.(...t)})};function oo(e,t,...n){if(e in t){const r=t[e];return Xe(r)?r(...n):r}const s=new Error(`No matching key: ${JSON.stringify(e)} in ${JSON.stringify(Object.keys(t))}`);throw Error.captureStackTrace?.(s,oo),s}var{min:hu,max:pu}=Math,gu=e=>Number.isNaN(e),oc=e=>gu(e)?0:e,Or=(e,t,n)=>{const s=oc(e),r=t==null||s>=t,o=n==null||s<=n;return r&&o},mu=(e,t,n)=>hu(pu(oc(e),t),n);function _o(e){if(!_n(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]=_o(r))}return n}function ic(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 Ms(...e){e.length===1?e[0]:e[1],e.length===2&&e[0]}function Fi(...e){e.length===1?e[0]:e[1],e.length===2&&e[0]}function cr(e,t){if(e==null)throw new Error(t())}var Ds={itemToValue(e){return typeof e=="string"?e:Lr(e)&&Os(e,"value")?e.value:""},itemToString(e){return typeof e=="string"?e:Lr(e)&&Os(e,"label")?e.label:Ds.itemToValue(e)},isItemDisabled(e){return Lr(e)&&Os(e,"disabled")?!!e.disabled:!1}},ac=class cc{constructor(t){_(this,"options",t),_(this,"items"),_(this,"indexMap",null),_(this,"copy",n=>new cc({...this.options,items:n??[...this.items]})),_(this,"isEqual",n=>bn(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)??Ds.itemToValue(n)),_(this,"getItemDisabled",n=>n==null?!1:this.options.isItemDisabled?.(n)??Ds.isItemDisabled(n)),_(this,"stringifyItem",n=>n==null?null:this.options.itemToString?.(n)??Ds.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 l=n(i,a);r.has(l)||r.set(l,[]),r.get(l).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 l=s.indexOf(i),c=s.indexOf(a);return l===-1?1:c===-1?-1:l-c}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)&&vu(this.stringifyItem(a),n))return a}}),_(this,"search",(n,s)=>{const{state:r,currentValue:o,timeout:i=350}=s,a=r.keysSoFar+n,c=a.length>1&&Array.from(a).every(g=>g===a[0])?a[0]:a,f=this.getByText(c,o),u=this.getItemValue(f);function h(){clearTimeout(r.timer),r.timer=-1}function p(g){r.keysSoFar=g,h(),g!==""&&(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(kn(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(kn(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(kn(this.items,r+1,...s))}),_(this,"prepend",(...n)=>this.copy(kn(this.items,0,...n))),_(this,"append",(...n)=>this.copy(kn(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(hs(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(hs(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(hs(this.items,o,r+1))}),_(this,"reorder",(n,s)=>this.copy(hs(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}},vu=(e,t)=>!!e?.toLowerCase().startsWith(t.toLowerCase());function kn(e,t,...n){return[...e.slice(0,t),...n,...e.slice(t)]}function hs(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 lc({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 dc({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 ps({values:e,collection:t,selectedItemMap:n}){const s=lc({values:e,collection:t,selectedItemMap:n}),r=dc({selectedItemMap:n,values:e,selectedItems:s,collection:t});return{selectedItems:s,nextSelectedItemMap:r}}function yu({selectedItems:e,collection:t}){return dc({selectedItemMap:new Map,values:e.map(n=>t.getItemValue(n)).filter(Boolean),selectedItems:e,collection:t})}var Gs=e=>new ac(e);Gs.empty=()=>new ac({items:[]});var bu=Object.defineProperty,wu=(e,t,n)=>t in e?bu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mr=(e,t,n)=>wu(e,typeof t!="symbol"?t+"":t,n),Eu=(e,t)=>e.map((n,s)=>e[(Math.max(t,0)+s)%e.length]),Ys=()=>{},lr=e=>typeof e=="object"&&e!==null,P=e=>e?"":void 0,he=e=>e?"true":void 0,xu=1,Su=9,$u=11,fe=e=>lr(e)&&e.nodeType===xu&&typeof e.nodeName=="string",Bo=e=>lr(e)&&e.nodeType===Su,Iu=e=>lr(e)&&e===e.window,uc=e=>fe(e)?e.localName||"":"#document";function Cu(e){return["html","body","#document"].includes(uc(e))}var fc=e=>lr(e)&&e.nodeType!==void 0,fn=e=>fc(e)&&e.nodeType===$u&&"host"in e,hc=e=>fe(e)&&e.localName==="input",Tu=e=>fe(e)?e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0:!1;function io(e){if(!e)return!1;const t=e.getRootNode();return dr(t)===e}var ku=/(textarea|select)/;function Au(e){if(e==null||!fe(e))return!1;try{return hc(e)&&e.selectionStart!=null||ku.test(e.localName)||e.isContentEditable||e.getAttribute("contenteditable")==="true"||e.getAttribute("contenteditable")===""}catch{return!1}}function hn(e,t){if(!e||!t||!fe(e)||!fc(t))return!1;if(fe(t)&&e===t||e.contains(t))return!0;const n=t.getRootNode?.();if(n&&fn(n)){let s=t;for(;s;){if(e===s)return!0;s=s.parentNode||s.host}}return!1}function Me(e){return Bo(e)?e:Iu(e)?e.document:e?.ownerDocument??document}function Lu(e){return Me(e).documentElement}function me(e){return fn(e)?me(e.host):Bo(e)?e.defaultView??window:fe(e)?e.ownerDocument?.defaultView??window:window}function dr(e){let t=e.activeElement;for(;t?.shadowRoot;){const n=t.shadowRoot.activeElement;if(!n||n===t)break;t=n}return t}function Hi(e,t){return!e||e===Me(e).body?!1:!t.some(n=>hn(n,e))}function Ou(e){if(uc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||fn(e)&&e.host||Lu(e);return fn(t)?t.host:t}function Mu(e){let t;try{if(t=e.getRootNode({composed:!0}),Bo(t)||fn(t))return t}catch{}return e.ownerDocument??document}var Dr=new WeakMap;function pc(e){return Dr.has(e)||Dr.set(e,me(e).getComputedStyle(e)),Dr.get(e)}var jo=()=>typeof document<"u";function Du(){return navigator.userAgentData?.platform??navigator.platform}function Ru(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}var Wo=e=>jo()&&e.test(Du()),Pu=e=>jo()&&e.test(Ru()),Vu=/^iPhone/i,Nu=/^iPad/i,Fu=/^Mac/i,Hu=/Android/i,_i=()=>jo()&&!!navigator.maxTouchPoints,_u=()=>Wo(Vu),Bu=()=>Wo(Nu)||Uo()&&navigator.maxTouchPoints>1,gc=()=>_u()||Bu(),Uo=()=>Wo(Fu),ju=()=>Pu(Hu),Wu=new Set(["menu","listbox","dialog","grid","tree","region","application"]),Uu=e=>Wu.has(e),qu=e=>e.getAttribute("aria-controls")?.split(" ")||[];function Gu(e,t){const n=new Set,s=Mu(e),r=o=>{const i=o.querySelectorAll("[aria-controls]");for(const a of i){if(a.getAttribute("aria-expanded")!=="true")continue;const l=qu(a);for(const c of l){if(!c||n.has(c))continue;n.add(c);const f=s.getElementById(c);if(f){const u=f.getAttribute("role"),h=f.getAttribute("aria-modal")==="true";if(u&&Uu(u)&&!h&&(f===t||f.contains(t)||r(f)))return!0}}}return!1};return r(e)}function Yu(e){return e.composedPath?.()??e.nativeEvent?.composedPath?.()}function ft(e){return Yu(e)?.[0]??e.target}function Ku(e){return qo(e).isComposing||e.keyCode===229}function zu(e){return e.pointerType===""&&e.isTrusted?!0:ju()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}var Zu=e=>e.button===2||Uo()&&e.ctrlKey&&e.button===0,Ju={Up:"ArrowUp",Down:"ArrowDown",Esc:"Escape"," ":"Space",",":"Comma",Left:"ArrowLeft",Right:"ArrowRight"},Bi={ArrowLeft:"ArrowRight",ArrowRight:"ArrowLeft"};function ao(e,t={}){const{dir:n="ltr",orientation:s="horizontal"}=t;let r=e.key;return r=Ju[r]??r,n==="rtl"&&s==="horizontal"&&r in Bi&&(r=Bi[r]),r}function qo(e){return e.nativeEvent??e}var Rs=(e,t,n,s)=>{const r=typeof e=="function"?e():e;return r?.addEventListener(t,n,s),()=>{r?.removeEventListener(t,n,s)}};function Xu(e,t){const{type:n="HTMLInputElement",property:s="value"}=t,r=me(e)[n].prototype;return Object.getOwnPropertyDescriptor(r,s)??{}}function Qu(e){if(e.localName==="input")return"HTMLInputElement";if(e.localName==="textarea")return"HTMLTextAreaElement";if(e.localName==="select")return"HTMLSelectElement"}function gs(e,t,n="value"){if(!e)return;const s=Qu(e);s&&Xu(e,{type:s,property:n}).set?.call(e,t),e.setAttribute(n,t)}function ef(e){return e.matches("textarea, input, select, button")}function tf(e,t){if(!e)return;const n=ef(e)?e.form:e.closest("form"),s=r=>{r.defaultPrevented||t()};return n?.addEventListener("reset",s,{passive:!0}),()=>n?.removeEventListener("reset",s)}function nf(e,t){const n=e?.closest("fieldset");if(!n)return;t(n.disabled);const s=me(n),r=new s.MutationObserver(()=>t(n.disabled));return r.observe(n,{attributes:!0,attributeFilter:["disabled"]}),()=>r.disconnect()}function sf(e,t){if(!e)return;const{onFieldsetDisabledChange:n,onFormReset:s}=t,r=[tf(e,s),nf(e,n)];return()=>r.forEach(o=>o?.())}var mc=Symbol.for("zag.changeEvent");function vc(e){return Object.prototype.hasOwnProperty.call(e,mc)}function rf(e){return vc(e)||Object.defineProperty(e,mc,{value:!0}),e}var of=e=>fe(e)&&e.tagName==="IFRAME";function af(e){const t=e.getAttribute("tabindex");return t?parseInt(t,10):NaN}var cf=e=>af(e)<0;function lf(e){return hc(e)&&e.type==="radio"}function df(e){if(!lf(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&&ur(o)),r=s.find(o=>o.checked);return r?r===e:s[0]===e}function uf(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 ff(e,t,n){const s=[...e],r=[...e],o=new Set,i=new Map;e.forEach((l,c)=>i.set(l,c));let a=0;for(;a<r.length;){const l=r[a++];if(!l||o.has(l))continue;o.add(l);const c=uf(l,t);if(c){const f=Array.from(c.querySelectorAll(Go)).filter(n),u=i.get(l);if(u!==void 0){const h=u+1;s.splice(h,0,...f),f.forEach((p,g)=>{i.set(p,h+g)});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,g)=>{i.set(p,h+g)})}r.push(...f)}}return s}var Go="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 ur(e){return!fe(e)||e.closest("[inert]")?!1:e.matches(Go)&&Tu(e)}function Yo(e,t={}){if(!e)return[];const{includeContainer:n,getShadowRoot:s}=t,r=Array.from(e.querySelectorAll(Go));n&&Rr(e)&&r.unshift(e);const o=[];for(const i of r)if(Rr(i)){if(of(i)&&i.contentDocument){const a=i.contentDocument.body;o.push(...Yo(a,{getShadowRoot:s}));continue}o.push(i)}if(s){const i=ff(o,s,Rr);return!i.length&&n?r:i}return!o.length&&n?r:o}function Rr(e){return fe(e)&&e.tabIndex>0?!0:!ur(e)||cf(e)?!1:df(e)}function hf(e,t={}){const n=Yo(e,t),s=n[0]||null,r=n[n.length-1]||null;return[s,r]}function pf(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=Yo(t).filter(a=>s?s(a):!0).find(a=>!a.hasAttribute("data-no-autofocus"))),o||t||void 0)}function gf(e){const t=e.currentTarget;if(!t)return!1;const[n,s]=hf(t);return!(io(n)&&e.shiftKey||io(s)&&!e.shiftKey||!n&&!s)}var yc=class bc{constructor(){Mr(this,"id",null),Mr(this,"fn_cleanup"),Mr(this,"cleanup",()=>{this.cancel()})}static create(){return new bc}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 pe(e){const t=yc.create();return t.request(e),t.cleanup}function wc(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 Pr=new WeakMap;function mf(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 vf(e){const t=mf(e),n=JSON.stringify(t);return{observe(s,r){const o=me(s);if(typeof o.MutationObserver!="function")return Ys;const i=Pr.get(s)??new Map;let a=i.get(n);if(!a){const c=new Set,f=new o.MutationObserver(u=>{for(const h of[...c])if(c.has(h))try{h(u)}catch(p){o.queueMicrotask(()=>{throw p})}});f.observe(s,t),a={observer:f,listeners:c},i.set(n,a),Pr.set(s,i)}const l=c=>r(c);return a.listeners.add(l),()=>{!a.listeners.delete(l)||a.listeners.size>0||(a.observer.disconnect(),i.delete(n),i.size===0&&Pr.delete(s))}}}}function yf(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 bf(e,t){const n=pe,s=[];return s.push(n(()=>{const r=typeof e=="function"?e():e;s.push(yf(r,t))})),()=>{s.forEach(r=>r?.())}}function co(e){const t=Ou(e);return Cu(t)?Me(t).body:fe(t)&&xf(t)?t:co(t)}var wf=/auto|scroll|overlay|hidden|clip/,Ef=new Set(["inline","contents"]);function xf(e){const t=me(e),{overflow:n,overflowX:s,overflowY:r,display:o}=t.getComputedStyle(e);return wf.test(n+r+s)&&!Ef.has(o)}var ji=/auto|scroll|overlay|hidden/;function Sf(e,t={}){const{axis:n}=t,{overflowX:s,overflowY:r}=me(e).getComputedStyle(e),o=n!=="y"&&ji.test(s)&&e.scrollWidth>e.clientWidth,i=n!=="x"&&ji.test(r)&&e.scrollHeight>e.clientHeight;return o||i}var rn="default",lo="",Ps=new WeakMap;function $f(e={}){const{target:t,doc:n}=e,s=n??document,r=s.documentElement;return gc()?(rn==="default"&&(lo=r.style.webkitUserSelect,r.style.webkitUserSelect="none"),rn="disabled"):t&&(Ps.set(t,t.style.userSelect),t.style.userSelect="none"),()=>Ec({target:t,doc:s})}function Ec(e={}){const{target:t,doc:n}=e,r=(n??document).documentElement;if(gc()){if(rn!=="disabled")return;rn="restoring",setTimeout(()=>{wc(()=>{rn==="restoring"&&(r.style.webkitUserSelect==="none"&&(r.style.webkitUserSelect=lo||""),lo="",rn="default")})},300)}else if(t&&Ps.has(t)){const o=Ps.get(t);t.style.userSelect==="none"&&(t.style.userSelect=o??""),t.getAttribute("style")===""&&t.removeAttribute("style"),Ps.delete(t)}}function If(e={}){const{defer:t,target:n,...s}=e,r=t?pe:i=>i(),o=[];return o.push(r(()=>{const i=typeof n=="function"?n():n;o.push($f({...s,target:i}))})),()=>{o.forEach(i=>i?.())}}function Cf(e,t){return Array.from(e?.querySelectorAll(t)??[])}function Tf(e,t){return e?.querySelector(t)??null}var Ko=e=>e.id;function kf(e,t,n=Ko){return e.find(s=>n(s)===t)}function Af(e,t,n=Ko){const s=kf(e,t,n);return s?e.indexOf(s):-1}function Lf(e,t){const{rootEl:n,...s}=t||{};!e||!n||Sf(n)&&e.scrollIntoView(s)}var Wi,Of=()=>Wi??(Wi=new Intl.Collator(void 0,{usage:"search",sensitivity:"base"})),Mf=e=>e.normalize("NFC").trim(),Df=e=>Mf(e.dataset?.valuetext??e.textContent??""),Rf=(e,t)=>{const n=t.normalize("NFC");return Of().compare(e.slice(0,n.length),n)===0};function Pf(e,t,n,s=Ko){const r=n?Af(e,n,s):-1;let o=n?Eu(e,r):e;return t.length===1&&(o=o.filter(a=>s(a)!==n)),o.find(a=>Rf(Df(a),t))}function Vf(e,t){if(!e)return Ys;const n=Object.keys(t).reduce((s,r)=>(s[r]=e.style.getPropertyValue(r),s),{});return Nf(n,t)?Ys:(Object.assign(e.style,t),()=>{Object.assign(e.style,n),e.style.length===0&&e.removeAttribute("style")})}function Nf(e,t){return Object.keys(e).every(n=>e[n]===t[n])}function Ff(e,t){const{state:n,activeId:s,key:r,timeout:o=350,itemToId:i}=t,a=n.keysSoFar+r,c=a.length>1&&Array.from(a).every(g=>g===a[0])?a[0]:a;let f=e.slice();const u=Pf(f,c,s,i);function h(){clearTimeout(n.timer),n.timer=-1}function p(g){n.keysSoFar=g,h(),g!==""&&(n.timer=+setTimeout(()=>{p(""),h()},o))}return p(a),u}var uo=Object.assign(Ff,{defaultOptions:{keysSoFar:"",timer:-1},isValidEvent:Hf});function Hf(e){return e.key.length===1&&!e.ctrlKey&&!e.metaKey}var _f={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 l=setTimeout(()=>{a(new Error(`Timeout of ${n}ms exceeded`))},n);s.addEventListener("abort",()=>{clearTimeout(l),a(new DOMException("Promise aborted","AbortError"))}),e.then(c=>{s.aborted||(clearTimeout(l),i(c))}).catch(c=>{s.aborted||(clearTimeout(l),a(c))})}),()=>t.abort()]}function jf(e,t){const{timeout:n,rootNode:s}=t,r=me(s),o=Me(s),i=new r.AbortController;let a;const l=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),c=()=>a?.disconnect();return l[0].then(c,c),l}var Wf=vf({});function Uf(e,t,n={}){const{defer:s,onMissing:r,getRootNode:o}=n,i=()=>typeof e=="function"?e():e,a=[],l=c=>{if(!c)return r?.();a.push(t(c))};if(!s)l(i());else{let c=!1;a.push(()=>{c=!0}),queueMicrotask(()=>{if(c)return;const f=i();if(f){l(f);return}let u=!1;const h=m=>{c||u||(u=!0,g(),d(),l(m))},p=o?.(),g=p?Wf.observe(p,()=>{const m=i();m&&h(m)}):Ys,d=pe(()=>h(i()));a.push(g,d)})}return()=>{a.forEach(c=>c?.())}}function qf(e){return!(e.metaKey||!Uo()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}var Gf=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),Yf=["a[href]","audio[controls]","button","details","embed","iframe","img[controls]","img[usemap]","input","select","textarea","video[controls]"].join(",");function Kf(e,t,n){const s=n?ft(n):null,r=Me(s),o=me(s),i=dr(r);return e=e||i instanceof o.HTMLInputElement&&!Gf.has(i?.type)||i instanceof o.HTMLTextAreaElement||i instanceof o.HTMLElement&&i.isContentEditable,!(e&&t==="keyboard"&&n instanceof o.KeyboardEvent&&!Reflect.has(Zf,n.key))}var ht=null,fo=new Set,Ks=new Map,jt=!1,xt=null,ho=!1,Vr=null,zf=!1,Zf={Tab:!0,Escape:!0};function fr(e,t){for(let n of fo)n(e,t)}function zs(e){xt=null,jt=!0,qf(e)&&(ht="keyboard",fr("keyboard",e))}function Te(e){(e.type==="pointermove"||e.type==="mousemove")&&e.isTrusted&&Vr?.x===e.clientX&&Vr?.y===e.clientY||(Vr={x:e.clientX,y:e.clientY},ht="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(xt=null,jt=!0,fr("pointer",e)))}function xc(e){if(zu(e)){xt=null,jt=!0,ht="virtual";return}xt=null;const t=ft(e),n=t?.closest("label"),s=n?.control;if(!n||!s||s.matches(":disabled"))return;const r=t?.closest(Yf);r&&n.contains(r)&&r!==s||s!==dr(n.ownerDocument)&&(xt=s)}function Sc(e){const t=ft(e),n=t===xt;t===me(t)||t===Me(t)||zf||!e.isTrusted||(!jt&&!n&&!ho&&(ht="virtual",fr("virtual",e)),jt=!1,xt=null,ho=!1)}function $c(){jt=!1,xt=null,ho=!0}function Jf(e){try{return e.focus}catch{return}}function Xf(e){const t=e.HTMLElement.prototype;try{let s=function(){jt=!0,(r??i.call(this)).apply(this,arguments)};var n=s;const r=Jf(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 Qf(e){if(typeof window>"u"||Ks.get(me(e)))return;const t=me(e),n=Me(e),s=Xf(t);n.addEventListener("keydown",zs,!0),n.addEventListener("keyup",zs,!0),n.addEventListener("click",xc,!0),t.addEventListener("focus",Sc,!0),t.addEventListener("blur",$c,!1),typeof t.PointerEvent<"u"?(n.addEventListener("pointerdown",Te,!0),n.addEventListener("pointermove",Te,!0),n.addEventListener("pointerup",Te,!0)):(n.addEventListener("mousedown",Te,!0),n.addEventListener("mousemove",Te,!0),n.addEventListener("mouseup",Te,!0)),t.addEventListener("beforeunload",()=>{eh(e)},{once:!0}),Ks.set(t,s)}var eh=(e,t)=>{const n=me(e),s=Me(e),r=Ks.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",zs,!0),s.removeEventListener("keyup",zs,!0),s.removeEventListener("click",xc,!0),n.removeEventListener("focus",Sc,!0),n.removeEventListener("blur",$c,!1),typeof n.PointerEvent<"u"?(s.removeEventListener("pointerdown",Te,!0),s.removeEventListener("pointermove",Te,!0),s.removeEventListener("pointerup",Te,!0)):(s.removeEventListener("mousedown",Te,!0),s.removeEventListener("mousemove",Te,!0),s.removeEventListener("mouseup",Te,!0)),Ks.delete(n)}};function po(){return ht}function th(e){ht=e,fr(e,null)}function Ui(){return ht==="keyboard"||ht==="virtual"}function nh(e={}){const{isTextInput:t,autoFocus:n,onChange:s,root:r}=e;Qf(r),s?.({isFocusVisible:n||Ui(),modality:ht});const o=(i,a)=>{Kf(!!t,i,a)&&s?.({isFocusVisible:Ui(),modality:i})};return fo.add(o),()=>{fo.delete(o)}}const sh=["top","right","bottom","left"],Ct=Math.min,rt=Math.max,Zs=Math.round,ms=Math.floor,ot=e=>({x:e,y:e}),rh={left:"right",right:"left",bottom:"top",top:"bottom"};function Ic(e,t,n){return rt(e,Ct(t,n))}function pt(e,t){return typeof e=="function"?e(t):e}function Tt(e){return e.split("-")[0]}function wn(e){return e.split("-")[1]}function zo(e){return e==="x"?"y":"x"}function Zo(e){return e==="y"?"height":"width"}function Be(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Jo(e){return zo(Be(e))}function oh(e,t,n){n===void 0&&(n=!1);const s=wn(e),r=Jo(e),o=Zo(r);let i=r==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=Js(i)),[i,Js(i)]}function ih(e){const t=Js(e);return[go(e),t,go(t)]}function go(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const qi=["left","right"],Gi=["right","left"],ah=["top","bottom"],ch=["bottom","top"];function lh(e,t,n){switch(e){case"top":case"bottom":return n?t?Gi:qi:t?qi:Gi;case"left":case"right":return t?ah:ch;default:return[]}}function dh(e,t,n,s){const r=wn(e);let o=lh(Tt(e),n==="start",s);return r&&(o=o.map(i=>i+"-"+r),t&&(o=o.concat(o.map(go)))),o}function Js(e){const t=Tt(e);return rh[t]+e.slice(t.length)}function uh(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 Cc(e){return typeof e!="number"?uh(e):{top:e,right:e,bottom:e,left:e}}function Xs(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 Yi(e,t,n){let{reference:s,floating:r}=e;const o=Be(t),i=Jo(t),a=Zo(i),l=Tt(t),c=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(l){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 g=wn(t);return g&&(p[i]+=h*(g==="end"?1:-1)*(n&&c?-1:1)),p}async function fh(e,t){var n;t===void 0&&(t={});const{x:s,y:r,platform:o,rects:i,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:h=!1,padding:p=0}=pt(t,e),g=Cc(p),m=a[h?u==="floating"?"reference":"floating":u],y=Xs(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(m)))==null||n?m:m.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:f,strategy:l})),$=u==="floating"?{x:s,y:r,width:i.floating.width,height:i.floating.height}:i.reference,w=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),M=await(o.isElement==null?void 0:o.isElement(w))&&await(o.getScale==null?void 0:o.getScale(w))||{x:1,y:1},O=Xs(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:$,offsetParent:w,strategy:l}):$);return{top:(y.top-O.top+g.top)/M.y,bottom:(O.bottom-y.bottom+g.bottom)/M.y,left:(y.left-O.left+g.left)/M.x,right:(O.right-y.right+g.right)/M.x}}const hh=50,ph=async(e,t,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:o=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:fh},l=await(i.isRTL==null?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:f,y:u}=Yi(c,s,l),h=s,p=0;const g={};for(let d=0;d<o.length;d++){const m=o[d];if(!m)continue;const{name:y,fn:$}=m,{x:w,y:M,data:O,reset:R}=await $({x:f,y:u,initialPlacement:s,placement:h,strategy:r,middlewareData:g,rects:c,platform:a,elements:{reference:e,floating:t}});f=w??f,u=M??u,g[y]={...g[y],...O},R&&p<hh&&(p++,typeof R=="object"&&(R.placement&&(h=R.placement),R.rects&&(c=R.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):R.rects),{x:f,y:u}=Yi(c,h,l)),d=-1)}return{x:f,y:u,placement:h,strategy:r,middlewareData:g}},gh=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:r,rects:o,platform:i,elements:a,middlewareData:l}=t,{element:c,padding:f=0}=pt(e,t)||{};if(c==null)return{};const u=Cc(f),h={x:n,y:s},p=Jo(r),g=Zo(p),d=await i.getDimensions(c),m=p==="y",y=m?"top":"left",$=m?"bottom":"right",w=m?"clientHeight":"clientWidth",M=o.reference[g]+o.reference[p]-h[p]-o.floating[g],O=h[p]-o.reference[p],R=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c));let E=R?R[w]:0;(!E||!await(i.isElement==null?void 0:i.isElement(R)))&&(E=a.floating[w]||o.floating[g]);const C=M/2-O/2,x=E/2-d[g]/2-1,T=Ct(u[y],x),b=Ct(u[$],x),A=E-d[g]-b,D=E/2-d[g]/2+C,V=Ic(T,D,A),H=!l.arrow&&wn(r)!=null&&D!==V&&o.reference[g]/2-(D<T?T:b)-d[g]/2<0,z=H?D<T?D-T:D-A:0;return{[p]:h[p]+z,data:{[p]:V,centerOffset:D-V-z,...H&&{alignmentOffset:z}},reset:H}}}),mh=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:l,elements:c}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:d=!0,...m}=pt(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const y=Tt(r),$=Be(a),w=Tt(a)===a,M=await(l.isRTL==null?void 0:l.isRTL(c.floating)),O=h||(w||!d?[Js(a)]:ih(a)),R=g!=="none";!h&&R&&O.push(...dh(a,d,g,M));const E=[a,...O],C=await l.detectOverflow(t,m),x=[];let T=((s=o.flip)==null?void 0:s.overflows)||[];if(f&&x.push(C[y]),u){const V=oh(r,i,M);x.push(C[V[0]],C[V[1]])}if(T=[...T,{placement:r,overflows:x}],!x.every(V=>V<=0)){var b,A;const V=(((b=o.flip)==null?void 0:b.index)||0)+1,H=E[V];if(H&&(!(u==="alignment"?$!==Be(H):!1)||T.every(Z=>Be(Z.placement)===$?Z.overflows[0]>0:!0)))return{data:{index:V,overflows:T},reset:{placement:H}};let z=(A=T.filter(re=>re.overflows[0]<=0).sort((re,Z)=>re.overflows[1]-Z.overflows[1])[0])==null?void 0:A.placement;if(!z)switch(p){case"bestFit":{var D;const re=(D=T.filter(Z=>{if(R){const W=Be(Z.placement);return W===$||W==="y"}return!0}).map(Z=>[Z.placement,Z.overflows.filter(W=>W>0).reduce((W,be)=>W+be,0)]).sort((Z,W)=>Z[1]-W[1])[0])==null?void 0:D[0];re&&(z=re);break}case"initialPlacement":z=a;break}if(r!==z)return{reset:{placement:z}}}return{}}}};function Ki(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function zi(e){return sh.some(t=>e[t]>=0)}const vh=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:r="referenceHidden",...o}=pt(e,t);switch(r){case"referenceHidden":{const i=await s.detectOverflow(t,{...o,elementContext:"reference"}),a=Ki(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:zi(a)}}}case"escaped":{const i=await s.detectOverflow(t,{...o,altBoundary:!0}),a=Ki(i,n.floating);return{data:{escapedOffsets:a,escaped:zi(a)}}}default:return{}}}}},Tc=new Set(["left","top"]);async function yh(e,t){const{placement:n,platform:s,elements:r}=e,o=await(s.isRTL==null?void 0:s.isRTL(r.floating)),i=Tt(n),a=wn(n),l=Be(n)==="y",c=Tc.has(i)?-1:1,f=o&&l?-1:1,u=pt(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:g}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof g=="number"&&(p=a==="end"?g*-1:g),l?{x:p*f,y:h*c}:{x:h*c,y:p*f}}const bh=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,l=await yh(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:r+l.x,y:o+l.y,data:{...l,placement:i}}}}},wh=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:l={fn:$=>{let{x:w,y:M}=$;return{x:w,y:M}}},...c}=pt(e,t),f={x:n,y:s},u=await o.detectOverflow(t,c),h=Be(r),p=zo(h);let g=f[p],d=f[h];const m=($,w)=>Ic(w+u[$==="y"?"top":"left"],w,w-u[$==="y"?"bottom":"right"]);i&&(g=m(p,g)),a&&(d=m(h,d));const y=l.fn({...t,[p]:g,[h]:d});return{...y,data:{x:y.x-n,y:y.y-s,enabled:{[p]:i,[h]:a}}}}}},Eh=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,s;const{x:r,y:o,placement:i,rects:a,middlewareData:l}=t,{offset:c=0,mainAxis:f=!0,crossAxis:u=!0}=pt(e,t),h={x:r,y:o},p=Be(i),g=zo(p);let d=h[g],m=h[p];const y=pt(c,t),$=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:(n=y.mainAxis)!=null?n:0,crossAxis:(s=y.crossAxis)!=null?s:0};if(f){const O=g==="y"?"height":"width",R=a.reference[g]-a.floating[O]+$.mainAxis,E=a.reference[g]+a.reference[O]-$.mainAxis;d<R?d=R:d>E&&(d=E)}if(u){var w,M;const O=g==="y"?"width":"height",R=Tc.has(Tt(i)),E=a.reference[p]-a.floating[O]+(R&&((w=l.offset)==null?void 0:w[p])||0)+(R?0:$.crossAxis),C=a.reference[p]+a.reference[O]+(R?0:((M=l.offset)==null?void 0:M[p])||0)-(R?$.crossAxis:0);m<E?m=E:m>C&&(m=C)}return{[g]:d,[p]:m}}}},xh=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}=pt(e,t),l=await r.detectOverflow(t,a),c=Tt(n),f=wn(n),u=Be(n)==="y",{width:h,height:p}=s.floating;let g,d;c==="top"||c==="bottom"?(g=c,d=f===(await(r.isRTL==null?void 0:r.isRTL(o.floating))?"start":"end")?"left":"right"):(d=c,g=f==="end"?"top":"bottom");const m=p-l.top-l.bottom,y=h-l.left-l.right,$=Ct(p-l[g],m),w=Ct(h-l[d],y),M=t.middlewareData.shift,O=!M;let R=$,E=w;M!=null&&M.enabled.x&&(E=y),M!=null&&M.enabled.y&&(R=m),O&&!f&&(u?E=h-2*rt(l.left,l.right):R=p-2*rt(l.top,l.bottom)),await i({...t,availableWidth:E,availableHeight:R});const C=await r.getDimensions(o.floating);return h!==C.width||p!==C.height?{reset:{rects:!0}}:{}}}};function hr(){return typeof window<"u"}function En(e){return kc(e)?(e.nodeName||"").toLowerCase():"#document"}function Ee(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function mt(e){var t;return(t=(kc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function kc(e){return hr()?e instanceof Node||e instanceof Ee(e).Node:!1}function qe(e){return hr()?e instanceof Element||e instanceof Ee(e).Element:!1}function Lt(e){return hr()?e instanceof HTMLElement||e instanceof Ee(e).HTMLElement:!1}function Zi(e){return!hr()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ee(e).ShadowRoot}function pr(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 Sh(e){return/^(table|td|th)$/.test(En(e))}function gr(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const $h=/transform|translate|scale|rotate|perspective|filter/,Ih=/paint|layout|strict|content/,Vt=e=>!!e&&e!=="none";let Nr;function Xo(e){const t=qe(e)?Ge(e):e;return Vt(t.transform)||Vt(t.translate)||Vt(t.scale)||Vt(t.rotate)||Vt(t.perspective)||!Qo()&&(Vt(t.backdropFilter)||Vt(t.filter))||$h.test(t.willChange||"")||Ih.test(t.contain||"")}function Ch(e){let t=Wt(e);for(;Lt(t)&&!Jn(t);){if(Xo(t))return t;if(gr(t))return null;t=Wt(t)}return null}function Qo(){return Nr==null&&(Nr=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Nr}function Jn(e){return/^(html|body|#document)$/.test(En(e))}function Ge(e){return Ee(e).getComputedStyle(e)}function mr(e){return qe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Wt(e){if(En(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Zi(e)&&e.host||mt(e);return Zi(t)?t.host:t}function Ac(e){const t=Wt(e);return Jn(t)?(e.ownerDocument||e).body:Lt(t)&&pr(t)?t:Ac(t)}function Xn(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=Ac(e),o=r===((s=e.ownerDocument)==null?void 0:s.body),i=Ee(r);if(o){const a=mo(i);return t.concat(i,i.visualViewport||[],pr(r)?r:[],a&&n?Xn(a):[])}else return t.concat(r,Xn(r,[],n))}function mo(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Lc(e){const t=Ge(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const r=Lt(e),o=r?e.offsetWidth:n,i=r?e.offsetHeight:s,a=Zs(n)!==o||Zs(s)!==i;return a&&(n=o,s=i),{width:n,height:s,$:a}}function ei(e){return qe(e)?e:e.contextElement}function an(e){const t=ei(e);if(!Lt(t))return ot(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:o}=Lc(t);let i=(o?Zs(n.width):n.width)/s,a=(o?Zs(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const Th=ot(0);function Oc(e){const t=Ee(e);return!Qo()||!t.visualViewport?Th:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function kh(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Ee(e)}function Ut(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=ei(e);let i=ot(1);t&&(s?qe(s)&&(i=an(s)):i=an(e));const a=kh(o,n,s)?Oc(o):ot(0);let l=(r.left+a.x)/i.x,c=(r.top+a.y)/i.y,f=r.width/i.x,u=r.height/i.y;if(o&&s){const h=Ee(o),p=qe(s)?Ee(s):s;let g=h,d=mo(g);for(;d&&p!==g;){const m=an(d),y=d.getBoundingClientRect(),$=Ge(d),w=y.left+(d.clientLeft+parseFloat($.paddingLeft))*m.x,M=y.top+(d.clientTop+parseFloat($.paddingTop))*m.y;l*=m.x,c*=m.y,f*=m.x,u*=m.y,l+=w,c+=M,g=Ee(d),d=mo(g)}}return Xs({width:f,height:u,x:l,y:c})}function vr(e,t){const n=mr(e).scrollLeft;return t?t.left+n:Ut(mt(e)).left+n}function Mc(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-vr(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?gr(t.floating):!1;if(s===i||a&&o)return n;let l={scrollLeft:0,scrollTop:0},c=ot(1);const f=ot(0),u=Lt(s);if((u||!o)&&((En(s)!=="body"||pr(i))&&(l=mr(s)),u)){const p=Ut(s);c=an(s),f.x=p.x+s.clientLeft,f.y=p.y+s.clientTop}const h=i&&!u&&!o?Mc(i,l):ot(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+f.x+h.x,y:n.y*c.y-l.scrollTop*c.y+f.y+h.y}}function Lh(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Oh(e){const t=mr(e),n=e.ownerDocument.body,s=rt(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=rt(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let o=-t.scrollLeft+vr(e);const i=-t.scrollTop;return Ge(n).direction==="rtl"&&(o+=rt(e.clientWidth,n.clientWidth)-s),{width:s,height:r,x:o,y:i}}const Mh=25;function Dh(e,t,n){n===void 0&&(n="viewport");const s=n==="layoutViewport",r=Ee(e),o=mt(e),i=r.visualViewport;let a=o.clientWidth,l=o.clientHeight,c=0,f=0;if(i){const h=!Qo()||t==="fixed";s?h||(c=-i.offsetLeft,f=-i.offsetTop):(a=i.width,l=i.height,h&&(c=i.offsetLeft,f=i.offsetTop))}if(vr(o)<=0){const h=o.ownerDocument,p=h.body,g=getComputedStyle(p),d=h.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,m=Math.abs(o.clientWidth-p.clientWidth-d),y=getComputedStyle(o).scrollbarGutter==="stable both-edges"?m/2:m;y<=Mh&&(a-=y)}return{width:a,height:l,x:c,y:f}}function Rh(e,t){const n=Ut(e,!0,t==="fixed"),s=n.top+e.clientTop,r=n.left+e.clientLeft,o=an(e),i=e.clientWidth*o.x,a=e.clientHeight*o.y,l=r*o.x,c=s*o.y;return{width:i,height:a,x:l,y:c}}function Ji(e,t,n){let s;if(t==="viewport"||t==="layoutViewport")s=Dh(e,n,t);else if(t==="document")s=Oh(mt(e));else if(qe(t))s=Rh(t,n);else{const r=Oc(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Xs(s)}function Ph(e,t){const n=t.get(e);if(n)return n;let s=Xn(e,[],!1).filter(a=>qe(a)&&En(a)!=="body"),r=null;const o=Ge(e).position==="fixed";let i=o?Wt(e):e;for(;qe(i)&&!Jn(i);){const a=Ge(i),l=Xo(i),c=r?r.position:o?"fixed":"";!l&&(c==="fixed"||c==="absolute"&&a.position==="static")?s=s.filter(u=>u!==i):r=a,i=Wt(i)}return t.set(e,s),s}function Vh(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const i=[...n==="clippingAncestors"?gr(t)?[]:Ph(t,this._c):[].concat(n),s],a=Ji(t,i[0],r);let l=a.top,c=a.right,f=a.bottom,u=a.left;for(let h=1;h<i.length;h++){const p=Ji(t,i[h],r);l=rt(p.top,l),c=Ct(p.right,c),f=Ct(p.bottom,f),u=rt(p.left,u)}return{width:c-u,height:f-l,x:u,y:l}}function Nh(e){const{width:t,height:n}=Lc(e);return{width:t,height:n}}function Fh(e,t,n){const s=Lt(t),r=mt(t),o=n==="fixed",i=Ut(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=ot(0);if((s||!o)&&((En(t)!=="body"||pr(r))&&(a=mr(t)),s)){const h=Ut(t,!0,o,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}!s&&r&&(l.x=vr(r));const c=r&&!s&&!o?Mc(r,a):ot(0),f=i.left+a.scrollLeft-l.x-c.x,u=i.top+a.scrollTop-l.y-c.y;return{x:f,y:u,width:i.width,height:i.height}}function Fr(e){return Ge(e).position==="static"}function Xi(e,t){if(!Lt(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 Dc(e,t){const n=Ee(e);if(gr(e))return n;if(!Lt(e)){let r=Wt(e);for(;r&&!Jn(r);){if(qe(r)&&!Fr(r))return r;r=Wt(r)}return n}let s=Xi(e,t);for(;s&&Sh(s)&&Fr(s);)s=Xi(s,t);return s&&Jn(s)&&Fr(s)&&!Xo(s)?n:s||Ch(e)||n}const Hh=async function(e){const t=this.getOffsetParent||Dc,n=this.getDimensions,s=await n(e.floating);return{reference:Fh(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function _h(e){return Ge(e).direction==="rtl"}const Bh={convertOffsetParentRelativeRectToViewportRelativeRect:Ah,getDocumentElement:mt,getClippingRect:Vh,getOffsetParent:Dc,getElementRects:Hh,getClientRects:Lh,getDimensions:Nh,getScale:an,isElement:qe,isRTL:_h};function Rc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function jh(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:g,width:d,height:m}=h;if(f||t(),!d||!m)return;const y=ms(g),$=ms(o.clientWidth-(p+d)),w=ms(o.clientHeight-(g+m)),M=ms(p),R={rootMargin:-y+"px "+-$+"px "+-w+"px "+-M+"px",threshold:rt(0,Ct(1,u))||1};let E=!0;function C(x){const T=x[0].intersectionRatio;if(!Rc(h,e.getBoundingClientRect()))return a();if(T!==u){if(!E)return a();T?a(!1,T):r=setTimeout(()=>{a(!1,1e-7)},1e3)}E=!1}try{s=new IntersectionObserver(C,{...R,root:o.ownerDocument})}catch{s=new IntersectionObserver(C,R)}s.observe(e)}const l=Ee(e),c=()=>a(n);return l.addEventListener("resize",c),a(!0),()=>{l.removeEventListener("resize",c),i()}}function Wh(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:l=!1}=s,c=ei(e),f=r||o?[...c?Xn(c):[],...t?Xn(t):[]]:[];f.forEach(y=>{r&&y.addEventListener("scroll",n),o&&y.addEventListener("resize",n)});const u=c&&a?jh(c,n,o):null;let h=-1,p=null;i&&(p=new ResizeObserver(y=>{let[$]=y;$&&$.target===c&&p&&t&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(t)})),n()}),c&&!l&&p.observe(c),t&&p.observe(t));let g,d=l?Ut(e):null;l&&m();function m(){const y=Ut(e);d&&!Rc(d,y)&&n(),d=y,g=requestAnimationFrame(m)}return n(),()=>{var y;f.forEach($=>{r&&$.removeEventListener("scroll",n),o&&$.removeEventListener("resize",n)}),u?.(),(y=p)==null||y.disconnect(),p=null,l&&cancelAnimationFrame(g)}}const Uh=bh,qh=wh,Gh=mh,Yh=xh,Kh=vh,zh=gh,Zh=Eh,Jh=(e,t,n)=>{const s=new Map,r=n??{},o={...Bh,...r.platform,_c:s};return ph(e,t,{...r,platform:o})};function Qi(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 Xh(e){if(!e)return Qi();const{x:t,y:n,width:s,height:r}=e;return Qi(t,n,s,r)}function Qh(e,t){return{contextElement:fe(e)?e:e?.contextElement,getBoundingClientRect:()=>{const n=e,s=t?.(n);return s||!n?Xh(s):n.getBoundingClientRect()}}}var An=e=>({variable:e,reference:`var(${e})`}),Qe={arrowSize:An("--arrow-size"),arrowSizeHalf:An("--arrow-size-half"),arrowBg:An("--arrow-background"),transformOrigin:An("--transform-origin"),arrowOffset:An("--arrow-offset")},ep=e=>e==="top"||e==="bottom"?"y":"x";function tp(e,t){return{name:"transformOrigin",fn(n){const{elements:s,middlewareData:r,placement:o,rects:i,y:a}=n,l=o.split("-")[0],c=ep(l),f=r.arrow?.x||0,u=r.arrow?.y||0,h=t?.clientWidth||0,p=t?.clientHeight||0,g=f+h/2,d=u+p/2,m=Math.abs(r.shift?.y||0),y=i.reference.height/2,$=p/2,w=e.offset?.mainAxis??e.gutter,M=typeof w=="number"?w+$:w??$,O=m>M,R={top:`${g}px calc(100% + ${M}px)`,bottom:`${g}px ${-M}px`,left:`calc(100% + ${M}px) ${d}px`,right:`${-M}px ${d}px`}[l],E=`${g}px ${i.reference.y+y-a}px`,C=!!e.overlap&&c==="y"&&O;return s.floating.style.setProperty(Qe.transformOrigin.variable,C?E:R),{data:{transformOrigin:C?E:R}}}}}var np={name:"rects",fn({rects:e}){return{data:e}}},sp=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% + ${Qe.arrowOffset.reference})`}),{}}}};function rp(e){const[t,n]=e.split("-");return{side:t,align:n,hasAlign:n!=null}}function Pc(e){return e.split("-")[0]}var op={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 ea(e,t){const n=e.devicePixelRatio||1;return Math.round(t*n)/n}function on(e,t){return e!=null&&Math.abs(e-t)<.5}function yr(e){return typeof e=="function"?e():e==="clipping-ancestors"?"clippingAncestors":e}function ip(e,t,n){const s=e||t.createElement("div");return zh({element:s,padding:n.arrowPadding})}function ap(e,t){if(!iu(t.offset??t.gutter))return Uh(({placement:n})=>{const s=(e?.clientHeight||0)/2,r=t.offset?.mainAxis??t.gutter,o=typeof r=="number"?r+s:r??s,{hasAlign:i}=rp(n),a=i?void 0:t.shift,l=t.offset?.crossAxis??a;return _o({crossAxis:l,mainAxis:o,alignmentAxis:t.shift})})}function cp(e){if(e.flip)return Gh(()=>{const t=yr(e.boundary);return{...t?{boundary:t}:void 0,padding:e.overflowPadding,fallbackPlacements:e.flip===!0?void 0:e.flip}})}function lp(e){if(!(!e.slide&&!e.overlap))return qh(()=>{const t=yr(e.boundary);return{...t?{boundary:t}:void 0,mainAxis:e.slide,crossAxis:e.overlap,padding:e.overflowPadding,limiter:Zh()}})}function dp(e){if(e.sizeMiddleware===!1&&!e.sameWidth&&!e.fitViewport)return;let t,n,s,r;return Yh(()=>{const o=yr(e.boundary);return{padding:e.overflowPadding,...o?{boundary:o}:void 0,apply({elements:i,rects:a,availableHeight:l,availableWidth:c}){const f=i.floating,u=Math.round(a.reference.width),h=Math.round(a.reference.height);c=Math.floor(c),l=Math.floor(l),on(t,u)||(f.style.setProperty("--reference-width",`${u}px`),t=u),on(n,h)||(f.style.setProperty("--reference-height",`${h}px`),n=h),on(s,c)||(f.style.setProperty("--available-width",`${c}px`),s=c),on(r,l)||(f.style.setProperty("--available-height",`${l}px`),r=l)}}})}function up(e){if(e.hideWhenDetached)return Kh(()=>({strategy:"referenceHidden",boundary:yr(e.boundary)??"clippingAncestors"}))}function fp(e){return e?e===!0?{ancestorResize:!0,ancestorScroll:!0,elementResize:!0,layoutShift:!0}:e:{}}var hp=["transform","visibility","pointer-events","--x","--y","--z-index","z-index","--reference-width","--reference-height","--available-width","--available-height","--transform-origin"],pp=["top","right","bottom","left"],Bn=new WeakSet;function gp(e,t){const n=e.style.getPropertyValue("z-index"),s=Bn.has(e),r=s&&n==="var(--z-index)";s&&!r&&Bn.delete(e);const o=pc(t).zIndex;if(o==="auto"){r&&(e.style.removeProperty("z-index"),Bn.delete(e));return}n&&!r||(e.style.setProperty("--z-index",o),e.style.setProperty("z-index","var(--z-index)"),Bn.add(e))}function ta(e,t){if(!e)return rc;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 na(e){return e==null?null:fe(e)?e:typeof e=="object"&&e&&"contextElement"in e&&e.contextElement?e.contextElement:e}function mp(e,t,n={}){const s=()=>(typeof t=="function"?t():t)??null,r=()=>{const T=typeof e=="function"?e():e;return n.getAnchorElement?.()??T},o=()=>{const T=r();return!T&&!n.getAnchorRect?null:Qh(T,n.getAnchorRect)},i=Object.assign({},op,n);let a=[],l=null,c,f;function u(T){if(c?.(),f?.(),l=T,i.restoreStyles){const A=ta(T,hp);c=()=>{A(),Bn.delete(T)}}else c=void 0;const b=T.querySelector("[data-part=arrow]");f=i.restoreStyles?ta(b,pp):void 0,a=[ap(b,i),cp(i),lp(i),ip(b,T.ownerDocument,i),sp(b),tp({gutter:i.gutter,offset:i.offset,overlap:i.overlap},b),dp(i),up(i),np]}const{placement:h,strategy:p,onComplete:g,onPositioned:d}=i;let m,y,$=!1,w,M,O=rc;const R=fp(i.listeners);function E(){if(!i.listeners)return;const T=r(),b=o(),A=s();if(!b||!A)return;(na(T)!==na(w)||A!==M)&&(O(),w=T,M=A,O=Wh(b,A,x,R))}async function C(){E();const T=s();if(!T)return;T!==l&&(u(T),$=!1);const b=o();if(!b)return;const A=await Jh(b,T,{placement:h,middleware:a,strategy:p}),D=me(T),V=ea(D,A.x),H=ea(D,A.y);if(g?.({...A,x:V,y:H}),i.applyStyles!==!1&&(on(m,V)||(T.style.setProperty("--x",`${V}px`),m=V),on(y,H)||(T.style.setProperty("--y",`${H}px`),y=H),i.hideWhenDetached&&(A.middlewareData.hide?.referenceHidden?(T.style.setProperty("visibility","hidden"),T.style.setProperty("pointer-events","none")):(T.style.removeProperty("visibility"),T.style.removeProperty("pointer-events"))),!$)){const z=T.firstElementChild;z&&(gp(T,z),$=!0)}}async function x(){n.updatePosition?(await n.updatePosition({updatePosition:C,floatingElement:s()}),d?.({placed:!0})):await C()}return x(),()=>{O(),f?.(),c?.(),d?.({placed:!1})}}function vo(e,t,n={}){const{defer:s,...r}=n,o=s?pe:a=>a(),i=[];return i.push(o(()=>{i.push(mp(e,t,r))})),()=>{i.forEach(a=>a?.())}}var vp={bottom:"rotate(45deg)",left:"rotate(135deg)",top:"rotate(225deg)",right:"rotate(315deg)"};function Vc(e={}){const{placement:t,sameWidth:n,fitViewport:s,strategy:r="absolute",applyStyles:o=!0}=e;return{arrow:{position:"absolute",width:Qe.arrowSize.reference,height:Qe.arrowSize.reference,[Qe.arrowSizeHalf.variable]:`calc(${Qe.arrowSize.reference} / 2)`,[Qe.arrowOffset.variable]:`calc(${Qe.arrowSizeHalf.reference} * -1)`},arrowTip:{transform:t?vp[t.split("-")[0]]:void 0,background:Qe.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 yp=e=>e.ids?.root??`select:${e.id}`,yo=e=>e.ids?.content??`select:${e.id}:content`,bo=e=>e.ids?.trigger??`select:${e.id}:trigger`,Nc=e=>e.ids?.clearTrigger??`select:${e.id}:clear-trigger`,vs=e=>e.ids?.label??`select:${e.id}:label`,bp=e=>e.ids?.control??`select:${e.id}:control`,wo=(e,t)=>e.ids?.item?.(t)??`select:${e.id}:option:${t}`,Eo=e=>e.ids?.hiddenSelect??`select:${e.id}:select`,Fc=e=>e.ids?.positioner??`select:${e.id}:positioner`,wp=(e,t)=>e.ids?.itemGroup?.(t)??`select:${e.id}:optgroup:${t}`,sa=(e,t)=>e.ids?.itemGroupLabel?.(t)??`select:${e.id}:optgroup-label:${t}`,Hr=e=>e.getById(Eo(e)),Ln=e=>e.getById(yo(e)),_t=e=>e.getById(bo(e)),Ep=e=>e.getById(Nc(e)),_r=e=>e.getById(Fc(e)),Br=(e,t)=>t==null?null:e.getById(wo(e,t)),xp={clearTriggerLabel:"Clear value"};function Sp(e,t){const{context:n,prop:s,scope:r,state:o,computed:i,send:a}=e,l=ic(xp,s("translations")),c=s("disabled")||n.get("fieldsetDisabled"),f=!!s("invalid"),u=!!s("required"),h=!!s("readOnly"),p=s("composite"),g=s("collection"),d=o.hasTag("open"),m=o.matches("focused"),y=n.get("highlightedValue"),$=n.get("highlightedItem"),w=i("selectedItems"),M=n.get("currentPlacement"),O=M?Pc(M):void 0,R=i("isTypingAhead"),E=i("isInteractive"),C=y?wo(r,y):void 0;function x(b){const A=g.getItemDisabled(b.item),D=g.getItemValue(b.item);return cr(D,()=>`[zag-js] No value found for item ${JSON.stringify(b.item)}`),{value:D,disabled:!!(c||A),highlighted:y===D,selected:n.get("value").includes(D)}}const T=Vc({...s("positioning"),placement:M});return{open:d,focused:m,empty:n.get("value").length===0,highlightedItem:$,highlightedValue:y,selectedItems:w,hasSelectedItems:i("hasSelectedItems"),value:n.get("value"),valueAsString:i("valueAsString"),collection:g,multiple:!!s("multiple"),disabled:!!c,reposition(b={}){a({type:"POSITIONING.SET",options:b})},focus(){_t(r)?.focus({preventScroll:!0})},setOpen(b){a({type:b?"OPEN":"CLOSE",replaces:"open"})},selectValue(b){a({type:"ITEM.SELECT",value:b})},setValue(b){a({type:"VALUE.SET",value:b})},selectAll(){a({type:"VALUE.SET",value:g.getValues()})},setHighlightValue(b){a({type:"HIGHLIGHTED_VALUE.SET",value:b})},clearHighlightValue(){a({type:"HIGHLIGHTED_VALUE.CLEAR"})},clearValue(b){a(b?{type:"ITEM.CLEAR",value:b}:{type:"VALUE.CLEAR"})},getItemState:x,getRootProps(){return t.element({...ve.root.attrs,dir:s("dir"),id:yp(r),"data-invalid":P(f),"data-readonly":P(h)})},getLabelProps(){return t.label({dir:s("dir"),id:vs(r),...ve.label.attrs,"data-disabled":P(c),"data-invalid":P(f),"data-readonly":P(h),"data-required":P(u),htmlFor:Eo(r),onClick(b){b.defaultPrevented||c||_t(r)?.focus({preventScroll:!0})}})},getControlProps(){return t.element({...ve.control.attrs,dir:s("dir"),id:bp(r),"data-state":d?"open":"closed","data-focus":P(m),"data-disabled":P(c),"data-invalid":P(f)})},getValueTextProps(){return t.element({...ve.valueText.attrs,dir:s("dir"),"data-disabled":P(c),"data-invalid":P(f),"data-focus":P(m)})},getTriggerProps(){return t.button({id:bo(r),disabled:c,dir:s("dir"),type:"button",role:"combobox","aria-controls":yo(r),"aria-expanded":d,"aria-haspopup":"listbox","data-state":d?"open":"closed","aria-invalid":f,"aria-required":u,"aria-labelledby":vs(r),...ve.trigger.attrs,"data-disabled":P(c),"data-invalid":P(f),"data-readonly":P(h),"data-placement":M,"data-side":O,"data-placeholder-shown":P(!i("hasSelectedItems")),onClick(b){E&&(b.defaultPrevented||a({type:"TRIGGER.CLICK"}))},onFocus(){a({type:"TRIGGER.FOCUS"})},onBlur(){a({type:"TRIGGER.BLUR"})},onKeyDown(b){if(b.defaultPrevented||!E)return;const D={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(R?{type:"TRIGGER.TYPEAHEAD",key:V.key}:{type:"TRIGGER.ENTER"})}}[ao(b,{dir:s("dir"),orientation:"vertical"})];if(D){D(b),b.preventDefault();return}uo.isValidEvent(b)&&(a({type:"TRIGGER.TYPEAHEAD",key:b.key}),b.preventDefault())}})},getIndicatorProps(){return t.element({...ve.indicator.attrs,dir:s("dir"),"aria-hidden":!0,"data-state":d?"open":"closed","data-disabled":P(c),"data-invalid":P(f),"data-readonly":P(h)})},getItemProps(b){const A=x(b);return t.element({id:wo(r,A.value),role:"option",...ve.item.attrs,dir:s("dir"),"data-value":A.value,"aria-selected":A.selected,"data-state":A.selected?"checked":"unchecked","data-highlighted":P(A.highlighted),"data-disabled":P(A.disabled),"aria-disabled":he(A.disabled),onPointerMove(D){A.disabled||D.pointerType!=="mouse"||po()==="pointer"&&A.value!==y&&a({type:"ITEM.POINTER_MOVE",value:A.value})},onClick(D){D.defaultPrevented||A.disabled||a({type:"ITEM.CLICK",src:"pointerup",value:A.value})},onPointerLeave(D){A.disabled||b.persistFocus||D.pointerType==="mouse"&&po()==="pointer"&&a({type:"ITEM.POINTER_LEAVE"})}})},getItemTextProps(b){const A=x(b);return t.element({...ve.itemText.attrs,"data-state":A.selected?"checked":"unchecked","data-disabled":P(A.disabled),"data-highlighted":P(A.highlighted)})},getItemIndicatorProps(b){const A=x(b);return t.element({"aria-hidden":!0,...ve.itemIndicator.attrs,"data-state":A.selected?"checked":"unchecked",hidden:!A.selected})},getItemGroupLabelProps(b){const{htmlFor:A}=b;return t.element({...ve.itemGroupLabel.attrs,id:sa(r,A),dir:s("dir"),role:"presentation"})},getItemGroupProps(b){const{id:A}=b;return t.element({...ve.itemGroup.attrs,"data-disabled":P(c),id:wp(r,A),"aria-labelledby":sa(r,A),role:"group",dir:s("dir")})},getClearTriggerProps(){return t.button({...ve.clearTrigger.attrs,id:Nc(r),type:"button","aria-label":l.clearTriggerLabel,"data-invalid":P(f),disabled:c,hidden:!i("hasSelectedItems"),dir:s("dir"),onClick(b){b.defaultPrevented||a({type:"CLEAR.CLICK"})}})},getHiddenSelectProps(){const b=n.get("value"),A=s("multiple")?b:b?.[0],D=V=>{const H=qo(V);vc(H)||a({type:"VALUE.SET",value:$p(V.currentTarget)})};return t.select({name:s("name"),form:s("form"),disabled:c,multiple:s("multiple"),required:s("required"),"aria-hidden":!0,id:Eo(r),defaultValue:A,style:_f,tabIndex:-1,autoComplete:s("autoComplete"),onChange:D,onInput:D,onFocus(){_t(r)?.focus({preventScroll:!0})},"aria-labelledby":vs(r)})},getPositionerProps(){return t.element({...ve.positioner.attrs,dir:s("dir"),id:Fc(r),style:T.floating})},getContentProps(){return t.element({hidden:!d,dir:s("dir"),id:yo(r),role:p?"listbox":"dialog",...ve.content.attrs,"data-state":d?"open":"closed","data-placement":M,"data-side":O,"data-activedescendant":C,"aria-activedescendant":p?C:void 0,"aria-multiselectable":s("multiple")&&p?!0:void 0,"aria-labelledby":vs(r),tabIndex:0,onKeyDown(b){if(!E||!hn(b.currentTarget,ft(b)))return;if(b.key==="Tab"&&!gf(b)){b.preventDefault();return}const A={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){R?a({type:"CONTENT.TYPEAHEAD",key:H.key}):A.Enter?.()}},D=A[ao(b)];if(D){D(b),b.preventDefault();return}const V=ft(b);Au(V)||uo.isValidEvent(b)&&(a({type:"CONTENT.TYPEAHEAD",key:b.key}),b.preventDefault())}})},getListProps(){return t.element({...ve.list.attrs,tabIndex:0,role:p?void 0:"listbox","aria-labelledby":bo(r),"aria-activedescendant":p?void 0:C,"aria-multiselectable":!p&&s("multiple")?!0:void 0})}}}var $p=e=>e.multiple?Array.from(e.selectedOptions,t=>t.value):e.value?[e.value]:[];function Ip(e,t,n){let s=[],r;return o=>{const i=e(o);return(i.length!==s.length||i.some((l,c)=>!bn(s[c],l)))&&(s=i,r=t(i,o)),r}}function Cp(){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 Ot=".",Hc="#",ra=new WeakMap,_c=new WeakMap;function xo(e){return e.join(Ot)}function Tp(e){return e.includes(Ot)}function Bc(e){return e.startsWith(Hc)}function kp(e){return e.startsWith(Ot)}function Ap(e){return Bc(e)?e.slice(Hc.length):e}function So(e,t){return e?`${e}${Ot}${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)&&Fi(`[zag-js] Duplicate state id: "${i}"`),n.set(i,r));const a=o.states;if(a){cr(o.initial,()=>`[zag-js] Compound state "${r}" has child states but no "initial" property`),o.initial in a||Fi(`[zag-js] Compound state "${r}" has initial "${String(o.initial)}" which is not a child state`);for(const[l,c]of Object.entries(a)){if(!c)continue;const f=So(r,l);s(f,c)}}};for(const[r,o]of Object.entries(e.states))o&&s(r,o);return{index:t,idIndex:n}}function rs(e){const t=ra.get(e);if(t)return t;const{index:n,idIndex:s}=Lp(e);return ra.set(e,n),_c.set(e,s),n}function Op(e,t){return rs(e),_c.get(e)?.get(t)}function ti(e){return e?String(e).split(Ot).filter(Boolean):[]}function Qs(e,t){if(!t)return[];const n=rs(e),s=ti(t),r=[],o=[];for(const i of s){o.push(i);const a=xo(o),l=n.get(a);if(!l)break;r.push({path:a,state:l})}return r}function On(e,t){const n=rs(e),s=ti(t);if(!s.length)return t;const r=[];for(const a of s){r.push(a);const l=xo(r);if(!n.has(l))return t}let o=xo(r),i=n.get(o);for(;i?.initial;){const a=`${o}${Ot}${i.initial}`,l=n.get(a);if(!l)break;o=a,i=l}return o}function oa(e,t){return rs(e).has(t)}function ia(e,t,n){const s=String(t);if(Bc(s)){const r=Ap(s),o=Op(e,r);return cr(o,()=>`[zag-js] Unknown state id: "${r}"`),On(e,o)}if(kp(s)&&n){const r=So(n,s.slice(1));return On(e,r)}if(!Tp(s)&&n){const r=ti(n);for(let o=r.length-1;o>=1;o--){const i=r.slice(0,o).join(Ot),a=So(i,s);if(oa(e,a))return On(e,a)}if(oa(e,s))return On(e,s)}return On(e,s)}function Mp(e,t,n){const s=Qs(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 Dp(e,t,n,s){const r=t?Qs(e,t):[],o=Qs(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(),l=o.slice(i);const c=r[r.length-1]?.path===o[o.length-1]?.path;return s&&c&&(a=r.slice().reverse(),l=o),{exiting:a,entering:l}}function Rp(e,t){return e?e===t||e.startsWith(`${t}${Ot}`):!1}function Pp(e,t,n){return Qs(e,t).some(s=>s.state.tags?.includes(n))}function jc(){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 Wc(e){return rs(e),e}var jn=(e=>(e.NotStarted="Not Started",e.Started="Started",e.Stopped="Stopped",e))(jn||{}),ys="__init__";function Vp(e){const t=()=>e.getRootNode?.()??document,n=()=>Me(t());return{...e,getRootNode:t,getDoc:n,getWin:()=>n().defaultView??window,getActiveElement:()=>dr(t()),isActiveElement:io,getById:i=>t().getElementById(i)}}function Np(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 Fp(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 aa="pointerdown.outside",ca="focus.outside";function Hp(e){for(const t of e)if(fe(t)&&ur(t))return!0;return!1}var Uc=e=>"clientY"in e;function _p(e,t){if(!Uc(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 la(e,t){if(!t||!Uc(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 jp(e,t){const{exclude:n,onFocusOutside:s,onPointerDownOutside:r,onInteractOutside:o,defer:i,followControlledElements:a=!0}=t;if(!e)return;const l=Me(e),c=me(e),f=Np(c),u=Fp(c);function h(O,R){if(!fe(R)||!R.isConnected||hn(e,R)||_p(e,O)||a&&Gu(e,R))return!1;const E=l.querySelector(`[aria-controls="${e.id}"]`);if(E){const x=co(E);if(la(O,x))return!1}const C=co(e);return la(O,C)?!1:!n?.(R)}const p=new Set,g=fn(e?.getRootNode());let d=!1;function m(O){d=!0;const R=()=>{d=!1};l.addEventListener("pointerup",R,{once:!0}),c.addEventListener("pointerup",R,{once:!0});function E(C){const x=i&&!_i()?pe:A=>A(),T=C??O,b=T?.composedPath?.()??[T?.target];x(()=>{const A=g?b[0]:ft(O);if(!(!e||!h(O,A))){if(r||o){const D=qs(r,o);e.addEventListener(aa,D,{once:!0})}da(e,aa,{bubbles:!1,cancelable:!0,detail:{originalEvent:T,contextmenu:Zu(T),focusable:Hp(b),target:A}})}})}O.pointerType==="touch"?(p.forEach(C=>C()),p.add(Rs(l,"click",E,{once:!0})),p.add(u.addEventListener("click",E,{once:!0})),p.add(f.addEventListener("click",E,{once:!0}))):E()}const y=new Set,$=setTimeout(()=>{y.add(Rs(l,"pointerdown",m,!0)),y.add(u.addEventListener("pointerdown",m,!0)),y.add(f.addEventListener("pointerdown",m,!0))},0),w=yc.create();function M(O){if(d)return;(i?E=>w.request(E):E=>E())(()=>{const E=O?.composedPath?.()??[O?.target],C=g?E[0]:ft(O);if(!(!e||!h(O,C))){if(s||o){const x=qs(s,o);e.addEventListener(ca,x,{once:!0})}da(e,ca,{bubbles:!1,cancelable:!0,detail:{originalEvent:O,contextmenu:!1,focusable:ur(C),target:C}})}})}return _i()||(y.add(Rs(l,"focusin",M,!0)),y.add(u.addEventListener("focusin",M,!0)),y.add(f.addEventListener("focusin",M,!0))),()=>{clearTimeout($),w.cancel(),p.forEach(O=>O()),y.forEach(O=>O())}}function Wp(e,t){const{defer:n}=t,s=n?pe:o=>o(),r=[];return r.push(s(()=>{const o=typeof e=="function"?e():e;r.push(jp(o,t))})),()=>{r.forEach(o=>o?.())}}function da(e,t,n){const s=e.ownerDocument.defaultView||window,r=new s.CustomEvent(t,n);return e.dispatchEvent(r)}function Up(e,t){const n=s=>{s.key==="Escape"&&(s.isComposing||t?.(s))};return Rs(Me(e),"keydown",n,{capture:!0})}var ua="layer:request-dismiss",we={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=>hn(s.node,t))||this.recentlyRemoved.size>0)},isInBranch(e){return Array.from(this.branches).some(t=>hn(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&&qp(r)}),this.recentlyRemoved.add(e),wc(()=>this.recentlyRemoved.delete(e)),t<this.count()-1&&this.getNestedLayers(e).forEach(r=>we.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)=>{fa(e,t,e.node),e.styleTargets?.forEach(n=>{const s=n();if(!s||s===e.node)return;fa(e,t,s);const{zIndex:r}=pc(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];Yp(e,ua,r=>{s.requestDismiss?.(r),r.defaultPrevented||s?.dismiss()}),Gp(e,ua,{originalLayer:e,targetLayer:t,originalIndex:n,targetIndex:t?this.indexOf(t):-1}),this.syncLayers()},clear(){this.remove(this.layers[0].node)}};function fa(e,t,n){n.style.setProperty("--layer-index",`${t}`),n.removeAttribute("data-nested"),n.removeAttribute("data-has-nested"),we.getParentLayerOfType(e.node,e.type)&&n.setAttribute("data-nested",e.type);const r=we.countNestedLayersOfType(e.node,e.type);r>0&&n.setAttribute("data-has-nested",e.type),n.style.setProperty("--nested-layer-count",`${r}`)}function qp(e){e.style.removeProperty("--layer-index"),e.style.removeProperty("--nested-layer-count"),e.removeAttribute("data-nested"),e.removeAttribute("data-has-nested")}function Gp(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 Yp(e,t,n){e.addEventListener(t,n,{once:!0})}var jr=new WeakMap,Kn=new WeakMap;function Kp(e){return we.isBelowPointerBlockingLayer(e)?"none":"auto"}function qc(e){const t=Kp(e);e.style.pointerEvents!==t&&(e.style.pointerEvents=t)}function zp(e){if(Kn.has(e))return;const t=me(e);if(typeof t.MutationObserver>"u")return;const n=new t.MutationObserver(()=>{Kn.has(e)&&qc(e)});n.observe(e,{attributes:!0,attributeFilter:["style"]}),Kn.set(e,n)}function ha(){we.layers.forEach(({node:e})=>{qc(e),zp(e)})}function Zp(e){const t=Kn.get(e);t&&(t.disconnect(),Kn.delete(e)),e.style.pointerEvents=""}function Jp(e,t){const n=Me(e),s=[];return we.hasPointerBlockingLayer()&&!n.body.hasAttribute("data-inert")&&(jr.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]=jf(()=>{const a=r();return fe(a)?a:null},{timeout:1e3});o.then(a=>s.push(Vf(a,{pointerEvents:"auto"}))),s.push(i)}),()=>{we.hasPointerBlockingLayer()||(queueMicrotask(()=>{const r=n.body;if(!r)return;const o=jr.get(r);o!==void 0&&(r.style.pointerEvents=o,jr.delete(r)),r.removeAttribute("data-inert"),r.style.length===0&&r.removeAttribute("style")}),s.forEach(r=>r()))}}function Xp(e,t){const{onDismiss:n,onRequestDismiss:s,pointerBlocking:r,exclude:o,debug:i,type:a="dialog",layerStyleTargets:l}=t,c={dismiss:n,node:e,type:a,pointerBlocking:r,requestDismiss:s,styleTargets:l};we.add(c),ha();function f(d){const m=ft(d.detail.originalEvent);we.isBelowPointerBlockingLayer(e)||we.isInBranch(m)||(t.onPointerDownOutside?.(d),t.onInteractOutside?.(d),!d.defaultPrevented&&(i&&console.log("onPointerDownOutside:",d.detail.originalEvent),n?.(d)))}function u(d){const m=ft(d.detail.originalEvent);we.isInBranch(m)||(t.onFocusOutside?.(d),t.onInteractOutside?.(d),!d.defaultPrevented&&(i&&console.log("onFocusOutside:",d.detail.originalEvent),n?.(d)))}function h(d){we.isTopMost(e)&&(t.onEscapeKeyDown?.(d),!d.defaultPrevented&&n&&(d.preventDefault(),n(d)))}function p(d){const m=typeof o=="function"?o():o,y=Array.isArray(m)?m:[m],$=t.persistentElements?.map(w=>w()).filter(fe);return $&&y.push(...$),y.some(w=>hn(w,d))||we.isInNestedLayer(e,d)}const g=[r?Jp(e,t.persistentElements):void 0,Up(e,h),Wp(e,{exclude:p,onFocusOutside:u,onPointerDownOutside:f,defer:t.defer})];return()=>{we.remove(e),ha(),Zp(e),g.forEach(d=>d?.())}}function Gc(e,t){const{warnOnMissingNode:n=!0}=t;return Uf(e,s=>Xp(s,t),{defer:t.defer,getRootNode:t.getRootNode,onMissing:n?()=>Ms("[@zag-js/dismissable] node is `null` or `undefined`"):void 0})}var{and:Mn,not:Nt,or:Qp}=jc(),eg=Wc({props({props:e}){return{loopFocus:!1,closeOnSelect:!e.multiple,composite:!0,defaultValue:[],...e,collection:e.collection??Gs.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:bn,onChange(o){const i=n(),a=e("collection"),l=i.get("selectedItemMap"),c=ps({values:o,collection:a,selectedItemMap:l}),f=e("value")??o,u=f===o?c:ps({values:f,collection:a,selectedItemMap:c.nextSelectedItemMap});return i.set("selectedItemMap",u.nextSelectedItemMap),e("onValueChange")?.({value:o,items:c.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:yu({selectedItems:r,collection:e("collection")})}))}},refs(){return{typeahead:{...uo.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})=>lc({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:Qp("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:Mn(Nt("multiple"),"hasSelectedItems"),actions:["selectPreviousItem"]},{guard:Nt("multiple"),actions:["selectLastItem"]}],"TRIGGER.ARROW_RIGHT":[{guard:Mn(Nt("multiple"),"hasSelectedItems"),actions:["selectNextItem"]},{guard:Nt("multiple"),actions:["selectFirstItem"]}],"TRIGGER.HOME":{guard:Nt("multiple"),actions:["selectFirstItem"]},"TRIGGER.END":{guard:Nt("multiple"),actions:["selectLastItem"]},"TRIGGER.TYPEAHEAD":{guard:Nt("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:Mn("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:Mn("hasHighlightedItem","loop","isLastItemHighlighted"),actions:["highlightFirstItem"]},{guard:"hasHighlightedItem",actions:["highlightNextItem"]},{actions:["highlightFirstItem"]}],"CONTENT.ARROW_UP":[{guard:Mn("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})=>pa(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 nh({root:e.getRootNode?.()})},trackFormControlState({context:e,scope:t}){return sf(Hr(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=()=>Ln(e);let r=!0;return Gc(s,{type:"listbox",defer:!0,getRootNode:e.getRootNode,layerStyleTargets:[()=>_r(e)],exclude:[_t(e),Ep(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),vo(()=>_t(n),()=>_r(n),{defer:!0,...s,onComplete(i){e.set("currentPlacement",i.placement)}})},scrollToHighlightedItem({context:e,prop:t,scope:n}){const s=a=>{const l=e.get("highlightedValue");if(l==null||po()==="pointer")return;const f=Ln(n),u=t("scrollToIndexFn");if(u){const p=t("collection").indexOf(l);u?.({index:p,immediate:a,getElement:()=>Br(n,l)});return}const h=Br(n,l);Lf(h,{rootEl:f,block:"nearest"})},r=pe(()=>{th("virtual"),s(!0)}),i=bf(()=>Ln(n),{attributes:["data-activedescendant"],callback(){s(!1)}});return()=>{r(),i()}}},actions:{reposition({context:e,prop:t,scope:n,event:s}){const r=()=>_r(n);vo(_t(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}){pe(()=>{const t=pf({root:Ln(e)});t&&t.focus({preventScroll:!0})})},focusTriggerEl({event:e,scope:t}){if(!pa(e))return;const n=tg(e);pe(()=>{_t(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")?Ri(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")?Ri(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:()=>Br(t,n)})}else Ln(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=Hr(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=ps({values:e.get("value"),collection:n,selectedItemMap:e.get("selectedItemMap")});e.set("selectedItemMap",r.nextSelectedItemMap)},syncSelectedItems({context:e,prop:t}){const n=ps({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=Hr(e);if(!t)return;const n=e.getWin(),s=new n.Event("change",{bubbles:!0,composed:!0});t.dispatchEvent(rf(s))})}}}});function pa(e){const t=e.restoreFocus??e.previousEvent?.restoreFocus;return t==null||!!t}function tg(e){return e.focusVisible??e.previousEvent?.focusVisible?{preventScroll:!0,focusVisible:!0}:{preventScroll:!0}}function ng(e){return new Proxy({},{get(t,n){return n==="style"?s=>e({style:s}).style:e}})}var sg=Object.defineProperty,rg=(e,t,n)=>t in e?sg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Y=(e,t,n)=>rg(e,typeof t!="symbol"?t+"":t,n),ga={onFocus:"onFocusin",onBlur:"onFocusout",onChange:"onInput",onDoubleClick:"onDblclick",htmlFor:"for",className:"class",defaultValue:"value",defaultChecked:"checked"},og=new Set(["viewBox","preserveAspectRatio"]),Yc=ng(e=>Object.entries(e).reduce((t,[n,s])=>{if(s===void 0)return t;n in ga&&(n=ga[n]);const r=og.has(n)?n:n.toLowerCase();return t[r]=s,t},{})),bs=new WeakMap,ma=new Set(["value","checked","selected"]),ig=new Set(["viewBox","preserveAspectRatio","clipPath","clipRule","fillRule","strokeWidth","strokeLinecap","strokeLinejoin","strokeDasharray","strokeDashoffset","strokeMiterlimit"]),ag=e=>e.tagName==="svg"||e.namespaceURI==="http://www.w3.org/2000/svg",ws=(e,t)=>ag(e)&&ig.has(t)?t:t.toLowerCase(),Wr=e=>e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),va=(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(Wr(r));for(const r in n){const o=n[r];o==null?s.removeProperty(Wr(r)):s.setProperty(Wr(r),String(o))}}};function se(e,t,n){const s="default";let r=bs.get(e);r||(r=new Map,bs.set(e,r));const o=r.get(s)||{},i=Object.keys(t),a=(d,m)=>{e.addEventListener(d.toLowerCase(),m)},l=(d,m)=>{e.removeEventListener(d.toLowerCase(),m)},c=d=>d.startsWith("on"),f=d=>!d.startsWith("on"),u=d=>a(d.substring(2),t[d]),h=d=>l(d.substring(2),t[d]),p=d=>{const m=t[d],y=o[d];if(m!==y){if(d==="class"){e.className=m??"";return}if(d==="style"){va(e,y,m);return}if(ma.has(d)){e[d]=m??"";return}if(typeof m=="boolean"&&!d.includes("aria-")){e.toggleAttribute(ws(e,d),m);return}if(d==="children"){e.innerHTML=m;return}if(m!=null){e.setAttribute(ws(e,d),m);return}e.removeAttribute(ws(e,d))}};for(const d in o)t[d]==null&&(d==="class"?e.className="":d==="style"?va(e,o[d],void 0):ma.has(d)?e[d]="":e.removeAttribute(ws(e,d)));return Object.keys(o).filter(c).forEach(d=>{l(d.substring(2),o[d])}),i.filter(c).forEach(u),i.filter(f).forEach(p),r.set(s,t),function(){i.filter(c).forEach(h);const m=bs.get(e);m&&(m.delete(s),m.size===0&&bs.delete(e))}}function cg(){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 Kc(e,t){const n=cg();return n?(n[e]||(n[e]=t()),n[e]):t()}var Vs=Kc("__zag__refSet",()=>new WeakSet),lg=e=>typeof e=="object"&&e!==null&&"$$typeof"in e&&"props"in e,dg=e=>typeof e=="object"&&e!==null&&"__v_isVNode"in e,ug=e=>typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeName=="string",fg=e=>lg(e)||dg(e)||ug(e),$o=e=>e!==null&&typeof e=="object",ya=e=>$o(e)&&!Vs.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!fg(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 hg=Symbol(),ba=Object.getPrototypeOf,Io=new WeakMap,pg=e=>e&&(Io.has(e)?Io.get(e):ba(e)===Object.prototype||ba(e)===Array.prototype),gg=e=>pg(e)&&e[hg]||null,wa=(e,t=!0)=>{Io.set(e,t)};var Ht=Kc("__zag__proxyStateMap",()=>new WeakMap),mg=(e=Object.is,t=(a,l)=>new Proxy(a,l),n=new WeakMap,s=(a,l)=>{const c=n.get(a);if(c?.[0]===l)return c[1];const f=Array.isArray(a)?[]:Object.create(Object.getPrototypeOf(a));return wa(f,!0),n.set(a,[l,f]),Reflect.ownKeys(a).forEach(u=>{const h=Reflect.get(a,u);Vs.has(h)?(wa(h,!1),f[u]=h):Ht.has(h)?f[u]=yg(h):f[u]=h}),Object.freeze(f)},r=new WeakMap,o=[1,1],i=a=>{if(!$o(a))throw new Error("object required");const l=r.get(a);if(l)return l;let c=o[0];const f=new Set,u=(E,C=++o[0])=>{c!==C&&(c=C,f.forEach(x=>x(E,C)))};let h=o[1];const p=(E=++o[1])=>(h!==E&&!f.size&&(h=E,d.forEach(([C])=>{const x=C[1](E);x>c&&(c=x)})),c),g=E=>(C,x)=>{const T=[...C];T[1]=[E,...T[1]],u(T,x)},d=new Map,m=(E,C)=>{if(f.size){const x=C[3](g(E));d.set(E,[C,x])}else d.set(E,[C])},y=E=>{const C=d.get(E);C&&(d.delete(E),C[1]?.())},$=E=>(f.add(E),f.size===1&&d.forEach(([x,T],b)=>{const A=x[3](g(b));d.set(b,[x,A])}),()=>{f.delete(E),f.size===0&&d.forEach(([x,T],b)=>{T&&(T(),d.set(b,[x]))})}),w=Array.isArray(a)?[]:Object.create(Object.getPrototypeOf(a)),O=t(w,{deleteProperty(E,C){const x=Reflect.get(E,C);y(C);const T=Reflect.deleteProperty(E,C);return T&&u(["delete",[C],x]),T},set(E,C,x,T){const b=Reflect.has(E,C),A=Reflect.get(E,C,T);if(b&&(e(A,x)||r.has(x)&&e(A,r.get(x))))return!0;y(C),$o(x)&&(x=gg(x)||x);let D=x;if(!Object.getOwnPropertyDescriptor(E,C)?.set){!Ht.has(x)&&ya(x)&&(D=zc(x));const V=!Vs.has(D)&&Ht.get(D);V&&m(C,V)}return Reflect.set(E,C,D,T),u(["set",[C],x,A]),!0}});r.set(a,O);const R=[w,p,s,$];return Ht.set(O,R),Reflect.ownKeys(a).forEach(E=>{const C=Object.getOwnPropertyDescriptor(a,E);C.get||C.set?Object.defineProperty(w,E,C):O[E]=a[E]}),O})=>[i,Ht,Vs,e,t,ya,n,s,r,o],[vg]=mg();function zc(e={}){return vg(e)}function Ea(e,t,n){const s=Ht.get(e);let r;const o=[],i=s[3];let a=!1;const c=i(f=>{o.push(f),r||(r=Promise.resolve().then(()=>{r=void 0,a&&t(o.splice(0))}))});return a=!0,()=>{a=!1,c()}}function yg(e){const t=Ht.get(e),[n,s,r]=t;return r(n,s())}function er(e){const t=e().value??e().defaultValue;e().debug&&console.log(`[bindable > ${e().debug}] initial`,t);const n=e().isEqual??Object.is,s=zc({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=Xe(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)}}}er.cleanup=e=>{};er.ref=e=>{let t=e;return{get:()=>t,set:n=>{t=n}}};function bg(e){const t={current:e};return{get(n){return t.current[n]},set(n,s){t.current[n]=s}}}var{defineProperty:wg,getOwnPropertyDescriptor:Eg,getOwnPropertyDescriptors:xa}=Object;function Wn(e,t){if(Object.is(e,t))return e;if(!_n(e)||!_n(t))return t===void 0?e:t;let n=e;const s=(r,o)=>{n===e&&(n=Object.defineProperties({},xa(e))),wg(n,r,o)};for(const[r,o]of Object.entries(xa(t))){if(!o.enumerable)continue;if(o.get){s(r,o);continue}const i=o.value;if(i===void 0)continue;const a=!!Eg(e,r)?.get,l=e[r],c=_n(l)&&_n(i)?Wn(l,i):i;!a&&Object.is(l,c)||s(r,{value:c,writable:!0,enumerable:!0,configurable:!0})}return n}var Zc=class{constructor(e,t={}){Y(this,"machine",e),Y(this,"scope"),Y(this,"context"),Y(this,"prop"),Y(this,"state"),Y(this,"refs"),Y(this,"computed"),Y(this,"event",{type:""}),Y(this,"previousEvent",{type:""}),Y(this,"effects",new Map),Y(this,"replaceTracker",Cp()),Y(this,"transition",null),Y(this,"cleanups",[]),Y(this,"subscriptions",[]),Y(this,"userProps"),Y(this,"userPropsSources",[]),Y(this,"getUserProps",()=>{let u=this.userProps;for(const h of this.userPropsSources){const p=Ni(h);u=u?Wn(u,p):p}return u}),Y(this,"getEvent",()=>({...this.event,current:()=>this.event,previous:()=>this.previousEvent})),Y(this,"getState",()=>({...this.state,matches:(...u)=>u.some(h=>Rp(this.state.get(),h)),hasTag:u=>Pp(this.machine,this.state.get(),u)})),Y(this,"debug",(...u)=>{this.machine.debug&&console.log(...u)}),Y(this,"notify",()=>{this.publish()}),Y(this,"send",u=>{if(this.status!==jn.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 g=this.state.get();const d=u.type,{transitions:m,source:y}=Mp(this.machine,g,d),$=this.choose(m);if(!$)return;this.transition=$;const w=ia(this.machine,$.target??g,y);this.debug("transition",$),w!==g?this.state.set(w):$.reenter?this.state.invoke(g,g):this.action($.actions)})}),Y(this,"action",u=>{const h=Xe(u)?u(this.getParams()):u;if(!h)return;const p=h.map(g=>{const d=this.machine.implementations?.actions?.[g];return d||Ms(`[zag-js] No implementation found for action "${JSON.stringify(g)}"`),d});for(const g of p)g?.(this.getParams())}),Y(this,"guard",u=>{if(Xe(u))return u(this.getParams());const h=this.machine.implementations?.guards?.[u];return h||Ms(`[zag-js] No implementation found for guard "${JSON.stringify(u)}"`),h?.(this.getParams())}),Y(this,"effect",u=>{const h=Xe(u)?u(this.getParams()):u;if(!h)return;const p=h.map(d=>{const m=this.machine.implementations?.effects?.[d];return m||Ms(`[zag-js] No implementation found for effect "${JSON.stringify(d)}"`),m}),g=[];for(const d of p){const m=d?.(this.getParams());m&&g.push(m)}return()=>g.forEach(d=>d?.())}),Y(this,"choose",u=>Xd(u).find(h=>{let p=!h.guard;return ou(h.guard)?p=!!this.guard(h.guard):Xe(h.guard)&&(p=h.guard(this.getParams())),p})),Y(this,"subscribe",u=>(this.subscriptions.push(u),()=>{const h=this.subscriptions.indexOf(u);h>-1&&this.subscriptions.splice(h,1)})),Y(this,"status",jn.NotStarted),Y(this,"publish",()=>{this.callTrackers(),this.subscriptions.forEach(u=>u(this.service))}),Y(this,"trackers",[]),Y(this,"setupTrackers",()=>{this.machine.watch?.(this.getParams())}),Y(this,"callTrackers",()=>{this.trackers.forEach(({deps:u,fn:h})=>{const p=u.map(g=>g());bn(h.prev,p)||(h(),h.prev=p)})}),Y(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:fu,scope:this.scope,choose:this.choose})),Xe(t)?this.userPropsSources.push(t):this.userProps=t;const{id:n,ids:s,getRootNode:r}=Ni(t);this.scope=Vp({id:n,ids:s,getRootNode:r});const o=u=>{const h=this.getUserProps();return(e.props?.({props:_o(h),scope:this.scope})??h)[u]};this.prop=o;const i=e.context?.({prop:o,bindable:er,scope:this.scope,flush(u){queueMicrotask(u)},getContext(){return a},getComputed(){return l},getRefs(){return c},getEvent:this.getEvent.bind(this)});i&&Object.values(i).forEach(u=>{const h=Ea(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 l=u=>(cr(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:l}));this.computed=l;const c=bg(e.refs?.({prop:o,context:a})??{});this.refs=c;const f=er(()=>({defaultValue:ia(e,e.initialState({prop:o})),onChange:(u,h)=>{const{exiting:p,entering:g}=Dp(this.machine,h,u,this.transition?.reenter);if(p.forEach(d=>{this.effects.get(d.path)?.(),this.effects.delete(d.path)}),p.forEach(d=>{this.action(d.state?.exit)}),this.action(this.transition?.actions),g.forEach(d=>{const m=this.effect(d.state?.effects);if(m){const y=this.effects.get(d.path);this.effects.set(d.path,y?qs(y,m):m)}}),h===ys){this.action(e.entry);const d=this.effect(e.effects);if(d){const m=this.effects.get(ys);this.effects.set(ys,m?qs(m,d):d)}}g.forEach(d=>{this.action(d.state?.entry)})}}));this.state=f,this.cleanups.push(Ea(this.state.ref,()=>this.notify()))}updateProps(e){const t=this.userPropsSources;if(Xe(e))t.push(e);else if(t.length===0)this.userProps=Wn(this.userProps,e);else{const n=t.length-1,s=t[n];if(Xe(s)){const r=Wn({},e);r&&Object.keys(r).length>0&&t.push(r)}else t[n]=Wn(s,e)}this.notify()}start(){this.status=jn.Started,this.debug("initializing..."),this.state.invoke(this.state.initial,ys),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=jn.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 xg='<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 Sg=0;function $g(e){const t=document.createElement("span");t.className="ui-select",t.innerHTML=`<button type="button" class="ui-select-trigger"><span></span>${xg}</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="",l=e.value,c=e.disabled;const f=new Zc(eg,{id:`select-${++Sg}`,collection:Gs({items:i}),defaultValue:[l],disabled:c,positioning:{placement:"bottom-start",strategy:"fixed",sameWidth:!0,gutter:6},onValueChange({value:d}){e.value!==d[0]&&(l=e.value=d[0]??"",e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})))}}),u=()=>Sp(f.service,Yc);function h(){const d=u();se(t,d.getRootProps()),se(n,{...d.getTriggerProps(),"aria-label":e.getAttribute("aria-label")||e.labels?.[0]?.textContent?.trim(),"aria-labelledby":void 0}),se(r,d.getPositionerProps()),se(o,{...d.getContentProps(),"aria-label":e.getAttribute("aria-label"),"aria-labelledby":void 0});const m=e.selectedOptions[0]?.textContent||"Choose…";s.textContent!==m&&(s.textContent=m),i.forEach((y,$)=>{const w=o.children[$];se(w,d.getItemProps({item:y}))}),r.hidden=!d.open,d.open&&!r.matches(":popover-open")&&r.showPopover?.(),!d.open&&r.matches(":popover-open")&&r.hidePopover?.()}function p(){const d=Array.from(e.options,y=>({value:y.value,label:y.text,disabled:y.disabled})),m=JSON.stringify(d);m!==a&&(a=m,i=d,o.replaceChildren(...i.map(y=>{const $=document.createElement("div");return $.className="ui-select-option",$.textContent=y.label,$})),f.updateProps({collection:Gs({items:i})})),l!==e.value&&(l=e.value,u().setValue([l])),c!==e.disabled&&(c=e.disabled,f.updateProps({disabled:c})),h()}t.addEventListener("keydown",d=>d.stopPropagation()),e.addEventListener("change",p);const g=f.subscribe(h);return f.start(),p(),{sync:p,focus:()=>n.focus(),dispose(){e.removeEventListener("change",p),g(),f.stop(),t.remove(),e.hidden=!1}}}function Qn(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,$g(t))}function Ig(e){Qn(e.parentElement),wt.get(e)?.focus()}function Cg(){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")))))&&Qn()});return e.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["disabled"]}),Qn(),()=>{e.disconnect();for(const t of wt.values())t.dispose();wt.clear()}}function Tg(e){const t=document.createElement("dialog");t.className="launch-dialog",t.setAttribute("aria-labelledby","launch-heading"),t.innerHTML=`
10
10
  <button class="icon-button dialog-close" aria-label="Close open session">×</button>
11
11
  <h2 id="launch-heading">Open session</h2><p class="launch-title"></p>
12
12
  <label class="launch-destination">Open in<select aria-label="Open in">
@@ -26,7 +26,7 @@ lucide.createIcons({icons});\``);if(typeof document>"u")throw new Error("`create
26
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
27
  <p class="launch-availability"></p>
28
28
  </section>
29
- <p class="launch-status" role="status"></p>`,document.body.append(t);const n=new AbortController,s={signal:n.signal},r=b=>t.querySelector(b),o=r("select"),i=r(".launch-directory"),a=r(".launch-web-link"),l=r(".launch-command"),c=r(".launch-terminal"),f=r(".launch-copy"),u=r(".launch-status");let h,p=0,g=0,d,m,y,$,w,M=null;function O(){g++,m?.abort(),clearTimeout(w),y=void 0,l.value="",c.disabled=f.disabled=!0,r(".launch-summary").hidden=!0,r(".launch-availability").textContent=""}function R(){t.close(),p++,d?.abort(),O(),e(),M?.focus({preventScroll:!0})}async function E(b){try{await navigator.clipboard.writeText(b),u.textContent="Command copied."}catch{u.textContent=`Copy this command: ${b}`,b===l.value&&(l.focus(),l.select())}}function T(){if(a.hidden=!0,a.removeAttribute("href"),h&&$?.webBaseUrl)try{a.href=Yd($.webBaseUrl,h.nativeID||h.id),a.hidden=!1}catch{}u.textContent=$?a.hidden?"OpenCode is unavailable. Choose another app to use the saved conversation.":"":"Finding OpenCode…"}function x(b){const A=Hn.find(D=>D.id===o.value)?.name||Ue(o.value);l.value=b.command,f.disabled=!1,c.disabled=!b.terminalAvailable,c.textContent=`${b.mode==="resume"?"Resume in":"Open in"} ${A} ↗`,r(".launch-summary").hidden=!1,r(".launch-mode").textContent=b.mode==="resume"?"Resume original session":"New session · saved context",r(".launch-hint").textContent=b.mode==="resume"?`Continue this conversation in ${A}.`:`Start in ${A} with the saved conversation.`,r(".launch-context").hidden=!b.context,r(".launch-coverage").textContent=b.context?`${b.context.messages.toLocaleString()} / ${b.context.totalMessages.toLocaleString()} messages${b.context.partial?" · Partial history":""}`:"",r(".launch-context-path").textContent=b.context?.path||"",r(".launch-availability").textContent=b.targetAvailable?b.terminalAvailable?"":"Automatic terminal opening is unavailable. Run the copied command in your terminal.":`${A} CLI was not found. Install it, then run the copied command.`,u.textContent=""}async function C(){if(O(),!h||!t.open)return;const b=o.value==="web";if(r(".launch-web").hidden=!b,r(".launch-cli").hidden=b,b){T();return}if(!Ar(o.value))return;const A=g;m=new AbortController,u.textContent="Preparing command…";try{const D=await fetch(`/api/sessiongraph/session/${encodeURIComponent(h.id)}/prepare-launch`,{method:"POST",signal:m.signal,headers:{"Content-Type":"application/json","X-SessionGraph-Action":"prepare-launch"},body:JSON.stringify({target:o.value,directory:i.value})}),V=await D.json();if(!D.ok)throw new Error(V.error||"Could not prepare this session.");if(g!==A)return;y=V,x(y)}catch(D){g===A&&(l.placeholder="Command unavailable",u.textContent=D instanceof Error?D.message:"Could not prepare this session.")}}return o.addEventListener("change",()=>{try{localStorage.setItem("sessiongraph.open-target",o.value)}catch{}C()},s),i.addEventListener("input",()=>{O(),u.textContent="Checking working directory…",w=setTimeout(()=>{C()},300)},s),i.addEventListener("change",()=>{C()},s),r(".dialog-close").addEventListener("click",R,s),t.addEventListener("cancel",b=>{b.preventDefault(),R()},s),t.addEventListener("keydown",b=>{b.stopPropagation()},s),f.addEventListener("click",()=>{y&&E(y.command)},s),r(".launch-copy-pair").addEventListener("click",()=>{E("opencode pair")},s),c.addEventListener("click",async()=>{if(!h||!y||c.disabled)return;const b=p;c.disabled=o.disabled=i.disabled=!0,u.textContent="Opening Terminal…";try{const A=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:y.directory})}),D=await A.json();if(!A.ok)throw new Error(D.error||"Could not open Terminal.");p===b&&(u.textContent="Session sent to Terminal.")}catch(A){p===b&&(u.textContent=A instanceof Error?A.message:"Could not open Terminal. Copy the command instead.")}finally{p===b&&(o.disabled=i.disabled=!1,c.disabled=!y?.terminalAvailable)}},s),{async open(b){h=b;const A=++p;d?.abort(),d=new AbortController,$=void 0,O(),t.open||(M=document.activeElement),r(".launch-title").textContent=`${Ue(b.source)} · ${b.title}`,i.value=b.directory,i.disabled=o.disabled=!1,o.value=Ar(b.source)?b.source:"opencode";const D=(!b.source||b.source==="opencode")&&tc(b.nativeID||b.id);o.querySelector('[value="web"]').disabled=!D;for(const V of Hn)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");(Ar(V)||V==="web"&&D)&&(o.value=V)}catch{}l.placeholder="Preparing command…",r(".launch-context").open=!1,t.open||t.showModal(),e(),Ig(o),C();try{const V=await fetch(`/api/sessiongraph/session/${encodeURIComponent(b.id)}/connection`,{signal:d.signal});if(!V.ok)throw new Error("Connection unavailable");const H=await V.json();if(p!==A)return;$=H;for(const z of Hn){const re=H.targets.some(Z=>Z.id===z.id&&Z.available);o.querySelector(`[value="${z.id}"]`).textContent=`${z.name}${re?"":" · CLI not found"}`}o.value==="web"&&T()}catch{p===A&&o.value==="web"&&(u.textContent="OpenCode is unavailable. Choose another app to use the saved conversation.")}},dispose(){p++,d?.abort(),O(),n.abort(),t.remove()}}}const kg=e=>e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]);function Ag(e,t,n){const s=document.createElement("dialog");s.className="imports-dialog",s.setAttribute("aria-labelledby","imports-heading"),s.innerHTML='<button class="icon-button dialog-close" aria-label="Close sources">×</button><span class="eyebrow">SessionGraph</span><h2 id="imports-heading">Explore &amp; 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 &amp; 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(s);const r=x=>s.querySelector(x);let o=!1,i=0,a=!1,l=null,c=!1,f=!1,u=!1;const h=new AbortController;let p=!1,g=0,d=!1,m=!1,y=!1;function $(){const x=s.querySelectorAll("input:checked").length;r(".import-start").disabled=o||c||d,r(".import-start").textContent=o||c?"Importing…":d?"Finding sources…":m?p?x?"Import & continue →":"Continue without importing →":"Import updates ↗":"Try again",s.querySelectorAll("input").forEach(C=>{C.disabled=o||c})}async function w(x,C){const b=await fetch(`/api/sessiongraph/${x}`,{...C,signal:AbortSignal.any([h.signal,AbortSignal.timeout(3e4)])}),A=await b.json();if(b.status===409&&x==="import"&&C?.method==="POST")return w("import");if(!b.ok)throw new Error(A.error||"Import unavailable.");return A}function M(x){o=x.running,$(),r(".imports-progress").textContent=o?`${x.source?Ue(x.source):"Importing"} · ${x.imported.toLocaleString()} imported · ${x.unchanged.toLocaleString()} unchanged${x.discovered?` / ${x.discovered.toLocaleString()} found`:" · discovering…"}`:`${x.imported.toLocaleString()} imported · ${x.unchanged.toLocaleString()} already up to date${x.failed?` · ${x.failed} unavailable`:""}`,r(".imports-notes").hidden=!x.errors.length;const C=new Map;x.errors.forEach(b=>C.set(b,(C.get(b)||0)+1)),r(".imports-notes div").innerHTML=[...C].map(([b,A])=>`<p>${kg(b)}${A>1?` (${A} occurrences)`:""}</p>`).join(""),document.dispatchEvent(new CustomEvent("sessiongraph-import-status",{detail:x}))}async function O(){if(!(a||f)){i=0,f=!0;try{const x=await w("import");if(a)return;if(M(x),x.running)i=window.setTimeout(O,1e3);else{const C=y;y=!1,await e(u),!a&&C&&n(x.failed?"Import finished with some unavailable history. Open Manage sources for details or to retry.":x.imported+x.unchanged?"Your sessions are ready to explore.":"No conversations found. You can choose other sources in Manage sources.")}}catch(x){R(x)}finally{f=!1}}}function R(x){if(a)return;y=!1;const C=x instanceof Error?x.message:"Import unavailable.";M({running:!1,discovered:0,imported:0,unchanged:0,failed:1,errors:[C]}),r(".imports-progress").textContent=C,s.open||n(`${C} Open Manage sources to retry.`)}async function E(x,C=!1){if(a||C&&s.open)return;if(o||c||f||i){!C&&!s.open&&T();return}c=!0,u=C,o=!0,$();const b=p&&s.open&&x!==void 0,A=g;try{const D=await w("import",{method:"POST",headers:{"Content-Type":"application/json","X-SessionGraph-Action":"import"},body:JSON.stringify(C?{automatic:!0}:{sources:x})});if(a||(M(D),b&&(y=!!x?.length,g===A&&s.open&&s.close(),x?.length&&n("Import started. You can explore the map as soon as your sessions are ready."),await e(!0)),a))return;window.clearTimeout(i),i=window.setTimeout(O,100)}catch(D){R(D)}finally{c=!1,a||$()}}async function T(x=!1){p=x;const C=++g;d=!0,m=!1,l=document.activeElement,r("#imports-heading").textContent=x?"Explore & visualize all your LLM sessions":"Your session sources.",r("footer > span").textContent=x?"You can change sources later.":"Saved locally in SQLite",x&&(r(".imports-progress").textContent="Detected conversation sources are selected for you.",r(".imports-notes").hidden=!0),$(),s.open||s.showModal(),t(),r(".import-sources").textContent="Finding local session sources…";try{const b=await w("sources");if(a||C!==g)return;r(".import-sources").innerHTML=Qa(b.sources).map(D=>ec(D,{checked:D.selected||x&&D.available&&D.capabilities.history,disabled:o})).join(""),m=!0,x&&!s.querySelector("input:checked")&&(r(".imports-progress").textContent="No conversation sources selected. You can choose sources now or add them later.");const A=await w("import");if(a||C!==g)return;A.running?(M(A),window.clearTimeout(i),i=window.setTimeout(O,1e3)):x||M(A)}catch(b){!a&&C===g&&(m=!1,r(".import-sources").textContent=b instanceof Error?b.message:"Could not detect sources.")}finally{!a&&C===g&&(d=!1,$())}}return r(".import-sources").addEventListener("change",$),r(".import-start").addEventListener("click",()=>{m?E([...s.querySelectorAll("input:checked")].map(x=>x.value)):T(p)}),r(".dialog-close").addEventListener("click",()=>s.close()),s.addEventListener("close",()=>{g++,d=!1,t(),l?.focus()}),s.addEventListener("keydown",x=>x.stopPropagation()),{open:T,sources:async()=>(await w("sources")).sources,select:x=>E(x),get busy(){return o||c||f||!!i},refresh:(x=!1)=>E(void 0,x),resume:()=>{u=!0,o=!0,window.clearTimeout(i),O()},dispose:()=>{a=!0,h.abort(),window.clearTimeout(i),s.remove()}}}const Lg=6e4,Og=3e4;class Mg{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<Og)){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 Rg=Object.freeze({sourceID:"",projectID:"",directory:"",days:0,fromDate:"",toDate:"",includeChildren:!0,includeArchived:!1}),Pg=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 Vg(e){const t={...Rg};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"])Pg(n[s])&&(t[s]=n[s]);return t.fromDate&&t.toDate&&t.fromDate>t.toDate&&(t.fromDate="",t.toDate=""),t}const Ng=e=>typeof e=="number"&&Number.isSafeInteger(e)&&e>=0;function Jc(e){const t=e.filter(i=>["opencode","continue"].includes(i.source||"opencode")&&Ng(i.tokens)),n=t.filter(i=>Number.isFinite(i.activity?.lastMessageAt)&&i.activity.lastMessageAt>0).sort((i,a)=>Math.max(i.created,i.activity.lastMessageAt)-Math.max(a.created,a.activity.lastMessageAt)),s=[],r=[0];for(const i of n)s.push(Math.max(i.created,i.activity.lastMessageAt)),r.push(r.at(-1)+i.tokens);const o=t.reduce((i,a)=>i+a.tokens,0);return{recorded:t.length,missing:e.length-t.length,untimed:t.length-n.length,at(i,a=!1){if(a)return{tokens:o,sessions:t.length};let l=0,c=s.length;for(;l<c;){const f=l+c>>>1;s[f]<=i?l=f+1:c=f}return{tokens:r[l],sessions:l}}}}const ni=15e3,tr=5e3,Xc=1e3,si=30,To=ni/1e3*si,Qv=(ni+tr+Xc)/1e3*si,ey=e=>Math.min(1,e/(To-1)),ty=e=>e<To?null:Math.min(1,(e-To+1)/(tr/1e3*si));function ny(e){const t=Math.max(0,Math.min(1,e)),n=.08,s=.35,r=1-(n+s)/2,o=i=>i**3-i**4/2;return t<n?n*o(t/n)/r:t>1-s?1-s*o((1-t)/s)/r:(t-n/2)/r}const Fg=new Intl.DateTimeFormat("en",{month:"short",year:"numeric"}),Hg=new Intl.DateTimeFormat("en",{month:"short",day:"numeric",year:"numeric"}),_g=(e,t)=>(t>=90*864e5?Fg:Hg).format(e);function Bg(e,t,n,s=70){const r=new Array(s).fill(0),o=Math.max(1,n-t);for(const i of e)r[Math.max(0,Math.min(s-1,Math.floor((i-t)/o*s)))]++;return r}function Qc(e){const t=e.map(n=>n.created).sort((n,s)=>n-s);return(n,s=!1)=>{if(s)return t.length;let r=0,o=t.length;for(;r<o;){const i=r+o>>>1;t[i]<=n?r=i+1:o=i}return r}}function jg(e,t){return!t||e.source===t||!!(e.source==="t3-code"&&e.linkedSessionIDs?.some(n=>n.startsWith(`${t}:`)))}const br=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}),ri="sessiongraph.preferences",Sa={motion:["system","on","off"],view:["3d","2d"],density:["comfortable","compact"],quality:["performance","balanced","high"],trails:["all","selected","off"]},$a={clickVolume:[0,100],panelOpacity:[55,100],bloom:[0,75],nodeScale:[60,180],trailOpacity:[0,100],trailSpeed:[10,100],playbackSpeed:[.25,3]};function wr(e){const t={...br};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 Sa)Sa[s].includes(r)&&Object.assign(t,{[s]:r});else if(s in $a){const[o,i]=$a[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 el(e){try{const t=JSON.parse(e.getItem(ri)||e.getItem("session-atlas.preferences")||"null");return wr(t?.version===1?t.values:void 0)}catch{return{...br}}}function tl(e,t){try{return e.setItem(ri,JSON.stringify({version:1,values:wr(t)})),!0}catch{return!1}}const Co=(e,t)=>e.motion==="on"||e.motion==="system"&&!t,ze=[["interface","Interface",Td],["sources","Sources",gd],["audio","Sound",Ja],["graphics","Graphics",Za],["trails","Trails & playback",$d],["privacy","Privacy",xd]],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>`,Ft=(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>`,Dn=(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 Wg(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>
29
+ <p class="launch-status" role="status"></p>`,document.body.append(t);const n=new AbortController,s={signal:n.signal},r=b=>t.querySelector(b),o=r("select"),i=r(".launch-directory"),a=r(".launch-web-link"),l=r(".launch-command"),c=r(".launch-terminal"),f=r(".launch-copy"),u=r(".launch-status");let h,p=0,g=0,d,m,y,$,w,M=null;function O(){g++,m?.abort(),clearTimeout(w),y=void 0,l.value="",c.disabled=f.disabled=!0,r(".launch-summary").hidden=!0,r(".launch-availability").textContent=""}function R(){t.close(),p++,d?.abort(),O(),e(),M?.focus({preventScroll:!0})}async function E(b){try{await navigator.clipboard.writeText(b),u.textContent="Command copied."}catch{u.textContent=`Copy this command: ${b}`,b===l.value&&(l.focus(),l.select())}}function C(){if(a.hidden=!0,a.removeAttribute("href"),h&&$?.webBaseUrl)try{a.href=Yd($.webBaseUrl,h.nativeID||h.id),a.hidden=!1}catch{}u.textContent=$?a.hidden?"OpenCode is unavailable. Choose another app to use the saved conversation.":"":"Finding OpenCode…"}function x(b){const A=Hn.find(D=>D.id===o.value)?.name||Ue(o.value);l.value=b.command,f.disabled=!1,c.disabled=!b.terminalAvailable,c.textContent=`${b.mode==="resume"?"Resume in":"Open in"} ${A} ↗`,r(".launch-summary").hidden=!1,r(".launch-mode").textContent=b.mode==="resume"?"Resume original session":"New session · saved context",r(".launch-hint").textContent=b.mode==="resume"?`Continue this conversation in ${A}.`:`Start in ${A} with the saved conversation.`,r(".launch-context").hidden=!b.context,r(".launch-coverage").textContent=b.context?`${b.context.messages.toLocaleString()} / ${b.context.totalMessages.toLocaleString()} messages${b.context.partial?" · Partial history":""}`:"",r(".launch-context-path").textContent=b.context?.path||"",r(".launch-availability").textContent=b.targetAvailable?b.terminalAvailable?"":"Automatic terminal opening is unavailable. Run the copied command in your terminal.":`${A} CLI was not found. Install it, then run the copied command.`,u.textContent=""}async function T(){if(O(),!h||!t.open)return;const b=o.value==="web";if(r(".launch-web").hidden=!b,r(".launch-cli").hidden=b,b){C();return}if(!Ar(o.value))return;const A=g;m=new AbortController,u.textContent="Preparing command…";try{const D=await fetch(`/api/sessiongraph/session/${encodeURIComponent(h.id)}/prepare-launch`,{method:"POST",signal:m.signal,headers:{"Content-Type":"application/json","X-SessionGraph-Action":"prepare-launch"},body:JSON.stringify({target:o.value,directory:i.value})}),V=await D.json();if(!D.ok)throw new Error(V.error||"Could not prepare this session.");if(g!==A)return;y=V,x(y)}catch(D){g===A&&(l.placeholder="Command unavailable",u.textContent=D instanceof Error?D.message:"Could not prepare this session.")}}return o.addEventListener("change",()=>{try{localStorage.setItem("sessiongraph.open-target",o.value)}catch{}T()},s),i.addEventListener("input",()=>{O(),u.textContent="Checking working directory…",w=setTimeout(()=>{T()},300)},s),i.addEventListener("change",()=>{T()},s),r(".dialog-close").addEventListener("click",R,s),t.addEventListener("cancel",b=>{b.preventDefault(),R()},s),t.addEventListener("keydown",b=>{b.stopPropagation()},s),f.addEventListener("click",()=>{y&&E(y.command)},s),r(".launch-copy-pair").addEventListener("click",()=>{E("opencode pair")},s),c.addEventListener("click",async()=>{if(!h||!y||c.disabled)return;const b=p;c.disabled=o.disabled=i.disabled=!0,u.textContent="Opening Terminal…";try{const A=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:y.directory})}),D=await A.json();if(!A.ok)throw new Error(D.error||"Could not open Terminal.");p===b&&(u.textContent="Session sent to Terminal.")}catch(A){p===b&&(u.textContent=A instanceof Error?A.message:"Could not open Terminal. Copy the command instead.")}finally{p===b&&(o.disabled=i.disabled=!1,c.disabled=!y?.terminalAvailable)}},s),{async open(b){h=b;const A=++p;d?.abort(),d=new AbortController,$=void 0,O(),t.open||(M=document.activeElement),r(".launch-title").textContent=`${Ue(b.source)} · ${b.title}`,i.value=b.directory,i.disabled=o.disabled=!1,o.value=Ar(b.source)?b.source:"opencode";const D=(!b.source||b.source==="opencode")&&tc(b.nativeID||b.id);o.querySelector('[value="web"]').disabled=!D;for(const V of Hn)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");(Ar(V)||V==="web"&&D)&&(o.value=V)}catch{}l.placeholder="Preparing command…",r(".launch-context").open=!1,t.open||t.showModal(),e(),Ig(o),T();try{const V=await fetch(`/api/sessiongraph/session/${encodeURIComponent(b.id)}/connection`,{signal:d.signal});if(!V.ok)throw new Error("Connection unavailable");const H=await V.json();if(p!==A)return;$=H;for(const z of Hn){const re=H.targets.some(Z=>Z.id===z.id&&Z.available);o.querySelector(`[value="${z.id}"]`).textContent=`${z.name}${re?"":" · CLI not found"}`}o.value==="web"&&C()}catch{p===A&&o.value==="web"&&(u.textContent="OpenCode is unavailable. Choose another app to use the saved conversation.")}},dispose(){p++,d?.abort(),O(),n.abort(),t.remove()}}}const kg=e=>e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]);function Ag(e,t,n){const s=document.createElement("dialog");s.className="imports-dialog",s.setAttribute("aria-labelledby","imports-heading"),s.innerHTML='<button class="icon-button dialog-close" aria-label="Close sources">×</button><span class="eyebrow">SessionGraph</span><h2 id="imports-heading">Explore &amp; 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 &amp; 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(s);const r=x=>s.querySelector(x);let o=!1,i=0,a=!1,l=null,c=!1,f=!1,u=!1;const h=new AbortController;let p=!1,g=0,d=!1,m=!1,y=!1;function $(){const x=s.querySelectorAll("input:checked").length;r(".import-start").disabled=o||c||d,r(".import-start").textContent=o||c?"Importing…":d?"Finding sources…":m?p?x?"Import & continue →":"Continue without importing →":"Import updates ↗":"Try again",s.querySelectorAll("input").forEach(T=>{T.disabled=o||c})}async function w(x,T){const b=await fetch(`/api/sessiongraph/${x}`,{...T,signal:AbortSignal.any([h.signal,AbortSignal.timeout(3e4)])}),A=await b.json();if(b.status===409&&x==="import"&&T?.method==="POST")return w("import");if(!b.ok)throw new Error(A.error||"Import unavailable.");return A}function M(x){o=x.running,$(),r(".imports-progress").textContent=o?`${x.source?Ue(x.source):"Importing"} · ${x.imported.toLocaleString()} imported · ${x.unchanged.toLocaleString()} unchanged${x.discovered?` / ${x.discovered.toLocaleString()} found`:" · discovering…"}`:`${x.imported.toLocaleString()} imported · ${x.unchanged.toLocaleString()} already up to date${x.failed?` · ${x.failed} unavailable`:""}`,r(".imports-notes").hidden=!x.errors.length;const T=new Map;x.errors.forEach(b=>T.set(b,(T.get(b)||0)+1)),r(".imports-notes div").innerHTML=[...T].map(([b,A])=>`<p>${kg(b)}${A>1?` (${A} occurrences)`:""}</p>`).join(""),document.dispatchEvent(new CustomEvent("sessiongraph-import-status",{detail:x}))}async function O(){if(!(a||f)){i=0,f=!0;try{const x=await w("import");if(a)return;if(M(x),x.running)i=window.setTimeout(O,1e3);else{const T=y;y=!1,await e(u),!a&&T&&n(x.failed?"Import finished with some unavailable history. Open Manage sources for details or to retry.":x.imported+x.unchanged?"Your sessions are ready to explore.":"No conversations found. You can choose other sources in Manage sources.")}}catch(x){R(x)}finally{f=!1}}}function R(x){if(a)return;y=!1;const T=x instanceof Error?x.message:"Import unavailable.";M({running:!1,discovered:0,imported:0,unchanged:0,failed:1,errors:[T]}),r(".imports-progress").textContent=T,s.open||n(`${T} Open Manage sources to retry.`)}async function E(x,T=!1){if(a||T&&s.open)return;if(o||c||f||i){!T&&!s.open&&C();return}c=!0,u=T,o=!0,$();const b=p&&s.open&&x!==void 0,A=g;try{const D=await w("import",{method:"POST",headers:{"Content-Type":"application/json","X-SessionGraph-Action":"import"},body:JSON.stringify(T?{automatic:!0}:{sources:x})});if(a||(M(D),b&&(y=!!x?.length,g===A&&s.open&&s.close(),x?.length&&n("Import started. You can explore the map as soon as your sessions are ready."),await e(!0)),a))return;window.clearTimeout(i),i=window.setTimeout(O,100)}catch(D){R(D)}finally{c=!1,a||$()}}async function C(x=!1){p=x;const T=++g;d=!0,m=!1,l=document.activeElement,r("#imports-heading").textContent=x?"Explore & visualize all your LLM sessions":"Your session sources.",r("footer > span").textContent=x?"You can change sources later.":"Saved locally in SQLite",x&&(r(".imports-progress").textContent="Detected conversation sources are selected for you.",r(".imports-notes").hidden=!0),$(),s.open||s.showModal(),t(),r(".import-sources").textContent="Finding local session sources…";try{const b=await w("sources");if(a||T!==g)return;r(".import-sources").innerHTML=Qa(b.sources).map(D=>ec(D,{checked:D.selected||x&&D.available&&D.capabilities.history,disabled:o})).join(""),m=!0,x&&!s.querySelector("input:checked")&&(r(".imports-progress").textContent="No conversation sources selected. You can choose sources now or add them later.");const A=await w("import");if(a||T!==g)return;A.running?(M(A),window.clearTimeout(i),i=window.setTimeout(O,1e3)):x||M(A)}catch(b){!a&&T===g&&(m=!1,r(".import-sources").textContent=b instanceof Error?b.message:"Could not detect sources.")}finally{!a&&T===g&&(d=!1,$())}}return r(".import-sources").addEventListener("change",$),r(".import-start").addEventListener("click",()=>{m?E([...s.querySelectorAll("input:checked")].map(x=>x.value)):C(p)}),r(".dialog-close").addEventListener("click",()=>s.close()),s.addEventListener("close",()=>{g++,d=!1,t(),l?.focus()}),s.addEventListener("keydown",x=>x.stopPropagation()),{open:C,sources:async()=>(await w("sources")).sources,select:x=>E(x),get busy(){return o||c||f||!!i},refresh:(x=!1)=>E(void 0,x),resume:()=>{u=!0,o=!0,window.clearTimeout(i),O()},dispose:()=>{a=!0,h.abort(),window.clearTimeout(i),s.remove()}}}const Lg=6e4,Og=3e4;class Mg{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<Og)){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 Rg=Object.freeze({sourceID:"",projectID:"",directory:"",days:0,fromDate:"",toDate:"",includeChildren:!0,includeArchived:!1}),Pg=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 Vg(e){const t={...Rg};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"])Pg(n[s])&&(t[s]=n[s]);return t.fromDate&&t.toDate&&t.fromDate>t.toDate&&(t.fromDate="",t.toDate=""),t}const Ng=e=>typeof e=="number"&&Number.isSafeInteger(e)&&e>=0;function Jc(e){const t=e.filter(i=>["opencode","continue"].includes(i.source||"opencode")&&Ng(i.tokens)),n=t.filter(i=>Number.isFinite(i.activity?.lastMessageAt)&&i.activity.lastMessageAt>0).sort((i,a)=>Math.max(i.created,i.activity.lastMessageAt)-Math.max(a.created,a.activity.lastMessageAt)),s=[],r=[0];for(const i of n)s.push(Math.max(i.created,i.activity.lastMessageAt)),r.push(r.at(-1)+i.tokens);const o=t.reduce((i,a)=>i+a.tokens,0);return{recorded:t.length,missing:e.length-t.length,untimed:t.length-n.length,at(i,a=!1){if(a)return{tokens:o,sessions:t.length};let l=0,c=s.length;for(;l<c;){const f=l+c>>>1;s[f]<=i?l=f+1:c=f}return{tokens:r[l],sessions:l}}}}const ni=15e3,tr=5e3,Xc=1e3,si=30,Co=ni/1e3*si,Qv=(ni+tr+Xc)/1e3*si,ey=e=>Math.min(1,e/(Co-1)),ty=e=>e<Co?null:Math.min(1,(e-Co+1)/(tr/1e3*si));function ny(e){const t=Math.max(0,Math.min(1,e)),n=.08,s=.35,r=1-(n+s)/2,o=i=>i**3-i**4/2;return t<n?n*o(t/n)/r:t>1-s?1-s*o((1-t)/s)/r:(t-n/2)/r}const Fg=new Intl.DateTimeFormat("en",{month:"short",year:"numeric"}),Hg=new Intl.DateTimeFormat("en",{month:"short",day:"numeric",year:"numeric"}),_g=(e,t)=>(t>=90*864e5?Fg:Hg).format(e);function Bg(e,t,n,s=70){const r=new Array(s).fill(0),o=Math.max(1,n-t);for(const i of e)r[Math.max(0,Math.min(s-1,Math.floor((i-t)/o*s)))]++;return r}function Qc(e){const t=e.map(n=>n.created).sort((n,s)=>n-s);return(n,s=!1)=>{if(s)return t.length;let r=0,o=t.length;for(;r<o;){const i=r+o>>>1;t[i]<=n?r=i+1:o=i}return r}}function jg(e,t){return!t||e.source===t||!!(e.source==="t3-code"&&e.linkedSessionIDs?.some(n=>n.startsWith(`${t}:`)))}const br=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}),ri="sessiongraph.preferences",Sa={motion:["system","on","off"],view:["3d","2d"],density:["comfortable","compact"],quality:["performance","balanced","high"],trails:["all","selected","off"]},$a={clickVolume:[0,100],panelOpacity:[55,100],bloom:[0,75],nodeScale:[60,180],trailOpacity:[0,100],trailSpeed:[10,100],playbackSpeed:[.25,3]};function wr(e){const t={...br};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 Sa)Sa[s].includes(r)&&Object.assign(t,{[s]:r});else if(s in $a){const[o,i]=$a[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 el(e){try{const t=JSON.parse(e.getItem(ri)||e.getItem("session-atlas.preferences")||"null");return wr(t?.version===1?t.values:void 0)}catch{return{...br}}}function tl(e,t){try{return e.setItem(ri,JSON.stringify({version:1,values:wr(t)})),!0}catch{return!1}}const To=(e,t)=>e.motion==="on"||e.motion==="system"&&!t,ze=[["interface","Interface",Cd],["sources","Sources",gd],["audio","Sound",Ja],["graphics","Graphics",Za],["trails","Trails & playback",$d],["privacy","Privacy",xd]],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>`,Ft=(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>`,Dn=(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 Wg(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
30
  <div class="settings-layout"><nav class="settings-tabs" role="tablist" aria-label="Settings categories">${ze.map(([g,d,m],y)=>`<button role="tab" id="settings-tab-${g}" aria-controls="settings-${g}" aria-selected="${!y}" tabindex="${y?-1:0}" data-tab="${g}">${za([m[0],{...m[1],"aria-hidden":"true","stroke-width":1.5},m[2]]).outerHTML}${d}</button>`).join("")}</nav>
31
31
  <div class="settings-content">
32
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>
@@ -74,27 +74,27 @@ lucide.createIcons({icons});\``);if(typeof document>"u")throw new Error("`create
74
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
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
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(".settings-archived");r.addEventListener("change",()=>e.changeArchived(r.checked),s);let o=null,i=0,a=!1,l=!1,c="interface";const f=()=>{t.querySelectorAll(".settings-source, .settings-import").forEach(g=>{g.disabled=a||l}),t.querySelector(".settings-source")||(t.querySelector(".settings-import").disabled=!0)};async function u(){const g=++i;a=!0,f();const d=t.querySelector(".settings-sources-list");d.textContent="Finding local session sources…";try{const m=await e.getSources();if(n.signal.aborted||g!==i)return;d.innerHTML=Qa(m).map(y=>ec(y,{settings:!0})).join("")}catch(m){if(n.signal.aborted||g!==i)return;d.textContent=m instanceof Error?m.message:"Could not detect sources.";const y=document.createElement("button");y.className="secondary-button",y.textContent="Retry",y.addEventListener("click",()=>{u()},s),d.append(y)}finally{g===i&&!n.signal.aborted&&(a=!1,f(),t.querySelector(".settings-import").disabled||=!d.querySelector("input"))}}t.querySelector(".settings-import").addEventListener("click",async()=>{const g=[...t.querySelectorAll(".settings-source:checked")].map(d=>d.value);l=!0,f(),t.querySelector(".settings-import-progress").textContent="Starting import…";try{await e.importSources(g)}catch(d){l=!1,f(),t.querySelector(".settings-import-progress").textContent=d instanceof Error?d.message:"Import unavailable."}},s);const h=()=>t.close();for(const g of[".settings-close",".settings-done"])t.querySelector(g).addEventListener("click",h,s);t.addEventListener("close",()=>{e.visibility(),o?.focus({preventScroll:!0})},s),t.addEventListener("keydown",g=>{g.stopPropagation()},s);function p(g){c=g;for(const[d]of ze){const m=t.querySelector(`[data-tab="${d}"]`);m.setAttribute("aria-selected",String(d===g)),m.tabIndex=d===g?0:-1,t.querySelector(`#settings-${d}`).hidden=d!==g}t.querySelector(".settings-content").scrollTop=0,c==="sources"&&u()}for(const g of t.querySelectorAll("[data-tab]"))g.addEventListener("click",()=>p(g.dataset.tab),s),g.addEventListener("keydown",d=>{const m=ze.findIndex(([$])=>$===g.dataset.tab),y=d.key==="Home"?0:d.key==="End"?ze.length-1:["ArrowRight","ArrowDown"].includes(d.key)?(m+1)%ze.length:["ArrowLeft","ArrowUp"].includes(d.key)?(m+ze.length-1)%ze.length:-1;y<0||(d.preventDefault(),p(ze[y][0]),t.querySelector(`[data-tab="${ze[y][0]}"]`).focus())},s);return t.addEventListener("input",g=>{const d=g.target,m=d.dataset.pref;if(!m)return;const y=d.type==="checkbox"?d.checked:d.type==="range"?Number(d.value):d.value;e.change({[m]:y})},s),t.querySelector(".settings-preview").addEventListener("click",e.previewSound,s),t.querySelector(".settings-reset").addEventListener("click",()=>{e.changeArchived(!1),e.change({...br})},s),t.querySelector(".settings-reset-panels").addEventListener("click",e.resetPanels,s),{open(){t.open||(r.checked=e.getArchived(),o=document.activeElement,t.showModal(),e.visibility(),t.querySelector('[aria-selected="true"]').focus(),c==="sources"&&u())},importStatus(g){const d=l;l=g.running,f(),t.querySelector(".settings-import-progress").textContent=g.running?`Importing · ${g.imported.toLocaleString()} saved`:`${g.imported.toLocaleString()} imported · ${g.unchanged.toLocaleString()} unchanged${g.failed?` · ${g.failed} unavailable`:""}${g.errors.length?` · ${g.errors[0]}`:""}`,d&&!g.running&&t.open&&c==="sources"&&u()},render(g,d,m="saved"){r.checked=e.getArchived();for(const y of t.querySelectorAll("[data-pref]")){const $=y.dataset.pref;y.type==="checkbox"?y.checked=!!g[$]:y.value=String(g[$]);const w=t.querySelector(`[data-output="${$}"]`);w&&(w.value=`${g[$]}${w.dataset.unit}`),y.disabled=$==="bloom"&&g.quality==="performance"||$==="trailSpeed"&&(!g.trailFlow||g.trails==="off"||g.motion==="off")}t.querySelector(".settings-save-status").textContent=m==="saving"?"Saving preferences…":m==="error"?"Changes applied; could not save to the local library.":d?"Saved on this device · changes apply live.":"Applied for this visit; storage is unavailable.",t.querySelector(".settings-preview").disabled=g.muted||!g.clickSounds||!g.clickVolume,Qn(t)},audioStatus(g){t.querySelector(".settings-audio-status").textContent=g},dispose(){n.abort(),t.remove()}}}class Ug{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 sy=e=>e.kind==="message"&&(e.role==="user"||e.role==="assistant"),nl=e=>e.kind==="message"?e.role==="user"?"#b0e9d6":"#9bbcff":e.kind.startsWith("tool_")?"#eac594":"#d7a1f1",sl=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],bt=e=>e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]),qg=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"medium"}),Ia=e=>e===null?"Time not recorded":qg.format(e),Ta=e=>`<span class="event-badge" style="--event-color:${nl(e)}">${sl(e)}</span>`;function Gg(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</h2><button class="icon-button event-close" aria-label="Close message details">×</button></header>
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(".settings-archived");r.addEventListener("change",()=>e.changeArchived(r.checked),s);let o=null,i=0,a=!1,l=!1,c="interface";const f=()=>{t.querySelectorAll(".settings-source, .settings-import").forEach(g=>{g.disabled=a||l}),t.querySelector(".settings-source")||(t.querySelector(".settings-import").disabled=!0)};async function u(){const g=++i;a=!0,f();const d=t.querySelector(".settings-sources-list");d.textContent="Finding local session sources…";try{const m=await e.getSources();if(n.signal.aborted||g!==i)return;d.innerHTML=Qa(m).map(y=>ec(y,{settings:!0})).join("")}catch(m){if(n.signal.aborted||g!==i)return;d.textContent=m instanceof Error?m.message:"Could not detect sources.";const y=document.createElement("button");y.className="secondary-button",y.textContent="Retry",y.addEventListener("click",()=>{u()},s),d.append(y)}finally{g===i&&!n.signal.aborted&&(a=!1,f(),t.querySelector(".settings-import").disabled||=!d.querySelector("input"))}}t.querySelector(".settings-import").addEventListener("click",async()=>{const g=[...t.querySelectorAll(".settings-source:checked")].map(d=>d.value);l=!0,f(),t.querySelector(".settings-import-progress").textContent="Starting import…";try{await e.importSources(g)}catch(d){l=!1,f(),t.querySelector(".settings-import-progress").textContent=d instanceof Error?d.message:"Import unavailable."}},s);const h=()=>t.close();for(const g of[".settings-close",".settings-done"])t.querySelector(g).addEventListener("click",h,s);t.addEventListener("close",()=>{e.visibility(),o?.focus({preventScroll:!0})},s),t.addEventListener("keydown",g=>{g.stopPropagation()},s);function p(g){c=g;for(const[d]of ze){const m=t.querySelector(`[data-tab="${d}"]`);m.setAttribute("aria-selected",String(d===g)),m.tabIndex=d===g?0:-1,t.querySelector(`#settings-${d}`).hidden=d!==g}t.querySelector(".settings-content").scrollTop=0,c==="sources"&&u()}for(const g of t.querySelectorAll("[data-tab]"))g.addEventListener("click",()=>p(g.dataset.tab),s),g.addEventListener("keydown",d=>{const m=ze.findIndex(([$])=>$===g.dataset.tab),y=d.key==="Home"?0:d.key==="End"?ze.length-1:["ArrowRight","ArrowDown"].includes(d.key)?(m+1)%ze.length:["ArrowLeft","ArrowUp"].includes(d.key)?(m+ze.length-1)%ze.length:-1;y<0||(d.preventDefault(),p(ze[y][0]),t.querySelector(`[data-tab="${ze[y][0]}"]`).focus())},s);return t.addEventListener("input",g=>{const d=g.target,m=d.dataset.pref;if(!m)return;const y=d.type==="checkbox"?d.checked:d.type==="range"?Number(d.value):d.value;e.change({[m]:y})},s),t.querySelector(".settings-preview").addEventListener("click",e.previewSound,s),t.querySelector(".settings-reset").addEventListener("click",()=>{e.changeArchived(!1),e.change({...br})},s),t.querySelector(".settings-reset-panels").addEventListener("click",e.resetPanels,s),{open(){t.open||(r.checked=e.getArchived(),o=document.activeElement,t.showModal(),e.visibility(),t.querySelector('[aria-selected="true"]').focus(),c==="sources"&&u())},importStatus(g){const d=l;l=g.running,f(),t.querySelector(".settings-import-progress").textContent=g.running?`Importing · ${g.imported.toLocaleString()} saved`:`${g.imported.toLocaleString()} imported · ${g.unchanged.toLocaleString()} unchanged${g.failed?` · ${g.failed} unavailable`:""}${g.errors.length?` · ${g.errors[0]}`:""}`,d&&!g.running&&t.open&&c==="sources"&&u()},render(g,d,m="saved"){r.checked=e.getArchived();for(const y of t.querySelectorAll("[data-pref]")){const $=y.dataset.pref;y.type==="checkbox"?y.checked=!!g[$]:y.value=String(g[$]);const w=t.querySelector(`[data-output="${$}"]`);w&&(w.value=`${g[$]}${w.dataset.unit}`),y.disabled=$==="bloom"&&g.quality==="performance"||$==="trailSpeed"&&(!g.trailFlow||g.trails==="off"||g.motion==="off")}t.querySelector(".settings-save-status").textContent=m==="saving"?"Saving preferences…":m==="error"?"Changes applied; could not save to the local library.":d?"Saved on this device · changes apply live.":"Applied for this visit; storage is unavailable.",t.querySelector(".settings-preview").disabled=g.muted||!g.clickSounds||!g.clickVolume,Qn(t)},audioStatus(g){t.querySelector(".settings-audio-status").textContent=g},dispose(){n.abort(),t.remove()}}}class Ug{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 sy=e=>e.kind==="message"&&(e.role==="user"||e.role==="assistant"),nl=e=>e.kind==="message"?e.role==="user"?"#b0e9d6":"#9bbcff":e.kind.startsWith("tool_")?"#eac594":"#d7a1f1",sl=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],bt=e=>e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]),qg=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"medium"}),Ia=e=>e===null?"Time not recorded":qg.format(e),Ca=e=>`<span class="event-badge" style="--event-color:${nl(e)}">${sl(e)}</span>`;function Gg(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</h2><button class="icon-button event-close" aria-label="Close message details">×</button></header>
78
78
  <div class="event-detail-nav"><button class="secondary-button" data-step="previous" aria-label="Previous message" title="Previous message (← / ↑)">← Previous</button><span class="event-position" role="status"></span><button class="secondary-button" data-step="next" aria-label="Next message" title="Next message (→ / ↓)">Next →</button></div>
79
79
  <div class="event-scroll"><article class="event-content" aria-label="Message details" tabindex="0"></article>
80
80
  <details class="event-browser"><summary>Browse messages <span class="event-count"></span></summary>
81
81
  <nav class="event-list" aria-label="Session messages"></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>
82
82
  </details>
83
- </div><footer class="event-footer"><span class="event-coverage"></span><button class="text-button event-reload">Reload</button></footer>`,e.append(s);const r=E=>s.querySelector(E),o=new AbortController;let i,a,l,c;const f="messages";let u=!1,h,p,g={};const d=(E,T)=>`<button class="event-row" data-event="${bt(E.id)}" aria-current="${l?.selected?.id===E.id?"true":"false"}"><span class="event-row-top">${Ta(E)}<small>#${l.offset+T+1}</small></span><span class="event-preview">${bt(E.preview||"No text recorded")}</span><time>${Ia(E.time)}</time></button>`;function m(){!l||!r(".event-browser").open||(r(".event-list").innerHTML=l.items.map(d).join("")||'<p class="event-empty">No saved messages.</p>')}function y(){if(!l)return;r(".event-count").textContent=`${l.total.toLocaleString()} messages${l.partial?" · partial coverage":""}`,m();for(const T of["previous","next"])r(`[data-page="${T}"]`).disabled=!l[`${T}Cursor`];r(".event-coverage").textContent=l.partial?"Partial history":"Saved locally";const E=l.selected;r(".event-position").textContent=E?`${l.offset+l.items.findIndex(T=>T.id===E.id)+1} / ${l.total}`:"No messages";for(const T of["previous","next"])r(`[data-step="${T}"]`).disabled=!l[`${T}Item`];if(!E){r(".event-content").innerHTML='<div class="event-empty"><h3>No messages yet.</h3><p>Refresh the source to import saved user and assistant messages.</p></div>',n.select(null);return}n.select(E),r(".event-content").innerHTML=`<div class="event-detail-heading">${Ta(E)}<h3>${bt(E.name)}</h3><p>${Ia(E.time)}</p></div>
83
+ </div><footer class="event-footer"><span class="event-coverage"></span><button class="text-button event-reload">Reload</button></footer>`,e.append(s);const r=E=>s.querySelector(E),o=new AbortController;let i,a,l,c;const f="messages";let u=!1,h,p,g={};const d=(E,C)=>`<button class="event-row" data-event="${bt(E.id)}" aria-current="${l?.selected?.id===E.id?"true":"false"}"><span class="event-row-top">${Ca(E)}<small>#${l.offset+C+1}</small></span><span class="event-preview">${bt(E.preview||"No text recorded")}</span><time>${Ia(E.time)}</time></button>`;function m(){!l||!r(".event-browser").open||(r(".event-list").innerHTML=l.items.map(d).join("")||'<p class="event-empty">No saved messages.</p>')}function y(){if(!l)return;r(".event-count").textContent=`${l.total.toLocaleString()} messages${l.partial?" · partial coverage":""}`,m();for(const C of["previous","next"])r(`[data-page="${C}"]`).disabled=!l[`${C}Cursor`];r(".event-coverage").textContent=l.partial?"Partial history":"Saved locally";const E=l.selected;r(".event-position").textContent=E?`${l.offset+l.items.findIndex(C=>C.id===E.id)+1} / ${l.total}`:"No messages";for(const C of["previous","next"])r(`[data-step="${C}"]`).disabled=!l[`${C}Item`];if(!E){r(".event-content").innerHTML='<div class="event-empty"><h3>No messages yet.</h3><p>Refresh the source to import saved user and assistant messages.</p></div>',n.select(null);return}n.select(E),r(".event-content").innerHTML=`<div class="event-detail-heading">${Ca(E)}<h3>${bt(E.name)}</h3><p>${Ia(E.time)}</p></div>
84
84
  ${E.partial?'<p class="event-warning">Partial message</p>':""}
85
85
  ${E.text?`<section class="event-payload"><pre>${bt(E.text)}</pre></section>`:'<p class="event-empty">No message text was recorded.</p>'}
86
- <details class="event-provenance"><summary>Source details</summary><dl><dt>Source</dt><dd>${bt(Ue(a?.source))}</dd><dt>Message ID</dt><dd>${bt(E.messageID)}</dd><dt>Timestamp source</dt><dd>${bt(E.timeSource)}</dd></dl></details>`}async function $(E={}){if(!a)return;clearTimeout(p),i?.abort();const T=new AbortController;i=T,g=E,u=!0,s.setAttribute("aria-busy","true"),r(".event-position").textContent="Loading…";for(const D of s.querySelectorAll("[data-step], [data-page]"))D.disabled=!0;const x=r(".event-list").scrollTop,C=l?.offset,b=document.activeElement,A=b instanceof HTMLElement?b.dataset:void 0;try{const D=await t.read(a.id,{filter:f,...E,...c?{revision:c}:{}},T.signal);if(T.signal.aborted)return;l=D,c=l.revision,y(),r(".event-list").scrollTop=l.offset===C?x:0,r(".event-scroll").scrollTop=0;const V=A?.event?`[data-event="${A.event}"]`:"";V&&(document.activeElement===b||!b?.isConnected&&document.activeElement===document.body)&&s.querySelector(V)?.focus({preventScroll:!0}),clearTimeout(p),p=setTimeout(()=>{h?.abort(),h=new AbortController;for(const H of[l?.previousItem,l?.nextItem])H&&t.read(a.id,{item:H,filter:f,revision:c},h.signal).catch(()=>{})},60)}catch(D){if(T.signal.aborted)return;l=void 0,r(".event-position").textContent="Unavailable",r(".event-content").innerHTML=`<div class="event-empty"><h3>Could not load this history.</h3><p>${bt(D instanceof Error?D.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===T&&(u=!1,s.removeAttribute("aria-busy"))}}const w=()=>{t.clear(),c=void 0,l=void 0,$()},M=()=>!s.hidden&&!e.hidden,O=()=>{clearTimeout(p),h?.abort(),i?.abort(),i=void 0,u=!1,l=void 0,s.hidden=!0,s.removeAttribute("aria-busy"),e.classList.remove("has-events"),n.select(null)},R=E=>{if(u)return;const T=E==="next"?l?.nextItem:l?.previousItem;T&&$({item:T})};return s.addEventListener("click",E=>{const T=E.target.closest("button");if(T){if(T.dataset.event&&$({item:T.dataset.event}),T.dataset.step&&R(T.dataset.step==="next"?"next":"previous"),T.dataset.page){const x=T.dataset.page==="next"?l?.nextCursor:l?.previousCursor;x&&$({cursor:x})}T.hasAttribute("data-retry")&&$(g),(T.hasAttribute("data-reload")||T.classList.contains("event-reload"))&&w(),T.classList.contains("event-close")&&(O(),document.querySelector("#scene canvas")?.focus({preventScroll:!0}))}},{signal:o.signal}),r(".event-browser").addEventListener("toggle",m,{signal:o.signal}),{close:O,handleKey(E){return!M()||E.defaultPrevented||E.metaKey||E.ctrlKey||E.altKey||E.shiftKey||document.querySelector("dialog[open]")||E.target.closest('input, select, textarea, [contenteditable="true"], [data-drag-panel], #explorer')?!1:E.key==="Escape"?(E.preventDefault(),O(),document.querySelector("#scene canvas")?.focus({preventScroll:!0}),!0):["ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].includes(E.key)?(E.preventDefault(),R(E.key==="ArrowLeft"||E.key==="ArrowUp"?"previous":"next"),!0):!1},open(E,T,x){clearTimeout(p),h?.abort();const C=a?.id===E.id;a=E,c=x,l=void 0,r(".event-list").replaceChildren(),r(".event-content").innerHTML='<p class="event-empty">Loading saved history…</p>',r(".event-coverage").textContent="Loading coverage…",C||(r(".event-browser").open=!1),s.hidden=!1,e.classList.add("has-events"),$(T?{item:T}:{})},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,l=0,c=0,f=1;const u=document.createElement("strong"),h=document.createElement("pre"),p=document.createElement("span"),g=()=>{clearTimeout(i),o?.abort(),o=void 0,r=void 0,a=void 0,e.hidden=!0,e.classList.remove("message-tooltip")};function d(y,$){if(!a)return;const w=`${sl(a)} · ${a.name}`,M=y||"No text recorded.",O=[$,f>1?`${f} nearby items`:"","Click to focus and read · ← / → to navigate"].filter(Boolean).join(" · ");u.textContent!==w&&(u.textContent=w),h.textContent!==M&&(h.textContent=M),p.textContent!==O&&(p.textContent=O),u.parentElement!==e&&e.replaceChildren(u,h,p),e.classList.add("message-tooltip"),e.hidden=!1,e.style.setProperty("--event-color",nl(a));const R=e.offsetWidth,E=e.offsetHeight,T=t.getBoundingClientRect(),x=[...document.querySelectorAll(".floating-panel:not([hidden]), .app-header, .map-controls")].map(A=>A.getBoundingClientRect()),b=[c+18,c-E-18].flatMap(A=>[l+18,l-R-18].map(D=>{D=Math.max(8,Math.min(D,t.clientWidth-R-8)),A=Math.max(8,Math.min(A,t.clientHeight-E-8));const V=T.left+D,H=T.top+A,z=x.reduce((re,Z)=>re+Math.max(0,Math.min(V+R,Z.right+8)-Math.max(V,Z.left-8))*Math.max(0,Math.min(H+E,Z.bottom+8)-Math.max(H,Z.top-8)),0);return{left:D,top:A,overlap:z}})).reduce((A,D)=>D.overlap<A.overlap?D:A);e.style.left=`${b.left}px`,e.style.top=`${b.top}px`}function m(y){const $=[y.text,y.input?`Input
86
+ <details class="event-provenance"><summary>Source details</summary><dl><dt>Source</dt><dd>${bt(Ue(a?.source))}</dd><dt>Message ID</dt><dd>${bt(E.messageID)}</dd><dt>Timestamp source</dt><dd>${bt(E.timeSource)}</dd></dl></details>`}async function $(E={}){if(!a)return;clearTimeout(p),i?.abort();const C=new AbortController;i=C,g=E,u=!0,s.setAttribute("aria-busy","true"),r(".event-position").textContent="Loading…";for(const D of s.querySelectorAll("[data-step], [data-page]"))D.disabled=!0;const x=r(".event-list").scrollTop,T=l?.offset,b=document.activeElement,A=b instanceof HTMLElement?b.dataset:void 0;try{const D=await t.read(a.id,{filter:f,...E,...c?{revision:c}:{}},C.signal);if(C.signal.aborted)return;l=D,c=l.revision,y(),r(".event-list").scrollTop=l.offset===T?x:0,r(".event-scroll").scrollTop=0;const V=A?.event?`[data-event="${A.event}"]`:"";V&&(document.activeElement===b||!b?.isConnected&&document.activeElement===document.body)&&s.querySelector(V)?.focus({preventScroll:!0}),clearTimeout(p),p=setTimeout(()=>{h?.abort(),h=new AbortController;for(const H of[l?.previousItem,l?.nextItem])H&&t.read(a.id,{item:H,filter:f,revision:c},h.signal).catch(()=>{})},60)}catch(D){if(C.signal.aborted)return;l=void 0,r(".event-position").textContent="Unavailable",r(".event-content").innerHTML=`<div class="event-empty"><h3>Could not load this history.</h3><p>${bt(D instanceof Error?D.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===C&&(u=!1,s.removeAttribute("aria-busy"))}}const w=()=>{t.clear(),c=void 0,l=void 0,$()},M=()=>!s.hidden&&!e.hidden,O=()=>{clearTimeout(p),h?.abort(),i?.abort(),i=void 0,u=!1,l=void 0,s.hidden=!0,s.removeAttribute("aria-busy"),e.classList.remove("has-events"),n.select(null)},R=E=>{if(u)return;const C=E==="next"?l?.nextItem:l?.previousItem;C&&$({item:C})};return s.addEventListener("click",E=>{const C=E.target.closest("button");if(C){if(C.dataset.event&&$({item:C.dataset.event}),C.dataset.step&&R(C.dataset.step==="next"?"next":"previous"),C.dataset.page){const x=C.dataset.page==="next"?l?.nextCursor:l?.previousCursor;x&&$({cursor:x})}C.hasAttribute("data-retry")&&$(g),(C.hasAttribute("data-reload")||C.classList.contains("event-reload"))&&w(),C.classList.contains("event-close")&&(O(),document.querySelector("#scene canvas")?.focus({preventScroll:!0}))}},{signal:o.signal}),r(".event-browser").addEventListener("toggle",m,{signal:o.signal}),{close:O,handleKey(E){return!M()||E.defaultPrevented||E.metaKey||E.ctrlKey||E.altKey||E.shiftKey||document.querySelector("dialog[open]")||E.target.closest('input, select, textarea, [contenteditable="true"], [data-drag-panel], #explorer')?!1:E.key==="Escape"?(E.preventDefault(),O(),document.querySelector("#scene canvas")?.focus({preventScroll:!0}),!0):["ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].includes(E.key)?(E.preventDefault(),R(E.key==="ArrowLeft"||E.key==="ArrowUp"?"previous":"next"),!0):!1},open(E,C,x){clearTimeout(p),h?.abort();const T=a?.id===E.id;a=E,c=x,l=void 0,r(".event-list").replaceChildren(),r(".event-content").innerHTML='<p class="event-empty">Loading saved history…</p>',r(".event-coverage").textContent="Loading coverage…",T||(r(".event-browser").open=!1),s.hidden=!1,e.classList.add("has-events"),$(C?{item:C}:{})},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,l=0,c=0,f=1;const u=document.createElement("strong"),h=document.createElement("pre"),p=document.createElement("span"),g=()=>{clearTimeout(i),o?.abort(),o=void 0,r=void 0,a=void 0,e.hidden=!0,e.classList.remove("message-tooltip")};function d(y,$){if(!a)return;const w=`${sl(a)} · ${a.name}`,M=y||"No text recorded.",O=[$,f>1?`${f} nearby items`:"","Click to focus and read · ← / → to navigate"].filter(Boolean).join(" · ");u.textContent!==w&&(u.textContent=w),h.textContent!==M&&(h.textContent=M),p.textContent!==O&&(p.textContent=O),u.parentElement!==e&&e.replaceChildren(u,h,p),e.classList.add("message-tooltip"),e.hidden=!1,e.style.setProperty("--event-color",nl(a));const R=e.offsetWidth,E=e.offsetHeight,C=t.getBoundingClientRect(),x=[...document.querySelectorAll(".floating-panel:not([hidden]), .app-header, .map-controls")].map(A=>A.getBoundingClientRect()),b=[c+18,c-E-18].flatMap(A=>[l+18,l-R-18].map(D=>{D=Math.max(8,Math.min(D,t.clientWidth-R-8)),A=Math.max(8,Math.min(A,t.clientHeight-E-8));const V=C.left+D,H=C.top+A,z=x.reduce((re,Z)=>re+Math.max(0,Math.min(V+R,Z.right+8)-Math.max(V,Z.left-8))*Math.max(0,Math.min(H+E,Z.bottom+8)-Math.max(H,Z.top-8)),0);return{left:D,top:A,overlap:z}})).reduce((A,D)=>D.overlap<A.overlap?D:A);e.style.left=`${b.left}px`,e.style.top=`${b.top}px`}function m(y){const $=[y.text,y.input?`Input
87
87
  ${y.input}`:"",y.output?`Output
88
88
  ${y.output}`:""].filter(Boolean).join(`
89
89
 
90
- `);return{text:$.slice(0,1800),shortened:$.length>1800||!!y.partial}}return{clear:g,show(y,$,w,M,O,R){const E=`${$}:${w}:${y.id}`,T=r!==E;T&&g(),r=E,a=y,l=O,c=R,f=M;const x=s.get(E);d(x?.text||y.preview,x?x.shortened?"Content preview":"":"Loading message…"),!(!T||x)&&(i=setTimeout(async()=>{const C=new AbortController;o=C;try{const b=await n.read($,{item:y.id,revision:w,filter:"messages"},C.signal);if(C.signal.aborted||r!==E||b.selected?.id!==y.id)return;const A=m(b.selected);s.set(E,A),s.size>20&&s.delete(s.keys().next().value),d(A.text,A.shortened?"Content preview":"")}catch{!C.signal.aborted&&r===E&&d(y.preview,"Saved excerpt · open for details")}},120))},dispose(){g(),s.clear()}}}class Kg{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 c=new AbortController,f=this.generation,u=new URLSearchParams({filter:r,...n}),h=this.request(`/api/sessiongraph/session/${encodeURIComponent(t)}/events?${u}`,{signal:AbortSignal.any([c.signal,AbortSignal.timeout(3e4)])}).then(async d=>{const m=await d.json();if(!d.ok)throw d.status===409&&this.clear(),new Error(m.error||"Could not load events.");if(c.signal.aborted||f!==this.generation)throw new DOMException("Request cancelled","AbortError");if(m.sessionID!==t||n.revision&&m.revision!==n.revision)throw new Error("Saved history changed. Reload the event explorer.");const y=JSON.stringify([t,m.revision,r,n.item,n.cursor]),$=JSON.stringify(m).length;for(this.characters-=this.pages.get(y)?.characters||0,this.pages.delete(y),this.pages.set(y,{page:m,characters:$}),this.characters+=$;this.pages.size>20||this.characters>2e6;){const w=this.pages.keys().next().value;this.characters-=this.pages.get(w).characters,this.pages.delete(w)}return m});a={controller:c,promise:h,readers:0},this.pending.set(o,a);const p=a,g=()=>{this.pending.get(o)===p&&this.pending.delete(o)};h.then(g,g)}const l=a;return l.readers++,new Promise((c,f)=>{const u=()=>{p(),f(s.reason)};let h=!1;const p=()=>{h||(h=!0,s?.removeEventListener("abort",u),--l.readers===0&&this.pending.get(o)===l&&(this.pending.delete(o),l.controller.abort()))};s?.addEventListener("abort",u,{once:!0}),l.promise.then(g=>{h||(p(),c(g))},g=>{h||(p(),f(g))})})}}function ae(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 tn(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 Es,Xt,Ie,Qt,xs,Ur,Ss;const Ca="__TAURI_TO_IPC_KEY__";function zg(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}class ry{constructor(t){Es.add(this),Xt.set(this,void 0),Ie.set(this,0),Qt.set(this,[]),xs.set(this,void 0),tn(this,Xt,t||(()=>{})),this.id=zg(n=>{const s=n.index;if("end"in n){s==ae(this,Ie,"f")?this.cleanupCallback():tn(this,xs,s);return}const r=n.message;if(s==ae(this,Ie,"f")){for(ae(this,Es,"m",Ur).call(this,r),tn(this,Ie,ae(this,Ie,"f")+1);ae(this,Ie,"f")in ae(this,Qt,"f");){const o=ae(this,Qt,"f")[ae(this,Ie,"f")];ae(this,Es,"m",Ur).call(this,o),delete ae(this,Qt,"f")[ae(this,Ie,"f")],tn(this,Ie,ae(this,Ie,"f")+1)}ae(this,Ie,"f")===ae(this,xs,"f")&&this.cleanupCallback()}else ae(this,Qt,"f")[s]=r})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(t){tn(this,Xt,t)}get onmessage(){return ae(this,Xt,"f")}[(Xt=new WeakMap,Ie=new WeakMap,Qt=new WeakMap,xs=new WeakMap,Es=new WeakSet,Ur=function(n){try{ae(this,Xt,"f").call(this,n)}catch(s){queueMicrotask(()=>{throw s})}},Ca)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[Ca]()}}async function rl(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}class oy{get rid(){return ae(this,Ss,"f")}constructor(t){Ss.set(this,void 0),tn(this,Ss,t)}async close(){return rl("plugin:resources|close",{rid:this.rid})}async[(Ss=new WeakMap,Symbol.asyncDispose)](){await this.close()}}function Zg(){return!!(globalThis||window).isTauri}async function Jg(){await rl("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 Qg='<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>',em='<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 tm(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=c=>{const f=["downloading","installing","restarting"].includes(c.phase),u=c.phase==="ready"||c.phase==="error"&&c.retry!=="download",h=c.phase==="downloading"?c.progress===void 0?"Downloading":`${c.progress}%`:c.phase==="installing"?"Installing":c.phase==="restarting"?"Restarting":u?"Restart":c.phase==="error"?"Retry update":"Update",p=c.phase==="error"?`${c.retry==="restart"?"Could not restart SessionGraph.":`Could not ${c.retry==="download"?"download or verify":"install"} the update.`} ${c.error||""} Click to try again.`:c.phase==="restarting"?`Restarting SessionGraph ${c.version}`:u?`Restart to install SessionGraph ${c.version}`:`Update to SessionGraph ${c.version}`;t.hidden=c.phase==="hidden",t.disabled=f,t.dataset.phase=c.phase,t.setAttribute("aria-busy",String(f)),t.setAttribute("aria-label",p),t.title=p;const g=`${u||c.phase==="restarting"?em:Qg}<span>${h}</span>`;t.innerHTML!==g&&(t.innerHTML=g);const d=c.phase==="hidden"?"":c.phase==="downloading"?`Downloading SessionGraph ${c.version}`:p;d!==s&&(n.textContent=d,s=d)},o=new Xg(e,r);t.addEventListener("click",()=>{o.activate()});const i=()=>{document.visibilityState==="visible"&&navigator.onLine&&o.check()},a=window.setTimeout(i,1e4),l=window.setInterval(i,240*6e4);return document.addEventListener("visibilitychange",i),window.addEventListener("online",i),{check:()=>o.check(),dispose(){clearTimeout(a),clearInterval(l),o.dispose(),t.remove(),n.remove(),document.removeEventListener("visibilitychange",i),window.removeEventListener("online",i)}}}function nm(){return Zg()?tm({async check(){const{check:e}=await No(async()=>{const{check:n}=await import("./index-3_I59bPI.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 Jg()}}):{dispose(){}}}var sm=sn("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=sm.build();function qr(e,t){return e-t*Math.floor(e/t)}const ol=1721426;function $s(e,t,n,s){t=oi(e,t);let r=t-1,o=-2;return n<=2?o=0:Ns(t)&&(o=-1),ol-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*n-362)/12+o+s)}function Ns(e){return e%4===0&&(e%100!==0||e%400===0)}function oi(e,t){return e==="BC"?1-t:t}function rm(e){let t="AD";return e<=0&&(t="BC",e=1-e),[t,e]}const om={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 pn{fromJulianDay(t){let n=t,s=n-ol,r=Math.floor(s/146097),o=qr(s,146097),i=Math.floor(o/36524),a=qr(o,36524),l=Math.floor(a/1461),c=qr(a,1461),f=Math.floor(c/365),u=r*400+i*100+l*4+f+(i!==4&&f!==4?1:0),[h,p]=rm(u),g=n-$s(h,p,1,1),d=2;n<$s(h,p,3,1)?d=0:Ns(p)&&(d=1);let m=Math.floor(((g+d)*12+373)/367),y=n-$s(h,p,m,1)+1;return new Pe(h,p,m,y)}toJulianDay(t){return $s(t.era,t.year,t.month,t.day)}getDaysInMonth(t){return om[Ns(t.year)?"leapyear":"standard"][t.month-1]}getMonthsInYear(t){return 12}getDaysInYear(t){return Ns(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 im={"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 Se(e,t){return t=de(t,e.calendar),e.era===t.era&&e.year===t.year&&e.month===t.month&&e.day===t.day}function am(e,t){return t=de(t,e.calendar),e=tt(e),t=tt(t),e.era===t.era&&e.year===t.year&&e.month===t.month}function cm(e,t){return t=de(t,e.calendar),e=es(e),t=es(t),e.era===t.era&&e.year===t.year}function lm(e,t){return Er(e.calendar,t.calendar)&&Se(e,t)}function Rn(e,t){return Er(e.calendar,t.calendar)&&am(e,t)}function Pn(e,t){return Er(e.calendar,t.calendar)&&cm(e,t)}function Er(e,t){return e.isEqual?.(t)??t.isEqual?.(e)??e.identifier===t.identifier}function dm(e,t){return Se(e,xr(t))}const um={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6};function il(e,t,n){let s=e.calendar.toJulianDay(e),r=n?um[n]:gm(t),o=Math.ceil(s+1-r)%7;return o<0&&(o+=7),o}function al(e){return nt(Date.now(),e)}function xr(e){return Bt(al(e))}function cl(e,t){return e.calendar.toJulianDay(e)-t.calendar.toJulianDay(t)}function fm(e,t){return ka(e)-ka(t)}function ka(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let Gr=null,hm=!1;function ii(){return Gr==null&&(Gr=new Intl.DateTimeFormat().resolvedOptions().timeZone),Gr}function ll(){return hm}function tt(e){return e.subtract({days:e.day-1})}function ko(e){return e.add({days:e.calendar.getDaysInMonth(e)-e.day})}function es(e){return tt(e.subtract({months:e.month-1}))}function pm(e){return ko(e.add({months:e.calendar.getMonthsInYear(e)-e.month}))}function St(e,t,n){let s=il(e,t,n);return e.subtract({days:s})}function Aa(e,t,n){return St(e,t,n).add({days:6})}const La=new Map,Yr=new Map;function dl(e){if(Intl.Locale){let n=La.get(e);return n||(n=new Intl.Locale(e).maximize().region,n&&La.set(e,n)),n}let t=e.split("-")[1];return t==="u"?void 0:t}function gm(e){let t=Yr.get(e);if(!t){if(Intl.Locale){let s=new Intl.Locale(e);if("getWeekInfo"in s&&(t=s.getWeekInfo(),t))return Yr.set(e,t),t.firstDay}let n=dl(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&&im[n]||0};Yr.set(e,t)}return t.firstDay}function mm(e,t,n){let s=e.calendar.getDaysInMonth(e);return Math.ceil((il(tt(e),t,n)+s)/7)}function ul(e,t){return e&&t?e.compare(t)<=0?e:t:e||t}function fl(e,t){return e&&t?e.compare(t)>=0?e:t:e||t}const vm={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 ym(e,t){let n=e.calendar.toJulianDay(e),s=Math.ceil(n+1)%7;s<0&&(s+=7);let r=dl(t),[o,i]=vm[r]||[6,0];return s===o||s===i}function gn(e){e=de(e,new pn);let t=oi(e.era,e.year);return hl(t,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function hl(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 Ao(e,t){if(t==="UTC")return 0;if(e>0&&t===ii()&&!ll())return new Date(e).getTimezoneOffset()*-6e4;let{year:n,month:s,day:r,hour:o,minute:i,second:a}=pl(e,t);return hl(n,s,r,o,i,a,0)-Math.floor(e/1e3)*1e3}const Oa=new Map;function pl(e,t){let n=Oa.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"}),Oa.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 Ma=864e5;function bm(e,t,n,s){return(n===s?[n]:[n,s]).filter(o=>wm(e,t,o))}function wm(e,t,n){let s=pl(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 et(e,t,n="compatible"){let s=Le(e);if(t==="UTC")return gn(s);if(t===ii()&&n==="compatible"&&!ll()){s=de(s,new pn);let l=new Date,c=oi(s.era,s.year);return l.setFullYear(c,s.month-1,s.day),l.setHours(s.hour,s.minute,s.second,s.millisecond),l.getTime()}let r=gn(s),o=Ao(r-Ma,t),i=Ao(r+Ma,t),a=bm(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 gl(e,t,n="compatible"){return new Date(et(e,t,n))}function nt(e,t){let n=Ao(e,t),s=new Date(e+n),r=s.getUTCFullYear(),o=s.getUTCMonth()+1,i=s.getUTCDate(),a=s.getUTCHours(),l=s.getUTCMinutes(),c=s.getUTCSeconds(),f=s.getUTCMilliseconds();return new ts(r<1?"BC":"AD",r<1?-r+1:r,o,i,t,n,a,l,c,f)}function Bt(e){return new Pe(e.calendar,e.era,e.year,e.month,e.day)}function Le(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 sr(e.calendar,e.era,e.year,e.month,e.day,n,s,r,o)}function de(e,t){if(Er(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,qt(s),s}function ml(e,t,n){if(e instanceof ts)return e.timeZone===t?e:xm(e,t);let s=et(e,t,n);return nt(s,t)}function Em(e){let t=gn(e)-e.offset;return new Date(t)}function xm(e,t){let n=gn(e)-e.offset;return de(nt(n,t),e.calendar)}const Vn=36e5;function Sr(e,t){let n=e.copy(),s="hour"in n?Tm(n,t):0;Lo(n,t.years||0),n.calendar.balanceYearMonth&&n.calendar.balanceYearMonth(n,e),n.month+=t.months||0,Oo(n),vl(n),n.day+=(t.weeks||0)*7,n.day+=t.days||0,n.day+=s,Sm(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 Lo(e,t){e.calendar.isInverseEra?.(e)&&(t=-t),e.year+=t}function Oo(e){for(;e.month<1;)Lo(e,-1),e.month+=e.calendar.getMonthsInYear(e);let t=0;for(;e.month>(t=e.calendar.getMonthsInYear(e));)e.month-=t,Lo(e,1)}function Sm(e){for(;e.day<1;)e.month--,Oo(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,Oo(e)}function vl(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 qt(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),vl(e)}function yl(e){let t={};for(let n in e)typeof e[n]=="number"&&(t[n]=-e[n]);return t}function bl(e,t){return Sr(e,yl(t))}function ai(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),qt(n),n}function nr(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),Im(n),n}function $m(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=Is(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=Is(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=Is(e.minute,60);let t=Math.floor(e.hour/24);return e.hour=Is(e.hour,24),t}function Im(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 Is(e,t){let n=e%t;return n<0&&(n+=t),n}function Tm(e,t){return e.hour+=t.hours||0,e.minute+=t.minutes||0,e.second+=t.seconds||0,e.millisecond+=t.milliseconds||0,$m(e)}function ci(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=st(i,n,0,o.length-1,s?.round),r.era=o[i],qt(r);break}case"year":r.calendar.isInverseEra?.(r)&&(n=-n),r.year=st(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=st(e.month,n,1,e.calendar.getMonthsInYear(e),s?.round);break;case"day":r.day=st(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),qt(r),r}function wl(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 l=o>=12;i=l?12:0,a=l?23:11}r.hour=st(o,n,i,a,s?.round);break}case"minute":r.minute=st(e.minute,n,0,59,s?.round);break;case"second":r.second=st(e.second,n,0,59,s?.round);break;case"millisecond":r.millisecond=st(e.millisecond,n,0,999,s?.round);break;default:throw new Error("Unsupported field "+t)}return r}function st(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 El(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=Sr(Le(e),{years:t.years,months:t.months,weeks:t.weeks,days:t.days});n=et(r,e.timeZone)}else n=gn(e)-e.offset;n+=t.milliseconds||0,n+=(t.seconds||0)*1e3,n+=(t.minutes||0)*6e4,n+=(t.hours||0)*36e5;let s=nt(n,e.timeZone);return de(s,e.calendar)}function Cm(e,t){return El(e,yl(t))}function km(e,t,n,s){switch(t){case"hour":{let r=0,o=23;if(s?.hourCycle===12){let g=e.hour>=12;r=g?12:0,o=g?23:11}let i=Le(e),a=de(nr(i,{hour:r}),new pn),l=[et(a,e.timeZone,"earlier"),et(a,e.timeZone,"later")].filter(g=>nt(g,e.timeZone).day===a.day)[0],c=de(nr(i,{hour:o}),new pn),f=[et(c,e.timeZone,"earlier"),et(c,e.timeZone,"later")].filter(g=>nt(g,e.timeZone).day===c.day).pop(),u=gn(e)-e.offset,h=Math.floor(u/Vn),p=u%Vn;return u=st(h,n,Math.floor(l/Vn),Math.floor(f/Vn),s?.round)*Vn+p,de(nt(u,e.timeZone),e.calendar)}case"minute":case"second":case"millisecond":return wl(e,t,n,s);case"era":case"year":case"month":case"day":{let r=ci(Le(e),t,n,s),o=et(r,e.timeZone);return de(nt(o,e.timeZone),e.calendar)}default:throw new Error("Unsupported field "+t)}}function Am(e,t,n){let s=Le(e),r=nr(ai(s,t),t);if(r.compare(s)===0)return e;let o=et(r,e.timeZone,n);return de(nt(o,e.timeZone),e.calendar)}const Lm=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,Om=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function Mm(e){let t=e.match(Lm);if(!t)throw Om.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(Kr(t[1],0,9999),Kr(t[2],1,12),1);return n.day=Kr(t[3],1,n.calendar.getDaysInMonth(n)),n}function Kr(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 Dm(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 xl(e){let t=de(e,new pn),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 Sl(e){return`${xl(e)}T${Dm(e)}`}function Rm(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 Pm(e){return`${Sl(e)}${Rm(e.offset)}[${e.timeZone}]`}function li(e){let t=typeof e[0]=="object"?e.shift():new pn,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]=li(t);this.calendar=n,this.era=s,this.year=r,this.month=o,this.day=i,qt(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 Sr(this,t)}subtract(t){return bl(this,t)}set(t){return ai(this,t)}cycle(t,n,s){return ci(this,t,n,s)}toDate(t){return gl(this,t)}toString(){return xl(this)}compare(t){return cl(this,t)}}class sr{#e;constructor(...t){let[n,s,r,o,i]=li(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,qt(this)}copy(){return this.era?new sr(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new sr(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(t){return Sr(this,t)}subtract(t){return bl(this,t)}set(t){return ai(nr(this,t),t)}cycle(t,n,s){switch(t){case"era":case"year":case"month":case"day":return ci(this,t,n,s);default:return wl(this,t,n,s)}}toDate(t,n){return gl(this,t,n)}toString(){return Sl(this)}compare(t){let n=cl(this,t);return n===0?fm(this,Le(t)):n}}class ts{#e;constructor(...t){let[n,s,r,o,i]=li(t),a=t.shift(),l=t.shift();this.calendar=n,this.era=s,this.year=r,this.month=o,this.day=i,this.timeZone=a,this.offset=l,this.hour=t.shift()||0,this.minute=t.shift()||0,this.second=t.shift()||0,this.millisecond=t.shift()||0,qt(this)}copy(){return this.era?new ts(this.calendar,this.era,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond):new ts(this.calendar,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond)}add(t){return El(this,t)}subtract(t){return Cm(this,t)}set(t,n){return Am(this,t,n)}cycle(t,n,s){return km(this,t,n,s)}toDate(){return Em(this)}toString(){return Pm(this)}toAbsoluteString(){return this.toDate().toISOString()}compare(t){return this.toDate().getTime()-ml(t,this.timeZone).toDate().getTime()}}let zr=new Map;class Ae{constructor(t,n={}){this.formatter=$l(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 Fm()&&(this.resolvedHourCycle||(this.resolvedHourCycle=Hm(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 Vm={true:{ja:"h11"},false:{}};function $l(e,t={}){if(typeof t.hour12=="boolean"&&Nm()){t={...t};let r=Vm[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(zr.has(n))return zr.get(n);let s=new Intl.DateTimeFormat(e,t);return zr.set(n,s),s}let Zr=null;function Nm(){return Zr==null&&(Zr=new Intl.DateTimeFormat("en-US",{hour:"numeric",hour12:!1}).format(new Date(2020,2,3,0))==="24"),Zr}let Jr=null;function Fm(){return Jr==null&&(Jr=new Intl.DateTimeFormat("fr",{hour:"numeric",hour12:!1}).resolvedOptions().hourCycle==="h12"),Jr}function Hm(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=$l(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 _m(e,t,n,s,r){const o={};for(let a in t){const l=a,c=t[l];c!=null&&(o[l]=Math.floor(c/2),o[l]>0&&c%2===0&&o[l]--)}const i=Kt(e,t,n).subtract(o);return os(e,i,t,n,s,r)}function Kt(e,t,n,s,r){let o=e;return t.years?o=es(e):t.months?o=tt(e):t.weeks&&(o=St(e,n)),os(e,o,t,n,s,r)}function di(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=Kt(e,t,n).subtract(o);return os(e,i,t,n,s,r)}function os(e,t,n,s,r,o){return r&&e.compare(r)>=0&&(t=fl(t,Kt(Bt(r),n,s))),o&&e.compare(o)<=0&&(t=ul(t,di(Bt(o),n,s))),t}function ke(e,t,n){const s=Bt(e),r=t?Bt(t):void 0,o=n?Bt(n):void 0;let i=s;return r&&(i=fl(i,r)),o&&(i=ul(i,o)),i.compare(s)===0?e:"hour"in e?e.set({year:i.year,month:i.month,day:i.day}):i}function Da(e,t,n,s,r,o){switch(t){case"start":return Kt(e,n,s,r,o);case"end":return di(e,n,s,r,o);default:return _m(e,n,s,r,o)}}function Et(e,t){return e==null||t==null?e===t:!("hour"in e)&&!("hour"in t)?Se(e,t):Le(e).compare(Le(t))===0}function Ra(e,t,n,s,r){return e?t?.(e,n)?!0:_e(e,s,r):!1}function _e(e,t,n){return t!=null&&e.compare(t)<0||n!=null&&e.compare(n)>0}function Bm(e,t,n){const s=e.subtract({days:1});return Se(s,e)||_e(s,t,n)}function jm(e,t,n){const s=e.add({days:1});return Se(s,e)||_e(s,t,n)}function ui(e){let t={...e};for(let n in t)t[n]=1;return t}function Il(e,t){let n={...t};return n.days?n.days--:n.days=-1,e.add(n)}function Tl(e){if(!e)return;const t=e.calendar.identifier;return t==="gregory"||t==="iso8601"?e.era==="BC"?"short":void 0:"short"}function Cl(e,t,n){const s=n??Le(xr(t));return new Ae(e,{weekday:"long",month:"long",year:"numeric",day:"numeric",era:Tl(s),calendar:s.calendar.identifier,timeZone:t})}function Pa(e,t,n){const s=n??xr(t);return new Ae(e,{month:"long",year:"numeric",era:Tl(s),calendar:s.calendar.identifier,timeZone:t})}function Wm(e,t,n,s,r){let o=n.formatRangeToParts(e.toDate(r),t.toDate(r)),i=-1;for(let c=0;c<o.length;c++){let f=o[c];if(f.source==="shared"&&f.type==="literal")i=c;else if(f.source==="endRange")break}let a="",l="";for(let c=0;c<o.length;c++)c<i?a+=o[c].value:c>i&&(l+=o[c].value);return s(a,l)}function Ts(e,t,n,s){if(!e)return"";let r=e,o=t??e,i=Cl(n,s);return Se(r,o)?i.format(r.toDate(s)):Wm(r,o,i,(a,l)=>`${a} – ${l}`,s)}var Um=["sun","mon","tue","wed","thu","fri","sat"];function kl(e){return e!=null?Um[e]:void 0}function Al(e,t,n){const s=kl(n);return St(e,t,s)}function Ll(e,t,n,s){const r=t.add({weeks:e}),o=[];let i=Al(r,n,s);for(;o.length<7;){o.push(i);let a=i.add({days:1});if(Se(i,a))break;i=a}return o}function qm(e,t,n,s){const r=kl(s),o=n??mm(e,t,r);return[...new Array(o).keys()].map(a=>Ll(a,e,t,s))}function Gm(e,t){const n=new Ae(e,{weekday:"long",timeZone:t}),s=new Ae(e,{weekday:"short",timeZone:t}),r=new Ae(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=Al(e,s,t),o=[...new Array(7).keys()],i=Gm(s,n);return o.map(a=>i(r.add({days:a})))}function Km(e,t="long",n){if(!n||n.calendar.identifier==="gregory"||n.calendar.identifier==="iso8601"){const i=new Date(2021,0,1),a=[];for(let l=0;l<12;l++)a.push(i.toLocaleString(e,{month:t})),i.setMonth(i.getMonth()+1);return a}const s=n.calendar.getMonthsInYear(n),r=new Ae(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 Va(e,t){const n=St(e,t,"mon"),s=n.year,r=n.set({month:1,day:4}),o=St(r,t,"mon"),i=n.calendar.toJulianDay(n),a=o.calendar.toJulianDay(o);if(i>=a)return 1+Math.floor((i-a)/7);const l=n.set({year:s-1,month:1,day:4}),c=St(l,t,"mon"),f=c.calendar.toJulianDay(c);return 1+Math.floor((i-f)/7)}function zm(e){const t=[];for(let n=e.from;n<=e.to;n+=1)t.push(n);return t}var Zm=1900,Jm=2099;function Xm(e,t,n){const s=e.calendar,r=t?.year??de(new Pe(Zm,1,1),s).year,o=n?.year??de(new Pe(Jm,12,31),s).year;return{from:r,to:o}}var Qm=10;function ev(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+Qm?(r-100).toString():r.toString()}return e}}function cn(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 zn(e,t){const n=xr(e??ii());return t?de(n,t):n}function is(e,t,n,s){return function(o){const{startDate:i,focusedDate:a}=o,l=Il(i,e);return _e(a,n,s)?{startDate:i,focusedDate:ke(a,n,s),endDate:l}:a.compare(i)<0?{startDate:di(a,e,t,n,s),focusedDate:ke(a,n,s),endDate:l}:a.compare(l)>0?{startDate:Kt(a,e,t,n,s),endDate:l,focusedDate:ke(a,n,s)}:{startDate:i,endDate:l,focusedDate:ke(a,n,s)}}}function Ol(e,t,n,s,r,o){const i=is(n,s,r,o),a=t.add(n);return i({focusedDate:e.add(n),startDate:Kt(os(e,a,n,s,r,o),n,s)})}function Ml(e,t,n,s,r,o){const i=is(n,s,r,o);let a=t.subtract(n);return i({focusedDate:e.subtract(n),startDate:Kt(os(e,a,n,s,r,o),n,s)})}function tv(e,t,n,s,r,o,i){const a=is(s,r,o,i);if(!n&&!s.days)return a({focusedDate:e.add(ui(s)),startDate:t});if(s.days)return Ol(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 nv(e,t,n,s,r,o,i){const a=is(s,r,o,i);if(!n&&!s.days)return a({focusedDate:e.subtract(ui(s)),startDate:t});if(s.days)return Ml(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 Na=new Map;function sv(e){let t=Na.get(e);return t!=null||(t="0123456789"+new Intl.NumberFormat(e,{useGrouping:!1}).format(1234567890),Na.set(e,t)),t}var rv=(e,t)=>t?sv(t).includes(e):/\d/.test(e),Dl=(e,t,n)=>!e||e.length!==1?!0:rv(e,n)||t.includes(e),ov=(e,t,n)=>e.split("").filter(s=>Dl(s,t,n)).join(""),Fa=new Map;function iv(e){let t=Fa.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:"/",Fa.set(e,t),t}var Ha=e=>e!=null&&e.length===4,av=e=>e!=null&&parseFloat(e)<=12,cv=e=>e!=null&&parseFloat(e)<=31;function lv(e,t,n){const s=dv(t,n);let{year:r,month:o,day:i}=uv(s,e)??{};if(r!=null||o!=null||i!=null){const c=new Date;r||(r=c.getFullYear().toString()),o||(o=(c.getMonth()+1).toString()),i||(i=c.getDate().toString())}if(Ha(r)||(r=ev(r)),Ha(r)&&av(o)&&cv(i))return new Pe(+r,+o,+i);const l=Date.parse(e);if(!isNaN(l)){const c=new Date(l);return new Pe(c.getFullYear(),c.getMonth()+1,c.getDate())}}function dv(e,t){return new Ae(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 uv(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 _a(e,t,n){const s=Bt(al(n));switch(e){case"thisWeek":return[St(s,t),Aa(s,t)];case"thisMonth":return[tt(s),s];case"thisQuarter":return[tt(s).add({months:-((s.month-1)%3)}),s];case"thisYear":return[es(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[tt(s.add({months:-1})),ko(s.add({months:-1}))];case"lastQuarter":return[tt(s.add({months:-((s.month-1)%3)-3})),ko(s.add({months:-((s.month-1)%3)-1}))];case"lastWeek":return[St(s,t).add({weeks:-1}),Aa(s,t).add({weeks:-1})];case"lastYear":return[es(s.add({years:-1})),pm(s.add({years:-1}))];default:throw new Error(`Invalid date range preset: ${e}`)}}var fv=(e,t)=>e.ids?.label?.(t)??`datepicker:${e.id}:label:${t}`,hv=e=>e.ids?.root??`datepicker:${e.id}`,pv=(e,t)=>e.ids?.table?.(t)??`datepicker:${e.id}:table:${t}`,Mo=e=>e.ids?.content??`datepicker:${e.id}:content`,Xr=(e,t)=>e.ids?.cellTrigger?.(t)??`datepicker:${e.id}:cell-trigger:${t}`,gv=(e,t)=>e.ids?.prevTrigger?.(t)??`datepicker:${e.id}:prev:${t}`,mv=(e,t)=>e.ids?.nextTrigger?.(t)??`datepicker:${e.id}:next:${t}`,vv=(e,t)=>e.ids?.viewTrigger?.(t)??`datepicker:${e.id}:view:${t}`,Rl=e=>e.ids?.clearTrigger??`datepicker:${e.id}:clear`,Pl=e=>e.ids?.control??`datepicker:${e.id}:control`,Ba=(e,t)=>e.ids?.input?.(t)??`datepicker:${e.id}:input:${t}`,Vl=e=>e.ids?.trigger??`datepicker:${e.id}:trigger`,Nl=e=>e.ids?.positioner??`datepicker:${e.id}:positioner`,Fl=e=>e.ids?.monthSelect??`datepicker:${e.id}:month-select`,Hl=e=>e.ids?.yearSelect??`datepicker:${e.id}:year-select`,ja=(e,t)=>Cf(nn(e),`[data-part=table-cell-trigger][data-view=${t}][data-focus]:not([data-outside-range])`),Fs=e=>e.getById(Vl(e)),nn=e=>e.getById(Mo(e)),Un=e=>Tf(_l(e),"[data-part=input]"),yv=e=>e.getById(Hl(e)),bv=e=>e.getById(Fl(e)),wv=e=>e.getById(Rl(e)),Wa=e=>e.getById(Nl(e)),_l=e=>e.getById(Pl(e)),Ua=e=>{const t=Un(e);if(t.length===0){Fs(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 Hs(e){const[t,n]=e;let s;return!t||!n?s=e:s=t.compare(n)<=0?e:[n,t],s}function en(e,t){const[n,s]=t;return!n||!s?!1:n.compare(e)<=0&&s.compare(e)>=0}function Cs(e){return e.slice().filter(t=>t!=null).sort((t,n)=>t.compare(n))}function Ev(e,t){return new Ae(e).formatToParts(new Date).map(n=>t[n.type]??n.value).join("")}var qa=e=>!Number.isNaN(e.day)&&!Number.isNaN(e.month)&&!Number.isNaN(e.year),xv={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 oo(e,{year:"Switch to previous decade",month:"Switch to previous year",day:"Switch to previous month"})},nextTrigger(e){return oo(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 it(e,t){return e?e==="day"?0:e==="month"?1:2:t||0}function fi(e){return e===0?"day":e===1?"month":"year"}function hi(e,t,n){return fi(mu(it(e,0),it(t,0),it(n,2)))}function Sv(e,t){return it(e,0)>it(t,0)}function $v(e,t){return it(e,0)<it(t,0)}function Bl(e,t,n){const s=it(e,0)+1;return hi(fi(s),t,n)}function Iv(e,t,n){const s=it(e,0)-1;return hi(fi(s),t,n)}var Tv=["day","month","year"];function Cv(e){Tv.forEach(t=>e(t))}var kv=Ip(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=cn(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 Ae(r,{year:"numeric",timeZone:o,calendar:n.calendar.identifier}),h=u.format(n.toDate(o)),p=u.format(s.toDate(o)),g=i==="range"?`${h} - ${p}`:h;return{start:h,end:p,formatted:g}}const a=new Ae(r,{month:"long",year:"numeric",timeZone:o,calendar:n.calendar.identifier}),l=a.format(n.toDate(o)),c=a.format(s.toDate(o)),f=i==="range"?`${l} - ${c}`:l;return{start:l,end:c,formatted:f}});function Av(e,t){const{state:n,context:s,prop:r,send:o,computed:i,scope:a}=e,l=s.get("startValue"),c=i("endValue"),f=s.get("value"),u=s.get("focusedValue"),h=s.get("hoveredValue"),p=h?Hs([f[0],h]):[],g=!!r("disabled"),d=!!r("readOnly"),m=!!r("invalid"),y=i("isInteractive"),$=f.length===0,w=r("min"),M=r("max"),O=r("locale"),R=r("timeZone"),E=r("startOfWeek"),T=n.matches("focused"),x=n.matches("open"),C=r("selectionMode")==="range",b=r("selectionMode")==="multiple",A=r("isDateUnavailable"),D=r("maxSelectedDates"),V=b&&D!=null&&f.length>=D,H=s.get("currentPlacement"),z=H?Pc(H):void 0,re=Vc({...r("positioning"),placement:H}),Z=iv(O),W=ic(xv,r("translations"));function be(L=l){const S=r("fixedWeeks")?6:void 0;return qm(L,O,S,E)}function Mt(L={}){const{format:S}=L;return Km(O,S,u).map((v,I)=>{const F=I+1,Q=u.set({month:F}),U=_e(Q,w,M);return{label:v,value:F,disabled:U}})}function $e(){const L=Xm(u,w,M);return zm(L).map(v=>({label:v.toString(),value:v,disabled:!Or(v,w?.year,M?.year)}))}function Ke(L){return Ra(L,A,O,w,M)}function Dt(L){const S=l??zn(R,u.calendar);o({type:"FOCUS.SET",value:S.set({month:L})})}function Zt(L){const S=l??zn(R,u.calendar);o({type:"FOCUS.SET",value:S.set({year:L})})}function vt(L){const{value:S,disabled:v}=L,I=u.set({year:S}),Q=!cn(l.year).includes(S),U=Or(S,w?.year,M?.year),G=C&&en(I,f),ce=C&&f[0]&&Pn(I,f[0]),De=C&&f[1]&&Pn(I,f[1]),Ne=C&&p.length>0,ie=Ne&&en(I,p),Fe=Ne&&p[0]&&Pn(I,p[0]),He=Ne&&p[1]&&Pn(I,p[1]),ds={focused:u.year===L.value,selectable:U,outsideRange:Q,selected:!!f.find(us=>us&&us.year===S),valueText:S.toString(),inRange:G||ie,firstInRange:!!ce,lastInRange:!!De,inHoveredRange:!!ie,firstInHoveredRange:!!Fe,lastInHoveredRange:!!He,value:I,get disabled(){return v||!ds.selectable}};return ds}function Rt(L){const{value:S,disabled:v}=L,I=u.set({month:S}),F=Pa(O,R,u),Q=C&&en(I,f),U=C&&f[0]&&Rn(I,f[0]),G=C&&f[1]&&Rn(I,f[1]),ce=C&&p.length>0,De=ce&&en(I,p),Ne=ce&&p[0]&&Rn(I,p[0]),ie=ce&&p[1]&&Rn(I,p[1]),Fe={focused:u.month===L.value,selectable:!_e(I,w,M),selected:!!f.find(He=>He&&He.month===S&&He.year===u.year),valueText:F.format(I.toDate(R)),inRange:Q||De,firstInRange:!!U,lastInRange:!!G,inHoveredRange:!!De,firstInHoveredRange:!!Ne,lastInHoveredRange:!!ie,outsideRange:!1,value:I,get disabled(){return v||!Fe.selectable}};return Fe}function yt(L){const{value:S,disabled:v,visibleRange:I=i("visibleRange")}=L,F=Cl(O,R,u),Q=ui(i("visibleDuration")),U=r("outsideDaySelectable"),G=I.start.add(Q).subtract({days:1}),ce=_e(S,I.start,G),De=C&&en(S,f),Ne=C&&f[0]&&Se(S,f[0]),ie=C&&f[1]&&Se(S,f[1]),Fe=C&&p.length>0,He=Fe&&en(S,p),ds=Fe&&p[0]&&Se(S,p[0]),us=Fe&&p[1]&&Se(S,p[1]),ki=f.some(Ai=>Ai!=null&&Se(S,Ai)),fs={invalid:_e(S,w,M),disabled:v||!U&&ce||_e(S,w,M)||V&&!ki,selected:ki,unavailable:Ra(S,A,O,w,M)&&!v,outsideRange:ce,today:dm(S,R),weekend:ym(S,O),value:S,valueText:F.format(S.toDate(R)),get focused(){return u!=null&&Se(S,u)&&(!fs.outsideRange||U)},get selectable(){return!fs.disabled&&!fs.unavailable},inRange:De||He,firstInRange:Ne,lastInRange:ie,inHoveredRange:He,firstInHoveredRange:ds,lastInHoveredRange:us};return fs}function $n(L){const{view:S="day",id:v}=L;return[S,v].filter(Boolean).join(" ")}return{focused:T,open:x,disabled:g,invalid:m,readOnly:d,inline:!!r("inline"),numOfMonths:r("numOfMonths"),showWeekNumbers:!!r("showWeekNumbers"),selectionMode:r("selectionMode"),maxSelectedDates:D,isMaxSelected:V,view:s.get("view"),getRangePresetValue(L){return _a(L,O,R)},getWeekNumber(L){const S=L[0];return S?Va(S,O):0},getDaysInWeek(L,S=l){return Ll(L,S,O,E)},getOffset(L){const S=l.add(L),v=c.add(L),I=Pa(O,R,u);return{visibleRange:{start:S,end:v},weeks:be(S),visibleRangeText:{start:I.format(S.toDate(R)),end:I.format(v.toDate(R))}}},getMonthWeeks:be,isUnavailable:Ke,weeks:be(),weekDays:Ym(l,E,R,O),visibleRangeText:i("visibleRangeText"),value:f,valueAsDate:f.filter(L=>L!=null).map(L=>L.toDate(R)),valueAsString:i("valueAsString"),focusedValue:u,focusedValueAsDate:u?.toDate(R),focusedValueAsString:r("format")(u,{locale:O,timeZone:R}),visibleRange:i("visibleRange"),selectToday(){const L=ke(zn(R,u.calendar),w,M);o({type:"VALUE.SET",value:[L]})},setValue(L){const S=L.map(v=>ke(v,w,M));o({type:"VALUE.SET",value:S})},setTime(L,S=0){const v=Array.from(f);let I=v[S];I&&("hour"in I||(I=Le(I)),I=I.set({hour:L.hour??("hour"in I?I.hour:0),minute:L.minute??("minute"in I?I.minute:0),second:L.second??("second"in I?I.second:0),millisecond:L.millisecond??("millisecond"in I?I.millisecond:0)}),v[S]=ke(I,w,M),o({type:"VALUE.SET",value:v}))},clearValue(L={}){const{focus:S=!0}=L;o({type:"VALUE.CLEAR",focus:S})},setFocusedValue(L){o({type:"FOCUS.SET",value:L})},setOpen(L){r("inline")||o({type:L?"OPEN":"CLOSE",replaces:"open"})},focusMonth:Dt,focusYear:Zt,getYears:$e,getMonths:Mt,getYearsGrid(L={}){const{columns:S=1}=L,v=cn(l.year).map(I=>({label:I.toString(),value:I,disabled:!Or(I,w?.year,M?.year)}));return Pi(v,S)},getDecade(){const L=cn(l.year);return{start:L.at(0),end:L.at(-1)}},getMonthsGrid(L={}){const{columns:S=1,format:v}=L;return Pi(Mt({format:v}),S)},format(L,S={month:"long",year:"numeric"}){return new Ae(O,{...S,calendar:L.calendar.identifier}).format(L.toDate(R))},setView(L){o({type:"VIEW.SET",view:L})},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:hv(a),"data-state":x?"open":"closed","data-disabled":P(g),"data-readonly":P(d),"data-empty":P($)})},getLabelProps(L={}){const{index:S=0}=L;return t.label({...J.label.attrs,id:fv(a,S),dir:r("dir"),htmlFor:Ba(a,S),"data-state":x?"open":"closed","data-index":S,"data-disabled":P(g),"data-readonly":P(d),"data-invalid":P(m)})},getControlProps(){return t.element({...J.control.attrs,dir:r("dir"),id:Pl(a),"data-disabled":P(g),"data-placeholder-shown":P($),"data-invalid":P(m)})},getRangeTextProps(){return t.element({...J.rangeText.attrs,dir:r("dir")})},getContentProps(){return t.element({...J.content.attrs,hidden:!x,dir:r("dir"),"data-state":x?"open":"closed","data-placement":H,"data-side":z,"data-inline":P(r("inline")),id:Mo(a),tabIndex:-1,role:"application","aria-label":W.content})},getTableProps(L={}){const{view:S="day",columns:v=S==="day"?7:4}=L,I=$n(L);return t.element({...J.table.attrs,role:"grid","data-columns":v,"aria-label":i("visibleRangeText").formatted,id:pv(a,I),"aria-readonly":he(d),"aria-disabled":he(g),"aria-multiselectable":he(r("selectionMode")!=="single"),"data-view":S,dir:r("dir"),tabIndex:-1,onKeyDown(F){if(F.defaultPrevented||g)return;const Q={Enter(){y&&(S==="day"&&Ke(u)||S==="month"&&!Rt({value:u.month}).selectable||S==="year"&&!vt({value:u.year}).selectable||o({type:"TABLE.ENTER",view:S,columns:v,focus:!0}))},Space(G){Q.Enter?.()},ArrowLeft(){o({type:"TABLE.ARROW_LEFT",view:S,columns:v,focus:!0})},ArrowRight(){o({type:"TABLE.ARROW_RIGHT",view:S,columns:v,focus:!0})},ArrowUp(){o({type:"TABLE.ARROW_UP",view:S,columns:v,focus:!0})},ArrowDown(){o({type:"TABLE.ARROW_DOWN",view:S,columns:v,focus:!0})},PageUp(G){o({type:"TABLE.PAGE_UP",larger:G.shiftKey,view:S,columns:v,focus:!0})},PageDown(G){o({type:"TABLE.PAGE_DOWN",larger:G.shiftKey,view:S,columns:v,focus:!0})},Home(){o({type:"TABLE.HOME",view:S,columns:v,focus:!0})},End(){o({type:"TABLE.END",view:S,columns:v,focus:!0})}},U=Q[ao(F,{dir:r("dir")})];U&&(U(F),F.preventDefault(),F.stopPropagation())},onPointerLeave(){o({type:"TABLE.POINTER_LEAVE"})},onPointerDown(){o({type:"TABLE.POINTER_DOWN",view:S})},onPointerUp(){o({type:"TABLE.POINTER_UP",view:S})}})},getTableHeadProps(L={}){const{view:S="day"}=L;return t.element({...J.tableHead.attrs,"aria-hidden":!0,dir:r("dir"),"data-view":S,"data-disabled":P(g)})},getTableHeaderProps(L={}){const{view:S="day"}=L;return t.element({...J.tableHeader.attrs,dir:r("dir"),"data-view":S,"data-disabled":P(g)})},getTableBodyProps(L={}){const{view:S="day"}=L;return t.element({...J.tableBody.attrs,"data-view":S,"data-disabled":P(g)})},getTableRowProps(L={}){const{view:S="day"}=L;return t.element({...J.tableRow.attrs,"aria-disabled":he(g),"data-disabled":P(g),"data-view":S})},getWeekNumberHeaderCellProps(L={}){const{view:S="day"}=L;return t.element({...J.tableCell.attrs,scope:"col","aria-label":W.weekColumnHeader,"data-view":S,"data-type":"week-number","data-disabled":P(g)})},getWeekNumberCellProps(L){const{weekIndex:S,week:v}=L,I=v[0]?Va(v[0],O):0;return t.element({...J.tableCell.attrs,role:"rowheader","aria-label":W.weekNumberCell?.(I),"data-view":"day","data-week-index":S,"data-type":"week-number","data-disabled":P(g)})},getDayTableCellState:yt,getDayTableCellProps(L){const{value:S}=L,v=yt(L);return t.element({...J.tableCell.attrs,role:"gridcell","aria-disabled":he(!v.selectable),"aria-selected":v.selected||v.inRange,"aria-invalid":he(v.invalid),"aria-current":v.today?"date":void 0,"data-value":S.toString()})},getDayTableCellTriggerProps(L){const{value:S}=L,v=yt(L);return t.element({...J.tableCellTrigger.attrs,id:Xr(a,S.toString()),role:"button",dir:r("dir"),tabIndex:g?-1:v.focused?0:-1,"aria-label":W.dayCell(v),"aria-disabled":he(!v.selectable),"aria-invalid":he(v.invalid),"data-disabled":P(!v.selectable),"data-selectable":P(v.selectable),"data-selected":P(v.selected),"data-value":S.toString(),"data-view":"day","data-today":P(v.today),"data-focus":P(v.focused),"data-unavailable":P(v.unavailable),"data-range-start":P(v.firstInRange),"data-range-end":P(v.lastInRange),"data-in-range":P(v.inRange),"data-outside-range":P(v.outsideRange),"data-weekend":P(v.weekend),"data-in-hover-range":P(v.inHoveredRange),"data-hover-range-start":P(v.firstInHoveredRange),"data-hover-range-end":P(v.lastInHoveredRange),onClick(I){I.defaultPrevented||y&&v.selectable&&o({type:"CELL.CLICK",cell:"day",value:S})},onPointerMove:C?I=>{if(I.pointerType==="touch"||!v.selectable)return;const F=!a.isActiveElement(I.currentTarget);h&&lm(S,h)||o({type:"CELL.POINTER_MOVE",cell:"day",value:S,focus:F,outsideRange:v.outsideRange})}:void 0})},getMonthTableCellState:Rt,getMonthTableCellProps(L){const{value:S,columns:v}=L,I=Rt(L);return t.element({...J.tableCell.attrs,dir:r("dir"),colSpan:v,role:"gridcell","aria-selected":he(I.selected||I.inRange),"data-selected":P(I.selected),"aria-disabled":he(!I.selectable),"data-value":S})},getMonthTableCellTriggerProps(L){const{value:S}=L,v=Rt(L);return t.element({...J.tableCellTrigger.attrs,id:Xr(a,S.toString()),role:"button",dir:r("dir"),tabIndex:g?-1:v.focused?0:-1,"aria-label":v.valueText,"aria-disabled":he(!v.selectable),"data-disabled":P(!v.selectable),"data-selectable":P(v.selectable),"data-selected":P(v.selected),"data-value":S,"data-view":"month","data-focus":P(v.focused),"data-outside-range":P(v.outsideRange),"data-range-start":P(v.firstInRange),"data-range-end":P(v.lastInRange),"data-in-range":P(v.inRange),"data-in-hover-range":P(v.inHoveredRange),"data-hover-range-start":P(v.firstInHoveredRange),"data-hover-range-end":P(v.lastInHoveredRange),onClick(I){I.defaultPrevented||y&&v.selectable&&o({type:"CELL.CLICK",cell:"month",value:S})},onPointerMove:C?I=>{if(I.pointerType==="touch"||!v.selectable)return;const F=!a.isActiveElement(I.currentTarget);h&&v.value&&Rn(v.value,h)||o({type:"CELL.POINTER_MOVE",cell:"month",value:v.value,focus:F})}:void 0})},getYearTableCellState:vt,getYearTableCellProps(L){const{value:S,columns:v}=L,I=vt(L);return t.element({...J.tableCell.attrs,dir:r("dir"),colSpan:v,role:"gridcell","aria-selected":he(I.selected||I.inRange),"data-selected":P(I.selected),"aria-disabled":he(!I.selectable),"data-value":S})},getYearTableCellTriggerProps(L){const{value:S}=L,v=vt(L);return t.element({...J.tableCellTrigger.attrs,id:Xr(a,S.toString()),role:"button",dir:r("dir"),tabIndex:g?-1:v.focused?0:-1,"aria-label":v.valueText,"aria-disabled":he(!v.selectable),"data-disabled":P(!v.selectable),"data-selectable":P(v.selectable),"data-selected":P(v.selected),"data-value":S,"data-view":"year","data-focus":P(v.focused),"data-outside-range":P(v.outsideRange),"data-range-start":P(v.firstInRange),"data-range-end":P(v.lastInRange),"data-in-range":P(v.inRange),"data-in-hover-range":P(v.inHoveredRange),"data-hover-range-start":P(v.firstInHoveredRange),"data-hover-range-end":P(v.lastInHoveredRange),onClick(I){I.defaultPrevented||y&&v.selectable&&o({type:"CELL.CLICK",cell:"year",value:S})},onPointerMove:C?I=>{if(I.pointerType==="touch"||!v.selectable||v.outsideRange)return;const F=!a.isActiveElement(I.currentTarget);h&&v.value&&Pn(v.value,h)||o({type:"CELL.POINTER_MOVE",cell:"year",value:v.value,focus:F})}:void 0})},getNextTriggerProps(L={}){const{view:S="day"}=L,v=g||!i("isNextVisibleRangeValid");return t.button({...J.nextTrigger.attrs,dir:r("dir"),id:mv(a,S),type:"button","aria-label":W.nextTrigger(S),disabled:v,"data-disabled":P(v),onClick(I){I.defaultPrevented||o({type:"GOTO.NEXT",view:S})}})},getPrevTriggerProps(L={}){const{view:S="day"}=L,v=g||!i("isPrevVisibleRangeValid");return t.button({...J.prevTrigger.attrs,dir:r("dir"),id:gv(a,S),type:"button","aria-label":W.prevTrigger(S),disabled:v,"data-disabled":P(v),onClick(I){I.defaultPrevented||o({type:"GOTO.PREV",view:S})}})},getClearTriggerProps(){return t.button({...J.clearTrigger.attrs,id:Rl(a),dir:r("dir"),type:"button","aria-label":W.clearTrigger,hidden:!f.length,onClick(L){L.defaultPrevented||y&&o({type:"VALUE.CLEAR"})}})},getTriggerProps(){return t.button({...J.trigger.attrs,id:Vl(a),dir:r("dir"),type:"button","data-placement":H,"data-side":z,"aria-label":W.trigger(x),"aria-controls":Mo(a),"aria-expanded":x,"data-state":x?"open":"closed","data-placeholder-shown":P($),"aria-haspopup":"grid",disabled:g,onClick(L){L.defaultPrevented||y&&o({type:"TRIGGER.CLICK"})}})},getViewProps(L={}){const{view:S="day"}=L;return t.element({...J.view.attrs,"data-view":S,hidden:s.get("view")!==S})},getViewTriggerProps(L={}){const{view:S="day"}=L,v=Bl(S,r("minView"),r("maxView")),I=v!==S,F=g||!I;return t.button({...J.viewTrigger.attrs,"data-view":S,dir:r("dir"),id:vv(a,S),type:"button",disabled:F,"data-disabled":P(F),"aria-label":W.viewTrigger(S,I?v:void 0),onClick(Q){Q.defaultPrevented||y&&o({type:"VIEW.TOGGLE",src:"viewTrigger"})}})},getViewControlProps(L={}){const{view:S="day"}=L;return t.element({...J.viewControl.attrs,"data-view":S,dir:r("dir")})},getInputProps(L={}){const{index:S=0,fixOnBlur:v=!0}=L;return t.input({...J.input.attrs,id:Ba(a,S),autoComplete:"off",autoCorrect:"off",spellCheck:"false",dir:r("dir"),name:r("name"),"data-index":S,"data-state":x?"open":"closed","data-placeholder-shown":P($),readOnly:d,disabled:g,required:r("required"),"aria-invalid":he(m),"data-invalid":P(m),placeholder:r("placeholder")||Ev(O,W.placeholder(O)),defaultValue:i("valueAsString")[S],onBeforeInput(I){const{data:F}=qo(I);Dl(F,Z,O)||I.preventDefault()},onClick(I){I.defaultPrevented||r("openOnClick")&&y&&o({type:"OPEN",src:"input.click"})},onFocus(){o({type:"INPUT.FOCUS",index:S})},onBlur(I){const F=I.currentTarget.value.trim();o({type:"INPUT.BLUR",value:F,index:S,fixOnBlur:v})},onKeyDown(I){if(I.defaultPrevented||!y)return;const Q={Enter(U){Ku(U)||Ke(u)||U.currentTarget.value.trim()!==""&&o({type:"INPUT.ENTER",value:U.currentTarget.value,index:S})}}[I.key];Q&&(Q(I),I.preventDefault())},onInput(I){const F=I.currentTarget.value;o({type:"INPUT.CHANGE",value:ov(F,Z,O),index:S})}})},getMonthSelectProps(){return t.select({...J.monthSelect.attrs,id:Fl(a),"aria-label":W.monthSelect,disabled:g,dir:r("dir"),defaultValue:l.month,onChange(L){Dt(Number(L.currentTarget.value))}})},getYearSelectProps(){return t.select({...J.yearSelect.attrs,id:Hl(a),disabled:g,"aria-label":W.yearSelect,dir:r("dir"),defaultValue:l.year,onChange(L){Zt(Number(L.currentTarget.value))}})},getPositionerProps(){return t.element({id:Nl(a),...J.positioner.attrs,dir:r("dir"),style:re.floating})},getPresetTriggerProps(L){const S=Array.isArray(L.value)?L.value:_a(L.value,O,R),v=S.filter(I=>I!=null).map(I=>I.toDate(R).toDateString());return t.button({...J.presetTrigger.attrs,"aria-label":W.presetTrigger(v),type:"button",onClick(I){I.defaultPrevented||y&&o({type:"PRESET.CLICK",value:S})}})}}}var Qr="__live-region-debug__",Lv="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;",Ov=100,Mv=200,Dv={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 Rv(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 l;function c(){if(!o)return;let m=n.getElementById(Qr);return m||(m=n.createElement("div"),m.id=Qr,m.dataset.liveAnnouncerDebug="true",m.setAttribute("aria-hidden","true"),m.style.cssText=Lv,a().appendChild(m),m)}function f(){const m=n.createElement("span");return m.dataset.liveAnnouncer="true",m.setAttribute("aria-live",t),m.setAttribute("aria-atomic","true"),m.setAttribute("role",t==="assertive"?"alert":"status"),Object.assign(m.style,Dv),a().appendChild(m),u=Date.now()+Mv,m}let u=0,h=f();function p(){i.clearTimeout(l),l=void 0}function g(m,y=r){p(),h?.isConnected||(h=f());const $=h;$.textContent="",l=i.setTimeout(()=>{l=void 0,$.textContent=m;const w=c();w&&(w.textContent=m)},Math.max(y,Ov,u-Date.now()))}function d(){p(),h?.remove(),h=null,o&&n.getElementById(Qr)?.remove()}return{announce:g,cancel:p,destroy:d,toJSON(){return"live-region"}}}var{and:ye}=jc();function Pv(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 ks(e,t){return e.map(n=>n==null?"":t("format")(n,{locale:t("locale"),timeZone:t("timeZone")}))}var Vv=Wc({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 g=new Intl.DateTimeFormat(t).resolvedOptions().calendar;g!=="gregory"&&g!=="iso8601"&&(o=e.createCalendar(g))}const i=p=>!o||p.calendar.identifier===o.identifier?p:de(p,o),a=e.defaultValue?Cs(e.defaultValue).map(p=>ke(i(p),e.min,e.max)):void 0,l=e.value?Cs(e.value).map(p=>ke(i(p),e.min,e.max)):void 0;let c=e.focusedValue||e.defaultFocusedValue||l?.[0]||a?.[0]||zn(n,o);c=ke(i(c),e.min,e.max);const f=e.minView||"day",u=e.maxView||"year",h=hi(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:g,timeZone:d}){return new Ae(g,{timeZone:d,day:"2-digit",month:"2-digit",year:"numeric",calendar:o?.identifier}).format(p.toDate(d))},parse(p,{locale:g,timeZone:d}){return lv(p,g,d)},...e,focusedValue:typeof e.focusedValue>"u"?void 0:c,defaultFocusedValue:c,value:l,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=ks(i,e);e("onFocusChange")?.({value:i,valueAsString:a,view:o,focusedValue:s})}})),value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:Pv,hash:s=>s.map(r=>r?.toString()??"").join(","),onChange(s){const r=n(),o=ks(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:Da(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})=>Il(e.get("startValue"),t("visibleDuration")),visibleRange:({context:e,computed:t})=>({start:e.get("startValue"),end:t("endValue")}),visibleRangeText:({context:e,prop:t,computed:n})=>kv({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})=>!Bm(e.get("startValue"),t("min"),t("max")),isNextVisibleRangeValid:({prop:e,computed:t})=>!jm(t("endValue"),e("min"),e("max")),valueAsString:({context:e,prop:t})=>ks(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:ye("shouldRestoreFocus","isInteractOutsideEvent"),target:"focused",actions:["restoreFocusToTrigger"]},{guard:"shouldRestoreFocus",target:"focused",actions:["restoreFocusToInput"]},{target:"idle"}],"CELL.CLICK":[{guard:"isAboveMinView",actions:["setFocusedValueForView","setPreviousView"]},{guard:ye("isRangePicker","hasSelectedRange"),actions:["setActiveIndexToStart","resetSelection","setActiveIndexToEnd"]},{guard:ye("isRangePicker","isSelectingEndDate","closeOnSelect","isOpenControlled"),actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","setRestoreFocus"]},{guard:ye("isRangePicker","isSelectingEndDate","closeOnSelect"),target:"focused",actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","restoreFocusToInput"]},{guard:ye("isRangePicker","isSelectingEndDate"),actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate"]},{guard:"isRangePicker",actions:["setFocusedDate","setSelectedDate","setActiveIndexToEnd"]},{guard:ye("isMultiPicker","canSelectDate"),actions:["setFocusedDate","toggleSelectedDate"]},{guard:"isMultiPicker",actions:["setFocusedDate"]},{guard:ye("closeOnSelect","isOpenControlled"),actions:["setFocusedDate","setSelectedDate","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["setFocusedDate","setSelectedDate","invokeOnClose","restoreFocusToInput"]},{actions:["setFocusedDate","setSelectedDate"]}],"CELL.POINTER_MOVE":[{guard:ye("isRangePicker","isSelectingEndDate","isDayPointerMoveOutsideVisibleMonth"),actions:["setHoveredDate"]},{guard:ye("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:ye("isRangePicker","hasSelectedRange"),actions:["setActiveIndexToStart","resetSelection","setActiveIndexToEnd","focusNextDay"]},{guard:ye("isRangePicker","isSelectingEndDate","closeOnSelect","isOpenControlled"),actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose"]},{guard:ye("isRangePicker","isSelectingEndDate","closeOnSelect"),target:"focused",actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","restoreFocusToInput"]},{guard:ye("isRangePicker","isSelectingEndDate"),actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate"]},{guard:"isRangePicker",actions:["setSelectedDate","setActiveIndexToEnd","focusNextDay"]},{guard:ye("isMultiPicker","canSelectDate"),actions:["toggleSelectedDate"]},{guard:"isMultiPicker"},{guard:ye("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})=>Sv(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=qn(e,s.value??t.get("focusedValue"));return o.some(l=>Et(l,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=_l(n);return vo(s,()=>Wa(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",Rv({level:"assertive",document:n})),()=>t.get("announcer")?.destroy?.()},trackDismissableElement({scope:e,send:t,context:n,prop:s}){return s("inline")?void 0:Gc(()=>nn(e),{type:"popover",defer:!0,getRootNode:e.getRootNode,layerStyleTargets:[()=>Wa(e)],exclude:[...Un(e),Fs(e),wv(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=Bl(e.get("view"),t("minView"),t("maxView"));e.set("view",n)},setPreviousView({context:e,prop:t}){const n=Iv(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,l]=s;a&&l?i=Ts(a,l,r,o):a?i=Ts(a,null,r,o):l?i=Ts(l,null,r,o):i=""}else i=s.map(a=>Ts(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}){If({target:nn(e),doc:e.getDoc()})},enableTextSelection({scope:e}){Ec({doc:e.getDoc(),target:nn(e)})},focusFirstSelectedDate(e){const{context:t}=e;t.get("value").length&&ne(e,t.get("value")[0])},syncInputElement({scope:e,computed:t}){pe(()=>{Un(e).forEach((s,r)=>{gs(s,t("valueAsString")[r]||"")})})},setFocusedDate(e){const{event:t}=e,n=Array.isArray(t.value)?t.value[0]:t.value;ne(e,n)},setFocusedValueForView(e){const{context:t,event:n}=e;ne(e,t.get("focusedValue").set({[t.get("view")]:n.value}))},focusNextMonth(e){const{context:t}=e;ne(e,t.get("focusedValue").add({months:1}))},focusPreviousMonth(e){const{context:t}=e;ne(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=>ke(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=qn(e,n.value??t.get("focusedValue"));s[r]=As(o,i),t.set("value",Hs(s))},resetSelection(e){const{context:t,event:n}=e,s=t.get("value")[0],r=qn(e,n.value??t.get("focusedValue"));t.set("value",[As(s,r)])},toggleSelectedDate(e){const{context:t,event:n}=e,s=qn(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",Cs(i))}else{const i=Array.from(r);i.splice(o,1),t.set("value",Cs(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]=As(r,o),e.set("value",Hs(n));const i=t("valueAsString");e.set("inputValue",i[s])},focusPreviousDay(e){const{context:t}=e,n=t.get("focusedValue").subtract({days:1});ne(e,n)},focusNextDay(e){const{context:t}=e,n=t.get("focusedValue").add({days:1});ne(e,n)},focusPreviousWeek(e){const{context:t}=e,n=t.get("focusedValue").subtract({weeks:1});ne(e,n)},focusNextWeek(e){const{context:t}=e,n=t.get("focusedValue").add({weeks:1});ne(e,n)},focusNextPage(e){const{context:t,computed:n,prop:s}=e,r=Ol(t.get("focusedValue"),t.get("startValue"),n("visibleDuration"),s("locale"),s("min"),s("max"));Ls(e,r)},focusPreviousPage(e){const{context:t,computed:n,prop:s}=e,r=Ml(t.get("focusedValue"),t.get("startValue"),n("visibleDuration"),s("locale"),s("min"),s("max"));Ls(e,r)},focusSectionStart(e){const{context:t}=e;ne(e,t.get("startValue").copy())},focusSectionEnd(e){const{computed:t}=e;ne(e,t("endValue").copy())},focusNextSection(e){const{context:t,event:n,computed:s,prop:r}=e,o=tv(t.get("focusedValue"),t.get("startValue"),n.larger,s("visibleDuration"),r("locale"),r("min"),r("max"));o&&Ls(e,o)},focusPreviousSection(e){const{context:t,event:n,computed:s,prop:r}=e,o=nv(t.get("focusedValue"),t.get("startValue"),n.larger,s("visibleDuration"),r("locale"),r("min"),r("max"));o&&Ls(e,o)},focusNextYear(e){const{context:t}=e,n=t.get("focusedValue").add({years:1});ne(e,n)},focusPreviousYear(e){const{context:t}=e,n=t.get("focusedValue").subtract({years:1});ne(e,n)},focusNextDecade(e){const{context:t}=e,n=t.get("focusedValue").add({years:10});ne(e,n)},focusPreviousDecade(e){const{context:t}=e,n=t.get("focusedValue").subtract({years:10});ne(e,n)},clearFocusedDate(e){const{context:t,prop:n}=e,s=t.get("focusedValue").calendar;ne(e,zn(n("timeZone"),s))},focusPreviousMonthColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").subtract({months:n.columns});ne(e,s)},focusNextMonthColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").add({months:n.columns});ne(e,s)},focusPreviousYearColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").subtract({years:n.columns});ne(e,s)},focusNextYearColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").add({years:n.columns});ne(e,s)},focusFirstMonth(e){const{context:t}=e,n=t.get("focusedValue"),s=n.calendar.getMinimumMonthInYear?.(n)??1;ne(e,n.set({month:s}))},focusLastMonth(e){const{context:t}=e,n=t.get("focusedValue"),s=n.calendar.getMonthsInYear(n);ne(e,n.set({month:s}))},focusFirstYear(e){const{context:t}=e,n=cn(t.get("focusedValue").year),s=t.get("focusedValue").set({year:n[0]});ne(e,s)},focusLastYear(e){const{context:t}=e,n=cn(t.get("focusedValue").year),s=t.get("focusedValue").set({year:n[n.length-1]});ne(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"&&pe(()=>{const s=t.get("view");ja(e,s)?.focus({preventScroll:!0})})},focusActiveCellIfNeeded({scope:e,context:t,event:n}){n.focus&&pe(()=>{const s=t.get("view");ja(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=nn(e),s=Nv(t);pe(()=>{Hi(e.getActiveElement(),[n])||Fs(e)?.focus(s)})},focusFirstInputElement({scope:e,event:t}){t.focus!==!1&&pe(()=>{const[n]=Un(e);(n??Fs(e))?.focus({preventScroll:!0})})},focusInputElement({scope:e}){pe(()=>Ua(e))},restoreFocusToInput({scope:e}){const t=nn(e);pe(()=>{Hi(e.getActiveElement(),[t])||Ua(e)})},syncMonthSelectElement({scope:e,context:t}){const n=bv(e);gs(n,t.get("startValue").month.toString())},syncYearSelectElement({scope:e,context:t}){const n=yv(e);gs(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=Un(e),r=n.index??t.get("activeIndex");gs(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||!qa(r)||ne(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||!qa(r))&&t.value&&(r=e.get("focusedValue").copy()),!r)return;r=ke(r,n("min"),n("max"));const o=Array.from(e.get("value"));o[t.index]=As(o[t.index],r);const i=Hs(o);e.set("value",i);const a=ks(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(!_e(s,e.get("startValue"),t("endValue")))return;const o=Da(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})}}}}),qn=(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 Cv(i=>{$v(i,s("minView"))&&(o=o.set({[i]:i==="day"?1:0}))}),o},As=(e,t)=>{if(!e||!("hour"in e))return t;const n="timeZone"in e;let s=t;return"hour"in t||(n?s=ml(Le(t),e.timeZone):s=Le(t)),s.set({hour:e.hour,minute:e.minute,second:e.second,millisecond:e.millisecond})};function ne(e,t){const{context:n,prop:s,computed:r}=e;if(!t)return;const o=qn(e,t);if(Et(n.get("focusedValue"),o))return;const a=is(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 Ls(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 Nv(e){return e.focusVisible??e.previousEvent?.focusVisible?{preventScroll:!0,focusVisible:!0}:{preventScroll:!0}}function jl(e){return Array.isArray(e)?e.map(t=>jl(t)):e instanceof Date?new Pe(e.getFullYear(),e.getMonth()+1,e.getDate()):Mm(e)}const eo=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>`,to=e=>{try{return/^\d{4}-\d{2}-\d{2}$/.test(e)?jl(e):void 0}catch{return}};function Fv(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>
90
+ `);return{text:$.slice(0,1800),shortened:$.length>1800||!!y.partial}}return{clear:g,show(y,$,w,M,O,R){const E=`${$}:${w}:${y.id}`,C=r!==E;C&&g(),r=E,a=y,l=O,c=R,f=M;const x=s.get(E);d(x?.text||y.preview,x?x.shortened?"Content preview":"":"Loading message…"),!(!C||x)&&(i=setTimeout(async()=>{const T=new AbortController;o=T;try{const b=await n.read($,{item:y.id,revision:w,filter:"messages"},T.signal);if(T.signal.aborted||r!==E||b.selected?.id!==y.id)return;const A=m(b.selected);s.set(E,A),s.size>20&&s.delete(s.keys().next().value),d(A.text,A.shortened?"Content preview":"")}catch{!T.signal.aborted&&r===E&&d(y.preview,"Saved excerpt · open for details")}},120))},dispose(){g(),s.clear()}}}class Kg{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 c=new AbortController,f=this.generation,u=new URLSearchParams({filter:r,...n}),h=this.request(`/api/sessiongraph/session/${encodeURIComponent(t)}/events?${u}`,{signal:AbortSignal.any([c.signal,AbortSignal.timeout(3e4)])}).then(async d=>{const m=await d.json();if(!d.ok)throw d.status===409&&this.clear(),new Error(m.error||"Could not load events.");if(c.signal.aborted||f!==this.generation)throw new DOMException("Request cancelled","AbortError");if(m.sessionID!==t||n.revision&&m.revision!==n.revision)throw new Error("Saved history changed. Reload the event explorer.");const y=JSON.stringify([t,m.revision,r,n.item,n.cursor]),$=JSON.stringify(m).length;for(this.characters-=this.pages.get(y)?.characters||0,this.pages.delete(y),this.pages.set(y,{page:m,characters:$}),this.characters+=$;this.pages.size>20||this.characters>2e6;){const w=this.pages.keys().next().value;this.characters-=this.pages.get(w).characters,this.pages.delete(w)}return m});a={controller:c,promise:h,readers:0},this.pending.set(o,a);const p=a,g=()=>{this.pending.get(o)===p&&this.pending.delete(o)};h.then(g,g)}const l=a;return l.readers++,new Promise((c,f)=>{const u=()=>{p(),f(s.reason)};let h=!1;const p=()=>{h||(h=!0,s?.removeEventListener("abort",u),--l.readers===0&&this.pending.get(o)===l&&(this.pending.delete(o),l.controller.abort()))};s?.addEventListener("abort",u,{once:!0}),l.promise.then(g=>{h||(p(),c(g))},g=>{h||(p(),f(g))})})}}function ae(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 tn(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 Es,Xt,Ie,Qt,xs,Ur,Ss;const Ta="__TAURI_TO_IPC_KEY__";function zg(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}class ry{constructor(t){Es.add(this),Xt.set(this,void 0),Ie.set(this,0),Qt.set(this,[]),xs.set(this,void 0),tn(this,Xt,t||(()=>{})),this.id=zg(n=>{const s=n.index;if("end"in n){s==ae(this,Ie,"f")?this.cleanupCallback():tn(this,xs,s);return}const r=n.message;if(s==ae(this,Ie,"f")){for(ae(this,Es,"m",Ur).call(this,r),tn(this,Ie,ae(this,Ie,"f")+1);ae(this,Ie,"f")in ae(this,Qt,"f");){const o=ae(this,Qt,"f")[ae(this,Ie,"f")];ae(this,Es,"m",Ur).call(this,o),delete ae(this,Qt,"f")[ae(this,Ie,"f")],tn(this,Ie,ae(this,Ie,"f")+1)}ae(this,Ie,"f")===ae(this,xs,"f")&&this.cleanupCallback()}else ae(this,Qt,"f")[s]=r})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(t){tn(this,Xt,t)}get onmessage(){return ae(this,Xt,"f")}[(Xt=new WeakMap,Ie=new WeakMap,Qt=new WeakMap,xs=new WeakMap,Es=new WeakSet,Ur=function(n){try{ae(this,Xt,"f").call(this,n)}catch(s){queueMicrotask(()=>{throw s})}},Ta)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[Ta]()}}async function rl(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}class oy{get rid(){return ae(this,Ss,"f")}constructor(t){Ss.set(this,void 0),tn(this,Ss,t)}async close(){return rl("plugin:resources|close",{rid:this.rid})}async[(Ss=new WeakMap,Symbol.asyncDispose)](){await this.close()}}function Zg(){return!!(globalThis||window).isTauri}async function Jg(){await rl("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 Qg='<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>',em='<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 tm(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=c=>{const f=["downloading","installing","restarting"].includes(c.phase),u=c.phase==="ready"||c.phase==="error"&&c.retry!=="download",h=c.phase==="downloading"?c.progress===void 0?"Downloading":`${c.progress}%`:c.phase==="installing"?"Installing":c.phase==="restarting"?"Restarting":u?"Restart":c.phase==="error"?"Retry update":"Update",p=c.phase==="error"?`${c.retry==="restart"?"Could not restart SessionGraph.":`Could not ${c.retry==="download"?"download or verify":"install"} the update.`} ${c.error||""} Click to try again.`:c.phase==="restarting"?`Restarting SessionGraph ${c.version}`:u?`Restart to install SessionGraph ${c.version}`:`Update to SessionGraph ${c.version}`;t.hidden=c.phase==="hidden",t.disabled=f,t.dataset.phase=c.phase,t.setAttribute("aria-busy",String(f)),t.setAttribute("aria-label",p),t.title=p;const g=`${u||c.phase==="restarting"?em:Qg}<span>${h}</span>`;t.innerHTML!==g&&(t.innerHTML=g);const d=c.phase==="hidden"?"":c.phase==="downloading"?`Downloading SessionGraph ${c.version}`:p;d!==s&&(n.textContent=d,s=d)},o=new Xg(e,r);t.addEventListener("click",()=>{o.activate()});const i=()=>{document.visibilityState==="visible"&&navigator.onLine&&o.check()},a=window.setTimeout(i,1e4),l=window.setInterval(i,240*6e4);return document.addEventListener("visibilitychange",i),window.addEventListener("online",i),{check:()=>o.check(),dispose(){clearTimeout(a),clearInterval(l),o.dispose(),t.remove(),n.remove(),document.removeEventListener("visibilitychange",i),window.removeEventListener("online",i)}}}function nm(){return Zg()?tm({async check(){const{check:e}=await No(async()=>{const{check:n}=await import("./index-CQQQn4As.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 Jg()}}):{dispose(){}}}var sm=sn("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=sm.build();function qr(e,t){return e-t*Math.floor(e/t)}const ol=1721426;function $s(e,t,n,s){t=oi(e,t);let r=t-1,o=-2;return n<=2?o=0:Ns(t)&&(o=-1),ol-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*n-362)/12+o+s)}function Ns(e){return e%4===0&&(e%100!==0||e%400===0)}function oi(e,t){return e==="BC"?1-t:t}function rm(e){let t="AD";return e<=0&&(t="BC",e=1-e),[t,e]}const om={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 pn{fromJulianDay(t){let n=t,s=n-ol,r=Math.floor(s/146097),o=qr(s,146097),i=Math.floor(o/36524),a=qr(o,36524),l=Math.floor(a/1461),c=qr(a,1461),f=Math.floor(c/365),u=r*400+i*100+l*4+f+(i!==4&&f!==4?1:0),[h,p]=rm(u),g=n-$s(h,p,1,1),d=2;n<$s(h,p,3,1)?d=0:Ns(p)&&(d=1);let m=Math.floor(((g+d)*12+373)/367),y=n-$s(h,p,m,1)+1;return new Pe(h,p,m,y)}toJulianDay(t){return $s(t.era,t.year,t.month,t.day)}getDaysInMonth(t){return om[Ns(t.year)?"leapyear":"standard"][t.month-1]}getMonthsInYear(t){return 12}getDaysInYear(t){return Ns(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 im={"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 Se(e,t){return t=de(t,e.calendar),e.era===t.era&&e.year===t.year&&e.month===t.month&&e.day===t.day}function am(e,t){return t=de(t,e.calendar),e=tt(e),t=tt(t),e.era===t.era&&e.year===t.year&&e.month===t.month}function cm(e,t){return t=de(t,e.calendar),e=es(e),t=es(t),e.era===t.era&&e.year===t.year}function lm(e,t){return Er(e.calendar,t.calendar)&&Se(e,t)}function Rn(e,t){return Er(e.calendar,t.calendar)&&am(e,t)}function Pn(e,t){return Er(e.calendar,t.calendar)&&cm(e,t)}function Er(e,t){return e.isEqual?.(t)??t.isEqual?.(e)??e.identifier===t.identifier}function dm(e,t){return Se(e,xr(t))}const um={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6};function il(e,t,n){let s=e.calendar.toJulianDay(e),r=n?um[n]:gm(t),o=Math.ceil(s+1-r)%7;return o<0&&(o+=7),o}function al(e){return nt(Date.now(),e)}function xr(e){return Bt(al(e))}function cl(e,t){return e.calendar.toJulianDay(e)-t.calendar.toJulianDay(t)}function fm(e,t){return ka(e)-ka(t)}function ka(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let Gr=null,hm=!1;function ii(){return Gr==null&&(Gr=new Intl.DateTimeFormat().resolvedOptions().timeZone),Gr}function ll(){return hm}function tt(e){return e.subtract({days:e.day-1})}function ko(e){return e.add({days:e.calendar.getDaysInMonth(e)-e.day})}function es(e){return tt(e.subtract({months:e.month-1}))}function pm(e){return ko(e.add({months:e.calendar.getMonthsInYear(e)-e.month}))}function St(e,t,n){let s=il(e,t,n);return e.subtract({days:s})}function Aa(e,t,n){return St(e,t,n).add({days:6})}const La=new Map,Yr=new Map;function dl(e){if(Intl.Locale){let n=La.get(e);return n||(n=new Intl.Locale(e).maximize().region,n&&La.set(e,n)),n}let t=e.split("-")[1];return t==="u"?void 0:t}function gm(e){let t=Yr.get(e);if(!t){if(Intl.Locale){let s=new Intl.Locale(e);if("getWeekInfo"in s&&(t=s.getWeekInfo(),t))return Yr.set(e,t),t.firstDay}let n=dl(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&&im[n]||0};Yr.set(e,t)}return t.firstDay}function mm(e,t,n){let s=e.calendar.getDaysInMonth(e);return Math.ceil((il(tt(e),t,n)+s)/7)}function ul(e,t){return e&&t?e.compare(t)<=0?e:t:e||t}function fl(e,t){return e&&t?e.compare(t)>=0?e:t:e||t}const vm={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 ym(e,t){let n=e.calendar.toJulianDay(e),s=Math.ceil(n+1)%7;s<0&&(s+=7);let r=dl(t),[o,i]=vm[r]||[6,0];return s===o||s===i}function gn(e){e=de(e,new pn);let t=oi(e.era,e.year);return hl(t,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function hl(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 Ao(e,t){if(t==="UTC")return 0;if(e>0&&t===ii()&&!ll())return new Date(e).getTimezoneOffset()*-6e4;let{year:n,month:s,day:r,hour:o,minute:i,second:a}=pl(e,t);return hl(n,s,r,o,i,a,0)-Math.floor(e/1e3)*1e3}const Oa=new Map;function pl(e,t){let n=Oa.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"}),Oa.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 Ma=864e5;function bm(e,t,n,s){return(n===s?[n]:[n,s]).filter(o=>wm(e,t,o))}function wm(e,t,n){let s=pl(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 et(e,t,n="compatible"){let s=Le(e);if(t==="UTC")return gn(s);if(t===ii()&&n==="compatible"&&!ll()){s=de(s,new pn);let l=new Date,c=oi(s.era,s.year);return l.setFullYear(c,s.month-1,s.day),l.setHours(s.hour,s.minute,s.second,s.millisecond),l.getTime()}let r=gn(s),o=Ao(r-Ma,t),i=Ao(r+Ma,t),a=bm(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 gl(e,t,n="compatible"){return new Date(et(e,t,n))}function nt(e,t){let n=Ao(e,t),s=new Date(e+n),r=s.getUTCFullYear(),o=s.getUTCMonth()+1,i=s.getUTCDate(),a=s.getUTCHours(),l=s.getUTCMinutes(),c=s.getUTCSeconds(),f=s.getUTCMilliseconds();return new ts(r<1?"BC":"AD",r<1?-r+1:r,o,i,t,n,a,l,c,f)}function Bt(e){return new Pe(e.calendar,e.era,e.year,e.month,e.day)}function Le(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 sr(e.calendar,e.era,e.year,e.month,e.day,n,s,r,o)}function de(e,t){if(Er(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,qt(s),s}function ml(e,t,n){if(e instanceof ts)return e.timeZone===t?e:xm(e,t);let s=et(e,t,n);return nt(s,t)}function Em(e){let t=gn(e)-e.offset;return new Date(t)}function xm(e,t){let n=gn(e)-e.offset;return de(nt(n,t),e.calendar)}const Vn=36e5;function Sr(e,t){let n=e.copy(),s="hour"in n?Cm(n,t):0;Lo(n,t.years||0),n.calendar.balanceYearMonth&&n.calendar.balanceYearMonth(n,e),n.month+=t.months||0,Oo(n),vl(n),n.day+=(t.weeks||0)*7,n.day+=t.days||0,n.day+=s,Sm(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 Lo(e,t){e.calendar.isInverseEra?.(e)&&(t=-t),e.year+=t}function Oo(e){for(;e.month<1;)Lo(e,-1),e.month+=e.calendar.getMonthsInYear(e);let t=0;for(;e.month>(t=e.calendar.getMonthsInYear(e));)e.month-=t,Lo(e,1)}function Sm(e){for(;e.day<1;)e.month--,Oo(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,Oo(e)}function vl(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 qt(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),vl(e)}function yl(e){let t={};for(let n in e)typeof e[n]=="number"&&(t[n]=-e[n]);return t}function bl(e,t){return Sr(e,yl(t))}function ai(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),qt(n),n}function nr(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),Im(n),n}function $m(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=Is(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=Is(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=Is(e.minute,60);let t=Math.floor(e.hour/24);return e.hour=Is(e.hour,24),t}function Im(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 Is(e,t){let n=e%t;return n<0&&(n+=t),n}function Cm(e,t){return e.hour+=t.hours||0,e.minute+=t.minutes||0,e.second+=t.seconds||0,e.millisecond+=t.milliseconds||0,$m(e)}function ci(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=st(i,n,0,o.length-1,s?.round),r.era=o[i],qt(r);break}case"year":r.calendar.isInverseEra?.(r)&&(n=-n),r.year=st(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=st(e.month,n,1,e.calendar.getMonthsInYear(e),s?.round);break;case"day":r.day=st(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),qt(r),r}function wl(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 l=o>=12;i=l?12:0,a=l?23:11}r.hour=st(o,n,i,a,s?.round);break}case"minute":r.minute=st(e.minute,n,0,59,s?.round);break;case"second":r.second=st(e.second,n,0,59,s?.round);break;case"millisecond":r.millisecond=st(e.millisecond,n,0,999,s?.round);break;default:throw new Error("Unsupported field "+t)}return r}function st(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 El(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=Sr(Le(e),{years:t.years,months:t.months,weeks:t.weeks,days:t.days});n=et(r,e.timeZone)}else n=gn(e)-e.offset;n+=t.milliseconds||0,n+=(t.seconds||0)*1e3,n+=(t.minutes||0)*6e4,n+=(t.hours||0)*36e5;let s=nt(n,e.timeZone);return de(s,e.calendar)}function Tm(e,t){return El(e,yl(t))}function km(e,t,n,s){switch(t){case"hour":{let r=0,o=23;if(s?.hourCycle===12){let g=e.hour>=12;r=g?12:0,o=g?23:11}let i=Le(e),a=de(nr(i,{hour:r}),new pn),l=[et(a,e.timeZone,"earlier"),et(a,e.timeZone,"later")].filter(g=>nt(g,e.timeZone).day===a.day)[0],c=de(nr(i,{hour:o}),new pn),f=[et(c,e.timeZone,"earlier"),et(c,e.timeZone,"later")].filter(g=>nt(g,e.timeZone).day===c.day).pop(),u=gn(e)-e.offset,h=Math.floor(u/Vn),p=u%Vn;return u=st(h,n,Math.floor(l/Vn),Math.floor(f/Vn),s?.round)*Vn+p,de(nt(u,e.timeZone),e.calendar)}case"minute":case"second":case"millisecond":return wl(e,t,n,s);case"era":case"year":case"month":case"day":{let r=ci(Le(e),t,n,s),o=et(r,e.timeZone);return de(nt(o,e.timeZone),e.calendar)}default:throw new Error("Unsupported field "+t)}}function Am(e,t,n){let s=Le(e),r=nr(ai(s,t),t);if(r.compare(s)===0)return e;let o=et(r,e.timeZone,n);return de(nt(o,e.timeZone),e.calendar)}const Lm=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,Om=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function Mm(e){let t=e.match(Lm);if(!t)throw Om.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(Kr(t[1],0,9999),Kr(t[2],1,12),1);return n.day=Kr(t[3],1,n.calendar.getDaysInMonth(n)),n}function Kr(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 Dm(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 xl(e){let t=de(e,new pn),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 Sl(e){return`${xl(e)}T${Dm(e)}`}function Rm(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 Pm(e){return`${Sl(e)}${Rm(e.offset)}[${e.timeZone}]`}function li(e){let t=typeof e[0]=="object"?e.shift():new pn,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]=li(t);this.calendar=n,this.era=s,this.year=r,this.month=o,this.day=i,qt(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 Sr(this,t)}subtract(t){return bl(this,t)}set(t){return ai(this,t)}cycle(t,n,s){return ci(this,t,n,s)}toDate(t){return gl(this,t)}toString(){return xl(this)}compare(t){return cl(this,t)}}class sr{#e;constructor(...t){let[n,s,r,o,i]=li(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,qt(this)}copy(){return this.era?new sr(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new sr(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(t){return Sr(this,t)}subtract(t){return bl(this,t)}set(t){return ai(nr(this,t),t)}cycle(t,n,s){switch(t){case"era":case"year":case"month":case"day":return ci(this,t,n,s);default:return wl(this,t,n,s)}}toDate(t,n){return gl(this,t,n)}toString(){return Sl(this)}compare(t){let n=cl(this,t);return n===0?fm(this,Le(t)):n}}class ts{#e;constructor(...t){let[n,s,r,o,i]=li(t),a=t.shift(),l=t.shift();this.calendar=n,this.era=s,this.year=r,this.month=o,this.day=i,this.timeZone=a,this.offset=l,this.hour=t.shift()||0,this.minute=t.shift()||0,this.second=t.shift()||0,this.millisecond=t.shift()||0,qt(this)}copy(){return this.era?new ts(this.calendar,this.era,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond):new ts(this.calendar,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond)}add(t){return El(this,t)}subtract(t){return Tm(this,t)}set(t,n){return Am(this,t,n)}cycle(t,n,s){return km(this,t,n,s)}toDate(){return Em(this)}toString(){return Pm(this)}toAbsoluteString(){return this.toDate().toISOString()}compare(t){return this.toDate().getTime()-ml(t,this.timeZone).toDate().getTime()}}let zr=new Map;class Ae{constructor(t,n={}){this.formatter=$l(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 Fm()&&(this.resolvedHourCycle||(this.resolvedHourCycle=Hm(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 Vm={true:{ja:"h11"},false:{}};function $l(e,t={}){if(typeof t.hour12=="boolean"&&Nm()){t={...t};let r=Vm[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(zr.has(n))return zr.get(n);let s=new Intl.DateTimeFormat(e,t);return zr.set(n,s),s}let Zr=null;function Nm(){return Zr==null&&(Zr=new Intl.DateTimeFormat("en-US",{hour:"numeric",hour12:!1}).format(new Date(2020,2,3,0))==="24"),Zr}let Jr=null;function Fm(){return Jr==null&&(Jr=new Intl.DateTimeFormat("fr",{hour:"numeric",hour12:!1}).resolvedOptions().hourCycle==="h12"),Jr}function Hm(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=$l(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 _m(e,t,n,s,r){const o={};for(let a in t){const l=a,c=t[l];c!=null&&(o[l]=Math.floor(c/2),o[l]>0&&c%2===0&&o[l]--)}const i=Kt(e,t,n).subtract(o);return os(e,i,t,n,s,r)}function Kt(e,t,n,s,r){let o=e;return t.years?o=es(e):t.months?o=tt(e):t.weeks&&(o=St(e,n)),os(e,o,t,n,s,r)}function di(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=Kt(e,t,n).subtract(o);return os(e,i,t,n,s,r)}function os(e,t,n,s,r,o){return r&&e.compare(r)>=0&&(t=fl(t,Kt(Bt(r),n,s))),o&&e.compare(o)<=0&&(t=ul(t,di(Bt(o),n,s))),t}function ke(e,t,n){const s=Bt(e),r=t?Bt(t):void 0,o=n?Bt(n):void 0;let i=s;return r&&(i=fl(i,r)),o&&(i=ul(i,o)),i.compare(s)===0?e:"hour"in e?e.set({year:i.year,month:i.month,day:i.day}):i}function Da(e,t,n,s,r,o){switch(t){case"start":return Kt(e,n,s,r,o);case"end":return di(e,n,s,r,o);default:return _m(e,n,s,r,o)}}function Et(e,t){return e==null||t==null?e===t:!("hour"in e)&&!("hour"in t)?Se(e,t):Le(e).compare(Le(t))===0}function Ra(e,t,n,s,r){return e?t?.(e,n)?!0:_e(e,s,r):!1}function _e(e,t,n){return t!=null&&e.compare(t)<0||n!=null&&e.compare(n)>0}function Bm(e,t,n){const s=e.subtract({days:1});return Se(s,e)||_e(s,t,n)}function jm(e,t,n){const s=e.add({days:1});return Se(s,e)||_e(s,t,n)}function ui(e){let t={...e};for(let n in t)t[n]=1;return t}function Il(e,t){let n={...t};return n.days?n.days--:n.days=-1,e.add(n)}function Cl(e){if(!e)return;const t=e.calendar.identifier;return t==="gregory"||t==="iso8601"?e.era==="BC"?"short":void 0:"short"}function Tl(e,t,n){const s=n??Le(xr(t));return new Ae(e,{weekday:"long",month:"long",year:"numeric",day:"numeric",era:Cl(s),calendar:s.calendar.identifier,timeZone:t})}function Pa(e,t,n){const s=n??xr(t);return new Ae(e,{month:"long",year:"numeric",era:Cl(s),calendar:s.calendar.identifier,timeZone:t})}function Wm(e,t,n,s,r){let o=n.formatRangeToParts(e.toDate(r),t.toDate(r)),i=-1;for(let c=0;c<o.length;c++){let f=o[c];if(f.source==="shared"&&f.type==="literal")i=c;else if(f.source==="endRange")break}let a="",l="";for(let c=0;c<o.length;c++)c<i?a+=o[c].value:c>i&&(l+=o[c].value);return s(a,l)}function Cs(e,t,n,s){if(!e)return"";let r=e,o=t??e,i=Tl(n,s);return Se(r,o)?i.format(r.toDate(s)):Wm(r,o,i,(a,l)=>`${a} – ${l}`,s)}var Um=["sun","mon","tue","wed","thu","fri","sat"];function kl(e){return e!=null?Um[e]:void 0}function Al(e,t,n){const s=kl(n);return St(e,t,s)}function Ll(e,t,n,s){const r=t.add({weeks:e}),o=[];let i=Al(r,n,s);for(;o.length<7;){o.push(i);let a=i.add({days:1});if(Se(i,a))break;i=a}return o}function qm(e,t,n,s){const r=kl(s),o=n??mm(e,t,r);return[...new Array(o).keys()].map(a=>Ll(a,e,t,s))}function Gm(e,t){const n=new Ae(e,{weekday:"long",timeZone:t}),s=new Ae(e,{weekday:"short",timeZone:t}),r=new Ae(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=Al(e,s,t),o=[...new Array(7).keys()],i=Gm(s,n);return o.map(a=>i(r.add({days:a})))}function Km(e,t="long",n){if(!n||n.calendar.identifier==="gregory"||n.calendar.identifier==="iso8601"){const i=new Date(2021,0,1),a=[];for(let l=0;l<12;l++)a.push(i.toLocaleString(e,{month:t})),i.setMonth(i.getMonth()+1);return a}const s=n.calendar.getMonthsInYear(n),r=new Ae(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 Va(e,t){const n=St(e,t,"mon"),s=n.year,r=n.set({month:1,day:4}),o=St(r,t,"mon"),i=n.calendar.toJulianDay(n),a=o.calendar.toJulianDay(o);if(i>=a)return 1+Math.floor((i-a)/7);const l=n.set({year:s-1,month:1,day:4}),c=St(l,t,"mon"),f=c.calendar.toJulianDay(c);return 1+Math.floor((i-f)/7)}function zm(e){const t=[];for(let n=e.from;n<=e.to;n+=1)t.push(n);return t}var Zm=1900,Jm=2099;function Xm(e,t,n){const s=e.calendar,r=t?.year??de(new Pe(Zm,1,1),s).year,o=n?.year??de(new Pe(Jm,12,31),s).year;return{from:r,to:o}}var Qm=10;function ev(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+Qm?(r-100).toString():r.toString()}return e}}function cn(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 zn(e,t){const n=xr(e??ii());return t?de(n,t):n}function is(e,t,n,s){return function(o){const{startDate:i,focusedDate:a}=o,l=Il(i,e);return _e(a,n,s)?{startDate:i,focusedDate:ke(a,n,s),endDate:l}:a.compare(i)<0?{startDate:di(a,e,t,n,s),focusedDate:ke(a,n,s),endDate:l}:a.compare(l)>0?{startDate:Kt(a,e,t,n,s),endDate:l,focusedDate:ke(a,n,s)}:{startDate:i,endDate:l,focusedDate:ke(a,n,s)}}}function Ol(e,t,n,s,r,o){const i=is(n,s,r,o),a=t.add(n);return i({focusedDate:e.add(n),startDate:Kt(os(e,a,n,s,r,o),n,s)})}function Ml(e,t,n,s,r,o){const i=is(n,s,r,o);let a=t.subtract(n);return i({focusedDate:e.subtract(n),startDate:Kt(os(e,a,n,s,r,o),n,s)})}function tv(e,t,n,s,r,o,i){const a=is(s,r,o,i);if(!n&&!s.days)return a({focusedDate:e.add(ui(s)),startDate:t});if(s.days)return Ol(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 nv(e,t,n,s,r,o,i){const a=is(s,r,o,i);if(!n&&!s.days)return a({focusedDate:e.subtract(ui(s)),startDate:t});if(s.days)return Ml(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 Na=new Map;function sv(e){let t=Na.get(e);return t!=null||(t="0123456789"+new Intl.NumberFormat(e,{useGrouping:!1}).format(1234567890),Na.set(e,t)),t}var rv=(e,t)=>t?sv(t).includes(e):/\d/.test(e),Dl=(e,t,n)=>!e||e.length!==1?!0:rv(e,n)||t.includes(e),ov=(e,t,n)=>e.split("").filter(s=>Dl(s,t,n)).join(""),Fa=new Map;function iv(e){let t=Fa.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:"/",Fa.set(e,t),t}var Ha=e=>e!=null&&e.length===4,av=e=>e!=null&&parseFloat(e)<=12,cv=e=>e!=null&&parseFloat(e)<=31;function lv(e,t,n){const s=dv(t,n);let{year:r,month:o,day:i}=uv(s,e)??{};if(r!=null||o!=null||i!=null){const c=new Date;r||(r=c.getFullYear().toString()),o||(o=(c.getMonth()+1).toString()),i||(i=c.getDate().toString())}if(Ha(r)||(r=ev(r)),Ha(r)&&av(o)&&cv(i))return new Pe(+r,+o,+i);const l=Date.parse(e);if(!isNaN(l)){const c=new Date(l);return new Pe(c.getFullYear(),c.getMonth()+1,c.getDate())}}function dv(e,t){return new Ae(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 uv(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 _a(e,t,n){const s=Bt(al(n));switch(e){case"thisWeek":return[St(s,t),Aa(s,t)];case"thisMonth":return[tt(s),s];case"thisQuarter":return[tt(s).add({months:-((s.month-1)%3)}),s];case"thisYear":return[es(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[tt(s.add({months:-1})),ko(s.add({months:-1}))];case"lastQuarter":return[tt(s.add({months:-((s.month-1)%3)-3})),ko(s.add({months:-((s.month-1)%3)-1}))];case"lastWeek":return[St(s,t).add({weeks:-1}),Aa(s,t).add({weeks:-1})];case"lastYear":return[es(s.add({years:-1})),pm(s.add({years:-1}))];default:throw new Error(`Invalid date range preset: ${e}`)}}var fv=(e,t)=>e.ids?.label?.(t)??`datepicker:${e.id}:label:${t}`,hv=e=>e.ids?.root??`datepicker:${e.id}`,pv=(e,t)=>e.ids?.table?.(t)??`datepicker:${e.id}:table:${t}`,Mo=e=>e.ids?.content??`datepicker:${e.id}:content`,Xr=(e,t)=>e.ids?.cellTrigger?.(t)??`datepicker:${e.id}:cell-trigger:${t}`,gv=(e,t)=>e.ids?.prevTrigger?.(t)??`datepicker:${e.id}:prev:${t}`,mv=(e,t)=>e.ids?.nextTrigger?.(t)??`datepicker:${e.id}:next:${t}`,vv=(e,t)=>e.ids?.viewTrigger?.(t)??`datepicker:${e.id}:view:${t}`,Rl=e=>e.ids?.clearTrigger??`datepicker:${e.id}:clear`,Pl=e=>e.ids?.control??`datepicker:${e.id}:control`,Ba=(e,t)=>e.ids?.input?.(t)??`datepicker:${e.id}:input:${t}`,Vl=e=>e.ids?.trigger??`datepicker:${e.id}:trigger`,Nl=e=>e.ids?.positioner??`datepicker:${e.id}:positioner`,Fl=e=>e.ids?.monthSelect??`datepicker:${e.id}:month-select`,Hl=e=>e.ids?.yearSelect??`datepicker:${e.id}:year-select`,ja=(e,t)=>Tf(nn(e),`[data-part=table-cell-trigger][data-view=${t}][data-focus]:not([data-outside-range])`),Fs=e=>e.getById(Vl(e)),nn=e=>e.getById(Mo(e)),Un=e=>Cf(_l(e),"[data-part=input]"),yv=e=>e.getById(Hl(e)),bv=e=>e.getById(Fl(e)),wv=e=>e.getById(Rl(e)),Wa=e=>e.getById(Nl(e)),_l=e=>e.getById(Pl(e)),Ua=e=>{const t=Un(e);if(t.length===0){Fs(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 Hs(e){const[t,n]=e;let s;return!t||!n?s=e:s=t.compare(n)<=0?e:[n,t],s}function en(e,t){const[n,s]=t;return!n||!s?!1:n.compare(e)<=0&&s.compare(e)>=0}function Ts(e){return e.slice().filter(t=>t!=null).sort((t,n)=>t.compare(n))}function Ev(e,t){return new Ae(e).formatToParts(new Date).map(n=>t[n.type]??n.value).join("")}var qa=e=>!Number.isNaN(e.day)&&!Number.isNaN(e.month)&&!Number.isNaN(e.year),xv={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 oo(e,{year:"Switch to previous decade",month:"Switch to previous year",day:"Switch to previous month"})},nextTrigger(e){return oo(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 it(e,t){return e?e==="day"?0:e==="month"?1:2:t||0}function fi(e){return e===0?"day":e===1?"month":"year"}function hi(e,t,n){return fi(mu(it(e,0),it(t,0),it(n,2)))}function Sv(e,t){return it(e,0)>it(t,0)}function $v(e,t){return it(e,0)<it(t,0)}function Bl(e,t,n){const s=it(e,0)+1;return hi(fi(s),t,n)}function Iv(e,t,n){const s=it(e,0)-1;return hi(fi(s),t,n)}var Cv=["day","month","year"];function Tv(e){Cv.forEach(t=>e(t))}var kv=Ip(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=cn(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 Ae(r,{year:"numeric",timeZone:o,calendar:n.calendar.identifier}),h=u.format(n.toDate(o)),p=u.format(s.toDate(o)),g=i==="range"?`${h} - ${p}`:h;return{start:h,end:p,formatted:g}}const a=new Ae(r,{month:"long",year:"numeric",timeZone:o,calendar:n.calendar.identifier}),l=a.format(n.toDate(o)),c=a.format(s.toDate(o)),f=i==="range"?`${l} - ${c}`:l;return{start:l,end:c,formatted:f}});function Av(e,t){const{state:n,context:s,prop:r,send:o,computed:i,scope:a}=e,l=s.get("startValue"),c=i("endValue"),f=s.get("value"),u=s.get("focusedValue"),h=s.get("hoveredValue"),p=h?Hs([f[0],h]):[],g=!!r("disabled"),d=!!r("readOnly"),m=!!r("invalid"),y=i("isInteractive"),$=f.length===0,w=r("min"),M=r("max"),O=r("locale"),R=r("timeZone"),E=r("startOfWeek"),C=n.matches("focused"),x=n.matches("open"),T=r("selectionMode")==="range",b=r("selectionMode")==="multiple",A=r("isDateUnavailable"),D=r("maxSelectedDates"),V=b&&D!=null&&f.length>=D,H=s.get("currentPlacement"),z=H?Pc(H):void 0,re=Vc({...r("positioning"),placement:H}),Z=iv(O),W=ic(xv,r("translations"));function be(L=l){const S=r("fixedWeeks")?6:void 0;return qm(L,O,S,E)}function Mt(L={}){const{format:S}=L;return Km(O,S,u).map((v,I)=>{const F=I+1,Q=u.set({month:F}),U=_e(Q,w,M);return{label:v,value:F,disabled:U}})}function $e(){const L=Xm(u,w,M);return zm(L).map(v=>({label:v.toString(),value:v,disabled:!Or(v,w?.year,M?.year)}))}function Ke(L){return Ra(L,A,O,w,M)}function Dt(L){const S=l??zn(R,u.calendar);o({type:"FOCUS.SET",value:S.set({month:L})})}function Zt(L){const S=l??zn(R,u.calendar);o({type:"FOCUS.SET",value:S.set({year:L})})}function vt(L){const{value:S,disabled:v}=L,I=u.set({year:S}),Q=!cn(l.year).includes(S),U=Or(S,w?.year,M?.year),G=T&&en(I,f),ce=T&&f[0]&&Pn(I,f[0]),De=T&&f[1]&&Pn(I,f[1]),Ne=T&&p.length>0,ie=Ne&&en(I,p),Fe=Ne&&p[0]&&Pn(I,p[0]),He=Ne&&p[1]&&Pn(I,p[1]),ds={focused:u.year===L.value,selectable:U,outsideRange:Q,selected:!!f.find(us=>us&&us.year===S),valueText:S.toString(),inRange:G||ie,firstInRange:!!ce,lastInRange:!!De,inHoveredRange:!!ie,firstInHoveredRange:!!Fe,lastInHoveredRange:!!He,value:I,get disabled(){return v||!ds.selectable}};return ds}function Rt(L){const{value:S,disabled:v}=L,I=u.set({month:S}),F=Pa(O,R,u),Q=T&&en(I,f),U=T&&f[0]&&Rn(I,f[0]),G=T&&f[1]&&Rn(I,f[1]),ce=T&&p.length>0,De=ce&&en(I,p),Ne=ce&&p[0]&&Rn(I,p[0]),ie=ce&&p[1]&&Rn(I,p[1]),Fe={focused:u.month===L.value,selectable:!_e(I,w,M),selected:!!f.find(He=>He&&He.month===S&&He.year===u.year),valueText:F.format(I.toDate(R)),inRange:Q||De,firstInRange:!!U,lastInRange:!!G,inHoveredRange:!!De,firstInHoveredRange:!!Ne,lastInHoveredRange:!!ie,outsideRange:!1,value:I,get disabled(){return v||!Fe.selectable}};return Fe}function yt(L){const{value:S,disabled:v,visibleRange:I=i("visibleRange")}=L,F=Tl(O,R,u),Q=ui(i("visibleDuration")),U=r("outsideDaySelectable"),G=I.start.add(Q).subtract({days:1}),ce=_e(S,I.start,G),De=T&&en(S,f),Ne=T&&f[0]&&Se(S,f[0]),ie=T&&f[1]&&Se(S,f[1]),Fe=T&&p.length>0,He=Fe&&en(S,p),ds=Fe&&p[0]&&Se(S,p[0]),us=Fe&&p[1]&&Se(S,p[1]),ki=f.some(Ai=>Ai!=null&&Se(S,Ai)),fs={invalid:_e(S,w,M),disabled:v||!U&&ce||_e(S,w,M)||V&&!ki,selected:ki,unavailable:Ra(S,A,O,w,M)&&!v,outsideRange:ce,today:dm(S,R),weekend:ym(S,O),value:S,valueText:F.format(S.toDate(R)),get focused(){return u!=null&&Se(S,u)&&(!fs.outsideRange||U)},get selectable(){return!fs.disabled&&!fs.unavailable},inRange:De||He,firstInRange:Ne,lastInRange:ie,inHoveredRange:He,firstInHoveredRange:ds,lastInHoveredRange:us};return fs}function $n(L){const{view:S="day",id:v}=L;return[S,v].filter(Boolean).join(" ")}return{focused:C,open:x,disabled:g,invalid:m,readOnly:d,inline:!!r("inline"),numOfMonths:r("numOfMonths"),showWeekNumbers:!!r("showWeekNumbers"),selectionMode:r("selectionMode"),maxSelectedDates:D,isMaxSelected:V,view:s.get("view"),getRangePresetValue(L){return _a(L,O,R)},getWeekNumber(L){const S=L[0];return S?Va(S,O):0},getDaysInWeek(L,S=l){return Ll(L,S,O,E)},getOffset(L){const S=l.add(L),v=c.add(L),I=Pa(O,R,u);return{visibleRange:{start:S,end:v},weeks:be(S),visibleRangeText:{start:I.format(S.toDate(R)),end:I.format(v.toDate(R))}}},getMonthWeeks:be,isUnavailable:Ke,weeks:be(),weekDays:Ym(l,E,R,O),visibleRangeText:i("visibleRangeText"),value:f,valueAsDate:f.filter(L=>L!=null).map(L=>L.toDate(R)),valueAsString:i("valueAsString"),focusedValue:u,focusedValueAsDate:u?.toDate(R),focusedValueAsString:r("format")(u,{locale:O,timeZone:R}),visibleRange:i("visibleRange"),selectToday(){const L=ke(zn(R,u.calendar),w,M);o({type:"VALUE.SET",value:[L]})},setValue(L){const S=L.map(v=>ke(v,w,M));o({type:"VALUE.SET",value:S})},setTime(L,S=0){const v=Array.from(f);let I=v[S];I&&("hour"in I||(I=Le(I)),I=I.set({hour:L.hour??("hour"in I?I.hour:0),minute:L.minute??("minute"in I?I.minute:0),second:L.second??("second"in I?I.second:0),millisecond:L.millisecond??("millisecond"in I?I.millisecond:0)}),v[S]=ke(I,w,M),o({type:"VALUE.SET",value:v}))},clearValue(L={}){const{focus:S=!0}=L;o({type:"VALUE.CLEAR",focus:S})},setFocusedValue(L){o({type:"FOCUS.SET",value:L})},setOpen(L){r("inline")||o({type:L?"OPEN":"CLOSE",replaces:"open"})},focusMonth:Dt,focusYear:Zt,getYears:$e,getMonths:Mt,getYearsGrid(L={}){const{columns:S=1}=L,v=cn(l.year).map(I=>({label:I.toString(),value:I,disabled:!Or(I,w?.year,M?.year)}));return Pi(v,S)},getDecade(){const L=cn(l.year);return{start:L.at(0),end:L.at(-1)}},getMonthsGrid(L={}){const{columns:S=1,format:v}=L;return Pi(Mt({format:v}),S)},format(L,S={month:"long",year:"numeric"}){return new Ae(O,{...S,calendar:L.calendar.identifier}).format(L.toDate(R))},setView(L){o({type:"VIEW.SET",view:L})},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:hv(a),"data-state":x?"open":"closed","data-disabled":P(g),"data-readonly":P(d),"data-empty":P($)})},getLabelProps(L={}){const{index:S=0}=L;return t.label({...J.label.attrs,id:fv(a,S),dir:r("dir"),htmlFor:Ba(a,S),"data-state":x?"open":"closed","data-index":S,"data-disabled":P(g),"data-readonly":P(d),"data-invalid":P(m)})},getControlProps(){return t.element({...J.control.attrs,dir:r("dir"),id:Pl(a),"data-disabled":P(g),"data-placeholder-shown":P($),"data-invalid":P(m)})},getRangeTextProps(){return t.element({...J.rangeText.attrs,dir:r("dir")})},getContentProps(){return t.element({...J.content.attrs,hidden:!x,dir:r("dir"),"data-state":x?"open":"closed","data-placement":H,"data-side":z,"data-inline":P(r("inline")),id:Mo(a),tabIndex:-1,role:"application","aria-label":W.content})},getTableProps(L={}){const{view:S="day",columns:v=S==="day"?7:4}=L,I=$n(L);return t.element({...J.table.attrs,role:"grid","data-columns":v,"aria-label":i("visibleRangeText").formatted,id:pv(a,I),"aria-readonly":he(d),"aria-disabled":he(g),"aria-multiselectable":he(r("selectionMode")!=="single"),"data-view":S,dir:r("dir"),tabIndex:-1,onKeyDown(F){if(F.defaultPrevented||g)return;const Q={Enter(){y&&(S==="day"&&Ke(u)||S==="month"&&!Rt({value:u.month}).selectable||S==="year"&&!vt({value:u.year}).selectable||o({type:"TABLE.ENTER",view:S,columns:v,focus:!0}))},Space(G){Q.Enter?.()},ArrowLeft(){o({type:"TABLE.ARROW_LEFT",view:S,columns:v,focus:!0})},ArrowRight(){o({type:"TABLE.ARROW_RIGHT",view:S,columns:v,focus:!0})},ArrowUp(){o({type:"TABLE.ARROW_UP",view:S,columns:v,focus:!0})},ArrowDown(){o({type:"TABLE.ARROW_DOWN",view:S,columns:v,focus:!0})},PageUp(G){o({type:"TABLE.PAGE_UP",larger:G.shiftKey,view:S,columns:v,focus:!0})},PageDown(G){o({type:"TABLE.PAGE_DOWN",larger:G.shiftKey,view:S,columns:v,focus:!0})},Home(){o({type:"TABLE.HOME",view:S,columns:v,focus:!0})},End(){o({type:"TABLE.END",view:S,columns:v,focus:!0})}},U=Q[ao(F,{dir:r("dir")})];U&&(U(F),F.preventDefault(),F.stopPropagation())},onPointerLeave(){o({type:"TABLE.POINTER_LEAVE"})},onPointerDown(){o({type:"TABLE.POINTER_DOWN",view:S})},onPointerUp(){o({type:"TABLE.POINTER_UP",view:S})}})},getTableHeadProps(L={}){const{view:S="day"}=L;return t.element({...J.tableHead.attrs,"aria-hidden":!0,dir:r("dir"),"data-view":S,"data-disabled":P(g)})},getTableHeaderProps(L={}){const{view:S="day"}=L;return t.element({...J.tableHeader.attrs,dir:r("dir"),"data-view":S,"data-disabled":P(g)})},getTableBodyProps(L={}){const{view:S="day"}=L;return t.element({...J.tableBody.attrs,"data-view":S,"data-disabled":P(g)})},getTableRowProps(L={}){const{view:S="day"}=L;return t.element({...J.tableRow.attrs,"aria-disabled":he(g),"data-disabled":P(g),"data-view":S})},getWeekNumberHeaderCellProps(L={}){const{view:S="day"}=L;return t.element({...J.tableCell.attrs,scope:"col","aria-label":W.weekColumnHeader,"data-view":S,"data-type":"week-number","data-disabled":P(g)})},getWeekNumberCellProps(L){const{weekIndex:S,week:v}=L,I=v[0]?Va(v[0],O):0;return t.element({...J.tableCell.attrs,role:"rowheader","aria-label":W.weekNumberCell?.(I),"data-view":"day","data-week-index":S,"data-type":"week-number","data-disabled":P(g)})},getDayTableCellState:yt,getDayTableCellProps(L){const{value:S}=L,v=yt(L);return t.element({...J.tableCell.attrs,role:"gridcell","aria-disabled":he(!v.selectable),"aria-selected":v.selected||v.inRange,"aria-invalid":he(v.invalid),"aria-current":v.today?"date":void 0,"data-value":S.toString()})},getDayTableCellTriggerProps(L){const{value:S}=L,v=yt(L);return t.element({...J.tableCellTrigger.attrs,id:Xr(a,S.toString()),role:"button",dir:r("dir"),tabIndex:g?-1:v.focused?0:-1,"aria-label":W.dayCell(v),"aria-disabled":he(!v.selectable),"aria-invalid":he(v.invalid),"data-disabled":P(!v.selectable),"data-selectable":P(v.selectable),"data-selected":P(v.selected),"data-value":S.toString(),"data-view":"day","data-today":P(v.today),"data-focus":P(v.focused),"data-unavailable":P(v.unavailable),"data-range-start":P(v.firstInRange),"data-range-end":P(v.lastInRange),"data-in-range":P(v.inRange),"data-outside-range":P(v.outsideRange),"data-weekend":P(v.weekend),"data-in-hover-range":P(v.inHoveredRange),"data-hover-range-start":P(v.firstInHoveredRange),"data-hover-range-end":P(v.lastInHoveredRange),onClick(I){I.defaultPrevented||y&&v.selectable&&o({type:"CELL.CLICK",cell:"day",value:S})},onPointerMove:T?I=>{if(I.pointerType==="touch"||!v.selectable)return;const F=!a.isActiveElement(I.currentTarget);h&&lm(S,h)||o({type:"CELL.POINTER_MOVE",cell:"day",value:S,focus:F,outsideRange:v.outsideRange})}:void 0})},getMonthTableCellState:Rt,getMonthTableCellProps(L){const{value:S,columns:v}=L,I=Rt(L);return t.element({...J.tableCell.attrs,dir:r("dir"),colSpan:v,role:"gridcell","aria-selected":he(I.selected||I.inRange),"data-selected":P(I.selected),"aria-disabled":he(!I.selectable),"data-value":S})},getMonthTableCellTriggerProps(L){const{value:S}=L,v=Rt(L);return t.element({...J.tableCellTrigger.attrs,id:Xr(a,S.toString()),role:"button",dir:r("dir"),tabIndex:g?-1:v.focused?0:-1,"aria-label":v.valueText,"aria-disabled":he(!v.selectable),"data-disabled":P(!v.selectable),"data-selectable":P(v.selectable),"data-selected":P(v.selected),"data-value":S,"data-view":"month","data-focus":P(v.focused),"data-outside-range":P(v.outsideRange),"data-range-start":P(v.firstInRange),"data-range-end":P(v.lastInRange),"data-in-range":P(v.inRange),"data-in-hover-range":P(v.inHoveredRange),"data-hover-range-start":P(v.firstInHoveredRange),"data-hover-range-end":P(v.lastInHoveredRange),onClick(I){I.defaultPrevented||y&&v.selectable&&o({type:"CELL.CLICK",cell:"month",value:S})},onPointerMove:T?I=>{if(I.pointerType==="touch"||!v.selectable)return;const F=!a.isActiveElement(I.currentTarget);h&&v.value&&Rn(v.value,h)||o({type:"CELL.POINTER_MOVE",cell:"month",value:v.value,focus:F})}:void 0})},getYearTableCellState:vt,getYearTableCellProps(L){const{value:S,columns:v}=L,I=vt(L);return t.element({...J.tableCell.attrs,dir:r("dir"),colSpan:v,role:"gridcell","aria-selected":he(I.selected||I.inRange),"data-selected":P(I.selected),"aria-disabled":he(!I.selectable),"data-value":S})},getYearTableCellTriggerProps(L){const{value:S}=L,v=vt(L);return t.element({...J.tableCellTrigger.attrs,id:Xr(a,S.toString()),role:"button",dir:r("dir"),tabIndex:g?-1:v.focused?0:-1,"aria-label":v.valueText,"aria-disabled":he(!v.selectable),"data-disabled":P(!v.selectable),"data-selectable":P(v.selectable),"data-selected":P(v.selected),"data-value":S,"data-view":"year","data-focus":P(v.focused),"data-outside-range":P(v.outsideRange),"data-range-start":P(v.firstInRange),"data-range-end":P(v.lastInRange),"data-in-range":P(v.inRange),"data-in-hover-range":P(v.inHoveredRange),"data-hover-range-start":P(v.firstInHoveredRange),"data-hover-range-end":P(v.lastInHoveredRange),onClick(I){I.defaultPrevented||y&&v.selectable&&o({type:"CELL.CLICK",cell:"year",value:S})},onPointerMove:T?I=>{if(I.pointerType==="touch"||!v.selectable||v.outsideRange)return;const F=!a.isActiveElement(I.currentTarget);h&&v.value&&Pn(v.value,h)||o({type:"CELL.POINTER_MOVE",cell:"year",value:v.value,focus:F})}:void 0})},getNextTriggerProps(L={}){const{view:S="day"}=L,v=g||!i("isNextVisibleRangeValid");return t.button({...J.nextTrigger.attrs,dir:r("dir"),id:mv(a,S),type:"button","aria-label":W.nextTrigger(S),disabled:v,"data-disabled":P(v),onClick(I){I.defaultPrevented||o({type:"GOTO.NEXT",view:S})}})},getPrevTriggerProps(L={}){const{view:S="day"}=L,v=g||!i("isPrevVisibleRangeValid");return t.button({...J.prevTrigger.attrs,dir:r("dir"),id:gv(a,S),type:"button","aria-label":W.prevTrigger(S),disabled:v,"data-disabled":P(v),onClick(I){I.defaultPrevented||o({type:"GOTO.PREV",view:S})}})},getClearTriggerProps(){return t.button({...J.clearTrigger.attrs,id:Rl(a),dir:r("dir"),type:"button","aria-label":W.clearTrigger,hidden:!f.length,onClick(L){L.defaultPrevented||y&&o({type:"VALUE.CLEAR"})}})},getTriggerProps(){return t.button({...J.trigger.attrs,id:Vl(a),dir:r("dir"),type:"button","data-placement":H,"data-side":z,"aria-label":W.trigger(x),"aria-controls":Mo(a),"aria-expanded":x,"data-state":x?"open":"closed","data-placeholder-shown":P($),"aria-haspopup":"grid",disabled:g,onClick(L){L.defaultPrevented||y&&o({type:"TRIGGER.CLICK"})}})},getViewProps(L={}){const{view:S="day"}=L;return t.element({...J.view.attrs,"data-view":S,hidden:s.get("view")!==S})},getViewTriggerProps(L={}){const{view:S="day"}=L,v=Bl(S,r("minView"),r("maxView")),I=v!==S,F=g||!I;return t.button({...J.viewTrigger.attrs,"data-view":S,dir:r("dir"),id:vv(a,S),type:"button",disabled:F,"data-disabled":P(F),"aria-label":W.viewTrigger(S,I?v:void 0),onClick(Q){Q.defaultPrevented||y&&o({type:"VIEW.TOGGLE",src:"viewTrigger"})}})},getViewControlProps(L={}){const{view:S="day"}=L;return t.element({...J.viewControl.attrs,"data-view":S,dir:r("dir")})},getInputProps(L={}){const{index:S=0,fixOnBlur:v=!0}=L;return t.input({...J.input.attrs,id:Ba(a,S),autoComplete:"off",autoCorrect:"off",spellCheck:"false",dir:r("dir"),name:r("name"),"data-index":S,"data-state":x?"open":"closed","data-placeholder-shown":P($),readOnly:d,disabled:g,required:r("required"),"aria-invalid":he(m),"data-invalid":P(m),placeholder:r("placeholder")||Ev(O,W.placeholder(O)),defaultValue:i("valueAsString")[S],onBeforeInput(I){const{data:F}=qo(I);Dl(F,Z,O)||I.preventDefault()},onClick(I){I.defaultPrevented||r("openOnClick")&&y&&o({type:"OPEN",src:"input.click"})},onFocus(){o({type:"INPUT.FOCUS",index:S})},onBlur(I){const F=I.currentTarget.value.trim();o({type:"INPUT.BLUR",value:F,index:S,fixOnBlur:v})},onKeyDown(I){if(I.defaultPrevented||!y)return;const Q={Enter(U){Ku(U)||Ke(u)||U.currentTarget.value.trim()!==""&&o({type:"INPUT.ENTER",value:U.currentTarget.value,index:S})}}[I.key];Q&&(Q(I),I.preventDefault())},onInput(I){const F=I.currentTarget.value;o({type:"INPUT.CHANGE",value:ov(F,Z,O),index:S})}})},getMonthSelectProps(){return t.select({...J.monthSelect.attrs,id:Fl(a),"aria-label":W.monthSelect,disabled:g,dir:r("dir"),defaultValue:l.month,onChange(L){Dt(Number(L.currentTarget.value))}})},getYearSelectProps(){return t.select({...J.yearSelect.attrs,id:Hl(a),disabled:g,"aria-label":W.yearSelect,dir:r("dir"),defaultValue:l.year,onChange(L){Zt(Number(L.currentTarget.value))}})},getPositionerProps(){return t.element({id:Nl(a),...J.positioner.attrs,dir:r("dir"),style:re.floating})},getPresetTriggerProps(L){const S=Array.isArray(L.value)?L.value:_a(L.value,O,R),v=S.filter(I=>I!=null).map(I=>I.toDate(R).toDateString());return t.button({...J.presetTrigger.attrs,"aria-label":W.presetTrigger(v),type:"button",onClick(I){I.defaultPrevented||y&&o({type:"PRESET.CLICK",value:S})}})}}}var Qr="__live-region-debug__",Lv="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;",Ov=100,Mv=200,Dv={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 Rv(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 l;function c(){if(!o)return;let m=n.getElementById(Qr);return m||(m=n.createElement("div"),m.id=Qr,m.dataset.liveAnnouncerDebug="true",m.setAttribute("aria-hidden","true"),m.style.cssText=Lv,a().appendChild(m),m)}function f(){const m=n.createElement("span");return m.dataset.liveAnnouncer="true",m.setAttribute("aria-live",t),m.setAttribute("aria-atomic","true"),m.setAttribute("role",t==="assertive"?"alert":"status"),Object.assign(m.style,Dv),a().appendChild(m),u=Date.now()+Mv,m}let u=0,h=f();function p(){i.clearTimeout(l),l=void 0}function g(m,y=r){p(),h?.isConnected||(h=f());const $=h;$.textContent="",l=i.setTimeout(()=>{l=void 0,$.textContent=m;const w=c();w&&(w.textContent=m)},Math.max(y,Ov,u-Date.now()))}function d(){p(),h?.remove(),h=null,o&&n.getElementById(Qr)?.remove()}return{announce:g,cancel:p,destroy:d,toJSON(){return"live-region"}}}var{and:ye}=jc();function Pv(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 ks(e,t){return e.map(n=>n==null?"":t("format")(n,{locale:t("locale"),timeZone:t("timeZone")}))}var Vv=Wc({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 g=new Intl.DateTimeFormat(t).resolvedOptions().calendar;g!=="gregory"&&g!=="iso8601"&&(o=e.createCalendar(g))}const i=p=>!o||p.calendar.identifier===o.identifier?p:de(p,o),a=e.defaultValue?Ts(e.defaultValue).map(p=>ke(i(p),e.min,e.max)):void 0,l=e.value?Ts(e.value).map(p=>ke(i(p),e.min,e.max)):void 0;let c=e.focusedValue||e.defaultFocusedValue||l?.[0]||a?.[0]||zn(n,o);c=ke(i(c),e.min,e.max);const f=e.minView||"day",u=e.maxView||"year",h=hi(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:g,timeZone:d}){return new Ae(g,{timeZone:d,day:"2-digit",month:"2-digit",year:"numeric",calendar:o?.identifier}).format(p.toDate(d))},parse(p,{locale:g,timeZone:d}){return lv(p,g,d)},...e,focusedValue:typeof e.focusedValue>"u"?void 0:c,defaultFocusedValue:c,value:l,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=ks(i,e);e("onFocusChange")?.({value:i,valueAsString:a,view:o,focusedValue:s})}})),value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:Pv,hash:s=>s.map(r=>r?.toString()??"").join(","),onChange(s){const r=n(),o=ks(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:Da(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})=>Il(e.get("startValue"),t("visibleDuration")),visibleRange:({context:e,computed:t})=>({start:e.get("startValue"),end:t("endValue")}),visibleRangeText:({context:e,prop:t,computed:n})=>kv({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})=>!Bm(e.get("startValue"),t("min"),t("max")),isNextVisibleRangeValid:({prop:e,computed:t})=>!jm(t("endValue"),e("min"),e("max")),valueAsString:({context:e,prop:t})=>ks(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:ye("shouldRestoreFocus","isInteractOutsideEvent"),target:"focused",actions:["restoreFocusToTrigger"]},{guard:"shouldRestoreFocus",target:"focused",actions:["restoreFocusToInput"]},{target:"idle"}],"CELL.CLICK":[{guard:"isAboveMinView",actions:["setFocusedValueForView","setPreviousView"]},{guard:ye("isRangePicker","hasSelectedRange"),actions:["setActiveIndexToStart","resetSelection","setActiveIndexToEnd"]},{guard:ye("isRangePicker","isSelectingEndDate","closeOnSelect","isOpenControlled"),actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","setRestoreFocus"]},{guard:ye("isRangePicker","isSelectingEndDate","closeOnSelect"),target:"focused",actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","restoreFocusToInput"]},{guard:ye("isRangePicker","isSelectingEndDate"),actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate"]},{guard:"isRangePicker",actions:["setFocusedDate","setSelectedDate","setActiveIndexToEnd"]},{guard:ye("isMultiPicker","canSelectDate"),actions:["setFocusedDate","toggleSelectedDate"]},{guard:"isMultiPicker",actions:["setFocusedDate"]},{guard:ye("closeOnSelect","isOpenControlled"),actions:["setFocusedDate","setSelectedDate","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["setFocusedDate","setSelectedDate","invokeOnClose","restoreFocusToInput"]},{actions:["setFocusedDate","setSelectedDate"]}],"CELL.POINTER_MOVE":[{guard:ye("isRangePicker","isSelectingEndDate","isDayPointerMoveOutsideVisibleMonth"),actions:["setHoveredDate"]},{guard:ye("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:ye("isRangePicker","hasSelectedRange"),actions:["setActiveIndexToStart","resetSelection","setActiveIndexToEnd","focusNextDay"]},{guard:ye("isRangePicker","isSelectingEndDate","closeOnSelect","isOpenControlled"),actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose"]},{guard:ye("isRangePicker","isSelectingEndDate","closeOnSelect"),target:"focused",actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","restoreFocusToInput"]},{guard:ye("isRangePicker","isSelectingEndDate"),actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate"]},{guard:"isRangePicker",actions:["setSelectedDate","setActiveIndexToEnd","focusNextDay"]},{guard:ye("isMultiPicker","canSelectDate"),actions:["toggleSelectedDate"]},{guard:"isMultiPicker"},{guard:ye("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})=>Sv(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=qn(e,s.value??t.get("focusedValue"));return o.some(l=>Et(l,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=_l(n);return vo(s,()=>Wa(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",Rv({level:"assertive",document:n})),()=>t.get("announcer")?.destroy?.()},trackDismissableElement({scope:e,send:t,context:n,prop:s}){return s("inline")?void 0:Gc(()=>nn(e),{type:"popover",defer:!0,getRootNode:e.getRootNode,layerStyleTargets:[()=>Wa(e)],exclude:[...Un(e),Fs(e),wv(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=Bl(e.get("view"),t("minView"),t("maxView"));e.set("view",n)},setPreviousView({context:e,prop:t}){const n=Iv(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,l]=s;a&&l?i=Cs(a,l,r,o):a?i=Cs(a,null,r,o):l?i=Cs(l,null,r,o):i=""}else i=s.map(a=>Cs(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}){If({target:nn(e),doc:e.getDoc()})},enableTextSelection({scope:e}){Ec({doc:e.getDoc(),target:nn(e)})},focusFirstSelectedDate(e){const{context:t}=e;t.get("value").length&&ne(e,t.get("value")[0])},syncInputElement({scope:e,computed:t}){pe(()=>{Un(e).forEach((s,r)=>{gs(s,t("valueAsString")[r]||"")})})},setFocusedDate(e){const{event:t}=e,n=Array.isArray(t.value)?t.value[0]:t.value;ne(e,n)},setFocusedValueForView(e){const{context:t,event:n}=e;ne(e,t.get("focusedValue").set({[t.get("view")]:n.value}))},focusNextMonth(e){const{context:t}=e;ne(e,t.get("focusedValue").add({months:1}))},focusPreviousMonth(e){const{context:t}=e;ne(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=>ke(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=qn(e,n.value??t.get("focusedValue"));s[r]=As(o,i),t.set("value",Hs(s))},resetSelection(e){const{context:t,event:n}=e,s=t.get("value")[0],r=qn(e,n.value??t.get("focusedValue"));t.set("value",[As(s,r)])},toggleSelectedDate(e){const{context:t,event:n}=e,s=qn(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",Ts(i))}else{const i=Array.from(r);i.splice(o,1),t.set("value",Ts(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]=As(r,o),e.set("value",Hs(n));const i=t("valueAsString");e.set("inputValue",i[s])},focusPreviousDay(e){const{context:t}=e,n=t.get("focusedValue").subtract({days:1});ne(e,n)},focusNextDay(e){const{context:t}=e,n=t.get("focusedValue").add({days:1});ne(e,n)},focusPreviousWeek(e){const{context:t}=e,n=t.get("focusedValue").subtract({weeks:1});ne(e,n)},focusNextWeek(e){const{context:t}=e,n=t.get("focusedValue").add({weeks:1});ne(e,n)},focusNextPage(e){const{context:t,computed:n,prop:s}=e,r=Ol(t.get("focusedValue"),t.get("startValue"),n("visibleDuration"),s("locale"),s("min"),s("max"));Ls(e,r)},focusPreviousPage(e){const{context:t,computed:n,prop:s}=e,r=Ml(t.get("focusedValue"),t.get("startValue"),n("visibleDuration"),s("locale"),s("min"),s("max"));Ls(e,r)},focusSectionStart(e){const{context:t}=e;ne(e,t.get("startValue").copy())},focusSectionEnd(e){const{computed:t}=e;ne(e,t("endValue").copy())},focusNextSection(e){const{context:t,event:n,computed:s,prop:r}=e,o=tv(t.get("focusedValue"),t.get("startValue"),n.larger,s("visibleDuration"),r("locale"),r("min"),r("max"));o&&Ls(e,o)},focusPreviousSection(e){const{context:t,event:n,computed:s,prop:r}=e,o=nv(t.get("focusedValue"),t.get("startValue"),n.larger,s("visibleDuration"),r("locale"),r("min"),r("max"));o&&Ls(e,o)},focusNextYear(e){const{context:t}=e,n=t.get("focusedValue").add({years:1});ne(e,n)},focusPreviousYear(e){const{context:t}=e,n=t.get("focusedValue").subtract({years:1});ne(e,n)},focusNextDecade(e){const{context:t}=e,n=t.get("focusedValue").add({years:10});ne(e,n)},focusPreviousDecade(e){const{context:t}=e,n=t.get("focusedValue").subtract({years:10});ne(e,n)},clearFocusedDate(e){const{context:t,prop:n}=e,s=t.get("focusedValue").calendar;ne(e,zn(n("timeZone"),s))},focusPreviousMonthColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").subtract({months:n.columns});ne(e,s)},focusNextMonthColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").add({months:n.columns});ne(e,s)},focusPreviousYearColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").subtract({years:n.columns});ne(e,s)},focusNextYearColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").add({years:n.columns});ne(e,s)},focusFirstMonth(e){const{context:t}=e,n=t.get("focusedValue"),s=n.calendar.getMinimumMonthInYear?.(n)??1;ne(e,n.set({month:s}))},focusLastMonth(e){const{context:t}=e,n=t.get("focusedValue"),s=n.calendar.getMonthsInYear(n);ne(e,n.set({month:s}))},focusFirstYear(e){const{context:t}=e,n=cn(t.get("focusedValue").year),s=t.get("focusedValue").set({year:n[0]});ne(e,s)},focusLastYear(e){const{context:t}=e,n=cn(t.get("focusedValue").year),s=t.get("focusedValue").set({year:n[n.length-1]});ne(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"&&pe(()=>{const s=t.get("view");ja(e,s)?.focus({preventScroll:!0})})},focusActiveCellIfNeeded({scope:e,context:t,event:n}){n.focus&&pe(()=>{const s=t.get("view");ja(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=nn(e),s=Nv(t);pe(()=>{Hi(e.getActiveElement(),[n])||Fs(e)?.focus(s)})},focusFirstInputElement({scope:e,event:t}){t.focus!==!1&&pe(()=>{const[n]=Un(e);(n??Fs(e))?.focus({preventScroll:!0})})},focusInputElement({scope:e}){pe(()=>Ua(e))},restoreFocusToInput({scope:e}){const t=nn(e);pe(()=>{Hi(e.getActiveElement(),[t])||Ua(e)})},syncMonthSelectElement({scope:e,context:t}){const n=bv(e);gs(n,t.get("startValue").month.toString())},syncYearSelectElement({scope:e,context:t}){const n=yv(e);gs(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=Un(e),r=n.index??t.get("activeIndex");gs(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||!qa(r)||ne(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||!qa(r))&&t.value&&(r=e.get("focusedValue").copy()),!r)return;r=ke(r,n("min"),n("max"));const o=Array.from(e.get("value"));o[t.index]=As(o[t.index],r);const i=Hs(o);e.set("value",i);const a=ks(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(!_e(s,e.get("startValue"),t("endValue")))return;const o=Da(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})}}}}),qn=(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 Tv(i=>{$v(i,s("minView"))&&(o=o.set({[i]:i==="day"?1:0}))}),o},As=(e,t)=>{if(!e||!("hour"in e))return t;const n="timeZone"in e;let s=t;return"hour"in t||(n?s=ml(Le(t),e.timeZone):s=Le(t)),s.set({hour:e.hour,minute:e.minute,second:e.second,millisecond:e.millisecond})};function ne(e,t){const{context:n,prop:s,computed:r}=e;if(!t)return;const o=qn(e,t);if(Et(n.get("focusedValue"),o))return;const a=is(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 Ls(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 Nv(e){return e.focusVisible??e.previousEvent?.focusVisible?{preventScroll:!0,focusVisible:!0}:{preventScroll:!0}}function jl(e){return Array.isArray(e)?e.map(t=>jl(t)):e instanceof Date?new Pe(e.getFullYear(),e.getMonth()+1,e.getDate()):Mm(e)}const eo=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>`,to=e=>{try{return/^\d{4}-\d{2}-\d{2}$/.test(e)?jl(e):void 0}catch{return}};function Fv(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>
91
91
  <div class="date-positioner" popover="manual"><section class="date-popover">
92
92
  <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>
93
93
  <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>
94
94
  <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>
95
95
  <div class="date-calendar"><div class="date-navigation"><button type="button" class="icon-button date-prev">${eo("left")}</button><button type="button" class="date-view"></button><button type="button" class="icon-button date-next">${eo("right")}</button></div><div class="date-grids"></div></div>
96
96
  <footer class="date-footer"><span class="date-status" role="status"></span><button id="apply-dates" class="primary-button" type="button">Apply range ${eo("right")}</button></footer>
97
- </section></div>`;const s=d=>e.querySelector(d),r=s(".date-trigger"),o=s(".date-positioner"),i=s(".date-popover"),a=[s("#from-date"),s("#to-date")],l=s("#apply-dates"),c=new Zc(Vv,{id:"timeline-dates",selectionMode:"range",closeOnSelect:!1,fixedWeeks:!0,outsideDaySelectable:!0,locale:navigator.language,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,format:d=>d.toString(),parse:to,placeholder:"YYYY-MM-DD",positioning:{placement:"top-end",strategy:"fixed",gutter:12,slide:!0},onOpenChange({open:d}){d&&n()}}),f=()=>Av(c.service,Yc),u=["day","month","year"].map(d=>{const m=document.createElement("table");m.dataset.calendarView=d;const y=m.createTHead(),$=y.insertRow();if(d==="day")for(let R=0;R<7;R++)$.append(document.createElement("th"));const w=m.createTBody(),M=d==="day"?6:4,O=d==="day"?7:3;for(let R=0;R<M;R++){const E=w.insertRow();for(let T=0;T<O;T++){const x=document.createElement("button");x.type="button",E.insertCell().append(x)}}return s(".date-grids").append(m),{view:d,table:m,head:y,body:w}});function h(){const d=a.map($=>to($.value)),m=!!(d[0]&&d[1]&&d[0].compare(d[1])<=0);l.disabled=!m;for(const[$,w]of a.entries())w.setAttribute("aria-invalid",String(!!w.value&&!d[$]));const y=m?"Both dates included":"Choose a start and end date";s(".date-status").textContent!==y&&(s(".date-status").textContent=y)}function p(){const d=f();se(e,d.getRootProps()),se(s(".date-control"),d.getControlProps()),se(r,{...d.getTriggerProps(),"aria-label":"Custom date range"}),se(o,d.getPositionerProps()),se(i,{...d.getContentProps(),"aria-label":"Custom date range"}),a.forEach(($,w)=>se($,{...d.getInputProps({index:w}),"aria-label":w?"To date":"From date"})),se(s(".date-prev"),d.getPrevTriggerProps({view:d.view})),se(s(".date-next"),d.getNextTriggerProps({view:d.view}));const m=d.view==="day"?d.visibleRangeText.start:d.view==="month"?String(d.visibleRange.start.year):`${d.getDecade().start} – ${d.getDecade().end}`,y=s(".date-view");se(y,d.getViewTriggerProps({view:d.view})),y.textContent!==m&&(y.textContent=m);for(const{view:$,table:w,head:M,body:O}of u){w.hidden=d.view!==$,se(w,d.getTableProps({view:$,columns:$==="day"?7:3})),se(M,d.getTableHeaderProps({view:$})),se(O,d.getTableBodyProps({view:$})),$==="day"&&d.weekDays.forEach((E,T)=>{const x=M.rows[0].cells[T];x.scope="col",x.setAttribute("aria-label",E.long),x.textContent!==E.short&&(x.textContent=E.short)});const R=$==="day"?d.weeks:$==="month"?d.getMonthsGrid({columns:3,format:"short"}):d.getYearsGrid({columns:3});Array.from(O.rows).forEach((E,T)=>{se(E,d.getTableRowProps({view:$})),Array.from(E.cells).forEach((x,C)=>{const b=R[T]?.[C],A=x.firstElementChild;if(x.hidden=!b,!!b)if($==="day"){const D=d.weeks[T][C];se(x,d.getDayTableCellProps({value:D})),se(A,d.getDayTableCellTriggerProps({value:D})),A.textContent!==String(D.day)&&(A.textContent=String(D.day))}else{const D=b;se(x,$==="month"?d.getMonthTableCellProps({...D,columns:3}):d.getYearTableCellProps({...D,columns:3})),se(A,$==="month"?d.getMonthTableCellTriggerProps({...D}):d.getYearTableCellTriggerProps({...D})),A.textContent!==D.label&&(A.textContent=D.label)}})})}o.hidden=!d.open,d.open&&!o.matches(":popover-open")&&o.showPopover?.(),!d.open&&o.matches(":popover-open")&&o.hidePopover?.(),r.classList.toggle("active",d.open),h()}s(".date-close").addEventListener("click",()=>f().setOpen(!1));for(const d of e.querySelectorAll("[data-preset]"))d.addEventListener("click",()=>{const m=f(),y=m.getRangePresetValue(d.dataset.preset);m.setValue(y),m.setFocusedValue(y[0]),m.setView("day")});l.addEventListener("click",()=>{h(),l.disabled||(t(a[0].value,a[1].value),f().setOpen(!1))}),i.addEventListener("input",h),e.addEventListener("keydown",d=>d.stopPropagation());const g=c.subscribe(p);return c.start(),p(),{setRange(d,m){const y=[d,m].map(to).filter($=>$!==void 0);f().setValue(y),y[0]&&f().setFocusedValue(y[0])},dispose(){g(),c.stop(),e.replaceChildren()}}}const Hv={Search:Od,GitFork:bd,GitBranch:yd,Folder:vd,ArrowUpRight:cd,ArrowRight:ad,X:Nd,Box:ld,RotateCcw:Ld,RefreshCw:Ad,Play:kd,Pause:Cd,ChevronDown:dd,FileCode2:md,Terminal:Pd,Copy:hd,Crosshair:pd,CircleHelp:ud,SlidersHorizontal:Rd,LoaderCircle:Ed,Network:Sd,Clock:fd,Sparkles:Za,Grip:wd,PanelRight:Id,Settings2:Md,Volume2:Ja,VolumeX:Vd,Share2:Dd},Oe=()=>{Fd({icons:Hv,attrs:{"stroke-width":1.5}}),Qn()},N=(e,t="")=>`<i data-lucide="${e}" class="${t}" aria-hidden="true"></i>`,k=e=>document.querySelector(e),X=e=>e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]),Wl=e=>Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}).format(e),ge=e=>e.toLocaleString("en"),_v=[new Intl.DateTimeFormat("en",{month:"short",day:"numeric"}),new Intl.DateTimeFormat("en",{month:"short",day:"numeric",year:"numeric"})],Bv=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}),jv=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit"}),mn=(e,t=!1)=>_v[Number(t)].format(e),vn=e=>Bv.format(e),Ga=e=>{const t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`};let B,te={nodes:[],edges:[],lanes:[],start:0,end:0},le=[],pi=[],Ul=new Set,_s=new Map,ns=new Map,ql=new Map,ee,Gl=!0,Gn,j=new URLSearchParams(location.search).get("session"),je,Re,Bs=0,gt="",$t="",We="",at=0,ct="",lt="",yn=!0,Gt=!1,ln=60,js=0,Do,Ro,gi=0,kt=!1,oe=1,rr=0,Zn=0,Je=Jc([]),Po="",Yl=Qc([]),Ws,no,Nn=0,Fn=!1,q={...br},Yt=!0,$r,dt,ss=!1,Vo="";try{q=el(localStorage)}catch{Yt=!1}const or=matchMedia("(prefers-reduced-motion: reduce)");k("#app").innerHTML=`
97
+ </section></div>`;const s=d=>e.querySelector(d),r=s(".date-trigger"),o=s(".date-positioner"),i=s(".date-popover"),a=[s("#from-date"),s("#to-date")],l=s("#apply-dates"),c=new Zc(Vv,{id:"timeline-dates",selectionMode:"range",closeOnSelect:!1,fixedWeeks:!0,outsideDaySelectable:!0,locale:navigator.language,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,format:d=>d.toString(),parse:to,placeholder:"YYYY-MM-DD",positioning:{placement:"top-end",strategy:"fixed",gutter:12,slide:!0},onOpenChange({open:d}){d&&n()}}),f=()=>Av(c.service,Yc),u=["day","month","year"].map(d=>{const m=document.createElement("table");m.dataset.calendarView=d;const y=m.createTHead(),$=y.insertRow();if(d==="day")for(let R=0;R<7;R++)$.append(document.createElement("th"));const w=m.createTBody(),M=d==="day"?6:4,O=d==="day"?7:3;for(let R=0;R<M;R++){const E=w.insertRow();for(let C=0;C<O;C++){const x=document.createElement("button");x.type="button",E.insertCell().append(x)}}return s(".date-grids").append(m),{view:d,table:m,head:y,body:w}});function h(){const d=a.map($=>to($.value)),m=!!(d[0]&&d[1]&&d[0].compare(d[1])<=0);l.disabled=!m;for(const[$,w]of a.entries())w.setAttribute("aria-invalid",String(!!w.value&&!d[$]));const y=m?"Both dates included":"Choose a start and end date";s(".date-status").textContent!==y&&(s(".date-status").textContent=y)}function p(){const d=f();se(e,d.getRootProps()),se(s(".date-control"),d.getControlProps()),se(r,{...d.getTriggerProps(),"aria-label":"Custom date range"}),se(o,d.getPositionerProps()),se(i,{...d.getContentProps(),"aria-label":"Custom date range"}),a.forEach(($,w)=>se($,{...d.getInputProps({index:w}),"aria-label":w?"To date":"From date"})),se(s(".date-prev"),d.getPrevTriggerProps({view:d.view})),se(s(".date-next"),d.getNextTriggerProps({view:d.view}));const m=d.view==="day"?d.visibleRangeText.start:d.view==="month"?String(d.visibleRange.start.year):`${d.getDecade().start} – ${d.getDecade().end}`,y=s(".date-view");se(y,d.getViewTriggerProps({view:d.view})),y.textContent!==m&&(y.textContent=m);for(const{view:$,table:w,head:M,body:O}of u){w.hidden=d.view!==$,se(w,d.getTableProps({view:$,columns:$==="day"?7:3})),se(M,d.getTableHeaderProps({view:$})),se(O,d.getTableBodyProps({view:$})),$==="day"&&d.weekDays.forEach((E,C)=>{const x=M.rows[0].cells[C];x.scope="col",x.setAttribute("aria-label",E.long),x.textContent!==E.short&&(x.textContent=E.short)});const R=$==="day"?d.weeks:$==="month"?d.getMonthsGrid({columns:3,format:"short"}):d.getYearsGrid({columns:3});Array.from(O.rows).forEach((E,C)=>{se(E,d.getTableRowProps({view:$})),Array.from(E.cells).forEach((x,T)=>{const b=R[C]?.[T],A=x.firstElementChild;if(x.hidden=!b,!!b)if($==="day"){const D=d.weeks[C][T];se(x,d.getDayTableCellProps({value:D})),se(A,d.getDayTableCellTriggerProps({value:D})),A.textContent!==String(D.day)&&(A.textContent=String(D.day))}else{const D=b;se(x,$==="month"?d.getMonthTableCellProps({...D,columns:3}):d.getYearTableCellProps({...D,columns:3})),se(A,$==="month"?d.getMonthTableCellTriggerProps({...D}):d.getYearTableCellTriggerProps({...D})),A.textContent!==D.label&&(A.textContent=D.label)}})})}o.hidden=!d.open,d.open&&!o.matches(":popover-open")&&o.showPopover?.(),!d.open&&o.matches(":popover-open")&&o.hidePopover?.(),r.classList.toggle("active",d.open),h()}s(".date-close").addEventListener("click",()=>f().setOpen(!1));for(const d of e.querySelectorAll("[data-preset]"))d.addEventListener("click",()=>{const m=f(),y=m.getRangePresetValue(d.dataset.preset);m.setValue(y),m.setFocusedValue(y[0]),m.setView("day")});l.addEventListener("click",()=>{h(),l.disabled||(t(a[0].value,a[1].value),f().setOpen(!1))}),i.addEventListener("input",h),e.addEventListener("keydown",d=>d.stopPropagation());const g=c.subscribe(p);return c.start(),p(),{setRange(d,m){const y=[d,m].map(to).filter($=>$!==void 0);f().setValue(y),y[0]&&f().setFocusedValue(y[0])},dispose(){g(),c.stop(),e.replaceChildren()}}}const Hv={Search:Od,GitFork:bd,GitBranch:yd,Folder:vd,ArrowUpRight:cd,ArrowRight:ad,X:Nd,Box:ld,RotateCcw:Ld,RefreshCw:Ad,Play:kd,Pause:Td,ChevronDown:dd,FileCode2:md,Terminal:Pd,Copy:hd,Crosshair:pd,CircleHelp:ud,SlidersHorizontal:Rd,LoaderCircle:Ed,Network:Sd,Clock:fd,Sparkles:Za,Grip:wd,PanelRight:Id,Settings2:Md,Volume2:Ja,VolumeX:Vd,Share2:Dd},Oe=()=>{Fd({icons:Hv,attrs:{"stroke-width":1.5}}),Qn()},N=(e,t="")=>`<i data-lucide="${e}" class="${t}" aria-hidden="true"></i>`,k=e=>document.querySelector(e),X=e=>e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]),Wl=e=>Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}).format(e),ge=e=>e.toLocaleString("en"),_v=[new Intl.DateTimeFormat("en",{month:"short",day:"numeric"}),new Intl.DateTimeFormat("en",{month:"short",day:"numeric",year:"numeric"})],Bv=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}),jv=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit"}),mn=(e,t=!1)=>_v[Number(t)].format(e),vn=e=>Bv.format(e),Ga=e=>{const t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`};let B,te={nodes:[],edges:[],lanes:[],start:0,end:0},le=[],pi=[],Ul=new Set,_s=new Map,ns=new Map,ql=new Map,ee,Gl=!0,Gn,j=new URLSearchParams(location.search).get("session"),je,Re,Bs=0,gt="",$t="",We="",at=0,ct="",lt="",yn=!0,Gt=!1,ln=60,js=0,Do,Ro,gi=0,kt=!1,oe=1,rr=0,Zn=0,Je=Jc([]),Po="",Yl=Qc([]),Ws,no,Nn=0,Fn=!1,q={...br},Yt=!0,$r,dt,ss=!1,Vo="";try{q=el(localStorage)}catch{Yt=!1}const or=matchMedia("(prefers-reduced-motion: reduce)");k("#app").innerHTML=`
98
98
  <main class="map" aria-label="Session map">
99
99
  <h1 class="sr-only">SessionGraph — Explore &amp; visualize all your LLM sessions</h1>
100
100
  <div id="scene"></div>
@@ -144,7 +144,7 @@ ${y.output}`:""].filter(Boolean).join(`
144
144
  <p>Time runs left to right. Each orb travels from session creation to its latest saved message, leaving a trail behind. Select it to explore user and assistant messages in matching colors. Messages without timestamps stay readable in the explorer. Click empty space to deselect. Directory colors group sessions; only fork and child links represent ancestry.</p><button class="secondary-button motion-button" id="motion" aria-pressed="true">${N("sparkles")}Animate map</button></dialog>
145
145
  <div id="toast" class="toast" role="status" hidden></div>
146
146
  <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>
147
- `;Oe();Bd();nm();Tg();const Kl=Fv(k(".custom-dates"),(e,t)=>{ct=e,lt=t,Ve(!0)},xe),zt=()=>{const e=!!document.querySelector("dialog[open]");e&&kt&&xe(),ee?.setSuspended(e)},mi=new Kg,It=Yg(k("#tooltip"),k("#scene"),mi),Ir=Gg(k("#inspector"),mi,{select:e=>{It.clear(),ee?.selectEvent(e?.id||null),e&&!kt&&(oe=1,xn(),ee?.focusEvent(e))}});function vi(e){const t=B?.sessions.find(n=>n.id===j);t&&(It.clear(),xe(),ue("inspector",!0),Ir.open(t,e,e?Re?.revision:void 0))}const as=Wg({change:Tr,getArchived:()=>Gt,changeArchived:e=>{Gt=e,Ve()},visibility:zt,previewSound:()=>{ir.play("select")},getSources:()=>Ye.sources(),importSources:e=>Ye.select(e),resetPanels:()=>{document.querySelectorAll(".floating-panel").forEach(e=>{e.removeAttribute("style"),delete e.dataset.positioned})}}),ir=new Ug(q,as.audioStatus);function cs(){ee?.applyPreferences(q),ir.configure(q),document.documentElement.dataset.density=q.density,document.documentElement.dataset.motion=String(Co(q,or.matches)),document.documentElement.style.setProperty("--panel-opacity",`${q.panelOpacity}%`),k("#motion").setAttribute("aria-pressed",String(Co(q,or.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=N(q.muted?"volume-x":"volume-2"),as.render(q,Yt||ss,dt?.state||"saved"),Oe()}function Tr(e){const t=e.autoImport!==void 0&&e.autoImport!==q.autoImport;q=wr({...q,...e});try{Yt=tl(localStorage,q)}catch{Yt=!1}cs(),yi({preferences:{...q},...t?{autoImport:q.autoImport}:{}})}function yi(e){dt?.save(e)}function Wv(){return{sourceID:$t,projectID:gt,directory:We,days:at,fromDate:ct,toDate:lt,includeChildren:yn,includeArchived:Gt}}k("#open-settings").addEventListener("click",as.open);k("#mute-audio").addEventListener("click",()=>Tr({muted:!q.muted}));const Uv=()=>cs();or.addEventListener("change",Uv);const qv=e=>{if(e.key===ri)try{q={...el(localStorage),autoImport:q.autoImport},cs()}catch{}};window.addEventListener("storage",qv);cs();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=>{as.render(q,Yt||ss,e),e==="error"&&At("Changes applied, but could not save to the local library. Retrying when you return."),e==="saved"&&$r?.check()});const zl=Cg(zt),Ye=Ag(e=>xi(e),zt,At);$r=new Mg({eligible:()=>q.autoImport&&!dt?.pending&&document.visibilityState==="visible"&&!!(B&&!B.onboarding&&B.sources?.some(e=>e.selected)),busy:()=>Ye.busy||!!document.querySelector("dialog[open]"),refresh:()=>Ye.refresh(!0)});const Cr=new AbortController,ls=()=>{document.visibilityState==="visible"&&(dt?.state==="error"&&dt.flush(),$r?.check())};window.addEventListener("focus",ls,{signal:Cr.signal});document.addEventListener("visibilitychange",ls,{signal:Cr.signal});window.setInterval(ls,Lg);k("#manage-sources").addEventListener("click",()=>{Ye.open()});document.addEventListener("sessiongraph-import-status",e=>{const t=e.detail;$r?.activity(),as.importStatus(t),B&&(B.importing=t.running),le.length||kr(),k("#refresh").classList.toggle("spinning",t.running),k(".connection").title=t.running?`Importing ${Ue(t.source)} · ${t.imported} sessions saved`:t.failed?"Import unavailable · open Manage sources for details":"Local library · SQLite"},{signal:Cr.signal});const bi=Gd(Sn,zt,e=>{zl.open(e)});k("#search").addEventListener("click",bi.open);function ue(e,t){kt&&(e==="timeline"?!t:t)&&xe();const n=k(`#${e}`);n.hidden=!t,k(`#toggle-${e}`).setAttribute("aria-expanded",String(t)),t&&innerWidth<760&&e!=="timeline"&&ue(e==="explorer"?"inspector":"explorer",!1)}ue("explorer",innerWidth>=760);let so=[];for(const e of["explorer","timeline","inspector"])k(`#toggle-${e}`).addEventListener("click",()=>ue(e,k(`#${e}`).hidden));k("#close-explorer").addEventListener("click",()=>{ue("explorer",!1),k("#toggle-explorer").focus()});k("#close-timeline").addEventListener("click",()=>{xe(),ue("timeline",!1),k("#toggle-timeline").focus()});function At(e){k("#toast").textContent=e,k("#toast").hidden=!1,window.setTimeout(()=>{k("#toast").hidden=!0},3500)}function wi(){ue("inspector",!1),Ir.close(),It.clear(),k("#session-inspector").replaceChildren(),k("#toggle-inspector").hidden=!0}wi();async function Gv(){try{const{TimelineScene:e}=await No(async()=>{const{TimelineScene:t}=await import("./scene-CEalI0mr.js");return{TimelineScene:t}},__vite__mapDeps([0,1]));ee=new e(k("#scene"),{onSelect:t=>{t?(ir.play("select"),Sn(t)):Ti()},onPlaybackInterrupt:xe,onEvent:t=>{ir.play("select"),vi(t)},onEventHover:(t,n,s,r)=>{Gn=void 0,t&&j&&Re?It.show(t,j,Re.revision,n,s,r):It.clear()},onHover:(t,n,s)=>{const r=k("#tooltip");r.classList.contains("message-tooltip")&&(It.clear(),Gn=void 0),r.hidden!==!t&&(r.hidden=!t),t&&(Gn!==t.session&&(Gn=t.session,r.innerHTML=`<strong>${X(t.session.title)}</strong><span>${X(Ue(t.session.source))} · ${t.session.activity?.lastMessageAt?`Last message ${vn(t.session.activity.lastMessageAt)}`:"Message time unavailable"}<br>Started ${vn(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),B&&(ee.setGraph(te,!0),j&&(ee.select(j),ee.focus(j)),je&&ee.setFiles(je.files),Re&&ee.setEvents(Re.items))}catch(e){console.error("[sessiongraph] Graphics initialization failed",e),At("3D requires WebGL. You can still browse sessions in the list.")}finally{Gl=!1,B&&kr()}}Gv();k("#scene").addEventListener("scene-error",e=>At(e.detail));async function Ei(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 xi(e=!1){const t=k("#refresh");t.disabled=!0,t.classList.add("spinning");try{const n=dt?.revision,s=await Ei("/api/sessiongraph"),r=B,o=j?_s.get(j):void 0,i=!!(r&&te.nodes.length);if(B=s,!dt?.pending&&n===dt?.revision){q={...wr(s.preferences||q),autoImport:s.autoImport!==!1};try{Yt=tl(localStorage,q)}catch{Yt=!1}if(!ss){const l=Vg(s.viewState);({sourceID:$t,projectID:gt,directory:We,days:at,fromDate:ct,toDate:lt,includeChildren:yn,includeArchived:Gt}=l),k("#children").checked=yn,Vo=JSON.stringify(l),s.preferences||yi({preferences:{...q}})}cs()}if(ss=!0,k("#connection-label").textContent="Local library",k(".connection").classList.add("connected"),k(".connection").title=`Connected · ${ge(B.sessions.length)} sessions`,r&&JSON.stringify(r.sessions)===JSON.stringify(s.sessions)&&JSON.stringify(r.projects)===JSON.stringify(s.projects)){kr();return}mi.clear(),_s=new Map(B.sessions.map(l=>[l.id,l])),k("#source").innerHTML='<option value="">All sources</option>'+(B.sources||[]).map(l=>`<option value="${X(l.id)}">${X(l.name)} · ${l.sessions.toLocaleString()}</option>`).join(""),k("#source").value=$t,k("#source-filter-icon").innerHTML=ut($t),bi.setData(B);const a=new Map;if(B.sessions.forEach(l=>a.set(l.projectID,(a.get(l.projectID)||0)+1)),k("#project").innerHTML='<option value="">All projects</option>'+[...B.projects].filter(l=>a.has(l.id)).sort((l,c)=>(a.get(c.id)||0)-(a.get(l.id)||0)).map(l=>`<option value="${X(l.id)}">${X(l.name)} · ${ge(a.get(l.id)||0)}</option>`).join(""),k("#project").value=gt,Si(),j&&!r){const l=B.sessions.find(c=>c.id===j);l&&l.created<Date.now()-at*864e5&&(at=0),l?.archived&&(Gt=!0)}if(Ve(!i,i),j&&!r)Sn(j);else if(j){const l=_s.get(j);if(l&&JSON.stringify(o)!==JSON.stringify(l)){const c=k(".detail-scroll")?.scrollTop||0;je=void 0,Re=void 0,Ql(l,!1),k(".detail-scroll").scrollTop=c,ar(l.id),Ci(l)}}else wi();!e&&B.warnings.length&&At(B.warnings.join(" ")),!e&&B.onboarding&&Ye.open(!0)}catch(n){if(e&&B){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=`${N("terminal")}<h3>Local library unavailable</h3><p>${X(n instanceof Error?n.message:"Unable to connect.")}</p><button class="primary-button" id="retry">Retry ${N("arrow-right")}</button>`,k("#retry").addEventListener("click",()=>{xi().then(ls)}),B||(k("#session-list").innerHTML='<p class="empty-list">Your sessions will appear here once connected.</p>',k("#list-count").textContent="Offline"),Oe()}finally{t.disabled=!1,t.classList.remove("spinning")}}function Si(){const e=B?.sessions.filter(s=>!gt||s.projectID===gt)||[],t=[...new Set(e.map(s=>s.directory))].sort((s,r)=>Yn(s).localeCompare(Yn(r))),n=new Set(B?.projects.flatMap(s=>s.worktrees));k("#directory").innerHTML='<option value="">All directories</option>'+t.map(s=>`<option value="${X(s)}">${n.has(s)?"⑂ ":""}${X(Yn(s))}</option>`).join(""),t.includes(We)||(We=""),k("#directory").value=We}function Ve(e=!1,t=!1){if(!B)return;t||(xe(),oe=1,ln=60);const n=k("#session-list").scrollTop,s=document.activeElement?.closest("[data-session]")?.dataset.session,r=Date.now(),o=ct?new Date(`${ct}T00:00:00`).getTime():at?r-at*864e5:0,i=lt?new Date(`${lt}T23:59:59.999`).getTime():1/0;le=B.sessions.filter(c=>jg(c,$t)&&(!gt||c.projectID===gt)&&(!We||c.directory===We)&&(yn||!c.parentID||!!c.forkID)&&(Gt||!c.archived)&&c.created>=o&&c.created<=i),pi=[...le].sort((c,f)=>dn(f)-dn(c)),Ul=new Set(le.map(c=>c.id)),bi.setScope(le.map(c=>c.id)),te=_d(le,B.projects,t?te:void 0),ql=new Map(te.nodes.map(c=>[c.session.id,c.color])),ee?.setCutoff(oe),ee?.setGraph(te,e,t),kr(),document.querySelectorAll("[data-days]").forEach(c=>c.classList.toggle("active",!ct&&!lt&&Number(c.dataset.days)===at)),Ii(),t&&(k("#session-list").scrollTop=n,s&&ns.get(s)?.focus({preventScroll:!0})),Yv(),j&&!le.some(c=>c.id===j)?Ti():j&&je&&ee?.setFiles(je.files),j&&Re&&ee?.setEvents(Re.items),Oe();const a=Wv(),l=JSON.stringify(a);ss&&l!==Vo&&(Vo=l,yi({viewState:a}))}function kr(){$i();const e=k("#graph-message");e.hidden=!!(le.length&&ee),le.length?ee||(e.innerHTML=Gl?"<h3>Preparing the map…</h3>":`${N("box")}<h3>WebGL is unavailable.</h3><p>You can explore every session and its file details in the list.</p>`):e.innerHTML=B?.importing?'<div class="loading-orbit"><span></span><span></span><span></span></div><h3>Importing your sessions…</h3><p>Your map will appear when the import finishes.</p>':B&&!B.sessions.length?`${N("folder")}<h3>Your map starts here</h3><p>Choose a source with saved conversations to get started.</p><button class="primary-button" id="empty-sources">Choose sources ${N("arrow-right")}</button>`:`${N("search")}<h3>No matching sessions</h3><button class="text-button" id="clear-filters">Reset filters ${N("rotate-ccw")}</button>`,k("#clear-filters")?.addEventListener("click",()=>Zl()),k("#empty-sources")?.addEventListener("click",()=>{Ye.open()}),Oe()}function $i(e=!1){const t=!!(le.length&&ee);(e||!t)&&(window.clearTimeout(Nn),Nn=0,Fn=!1),k(".playback-share").classList.toggle("ready",Fn&&t),k("#share-playback").disabled=!Fn||!t,t&&!Fn&&!Nn&&(Nn=window.setTimeout(()=>{Nn=0,Fn=!0,$i()},1e3))}function Zl(e){$t="",k("#source").value="",k("#source-filter-icon").innerHTML=ut(),gt="",We="",at=0,ct="",lt="",yn=!0,Gt=e?.archived===!0,k("#project").value="",k("#children").checked=!0,Kl.setRange("",""),Si(),Ve(!0)}function Ii(){k("#list-count").textContent=ge(le.length);const e=pi;let t="";k("#session-list").innerHTML=e.slice(0,ln).map(n=>{const s=dn(n),r=mn(s),o=r!==t?`<div class="list-date">${r}<span>${new Date(s).getFullYear()}</span></div>`:"";return t=r,`${o}<button class="session-card ${j===n.id?"selected":""}" data-session="${X(n.id)}" aria-pressed="${j===n.id}" title="${X(n.title)}"><span class="session-dot" style="--node-color:${ql.get(n.id)}"></span><span class="session-card-body"><span class="session-title">${X(n.title)}</span><span class="session-meta">${n.forkID?N("git-fork"):n.parentID?N("network"):""}<span class="source-badge" data-source="${X(n.source||"opencode")}">${ut(n.source)}${X(Ue(n.source))}</span><span title="${n.activity?.lastMessageAt?"Latest saved message":"Session created; message time unavailable"}">${jv.format(s)}</span></span></span></button>`}).join("")+(e.length>ln?`<button id="more-sessions" class="load-more">Show more sessions ${N("chevron-down")}</button>`:e.length?"":'<p class="empty-list">No sessions match your filters.</p>'),k("#more-sessions")?.addEventListener("click",()=>{ln+=100;const n=k("#session-list").scrollTop;Ii(),k("#session-list").scrollTop=n,Oe()}),ns=new Map([...k("#session-list").querySelectorAll(".session-card")].map(n=>[n.dataset.session,n])),Oe()}function Jl(e){for(const t of[e,j]){const n=t?ns.get(t):void 0;n&&(n.classList.toggle("selected",t===j),n.setAttribute("aria-pressed",String(t===j)))}}function Yv(){Je=Jc(le),Yl=Qc(le),Po="";const e=Bg(le.map(dn),te.start,te.end),t=Math.max(...e,1);k("#histogram").innerHTML=e.map(n=>`<span style="height:${Math.max(4,n/t*100)}%;opacity:${n?.8:.15}" title="${n} session endpoints"></span>`).join(""),k("#date-label").textContent=te.start?`${mn(te.start,new Date(te.start).getFullYear()!==new Date(te.end).getFullYear())} — ${mn(te.end,!0)}`:"No sessions",te.start&&Kl.setRange(ct||Ga(te.start),lt||Ga(te.end)),xn()}function xn(){k("#scrubber").value=String(Math.round(oe*1e3)),k("#timeline-cursor").style.left=`${oe*100}%`,k("#histogram").style.setProperty("--progress",`${oe*100}%`);const e=te.start+(te.end-te.start)*oe;k("#playback-date").textContent=te.start?mn(e,new Date(te.start).getFullYear()!==new Date(te.end).getFullYear()):"—";const t=te.nodes.length?_g(e,te.end-te.start):"—";k("#playback-period").textContent!==t&&(k("#playback-period").textContent=t);const n=Je.at(e,oe>=1),s=Yl(e,oe>=1),r=`${n.tokens}:${n.sessions}:${s}`;r!==Po&&(Po=r,k("#playback-summary").hidden=le.length===0,k("#playback-sessions").textContent=ge(s),k("#playback-tokens").textContent=Je.recorded?Wl(n.tokens):"—",k("#playback-token-coverage").textContent=Je.recorded?`${ge(n.sessions)} / ${ge(Je.recorded)} with recorded usage`:"Usage unavailable",k("#playback-summary").title=`${ge(s)} sessions started. ${Je.recorded?`${ge(n.tokens)} burnt tokens`:"Token usage unavailable"}. Token totals are added at the latest saved message, including cache where reported. ${ge(Je.missing)} sessions have no supported recorded count.${Je.untimed?` ${ge(Je.untimed)} totals have no message timestamp and are included only at the end.`:""}`),ee?.setCutoff(oe)}function xe(){if(kt=!1,Zn=0,k("#app").classList.remove("playback-mode"),Ws){const e=Ws;Ws=void 0,ue("explorer",e.explorer),ue("inspector",e.inspector&&!!j)}ee?.setPlaying(!1),cancelAnimationFrame(gi),k("#play").innerHTML=N("play"),k("#play").setAttribute("aria-label","Play timeline"),Oe()}function Xl(e){if(!kt)return;const t=Math.max(0,e-rr);rr=e,document.hidden||(oe<1?oe=Math.min(1,oe+t*q.playbackSpeed/ni):Zn+=t),xn(),ee?.setPlaybackOutro(oe>=1?Math.min(1,Zn/tr):null),oe>=1&&Zn>=tr+Xc?xe():gi=requestAnimationFrame(Xl)}function Ti(){const e=j;Do?.abort(),Ro?.abort(),k("#file-legend").hidden=!0,js++,Bs++,j=null,je=void 0,Re=void 0,ee?.select(null),history.replaceState(null,"",location.pathname),wi(),Jl(e)}function Kv(e){const t=e.forkID?[{id:e.forkID,label:"Forked from",kind:"git-fork"}]:e.parentID?[{id:e.parentID,label:"Parent",kind:"network"}]:[],n=B.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=B.sessions.find(i=>i.id===r.id);return`<button class="relation" data-related="${X(r.id)}" ${o?"":"disabled"}>${N(r.kind)}<span><small>${r.label}</small><strong>${X(o?.title||"Session no longer available")}</strong></span>${N("arrow-up-right")}</button>`}).join("")}</section>`:""}function Ql(e,t=!0){const n=B.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=`
147
+ `;Oe();Bd();nm();Cg();const Kl=Fv(k(".custom-dates"),(e,t)=>{ct=e,lt=t,Ve(!0)},xe),zt=()=>{const e=!!document.querySelector("dialog[open]");e&&kt&&xe(),ee?.setSuspended(e)},mi=new Kg,It=Yg(k("#tooltip"),k("#scene"),mi),Ir=Gg(k("#inspector"),mi,{select:e=>{It.clear(),ee?.selectEvent(e?.id||null),e&&!kt&&(oe=1,xn(),ee?.focusEvent(e))}});function vi(e){const t=B?.sessions.find(n=>n.id===j);t&&(It.clear(),xe(),ue("inspector",!0),Ir.open(t,e,e?Re?.revision:void 0))}const as=Wg({change:Cr,getArchived:()=>Gt,changeArchived:e=>{Gt=e,Ve()},visibility:zt,previewSound:()=>{ir.play("select")},getSources:()=>Ye.sources(),importSources:e=>Ye.select(e),resetPanels:()=>{document.querySelectorAll(".floating-panel").forEach(e=>{e.removeAttribute("style"),delete e.dataset.positioned})}}),ir=new Ug(q,as.audioStatus);function cs(){ee?.applyPreferences(q),ir.configure(q),document.documentElement.dataset.density=q.density,document.documentElement.dataset.motion=String(To(q,or.matches)),document.documentElement.style.setProperty("--panel-opacity",`${q.panelOpacity}%`),k("#motion").setAttribute("aria-pressed",String(To(q,or.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=N(q.muted?"volume-x":"volume-2"),as.render(q,Yt||ss,dt?.state||"saved"),Oe()}function Cr(e){const t=e.autoImport!==void 0&&e.autoImport!==q.autoImport;q=wr({...q,...e});try{Yt=tl(localStorage,q)}catch{Yt=!1}cs(),yi({preferences:{...q},...t?{autoImport:q.autoImport}:{}})}function yi(e){dt?.save(e)}function Wv(){return{sourceID:$t,projectID:gt,directory:We,days:at,fromDate:ct,toDate:lt,includeChildren:yn,includeArchived:Gt}}k("#open-settings").addEventListener("click",as.open);k("#mute-audio").addEventListener("click",()=>Cr({muted:!q.muted}));const Uv=()=>cs();or.addEventListener("change",Uv);const qv=e=>{if(e.key===ri)try{q={...el(localStorage),autoImport:q.autoImport},cs()}catch{}};window.addEventListener("storage",qv);cs();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=>{as.render(q,Yt||ss,e),e==="error"&&At("Changes applied, but could not save to the local library. Retrying when you return."),e==="saved"&&$r?.check()});const zl=Tg(zt),Ye=Ag(e=>xi(e),zt,At);$r=new Mg({eligible:()=>q.autoImport&&!dt?.pending&&document.visibilityState==="visible"&&!!(B&&!B.onboarding&&B.sources?.some(e=>e.selected)),busy:()=>Ye.busy||!!document.querySelector("dialog[open]"),refresh:()=>Ye.refresh(!0)});const Tr=new AbortController,ls=()=>{document.visibilityState==="visible"&&(dt?.state==="error"&&dt.flush(),$r?.check())};window.addEventListener("focus",ls,{signal:Tr.signal});document.addEventListener("visibilitychange",ls,{signal:Tr.signal});window.setInterval(ls,Lg);k("#manage-sources").addEventListener("click",()=>{Ye.open()});document.addEventListener("sessiongraph-import-status",e=>{const t=e.detail;$r?.activity(),as.importStatus(t),B&&(B.importing=t.running),le.length||kr(),k("#refresh").classList.toggle("spinning",t.running),k(".connection").title=t.running?`Importing ${Ue(t.source)} · ${t.imported} sessions saved`:t.failed?"Import unavailable · open Manage sources for details":"Local library · SQLite"},{signal:Tr.signal});const bi=Gd(Sn,zt,e=>{zl.open(e)});k("#search").addEventListener("click",bi.open);function ue(e,t){kt&&(e==="timeline"?!t:t)&&xe();const n=k(`#${e}`);n.hidden=!t,k(`#toggle-${e}`).setAttribute("aria-expanded",String(t)),t&&innerWidth<760&&e!=="timeline"&&ue(e==="explorer"?"inspector":"explorer",!1)}ue("explorer",innerWidth>=760);let so=[];for(const e of["explorer","timeline","inspector"])k(`#toggle-${e}`).addEventListener("click",()=>ue(e,k(`#${e}`).hidden));k("#close-explorer").addEventListener("click",()=>{ue("explorer",!1),k("#toggle-explorer").focus()});k("#close-timeline").addEventListener("click",()=>{xe(),ue("timeline",!1),k("#toggle-timeline").focus()});function At(e){k("#toast").textContent=e,k("#toast").hidden=!1,window.setTimeout(()=>{k("#toast").hidden=!0},3500)}function wi(){ue("inspector",!1),Ir.close(),It.clear(),k("#session-inspector").replaceChildren(),k("#toggle-inspector").hidden=!0}wi();async function Gv(){try{const{TimelineScene:e}=await No(async()=>{const{TimelineScene:t}=await import("./scene-BGmgWBAw.js");return{TimelineScene:t}},__vite__mapDeps([0,1]));ee=new e(k("#scene"),{onSelect:t=>{t?(ir.play("select"),Sn(t)):Ci()},onPlaybackInterrupt:xe,onEvent:t=>{ir.play("select"),vi(t)},onEventHover:(t,n,s,r)=>{Gn=void 0,t&&j&&Re?It.show(t,j,Re.revision,n,s,r):It.clear()},onHover:(t,n,s)=>{const r=k("#tooltip");r.classList.contains("message-tooltip")&&(It.clear(),Gn=void 0),r.hidden!==!t&&(r.hidden=!t),t&&(Gn!==t.session&&(Gn=t.session,r.innerHTML=`<strong>${X(t.session.title)}</strong><span>${X(Ue(t.session.source))} · ${t.session.activity?.lastMessageAt?`Last message ${vn(t.session.activity.lastMessageAt)}`:"Message time unavailable"}<br>Started ${vn(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),B&&(ee.setGraph(te,!0),j&&(ee.select(j),ee.focus(j)),je&&ee.setFiles(je.files),Re&&ee.setEvents(Re.items))}catch(e){console.error("[sessiongraph] Graphics initialization failed",e),At("3D requires WebGL. You can still browse sessions in the list.")}finally{Gl=!1,B&&kr()}}Gv();k("#scene").addEventListener("scene-error",e=>At(e.detail));async function Ei(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 xi(e=!1){const t=k("#refresh");t.disabled=!0,t.classList.add("spinning");try{const n=dt?.revision,s=await Ei("/api/sessiongraph"),r=B,o=j?_s.get(j):void 0,i=!!(r&&te.nodes.length);if(B=s,!dt?.pending&&n===dt?.revision){q={...wr(s.preferences||q),autoImport:s.autoImport!==!1};try{Yt=tl(localStorage,q)}catch{Yt=!1}if(!ss){const l=Vg(s.viewState);({sourceID:$t,projectID:gt,directory:We,days:at,fromDate:ct,toDate:lt,includeChildren:yn,includeArchived:Gt}=l),k("#children").checked=yn,Vo=JSON.stringify(l),s.preferences||yi({preferences:{...q}})}cs()}if(ss=!0,k("#connection-label").textContent="Local library",k(".connection").classList.add("connected"),k(".connection").title=`Connected · ${ge(B.sessions.length)} sessions`,r&&JSON.stringify(r.sessions)===JSON.stringify(s.sessions)&&JSON.stringify(r.projects)===JSON.stringify(s.projects)){kr();return}mi.clear(),_s=new Map(B.sessions.map(l=>[l.id,l])),k("#source").innerHTML='<option value="">All sources</option>'+(B.sources||[]).map(l=>`<option value="${X(l.id)}">${X(l.name)} · ${l.sessions.toLocaleString()}</option>`).join(""),k("#source").value=$t,k("#source-filter-icon").innerHTML=ut($t),bi.setData(B);const a=new Map;if(B.sessions.forEach(l=>a.set(l.projectID,(a.get(l.projectID)||0)+1)),k("#project").innerHTML='<option value="">All projects</option>'+[...B.projects].filter(l=>a.has(l.id)).sort((l,c)=>(a.get(c.id)||0)-(a.get(l.id)||0)).map(l=>`<option value="${X(l.id)}">${X(l.name)} · ${ge(a.get(l.id)||0)}</option>`).join(""),k("#project").value=gt,Si(),j&&!r){const l=B.sessions.find(c=>c.id===j);l&&l.created<Date.now()-at*864e5&&(at=0),l?.archived&&(Gt=!0)}if(Ve(!i,i),j&&!r)Sn(j);else if(j){const l=_s.get(j);if(l&&JSON.stringify(o)!==JSON.stringify(l)){const c=k(".detail-scroll")?.scrollTop||0;je=void 0,Re=void 0,Ql(l,!1),k(".detail-scroll").scrollTop=c,ar(l.id),Ti(l)}}else wi();!e&&B.warnings.length&&At(B.warnings.join(" ")),!e&&B.onboarding&&Ye.open(!0)}catch(n){if(e&&B){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=`${N("terminal")}<h3>Local library unavailable</h3><p>${X(n instanceof Error?n.message:"Unable to connect.")}</p><button class="primary-button" id="retry">Retry ${N("arrow-right")}</button>`,k("#retry").addEventListener("click",()=>{xi().then(ls)}),B||(k("#session-list").innerHTML='<p class="empty-list">Your sessions will appear here once connected.</p>',k("#list-count").textContent="Offline"),Oe()}finally{t.disabled=!1,t.classList.remove("spinning")}}function Si(){const e=B?.sessions.filter(s=>!gt||s.projectID===gt)||[],t=[...new Set(e.map(s=>s.directory))].sort((s,r)=>Yn(s).localeCompare(Yn(r))),n=new Set(B?.projects.flatMap(s=>s.worktrees));k("#directory").innerHTML='<option value="">All directories</option>'+t.map(s=>`<option value="${X(s)}">${n.has(s)?"⑂ ":""}${X(Yn(s))}</option>`).join(""),t.includes(We)||(We=""),k("#directory").value=We}function Ve(e=!1,t=!1){if(!B)return;t||(xe(),oe=1,ln=60);const n=k("#session-list").scrollTop,s=document.activeElement?.closest("[data-session]")?.dataset.session,r=Date.now(),o=ct?new Date(`${ct}T00:00:00`).getTime():at?r-at*864e5:0,i=lt?new Date(`${lt}T23:59:59.999`).getTime():1/0;le=B.sessions.filter(c=>jg(c,$t)&&(!gt||c.projectID===gt)&&(!We||c.directory===We)&&(yn||!c.parentID||!!c.forkID)&&(Gt||!c.archived)&&c.created>=o&&c.created<=i),pi=[...le].sort((c,f)=>dn(f)-dn(c)),Ul=new Set(le.map(c=>c.id)),bi.setScope(le.map(c=>c.id)),te=_d(le,B.projects,t?te:void 0),ql=new Map(te.nodes.map(c=>[c.session.id,c.color])),ee?.setCutoff(oe),ee?.setGraph(te,e,t),kr(),document.querySelectorAll("[data-days]").forEach(c=>c.classList.toggle("active",!ct&&!lt&&Number(c.dataset.days)===at)),Ii(),t&&(k("#session-list").scrollTop=n,s&&ns.get(s)?.focus({preventScroll:!0})),Yv(),j&&!le.some(c=>c.id===j)?Ci():j&&je&&ee?.setFiles(je.files),j&&Re&&ee?.setEvents(Re.items),Oe();const a=Wv(),l=JSON.stringify(a);ss&&l!==Vo&&(Vo=l,yi({viewState:a}))}function kr(){$i();const e=k("#graph-message");e.hidden=!!(le.length&&ee),le.length?ee||(e.innerHTML=Gl?"<h3>Preparing the map…</h3>":`${N("box")}<h3>WebGL is unavailable.</h3><p>You can explore every session and its file details in the list.</p>`):e.innerHTML=B?.importing?'<div class="loading-orbit"><span></span><span></span><span></span></div><h3>Importing your sessions…</h3><p>Your map will appear when the import finishes.</p>':B&&!B.sessions.length?`${N("folder")}<h3>Your map starts here</h3><p>Choose a source with saved conversations to get started.</p><button class="primary-button" id="empty-sources">Choose sources ${N("arrow-right")}</button>`:`${N("search")}<h3>No matching sessions</h3><button class="text-button" id="clear-filters">Reset filters ${N("rotate-ccw")}</button>`,k("#clear-filters")?.addEventListener("click",()=>Zl()),k("#empty-sources")?.addEventListener("click",()=>{Ye.open()}),Oe()}function $i(e=!1){const t=!!(le.length&&ee);(e||!t)&&(window.clearTimeout(Nn),Nn=0,Fn=!1),k(".playback-share").classList.toggle("ready",Fn&&t),k("#share-playback").disabled=!Fn||!t,t&&!Fn&&!Nn&&(Nn=window.setTimeout(()=>{Nn=0,Fn=!0,$i()},1e3))}function Zl(e){$t="",k("#source").value="",k("#source-filter-icon").innerHTML=ut(),gt="",We="",at=0,ct="",lt="",yn=!0,Gt=e?.archived===!0,k("#project").value="",k("#children").checked=!0,Kl.setRange("",""),Si(),Ve(!0)}function Ii(){k("#list-count").textContent=ge(le.length);const e=pi;let t="";k("#session-list").innerHTML=e.slice(0,ln).map(n=>{const s=dn(n),r=mn(s),o=r!==t?`<div class="list-date">${r}<span>${new Date(s).getFullYear()}</span></div>`:"";return t=r,`${o}<button class="session-card ${j===n.id?"selected":""}" data-session="${X(n.id)}" aria-pressed="${j===n.id}" title="${X(n.title)}"><span class="session-dot" style="--node-color:${ql.get(n.id)}"></span><span class="session-card-body"><span class="session-title">${X(n.title)}</span><span class="session-meta">${n.forkID?N("git-fork"):n.parentID?N("network"):""}<span class="source-badge" data-source="${X(n.source||"opencode")}">${ut(n.source)}${X(Ue(n.source))}</span><span title="${n.activity?.lastMessageAt?"Latest saved message":"Session created; message time unavailable"}">${jv.format(s)}</span></span></span></button>`}).join("")+(e.length>ln?`<button id="more-sessions" class="load-more">Show more sessions ${N("chevron-down")}</button>`:e.length?"":'<p class="empty-list">No sessions match your filters.</p>'),k("#more-sessions")?.addEventListener("click",()=>{ln+=100;const n=k("#session-list").scrollTop;Ii(),k("#session-list").scrollTop=n,Oe()}),ns=new Map([...k("#session-list").querySelectorAll(".session-card")].map(n=>[n.dataset.session,n])),Oe()}function Jl(e){for(const t of[e,j]){const n=t?ns.get(t):void 0;n&&(n.classList.toggle("selected",t===j),n.setAttribute("aria-pressed",String(t===j)))}}function Yv(){Je=Jc(le),Yl=Qc(le),Po="";const e=Bg(le.map(dn),te.start,te.end),t=Math.max(...e,1);k("#histogram").innerHTML=e.map(n=>`<span style="height:${Math.max(4,n/t*100)}%;opacity:${n?.8:.15}" title="${n} session endpoints"></span>`).join(""),k("#date-label").textContent=te.start?`${mn(te.start,new Date(te.start).getFullYear()!==new Date(te.end).getFullYear())} — ${mn(te.end,!0)}`:"No sessions",te.start&&Kl.setRange(ct||Ga(te.start),lt||Ga(te.end)),xn()}function xn(){k("#scrubber").value=String(Math.round(oe*1e3)),k("#timeline-cursor").style.left=`${oe*100}%`,k("#histogram").style.setProperty("--progress",`${oe*100}%`);const e=te.start+(te.end-te.start)*oe;k("#playback-date").textContent=te.start?mn(e,new Date(te.start).getFullYear()!==new Date(te.end).getFullYear()):"—";const t=te.nodes.length?_g(e,te.end-te.start):"—";k("#playback-period").textContent!==t&&(k("#playback-period").textContent=t);const n=Je.at(e,oe>=1),s=Yl(e,oe>=1),r=`${n.tokens}:${n.sessions}:${s}`;r!==Po&&(Po=r,k("#playback-summary").hidden=le.length===0,k("#playback-sessions").textContent=ge(s),k("#playback-tokens").textContent=Je.recorded?Wl(n.tokens):"—",k("#playback-token-coverage").textContent=Je.recorded?`${ge(n.sessions)} / ${ge(Je.recorded)} with recorded usage`:"Usage unavailable",k("#playback-summary").title=`${ge(s)} sessions started. ${Je.recorded?`${ge(n.tokens)} burnt tokens`:"Token usage unavailable"}. Token totals are added at the latest saved message, including cache where reported. ${ge(Je.missing)} sessions have no supported recorded count.${Je.untimed?` ${ge(Je.untimed)} totals have no message timestamp and are included only at the end.`:""}`),ee?.setCutoff(oe)}function xe(){if(kt=!1,Zn=0,k("#app").classList.remove("playback-mode"),Ws){const e=Ws;Ws=void 0,ue("explorer",e.explorer),ue("inspector",e.inspector&&!!j)}ee?.setPlaying(!1),cancelAnimationFrame(gi),k("#play").innerHTML=N("play"),k("#play").setAttribute("aria-label","Play timeline"),Oe()}function Xl(e){if(!kt)return;const t=Math.max(0,e-rr);rr=e,document.hidden||(oe<1?oe=Math.min(1,oe+t*q.playbackSpeed/ni):Zn+=t),xn(),ee?.setPlaybackOutro(oe>=1?Math.min(1,Zn/tr):null),oe>=1&&Zn>=tr+Xc?xe():gi=requestAnimationFrame(Xl)}function Ci(){const e=j;Do?.abort(),Ro?.abort(),k("#file-legend").hidden=!0,js++,Bs++,j=null,je=void 0,Re=void 0,ee?.select(null),history.replaceState(null,"",location.pathname),wi(),Jl(e)}function Kv(e){const t=e.forkID?[{id:e.forkID,label:"Forked from",kind:"git-fork"}]:e.parentID?[{id:e.parentID,label:"Parent",kind:"network"}]:[],n=B.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=B.sessions.find(i=>i.id===r.id);return`<button class="relation" data-related="${X(r.id)}" ${o?"":"disabled"}>${N(r.kind)}<span><small>${r.label}</small><strong>${X(o?.title||"Session no longer available")}</strong></span>${N("arrow-up-right")}</button>`}).join("")}</section>`:""}function Ql(e,t=!0){const n=B.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=`
148
148
  <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">${N("grip")}<span>${s}</span></button><button id="close-inspector" class="icon-button" aria-label="Close session details">${N("x")}</button></div>
149
149
  <div class="detail-scroll">
150
150
  <div class="detail-title"><span class="source-badge" data-source="${X(e.source||"opencode")}">${ut(e.source)}${X(Ue(e.source))}</span><h2>${X(e.title)}</h2><span class="detail-date">${vn(e.created)}</span></div>
@@ -157,11 +157,11 @@ ${y.output}`:""].filter(Boolean).join(`
157
157
  `,k("#toggle-inspector").hidden=!1,t&&ue("inspector",!0),k("#close-inspector").addEventListener("click",()=>{ue("inspector",!1),k("#toggle-inspector").focus()}),k("#focus-session").addEventListener("click",()=>{xe(),ee?.focus(e.id)}),k("#open-session").addEventListener("click",()=>{zl.open(e)}),k("#copy-id").addEventListener("click",async()=>{try{await navigator.clipboard.writeText(e.nativeID||e.id),At("Session ID copied")}catch{At(e.nativeID||e.id)}}),ed(e),Oe()}function ed(e,t){const n=t?[`${ge(t.total)} messages · ${ge(t.items.length)} on map`,t.limited?"Map limit reached":"",t.partial?"Partial history":""].filter(Boolean):["Loading messages…"];k("#message-detail").innerHTML=`<div class="section-label">Session timeline</div><dl class="metadata">
158
158
  <div><dt>Trail starts</dt><dd>${vn(e.created)}</dd></div>
159
159
  <div><dt>Node · last message</dt><dd>${e.activity?.lastMessageAt?vn(e.activity.lastMessageAt):"Unknown · at session start"}</dd></div>
160
- </dl><div class="event-key"><span style="--event-color:#ffffff"><i></i>User & assistant messages</span></div><p class="coverage-note">${n.map(X).join(" · ")}</p><button class="secondary-button explore-events">Explore messages ${N("arrow-right")}</button>`,k(".explore-events").addEventListener("click",()=>vi()),Oe()}async function Ci(e,t=!1){const n=++Bs;Ro?.abort();const s=new AbortController;Ro=s;try{const r=await Ei(`/api/sessiongraph/session/${encodeURIComponent(e.id)}/event-markers`,s.signal);if(s.signal.aborted||n!==Bs||j!==e.id)return;Re=r,ee?.setEvents(r.items,t),ed(e,r)}catch{if(s.signal.aborted||n!==Bs||j!==e.id)return;k("#message-detail").innerHTML='<div class="section-label">Session timeline</div><p class="coverage-note">Message timing unavailable.</p><button class="secondary-button explore-events">Explore messages</button><button class="load-more" id="retry-timeline">Retry message markers</button>',k(".explore-events").addEventListener("click",()=>vi()),k("#retry-timeline").addEventListener("click",()=>{Ci(e)})}}function zv(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 Ya(e){const t=e.files;k("#file-legend").hidden=!t.length,k("#file-detail").innerHTML=`
160
+ </dl><div class="event-key"><span style="--event-color:#ffffff"><i></i>User & assistant messages</span></div><p class="coverage-note">${n.map(X).join(" · ")}</p><button class="secondary-button explore-events">Explore messages ${N("arrow-right")}</button>`,k(".explore-events").addEventListener("click",()=>vi()),Oe()}async function Ti(e,t=!1){const n=++Bs;Ro?.abort();const s=new AbortController;Ro=s;try{const r=await Ei(`/api/sessiongraph/session/${encodeURIComponent(e.id)}/event-markers`,s.signal);if(s.signal.aborted||n!==Bs||j!==e.id)return;Re=r,ee?.setEvents(r.items,t),ed(e,r)}catch{if(s.signal.aborted||n!==Bs||j!==e.id)return;k("#message-detail").innerHTML='<div class="section-label">Session timeline</div><p class="coverage-note">Message timing unavailable.</p><button class="secondary-button explore-events">Explore messages</button><button class="load-more" id="retry-timeline">Retry message markers</button>',k(".explore-events").addEventListener("click",()=>vi()),k("#retry-timeline").addEventListener("click",()=>{Ti(e)})}}function zv(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 Ya(e){const t=e.files;k("#file-legend").hidden=!t.length,k("#file-detail").innerHTML=`
161
161
  <section class="detail-section"><div class="section-label">Changed files<span>${ge(t.length)}${e.partial?"+":""}</span></div>
162
162
  ${t.length?`<ul class="file-list">${t.map(n=>`<li title="${X(n.path)} · ${n.source}">${N("file-code-2")}<div><strong>${X(Yn(n.path))}</strong>${n.path.includes("/")?`<span>${X(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>'}
163
163
  <p class="coverage-note">${ge(e.messagesScanned)} messages${e.partial?" · Partial history":""}${e.snapshotSteps?"":" · Snapshots unavailable"}${t.length>80?" · 80 files on map":""}</p>
164
164
  ${e.nextCursor?'<p class="coverage-note" id="history-loading" role="status">Loading full history…</p>':""}</section>
165
165
  ${e.locations.length?`<details class="more-details detail-section"><summary>Directory moves ${N("chevron-down")}</summary>${e.locations.map(n=>`<div class="location-entry"><span>${vn(n.time)}</span><code>${X(n.directory)}</code></div>`).join("")}</details>`:""}
166
166
  ${e.tools.length?`<details class="more-details detail-section"><summary>Tools used <span>${ge(e.tools.reduce((n,s)=>n+s.count,0))}</span>${N("chevron-down")}</summary><div class="tools-list">${e.tools.slice(0,12).map(n=>`<div><span>${X(n.name)}</span><strong>${n.count}</strong></div>`).join("")}</div></details>`:""}
167
- `,ee?.setFiles(t),Oe()}async function ar(e){const t=++js;Do?.abort();const n=new AbortController;Do=n;let s,r;const o=new Set;try{do{const i=await Ei(`/api/sessiongraph/session/${encodeURIComponent(e)}${s?`?cursor=${encodeURIComponent(s)}`:""}`,n.signal);if(n.signal.aborted||t!==js||j!==e)return;if(r&&i.revision!==r.revision)throw new Error("History changed. Retry to load the latest version.");if(r=r?zv(r,i):i,je=r,!s||!i.nextCursor?Ya(r):k("#history-loading")&&(k("#history-loading").textContent=`Loading full history… ${ge(r.messagesScanned)} messages`),s=i.nextCursor||void 0,s&&o.has(s))throw new Error("History could not be loaded. Please retry.");s&&o.add(s)}while(s)}catch(i){if(n.signal.aborted||t!==js||j!==e)return;if(je){Ya(je);const a=k("#history-loading");a&&(a.innerHTML='History loading interrupted. <button class="text-button" id="retry-detail">Retry</button>'),k("#retry-detail")?.addEventListener("click",()=>{ar(e)})}else k("#file-detail").innerHTML=`<section class="detail-section"><div class="section-label">Changed files</div><p class="coverage-note">${X(i instanceof Error?i.message:"Details unavailable.")}</p><button class="load-more" id="retry-detail">Retry file details</button></section>`,k("#retry-detail").addEventListener("click",()=>ar(e))}}function Sn(e){const t=_s.get(e);if(!t)return;const n=j;Ir.close(),It.clear(),Ul.has(e)||Zl(t),xe(),oe=1,xn(),j=e,je=void 0,Re=void 0,k("#file-legend").hidden=!0,history.replaceState(null,"",`?session=${encodeURIComponent(e)}`),ee?.select(e),Ql(t),ee?.focus(e),Jl(n),ar(e),Ci(t,!0)}k("#session-list").addEventListener("click",e=>{const t=e.target.closest("[data-session]");t?.dataset.session&&Sn(t.dataset.session)});k("#inspector").addEventListener("click",e=>{const t=e.target.closest("[data-related]");t?.dataset.related&&Sn(t.dataset.related)});k("#project").addEventListener("change",e=>{gt=e.target.value,We="",Si(),Ve(!0)});k("#source").addEventListener("change",e=>{$t=e.target.value,k("#source-filter-icon").innerHTML=ut($t),Ve(!0)});k("#directory").addEventListener("change",e=>{We=e.target.value,Ve(!0)});k("#children").addEventListener("change",e=>{yn=e.target.checked,Ve()});document.querySelectorAll("[data-days]").forEach(e=>e.addEventListener("click",()=>{at=Number(e.dataset.days),ct="",lt="",Ve(!0)}));k("#reset-camera").addEventListener("click",()=>Ve(!0));k("#refresh").addEventListener("click",()=>{B?.onboarding?Ye.open(!0):Ye.refresh()});k("#scrubber").addEventListener("input",e=>{xe(),oe=Number(e.target.value)/1e3,xn()});k("#play").addEventListener("click",()=>{if(le.length){if(kt)return xe();oe>=1&&(oe=0),xn(),Ws={explorer:!k("#explorer").hidden,inspector:!k("#inspector").hidden},ue("explorer",!1),ue("inspector",!1),ue("timeline",!0),It.clear(),Gn=void 0,k("#app").classList.add("playback-mode"),$i(!0),kt=!0,Zn=0,ee?.setPlaying(!0),rr=performance.now(),k("#play").innerHTML=N("pause"),k("#play").setAttribute("aria-label","Pause timeline"),Oe(),gi=requestAnimationFrame(Xl)}});document.addEventListener("visibilitychange",()=>{rr=performance.now()},{signal:Cr.signal});k("#share-playback").addEventListener("click",async()=>{const e=k("#share-playback");e.disabled=!0;try{if(!no){const{createPlaybackShare:t}=await No(async()=>{const{createPlaybackShare:n}=await import("./share-BydK_UaB.js");return{createPlaybackShare:n}},__vite__mapDeps([2,0,1]));no=t(zt)}te.nodes.length&&no.open(te,q)}catch{At("Could not open GIF sharing. Please try again.")}finally{e.disabled=!le.length||!ee}});for(const e of[!1,!0])k(`#view-${e?"2d":"3d"}`).addEventListener("click",()=>Tr({view:e?"2d":"3d"}));k("#motion").addEventListener("click",()=>Tr({motion:Co(q,or.matches)?"off":"on"}));k("#help").addEventListener("click",()=>{k("#help-dialog").showModal(),zt()});k("#help-dialog").addEventListener("close",zt);k("#close-help").addEventListener("click",()=>k("#help-dialog").close());document.addEventListener("keydown",e=>{if(!e.defaultPrevented&&!document.querySelector("dialog[open]")){if(kt&&e.key==="Escape"){e.preventDefault(),xe();return}if(!Ir.handleKey(e)){if(e.key==="Escape"){j?Ti():ue("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=pi,s=n.findIndex(i=>i.id===j),r=e.key==="ArrowLeft"||e.key==="ArrowUp"?-1:1,o=n[Math.max(0,Math.min(n.length-1,s+r))];o&&(e.preventDefault(),Sn(o.id),t.closest(".session-card")&&(ns.has(o.id)||(ln=Math.min(n.length,ln+100),Ii()),ns.get(o.id)?.focus({preventScroll:!0})));return}}if(e.key.toLowerCase()==="f"&&Ve(!0),e.key.toLowerCase()==="h"){xe();const t=["explorer","timeline","inspector"].filter(n=>!k(`#${n}`).hidden);t.length?(so=t,t.forEach(n=>ue(n,!1))):(so.length?so:["explorer","timeline"]).forEach(n=>{(n!=="inspector"||j)&&ue(n,!0)})}}}}});xi().then(()=>{B?.importing?Ye.resume():ls()});export{ry as C,br as D,oy as R,Dd as S,No as _,Qc as a,Qv as b,za as c,ey as d,si as e,ty as f,_g as g,K as h,Zg as i,In as j,Zv as k,Hd as l,Co as m,ny as n,Jv as o,Jc as p,Xv as q,sy as r,dn as s,Bg as t,ro as u,rl as v};
167
+ `,ee?.setFiles(t),Oe()}async function ar(e){const t=++js;Do?.abort();const n=new AbortController;Do=n;let s,r;const o=new Set;try{do{const i=await Ei(`/api/sessiongraph/session/${encodeURIComponent(e)}${s?`?cursor=${encodeURIComponent(s)}`:""}`,n.signal);if(n.signal.aborted||t!==js||j!==e)return;if(r&&i.revision!==r.revision)throw new Error("History changed. Retry to load the latest version.");if(r=r?zv(r,i):i,je=r,!s||!i.nextCursor?Ya(r):k("#history-loading")&&(k("#history-loading").textContent=`Loading full history… ${ge(r.messagesScanned)} messages`),s=i.nextCursor||void 0,s&&o.has(s))throw new Error("History could not be loaded. Please retry.");s&&o.add(s)}while(s)}catch(i){if(n.signal.aborted||t!==js||j!==e)return;if(je){Ya(je);const a=k("#history-loading");a&&(a.innerHTML='History loading interrupted. <button class="text-button" id="retry-detail">Retry</button>'),k("#retry-detail")?.addEventListener("click",()=>{ar(e)})}else k("#file-detail").innerHTML=`<section class="detail-section"><div class="section-label">Changed files</div><p class="coverage-note">${X(i instanceof Error?i.message:"Details unavailable.")}</p><button class="load-more" id="retry-detail">Retry file details</button></section>`,k("#retry-detail").addEventListener("click",()=>ar(e))}}function Sn(e){const t=_s.get(e);if(!t)return;const n=j;Ir.close(),It.clear(),Ul.has(e)||Zl(t),xe(),oe=1,xn(),j=e,je=void 0,Re=void 0,k("#file-legend").hidden=!0,history.replaceState(null,"",`?session=${encodeURIComponent(e)}`),ee?.select(e),Ql(t),ee?.focus(e),Jl(n),ar(e),Ti(t,!0)}k("#session-list").addEventListener("click",e=>{const t=e.target.closest("[data-session]");t?.dataset.session&&Sn(t.dataset.session)});k("#inspector").addEventListener("click",e=>{const t=e.target.closest("[data-related]");t?.dataset.related&&Sn(t.dataset.related)});k("#project").addEventListener("change",e=>{gt=e.target.value,We="",Si(),Ve(!0)});k("#source").addEventListener("change",e=>{$t=e.target.value,k("#source-filter-icon").innerHTML=ut($t),Ve(!0)});k("#directory").addEventListener("change",e=>{We=e.target.value,Ve(!0)});k("#children").addEventListener("change",e=>{yn=e.target.checked,Ve()});document.querySelectorAll("[data-days]").forEach(e=>e.addEventListener("click",()=>{at=Number(e.dataset.days),ct="",lt="",Ve(!0)}));k("#reset-camera").addEventListener("click",()=>Ve(!0));k("#refresh").addEventListener("click",()=>{B?.onboarding?Ye.open(!0):Ye.refresh()});k("#scrubber").addEventListener("input",e=>{xe(),oe=Number(e.target.value)/1e3,xn()});k("#play").addEventListener("click",()=>{if(le.length){if(kt)return xe();oe>=1&&(oe=0),xn(),Ws={explorer:!k("#explorer").hidden,inspector:!k("#inspector").hidden},ue("explorer",!1),ue("inspector",!1),ue("timeline",!0),It.clear(),Gn=void 0,k("#app").classList.add("playback-mode"),$i(!0),kt=!0,Zn=0,ee?.setPlaying(!0),rr=performance.now(),k("#play").innerHTML=N("pause"),k("#play").setAttribute("aria-label","Pause timeline"),Oe(),gi=requestAnimationFrame(Xl)}});document.addEventListener("visibilitychange",()=>{rr=performance.now()},{signal:Tr.signal});k("#share-playback").addEventListener("click",async()=>{const e=k("#share-playback");e.disabled=!0;try{if(!no){const{createPlaybackShare:t}=await No(async()=>{const{createPlaybackShare:n}=await import("./share-CLYxMZI8.js");return{createPlaybackShare:n}},__vite__mapDeps([2,0,1]));no=t(zt)}te.nodes.length&&no.open(te,q)}catch{At("Could not open GIF sharing. Please try again.")}finally{e.disabled=!le.length||!ee}});for(const e of[!1,!0])k(`#view-${e?"2d":"3d"}`).addEventListener("click",()=>Cr({view:e?"2d":"3d"}));k("#motion").addEventListener("click",()=>Cr({motion:To(q,or.matches)?"off":"on"}));k("#help").addEventListener("click",()=>{k("#help-dialog").showModal(),zt()});k("#help-dialog").addEventListener("close",zt);k("#close-help").addEventListener("click",()=>k("#help-dialog").close());document.addEventListener("keydown",e=>{if(!e.defaultPrevented&&!document.querySelector("dialog[open]")){if(kt&&e.key==="Escape"){e.preventDefault(),xe();return}if(!Ir.handleKey(e)){if(e.key==="Escape"){j?Ci():ue("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=pi,s=n.findIndex(i=>i.id===j),r=e.key==="ArrowLeft"||e.key==="ArrowUp"?-1:1,o=n[Math.max(0,Math.min(n.length-1,s+r))];o&&(e.preventDefault(),Sn(o.id),t.closest(".session-card")&&(ns.has(o.id)||(ln=Math.min(n.length,ln+100),Ii()),ns.get(o.id)?.focus({preventScroll:!0})));return}}if(e.key.toLowerCase()==="f"&&Ve(!0),e.key.toLowerCase()==="h"){xe();const t=["explorer","timeline","inspector"].filter(n=>!k(`#${n}`).hidden);t.length?(so=t,t.forEach(n=>ue(n,!1))):(so.length?so:["explorer","timeline"]).forEach(n=>{(n!=="inspector"||j)&&ue(n,!0)})}}}}});xi().then(()=>{B?.importing?Ye.resume():ls()});export{ry as C,br as D,oy as R,Dd as S,No as _,Qc as a,Qv as b,za as c,ey as d,si as e,ty as f,_g as g,K as h,Zg as i,In as j,Zv as k,Hd as l,To as m,ny as n,Jv as o,Jc as p,Xv as q,sy as r,dn as s,Bg as t,ro as u,rl as v};