sessiongraph-app-win32-x64 1.0.13 → 1.0.15

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.
Files changed (29) hide show
  1. package/package.json +2 -2
  2. package/payload/SessionGraph.exe +0 -0
  3. package/payload/resources/node.exe +2 -2
  4. package/payload/resources/server.mjs +643 -325
  5. package/payload/resources/web/assets/external-links-BmBkCsrt.js +1 -0
  6. package/payload/resources/web/assets/index-B1kyvo41.js +175 -0
  7. package/payload/resources/web/assets/index-BLM-0yG6.js +1 -0
  8. package/payload/resources/web/assets/{index-CJb-F0VY.js → index-D4P4hbvc.js} +1 -1
  9. package/payload/resources/web/assets/index-Du0_nVjH.css +1 -0
  10. package/payload/resources/web/assets/{index-HzUuskn3.js → index-Kotmn42s.js} +1 -1
  11. package/payload/resources/web/assets/publishing-CEvQPkO1.css +1 -0
  12. package/payload/resources/web/assets/publishing-D9CqkbeB.js +23 -0
  13. package/payload/resources/web/assets/scene-CTHyYtma.js +139 -0
  14. package/payload/resources/web/assets/share-Cw1E-ED9.js +7 -0
  15. package/payload/resources/web/index.html +2 -2
  16. package/payload/resources/web/sources/NOTICE.txt +4 -4
  17. package/payload/resources/web/assets/external-links-BcKDmn29.js +0 -1
  18. package/payload/resources/web/assets/index-CDA8pT1Q.js +0 -170
  19. package/payload/resources/web/assets/index-DYhIhreE.js +0 -1
  20. package/payload/resources/web/assets/index-cVgPCrFV.css +0 -1
  21. package/payload/resources/web/assets/publishing-CpVLG7_B.js +0 -25
  22. package/payload/resources/web/assets/publishing-VJhUmdPH.css +0 -1
  23. package/payload/resources/web/assets/scene-BkoCsbA8.js +0 -139
  24. package/payload/resources/web/assets/share-CS1dKayZ.js +0 -7
  25. package/payload/resources/web/sources/hindsight.svg +0 -1
  26. package/payload/resources/web/sources/lmstudio.svg +0 -1
  27. package/payload/resources/web/sources/reasonix.svg +0 -1
  28. package/payload/resources/web/sources/trae.svg +0 -1
  29. package/payload/resources/web/sources/warp.svg +0 -1
