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,4 +1,4 @@
1
- import{n as e,r as t,t as n}from"./rolldown-runtime-XKyaHtl9.js";import{Mr as r,Rr as i,Tr as a,Zr as o,ki as s,ui as c,v as l,xi as u}from"./blocks-BTQTnJ34.js";import{A as d,C as f,D as p,E as m,F as h,I as g,L as _,M as v,N as y,O as b,P as x,S,T as C,_ as w,a as T,b as E,h as D,i as O,j as k,k as ee,m as te,n as A,o as j,p as M,r as ne,s as N,t as re,u as ie,v as ae,w as oe,x as se,y as ce}from"./hooks-CDqQcVnS.js";var P=t(s(),1);P.memo(le);function le({routes:e,manifest:t,state:n,isStatic:r,onError:i}){let a=P.useContext(w);return x(a,`You must render this element inside a <DataRouterContext.Provider> element`),D(e,void 0,{router:a.router,manifest:t,state:n,isStatic:r,onError:i})}function ue({to:e,replace:t,state:n,relative:r}){x(j(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i,navigator:a}=P.useContext(E);g(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:o}=P.useContext(se),{pathname:s}=N(),c=ie(),l=d(e,m(o),s,r===`path`);C(typeof e==`string`?e:y(e),a.createHref(l),oe(a),`reject`);let u=JSON.stringify(l);return P.useEffect(()=>{c(JSON.parse(u),{replace:t,state:n,relative:r})},[c,u,r,t,n]),null}function de(e){x(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function fe({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){x(!j(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=P.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=h(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,_=P.useMemo(()=>{let e=k(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return g(_!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),_==null?null:P.createElement(E.Provider,{value:c},P.createElement(ce.Provider,{children:t,value:_}))}function pe({children:e,location:t}){return te(me(e),t)}P.Component;function me(e,t=[]){let n=[];return P.Children.forEach(e,(e,r)=>{if(!P.isValidElement(e))return;let i=[...t,r];if(e.type===P.Fragment){n.push.apply(n,me(e.props.children,i));return}x(e.type===de,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`);let a=e.props;x(!a.index||!a.children,`An index route cannot have child routes.`);let o={id:a.id||i.join(`-`),caseSensitive:a.caseSensitive,element:a.element,Component:a.Component,index:a.index,path:a.path,middleware:a.middleware,loader:a.loader,action:a.action,hydrateFallbackElement:a.hydrateFallbackElement,HydrateFallback:a.HydrateFallback,errorElement:a.errorElement,ErrorBoundary:a.ErrorBoundary,shouldRevalidate:a.shouldRevalidate,handle:a.handle,lazy:a.lazy};a.children&&(o.children=me(a.children,i)),n.push(o)}),n}var he=`application/x-www-form-urlencoded`;function ge(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function _e(e){return ge(e)&&e.tagName.toLowerCase()===`button`}function ve(e){return ge(e)&&e.tagName.toLowerCase()===`form`}function ye(e){return ge(e)&&e.tagName.toLowerCase()===`input`}function be(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function xe(e,t){return e.button===0&&(!t||t===`_self`)&&!be(e)}function Se(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Ce(e,t){let n=Se(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var we=null;function Te(){if(we===null)try{new FormData(document.createElement(`form`),0),we=!1}catch{we=!0}return we}var Ee=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function De(e){return e!=null&&!Ee.has(e)?(g(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${he}"`),null):e}function Oe(e,t){let n,r,i,a,o;if(ve(e)){let o=e.getAttribute(`action`);r=o?k(o,t):null,n=e.getAttribute(`method`)||`get`,i=De(e.getAttribute(`enctype`))||he,a=new FormData(e)}else if(_e(e)||ye(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?k(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||`get`,i=De(e.getAttribute(`formenctype`))||De(o.getAttribute(`enctype`))||he,a=new FormData(o,e),!Te()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(ge(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=`get`,r=null,i=he,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}function ke(e,t){if(e===!1||e==null)throw Error(t)}function Ae(e,t){let n=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n.pathname=n.pathname.endsWith(`/`)?`${n.pathname}_.${t}`:`${n.pathname}.${t}`,n}async function je(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Me(e){return e!=null&&typeof e.page==`string`}function Ne(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function Pe(e,t,n){return ze((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await je(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Ne).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Fe(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Ie(e,t,{includeHydrateFallback:n}={}){return Le(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function Le(e){return[...new Set(e)]}function Re(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function ze(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Me(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Re(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}var Be=P.createContext(void 0);Be.displayName=`FrameworkContext`;function Ve(){let e=P.useContext(Be);return ke(e,`You must render this element inside a <HydratedRouter> element`),e}function He(e,t){let n=P.useContext(Be),[r,i]=P.useState(!1),[a,o]=P.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=P.useRef(null);P.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),P.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:Ue(s,p),onBlur:Ue(c,m),onMouseEnter:Ue(l,p),onMouseLeave:Ue(u,m),onTouchStart:Ue(d,p)}]:[a,f,{}]:[!1,f,{}]}function Ue(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function We({page:e,...t}){let n=f(),{nonce:r}=Ve(),{router:i}=A(`PrefetchPageLinks`),a=P.useMemo(()=>i.match(e),[i,i.routes,e]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?P.createElement(Ke,{page:e,matches:a,...t}):P.createElement(qe,{page:e,matches:a,...t})):null}function Ge(e){let{manifest:t,routeModules:n}=Ve(),[r,i]=P.useState([]);return P.useEffect(()=>{let r=!1;return Pe(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Ke({page:e,matches:t,...n}){let r=N(),i=P.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Ae(e,`rsc`),i=!1,a=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?i=!0:a.push(e.route.id);return i&&a.length>0&&n.searchParams.set(`_routes`,a.join(`,`)),[n.pathname+n.search]},[e,r,t]);return P.createElement(P.Fragment,null,i.map(e=>P.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function qe({page:e,matches:t,...n}){let r=N(),{manifest:i,routeModules:a}=Ve(),{matches:o}=O(`PrefetchPageLinks`),{loaderData:s}=ne(`PrefetchPageLinks`),c=P.useMemo(()=>Fe(e,t,o,i,r,`data`),[e,t,o,i,r]),l=P.useMemo(()=>Fe(e,t,o,i,r,`assets`),[e,t,o,i,r]),u=P.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,o=!1;if(t.forEach(e=>{let t=i.routes[e.route.id];t&&t.hasLoader&&(!c.some(t=>t.route.id===e.route.id)&&e.route.id in s&&a[e.route.id]?.shouldRevalidate||t.hasClientLoader?o=!0:n.add(e.route.id))}),n.size===0)return[];let l=Ae(e,`data`);return o&&n.size>0&&l.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[l.pathname+l.search]},[s,r,i,c,t,e,a]),d=P.useMemo(()=>Ie(l,i),[l,i]),f=Ge(l);return P.createElement(P.Fragment,null,u.map(e=>P.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),d.map(e=>P.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),f.map(({key:e,link:t})=>P.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Je(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}var Ye=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Ye&&(window.__reactRouterVersion=`8`)}catch{}function Xe({basename:e,children:t,useTransitions:n,window:r}){let i=P.useRef(null);i.current??=v({window:r,v5Compat:!0});let a=i.current,[o,s]=P.useState({action:a.action,location:a.location}),c=P.useCallback(e=>{n===!1?s(e):P.startTransition(()=>s(e))},[n]);return P.useLayoutEffect(()=>a.listen(c),[a,c]),P.createElement(fe,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}var Ze=P.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:f,defaultShouldRevalidate:m,...h},g){let{basename:v,navigator:y,useTransitions:b}=P.useContext(E),x=typeof l==`string`&&_.test(l),S=ee(l,v);l=S.to;let C=T(l,{relative:r}),w=N(),D=null;if(o){let e=d(o,[],w.mask?w.mask.pathname:`/`,!0);v!==`/`&&(e.pathname=e.pathname===`/`?v:p([v,e.pathname])),D=y.createHref(e)}let[O,k,te]=He(n,h),A=et(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:f,defaultShouldRevalidate:m,useTransitions:b});function j(t){e&&e(t),t.defaultPrevented||A(t)}let M=!(S.isExternal||i),ne=P.createElement(`a`,{...h,...te,href:(M?D:void 0)||S.absoluteURL||C,onClick:M?j:e,ref:Je(g,k),target:c,"data-discover":!x&&t===`render`?`true`:void 0});return O&&!x?P.createElement(P.Fragment,null,ne,P.createElement(We,{page:C})):ne});Ze.displayName=`Link`;var Qe=P.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=M(a,{relative:c.relative}),d=N(),f=P.useContext(ae),{navigator:p,basename:m}=P.useContext(E),h=f!=null&&ot(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f?.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=k(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(y)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,w;w=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(S):i;return P.createElement(Ze,{...c,"aria-current":C,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(S):s)});Qe.displayName=`NavLink`;var $e=P.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=`get`,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=P.useContext(E),g=it(),v=at(s,{relative:l}),y=o.toLowerCase()===`get`?`get`:`post`,b=typeof s==`string`&&_.test(s);return P.createElement(`form`,{ref:m,method:y,action:v,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?P.startTransition(()=>p()):p()},...p,"data-discover":!b&&e===`render`?`true`:void 0})});$e.displayName=`Form`;function et(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=ie(),d=N(),f=M(e,{relative:o});return P.useCallback(p=>{if(xe(p,t)){p.preventDefault();let t=n===void 0?y(d)===y(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?P.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function tt(e){g(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=P.useRef(Se(e)),n=P.useRef(!1),r=N(),i=P.useMemo(()=>Ce(r.search,n.current?null:t.current),[r.search]),a=ie();return[i,P.useCallback((e,t)=>{let r=Se(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var nt=0,rt=()=>`__${String(++nt)}__`;function it(){let{router:e}=A(`useSubmit`),{basename:t}=P.useContext(E),n=re(`useSubmit`),r=e.fetch,i=e.navigate;return P.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Oe(e,t);a.navigate===!1?await r(a.fetcherKey||rt(),n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,relative:a.relative,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,relative:a.relative,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function at(e,{relative:t}={}){let{basename:n}=P.useContext(E),r=P.useContext(se);x(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...M(e||`.`,{relative:t})},o=N();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:p([n,a.pathname])),y(a)}function ot(e,{relative:t}={}){let n=P.useContext(S);x(n!=null,"`useViewTransitionState` must be used within `react-router/dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=A(`useViewTransitionState`),i=M(e,{relative:t});if(!n.isTransitioning)return!1;let a=k(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=k(n.nextLocation.pathname,r)||n.nextLocation.pathname;return b(i.pathname,o)!=null||b(i.pathname,a)!=null}function st(e){if(e?.month===void 0){let t=[`fiveHour`,`sevenDay`].filter(t=>e?.absent?.includes(t)!==!0),n=t.filter(t=>e?.[t]!=null);return e?.source===`api`&&n.length>0?n:[...t]}return[...[`fiveHour`,`sevenDay`].filter(t=>e[t]!==null),`month`]}var ct=8;function lt(e,t){if(e===void 0)return null;let n=e.accounts.find(e=>e.status?.email===t);return n===void 0?null:e.accounts.map(e=>e.key).sort().indexOf(n.key)%ct+1}function ut(e,t,n){return n!=null&&!(e?.accounts.some(e=>e.status?.email===n&&e.projects.includes(t))??!1)}function dt(e,t){let n=t.status?.email??null,r=n===null?null:lt(e,n);return r===null?e.accounts.map(e=>e.key).sort().indexOf(t.key)%ct+1:r}var ft=[`claude`,`codex`,`opencode`,`copilot`];function pt(e){return e.cloud===void 0?e.apiKey?`apiKey`:`cli`:`cloud`}function mt(e){return e.apiKey||e.cloud!==void 0}var ht=[`zen`,`claudeSubscription`,`chatgpt`,`github`,`anthropicKey`,`openaiKey`,`openrouterKey`,`bedrock`,`vertex`,`foundry`,`other`],gt={claudeSubscription:`anthropic`,anthropicKey:`anthropic`,bedrock:`aws`,vertex:`google`,foundry:`microsoft`,chatgpt:`openai`,openaiKey:`openai`,openrouterKey:`openrouter`,zen:`zen`,github:`github`,other:null};function _t(e){if(e.agent===`copilot`)return`github`;if(e.cloud!==void 0)return e.cloud.cloud;if(e.agent===`claude`)return e.apiKey?`anthropicKey`:`claudeSubscription`;if(e.agent===`codex`)return e.apiKey?`openaiKey`:`chatgpt`;if(e.agent!==`opencode`)return`other`;let t=e.status?.subscriptionType?.split(`,`).map(e=>e.trim())??[];return e.status?.authMethod===`subscription_key`?`zen`:e.apiKey?t.includes(`anthropic`)?`anthropicKey`:t.includes(`openai`)?`openaiKey`:t.includes(`openrouter`)?`openrouterKey`:`zen`:t.includes(`openai`)?`chatgpt`:t.includes(`github-copilot`)?`github`:t.includes(`anthropic`)?`claudeSubscription`:`zen`}function vt(e){return ht.map(t=>({access:t,entries:e.filter(e=>_t(e)===t)})).filter(e=>e.entries.length>0)}function yt({login:e}){return e?.agent===`codex`||e?.agent===`opencode`}function bt(e,t){return e.missing.includes(t)}var xt={claude:`login.claudeMissing`,codex:`login.codexMissing`,opencode:`login.opencodeMissing`,copilot:`login.copilotMissing`};function St(e,t){return e===null?[...a]:a.filter(n=>t.includes(n)||e.accounts.some(e=>e.agent===n))}function Ct(e,t){let n=[...r(e.accounts,t)].sort((t,n)=>Number(n.key===e.active)-Number(t.key===e.active)||Number(wt(e,n))-Number(wt(e,t))),i=[...ft];return[...i,...new Set(n.map(e=>e.agent).filter(e=>!i.includes(e)))].map(e=>({agent:e,entries:n.filter(t=>t.agent===e)})).filter(e=>e.entries.length>0)}function wt(e,t){return e.active===t.key||e.apps.some(e=>e.account===t.key)||t.projects.length>0||t.sessions.length>0}function Tt(e){let t=null;for(let n of st(e)){let r=e?.[n]??null;if(r===null||r.used!==void 0)continue;let i=Math.round(100-Math.min(Math.max(r.usedPercentage,0),100));(t===null||i<t.free)&&(t={span:n,free:i,window:r})}return t}function Et(e,t,n){if(e.missing.includes(t))return{state:`cliMissing`};let r=e.accounts.find(e=>e.key===n&&e.agent===t);return r===void 0?{state:`noAccount`}:o(r)?{state:`unsupported`,entry:r}:{state:r.needsLogin?`signIn`:`ready`,entry:r}}var Dt=[`7d`,`30d`,`month`,`last-month`,`3m`,`year`,`all`],Ot=864e5;function kt(e){return Dt.includes(e)}function At(e){return`${e.getFullYear()}-${jt(e.getMonth()+1)}-${jt(e.getDate())}`}function jt(e){return String(e).padStart(2,`0`)}function F(e){return new Date(`${e}T00:00:00Z`)}function Mt(e){return e.toISOString().slice(0,10)}function I(e,t){return Mt(new Date(F(e).getTime()+t*Ot))}function Nt(e){let t=F(e);return Mt(new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth()+1,0)))}function Pt(e,t){let n=F(e),r=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+t,1)),i=Number(Nt(Mt(r)).slice(8));return Mt(new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),Math.min(n.getUTCDate(),i))))}function Ft(e){return Math.round((F(e.to).getTime()-F(e.from).getTime())/Ot)+1}function It(e,t,n){if(!(`preset`in e))return{from:e.from,to:e.to};let r=`${t.slice(0,7)}-01`;switch(e.preset){case`7d`:return{from:I(t,-6),to:t};case`30d`:return{from:I(t,-29),to:t};case`3m`:return{from:I(Pt(t,-3),1),to:t};case`month`:return{from:r,to:t};case`last-month`:{let e=Pt(r,-1);return{from:e,to:Nt(e)}}case`year`:return{from:`${t.slice(0,4)}-01-01`,to:t};case`all`:return{from:n!==null&&n<t?n:t,to:t}}}function Lt(e){let t=F(e.from),n=F(e.to);return(n.getUTCFullYear()-t.getUTCFullYear())*12+n.getUTCMonth()-t.getUTCMonth()+1}function Rt(e,t){return e.from.endsWith(`-01-01`)&&(e.to.endsWith(`-12-31`)||e.to===t&&e.to.slice(0,4)===t.slice(0,4))?Number(e.to.slice(0,4))-Number(e.from.slice(0,4))+1:null}function zt(e,t){return e.from.endsWith(`-01`)&&(e.to===Nt(e.to)||e.to===t)?Lt(e):null}function Bt(e,t,n){let r=Rt(e,n),i=r===null?zt(e,n):r*12;if(i!==null){let r=Pt(e.from,t*i);if(r>n)return e;let a=I(Pt(r,i),-1);return{from:r,to:a>n?n:a}}let a=Ft(e),o={from:I(e.from,t*a),to:I(e.to,t*a)};return o.to<=n?o:{from:I(n,1-a),to:n}}function Vt(e){let t=Ft(e);return{from:I(e.from,-t),to:I(e.from,-1)}}function Ht(e){let t=Ft(e);return t<=62?`day`:t<=366?`week`:`month`}function Ut(e,t){return t===`day`?e:t===`month`?`${e.slice(0,7)}-01`:I(e,-((F(e).getUTCDay()+6)%7))}function Wt(e,t){return t===`day`?I(e,1):t===`week`?I(e,7):Pt(e,1)}function Gt(e,t){let n=[];for(let r=Ut(e.from,t);r<=e.to;r=Wt(r,t))n.push(r);return n}function Kt(e,t=!0){let n=`${Number(e.slice(8))} ${u.stats.period.monthsOfDay[Number(e.slice(5,7))-1]}`;return t?`${n} ${e.slice(0,4)}`:n}function qt(e){if(e.from===e.to)return Kt(e.from);let t=e.from.slice(0,4)===e.to.slice(0,4);return`${Kt(e.from,!t)} — ${Kt(e.to)}`}function Jt(e,t){return t===`month`?`${u.stats.period.monthsShort[Number(e.slice(5,7))-1]} ${e.slice(0,4)}`:Kt(e,!1)}var Yt={opus:`Opus`,sonnet:`Sonnet`,haiku:`Haiku`,fable:`Fable`,sol:`Sol`,luna:`Luna`,astra:`Astra`,terra:`Terra`,gpt:`GPT`,deepseek:`DeepSeek`,qwen:`Qwen`,gemini:`Gemini`,kimi:`Kimi`,glm:`GLM`,mistral:`Mistral`,llama:`Llama`,minimax:`MiniMax`},Xt={chain:`Even Keel`,vscode:`VS Code`,cli:`CLI`,"tally-classify":`Tally`,codex:`Codex`,"codex-exec":`Codex CLI`,"codex-desktop":`Codex Desktop`,opencode:`OpenCode`,copilot:`GitHub Copilot`},Zt=c(e=>new Intl.NumberFormat(e,{maximumFractionDigits:0}));function Qt(e){return e===0?`$0`:e<.01?`< $0.01`:e<100?`$${e.toFixed(2)}`:`$${Zt().format(e).replace(/\s/g,` `)}`}function $t(e,t){if(t<=0)return null;let n=Math.round((e-t)/t*100);return n===0?u.units.percent(`±0`):u.units.percent(n>0?`+${n}`:`−${-n}`)}function en(e){return e===null?`—`:e===0?u.units.percent(`0`):e<1?u.units.percent(`< 1`):u.units.percent(String(Math.round(e)))}function tn(e){if(e===null)return`—`;let{hour:t,minute:n}=u.units;if(e===0)return`0 ${n}`;if(e<30)return`< 1 ${n}`;let r=Math.round(e/60);if(r<60)return`${r} ${n}`;if(r>=600)return`${Math.round(r/60)} ${t}`;let i=r%60;return i===0?`${r/60} ${t}`:`${Math.floor(r/60)} ${t} ${String(i).padStart(2,`0`)} ${n}`}function nn(e){return e===null?`—`:e<10?`${Number(e.toFixed(1))} ${u.units.second}`:e<120?`${Math.round(e)} ${u.units.second}`:e<600?`${Number((e/60).toFixed(1))} ${u.units.minute}`:tn(e)}function rn(e){return e===null?`—`:`×${e>=10?Math.round(e):Number(e.toFixed(1))}`}function an(e){return e===null?u.stats.labels.unsorted:u.stats.labels.reasons[e]??e}function on(e){return u.stats.labels.kinds[e]??e}function sn(e){return e===null?u.stats.labels.outsideChain:u.stats.labels.launches[e]??e}function cn(e){let t=/^claude-([a-z]+)((?:-\d{1,2})+)(?:-\d{8})?$/.exec(e);return t===null?e:`${Yt[t[1]]??t[1]} ${t[2].slice(1).replaceAll(`-`,`.`)}`}function ln(e){return e===`other`?u.stats.labels.otherModels:Yt[e]??e}function un(e){return e===`desktop`?u.stats.labels.desktop:e===`other`?u.stats.labels.otherEntrypoint:Xt[e]??e}function dn(e,t,n){let r=n===null||n.from<t.from?t.from:n.from,i=n===null||n.to>t.to?t.to:n.to;if(n===null||r>i)return{share:null,perWeek:!1,from:null,to:null};let a=Ft({from:r,to:i}),o=e??0;return{share:a>7?o*7/a:o,perWeek:a>7,from:r>t.from?r:null,to:i<t.to?i:null}}function fn(e){let t=new Map;for(let{account:n,peak:r,open:i}of e){let e=t.get(n)??{account:n,closed:[],open:[]};t.set(n,e),(i?e.open:e.closed).push(r)}return[...t.values()]}var L=i();function pn({title:e,question:t,confirm:n,cancel:r,busy:i,failure:a,safe:o=!1,onConfirm:s,onClose:c}){let u=(0,P.useRef)(null),d=l(u,c),f=(0,P.useId)();return(0,P.useEffect)(()=>{u.current?.open===!1&&u.current.showModal()},[]),(0,L.jsx)(`dialog`,{ref:u,className:`add-package add-package--narrow`,"aria-labelledby":f,onCancel:e=>{e.preventDefault(),e.stopPropagation(),c()},...d,children:(0,L.jsxs)(`div`,{className:`add-package__frame`,children:[(0,L.jsx)(`header`,{className:`add-package__head`,children:(0,L.jsx)(`h2`,{id:f,className:`add-package__title`,children:e})}),(0,L.jsx)(`div`,{className:`add-package__body`,children:(0,L.jsx)(`p`,{className:`add-package__question`,children:t})}),a!==void 0&&(0,L.jsx)(`p`,{role:`alert`,className:`notice notice--error add-package__failure`,children:a}),(0,L.jsxs)(`footer`,{className:`add-package__foot`,children:[(0,L.jsx)(`span`,{className:`add-package__spacer`}),(0,L.jsx)(`button`,{type:`button`,className:`button`,disabled:i,onClick:c,children:r}),(0,L.jsx)(`button`,{type:`button`,className:o?`button button--primary`:`button button--danger`,disabled:i,onClick:s,children:n})]})]})})}function mn(){}function hn(){}function gn(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?vn(e.position):`start`in e||`end`in e?vn(e):`line`in e||`column`in e?_n(e):``}function _n(e){return yn(e&&e.line)+`:`+yn(e&&e.column)}function vn(e){return _n(e&&e.start)+`-`+_n(e&&e.end)}function yn(e){return e&&typeof e==`number`?e:1}var R=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=gn(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};R.prototype.file=``,R.prototype.name=``,R.prototype.reason=``,R.prototype.message=``,R.prototype.stack=``,R.prototype.column=void 0,R.prototype.line=void 0,R.prototype.ancestors=void 0,R.prototype.cause=void 0,R.prototype.fatal=void 0,R.prototype.place=void 0,R.prototype.ruleId=void 0,R.prototype.source=void 0;var bn={};function xn(e,t){let n=t||bn;return Sn(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function Sn(e,t,n){if(wn(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return Cn(e.children,t,n)}return Array.isArray(e)?Cn(e,t,n):``}function Cn(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Sn(e[i],t,n);return r.join(``)}function wn(e){return!!(e&&typeof e==`object`)}var Tn=document.createElement(`i`);function En(e){let t=`&`+e+`;`;Tn.innerHTML=t;let n=Tn.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function z(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function B(e,t){return e.length>0?(z(e,e.length,0,t),e):t}var Dn={}.hasOwnProperty;function On(e){let t={},n=-1;for(;++n<e.length;)kn(t,e[n]);return t}function kn(e,t){let n;for(n in t){let r=(Dn.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Dn.call(r,a)||(r[a]=[]);let e=i[a];An(r[a],Array.isArray(e)?e:e?[e]:[])}}}function An(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);z(e,0,0,r)}function jn(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function V(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var H=q(/[A-Za-z]/),U=q(/[\dA-Za-z]/),Mn=q(/[#-'*+\--9=?A-Z^-~]/);function Nn(e){return e!==null&&(e<32||e===127)}var Pn=q(/\d/),Fn=q(/[\dA-Fa-f]/),In=q(/[!-/:-@[-`{-~]/);function W(e){return e!==null&&e<-2}function G(e){return e!==null&&(e<0||e===32)}function K(e){return e===-2||e===-1||e===32}var Ln=q(/\p{P}|\p{S}/u),Rn=q(/\s/);function q(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function J(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return K(r)?(e.enter(n),s(r)):t(r)}function s(r){return K(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}function zn(e,t,n,r,i,a){let o=0;return s;function s(t){return a>0&&K(t)?(e.enter(r),c(t)):l(t)}function c(t){return K(t)&&o<a?(e.consume(t),o++,c):(e.exit(r),l(t))}function l(e){return o>=i?t(e):n(e)}}var Bn={tokenize:Vn};function Vn(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null)e.consume(n);else return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),J(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null)e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);else return W(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Hn=class{constructor(){this.index=new Map,this.map=[]}add(e,t,n){Un(this,e,t,n,!1)}addBefore(e,t,n){Un(this,e,t,n,!0)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function Un(e,t,n,r,i){if(n===0&&r.length===0)return;let a=e.index.get(t);if(a){a[1]+=n,i?(r.push(...a[2]),a[2]=r):a[2].push(...r);return}let o=[t,n,r];e.map.push(o),e.index.set(t,o)}var Wn={tokenize:Kn},Gn={tokenize:qn};function Kn(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;let c=new Hn;return c.add(a+1,0,t.events.slice(n)),c.add(n,s-n,[]),c.consume(t.events),l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!(!i.currentConstruct||i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Gn,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Gn,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null)i&&v(),_(0),e.consume(n);else return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null)g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);else return W(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;let l=new Hn;l.add(a+1,0,t.events.slice(n)),l.add(n,e-n,[]),l.consume(t.events)}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function qn(e,t,n){return J(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Jn(e){if(e===null||G(e)||Rn(e))return 1;if(Ln(e))return 2}function Yn(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var Xn={name:`attention`,resolveAll:Zn,tokenize:Qn};function Zn(e,t){let n=-1,r;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){let i=n;for(;i--;)if(e[i][0]===`exit`&&e[i][1].type===`attentionSequence`&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;let a=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,o={...e[i][1].end},s={...e[n][1].start};$n(o,-a),$n(s,a);let c={type:a>1?`strongSequence`:`emphasisSequence`,start:o,end:{...e[i][1].end}},l={type:a>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:s},u={type:a>1?`strongText`:`emphasisText`,start:{...e[i][1].end},end:{...e[n][1].start}},d={type:a>1?`strong`:`emphasis`,start:{...c.start},end:{...l.end}};e[i][1].end={...c.start},e[n][1].start={...l.end},r=[],e[i][1].end.offset-e[i][1].start.offset&&(r=B(r,[[`enter`,e[i][1],t],[`exit`,e[i][1],t]])),r=B(r,[[`enter`,d,t],[`enter`,c,t],[`exit`,c,t],[`enter`,u,t]]),r=B(r,Yn(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=B(r,[[`exit`,u,t],[`enter`,l,t],[`exit`,l,t],[`exit`,d,t]]);let f=0;e[n][1].end.offset-e[n][1].start.offset&&(f=2,r=B(r,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])),z(e,i-1,n-i+3,r),n=i+r.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Qn(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Jn(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=Jn(o),u=!l||l===2&&i||n.includes(o)&&o!==42&&o!==95,d=!i||i===2&&l||n.includes(r)&&r!==42&&r!==95;return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function $n(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var er={name:`autolink`,tokenize:tr};function tr(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return H(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||U(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||U(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||Nn(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Mn(t)?(e.consume(t),l):n(t)}function u(e){return U(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||U(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var nr={partial:!0,tokenize:rr};function rr(e,t,n){return r;function r(t){return K(t)?J(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||W(e)?t(e):n(e)}}var ir={continuation:{tokenize:or},exit:sr,name:`blockQuote`,tokenize:ar};function ar(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return K(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function or(e,t,n){let r=this;return i;function i(t){return K(t)?J(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(ir,t,n)(r)}}function sr(e){e.exit(`blockQuote`)}var cr={name:`characterEscape`,tokenize:lr};function lr(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return In(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var ur={name:`characterReference`,tokenize:dr};function dr(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=U,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Fn,u):(e.enter(`characterReferenceValue`),a=7,o=Pn,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===U&&!En(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var fr={partial:!0,tokenize:pr};function pr(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var mr={concrete:!0,name:`codeFenced`,tokenize:hr};function hr(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),K(t)?J(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||W(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(fr,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||W(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):K(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),J(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||W(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||W(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&K(t)?J(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||W(t)?e.check(fr,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||W(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),K(t)?J(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),K(t)?J(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||W(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}var gr={name:`codeIndented`,tokenize:vr},_r={partial:!0,tokenize:yr};function vr(e,t,n){return r;function r(t){return e.enter(`codeIndented`),zn(e,i,n,`linePrefix`,4,4)(t)}function i(t){return t===null?o(t):W(t)?e.attempt(_r,i,o)(t):(e.enter(`codeFlowValue`),a(t))}function a(t){return t===null||W(t)?(e.exit(`codeFlowValue`),i(t)):(e.consume(t),a)}function o(n){return e.exit(`codeIndented`),t(n)}}function yr(e,t,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):W(o)?(e.enter(`lineEnding`),e.consume(o),e.exit(`lineEnding`),i):zn(e,t,a,`linePrefix`,4,4)(o)}function a(e){return W(e)?i(e):n(e)}}var br={name:`codeText`,previous:Sr,resolve:xr,tokenize:Cr};function xr(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Sr(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Cr(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):W(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||W(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var wr=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&Tr(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),Tr(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Tr(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e<this.left.length){let t=this.left.splice(e,1/0);Tr(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);Tr(this.left,t.reverse())}}}};function Tr(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Er(e){let t={},n=-1,r,i,a,o,s,c,l,u=new wr(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,Dr(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(o[1].type!==`linePrefix`&&o[1].type!==`listItemIndent`)break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return z(e,0,1/0,u.slice(0)),!l}function Dr(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var Or={resolve:Ar,tokenize:jr},kr={partial:!0,tokenize:Mr};function Ar(e){return Er(e),e}function jr(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):W(t)?e.check(kr,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function Mr(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),J(e,a,`linePrefix`)}function a(i){if(i===null||W(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Nr(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Nn(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||W(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||G(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||Nn(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function Pr(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):W(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||W(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!K(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Fr(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):W(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),J(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||W(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Ir(e,t){let n;return r;function r(i){return W(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):K(i)?J(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Lr={name:`definition`,tokenize:zr},Rr={partial:!0,tokenize:Br};function zr(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Pr.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=V(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return G(t)?Ir(e,l)(t):l(t)}function l(t){return Nr(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Rr,d,d)(t)}function d(t){return K(t)?J(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||W(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Br(e,t,n){return r;function r(t){return G(t)?Ir(e,i)(t):n(t)}function i(t){return Fr(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return K(t)?J(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||W(e)?t(e):n(e)}}var Vr={name:`hardBreakEscape`,tokenize:Hr};function Hr(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return W(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Ur={name:`headingAtx`,resolve:Wr,tokenize:Gr};function Wr(e,t){let n=e.length-2,r=3;if(e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r){let i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`};z(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])}return e}function Gr(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||G(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||W(n)?(e.exit(`atxHeading`),t(n)):K(n)?J(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||G(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Kr=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),qr=[`pre`,`script`,`style`,`textarea`],Jr={concrete:!0,name:`htmlFlow`,resolveTo:Xr,tokenize:Zr},Yr={partial:!0,tokenize:Qr};function Xr(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Zr(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:N):H(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):H(a)?(e.consume(a),i=4,r.interrupt?t:N):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:N):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return H(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||G(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&qr.includes(l)?(i=1,r.interrupt?t(s):O(s)):Kr.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||U(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return K(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||H(t)?(e.consume(t),b):K(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||U(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):K(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):K(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||W(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||G(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||K(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||W(t)?O(t):K(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),A):t===60&&i===1?(e.consume(t),j):t===62&&i===4?(e.consume(t),re):t===63&&i===3?(e.consume(t),N):t===93&&i===5?(e.consume(t),ne):W(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Yr,ie,k)(t)):t===null||W(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(fr,ee,ie)(t)}function ee(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),te}function te(t){return t===null||W(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function A(t){return t===45?(e.consume(t),N):O(t)}function j(t){return t===47?(e.consume(t),o=``,M):O(t)}function M(t){if(t===62){let n=o.toLowerCase();return qr.includes(n)?(e.consume(t),re):O(t)}return H(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),M):O(t)}function ne(t){return t===93?(e.consume(t),N):O(t)}function N(t){return t===62?(e.consume(t),re):t===45&&i===2?(e.consume(t),N):O(t)}function re(t){return t===null||W(t)?(e.exit(`htmlFlowData`),ie(t)):(e.consume(t),re)}function ie(n){return e.exit(`htmlFlow`),t(n)}}function Qr(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(nr,t,n)}}var $r={name:`htmlText`,tokenize:ei};function ei(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):H(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):H(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):W(t)?(o=d,j(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?A(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):W(t)?(o=h,j(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?A(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?A(t):W(t)?(o=v,j(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):W(t)?(o=y,j(t)):(e.consume(t),y)}function b(e){return e===62?A(e):y(e)}function x(t){return H(t)?(e.consume(t),S):n(t)}function S(t){return t===45||U(t)?(e.consume(t),S):C(t)}function C(t){return W(t)?(o=C,j(t)):K(t)?(e.consume(t),C):A(t)}function w(t){return t===45||U(t)?(e.consume(t),w):t===47||t===62||G(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),A):t===58||t===95||H(t)?(e.consume(t),E):W(t)?(o=T,j(t)):K(t)?(e.consume(t),T):A(t)}function E(t){return t===45||t===46||t===58||t===95||U(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):W(t)?(o=D,j(t)):K(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):W(t)?(o=O,j(t)):K(t)?(e.consume(t),O):(e.consume(t),ee)}function k(t){return t===i?(e.consume(t),i=void 0,te):t===null?n(t):W(t)?(o=k,j(t)):(e.consume(t),k)}function ee(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||G(t)?T(t):(e.consume(t),ee)}function te(e){return e===47||e===62||G(e)?T(e):n(e)}function A(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function j(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),M}function M(t){return K(t)?J(e,ne,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ne(t)}function ne(t){return e.enter(`htmlTextData`),o(t)}}var ti={name:`labelEnd`,resolveAll:ai,resolveTo:oi,tokenize:si},ni={tokenize:ci},ri={tokenize:li},ii={tokenize:ui};function ai(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&z(e,0,e.length,n),e}function oi(e,t){let n=e.length,r=0,i,a,o;for(;n--;){let t=e[n][1];if(i){if(t.type===`link`||t.type===`labelLink`&&t._inactive)break;e[n][0]===`enter`&&t.type===`labelLink`&&(t._inactive=!0)}else if(a){if(e[n][0]===`enter`&&(t.type===`labelImage`||t.type===`labelLink`)&&!t._balanced&&(i=n,t.type!==`labelLink`)){r=2;break}}else t.type===`labelEnd`&&(a=n)}let s={type:e[i][1].type===`labelLink`?`link`:`image`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:`label`,start:{...e[i][1].start},end:{...e[a][1].end}},l={type:`labelText`,start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return o=[[`enter`,s,t],[`enter`,c,t]],o=B(o,e.slice(i+1,i+r+3)),o=B(o,[[`enter`,l,t]]),o=B(o,Yn(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),o=B(o,[[`exit`,l,t],e[a-2],e[a-1],[`exit`,c,t]]),o=B(o,e.slice(a+1)),o=B(o,[[`exit`,s,t]]),z(e,i,e.length,o),e}function si(e,t,n){let r=this,i=r._labelStarts,a,o;if(i){for(;i.length>0&&i[i.length-1]._balanced;)i.pop();a=i[i.length-1]}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(V(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(ni,u,o?u:d)(t):t===91?e.attempt(ri,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(ii,u,d)(t)}function u(e){return i.pop(),t(e)}function d(e){return a._balanced=!0,n(e)}}function ci(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return G(t)?Ir(e,a)(t):a(t)}function a(t){return t===41?u(t):Nr(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return G(t)?Ir(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Fr(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return G(t)?Ir(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function li(e,t,n){let r=this;return i;function i(t){return Pr.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(V(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function ui(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var di={name:`labelStartImage`,resolveAll:ti.resolveAll,tokenize:fi};function fi(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),o}function o(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelImage`),s):n(t)}function s(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var pi={name:`labelStartLink`,resolveAll:ti.resolveAll,tokenize:mi};function mi(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelLink`),o}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var hi={name:`lineEnding`,tokenize:gi};function gi(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),J(e,t,`linePrefix`)}}var _i={name:`thematicBreak`,tokenize:vi};function vi(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||W(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),K(t)?J(e,s,`whitespace`)(t):s(t))}}var Y={continuation:{tokenize:Si},exit:wi,name:`list`,tokenize:xi},yi={partial:!0,tokenize:Ti},bi={partial:!0,tokenize:Ci};function xi(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:Pn(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(_i,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return Pn(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(nr,r.interrupt?n:u,e.attempt(yi,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return K(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function Si(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(nr,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,J(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!K(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(bi,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,J(e,e.attempt(Y,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Ci(e,t,n){let r=this;return J(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function wi(e){e.exit(this.containerState.type)}function Ti(e,t,n){let r=this;return J(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!K(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Ei={name:`setextUnderline`,resolveTo:Di,tokenize:Oi};function Di(e,t){let n=new Hn,r=e.length,i,a,o;for(;r--;)if(e[r][0]===`enter`){if(e[r][1].type===`content`){i=r;break}e[r][1].type===`paragraph`&&(a=r)}else e[r][1].type===`content`&&n.add(r,1,[]),!o&&e[r][1].type===`definition`&&(o=r);let s={type:`setextHeading`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type=`setextHeadingText`,o?(n.add(a,0,[[`enter`,s,t]]),n.add(o+1,0,[[`exit`,e[i][1],t]]),e[i][1].end={...e[o][1].end}):e[i][1]=s,n.add(e.length,0,[[`exit`,s,t]]),n.consume(e),e}function Oi(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),K(t)?J(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||W(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var ki={tokenize:Ai};function Ai(e){let t=this,n=e.attempt(nr,r,e.attempt(this.parser.constructs.flowInitial,i,J(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Or,i)),`linePrefix`)));return n;function r(r){if(r===null)e.consume(r);else return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null)e.consume(r);else return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var ji={resolveAll:Fi()},Mi=Pi(`string`),Ni=Pi(`text`);function Pi(e){return{resolveAll:Fi(e===`text`?Ii:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null)t.consume(e);else return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function Fi(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):t[r]&&t[r][1].type===`data`||(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function Ii(e,t){let n=new Hn,r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type===`lineEnding`)&&e[r-1][1].type===`data`){let i=e[r-1][1],a=t.sliceStream(i),o=a.length,s=-1,c=0,l;for(;o--;){let e=a[o];if(typeof e==`string`){for(s=e.length;e.charCodeAt(s-1)===32;)c++,s--;if(s)break;s=-1}else if(e===-2)l=!0,c++;else if(e!==-1){o++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(c=0),c){let a={type:r===e.length||l||c<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:o?s:i.start._bufferIndex+s,_index:i.start._index+o,line:i.end.line,column:i.end.column-c,offset:i.end.offset-c},end:{...i.end}};i.end={...a.start},i.start.offset===i.end.offset?Object.assign(i,a):n.add(r,0,[[`enter`,a,t],[`exit`,a,t]])}r++}return n.consume(e),e}var Li=e({attentionMarkers:()=>Gi,contentInitial:()=>zi,disable:()=>Ki,document:()=>Ri,flow:()=>Vi,flowInitial:()=>Bi,insideSpan:()=>Wi,string:()=>Hi,text:()=>Ui}),Ri={42:Y,43:Y,45:Y,48:Y,49:Y,50:Y,51:Y,52:Y,53:Y,54:Y,55:Y,56:Y,57:Y,62:ir},zi={91:Lr},Bi={[-2]:gr,[-1]:gr,32:gr},Vi={35:Ur,42:_i,45:[Ei,_i],60:Jr,61:Ei,95:_i,96:mr,126:mr},Hi={38:ur,92:cr},Ui={[-5]:hi,[-4]:hi,[-3]:hi,33:di,38:ur,42:Xn,60:[er,$r],91:pi,92:[Vr,cr],93:ti,95:Xn,96:br},Wi={null:[Xn,ji]},Gi={null:[42,95]},Ki={null:[]};function qi(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=B(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Yn(a,l.events,l),l.events):[]}function f(e,t){return Yi(p(e),t)}function p(e){return Ji(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){for(;r._index<o.length;){let e=o[r._index];if(typeof e==`string`){let t=r._index;for(r._bufferIndex<0&&(r._bufferIndex=0);r._index===t&&r._bufferIndex<e.length;)_(e.charCodeAt(r._bufferIndex))}else _(e)}}function _(e){u=u(e)}function v(e){W(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&z(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Ji(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Yi(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
1
+ import{n as e,r as t,t as n}from"./rolldown-runtime-XKyaHtl9.js";import{Mr as r,Rr as i,Tr as a,Zr as o,ki as s,ui as c,v as l,xi as u}from"./blocks-CrABcaPz.js";import{A as d,C as f,D as p,E as m,F as h,I as g,L as _,M as v,N as y,O as b,P as x,S,T as C,_ as w,a as T,b as E,h as D,i as O,j as k,k as ee,m as te,n as A,o as j,p as M,r as ne,s as N,t as re,u as ie,v as ae,w as oe,x as se,y as ce}from"./hooks-JRdbz0x_.js";var P=t(s(),1);P.memo(le);function le({routes:e,manifest:t,state:n,isStatic:r,onError:i}){let a=P.useContext(w);return x(a,`You must render this element inside a <DataRouterContext.Provider> element`),D(e,void 0,{router:a.router,manifest:t,state:n,isStatic:r,onError:i})}function ue({to:e,replace:t,state:n,relative:r}){x(j(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i,navigator:a}=P.useContext(E);g(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:o}=P.useContext(se),{pathname:s}=N(),c=ie(),l=d(e,m(o),s,r===`path`);C(typeof e==`string`?e:y(e),a.createHref(l),oe(a),`reject`);let u=JSON.stringify(l);return P.useEffect(()=>{c(JSON.parse(u),{replace:t,state:n,relative:r})},[c,u,r,t,n]),null}function de(e){x(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function fe({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){x(!j(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=P.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=h(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,_=P.useMemo(()=>{let e=k(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return g(_!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),_==null?null:P.createElement(E.Provider,{value:c},P.createElement(ce.Provider,{children:t,value:_}))}function pe({children:e,location:t}){return te(me(e),t)}P.Component;function me(e,t=[]){let n=[];return P.Children.forEach(e,(e,r)=>{if(!P.isValidElement(e))return;let i=[...t,r];if(e.type===P.Fragment){n.push.apply(n,me(e.props.children,i));return}x(e.type===de,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`);let a=e.props;x(!a.index||!a.children,`An index route cannot have child routes.`);let o={id:a.id||i.join(`-`),caseSensitive:a.caseSensitive,element:a.element,Component:a.Component,index:a.index,path:a.path,middleware:a.middleware,loader:a.loader,action:a.action,hydrateFallbackElement:a.hydrateFallbackElement,HydrateFallback:a.HydrateFallback,errorElement:a.errorElement,ErrorBoundary:a.ErrorBoundary,shouldRevalidate:a.shouldRevalidate,handle:a.handle,lazy:a.lazy};a.children&&(o.children=me(a.children,i)),n.push(o)}),n}var he=`application/x-www-form-urlencoded`;function ge(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function _e(e){return ge(e)&&e.tagName.toLowerCase()===`button`}function ve(e){return ge(e)&&e.tagName.toLowerCase()===`form`}function ye(e){return ge(e)&&e.tagName.toLowerCase()===`input`}function be(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function xe(e,t){return e.button===0&&(!t||t===`_self`)&&!be(e)}function Se(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Ce(e,t){let n=Se(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var we=null;function Te(){if(we===null)try{new FormData(document.createElement(`form`),0),we=!1}catch{we=!0}return we}var Ee=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function De(e){return e!=null&&!Ee.has(e)?(g(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${he}"`),null):e}function Oe(e,t){let n,r,i,a,o;if(ve(e)){let o=e.getAttribute(`action`);r=o?k(o,t):null,n=e.getAttribute(`method`)||`get`,i=De(e.getAttribute(`enctype`))||he,a=new FormData(e)}else if(_e(e)||ye(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?k(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||`get`,i=De(e.getAttribute(`formenctype`))||De(o.getAttribute(`enctype`))||he,a=new FormData(o,e),!Te()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(ge(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=`get`,r=null,i=he,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}function ke(e,t){if(e===!1||e==null)throw Error(t)}function Ae(e,t){let n=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n.pathname=n.pathname.endsWith(`/`)?`${n.pathname}_.${t}`:`${n.pathname}.${t}`,n}async function je(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Me(e){return e!=null&&typeof e.page==`string`}function Ne(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function Pe(e,t,n){return ze((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await je(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Ne).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Fe(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Ie(e,t,{includeHydrateFallback:n}={}){return Le(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function Le(e){return[...new Set(e)]}function Re(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function ze(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Me(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Re(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}var Be=P.createContext(void 0);Be.displayName=`FrameworkContext`;function Ve(){let e=P.useContext(Be);return ke(e,`You must render this element inside a <HydratedRouter> element`),e}function He(e,t){let n=P.useContext(Be),[r,i]=P.useState(!1),[a,o]=P.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=P.useRef(null);P.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),P.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:Ue(s,p),onBlur:Ue(c,m),onMouseEnter:Ue(l,p),onMouseLeave:Ue(u,m),onTouchStart:Ue(d,p)}]:[a,f,{}]:[!1,f,{}]}function Ue(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function We({page:e,...t}){let n=f(),{nonce:r}=Ve(),{router:i}=A(`PrefetchPageLinks`),a=P.useMemo(()=>i.match(e),[i,i.routes,e]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?P.createElement(Ke,{page:e,matches:a,...t}):P.createElement(qe,{page:e,matches:a,...t})):null}function Ge(e){let{manifest:t,routeModules:n}=Ve(),[r,i]=P.useState([]);return P.useEffect(()=>{let r=!1;return Pe(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Ke({page:e,matches:t,...n}){let r=N(),i=P.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Ae(e,`rsc`),i=!1,a=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?i=!0:a.push(e.route.id);return i&&a.length>0&&n.searchParams.set(`_routes`,a.join(`,`)),[n.pathname+n.search]},[e,r,t]);return P.createElement(P.Fragment,null,i.map(e=>P.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function qe({page:e,matches:t,...n}){let r=N(),{manifest:i,routeModules:a}=Ve(),{matches:o}=O(`PrefetchPageLinks`),{loaderData:s}=ne(`PrefetchPageLinks`),c=P.useMemo(()=>Fe(e,t,o,i,r,`data`),[e,t,o,i,r]),l=P.useMemo(()=>Fe(e,t,o,i,r,`assets`),[e,t,o,i,r]),u=P.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,o=!1;if(t.forEach(e=>{let t=i.routes[e.route.id];t&&t.hasLoader&&(!c.some(t=>t.route.id===e.route.id)&&e.route.id in s&&a[e.route.id]?.shouldRevalidate||t.hasClientLoader?o=!0:n.add(e.route.id))}),n.size===0)return[];let l=Ae(e,`data`);return o&&n.size>0&&l.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[l.pathname+l.search]},[s,r,i,c,t,e,a]),d=P.useMemo(()=>Ie(l,i),[l,i]),f=Ge(l);return P.createElement(P.Fragment,null,u.map(e=>P.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),d.map(e=>P.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),f.map(({key:e,link:t})=>P.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Je(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}var Ye=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Ye&&(window.__reactRouterVersion=`8`)}catch{}function Xe({basename:e,children:t,useTransitions:n,window:r}){let i=P.useRef(null);i.current??=v({window:r,v5Compat:!0});let a=i.current,[o,s]=P.useState({action:a.action,location:a.location}),c=P.useCallback(e=>{n===!1?s(e):P.startTransition(()=>s(e))},[n]);return P.useLayoutEffect(()=>a.listen(c),[a,c]),P.createElement(fe,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}var Ze=P.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:f,defaultShouldRevalidate:m,...h},g){let{basename:v,navigator:y,useTransitions:b}=P.useContext(E),x=typeof l==`string`&&_.test(l),S=ee(l,v);l=S.to;let C=T(l,{relative:r}),w=N(),D=null;if(o){let e=d(o,[],w.mask?w.mask.pathname:`/`,!0);v!==`/`&&(e.pathname=e.pathname===`/`?v:p([v,e.pathname])),D=y.createHref(e)}let[O,k,te]=He(n,h),A=et(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:f,defaultShouldRevalidate:m,useTransitions:b});function j(t){e&&e(t),t.defaultPrevented||A(t)}let M=!(S.isExternal||i),ne=P.createElement(`a`,{...h,...te,href:(M?D:void 0)||S.absoluteURL||C,onClick:M?j:e,ref:Je(g,k),target:c,"data-discover":!x&&t===`render`?`true`:void 0});return O&&!x?P.createElement(P.Fragment,null,ne,P.createElement(We,{page:C})):ne});Ze.displayName=`Link`;var Qe=P.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=M(a,{relative:c.relative}),d=N(),f=P.useContext(ae),{navigator:p,basename:m}=P.useContext(E),h=f!=null&&ot(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f?.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=k(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(y)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,w;w=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(S):i;return P.createElement(Ze,{...c,"aria-current":C,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(S):s)});Qe.displayName=`NavLink`;var $e=P.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=`get`,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=P.useContext(E),g=it(),v=at(s,{relative:l}),y=o.toLowerCase()===`get`?`get`:`post`,b=typeof s==`string`&&_.test(s);return P.createElement(`form`,{ref:m,method:y,action:v,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?P.startTransition(()=>p()):p()},...p,"data-discover":!b&&e===`render`?`true`:void 0})});$e.displayName=`Form`;function et(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=ie(),d=N(),f=M(e,{relative:o});return P.useCallback(p=>{if(xe(p,t)){p.preventDefault();let t=n===void 0?y(d)===y(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?P.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function tt(e){g(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=P.useRef(Se(e)),n=P.useRef(!1),r=N(),i=P.useMemo(()=>Ce(r.search,n.current?null:t.current),[r.search]),a=ie();return[i,P.useCallback((e,t)=>{let r=Se(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var nt=0,rt=()=>`__${String(++nt)}__`;function it(){let{router:e}=A(`useSubmit`),{basename:t}=P.useContext(E),n=re(`useSubmit`),r=e.fetch,i=e.navigate;return P.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Oe(e,t);a.navigate===!1?await r(a.fetcherKey||rt(),n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,relative:a.relative,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,relative:a.relative,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function at(e,{relative:t}={}){let{basename:n}=P.useContext(E),r=P.useContext(se);x(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...M(e||`.`,{relative:t})},o=N();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:p([n,a.pathname])),y(a)}function ot(e,{relative:t}={}){let n=P.useContext(S);x(n!=null,"`useViewTransitionState` must be used within `react-router/dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=A(`useViewTransitionState`),i=M(e,{relative:t});if(!n.isTransitioning)return!1;let a=k(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=k(n.nextLocation.pathname,r)||n.nextLocation.pathname;return b(i.pathname,o)!=null||b(i.pathname,a)!=null}function st(e){if(e?.month===void 0){let t=[`fiveHour`,`sevenDay`].filter(t=>e?.absent?.includes(t)!==!0),n=t.filter(t=>e?.[t]!=null);return e?.source===`api`&&n.length>0?n:[...t]}return[...[`fiveHour`,`sevenDay`].filter(t=>e[t]!==null),`month`]}var ct=8;function lt(e,t){if(e===void 0)return null;let n=e.accounts.find(e=>e.status?.email===t);return n===void 0?null:e.accounts.map(e=>e.key).sort().indexOf(n.key)%ct+1}function ut(e,t,n){return n!=null&&!(e?.accounts.some(e=>e.status?.email===n&&e.projects.includes(t))??!1)}function dt(e,t){let n=t.status?.email??null,r=n===null?null:lt(e,n);return r===null?e.accounts.map(e=>e.key).sort().indexOf(t.key)%ct+1:r}var ft=[`claude`,`codex`,`opencode`,`copilot`];function pt(e){return e.cloud===void 0?e.apiKey?`apiKey`:`cli`:`cloud`}function mt(e){return e.apiKey||e.cloud!==void 0}var ht=[`zen`,`claudeSubscription`,`chatgpt`,`github`,`anthropicKey`,`openaiKey`,`openrouterKey`,`bedrock`,`vertex`,`foundry`,`other`],gt={claudeSubscription:`anthropic`,anthropicKey:`anthropic`,bedrock:`aws`,vertex:`google`,foundry:`microsoft`,chatgpt:`openai`,openaiKey:`openai`,openrouterKey:`openrouter`,zen:`zen`,github:`github`,other:null};function _t(e){if(e.agent===`copilot`)return`github`;if(e.cloud!==void 0)return e.cloud.cloud;if(e.agent===`claude`)return e.apiKey?`anthropicKey`:`claudeSubscription`;if(e.agent===`codex`)return e.apiKey?`openaiKey`:`chatgpt`;if(e.agent!==`opencode`)return`other`;let t=e.status?.subscriptionType?.split(`,`).map(e=>e.trim())??[];return e.status?.authMethod===`subscription_key`?`zen`:e.apiKey?t.includes(`anthropic`)?`anthropicKey`:t.includes(`openai`)?`openaiKey`:t.includes(`openrouter`)?`openrouterKey`:`zen`:t.includes(`openai`)?`chatgpt`:t.includes(`github-copilot`)?`github`:t.includes(`anthropic`)?`claudeSubscription`:`zen`}function vt(e){return ht.map(t=>({access:t,entries:e.filter(e=>_t(e)===t)})).filter(e=>e.entries.length>0)}function yt({login:e}){return e?.agent===`codex`||e?.agent===`opencode`}function bt(e,t){return e.missing.includes(t)}var xt={claude:`login.claudeMissing`,codex:`login.codexMissing`,opencode:`login.opencodeMissing`,copilot:`login.copilotMissing`};function St(e,t){return e===null?[...a]:a.filter(n=>t.includes(n)||e.accounts.some(e=>e.agent===n))}function Ct(e,t){let n=[...r(e.accounts,t)].sort((t,n)=>Number(n.key===e.active)-Number(t.key===e.active)||Number(wt(e,n))-Number(wt(e,t))),i=[...ft];return[...i,...new Set(n.map(e=>e.agent).filter(e=>!i.includes(e)))].map(e=>({agent:e,entries:n.filter(t=>t.agent===e)})).filter(e=>e.entries.length>0)}function wt(e,t){return e.active===t.key||e.apps.some(e=>e.account===t.key)||t.projects.length>0||t.sessions.length>0}function Tt(e){let t=null;for(let n of st(e)){let r=e?.[n]??null;if(r===null||r.used!==void 0)continue;let i=Math.round(100-Math.min(Math.max(r.usedPercentage,0),100));(t===null||i<t.free)&&(t={span:n,free:i,window:r})}return t}function Et(e,t,n){if(e.missing.includes(t))return{state:`cliMissing`};let r=e.accounts.find(e=>e.key===n&&e.agent===t);return r===void 0?{state:`noAccount`}:o(r)?{state:`unsupported`,entry:r}:{state:r.needsLogin?`signIn`:`ready`,entry:r}}var Dt=[`7d`,`30d`,`month`,`last-month`,`3m`,`year`,`all`],Ot=864e5;function kt(e){return Dt.includes(e)}function At(e){return`${e.getFullYear()}-${jt(e.getMonth()+1)}-${jt(e.getDate())}`}function jt(e){return String(e).padStart(2,`0`)}function F(e){return new Date(`${e}T00:00:00Z`)}function Mt(e){return e.toISOString().slice(0,10)}function I(e,t){return Mt(new Date(F(e).getTime()+t*Ot))}function Nt(e){let t=F(e);return Mt(new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth()+1,0)))}function Pt(e,t){let n=F(e),r=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+t,1)),i=Number(Nt(Mt(r)).slice(8));return Mt(new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),Math.min(n.getUTCDate(),i))))}function Ft(e){return Math.round((F(e.to).getTime()-F(e.from).getTime())/Ot)+1}function It(e,t,n){if(!(`preset`in e))return{from:e.from,to:e.to};let r=`${t.slice(0,7)}-01`;switch(e.preset){case`7d`:return{from:I(t,-6),to:t};case`30d`:return{from:I(t,-29),to:t};case`3m`:return{from:I(Pt(t,-3),1),to:t};case`month`:return{from:r,to:t};case`last-month`:{let e=Pt(r,-1);return{from:e,to:Nt(e)}}case`year`:return{from:`${t.slice(0,4)}-01-01`,to:t};case`all`:return{from:n!==null&&n<t?n:t,to:t}}}function Lt(e){let t=F(e.from),n=F(e.to);return(n.getUTCFullYear()-t.getUTCFullYear())*12+n.getUTCMonth()-t.getUTCMonth()+1}function Rt(e,t){return e.from.endsWith(`-01-01`)&&(e.to.endsWith(`-12-31`)||e.to===t&&e.to.slice(0,4)===t.slice(0,4))?Number(e.to.slice(0,4))-Number(e.from.slice(0,4))+1:null}function zt(e,t){return e.from.endsWith(`-01`)&&(e.to===Nt(e.to)||e.to===t)?Lt(e):null}function Bt(e,t,n){let r=Rt(e,n),i=r===null?zt(e,n):r*12;if(i!==null){let r=Pt(e.from,t*i);if(r>n)return e;let a=I(Pt(r,i),-1);return{from:r,to:a>n?n:a}}let a=Ft(e),o={from:I(e.from,t*a),to:I(e.to,t*a)};return o.to<=n?o:{from:I(n,1-a),to:n}}function Vt(e){let t=Ft(e);return{from:I(e.from,-t),to:I(e.from,-1)}}function Ht(e){let t=Ft(e);return t<=62?`day`:t<=366?`week`:`month`}function Ut(e,t){return t===`day`?e:t===`month`?`${e.slice(0,7)}-01`:I(e,-((F(e).getUTCDay()+6)%7))}function Wt(e,t){return t===`day`?I(e,1):t===`week`?I(e,7):Pt(e,1)}function Gt(e,t){let n=[];for(let r=Ut(e.from,t);r<=e.to;r=Wt(r,t))n.push(r);return n}function Kt(e,t=!0){let n=`${Number(e.slice(8))} ${u.stats.period.monthsOfDay[Number(e.slice(5,7))-1]}`;return t?`${n} ${e.slice(0,4)}`:n}function qt(e){if(e.from===e.to)return Kt(e.from);let t=e.from.slice(0,4)===e.to.slice(0,4);return`${Kt(e.from,!t)} — ${Kt(e.to)}`}function Jt(e,t){return t===`month`?`${u.stats.period.monthsShort[Number(e.slice(5,7))-1]} ${e.slice(0,4)}`:Kt(e,!1)}var Yt={opus:`Opus`,sonnet:`Sonnet`,haiku:`Haiku`,fable:`Fable`,sol:`Sol`,luna:`Luna`,astra:`Astra`,terra:`Terra`,gpt:`GPT`,deepseek:`DeepSeek`,qwen:`Qwen`,gemini:`Gemini`,kimi:`Kimi`,glm:`GLM`,mistral:`Mistral`,llama:`Llama`,minimax:`MiniMax`},Xt={chain:`Even Keel`,vscode:`VS Code`,cli:`CLI`,"tally-classify":`Tally`,codex:`Codex`,"codex-exec":`Codex CLI`,"codex-desktop":`Codex Desktop`,opencode:`OpenCode`,copilot:`GitHub Copilot`},Zt=c(e=>new Intl.NumberFormat(e,{maximumFractionDigits:0}));function Qt(e){return e===0?`$0`:e<.01?`< $0.01`:e<100?`$${e.toFixed(2)}`:`$${Zt().format(e).replace(/\s/g,` `)}`}function $t(e,t){if(t<=0)return null;let n=Math.round((e-t)/t*100);return n===0?u.units.percent(`±0`):u.units.percent(n>0?`+${n}`:`−${-n}`)}function en(e){return e===null?`—`:e===0?u.units.percent(`0`):e<1?u.units.percent(`< 1`):u.units.percent(String(Math.round(e)))}function tn(e){if(e===null)return`—`;let{hour:t,minute:n}=u.units;if(e===0)return`0 ${n}`;if(e<30)return`< 1 ${n}`;let r=Math.round(e/60);if(r<60)return`${r} ${n}`;if(r>=600)return`${Math.round(r/60)} ${t}`;let i=r%60;return i===0?`${r/60} ${t}`:`${Math.floor(r/60)} ${t} ${String(i).padStart(2,`0`)} ${n}`}function nn(e){return e===null?`—`:e<10?`${Number(e.toFixed(1))} ${u.units.second}`:e<120?`${Math.round(e)} ${u.units.second}`:e<600?`${Number((e/60).toFixed(1))} ${u.units.minute}`:tn(e)}function rn(e){return e===null?`—`:`×${e>=10?Math.round(e):Number(e.toFixed(1))}`}function an(e){return e===null?u.stats.labels.unsorted:u.stats.labels.reasons[e]??e}function on(e){return u.stats.labels.kinds[e]??e}function sn(e){return e===null?u.stats.labels.outsideChain:u.stats.labels.launches[e]??e}function cn(e){let t=/^claude-([a-z]+)((?:-\d{1,2})+)(?:-\d{8})?$/.exec(e);return t===null?e:`${Yt[t[1]]??t[1]} ${t[2].slice(1).replaceAll(`-`,`.`)}`}function ln(e){return e===`other`?u.stats.labels.otherModels:Yt[e]??e}function un(e){return e===`desktop`?u.stats.labels.desktop:e===`other`?u.stats.labels.otherEntrypoint:Xt[e]??e}function dn(e,t,n){let r=n===null||n.from<t.from?t.from:n.from,i=n===null||n.to>t.to?t.to:n.to;if(n===null||r>i)return{share:null,perWeek:!1,from:null,to:null};let a=Ft({from:r,to:i}),o=e??0;return{share:a>7?o*7/a:o,perWeek:a>7,from:r>t.from?r:null,to:i<t.to?i:null}}function fn(e){let t=new Map;for(let{account:n,peak:r,open:i}of e){let e=t.get(n)??{account:n,closed:[],open:[]};t.set(n,e),(i?e.open:e.closed).push(r)}return[...t.values()]}var L=i();function pn({title:e,question:t,confirm:n,cancel:r,busy:i,failure:a,safe:o=!1,onConfirm:s,onClose:c}){let u=(0,P.useRef)(null),d=l(u,c),f=(0,P.useId)();return(0,P.useEffect)(()=>{u.current?.open===!1&&u.current.showModal()},[]),(0,L.jsx)(`dialog`,{ref:u,className:`add-package add-package--narrow`,"aria-labelledby":f,onCancel:e=>{e.preventDefault(),e.stopPropagation(),c()},...d,children:(0,L.jsxs)(`div`,{className:`add-package__frame`,children:[(0,L.jsx)(`header`,{className:`add-package__head`,children:(0,L.jsx)(`h2`,{id:f,className:`add-package__title`,children:e})}),(0,L.jsx)(`div`,{className:`add-package__body`,children:(0,L.jsx)(`p`,{className:`add-package__question`,children:t})}),a!==void 0&&(0,L.jsx)(`p`,{role:`alert`,className:`notice notice--error add-package__failure`,children:a}),(0,L.jsxs)(`footer`,{className:`add-package__foot`,children:[(0,L.jsx)(`span`,{className:`add-package__spacer`}),(0,L.jsx)(`button`,{type:`button`,className:`button`,disabled:i,onClick:c,children:r}),(0,L.jsx)(`button`,{type:`button`,className:o?`button button--primary`:`button button--danger`,disabled:i,onClick:s,children:n})]})]})})}function mn(){}function hn(){}function gn(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?vn(e.position):`start`in e||`end`in e?vn(e):`line`in e||`column`in e?_n(e):``}function _n(e){return yn(e&&e.line)+`:`+yn(e&&e.column)}function vn(e){return _n(e&&e.start)+`-`+_n(e&&e.end)}function yn(e){return e&&typeof e==`number`?e:1}var R=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=gn(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};R.prototype.file=``,R.prototype.name=``,R.prototype.reason=``,R.prototype.message=``,R.prototype.stack=``,R.prototype.column=void 0,R.prototype.line=void 0,R.prototype.ancestors=void 0,R.prototype.cause=void 0,R.prototype.fatal=void 0,R.prototype.place=void 0,R.prototype.ruleId=void 0,R.prototype.source=void 0;var bn={};function xn(e,t){let n=t||bn;return Sn(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function Sn(e,t,n){if(wn(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return Cn(e.children,t,n)}return Array.isArray(e)?Cn(e,t,n):``}function Cn(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Sn(e[i],t,n);return r.join(``)}function wn(e){return!!(e&&typeof e==`object`)}var Tn=document.createElement(`i`);function En(e){let t=`&`+e+`;`;Tn.innerHTML=t;let n=Tn.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function z(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function B(e,t){return e.length>0?(z(e,e.length,0,t),e):t}var Dn={}.hasOwnProperty;function On(e){let t={},n=-1;for(;++n<e.length;)kn(t,e[n]);return t}function kn(e,t){let n;for(n in t){let r=(Dn.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Dn.call(r,a)||(r[a]=[]);let e=i[a];An(r[a],Array.isArray(e)?e:e?[e]:[])}}}function An(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);z(e,0,0,r)}function jn(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function V(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var H=q(/[A-Za-z]/),U=q(/[\dA-Za-z]/),Mn=q(/[#-'*+\--9=?A-Z^-~]/);function Nn(e){return e!==null&&(e<32||e===127)}var Pn=q(/\d/),Fn=q(/[\dA-Fa-f]/),In=q(/[!-/:-@[-`{-~]/);function W(e){return e!==null&&e<-2}function G(e){return e!==null&&(e<0||e===32)}function K(e){return e===-2||e===-1||e===32}var Ln=q(/\p{P}|\p{S}/u),Rn=q(/\s/);function q(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function J(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return K(r)?(e.enter(n),s(r)):t(r)}function s(r){return K(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}function zn(e,t,n,r,i,a){let o=0;return s;function s(t){return a>0&&K(t)?(e.enter(r),c(t)):l(t)}function c(t){return K(t)&&o<a?(e.consume(t),o++,c):(e.exit(r),l(t))}function l(e){return o>=i?t(e):n(e)}}var Bn={tokenize:Vn};function Vn(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null)e.consume(n);else return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),J(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null)e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);else return W(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Hn=class{constructor(){this.index=new Map,this.map=[]}add(e,t,n){Un(this,e,t,n,!1)}addBefore(e,t,n){Un(this,e,t,n,!0)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function Un(e,t,n,r,i){if(n===0&&r.length===0)return;let a=e.index.get(t);if(a){a[1]+=n,i?(r.push(...a[2]),a[2]=r):a[2].push(...r);return}let o=[t,n,r];e.map.push(o),e.index.set(t,o)}var Wn={tokenize:Kn},Gn={tokenize:qn};function Kn(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;let c=new Hn;return c.add(a+1,0,t.events.slice(n)),c.add(n,s-n,[]),c.consume(t.events),l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!(!i.currentConstruct||i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Gn,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Gn,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null)i&&v(),_(0),e.consume(n);else return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null)g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);else return W(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;let l=new Hn;l.add(a+1,0,t.events.slice(n)),l.add(n,e-n,[]),l.consume(t.events)}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function qn(e,t,n){return J(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Jn(e){if(e===null||G(e)||Rn(e))return 1;if(Ln(e))return 2}function Yn(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var Xn={name:`attention`,resolveAll:Zn,tokenize:Qn};function Zn(e,t){let n=-1,r;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){let i=n;for(;i--;)if(e[i][0]===`exit`&&e[i][1].type===`attentionSequence`&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;let a=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,o={...e[i][1].end},s={...e[n][1].start};$n(o,-a),$n(s,a);let c={type:a>1?`strongSequence`:`emphasisSequence`,start:o,end:{...e[i][1].end}},l={type:a>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:s},u={type:a>1?`strongText`:`emphasisText`,start:{...e[i][1].end},end:{...e[n][1].start}},d={type:a>1?`strong`:`emphasis`,start:{...c.start},end:{...l.end}};e[i][1].end={...c.start},e[n][1].start={...l.end},r=[],e[i][1].end.offset-e[i][1].start.offset&&(r=B(r,[[`enter`,e[i][1],t],[`exit`,e[i][1],t]])),r=B(r,[[`enter`,d,t],[`enter`,c,t],[`exit`,c,t],[`enter`,u,t]]),r=B(r,Yn(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=B(r,[[`exit`,u,t],[`enter`,l,t],[`exit`,l,t],[`exit`,d,t]]);let f=0;e[n][1].end.offset-e[n][1].start.offset&&(f=2,r=B(r,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])),z(e,i-1,n-i+3,r),n=i+r.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Qn(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Jn(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=Jn(o),u=!l||l===2&&i||n.includes(o)&&o!==42&&o!==95,d=!i||i===2&&l||n.includes(r)&&r!==42&&r!==95;return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function $n(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var er={name:`autolink`,tokenize:tr};function tr(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return H(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||U(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||U(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||Nn(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Mn(t)?(e.consume(t),l):n(t)}function u(e){return U(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||U(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var nr={partial:!0,tokenize:rr};function rr(e,t,n){return r;function r(t){return K(t)?J(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||W(e)?t(e):n(e)}}var ir={continuation:{tokenize:or},exit:sr,name:`blockQuote`,tokenize:ar};function ar(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return K(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function or(e,t,n){let r=this;return i;function i(t){return K(t)?J(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(ir,t,n)(r)}}function sr(e){e.exit(`blockQuote`)}var cr={name:`characterEscape`,tokenize:lr};function lr(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return In(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var ur={name:`characterReference`,tokenize:dr};function dr(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=U,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Fn,u):(e.enter(`characterReferenceValue`),a=7,o=Pn,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===U&&!En(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var fr={partial:!0,tokenize:pr};function pr(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var mr={concrete:!0,name:`codeFenced`,tokenize:hr};function hr(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),K(t)?J(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||W(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(fr,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||W(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):K(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),J(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||W(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||W(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&K(t)?J(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||W(t)?e.check(fr,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||W(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),K(t)?J(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),K(t)?J(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||W(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}var gr={name:`codeIndented`,tokenize:vr},_r={partial:!0,tokenize:yr};function vr(e,t,n){return r;function r(t){return e.enter(`codeIndented`),zn(e,i,n,`linePrefix`,4,4)(t)}function i(t){return t===null?o(t):W(t)?e.attempt(_r,i,o)(t):(e.enter(`codeFlowValue`),a(t))}function a(t){return t===null||W(t)?(e.exit(`codeFlowValue`),i(t)):(e.consume(t),a)}function o(n){return e.exit(`codeIndented`),t(n)}}function yr(e,t,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):W(o)?(e.enter(`lineEnding`),e.consume(o),e.exit(`lineEnding`),i):zn(e,t,a,`linePrefix`,4,4)(o)}function a(e){return W(e)?i(e):n(e)}}var br={name:`codeText`,previous:Sr,resolve:xr,tokenize:Cr};function xr(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Sr(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Cr(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):W(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||W(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var wr=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&Tr(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),Tr(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Tr(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e<this.left.length){let t=this.left.splice(e,1/0);Tr(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);Tr(this.left,t.reverse())}}}};function Tr(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Er(e){let t={},n=-1,r,i,a,o,s,c,l,u=new wr(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,Dr(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(o[1].type!==`linePrefix`&&o[1].type!==`listItemIndent`)break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return z(e,0,1/0,u.slice(0)),!l}function Dr(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var Or={resolve:Ar,tokenize:jr},kr={partial:!0,tokenize:Mr};function Ar(e){return Er(e),e}function jr(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):W(t)?e.check(kr,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function Mr(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),J(e,a,`linePrefix`)}function a(i){if(i===null||W(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Nr(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Nn(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||W(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||G(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||Nn(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function Pr(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):W(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||W(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!K(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Fr(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):W(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),J(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||W(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Ir(e,t){let n;return r;function r(i){return W(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):K(i)?J(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Lr={name:`definition`,tokenize:zr},Rr={partial:!0,tokenize:Br};function zr(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Pr.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=V(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return G(t)?Ir(e,l)(t):l(t)}function l(t){return Nr(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Rr,d,d)(t)}function d(t){return K(t)?J(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||W(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Br(e,t,n){return r;function r(t){return G(t)?Ir(e,i)(t):n(t)}function i(t){return Fr(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return K(t)?J(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||W(e)?t(e):n(e)}}var Vr={name:`hardBreakEscape`,tokenize:Hr};function Hr(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return W(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Ur={name:`headingAtx`,resolve:Wr,tokenize:Gr};function Wr(e,t){let n=e.length-2,r=3;if(e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r){let i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`};z(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])}return e}function Gr(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||G(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||W(n)?(e.exit(`atxHeading`),t(n)):K(n)?J(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||G(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Kr=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),qr=[`pre`,`script`,`style`,`textarea`],Jr={concrete:!0,name:`htmlFlow`,resolveTo:Xr,tokenize:Zr},Yr={partial:!0,tokenize:Qr};function Xr(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Zr(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:N):H(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):H(a)?(e.consume(a),i=4,r.interrupt?t:N):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:N):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return H(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||G(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&qr.includes(l)?(i=1,r.interrupt?t(s):O(s)):Kr.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||U(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return K(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||H(t)?(e.consume(t),b):K(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||U(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):K(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):K(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||W(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||G(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||K(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||W(t)?O(t):K(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),A):t===60&&i===1?(e.consume(t),j):t===62&&i===4?(e.consume(t),re):t===63&&i===3?(e.consume(t),N):t===93&&i===5?(e.consume(t),ne):W(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Yr,ie,k)(t)):t===null||W(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(fr,ee,ie)(t)}function ee(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),te}function te(t){return t===null||W(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function A(t){return t===45?(e.consume(t),N):O(t)}function j(t){return t===47?(e.consume(t),o=``,M):O(t)}function M(t){if(t===62){let n=o.toLowerCase();return qr.includes(n)?(e.consume(t),re):O(t)}return H(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),M):O(t)}function ne(t){return t===93?(e.consume(t),N):O(t)}function N(t){return t===62?(e.consume(t),re):t===45&&i===2?(e.consume(t),N):O(t)}function re(t){return t===null||W(t)?(e.exit(`htmlFlowData`),ie(t)):(e.consume(t),re)}function ie(n){return e.exit(`htmlFlow`),t(n)}}function Qr(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(nr,t,n)}}var $r={name:`htmlText`,tokenize:ei};function ei(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):H(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):H(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):W(t)?(o=d,j(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?A(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):W(t)?(o=h,j(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?A(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?A(t):W(t)?(o=v,j(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):W(t)?(o=y,j(t)):(e.consume(t),y)}function b(e){return e===62?A(e):y(e)}function x(t){return H(t)?(e.consume(t),S):n(t)}function S(t){return t===45||U(t)?(e.consume(t),S):C(t)}function C(t){return W(t)?(o=C,j(t)):K(t)?(e.consume(t),C):A(t)}function w(t){return t===45||U(t)?(e.consume(t),w):t===47||t===62||G(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),A):t===58||t===95||H(t)?(e.consume(t),E):W(t)?(o=T,j(t)):K(t)?(e.consume(t),T):A(t)}function E(t){return t===45||t===46||t===58||t===95||U(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):W(t)?(o=D,j(t)):K(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):W(t)?(o=O,j(t)):K(t)?(e.consume(t),O):(e.consume(t),ee)}function k(t){return t===i?(e.consume(t),i=void 0,te):t===null?n(t):W(t)?(o=k,j(t)):(e.consume(t),k)}function ee(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||G(t)?T(t):(e.consume(t),ee)}function te(e){return e===47||e===62||G(e)?T(e):n(e)}function A(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function j(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),M}function M(t){return K(t)?J(e,ne,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ne(t)}function ne(t){return e.enter(`htmlTextData`),o(t)}}var ti={name:`labelEnd`,resolveAll:ai,resolveTo:oi,tokenize:si},ni={tokenize:ci},ri={tokenize:li},ii={tokenize:ui};function ai(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&z(e,0,e.length,n),e}function oi(e,t){let n=e.length,r=0,i,a,o;for(;n--;){let t=e[n][1];if(i){if(t.type===`link`||t.type===`labelLink`&&t._inactive)break;e[n][0]===`enter`&&t.type===`labelLink`&&(t._inactive=!0)}else if(a){if(e[n][0]===`enter`&&(t.type===`labelImage`||t.type===`labelLink`)&&!t._balanced&&(i=n,t.type!==`labelLink`)){r=2;break}}else t.type===`labelEnd`&&(a=n)}let s={type:e[i][1].type===`labelLink`?`link`:`image`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:`label`,start:{...e[i][1].start},end:{...e[a][1].end}},l={type:`labelText`,start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return o=[[`enter`,s,t],[`enter`,c,t]],o=B(o,e.slice(i+1,i+r+3)),o=B(o,[[`enter`,l,t]]),o=B(o,Yn(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),o=B(o,[[`exit`,l,t],e[a-2],e[a-1],[`exit`,c,t]]),o=B(o,e.slice(a+1)),o=B(o,[[`exit`,s,t]]),z(e,i,e.length,o),e}function si(e,t,n){let r=this,i=r._labelStarts,a,o;if(i){for(;i.length>0&&i[i.length-1]._balanced;)i.pop();a=i[i.length-1]}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(V(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(ni,u,o?u:d)(t):t===91?e.attempt(ri,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(ii,u,d)(t)}function u(e){return i.pop(),t(e)}function d(e){return a._balanced=!0,n(e)}}function ci(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return G(t)?Ir(e,a)(t):a(t)}function a(t){return t===41?u(t):Nr(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return G(t)?Ir(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Fr(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return G(t)?Ir(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function li(e,t,n){let r=this;return i;function i(t){return Pr.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(V(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function ui(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var di={name:`labelStartImage`,resolveAll:ti.resolveAll,tokenize:fi};function fi(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),o}function o(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelImage`),s):n(t)}function s(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var pi={name:`labelStartLink`,resolveAll:ti.resolveAll,tokenize:mi};function mi(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelLink`),o}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var hi={name:`lineEnding`,tokenize:gi};function gi(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),J(e,t,`linePrefix`)}}var _i={name:`thematicBreak`,tokenize:vi};function vi(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||W(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),K(t)?J(e,s,`whitespace`)(t):s(t))}}var Y={continuation:{tokenize:Si},exit:wi,name:`list`,tokenize:xi},yi={partial:!0,tokenize:Ti},bi={partial:!0,tokenize:Ci};function xi(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:Pn(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(_i,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return Pn(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(nr,r.interrupt?n:u,e.attempt(yi,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return K(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function Si(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(nr,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,J(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!K(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(bi,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,J(e,e.attempt(Y,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Ci(e,t,n){let r=this;return J(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function wi(e){e.exit(this.containerState.type)}function Ti(e,t,n){let r=this;return J(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!K(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Ei={name:`setextUnderline`,resolveTo:Di,tokenize:Oi};function Di(e,t){let n=new Hn,r=e.length,i,a,o;for(;r--;)if(e[r][0]===`enter`){if(e[r][1].type===`content`){i=r;break}e[r][1].type===`paragraph`&&(a=r)}else e[r][1].type===`content`&&n.add(r,1,[]),!o&&e[r][1].type===`definition`&&(o=r);let s={type:`setextHeading`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type=`setextHeadingText`,o?(n.add(a,0,[[`enter`,s,t]]),n.add(o+1,0,[[`exit`,e[i][1],t]]),e[i][1].end={...e[o][1].end}):e[i][1]=s,n.add(e.length,0,[[`exit`,s,t]]),n.consume(e),e}function Oi(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),K(t)?J(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||W(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var ki={tokenize:Ai};function Ai(e){let t=this,n=e.attempt(nr,r,e.attempt(this.parser.constructs.flowInitial,i,J(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Or,i)),`linePrefix`)));return n;function r(r){if(r===null)e.consume(r);else return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null)e.consume(r);else return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var ji={resolveAll:Fi()},Mi=Pi(`string`),Ni=Pi(`text`);function Pi(e){return{resolveAll:Fi(e===`text`?Ii:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null)t.consume(e);else return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function Fi(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):t[r]&&t[r][1].type===`data`||(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function Ii(e,t){let n=new Hn,r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type===`lineEnding`)&&e[r-1][1].type===`data`){let i=e[r-1][1],a=t.sliceStream(i),o=a.length,s=-1,c=0,l;for(;o--;){let e=a[o];if(typeof e==`string`){for(s=e.length;e.charCodeAt(s-1)===32;)c++,s--;if(s)break;s=-1}else if(e===-2)l=!0,c++;else if(e!==-1){o++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(c=0),c){let a={type:r===e.length||l||c<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:o?s:i.start._bufferIndex+s,_index:i.start._index+o,line:i.end.line,column:i.end.column-c,offset:i.end.offset-c},end:{...i.end}};i.end={...a.start},i.start.offset===i.end.offset?Object.assign(i,a):n.add(r,0,[[`enter`,a,t],[`exit`,a,t]])}r++}return n.consume(e),e}var Li=e({attentionMarkers:()=>Gi,contentInitial:()=>zi,disable:()=>Ki,document:()=>Ri,flow:()=>Vi,flowInitial:()=>Bi,insideSpan:()=>Wi,string:()=>Hi,text:()=>Ui}),Ri={42:Y,43:Y,45:Y,48:Y,49:Y,50:Y,51:Y,52:Y,53:Y,54:Y,55:Y,56:Y,57:Y,62:ir},zi={91:Lr},Bi={[-2]:gr,[-1]:gr,32:gr},Vi={35:Ur,42:_i,45:[Ei,_i],60:Jr,61:Ei,95:_i,96:mr,126:mr},Hi={38:ur,92:cr},Ui={[-5]:hi,[-4]:hi,[-3]:hi,33:di,38:ur,42:Xn,60:[er,$r],91:pi,92:[Vr,cr],93:ti,95:Xn,96:br},Wi={null:[Xn,ji]},Gi={null:[42,95]},Ki={null:[]};function qi(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=B(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Yn(a,l.events,l),l.events):[]}function f(e,t){return Yi(p(e),t)}function p(e){return Ji(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){for(;r._index<o.length;){let e=o[r._index];if(typeof e==`string`){let t=r._index;for(r._bufferIndex<0&&(r._bufferIndex=0);r._index===t&&r._bufferIndex<e.length;)_(e.charCodeAt(r._bufferIndex))}else _(e)}}function _(e){u=u(e)}function v(e){W(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&z(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Ji(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Yi(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
2
2
  `;break;case-3:o=`\r
3
3
  `;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function Xi(e){let t={constructs:On([Li,...(e||{}).extensions||[]]),content:n(Bn),defined:[],document:n(Wn),flow:n(ki),lazy:{},string:n(Mi),text:n(Ni)};return t;function n(e){return n;function n(n){return qi(t,e,n)}}}function Zi(e){for(;!Er(e););return e}var Qi=/[\0\t\n\r]/g;function $i(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i));let s=[],c=0;for(t=``,n&&=(i.charCodeAt(0)===65279&&c++,void 0);c<i.length;){Qi.lastIndex=c;let n=Qi.exec(i),a=n&&n.index!==void 0?n.index:i.length,o=i.charCodeAt(a);if(!n){t=i.slice(c);break}if(o===10&&c===a&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),c<a&&(s.push(i.slice(c,a)),e+=a-c),o){case 0:s.push(65533),e++;break;case 9:{let t=Math.ceil(e/4)*4;for(s.push(-2);e++<t;)s.push(-1);break}case 10:s.push(-4),e=1;break;default:r=!0,e=1}c=a+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var ea=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function ta(e){return e.replace(ea,na)}function na(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return jn(n.slice(t?2:1),t?16:10)}return En(n)||e}var ra={}.hasOwnProperty;function ia(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),aa(n)(Zi(Xi(n).document().write($i()(e,t,!0))))}function aa(e){let t={afterExit:[],beforeEnter:[],transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:o(xe),autolinkProtocol:E,autolinkEmail:E,atxHeading:o(_e),blockQuote:o(fe),characterEscape:E,characterReference:E,codeFenced:o(pe),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:o(pe,s),codeText:o(me,s),codeTextData:E,data:E,codeFlowValue:E,definition:o(he),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:o(ge),hardBreakEscape:o(ve),hardBreakTrailing:o(ve),htmlFlow:o(ye,s),htmlFlowData:E,htmlText:o(ye,s),htmlTextData:E,image:o(be),label:s,link:o(xe),listItem:o(Ce),listItemValue:p,listOrdered:o(Se,f),listUnordered:o(Se),paragraph:o(we),reference:oe,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:o(_e),strong:o(Te),thematicBreak:o(De)},exit:{atxHeading:l(),atxHeadingSequence:S,autolink:l(),autolinkEmail:de,autolinkProtocol:ue,blockQuote:l(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:ce,characterReferenceMarkerNumeric:ce,characterReferenceValue:P,characterReference:le,codeFenced:l(_),codeFencedFence:g,codeFencedFenceInfo:m,codeFencedFenceMeta:h,codeFlowValue:D,codeIndented:l(v),codeText:l(A),codeTextData:D,data:D,definition:l(),definitionDestinationString:x,definitionLabelString:y,definitionTitleString:b,emphasis:l(),hardBreakEscape:l(k),hardBreakTrailing:l(k),htmlFlow:l(ee),htmlFlowData:D,htmlText:l(te),htmlTextData:D,image:l(M),label:N,labelText:ne,lineEnding:O,link:l(j),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:se,resourceDestinationString:re,resourceTitleString:ie,resource:ae,setextHeading:l(T),setextHeadingLineSequence:w,setextHeadingText:C,strong:l(),thematicBreak:l()}};oa(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[],position:void 0},o={stack:[r],tokenStack:[],config:t,enter:c,exit:u,buffer:s,resume:d,data:n},l=[],f=[],p=-1;for(;++p<e.length;)f.push(e[p]),(e[p][1].type===`listOrdered`||e[p][1].type===`listUnordered`)&&(e[p][0]===`enter`?l.push(f.length-1):a(f,l.pop()));for(e=f,p=-1;++p<e.length;){let n=t[e[p][0]];e[p][0]===`enter`&&t.beforeEnter.length>0&&i(t.beforeEnter,{...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1]),ra.call(n,e[p][1].type)&&n[e[p][1].type].call({...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1]),e[p][0]===`exit`&&t.afterExit.length>0&&i(t.afterExit,{...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1])}if(o.tokenStack.length>0){let e=o.tokenStack[o.tokenStack.length-1];(e[1]||ca).call(o,void 0,e[0])}for(r.position={start:X(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:X(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},p=-1;++p<t.transforms.length;)r=t.transforms[p](r)||r;return r}function i(e,t,n){let r=-1;for(;++r<e.length;)e[r].call(t,n)}function a(e,t){let n=e.length-1,r=t-1,i=-1,a=!1,o,s,c,l,u=[];for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let n=r;for(s=void 0;n--;){let t=e[n];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=n}else if(t[1].type!==`linePrefix`&&t[1].type!==`blockQuotePrefix`&&t[1].type!==`blockQuotePrefixWhitespace`&&t[1].type!==`blockQuoteMarker`&&t[1].type!==`listItemIndent`)break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),u.push({at:s||r,event:[`exit`,o,t[2]]})}if(t[1].type===`listItemPrefix`){let e={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=e,u.push({at:r,event:[`enter`,e,t[2]]}),c=void 0,l=!0}}}let d=e.splice(t),f=0;for(r=-1;++r<d.length;){for(;f<u.length&&u[f].at===t+r;)e.push(u[f++].event);e.push(d[r])}e[t][1]._spread=a}function o(e,t){return n;function n(n){c.call(this,e(n),n),t&&t.call(this,n)}}function s(){this.stack.push({type:`fragment`,children:[]})}function c(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:X(t.start),end:void 0}}function l(e){return t;function t(t){e&&e.call(this,t),u.call(this,t)}}function u(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(!r)throw Error("Cannot close `"+e.type+"` ("+gn({start:e.start,end:e.end})+`): it’s not open`);r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||ca).call(this,e,r[0])),n.position.end=X(e.end)}function d(){return xn(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function p(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function h(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function v(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function y(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=V(this.sliceSerialize(e)).toLowerCase()}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function x(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function S(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function C(){this.data.setextHeadingSlurpLineEnding=!0}function w(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function E(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];n&&n.type===`text`||(n=Ee(),n.position={start:X(e.start),end:void 0},t.push(n)),this.stack.push(n)}function D(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=X(e.end)}function O(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=X(e.end),this.data.atHardBreak=void 0}else!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(E.call(this,e),D.call(this,e))}function k(){this.data.atHardBreak=!0}function ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function ne(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=ta(t),n.identifier=V(t).toLowerCase()}function N(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function re(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function ie(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ae(){this.data.inReference=void 0}function oe(){this.data.referenceType=`collapsed`}function se(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=V(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function ce(e){this.data.characterReferenceType=e.type}function P(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=jn(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=En(t);let i=this.stack[this.stack.length-1];i.value+=r}function le(e){let t=this.stack.pop();t.position.end=X(e.end)}function ue(e){D.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function de(e){D.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function fe(){return{type:`blockquote`,children:[],position:void 0}}function pe(){return{type:`code`,lang:null,meta:null,value:``,position:void 0}}function me(){return{type:`inlineCode`,value:``,position:void 0}}function he(){return{type:`definition`,identifier:``,label:null,title:null,url:``,position:void 0}}function ge(){return{type:`emphasis`,children:[],position:void 0}}function _e(){return{type:`heading`,depth:0,children:[],position:void 0}}function ve(){return{type:`break`,position:void 0}}function ye(){return{type:`html`,value:``,position:void 0}}function be(){return{type:`image`,title:null,url:``,alt:null,position:void 0}}function xe(){return{type:`link`,title:null,url:``,children:[],position:void 0}}function Se(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[],position:void 0}}function Ce(e){return{type:`listItem`,spread:e._spread,checked:null,children:[],position:void 0}}function we(){return{type:`paragraph`,children:[],position:void 0}}function Te(){return{type:`strong`,children:[],position:void 0}}function Ee(){return{type:`text`,value:``,position:void 0}}function De(){return{type:`thematicBreak`,position:void 0}}}function X(e){return{line:e.line,column:e.column,offset:e.offset}}function oa(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?oa(e,r):sa(e,r)}}function sa(e,t){let n;for(n in t)if(ra.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`afterExit`:case`beforeEnter`:{let r=t[n];r&&e[n].push(r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function ca(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+gn({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+gn({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+gn({start:t.start,end:t.end})+`) is still open`)}function la(e){let t=this;t.parser=n;function n(n){return ia(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}var ua=(function(e){if(e==null)return ha;if(typeof e==`function`)return ma(e);if(typeof e==`object`)return Array.isArray(e)?da(e):fa(e);if(typeof e==`string`)return pa(e);throw Error(`Expected function, string, or object as test`)});function da(e){let t=[],n=-1;for(;++n<e.length;)t[n]=ua(e[n]);return ma(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function fa(e){let t=e;return ma(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function pa(e){return ma(t);function t(t){return t&&t.type===e}}function ma(e){return t;function t(t,n,r){return!!(ga(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function ha(){return!0}function ga(e){return typeof e==`object`&&!!e&&`type`in e}function _a(e){return e}var va=[];function ya(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=ua(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+_a(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=va,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=ba(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function ba(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?va:[e]}function xa(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),ya(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}function Sa(e){if(e)throw e}var Ca=t(n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}))(),1);function wa(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Ta(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a)r(a);else{for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?Ea(s,i)(...o):r(null,...o)}}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function Ea(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var Z={basename:Da,dirname:Oa,extname:ka,join:Aa,sep:`/`};function Da(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);Na(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Oa(e){if(Na(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function ka(e){Na(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}}else n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function Aa(...e){let t=-1,n;for(;++t<e.length;)Na(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:ja(n)}function ja(e){Na(e);let t=e.codePointAt(0)===47,n=Ma(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function Ma(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(i!==o-1&&a!==1){if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1}i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function Na(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var Pa={cwd:Fa};function Fa(){return`/`}function Ia(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function La(e){if(typeof e==`string`)e=new URL(e);else if(!Ia(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return Ra(e)}function Ra(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var za=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],Ba=class{constructor(e){let t;t=e?Ia(e)?{path:e}:typeof e==`string`||Wa(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:Pa.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<za.length;){let e=za[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)za.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?Z.basename(this.path):void 0}set basename(e){Ha(e,`basename`),Va(e,`basename`),this.path=Z.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?Z.dirname(this.path):void 0}set dirname(e){Ua(this.basename,`dirname`),this.path=Z.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?Z.extname(this.path):void 0}set extname(e){if(Va(e,`extname`),Ua(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=Z.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){Ia(e)&&(e=La(e)),Ha(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?Z.basename(this.path,this.extname):void 0}set stem(e){Ha(e,`stem`),Va(e,`stem`),this.path=Z.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new R(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function Va(e,t){if(e&&e.includes(Z.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+Z.sep+"`")}function Ha(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function Ua(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function Wa(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Ga=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),Ka={}.hasOwnProperty,qa=new class e extends Ga{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Ta()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,Ca.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(Xa(`data`,this.frozen),this.namespace[e]=t,this):Ka.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Xa(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=$a(e),n=this.parser||this.Parser;return Ja(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),Ja(`process`,this.parser||this.Parser),Ya(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=$a(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);to(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),Ja(`processSync`,this.parser||this.Parser),Ya(`processSync`,this.compiler||this.Compiler),this.process(e,r),Qa(`processSync`,`process`,t),n;function r(e,r){t=!0,Sa(e),n=r}}run(e,t,n){Za(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=$a(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),Qa(`runSync`,`run`,n),r;function i(e,t){Sa(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=$a(t),r=this.compiler||this.Compiler;return Ya(`stringify`,r),Za(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(Xa(`use`,this.frozen),e!=null){if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`")}return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`){if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e)}else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,Ca.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null){if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];wa(o)&&wa(r)&&(r=(0,Ca.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function Ja(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function Ya(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function Xa(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Za(e){if(!wa(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function Qa(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function $a(e){return eo(e)?e:new Ba(e)}function eo(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function to(e){return typeof e==`string`||no(e)}function no(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}function ro(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function io(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function ao(e,t,n){let r=ua((n||{}).ignore||[]),i=oo(t),a=-1;for(;++a<i.length;)ya(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1)r.lastIndex=n+1;else{if(s!==n&&f({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a))for(let e of a)f(e);else a&&f(a);s=n+d[0].length,l=!0}if(!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&f({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length;function f(e){let t=u[u.length-1];t&&t.type===`text`&&e.type===`text`?t.value+=e.value:u.push(e)}}}function oo(e){if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let t=[],n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([so(e[0]),co(e[1])])}return t}function so(e){return typeof e==`string`?new RegExp(io(e),`g`):e}function co(e){return typeof e==`function`?e:function(){return e}}var lo=`phrasing`,uo=[`autolink`,`link`,`image`,`label`];function fo(){return{transforms:[bo],enter:{literalAutolink:mo,literalAutolinkEmail:ho,literalAutolinkHttp:ho,literalAutolinkWww:ho},exit:{literalAutolink:yo,literalAutolinkEmail:vo,literalAutolinkHttp:go,literalAutolinkWww:_o}}}function po(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:lo,notInConstruct:uo},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:lo,notInConstruct:uo},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:lo,notInConstruct:uo}]}}function mo(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function ho(e){this.config.enter.autolinkProtocol.call(this,e)}function go(e){this.config.exit.autolinkProtocol.call(this,e)}function _o(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function vo(e){this.config.exit.autolinkEmail.call(this,e)}function yo(e){this.exit(e)}function bo(e){ao(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,xo],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,So]],{ignore:[`link`,`linkReference`]})}function xo(e,t,n,r,i){let a=``;if(!To(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!Co(n)))return!1;let o=wo(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function So(e,t,n,r){return!To(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function Co(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function wo(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=ro(e,`(`),a=ro(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function To(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||Rn(n)||Ln(n))&&(!t||n!==47)}Fo.peek=Po;function Eo(){this.buffer()}function Do(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function Oo(){this.buffer()}function ko(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function Ao(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=V(this.sliceSerialize(e)).toLowerCase(),n.label=t}function jo(e){this.exit(e)}function Mo(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=V(this.sliceSerialize(e)).toLowerCase(),n.label=t}function No(e){this.exit(e)}function Po(){return`[`}function Fo(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function Io(){return{enter:{gfmFootnoteCallString:Eo,gfmFootnoteCall:Do,gfmFootnoteDefinitionLabelString:Oo,gfmFootnoteDefinition:ko},exit:{gfmFootnoteCallString:Ao,gfmFootnoteCall:jo,gfmFootnoteDefinitionLabelString:Mo,gfmFootnoteDefinition:No}}}function Lo(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Fo},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
4
4
  `:` `)+r.indentLines(r.containerFlow(e,a.current()),t?zo:Ro))),s(),o}}function Ro(e,t,n){return t===0?e:zo(e,t,n)}function zo(e,t,n){return(n?``:` `)+e}var Bo=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];Go.attention=Ko,Go.peek=qo;function Vo(){return{canContainEols:[`delete`],enter:{strikethrough:Uo},exit:{strikethrough:Wo}}}function Ho(){return{handlers:{delete:Go},unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:Bo}]}}function Uo(e){this.enter({type:`delete`,children:[],position:void 0},e)}function Wo(e){this.exit(e)}function Go(e,t,n,r){let i=n.createTracker(r),a=n.stack.includes(`strikethrough`)?`~`:`~~`,o=n.enter(`strikethrough`),s=i.move(a);return s+=n.containerPhrasing(e,{...i.current(),before:s,after:`~`}),s+=i.move(a),o(),s}function Ko(){return{construct:`strikethrough`,markers:[`~`],sizes:[2,1]}}function qo(){return`~`}function Jo(e){return e.length}function Yo(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Jo,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=Xo(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=Zo(r[d]);else{let e=Zo(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding===!1||n.alignDelimiters===!1&&i===``||n.delimiterStart===!1&&!d||r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{A as t,B as n,Br as r,C as i,D as a,Dn as o,Ei as s,Er as c,F as l,Fn as u,Ft as d,Gt as f,I as p,J as m,Jt as h,Kt as g,Ln as _,Lr as v,Nn as y,Ot as b,P as x,Pr as S,Q as C,Qt as w,Rr as T,Wt as E,Xr as D,Xt as O,Yt as k,b as A,ht as j,i as M,it as N,j as P,k as F,ki as ee,lt as I,m as te,mi as L,nt as ne,p as re,pi as R,t as ie,u as ae,ui as oe,v as z,w as se,x as B,xi as V,yr as ce}from"./blocks-BTQTnJ34.js";import{t as le}from"./react-dom-CDxcrI4x.js";import{s as ue,u as de}from"./hooks-CDqQcVnS.js";import{W as fe,Y as pe,Z as me,nt as he,ot as ge,u as _e}from"./lib-DUH5hYcn.js";import{$ as ve,A as ye,B as be,C as xe,D as Se,E as Ce,F as we,G as Te,H as Ee,I as De,L as Oe,M as ke,N as Ae,O as je,P as Me,R as Ne,S as H,St as Pe,T as Fe,V as Ie,a as Le,at as Re,bt as ze,ct as Be,dt as Ve,et as He,ft as Ue,i as We,it as Ge,j as Ke,nt as qe,o as Je,rt as Ye,st as Xe,tt as Ze,w as Qe,xt as $e,z as et}from"./accountParts-B-b8vNCY.js";import{c as tt,i as nt,n as rt,o as U,r as it,s as W,t as at}from"./rules-CVcjwHXa.js";import{t as G}from"./Select-BMRSXvrD.js";import{p as ot,s as st}from"./packageGroups-D15r6pKX.js";import{t as ct}from"./secret-CmK85pY6.js";var K={to:`shared`,tab:`trackers`},lt={to:`shared`,tab:`page`},ut={to:`accounts`},dt={"storage.backupFailed":{to:`shared`,tab:`backup`},"storage.backupCheckFailed":{to:`shared`,tab:`backup`},"agent.copyMissing":{to:`shared`,tab:`models`},"agent.copyFailed":{to:`shared`,tab:`models`},"copilot.binaryMissing":{to:`shared`,tab:`models`},"git.noBranch":{to:`project`,tab:`repo`},"git.wrongBranch":{to:`project`,tab:`repo`},"project.gitDirty":{to:`project`,tab:`repo`},"forward.foreign":{to:`project`,tab:`repo`},"chain.emptyLabels":{to:`project`,tab:`tracker`},"chain.emptyStatus":{to:`project`,tab:`tracker`},"prompt.empty":{to:`project`,tab:`sessions`},"chain.unknownModel":{to:`project`,tab:`sessions`},"chain.modelUnavailable":{to:`project`,tab:`sessions`},"chain.opencodeCopilot":{to:`project`,tab:`sessions`},"copilot.modelUnavailable":{to:`project`,tab:`sessions`},"copilot.notSignedIn":ut,"chain.limitSpent":{to:`project`,tab:`sessions`},"changelog.limitSpent":{to:`project`,tab:`sessions`},"account.signedOut":ut,"usage.goKeyExpired":ut,"account.loginExpired":ut,"account.activeGone":ut,"account.sharedPool":{to:`shared`,tab:`models`},"profiles.paused":K,"task.relabelFailed":K,"ci.noToken":K,"ci.denied":K,"ci.rerunDenied":K,"review.denied":K,"config.token":lt,"config.tokenShape":lt,"builtin.fileTooLarge":lt,"claude.untrusted":{to:`resume`},"claude.trustWriteFailed":{to:`resume`},"git.missing":{to:`resume`},"git.noIdentity":{to:`identity`},"git.found":{to:`gitOn`},"chain.packagesNotReady":{to:`packages`},"order.later":{to:`milestoneOrder`},"order.against":{to:`milestoneOrder`}};function ft(e){if(e==null)return null;if(e.code===`tracker.completeRefused`){let{task:t,level:n}=e.params;return n===void 0?{to:`tracker`,task:t}:{to:`moves`,level:n,task:t}}if(e.code===`profiles.disabled`)return{to:`enableProfile`,profile:e.params.id};if(e.code===`profiles.chainsRunning`)return{to:`stopChains`,projects:e.params.projects.split(`,`).filter(e=>e!==``)};if(e.code===`statusMove.refused`||e.code===`statusMove.outside`||e.code===`statusMove.notDone`)return{to:`moves`,level:e.params.level,task:e.params.task};let t=dt[e.code];if(t!==void 0)return t;for(let t of e.items??[]){let e=ft(t);if(e!==null)return e}return ft(e.cause)}var pt={repo:[`repo`,`branch`,`mergeInto`,`carryAgent`,`slot`,`changelog`,`color`],tracker:[`tracker`,`trackerProject`,`fillMilestone`,`chain`],sessions:[`provider`,`models`,`accounts`,`brief`,`prompt`,`beforeStart`,`promptLanguage`,`cacheTtl`,`autoCompactWindow`,`codexAutoCompactWindow`,`openCodeAutoCompactWindow`,`contextHandoffs`,`checkpointTokens`,`checkpointShares`],ci:[`check`,`afterGreen`,`ci`,`pullRequests`]},mt={chain:[`parallel`,`brief`,`fillMilestone`,`defaultGit`,`chain`],models:[`provider`,`models`,`accounts`,`autoCompactWindow`,`codexAutoCompactWindow`,`openCodeAutoCompactWindow`,`execution`,`cli`,`cliCheck`,`modelPrompts`,`promptLanguage`],sessions:[`hiddenSkills`,`context`,`contextHandoffs`,`checkpointTokens`,`checkpointShares`,`cacheTtl`,`keepWarm`],ci:[`ci`],page:[`language`,`allowedHosts`,`attachmentLimit`],backup:[`backupDir`,`backupKeep`,`backup`],stats:[`stats`]};function ht({project:e,field:t}){let n=t.split(`.`)[0];if(e===null){let e=Object.keys(mt).find(e=>mt[e].includes(n));return e===void 0?null:{to:`shared`,tab:e}}let r=Object.keys(pt).find(e=>pt[e].includes(n));return r===void 0?null:{to:`project`,project:e,tab:r}}function gt({config:e,configError:t}){if(t===null)return null;let n=e.trackers.flatMap(e=>e.projectKey===null?[]:[e.projectKey.key]),r=w(t,n);return r===null?null:ht(r)}var q=e(ee(),1),_t=new Set([`http`,`https`,`ssh`,`git`,`git+ssh`,`ssh+git`]),vt=/^([a-z][a-z0-9+.-]*):\/\/(.*)$/i,yt=/^(?:[^@/\s]*@)?(\[[^\]]+\]|[^/:\s]+)/,bt=/^(?:[^@\s]+@)?([^@\s:]+):(\S+)$/;function xt(e,t){if(e===``)return{kind:`blank`};let n=e.trim();if(n===``||/[\u0000-\u001f\u007f]/.test(n))return{kind:`none`};let r=t===void 0||t===`win32`,i=vt.exec(n);if(i!==null){let e=yt.exec(i[2]);return!_t.has(i[1].toLowerCase())||/\s/.test(n)||e===null?{kind:`none`}:{kind:`address`,host:e[1]}}let a=n.indexOf(`:`),o=n.indexOf(`/`),s=r&&/^[a-z]:/i.test(n);if(a>=0&&!s&&(o<0||a<o)){let e=bt.exec(n);return e===null?{kind:`none`}:{kind:`address`,host:e[1]}}return(r?/^(?:[a-z]:)?[\\/]/i.test(n):n.startsWith(`/`))||n===`~`||(r?/^~[\\/]/:/^~\//).test(n)?{kind:`path`}:/[\\/~:]/.test(n)||n===`.`||n===`..`?{kind:`relative`}:/\s/.test(n)?{kind:`none`}:{kind:`name`}}var St={git:!0,target:``,folder:``,other:!1,repo:``,branch:``,key:``,name:``,tracker:``,trackerProject:``,team:``,profile:``,place:`worktree`,slots:`2`,milestones:``,provider:``,typed:{key:!1,name:!1,trackerProject:!1}};function Ct(e){return e?.projectKey==null?`key`:e.projectKey.alias?`alias`:e.projectKey.optional?`within`:`place`}var wt=e=>e!==`key`;function Tt(e,t,n){return n===null?null:n.code===`wizard.trackerShared`?`milestones`:n.code===`wizard.keyShape`||n.code===`wizard.keyTaken`?e.key.trim()===``?null:wt(t)?`key`:`tracker`:n.code===`wizard.trackerPlace`&&(t===`key`?e.key:t===`within`?e.team:e.trackerProject).trim()===``?null:`tracker`}function Et(e,t){return e===`alias`?t.trackerProject.trim():e===`within`?t.team.trim():``}function Dt(e){let t=e.team.trim();return t===``||t===e.key.trim()?e.trackerProject:`${t}/${e.trackerProject}`}var Ot=/^([A-Z][A-Z0-9_]{0,6})\/(.*)$/;function kt(e,t){let n=e.trackerProject;if(t===`key`&&(n=e.key),t===`within`){let t=Ot.exec(e.trackerProject);n=t===null?`${e.key}/${e.trackerProject}`:`${t[1]}/${t[2].trim()}`}return JSON.stringify([e.tracker,e.profile,n,e.milestones])}function At(e,t,n){let r=e===`within`?Ot.exec(n.trim()):null;return r===null||r[1]===t?{team:``,trackerProject:r?.[2]??n}:{team:r[1],trackerProject:r[2]}}var jt=5,Mt=e=>e.git&&xt(e.target).kind===`address`,Nt=e=>e.other&&(!e.git||Mt(e));function Pt(e){return e.git&&e.target===``?!0:Nt(e)&&e.repo.trim()===``}function Ft(e,t){let n=!Nt(e)&&e.folder.trim()===``,r=!Mt(e)||!n||t.answer||t.remoteHeard;return!r||t.answer?{shown:r,note:null}:{shown:r,note:t.pending?`checking`:n?`blank`:null}}function It(e,t=!1){let n=0;if(e.git&&e.place===`slots`){let t=e.slots.trim();if(n=/^\d+$/.test(t)?Number(t):0,n<1)return}let r=Nt(e),i=!e.git||Mt(e);return{repo:r?e.repo.trim():``,branch:e.git?e.branch.trim():``,key:e.key.trim(),name:e.name.trim(),tracker:e.tracker,trackerProject:Dt({...e,trackerProject:e.trackerProject.trim()}),profile:e.profile===``||t?null:e.profile,slot:n,milestones:e.milestones.split(`
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{A as t,B as n,Br as r,C as i,D as a,Dn as o,Ei as s,Er as c,F as l,Fn as u,Ft as d,Gt as f,I as p,J as m,Jt as h,Kt as g,Ln as _,Lr as v,Nn as y,Ot as b,P as x,Pr as S,Q as C,Qt as w,Rr as T,Wt as E,Xr as D,Xt as O,Yt as k,b as A,ht as j,i as M,it as N,j as P,k as F,ki as ee,lt as I,m as te,mi as L,nt as ne,p as re,pi as R,t as ie,u as ae,ui as oe,v as z,w as se,x as B,xi as V,yr as ce}from"./blocks-CrABcaPz.js";import{t as le}from"./react-dom-BrsVbrva.js";import{s as ue,u as de}from"./hooks-JRdbz0x_.js";import{W as fe,Y as pe,Z as me,nt as he,ot as ge,u as _e}from"./lib-BWXVCBDM.js";import{$ as ve,A as ye,B as be,C as xe,D as Se,E as Ce,F as we,G as Te,H as Ee,I as De,L as Oe,M as ke,N as Ae,O as je,P as Me,R as Ne,S as H,St as Pe,T as Fe,V as Ie,a as Le,at as Re,bt as ze,ct as Be,dt as Ve,et as He,ft as Ue,i as We,it as Ge,j as Ke,nt as qe,o as Je,rt as Ye,st as Xe,tt as Ze,w as Qe,xt as $e,z as et}from"./accountParts-BgNHNRlI.js";import{c as tt,i as nt,n as rt,o as U,r as it,s as W,t as at}from"./rules-LK65q0Fp.js";import{t as G}from"./Select-BkfVMQn9.js";import{p as ot,s as st}from"./packageGroups-Bp5E3IBW.js";import{t as ct}from"./secret-CmK85pY6.js";var K={to:`shared`,tab:`trackers`},lt={to:`shared`,tab:`page`},ut={to:`accounts`},dt={"storage.backupFailed":{to:`shared`,tab:`backup`},"storage.backupCheckFailed":{to:`shared`,tab:`backup`},"agent.copyMissing":{to:`shared`,tab:`models`},"agent.copyFailed":{to:`shared`,tab:`models`},"copilot.binaryMissing":{to:`shared`,tab:`models`},"git.noBranch":{to:`project`,tab:`repo`},"git.wrongBranch":{to:`project`,tab:`repo`},"project.gitDirty":{to:`project`,tab:`repo`},"forward.foreign":{to:`project`,tab:`repo`},"chain.emptyLabels":{to:`project`,tab:`tracker`},"chain.emptyStatus":{to:`project`,tab:`tracker`},"prompt.empty":{to:`project`,tab:`sessions`},"chain.unknownModel":{to:`project`,tab:`sessions`},"chain.modelUnavailable":{to:`project`,tab:`sessions`},"chain.opencodeCopilot":{to:`project`,tab:`sessions`},"copilot.modelUnavailable":{to:`project`,tab:`sessions`},"copilot.notSignedIn":ut,"chain.limitSpent":{to:`project`,tab:`sessions`},"changelog.limitSpent":{to:`project`,tab:`sessions`},"account.signedOut":ut,"usage.goKeyExpired":ut,"account.loginExpired":ut,"account.activeGone":ut,"account.sharedPool":{to:`shared`,tab:`models`},"profiles.paused":K,"task.relabelFailed":K,"ci.noToken":K,"ci.denied":K,"ci.rerunDenied":K,"review.denied":K,"config.token":lt,"config.tokenShape":lt,"builtin.fileTooLarge":lt,"claude.untrusted":{to:`resume`},"claude.trustWriteFailed":{to:`resume`},"git.missing":{to:`resume`},"git.noIdentity":{to:`identity`},"git.found":{to:`gitOn`},"chain.packagesNotReady":{to:`packages`},"order.later":{to:`milestoneOrder`},"order.against":{to:`milestoneOrder`}};function ft(e){if(e==null)return null;if(e.code===`tracker.completeRefused`){let{task:t,level:n}=e.params;return n===void 0?{to:`tracker`,task:t}:{to:`moves`,level:n,task:t}}if(e.code===`profiles.disabled`)return{to:`enableProfile`,profile:e.params.id};if(e.code===`profiles.chainsRunning`)return{to:`stopChains`,projects:e.params.projects.split(`,`).filter(e=>e!==``)};if(e.code===`statusMove.refused`||e.code===`statusMove.outside`||e.code===`statusMove.notDone`)return{to:`moves`,level:e.params.level,task:e.params.task};let t=dt[e.code];if(t!==void 0)return t;for(let t of e.items??[]){let e=ft(t);if(e!==null)return e}return ft(e.cause)}var pt={repo:[`repo`,`branch`,`mergeInto`,`carryAgent`,`slot`,`changelog`,`color`],tracker:[`tracker`,`trackerProject`,`fillMilestone`,`chain`],sessions:[`provider`,`models`,`accounts`,`brief`,`prompt`,`beforeStart`,`promptLanguage`,`cacheTtl`,`autoCompactWindow`,`codexAutoCompactWindow`,`openCodeAutoCompactWindow`,`contextHandoffs`,`checkpointTokens`,`checkpointShares`],ci:[`check`,`afterGreen`,`ci`,`pullRequests`]},mt={chain:[`parallel`,`brief`,`fillMilestone`,`defaultGit`,`chain`],models:[`provider`,`models`,`accounts`,`autoCompactWindow`,`codexAutoCompactWindow`,`openCodeAutoCompactWindow`,`execution`,`cli`,`cliCheck`,`modelPrompts`,`promptLanguage`],sessions:[`hiddenSkills`,`context`,`contextHandoffs`,`checkpointTokens`,`checkpointShares`,`cacheTtl`,`keepWarm`],ci:[`ci`],page:[`language`,`allowedHosts`,`attachmentLimit`],backup:[`backupDir`,`backupKeep`,`backup`],stats:[`stats`]};function ht({project:e,field:t}){let n=t.split(`.`)[0];if(e===null){let e=Object.keys(mt).find(e=>mt[e].includes(n));return e===void 0?null:{to:`shared`,tab:e}}let r=Object.keys(pt).find(e=>pt[e].includes(n));return r===void 0?null:{to:`project`,project:e,tab:r}}function gt({config:e,configError:t}){if(t===null)return null;let n=e.trackers.flatMap(e=>e.projectKey===null?[]:[e.projectKey.key]),r=w(t,n);return r===null?null:ht(r)}var q=e(ee(),1),_t=new Set([`http`,`https`,`ssh`,`git`,`git+ssh`,`ssh+git`]),vt=/^([a-z][a-z0-9+.-]*):\/\/(.*)$/i,yt=/^(?:[^@/\s]*@)?(\[[^\]]+\]|[^/:\s]+)/,bt=/^(?:[^@\s]+@)?([^@\s:]+):(\S+)$/;function xt(e,t){if(e===``)return{kind:`blank`};let n=e.trim();if(n===``||/[\u0000-\u001f\u007f]/.test(n))return{kind:`none`};let r=t===void 0||t===`win32`,i=vt.exec(n);if(i!==null){let e=yt.exec(i[2]);return!_t.has(i[1].toLowerCase())||/\s/.test(n)||e===null?{kind:`none`}:{kind:`address`,host:e[1]}}let a=n.indexOf(`:`),o=n.indexOf(`/`),s=r&&/^[a-z]:/i.test(n);if(a>=0&&!s&&(o<0||a<o)){let e=bt.exec(n);return e===null?{kind:`none`}:{kind:`address`,host:e[1]}}return(r?/^(?:[a-z]:)?[\\/]/i.test(n):n.startsWith(`/`))||n===`~`||(r?/^~[\\/]/:/^~\//).test(n)?{kind:`path`}:/[\\/~:]/.test(n)||n===`.`||n===`..`?{kind:`relative`}:/\s/.test(n)?{kind:`none`}:{kind:`name`}}var St={git:!0,target:``,folder:``,other:!1,repo:``,branch:``,key:``,name:``,tracker:``,trackerProject:``,team:``,profile:``,place:`worktree`,slots:`2`,milestones:``,provider:``,typed:{key:!1,name:!1,trackerProject:!1}};function Ct(e){return e?.projectKey==null?`key`:e.projectKey.alias?`alias`:e.projectKey.optional?`within`:`place`}var wt=e=>e!==`key`;function Tt(e,t,n){return n===null?null:n.code===`wizard.trackerShared`?`milestones`:n.code===`wizard.keyShape`||n.code===`wizard.keyTaken`?e.key.trim()===``?null:wt(t)?`key`:`tracker`:n.code===`wizard.trackerPlace`&&(t===`key`?e.key:t===`within`?e.team:e.trackerProject).trim()===``?null:`tracker`}function Et(e,t){return e===`alias`?t.trackerProject.trim():e===`within`?t.team.trim():``}function Dt(e){let t=e.team.trim();return t===``||t===e.key.trim()?e.trackerProject:`${t}/${e.trackerProject}`}var Ot=/^([A-Z][A-Z0-9_]{0,6})\/(.*)$/;function kt(e,t){let n=e.trackerProject;if(t===`key`&&(n=e.key),t===`within`){let t=Ot.exec(e.trackerProject);n=t===null?`${e.key}/${e.trackerProject}`:`${t[1]}/${t[2].trim()}`}return JSON.stringify([e.tracker,e.profile,n,e.milestones])}function At(e,t,n){let r=e===`within`?Ot.exec(n.trim()):null;return r===null||r[1]===t?{team:``,trackerProject:r?.[2]??n}:{team:r[1],trackerProject:r[2]}}var jt=5,Mt=e=>e.git&&xt(e.target).kind===`address`,Nt=e=>e.other&&(!e.git||Mt(e));function Pt(e){return e.git&&e.target===``?!0:Nt(e)&&e.repo.trim()===``}function Ft(e,t){let n=!Nt(e)&&e.folder.trim()===``,r=!Mt(e)||!n||t.answer||t.remoteHeard;return!r||t.answer?{shown:r,note:null}:{shown:r,note:t.pending?`checking`:n?`blank`:null}}function It(e,t=!1){let n=0;if(e.git&&e.place===`slots`){let t=e.slots.trim();if(n=/^\d+$/.test(t)?Number(t):0,n<1)return}let r=Nt(e),i=!e.git||Mt(e);return{repo:r?e.repo.trim():``,branch:e.git?e.branch.trim():``,key:e.key.trim(),name:e.name.trim(),tracker:e.tracker,trackerProject:Dt({...e,trackerProject:e.trackerProject.trim()}),profile:e.profile===``||t?null:e.profile,slot:n,milestones:e.milestones.split(`
2
2
  `).map(e=>e.trim()).filter(e=>e!==``),provider:e.provider===``?null:e.provider,...e.git?{target:e.target}:{git:!1},...i&&!r?{folder:e.folder.trim()}:{}}}function Lt(e,t,n){return{...e,[t]:n,typed:{...e.typed,[t]:n.trim()!==``}}}function J(e,t){let n={...e};for(let[r,i]of Object.entries(t))e.typed[r]||(n[r]=i);return n}var Rt=e=>e.profile!==``||e.tracker===`builtin`;function zt(e){return e.tracker===`builtin`&&e.profile===``?e:J({...e,profile:``,tracker:tt,team:``},{key:``,name:``,trackerProject:``})}function Bt(e,t){return t.kind===e.tracker?{...e,profile:t.id}:J({...e,profile:t.id,tracker:t.kind,team:``},{key:``,name:``,trackerProject:``})}function Vt(e,t){return J({...e,team:t},{key:t})}function Ht(e,t,n){return t===`key`?J({...e,key:n.key,typed:{...e.typed,key:!0}},{name:n.name}):t===`within`?J({...e,team:n.key,trackerProject:n.within??``},{key:n.key,name:n.name}):t===`alias`?J({...e,trackerProject:n.key,typed:{...e.typed,trackerProject:!0}},{key:n.key,name:n.name}):J({...e,trackerProject:n.key,typed:{...e.typed,trackerProject:!0}},{key:Xt(n.name),name:n.name})}function Ut(e,t,n){if(n.root===null||!e.git)return e;let r={...e,branch:e.branch||(n.current??``)};if(t!==`place`)return r;let i=e.typed.trackerProject?e.trackerProject:n.suggested??e.trackerProject,a=i.includes(`/`)?i.slice(i.lastIndexOf(`/`)+1):Qt(n.root);return J(r,{trackerProject:i,key:Xt(a),name:a})}function Wt(e){return e!==null&&e.repo.root!==null&&e.repo.notice===null&&e.entry===null&&e.tracker?.ok===!0}function Gt(e,t,n){return Pt(e)?e.git&&e.target===``?`target`:`repo`:n?.repo.notice==null?Rt(e)?t===`place`&&e.trackerProject.trim()===``?`place`:t===`alias`&&e.trackerProject.trim()===``||t===`within`&&e.team.trim()===``?`project`:e.key.trim()===``?wt(t)?`key`:`project`:n===null?`checking`:n.entry===null?n.tracker?.ok===!0?null:n.tracker===null?`checking`:`tracker`:`entry`:`profile`:`repoError`}function Kt(e,t){let n=Et(e,t)||t.key.trim();if(n===``)return null;if(!t.git)return e===`place`?`#12 → ${n}-12`:`${n}-12`;let r=`${n}-12 → ${n.toLowerCase()}-12/task`;return e===`place`?`#12 → ${r}`:r}function qt(e,t){return e===`key`?t.key.trim():e===`within`?[t.team.trim()||t.key.trim(),t.trackerProject.trim()].filter(e=>e!==``).join(` / `):t.trackerProject.trim()}var Jt=[`agent`,`repo`,`tracker`,`project`,`place`];function Yt(e,t,n,r,i,a=n?.tracker??null){let o=e.key.trim(),s=n?.entry??null,c=Tt(e,t,s),l=Pt(e)?`empty`:r?.repo.notice==null?r?.repo.root==null?`empty`:`passed`:`failed`,u=a===null?`empty`:a.ok?`passed`:`failed`;return{agent:i,repo:l,tracker:Rt(e)?c===`tracker`?`failed`:u:`empty`,project:c===`milestones`||c===`key`?`failed`:o!==``&&n!==null&&s===null?`passed`:`empty`,place:It(e)===void 0?`failed`:`passed`}}function Xt(e){let t=Qt(e).toUpperCase().split(/[^A-Z0-9]+/).filter(e=>/^[A-Z]/.test(e));return t.length===0?``:(t.length===1?t[0].slice(0,3):t.map(e=>e[0]).join(``)).slice(0,jt)}function Zt(e){return e.toUpperCase().replace(/[^A-Z0-9_]/g,``).replace(/^[^A-Z]+/,``).slice(0,jt)}function Qt(e){return e.split(/[\\/]/).filter(e=>e!==``).pop()??``}var $t=e(le(),1),en=864e5;function tn(e,t){if(t===void 0)return 0;let n=e.alternatives.findIndex(e=>e.every(e=>t.fields.some(t=>t.name===e&&t.set)));return Math.max(n,0)}function nn(e,t){let n=e.alternatives[t]??[];return e.fields.filter(t=>!e.alternatives.some(e=>e.includes(t.name))||n.includes(t.name))}function rn(e,t){return nn(e,t).filter(t=>e.mcpOAuth!==!0||t.name!==`JIRA_MCP_TOKEN`)}function an(e,t,n,r){let i=e=>r?.fields.some(t=>t.name===e&&t.secret&&t.set)===!0;return rn(e,t).filter(({name:e,optional:t})=>t!==!0&&(n[e]??``).trim()===``&&!i(e)).map(({name:e})=>e)}function on(e,t,n){let r=new Set(nn(e,t).map(e=>e.name));return Object.fromEntries(e.fields.map(({name:e})=>[e,r.has(e)?n[e]??``:null]))}function sn(e,t){let[n,...r]=e.hostVariables;return t===void 0||t===``||n===void 0||r.length>0?{}:{[n]:t}}function cn(e,t){return Math.ceil((Date.parse(e)-t)/en)}var Y=T(),ln=1500;function un({kind:e,profile:t,body:n,values:r,blank:a,grant:o,onGrant:c,warning:l,children:u}){let{query:d}=v(),[f,p]=(0,q.useState)(null),[m,h]=(0,q.useState)(null),[g,_]=(0,q.useState)(!1),[y,b]=(0,q.useState)(!1),x=(0,q.useRef)(null),S=o!=null&&o.values===r,C=o===null?void 0:t?.mcpOAuth?.state,w=(0,q.useRef)({query:d,onGrant:c});w.current={query:d,onGrant:c};let T=(0,q.useRef)(r);(0,q.useEffect)(()=>{if(f===null)return;let e=!1,t=window.setInterval(()=>{let{query:t}=w.current;t(`profiles/oauth/status`,{flow:f}).then(n=>{if(!e){if(n.state===`waiting`){if(x.current?.closed!==!0)return;t(`profiles/oauth/cancel`,{flow:f}).catch(()=>{})}else n.state===`ready`?w.current.onGrant({flow:f,values:T.current}):h(n.error);x.current?.close(),p(null)}}).catch(t=>{e||(h(s(t)),p(null))})},ln);return()=>{e=!0,window.clearInterval(t)}},[f]);let E=async()=>{if(h(null),_(!1),b(!0),a.length>0)return;let e=window.open(`about:blank`,`even-keel-oauth`,`popup,width=640,height=760`);if(e===null)_(!0);else{x.current=e,T.current=r;try{let t=await d(`profiles/oauth/start`,n);e.location.href=t.url,p(t.flow)}catch(t){e.close(),h(s(t))}}};return(0,Y.jsxs)(`section`,{className:`profile-mcp`,"aria-label":V.profiles.mcp.title,children:[(0,Y.jsxs)(`span`,{className:`profile-mcp__head`,children:[(0,Y.jsx)(ae,{children:V.profiles.mcp.title}),(0,Y.jsx)(i,{text:V.profiles.mcp.hint,align:`start`})]}),e.kind===`jira`&&t===void 0&&(0,Y.jsxs)(`p`,{className:`settings__hint profile-mcp__hint`,children:[V.profiles.mcp.noSite,` `,(0,Y.jsx)(`a`,{href:`https://www.atlassian.com/software/jira/free`,target:`_blank`,rel:`noreferrer`,children:V.profiles.mcp.newSite})]}),S?(0,Y.jsx)(`p`,{className:`profiles__ok`,children:V.profiles.mcp.ready}):C===`connected`&&l===void 0?(0,Y.jsx)(`p`,{className:`profiles__ok`,children:V.profiles.mcp.connected}):C===`reconnect`?(0,Y.jsx)(`p`,{className:`notice notice--warn`,children:V.profiles.mcp.revoked}):o===null&&t?.mcpOAuth!==void 0?(0,Y.jsx)(`p`,{className:`settings__hint profile-mcp__hint`,children:V.profiles.mcp.dropped}):null,f===null&&l!==void 0&&(0,Y.jsx)(ie,{tone:`warn`,action:(0,Y.jsx)(`button`,{type:`button`,className:`button button--small`,onClick:()=>void E(),children:V.profiles.mcp.again}),children:R(l)}),f!==null&&(0,Y.jsx)(`p`,{className:`settings__hint profile-mcp__hint`,children:V.profiles.mcp.waiting}),y&&a.length>0&&(0,Y.jsx)(`p`,{className:`notice notice--error`,children:V.profiles.unfilled(a)}),g&&(0,Y.jsx)(`p`,{className:`notice notice--error`,children:V.profiles.mcp.blocked}),m!==null&&(0,Y.jsx)(`p`,{className:`notice notice--error`,children:R(m)}),(0,Y.jsxs)(`div`,{className:`profile-mcp__actions`,children:[f===null?l===void 0&&(0,Y.jsx)(`button`,{type:`button`,className:`button button--small`,onClick:()=>void E(),children:S||C!==void 0?V.profiles.mcp.again:V.profiles.mcp.connect}):(0,Y.jsx)(`button`,{type:`button`,className:`button button--small`,onClick:()=>{f!==null&&d(`profiles/oauth/cancel`,{flow:f}).catch(()=>{}),x.current?.close(),p(null)},children:V.profiles.mcp.cancel}),f===null&&(S||C!==void 0)&&(0,Y.jsx)(`button`,{type:`button`,className:`button button--small`,onClick:()=>c(t?.mcpOAuth===void 0?void 0:null),children:V.profiles.mcp.disconnect}),f===null&&o===null&&t?.mcpOAuth!==void 0&&(0,Y.jsx)(`button`,{type:`button`,className:`button button--small`,onClick:()=>c(void 0),children:V.profiles.mcp.keep})]}),(0,Y.jsxs)(`div`,{className:`profile-mcp__fallback`,children:[(0,Y.jsx)(`span`,{className:`settings__hint`,children:V.profiles.mcp.fallback}),u]})]})}var X=[`start`,`review`,`done`],dn=/review|ревью/i;function fn(e,t){let n=t.filter(t=>t.category===`Active`&&rt(e,t));return{start:n[0]?.name??null,review:n.find(e=>dn.test(e.name))?.name??null}}var pn=`\0leave`,mn=e=>Object.fromEntries(X.map(t=>[t,e?.[t]===null?pn:e?.[t]??``])),hn=e=>Object.fromEntries(Object.entries(mn(e)).map(([e,t])=>[e,t===`\0leave`?``:t]));function gn(e){return Object.fromEntries(X.flatMap(t=>{let n=e[t];return typeof n!=`string`||n===``?[]:[[t,n===`\0leave`&&t!==`done`?null:n]]}))}function _n(e,t){let n=t?.[e];return typeof n==`string`?n:e===`done`?V.profiles.moves.auto:V.profiles.moves.leave}var vn=(e,t)=>e!==``&&e!==`\0leave`&&t.length>0&&!t.some(t=>U(t.name,e));function yn(e,t,n,r,i){let a=n.filter(n=>e===`done`?it(t,n):rt(t,n)).map(e=>e.name),o=r===``||r===`\0leave`||a.some(e=>U(e,r))?a:[...a,r];return[{value:``,label:bn(e,``,i)},...i===void 0||e===`done`?[]:[{value:pn,label:V.profiles.moves.leave}],...o.map(e=>({value:e,label:e===r&&vn(e,n)?V.profiles.moves.missing(e):e}))]}function bn(e,t,n){return t===`\0leave`?V.profiles.moves.leave:t===``?n===void 0?_n(e,void 0):V.profiles.moves.asProfile(_n(e,n)):t}function xn(e){let{query:t}=v(),[n,r]=(0,q.useState)(void 0);return(0,q.useEffect)(()=>{let n=!0;return r(void 0),e===void 0?r(null):(t(`profiles/statuses`,{id:e}).then(e=>n&&r(e===null||e.length===0?null:e),()=>n&&r(null)),()=>{n=!1})},[e]),n}var Sn={start:()=>[V.profiles.moves.start,V.profiles.moves.startHint],review:()=>[V.profiles.moves.review,V.profiles.moves.reviewHint],done:()=>[V.profiles.moves.done,V.profiles.moves.doneHint]};function Cn({rules:e,statuses:t,text:n,profile:r,idPrefix:i,marks:o,onEdit:s}){return(0,Y.jsxs)(Y.Fragment,{children:[t===void 0&&(0,Y.jsx)(`p`,{className:`settings__hint`,children:V.profiles.moves.loading}),t===null&&(0,Y.jsx)(`p`,{className:`settings__hint`,children:V.profiles.moves.unread}),X.map(c=>{let[l,u]=Sn[c](),d=x(`${i}-move-${c}`),f=(0,Y.jsx)(G,{id:d,className:`settings__text`,value:n[c],options:yn(c,e,t??[],n[c],r),onChange:e=>s(c,e)}),p=vn(n[c],t??[]);return(0,Y.jsx)(a,{className:o.box(c),label:l,hint:u,htmlFor:d,mark:o.note(c,e=>bn(c,String(e),r)),control:(0,Y.jsx)(k,{line:p?{tone:`plain`,text:V.profiles.moves.missingNote,short:V.profiles.moves.missingShort}:null,fold:!0,children:f})},c)})]})}function wn(e){return(0,Y.jsx)(t,{title:V.profiles.moves.title,hint:e.hint??V.profiles.moves.hint,className:`settings__moves`,children:(0,Y.jsx)(Cn,{...e})})}var Tn={box:()=>`settings__field`,note:()=>null};function En({id:e,name:t,onClose:n}){let{state:r}=v(),{send:i,sending:a,failure:o}=S(),s=xn(e),c=r?.config.shared.chain,[l,u]=(0,q.useState)(null);(0,q.useEffect)(()=>{if(l!==null||s==null||c===void 0)return;let e=fn(c,s);u({start:e.start??``,review:e.review??``,done:``})},[s]);let d=async()=>{l!==null&&await i(`profiles/moves`,{id:e,moves:gn(l)})&&n()};return(0,Y.jsxs)(`div`,{className:`add-package__form profile-form`,children:[(0,Y.jsxs)(`div`,{className:`add-package__body`,children:[(0,Y.jsx)(`h3`,{className:`ui-label`,children:V.profiles.moves.stepTitle}),(0,Y.jsx)(`p`,{className:`settings__hint`,children:s===null?V.profiles.moves.stepUnread:V.profiles.moves.stepHint(t)}),s===void 0&&(0,Y.jsx)(`p`,{className:`settings__hint`,children:V.profiles.moves.loading}),l!==null&&c!==void 0&&(0,Y.jsx)(Cn,{rules:c,statuses:s,text:l,idPrefix:e,marks:Tn,onEdit:(e,t)=>u({...l,[e]:t})})]}),o!==null&&(0,Y.jsx)(`p`,{role:`alert`,className:`notice notice--error add-package__failure`,children:R(o)}),(0,Y.jsxs)(`footer`,{className:`add-package__foot`,children:[(0,Y.jsx)(`span`,{className:`add-package__spacer`}),(0,Y.jsx)(`button`,{type:`button`,className:`button`,onClick:n,children:V.profiles.moves.skip}),s!==null&&(0,Y.jsx)(`button`,{type:`button`,className:`button button--primary`,disabled:a||l===null,onClick:()=>void d(),children:V.profiles.moves.save})]})]})}function Dn({kinds:e,profile:t,stress:n,fixed:r,host:i,onClose:a,onSaved:o}){let s=(0,q.useRef)(null),[c,l]=(0,q.useState)(void 0),u=e=>{(c==null||window.confirm(V.profiles.mcp.discard))&&(l(void 0),e())},d=()=>u(a),f=z(s,d),[p,m]=(0,q.useState)(t?.kind??r??null),[h,g]=(0,q.useState)(null),[_,v]=(0,q.useState)(null),y=h===null?t:void 0,b=(0,q.useId)(),x=e.find(e=>e.kind===p);return(0,q.useEffect)(()=>{s.current?.open===!1&&s.current.showModal()},[]),(0,q.useEffect)(()=>{s.current?.querySelector(`.add-package__kinds button, .add-package__body input:not(:disabled)`)?.focus()},[p]),(0,Y.jsx)(`dialog`,{ref:s,className:`add-package`,"aria-labelledby":b,onCancel:e=>{e.preventDefault(),d()},...f,children:(0,Y.jsxs)(`div`,{className:`add-package__frame`,children:[(0,Y.jsxs)(`header`,{className:`add-package__head`,children:[(0,Y.jsx)(`h2`,{id:b,className:`add-package__title`,children:y===void 0?x===void 0?V.profiles.add:`${V.profiles.add} · ${x.title}`:V.profiles.editTitle(y.name)}),(0,Y.jsx)(`button`,{type:`button`,className:`panel__close`,"aria-label":V.packages.close,onClick:d,children:`×`})]}),_===null?x===void 0?(0,Y.jsx)(On,{kinds:e,onPick:m}):(0,Y.jsx)(Mn,{kind:x,profile:y,stress:n,host:h??i,onBack:y===void 0&&r===void 0?()=>u(()=>{g(null),m(null)}):void 0,onGitlab:e.some(e=>e.kind===`gitlab`)?e=>u(()=>{g(e),m(`gitlab`)}):void 0,onClose:d,onFinish:(e,t)=>y===void 0&&x.moves===!0?v({id:e,name:t}):a(),grant:c,onGrant:l,onSaved:o},x.kind):(0,Y.jsx)(En,{id:_.id,name:_.name,onClose:a})]})})}function On({kinds:e,onPick:t}){return(0,Y.jsx)(`div`,{className:`add-package__kinds`,children:e.map(({kind:e,title:n})=>(0,Y.jsxs)(`button`,{type:`button`,className:`add-package__kind`,onClick:()=>t(e),children:[(0,Y.jsx)(`span`,{className:`add-package__kind-icon`,children:(0,Y.jsx)(f,{kind:e})}),(0,Y.jsx)(`span`,{className:`add-package__kind-title`,children:n}),(0,Y.jsx)(`span`,{className:`add-package__kind-hint`,children:V.profiles.kindHint[e]??``})]},e))})}var kn=[`tracker`,`ci`,`pullRequests`],An=e=>V.profiles.fieldLabels[e]??V.secrets.purpose[e]??e;function jn({kind:e,stress:t}){let n=V.profiles.rights[e.kind]??{},r=kn.filter(e=>n[e]!==void 0);return(0,Y.jsxs)(`div`,{className:`settings__hint profile-rights`,children:[(0,Y.jsxs)(`p`,{className:`profile-rights__intro`,children:[V.profiles.rightsIntro[e.kind]??``,` `,(0,Y.jsx)(`a`,{href:e.help,target:`_blank`,rel:`noreferrer`,children:V.profiles.howTo})]}),(0,Y.jsx)(`ul`,{className:`profile-rights__list`,children:r.map(e=>(0,Y.jsxs)(`li`,{className:e===t?`profile-rights__use profile-rights__use--stressed`:`profile-rights__use`,children:[(0,Y.jsxs)(`span`,{className:`profile-rights__name`,children:[V.profiles.rightsUse[e],`:`]}),` `,n[e],e===`pullRequests`&&(0,Y.jsx)(`span`,{className:`profile-rights__note`,children:V.profiles.pushedByGit})]},e))})]})}function Mn({kind:e,profile:t,stress:n,host:r,onBack:i,onGitlab:a,onClose:o,onFinish:c,onSaved:l,grant:u,onGrant:d}){let{query:f}=v(),[p,m]=(0,q.useState)(()=>tn(e,t)),[h,g]=(0,q.useState)(()=>t===void 0?sn(e,r):Object.fromEntries(t.fields.filter(e=>e.value!==null).map(e=>[e.name,e.value]))),[_,y]=(0,q.useState)(t?.name??``),[b,x]=(0,q.useState)(null),[S,C]=(0,q.useState)(null),[w,T]=(0,q.useState)(!1),[E,D]=(0,q.useState)(!1),O=an(e,p,h,t).map(An),k=on(e,p,h),A=JSON.stringify(k),j=JSON.stringify([k,u]),M=b!==null&&b.values===j,N=(t?.projects.length??0)>0,P={kind:e.kind,values:k,...t===void 0?{}:{id:t.id}},F=u===null?{oauth:null}:u!==void 0&&u.values===A?{oauth:u.flow}:{},ee=(0,q.useRef)(null),I=u!=null&&u.values===A?u.flow:null,te=M?b.result.mcpWarning:u===void 0?t?.mcpOAuth?.warning:void 0,L=rn(e,p),ne=e.mcpOAuth===!0&&(u===void 0?t?.mcpOAuth!==void 0:u!==null&&u.values===A),re=M?{tone:`ok`,text:`${V.profiles.login(b.result.login)}${ne?` · ${V.profiles.mcp.checked}`:``}`,short:b.result.login}:null;(0,q.useEffect)(()=>{let e=ee.current;b!==null&&e!==null&&e.scrollTo({top:e.scrollHeight,behavior:ve()?`auto`:`smooth`})},[b]);let ie=async e=>{if(O.length>0)return D(!0),C(null),null;T(!0),C(null);try{return await e()}catch(e){return C(s(e)),null}finally{T(!1)}},oe=async()=>{x(null);let e=await f(`profiles/check`,{...P,...F});return x({values:j,result:e}),(_.trim()===``||_===b?.result.name)&&y(e.name),e};(0,q.useEffect)(()=>{I!==null&&ie(oe)},[I]);let z=async e=>{if(e.preventDefault(),w)return;let t=await ie(async()=>{let e=M?b.result:await oe();if(!M&&e.duplicate!==null)return null;let t=_.trim()===``||_===b?.result.name?e.name:_.trim();return{...await f(`profiles/save`,{...P,...F,name:t}),name:t}});t!==null&&(l?.(t.id),c(t.id,t.name))};return(0,Y.jsxs)(`form`,{className:`add-package__form profile-form`,onSubmit:e=>void z(e),children:[(0,Y.jsxs)(`div`,{ref:ee,className:`add-package__body`,inert:w,children:[(0,Y.jsx)(jn,{kind:e,stress:n}),e.alternatives.length>1&&(0,Y.jsxs)(`fieldset`,{className:`add-package__field`,children:[(0,Y.jsx)(`legend`,{className:`add-package__label add-package__legend`,children:V.profiles.signIn}),(0,Y.jsx)(`div`,{className:`add-package__switch`,children:e.alternatives.map((e,t)=>(0,Y.jsxs)(`label`,{className:`add-package__option`,children:[(0,Y.jsx)(`input`,{type:`radio`,name:`profile-sign-in`,checked:p===t,onChange:()=>m(t)}),V.profiles.alternative[e[0]]??e.join(` + `)]},e.join()))})]}),L.map(n=>{let r=t?.fields.find(e=>e.name===n.name),i=N&&e.hostVariables.includes(n.name);return(0,Y.jsx)(ot,{label:An(n.name),hint:i?V.profiles.hostLocked:V.profiles.fieldHints[n.name]?`${V.profiles.fieldHints[n.name]} (${n.name})`:n.name,line:n===L.at(-1)?re:null,children:e=>(0,Y.jsx)(`input`,{id:e,className:`add-package__input add-package__input--mono`,...ct(n.secret),value:h[n.name]??``,placeholder:n.secret&&r?.set===!0?V.profiles.kept:V.profiles.examples[n.name]??``,disabled:i,autoComplete:`off`,spellCheck:!1,onChange:e=>g({...h,[n.name]:e.target.value})})},n.name)}),e.mcpOAuth===!0&&(0,Y.jsx)(un,{kind:e,profile:t,body:P,values:A,blank:O,grant:u,onGrant:d,warning:te,children:(0,Y.jsx)(ot,{label:V.profiles.fieldLabels.JIRA_MCP_TOKEN,hint:V.profiles.fieldHints.JIRA_MCP_TOKEN,children:e=>(0,Y.jsx)(`input`,{id:e,className:`add-package__input add-package__input--mono`,...ct(),value:h.JIRA_MCP_TOKEN??``,placeholder:t?.fields.some(e=>e.name===`JIRA_MCP_TOKEN`&&e.set)?V.profiles.kept:``,onChange:e=>g({...h,JIRA_MCP_TOKEN:e.target.value})})})}),e.mcpShared===!0&&(0,Y.jsxs)(`section`,{className:`profile-mcp`,"aria-label":V.profiles.mcp.title,children:[(0,Y.jsx)(ae,{children:V.profiles.mcp.title}),(0,Y.jsx)(`p`,{className:`settings__hint profile-mcp__hint`,children:V.profiles.mcp.sharedToken})]}),(0,Y.jsx)(ot,{label:V.profiles.name,hint:V.profiles.nameHint,line:L.length===0?re:null,children:e=>(0,Y.jsx)(`input`,{id:e,className:`add-package__input`,value:_,autoComplete:`off`,onChange:e=>y(e.target.value)})}),M&&b.result.duplicate!==null&&(0,Y.jsx)(`p`,{className:`notice notice--warn`,children:V.profiles.duplicate(b.result.duplicate)})]}),E&&O.length>0&&(0,Y.jsx)(`p`,{role:`alert`,className:`notice notice--error add-package__failure`,children:V.profiles.unfilled(O)}),S!==null&&(0,Y.jsxs)(`div`,{role:`alert`,className:`notice notice--error add-package__failure`,children:[R(S),(S.code===`jira.mcpSite`||S.code===`jira.mcpToken`)&&(0,Y.jsx)(`p`,{children:(0,Y.jsx)(`a`,{href:`https://id.atlassian.com/manage-profile/security/api-tokens?autofillToken&appId=mcp-v2&selectedScopes=all`,target:`_blank`,rel:`noreferrer`,children:V.profiles.createMcpToken})}),S.code===`profiles.isGitlab`&&a!==void 0&&(0,Y.jsx)(`p`,{children:(0,Y.jsx)(`button`,{type:`button`,className:`button button--small`,onClick:()=>a(h.FORGEJO_URL??``),children:V.profiles.addGitlab})})]}),(0,Y.jsxs)(`footer`,{className:`add-package__foot`,children:[i!==void 0&&(0,Y.jsxs)(`button`,{type:`button`,className:`button`,onClick:i,children:[`← `,V.packages.back]}),(0,Y.jsx)(`span`,{className:`add-package__spacer`}),(0,Y.jsx)(`button`,{type:`button`,className:`button`,onClick:o,children:V.packages.cancel}),(0,Y.jsx)(`button`,{type:`button`,className:`button`,disabled:w,onClick:()=>void ie(oe),children:V.profiles.check}),(0,Y.jsx)(`button`,{type:`submit`,className:`button button--primary`,disabled:w,children:w?V.profiles.checking:V.profiles.save})]})]})}var Nn=[2e3,5e3,15e3,3e4,6e4],Pn={list:[],of:null,failure:null,failures:0};function Fn(e){return Nn[e-1]??null}function In(e,t){return{list:e,of:t,failure:null,failures:0}}function Ln(e,t,n){return{list:e.list,of:t,failure:n,failures:e.of===t&&e.failure!==null?e.failures+1:1}}function Rn(e,t,n){return e===null?null:t.trim()!==``&&!n?`alert`:`quiet`}function zn(e,t){let{state:n,error:r}=e.check;return e.expiresAt!==null&&cn(e.expiresAt,t)<=0?{tone:`error`,text:V.profiles.expires(0)}:n===`ok`?e.login===null?{tone:`ok`,text:V.profiles.states.ok}:{tone:`ok`,text:V.wizard.signedIn(e.login),short:e.login}:r!==null&&(n===`refused`||n===`unreachable`)?{tone:`error`,text:R(r)}:{tone:`plain`,text:V.profiles.states[n]}}function Bn({absent:e,alert:t,status:n,name:r,quiet:i}){return e===null?t===null?n===null?r===null?i?{tone:`plain`,text:V.wizard.suggestionsFailed}:null:{tone:`plain`,text:r}:n:{tone:`error`,text:t}:{tone:`error`,text:e}}var Vn=300,Hn=`+add`,Un=`+builtin`;function Wn(e){let{ids:t,state:n,fields:r,profiles:i,kinds:a,onChange:o,keyFixed:s=!1,status:c}=e,[l,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)(null),p=n.config.trackers.find(e=>e.name===r.tracker),m=Ct(p),h=i.find(e=>e.id===r.profile),g=p?.title??a.find(e=>e.kind===r.tracker)?.title??``,_=s?Xn(m,r):r,v=m===`place`||m===`alias`?_.trackerProject:m===`within`?_.team:_.key,y=Qn(h,v,m!==`within`);(0,q.useEffect)(()=>{let e=i.find(e=>e.id===d);e!==void 0&&(f(null),o(t=>Bt(t,e)))},[d,i,o]);let b=Zn(m,_,y.list);(0,q.useEffect)(()=>{b!==void 0&&!s&&o(e=>Ht(e,m,b))},[b?.key,b?.name,b?.within,m]);let x=m===`alias`?_.trackerProject.trim():_.key.trim(),S=(m===`key`||m===`alias`)&&y.of===x&&x!==``&&b===void 0&&y.failure===null,C=Rn(y.failure,v,b!==void 0||e.known===!0),w=Bn({absent:S?V.wizard.noSuchProject(g,x):null,alert:C===`alert`?R(y.failure):null,status:c??null,name:(m===`key`||m===`alias`)&&b!==void 0?b.name:null,quiet:C===`quiet`}),T=r.tracker===`builtin`?{tone:`plain`,text:V.wizard.builtinLine}:Kn(i,h),E=s&&m===`key`;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`settings__row tracker-fields__row`,children:[(0,Y.jsx)(Gn,{...e,line:E&&w?.tone===`error`?w:T,onAdd:()=>u(!0)}),(0,Y.jsx)(qn,{...e,shape:m,title:g,choice:p,disabled:h===void 0&&r.tracker!==`builtin`,list:y.list,line:w})]}),l&&(0,$t.createPortal)((0,Y.jsx)(Dn,{kinds:[...a],profile:void 0,onClose:()=>u(!1),onSaved:e=>f(e)}),document.body)]})}function Gn({ids:e,profiles:t,fields:n,profileHint:r,profileLocked:i=!1,soon:a,profileNote:o,profileMark:s,keyFixed:c=!1,builtin:l,line:u,onChange:d,onAdd:p}){let m=[...l===void 0?[]:[{value:Un,label:V.wizard.builtin,icon:(0,Y.jsx)(f,{kind:tt}),unavailable:l.unavailable}],...t.map(e=>({value:e.id,label:e.isDefault?V.profiles.byDefault(e.name):e.name,icon:(0,Y.jsx)(f,{kind:e.kind})})),{value:Hn,label:V.wizard.addProfile,icon:(0,Y.jsx)(b,{})}];return t.length===0&&l===void 0?(0,Y.jsxs)(`div`,{className:`settings__field`,children:[(0,Y.jsx)(A,{label:V.profiles.field,hint:r,soon:i?a:void 0,mark:s}),(0,Y.jsx)(k,{line:null,children:(0,Y.jsxs)(`button`,{type:`button`,id:e(`profile`),className:`button tracker-fields__add`,"aria-haspopup":`dialog`,disabled:i,onClick:p,children:[(0,Y.jsx)(b,{}),V.wizard.addProfile]})}),!c&&(0,Y.jsx)(`span`,{className:`settings__hint`,children:V.wizard.noProfiles}),o]}):(0,Y.jsxs)(`div`,{className:`settings__field`,children:[(0,Y.jsx)(A,{label:l===void 0?V.profiles.field:V.wizard.trackerPick,hint:r,htmlFor:e(`profile`),soon:i?a:void 0,mark:s}),(0,Y.jsx)(k,{line:u,children:(0,Y.jsx)(G,{id:e(`profile`),className:`settings__text tracker-fields__wide`,value:n.tracker===`builtin`?Un:n.profile,options:m,disabled:i,onChange:e=>{if(e===Un)return d(zt);let n=t.find(t=>t.id===e);n===void 0?p():d(e=>Bt(e,n))}})}),o]})}function Kn(e,t){return e.length===0?null:t===void 0?{tone:`plain`,text:V.wizard.pickProfile}:zn(t,Date.now())}function qn(e){let{ids:t,shape:n,title:r,choice:i,fields:a,disabled:o,list:s,line:c,onChange:l,keyFixed:u=!1,projectLocked:d=!1}=e,f=a.tracker,p=V.settings.trackerProject(f,r),m={disabled:d,box:e.projectBox,invalid:e.projectInvalid,mark:e.projectMark,children:e.projectNote},h=s.map(e=>({value:e.key,label:e.name}));if(o)return(0,Y.jsx)(Jn,{id:t(`project`),label:V.wizard.trackerField,value:Dt(a),disabled:!0,onChange:()=>{}});if(n===`key`){if(u)return null;let e=f===tt;return(0,Y.jsx)(Jn,{id:t(`project`),label:e?V.wizard.ownKey:p,hint:e?V.wizard.prefixHint:V.wizard.projectHint(r),value:a.key,placeholder:`ABC`,upper:!0,options:h,line:c,onChange:e=>l(t=>Lt(t,`key`,e.toUpperCase())),...m})}if(n===`alias`||n===`place`){let e=n===`alias`;return(0,Y.jsx)(Jn,{id:t(`project`),label:p,hint:e?u?V.settings.trackerProjectAlias:V.wizard.projectHint(r):V.wizard.repoPlaceHint,value:a.trackerProject,placeholder:e&&u?a.key:i?.projectKey?.example,upper:e,options:h,line:c,onChange:t=>l(n=>Lt(n,`trackerProject`,e?t.toUpperCase():t)),...m})}let g=Xn(n,a).team.trim(),_=s.filter(e=>e.within===void 0),v=s.filter(e=>e.within!==void 0&&e.key===g);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Jn,{id:t(`team`),label:V.wizard.team,hint:u?V.settings.trackerTeam:V.wizard.teamHint(r),value:a.team,placeholder:u?a.key:`ENG`,upper:!0,options:_.map(e=>({value:e.key,label:e.name})),disabled:d,onChange:e=>l(t=>Vt(t,e.toUpperCase()))}),(0,Y.jsx)(Jn,{id:t(`project`),label:p,hint:V.settings.trackerProjectOptional,value:a.trackerProject,placeholder:i?.projectKey?.example,options:v.map(e=>({value:e.within,label:e.name})),line:c,onChange:e=>l(t=>Lt(t,`trackerProject`,e)),...m})]})}function Jn({id:e,label:t,hint:n,value:r,placeholder:i,upper:a=!1,disabled:o=!1,invalid:s=!1,options:c=[],line:l=null,box:u=`settings__field`,mark:d,onChange:f,children:p}){return(0,Y.jsxs)(`div`,{className:u,children:[(0,Y.jsx)(A,{label:t,hint:n,htmlFor:e,mark:d}),(0,Y.jsx)(k,{line:l,children:(0,Y.jsx)(W,{id:e,className:`settings__text settings__text--mono tracker-fields__wide${a?` tracker-fields__upper`:``}`,mono:!0,value:r,options:c,placeholder:i,disabled:o,invalid:s,onChange:f})}),p]})}function Yn({profile:e}){let t=zn(e,Date.now());return t.tone===`plain`?(0,Y.jsx)(`span`,{className:`settings__hint`,children:t.text}):(0,Y.jsx)($n,{ok:t.tone===`ok`,children:t.text})}function Xn(e,t){return e===`alias`&&t.trackerProject.trim()===``?{...t,trackerProject:t.key}:e===`within`&&t.team.trim()===``?{...t,team:t.key}:t}function Zn(e,t,n){let r=t.key.trim();if(e===`place`||e===`alias`)return n.find(e=>e.key===t.trackerProject.trim());if(e===`key`)return n.find(e=>e.key===r);let i=t.team.trim(),a=t.trackerProject.trim();return a===``?n.find(e=>e.key===i&&e.within===void 0):n.find(e=>e.key===i&&e.within===a)}function Qn(e,t,n){let{query:r,state:i,link:a}=v(),o=e?.id??null,[c,l]=(0,q.useState)(Pn),[u,d]=(0,q.useState)(0),f=(0,q.useRef)(null),p=t.trim();(0,q.useEffect)(()=>{f.current=null,l(Pn)},[o]),(0,q.useEffect)(()=>{if(o===null||n&&c.failure===null&&p!==``&&f.current===o&&c.list.some(e=>e.key===p))return;let e=!0,t=setTimeout(()=>{r(`profiles/projects`,{id:o,query:p}).then(t=>{e&&(f.current=o,l(In(t,p)))},t=>e&&l(e=>Ln(e,p,s(t))))},Vn);return()=>{e=!1,clearTimeout(t)}},[o,p,n,u]),(0,q.useEffect)(()=>{let e=c.failure===null?null:Fn(c.failures);if(e===null)return;let t=setTimeout(()=>d(e=>e+1),e);return()=>clearTimeout(t)},[c]);let m=`${i?.startedAt??``}|${a}|${e?.check.state??``}`,h=(0,q.useRef)(m);return(0,q.useEffect)(()=>{h.current!==m&&(h.current=m,c.failure!==null&&a===`live`&&d(e=>e+1))},[m]),c}function $n({ok:e=!1,children:t}){return(0,Y.jsx)(`span`,{className:e?`tracker-fields__status tracker-fields__status--ok`:`tracker-fields__status`,role:e?void 0:`alert`,children:t})}var er={key:!0,name:!0,trackerProject:!0};function tr(e,t,n,r,i){let a=Ct(e.config.trackers.find(e=>e.name===n));return{...St,key:t,tracker:n,profile:r?.id??``,...At(a,t,i),typed:er}}function nr(e,t){return e.find(e=>e.projectIds.includes(t))??e.find(e=>e.isDefault)}function rr({state:e,project:t,tracker:n,trackerProject:r,known:i,locked:a,hasTasks:o,onEdit:s,trackerMark:c,trackerNote:l,box:u,mark:d,note:f,invalid:p}){let{send:m,sending:h,failure:g}=S(),[_,v]=(0,q.useState)(null),y=e.profiles.kinds.filter(e=>e.tracker),b=e.profiles.profiles.filter(e=>y.some(t=>t.kind===e.kind)),C=b.filter(e=>e.kind===n),w=e.config.projects[t]?.tracker,T=C.find(e=>e.id===_)??(n===w?nr(C,t):C.find(e=>e.isDefault)),E=tr(e,e.projectKeys[t]??``,n,T,r);(0,q.useEffect)(()=>{if(_===null||n!==w)return;v(null);let e=C.find(e=>e.id===_);e!==void 0&&m(`profiles/link`,{project:t,profile:e.isDefault?null:e.id})},[_,n,w]);let D=e=>{let n=e(E);if(n.tracker===`builtin`)v(null);else if(n.profile!==E.profile){let e=b.find(e=>e.id===n.profile);e!==void 0&&e.kind!==w?v(e.id):(v(null),m(`profiles/link`,{project:t,profile:e===void 0||e.isDefault?null:e.id}))}let r=Dt(n);(n.tracker!==E.tracker||r!==Dt(E))&&s(n.tracker,r)},O=w===`builtin`&&o,k={unavailable:w!==`builtin`&&o?V.settings.builtinUnavailable:void 0},A=a?`${V.wizard.trackerPickHint} ${V.settings.trackerLocked}`:O?`${V.wizard.trackerPickHint} ${V.settings.builtinLocked}`:V.wizard.trackerPickHint;return(0,Y.jsx)(Wn,{ids:e=>x(e===`project`?`trackerProject`:e===`team`?`trackerTeam`:`profile`),state:e,fields:E,profiles:b,kinds:y,profileHint:A,builtin:k,keyFixed:!0,known:i,profileLocked:a||O||h,projectLocked:a,soon:a?V.settings.trackerSoon:void 0,profileNote:(0,Y.jsxs)(Y.Fragment,{children:[l,(0,Y.jsx)(B,{error:g})]}),profileMark:c,projectBox:u,projectMark:d,projectNote:f,projectInvalid:p,onChange:D})}var ir=[`Won`,`Lost`],ar=[`ToDo`,`Active`],or=(e,t)=>e.some(e=>U(e,t));function sr(e,t,n){let r=[],i=(e,t)=>{e.trim()!==``&&!or(r.map(e=>e.name),e)&&r.push({name:e.trim(),category:t})};for(let n of[...e.flat(),...t])i(n.name,n.category);for(let e of[...n.active??[],...n.terminal??[]])i(e,null);return r}var cr=(e,t)=>{let n={name:t.name,category:t.category??`UnStarted`},r={...e,requiredLabels:[],excludedLabels:[],requiredMilestones:[],excludedMilestones:[]};return nt(r,n)?`closed`:rt(r,n)?`in`:`out`},lr=e=>e.category!==null&&ir.includes(e.category);function ur(e,t,n,r){return n===`closed`||e.terminal!==null&&lr(t)?e.terminal===null?`category`:r.terminal:e.active===null?`category`:r.active}function dr(e,t,n,r){return e.map(e=>{let i=cr(t,e);return{...e,place:i,origin:ur(t,e,i,r),inherited:cr(n,e)}})}function fr(e,t,n,r=!1){let i=e.find(e=>U(e.name,t))?.place,a=e.map(e=>U(e.name,t)?{...e,place:n}:e),o=e=>a.filter(t=>t.place===e).map(e=>e.name),s=e=>i!==n&&(i===e||n===e),c=a.every(e=>e.place===`closed`===lr(e)),l=a.every(e=>e.place===`in`===(e.category!==null&&ar.includes(e.category)&&e.place!==`closed`));return{...s(`in`)&&{active:l&&!r?null:o(`in`)},...s(`closed`)&&{terminal:c&&!r?null:o(`closed`)}}}var pr=(e,t)=>e===null||t===null?e===t:e.length===t.length&&e.every((e,n)=>U(e,t[n]));function mr(e,t,n,r){if(!r)return e;if(!pr(e,t))return e??n}function hr(e,t){return[...ce.map((e=>t=>({name:t,rule:e,origin:`builtin`}))(`question`)),...e.requiredLabels.map(e=>({name:e,rule:`required`,origin:t.requiredLabels})),...e.excludedLabels.map(e=>({name:e,rule:`excluded`,origin:t.excludedLabels}))]}function gr(e,t,n){let r=e=>e.filter(e=>!U(e,t)),i=(e,i)=>n===i?or(e,t)?[...e]:[...e,t.trim()]:r(e);return{requiredLabels:i(e.requiredLabels,`required`),excludedLabels:i(e.excludedLabels,`excluded`)}}var _r=e=>e.requiredMilestones.length>0?`only`:e.excludedMilestones.length>0?`except`:`all`;function vr(e,t){return t===`all`?{requiredMilestones:[],excludedMilestones:[]}:t===`except`?{requiredMilestones:[],excludedMilestones:[...e.excludedMilestones]}:{requiredMilestones:[...e.requiredMilestones],excludedMilestones:[...e.excludedMilestones]}}var yr=e=>Object.fromEntries(Object.keys(at).map(t=>[t,e]));function br(e,t,n){let r={...e};for(let e of Object.keys(n))!t.includes(e)&&n[e]!==void 0&&Object.assign(r,{[e]:n[e]});return r}function xr(e,t,n){let r=Object.keys(e);return Object.fromEntries(r.map(r=>[r,pr(e[r],t[r])?n[r]===void 0?`shared`:`profile`:`project`]))}var Sr=(e,t,n={})=>({...br(e,[],t),...n});function Cr(e,t){return Object.fromEntries(Object.keys(e).filter(n=>!pr(e[n],t[n])).map(t=>[t,e[t]]))}var wr=`=>`,Tr=e=>e===``?[]:e.split(`
3
3
  `),Er=e=>e.join(`
4
4
  `);function Dr(e){let t=e.indexOf(wr);return t<0?[e.trim(),``]:[e.slice(0,t).trim(),e.slice(t+2).trim()]}var Or=([e,t])=>`${e} ${wr} ${t}`;function kr(e,t=[]){let n=e=>e.filter((t,n)=>e.findIndex(e=>U(e,t))===n).sort((e,t)=>e.localeCompare(t));return{labels:n([...e.flatMap(e=>e.labels),...t.flatMap(e=>e.labels)]),milestones:n([...e.flatMap(e=>e.milestone===null?[]:[e.milestone.label]),...t.flatMap(e=>e.milestones??[])])}}function Ar(e,t){let n=[];for(let r of[...e.requiredMilestones,...e.excludedMilestones]){let e=r.trim();e!==``&&![...t,...n].some(t=>U(t,e))&&n.push(e)}return n}function jr(e,t,n){return e.filter(e=>(Mr(t,e.id)?.id??null)===n)}var Mr=(e,t)=>e.find(e=>(e.prefix??e.key)===t.slice(0,t.lastIndexOf(`-`))),Nr=(e,t)=>e.filter(e=>!t.split(`