sessiongraph-app-darwin-arm64 1.0.11 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/payload/SessionGraph.app/Contents/Info.plist +2 -2
- package/payload/SessionGraph.app/Contents/MacOS/sessiongraph +0 -0
- package/payload/SessionGraph.app/Contents/Resources/resources/server.mjs +157 -53
- package/payload/SessionGraph.app/Contents/Resources/resources/web/assets/{external-links-CJk2OPKW.js → external-links-D0O8IeG0.js} +1 -1
- package/payload/SessionGraph.app/Contents/Resources/resources/web/assets/{index-JjTdnq9-.js → index-BS2Voifb.js} +1 -1
- package/payload/SessionGraph.app/Contents/Resources/resources/web/assets/{index-DPovJIlT.js → index-CIhs02tq.js} +5 -5
- package/payload/SessionGraph.app/Contents/Resources/resources/web/assets/{index-DhlS3ZId.js → index-GTrhxXlP.js} +1 -1
- package/payload/SessionGraph.app/Contents/Resources/resources/web/assets/{index-DOYyn-b_.js → index-Vq4WYmzW.js} +1 -1
- package/payload/SessionGraph.app/Contents/Resources/resources/web/assets/{publishing-CkVIjq_f.js → publishing-ofssf6d6.js} +1 -1
- package/payload/SessionGraph.app/Contents/Resources/resources/web/assets/{scene-BXs8B_Kk.js → scene-KCDTPCOD.js} +1 -1
- package/payload/SessionGraph.app/Contents/Resources/resources/web/assets/{share-jfOenMTA.js → share-DKeJCFAo.js} +3 -3
- package/payload/SessionGraph.app/Contents/Resources/resources/web/assets/worker-C10U_apJ.js +2 -0
- package/payload/SessionGraph.app/Contents/Resources/resources/web/index.html +1 -1
- package/payload/SessionGraph.app/Contents/_CodeSignature/CodeResources +44 -44
- package/payload/SessionGraph.app/Contents/Resources/resources/web/assets/worker-DwqxiDWY.js +0 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/scene-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/scene-KCDTPCOD.js","assets/three-D_1Qt16u.js","assets/share-DKeJCFAo.js","assets/external-links-D0O8IeG0.js","assets/publishing-ofssf6d6.js","assets/publishing-VJhUmdPH.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&s(i)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}})();const sd="modulepreload",rd=function(e){return"/"+e},Di={},cr=function(t,n,s){let r=Promise.resolve();if(n&&n.length>0){let l=function(c){return Promise.all(c.map(f=>Promise.resolve(f).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),a=i?.nonce||i?.getAttribute("nonce");r=l(n.map(c=>{if(c=rd(c),c in Di)return;Di[c]=!0;const f=c.endsWith(".css"),u=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const h=document.createElement("link");if(h.rel=f?"stylesheet":sd,f||(h.as="script"),h.crossOrigin="",h.href=c,a&&h.setAttribute("nonce",a),document.head.appendChild(h),f)return new Promise((p,g)=>{h.addEventListener("load",p),h.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${c}`)))})}))}function o(i){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i}return r.then(i=>{for(const a of i||[])a.status==="rejected"&&o(a.reason);return t().catch(o)})};const Ja=(e,t,n=[])=>{const s=document.createElementNS("http://www.w3.org/2000/svg",e);return Object.keys(t).forEach(r=>{s.setAttribute(r,String(t[r]))}),n.length&&n.forEach(r=>{const o=Ja(...r);s.appendChild(o)}),s};var Xa=([e,t,n])=>Ja(e,t,n);const od=e=>Array.from(e.attributes).reduce((t,n)=>(t[n.name]=n.value,t),{}),id=e=>typeof e=="string"?e:!e||!e.class?"":e.class&&typeof e.class=="string"?e.class.split(" "):e.class&&Array.isArray(e.class)?e.class:"",ad=e=>e.flatMap(id).map(n=>n.trim()).filter(Boolean).filter((n,s,r)=>r.indexOf(n)===s).join(" "),cd=e=>e.replace(/(\w)(\w*)(_|-|\s*)/g,(t,n,s)=>n.toUpperCase()+s.toLowerCase()),Ri=(e,{nameAttr:t,icons:n,attrs:s})=>{const r=e.getAttribute(t);if(r==null)return;const o=cd(r),i=n[o];if(!i)return console.warn(`${e.outerHTML} icon name was not found in the provided icons object.`);const a=od(e),[l,c,f]=i,u={...c,"data-lucide":r,...s,...a},h=ad(["lucide",`lucide-${r}`,a,s]);h&&Object.assign(u,{class:h});const p=Xa([l,u,f]);return e.parentNode?.replaceChild(p,e)};const K={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};const ld=["svg",K,[["path",{d:"M5 12h14"}],["path",{d:"m12 5 7 7-7 7"}]]];const dd=["svg",K,[["path",{d:"M7 7h10v10"}],["path",{d:"M7 17 17 7"}]]];const ud=["svg",K,[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}],["path",{d:"m3.3 7 8.7 5 8.7-5"}],["path",{d:"M12 22V12"}]]];const fd=["svg",K,[["path",{d:"m6 9 6 6 6-6"}]]];const hd=["svg",K,[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}],["path",{d:"M12 17h.01"}]]];const pd=["svg",K,[["circle",{cx:"12",cy:"12",r:"10"}],["polyline",{points:"12 6 12 12 16 14"}]]];const gd=["svg",K,[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}]]];const md=["svg",K,[["circle",{cx:"12",cy:"12",r:"10"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18"}]]];const vd=["svg",K,[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5"}],["path",{d:"M3 12A9 3 0 0 0 21 12"}]]];const yd=["svg",K,[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}],["path",{d:"m5 12-3 3 3 3"}],["path",{d:"m9 18 3-3-3-3"}]]];const bd=["svg",K,[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"}]]];const wd=["svg",K,[["line",{x1:"6",x2:"6",y1:"3",y2:"15"}],["circle",{cx:"18",cy:"6",r:"3"}],["circle",{cx:"6",cy:"18",r:"3"}],["path",{d:"M18 9a9 9 0 0 1-9 9"}]]];const Ed=["svg",K,[["circle",{cx:"12",cy:"18",r:"3"}],["circle",{cx:"6",cy:"6",r:"3"}],["circle",{cx:"18",cy:"6",r:"3"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9"}],["path",{d:"M12 12v3"}]]];const xd=["svg",K,[["circle",{cx:"12",cy:"5",r:"1"}],["circle",{cx:"19",cy:"5",r:"1"}],["circle",{cx:"5",cy:"5",r:"1"}],["circle",{cx:"12",cy:"12",r:"1"}],["circle",{cx:"19",cy:"12",r:"1"}],["circle",{cx:"5",cy:"12",r:"1"}],["circle",{cx:"12",cy:"19",r:"1"}],["circle",{cx:"19",cy:"19",r:"1"}],["circle",{cx:"5",cy:"19",r:"1"}]]];const Sd=["svg",K,[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56"}]]];const $d=["svg",K,[["circle",{cx:"12",cy:"16",r:"1"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3"}]]];const Id=["svg",K,[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"}],["path",{d:"M12 12V8"}]]];const Cd=["svg",K,[["circle",{cx:"12",cy:"12",r:"3"}],["circle",{cx:"19",cy:"5",r:"2"}],["circle",{cx:"5",cy:"19",r:"2"}],["path",{d:"M10.4 21.9a10 10 0 0 0 9.941-15.416"}],["path",{d:"M13.5 2.1a10 10 0 0 0-9.841 15.416"}]]];const Td=["svg",K,[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M15 3v18"}]]];const kd=["svg",K,[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M3 9h18"}],["path",{d:"M9 21V9"}]]];const Ad=["svg",K,[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1"}]]];const Ld=["svg",K,[["polygon",{points:"6 3 20 12 6 21 6 3"}]]];const Od=["svg",K,[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}],["path",{d:"M8 16H3v5"}]]];const Md=["svg",K,[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}],["path",{d:"M3 3v5h5"}]]];const Dd=["svg",K,[["circle",{cx:"11",cy:"11",r:"8"}],["path",{d:"m21 21-4.3-4.3"}]]];const Rd=["svg",K,[["path",{d:"M20 7h-9"}],["path",{d:"M14 17H5"}],["circle",{cx:"17",cy:"17",r:"3"}],["circle",{cx:"7",cy:"7",r:"3"}]]];const Pd=["svg",K,[["circle",{cx:"18",cy:"5",r:"3"}],["circle",{cx:"6",cy:"12",r:"3"}],["circle",{cx:"18",cy:"19",r:"3"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49"}]]];const Vd=["svg",K,[["line",{x1:"21",x2:"14",y1:"4",y2:"4"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22"}]]];const Qa=["svg",K,[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"}],["path",{d:"M20 3v4"}],["path",{d:"M22 5h-4"}],["path",{d:"M4 17v2"}],["path",{d:"M5 18H3"}]]];const Nd=["svg",K,[["polyline",{points:"4 17 10 11 4 5"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19"}]]];const ec=["svg",K,[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z"}],["path",{d:"M16 9a5 5 0 0 1 0 6"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728"}]]];const Fd=["svg",K,[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15"}]]];const Hd=["svg",K,[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]]];const _d=({icons:e={},nameAttr:t="data-lucide",attrs:n={}}={})=>{if(!Object.values(e).length)throw new Error(`Please provide an icons object.
|
|
3
3
|
If you want to use all the icons you can import it like:
|
|
4
4
|
\`import { createIcons, icons } from 'lucide';
|
|
5
|
-
lucide.createIcons({icons});\``);if(typeof document>"u")throw new Error("`createIcons()` only works in a browser environment.");const s=document.querySelectorAll(`[${t}]`);if(Array.from(s).forEach(r=>Ri(r,{nameAttr:t,icons:e,attrs:n})),t==="data-lucide"){const r=document.querySelectorAll("[icon-name]");r.length>0&&(console.warn("[Lucide] Some icons were found with the now deprecated icon-name attribute. These will still be replaced for backwards compatibility, but will no longer be supported in v1.0 and you should switch to data-lucide"),Array.from(r).forEach(o=>Ri(o,{nameAttr:"icon-name",icons:e,attrs:n})))}},Pi=["#b0e9d6","#8eaff4","#d7a1f1","#eac594","#8cdbdf","#e7a3b8","#a8ca91"];function In(e){let t=2166136261;for(let n=0;n<e.length;n++)t=Math.imul(t^e.charCodeAt(n),16777619);return t=Math.imul(t^t>>>16,2246822507),t=Math.imul(t^t>>>13,3266489909),t^=t>>>16,(t>>>0)/4294967295}function Yn(e){return Us(e).split("/").at(-1)||"/"}const Us=e=>(/^(?:[a-z]:[\\/]|\\\\)/i.test(e)?e.replace(/\\/g,"/"):e).replace(/\/+$/,"")||(e.startsWith("/")?"/":""),Cn=e=>e.directory?JSON.stringify(["directory",Us(e.directory)]):JSON.stringify(["project",e.source||"opencode",e.projectID||e.id]),dn=e=>Math.max(e.created,e.activity?.lastMessageAt||e.created),ao=(e,t)=>{const n=t.timeFrame||t;return(e-n.start)/Math.max(1,n.end-n.start)*300-150},Qv=(e,t)=>ao(t.start+(t.end-t.start)*e,t),_o=(e,t)=>[t,e.position[1],e.position[2]],Bd=(e,t)=>_o(e,Math.max(e.startPosition[0],Math.min(t,e.position[0]))),ey=(e,t,n,s=0,r=[1,0,0])=>{const o=Bd(e,t);return[o[0]+r[0]*(n+s),o[1]+r[1]*(n+s),o[2]+r[2]*(n+s)]},ty=(e,t)=>[_o(e,Math.max(e.startPosition[0],Math.min(t.startPosition[0],e.position[0]))),t.startPosition];function jd(e,t,n){if(!e.length)return{nodes:[],edges:[],lanes:[],start:0,end:0};const s=[...e].sort((E,O)=>E.created-O.created||E.id.localeCompare(O.id)),r=s[0].created,o=s.reduce((E,O)=>Math.max(E,dn(O)),r+36e5),i=n?.nodes.length?n.timeFrame||{start:n.start,end:n.end}:{start:r,end:o},a=new Map;for(const E of s){const O=Cn(E),M=a.get(O)||[];M.push(E),a.set(O,M)}const l=[...a].sort((E,O)=>O[1].length-E[1].length||E[0].localeCompare(O[0])),c=new Map(n?.lanes.map((E,O)=>[E.key,E.slot??O]));let f=Math.max(-1,...c.values())+1;for(const[E]of l)c.has(E)||c.set(E,f++);l.sort((E,O)=>c.get(E[0])-c.get(O[0]));const u=[],h=[],p=new Set(t.flatMap(E=>E.worktrees.map(Us)));l.forEach(([E,O])=>{const M=c.get(E),D=M*2.399963,w=M===0?0:15+Math.sqrt(M)*14,S=Math.cos(D)*w,x=Math.sin(D)*w*.7,T=Pi[M%Pi.length],b=t.find(V=>V.id===O[0].projectID),A=O[0].directory,R={key:E,slot:M,label:A?Yn(A):b?.name||O[0].projectID||"Unknown directory",color:T,kind:A&&p.has(Us(A))?"worktree":"directory",y:S,z:x,nodes:[]};for(const V of O){const H=ao(dn(V),i),z=ao(V.created,i),re=In(V.id),W=!!(V.parentID||V.forkID)?12:6,be=Math.sin((z+150)/65+M*.7)*3.5,Dt=typeof V.tokens=="number"&&Number.isFinite(V.tokens)?Math.max(0,V.tokens):0,$e={session:V,position:[H,S+be+(re-.5)*W,x+(In(V.id+"z")-.5)*W],startPosition:[z,0,0],color:T,radius:.35+Math.min(.9,Math.log10(1+Dt)*.11)};h.push($e),R.nodes.push($e)}u.push(R)});const g=new Set(s.map(E=>E.id)),d=[];for(const E of s)E.forkID&&g.has(E.forkID)?d.push({from:E.forkID,to:E.id,kind:"fork"}):E.parentID&&g.has(E.parentID)&&d.push({from:E.parentID,to:E.id,kind:"child"});const m=new Map(h.map(E=>[E.session.id,E])),y=new Set;for(const E of n?.nodes||[]){const O=m.get(E.session.id);O&&Cn(O.session)===Cn(E.session)&&(O.position[1]=E.position[1],O.position[2]=E.position[2],y.add(O.session.id))}function C(E){const O=[],M=new Set;let D=E;for(;D&&!y.has(D.session.id)&&!M.has(D.session.id);){M.add(D.session.id);const w=D.session.forkID||D.session.parentID,S=w?m.get(w):void 0,x=S&&Cn(S.session)===Cn(D.session)?S:void 0;O.push({node:D,parent:x}),D=x}for(const{node:w,parent:S}of O.reverse()){const x=w.session.id;if(S){const T=In(x+"branch")>.5?1:-1;w.position[1]=S.position[1]+T*(9+In(x)*15),w.position[2]=S.position[2]+(In(x+"depth")-.5)*18}y.add(x)}}return s.forEach(E=>C(m.get(E.id))),h.forEach(E=>{E.startPosition=_o(E,E.startPosition[0])}),{nodes:h,edges:d,lanes:u,start:r,end:o,timeFrame:i}}function Wd(){const e=new AbortController,t={signal:e.signal};let n,s=innerWidth<760;function r(c,f,u){const h=Math.max(12,Math.min(f,innerWidth-c.offsetWidth-12)),p=Math.max(72,Math.min(u,innerHeight-c.offsetHeight-12));Object.assign(c.style,{left:`${h}px`,top:`${p}px`,right:"auto",bottom:"auto",transform:"none"}),c.dataset.positioned="true"}function o(){if(!n)return;const{panel:c,handle:f,pointerID:u}=n;n=void 0,c.classList.remove("dragging"),f.hasPointerCapture(u)&&f.releasePointerCapture(u)}document.addEventListener("pointerdown",c=>{if(c.button!==0)return;const f=c.target,u=f.closest(".floating-panel");if(!u)return;document.querySelectorAll(".floating-panel").forEach(g=>g.classList.toggle("front",g===u));const h=f.closest("[data-drag-panel]");if(!h)return;u.querySelectorAll(".custom-dates[open]").forEach(g=>{g.open=!1}),c.preventDefault(),h.focus({preventScroll:!0});const p=u.getBoundingClientRect();n={panel:u,handle:h,pointerID:c.pointerId,x:c.clientX,y:c.clientY,left:p.left,top:p.top},h.setPointerCapture(c.pointerId),u.classList.add("dragging")},t),document.addEventListener("pointermove",c=>{!n||c.pointerId!==n.pointerID||r(n.panel,n.left+c.clientX-n.x,n.top+c.clientY-n.y)},t),document.addEventListener("pointerup",o,t),document.addEventListener("pointercancel",o,t),document.addEventListener("lostpointercapture",o,t),document.addEventListener("keydown",c=>{const u=c.target.closest("[data-drag-panel]")?.closest(".floating-panel");if(!u||!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(c.key))return;c.preventDefault();const h=u.getBoundingClientRect(),p=c.shiftKey?40:10;r(u,h.left+(c.key==="ArrowLeft"?-p:c.key==="ArrowRight"?p:0),h.top+(c.key==="ArrowUp"?-p:c.key==="ArrowDown"?p:0))},t);const i=[...document.querySelectorAll(".floating-panel")],a=c=>{if(c.hidden||!c.dataset.positioned)return;const f=c.getBoundingClientRect();r(c,f.left,f.top)},l=new ResizeObserver(c=>c.forEach(f=>a(f.target)));return i.forEach(c=>l.observe(c)),window.addEventListener("resize",()=>{o(),s!==innerWidth<760?(s=innerWidth<760,i.forEach(c=>{c.removeAttribute("style"),delete c.dataset.positioned})):i.forEach(a)},t),()=>{o(),e.abort(),l.disconnect()}}const Ud=2,Vi=e=>JSON.stringify([Ud,e.revision,e.updated,e.created,e.projectID,e.directory]),un=e=>e.normalize("NFKD").replace(new RegExp("\\p{M}","gu"),"").toLowerCase(),Bo=e=>un(e).match(/[\p{L}\p{N}]+/gu)||[],qd=e=>Bo(e).join(" ");function Gd(e){const t={text:"",terms:[],phrases:[],filters:[]},n=[];for(const s of e.slice(0,300).match(/(?:[^\s"]+|"[^"]*")+/g)||[]){const r=/^(source|project|dir|model|is|after|before|in):(.+)$/i.exec(s);if(r){const i=r[1].toLowerCase(),a=un(r[2].replace(/^"|"$/g,""));if(i==="in"){const l={title:["title"],files:["files"],messages:["body"],tools:["tools"]};t.fields=l[a],t.fields||(t.error="Use in:title, in:files, in:messages, or in:tools.")}else i==="is"&&!["fork","child","root","archived"].includes(a)?t.error="Use is:fork, is:child, is:root, or is:archived.":["after","before"].includes(i)&&(!/^\d{4}-\d{2}-\d{2}$/.test(a)||!Number.isFinite(Date.parse(a))||new Date(a).toISOString().slice(0,10)!==a)?t.error="Use a valid date in YYYY-MM-DD format.":t.filters.push([i,a]);continue}const o=s.replace(/^"|"$/g,"");s.startsWith('"')&&s.endsWith('"')&&t.phrases.push(qd(o)),n.push(o)}return t.text=n.join(" "),t.terms=Bo(t.text).slice(0,12),t.text=t.terms.join(" "),t}function Yd(e,t,n=220){const s=un(e),r=t.reduce((i,a)=>{const l=s.indexOf(a);return l<0?i:Math.min(i,l)},1/0),o=Number.isFinite(r)?Math.max(0,r-55):0;return`${o?"…":""}${e.slice(o,o+n).replace(/\s+/g," ").trim()}${e.length>o+n?"…":""}`}const jo={opencode:{name:"OpenCode",icon:"opencode"},"claude-code":{name:"Claude Code",icon:"claude"},codex:{name:"Codex",icon:"openai"},"t3-code":{name:"T3 Code",icon:"t3"},cursor:{name:"Cursor",icon:"cursor"},gemini:{name:"Gemini CLI",icon:"gemini"},"qwen-code":{name:"Qwen Code",icon:"qwen"},pi:{name:"Pi",icon:"pi"},copilot:{name:"GitHub Copilot CLI",icon:"copilot"},"copilot-chat":{name:"GitHub Copilot Chat (VS Code)",icon:"copilot"},cline:{name:"Cline",icon:"cline"},"roo-code":{name:"Roo Code",icon:"roo"},"kilo-code":{name:"Kilo Code",icon:"kilo"},continue:{name:"Continue",icon:"continue"},"prime-agent":{name:"Prime Agent",icon:"prime"},omp:{name:"Oh My Pi",icon:"pi"},senpi:{name:"Senpi / OmO Native",icon:"senpi"},kimchi:{name:"Kimchi",icon:"kimchi"},gajae:{name:"Gajae-Code",icon:"gajae"},openclaw:{name:"OpenClaw",icon:"openclaw"},hermes:{name:"Hermes Agent",icon:"hermes"},amp:{name:"Amp",icon:"amp"},droid:{name:"Factory Droid",icon:"droid"},codebuff:{name:"Codebuff",icon:"codebuff"},freebuff:{name:"Freebuff",icon:"freebuff"},kimi:{name:"Kimi CLI / Code",icon:"kimi"},grok:{name:"Grok Build",icon:"grok"},jcode:{name:"Jcode",icon:"jcode"},"cherry-studio":{name:"Cherry Studio",icon:"cherry"},"command-code":{name:"Command Code",icon:"commandcode"},zcode:{name:"ZCode",icon:"zcode"},codebuddy:{name:"CodeBuddy",icon:"codebuddy"},workbuddy:{name:"WorkBuddy",icon:"codebuddy"},proma:{name:"Proma",icon:"proma"},"deepseek-harness":{name:"DeepSeek Harness",icon:"deepseek"},aside:{name:"Aside",icon:"aside"},vibe:{name:"Mistral Vibe",icon:"mistral"},muse:{name:"Muse Code",icon:"muse"},junie:{name:"Junie",icon:"junie"},augment:{name:"Augment Code",icon:"augment"},fx:{name:"Fx",icon:"fx"},"minimax-code":{name:"MiniMax Code",icon:"minimax"},opencodereview:{name:"OpenCodeReview",icon:"opencode"},goose:{name:"Goose",icon:"goose"},zed:{name:"Zed Agent",icon:"zed"},devin:{name:"Devin CLI",icon:"devin"},"devin-desktop":{name:"Devin Desktop",icon:"devin"},crush:{name:"Crush",icon:"crush"},octofriend:{name:"Octofriend",icon:"octofriend"},"kilo-cli":{name:"Kilo CLI",icon:"kilo"},"mimo-code":{name:"MiMo Code",icon:"mimo"},"mimo-desktop":{name:"Xiaomi MiMo AI",icon:"mimo"},unsloth:{name:"Unsloth Studio",icon:"unsloth"},kiro:{name:"Kiro",icon:"kiro"},mux:{name:"Mux",icon:"mux"},antigravity:{name:"Antigravity",icon:"antigravity"},"antigravity-cli":{name:"Antigravity CLI",icon:"antigravity"},"antigravity-extension":{name:"Antigravity IDE Extension",icon:"antigravity"},reasonix:{name:"Reasonix",icon:"reasonix"},trae:{name:"Trae / Trae Solo",icon:"trae"},warp:{name:"Warp / Oz",icon:"warp"},"lm-studio":{name:"LM Studio",icon:"lmstudio"},hindsight:{name:"Hindsight",icon:"hindsight"}},Ue=e=>jo[e||"opencode"]?.name||e||"Unknown",ny=e=>typeof e=="string"&&Object.hasOwn(jo,e),ut=e=>{const t=jo[e||""]?.icon||"generic";return`<span class="source-icon source-icon-${t}" aria-hidden="true" style="--source-icon:url('/sources/${t}.svg')"></span>`},tc=e=>[...e].sort((t,n)=>Number(n.selected||n.available||n.sessions>0)-Number(t.selected||t.available||t.sessions>0)||t.name.localeCompare(n.name)),Vt=e=>e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]);function nc(e,{checked:t=e.selected,disabled:n=!1,settings:s=!1}={}){const r=e.available?"Detected":"Not detected",o=e.capabilities.history?"":e.description.startsWith("Detection only")?"Detection only":"Metadata only",i=[e.description,e.lastImport?`Last import ${new Date(e.lastImport).toLocaleString()}`:"Not imported yet",e.error].filter(Boolean).join(" · ");return`<label class="import-source" data-source="${Vt(e.id)}" title="${Vt(i)}"><input ${s?'class="settings-source"':""} type="checkbox" value="${Vt(e.id)}" aria-label="${Vt(e.name)}" aria-description="${Vt(`${r}. ${e.sessions.toLocaleString()} saved sessions. ${i}`)}" ${t?"checked":""} ${n?"disabled":""}/><span class="source-symbol">${ut(e.id)}</span><span class="source-copy"><strong>${Vt(e.name)}</strong><small class="source-meta"><span class="source-detected ${e.available?"detected":""}">${r}</span><span>${e.sessions.toLocaleString()} saved</span>${o?`<span>${o}</span>`:""}</small>${e.error?`<small class="source-error">${Vt(e.error)}</small>`:""}</span></label>`}const Ce=e=>e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]);function Tn(e,t){const n=new Set(t.map(un));let s=0,r="";for(const o of e.matchAll(/[\p{L}\p{N}]+/gu)){r+=Ce(e.slice(s,o.index));const i=un(o[0]),a=[...n].some(l=>i.startsWith(l));r+=a?`<mark>${Ce(o[0])}</mark>`:Ce(o[0]),s=o.index+o[0].length}return r+Ce(e.slice(s))}function Kd(e,t=()=>{},n){const s=new Worker(new URL("/assets/worker-DwqxiDWY.js",import.meta.url),{type:"module"}),r=new AbortController,o={signal:r.signal},i=document.createElement("dialog");i.className="search-dialog",i.setAttribute("aria-label","Search sessions"),i.innerHTML=`
|
|
5
|
+
lucide.createIcons({icons});\``);if(typeof document>"u")throw new Error("`createIcons()` only works in a browser environment.");const s=document.querySelectorAll(`[${t}]`);if(Array.from(s).forEach(r=>Ri(r,{nameAttr:t,icons:e,attrs:n})),t==="data-lucide"){const r=document.querySelectorAll("[icon-name]");r.length>0&&(console.warn("[Lucide] Some icons were found with the now deprecated icon-name attribute. These will still be replaced for backwards compatibility, but will no longer be supported in v1.0 and you should switch to data-lucide"),Array.from(r).forEach(o=>Ri(o,{nameAttr:"icon-name",icons:e,attrs:n})))}},Pi=["#b0e9d6","#8eaff4","#d7a1f1","#eac594","#8cdbdf","#e7a3b8","#a8ca91"];function In(e){let t=2166136261;for(let n=0;n<e.length;n++)t=Math.imul(t^e.charCodeAt(n),16777619);return t=Math.imul(t^t>>>16,2246822507),t=Math.imul(t^t>>>13,3266489909),t^=t>>>16,(t>>>0)/4294967295}function Yn(e){return Us(e).split("/").at(-1)||"/"}const Us=e=>(/^(?:[a-z]:[\\/]|\\\\)/i.test(e)?e.replace(/\\/g,"/"):e).replace(/\/+$/,"")||(e.startsWith("/")?"/":""),Cn=e=>e.directory?JSON.stringify(["directory",Us(e.directory)]):JSON.stringify(["project",e.source||"opencode",e.projectID||e.id]),dn=e=>Math.max(e.created,e.activity?.lastMessageAt||e.created),ao=(e,t)=>{const n=t.timeFrame||t;return(e-n.start)/Math.max(1,n.end-n.start)*300-150},Qv=(e,t)=>ao(t.start+(t.end-t.start)*e,t),_o=(e,t)=>[t,e.position[1],e.position[2]],Bd=(e,t)=>_o(e,Math.max(e.startPosition[0],Math.min(t,e.position[0]))),ey=(e,t,n,s=0,r=[1,0,0])=>{const o=Bd(e,t);return[o[0]+r[0]*(n+s),o[1]+r[1]*(n+s),o[2]+r[2]*(n+s)]},ty=(e,t)=>[_o(e,Math.max(e.startPosition[0],Math.min(t.startPosition[0],e.position[0]))),t.startPosition];function jd(e,t,n){if(!e.length)return{nodes:[],edges:[],lanes:[],start:0,end:0};const s=[...e].sort((E,O)=>E.created-O.created||E.id.localeCompare(O.id)),r=s[0].created,o=s.reduce((E,O)=>Math.max(E,dn(O)),r+36e5),i=n?.nodes.length?n.timeFrame||{start:n.start,end:n.end}:{start:r,end:o},a=new Map;for(const E of s){const O=Cn(E),M=a.get(O)||[];M.push(E),a.set(O,M)}const l=[...a].sort((E,O)=>O[1].length-E[1].length||E[0].localeCompare(O[0])),c=new Map(n?.lanes.map((E,O)=>[E.key,E.slot??O]));let f=Math.max(-1,...c.values())+1;for(const[E]of l)c.has(E)||c.set(E,f++);l.sort((E,O)=>c.get(E[0])-c.get(O[0]));const u=[],h=[],p=new Set(t.flatMap(E=>E.worktrees.map(Us)));l.forEach(([E,O])=>{const M=c.get(E),D=M*2.399963,w=M===0?0:15+Math.sqrt(M)*14,S=Math.cos(D)*w,x=Math.sin(D)*w*.7,T=Pi[M%Pi.length],b=t.find(V=>V.id===O[0].projectID),A=O[0].directory,R={key:E,slot:M,label:A?Yn(A):b?.name||O[0].projectID||"Unknown directory",color:T,kind:A&&p.has(Us(A))?"worktree":"directory",y:S,z:x,nodes:[]};for(const V of O){const H=ao(dn(V),i),z=ao(V.created,i),re=In(V.id),W=!!(V.parentID||V.forkID)?12:6,be=Math.sin((z+150)/65+M*.7)*3.5,Dt=typeof V.tokens=="number"&&Number.isFinite(V.tokens)?Math.max(0,V.tokens):0,$e={session:V,position:[H,S+be+(re-.5)*W,x+(In(V.id+"z")-.5)*W],startPosition:[z,0,0],color:T,radius:.35+Math.min(.9,Math.log10(1+Dt)*.11)};h.push($e),R.nodes.push($e)}u.push(R)});const g=new Set(s.map(E=>E.id)),d=[];for(const E of s)E.forkID&&g.has(E.forkID)?d.push({from:E.forkID,to:E.id,kind:"fork"}):E.parentID&&g.has(E.parentID)&&d.push({from:E.parentID,to:E.id,kind:"child"});const m=new Map(h.map(E=>[E.session.id,E])),y=new Set;for(const E of n?.nodes||[]){const O=m.get(E.session.id);O&&Cn(O.session)===Cn(E.session)&&(O.position[1]=E.position[1],O.position[2]=E.position[2],y.add(O.session.id))}function C(E){const O=[],M=new Set;let D=E;for(;D&&!y.has(D.session.id)&&!M.has(D.session.id);){M.add(D.session.id);const w=D.session.forkID||D.session.parentID,S=w?m.get(w):void 0,x=S&&Cn(S.session)===Cn(D.session)?S:void 0;O.push({node:D,parent:x}),D=x}for(const{node:w,parent:S}of O.reverse()){const x=w.session.id;if(S){const T=In(x+"branch")>.5?1:-1;w.position[1]=S.position[1]+T*(9+In(x)*15),w.position[2]=S.position[2]+(In(x+"depth")-.5)*18}y.add(x)}}return s.forEach(E=>C(m.get(E.id))),h.forEach(E=>{E.startPosition=_o(E,E.startPosition[0])}),{nodes:h,edges:d,lanes:u,start:r,end:o,timeFrame:i}}function Wd(){const e=new AbortController,t={signal:e.signal};let n,s=innerWidth<760;function r(c,f,u){const h=Math.max(12,Math.min(f,innerWidth-c.offsetWidth-12)),p=Math.max(72,Math.min(u,innerHeight-c.offsetHeight-12));Object.assign(c.style,{left:`${h}px`,top:`${p}px`,right:"auto",bottom:"auto",transform:"none"}),c.dataset.positioned="true"}function o(){if(!n)return;const{panel:c,handle:f,pointerID:u}=n;n=void 0,c.classList.remove("dragging"),f.hasPointerCapture(u)&&f.releasePointerCapture(u)}document.addEventListener("pointerdown",c=>{if(c.button!==0)return;const f=c.target,u=f.closest(".floating-panel");if(!u)return;document.querySelectorAll(".floating-panel").forEach(g=>g.classList.toggle("front",g===u));const h=f.closest("[data-drag-panel]");if(!h)return;u.querySelectorAll(".custom-dates[open]").forEach(g=>{g.open=!1}),c.preventDefault(),h.focus({preventScroll:!0});const p=u.getBoundingClientRect();n={panel:u,handle:h,pointerID:c.pointerId,x:c.clientX,y:c.clientY,left:p.left,top:p.top},h.setPointerCapture(c.pointerId),u.classList.add("dragging")},t),document.addEventListener("pointermove",c=>{!n||c.pointerId!==n.pointerID||r(n.panel,n.left+c.clientX-n.x,n.top+c.clientY-n.y)},t),document.addEventListener("pointerup",o,t),document.addEventListener("pointercancel",o,t),document.addEventListener("lostpointercapture",o,t),document.addEventListener("keydown",c=>{const u=c.target.closest("[data-drag-panel]")?.closest(".floating-panel");if(!u||!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(c.key))return;c.preventDefault();const h=u.getBoundingClientRect(),p=c.shiftKey?40:10;r(u,h.left+(c.key==="ArrowLeft"?-p:c.key==="ArrowRight"?p:0),h.top+(c.key==="ArrowUp"?-p:c.key==="ArrowDown"?p:0))},t);const i=[...document.querySelectorAll(".floating-panel")],a=c=>{if(c.hidden||!c.dataset.positioned)return;const f=c.getBoundingClientRect();r(c,f.left,f.top)},l=new ResizeObserver(c=>c.forEach(f=>a(f.target)));return i.forEach(c=>l.observe(c)),window.addEventListener("resize",()=>{o(),s!==innerWidth<760?(s=innerWidth<760,i.forEach(c=>{c.removeAttribute("style"),delete c.dataset.positioned})):i.forEach(a)},t),()=>{o(),e.abort(),l.disconnect()}}const Ud=2,Vi=e=>JSON.stringify([Ud,e.revision,e.updated,e.created,e.projectID,e.directory]),un=e=>e.normalize("NFKD").replace(new RegExp("\\p{M}","gu"),"").toLowerCase(),Bo=e=>un(e).match(/[\p{L}\p{N}]+/gu)||[],qd=e=>Bo(e).join(" ");function Gd(e){const t={text:"",terms:[],phrases:[],filters:[]},n=[];for(const s of e.slice(0,300).match(/(?:[^\s"]+|"[^"]*")+/g)||[]){const r=/^(source|project|dir|model|is|after|before|in):(.+)$/i.exec(s);if(r){const i=r[1].toLowerCase(),a=un(r[2].replace(/^"|"$/g,""));if(i==="in"){const l={title:["title"],files:["files"],messages:["body"],tools:["tools"]};t.fields=l[a],t.fields||(t.error="Use in:title, in:files, in:messages, or in:tools.")}else i==="is"&&!["fork","child","root","archived"].includes(a)?t.error="Use is:fork, is:child, is:root, or is:archived.":["after","before"].includes(i)&&(!/^\d{4}-\d{2}-\d{2}$/.test(a)||!Number.isFinite(Date.parse(a))||new Date(a).toISOString().slice(0,10)!==a)?t.error="Use a valid date in YYYY-MM-DD format.":t.filters.push([i,a]);continue}const o=s.replace(/^"|"$/g,"");s.startsWith('"')&&s.endsWith('"')&&t.phrases.push(qd(o)),n.push(o)}return t.text=n.join(" "),t.terms=Bo(t.text).slice(0,12),t.text=t.terms.join(" "),t}function Yd(e,t,n=220){const s=un(e),r=t.reduce((i,a)=>{const l=s.indexOf(a);return l<0?i:Math.min(i,l)},1/0),o=Number.isFinite(r)?Math.max(0,r-55):0;return`${o?"…":""}${e.slice(o,o+n).replace(/\s+/g," ").trim()}${e.length>o+n?"…":""}`}const jo={opencode:{name:"OpenCode",icon:"opencode"},"claude-code":{name:"Claude Code",icon:"claude"},codex:{name:"Codex",icon:"openai"},"t3-code":{name:"T3 Code",icon:"t3"},cursor:{name:"Cursor",icon:"cursor"},gemini:{name:"Gemini CLI",icon:"gemini"},"qwen-code":{name:"Qwen Code",icon:"qwen"},pi:{name:"Pi",icon:"pi"},copilot:{name:"GitHub Copilot CLI",icon:"copilot"},"copilot-chat":{name:"GitHub Copilot Chat (VS Code)",icon:"copilot"},cline:{name:"Cline",icon:"cline"},"roo-code":{name:"Roo Code",icon:"roo"},"kilo-code":{name:"Kilo Code",icon:"kilo"},continue:{name:"Continue",icon:"continue"},"prime-agent":{name:"Prime Agent",icon:"prime"},omp:{name:"Oh My Pi",icon:"pi"},senpi:{name:"Senpi / OmO Native",icon:"senpi"},kimchi:{name:"Kimchi",icon:"kimchi"},gajae:{name:"Gajae-Code",icon:"gajae"},openclaw:{name:"OpenClaw",icon:"openclaw"},hermes:{name:"Hermes Agent",icon:"hermes"},amp:{name:"Amp",icon:"amp"},droid:{name:"Factory Droid",icon:"droid"},codebuff:{name:"Codebuff",icon:"codebuff"},freebuff:{name:"Freebuff",icon:"freebuff"},kimi:{name:"Kimi CLI / Code",icon:"kimi"},grok:{name:"Grok Build",icon:"grok"},jcode:{name:"Jcode",icon:"jcode"},"cherry-studio":{name:"Cherry Studio",icon:"cherry"},"command-code":{name:"Command Code",icon:"commandcode"},zcode:{name:"ZCode",icon:"zcode"},codebuddy:{name:"CodeBuddy",icon:"codebuddy"},workbuddy:{name:"WorkBuddy",icon:"codebuddy"},proma:{name:"Proma",icon:"proma"},"deepseek-harness":{name:"DeepSeek Harness",icon:"deepseek"},aside:{name:"Aside",icon:"aside"},vibe:{name:"Mistral Vibe",icon:"mistral"},muse:{name:"Muse Code",icon:"muse"},junie:{name:"Junie",icon:"junie"},augment:{name:"Augment Code",icon:"augment"},fx:{name:"Fx",icon:"fx"},"minimax-code":{name:"MiniMax Code",icon:"minimax"},opencodereview:{name:"OpenCodeReview",icon:"opencode"},goose:{name:"Goose",icon:"goose"},zed:{name:"Zed Agent",icon:"zed"},devin:{name:"Devin CLI",icon:"devin"},"devin-desktop":{name:"Devin Desktop",icon:"devin"},crush:{name:"Crush",icon:"crush"},octofriend:{name:"Octofriend",icon:"octofriend"},"kilo-cli":{name:"Kilo CLI",icon:"kilo"},"mimo-code":{name:"MiMo Code",icon:"mimo"},"mimo-desktop":{name:"Xiaomi MiMo AI",icon:"mimo"},unsloth:{name:"Unsloth Studio",icon:"unsloth"},kiro:{name:"Kiro",icon:"kiro"},mux:{name:"Mux",icon:"mux"},antigravity:{name:"Antigravity",icon:"antigravity"},"antigravity-cli":{name:"Antigravity CLI",icon:"antigravity"},"antigravity-extension":{name:"Antigravity IDE Extension",icon:"antigravity"},reasonix:{name:"Reasonix",icon:"reasonix"},trae:{name:"Trae / Trae Solo",icon:"trae"},warp:{name:"Warp / Oz",icon:"warp"},"lm-studio":{name:"LM Studio",icon:"lmstudio"},hindsight:{name:"Hindsight",icon:"hindsight"}},Ue=e=>jo[e||"opencode"]?.name||e||"Unknown",ny=e=>typeof e=="string"&&Object.hasOwn(jo,e),ut=e=>{const t=jo[e||""]?.icon||"generic";return`<span class="source-icon source-icon-${t}" aria-hidden="true" style="--source-icon:url('/sources/${t}.svg')"></span>`},tc=e=>[...e].sort((t,n)=>Number(n.selected||n.available||n.sessions>0)-Number(t.selected||t.available||t.sessions>0)||t.name.localeCompare(n.name)),Vt=e=>e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]);function nc(e,{checked:t=e.selected,disabled:n=!1,settings:s=!1}={}){const r=e.available?"Detected":"Not detected",o=e.capabilities.history?"":e.description.startsWith("Detection only")?"Detection only":"Metadata only",i=[e.description,e.lastImport?`Last import ${new Date(e.lastImport).toLocaleString()}`:"Not imported yet",e.error].filter(Boolean).join(" · ");return`<label class="import-source" data-source="${Vt(e.id)}" title="${Vt(i)}"><input ${s?'class="settings-source"':""} type="checkbox" value="${Vt(e.id)}" aria-label="${Vt(e.name)}" aria-description="${Vt(`${r}. ${e.sessions.toLocaleString()} saved sessions. ${i}`)}" ${t?"checked":""} ${n?"disabled":""}/><span class="source-symbol">${ut(e.id)}</span><span class="source-copy"><strong>${Vt(e.name)}</strong><small class="source-meta"><span class="source-detected ${e.available?"detected":""}">${r}</span><span>${e.sessions.toLocaleString()} saved</span>${o?`<span>${o}</span>`:""}</small>${e.error?`<small class="source-error">${Vt(e.error)}</small>`:""}</span></label>`}const Ce=e=>e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]);function Tn(e,t){const n=new Set(t.map(un));let s=0,r="";for(const o of e.matchAll(/[\p{L}\p{N}]+/gu)){r+=Ce(e.slice(s,o.index));const i=un(o[0]),a=[...n].some(l=>i.startsWith(l));r+=a?`<mark>${Ce(o[0])}</mark>`:Ce(o[0]),s=o.index+o[0].length}return r+Ce(e.slice(s))}function Kd(e,t=()=>{},n){const s=new Worker(new URL("/assets/worker-C10U_apJ.js",import.meta.url),{type:"module"}),r=new AbortController,o={signal:r.signal},i=document.createElement("dialog");i.className="search-dialog",i.setAttribute("aria-label","Search sessions"),i.innerHTML=`
|
|
6
6
|
<div class="search-command"><span class="search-command-icon" aria-hidden="true">⌕</span><input id="session-query" type="search" placeholder="Search sessions, messages, files…" autocomplete="off" spellcheck="false" role="combobox" aria-label="Search all sessions" aria-autocomplete="list" aria-expanded="true" aria-controls="search-results"/><button class="icon-button search-close" aria-label="Close search" title="Close (Esc)">×</button></div>
|
|
7
7
|
<div class="search-options"><select id="search-scope" aria-label="Search scope" title="Switch scope (Alt+S)"><option value="all">All history</option><option value="view">Current view</option></select><button id="search-conversations" class="search-chip" aria-label="Index conversations" aria-pressed="true" title="Pause or resume background indexing. Indexed messages, tools, and files remain searchable.">Conversations</button><span id="search-index-state" role="status">Loading index…</span></div>
|
|
8
8
|
<div class="search-body"><div id="search-results" class="search-results" role="listbox" aria-label="Matching sessions"><div class="search-results-inner"></div></div><aside id="search-preview" class="search-preview" aria-label="Session preview"></aside></div>
|
|
@@ -88,7 +88,7 @@ lucide.createIcons({icons});\``);if(typeof document>"u")throw new Error("`create
|
|
|
88
88
|
${y.input}`:"",y.output?`Output
|
|
89
89
|
${y.output}`:""].filter(Boolean).join(`
|
|
90
90
|
|
|
91
|
-
`);return{text:C.slice(0,1800),shortened:C.length>1800||!!y.partial}}return{clear:g,show(y,C,E,O,M,D){const w=`${C}:${E}:${y.id}`,S=r!==w;S&&g(),r=w,a=y,l=M,c=D,f=O;const x=s.get(w);d(x?.text||y.preview,x?x.shortened?"Content preview":"":"Loading message…"),!(!S||x)&&(i=setTimeout(async()=>{const T=new AbortController;o=T;try{const b=await n.read(C,{item:y.id,revision:E,filter:"messages"},T.signal);if(T.signal.aborted||r!==w||b.selected?.id!==y.id)return;const A=m(b.selected);s.set(w,A),s.size>20&&s.delete(s.keys().next().value),d(A.text,A.shortened?"Content preview":"")}catch{!T.signal.aborted&&r===w&&d(y.preview,"Saved excerpt · open for details")}},120))},dispose(){g(),s.clear()}}}class Zg{constructor(t=(...n)=>fetch(...n)){this.request=t}request;pages=new Map;pending=new Map;characters=0;generation=0;clear(){this.generation++,this.pages.clear(),this.characters=0;for(const t of this.pending.values())t.controller.abort();this.pending.clear()}read(t,n={},s){if(s?.aborted)return Promise.reject(s.reason);const r=n.filter||"all",o=JSON.stringify([t,n.revision,r,n.item,n.cursor]),i=n.revision?this.pages.get(o):void 0;if(i)return this.pages.delete(o),this.pages.set(o,i),Promise.resolve(i.page);let a=this.pending.get(o);if(!a){const c=new AbortController,f=this.generation,u=new URLSearchParams({filter:r,...n}),h=this.request(`/api/sessiongraph/session/${encodeURIComponent(t)}/events?${u}`,{signal:AbortSignal.any([c.signal,AbortSignal.timeout(3e4)])}).then(async d=>{const m=await d.json();if(!d.ok)throw d.status===409&&this.clear(),new Error(m.error||"Could not load events.");if(c.signal.aborted||f!==this.generation)throw new DOMException("Request cancelled","AbortError");if(m.sessionID!==t||n.revision&&m.revision!==n.revision)throw new Error("Saved history changed. Reload the event explorer.");const y=JSON.stringify([t,m.revision,r,n.item,n.cursor]),C=JSON.stringify(m).length;for(this.characters-=this.pages.get(y)?.characters||0,this.pages.delete(y),this.pages.set(y,{page:m,characters:C}),this.characters+=C;this.pages.size>20||this.characters>2e6;){const E=this.pages.keys().next().value;this.characters-=this.pages.get(E).characters,this.pages.delete(E)}return m});a={controller:c,promise:h,readers:0},this.pending.set(o,a);const p=a,g=()=>{this.pending.get(o)===p&&this.pending.delete(o)};h.then(g,g)}const l=a;return l.readers++,new Promise((c,f)=>{const u=()=>{p(),f(s.reason)};let h=!1;const p=()=>{h||(h=!0,s?.removeEventListener("abort",u),--l.readers===0&&this.pending.get(o)===l&&(this.pending.delete(o),l.controller.abort()))};s?.addEventListener("abort",u,{once:!0}),l.promise.then(g=>{h||(p(),c(g))},g=>{h||(p(),f(g))})})}}function ae(e,t,n,s){if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?s:n==="a"?s.call(e):s?s.value:t.get(e)}function tn(e,t,n,s,r){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var Es,Xt,Ie,Qt,xs,Gr,Ss;const La="__TAURI_TO_IPC_KEY__";function Jg(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}class cy{constructor(t){Es.add(this),Xt.set(this,void 0),Ie.set(this,0),Qt.set(this,[]),xs.set(this,void 0),tn(this,Xt,t||(()=>{})),this.id=Jg(n=>{const s=n.index;if("end"in n){s==ae(this,Ie,"f")?this.cleanupCallback():tn(this,xs,s);return}const r=n.message;if(s==ae(this,Ie,"f")){for(ae(this,Es,"m",Gr).call(this,r),tn(this,Ie,ae(this,Ie,"f")+1);ae(this,Ie,"f")in ae(this,Qt,"f");){const o=ae(this,Qt,"f")[ae(this,Ie,"f")];ae(this,Es,"m",Gr).call(this,o),delete ae(this,Qt,"f")[ae(this,Ie,"f")],tn(this,Ie,ae(this,Ie,"f")+1)}ae(this,Ie,"f")===ae(this,xs,"f")&&this.cleanupCallback()}else ae(this,Qt,"f")[s]=r})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(t){tn(this,Xt,t)}get onmessage(){return ae(this,Xt,"f")}[(Xt=new WeakMap,Ie=new WeakMap,Qt=new WeakMap,xs=new WeakMap,Es=new WeakSet,Gr=function(n){try{ae(this,Xt,"f").call(this,n)}catch(s){queueMicrotask(()=>{throw s})}},La)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[La]()}}async function il(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}class ly{get rid(){return ae(this,Ss,"f")}constructor(t){Ss.set(this,void 0),tn(this,Ss,t)}async close(){return il("plugin:resources|close",{rid:this.rid})}async[(Ss=new WeakMap,Symbol.asyncDispose)](){await this.close()}}function Xg(){return!!(globalThis||window).isTauri}async function Qg(){await il("plugin:process|restart")}class em{constructor(t,n,s=Date.now){this.backend=t,this.changed=n,this.now=s}backend;changed;now;state={phase:"hidden"};release;busy=!1;disposed=!1;downloaded=!1;installed=!1;lastCheck=-1/0;set(t){this.disposed||(this.state=t,this.changed(t))}async close(){const t=this.release;this.release=void 0,await t?.close().catch(()=>{})}async check(){if(!(this.disposed||this.busy||this.release||this.now()-this.lastCheck<5*6e4)){this.busy=!0,this.lastCheck=this.now();try{this.release=await this.backend.check()||void 0,this.release&&this.set({phase:"available",version:this.release.version})}catch{}finally{this.busy=!1,this.disposed&&await this.close()}}}async activate(){if(this.disposed||this.busy||!this.release)return;this.busy=!0;const{version:t}=this.release;let n=this.installed?"restart":this.downloaded?"install":"download";try{if(!this.downloaded){let s,r=0;this.set({phase:"downloading",version:t}),await this.release.download(o=>{o.event==="Started"&&(s=o.data.contentLength,r=0),o.event==="Progress"&&(r+=o.data.chunkLength),this.set({phase:"downloading",version:t,progress:s&&s>0?Math.min(99,Math.floor(r/s*100)):void 0})}),this.downloaded=!0,this.set({phase:"ready",version:t});return}if(this.installed||(this.set({phase:"installing",version:t}),await this.release.install(),this.installed=!0),this.disposed)return;n="restart",this.set({phase:"restarting",version:t}),await this.backend.restart()}catch(s){this.set({phase:"error",version:t,retry:n,error:String(s instanceof Error?s.message:s).slice(0,300)})}finally{this.busy=!1,this.disposed&&await this.close()}}dispose(){this.disposed=!0,this.busy||this.close()}}const tm='<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" aria-hidden="true"><path d="M8 2v9m-3-3 3 3 3-3M3 13h10"/></svg>',nm='<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" aria-hidden="true"><path d="M13 7a5 5 0 1 0-.8 4M13 2v5H8"/></svg>';function sm(e){const t=document.createElement("button");t.className="desktop-update glass",t.hidden=!0,t.type="button";const n=document.createElement("span");n.className="sr-only",n.role="status",n.setAttribute("aria-live","polite"),document.querySelector("#app").append(t,n);let s="";const r=c=>{const f=["downloading","installing","restarting"].includes(c.phase),u=c.phase==="ready"||c.phase==="error"&&c.retry!=="download",h=c.phase==="downloading"?c.progress===void 0?"Downloading":`${c.progress}%`:c.phase==="installing"?"Installing":c.phase==="restarting"?"Restarting":u?"Restart":c.phase==="error"?"Retry update":"Update",p=c.phase==="error"?`${c.retry==="restart"?"Could not restart SessionGraph.":`Could not ${c.retry==="download"?"download or verify":"install"} the update.`} ${c.error||""} Click to try again.`:c.phase==="restarting"?`Restarting SessionGraph ${c.version}`:u?`Restart to install SessionGraph ${c.version}`:`Update to SessionGraph ${c.version}`;t.hidden=c.phase==="hidden",t.disabled=f,t.dataset.phase=c.phase,t.setAttribute("aria-busy",String(f)),t.setAttribute("aria-label",p),t.title=p;const g=`${u||c.phase==="restarting"?nm:tm}<span>${h}</span>`;t.innerHTML!==g&&(t.innerHTML=g);const d=c.phase==="hidden"?"":c.phase==="downloading"?`Downloading SessionGraph ${c.version}`:p;d!==s&&(n.textContent=d,s=d)},o=new em(e,r);t.addEventListener("click",()=>{o.activate()});const i=()=>{document.visibilityState==="visible"&&navigator.onLine&&o.check()},a=window.setTimeout(i,1e4),l=window.setInterval(i,240*6e4);return document.addEventListener("visibilitychange",i),window.addEventListener("online",i),{check:()=>o.check(),dispose(){clearTimeout(a),clearInterval(l),o.dispose(),t.remove(),n.remove(),document.removeEventListener("visibilitychange",i),window.removeEventListener("online",i)}}}function rm(){return Xg()?sm({async check(){const{check:e}=await cr(async()=>{const{check:n}=await import("./index-DOYyn-b_.js");return{check:n}},[]),t=await e({timeout:15e3});return t&&{version:t.version,download:n=>t.download(n,{timeout:10*6e4}),install:()=>t.install({restartAfterInstall:!0}),close:()=>t.close()}},async restart(){await Qg()}}):{dispose(){}}}var om=sn("date-picker").parts("clearTrigger","content","control","input","label","monthSelect","nextTrigger","positioner","presetTrigger","prevTrigger","rangeText","root","table","tableBody","tableCell","tableCellTrigger","tableHead","tableHeader","tableRow","trigger","view","viewControl","viewTrigger","yearSelect"),J=om.build();function Yr(e,t){return e-t*Math.floor(e/t)}const al=1721426;function $s(e,t,n,s){t=ci(e,t);let r=t-1,o=-2;return n<=2?o=0:Ns(t)&&(o=-1),al-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*n-362)/12+o+s)}function Ns(e){return e%4===0&&(e%100!==0||e%400===0)}function ci(e,t){return e==="BC"?1-t:t}function im(e){let t="AD";return e<=0&&(t="BC",e=1-e),[t,e]}const am={standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]};class pn{fromJulianDay(t){let n=t,s=n-al,r=Math.floor(s/146097),o=Yr(s,146097),i=Math.floor(o/36524),a=Yr(o,36524),l=Math.floor(a/1461),c=Yr(a,1461),f=Math.floor(c/365),u=r*400+i*100+l*4+f+(i!==4&&f!==4?1:0),[h,p]=im(u),g=n-$s(h,p,1,1),d=2;n<$s(h,p,3,1)?d=0:Ns(p)&&(d=1);let m=Math.floor(((g+d)*12+373)/367),y=n-$s(h,p,m,1)+1;return new Pe(h,p,m,y)}toJulianDay(t){return $s(t.era,t.year,t.month,t.day)}getDaysInMonth(t){return am[Ns(t.year)?"leapyear":"standard"][t.month-1]}getMonthsInYear(t){return 12}getDaysInYear(t){return Ns(t.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(t){return 9999}getEras(){return["BC","AD"]}isInverseEra(t){return t.era==="BC"}balanceDate(t){t.year<=0&&(t.era=t.era==="BC"?"AD":"BC",t.year=1-t.year)}constructor(){this.identifier="gregory"}}const cm={"001":1,AD:1,AE:6,AF:6,AI:1,AL:1,AM:1,AN:1,AR:1,AT:1,AU:1,AX:1,AZ:1,BA:1,BE:1,BG:1,BH:6,BM:1,BN:1,BY:1,CH:1,CL:1,CM:1,CN:1,CR:1,CY:1,CZ:1,DE:1,DJ:6,DK:1,DZ:6,EC:1,EE:1,EG:6,ES:1,FI:1,FJ:1,FO:1,FR:1,GB:1,GE:1,GF:1,GP:1,GR:1,HR:1,HU:1,IE:1,IQ:6,IR:6,IS:1,IT:1,JO:6,KG:1,KW:6,KZ:1,LB:1,LI:1,LK:1,LT:1,LU:1,LV:1,LY:6,MC:1,MD:1,ME:1,MK:1,MN:1,MQ:1,MV:5,MY:1,NL:1,NO:1,NZ:1,OM:6,PL:1,QA:6,RE:1,RO:1,RS:1,RU:1,SD:6,SE:1,SI:1,SK:1,SM:1,SY:6,TJ:1,TM:1,TR:1,UA:1,UY:1,UZ:1,VA:1,VN:1,XK:1};function Se(e,t){return t=de(t,e.calendar),e.era===t.era&&e.year===t.year&&e.month===t.month&&e.day===t.day}function lm(e,t){return t=de(t,e.calendar),e=tt(e),t=tt(t),e.era===t.era&&e.year===t.year&&e.month===t.month}function dm(e,t){return t=de(t,e.calendar),e=es(e),t=es(t),e.era===t.era&&e.year===t.year}function um(e,t){return xr(e.calendar,t.calendar)&&Se(e,t)}function Rn(e,t){return xr(e.calendar,t.calendar)&&lm(e,t)}function Pn(e,t){return xr(e.calendar,t.calendar)&&dm(e,t)}function xr(e,t){return e.isEqual?.(t)??t.isEqual?.(e)??e.identifier===t.identifier}function fm(e,t){return Se(e,Sr(t))}const hm={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6};function cl(e,t,n){let s=e.calendar.toJulianDay(e),r=n?hm[n]:vm(t),o=Math.ceil(s+1-r)%7;return o<0&&(o+=7),o}function ll(e){return nt(Date.now(),e)}function Sr(e){return jt(ll(e))}function dl(e,t){return e.calendar.toJulianDay(e)-t.calendar.toJulianDay(t)}function pm(e,t){return Oa(e)-Oa(t)}function Oa(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let Kr=null,gm=!1;function li(){return Kr==null&&(Kr=new Intl.DateTimeFormat().resolvedOptions().timeZone),Kr}function ul(){return gm}function tt(e){return e.subtract({days:e.day-1})}function Oo(e){return e.add({days:e.calendar.getDaysInMonth(e)-e.day})}function es(e){return tt(e.subtract({months:e.month-1}))}function mm(e){return Oo(e.add({months:e.calendar.getMonthsInYear(e)-e.month}))}function $t(e,t,n){let s=cl(e,t,n);return e.subtract({days:s})}function Ma(e,t,n){return $t(e,t,n).add({days:6})}const Da=new Map,zr=new Map;function fl(e){if(Intl.Locale){let n=Da.get(e);return n||(n=new Intl.Locale(e).maximize().region,n&&Da.set(e,n)),n}let t=e.split("-")[1];return t==="u"?void 0:t}function vm(e){let t=zr.get(e);if(!t){if(Intl.Locale){let s=new Intl.Locale(e);if("getWeekInfo"in s&&(t=s.getWeekInfo(),t))return zr.set(e,t),t.firstDay}let n=fl(e);if(e.includes("-fw-")){let s=e.split("-fw-")[1].split("-")[0];s==="mon"?t={firstDay:1}:s==="tue"?t={firstDay:2}:s==="wed"?t={firstDay:3}:s==="thu"?t={firstDay:4}:s==="fri"?t={firstDay:5}:s==="sat"?t={firstDay:6}:t={firstDay:0}}else e.includes("-ca-iso8601")?t={firstDay:1}:t={firstDay:n&&cm[n]||0};zr.set(e,t)}return t.firstDay}function ym(e,t,n){let s=e.calendar.getDaysInMonth(e);return Math.ceil((cl(tt(e),t,n)+s)/7)}function hl(e,t){return e&&t?e.compare(t)<=0?e:t:e||t}function pl(e,t){return e&&t?e.compare(t)>=0?e:t:e||t}const bm={AF:[4,5],AE:[5,6],BH:[5,6],DZ:[5,6],EG:[5,6],IL:[5,6],IQ:[5,6],IR:[5,5],JO:[5,6],KW:[5,6],LY:[5,6],OM:[5,6],QA:[5,6],SA:[5,6],SD:[5,6],SY:[5,6],YE:[5,6]};function wm(e,t){let n=e.calendar.toJulianDay(e),s=Math.ceil(n+1)%7;s<0&&(s+=7);let r=fl(t),[o,i]=bm[r]||[6,0];return s===o||s===i}function gn(e){e=de(e,new pn);let t=ci(e.era,e.year);return gl(t,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function gl(e,t,n,s,r,o,i){let a=new Date;return a.setUTCHours(s,r,o,i),a.setUTCFullYear(e,t-1,n),a.getTime()}function Mo(e,t){if(t==="UTC")return 0;if(e>0&&t===li()&&!ul())return new Date(e).getTimezoneOffset()*-6e4;let{year:n,month:s,day:r,hour:o,minute:i,second:a}=ml(e,t);return gl(n,s,r,o,i,a,0)-Math.floor(e/1e3)*1e3}const Ra=new Map;function ml(e,t){let n=Ra.get(t);n||(n=new Intl.DateTimeFormat("en-US",{timeZone:t,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),Ra.set(t,n));let s=n.formatToParts(new Date(e)),r={};for(let o of s)o.type!=="literal"&&(r[o.type]=o.value);return{year:r.era==="BC"||r.era==="B"?-r.year+1:+r.year,month:+r.month,day:+r.day,hour:r.hour==="24"?0:+r.hour,minute:+r.minute,second:+r.second}}const Pa=864e5;function Em(e,t,n,s){return(n===s?[n]:[n,s]).filter(o=>xm(e,t,o))}function xm(e,t,n){let s=ml(n,t);return e.year===s.year&&e.month===s.month&&e.day===s.day&&e.hour===s.hour&&e.minute===s.minute&&e.second===s.second}function et(e,t,n="compatible"){let s=Le(e);if(t==="UTC")return gn(s);if(t===li()&&n==="compatible"&&!ul()){s=de(s,new pn);let l=new Date,c=ci(s.era,s.year);return l.setFullYear(c,s.month-1,s.day),l.setHours(s.hour,s.minute,s.second,s.millisecond),l.getTime()}let r=gn(s),o=Mo(r-Pa,t),i=Mo(r+Pa,t),a=Em(s,t,r-o,r-i);if(a.length===1)return a[0];if(a.length>1)switch(n){case"compatible":case"earlier":return a[0];case"later":return a[a.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(n){case"earlier":return Math.min(r-o,r-i);case"compatible":case"later":return Math.max(r-o,r-i);case"reject":throw new RangeError("No such absolute time found")}}function vl(e,t,n="compatible"){return new Date(et(e,t,n))}function nt(e,t){let n=Mo(e,t),s=new Date(e+n),r=s.getUTCFullYear(),o=s.getUTCMonth()+1,i=s.getUTCDate(),a=s.getUTCHours(),l=s.getUTCMinutes(),c=s.getUTCSeconds(),f=s.getUTCMilliseconds();return new ts(r<1?"BC":"AD",r<1?-r+1:r,o,i,t,n,a,l,c,f)}function jt(e){return new Pe(e.calendar,e.era,e.year,e.month,e.day)}function Le(e,t){let n=0,s=0,r=0,o=0;if("timeZone"in e)({hour:n,minute:s,second:r,millisecond:o}=e);else if("hour"in e&&!t)return e;return t&&({hour:n,minute:s,second:r,millisecond:o}=t),new sr(e.calendar,e.era,e.year,e.month,e.day,n,s,r,o)}function de(e,t){if(xr(e.calendar,t))return e;let n=t.fromJulianDay(e.calendar.toJulianDay(e)),s=e.copy();return s.calendar=t,s.era=n.era,s.year=n.year,s.month=n.month,s.day=n.day,Gt(s),s}function yl(e,t,n){if(e instanceof ts)return e.timeZone===t?e:$m(e,t);let s=et(e,t,n);return nt(s,t)}function Sm(e){let t=gn(e)-e.offset;return new Date(t)}function $m(e,t){let n=gn(e)-e.offset;return de(nt(n,t),e.calendar)}const Vn=36e5;function $r(e,t){let n=e.copy(),s="hour"in n?km(n,t):0;Do(n,t.years||0),n.calendar.balanceYearMonth&&n.calendar.balanceYearMonth(n,e),n.month+=t.months||0,Ro(n),bl(n),n.day+=(t.weeks||0)*7,n.day+=t.days||0,n.day+=s,Im(n),n.calendar.balanceDate&&n.calendar.balanceDate(n),n.year<1&&(n.year=1,n.month=1,n.day=1);let r=n.calendar.getYearsInEra(n);if(n.year>r){let i=n.calendar.isInverseEra?.(n);n.year=r,n.month=i?1:n.calendar.getMonthsInYear(n),n.day=i?1:n.calendar.getDaysInMonth(n)}n.month<1&&(n.month=1,n.day=1);let o=n.calendar.getMonthsInYear(n);return n.month>o&&(n.month=o,n.day=n.calendar.getDaysInMonth(n)),n.day=Math.max(1,Math.min(n.calendar.getDaysInMonth(n),n.day)),n}function Do(e,t){e.calendar.isInverseEra?.(e)&&(t=-t),e.year+=t}function Ro(e){for(;e.month<1;)Do(e,-1),e.month+=e.calendar.getMonthsInYear(e);let t=0;for(;e.month>(t=e.calendar.getMonthsInYear(e));)e.month-=t,Do(e,1)}function Im(e){for(;e.day<1;)e.month--,Ro(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,Ro(e)}function bl(e){e.month=Math.max(1,Math.min(e.calendar.getMonthsInYear(e),e.month)),e.day=Math.max(1,Math.min(e.calendar.getDaysInMonth(e),e.day))}function Gt(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),bl(e)}function wl(e){let t={};for(let n in e)typeof e[n]=="number"&&(t[n]=-e[n]);return t}function El(e,t){return $r(e,wl(t))}function di(e,t){let n=e.copy();return t.era!=null&&(n.era=t.era),t.year!=null&&(n.year=t.year),t.month!=null&&(n.month=t.month),t.day!=null&&(n.day=t.day),Gt(n),n}function nr(e,t){let n=e.copy();return t.hour!=null&&(n.hour=t.hour),t.minute!=null&&(n.minute=t.minute),t.second!=null&&(n.second=t.second),t.millisecond!=null&&(n.millisecond=t.millisecond),Tm(n),n}function Cm(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=Is(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=Is(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=Is(e.minute,60);let t=Math.floor(e.hour/24);return e.hour=Is(e.hour,24),t}function Tm(e){e.millisecond=Math.max(0,Math.min(e.millisecond,999)),e.second=Math.max(0,Math.min(e.second,59)),e.minute=Math.max(0,Math.min(e.minute,59)),e.hour=Math.max(0,Math.min(e.hour,23))}function Is(e,t){let n=e%t;return n<0&&(n+=t),n}function km(e,t){return e.hour+=t.hours||0,e.minute+=t.minutes||0,e.second+=t.seconds||0,e.millisecond+=t.milliseconds||0,Cm(e)}function ui(e,t,n,s){let r=e.copy();switch(t){case"era":{let o=e.calendar.getEras(),i=o.indexOf(e.era);if(i<0)throw new Error("Invalid era: "+e.era);i=st(i,n,0,o.length-1,s?.round),r.era=o[i],Gt(r);break}case"year":r.calendar.isInverseEra?.(r)&&(n=-n),r.year=st(e.year,n,-1/0,9999,s?.round),r.year===-1/0&&(r.year=1),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e);break;case"month":r.month=st(e.month,n,1,e.calendar.getMonthsInYear(e),s?.round);break;case"day":r.day=st(e.day,n,1,e.calendar.getDaysInMonth(e),s?.round);break;default:throw new Error("Unsupported field "+t)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),Gt(r),r}function xl(e,t,n,s){let r=e.copy();switch(t){case"hour":{let o=e.hour,i=0,a=23;if(s?.hourCycle===12){let l=o>=12;i=l?12:0,a=l?23:11}r.hour=st(o,n,i,a,s?.round);break}case"minute":r.minute=st(e.minute,n,0,59,s?.round);break;case"second":r.second=st(e.second,n,0,59,s?.round);break;case"millisecond":r.millisecond=st(e.millisecond,n,0,999,s?.round);break;default:throw new Error("Unsupported field "+t)}return r}function st(e,t,n,s,r=!1){if(r){e+=Math.sign(t),e<n&&(e=s);let o=Math.abs(t);t>0?e=Math.ceil(e/o)*o:e=Math.floor(e/o)*o,e>s&&(e=n)}else e+=t,e<n?e=s-(n-e-1):e>s&&(e=n+(e-s-1));return e}function Sl(e,t){let n;if(t.years!=null&&t.years!==0||t.months!=null&&t.months!==0||t.weeks!=null&&t.weeks!==0||t.days!=null&&t.days!==0){let r=$r(Le(e),{years:t.years,months:t.months,weeks:t.weeks,days:t.days});n=et(r,e.timeZone)}else n=gn(e)-e.offset;n+=t.milliseconds||0,n+=(t.seconds||0)*1e3,n+=(t.minutes||0)*6e4,n+=(t.hours||0)*36e5;let s=nt(n,e.timeZone);return de(s,e.calendar)}function Am(e,t){return Sl(e,wl(t))}function Lm(e,t,n,s){switch(t){case"hour":{let r=0,o=23;if(s?.hourCycle===12){let g=e.hour>=12;r=g?12:0,o=g?23:11}let i=Le(e),a=de(nr(i,{hour:r}),new pn),l=[et(a,e.timeZone,"earlier"),et(a,e.timeZone,"later")].filter(g=>nt(g,e.timeZone).day===a.day)[0],c=de(nr(i,{hour:o}),new pn),f=[et(c,e.timeZone,"earlier"),et(c,e.timeZone,"later")].filter(g=>nt(g,e.timeZone).day===c.day).pop(),u=gn(e)-e.offset,h=Math.floor(u/Vn),p=u%Vn;return u=st(h,n,Math.floor(l/Vn),Math.floor(f/Vn),s?.round)*Vn+p,de(nt(u,e.timeZone),e.calendar)}case"minute":case"second":case"millisecond":return xl(e,t,n,s);case"era":case"year":case"month":case"day":{let r=ui(Le(e),t,n,s),o=et(r,e.timeZone);return de(nt(o,e.timeZone),e.calendar)}default:throw new Error("Unsupported field "+t)}}function Om(e,t,n){let s=Le(e),r=nr(di(s,t),t);if(r.compare(s)===0)return e;let o=et(r,e.timeZone,n);return de(nt(o,e.timeZone),e.calendar)}const Mm=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,Dm=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function Rm(e){let t=e.match(Mm);if(!t)throw Dm.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let n=new Pe(Zr(t[1],0,9999),Zr(t[2],1,12),1);return n.day=Zr(t[3],1,n.calendar.getDaysInMonth(n)),n}function Zr(e,t,n){let s=Number(e);if(s<t||s>n)throw new RangeError(`Value out of range: ${t} <= ${s} <= ${n}`);return s}function Pm(e){return`${String(e.hour).padStart(2,"0")}:${String(e.minute).padStart(2,"0")}:${String(e.second).padStart(2,"0")}${e.millisecond?String(e.millisecond/1e3).slice(1):""}`}function $l(e){let t=de(e,new pn),n;return t.era==="BC"?n=t.year===1?"0000":"-"+String(Math.abs(1-t.year)).padStart(6,"00"):n=String(t.year).padStart(4,"0"),`${n}-${String(t.month).padStart(2,"0")}-${String(t.day).padStart(2,"0")}`}function Il(e){return`${$l(e)}T${Pm(e)}`}function Vm(e){let t=Math.sign(e)<0?"-":"+";e=Math.abs(e);let n=Math.floor(e/36e5),s=Math.floor(e%36e5/6e4),r=Math.floor(e%36e5%6e4/1e3),o=`${t}${String(n).padStart(2,"0")}:${String(s).padStart(2,"0")}`;return r!==0&&(o+=`:${String(r).padStart(2,"0")}`),o}function Nm(e){return`${Il(e)}${Vm(e.offset)}[${e.timeZone}]`}function fi(e){let t=typeof e[0]=="object"?e.shift():new pn,n;if(typeof e[0]=="string")n=e.shift();else{let i=t.getEras();n=i[i.length-1]}let s=e.shift(),r=e.shift(),o=e.shift();return[t,n,s,r,o]}class Pe{#e;constructor(...t){let[n,s,r,o,i]=fi(t);this.calendar=n,this.era=s,this.year=r,this.month=o,this.day=i,Gt(this)}copy(){return this.era?new Pe(this.calendar,this.era,this.year,this.month,this.day):new Pe(this.calendar,this.year,this.month,this.day)}add(t){return $r(this,t)}subtract(t){return El(this,t)}set(t){return di(this,t)}cycle(t,n,s){return ui(this,t,n,s)}toDate(t){return vl(this,t)}toString(){return $l(this)}compare(t){return dl(this,t)}}class sr{#e;constructor(...t){let[n,s,r,o,i]=fi(t);this.calendar=n,this.era=s,this.year=r,this.month=o,this.day=i,this.hour=t.shift()||0,this.minute=t.shift()||0,this.second=t.shift()||0,this.millisecond=t.shift()||0,Gt(this)}copy(){return this.era?new sr(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new sr(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(t){return $r(this,t)}subtract(t){return El(this,t)}set(t){return di(nr(this,t),t)}cycle(t,n,s){switch(t){case"era":case"year":case"month":case"day":return ui(this,t,n,s);default:return xl(this,t,n,s)}}toDate(t,n){return vl(this,t,n)}toString(){return Il(this)}compare(t){let n=dl(this,t);return n===0?pm(this,Le(t)):n}}class ts{#e;constructor(...t){let[n,s,r,o,i]=fi(t),a=t.shift(),l=t.shift();this.calendar=n,this.era=s,this.year=r,this.month=o,this.day=i,this.timeZone=a,this.offset=l,this.hour=t.shift()||0,this.minute=t.shift()||0,this.second=t.shift()||0,this.millisecond=t.shift()||0,Gt(this)}copy(){return this.era?new ts(this.calendar,this.era,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond):new ts(this.calendar,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond)}add(t){return Sl(this,t)}subtract(t){return Am(this,t)}set(t,n){return Om(this,t,n)}cycle(t,n,s){return Lm(this,t,n,s)}toDate(){return Sm(this)}toString(){return Nm(this)}toAbsoluteString(){return this.toDate().toISOString()}compare(t){return this.toDate().getTime()-yl(t,this.timeZone).toDate().getTime()}}let Jr=new Map;class Ae{constructor(t,n={}){this.formatter=Cl(t,n),this.options=n}format(t){return this.formatter.format(t)}formatToParts(t){return this.formatter.formatToParts(t)}formatRange(t,n){if(typeof this.formatter.formatRange=="function")return this.formatter.formatRange(t,n);if(n<t)throw new RangeError("End date must be >= start date");return`${this.formatter.format(t)} – ${this.formatter.format(n)}`}formatRangeToParts(t,n){if(typeof this.formatter.formatRangeToParts=="function")return this.formatter.formatRangeToParts(t,n);if(n<t)throw new RangeError("End date must be >= start date");let s=this.formatter.formatToParts(t),r=this.formatter.formatToParts(n);return[...s.map(o=>({...o,source:"startRange"})),{type:"literal",value:" – ",source:"shared"},...r.map(o=>({...o,source:"endRange"}))]}resolvedOptions(){let t=this.formatter.resolvedOptions();return _m()&&(this.resolvedHourCycle||(this.resolvedHourCycle=Bm(t.locale,this.options)),t.hourCycle=this.resolvedHourCycle,t.hour12=this.resolvedHourCycle==="h11"||this.resolvedHourCycle==="h12"),t.calendar==="ethiopic-amete-alem"&&(t.calendar="ethioaa"),t}}const Fm={true:{ja:"h11"},false:{}};function Cl(e,t={}){if(typeof t.hour12=="boolean"&&Hm()){t={...t};let r=Fm[String(t.hour12)][e.split("-")[0]],o=t.hour12?"h12":"h23";t.hourCycle=r??o,delete t.hour12}let n=e+(t?Object.entries(t).sort((r,o)=>r[0]<o[0]?-1:1).join():"");if(Jr.has(n))return Jr.get(n);let s=new Intl.DateTimeFormat(e,t);return Jr.set(n,s),s}let Xr=null;function Hm(){return Xr==null&&(Xr=new Intl.DateTimeFormat("en-US",{hour:"numeric",hour12:!1}).format(new Date(2020,2,3,0))==="24"),Xr}let Qr=null;function _m(){return Qr==null&&(Qr=new Intl.DateTimeFormat("fr",{hour:"numeric",hour12:!1}).resolvedOptions().hourCycle==="h12"),Qr}function Bm(e,t){if(!t.timeStyle&&!t.hour)return;e=e.replace(/(-u-)?-nu-[a-zA-Z0-9]+/,""),e+=(e.includes("-u-")?"":"-u")+"-nu-latn";let n=Cl(e,{...t,timeZone:void 0}),s=parseInt(n.formatToParts(new Date(2020,2,3,0)).find(o=>o.type==="hour").value,10),r=parseInt(n.formatToParts(new Date(2020,2,3,23)).find(o=>o.type==="hour").value,10);if(s===0&&r===23)return"h23";if(s===24&&r===23)return"h24";if(s===0&&r===11)return"h11";if(s===12&&r===11)return"h12";throw new Error("Unexpected hour cycle result")}function jm(e,t,n,s,r){const o={};for(let a in t){const l=a,c=t[l];c!=null&&(o[l]=Math.floor(c/2),o[l]>0&&c%2===0&&o[l]--)}const i=zt(e,t,n).subtract(o);return os(e,i,t,n,s,r)}function zt(e,t,n,s,r){let o=e;return t.years?o=es(e):t.months?o=tt(e):t.weeks&&(o=$t(e,n)),os(e,o,t,n,s,r)}function hi(e,t,n,s,r){let o={...t};o.days?o.days--:o.weeks?o.weeks--:o.months?o.months--:o.years&&o.years--;let i=zt(e,t,n).subtract(o);return os(e,i,t,n,s,r)}function os(e,t,n,s,r,o){return r&&e.compare(r)>=0&&(t=pl(t,zt(jt(r),n,s))),o&&e.compare(o)<=0&&(t=hl(t,hi(jt(o),n,s))),t}function ke(e,t,n){const s=jt(e),r=t?jt(t):void 0,o=n?jt(n):void 0;let i=s;return r&&(i=pl(i,r)),o&&(i=hl(i,o)),i.compare(s)===0?e:"hour"in e?e.set({year:i.year,month:i.month,day:i.day}):i}function Va(e,t,n,s,r,o){switch(t){case"start":return zt(e,n,s,r,o);case"end":return hi(e,n,s,r,o);default:return jm(e,n,s,r,o)}}function 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 Na(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 Wm(e,t,n){const s=e.subtract({days:1});return Se(s,e)||_e(s,t,n)}function Um(e,t,n){const s=e.add({days:1});return Se(s,e)||_e(s,t,n)}function pi(e){let t={...e};for(let n in t)t[n]=1;return t}function Tl(e,t){let n={...t};return n.days?n.days--:n.days=-1,e.add(n)}function kl(e){if(!e)return;const t=e.calendar.identifier;return t==="gregory"||t==="iso8601"?e.era==="BC"?"short":void 0:"short"}function Al(e,t,n){const s=n??Le(Sr(t));return new Ae(e,{weekday:"long",month:"long",year:"numeric",day:"numeric",era:kl(s),calendar:s.calendar.identifier,timeZone:t})}function Fa(e,t,n){const s=n??Sr(t);return new Ae(e,{month:"long",year:"numeric",era:kl(s),calendar:s.calendar.identifier,timeZone:t})}function qm(e,t,n,s,r){let o=n.formatRangeToParts(e.toDate(r),t.toDate(r)),i=-1;for(let c=0;c<o.length;c++){let f=o[c];if(f.source==="shared"&&f.type==="literal")i=c;else if(f.source==="endRange")break}let a="",l="";for(let c=0;c<o.length;c++)c<i?a+=o[c].value:c>i&&(l+=o[c].value);return s(a,l)}function Cs(e,t,n,s){if(!e)return"";let r=e,o=t??e,i=Al(n,s);return Se(r,o)?i.format(r.toDate(s)):qm(r,o,i,(a,l)=>`${a} – ${l}`,s)}var Gm=["sun","mon","tue","wed","thu","fri","sat"];function Ll(e){return e!=null?Gm[e]:void 0}function Ol(e,t,n){const s=Ll(n);return $t(e,t,s)}function Ml(e,t,n,s){const r=t.add({weeks:e}),o=[];let i=Ol(r,n,s);for(;o.length<7;){o.push(i);let a=i.add({days:1});if(Se(i,a))break;i=a}return o}function Ym(e,t,n,s){const r=Ll(s),o=n??ym(e,t,r);return[...new Array(o).keys()].map(a=>Ml(a,e,t,s))}function Km(e,t){const n=new Ae(e,{weekday:"long",timeZone:t}),s=new Ae(e,{weekday:"short",timeZone:t}),r=new Ae(e,{weekday:"narrow",timeZone:t});return o=>{const i=o instanceof Date?o:o.toDate(t);return{value:o,short:s.format(i),long:n.format(i),narrow:r.format(i)}}}function zm(e,t,n,s){const r=Ol(e,s,t),o=[...new Array(7).keys()],i=Km(s,n);return o.map(a=>i(r.add({days:a})))}function Zm(e,t="long",n){if(!n||n.calendar.identifier==="gregory"||n.calendar.identifier==="iso8601"){const i=new Date(2021,0,1),a=[];for(let l=0;l<12;l++)a.push(i.toLocaleString(e,{month:t})),i.setMonth(i.getMonth()+1);return a}const s=n.calendar.getMonthsInYear(n),r=new Ae(e,{month:t,calendar:n.calendar.identifier}),o=[];for(let i=1;i<=s;i++){const a=n.set({month:i});o.push(r.format(a.toDate("UTC")))}return o}function Ha(e,t){const n=$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"),f=c.calendar.toJulianDay(c);return 1+Math.floor((i-f)/7)}function Jm(e){const t=[];for(let n=e.from;n<=e.to;n+=1)t.push(n);return t}var Xm=1900,Qm=2099;function ev(e,t,n){const s=e.calendar,r=t?.year??de(new Pe(Xm,1,1),s).year,o=n?.year??de(new Pe(Qm,12,31),s).year;return{from:r,to:o}}var tv=10;function nv(e){if(e){if(e.length===3)return e.padEnd(4,"0");if(e.length===2){const t=new Date().getFullYear(),n=Math.floor(t/100)*100,s=parseInt(e.slice(-2),10),r=n+s;return r>t+tv?(r-100).toString():r.toString()}return e}}function cn(e){const t=e-e%10,n=[];for(let s=0;s<10;s+=1){const r=t+s;n.push(r)}return n}function zn(e,t){const n=Sr(e??li());return t?de(n,t):n}function is(e,t,n,s){return function(o){const{startDate:i,focusedDate:a}=o,l=Tl(i,e);return _e(a,n,s)?{startDate:i,focusedDate:ke(a,n,s),endDate:l}:a.compare(i)<0?{startDate:hi(a,e,t,n,s),focusedDate:ke(a,n,s),endDate:l}:a.compare(l)>0?{startDate:zt(a,e,t,n,s),endDate:l,focusedDate:ke(a,n,s)}:{startDate:i,endDate:l,focusedDate:ke(a,n,s)}}}function Dl(e,t,n,s,r,o){const i=is(n,s,r,o),a=t.add(n);return i({focusedDate:e.add(n),startDate:zt(os(e,a,n,s,r,o),n,s)})}function Rl(e,t,n,s,r,o){const i=is(n,s,r,o);let a=t.subtract(n);return i({focusedDate:e.subtract(n),startDate:zt(os(e,a,n,s,r,o),n,s)})}function sv(e,t,n,s,r,o,i){const a=is(s,r,o,i);if(!n&&!s.days)return a({focusedDate:e.add(pi(s)),startDate:t});if(s.days)return Dl(e,t,s,r,o,i);if(s.weeks)return a({focusedDate:e.add({months:1}),startDate:t});if(s.months||s.years)return a({focusedDate:e.add({years:1}),startDate:t})}function rv(e,t,n,s,r,o,i){const a=is(s,r,o,i);if(!n&&!s.days)return a({focusedDate:e.subtract(pi(s)),startDate:t});if(s.days)return Rl(e,t,s,r,o,i);if(s.weeks)return a({focusedDate:e.subtract({months:1}),startDate:t});if(s.months||s.years)return a({focusedDate:e.subtract({years:1}),startDate:t})}var _a=new Map;function ov(e){let t=_a.get(e);return t!=null||(t="0123456789"+new Intl.NumberFormat(e,{useGrouping:!1}).format(1234567890),_a.set(e,t)),t}var iv=(e,t)=>t?ov(t).includes(e):/\d/.test(e),Pl=(e,t,n)=>!e||e.length!==1?!0:iv(e,n)||t.includes(e),av=(e,t,n)=>e.split("").filter(s=>Pl(s,t,n)).join(""),Ba=new Map;function cv(e){let t=Ba.get(e);if(t!=null)return t;const s=new Intl.DateTimeFormat(e).formatToParts(new Date).find(r=>r.type==="literal");return t=s?s.value:"/",Ba.set(e,t),t}var ja=e=>e!=null&&e.length===4,lv=e=>e!=null&&parseFloat(e)<=12,dv=e=>e!=null&&parseFloat(e)<=31;function uv(e,t,n){const s=fv(t,n);let{year:r,month:o,day:i}=hv(s,e)??{};if(r!=null||o!=null||i!=null){const c=new Date;r||(r=c.getFullYear().toString()),o||(o=(c.getMonth()+1).toString()),i||(i=c.getDate().toString())}if(ja(r)||(r=nv(r)),ja(r)&&lv(o)&&dv(i))return new 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 fv(e,t){return new Ae(e,{day:"numeric",month:"numeric",year:"numeric",timeZone:t}).formatToParts(new Date(2e3,11,25)).map(({type:r,value:o})=>r==="literal"?`${o}?`:`((?!=<${r}>)\\d+)?`).join("")}function hv(e,t){const n=t.match(e);return e.toString().match(/<(.+?)>/g)?.map(s=>{const r=s.match(/<(.+)>/);return!r||r.length<=0?null:s.match(/<(.+)>/)?.[1]}).reduce((s,r,o)=>(r&&(n&&n.length>o?s[r]=n[o+1]:s[r]=null),s),{})}function Wa(e,t,n){const s=jt(ll(n));switch(e){case"thisWeek":return[$t(s,t),Ma(s,t)];case"thisMonth":return[tt(s),s];case"thisQuarter":return[tt(s).add({months:-((s.month-1)%3)}),s];case"thisYear":return[es(s),s];case"last3Days":return[s.add({days:-2}),s];case"last7Days":return[s.add({days:-6}),s];case"last14Days":return[s.add({days:-13}),s];case"last30Days":return[s.add({days:-29}),s];case"last90Days":return[s.add({days:-89}),s];case"lastMonth":return[tt(s.add({months:-1})),Oo(s.add({months:-1}))];case"lastQuarter":return[tt(s.add({months:-((s.month-1)%3)-3})),Oo(s.add({months:-((s.month-1)%3)-1}))];case"lastWeek":return[$t(s,t).add({weeks:-1}),Ma(s,t).add({weeks:-1})];case"lastYear":return[es(s.add({years:-1})),mm(s.add({years:-1}))];default:throw new Error(`Invalid date range preset: ${e}`)}}var pv=(e,t)=>e.ids?.label?.(t)??`datepicker:${e.id}:label:${t}`,gv=e=>e.ids?.root??`datepicker:${e.id}`,mv=(e,t)=>e.ids?.table?.(t)??`datepicker:${e.id}:table:${t}`,Po=e=>e.ids?.content??`datepicker:${e.id}:content`,eo=(e,t)=>e.ids?.cellTrigger?.(t)??`datepicker:${e.id}:cell-trigger:${t}`,vv=(e,t)=>e.ids?.prevTrigger?.(t)??`datepicker:${e.id}:prev:${t}`,yv=(e,t)=>e.ids?.nextTrigger?.(t)??`datepicker:${e.id}:next:${t}`,bv=(e,t)=>e.ids?.viewTrigger?.(t)??`datepicker:${e.id}:view:${t}`,Vl=e=>e.ids?.clearTrigger??`datepicker:${e.id}:clear`,Nl=e=>e.ids?.control??`datepicker:${e.id}:control`,Ua=(e,t)=>e.ids?.input?.(t)??`datepicker:${e.id}:input:${t}`,Fl=e=>e.ids?.trigger??`datepicker:${e.id}:trigger`,Hl=e=>e.ids?.positioner??`datepicker:${e.id}:positioner`,_l=e=>e.ids?.monthSelect??`datepicker:${e.id}:month-select`,Bl=e=>e.ids?.yearSelect??`datepicker:${e.id}:year-select`,qa=(e,t)=>Af(nn(e),`[data-part=table-cell-trigger][data-view=${t}][data-focus]:not([data-outside-range])`),Fs=e=>e.getById(Fl(e)),nn=e=>e.getById(Po(e)),Un=e=>kf(jl(e),"[data-part=input]"),wv=e=>e.getById(Bl(e)),Ev=e=>e.getById(_l(e)),xv=e=>e.getById(Vl(e)),Ga=e=>e.getById(Hl(e)),jl=e=>e.getById(Nl(e)),Ya=e=>{const t=Un(e);if(t.length===0){Fs(e)?.focus({preventScroll:!0});return}const n=t.findLastIndex(o=>o.value!==""),s=Math.max(n,0),r=t[s];r?.focus({preventScroll:!0}),r?.setSelectionRange(r.value.length,r.value.length)};function Hs(e){const[t,n]=e;let s;return!t||!n?s=e:s=t.compare(n)<=0?e:[n,t],s}function en(e,t){const[n,s]=t;return!n||!s?!1:n.compare(e)<=0&&s.compare(e)>=0}function Ts(e){return e.slice().filter(t=>t!=null).sort((t,n)=>t.compare(n))}function Sv(e,t){return new Ae(e).formatToParts(new Date).map(n=>t[n.type]??n.value).join("")}var Ka=e=>!Number.isNaN(e.day)&&!Number.isNaN(e.month)&&!Number.isNaN(e.year),$v={dayCell(e){return e.unavailable?`Not available. ${e.valueText}`:e.firstInRange?`Starting range from ${e.valueText}`:e.lastInRange?`Range ending at ${e.valueText}`:e.inRange?`In range. ${e.valueText}`:e.selected?`Selected date. ${e.valueText}`:`Choose ${e.valueText}`},trigger(e){return e?"Close calendar":"Open calendar"},viewTrigger(e,t){return t?`Switch to ${t} view`:`${e} view`},presetTrigger(e){const[t="",n=""]=e;return`select ${t} to ${n}`},prevTrigger(e){return co(e,{year:"Switch to previous decade",month:"Switch to previous year",day:"Switch to previous month"})},nextTrigger(e){return co(e,{year:"Switch to next decade",month:"Switch to next year",day:"Switch to next month"})},placeholder(){return{day:"dd",month:"mm",year:"yyyy"}},content:"calendar",monthSelect:"Select month",yearSelect:"Select year",clearTrigger:"Clear selected dates",weekColumnHeader:"Wk",weekNumberCell(e){return`Week ${e}`}};function it(e,t){return e?e==="day"?0:e==="month"?1:2:t||0}function gi(e){return e===0?"day":e===1?"month":"year"}function mi(e,t,n){return gi(yu(it(e,0),it(t,0),it(n,2)))}function Iv(e,t){return it(e,0)>it(t,0)}function Cv(e,t){return it(e,0)<it(t,0)}function Wl(e,t,n){const s=it(e,0)+1;return mi(gi(s),t,n)}function Tv(e,t,n){const s=it(e,0)-1;return mi(gi(s),t,n)}var kv=["day","month","year"];function Av(e){kv.forEach(t=>e(t))}var Lv=Tp(e=>[e.view,e.startValue.toString(),e.endValue.toString(),e.locale,e.timeZone,e.selectionMode],([e],t)=>{const{startValue:n,endValue:s,locale:r,timeZone:o,selectionMode:i}=t;if(e==="year"){const u=cn(n.year),h=u.at(0).toString(),p=u.at(-1).toString();return{start:h,end:p,formatted:`${h} - ${p}`}}if(e==="month"){const u=new Ae(r,{year:"numeric",timeZone:o,calendar:n.calendar.identifier}),h=u.format(n.toDate(o)),p=u.format(s.toDate(o)),g=i==="range"?`${h} - ${p}`:h;return{start:h,end:p,formatted:g}}const a=new Ae(r,{month:"long",year:"numeric",timeZone:o,calendar:n.calendar.identifier}),l=a.format(n.toDate(o)),c=a.format(s.toDate(o)),f=i==="range"?`${l} - ${c}`:l;return{start:l,end:c,formatted:f}});function Ov(e,t){const{state:n,context:s,prop:r,send:o,computed:i,scope:a}=e,l=s.get("startValue"),c=i("endValue"),f=s.get("value"),u=s.get("focusedValue"),h=s.get("hoveredValue"),p=h?Hs([f[0],h]):[],g=!!r("disabled"),d=!!r("readOnly"),m=!!r("invalid"),y=i("isInteractive"),C=f.length===0,E=r("min"),O=r("max"),M=r("locale"),D=r("timeZone"),w=r("startOfWeek"),S=n.matches("focused"),x=n.matches("open"),T=r("selectionMode")==="range",b=r("selectionMode")==="multiple",A=r("isDateUnavailable"),R=r("maxSelectedDates"),V=b&&R!=null&&f.length>=R,H=s.get("currentPlacement"),z=H?Nc(H):void 0,re=Fc({...r("positioning"),placement:H}),Z=cv(M),W=cc($v,r("translations"));function be(L=l){const $=r("fixedWeeks")?6:void 0;return Ym(L,M,$,w)}function Dt(L={}){const{format:$}=L;return Zm(M,$,u).map((v,I)=>{const F=I+1,Q=u.set({month:F}),U=_e(Q,E,O);return{label:v,value:F,disabled:U}})}function $e(){const L=ev(u,E,O);return Jm(L).map(v=>({label:v.toString(),value:v,disabled:!Dr(v,E?.year,O?.year)}))}function Ke(L){return Na(L,A,M,E,O)}function Rt(L){const $=l??zn(D,u.calendar);o({type:"FOCUS.SET",value:$.set({month:L})})}function Zt(L){const $=l??zn(D,u.calendar);o({type:"FOCUS.SET",value:$.set({year:L})})}function yt(L){const{value:$,disabled:v}=L,I=u.set({year:$}),Q=!cn(l.year).includes($),U=Dr($,E?.year,O?.year),G=T&&en(I,f),le=T&&f[0]&&Pn(I,f[0]),De=T&&f[1]&&Pn(I,f[1]),Ne=T&&p.length>0,ie=Ne&&en(I,p),Fe=Ne&&p[0]&&Pn(I,p[0]),He=Ne&&p[1]&&Pn(I,p[1]),ds={focused:u.year===L.value,selectable:U,outsideRange:Q,selected:!!f.find(us=>us&&us.year===$),valueText:$.toString(),inRange:G||ie,firstInRange:!!le,lastInRange:!!De,inHoveredRange:!!ie,firstInHoveredRange:!!Fe,lastInHoveredRange:!!He,value:I,get disabled(){return v||!ds.selectable}};return ds}function Pt(L){const{value:$,disabled:v}=L,I=u.set({month:$}),F=Fa(M,D,u),Q=T&&en(I,f),U=T&&f[0]&&Rn(I,f[0]),G=T&&f[1]&&Rn(I,f[1]),le=T&&p.length>0,De=le&&en(I,p),Ne=le&&p[0]&&Rn(I,p[0]),ie=le&&p[1]&&Rn(I,p[1]),Fe={focused:u.month===L.value,selectable:!_e(I,E,O),selected:!!f.find(He=>He&&He.month===$&&He.year===u.year),valueText:F.format(I.toDate(D)),inRange:Q||De,firstInRange:!!U,lastInRange:!!G,inHoveredRange:!!De,firstInHoveredRange:!!Ne,lastInHoveredRange:!!ie,outsideRange:!1,value:I,get disabled(){return v||!Fe.selectable}};return Fe}function bt(L){const{value:$,disabled:v,visibleRange:I=i("visibleRange")}=L,F=Al(M,D,u),Q=pi(i("visibleDuration")),U=r("outsideDaySelectable"),G=I.start.add(Q).subtract({days:1}),le=_e($,I.start,G),De=T&&en($,f),Ne=T&&f[0]&&Se($,f[0]),ie=T&&f[1]&&Se($,f[1]),Fe=T&&p.length>0,He=Fe&&en($,p),ds=Fe&&p[0]&&Se($,p[0]),us=Fe&&p[1]&&Se($,p[1]),Oi=f.some(Mi=>Mi!=null&&Se($,Mi)),fs={invalid:_e($,E,O),disabled:v||!U&&le||_e($,E,O)||V&&!Oi,selected:Oi,unavailable:Na($,A,M,E,O)&&!v,outsideRange:le,today:fm($,D),weekend:wm($,M),value:$,valueText:F.format($.toDate(D)),get focused(){return u!=null&&Se($,u)&&(!fs.outsideRange||U)},get selectable(){return!fs.disabled&&!fs.unavailable},inRange:De||He,firstInRange:Ne,lastInRange:ie,inHoveredRange:He,firstInHoveredRange:ds,lastInHoveredRange:us};return fs}function $n(L){const{view:$="day",id:v}=L;return[$,v].filter(Boolean).join(" ")}return{focused:S,open:x,disabled:g,invalid:m,readOnly:d,inline:!!r("inline"),numOfMonths:r("numOfMonths"),showWeekNumbers:!!r("showWeekNumbers"),selectionMode:r("selectionMode"),maxSelectedDates:R,isMaxSelected:V,view:s.get("view"),getRangePresetValue(L){return Wa(L,M,D)},getWeekNumber(L){const $=L[0];return $?Ha($,M):0},getDaysInWeek(L,$=l){return Ml(L,$,M,w)},getOffset(L){const $=l.add(L),v=c.add(L),I=Fa(M,D,u);return{visibleRange:{start:$,end:v},weeks:be($),visibleRangeText:{start:I.format($.toDate(D)),end:I.format(v.toDate(D))}}},getMonthWeeks:be,isUnavailable:Ke,weeks:be(),weekDays:zm(l,w,D,M),visibleRangeText:i("visibleRangeText"),value:f,valueAsDate:f.filter(L=>L!=null).map(L=>L.toDate(D)),valueAsString:i("valueAsString"),focusedValue:u,focusedValueAsDate:u?.toDate(D),focusedValueAsString:r("format")(u,{locale:M,timeZone:D}),visibleRange:i("visibleRange"),selectToday(){const L=ke(zn(D,u.calendar),E,O);o({type:"VALUE.SET",value:[L]})},setValue(L){const $=L.map(v=>ke(v,E,O));o({type:"VALUE.SET",value:$})},setTime(L,$=0){const v=Array.from(f);let I=v[$];I&&("hour"in I||(I=Le(I)),I=I.set({hour:L.hour??("hour"in I?I.hour:0),minute:L.minute??("minute"in I?I.minute:0),second:L.second??("second"in I?I.second:0),millisecond:L.millisecond??("millisecond"in I?I.millisecond:0)}),v[$]=ke(I,E,O),o({type:"VALUE.SET",value:v}))},clearValue(L={}){const{focus:$=!0}=L;o({type:"VALUE.CLEAR",focus:$})},setFocusedValue(L){o({type:"FOCUS.SET",value:L})},setOpen(L){r("inline")||o({type:L?"OPEN":"CLOSE",replaces:"open"})},focusMonth:Rt,focusYear:Zt,getYears:$e,getMonths:Dt,getYearsGrid(L={}){const{columns:$=1}=L,v=cn(l.year).map(I=>({label:I.toString(),value:I,disabled:!Dr(I,E?.year,O?.year)}));return Fi(v,$)},getDecade(){const L=cn(l.year);return{start:L.at(0),end:L.at(-1)}},getMonthsGrid(L={}){const{columns:$=1,format:v}=L;return Fi(Dt({format:v}),$)},format(L,$={month:"long",year:"numeric"}){return new Ae(M,{...$,calendar:L.calendar.identifier}).format(L.toDate(D))},setView(L){o({type:"VIEW.SET",view:L})},goToNext(){o({type:"GOTO.NEXT",view:s.get("view")})},goToPrev(){o({type:"GOTO.PREV",view:s.get("view")})},getRootProps(){return t.element({...J.root.attrs,dir:r("dir"),id:gv(a),"data-state":x?"open":"closed","data-disabled":P(g),"data-readonly":P(d),"data-empty":P(C)})},getLabelProps(L={}){const{index:$=0}=L;return t.label({...J.label.attrs,id:pv(a,$),dir:r("dir"),htmlFor:Ua(a,$),"data-state":x?"open":"closed","data-index":$,"data-disabled":P(g),"data-readonly":P(d),"data-invalid":P(m)})},getControlProps(){return t.element({...J.control.attrs,dir:r("dir"),id:Nl(a),"data-disabled":P(g),"data-placeholder-shown":P(C),"data-invalid":P(m)})},getRangeTextProps(){return t.element({...J.rangeText.attrs,dir:r("dir")})},getContentProps(){return t.element({...J.content.attrs,hidden:!x,dir:r("dir"),"data-state":x?"open":"closed","data-placement":H,"data-side":z,"data-inline":P(r("inline")),id:Po(a),tabIndex:-1,role:"application","aria-label":W.content})},getTableProps(L={}){const{view:$="day",columns:v=$==="day"?7:4}=L,I=$n(L);return t.element({...J.table.attrs,role:"grid","data-columns":v,"aria-label":i("visibleRangeText").formatted,id:mv(a,I),"aria-readonly":he(d),"aria-disabled":he(g),"aria-multiselectable":he(r("selectionMode")!=="single"),"data-view":$,dir:r("dir"),tabIndex:-1,onKeyDown(F){if(F.defaultPrevented||g)return;const Q={Enter(){y&&($==="day"&&Ke(u)||$==="month"&&!Pt({value:u.month}).selectable||$==="year"&&!yt({value:u.year}).selectable||o({type:"TABLE.ENTER",view:$,columns:v,focus:!0}))},Space(G){Q.Enter?.()},ArrowLeft(){o({type:"TABLE.ARROW_LEFT",view:$,columns:v,focus:!0})},ArrowRight(){o({type:"TABLE.ARROW_RIGHT",view:$,columns:v,focus:!0})},ArrowUp(){o({type:"TABLE.ARROW_UP",view:$,columns:v,focus:!0})},ArrowDown(){o({type:"TABLE.ARROW_DOWN",view:$,columns:v,focus:!0})},PageUp(G){o({type:"TABLE.PAGE_UP",larger:G.shiftKey,view:$,columns:v,focus:!0})},PageDown(G){o({type:"TABLE.PAGE_DOWN",larger:G.shiftKey,view:$,columns:v,focus:!0})},Home(){o({type:"TABLE.HOME",view:$,columns:v,focus:!0})},End(){o({type:"TABLE.END",view:$,columns:v,focus:!0})}},U=Q[uo(F,{dir:r("dir")})];U&&(U(F),F.preventDefault(),F.stopPropagation())},onPointerLeave(){o({type:"TABLE.POINTER_LEAVE"})},onPointerDown(){o({type:"TABLE.POINTER_DOWN",view:$})},onPointerUp(){o({type:"TABLE.POINTER_UP",view:$})}})},getTableHeadProps(L={}){const{view:$="day"}=L;return t.element({...J.tableHead.attrs,"aria-hidden":!0,dir:r("dir"),"data-view":$,"data-disabled":P(g)})},getTableHeaderProps(L={}){const{view:$="day"}=L;return t.element({...J.tableHeader.attrs,dir:r("dir"),"data-view":$,"data-disabled":P(g)})},getTableBodyProps(L={}){const{view:$="day"}=L;return t.element({...J.tableBody.attrs,"data-view":$,"data-disabled":P(g)})},getTableRowProps(L={}){const{view:$="day"}=L;return t.element({...J.tableRow.attrs,"aria-disabled":he(g),"data-disabled":P(g),"data-view":$})},getWeekNumberHeaderCellProps(L={}){const{view:$="day"}=L;return t.element({...J.tableCell.attrs,scope:"col","aria-label":W.weekColumnHeader,"data-view":$,"data-type":"week-number","data-disabled":P(g)})},getWeekNumberCellProps(L){const{weekIndex:$,week:v}=L,I=v[0]?Ha(v[0],M):0;return t.element({...J.tableCell.attrs,role:"rowheader","aria-label":W.weekNumberCell?.(I),"data-view":"day","data-week-index":$,"data-type":"week-number","data-disabled":P(g)})},getDayTableCellState:bt,getDayTableCellProps(L){const{value:$}=L,v=bt(L);return t.element({...J.tableCell.attrs,role:"gridcell","aria-disabled":he(!v.selectable),"aria-selected":v.selected||v.inRange,"aria-invalid":he(v.invalid),"aria-current":v.today?"date":void 0,"data-value":$.toString()})},getDayTableCellTriggerProps(L){const{value:$}=L,v=bt(L);return t.element({...J.tableCellTrigger.attrs,id:eo(a,$.toString()),role:"button",dir:r("dir"),tabIndex:g?-1:v.focused?0:-1,"aria-label":W.dayCell(v),"aria-disabled":he(!v.selectable),"aria-invalid":he(v.invalid),"data-disabled":P(!v.selectable),"data-selectable":P(v.selectable),"data-selected":P(v.selected),"data-value":$.toString(),"data-view":"day","data-today":P(v.today),"data-focus":P(v.focused),"data-unavailable":P(v.unavailable),"data-range-start":P(v.firstInRange),"data-range-end":P(v.lastInRange),"data-in-range":P(v.inRange),"data-outside-range":P(v.outsideRange),"data-weekend":P(v.weekend),"data-in-hover-range":P(v.inHoveredRange),"data-hover-range-start":P(v.firstInHoveredRange),"data-hover-range-end":P(v.lastInHoveredRange),onClick(I){I.defaultPrevented||y&&v.selectable&&o({type:"CELL.CLICK",cell:"day",value:$})},onPointerMove:T?I=>{if(I.pointerType==="touch"||!v.selectable)return;const F=!a.isActiveElement(I.currentTarget);h&&um($,h)||o({type:"CELL.POINTER_MOVE",cell:"day",value:$,focus:F,outsideRange:v.outsideRange})}:void 0})},getMonthTableCellState:Pt,getMonthTableCellProps(L){const{value:$,columns:v}=L,I=Pt(L);return t.element({...J.tableCell.attrs,dir:r("dir"),colSpan:v,role:"gridcell","aria-selected":he(I.selected||I.inRange),"data-selected":P(I.selected),"aria-disabled":he(!I.selectable),"data-value":$})},getMonthTableCellTriggerProps(L){const{value:$}=L,v=Pt(L);return t.element({...J.tableCellTrigger.attrs,id:eo(a,$.toString()),role:"button",dir:r("dir"),tabIndex:g?-1:v.focused?0:-1,"aria-label":v.valueText,"aria-disabled":he(!v.selectable),"data-disabled":P(!v.selectable),"data-selectable":P(v.selectable),"data-selected":P(v.selected),"data-value":$,"data-view":"month","data-focus":P(v.focused),"data-outside-range":P(v.outsideRange),"data-range-start":P(v.firstInRange),"data-range-end":P(v.lastInRange),"data-in-range":P(v.inRange),"data-in-hover-range":P(v.inHoveredRange),"data-hover-range-start":P(v.firstInHoveredRange),"data-hover-range-end":P(v.lastInHoveredRange),onClick(I){I.defaultPrevented||y&&v.selectable&&o({type:"CELL.CLICK",cell:"month",value:$})},onPointerMove:T?I=>{if(I.pointerType==="touch"||!v.selectable)return;const F=!a.isActiveElement(I.currentTarget);h&&v.value&&Rn(v.value,h)||o({type:"CELL.POINTER_MOVE",cell:"month",value:v.value,focus:F})}:void 0})},getYearTableCellState:yt,getYearTableCellProps(L){const{value:$,columns:v}=L,I=yt(L);return t.element({...J.tableCell.attrs,dir:r("dir"),colSpan:v,role:"gridcell","aria-selected":he(I.selected||I.inRange),"data-selected":P(I.selected),"aria-disabled":he(!I.selectable),"data-value":$})},getYearTableCellTriggerProps(L){const{value:$}=L,v=yt(L);return t.element({...J.tableCellTrigger.attrs,id:eo(a,$.toString()),role:"button",dir:r("dir"),tabIndex:g?-1:v.focused?0:-1,"aria-label":v.valueText,"aria-disabled":he(!v.selectable),"data-disabled":P(!v.selectable),"data-selectable":P(v.selectable),"data-selected":P(v.selected),"data-value":$,"data-view":"year","data-focus":P(v.focused),"data-outside-range":P(v.outsideRange),"data-range-start":P(v.firstInRange),"data-range-end":P(v.lastInRange),"data-in-range":P(v.inRange),"data-in-hover-range":P(v.inHoveredRange),"data-hover-range-start":P(v.firstInHoveredRange),"data-hover-range-end":P(v.lastInHoveredRange),onClick(I){I.defaultPrevented||y&&v.selectable&&o({type:"CELL.CLICK",cell:"year",value:$})},onPointerMove:T?I=>{if(I.pointerType==="touch"||!v.selectable||v.outsideRange)return;const F=!a.isActiveElement(I.currentTarget);h&&v.value&&Pn(v.value,h)||o({type:"CELL.POINTER_MOVE",cell:"year",value:v.value,focus:F})}:void 0})},getNextTriggerProps(L={}){const{view:$="day"}=L,v=g||!i("isNextVisibleRangeValid");return t.button({...J.nextTrigger.attrs,dir:r("dir"),id:yv(a,$),type:"button","aria-label":W.nextTrigger($),disabled:v,"data-disabled":P(v),onClick(I){I.defaultPrevented||o({type:"GOTO.NEXT",view:$})}})},getPrevTriggerProps(L={}){const{view:$="day"}=L,v=g||!i("isPrevVisibleRangeValid");return t.button({...J.prevTrigger.attrs,dir:r("dir"),id:vv(a,$),type:"button","aria-label":W.prevTrigger($),disabled:v,"data-disabled":P(v),onClick(I){I.defaultPrevented||o({type:"GOTO.PREV",view:$})}})},getClearTriggerProps(){return t.button({...J.clearTrigger.attrs,id:Vl(a),dir:r("dir"),type:"button","aria-label":W.clearTrigger,hidden:!f.length,onClick(L){L.defaultPrevented||y&&o({type:"VALUE.CLEAR"})}})},getTriggerProps(){return t.button({...J.trigger.attrs,id:Fl(a),dir:r("dir"),type:"button","data-placement":H,"data-side":z,"aria-label":W.trigger(x),"aria-controls":Po(a),"aria-expanded":x,"data-state":x?"open":"closed","data-placeholder-shown":P(C),"aria-haspopup":"grid",disabled:g,onClick(L){L.defaultPrevented||y&&o({type:"TRIGGER.CLICK"})}})},getViewProps(L={}){const{view:$="day"}=L;return t.element({...J.view.attrs,"data-view":$,hidden:s.get("view")!==$})},getViewTriggerProps(L={}){const{view:$="day"}=L,v=Wl($,r("minView"),r("maxView")),I=v!==$,F=g||!I;return t.button({...J.viewTrigger.attrs,"data-view":$,dir:r("dir"),id:bv(a,$),type:"button",disabled:F,"data-disabled":P(F),"aria-label":W.viewTrigger($,I?v:void 0),onClick(Q){Q.defaultPrevented||y&&o({type:"VIEW.TOGGLE",src:"viewTrigger"})}})},getViewControlProps(L={}){const{view:$="day"}=L;return t.element({...J.viewControl.attrs,"data-view":$,dir:r("dir")})},getInputProps(L={}){const{index:$=0,fixOnBlur:v=!0}=L;return t.input({...J.input.attrs,id:Ua(a,$),autoComplete:"off",autoCorrect:"off",spellCheck:"false",dir:r("dir"),name:r("name"),"data-index":$,"data-state":x?"open":"closed","data-placeholder-shown":P(C),readOnly:d,disabled:g,required:r("required"),"aria-invalid":he(m),"data-invalid":P(m),placeholder:r("placeholder")||Sv(M,W.placeholder(M)),defaultValue:i("valueAsString")[$],onBeforeInput(I){const{data:F}=Ko(I);Pl(F,Z,M)||I.preventDefault()},onClick(I){I.defaultPrevented||r("openOnClick")&&y&&o({type:"OPEN",src:"input.click"})},onFocus(){o({type:"INPUT.FOCUS",index:$})},onBlur(I){const F=I.currentTarget.value.trim();o({type:"INPUT.BLUR",value:F,index:$,fixOnBlur:v})},onKeyDown(I){if(I.defaultPrevented||!y)return;const Q={Enter(U){Zu(U)||Ke(u)||U.currentTarget.value.trim()!==""&&o({type:"INPUT.ENTER",value:U.currentTarget.value,index:$})}}[I.key];Q&&(Q(I),I.preventDefault())},onInput(I){const F=I.currentTarget.value;o({type:"INPUT.CHANGE",value:av(F,Z,M),index:$})}})},getMonthSelectProps(){return t.select({...J.monthSelect.attrs,id:_l(a),"aria-label":W.monthSelect,disabled:g,dir:r("dir"),defaultValue:l.month,onChange(L){Rt(Number(L.currentTarget.value))}})},getYearSelectProps(){return t.select({...J.yearSelect.attrs,id:Bl(a),disabled:g,"aria-label":W.yearSelect,dir:r("dir"),defaultValue:l.year,onChange(L){Zt(Number(L.currentTarget.value))}})},getPositionerProps(){return t.element({id:Hl(a),...J.positioner.attrs,dir:r("dir"),style:re.floating})},getPresetTriggerProps(L){const $=Array.isArray(L.value)?L.value:Wa(L.value,M,D),v=$.filter(I=>I!=null).map(I=>I.toDate(D).toDateString());return t.button({...J.presetTrigger.attrs,"aria-label":W.presetTrigger(v),type:"button",onClick(I){I.defaultPrevented||y&&o({type:"PRESET.CLICK",value:$})}})}}}var to="__live-region-debug__",Mv="position:fixed;inset-inline:0;bottom:0;z-index:2147483647;padding:12px 16px;background:black;color:white;font-size:14px;line-height:20px;text-align:center;pointer-events:none;",Dv=100,Rv=200,Pv={border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"};function Vv(e={}){const{level:t="polite",document:n=document,root:s,delay:r=0,debug:o=!1}=e,i=n.defaultView??window,a=()=>(typeof s=="function"?s():s)??n.body;let l;function c(){if(!o)return;let m=n.getElementById(to);return m||(m=n.createElement("div"),m.id=to,m.dataset.liveAnnouncerDebug="true",m.setAttribute("aria-hidden","true"),m.style.cssText=Mv,a().appendChild(m),m)}function f(){const m=n.createElement("span");return m.dataset.liveAnnouncer="true",m.setAttribute("aria-live",t),m.setAttribute("aria-atomic","true"),m.setAttribute("role",t==="assertive"?"alert":"status"),Object.assign(m.style,Pv),a().appendChild(m),u=Date.now()+Rv,m}let u=0,h=f();function p(){i.clearTimeout(l),l=void 0}function g(m,y=r){p(),h?.isConnected||(h=f());const C=h;C.textContent="",l=i.setTimeout(()=>{l=void 0,C.textContent=m;const E=c();E&&(E.textContent=m)},Math.max(y,Dv,u-Date.now()))}function d(){p(),h?.remove(),h=null,o&&n.getElementById(to)?.remove()}return{announce:g,cancel:p,destroy:d,toJSON(){return"live-region"}}}var{and:ye}=Uc();function Nv(e,t){if(e?.length!==t?.length)return!1;const n=Math.max(e.length,t.length);for(let s=0;s<n;s++)if(!xt(e[s],t[s]))return!1;return!0}function ks(e,t){return e.map(n=>n==null?"":t("format")(n,{locale:t("locale"),timeZone:t("timeZone")}))}var Fv=qc({props({props:e}){const t=e.locale||"en-US",n=e.timeZone||"UTC",s=e.selectionMode||"single",r=e.numOfMonths||1;let o;if(e.createCalendar){const g=new Intl.DateTimeFormat(t).resolvedOptions().calendar;g!=="gregory"&&g!=="iso8601"&&(o=e.createCalendar(g))}const i=p=>!o||p.calendar.identifier===o.identifier?p:de(p,o),a=e.defaultValue?Ts(e.defaultValue).map(p=>ke(i(p),e.min,e.max)):void 0,l=e.value?Ts(e.value).map(p=>ke(i(p),e.min,e.max)):void 0;let c=e.focusedValue||e.defaultFocusedValue||l?.[0]||a?.[0]||zn(n,o);c=ke(i(c),e.min,e.max);const f=e.minView||"day",u=e.maxView||"year",h=mi(e.defaultView||e.view||f,f,u);return{locale:t,numOfMonths:r,timeZone:n,selectionMode:s,minView:f,maxView:u,outsideDaySelectable:!1,closeOnSelect:!0,format(p,{locale:g,timeZone:d}){return new Ae(g,{timeZone:d,day:"2-digit",month:"2-digit",year:"numeric",calendar:o?.identifier}).format(p.toDate(d))},parse(p,{locale:g,timeZone:d}){return uv(p,g,d)},...e,focusedValue:typeof e.focusedValue>"u"?void 0:c,defaultFocusedValue:c,value:l,defaultValue:a??[],defaultView:h,positioning:{placement:"bottom",...e.positioning}}},initialState({prop:e}){return e("inline")||(e("open")??e("defaultOpen"))?"open":"idle"},refs(){return{announcer:void 0}},context({prop:e,bindable:t,getContext:n}){return{focusedValue:t(()=>({defaultValue:e("defaultFocusedValue"),value:e("focusedValue"),isEqual:xt,hash:s=>s.toString(),sync:!0,onChange(s){const r=n(),o=r.get("view"),i=r.get("value"),a=ks(i,e);e("onFocusChange")?.({value:i,valueAsString:a,view:o,focusedValue:s})}})),value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:Nv,hash:s=>s.map(r=>r?.toString()??"").join(","),onChange(s){const r=n(),o=ks(s,e);e("onValueChange")?.({value:s,valueAsString:o,view:r.get("view")})}})),inputValue:t(()=>({defaultValue:""})),activeIndex:t(()=>({defaultValue:0,sync:!0})),hoveredValue:t(()=>({defaultValue:null,isEqual: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:Va(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})=>Tl(e.get("startValue"),t("visibleDuration")),visibleRange:({context:e,computed:t})=>({start:e.get("startValue"),end:t("endValue")}),visibleRangeText:({context:e,prop:t,computed:n})=>Lv({view:e.get("view"),startValue:e.get("startValue"),endValue:n("endValue"),locale:t("locale"),timeZone:t("timeZone"),selectionMode:t("selectionMode")}),isPrevVisibleRangeValid:({context:e,prop:t})=>!Wm(e.get("startValue"),t("min"),t("max")),isNextVisibleRangeValid:({prop:e,computed:t})=>!Um(t("endValue"),e("min"),e("max")),valueAsString:({context:e,prop:t})=>ks(e.get("value"),t)},effects:["setupLiveRegion"],watch({track:e,prop:t,context:n,action:s,computed:r}){e([()=>t("locale")],()=>{s(["setStartValue","syncInputElement"])}),e([()=>n.hash("focusedValue")],()=>{s(["setStartValue","focusActiveCellIfNeeded","setHoveredValueIfKeyboard"])}),e([()=>n.hash("startValue")],()=>{s(["syncMonthSelectElement","syncYearSelectElement","invokeOnVisibleRangeChange"])}),e([()=>n.get("inputValue")],()=>{s(["syncInputValue"])}),e([()=>n.hash("value")],()=>{s(["syncInputElement"])}),e([()=>r("valueAsString").toString()],()=>{s(["announceValueText"])}),e([()=>n.get("view")],()=>{s(["focusActiveCell"])}),e([()=>t("open")],()=>{s(["toggleVisibility"])})},on:{"VALUE.SET":{actions:["setDateValue","setFocusedDate"]},"VIEW.SET":{actions:["setView"]},"FOCUS.SET":{actions:["setFocusedDate"]},"VALUE.CLEAR":{actions:["clearDateValue","clearFocusedDate","setActiveIndexToStart","clearHoveredDate","focusFirstInputElement"]},"INPUT.CHANGE":[{guard:"isInputValueEmpty",actions:["setInputValue","clearDateValue","clearFocusedDate"]},{actions:["setInputValue","focusParsedDate"]}],"INPUT.ENTER":{actions:["focusParsedDate","selectFocusedDate"]},"INPUT.FOCUS":{actions:["setActiveIndex"]},"INPUT.BLUR":[{guard:"shouldFixOnBlur",actions:["setActiveIndexToStart","selectParsedDate"]},{actions:["setActiveIndexToStart"]}],"PRESET.CLICK":[{guard:"isOpenControlled",actions:["setDateValue","setFocusedDate","invokeOnClose"]},{target:"focused",actions:["setDateValue","setFocusedDate","focusInputElement"]}],"GOTO.NEXT":[{guard:"isYearView",actions:["focusNextDecade","announceVisibleRange"]},{guard:"isMonthView",actions:["focusNextYear","announceVisibleRange"]},{actions:["focusNextPage"]}],"GOTO.PREV":[{guard:"isYearView",actions:["focusPreviousDecade","announceVisibleRange"]},{guard:"isMonthView",actions:["focusPreviousYear","announceVisibleRange"]},{actions:["focusPreviousPage"]}]},states:{idle:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell"]},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}]}},focused:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell"]},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}]}},open:{tags:["open"],entry:["resumeRangeSelection"],effects:["trackDismissableElement","trackPositioning"],exit:["clearHoveredDate"],on:{"CONTROLLED.CLOSE":[{guard:ye("shouldRestoreFocus","isInteractOutsideEvent"),target:"focused",actions:["restoreFocusToTrigger"]},{guard:"shouldRestoreFocus",target:"focused",actions:["restoreFocusToInput"]},{target:"idle"}],"CELL.CLICK":[{guard:"isAboveMinView",actions:["setFocusedValueForView","setPreviousView"]},{guard:ye("isRangePicker","hasSelectedRange"),actions:["setActiveIndexToStart","resetSelection","setActiveIndexToEnd"]},{guard:ye("isRangePicker","isSelectingEndDate","closeOnSelect","isOpenControlled"),actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","setRestoreFocus"]},{guard:ye("isRangePicker","isSelectingEndDate","closeOnSelect"),target:"focused",actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","restoreFocusToInput"]},{guard:ye("isRangePicker","isSelectingEndDate"),actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate"]},{guard:"isRangePicker",actions:["setFocusedDate","setSelectedDate","setActiveIndexToEnd"]},{guard:ye("isMultiPicker","canSelectDate"),actions:["setFocusedDate","toggleSelectedDate"]},{guard:"isMultiPicker",actions:["setFocusedDate"]},{guard:ye("closeOnSelect","isOpenControlled"),actions:["setFocusedDate","setSelectedDate","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["setFocusedDate","setSelectedDate","invokeOnClose","restoreFocusToInput"]},{actions:["setFocusedDate","setSelectedDate"]}],"CELL.POINTER_MOVE":[{guard:ye("isRangePicker","isSelectingEndDate","isDayPointerMoveOutsideVisibleMonth"),actions:["setHoveredDate"]},{guard:ye("isRangePicker","isSelectingEndDate"),actions:["setHoveredDate","setFocusedDate"]}],"TABLE.POINTER_LEAVE":{guard:"isRangePicker",actions:["clearHoveredDate"]},"TABLE.POINTER_DOWN":{actions:["disableTextSelection"]},"TABLE.POINTER_UP":{actions:["enableTextSelection"]},"TABLE.ESCAPE":[{guard:"isOpenControlled",actions:["focusFirstSelectedDate","invokeOnClose"]},{target:"focused",actions:["focusFirstSelectedDate","invokeOnClose","restoreFocusToTrigger"]}],"TABLE.ENTER":[{guard:"isAboveMinView",actions:["setPreviousView"]},{guard:ye("isRangePicker","hasSelectedRange"),actions:["setActiveIndexToStart","resetSelection","setActiveIndexToEnd","focusNextDay"]},{guard:ye("isRangePicker","isSelectingEndDate","closeOnSelect","isOpenControlled"),actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose"]},{guard:ye("isRangePicker","isSelectingEndDate","closeOnSelect"),target:"focused",actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","restoreFocusToInput"]},{guard:ye("isRangePicker","isSelectingEndDate"),actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate"]},{guard:"isRangePicker",actions:["setSelectedDate","setActiveIndexToEnd","focusNextDay"]},{guard:ye("isMultiPicker","canSelectDate"),actions:["toggleSelectedDate"]},{guard:"isMultiPicker"},{guard:ye("closeOnSelect","isOpenControlled"),actions:["selectFocusedDate","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectFocusedDate","invokeOnClose","restoreFocusToInput"]},{actions:["selectFocusedDate"]}],"TABLE.ARROW_RIGHT":[{guard:"isMonthView",actions:["focusNextMonth"]},{guard:"isYearView",actions:["focusNextYear"]},{actions:["focusNextDay","setHoveredDate"]}],"TABLE.ARROW_LEFT":[{guard:"isMonthView",actions:["focusPreviousMonth"]},{guard:"isYearView",actions:["focusPreviousYear"]},{actions:["focusPreviousDay"]}],"TABLE.ARROW_UP":[{guard:"isMonthView",actions:["focusPreviousMonthColumn"]},{guard:"isYearView",actions:["focusPreviousYearColumn"]},{actions:["focusPreviousWeek"]}],"TABLE.ARROW_DOWN":[{guard:"isMonthView",actions:["focusNextMonthColumn"]},{guard:"isYearView",actions:["focusNextYearColumn"]},{actions:["focusNextWeek"]}],"TABLE.PAGE_UP":{actions:["focusPreviousSection"]},"TABLE.PAGE_DOWN":{actions:["focusNextSection"]},"TABLE.HOME":[{guard:"isMonthView",actions:["focusFirstMonth"]},{guard:"isYearView",actions:["focusFirstYear"]},{actions:["focusSectionStart"]}],"TABLE.END":[{guard:"isMonthView",actions:["focusLastMonth"]},{guard:"isYearView",actions:["focusLastYear"]},{actions:["focusSectionEnd"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose"]}],"VIEW.TOGGLE":{actions:["setNextView"]},INTERACT_OUTSIDE:[{guard:"isOpenControlled",actions:["setActiveIndexToStart","invokeOnClose"]},{guard:"shouldRestoreFocus",target:"focused",actions:["setActiveIndexToStart","invokeOnClose","restoreFocusToTrigger"]},{target:"idle",actions:["setActiveIndexToStart","invokeOnClose"]}],CLOSE:[{guard:"isOpenControlled",actions:["setActiveIndexToStart","invokeOnClose"]},{target:"idle",actions:["setActiveIndexToStart","invokeOnClose"]}]}}},implementations:{guards:{isAboveMinView:({context:e,prop:t})=>Iv(e.get("view"),t("minView")),isDayView:({context:e,event:t})=>(t.view||e.get("view"))==="day",isMonthView:({context:e,event:t})=>(t.view||e.get("view"))==="month",isYearView:({context:e,event:t})=>(t.view||e.get("view"))==="year",isRangePicker:({prop:e})=>e("selectionMode")==="range",hasSelectedRange:({context:e})=>e.get("value").length===2,isMultiPicker:({prop:e})=>e("selectionMode")==="multiple",canSelectDate:e=>{const{context:t,prop:n,event:s}=e,r=n("maxSelectedDates");if(r==null)return!0;const o=t.get("value"),i=qn(e,s.value??t.get("focusedValue"));return o.some(l=>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=jl(n);return wo(s,()=>Ga(n),{...t("positioning"),defer:!0,onComplete(o){e.set("currentPlacement",o.placement)}})},setupLiveRegion({scope:e,refs:t}){const n=e.getDoc();return t.set("announcer",Vv({level:"assertive",document:n})),()=>t.get("announcer")?.destroy?.()},trackDismissableElement({scope:e,send:t,context:n,prop:s}){return s("inline")?void 0:Kc(()=>nn(e),{type:"popover",defer:!0,getRootNode:e.getRootNode,layerStyleTargets:[()=>Ga(e)],exclude:[...Un(e),Fs(e),xv(e)],onInteractOutside(o){n.set("restoreFocus",!o.detail.focusable)},onDismiss(){t({type:"INTERACT_OUTSIDE"})},onEscapeKeyDown(o){o.preventDefault(),t({type:"TABLE.ESCAPE",src:"dismissable",focusVisible:!0})}})}},actions:{setNextView({context:e,prop:t}){const n=Wl(e.get("view"),t("minView"),t("maxView"));e.set("view",n)},setPreviousView({context:e,prop:t}){const n=Tv(e.get("view"),t("minView"),t("maxView"));e.set("view",n)},setView({context:e,event:t}){e.set("view",t.view)},setRestoreFocus({context:e}){e.set("restoreFocus",!0)},announceValueText({context:e,prop:t,refs:n}){const s=e.get("value"),r=t("locale"),o=t("timeZone");let i;if(t("selectionMode")==="range"){const[a,l]=s;a&&l?i=Cs(a,l,r,o):a?i=Cs(a,null,r,o):l?i=Cs(l,null,r,o):i=""}else i=s.map(a=>Cs(a,null,r,o)).filter(Boolean).join(",");n.get("announcer")?.announce(i,3e3)},announceVisibleRange({computed:e,refs:t}){const{formatted:n}=e("visibleRangeText");t.get("announcer")?.announce(n)},disableTextSelection({scope:e}){Tf({target:nn(e),doc:e.getDoc()})},enableTextSelection({scope:e}){Sc({doc:e.getDoc(),target:nn(e)})},focusFirstSelectedDate(e){const{context:t}=e;t.get("value").length&&ne(e,t.get("value")[0])},syncInputElement({scope:e,computed:t}){pe(()=>{Un(e).forEach((s,r)=>{gs(s,t("valueAsString")[r]||"")})})},setFocusedDate(e){const{event:t}=e,n=Array.isArray(t.value)?t.value[0]:t.value;ne(e,n)},setFocusedValueForView(e){const{context:t,event:n}=e;ne(e,t.get("focusedValue").set({[t.get("view")]:n.value}))},focusNextMonth(e){const{context:t}=e;ne(e,t.get("focusedValue").add({months:1}))},focusPreviousMonth(e){const{context:t}=e;ne(e,t.get("focusedValue").subtract({months:1}))},setDateValue({context:e,event:t,prop:n}){if(!Array.isArray(t.value))return;const s=t.value.map(r=>ke(r,n("min"),n("max")));e.set("value",s)},clearDateValue({context:e}){e.set("value",[])},setSelectedDate(e){const{context:t,event:n}=e,s=Array.from(t.get("value")),r=t.get("activeIndex"),o=s[r],i=qn(e,n.value??t.get("focusedValue"));s[r]=As(o,i),t.set("value",Hs(s))},resetSelection(e){const{context:t,event:n}=e,s=t.get("value")[0],r=qn(e,n.value??t.get("focusedValue"));t.set("value",[As(s,r)])},toggleSelectedDate(e){const{context:t,event:n}=e,s=qn(e,n.value??t.get("focusedValue")),r=t.get("value"),o=r.findIndex(i=>xt(i,s));if(o===-1){const i=[...r,s];t.set("value",Ts(i))}else{const i=Array.from(r);i.splice(o,1),t.set("value",Ts(i))}},setHoveredDate({context:e,event:t}){e.set("hoveredValue",t.value)},clearHoveredDate({context:e}){e.set("hoveredValue",null)},selectFocusedDate({context:e,computed:t}){const n=Array.from(e.get("value")),s=e.get("activeIndex"),r=n[s],o=e.get("focusedValue").copy();n[s]=As(r,o),e.set("value",Hs(n));const i=t("valueAsString");e.set("inputValue",i[s])},focusPreviousDay(e){const{context:t}=e,n=t.get("focusedValue").subtract({days:1});ne(e,n)},focusNextDay(e){const{context:t}=e,n=t.get("focusedValue").add({days:1});ne(e,n)},focusPreviousWeek(e){const{context:t}=e,n=t.get("focusedValue").subtract({weeks:1});ne(e,n)},focusNextWeek(e){const{context:t}=e,n=t.get("focusedValue").add({weeks:1});ne(e,n)},focusNextPage(e){const{context:t,computed:n,prop:s}=e,r=Dl(t.get("focusedValue"),t.get("startValue"),n("visibleDuration"),s("locale"),s("min"),s("max"));Ls(e,r)},focusPreviousPage(e){const{context:t,computed:n,prop:s}=e,r=Rl(t.get("focusedValue"),t.get("startValue"),n("visibleDuration"),s("locale"),s("min"),s("max"));Ls(e,r)},focusSectionStart(e){const{context:t}=e;ne(e,t.get("startValue").copy())},focusSectionEnd(e){const{computed:t}=e;ne(e,t("endValue").copy())},focusNextSection(e){const{context:t,event:n,computed:s,prop:r}=e,o=sv(t.get("focusedValue"),t.get("startValue"),n.larger,s("visibleDuration"),r("locale"),r("min"),r("max"));o&&Ls(e,o)},focusPreviousSection(e){const{context:t,event:n,computed:s,prop:r}=e,o=rv(t.get("focusedValue"),t.get("startValue"),n.larger,s("visibleDuration"),r("locale"),r("min"),r("max"));o&&Ls(e,o)},focusNextYear(e){const{context:t}=e,n=t.get("focusedValue").add({years:1});ne(e,n)},focusPreviousYear(e){const{context:t}=e,n=t.get("focusedValue").subtract({years:1});ne(e,n)},focusNextDecade(e){const{context:t}=e,n=t.get("focusedValue").add({years:10});ne(e,n)},focusPreviousDecade(e){const{context:t}=e,n=t.get("focusedValue").subtract({years:10});ne(e,n)},clearFocusedDate(e){const{context:t,prop:n}=e,s=t.get("focusedValue").calendar;ne(e,zn(n("timeZone"),s))},focusPreviousMonthColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").subtract({months:n.columns});ne(e,s)},focusNextMonthColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").add({months:n.columns});ne(e,s)},focusPreviousYearColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").subtract({years:n.columns});ne(e,s)},focusNextYearColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").add({years:n.columns});ne(e,s)},focusFirstMonth(e){const{context:t}=e,n=t.get("focusedValue"),s=n.calendar.getMinimumMonthInYear?.(n)??1;ne(e,n.set({month:s}))},focusLastMonth(e){const{context:t}=e,n=t.get("focusedValue"),s=n.calendar.getMonthsInYear(n);ne(e,n.set({month:s}))},focusFirstYear(e){const{context:t}=e,n=cn(t.get("focusedValue").year),s=t.get("focusedValue").set({year:n[0]});ne(e,s)},focusLastYear(e){const{context:t}=e,n=cn(t.get("focusedValue").year),s=t.get("focusedValue").set({year:n[n.length-1]});ne(e,s)},setActiveIndex({context:e,event:t}){e.set("activeIndex",t.index)},setActiveIndexToEnd({context:e}){e.set("activeIndex",1)},setActiveIndexToStart({context:e}){e.set("activeIndex",0)},resumeRangeSelection({context:e,prop:t}){t("selectionMode")==="range"&&e.get("value").length===1&&e.set("activeIndex",1)},focusActiveCell({scope:e,context:t,event:n}){n.src!=="input.click"&&pe(()=>{const s=t.get("view");qa(e,s)?.focus({preventScroll:!0})})},focusActiveCellIfNeeded({scope:e,context:t,event:n}){n.focus&&pe(()=>{const s=t.get("view");qa(e,s)?.focus({preventScroll:!0})})},setHoveredValueIfKeyboard({context:e,event:t,prop:n}){!(t.type.startsWith("TABLE.ARROW")||["TABLE.ENTER","TABLE.HOME","TABLE.END","TABLE.PAGE_UP","TABLE.PAGE_DOWN"].includes(t.type))||n("selectionMode")!=="range"||e.get("activeIndex")===0||e.set("hoveredValue",e.get("focusedValue").copy())},restoreFocusToTrigger({scope:e,event:t}){const n=nn(e),s=Hv(t);pe(()=>{ji(e.getActiveElement(),[n])||Fs(e)?.focus(s)})},focusFirstInputElement({scope:e,event:t}){t.focus!==!1&&pe(()=>{const[n]=Un(e);(n??Fs(e))?.focus({preventScroll:!0})})},focusInputElement({scope:e}){pe(()=>Ya(e))},restoreFocusToInput({scope:e}){const t=nn(e);pe(()=>{ji(e.getActiveElement(),[t])||Ya(e)})},syncMonthSelectElement({scope:e,context:t}){const n=Ev(e);gs(n,t.get("startValue").month.toString())},syncYearSelectElement({scope:e,context:t}){const n=wv(e);gs(n,t.get("startValue").year.toString())},setInputValue({context:e,event:t}){e.get("activeIndex")===t.index&&e.set("inputValue",t.value)},syncInputValue({scope:e,context:t,event:n}){queueMicrotask(()=>{const s=Un(e),r=n.index??t.get("activeIndex");gs(s[r],t.get("inputValue"))})},focusParsedDate(e){const{event:t,prop:n}=e;if(t.index==null)return;const r=n("parse")(t.value,{locale:n("locale"),timeZone:n("timeZone")});!r||!Ka(r)||ne(e,r)},selectParsedDate({context:e,event:t,prop:n}){if(t.index==null)return;let r=n("parse")(t.value,{locale:n("locale"),timeZone:n("timeZone")});if((!r||!Ka(r))&&t.value&&(r=e.get("focusedValue").copy()),!r)return;r=ke(r,n("min"),n("max"));const o=Array.from(e.get("value"));o[t.index]=As(o[t.index],r);const i=Hs(o);e.set("value",i);const a=ks(i,n);e.set("inputValue",a[t.index])},resetView({context:e}){e.set("view",e.initial("view"))},setStartValue({context:e,computed:t,prop:n}){const s=e.get("focusedValue");if(!_e(s,e.get("startValue"),t("endValue")))return;const o=Va(s,"start",{months:n("numOfMonths")},n("locale"));e.set("startValue",o)},invokeOnOpen({prop:e,context:t}){e("inline")||e("onOpenChange")?.({open:!0,value:t.get("value")})},invokeOnClose({prop:e,context:t}){e("inline")||e("onOpenChange")?.({open:!1,value:t.get("value")})},invokeOnVisibleRangeChange({prop:e,context:t,computed:n}){e("onVisibleRangeChange")?.({view:t.get("view"),visibleRange:n("visibleRange")})},toggleVisibility({event:e,send:t,prop:n}){t({type:n("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:e})}}}}),qn=(e,t)=>{const{context:n,prop:s}=e,r=n.get("view");let o=typeof t=="number"?n.get("focusedValue").set({[r]:t}):t;return Av(i=>{Cv(i,s("minView"))&&(o=o.set({[i]:i==="day"?1:0}))}),o},As=(e,t)=>{if(!e||!("hour"in e))return t;const n="timeZone"in e;let s=t;return"hour"in t||(n?s=yl(Le(t),e.timeZone):s=Le(t)),s.set({hour:e.hour,minute:e.minute,second:e.second,millisecond:e.millisecond})};function ne(e,t){const{context:n,prop:s,computed:r}=e;if(!t)return;const o=qn(e,t);if(xt(n.get("focusedValue"),o))return;const a=is(r("visibleDuration"),s("locale"),s("min"),s("max"))({focusedDate:o,startDate:n.get("startValue")});n.set("startValue",a.startDate),n.set("focusedValue",a.focusedDate)}function Ls(e,t){const{context:n}=e;n.set("startValue",t.startDate);const s=n.get("focusedValue");xt(s,t.focusedDate)||n.set("focusedValue",t.focusedDate)}function Hv(e){return e.focusVisible??e.previousEvent?.focusVisible?{preventScroll:!0,focusVisible:!0}:{preventScroll:!0}}function Ul(e){return Array.isArray(e)?e.map(t=>Ul(t)):e instanceof Date?new Pe(e.getFullYear(),e.getMonth()+1,e.getDate()):Rm(e)}const no=e=>`<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="${e==="left"?"m10 4-4 4 4 4":"m6 4 4 4-4 4"}"/></svg>`,so=e=>{try{return/^\d{4}-\d{2}-\d{2}$/.test(e)?Ul(e):void 0}catch{return}};function _v(e,t,n){e.innerHTML=`<div class="date-control"><button class="icon-button date-trigger" type="button" aria-label="Custom date range" title="Custom date range"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><rect x="3" y="5" width="18" height="16" rx="3"/><path d="M7 3v4m10-4v4M3 11h18m-12 5h4"/></svg></button></div>
|
|
91
|
+
`);return{text:C.slice(0,1800),shortened:C.length>1800||!!y.partial}}return{clear:g,show(y,C,E,O,M,D){const w=`${C}:${E}:${y.id}`,S=r!==w;S&&g(),r=w,a=y,l=M,c=D,f=O;const x=s.get(w);d(x?.text||y.preview,x?x.shortened?"Content preview":"":"Loading message…"),!(!S||x)&&(i=setTimeout(async()=>{const T=new AbortController;o=T;try{const b=await n.read(C,{item:y.id,revision:E,filter:"messages"},T.signal);if(T.signal.aborted||r!==w||b.selected?.id!==y.id)return;const A=m(b.selected);s.set(w,A),s.size>20&&s.delete(s.keys().next().value),d(A.text,A.shortened?"Content preview":"")}catch{!T.signal.aborted&&r===w&&d(y.preview,"Saved excerpt · open for details")}},120))},dispose(){g(),s.clear()}}}class Zg{constructor(t=(...n)=>fetch(...n)){this.request=t}request;pages=new Map;pending=new Map;characters=0;generation=0;clear(){this.generation++,this.pages.clear(),this.characters=0;for(const t of this.pending.values())t.controller.abort();this.pending.clear()}read(t,n={},s){if(s?.aborted)return Promise.reject(s.reason);const r=n.filter||"all",o=JSON.stringify([t,n.revision,r,n.item,n.cursor]),i=n.revision?this.pages.get(o):void 0;if(i)return this.pages.delete(o),this.pages.set(o,i),Promise.resolve(i.page);let a=this.pending.get(o);if(!a){const c=new AbortController,f=this.generation,u=new URLSearchParams({filter:r,...n}),h=this.request(`/api/sessiongraph/session/${encodeURIComponent(t)}/events?${u}`,{signal:AbortSignal.any([c.signal,AbortSignal.timeout(3e4)])}).then(async d=>{const m=await d.json();if(!d.ok)throw d.status===409&&this.clear(),new Error(m.error||"Could not load events.");if(c.signal.aborted||f!==this.generation)throw new DOMException("Request cancelled","AbortError");if(m.sessionID!==t||n.revision&&m.revision!==n.revision)throw new Error("Saved history changed. Reload the event explorer.");const y=JSON.stringify([t,m.revision,r,n.item,n.cursor]),C=JSON.stringify(m).length;for(this.characters-=this.pages.get(y)?.characters||0,this.pages.delete(y),this.pages.set(y,{page:m,characters:C}),this.characters+=C;this.pages.size>20||this.characters>2e6;){const E=this.pages.keys().next().value;this.characters-=this.pages.get(E).characters,this.pages.delete(E)}return m});a={controller:c,promise:h,readers:0},this.pending.set(o,a);const p=a,g=()=>{this.pending.get(o)===p&&this.pending.delete(o)};h.then(g,g)}const l=a;return l.readers++,new Promise((c,f)=>{const u=()=>{p(),f(s.reason)};let h=!1;const p=()=>{h||(h=!0,s?.removeEventListener("abort",u),--l.readers===0&&this.pending.get(o)===l&&(this.pending.delete(o),l.controller.abort()))};s?.addEventListener("abort",u,{once:!0}),l.promise.then(g=>{h||(p(),c(g))},g=>{h||(p(),f(g))})})}}function ae(e,t,n,s){if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?s:n==="a"?s.call(e):s?s.value:t.get(e)}function tn(e,t,n,s,r){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var Es,Xt,Ie,Qt,xs,Gr,Ss;const La="__TAURI_TO_IPC_KEY__";function Jg(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}class cy{constructor(t){Es.add(this),Xt.set(this,void 0),Ie.set(this,0),Qt.set(this,[]),xs.set(this,void 0),tn(this,Xt,t||(()=>{})),this.id=Jg(n=>{const s=n.index;if("end"in n){s==ae(this,Ie,"f")?this.cleanupCallback():tn(this,xs,s);return}const r=n.message;if(s==ae(this,Ie,"f")){for(ae(this,Es,"m",Gr).call(this,r),tn(this,Ie,ae(this,Ie,"f")+1);ae(this,Ie,"f")in ae(this,Qt,"f");){const o=ae(this,Qt,"f")[ae(this,Ie,"f")];ae(this,Es,"m",Gr).call(this,o),delete ae(this,Qt,"f")[ae(this,Ie,"f")],tn(this,Ie,ae(this,Ie,"f")+1)}ae(this,Ie,"f")===ae(this,xs,"f")&&this.cleanupCallback()}else ae(this,Qt,"f")[s]=r})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(t){tn(this,Xt,t)}get onmessage(){return ae(this,Xt,"f")}[(Xt=new WeakMap,Ie=new WeakMap,Qt=new WeakMap,xs=new WeakMap,Es=new WeakSet,Gr=function(n){try{ae(this,Xt,"f").call(this,n)}catch(s){queueMicrotask(()=>{throw s})}},La)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[La]()}}async function il(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}class ly{get rid(){return ae(this,Ss,"f")}constructor(t){Ss.set(this,void 0),tn(this,Ss,t)}async close(){return il("plugin:resources|close",{rid:this.rid})}async[(Ss=new WeakMap,Symbol.asyncDispose)](){await this.close()}}function Xg(){return!!(globalThis||window).isTauri}async function Qg(){await il("plugin:process|restart")}class em{constructor(t,n,s=Date.now){this.backend=t,this.changed=n,this.now=s}backend;changed;now;state={phase:"hidden"};release;busy=!1;disposed=!1;downloaded=!1;installed=!1;lastCheck=-1/0;set(t){this.disposed||(this.state=t,this.changed(t))}async close(){const t=this.release;this.release=void 0,await t?.close().catch(()=>{})}async check(){if(!(this.disposed||this.busy||this.release||this.now()-this.lastCheck<5*6e4)){this.busy=!0,this.lastCheck=this.now();try{this.release=await this.backend.check()||void 0,this.release&&this.set({phase:"available",version:this.release.version})}catch{}finally{this.busy=!1,this.disposed&&await this.close()}}}async activate(){if(this.disposed||this.busy||!this.release)return;this.busy=!0;const{version:t}=this.release;let n=this.installed?"restart":this.downloaded?"install":"download";try{if(!this.downloaded){let s,r=0;this.set({phase:"downloading",version:t}),await this.release.download(o=>{o.event==="Started"&&(s=o.data.contentLength,r=0),o.event==="Progress"&&(r+=o.data.chunkLength),this.set({phase:"downloading",version:t,progress:s&&s>0?Math.min(99,Math.floor(r/s*100)):void 0})}),this.downloaded=!0,this.set({phase:"ready",version:t});return}if(this.installed||(this.set({phase:"installing",version:t}),await this.release.install(),this.installed=!0),this.disposed)return;n="restart",this.set({phase:"restarting",version:t}),await this.backend.restart()}catch(s){this.set({phase:"error",version:t,retry:n,error:String(s instanceof Error?s.message:s).slice(0,300)})}finally{this.busy=!1,this.disposed&&await this.close()}}dispose(){this.disposed=!0,this.busy||this.close()}}const tm='<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" aria-hidden="true"><path d="M8 2v9m-3-3 3 3 3-3M3 13h10"/></svg>',nm='<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" aria-hidden="true"><path d="M13 7a5 5 0 1 0-.8 4M13 2v5H8"/></svg>';function sm(e){const t=document.createElement("button");t.className="desktop-update glass",t.hidden=!0,t.type="button";const n=document.createElement("span");n.className="sr-only",n.role="status",n.setAttribute("aria-live","polite"),document.querySelector("#app").append(t,n);let s="";const r=c=>{const f=["downloading","installing","restarting"].includes(c.phase),u=c.phase==="ready"||c.phase==="error"&&c.retry!=="download",h=c.phase==="downloading"?c.progress===void 0?"Downloading":`${c.progress}%`:c.phase==="installing"?"Installing":c.phase==="restarting"?"Restarting":u?"Restart":c.phase==="error"?"Retry update":"Update",p=c.phase==="error"?`${c.retry==="restart"?"Could not restart SessionGraph.":`Could not ${c.retry==="download"?"download or verify":"install"} the update.`} ${c.error||""} Click to try again.`:c.phase==="restarting"?`Restarting SessionGraph ${c.version}`:u?`Restart to install SessionGraph ${c.version}`:`Update to SessionGraph ${c.version}`;t.hidden=c.phase==="hidden",t.disabled=f,t.dataset.phase=c.phase,t.setAttribute("aria-busy",String(f)),t.setAttribute("aria-label",p),t.title=p;const g=`${u||c.phase==="restarting"?nm:tm}<span>${h}</span>`;t.innerHTML!==g&&(t.innerHTML=g);const d=c.phase==="hidden"?"":c.phase==="downloading"?`Downloading SessionGraph ${c.version}`:p;d!==s&&(n.textContent=d,s=d)},o=new em(e,r);t.addEventListener("click",()=>{o.activate()});const i=()=>{document.visibilityState==="visible"&&navigator.onLine&&o.check()},a=window.setTimeout(i,1e4),l=window.setInterval(i,240*6e4);return document.addEventListener("visibilitychange",i),window.addEventListener("online",i),{check:()=>o.check(),dispose(){clearTimeout(a),clearInterval(l),o.dispose(),t.remove(),n.remove(),document.removeEventListener("visibilitychange",i),window.removeEventListener("online",i)}}}function rm(){return Xg()?sm({async check(){const{check:e}=await cr(async()=>{const{check:n}=await import("./index-Vq4WYmzW.js");return{check:n}},[]),t=await e({timeout:15e3});return t&&{version:t.version,download:n=>t.download(n,{timeout:10*6e4}),install:()=>t.install({restartAfterInstall:!0}),close:()=>t.close()}},async restart(){await Qg()}}):{dispose(){}}}var om=sn("date-picker").parts("clearTrigger","content","control","input","label","monthSelect","nextTrigger","positioner","presetTrigger","prevTrigger","rangeText","root","table","tableBody","tableCell","tableCellTrigger","tableHead","tableHeader","tableRow","trigger","view","viewControl","viewTrigger","yearSelect"),J=om.build();function Yr(e,t){return e-t*Math.floor(e/t)}const al=1721426;function $s(e,t,n,s){t=ci(e,t);let r=t-1,o=-2;return n<=2?o=0:Ns(t)&&(o=-1),al-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*n-362)/12+o+s)}function Ns(e){return e%4===0&&(e%100!==0||e%400===0)}function ci(e,t){return e==="BC"?1-t:t}function im(e){let t="AD";return e<=0&&(t="BC",e=1-e),[t,e]}const am={standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]};class pn{fromJulianDay(t){let n=t,s=n-al,r=Math.floor(s/146097),o=Yr(s,146097),i=Math.floor(o/36524),a=Yr(o,36524),l=Math.floor(a/1461),c=Yr(a,1461),f=Math.floor(c/365),u=r*400+i*100+l*4+f+(i!==4&&f!==4?1:0),[h,p]=im(u),g=n-$s(h,p,1,1),d=2;n<$s(h,p,3,1)?d=0:Ns(p)&&(d=1);let m=Math.floor(((g+d)*12+373)/367),y=n-$s(h,p,m,1)+1;return new Pe(h,p,m,y)}toJulianDay(t){return $s(t.era,t.year,t.month,t.day)}getDaysInMonth(t){return am[Ns(t.year)?"leapyear":"standard"][t.month-1]}getMonthsInYear(t){return 12}getDaysInYear(t){return Ns(t.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(t){return 9999}getEras(){return["BC","AD"]}isInverseEra(t){return t.era==="BC"}balanceDate(t){t.year<=0&&(t.era=t.era==="BC"?"AD":"BC",t.year=1-t.year)}constructor(){this.identifier="gregory"}}const cm={"001":1,AD:1,AE:6,AF:6,AI:1,AL:1,AM:1,AN:1,AR:1,AT:1,AU:1,AX:1,AZ:1,BA:1,BE:1,BG:1,BH:6,BM:1,BN:1,BY:1,CH:1,CL:1,CM:1,CN:1,CR:1,CY:1,CZ:1,DE:1,DJ:6,DK:1,DZ:6,EC:1,EE:1,EG:6,ES:1,FI:1,FJ:1,FO:1,FR:1,GB:1,GE:1,GF:1,GP:1,GR:1,HR:1,HU:1,IE:1,IQ:6,IR:6,IS:1,IT:1,JO:6,KG:1,KW:6,KZ:1,LB:1,LI:1,LK:1,LT:1,LU:1,LV:1,LY:6,MC:1,MD:1,ME:1,MK:1,MN:1,MQ:1,MV:5,MY:1,NL:1,NO:1,NZ:1,OM:6,PL:1,QA:6,RE:1,RO:1,RS:1,RU:1,SD:6,SE:1,SI:1,SK:1,SM:1,SY:6,TJ:1,TM:1,TR:1,UA:1,UY:1,UZ:1,VA:1,VN:1,XK:1};function Se(e,t){return t=de(t,e.calendar),e.era===t.era&&e.year===t.year&&e.month===t.month&&e.day===t.day}function lm(e,t){return t=de(t,e.calendar),e=tt(e),t=tt(t),e.era===t.era&&e.year===t.year&&e.month===t.month}function dm(e,t){return t=de(t,e.calendar),e=es(e),t=es(t),e.era===t.era&&e.year===t.year}function um(e,t){return xr(e.calendar,t.calendar)&&Se(e,t)}function Rn(e,t){return xr(e.calendar,t.calendar)&&lm(e,t)}function Pn(e,t){return xr(e.calendar,t.calendar)&&dm(e,t)}function xr(e,t){return e.isEqual?.(t)??t.isEqual?.(e)??e.identifier===t.identifier}function fm(e,t){return Se(e,Sr(t))}const hm={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6};function cl(e,t,n){let s=e.calendar.toJulianDay(e),r=n?hm[n]:vm(t),o=Math.ceil(s+1-r)%7;return o<0&&(o+=7),o}function ll(e){return nt(Date.now(),e)}function Sr(e){return jt(ll(e))}function dl(e,t){return e.calendar.toJulianDay(e)-t.calendar.toJulianDay(t)}function pm(e,t){return Oa(e)-Oa(t)}function Oa(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let Kr=null,gm=!1;function li(){return Kr==null&&(Kr=new Intl.DateTimeFormat().resolvedOptions().timeZone),Kr}function ul(){return gm}function tt(e){return e.subtract({days:e.day-1})}function Oo(e){return e.add({days:e.calendar.getDaysInMonth(e)-e.day})}function es(e){return tt(e.subtract({months:e.month-1}))}function mm(e){return Oo(e.add({months:e.calendar.getMonthsInYear(e)-e.month}))}function $t(e,t,n){let s=cl(e,t,n);return e.subtract({days:s})}function Ma(e,t,n){return $t(e,t,n).add({days:6})}const Da=new Map,zr=new Map;function fl(e){if(Intl.Locale){let n=Da.get(e);return n||(n=new Intl.Locale(e).maximize().region,n&&Da.set(e,n)),n}let t=e.split("-")[1];return t==="u"?void 0:t}function vm(e){let t=zr.get(e);if(!t){if(Intl.Locale){let s=new Intl.Locale(e);if("getWeekInfo"in s&&(t=s.getWeekInfo(),t))return zr.set(e,t),t.firstDay}let n=fl(e);if(e.includes("-fw-")){let s=e.split("-fw-")[1].split("-")[0];s==="mon"?t={firstDay:1}:s==="tue"?t={firstDay:2}:s==="wed"?t={firstDay:3}:s==="thu"?t={firstDay:4}:s==="fri"?t={firstDay:5}:s==="sat"?t={firstDay:6}:t={firstDay:0}}else e.includes("-ca-iso8601")?t={firstDay:1}:t={firstDay:n&&cm[n]||0};zr.set(e,t)}return t.firstDay}function ym(e,t,n){let s=e.calendar.getDaysInMonth(e);return Math.ceil((cl(tt(e),t,n)+s)/7)}function hl(e,t){return e&&t?e.compare(t)<=0?e:t:e||t}function pl(e,t){return e&&t?e.compare(t)>=0?e:t:e||t}const bm={AF:[4,5],AE:[5,6],BH:[5,6],DZ:[5,6],EG:[5,6],IL:[5,6],IQ:[5,6],IR:[5,5],JO:[5,6],KW:[5,6],LY:[5,6],OM:[5,6],QA:[5,6],SA:[5,6],SD:[5,6],SY:[5,6],YE:[5,6]};function wm(e,t){let n=e.calendar.toJulianDay(e),s=Math.ceil(n+1)%7;s<0&&(s+=7);let r=fl(t),[o,i]=bm[r]||[6,0];return s===o||s===i}function gn(e){e=de(e,new pn);let t=ci(e.era,e.year);return gl(t,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function gl(e,t,n,s,r,o,i){let a=new Date;return a.setUTCHours(s,r,o,i),a.setUTCFullYear(e,t-1,n),a.getTime()}function Mo(e,t){if(t==="UTC")return 0;if(e>0&&t===li()&&!ul())return new Date(e).getTimezoneOffset()*-6e4;let{year:n,month:s,day:r,hour:o,minute:i,second:a}=ml(e,t);return gl(n,s,r,o,i,a,0)-Math.floor(e/1e3)*1e3}const Ra=new Map;function ml(e,t){let n=Ra.get(t);n||(n=new Intl.DateTimeFormat("en-US",{timeZone:t,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),Ra.set(t,n));let s=n.formatToParts(new Date(e)),r={};for(let o of s)o.type!=="literal"&&(r[o.type]=o.value);return{year:r.era==="BC"||r.era==="B"?-r.year+1:+r.year,month:+r.month,day:+r.day,hour:r.hour==="24"?0:+r.hour,minute:+r.minute,second:+r.second}}const Pa=864e5;function Em(e,t,n,s){return(n===s?[n]:[n,s]).filter(o=>xm(e,t,o))}function xm(e,t,n){let s=ml(n,t);return e.year===s.year&&e.month===s.month&&e.day===s.day&&e.hour===s.hour&&e.minute===s.minute&&e.second===s.second}function et(e,t,n="compatible"){let s=Le(e);if(t==="UTC")return gn(s);if(t===li()&&n==="compatible"&&!ul()){s=de(s,new pn);let l=new Date,c=ci(s.era,s.year);return l.setFullYear(c,s.month-1,s.day),l.setHours(s.hour,s.minute,s.second,s.millisecond),l.getTime()}let r=gn(s),o=Mo(r-Pa,t),i=Mo(r+Pa,t),a=Em(s,t,r-o,r-i);if(a.length===1)return a[0];if(a.length>1)switch(n){case"compatible":case"earlier":return a[0];case"later":return a[a.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(n){case"earlier":return Math.min(r-o,r-i);case"compatible":case"later":return Math.max(r-o,r-i);case"reject":throw new RangeError("No such absolute time found")}}function vl(e,t,n="compatible"){return new Date(et(e,t,n))}function nt(e,t){let n=Mo(e,t),s=new Date(e+n),r=s.getUTCFullYear(),o=s.getUTCMonth()+1,i=s.getUTCDate(),a=s.getUTCHours(),l=s.getUTCMinutes(),c=s.getUTCSeconds(),f=s.getUTCMilliseconds();return new ts(r<1?"BC":"AD",r<1?-r+1:r,o,i,t,n,a,l,c,f)}function jt(e){return new Pe(e.calendar,e.era,e.year,e.month,e.day)}function Le(e,t){let n=0,s=0,r=0,o=0;if("timeZone"in e)({hour:n,minute:s,second:r,millisecond:o}=e);else if("hour"in e&&!t)return e;return t&&({hour:n,minute:s,second:r,millisecond:o}=t),new sr(e.calendar,e.era,e.year,e.month,e.day,n,s,r,o)}function de(e,t){if(xr(e.calendar,t))return e;let n=t.fromJulianDay(e.calendar.toJulianDay(e)),s=e.copy();return s.calendar=t,s.era=n.era,s.year=n.year,s.month=n.month,s.day=n.day,Gt(s),s}function yl(e,t,n){if(e instanceof ts)return e.timeZone===t?e:$m(e,t);let s=et(e,t,n);return nt(s,t)}function Sm(e){let t=gn(e)-e.offset;return new Date(t)}function $m(e,t){let n=gn(e)-e.offset;return de(nt(n,t),e.calendar)}const Vn=36e5;function $r(e,t){let n=e.copy(),s="hour"in n?km(n,t):0;Do(n,t.years||0),n.calendar.balanceYearMonth&&n.calendar.balanceYearMonth(n,e),n.month+=t.months||0,Ro(n),bl(n),n.day+=(t.weeks||0)*7,n.day+=t.days||0,n.day+=s,Im(n),n.calendar.balanceDate&&n.calendar.balanceDate(n),n.year<1&&(n.year=1,n.month=1,n.day=1);let r=n.calendar.getYearsInEra(n);if(n.year>r){let i=n.calendar.isInverseEra?.(n);n.year=r,n.month=i?1:n.calendar.getMonthsInYear(n),n.day=i?1:n.calendar.getDaysInMonth(n)}n.month<1&&(n.month=1,n.day=1);let o=n.calendar.getMonthsInYear(n);return n.month>o&&(n.month=o,n.day=n.calendar.getDaysInMonth(n)),n.day=Math.max(1,Math.min(n.calendar.getDaysInMonth(n),n.day)),n}function Do(e,t){e.calendar.isInverseEra?.(e)&&(t=-t),e.year+=t}function Ro(e){for(;e.month<1;)Do(e,-1),e.month+=e.calendar.getMonthsInYear(e);let t=0;for(;e.month>(t=e.calendar.getMonthsInYear(e));)e.month-=t,Do(e,1)}function Im(e){for(;e.day<1;)e.month--,Ro(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,Ro(e)}function bl(e){e.month=Math.max(1,Math.min(e.calendar.getMonthsInYear(e),e.month)),e.day=Math.max(1,Math.min(e.calendar.getDaysInMonth(e),e.day))}function Gt(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),bl(e)}function wl(e){let t={};for(let n in e)typeof e[n]=="number"&&(t[n]=-e[n]);return t}function El(e,t){return $r(e,wl(t))}function di(e,t){let n=e.copy();return t.era!=null&&(n.era=t.era),t.year!=null&&(n.year=t.year),t.month!=null&&(n.month=t.month),t.day!=null&&(n.day=t.day),Gt(n),n}function nr(e,t){let n=e.copy();return t.hour!=null&&(n.hour=t.hour),t.minute!=null&&(n.minute=t.minute),t.second!=null&&(n.second=t.second),t.millisecond!=null&&(n.millisecond=t.millisecond),Tm(n),n}function Cm(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=Is(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=Is(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=Is(e.minute,60);let t=Math.floor(e.hour/24);return e.hour=Is(e.hour,24),t}function Tm(e){e.millisecond=Math.max(0,Math.min(e.millisecond,999)),e.second=Math.max(0,Math.min(e.second,59)),e.minute=Math.max(0,Math.min(e.minute,59)),e.hour=Math.max(0,Math.min(e.hour,23))}function Is(e,t){let n=e%t;return n<0&&(n+=t),n}function km(e,t){return e.hour+=t.hours||0,e.minute+=t.minutes||0,e.second+=t.seconds||0,e.millisecond+=t.milliseconds||0,Cm(e)}function ui(e,t,n,s){let r=e.copy();switch(t){case"era":{let o=e.calendar.getEras(),i=o.indexOf(e.era);if(i<0)throw new Error("Invalid era: "+e.era);i=st(i,n,0,o.length-1,s?.round),r.era=o[i],Gt(r);break}case"year":r.calendar.isInverseEra?.(r)&&(n=-n),r.year=st(e.year,n,-1/0,9999,s?.round),r.year===-1/0&&(r.year=1),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e);break;case"month":r.month=st(e.month,n,1,e.calendar.getMonthsInYear(e),s?.round);break;case"day":r.day=st(e.day,n,1,e.calendar.getDaysInMonth(e),s?.round);break;default:throw new Error("Unsupported field "+t)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),Gt(r),r}function xl(e,t,n,s){let r=e.copy();switch(t){case"hour":{let o=e.hour,i=0,a=23;if(s?.hourCycle===12){let l=o>=12;i=l?12:0,a=l?23:11}r.hour=st(o,n,i,a,s?.round);break}case"minute":r.minute=st(e.minute,n,0,59,s?.round);break;case"second":r.second=st(e.second,n,0,59,s?.round);break;case"millisecond":r.millisecond=st(e.millisecond,n,0,999,s?.round);break;default:throw new Error("Unsupported field "+t)}return r}function st(e,t,n,s,r=!1){if(r){e+=Math.sign(t),e<n&&(e=s);let o=Math.abs(t);t>0?e=Math.ceil(e/o)*o:e=Math.floor(e/o)*o,e>s&&(e=n)}else e+=t,e<n?e=s-(n-e-1):e>s&&(e=n+(e-s-1));return e}function Sl(e,t){let n;if(t.years!=null&&t.years!==0||t.months!=null&&t.months!==0||t.weeks!=null&&t.weeks!==0||t.days!=null&&t.days!==0){let r=$r(Le(e),{years:t.years,months:t.months,weeks:t.weeks,days:t.days});n=et(r,e.timeZone)}else n=gn(e)-e.offset;n+=t.milliseconds||0,n+=(t.seconds||0)*1e3,n+=(t.minutes||0)*6e4,n+=(t.hours||0)*36e5;let s=nt(n,e.timeZone);return de(s,e.calendar)}function Am(e,t){return Sl(e,wl(t))}function Lm(e,t,n,s){switch(t){case"hour":{let r=0,o=23;if(s?.hourCycle===12){let g=e.hour>=12;r=g?12:0,o=g?23:11}let i=Le(e),a=de(nr(i,{hour:r}),new pn),l=[et(a,e.timeZone,"earlier"),et(a,e.timeZone,"later")].filter(g=>nt(g,e.timeZone).day===a.day)[0],c=de(nr(i,{hour:o}),new pn),f=[et(c,e.timeZone,"earlier"),et(c,e.timeZone,"later")].filter(g=>nt(g,e.timeZone).day===c.day).pop(),u=gn(e)-e.offset,h=Math.floor(u/Vn),p=u%Vn;return u=st(h,n,Math.floor(l/Vn),Math.floor(f/Vn),s?.round)*Vn+p,de(nt(u,e.timeZone),e.calendar)}case"minute":case"second":case"millisecond":return xl(e,t,n,s);case"era":case"year":case"month":case"day":{let r=ui(Le(e),t,n,s),o=et(r,e.timeZone);return de(nt(o,e.timeZone),e.calendar)}default:throw new Error("Unsupported field "+t)}}function Om(e,t,n){let s=Le(e),r=nr(di(s,t),t);if(r.compare(s)===0)return e;let o=et(r,e.timeZone,n);return de(nt(o,e.timeZone),e.calendar)}const Mm=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,Dm=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function Rm(e){let t=e.match(Mm);if(!t)throw Dm.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let n=new Pe(Zr(t[1],0,9999),Zr(t[2],1,12),1);return n.day=Zr(t[3],1,n.calendar.getDaysInMonth(n)),n}function Zr(e,t,n){let s=Number(e);if(s<t||s>n)throw new RangeError(`Value out of range: ${t} <= ${s} <= ${n}`);return s}function Pm(e){return`${String(e.hour).padStart(2,"0")}:${String(e.minute).padStart(2,"0")}:${String(e.second).padStart(2,"0")}${e.millisecond?String(e.millisecond/1e3).slice(1):""}`}function $l(e){let t=de(e,new pn),n;return t.era==="BC"?n=t.year===1?"0000":"-"+String(Math.abs(1-t.year)).padStart(6,"00"):n=String(t.year).padStart(4,"0"),`${n}-${String(t.month).padStart(2,"0")}-${String(t.day).padStart(2,"0")}`}function Il(e){return`${$l(e)}T${Pm(e)}`}function Vm(e){let t=Math.sign(e)<0?"-":"+";e=Math.abs(e);let n=Math.floor(e/36e5),s=Math.floor(e%36e5/6e4),r=Math.floor(e%36e5%6e4/1e3),o=`${t}${String(n).padStart(2,"0")}:${String(s).padStart(2,"0")}`;return r!==0&&(o+=`:${String(r).padStart(2,"0")}`),o}function Nm(e){return`${Il(e)}${Vm(e.offset)}[${e.timeZone}]`}function fi(e){let t=typeof e[0]=="object"?e.shift():new pn,n;if(typeof e[0]=="string")n=e.shift();else{let i=t.getEras();n=i[i.length-1]}let s=e.shift(),r=e.shift(),o=e.shift();return[t,n,s,r,o]}class Pe{#e;constructor(...t){let[n,s,r,o,i]=fi(t);this.calendar=n,this.era=s,this.year=r,this.month=o,this.day=i,Gt(this)}copy(){return this.era?new Pe(this.calendar,this.era,this.year,this.month,this.day):new Pe(this.calendar,this.year,this.month,this.day)}add(t){return $r(this,t)}subtract(t){return El(this,t)}set(t){return di(this,t)}cycle(t,n,s){return ui(this,t,n,s)}toDate(t){return vl(this,t)}toString(){return $l(this)}compare(t){return dl(this,t)}}class sr{#e;constructor(...t){let[n,s,r,o,i]=fi(t);this.calendar=n,this.era=s,this.year=r,this.month=o,this.day=i,this.hour=t.shift()||0,this.minute=t.shift()||0,this.second=t.shift()||0,this.millisecond=t.shift()||0,Gt(this)}copy(){return this.era?new sr(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new sr(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(t){return $r(this,t)}subtract(t){return El(this,t)}set(t){return di(nr(this,t),t)}cycle(t,n,s){switch(t){case"era":case"year":case"month":case"day":return ui(this,t,n,s);default:return xl(this,t,n,s)}}toDate(t,n){return vl(this,t,n)}toString(){return Il(this)}compare(t){let n=dl(this,t);return n===0?pm(this,Le(t)):n}}class ts{#e;constructor(...t){let[n,s,r,o,i]=fi(t),a=t.shift(),l=t.shift();this.calendar=n,this.era=s,this.year=r,this.month=o,this.day=i,this.timeZone=a,this.offset=l,this.hour=t.shift()||0,this.minute=t.shift()||0,this.second=t.shift()||0,this.millisecond=t.shift()||0,Gt(this)}copy(){return this.era?new ts(this.calendar,this.era,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond):new ts(this.calendar,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond)}add(t){return Sl(this,t)}subtract(t){return Am(this,t)}set(t,n){return Om(this,t,n)}cycle(t,n,s){return Lm(this,t,n,s)}toDate(){return Sm(this)}toString(){return Nm(this)}toAbsoluteString(){return this.toDate().toISOString()}compare(t){return this.toDate().getTime()-yl(t,this.timeZone).toDate().getTime()}}let Jr=new Map;class Ae{constructor(t,n={}){this.formatter=Cl(t,n),this.options=n}format(t){return this.formatter.format(t)}formatToParts(t){return this.formatter.formatToParts(t)}formatRange(t,n){if(typeof this.formatter.formatRange=="function")return this.formatter.formatRange(t,n);if(n<t)throw new RangeError("End date must be >= start date");return`${this.formatter.format(t)} – ${this.formatter.format(n)}`}formatRangeToParts(t,n){if(typeof this.formatter.formatRangeToParts=="function")return this.formatter.formatRangeToParts(t,n);if(n<t)throw new RangeError("End date must be >= start date");let s=this.formatter.formatToParts(t),r=this.formatter.formatToParts(n);return[...s.map(o=>({...o,source:"startRange"})),{type:"literal",value:" – ",source:"shared"},...r.map(o=>({...o,source:"endRange"}))]}resolvedOptions(){let t=this.formatter.resolvedOptions();return _m()&&(this.resolvedHourCycle||(this.resolvedHourCycle=Bm(t.locale,this.options)),t.hourCycle=this.resolvedHourCycle,t.hour12=this.resolvedHourCycle==="h11"||this.resolvedHourCycle==="h12"),t.calendar==="ethiopic-amete-alem"&&(t.calendar="ethioaa"),t}}const Fm={true:{ja:"h11"},false:{}};function Cl(e,t={}){if(typeof t.hour12=="boolean"&&Hm()){t={...t};let r=Fm[String(t.hour12)][e.split("-")[0]],o=t.hour12?"h12":"h23";t.hourCycle=r??o,delete t.hour12}let n=e+(t?Object.entries(t).sort((r,o)=>r[0]<o[0]?-1:1).join():"");if(Jr.has(n))return Jr.get(n);let s=new Intl.DateTimeFormat(e,t);return Jr.set(n,s),s}let Xr=null;function Hm(){return Xr==null&&(Xr=new Intl.DateTimeFormat("en-US",{hour:"numeric",hour12:!1}).format(new Date(2020,2,3,0))==="24"),Xr}let Qr=null;function _m(){return Qr==null&&(Qr=new Intl.DateTimeFormat("fr",{hour:"numeric",hour12:!1}).resolvedOptions().hourCycle==="h12"),Qr}function Bm(e,t){if(!t.timeStyle&&!t.hour)return;e=e.replace(/(-u-)?-nu-[a-zA-Z0-9]+/,""),e+=(e.includes("-u-")?"":"-u")+"-nu-latn";let n=Cl(e,{...t,timeZone:void 0}),s=parseInt(n.formatToParts(new Date(2020,2,3,0)).find(o=>o.type==="hour").value,10),r=parseInt(n.formatToParts(new Date(2020,2,3,23)).find(o=>o.type==="hour").value,10);if(s===0&&r===23)return"h23";if(s===24&&r===23)return"h24";if(s===0&&r===11)return"h11";if(s===12&&r===11)return"h12";throw new Error("Unexpected hour cycle result")}function jm(e,t,n,s,r){const o={};for(let a in t){const l=a,c=t[l];c!=null&&(o[l]=Math.floor(c/2),o[l]>0&&c%2===0&&o[l]--)}const i=zt(e,t,n).subtract(o);return os(e,i,t,n,s,r)}function zt(e,t,n,s,r){let o=e;return t.years?o=es(e):t.months?o=tt(e):t.weeks&&(o=$t(e,n)),os(e,o,t,n,s,r)}function hi(e,t,n,s,r){let o={...t};o.days?o.days--:o.weeks?o.weeks--:o.months?o.months--:o.years&&o.years--;let i=zt(e,t,n).subtract(o);return os(e,i,t,n,s,r)}function os(e,t,n,s,r,o){return r&&e.compare(r)>=0&&(t=pl(t,zt(jt(r),n,s))),o&&e.compare(o)<=0&&(t=hl(t,hi(jt(o),n,s))),t}function ke(e,t,n){const s=jt(e),r=t?jt(t):void 0,o=n?jt(n):void 0;let i=s;return r&&(i=pl(i,r)),o&&(i=hl(i,o)),i.compare(s)===0?e:"hour"in e?e.set({year:i.year,month:i.month,day:i.day}):i}function Va(e,t,n,s,r,o){switch(t){case"start":return zt(e,n,s,r,o);case"end":return hi(e,n,s,r,o);default:return jm(e,n,s,r,o)}}function 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 Na(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 Wm(e,t,n){const s=e.subtract({days:1});return Se(s,e)||_e(s,t,n)}function Um(e,t,n){const s=e.add({days:1});return Se(s,e)||_e(s,t,n)}function pi(e){let t={...e};for(let n in t)t[n]=1;return t}function Tl(e,t){let n={...t};return n.days?n.days--:n.days=-1,e.add(n)}function kl(e){if(!e)return;const t=e.calendar.identifier;return t==="gregory"||t==="iso8601"?e.era==="BC"?"short":void 0:"short"}function Al(e,t,n){const s=n??Le(Sr(t));return new Ae(e,{weekday:"long",month:"long",year:"numeric",day:"numeric",era:kl(s),calendar:s.calendar.identifier,timeZone:t})}function Fa(e,t,n){const s=n??Sr(t);return new Ae(e,{month:"long",year:"numeric",era:kl(s),calendar:s.calendar.identifier,timeZone:t})}function qm(e,t,n,s,r){let o=n.formatRangeToParts(e.toDate(r),t.toDate(r)),i=-1;for(let c=0;c<o.length;c++){let f=o[c];if(f.source==="shared"&&f.type==="literal")i=c;else if(f.source==="endRange")break}let a="",l="";for(let c=0;c<o.length;c++)c<i?a+=o[c].value:c>i&&(l+=o[c].value);return s(a,l)}function Cs(e,t,n,s){if(!e)return"";let r=e,o=t??e,i=Al(n,s);return Se(r,o)?i.format(r.toDate(s)):qm(r,o,i,(a,l)=>`${a} – ${l}`,s)}var Gm=["sun","mon","tue","wed","thu","fri","sat"];function Ll(e){return e!=null?Gm[e]:void 0}function Ol(e,t,n){const s=Ll(n);return $t(e,t,s)}function Ml(e,t,n,s){const r=t.add({weeks:e}),o=[];let i=Ol(r,n,s);for(;o.length<7;){o.push(i);let a=i.add({days:1});if(Se(i,a))break;i=a}return o}function Ym(e,t,n,s){const r=Ll(s),o=n??ym(e,t,r);return[...new Array(o).keys()].map(a=>Ml(a,e,t,s))}function Km(e,t){const n=new Ae(e,{weekday:"long",timeZone:t}),s=new Ae(e,{weekday:"short",timeZone:t}),r=new Ae(e,{weekday:"narrow",timeZone:t});return o=>{const i=o instanceof Date?o:o.toDate(t);return{value:o,short:s.format(i),long:n.format(i),narrow:r.format(i)}}}function zm(e,t,n,s){const r=Ol(e,s,t),o=[...new Array(7).keys()],i=Km(s,n);return o.map(a=>i(r.add({days:a})))}function Zm(e,t="long",n){if(!n||n.calendar.identifier==="gregory"||n.calendar.identifier==="iso8601"){const i=new Date(2021,0,1),a=[];for(let l=0;l<12;l++)a.push(i.toLocaleString(e,{month:t})),i.setMonth(i.getMonth()+1);return a}const s=n.calendar.getMonthsInYear(n),r=new Ae(e,{month:t,calendar:n.calendar.identifier}),o=[];for(let i=1;i<=s;i++){const a=n.set({month:i});o.push(r.format(a.toDate("UTC")))}return o}function Ha(e,t){const n=$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"),f=c.calendar.toJulianDay(c);return 1+Math.floor((i-f)/7)}function Jm(e){const t=[];for(let n=e.from;n<=e.to;n+=1)t.push(n);return t}var Xm=1900,Qm=2099;function ev(e,t,n){const s=e.calendar,r=t?.year??de(new Pe(Xm,1,1),s).year,o=n?.year??de(new Pe(Qm,12,31),s).year;return{from:r,to:o}}var tv=10;function nv(e){if(e){if(e.length===3)return e.padEnd(4,"0");if(e.length===2){const t=new Date().getFullYear(),n=Math.floor(t/100)*100,s=parseInt(e.slice(-2),10),r=n+s;return r>t+tv?(r-100).toString():r.toString()}return e}}function cn(e){const t=e-e%10,n=[];for(let s=0;s<10;s+=1){const r=t+s;n.push(r)}return n}function zn(e,t){const n=Sr(e??li());return t?de(n,t):n}function is(e,t,n,s){return function(o){const{startDate:i,focusedDate:a}=o,l=Tl(i,e);return _e(a,n,s)?{startDate:i,focusedDate:ke(a,n,s),endDate:l}:a.compare(i)<0?{startDate:hi(a,e,t,n,s),focusedDate:ke(a,n,s),endDate:l}:a.compare(l)>0?{startDate:zt(a,e,t,n,s),endDate:l,focusedDate:ke(a,n,s)}:{startDate:i,endDate:l,focusedDate:ke(a,n,s)}}}function Dl(e,t,n,s,r,o){const i=is(n,s,r,o),a=t.add(n);return i({focusedDate:e.add(n),startDate:zt(os(e,a,n,s,r,o),n,s)})}function Rl(e,t,n,s,r,o){const i=is(n,s,r,o);let a=t.subtract(n);return i({focusedDate:e.subtract(n),startDate:zt(os(e,a,n,s,r,o),n,s)})}function sv(e,t,n,s,r,o,i){const a=is(s,r,o,i);if(!n&&!s.days)return a({focusedDate:e.add(pi(s)),startDate:t});if(s.days)return Dl(e,t,s,r,o,i);if(s.weeks)return a({focusedDate:e.add({months:1}),startDate:t});if(s.months||s.years)return a({focusedDate:e.add({years:1}),startDate:t})}function rv(e,t,n,s,r,o,i){const a=is(s,r,o,i);if(!n&&!s.days)return a({focusedDate:e.subtract(pi(s)),startDate:t});if(s.days)return Rl(e,t,s,r,o,i);if(s.weeks)return a({focusedDate:e.subtract({months:1}),startDate:t});if(s.months||s.years)return a({focusedDate:e.subtract({years:1}),startDate:t})}var _a=new Map;function ov(e){let t=_a.get(e);return t!=null||(t="0123456789"+new Intl.NumberFormat(e,{useGrouping:!1}).format(1234567890),_a.set(e,t)),t}var iv=(e,t)=>t?ov(t).includes(e):/\d/.test(e),Pl=(e,t,n)=>!e||e.length!==1?!0:iv(e,n)||t.includes(e),av=(e,t,n)=>e.split("").filter(s=>Pl(s,t,n)).join(""),Ba=new Map;function cv(e){let t=Ba.get(e);if(t!=null)return t;const s=new Intl.DateTimeFormat(e).formatToParts(new Date).find(r=>r.type==="literal");return t=s?s.value:"/",Ba.set(e,t),t}var ja=e=>e!=null&&e.length===4,lv=e=>e!=null&&parseFloat(e)<=12,dv=e=>e!=null&&parseFloat(e)<=31;function uv(e,t,n){const s=fv(t,n);let{year:r,month:o,day:i}=hv(s,e)??{};if(r!=null||o!=null||i!=null){const c=new Date;r||(r=c.getFullYear().toString()),o||(o=(c.getMonth()+1).toString()),i||(i=c.getDate().toString())}if(ja(r)||(r=nv(r)),ja(r)&&lv(o)&&dv(i))return new 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 fv(e,t){return new Ae(e,{day:"numeric",month:"numeric",year:"numeric",timeZone:t}).formatToParts(new Date(2e3,11,25)).map(({type:r,value:o})=>r==="literal"?`${o}?`:`((?!=<${r}>)\\d+)?`).join("")}function hv(e,t){const n=t.match(e);return e.toString().match(/<(.+?)>/g)?.map(s=>{const r=s.match(/<(.+)>/);return!r||r.length<=0?null:s.match(/<(.+)>/)?.[1]}).reduce((s,r,o)=>(r&&(n&&n.length>o?s[r]=n[o+1]:s[r]=null),s),{})}function Wa(e,t,n){const s=jt(ll(n));switch(e){case"thisWeek":return[$t(s,t),Ma(s,t)];case"thisMonth":return[tt(s),s];case"thisQuarter":return[tt(s).add({months:-((s.month-1)%3)}),s];case"thisYear":return[es(s),s];case"last3Days":return[s.add({days:-2}),s];case"last7Days":return[s.add({days:-6}),s];case"last14Days":return[s.add({days:-13}),s];case"last30Days":return[s.add({days:-29}),s];case"last90Days":return[s.add({days:-89}),s];case"lastMonth":return[tt(s.add({months:-1})),Oo(s.add({months:-1}))];case"lastQuarter":return[tt(s.add({months:-((s.month-1)%3)-3})),Oo(s.add({months:-((s.month-1)%3)-1}))];case"lastWeek":return[$t(s,t).add({weeks:-1}),Ma(s,t).add({weeks:-1})];case"lastYear":return[es(s.add({years:-1})),mm(s.add({years:-1}))];default:throw new Error(`Invalid date range preset: ${e}`)}}var pv=(e,t)=>e.ids?.label?.(t)??`datepicker:${e.id}:label:${t}`,gv=e=>e.ids?.root??`datepicker:${e.id}`,mv=(e,t)=>e.ids?.table?.(t)??`datepicker:${e.id}:table:${t}`,Po=e=>e.ids?.content??`datepicker:${e.id}:content`,eo=(e,t)=>e.ids?.cellTrigger?.(t)??`datepicker:${e.id}:cell-trigger:${t}`,vv=(e,t)=>e.ids?.prevTrigger?.(t)??`datepicker:${e.id}:prev:${t}`,yv=(e,t)=>e.ids?.nextTrigger?.(t)??`datepicker:${e.id}:next:${t}`,bv=(e,t)=>e.ids?.viewTrigger?.(t)??`datepicker:${e.id}:view:${t}`,Vl=e=>e.ids?.clearTrigger??`datepicker:${e.id}:clear`,Nl=e=>e.ids?.control??`datepicker:${e.id}:control`,Ua=(e,t)=>e.ids?.input?.(t)??`datepicker:${e.id}:input:${t}`,Fl=e=>e.ids?.trigger??`datepicker:${e.id}:trigger`,Hl=e=>e.ids?.positioner??`datepicker:${e.id}:positioner`,_l=e=>e.ids?.monthSelect??`datepicker:${e.id}:month-select`,Bl=e=>e.ids?.yearSelect??`datepicker:${e.id}:year-select`,qa=(e,t)=>Af(nn(e),`[data-part=table-cell-trigger][data-view=${t}][data-focus]:not([data-outside-range])`),Fs=e=>e.getById(Fl(e)),nn=e=>e.getById(Po(e)),Un=e=>kf(jl(e),"[data-part=input]"),wv=e=>e.getById(Bl(e)),Ev=e=>e.getById(_l(e)),xv=e=>e.getById(Vl(e)),Ga=e=>e.getById(Hl(e)),jl=e=>e.getById(Nl(e)),Ya=e=>{const t=Un(e);if(t.length===0){Fs(e)?.focus({preventScroll:!0});return}const n=t.findLastIndex(o=>o.value!==""),s=Math.max(n,0),r=t[s];r?.focus({preventScroll:!0}),r?.setSelectionRange(r.value.length,r.value.length)};function Hs(e){const[t,n]=e;let s;return!t||!n?s=e:s=t.compare(n)<=0?e:[n,t],s}function en(e,t){const[n,s]=t;return!n||!s?!1:n.compare(e)<=0&&s.compare(e)>=0}function Ts(e){return e.slice().filter(t=>t!=null).sort((t,n)=>t.compare(n))}function Sv(e,t){return new Ae(e).formatToParts(new Date).map(n=>t[n.type]??n.value).join("")}var Ka=e=>!Number.isNaN(e.day)&&!Number.isNaN(e.month)&&!Number.isNaN(e.year),$v={dayCell(e){return e.unavailable?`Not available. ${e.valueText}`:e.firstInRange?`Starting range from ${e.valueText}`:e.lastInRange?`Range ending at ${e.valueText}`:e.inRange?`In range. ${e.valueText}`:e.selected?`Selected date. ${e.valueText}`:`Choose ${e.valueText}`},trigger(e){return e?"Close calendar":"Open calendar"},viewTrigger(e,t){return t?`Switch to ${t} view`:`${e} view`},presetTrigger(e){const[t="",n=""]=e;return`select ${t} to ${n}`},prevTrigger(e){return co(e,{year:"Switch to previous decade",month:"Switch to previous year",day:"Switch to previous month"})},nextTrigger(e){return co(e,{year:"Switch to next decade",month:"Switch to next year",day:"Switch to next month"})},placeholder(){return{day:"dd",month:"mm",year:"yyyy"}},content:"calendar",monthSelect:"Select month",yearSelect:"Select year",clearTrigger:"Clear selected dates",weekColumnHeader:"Wk",weekNumberCell(e){return`Week ${e}`}};function it(e,t){return e?e==="day"?0:e==="month"?1:2:t||0}function gi(e){return e===0?"day":e===1?"month":"year"}function mi(e,t,n){return gi(yu(it(e,0),it(t,0),it(n,2)))}function Iv(e,t){return it(e,0)>it(t,0)}function Cv(e,t){return it(e,0)<it(t,0)}function Wl(e,t,n){const s=it(e,0)+1;return mi(gi(s),t,n)}function Tv(e,t,n){const s=it(e,0)-1;return mi(gi(s),t,n)}var kv=["day","month","year"];function Av(e){kv.forEach(t=>e(t))}var Lv=Tp(e=>[e.view,e.startValue.toString(),e.endValue.toString(),e.locale,e.timeZone,e.selectionMode],([e],t)=>{const{startValue:n,endValue:s,locale:r,timeZone:o,selectionMode:i}=t;if(e==="year"){const u=cn(n.year),h=u.at(0).toString(),p=u.at(-1).toString();return{start:h,end:p,formatted:`${h} - ${p}`}}if(e==="month"){const u=new Ae(r,{year:"numeric",timeZone:o,calendar:n.calendar.identifier}),h=u.format(n.toDate(o)),p=u.format(s.toDate(o)),g=i==="range"?`${h} - ${p}`:h;return{start:h,end:p,formatted:g}}const a=new Ae(r,{month:"long",year:"numeric",timeZone:o,calendar:n.calendar.identifier}),l=a.format(n.toDate(o)),c=a.format(s.toDate(o)),f=i==="range"?`${l} - ${c}`:l;return{start:l,end:c,formatted:f}});function Ov(e,t){const{state:n,context:s,prop:r,send:o,computed:i,scope:a}=e,l=s.get("startValue"),c=i("endValue"),f=s.get("value"),u=s.get("focusedValue"),h=s.get("hoveredValue"),p=h?Hs([f[0],h]):[],g=!!r("disabled"),d=!!r("readOnly"),m=!!r("invalid"),y=i("isInteractive"),C=f.length===0,E=r("min"),O=r("max"),M=r("locale"),D=r("timeZone"),w=r("startOfWeek"),S=n.matches("focused"),x=n.matches("open"),T=r("selectionMode")==="range",b=r("selectionMode")==="multiple",A=r("isDateUnavailable"),R=r("maxSelectedDates"),V=b&&R!=null&&f.length>=R,H=s.get("currentPlacement"),z=H?Nc(H):void 0,re=Fc({...r("positioning"),placement:H}),Z=cv(M),W=cc($v,r("translations"));function be(L=l){const $=r("fixedWeeks")?6:void 0;return Ym(L,M,$,w)}function Dt(L={}){const{format:$}=L;return Zm(M,$,u).map((v,I)=>{const F=I+1,Q=u.set({month:F}),U=_e(Q,E,O);return{label:v,value:F,disabled:U}})}function $e(){const L=ev(u,E,O);return Jm(L).map(v=>({label:v.toString(),value:v,disabled:!Dr(v,E?.year,O?.year)}))}function Ke(L){return Na(L,A,M,E,O)}function Rt(L){const $=l??zn(D,u.calendar);o({type:"FOCUS.SET",value:$.set({month:L})})}function Zt(L){const $=l??zn(D,u.calendar);o({type:"FOCUS.SET",value:$.set({year:L})})}function yt(L){const{value:$,disabled:v}=L,I=u.set({year:$}),Q=!cn(l.year).includes($),U=Dr($,E?.year,O?.year),G=T&&en(I,f),le=T&&f[0]&&Pn(I,f[0]),De=T&&f[1]&&Pn(I,f[1]),Ne=T&&p.length>0,ie=Ne&&en(I,p),Fe=Ne&&p[0]&&Pn(I,p[0]),He=Ne&&p[1]&&Pn(I,p[1]),ds={focused:u.year===L.value,selectable:U,outsideRange:Q,selected:!!f.find(us=>us&&us.year===$),valueText:$.toString(),inRange:G||ie,firstInRange:!!le,lastInRange:!!De,inHoveredRange:!!ie,firstInHoveredRange:!!Fe,lastInHoveredRange:!!He,value:I,get disabled(){return v||!ds.selectable}};return ds}function Pt(L){const{value:$,disabled:v}=L,I=u.set({month:$}),F=Fa(M,D,u),Q=T&&en(I,f),U=T&&f[0]&&Rn(I,f[0]),G=T&&f[1]&&Rn(I,f[1]),le=T&&p.length>0,De=le&&en(I,p),Ne=le&&p[0]&&Rn(I,p[0]),ie=le&&p[1]&&Rn(I,p[1]),Fe={focused:u.month===L.value,selectable:!_e(I,E,O),selected:!!f.find(He=>He&&He.month===$&&He.year===u.year),valueText:F.format(I.toDate(D)),inRange:Q||De,firstInRange:!!U,lastInRange:!!G,inHoveredRange:!!De,firstInHoveredRange:!!Ne,lastInHoveredRange:!!ie,outsideRange:!1,value:I,get disabled(){return v||!Fe.selectable}};return Fe}function bt(L){const{value:$,disabled:v,visibleRange:I=i("visibleRange")}=L,F=Al(M,D,u),Q=pi(i("visibleDuration")),U=r("outsideDaySelectable"),G=I.start.add(Q).subtract({days:1}),le=_e($,I.start,G),De=T&&en($,f),Ne=T&&f[0]&&Se($,f[0]),ie=T&&f[1]&&Se($,f[1]),Fe=T&&p.length>0,He=Fe&&en($,p),ds=Fe&&p[0]&&Se($,p[0]),us=Fe&&p[1]&&Se($,p[1]),Oi=f.some(Mi=>Mi!=null&&Se($,Mi)),fs={invalid:_e($,E,O),disabled:v||!U&&le||_e($,E,O)||V&&!Oi,selected:Oi,unavailable:Na($,A,M,E,O)&&!v,outsideRange:le,today:fm($,D),weekend:wm($,M),value:$,valueText:F.format($.toDate(D)),get focused(){return u!=null&&Se($,u)&&(!fs.outsideRange||U)},get selectable(){return!fs.disabled&&!fs.unavailable},inRange:De||He,firstInRange:Ne,lastInRange:ie,inHoveredRange:He,firstInHoveredRange:ds,lastInHoveredRange:us};return fs}function $n(L){const{view:$="day",id:v}=L;return[$,v].filter(Boolean).join(" ")}return{focused:S,open:x,disabled:g,invalid:m,readOnly:d,inline:!!r("inline"),numOfMonths:r("numOfMonths"),showWeekNumbers:!!r("showWeekNumbers"),selectionMode:r("selectionMode"),maxSelectedDates:R,isMaxSelected:V,view:s.get("view"),getRangePresetValue(L){return Wa(L,M,D)},getWeekNumber(L){const $=L[0];return $?Ha($,M):0},getDaysInWeek(L,$=l){return Ml(L,$,M,w)},getOffset(L){const $=l.add(L),v=c.add(L),I=Fa(M,D,u);return{visibleRange:{start:$,end:v},weeks:be($),visibleRangeText:{start:I.format($.toDate(D)),end:I.format(v.toDate(D))}}},getMonthWeeks:be,isUnavailable:Ke,weeks:be(),weekDays:zm(l,w,D,M),visibleRangeText:i("visibleRangeText"),value:f,valueAsDate:f.filter(L=>L!=null).map(L=>L.toDate(D)),valueAsString:i("valueAsString"),focusedValue:u,focusedValueAsDate:u?.toDate(D),focusedValueAsString:r("format")(u,{locale:M,timeZone:D}),visibleRange:i("visibleRange"),selectToday(){const L=ke(zn(D,u.calendar),E,O);o({type:"VALUE.SET",value:[L]})},setValue(L){const $=L.map(v=>ke(v,E,O));o({type:"VALUE.SET",value:$})},setTime(L,$=0){const v=Array.from(f);let I=v[$];I&&("hour"in I||(I=Le(I)),I=I.set({hour:L.hour??("hour"in I?I.hour:0),minute:L.minute??("minute"in I?I.minute:0),second:L.second??("second"in I?I.second:0),millisecond:L.millisecond??("millisecond"in I?I.millisecond:0)}),v[$]=ke(I,E,O),o({type:"VALUE.SET",value:v}))},clearValue(L={}){const{focus:$=!0}=L;o({type:"VALUE.CLEAR",focus:$})},setFocusedValue(L){o({type:"FOCUS.SET",value:L})},setOpen(L){r("inline")||o({type:L?"OPEN":"CLOSE",replaces:"open"})},focusMonth:Rt,focusYear:Zt,getYears:$e,getMonths:Dt,getYearsGrid(L={}){const{columns:$=1}=L,v=cn(l.year).map(I=>({label:I.toString(),value:I,disabled:!Dr(I,E?.year,O?.year)}));return Fi(v,$)},getDecade(){const L=cn(l.year);return{start:L.at(0),end:L.at(-1)}},getMonthsGrid(L={}){const{columns:$=1,format:v}=L;return Fi(Dt({format:v}),$)},format(L,$={month:"long",year:"numeric"}){return new Ae(M,{...$,calendar:L.calendar.identifier}).format(L.toDate(D))},setView(L){o({type:"VIEW.SET",view:L})},goToNext(){o({type:"GOTO.NEXT",view:s.get("view")})},goToPrev(){o({type:"GOTO.PREV",view:s.get("view")})},getRootProps(){return t.element({...J.root.attrs,dir:r("dir"),id:gv(a),"data-state":x?"open":"closed","data-disabled":P(g),"data-readonly":P(d),"data-empty":P(C)})},getLabelProps(L={}){const{index:$=0}=L;return t.label({...J.label.attrs,id:pv(a,$),dir:r("dir"),htmlFor:Ua(a,$),"data-state":x?"open":"closed","data-index":$,"data-disabled":P(g),"data-readonly":P(d),"data-invalid":P(m)})},getControlProps(){return t.element({...J.control.attrs,dir:r("dir"),id:Nl(a),"data-disabled":P(g),"data-placeholder-shown":P(C),"data-invalid":P(m)})},getRangeTextProps(){return t.element({...J.rangeText.attrs,dir:r("dir")})},getContentProps(){return t.element({...J.content.attrs,hidden:!x,dir:r("dir"),"data-state":x?"open":"closed","data-placement":H,"data-side":z,"data-inline":P(r("inline")),id:Po(a),tabIndex:-1,role:"application","aria-label":W.content})},getTableProps(L={}){const{view:$="day",columns:v=$==="day"?7:4}=L,I=$n(L);return t.element({...J.table.attrs,role:"grid","data-columns":v,"aria-label":i("visibleRangeText").formatted,id:mv(a,I),"aria-readonly":he(d),"aria-disabled":he(g),"aria-multiselectable":he(r("selectionMode")!=="single"),"data-view":$,dir:r("dir"),tabIndex:-1,onKeyDown(F){if(F.defaultPrevented||g)return;const Q={Enter(){y&&($==="day"&&Ke(u)||$==="month"&&!Pt({value:u.month}).selectable||$==="year"&&!yt({value:u.year}).selectable||o({type:"TABLE.ENTER",view:$,columns:v,focus:!0}))},Space(G){Q.Enter?.()},ArrowLeft(){o({type:"TABLE.ARROW_LEFT",view:$,columns:v,focus:!0})},ArrowRight(){o({type:"TABLE.ARROW_RIGHT",view:$,columns:v,focus:!0})},ArrowUp(){o({type:"TABLE.ARROW_UP",view:$,columns:v,focus:!0})},ArrowDown(){o({type:"TABLE.ARROW_DOWN",view:$,columns:v,focus:!0})},PageUp(G){o({type:"TABLE.PAGE_UP",larger:G.shiftKey,view:$,columns:v,focus:!0})},PageDown(G){o({type:"TABLE.PAGE_DOWN",larger:G.shiftKey,view:$,columns:v,focus:!0})},Home(){o({type:"TABLE.HOME",view:$,columns:v,focus:!0})},End(){o({type:"TABLE.END",view:$,columns:v,focus:!0})}},U=Q[uo(F,{dir:r("dir")})];U&&(U(F),F.preventDefault(),F.stopPropagation())},onPointerLeave(){o({type:"TABLE.POINTER_LEAVE"})},onPointerDown(){o({type:"TABLE.POINTER_DOWN",view:$})},onPointerUp(){o({type:"TABLE.POINTER_UP",view:$})}})},getTableHeadProps(L={}){const{view:$="day"}=L;return t.element({...J.tableHead.attrs,"aria-hidden":!0,dir:r("dir"),"data-view":$,"data-disabled":P(g)})},getTableHeaderProps(L={}){const{view:$="day"}=L;return t.element({...J.tableHeader.attrs,dir:r("dir"),"data-view":$,"data-disabled":P(g)})},getTableBodyProps(L={}){const{view:$="day"}=L;return t.element({...J.tableBody.attrs,"data-view":$,"data-disabled":P(g)})},getTableRowProps(L={}){const{view:$="day"}=L;return t.element({...J.tableRow.attrs,"aria-disabled":he(g),"data-disabled":P(g),"data-view":$})},getWeekNumberHeaderCellProps(L={}){const{view:$="day"}=L;return t.element({...J.tableCell.attrs,scope:"col","aria-label":W.weekColumnHeader,"data-view":$,"data-type":"week-number","data-disabled":P(g)})},getWeekNumberCellProps(L){const{weekIndex:$,week:v}=L,I=v[0]?Ha(v[0],M):0;return t.element({...J.tableCell.attrs,role:"rowheader","aria-label":W.weekNumberCell?.(I),"data-view":"day","data-week-index":$,"data-type":"week-number","data-disabled":P(g)})},getDayTableCellState:bt,getDayTableCellProps(L){const{value:$}=L,v=bt(L);return t.element({...J.tableCell.attrs,role:"gridcell","aria-disabled":he(!v.selectable),"aria-selected":v.selected||v.inRange,"aria-invalid":he(v.invalid),"aria-current":v.today?"date":void 0,"data-value":$.toString()})},getDayTableCellTriggerProps(L){const{value:$}=L,v=bt(L);return t.element({...J.tableCellTrigger.attrs,id:eo(a,$.toString()),role:"button",dir:r("dir"),tabIndex:g?-1:v.focused?0:-1,"aria-label":W.dayCell(v),"aria-disabled":he(!v.selectable),"aria-invalid":he(v.invalid),"data-disabled":P(!v.selectable),"data-selectable":P(v.selectable),"data-selected":P(v.selected),"data-value":$.toString(),"data-view":"day","data-today":P(v.today),"data-focus":P(v.focused),"data-unavailable":P(v.unavailable),"data-range-start":P(v.firstInRange),"data-range-end":P(v.lastInRange),"data-in-range":P(v.inRange),"data-outside-range":P(v.outsideRange),"data-weekend":P(v.weekend),"data-in-hover-range":P(v.inHoveredRange),"data-hover-range-start":P(v.firstInHoveredRange),"data-hover-range-end":P(v.lastInHoveredRange),onClick(I){I.defaultPrevented||y&&v.selectable&&o({type:"CELL.CLICK",cell:"day",value:$})},onPointerMove:T?I=>{if(I.pointerType==="touch"||!v.selectable)return;const F=!a.isActiveElement(I.currentTarget);h&&um($,h)||o({type:"CELL.POINTER_MOVE",cell:"day",value:$,focus:F,outsideRange:v.outsideRange})}:void 0})},getMonthTableCellState:Pt,getMonthTableCellProps(L){const{value:$,columns:v}=L,I=Pt(L);return t.element({...J.tableCell.attrs,dir:r("dir"),colSpan:v,role:"gridcell","aria-selected":he(I.selected||I.inRange),"data-selected":P(I.selected),"aria-disabled":he(!I.selectable),"data-value":$})},getMonthTableCellTriggerProps(L){const{value:$}=L,v=Pt(L);return t.element({...J.tableCellTrigger.attrs,id:eo(a,$.toString()),role:"button",dir:r("dir"),tabIndex:g?-1:v.focused?0:-1,"aria-label":v.valueText,"aria-disabled":he(!v.selectable),"data-disabled":P(!v.selectable),"data-selectable":P(v.selectable),"data-selected":P(v.selected),"data-value":$,"data-view":"month","data-focus":P(v.focused),"data-outside-range":P(v.outsideRange),"data-range-start":P(v.firstInRange),"data-range-end":P(v.lastInRange),"data-in-range":P(v.inRange),"data-in-hover-range":P(v.inHoveredRange),"data-hover-range-start":P(v.firstInHoveredRange),"data-hover-range-end":P(v.lastInHoveredRange),onClick(I){I.defaultPrevented||y&&v.selectable&&o({type:"CELL.CLICK",cell:"month",value:$})},onPointerMove:T?I=>{if(I.pointerType==="touch"||!v.selectable)return;const F=!a.isActiveElement(I.currentTarget);h&&v.value&&Rn(v.value,h)||o({type:"CELL.POINTER_MOVE",cell:"month",value:v.value,focus:F})}:void 0})},getYearTableCellState:yt,getYearTableCellProps(L){const{value:$,columns:v}=L,I=yt(L);return t.element({...J.tableCell.attrs,dir:r("dir"),colSpan:v,role:"gridcell","aria-selected":he(I.selected||I.inRange),"data-selected":P(I.selected),"aria-disabled":he(!I.selectable),"data-value":$})},getYearTableCellTriggerProps(L){const{value:$}=L,v=yt(L);return t.element({...J.tableCellTrigger.attrs,id:eo(a,$.toString()),role:"button",dir:r("dir"),tabIndex:g?-1:v.focused?0:-1,"aria-label":v.valueText,"aria-disabled":he(!v.selectable),"data-disabled":P(!v.selectable),"data-selectable":P(v.selectable),"data-selected":P(v.selected),"data-value":$,"data-view":"year","data-focus":P(v.focused),"data-outside-range":P(v.outsideRange),"data-range-start":P(v.firstInRange),"data-range-end":P(v.lastInRange),"data-in-range":P(v.inRange),"data-in-hover-range":P(v.inHoveredRange),"data-hover-range-start":P(v.firstInHoveredRange),"data-hover-range-end":P(v.lastInHoveredRange),onClick(I){I.defaultPrevented||y&&v.selectable&&o({type:"CELL.CLICK",cell:"year",value:$})},onPointerMove:T?I=>{if(I.pointerType==="touch"||!v.selectable||v.outsideRange)return;const F=!a.isActiveElement(I.currentTarget);h&&v.value&&Pn(v.value,h)||o({type:"CELL.POINTER_MOVE",cell:"year",value:v.value,focus:F})}:void 0})},getNextTriggerProps(L={}){const{view:$="day"}=L,v=g||!i("isNextVisibleRangeValid");return t.button({...J.nextTrigger.attrs,dir:r("dir"),id:yv(a,$),type:"button","aria-label":W.nextTrigger($),disabled:v,"data-disabled":P(v),onClick(I){I.defaultPrevented||o({type:"GOTO.NEXT",view:$})}})},getPrevTriggerProps(L={}){const{view:$="day"}=L,v=g||!i("isPrevVisibleRangeValid");return t.button({...J.prevTrigger.attrs,dir:r("dir"),id:vv(a,$),type:"button","aria-label":W.prevTrigger($),disabled:v,"data-disabled":P(v),onClick(I){I.defaultPrevented||o({type:"GOTO.PREV",view:$})}})},getClearTriggerProps(){return t.button({...J.clearTrigger.attrs,id:Vl(a),dir:r("dir"),type:"button","aria-label":W.clearTrigger,hidden:!f.length,onClick(L){L.defaultPrevented||y&&o({type:"VALUE.CLEAR"})}})},getTriggerProps(){return t.button({...J.trigger.attrs,id:Fl(a),dir:r("dir"),type:"button","data-placement":H,"data-side":z,"aria-label":W.trigger(x),"aria-controls":Po(a),"aria-expanded":x,"data-state":x?"open":"closed","data-placeholder-shown":P(C),"aria-haspopup":"grid",disabled:g,onClick(L){L.defaultPrevented||y&&o({type:"TRIGGER.CLICK"})}})},getViewProps(L={}){const{view:$="day"}=L;return t.element({...J.view.attrs,"data-view":$,hidden:s.get("view")!==$})},getViewTriggerProps(L={}){const{view:$="day"}=L,v=Wl($,r("minView"),r("maxView")),I=v!==$,F=g||!I;return t.button({...J.viewTrigger.attrs,"data-view":$,dir:r("dir"),id:bv(a,$),type:"button",disabled:F,"data-disabled":P(F),"aria-label":W.viewTrigger($,I?v:void 0),onClick(Q){Q.defaultPrevented||y&&o({type:"VIEW.TOGGLE",src:"viewTrigger"})}})},getViewControlProps(L={}){const{view:$="day"}=L;return t.element({...J.viewControl.attrs,"data-view":$,dir:r("dir")})},getInputProps(L={}){const{index:$=0,fixOnBlur:v=!0}=L;return t.input({...J.input.attrs,id:Ua(a,$),autoComplete:"off",autoCorrect:"off",spellCheck:"false",dir:r("dir"),name:r("name"),"data-index":$,"data-state":x?"open":"closed","data-placeholder-shown":P(C),readOnly:d,disabled:g,required:r("required"),"aria-invalid":he(m),"data-invalid":P(m),placeholder:r("placeholder")||Sv(M,W.placeholder(M)),defaultValue:i("valueAsString")[$],onBeforeInput(I){const{data:F}=Ko(I);Pl(F,Z,M)||I.preventDefault()},onClick(I){I.defaultPrevented||r("openOnClick")&&y&&o({type:"OPEN",src:"input.click"})},onFocus(){o({type:"INPUT.FOCUS",index:$})},onBlur(I){const F=I.currentTarget.value.trim();o({type:"INPUT.BLUR",value:F,index:$,fixOnBlur:v})},onKeyDown(I){if(I.defaultPrevented||!y)return;const Q={Enter(U){Zu(U)||Ke(u)||U.currentTarget.value.trim()!==""&&o({type:"INPUT.ENTER",value:U.currentTarget.value,index:$})}}[I.key];Q&&(Q(I),I.preventDefault())},onInput(I){const F=I.currentTarget.value;o({type:"INPUT.CHANGE",value:av(F,Z,M),index:$})}})},getMonthSelectProps(){return t.select({...J.monthSelect.attrs,id:_l(a),"aria-label":W.monthSelect,disabled:g,dir:r("dir"),defaultValue:l.month,onChange(L){Rt(Number(L.currentTarget.value))}})},getYearSelectProps(){return t.select({...J.yearSelect.attrs,id:Bl(a),disabled:g,"aria-label":W.yearSelect,dir:r("dir"),defaultValue:l.year,onChange(L){Zt(Number(L.currentTarget.value))}})},getPositionerProps(){return t.element({id:Hl(a),...J.positioner.attrs,dir:r("dir"),style:re.floating})},getPresetTriggerProps(L){const $=Array.isArray(L.value)?L.value:Wa(L.value,M,D),v=$.filter(I=>I!=null).map(I=>I.toDate(D).toDateString());return t.button({...J.presetTrigger.attrs,"aria-label":W.presetTrigger(v),type:"button",onClick(I){I.defaultPrevented||y&&o({type:"PRESET.CLICK",value:$})}})}}}var to="__live-region-debug__",Mv="position:fixed;inset-inline:0;bottom:0;z-index:2147483647;padding:12px 16px;background:black;color:white;font-size:14px;line-height:20px;text-align:center;pointer-events:none;",Dv=100,Rv=200,Pv={border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"};function Vv(e={}){const{level:t="polite",document:n=document,root:s,delay:r=0,debug:o=!1}=e,i=n.defaultView??window,a=()=>(typeof s=="function"?s():s)??n.body;let l;function c(){if(!o)return;let m=n.getElementById(to);return m||(m=n.createElement("div"),m.id=to,m.dataset.liveAnnouncerDebug="true",m.setAttribute("aria-hidden","true"),m.style.cssText=Mv,a().appendChild(m),m)}function f(){const m=n.createElement("span");return m.dataset.liveAnnouncer="true",m.setAttribute("aria-live",t),m.setAttribute("aria-atomic","true"),m.setAttribute("role",t==="assertive"?"alert":"status"),Object.assign(m.style,Pv),a().appendChild(m),u=Date.now()+Rv,m}let u=0,h=f();function p(){i.clearTimeout(l),l=void 0}function g(m,y=r){p(),h?.isConnected||(h=f());const C=h;C.textContent="",l=i.setTimeout(()=>{l=void 0,C.textContent=m;const E=c();E&&(E.textContent=m)},Math.max(y,Dv,u-Date.now()))}function d(){p(),h?.remove(),h=null,o&&n.getElementById(to)?.remove()}return{announce:g,cancel:p,destroy:d,toJSON(){return"live-region"}}}var{and:ye}=Uc();function Nv(e,t){if(e?.length!==t?.length)return!1;const n=Math.max(e.length,t.length);for(let s=0;s<n;s++)if(!xt(e[s],t[s]))return!1;return!0}function ks(e,t){return e.map(n=>n==null?"":t("format")(n,{locale:t("locale"),timeZone:t("timeZone")}))}var Fv=qc({props({props:e}){const t=e.locale||"en-US",n=e.timeZone||"UTC",s=e.selectionMode||"single",r=e.numOfMonths||1;let o;if(e.createCalendar){const g=new Intl.DateTimeFormat(t).resolvedOptions().calendar;g!=="gregory"&&g!=="iso8601"&&(o=e.createCalendar(g))}const i=p=>!o||p.calendar.identifier===o.identifier?p:de(p,o),a=e.defaultValue?Ts(e.defaultValue).map(p=>ke(i(p),e.min,e.max)):void 0,l=e.value?Ts(e.value).map(p=>ke(i(p),e.min,e.max)):void 0;let c=e.focusedValue||e.defaultFocusedValue||l?.[0]||a?.[0]||zn(n,o);c=ke(i(c),e.min,e.max);const f=e.minView||"day",u=e.maxView||"year",h=mi(e.defaultView||e.view||f,f,u);return{locale:t,numOfMonths:r,timeZone:n,selectionMode:s,minView:f,maxView:u,outsideDaySelectable:!1,closeOnSelect:!0,format(p,{locale:g,timeZone:d}){return new Ae(g,{timeZone:d,day:"2-digit",month:"2-digit",year:"numeric",calendar:o?.identifier}).format(p.toDate(d))},parse(p,{locale:g,timeZone:d}){return uv(p,g,d)},...e,focusedValue:typeof e.focusedValue>"u"?void 0:c,defaultFocusedValue:c,value:l,defaultValue:a??[],defaultView:h,positioning:{placement:"bottom",...e.positioning}}},initialState({prop:e}){return e("inline")||(e("open")??e("defaultOpen"))?"open":"idle"},refs(){return{announcer:void 0}},context({prop:e,bindable:t,getContext:n}){return{focusedValue:t(()=>({defaultValue:e("defaultFocusedValue"),value:e("focusedValue"),isEqual:xt,hash:s=>s.toString(),sync:!0,onChange(s){const r=n(),o=r.get("view"),i=r.get("value"),a=ks(i,e);e("onFocusChange")?.({value:i,valueAsString:a,view:o,focusedValue:s})}})),value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:Nv,hash:s=>s.map(r=>r?.toString()??"").join(","),onChange(s){const r=n(),o=ks(s,e);e("onValueChange")?.({value:s,valueAsString:o,view:r.get("view")})}})),inputValue:t(()=>({defaultValue:""})),activeIndex:t(()=>({defaultValue:0,sync:!0})),hoveredValue:t(()=>({defaultValue:null,isEqual: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:Va(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})=>Tl(e.get("startValue"),t("visibleDuration")),visibleRange:({context:e,computed:t})=>({start:e.get("startValue"),end:t("endValue")}),visibleRangeText:({context:e,prop:t,computed:n})=>Lv({view:e.get("view"),startValue:e.get("startValue"),endValue:n("endValue"),locale:t("locale"),timeZone:t("timeZone"),selectionMode:t("selectionMode")}),isPrevVisibleRangeValid:({context:e,prop:t})=>!Wm(e.get("startValue"),t("min"),t("max")),isNextVisibleRangeValid:({prop:e,computed:t})=>!Um(t("endValue"),e("min"),e("max")),valueAsString:({context:e,prop:t})=>ks(e.get("value"),t)},effects:["setupLiveRegion"],watch({track:e,prop:t,context:n,action:s,computed:r}){e([()=>t("locale")],()=>{s(["setStartValue","syncInputElement"])}),e([()=>n.hash("focusedValue")],()=>{s(["setStartValue","focusActiveCellIfNeeded","setHoveredValueIfKeyboard"])}),e([()=>n.hash("startValue")],()=>{s(["syncMonthSelectElement","syncYearSelectElement","invokeOnVisibleRangeChange"])}),e([()=>n.get("inputValue")],()=>{s(["syncInputValue"])}),e([()=>n.hash("value")],()=>{s(["syncInputElement"])}),e([()=>r("valueAsString").toString()],()=>{s(["announceValueText"])}),e([()=>n.get("view")],()=>{s(["focusActiveCell"])}),e([()=>t("open")],()=>{s(["toggleVisibility"])})},on:{"VALUE.SET":{actions:["setDateValue","setFocusedDate"]},"VIEW.SET":{actions:["setView"]},"FOCUS.SET":{actions:["setFocusedDate"]},"VALUE.CLEAR":{actions:["clearDateValue","clearFocusedDate","setActiveIndexToStart","clearHoveredDate","focusFirstInputElement"]},"INPUT.CHANGE":[{guard:"isInputValueEmpty",actions:["setInputValue","clearDateValue","clearFocusedDate"]},{actions:["setInputValue","focusParsedDate"]}],"INPUT.ENTER":{actions:["focusParsedDate","selectFocusedDate"]},"INPUT.FOCUS":{actions:["setActiveIndex"]},"INPUT.BLUR":[{guard:"shouldFixOnBlur",actions:["setActiveIndexToStart","selectParsedDate"]},{actions:["setActiveIndexToStart"]}],"PRESET.CLICK":[{guard:"isOpenControlled",actions:["setDateValue","setFocusedDate","invokeOnClose"]},{target:"focused",actions:["setDateValue","setFocusedDate","focusInputElement"]}],"GOTO.NEXT":[{guard:"isYearView",actions:["focusNextDecade","announceVisibleRange"]},{guard:"isMonthView",actions:["focusNextYear","announceVisibleRange"]},{actions:["focusNextPage"]}],"GOTO.PREV":[{guard:"isYearView",actions:["focusPreviousDecade","announceVisibleRange"]},{guard:"isMonthView",actions:["focusPreviousYear","announceVisibleRange"]},{actions:["focusPreviousPage"]}]},states:{idle:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell"]},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}]}},focused:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell"]},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}]}},open:{tags:["open"],entry:["resumeRangeSelection"],effects:["trackDismissableElement","trackPositioning"],exit:["clearHoveredDate"],on:{"CONTROLLED.CLOSE":[{guard:ye("shouldRestoreFocus","isInteractOutsideEvent"),target:"focused",actions:["restoreFocusToTrigger"]},{guard:"shouldRestoreFocus",target:"focused",actions:["restoreFocusToInput"]},{target:"idle"}],"CELL.CLICK":[{guard:"isAboveMinView",actions:["setFocusedValueForView","setPreviousView"]},{guard:ye("isRangePicker","hasSelectedRange"),actions:["setActiveIndexToStart","resetSelection","setActiveIndexToEnd"]},{guard:ye("isRangePicker","isSelectingEndDate","closeOnSelect","isOpenControlled"),actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","setRestoreFocus"]},{guard:ye("isRangePicker","isSelectingEndDate","closeOnSelect"),target:"focused",actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","restoreFocusToInput"]},{guard:ye("isRangePicker","isSelectingEndDate"),actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate"]},{guard:"isRangePicker",actions:["setFocusedDate","setSelectedDate","setActiveIndexToEnd"]},{guard:ye("isMultiPicker","canSelectDate"),actions:["setFocusedDate","toggleSelectedDate"]},{guard:"isMultiPicker",actions:["setFocusedDate"]},{guard:ye("closeOnSelect","isOpenControlled"),actions:["setFocusedDate","setSelectedDate","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["setFocusedDate","setSelectedDate","invokeOnClose","restoreFocusToInput"]},{actions:["setFocusedDate","setSelectedDate"]}],"CELL.POINTER_MOVE":[{guard:ye("isRangePicker","isSelectingEndDate","isDayPointerMoveOutsideVisibleMonth"),actions:["setHoveredDate"]},{guard:ye("isRangePicker","isSelectingEndDate"),actions:["setHoveredDate","setFocusedDate"]}],"TABLE.POINTER_LEAVE":{guard:"isRangePicker",actions:["clearHoveredDate"]},"TABLE.POINTER_DOWN":{actions:["disableTextSelection"]},"TABLE.POINTER_UP":{actions:["enableTextSelection"]},"TABLE.ESCAPE":[{guard:"isOpenControlled",actions:["focusFirstSelectedDate","invokeOnClose"]},{target:"focused",actions:["focusFirstSelectedDate","invokeOnClose","restoreFocusToTrigger"]}],"TABLE.ENTER":[{guard:"isAboveMinView",actions:["setPreviousView"]},{guard:ye("isRangePicker","hasSelectedRange"),actions:["setActiveIndexToStart","resetSelection","setActiveIndexToEnd","focusNextDay"]},{guard:ye("isRangePicker","isSelectingEndDate","closeOnSelect","isOpenControlled"),actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose"]},{guard:ye("isRangePicker","isSelectingEndDate","closeOnSelect"),target:"focused",actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","restoreFocusToInput"]},{guard:ye("isRangePicker","isSelectingEndDate"),actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate"]},{guard:"isRangePicker",actions:["setSelectedDate","setActiveIndexToEnd","focusNextDay"]},{guard:ye("isMultiPicker","canSelectDate"),actions:["toggleSelectedDate"]},{guard:"isMultiPicker"},{guard:ye("closeOnSelect","isOpenControlled"),actions:["selectFocusedDate","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectFocusedDate","invokeOnClose","restoreFocusToInput"]},{actions:["selectFocusedDate"]}],"TABLE.ARROW_RIGHT":[{guard:"isMonthView",actions:["focusNextMonth"]},{guard:"isYearView",actions:["focusNextYear"]},{actions:["focusNextDay","setHoveredDate"]}],"TABLE.ARROW_LEFT":[{guard:"isMonthView",actions:["focusPreviousMonth"]},{guard:"isYearView",actions:["focusPreviousYear"]},{actions:["focusPreviousDay"]}],"TABLE.ARROW_UP":[{guard:"isMonthView",actions:["focusPreviousMonthColumn"]},{guard:"isYearView",actions:["focusPreviousYearColumn"]},{actions:["focusPreviousWeek"]}],"TABLE.ARROW_DOWN":[{guard:"isMonthView",actions:["focusNextMonthColumn"]},{guard:"isYearView",actions:["focusNextYearColumn"]},{actions:["focusNextWeek"]}],"TABLE.PAGE_UP":{actions:["focusPreviousSection"]},"TABLE.PAGE_DOWN":{actions:["focusNextSection"]},"TABLE.HOME":[{guard:"isMonthView",actions:["focusFirstMonth"]},{guard:"isYearView",actions:["focusFirstYear"]},{actions:["focusSectionStart"]}],"TABLE.END":[{guard:"isMonthView",actions:["focusLastMonth"]},{guard:"isYearView",actions:["focusLastYear"]},{actions:["focusSectionEnd"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose"]}],"VIEW.TOGGLE":{actions:["setNextView"]},INTERACT_OUTSIDE:[{guard:"isOpenControlled",actions:["setActiveIndexToStart","invokeOnClose"]},{guard:"shouldRestoreFocus",target:"focused",actions:["setActiveIndexToStart","invokeOnClose","restoreFocusToTrigger"]},{target:"idle",actions:["setActiveIndexToStart","invokeOnClose"]}],CLOSE:[{guard:"isOpenControlled",actions:["setActiveIndexToStart","invokeOnClose"]},{target:"idle",actions:["setActiveIndexToStart","invokeOnClose"]}]}}},implementations:{guards:{isAboveMinView:({context:e,prop:t})=>Iv(e.get("view"),t("minView")),isDayView:({context:e,event:t})=>(t.view||e.get("view"))==="day",isMonthView:({context:e,event:t})=>(t.view||e.get("view"))==="month",isYearView:({context:e,event:t})=>(t.view||e.get("view"))==="year",isRangePicker:({prop:e})=>e("selectionMode")==="range",hasSelectedRange:({context:e})=>e.get("value").length===2,isMultiPicker:({prop:e})=>e("selectionMode")==="multiple",canSelectDate:e=>{const{context:t,prop:n,event:s}=e,r=n("maxSelectedDates");if(r==null)return!0;const o=t.get("value"),i=qn(e,s.value??t.get("focusedValue"));return o.some(l=>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=jl(n);return wo(s,()=>Ga(n),{...t("positioning"),defer:!0,onComplete(o){e.set("currentPlacement",o.placement)}})},setupLiveRegion({scope:e,refs:t}){const n=e.getDoc();return t.set("announcer",Vv({level:"assertive",document:n})),()=>t.get("announcer")?.destroy?.()},trackDismissableElement({scope:e,send:t,context:n,prop:s}){return s("inline")?void 0:Kc(()=>nn(e),{type:"popover",defer:!0,getRootNode:e.getRootNode,layerStyleTargets:[()=>Ga(e)],exclude:[...Un(e),Fs(e),xv(e)],onInteractOutside(o){n.set("restoreFocus",!o.detail.focusable)},onDismiss(){t({type:"INTERACT_OUTSIDE"})},onEscapeKeyDown(o){o.preventDefault(),t({type:"TABLE.ESCAPE",src:"dismissable",focusVisible:!0})}})}},actions:{setNextView({context:e,prop:t}){const n=Wl(e.get("view"),t("minView"),t("maxView"));e.set("view",n)},setPreviousView({context:e,prop:t}){const n=Tv(e.get("view"),t("minView"),t("maxView"));e.set("view",n)},setView({context:e,event:t}){e.set("view",t.view)},setRestoreFocus({context:e}){e.set("restoreFocus",!0)},announceValueText({context:e,prop:t,refs:n}){const s=e.get("value"),r=t("locale"),o=t("timeZone");let i;if(t("selectionMode")==="range"){const[a,l]=s;a&&l?i=Cs(a,l,r,o):a?i=Cs(a,null,r,o):l?i=Cs(l,null,r,o):i=""}else i=s.map(a=>Cs(a,null,r,o)).filter(Boolean).join(",");n.get("announcer")?.announce(i,3e3)},announceVisibleRange({computed:e,refs:t}){const{formatted:n}=e("visibleRangeText");t.get("announcer")?.announce(n)},disableTextSelection({scope:e}){Tf({target:nn(e),doc:e.getDoc()})},enableTextSelection({scope:e}){Sc({doc:e.getDoc(),target:nn(e)})},focusFirstSelectedDate(e){const{context:t}=e;t.get("value").length&&ne(e,t.get("value")[0])},syncInputElement({scope:e,computed:t}){pe(()=>{Un(e).forEach((s,r)=>{gs(s,t("valueAsString")[r]||"")})})},setFocusedDate(e){const{event:t}=e,n=Array.isArray(t.value)?t.value[0]:t.value;ne(e,n)},setFocusedValueForView(e){const{context:t,event:n}=e;ne(e,t.get("focusedValue").set({[t.get("view")]:n.value}))},focusNextMonth(e){const{context:t}=e;ne(e,t.get("focusedValue").add({months:1}))},focusPreviousMonth(e){const{context:t}=e;ne(e,t.get("focusedValue").subtract({months:1}))},setDateValue({context:e,event:t,prop:n}){if(!Array.isArray(t.value))return;const s=t.value.map(r=>ke(r,n("min"),n("max")));e.set("value",s)},clearDateValue({context:e}){e.set("value",[])},setSelectedDate(e){const{context:t,event:n}=e,s=Array.from(t.get("value")),r=t.get("activeIndex"),o=s[r],i=qn(e,n.value??t.get("focusedValue"));s[r]=As(o,i),t.set("value",Hs(s))},resetSelection(e){const{context:t,event:n}=e,s=t.get("value")[0],r=qn(e,n.value??t.get("focusedValue"));t.set("value",[As(s,r)])},toggleSelectedDate(e){const{context:t,event:n}=e,s=qn(e,n.value??t.get("focusedValue")),r=t.get("value"),o=r.findIndex(i=>xt(i,s));if(o===-1){const i=[...r,s];t.set("value",Ts(i))}else{const i=Array.from(r);i.splice(o,1),t.set("value",Ts(i))}},setHoveredDate({context:e,event:t}){e.set("hoveredValue",t.value)},clearHoveredDate({context:e}){e.set("hoveredValue",null)},selectFocusedDate({context:e,computed:t}){const n=Array.from(e.get("value")),s=e.get("activeIndex"),r=n[s],o=e.get("focusedValue").copy();n[s]=As(r,o),e.set("value",Hs(n));const i=t("valueAsString");e.set("inputValue",i[s])},focusPreviousDay(e){const{context:t}=e,n=t.get("focusedValue").subtract({days:1});ne(e,n)},focusNextDay(e){const{context:t}=e,n=t.get("focusedValue").add({days:1});ne(e,n)},focusPreviousWeek(e){const{context:t}=e,n=t.get("focusedValue").subtract({weeks:1});ne(e,n)},focusNextWeek(e){const{context:t}=e,n=t.get("focusedValue").add({weeks:1});ne(e,n)},focusNextPage(e){const{context:t,computed:n,prop:s}=e,r=Dl(t.get("focusedValue"),t.get("startValue"),n("visibleDuration"),s("locale"),s("min"),s("max"));Ls(e,r)},focusPreviousPage(e){const{context:t,computed:n,prop:s}=e,r=Rl(t.get("focusedValue"),t.get("startValue"),n("visibleDuration"),s("locale"),s("min"),s("max"));Ls(e,r)},focusSectionStart(e){const{context:t}=e;ne(e,t.get("startValue").copy())},focusSectionEnd(e){const{computed:t}=e;ne(e,t("endValue").copy())},focusNextSection(e){const{context:t,event:n,computed:s,prop:r}=e,o=sv(t.get("focusedValue"),t.get("startValue"),n.larger,s("visibleDuration"),r("locale"),r("min"),r("max"));o&&Ls(e,o)},focusPreviousSection(e){const{context:t,event:n,computed:s,prop:r}=e,o=rv(t.get("focusedValue"),t.get("startValue"),n.larger,s("visibleDuration"),r("locale"),r("min"),r("max"));o&&Ls(e,o)},focusNextYear(e){const{context:t}=e,n=t.get("focusedValue").add({years:1});ne(e,n)},focusPreviousYear(e){const{context:t}=e,n=t.get("focusedValue").subtract({years:1});ne(e,n)},focusNextDecade(e){const{context:t}=e,n=t.get("focusedValue").add({years:10});ne(e,n)},focusPreviousDecade(e){const{context:t}=e,n=t.get("focusedValue").subtract({years:10});ne(e,n)},clearFocusedDate(e){const{context:t,prop:n}=e,s=t.get("focusedValue").calendar;ne(e,zn(n("timeZone"),s))},focusPreviousMonthColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").subtract({months:n.columns});ne(e,s)},focusNextMonthColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").add({months:n.columns});ne(e,s)},focusPreviousYearColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").subtract({years:n.columns});ne(e,s)},focusNextYearColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").add({years:n.columns});ne(e,s)},focusFirstMonth(e){const{context:t}=e,n=t.get("focusedValue"),s=n.calendar.getMinimumMonthInYear?.(n)??1;ne(e,n.set({month:s}))},focusLastMonth(e){const{context:t}=e,n=t.get("focusedValue"),s=n.calendar.getMonthsInYear(n);ne(e,n.set({month:s}))},focusFirstYear(e){const{context:t}=e,n=cn(t.get("focusedValue").year),s=t.get("focusedValue").set({year:n[0]});ne(e,s)},focusLastYear(e){const{context:t}=e,n=cn(t.get("focusedValue").year),s=t.get("focusedValue").set({year:n[n.length-1]});ne(e,s)},setActiveIndex({context:e,event:t}){e.set("activeIndex",t.index)},setActiveIndexToEnd({context:e}){e.set("activeIndex",1)},setActiveIndexToStart({context:e}){e.set("activeIndex",0)},resumeRangeSelection({context:e,prop:t}){t("selectionMode")==="range"&&e.get("value").length===1&&e.set("activeIndex",1)},focusActiveCell({scope:e,context:t,event:n}){n.src!=="input.click"&&pe(()=>{const s=t.get("view");qa(e,s)?.focus({preventScroll:!0})})},focusActiveCellIfNeeded({scope:e,context:t,event:n}){n.focus&&pe(()=>{const s=t.get("view");qa(e,s)?.focus({preventScroll:!0})})},setHoveredValueIfKeyboard({context:e,event:t,prop:n}){!(t.type.startsWith("TABLE.ARROW")||["TABLE.ENTER","TABLE.HOME","TABLE.END","TABLE.PAGE_UP","TABLE.PAGE_DOWN"].includes(t.type))||n("selectionMode")!=="range"||e.get("activeIndex")===0||e.set("hoveredValue",e.get("focusedValue").copy())},restoreFocusToTrigger({scope:e,event:t}){const n=nn(e),s=Hv(t);pe(()=>{ji(e.getActiveElement(),[n])||Fs(e)?.focus(s)})},focusFirstInputElement({scope:e,event:t}){t.focus!==!1&&pe(()=>{const[n]=Un(e);(n??Fs(e))?.focus({preventScroll:!0})})},focusInputElement({scope:e}){pe(()=>Ya(e))},restoreFocusToInput({scope:e}){const t=nn(e);pe(()=>{ji(e.getActiveElement(),[t])||Ya(e)})},syncMonthSelectElement({scope:e,context:t}){const n=Ev(e);gs(n,t.get("startValue").month.toString())},syncYearSelectElement({scope:e,context:t}){const n=wv(e);gs(n,t.get("startValue").year.toString())},setInputValue({context:e,event:t}){e.get("activeIndex")===t.index&&e.set("inputValue",t.value)},syncInputValue({scope:e,context:t,event:n}){queueMicrotask(()=>{const s=Un(e),r=n.index??t.get("activeIndex");gs(s[r],t.get("inputValue"))})},focusParsedDate(e){const{event:t,prop:n}=e;if(t.index==null)return;const r=n("parse")(t.value,{locale:n("locale"),timeZone:n("timeZone")});!r||!Ka(r)||ne(e,r)},selectParsedDate({context:e,event:t,prop:n}){if(t.index==null)return;let r=n("parse")(t.value,{locale:n("locale"),timeZone:n("timeZone")});if((!r||!Ka(r))&&t.value&&(r=e.get("focusedValue").copy()),!r)return;r=ke(r,n("min"),n("max"));const o=Array.from(e.get("value"));o[t.index]=As(o[t.index],r);const i=Hs(o);e.set("value",i);const a=ks(i,n);e.set("inputValue",a[t.index])},resetView({context:e}){e.set("view",e.initial("view"))},setStartValue({context:e,computed:t,prop:n}){const s=e.get("focusedValue");if(!_e(s,e.get("startValue"),t("endValue")))return;const o=Va(s,"start",{months:n("numOfMonths")},n("locale"));e.set("startValue",o)},invokeOnOpen({prop:e,context:t}){e("inline")||e("onOpenChange")?.({open:!0,value:t.get("value")})},invokeOnClose({prop:e,context:t}){e("inline")||e("onOpenChange")?.({open:!1,value:t.get("value")})},invokeOnVisibleRangeChange({prop:e,context:t,computed:n}){e("onVisibleRangeChange")?.({view:t.get("view"),visibleRange:n("visibleRange")})},toggleVisibility({event:e,send:t,prop:n}){t({type:n("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:e})}}}}),qn=(e,t)=>{const{context:n,prop:s}=e,r=n.get("view");let o=typeof t=="number"?n.get("focusedValue").set({[r]:t}):t;return Av(i=>{Cv(i,s("minView"))&&(o=o.set({[i]:i==="day"?1:0}))}),o},As=(e,t)=>{if(!e||!("hour"in e))return t;const n="timeZone"in e;let s=t;return"hour"in t||(n?s=yl(Le(t),e.timeZone):s=Le(t)),s.set({hour:e.hour,minute:e.minute,second:e.second,millisecond:e.millisecond})};function ne(e,t){const{context:n,prop:s,computed:r}=e;if(!t)return;const o=qn(e,t);if(xt(n.get("focusedValue"),o))return;const a=is(r("visibleDuration"),s("locale"),s("min"),s("max"))({focusedDate:o,startDate:n.get("startValue")});n.set("startValue",a.startDate),n.set("focusedValue",a.focusedDate)}function Ls(e,t){const{context:n}=e;n.set("startValue",t.startDate);const s=n.get("focusedValue");xt(s,t.focusedDate)||n.set("focusedValue",t.focusedDate)}function Hv(e){return e.focusVisible??e.previousEvent?.focusVisible?{preventScroll:!0,focusVisible:!0}:{preventScroll:!0}}function Ul(e){return Array.isArray(e)?e.map(t=>Ul(t)):e instanceof Date?new Pe(e.getFullYear(),e.getMonth()+1,e.getDate()):Rm(e)}const no=e=>`<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="${e==="left"?"m10 4-4 4 4 4":"m6 4 4 4-4 4"}"/></svg>`,so=e=>{try{return/^\d{4}-\d{2}-\d{2}$/.test(e)?Ul(e):void 0}catch{return}};function _v(e,t,n){e.innerHTML=`<div class="date-control"><button class="icon-button date-trigger" type="button" aria-label="Custom date range" title="Custom date range"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><rect x="3" y="5" width="18" height="16" rx="3"/><path d="M7 3v4m10-4v4M3 11h18m-12 5h4"/></svg></button></div>
|
|
92
92
|
<div class="date-positioner" popover="manual"><section class="date-popover">
|
|
93
93
|
<header class="date-heading"><div><span class="eyebrow">FOCUS YOUR TIMELINE</span><h2>Date range</h2></div><button type="button" class="icon-button date-close" aria-label="Close date range">×</button></header>
|
|
94
94
|
<div class="date-fields"><label>From<input id="from-date" aria-label="From date" autocomplete="off" spellcheck="false" placeholder="YYYY-MM-DD"/></label><span aria-hidden="true">→</span><label>To<input id="to-date" aria-label="To date" autocomplete="off" spellcheck="false" placeholder="YYYY-MM-DD"/></label></div>
|
|
@@ -146,7 +146,7 @@ ${y.output}`:""].filter(Boolean).join(`
|
|
|
146
146
|
<p>Time runs left to right. Each orb travels from session creation to its latest saved message, leaving a trail behind. Select it to explore user and assistant messages in matching colors. Messages without timestamps stay readable in the explorer. Click empty space to deselect. Directory colors group sessions; only fork and child links represent ancestry.</p><button class="secondary-button motion-button" id="motion" aria-pressed="true">${N("sparkles")}Animate map</button></dialog>
|
|
147
147
|
<div id="toast" class="toast" role="status" hidden></div>
|
|
148
148
|
<aside class="shortcut-hints" aria-label="Keyboard shortcuts"><span><kbd>/</kbd>Search</span><span><kbd>F</kbd>Fit view</span><span><kbd>H</kbd>Panels</span><span><kbd>Esc</kbd>Clear selection</span></aside>
|
|
149
|
-
`;Oe();Wd();rm();kg();const Zl=_v(k(".custom-dates"),(e,t)=>{ct=e,lt=t,Ve(!0)},xe),Mt=()=>{const e=!!document.querySelector("dialog[open]");e&&At&&xe(),ee?.setSuspended(e)},bi=new Zg,Ct=zg(k("#tooltip"),k("#scene"),bi),Cr=Kg(k("#inspector"),bi,{select:e=>{Ct.clear(),ee?.selectEvent(e?.id||null),e&&!At&&(oe=1,xn(),ee?.focusEvent(e))}});function wi(e){const t=B?.sessions.find(n=>n.id===j);t&&(Ct.clear(),xe(),ue("inspector",!0),Cr.open(t,e,e?Re?.revision:void 0))}const as=qg({publishing:Lr,change:Tr,getArchived:()=>Yt,changeArchived:e=>{Yt=e,Ve()},visibility:Mt,previewSound:()=>{ir.play("select")},getSources:()=>Ye.sources(),importSources:e=>Ye.select(e),resetPanels:()=>{document.querySelectorAll(".floating-panel").forEach(e=>{e.removeAttribute("style"),delete e.dataset.positioned})}}),ir=new Gg(q,as.audioStatus);function cs(){ee?.applyPreferences(q),ir.configure(q),document.documentElement.dataset.density=q.density,document.documentElement.dataset.motion=String(Lo(q,or.matches)),document.documentElement.style.setProperty("--panel-opacity",`${q.panelOpacity}%`),k("#motion").setAttribute("aria-pressed",String(Lo(q,or.matches)));for(const t of["2d","3d"]){const n=k(`#view-${t}`);n.classList.toggle("active",q.view===t),n.setAttribute("aria-pressed",String(q.view===t))}const e=k("#mute-audio");e.setAttribute("aria-pressed",String(q.muted)),e.setAttribute("aria-label",q.muted?"Unmute sound":"Mute sound"),e.title=q.muted?"Unmute sound":"Mute sound",e.innerHTML=N(q.muted?"volume-x":"volume-2"),as.render(q,Kt||ss,dt?.state||"saved"),Oe()}function Tr(e){const t=e.autoImport!==void 0&&e.autoImport!==q.autoImport;q=Er({...q,...e});try{Kt=sl(localStorage,q)}catch{Kt=!1}cs(),Ei({preferences:{...q},...t?{autoImport:q.autoImport}:{}})}function Ei(e){dt?.save(e)}function qv(){return{sourceID:It,projectID:gt,directory:We,days:at,fromDate:ct,toDate:lt,includeChildren:yn,includeArchived:Yt}}k("#open-settings").addEventListener("click",as.open);k("#mute-audio").addEventListener("click",()=>Tr({muted:!q.muted}));const Gv=()=>cs();or.addEventListener("change",Gv);const Yv=e=>{if(e.key===ai)try{q={...nl(localStorage),autoImport:q.autoImport},cs()}catch{}};window.addEventListener("storage",Yv);cs();dt=new Pg(async e=>{if(!(await fetch("/api/sessiongraph/settings",{method:"POST",headers:{"Content-Type":"application/json","X-SessionGraph-Action":"settings"},body:JSON.stringify(e),signal:AbortSignal.timeout(15e3),keepalive:!0})).ok)throw new Error("Could not save library settings.")},e=>{as.render(q,Kt||ss,e),e==="error"&&mt("Changes applied, but could not save to the local library. Retrying when you return."),e==="saved"&&Ir?.check()});const Jl=Ag(Mt),Ye=Og(e=>Ii(e),Mt,mt);Ir=new Rg({eligible:()=>q.autoImport&&!dt?.pending&&document.visibilityState==="visible"&&!!(B&&!B.onboarding&&B.sources?.some(e=>e.selected)),busy:()=>Ye.busy||!!document.querySelector("dialog[open]"),refresh:()=>Ye.refresh(!0)});const kr=new AbortController,ls=()=>{document.visibilityState==="visible"&&(dt?.state==="error"&&dt.flush(),Ir?.check())};window.addEventListener("focus",ls,{signal:kr.signal});document.addEventListener("visibilitychange",ls,{signal:kr.signal});window.setInterval(ls,Mg);k("#manage-sources").addEventListener("click",()=>{Ye.open()});document.addEventListener("sessiongraph-import-status",e=>{const t=e.detail;Ir?.activity(),as.importStatus(t),B&&(B.importing=t.running),ce.length||Ar(),k("#refresh").classList.toggle("spinning",t.running),k(".connection").title=t.running?`Importing ${Ue(t.source)} · ${t.imported} sessions saved`:t.failed?"Import unavailable · open Manage sources for details":"Local library · SQLite"},{signal:kr.signal});const xi=Kd(Sn,Mt,e=>{Jl.open(e)});k("#search").addEventListener("click",xi.open);function ue(e,t){At&&(e==="timeline"?!t:t)&&xe();const n=k(`#${e}`);n.hidden=!t,k(`#toggle-${e}`).setAttribute("aria-expanded",String(t)),t&&innerWidth<760&&e!=="timeline"&&ue(e==="explorer"?"inspector":"explorer",!1)}ue("explorer",innerWidth>=760);let io=[];for(const e of["explorer","timeline","inspector"])k(`#toggle-${e}`).addEventListener("click",()=>ue(e,k(`#${e}`).hidden));k("#close-explorer").addEventListener("click",()=>{ue("explorer",!1),k("#toggle-explorer").focus()});k("#close-timeline").addEventListener("click",()=>{xe(),ue("timeline",!1),k("#toggle-timeline").focus()});function mt(e){k("#toast").textContent=e,k("#toast").hidden=!1,window.setTimeout(()=>{k("#toast").hidden=!0},3500)}function Si(){ue("inspector",!1),Cr.close(),Ct.clear(),k("#session-inspector").replaceChildren(),k("#toggle-inspector").hidden=!0}Si();async function Kv(){try{const{TimelineScene:e}=await cr(async()=>{const{TimelineScene:t}=await import("./scene-BXs8B_Kk.js");return{TimelineScene:t}},__vite__mapDeps([0,1]));ee=new e(k("#scene"),{onSelect:t=>{t?(ir.play("select"),Sn(t)):Ai()},onPlaybackInterrupt:xe,onEvent:t=>{ir.play("select"),wi(t)},onEventHover:(t,n,s,r)=>{Gn=void 0,t&&j&&Re?Ct.show(t,j,Re.revision,n,s,r):Ct.clear()},onHover:(t,n,s)=>{const r=k("#tooltip");r.classList.contains("message-tooltip")&&(Ct.clear(),Gn=void 0),r.hidden!==!t&&(r.hidden=!t),t&&(Gn!==t.session&&(Gn=t.session,r.innerHTML=`<strong>${X(t.session.title)}</strong><span>${X(Ue(t.session.source))} · ${t.session.activity?.lastMessageAt?`Last message ${vn(t.session.activity.lastMessageAt)}`:"Message time unavailable"}<br>Started ${vn(t.session.created)}</span>`),r.style.left=`${Math.min(n+18,k("#scene").clientWidth-280)}px`,r.style.top=`${Math.max(8,Math.min(s-32,k("#scene").clientHeight-110))}px`)}}),ee.applyPreferences(q),B&&(ee.setGraph(te,!0),j&&(ee.select(j),ee.focus(j)),je&&ee.setFiles(je.files),Re&&ee.setEvents(Re.items))}catch(e){console.error("[sessiongraph] Graphics initialization failed",e),mt("3D requires WebGL. You can still browse sessions in the list.")}finally{Kl=!1,B&&Ar()}}Kv();k("#scene").addEventListener("scene-error",e=>mt(e.detail));async function $i(e,t){const n=AbortSignal.timeout(18e4),s=await fetch(e,{signal:t?AbortSignal.any([t,n]):n}),r=await s.json();if(!s.ok)throw new Error(r.error||"Request failed.");return r}async function Ii(e=!1){const t=k("#refresh");t.disabled=!0,t.classList.add("spinning");try{const n=dt?.revision,s=await $i("/api/sessiongraph"),r=B,o=j?_s.get(j):void 0,i=!!(r&&te.nodes.length);if(B=s,!dt?.pending&&n===dt?.revision){q={...Er(s.preferences||q),autoImport:s.autoImport!==!1};try{Kt=sl(localStorage,q)}catch{Kt=!1}if(!ss){const l=Fg(s.viewState);({sourceID:It,projectID:gt,directory:We,days:at,fromDate:ct,toDate:lt,includeChildren:yn,includeArchived:Yt}=l),k("#children").checked=yn,Ho=JSON.stringify(l),s.preferences||Ei({preferences:{...q}})}cs()}if(ss=!0,k("#connection-label").textContent="Local library",k(".connection").classList.add("connected"),k(".connection").title=`Connected · ${ge(B.sessions.length)} sessions`,r&&JSON.stringify(r.sessions)===JSON.stringify(s.sessions)&&JSON.stringify(r.projects)===JSON.stringify(s.projects)){Ar();return}bi.clear(),_s=new Map(B.sessions.map(l=>[l.id,l])),k("#source").innerHTML='<option value="">All sources</option>'+(B.sources||[]).map(l=>`<option value="${X(l.id)}">${X(l.name)} · ${l.sessions.toLocaleString()}</option>`).join(""),k("#source").value=It,k("#source-filter-icon").innerHTML=ut(It),xi.setData(B);const a=new Map;if(B.sessions.forEach(l=>a.set(l.projectID,(a.get(l.projectID)||0)+1)),k("#project").innerHTML='<option value="">All projects</option>'+[...B.projects].filter(l=>a.has(l.id)).sort((l,c)=>(a.get(c.id)||0)-(a.get(l.id)||0)).map(l=>`<option value="${X(l.id)}">${X(l.name)} · ${ge(a.get(l.id)||0)}</option>`).join(""),k("#project").value=gt,Ci(),j&&!r){const l=B.sessions.find(c=>c.id===j);l&&l.created<Date.now()-at*864e5&&(at=0),l?.archived&&(Yt=!0)}if(Ve(!i,i),j&&!r)Sn(j);else if(j){const l=_s.get(j);if(l&&JSON.stringify(o)!==JSON.stringify(l)){const c=k(".detail-scroll")?.scrollTop||0;je=void 0,Re=void 0,td(l,!1),k(".detail-scroll").scrollTop=c,ar(l.id),Li(l)}}else Si();!e&&B.warnings.length&&mt(B.warnings.join(" ")),!e&&B.onboarding&&Ye.open(!0)}catch(n){if(e&&B){k(".connection").title="Library refresh unavailable · retry with Refresh sessions";return}k("#connection-label").textContent="Connection unavailable",k(".connection").title="Connection unavailable",k(".connection").classList.remove("connected"),k("#graph-message").hidden=!1,k("#graph-message").innerHTML=`${N("terminal")}<h3>Local library unavailable</h3><p>${X(n instanceof Error?n.message:"Unable to connect.")}</p><button class="primary-button" id="retry">Retry ${N("arrow-right")}</button>`,k("#retry").addEventListener("click",()=>{Ii().then(ls)}),B||(k("#session-list").innerHTML='<p class="empty-list">Your sessions will appear here once connected.</p>',k("#list-count").textContent="Offline"),Oe()}finally{t.disabled=!1,t.classList.remove("spinning")}}function Ci(){const e=B?.sessions.filter(s=>!gt||s.projectID===gt)||[],t=[...new Set(e.map(s=>s.directory))].sort((s,r)=>Yn(s).localeCompare(Yn(r))),n=new Set(B?.projects.flatMap(s=>s.worktrees));k("#directory").innerHTML='<option value="">All directories</option>'+t.map(s=>`<option value="${X(s)}">${n.has(s)?"⑂ ":""}${X(Yn(s))}</option>`).join(""),t.includes(We)||(We=""),k("#directory").value=We}function Ve(e=!1,t=!1){if(!B)return;t||(xe(),oe=1,ln=60);const n=k("#session-list").scrollTop,s=document.activeElement?.closest("[data-session]")?.dataset.session,r=Date.now(),o=ct?new Date(`${ct}T00:00:00`).getTime():at?r-at*864e5:0,i=lt?new Date(`${lt}T23:59:59.999`).getTime():1/0;ce=B.sessions.filter(c=>Ug(c,It)&&(!gt||c.projectID===gt)&&(!We||c.directory===We)&&(yn||!c.parentID||!!c.forkID)&&(Yt||!c.archived)&&c.created>=o&&c.created<=i),vi=[...ce].sort((c,f)=>dn(f)-dn(c)),Gl=new Set(ce.map(c=>c.id)),xi.setScope(ce.map(c=>c.id)),te=jd(ce,B.projects,t?te:void 0),Yl=new Map(te.nodes.map(c=>[c.session.id,c.color])),ee?.setCutoff(oe),ee?.setGraph(te,e,t),Ar(),document.querySelectorAll("[data-days]").forEach(c=>c.classList.toggle("active",!ct&&!lt&&Number(c.dataset.days)===at)),ki(),t&&(k("#session-list").scrollTop=n,s&&ns.get(s)?.focus({preventScroll:!0})),zv(),j&&!ce.some(c=>c.id===j)?Ai():j&&je&&ee?.setFiles(je.files),j&&Re&&ee?.setEvents(Re.items),Oe();const a=qv(),l=JSON.stringify(a);ss&&l!==Ho&&(Ho=l,Ei({viewState:a}))}function Ar(){Ti();const e=k("#graph-message");e.hidden=!!(ce.length&&ee),ce.length?ee||(e.innerHTML=Kl?"<h3>Preparing the map…</h3>":`${N("box")}<h3>WebGL is unavailable.</h3><p>You can explore every session and its file details in the list.</p>`):e.innerHTML=B?.importing?'<div class="loading-orbit"><span></span><span></span><span></span></div><h3>Importing your sessions…</h3><p>Your map will appear when the import finishes.</p>':B&&!B.sessions.length?`${N("folder")}<h3>Your map starts here</h3><p>Choose a source with saved conversations to get started.</p><button class="primary-button" id="empty-sources">Choose sources ${N("arrow-right")}</button>`:`${N("search")}<h3>No matching sessions</h3><button class="text-button" id="clear-filters">Reset filters ${N("rotate-ccw")}</button>`,k("#clear-filters")?.addEventListener("click",()=>Xl()),k("#empty-sources")?.addEventListener("click",()=>{Ye.open()}),Oe()}function Ti(e=!1){const t=!!(ce.length&&ee);(e||!t)&&(window.clearTimeout(Nn),Nn=0,Fn=!1),k(".playback-share").classList.toggle("ready",Fn&&t),k("#share-playback").disabled=!Fn||!t,t&&!Fn&&!Nn&&(Nn=window.setTimeout(()=>{Nn=0,Fn=!0,Ti()},1e3))}function Xl(e){It="",k("#source").value="",k("#source-filter-icon").innerHTML=ut(),gt="",We="",at=0,ct="",lt="",yn=!0,Yt=e?.archived===!0,k("#project").value="",k("#children").checked=!0,Zl.setRange("",""),Ci(),Ve(!0)}function ki(){k("#list-count").textContent=ge(ce.length);const e=vi;let t="";k("#session-list").innerHTML=e.slice(0,ln).map(n=>{const s=dn(n),r=mn(s),o=r!==t?`<div class="list-date">${r}<span>${new Date(s).getFullYear()}</span></div>`:"";return t=r,`${o}<button class="session-card ${j===n.id?"selected":""}" data-session="${X(n.id)}" aria-pressed="${j===n.id}" title="${X(n.title)}"><span class="session-dot" style="--node-color:${Yl.get(n.id)}"></span><span class="session-card-body"><span class="session-title">${X(n.title)}</span><span class="session-meta">${n.forkID?N("git-fork"):n.parentID?N("network"):""}<span class="source-badge" data-source="${X(n.source||"opencode")}">${ut(n.source)}${X(Ue(n.source))}</span><span title="${n.activity?.lastMessageAt?"Latest saved message":"Session created; message time unavailable"}">${Uv.format(s)}</span></span></span></button>`}).join("")+(e.length>ln?`<button id="more-sessions" class="load-more">Show more sessions ${N("chevron-down")}</button>`:e.length?"":'<p class="empty-list">No sessions match your filters.</p>'),k("#more-sessions")?.addEventListener("click",()=>{ln+=100;const n=k("#session-list").scrollTop;ki(),k("#session-list").scrollTop=n,Oe()}),ns=new Map([...k("#session-list").querySelectorAll(".session-card")].map(n=>[n.dataset.session,n])),Oe()}function Ql(e){for(const t of[e,j]){const n=t?ns.get(t):void 0;n&&(n.classList.toggle("selected",t===j),n.setAttribute("aria-pressed",String(t===j)))}}function zv(){Je=Qc(ce),zl=tl(ce),Fo="";const e=Wg(ce.map(dn),te.start,te.end),t=Math.max(...e,1);k("#histogram").innerHTML=e.map(n=>`<span style="height:${Math.max(4,n/t*100)}%;opacity:${n?.8:.15}" title="${n} session endpoints"></span>`).join(""),k("#date-label").textContent=te.start?`${mn(te.start,new Date(te.start).getFullYear()!==new Date(te.end).getFullYear())} — ${mn(te.end,!0)}`:"No sessions",te.start&&Zl.setRange(ct||za(te.start),lt||za(te.end)),xn()}function xn(){k("#scrubber").value=String(Math.round(oe*1e3)),k("#timeline-cursor").style.left=`${oe*100}%`,k("#histogram").style.setProperty("--progress",`${oe*100}%`);const e=te.start+(te.end-te.start)*oe;k("#playback-date").textContent=te.start?mn(e,new Date(te.start).getFullYear()!==new Date(te.end).getFullYear()):"—";const t=te.nodes.length?jg(e,te.end-te.start):"—";k("#playback-period").textContent!==t&&(k("#playback-period").textContent=t);const n=Je.at(e,oe>=1),s=zl(e,oe>=1),r=`${n.tokens}:${n.sessions}:${s}`;r!==Fo&&(Fo=r,k("#playback-summary").hidden=ce.length===0,k("#playback-sessions").textContent=ge(s),k("#playback-tokens").textContent=Je.recorded?ql(n.tokens):"—",k("#playback-token-coverage").textContent=Je.recorded?`${ge(n.sessions)} / ${ge(Je.recorded)} with recorded usage`:"Usage unavailable",k("#playback-summary").title=`${ge(s)} sessions started. ${Je.recorded?`${ge(n.tokens)} burnt tokens`:"Token usage unavailable"}. Token totals are added at the latest saved message, including cache where reported. ${ge(Je.missing)} sessions have no supported recorded count.${Je.untimed?` ${ge(Je.untimed)} totals have no message timestamp and are included only at the end.`:""}`),ee?.setCutoff(oe)}function xe(){if(At=!1,Zn=0,k("#app").classList.remove("playback-mode"),Ws){const e=Ws;Ws=void 0,ue("explorer",e.explorer),ue("inspector",e.inspector&&!!j)}ee?.setPlaying(!1),cancelAnimationFrame(yi),k("#play").innerHTML=N("play"),k("#play").setAttribute("aria-label","Play timeline"),Oe()}function ed(e){if(!At)return;const t=Math.max(0,e-rr);rr=e,document.hidden||(oe<1?oe=Math.min(1,oe+t*q.playbackSpeed/oi):Zn+=t),xn(),ee?.setPlaybackOutro(oe>=1?Math.min(1,Zn/tr):null),oe>=1&&Zn>=tr+el?xe():yi=requestAnimationFrame(ed)}function Ai(){const e=j;Vo?.abort(),No?.abort(),k("#file-legend").hidden=!0,js++,Bs++,j=null,je=void 0,Re=void 0,ee?.select(null),history.replaceState(null,"",location.pathname),Si(),Ql(e)}function Zv(e){const t=e.forkID?[{id:e.forkID,label:"Forked from",kind:"git-fork"}]:e.parentID?[{id:e.parentID,label:"Parent",kind:"network"}]:[],n=B.sessions.filter(r=>r.forkID===e.id||!r.forkID&&r.parentID===e.id),s=[...t,...n.map(r=>({id:r.id,label:r.forkID?"Fork":"Child",kind:r.forkID?"git-fork":"network"}))];return s.length?`<section class="detail-section"><div class="section-label">Connections<span>${s.length}</span></div>${s.map(r=>{const o=B.sessions.find(i=>i.id===r.id);return`<button class="relation" data-related="${X(r.id)}" ${o?"":"disabled"}>${N(r.kind)}<span><small>${r.label}</small><strong>${X(o?.title||"Session no longer available")}</strong></span>${N("arrow-up-right")}</button>`}).join("")}</section>`:""}function td(e,t=!0){const n=B.projects.find(o=>o.id===e.projectID),s=e.forkID?"Fork":e.parentID?"Child session":"Session",r=n?.worktrees.includes(e.directory);k("#session-inspector").innerHTML=`
|
|
149
|
+
`;Oe();Wd();rm();kg();const Zl=_v(k(".custom-dates"),(e,t)=>{ct=e,lt=t,Ve(!0)},xe),Mt=()=>{const e=!!document.querySelector("dialog[open]");e&&At&&xe(),ee?.setSuspended(e)},bi=new Zg,Ct=zg(k("#tooltip"),k("#scene"),bi),Cr=Kg(k("#inspector"),bi,{select:e=>{Ct.clear(),ee?.selectEvent(e?.id||null),e&&!At&&(oe=1,xn(),ee?.focusEvent(e))}});function wi(e){const t=B?.sessions.find(n=>n.id===j);t&&(Ct.clear(),xe(),ue("inspector",!0),Cr.open(t,e,e?Re?.revision:void 0))}const as=qg({publishing:Lr,change:Tr,getArchived:()=>Yt,changeArchived:e=>{Yt=e,Ve()},visibility:Mt,previewSound:()=>{ir.play("select")},getSources:()=>Ye.sources(),importSources:e=>Ye.select(e),resetPanels:()=>{document.querySelectorAll(".floating-panel").forEach(e=>{e.removeAttribute("style"),delete e.dataset.positioned})}}),ir=new Gg(q,as.audioStatus);function cs(){ee?.applyPreferences(q),ir.configure(q),document.documentElement.dataset.density=q.density,document.documentElement.dataset.motion=String(Lo(q,or.matches)),document.documentElement.style.setProperty("--panel-opacity",`${q.panelOpacity}%`),k("#motion").setAttribute("aria-pressed",String(Lo(q,or.matches)));for(const t of["2d","3d"]){const n=k(`#view-${t}`);n.classList.toggle("active",q.view===t),n.setAttribute("aria-pressed",String(q.view===t))}const e=k("#mute-audio");e.setAttribute("aria-pressed",String(q.muted)),e.setAttribute("aria-label",q.muted?"Unmute sound":"Mute sound"),e.title=q.muted?"Unmute sound":"Mute sound",e.innerHTML=N(q.muted?"volume-x":"volume-2"),as.render(q,Kt||ss,dt?.state||"saved"),Oe()}function Tr(e){const t=e.autoImport!==void 0&&e.autoImport!==q.autoImport;q=Er({...q,...e});try{Kt=sl(localStorage,q)}catch{Kt=!1}cs(),Ei({preferences:{...q},...t?{autoImport:q.autoImport}:{}})}function Ei(e){dt?.save(e)}function qv(){return{sourceID:It,projectID:gt,directory:We,days:at,fromDate:ct,toDate:lt,includeChildren:yn,includeArchived:Yt}}k("#open-settings").addEventListener("click",as.open);k("#mute-audio").addEventListener("click",()=>Tr({muted:!q.muted}));const Gv=()=>cs();or.addEventListener("change",Gv);const Yv=e=>{if(e.key===ai)try{q={...nl(localStorage),autoImport:q.autoImport},cs()}catch{}};window.addEventListener("storage",Yv);cs();dt=new Pg(async e=>{if(!(await fetch("/api/sessiongraph/settings",{method:"POST",headers:{"Content-Type":"application/json","X-SessionGraph-Action":"settings"},body:JSON.stringify(e),signal:AbortSignal.timeout(15e3),keepalive:!0})).ok)throw new Error("Could not save library settings.")},e=>{as.render(q,Kt||ss,e),e==="error"&&mt("Changes applied, but could not save to the local library. Retrying when you return."),e==="saved"&&Ir?.check()});const Jl=Ag(Mt),Ye=Og(e=>Ii(e),Mt,mt);Ir=new Rg({eligible:()=>q.autoImport&&!dt?.pending&&document.visibilityState==="visible"&&!!(B&&!B.onboarding&&B.sources?.some(e=>e.selected)),busy:()=>Ye.busy||!!document.querySelector("dialog[open]"),refresh:()=>Ye.refresh(!0)});const kr=new AbortController,ls=()=>{document.visibilityState==="visible"&&(dt?.state==="error"&&dt.flush(),Ir?.check())};window.addEventListener("focus",ls,{signal:kr.signal});document.addEventListener("visibilitychange",ls,{signal:kr.signal});window.setInterval(ls,Mg);k("#manage-sources").addEventListener("click",()=>{Ye.open()});document.addEventListener("sessiongraph-import-status",e=>{const t=e.detail;Ir?.activity(),as.importStatus(t),B&&(B.importing=t.running),ce.length||Ar(),k("#refresh").classList.toggle("spinning",t.running),k(".connection").title=t.running?`Importing ${Ue(t.source)} · ${t.imported} sessions saved`:t.failed?"Import unavailable · open Manage sources for details":"Local library · SQLite"},{signal:kr.signal});const xi=Kd(Sn,Mt,e=>{Jl.open(e)});k("#search").addEventListener("click",xi.open);function ue(e,t){At&&(e==="timeline"?!t:t)&&xe();const n=k(`#${e}`);n.hidden=!t,k(`#toggle-${e}`).setAttribute("aria-expanded",String(t)),t&&innerWidth<760&&e!=="timeline"&&ue(e==="explorer"?"inspector":"explorer",!1)}ue("explorer",innerWidth>=760);let io=[];for(const e of["explorer","timeline","inspector"])k(`#toggle-${e}`).addEventListener("click",()=>ue(e,k(`#${e}`).hidden));k("#close-explorer").addEventListener("click",()=>{ue("explorer",!1),k("#toggle-explorer").focus()});k("#close-timeline").addEventListener("click",()=>{xe(),ue("timeline",!1),k("#toggle-timeline").focus()});function mt(e){k("#toast").textContent=e,k("#toast").hidden=!1,window.setTimeout(()=>{k("#toast").hidden=!0},3500)}function Si(){ue("inspector",!1),Cr.close(),Ct.clear(),k("#session-inspector").replaceChildren(),k("#toggle-inspector").hidden=!0}Si();async function Kv(){try{const{TimelineScene:e}=await cr(async()=>{const{TimelineScene:t}=await import("./scene-KCDTPCOD.js");return{TimelineScene:t}},__vite__mapDeps([0,1]));ee=new e(k("#scene"),{onSelect:t=>{t?(ir.play("select"),Sn(t)):Ai()},onPlaybackInterrupt:xe,onEvent:t=>{ir.play("select"),wi(t)},onEventHover:(t,n,s,r)=>{Gn=void 0,t&&j&&Re?Ct.show(t,j,Re.revision,n,s,r):Ct.clear()},onHover:(t,n,s)=>{const r=k("#tooltip");r.classList.contains("message-tooltip")&&(Ct.clear(),Gn=void 0),r.hidden!==!t&&(r.hidden=!t),t&&(Gn!==t.session&&(Gn=t.session,r.innerHTML=`<strong>${X(t.session.title)}</strong><span>${X(Ue(t.session.source))} · ${t.session.activity?.lastMessageAt?`Last message ${vn(t.session.activity.lastMessageAt)}`:"Message time unavailable"}<br>Started ${vn(t.session.created)}</span>`),r.style.left=`${Math.min(n+18,k("#scene").clientWidth-280)}px`,r.style.top=`${Math.max(8,Math.min(s-32,k("#scene").clientHeight-110))}px`)}}),ee.applyPreferences(q),B&&(ee.setGraph(te,!0),j&&(ee.select(j),ee.focus(j)),je&&ee.setFiles(je.files),Re&&ee.setEvents(Re.items))}catch(e){console.error("[sessiongraph] Graphics initialization failed",e),mt("3D requires WebGL. You can still browse sessions in the list.")}finally{Kl=!1,B&&Ar()}}Kv();k("#scene").addEventListener("scene-error",e=>mt(e.detail));async function $i(e,t){const n=AbortSignal.timeout(18e4),s=await fetch(e,{signal:t?AbortSignal.any([t,n]):n}),r=await s.json();if(!s.ok)throw new Error(r.error||"Request failed.");return r}async function Ii(e=!1){const t=k("#refresh");t.disabled=!0,t.classList.add("spinning");try{const n=dt?.revision,s=await $i("/api/sessiongraph"),r=B,o=j?_s.get(j):void 0,i=!!(r&&te.nodes.length);if(B=s,!dt?.pending&&n===dt?.revision){q={...Er(s.preferences||q),autoImport:s.autoImport!==!1};try{Kt=sl(localStorage,q)}catch{Kt=!1}if(!ss){const l=Fg(s.viewState);({sourceID:It,projectID:gt,directory:We,days:at,fromDate:ct,toDate:lt,includeChildren:yn,includeArchived:Yt}=l),k("#children").checked=yn,Ho=JSON.stringify(l),s.preferences||Ei({preferences:{...q}})}cs()}if(ss=!0,k("#connection-label").textContent="Local library",k(".connection").classList.add("connected"),k(".connection").title=`Connected · ${ge(B.sessions.length)} sessions`,r&&JSON.stringify(r.sessions)===JSON.stringify(s.sessions)&&JSON.stringify(r.projects)===JSON.stringify(s.projects)){Ar();return}bi.clear(),_s=new Map(B.sessions.map(l=>[l.id,l])),k("#source").innerHTML='<option value="">All sources</option>'+(B.sources||[]).map(l=>`<option value="${X(l.id)}">${X(l.name)} · ${l.sessions.toLocaleString()}</option>`).join(""),k("#source").value=It,k("#source-filter-icon").innerHTML=ut(It),xi.setData(B);const a=new Map;if(B.sessions.forEach(l=>a.set(l.projectID,(a.get(l.projectID)||0)+1)),k("#project").innerHTML='<option value="">All projects</option>'+[...B.projects].filter(l=>a.has(l.id)).sort((l,c)=>(a.get(c.id)||0)-(a.get(l.id)||0)).map(l=>`<option value="${X(l.id)}">${X(l.name)} · ${ge(a.get(l.id)||0)}</option>`).join(""),k("#project").value=gt,Ci(),j&&!r){const l=B.sessions.find(c=>c.id===j);l&&l.created<Date.now()-at*864e5&&(at=0),l?.archived&&(Yt=!0)}if(Ve(!i,i),j&&!r)Sn(j);else if(j){const l=_s.get(j);if(l&&JSON.stringify(o)!==JSON.stringify(l)){const c=k(".detail-scroll")?.scrollTop||0;je=void 0,Re=void 0,td(l,!1),k(".detail-scroll").scrollTop=c,ar(l.id),Li(l)}}else Si();!e&&B.warnings.length&&mt(B.warnings.join(" ")),!e&&B.onboarding&&Ye.open(!0)}catch(n){if(e&&B){k(".connection").title="Library refresh unavailable · retry with Refresh sessions";return}k("#connection-label").textContent="Connection unavailable",k(".connection").title="Connection unavailable",k(".connection").classList.remove("connected"),k("#graph-message").hidden=!1,k("#graph-message").innerHTML=`${N("terminal")}<h3>Local library unavailable</h3><p>${X(n instanceof Error?n.message:"Unable to connect.")}</p><button class="primary-button" id="retry">Retry ${N("arrow-right")}</button>`,k("#retry").addEventListener("click",()=>{Ii().then(ls)}),B||(k("#session-list").innerHTML='<p class="empty-list">Your sessions will appear here once connected.</p>',k("#list-count").textContent="Offline"),Oe()}finally{t.disabled=!1,t.classList.remove("spinning")}}function Ci(){const e=B?.sessions.filter(s=>!gt||s.projectID===gt)||[],t=[...new Set(e.map(s=>s.directory))].sort((s,r)=>Yn(s).localeCompare(Yn(r))),n=new Set(B?.projects.flatMap(s=>s.worktrees));k("#directory").innerHTML='<option value="">All directories</option>'+t.map(s=>`<option value="${X(s)}">${n.has(s)?"⑂ ":""}${X(Yn(s))}</option>`).join(""),t.includes(We)||(We=""),k("#directory").value=We}function Ve(e=!1,t=!1){if(!B)return;t||(xe(),oe=1,ln=60);const n=k("#session-list").scrollTop,s=document.activeElement?.closest("[data-session]")?.dataset.session,r=Date.now(),o=ct?new Date(`${ct}T00:00:00`).getTime():at?r-at*864e5:0,i=lt?new Date(`${lt}T23:59:59.999`).getTime():1/0;ce=B.sessions.filter(c=>Ug(c,It)&&(!gt||c.projectID===gt)&&(!We||c.directory===We)&&(yn||!c.parentID||!!c.forkID)&&(Yt||!c.archived)&&c.created>=o&&c.created<=i),vi=[...ce].sort((c,f)=>dn(f)-dn(c)),Gl=new Set(ce.map(c=>c.id)),xi.setScope(ce.map(c=>c.id)),te=jd(ce,B.projects,t?te:void 0),Yl=new Map(te.nodes.map(c=>[c.session.id,c.color])),ee?.setCutoff(oe),ee?.setGraph(te,e,t),Ar(),document.querySelectorAll("[data-days]").forEach(c=>c.classList.toggle("active",!ct&&!lt&&Number(c.dataset.days)===at)),ki(),t&&(k("#session-list").scrollTop=n,s&&ns.get(s)?.focus({preventScroll:!0})),zv(),j&&!ce.some(c=>c.id===j)?Ai():j&&je&&ee?.setFiles(je.files),j&&Re&&ee?.setEvents(Re.items),Oe();const a=qv(),l=JSON.stringify(a);ss&&l!==Ho&&(Ho=l,Ei({viewState:a}))}function Ar(){Ti();const e=k("#graph-message");e.hidden=!!(ce.length&&ee),ce.length?ee||(e.innerHTML=Kl?"<h3>Preparing the map…</h3>":`${N("box")}<h3>WebGL is unavailable.</h3><p>You can explore every session and its file details in the list.</p>`):e.innerHTML=B?.importing?'<div class="loading-orbit"><span></span><span></span><span></span></div><h3>Importing your sessions…</h3><p>Your map will appear when the import finishes.</p>':B&&!B.sessions.length?`${N("folder")}<h3>Your map starts here</h3><p>Choose a source with saved conversations to get started.</p><button class="primary-button" id="empty-sources">Choose sources ${N("arrow-right")}</button>`:`${N("search")}<h3>No matching sessions</h3><button class="text-button" id="clear-filters">Reset filters ${N("rotate-ccw")}</button>`,k("#clear-filters")?.addEventListener("click",()=>Xl()),k("#empty-sources")?.addEventListener("click",()=>{Ye.open()}),Oe()}function Ti(e=!1){const t=!!(ce.length&&ee);(e||!t)&&(window.clearTimeout(Nn),Nn=0,Fn=!1),k(".playback-share").classList.toggle("ready",Fn&&t),k("#share-playback").disabled=!Fn||!t,t&&!Fn&&!Nn&&(Nn=window.setTimeout(()=>{Nn=0,Fn=!0,Ti()},1e3))}function Xl(e){It="",k("#source").value="",k("#source-filter-icon").innerHTML=ut(),gt="",We="",at=0,ct="",lt="",yn=!0,Yt=e?.archived===!0,k("#project").value="",k("#children").checked=!0,Zl.setRange("",""),Ci(),Ve(!0)}function ki(){k("#list-count").textContent=ge(ce.length);const e=vi;let t="";k("#session-list").innerHTML=e.slice(0,ln).map(n=>{const s=dn(n),r=mn(s),o=r!==t?`<div class="list-date">${r}<span>${new Date(s).getFullYear()}</span></div>`:"";return t=r,`${o}<button class="session-card ${j===n.id?"selected":""}" data-session="${X(n.id)}" aria-pressed="${j===n.id}" title="${X(n.title)}"><span class="session-dot" style="--node-color:${Yl.get(n.id)}"></span><span class="session-card-body"><span class="session-title">${X(n.title)}</span><span class="session-meta">${n.forkID?N("git-fork"):n.parentID?N("network"):""}<span class="source-badge" data-source="${X(n.source||"opencode")}">${ut(n.source)}${X(Ue(n.source))}</span><span title="${n.activity?.lastMessageAt?"Latest saved message":"Session created; message time unavailable"}">${Uv.format(s)}</span></span></span></button>`}).join("")+(e.length>ln?`<button id="more-sessions" class="load-more">Show more sessions ${N("chevron-down")}</button>`:e.length?"":'<p class="empty-list">No sessions match your filters.</p>'),k("#more-sessions")?.addEventListener("click",()=>{ln+=100;const n=k("#session-list").scrollTop;ki(),k("#session-list").scrollTop=n,Oe()}),ns=new Map([...k("#session-list").querySelectorAll(".session-card")].map(n=>[n.dataset.session,n])),Oe()}function Ql(e){for(const t of[e,j]){const n=t?ns.get(t):void 0;n&&(n.classList.toggle("selected",t===j),n.setAttribute("aria-pressed",String(t===j)))}}function zv(){Je=Qc(ce),zl=tl(ce),Fo="";const e=Wg(ce.map(dn),te.start,te.end),t=Math.max(...e,1);k("#histogram").innerHTML=e.map(n=>`<span style="height:${Math.max(4,n/t*100)}%;opacity:${n?.8:.15}" title="${n} session endpoints"></span>`).join(""),k("#date-label").textContent=te.start?`${mn(te.start,new Date(te.start).getFullYear()!==new Date(te.end).getFullYear())} — ${mn(te.end,!0)}`:"No sessions",te.start&&Zl.setRange(ct||za(te.start),lt||za(te.end)),xn()}function xn(){k("#scrubber").value=String(Math.round(oe*1e3)),k("#timeline-cursor").style.left=`${oe*100}%`,k("#histogram").style.setProperty("--progress",`${oe*100}%`);const e=te.start+(te.end-te.start)*oe;k("#playback-date").textContent=te.start?mn(e,new Date(te.start).getFullYear()!==new Date(te.end).getFullYear()):"—";const t=te.nodes.length?jg(e,te.end-te.start):"—";k("#playback-period").textContent!==t&&(k("#playback-period").textContent=t);const n=Je.at(e,oe>=1),s=zl(e,oe>=1),r=`${n.tokens}:${n.sessions}:${s}`;r!==Fo&&(Fo=r,k("#playback-summary").hidden=ce.length===0,k("#playback-sessions").textContent=ge(s),k("#playback-tokens").textContent=Je.recorded?ql(n.tokens):"—",k("#playback-token-coverage").textContent=Je.recorded?`${ge(n.sessions)} / ${ge(Je.recorded)} with recorded usage`:"Usage unavailable",k("#playback-summary").title=`${ge(s)} sessions started. ${Je.recorded?`${ge(n.tokens)} burnt tokens`:"Token usage unavailable"}. Token totals are added at the latest saved message, including cache where reported. ${ge(Je.missing)} sessions have no supported recorded count.${Je.untimed?` ${ge(Je.untimed)} totals have no message timestamp and are included only at the end.`:""}`),ee?.setCutoff(oe)}function xe(){if(At=!1,Zn=0,k("#app").classList.remove("playback-mode"),Ws){const e=Ws;Ws=void 0,ue("explorer",e.explorer),ue("inspector",e.inspector&&!!j)}ee?.setPlaying(!1),cancelAnimationFrame(yi),k("#play").innerHTML=N("play"),k("#play").setAttribute("aria-label","Play timeline"),Oe()}function ed(e){if(!At)return;const t=Math.max(0,e-rr);rr=e,document.hidden||(oe<1?oe=Math.min(1,oe+t*q.playbackSpeed/oi):Zn+=t),xn(),ee?.setPlaybackOutro(oe>=1?Math.min(1,Zn/tr):null),oe>=1&&Zn>=tr+el?xe():yi=requestAnimationFrame(ed)}function Ai(){const e=j;Vo?.abort(),No?.abort(),k("#file-legend").hidden=!0,js++,Bs++,j=null,je=void 0,Re=void 0,ee?.select(null),history.replaceState(null,"",location.pathname),Si(),Ql(e)}function Zv(e){const t=e.forkID?[{id:e.forkID,label:"Forked from",kind:"git-fork"}]:e.parentID?[{id:e.parentID,label:"Parent",kind:"network"}]:[],n=B.sessions.filter(r=>r.forkID===e.id||!r.forkID&&r.parentID===e.id),s=[...t,...n.map(r=>({id:r.id,label:r.forkID?"Fork":"Child",kind:r.forkID?"git-fork":"network"}))];return s.length?`<section class="detail-section"><div class="section-label">Connections<span>${s.length}</span></div>${s.map(r=>{const o=B.sessions.find(i=>i.id===r.id);return`<button class="relation" data-related="${X(r.id)}" ${o?"":"disabled"}>${N(r.kind)}<span><small>${r.label}</small><strong>${X(o?.title||"Session no longer available")}</strong></span>${N("arrow-up-right")}</button>`}).join("")}</section>`:""}function td(e,t=!0){const n=B.projects.find(o=>o.id===e.projectID),s=e.forkID?"Fork":e.parentID?"Child session":"Session",r=n?.worktrees.includes(e.directory);k("#session-inspector").innerHTML=`
|
|
150
150
|
<div class="panel-heading"><button class="panel-handle" data-drag-panel="inspector" aria-label="Move session details panel" title="Drag to move · Arrow keys to reposition">${N("grip")}<span>${s}</span></button><button id="close-inspector" class="icon-button" aria-label="Close session details">${N("x")}</button></div>
|
|
151
151
|
<div class="detail-scroll">
|
|
152
152
|
<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>
|
|
@@ -166,4 +166,4 @@ ${y.output}`:""].filter(Boolean).join(`
|
|
|
166
166
|
${e.nextCursor?'<p class="coverage-note" id="history-loading" role="status">Loading full history…</p>':""}</section>
|
|
167
167
|
${e.locations.length?`<details class="more-details detail-section"><summary>Directory moves ${N("chevron-down")}</summary>${e.locations.map(n=>`<div class="location-entry"><span>${vn(n.time)}</span><code>${X(n.directory)}</code></div>`).join("")}</details>`:""}
|
|
168
168
|
${e.tools.length?`<details class="more-details detail-section"><summary>Tools used <span>${ge(e.tools.reduce((n,s)=>n+s.count,0))}</span>${N("chevron-down")}</summary><div class="tools-list">${e.tools.slice(0,12).map(n=>`<div><span>${X(n.name)}</span><strong>${n.count}</strong></div>`).join("")}</div></details>`:""}
|
|
169
|
-
`,ee?.setFiles(t),Oe()}async function ar(e){const t=++js;Vo?.abort();const n=new AbortController;Vo=n;let s,r;const o=new Set;try{do{const i=await $i(`/api/sessiongraph/session/${encodeURIComponent(e)}${s?`?cursor=${encodeURIComponent(s)}`:""}`,n.signal);if(n.signal.aborted||t!==js||j!==e)return;if(r&&i.revision!==r.revision)throw new Error("History changed. Retry to load the latest version.");if(r=r?Jv(r,i):i,je=r,!s||!i.nextCursor?Za(r):k("#history-loading")&&(k("#history-loading").textContent=`Loading full history… ${ge(r.messagesScanned)} messages`),s=i.nextCursor||void 0,s&&o.has(s))throw new Error("History could not be loaded. Please retry.");s&&o.add(s)}while(s)}catch(i){if(n.signal.aborted||t!==js||j!==e)return;if(je){Za(je);const a=k("#history-loading");a&&(a.innerHTML='History loading interrupted. <button class="text-button" id="retry-detail">Retry</button>'),k("#retry-detail")?.addEventListener("click",()=>{ar(e)})}else k("#file-detail").innerHTML=`<section class="detail-section"><div class="section-label">Changed files</div><p class="coverage-note">${X(i instanceof Error?i.message:"Details unavailable.")}</p><button class="load-more" id="retry-detail">Retry file details</button></section>`,k("#retry-detail").addEventListener("click",()=>ar(e))}}function Sn(e){const t=_s.get(e);if(!t)return;const n=j;Cr.close(),Ct.clear(),Gl.has(e)||Xl(t),xe(),oe=1,xn(),j=e,je=void 0,Re=void 0,k("#file-legend").hidden=!0,history.replaceState(null,"",`?session=${encodeURIComponent(e)}`),ee?.select(e),td(t),ee?.focus(e),Ql(n),ar(e),Li(t,!0)}k("#session-list").addEventListener("click",e=>{const t=e.target.closest("[data-session]");t?.dataset.session&&Sn(t.dataset.session)});k("#inspector").addEventListener("click",e=>{const t=e.target.closest("[data-related]");t?.dataset.related&&Sn(t.dataset.related)});k("#project").addEventListener("change",e=>{gt=e.target.value,We="",Ci(),Ve(!0)});k("#source").addEventListener("change",e=>{It=e.target.value,k("#source-filter-icon").innerHTML=ut(It),Ve(!0)});k("#directory").addEventListener("change",e=>{We=e.target.value,Ve(!0)});k("#children").addEventListener("change",e=>{yn=e.target.checked,Ve()});document.querySelectorAll("[data-days]").forEach(e=>e.addEventListener("click",()=>{at=Number(e.dataset.days),ct="",lt="",Ve(!0)}));k("#reset-camera").addEventListener("click",()=>Ve(!0));k("#refresh").addEventListener("click",()=>{B?.onboarding?Ye.open(!0):Ye.refresh()});k("#scrubber").addEventListener("input",e=>{xe(),oe=Number(e.target.value)/1e3,xn()});k("#play").addEventListener("click",()=>{if(ce.length){if(At)return xe();oe>=1&&(oe=0),xn(),Ws={explorer:!k("#explorer").hidden,inspector:!k("#inspector").hidden},ue("explorer",!1),ue("inspector",!1),ue("timeline",!0),Ct.clear(),Gn=void 0,k("#app").classList.add("playback-mode"),Ti(!0),At=!0,Zn=0,ee?.setPlaying(!0),rr=performance.now(),k("#play").innerHTML=N("pause"),k("#play").setAttribute("aria-label","Pause timeline"),Oe(),yi=requestAnimationFrame(ed)}});document.addEventListener("visibilitychange",()=>{rr=performance.now()},{signal:kr.signal});async function Xv(){const e=k("#share-playback");e.disabled=!0;try{if(!ro){const{createPlaybackShare:t}=await cr(async()=>{const{createPlaybackShare:n}=await import("./share-
|
|
169
|
+
`,ee?.setFiles(t),Oe()}async function ar(e){const t=++js;Vo?.abort();const n=new AbortController;Vo=n;let s,r;const o=new Set;try{do{const i=await $i(`/api/sessiongraph/session/${encodeURIComponent(e)}${s?`?cursor=${encodeURIComponent(s)}`:""}`,n.signal);if(n.signal.aborted||t!==js||j!==e)return;if(r&&i.revision!==r.revision)throw new Error("History changed. Retry to load the latest version.");if(r=r?Jv(r,i):i,je=r,!s||!i.nextCursor?Za(r):k("#history-loading")&&(k("#history-loading").textContent=`Loading full history… ${ge(r.messagesScanned)} messages`),s=i.nextCursor||void 0,s&&o.has(s))throw new Error("History could not be loaded. Please retry.");s&&o.add(s)}while(s)}catch(i){if(n.signal.aborted||t!==js||j!==e)return;if(je){Za(je);const a=k("#history-loading");a&&(a.innerHTML='History loading interrupted. <button class="text-button" id="retry-detail">Retry</button>'),k("#retry-detail")?.addEventListener("click",()=>{ar(e)})}else k("#file-detail").innerHTML=`<section class="detail-section"><div class="section-label">Changed files</div><p class="coverage-note">${X(i instanceof Error?i.message:"Details unavailable.")}</p><button class="load-more" id="retry-detail">Retry file details</button></section>`,k("#retry-detail").addEventListener("click",()=>ar(e))}}function Sn(e){const t=_s.get(e);if(!t)return;const n=j;Cr.close(),Ct.clear(),Gl.has(e)||Xl(t),xe(),oe=1,xn(),j=e,je=void 0,Re=void 0,k("#file-legend").hidden=!0,history.replaceState(null,"",`?session=${encodeURIComponent(e)}`),ee?.select(e),td(t),ee?.focus(e),Ql(n),ar(e),Li(t,!0)}k("#session-list").addEventListener("click",e=>{const t=e.target.closest("[data-session]");t?.dataset.session&&Sn(t.dataset.session)});k("#inspector").addEventListener("click",e=>{const t=e.target.closest("[data-related]");t?.dataset.related&&Sn(t.dataset.related)});k("#project").addEventListener("change",e=>{gt=e.target.value,We="",Ci(),Ve(!0)});k("#source").addEventListener("change",e=>{It=e.target.value,k("#source-filter-icon").innerHTML=ut(It),Ve(!0)});k("#directory").addEventListener("change",e=>{We=e.target.value,Ve(!0)});k("#children").addEventListener("change",e=>{yn=e.target.checked,Ve()});document.querySelectorAll("[data-days]").forEach(e=>e.addEventListener("click",()=>{at=Number(e.dataset.days),ct="",lt="",Ve(!0)}));k("#reset-camera").addEventListener("click",()=>Ve(!0));k("#refresh").addEventListener("click",()=>{B?.onboarding?Ye.open(!0):Ye.refresh()});k("#scrubber").addEventListener("input",e=>{xe(),oe=Number(e.target.value)/1e3,xn()});k("#play").addEventListener("click",()=>{if(ce.length){if(At)return xe();oe>=1&&(oe=0),xn(),Ws={explorer:!k("#explorer").hidden,inspector:!k("#inspector").hidden},ue("explorer",!1),ue("inspector",!1),ue("timeline",!0),Ct.clear(),Gn=void 0,k("#app").classList.add("playback-mode"),Ti(!0),At=!0,Zn=0,ee?.setPlaying(!0),rr=performance.now(),k("#play").innerHTML=N("pause"),k("#play").setAttribute("aria-label","Pause timeline"),Oe(),yi=requestAnimationFrame(ed)}});document.addEventListener("visibilitychange",()=>{rr=performance.now()},{signal:kr.signal});async function Xv(){const e=k("#share-playback");e.disabled=!0;try{if(!ro){const{createPlaybackShare:t}=await cr(async()=>{const{createPlaybackShare:n}=await import("./share-DKeJCFAo.js");return{createPlaybackShare:n}},__vite__mapDeps([2,0,1,3]));ro=t(Mt,()=>{Lr()})}te.nodes.length&&ro.open(te,q)}catch{mt("Could not open video sharing. Please try again.")}finally{e.disabled=!ce.length||!ee}}async function Lr(){try{if(!oo){const{createPublishing:e}=await cr(async()=>{const{createPublishing:t}=await import("./publishing-ofssf6d6.js");return{createPublishing:t}},__vite__mapDeps([4,0,1,3,5]));oo=e(Mt,()=>{Xv()})}await oo.open(ce.map(e=>e.id))}catch{mt("Could not open publishing. Please try again.")}}k("#share-playback").addEventListener("click",Lr);k("#open-publishing").addEventListener("click",Lr);for(const e of[!1,!0])k(`#view-${e?"2d":"3d"}`).addEventListener("click",()=>Tr({view:e?"2d":"3d"}));k("#motion").addEventListener("click",()=>Tr({motion:Lo(q,or.matches)?"off":"on"}));k("#help").addEventListener("click",()=>{k("#help-dialog").showModal(),Mt()});k("#help-dialog").addEventListener("close",Mt);k("#close-help").addEventListener("click",()=>k("#help-dialog").close());document.addEventListener("keydown",e=>{if(!e.defaultPrevented&&!document.querySelector("dialog[open]")){if(At&&e.key==="Escape"){e.preventDefault(),xe();return}if(!Cr.handleKey(e)){if(e.key==="Escape"){j?Ai():ue("explorer",!1);return}if(!(e.target.matches("input, select, textarea")||e.metaKey||e.ctrlKey||e.altKey)){if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key)&&!e.target.closest('[data-drag-panel], [contenteditable="true"]')){const t=e.target;if(t.matches("canvas, body, .session-card")||t.closest(".session-card")){const n=vi,s=n.findIndex(i=>i.id===j),r=e.key==="ArrowLeft"||e.key==="ArrowUp"?-1:1,o=n[Math.max(0,Math.min(n.length-1,s+r))];o&&(e.preventDefault(),Sn(o.id),t.closest(".session-card")&&(ns.has(o.id)||(ln=Math.min(n.length,ln+100),ki()),ns.get(o.id)?.focus({preventScroll:!0})));return}}if(e.key.toLowerCase()==="f"&&Ve(!0),e.key.toLowerCase()==="h"){xe();const t=["explorer","timeline","inspector"].filter(n=>!k(`#${n}`).hidden);t.length?(io=t,t.forEach(n=>ue(n,!1))):(io.length?io:["explorer","timeline"]).forEach(n=>{(n!=="inspector"||j)&&ue(n,!0)})}}}}});Ii().then(()=>{B?.importing?Ye.resume():ls()});export{cy as C,wr as D,oi as P,ly as R,Pd as S,cr as _,tl as a,sy as b,Xa as c,ry as d,ii as e,oy as f,jg as g,K as h,Xg as i,ny as j,Ue as k,Lo as l,jd as m,il as n,In as o,Qc as p,Qv as q,Bd as r,dn as s,Wg as t,ey as u,iy as v,ty as w,ay as x,ao as y};
|