even-keel 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +3 -3
  3. package/dist/src/badge/collect.js +26 -4
  4. package/dist/src/badge/render.js +2 -1
  5. package/dist/src/claude/sdk/host.js +10 -3
  6. package/dist/src/copilot/adapter.js +1 -1
  7. package/dist/src/notice/en.js +1 -0
  8. package/dist/src/service/trackers.js +3 -2
  9. package/dist/src/sessions/ask.js +6 -0
  10. package/dist/src/sessions/monitor.js +1 -0
  11. package/dist/src/sessions/permission.js +3 -2
  12. package/dist/src/sessions/transcript.js +29 -2
  13. package/dist/src/tracker/questions.js +35 -3
  14. package/dist/web/assets/{BadgeDialog-D4hwGrta.js → BadgeDialog-DTnQXw9H.js} +1 -1
  15. package/dist/web/assets/{DescriptionEditor-ujHSJeis.js → DescriptionEditor-CpRmzCRQ.js} +1 -1
  16. package/dist/web/assets/{ProjectPackages-DMk8vL5N.js → ProjectPackages-BILdF91o.js} +1 -1
  17. package/dist/web/assets/{Select-BMRSXvrD.js → Select-BkfVMQn9.js} +1 -1
  18. package/dist/web/assets/{TaskCard-DeZtmpq4.js → TaskCard-BdMTPm5U.js} +2 -2
  19. package/dist/web/assets/TranscriptWindow-BNF7AkTM.css +1 -0
  20. package/dist/web/assets/TranscriptWindow-DWmiEsux.js +4 -0
  21. package/dist/web/assets/{accountParts-B-b8vNCY.js → accountParts-BgNHNRlI.js} +1 -1
  22. package/dist/web/assets/blocks-CrABcaPz.js +12 -0
  23. package/dist/web/assets/{cardDrafts-yo2X_Uq1.js → cardDrafts-BfmbAV1M.js} +1 -1
  24. package/dist/web/assets/{cardSide-Y3dIjNVW.js → cardSide-D2KI5tvT.js} +1 -1
  25. package/dist/web/assets/{feedLine-BJhjgpoe.js → feedLine-Ba2zSS8M.js} +1 -1
  26. package/dist/web/assets/{hooks-CDqQcVnS.js → hooks-JRdbz0x_.js} +1 -1
  27. package/dist/web/assets/{index-B9H7kxbk.js → index-CLtOpp9i.js} +4 -4
  28. package/dist/web/assets/{lib-DUH5hYcn.js → lib-BWXVCBDM.js} +1 -1
  29. package/dist/web/assets/{overview-BdakxI-5.js → overview-D3YlvCUL.js} +1 -1
  30. package/dist/web/assets/{packageGroups-D15r6pKX.js → packageGroups-Bp5E3IBW.js} +1 -1
  31. package/dist/web/assets/{react-dom-CDxcrI4x.js → react-dom-BrsVbrva.js} +1 -1
  32. package/dist/web/assets/{rules-CVcjwHXa.js → rules-LK65q0Fp.js} +1 -1
  33. package/dist/web/assets/{useFileDrop-vzFQ_b-5.js → useFileDrop-uBrD_n1G.js} +1 -1
  34. package/dist/web/assets/{useHeightGlide-DBfdeOiD.js → useHeightGlide-DUlst5w-.js} +1 -1
  35. package/dist/web/assets/{useRowFocus-CMvgf7Aw.js → useRowFocus-B25YUpUj.js} +1 -1
  36. package/dist/web/index.html +14 -14
  37. package/package.json +2 -2
  38. package/tally/tally.config.json +8 -0
  39. package/dist/web/assets/TranscriptWindow-DRGnlese.css +0 -1
  40. package/dist/web/assets/TranscriptWindow-hQHw_CQ7.js +0 -4
  41. package/dist/web/assets/blocks-BTQTnJ34.js +0 -12
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{At as t,Br as n,Lr as r,Rr as i,Vr as a,Xt as o,hr as s,ki as c,li as l,or as u,pi as d,pr as f,xi as p}from"./blocks-BTQTnJ34.js";import{Q as m,it as h,rt as ee,t as te}from"./lib-DUH5hYcn.js";import{d as g,g as _,h as ne,v as re,y as ie}from"./accountParts-B-b8vNCY.js";import{C as ae,u as oe}from"./cardDrafts-yo2X_Uq1.js";var v=e(c(),1);function y(e){return{"--series":e===null?`var(--series-other)`:`var(--series-${e})`}}function b(e){return{"--series":e===null?`var(--series-other)`:`var(--tone-${e})`}}var x=`(max-width: 760px)`;function S(e){let t=window.matchMedia(x);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function C(){return window.matchMedia(x).matches}function se(){return(0,v.useSyncExternalStore)(S,C)}var w=i();function T(e){return e===`fiveHour`?{label:p.limits.fiveHour,title:p.limits.fiveHourTitle}:e===`sevenDay`?{label:p.limits.week,title:p.limits.weekTitle}:{label:p.limits.month,title:p.limits.monthTitle}}function E(e,t,n=!1){return e.left===void 0?e.used!==void 0&&e.limit!==void 0?n?`${t}%`:p.limits.usedOf(Math.round(e.used),Math.round(e.limit)):e.used===void 0?`${t}%`:n?p.limits.usedShort(e.used):p.limits.used(e.used):n?String(e.left):p.limits.left(e.left)}function ce({limits:e,now:t,bare:n=!1,named:r=!1}){let i=e===null?``:` · ${p.limits.sources[e.source]}`;return(0,w.jsx)(`div`,{className:n?`limits limits--bare`:`limits`,children:h(e).map(a=>(0,w.jsx)(le,{...T(a),source:i,window:e?.[a]??null,now:t,bare:n,named:!n||r},a))})}function le({label:e,title:t,source:n,window:r,now:i,bare:a,named:o}){if(r===null)return(0,w.jsxs)(`div`,{className:`meter meter--empty`,title:p.limits.empty(t,n),children:[(0,w.jsxs)(`span`,{className:`meter__top`,children:[o&&(0,w.jsx)(`span`,{className:`meter__label`,children:e}),(0,w.jsx)(`span`,{className:`meter__value`,children:a?p.limits.noData:`—`})]}),(0,w.jsx)(`span`,{className:`meter__bar`,"aria-hidden":`true`})]});let s=Math.round(Math.min(Math.max(r.usedPercentage,0),100)),c=f(r.resetsAt,i);return(0,w.jsxs)(`div`,{className:`meter${s>=100?` meter--full`:s>=80?` meter--warm`:``}`,title:p.limits.reset(t,c,n),children:[(0,w.jsxs)(`span`,{className:`meter__top`,children:[o&&(0,w.jsx)(`span`,{className:`meter__label`,children:e}),(0,w.jsx)(`span`,{className:`meter__value`,children:E(r,s)}),(0,w.jsxs)(`span`,{className:`meter__reset`,children:[`↻ `,c]})]}),(0,w.jsx)(`span`,{className:`meter__bar`,role:`meter`,"aria-label":t,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":s,children:(0,w.jsx)(`span`,{className:`meter__fill`,style:{width:`${s}%`}})})]})}function ue(e){let[t,n]=(0,v.useState)(()=>new Date);return(0,v.useEffect)(()=>{let t=setInterval(()=>n(new Date),e);return()=>clearInterval(t)},[e]),t}function de(e){return e===`shared`?`Even Keel`:e===`project`?l===`ru`?`проект`:`project`:l===`ru`?`задача`:`task`}function fe({account:e,levels:t,now:r,spend:i,tokens:a}){let o=t[0]?.account,s=(0,v.useRef)(o),[c,l]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{if(s.current===o)return;s.current=o,l(!0);let e=setTimeout(()=>l(!1),1600);return()=>clearTimeout(e)},[o]),t.some(t=>e.accounts.some(e=>e.key===t.account))?(0,w.jsx)(`div`,{id:`account-card`,className:`account-card account-levels`,role:`tooltip`,children:t.map((t,o)=>{let s=e.accounts.find(e=>e.key===t.account);if(!s)return null;let l=g(s),d=n(s,e.accounts),f=s.name===null&&d===s.status?.email?d.split(`@`)[0]:d,p=ee(s.limits),h=(s.usage.state===`stale`||s.limitsOutdated===!0)&&s.limits!==null;return(0,w.jsxs)(`div`,{className:`account-level account-level--${o}${o===0&&c?` account-level--changed`:``}`,style:y(m(e,s)),children:[(0,w.jsxs)(`div`,{className:`account-level__head`,children:[(0,w.jsxs)(`div`,{className:`account-level__identity`,children:[(0,w.jsx)(`span`,{className:`account-card__name`,children:f}),l&&(0,w.jsx)(`span`,{className:`tag`,children:l}),(0,w.jsxs)(`span`,{className:`chip account-level__source`,children:[de(t.source),t.task&&(0,w.jsxs)(w.Fragment,{children:[` `,(0,w.jsx)(`span`,{className:`account-level__task`,children:t.task})]})]})]}),h&&o===0&&(0,w.jsx)(`span`,{className:`account-level__stale`,children:u(s.limits.updatedAt,r)}),o>0&&(p?(0,w.jsx)(`span`,{className:`account-level__number`,children:E(p.window,100-p.free)}):(0,w.jsx)(D,{entry:s,spend:i,tokens:a}))]}),o===0&&(0,w.jsx)(`div`,{className:`account-level__body`,children:(0,w.jsx)(O,{entry:s,now:r,spend:i,tokens:a})})]},t.account)})}):null}function pe({account:e,entry:t,now:r}){let i=re(e),a=ie(e),o=g(t),s=n(t,e.accounts),c=t.name===null&&s===t.status?.email?s.split(`@`)[0]:s;return(0,w.jsxs)(`div`,{className:`account-level account-level--0`,style:y(m(e,t)),children:[(0,w.jsx)(`div`,{className:`account-level__head`,children:(0,w.jsxs)(`div`,{className:`account-level__identity`,children:[(0,w.jsx)(`span`,{className:`account-card__name`,children:c}),o&&(0,w.jsx)(`span`,{className:`tag`,children:o})]})}),(0,w.jsx)(`div`,{className:`account-level__body`,children:(0,w.jsx)(O,{entry:t,now:r,spend:i,tokens:a})})]})}function D({entry:e,spend:t,tokens:n}){let r=_(e)?ne(t,e.key):n===null?null:p.account.tokens(s(n[e.key]?.day??0),s(n[e.key]?.month??0));return r===null?null:(0,w.jsx)(`span`,{className:`account-level__summary`,children:r})}function O({entry:e,now:t,spend:n,tokens:r}){let i=h(e.limits).filter(t=>e.limits?.[t]!=null);return i.length===0?(0,w.jsx)(D,{entry:e,spend:n,tokens:r}):i.map(n=>{let r=e.limits[n],i=Math.round(Math.min(Math.max(r.usedPercentage,0),100)),a=e.limitsOutdated?` meter--outdated`:i>=100?` meter--full`:i>=80?` meter--warm`:``;return(0,w.jsxs)(`div`,{className:`account-level__window${a}`,children:[(0,w.jsx)(`span`,{className:`account-level__label`,children:T(n).label}),(0,w.jsx)(`span`,{className:`meter__bar`,children:(0,w.jsx)(`span`,{className:`meter__fill`,style:{width:`${i}%`}})}),(0,w.jsx)(`span`,{className:`account-level__value`,children:E(r,i)}),(0,w.jsx)(`span`,{className:`account-level__reset`,children:f(r.resetsAt,t)})]},n)})}function k(e){return e.slice(e.lastIndexOf(`/`)+1)}function A(e){return{provider:e.provider===null?null:ae({provider:e.provider,model:null,effort:null}),model:e.model===null?null:k(e.model),effort:e.effort}}var j=[`chainRun`,`chatTask`],M={chainRun:`Mod+Enter`,chatTask:`Mod+B`},N=[`chatTask`],P=[`Mod`,`Ctrl`,`Meta`,`Alt`,`Shift`],F=/^(?:[A-Z0-9]|F(?:[1-9]|1[0-2])|Enter|Space|Tab|Escape|Backspace|Delete|Insert|Home|End|PageUp|PageDown|Arrow(?:Up|Down|Left|Right)|Minus|Equal|BracketLeft|BracketRight|Backslash|Semicolon|Quote|Comma|Period|Slash|Backquote)$/,I=/^[A-Za-z0-9-]{8,64}$/;function L(e){let t=e.split(`+`),n=t.pop();if(!F.test(n))return null;let r=-1;for(let e of t){let t=P.indexOf(e);if(t<=r)return null;r=t}return{modifiers:t,key:n}}function R(e){return{...M,...e}}var z=/^(?:Shift|Control|Alt|Meta|OS)(?:Left|Right)?$|^(?:AltGraph|CapsLock|Fn|FnLock|NumLock)$/;function B(e,t){if(z.test(e.code))return null;let n=me(e.code),r=[];(t?e.metaKey:e.ctrlKey)&&r.push(`Mod`),t&&e.ctrlKey&&r.push(`Ctrl`),!t&&e.metaKey&&r.push(`Meta`),e.altKey&&r.push(`Alt`),e.shiftKey&&r.push(`Shift`);let i=[...r,n].join(`+`);return L(i)===null?null:i}function me(e){return/^Key[A-Z]$/.test(e)?e.slice(3):/^Digit[0-9]$/.test(e)?e.slice(5):e===`NumpadEnter`?`Enter`:e}var he=[[`Ctrl`,`⌃`],[`Alt`,`⌥`],[`Shift`,`⇧`],[`Mod`,`⌘`]],ge={Mod:`Ctrl`,Ctrl:`Ctrl`,Meta:`Win`,Alt:`Alt`,Shift:`Shift`},_e={ArrowUp:`↑`,ArrowDown:`↓`,ArrowLeft:`←`,ArrowRight:`→`,Escape:`Esc`,Minus:`-`,Equal:`=`,BracketLeft:`[`,BracketRight:`]`,Backslash:`\\`,Semicolon:`;`,Quote:`'`,Comma:`,`,Period:`.`,Slash:`/`,Backquote:"`"};function ve(e,t){let n=L(e);if(n===null)return e;let r=_e[n.key]??n.key;if(!t)return[...n.modifiers.map(e=>ge[e]),r].join(`+`);let i=he.filter(([e])=>n.modifiers.includes(e)).map(([,e])=>e);return i.length===0?r:`${i.join(``)} ${r}`}var ye=[`W`,`T`,`N`,`L`,`Tab`,`Q`];function be(e,t,n){let r=L(e);if(r===null)return{kind:`bare`};let i=e=>r.modifiers.includes(e);if(i(`Mod`)&&ye.includes(r.key)||i(`Ctrl`)&&r.key===`Tab`)return{kind:`reserved`};if(!(i(`Mod`)||i(`Ctrl`)||i(`Meta`)||i(`Alt`))&&!/^F\d+$/.test(r.key))return{kind:`bare`};if(r.key===`Enter`&&N.includes(t))return{kind:`field`};let a=Object.entries(n).find(([n,r])=>n!==t&&r===e);return a===void 0?null:{kind:`taken`,action:a[0]}}function xe(e){return/mac/i.test(e.userAgentData?.platform??e.platform??``)}function Se(e,t){if(e.isComposing)return!0;let n=e.target;return n?.isContentEditable===!0||[`INPUT`,`TEXTAREA`,`SELECT`].includes(n?.tagName??``)?!0:t.querySelector(`dialog[open]`)!==null}var V=`even-keel.browser`,H=null;function Ce(){try{let e=localStorage.getItem(V);if(e!==null&&I.test(e))return e;let t=U();return localStorage.setItem(V,t),t}catch{return H??=U(),H}}function U(){return[...crypto.getRandomValues(new Uint8Array(16))].map(e=>e.toString(16).padStart(2,`0`)).join(``)}function W(){let{state:e}=r(),t=Ce(),n=e?.hotkeys?.[t]??{};return{browser:t,own:n,current:R(n),mac:xe(navigator)}}function we(e,t){let{current:n,mac:r}=W();return i=>{i.repeat||i.nativeEvent.isComposing||B(i,r)!==n[e]||(i.preventDefault(),t())}}function Te(e,t){let{current:n,mac:r}=W(),i=n[e],a=(0,v.useRef)(t);a.current=t,(0,v.useEffect)(()=>{let e=e=>{e.repeat||Se(e,document)||B(e,r)!==i||(e.preventDefault(),a.current())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i,r])}var Ee=864e5,De=`even-keel`,G=`chatDrafts`,K=`taskDrafts`;function q(e){return e.text.trim()===``&&e.files.length===0}function Oe(e,t){return`${e}\u0000${t}`}function ke(e){return new Set([...e.sessions.map(e=>e.sessionId),...Object.values(e.taskSessions).flatMap(e=>e.map(e=>e.sessionId))])}function Ae(e){return new Set([...e.tasks.map(e=>e.id),...Object.keys(e.taskSessions)])}function J(e,t,n){return e.filter(e=>!t.has(e.id)&&n-e.savedAt>Ee).map(e=>e.id)}var Y=null;function X(){return Y??=new Promise((e,t)=>{let n=indexedDB.open(De,2);n.onupgradeneeded=()=>{let e=n.result;e.objectStoreNames.contains(G)||e.createObjectStore(G,{keyPath:`sessionId`}),e.objectStoreNames.contains(K)||e.createObjectStore(K,{keyPath:`key`})},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error??Error(`cannot open IndexedDB`))}).catch(e=>{throw Y=null,e}),Y}async function Z(e,t,n){let r=await X();return new Promise((i,a)=>{let o=n(r.transaction(e,t).objectStore(e));o.onsuccess=()=>i(o.result),o.onerror=()=>a(o.error??Error(`IndexedDB request failed`))})}async function je(e,t,n){try{let r=await Z(K,`readonly`,t=>t.get(e));if(r!==void 0)return{text:r.text,files:r.files};let i=await Z(G,`readonly`,e=>e.get(n));if(i===void 0)return null;let a={text:i.text,files:i.files};return await Q(e,t,a),await Z(G,`readwrite`,e=>e.delete(n)),a}catch{return null}}async function Q(e,t,n){try{q(n)?await Z(K,`readwrite`,t=>t.delete(e)):await Z(K,`readwrite`,r=>r.put({key:e,task:t,text:n.text,files:n.files,savedAt:Date.now()}))}catch{}}async function Me(e,t){try{let n=Date.now(),r=await Z(K,`readonly`,e=>e.getAll()),i=new Set(r.filter(t=>e.has(t.task)).map(e=>e.key));for(let e of J(r.map(e=>({id:e.key,savedAt:e.savedAt})),i,n))await Z(K,`readwrite`,t=>t.delete(e));let a=await Z(G,`readonly`,e=>e.getAll());for(let e of J(a.map(e=>({id:e.sessionId,savedAt:e.savedAt})),t,n))await Z(G,`readwrite`,t=>t.delete(e))}catch{}}function Ne({review:e}){return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(o,{tip:p.chain.review.pullTitle,inline:!0,children:(0,w.jsx)(`a`,{href:e.url,className:`chip chip--pull`,target:`_blank`,rel:`noreferrer`,draggable:!1,children:p.chain.review.pull(e.number)})}),e.feedback&&(0,w.jsx)(o,{tip:p.chain.review.feedbackTitle,inline:!0,focusable:!0,children:(0,w.jsx)(`span`,{className:`chip chip--feedback`,children:p.chain.review.feedback})}),e.closed!==void 0&&(0,w.jsx)(`span`,{className:`chip`,children:e.closed===`merged`?p.chain.review.merged:p.chain.review.closed})]})}function Pe({review:e,compact:n=!1}){let r=(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{children:p.session.openPull(e.number)}),e.feedback&&(0,w.jsx)(`span`,{children:p.chain.review.feedbackTitle}),e.closed!==void 0&&(0,w.jsx)(`span`,{children:e.closed===`merged`?p.chain.review.merged:p.chain.review.closed})]});return(0,w.jsx)(o,{tip:r,inline:!0,align:n?`end`:`start`,className:n?`pull-button pull-button--compact`:`pull-button`,children:(0,w.jsxs)(`a`,{href:e.url,className:n?`panel__remote`:`button pull-button__link`,target:`_blank`,rel:`noreferrer`,"aria-label":n?p.session.openPull(e.number):void 0,children:[(0,w.jsx)(t,{}),!n&&p.chain.review.pull(e.number)]})})}var Fe={a:({href:e,children:t})=>e!==void 0&&/^(https?|mailto):/i.test(e)?(0,w.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,children:t}):(0,w.jsx)(`span`,{children:t}),img:({alt:e})=>e?(0,w.jsxs)(`span`,{className:`markdown__image`,children:[`[`,e,`]`]}):null};function Ie({text:e}){return(0,w.jsx)(`div`,{className:`markdown`,children:(0,w.jsx)(oe,{remarkPlugins:[te],components:Fe,children:e})})}function Le({account:e,agent:t}){let{state:i}=r();if(e==null)return null;let o=i?.account,s=a(o,e,t),c=e.lastIndexOf(`@`),l=s===void 0?c>0?e.slice(0,c):e:n(s,o.accounts),u=s===void 0?e:[...new Set([s.key,s.status?.email??s.key])].join(` · `);return(0,w.jsx)(`span`,{className:`account-tag`,style:y(s===void 0?null:m(o,s)),title:p.session.account(u),children:(0,w.jsx)(`span`,{className:`account-tag__name`,children:l})})}function $(e){return e.split(/[\\/]/).pop()??e}function Re(e){let t=Object.entries(e.answers?.answers??{}).map(([e,t])=>`${e} → ${t}`),n=(e.files??[]).map(e=>`📎 ${$(e)}`);return[...t,e.notice===void 0?e.text:d(e.notice),...n].filter(e=>e!==``).join(` · `)}export{C as A,A as C,ce as D,ue as E,y as M,b as N,T as O,k as S,fe as T,B as _,Pe as a,M as b,q as c,Me as d,je as f,W as g,Te as h,Ie as i,se as j,E as k,ke as l,we as m,$ as n,Ne as o,Q as p,Le as r,Oe as s,Re as t,Ae as u,ve as v,pe as w,j as x,be as y};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{At as t,Br as n,Lr as r,Rr as i,Vr as a,Xt as o,hr as s,ki as c,li as l,or as u,pi as d,pr as f,xi as p}from"./blocks-CrABcaPz.js";import{Q as m,it as h,rt as ee,t as te}from"./lib-BWXVCBDM.js";import{d as g,g as _,h as ne,v as re,y as ie}from"./accountParts-BgNHNRlI.js";import{C as ae,u as oe}from"./cardDrafts-BfmbAV1M.js";var v=e(c(),1);function y(e){return{"--series":e===null?`var(--series-other)`:`var(--series-${e})`}}function b(e){return{"--series":e===null?`var(--series-other)`:`var(--tone-${e})`}}var x=`(max-width: 760px)`;function S(e){let t=window.matchMedia(x);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function C(){return window.matchMedia(x).matches}function se(){return(0,v.useSyncExternalStore)(S,C)}var w=i();function T(e){return e===`fiveHour`?{label:p.limits.fiveHour,title:p.limits.fiveHourTitle}:e===`sevenDay`?{label:p.limits.week,title:p.limits.weekTitle}:{label:p.limits.month,title:p.limits.monthTitle}}function E(e,t,n=!1){return e.left===void 0?e.used!==void 0&&e.limit!==void 0?n?`${t}%`:p.limits.usedOf(Math.round(e.used),Math.round(e.limit)):e.used===void 0?`${t}%`:n?p.limits.usedShort(e.used):p.limits.used(e.used):n?String(e.left):p.limits.left(e.left)}function ce({limits:e,now:t,bare:n=!1,named:r=!1}){let i=e===null?``:` · ${p.limits.sources[e.source]}`;return(0,w.jsx)(`div`,{className:n?`limits limits--bare`:`limits`,children:h(e).map(a=>(0,w.jsx)(le,{...T(a),source:i,window:e?.[a]??null,now:t,bare:n,named:!n||r},a))})}function le({label:e,title:t,source:n,window:r,now:i,bare:a,named:o}){if(r===null)return(0,w.jsxs)(`div`,{className:`meter meter--empty`,title:p.limits.empty(t,n),children:[(0,w.jsxs)(`span`,{className:`meter__top`,children:[o&&(0,w.jsx)(`span`,{className:`meter__label`,children:e}),(0,w.jsx)(`span`,{className:`meter__value`,children:a?p.limits.noData:`—`})]}),(0,w.jsx)(`span`,{className:`meter__bar`,"aria-hidden":`true`})]});let s=Math.round(Math.min(Math.max(r.usedPercentage,0),100)),c=f(r.resetsAt,i);return(0,w.jsxs)(`div`,{className:`meter${s>=100?` meter--full`:s>=80?` meter--warm`:``}`,title:p.limits.reset(t,c,n),children:[(0,w.jsxs)(`span`,{className:`meter__top`,children:[o&&(0,w.jsx)(`span`,{className:`meter__label`,children:e}),(0,w.jsx)(`span`,{className:`meter__value`,children:E(r,s)}),(0,w.jsxs)(`span`,{className:`meter__reset`,children:[`↻ `,c]})]}),(0,w.jsx)(`span`,{className:`meter__bar`,role:`meter`,"aria-label":t,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":s,children:(0,w.jsx)(`span`,{className:`meter__fill`,style:{width:`${s}%`}})})]})}function ue(e){let[t,n]=(0,v.useState)(()=>new Date);return(0,v.useEffect)(()=>{let t=setInterval(()=>n(new Date),e);return()=>clearInterval(t)},[e]),t}function de(e){return e===`shared`?`Even Keel`:e===`project`?l===`ru`?`проект`:`project`:l===`ru`?`задача`:`task`}function fe({account:e,levels:t,now:r,spend:i,tokens:a}){let o=t[0]?.account,s=(0,v.useRef)(o),[c,l]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{if(s.current===o)return;s.current=o,l(!0);let e=setTimeout(()=>l(!1),1600);return()=>clearTimeout(e)},[o]),t.some(t=>e.accounts.some(e=>e.key===t.account))?(0,w.jsx)(`div`,{id:`account-card`,className:`account-card account-levels`,role:`tooltip`,children:t.map((t,o)=>{let s=e.accounts.find(e=>e.key===t.account);if(!s)return null;let l=g(s),d=n(s,e.accounts),f=s.name===null&&d===s.status?.email?d.split(`@`)[0]:d,p=ee(s.limits),h=(s.usage.state===`stale`||s.limitsOutdated===!0)&&s.limits!==null;return(0,w.jsxs)(`div`,{className:`account-level account-level--${o}${o===0&&c?` account-level--changed`:``}`,style:y(m(e,s)),children:[(0,w.jsxs)(`div`,{className:`account-level__head`,children:[(0,w.jsxs)(`div`,{className:`account-level__identity`,children:[(0,w.jsx)(`span`,{className:`account-card__name`,children:f}),l&&(0,w.jsx)(`span`,{className:`tag`,children:l}),(0,w.jsxs)(`span`,{className:`chip account-level__source`,children:[de(t.source),t.task&&(0,w.jsxs)(w.Fragment,{children:[` `,(0,w.jsx)(`span`,{className:`account-level__task`,children:t.task})]})]})]}),h&&o===0&&(0,w.jsx)(`span`,{className:`account-level__stale`,children:u(s.limits.updatedAt,r)}),o>0&&(p?(0,w.jsx)(`span`,{className:`account-level__number`,children:E(p.window,100-p.free)}):(0,w.jsx)(D,{entry:s,spend:i,tokens:a}))]}),o===0&&(0,w.jsx)(`div`,{className:`account-level__body`,children:(0,w.jsx)(O,{entry:s,now:r,spend:i,tokens:a})})]},t.account)})}):null}function pe({account:e,entry:t,now:r}){let i=re(e),a=ie(e),o=g(t),s=n(t,e.accounts),c=t.name===null&&s===t.status?.email?s.split(`@`)[0]:s;return(0,w.jsxs)(`div`,{className:`account-level account-level--0`,style:y(m(e,t)),children:[(0,w.jsx)(`div`,{className:`account-level__head`,children:(0,w.jsxs)(`div`,{className:`account-level__identity`,children:[(0,w.jsx)(`span`,{className:`account-card__name`,children:c}),o&&(0,w.jsx)(`span`,{className:`tag`,children:o})]})}),(0,w.jsx)(`div`,{className:`account-level__body`,children:(0,w.jsx)(O,{entry:t,now:r,spend:i,tokens:a})})]})}function D({entry:e,spend:t,tokens:n}){let r=_(e)?ne(t,e.key):n===null?null:p.account.tokens(s(n[e.key]?.day??0),s(n[e.key]?.month??0));return r===null?null:(0,w.jsx)(`span`,{className:`account-level__summary`,children:r})}function O({entry:e,now:t,spend:n,tokens:r}){let i=h(e.limits).filter(t=>e.limits?.[t]!=null);return i.length===0?(0,w.jsx)(D,{entry:e,spend:n,tokens:r}):i.map(n=>{let r=e.limits[n],i=Math.round(Math.min(Math.max(r.usedPercentage,0),100)),a=e.limitsOutdated?` meter--outdated`:i>=100?` meter--full`:i>=80?` meter--warm`:``;return(0,w.jsxs)(`div`,{className:`account-level__window${a}`,children:[(0,w.jsx)(`span`,{className:`account-level__label`,children:T(n).label}),(0,w.jsx)(`span`,{className:`meter__bar`,children:(0,w.jsx)(`span`,{className:`meter__fill`,style:{width:`${i}%`}})}),(0,w.jsx)(`span`,{className:`account-level__value`,children:E(r,i)}),(0,w.jsx)(`span`,{className:`account-level__reset`,children:f(r.resetsAt,t)})]},n)})}function k(e){return e.slice(e.lastIndexOf(`/`)+1)}function A(e){return{provider:e.provider===null?null:ae({provider:e.provider,model:null,effort:null}),model:e.model===null?null:k(e.model),effort:e.effort}}var j=[`chainRun`,`chatTask`],M={chainRun:`Mod+Enter`,chatTask:`Mod+B`},N=[`chatTask`],P=[`Mod`,`Ctrl`,`Meta`,`Alt`,`Shift`],F=/^(?:[A-Z0-9]|F(?:[1-9]|1[0-2])|Enter|Space|Tab|Escape|Backspace|Delete|Insert|Home|End|PageUp|PageDown|Arrow(?:Up|Down|Left|Right)|Minus|Equal|BracketLeft|BracketRight|Backslash|Semicolon|Quote|Comma|Period|Slash|Backquote)$/,I=/^[A-Za-z0-9-]{8,64}$/;function L(e){let t=e.split(`+`),n=t.pop();if(!F.test(n))return null;let r=-1;for(let e of t){let t=P.indexOf(e);if(t<=r)return null;r=t}return{modifiers:t,key:n}}function R(e){return{...M,...e}}var z=/^(?:Shift|Control|Alt|Meta|OS)(?:Left|Right)?$|^(?:AltGraph|CapsLock|Fn|FnLock|NumLock)$/;function B(e,t){if(z.test(e.code))return null;let n=me(e.code),r=[];(t?e.metaKey:e.ctrlKey)&&r.push(`Mod`),t&&e.ctrlKey&&r.push(`Ctrl`),!t&&e.metaKey&&r.push(`Meta`),e.altKey&&r.push(`Alt`),e.shiftKey&&r.push(`Shift`);let i=[...r,n].join(`+`);return L(i)===null?null:i}function me(e){return/^Key[A-Z]$/.test(e)?e.slice(3):/^Digit[0-9]$/.test(e)?e.slice(5):e===`NumpadEnter`?`Enter`:e}var he=[[`Ctrl`,`⌃`],[`Alt`,`⌥`],[`Shift`,`⇧`],[`Mod`,`⌘`]],ge={Mod:`Ctrl`,Ctrl:`Ctrl`,Meta:`Win`,Alt:`Alt`,Shift:`Shift`},_e={ArrowUp:`↑`,ArrowDown:`↓`,ArrowLeft:`←`,ArrowRight:`→`,Escape:`Esc`,Minus:`-`,Equal:`=`,BracketLeft:`[`,BracketRight:`]`,Backslash:`\\`,Semicolon:`;`,Quote:`'`,Comma:`,`,Period:`.`,Slash:`/`,Backquote:"`"};function ve(e,t){let n=L(e);if(n===null)return e;let r=_e[n.key]??n.key;if(!t)return[...n.modifiers.map(e=>ge[e]),r].join(`+`);let i=he.filter(([e])=>n.modifiers.includes(e)).map(([,e])=>e);return i.length===0?r:`${i.join(``)} ${r}`}var ye=[`W`,`T`,`N`,`L`,`Tab`,`Q`];function be(e,t,n){let r=L(e);if(r===null)return{kind:`bare`};let i=e=>r.modifiers.includes(e);if(i(`Mod`)&&ye.includes(r.key)||i(`Ctrl`)&&r.key===`Tab`)return{kind:`reserved`};if(!(i(`Mod`)||i(`Ctrl`)||i(`Meta`)||i(`Alt`))&&!/^F\d+$/.test(r.key))return{kind:`bare`};if(r.key===`Enter`&&N.includes(t))return{kind:`field`};let a=Object.entries(n).find(([n,r])=>n!==t&&r===e);return a===void 0?null:{kind:`taken`,action:a[0]}}function xe(e){return/mac/i.test(e.userAgentData?.platform??e.platform??``)}function Se(e,t){if(e.isComposing)return!0;let n=e.target;return n?.isContentEditable===!0||[`INPUT`,`TEXTAREA`,`SELECT`].includes(n?.tagName??``)?!0:t.querySelector(`dialog[open]`)!==null}var V=`even-keel.browser`,H=null;function Ce(){try{let e=localStorage.getItem(V);if(e!==null&&I.test(e))return e;let t=U();return localStorage.setItem(V,t),t}catch{return H??=U(),H}}function U(){return[...crypto.getRandomValues(new Uint8Array(16))].map(e=>e.toString(16).padStart(2,`0`)).join(``)}function W(){let{state:e}=r(),t=Ce(),n=e?.hotkeys?.[t]??{};return{browser:t,own:n,current:R(n),mac:xe(navigator)}}function we(e,t){let{current:n,mac:r}=W();return i=>{i.repeat||i.nativeEvent.isComposing||B(i,r)!==n[e]||(i.preventDefault(),t())}}function Te(e,t){let{current:n,mac:r}=W(),i=n[e],a=(0,v.useRef)(t);a.current=t,(0,v.useEffect)(()=>{let e=e=>{e.repeat||Se(e,document)||B(e,r)!==i||(e.preventDefault(),a.current())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i,r])}var Ee=864e5,De=`even-keel`,G=`chatDrafts`,K=`taskDrafts`;function q(e){return e.text.trim()===``&&e.files.length===0}function Oe(e,t){return`${e}\u0000${t}`}function ke(e){return new Set([...e.sessions.map(e=>e.sessionId),...Object.values(e.taskSessions).flatMap(e=>e.map(e=>e.sessionId))])}function Ae(e){return new Set([...e.tasks.map(e=>e.id),...Object.keys(e.taskSessions)])}function J(e,t,n){return e.filter(e=>!t.has(e.id)&&n-e.savedAt>Ee).map(e=>e.id)}var Y=null;function X(){return Y??=new Promise((e,t)=>{let n=indexedDB.open(De,2);n.onupgradeneeded=()=>{let e=n.result;e.objectStoreNames.contains(G)||e.createObjectStore(G,{keyPath:`sessionId`}),e.objectStoreNames.contains(K)||e.createObjectStore(K,{keyPath:`key`})},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error??Error(`cannot open IndexedDB`))}).catch(e=>{throw Y=null,e}),Y}async function Z(e,t,n){let r=await X();return new Promise((i,a)=>{let o=n(r.transaction(e,t).objectStore(e));o.onsuccess=()=>i(o.result),o.onerror=()=>a(o.error??Error(`IndexedDB request failed`))})}async function je(e,t,n){try{let r=await Z(K,`readonly`,t=>t.get(e));if(r!==void 0)return{text:r.text,files:r.files};let i=await Z(G,`readonly`,e=>e.get(n));if(i===void 0)return null;let a={text:i.text,files:i.files};return await Q(e,t,a),await Z(G,`readwrite`,e=>e.delete(n)),a}catch{return null}}async function Q(e,t,n){try{q(n)?await Z(K,`readwrite`,t=>t.delete(e)):await Z(K,`readwrite`,r=>r.put({key:e,task:t,text:n.text,files:n.files,savedAt:Date.now()}))}catch{}}async function Me(e,t){try{let n=Date.now(),r=await Z(K,`readonly`,e=>e.getAll()),i=new Set(r.filter(t=>e.has(t.task)).map(e=>e.key));for(let e of J(r.map(e=>({id:e.key,savedAt:e.savedAt})),i,n))await Z(K,`readwrite`,t=>t.delete(e));let a=await Z(G,`readonly`,e=>e.getAll());for(let e of J(a.map(e=>({id:e.sessionId,savedAt:e.savedAt})),t,n))await Z(G,`readwrite`,t=>t.delete(e))}catch{}}function Ne({review:e}){return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(o,{tip:p.chain.review.pullTitle,inline:!0,children:(0,w.jsx)(`a`,{href:e.url,className:`chip chip--pull`,target:`_blank`,rel:`noreferrer`,draggable:!1,children:p.chain.review.pull(e.number)})}),e.feedback&&(0,w.jsx)(o,{tip:p.chain.review.feedbackTitle,inline:!0,focusable:!0,children:(0,w.jsx)(`span`,{className:`chip chip--feedback`,children:p.chain.review.feedback})}),e.closed!==void 0&&(0,w.jsx)(`span`,{className:`chip`,children:e.closed===`merged`?p.chain.review.merged:p.chain.review.closed})]})}function Pe({review:e,compact:n=!1}){let r=(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{children:p.session.openPull(e.number)}),e.feedback&&(0,w.jsx)(`span`,{children:p.chain.review.feedbackTitle}),e.closed!==void 0&&(0,w.jsx)(`span`,{children:e.closed===`merged`?p.chain.review.merged:p.chain.review.closed})]});return(0,w.jsx)(o,{tip:r,inline:!0,align:n?`end`:`start`,className:n?`pull-button pull-button--compact`:`pull-button`,children:(0,w.jsxs)(`a`,{href:e.url,className:n?`panel__remote`:`button pull-button__link`,target:`_blank`,rel:`noreferrer`,"aria-label":n?p.session.openPull(e.number):void 0,children:[(0,w.jsx)(t,{}),!n&&p.chain.review.pull(e.number)]})})}var Fe={a:({href:e,children:t})=>e!==void 0&&/^(https?|mailto):/i.test(e)?(0,w.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,children:t}):(0,w.jsx)(`span`,{children:t}),img:({alt:e})=>e?(0,w.jsxs)(`span`,{className:`markdown__image`,children:[`[`,e,`]`]}):null};function Ie({text:e}){return(0,w.jsx)(`div`,{className:`markdown`,children:(0,w.jsx)(oe,{remarkPlugins:[te],components:Fe,children:e})})}function Le({account:e,agent:t}){let{state:i}=r();if(e==null)return null;let o=i?.account,s=a(o,e,t),c=e.lastIndexOf(`@`),l=s===void 0?c>0?e.slice(0,c):e:n(s,o.accounts),u=s===void 0?e:[...new Set([s.key,s.status?.email??s.key])].join(` · `);return(0,w.jsx)(`span`,{className:`account-tag`,style:y(s===void 0?null:m(o,s)),title:p.session.account(u),children:(0,w.jsx)(`span`,{className:`account-tag__name`,children:l})})}function $(e){return e.split(/[\\/]/).pop()??e}function Re(e){let t=Object.entries(e.answers?.answers??{}).map(([e,t])=>`${e} → ${t}`),n=(e.files??[]).map(e=>`📎 ${$(e)}`);return[...t,e.notice===void 0?e.text:d(e.notice),...n].filter(e=>e!==``).join(` · `)}export{C as A,A as C,ce as D,ue as E,y as M,b as N,T as O,k as S,fe as T,B as _,Pe as a,M as b,q as c,Me as d,je as f,W as g,Te as h,Ie as i,se as j,E as k,ke as l,we as m,$ as n,Ne as o,Q as p,Le as r,Oe as s,Re as t,Ae as u,ve as v,pe as w,j as x,be as y};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{ki as t}from"./blocks-BTQTnJ34.js";var n=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,r=/^[\\/]{2}/;function i(e,t){return t+e.replace(/\\/g,`/`)}var a=`popstate`;function o(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function s(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return f(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:p(t)}return h(t,n,null,e)}function c(e,t){if(e===!1||e==null)throw Error(t)}function l(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function u(){return Math.random().toString(36).substring(2,10)}function d(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function f(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?m(t):t,state:n,key:t&&t.key||r||u(),mask:i}}function p({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function m(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function h(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:s=!1}=r,c=i.history,l=`POP`,u=null,p=m();p??(p=0,c.replaceState({...c.state,idx:p},``));function m(){return(c.state||{idx:null}).idx}function h(){l=`POP`;let e=m(),t=e==null?null:e-p;p=e,u&&u({action:l,location:v.location,delta:t})}function g(e,t){l=`PUSH`;let r=o(e)?e:f(v.location,e,t);n&&n(r,e),p=m()+1;let a=d(r,p),h=v.createHref(r.mask||r);try{c.pushState(a,``,h)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(h)}s&&u&&u({action:l,location:v.location,delta:1})}function te(e,t){l=`REPLACE`;let r=o(e)?e:f(v.location,e,t);n&&n(r,e),p=m();let i=d(r,p),a=v.createHref(r.mask||r);c.replaceState(i,``,a),s&&u&&u({action:l,location:v.location,delta:0})}function _(e){return ee(i,e)}let v={get action(){return l},get location(){return e(i,c)},listen(e){if(u)throw Error(`A history only accepts one active listener`);return i.addEventListener(a,h),u=e,()=>{i.removeEventListener(a,h),u=null}},createHref(e){return t(i,e)},createURL:_,encodeLocation(e){let t=_(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:g,replace:te,go(e){return c.go(e)}};return v}function ee(e,t,n=!1){let i=`http://localhost`;e&&(i=e.location.origin===`null`?e.location.href:e.location.origin),c(i,`No window.location.(origin|href) available to create URL`);let a=typeof t==`string`?t:p(t);return a=a.replace(/ $/,`%20`),!n&&r.test(a)&&(a=i+a),new URL(a,i)}var g=e(t(),1);function te(e,t,n=`/`){return _(e,t,n,!1)}function _(e,t,n,r,i){let a=w((typeof t==`string`?m(t):t).pathname||`/`,n);if(a==null)return null;let o=i??ne(e),s=null,c=ge(a);for(let e=0;s==null&&e<o.length;++e)s=he(o[e],c,r);return s}function v(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,loaderData:t[n.id],handle:n.handle}}function ne(e){let t=y(e);return ie(t),t}function y(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let l={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(l.relativePath.startsWith(`/`)){if(!l.relativePath.startsWith(r)&&o)return;c(l.relativePath.startsWith(r),`Absolute route path "${l.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),l.relativePath=l.relativePath.slice(r.length)}let u=k([r,l.relativePath]),d=n.concat(l);e.children&&e.children.length>0&&(c(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${u}".`),y(e.children,t,d,u,o)),(e.path!=null||e.index)&&t.push({path:u,score:pe(u,e.index),routesMeta:d.map((e,t)=>{let[n,r]=C(e.relativePath,e.caseSensitive,t===d.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of re(e.path))a(e,t,!0,n)}),t}function re(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=re(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function ie(e){e.sort((e,t)=>e.score===t.score?me(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var ae=/^:[\w-]+$/,oe=/^:[\w-]+/,se=3.5,ce=3,le=2,ue=1,de=10,fe=-2,b=e=>e===`*`;function pe(e,t){let n=e.split(`/`),r=n.length;return n.some(b)&&(r+=fe),t&&(r+=le),n.filter(e=>!b(e)).reduce((e,t)=>e+(ae.test(t)?ce:oe.test(t)?se:t===``?ue:de),r)}function me(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function he(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?S(u,l,s.matcher,s.compiledParams):x(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=x({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:k([a,d.pathname]),pathnameBase:be(k([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=k([a,d.pathnameBase]))}return o}function x(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=C(e.path,e.caseSensitive,e.end);return S(e,t,n,r)}function S(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=A(a,1),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=A(a.slice(0,a.length-e.length),1)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function C(e,t=!1,n=!0){l(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(?=\/|$|\()/g,`(?:/$1)?`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function ge(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return l(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function w(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function _e(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?m(e):e,a;return n?(n=ye(n),a=n.startsWith(`/`)||n.startsWith(`\\`)?T(n.substring(1),`/`):T(n,t)):a=t,{pathname:a,search:xe(r),hash:Se(i)}}function T(e,t){let n=A(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function E(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function ve(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function D(e){let t=ve(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function O(e,t,n,r=!1){let i;typeof e==`string`?i=m(e):(i={...e},c(!i.pathname||!i.pathname.includes(`?`),E(`?`,`pathname`,`search`,i)),c(!i.pathname||!i.pathname.includes(`#`),E(`#`,`pathname`,`hash`,i)),c(!i.search||!i.search.includes(`#`),E(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let l=_e(i,s),u=o&&o!==`/`&&o.endsWith(`/`),d=(a||o===`.`)&&n.endsWith(`/`);return!l.pathname.endsWith(`/`)&&(u||d)&&(l.pathname+=`/`),l}var ye=e=>e.replace(/[\\/]{2,}/g,`/`),k=e=>ye(e.join(`/`));function A(e,t=0){let n=e.length;for(;n>t&&e.charCodeAt(n-1)===47;)n--;return n===e.length?e:e.slice(0,n)}var be=e=>A(e).replace(/^\/*/,`/`),xe=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Se=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Ce=class{status;statusText;data;error;internal;constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function we(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Te(e){return k(e.map(e=>e.route.path).filter(Boolean))||`/`}var Ee=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function j(e,t){let a=e;if(typeof a!=`string`||!n.test(a))return{absoluteURL:void 0,isExternal:!1,to:a};let o=a,s=!1;if(Ee)try{let e=new URL(window.location.href),n=r.test(a)?new URL(i(a,e.protocol)):new URL(a),o=w(n.pathname,t);n.origin===e.origin&&o!=null?a=o+n.search+n.hash:s=!0}catch{l(!1,`<Link to="${a}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:s,to:a}}var M=new URL(`http://localhost`);function N(e){if(e.createURL)return e.createURL(`/`);try{return new URL(e.createHref(`/`),M)}catch{return M}}function P(e,t){return e.origin===t.origin&&(e.origin!==`null`||e.protocol===t.protocol&&e.host===t.host)}function De(e,t){if(e.startsWith(`//`))return!0;let n=t.protocol.toLowerCase();return e.toLowerCase().startsWith(n)?t.host===``||e.slice(n.length).startsWith(`//`):!1}function F(e,t,n,r){let i=null;try{i=e==null?null:new URL(e,n)}catch{}let a=new URL(t,n),o=i!=null&&!P(i,n),s=!P(a,n);if(r===`reject`){if(o||s)throw Error(`External navigation is not allowed`)}else if(s&&(i==null||!De(e,i)||!P(i,a)))throw Error(`External navigation is not allowed`)}var I=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(I);var Oe=[`GET`,...I];new Set(Oe);var ke=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Ae(e){try{return ke.includes(new URL(e).protocol)}catch{return!1}}var L=g.createContext(null);L.displayName=`DataRouter`;var R=g.createContext(null);R.displayName=`DataRouterState`;var z=g.createContext(null);z.displayName=`DataRouterData`;var B=g.createContext(null);B.displayName=`DataRouterNavigation`;var je=g.createContext(!1);function Me(){return g.useContext(je)}var Ne=g.createContext({isTransitioning:!1});Ne.displayName=`ViewTransition`;var Pe=g.createContext(null);Pe.displayName=`Fetchers`;var Fe=g.createContext(null);Fe.displayName=`Await`;var V=g.createContext(null);V.displayName=`Navigation`;var H=g.createContext(null);H.displayName=`Location`;var U=g.createContext({outlet:null,matches:[],isDataRoute:!1});U.displayName=`Route`;var W=g.createContext(!1);W.displayName=`IsDataRoute`;var G=g.createContext(void 0);G.displayName=`RouteId`;var K=g.createContext(null);K.displayName=`RouteError`;var q=`REACT_ROUTER_ERROR`,Ie=`REDIRECT`,Le=`ROUTE_ERROR_RESPONSE`;function Re(e){if(e.startsWith(`${q}:${Ie}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function ze(e){if(e.startsWith(`${q}:${Le}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Ce(t.status,t.statusText,t.data)}catch{}}function Be(e,{relative:t}={}){c(J(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=g.useContext(V),{hash:i,pathname:a,search:o}=Ke(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:k([n,a])),r.createHref({pathname:s,search:o,hash:i})}function J(){return g.useContext(H)!=null}function Y(){return c(J(),`useLocation() may be used only in the context of a <Router> component.`),g.useContext(H).location}function Ve(e){c(J(),`useMatch() may be used only in the context of a <Router> component.`);let{pathname:t}=Y();return g.useMemo(()=>x(e,ge(t)),[t,e])}var He=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Ue(){return g.useContext(W)?st():We()}function We(){c(J(),`useNavigate() may be used only in the context of a <Router> component.`);let e=g.useContext(L),{basename:t,navigator:n}=g.useContext(V),{matches:r}=g.useContext(U),{pathname:i}=Y(),a=JSON.stringify(D(r)),o=g.useRef(!1);return g.useLayoutEffect(()=>{o.current=!0}),g.useCallback((r,s={})=>{if(l(o.current,He),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=O(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:k([t,c.pathname])),F(typeof r==`string`?r:p(r),n.createHref(c),N(n),`reject`),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}g.createContext(null);function Ge(){let{matches:e}=g.useContext(U);return e[e.length-1]?.params??{}}function Ke(e,{relative:t}={}){let{matches:n}=g.useContext(U),{pathname:r}=Y(),i=JSON.stringify(D(n));return g.useMemo(()=>O(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function qe(e,t){return Je(e,t)}function Je(e,t,n){c(J(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=g.useContext(V),{matches:i}=g.useContext(U),a=i[i.length-1],o=a?a.params:{};a&&a.pathname;let s=a?a.pathnameBase:`/`;a&&a.route;let l=Y(),u;if(t){let e=typeof t==`string`?m(t):t;c(s===`/`||e.pathname?.startsWith(s),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${s}" but pathname "${e.pathname}" was given in the \`location\` prop.`),u=e}else u=l;let d=u.pathname||`/`,f=d;if(s!==`/`){let e=s.replace(/^\//,``).split(`/`);f=`/`+d.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let p;p=n?n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):n.router.match(n.state.location):te(e,{pathname:f});let h=et(p&&p.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:k([s,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?s:k([s,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?g.createElement(H.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...u},navigationType:`POP`}},h):h}function Ye(){let e=ot(),t=we(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return g.createElement(g.Fragment,null,g.createElement(`h2`,null,`Unexpected Application Error!`),g.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?g.createElement(`pre`,{style:{padding:`0.5rem`,backgroundColor:`rgba(200,200,200, 0.5)`}},n):null,null)}var Xe=g.createElement(Ye,null),Ze=class extends g.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static contextType=je;static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=ze(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:g.createElement(U.Provider,{value:this.props.routeContext},g.createElement(W.Provider,{value:this.props.routeContext.isDataRoute},g.createElement(G.Provider,{value:this.props.routeContext.matches[this.props.routeContext.matches.length-1]?.route.id},g.createElement(K.Provider,{value:e,children:this.props.component}))));return this.context?g.createElement(Qe,{error:e},t):t}},X=new WeakMap;function Qe({children:e,error:t}){let{basename:n,navigator:r}=g.useContext(V);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Re(t.digest);if(e){let i=X.get(t);if(i)throw i;let a=j(e.location,n),o=a.absoluteURL||a.to;if(F(e.location,o,N(r),`allow-explicit`),Ae(o))throw Error(`Invalid redirect location`);if(Ee&&!X.get(t)){if(a.isExternal||e.reloadDocument)window.location.href=o;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw X.set(t,n),n}}return g.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${o}`})}}return e}function $e({routeContext:e,match:t,children:n}){let r=g.useContext(L);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),g.createElement(U.Provider,{value:e},g.createElement(W.Provider,{value:e.isDataRoute},g.createElement(G.Provider,{value:t.route.id},n)))}function et(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);c(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let l=n?.onError,u=r&&l?(e,t)=>{l(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:Te(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let l,d=!1,f=null,p=null;r&&(l=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||Xe,o&&(s<0&&c===0?(lt(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=l?f:d?p:n.route.Component?g.createElement(n.route.Component,null):n.route.element?n.route.element:e,g.createElement($e,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?g.createElement(Ze,{location:r.location,revalidation:r.revalidation,component:f,error:l,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:u}):h()},null)}function Z(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function tt(e){let t=g.useContext(L);return c(t,Z(e)),t}function nt(e){let t=g.useContext(R);return c(t,Z(e)),t}function Q(e){let t=g.useContext(z);return c(t,Z(e)),t}function rt(e){let t=g.useContext(B);return c(t,Z(e)),t}function $(e){let t=g.useContext(G);return c(t,`${e} can only be used on routes that contain a unique "id"`),t}function it(){let{navigation:e}=rt(`useNavigation`);return g.useMemo(()=>{let{matches:t,historyAction:n,...r}=e;return r},[e])}function at(){let{matches:e}=nt(`useMatches`),{loaderData:t}=Q(`useMatches`);return g.useMemo(()=>e.map(e=>v(e,t)),[e,t])}function ot(){let e=g.useContext(K),t=Q(`useRouteError`),n=$(`useRouteError`);return e===void 0?t.errors?.[n]:e}function st(){let{router:e}=tt(`useNavigate`),t=$(`useNavigate`),n=g.useRef(!1);return g.useLayoutEffect(()=>{n.current=!0}),g.useCallback(async(r,i={})=>{l(n.current,He),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var ct={};function lt(e,t,n){!t&&!ct[e]&&(ct[e]=!0,l(!1,n))}export{O as A,Me as C,k as D,D as E,m as F,l as I,n as L,s as M,p as N,x as O,c as P,Ne as S,F as T,L as _,Be as a,V as b,Ve as c,it as d,Ge as f,Fe as g,Je as h,nt as i,w as j,j as k,at as l,qe as m,tt as n,J as o,Ke as p,Q as r,Y as s,$ as t,Ue as u,B as v,N as w,U as x,H as y};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{ki as t}from"./blocks-CrABcaPz.js";var n=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,r=/^[\\/]{2}/;function i(e,t){return t+e.replace(/\\/g,`/`)}var a=`popstate`;function o(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function s(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return f(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:p(t)}return h(t,n,null,e)}function c(e,t){if(e===!1||e==null)throw Error(t)}function l(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function u(){return Math.random().toString(36).substring(2,10)}function d(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function f(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?m(t):t,state:n,key:t&&t.key||r||u(),mask:i}}function p({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function m(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function h(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:s=!1}=r,c=i.history,l=`POP`,u=null,p=m();p??(p=0,c.replaceState({...c.state,idx:p},``));function m(){return(c.state||{idx:null}).idx}function h(){l=`POP`;let e=m(),t=e==null?null:e-p;p=e,u&&u({action:l,location:v.location,delta:t})}function g(e,t){l=`PUSH`;let r=o(e)?e:f(v.location,e,t);n&&n(r,e),p=m()+1;let a=d(r,p),h=v.createHref(r.mask||r);try{c.pushState(a,``,h)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(h)}s&&u&&u({action:l,location:v.location,delta:1})}function te(e,t){l=`REPLACE`;let r=o(e)?e:f(v.location,e,t);n&&n(r,e),p=m();let i=d(r,p),a=v.createHref(r.mask||r);c.replaceState(i,``,a),s&&u&&u({action:l,location:v.location,delta:0})}function _(e){return ee(i,e)}let v={get action(){return l},get location(){return e(i,c)},listen(e){if(u)throw Error(`A history only accepts one active listener`);return i.addEventListener(a,h),u=e,()=>{i.removeEventListener(a,h),u=null}},createHref(e){return t(i,e)},createURL:_,encodeLocation(e){let t=_(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:g,replace:te,go(e){return c.go(e)}};return v}function ee(e,t,n=!1){let i=`http://localhost`;e&&(i=e.location.origin===`null`?e.location.href:e.location.origin),c(i,`No window.location.(origin|href) available to create URL`);let a=typeof t==`string`?t:p(t);return a=a.replace(/ $/,`%20`),!n&&r.test(a)&&(a=i+a),new URL(a,i)}var g=e(t(),1);function te(e,t,n=`/`){return _(e,t,n,!1)}function _(e,t,n,r,i){let a=w((typeof t==`string`?m(t):t).pathname||`/`,n);if(a==null)return null;let o=i??ne(e),s=null,c=ge(a);for(let e=0;s==null&&e<o.length;++e)s=he(o[e],c,r);return s}function v(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,loaderData:t[n.id],handle:n.handle}}function ne(e){let t=y(e);return ie(t),t}function y(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let l={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(l.relativePath.startsWith(`/`)){if(!l.relativePath.startsWith(r)&&o)return;c(l.relativePath.startsWith(r),`Absolute route path "${l.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),l.relativePath=l.relativePath.slice(r.length)}let u=k([r,l.relativePath]),d=n.concat(l);e.children&&e.children.length>0&&(c(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${u}".`),y(e.children,t,d,u,o)),(e.path!=null||e.index)&&t.push({path:u,score:pe(u,e.index),routesMeta:d.map((e,t)=>{let[n,r]=C(e.relativePath,e.caseSensitive,t===d.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of re(e.path))a(e,t,!0,n)}),t}function re(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=re(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function ie(e){e.sort((e,t)=>e.score===t.score?me(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var ae=/^:[\w-]+$/,oe=/^:[\w-]+/,se=3.5,ce=3,le=2,ue=1,de=10,fe=-2,b=e=>e===`*`;function pe(e,t){let n=e.split(`/`),r=n.length;return n.some(b)&&(r+=fe),t&&(r+=le),n.filter(e=>!b(e)).reduce((e,t)=>e+(ae.test(t)?ce:oe.test(t)?se:t===``?ue:de),r)}function me(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function he(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?S(u,l,s.matcher,s.compiledParams):x(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=x({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:k([a,d.pathname]),pathnameBase:be(k([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=k([a,d.pathnameBase]))}return o}function x(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=C(e.path,e.caseSensitive,e.end);return S(e,t,n,r)}function S(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=A(a,1),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=A(a.slice(0,a.length-e.length),1)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function C(e,t=!1,n=!0){l(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(?=\/|$|\()/g,`(?:/$1)?`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function ge(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return l(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function w(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function _e(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?m(e):e,a;return n?(n=ye(n),a=n.startsWith(`/`)||n.startsWith(`\\`)?T(n.substring(1),`/`):T(n,t)):a=t,{pathname:a,search:xe(r),hash:Se(i)}}function T(e,t){let n=A(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function E(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function ve(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function D(e){let t=ve(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function O(e,t,n,r=!1){let i;typeof e==`string`?i=m(e):(i={...e},c(!i.pathname||!i.pathname.includes(`?`),E(`?`,`pathname`,`search`,i)),c(!i.pathname||!i.pathname.includes(`#`),E(`#`,`pathname`,`hash`,i)),c(!i.search||!i.search.includes(`#`),E(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let l=_e(i,s),u=o&&o!==`/`&&o.endsWith(`/`),d=(a||o===`.`)&&n.endsWith(`/`);return!l.pathname.endsWith(`/`)&&(u||d)&&(l.pathname+=`/`),l}var ye=e=>e.replace(/[\\/]{2,}/g,`/`),k=e=>ye(e.join(`/`));function A(e,t=0){let n=e.length;for(;n>t&&e.charCodeAt(n-1)===47;)n--;return n===e.length?e:e.slice(0,n)}var be=e=>A(e).replace(/^\/*/,`/`),xe=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Se=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Ce=class{status;statusText;data;error;internal;constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function we(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Te(e){return k(e.map(e=>e.route.path).filter(Boolean))||`/`}var Ee=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function j(e,t){let a=e;if(typeof a!=`string`||!n.test(a))return{absoluteURL:void 0,isExternal:!1,to:a};let o=a,s=!1;if(Ee)try{let e=new URL(window.location.href),n=r.test(a)?new URL(i(a,e.protocol)):new URL(a),o=w(n.pathname,t);n.origin===e.origin&&o!=null?a=o+n.search+n.hash:s=!0}catch{l(!1,`<Link to="${a}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:s,to:a}}var M=new URL(`http://localhost`);function N(e){if(e.createURL)return e.createURL(`/`);try{return new URL(e.createHref(`/`),M)}catch{return M}}function P(e,t){return e.origin===t.origin&&(e.origin!==`null`||e.protocol===t.protocol&&e.host===t.host)}function De(e,t){if(e.startsWith(`//`))return!0;let n=t.protocol.toLowerCase();return e.toLowerCase().startsWith(n)?t.host===``||e.slice(n.length).startsWith(`//`):!1}function F(e,t,n,r){let i=null;try{i=e==null?null:new URL(e,n)}catch{}let a=new URL(t,n),o=i!=null&&!P(i,n),s=!P(a,n);if(r===`reject`){if(o||s)throw Error(`External navigation is not allowed`)}else if(s&&(i==null||!De(e,i)||!P(i,a)))throw Error(`External navigation is not allowed`)}var I=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(I);var Oe=[`GET`,...I];new Set(Oe);var ke=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Ae(e){try{return ke.includes(new URL(e).protocol)}catch{return!1}}var L=g.createContext(null);L.displayName=`DataRouter`;var R=g.createContext(null);R.displayName=`DataRouterState`;var z=g.createContext(null);z.displayName=`DataRouterData`;var B=g.createContext(null);B.displayName=`DataRouterNavigation`;var je=g.createContext(!1);function Me(){return g.useContext(je)}var Ne=g.createContext({isTransitioning:!1});Ne.displayName=`ViewTransition`;var Pe=g.createContext(null);Pe.displayName=`Fetchers`;var Fe=g.createContext(null);Fe.displayName=`Await`;var V=g.createContext(null);V.displayName=`Navigation`;var H=g.createContext(null);H.displayName=`Location`;var U=g.createContext({outlet:null,matches:[],isDataRoute:!1});U.displayName=`Route`;var W=g.createContext(!1);W.displayName=`IsDataRoute`;var G=g.createContext(void 0);G.displayName=`RouteId`;var K=g.createContext(null);K.displayName=`RouteError`;var q=`REACT_ROUTER_ERROR`,Ie=`REDIRECT`,Le=`ROUTE_ERROR_RESPONSE`;function Re(e){if(e.startsWith(`${q}:${Ie}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function ze(e){if(e.startsWith(`${q}:${Le}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Ce(t.status,t.statusText,t.data)}catch{}}function Be(e,{relative:t}={}){c(J(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=g.useContext(V),{hash:i,pathname:a,search:o}=Ke(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:k([n,a])),r.createHref({pathname:s,search:o,hash:i})}function J(){return g.useContext(H)!=null}function Y(){return c(J(),`useLocation() may be used only in the context of a <Router> component.`),g.useContext(H).location}function Ve(e){c(J(),`useMatch() may be used only in the context of a <Router> component.`);let{pathname:t}=Y();return g.useMemo(()=>x(e,ge(t)),[t,e])}var He=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Ue(){return g.useContext(W)?st():We()}function We(){c(J(),`useNavigate() may be used only in the context of a <Router> component.`);let e=g.useContext(L),{basename:t,navigator:n}=g.useContext(V),{matches:r}=g.useContext(U),{pathname:i}=Y(),a=JSON.stringify(D(r)),o=g.useRef(!1);return g.useLayoutEffect(()=>{o.current=!0}),g.useCallback((r,s={})=>{if(l(o.current,He),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=O(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:k([t,c.pathname])),F(typeof r==`string`?r:p(r),n.createHref(c),N(n),`reject`),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}g.createContext(null);function Ge(){let{matches:e}=g.useContext(U);return e[e.length-1]?.params??{}}function Ke(e,{relative:t}={}){let{matches:n}=g.useContext(U),{pathname:r}=Y(),i=JSON.stringify(D(n));return g.useMemo(()=>O(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function qe(e,t){return Je(e,t)}function Je(e,t,n){c(J(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=g.useContext(V),{matches:i}=g.useContext(U),a=i[i.length-1],o=a?a.params:{};a&&a.pathname;let s=a?a.pathnameBase:`/`;a&&a.route;let l=Y(),u;if(t){let e=typeof t==`string`?m(t):t;c(s===`/`||e.pathname?.startsWith(s),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${s}" but pathname "${e.pathname}" was given in the \`location\` prop.`),u=e}else u=l;let d=u.pathname||`/`,f=d;if(s!==`/`){let e=s.replace(/^\//,``).split(`/`);f=`/`+d.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let p;p=n?n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):n.router.match(n.state.location):te(e,{pathname:f});let h=et(p&&p.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:k([s,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?s:k([s,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?g.createElement(H.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...u},navigationType:`POP`}},h):h}function Ye(){let e=ot(),t=we(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return g.createElement(g.Fragment,null,g.createElement(`h2`,null,`Unexpected Application Error!`),g.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?g.createElement(`pre`,{style:{padding:`0.5rem`,backgroundColor:`rgba(200,200,200, 0.5)`}},n):null,null)}var Xe=g.createElement(Ye,null),Ze=class extends g.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static contextType=je;static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=ze(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:g.createElement(U.Provider,{value:this.props.routeContext},g.createElement(W.Provider,{value:this.props.routeContext.isDataRoute},g.createElement(G.Provider,{value:this.props.routeContext.matches[this.props.routeContext.matches.length-1]?.route.id},g.createElement(K.Provider,{value:e,children:this.props.component}))));return this.context?g.createElement(Qe,{error:e},t):t}},X=new WeakMap;function Qe({children:e,error:t}){let{basename:n,navigator:r}=g.useContext(V);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Re(t.digest);if(e){let i=X.get(t);if(i)throw i;let a=j(e.location,n),o=a.absoluteURL||a.to;if(F(e.location,o,N(r),`allow-explicit`),Ae(o))throw Error(`Invalid redirect location`);if(Ee&&!X.get(t)){if(a.isExternal||e.reloadDocument)window.location.href=o;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw X.set(t,n),n}}return g.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${o}`})}}return e}function $e({routeContext:e,match:t,children:n}){let r=g.useContext(L);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),g.createElement(U.Provider,{value:e},g.createElement(W.Provider,{value:e.isDataRoute},g.createElement(G.Provider,{value:t.route.id},n)))}function et(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);c(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let l=n?.onError,u=r&&l?(e,t)=>{l(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:Te(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let l,d=!1,f=null,p=null;r&&(l=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||Xe,o&&(s<0&&c===0?(lt(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=l?f:d?p:n.route.Component?g.createElement(n.route.Component,null):n.route.element?n.route.element:e,g.createElement($e,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?g.createElement(Ze,{location:r.location,revalidation:r.revalidation,component:f,error:l,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:u}):h()},null)}function Z(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function tt(e){let t=g.useContext(L);return c(t,Z(e)),t}function nt(e){let t=g.useContext(R);return c(t,Z(e)),t}function Q(e){let t=g.useContext(z);return c(t,Z(e)),t}function rt(e){let t=g.useContext(B);return c(t,Z(e)),t}function $(e){let t=g.useContext(G);return c(t,`${e} can only be used on routes that contain a unique "id"`),t}function it(){let{navigation:e}=rt(`useNavigation`);return g.useMemo(()=>{let{matches:t,historyAction:n,...r}=e;return r},[e])}function at(){let{matches:e}=nt(`useMatches`),{loaderData:t}=Q(`useMatches`);return g.useMemo(()=>e.map(e=>v(e,t)),[e,t])}function ot(){let e=g.useContext(K),t=Q(`useRouteError`),n=$(`useRouteError`);return e===void 0?t.errors?.[n]:e}function st(){let{router:e}=tt(`useNavigate`),t=$(`useNavigate`),n=g.useRef(!1);return g.useLayoutEffect(()=>{n.current=!0}),g.useCallback(async(r,i={})=>{l(n.current,He),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var ct={};function lt(e,t,n){!t&&!ct[e]&&(ct[e]=!0,l(!1,n))}export{O as A,Me as C,k as D,D as E,m as F,l as I,n as L,s as M,p as N,x as O,c as P,Ne as S,F as T,L as _,Be as a,V as b,Ve as c,it as d,Ge as f,Fe as g,Je as h,nt as i,w as j,j as k,at as l,qe as m,tt as n,J as o,Ke as p,Q as r,Y as s,$ as t,Ue as u,B as v,N as w,U as x,H as y};