@@ -1,170 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/scene-BkoCsbA8.js","assets/three-D_1Qt16u.js","assets/share-CS1dKayZ.js","assets/external-links-BcKDmn29.js","assets/publishing-CpVLG7_B.js","assets/publishing-VJhUmdPH.css"])))=>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 sd="modulepreload",rd=function(e){return"/"+e},Di={},lr=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=rd(c),c in Di)return;Di[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":sd,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 Ja=(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=Ja(...r);s.appendChild(o)}),s};var Xa=([e,t,n])=>Ja(e,t,n);const od=e=>Array.from(e.attributes).reduce((t,n)=>(t[n.name]=n.value,t),{}),id=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:"",ad=e=>e.flatMap(id).map(n=>n.trim()).filter(Boolean).filter((n,s,r)=>r.indexOf(n)===s).join(" "),cd=e=>e.replace(/(\w)(\w*)(_|-|\s*)/g,(t,n,s)=>n.toUpperCase()+s.toLowerCase()),Ri=(e,{nameAttr:t,icons:n,attrs:s})=>{const r=e.getAttribute(t);if(r==null)return;const o=cd(r),i=n[o];if(!i)return console.warn(`${e.outerHTML} icon name was not found in the provided icons object.`);const a=od(e),[l,c,f]=i,u={...c,"data-lucide":r,...s,...a},h=ad(["lucide",`lucide-${r}`,a,s]);h&&Object.assign(u,{class:h});const p=Xa([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 ld=["svg",K,[["path",{d:"M5 12h14"}],["path",{d:"m12 5 7 7-7 7"}]]];const dd=["svg",K,[["path",{d:"M7 7h10v10"}],["path",{d:"M7 17 17 7"}]]];const ud=["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 fd=["svg",K,[["path",{d:"m6 9 6 6 6-6"}]]];const hd=["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 pd=["svg",K,[["circle",{cx:"12",cy:"12",r:"10"}],["polyline",{points:"12 6 12 12 16 14"}]]];const gd=["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 md=["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 vd=["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 yd=["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 bd=["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 wd=["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 Ed=["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 xd=["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 Sd=["svg",K,[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56"}]]];const $d=["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 Id=["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 Cd=["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 Td=["svg",K,[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M15 3v18"}]]];const kd=["svg",K,[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M3 9h18"}],["path",{d:"M9 21V9"}]]];const Ad=["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 Ld=["svg",K,[["polygon",{points:"6 3 20 12 6 21 6 3"}]]];const Od=["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 Md=["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 Dd=["svg",K,[["circle",{cx:"11",cy:"11",r:"8"}],["path",{d:"m21 21-4.3-4.3"}]]];const Rd=["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 Pd=["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 Vd=["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 Qa=["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 Nd=["svg",K,[["polyline",{points:"4 17 10 11 4 5"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19"}]]];const ec=["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 Fd=["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 Hd=["svg",K,[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]]];const _d=({icons:e={},nameAttr:t="data-lucide",attrs:n={}}={})=>{if(!Object.values(e).length)throw new Error(`Please provide an icons object.
3
- If you want to use all the icons you can import it like:
4
- \`import { createIcons, icons } from 'lucide';
5
- lucide.createIcons({icons});\``);if(typeof document>"u")throw new Error("`createIcons()` only works in a browser environment.");const s=document.querySelectorAll(`[${t}]`);if(Array.from(s).forEach(r=>Ri(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=>Ri(o,{nameAttr:"icon-name",icons:e,attrs:n})))}},Pi=["#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 qs(e).split("/").at(-1)||"/"}const qs=e=>(/^(?:[a-z]:[\\/]|\\\\)/i.test(e)?e.replace(/\\/g,"/"):e).replace(/\/+$/,"")||(e.startsWith("/")?"/":""),Cn=e=>e.directory?JSON.stringify(["directory",qs(e.directory)]):JSON.stringify(["project",e.source||"opencode",e.projectID||e.id]),dn=e=>Math.max(e.created,e.activity?.lastMessageAt||e.created),ao=(e,t)=>{const n=t.timeFrame||t;return(e-n.start)/Math.max(1,n.end-n.start)*300-150},Qv=(e,t)=>ao(t.start+(t.end-t.start)*e,t),_o=(e,t)=>[t,e.position[1],e.position[2]],Bd=(e,t)=>_o(e,Math.max(e.startPosition[0],Math.min(t,e.position[0]))),ey=(e,t,n,s=0,r=[1,0,0])=>{const o=Bd(e,t);return[o[0]+r[0]*(n+s),o[1]+r[1]*(n+s),o[2]+r[2]*(n+s)]},ty=(e,t)=>[_o(e,Math.max(e.startPosition[0],Math.min(t.startPosition[0],e.position[0]))),t.startPosition];function jd(e,t,n){if(!e.length)return{nodes:[],edges:[],lanes:[],start:0,end:0};const s=[...e].sort((E,O)=>E.created-O.created||E.id.localeCompare(O.id)),r=s[0].created,o=s.reduce((E,O)=>Math.max(E,dn(O)),r+36e5),i=n?.nodes.length?n.timeFrame||{start:n.start,end:n.end}:{start:r,end:o},a=new Map;for(const E of s){const O=Cn(E),M=a.get(O)||[];M.push(E),a.set(O,M)}const l=[...a].sort((E,O)=>O[1].length-E[1].length||E[0].localeCompare(O[0])),c=new Map(n?.lanes.map((E,O)=>[E.key,E.slot??O]));let f=Math.max(-1,...c.values())+1;for(const[E]of l)c.has(E)||c.set(E,f++);l.sort((E,O)=>c.get(E[0])-c.get(O[0]));const u=[],h=[],p=new Set(t.flatMap(E=>E.worktrees.map(qs)));l.forEach(([E,O])=>{const M=c.get(E),D=M*2.399963,w=M===0?0:15+Math.sqrt(M)*14,S=Math.cos(D)*w,x=Math.sin(D)*w*.7,T=Pi[M%Pi.length],b=t.find(V=>V.id===O[0].projectID),A=O[0].directory,R={key:E,slot:M,label:A?Yn(A):b?.name||O[0].projectID||"Unknown directory",color:T,kind:A&&p.has(qs(A))?"worktree":"directory",y:S,z:x,nodes:[]};for(const V of O){const H=ao(dn(V),i),Z=ao(V.created,i),re=In(V.id),W=!!(V.parentID||V.forkID)?12:6,we=Math.sin((Z+150)/65+M*.7)*3.5,Dt=typeof V.tokens=="number"&&Number.isFinite(V.tokens)?Math.max(0,V.tokens):0,$e={session:V,position:[H,S+we+(re-.5)*W,x+(In(V.id+"z")-.5)*W],startPosition:[Z,0,0],color:T,radius:.35+Math.min(.9,Math.log10(1+Dt)*.11)};h.push($e),R.nodes.push($e)}u.push(R)});const g=new Set(s.map(E=>E.id)),d=[];for(const E of s)E.forkID&&g.has(E.forkID)?d.push({from:E.forkID,to:E.id,kind:"fork"}):E.parentID&&g.has(E.parentID)&&d.push({from:E.parentID,to:E.id,kind:"child"});const m=new Map(h.map(E=>[E.session.id,E])),y=new Set;for(const E of n?.nodes||[]){const O=m.get(E.session.id);O&&Cn(O.session)===Cn(E.session)&&(O.position[1]=E.position[1],O.position[2]=E.position[2],y.add(O.session.id))}function C(E){const O=[],M=new Set;let D=E;for(;D&&!y.has(D.session.id)&&!M.has(D.session.id);){M.add(D.session.id);const w=D.session.forkID||D.session.parentID,S=w?m.get(w):void 0,x=S&&Cn(S.session)===Cn(D.session)?S:void 0;O.push({node:D,parent:x}),D=x}for(const{node:w,parent:S}of O.reverse()){const x=w.session.id;if(S){const T=In(x+"branch")>.5?1:-1;w.position[1]=S.position[1]+T*(9+In(x)*15),w.position[2]=S.position[2]+(In(x+"depth")-.5)*18}y.add(x)}}return s.forEach(E=>C(m.get(E.id))),h.forEach(E=>{E.startPosition=_o(E,E.startPosition[0])}),{nodes:h,edges:d,lanes:u,start:r,end:o,timeFrame:i}}function Wd(){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 Ud=2,Vi=e=>JSON.stringify([Ud,e.revision,e.updated,e.created,e.projectID,e.directory]),un=e=>e.normalize("NFKD").replace(new RegExp("\\p{M}","gu"),"").toLowerCase(),Bo=e=>un(e).match(/[\p{L}\p{N}]+/gu)||[],qd=e=>Bo(e).join(" ");function Gd(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(qd(o)),n.push(o)}return t.text=n.join(" "),t.terms=Bo(t.text).slice(0,12),t.text=t.terms.join(" "),t}function Yd(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 jo={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"}},Le=e=>jo[e||"opencode"]?.name||e||"Unknown",ny=e=>typeof e=="string"&&Object.hasOwn(jo,e),qe=e=>{const t=jo[e||""]?.icon||"generic";return`<span class="source-icon source-icon-${t}" aria-hidden="true" style="--source-icon:url('/sources/${t}.svg')"></span>`},tc=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)),Vt=e=>e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]);function nc(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="${Vt(e.id)}" title="${Vt(i)}"><input ${s?'class="settings-source"':""} type="checkbox" value="${Vt(e.id)}" aria-label="${Vt(e.name)}" aria-description="${Vt(`${r}. ${e.sessions.toLocaleString()} saved sessions. ${i}`)}" ${t?"checked":""} ${n?"disabled":""}/><span class="source-symbol">${qe(e.id)}</span><span class="source-copy"><strong>${Vt(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">${Vt(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 Kd(e,t=()=>{},n){const s=new Worker(new URL("/assets/worker-C10U_apJ.js",import.meta.url),{type:"module"}),r=new AbortController,o={signal:r.signal},i=document.createElement("dialog");i.className="search-dialog",i.setAttribute("aria-label","Search sessions"),i.innerHTML=`
6
- <div class="search-command"><span class="search-command-icon" aria-hidden="true">⌕</span><input id="session-query" type="search" placeholder="Search sessions, messages, files…" autocomplete="off" spellcheck="false" role="combobox" aria-label="Search all sessions" aria-autocomplete="list" aria-expanded="true" aria-controls="search-results"/><button class="icon-button search-close" aria-label="Close search" title="Close (Esc)">×</button></div>
7
- <div class="search-options"><select id="search-scope" aria-label="Search scope" title="Switch scope (Alt+S)"><option value="all">All history</option><option value="view">Current view</option></select><button id="search-conversations" class="search-chip" aria-label="Index conversations" aria-pressed="true" title="Pause or resume background indexing. Indexed messages, tools, and files remain searchable.">Conversations</button><span id="search-index-state" role="status">Loading index…</span></div>
8
- <div class="search-body"><div id="search-results" class="search-results" role="listbox" aria-label="Matching sessions"><div class="search-results-inner"></div></div><aside id="search-preview" class="search-preview" aria-label="Session preview"></aside></div>
9
- <div class="search-footer"><span id="search-result-status" role="status">Loading sessions…</span><button id="search-more" hidden>More results</button><details class="search-syntax"><summary title="Search filters and cache">Filters</summary><div><code>project:sessiongraph</code><code>model:claude</code><code>in:files package.json</code><code>is:fork</code><code>after:2026-09-01</code><code>"exact phrase"</code><button id="search-clear-cache" title="Clear saved search text and pause indexing. Titles remain searchable; enable Conversations to rebuild.">Clear saved index</button></div></details><span class="search-keys"><kbd>↑↓</kbd> navigate <kbd>↵</kbd> open</span></div>`,document.body.append(i);const a=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,C=0,E=0,O=80,M=0,D=0,w=0,S=!1,x=!1,T=!0,b,A=null,R,V=0,H="",Z="",re=!1;const J=new Map,W=86,we=v=>s.postMessage(v);function Dt(){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||(S?"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 de=`${Le(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="${C}" 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>${qe(G.source)}${Ce(de)}</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 ze(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:Bo(Gd(l.value).text),de=v?.fragments.filter(ie=>{const He=un(ie.text);return G.length&&G.every(_e=>He.includes(_e))}).slice(0,4)||[],Re=v?.fragments.filter(ie=>["You","Assistant"].includes(ie.kind)).slice(0,5).reverse()||[],Fe=de.length?de:Re;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>${de.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>':Fe.length?Fe.map(ie=>`<article><span>${Ce(ie.kind)}</span><p>${Tn(Yd(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=`${qe(U.source)}Open in ${Ce(Le(U.source))} ↗`,ie.addEventListener("click",()=>n(U),o),u.querySelector(".search-preview-heading")?.append(ie)}u.querySelector(".preview-retry")?.addEventListener("click",()=>{H="",Rt()},o)}function Rt(){const v=m[y],I=v&&p.get(v.id),F=I?`${I.id}:${Vi(I)}:${l.value}`:"";if(F===H)return;if(H=F,window.clearTimeout(V),R?.abort(),!I){ze();return}const Q=`${I.id}:${Vi(I)}`,U=J.get(Q);if(U){ze(U);return}ze(void 0,!0),V=window.setTimeout(async()=>{const G=new AbortController;R=G;try{const de=await fetch(`/api/sessiongraph/session/${encodeURIComponent(I.id)}/content?updated=${I.updated}`,{signal:G.signal});if(!de.ok)throw new Error("Preview unavailable");const Re=await de.json();if(G.signal.aborted||F!==H)return;J.size>=25&&J.delete(J.keys().next().value),J.set(Q,Re),ze(Re)}catch{!G.signal.aborted&&F===H&&ze(void 0,!1,!0)}},90)}function Zt(){cancelAnimationFrame(M),S=!0,l.setAttribute("aria-busy","true");const v=++E;D=performance.now(),M=requestAnimationFrame(()=>we({type:"query",request:v,text:l.value,viewOnly:h.value==="view",limit:O}))}function bt(){y=0,re=!1,O=80,c.scrollTop=0,H="",Zt()}function Pt(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(),Rt()}function wt(){i.close(),t(!1),R?.abort(),window.clearTimeout(V),H="",A?.focus({preventScroll:!0})}function $n(){const v=m[y];!v||S||(wt(),e(v.id))}function L(){i.open||(A=document.activeElement,i.showModal()),t(!0),l.focus({preventScroll:!0}),l.select(),Zt(),T&&we({type:"warm",enabled:!0})}s.onmessage=v=>{const I=v.data;if(I.type==="status"){b=I.status,Dt();return}if(I.type==="error"){Z=I.message,S=!1,l.setAttribute("aria-busy","false"),$e();return}if(I.request!==E)return;const F=m[y]?.id;w=S?performance.now()-D:w,S=!1,l.setAttribute("aria-busy","false"),m=I.hits,C=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||`${C.toLocaleString()} ${l.value?"matches":"sessions"} · ${Math.round(I.elapsed)} ms`,a("#search-more").hidden=m.length>=C||O>=250,i.open&&($e(),Rt())},s.onerror=()=>{Z="Search could not start. Reload to retry.",S=!1,$e()},l.addEventListener("input",()=>{x||bt()},o),l.addEventListener("compositionstart",()=>{x=!0},o),l.addEventListener("compositionend",()=>{x=!1,bt()},o),h.addEventListener("change",bt,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(),Rt(),l.focus())},o),c.addEventListener("dblclick",$n,o),a("#search-more").addEventListener("click",()=>{O=Math.min(250,O+80),Zt()},o),a("#search-conversations").addEventListener("click",()=>{T=!T,a("#search-conversations").setAttribute("aria-pressed",String(T)),we({type:"warm",enabled:T}),Dt()},o),a("#search-clear-cache").addEventListener("click",()=>{T=!1,a("#search-conversations").setAttribute("aria-pressed","false"),J.clear(),H="",R?.abort(),window.clearTimeout(V),a(".search-syntax").open=!1,we({type:"clear-cache"}),l.focus()},o),a(".search-close").addEventListener("click",wt,o),i.addEventListener("cancel",v=>{v.preventDefault(),wt()},o),i.addEventListener("keydown",v=>{v.stopPropagation(),!(x||v.isComposing)&&((v.key==="ArrowDown"||v.key==="ArrowUp")&&(v.preventDefault(),Pt(v.key==="ArrowDown"?1:-1)),(v.key==="PageDown"||v.key==="PageUp")&&(v.preventDefault(),Pt((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(),wt()),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 $=new ResizeObserver(()=>{i.open&&$e()});return $.observe(c),{open:L,setData(v){d!==v.sourceID&&(J.clear(),H="",R?.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])),we({type:"data",sessions:v.sessions,projects:v.projects,sourceID:d})},setScope(v){we({type:"scope",ids:v})},diagnostics:()=>({open:i.open,query:l.value,matches:C,renderedRows:f.querySelectorAll('[role="option"]').length,roundTripMs:w,pending:S,index:b}),dispose(){s.terminate(),r.abort(),$.disconnect(),R?.abort(),window.clearTimeout(V),cancelAnimationFrame(M),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"}],Or=e=>Hn.some(t=>t.id===e),sc=e=>/^ses[a-zA-Z0-9_-]+$/.test(e);function zd(e,t){if(!sc(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(Zd(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(),Zd=e=>e.length===0,Jd=sn("select").parts("label","positioner","trigger","indicator","clearTrigger","item","itemText","itemIndicator","itemGroup","itemGroupLabel","list","content","root","control","valueText"),ve=Jd.build(),Xd=Object.defineProperty,Qd=(e,t,n)=>t in e?Xd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_=(e,t,n)=>Qd(e,typeof t!="symbol"?t+"":t,n);function eu(e){return e==null?[]:Array.isArray(e)?e:[e]}var tu=e=>e[e.length-1],nu=(e,t)=>e.indexOf(t)!==-1,su=(e,...t)=>e.concat(t),ru=(e,...t)=>e.filter(n=>!t.includes(n)),Ni=(e,t)=>nu(e,t)?ru(e,t):su(e,t);function Fi(e,t){return e.reduce((n,s,r)=>(r%t===0?n.push([s]):tu(n)?.push(s),n),[])}var Hi=e=>e?.constructor.name==="Array",ou=(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(Hi(e)&&Hi(t))return ou(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},iu=e=>Array.isArray(e),rc=e=>e!=null&&typeof e=="object",Mr=e=>rc(e)&&!iu(e),au=e=>typeof e=="string",Qe=e=>typeof e=="function",cu=e=>e==null,Ms=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),lu=e=>Object.prototype.toString.call(e),oc=Function.prototype.toString,du=oc.call(Object),_n=e=>{if(!rc(e)||lu(e)!="[object Object]"||hu(e))return!1;const t=Object.getPrototypeOf(e);if(t===null)return!0;const n=Ms(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&oc.call(n)==du},uu=e=>typeof e=="object"&&e!==null&&"$$typeof"in e&&"props"in e,fu=e=>typeof e=="object"&&e!==null&&"__v_isVNode"in e,hu=e=>uu(e)||fu(e),_i=(e,...t)=>(typeof e=="function"?e(...t):e)??void 0,pu=e=>e(),ic=()=>{},Gs=(...e)=>(...t)=>{e.forEach(function(n){n?.(...t)})};function co(e,t,...n){if(e in t){const r=t[e];return Qe(r)?r(...n):r}const s=new Error(`No matching key: ${JSON.stringify(e)} in ${JSON.stringify(Object.keys(t))}`);throw Error.captureStackTrace?.(s,co),s}var{min:gu,max:mu}=Math,vu=e=>Number.isNaN(e),ac=e=>vu(e)?0:e,Dr=(e,t,n)=>{const s=ac(e),r=t==null||s>=t,o=n==null||s<=n;return r&&o},yu=(e,t,n)=>gu(mu(ac(e),t),n);function Wo(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]=Wo(r))}return n}function cc(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 Ds(...e){e.length===1?e[0]:e[1],e.length===2&&e[0]}function Bi(...e){e.length===1?e[0]:e[1],e.length===2&&e[0]}function dr(e,t){if(e==null)throw new Error(t())}var Rs={itemToValue(e){return typeof e=="string"?e:Mr(e)&&Ms(e,"value")?e.value:""},itemToString(e){return typeof e=="string"?e:Mr(e)&&Ms(e,"label")?e.label:Rs.itemToValue(e)},isItemDisabled(e){return Mr(e)&&Ms(e,"disabled")?!!e.disabled:!1}},lc=class dc{constructor(t){_(this,"options",t),_(this,"items"),_(this,"indexMap",null),_(this,"copy",n=>new dc({...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)??Rs.itemToValue(n)),_(this,"getItemDisabled",n=>n==null?!1:this.options.isItemDisabled?.(n)??Rs.isItemDisabled(n)),_(this,"stringifyItem",n=>n==null?null:this.options.itemToString?.(n)??Rs.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)&&bu(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(ps(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(ps(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(ps(this.items,o,r+1))}),_(this,"reorder",(n,s)=>this.copy(ps(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}},bu=(e,t)=>!!e?.toLowerCase().startsWith(t.toLowerCase());function kn(e,t,...n){return[...e.slice(0,t),...n,...e.slice(t)]}function ps(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 uc({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 fc({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 gs({values:e,collection:t,selectedItemMap:n}){const s=uc({values:e,collection:t,selectedItemMap:n}),r=fc({selectedItemMap:n,values:e,selectedItems:s,collection:t});return{selectedItems:s,nextSelectedItemMap:r}}function wu({selectedItems:e,collection:t}){return fc({selectedItemMap:new Map,values:e.map(n=>t.getItemValue(n)).filter(Boolean),selectedItems:e,collection:t})}var Ys=e=>new lc(e);Ys.empty=()=>new lc({items:[]});var Eu=Object.defineProperty,xu=(e,t,n)=>t in e?Eu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rr=(e,t,n)=>xu(e,typeof t!="symbol"?t+"":t,n),Su=(e,t)=>e.map((n,s)=>e[(Math.max(t,0)+s)%e.length]),Ks=()=>{},ur=e=>typeof e=="object"&&e!==null,P=e=>e?"":void 0,he=e=>e?"true":void 0,$u=1,Iu=9,Cu=11,fe=e=>ur(e)&&e.nodeType===$u&&typeof e.nodeName=="string",Uo=e=>ur(e)&&e.nodeType===Iu,Tu=e=>ur(e)&&e===e.window,hc=e=>fe(e)?e.localName||"":"#document";function ku(e){return["html","body","#document"].includes(hc(e))}var pc=e=>ur(e)&&e.nodeType!==void 0,fn=e=>pc(e)&&e.nodeType===Cu&&"host"in e,gc=e=>fe(e)&&e.localName==="input",Au=e=>fe(e)?e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0:!1;function lo(e){if(!e)return!1;const t=e.getRootNode();return fr(t)===e}var Lu=/(textarea|select)/;function Ou(e){if(e==null||!fe(e))return!1;try{return gc(e)&&e.selectionStart!=null||Lu.test(e.localName)||e.isContentEditable||e.getAttribute("contenteditable")==="true"||e.getAttribute("contenteditable")===""}catch{return!1}}function hn(e,t){if(!e||!t||!fe(e)||!pc(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 De(e){return Uo(e)?e:Tu(e)?e.document:e?.ownerDocument??document}function Mu(e){return De(e).documentElement}function me(e){return fn(e)?me(e.host):Uo(e)?e.defaultView??window:fe(e)?e.ownerDocument?.defaultView??window:window}function fr(e){let t=e.activeElement;for(;t?.shadowRoot;){const n=t.shadowRoot.activeElement;if(!n||n===t)break;t=n}return t}function ji(e,t){return!e||e===De(e).body?!1:!t.some(n=>hn(n,e))}function Du(e){if(hc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||fn(e)&&e.host||Mu(e);return fn(t)?t.host:t}function Ru(e){let t;try{if(t=e.getRootNode({composed:!0}),Uo(t)||fn(t))return t}catch{}return e.ownerDocument??document}var Pr=new WeakMap;function mc(e){return Pr.has(e)||Pr.set(e,me(e).getComputedStyle(e)),Pr.get(e)}var qo=()=>typeof document<"u";function Pu(){return navigator.userAgentData?.platform??navigator.platform}function Vu(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}var Go=e=>qo()&&e.test(Pu()),Nu=e=>qo()&&e.test(Vu()),Fu=/^iPhone/i,Hu=/^iPad/i,_u=/^Mac/i,Bu=/Android/i,Wi=()=>qo()&&!!navigator.maxTouchPoints,ju=()=>Go(Fu),Wu=()=>Go(Hu)||Yo()&&navigator.maxTouchPoints>1,vc=()=>ju()||Wu(),Yo=()=>Go(_u),Uu=()=>Nu(Bu),qu=new Set(["menu","listbox","dialog","grid","tree","region","application"]),Gu=e=>qu.has(e),Yu=e=>e.getAttribute("aria-controls")?.split(" ")||[];function Ku(e,t){const n=new Set,s=Ru(e),r=o=>{const i=o.querySelectorAll("[aria-controls]");for(const a of i){if(a.getAttribute("aria-expanded")!=="true")continue;const l=Yu(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&&Gu(u)&&!h&&(f===t||f.contains(t)||r(f)))return!0}}}return!1};return r(e)}function zu(e){return e.composedPath?.()??e.nativeEvent?.composedPath?.()}function ht(e){return zu(e)?.[0]??e.target}function Zu(e){return Ko(e).isComposing||e.keyCode===229}function Ju(e){return e.pointerType===""&&e.isTrusted?!0:Uu()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}var Xu=e=>e.button===2||Yo()&&e.ctrlKey&&e.button===0,Qu={Up:"ArrowUp",Down:"ArrowDown",Esc:"Escape"," ":"Space",",":"Comma",Left:"ArrowLeft",Right:"ArrowRight"},Ui={ArrowLeft:"ArrowRight",ArrowRight:"ArrowLeft"};function uo(e,t={}){const{dir:n="ltr",orientation:s="horizontal"}=t;let r=e.key;return r=Qu[r]??r,n==="rtl"&&s==="horizontal"&&r in Ui&&(r=Ui[r]),r}function Ko(e){return e.nativeEvent??e}var Ps=(e,t,n,s)=>{const r=typeof e=="function"?e():e;return r?.addEventListener(t,n,s),()=>{r?.removeEventListener(t,n,s)}};function ef(e,t){const{type:n="HTMLInputElement",property:s="value"}=t,r=me(e)[n].prototype;return Object.getOwnPropertyDescriptor(r,s)??{}}function tf(e){if(e.localName==="input")return"HTMLInputElement";if(e.localName==="textarea")return"HTMLTextAreaElement";if(e.localName==="select")return"HTMLSelectElement"}function ms(e,t,n="value"){if(!e)return;const s=tf(e);s&&ef(e,{type:s,property:n}).set?.call(e,t),e.setAttribute(n,t)}function nf(e){return e.matches("textarea, input, select, button")}function sf(e,t){if(!e)return;const n=nf(e)?e.form:e.closest("form"),s=r=>{r.defaultPrevented||t()};return n?.addEventListener("reset",s,{passive:!0}),()=>n?.removeEventListener("reset",s)}function rf(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 of(e,t){if(!e)return;const{onFieldsetDisabledChange:n,onFormReset:s}=t,r=[sf(e,s),rf(e,n)];return()=>r.forEach(o=>o?.())}var yc=Symbol.for("zag.changeEvent");function bc(e){return Object.prototype.hasOwnProperty.call(e,yc)}function af(e){return bc(e)||Object.defineProperty(e,yc,{value:!0}),e}var cf=e=>fe(e)&&e.tagName==="IFRAME";function lf(e){const t=e.getAttribute("tabindex");return t?parseInt(t,10):NaN}var df=e=>lf(e)<0;function uf(e){return gc(e)&&e.type==="radio"}function ff(e){if(!uf(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&&hr(o)),r=s.find(o=>o.checked);return r?r===e:s[0]===e}function hf(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 pf(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=hf(l,t);if(c){const f=Array.from(c.querySelectorAll(zo)).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 zo="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 hr(e){return!fe(e)||e.closest("[inert]")?!1:e.matches(zo)&&Au(e)}function Zo(e,t={}){if(!e)return[];const{includeContainer:n,getShadowRoot:s}=t,r=Array.from(e.querySelectorAll(zo));n&&Vr(e)&&r.unshift(e);const o=[];for(const i of r)if(Vr(i)){if(cf(i)&&i.contentDocument){const a=i.contentDocument.body;o.push(...Zo(a,{getShadowRoot:s}));continue}o.push(i)}if(s){const i=pf(o,s,Vr);return!i.length&&n?r:i}return!o.length&&n?r:o}function Vr(e){return fe(e)&&e.tabIndex>0?!0:!hr(e)||df(e)?!1:ff(e)}function gf(e,t={}){const n=Zo(e,t),s=n[0]||null,r=n[n.length-1]||null;return[s,r]}function mf(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=Zo(t).filter(a=>s?s(a):!0).find(a=>!a.hasAttribute("data-no-autofocus"))),o||t||void 0)}function vf(e){const t=e.currentTarget;if(!t)return!1;const[n,s]=gf(t);return!(lo(n)&&e.shiftKey||lo(s)&&!e.shiftKey||!n&&!s)}var wc=class Ec{constructor(){Rr(this,"id",null),Rr(this,"fn_cleanup"),Rr(this,"cleanup",()=>{this.cancel()})}static create(){return new Ec}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=wc.create();return t.request(e),t.cleanup}function xc(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 Nr=new WeakMap;function yf(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 bf(e){const t=yf(e),n=JSON.stringify(t);return{observe(s,r){const o=me(s);if(typeof o.MutationObserver!="function")return Ks;const i=Nr.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),Nr.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&&Nr.delete(s))}}}}function wf(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 Ef(e,t){const n=pe,s=[];return s.push(n(()=>{const r=typeof e=="function"?e():e;s.push(wf(r,t))})),()=>{s.forEach(r=>r?.())}}function fo(e){const t=Du(e);return ku(t)?De(t).body:fe(t)&&$f(t)?t:fo(t)}var xf=/auto|scroll|overlay|hidden|clip/,Sf=new Set(["inline","contents"]);function $f(e){const t=me(e),{overflow:n,overflowX:s,overflowY:r,display:o}=t.getComputedStyle(e);return xf.test(n+r+s)&&!Sf.has(o)}var qi=/auto|scroll|overlay|hidden/;function If(e,t={}){const{axis:n}=t,{overflowX:s,overflowY:r}=me(e).getComputedStyle(e),o=n!=="y"&&qi.test(s)&&e.scrollWidth>e.clientWidth,i=n!=="x"&&qi.test(r)&&e.scrollHeight>e.clientHeight;return o||i}var rn="default",ho="",Vs=new WeakMap;function Cf(e={}){const{target:t,doc:n}=e,s=n??document,r=s.documentElement;return vc()?(rn==="default"&&(ho=r.style.webkitUserSelect,r.style.webkitUserSelect="none"),rn="disabled"):t&&(Vs.set(t,t.style.userSelect),t.style.userSelect="none"),()=>Sc({target:t,doc:s})}function Sc(e={}){const{target:t,doc:n}=e,r=(n??document).documentElement;if(vc()){if(rn!=="disabled")return;rn="restoring",setTimeout(()=>{xc(()=>{rn==="restoring"&&(r.style.webkitUserSelect==="none"&&(r.style.webkitUserSelect=ho||""),ho="",rn="default")})},300)}else if(t&&Vs.has(t)){const o=Vs.get(t);t.style.userSelect==="none"&&(t.style.userSelect=o??""),t.getAttribute("style")===""&&t.removeAttribute("style"),Vs.delete(t)}}function Tf(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(Cf({...s,target:i}))})),()=>{o.forEach(i=>i?.())}}function kf(e,t){return Array.from(e?.querySelectorAll(t)??[])}function Af(e,t){return e?.querySelector(t)??null}var Jo=e=>e.id;function Lf(e,t,n=Jo){return e.find(s=>n(s)===t)}function Of(e,t,n=Jo){const s=Lf(e,t,n);return s?e.indexOf(s):-1}function Mf(e,t){const{rootEl:n,...s}=t||{};!e||!n||If(n)&&e.scrollIntoView(s)}var Gi,Df=()=>Gi??(Gi=new Intl.Collator(void 0,{usage:"search",sensitivity:"base"})),Rf=e=>e.normalize("NFC").trim(),Pf=e=>Rf(e.dataset?.valuetext??e.textContent??""),Vf=(e,t)=>{const n=t.normalize("NFC");return Df().compare(e.slice(0,n.length),n)===0};function Nf(e,t,n,s=Jo){const r=n?Of(e,n,s):-1;let o=n?Su(e,r):e;return t.length===1&&(o=o.filter(a=>s(a)!==n)),o.find(a=>Vf(Pf(a),t))}function Ff(e,t){if(!e)return Ks;const n=Object.keys(t).reduce((s,r)=>(s[r]=e.style.getPropertyValue(r),s),{});return Hf(n,t)?Ks:(Object.assign(e.style,t),()=>{Object.assign(e.style,n),e.style.length===0&&e.removeAttribute("style")})}function Hf(e,t){return Object.keys(e).every(n=>e[n]===t[n])}function _f(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=Nf(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 po=Object.assign(_f,{defaultOptions:{keysSoFar:"",timer:-1},isValidEvent:Bf});function Bf(e){return e.key.length===1&&!e.ctrlKey&&!e.metaKey}var jf={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 Wf(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 Uf(e,t){const{timeout:n,rootNode:s}=t,r=me(s),o=De(s),i=new r.AbortController;let a;const l=Wf(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 qf=bf({});function Gf(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?qf.observe(p,()=>{const m=i();m&&h(m)}):Ks,d=pe(()=>h(i()));a.push(g,d)})}return()=>{a.forEach(c=>c?.())}}function Yf(e){return!(e.metaKey||!Yo()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}var Kf=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),zf=["a[href]","audio[controls]","button","details","embed","iframe","img[controls]","img[usemap]","input","select","textarea","video[controls]"].join(",");function Zf(e,t,n){const s=n?ht(n):null,r=De(s),o=me(s),i=fr(r);return e=e||i instanceof o.HTMLInputElement&&!Kf.has(i?.type)||i instanceof o.HTMLTextAreaElement||i instanceof o.HTMLElement&&i.isContentEditable,!(e&&t==="keyboard"&&n instanceof o.KeyboardEvent&&!Reflect.has(Xf,n.key))}var pt=null,go=new Set,zs=new Map,Wt=!1,$t=null,mo=!1,Fr=null,Jf=!1,Xf={Tab:!0,Escape:!0};function pr(e,t){for(let n of go)n(e,t)}function Zs(e){$t=null,Wt=!0,Yf(e)&&(pt="keyboard",pr("keyboard",e))}function Te(e){(e.type==="pointermove"||e.type==="mousemove")&&e.isTrusted&&Fr?.x===e.clientX&&Fr?.y===e.clientY||(Fr={x:e.clientX,y:e.clientY},pt="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&($t=null,Wt=!0,pr("pointer",e)))}function $c(e){if(Ju(e)){$t=null,Wt=!0,pt="virtual";return}$t=null;const t=ht(e),n=t?.closest("label"),s=n?.control;if(!n||!s||s.matches(":disabled"))return;const r=t?.closest(zf);r&&n.contains(r)&&r!==s||s!==fr(n.ownerDocument)&&($t=s)}function Ic(e){const t=ht(e),n=t===$t;t===me(t)||t===De(t)||Jf||!e.isTrusted||(!Wt&&!n&&!mo&&(pt="virtual",pr("virtual",e)),Wt=!1,$t=null,mo=!1)}function Cc(){Wt=!1,$t=null,mo=!0}function Qf(e){try{return e.focus}catch{return}}function eh(e){const t=e.HTMLElement.prototype;try{let s=function(){Wt=!0,(r??i.call(this)).apply(this,arguments)};var n=s;const r=Qf(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 th(e){if(typeof window>"u"||zs.get(me(e)))return;const t=me(e),n=De(e),s=eh(t);n.addEventListener("keydown",Zs,!0),n.addEventListener("keyup",Zs,!0),n.addEventListener("click",$c,!0),t.addEventListener("focus",Ic,!0),t.addEventListener("blur",Cc,!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",()=>{nh(e)},{once:!0}),zs.set(t,s)}var nh=(e,t)=>{const n=me(e),s=De(e),r=zs.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",$c,!0),n.removeEventListener("focus",Ic,!0),n.removeEventListener("blur",Cc,!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)),zs.delete(n)}};function vo(){return pt}function sh(e){pt=e,pr(e,null)}function Yi(){return pt==="keyboard"||pt==="virtual"}function rh(e={}){const{isTextInput:t,autoFocus:n,onChange:s,root:r}=e;th(r),s?.({isFocusVisible:n||Yi(),modality:pt});const o=(i,a)=>{Zf(!!t,i,a)&&s?.({isFocusVisible:Yi(),modality:i})};return go.add(o),()=>{go.delete(o)}}const oh=["top","right","bottom","left"],Tt=Math.min,ot=Math.max,Js=Math.round,vs=Math.floor,it=e=>({x:e,y:e}),ih={left:"right",right:"left",bottom:"top",top:"bottom"};function Tc(e,t,n){return ot(e,Tt(t,n))}function gt(e,t){return typeof e=="function"?e(t):e}function kt(e){return e.split("-")[0]}function wn(e){return e.split("-")[1]}function Xo(e){return e==="x"?"y":"x"}function Qo(e){return e==="y"?"height":"width"}function je(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function ei(e){return Xo(je(e))}function ah(e,t,n){n===void 0&&(n=!1);const s=wn(e),r=ei(e),o=Qo(r);let i=r==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=Xs(i)),[i,Xs(i)]}function ch(e){const t=Xs(e);return[yo(e),t,yo(t)]}function yo(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Ki=["left","right"],zi=["right","left"],lh=["top","bottom"],dh=["bottom","top"];function uh(e,t,n){switch(e){case"top":case"bottom":return n?t?zi:Ki:t?Ki:zi;case"left":case"right":return t?lh:dh;default:return[]}}function fh(e,t,n,s){const r=wn(e);let o=uh(kt(e),n==="start",s);return r&&(o=o.map(i=>i+"-"+r),t&&(o=o.concat(o.map(yo)))),o}function Xs(e){const t=kt(e);return ih[t]+e.slice(t.length)}function hh(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 kc(e){return typeof e!="number"?hh(e):{top:e,right:e,bottom:e,left:e}}function Qs(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 Zi(e,t,n){let{reference:s,floating:r}=e;const o=je(t),i=ei(t),a=Qo(i),l=kt(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 ph(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}=gt(t,e),g=kc(p),m=a[h?u==="floating"?"reference":"floating":u],y=Qs(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})),C=u==="floating"?{x:s,y:r,width:i.floating.width,height:i.floating.height}:i.reference,E=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),O=await(o.isElement==null?void 0:o.isElement(E))&&await(o.getScale==null?void 0:o.getScale(E))||{x:1,y:1},M=Qs(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:C,offsetParent:E,strategy:l}):C);return{top:(y.top-M.top+g.top)/O.y,bottom:(M.bottom-y.bottom+g.bottom)/O.y,left:(y.left-M.left+g.left)/O.x,right:(M.right-y.right+g.right)/O.x}}const gh=50,mh=async(e,t,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:o=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:ph},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}=Zi(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:C}=m,{x:E,y:O,data:M,reset:D}=await C({x:f,y:u,initialPlacement:s,placement:h,strategy:r,middlewareData:g,rects:c,platform:a,elements:{reference:e,floating:t}});f=E??f,u=O??u,g[y]={...g[y],...M},D&&p<gh&&(p++,typeof D=="object"&&(D.placement&&(h=D.placement),D.rects&&(c=D.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):D.rects),{x:f,y:u}=Zi(c,h,l)),d=-1)}return{x:f,y:u,placement:h,strategy:r,middlewareData:g}},vh=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}=gt(e,t)||{};if(c==null)return{};const u=kc(f),h={x:n,y:s},p=ei(r),g=Qo(p),d=await i.getDimensions(c),m=p==="y",y=m?"top":"left",C=m?"bottom":"right",E=m?"clientHeight":"clientWidth",O=o.reference[g]+o.reference[p]-h[p]-o.floating[g],M=h[p]-o.reference[p],D=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c));let w=D?D[E]:0;(!w||!await(i.isElement==null?void 0:i.isElement(D)))&&(w=a.floating[E]||o.floating[g]);const S=O/2-M/2,x=w/2-d[g]/2-1,T=Tt(u[y],x),b=Tt(u[C],x),A=w-d[g]-b,R=w/2-d[g]/2+S,V=Tc(T,R,A),H=!l.arrow&&wn(r)!=null&&R!==V&&o.reference[g]/2-(R<T?T:b)-d[g]/2<0,Z=H?R<T?R-T:R-A:0;return{[p]:h[p]+Z,data:{[p]:V,centerOffset:R-V-Z,...H&&{alignmentOffset:Z}},reset:H}}}),yh=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}=gt(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const y=kt(r),C=je(a),E=kt(a)===a,O=await(l.isRTL==null?void 0:l.isRTL(c.floating)),M=h||(E||!d?[Xs(a)]:ch(a)),D=g!=="none";!h&&D&&M.push(...fh(a,d,g,O));const w=[a,...M],S=await l.detectOverflow(t,m),x=[];let T=((s=o.flip)==null?void 0:s.overflows)||[];if(f&&x.push(S[y]),u){const V=ah(r,i,O);x.push(S[V[0]],S[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=w[V];if(H&&(!(u==="alignment"?C!==je(H):!1)||T.every(J=>je(J.placement)===C?J.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,J)=>re.overflows[1]-J.overflows[1])[0])==null?void 0:A.placement;if(!Z)switch(p){case"bestFit":{var R;const re=(R=T.filter(J=>{if(D){const W=je(J.placement);return W===C||W==="y"}return!0}).map(J=>[J.placement,J.overflows.filter(W=>W>0).reduce((W,we)=>W+we,0)]).sort((J,W)=>J[1]-W[1])[0])==null?void 0:R[0];re&&(Z=re);break}case"initialPlacement":Z=a;break}if(r!==Z)return{reset:{placement:Z}}}return{}}}};function Ji(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Xi(e){return oh.some(t=>e[t]>=0)}const bh=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:r="referenceHidden",...o}=gt(e,t);switch(r){case"referenceHidden":{const i=await s.detectOverflow(t,{...o,elementContext:"reference"}),a=Ji(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Xi(a)}}}case"escaped":{const i=await s.detectOverflow(t,{...o,altBoundary:!0}),a=Ji(i,n.floating);return{data:{escapedOffsets:a,escaped:Xi(a)}}}default:return{}}}}},Ac=new Set(["left","top"]);async function wh(e,t){const{placement:n,platform:s,elements:r}=e,o=await(s.isRTL==null?void 0:s.isRTL(r.floating)),i=kt(n),a=wn(n),l=je(n)==="y",c=Ac.has(i)?-1:1,f=o&&l?-1:1,u=gt(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 Eh=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 wh(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}}}}},xh=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:C=>{let{x:E,y:O}=C;return{x:E,y:O}}},...c}=gt(e,t),f={x:n,y:s},u=await o.detectOverflow(t,c),h=je(r),p=Xo(h);let g=f[p],d=f[h];const m=(C,E)=>Tc(E+u[C==="y"?"top":"left"],E,E-u[C==="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}}}}}},Sh=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}=gt(e,t),h={x:r,y:o},p=je(i),g=Xo(p);let d=h[g],m=h[p];const y=gt(c,t),C=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:(n=y.mainAxis)!=null?n:0,crossAxis:(s=y.crossAxis)!=null?s:0};if(f){const M=g==="y"?"height":"width",D=a.reference[g]-a.floating[M]+C.mainAxis,w=a.reference[g]+a.reference[M]-C.mainAxis;d<D?d=D:d>w&&(d=w)}if(u){var E,O;const M=g==="y"?"width":"height",D=Ac.has(kt(i)),w=a.reference[p]-a.floating[M]+(D&&((E=l.offset)==null?void 0:E[p])||0)+(D?0:C.crossAxis),S=a.reference[p]+a.reference[M]+(D?0:((O=l.offset)==null?void 0:O[p])||0)-(D?C.crossAxis:0);m<w?m=w:m>S&&(m=S)}return{[g]:d,[p]:m}}}},$h=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}=gt(e,t),l=await r.detectOverflow(t,a),c=kt(n),f=wn(n),u=je(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,C=Tt(p-l[g],m),E=Tt(h-l[d],y),O=t.middlewareData.shift,M=!O;let D=C,w=E;O!=null&&O.enabled.x&&(w=y),O!=null&&O.enabled.y&&(D=m),M&&!f&&(u?w=h-2*ot(l.left,l.right):D=p-2*ot(l.top,l.bottom)),await i({...t,availableWidth:w,availableHeight:D});const S=await r.getDimensions(o.floating);return h!==S.width||p!==S.height?{reset:{rects:!0}}:{}}}};function gr(){return typeof window<"u"}function En(e){return Lc(e)?(e.nodeName||"").toLowerCase():"#document"}function xe(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function yt(e){var t;return(t=(Lc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Lc(e){return gr()?e instanceof Node||e instanceof xe(e).Node:!1}function Ge(e){return gr()?e instanceof Element||e instanceof xe(e).Element:!1}function Lt(e){return gr()?e instanceof HTMLElement||e instanceof xe(e).HTMLElement:!1}function Qi(e){return!gr()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof xe(e).ShadowRoot}function mr(e){const{overflow:t,overflowX:n,overflowY:s,display:r}=Ye(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&r!=="inline"&&r!=="contents"}function Ih(e){return/^(table|td|th)$/.test(En(e))}function vr(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Ch=/transform|translate|scale|rotate|perspective|filter/,Th=/paint|layout|strict|content/,Nt=e=>!!e&&e!=="none";let Hr;function ti(e){const t=Ge(e)?Ye(e):e;return Nt(t.transform)||Nt(t.translate)||Nt(t.scale)||Nt(t.rotate)||Nt(t.perspective)||!ni()&&(Nt(t.backdropFilter)||Nt(t.filter))||Ch.test(t.willChange||"")||Th.test(t.contain||"")}function kh(e){let t=Ut(e);for(;Lt(t)&&!Jn(t);){if(ti(t))return t;if(vr(t))return null;t=Ut(t)}return null}function ni(){return Hr==null&&(Hr=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Hr}function Jn(e){return/^(html|body|#document)$/.test(En(e))}function Ye(e){return xe(e).getComputedStyle(e)}function yr(e){return Ge(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ut(e){if(En(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Qi(e)&&e.host||yt(e);return Qi(t)?t.host:t}function Oc(e){const t=Ut(e);return Jn(t)?(e.ownerDocument||e).body:Lt(t)&&mr(t)?t:Oc(t)}function Xn(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=Oc(e),o=r===((s=e.ownerDocument)==null?void 0:s.body),i=xe(r);if(o){const a=bo(i);return t.concat(i,i.visualViewport||[],mr(r)?r:[],a&&n?Xn(a):[])}else return t.concat(r,Xn(r,[],n))}function bo(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Mc(e){const t=Ye(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=Js(n)!==o||Js(s)!==i;return a&&(n=o,s=i),{width:n,height:s,$:a}}function si(e){return Ge(e)?e:e.contextElement}function an(e){const t=si(e);if(!Lt(t))return it(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:o}=Mc(t);let i=(o?Js(n.width):n.width)/s,a=(o?Js(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const Ah=it(0);function Dc(e){const t=xe(e);return!ni()||!t.visualViewport?Ah:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Lh(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===xe(e)}function qt(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=si(e);let i=it(1);t&&(s?Ge(s)&&(i=an(s)):i=an(e));const a=Lh(o,n,s)?Dc(o):it(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=xe(o),p=Ge(s)?xe(s):s;let g=h,d=bo(g);for(;d&&p!==g;){const m=an(d),y=d.getBoundingClientRect(),C=Ye(d),E=y.left+(d.clientLeft+parseFloat(C.paddingLeft))*m.x,O=y.top+(d.clientTop+parseFloat(C.paddingTop))*m.y;l*=m.x,c*=m.y,f*=m.x,u*=m.y,l+=E,c+=O,g=xe(d),d=bo(g)}}return Qs({width:f,height:u,x:l,y:c})}function br(e,t){const n=yr(e).scrollLeft;return t?t.left+n:qt(yt(e)).left+n}function Rc(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-br(e,n),r=n.top+t.scrollTop;return{x:s,y:r}}function Oh(e){let{elements:t,rect:n,offsetParent:s,strategy:r}=e;const o=r==="fixed",i=yt(s),a=t?vr(t.floating):!1;if(s===i||a&&o)return n;let l={scrollLeft:0,scrollTop:0},c=it(1);const f=it(0),u=Lt(s);if((u||!o)&&((En(s)!=="body"||mr(i))&&(l=yr(s)),u)){const p=qt(s);c=an(s),f.x=p.x+s.clientLeft,f.y=p.y+s.clientTop}const h=i&&!u&&!o?Rc(i,l):it(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 Mh(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Dh(e){const t=yr(e),n=e.ownerDocument.body,s=ot(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=ot(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let o=-t.scrollLeft+br(e);const i=-t.scrollTop;return Ye(n).direction==="rtl"&&(o+=ot(e.clientWidth,n.clientWidth)-s),{width:s,height:r,x:o,y:i}}const Rh=25;function Ph(e,t,n){n===void 0&&(n="viewport");const s=n==="layoutViewport",r=xe(e),o=yt(e),i=r.visualViewport;let a=o.clientWidth,l=o.clientHeight,c=0,f=0;if(i){const h=!ni()||t==="fixed";s?h||(c=-i.offsetLeft,f=-i.offsetTop):(a=i.width,l=i.height,h&&(c=i.offsetLeft,f=i.offsetTop))}if(br(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<=Rh&&(a-=y)}return{width:a,height:l,x:c,y:f}}function Vh(e,t){const n=qt(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 ea(e,t,n){let s;if(t==="viewport"||t==="layoutViewport")s=Ph(e,n,t);else if(t==="document")s=Dh(yt(e));else if(Ge(t))s=Vh(t,n);else{const r=Dc(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Qs(s)}function Nh(e,t){const n=t.get(e);if(n)return n;let s=Xn(e,[],!1).filter(a=>Ge(a)&&En(a)!=="body"),r=null;const o=Ye(e).position==="fixed";let i=o?Ut(e):e;for(;Ge(i)&&!Jn(i);){const a=Ye(i),l=ti(i),c=r?r.position:o?"fixed":"";!l&&(c==="fixed"||c==="absolute"&&a.position==="static")?s=s.filter(u=>u!==i):r=a,i=Ut(i)}return t.set(e,s),s}function Fh(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const i=[...n==="clippingAncestors"?vr(t)?[]:Nh(t,this._c):[].concat(n),s],a=ea(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=ea(t,i[h],r);l=ot(p.top,l),c=Tt(p.right,c),f=Tt(p.bottom,f),u=ot(p.left,u)}return{width:c-u,height:f-l,x:u,y:l}}function Hh(e){const{width:t,height:n}=Mc(e);return{width:t,height:n}}function _h(e,t,n){const s=Lt(t),r=yt(t),o=n==="fixed",i=qt(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=it(0);if((s||!o)&&((En(t)!=="body"||mr(r))&&(a=yr(t)),s)){const h=qt(t,!0,o,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}!s&&r&&(l.x=br(r));const c=r&&!s&&!o?Rc(r,a):it(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 _r(e){return Ye(e).position==="static"}function ta(e,t){if(!Lt(e)||Ye(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return yt(e)===n&&(n=n.ownerDocument.body),n}function Pc(e,t){const n=xe(e);if(vr(e))return n;if(!Lt(e)){let r=Ut(e);for(;r&&!Jn(r);){if(Ge(r)&&!_r(r))return r;r=Ut(r)}return n}let s=ta(e,t);for(;s&&Ih(s)&&_r(s);)s=ta(s,t);return s&&Jn(s)&&_r(s)&&!ti(s)?n:s||kh(e)||n}const Bh=async function(e){const t=this.getOffsetParent||Pc,n=this.getDimensions,s=await n(e.floating);return{reference:_h(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function jh(e){return Ye(e).direction==="rtl"}const Wh={convertOffsetParentRelativeRectToViewportRelativeRect:Oh,getDocumentElement:yt,getClippingRect:Fh,getOffsetParent:Pc,getElementRects:Bh,getClientRects:Mh,getDimensions:Hh,getScale:an,isElement:Ge,isRTL:jh};function Vc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Uh(e,t,n){let s=null,r;const o=yt(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=vs(g),C=vs(o.clientWidth-(p+d)),E=vs(o.clientHeight-(g+m)),O=vs(p),D={rootMargin:-y+"px "+-C+"px "+-E+"px "+-O+"px",threshold:ot(0,Tt(1,u))||1};let w=!0;function S(x){const T=x[0].intersectionRatio;if(!Vc(h,e.getBoundingClientRect()))return a();if(T!==u){if(!w)return a();T?a(!1,T):r=setTimeout(()=>{a(!1,1e-7)},1e3)}w=!1}try{s=new IntersectionObserver(S,{...D,root:o.ownerDocument})}catch{s=new IntersectionObserver(S,D)}s.observe(e)}const l=xe(e),c=()=>a(n);return l.addEventListener("resize",c),a(!0),()=>{l.removeEventListener("resize",c),i()}}function qh(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=si(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?Uh(c,n,o):null;let h=-1,p=null;i&&(p=new ResizeObserver(y=>{let[C]=y;C&&C.target===c&&p&&t&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var E;(E=p)==null||E.observe(t)})),n()}),c&&!l&&p.observe(c),t&&p.observe(t));let g,d=l?qt(e):null;l&&m();function m(){const y=qt(e);d&&!Vc(d,y)&&n(),d=y,g=requestAnimationFrame(m)}return n(),()=>{var y;f.forEach(C=>{r&&C.removeEventListener("scroll",n),o&&C.removeEventListener("resize",n)}),u?.(),(y=p)==null||y.disconnect(),p=null,l&&cancelAnimationFrame(g)}}const Gh=Eh,Yh=xh,Kh=yh,zh=$h,Zh=bh,Jh=vh,Xh=Sh,Qh=(e,t,n)=>{const s=new Map,r=n??{},o={...Wh,...r.platform,_c:s};return mh(e,t,{...r,platform:o})};function na(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 ep(e){if(!e)return na();const{x:t,y:n,width:s,height:r}=e;return na(t,n,s,r)}function tp(e,t){return{contextElement:fe(e)?e:e?.contextElement,getBoundingClientRect:()=>{const n=e,s=t?.(n);return s||!n?ep(s):n.getBoundingClientRect()}}}var An=e=>({variable:e,reference:`var(${e})`}),et={arrowSize:An("--arrow-size"),arrowSizeHalf:An("--arrow-size-half"),arrowBg:An("--arrow-background"),transformOrigin:An("--transform-origin"),arrowOffset:An("--arrow-offset")},np=e=>e==="top"||e==="bottom"?"y":"x";function sp(e,t){return{name:"transformOrigin",fn(n){const{elements:s,middlewareData:r,placement:o,rects:i,y:a}=n,l=o.split("-")[0],c=np(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,C=p/2,E=e.offset?.mainAxis??e.gutter,O=typeof E=="number"?E+C:E??C,M=m>O,D={top:`${g}px calc(100% + ${O}px)`,bottom:`${g}px ${-O}px`,left:`calc(100% + ${O}px) ${d}px`,right:`${-O}px ${d}px`}[l],w=`${g}px ${i.reference.y+y-a}px`,S=!!e.overlap&&c==="y"&&M;return s.floating.style.setProperty(et.transformOrigin.variable,S?w:D),{data:{transformOrigin:S?w:D}}}}}var rp={name:"rects",fn({rects:e}){return{data:e}}},op=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% + ${et.arrowOffset.reference})`}),{}}}};function ip(e){const[t,n]=e.split("-");return{side:t,align:n,hasAlign:n!=null}}function Nc(e){return e.split("-")[0]}var ap={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 sa(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 wr(e){return typeof e=="function"?e():e==="clipping-ancestors"?"clippingAncestors":e}function cp(e,t,n){const s=e||t.createElement("div");return Jh({element:s,padding:n.arrowPadding})}function lp(e,t){if(!cu(t.offset??t.gutter))return Gh(({placement:n})=>{const s=(e?.clientHeight||0)/2,r=t.offset?.mainAxis??t.gutter,o=typeof r=="number"?r+s:r??s,{hasAlign:i}=ip(n),a=i?void 0:t.shift,l=t.offset?.crossAxis??a;return Wo({crossAxis:l,mainAxis:o,alignmentAxis:t.shift})})}function dp(e){if(e.flip)return Kh(()=>{const t=wr(e.boundary);return{...t?{boundary:t}:void 0,padding:e.overflowPadding,fallbackPlacements:e.flip===!0?void 0:e.flip}})}function up(e){if(!(!e.slide&&!e.overlap))return Yh(()=>{const t=wr(e.boundary);return{...t?{boundary:t}:void 0,mainAxis:e.slide,crossAxis:e.overlap,padding:e.overflowPadding,limiter:Xh()}})}function fp(e){if(e.sizeMiddleware===!1&&!e.sameWidth&&!e.fitViewport)return;let t,n,s,r;return zh(()=>{const o=wr(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 hp(e){if(e.hideWhenDetached)return Zh(()=>({strategy:"referenceHidden",boundary:wr(e.boundary)??"clippingAncestors"}))}function pp(e){return e?e===!0?{ancestorResize:!0,ancestorScroll:!0,elementResize:!0,layoutShift:!0}:e:{}}var gp=["transform","visibility","pointer-events","--x","--y","--z-index","z-index","--reference-width","--reference-height","--available-width","--available-height","--transform-origin"],mp=["top","right","bottom","left"],Bn=new WeakSet;function vp(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=mc(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 ra(e,t){if(!e)return ic;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 oa(e){return e==null?null:fe(e)?e:typeof e=="object"&&e&&"contextElement"in e&&e.contextElement?e.contextElement:e}function yp(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:tp(T,n.getAnchorRect)},i=Object.assign({},ap,n);let a=[],l=null,c,f;function u(T){if(c?.(),f?.(),l=T,i.restoreStyles){const A=ra(T,gp);c=()=>{A(),Bn.delete(T)}}else c=void 0;const b=T.querySelector("[data-part=arrow]");f=i.restoreStyles?ra(b,mp):void 0,a=[lp(b,i),dp(i),up(i),cp(b,T.ownerDocument,i),op(b),sp({gutter:i.gutter,offset:i.offset,overlap:i.overlap},b),fp(i),hp(i),rp]}const{placement:h,strategy:p,onComplete:g,onPositioned:d}=i;let m,y,C=!1,E,O,M=ic;const D=pp(i.listeners);function w(){if(!i.listeners)return;const T=r(),b=o(),A=s();if(!b||!A)return;(oa(T)!==oa(E)||A!==O)&&(M(),E=T,O=A,M=qh(b,A,x,D))}async function S(){w();const T=s();if(!T)return;T!==l&&(u(T),C=!1);const b=o();if(!b)return;const A=await Qh(b,T,{placement:h,middleware:a,strategy:p}),R=me(T),V=sa(R,A.x),H=sa(R,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"))),!C)){const Z=T.firstElementChild;Z&&(vp(T,Z),C=!0)}}async function x(){n.updatePosition?(await n.updatePosition({updatePosition:S,floatingElement:s()}),d?.({placed:!0})):await S()}return x(),()=>{M(),f?.(),c?.(),d?.({placed:!1})}}function wo(e,t,n={}){const{defer:s,...r}=n,o=s?pe:a=>a(),i=[];return i.push(o(()=>{i.push(yp(e,t,r))})),()=>{i.forEach(a=>a?.())}}var bp={bottom:"rotate(45deg)",left:"rotate(135deg)",top:"rotate(225deg)",right:"rotate(315deg)"};function Fc(e={}){const{placement:t,sameWidth:n,fitViewport:s,strategy:r="absolute",applyStyles:o=!0}=e;return{arrow:{position:"absolute",width:et.arrowSize.reference,height:et.arrowSize.reference,[et.arrowSizeHalf.variable]:`calc(${et.arrowSize.reference} / 2)`,[et.arrowOffset.variable]:`calc(${et.arrowSizeHalf.reference} * -1)`},arrowTip:{transform:t?bp[t.split("-")[0]]:void 0,background:et.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 wp=e=>e.ids?.root??`select:${e.id}`,Eo=e=>e.ids?.content??`select:${e.id}:content`,xo=e=>e.ids?.trigger??`select:${e.id}:trigger`,Hc=e=>e.ids?.clearTrigger??`select:${e.id}:clear-trigger`,ys=e=>e.ids?.label??`select:${e.id}:label`,Ep=e=>e.ids?.control??`select:${e.id}:control`,So=(e,t)=>e.ids?.item?.(t)??`select:${e.id}:option:${t}`,$o=e=>e.ids?.hiddenSelect??`select:${e.id}:select`,_c=e=>e.ids?.positioner??`select:${e.id}:positioner`,xp=(e,t)=>e.ids?.itemGroup?.(t)??`select:${e.id}:optgroup:${t}`,ia=(e,t)=>e.ids?.itemGroupLabel?.(t)??`select:${e.id}:optgroup-label:${t}`,Br=e=>e.getById($o(e)),Ln=e=>e.getById(Eo(e)),Bt=e=>e.getById(xo(e)),Sp=e=>e.getById(Hc(e)),jr=e=>e.getById(_c(e)),Wr=(e,t)=>t==null?null:e.getById(So(e,t)),$p={clearTriggerLabel:"Clear value"};function Ip(e,t){const{context:n,prop:s,scope:r,state:o,computed:i,send:a}=e,l=cc($p,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"),C=n.get("highlightedItem"),E=i("selectedItems"),O=n.get("currentPlacement"),M=O?Nc(O):void 0,D=i("isTypingAhead"),w=i("isInteractive"),S=y?So(r,y):void 0;function x(b){const A=g.getItemDisabled(b.item),R=g.getItemValue(b.item);return dr(R,()=>`[zag-js] No value found for item ${JSON.stringify(b.item)}`),{value:R,disabled:!!(c||A),highlighted:y===R,selected:n.get("value").includes(R)}}const T=Fc({...s("positioning"),placement:O});return{open:d,focused:m,empty:n.get("value").length===0,highlightedItem:C,highlightedValue:y,selectedItems:E,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(){Bt(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:wp(r),"data-invalid":P(f),"data-readonly":P(h)})},getLabelProps(){return t.label({dir:s("dir"),id:ys(r),...ve.label.attrs,"data-disabled":P(c),"data-invalid":P(f),"data-readonly":P(h),"data-required":P(u),htmlFor:$o(r),onClick(b){b.defaultPrevented||c||Bt(r)?.focus({preventScroll:!0})}})},getControlProps(){return t.element({...ve.control.attrs,dir:s("dir"),id:Ep(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:xo(r),disabled:c,dir:s("dir"),type:"button",role:"combobox","aria-controls":Eo(r),"aria-expanded":d,"aria-haspopup":"listbox","data-state":d?"open":"closed","aria-invalid":f,"aria-required":u,"aria-labelledby":ys(r),...ve.trigger.attrs,"data-disabled":P(c),"data-invalid":P(f),"data-readonly":P(h),"data-placement":O,"data-side":M,"data-placeholder-shown":P(!i("hasSelectedItems")),onClick(b){w&&(b.defaultPrevented||a({type:"TRIGGER.CLICK"}))},onFocus(){a({type:"TRIGGER.FOCUS"})},onBlur(){a({type:"TRIGGER.BLUR"})},onKeyDown(b){if(b.defaultPrevented||!w)return;const R={ArrowUp(){a({type:"TRIGGER.ARROW_UP"})},ArrowDown(V){a({type:V.altKey?"OPEN":"TRIGGER.ARROW_DOWN"})},ArrowLeft(){a({type:"TRIGGER.ARROW_LEFT"})},ArrowRight(){a({type:"TRIGGER.ARROW_RIGHT"})},Home(){a({type:"TRIGGER.HOME"})},End(){a({type:"TRIGGER.END"})},Enter(){a({type:"TRIGGER.ENTER"})},Space(V){a(D?{type:"TRIGGER.TYPEAHEAD",key:V.key}:{type:"TRIGGER.ENTER"})}}[uo(b,{dir:s("dir"),orientation:"vertical"})];if(R){R(b),b.preventDefault();return}po.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:So(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(R){A.disabled||R.pointerType!=="mouse"||vo()==="pointer"&&A.value!==y&&a({type:"ITEM.POINTER_MOVE",value:A.value})},onClick(R){R.defaultPrevented||A.disabled||a({type:"ITEM.CLICK",src:"pointerup",value:A.value})},onPointerLeave(R){A.disabled||b.persistFocus||R.pointerType==="mouse"&&vo()==="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:ia(r,A),dir:s("dir"),role:"presentation"})},getItemGroupProps(b){const{id:A}=b;return t.element({...ve.itemGroup.attrs,"data-disabled":P(c),id:xp(r,A),"aria-labelledby":ia(r,A),role:"group",dir:s("dir")})},getClearTriggerProps(){return t.button({...ve.clearTrigger.attrs,id:Hc(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],R=V=>{const H=Ko(V);bc(H)||a({type:"VALUE.SET",value:Cp(V.currentTarget)})};return t.select({name:s("name"),form:s("form"),disabled:c,multiple:s("multiple"),required:s("required"),"aria-hidden":!0,id:$o(r),defaultValue:A,style:jf,tabIndex:-1,autoComplete:s("autoComplete"),onChange:R,onInput:R,onFocus(){Bt(r)?.focus({preventScroll:!0})},"aria-labelledby":ys(r)})},getPositionerProps(){return t.element({...ve.positioner.attrs,dir:s("dir"),id:_c(r),style:T.floating})},getContentProps(){return t.element({hidden:!d,dir:s("dir"),id:Eo(r),role:p?"listbox":"dialog",...ve.content.attrs,"data-state":d?"open":"closed","data-placement":O,"data-side":M,"data-activedescendant":S,"aria-activedescendant":p?S:void 0,"aria-multiselectable":s("multiple")&&p?!0:void 0,"aria-labelledby":ys(r),tabIndex:0,onKeyDown(b){if(!w||!hn(b.currentTarget,ht(b)))return;if(b.key==="Tab"&&!vf(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){D?a({type:"CONTENT.TYPEAHEAD",key:H.key}):A.Enter?.()}},R=A[uo(b)];if(R){R(b),b.preventDefault();return}const V=ht(b);Ou(V)||po.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":xo(r),"aria-activedescendant":p?void 0:S,"aria-multiselectable":!p&&s("multiple")?!0:void 0})}}}var Cp=e=>e.multiple?Array.from(e.selectedOptions,t=>t.value):e.value?[e.value]:[];function Tp(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 kp(){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=".",Bc="#",aa=new WeakMap,jc=new WeakMap;function Io(e){return e.join(Ot)}function Ap(e){return e.includes(Ot)}function Wc(e){return e.startsWith(Bc)}function Lp(e){return e.startsWith(Ot)}function Op(e){return Wc(e)?e.slice(Bc.length):e}function Co(e,t){return e?`${e}${Ot}${t}`:t}function Mp(e){const t=new Map,n=new Map,s=(r,o)=>{t.set(r,o);const i=o.id;i&&(n.has(i)&&Bi(`[zag-js] Duplicate state id: "${i}"`),n.set(i,r));const a=o.states;if(a){dr(o.initial,()=>`[zag-js] Compound state "${r}" has child states but no "initial" property`),o.initial in a||Bi(`[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=Co(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=aa.get(e);if(t)return t;const{index:n,idIndex:s}=Mp(e);return aa.set(e,n),jc.set(e,s),n}function Dp(e,t){return rs(e),jc.get(e)?.get(t)}function ri(e){return e?String(e).split(Ot).filter(Boolean):[]}function er(e,t){if(!t)return[];const n=rs(e),s=ri(t),r=[],o=[];for(const i of s){o.push(i);const a=Io(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=ri(t);if(!s.length)return t;const r=[];for(const a of s){r.push(a);const l=Io(r);if(!n.has(l))return t}let o=Io(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 ca(e,t){return rs(e).has(t)}function la(e,t,n){const s=String(t);if(Wc(s)){const r=Op(s),o=Dp(e,r);return dr(o,()=>`[zag-js] Unknown state id: "${r}"`),On(e,o)}if(Lp(s)&&n){const r=Co(n,s.slice(1));return On(e,r)}if(!Ap(s)&&n){const r=ri(n);for(let o=r.length-1;o>=1;o--){const i=r.slice(0,o).join(Ot),a=Co(i,s);if(ca(e,a))return On(e,a)}if(ca(e,s))return On(e,s)}return On(e,s)}function Rp(e,t,n){const s=er(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 Pp(e,t,n,s){const r=t?er(e,t):[],o=er(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 Vp(e,t){return e?e===t||e.startsWith(`${t}${Ot}`):!1}function Np(e,t,n){return er(e,t).some(s=>s.state.tags?.includes(n))}function Uc(){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 qc(e){return rs(e),e}var jn=(e=>(e.NotStarted="Not Started",e.Started="Started",e.Stopped="Stopped",e))(jn||{}),bs="__init__";function Fp(e){const t=()=>e.getRootNode?.()??document,n=()=>De(t());return{...e,getRootNode:t,getDoc:n,getWin:()=>n().defaultView??window,getActiveElement:()=>fr(t()),isActiveElement:lo,getById:i=>t().getElementById(i)}}function Hp(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 _p(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 da="pointerdown.outside",ua="focus.outside";function Bp(e){for(const t of e)if(fe(t)&&hr(t))return!0;return!1}var Gc=e=>"clientY"in e;function jp(e,t){if(!Gc(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 Wp(e,t){return e.y<=t.y&&t.y<=e.y+e.height&&e.x<=t.x&&t.x<=e.x+e.width}function fa(e,t){if(!t||!Gc(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 Wp(i,a)?s||o:!1}function Up(e,t){const{exclude:n,onFocusOutside:s,onPointerDownOutside:r,onInteractOutside:o,defer:i,followControlledElements:a=!0}=t;if(!e)return;const l=De(e),c=me(e),f=Hp(c),u=_p(c);function h(M,D){if(!fe(D)||!D.isConnected||hn(e,D)||jp(e,M)||a&&Ku(e,D))return!1;const w=l.querySelector(`[aria-controls="${e.id}"]`);if(w){const x=fo(w);if(fa(M,x))return!1}const S=fo(e);return fa(M,S)?!1:!n?.(D)}const p=new Set,g=fn(e?.getRootNode());let d=!1;function m(M){d=!0;const D=()=>{d=!1};l.addEventListener("pointerup",D,{once:!0}),c.addEventListener("pointerup",D,{once:!0});function w(S){const x=i&&!Wi()?pe:A=>A(),T=S??M,b=T?.composedPath?.()??[T?.target];x(()=>{const A=g?b[0]:ht(M);if(!(!e||!h(M,A))){if(r||o){const R=Gs(r,o);e.addEventListener(da,R,{once:!0})}ha(e,da,{bubbles:!1,cancelable:!0,detail:{originalEvent:T,contextmenu:Xu(T),focusable:Bp(b),target:A}})}})}M.pointerType==="touch"?(p.forEach(S=>S()),p.add(Ps(l,"click",w,{once:!0})),p.add(u.addEventListener("click",w,{once:!0})),p.add(f.addEventListener("click",w,{once:!0}))):w()}const y=new Set,C=setTimeout(()=>{y.add(Ps(l,"pointerdown",m,!0)),y.add(u.addEventListener("pointerdown",m,!0)),y.add(f.addEventListener("pointerdown",m,!0))},0),E=wc.create();function O(M){if(d)return;(i?w=>E.request(w):w=>w())(()=>{const w=M?.composedPath?.()??[M?.target],S=g?w[0]:ht(M);if(!(!e||!h(M,S))){if(s||o){const x=Gs(s,o);e.addEventListener(ua,x,{once:!0})}ha(e,ua,{bubbles:!1,cancelable:!0,detail:{originalEvent:M,contextmenu:!1,focusable:hr(S),target:S}})}})}return Wi()||(y.add(Ps(l,"focusin",O,!0)),y.add(u.addEventListener("focusin",O,!0)),y.add(f.addEventListener("focusin",O,!0))),()=>{clearTimeout(C),E.cancel(),p.forEach(M=>M()),y.forEach(M=>M())}}function qp(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(Up(o,t))})),()=>{r.forEach(o=>o?.())}}function ha(e,t,n){const s=e.ownerDocument.defaultView||window,r=new s.CustomEvent(t,n);return e.dispatchEvent(r)}function Gp(e,t){const n=s=>{s.key==="Escape"&&(s.isComposing||t?.(s))};return Ps(De(e),"keydown",n,{capture:!0})}var pa="layer:request-dismiss",Ee={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&&Yp(r)}),this.recentlyRemoved.add(e),xc(()=>this.recentlyRemoved.delete(e)),t<this.count()-1&&this.getNestedLayers(e).forEach(r=>Ee.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)=>{ga(e,t,e.node),e.styleTargets?.forEach(n=>{const s=n();if(!s||s===e.node)return;ga(e,t,s);const{zIndex:r}=mc(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];zp(e,pa,r=>{s.requestDismiss?.(r),r.defaultPrevented||s?.dismiss()}),Kp(e,pa,{originalLayer:e,targetLayer:t,originalIndex:n,targetIndex:t?this.indexOf(t):-1}),this.syncLayers()},clear(){this.remove(this.layers[0].node)}};function ga(e,t,n){n.style.setProperty("--layer-index",`${t}`),n.removeAttribute("data-nested"),n.removeAttribute("data-has-nested"),Ee.getParentLayerOfType(e.node,e.type)&&n.setAttribute("data-nested",e.type);const r=Ee.countNestedLayersOfType(e.node,e.type);r>0&&n.setAttribute("data-has-nested",e.type),n.style.setProperty("--nested-layer-count",`${r}`)}function Yp(e){e.style.removeProperty("--layer-index"),e.style.removeProperty("--nested-layer-count"),e.removeAttribute("data-nested"),e.removeAttribute("data-has-nested")}function Kp(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 zp(e,t,n){e.addEventListener(t,n,{once:!0})}var Ur=new WeakMap,Kn=new WeakMap;function Zp(e){return Ee.isBelowPointerBlockingLayer(e)?"none":"auto"}function Yc(e){const t=Zp(e);e.style.pointerEvents!==t&&(e.style.pointerEvents=t)}function Jp(e){if(Kn.has(e))return;const t=me(e);if(typeof t.MutationObserver>"u")return;const n=new t.MutationObserver(()=>{Kn.has(e)&&Yc(e)});n.observe(e,{attributes:!0,attributeFilter:["style"]}),Kn.set(e,n)}function ma(){Ee.layers.forEach(({node:e})=>{Yc(e),Jp(e)})}function Xp(e){const t=Kn.get(e);t&&(t.disconnect(),Kn.delete(e)),e.style.pointerEvents=""}function Qp(e,t){const n=De(e),s=[];return Ee.hasPointerBlockingLayer()&&!n.body.hasAttribute("data-inert")&&(Ur.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]=Uf(()=>{const a=r();return fe(a)?a:null},{timeout:1e3});o.then(a=>s.push(Ff(a,{pointerEvents:"auto"}))),s.push(i)}),()=>{Ee.hasPointerBlockingLayer()||(queueMicrotask(()=>{const r=n.body;if(!r)return;const o=Ur.get(r);o!==void 0&&(r.style.pointerEvents=o,Ur.delete(r)),r.removeAttribute("data-inert"),r.style.length===0&&r.removeAttribute("style")}),s.forEach(r=>r()))}}function eg(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};Ee.add(c),ma();function f(d){const m=ht(d.detail.originalEvent);Ee.isBelowPointerBlockingLayer(e)||Ee.isInBranch(m)||(t.onPointerDownOutside?.(d),t.onInteractOutside?.(d),!d.defaultPrevented&&(i&&console.log("onPointerDownOutside:",d.detail.originalEvent),n?.(d)))}function u(d){const m=ht(d.detail.originalEvent);Ee.isInBranch(m)||(t.onFocusOutside?.(d),t.onInteractOutside?.(d),!d.defaultPrevented&&(i&&console.log("onFocusOutside:",d.detail.originalEvent),n?.(d)))}function h(d){Ee.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],C=t.persistentElements?.map(E=>E()).filter(fe);return C&&y.push(...C),y.some(E=>hn(E,d))||Ee.isInNestedLayer(e,d)}const g=[r?Qp(e,t.persistentElements):void 0,Gp(e,h),qp(e,{exclude:p,onFocusOutside:u,onPointerDownOutside:f,defer:t.defer})];return()=>{Ee.remove(e),ma(),Xp(e),g.forEach(d=>d?.())}}function Kc(e,t){const{warnOnMissingNode:n=!0}=t;return Gf(e,s=>eg(s,t),{defer:t.defer,getRootNode:t.getRootNode,onMissing:n?()=>Ds("[@zag-js/dismissable] node is `null` or `undefined`"):void 0})}var{and:Mn,not:Ft,or:tg}=Uc(),ng=qc({props({props:e}){return{loopFocus:!1,closeOnSelect:!e.multiple,composite:!0,defaultValue:[],...e,collection:e.collection??Ys.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=gs({values:o,collection:a,selectedItemMap:l}),f=e("value")??o,u=f===o?c:gs({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:wu({selectedItems:r,collection:e("collection")})}))}},refs(){return{typeahead:{...po.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})=>uc({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:tg("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(Ft("multiple"),"hasSelectedItems"),actions:["selectPreviousItem"]},{guard:Ft("multiple"),actions:["selectLastItem"]}],"TRIGGER.ARROW_RIGHT":[{guard:Mn(Ft("multiple"),"hasSelectedItems"),actions:["selectNextItem"]},{guard:Ft("multiple"),actions:["selectFirstItem"]}],"TRIGGER.HOME":{guard:Ft("multiple"),actions:["selectFirstItem"]},"TRIGGER.END":{guard:Ft("multiple"),actions:["selectLastItem"]},"TRIGGER.TYPEAHEAD":{guard:Ft("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})=>va(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 rh({root:e.getRootNode?.()})},trackFormControlState({context:e,scope:t}){return of(Br(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 Kc(s,{type:"listbox",defer:!0,getRootNode:e.getRootNode,layerStyleTargets:[()=>jr(e)],exclude:[Bt(e),Sp(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),wo(()=>Bt(n),()=>jr(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||vo()==="pointer")return;const f=Ln(n),u=t("scrollToIndexFn");if(u){const p=t("collection").indexOf(l);u?.({index:p,immediate:a,getElement:()=>Wr(n,l)});return}const h=Wr(n,l);Mf(h,{rootEl:f,block:"nearest"})},r=pe(()=>{sh("virtual"),s(!0)}),i=Ef(()=>Ln(n),{attributes:["data-activedescendant"],callback(){s(!1)}});return()=>{r(),i()}}},actions:{reposition({context:e,prop:t,scope:n,event:s}){const r=()=>jr(n);wo(Bt(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=mf({root:Ln(e)});t&&t.focus({preventScroll:!0})})},focusTriggerEl({event:e,scope:t}){if(!va(e))return;const n=sg(e);pe(()=>{Bt(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")?Ni(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")?Ni(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:()=>Wr(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=Br(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=gs({values:e.get("value"),collection:n,selectedItemMap:e.get("selectedItemMap")});e.set("selectedItemMap",r.nextSelectedItemMap)},syncSelectedItems({context:e,prop:t}){const n=gs({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=Br(e);if(!t)return;const n=e.getWin(),s=new n.Event("change",{bubbles:!0,composed:!0});t.dispatchEvent(af(s))})}}}});function va(e){const t=e.restoreFocus??e.previousEvent?.restoreFocus;return t==null||!!t}function sg(e){return e.focusVisible??e.previousEvent?.focusVisible?{preventScroll:!0,focusVisible:!0}:{preventScroll:!0}}function rg(e){return new Proxy({},{get(t,n){return n==="style"?s=>e({style:s}).style:e}})}var og=Object.defineProperty,ig=(e,t,n)=>t in e?og(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Y=(e,t,n)=>ig(e,typeof t!="symbol"?t+"":t,n),ya={onFocus:"onFocusin",onBlur:"onFocusout",onChange:"onInput",onDoubleClick:"onDblclick",htmlFor:"for",className:"class",defaultValue:"value",defaultChecked:"checked"},ag=new Set(["viewBox","preserveAspectRatio"]),zc=rg(e=>Object.entries(e).reduce((t,[n,s])=>{if(s===void 0)return t;n in ya&&(n=ya[n]);const r=ag.has(n)?n:n.toLowerCase();return t[r]=s,t},{})),ws=new WeakMap,ba=new Set(["value","checked","selected"]),cg=new Set(["viewBox","preserveAspectRatio","clipPath","clipRule","fillRule","strokeWidth","strokeLinecap","strokeLinejoin","strokeDasharray","strokeDashoffset","strokeMiterlimit"]),lg=e=>e.tagName==="svg"||e.namespaceURI==="http://www.w3.org/2000/svg",Es=(e,t)=>lg(e)&&cg.has(t)?t:t.toLowerCase(),qr=e=>e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),wa=(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(qr(r));for(const r in n){const o=n[r];o==null?s.removeProperty(qr(r)):s.setProperty(qr(r),String(o))}}};function se(e,t,n){const s="default";let r=ws.get(e);r||(r=new Map,ws.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"){wa(e,y,m);return}if(ba.has(d)){e[d]=m??"";return}if(typeof m=="boolean"&&!d.includes("aria-")){e.toggleAttribute(Es(e,d),m);return}if(d==="children"){e.innerHTML=m;return}if(m!=null){e.setAttribute(Es(e,d),m);return}e.removeAttribute(Es(e,d))}};for(const d in o)t[d]==null&&(d==="class"?e.className="":d==="style"?wa(e,o[d],void 0):ba.has(d)?e[d]="":e.removeAttribute(Es(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=ws.get(e);m&&(m.delete(s),m.size===0&&ws.delete(e))}}function dg(){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 Zc(e,t){const n=dg();return n?(n[e]||(n[e]=t()),n[e]):t()}var Ns=Zc("__zag__refSet",()=>new WeakSet),ug=e=>typeof e=="object"&&e!==null&&"$$typeof"in e&&"props"in e,fg=e=>typeof e=="object"&&e!==null&&"__v_isVNode"in e,hg=e=>typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeName=="string",pg=e=>ug(e)||fg(e)||hg(e),To=e=>e!==null&&typeof e=="object",Ea=e=>To(e)&&!Ns.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!pg(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 gg=Symbol(),xa=Object.getPrototypeOf,ko=new WeakMap,mg=e=>e&&(ko.has(e)?ko.get(e):xa(e)===Object.prototype||xa(e)===Array.prototype),vg=e=>mg(e)&&e[gg]||null,Sa=(e,t=!0)=>{ko.set(e,t)};var _t=Zc("__zag__proxyStateMap",()=>new WeakMap),yg=(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 Sa(f,!0),n.set(a,[l,f]),Reflect.ownKeys(a).forEach(u=>{const h=Reflect.get(a,u);Ns.has(h)?(Sa(h,!1),f[u]=h):_t.has(h)?f[u]=wg(h):f[u]=h}),Object.freeze(f)},r=new WeakMap,o=[1,1],i=a=>{if(!To(a))throw new Error("object required");const l=r.get(a);if(l)return l;let c=o[0];const f=new Set,u=(w,S=++o[0])=>{c!==S&&(c=S,f.forEach(x=>x(w,S)))};let h=o[1];const p=(w=++o[1])=>(h!==w&&!f.size&&(h=w,d.forEach(([S])=>{const x=S[1](w);x>c&&(c=x)})),c),g=w=>(S,x)=>{const T=[...S];T[1]=[w,...T[1]],u(T,x)},d=new Map,m=(w,S)=>{if(f.size){const x=S[3](g(w));d.set(w,[S,x])}else d.set(w,[S])},y=w=>{const S=d.get(w);S&&(d.delete(w),S[1]?.())},C=w=>(f.add(w),f.size===1&&d.forEach(([x,T],b)=>{const A=x[3](g(b));d.set(b,[x,A])}),()=>{f.delete(w),f.size===0&&d.forEach(([x,T],b)=>{T&&(T(),d.set(b,[x]))})}),E=Array.isArray(a)?[]:Object.create(Object.getPrototypeOf(a)),M=t(E,{deleteProperty(w,S){const x=Reflect.get(w,S);y(S);const T=Reflect.deleteProperty(w,S);return T&&u(["delete",[S],x]),T},set(w,S,x,T){const b=Reflect.has(w,S),A=Reflect.get(w,S,T);if(b&&(e(A,x)||r.has(x)&&e(A,r.get(x))))return!0;y(S),To(x)&&(x=vg(x)||x);let R=x;if(!Object.getOwnPropertyDescriptor(w,S)?.set){!_t.has(x)&&Ea(x)&&(R=Jc(x));const V=!Ns.has(R)&&_t.get(R);V&&m(S,V)}return Reflect.set(w,S,R,T),u(["set",[S],x,A]),!0}});r.set(a,M);const D=[E,p,s,C];return _t.set(M,D),Reflect.ownKeys(a).forEach(w=>{const S=Object.getOwnPropertyDescriptor(a,w);S.get||S.set?Object.defineProperty(E,w,S):M[w]=a[w]}),M})=>[i,_t,Ns,e,t,Ea,n,s,r,o],[bg]=yg();function Jc(e={}){return bg(e)}function $a(e,t,n){const s=_t.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 wg(e){const t=_t.get(e),[n,s,r]=t;return r(n,s())}function tr(e){const t=e().value??e().defaultValue;e().debug&&console.log(`[bindable > ${e().debug}] initial`,t);const n=e().isEqual??Object.is,s=Jc({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=Qe(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)}}}tr.cleanup=e=>{};tr.ref=e=>{let t=e;return{get:()=>t,set:n=>{t=n}}};function Eg(e){const t={current:e};return{get(n){return t.current[n]},set(n,s){t.current[n]=s}}}var{defineProperty:xg,getOwnPropertyDescriptor:Sg,getOwnPropertyDescriptors:Ia}=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({},Ia(e))),xg(n,r,o)};for(const[r,o]of Object.entries(Ia(t))){if(!o.enumerable)continue;if(o.get){s(r,o);continue}const i=o.value;if(i===void 0)continue;const a=!!Sg(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 Xc=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",kp()),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=_i(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=>Vp(this.state.get(),h)),hasTag:u=>Np(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}=Rp(this.machine,g,d),C=this.choose(m);if(!C)return;this.transition=C;const E=la(this.machine,C.target??g,y);this.debug("transition",C),E!==g?this.state.set(E):C.reenter?this.state.invoke(g,g):this.action(C.actions)})}),Y(this,"action",u=>{const h=Qe(u)?u(this.getParams()):u;if(!h)return;const p=h.map(g=>{const d=this.machine.implementations?.actions?.[g];return d||Ds(`[zag-js] No implementation found for action "${JSON.stringify(g)}"`),d});for(const g of p)g?.(this.getParams())}),Y(this,"guard",u=>{if(Qe(u))return u(this.getParams());const h=this.machine.implementations?.guards?.[u];return h||Ds(`[zag-js] No implementation found for guard "${JSON.stringify(u)}"`),h?.(this.getParams())}),Y(this,"effect",u=>{const h=Qe(u)?u(this.getParams()):u;if(!h)return;const p=h.map(d=>{const m=this.machine.implementations?.effects?.[d];return m||Ds(`[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=>eu(u).find(h=>{let p=!h.guard;return au(h.guard)?p=!!this.guard(h.guard):Qe(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:pu,scope:this.scope,choose:this.choose})),Qe(t)?this.userPropsSources.push(t):this.userProps=t;const{id:n,ids:s,getRootNode:r}=_i(t);this.scope=Fp({id:n,ids:s,getRootNode:r});const o=u=>{const h=this.getUserProps();return(e.props?.({props:Wo(h),scope:this.scope})??h)[u]};this.prop=o;const i=e.context?.({prop:o,bindable:tr,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=$a(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=>(dr(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=Eg(e.refs?.({prop:o,context:a})??{});this.refs=c;const f=tr(()=>({defaultValue:la(e,e.initialState({prop:o})),onChange:(u,h)=>{const{exiting:p,entering:g}=Pp(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?Gs(y,m):m)}}),h===bs){this.action(e.entry);const d=this.effect(e.effects);if(d){const m=this.effects.get(bs);this.effects.set(bs,m?Gs(m,d):d)}}g.forEach(d=>{this.action(d.state?.entry)})}}));this.state=f,this.cleanups.push($a(this.state.ref,()=>this.notify()))}updateProps(e){const t=this.userPropsSources;if(Qe(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(Qe(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,bs),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 $g='<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>',xt=new Map;let Ig=0;function Cg(e){const t=document.createElement("span");t.className="ui-select",t.innerHTML=`<button type="button" class="ui-select-trigger"><span></span>${$g}</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 Xc(ng,{id:`select-${++Ig}`,collection:Ys({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=()=>Ip(f.service,zc);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,C)=>{const E=o.children[C];se(E,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 C=document.createElement("div");return C.className="ui-select-option",C.textContent=y.label,C})),f.updateProps({collection:Ys({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 xt)t.isConnected||(n.dispose(),xt.delete(t));for(const t of e.querySelectorAll("select:not([data-native])"))xt.has(t)?xt.get(t).sync():xt.set(t,Cg(t))}function Tg(e){Qn(e.parentElement),xt.get(e)?.focus()}function kg(){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 xt.values())t.dispose();xt.clear()}}function Ag(e){const t=document.createElement("dialog");t.className="launch-dialog",t.setAttribute("aria-labelledby","launch-heading"),t.innerHTML=`
10
- <button class="icon-button dialog-close" aria-label="Close open session">×</button>
11
- <h2 id="launch-heading">Open session</h2><p class="launch-title"></p>
12
- <label class="launch-destination">Open in<select aria-label="Open in">
13
- ${Hn.map(b=>`<option value="${b.id}">${b.name}</option>`).join("")}
14
- <option value="web">OpenCode · Web browser</option>
15
- </select></label>
16
- <section class="launch-web" hidden>
17
- <a class="primary-button launch-web-link" target="_blank" rel="noopener noreferrer" hidden>Open in browser ↗</a>
18
- <details class="launch-pairing"><summary>First time connecting?</summary><p>Run <code>opencode pair</code> in your terminal and open its pairing link once. Then open this session again.</p><button class="text-button launch-copy-pair">Copy pairing command</button></details>
19
- </section>
20
- <section class="launch-cli">
21
- <label class="launch-directory-label">Working directory<input class="launch-directory" aria-label="Working directory" spellcheck="false" autocomplete="off"/></label>
22
- <div class="launch-summary" hidden><strong class="launch-mode"></strong><p class="launch-hint"></p>
23
- <details class="launch-context" hidden><summary>Saved context</summary><p class="launch-coverage"></p><code class="launch-context-path"></code></details>
24
- </div>
25
- <input class="launch-command" aria-label="CLI command" readonly spellcheck="false" placeholder="Preparing command…"/>
26
- <div class="launch-actions"><button class="primary-button launch-terminal" disabled>Open Terminal ↗</button><button class="secondary-button launch-copy" disabled>Copy command</button></div>
27
- <p class="launch-availability"></p>
28
- </section>
29
- <p class="launch-status" role="status"></p>`,document.body.append(t);const n=new AbortController,s={signal:n.signal},r=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,C,E,O=null;function M(){g++,m?.abort(),clearTimeout(E),y=void 0,l.value="",c.disabled=f.disabled=!0,r(".launch-summary").hidden=!0,r(".launch-availability").textContent=""}function D(){t.close(),p++,d?.abort(),M(),e(),O?.focus({preventScroll:!0})}async function w(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 S(){if(a.hidden=!0,a.removeAttribute("href"),h&&C?.webBaseUrl)try{a.href=zd(C.webBaseUrl,h.nativeID||h.id),a.hidden=!1}catch{}u.textContent=C?a.hidden?"OpenCode is unavailable. Choose another app to use the saved conversation.":"":"Finding OpenCode…"}function x(b){const A=Hn.find(R=>R.id===o.value)?.name||Le(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(M(),!h||!t.open)return;const b=o.value==="web";if(r(".launch-web").hidden=!b,r(".launch-cli").hidden=b,b){S();return}if(!Or(o.value))return;const A=g;m=new AbortController,u.textContent="Preparing command…";try{const R=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 R.json();if(!R.ok)throw new Error(V.error||"Could not prepare this session.");if(g!==A)return;y=V,x(y)}catch(R){g===A&&(l.placeholder="Command unavailable",u.textContent=R instanceof Error?R.message:"Could not prepare this session.")}}return o.addEventListener("change",()=>{try{localStorage.setItem("sessiongraph.open-target",o.value)}catch{}T()},s),i.addEventListener("input",()=>{M(),u.textContent="Checking working directory…",E=setTimeout(()=>{T()},300)},s),i.addEventListener("change",()=>{T()},s),r(".dialog-close").addEventListener("click",D,s),t.addEventListener("cancel",b=>{b.preventDefault(),D()},s),t.addEventListener("keydown",b=>{b.stopPropagation()},s),f.addEventListener("click",()=>{y&&w(y.command)},s),r(".launch-copy-pair").addEventListener("click",()=>{w("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})}),R=await A.json();if(!A.ok)throw new Error(R.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,C=void 0,M(),t.open||(O=document.activeElement),r(".launch-title").textContent=`${Le(b.source)} · ${b.title}`,i.value=b.directory,i.disabled=o.disabled=!1,o.value=Or(b.source)?b.source:"opencode";const R=(!b.source||b.source==="opencode")&&sc(b.nativeID||b.id);o.querySelector('[value="web"]').disabled=!R;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");(Or(V)||V==="web"&&R)&&(o.value=V)}catch{}l.placeholder="Preparing command…",r(".launch-context").open=!1,t.open||t.showModal(),e(),Tg(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;C=H;for(const Z of Hn){const re=H.targets.some(J=>J.id===Z.id&&J.available);o.querySelector(`[value="${Z.id}"]`).textContent=`${Z.name}${re?"":" · CLI not found"}`}o.value==="web"&&S()}catch{p===A&&o.value==="web"&&(u.textContent="OpenCode is unavailable. Choose another app to use the saved conversation.")}},dispose(){p++,d?.abort(),M(),n.abort(),t.remove()}}}const Lg=e=>e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]);function Og(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 C(){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 E(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 E("import");if(!b.ok)throw new Error(A.error||"Import unavailable.");return A}function O(x){o=x.running,C(),r(".imports-progress").textContent=o?`${x.source?Le(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>${Lg(b)}${A>1?` (${A} occurrences)`:""}</p>`).join(""),document.dispatchEvent(new CustomEvent("sessiongraph-import-status",{detail:x}))}async function M(){if(!(a||f)){i=0,f=!0;try{const x=await E("import");if(a)return;if(O(x),x.running)i=window.setTimeout(M,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){D(x)}finally{f=!1}}}function D(x){if(a)return;y=!1;const T=x instanceof Error?x.message:"Import unavailable.";O({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 w(x,T=!1){if(a||T&&s.open)return;if(o||c||f||i){!T&&!s.open&&S();return}c=!0,u=T,o=!0,C();const b=p&&s.open&&x!==void 0,A=g;try{const R=await E("import",{method:"POST",headers:{"Content-Type":"application/json","X-SessionGraph-Action":"import"},body:JSON.stringify(T?{automatic:!0}:{sources:x})});if(a||(O(R),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(M,100)}catch(R){D(R)}finally{c=!1,a||C()}}async function S(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),C(),s.open||s.showModal(),t(),r(".import-sources").textContent="Finding local session sources…";try{const b=await E("sources");if(a||T!==g)return;r(".import-sources").innerHTML=tc(b.sources).map(R=>nc(R,{checked:R.selected||x&&R.available&&R.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 E("import");if(a||T!==g)return;A.running?(O(A),window.clearTimeout(i),i=window.setTimeout(M,1e3)):x||O(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,C())}}return r(".import-sources").addEventListener("change",C),r(".import-start").addEventListener("click",()=>{m?w([...s.querySelectorAll("input:checked")].map(x=>x.value)):S(p)}),r(".dialog-close").addEventListener("click",()=>s.close()),s.addEventListener("close",()=>{g++,d=!1,t(),l?.focus()}),s.addEventListener("keydown",x=>x.stopPropagation()),{open:S,sources:async()=>(await E("sources")).sources,select:x=>w(x),get busy(){return o||c||f||!!i},refresh:(x=!1)=>w(void 0,x),resume:()=>{u=!0,o=!0,window.clearTimeout(i),M()},dispose:()=>{a=!0,h.abort(),window.clearTimeout(i),s.remove()}}}const Mg=6e4,Dg=3e4;class Rg{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<Dg)){this.checking=!0,this.activity();try{await this.options.refresh()}finally{this.checking=!1}}}dispose(){this.disposed=!0}}class Pg{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 Vg=Object.freeze({sourceID:"",projectID:"",directory:"",days:0,fromDate:"",toDate:"",includeChildren:!0,includeArchived:!1}),Ng=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 Fg(e){const t={...Vg};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"])Ng(n[s])&&(t[s]=n[s]);return t.fromDate&&t.toDate&&t.fromDate>t.toDate&&(t.fromDate="",t.toDate=""),t}const Hg=e=>typeof e=="number"&&Number.isSafeInteger(e)&&e>=0;function Qc(e){const t=e.filter(i=>["opencode","continue"].includes(i.source||"opencode")&&Hg(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 oi=15e3,nr=5e3,el=1e3,ii=30,Ao=oi/1e3*ii,sy=(oi+nr+el)/1e3*ii,ry=e=>Math.min(1,e/(Ao-1)),oy=e=>e<Ao?null:Math.min(1,(e-Ao+1)/(nr/1e3*ii));function iy(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 _g=new Intl.DateTimeFormat("en",{month:"short",year:"numeric"}),Bg=new Intl.DateTimeFormat("en",{month:"short",day:"numeric",year:"numeric"}),jg=(e,t)=>(t>=90*864e5?_g:Bg).format(e);function Wg(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 tl(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 Ug(e,t){return!t||e.source===t||!!(e.source==="t3-code"&&e.linkedSessionIDs?.some(n=>n.startsWith(`${t}:`)))}const Er=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}),ai="sessiongraph.preferences",Ca={motion:["system","on","off"],view:["3d","2d"],density:["comfortable","compact"],quality:["performance","balanced","high"],trails:["all","selected","off"]},Ta={clickVolume:[0,100],panelOpacity:[55,100],bloom:[0,75],nodeScale:[60,180],trailOpacity:[0,100],trailSpeed:[10,100],playbackSpeed:[.25,3]};function xr(e){const t={...Er};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 Ca)Ca[s].includes(r)&&Object.assign(t,{[s]:r});else if(s in Ta){const[o,i]=Ta[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 nl(e){try{const t=JSON.parse(e.getItem(ai)||e.getItem("session-atlas.preferences")||"null");return xr(t?.version===1?t.values:void 0)}catch{return{...Er}}}function sl(e,t){try{return e.setItem(ai,JSON.stringify({version:1,values:xr(t)})),!0}catch{return!1}}const Lo=(e,t)=>e.motion==="on"||e.motion==="system"&&!t,Ze=[["interface","Interface",kd],["sources","Sources",vd],["audio","Sound",ec],["graphics","Graphics",Qa],["trails","Trails & playback",Cd],["privacy","Privacy",$d]],Je=(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>`,Ht=(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 qg(e){const t=document.createElement("dialog");t.className="settings-dialog",t.setAttribute("aria-labelledby","settings-title"),t.innerHTML=`<header class="settings-heading"><div><h2 id="settings-title">Settings</h2><p>Import, appearance, and playback preferences.</p></div><button class="icon-button settings-close" aria-label="Close settings">×</button></header>
30
- <div class="settings-layout"><nav class="settings-tabs" role="tablist" aria-label="Settings categories">${Ze.map(([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}">${Xa([m[0],{...m[1],"aria-hidden":"true","stroke-width":1.5},m[2]]).outerHTML}${d}</button>`).join("")}</nav>
31
- <div class="settings-content">
32
- <section id="settings-interface" role="tabpanel" aria-labelledby="settings-tab-interface"><h3>Interface</h3><p class="settings-description">View preferences and filters are saved with your library.</p>
33
- ${Dn("view","Default view","Switch between depth and a flat timeline.",[["3d","3D galaxy"],["2d","2D timeline"]])}
34
- ${Dn("motion","Motion","Camera transitions, reveals, and ambient movement.",[["system","Follow system"],["on","On"],["off","Off"]])}
35
- ${Dn("density","Session list","Adjust spacing between sessions.",[["comfortable","Comfortable"],["compact","Compact"]])}
36
- <label class="setting-row"><span><strong>Show archived sessions</strong><small>Include archived history in the map and session list.</small></span><input class="settings-archived" type="checkbox" role="switch" aria-label="Show archived sessions"/></label>
37
- ${Ht("panelOpacity","Panel opacity","Adjust panel background transparency.",55,100)}
38
- <div class="settings-note"><span>Restore the default panel layout.</span><button class="secondary-button settings-reset-panels">Reset panel positions</button></div>
39
- </section>
40
- <section id="settings-sources" role="tabpanel" aria-labelledby="settings-tab-sources" hidden><h3>Sources</h3><p class="settings-description">Choose the local apps to import. Importing is read-only.</p>
41
- ${Je("autoImport","Auto-import sessions","Check selected sources on startup, on return, and every minute while visible.")}
42
- <div class="settings-sources-list import-sources"></div>
43
- <div class="settings-import-progress" role="status"></div>
44
- <div class="settings-note"><span>Source changes apply when you import. Previously saved history is kept.</span><button class="secondary-button settings-import" disabled>Import selected sources</button></div>
45
- </section>
46
- <section id="settings-audio" role="tabpanel" aria-labelledby="settings-tab-audio" hidden><h3>Sound</h3><p class="settings-description">Interaction sounds are synthesized locally.</p>
47
- ${Je("muted","Mute all sound","Silence everything. Your volume levels are kept.")}
48
- ${Je("clickSounds","Interaction sounds","A soft tick for controls; a chime for sessions.")}
49
- ${Ht("clickVolume","Interaction volume","Adjust interaction sound volume.",0,100)}
50
- <div class="settings-note"><span class="settings-audio-status" role="status">Sound starts after your first interaction.</span><button class="secondary-button settings-preview" data-sound="none">Preview chime</button></div>
51
- <p class="settings-footnote">Audio pauses while this tab is hidden. The speaker button on the map is a quick mute.</p>
52
- </section>
53
- <section id="settings-graphics" role="tabpanel" aria-labelledby="settings-tab-graphics" hidden><h3>Graphics</h3><p class="settings-description">Adjust rendering quality and map appearance.</p>
54
- ${Dn("quality","Render quality","Performance uses 1× resolution and skips post-process effects.",[["performance","Performance"],["balanced","Balanced"],["high","High fidelity"]])}
55
- ${Ht("bloom","Glow strength","Soft light around bright nodes; disabled in Performance.",0,75)}
56
- ${Ht("nodeScale","Node size","Scale the lights without changing their positions.",60,180)}
57
- ${Je("stars","Starfield","A faint field of stars behind the timeline.")}
58
- ${Je("labels","Map labels","Directory names and the selected session title.")}
59
- ${Je("focusDimming","Focus dimming","Dim surrounding nodes when a session is selected.")}
60
- </section>
61
- <section id="settings-trails" role="tabpanel" aria-labelledby="settings-tab-trails" hidden><h3>Trails &amp; playback</h3><p class="settings-description">Trails start at creation and end at the latest recorded message.</p>
62
- ${Dn("trails","Session trails","Choose how much history to draw on the map.",[["all","All sessions"],["selected","Selected session"],["off","Hidden"]])}
63
- ${Ht("trailOpacity","Trail brightness","Fade lifetime trails into the background.",0,100)}
64
- ${Je("trailFlow","Flowing trails","A decorative pulse along each lifetime; respects Motion.")}
65
- ${Ht("trailSpeed","Flow speed","How quickly the light travels along the trails.",10,100)}
66
- ${Je("relationships","Relationship links","Show recorded fork and child connections.")}
67
- ${Je("messageDots","Message dots","User and assistant messages, colored to match the selected session.")}
68
- ${Ht("playbackSpeed","Playback speed","1× plays the full timeline in 15 seconds.",.25,3,"×",.25)}
69
- <p class="settings-footnote">Flow is decorative. Message dots reflect saved timestamps; visual settings never alter your history.</p>
70
- </section>
71
- <section id="settings-privacy" role="tabpanel" aria-labelledby="settings-tab-privacy" hidden><h3>Privacy</h3><p class="settings-description">Local storage and network access.</p>
72
- <div class="settings-note"><span><strong>Public profile</strong><br>Choose which usage fields to share. Nothing uploads until you review a preview and publish.</span><button class="secondary-button settings-publishing">Publishing settings</button></div>
73
- <div class="setting-row"><span><strong>Processed on this computer</strong><small>Importing, indexing, search, and visualization run locally. Imports read your selected sources without changing them or starting an AI agent.</small></span></div>
74
- <div class="setting-row"><span><strong>Update checks use the internet</strong><small>Desktop update checks and downloads contact GitHub without session content. npm installation contacts its registry. These services receive ordinary connection metadata, including your public IP address.</small></span></div>
75
- <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>
76
- <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>
77
- </section>
78
- </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=tc(m).map(y=>nc(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();t.querySelector(".settings-publishing").addEventListener("click",()=>{t.close(),e.publishing()},s);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(([C])=>C===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({...Er})},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 C=y.dataset.pref;y.type==="checkbox"?y.checked=!!g[C]:y.value=String(g[C]);const E=t.querySelector(`[data-output="${C}"]`);E&&(E.value=`${g[C]}${E.dataset.unit}`),y.disabled=C==="bloom"&&g.quality==="performance"||C==="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 Gg{constructor(t,n){this.preferences=t,this.status=n;const s={signal:this.events.signal};document.addEventListener("click",r=>{if(!r.isTrusted)return;const o=r.target?.closest('button, a[href], summary, input[type="checkbox"], [role="option"]');!o||o.matches(":disabled")||o.closest('[data-sound="none"], [data-drag-panel]')||this.play(o.matches('[data-session], [data-related], [role="option"]')?"select":"click")},s),document.addEventListener("change",r=>{r.isTrusted&&r.target?.matches('select, input[type="range"]')&&this.play("click")},s),document.addEventListener("pointerdown",r=>{r.isTrusted&&(this.interacted=!0,this.unlock())},{...s,passive:!0}),document.addEventListener("keydown",r=>{r.isTrusted&&!r.repeat&&["Enter"," ","ArrowUp","ArrowDown"].includes(r.key)&&(this.interacted=!0,this.unlock())},s),document.addEventListener("visibilitychange",()=>this.sync(),s),window.addEventListener("pagehide",()=>{this.active=!1,this.sync()},s),window.addEventListener("pageshow",()=>{this.active=!0,this.sync()},s)}preferences;status;context;master;analyser;voices=new Set;events=new AbortController;disposed=!1;unavailable=!1;clicks=0;lastClick=0;suspendTimer;active=!0;interacted=!1;enabled(){return!this.preferences.muted&&this.preferences.clickSounds&&this.preferences.clickVolume>0}async unlock(){if(!(this.disposed||document.hidden||!this.active||!this.enabled()))try{if(!this.context){this.context=new AudioContext,this.master=this.context.createGain(),this.master.gain.value=0;const t=this.context.createDynamicsCompressor();t.threshold.value=-12,t.ratio.value=6,this.analyser=this.context.createAnalyser(),this.analyser.fftSize=256,this.master.connect(t).connect(this.analyser).connect(this.context.destination),this.context.addEventListener("statechange",()=>this.report(),{signal:this.events.signal})}this.context.state==="suspended"&&await this.context.resume(),this.disposed||this.sync()}catch{this.unavailable=!0,this.report()}}ramp(t,n,s=.15){const r=this.context.currentTime;t.cancelScheduledValues(r),t.setTargetAtTime(n,r,s)}cleanup(t){t.nodes.forEach(n=>n.disconnect()),this.voices.delete(t)}sync(){clearTimeout(this.suspendTimer);const t=this.context;if(!t||this.disposed){this.report();return}const n=this.enabled()&&!document.hidden&&this.active;if(n&&t.state==="suspended"&&t.resume().catch(()=>{this.unavailable=!0,this.report()}),this.ramp(this.master.gain,n?.7:0,.035),!n){const s=()=>{for(const r of this.voices)r.sources.forEach(o=>{try{o.stop()}catch{}}),this.cleanup(r);t.suspend().catch(()=>{})};document.hidden||!this.active?s():this.suspendTimer=setTimeout(s,180)}this.report()}report(){this.status(this.unavailable?"Audio is unavailable in this browser.":this.preferences.muted?"All sound is muted.":document.hidden||!this.active?"Audio paused while the app is hidden.":this.context?.state==="running"?"Audio is ready · pauses automatically in the background.":"Click a control or preview to start audio.")}configure(t){this.preferences=t,this.sync(),!this.context&&this.interacted&&this.unlock()}async play(t="click"){await this.unlock();const n=this.context;if(this.disposed||!n||n.state!=="running"||document.hidden||!this.active||this.preferences.muted||!this.preferences.clickSounds||!this.preferences.clickVolume||performance.now()-this.lastClick<45)return;this.lastClick=performance.now(),this.clicks++;const s=n.createGain(),r=n.createOscillator(),o=n.currentTime;r.type="sine",r.frequency.setValueAtTime(t==="select"?660:900,o),r.frequency.exponentialRampToValueAtTime(t==="select"?990:420,o+.065),s.gain.setValueAtTime(0,o),s.gain.linearRampToValueAtTime(this.preferences.clickVolume/100*.12,o+.004),s.gain.exponentialRampToValueAtTime(1e-4,o+(t==="select"?.19:.065)),r.connect(s).connect(this.master);const i={gain:s,sources:[r],nodes:[r,s]};this.voices.add(i),r.onended=()=>this.cleanup(i),r.start(),r.stop(o+.22)}diagnostics(){const t=new Float32Array(256);return this.analyser?.getFloatTimeDomainData(t),{state:this.context?.state||"unstarted",muted:this.preferences.muted,voices:this.voices.size,clicks:this.clicks,rms:Math.sqrt(t.reduce((n,s)=>n+s*s,0)/t.length)}}dispose(){this.disposed=!0,this.events.abort(),clearTimeout(this.suspendTimer);for(const t of this.voices)t.sources.forEach(n=>{try{n.stop()}catch{}}),this.cleanup(t);this.context?.close().catch(()=>{})}}const ay=e=>e.kind==="message"&&(e.role==="user"||e.role==="assistant"),rl=e=>e.kind==="message"?e.role==="user"?"#b0e9d6":"#9bbcff":e.kind.startsWith("tool_")?"#eac594":"#d7a1f1",ol=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],Et=e=>e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]),Yg=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"medium"}),ka=e=>e===null?"Time not recorded":Yg.format(e),Aa=e=>`<span class="event-badge" style="--event-color:${rl(e)}">${ol(e)}</span>`;function Kg(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>
79
- <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>
80
- <div class="event-scroll"><article class="event-content" aria-label="Message details" tabindex="0"></article>
81
- <details class="event-browser"><summary>Browse messages <span class="event-count"></span></summary>
82
- <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>
83
- </details>
84
- </div><footer class="event-footer"><span class="event-coverage"></span><button class="text-button event-reload">Reload</button></footer>`,e.append(s);const r=w=>s.querySelector(w),o=new AbortController;let i,a,l,c;const f="messages";let u=!1,h,p,g={};const d=(w,S)=>`<button class="event-row" data-event="${Et(w.id)}" aria-current="${l?.selected?.id===w.id?"true":"false"}"><span class="event-row-top">${Aa(w)}<small>#${l.offset+S+1}</small></span><span class="event-preview">${Et(w.preview||"No text recorded")}</span><time>${ka(w.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 S of["previous","next"])r(`[data-page="${S}"]`).disabled=!l[`${S}Cursor`];r(".event-coverage").textContent=l.partial?"Partial history":"Saved locally";const w=l.selected;r(".event-position").textContent=w?`${l.offset+l.items.findIndex(S=>S.id===w.id)+1} / ${l.total}`:"No messages";for(const S of["previous","next"])r(`[data-step="${S}"]`).disabled=!l[`${S}Item`];if(!w){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(w),r(".event-content").innerHTML=`<div class="event-detail-heading">${Aa(w)}<h3>${Et(w.name)}</h3><p>${ka(w.time)}</p></div>
85
- ${w.partial?'<p class="event-warning">Partial message</p>':""}
86
- ${w.text?`<section class="event-payload"><pre>${Et(w.text)}</pre></section>`:'<p class="event-empty">No message text was recorded.</p>'}
87
- <details class="event-provenance"><summary>Source details</summary><dl><dt>Source</dt><dd>${Et(Le(a?.source))}</dd><dt>Message ID</dt><dd>${Et(w.messageID)}</dd><dt>Timestamp source</dt><dd>${Et(w.timeSource)}</dd></dl></details>`}async function C(w={}){if(!a)return;clearTimeout(p),i?.abort();const S=new AbortController;i=S,g=w,u=!0,s.setAttribute("aria-busy","true"),r(".event-position").textContent="Loading…";for(const R of s.querySelectorAll("[data-step], [data-page]"))R.disabled=!0;const x=r(".event-list").scrollTop,T=l?.offset,b=document.activeElement,A=b instanceof HTMLElement?b.dataset:void 0;try{const R=await t.read(a.id,{filter:f,...w,...c?{revision:c}:{}},S.signal);if(S.signal.aborted)return;l=R,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(R){if(S.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>${Et(R instanceof Error?R.message:"Please retry.")}</p><button class="secondary-button" data-retry>Retry</button> <button class="secondary-button" data-reload>Reload current history</button></div>`}finally{i===S&&(u=!1,s.removeAttribute("aria-busy"))}}const E=()=>{t.clear(),c=void 0,l=void 0,C()},O=()=>!s.hidden&&!e.hidden,M=()=>{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)},D=w=>{if(u)return;const S=w==="next"?l?.nextItem:l?.previousItem;S&&C({item:S})};return s.addEventListener("click",w=>{const S=w.target.closest("button");if(S){if(S.dataset.event&&C({item:S.dataset.event}),S.dataset.step&&D(S.dataset.step==="next"?"next":"previous"),S.dataset.page){const x=S.dataset.page==="next"?l?.nextCursor:l?.previousCursor;x&&C({cursor:x})}S.hasAttribute("data-retry")&&C(g),(S.hasAttribute("data-reload")||S.classList.contains("event-reload"))&&E(),S.classList.contains("event-close")&&(M(),document.querySelector("#scene canvas")?.focus({preventScroll:!0}))}},{signal:o.signal}),r(".event-browser").addEventListener("toggle",m,{signal:o.signal}),{close:M,handleKey(w){return!O()||w.defaultPrevented||w.metaKey||w.ctrlKey||w.altKey||w.shiftKey||document.querySelector("dialog[open]")||w.target.closest('input, select, textarea, [contenteditable="true"], [data-drag-panel], #explorer')?!1:w.key==="Escape"?(w.preventDefault(),M(),document.querySelector("#scene canvas")?.focus({preventScroll:!0}),!0):["ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].includes(w.key)?(w.preventDefault(),D(w.key==="ArrowLeft"||w.key==="ArrowUp"?"previous":"next"),!0):!1},open(w,S,x){clearTimeout(p),h?.abort();const T=a?.id===w.id;a=w,c=x,l=void 0,r("#event-title").textContent=`${Le(w.source)} messages`,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(S?{item:S}:{})},dispose(){clearTimeout(p),h?.abort(),i?.abort(),o.abort(),s.remove()}}}function zg(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,C){if(!a)return;const E=`${ol(a)} · ${a.name}`,O=y||"No text recorded.",M=[C,f>1?`${f} nearby items`:"","Click to focus and read · ← / → to navigate"].filter(Boolean).join(" · ");u.textContent!==E&&(u.textContent=E),h.textContent!==O&&(h.textContent=O),p.textContent!==M&&(p.textContent=M),u.parentElement!==e&&e.replaceChildren(u,h,p),e.classList.add("message-tooltip"),e.hidden=!1,e.style.setProperty("--event-color",rl(a));const D=e.offsetWidth,w=e.offsetHeight,S=t.getBoundingClientRect(),x=[...document.querySelectorAll(".floating-panel:not([hidden]), .app-header, .map-controls")].map(A=>A.getBoundingClientRect()),b=[c+18,c-w-18].flatMap(A=>[l+18,l-D-18].map(R=>{R=Math.max(8,Math.min(R,t.clientWidth-D-8)),A=Math.max(8,Math.min(A,t.clientHeight-w-8));const V=S.left+R,H=S.top+A,Z=x.reduce((re,J)=>re+Math.max(0,Math.min(V+D,J.right+8)-Math.max(V,J.left-8))*Math.max(0,Math.min(H+w,J.bottom+8)-Math.max(H,J.top-8)),0);return{left:R,top:A,overlap:Z}})).reduce((A,R)=>R.overlap<A.overlap?R:A);e.style.left=`${b.left}px`,e.style.top=`${b.top}px`}function m(y){const C=[y.text,y.input?`Input
88
- ${y.input}`:"",y.output?`Output
89
- ${y.output}`:""].filter(Boolean).join(`
90
-
91
- `);return{text:C.slice(0,1800),shortened:C.length>1800||!!y.partial}}return{clear:g,show(y,C,E,O,M,D){const w=`${C}:${E}:${y.id}`,S=r!==w;S&&g(),r=w,a=y,l=M,c=D,f=O;const x=s.get(w);d(x?.text||y.preview,x?x.shortened?"Content preview":"":"Loading message…"),!(!S||x)&&(i=setTimeout(async()=>{const T=new AbortController;o=T;try{const b=await n.read(C,{item:y.id,revision:E,filter:"messages"},T.signal);if(T.signal.aborted||r!==w||b.selected?.id!==y.id)return;const A=m(b.selected);s.set(w,A),s.size>20&&s.delete(s.keys().next().value),d(A.text,A.shortened?"Content preview":"")}catch{!T.signal.aborted&&r===w&&d(y.preview,"Saved excerpt · open for details")}},120))},dispose(){g(),s.clear()}}}class Zg{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]),C=JSON.stringify(m).length;for(this.characters-=this.pages.get(y)?.characters||0,this.pages.delete(y),this.pages.set(y,{page:m,characters:C}),this.characters+=C;this.pages.size>20||this.characters>2e6;){const E=this.pages.keys().next().value;this.characters-=this.pages.get(E).characters,this.pages.delete(E)}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 xs,Xt,Ie,Qt,Ss,Gr,$s;const La="__TAURI_TO_IPC_KEY__";function Jg(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}class cy{constructor(t){xs.add(this),Xt.set(this,void 0),Ie.set(this,0),Qt.set(this,[]),Ss.set(this,void 0),tn(this,Xt,t||(()=>{})),this.id=Jg(n=>{const s=n.index;if("end"in n){s==ae(this,Ie,"f")?this.cleanupCallback():tn(this,Ss,s);return}const r=n.message;if(s==ae(this,Ie,"f")){for(ae(this,xs,"m",Gr).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,xs,"m",Gr).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,Ss,"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,Ss=new WeakMap,xs=new WeakSet,Gr=function(n){try{ae(this,Xt,"f").call(this,n)}catch(s){queueMicrotask(()=>{throw s})}},La)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[La]()}}async function il(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}class ly{get rid(){return ae(this,$s,"f")}constructor(t){$s.set(this,void 0),tn(this,$s,t)}async close(){return il("plugin:resources|close",{rid:this.rid})}async[($s=new WeakMap,Symbol.asyncDispose)](){await this.close()}}function Xg(){return!!(globalThis||window).isTauri}async function Qg(){await il("plugin:process|restart")}class em{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 tm='<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>',nm='<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 sm(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"?nm:tm}<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 em(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 rm(){return Xg()?sm({async check(){const{check:e}=await lr(async()=>{const{check:n}=await import("./index-DYhIhreE.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 Qg()}}):{dispose(){}}}var om=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"),X=om.build();function Yr(e,t){return e-t*Math.floor(e/t)}const al=1721426;function Is(e,t,n,s){t=ci(e,t);let r=t-1,o=-2;return n<=2?o=0:Fs(t)&&(o=-1),al-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*n-362)/12+o+s)}function Fs(e){return e%4===0&&(e%100!==0||e%400===0)}function ci(e,t){return e==="BC"?1-t:t}function im(e){let t="AD";return e<=0&&(t="BC",e=1-e),[t,e]}const am={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-al,r=Math.floor(s/146097),o=Yr(s,146097),i=Math.floor(o/36524),a=Yr(o,36524),l=Math.floor(a/1461),c=Yr(a,1461),f=Math.floor(c/365),u=r*400+i*100+l*4+f+(i!==4&&f!==4?1:0),[h,p]=im(u),g=n-Is(h,p,1,1),d=2;n<Is(h,p,3,1)?d=0:Fs(p)&&(d=1);let m=Math.floor(((g+d)*12+373)/367),y=n-Is(h,p,m,1)+1;return new Ve(h,p,m,y)}toJulianDay(t){return Is(t.era,t.year,t.month,t.day)}getDaysInMonth(t){return am[Fs(t.year)?"leapyear":"standard"][t.month-1]}getMonthsInYear(t){return 12}getDaysInYear(t){return Fs(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 cm={"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=ue(t,e.calendar),e.era===t.era&&e.year===t.year&&e.month===t.month&&e.day===t.day}function lm(e,t){return t=ue(t,e.calendar),e=nt(e),t=nt(t),e.era===t.era&&e.year===t.year&&e.month===t.month}function dm(e,t){return t=ue(t,e.calendar),e=es(e),t=es(t),e.era===t.era&&e.year===t.year}function um(e,t){return Sr(e.calendar,t.calendar)&&Se(e,t)}function Rn(e,t){return Sr(e.calendar,t.calendar)&&lm(e,t)}function Pn(e,t){return Sr(e.calendar,t.calendar)&&dm(e,t)}function Sr(e,t){return e.isEqual?.(t)??t.isEqual?.(e)??e.identifier===t.identifier}function fm(e,t){return Se(e,$r(t))}const hm={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6};function cl(e,t,n){let s=e.calendar.toJulianDay(e),r=n?hm[n]:vm(t),o=Math.ceil(s+1-r)%7;return o<0&&(o+=7),o}function ll(e){return st(Date.now(),e)}function $r(e){return jt(ll(e))}function dl(e,t){return e.calendar.toJulianDay(e)-t.calendar.toJulianDay(t)}function pm(e,t){return Oa(e)-Oa(t)}function Oa(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let Kr=null,gm=!1;function li(){return Kr==null&&(Kr=new Intl.DateTimeFormat().resolvedOptions().timeZone),Kr}function ul(){return gm}function nt(e){return e.subtract({days:e.day-1})}function Oo(e){return e.add({days:e.calendar.getDaysInMonth(e)-e.day})}function es(e){return nt(e.subtract({months:e.month-1}))}function mm(e){return Oo(e.add({months:e.calendar.getMonthsInYear(e)-e.month}))}function It(e,t,n){let s=cl(e,t,n);return e.subtract({days:s})}function Ma(e,t,n){return It(e,t,n).add({days:6})}const Da=new Map,zr=new Map;function fl(e){if(Intl.Locale){let n=Da.get(e);return n||(n=new Intl.Locale(e).maximize().region,n&&Da.set(e,n)),n}let t=e.split("-")[1];return t==="u"?void 0:t}function vm(e){let t=zr.get(e);if(!t){if(Intl.Locale){let s=new Intl.Locale(e);if("getWeekInfo"in s&&(t=s.getWeekInfo(),t))return zr.set(e,t),t.firstDay}let n=fl(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&&cm[n]||0};zr.set(e,t)}return t.firstDay}function ym(e,t,n){let s=e.calendar.getDaysInMonth(e);return Math.ceil((cl(nt(e),t,n)+s)/7)}function hl(e,t){return e&&t?e.compare(t)<=0?e:t:e||t}function pl(e,t){return e&&t?e.compare(t)>=0?e:t:e||t}const bm={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 wm(e,t){let n=e.calendar.toJulianDay(e),s=Math.ceil(n+1)%7;s<0&&(s+=7);let r=fl(t),[o,i]=bm[r]||[6,0];return s===o||s===i}function gn(e){e=ue(e,new pn);let t=ci(e.era,e.year);return gl(t,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function gl(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 Mo(e,t){if(t==="UTC")return 0;if(e>0&&t===li()&&!ul())return new Date(e).getTimezoneOffset()*-6e4;let{year:n,month:s,day:r,hour:o,minute:i,second:a}=ml(e,t);return gl(n,s,r,o,i,a,0)-Math.floor(e/1e3)*1e3}const Ra=new Map;function ml(e,t){let n=Ra.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"}),Ra.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 Pa=864e5;function Em(e,t,n,s){return(n===s?[n]:[n,s]).filter(o=>xm(e,t,o))}function xm(e,t,n){let s=ml(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 tt(e,t,n="compatible"){let s=Oe(e);if(t==="UTC")return gn(s);if(t===li()&&n==="compatible"&&!ul()){s=ue(s,new pn);let l=new Date,c=ci(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=Mo(r-Pa,t),i=Mo(r+Pa,t),a=Em(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 vl(e,t,n="compatible"){return new Date(tt(e,t,n))}function st(e,t){let n=Mo(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 jt(e){return new Ve(e.calendar,e.era,e.year,e.month,e.day)}function Oe(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 rr(e.calendar,e.era,e.year,e.month,e.day,n,s,r,o)}function ue(e,t){if(Sr(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,Gt(s),s}function yl(e,t,n){if(e instanceof ts)return e.timeZone===t?e:$m(e,t);let s=tt(e,t,n);return st(s,t)}function Sm(e){let t=gn(e)-e.offset;return new Date(t)}function $m(e,t){let n=gn(e)-e.offset;return ue(st(n,t),e.calendar)}const Vn=36e5;function Ir(e,t){let n=e.copy(),s="hour"in n?km(n,t):0;Do(n,t.years||0),n.calendar.balanceYearMonth&&n.calendar.balanceYearMonth(n,e),n.month+=t.months||0,Ro(n),bl(n),n.day+=(t.weeks||0)*7,n.day+=t.days||0,n.day+=s,Im(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 Do(e,t){e.calendar.isInverseEra?.(e)&&(t=-t),e.year+=t}function Ro(e){for(;e.month<1;)Do(e,-1),e.month+=e.calendar.getMonthsInYear(e);let t=0;for(;e.month>(t=e.calendar.getMonthsInYear(e));)e.month-=t,Do(e,1)}function Im(e){for(;e.day<1;)e.month--,Ro(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,Ro(e)}function bl(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 Gt(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),bl(e)}function wl(e){let t={};for(let n in e)typeof e[n]=="number"&&(t[n]=-e[n]);return t}function El(e,t){return Ir(e,wl(t))}function di(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),Gt(n),n}function sr(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),Tm(n),n}function Cm(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=Cs(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=Cs(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=Cs(e.minute,60);let t=Math.floor(e.hour/24);return e.hour=Cs(e.hour,24),t}function Tm(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 Cs(e,t){let n=e%t;return n<0&&(n+=t),n}function km(e,t){return e.hour+=t.hours||0,e.minute+=t.minutes||0,e.second+=t.seconds||0,e.millisecond+=t.milliseconds||0,Cm(e)}function ui(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=rt(i,n,0,o.length-1,s?.round),r.era=o[i],Gt(r);break}case"year":r.calendar.isInverseEra?.(r)&&(n=-n),r.year=rt(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=rt(e.month,n,1,e.calendar.getMonthsInYear(e),s?.round);break;case"day":r.day=rt(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),Gt(r),r}function xl(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=rt(o,n,i,a,s?.round);break}case"minute":r.minute=rt(e.minute,n,0,59,s?.round);break;case"second":r.second=rt(e.second,n,0,59,s?.round);break;case"millisecond":r.millisecond=rt(e.millisecond,n,0,999,s?.round);break;default:throw new Error("Unsupported field "+t)}return r}function rt(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 Sl(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=Ir(Oe(e),{years:t.years,months:t.months,weeks:t.weeks,days:t.days});n=tt(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=st(n,e.timeZone);return ue(s,e.calendar)}function Am(e,t){return Sl(e,wl(t))}function Lm(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=Oe(e),a=ue(sr(i,{hour:r}),new pn),l=[tt(a,e.timeZone,"earlier"),tt(a,e.timeZone,"later")].filter(g=>st(g,e.timeZone).day===a.day)[0],c=ue(sr(i,{hour:o}),new pn),f=[tt(c,e.timeZone,"earlier"),tt(c,e.timeZone,"later")].filter(g=>st(g,e.timeZone).day===c.day).pop(),u=gn(e)-e.offset,h=Math.floor(u/Vn),p=u%Vn;return u=rt(h,n,Math.floor(l/Vn),Math.floor(f/Vn),s?.round)*Vn+p,ue(st(u,e.timeZone),e.calendar)}case"minute":case"second":case"millisecond":return xl(e,t,n,s);case"era":case"year":case"month":case"day":{let r=ui(Oe(e),t,n,s),o=tt(r,e.timeZone);return ue(st(o,e.timeZone),e.calendar)}default:throw new Error("Unsupported field "+t)}}function Om(e,t,n){let s=Oe(e),r=sr(di(s,t),t);if(r.compare(s)===0)return e;let o=tt(r,e.timeZone,n);return ue(st(o,e.timeZone),e.calendar)}const Mm=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,Dm=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function Rm(e){let t=e.match(Mm);if(!t)throw Dm.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let n=new Ve(Zr(t[1],0,9999),Zr(t[2],1,12),1);return n.day=Zr(t[3],1,n.calendar.getDaysInMonth(n)),n}function Zr(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 Pm(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 $l(e){let t=ue(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 Il(e){return`${$l(e)}T${Pm(e)}`}function Vm(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 Nm(e){return`${Il(e)}${Vm(e.offset)}[${e.timeZone}]`}function fi(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 Ve{#e;constructor(...t){let[n,s,r,o,i]=fi(t);this.calendar=n,this.era=s,this.year=r,this.month=o,this.day=i,Gt(this)}copy(){return this.era?new Ve(this.calendar,this.era,this.year,this.month,this.day):new Ve(this.calendar,this.year,this.month,this.day)}add(t){return Ir(this,t)}subtract(t){return El(this,t)}set(t){return di(this,t)}cycle(t,n,s){return ui(this,t,n,s)}toDate(t){return vl(this,t)}toString(){return $l(this)}compare(t){return dl(this,t)}}class rr{#e;constructor(...t){let[n,s,r,o,i]=fi(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,Gt(this)}copy(){return this.era?new rr(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new rr(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(t){return Ir(this,t)}subtract(t){return El(this,t)}set(t){return di(sr(this,t),t)}cycle(t,n,s){switch(t){case"era":case"year":case"month":case"day":return ui(this,t,n,s);default:return xl(this,t,n,s)}}toDate(t,n){return vl(this,t,n)}toString(){return Il(this)}compare(t){let n=dl(this,t);return n===0?pm(this,Oe(t)):n}}class ts{#e;constructor(...t){let[n,s,r,o,i]=fi(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,Gt(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 Sl(this,t)}subtract(t){return Am(this,t)}set(t,n){return Om(this,t,n)}cycle(t,n,s){return Lm(this,t,n,s)}toDate(){return Sm(this)}toString(){return Nm(this)}toAbsoluteString(){return this.toDate().toISOString()}compare(t){return this.toDate().getTime()-yl(t,this.timeZone).toDate().getTime()}}let Jr=new Map;class Ae{constructor(t,n={}){this.formatter=Cl(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 _m()&&(this.resolvedHourCycle||(this.resolvedHourCycle=Bm(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 Fm={true:{ja:"h11"},false:{}};function Cl(e,t={}){if(typeof t.hour12=="boolean"&&Hm()){t={...t};let r=Fm[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(Jr.has(n))return Jr.get(n);let s=new Intl.DateTimeFormat(e,t);return Jr.set(n,s),s}let Xr=null;function Hm(){return Xr==null&&(Xr=new Intl.DateTimeFormat("en-US",{hour:"numeric",hour12:!1}).format(new Date(2020,2,3,0))==="24"),Xr}let Qr=null;function _m(){return Qr==null&&(Qr=new Intl.DateTimeFormat("fr",{hour:"numeric",hour12:!1}).resolvedOptions().hourCycle==="h12"),Qr}function Bm(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=Cl(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 jm(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=zt(e,t,n).subtract(o);return os(e,i,t,n,s,r)}function zt(e,t,n,s,r){let o=e;return t.years?o=es(e):t.months?o=nt(e):t.weeks&&(o=It(e,n)),os(e,o,t,n,s,r)}function hi(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=zt(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=pl(t,zt(jt(r),n,s))),o&&e.compare(o)<=0&&(t=hl(t,hi(jt(o),n,s))),t}function ke(e,t,n){const s=jt(e),r=t?jt(t):void 0,o=n?jt(n):void 0;let i=s;return r&&(i=pl(i,r)),o&&(i=hl(i,o)),i.compare(s)===0?e:"hour"in e?e.set({year:i.year,month:i.month,day:i.day}):i}function Va(e,t,n,s,r,o){switch(t){case"start":return zt(e,n,s,r,o);case"end":return hi(e,n,s,r,o);default:return jm(e,n,s,r,o)}}function St(e,t){return e==null||t==null?e===t:!("hour"in e)&&!("hour"in t)?Se(e,t):Oe(e).compare(Oe(t))===0}function Na(e,t,n,s,r){return e?t?.(e,n)?!0:Be(e,s,r):!1}function Be(e,t,n){return t!=null&&e.compare(t)<0||n!=null&&e.compare(n)>0}function Wm(e,t,n){const s=e.subtract({days:1});return Se(s,e)||Be(s,t,n)}function Um(e,t,n){const s=e.add({days:1});return Se(s,e)||Be(s,t,n)}function pi(e){let t={...e};for(let n in t)t[n]=1;return t}function Tl(e,t){let n={...t};return n.days?n.days--:n.days=-1,e.add(n)}function kl(e){if(!e)return;const t=e.calendar.identifier;return t==="gregory"||t==="iso8601"?e.era==="BC"?"short":void 0:"short"}function Al(e,t,n){const s=n??Oe($r(t));return new Ae(e,{weekday:"long",month:"long",year:"numeric",day:"numeric",era:kl(s),calendar:s.calendar.identifier,timeZone:t})}function Fa(e,t,n){const s=n??$r(t);return new Ae(e,{month:"long",year:"numeric",era:kl(s),calendar:s.calendar.identifier,timeZone:t})}function qm(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=Al(n,s);return Se(r,o)?i.format(r.toDate(s)):qm(r,o,i,(a,l)=>`${a} – ${l}`,s)}var Gm=["sun","mon","tue","wed","thu","fri","sat"];function Ll(e){return e!=null?Gm[e]:void 0}function Ol(e,t,n){const s=Ll(n);return It(e,t,s)}function Ml(e,t,n,s){const r=t.add({weeks:e}),o=[];let i=Ol(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 Ym(e,t,n,s){const r=Ll(s),o=n??ym(e,t,r);return[...new Array(o).keys()].map(a=>Ml(a,e,t,s))}function Km(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 zm(e,t,n,s){const r=Ol(e,s,t),o=[...new Array(7).keys()],i=Km(s,n);return o.map(a=>i(r.add({days:a})))}function Zm(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 Ha(e,t){const n=It(e,t,"mon"),s=n.year,r=n.set({month:1,day:4}),o=It(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=It(l,t,"mon"),f=c.calendar.toJulianDay(c);return 1+Math.floor((i-f)/7)}function Jm(e){const t=[];for(let n=e.from;n<=e.to;n+=1)t.push(n);return t}var Xm=1900,Qm=2099;function ev(e,t,n){const s=e.calendar,r=t?.year??ue(new Ve(Xm,1,1),s).year,o=n?.year??ue(new Ve(Qm,12,31),s).year;return{from:r,to:o}}var tv=10;function nv(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+tv?(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=$r(e??li());return t?ue(n,t):n}function is(e,t,n,s){return function(o){const{startDate:i,focusedDate:a}=o,l=Tl(i,e);return Be(a,n,s)?{startDate:i,focusedDate:ke(a,n,s),endDate:l}:a.compare(i)<0?{startDate:hi(a,e,t,n,s),focusedDate:ke(a,n,s),endDate:l}:a.compare(l)>0?{startDate:zt(a,e,t,n,s),endDate:l,focusedDate:ke(a,n,s)}:{startDate:i,endDate:l,focusedDate:ke(a,n,s)}}}function Dl(e,t,n,s,r,o){const i=is(n,s,r,o),a=t.add(n);return i({focusedDate:e.add(n),startDate:zt(os(e,a,n,s,r,o),n,s)})}function Rl(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:zt(os(e,a,n,s,r,o),n,s)})}function sv(e,t,n,s,r,o,i){const a=is(s,r,o,i);if(!n&&!s.days)return a({focusedDate:e.add(pi(s)),startDate:t});if(s.days)return Dl(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 rv(e,t,n,s,r,o,i){const a=is(s,r,o,i);if(!n&&!s.days)return a({focusedDate:e.subtract(pi(s)),startDate:t});if(s.days)return Rl(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 _a=new Map;function ov(e){let t=_a.get(e);return t!=null||(t="0123456789"+new Intl.NumberFormat(e,{useGrouping:!1}).format(1234567890),_a.set(e,t)),t}var iv=(e,t)=>t?ov(t).includes(e):/\d/.test(e),Pl=(e,t,n)=>!e||e.length!==1?!0:iv(e,n)||t.includes(e),av=(e,t,n)=>e.split("").filter(s=>Pl(s,t,n)).join(""),Ba=new Map;function cv(e){let t=Ba.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:"/",Ba.set(e,t),t}var ja=e=>e!=null&&e.length===4,lv=e=>e!=null&&parseFloat(e)<=12,dv=e=>e!=null&&parseFloat(e)<=31;function uv(e,t,n){const s=fv(t,n);let{year:r,month:o,day:i}=hv(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(ja(r)||(r=nv(r)),ja(r)&&lv(o)&&dv(i))return new Ve(+r,+o,+i);const l=Date.parse(e);if(!isNaN(l)){const c=new Date(l);return new Ve(c.getFullYear(),c.getMonth()+1,c.getDate())}}function fv(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 hv(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 Wa(e,t,n){const s=jt(ll(n));switch(e){case"thisWeek":return[It(s,t),Ma(s,t)];case"thisMonth":return[nt(s),s];case"thisQuarter":return[nt(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[nt(s.add({months:-1})),Oo(s.add({months:-1}))];case"lastQuarter":return[nt(s.add({months:-((s.month-1)%3)-3})),Oo(s.add({months:-((s.month-1)%3)-1}))];case"lastWeek":return[It(s,t).add({weeks:-1}),Ma(s,t).add({weeks:-1})];case"lastYear":return[es(s.add({years:-1})),mm(s.add({years:-1}))];default:throw new Error(`Invalid date range preset: ${e}`)}}var pv=(e,t)=>e.ids?.label?.(t)??`datepicker:${e.id}:label:${t}`,gv=e=>e.ids?.root??`datepicker:${e.id}`,mv=(e,t)=>e.ids?.table?.(t)??`datepicker:${e.id}:table:${t}`,Po=e=>e.ids?.content??`datepicker:${e.id}:content`,eo=(e,t)=>e.ids?.cellTrigger?.(t)??`datepicker:${e.id}:cell-trigger:${t}`,vv=(e,t)=>e.ids?.prevTrigger?.(t)??`datepicker:${e.id}:prev:${t}`,yv=(e,t)=>e.ids?.nextTrigger?.(t)??`datepicker:${e.id}:next:${t}`,bv=(e,t)=>e.ids?.viewTrigger?.(t)??`datepicker:${e.id}:view:${t}`,Vl=e=>e.ids?.clearTrigger??`datepicker:${e.id}:clear`,Nl=e=>e.ids?.control??`datepicker:${e.id}:control`,Ua=(e,t)=>e.ids?.input?.(t)??`datepicker:${e.id}:input:${t}`,Fl=e=>e.ids?.trigger??`datepicker:${e.id}:trigger`,Hl=e=>e.ids?.positioner??`datepicker:${e.id}:positioner`,_l=e=>e.ids?.monthSelect??`datepicker:${e.id}:month-select`,Bl=e=>e.ids?.yearSelect??`datepicker:${e.id}:year-select`,qa=(e,t)=>Af(nn(e),`[data-part=table-cell-trigger][data-view=${t}][data-focus]:not([data-outside-range])`),Hs=e=>e.getById(Fl(e)),nn=e=>e.getById(Po(e)),Un=e=>kf(jl(e),"[data-part=input]"),wv=e=>e.getById(Bl(e)),Ev=e=>e.getById(_l(e)),xv=e=>e.getById(Vl(e)),Ga=e=>e.getById(Hl(e)),jl=e=>e.getById(Nl(e)),Ya=e=>{const t=Un(e);if(t.length===0){Hs(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 _s(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 ks(e){return e.slice().filter(t=>t!=null).sort((t,n)=>t.compare(n))}function Sv(e,t){return new Ae(e).formatToParts(new Date).map(n=>t[n.type]??n.value).join("")}var Ka=e=>!Number.isNaN(e.day)&&!Number.isNaN(e.month)&&!Number.isNaN(e.year),$v={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 co(e,{year:"Switch to previous decade",month:"Switch to previous year",day:"Switch to previous month"})},nextTrigger(e){return co(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 at(e,t){return e?e==="day"?0:e==="month"?1:2:t||0}function gi(e){return e===0?"day":e===1?"month":"year"}function mi(e,t,n){return gi(yu(at(e,0),at(t,0),at(n,2)))}function Iv(e,t){return at(e,0)>at(t,0)}function Cv(e,t){return at(e,0)<at(t,0)}function Wl(e,t,n){const s=at(e,0)+1;return mi(gi(s),t,n)}function Tv(e,t,n){const s=at(e,0)-1;return mi(gi(s),t,n)}var kv=["day","month","year"];function Av(e){kv.forEach(t=>e(t))}var Lv=Tp(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 Ov(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?_s([f[0],h]):[],g=!!r("disabled"),d=!!r("readOnly"),m=!!r("invalid"),y=i("isInteractive"),C=f.length===0,E=r("min"),O=r("max"),M=r("locale"),D=r("timeZone"),w=r("startOfWeek"),S=n.matches("focused"),x=n.matches("open"),T=r("selectionMode")==="range",b=r("selectionMode")==="multiple",A=r("isDateUnavailable"),R=r("maxSelectedDates"),V=b&&R!=null&&f.length>=R,H=s.get("currentPlacement"),Z=H?Nc(H):void 0,re=Fc({...r("positioning"),placement:H}),J=cv(M),W=cc($v,r("translations"));function we(L=l){const $=r("fixedWeeks")?6:void 0;return Ym(L,M,$,w)}function Dt(L={}){const{format:$}=L;return Zm(M,$,u).map((v,I)=>{const F=I+1,Q=u.set({month:F}),U=Be(Q,E,O);return{label:v,value:F,disabled:U}})}function $e(){const L=ev(u,E,O);return Jm(L).map(v=>({label:v.toString(),value:v,disabled:!Dr(v,E?.year,O?.year)}))}function ze(L){return Na(L,A,M,E,O)}function Rt(L){const $=l??zn(D,u.calendar);o({type:"FOCUS.SET",value:$.set({month:L})})}function Zt(L){const $=l??zn(D,u.calendar);o({type:"FOCUS.SET",value:$.set({year:L})})}function bt(L){const{value:$,disabled:v}=L,I=u.set({year:$}),Q=!cn(l.year).includes($),U=Dr($,E?.year,O?.year),G=T&&en(I,f),de=T&&f[0]&&Pn(I,f[0]),Re=T&&f[1]&&Pn(I,f[1]),Fe=T&&p.length>0,ie=Fe&&en(I,p),He=Fe&&p[0]&&Pn(I,p[0]),_e=Fe&&p[1]&&Pn(I,p[1]),us={focused:u.year===L.value,selectable:U,outsideRange:Q,selected:!!f.find(fs=>fs&&fs.year===$),valueText:$.toString(),inRange:G||ie,firstInRange:!!de,lastInRange:!!Re,inHoveredRange:!!ie,firstInHoveredRange:!!He,lastInHoveredRange:!!_e,value:I,get disabled(){return v||!us.selectable}};return us}function Pt(L){const{value:$,disabled:v}=L,I=u.set({month:$}),F=Fa(M,D,u),Q=T&&en(I,f),U=T&&f[0]&&Rn(I,f[0]),G=T&&f[1]&&Rn(I,f[1]),de=T&&p.length>0,Re=de&&en(I,p),Fe=de&&p[0]&&Rn(I,p[0]),ie=de&&p[1]&&Rn(I,p[1]),He={focused:u.month===L.value,selectable:!Be(I,E,O),selected:!!f.find(_e=>_e&&_e.month===$&&_e.year===u.year),valueText:F.format(I.toDate(D)),inRange:Q||Re,firstInRange:!!U,lastInRange:!!G,inHoveredRange:!!Re,firstInHoveredRange:!!Fe,lastInHoveredRange:!!ie,outsideRange:!1,value:I,get disabled(){return v||!He.selectable}};return He}function wt(L){const{value:$,disabled:v,visibleRange:I=i("visibleRange")}=L,F=Al(M,D,u),Q=pi(i("visibleDuration")),U=r("outsideDaySelectable"),G=I.start.add(Q).subtract({days:1}),de=Be($,I.start,G),Re=T&&en($,f),Fe=T&&f[0]&&Se($,f[0]),ie=T&&f[1]&&Se($,f[1]),He=T&&p.length>0,_e=He&&en($,p),us=He&&p[0]&&Se($,p[0]),fs=He&&p[1]&&Se($,p[1]),Oi=f.some(Mi=>Mi!=null&&Se($,Mi)),hs={invalid:Be($,E,O),disabled:v||!U&&de||Be($,E,O)||V&&!Oi,selected:Oi,unavailable:Na($,A,M,E,O)&&!v,outsideRange:de,today:fm($,D),weekend:wm($,M),value:$,valueText:F.format($.toDate(D)),get focused(){return u!=null&&Se($,u)&&(!hs.outsideRange||U)},get selectable(){return!hs.disabled&&!hs.unavailable},inRange:Re||_e,firstInRange:Fe,lastInRange:ie,inHoveredRange:_e,firstInHoveredRange:us,lastInHoveredRange:fs};return hs}function $n(L){const{view:$="day",id:v}=L;return[$,v].filter(Boolean).join(" ")}return{focused:S,open:x,disabled:g,invalid:m,readOnly:d,inline:!!r("inline"),numOfMonths:r("numOfMonths"),showWeekNumbers:!!r("showWeekNumbers"),selectionMode:r("selectionMode"),maxSelectedDates:R,isMaxSelected:V,view:s.get("view"),getRangePresetValue(L){return Wa(L,M,D)},getWeekNumber(L){const $=L[0];return $?Ha($,M):0},getDaysInWeek(L,$=l){return Ml(L,$,M,w)},getOffset(L){const $=l.add(L),v=c.add(L),I=Fa(M,D,u);return{visibleRange:{start:$,end:v},weeks:we($),visibleRangeText:{start:I.format($.toDate(D)),end:I.format(v.toDate(D))}}},getMonthWeeks:we,isUnavailable:ze,weeks:we(),weekDays:zm(l,w,D,M),visibleRangeText:i("visibleRangeText"),value:f,valueAsDate:f.filter(L=>L!=null).map(L=>L.toDate(D)),valueAsString:i("valueAsString"),focusedValue:u,focusedValueAsDate:u?.toDate(D),focusedValueAsString:r("format")(u,{locale:M,timeZone:D}),visibleRange:i("visibleRange"),selectToday(){const L=ke(zn(D,u.calendar),E,O);o({type:"VALUE.SET",value:[L]})},setValue(L){const $=L.map(v=>ke(v,E,O));o({type:"VALUE.SET",value:$})},setTime(L,$=0){const v=Array.from(f);let I=v[$];I&&("hour"in I||(I=Oe(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[$]=ke(I,E,O),o({type:"VALUE.SET",value:v}))},clearValue(L={}){const{focus:$=!0}=L;o({type:"VALUE.CLEAR",focus:$})},setFocusedValue(L){o({type:"FOCUS.SET",value:L})},setOpen(L){r("inline")||o({type:L?"OPEN":"CLOSE",replaces:"open"})},focusMonth:Rt,focusYear:Zt,getYears:$e,getMonths:Dt,getYearsGrid(L={}){const{columns:$=1}=L,v=cn(l.year).map(I=>({label:I.toString(),value:I,disabled:!Dr(I,E?.year,O?.year)}));return Fi(v,$)},getDecade(){const L=cn(l.year);return{start:L.at(0),end:L.at(-1)}},getMonthsGrid(L={}){const{columns:$=1,format:v}=L;return Fi(Dt({format:v}),$)},format(L,$={month:"long",year:"numeric"}){return new Ae(M,{...$,calendar:L.calendar.identifier}).format(L.toDate(D))},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({...X.root.attrs,dir:r("dir"),id:gv(a),"data-state":x?"open":"closed","data-disabled":P(g),"data-readonly":P(d),"data-empty":P(C)})},getLabelProps(L={}){const{index:$=0}=L;return t.label({...X.label.attrs,id:pv(a,$),dir:r("dir"),htmlFor:Ua(a,$),"data-state":x?"open":"closed","data-index":$,"data-disabled":P(g),"data-readonly":P(d),"data-invalid":P(m)})},getControlProps(){return t.element({...X.control.attrs,dir:r("dir"),id:Nl(a),"data-disabled":P(g),"data-placeholder-shown":P(C),"data-invalid":P(m)})},getRangeTextProps(){return t.element({...X.rangeText.attrs,dir:r("dir")})},getContentProps(){return t.element({...X.content.attrs,hidden:!x,dir:r("dir"),"data-state":x?"open":"closed","data-placement":H,"data-side":Z,"data-inline":P(r("inline")),id:Po(a),tabIndex:-1,role:"application","aria-label":W.content})},getTableProps(L={}){const{view:$="day",columns:v=$==="day"?7:4}=L,I=$n(L);return t.element({...X.table.attrs,role:"grid","data-columns":v,"aria-label":i("visibleRangeText").formatted,id:mv(a,I),"aria-readonly":he(d),"aria-disabled":he(g),"aria-multiselectable":he(r("selectionMode")!=="single"),"data-view":$,dir:r("dir"),tabIndex:-1,onKeyDown(F){if(F.defaultPrevented||g)return;const Q={Enter(){y&&($==="day"&&ze(u)||$==="month"&&!Pt({value:u.month}).selectable||$==="year"&&!bt({value:u.year}).selectable||o({type:"TABLE.ENTER",view:$,columns:v,focus:!0}))},Space(G){Q.Enter?.()},ArrowLeft(){o({type:"TABLE.ARROW_LEFT",view:$,columns:v,focus:!0})},ArrowRight(){o({type:"TABLE.ARROW_RIGHT",view:$,columns:v,focus:!0})},ArrowUp(){o({type:"TABLE.ARROW_UP",view:$,columns:v,focus:!0})},ArrowDown(){o({type:"TABLE.ARROW_DOWN",view:$,columns:v,focus:!0})},PageUp(G){o({type:"TABLE.PAGE_UP",larger:G.shiftKey,view:$,columns:v,focus:!0})},PageDown(G){o({type:"TABLE.PAGE_DOWN",larger:G.shiftKey,view:$,columns:v,focus:!0})},Home(){o({type:"TABLE.HOME",view:$,columns:v,focus:!0})},End(){o({type:"TABLE.END",view:$,columns:v,focus:!0})}},U=Q[uo(F,{dir:r("dir")})];U&&(U(F),F.preventDefault(),F.stopPropagation())},onPointerLeave(){o({type:"TABLE.POINTER_LEAVE"})},onPointerDown(){o({type:"TABLE.POINTER_DOWN",view:$})},onPointerUp(){o({type:"TABLE.POINTER_UP",view:$})}})},getTableHeadProps(L={}){const{view:$="day"}=L;return t.element({...X.tableHead.attrs,"aria-hidden":!0,dir:r("dir"),"data-view":$,"data-disabled":P(g)})},getTableHeaderProps(L={}){const{view:$="day"}=L;return t.element({...X.tableHeader.attrs,dir:r("dir"),"data-view":$,"data-disabled":P(g)})},getTableBodyProps(L={}){const{view:$="day"}=L;return t.element({...X.tableBody.attrs,"data-view":$,"data-disabled":P(g)})},getTableRowProps(L={}){const{view:$="day"}=L;return t.element({...X.tableRow.attrs,"aria-disabled":he(g),"data-disabled":P(g),"data-view":$})},getWeekNumberHeaderCellProps(L={}){const{view:$="day"}=L;return t.element({...X.tableCell.attrs,scope:"col","aria-label":W.weekColumnHeader,"data-view":$,"data-type":"week-number","data-disabled":P(g)})},getWeekNumberCellProps(L){const{weekIndex:$,week:v}=L,I=v[0]?Ha(v[0],M):0;return t.element({...X.tableCell.attrs,role:"rowheader","aria-label":W.weekNumberCell?.(I),"data-view":"day","data-week-index":$,"data-type":"week-number","data-disabled":P(g)})},getDayTableCellState:wt,getDayTableCellProps(L){const{value:$}=L,v=wt(L);return t.element({...X.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":$.toString()})},getDayTableCellTriggerProps(L){const{value:$}=L,v=wt(L);return t.element({...X.tableCellTrigger.attrs,id:eo(a,$.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":$.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:$})},onPointerMove:T?I=>{if(I.pointerType==="touch"||!v.selectable)return;const F=!a.isActiveElement(I.currentTarget);h&&um($,h)||o({type:"CELL.POINTER_MOVE",cell:"day",value:$,focus:F,outsideRange:v.outsideRange})}:void 0})},getMonthTableCellState:Pt,getMonthTableCellProps(L){const{value:$,columns:v}=L,I=Pt(L);return t.element({...X.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":$})},getMonthTableCellTriggerProps(L){const{value:$}=L,v=Pt(L);return t.element({...X.tableCellTrigger.attrs,id:eo(a,$.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":$,"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:$})},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:bt,getYearTableCellProps(L){const{value:$,columns:v}=L,I=bt(L);return t.element({...X.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":$})},getYearTableCellTriggerProps(L){const{value:$}=L,v=bt(L);return t.element({...X.tableCellTrigger.attrs,id:eo(a,$.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":$,"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:$})},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:$="day"}=L,v=g||!i("isNextVisibleRangeValid");return t.button({...X.nextTrigger.attrs,dir:r("dir"),id:yv(a,$),type:"button","aria-label":W.nextTrigger($),disabled:v,"data-disabled":P(v),onClick(I){I.defaultPrevented||o({type:"GOTO.NEXT",view:$})}})},getPrevTriggerProps(L={}){const{view:$="day"}=L,v=g||!i("isPrevVisibleRangeValid");return t.button({...X.prevTrigger.attrs,dir:r("dir"),id:vv(a,$),type:"button","aria-label":W.prevTrigger($),disabled:v,"data-disabled":P(v),onClick(I){I.defaultPrevented||o({type:"GOTO.PREV",view:$})}})},getClearTriggerProps(){return t.button({...X.clearTrigger.attrs,id:Vl(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({...X.trigger.attrs,id:Fl(a),dir:r("dir"),type:"button","data-placement":H,"data-side":Z,"aria-label":W.trigger(x),"aria-controls":Po(a),"aria-expanded":x,"data-state":x?"open":"closed","data-placeholder-shown":P(C),"aria-haspopup":"grid",disabled:g,onClick(L){L.defaultPrevented||y&&o({type:"TRIGGER.CLICK"})}})},getViewProps(L={}){const{view:$="day"}=L;return t.element({...X.view.attrs,"data-view":$,hidden:s.get("view")!==$})},getViewTriggerProps(L={}){const{view:$="day"}=L,v=Wl($,r("minView"),r("maxView")),I=v!==$,F=g||!I;return t.button({...X.viewTrigger.attrs,"data-view":$,dir:r("dir"),id:bv(a,$),type:"button",disabled:F,"data-disabled":P(F),"aria-label":W.viewTrigger($,I?v:void 0),onClick(Q){Q.defaultPrevented||y&&o({type:"VIEW.TOGGLE",src:"viewTrigger"})}})},getViewControlProps(L={}){const{view:$="day"}=L;return t.element({...X.viewControl.attrs,"data-view":$,dir:r("dir")})},getInputProps(L={}){const{index:$=0,fixOnBlur:v=!0}=L;return t.input({...X.input.attrs,id:Ua(a,$),autoComplete:"off",autoCorrect:"off",spellCheck:"false",dir:r("dir"),name:r("name"),"data-index":$,"data-state":x?"open":"closed","data-placeholder-shown":P(C),readOnly:d,disabled:g,required:r("required"),"aria-invalid":he(m),"data-invalid":P(m),placeholder:r("placeholder")||Sv(M,W.placeholder(M)),defaultValue:i("valueAsString")[$],onBeforeInput(I){const{data:F}=Ko(I);Pl(F,J,M)||I.preventDefault()},onClick(I){I.defaultPrevented||r("openOnClick")&&y&&o({type:"OPEN",src:"input.click"})},onFocus(){o({type:"INPUT.FOCUS",index:$})},onBlur(I){const F=I.currentTarget.value.trim();o({type:"INPUT.BLUR",value:F,index:$,fixOnBlur:v})},onKeyDown(I){if(I.defaultPrevented||!y)return;const Q={Enter(U){Zu(U)||ze(u)||U.currentTarget.value.trim()!==""&&o({type:"INPUT.ENTER",value:U.currentTarget.value,index:$})}}[I.key];Q&&(Q(I),I.preventDefault())},onInput(I){const F=I.currentTarget.value;o({type:"INPUT.CHANGE",value:av(F,J,M),index:$})}})},getMonthSelectProps(){return t.select({...X.monthSelect.attrs,id:_l(a),"aria-label":W.monthSelect,disabled:g,dir:r("dir"),defaultValue:l.month,onChange(L){Rt(Number(L.currentTarget.value))}})},getYearSelectProps(){return t.select({...X.yearSelect.attrs,id:Bl(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:Hl(a),...X.positioner.attrs,dir:r("dir"),style:re.floating})},getPresetTriggerProps(L){const $=Array.isArray(L.value)?L.value:Wa(L.value,M,D),v=$.filter(I=>I!=null).map(I=>I.toDate(D).toDateString());return t.button({...X.presetTrigger.attrs,"aria-label":W.presetTrigger(v),type:"button",onClick(I){I.defaultPrevented||y&&o({type:"PRESET.CLICK",value:$})}})}}}var to="__live-region-debug__",Mv="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;",Dv=100,Rv=200,Pv={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 Vv(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(to);return m||(m=n.createElement("div"),m.id=to,m.dataset.liveAnnouncerDebug="true",m.setAttribute("aria-hidden","true"),m.style.cssText=Mv,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,Pv),a().appendChild(m),u=Date.now()+Rv,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 C=h;C.textContent="",l=i.setTimeout(()=>{l=void 0,C.textContent=m;const E=c();E&&(E.textContent=m)},Math.max(y,Dv,u-Date.now()))}function d(){p(),h?.remove(),h=null,o&&n.getElementById(to)?.remove()}return{announce:g,cancel:p,destroy:d,toJSON(){return"live-region"}}}var{and:ye}=Uc();function Nv(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(!St(e[s],t[s]))return!1;return!0}function As(e,t){return e.map(n=>n==null?"":t("format")(n,{locale:t("locale"),timeZone:t("timeZone")}))}var Fv=qc({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:ue(p,o),a=e.defaultValue?ks(e.defaultValue).map(p=>ke(i(p),e.min,e.max)):void 0,l=e.value?ks(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=mi(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 uv(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:St,hash:s=>s.toString(),sync:!0,onChange(s){const r=n(),o=r.get("view"),i=r.get("value"),a=As(i,e);e("onFocusChange")?.({value:i,valueAsString:a,view:o,focusedValue:s})}})),value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:Nv,hash:s=>s.map(r=>r?.toString()??"").join(","),onChange(s){const r=n(),o=As(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:St})),view:t(()=>({defaultValue:e("defaultView"),value:e("view"),onChange(s){e("onViewChange")?.({view:s})}})),startValue:t(()=>{const s=e("focusedValue")||e("defaultFocusedValue");return{defaultValue:Va(s,"start",{months:e("numOfMonths")},e("locale")),isEqual:St,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})=>Tl(e.get("startValue"),t("visibleDuration")),visibleRange:({context:e,computed:t})=>({start:e.get("startValue"),end:t("endValue")}),visibleRangeText:({context:e,prop:t,computed:n})=>Lv({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})=>!Wm(e.get("startValue"),t("min"),t("max")),isNextVisibleRangeValid:({prop:e,computed:t})=>!Um(t("endValue"),e("min"),e("max")),valueAsString:({context:e,prop:t})=>As(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})=>Iv(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=>St(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=jl(n);return wo(s,()=>Ga(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",Vv({level:"assertive",document:n})),()=>t.get("announcer")?.destroy?.()},trackDismissableElement({scope:e,send:t,context:n,prop:s}){return s("inline")?void 0:Kc(()=>nn(e),{type:"popover",defer:!0,getRootNode:e.getRootNode,layerStyleTargets:[()=>Ga(e)],exclude:[...Un(e),Hs(e),xv(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=Wl(e.get("view"),t("minView"),t("maxView"));e.set("view",n)},setPreviousView({context:e,prop:t}){const n=Tv(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}){Tf({target:nn(e),doc:e.getDoc()})},enableTextSelection({scope:e}){Sc({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)=>{ms(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]=Ls(o,i),t.set("value",_s(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",[Ls(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=>St(i,s));if(o===-1){const i=[...r,s];t.set("value",ks(i))}else{const i=Array.from(r);i.splice(o,1),t.set("value",ks(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]=Ls(r,o),e.set("value",_s(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=Dl(t.get("focusedValue"),t.get("startValue"),n("visibleDuration"),s("locale"),s("min"),s("max"));Os(e,r)},focusPreviousPage(e){const{context:t,computed:n,prop:s}=e,r=Rl(t.get("focusedValue"),t.get("startValue"),n("visibleDuration"),s("locale"),s("min"),s("max"));Os(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=sv(t.get("focusedValue"),t.get("startValue"),n.larger,s("visibleDuration"),r("locale"),r("min"),r("max"));o&&Os(e,o)},focusPreviousSection(e){const{context:t,event:n,computed:s,prop:r}=e,o=rv(t.get("focusedValue"),t.get("startValue"),n.larger,s("visibleDuration"),r("locale"),r("min"),r("max"));o&&Os(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");qa(e,s)?.focus({preventScroll:!0})})},focusActiveCellIfNeeded({scope:e,context:t,event:n}){n.focus&&pe(()=>{const s=t.get("view");qa(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=Hv(t);pe(()=>{ji(e.getActiveElement(),[n])||Hs(e)?.focus(s)})},focusFirstInputElement({scope:e,event:t}){t.focus!==!1&&pe(()=>{const[n]=Un(e);(n??Hs(e))?.focus({preventScroll:!0})})},focusInputElement({scope:e}){pe(()=>Ya(e))},restoreFocusToInput({scope:e}){const t=nn(e);pe(()=>{ji(e.getActiveElement(),[t])||Ya(e)})},syncMonthSelectElement({scope:e,context:t}){const n=Ev(e);ms(n,t.get("startValue").month.toString())},syncYearSelectElement({scope:e,context:t}){const n=wv(e);ms(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");ms(s[r],t.get("inputValue"))})},focusParsedDate(e){const{event:t,prop:n}=e;if(t.index==null)return;const r=n("parse")(t.value,{locale:n("locale"),timeZone:n("timeZone")});!r||!Ka(r)||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||!Ka(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]=Ls(o[t.index],r);const i=_s(o);e.set("value",i);const a=As(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(!Be(s,e.get("startValue"),t("endValue")))return;const o=Va(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 Av(i=>{Cv(i,s("minView"))&&(o=o.set({[i]:i==="day"?1:0}))}),o},Ls=(e,t)=>{if(!e||!("hour"in e))return t;const n="timeZone"in e;let s=t;return"hour"in t||(n?s=yl(Oe(t),e.timeZone):s=Oe(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(St(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 Os(e,t){const{context:n}=e;n.set("startValue",t.startDate);const s=n.get("focusedValue");St(s,t.focusedDate)||n.set("focusedValue",t.focusedDate)}function Hv(e){return e.focusVisible??e.previousEvent?.focusVisible?{preventScroll:!0,focusVisible:!0}:{preventScroll:!0}}function Ul(e){return Array.isArray(e)?e.map(t=>Ul(t)):e instanceof Date?new Ve(e.getFullYear(),e.getMonth()+1,e.getDate()):Rm(e)}const no=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>`,so=e=>{try{return/^\d{4}-\d{2}-\d{2}$/.test(e)?Ul(e):void 0}catch{return}};function _v(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>
92
- <div class="date-positioner" popover="manual"><section class="date-popover">
93
- <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>
94
- <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>
95
- <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>
96
- <div class="date-calendar"><div class="date-navigation"><button type="button" class="icon-button date-prev">${no("left")}</button><button type="button" class="date-view"></button><button type="button" class="icon-button date-next">${no("right")}</button></div><div class="date-grids"></div></div>
97
- <footer class="date-footer"><span class="date-status" role="status"></span><button id="apply-dates" class="primary-button" type="button">Apply range ${no("right")}</button></footer>
98
- </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 Xc(Fv,{id:"timeline-dates",selectionMode:"range",closeOnSelect:!1,fixedWeeks:!0,outsideDaySelectable:!0,locale:navigator.language,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,format:d=>d.toString(),parse:so,placeholder:"YYYY-MM-DD",positioning:{placement:"top-end",strategy:"fixed",gutter:12,slide:!0},onOpenChange({open:d}){d&&n()}}),f=()=>Ov(c.service,zc),u=["day","month","year"].map(d=>{const m=document.createElement("table");m.dataset.calendarView=d;const y=m.createTHead(),C=y.insertRow();if(d==="day")for(let D=0;D<7;D++)C.append(document.createElement("th"));const E=m.createTBody(),O=d==="day"?6:4,M=d==="day"?7:3;for(let D=0;D<O;D++){const w=E.insertRow();for(let S=0;S<M;S++){const x=document.createElement("button");x.type="button",w.insertCell().append(x)}}return s(".date-grids").append(m),{view:d,table:m,head:y,body:E}});function h(){const d=a.map(C=>so(C.value)),m=!!(d[0]&&d[1]&&d[0].compare(d[1])<=0);l.disabled=!m;for(const[C,E]of a.entries())E.setAttribute("aria-invalid",String(!!E.value&&!d[C]));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((C,E)=>se(C,{...d.getInputProps({index:E}),"aria-label":E?"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:C,table:E,head:O,body:M}of u){E.hidden=d.view!==C,se(E,d.getTableProps({view:C,columns:C==="day"?7:3})),se(O,d.getTableHeaderProps({view:C})),se(M,d.getTableBodyProps({view:C})),C==="day"&&d.weekDays.forEach((w,S)=>{const x=O.rows[0].cells[S];x.scope="col",x.setAttribute("aria-label",w.long),x.textContent!==w.short&&(x.textContent=w.short)});const D=C==="day"?d.weeks:C==="month"?d.getMonthsGrid({columns:3,format:"short"}):d.getYearsGrid({columns:3});Array.from(M.rows).forEach((w,S)=>{se(w,d.getTableRowProps({view:C})),Array.from(w.cells).forEach((x,T)=>{const b=D[S]?.[T],A=x.firstElementChild;if(x.hidden=!b,!!b)if(C==="day"){const R=d.weeks[S][T];se(x,d.getDayTableCellProps({value:R})),se(A,d.getDayTableCellTriggerProps({value:R})),A.textContent!==String(R.day)&&(A.textContent=String(R.day))}else{const R=b;se(x,C==="month"?d.getMonthTableCellProps({...R,columns:3}):d.getYearTableCellProps({...R,columns:3})),se(A,C==="month"?d.getMonthTableCellTriggerProps({...R}):d.getYearTableCellTriggerProps({...R})),A.textContent!==R.label&&(A.textContent=R.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(so).filter(C=>C!==void 0);f().setValue(y),y[0]&&f().setFocusedValue(y[0])},dispose(){g(),c.stop(),e.replaceChildren()}}}const Bv={Search:Dd,GitFork:Ed,GitBranch:wd,Folder:bd,ArrowUpRight:dd,ArrowRight:ld,X:Hd,Box:ud,RotateCcw:Md,RefreshCw:Od,Play:Ld,Pause:Ad,ChevronDown:fd,FileCode2:yd,Terminal:Nd,Copy:gd,Crosshair:md,CircleHelp:hd,SlidersHorizontal:Vd,LoaderCircle:Sd,Network:Id,Clock:pd,Sparkles:Qa,Grip:xd,PanelRight:Td,Settings2:Rd,Volume2:ec,VolumeX:Fd,Share2:Pd},Me=()=>{_d({icons:Bv,attrs:{"stroke-width":1.5}}),Qn()},N=(e,t="")=>`<i data-lucide="${e}" class="${t}" aria-hidden="true"></i>`,k=e=>document.querySelector(e),z=e=>e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]),ql=e=>Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}).format(e),ge=e=>e.toLocaleString("en"),jv=[new Intl.DateTimeFormat("en",{month:"short",day:"numeric"}),new Intl.DateTimeFormat("en",{month:"short",day:"numeric",year:"numeric"})],Wv=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}),Uv=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit"}),mn=(e,t=!1)=>jv[Number(t)].format(e),vn=e=>Wv.format(e),za=e=>{const t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`};let j,te={nodes:[],edges:[],lanes:[],start:0,end:0},ce=[],vi=[],Gl=new Set,Bs=new Map,ns=new Map,Yl=new Map,ee,Kl=!0,Gn,B=new URLSearchParams(location.search).get("session"),We,Pe,js=0,mt="",Ct="",Ue="",ct=0,lt="",dt="",yn=!0,Yt=!1,ln=60,Ws=0,Vo,No,yi=0,At=!1,oe=1,or=0,Zn=0,Xe=Qc([]),Fo="",zl=tl([]),Us,ro,oo,Nn=0,Fn=!1,q={...Er},Kt=!0,Cr,ut,ss=!1,Ho="";try{q=nl(localStorage)}catch{Kt=!1}const ir=matchMedia("(prefers-reduced-motion: reduce)");k("#app").innerHTML=`
99
- <main class="map" aria-label="Session map">
100
- <h1 class="sr-only">SessionGraph — Explore &amp; visualize all your LLM sessions</h1>
101
- <div id="scene"></div>
102
- <div class="canvas-vignette"></div>
103
- <div id="graph-message" class="graph-message"><div class="loading-orbit"><span></span><span></span><span></span></div><h3>Loading sessions…</h3></div>
104
- <div id="tooltip" class="node-tooltip" hidden></div>
105
- </main>
106
- <header class="app-header glass">
107
- <a class="brand" href="/" aria-label="SessionGraph home" title="Explore &amp; visualize all your LLM sessions"><img src="/brand/mark.svg" alt=""/><span>SessionGraph</span></a>
108
- <span class="connection" role="status" title="Connecting"><span class="status-dot"></span><span id="connection-label" class="sr-only">Connecting</span></span>
109
- <span class="toolbar-divider"></span>
110
- <button class="toolbar-button" id="toggle-explorer" aria-label="Toggle sessions" aria-controls="explorer" aria-expanded="true" title="Sessions">${N("search")}<span>Sessions</span></button>
111
- </header>
112
- <nav class="map-controls glass" aria-label="Map controls">
113
- <div class="view-switch" role="group" aria-label="View mode"><button id="view-3d" class="active" aria-pressed="true">3D</button><button id="view-2d" aria-pressed="false">2D</button></div>
114
- <span class="toolbar-divider"></span>
115
- <button class="icon-button" id="reset-camera" aria-label="Fit view" title="Fit view (F)">${N("crosshair")}</button>
116
- <button class="icon-button" id="toggle-timeline" aria-label="Toggle timeline" aria-controls="timeline" aria-expanded="true" title="Timeline">${N("clock")}</button>
117
- <button class="icon-button" id="toggle-inspector" aria-label="Toggle session details" aria-controls="inspector" aria-expanded="false" title="Session details" hidden>${N("panel-right")}</button>
118
- <button class="icon-button" id="help" aria-label="Help" title="Help">${N("circle-help")}</button>
119
- <button class="icon-button" id="mute-audio" aria-label="Mute sound" title="Mute sound" aria-pressed="false" data-sound="none">${N("volume-2")}</button>
120
- <button class="icon-button" id="open-settings" aria-label="Settings" title="Settings" aria-haspopup="dialog">${N("settings-2")}</button>
121
- <button class="icon-button" id="open-publishing" aria-label="Share SessionGraph" title="Share SessionGraph" aria-haspopup="dialog">${N("share-2")}</button>
122
- </nav>
123
- <aside class="sidebar floating-panel glass" id="explorer" aria-label="Sessions">
124
- <div class="panel-heading"><button class="panel-handle" data-drag-panel="explorer" aria-label="Move sessions panel" title="Drag to move · Arrow keys to reposition">${N("grip")}<span>Sessions</span><span class="small-badge" id="list-count">—</span></button><button class="icon-button" id="refresh" aria-label="Refresh sessions" title="Refresh sessions">${N("refresh-cw")}</button><button class="icon-button" id="close-explorer" aria-label="Close sessions">${N("x")}</button></div>
125
- <button class="search-box search-trigger" id="search" aria-label="Search all sessions">${N("search")}<span>Search everything…</span><kbd>/</kbd></button>
126
- <div class="filters">
127
- <div class="filter-row"><div class="select-wrap"><span id="source-filter-icon">${qe()}</span><select id="source" aria-label="Session source"><option value="">All sources</option></select>${N("chevron-down")}</div><button class="icon-button" id="manage-sources" aria-label="Manage sources" title="Import sources">${N("sliders-horizontal")}</button></div>
128
- <div class="select-wrap">${N("folder")}<select id="project" aria-label="Project"><option value="">All projects</option></select>${N("chevron-down")}</div>
129
- <div class="select-wrap">${N("git-branch")}<select id="directory" aria-label="Worktree or directory"><option value="">All directories</option></select>${N("chevron-down")}</div>
130
- <div class="filter-toggles"><label><input type="checkbox" id="children" checked/><span>Child sessions</span></label></div>
131
- </div>
132
- <nav class="session-list" id="session-list" aria-label="Sessions"><div class="list-loading">${[0,1,2,3,4].map(()=>'<div class="skeleton"></div>').join("")}</div></nav>
133
- </aside>
134
- <div class="inspector-stack floating-panel" id="inspector" hidden><aside class="inspector glass" id="session-inspector" aria-label="Session details"></aside></div>
135
- <div class="timeline-dock floating-panel" id="timeline">
136
- <div class="playback-share"><button id="share-playback" class="primary-button" disabled>${N("share-2")}Share SessionGraph</button></div>
137
- <section class="timeline-panel glass" aria-label="Timeline controls">
138
- <div class="timeline-top"><button class="panel-handle" data-drag-panel="timeline" aria-label="Move timeline panel" title="Drag to move · Arrow keys to reposition">${N("grip")}<span id="date-label">Timeline</span></button><div class="range-buttons" role="group" aria-label="Date range"><button data-days="7">7D</button><button data-days="30">30D</button><button data-days="90">90D</button><button data-days="0" class="active">All</button></div><div class="custom-dates"></div><button class="icon-button" id="close-timeline" aria-label="Close timeline">${N("x")}</button></div>
139
- <div class="timeline-track"><button id="play" class="play-button" aria-label="Play timeline">${N("play")}</button><div class="histogram-wrap"><div id="histogram" class="histogram"></div><input id="scrubber" type="range" min="0" max="1000" value="1000" aria-label="Timeline playback position"/><div class="timeline-cursor" id="timeline-cursor"></div></div><div class="playback-date" id="playback-date">—</div></div>
140
- <div class="playback-period" id="playback-period" aria-label="Approximate playback date">—</div>
141
- <div class="playback-summary" id="playback-summary" hidden><span><strong id="playback-sessions">0</strong><span>Sessions</span></span><span><strong id="playback-tokens">0</strong><span>Burnt tokens</span></span><small id="playback-token-coverage"></small></div>
142
- </section>
143
- </div>
144
- <dialog id="help-dialog" aria-labelledby="help-title"><button class="icon-button dialog-close" id="close-help" aria-label="Close help">${N("x")}</button><h2 id="help-title">Explore the map</h2><div class="help-rows"><div><span>Orbit</span><kbd>Drag</kbd></div><div><span>Zoom</span><kbd>Scroll / pinch</kbd></div><div><span>Pan</span><kbd>Right-drag</kbd></div><div><span>Fit view</span><kbd>F</kbd></div><div><span>Search everything</span><kbd>/ · ⌘/Ctrl K</kbd></div><div><span>Hide / restore panels</span><kbd>H</kbd></div><div><span>Clear selection</span><kbd>Esc</kbd></div></div>
145
- <div class="graph-legend"><span><i class="legend-node"></i>Session orb</span><span><i class="legend-node message"></i>Message</span><span><i class="legend-line lane"></i>Session lifetime</span><span><i class="legend-line fork"></i>Fork</span><span><i class="legend-line child"></i>Child</span><span id="file-legend" hidden><i class="legend-file"></i>File</span></div>
146
- <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>
147
- <div id="toast" class="toast" role="status" hidden></div>
148
- <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>
149
- `;Me();Wd();rm();kg();const Zl=_v(k(".custom-dates"),(e,t)=>{lt=e,dt=t,Ne(!0)},be),Mt=()=>{const e=!!document.querySelector("dialog[open]");e&&At&&be(),ee?.setSuspended(e)},bi=new Zg,ft=zg(k("#tooltip"),k("#scene"),bi),as=Kg(k("#inspector"),bi,{select:e=>{const t=e?.sessionID===B?e:null;ft.clear(),ee?.selectEvent(t?.id||null),t&&!At&&(oe=1,xn(),ee?.focusEvent(t))}});function wi(e){const t=j?.sessions.find(n=>n.id===B);t&&(ft.clear(),be(),le("inspector",!0),as.open(t,e,e?Pe?.revision:void 0))}const cs=qg({publishing:Lr,change:Tr,getArchived:()=>Yt,changeArchived:e=>{Yt=e,Ne()},visibility:Mt,previewSound:()=>{ar.play("select")},getSources:()=>Ke.sources(),importSources:e=>Ke.select(e),resetPanels:()=>{document.querySelectorAll(".floating-panel").forEach(e=>{e.removeAttribute("style"),delete e.dataset.positioned})}}),ar=new Gg(q,cs.audioStatus);function ls(){ee?.applyPreferences(q),ar.configure(q),document.documentElement.dataset.density=q.density,document.documentElement.dataset.motion=String(Lo(q,ir.matches)),document.documentElement.style.setProperty("--panel-opacity",`${q.panelOpacity}%`),k("#motion").setAttribute("aria-pressed",String(Lo(q,ir.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"),cs.render(q,Kt||ss,ut?.state||"saved"),Me()}function Tr(e){const t=e.autoImport!==void 0&&e.autoImport!==q.autoImport;q=xr({...q,...e});try{Kt=sl(localStorage,q)}catch{Kt=!1}ls(),Ei({preferences:{...q},...t?{autoImport:q.autoImport}:{}})}function Ei(e){ut?.save(e)}function qv(){return{sourceID:Ct,projectID:mt,directory:Ue,days:ct,fromDate:lt,toDate:dt,includeChildren:yn,includeArchived:Yt}}k("#open-settings").addEventListener("click",cs.open);k("#mute-audio").addEventListener("click",()=>Tr({muted:!q.muted}));const Gv=()=>ls();ir.addEventListener("change",Gv);const Yv=e=>{if(e.key===ai)try{q={...nl(localStorage),autoImport:q.autoImport},ls()}catch{}};window.addEventListener("storage",Yv);ls();ut=new Pg(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=>{cs.render(q,Kt||ss,e),e==="error"&&vt("Changes applied, but could not save to the local library. Retrying when you return."),e==="saved"&&Cr?.check()});const Jl=Ag(Mt),Ke=Og(e=>Ii(e),Mt,vt);Cr=new Rg({eligible:()=>q.autoImport&&!ut?.pending&&document.visibilityState==="visible"&&!!(j&&!j.onboarding&&j.sources?.some(e=>e.selected)),busy:()=>Ke.busy||!!document.querySelector("dialog[open]"),refresh:()=>Ke.refresh(!0)});const kr=new AbortController,ds=()=>{document.visibilityState==="visible"&&(ut?.state==="error"&&ut.flush(),Cr?.check())};window.addEventListener("focus",ds,{signal:kr.signal});document.addEventListener("visibilitychange",ds,{signal:kr.signal});window.setInterval(ds,Mg);k("#manage-sources").addEventListener("click",()=>{Ke.open()});document.addEventListener("sessiongraph-import-status",e=>{const t=e.detail;Cr?.activity(),cs.importStatus(t),j&&(j.importing=t.running),ce.length||Ar(),k("#refresh").classList.toggle("spinning",t.running),k(".connection").title=t.running?`Importing ${Le(t.source)} · ${t.imported} sessions saved`:t.failed?"Import unavailable · open Manage sources for details":"Local library · SQLite"},{signal:kr.signal});const xi=Kd(Sn,Mt,e=>{Jl.open(e)});k("#search").addEventListener("click",xi.open);function le(e,t){At&&(e==="timeline"?!t:t)&&be();const n=k(`#${e}`);n.hidden=!t,k(`#toggle-${e}`).setAttribute("aria-expanded",String(t)),t&&innerWidth<760&&e!=="timeline"&&le(e==="explorer"?"inspector":"explorer",!1)}le("explorer",innerWidth>=760);let io=[];for(const e of["explorer","timeline","inspector"])k(`#toggle-${e}`).addEventListener("click",()=>le(e,k(`#${e}`).hidden));k("#close-explorer").addEventListener("click",()=>{le("explorer",!1),k("#toggle-explorer").focus()});k("#close-timeline").addEventListener("click",()=>{be(),le("timeline",!1),k("#toggle-timeline").focus()});function vt(e){k("#toast").textContent=e,k("#toast").hidden=!1,window.setTimeout(()=>{k("#toast").hidden=!0},3500)}function Si(){le("inspector",!1),as.close(),ft.clear(),k("#session-inspector").replaceChildren(),k("#toggle-inspector").hidden=!0}Si();async function Kv(){try{const{TimelineScene:e}=await lr(async()=>{const{TimelineScene:t}=await import("./scene-BkoCsbA8.js");return{TimelineScene:t}},__vite__mapDeps([0,1]));ee=new e(k("#scene"),{onSelect:t=>{t?(ar.play("select"),Sn(t)):Ai()},onPlaybackInterrupt:be,onEvent:t=>{ar.play("select"),wi(t)},onEventHover:(t,n,s,r)=>{Gn=void 0,t&&B&&Pe?ft.show(t,B,Pe.revision,n,s,r):ft.clear()},onHover:(t,n,s)=>{const r=k("#tooltip");r.classList.contains("message-tooltip")&&(ft.clear(),Gn=void 0),r.hidden!==!t&&(r.hidden=!t),t&&(Gn!==t.session&&(Gn=t.session,r.innerHTML=`<strong>${z(t.session.title)}</strong><span>${z(Le(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),j&&(ee.setGraph(te,!0),B&&(ee.select(B),ee.focus(B)),We&&ee.setFiles(We.files),Pe&&ee.setEvents(Pe.items))}catch(e){console.error("[sessiongraph] Graphics initialization failed",e),vt("3D requires WebGL. You can still browse sessions in the list.")}finally{Kl=!1,j&&Ar()}}Kv();k("#scene").addEventListener("scene-error",e=>vt(e.detail));async function $i(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 Ii(e=!1){const t=k("#refresh");t.disabled=!0,t.classList.add("spinning");try{const n=ut?.revision,s=await $i("/api/sessiongraph"),r=j,o=B?Bs.get(B):void 0,i=!!(r&&te.nodes.length);if(j=s,!ut?.pending&&n===ut?.revision){q={...xr(s.preferences||q),autoImport:s.autoImport!==!1};try{Kt=sl(localStorage,q)}catch{Kt=!1}if(!ss){const l=Fg(s.viewState);({sourceID:Ct,projectID:mt,directory:Ue,days:ct,fromDate:lt,toDate:dt,includeChildren:yn,includeArchived:Yt}=l),k("#children").checked=yn,Ho=JSON.stringify(l),s.preferences||Ei({preferences:{...q}})}ls()}if(ss=!0,k("#connection-label").textContent="Local library",k(".connection").classList.add("connected"),k(".connection").title=`Connected · ${ge(j.sessions.length)} sessions`,r&&JSON.stringify(r.sessions)===JSON.stringify(s.sessions)&&JSON.stringify(r.projects)===JSON.stringify(s.projects)){Ar();return}bi.clear(),Bs=new Map(j.sessions.map(l=>[l.id,l])),k("#source").innerHTML='<option value="">All sources</option>'+(j.sources||[]).map(l=>`<option value="${z(l.id)}">${z(l.name)} · ${l.sessions.toLocaleString()}</option>`).join(""),k("#source").value=Ct,k("#source-filter-icon").innerHTML=qe(Ct),xi.setData(j);const a=new Map;if(j.sessions.forEach(l=>a.set(l.projectID,(a.get(l.projectID)||0)+1)),k("#project").innerHTML='<option value="">All projects</option>'+[...j.projects].filter(l=>a.has(l.id)).sort((l,c)=>(a.get(c.id)||0)-(a.get(l.id)||0)).map(l=>`<option value="${z(l.id)}">${z(l.name)} · ${ge(a.get(l.id)||0)}</option>`).join(""),k("#project").value=mt,Ci(),B&&!r){const l=j.sessions.find(c=>c.id===B);l&&l.created<Date.now()-ct*864e5&&(ct=0),l?.archived&&(Yt=!0)}if(Ne(!i,i),B&&!r)Sn(B);else if(B){const l=Bs.get(B);if(l&&JSON.stringify(o)!==JSON.stringify(l)){const c=k(".detail-scroll")?.scrollTop||0;We=void 0,Pe=void 0,td(l,!1),k(".detail-scroll").scrollTop=c,cr(l.id),Li(l)}}else Si();!e&&j.warnings.length&&vt(j.warnings.join(" ")),!e&&j.onboarding&&Ke.open(!0)}catch(n){if(e&&j){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>${z(n instanceof Error?n.message:"Unable to connect.")}</p><button class="primary-button" id="retry">Retry ${N("arrow-right")}</button>`,k("#retry").addEventListener("click",()=>{Ii().then(ds)}),j||(k("#session-list").innerHTML='<p class="empty-list">Your sessions will appear here once connected.</p>',k("#list-count").textContent="Offline"),Me()}finally{t.disabled=!1,t.classList.remove("spinning")}}function Ci(){const e=j?.sessions.filter(s=>!mt||s.projectID===mt)||[],t=[...new Set(e.map(s=>s.directory))].sort((s,r)=>Yn(s).localeCompare(Yn(r))),n=new Set(j?.projects.flatMap(s=>s.worktrees));k("#directory").innerHTML='<option value="">All directories</option>'+t.map(s=>`<option value="${z(s)}">${n.has(s)?"⑂ ":""}${z(Yn(s))}</option>`).join(""),t.includes(Ue)||(Ue=""),k("#directory").value=Ue}function Ne(e=!1,t=!1){if(!j)return;t||(be(),oe=1,ln=60);const n=k("#session-list").scrollTop,s=document.activeElement?.closest("[data-session]")?.dataset.session,r=Date.now(),o=lt?new Date(`${lt}T00:00:00`).getTime():ct?r-ct*864e5:0,i=dt?new Date(`${dt}T23:59:59.999`).getTime():1/0;ce=j.sessions.filter(c=>Ug(c,Ct)&&(!mt||c.projectID===mt)&&(!Ue||c.directory===Ue)&&(yn||!c.parentID||!!c.forkID)&&(Yt||!c.archived)&&c.created>=o&&c.created<=i),vi=[...ce].sort((c,f)=>dn(f)-dn(c)),Gl=new Set(ce.map(c=>c.id)),xi.setScope(ce.map(c=>c.id)),te=jd(ce,j.projects,t?te:void 0),Yl=new Map(te.nodes.map(c=>[c.session.id,c.color])),ee?.setCutoff(oe),ee?.setGraph(te,e,t),Ar(),document.querySelectorAll("[data-days]").forEach(c=>c.classList.toggle("active",!lt&&!dt&&Number(c.dataset.days)===ct)),ki(),t&&(k("#session-list").scrollTop=n,s&&ns.get(s)?.focus({preventScroll:!0})),zv(),B&&!ce.some(c=>c.id===B)?Ai():B&&We&&ee?.setFiles(We.files),B&&Pe&&ee?.setEvents(Pe.items),Me();const a=qv(),l=JSON.stringify(a);ss&&l!==Ho&&(Ho=l,Ei({viewState:a}))}function Ar(){Ti();const e=k("#graph-message");e.hidden=!!(ce.length&&ee),ce.length?ee||(e.innerHTML=Kl?"<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=j?.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>':j&&!j.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",()=>Xl()),k("#empty-sources")?.addEventListener("click",()=>{Ke.open()}),Me()}function Ti(e=!1){const t=!!(ce.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,Ti()},1e3))}function Xl(e){Ct="",k("#source").value="",k("#source-filter-icon").innerHTML=qe(),mt="",Ue="",ct=0,lt="",dt="",yn=!0,Yt=e?.archived===!0,k("#project").value="",k("#children").checked=!0,Zl.setRange("",""),Ci(),Ne(!0)}function ki(){k("#list-count").textContent=ge(ce.length);const e=vi;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 ${B===n.id?"selected":""}" data-session="${z(n.id)}" aria-pressed="${B===n.id}" title="${z(n.title)}"><span class="session-dot" style="--node-color:${Yl.get(n.id)}"></span><span class="session-card-body"><span class="session-title">${z(n.title)}</span><span class="session-meta">${n.forkID?N("git-fork"):n.parentID?N("network"):""}<span class="source-badge" data-source="${z(n.source||"opencode")}">${qe(n.source)}${z(Le(n.source))}</span><span title="${n.activity?.lastMessageAt?"Latest saved message":"Session created; message time unavailable"}">${Uv.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;ki(),k("#session-list").scrollTop=n,Me()}),ns=new Map([...k("#session-list").querySelectorAll(".session-card")].map(n=>[n.dataset.session,n])),Me()}function Ql(e){for(const t of[e,B]){const n=t?ns.get(t):void 0;n&&(n.classList.toggle("selected",t===B),n.setAttribute("aria-pressed",String(t===B)))}}function zv(){Xe=Qc(ce),zl=tl(ce),Fo="";const e=Wg(ce.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&&Zl.setRange(lt||za(te.start),dt||za(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?jg(e,te.end-te.start):"—";k("#playback-period").textContent!==t&&(k("#playback-period").textContent=t);const n=Xe.at(e,oe>=1),s=zl(e,oe>=1),r=`${n.tokens}:${n.sessions}:${s}`;r!==Fo&&(Fo=r,k("#playback-summary").hidden=ce.length===0,k("#playback-sessions").textContent=ge(s),k("#playback-tokens").textContent=Xe.recorded?ql(n.tokens):"—",k("#playback-token-coverage").textContent=Xe.recorded?`${ge(n.sessions)} / ${ge(Xe.recorded)} with recorded usage`:"Usage unavailable",k("#playback-summary").title=`${ge(s)} sessions started. ${Xe.recorded?`${ge(n.tokens)} burnt tokens`:"Token usage unavailable"}. Token totals are added at the latest saved message, including cache where reported. ${ge(Xe.missing)} sessions have no supported recorded count.${Xe.untimed?` ${ge(Xe.untimed)} totals have no message timestamp and are included only at the end.`:""}`),ee?.setCutoff(oe)}function be(){if(At=!1,Zn=0,k("#app").classList.remove("playback-mode"),Us){const e=Us;Us=void 0,le("explorer",e.explorer),le("inspector",e.inspector&&!!B)}ee?.setPlaying(!1),cancelAnimationFrame(yi),k("#play").innerHTML=N("play"),k("#play").setAttribute("aria-label","Play timeline"),Me()}function ed(e){if(!At)return;const t=Math.max(0,e-or);or=e,document.hidden||(oe<1?oe=Math.min(1,oe+t*q.playbackSpeed/oi):Zn+=t),xn(),ee?.setPlaybackOutro(oe>=1?Math.min(1,Zn/nr):null),oe>=1&&Zn>=nr+el?be():yi=requestAnimationFrame(ed)}function Ai(){const e=B;Vo?.abort(),No?.abort(),k("#file-legend").hidden=!0,Ws++,js++,B=null,We=void 0,Pe=void 0,ee?.select(null),history.replaceState(null,"",location.pathname),Si(),Ql(e)}function Zv(e){const t=e.forkID?[{id:e.forkID,label:"Forked from",kind:"git-fork"}]:e.parentID?[{id:e.parentID,label:"Parent",kind:"network"}]:[],n=j.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=j.sessions.find(i=>i.id===r.id);return`<button class="relation" data-related="${z(r.id)}" ${o?"":"disabled"}>${N(r.kind)}<span><small>${r.label}</small><strong>${z(o?.title||"Session no longer available")}</strong></span>${N("arrow-up-right")}</button>`}).join("")}</section>`:""}function td(e,t=!0){const n=j.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=`
150
- <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>
151
- <div class="detail-scroll">
152
- <div class="detail-title"><span class="source-badge" data-source="${z(e.source||"opencode")}">${qe(e.source)}${z(Le(e.source))}</span><h2>${z(e.title)}</h2><span class="detail-date">${vn(e.created)}</span></div>
153
- <div class="detail-actions"><button id="open-session" class="secondary-button">${N("arrow-up-right")}Open session</button><button id="focus-session" class="icon-button" title="Focus node" aria-label="Focus node">${N("crosshair")}</button><button id="copy-id" class="icon-button" title="Copy session ID" aria-label="Copy session ID">${N("copy")}</button></div>
154
- <section id="message-detail" class="detail-section"></section>
155
- ${e.linkedSessionIDs?.length?`<section class="detail-section"><div class="section-label">Linked provider history</div><p class="coverage-note">One conversation on the map. Each source keeps its own saved history${e.coverage?.history==="partial"?"; the T3 copy is partial":""}.</p>${e.linkedSessionIDs.map(o=>`<button class="relation" data-history="${z(o)}">${qe(o.split(":")[0])}<span><small>Saved provider copy</small><strong>${z(Le(o.split(":")[0]))}</strong></span>${N("arrow-up-right")}</button>`).join("")}</section>`:""}
156
- <div id="file-detail"><section class="detail-section"><div class="section-label">Changed files</div><div class="detail-loading">${N("loader-circle","spinning")}Loading changes…</div></section></div>
157
- ${Zv(e)}
158
- <details class="more-details detail-section"><summary>Session info ${N("chevron-down")}</summary><dl class="metadata"><div><dt>Project</dt><dd>${z(n?.name||"Unknown")}</dd></div><div><dt>Model</dt><dd>${z(e.model)}</dd></div><div><dt>Agent</dt><dd>${z(e.agent||"Unknown")}</dd></div><div><dt>Tokens incl. cache</dt><dd>${e.tokens===null?"Not recorded":ql(e.tokens)}</dd></div><div><dt>Recorded cost</dt><dd>${e.cost===null?"Not recorded":`$${e.cost.toFixed(2)}`}</dd></div><div><dt>Updated</dt><dd>${mn(e.updated)}</dd></div><div><dt>Imported</dt><dd>${e.coverage?.importedAt?mn(e.coverage.importedAt):"Pending"}</dd></div></dl><div class="directory-card"><span>${r?"Worktree":"Directory"}</span><code>${z(e.directory)}</code></div></details>
159
- </div>
160
- `,k("#toggle-inspector").hidden=!1,t&&le("inspector",!0),k("#close-inspector").addEventListener("click",()=>{le("inspector",!1),k("#toggle-inspector").focus()}),k("#focus-session").addEventListener("click",()=>{be(),ee?.focus(e.id)}),k("#open-session").addEventListener("click",()=>{Jl.open(e)}),k("#copy-id").addEventListener("click",async()=>{try{await navigator.clipboard.writeText(e.nativeID||e.id),vt("Session ID copied")}catch{vt(e.nativeID||e.id)}}),nd(e),Me()}function nd(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">
161
- <div><dt>Trail starts</dt><dd>${vn(e.created)}</dd></div>
162
- <div><dt>Node · last message</dt><dd>${e.activity?.lastMessageAt?vn(e.activity.lastMessageAt):"Unknown · at session start"}</dd></div>
163
- </dl><div class="event-key"><span style="--event-color:#ffffff"><i></i>User & assistant messages</span></div><p class="coverage-note">${n.map(z).join(" · ")}</p><button class="secondary-button explore-events">Explore messages ${N("arrow-right")}</button>`,k(".explore-events").addEventListener("click",()=>wi()),Me()}async function Li(e,t=!1){const n=++js;No?.abort();const s=new AbortController;No=s;try{const r=await $i(`/api/sessiongraph/session/${encodeURIComponent(e.id)}/event-markers`,s.signal);if(s.signal.aborted||n!==js||B!==e.id)return;Pe=r,ee?.setEvents(r.items,t),nd(e,r)}catch{if(s.signal.aborted||n!==js||B!==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",()=>wi()),k("#retry-timeline").addEventListener("click",()=>{Li(e)})}}function Jv(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 Za(e){const t=e.files;k("#file-legend").hidden=!t.length,k("#file-detail").innerHTML=`
164
- <section class="detail-section"><div class="section-label">Changed files<span>${ge(t.length)}${e.partial?"+":""}</span></div>
165
- ${t.length?`<ul class="file-list">${t.map(n=>`<li title="${z(n.path)} · ${n.source}">${N("file-code-2")}<div><strong>${z(Yn(n.path))}</strong>${n.path.includes("/")?`<span>${z(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>'}
166
- <p class="coverage-note">${ge(e.messagesScanned)} messages${e.partial?" · Partial history":""}${e.snapshotSteps?"":" · Snapshots unavailable"}${t.length>80?" · 80 files on map":""}</p>
167
- ${e.nextCursor?'<p class="coverage-note" id="history-loading" role="status">Loading full history…</p>':""}</section>
168
- ${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>${z(n.directory)}</code></div>`).join("")}</details>`:""}
169
- ${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>${z(n.name)}</span><strong>${n.count}</strong></div>`).join("")}</div></details>`:""}
170
- `,ee?.setFiles(t),Me()}async function cr(e){const t=++Ws;Vo?.abort();const n=new AbortController;Vo=n;let s,r;const o=new Set;try{do{const i=await $i(`/api/sessiongraph/session/${encodeURIComponent(e)}${s?`?cursor=${encodeURIComponent(s)}`:""}`,n.signal);if(n.signal.aborted||t!==Ws||B!==e)return;if(r&&i.revision!==r.revision)throw new Error("History changed. Retry to load the latest version.");if(r=r?Jv(r,i):i,We=r,!s||!i.nextCursor?Za(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!==Ws||B!==e)return;if(We){Za(We);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",()=>{cr(e)})}else k("#file-detail").innerHTML=`<section class="detail-section"><div class="section-label">Changed files</div><p class="coverage-note">${z(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",()=>cr(e))}}function Sn(e){const t=Bs.get(e);if(!t)return;const n=B;as.close(),ft.clear(),Gl.has(e)||Xl(t),be(),oe=1,xn(),B=e,We=void 0,Pe=void 0,k("#file-legend").hidden=!0,history.replaceState(null,"",`?session=${encodeURIComponent(e)}`),ee?.select(e),td(t),ee?.focus(e),Ql(n),cr(e),Li(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-history]")?.dataset.history;if(t){ft.clear(),be(),le("inspector",!0),as.open({id:t,source:t.split(":")[0]});return}const n=e.target.closest("[data-related]");n?.dataset.related&&Sn(n.dataset.related)});k("#project").addEventListener("change",e=>{mt=e.target.value,Ue="",Ci(),Ne(!0)});k("#source").addEventListener("change",e=>{Ct=e.target.value,k("#source-filter-icon").innerHTML=qe(Ct),Ne(!0)});k("#directory").addEventListener("change",e=>{Ue=e.target.value,Ne(!0)});k("#children").addEventListener("change",e=>{yn=e.target.checked,Ne()});document.querySelectorAll("[data-days]").forEach(e=>e.addEventListener("click",()=>{ct=Number(e.dataset.days),lt="",dt="",Ne(!0)}));k("#reset-camera").addEventListener("click",()=>Ne(!0));k("#refresh").addEventListener("click",()=>{j?.onboarding?Ke.open(!0):Ke.refresh()});k("#scrubber").addEventListener("input",e=>{be(),oe=Number(e.target.value)/1e3,xn()});k("#play").addEventListener("click",()=>{if(ce.length){if(At)return be();oe>=1&&(oe=0),xn(),Us={explorer:!k("#explorer").hidden,inspector:!k("#inspector").hidden},le("explorer",!1),le("inspector",!1),le("timeline",!0),ft.clear(),Gn=void 0,k("#app").classList.add("playback-mode"),Ti(!0),At=!0,Zn=0,ee?.setPlaying(!0),or=performance.now(),k("#play").innerHTML=N("pause"),k("#play").setAttribute("aria-label","Pause timeline"),Me(),yi=requestAnimationFrame(ed)}});document.addEventListener("visibilitychange",()=>{or=performance.now()},{signal:kr.signal});async function Xv(){const e=k("#share-playback");e.disabled=!0;try{if(!ro){const{createPlaybackShare:t}=await lr(async()=>{const{createPlaybackShare:n}=await import("./share-CS1dKayZ.js");return{createPlaybackShare:n}},__vite__mapDeps([2,0,1,3]));ro=t(Mt,()=>{Lr()})}te.nodes.length&&ro.open(te,q)}catch{vt("Could not open video sharing. Please try again.")}finally{e.disabled=!ce.length||!ee}}async function Lr(){try{if(!oo){const{createPublishing:e}=await lr(async()=>{const{createPublishing:t}=await import("./publishing-CpVLG7_B.js");return{createPublishing:t}},__vite__mapDeps([4,0,1,3,5]));oo=e(Mt,()=>{Xv()})}await oo.open(ce.map(e=>e.id))}catch{vt("Could not open publishing. Please try again.")}}k("#share-playback").addEventListener("click",Lr);k("#open-publishing").addEventListener("click",Lr);for(const e of[!1,!0])k(`#view-${e?"2d":"3d"}`).addEventListener("click",()=>Tr({view:e?"2d":"3d"}));k("#motion").addEventListener("click",()=>Tr({motion:Lo(q,ir.matches)?"off":"on"}));k("#help").addEventListener("click",()=>{k("#help-dialog").showModal(),Mt()});k("#help-dialog").addEventListener("close",Mt);k("#close-help").addEventListener("click",()=>k("#help-dialog").close());document.addEventListener("keydown",e=>{if(!e.defaultPrevented&&!document.querySelector("dialog[open]")){if(At&&e.key==="Escape"){e.preventDefault(),be();return}if(!as.handleKey(e)){if(e.key==="Escape"){B?Ai():le("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=vi,s=n.findIndex(i=>i.id===B),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),ki()),ns.get(o.id)?.focus({preventScroll:!0})));return}}if(e.key.toLowerCase()==="f"&&Ne(!0),e.key.toLowerCase()==="h"){be();const t=["explorer","timeline","inspector"].filter(n=>!k(`#${n}`).hidden);t.length?(io=t,t.forEach(n=>le(n,!1))):(io.length?io:["explorer","timeline"]).forEach(n=>{(n!=="inspector"||B)&&le(n,!0)})}}}}});Ii().then(()=>{j?.importing?Ke.resume():ds()});export{cy as C,Er as D,oi as P,ly as R,Pd as S,lr as _,tl as a,sy as b,Xa as c,ry as d,ii as e,oy as f,jg as g,K as h,Xg as i,ny as j,Le as k,Lo as l,jd as m,il as n,In as o,Qc as p,Qv as q,Bd as r,dn as s,Wg as t,ey as u,iy as v,ty as w,ay as x,ao as y};