sessiongraph 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,165 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/scene-Cg3ezvud.js","assets/three-D_1Qt16u.js","assets/share-Cyn7-rP1.js"])))=>i.map(i=>d[i]);
2
- (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&s(i)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}})();const Xl="modulepreload",Ql=function(e){return"/"+e},Ci={},Ro=function(t,n,s){let r=Promise.resolve();if(n&&n.length>0){let l=function(c){return Promise.all(c.map(h=>Promise.resolve(h).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=Ql(c),c in Ci)return;Ci[c]=!0;const h=c.endsWith(".css"),u=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const f=document.createElement("link");if(f.rel=h?"stylesheet":Xl,h||(f.as="script"),f.crossOrigin="",f.href=c,a&&f.setAttribute("nonce",a),document.head.appendChild(f),h)return new Promise((p,g)=>{f.addEventListener("load",p),f.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 qa=(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=qa(...r);s.appendChild(o)}),s};var Ga=([e,t,n])=>qa(e,t,n);const ed=e=>Array.from(e.attributes).reduce((t,n)=>(t[n.name]=n.value,t),{}),td=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:"",nd=e=>e.flatMap(td).map(n=>n.trim()).filter(Boolean).filter((n,s,r)=>r.indexOf(n)===s).join(" "),sd=e=>e.replace(/(\w)(\w*)(_|-|\s*)/g,(t,n,s)=>n.toUpperCase()+s.toLowerCase()),ki=(e,{nameAttr:t,icons:n,attrs:s})=>{const r=e.getAttribute(t);if(r==null)return;const o=sd(r),i=n[o];if(!i)return console.warn(`${e.outerHTML} icon name was not found in the provided icons object.`);const a=ed(e),[l,c,h]=i,u={...c,"data-lucide":r,...s,...a},f=nd(["lucide",`lucide-${r}`,a,s]);f&&Object.assign(u,{class:f});const p=Ga([l,u,h]);return e.parentNode?.replaceChild(p,e)};const Y={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};const rd=["svg",Y,[["path",{d:"M5 12h14"}],["path",{d:"m12 5 7 7-7 7"}]]];const od=["svg",Y,[["path",{d:"M7 7h10v10"}],["path",{d:"M7 17 17 7"}]]];const id=["svg",Y,[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}],["path",{d:"m3.3 7 8.7 5 8.7-5"}],["path",{d:"M12 22V12"}]]];const ad=["svg",Y,[["path",{d:"m6 9 6 6 6-6"}]]];const cd=["svg",Y,[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}],["path",{d:"M12 17h.01"}]]];const ld=["svg",Y,[["circle",{cx:"12",cy:"12",r:"10"}],["polyline",{points:"12 6 12 12 16 14"}]]];const dd=["svg",Y,[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}]]];const ud=["svg",Y,[["circle",{cx:"12",cy:"12",r:"10"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18"}]]];const fd=["svg",Y,[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5"}],["path",{d:"M3 12A9 3 0 0 0 21 12"}]]];const hd=["svg",Y,[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}],["path",{d:"m5 12-3 3 3 3"}],["path",{d:"m9 18 3-3-3-3"}]]];const pd=["svg",Y,[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"}]]];const gd=["svg",Y,[["line",{x1:"6",x2:"6",y1:"3",y2:"15"}],["circle",{cx:"18",cy:"6",r:"3"}],["circle",{cx:"6",cy:"18",r:"3"}],["path",{d:"M18 9a9 9 0 0 1-9 9"}]]];const md=["svg",Y,[["circle",{cx:"12",cy:"18",r:"3"}],["circle",{cx:"6",cy:"6",r:"3"}],["circle",{cx:"18",cy:"6",r:"3"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9"}],["path",{d:"M12 12v3"}]]];const vd=["svg",Y,[["circle",{cx:"12",cy:"5",r:"1"}],["circle",{cx:"19",cy:"5",r:"1"}],["circle",{cx:"5",cy:"5",r:"1"}],["circle",{cx:"12",cy:"12",r:"1"}],["circle",{cx:"19",cy:"12",r:"1"}],["circle",{cx:"5",cy:"12",r:"1"}],["circle",{cx:"12",cy:"19",r:"1"}],["circle",{cx:"19",cy:"19",r:"1"}],["circle",{cx:"5",cy:"19",r:"1"}]]];const yd=["svg",Y,[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56"}]]];const bd=["svg",Y,[["circle",{cx:"12",cy:"16",r:"1"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3"}]]];const wd=["svg",Y,[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"}],["path",{d:"M12 12V8"}]]];const Ed=["svg",Y,[["circle",{cx:"12",cy:"12",r:"3"}],["circle",{cx:"19",cy:"5",r:"2"}],["circle",{cx:"5",cy:"19",r:"2"}],["path",{d:"M10.4 21.9a10 10 0 0 0 9.941-15.416"}],["path",{d:"M13.5 2.1a10 10 0 0 0-9.841 15.416"}]]];const xd=["svg",Y,[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M15 3v18"}]]];const Sd=["svg",Y,[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M3 9h18"}],["path",{d:"M9 21V9"}]]];const $d=["svg",Y,[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1"}]]];const Id=["svg",Y,[["polygon",{points:"6 3 20 12 6 21 6 3"}]]];const Td=["svg",Y,[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}],["path",{d:"M8 16H3v5"}]]];const Cd=["svg",Y,[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}],["path",{d:"M3 3v5h5"}]]];const kd=["svg",Y,[["circle",{cx:"11",cy:"11",r:"8"}],["path",{d:"m21 21-4.3-4.3"}]]];const Ad=["svg",Y,[["path",{d:"M20 7h-9"}],["path",{d:"M14 17H5"}],["circle",{cx:"17",cy:"17",r:"3"}],["circle",{cx:"7",cy:"7",r:"3"}]]];const Ld=["svg",Y,[["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 Od=["svg",Y,[["line",{x1:"21",x2:"14",y1:"4",y2:"4"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22"}]]];const Ya=["svg",Y,[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"}],["path",{d:"M20 3v4"}],["path",{d:"M22 5h-4"}],["path",{d:"M4 17v2"}],["path",{d:"M5 18H3"}]]];const Md=["svg",Y,[["polyline",{points:"4 17 10 11 4 5"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19"}]]];const Ka=["svg",Y,[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z"}],["path",{d:"M16 9a5 5 0 0 1 0 6"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728"}]]];const Dd=["svg",Y,[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15"}]]];const Rd=["svg",Y,[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]]];const Pd=({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=>ki(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=>ki(o,{nameAttr:"icon-name",icons:e,attrs:n})))}},Ai=["#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 qn(e){return js(e).split("/").at(-1)||"/"}const js=e=>(/^(?:[a-z]:[\\/]|\\\\)/i.test(e)?e.replace(/\\/g,"/"):e).replace(/\/+$/,"")||(e.startsWith("/")?"/":""),Tn=e=>e.directory?JSON.stringify(["directory",js(e.directory)]):JSON.stringify(["project",e.source||"opencode",e.projectID||e.id]),dn=e=>Math.max(e.created,e.activity?.lastMessageAt||e.created),to=(e,t)=>{const n=t.timeFrame||t;return(e-n.start)/Math.max(1,n.end-n.start)*300-150},Gv=(e,t)=>to(t.start+(t.end-t.start)*e,t),Po=(e,t)=>[t,e.position[1],e.position[2]],Vd=(e,t)=>Po(e,Math.max(e.startPosition[0],Math.min(t,e.position[0]))),Yv=(e,t,n,s=0,r=[1,0,0])=>{const o=Vd(e,t);return[o[0]+r[0]*(n+s),o[1]+r[1]*(n+s),o[2]+r[2]*(n+s)]},Kv=(e,t)=>[Po(e,Math.max(e.startPosition[0],Math.min(t.startPosition[0],e.position[0]))),t.startPosition];function Nd(e,t,n){if(!e.length)return{nodes:[],edges:[],lanes:[],start:0,end:0};const s=[...e].sort((E,L)=>E.created-L.created||E.id.localeCompare(L.id)),r=s[0].created,o=s.reduce((E,L)=>Math.max(E,dn(L)),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 L=Tn(E),x=a.get(L)||[];x.push(E),a.set(L,x)}const l=[...a].sort((E,L)=>L[1].length-E[1].length||E[0].localeCompare(L[0])),c=new Map(n?.lanes.map((E,L)=>[E.key,E.slot??L]));let h=Math.max(-1,...c.values())+1;for(const[E]of l)c.has(E)||c.set(E,h++);l.sort((E,L)=>c.get(E[0])-c.get(L[0]));const u=[],f=[],p=new Set(t.flatMap(E=>E.worktrees.map(js)));l.forEach(([E,L])=>{const x=c.get(E),A=x*2.399963,b=x===0?0:15+Math.sqrt(x)*14,S=Math.cos(A)*b,D=Math.sin(A)*b*.7,M=Ai[x%Ai.length],w=t.find(V=>V.id===L[0].projectID),O=L[0].directory,R={key:E,slot:x,label:O?qn(O):w?.name||L[0].projectID||"Unknown directory",color:M,kind:O&&p.has(js(O))?"worktree":"directory",y:S,z:D,nodes:[]};for(const V of L){const H=to(dn(V),i),K=to(V.created,i),re=In(V.id),j=!!(V.parentID||V.forkID)?12:6,be=Math.sin((K+150)/65+x*.7)*3.5,Ot=typeof V.tokens=="number"&&Number.isFinite(V.tokens)?Math.max(0,V.tokens):0,$e={session:V,position:[H,S+be+(re-.5)*j,D+(In(V.id+"z")-.5)*j],startPosition:[K,0,0],color:M,radius:.35+Math.min(.9,Math.log10(1+Ot)*.11)};f.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(f.map(E=>[E.session.id,E])),y=new Set;for(const E of n?.nodes||[]){const L=m.get(E.session.id);L&&Tn(L.session)===Tn(E.session)&&(L.position[1]=E.position[1],L.position[2]=E.position[2],y.add(L.session.id))}function T(E,L=new Set){const x=E.session.id;if(y.has(x)||L.has(x))return;L.add(x);const A=E.session.forkID||E.session.parentID,b=A?m.get(A):void 0;if(b&&Tn(b.session)===Tn(E.session)){T(b,L);const S=In(x+"branch")>.5?1:-1;E.position[1]=b.position[1]+S*(9+In(x)*15),E.position[2]=b.position[2]+(In(x+"depth")-.5)*18}y.add(x)}return s.forEach(E=>T(m.get(E.id))),f.forEach(E=>{E.startPosition=Po(E,E.startPosition[0])}),{nodes:f,edges:d,lanes:u,start:r,end:o,timeFrame:i}}function Fd(){const e=new AbortController,t={signal:e.signal};let n,s=innerWidth<760;function r(c,h,u){const f=Math.max(12,Math.min(h,innerWidth-c.offsetWidth-12)),p=Math.max(72,Math.min(u,innerHeight-c.offsetHeight-12));Object.assign(c.style,{left:`${f}px`,top:`${p}px`,right:"auto",bottom:"auto",transform:"none"}),c.dataset.positioned="true"}function o(){if(!n)return;const{panel:c,handle:h,pointerID:u}=n;n=void 0,c.classList.remove("dragging"),h.hasPointerCapture(u)&&h.releasePointerCapture(u)}document.addEventListener("pointerdown",c=>{if(c.button!==0)return;const h=c.target,u=h.closest(".floating-panel");if(!u)return;document.querySelectorAll(".floating-panel").forEach(g=>g.classList.toggle("front",g===u));const f=h.closest("[data-drag-panel]");if(!f)return;u.querySelectorAll(".custom-dates[open]").forEach(g=>{g.open=!1}),c.preventDefault(),f.focus({preventScroll:!0});const p=u.getBoundingClientRect();n={panel:u,handle:f,pointerID:c.pointerId,x:c.clientX,y:c.clientY,left:p.left,top:p.top},f.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 f=u.getBoundingClientRect(),p=c.shiftKey?40:10;r(u,f.left+(c.key==="ArrowLeft"?-p:c.key==="ArrowRight"?p:0),f.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 h=c.getBoundingClientRect();r(c,h.left,h.top)},l=new ResizeObserver(c=>c.forEach(h=>a(h.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 Hd=2,Li=e=>JSON.stringify([Hd,e.revision,e.updated,e.created,e.projectID,e.directory]),un=e=>e.normalize("NFKD").replace(new RegExp("\\p{M}","gu"),"").toLowerCase(),Vo=e=>un(e).match(/[\p{L}\p{N}]+/gu)||[],_d=e=>Vo(e).join(" ");function Bd(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(_d(o)),n.push(o)}return t.text=n.join(" "),t.terms=Vo(t.text).slice(0,12),t.text=t.terms.join(" "),t}function jd(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 za={opencode:{name:"OpenCode",icon:"opencode"},"claude-code":{name:"Claude Code",icon:"claude"},codex:{name:"Codex",icon:"openai"},cursor:{name:"Cursor",icon:"cursor"},gemini:{name:"Gemini CLI",icon:"gemini"},"qwen-code":{name:"Qwen Code",icon:"qwen"},pi:{name:"Pi",icon:"pi"},copilot:{name:"GitHub Copilot CLI",icon:"copilot"},cline:{name:"Cline",icon:"cline"},"roo-code":{name:"Roo Code",icon:"roo"},"kilo-code":{name:"Kilo Code",icon:"kilo"},continue:{name:"Continue",icon:"continue"}},Ue=e=>za[e||"opencode"]?.name||e||"Unknown",ut=e=>{const t=za[e||""]?.icon||"generic";return`<span class="source-icon source-icon-${t}" aria-hidden="true" style="--source-icon:url('/sources/${t}.svg')"></span>`},Za=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)),Rt=e=>e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]);function Ja(e,{checked:t=e.selected,disabled:n=!1,settings:s=!1}={}){const r=e.available?"Detected":"Not detected",o=[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="${Rt(e.id)}" title="${Rt(o)}"><input ${s?'class="settings-source"':""} type="checkbox" value="${Rt(e.id)}" aria-label="${Rt(e.name)}" aria-description="${Rt(`${r}. ${e.sessions.toLocaleString()} saved sessions. ${o}`)}" ${t?"checked":""} ${n?"disabled":""}/><span class="source-symbol">${ut(e.id)}</span><span class="source-copy"><strong>${Rt(e.name)}</strong><small class="source-meta"><span class="source-detected ${e.available?"detected":""}">${r}</span><span>${e.sessions.toLocaleString()} saved</span></small>${e.error?`<small class="source-error">${Rt(e.error)}</small>`:""}</span></label>`}const Te=e=>e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]);function Cn(e,t){const n=new Set(t.map(un));let s=0,r="";for(const o of e.matchAll(/[\p{L}\p{N}]+/gu)){r+=Te(e.slice(s,o.index));const i=un(o[0]),a=[...n].some(l=>i.startsWith(l));r+=a?`<mark>${Te(o[0])}</mark>`:Te(o[0]),s=o.index+o[0].length}return r+Te(e.slice(s))}function Wd(e,t=()=>{},n){const s=new Worker(new URL("/assets/worker-YMPBjASm.js",import.meta.url),{type:"module"}),r=new AbortController,o={signal:r.signal},i=document.createElement("dialog");i.className="search-dialog",i.setAttribute("aria-label","Search sessions"),i.innerHTML=`
6
- <div class="search-command"><span class="search-command-icon" aria-hidden="true">⌕</span><input id="session-query" type="search" placeholder="Search sessions, messages, files…" autocomplete="off" spellcheck="false" role="combobox" aria-label="Search all sessions" aria-autocomplete="list" aria-expanded="true" aria-controls="search-results"/><button class="icon-button search-close" aria-label="Close search" title="Close (Esc)">×</button></div>
7
- <div class="search-options"><select id="search-scope" aria-label="Search scope" title="Switch scope (Alt+S)"><option value="all">All history</option><option value="view">Current view</option></select><button id="search-conversations" class="search-chip" aria-label="Index conversations" aria-pressed="true" title="Pause or resume background indexing. Indexed messages, tools, and files remain searchable.">Conversations</button><span id="search-index-state" role="status">Loading index…</span></div>
8
- <div class="search-body"><div id="search-results" class="search-results" role="listbox" aria-label="Matching sessions"><div class="search-results-inner"></div></div><aside id="search-preview" class="search-preview" aria-label="Session preview"></aside></div>
9
- <div class="search-footer"><span id="search-result-status" role="status">Loading sessions…</span><button id="search-more" hidden>More results</button><details class="search-syntax"><summary title="Search filters and cache">Filters</summary><div><code>project:sessiongraph</code><code>model:claude</code><code>in:files package.json</code><code>is:fork</code><code>after:2026-09-01</code><code>"exact phrase"</code><button id="search-clear-cache" title="Clear saved search text and pause indexing. Titles remain searchable; enable Conversations to rebuild.">Clear saved index</button></div></details><span class="search-keys"><kbd>↑↓</kbd> navigate <kbd>↵</kbd> open</span></div>`,document.body.append(i);const a=v=>i.querySelector(v),l=a("#session-query"),c=a("#search-results"),h=a(".search-results-inner"),u=a("#search-preview"),f=a("#search-scope");let p=new Map,g=new Map,d,m=[],y=0,T=0,E=0,L=80,x=0,A=0,b=0,S=!1,D=!1,M=!0,w,O=null,R,V=0,H="",K="",re=!1;const z=new Map,j=86,be=v=>s.postMessage(v);function Ot(){if(!w)return;const v=a("#search-index-state");v.textContent=w.storage==="restoring"?"Restoring saved index…":w.complete===w.total&&w.total?`Conversations ready${w.storage==="local"?" · saved locally":""}`:`${w.indexed.toLocaleString()} / ${w.total.toLocaleString()} conversations${M?w.active?" · indexing":" · partial":" · paused"}`,v.title=`Titles and metadata cover all ${w.total.toLocaleString()} imported sessions. ${w.complete.toLocaleString()} conversations have all supported text indexed. ${w.failed?`${w.failed} unavailable; toggle Conversations to retry. `:""}${w.limited?"Large histories are sampled; missing matches may be in unindexed text. ":""}${w.storage==="memory"?"Saving unavailable; search continues in memory.":`Saved in local SQLite. ${w.restored.toLocaleString()} conversations restored; unchanged pages are reused. Clear saved index under Filters. Imported sessions remain saved.`}`}function $e(){if(h.style.height=`${m.length*j}px`,!m.length){h.innerHTML=`<div class="search-empty">${Te(K||(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/j)-3),I=Math.min(m.length,v+Math.ceil(c.clientHeight/j)+7);h.innerHTML=m.slice(v,I).map((N,Q)=>{const W=v+Q,q=p.get(N.id);if(!q)return"";const ce=`${Ue(q.source)} · ${g.get(q.projectID)||q.directory.split("/").at(-1)||"Global"} · ${new Date(q.updated).toLocaleDateString(void 0,{month:"short",day:"numeric"})}`;return`<div id="search-hit-${W}" class="search-result ${W===y?"active":""}" role="option" aria-selected="${W===y}" aria-posinset="${W+1}" aria-setsize="${T}" data-result-index="${W}" style="top:${W*j}px"><div class="search-result-title">${Cn(q.title,N.terms)}</div><div class="search-result-meta"><span>${ut(q.source)}${Te(ce)}</span><span class="match-kind">${Te(N.source)}</span></div>${N.excerpt?`<div class="search-result-excerpt">${Cn(N.excerpt,N.terms)}</div>`:`<div class="search-result-excerpt">${Te(q.model)}</div>`}</div>`}).join(""),y>=v&&y<I?l.setAttribute("aria-activedescendant",`search-hit-${y}`):l.removeAttribute("aria-activedescendant")}function Ye(v,I=!1,N=!1){const Q=m[y],W=Q&&p.get(Q.id);if(!W){u.innerHTML="";return}const q=Q.terms.length?Q.terms:Vo(Bd(l.value).text),ce=v?.fragments.filter(ie=>{const Fe=un(ie.text);return q.length&&q.every(He=>Fe.includes(He))}).slice(0,4)||[],De=v?.fragments.filter(ie=>["You","Assistant"].includes(ie.kind)).slice(0,5).reverse()||[],Ne=ce.length?ce:De;if(u.innerHTML=`<div class="search-preview-heading"><span>${Te(g.get(W.projectID)||"Session")}</span><h2>${Cn(W.title,q)}</h2><p>${Te(W.model)} · ${new Date(W.created).toLocaleDateString()}</p><button class="secondary-button search-open">Explore session <span aria-hidden="true">↗</span></button></div>${Q.excerpt?`<section class="search-preview-section"><h3>Matching passage</h3><p>${Cn(Q.excerpt,q)}</p></section>`:""}<section class="search-preview-section"><h3>${ce.length?"Matching context":"Recent conversation"}</h3>${I?'<p class="preview-loading">Loading preview…</p>':N?'<p>Preview unavailable.</p><button class="text-button preview-retry">Retry</button>':Ne.length?Ne.map(ie=>`<article><span>${Te(ie.kind)}</span><p>${Cn(jd(ie.text,q,360),q)}</p></article>`).join(""):"<p>No conversation text in this batch.</p>"}${v&&(v.nextCursor||v.truncated)?'<p class="preview-coverage">Recent messages · partial preview</p>':""}</section>`,u.querySelector(".search-open")?.addEventListener("click",$n,o),n){const ie=document.createElement("button");ie.className="text-button search-launch",ie.innerHTML=`${ut(W.source)}Open in ${Te(Ue(W.source))} ↗`,ie.addEventListener("click",()=>n(W),o),u.querySelector(".search-preview-heading")?.append(ie)}u.querySelector(".preview-retry")?.addEventListener("click",()=>{H="",Mt()},o)}function Mt(){const v=m[y],I=v&&p.get(v.id),N=I?`${I.id}:${Li(I)}:${l.value}`:"";if(N===H)return;if(H=N,window.clearTimeout(V),R?.abort(),!I){Ye();return}const Q=`${I.id}:${Li(I)}`,W=z.get(Q);if(W){Ye(W);return}Ye(void 0,!0),V=window.setTimeout(async()=>{const q=new AbortController;R=q;try{const ce=await fetch(`/api/sessiongraph/session/${encodeURIComponent(I.id)}/content?updated=${I.updated}`,{signal:q.signal});if(!ce.ok)throw new Error("Preview unavailable");const De=await ce.json();if(q.signal.aborted||N!==H)return;z.size>=25&&z.delete(z.keys().next().value),z.set(Q,De),Ye(De)}catch{!q.signal.aborted&&N===H&&Ye(void 0,!1,!0)}},90)}function Zt(){cancelAnimationFrame(x),S=!0,l.setAttribute("aria-busy","true");const v=++E;A=performance.now(),x=requestAnimationFrame(()=>be({type:"query",request:v,text:l.value,viewOnly:f.value==="view",limit:L}))}function yt(){y=0,re=!1,L=80,c.scrollTop=0,H="",Zt()}function Dt(v){if(!m.length)return;re=!0,y=Math.max(0,Math.min(m.length-1,y+v));const I=y*j;I<c.scrollTop?c.scrollTop=I:I+j>c.scrollTop+c.clientHeight&&(c.scrollTop=I+j-c.clientHeight),$e(),Mt()}function bt(){i.close(),t(!1),R?.abort(),window.clearTimeout(V),H="",O?.focus({preventScroll:!0})}function $n(){const v=m[y];!v||S||(bt(),e(v.id))}function k(){i.open||(O=document.activeElement,i.showModal()),t(!0),l.focus({preventScroll:!0}),l.select(),Zt(),M&&be({type:"warm",enabled:!0})}s.onmessage=v=>{const I=v.data;if(I.type==="status"){w=I.status,Ot();return}if(I.type==="error"){K=I.message,S=!1,l.setAttribute("aria-busy","false"),$e();return}if(I.request!==E)return;const N=m[y]?.id;b=S?performance.now()-A:b,S=!1,l.setAttribute("aria-busy","false"),m=I.hits,T=I.total,K=I.error||"",y=Math.max(0,Math.min(m.length-1,re&&N?m.findIndex(Q=>Q.id===N):0)),a("#search-result-status").textContent=K||`${T.toLocaleString()} ${l.value?"matches":"sessions"} · ${Math.round(I.elapsed)} ms`,a("#search-more").hidden=m.length>=T||L>=250,i.open&&($e(),Mt())},s.onerror=()=>{K="Search could not start. Reload to retry.",S=!1,$e()},l.addEventListener("input",()=>{D||yt()},o),l.addEventListener("compositionstart",()=>{D=!0},o),l.addEventListener("compositionend",()=>{D=!1,yt()},o),f.addEventListener("change",yt,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(),Mt(),l.focus())},o),c.addEventListener("dblclick",$n,o),a("#search-more").addEventListener("click",()=>{L=Math.min(250,L+80),Zt()},o),a("#search-conversations").addEventListener("click",()=>{M=!M,a("#search-conversations").setAttribute("aria-pressed",String(M)),be({type:"warm",enabled:M}),Ot()},o),a("#search-clear-cache").addEventListener("click",()=>{M=!1,a("#search-conversations").setAttribute("aria-pressed","false"),z.clear(),H="",R?.abort(),window.clearTimeout(V),a(".search-syntax").open=!1,be({type:"clear-cache"}),l.focus()},o),a(".search-close").addEventListener("click",bt,o),i.addEventListener("cancel",v=>{v.preventDefault(),bt()},o),i.addEventListener("keydown",v=>{v.stopPropagation(),!(D||v.isComposing)&&((v.key==="ArrowDown"||v.key==="ArrowUp")&&(v.preventDefault(),Dt(v.key==="ArrowDown"?1:-1)),(v.key==="PageDown"||v.key==="PageUp")&&(v.preventDefault(),Dt((v.key==="PageDown"?1:-1)*Math.max(1,Math.floor(c.clientHeight/j)))),v.key==="Enter"&&v.target===l&&(v.preventDefault(),$n()),v.key==="Escape"&&(v.preventDefault(),bt()),v.key.toLowerCase()==="s"&&v.altKey&&(v.preventDefault(),f.value=f.value==="view"?"all":"view",f.dispatchEvent(new Event("change",{bubbles:!0}))))},o),document.addEventListener("keydown",v=>{if(i.open||document.querySelector("dialog[open]"))return;const I=v.target,N=I.isContentEditable||I.closest('input:not([type="range"]):not([type="checkbox"]):not([type="radio"]), textarea, select');(v.key==="/"&&!N&&!v.ctrlKey&&!v.metaKey&&!v.altKey||v.key.toLowerCase()==="k"&&(v.metaKey||v.ctrlKey))&&(v.preventDefault(),k())},o);const $=new ResizeObserver(()=>{i.open&&$e()});return $.observe(c),{open:k,setData(v){d!==v.sourceID&&(z.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])),be({type:"data",sessions:v.sessions,projects:v.projects,sourceID:d})},setScope(v){be({type:"scope",ids:v})},diagnostics:()=>({open:i.open,query:l.value,matches:T,renderedRows:h.querySelectorAll('[role="option"]').length,roundTripMs:b,pending:S,index:w}),dispose(){s.terminate(),r.abort(),$.disconnect(),R?.abort(),window.clearTimeout(V),cancelAnimationFrame(x),i.remove()}}}const Nn=[{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"}],Tr=e=>Nn.some(t=>t.id===e),Xa=e=>/^ses[a-zA-Z0-9_-]+$/.test(e);function Ud(e,t){if(!Xa(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(qd(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(),qd=e=>e.length===0,Gd=sn("select").parts("label","positioner","trigger","indicator","clearTrigger","item","itemText","itemIndicator","itemGroup","itemGroupLabel","list","content","root","control","valueText"),ve=Gd.build(),Yd=Object.defineProperty,Kd=(e,t,n)=>t in e?Yd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_=(e,t,n)=>Kd(e,typeof t!="symbol"?t+"":t,n);function zd(e){return e==null?[]:Array.isArray(e)?e:[e]}var Zd=e=>e[e.length-1],Jd=(e,t)=>e.indexOf(t)!==-1,Xd=(e,...t)=>e.concat(t),Qd=(e,...t)=>e.filter(n=>!t.includes(n)),Oi=(e,t)=>Jd(e,t)?Qd(e,t):Xd(e,t);function Mi(e,t){return e.reduce((n,s,r)=>(r%t===0?n.push([s]):Zd(n)?.push(s),n),[])}var Di=e=>e?.constructor.name==="Array",eu=(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(Di(e)&&Di(t))return eu(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},tu=e=>Array.isArray(e),Qa=e=>e!=null&&typeof e=="object",Cr=e=>Qa(e)&&!tu(e),nu=e=>typeof e=="string",Je=e=>typeof e=="function",su=e=>e==null,As=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),ru=e=>Object.prototype.toString.call(e),ec=Function.prototype.toString,ou=ec.call(Object),Fn=e=>{if(!Qa(e)||ru(e)!="[object Object]"||cu(e))return!1;const t=Object.getPrototypeOf(e);if(t===null)return!0;const n=As(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&ec.call(n)==ou},iu=e=>typeof e=="object"&&e!==null&&"$$typeof"in e&&"props"in e,au=e=>typeof e=="object"&&e!==null&&"__v_isVNode"in e,cu=e=>iu(e)||au(e),Ri=(e,...t)=>(typeof e=="function"?e(...t):e)??void 0,lu=e=>e(),tc=()=>{},Ws=(...e)=>(...t)=>{e.forEach(function(n){n?.(...t)})};function no(e,t,...n){if(e in t){const r=t[e];return Je(r)?r(...n):r}const s=new Error(`No matching key: ${JSON.stringify(e)} in ${JSON.stringify(Object.keys(t))}`);throw Error.captureStackTrace?.(s,no),s}var{min:du,max:uu}=Math,fu=e=>Number.isNaN(e),nc=e=>fu(e)?0:e,kr=(e,t,n)=>{const s=nc(e),r=t==null||s>=t,o=n==null||s<=n;return r&&o},hu=(e,t,n)=>du(uu(nc(e),t),n);function No(e){if(!Fn(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]=No(r))}return n}function sc(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 Ls(...e){e.length===1?e[0]:e[1],e.length===2&&e[0]}function Pi(...e){e.length===1?e[0]:e[1],e.length===2&&e[0]}function ir(e,t){if(e==null)throw new Error(t())}var Os={itemToValue(e){return typeof e=="string"?e:Cr(e)&&As(e,"value")?e.value:""},itemToString(e){return typeof e=="string"?e:Cr(e)&&As(e,"label")?e.label:Os.itemToValue(e)},isItemDisabled(e){return Cr(e)&&As(e,"disabled")?!!e.disabled:!1}},rc=class oc{constructor(t){_(this,"options",t),_(this,"items"),_(this,"indexMap",null),_(this,"copy",n=>new oc({...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)??Os.itemToValue(n)),_(this,"getItemDisabled",n=>n==null?!1:this.options.isItemDisabled?.(n)??Os.isItemDisabled(n)),_(this,"stringifyItem",n=>n==null?null:this.options.itemToString?.(n)??Os.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)&&pu(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,h=this.getByText(c,o),u=this.getItemValue(h);function f(){clearTimeout(r.timer),r.timer=-1}function p(g){r.keysSoFar=g,f(),g!==""&&(r.timer=+setTimeout(()=>{p(""),f()},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(us(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(us(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(us(this.items,o,r+1))}),_(this,"reorder",(n,s)=>this.copy(us(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}},pu=(e,t)=>!!e?.toLowerCase().startsWith(t.toLowerCase());function kn(e,t,...n){return[...e.slice(0,t),...n,...e.slice(t)]}function us(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 ic({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 ac({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 fs({values:e,collection:t,selectedItemMap:n}){const s=ic({values:e,collection:t,selectedItemMap:n}),r=ac({selectedItemMap:n,values:e,selectedItems:s,collection:t});return{selectedItems:s,nextSelectedItemMap:r}}function gu({selectedItems:e,collection:t}){return ac({selectedItemMap:new Map,values:e.map(n=>t.getItemValue(n)).filter(Boolean),selectedItems:e,collection:t})}var Us=e=>new rc(e);Us.empty=()=>new rc({items:[]});var mu=Object.defineProperty,vu=(e,t,n)=>t in e?mu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ar=(e,t,n)=>vu(e,typeof t!="symbol"?t+"":t,n),yu=(e,t)=>e.map((n,s)=>e[(Math.max(t,0)+s)%e.length]),qs=()=>{},ar=e=>typeof e=="object"&&e!==null,P=e=>e?"":void 0,fe=e=>e?"true":void 0,bu=1,wu=9,Eu=11,ue=e=>ar(e)&&e.nodeType===bu&&typeof e.nodeName=="string",Fo=e=>ar(e)&&e.nodeType===wu,xu=e=>ar(e)&&e===e.window,cc=e=>ue(e)?e.localName||"":"#document";function Su(e){return["html","body","#document"].includes(cc(e))}var lc=e=>ar(e)&&e.nodeType!==void 0,fn=e=>lc(e)&&e.nodeType===Eu&&"host"in e,dc=e=>ue(e)&&e.localName==="input",$u=e=>ue(e)?e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0:!1;function so(e){if(!e)return!1;const t=e.getRootNode();return cr(t)===e}var Iu=/(textarea|select)/;function Tu(e){if(e==null||!ue(e))return!1;try{return dc(e)&&e.selectionStart!=null||Iu.test(e.localName)||e.isContentEditable||e.getAttribute("contenteditable")==="true"||e.getAttribute("contenteditable")===""}catch{return!1}}function hn(e,t){if(!e||!t||!ue(e)||!lc(t))return!1;if(ue(t)&&e===t||e.contains(t))return!0;const n=t.getRootNode?.();if(n&&fn(n)){let s=t;for(;s;){if(e===s)return!0;s=s.parentNode||s.host}}return!1}function Me(e){return Fo(e)?e:xu(e)?e.document:e?.ownerDocument??document}function Cu(e){return Me(e).documentElement}function me(e){return fn(e)?me(e.host):Fo(e)?e.defaultView??window:ue(e)?e.ownerDocument?.defaultView??window:window}function cr(e){let t=e.activeElement;for(;t?.shadowRoot;){const n=t.shadowRoot.activeElement;if(!n||n===t)break;t=n}return t}function Vi(e,t){return!e||e===Me(e).body?!1:!t.some(n=>hn(n,e))}function ku(e){if(cc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||fn(e)&&e.host||Cu(e);return fn(t)?t.host:t}function Au(e){let t;try{if(t=e.getRootNode({composed:!0}),Fo(t)||fn(t))return t}catch{}return e.ownerDocument??document}var Lr=new WeakMap;function uc(e){return Lr.has(e)||Lr.set(e,me(e).getComputedStyle(e)),Lr.get(e)}var Ho=()=>typeof document<"u";function Lu(){return navigator.userAgentData?.platform??navigator.platform}function Ou(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}var _o=e=>Ho()&&e.test(Lu()),Mu=e=>Ho()&&e.test(Ou()),Du=/^iPhone/i,Ru=/^iPad/i,Pu=/^Mac/i,Vu=/Android/i,Ni=()=>Ho()&&!!navigator.maxTouchPoints,Nu=()=>_o(Du),Fu=()=>_o(Ru)||Bo()&&navigator.maxTouchPoints>1,fc=()=>Nu()||Fu(),Bo=()=>_o(Pu),Hu=()=>Mu(Vu),_u=new Set(["menu","listbox","dialog","grid","tree","region","application"]),Bu=e=>_u.has(e),ju=e=>e.getAttribute("aria-controls")?.split(" ")||[];function Wu(e,t){const n=new Set,s=Au(e),r=o=>{const i=o.querySelectorAll("[aria-controls]");for(const a of i){if(a.getAttribute("aria-expanded")!=="true")continue;const l=ju(a);for(const c of l){if(!c||n.has(c))continue;n.add(c);const h=s.getElementById(c);if(h){const u=h.getAttribute("role"),f=h.getAttribute("aria-modal")==="true";if(u&&Bu(u)&&!f&&(h===t||h.contains(t)||r(h)))return!0}}}return!1};return r(e)}function Uu(e){return e.composedPath?.()??e.nativeEvent?.composedPath?.()}function ft(e){return Uu(e)?.[0]??e.target}function qu(e){return jo(e).isComposing||e.keyCode===229}function Gu(e){return e.pointerType===""&&e.isTrusted?!0:Hu()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}var Yu=e=>e.button===2||Bo()&&e.ctrlKey&&e.button===0,Ku={Up:"ArrowUp",Down:"ArrowDown",Esc:"Escape"," ":"Space",",":"Comma",Left:"ArrowLeft",Right:"ArrowRight"},Fi={ArrowLeft:"ArrowRight",ArrowRight:"ArrowLeft"};function ro(e,t={}){const{dir:n="ltr",orientation:s="horizontal"}=t;let r=e.key;return r=Ku[r]??r,n==="rtl"&&s==="horizontal"&&r in Fi&&(r=Fi[r]),r}function jo(e){return e.nativeEvent??e}var Ms=(e,t,n,s)=>{const r=typeof e=="function"?e():e;return r?.addEventListener(t,n,s),()=>{r?.removeEventListener(t,n,s)}};function zu(e,t){const{type:n="HTMLInputElement",property:s="value"}=t,r=me(e)[n].prototype;return Object.getOwnPropertyDescriptor(r,s)??{}}function Zu(e){if(e.localName==="input")return"HTMLInputElement";if(e.localName==="textarea")return"HTMLTextAreaElement";if(e.localName==="select")return"HTMLSelectElement"}function hs(e,t,n="value"){if(!e)return;const s=Zu(e);s&&zu(e,{type:s,property:n}).set?.call(e,t),e.setAttribute(n,t)}function Ju(e){return e.matches("textarea, input, select, button")}function Xu(e,t){if(!e)return;const n=Ju(e)?e.form:e.closest("form"),s=r=>{r.defaultPrevented||t()};return n?.addEventListener("reset",s,{passive:!0}),()=>n?.removeEventListener("reset",s)}function Qu(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 ef(e,t){if(!e)return;const{onFieldsetDisabledChange:n,onFormReset:s}=t,r=[Xu(e,s),Qu(e,n)];return()=>r.forEach(o=>o?.())}var hc=Symbol.for("zag.changeEvent");function pc(e){return Object.prototype.hasOwnProperty.call(e,hc)}function tf(e){return pc(e)||Object.defineProperty(e,hc,{value:!0}),e}var nf=e=>ue(e)&&e.tagName==="IFRAME";function sf(e){const t=e.getAttribute("tabindex");return t?parseInt(t,10):NaN}var rf=e=>sf(e)<0;function of(e){return dc(e)&&e.type==="radio"}function af(e){if(!of(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&&lr(o)),r=s.find(o=>o.checked);return r?r===e:s[0]===e}function cf(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 lf(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=cf(l,t);if(c){const h=Array.from(c.querySelectorAll(Wo)).filter(n),u=i.get(l);if(u!==void 0){const f=u+1;s.splice(f,0,...h),h.forEach((p,g)=>{i.set(p,f+g)});for(let p=f+h.length;p<s.length;p++)i.set(s[p],p)}else{const f=s.length;s.push(...h),h.forEach((p,g)=>{i.set(p,f+g)})}r.push(...h)}}return s}var Wo="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 lr(e){return!ue(e)||e.closest("[inert]")?!1:e.matches(Wo)&&$u(e)}function Uo(e,t={}){if(!e)return[];const{includeContainer:n,getShadowRoot:s}=t,r=Array.from(e.querySelectorAll(Wo));n&&Or(e)&&r.unshift(e);const o=[];for(const i of r)if(Or(i)){if(nf(i)&&i.contentDocument){const a=i.contentDocument.body;o.push(...Uo(a,{getShadowRoot:s}));continue}o.push(i)}if(s){const i=lf(o,s,Or);return!i.length&&n?r:i}return!o.length&&n?r:o}function Or(e){return ue(e)&&e.tabIndex>0?!0:!lr(e)||rf(e)?!1:af(e)}function df(e,t={}){const n=Uo(e,t),s=n[0]||null,r=n[n.length-1]||null;return[s,r]}function uf(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=Uo(t).filter(a=>s?s(a):!0).find(a=>!a.hasAttribute("data-no-autofocus"))),o||t||void 0)}function ff(e){const t=e.currentTarget;if(!t)return!1;const[n,s]=df(t);return!(so(n)&&e.shiftKey||so(s)&&!e.shiftKey||!n&&!s)}var gc=class mc{constructor(){Ar(this,"id",null),Ar(this,"fn_cleanup"),Ar(this,"cleanup",()=>{this.cancel()})}static create(){return new mc}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 he(e){const t=gc.create();return t.request(e),t.cleanup}function vc(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 Mr=new WeakMap;function hf(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 pf(e){const t=hf(e),n=JSON.stringify(t);return{observe(s,r){const o=me(s);if(typeof o.MutationObserver!="function")return qs;const i=Mr.get(s)??new Map;let a=i.get(n);if(!a){const c=new Set,h=new o.MutationObserver(u=>{for(const f of[...c])if(c.has(f))try{f(u)}catch(p){o.queueMicrotask(()=>{throw p})}});h.observe(s,t),a={observer:h,listeners:c},i.set(n,a),Mr.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&&Mr.delete(s))}}}}function gf(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 mf(e,t){const n=he,s=[];return s.push(n(()=>{const r=typeof e=="function"?e():e;s.push(gf(r,t))})),()=>{s.forEach(r=>r?.())}}function oo(e){const t=ku(e);return Su(t)?Me(t).body:ue(t)&&bf(t)?t:oo(t)}var vf=/auto|scroll|overlay|hidden|clip/,yf=new Set(["inline","contents"]);function bf(e){const t=me(e),{overflow:n,overflowX:s,overflowY:r,display:o}=t.getComputedStyle(e);return vf.test(n+r+s)&&!yf.has(o)}var Hi=/auto|scroll|overlay|hidden/;function wf(e,t={}){const{axis:n}=t,{overflowX:s,overflowY:r}=me(e).getComputedStyle(e),o=n!=="y"&&Hi.test(s)&&e.scrollWidth>e.clientWidth,i=n!=="x"&&Hi.test(r)&&e.scrollHeight>e.clientHeight;return o||i}var rn="default",io="",Ds=new WeakMap;function Ef(e={}){const{target:t,doc:n}=e,s=n??document,r=s.documentElement;return fc()?(rn==="default"&&(io=r.style.webkitUserSelect,r.style.webkitUserSelect="none"),rn="disabled"):t&&(Ds.set(t,t.style.userSelect),t.style.userSelect="none"),()=>yc({target:t,doc:s})}function yc(e={}){const{target:t,doc:n}=e,r=(n??document).documentElement;if(fc()){if(rn!=="disabled")return;rn="restoring",setTimeout(()=>{vc(()=>{rn==="restoring"&&(r.style.webkitUserSelect==="none"&&(r.style.webkitUserSelect=io||""),io="",rn="default")})},300)}else if(t&&Ds.has(t)){const o=Ds.get(t);t.style.userSelect==="none"&&(t.style.userSelect=o??""),t.getAttribute("style")===""&&t.removeAttribute("style"),Ds.delete(t)}}function xf(e={}){const{defer:t,target:n,...s}=e,r=t?he:i=>i(),o=[];return o.push(r(()=>{const i=typeof n=="function"?n():n;o.push(Ef({...s,target:i}))})),()=>{o.forEach(i=>i?.())}}function Sf(e,t){return Array.from(e?.querySelectorAll(t)??[])}function $f(e,t){return e?.querySelector(t)??null}var qo=e=>e.id;function If(e,t,n=qo){return e.find(s=>n(s)===t)}function Tf(e,t,n=qo){const s=If(e,t,n);return s?e.indexOf(s):-1}function Cf(e,t){const{rootEl:n,...s}=t||{};!e||!n||wf(n)&&e.scrollIntoView(s)}var _i,kf=()=>_i??(_i=new Intl.Collator(void 0,{usage:"search",sensitivity:"base"})),Af=e=>e.normalize("NFC").trim(),Lf=e=>Af(e.dataset?.valuetext??e.textContent??""),Of=(e,t)=>{const n=t.normalize("NFC");return kf().compare(e.slice(0,n.length),n)===0};function Mf(e,t,n,s=qo){const r=n?Tf(e,n,s):-1;let o=n?yu(e,r):e;return t.length===1&&(o=o.filter(a=>s(a)!==n)),o.find(a=>Of(Lf(a),t))}function Df(e,t){if(!e)return qs;const n=Object.keys(t).reduce((s,r)=>(s[r]=e.style.getPropertyValue(r),s),{});return Rf(n,t)?qs:(Object.assign(e.style,t),()=>{Object.assign(e.style,n),e.style.length===0&&e.removeAttribute("style")})}function Rf(e,t){return Object.keys(e).every(n=>e[n]===t[n])}function Pf(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 h=e.slice();const u=Mf(h,c,s,i);function f(){clearTimeout(n.timer),n.timer=-1}function p(g){n.keysSoFar=g,f(),g!==""&&(n.timer=+setTimeout(()=>{p(""),f()},o))}return p(a),u}var ao=Object.assign(Pf,{defaultOptions:{keysSoFar:"",timer:-1},isValidEvent:Vf});function Vf(e){return e.key.length===1&&!e.ctrlKey&&!e.metaKey}var Nf={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 Ff(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 Hf(e,t){const{timeout:n,rootNode:s}=t,r=me(s),o=Me(s),i=new r.AbortController;let a;const l=Ff(new Promise(h=>{const u=e();if(u){h(u);return}a=new r.MutationObserver(()=>{const f=e();f&&f.isConnected&&(a?.disconnect(),h(f))}),a.observe(o.body,{childList:!0,subtree:!0})}),i,n),c=()=>a?.disconnect();return l[0].then(c,c),l}var _f=pf({});function Bf(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 h=i();if(h){l(h);return}let u=!1;const f=m=>{c||u||(u=!0,g(),d(),l(m))},p=o?.(),g=p?_f.observe(p,()=>{const m=i();m&&f(m)}):qs,d=he(()=>f(i()));a.push(g,d)})}return()=>{a.forEach(c=>c?.())}}function jf(e){return!(e.metaKey||!Bo()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}var Wf=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),Uf=["a[href]","audio[controls]","button","details","embed","iframe","img[controls]","img[usemap]","input","select","textarea","video[controls]"].join(",");function qf(e,t,n){const s=n?ft(n):null,r=Me(s),o=me(s),i=cr(r);return e=e||i instanceof o.HTMLInputElement&&!Wf.has(i?.type)||i instanceof o.HTMLTextAreaElement||i instanceof o.HTMLElement&&i.isContentEditable,!(e&&t==="keyboard"&&n instanceof o.KeyboardEvent&&!Reflect.has(Yf,n.key))}var ht=null,co=new Set,Gs=new Map,Bt=!1,St=null,lo=!1,Dr=null,Gf=!1,Yf={Tab:!0,Escape:!0};function dr(e,t){for(let n of co)n(e,t)}function Ys(e){St=null,Bt=!0,jf(e)&&(ht="keyboard",dr("keyboard",e))}function Ce(e){(e.type==="pointermove"||e.type==="mousemove")&&e.isTrusted&&Dr?.x===e.clientX&&Dr?.y===e.clientY||(Dr={x:e.clientX,y:e.clientY},ht="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(St=null,Bt=!0,dr("pointer",e)))}function bc(e){if(Gu(e)){St=null,Bt=!0,ht="virtual";return}St=null;const t=ft(e),n=t?.closest("label"),s=n?.control;if(!n||!s||s.matches(":disabled"))return;const r=t?.closest(Uf);r&&n.contains(r)&&r!==s||s!==cr(n.ownerDocument)&&(St=s)}function wc(e){const t=ft(e),n=t===St;t===me(t)||t===Me(t)||Gf||!e.isTrusted||(!Bt&&!n&&!lo&&(ht="virtual",dr("virtual",e)),Bt=!1,St=null,lo=!1)}function Ec(){Bt=!1,St=null,lo=!0}function Kf(e){try{return e.focus}catch{return}}function zf(e){const t=e.HTMLElement.prototype;try{let s=function(){Bt=!0,(r??i.call(this)).apply(this,arguments)};var n=s;const r=Kf(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 Zf(e){if(typeof window>"u"||Gs.get(me(e)))return;const t=me(e),n=Me(e),s=zf(t);n.addEventListener("keydown",Ys,!0),n.addEventListener("keyup",Ys,!0),n.addEventListener("click",bc,!0),t.addEventListener("focus",wc,!0),t.addEventListener("blur",Ec,!1),typeof t.PointerEvent<"u"?(n.addEventListener("pointerdown",Ce,!0),n.addEventListener("pointermove",Ce,!0),n.addEventListener("pointerup",Ce,!0)):(n.addEventListener("mousedown",Ce,!0),n.addEventListener("mousemove",Ce,!0),n.addEventListener("mouseup",Ce,!0)),t.addEventListener("beforeunload",()=>{Jf(e)},{once:!0}),Gs.set(t,s)}var Jf=(e,t)=>{const n=me(e),s=Me(e),r=Gs.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",Ys,!0),s.removeEventListener("keyup",Ys,!0),s.removeEventListener("click",bc,!0),n.removeEventListener("focus",wc,!0),n.removeEventListener("blur",Ec,!1),typeof n.PointerEvent<"u"?(s.removeEventListener("pointerdown",Ce,!0),s.removeEventListener("pointermove",Ce,!0),s.removeEventListener("pointerup",Ce,!0)):(s.removeEventListener("mousedown",Ce,!0),s.removeEventListener("mousemove",Ce,!0),s.removeEventListener("mouseup",Ce,!0)),Gs.delete(n)}};function uo(){return ht}function Xf(e){ht=e,dr(e,null)}function Bi(){return ht==="keyboard"||ht==="virtual"}function Qf(e={}){const{isTextInput:t,autoFocus:n,onChange:s,root:r}=e;Zf(r),s?.({isFocusVisible:n||Bi(),modality:ht});const o=(i,a)=>{qf(!!t,i,a)&&s?.({isFocusVisible:Bi(),modality:i})};return co.add(o),()=>{co.delete(o)}}const eh=["top","right","bottom","left"],Tt=Math.min,st=Math.max,Ks=Math.round,ps=Math.floor,rt=e=>({x:e,y:e}),th={left:"right",right:"left",bottom:"top",top:"bottom"};function xc(e,t,n){return st(e,Tt(t,n))}function pt(e,t){return typeof e=="function"?e(t):e}function Ct(e){return e.split("-")[0]}function wn(e){return e.split("-")[1]}function Go(e){return e==="x"?"y":"x"}function Yo(e){return e==="y"?"height":"width"}function Be(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Ko(e){return Go(Be(e))}function nh(e,t,n){n===void 0&&(n=!1);const s=wn(e),r=Ko(e),o=Yo(r);let i=r==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=zs(i)),[i,zs(i)]}function sh(e){const t=zs(e);return[fo(e),t,fo(t)]}function fo(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const ji=["left","right"],Wi=["right","left"],rh=["top","bottom"],oh=["bottom","top"];function ih(e,t,n){switch(e){case"top":case"bottom":return n?t?Wi:ji:t?ji:Wi;case"left":case"right":return t?rh:oh;default:return[]}}function ah(e,t,n,s){const r=wn(e);let o=ih(Ct(e),n==="start",s);return r&&(o=o.map(i=>i+"-"+r),t&&(o=o.concat(o.map(fo)))),o}function zs(e){const t=Ct(e);return th[t]+e.slice(t.length)}function ch(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 Sc(e){return typeof e!="number"?ch(e):{top:e,right:e,bottom:e,left:e}}function Zs(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 Ui(e,t,n){let{reference:s,floating:r}=e;const o=Be(t),i=Ko(t),a=Yo(i),l=Ct(t),c=o==="y",h=s.x+s.width/2-r.width/2,u=s.y+s.height/2-r.height/2,f=s[a]/2-r[a]/2;let p;switch(l){case"top":p={x:h,y:s.y-r.height};break;case"bottom":p={x:h,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]+=f*(g==="end"?1:-1)*(n&&c?-1:1)),p}async function lh(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:h="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=pt(t,e),g=Sc(p),m=a[f?u==="floating"?"reference":"floating":u],y=Zs(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:h,strategy:l})),T=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)),L=await(o.isElement==null?void 0:o.isElement(E))&&await(o.getScale==null?void 0:o.getScale(E))||{x:1,y:1},x=Zs(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:T,offsetParent:E,strategy:l}):T);return{top:(y.top-x.top+g.top)/L.y,bottom:(x.bottom-y.bottom+g.bottom)/L.y,left:(y.left-x.left+g.left)/L.x,right:(x.right-y.right+g.right)/L.x}}const dh=50,uh=async(e,t,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:o=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:lh},l=await(i.isRTL==null?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:h,y:u}=Ui(c,s,l),f=s,p=0;const g={};for(let d=0;d<o.length;d++){const m=o[d];if(!m)continue;const{name:y,fn:T}=m,{x:E,y:L,data:x,reset:A}=await T({x:h,y:u,initialPlacement:s,placement:f,strategy:r,middlewareData:g,rects:c,platform:a,elements:{reference:e,floating:t}});h=E??h,u=L??u,g[y]={...g[y],...x},A&&p<dh&&(p++,typeof A=="object"&&(A.placement&&(f=A.placement),A.rects&&(c=A.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):A.rects),{x:h,y:u}=Ui(c,f,l)),d=-1)}return{x:h,y:u,placement:f,strategy:r,middlewareData:g}},fh=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:h=0}=pt(e,t)||{};if(c==null)return{};const u=Sc(h),f={x:n,y:s},p=Ko(r),g=Yo(p),d=await i.getDimensions(c),m=p==="y",y=m?"top":"left",T=m?"bottom":"right",E=m?"clientHeight":"clientWidth",L=o.reference[g]+o.reference[p]-f[p]-o.floating[g],x=f[p]-o.reference[p],A=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c));let b=A?A[E]:0;(!b||!await(i.isElement==null?void 0:i.isElement(A)))&&(b=a.floating[E]||o.floating[g]);const S=L/2-x/2,D=b/2-d[g]/2-1,M=Tt(u[y],D),w=Tt(u[T],D),O=b-d[g]-w,R=b/2-d[g]/2+S,V=xc(M,R,O),H=!l.arrow&&wn(r)!=null&&R!==V&&o.reference[g]/2-(R<M?M:w)-d[g]/2<0,K=H?R<M?R-M:R-O:0;return{[p]:f[p]+K,data:{[p]:V,centerOffset:R-V-K,...H&&{alignmentOffset:K}},reset:H}}}),hh=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:h=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:d=!0,...m}=pt(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const y=Ct(r),T=Be(a),E=Ct(a)===a,L=await(l.isRTL==null?void 0:l.isRTL(c.floating)),x=f||(E||!d?[zs(a)]:sh(a)),A=g!=="none";!f&&A&&x.push(...ah(a,d,g,L));const b=[a,...x],S=await l.detectOverflow(t,m),D=[];let M=((s=o.flip)==null?void 0:s.overflows)||[];if(h&&D.push(S[y]),u){const V=nh(r,i,L);D.push(S[V[0]],S[V[1]])}if(M=[...M,{placement:r,overflows:D}],!D.every(V=>V<=0)){var w,O;const V=(((w=o.flip)==null?void 0:w.index)||0)+1,H=b[V];if(H&&(!(u==="alignment"?T!==Be(H):!1)||M.every(z=>Be(z.placement)===T?z.overflows[0]>0:!0)))return{data:{index:V,overflows:M},reset:{placement:H}};let K=(O=M.filter(re=>re.overflows[0]<=0).sort((re,z)=>re.overflows[1]-z.overflows[1])[0])==null?void 0:O.placement;if(!K)switch(p){case"bestFit":{var R;const re=(R=M.filter(z=>{if(A){const j=Be(z.placement);return j===T||j==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(j=>j>0).reduce((j,be)=>j+be,0)]).sort((z,j)=>z[1]-j[1])[0])==null?void 0:R[0];re&&(K=re);break}case"initialPlacement":K=a;break}if(r!==K)return{reset:{placement:K}}}return{}}}};function qi(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Gi(e){return eh.some(t=>e[t]>=0)}const ph=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:r="referenceHidden",...o}=pt(e,t);switch(r){case"referenceHidden":{const i=await s.detectOverflow(t,{...o,elementContext:"reference"}),a=qi(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Gi(a)}}}case"escaped":{const i=await s.detectOverflow(t,{...o,altBoundary:!0}),a=qi(i,n.floating);return{data:{escapedOffsets:a,escaped:Gi(a)}}}default:return{}}}}},$c=new Set(["left","top"]);async function gh(e,t){const{placement:n,platform:s,elements:r}=e,o=await(s.isRTL==null?void 0:s.isRTL(r.floating)),i=Ct(n),a=wn(n),l=Be(n)==="y",c=$c.has(i)?-1:1,h=o&&l?-1:1,u=pt(t,e);let{mainAxis:f,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*h,y:f*c}:{x:f*c,y:p*h}}const mh=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 gh(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}}}}},vh=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:T=>{let{x:E,y:L}=T;return{x:E,y:L}}},...c}=pt(e,t),h={x:n,y:s},u=await o.detectOverflow(t,c),f=Be(r),p=Go(f);let g=h[p],d=h[f];const m=(T,E)=>xc(E+u[T==="y"?"top":"left"],E,E-u[T==="y"?"bottom":"right"]);i&&(g=m(p,g)),a&&(d=m(f,d));const y=l.fn({...t,[p]:g,[f]:d});return{...y,data:{x:y.x-n,y:y.y-s,enabled:{[p]:i,[f]:a}}}}}},yh=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:h=!0,crossAxis:u=!0}=pt(e,t),f={x:r,y:o},p=Be(i),g=Go(p);let d=f[g],m=f[p];const y=pt(c,t),T=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:(n=y.mainAxis)!=null?n:0,crossAxis:(s=y.crossAxis)!=null?s:0};if(h){const x=g==="y"?"height":"width",A=a.reference[g]-a.floating[x]+T.mainAxis,b=a.reference[g]+a.reference[x]-T.mainAxis;d<A?d=A:d>b&&(d=b)}if(u){var E,L;const x=g==="y"?"width":"height",A=$c.has(Ct(i)),b=a.reference[p]-a.floating[x]+(A&&((E=l.offset)==null?void 0:E[p])||0)+(A?0:T.crossAxis),S=a.reference[p]+a.reference[x]+(A?0:((L=l.offset)==null?void 0:L[p])||0)-(A?T.crossAxis:0);m<b?m=b:m>S&&(m=S)}return{[g]:d,[p]:m}}}},bh=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:s,platform:r,elements:o}=t,{apply:i=()=>{},...a}=pt(e,t),l=await r.detectOverflow(t,a),c=Ct(n),h=wn(n),u=Be(n)==="y",{width:f,height:p}=s.floating;let g,d;c==="top"||c==="bottom"?(g=c,d=h===(await(r.isRTL==null?void 0:r.isRTL(o.floating))?"start":"end")?"left":"right"):(d=c,g=h==="end"?"top":"bottom");const m=p-l.top-l.bottom,y=f-l.left-l.right,T=Tt(p-l[g],m),E=Tt(f-l[d],y),L=t.middlewareData.shift,x=!L;let A=T,b=E;L!=null&&L.enabled.x&&(b=y),L!=null&&L.enabled.y&&(A=m),x&&!h&&(u?b=f-2*st(l.left,l.right):A=p-2*st(l.top,l.bottom)),await i({...t,availableWidth:b,availableHeight:A});const S=await r.getDimensions(o.floating);return f!==S.width||p!==S.height?{reset:{rects:!0}}:{}}}};function ur(){return typeof window<"u"}function En(e){return Ic(e)?(e.nodeName||"").toLowerCase():"#document"}function Ee(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function vt(e){var t;return(t=(Ic(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ic(e){return ur()?e instanceof Node||e instanceof Ee(e).Node:!1}function qe(e){return ur()?e instanceof Element||e instanceof Ee(e).Element:!1}function At(e){return ur()?e instanceof HTMLElement||e instanceof Ee(e).HTMLElement:!1}function Yi(e){return!ur()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ee(e).ShadowRoot}function fr(e){const{overflow:t,overflowX:n,overflowY:s,display:r}=Ge(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&r!=="inline"&&r!=="contents"}function wh(e){return/^(table|td|th)$/.test(En(e))}function hr(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Eh=/transform|translate|scale|rotate|perspective|filter/,xh=/paint|layout|strict|content/,Pt=e=>!!e&&e!=="none";let Rr;function zo(e){const t=qe(e)?Ge(e):e;return Pt(t.transform)||Pt(t.translate)||Pt(t.scale)||Pt(t.rotate)||Pt(t.perspective)||!Zo()&&(Pt(t.backdropFilter)||Pt(t.filter))||Eh.test(t.willChange||"")||xh.test(t.contain||"")}function Sh(e){let t=jt(e);for(;At(t)&&!zn(t);){if(zo(t))return t;if(hr(t))return null;t=jt(t)}return null}function Zo(){return Rr==null&&(Rr=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Rr}function zn(e){return/^(html|body|#document)$/.test(En(e))}function Ge(e){return Ee(e).getComputedStyle(e)}function pr(e){return qe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function jt(e){if(En(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Yi(e)&&e.host||vt(e);return Yi(t)?t.host:t}function Tc(e){const t=jt(e);return zn(t)?(e.ownerDocument||e).body:At(t)&&fr(t)?t:Tc(t)}function Zn(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=Tc(e),o=r===((s=e.ownerDocument)==null?void 0:s.body),i=Ee(r);if(o){const a=ho(i);return t.concat(i,i.visualViewport||[],fr(r)?r:[],a&&n?Zn(a):[])}else return t.concat(r,Zn(r,[],n))}function ho(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Cc(e){const t=Ge(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const r=At(e),o=r?e.offsetWidth:n,i=r?e.offsetHeight:s,a=Ks(n)!==o||Ks(s)!==i;return a&&(n=o,s=i),{width:n,height:s,$:a}}function Jo(e){return qe(e)?e:e.contextElement}function an(e){const t=Jo(e);if(!At(t))return rt(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:o}=Cc(t);let i=(o?Ks(n.width):n.width)/s,a=(o?Ks(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const $h=rt(0);function kc(e){const t=Ee(e);return!Zo()||!t.visualViewport?$h:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ih(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Ee(e)}function Wt(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=Jo(e);let i=rt(1);t&&(s?qe(s)&&(i=an(s)):i=an(e));const a=Ih(o,n,s)?kc(o):rt(0);let l=(r.left+a.x)/i.x,c=(r.top+a.y)/i.y,h=r.width/i.x,u=r.height/i.y;if(o&&s){const f=Ee(o),p=qe(s)?Ee(s):s;let g=f,d=ho(g);for(;d&&p!==g;){const m=an(d),y=d.getBoundingClientRect(),T=Ge(d),E=y.left+(d.clientLeft+parseFloat(T.paddingLeft))*m.x,L=y.top+(d.clientTop+parseFloat(T.paddingTop))*m.y;l*=m.x,c*=m.y,h*=m.x,u*=m.y,l+=E,c+=L,g=Ee(d),d=ho(g)}}return Zs({width:h,height:u,x:l,y:c})}function gr(e,t){const n=pr(e).scrollLeft;return t?t.left+n:Wt(vt(e)).left+n}function Ac(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-gr(e,n),r=n.top+t.scrollTop;return{x:s,y:r}}function Th(e){let{elements:t,rect:n,offsetParent:s,strategy:r}=e;const o=r==="fixed",i=vt(s),a=t?hr(t.floating):!1;if(s===i||a&&o)return n;let l={scrollLeft:0,scrollTop:0},c=rt(1);const h=rt(0),u=At(s);if((u||!o)&&((En(s)!=="body"||fr(i))&&(l=pr(s)),u)){const p=Wt(s);c=an(s),h.x=p.x+s.clientLeft,h.y=p.y+s.clientTop}const f=i&&!u&&!o?Ac(i,l):rt(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+h.x+f.x,y:n.y*c.y-l.scrollTop*c.y+h.y+f.y}}function Ch(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function kh(e){const t=pr(e),n=e.ownerDocument.body,s=st(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=st(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let o=-t.scrollLeft+gr(e);const i=-t.scrollTop;return Ge(n).direction==="rtl"&&(o+=st(e.clientWidth,n.clientWidth)-s),{width:s,height:r,x:o,y:i}}const Ah=25;function Lh(e,t,n){n===void 0&&(n="viewport");const s=n==="layoutViewport",r=Ee(e),o=vt(e),i=r.visualViewport;let a=o.clientWidth,l=o.clientHeight,c=0,h=0;if(i){const f=!Zo()||t==="fixed";s?f||(c=-i.offsetLeft,h=-i.offsetTop):(a=i.width,l=i.height,f&&(c=i.offsetLeft,h=i.offsetTop))}if(gr(o)<=0){const f=o.ownerDocument,p=f.body,g=getComputedStyle(p),d=f.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<=Ah&&(a-=y)}return{width:a,height:l,x:c,y:h}}function Oh(e,t){const n=Wt(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 Ki(e,t,n){let s;if(t==="viewport"||t==="layoutViewport")s=Lh(e,n,t);else if(t==="document")s=kh(vt(e));else if(qe(t))s=Oh(t,n);else{const r=kc(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Zs(s)}function Mh(e,t){const n=t.get(e);if(n)return n;let s=Zn(e,[],!1).filter(a=>qe(a)&&En(a)!=="body"),r=null;const o=Ge(e).position==="fixed";let i=o?jt(e):e;for(;qe(i)&&!zn(i);){const a=Ge(i),l=zo(i),c=r?r.position:o?"fixed":"";!l&&(c==="fixed"||c==="absolute"&&a.position==="static")?s=s.filter(u=>u!==i):r=a,i=jt(i)}return t.set(e,s),s}function Dh(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const i=[...n==="clippingAncestors"?hr(t)?[]:Mh(t,this._c):[].concat(n),s],a=Ki(t,i[0],r);let l=a.top,c=a.right,h=a.bottom,u=a.left;for(let f=1;f<i.length;f++){const p=Ki(t,i[f],r);l=st(p.top,l),c=Tt(p.right,c),h=Tt(p.bottom,h),u=st(p.left,u)}return{width:c-u,height:h-l,x:u,y:l}}function Rh(e){const{width:t,height:n}=Cc(e);return{width:t,height:n}}function Ph(e,t,n){const s=At(t),r=vt(t),o=n==="fixed",i=Wt(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=rt(0);if((s||!o)&&((En(t)!=="body"||fr(r))&&(a=pr(t)),s)){const f=Wt(t,!0,o,t);l.x=f.x+t.clientLeft,l.y=f.y+t.clientTop}!s&&r&&(l.x=gr(r));const c=r&&!s&&!o?Ac(r,a):rt(0),h=i.left+a.scrollLeft-l.x-c.x,u=i.top+a.scrollTop-l.y-c.y;return{x:h,y:u,width:i.width,height:i.height}}function Pr(e){return Ge(e).position==="static"}function zi(e,t){if(!At(e)||Ge(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return vt(e)===n&&(n=n.ownerDocument.body),n}function Lc(e,t){const n=Ee(e);if(hr(e))return n;if(!At(e)){let r=jt(e);for(;r&&!zn(r);){if(qe(r)&&!Pr(r))return r;r=jt(r)}return n}let s=zi(e,t);for(;s&&wh(s)&&Pr(s);)s=zi(s,t);return s&&zn(s)&&Pr(s)&&!zo(s)?n:s||Sh(e)||n}const Vh=async function(e){const t=this.getOffsetParent||Lc,n=this.getDimensions,s=await n(e.floating);return{reference:Ph(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function Nh(e){return Ge(e).direction==="rtl"}const Fh={convertOffsetParentRelativeRectToViewportRelativeRect:Th,getDocumentElement:vt,getClippingRect:Dh,getOffsetParent:Lc,getElementRects:Vh,getClientRects:Ch,getDimensions:Rh,getScale:an,isElement:qe,isRTL:Nh};function Oc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Hh(e,t,n){let s=null,r;const o=vt(e);function i(){var h;clearTimeout(r),(h=s)==null||h.disconnect(),s=null}function a(h,u){h===void 0&&(h=!1),u===void 0&&(u=1),i();const f=e.getBoundingClientRect(),{left:p,top:g,width:d,height:m}=f;if(h||t(),!d||!m)return;const y=ps(g),T=ps(o.clientWidth-(p+d)),E=ps(o.clientHeight-(g+m)),L=ps(p),A={rootMargin:-y+"px "+-T+"px "+-E+"px "+-L+"px",threshold:st(0,Tt(1,u))||1};let b=!0;function S(D){const M=D[0].intersectionRatio;if(!Oc(f,e.getBoundingClientRect()))return a();if(M!==u){if(!b)return a();M?a(!1,M):r=setTimeout(()=>{a(!1,1e-7)},1e3)}b=!1}try{s=new IntersectionObserver(S,{...A,root:o.ownerDocument})}catch{s=new IntersectionObserver(S,A)}s.observe(e)}const l=Ee(e),c=()=>a(n);return l.addEventListener("resize",c),a(!0),()=>{l.removeEventListener("resize",c),i()}}function _h(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=Jo(e),h=r||o?[...c?Zn(c):[],...t?Zn(t):[]]:[];h.forEach(y=>{r&&y.addEventListener("scroll",n),o&&y.addEventListener("resize",n)});const u=c&&a?Hh(c,n,o):null;let f=-1,p=null;i&&(p=new ResizeObserver(y=>{let[T]=y;T&&T.target===c&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var E;(E=p)==null||E.observe(t)})),n()}),c&&!l&&p.observe(c),t&&p.observe(t));let g,d=l?Wt(e):null;l&&m();function m(){const y=Wt(e);d&&!Oc(d,y)&&n(),d=y,g=requestAnimationFrame(m)}return n(),()=>{var y;h.forEach(T=>{r&&T.removeEventListener("scroll",n),o&&T.removeEventListener("resize",n)}),u?.(),(y=p)==null||y.disconnect(),p=null,l&&cancelAnimationFrame(g)}}const Bh=mh,jh=vh,Wh=hh,Uh=bh,qh=ph,Gh=fh,Yh=yh,Kh=(e,t,n)=>{const s=new Map,r=n??{},o={...Fh,...r.platform,_c:s};return uh(e,t,{...r,platform:o})};function Zi(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 zh(e){if(!e)return Zi();const{x:t,y:n,width:s,height:r}=e;return Zi(t,n,s,r)}function Zh(e,t){return{contextElement:ue(e)?e:e?.contextElement,getBoundingClientRect:()=>{const n=e,s=t?.(n);return s||!n?zh(s):n.getBoundingClientRect()}}}var An=e=>({variable:e,reference:`var(${e})`}),Xe={arrowSize:An("--arrow-size"),arrowSizeHalf:An("--arrow-size-half"),arrowBg:An("--arrow-background"),transformOrigin:An("--transform-origin"),arrowOffset:An("--arrow-offset")},Jh=e=>e==="top"||e==="bottom"?"y":"x";function Xh(e,t){return{name:"transformOrigin",fn(n){const{elements:s,middlewareData:r,placement:o,rects:i,y:a}=n,l=o.split("-")[0],c=Jh(l),h=r.arrow?.x||0,u=r.arrow?.y||0,f=t?.clientWidth||0,p=t?.clientHeight||0,g=h+f/2,d=u+p/2,m=Math.abs(r.shift?.y||0),y=i.reference.height/2,T=p/2,E=e.offset?.mainAxis??e.gutter,L=typeof E=="number"?E+T:E??T,x=m>L,A={top:`${g}px calc(100% + ${L}px)`,bottom:`${g}px ${-L}px`,left:`calc(100% + ${L}px) ${d}px`,right:`${-L}px ${d}px`}[l],b=`${g}px ${i.reference.y+y-a}px`,S=!!e.overlap&&c==="y"&&x;return s.floating.style.setProperty(Xe.transformOrigin.variable,S?b:A),{data:{transformOrigin:S?b:A}}}}}var Qh={name:"rects",fn({rects:e}){return{data:e}}},ep=e=>{if(e)return{name:"shiftArrow",fn({placement:t,middlewareData:n}){if(!n.arrow)return{};const{x:s,y:r}=n.arrow,o=t.split("-")[0];return Object.assign(e.style,{left:s!=null?`${s}px`:"",top:r!=null?`${r}px`:"",[o]:`calc(100% + ${Xe.arrowOffset.reference})`}),{}}}};function tp(e){const[t,n]=e.split("-");return{side:t,align:n,hasAlign:n!=null}}function Mc(e){return e.split("-")[0]}var np={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 Ji(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 mr(e){return typeof e=="function"?e():e==="clipping-ancestors"?"clippingAncestors":e}function sp(e,t,n){const s=e||t.createElement("div");return Gh({element:s,padding:n.arrowPadding})}function rp(e,t){if(!su(t.offset??t.gutter))return Bh(({placement:n})=>{const s=(e?.clientHeight||0)/2,r=t.offset?.mainAxis??t.gutter,o=typeof r=="number"?r+s:r??s,{hasAlign:i}=tp(n),a=i?void 0:t.shift,l=t.offset?.crossAxis??a;return No({crossAxis:l,mainAxis:o,alignmentAxis:t.shift})})}function op(e){if(e.flip)return Wh(()=>{const t=mr(e.boundary);return{...t?{boundary:t}:void 0,padding:e.overflowPadding,fallbackPlacements:e.flip===!0?void 0:e.flip}})}function ip(e){if(!(!e.slide&&!e.overlap))return jh(()=>{const t=mr(e.boundary);return{...t?{boundary:t}:void 0,mainAxis:e.slide,crossAxis:e.overlap,padding:e.overflowPadding,limiter:Yh()}})}function ap(e){if(e.sizeMiddleware===!1&&!e.sameWidth&&!e.fitViewport)return;let t,n,s,r;return Uh(()=>{const o=mr(e.boundary);return{padding:e.overflowPadding,...o?{boundary:o}:void 0,apply({elements:i,rects:a,availableHeight:l,availableWidth:c}){const h=i.floating,u=Math.round(a.reference.width),f=Math.round(a.reference.height);c=Math.floor(c),l=Math.floor(l),on(t,u)||(h.style.setProperty("--reference-width",`${u}px`),t=u),on(n,f)||(h.style.setProperty("--reference-height",`${f}px`),n=f),on(s,c)||(h.style.setProperty("--available-width",`${c}px`),s=c),on(r,l)||(h.style.setProperty("--available-height",`${l}px`),r=l)}}})}function cp(e){if(e.hideWhenDetached)return qh(()=>({strategy:"referenceHidden",boundary:mr(e.boundary)??"clippingAncestors"}))}function lp(e){return e?e===!0?{ancestorResize:!0,ancestorScroll:!0,elementResize:!0,layoutShift:!0}:e:{}}var dp=["transform","visibility","pointer-events","--x","--y","--z-index","z-index","--reference-width","--reference-height","--available-width","--available-height","--transform-origin"],up=["top","right","bottom","left"],Hn=new WeakSet;function fp(e,t){const n=e.style.getPropertyValue("z-index"),s=Hn.has(e),r=s&&n==="var(--z-index)";s&&!r&&Hn.delete(e);const o=uc(t).zIndex;if(o==="auto"){r&&(e.style.removeProperty("z-index"),Hn.delete(e));return}n&&!r||(e.style.setProperty("--z-index",o),e.style.setProperty("z-index","var(--z-index)"),Hn.add(e))}function Xi(e,t){if(!e)return tc;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 Qi(e){return e==null?null:ue(e)?e:typeof e=="object"&&e&&"contextElement"in e&&e.contextElement?e.contextElement:e}function hp(e,t,n={}){const s=()=>(typeof t=="function"?t():t)??null,r=()=>{const M=typeof e=="function"?e():e;return n.getAnchorElement?.()??M},o=()=>{const M=r();return!M&&!n.getAnchorRect?null:Zh(M,n.getAnchorRect)},i=Object.assign({},np,n);let a=[],l=null,c,h;function u(M){if(c?.(),h?.(),l=M,i.restoreStyles){const O=Xi(M,dp);c=()=>{O(),Hn.delete(M)}}else c=void 0;const w=M.querySelector("[data-part=arrow]");h=i.restoreStyles?Xi(w,up):void 0,a=[rp(w,i),op(i),ip(i),sp(w,M.ownerDocument,i),ep(w),Xh({gutter:i.gutter,offset:i.offset,overlap:i.overlap},w),ap(i),cp(i),Qh]}const{placement:f,strategy:p,onComplete:g,onPositioned:d}=i;let m,y,T=!1,E,L,x=tc;const A=lp(i.listeners);function b(){if(!i.listeners)return;const M=r(),w=o(),O=s();if(!w||!O)return;(Qi(M)!==Qi(E)||O!==L)&&(x(),E=M,L=O,x=_h(w,O,D,A))}async function S(){b();const M=s();if(!M)return;M!==l&&(u(M),T=!1);const w=o();if(!w)return;const O=await Kh(w,M,{placement:f,middleware:a,strategy:p}),R=me(M),V=Ji(R,O.x),H=Ji(R,O.y);if(g?.({...O,x:V,y:H}),i.applyStyles!==!1&&(on(m,V)||(M.style.setProperty("--x",`${V}px`),m=V),on(y,H)||(M.style.setProperty("--y",`${H}px`),y=H),i.hideWhenDetached&&(O.middlewareData.hide?.referenceHidden?(M.style.setProperty("visibility","hidden"),M.style.setProperty("pointer-events","none")):(M.style.removeProperty("visibility"),M.style.removeProperty("pointer-events"))),!T)){const K=M.firstElementChild;K&&(fp(M,K),T=!0)}}async function D(){n.updatePosition?(await n.updatePosition({updatePosition:S,floatingElement:s()}),d?.({placed:!0})):await S()}return D(),()=>{x(),h?.(),c?.(),d?.({placed:!1})}}function po(e,t,n={}){const{defer:s,...r}=n,o=s?he:a=>a(),i=[];return i.push(o(()=>{i.push(hp(e,t,r))})),()=>{i.forEach(a=>a?.())}}var pp={bottom:"rotate(45deg)",left:"rotate(135deg)",top:"rotate(225deg)",right:"rotate(315deg)"};function Dc(e={}){const{placement:t,sameWidth:n,fitViewport:s,strategy:r="absolute",applyStyles:o=!0}=e;return{arrow:{position:"absolute",width:Xe.arrowSize.reference,height:Xe.arrowSize.reference,[Xe.arrowSizeHalf.variable]:`calc(${Xe.arrowSize.reference} / 2)`,[Xe.arrowOffset.variable]:`calc(${Xe.arrowSizeHalf.reference} * -1)`},arrowTip:{transform:t?pp[t.split("-")[0]]:void 0,background:Xe.arrowBg.reference,top:"0",left:"0",width:"100%",height:"100%",position:"absolute",zIndex:"inherit"},floating:{position:r,isolation:"isolate",minWidth:n?void 0:"max-content",width:n?"var(--reference-width)":void 0,maxWidth:s?"var(--available-width)":void 0,maxHeight:s?"var(--available-height)":void 0,pointerEvents:t?void 0:"none",top:"0px",left:"0px",transform:t?"translate3d(var(--x, 0), var(--y, -100vh), 0)":"translate3d(0, -100vh, 0)",zIndex:o===!1?"var(--z-index)":void 0}}}var gp=e=>e.ids?.root??`select:${e.id}`,go=e=>e.ids?.content??`select:${e.id}:content`,mo=e=>e.ids?.trigger??`select:${e.id}:trigger`,Rc=e=>e.ids?.clearTrigger??`select:${e.id}:clear-trigger`,gs=e=>e.ids?.label??`select:${e.id}:label`,mp=e=>e.ids?.control??`select:${e.id}:control`,vo=(e,t)=>e.ids?.item?.(t)??`select:${e.id}:option:${t}`,yo=e=>e.ids?.hiddenSelect??`select:${e.id}:select`,Pc=e=>e.ids?.positioner??`select:${e.id}:positioner`,vp=(e,t)=>e.ids?.itemGroup?.(t)??`select:${e.id}:optgroup:${t}`,ea=(e,t)=>e.ids?.itemGroupLabel?.(t)??`select:${e.id}:optgroup-label:${t}`,Vr=e=>e.getById(yo(e)),Ln=e=>e.getById(go(e)),Ht=e=>e.getById(mo(e)),yp=e=>e.getById(Rc(e)),Nr=e=>e.getById(Pc(e)),Fr=(e,t)=>t==null?null:e.getById(vo(e,t)),bp={clearTriggerLabel:"Clear value"};function wp(e,t){const{context:n,prop:s,scope:r,state:o,computed:i,send:a}=e,l=sc(bp,s("translations")),c=s("disabled")||n.get("fieldsetDisabled"),h=!!s("invalid"),u=!!s("required"),f=!!s("readOnly"),p=s("composite"),g=s("collection"),d=o.hasTag("open"),m=o.matches("focused"),y=n.get("highlightedValue"),T=n.get("highlightedItem"),E=i("selectedItems"),L=n.get("currentPlacement"),x=L?Mc(L):void 0,A=i("isTypingAhead"),b=i("isInteractive"),S=y?vo(r,y):void 0;function D(w){const O=g.getItemDisabled(w.item),R=g.getItemValue(w.item);return ir(R,()=>`[zag-js] No value found for item ${JSON.stringify(w.item)}`),{value:R,disabled:!!(c||O),highlighted:y===R,selected:n.get("value").includes(R)}}const M=Dc({...s("positioning"),placement:L});return{open:d,focused:m,empty:n.get("value").length===0,highlightedItem:T,highlightedValue:y,selectedItems:E,hasSelectedItems:i("hasSelectedItems"),value:n.get("value"),valueAsString:i("valueAsString"),collection:g,multiple:!!s("multiple"),disabled:!!c,reposition(w={}){a({type:"POSITIONING.SET",options:w})},focus(){Ht(r)?.focus({preventScroll:!0})},setOpen(w){a({type:w?"OPEN":"CLOSE",replaces:"open"})},selectValue(w){a({type:"ITEM.SELECT",value:w})},setValue(w){a({type:"VALUE.SET",value:w})},selectAll(){a({type:"VALUE.SET",value:g.getValues()})},setHighlightValue(w){a({type:"HIGHLIGHTED_VALUE.SET",value:w})},clearHighlightValue(){a({type:"HIGHLIGHTED_VALUE.CLEAR"})},clearValue(w){a(w?{type:"ITEM.CLEAR",value:w}:{type:"VALUE.CLEAR"})},getItemState:D,getRootProps(){return t.element({...ve.root.attrs,dir:s("dir"),id:gp(r),"data-invalid":P(h),"data-readonly":P(f)})},getLabelProps(){return t.label({dir:s("dir"),id:gs(r),...ve.label.attrs,"data-disabled":P(c),"data-invalid":P(h),"data-readonly":P(f),"data-required":P(u),htmlFor:yo(r),onClick(w){w.defaultPrevented||c||Ht(r)?.focus({preventScroll:!0})}})},getControlProps(){return t.element({...ve.control.attrs,dir:s("dir"),id:mp(r),"data-state":d?"open":"closed","data-focus":P(m),"data-disabled":P(c),"data-invalid":P(h)})},getValueTextProps(){return t.element({...ve.valueText.attrs,dir:s("dir"),"data-disabled":P(c),"data-invalid":P(h),"data-focus":P(m)})},getTriggerProps(){return t.button({id:mo(r),disabled:c,dir:s("dir"),type:"button",role:"combobox","aria-controls":go(r),"aria-expanded":d,"aria-haspopup":"listbox","data-state":d?"open":"closed","aria-invalid":h,"aria-required":u,"aria-labelledby":gs(r),...ve.trigger.attrs,"data-disabled":P(c),"data-invalid":P(h),"data-readonly":P(f),"data-placement":L,"data-side":x,"data-placeholder-shown":P(!i("hasSelectedItems")),onClick(w){b&&(w.defaultPrevented||a({type:"TRIGGER.CLICK"}))},onFocus(){a({type:"TRIGGER.FOCUS"})},onBlur(){a({type:"TRIGGER.BLUR"})},onKeyDown(w){if(w.defaultPrevented||!b)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(A?{type:"TRIGGER.TYPEAHEAD",key:V.key}:{type:"TRIGGER.ENTER"})}}[ro(w,{dir:s("dir"),orientation:"vertical"})];if(R){R(w),w.preventDefault();return}ao.isValidEvent(w)&&(a({type:"TRIGGER.TYPEAHEAD",key:w.key}),w.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(h),"data-readonly":P(f)})},getItemProps(w){const O=D(w);return t.element({id:vo(r,O.value),role:"option",...ve.item.attrs,dir:s("dir"),"data-value":O.value,"aria-selected":O.selected,"data-state":O.selected?"checked":"unchecked","data-highlighted":P(O.highlighted),"data-disabled":P(O.disabled),"aria-disabled":fe(O.disabled),onPointerMove(R){O.disabled||R.pointerType!=="mouse"||uo()==="pointer"&&O.value!==y&&a({type:"ITEM.POINTER_MOVE",value:O.value})},onClick(R){R.defaultPrevented||O.disabled||a({type:"ITEM.CLICK",src:"pointerup",value:O.value})},onPointerLeave(R){O.disabled||w.persistFocus||R.pointerType==="mouse"&&uo()==="pointer"&&a({type:"ITEM.POINTER_LEAVE"})}})},getItemTextProps(w){const O=D(w);return t.element({...ve.itemText.attrs,"data-state":O.selected?"checked":"unchecked","data-disabled":P(O.disabled),"data-highlighted":P(O.highlighted)})},getItemIndicatorProps(w){const O=D(w);return t.element({"aria-hidden":!0,...ve.itemIndicator.attrs,"data-state":O.selected?"checked":"unchecked",hidden:!O.selected})},getItemGroupLabelProps(w){const{htmlFor:O}=w;return t.element({...ve.itemGroupLabel.attrs,id:ea(r,O),dir:s("dir"),role:"presentation"})},getItemGroupProps(w){const{id:O}=w;return t.element({...ve.itemGroup.attrs,"data-disabled":P(c),id:vp(r,O),"aria-labelledby":ea(r,O),role:"group",dir:s("dir")})},getClearTriggerProps(){return t.button({...ve.clearTrigger.attrs,id:Rc(r),type:"button","aria-label":l.clearTriggerLabel,"data-invalid":P(h),disabled:c,hidden:!i("hasSelectedItems"),dir:s("dir"),onClick(w){w.defaultPrevented||a({type:"CLEAR.CLICK"})}})},getHiddenSelectProps(){const w=n.get("value"),O=s("multiple")?w:w?.[0],R=V=>{const H=jo(V);pc(H)||a({type:"VALUE.SET",value:Ep(V.currentTarget)})};return t.select({name:s("name"),form:s("form"),disabled:c,multiple:s("multiple"),required:s("required"),"aria-hidden":!0,id:yo(r),defaultValue:O,style:Nf,tabIndex:-1,autoComplete:s("autoComplete"),onChange:R,onInput:R,onFocus(){Ht(r)?.focus({preventScroll:!0})},"aria-labelledby":gs(r)})},getPositionerProps(){return t.element({...ve.positioner.attrs,dir:s("dir"),id:Pc(r),style:M.floating})},getContentProps(){return t.element({hidden:!d,dir:s("dir"),id:go(r),role:p?"listbox":"dialog",...ve.content.attrs,"data-state":d?"open":"closed","data-placement":L,"data-side":x,"data-activedescendant":S,"aria-activedescendant":p?S:void 0,"aria-multiselectable":s("multiple")&&p?!0:void 0,"aria-labelledby":gs(r),tabIndex:0,onKeyDown(w){if(!b||!hn(w.currentTarget,ft(w)))return;if(w.key==="Tab"&&!ff(w)){w.preventDefault();return}const O={ArrowUp(){a({type:"CONTENT.ARROW_UP"})},ArrowDown(){a({type:"CONTENT.ARROW_DOWN"})},Home(){a({type:"CONTENT.HOME"})},End(){a({type:"CONTENT.END"})},Enter(){a({type:"ITEM.CLICK",src:"keydown.enter"})},Space(H){A?a({type:"CONTENT.TYPEAHEAD",key:H.key}):O.Enter?.()}},R=O[ro(w)];if(R){R(w),w.preventDefault();return}const V=ft(w);Tu(V)||ao.isValidEvent(w)&&(a({type:"CONTENT.TYPEAHEAD",key:w.key}),w.preventDefault())}})},getListProps(){return t.element({...ve.list.attrs,tabIndex:0,role:p?void 0:"listbox","aria-labelledby":mo(r),"aria-activedescendant":p?void 0:S,"aria-multiselectable":!p&&s("multiple")?!0:void 0})}}}var Ep=e=>e.multiple?Array.from(e.selectedOptions,t=>t.value):e.value?[e.value]:[];function xp(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 Sp(){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 Lt=".",Vc="#",ta=new WeakMap,Nc=new WeakMap;function bo(e){return e.join(Lt)}function $p(e){return e.includes(Lt)}function Fc(e){return e.startsWith(Vc)}function Ip(e){return e.startsWith(Lt)}function Tp(e){return Fc(e)?e.slice(Vc.length):e}function wo(e,t){return e?`${e}${Lt}${t}`:t}function Cp(e){const t=new Map,n=new Map,s=(r,o)=>{t.set(r,o);const i=o.id;i&&(n.has(i)&&Pi(`[zag-js] Duplicate state id: "${i}"`),n.set(i,r));const a=o.states;if(a){ir(o.initial,()=>`[zag-js] Compound state "${r}" has child states but no "initial" property`),o.initial in a||Pi(`[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 h=wo(r,l);s(h,c)}}};for(const[r,o]of Object.entries(e.states))o&&s(r,o);return{index:t,idIndex:n}}function ns(e){const t=ta.get(e);if(t)return t;const{index:n,idIndex:s}=Cp(e);return ta.set(e,n),Nc.set(e,s),n}function kp(e,t){return ns(e),Nc.get(e)?.get(t)}function Xo(e){return e?String(e).split(Lt).filter(Boolean):[]}function Js(e,t){if(!t)return[];const n=ns(e),s=Xo(t),r=[],o=[];for(const i of s){o.push(i);const a=bo(o),l=n.get(a);if(!l)break;r.push({path:a,state:l})}return r}function On(e,t){const n=ns(e),s=Xo(t);if(!s.length)return t;const r=[];for(const a of s){r.push(a);const l=bo(r);if(!n.has(l))return t}let o=bo(r),i=n.get(o);for(;i?.initial;){const a=`${o}${Lt}${i.initial}`,l=n.get(a);if(!l)break;o=a,i=l}return o}function na(e,t){return ns(e).has(t)}function sa(e,t,n){const s=String(t);if(Fc(s)){const r=Tp(s),o=kp(e,r);return ir(o,()=>`[zag-js] Unknown state id: "${r}"`),On(e,o)}if(Ip(s)&&n){const r=wo(n,s.slice(1));return On(e,r)}if(!$p(s)&&n){const r=Xo(n);for(let o=r.length-1;o>=1;o--){const i=r.slice(0,o).join(Lt),a=wo(i,s);if(na(e,a))return On(e,a)}if(na(e,s))return On(e,s)}return On(e,s)}function Ap(e,t,n){const s=Js(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 Lp(e,t,n,s){const r=t?Js(e,t):[],o=Js(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 Op(e,t){return e?e===t||e.startsWith(`${t}${Lt}`):!1}function Mp(e,t,n){return Js(e,t).some(s=>s.state.tags?.includes(n))}function Hc(){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 _c(e){return ns(e),e}var _n=(e=>(e.NotStarted="Not Started",e.Started="Started",e.Stopped="Stopped",e))(_n||{}),ms="__init__";function Dp(e){const t=()=>e.getRootNode?.()??document,n=()=>Me(t());return{...e,getRootNode:t,getDoc:n,getWin:()=>n().defaultView??window,getActiveElement:()=>cr(t()),isActiveElement:so,getById:i=>t().getElementById(i)}}function Rp(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 Pp(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 ra="pointerdown.outside",oa="focus.outside";function Vp(e){for(const t of e)if(ue(t)&&lr(t))return!0;return!1}var Bc=e=>"clientY"in e;function Np(e,t){if(!Bc(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 Fp(e,t){return e.y<=t.y&&t.y<=e.y+e.height&&e.x<=t.x&&t.x<=e.x+e.width}function ia(e,t){if(!t||!Bc(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 Fp(i,a)?s||o:!1}function Hp(e,t){const{exclude:n,onFocusOutside:s,onPointerDownOutside:r,onInteractOutside:o,defer:i,followControlledElements:a=!0}=t;if(!e)return;const l=Me(e),c=me(e),h=Rp(c),u=Pp(c);function f(x,A){if(!ue(A)||!A.isConnected||hn(e,A)||Np(e,x)||a&&Wu(e,A))return!1;const b=l.querySelector(`[aria-controls="${e.id}"]`);if(b){const D=oo(b);if(ia(x,D))return!1}const S=oo(e);return ia(x,S)?!1:!n?.(A)}const p=new Set,g=fn(e?.getRootNode());let d=!1;function m(x){d=!0;const A=()=>{d=!1};l.addEventListener("pointerup",A,{once:!0}),c.addEventListener("pointerup",A,{once:!0});function b(S){const D=i&&!Ni()?he:O=>O(),M=S??x,w=M?.composedPath?.()??[M?.target];D(()=>{const O=g?w[0]:ft(x);if(!(!e||!f(x,O))){if(r||o){const R=Ws(r,o);e.addEventListener(ra,R,{once:!0})}aa(e,ra,{bubbles:!1,cancelable:!0,detail:{originalEvent:M,contextmenu:Yu(M),focusable:Vp(w),target:O}})}})}x.pointerType==="touch"?(p.forEach(S=>S()),p.add(Ms(l,"click",b,{once:!0})),p.add(u.addEventListener("click",b,{once:!0})),p.add(h.addEventListener("click",b,{once:!0}))):b()}const y=new Set,T=setTimeout(()=>{y.add(Ms(l,"pointerdown",m,!0)),y.add(u.addEventListener("pointerdown",m,!0)),y.add(h.addEventListener("pointerdown",m,!0))},0),E=gc.create();function L(x){if(d)return;(i?b=>E.request(b):b=>b())(()=>{const b=x?.composedPath?.()??[x?.target],S=g?b[0]:ft(x);if(!(!e||!f(x,S))){if(s||o){const D=Ws(s,o);e.addEventListener(oa,D,{once:!0})}aa(e,oa,{bubbles:!1,cancelable:!0,detail:{originalEvent:x,contextmenu:!1,focusable:lr(S),target:S}})}})}return Ni()||(y.add(Ms(l,"focusin",L,!0)),y.add(u.addEventListener("focusin",L,!0)),y.add(h.addEventListener("focusin",L,!0))),()=>{clearTimeout(T),E.cancel(),p.forEach(x=>x()),y.forEach(x=>x())}}function _p(e,t){const{defer:n}=t,s=n?he:o=>o(),r=[];return r.push(s(()=>{const o=typeof e=="function"?e():e;r.push(Hp(o,t))})),()=>{r.forEach(o=>o?.())}}function aa(e,t,n){const s=e.ownerDocument.defaultView||window,r=new s.CustomEvent(t,n);return e.dispatchEvent(r)}function Bp(e,t){const n=s=>{s.key==="Escape"&&(s.isComposing||t?.(s))};return Ms(Me(e),"keydown",n,{capture:!0})}var ca="layer:request-dismiss",we={layers:[],branches:[],recentlyRemoved:new Set,count(){return this.layers.length},pointerBlockingLayers(){return this.layers.filter(e=>e.pointerBlocking)},topMostPointerBlockingLayer(){return[...this.pointerBlockingLayers()].slice(-1)[0]},hasPointerBlockingLayer(){return this.pointerBlockingLayers().length>0},isBelowPointerBlockingLayer(e){const t=this.indexOf(e),n=this.topMostPointerBlockingLayer()?this.indexOf(this.topMostPointerBlockingLayer()?.node):-1;return t<n},isTopMost(e){return this.layers[this.count()-1]?.node===e},getNestedLayers(e){return Array.from(this.layers).slice(this.indexOf(e)+1)},getLayersByType(e){return this.layers.filter(t=>t.type===e)},getNestedLayersByType(e,t){const n=this.indexOf(e);return n===-1?[]:this.layers.slice(n+1).filter(s=>s.type===t)},getParentLayerOfType(e,t){const n=this.indexOf(e);if(!(n<=0))return this.layers.slice(0,n).reverse().find(s=>s.type===t)},countNestedLayersOfType(e,t){return this.getNestedLayersByType(e,t).length},isInNestedLayer(e,t){return!!(this.getNestedLayers(e).some(s=>hn(s.node,t))||this.recentlyRemoved.size>0)},isInBranch(e){return Array.from(this.branches).some(t=>hn(t,e))},add(e){const t=this.indexOf(e.node);t!==-1&&this.layers.splice(t,1),this.layers.push(e),this.syncLayers()},addBranch(e){this.branches.push(e)},remove(e){const t=this.indexOf(e);if(t<0)return;this.layers[t].styleTargets?.forEach(s=>{const r=s();r&&jp(r)}),this.recentlyRemoved.add(e),vc(()=>this.recentlyRemoved.delete(e)),t<this.count()-1&&this.getNestedLayers(e).forEach(r=>we.dismiss(r.node,e)),this.layers.splice(t,1),this.syncLayers()},removeBranch(e){const t=this.branches.indexOf(e);t>=0&&this.branches.splice(t,1)},syncLayers(){this.layers.forEach((e,t)=>{la(e,t,e.node),e.styleTargets?.forEach(n=>{const s=n();if(!s||s===e.node)return;la(e,t,s);const{zIndex:r}=uc(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];Up(e,ca,r=>{s.requestDismiss?.(r),r.defaultPrevented||s?.dismiss()}),Wp(e,ca,{originalLayer:e,targetLayer:t,originalIndex:n,targetIndex:t?this.indexOf(t):-1}),this.syncLayers()},clear(){this.remove(this.layers[0].node)}};function la(e,t,n){n.style.setProperty("--layer-index",`${t}`),n.removeAttribute("data-nested"),n.removeAttribute("data-has-nested"),we.getParentLayerOfType(e.node,e.type)&&n.setAttribute("data-nested",e.type);const r=we.countNestedLayersOfType(e.node,e.type);r>0&&n.setAttribute("data-has-nested",e.type),n.style.setProperty("--nested-layer-count",`${r}`)}function jp(e){e.style.removeProperty("--layer-index"),e.style.removeProperty("--nested-layer-count"),e.removeAttribute("data-nested"),e.removeAttribute("data-has-nested")}function Wp(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 Up(e,t,n){e.addEventListener(t,n,{once:!0})}var Hr=new WeakMap,Gn=new WeakMap;function qp(e){return we.isBelowPointerBlockingLayer(e)?"none":"auto"}function jc(e){const t=qp(e);e.style.pointerEvents!==t&&(e.style.pointerEvents=t)}function Gp(e){if(Gn.has(e))return;const t=me(e);if(typeof t.MutationObserver>"u")return;const n=new t.MutationObserver(()=>{Gn.has(e)&&jc(e)});n.observe(e,{attributes:!0,attributeFilter:["style"]}),Gn.set(e,n)}function da(){we.layers.forEach(({node:e})=>{jc(e),Gp(e)})}function Yp(e){const t=Gn.get(e);t&&(t.disconnect(),Gn.delete(e)),e.style.pointerEvents=""}function Kp(e,t){const n=Me(e),s=[];return we.hasPointerBlockingLayer()&&!n.body.hasAttribute("data-inert")&&(Hr.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]=Hf(()=>{const a=r();return ue(a)?a:null},{timeout:1e3});o.then(a=>s.push(Df(a,{pointerEvents:"auto"}))),s.push(i)}),()=>{we.hasPointerBlockingLayer()||(queueMicrotask(()=>{const r=n.body;if(!r)return;const o=Hr.get(r);o!==void 0&&(r.style.pointerEvents=o,Hr.delete(r)),r.removeAttribute("data-inert"),r.style.length===0&&r.removeAttribute("style")}),s.forEach(r=>r()))}}function zp(e,t){const{onDismiss:n,onRequestDismiss:s,pointerBlocking:r,exclude:o,debug:i,type:a="dialog",layerStyleTargets:l}=t,c={dismiss:n,node:e,type:a,pointerBlocking:r,requestDismiss:s,styleTargets:l};we.add(c),da();function h(d){const m=ft(d.detail.originalEvent);we.isBelowPointerBlockingLayer(e)||we.isInBranch(m)||(t.onPointerDownOutside?.(d),t.onInteractOutside?.(d),!d.defaultPrevented&&(i&&console.log("onPointerDownOutside:",d.detail.originalEvent),n?.(d)))}function u(d){const m=ft(d.detail.originalEvent);we.isInBranch(m)||(t.onFocusOutside?.(d),t.onInteractOutside?.(d),!d.defaultPrevented&&(i&&console.log("onFocusOutside:",d.detail.originalEvent),n?.(d)))}function f(d){we.isTopMost(e)&&(t.onEscapeKeyDown?.(d),!d.defaultPrevented&&n&&(d.preventDefault(),n(d)))}function p(d){const m=typeof o=="function"?o():o,y=Array.isArray(m)?m:[m],T=t.persistentElements?.map(E=>E()).filter(ue);return T&&y.push(...T),y.some(E=>hn(E,d))||we.isInNestedLayer(e,d)}const g=[r?Kp(e,t.persistentElements):void 0,Bp(e,f),_p(e,{exclude:p,onFocusOutside:u,onPointerDownOutside:h,defer:t.defer})];return()=>{we.remove(e),da(),Yp(e),g.forEach(d=>d?.())}}function Wc(e,t){const{warnOnMissingNode:n=!0}=t;return Bf(e,s=>zp(s,t),{defer:t.defer,getRootNode:t.getRootNode,onMissing:n?()=>Ls("[@zag-js/dismissable] node is `null` or `undefined`"):void 0})}var{and:Mn,not:Vt,or:Zp}=Hc(),Jp=_c({props({props:e}){return{loopFocus:!1,closeOnSelect:!e.multiple,composite:!0,defaultValue:[],...e,collection:e.collection??Us.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=fs({values:o,collection:a,selectedItemMap:l}),h=e("value")??o,u=h===o?c:fs({values:h,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:gu({selectedItems:r,collection:e("collection")})}))}},refs(){return{typeahead:{...ao.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})=>ic({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:Zp("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(Vt("multiple"),"hasSelectedItems"),actions:["selectPreviousItem"]},{guard:Vt("multiple"),actions:["selectLastItem"]}],"TRIGGER.ARROW_RIGHT":[{guard:Mn(Vt("multiple"),"hasSelectedItems"),actions:["selectNextItem"]},{guard:Vt("multiple"),actions:["selectFirstItem"]}],"TRIGGER.HOME":{guard:Vt("multiple"),actions:["selectFirstItem"]},"TRIGGER.END":{guard:Vt("multiple"),actions:["selectLastItem"]},"TRIGGER.TYPEAHEAD":{guard:Vt("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})=>ua(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 Qf({root:e.getRootNode?.()})},trackFormControlState({context:e,scope:t}){return ef(Vr(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 Wc(s,{type:"listbox",defer:!0,getRootNode:e.getRootNode,layerStyleTargets:[()=>Nr(e)],exclude:[Ht(e),yp(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),po(()=>Ht(n),()=>Nr(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||uo()==="pointer")return;const h=Ln(n),u=t("scrollToIndexFn");if(u){const p=t("collection").indexOf(l);u?.({index:p,immediate:a,getElement:()=>Fr(n,l)});return}const f=Fr(n,l);Cf(f,{rootEl:h,block:"nearest"})},r=he(()=>{Xf("virtual"),s(!0)}),i=mf(()=>Ln(n),{attributes:["data-activedescendant"],callback(){s(!1)}});return()=>{r(),i()}}},actions:{reposition({context:e,prop:t,scope:n,event:s}){const r=()=>Nr(n);po(Ht(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}){he(()=>{const t=uf({root:Ln(e)});t&&t.focus({preventScroll:!0})})},focusTriggerEl({event:e,scope:t}){if(!ua(e))return;const n=Xp(e);he(()=>{Ht(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")?Oi(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")?Oi(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:()=>Fr(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=Vr(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=fs({values:e.get("value"),collection:n,selectedItemMap:e.get("selectedItemMap")});e.set("selectedItemMap",r.nextSelectedItemMap)},syncSelectedItems({context:e,prop:t}){const n=fs({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=Vr(e);if(!t)return;const n=e.getWin(),s=new n.Event("change",{bubbles:!0,composed:!0});t.dispatchEvent(tf(s))})}}}});function ua(e){const t=e.restoreFocus??e.previousEvent?.restoreFocus;return t==null||!!t}function Xp(e){return e.focusVisible??e.previousEvent?.focusVisible?{preventScroll:!0,focusVisible:!0}:{preventScroll:!0}}function Qp(e){return new Proxy({},{get(t,n){return n==="style"?s=>e({style:s}).style:e}})}var eg=Object.defineProperty,tg=(e,t,n)=>t in e?eg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,G=(e,t,n)=>tg(e,typeof t!="symbol"?t+"":t,n),fa={onFocus:"onFocusin",onBlur:"onFocusout",onChange:"onInput",onDoubleClick:"onDblclick",htmlFor:"for",className:"class",defaultValue:"value",defaultChecked:"checked"},ng=new Set(["viewBox","preserveAspectRatio"]),Uc=Qp(e=>Object.entries(e).reduce((t,[n,s])=>{if(s===void 0)return t;n in fa&&(n=fa[n]);const r=ng.has(n)?n:n.toLowerCase();return t[r]=s,t},{})),vs=new WeakMap,ha=new Set(["value","checked","selected"]),sg=new Set(["viewBox","preserveAspectRatio","clipPath","clipRule","fillRule","strokeWidth","strokeLinecap","strokeLinejoin","strokeDasharray","strokeDashoffset","strokeMiterlimit"]),rg=e=>e.tagName==="svg"||e.namespaceURI==="http://www.w3.org/2000/svg",ys=(e,t)=>rg(e)&&sg.has(t)?t:t.toLowerCase(),_r=e=>e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),pa=(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(_r(r));for(const r in n){const o=n[r];o==null?s.removeProperty(_r(r)):s.setProperty(_r(r),String(o))}}};function se(e,t,n){const s="default";let r=vs.get(e);r||(r=new Map,vs.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"),h=d=>!d.startsWith("on"),u=d=>a(d.substring(2),t[d]),f=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"){pa(e,y,m);return}if(ha.has(d)){e[d]=m??"";return}if(typeof m=="boolean"&&!d.includes("aria-")){e.toggleAttribute(ys(e,d),m);return}if(d==="children"){e.innerHTML=m;return}if(m!=null){e.setAttribute(ys(e,d),m);return}e.removeAttribute(ys(e,d))}};for(const d in o)t[d]==null&&(d==="class"?e.className="":d==="style"?pa(e,o[d],void 0):ha.has(d)?e[d]="":e.removeAttribute(ys(e,d)));return Object.keys(o).filter(c).forEach(d=>{l(d.substring(2),o[d])}),i.filter(c).forEach(u),i.filter(h).forEach(p),r.set(s,t),function(){i.filter(c).forEach(f);const m=vs.get(e);m&&(m.delete(s),m.size===0&&vs.delete(e))}}function og(){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 qc(e,t){const n=og();return n?(n[e]||(n[e]=t()),n[e]):t()}var Rs=qc("__zag__refSet",()=>new WeakSet),ig=e=>typeof e=="object"&&e!==null&&"$$typeof"in e&&"props"in e,ag=e=>typeof e=="object"&&e!==null&&"__v_isVNode"in e,cg=e=>typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeName=="string",lg=e=>ig(e)||ag(e)||cg(e),Eo=e=>e!==null&&typeof e=="object",ga=e=>Eo(e)&&!Rs.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!lg(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 dg=Symbol(),ma=Object.getPrototypeOf,xo=new WeakMap,ug=e=>e&&(xo.has(e)?xo.get(e):ma(e)===Object.prototype||ma(e)===Array.prototype),fg=e=>ug(e)&&e[dg]||null,va=(e,t=!0)=>{xo.set(e,t)};var Ft=qc("__zag__proxyStateMap",()=>new WeakMap),hg=(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 h=Array.isArray(a)?[]:Object.create(Object.getPrototypeOf(a));return va(h,!0),n.set(a,[l,h]),Reflect.ownKeys(a).forEach(u=>{const f=Reflect.get(a,u);Rs.has(f)?(va(f,!1),h[u]=f):Ft.has(f)?h[u]=gg(f):h[u]=f}),Object.freeze(h)},r=new WeakMap,o=[1,1],i=a=>{if(!Eo(a))throw new Error("object required");const l=r.get(a);if(l)return l;let c=o[0];const h=new Set,u=(b,S=++o[0])=>{c!==S&&(c=S,h.forEach(D=>D(b,S)))};let f=o[1];const p=(b=++o[1])=>(f!==b&&!h.size&&(f=b,d.forEach(([S])=>{const D=S[1](b);D>c&&(c=D)})),c),g=b=>(S,D)=>{const M=[...S];M[1]=[b,...M[1]],u(M,D)},d=new Map,m=(b,S)=>{if(h.size){const D=S[3](g(b));d.set(b,[S,D])}else d.set(b,[S])},y=b=>{const S=d.get(b);S&&(d.delete(b),S[1]?.())},T=b=>(h.add(b),h.size===1&&d.forEach(([D,M],w)=>{const O=D[3](g(w));d.set(w,[D,O])}),()=>{h.delete(b),h.size===0&&d.forEach(([D,M],w)=>{M&&(M(),d.set(w,[D]))})}),E=Array.isArray(a)?[]:Object.create(Object.getPrototypeOf(a)),x=t(E,{deleteProperty(b,S){const D=Reflect.get(b,S);y(S);const M=Reflect.deleteProperty(b,S);return M&&u(["delete",[S],D]),M},set(b,S,D,M){const w=Reflect.has(b,S),O=Reflect.get(b,S,M);if(w&&(e(O,D)||r.has(D)&&e(O,r.get(D))))return!0;y(S),Eo(D)&&(D=fg(D)||D);let R=D;if(!Object.getOwnPropertyDescriptor(b,S)?.set){!Ft.has(D)&&ga(D)&&(R=Gc(D));const V=!Rs.has(R)&&Ft.get(R);V&&m(S,V)}return Reflect.set(b,S,R,M),u(["set",[S],D,O]),!0}});r.set(a,x);const A=[E,p,s,T];return Ft.set(x,A),Reflect.ownKeys(a).forEach(b=>{const S=Object.getOwnPropertyDescriptor(a,b);S.get||S.set?Object.defineProperty(E,b,S):x[b]=a[b]}),x})=>[i,Ft,Rs,e,t,ga,n,s,r,o],[pg]=hg();function Gc(e={}){return pg(e)}function ya(e,t,n){const s=Ft.get(e);let r;const o=[],i=s[3];let a=!1;const c=i(h=>{o.push(h),r||(r=Promise.resolve().then(()=>{r=void 0,a&&t(o.splice(0))}))});return a=!0,()=>{a=!1,c()}}function gg(e){const t=Ft.get(e),[n,s,r]=t;return r(n,s())}function Xs(e){const t=e().value??e().defaultValue;e().debug&&console.log(`[bindable > ${e().debug}] initial`,t);const n=e().isEqual??Object.is,s=Gc({value:t}),r=()=>e().value!==void 0;return{initial:t,ref:s,get(){return r()?e().value:s.value},set(o){const i=r()?e().value:s.value,a=Je(o)?o(i):o;e().debug&&console.log(`[bindable > ${e().debug}] setValue`,{next:a,prev:i}),r()||(s.value=a),n(a,i)||e().onChange?.(a,i)},invoke(o,i){e().onChange?.(o,i)},hash(o){return e().hash?.(o)??String(o)}}}Xs.cleanup=e=>{};Xs.ref=e=>{let t=e;return{get:()=>t,set:n=>{t=n}}};function mg(e){const t={current:e};return{get(n){return t.current[n]},set(n,s){t.current[n]=s}}}var{defineProperty:vg,getOwnPropertyDescriptor:yg,getOwnPropertyDescriptors:ba}=Object;function Bn(e,t){if(Object.is(e,t))return e;if(!Fn(e)||!Fn(t))return t===void 0?e:t;let n=e;const s=(r,o)=>{n===e&&(n=Object.defineProperties({},ba(e))),vg(n,r,o)};for(const[r,o]of Object.entries(ba(t))){if(!o.enumerable)continue;if(o.get){s(r,o);continue}const i=o.value;if(i===void 0)continue;const a=!!yg(e,r)?.get,l=e[r],c=Fn(l)&&Fn(i)?Bn(l,i):i;!a&&Object.is(l,c)||s(r,{value:c,writable:!0,enumerable:!0,configurable:!0})}return n}var Yc=class{constructor(e,t={}){G(this,"machine",e),G(this,"scope"),G(this,"context"),G(this,"prop"),G(this,"state"),G(this,"refs"),G(this,"computed"),G(this,"event",{type:""}),G(this,"previousEvent",{type:""}),G(this,"effects",new Map),G(this,"replaceTracker",Sp()),G(this,"transition",null),G(this,"cleanups",[]),G(this,"subscriptions",[]),G(this,"userProps"),G(this,"userPropsSources",[]),G(this,"getUserProps",()=>{let u=this.userProps;for(const f of this.userPropsSources){const p=Ri(f);u=u?Bn(u,p):p}return u}),G(this,"getEvent",()=>({...this.event,current:()=>this.event,previous:()=>this.previousEvent})),G(this,"getState",()=>({...this.state,matches:(...u)=>u.some(f=>Op(this.state.get(),f)),hasTag:u=>Mp(this.machine,this.state.get(),u)})),G(this,"debug",(...u)=>{this.machine.debug&&console.log(...u)}),G(this,"notify",()=>{this.publish()}),G(this,"send",u=>{if(this.status!==_n.Started)return;const f=u?.replaces,p=f?this.replaceTracker.claim(f):void 0;queueMicrotask(()=>{if(!u||f&&p&&this.replaceTracker.isReplaced(f,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}=Ap(this.machine,g,d),T=this.choose(m);if(!T)return;this.transition=T;const E=sa(this.machine,T.target??g,y);this.debug("transition",T),E!==g?this.state.set(E):T.reenter?this.state.invoke(g,g):this.action(T.actions)})}),G(this,"action",u=>{const f=Je(u)?u(this.getParams()):u;if(!f)return;const p=f.map(g=>{const d=this.machine.implementations?.actions?.[g];return d||Ls(`[zag-js] No implementation found for action "${JSON.stringify(g)}"`),d});for(const g of p)g?.(this.getParams())}),G(this,"guard",u=>{if(Je(u))return u(this.getParams());const f=this.machine.implementations?.guards?.[u];return f||Ls(`[zag-js] No implementation found for guard "${JSON.stringify(u)}"`),f?.(this.getParams())}),G(this,"effect",u=>{const f=Je(u)?u(this.getParams()):u;if(!f)return;const p=f.map(d=>{const m=this.machine.implementations?.effects?.[d];return m||Ls(`[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?.())}),G(this,"choose",u=>zd(u).find(f=>{let p=!f.guard;return nu(f.guard)?p=!!this.guard(f.guard):Je(f.guard)&&(p=f.guard(this.getParams())),p})),G(this,"subscribe",u=>(this.subscriptions.push(u),()=>{const f=this.subscriptions.indexOf(u);f>-1&&this.subscriptions.splice(f,1)})),G(this,"status",_n.NotStarted),G(this,"publish",()=>{this.callTrackers(),this.subscriptions.forEach(u=>u(this.service))}),G(this,"trackers",[]),G(this,"setupTrackers",()=>{this.machine.watch?.(this.getParams())}),G(this,"callTrackers",()=>{this.trackers.forEach(({deps:u,fn:f})=>{const p=u.map(g=>g());bn(f.prev,p)||(f(),f.prev=p)})}),G(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,f)=>{f.prev=u.map(p=>p()),this.trackers.push({deps:u,fn:f})},refs:this.refs,computed:this.computed,flush:lu,scope:this.scope,choose:this.choose})),Je(t)?this.userPropsSources.push(t):this.userProps=t;const{id:n,ids:s,getRootNode:r}=Ri(t);this.scope=Dp({id:n,ids:s,getRootNode:r});const o=u=>{const f=this.getUserProps();return(e.props?.({props:No(f),scope:this.scope})??f)[u]};this.prop=o;const i=e.context?.({prop:o,bindable:Xs,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 f=ya(u.ref,()=>this.notify());this.cleanups.push(f)});const a={get(u){return i?.[u].get()},set(u,f){i?.[u].set(f)},initial(u){return i?.[u].initial},hash(u){const f=i?.[u].get();return i?.[u].hash(f)}};this.context=a;const l=u=>(ir(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=mg(e.refs?.({prop:o,context:a})??{});this.refs=c;const h=Xs(()=>({defaultValue:sa(e,e.initialState({prop:o})),onChange:(u,f)=>{const{exiting:p,entering:g}=Lp(this.machine,f,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?Ws(y,m):m)}}),f===ms){this.action(e.entry);const d=this.effect(e.effects);if(d){const m=this.effects.get(ms);this.effects.set(ms,m?Ws(m,d):d)}}g.forEach(d=>{this.action(d.state?.entry)})}}));this.state=h,this.cleanups.push(ya(this.state.ref,()=>this.notify()))}updateProps(e){const t=this.userPropsSources;if(Je(e))t.push(e);else if(t.length===0)this.userProps=Bn(this.userProps,e);else{const n=t.length-1,s=t[n];if(Je(s)){const r=Bn({},e);r&&Object.keys(r).length>0&&t.push(r)}else t[n]=Bn(s,e)}this.notify()}start(){this.status=_n.Started,this.debug("initializing..."),this.state.invoke(this.state.initial,ms),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=_n.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 bg='<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>',Et=new Map;let wg=0;function Eg(e){const t=document.createElement("span");t.className="ui-select",t.innerHTML=`<button type="button" class="ui-select-trigger"><span></span>${bg}</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 h=new Yc(Jp,{id:`select-${++wg}`,collection:Us({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=()=>wp(h.service,Uc);function f(){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,T)=>{const E=o.children[T];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 T=document.createElement("div");return T.className="ui-select-option",T.textContent=y.label,T})),h.updateProps({collection:Us({items:i})})),l!==e.value&&(l=e.value,u().setValue([l])),c!==e.disabled&&(c=e.disabled,h.updateProps({disabled:c})),f()}t.addEventListener("keydown",d=>d.stopPropagation()),e.addEventListener("change",p);const g=h.subscribe(f);return h.start(),p(),{sync:p,focus:()=>n.focus(),dispose(){e.removeEventListener("change",p),g(),h.stop(),t.remove(),e.hidden=!1}}}function Jn(e=document){for(const[t,n]of Et)t.isConnected||(n.dispose(),Et.delete(t));for(const t of e.querySelectorAll("select:not([data-native])"))Et.has(t)?Et.get(t).sync():Et.set(t,Eg(t))}function xg(e){Jn(e.parentElement),Et.get(e)?.focus()}function Sg(){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")))))&&Jn()});return e.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["disabled"]}),Jn(),()=>{e.disconnect();for(const t of Et.values())t.dispose();Et.clear()}}function $g(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
- ${Nn.map(w=>`<option value="${w.id}">${w.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=w=>t.querySelector(w),o=r("select"),i=r(".launch-directory"),a=r(".launch-web-link"),l=r(".launch-command"),c=r(".launch-terminal"),h=r(".launch-copy"),u=r(".launch-status");let f,p=0,g=0,d,m,y,T,E,L=null;function x(){g++,m?.abort(),clearTimeout(E),y=void 0,l.value="",c.disabled=h.disabled=!0,r(".launch-summary").hidden=!0,r(".launch-availability").textContent=""}function A(){t.close(),p++,d?.abort(),x(),e(),L?.focus({preventScroll:!0})}async function b(w){try{await navigator.clipboard.writeText(w),u.textContent="Command copied."}catch{u.textContent=`Copy this command: ${w}`,w===l.value&&(l.focus(),l.select())}}function S(){if(a.hidden=!0,a.removeAttribute("href"),f&&T?.webBaseUrl)try{a.href=Ud(T.webBaseUrl,f.nativeID||f.id),a.hidden=!1}catch{}u.textContent=T?a.hidden?"OpenCode is unavailable. Choose another app to use the saved conversation.":"":"Finding OpenCode…"}function D(w){const O=Nn.find(R=>R.id===o.value)?.name||Ue(o.value);l.value=w.command,h.disabled=!1,c.disabled=!w.terminalAvailable,c.textContent=`${w.mode==="resume"?"Resume in":"Open in"} ${O} ↗`,r(".launch-summary").hidden=!1,r(".launch-mode").textContent=w.mode==="resume"?"Resume original session":"New session · saved context",r(".launch-hint").textContent=w.mode==="resume"?`Continue this conversation in ${O}.`:`Start in ${O} with the saved conversation.`,r(".launch-context").hidden=!w.context,r(".launch-coverage").textContent=w.context?`${w.context.messages.toLocaleString()} / ${w.context.totalMessages.toLocaleString()} messages${w.context.partial?" · Partial history":""}`:"",r(".launch-context-path").textContent=w.context?.path||"",r(".launch-availability").textContent=w.targetAvailable?w.terminalAvailable?"":"Automatic terminal opening is unavailable. Run the copied command in your terminal.":`${O} CLI was not found. Install it, then run the copied command.`,u.textContent=""}async function M(){if(x(),!f||!t.open)return;const w=o.value==="web";if(r(".launch-web").hidden=!w,r(".launch-cli").hidden=w,w){S();return}if(!Tr(o.value))return;const O=g;m=new AbortController,u.textContent="Preparing command…";try{const R=await fetch(`/api/sessiongraph/session/${encodeURIComponent(f.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!==O)return;y=V,D(y)}catch(R){g===O&&(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{}M()},s),i.addEventListener("input",()=>{x(),u.textContent="Checking working directory…",E=setTimeout(()=>{M()},300)},s),i.addEventListener("change",()=>{M()},s),r(".dialog-close").addEventListener("click",A,s),t.addEventListener("cancel",w=>{w.preventDefault(),A()},s),t.addEventListener("keydown",w=>{w.stopPropagation()},s),h.addEventListener("click",()=>{y&&b(y.command)},s),r(".launch-copy-pair").addEventListener("click",()=>{b("opencode pair")},s),c.addEventListener("click",async()=>{if(!f||!y||c.disabled)return;const w=p;c.disabled=o.disabled=i.disabled=!0,u.textContent="Opening Terminal…";try{const O=await fetch(`/api/sessiongraph/session/${encodeURIComponent(f.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 O.json();if(!O.ok)throw new Error(R.error||"Could not open Terminal.");p===w&&(u.textContent="Session sent to Terminal.")}catch(O){p===w&&(u.textContent=O instanceof Error?O.message:"Could not open Terminal. Copy the command instead.")}finally{p===w&&(o.disabled=i.disabled=!1,c.disabled=!y?.terminalAvailable)}},s),{async open(w){f=w;const O=++p;d?.abort(),d=new AbortController,T=void 0,x(),t.open||(L=document.activeElement),r(".launch-title").textContent=`${Ue(w.source)} · ${w.title}`,i.value=w.directory,i.disabled=o.disabled=!1,o.value=Tr(w.source)?w.source:"opencode";const R=(!w.source||w.source==="opencode")&&Xa(w.nativeID||w.id);o.querySelector('[value="web"]').disabled=!R;for(const V of Nn)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");(Tr(V)||V==="web"&&R)&&(o.value=V)}catch{}l.placeholder="Preparing command…",r(".launch-context").open=!1,t.open||t.showModal(),e(),xg(o),M();try{const V=await fetch(`/api/sessiongraph/session/${encodeURIComponent(w.id)}/connection`,{signal:d.signal});if(!V.ok)throw new Error("Connection unavailable");const H=await V.json();if(p!==O)return;T=H;for(const K of Nn){const re=H.targets.some(z=>z.id===K.id&&z.available);o.querySelector(`[value="${K.id}"]`).textContent=`${K.name}${re?"":" · CLI not found"}`}o.value==="web"&&S()}catch{p===O&&o.value==="web"&&(u.textContent="OpenCode is unavailable. Choose another app to use the saved conversation.")}},dispose(){p++,d?.abort(),x(),n.abort(),t.remove()}}}const Ig=e=>e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]);function Tg(e,t){const n=document.createElement("dialog");n.className="imports-dialog",n.setAttribute("aria-labelledby","imports-heading"),n.innerHTML='<button class="icon-button dialog-close" aria-label="Close sources">×</button><span class="eyebrow">SessionGraph</span><h2 id="imports-heading">Explore &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(n);const s=x=>n.querySelector(x);let r=!1,o=0,i=!1,a=null,l=!1,c=!1,h=!1;const u=new AbortController;let f=!1,p=0,g;async function d(x,A){const b=await fetch(`/api/sessiongraph/${x}`,{...A,signal:AbortSignal.any([u.signal,AbortSignal.timeout(3e4)])}),S=await b.json();if(b.status===409&&x==="import"&&A?.method==="POST")return d("import");if(!b.ok)throw new Error(S.error||"Import unavailable.");return S}function m(x){r=x.running,s(".import-start").disabled=r,n.querySelectorAll("input").forEach(b=>{b.disabled=r}),s(".imports-progress").textContent=r?`${Ue(x.source)} · ${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`:""}`,s(".import-start").textContent=r?"Importing…":"Import updates ↗",s(".imports-notes").hidden=!x.errors.length;const A=new Map;x.errors.forEach(b=>A.set(b,(A.get(b)||0)+1)),s(".imports-notes div").innerHTML=[...A].map(([b,S])=>`<p>${Ig(b)}${S>1?` (${S} occurrences)`:""}</p>`).join(""),document.dispatchEvent(new CustomEvent("sessiongraph-import-status",{detail:x}))}async function y(){if(!(i||c)){o=0,c=!0;try{const x=await d("import");if(i)return;if(m(x),x.running)o=window.setTimeout(y,1e3);else{const A=g;g=void 0,await e(h),!i&&A===p&&n.open&&!x.failed&&!x.errors.length&&n.close()}}catch(x){T(x)}finally{c=!1}}}function T(x){if(i)return;g=void 0;const A=x instanceof Error?x.message:"Import unavailable.";m({running:!1,discovered:0,imported:0,unchanged:0,failed:1,errors:[A]}),s(".imports-progress").textContent=A}async function E(x,A=!1){if(!(i||A&&n.open)){if(r||l||c||o){!A&&!n.open&&L();return}l=!0,h=A,r=!0,s(".import-start").disabled=!0,g=f&&n.open&&x!==void 0?p:void 0;try{const b=await d("import",{method:"POST",headers:{"Content-Type":"application/json","X-SessionGraph-Action":"import"},body:JSON.stringify(A?{automatic:!0}:{sources:x})});if(i)return;m(b),window.clearTimeout(o),o=window.setTimeout(y,100)}catch(b){T(b)}finally{l=!1}}}async function L(x=!1){f=x,p++,a=document.activeElement,s("#imports-heading").textContent=x?"Explore & visualize all your LLM sessions":"Your session sources.",n.open||n.showModal(),t(),s(".import-sources").textContent="Finding local session sources…";try{const A=await d("sources");s(".import-sources").innerHTML=Za(A.sources).map(S=>Ja(S,{checked:S.selected||x&&S.available,disabled:r})).join("");const b=await d("import");b.running?(m(b),window.clearTimeout(o),o=window.setTimeout(y,1e3)):x||m(b)}catch(A){s(".import-sources").textContent=A instanceof Error?A.message:"Could not detect sources."}}return s(".import-start").addEventListener("click",()=>{E([...n.querySelectorAll("input:checked")].map(x=>x.value))}),s(".dialog-close").addEventListener("click",()=>n.close()),n.addEventListener("close",()=>{p++,g=void 0,t(),a?.focus()}),n.addEventListener("keydown",x=>x.stopPropagation()),{open:L,sources:async()=>(await d("sources")).sources,select:x=>E(x),get busy(){return r||l||c||!!o},refresh:(x=!1)=>E(void 0,x),resume:()=>{h=!0,r=!0,window.clearTimeout(o),y()},dispose:()=>{i=!0,u.abort(),window.clearTimeout(o),n.remove()}}}const Cg=6e4,kg=3e4;class Ag{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<kg)){this.checking=!0,this.activity();try{await this.options.refresh()}finally{this.checking=!1}}}dispose(){this.disposed=!0}}class Lg{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 Og=Object.freeze({sourceID:"",projectID:"",directory:"",days:0,fromDate:"",toDate:"",includeChildren:!0,includeArchived:!1}),Mg=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 Dg(e){const t={...Og};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"])Mg(n[s])&&(t[s]=n[s]);return t.fromDate&&t.toDate&&t.fromDate>t.toDate&&(t.fromDate="",t.toDate=""),t}const Rg=e=>typeof e=="number"&&Number.isSafeInteger(e)&&e>=0;function Kc(e){const t=e.filter(i=>["opencode","continue"].includes(i.source||"opencode")&&Rg(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 h=l+c>>>1;s[h]<=i?l=h+1:c=h}return{tokens:r[l],sessions:l}}}}const Qo=15e3,Qs=5e3,zc=1e3,ei=30,So=Qo/1e3*ei,zv=(Qo+Qs+zc)/1e3*ei,Zv=e=>Math.min(1,e/(So-1)),Jv=e=>e<So?null:Math.min(1,(e-So+1)/(Qs/1e3*ei));function Xv(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 Pg=new Intl.DateTimeFormat("en",{month:"short",year:"numeric"}),Vg=new Intl.DateTimeFormat("en",{month:"short",day:"numeric",year:"numeric"}),Ng=(e,t)=>(t>=90*864e5?Pg:Vg).format(e);function Fg(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 Zc(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}}const vr=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}),ti="sessiongraph.preferences",wa={motion:["system","on","off"],view:["3d","2d"],density:["comfortable","compact"],quality:["performance","balanced","high"],trails:["all","selected","off"]},Ea={clickVolume:[0,100],panelOpacity:[55,100],bloom:[0,75],nodeScale:[60,180],trailOpacity:[0,100],trailSpeed:[10,100],playbackSpeed:[.25,3]};function yr(e){const t={...vr};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 wa)wa[s].includes(r)&&Object.assign(t,{[s]:r});else if(s in Ea){const[o,i]=Ea[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 Jc(e){try{const t=JSON.parse(e.getItem(ti)||e.getItem("session-atlas.preferences")||"null");return yr(t?.version===1?t.values:void 0)}catch{return{...vr}}}function Xc(e,t){try{return e.setItem(ti,JSON.stringify({version:1,values:yr(t)})),!0}catch{return!1}}const $o=(e,t)=>e.motion==="on"||e.motion==="system"&&!t,Ke=[["interface","Interface",Sd],["sources","Sources",fd],["audio","Sound",Ka],["graphics","Graphics",Ya],["trails","Trails & playback",Ed],["privacy","Privacy",bd]],ze=(e,t,n)=>`<label class="setting-row"><span><strong>${t}</strong><small>${n}</small></span><input type="checkbox" role="switch" data-pref="${e}" aria-label="${t}"/></label>`,Nt=(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 Hg(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">${Ke.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}">${Ga([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
- ${Nt("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
- ${ze("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
- ${ze("muted","Mute all sound","Silence everything. Your volume levels are kept.")}
48
- ${ze("clickSounds","Interaction sounds","A soft tick for controls; a chime for sessions.")}
49
- ${Nt("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
- ${Nt("bloom","Glow strength","Soft light around bright nodes; disabled in Performance.",0,75)}
56
- ${Nt("nodeScale","Node size","Scale the lights without changing their positions.",60,180)}
57
- ${ze("stars","Starfield","A faint field of stars behind the timeline.")}
58
- ${ze("labels","Map labels","Directory names and the selected session title.")}
59
- ${ze("focusDimming","Focus dimming","Dim surrounding nodes when a session is selected.")}
60
- </section>
61
- <section id="settings-trails" role="tabpanel" aria-labelledby="settings-tab-trails" hidden><h3>Trails &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
- ${Nt("trailOpacity","Trail brightness","Fade lifetime trails into the background.",0,100)}
64
- ${ze("trailFlow","Flowing trails","A decorative pulse along each lifetime; respects Motion.")}
65
- ${Nt("trailSpeed","Flow speed","How quickly the light travels along the trails.",10,100)}
66
- ${ze("relationships","Relationship links","Show recorded fork and child connections.")}
67
- ${ze("messageDots","Message dots","User and assistant messages, colored to match the selected session.")}
68
- ${Nt("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="setting-row"><span><strong>Processed on this computer</strong><small>Importing, indexing, search, and visualization run locally. Imports read your selected sources without changing them or starting an AI agent.</small></span></div>
73
- <div class="setting-row"><span><strong>Update checks use the internet</strong><small>Desktop update checks and downloads contact GitHub without session content. npm installation contacts its registry. These services receive ordinary connection metadata, including your public IP address.</small></span></div>
74
- <div class="setting-row"><span><strong>Continuing a session is your choice</strong><small>Explicitly launching another harness lets it read the selected context. It may contact its model provider under its own privacy settings.</small></span></div>
75
- <div class="setting-row"><span><strong>Local storage is not encrypted by SessionGraph</strong><small>Saved conversations, search text, and handoff files rely on your device's access controls. Disk encryption and backup or sync settings affect confidentiality. Deselecting a source keeps previously imported history.</small></span></div>
76
- </section>
77
- </div></div><footer class="settings-footer"><span class="settings-save-status" role="status">Changes save automatically on this device.</span><button class="text-button settings-reset">Restore defaults</button><button class="primary-button settings-done">Done</button></footer>`,document.body.append(t);const n=new AbortController,s={signal:n.signal},r=t.querySelector(".settings-archived");r.addEventListener("change",()=>e.changeArchived(r.checked),s);let o=null,i=0,a=!1,l=!1,c="interface";const h=()=>{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,h();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=Za(m).map(y=>Ja(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,h(),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,h(),t.querySelector(".settings-import-progress").textContent="Starting import…";try{await e.importSources(g)}catch(d){l=!1,h(),t.querySelector(".settings-import-progress").textContent=d instanceof Error?d.message:"Import unavailable."}},s);const f=()=>t.close();for(const g of[".settings-close",".settings-done"])t.querySelector(g).addEventListener("click",f,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 Ke){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=Ke.findIndex(([T])=>T===g.dataset.tab),y=d.key==="Home"?0:d.key==="End"?Ke.length-1:["ArrowRight","ArrowDown"].includes(d.key)?(m+1)%Ke.length:["ArrowLeft","ArrowUp"].includes(d.key)?(m+Ke.length-1)%Ke.length:-1;y<0||(d.preventDefault(),p(Ke[y][0]),t.querySelector(`[data-tab="${Ke[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({...vr})},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,h(),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 T=y.dataset.pref;y.type==="checkbox"?y.checked=!!g[T]:y.value=String(g[T]);const E=t.querySelector(`[data-output="${T}"]`);E&&(E.value=`${g[T]}${E.dataset.unit}`),y.disabled=T==="bloom"&&g.quality==="performance"||T==="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,Jn(t)},audioStatus(g){t.querySelector(".settings-audio-status").textContent=g},dispose(){n.abort(),t.remove()}}}class _g{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 Qv=e=>e.kind==="message"&&(e.role==="user"||e.role==="assistant"),Qc=e=>e.kind==="message"?e.role==="user"?"#b0e9d6":"#9bbcff":e.kind.startsWith("tool_")?"#eac594":"#d7a1f1",el=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],wt=e=>e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]),Bg=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"medium"}),xa=e=>e===null?"Time not recorded":Bg.format(e),Sa=e=>`<span class="event-badge" style="--event-color:${Qc(e)}">${el(e)}</span>`;function jg(e,t,n){const s=document.createElement("aside");s.className="event-panel glass",s.id="message-panel",s.hidden=!0,s.setAttribute("aria-labelledby","event-title"),s.innerHTML=`<header class="event-heading"><h2 id="event-title">Messages</h2><button class="icon-button event-close" aria-label="Close message details">×</button></header>
78
- <div class="event-detail-nav"><button class="secondary-button" data-step="previous" aria-label="Previous message" title="Previous message (← / ↑)">← Previous</button><span class="event-position" role="status"></span><button class="secondary-button" data-step="next" aria-label="Next message" title="Next message (→ / ↓)">Next →</button></div>
79
- <div class="event-scroll"><article class="event-content" aria-label="Message details" tabindex="0"></article>
80
- <details class="event-browser"><summary>Browse messages <span class="event-count"></span></summary>
81
- <nav class="event-list" aria-label="Session messages"></nav><div class="event-pagination"><button class="secondary-button" data-page="previous">← Earlier page</button><button class="secondary-button" data-page="next">Later page →</button></div>
82
- </details>
83
- </div><footer class="event-footer"><span class="event-coverage"></span><button class="text-button event-reload">Reload</button></footer>`,e.append(s);const r=b=>s.querySelector(b),o=new AbortController;let i,a,l,c;const h="messages";let u=!1,f,p,g={};const d=(b,S)=>`<button class="event-row" data-event="${wt(b.id)}" aria-current="${l?.selected?.id===b.id?"true":"false"}"><span class="event-row-top">${Sa(b)}<small>#${l.offset+S+1}</small></span><span class="event-preview">${wt(b.preview||"No text recorded")}</span><time>${xa(b.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 b=l.selected;r(".event-position").textContent=b?`${l.offset+l.items.findIndex(S=>S.id===b.id)+1} / ${l.total}`:"No messages";for(const S of["previous","next"])r(`[data-step="${S}"]`).disabled=!l[`${S}Item`];if(!b){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(b),r(".event-content").innerHTML=`<div class="event-detail-heading">${Sa(b)}<h3>${wt(b.name)}</h3><p>${xa(b.time)}</p></div>
84
- ${b.partial?'<p class="event-warning">Partial message</p>':""}
85
- ${b.text?`<section class="event-payload"><pre>${wt(b.text)}</pre></section>`:'<p class="event-empty">No message text was recorded.</p>'}
86
- <details class="event-provenance"><summary>Source details</summary><dl><dt>Source</dt><dd>${wt(Ue(a?.source))}</dd><dt>Message ID</dt><dd>${wt(b.messageID)}</dd><dt>Timestamp source</dt><dd>${wt(b.timeSource)}</dd></dl></details>`}async function T(b={}){if(!a)return;clearTimeout(p),i?.abort();const S=new AbortController;i=S,g=b,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 D=r(".event-list").scrollTop,M=l?.offset,w=document.activeElement,O=w instanceof HTMLElement?w.dataset:void 0;try{const R=await t.read(a.id,{filter:h,...b,...c?{revision:c}:{}},S.signal);if(S.signal.aborted)return;l=R,c=l.revision,y(),r(".event-list").scrollTop=l.offset===M?D:0,r(".event-scroll").scrollTop=0;const V=O?.event?`[data-event="${O.event}"]`:"";V&&(document.activeElement===w||!w?.isConnected&&document.activeElement===document.body)&&s.querySelector(V)?.focus({preventScroll:!0}),clearTimeout(p),p=setTimeout(()=>{f?.abort(),f=new AbortController;for(const H of[l?.previousItem,l?.nextItem])H&&t.read(a.id,{item:H,filter:h,revision:c},f.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>${wt(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,T()},L=()=>!s.hidden&&!e.hidden,x=()=>{clearTimeout(p),f?.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)},A=b=>{if(u)return;const S=b==="next"?l?.nextItem:l?.previousItem;S&&T({item:S})};return s.addEventListener("click",b=>{const S=b.target.closest("button");if(S){if(S.dataset.event&&T({item:S.dataset.event}),S.dataset.step&&A(S.dataset.step==="next"?"next":"previous"),S.dataset.page){const D=S.dataset.page==="next"?l?.nextCursor:l?.previousCursor;D&&T({cursor:D})}S.hasAttribute("data-retry")&&T(g),(S.hasAttribute("data-reload")||S.classList.contains("event-reload"))&&E(),S.classList.contains("event-close")&&(x(),document.querySelector("#scene canvas")?.focus({preventScroll:!0}))}},{signal:o.signal}),r(".event-browser").addEventListener("toggle",m,{signal:o.signal}),{close:x,handleKey(b){return!L()||b.defaultPrevented||b.metaKey||b.ctrlKey||b.altKey||b.shiftKey||document.querySelector("dialog[open]")||b.target.closest('input, select, textarea, [contenteditable="true"], [data-drag-panel], #explorer')?!1:b.key==="Escape"?(b.preventDefault(),x(),document.querySelector("#scene canvas")?.focus({preventScroll:!0}),!0):["ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].includes(b.key)?(b.preventDefault(),A(b.key==="ArrowLeft"||b.key==="ArrowUp"?"previous":"next"),!0):!1},open(b,S,D){clearTimeout(p),f?.abort();const M=a?.id===b.id;a=b,c=D,l=void 0,r(".event-list").replaceChildren(),r(".event-content").innerHTML='<p class="event-empty">Loading saved history…</p>',r(".event-coverage").textContent="Loading coverage…",M||(r(".event-browser").open=!1),s.hidden=!1,e.classList.add("has-events"),T(S?{item:S}:{})},dispose(){clearTimeout(p),f?.abort(),i?.abort(),o.abort(),s.remove()}}}function Wg(e,t,n){const s=new Map;let r,o,i,a,l=0,c=0,h=1;const u=document.createElement("strong"),f=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,T){if(!a)return;const E=`${el(a)} · ${a.name}`,L=y||"No text recorded.",x=[T,h>1?`${h} nearby items`:"","Click to focus and read · ← / → to navigate"].filter(Boolean).join(" · ");u.textContent!==E&&(u.textContent=E),f.textContent!==L&&(f.textContent=L),p.textContent!==x&&(p.textContent=x),u.parentElement!==e&&e.replaceChildren(u,f,p),e.classList.add("message-tooltip"),e.hidden=!1,e.style.setProperty("--event-color",Qc(a));const A=e.offsetWidth,b=e.offsetHeight,S=t.getBoundingClientRect(),D=[...document.querySelectorAll(".floating-panel:not([hidden]), .app-header, .map-controls")].map(O=>O.getBoundingClientRect()),w=[c+18,c-b-18].flatMap(O=>[l+18,l-A-18].map(R=>{R=Math.max(8,Math.min(R,t.clientWidth-A-8)),O=Math.max(8,Math.min(O,t.clientHeight-b-8));const V=S.left+R,H=S.top+O,K=D.reduce((re,z)=>re+Math.max(0,Math.min(V+A,z.right+8)-Math.max(V,z.left-8))*Math.max(0,Math.min(H+b,z.bottom+8)-Math.max(H,z.top-8)),0);return{left:R,top:O,overlap:K}})).reduce((O,R)=>R.overlap<O.overlap?R:O);e.style.left=`${w.left}px`,e.style.top=`${w.top}px`}function m(y){const T=[y.text,y.input?`Input
87
- ${y.input}`:"",y.output?`Output
88
- ${y.output}`:""].filter(Boolean).join(`
89
-
90
- `);return{text:T.slice(0,1800),shortened:T.length>1800||!!y.partial}}return{clear:g,show(y,T,E,L,x,A){const b=`${T}:${E}:${y.id}`,S=r!==b;S&&g(),r=b,a=y,l=x,c=A,h=L;const D=s.get(b);d(D?.text||y.preview,D?D.shortened?"Content preview":"":"Loading message…"),!(!S||D)&&(i=setTimeout(async()=>{const M=new AbortController;o=M;try{const w=await n.read(T,{item:y.id,revision:E,filter:"messages"},M.signal);if(M.signal.aborted||r!==b||w.selected?.id!==y.id)return;const O=m(w.selected);s.set(b,O),s.size>20&&s.delete(s.keys().next().value),d(O.text,O.shortened?"Content preview":"")}catch{!M.signal.aborted&&r===b&&d(y.preview,"Saved excerpt · open for details")}},120))},dispose(){g(),s.clear()}}}class Ug{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,h=this.generation,u=new URLSearchParams({filter:r,...n}),f=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||h!==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]),T=JSON.stringify(m).length;for(this.characters-=this.pages.get(y)?.characters||0,this.pages.delete(y),this.pages.set(y,{page:m,characters:T}),this.characters+=T;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:f,readers:0},this.pending.set(o,a);const p=a,g=()=>{this.pending.get(o)===p&&this.pending.delete(o)};f.then(g,g)}const l=a;return l.readers++,new Promise((c,h)=>{const u=()=>{p(),h(s.reason)};let f=!1;const p=()=>{f||(f=!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=>{f||(p(),c(g))},g=>{f||(p(),h(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 bs,Xt,Ie,Qt,ws,Br,Es;const $a="__TAURI_TO_IPC_KEY__";function qg(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}class ey{constructor(t){bs.add(this),Xt.set(this,void 0),Ie.set(this,0),Qt.set(this,[]),ws.set(this,void 0),tn(this,Xt,t||(()=>{})),this.id=qg(n=>{const s=n.index;if("end"in n){s==ae(this,Ie,"f")?this.cleanupCallback():tn(this,ws,s);return}const r=n.message;if(s==ae(this,Ie,"f")){for(ae(this,bs,"m",Br).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,bs,"m",Br).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,ws,"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,ws=new WeakMap,bs=new WeakSet,Br=function(n){try{ae(this,Xt,"f").call(this,n)}catch(s){queueMicrotask(()=>{throw s})}},$a)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[$a]()}}async function tl(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}class ty{get rid(){return ae(this,Es,"f")}constructor(t){Es.set(this,void 0),tn(this,Es,t)}async close(){return tl("plugin:resources|close",{rid:this.rid})}async[(Es=new WeakMap,Symbol.asyncDispose)](){await this.close()}}function Gg(){return!!(globalThis||window).isTauri}async function Yg(){await tl("plugin:process|restart")}class Kg{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 zg='<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>',Zg='<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 Jg(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 h=["downloading","installing","restarting"].includes(c.phase),u=c.phase==="ready"||c.phase==="error"&&c.retry!=="download",f=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=h,t.dataset.phase=c.phase,t.setAttribute("aria-busy",String(h)),t.setAttribute("aria-label",p),t.title=p;const g=`${u||c.phase==="restarting"?Zg:zg}<span>${f}</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 Kg(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 Xg(){return Gg()?Jg({async check(){const{check:e}=await Ro(async()=>{const{check:n}=await import("./index-G_Vk_zeX.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 Yg()}}):{dispose(){}}}var Qg=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"),Z=Qg.build();function jr(e,t){return e-t*Math.floor(e/t)}const nl=1721426;function xs(e,t,n,s){t=ni(e,t);let r=t-1,o=-2;return n<=2?o=0:Ps(t)&&(o=-1),nl-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*n-362)/12+o+s)}function Ps(e){return e%4===0&&(e%100!==0||e%400===0)}function ni(e,t){return e==="BC"?1-t:t}function em(e){let t="AD";return e<=0&&(t="BC",e=1-e),[t,e]}const tm={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-nl,r=Math.floor(s/146097),o=jr(s,146097),i=Math.floor(o/36524),a=jr(o,36524),l=Math.floor(a/1461),c=jr(a,1461),h=Math.floor(c/365),u=r*400+i*100+l*4+h+(i!==4&&h!==4?1:0),[f,p]=em(u),g=n-xs(f,p,1,1),d=2;n<xs(f,p,3,1)?d=0:Ps(p)&&(d=1);let m=Math.floor(((g+d)*12+373)/367),y=n-xs(f,p,m,1)+1;return new Pe(f,p,m,y)}toJulianDay(t){return xs(t.era,t.year,t.month,t.day)}getDaysInMonth(t){return tm[Ps(t.year)?"leapyear":"standard"][t.month-1]}getMonthsInYear(t){return 12}getDaysInYear(t){return Ps(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 nm={"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=le(t,e.calendar),e.era===t.era&&e.year===t.year&&e.month===t.month&&e.day===t.day}function sm(e,t){return t=le(t,e.calendar),e=et(e),t=et(t),e.era===t.era&&e.year===t.year&&e.month===t.month}function rm(e,t){return t=le(t,e.calendar),e=Xn(e),t=Xn(t),e.era===t.era&&e.year===t.year}function om(e,t){return br(e.calendar,t.calendar)&&Se(e,t)}function Rn(e,t){return br(e.calendar,t.calendar)&&sm(e,t)}function Pn(e,t){return br(e.calendar,t.calendar)&&rm(e,t)}function br(e,t){return e.isEqual?.(t)??t.isEqual?.(e)??e.identifier===t.identifier}function im(e,t){return Se(e,wr(t))}const am={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6};function sl(e,t,n){let s=e.calendar.toJulianDay(e),r=n?am[n]:um(t),o=Math.ceil(s+1-r)%7;return o<0&&(o+=7),o}function rl(e){return tt(Date.now(),e)}function wr(e){return _t(rl(e))}function ol(e,t){return e.calendar.toJulianDay(e)-t.calendar.toJulianDay(t)}function cm(e,t){return Ia(e)-Ia(t)}function Ia(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let Wr=null,lm=!1;function si(){return Wr==null&&(Wr=new Intl.DateTimeFormat().resolvedOptions().timeZone),Wr}function il(){return lm}function et(e){return e.subtract({days:e.day-1})}function Io(e){return e.add({days:e.calendar.getDaysInMonth(e)-e.day})}function Xn(e){return et(e.subtract({months:e.month-1}))}function dm(e){return Io(e.add({months:e.calendar.getMonthsInYear(e)-e.month}))}function $t(e,t,n){let s=sl(e,t,n);return e.subtract({days:s})}function Ta(e,t,n){return $t(e,t,n).add({days:6})}const Ca=new Map,Ur=new Map;function al(e){if(Intl.Locale){let n=Ca.get(e);return n||(n=new Intl.Locale(e).maximize().region,n&&Ca.set(e,n)),n}let t=e.split("-")[1];return t==="u"?void 0:t}function um(e){let t=Ur.get(e);if(!t){if(Intl.Locale){let s=new Intl.Locale(e);if("getWeekInfo"in s&&(t=s.getWeekInfo(),t))return Ur.set(e,t),t.firstDay}let n=al(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&&nm[n]||0};Ur.set(e,t)}return t.firstDay}function fm(e,t,n){let s=e.calendar.getDaysInMonth(e);return Math.ceil((sl(et(e),t,n)+s)/7)}function cl(e,t){return e&&t?e.compare(t)<=0?e:t:e||t}function ll(e,t){return e&&t?e.compare(t)>=0?e:t:e||t}const hm={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 pm(e,t){let n=e.calendar.toJulianDay(e),s=Math.ceil(n+1)%7;s<0&&(s+=7);let r=al(t),[o,i]=hm[r]||[6,0];return s===o||s===i}function gn(e){e=le(e,new pn);let t=ni(e.era,e.year);return dl(t,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function dl(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 To(e,t){if(t==="UTC")return 0;if(e>0&&t===si()&&!il())return new Date(e).getTimezoneOffset()*-6e4;let{year:n,month:s,day:r,hour:o,minute:i,second:a}=ul(e,t);return dl(n,s,r,o,i,a,0)-Math.floor(e/1e3)*1e3}const ka=new Map;function ul(e,t){let n=ka.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"}),ka.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 Aa=864e5;function gm(e,t,n,s){return(n===s?[n]:[n,s]).filter(o=>mm(e,t,o))}function mm(e,t,n){let s=ul(n,t);return e.year===s.year&&e.month===s.month&&e.day===s.day&&e.hour===s.hour&&e.minute===s.minute&&e.second===s.second}function Qe(e,t,n="compatible"){let s=Le(e);if(t==="UTC")return gn(s);if(t===si()&&n==="compatible"&&!il()){s=le(s,new pn);let l=new Date,c=ni(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=To(r-Aa,t),i=To(r+Aa,t),a=gm(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 fl(e,t,n="compatible"){return new Date(Qe(e,t,n))}function tt(e,t){let n=To(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(),h=s.getUTCMilliseconds();return new Qn(r<1?"BC":"AD",r<1?-r+1:r,o,i,t,n,a,l,c,h)}function _t(e){return new Pe(e.calendar,e.era,e.year,e.month,e.day)}function Le(e,t){let n=0,s=0,r=0,o=0;if("timeZone"in e)({hour:n,minute:s,second:r,millisecond:o}=e);else if("hour"in e&&!t)return e;return t&&({hour:n,minute:s,second:r,millisecond:o}=t),new tr(e.calendar,e.era,e.year,e.month,e.day,n,s,r,o)}function le(e,t){if(br(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,Ut(s),s}function hl(e,t,n){if(e instanceof Qn)return e.timeZone===t?e:ym(e,t);let s=Qe(e,t,n);return tt(s,t)}function vm(e){let t=gn(e)-e.offset;return new Date(t)}function ym(e,t){let n=gn(e)-e.offset;return le(tt(n,t),e.calendar)}const Vn=36e5;function Er(e,t){let n=e.copy(),s="hour"in n?xm(n,t):0;Co(n,t.years||0),n.calendar.balanceYearMonth&&n.calendar.balanceYearMonth(n,e),n.month+=t.months||0,ko(n),pl(n),n.day+=(t.weeks||0)*7,n.day+=t.days||0,n.day+=s,bm(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 Co(e,t){e.calendar.isInverseEra?.(e)&&(t=-t),e.year+=t}function ko(e){for(;e.month<1;)Co(e,-1),e.month+=e.calendar.getMonthsInYear(e);let t=0;for(;e.month>(t=e.calendar.getMonthsInYear(e));)e.month-=t,Co(e,1)}function bm(e){for(;e.day<1;)e.month--,ko(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,ko(e)}function pl(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 Ut(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),pl(e)}function gl(e){let t={};for(let n in e)typeof e[n]=="number"&&(t[n]=-e[n]);return t}function ml(e,t){return Er(e,gl(t))}function ri(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),Ut(n),n}function er(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),Em(n),n}function wm(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=Ss(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=Ss(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=Ss(e.minute,60);let t=Math.floor(e.hour/24);return e.hour=Ss(e.hour,24),t}function Em(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 Ss(e,t){let n=e%t;return n<0&&(n+=t),n}function xm(e,t){return e.hour+=t.hours||0,e.minute+=t.minutes||0,e.second+=t.seconds||0,e.millisecond+=t.milliseconds||0,wm(e)}function oi(e,t,n,s){let r=e.copy();switch(t){case"era":{let o=e.calendar.getEras(),i=o.indexOf(e.era);if(i<0)throw new Error("Invalid era: "+e.era);i=nt(i,n,0,o.length-1,s?.round),r.era=o[i],Ut(r);break}case"year":r.calendar.isInverseEra?.(r)&&(n=-n),r.year=nt(e.year,n,-1/0,9999,s?.round),r.year===-1/0&&(r.year=1),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e);break;case"month":r.month=nt(e.month,n,1,e.calendar.getMonthsInYear(e),s?.round);break;case"day":r.day=nt(e.day,n,1,e.calendar.getDaysInMonth(e),s?.round);break;default:throw new Error("Unsupported field "+t)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),Ut(r),r}function vl(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=nt(o,n,i,a,s?.round);break}case"minute":r.minute=nt(e.minute,n,0,59,s?.round);break;case"second":r.second=nt(e.second,n,0,59,s?.round);break;case"millisecond":r.millisecond=nt(e.millisecond,n,0,999,s?.round);break;default:throw new Error("Unsupported field "+t)}return r}function nt(e,t,n,s,r=!1){if(r){e+=Math.sign(t),e<n&&(e=s);let o=Math.abs(t);t>0?e=Math.ceil(e/o)*o:e=Math.floor(e/o)*o,e>s&&(e=n)}else e+=t,e<n?e=s-(n-e-1):e>s&&(e=n+(e-s-1));return e}function yl(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=Er(Le(e),{years:t.years,months:t.months,weeks:t.weeks,days:t.days});n=Qe(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=tt(n,e.timeZone);return le(s,e.calendar)}function Sm(e,t){return yl(e,gl(t))}function $m(e,t,n,s){switch(t){case"hour":{let r=0,o=23;if(s?.hourCycle===12){let g=e.hour>=12;r=g?12:0,o=g?23:11}let i=Le(e),a=le(er(i,{hour:r}),new pn),l=[Qe(a,e.timeZone,"earlier"),Qe(a,e.timeZone,"later")].filter(g=>tt(g,e.timeZone).day===a.day)[0],c=le(er(i,{hour:o}),new pn),h=[Qe(c,e.timeZone,"earlier"),Qe(c,e.timeZone,"later")].filter(g=>tt(g,e.timeZone).day===c.day).pop(),u=gn(e)-e.offset,f=Math.floor(u/Vn),p=u%Vn;return u=nt(f,n,Math.floor(l/Vn),Math.floor(h/Vn),s?.round)*Vn+p,le(tt(u,e.timeZone),e.calendar)}case"minute":case"second":case"millisecond":return vl(e,t,n,s);case"era":case"year":case"month":case"day":{let r=oi(Le(e),t,n,s),o=Qe(r,e.timeZone);return le(tt(o,e.timeZone),e.calendar)}default:throw new Error("Unsupported field "+t)}}function Im(e,t,n){let s=Le(e),r=er(ri(s,t),t);if(r.compare(s)===0)return e;let o=Qe(r,e.timeZone,n);return le(tt(o,e.timeZone),e.calendar)}const Tm=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,Cm=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function km(e){let t=e.match(Tm);if(!t)throw Cm.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let n=new Pe(qr(t[1],0,9999),qr(t[2],1,12),1);return n.day=qr(t[3],1,n.calendar.getDaysInMonth(n)),n}function qr(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 Am(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 bl(e){let t=le(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 wl(e){return`${bl(e)}T${Am(e)}`}function Lm(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 Om(e){return`${wl(e)}${Lm(e.offset)}[${e.timeZone}]`}function ii(e){let t=typeof e[0]=="object"?e.shift():new pn,n;if(typeof e[0]=="string")n=e.shift();else{let i=t.getEras();n=i[i.length-1]}let s=e.shift(),r=e.shift(),o=e.shift();return[t,n,s,r,o]}class Pe{#e;constructor(...t){let[n,s,r,o,i]=ii(t);this.calendar=n,this.era=s,this.year=r,this.month=o,this.day=i,Ut(this)}copy(){return this.era?new Pe(this.calendar,this.era,this.year,this.month,this.day):new Pe(this.calendar,this.year,this.month,this.day)}add(t){return Er(this,t)}subtract(t){return ml(this,t)}set(t){return ri(this,t)}cycle(t,n,s){return oi(this,t,n,s)}toDate(t){return fl(this,t)}toString(){return bl(this)}compare(t){return ol(this,t)}}class tr{#e;constructor(...t){let[n,s,r,o,i]=ii(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,Ut(this)}copy(){return this.era?new tr(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new tr(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(t){return Er(this,t)}subtract(t){return ml(this,t)}set(t){return ri(er(this,t),t)}cycle(t,n,s){switch(t){case"era":case"year":case"month":case"day":return oi(this,t,n,s);default:return vl(this,t,n,s)}}toDate(t,n){return fl(this,t,n)}toString(){return wl(this)}compare(t){let n=ol(this,t);return n===0?cm(this,Le(t)):n}}class Qn{#e;constructor(...t){let[n,s,r,o,i]=ii(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,Ut(this)}copy(){return this.era?new Qn(this.calendar,this.era,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond):new Qn(this.calendar,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond)}add(t){return yl(this,t)}subtract(t){return Sm(this,t)}set(t,n){return Im(this,t,n)}cycle(t,n,s){return $m(this,t,n,s)}toDate(){return vm(this)}toString(){return Om(this)}toAbsoluteString(){return this.toDate().toISOString()}compare(t){return this.toDate().getTime()-hl(t,this.timeZone).toDate().getTime()}}let Gr=new Map;class Ae{constructor(t,n={}){this.formatter=El(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 Rm()&&(this.resolvedHourCycle||(this.resolvedHourCycle=Pm(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 Mm={true:{ja:"h11"},false:{}};function El(e,t={}){if(typeof t.hour12=="boolean"&&Dm()){t={...t};let r=Mm[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(Gr.has(n))return Gr.get(n);let s=new Intl.DateTimeFormat(e,t);return Gr.set(n,s),s}let Yr=null;function Dm(){return Yr==null&&(Yr=new Intl.DateTimeFormat("en-US",{hour:"numeric",hour12:!1}).format(new Date(2020,2,3,0))==="24"),Yr}let Kr=null;function Rm(){return Kr==null&&(Kr=new Intl.DateTimeFormat("fr",{hour:"numeric",hour12:!1}).resolvedOptions().hourCycle==="h12"),Kr}function Pm(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=El(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 Vm(e,t,n,s,r){const o={};for(let a in t){const l=a,c=t[l];c!=null&&(o[l]=Math.floor(c/2),o[l]>0&&c%2===0&&o[l]--)}const i=Kt(e,t,n).subtract(o);return ss(e,i,t,n,s,r)}function Kt(e,t,n,s,r){let o=e;return t.years?o=Xn(e):t.months?o=et(e):t.weeks&&(o=$t(e,n)),ss(e,o,t,n,s,r)}function ai(e,t,n,s,r){let o={...t};o.days?o.days--:o.weeks?o.weeks--:o.months?o.months--:o.years&&o.years--;let i=Kt(e,t,n).subtract(o);return ss(e,i,t,n,s,r)}function ss(e,t,n,s,r,o){return r&&e.compare(r)>=0&&(t=ll(t,Kt(_t(r),n,s))),o&&e.compare(o)<=0&&(t=cl(t,ai(_t(o),n,s))),t}function ke(e,t,n){const s=_t(e),r=t?_t(t):void 0,o=n?_t(n):void 0;let i=s;return r&&(i=ll(i,r)),o&&(i=cl(i,o)),i.compare(s)===0?e:"hour"in e?e.set({year:i.year,month:i.month,day:i.day}):i}function La(e,t,n,s,r,o){switch(t){case"start":return Kt(e,n,s,r,o);case"end":return ai(e,n,s,r,o);default:return Vm(e,n,s,r,o)}}function xt(e,t){return e==null||t==null?e===t:!("hour"in e)&&!("hour"in t)?Se(e,t):Le(e).compare(Le(t))===0}function Oa(e,t,n,s,r){return e?t?.(e,n)?!0:_e(e,s,r):!1}function _e(e,t,n){return t!=null&&e.compare(t)<0||n!=null&&e.compare(n)>0}function Nm(e,t,n){const s=e.subtract({days:1});return Se(s,e)||_e(s,t,n)}function Fm(e,t,n){const s=e.add({days:1});return Se(s,e)||_e(s,t,n)}function ci(e){let t={...e};for(let n in t)t[n]=1;return t}function xl(e,t){let n={...t};return n.days?n.days--:n.days=-1,e.add(n)}function Sl(e){if(!e)return;const t=e.calendar.identifier;return t==="gregory"||t==="iso8601"?e.era==="BC"?"short":void 0:"short"}function $l(e,t,n){const s=n??Le(wr(t));return new Ae(e,{weekday:"long",month:"long",year:"numeric",day:"numeric",era:Sl(s),calendar:s.calendar.identifier,timeZone:t})}function Ma(e,t,n){const s=n??wr(t);return new Ae(e,{month:"long",year:"numeric",era:Sl(s),calendar:s.calendar.identifier,timeZone:t})}function Hm(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 h=o[c];if(h.source==="shared"&&h.type==="literal")i=c;else if(h.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 $s(e,t,n,s){if(!e)return"";let r=e,o=t??e,i=$l(n,s);return Se(r,o)?i.format(r.toDate(s)):Hm(r,o,i,(a,l)=>`${a} – ${l}`,s)}var _m=["sun","mon","tue","wed","thu","fri","sat"];function Il(e){return e!=null?_m[e]:void 0}function Tl(e,t,n){const s=Il(n);return $t(e,t,s)}function Cl(e,t,n,s){const r=t.add({weeks:e}),o=[];let i=Tl(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 Bm(e,t,n,s){const r=Il(s),o=n??fm(e,t,r);return[...new Array(o).keys()].map(a=>Cl(a,e,t,s))}function jm(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 Wm(e,t,n,s){const r=Tl(e,s,t),o=[...new Array(7).keys()],i=jm(s,n);return o.map(a=>i(r.add({days:a})))}function Um(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 Da(e,t){const n=$t(e,t,"mon"),s=n.year,r=n.set({month:1,day:4}),o=$t(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=$t(l,t,"mon"),h=c.calendar.toJulianDay(c);return 1+Math.floor((i-h)/7)}function qm(e){const t=[];for(let n=e.from;n<=e.to;n+=1)t.push(n);return t}var Gm=1900,Ym=2099;function Km(e,t,n){const s=e.calendar,r=t?.year??le(new Pe(Gm,1,1),s).year,o=n?.year??le(new Pe(Ym,12,31),s).year;return{from:r,to:o}}var zm=10;function Zm(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+zm?(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 Yn(e,t){const n=wr(e??si());return t?le(n,t):n}function rs(e,t,n,s){return function(o){const{startDate:i,focusedDate:a}=o,l=xl(i,e);return _e(a,n,s)?{startDate:i,focusedDate:ke(a,n,s),endDate:l}:a.compare(i)<0?{startDate:ai(a,e,t,n,s),focusedDate:ke(a,n,s),endDate:l}:a.compare(l)>0?{startDate:Kt(a,e,t,n,s),endDate:l,focusedDate:ke(a,n,s)}:{startDate:i,endDate:l,focusedDate:ke(a,n,s)}}}function kl(e,t,n,s,r,o){const i=rs(n,s,r,o),a=t.add(n);return i({focusedDate:e.add(n),startDate:Kt(ss(e,a,n,s,r,o),n,s)})}function Al(e,t,n,s,r,o){const i=rs(n,s,r,o);let a=t.subtract(n);return i({focusedDate:e.subtract(n),startDate:Kt(ss(e,a,n,s,r,o),n,s)})}function Jm(e,t,n,s,r,o,i){const a=rs(s,r,o,i);if(!n&&!s.days)return a({focusedDate:e.add(ci(s)),startDate:t});if(s.days)return kl(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 Xm(e,t,n,s,r,o,i){const a=rs(s,r,o,i);if(!n&&!s.days)return a({focusedDate:e.subtract(ci(s)),startDate:t});if(s.days)return Al(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 Ra=new Map;function Qm(e){let t=Ra.get(e);return t!=null||(t="0123456789"+new Intl.NumberFormat(e,{useGrouping:!1}).format(1234567890),Ra.set(e,t)),t}var ev=(e,t)=>t?Qm(t).includes(e):/\d/.test(e),Ll=(e,t,n)=>!e||e.length!==1?!0:ev(e,n)||t.includes(e),tv=(e,t,n)=>e.split("").filter(s=>Ll(s,t,n)).join(""),Pa=new Map;function nv(e){let t=Pa.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:"/",Pa.set(e,t),t}var Va=e=>e!=null&&e.length===4,sv=e=>e!=null&&parseFloat(e)<=12,rv=e=>e!=null&&parseFloat(e)<=31;function ov(e,t,n){const s=iv(t,n);let{year:r,month:o,day:i}=av(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(Va(r)||(r=Zm(r)),Va(r)&&sv(o)&&rv(i))return new Pe(+r,+o,+i);const l=Date.parse(e);if(!isNaN(l)){const c=new Date(l);return new Pe(c.getFullYear(),c.getMonth()+1,c.getDate())}}function iv(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 av(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 Na(e,t,n){const s=_t(rl(n));switch(e){case"thisWeek":return[$t(s,t),Ta(s,t)];case"thisMonth":return[et(s),s];case"thisQuarter":return[et(s).add({months:-((s.month-1)%3)}),s];case"thisYear":return[Xn(s),s];case"last3Days":return[s.add({days:-2}),s];case"last7Days":return[s.add({days:-6}),s];case"last14Days":return[s.add({days:-13}),s];case"last30Days":return[s.add({days:-29}),s];case"last90Days":return[s.add({days:-89}),s];case"lastMonth":return[et(s.add({months:-1})),Io(s.add({months:-1}))];case"lastQuarter":return[et(s.add({months:-((s.month-1)%3)-3})),Io(s.add({months:-((s.month-1)%3)-1}))];case"lastWeek":return[$t(s,t).add({weeks:-1}),Ta(s,t).add({weeks:-1})];case"lastYear":return[Xn(s.add({years:-1})),dm(s.add({years:-1}))];default:throw new Error(`Invalid date range preset: ${e}`)}}var cv=(e,t)=>e.ids?.label?.(t)??`datepicker:${e.id}:label:${t}`,lv=e=>e.ids?.root??`datepicker:${e.id}`,dv=(e,t)=>e.ids?.table?.(t)??`datepicker:${e.id}:table:${t}`,Ao=e=>e.ids?.content??`datepicker:${e.id}:content`,zr=(e,t)=>e.ids?.cellTrigger?.(t)??`datepicker:${e.id}:cell-trigger:${t}`,uv=(e,t)=>e.ids?.prevTrigger?.(t)??`datepicker:${e.id}:prev:${t}`,fv=(e,t)=>e.ids?.nextTrigger?.(t)??`datepicker:${e.id}:next:${t}`,hv=(e,t)=>e.ids?.viewTrigger?.(t)??`datepicker:${e.id}:view:${t}`,Ol=e=>e.ids?.clearTrigger??`datepicker:${e.id}:clear`,Ml=e=>e.ids?.control??`datepicker:${e.id}:control`,Fa=(e,t)=>e.ids?.input?.(t)??`datepicker:${e.id}:input:${t}`,Dl=e=>e.ids?.trigger??`datepicker:${e.id}:trigger`,Rl=e=>e.ids?.positioner??`datepicker:${e.id}:positioner`,Pl=e=>e.ids?.monthSelect??`datepicker:${e.id}:month-select`,Vl=e=>e.ids?.yearSelect??`datepicker:${e.id}:year-select`,Ha=(e,t)=>$f(nn(e),`[data-part=table-cell-trigger][data-view=${t}][data-focus]:not([data-outside-range])`),Vs=e=>e.getById(Dl(e)),nn=e=>e.getById(Ao(e)),jn=e=>Sf(Nl(e),"[data-part=input]"),pv=e=>e.getById(Vl(e)),gv=e=>e.getById(Pl(e)),mv=e=>e.getById(Ol(e)),_a=e=>e.getById(Rl(e)),Nl=e=>e.getById(Ml(e)),Ba=e=>{const t=jn(e);if(t.length===0){Vs(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 Ns(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 Is(e){return e.slice().filter(t=>t!=null).sort((t,n)=>t.compare(n))}function vv(e,t){return new Ae(e).formatToParts(new Date).map(n=>t[n.type]??n.value).join("")}var ja=e=>!Number.isNaN(e.day)&&!Number.isNaN(e.month)&&!Number.isNaN(e.year),yv={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 no(e,{year:"Switch to previous decade",month:"Switch to previous year",day:"Switch to previous month"})},nextTrigger(e){return no(e,{year:"Switch to next decade",month:"Switch to next year",day:"Switch to next month"})},placeholder(){return{day:"dd",month:"mm",year:"yyyy"}},content:"calendar",monthSelect:"Select month",yearSelect:"Select year",clearTrigger:"Clear selected dates",weekColumnHeader:"Wk",weekNumberCell(e){return`Week ${e}`}};function ot(e,t){return e?e==="day"?0:e==="month"?1:2:t||0}function li(e){return e===0?"day":e===1?"month":"year"}function di(e,t,n){return li(hu(ot(e,0),ot(t,0),ot(n,2)))}function bv(e,t){return ot(e,0)>ot(t,0)}function wv(e,t){return ot(e,0)<ot(t,0)}function Fl(e,t,n){const s=ot(e,0)+1;return di(li(s),t,n)}function Ev(e,t,n){const s=ot(e,0)-1;return di(li(s),t,n)}var xv=["day","month","year"];function Sv(e){xv.forEach(t=>e(t))}var $v=xp(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),f=u.at(0).toString(),p=u.at(-1).toString();return{start:f,end:p,formatted:`${f} - ${p}`}}if(e==="month"){const u=new Ae(r,{year:"numeric",timeZone:o,calendar:n.calendar.identifier}),f=u.format(n.toDate(o)),p=u.format(s.toDate(o)),g=i==="range"?`${f} - ${p}`:f;return{start:f,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)),h=i==="range"?`${l} - ${c}`:l;return{start:l,end:c,formatted:h}});function Iv(e,t){const{state:n,context:s,prop:r,send:o,computed:i,scope:a}=e,l=s.get("startValue"),c=i("endValue"),h=s.get("value"),u=s.get("focusedValue"),f=s.get("hoveredValue"),p=f?Ns([h[0],f]):[],g=!!r("disabled"),d=!!r("readOnly"),m=!!r("invalid"),y=i("isInteractive"),T=h.length===0,E=r("min"),L=r("max"),x=r("locale"),A=r("timeZone"),b=r("startOfWeek"),S=n.matches("focused"),D=n.matches("open"),M=r("selectionMode")==="range",w=r("selectionMode")==="multiple",O=r("isDateUnavailable"),R=r("maxSelectedDates"),V=w&&R!=null&&h.length>=R,H=s.get("currentPlacement"),K=H?Mc(H):void 0,re=Dc({...r("positioning"),placement:H}),z=nv(x),j=sc(yv,r("translations"));function be(k=l){const $=r("fixedWeeks")?6:void 0;return Bm(k,x,$,b)}function Ot(k={}){const{format:$}=k;return Um(x,$,u).map((v,I)=>{const N=I+1,Q=u.set({month:N}),W=_e(Q,E,L);return{label:v,value:N,disabled:W}})}function $e(){const k=Km(u,E,L);return qm(k).map(v=>({label:v.toString(),value:v,disabled:!kr(v,E?.year,L?.year)}))}function Ye(k){return Oa(k,O,x,E,L)}function Mt(k){const $=l??Yn(A,u.calendar);o({type:"FOCUS.SET",value:$.set({month:k})})}function Zt(k){const $=l??Yn(A,u.calendar);o({type:"FOCUS.SET",value:$.set({year:k})})}function yt(k){const{value:$,disabled:v}=k,I=u.set({year:$}),Q=!cn(l.year).includes($),W=kr($,E?.year,L?.year),q=M&&en(I,h),ce=M&&h[0]&&Pn(I,h[0]),De=M&&h[1]&&Pn(I,h[1]),Ne=M&&p.length>0,ie=Ne&&en(I,p),Fe=Ne&&p[0]&&Pn(I,p[0]),He=Ne&&p[1]&&Pn(I,p[1]),cs={focused:u.year===k.value,selectable:W,outsideRange:Q,selected:!!h.find(ls=>ls&&ls.year===$),valueText:$.toString(),inRange:q||ie,firstInRange:!!ce,lastInRange:!!De,inHoveredRange:!!ie,firstInHoveredRange:!!Fe,lastInHoveredRange:!!He,value:I,get disabled(){return v||!cs.selectable}};return cs}function Dt(k){const{value:$,disabled:v}=k,I=u.set({month:$}),N=Ma(x,A,u),Q=M&&en(I,h),W=M&&h[0]&&Rn(I,h[0]),q=M&&h[1]&&Rn(I,h[1]),ce=M&&p.length>0,De=ce&&en(I,p),Ne=ce&&p[0]&&Rn(I,p[0]),ie=ce&&p[1]&&Rn(I,p[1]),Fe={focused:u.month===k.value,selectable:!_e(I,E,L),selected:!!h.find(He=>He&&He.month===$&&He.year===u.year),valueText:N.format(I.toDate(A)),inRange:Q||De,firstInRange:!!W,lastInRange:!!q,inHoveredRange:!!De,firstInHoveredRange:!!Ne,lastInHoveredRange:!!ie,outsideRange:!1,value:I,get disabled(){return v||!Fe.selectable}};return Fe}function bt(k){const{value:$,disabled:v,visibleRange:I=i("visibleRange")}=k,N=$l(x,A,u),Q=ci(i("visibleDuration")),W=r("outsideDaySelectable"),q=I.start.add(Q).subtract({days:1}),ce=_e($,I.start,q),De=M&&en($,h),Ne=M&&h[0]&&Se($,h[0]),ie=M&&h[1]&&Se($,h[1]),Fe=M&&p.length>0,He=Fe&&en($,p),cs=Fe&&p[0]&&Se($,p[0]),ls=Fe&&p[1]&&Se($,p[1]),Ii=h.some(Ti=>Ti!=null&&Se($,Ti)),ds={invalid:_e($,E,L),disabled:v||!W&&ce||_e($,E,L)||V&&!Ii,selected:Ii,unavailable:Oa($,O,x,E,L)&&!v,outsideRange:ce,today:im($,A),weekend:pm($,x),value:$,valueText:N.format($.toDate(A)),get focused(){return u!=null&&Se($,u)&&(!ds.outsideRange||W)},get selectable(){return!ds.disabled&&!ds.unavailable},inRange:De||He,firstInRange:Ne,lastInRange:ie,inHoveredRange:He,firstInHoveredRange:cs,lastInHoveredRange:ls};return ds}function $n(k){const{view:$="day",id:v}=k;return[$,v].filter(Boolean).join(" ")}return{focused:S,open:D,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(k){return Na(k,x,A)},getWeekNumber(k){const $=k[0];return $?Da($,x):0},getDaysInWeek(k,$=l){return Cl(k,$,x,b)},getOffset(k){const $=l.add(k),v=c.add(k),I=Ma(x,A,u);return{visibleRange:{start:$,end:v},weeks:be($),visibleRangeText:{start:I.format($.toDate(A)),end:I.format(v.toDate(A))}}},getMonthWeeks:be,isUnavailable:Ye,weeks:be(),weekDays:Wm(l,b,A,x),visibleRangeText:i("visibleRangeText"),value:h,valueAsDate:h.filter(k=>k!=null).map(k=>k.toDate(A)),valueAsString:i("valueAsString"),focusedValue:u,focusedValueAsDate:u?.toDate(A),focusedValueAsString:r("format")(u,{locale:x,timeZone:A}),visibleRange:i("visibleRange"),selectToday(){const k=ke(Yn(A,u.calendar),E,L);o({type:"VALUE.SET",value:[k]})},setValue(k){const $=k.map(v=>ke(v,E,L));o({type:"VALUE.SET",value:$})},setTime(k,$=0){const v=Array.from(h);let I=v[$];I&&("hour"in I||(I=Le(I)),I=I.set({hour:k.hour??("hour"in I?I.hour:0),minute:k.minute??("minute"in I?I.minute:0),second:k.second??("second"in I?I.second:0),millisecond:k.millisecond??("millisecond"in I?I.millisecond:0)}),v[$]=ke(I,E,L),o({type:"VALUE.SET",value:v}))},clearValue(k={}){const{focus:$=!0}=k;o({type:"VALUE.CLEAR",focus:$})},setFocusedValue(k){o({type:"FOCUS.SET",value:k})},setOpen(k){r("inline")||o({type:k?"OPEN":"CLOSE",replaces:"open"})},focusMonth:Mt,focusYear:Zt,getYears:$e,getMonths:Ot,getYearsGrid(k={}){const{columns:$=1}=k,v=cn(l.year).map(I=>({label:I.toString(),value:I,disabled:!kr(I,E?.year,L?.year)}));return Mi(v,$)},getDecade(){const k=cn(l.year);return{start:k.at(0),end:k.at(-1)}},getMonthsGrid(k={}){const{columns:$=1,format:v}=k;return Mi(Ot({format:v}),$)},format(k,$={month:"long",year:"numeric"}){return new Ae(x,{...$,calendar:k.calendar.identifier}).format(k.toDate(A))},setView(k){o({type:"VIEW.SET",view:k})},goToNext(){o({type:"GOTO.NEXT",view:s.get("view")})},goToPrev(){o({type:"GOTO.PREV",view:s.get("view")})},getRootProps(){return t.element({...Z.root.attrs,dir:r("dir"),id:lv(a),"data-state":D?"open":"closed","data-disabled":P(g),"data-readonly":P(d),"data-empty":P(T)})},getLabelProps(k={}){const{index:$=0}=k;return t.label({...Z.label.attrs,id:cv(a,$),dir:r("dir"),htmlFor:Fa(a,$),"data-state":D?"open":"closed","data-index":$,"data-disabled":P(g),"data-readonly":P(d),"data-invalid":P(m)})},getControlProps(){return t.element({...Z.control.attrs,dir:r("dir"),id:Ml(a),"data-disabled":P(g),"data-placeholder-shown":P(T),"data-invalid":P(m)})},getRangeTextProps(){return t.element({...Z.rangeText.attrs,dir:r("dir")})},getContentProps(){return t.element({...Z.content.attrs,hidden:!D,dir:r("dir"),"data-state":D?"open":"closed","data-placement":H,"data-side":K,"data-inline":P(r("inline")),id:Ao(a),tabIndex:-1,role:"application","aria-label":j.content})},getTableProps(k={}){const{view:$="day",columns:v=$==="day"?7:4}=k,I=$n(k);return t.element({...Z.table.attrs,role:"grid","data-columns":v,"aria-label":i("visibleRangeText").formatted,id:dv(a,I),"aria-readonly":fe(d),"aria-disabled":fe(g),"aria-multiselectable":fe(r("selectionMode")!=="single"),"data-view":$,dir:r("dir"),tabIndex:-1,onKeyDown(N){if(N.defaultPrevented||g)return;const Q={Enter(){y&&($==="day"&&Ye(u)||$==="month"&&!Dt({value:u.month}).selectable||$==="year"&&!yt({value:u.year}).selectable||o({type:"TABLE.ENTER",view:$,columns:v,focus:!0}))},Space(q){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(q){o({type:"TABLE.PAGE_UP",larger:q.shiftKey,view:$,columns:v,focus:!0})},PageDown(q){o({type:"TABLE.PAGE_DOWN",larger:q.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})}},W=Q[ro(N,{dir:r("dir")})];W&&(W(N),N.preventDefault(),N.stopPropagation())},onPointerLeave(){o({type:"TABLE.POINTER_LEAVE"})},onPointerDown(){o({type:"TABLE.POINTER_DOWN",view:$})},onPointerUp(){o({type:"TABLE.POINTER_UP",view:$})}})},getTableHeadProps(k={}){const{view:$="day"}=k;return t.element({...Z.tableHead.attrs,"aria-hidden":!0,dir:r("dir"),"data-view":$,"data-disabled":P(g)})},getTableHeaderProps(k={}){const{view:$="day"}=k;return t.element({...Z.tableHeader.attrs,dir:r("dir"),"data-view":$,"data-disabled":P(g)})},getTableBodyProps(k={}){const{view:$="day"}=k;return t.element({...Z.tableBody.attrs,"data-view":$,"data-disabled":P(g)})},getTableRowProps(k={}){const{view:$="day"}=k;return t.element({...Z.tableRow.attrs,"aria-disabled":fe(g),"data-disabled":P(g),"data-view":$})},getWeekNumberHeaderCellProps(k={}){const{view:$="day"}=k;return t.element({...Z.tableCell.attrs,scope:"col","aria-label":j.weekColumnHeader,"data-view":$,"data-type":"week-number","data-disabled":P(g)})},getWeekNumberCellProps(k){const{weekIndex:$,week:v}=k,I=v[0]?Da(v[0],x):0;return t.element({...Z.tableCell.attrs,role:"rowheader","aria-label":j.weekNumberCell?.(I),"data-view":"day","data-week-index":$,"data-type":"week-number","data-disabled":P(g)})},getDayTableCellState:bt,getDayTableCellProps(k){const{value:$}=k,v=bt(k);return t.element({...Z.tableCell.attrs,role:"gridcell","aria-disabled":fe(!v.selectable),"aria-selected":v.selected||v.inRange,"aria-invalid":fe(v.invalid),"aria-current":v.today?"date":void 0,"data-value":$.toString()})},getDayTableCellTriggerProps(k){const{value:$}=k,v=bt(k);return t.element({...Z.tableCellTrigger.attrs,id:zr(a,$.toString()),role:"button",dir:r("dir"),tabIndex:g?-1:v.focused?0:-1,"aria-label":j.dayCell(v),"aria-disabled":fe(!v.selectable),"aria-invalid":fe(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:M?I=>{if(I.pointerType==="touch"||!v.selectable)return;const N=!a.isActiveElement(I.currentTarget);f&&om($,f)||o({type:"CELL.POINTER_MOVE",cell:"day",value:$,focus:N,outsideRange:v.outsideRange})}:void 0})},getMonthTableCellState:Dt,getMonthTableCellProps(k){const{value:$,columns:v}=k,I=Dt(k);return t.element({...Z.tableCell.attrs,dir:r("dir"),colSpan:v,role:"gridcell","aria-selected":fe(I.selected||I.inRange),"data-selected":P(I.selected),"aria-disabled":fe(!I.selectable),"data-value":$})},getMonthTableCellTriggerProps(k){const{value:$}=k,v=Dt(k);return t.element({...Z.tableCellTrigger.attrs,id:zr(a,$.toString()),role:"button",dir:r("dir"),tabIndex:g?-1:v.focused?0:-1,"aria-label":v.valueText,"aria-disabled":fe(!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:M?I=>{if(I.pointerType==="touch"||!v.selectable)return;const N=!a.isActiveElement(I.currentTarget);f&&v.value&&Rn(v.value,f)||o({type:"CELL.POINTER_MOVE",cell:"month",value:v.value,focus:N})}:void 0})},getYearTableCellState:yt,getYearTableCellProps(k){const{value:$,columns:v}=k,I=yt(k);return t.element({...Z.tableCell.attrs,dir:r("dir"),colSpan:v,role:"gridcell","aria-selected":fe(I.selected||I.inRange),"data-selected":P(I.selected),"aria-disabled":fe(!I.selectable),"data-value":$})},getYearTableCellTriggerProps(k){const{value:$}=k,v=yt(k);return t.element({...Z.tableCellTrigger.attrs,id:zr(a,$.toString()),role:"button",dir:r("dir"),tabIndex:g?-1:v.focused?0:-1,"aria-label":v.valueText,"aria-disabled":fe(!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:M?I=>{if(I.pointerType==="touch"||!v.selectable||v.outsideRange)return;const N=!a.isActiveElement(I.currentTarget);f&&v.value&&Pn(v.value,f)||o({type:"CELL.POINTER_MOVE",cell:"year",value:v.value,focus:N})}:void 0})},getNextTriggerProps(k={}){const{view:$="day"}=k,v=g||!i("isNextVisibleRangeValid");return t.button({...Z.nextTrigger.attrs,dir:r("dir"),id:fv(a,$),type:"button","aria-label":j.nextTrigger($),disabled:v,"data-disabled":P(v),onClick(I){I.defaultPrevented||o({type:"GOTO.NEXT",view:$})}})},getPrevTriggerProps(k={}){const{view:$="day"}=k,v=g||!i("isPrevVisibleRangeValid");return t.button({...Z.prevTrigger.attrs,dir:r("dir"),id:uv(a,$),type:"button","aria-label":j.prevTrigger($),disabled:v,"data-disabled":P(v),onClick(I){I.defaultPrevented||o({type:"GOTO.PREV",view:$})}})},getClearTriggerProps(){return t.button({...Z.clearTrigger.attrs,id:Ol(a),dir:r("dir"),type:"button","aria-label":j.clearTrigger,hidden:!h.length,onClick(k){k.defaultPrevented||y&&o({type:"VALUE.CLEAR"})}})},getTriggerProps(){return t.button({...Z.trigger.attrs,id:Dl(a),dir:r("dir"),type:"button","data-placement":H,"data-side":K,"aria-label":j.trigger(D),"aria-controls":Ao(a),"aria-expanded":D,"data-state":D?"open":"closed","data-placeholder-shown":P(T),"aria-haspopup":"grid",disabled:g,onClick(k){k.defaultPrevented||y&&o({type:"TRIGGER.CLICK"})}})},getViewProps(k={}){const{view:$="day"}=k;return t.element({...Z.view.attrs,"data-view":$,hidden:s.get("view")!==$})},getViewTriggerProps(k={}){const{view:$="day"}=k,v=Fl($,r("minView"),r("maxView")),I=v!==$,N=g||!I;return t.button({...Z.viewTrigger.attrs,"data-view":$,dir:r("dir"),id:hv(a,$),type:"button",disabled:N,"data-disabled":P(N),"aria-label":j.viewTrigger($,I?v:void 0),onClick(Q){Q.defaultPrevented||y&&o({type:"VIEW.TOGGLE",src:"viewTrigger"})}})},getViewControlProps(k={}){const{view:$="day"}=k;return t.element({...Z.viewControl.attrs,"data-view":$,dir:r("dir")})},getInputProps(k={}){const{index:$=0,fixOnBlur:v=!0}=k;return t.input({...Z.input.attrs,id:Fa(a,$),autoComplete:"off",autoCorrect:"off",spellCheck:"false",dir:r("dir"),name:r("name"),"data-index":$,"data-state":D?"open":"closed","data-placeholder-shown":P(T),readOnly:d,disabled:g,required:r("required"),"aria-invalid":fe(m),"data-invalid":P(m),placeholder:r("placeholder")||vv(x,j.placeholder(x)),defaultValue:i("valueAsString")[$],onBeforeInput(I){const{data:N}=jo(I);Ll(N,z,x)||I.preventDefault()},onClick(I){I.defaultPrevented||r("openOnClick")&&y&&o({type:"OPEN",src:"input.click"})},onFocus(){o({type:"INPUT.FOCUS",index:$})},onBlur(I){const N=I.currentTarget.value.trim();o({type:"INPUT.BLUR",value:N,index:$,fixOnBlur:v})},onKeyDown(I){if(I.defaultPrevented||!y)return;const Q={Enter(W){qu(W)||Ye(u)||W.currentTarget.value.trim()!==""&&o({type:"INPUT.ENTER",value:W.currentTarget.value,index:$})}}[I.key];Q&&(Q(I),I.preventDefault())},onInput(I){const N=I.currentTarget.value;o({type:"INPUT.CHANGE",value:tv(N,z,x),index:$})}})},getMonthSelectProps(){return t.select({...Z.monthSelect.attrs,id:Pl(a),"aria-label":j.monthSelect,disabled:g,dir:r("dir"),defaultValue:l.month,onChange(k){Mt(Number(k.currentTarget.value))}})},getYearSelectProps(){return t.select({...Z.yearSelect.attrs,id:Vl(a),disabled:g,"aria-label":j.yearSelect,dir:r("dir"),defaultValue:l.year,onChange(k){Zt(Number(k.currentTarget.value))}})},getPositionerProps(){return t.element({id:Rl(a),...Z.positioner.attrs,dir:r("dir"),style:re.floating})},getPresetTriggerProps(k){const $=Array.isArray(k.value)?k.value:Na(k.value,x,A),v=$.filter(I=>I!=null).map(I=>I.toDate(A).toDateString());return t.button({...Z.presetTrigger.attrs,"aria-label":j.presetTrigger(v),type:"button",onClick(I){I.defaultPrevented||y&&o({type:"PRESET.CLICK",value:$})}})}}}var Zr="__live-region-debug__",Tv="position:fixed;inset-inline:0;bottom:0;z-index:2147483647;padding:12px 16px;background:black;color:white;font-size:14px;line-height:20px;text-align:center;pointer-events:none;",Cv=100,kv=200,Av={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 Lv(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(Zr);return m||(m=n.createElement("div"),m.id=Zr,m.dataset.liveAnnouncerDebug="true",m.setAttribute("aria-hidden","true"),m.style.cssText=Tv,a().appendChild(m),m)}function h(){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,Av),a().appendChild(m),u=Date.now()+kv,m}let u=0,f=h();function p(){i.clearTimeout(l),l=void 0}function g(m,y=r){p(),f?.isConnected||(f=h());const T=f;T.textContent="",l=i.setTimeout(()=>{l=void 0,T.textContent=m;const E=c();E&&(E.textContent=m)},Math.max(y,Cv,u-Date.now()))}function d(){p(),f?.remove(),f=null,o&&n.getElementById(Zr)?.remove()}return{announce:g,cancel:p,destroy:d,toJSON(){return"live-region"}}}var{and:ye}=Hc();function Ov(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(!xt(e[s],t[s]))return!1;return!0}function Ts(e,t){return e.map(n=>n==null?"":t("format")(n,{locale:t("locale"),timeZone:t("timeZone")}))}var Mv=_c({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:le(p,o),a=e.defaultValue?Is(e.defaultValue).map(p=>ke(i(p),e.min,e.max)):void 0,l=e.value?Is(e.value).map(p=>ke(i(p),e.min,e.max)):void 0;let c=e.focusedValue||e.defaultFocusedValue||l?.[0]||a?.[0]||Yn(n,o);c=ke(i(c),e.min,e.max);const h=e.minView||"day",u=e.maxView||"year",f=di(e.defaultView||e.view||h,h,u);return{locale:t,numOfMonths:r,timeZone:n,selectionMode:s,minView:h,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 ov(p,g,d)},...e,focusedValue:typeof e.focusedValue>"u"?void 0:c,defaultFocusedValue:c,value:l,defaultValue:a??[],defaultView:f,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:xt,hash:s=>s.toString(),sync:!0,onChange(s){const r=n(),o=r.get("view"),i=r.get("value"),a=Ts(i,e);e("onFocusChange")?.({value:i,valueAsString:a,view:o,focusedValue:s})}})),value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:Ov,hash:s=>s.map(r=>r?.toString()??"").join(","),onChange(s){const r=n(),o=Ts(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:xt})),view:t(()=>({defaultValue:e("defaultView"),value:e("view"),onChange(s){e("onViewChange")?.({view:s})}})),startValue:t(()=>{const s=e("focusedValue")||e("defaultFocusedValue");return{defaultValue:La(s,"start",{months:e("numOfMonths")},e("locale")),isEqual:xt,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})=>xl(e.get("startValue"),t("visibleDuration")),visibleRange:({context:e,computed:t})=>({start:e.get("startValue"),end:t("endValue")}),visibleRangeText:({context:e,prop:t,computed:n})=>$v({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})=>!Nm(e.get("startValue"),t("min"),t("max")),isNextVisibleRangeValid:({prop:e,computed:t})=>!Fm(t("endValue"),e("min"),e("max")),valueAsString:({context:e,prop:t})=>Ts(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})=>bv(e.get("view"),t("minView")),isDayView:({context:e,event:t})=>(t.view||e.get("view"))==="day",isMonthView:({context:e,event:t})=>(t.view||e.get("view"))==="month",isYearView:({context:e,event:t})=>(t.view||e.get("view"))==="year",isRangePicker:({prop:e})=>e("selectionMode")==="range",hasSelectedRange:({context:e})=>e.get("value").length===2,isMultiPicker:({prop:e})=>e("selectionMode")==="multiple",canSelectDate:e=>{const{context:t,prop:n,event:s}=e,r=n("maxSelectedDates");if(r==null)return!0;const o=t.get("value"),i=Wn(e,s.value??t.get("focusedValue"));return o.some(l=>xt(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=Nl(n);return po(s,()=>_a(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",Lv({level:"assertive",document:n})),()=>t.get("announcer")?.destroy?.()},trackDismissableElement({scope:e,send:t,context:n,prop:s}){return s("inline")?void 0:Wc(()=>nn(e),{type:"popover",defer:!0,getRootNode:e.getRootNode,layerStyleTargets:[()=>_a(e)],exclude:[...jn(e),Vs(e),mv(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=Fl(e.get("view"),t("minView"),t("maxView"));e.set("view",n)},setPreviousView({context:e,prop:t}){const n=Ev(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=$s(a,l,r,o):a?i=$s(a,null,r,o):l?i=$s(l,null,r,o):i=""}else i=s.map(a=>$s(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}){xf({target:nn(e),doc:e.getDoc()})},enableTextSelection({scope:e}){yc({doc:e.getDoc(),target:nn(e)})},focusFirstSelectedDate(e){const{context:t}=e;t.get("value").length&&te(e,t.get("value")[0])},syncInputElement({scope:e,computed:t}){he(()=>{jn(e).forEach((s,r)=>{hs(s,t("valueAsString")[r]||"")})})},setFocusedDate(e){const{event:t}=e,n=Array.isArray(t.value)?t.value[0]:t.value;te(e,n)},setFocusedValueForView(e){const{context:t,event:n}=e;te(e,t.get("focusedValue").set({[t.get("view")]:n.value}))},focusNextMonth(e){const{context:t}=e;te(e,t.get("focusedValue").add({months:1}))},focusPreviousMonth(e){const{context:t}=e;te(e,t.get("focusedValue").subtract({months:1}))},setDateValue({context:e,event:t,prop:n}){if(!Array.isArray(t.value))return;const s=t.value.map(r=>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=Wn(e,n.value??t.get("focusedValue"));s[r]=Cs(o,i),t.set("value",Ns(s))},resetSelection(e){const{context:t,event:n}=e,s=t.get("value")[0],r=Wn(e,n.value??t.get("focusedValue"));t.set("value",[Cs(s,r)])},toggleSelectedDate(e){const{context:t,event:n}=e,s=Wn(e,n.value??t.get("focusedValue")),r=t.get("value"),o=r.findIndex(i=>xt(i,s));if(o===-1){const i=[...r,s];t.set("value",Is(i))}else{const i=Array.from(r);i.splice(o,1),t.set("value",Is(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]=Cs(r,o),e.set("value",Ns(n));const i=t("valueAsString");e.set("inputValue",i[s])},focusPreviousDay(e){const{context:t}=e,n=t.get("focusedValue").subtract({days:1});te(e,n)},focusNextDay(e){const{context:t}=e,n=t.get("focusedValue").add({days:1});te(e,n)},focusPreviousWeek(e){const{context:t}=e,n=t.get("focusedValue").subtract({weeks:1});te(e,n)},focusNextWeek(e){const{context:t}=e,n=t.get("focusedValue").add({weeks:1});te(e,n)},focusNextPage(e){const{context:t,computed:n,prop:s}=e,r=kl(t.get("focusedValue"),t.get("startValue"),n("visibleDuration"),s("locale"),s("min"),s("max"));ks(e,r)},focusPreviousPage(e){const{context:t,computed:n,prop:s}=e,r=Al(t.get("focusedValue"),t.get("startValue"),n("visibleDuration"),s("locale"),s("min"),s("max"));ks(e,r)},focusSectionStart(e){const{context:t}=e;te(e,t.get("startValue").copy())},focusSectionEnd(e){const{computed:t}=e;te(e,t("endValue").copy())},focusNextSection(e){const{context:t,event:n,computed:s,prop:r}=e,o=Jm(t.get("focusedValue"),t.get("startValue"),n.larger,s("visibleDuration"),r("locale"),r("min"),r("max"));o&&ks(e,o)},focusPreviousSection(e){const{context:t,event:n,computed:s,prop:r}=e,o=Xm(t.get("focusedValue"),t.get("startValue"),n.larger,s("visibleDuration"),r("locale"),r("min"),r("max"));o&&ks(e,o)},focusNextYear(e){const{context:t}=e,n=t.get("focusedValue").add({years:1});te(e,n)},focusPreviousYear(e){const{context:t}=e,n=t.get("focusedValue").subtract({years:1});te(e,n)},focusNextDecade(e){const{context:t}=e,n=t.get("focusedValue").add({years:10});te(e,n)},focusPreviousDecade(e){const{context:t}=e,n=t.get("focusedValue").subtract({years:10});te(e,n)},clearFocusedDate(e){const{context:t,prop:n}=e,s=t.get("focusedValue").calendar;te(e,Yn(n("timeZone"),s))},focusPreviousMonthColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").subtract({months:n.columns});te(e,s)},focusNextMonthColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").add({months:n.columns});te(e,s)},focusPreviousYearColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").subtract({years:n.columns});te(e,s)},focusNextYearColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").add({years:n.columns});te(e,s)},focusFirstMonth(e){const{context:t}=e,n=t.get("focusedValue"),s=n.calendar.getMinimumMonthInYear?.(n)??1;te(e,n.set({month:s}))},focusLastMonth(e){const{context:t}=e,n=t.get("focusedValue"),s=n.calendar.getMonthsInYear(n);te(e,n.set({month:s}))},focusFirstYear(e){const{context:t}=e,n=cn(t.get("focusedValue").year),s=t.get("focusedValue").set({year:n[0]});te(e,s)},focusLastYear(e){const{context:t}=e,n=cn(t.get("focusedValue").year),s=t.get("focusedValue").set({year:n[n.length-1]});te(e,s)},setActiveIndex({context:e,event:t}){e.set("activeIndex",t.index)},setActiveIndexToEnd({context:e}){e.set("activeIndex",1)},setActiveIndexToStart({context:e}){e.set("activeIndex",0)},resumeRangeSelection({context:e,prop:t}){t("selectionMode")==="range"&&e.get("value").length===1&&e.set("activeIndex",1)},focusActiveCell({scope:e,context:t,event:n}){n.src!=="input.click"&&he(()=>{const s=t.get("view");Ha(e,s)?.focus({preventScroll:!0})})},focusActiveCellIfNeeded({scope:e,context:t,event:n}){n.focus&&he(()=>{const s=t.get("view");Ha(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=Dv(t);he(()=>{Vi(e.getActiveElement(),[n])||Vs(e)?.focus(s)})},focusFirstInputElement({scope:e,event:t}){t.focus!==!1&&he(()=>{const[n]=jn(e);(n??Vs(e))?.focus({preventScroll:!0})})},focusInputElement({scope:e}){he(()=>Ba(e))},restoreFocusToInput({scope:e}){const t=nn(e);he(()=>{Vi(e.getActiveElement(),[t])||Ba(e)})},syncMonthSelectElement({scope:e,context:t}){const n=gv(e);hs(n,t.get("startValue").month.toString())},syncYearSelectElement({scope:e,context:t}){const n=pv(e);hs(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=jn(e),r=n.index??t.get("activeIndex");hs(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||!ja(r)||te(e,r)},selectParsedDate({context:e,event:t,prop:n}){if(t.index==null)return;let r=n("parse")(t.value,{locale:n("locale"),timeZone:n("timeZone")});if((!r||!ja(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]=Cs(o[t.index],r);const i=Ns(o);e.set("value",i);const a=Ts(i,n);e.set("inputValue",a[t.index])},resetView({context:e}){e.set("view",e.initial("view"))},setStartValue({context:e,computed:t,prop:n}){const s=e.get("focusedValue");if(!_e(s,e.get("startValue"),t("endValue")))return;const o=La(s,"start",{months:n("numOfMonths")},n("locale"));e.set("startValue",o)},invokeOnOpen({prop:e,context:t}){e("inline")||e("onOpenChange")?.({open:!0,value:t.get("value")})},invokeOnClose({prop:e,context:t}){e("inline")||e("onOpenChange")?.({open:!1,value:t.get("value")})},invokeOnVisibleRangeChange({prop:e,context:t,computed:n}){e("onVisibleRangeChange")?.({view:t.get("view"),visibleRange:n("visibleRange")})},toggleVisibility({event:e,send:t,prop:n}){t({type:n("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:e})}}}}),Wn=(e,t)=>{const{context:n,prop:s}=e,r=n.get("view");let o=typeof t=="number"?n.get("focusedValue").set({[r]:t}):t;return Sv(i=>{wv(i,s("minView"))&&(o=o.set({[i]:i==="day"?1:0}))}),o},Cs=(e,t)=>{if(!e||!("hour"in e))return t;const n="timeZone"in e;let s=t;return"hour"in t||(n?s=hl(Le(t),e.timeZone):s=Le(t)),s.set({hour:e.hour,minute:e.minute,second:e.second,millisecond:e.millisecond})};function te(e,t){const{context:n,prop:s,computed:r}=e;if(!t)return;const o=Wn(e,t);if(xt(n.get("focusedValue"),o))return;const a=rs(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 ks(e,t){const{context:n}=e;n.set("startValue",t.startDate);const s=n.get("focusedValue");xt(s,t.focusedDate)||n.set("focusedValue",t.focusedDate)}function Dv(e){return e.focusVisible??e.previousEvent?.focusVisible?{preventScroll:!0,focusVisible:!0}:{preventScroll:!0}}function Hl(e){return Array.isArray(e)?e.map(t=>Hl(t)):e instanceof Date?new Pe(e.getFullYear(),e.getMonth()+1,e.getDate()):km(e)}const Jr=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>`,Xr=e=>{try{return/^\d{4}-\d{2}-\d{2}$/.test(e)?Hl(e):void 0}catch{return}};function Rv(e,t,n){e.innerHTML=`<div class="date-control"><button class="icon-button date-trigger" type="button" aria-label="Custom date range" title="Custom date range"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><rect x="3" y="5" width="18" height="16" rx="3"/><path d="M7 3v4m10-4v4M3 11h18m-12 5h4"/></svg></button></div>
91
- <div class="date-positioner" popover="manual"><section class="date-popover">
92
- <header class="date-heading"><div><span class="eyebrow">FOCUS YOUR TIMELINE</span><h2>Date range</h2></div><button type="button" class="icon-button date-close" aria-label="Close date range">×</button></header>
93
- <div class="date-fields"><label>From<input id="from-date" aria-label="From date" autocomplete="off" spellcheck="false" placeholder="YYYY-MM-DD"/></label><span aria-hidden="true">→</span><label>To<input id="to-date" aria-label="To date" autocomplete="off" spellcheck="false" placeholder="YYYY-MM-DD"/></label></div>
94
- <div class="date-presets"><button type="button" data-preset="last7Days">Last 7 days</button><button type="button" data-preset="last30Days">Last 30 days</button><button type="button" data-preset="thisMonth">This month</button></div>
95
- <div class="date-calendar"><div class="date-navigation"><button type="button" class="icon-button date-prev">${Jr("left")}</button><button type="button" class="date-view"></button><button type="button" class="icon-button date-next">${Jr("right")}</button></div><div class="date-grids"></div></div>
96
- <footer class="date-footer"><span class="date-status" role="status"></span><button id="apply-dates" class="primary-button" type="button">Apply range ${Jr("right")}</button></footer>
97
- </section></div>`;const s=d=>e.querySelector(d),r=s(".date-trigger"),o=s(".date-positioner"),i=s(".date-popover"),a=[s("#from-date"),s("#to-date")],l=s("#apply-dates"),c=new Yc(Mv,{id:"timeline-dates",selectionMode:"range",closeOnSelect:!1,fixedWeeks:!0,outsideDaySelectable:!0,locale:navigator.language,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,format:d=>d.toString(),parse:Xr,placeholder:"YYYY-MM-DD",positioning:{placement:"top-end",strategy:"fixed",gutter:12,slide:!0},onOpenChange({open:d}){d&&n()}}),h=()=>Iv(c.service,Uc),u=["day","month","year"].map(d=>{const m=document.createElement("table");m.dataset.calendarView=d;const y=m.createTHead(),T=y.insertRow();if(d==="day")for(let A=0;A<7;A++)T.append(document.createElement("th"));const E=m.createTBody(),L=d==="day"?6:4,x=d==="day"?7:3;for(let A=0;A<L;A++){const b=E.insertRow();for(let S=0;S<x;S++){const D=document.createElement("button");D.type="button",b.insertCell().append(D)}}return s(".date-grids").append(m),{view:d,table:m,head:y,body:E}});function f(){const d=a.map(T=>Xr(T.value)),m=!!(d[0]&&d[1]&&d[0].compare(d[1])<=0);l.disabled=!m;for(const[T,E]of a.entries())E.setAttribute("aria-invalid",String(!!E.value&&!d[T]));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=h();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((T,E)=>se(T,{...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:T,table:E,head:L,body:x}of u){E.hidden=d.view!==T,se(E,d.getTableProps({view:T,columns:T==="day"?7:3})),se(L,d.getTableHeaderProps({view:T})),se(x,d.getTableBodyProps({view:T})),T==="day"&&d.weekDays.forEach((b,S)=>{const D=L.rows[0].cells[S];D.scope="col",D.setAttribute("aria-label",b.long),D.textContent!==b.short&&(D.textContent=b.short)});const A=T==="day"?d.weeks:T==="month"?d.getMonthsGrid({columns:3,format:"short"}):d.getYearsGrid({columns:3});Array.from(x.rows).forEach((b,S)=>{se(b,d.getTableRowProps({view:T})),Array.from(b.cells).forEach((D,M)=>{const w=A[S]?.[M],O=D.firstElementChild;if(D.hidden=!w,!!w)if(T==="day"){const R=d.weeks[S][M];se(D,d.getDayTableCellProps({value:R})),se(O,d.getDayTableCellTriggerProps({value:R})),O.textContent!==String(R.day)&&(O.textContent=String(R.day))}else{const R=w;se(D,T==="month"?d.getMonthTableCellProps({...R,columns:3}):d.getYearTableCellProps({...R,columns:3})),se(O,T==="month"?d.getMonthTableCellTriggerProps({...R}):d.getYearTableCellTriggerProps({...R})),O.textContent!==R.label&&(O.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),f()}s(".date-close").addEventListener("click",()=>h().setOpen(!1));for(const d of e.querySelectorAll("[data-preset]"))d.addEventListener("click",()=>{const m=h(),y=m.getRangePresetValue(d.dataset.preset);m.setValue(y),m.setFocusedValue(y[0]),m.setView("day")});l.addEventListener("click",()=>{f(),l.disabled||(t(a[0].value,a[1].value),h().setOpen(!1))}),i.addEventListener("input",f),e.addEventListener("keydown",d=>d.stopPropagation());const g=c.subscribe(p);return c.start(),p(),{setRange(d,m){const y=[d,m].map(Xr).filter(T=>T!==void 0);h().setValue(y),y[0]&&h().setFocusedValue(y[0])},dispose(){g(),c.stop(),e.replaceChildren()}}}const Pv={Search:kd,GitFork:md,GitBranch:gd,Folder:pd,ArrowUpRight:od,ArrowRight:rd,X:Rd,Box:id,RotateCcw:Cd,RefreshCw:Td,Play:Id,Pause:$d,ChevronDown:ad,FileCode2:hd,Terminal:Md,Copy:dd,Crosshair:ud,CircleHelp:cd,SlidersHorizontal:Od,LoaderCircle:yd,Network:wd,Clock:ld,Sparkles:Ya,Grip:vd,PanelRight:xd,Settings2:Ad,Volume2:Ka,VolumeX:Dd,Share2:Ld},Oe=()=>{Pd({icons:Pv,attrs:{"stroke-width":1.5}}),Jn()},F=(e,t="")=>`<i data-lucide="${e}" class="${t}" aria-hidden="true"></i>`,C=e=>document.querySelector(e),X=e=>e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]),_l=e=>Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}).format(e),pe=e=>e.toLocaleString("en"),Vv=[new Intl.DateTimeFormat("en",{month:"short",day:"numeric"}),new Intl.DateTimeFormat("en",{month:"short",day:"numeric",year:"numeric"})],Nv=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}),Fv=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit"}),mn=(e,t=!1)=>Vv[Number(t)].format(e),vn=e=>Nv.format(e),Wa=e=>{const t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`};let J,ne={nodes:[],edges:[],lanes:[],start:0,end:0},ge=[],ui=[],Bl=new Set,Fs=new Map,es=new Map,jl=new Map,ee,Wl=!0,Un,B=new URLSearchParams(location.search).get("session"),je,Re,Hs=0,gt="",it="",We="",at=0,ct="",lt="",yn=!0,qt=!1,ln=60,_s=0,Lo,Oo,fi=0,kt=!1,oe=1,nr=0,Kn=0,Ze=Kc([]),Mo="",Ul=Zc([]),Bs,Qr,U={...vr},Gt=!0,xr,dt,ts=!1,Do="";try{U=Jc(localStorage)}catch{Gt=!1}const sr=matchMedia("(prefers-reduced-motion: reduce)");C("#app").innerHTML=`
98
- <main class="map" aria-label="Session map">
99
- <h1 class="sr-only">SessionGraph — Explore &amp; visualize all your LLM sessions</h1>
100
- <div id="scene"></div>
101
- <div class="canvas-vignette"></div>
102
- <div id="graph-message" class="graph-message"><div class="loading-orbit"><span></span><span></span><span></span></div><h3>Loading sessions…</h3></div>
103
- <div id="tooltip" class="node-tooltip" hidden></div>
104
- </main>
105
- <header class="app-header glass">
106
- <a class="brand" href="/" aria-label="SessionGraph home" title="Explore &amp; visualize all your LLM sessions"><img src="/favicon.svg" alt=""/><span>SessionGraph<span class="brand-dot">.</span></span></a>
107
- <span class="connection" role="status" title="Connecting"><span class="status-dot"></span><span id="connection-label" class="sr-only">Connecting</span></span>
108
- <span class="toolbar-divider"></span>
109
- <button class="toolbar-button" id="toggle-explorer" aria-label="Toggle sessions" aria-controls="explorer" aria-expanded="true" title="Sessions">${F("search")}<span>Sessions</span></button>
110
- </header>
111
- <nav class="map-controls glass" aria-label="Map controls">
112
- <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>
113
- <span class="toolbar-divider"></span>
114
- <button class="icon-button" id="reset-camera" aria-label="Fit view" title="Fit view (F)">${F("crosshair")}</button>
115
- <button class="icon-button" id="toggle-timeline" aria-label="Toggle timeline" aria-controls="timeline" aria-expanded="true" title="Timeline">${F("clock")}</button>
116
- <button class="icon-button" id="toggle-inspector" aria-label="Toggle session details" aria-controls="inspector" aria-expanded="false" title="Session details" hidden>${F("panel-right")}</button>
117
- <button class="icon-button" id="help" aria-label="Help" title="Help">${F("circle-help")}</button>
118
- <button class="icon-button" id="mute-audio" aria-label="Mute sound" title="Mute sound" aria-pressed="false" data-sound="none">${F("volume-2")}</button>
119
- <button class="icon-button" id="open-settings" aria-label="Settings" title="Settings" aria-haspopup="dialog">${F("settings-2")}</button>
120
- </nav>
121
- <aside class="sidebar floating-panel glass" id="explorer" aria-label="Sessions">
122
- <div class="panel-heading"><button class="panel-handle" data-drag-panel="explorer" aria-label="Move sessions panel" title="Drag to move · Arrow keys to reposition">${F("grip")}<span>Sessions</span><span class="small-badge" id="list-count">—</span></button><button class="icon-button" id="refresh" aria-label="Refresh sessions" title="Refresh sessions">${F("refresh-cw")}</button><button class="icon-button" id="close-explorer" aria-label="Close sessions">${F("x")}</button></div>
123
- <button class="search-box search-trigger" id="search" aria-label="Search all sessions">${F("search")}<span>Search everything…</span><kbd>/</kbd></button>
124
- <div class="filters">
125
- <div class="filter-row"><div class="select-wrap"><span id="source-filter-icon">${ut()}</span><select id="source" aria-label="Session source"><option value="">All sources</option></select>${F("chevron-down")}</div><button class="icon-button" id="manage-sources" aria-label="Manage sources" title="Import sources">${F("sliders-horizontal")}</button></div>
126
- <div class="select-wrap">${F("folder")}<select id="project" aria-label="Project"><option value="">All projects</option></select>${F("chevron-down")}</div>
127
- <div class="select-wrap">${F("git-branch")}<select id="directory" aria-label="Worktree or directory"><option value="">All directories</option></select>${F("chevron-down")}</div>
128
- <div class="filter-toggles"><label><input type="checkbox" id="children" checked/><span>Child sessions</span></label></div>
129
- </div>
130
- <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>
131
- </aside>
132
- <div class="inspector-stack floating-panel" id="inspector" hidden><aside class="inspector glass" id="session-inspector" aria-label="Session details"></aside></div>
133
- <section class="timeline-panel floating-panel glass" id="timeline" aria-label="Timeline controls">
134
- <div class="timeline-top"><button class="panel-handle" data-drag-panel="timeline" aria-label="Move timeline panel" title="Drag to move · Arrow keys to reposition">${F("grip")}<span id="date-label">Timeline</span></button><div class="range-buttons" role="group" aria-label="Date range"><button data-days="7">7D</button><button data-days="30">30D</button><button data-days="90">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">${F("x")}</button></div>
135
- <div class="timeline-track"><button id="play" class="play-button" aria-label="Play timeline">${F("play")}</button><div class="histogram-wrap"><div id="histogram" class="histogram"></div><input id="scrubber" type="range" min="0" max="1000" value="1000" aria-label="Timeline playback position"/><div class="timeline-cursor" id="timeline-cursor"></div></div><div class="playback-date" id="playback-date">—</div></div>
136
- <div class="playback-period" id="playback-period" aria-label="Approximate playback date">—</div>
137
- <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>
138
- <div class="playback-share"><button id="share-playback" class="primary-button" disabled>${F("share-2")}Share SessionGraph</button></div>
139
- </section>
140
- <dialog id="help-dialog" aria-labelledby="help-title"><button class="icon-button dialog-close" id="close-help" aria-label="Close help">${F("x")}</button><h2 id="help-title">Explore the map</h2><div class="help-rows"><div><span>Orbit</span><kbd>Drag</kbd></div><div><span>Zoom</span><kbd>Scroll / pinch</kbd></div><div><span>Pan</span><kbd>Right-drag</kbd></div><div><span>Fit view</span><kbd>F</kbd></div><div><span>Search everything</span><kbd>/ · ⌘/Ctrl K</kbd></div><div><span>Hide / restore panels</span><kbd>H</kbd></div><div><span>Clear selection</span><kbd>Esc</kbd></div></div>
141
- <div class="graph-legend"><span><i class="legend-node"></i>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>
142
- <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">${F("sparkles")}Animate map</button></dialog>
143
- <div id="toast" class="toast" role="status" hidden></div>
144
- <aside class="shortcut-hints" aria-label="Keyboard shortcuts"><span><kbd>/</kbd>Search</span><span><kbd>F</kbd>Fit view</span><span><kbd>H</kbd>Panels</span><span><kbd>Esc</kbd>Clear selection</span></aside>
145
- `;Oe();Fd();Xg();Sg();const ql=Rv(C(".custom-dates"),(e,t)=>{ct=e,lt=t,Ve(!0)},xe),zt=()=>{const e=!!document.querySelector("dialog[open]");e&&kt&&xe(),ee?.setSuspended(e)},hi=new Ug,It=Wg(C("#tooltip"),C("#scene"),hi),Sr=jg(C("#inspector"),hi,{select:e=>{It.clear(),ee?.selectEvent(e?.id||null),e&&!kt&&(oe=1,xn(),ee?.focusEvent(e))}});function pi(e){const t=J?.sessions.find(n=>n.id===B);t&&(It.clear(),xe(),de("inspector",!0),Sr.open(t,e,e?Re?.revision:void 0))}const os=Hg({change:$r,getArchived:()=>qt,changeArchived:e=>{qt=e,Ve()},visibility:zt,previewSound:()=>{rr.play("select")},getSources:()=>mt.sources(),importSources:e=>mt.select(e),resetPanels:()=>{document.querySelectorAll(".floating-panel").forEach(e=>{e.removeAttribute("style"),delete e.dataset.positioned})}}),rr=new _g(U,os.audioStatus);function is(){ee?.applyPreferences(U),rr.configure(U),document.documentElement.dataset.density=U.density,document.documentElement.dataset.motion=String($o(U,sr.matches)),document.documentElement.style.setProperty("--panel-opacity",`${U.panelOpacity}%`),C("#motion").setAttribute("aria-pressed",String($o(U,sr.matches)));for(const t of["2d","3d"]){const n=C(`#view-${t}`);n.classList.toggle("active",U.view===t),n.setAttribute("aria-pressed",String(U.view===t))}const e=C("#mute-audio");e.setAttribute("aria-pressed",String(U.muted)),e.setAttribute("aria-label",U.muted?"Unmute sound":"Mute sound"),e.title=U.muted?"Unmute sound":"Mute sound",e.innerHTML=F(U.muted?"volume-x":"volume-2"),os.render(U,Gt||ts,dt?.state||"saved"),Oe()}function $r(e){const t=e.autoImport!==void 0&&e.autoImport!==U.autoImport;U=yr({...U,...e});try{Gt=Xc(localStorage,U)}catch{Gt=!1}is(),gi({preferences:{...U},...t?{autoImport:U.autoImport}:{}})}function gi(e){dt?.save(e)}function Hv(){return{sourceID:it,projectID:gt,directory:We,days:at,fromDate:ct,toDate:lt,includeChildren:yn,includeArchived:qt}}C("#open-settings").addEventListener("click",os.open);C("#mute-audio").addEventListener("click",()=>$r({muted:!U.muted}));const _v=()=>is();sr.addEventListener("change",_v);const Bv=e=>{if(e.key===ti)try{U={...Jc(localStorage),autoImport:U.autoImport},is()}catch{}};window.addEventListener("storage",Bv);is();dt=new Lg(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=>{os.render(U,Gt||ts,e),e==="error"&&Yt("Changes applied, but could not save to the local library. Retrying when you return."),e==="saved"&&xr?.check()});const Gl=$g(zt),mt=Tg(e=>bi(e),zt);xr=new Ag({eligible:()=>U.autoImport&&!dt?.pending&&document.visibilityState==="visible"&&!!(J&&!J.onboarding&&J.sources?.some(e=>e.selected)),busy:()=>mt.busy||!!document.querySelector("dialog[open]"),refresh:()=>mt.refresh(!0)});const Ir=new AbortController,as=()=>{document.visibilityState==="visible"&&(dt?.state==="error"&&dt.flush(),xr?.check())};window.addEventListener("focus",as,{signal:Ir.signal});document.addEventListener("visibilitychange",as,{signal:Ir.signal});window.setInterval(as,Cg);C("#manage-sources").addEventListener("click",()=>{mt.open()});document.addEventListener("sessiongraph-import-status",e=>{const t=e.detail;xr?.activity(),os.importStatus(t),C("#refresh").classList.toggle("spinning",t.running),C(".connection").title=t.running?`Importing ${Ue(t.source)} · ${t.imported} sessions saved`:t.failed?"Import unavailable · open Manage sources for details":"Local library · SQLite"},{signal:Ir.signal});const mi=Wd(Sn,zt,e=>{Gl.open(e)});C("#search").addEventListener("click",mi.open);function de(e,t){kt&&(e==="timeline"?!t:t)&&xe();const n=C(`#${e}`);n.hidden=!t,C(`#toggle-${e}`).setAttribute("aria-expanded",String(t)),t&&innerWidth<760&&e!=="timeline"&&de(e==="explorer"?"inspector":"explorer",!1)}de("explorer",innerWidth>=760);let eo=[];for(const e of["explorer","timeline","inspector"])C(`#toggle-${e}`).addEventListener("click",()=>de(e,C(`#${e}`).hidden));C("#close-explorer").addEventListener("click",()=>{de("explorer",!1),C("#toggle-explorer").focus()});C("#close-timeline").addEventListener("click",()=>{xe(),de("timeline",!1),C("#toggle-timeline").focus()});function Yt(e){C("#toast").textContent=e,C("#toast").hidden=!1,window.setTimeout(()=>{C("#toast").hidden=!0},3500)}function vi(){de("inspector",!1),Sr.close(),It.clear(),C("#session-inspector").replaceChildren(),C("#toggle-inspector").hidden=!0}vi();async function jv(){try{const{TimelineScene:e}=await Ro(async()=>{const{TimelineScene:t}=await import("./scene-Cg3ezvud.js");return{TimelineScene:t}},__vite__mapDeps([0,1]));ee=new e(C("#scene"),{onSelect:t=>{t?(rr.play("select"),Sn(t)):Si()},onPlaybackInterrupt:xe,onEvent:t=>{rr.play("select"),pi(t)},onEventHover:(t,n,s,r)=>{Un=void 0,t&&B&&Re?It.show(t,B,Re.revision,n,s,r):It.clear()},onHover:(t,n,s)=>{const r=C("#tooltip");r.classList.contains("message-tooltip")&&(It.clear(),Un=void 0),r.hidden!==!t&&(r.hidden=!t),t&&(Un!==t.session&&(Un=t.session,r.innerHTML=`<strong>${X(t.session.title)}</strong><span>${X(Ue(t.session.source))} · ${t.session.activity?.lastMessageAt?`Last message ${vn(t.session.activity.lastMessageAt)}`:"Message time unavailable"}<br>Started ${vn(t.session.created)}</span>`),r.style.left=`${Math.min(n+18,C("#scene").clientWidth-280)}px`,r.style.top=`${Math.max(8,Math.min(s-32,C("#scene").clientHeight-110))}px`)}}),ee.applyPreferences(U),J&&(ee.setGraph(ne,!0),B&&(ee.select(B),ee.focus(B)),je&&ee.setFiles(je.files),Re&&ee.setEvents(Re.items))}catch(e){console.error("[sessiongraph] Graphics initialization failed",e),Yt("3D requires WebGL. You can still browse sessions in the list.")}finally{Wl=!1,J&&Ei()}}jv();C("#scene").addEventListener("scene-error",e=>Yt(e.detail));async function yi(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 bi(e=!1){const t=C("#refresh");t.disabled=!0,t.classList.add("spinning");try{const n=dt?.revision,s=await yi("/api/sessiongraph"),r=J,o=B?Fs.get(B):void 0,i=!!(r&&ne.nodes.length);if(J=s,!dt?.pending&&n===dt?.revision){U={...yr(s.preferences||U),autoImport:s.autoImport!==!1};try{Gt=Xc(localStorage,U)}catch{Gt=!1}if(!ts){const l=Dg(s.viewState);({sourceID:it,projectID:gt,directory:We,days:at,fromDate:ct,toDate:lt,includeChildren:yn,includeArchived:qt}=l),C("#children").checked=yn,Do=JSON.stringify(l),s.preferences||gi({preferences:{...U}})}is()}if(ts=!0,C("#connection-label").textContent="Local library",C(".connection").classList.add("connected"),C(".connection").title=`Connected · ${pe(J.sessions.length)} sessions`,r&&JSON.stringify(r.sessions)===JSON.stringify(s.sessions)&&JSON.stringify(r.projects)===JSON.stringify(s.projects)){Ei();return}hi.clear(),Fs=new Map(J.sessions.map(l=>[l.id,l])),C("#source").innerHTML='<option value="">All sources</option>'+(J.sources||[]).map(l=>`<option value="${X(l.id)}">${X(l.name)} · ${l.sessions.toLocaleString()}</option>`).join(""),C("#source").value=it,C("#source-filter-icon").innerHTML=ut(it),mi.setData(J);const a=new Map;if(J.sessions.forEach(l=>a.set(l.projectID,(a.get(l.projectID)||0)+1)),C("#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="${X(l.id)}">${X(l.name)} · ${pe(a.get(l.id)||0)}</option>`).join(""),C("#project").value=gt,wi(),B&&!r){const l=J.sessions.find(c=>c.id===B);l&&l.created<Date.now()-at*864e5&&(at=0),l?.archived&&(qt=!0)}if(Ve(!i,i),B&&!r)Sn(B);else if(B){const l=Fs.get(B);if(l&&JSON.stringify(o)!==JSON.stringify(l)){const c=C(".detail-scroll")?.scrollTop||0;je=void 0,Re=void 0,Zl(l,!1),C(".detail-scroll").scrollTop=c,or(l.id),$i(l)}}else vi();!e&&J.warnings.length&&Yt(J.warnings.join(" ")),!e&&J.onboarding&&mt.open(!0)}catch(n){if(e&&J){C(".connection").title="Library refresh unavailable · retry with Refresh sessions";return}C("#connection-label").textContent="Connection unavailable",C(".connection").title="Connection unavailable",C(".connection").classList.remove("connected"),C("#graph-message").hidden=!1,C("#graph-message").innerHTML=`${F("terminal")}<h3>Local library unavailable</h3><p>${X(n instanceof Error?n.message:"Unable to connect.")}</p><button class="primary-button" id="retry">Retry ${F("arrow-right")}</button>`,C("#retry").addEventListener("click",()=>{bi().then(as)}),J||(C("#session-list").innerHTML='<p class="empty-list">Your sessions will appear here once connected.</p>',C("#list-count").textContent="Offline"),Oe()}finally{t.disabled=!1,t.classList.remove("spinning")}}function wi(){const e=J?.sessions.filter(s=>!gt||s.projectID===gt)||[],t=[...new Set(e.map(s=>s.directory))].sort((s,r)=>qn(s).localeCompare(qn(r))),n=new Set(J?.projects.flatMap(s=>s.worktrees));C("#directory").innerHTML='<option value="">All directories</option>'+t.map(s=>`<option value="${X(s)}">${n.has(s)?"⑂ ":""}${X(qn(s))}</option>`).join(""),t.includes(We)||(We=""),C("#directory").value=We}function Ve(e=!1,t=!1){if(!J)return;t||(xe(),oe=1,ln=60);const n=C("#session-list").scrollTop,s=document.activeElement?.closest("[data-session]")?.dataset.session,r=Date.now(),o=ct?new Date(`${ct}T00:00:00`).getTime():at?r-at*864e5:0,i=lt?new Date(`${lt}T23:59:59.999`).getTime():1/0;ge=J.sessions.filter(c=>(!it||c.source===it)&&(!gt||c.projectID===gt)&&(!We||c.directory===We)&&(yn||!c.parentID||!!c.forkID)&&(qt||!c.archived)&&c.created>=o&&c.created<=i),ui=[...ge].sort((c,h)=>dn(h)-dn(c)),Bl=new Set(ge.map(c=>c.id)),mi.setScope(ge.map(c=>c.id)),ne=Nd(ge,J.projects,t?ne:void 0),jl=new Map(ne.nodes.map(c=>[c.session.id,c.color])),ee?.setCutoff(oe),ee?.setGraph(ne,e,t),Ei(),document.querySelectorAll("[data-days]").forEach(c=>c.classList.toggle("active",!ct&&!lt&&Number(c.dataset.days)===at)),xi(),t&&(C("#session-list").scrollTop=n,s&&es.get(s)?.focus({preventScroll:!0})),Wv(),B&&!ge.some(c=>c.id===B)?Si():B&&je&&ee?.setFiles(je.files),B&&Re&&ee?.setEvents(Re.items),Oe();const a=Hv(),l=JSON.stringify(a);ts&&l!==Do&&(Do=l,gi({viewState:a}))}function Ei(){C("#share-playback").disabled=!ge.length||!ee;const e=C("#graph-message");e.hidden=!!(ge.length&&ee),ge.length?ee||(e.innerHTML=Wl?"<h3>Preparing the map…</h3>":`${F("box")}<h3>WebGL is unavailable.</h3><p>You can explore every session and its file details in the list.</p>`):e.innerHTML=`${F("search")}<h3>No matching sessions</h3><button class="text-button" id="clear-filters">Reset filters ${F("rotate-ccw")}</button>`,C("#clear-filters")?.addEventListener("click",()=>Yl()),Oe()}function Yl(e){it="",C("#source").value="",C("#source-filter-icon").innerHTML=ut(),gt="",We="",at=0,ct="",lt="",yn=!0,qt=e?.archived===!0,C("#project").value="",C("#children").checked=!0,ql.setRange("",""),wi(),Ve(!0)}function xi(){C("#list-count").textContent=pe(ge.length);const e=ui;let t="";C("#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="${X(n.id)}" aria-pressed="${B===n.id}" title="${X(n.title)}"><span class="session-dot" style="--node-color:${jl.get(n.id)}"></span><span class="session-card-body"><span class="session-title">${X(n.title)}</span><span class="session-meta">${n.forkID?F("git-fork"):n.parentID?F("network"):""}<span class="source-badge" data-source="${X(n.source||"opencode")}">${ut(n.source)}${X(Ue(n.source))}</span><span title="${n.activity?.lastMessageAt?"Latest saved message":"Session created; message time unavailable"}">${Fv.format(s)}</span></span></span></button>`}).join("")+(e.length>ln?`<button id="more-sessions" class="load-more">Show more sessions ${F("chevron-down")}</button>`:e.length?"":'<p class="empty-list">No sessions match your filters.</p>'),C("#more-sessions")?.addEventListener("click",()=>{ln+=100;const n=C("#session-list").scrollTop;xi(),C("#session-list").scrollTop=n,Oe()}),es=new Map([...C("#session-list").querySelectorAll(".session-card")].map(n=>[n.dataset.session,n])),Oe()}function Kl(e){for(const t of[e,B]){const n=t?es.get(t):void 0;n&&(n.classList.toggle("selected",t===B),n.setAttribute("aria-pressed",String(t===B)))}}function Wv(){Ze=Kc(ge),Ul=Zc(ge),Mo="";const e=Fg(ge.map(dn),ne.start,ne.end),t=Math.max(...e,1);C("#histogram").innerHTML=e.map(n=>`<span style="height:${Math.max(4,n/t*100)}%;opacity:${n?.8:.15}" title="${n} session endpoints"></span>`).join(""),C("#date-label").textContent=ne.start?`${mn(ne.start)} — ${mn(ne.end,!0)}`:"No sessions",ne.start&&ql.setRange(ct||Wa(ne.start),lt||Wa(ne.end)),xn()}function xn(){C("#scrubber").value=String(Math.round(oe*1e3)),C("#timeline-cursor").style.left=`${oe*100}%`,C("#histogram").style.setProperty("--progress",`${oe*100}%`);const e=ne.start+(ne.end-ne.start)*oe;C("#playback-date").textContent=ne.start?mn(e):"—";const t=ne.nodes.length?Ng(e,ne.end-ne.start):"—";C("#playback-period").textContent!==t&&(C("#playback-period").textContent=t);const n=Ze.at(e,oe>=1),s=Ul(e,oe>=1),r=`${n.tokens}:${n.sessions}:${s}`;r!==Mo&&(Mo=r,C("#playback-summary").hidden=ge.length===0,C("#playback-sessions").textContent=pe(s),C("#playback-tokens").textContent=Ze.recorded?_l(n.tokens):"—",C("#playback-token-coverage").textContent=Ze.recorded?`${pe(n.sessions)} / ${pe(Ze.recorded)} with recorded usage`:"Usage unavailable",C("#playback-summary").title=`${pe(s)} sessions started. ${Ze.recorded?`${pe(n.tokens)} burnt tokens`:"Token usage unavailable"}. Token totals are added at the latest saved message, including cache where reported. ${pe(Ze.missing)} sessions have no supported recorded count.${Ze.untimed?` ${pe(Ze.untimed)} totals have no message timestamp and are included only at the end.`:""}`),ee?.setCutoff(oe)}function xe(){if(kt=!1,Kn=0,C("#app").classList.remove("playback-mode"),Bs){const e=Bs;Bs=void 0,de("explorer",e.explorer),de("inspector",e.inspector&&!!B)}ee?.setPlaying(!1),cancelAnimationFrame(fi),C("#play").innerHTML=F("play"),C("#play").setAttribute("aria-label","Play timeline"),Oe()}function zl(e){if(!kt)return;const t=Math.max(0,e-nr);nr=e,document.hidden||(oe<1?oe=Math.min(1,oe+t*U.playbackSpeed/Qo):Kn+=t),xn(),ee?.setPlaybackOutro(oe>=1?Math.min(1,Kn/Qs):null),oe>=1&&Kn>=Qs+zc?xe():fi=requestAnimationFrame(zl)}function Si(){const e=B;Lo?.abort(),Oo?.abort(),C("#file-legend").hidden=!0,_s++,Hs++,B=null,je=void 0,Re=void 0,ee?.select(null),history.replaceState(null,"",location.pathname),vi(),Kl(e)}function Uv(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="${X(r.id)}" ${o?"":"disabled"}>${F(r.kind)}<span><small>${r.label}</small><strong>${X(o?.title||"Session no longer available")}</strong></span>${F("arrow-up-right")}</button>`}).join("")}</section>`:""}function Zl(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);C("#session-inspector").innerHTML=`
146
- <div class="panel-heading"><button class="panel-handle" data-drag-panel="inspector" aria-label="Move session details panel" title="Drag to move · Arrow keys to reposition">${F("grip")}<span>${s}</span></button><button id="close-inspector" class="icon-button" aria-label="Close session details">${F("x")}</button></div>
147
- <div class="detail-scroll">
148
- <div class="detail-title"><span class="source-badge" data-source="${X(e.source||"opencode")}">${ut(e.source)}${X(Ue(e.source))}</span><h2>${X(e.title)}</h2><span class="detail-date">${vn(e.created)}</span></div>
149
- <div class="detail-actions"><button id="open-session" class="secondary-button">${F("arrow-up-right")}Open session</button><button id="focus-session" class="icon-button" title="Focus node" aria-label="Focus node">${F("crosshair")}</button><button id="copy-id" class="icon-button" title="Copy session ID" aria-label="Copy session ID">${F("copy")}</button></div>
150
- <section id="message-detail" class="detail-section"></section>
151
- <div id="file-detail"><section class="detail-section"><div class="section-label">Changed files</div><div class="detail-loading">${F("loader-circle","spinning")}Loading changes…</div></section></div>
152
- ${Uv(e)}
153
- <details class="more-details detail-section"><summary>Session info ${F("chevron-down")}</summary><dl class="metadata"><div><dt>Project</dt><dd>${X(n?.name||"Unknown")}</dd></div><div><dt>Model</dt><dd>${X(e.model)}</dd></div><div><dt>Agent</dt><dd>${X(e.agent||"Unknown")}</dd></div><div><dt>Tokens incl. cache</dt><dd>${e.tokens===null?"Not recorded":_l(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>${X(e.directory)}</code></div></details>
154
- </div>
155
- `,C("#toggle-inspector").hidden=!1,t&&de("inspector",!0),C("#close-inspector").addEventListener("click",()=>{de("inspector",!1),C("#toggle-inspector").focus()}),C("#focus-session").addEventListener("click",()=>{xe(),ee?.focus(e.id)}),C("#open-session").addEventListener("click",()=>{Gl.open(e)}),C("#copy-id").addEventListener("click",async()=>{try{await navigator.clipboard.writeText(e.nativeID||e.id),Yt("Session ID copied")}catch{Yt(e.nativeID||e.id)}}),Jl(e),Oe()}function Jl(e,t){const n=t?[`${pe(t.total)} messages · ${pe(t.items.length)} on map`,t.limited?"Map limit reached":"",t.partial?"Partial history":""].filter(Boolean):["Loading messages…"];C("#message-detail").innerHTML=`<div class="section-label">Session timeline</div><dl class="metadata">
156
- <div><dt>Trail starts</dt><dd>${vn(e.created)}</dd></div>
157
- <div><dt>Node · last message</dt><dd>${e.activity?.lastMessageAt?vn(e.activity.lastMessageAt):"Unknown · at session start"}</dd></div>
158
- </dl><div class="event-key"><span style="--event-color:#ffffff"><i></i>User & assistant messages</span></div><p class="coverage-note">${n.map(X).join(" · ")}</p><button class="secondary-button explore-events">Explore messages ${F("arrow-right")}</button>`,C(".explore-events").addEventListener("click",()=>pi()),Oe()}async function $i(e,t=!1){const n=++Hs;Oo?.abort();const s=new AbortController;Oo=s;try{const r=await yi(`/api/sessiongraph/session/${encodeURIComponent(e.id)}/event-markers`,s.signal);if(s.signal.aborted||n!==Hs||B!==e.id)return;Re=r,ee?.setEvents(r.items,t),Jl(e,r)}catch{if(s.signal.aborted||n!==Hs||B!==e.id)return;C("#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>',C(".explore-events").addEventListener("click",()=>pi()),C("#retry-timeline").addEventListener("click",()=>{$i(e)})}}function qv(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 Ua(e){const t=e.files;C("#file-legend").hidden=!t.length,C("#file-detail").innerHTML=`
159
- <section class="detail-section"><div class="section-label">Changed files<span>${pe(t.length)}${e.partial?"+":""}</span></div>
160
- ${t.length?`<ul class="file-list">${t.map(n=>`<li title="${X(n.path)} · ${n.source}">${F("file-code-2")}<div><strong>${X(qn(n.path))}</strong>${n.path.includes("/")?`<span>${X(n.path.slice(0,n.path.lastIndexOf("/")))}</span>`:""}</div><small>${n.steps}×</small></li>`).join("")}</ul>`:'<div class="no-files"><p>No file changes found.</p></div>'}
161
- <p class="coverage-note">${pe(e.messagesScanned)} messages${e.partial?" · Partial history":""}${e.snapshotSteps?"":" · Snapshots unavailable"}${t.length>80?" · 80 files on map":""}</p>
162
- ${e.nextCursor?'<p class="coverage-note" id="history-loading" role="status">Loading full history…</p>':""}</section>
163
- ${e.locations.length?`<details class="more-details detail-section"><summary>Directory moves ${F("chevron-down")}</summary>${e.locations.map(n=>`<div class="location-entry"><span>${vn(n.time)}</span><code>${X(n.directory)}</code></div>`).join("")}</details>`:""}
164
- ${e.tools.length?`<details class="more-details detail-section"><summary>Tools used <span>${pe(e.tools.reduce((n,s)=>n+s.count,0))}</span>${F("chevron-down")}</summary><div class="tools-list">${e.tools.slice(0,12).map(n=>`<div><span>${X(n.name)}</span><strong>${n.count}</strong></div>`).join("")}</div></details>`:""}
165
- `,ee?.setFiles(t),Oe()}async function or(e){const t=++_s;Lo?.abort();const n=new AbortController;Lo=n;let s,r;const o=new Set;try{do{const i=await yi(`/api/sessiongraph/session/${encodeURIComponent(e)}${s?`?cursor=${encodeURIComponent(s)}`:""}`,n.signal);if(n.signal.aborted||t!==_s||B!==e)return;if(r&&i.revision!==r.revision)throw new Error("History changed. Retry to load the latest version.");if(r=r?qv(r,i):i,je=r,!s||!i.nextCursor?Ua(r):C("#history-loading")&&(C("#history-loading").textContent=`Loading full history… ${pe(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!==_s||B!==e)return;if(je){Ua(je);const a=C("#history-loading");a&&(a.innerHTML='History loading interrupted. <button class="text-button" id="retry-detail">Retry</button>'),C("#retry-detail")?.addEventListener("click",()=>{or(e)})}else C("#file-detail").innerHTML=`<section class="detail-section"><div class="section-label">Changed files</div><p class="coverage-note">${X(i instanceof Error?i.message:"Details unavailable.")}</p><button class="load-more" id="retry-detail">Retry file details</button></section>`,C("#retry-detail").addEventListener("click",()=>or(e))}}function Sn(e){const t=Fs.get(e);if(!t)return;const n=B;Sr.close(),It.clear(),Bl.has(e)||Yl(t),xe(),oe=1,xn(),B=e,je=void 0,Re=void 0,C("#file-legend").hidden=!0,history.replaceState(null,"",`?session=${encodeURIComponent(e)}`),ee?.select(e),Zl(t),ee?.focus(e),Kl(n),or(e),$i(t,!0)}C("#session-list").addEventListener("click",e=>{const t=e.target.closest("[data-session]");t?.dataset.session&&Sn(t.dataset.session)});C("#inspector").addEventListener("click",e=>{const t=e.target.closest("[data-related]");t?.dataset.related&&Sn(t.dataset.related)});C("#project").addEventListener("change",e=>{gt=e.target.value,We="",wi(),Ve(!0)});C("#source").addEventListener("change",e=>{it=e.target.value,C("#source-filter-icon").innerHTML=ut(it),Ve(!0)});C("#directory").addEventListener("change",e=>{We=e.target.value,Ve(!0)});C("#children").addEventListener("change",e=>{yn=e.target.checked,Ve()});document.querySelectorAll("[data-days]").forEach(e=>e.addEventListener("click",()=>{at=Number(e.dataset.days),ct="",lt="",Ve(!0)}));C("#reset-camera").addEventListener("click",()=>Ve(!0));C("#refresh").addEventListener("click",()=>{J?.onboarding?mt.open(!0):mt.refresh()});C("#scrubber").addEventListener("input",e=>{xe(),oe=Number(e.target.value)/1e3,xn()});C("#play").addEventListener("click",()=>{if(ge.length){if(kt)return xe();oe>=1&&(oe=0),xn(),Bs={explorer:!C("#explorer").hidden,inspector:!C("#inspector").hidden},de("explorer",!1),de("inspector",!1),de("timeline",!0),It.clear(),Un=void 0,C("#app").classList.add("playback-mode"),kt=!0,Kn=0,ee?.setPlaying(!0),nr=performance.now(),C("#play").innerHTML=F("pause"),C("#play").setAttribute("aria-label","Pause timeline"),Oe(),fi=requestAnimationFrame(zl)}});document.addEventListener("visibilitychange",()=>{nr=performance.now()},{signal:Ir.signal});C("#share-playback").addEventListener("click",async()=>{const e=C("#share-playback");e.disabled=!0;try{if(!Qr){const{createPlaybackShare:t}=await Ro(async()=>{const{createPlaybackShare:n}=await import("./share-Cyn7-rP1.js");return{createPlaybackShare:n}},__vite__mapDeps([2,0,1]));Qr=t(zt)}ne.nodes.length&&Qr.open(ne,U)}catch{Yt("Could not open GIF sharing. Please try again.")}finally{e.disabled=!ge.length||!ee}});for(const e of[!1,!0])C(`#view-${e?"2d":"3d"}`).addEventListener("click",()=>$r({view:e?"2d":"3d"}));C("#motion").addEventListener("click",()=>$r({motion:$o(U,sr.matches)?"off":"on"}));C("#help").addEventListener("click",()=>{C("#help-dialog").showModal(),zt()});C("#help-dialog").addEventListener("close",zt);C("#close-help").addEventListener("click",()=>C("#help-dialog").close());document.addEventListener("keydown",e=>{if(!e.defaultPrevented&&!document.querySelector("dialog[open]")){if(kt&&e.key==="Escape"){e.preventDefault(),xe();return}if(!Sr.handleKey(e)){if(e.key==="Escape"){B?Si():de("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=ui,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")&&(es.has(o.id)||(ln=Math.min(n.length,ln+100),xi()),es.get(o.id)?.focus({preventScroll:!0})));return}}if(e.key.toLowerCase()==="f"&&Ve(!0),e.key.toLowerCase()==="h"){xe();const t=["explorer","timeline","inspector"].filter(n=>!C(`#${n}`).hidden);t.length?(eo=t,t.forEach(n=>de(n,!1))):(eo.length?eo:["explorer","timeline"]).forEach(n=>{(n!=="inspector"||B)&&de(n,!0)})}}}}});bi().then(()=>{J?.importing?mt.resume():as()});export{ey as C,vr as D,ty as R,Ld as S,Ro as _,Zc as a,zv as b,Ga as c,Zv as d,ei as e,Jv as f,Ng as g,Y as h,Gg as i,In as j,Gv as k,Vd as l,$o as m,Xv as n,Yv as o,Kc as p,Kv as q,Qv as r,dn as s,Fg as t,to as u,tl as v};