@gobing-ai/spur 0.3.67 → 0.3.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/config/corpus-baseline.json +2 -50
- package/config/templates/docs/99_PROJECT_CONSTITUTION.md +21 -16
- package/config/workflow-composition-baseline.json +109 -59
- package/config/workflows/docs-pipeline.yaml +98 -22
- package/config/workflows/idea-pipeline.yaml +20 -22
- package/config/workflows/task-pipeline.yaml +207 -108
- package/package.json +9 -9
- package/plugins/sp/README.md +6 -7
- package/plugins/sp/commands/dev-idea.md +5 -3
- package/plugins/sp/commands/dev-plan.md +3 -1
- package/plugins/sp/commands/dev-review-session.md +2 -1
- package/plugins/sp/hooks/context-post-tool.ts +101 -2
- package/plugins/sp/hooks/context-session-start.ts +22 -1
- package/plugins/sp/plugin.json +1 -1
- package/plugins/sp/scripts/stage-registry-adapter.ts +144 -2
- package/plugins/sp/skills/session-review/SKILL.md +16 -0
- package/plugins/sp/skills/spur-dev/references/cross-cutting.md +40 -16
- package/plugins/sp/skills/spur-dev/references/dev-operations.md +6 -6
- package/plugins/sp/skills/spur-dev/references/execution-batch.md +80 -11
- package/plugins/sp/skills/spur-dev/references/inline-pipeline-driver.md +18 -13
- package/spur.js +2069 -597
- package/web/_astro/{BoardApp.BEtcJqde.js → BoardApp.BQFbkeqq.js} +15 -15
- package/web/_astro/BoardApp.CTkqrhWd.js +1 -0
- package/web/_astro/{TaskDetail.ClAbCXom.js → TaskDetail.Dl2Eaj1w.js} +1 -1
- package/web/_astro/{arc.CCvf51_y.js → arc.uG14rp8A.js} +1 -1
- package/web/_astro/{architectureDiagram-3BPJPVTR.C0cb0J5M.js → architectureDiagram-3BPJPVTR.Dye6uD_x.js} +1 -1
- package/web/_astro/{blockDiagram-GPEHLZMM.CIyjqoCE.js → blockDiagram-GPEHLZMM.B9Pkh7Hb.js} +1 -1
- package/web/_astro/{c4Diagram-AAUBKEIU.fs14IuFs.js → c4Diagram-AAUBKEIU.C2x7SC_X.js} +1 -1
- package/web/_astro/channel.Dsvulp7W.js +1 -0
- package/web/_astro/{chunk-2J33WTMH.CaBKv4ZO.js → chunk-2J33WTMH.D2p4-nWk.js} +1 -1
- package/web/_astro/{chunk-4BX2VUAB.BOllTPto.js → chunk-4BX2VUAB.S-6jf33o.js} +1 -1
- package/web/_astro/{chunk-55IACEB6.ChEof0O4.js → chunk-55IACEB6.DVXj4Fdh.js} +1 -1
- package/web/_astro/{chunk-727SXJPM.Co2kdjD8.js → chunk-727SXJPM.Dz689FMN.js} +1 -1
- package/web/_astro/{chunk-AQP2D5EJ.SWmfcnog.js → chunk-AQP2D5EJ.KxYj5TnI.js} +1 -1
- package/web/_astro/{chunk-FMBD7UC4.rDAFifF3.js → chunk-FMBD7UC4.itTQyHQB.js} +1 -1
- package/web/_astro/{chunk-ND2GUHAM.BCnoXKCw.js → chunk-ND2GUHAM.euSrbJf5.js} +1 -1
- package/web/_astro/{chunk-QZHKN3VN.RSmy2hDO.js → chunk-QZHKN3VN.OWASJRQy.js} +1 -1
- package/web/_astro/{classDiagram-4FO5ZUOK.Be7PEfrX.js → classDiagram-4FO5ZUOK.BLvrlpNO.js} +1 -1
- package/web/_astro/{classDiagram-v2-Q7XG4LA2.Be7PEfrX.js → classDiagram-v2-Q7XG4LA2.BLvrlpNO.js} +1 -1
- package/web/_astro/{cose-bilkent-S5V4N54A.BkUp2aSK.js → cose-bilkent-S5V4N54A.XBF-rmyD.js} +1 -1
- package/web/_astro/{cynefin-OW5HDTMX.BegGGlUV.js → cynefin-OW5HDTMX.DlCx762Z.js} +1 -1
- package/web/_astro/{dagre-BM42HDAG.BkUdjsaC.js → dagre-BM42HDAG.D17Rshxv.js} +1 -1
- package/web/_astro/{diagram-2AECGRRQ.E9vugt3-.js → diagram-2AECGRRQ.AhBIVJC8.js} +1 -1
- package/web/_astro/{diagram-5GNKFQAL.Dj4yeHXB.js → diagram-5GNKFQAL.C9ximjyC.js} +1 -1
- package/web/_astro/{diagram-KO2AKTUF.Buaquwli.js → diagram-KO2AKTUF.CZb7Ru_9.js} +1 -1
- package/web/_astro/{diagram-LMA3HP47.BV3dgGgm.js → diagram-LMA3HP47.BW7LwqoS.js} +1 -1
- package/web/_astro/{diagram-OG6HWLK6.Cnx3s-tc.js → diagram-OG6HWLK6.XC025W0V.js} +1 -1
- package/web/_astro/{erDiagram-TEJ5UH35.DKK_abu4.js → erDiagram-TEJ5UH35.CpMXmBDP.js} +1 -1
- package/web/_astro/{flowDiagram-I6XJVG4X.BNuu9fbm.js → flowDiagram-I6XJVG4X.D2ednJWg.js} +1 -1
- package/web/_astro/{ganttDiagram-6RSMTGT7.b16KUMjy.js → ganttDiagram-6RSMTGT7.BjL9FGKO.js} +1 -1
- package/web/_astro/{gitGraphDiagram-PVQCEYII.Kh41lbG5.js → gitGraphDiagram-PVQCEYII.B90g1VGk.js} +1 -1
- package/web/_astro/{infoDiagram-5YYISTIA.DEWBXkp-.js → infoDiagram-5YYISTIA.RqgycKtQ.js} +1 -1
- package/web/_astro/{ishikawaDiagram-YF4QCWOH.DiAdmcL6.js → ishikawaDiagram-YF4QCWOH.Ctn-zt6a.js} +1 -1
- package/web/_astro/{journeyDiagram-JHISSGLW.D1Ki7IRm.js → journeyDiagram-JHISSGLW.DJhT8Ctp.js} +1 -1
- package/web/_astro/{kanban-definition-UN3LZRKU.CWUhrQpc.js → kanban-definition-UN3LZRKU.BY1QdejI.js} +1 -1
- package/web/_astro/{linear.BaFsgcCe.js → linear.Di7YObSt.js} +1 -1
- package/web/_astro/{mermaid.core.CHw_AsGy.js → mermaid.core.CbxtJS3Q.js} +4 -4
- package/web/_astro/{mindmap-definition-RKZ34NQL.UIhghgmN.js → mindmap-definition-RKZ34NQL.CxvR4g_J.js} +1 -1
- package/web/_astro/{pieDiagram-4H26LBE5.D05l3JUA.js → pieDiagram-4H26LBE5.jNWqnBHH.js} +1 -1
- package/web/_astro/{quadrantDiagram-W4KKPZXB.BcWIhIcE.js → quadrantDiagram-W4KKPZXB.BCp12MbA.js} +1 -1
- package/web/_astro/{requirementDiagram-4Y6WPE33.B1rYvKGn.js → requirementDiagram-4Y6WPE33.Dxhm4TyR.js} +1 -1
- package/web/_astro/{sankeyDiagram-5OEKKPKP.CKylVRC4.js → sankeyDiagram-5OEKKPKP.BtQXp4J9.js} +1 -1
- package/web/_astro/{sequenceDiagram-3UESZ5HK.Dm3uA_s4.js → sequenceDiagram-3UESZ5HK.BWEM1R_Q.js} +1 -1
- package/web/_astro/{stateDiagram-AJRCARHV.Bgca_BLe.js → stateDiagram-AJRCARHV.BG3wUkWB.js} +1 -1
- package/web/_astro/{stateDiagram-v2-BHNVJYJU.C1T7YFrG.js → stateDiagram-v2-BHNVJYJU.BLtMeFVP.js} +1 -1
- package/web/_astro/{timeline-definition-PNZ67QCA.ZOHJn3Sn.js → timeline-definition-PNZ67QCA.D5fHo0az.js} +1 -1
- package/web/_astro/{vennDiagram-CIIHVFJN.DegZitjD.js → vennDiagram-CIIHVFJN.0DcuMluU.js} +1 -1
- package/web/_astro/{wardleyDiagram-YWT4CUSO.BDsC115d.js → wardleyDiagram-YWT4CUSO.BZ-dxgHm.js} +1 -1
- package/web/_astro/{xychartDiagram-2RQKCTM6.D0MO70ea.js → xychartDiagram-2RQKCTM6.Bg-XWF7z.js} +1 -1
- package/web/index.html +1 -1
- package/web/_astro/BoardApp.DBEin4N5.js +0 -1
- package/web/_astro/channel.BGn_DUCD.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_astro/mermaid.core.
|
|
2
|
-
import{r as g,R as Qw,g as kl,c as et,b as Jw}from"./index.De90oHcH.js";var Iu={exports:{}},ks={};var Lb;function eA(){if(Lb)return ks;Lb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,s){var i=null;if(s!==void 0&&(i=""+s),a.key!==void 0&&(i=""+a.key),"key"in a){s={};for(var o in a)o!=="key"&&(s[o]=a[o])}else s=a;return a=s.ref,{$$typeof:e,type:r,key:i,ref:a!==void 0?a:null,props:s}}return ks.Fragment=t,ks.jsx=n,ks.jsxs=n,ks}var Fb;function tA(){return Fb||(Fb=1,Iu.exports=eA()),Iu.exports}var l=tA();var Ly=e=>{throw TypeError(e)},nA=(e,t,n)=>t.has(e)||Ly("Cannot "+n),Ru=(e,t,n)=>(nA(e,t,"read from private field"),n?n.call(e):t.get(e)),rA=(e,t,n)=>t.has(e)?Ly("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Mb="popstate";function aA(e={}){function t(r,a){let{pathname:s,search:i,hash:o}=r.location;return pi("",{pathname:s,search:i,hash:o},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function n(r,a){return typeof a=="string"?a:vr(a)}return iA(t,n,null,e)}function it(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Wt(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function sA(){return Math.random().toString(36).substring(2,10)}function Pb(e,t){return{usr:e.state,key:e.key,idx:t}}function pi(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?ea(t):t,state:n,key:t&&t.key||r||sA()}}function vr({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function ea(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function iA(e,t,n,r={}){let{window:a=document.defaultView,v5Compat:s=!1}=r,i=a.history,o="POP",u=null,c=p();c==null&&(c=0,i.replaceState({...i.state,idx:c},""));function p(){return(i.state||{idx:null}).idx}function d(){o="POP";let x=p(),y=x==null?null:x-c;c=x,u&&u({action:o,location:E.location,delta:y})}function f(x,y){o="PUSH";let S=pi(E.location,x,y);c=p()+1;let w=Pb(S,c),A=E.createHref(S);try{i.pushState(w,"",A)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;a.location.assign(A)}s&&u&&u({action:o,location:E.location,delta:1})}function m(x,y){o="REPLACE";let S=pi(E.location,x,y);c=p();let w=Pb(S,c),A=E.createHref(S);i.replaceState(w,"",A),s&&u&&u({action:o,location:E.location,delta:0})}function b(x){return Fy(x)}let E={get action(){return o},get location(){return e(a,i)},listen(x){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(Mb,d),u=x,()=>{a.removeEventListener(Mb,d),u=null}},createHref(x){return t(a,x)},createURL:b,encodeLocation(x){let y=b(x);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:f,replace:m,go(x){return i.go(x)}};return E}function Fy(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),it(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:vr(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}var Gs,jb=class{constructor(e){if(rA(this,Gs,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(Ru(this,Gs).has(e))return Ru(this,Gs).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){Ru(this,Gs).set(e,t)}};Gs=new WeakMap;var oA=new Set(["lazy","caseSensitive","path","id","index","children"]);function lA(e){return oA.has(e)}var uA=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function cA(e){return uA.has(e)}function dA(e){return e.index===!0}function fi(e,t,n=[],r={},a=!1){return e.map((s,i)=>{let o=[...n,String(i)],u=typeof s.id=="string"?s.id:o.join("-");if(it(s.index!==!0||!s.children,"Cannot specify children on an index route"),it(a||!r[u],`Found a route id collision on id "${u}". Route id's must be globally unique within Data Router usages`),dA(s)){let c={...s,id:u};return r[u]=Bb(c,t(c)),c}else{let c={...s,id:u,children:void 0};return r[u]=Bb(c,t(c)),s.children&&(c.children=fi(s.children,t,o,r,a)),c}})}function Bb(e,t){return Object.assign(e,{...t,...typeof t.lazy=="object"&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function Gr(e,t,n="/"){return Ws(e,t,n,!1)}function Ws(e,t,n,r){let a=typeof t=="string"?ea(t):t,s=ar(a.pathname||"/",n);if(s==null)return null;let i=My(e);fA(i);let o=null;for(let u=0;o==null&&u<i.length;++u){let c=wA(s);o=SA(i[u],c,r)}return o}function pA(e,t){let{route:n,pathname:r,params:a}=e;return{id:n.id,pathname:r,params:a,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function My(e,t=[],n=[],r="",a=!1){let s=(i,o,u=a,c)=>{let p={relativePath:c===void 0?i.path||"":c,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(r)&&u)return;it(p.relativePath.startsWith(r),`Absolute route path "${p.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(r.length)}let d=Sr([r,p.relativePath]),f=n.concat(p);i.children&&i.children.length>0&&(it(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${d}".`),My(i.children,t,f,d,u)),!(i.path==null&&!i.index)&&t.push({path:d,score:yA(d,i.index),routesMeta:f})};return e.forEach((i,o)=>{if(i.path===""||!i.path?.includes("?"))s(i,o);else for(let u of Py(i.path))s(i,o,!0,u)}),t}function Py(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,a=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return a?[s,""]:[s];let i=Py(r.join("/")),o=[];return o.push(...i.map(u=>u===""?s:[s,u].join("/"))),a&&o.push(...i),o.map(u=>e.startsWith("/")&&u===""?"/":u)}function fA(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:TA(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var mA=/^:[\w-]+$/,hA=3,gA=2,bA=1,EA=10,xA=-2,Ub=e=>e==="*";function yA(e,t){let n=e.split("/"),r=n.length;return n.some(Ub)&&(r+=xA),t&&(r+=gA),n.filter(a=>!Ub(a)).reduce((a,s)=>a+(mA.test(s)?hA:s===""?bA:EA),r)}function TA(e,t){return e.length===t.length&&e.slice(0,-1).every((r,a)=>r===t[a])?e[e.length-1]-t[t.length-1]:0}function SA(e,t,n=!1){let{routesMeta:r}=e,a={},s="/",i=[];for(let o=0;o<r.length;++o){let u=r[o],c=o===r.length-1,p=s==="/"?t:t.slice(s.length)||"/",d=qo({path:u.relativePath,caseSensitive:u.caseSensitive,end:c},p),f=u.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=qo({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},p)),!d)return null;Object.assign(a,d.params),i.push({params:a,pathname:Sr([s,d.pathname]),pathnameBase:_A(Sr([s,d.pathnameBase])),route:f}),d.pathnameBase!=="/"&&(s=Sr([s,d.pathnameBase]))}return i}function qo(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=vA(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let s=a[0],i=s.replace(/(.)\/+$/,"$1"),o=a.slice(1);return{params:r.reduce((c,{paramName:p,isOptional:d},f)=>{if(p==="*"){let b=o[f]||"";i=s.slice(0,s.length-b.length).replace(/(.)\/+$/,"$1")}const m=o[f];return d&&!m?c[p]=void 0:c[p]=(m||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:i,pattern:e}}function vA(e,t=!1,n=!0){Wt(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,o,u)=>(r.push({paramName:o,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function wA(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Wt(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function ar(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function AA({basename:e,pathname:t}){return t==="/"?e:Sr([e,t])}var jy=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Il=e=>jy.test(e);function NA(e,t="/"){let{pathname:n,search:r="",hash:a=""}=typeof e=="string"?ea(e):e,s;if(n)if(Il(n))s=n;else{if(n.includes("//")){let i=n;n=n.replace(/\/\/+/g,"/"),Wt(!1,`Pathnames cannot have embedded double slashes - normalizing ${i} -> ${n}`)}n.startsWith("/")?s=$b(n.substring(1),"/"):s=$b(n,t)}else s=t;return{pathname:s,search:CA(r),hash:kA(a)}}function $b(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function Du(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function By(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Rl(e){let t=By(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Dl(e,t,n,r=!1){let a;typeof e=="string"?a=ea(e):(a={...e},it(!a.pathname||!a.pathname.includes("?"),Du("?","pathname","search",a)),it(!a.pathname||!a.pathname.includes("#"),Du("#","pathname","hash",a)),it(!a.search||!a.search.includes("#"),Du("#","search","hash",a)));let s=e===""||a.pathname==="",i=s?"/":a.pathname,o;if(i==null)o=n;else{let d=t.length-1;if(!r&&i.startsWith("..")){let f=i.split("/");for(;f[0]==="..";)f.shift(),d-=1;a.pathname=f.join("/")}o=d>=0?t[d]:"/"}let u=NA(a,o),c=i&&i!=="/"&&i.endsWith("/"),p=(s||i===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(c||p)&&(u.pathname+="/"),u}var Sr=e=>e.join("/").replace(/\/\/+/g,"/"),_A=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),CA=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,kA=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Ii=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function mi(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Ri(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Uy=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function $y(e,t){let n=e;if(typeof n!="string"||!jy.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,a=!1;if(Uy)try{let s=new URL(window.location.href),i=n.startsWith("//")?new URL(s.protocol+n):new URL(n),o=ar(i.pathname,t);i.origin===s.origin&&o!=null?n=o+i.search+i.hash:a=!0}catch{Wt(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:a,to:n}}var qr=Symbol("Uninstrumented");function IA(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(a=>a({id:t.id,index:t.index,path:t.path,instrument(s){let i=Object.keys(n);for(let o of i)s[o]&&n[o].push(s[o])}}));let r={};if(typeof t.lazy=="function"&&n.lazy.length>0){let a=Ha(n.lazy,t.lazy,()=>{});a&&(r.lazy=a)}if(typeof t.lazy=="object"){let a=t.lazy;["middleware","loader","action"].forEach(s=>{let i=a[s],o=n[`lazy.${s}`];if(typeof i=="function"&&o.length>0){let u=Ha(o,i,()=>{});u&&(r.lazy=Object.assign(r.lazy||{},{[s]:u}))}})}return["loader","action"].forEach(a=>{let s=t[a];if(typeof s=="function"&&n[a].length>0){let i=s[qr]??s,o=Ha(n[a],i,(...u)=>zb(u[0]));o&&(o[qr]=i,r[a]=o)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(a=>{let s=a[qr]??a,i=Ha(n.middleware,s,(...o)=>zb(o[0]));return i?(i[qr]=s,i):a})),r}function RA(e,t){let n={navigate:[],fetch:[]};if(t.forEach(r=>r({instrument(a){let s=Object.keys(a);for(let i of s)a[i]&&n[i].push(a[i])}})),n.navigate.length>0){let r=e.navigate[qr]??e.navigate,a=Ha(n.navigate,r,(...s)=>{let[i,o]=s;return{to:typeof i=="number"||typeof i=="string"?i:i?vr(i):".",...Hb(e,o??{})}});a&&(a[qr]=r,e.navigate=a)}if(n.fetch.length>0){let r=e.fetch[qr]??e.fetch,a=Ha(n.fetch,r,(...s)=>{let[i,,o,u]=s;return{href:o??".",fetcherKey:i,...Hb(e,u??{})}});a&&(a[qr]=r,e.fetch=a)}return e}function Ha(e,t,n){return e.length===0?null:async(...r)=>{let a=await zy(e,n(...r),()=>t(...r),e.length-1);if(a.type==="error")throw a.value;return a.value}}async function zy(e,t,n,r){let a=e[r],s;if(a){let i,o=async()=>(i?console.error("You cannot call instrumented handlers more than once"):i=zy(e,t,n,r-1),s=await i,it(s,"Expected a result"),s.type==="error"&&s.value instanceof Error?{status:"error",error:s.value}:{status:"success",error:void 0});try{await a(o,t)}catch(u){console.error("An instrumentation function threw an error:",u)}i||await o(),await i}else try{s={type:"success",value:await n()}}catch(i){s={type:"error",value:i}}return s||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function zb(e){let{request:t,context:n,params:r,unstable_pattern:a}=e;return{request:DA(t),params:{...r},unstable_pattern:a,context:OA(n)}}function Hb(e,t){return{currentUrl:vr(e.state.location),..."formMethod"in t?{formMethod:t.formMethod}:{},..."formEncType"in t?{formEncType:t.formEncType}:{},..."formData"in t?{formData:t.formData}:{},..."body"in t?{body:t.body}:{}}}function DA(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function OA(e){if(FA(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var LA=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function FA(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join("\0")===LA}var Hy=["POST","PUT","PATCH","DELETE"],MA=new Set(Hy),PA=["GET",...Hy],jA=new Set(PA),Gy=new Set([301,302,303,307,308]),BA=new Set([307,308]),Ou={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},UA={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Is={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},$A=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Wy="remix-router-transitions",Vy=Symbol("ResetLoaderData");function zA(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u";it(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let r=e.hydrationRouteProperties||[],a=e.mapRouteProperties||$A,s=a;if(e.unstable_instrumentations){let M=e.unstable_instrumentations;s=z=>({...a(z),...IA(M.map(Y=>Y.route).filter(Boolean),z)})}let i={},o=fi(e.routes,s,void 0,i),u,c=e.basename||"/";c.startsWith("/")||(c=`/${c}`);let p=e.dataStrategy||qA,d={...e.future},f=null,m=new Set,b=null,E=null,x=null,y=e.hydrationData!=null,S=Gr(o,e.history.location,c),w=!1,A=null,D;if(S==null&&!e.patchRoutesOnNavigation){let M=Jn(404,{pathname:e.history.location.pathname}),{matches:z,route:Y}=so(o);D=!0,S=z,A={[Y.id]:M}}else if(S&&!e.hydrationData&&Qe(S,o,e.history.location.pathname).active&&(S=null),S)if(S.some(M=>M.route.lazy))D=!1;else if(!S.some(M=>Dd(M.route)))D=!0;else{let M=e.hydrationData?e.hydrationData.loaderData:null,z=e.hydrationData?e.hydrationData.errors:null;if(z){let Y=S.findIndex(le=>z[le.route.id]!==void 0);D=S.slice(0,Y+1).every(le=>!Mc(le.route,M,z))}else D=S.every(Y=>!Mc(Y.route,M,z))}else{D=!1,S=[];let M=Qe(null,o,e.history.location.pathname);M.active&&M.matches&&(w=!0,S=M.matches)}let N,T={historyAction:e.history.action,location:e.history.location,matches:S,initialized:D,navigation:Ou,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||A,fetchers:new Map,blockers:new Map},v="POP",R=null,C=!1,U,k=!1,j=new Map,G=null,$=!1,te=!1,H=new Set,se=new Map,de=0,O=-1,ne=new Map,pe=new Set,L=new Map,ke=new Map,Re=new Set,Q=new Map,_e,fe=null;function X(){if(f=e.history.listen(({action:M,location:z,delta:Y})=>{if(_e){_e(),_e=void 0;return}Wt(Q.size===0||Y!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let le=Qt({currentLocation:T.location,nextLocation:z,historyAction:M});if(le&&Y!=null){let be=new Promise(Ie=>{_e=Ie});e.history.go(Y*-1),vt(le,{state:"blocked",location:z,proceed(){vt(le,{state:"proceeding",proceed:void 0,reset:void 0,location:z}),be.then(()=>e.history.go(Y))},reset(){let Ie=new Map(T.blockers);Ie.set(le,Is),me({blockers:Ie})}}),R?.resolve(),R=null;return}return Ze(M,z)}),n){dN(t,j);let M=()=>pN(t,j);t.addEventListener("pagehide",M),G=()=>t.removeEventListener("pagehide",M)}return T.initialized||Ze("POP",T.location,{initialHydration:!0}),N}function Ve(){f&&f(),G&&G(),m.clear(),U&&U.abort(),T.fetchers.forEach((M,z)=>ht(z)),T.blockers.forEach((M,z)=>je(z))}function ge(M){return m.add(M),()=>m.delete(M)}function me(M,z={}){M.matches&&(M.matches=M.matches.map(be=>{let Ie=i[be.route.id],Ce=be.route;return Ce.element!==Ie.element||Ce.errorElement!==Ie.errorElement||Ce.hydrateFallbackElement!==Ie.hydrateFallbackElement?{...be,route:Ie}:be})),T={...T,...M};let Y=[],le=[];T.fetchers.forEach((be,Ie)=>{be.state==="idle"&&(Re.has(Ie)?Y.push(Ie):le.push(Ie))}),Re.forEach(be=>{!T.fetchers.has(be)&&!se.has(be)&&Y.push(be)}),[...m].forEach(be=>be(T,{deletedFetchers:Y,newErrors:M.errors??null,viewTransitionOpts:z.viewTransitionOpts,flushSync:z.flushSync===!0})),Y.forEach(be=>ht(be)),le.forEach(be=>T.fetchers.delete(be))}function Te(M,z,{flushSync:Y}={}){let le=T.actionData!=null&&T.navigation.formMethod!=null&&kn(T.navigation.formMethod)&&T.navigation.state==="loading"&&M.state?._isRedirect!==!0,be;z.actionData?Object.keys(z.actionData).length>0?be=z.actionData:be=null:le?be=T.actionData:be=null;let Ie=z.loaderData?Jb(T.loaderData,z.loaderData,z.matches||[],z.errors):T.loaderData,Ce=T.blockers;Ce.size>0&&(Ce=new Map(Ce),Ce.forEach((We,Ue)=>Ce.set(Ue,Is)));let Oe=$?!1:nt(M,z.matches||T.matches),we=C===!0||T.navigation.formMethod!=null&&kn(T.navigation.formMethod)&&M.state?._isRedirect!==!0;u&&(o=u,u=void 0),$||v==="POP"||(v==="PUSH"?e.history.push(M,M.state):v==="REPLACE"&&e.history.replace(M,M.state));let Fe;if(v==="POP"){let We=j.get(T.location.pathname);We&&We.has(M.pathname)?Fe={currentLocation:T.location,nextLocation:M}:j.has(M.pathname)&&(Fe={currentLocation:M,nextLocation:T.location})}else if(k){let We=j.get(T.location.pathname);We?We.add(M.pathname):(We=new Set([M.pathname]),j.set(T.location.pathname,We)),Fe={currentLocation:T.location,nextLocation:M}}me({...z,actionData:be,loaderData:Ie,historyAction:v,location:M,initialized:!0,navigation:Ou,revalidation:"idle",restoreScrollPosition:Oe,preventScrollReset:we,blockers:Ce},{viewTransitionOpts:Fe,flushSync:Y===!0}),v="POP",C=!1,k=!1,$=!1,te=!1,R?.resolve(),R=null,fe?.resolve(),fe=null}async function ve(M,z){if(R?.resolve(),R=null,typeof M=="number"){R||(R=r0());let gt=R.promise;return e.history.go(M),gt}let Y=Fc(T.location,T.matches,c,M,z?.fromRouteId,z?.relative),{path:le,submission:be,error:Ie}=Gb(!1,Y,z),Ce=T.location,Oe=pi(T.location,le,z&&z.state);Oe={...Oe,...e.history.encodeLocation(Oe)};let we=z&&z.replace!=null?z.replace:void 0,Fe="PUSH";we===!0?Fe="REPLACE":we===!1||be!=null&&kn(be.formMethod)&&be.formAction===T.location.pathname+T.location.search&&(Fe="REPLACE");let We=z&&"preventScrollReset"in z?z.preventScrollReset===!0:void 0,Ue=(z&&z.flushSync)===!0,mt=Qt({currentLocation:Ce,nextLocation:Oe,historyAction:Fe});if(mt){vt(mt,{state:"blocked",location:Oe,proceed(){vt(mt,{state:"proceeding",proceed:void 0,reset:void 0,location:Oe}),ve(M,z)},reset(){let gt=new Map(T.blockers);gt.set(mt,Is),me({blockers:gt})}});return}await Ze(Fe,Oe,{submission:be,pendingError:Ie,preventScrollReset:We,replace:z&&z.replace,enableViewTransition:z&&z.viewTransition,flushSync:Ue,callSiteDefaultShouldRevalidate:z&&z.unstable_defaultShouldRevalidate})}function ie(){fe||(fe=r0()),oe(),me({revalidation:"loading"});let M=fe.promise;return T.navigation.state==="submitting"?M:T.navigation.state==="idle"?(Ze(T.historyAction,T.location,{startUninterruptedRevalidation:!0}),M):(Ze(v||T.historyAction,T.navigation.location,{overrideNavigation:T.navigation,enableViewTransition:k===!0}),M)}async function Ze(M,z,Y){U&&U.abort(),U=null,v=M,$=(Y&&Y.startUninterruptedRevalidation)===!0,Dt(T.location,T.matches),C=(Y&&Y.preventScrollReset)===!0,k=(Y&&Y.enableViewTransition)===!0;let le=u||o,be=Y&&Y.overrideNavigation,Ie=Y?.initialHydration&&T.matches&&T.matches.length>0&&!w?T.matches:Gr(le,z,c),Ce=(Y&&Y.flushSync)===!0;if(Ie&&T.initialized&&!te&&tN(T.location,z)&&!(Y&&Y.submission&&kn(Y.submission.formMethod))){Te(z,{matches:Ie},{flushSync:Ce});return}let Oe=Qe(Ie,le,z.pathname);if(Oe.active&&Oe.matches&&(Ie=Oe.matches),!Ie){let{error:en,notFoundMatches:En,route:_t}=Le(z.pathname);Te(z,{matches:En,loaderData:{},errors:{[_t.id]:en}},{flushSync:Ce});return}U=new AbortController;let we=Ua(e.history,z,U.signal,Y&&Y.submission),Fe=e.getContext?await e.getContext():new jb,We;if(Y&&Y.pendingError)We=[Wr(Ie).route.id,{type:"error",error:Y.pendingError}];else if(Y&&Y.submission&&kn(Y.submission.formMethod)){let en=await ot(we,z,Y.submission,Ie,Fe,Oe.active,Y&&Y.initialHydration===!0,{replace:Y.replace,flushSync:Ce});if(en.shortCircuited)return;if(en.pendingActionResult){let[En,_t]=en.pendingActionResult;if(Wn(_t)&&mi(_t.error)&&_t.error.status===404){U=null,Te(z,{matches:en.matches,loaderData:{},errors:{[En]:_t.error}});return}}Ie=en.matches||Ie,We=en.pendingActionResult,be=Lu(z,Y.submission),Ce=!1,Oe.active=!1,we=Ua(e.history,we.url,we.signal)}let{shortCircuited:Ue,matches:mt,loaderData:gt,errors:Jt}=await rt(we,z,Ie,Fe,Oe.active,be,Y&&Y.submission,Y&&Y.fetcherSubmission,Y&&Y.replace,Y&&Y.initialHydration===!0,Ce,We,Y&&Y.callSiteDefaultShouldRevalidate);Ue||(U=null,Te(z,{matches:mt||Ie,...e0(We),loaderData:gt,errors:Jt}))}async function ot(M,z,Y,le,be,Ie,Ce,Oe={}){oe();let we=uN(z,Y);if(me({navigation:we},{flushSync:Oe.flushSync===!0}),Ie){let Ue=await wt(le,z.pathname,M.signal);if(Ue.type==="aborted")return{shortCircuited:!0};if(Ue.type==="error"){if(Ue.partialMatches.length===0){let{matches:gt,route:Jt}=so(o);return{matches:gt,pendingActionResult:[Jt.id,{type:"error",error:Ue.error}]}}let mt=Wr(Ue.partialMatches).route.id;return{matches:Ue.partialMatches,pendingActionResult:[mt,{type:"error",error:Ue.error}]}}else if(Ue.matches)le=Ue.matches;else{let{notFoundMatches:mt,error:gt,route:Jt}=Le(z.pathname);return{matches:mt,pendingActionResult:[Jt.id,{type:"error",error:gt}]}}}let Fe,We=Lo(le,z);if(!We.route.action&&!We.route.lazy)Fe={type:"error",error:Jn(405,{method:M.method,pathname:z.pathname,routeId:We.route.id})};else{let Ue=Za(s,i,M,le,We,Ce?[]:r,be),mt=await Je(M,Ue,be,null);if(Fe=mt[We.route.id],!Fe){for(let gt of le)if(mt[gt.route.id]){Fe=mt[gt.route.id];break}}if(M.signal.aborted)return{shortCircuited:!0}}if(ua(Fe)){let Ue;return Oe&&Oe.replace!=null?Ue=Oe.replace:Ue=Kb(Fe.response.headers.get("Location"),new URL(M.url),c)===T.location.pathname+T.location.search,await De(M,Fe,!0,{submission:Y,replace:Ue}),{shortCircuited:!0}}if(Wn(Fe)){let Ue=Wr(le,We.route.id);return(Oe&&Oe.replace)!==!0&&(v="PUSH"),{matches:le,pendingActionResult:[Ue.route.id,Fe,We.route.id]}}return{matches:le,pendingActionResult:[We.route.id,Fe]}}async function rt(M,z,Y,le,be,Ie,Ce,Oe,we,Fe,We,Ue,mt){let gt=Ie||Lu(z,Ce),Jt=Ce||Oe||n0(gt),en=!$&&!Fe;if(be){if(en){let Gt=Ht(Ue);me({navigation:gt,...Gt!==void 0?{actionData:Gt}:{}},{flushSync:We})}let lt=await wt(Y,z.pathname,M.signal);if(lt.type==="aborted")return{shortCircuited:!0};if(lt.type==="error"){if(lt.partialMatches.length===0){let{matches:Kn,route:xn}=so(o);return{matches:Kn,loaderData:{},errors:{[xn.id]:lt.error}}}let Gt=Wr(lt.partialMatches).route.id;return{matches:lt.partialMatches,loaderData:{},errors:{[Gt]:lt.error}}}else if(lt.matches)Y=lt.matches;else{let{error:Gt,notFoundMatches:Kn,route:xn}=Le(z.pathname);return{matches:Kn,loaderData:{},errors:{[xn.id]:Gt}}}}let En=u||o,{dsMatches:_t,revalidatingFetchers:jn}=Wb(M,le,s,i,e.history,T,Y,Jt,z,Fe?[]:r,Fe===!0,te,H,Re,L,pe,En,c,e.patchRoutesOnNavigation!=null,Ue,mt);if(O=++de,!e.dataStrategy&&!_t.some(lt=>lt.shouldLoad)&&!_t.some(lt=>lt.route.middleware&<.route.middleware.length>0)&&jn.length===0){let lt=ae();return Te(z,{matches:Y,loaderData:{},errors:Ue&&Wn(Ue[1])?{[Ue[0]]:Ue[1].error}:null,...e0(Ue),...lt?{fetchers:new Map(T.fetchers)}:{}},{flushSync:We}),{shortCircuited:!0}}if(en){let lt={};if(!be){lt.navigation=gt;let Gt=Ht(Ue);Gt!==void 0&&(lt.actionData=Gt)}jn.length>0&&(lt.fetchers=St(jn)),me(lt,{flushSync:We})}jn.forEach(lt=>{kt(lt.key),lt.controller&&se.set(lt.key,lt.controller)});let _n=()=>jn.forEach(lt=>kt(lt.key));U&&U.signal.addEventListener("abort",_n);let{loaderResults:Fr,fetcherResults:Cn}=await Z(_t,jn,M,le);if(M.signal.aborted)return{shortCircuited:!0};U&&U.signal.removeEventListener("abort",_n),jn.forEach(lt=>se.delete(lt.key));let Zn=io(Fr);if(Zn)return await De(M,Zn.result,!0,{replace:we}),{shortCircuited:!0};if(Zn=io(Cn),Zn)return pe.add(Zn.key),await De(M,Zn.result,!0,{replace:we}),{shortCircuited:!0};let{loaderData:_s,errors:Mr}=Qb(T,Y,Fr,Ue,jn,Cn);Fe&&T.errors&&(Mr={...T.errors,...Mr});let hr=ae(),Cr=Ne(O),Pr=hr||Cr||jn.length>0;return{matches:Y,loaderData:_s,errors:Mr,...Pr?{fetchers:new Map(T.fetchers)}:{}}}function Ht(M){if(M&&!Wn(M[1]))return{[M[0]]:M[1].data};if(T.actionData)return Object.keys(T.actionData).length===0?null:T.actionData}function St(M){return M.forEach(z=>{let Y=T.fetchers.get(z.key),le=Rs(void 0,Y?Y.data:void 0);T.fetchers.set(z.key,le)}),new Map(T.fetchers)}async function Ct(M,z,Y,le){kt(M);let be=(le&&le.flushSync)===!0,Ie=u||o,Ce=Fc(T.location,T.matches,c,Y,z,le?.relative),Oe=Gr(Ie,Ce,c),we=Qe(Oe,Ie,Ce);if(we.active&&we.matches&&(Oe=we.matches),!Oe){ue(M,z,Jn(404,{pathname:Ce}),{flushSync:be});return}let{path:Fe,submission:We,error:Ue}=Gb(!0,Ce,le);if(Ue){ue(M,z,Ue,{flushSync:be});return}let mt=e.getContext?await e.getContext():new jb,gt=(le&&le.preventScrollReset)===!0;if(We&&kn(We.formMethod)){await Zt(M,z,Fe,Oe,mt,we.active,be,gt,We,le&&le.unstable_defaultShouldRevalidate);return}L.set(M,{routeId:z,path:Fe}),await at(M,z,Fe,Oe,mt,we.active,be,gt,We)}async function Zt(M,z,Y,le,be,Ie,Ce,Oe,we,Fe){oe(),L.delete(M);let We=T.fetchers.get(M);J(M,cN(we,We),{flushSync:Ce});let Ue=new AbortController,mt=Ua(e.history,Y,Ue.signal,we);if(Ie){let Ut=await wt(le,new URL(mt.url).pathname,mt.signal,M);if(Ut.type==="aborted")return;if(Ut.type==="error"){ue(M,z,Ut.error,{flushSync:Ce});return}else if(Ut.matches)le=Ut.matches;else{ue(M,z,Jn(404,{pathname:Y}),{flushSync:Ce});return}}let gt=Lo(le,Y);if(!gt.route.action&&!gt.route.lazy){let Ut=Jn(405,{method:we.formMethod,pathname:Y,routeId:z});ue(M,z,Ut,{flushSync:Ce});return}se.set(M,Ue);let Jt=de,en=Za(s,i,mt,le,gt,r,be),En=await Je(mt,en,be,M),_t=En[gt.route.id];if(!_t){for(let Ut of en)if(En[Ut.route.id]){_t=En[Ut.route.id];break}}if(mt.signal.aborted){se.get(M)===Ue&&se.delete(M);return}if(Re.has(M)){if(ua(_t)||Wn(_t)){J(M,kr(void 0));return}}else{if(ua(_t))if(se.delete(M),O>Jt){J(M,kr(void 0));return}else return pe.add(M),J(M,Rs(we)),De(mt,_t,!1,{fetcherSubmission:we,preventScrollReset:Oe});if(Wn(_t)){ue(M,z,_t.error);return}}let jn=T.navigation.location||T.location,_n=Ua(e.history,jn,Ue.signal),Fr=u||o,Cn=T.navigation.state!=="idle"?Gr(Fr,T.navigation.location,c):T.matches;it(Cn,"Didn't find any matches after fetcher action");let Zn=++de;ne.set(M,Zn);let _s=Rs(we,_t.data);T.fetchers.set(M,_s);let{dsMatches:Mr,revalidatingFetchers:hr}=Wb(_n,be,s,i,e.history,T,Cn,we,jn,r,!1,te,H,Re,L,pe,Fr,c,e.patchRoutesOnNavigation!=null,[gt.route.id,_t],Fe);hr.filter(Ut=>Ut.key!==M).forEach(Ut=>{let Oa=Ut.key,Cs=T.fetchers.get(Oa),ro=Rs(void 0,Cs?Cs.data:void 0);T.fetchers.set(Oa,ro),kt(Oa),Ut.controller&&se.set(Oa,Ut.controller)}),me({fetchers:new Map(T.fetchers)});let Cr=()=>hr.forEach(Ut=>kt(Ut.key));Ue.signal.addEventListener("abort",Cr);let{loaderResults:Pr,fetcherResults:lt}=await Z(Mr,hr,_n,be);if(Ue.signal.aborted)return;if(Ue.signal.removeEventListener("abort",Cr),ne.delete(M),se.delete(M),hr.forEach(Ut=>se.delete(Ut.key)),T.fetchers.has(M)){let Ut=kr(_t.data);T.fetchers.set(M,Ut)}let Gt=io(Pr);if(Gt)return De(_n,Gt.result,!1,{preventScrollReset:Oe});if(Gt=io(lt),Gt)return pe.add(Gt.key),De(_n,Gt.result,!1,{preventScrollReset:Oe});let{loaderData:Kn,errors:xn}=Qb(T,Cn,Pr,void 0,hr,lt);Ne(Zn),T.navigation.state==="loading"&&Zn>O?(it(v,"Expected pending action"),U&&U.abort(),Te(T.navigation.location,{matches:Cn,loaderData:Kn,errors:xn,fetchers:new Map(T.fetchers)})):(me({errors:xn,loaderData:Jb(T.loaderData,Kn,Cn,xn),fetchers:new Map(T.fetchers)}),te=!1)}async function at(M,z,Y,le,be,Ie,Ce,Oe,we){let Fe=T.fetchers.get(M);J(M,Rs(we,Fe?Fe.data:void 0),{flushSync:Ce});let We=new AbortController,Ue=Ua(e.history,Y,We.signal);if(Ie){let _t=await wt(le,new URL(Ue.url).pathname,Ue.signal,M);if(_t.type==="aborted")return;if(_t.type==="error"){ue(M,z,_t.error,{flushSync:Ce});return}else if(_t.matches)le=_t.matches;else{ue(M,z,Jn(404,{pathname:Y}),{flushSync:Ce});return}}let mt=Lo(le,Y);se.set(M,We);let gt=de,Jt=Za(s,i,Ue,le,mt,r,be),En=(await Je(Ue,Jt,be,M))[mt.route.id];if(se.get(M)===We&&se.delete(M),!Ue.signal.aborted){if(Re.has(M)){J(M,kr(void 0));return}if(ua(En))if(O>gt){J(M,kr(void 0));return}else{pe.add(M),await De(Ue,En,!1,{preventScrollReset:Oe});return}if(Wn(En)){ue(M,z,En.error);return}J(M,kr(En.data))}}async function De(M,z,Y,{submission:le,fetcherSubmission:be,preventScrollReset:Ie,replace:Ce}={}){Y||(R?.resolve(),R=null),z.response.headers.has("X-Remix-Revalidate")&&(te=!0);let Oe=z.response.headers.get("Location");it(Oe,"Expected a Location header on the redirect Response"),Oe=Kb(Oe,new URL(M.url),c);let we=pi(T.location,Oe,{_isRedirect:!0});if(n){let Jt=!1;if(z.response.headers.has("X-Remix-Reload-Document"))Jt=!0;else if(Il(Oe)){const en=Fy(Oe,!0);Jt=en.origin!==t.location.origin||ar(en.pathname,c)==null}if(Jt){Ce?t.location.replace(Oe):t.location.assign(Oe);return}}U=null;let Fe=Ce===!0||z.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:We,formAction:Ue,formEncType:mt}=T.navigation;!le&&!be&&We&&Ue&&mt&&(le=n0(T.navigation));let gt=le||be;if(BA.has(z.response.status)&>&&kn(gt.formMethod))await Ze(Fe,we,{submission:{...gt,formAction:Oe},preventScrollReset:Ie||C,enableViewTransition:Y?k:void 0});else{let Jt=Lu(we,le);await Ze(Fe,we,{overrideNavigation:Jt,fetcherSubmission:be,preventScrollReset:Ie||C,enableViewTransition:Y?k:void 0})}}async function Je(M,z,Y,le){let be,Ie={};try{be=await ZA(p,M,z,le,Y,!1)}catch(Ce){return z.filter(Oe=>Oe.shouldLoad).forEach(Oe=>{Ie[Oe.route.id]={type:"error",error:Ce}}),Ie}if(M.signal.aborted)return Ie;if(!kn(M.method))for(let Ce of z){if(be[Ce.route.id]?.type==="error")break;!be.hasOwnProperty(Ce.route.id)&&!T.loaderData.hasOwnProperty(Ce.route.id)&&(!T.errors||!T.errors.hasOwnProperty(Ce.route.id))&&Ce.shouldCallHandler()&&(be[Ce.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${Ce.route.id}`)})}for(let[Ce,Oe]of Object.entries(be))if(sN(Oe)){let we=Oe.result;Ie[Ce]={type:"redirect",response:JA(we,M,Ce,z,c)}}else Ie[Ce]=await QA(Oe);return Ie}async function Z(M,z,Y,le){let be=Je(Y,M,le,null),Ie=Promise.all(z.map(async we=>{if(we.matches&&we.match&&we.request&&we.controller){let We=(await Je(we.request,we.matches,le,we.key))[we.match.route.id];return{[we.key]:We}}else return Promise.resolve({[we.key]:{type:"error",error:Jn(404,{pathname:we.path})}})})),Ce=await be,Oe=(await Ie).reduce((we,Fe)=>Object.assign(we,Fe),{});return{loaderResults:Ce,fetcherResults:Oe}}function oe(){te=!0,L.forEach((M,z)=>{se.has(z)&&H.add(z),kt(z)})}function J(M,z,Y={}){T.fetchers.set(M,z),me({fetchers:new Map(T.fetchers)},{flushSync:(Y&&Y.flushSync)===!0})}function ue(M,z,Y,le={}){let be=Wr(T.matches,z);ht(M),me({errors:{[be.route.id]:Y},fetchers:new Map(T.fetchers)},{flushSync:(le&&le.flushSync)===!0})}function Pe(M){return ke.set(M,(ke.get(M)||0)+1),Re.has(M)&&Re.delete(M),T.fetchers.get(M)||UA}function qe(M,z){kt(M,z?.reason),J(M,kr(null))}function ht(M){let z=T.fetchers.get(M);se.has(M)&&!(z&&z.state==="loading"&&ne.has(M))&&kt(M),L.delete(M),ne.delete(M),pe.delete(M),Re.delete(M),H.delete(M),T.fetchers.delete(M)}function Rt(M){let z=(ke.get(M)||0)-1;z<=0?(ke.delete(M),Re.add(M)):ke.set(M,z),me({fetchers:new Map(T.fetchers)})}function kt(M,z){let Y=se.get(M);Y&&(Y.abort(z),se.delete(M))}function jt(M){for(let z of M){let Y=Pe(z),le=kr(Y.data);T.fetchers.set(z,le)}}function ae(){let M=[],z=!1;for(let Y of pe){let le=T.fetchers.get(Y);it(le,`Expected fetcher: ${Y}`),le.state==="loading"&&(pe.delete(Y),M.push(Y),z=!0)}return jt(M),z}function Ne(M){let z=[];for(let[Y,le]of ne)if(le<M){let be=T.fetchers.get(Y);it(be,`Expected fetcher: ${Y}`),be.state==="loading"&&(kt(Y),ne.delete(Y),z.push(Y))}return jt(z),z.length>0}function ze(M,z){let Y=T.blockers.get(M)||Is;return Q.get(M)!==z&&Q.set(M,z),Y}function je(M){T.blockers.delete(M),Q.delete(M)}function vt(M,z){let Y=T.blockers.get(M)||Is;it(Y.state==="unblocked"&&z.state==="blocked"||Y.state==="blocked"&&z.state==="blocked"||Y.state==="blocked"&&z.state==="proceeding"||Y.state==="blocked"&&z.state==="unblocked"||Y.state==="proceeding"&&z.state==="unblocked",`Invalid blocker state transition: ${Y.state} -> ${z.state}`);let le=new Map(T.blockers);le.set(M,z),me({blockers:le})}function Qt({currentLocation:M,nextLocation:z,historyAction:Y}){if(Q.size===0)return;Q.size>1&&Wt(!1,"A router only supports one blocker at a time");let le=Array.from(Q.entries()),[be,Ie]=le[le.length-1],Ce=T.blockers.get(be);if(!(Ce&&Ce.state==="proceeding")&&Ie({currentLocation:M,nextLocation:z,historyAction:Y}))return be}function Le(M){let z=Jn(404,{pathname:M}),Y=u||o,{matches:le,route:be}=so(Y);return{notFoundMatches:le,route:be,error:z}}function ft(M,z,Y){if(b=M,x=z,E=Y||null,!y&&T.navigation===Ou){y=!0;let le=nt(T.location,T.matches);le!=null&&me({restoreScrollPosition:le})}return()=>{b=null,x=null,E=null}}function Ke(M,z){return E&&E(M,z.map(le=>pA(le,T.loaderData)))||M.key}function Dt(M,z){if(b&&x){let Y=Ke(M,z);b[Y]=x()}}function nt(M,z){if(b){let Y=Ke(M,z),le=b[Y];if(typeof le=="number")return le}return null}function Qe(M,z,Y){if(e.patchRoutesOnNavigation)if(M){if(Object.keys(M[0].params).length>0)return{active:!0,matches:Ws(z,Y,c,!0)}}else return{active:!0,matches:Ws(z,Y,c,!0)||[]};return{active:!1,matches:null}}async function wt(M,z,Y,le){if(!e.patchRoutesOnNavigation)return{type:"success",matches:M};let be=M;for(;;){let Ie=u==null,Ce=u||o,Oe=i;try{await e.patchRoutesOnNavigation({signal:Y,path:z,matches:be,fetcherKey:le,patch:(We,Ue)=>{Y.aborted||Vb(We,Ue,Ce,Oe,s,!1)}})}catch(We){return{type:"error",error:We,partialMatches:be}}finally{Ie&&!Y.aborted&&(o=[...o])}if(Y.aborted)return{type:"aborted"};let we=Gr(Ce,z,c),Fe=null;if(we){if(Object.keys(we[0].params).length===0)return{type:"success",matches:we};if(Fe=Ws(Ce,z,c,!0),!(Fe&&be.length<Fe.length&&Kt(be,Fe.slice(0,be.length))))return{type:"success",matches:we}}if(Fe||(Fe=Ws(Ce,z,c,!0)),!Fe||Kt(be,Fe))return{type:"success",matches:null};be=Fe}}function Kt(M,z){return M.length===z.length&&M.every((Y,le)=>Y.route.id===z[le].route.id)}function W(M){i={},u=fi(M,s,void 0,i)}function Be(M,z,Y=!1){let le=u==null;Vb(M,z,u||o,i,s,Y),le&&(o=[...o],me({}))}return N={get basename(){return c},get future(){return d},get state(){return T},get routes(){return o},get window(){return t},initialize:X,subscribe:ge,enableScrollRestoration:ft,navigate:ve,fetch:Ct,revalidate:ie,createHref:M=>e.history.createHref(M),encodeLocation:M=>e.history.encodeLocation(M),getFetcher:Pe,resetFetcher:qe,deleteFetcher:Rt,dispose:Ve,getBlocker:ze,deleteBlocker:je,patchRoutes:Be,_internalFetchControllers:se,_internalSetRoutes:W,_internalSetStateDoNotUseOrYouWillBreakYourApp(M){me(M)}},e.unstable_instrumentations&&(N=RA(N,e.unstable_instrumentations.map(M=>M.router).filter(Boolean))),N}function HA(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function Fc(e,t,n,r,a,s){let i,o;if(a){i=[];for(let c of t)if(i.push(c),c.route.id===a){o=c;break}}else i=t,o=t[t.length-1];let u=Dl(r||".",Rl(i),ar(e.pathname,n)||e.pathname,s==="path");if(r==null&&(u.search=e.search,u.hash=e.hash),(r==null||r===""||r===".")&&o){let c=Ld(u.search);if(o.route.index&&!c)u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index";else if(!o.route.index&&c){let p=new URLSearchParams(u.search),d=p.getAll("index");p.delete("index"),d.filter(m=>m).forEach(m=>p.append("index",m));let f=p.toString();u.search=f?`?${f}`:""}}return n!=="/"&&(u.pathname=AA({basename:n,pathname:u.pathname})),vr(u)}function Gb(e,t,n){if(!n||!HA(n))return{path:t};if(n.formMethod&&!lN(n.formMethod))return{path:t,error:Jn(405,{method:n.formMethod})};let r=()=>({path:t,error:Jn(400,{type:"invalid-body"})}),s=(n.formMethod||"get").toUpperCase(),i=Qy(t);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!kn(s))return r();let d=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((f,[m,b])=>`${f}${m}=${b}
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_astro/mermaid.core.CbxtJS3Q.js","_astro/index.De90oHcH.js","_astro/TaskDetail.Dl2Eaj1w.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as g,R as Qw,g as kl,c as tt,b as Jw}from"./index.De90oHcH.js";var Iu={exports:{}},ks={};var Lb;function eA(){if(Lb)return ks;Lb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,s){var i=null;if(s!==void 0&&(i=""+s),a.key!==void 0&&(i=""+a.key),"key"in a){s={};for(var o in a)o!=="key"&&(s[o]=a[o])}else s=a;return a=s.ref,{$$typeof:e,type:r,key:i,ref:a!==void 0?a:null,props:s}}return ks.Fragment=t,ks.jsx=n,ks.jsxs=n,ks}var Fb;function tA(){return Fb||(Fb=1,Iu.exports=eA()),Iu.exports}var l=tA();var Ly=e=>{throw TypeError(e)},nA=(e,t,n)=>t.has(e)||Ly("Cannot "+n),Ru=(e,t,n)=>(nA(e,t,"read from private field"),n?n.call(e):t.get(e)),rA=(e,t,n)=>t.has(e)?Ly("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Mb="popstate";function aA(e={}){function t(r,a){let{pathname:s,search:i,hash:o}=r.location;return pi("",{pathname:s,search:i,hash:o},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function n(r,a){return typeof a=="string"?a:vr(a)}return iA(t,n,null,e)}function it(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Wt(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function sA(){return Math.random().toString(36).substring(2,10)}function Pb(e,t){return{usr:e.state,key:e.key,idx:t}}function pi(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?ea(t):t,state:n,key:t&&t.key||r||sA()}}function vr({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function ea(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function iA(e,t,n,r={}){let{window:a=document.defaultView,v5Compat:s=!1}=r,i=a.history,o="POP",u=null,c=p();c==null&&(c=0,i.replaceState({...i.state,idx:c},""));function p(){return(i.state||{idx:null}).idx}function d(){o="POP";let x=p(),y=x==null?null:x-c;c=x,u&&u({action:o,location:E.location,delta:y})}function f(x,y){o="PUSH";let S=pi(E.location,x,y);c=p()+1;let w=Pb(S,c),A=E.createHref(S);try{i.pushState(w,"",A)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;a.location.assign(A)}s&&u&&u({action:o,location:E.location,delta:1})}function m(x,y){o="REPLACE";let S=pi(E.location,x,y);c=p();let w=Pb(S,c),A=E.createHref(S);i.replaceState(w,"",A),s&&u&&u({action:o,location:E.location,delta:0})}function b(x){return Fy(x)}let E={get action(){return o},get location(){return e(a,i)},listen(x){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(Mb,d),u=x,()=>{a.removeEventListener(Mb,d),u=null}},createHref(x){return t(a,x)},createURL:b,encodeLocation(x){let y=b(x);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:f,replace:m,go(x){return i.go(x)}};return E}function Fy(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),it(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:vr(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}var Gs,jb=class{constructor(e){if(rA(this,Gs,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(Ru(this,Gs).has(e))return Ru(this,Gs).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){Ru(this,Gs).set(e,t)}};Gs=new WeakMap;var oA=new Set(["lazy","caseSensitive","path","id","index","children"]);function lA(e){return oA.has(e)}var uA=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function cA(e){return uA.has(e)}function dA(e){return e.index===!0}function fi(e,t,n=[],r={},a=!1){return e.map((s,i)=>{let o=[...n,String(i)],u=typeof s.id=="string"?s.id:o.join("-");if(it(s.index!==!0||!s.children,"Cannot specify children on an index route"),it(a||!r[u],`Found a route id collision on id "${u}". Route id's must be globally unique within Data Router usages`),dA(s)){let c={...s,id:u};return r[u]=Bb(c,t(c)),c}else{let c={...s,id:u,children:void 0};return r[u]=Bb(c,t(c)),s.children&&(c.children=fi(s.children,t,o,r,a)),c}})}function Bb(e,t){return Object.assign(e,{...t,...typeof t.lazy=="object"&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function Gr(e,t,n="/"){return Ws(e,t,n,!1)}function Ws(e,t,n,r){let a=typeof t=="string"?ea(t):t,s=ar(a.pathname||"/",n);if(s==null)return null;let i=My(e);fA(i);let o=null;for(let u=0;o==null&&u<i.length;++u){let c=wA(s);o=SA(i[u],c,r)}return o}function pA(e,t){let{route:n,pathname:r,params:a}=e;return{id:n.id,pathname:r,params:a,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function My(e,t=[],n=[],r="",a=!1){let s=(i,o,u=a,c)=>{let p={relativePath:c===void 0?i.path||"":c,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(r)&&u)return;it(p.relativePath.startsWith(r),`Absolute route path "${p.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(r.length)}let d=Sr([r,p.relativePath]),f=n.concat(p);i.children&&i.children.length>0&&(it(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${d}".`),My(i.children,t,f,d,u)),!(i.path==null&&!i.index)&&t.push({path:d,score:yA(d,i.index),routesMeta:f})};return e.forEach((i,o)=>{if(i.path===""||!i.path?.includes("?"))s(i,o);else for(let u of Py(i.path))s(i,o,!0,u)}),t}function Py(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,a=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return a?[s,""]:[s];let i=Py(r.join("/")),o=[];return o.push(...i.map(u=>u===""?s:[s,u].join("/"))),a&&o.push(...i),o.map(u=>e.startsWith("/")&&u===""?"/":u)}function fA(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:TA(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var mA=/^:[\w-]+$/,hA=3,gA=2,bA=1,EA=10,xA=-2,Ub=e=>e==="*";function yA(e,t){let n=e.split("/"),r=n.length;return n.some(Ub)&&(r+=xA),t&&(r+=gA),n.filter(a=>!Ub(a)).reduce((a,s)=>a+(mA.test(s)?hA:s===""?bA:EA),r)}function TA(e,t){return e.length===t.length&&e.slice(0,-1).every((r,a)=>r===t[a])?e[e.length-1]-t[t.length-1]:0}function SA(e,t,n=!1){let{routesMeta:r}=e,a={},s="/",i=[];for(let o=0;o<r.length;++o){let u=r[o],c=o===r.length-1,p=s==="/"?t:t.slice(s.length)||"/",d=qo({path:u.relativePath,caseSensitive:u.caseSensitive,end:c},p),f=u.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=qo({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},p)),!d)return null;Object.assign(a,d.params),i.push({params:a,pathname:Sr([s,d.pathname]),pathnameBase:_A(Sr([s,d.pathnameBase])),route:f}),d.pathnameBase!=="/"&&(s=Sr([s,d.pathnameBase]))}return i}function qo(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=vA(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let s=a[0],i=s.replace(/(.)\/+$/,"$1"),o=a.slice(1);return{params:r.reduce((c,{paramName:p,isOptional:d},f)=>{if(p==="*"){let b=o[f]||"";i=s.slice(0,s.length-b.length).replace(/(.)\/+$/,"$1")}const m=o[f];return d&&!m?c[p]=void 0:c[p]=(m||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:i,pattern:e}}function vA(e,t=!1,n=!0){Wt(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,o,u)=>(r.push({paramName:o,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function wA(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Wt(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function ar(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function AA({basename:e,pathname:t}){return t==="/"?e:Sr([e,t])}var jy=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Il=e=>jy.test(e);function NA(e,t="/"){let{pathname:n,search:r="",hash:a=""}=typeof e=="string"?ea(e):e,s;if(n)if(Il(n))s=n;else{if(n.includes("//")){let i=n;n=n.replace(/\/\/+/g,"/"),Wt(!1,`Pathnames cannot have embedded double slashes - normalizing ${i} -> ${n}`)}n.startsWith("/")?s=$b(n.substring(1),"/"):s=$b(n,t)}else s=t;return{pathname:s,search:CA(r),hash:kA(a)}}function $b(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function Du(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function By(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Rl(e){let t=By(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Dl(e,t,n,r=!1){let a;typeof e=="string"?a=ea(e):(a={...e},it(!a.pathname||!a.pathname.includes("?"),Du("?","pathname","search",a)),it(!a.pathname||!a.pathname.includes("#"),Du("#","pathname","hash",a)),it(!a.search||!a.search.includes("#"),Du("#","search","hash",a)));let s=e===""||a.pathname==="",i=s?"/":a.pathname,o;if(i==null)o=n;else{let d=t.length-1;if(!r&&i.startsWith("..")){let f=i.split("/");for(;f[0]==="..";)f.shift(),d-=1;a.pathname=f.join("/")}o=d>=0?t[d]:"/"}let u=NA(a,o),c=i&&i!=="/"&&i.endsWith("/"),p=(s||i===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(c||p)&&(u.pathname+="/"),u}var Sr=e=>e.join("/").replace(/\/\/+/g,"/"),_A=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),CA=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,kA=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Ii=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function mi(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Ri(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Uy=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function $y(e,t){let n=e;if(typeof n!="string"||!jy.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,a=!1;if(Uy)try{let s=new URL(window.location.href),i=n.startsWith("//")?new URL(s.protocol+n):new URL(n),o=ar(i.pathname,t);i.origin===s.origin&&o!=null?n=o+i.search+i.hash:a=!0}catch{Wt(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:a,to:n}}var qr=Symbol("Uninstrumented");function IA(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(a=>a({id:t.id,index:t.index,path:t.path,instrument(s){let i=Object.keys(n);for(let o of i)s[o]&&n[o].push(s[o])}}));let r={};if(typeof t.lazy=="function"&&n.lazy.length>0){let a=Ha(n.lazy,t.lazy,()=>{});a&&(r.lazy=a)}if(typeof t.lazy=="object"){let a=t.lazy;["middleware","loader","action"].forEach(s=>{let i=a[s],o=n[`lazy.${s}`];if(typeof i=="function"&&o.length>0){let u=Ha(o,i,()=>{});u&&(r.lazy=Object.assign(r.lazy||{},{[s]:u}))}})}return["loader","action"].forEach(a=>{let s=t[a];if(typeof s=="function"&&n[a].length>0){let i=s[qr]??s,o=Ha(n[a],i,(...u)=>zb(u[0]));o&&(o[qr]=i,r[a]=o)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(a=>{let s=a[qr]??a,i=Ha(n.middleware,s,(...o)=>zb(o[0]));return i?(i[qr]=s,i):a})),r}function RA(e,t){let n={navigate:[],fetch:[]};if(t.forEach(r=>r({instrument(a){let s=Object.keys(a);for(let i of s)a[i]&&n[i].push(a[i])}})),n.navigate.length>0){let r=e.navigate[qr]??e.navigate,a=Ha(n.navigate,r,(...s)=>{let[i,o]=s;return{to:typeof i=="number"||typeof i=="string"?i:i?vr(i):".",...Hb(e,o??{})}});a&&(a[qr]=r,e.navigate=a)}if(n.fetch.length>0){let r=e.fetch[qr]??e.fetch,a=Ha(n.fetch,r,(...s)=>{let[i,,o,u]=s;return{href:o??".",fetcherKey:i,...Hb(e,u??{})}});a&&(a[qr]=r,e.fetch=a)}return e}function Ha(e,t,n){return e.length===0?null:async(...r)=>{let a=await zy(e,n(...r),()=>t(...r),e.length-1);if(a.type==="error")throw a.value;return a.value}}async function zy(e,t,n,r){let a=e[r],s;if(a){let i,o=async()=>(i?console.error("You cannot call instrumented handlers more than once"):i=zy(e,t,n,r-1),s=await i,it(s,"Expected a result"),s.type==="error"&&s.value instanceof Error?{status:"error",error:s.value}:{status:"success",error:void 0});try{await a(o,t)}catch(u){console.error("An instrumentation function threw an error:",u)}i||await o(),await i}else try{s={type:"success",value:await n()}}catch(i){s={type:"error",value:i}}return s||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function zb(e){let{request:t,context:n,params:r,unstable_pattern:a}=e;return{request:DA(t),params:{...r},unstable_pattern:a,context:OA(n)}}function Hb(e,t){return{currentUrl:vr(e.state.location),..."formMethod"in t?{formMethod:t.formMethod}:{},..."formEncType"in t?{formEncType:t.formEncType}:{},..."formData"in t?{formData:t.formData}:{},..."body"in t?{body:t.body}:{}}}function DA(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function OA(e){if(FA(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var LA=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function FA(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join("\0")===LA}var Hy=["POST","PUT","PATCH","DELETE"],MA=new Set(Hy),PA=["GET",...Hy],jA=new Set(PA),Gy=new Set([301,302,303,307,308]),BA=new Set([307,308]),Ou={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},UA={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Is={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},$A=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Wy="remix-router-transitions",Vy=Symbol("ResetLoaderData");function zA(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u";it(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let r=e.hydrationRouteProperties||[],a=e.mapRouteProperties||$A,s=a;if(e.unstable_instrumentations){let M=e.unstable_instrumentations;s=z=>({...a(z),...IA(M.map(Y=>Y.route).filter(Boolean),z)})}let i={},o=fi(e.routes,s,void 0,i),u,c=e.basename||"/";c.startsWith("/")||(c=`/${c}`);let p=e.dataStrategy||qA,d={...e.future},f=null,m=new Set,b=null,E=null,x=null,y=e.hydrationData!=null,S=Gr(o,e.history.location,c),w=!1,A=null,D;if(S==null&&!e.patchRoutesOnNavigation){let M=Jn(404,{pathname:e.history.location.pathname}),{matches:z,route:Y}=so(o);D=!0,S=z,A={[Y.id]:M}}else if(S&&!e.hydrationData&&Qe(S,o,e.history.location.pathname).active&&(S=null),S)if(S.some(M=>M.route.lazy))D=!1;else if(!S.some(M=>Dd(M.route)))D=!0;else{let M=e.hydrationData?e.hydrationData.loaderData:null,z=e.hydrationData?e.hydrationData.errors:null;if(z){let Y=S.findIndex(le=>z[le.route.id]!==void 0);D=S.slice(0,Y+1).every(le=>!Mc(le.route,M,z))}else D=S.every(Y=>!Mc(Y.route,M,z))}else{D=!1,S=[];let M=Qe(null,o,e.history.location.pathname);M.active&&M.matches&&(w=!0,S=M.matches)}let N,T={historyAction:e.history.action,location:e.history.location,matches:S,initialized:D,navigation:Ou,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||A,fetchers:new Map,blockers:new Map},v="POP",R=null,C=!1,U,k=!1,j=new Map,G=null,$=!1,te=!1,H=new Set,se=new Map,de=0,O=-1,ne=new Map,pe=new Set,L=new Map,ke=new Map,Re=new Set,Q=new Map,_e,fe=null;function X(){if(f=e.history.listen(({action:M,location:z,delta:Y})=>{if(_e){_e(),_e=void 0;return}Wt(Q.size===0||Y!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let le=Qt({currentLocation:T.location,nextLocation:z,historyAction:M});if(le&&Y!=null){let be=new Promise(Ie=>{_e=Ie});e.history.go(Y*-1),vt(le,{state:"blocked",location:z,proceed(){vt(le,{state:"proceeding",proceed:void 0,reset:void 0,location:z}),be.then(()=>e.history.go(Y))},reset(){let Ie=new Map(T.blockers);Ie.set(le,Is),me({blockers:Ie})}}),R?.resolve(),R=null;return}return Ze(M,z)}),n){dN(t,j);let M=()=>pN(t,j);t.addEventListener("pagehide",M),G=()=>t.removeEventListener("pagehide",M)}return T.initialized||Ze("POP",T.location,{initialHydration:!0}),N}function Ve(){f&&f(),G&&G(),m.clear(),U&&U.abort(),T.fetchers.forEach((M,z)=>ht(z)),T.blockers.forEach((M,z)=>je(z))}function ge(M){return m.add(M),()=>m.delete(M)}function me(M,z={}){M.matches&&(M.matches=M.matches.map(be=>{let Ie=i[be.route.id],Ce=be.route;return Ce.element!==Ie.element||Ce.errorElement!==Ie.errorElement||Ce.hydrateFallbackElement!==Ie.hydrateFallbackElement?{...be,route:Ie}:be})),T={...T,...M};let Y=[],le=[];T.fetchers.forEach((be,Ie)=>{be.state==="idle"&&(Re.has(Ie)?Y.push(Ie):le.push(Ie))}),Re.forEach(be=>{!T.fetchers.has(be)&&!se.has(be)&&Y.push(be)}),[...m].forEach(be=>be(T,{deletedFetchers:Y,newErrors:M.errors??null,viewTransitionOpts:z.viewTransitionOpts,flushSync:z.flushSync===!0})),Y.forEach(be=>ht(be)),le.forEach(be=>T.fetchers.delete(be))}function Te(M,z,{flushSync:Y}={}){let le=T.actionData!=null&&T.navigation.formMethod!=null&&kn(T.navigation.formMethod)&&T.navigation.state==="loading"&&M.state?._isRedirect!==!0,be;z.actionData?Object.keys(z.actionData).length>0?be=z.actionData:be=null:le?be=T.actionData:be=null;let Ie=z.loaderData?Jb(T.loaderData,z.loaderData,z.matches||[],z.errors):T.loaderData,Ce=T.blockers;Ce.size>0&&(Ce=new Map(Ce),Ce.forEach((We,Ue)=>Ce.set(Ue,Is)));let Oe=$?!1:nt(M,z.matches||T.matches),we=C===!0||T.navigation.formMethod!=null&&kn(T.navigation.formMethod)&&M.state?._isRedirect!==!0;u&&(o=u,u=void 0),$||v==="POP"||(v==="PUSH"?e.history.push(M,M.state):v==="REPLACE"&&e.history.replace(M,M.state));let Fe;if(v==="POP"){let We=j.get(T.location.pathname);We&&We.has(M.pathname)?Fe={currentLocation:T.location,nextLocation:M}:j.has(M.pathname)&&(Fe={currentLocation:M,nextLocation:T.location})}else if(k){let We=j.get(T.location.pathname);We?We.add(M.pathname):(We=new Set([M.pathname]),j.set(T.location.pathname,We)),Fe={currentLocation:T.location,nextLocation:M}}me({...z,actionData:be,loaderData:Ie,historyAction:v,location:M,initialized:!0,navigation:Ou,revalidation:"idle",restoreScrollPosition:Oe,preventScrollReset:we,blockers:Ce},{viewTransitionOpts:Fe,flushSync:Y===!0}),v="POP",C=!1,k=!1,$=!1,te=!1,R?.resolve(),R=null,fe?.resolve(),fe=null}async function ve(M,z){if(R?.resolve(),R=null,typeof M=="number"){R||(R=r0());let gt=R.promise;return e.history.go(M),gt}let Y=Fc(T.location,T.matches,c,M,z?.fromRouteId,z?.relative),{path:le,submission:be,error:Ie}=Gb(!1,Y,z),Ce=T.location,Oe=pi(T.location,le,z&&z.state);Oe={...Oe,...e.history.encodeLocation(Oe)};let we=z&&z.replace!=null?z.replace:void 0,Fe="PUSH";we===!0?Fe="REPLACE":we===!1||be!=null&&kn(be.formMethod)&&be.formAction===T.location.pathname+T.location.search&&(Fe="REPLACE");let We=z&&"preventScrollReset"in z?z.preventScrollReset===!0:void 0,Ue=(z&&z.flushSync)===!0,mt=Qt({currentLocation:Ce,nextLocation:Oe,historyAction:Fe});if(mt){vt(mt,{state:"blocked",location:Oe,proceed(){vt(mt,{state:"proceeding",proceed:void 0,reset:void 0,location:Oe}),ve(M,z)},reset(){let gt=new Map(T.blockers);gt.set(mt,Is),me({blockers:gt})}});return}await Ze(Fe,Oe,{submission:be,pendingError:Ie,preventScrollReset:We,replace:z&&z.replace,enableViewTransition:z&&z.viewTransition,flushSync:Ue,callSiteDefaultShouldRevalidate:z&&z.unstable_defaultShouldRevalidate})}function ie(){fe||(fe=r0()),oe(),me({revalidation:"loading"});let M=fe.promise;return T.navigation.state==="submitting"?M:T.navigation.state==="idle"?(Ze(T.historyAction,T.location,{startUninterruptedRevalidation:!0}),M):(Ze(v||T.historyAction,T.navigation.location,{overrideNavigation:T.navigation,enableViewTransition:k===!0}),M)}async function Ze(M,z,Y){U&&U.abort(),U=null,v=M,$=(Y&&Y.startUninterruptedRevalidation)===!0,Dt(T.location,T.matches),C=(Y&&Y.preventScrollReset)===!0,k=(Y&&Y.enableViewTransition)===!0;let le=u||o,be=Y&&Y.overrideNavigation,Ie=Y?.initialHydration&&T.matches&&T.matches.length>0&&!w?T.matches:Gr(le,z,c),Ce=(Y&&Y.flushSync)===!0;if(Ie&&T.initialized&&!te&&tN(T.location,z)&&!(Y&&Y.submission&&kn(Y.submission.formMethod))){Te(z,{matches:Ie},{flushSync:Ce});return}let Oe=Qe(Ie,le,z.pathname);if(Oe.active&&Oe.matches&&(Ie=Oe.matches),!Ie){let{error:en,notFoundMatches:En,route:_t}=Le(z.pathname);Te(z,{matches:En,loaderData:{},errors:{[_t.id]:en}},{flushSync:Ce});return}U=new AbortController;let we=Ua(e.history,z,U.signal,Y&&Y.submission),Fe=e.getContext?await e.getContext():new jb,We;if(Y&&Y.pendingError)We=[Wr(Ie).route.id,{type:"error",error:Y.pendingError}];else if(Y&&Y.submission&&kn(Y.submission.formMethod)){let en=await ot(we,z,Y.submission,Ie,Fe,Oe.active,Y&&Y.initialHydration===!0,{replace:Y.replace,flushSync:Ce});if(en.shortCircuited)return;if(en.pendingActionResult){let[En,_t]=en.pendingActionResult;if(Wn(_t)&&mi(_t.error)&&_t.error.status===404){U=null,Te(z,{matches:en.matches,loaderData:{},errors:{[En]:_t.error}});return}}Ie=en.matches||Ie,We=en.pendingActionResult,be=Lu(z,Y.submission),Ce=!1,Oe.active=!1,we=Ua(e.history,we.url,we.signal)}let{shortCircuited:Ue,matches:mt,loaderData:gt,errors:Jt}=await rt(we,z,Ie,Fe,Oe.active,be,Y&&Y.submission,Y&&Y.fetcherSubmission,Y&&Y.replace,Y&&Y.initialHydration===!0,Ce,We,Y&&Y.callSiteDefaultShouldRevalidate);Ue||(U=null,Te(z,{matches:mt||Ie,...e0(We),loaderData:gt,errors:Jt}))}async function ot(M,z,Y,le,be,Ie,Ce,Oe={}){oe();let we=uN(z,Y);if(me({navigation:we},{flushSync:Oe.flushSync===!0}),Ie){let Ue=await wt(le,z.pathname,M.signal);if(Ue.type==="aborted")return{shortCircuited:!0};if(Ue.type==="error"){if(Ue.partialMatches.length===0){let{matches:gt,route:Jt}=so(o);return{matches:gt,pendingActionResult:[Jt.id,{type:"error",error:Ue.error}]}}let mt=Wr(Ue.partialMatches).route.id;return{matches:Ue.partialMatches,pendingActionResult:[mt,{type:"error",error:Ue.error}]}}else if(Ue.matches)le=Ue.matches;else{let{notFoundMatches:mt,error:gt,route:Jt}=Le(z.pathname);return{matches:mt,pendingActionResult:[Jt.id,{type:"error",error:gt}]}}}let Fe,We=Lo(le,z);if(!We.route.action&&!We.route.lazy)Fe={type:"error",error:Jn(405,{method:M.method,pathname:z.pathname,routeId:We.route.id})};else{let Ue=Za(s,i,M,le,We,Ce?[]:r,be),mt=await et(M,Ue,be,null);if(Fe=mt[We.route.id],!Fe){for(let gt of le)if(mt[gt.route.id]){Fe=mt[gt.route.id];break}}if(M.signal.aborted)return{shortCircuited:!0}}if(ua(Fe)){let Ue;return Oe&&Oe.replace!=null?Ue=Oe.replace:Ue=Kb(Fe.response.headers.get("Location"),new URL(M.url),c)===T.location.pathname+T.location.search,await De(M,Fe,!0,{submission:Y,replace:Ue}),{shortCircuited:!0}}if(Wn(Fe)){let Ue=Wr(le,We.route.id);return(Oe&&Oe.replace)!==!0&&(v="PUSH"),{matches:le,pendingActionResult:[Ue.route.id,Fe,We.route.id]}}return{matches:le,pendingActionResult:[We.route.id,Fe]}}async function rt(M,z,Y,le,be,Ie,Ce,Oe,we,Fe,We,Ue,mt){let gt=Ie||Lu(z,Ce),Jt=Ce||Oe||n0(gt),en=!$&&!Fe;if(be){if(en){let Gt=Ht(Ue);me({navigation:gt,...Gt!==void 0?{actionData:Gt}:{}},{flushSync:We})}let lt=await wt(Y,z.pathname,M.signal);if(lt.type==="aborted")return{shortCircuited:!0};if(lt.type==="error"){if(lt.partialMatches.length===0){let{matches:Kn,route:xn}=so(o);return{matches:Kn,loaderData:{},errors:{[xn.id]:lt.error}}}let Gt=Wr(lt.partialMatches).route.id;return{matches:lt.partialMatches,loaderData:{},errors:{[Gt]:lt.error}}}else if(lt.matches)Y=lt.matches;else{let{error:Gt,notFoundMatches:Kn,route:xn}=Le(z.pathname);return{matches:Kn,loaderData:{},errors:{[xn.id]:Gt}}}}let En=u||o,{dsMatches:_t,revalidatingFetchers:jn}=Wb(M,le,s,i,e.history,T,Y,Jt,z,Fe?[]:r,Fe===!0,te,H,Re,L,pe,En,c,e.patchRoutesOnNavigation!=null,Ue,mt);if(O=++de,!e.dataStrategy&&!_t.some(lt=>lt.shouldLoad)&&!_t.some(lt=>lt.route.middleware&<.route.middleware.length>0)&&jn.length===0){let lt=ae();return Te(z,{matches:Y,loaderData:{},errors:Ue&&Wn(Ue[1])?{[Ue[0]]:Ue[1].error}:null,...e0(Ue),...lt?{fetchers:new Map(T.fetchers)}:{}},{flushSync:We}),{shortCircuited:!0}}if(en){let lt={};if(!be){lt.navigation=gt;let Gt=Ht(Ue);Gt!==void 0&&(lt.actionData=Gt)}jn.length>0&&(lt.fetchers=St(jn)),me(lt,{flushSync:We})}jn.forEach(lt=>{kt(lt.key),lt.controller&&se.set(lt.key,lt.controller)});let _n=()=>jn.forEach(lt=>kt(lt.key));U&&U.signal.addEventListener("abort",_n);let{loaderResults:Fr,fetcherResults:Cn}=await Z(_t,jn,M,le);if(M.signal.aborted)return{shortCircuited:!0};U&&U.signal.removeEventListener("abort",_n),jn.forEach(lt=>se.delete(lt.key));let Zn=io(Fr);if(Zn)return await De(M,Zn.result,!0,{replace:we}),{shortCircuited:!0};if(Zn=io(Cn),Zn)return pe.add(Zn.key),await De(M,Zn.result,!0,{replace:we}),{shortCircuited:!0};let{loaderData:_s,errors:Mr}=Qb(T,Y,Fr,Ue,jn,Cn);Fe&&T.errors&&(Mr={...T.errors,...Mr});let hr=ae(),Cr=Ne(O),Pr=hr||Cr||jn.length>0;return{matches:Y,loaderData:_s,errors:Mr,...Pr?{fetchers:new Map(T.fetchers)}:{}}}function Ht(M){if(M&&!Wn(M[1]))return{[M[0]]:M[1].data};if(T.actionData)return Object.keys(T.actionData).length===0?null:T.actionData}function St(M){return M.forEach(z=>{let Y=T.fetchers.get(z.key),le=Rs(void 0,Y?Y.data:void 0);T.fetchers.set(z.key,le)}),new Map(T.fetchers)}async function Ct(M,z,Y,le){kt(M);let be=(le&&le.flushSync)===!0,Ie=u||o,Ce=Fc(T.location,T.matches,c,Y,z,le?.relative),Oe=Gr(Ie,Ce,c),we=Qe(Oe,Ie,Ce);if(we.active&&we.matches&&(Oe=we.matches),!Oe){ue(M,z,Jn(404,{pathname:Ce}),{flushSync:be});return}let{path:Fe,submission:We,error:Ue}=Gb(!0,Ce,le);if(Ue){ue(M,z,Ue,{flushSync:be});return}let mt=e.getContext?await e.getContext():new jb,gt=(le&&le.preventScrollReset)===!0;if(We&&kn(We.formMethod)){await Zt(M,z,Fe,Oe,mt,we.active,be,gt,We,le&&le.unstable_defaultShouldRevalidate);return}L.set(M,{routeId:z,path:Fe}),await at(M,z,Fe,Oe,mt,we.active,be,gt,We)}async function Zt(M,z,Y,le,be,Ie,Ce,Oe,we,Fe){oe(),L.delete(M);let We=T.fetchers.get(M);J(M,cN(we,We),{flushSync:Ce});let Ue=new AbortController,mt=Ua(e.history,Y,Ue.signal,we);if(Ie){let Ut=await wt(le,new URL(mt.url).pathname,mt.signal,M);if(Ut.type==="aborted")return;if(Ut.type==="error"){ue(M,z,Ut.error,{flushSync:Ce});return}else if(Ut.matches)le=Ut.matches;else{ue(M,z,Jn(404,{pathname:Y}),{flushSync:Ce});return}}let gt=Lo(le,Y);if(!gt.route.action&&!gt.route.lazy){let Ut=Jn(405,{method:we.formMethod,pathname:Y,routeId:z});ue(M,z,Ut,{flushSync:Ce});return}se.set(M,Ue);let Jt=de,en=Za(s,i,mt,le,gt,r,be),En=await et(mt,en,be,M),_t=En[gt.route.id];if(!_t){for(let Ut of en)if(En[Ut.route.id]){_t=En[Ut.route.id];break}}if(mt.signal.aborted){se.get(M)===Ue&&se.delete(M);return}if(Re.has(M)){if(ua(_t)||Wn(_t)){J(M,kr(void 0));return}}else{if(ua(_t))if(se.delete(M),O>Jt){J(M,kr(void 0));return}else return pe.add(M),J(M,Rs(we)),De(mt,_t,!1,{fetcherSubmission:we,preventScrollReset:Oe});if(Wn(_t)){ue(M,z,_t.error);return}}let jn=T.navigation.location||T.location,_n=Ua(e.history,jn,Ue.signal),Fr=u||o,Cn=T.navigation.state!=="idle"?Gr(Fr,T.navigation.location,c):T.matches;it(Cn,"Didn't find any matches after fetcher action");let Zn=++de;ne.set(M,Zn);let _s=Rs(we,_t.data);T.fetchers.set(M,_s);let{dsMatches:Mr,revalidatingFetchers:hr}=Wb(_n,be,s,i,e.history,T,Cn,we,jn,r,!1,te,H,Re,L,pe,Fr,c,e.patchRoutesOnNavigation!=null,[gt.route.id,_t],Fe);hr.filter(Ut=>Ut.key!==M).forEach(Ut=>{let Oa=Ut.key,Cs=T.fetchers.get(Oa),ro=Rs(void 0,Cs?Cs.data:void 0);T.fetchers.set(Oa,ro),kt(Oa),Ut.controller&&se.set(Oa,Ut.controller)}),me({fetchers:new Map(T.fetchers)});let Cr=()=>hr.forEach(Ut=>kt(Ut.key));Ue.signal.addEventListener("abort",Cr);let{loaderResults:Pr,fetcherResults:lt}=await Z(Mr,hr,_n,be);if(Ue.signal.aborted)return;if(Ue.signal.removeEventListener("abort",Cr),ne.delete(M),se.delete(M),hr.forEach(Ut=>se.delete(Ut.key)),T.fetchers.has(M)){let Ut=kr(_t.data);T.fetchers.set(M,Ut)}let Gt=io(Pr);if(Gt)return De(_n,Gt.result,!1,{preventScrollReset:Oe});if(Gt=io(lt),Gt)return pe.add(Gt.key),De(_n,Gt.result,!1,{preventScrollReset:Oe});let{loaderData:Kn,errors:xn}=Qb(T,Cn,Pr,void 0,hr,lt);Ne(Zn),T.navigation.state==="loading"&&Zn>O?(it(v,"Expected pending action"),U&&U.abort(),Te(T.navigation.location,{matches:Cn,loaderData:Kn,errors:xn,fetchers:new Map(T.fetchers)})):(me({errors:xn,loaderData:Jb(T.loaderData,Kn,Cn,xn),fetchers:new Map(T.fetchers)}),te=!1)}async function at(M,z,Y,le,be,Ie,Ce,Oe,we){let Fe=T.fetchers.get(M);J(M,Rs(we,Fe?Fe.data:void 0),{flushSync:Ce});let We=new AbortController,Ue=Ua(e.history,Y,We.signal);if(Ie){let _t=await wt(le,new URL(Ue.url).pathname,Ue.signal,M);if(_t.type==="aborted")return;if(_t.type==="error"){ue(M,z,_t.error,{flushSync:Ce});return}else if(_t.matches)le=_t.matches;else{ue(M,z,Jn(404,{pathname:Y}),{flushSync:Ce});return}}let mt=Lo(le,Y);se.set(M,We);let gt=de,Jt=Za(s,i,Ue,le,mt,r,be),En=(await et(Ue,Jt,be,M))[mt.route.id];if(se.get(M)===We&&se.delete(M),!Ue.signal.aborted){if(Re.has(M)){J(M,kr(void 0));return}if(ua(En))if(O>gt){J(M,kr(void 0));return}else{pe.add(M),await De(Ue,En,!1,{preventScrollReset:Oe});return}if(Wn(En)){ue(M,z,En.error);return}J(M,kr(En.data))}}async function De(M,z,Y,{submission:le,fetcherSubmission:be,preventScrollReset:Ie,replace:Ce}={}){Y||(R?.resolve(),R=null),z.response.headers.has("X-Remix-Revalidate")&&(te=!0);let Oe=z.response.headers.get("Location");it(Oe,"Expected a Location header on the redirect Response"),Oe=Kb(Oe,new URL(M.url),c);let we=pi(T.location,Oe,{_isRedirect:!0});if(n){let Jt=!1;if(z.response.headers.has("X-Remix-Reload-Document"))Jt=!0;else if(Il(Oe)){const en=Fy(Oe,!0);Jt=en.origin!==t.location.origin||ar(en.pathname,c)==null}if(Jt){Ce?t.location.replace(Oe):t.location.assign(Oe);return}}U=null;let Fe=Ce===!0||z.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:We,formAction:Ue,formEncType:mt}=T.navigation;!le&&!be&&We&&Ue&&mt&&(le=n0(T.navigation));let gt=le||be;if(BA.has(z.response.status)&>&&kn(gt.formMethod))await Ze(Fe,we,{submission:{...gt,formAction:Oe},preventScrollReset:Ie||C,enableViewTransition:Y?k:void 0});else{let Jt=Lu(we,le);await Ze(Fe,we,{overrideNavigation:Jt,fetcherSubmission:be,preventScrollReset:Ie||C,enableViewTransition:Y?k:void 0})}}async function et(M,z,Y,le){let be,Ie={};try{be=await ZA(p,M,z,le,Y,!1)}catch(Ce){return z.filter(Oe=>Oe.shouldLoad).forEach(Oe=>{Ie[Oe.route.id]={type:"error",error:Ce}}),Ie}if(M.signal.aborted)return Ie;if(!kn(M.method))for(let Ce of z){if(be[Ce.route.id]?.type==="error")break;!be.hasOwnProperty(Ce.route.id)&&!T.loaderData.hasOwnProperty(Ce.route.id)&&(!T.errors||!T.errors.hasOwnProperty(Ce.route.id))&&Ce.shouldCallHandler()&&(be[Ce.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${Ce.route.id}`)})}for(let[Ce,Oe]of Object.entries(be))if(sN(Oe)){let we=Oe.result;Ie[Ce]={type:"redirect",response:JA(we,M,Ce,z,c)}}else Ie[Ce]=await QA(Oe);return Ie}async function Z(M,z,Y,le){let be=et(Y,M,le,null),Ie=Promise.all(z.map(async we=>{if(we.matches&&we.match&&we.request&&we.controller){let We=(await et(we.request,we.matches,le,we.key))[we.match.route.id];return{[we.key]:We}}else return Promise.resolve({[we.key]:{type:"error",error:Jn(404,{pathname:we.path})}})})),Ce=await be,Oe=(await Ie).reduce((we,Fe)=>Object.assign(we,Fe),{});return{loaderResults:Ce,fetcherResults:Oe}}function oe(){te=!0,L.forEach((M,z)=>{se.has(z)&&H.add(z),kt(z)})}function J(M,z,Y={}){T.fetchers.set(M,z),me({fetchers:new Map(T.fetchers)},{flushSync:(Y&&Y.flushSync)===!0})}function ue(M,z,Y,le={}){let be=Wr(T.matches,z);ht(M),me({errors:{[be.route.id]:Y},fetchers:new Map(T.fetchers)},{flushSync:(le&&le.flushSync)===!0})}function Pe(M){return ke.set(M,(ke.get(M)||0)+1),Re.has(M)&&Re.delete(M),T.fetchers.get(M)||UA}function qe(M,z){kt(M,z?.reason),J(M,kr(null))}function ht(M){let z=T.fetchers.get(M);se.has(M)&&!(z&&z.state==="loading"&&ne.has(M))&&kt(M),L.delete(M),ne.delete(M),pe.delete(M),Re.delete(M),H.delete(M),T.fetchers.delete(M)}function Rt(M){let z=(ke.get(M)||0)-1;z<=0?(ke.delete(M),Re.add(M)):ke.set(M,z),me({fetchers:new Map(T.fetchers)})}function kt(M,z){let Y=se.get(M);Y&&(Y.abort(z),se.delete(M))}function jt(M){for(let z of M){let Y=Pe(z),le=kr(Y.data);T.fetchers.set(z,le)}}function ae(){let M=[],z=!1;for(let Y of pe){let le=T.fetchers.get(Y);it(le,`Expected fetcher: ${Y}`),le.state==="loading"&&(pe.delete(Y),M.push(Y),z=!0)}return jt(M),z}function Ne(M){let z=[];for(let[Y,le]of ne)if(le<M){let be=T.fetchers.get(Y);it(be,`Expected fetcher: ${Y}`),be.state==="loading"&&(kt(Y),ne.delete(Y),z.push(Y))}return jt(z),z.length>0}function ze(M,z){let Y=T.blockers.get(M)||Is;return Q.get(M)!==z&&Q.set(M,z),Y}function je(M){T.blockers.delete(M),Q.delete(M)}function vt(M,z){let Y=T.blockers.get(M)||Is;it(Y.state==="unblocked"&&z.state==="blocked"||Y.state==="blocked"&&z.state==="blocked"||Y.state==="blocked"&&z.state==="proceeding"||Y.state==="blocked"&&z.state==="unblocked"||Y.state==="proceeding"&&z.state==="unblocked",`Invalid blocker state transition: ${Y.state} -> ${z.state}`);let le=new Map(T.blockers);le.set(M,z),me({blockers:le})}function Qt({currentLocation:M,nextLocation:z,historyAction:Y}){if(Q.size===0)return;Q.size>1&&Wt(!1,"A router only supports one blocker at a time");let le=Array.from(Q.entries()),[be,Ie]=le[le.length-1],Ce=T.blockers.get(be);if(!(Ce&&Ce.state==="proceeding")&&Ie({currentLocation:M,nextLocation:z,historyAction:Y}))return be}function Le(M){let z=Jn(404,{pathname:M}),Y=u||o,{matches:le,route:be}=so(Y);return{notFoundMatches:le,route:be,error:z}}function ft(M,z,Y){if(b=M,x=z,E=Y||null,!y&&T.navigation===Ou){y=!0;let le=nt(T.location,T.matches);le!=null&&me({restoreScrollPosition:le})}return()=>{b=null,x=null,E=null}}function Ke(M,z){return E&&E(M,z.map(le=>pA(le,T.loaderData)))||M.key}function Dt(M,z){if(b&&x){let Y=Ke(M,z);b[Y]=x()}}function nt(M,z){if(b){let Y=Ke(M,z),le=b[Y];if(typeof le=="number")return le}return null}function Qe(M,z,Y){if(e.patchRoutesOnNavigation)if(M){if(Object.keys(M[0].params).length>0)return{active:!0,matches:Ws(z,Y,c,!0)}}else return{active:!0,matches:Ws(z,Y,c,!0)||[]};return{active:!1,matches:null}}async function wt(M,z,Y,le){if(!e.patchRoutesOnNavigation)return{type:"success",matches:M};let be=M;for(;;){let Ie=u==null,Ce=u||o,Oe=i;try{await e.patchRoutesOnNavigation({signal:Y,path:z,matches:be,fetcherKey:le,patch:(We,Ue)=>{Y.aborted||Vb(We,Ue,Ce,Oe,s,!1)}})}catch(We){return{type:"error",error:We,partialMatches:be}}finally{Ie&&!Y.aborted&&(o=[...o])}if(Y.aborted)return{type:"aborted"};let we=Gr(Ce,z,c),Fe=null;if(we){if(Object.keys(we[0].params).length===0)return{type:"success",matches:we};if(Fe=Ws(Ce,z,c,!0),!(Fe&&be.length<Fe.length&&Kt(be,Fe.slice(0,be.length))))return{type:"success",matches:we}}if(Fe||(Fe=Ws(Ce,z,c,!0)),!Fe||Kt(be,Fe))return{type:"success",matches:null};be=Fe}}function Kt(M,z){return M.length===z.length&&M.every((Y,le)=>Y.route.id===z[le].route.id)}function W(M){i={},u=fi(M,s,void 0,i)}function Be(M,z,Y=!1){let le=u==null;Vb(M,z,u||o,i,s,Y),le&&(o=[...o],me({}))}return N={get basename(){return c},get future(){return d},get state(){return T},get routes(){return o},get window(){return t},initialize:X,subscribe:ge,enableScrollRestoration:ft,navigate:ve,fetch:Ct,revalidate:ie,createHref:M=>e.history.createHref(M),encodeLocation:M=>e.history.encodeLocation(M),getFetcher:Pe,resetFetcher:qe,deleteFetcher:Rt,dispose:Ve,getBlocker:ze,deleteBlocker:je,patchRoutes:Be,_internalFetchControllers:se,_internalSetRoutes:W,_internalSetStateDoNotUseOrYouWillBreakYourApp(M){me(M)}},e.unstable_instrumentations&&(N=RA(N,e.unstable_instrumentations.map(M=>M.router).filter(Boolean))),N}function HA(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function Fc(e,t,n,r,a,s){let i,o;if(a){i=[];for(let c of t)if(i.push(c),c.route.id===a){o=c;break}}else i=t,o=t[t.length-1];let u=Dl(r||".",Rl(i),ar(e.pathname,n)||e.pathname,s==="path");if(r==null&&(u.search=e.search,u.hash=e.hash),(r==null||r===""||r===".")&&o){let c=Ld(u.search);if(o.route.index&&!c)u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index";else if(!o.route.index&&c){let p=new URLSearchParams(u.search),d=p.getAll("index");p.delete("index"),d.filter(m=>m).forEach(m=>p.append("index",m));let f=p.toString();u.search=f?`?${f}`:""}}return n!=="/"&&(u.pathname=AA({basename:n,pathname:u.pathname})),vr(u)}function Gb(e,t,n){if(!n||!HA(n))return{path:t};if(n.formMethod&&!lN(n.formMethod))return{path:t,error:Jn(405,{method:n.formMethod})};let r=()=>({path:t,error:Jn(400,{type:"invalid-body"})}),s=(n.formMethod||"get").toUpperCase(),i=Qy(t);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!kn(s))return r();let d=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((f,[m,b])=>`${f}${m}=${b}
|
|
3
3
|
`,""):String(n.body);return{path:t,submission:{formMethod:s,formAction:i,formEncType:n.formEncType,formData:void 0,json:void 0,text:d}}}else if(n.formEncType==="application/json"){if(!kn(s))return r();try{let d=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:s,formAction:i,formEncType:n.formEncType,formData:void 0,json:d,text:void 0}}}catch{return r()}}}it(typeof FormData=="function","FormData is not available in this environment");let o,u;if(n.formData)o=jc(n.formData),u=n.formData;else if(n.body instanceof FormData)o=jc(n.body),u=n.body;else if(n.body instanceof URLSearchParams)o=n.body,u=Xb(o);else if(n.body==null)o=new URLSearchParams,u=new FormData;else try{o=new URLSearchParams(n.body),u=Xb(o)}catch{return r()}let c={formMethod:s,formAction:i,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:u,json:void 0,text:void 0};if(kn(c.formMethod))return{path:t,submission:c};let p=ea(t);return e&&p.search&&Ld(p.search)&&o.append("index",""),p.search=`?${o}`,{path:vr(p),submission:c}}function Wb(e,t,n,r,a,s,i,o,u,c,p,d,f,m,b,E,x,y,S,w,A){let D=w?Wn(w[1])?w[1].error:w[1].data:void 0,N=a.createURL(s.location),T=a.createURL(u),v;if(p&&s.errors){let $=Object.keys(s.errors)[0];v=i.findIndex(te=>te.route.id===$)}else if(w&&Wn(w[1])){let $=w[0];v=i.findIndex(te=>te.route.id===$)-1}let R=w?w[1].statusCode:void 0,C=R&&R>=400,U={currentUrl:N,currentParams:s.matches[0]?.params||{},nextUrl:T,nextParams:i[0].params,...o,actionResult:D,actionStatus:R},k=Ri(i),j=i.map(($,te)=>{let{route:H}=$,se=null;if(v!=null&&te>v?se=!1:H.lazy?se=!0:Dd(H)?p?se=Mc(H,s.loaderData,s.errors):GA(s.loaderData,s.matches[te],$)&&(se=!0):se=!1,se!==null)return Pc(n,r,e,k,$,c,t,se);let de=!1;typeof A=="boolean"?de=A:C?de=!1:(d||N.pathname+N.search===T.pathname+T.search||N.search!==T.search||WA(s.matches[te],$))&&(de=!0);let O={...U,defaultShouldRevalidate:de},ne=Ks($,O);return Pc(n,r,e,k,$,c,t,ne,O,A)}),G=[];return b.forEach(($,te)=>{if(p||!i.some(ke=>ke.route.id===$.routeId)||m.has(te))return;let H=s.fetchers.get(te),se=H&&H.state!=="idle"&&H.data===void 0,de=Gr(x,$.path,y);if(!de){if(S&&se)return;G.push({key:te,routeId:$.routeId,path:$.path,matches:null,match:null,request:null,controller:null});return}if(E.has(te))return;let O=Lo(de,$.path),ne=new AbortController,pe=Ua(a,$.path,ne.signal),L=null;if(f.has(te))f.delete(te),L=Za(n,r,pe,de,O,c,t);else if(se)d&&(L=Za(n,r,pe,de,O,c,t));else{let ke;typeof A=="boolean"?ke=A:C?ke=!1:ke=d;let Re={...U,defaultShouldRevalidate:ke};Ks(O,Re)&&(L=Za(n,r,pe,de,O,c,t,Re))}L&&G.push({key:te,routeId:$.routeId,path:$.path,matches:L,match:O,request:pe,controller:ne})}),{dsMatches:j,revalidatingFetchers:G}}function Dd(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function Mc(e,t,n){if(e.lazy)return!0;if(!Dd(e))return!1;let r=t!=null&&e.id in t,a=n!=null&&n[e.id]!==void 0;return!r&&a?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!r&&!a}function GA(e,t,n){let r=!t||n.route.id!==t.route.id,a=!e.hasOwnProperty(n.route.id);return r||a}function WA(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function Ks(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}function Vb(e,t,n,r,a,s){let i;if(e){let c=r[e];it(c,`No route found to patch children into: routeId = ${e}`),c.children||(c.children=[]),i=c.children}else i=n;let o=[],u=[];if(t.forEach(c=>{let p=i.find(d=>qy(c,d));p?u.push({existingRoute:p,newRoute:c}):o.push(c)}),o.length>0){let c=fi(o,a,[e||"_","patch",String(i?.length||"0")],r);i.push(...c)}if(s&&u.length>0)for(let c=0;c<u.length;c++){let{existingRoute:p,newRoute:d}=u[c],f=p,[m]=fi([d],a,[],{},!0);Object.assign(f,{element:m.element?m.element:f.element,errorElement:m.errorElement?m.errorElement:f.errorElement,hydrateFallbackElement:m.hydrateFallbackElement?m.hydrateFallbackElement:f.hydrateFallbackElement})}}function qy(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children.every((n,r)=>t.children?.some(a=>qy(n,a))):!1}var qb=new WeakMap,Yy=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let a=n[t.id];if(it(a,"No route found in manifest"),!a.lazy||typeof a.lazy!="object")return;let s=a.lazy[e];if(!s)return;let i=qb.get(a);i||(i={},qb.set(a,i));let o=i[e];if(o)return o;let u=(async()=>{let c=lA(e),d=a[e]!==void 0&&e!=="hasErrorBoundary";if(c)Wt(!c,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),i[e]=Promise.resolve();else if(d)Wt(!1,`Route "${a.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let f=await s();f!=null&&(Object.assign(a,{[e]:f}),Object.assign(a,r(a)))}typeof a.lazy=="object"&&(a.lazy[e]=void 0,Object.values(a.lazy).every(f=>f===void 0)&&(a.lazy=void 0))})();return i[e]=u,u},Yb=new WeakMap;function VA(e,t,n,r,a){let s=n[e.id];if(it(s,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let p=Yb.get(s);if(p)return{lazyRoutePromise:p,lazyHandlerPromise:p};let d=(async()=>{it(typeof e.lazy=="function","No lazy route function found");let f=await e.lazy(),m={};for(let b in f){let E=f[b];if(E===void 0)continue;let x=cA(b),S=s[b]!==void 0&&b!=="hasErrorBoundary";x?Wt(!x,"Route property "+b+" is not a supported property to be returned from a lazy route function. This property will be ignored."):S?Wt(!S,`Route "${s.id}" has a static property "${b}" defined but its lazy function is also returning a value for this property. The lazy route property "${b}" will be ignored.`):m[b]=E}Object.assign(s,m),Object.assign(s,{...r(s),lazy:void 0})})();return Yb.set(s,d),d.catch(()=>{}),{lazyRoutePromise:d,lazyHandlerPromise:d}}let i=Object.keys(e.lazy),o=[],u;for(let p of i){if(a&&a.includes(p))continue;let d=Yy({key:p,route:e,manifest:n,mapRouteProperties:r});d&&(o.push(d),p===t&&(u=d))}let c=o.length>0?Promise.all(o).then(()=>{}):void 0;return c?.catch(()=>{}),u?.catch(()=>{}),{lazyRoutePromise:c,lazyHandlerPromise:u}}async function Zb(e){let t=e.matches.filter(a=>a.shouldLoad),n={};return(await Promise.all(t.map(a=>a.resolve()))).forEach((a,s)=>{n[t[s].route.id]=a}),n}async function qA(e){return e.matches.some(t=>t.route.middleware)?Zy(e,()=>Zb(e)):Zb(e)}function Zy(e,t){return YA(e,t,r=>{if(oN(r))throw r;return r},rN,n);function n(r,a,s){if(s)return Promise.resolve(Object.assign(s.value,{[a]:{type:"error",result:r}}));{let{matches:i}=e,o=Math.min(Math.max(i.findIndex(c=>c.route.id===a),0),Math.max(i.findIndex(c=>c.shouldCallHandler()),0)),u=Wr(i,i[o].route.id).route.id;return Promise.resolve({[u]:{type:"error",result:r}})}}}async function YA(e,t,n,r,a){let{matches:s,request:i,params:o,context:u,unstable_pattern:c}=e,p=s.flatMap(f=>f.route.middleware?f.route.middleware.map(m=>[f.route.id,m]):[]);return await Ky({request:i,params:o,context:u,unstable_pattern:c},p,t,n,r,a)}async function Ky(e,t,n,r,a,s,i=0){let{request:o}=e;if(o.signal.aborted)throw o.signal.reason??new Error(`Request aborted: ${o.method} ${o.url}`);let u=t[i];if(!u)return await n();let[c,p]=u,d,f=async()=>{if(d)throw new Error("You may only call `next()` once per middleware");try{return d={value:await Ky(e,t,n,r,a,s,i+1)},d.value}catch(m){return d={value:await s(m,c,d)},d.value}};try{let m=await p(e,f),b=m!=null?r(m):void 0;return a(b)?b:d?b??d.value:(d={value:await f()},d.value)}catch(m){return await s(m,c,d)}}function Xy(e,t,n,r,a){let s=Yy({key:"middleware",route:r.route,manifest:t,mapRouteProperties:e}),i=VA(r.route,kn(n.method)?"action":"loader",t,e,a);return{middleware:s,route:i.lazyRoutePromise,handler:i.lazyHandlerPromise}}function Pc(e,t,n,r,a,s,i,o,u=null,c){let p=!1,d=Xy(e,t,n,a,s);return{...a,_lazyPromises:d,shouldLoad:o,shouldRevalidateArgs:u,shouldCallHandler(f){return p=!0,u?typeof c=="boolean"?Ks(a,{...u,defaultShouldRevalidate:c}):typeof f=="boolean"?Ks(a,{...u,defaultShouldRevalidate:f}):Ks(a,u):o},resolve(f){let{lazy:m,loader:b,middleware:E}=a.route,x=p||o||f&&!kn(n.method)&&(m||b),y=E&&E.length>0&&!b&&!m;return x&&(kn(n.method)||!y)?KA({request:n,unstable_pattern:r,match:a,lazyHandlerPromise:d?.handler,lazyRoutePromise:d?.route,handlerOverride:f,scopedContext:i}):Promise.resolve({type:"data",result:void 0})}}}function Za(e,t,n,r,a,s,i,o=null){return r.map(u=>u.route.id!==a.route.id?{...u,shouldLoad:!1,shouldRevalidateArgs:o,shouldCallHandler:()=>!1,_lazyPromises:Xy(e,t,n,u,s),resolve:()=>Promise.resolve({type:"data",result:void 0})}:Pc(e,t,n,Ri(r),u,s,i,!0,o))}async function ZA(e,t,n,r,a,s){n.some(c=>c._lazyPromises?.middleware)&&await Promise.all(n.map(c=>c._lazyPromises?.middleware));let i={request:t,unstable_pattern:Ri(n),params:n[0].params,context:a,matches:n},u=await e({...i,fetcherKey:r,runClientMiddleware:c=>{let p=i;return Zy(p,()=>c({...p,fetcherKey:r,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(n.flatMap(c=>[c._lazyPromises?.handler,c._lazyPromises?.route]))}catch{}return u}async function KA({request:e,unstable_pattern:t,match:n,lazyHandlerPromise:r,lazyRoutePromise:a,handlerOverride:s,scopedContext:i}){let o,u,c=kn(e.method),p=c?"action":"loader",d=f=>{let m,b=new Promise((y,S)=>m=S);u=()=>m(),e.signal.addEventListener("abort",u);let E=y=>typeof f!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${p}" [routeId: ${n.route.id}]`)):f({request:e,unstable_pattern:t,params:n.params,context:i},...y!==void 0?[y]:[]),x=(async()=>{try{return{type:"data",result:await(s?s(S=>E(S)):E())}}catch(y){return{type:"error",result:y}}})();return Promise.race([x,b])};try{let f=c?n.route.action:n.route.loader;if(r||a)if(f){let m,[b]=await Promise.all([d(f).catch(E=>{m=E}),r,a]);if(m!==void 0)throw m;o=b}else{await r;let m=c?n.route.action:n.route.loader;if(m)[o]=await Promise.all([d(m),a]);else if(p==="action"){let b=new URL(e.url),E=b.pathname+b.search;throw Jn(405,{method:e.method,pathname:E,routeId:n.route.id})}else return{type:"data",result:void 0}}else if(f)o=await d(f);else{let m=new URL(e.url),b=m.pathname+m.search;throw Jn(404,{pathname:b})}}catch(f){return{type:"error",result:f}}finally{u&&e.signal.removeEventListener("abort",u)}return o}async function XA(e){let t=e.headers.get("Content-Type");return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function QA(e){let{result:t,type:n}=e;if(Od(t)){let r;try{r=await XA(t)}catch(a){return{type:"error",error:a}}return n==="error"?{type:"error",error:new Ii(t.status,t.statusText,r),statusCode:t.status,headers:t.headers}:{type:"data",data:r,statusCode:t.status,headers:t.headers}}return n==="error"?t0(t)?t.data instanceof Error?{type:"error",error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:nN(t),statusCode:mi(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:t,statusCode:mi(t)?t.status:void 0}:t0(t)?{type:"data",data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"data",data:t}}function JA(e,t,n,r,a){let s=e.headers.get("Location");if(it(s,"Redirects returned/thrown from loaders/actions must have a Location header"),!Il(s)){let i=r.slice(0,r.findIndex(o=>o.route.id===n)+1);s=Fc(new URL(t.url),i,a,s),e.headers.set("Location",s)}return e}function Kb(e,t,n){if(Il(e)){let r=e,a=r.startsWith("//")?new URL(t.protocol+r):new URL(r),s=ar(a.pathname,n)!=null;if(a.origin===t.origin&&s)return a.pathname+a.search+a.hash}return e}function Ua(e,t,n,r){let a=e.createURL(Qy(t)).toString(),s={signal:n};if(r&&kn(r.formMethod)){let{formMethod:i,formEncType:o}=r;s.method=i.toUpperCase(),o==="application/json"?(s.headers=new Headers({"Content-Type":o}),s.body=JSON.stringify(r.json)):o==="text/plain"?s.body=r.text:o==="application/x-www-form-urlencoded"&&r.formData?s.body=jc(r.formData):s.body=r.formData}return new Request(a,s)}function jc(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function Xb(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function eN(e,t,n,r=!1,a=!1){let s={},i=null,o,u=!1,c={},p=n&&Wn(n[1])?n[1].error:void 0;return e.forEach(d=>{if(!(d.route.id in t))return;let f=d.route.id,m=t[f];if(it(!ua(m),"Cannot handle redirect results in processLoaderData"),Wn(m)){let b=m.error;if(p!==void 0&&(b=p,p=void 0),i=i||{},a)i[f]=b;else{let E=Wr(e,f);i[E.route.id]==null&&(i[E.route.id]=b)}r||(s[f]=Vy),u||(u=!0,o=mi(m.error)?m.error.status:500),m.headers&&(c[f]=m.headers)}else s[f]=m.data,m.statusCode&&m.statusCode!==200&&!u&&(o=m.statusCode),m.headers&&(c[f]=m.headers)}),p!==void 0&&n&&(i={[n[0]]:p},n[2]&&(s[n[2]]=void 0)),{loaderData:s,errors:i,statusCode:o||200,loaderHeaders:c}}function Qb(e,t,n,r,a,s){let{loaderData:i,errors:o}=eN(t,n,r);return a.filter(u=>!u.matches||u.matches.some(c=>c.shouldLoad)).forEach(u=>{let{key:c,match:p,controller:d}=u;if(d&&d.signal.aborted)return;let f=s[c];if(it(f,"Did not find corresponding fetcher result"),Wn(f)){let m=Wr(e.matches,p?.route.id);o&&o[m.route.id]||(o={...o,[m.route.id]:f.error}),e.fetchers.delete(c)}else if(ua(f))it(!1,"Unhandled fetcher revalidation redirect");else{let m=kr(f.data);e.fetchers.set(c,m)}}),{loaderData:i,errors:o}}function Jb(e,t,n,r){let a=Object.entries(t).filter(([,s])=>s!==Vy).reduce((s,[i,o])=>(s[i]=o,s),{});for(let s of n){let i=s.route.id;if(!t.hasOwnProperty(i)&&e.hasOwnProperty(i)&&s.route.loader&&(a[i]=e[i]),r&&r.hasOwnProperty(i))break}return a}function e0(e){return e?Wn(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Wr(e,t){return(t?e.slice(0,e.findIndex(r=>r.route.id===t)+1):[...e]).reverse().find(r=>r.route.hasErrorBoundary===!0)||e[0]}function so(e){let t=e.length===1?e[0]:e.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function Jn(e,{pathname:t,routeId:n,method:r,type:a,message:s}={}){let i="Unknown Server Error",o="Unknown @remix-run/router error";return e===400?(i="Bad Request",r&&t&&n?o=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:a==="invalid-body"&&(o="Unable to encode submission body")):e===403?(i="Forbidden",o=`Route "${n}" does not match URL "${t}"`):e===404?(i="Not Found",o=`No route matches URL "${t}"`):e===405&&(i="Method Not Allowed",r&&t&&n?o=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(o=`Invalid request method "${r.toUpperCase()}"`)),new Ii(e||500,i,new Error(o),!0)}function io(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[r,a]=t[n];if(ua(a))return{key:r,result:a}}}function Qy(e){let t=typeof e=="string"?ea(e):e;return vr({...t,hash:""})}function tN(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function nN(e){return new Ii(e.init?.status??500,e.init?.statusText??"Internal Server Error",e.data)}function rN(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([t,n])=>typeof t=="string"&&aN(n))}function aN(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function sN(e){return Od(e.result)&&Gy.has(e.result.status)}function Wn(e){return e.type==="error"}function ua(e){return(e&&e.type)==="redirect"}function t0(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function Od(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function iN(e){return Gy.has(e)}function oN(e){return Od(e)&&iN(e.status)&&e.headers.has("Location")}function lN(e){return jA.has(e.toUpperCase())}function kn(e){return MA.has(e.toUpperCase())}function Ld(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Lo(e,t){let n=typeof t=="string"?ea(t).search:t.search;if(e[e.length-1].route.index&&Ld(n||""))return e[e.length-1];let r=By(e);return r[r.length-1]}function n0(e){let{formMethod:t,formAction:n,formEncType:r,text:a,formData:s,json:i}=e;if(!(!t||!n||!r)){if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:a};if(s!=null)return{formMethod:t,formAction:n,formEncType:r,formData:s,json:void 0,text:void 0};if(i!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:i,text:void 0}}}function Lu(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function uN(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function Rs(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function cN(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function kr(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function dN(e,t){try{let n=e.sessionStorage.getItem(Wy);if(n){let r=JSON.parse(n);for(let[a,s]of Object.entries(r||{}))s&&Array.isArray(s)&&t.set(a,new Set(s||[]))}}catch{}}function pN(e,t){if(t.size>0){let n={};for(let[r,a]of t)n[r]=[...a];try{e.sessionStorage.setItem(Wy,JSON.stringify(n))}catch(r){Wt(!1,`Failed to save applied view transitions in sessionStorage (${r}).`)}}}function r0(){let e,t,n=new Promise((r,a)=>{e=async s=>{r(s);try{await n}catch{}},t=async s=>{a(s);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var Ta=g.createContext(null);Ta.displayName="DataRouter";var Di=g.createContext(null);Di.displayName="DataRouterState";var Jy=g.createContext(!1);function fN(){return g.useContext(Jy)}var Fd=g.createContext({isTransitioning:!1});Fd.displayName="ViewTransition";var e1=g.createContext(new Map);e1.displayName="Fetchers";var mN=g.createContext(null);mN.displayName="Await";var Yn=g.createContext(null);Yn.displayName="Navigation";var Ol=g.createContext(null);Ol.displayName="Location";var dr=g.createContext({outlet:null,matches:[],isDataRoute:!1});dr.displayName="Route";var Md=g.createContext(null);Md.displayName="RouteError";var t1="REACT_ROUTER_ERROR",hN="REDIRECT",gN="ROUTE_ERROR_RESPONSE";function bN(e){if(e.startsWith(`${t1}:${hN}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function EN(e){if(e.startsWith(`${t1}:${gN}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Ii(t.status,t.statusText,t.data)}catch{}}function xN(e,{relative:t}={}){it(cs(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=g.useContext(Yn),{hash:a,pathname:s,search:i}=Oi(e,{relative:t}),o=s;return n!=="/"&&(o=s==="/"?n:Sr([n,s])),r.createHref({pathname:o,search:i,hash:a})}function cs(){return g.useContext(Ol)!=null}function sr(){return it(cs(),"useLocation() may be used only in the context of a <Router> component."),g.useContext(Ol).location}var n1="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function r1(e){g.useContext(Yn).static||g.useLayoutEffect(e)}function Ll(){let{isDataRoute:e}=g.useContext(dr);return e?LN():yN()}function yN(){it(cs(),"useNavigate() may be used only in the context of a <Router> component.");let e=g.useContext(Ta),{basename:t,navigator:n}=g.useContext(Yn),{matches:r}=g.useContext(dr),{pathname:a}=sr(),s=JSON.stringify(Rl(r)),i=g.useRef(!1);return r1(()=>{i.current=!0}),g.useCallback((u,c={})=>{if(Wt(i.current,n1),!i.current)return;if(typeof u=="number"){n.go(u);return}let p=Dl(u,JSON.parse(s),a,c.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:Sr([t,p.pathname])),(c.replace?n.replace:n.push)(p,c.state,c)},[t,n,s,a,e])}var TN=g.createContext(null);function SN(e){let t=g.useContext(dr).outlet;return g.useMemo(()=>t&&g.createElement(TN.Provider,{value:e},t),[t,e])}function Oi(e,{relative:t}={}){let{matches:n}=g.useContext(dr),{pathname:r}=sr(),a=JSON.stringify(Rl(n));return g.useMemo(()=>Dl(e,JSON.parse(a),r,t==="path"),[e,a,r,t])}function vN(e,t,n,r,a){it(cs(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=g.useContext(Yn),{matches:i}=g.useContext(dr),o=i[i.length-1],u=o?o.params:{},c=o?o.pathname:"/",p=o?o.pathnameBase:"/",d=o&&o.route;{let S=d&&d.path||"";s1(c,!d||S.endsWith("*")||S.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${S}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
4
4
|
|
|
5
5
|
Please change the parent <Route path="${S}"> to <Route path="${S==="/"?"*":`${S}/*`}">.`)}let f=sr(),m;m=f;let b=m.pathname||"/",E=b;if(p!=="/"){let S=p.replace(/^\//,"").split("/");E="/"+b.replace(/^\//,"").split("/").slice(S.length).join("/")}let x=Gr(e,{pathname:E});return Wt(d||x!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),Wt(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),CN(x&&x.map(S=>Object.assign({},S,{params:Object.assign({},u,S.params),pathname:Sr([p,s.encodeLocation?s.encodeLocation(S.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?p:Sr([p,s.encodeLocation?s.encodeLocation(S.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathnameBase])})),i,n,r,a)}function wN(){let e=ON(),t=mi(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:r},s={padding:"2px 4px",backgroundColor:r},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=g.createElement(g.Fragment,null,g.createElement("p",null,"💿 Hey developer 👋"),g.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",g.createElement("code",{style:s},"ErrorBoundary")," or"," ",g.createElement("code",{style:s},"errorElement")," prop on your route.")),g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},t),n?g.createElement("pre",{style:a},n):null,i)}var AN=g.createElement(wN,null),a1=class extends g.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=EN(e.digest);n&&(e=n)}let t=e!==void 0?g.createElement(dr.Provider,{value:this.props.routeContext},g.createElement(Md.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?g.createElement(NN,{error:e},t):t}};a1.contextType=Jy;var Fu=new WeakMap;function NN({children:e,error:t}){let{basename:n}=g.useContext(Yn);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=bN(t.digest);if(r){let a=Fu.get(t);if(a)throw a;let s=$y(r.location,n);if(Uy&&!Fu.get(t))if(s.isExternal||r.reloadDocument)window.location.href=s.absoluteURL||s.to;else{const i=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(s.to,{replace:r.replace}));throw Fu.set(t,i),i}return g.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return e}function _N({routeContext:e,match:t,children:n}){let r=g.useContext(Ta);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),g.createElement(dr.Provider,{value:e},n)}function CN(e,t=[],n=null,r=null,a=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let s=e,i=n?.errors;if(i!=null){let p=s.findIndex(d=>d.route.id&&i?.[d.route.id]!==void 0);it(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),s=s.slice(0,Math.min(s.length,p+1))}let o=!1,u=-1;if(n)for(let p=0;p<s.length;p++){let d=s[p];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(u=p),d.route.id){let{loaderData:f,errors:m}=n,b=d.route.loader&&!f.hasOwnProperty(d.route.id)&&(!m||m[d.route.id]===void 0);if(d.route.lazy||b){o=!0,u>=0?s=s.slice(0,u+1):s=[s[0]];break}}}let c=n&&r?(p,d)=>{r(p,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:Ri(n.matches),errorInfo:d})}:void 0;return s.reduceRight((p,d,f)=>{let m,b=!1,E=null,x=null;n&&(m=i&&d.route.id?i[d.route.id]:void 0,E=d.route.errorElement||AN,o&&(u<0&&f===0?(s1("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),b=!0,x=null):u===f&&(b=!0,x=d.route.hydrateFallbackElement||null)));let y=t.concat(s.slice(0,f+1)),S=()=>{let w;return m?w=E:b?w=x:d.route.Component?w=g.createElement(d.route.Component,null):d.route.element?w=d.route.element:w=p,g.createElement(_N,{match:d,routeContext:{outlet:p,matches:y,isDataRoute:n!=null},children:w})};return n&&(d.route.ErrorBoundary||d.route.errorElement||f===0)?g.createElement(a1,{location:n.location,revalidation:n.revalidation,component:E,error:m,children:S(),routeContext:{outlet:null,matches:y,isDataRoute:!0},onError:c}):S()},null)}function Pd(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function kN(e){let t=g.useContext(Ta);return it(t,Pd(e)),t}function IN(e){let t=g.useContext(Di);return it(t,Pd(e)),t}function RN(e){let t=g.useContext(dr);return it(t,Pd(e)),t}function jd(e){let t=RN(e),n=t.matches[t.matches.length-1];return it(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function DN(){return jd("useRouteId")}function ON(){let e=g.useContext(Md),t=IN("useRouteError"),n=jd("useRouteError");return e!==void 0?e:t.errors?.[n]}function LN(){let{router:e}=kN("useNavigate"),t=jd("useNavigate"),n=g.useRef(!1);return r1(()=>{n.current=!0}),g.useCallback(async(a,s={})=>{Wt(n.current,n1),n.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:t,...s}))},[e,t])}var a0={};function s1(e,t,n){!t&&!a0[e]&&(a0[e]=!0,Wt(!1,n))}var s0={};function i0(e,t){!e&&!s0[t]&&(s0[t]=!0,console.warn(t))}var FN="useOptimistic",o0=Qw[FN],MN=()=>{};function PN(e){return o0?o0(e):[e,MN]}function jN(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&Wt(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:g.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&Wt(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:g.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&Wt(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:g.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var BN=["HydrateFallback","hydrateFallbackElement"],UN=class{constructor(){this.status="pending",this.promise=new Promise((e,t)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",e(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",t(n))}})}};function $N({router:e,flushSync:t,onError:n,unstable_useTransitions:r}){r=fN()||r;let[s,i]=g.useState(e.state),[o,u]=PN(s),[c,p]=g.useState(),[d,f]=g.useState({isTransitioning:!1}),[m,b]=g.useState(),[E,x]=g.useState(),[y,S]=g.useState(),w=g.useRef(new Map),A=g.useCallback((v,{deletedFetchers:R,newErrors:C,flushSync:U,viewTransitionOpts:k})=>{C&&n&&Object.values(C).forEach(G=>n(G,{location:v.location,params:v.matches[0]?.params??{},unstable_pattern:Ri(v.matches)})),v.fetchers.forEach((G,$)=>{G.data!==void 0&&w.current.set($,G.data)}),R.forEach(G=>w.current.delete(G)),i0(U===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let j=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition=="function";if(i0(k==null||j,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!k||!j){t&&U?t(()=>i(v)):r===!1?i(v):g.startTransition(()=>{r===!0&&u(G=>l0(G,v)),i(v)});return}if(t&&U){t(()=>{E&&(m?.resolve(),E.skipTransition()),f({isTransitioning:!0,flushSync:!0,currentLocation:k.currentLocation,nextLocation:k.nextLocation})});let G=e.window.document.startViewTransition(()=>{t(()=>i(v))});G.finished.finally(()=>{t(()=>{b(void 0),x(void 0),p(void 0),f({isTransitioning:!1})})}),t(()=>x(G));return}E?(m?.resolve(),E.skipTransition(),S({state:v,currentLocation:k.currentLocation,nextLocation:k.nextLocation})):(p(v),f({isTransitioning:!0,flushSync:!1,currentLocation:k.currentLocation,nextLocation:k.nextLocation}))},[e.window,t,E,m,r,u,n]);g.useLayoutEffect(()=>e.subscribe(A),[e,A]),g.useEffect(()=>{d.isTransitioning&&!d.flushSync&&b(new UN)},[d]),g.useEffect(()=>{if(m&&c&&e.window){let v=c,R=m.promise,C=e.window.document.startViewTransition(async()=>{r===!1?i(v):g.startTransition(()=>{r===!0&&u(U=>l0(U,v)),i(v)}),await R});C.finished.finally(()=>{b(void 0),x(void 0),p(void 0),f({isTransitioning:!1})}),x(C)}},[c,m,e.window,r,u]),g.useEffect(()=>{m&&c&&o.location.key===c.location.key&&m.resolve()},[m,E,o.location,c]),g.useEffect(()=>{!d.isTransitioning&&y&&(p(y.state),f({isTransitioning:!0,flushSync:!1,currentLocation:y.currentLocation,nextLocation:y.nextLocation}),S(void 0))},[d.isTransitioning,y]);let D=g.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:v=>e.navigate(v),push:(v,R,C)=>e.navigate(v,{state:R,preventScrollReset:C?.preventScrollReset}),replace:(v,R,C)=>e.navigate(v,{replace:!0,state:R,preventScrollReset:C?.preventScrollReset})}),[e]),N=e.basename||"/",T=g.useMemo(()=>({router:e,navigator:D,static:!1,basename:N,onError:n}),[e,D,N,n]);return g.createElement(g.Fragment,null,g.createElement(Ta.Provider,{value:T},g.createElement(Di.Provider,{value:o},g.createElement(e1.Provider,{value:w.current},g.createElement(Fd.Provider,{value:d},g.createElement(WN,{basename:N,location:o.location,navigationType:o.historyAction,navigator:D,unstable_useTransitions:r},g.createElement(zN,{routes:e.routes,future:e.future,state:o,onError:n})))))),null)}function l0(e,t){return{...e,navigation:t.navigation.state!=="idle"?t.navigation:e.navigation,revalidation:t.revalidation!=="idle"?t.revalidation:e.revalidation,actionData:t.navigation.state!=="submitting"?t.actionData:e.actionData,fetchers:t.fetchers}}var zN=g.memo(HN);function HN({routes:e,future:t,state:n,onError:r}){return vN(e,void 0,n,r,t)}function u0({to:e,replace:t,state:n,relative:r}){it(cs(),"<Navigate> may be used only in the context of a <Router> component.");let{static:a}=g.useContext(Yn);Wt(!a,"<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:s}=g.useContext(dr),{pathname:i}=sr(),o=Ll(),u=Dl(e,Rl(s),i,r==="path"),c=JSON.stringify(u);return g.useEffect(()=>{o(JSON.parse(c),{replace:t,state:n,relative:r})},[o,c,r,t,n]),null}function GN(e){return SN(e.context)}function WN({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:a,static:s=!1,unstable_useTransitions:i}){it(!cs(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let o=e.replace(/^\/*/,"/"),u=g.useMemo(()=>({basename:o,navigator:a,static:s,unstable_useTransitions:i,future:{}}),[o,a,s,i]);typeof n=="string"&&(n=ea(n));let{pathname:c="/",search:p="",hash:d="",state:f=null,key:m="default"}=n,b=g.useMemo(()=>{let E=ar(c,o);return E==null?null:{location:{pathname:E,search:p,hash:d,state:f,key:m},navigationType:r}},[o,c,p,d,f,m,r]);return Wt(b!=null,`<Router basename="${o}"> is not able to match the URL "${c}${p}${d}" because it does not start with the basename, so the <Router> won't render anything.`),b==null?null:g.createElement(Yn.Provider,{value:u},g.createElement(Ol.Provider,{children:t,value:b}))}var Fo="get",Mo="application/x-www-form-urlencoded";function Fl(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function VN(e){return Fl(e)&&e.tagName.toLowerCase()==="button"}function qN(e){return Fl(e)&&e.tagName.toLowerCase()==="form"}function YN(e){return Fl(e)&&e.tagName.toLowerCase()==="input"}function ZN(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function KN(e,t){return e.button===0&&(!t||t==="_self")&&!ZN(e)}function Bc(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(a=>[n,a]):[[n,r]])},[]))}function XN(e,t){let n=Bc(e);return t&&t.forEach((r,a)=>{n.has(a)||t.getAll(a).forEach(s=>{n.append(a,s)})}),n}var oo=null;function QN(){if(oo===null)try{new FormData(document.createElement("form"),0),oo=!1}catch{oo=!0}return oo}var JN=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Mu(e){return e!=null&&!JN.has(e)?(Wt(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Mo}"`),null):e}function e_(e,t){let n,r,a,s,i;if(qN(e)){let o=e.getAttribute("action");r=o?ar(o,t):null,n=e.getAttribute("method")||Fo,a=Mu(e.getAttribute("enctype"))||Mo,s=new FormData(e)}else if(VN(e)||YN(e)&&(e.type==="submit"||e.type==="image")){let o=e.form;if(o==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=e.getAttribute("formaction")||o.getAttribute("action");if(r=u?ar(u,t):null,n=e.getAttribute("formmethod")||o.getAttribute("method")||Fo,a=Mu(e.getAttribute("formenctype"))||Mu(o.getAttribute("enctype"))||Mo,s=new FormData(o,e),!QN()){let{name:c,type:p,value:d}=e;if(p==="image"){let f=c?`${c}.`:"";s.append(`${f}x`,"0"),s.append(`${f}y`,"0")}else c&&s.append(c,d)}}else{if(Fl(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Fo,r=null,a=Mo,i=e}return s&&a==="text/plain"&&(i=s,s=void 0),{action:r,method:n.toLowerCase(),encType:a,formData:s,body:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Bd(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function t_(e,t,n){let r=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r.pathname==="/"?r.pathname=`_root.${n}`:t&&ar(r.pathname,t)==="/"?r.pathname=`${t.replace(/\/$/,"")}/_root.${n}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${n}`,r}async function n_(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(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function r_(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 a_(e,t,n){let r=await Promise.all(e.map(async a=>{let s=t.routes[a.route.id];if(s){let i=await n_(s,n);return i.links?i.links():[]}return[]}));return l_(r.flat(1).filter(r_).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function c0(e,t,n,r,a,s){let i=(u,c)=>n[c]?u.route.id!==n[c].route.id:!0,o=(u,c)=>n[c].pathname!==u.pathname||n[c].route.path?.endsWith("*")&&n[c].params["*"]!==u.params["*"];return s==="assets"?t.filter((u,c)=>i(u,c)||o(u,c)):s==="data"?t.filter((u,c)=>{let p=r.routes[u.route.id];if(!p||!p.hasLoader)return!1;if(i(u,c)||o(u,c))return!0;if(u.route.shouldRevalidate){let d=u.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof d=="boolean")return d}return!0}):[]}function s_(e,t,{includeHydrateFallback:n}={}){return i_(e.map(r=>{let a=t.routes[r.route.id];if(!a)return[];let s=[a.module];return a.clientActionModule&&(s=s.concat(a.clientActionModule)),a.clientLoaderModule&&(s=s.concat(a.clientLoaderModule)),n&&a.hydrateFallbackModule&&(s=s.concat(a.hydrateFallbackModule)),a.imports&&(s=s.concat(a.imports)),s}).flat(1))}function i_(e){return[...new Set(e)]}function o_(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function l_(e,t){let n=new Set;return new Set(t),e.reduce((r,a)=>{let s=JSON.stringify(o_(a));return n.has(s)||(n.add(s),r.push({key:s,link:a})),r},[])}function i1(){let e=g.useContext(Ta);return Bd(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function u_(){let e=g.useContext(Di);return Bd(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Ud=g.createContext(void 0);Ud.displayName="FrameworkContext";function o1(){let e=g.useContext(Ud);return Bd(e,"You must render this element inside a <HydratedRouter> element"),e}function c_(e,t){let n=g.useContext(Ud),[r,a]=g.useState(!1),[s,i]=g.useState(!1),{onFocus:o,onBlur:u,onMouseEnter:c,onMouseLeave:p,onTouchStart:d}=t,f=g.useRef(null);g.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let E=y=>{y.forEach(S=>{i(S.isIntersecting)})},x=new IntersectionObserver(E,{threshold:.5});return f.current&&x.observe(f.current),()=>{x.disconnect()}}},[e]),g.useEffect(()=>{if(r){let E=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(E)}}},[r]);let m=()=>{a(!0)},b=()=>{a(!1),i(!1)};return n?e!=="intent"?[s,f,{}]:[s,f,{onFocus:Ds(o,m),onBlur:Ds(u,b),onMouseEnter:Ds(c,m),onMouseLeave:Ds(p,b),onTouchStart:Ds(d,m)}]:[!1,f,{}]}function Ds(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function d_({page:e,...t}){let{router:n}=i1(),r=g.useMemo(()=>Gr(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?g.createElement(f_,{page:e,matches:r,...t}):null}function p_(e){let{manifest:t,routeModules:n}=o1(),[r,a]=g.useState([]);return g.useEffect(()=>{let s=!1;return a_(e,t,n).then(i=>{s||a(i)}),()=>{s=!0}},[e,t,n]),r}function f_({page:e,matches:t,...n}){let r=sr(),{manifest:a,routeModules:s}=o1(),{basename:i}=i1(),{loaderData:o,matches:u}=u_(),c=g.useMemo(()=>c0(e,t,u,a,r,"data"),[e,t,u,a,r]),p=g.useMemo(()=>c0(e,t,u,a,r,"assets"),[e,t,u,a,r]),d=g.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let b=new Set,E=!1;if(t.forEach(y=>{let S=a.routes[y.route.id];!S||!S.hasLoader||(!c.some(w=>w.route.id===y.route.id)&&y.route.id in o&&s[y.route.id]?.shouldRevalidate||S.hasClientLoader?E=!0:b.add(y.route.id))}),b.size===0)return[];let x=t_(e,i,"data");return E&&b.size>0&&x.searchParams.set("_routes",t.filter(y=>b.has(y.route.id)).map(y=>y.route.id).join(",")),[x.pathname+x.search]},[i,o,r,a,c,t,e,s]),f=g.useMemo(()=>s_(p,a),[p,a]),m=p_(p);return g.createElement(g.Fragment,null,d.map(b=>g.createElement("link",{key:b,rel:"prefetch",as:"fetch",href:b,...n})),f.map(b=>g.createElement("link",{key:b,rel:"modulepreload",href:b,...n})),m.map(({key:b,link:E})=>g.createElement("link",{key:b,nonce:n.nonce,...E})))}function m_(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var h_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{h_&&(window.__reactRouterVersion="7.11.0")}catch{}function g_(e,t){return zA({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:aA({window:t?.window}),hydrationData:b_(),routes:e,mapRouteProperties:jN,hydrationRouteProperties:BN,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,unstable_instrumentations:t?.unstable_instrumentations}).initialize()}function b_(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:E_(e.errors)}),e}function E_(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,a]of t)if(a&&a.__type==="RouteErrorResponse")n[r]=new Ii(a.status,a.statusText,a.data,a.internal===!0);else if(a&&a.__type==="Error"){if(a.__subType){let s=window[a.__subType];if(typeof s=="function")try{let i=new s(a.message);i.stack="",n[r]=i}catch{}}if(n[r]==null){let s=new Error(a.message);s.stack="",n[r]=s}}else n[r]=a;return n}var l1=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,u1=g.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:a,reloadDocument:s,replace:i,state:o,target:u,to:c,preventScrollReset:p,viewTransition:d,unstable_defaultShouldRevalidate:f,...m},b){let{basename:E,unstable_useTransitions:x}=g.useContext(Yn),y=typeof c=="string"&&l1.test(c),S=$y(c,E);c=S.to;let w=xN(c,{relative:a}),[A,D,N]=c_(r,m),T=T_(c,{replace:i,state:o,target:u,preventScrollReset:p,relative:a,viewTransition:d,unstable_defaultShouldRevalidate:f,unstable_useTransitions:x});function v(C){t&&t(C),C.defaultPrevented||T(C)}let R=g.createElement("a",{...m,...N,href:S.absoluteURL||w,onClick:S.isExternal||s?t:v,ref:m_(b,D),target:u,"data-discover":!y&&n==="render"?"true":void 0});return A&&!y?g.createElement(g.Fragment,null,R,g.createElement(d_,{page:w})):R});u1.displayName="Link";var c1=g.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:a=!1,style:s,to:i,viewTransition:o,children:u,...c},p){let d=Oi(i,{relative:c.relative}),f=sr(),m=g.useContext(Di),{navigator:b,basename:E}=g.useContext(Yn),x=m!=null&&__(d)&&o===!0,y=b.encodeLocation?b.encodeLocation(d).pathname:d.pathname,S=f.pathname,w=m&&m.navigation&&m.navigation.location?m.navigation.location.pathname:null;n||(S=S.toLowerCase(),w=w?w.toLowerCase():null,y=y.toLowerCase()),w&&E&&(w=ar(w,E)||w);const A=y!=="/"&&y.endsWith("/")?y.length-1:y.length;let D=S===y||!a&&S.startsWith(y)&&S.charAt(A)==="/",N=w!=null&&(w===y||!a&&w.startsWith(y)&&w.charAt(y.length)==="/"),T={isActive:D,isPending:N,isTransitioning:x},v=D?t:void 0,R;typeof r=="function"?R=r(T):R=[r,D?"active":null,N?"pending":null,x?"transitioning":null].filter(Boolean).join(" ");let C=typeof s=="function"?s(T):s;return g.createElement(u1,{...c,"aria-current":v,className:R,ref:p,style:C,to:i,viewTransition:o},typeof u=="function"?u(T):u)});c1.displayName="NavLink";var x_=g.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:a,state:s,method:i=Fo,action:o,onSubmit:u,relative:c,preventScrollReset:p,viewTransition:d,unstable_defaultShouldRevalidate:f,...m},b)=>{let{unstable_useTransitions:E}=g.useContext(Yn),x=A_(),y=N_(o,{relative:c}),S=i.toLowerCase()==="get"?"get":"post",w=typeof o=="string"&&l1.test(o),A=D=>{if(u&&u(D),D.defaultPrevented)return;D.preventDefault();let N=D.nativeEvent.submitter,T=N?.getAttribute("formmethod")||i,v=()=>x(N||D.currentTarget,{fetcherKey:t,method:T,navigate:n,replace:a,state:s,relative:c,preventScrollReset:p,viewTransition:d,unstable_defaultShouldRevalidate:f});E&&n!==!1?g.startTransition(()=>v()):v()};return g.createElement("form",{ref:b,method:S,action:y,onSubmit:r?u:A,...m,"data-discover":!w&&e==="render"?"true":void 0})});x_.displayName="Form";function y_(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function d1(e){let t=g.useContext(Ta);return it(t,y_(e)),t}function T_(e,{target:t,replace:n,state:r,preventScrollReset:a,relative:s,viewTransition:i,unstable_defaultShouldRevalidate:o,unstable_useTransitions:u}={}){let c=Ll(),p=sr(),d=Oi(e,{relative:s});return g.useCallback(f=>{if(KN(f,t)){f.preventDefault();let m=n!==void 0?n:vr(p)===vr(d),b=()=>c(e,{replace:m,state:r,preventScrollReset:a,relative:s,viewTransition:i,unstable_defaultShouldRevalidate:o});u?g.startTransition(()=>b()):b()}},[p,c,d,n,r,t,e,a,s,i,o,u])}function S_(e){Wt(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=g.useRef(Bc(e)),n=g.useRef(!1),r=sr(),a=g.useMemo(()=>XN(r.search,n.current?null:t.current),[r.search]),s=Ll(),i=g.useCallback((o,u)=>{const c=Bc(typeof o=="function"?o(new URLSearchParams(a)):o);n.current=!0,s("?"+c,u)},[s,a]);return[a,i]}var v_=0,w_=()=>`__${String(++v_)}__`;function A_(){let{router:e}=d1("useSubmit"),{basename:t}=g.useContext(Yn),n=DN(),r=e.fetch,a=e.navigate;return g.useCallback(async(s,i={})=>{let{action:o,method:u,encType:c,formData:p,body:d}=e_(s,t);if(i.navigate===!1){let f=i.fetcherKey||w_();await r(f,n,i.action||o,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:p,body:d,formMethod:i.method||u,formEncType:i.encType||c,flushSync:i.flushSync})}else await a(i.action||o,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:p,body:d,formMethod:i.method||u,formEncType:i.encType||c,replace:i.replace,state:i.state,fromRouteId:n,flushSync:i.flushSync,viewTransition:i.viewTransition})},[r,a,t,n])}function N_(e,{relative:t}={}){let{basename:n}=g.useContext(Yn),r=g.useContext(dr);it(r,"useFormAction must be used inside a RouteContext");let[a]=r.matches.slice(-1),s={...Oi(e||".",{relative:t})},i=sr();if(e==null){s.search=i.search;let o=new URLSearchParams(s.search),u=o.getAll("index");if(u.some(p=>p==="")){o.delete("index"),u.filter(d=>d).forEach(d=>o.append("index",d));let p=o.toString();s.search=p?`?${p}`:""}}return(!e||e===".")&&a.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:Sr([n,s.pathname])),vr(s)}function __(e,{relative:t}={}){let n=g.useContext(Fd);it(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=d1("useViewTransitionState"),a=Oi(e,{relative:t});if(!n.isTransitioning)return!1;let s=ar(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=ar(n.nextLocation.pathname,r)||n.nextLocation.pathname;return qo(a.pathname,i)!=null||qo(a.pathname,s)!=null}function ct(){return ct=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ct.apply(null,arguments)}const Li=(function(e){if(e==null)return R_;if(typeof e=="function")return Ml(e);if(typeof e=="object")return Array.isArray(e)?C_(e):k_(e);if(typeof e=="string")return I_(e);throw new Error("Expected function, string, or object as test")});function C_(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Li(e[n]);return Ml(r);function r(...a){let s=-1;for(;++s<t.length;)if(t[s].apply(this,a))return!0;return!1}}function k_(e){const t=e;return Ml(n);function n(r){const a=r;let s;for(s in e)if(a[s]!==t[s])return!1;return!0}}function I_(e){return Ml(t);function t(n){return n&&n.type===e}}function Ml(e){return t;function t(n,r,a){return!!(D_(n)&&e.call(this,n,typeof r=="number"?r:void 0,a||void 0))}}function R_(){return!0}function D_(e){return e!==null&&typeof e=="object"&&"type"in e}const p1=[],O_=!0,Yo=!1,Xs="skip";function $d(e,t,n,r){let a;typeof t=="function"&&typeof n!="function"?(r=n,n=t):a=t;const s=Li(a),i=r?-1:1;o(e,void 0,[])();function o(u,c,p){const d=u&&typeof u=="object"?u:{};if(typeof d.type=="string"){const m=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(u.type+(m?"<"+m+">":""))+")"})}return f;function f(){let m=p1,b,E,x;if((!t||s(u,c,p[p.length-1]||void 0))&&(m=L_(n(u,p)),m[0]===Yo))return m;if("children"in u&&u.children){const y=u;if(y.children&&m[0]!==Xs)for(E=(r?y.children.length:-1)+i,x=p.concat(y);E>-1&&E<y.children.length;){const S=y.children[E];if(b=o(S,E,x)(),b[0]===Yo)return b;E=typeof b[1]=="number"?b[1]:E+i}}return m}}}function L_(e){return Array.isArray(e)?e:typeof e=="number"?[O_,e]:e==null?p1:[e]}function $n(e,t,n,r){let a,s,i;typeof t=="function"&&typeof n!="function"?(s=void 0,i=t,a=n):(s=t,i=n,a=r),$d(e,s,o,a);function o(u,c){const p=c[c.length-1],d=p?p.children.indexOf(u):void 0;return i(u,d,p)}}function Ga(e){return"children"in e?f1(e):"value"in e?e.value:""}function F_(e){return e.type==="text"?e.value:"children"in e?f1(e):""}function f1(e){let t=-1;const n=[];for(;++t<e.children.length;)n[t]=F_(e.children[t]);return n.join("")}const M_={}.hasOwnProperty;function P_(e,t,n){const r=Li(t),a=t&&typeof t=="object"&&"cascade"in t?t.cascade:void 0,s=a??!0;return i(e);function i(o,u,c){const p=[];if(!r(o,u,c))return;if(j_(o)){let m=-1;for(;++m<o.children.length;){const b=i(o.children[m],m,o);b&&p.push(b)}if(s&&o.children.length>0&&p.length===0)return}const d={};let f;for(f in o)M_.call(o,f)&&(d[f]=f==="children"?p:o[f]);return d}}function j_(e){return"children"in e&&e.children!==void 0}var lo={exports:{}},d0;function B_(){return d0||(d0=1,(function(e,t){function n(r){let a=[],s;for(let i of r.split(",").map(o=>o.trim()))if(/^-?\d+$/.test(i))a.push(parseInt(i,10));else if(s=i.match(/^(-?\d+)(-|\.\.\.?|\u2025|\u2026|\u22EF)(-?\d+)$/)){let[o,u,c,p]=s;if(u&&p){u=parseInt(u),p=parseInt(p);const d=u<p?1:-1;(c==="-"||c===".."||c==="‥")&&(p+=d);for(let f=u;f!==p;f+=d)a.push(f)}}return a}t.default=n,e.exports=n})(lo,lo.exports)),lo.exports}var U_=B_();const $_=kl(U_);pt.displayName="clike";pt.aliases=[];function pt(e){e.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}}pr.displayName="c";pr.aliases=[];function pr(e){e.register(pt),e.languages.c=e.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),e.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),e.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},e.languages.c.string],char:e.languages.c.char,comment:e.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:e.languages.c}}}}),e.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete e.languages.c.boolean}Sa.displayName="cpp";Sa.aliases=[];function Sa(e){e.register(pr),(function(t){var n=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,r=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,function(){return n.source});t.languages.cpp=t.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,function(){return n.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:n,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),t.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,function(){return r})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),t.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t.languages.cpp}}}}),t.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),t.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:t.languages.extend("cpp",{})}}),t.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},t.languages.cpp["base-clause"])})(e)}Pl.displayName="arduino";Pl.aliases=["ino"];function Pl(e){e.register(Sa),e.languages.arduino=e.languages.extend("cpp",{keyword:/\b(?:String|array|bool|boolean|break|byte|case|catch|continue|default|do|double|else|finally|for|function|goto|if|in|instanceof|int|integer|long|loop|new|null|return|setup|string|switch|throw|try|void|while|word)\b/,constant:/\b(?:ANALOG_MESSAGE|DEFAULT|DIGITAL_MESSAGE|EXTERNAL|FIRMATA_STRING|HIGH|INPUT|INPUT_PULLUP|INTERNAL|INTERNAL1V1|INTERNAL2V56|LED_BUILTIN|LOW|OUTPUT|REPORT_ANALOG|REPORT_DIGITAL|SET_PIN_MODE|SYSEX_START|SYSTEM_RESET)\b/,builtin:/\b(?:Audio|BSSID|Bridge|Client|Console|EEPROM|Esplora|EsploraTFT|Ethernet|EthernetClient|EthernetServer|EthernetUDP|File|FileIO|FileSystem|Firmata|GPRS|GSM|GSMBand|GSMClient|GSMModem|GSMPIN|GSMScanner|GSMServer|GSMVoiceCall|GSM_SMS|HttpClient|IPAddress|IRread|Keyboard|KeyboardController|LiquidCrystal|LiquidCrystal_I2C|Mailbox|Mouse|MouseController|PImage|Process|RSSI|RobotControl|RobotMotor|SD|SPI|SSID|Scheduler|Serial|Server|Servo|SoftwareSerial|Stepper|Stream|TFT|Task|USBHost|WiFi|WiFiClient|WiFiServer|WiFiUDP|Wire|YunClient|YunServer|abs|addParameter|analogRead|analogReadResolution|analogReference|analogWrite|analogWriteResolution|answerCall|attach|attachGPRS|attachInterrupt|attached|autoscroll|available|background|beep|begin|beginPacket|beginSD|beginSMS|beginSpeaker|beginTFT|beginTransmission|beginWrite|bit|bitClear|bitRead|bitSet|bitWrite|blink|blinkVersion|buffer|changePIN|checkPIN|checkPUK|checkReg|circle|cityNameRead|cityNameWrite|clear|clearScreen|click|close|compassRead|config|connect|connected|constrain|cos|countryNameRead|countryNameWrite|createChar|cursor|debugPrint|delay|delayMicroseconds|detach|detachInterrupt|digitalRead|digitalWrite|disconnect|display|displayLogos|drawBMP|drawCompass|encryptionType|end|endPacket|endSMS|endTransmission|endWrite|exists|exitValue|fill|find|findUntil|flush|gatewayIP|get|getAsynchronously|getBand|getButton|getCurrentCarrier|getIMEI|getKey|getModifiers|getOemKey|getPINUsed|getResult|getSignalStrength|getSocket|getVoiceCallStatus|getXChange|getYChange|hangCall|height|highByte|home|image|interrupts|isActionDone|isDirectory|isListening|isPIN|isPressed|isValid|keyPressed|keyReleased|keyboardRead|knobRead|leftToRight|line|lineFollowConfig|listen|listenOnLocalhost|loadImage|localIP|lowByte|macAddress|maintain|map|max|messageAvailable|micros|millis|min|mkdir|motorsStop|motorsWrite|mouseDragged|mouseMoved|mousePressed|mouseReleased|move|noAutoscroll|noBlink|noBuffer|noCursor|noDisplay|noFill|noInterrupts|noListenOnLocalhost|noStroke|noTone|onReceive|onRequest|open|openNextFile|overflow|parseCommand|parseFloat|parseInt|parsePacket|pauseMode|peek|pinMode|playFile|playMelody|point|pointTo|position|pow|prepare|press|print|printFirmwareVersion|printVersion|println|process|processInput|pulseIn|put|random|randomSeed|read|readAccelerometer|readBlue|readButton|readBytes|readBytesUntil|readGreen|readJoystickButton|readJoystickSwitch|readJoystickX|readJoystickY|readLightSensor|readMessage|readMicrophone|readNetworks|readRed|readSlider|readString|readStringUntil|readTemperature|ready|rect|release|releaseAll|remoteIP|remoteNumber|remotePort|remove|requestFrom|retrieveCallingNumber|rewindDirectory|rightToLeft|rmdir|robotNameRead|robotNameWrite|run|runAsynchronously|runShellCommand|runShellCommandAsynchronously|running|scanNetworks|scrollDisplayLeft|scrollDisplayRight|seek|sendAnalog|sendDigitalPortPair|sendDigitalPorts|sendString|sendSysex|serialEvent|setBand|setBitOrder|setClockDivider|setCursor|setDNS|setDataMode|setFirmwareVersion|setMode|setPINUsed|setSpeed|setTextSize|setTimeout|shiftIn|shiftOut|shutdown|sin|size|sqrt|startLoop|step|stop|stroke|subnetMask|switchPIN|tan|tempoWrite|text|tone|transfer|tuneWrite|turn|updateIR|userNameRead|userNameWrite|voiceCall|waitContinue|width|write|writeBlue|writeGreen|writeJSON|writeMessage|writeMicroseconds|writeRGB|writeRed|yield)\b/}),e.languages.ino=e.languages.arduino}Fi.displayName="bash";Fi.aliases=["sh","shell"];function Fi(e){(function(t){var n="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",r={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},a={bash:r,environment:{pattern:RegExp("\\$"+n),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+n),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};t.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+n),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:a},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:r}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:a},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:a.entity}}],environment:{pattern:RegExp("\\$?"+n),alias:"constant"},variable:a.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},r.inside=t.languages.bash;for(var s=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],i=a.variable[1].inside,o=0;o<s.length;o++)i[s[o]]=t.languages.bash[s[o]];t.languages.sh=t.languages.bash,t.languages.shell=t.languages.bash})(e)}va.displayName="csharp";va.aliases=["cs","dotnet"];function va(e){e.register(pt),(function(t){function n(O,ne){return O.replace(/<<(\d+)>>/g,function(pe,L){return"(?:"+ne[+L]+")"})}function r(O,ne,pe){return RegExp(n(O,ne),"")}function a(O,ne){for(var pe=0;pe<ne;pe++)O=O.replace(/<<self>>/g,function(){return"(?:"+O+")"});return O.replace(/<<self>>/g,"[^\\s\\S]")}var s={type:"bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void",typeDeclaration:"class enum interface record struct",contextual:"add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)",other:"abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield"};function i(O){return"\\b(?:"+O.trim().replace(/ /g,"|")+")\\b"}var o=i(s.typeDeclaration),u=RegExp(i(s.type+" "+s.typeDeclaration+" "+s.contextual+" "+s.other)),c=i(s.typeDeclaration+" "+s.contextual+" "+s.other),p=i(s.type+" "+s.typeDeclaration+" "+s.other),d=a(/<(?:[^<>;=+\-*/%&|^]|<<self>>)*>/.source,2),f=a(/\((?:[^()]|<<self>>)*\)/.source,2),m=/@?\b[A-Za-z_]\w*\b/.source,b=n(/<<0>>(?:\s*<<1>>)?/.source,[m,d]),E=n(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source,[c,b]),x=/\[\s*(?:,\s*)*\]/.source,y=n(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source,[E,x]),S=n(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source,[d,f,x]),w=n(/\(<<0>>+(?:,<<0>>+)+\)/.source,[S]),A=n(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source,[w,E,x]),D={keyword:u,punctuation:/[<>()?,.:[\]]/},N=/'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source,T=/"(?:\\.|[^\\"\r\n])*"/.source,v=/@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;t.languages.csharp=t.languages.extend("clike",{string:[{pattern:r(/(^|[^$\\])<<0>>/.source,[v]),lookbehind:!0,greedy:!0},{pattern:r(/(^|[^@$\\])<<0>>/.source,[T]),lookbehind:!0,greedy:!0}],"class-name":[{pattern:r(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source,[E]),lookbehind:!0,inside:D},{pattern:r(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source,[m,A]),lookbehind:!0,inside:D},{pattern:r(/(\busing\s+)<<0>>(?=\s*=)/.source,[m]),lookbehind:!0},{pattern:r(/(\b<<0>>\s+)<<1>>/.source,[o,b]),lookbehind:!0,inside:D},{pattern:r(/(\bcatch\s*\(\s*)<<0>>/.source,[E]),lookbehind:!0,inside:D},{pattern:r(/(\bwhere\s+)<<0>>/.source,[m]),lookbehind:!0},{pattern:r(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source,[y]),lookbehind:!0,inside:D},{pattern:r(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source,[A,p,m]),inside:D}],keyword:u,number:/(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:[dflmu]|lu|ul)?\b/i,operator:/>>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,punctuation:/\?\.?|::|[{}[\];(),.:]/}),t.languages.insertBefore("csharp","number",{range:{pattern:/\.\./,alias:"operator"}}),t.languages.insertBefore("csharp","punctuation",{"named-parameter":{pattern:r(/([(,]\s*)<<0>>(?=\s*:)/.source,[m]),lookbehind:!0,alias:"punctuation"}}),t.languages.insertBefore("csharp","class-name",{namespace:{pattern:r(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source,[m]),lookbehind:!0,inside:{punctuation:/\./}},"type-expression":{pattern:r(/(\b(?:default|sizeof|typeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source,[f]),lookbehind:!0,alias:"class-name",inside:D},"return-type":{pattern:r(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source,[A,E]),inside:D,alias:"class-name"},"constructor-invocation":{pattern:r(/(\bnew\s+)<<0>>(?=\s*[[({])/.source,[A]),lookbehind:!0,inside:D,alias:"class-name"},"generic-method":{pattern:r(/<<0>>\s*<<1>>(?=\s*\()/.source,[m,d]),inside:{function:r(/^<<0>>/.source,[m]),generic:{pattern:RegExp(d),alias:"class-name",inside:D}}},"type-list":{pattern:r(/\b((?:<<0>>\s+<<1>>|record\s+<<1>>\s*<<5>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>|<<1>>\s*<<5>>|<<6>>)(?:\s*,\s*(?:<<3>>|<<4>>|<<6>>))*(?=\s*(?:where|[{;]|=>|$))/.source,[o,b,m,A,u.source,f,/\bnew\s*\(\s*\)/.source]),lookbehind:!0,inside:{"record-arguments":{pattern:r(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source,[b,f]),lookbehind:!0,greedy:!0,inside:t.languages.csharp},keyword:u,"class-name":{pattern:RegExp(A),greedy:!0,inside:D},punctuation:/[,()]/}},preprocessor:{pattern:/(^[\t ]*)#.*/m,lookbehind:!0,alias:"property",inside:{directive:{pattern:/(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,lookbehind:!0,alias:"keyword"}}}});var R=T+"|"+N,C=n(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source,[R]),U=a(n(/[^"'/()]|<<0>>|\(<<self>>*\)/.source,[C]),2),k=/\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source,j=n(/<<0>>(?:\s*\(<<1>>*\))?/.source,[E,U]);t.languages.insertBefore("csharp","class-name",{attribute:{pattern:r(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source,[k,j]),lookbehind:!0,greedy:!0,inside:{target:{pattern:r(/^<<0>>(?=\s*:)/.source,[k]),alias:"keyword"},"attribute-arguments":{pattern:r(/\(<<0>>*\)/.source,[U]),inside:t.languages.csharp},"class-name":{pattern:RegExp(E),inside:{punctuation:/\./}},punctuation:/[:,]/}}});var G=/:[^}\r\n]+/.source,$=a(n(/[^"'/()]|<<0>>|\(<<self>>*\)/.source,[C]),2),te=n(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[$,G]),H=a(n(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<<self>>*\)/.source,[R]),2),se=n(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[H,G]);function de(O,ne){return{interpolation:{pattern:r(/((?:^|[^{])(?:\{\{)*)<<0>>/.source,[O]),lookbehind:!0,inside:{"format-string":{pattern:r(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source,[ne,G]),lookbehind:!0,inside:{punctuation:/^:/}},punctuation:/^\{|\}$/,expression:{pattern:/[\s\S]+/,alias:"language-csharp",inside:t.languages.csharp}}},string:/[\s\S]+/}}t.languages.insertBefore("csharp","string",{"interpolation-string":[{pattern:r(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source,[te]),lookbehind:!0,greedy:!0,inside:de(te,$)},{pattern:r(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source,[se]),lookbehind:!0,greedy:!0,inside:de(se,H)}],char:{pattern:RegExp(N),greedy:!0}}),t.languages.dotnet=t.languages.cs=t.languages.csharp})(e)}bn.displayName="markup";bn.aliases=["atom","html","mathml","rss","ssml","svg","xml"];function bn(e){e.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},e.languages.markup.tag.inside["attr-value"].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside["internal-subset"].inside=e.languages.markup,e.hooks.add("wrap",function(t){t.type==="entity"&&(t.attributes.title=t.content.value.replace(/&/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(n,r){var a={};a["language-"+r]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:e.languages[r]},a.cdata=/^<!\[CDATA\[|\]\]>$/i;var s={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:a}};s["language-"+r]={pattern:/[\s\S]+/,inside:e.languages[r]};var i={};i[n]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return n}),"i"),lookbehind:!0,greedy:!0,inside:s},e.languages.insertBefore("markup","cdata",i)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(t,n){e.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[n,"language-"+n],inside:e.languages[n]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup,e.languages.xml=e.languages.extend("markup",{}),e.languages.ssml=e.languages.xml,e.languages.atom=e.languages.xml,e.languages.rss=e.languages.xml}ta.displayName="css";ta.aliases=[];function ta(e){(function(t){var n=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+n.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+n.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+n.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+n.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:n,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var r=t.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))})(e)}jl.displayName="diff";jl.aliases=[];function jl(e){(function(t){t.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var n={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(n).forEach(function(r){var a=n[r],s=[];/^\w+$/.test(r)||s.push(/\w+/.exec(r)[0]),r==="diff"&&s.push("bold"),t.languages.diff[r]={pattern:RegExp("^(?:["+a+`].*(?:\r
|
|
@@ -8,15 +8,15 @@ Please change the parent <Route path="${S}"> to <Route path="${S==="/"?"*":`${S}
|
|
|
8
8
|
]))(?:`+(/[^\s\\]/.source+'|[ ]+(?:(?![ "])|'+r+")|"+/\\[\r\n]+(?:[#;].*[\r\n]+)*(?![#;])/.source)+")*"),lookbehind:!0,greedy:!0,alias:"attr-value",inside:{comment:n,quoted:{pattern:RegExp(/(^|\s)/.source+r),lookbehind:!0,greedy:!0},punctuation:/\\$/m,boolean:{pattern:/^(?:false|no|off|on|true|yes)$/,greedy:!0}}},punctuation:/=/}})(e)}Gi.displayName="t4-templating";Gi.aliases=[];function Gi(e){(function(t){function n(a,s,i){return{pattern:RegExp("<#"+a+"[\\s\\S]*?#>"),alias:"block",inside:{delimiter:{pattern:RegExp("^<#"+a+"|#>$"),alias:"important"},content:{pattern:/[\s\S]+/,inside:s,alias:i}}}}function r(a){var s=t.languages[a],i="language-"+a;return{block:{pattern:/<#[\s\S]+?#>/,inside:{directive:n("@",{"attr-value":{pattern:/=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/,inside:{punctuation:/^=|^["']|["']$/}},keyword:/\b\w+(?=\s)/,"attr-name":/\b\w+/}),expression:n("=",s,i),"class-feature":n("\\+",s,i),standard:n("",s,i)}}}}t.languages["t4-templating"]=Object.defineProperty({},"createT4",{value:r})})(e)}Qh.displayName="t4-cs";Qh.aliases=["t4"];function Qh(e){e.register(va),e.register(Gi),e.languages.t4=e.languages["t4-cs"]=e.languages["t4-templating"].createT4("csharp")}Jh.displayName="t4-vb";Jh.aliases=[];function Jh(e){e.register(Gi),e.register(Ui),e.languages["t4-vb"]=e.languages["t4-templating"].createT4("vbnet")}eg.displayName="tap";eg.aliases=[];function eg(e){e.register(Pi),e.languages.tap={fail:/not ok[^#{\n\r]*/,pass:/ok[^#{\n\r]*/,pragma:/pragma [+-][a-z]+/,bailout:/bail out!.*/i,version:/TAP version \d+/i,plan:/\b\d+\.\.\d+(?: +#.*)?/,subtest:{pattern:/# Subtest(?:: .*)?/,greedy:!0},punctuation:/[{}]/,directive:/#.*/,yamlish:{pattern:/(^[ \t]*)---[\s\S]*?[\r\n][ \t]*\.\.\.$/m,lookbehind:!0,inside:e.languages.yaml,alias:"language-yaml"}}}tg.displayName="tcl";tg.aliases=[];function tg(e){e.languages.tcl={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0},string:{pattern:/"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*"/,greedy:!0},variable:[{pattern:/(\$)(?:::)?(?:[a-zA-Z0-9]+::)*\w+/,lookbehind:!0},{pattern:/(\$)\{[^}]+\}/,lookbehind:!0},{pattern:/(^[\t ]*set[ \t]+)(?:::)?(?:[a-zA-Z0-9]+::)*\w+/m,lookbehind:!0}],function:{pattern:/(^[\t ]*proc[ \t]+)\S+/m,lookbehind:!0},builtin:[{pattern:/(^[\t ]*)(?:break|class|continue|error|eval|exit|for|foreach|if|proc|return|switch|while)\b/m,lookbehind:!0},/\b(?:else|elseif)\b/],scope:{pattern:/(^[\t ]*)(?:global|upvar|variable)\b/m,lookbehind:!0,alias:"constant"},keyword:{pattern:/(^[\t ]*|\[)(?:Safe_Base|Tcl|after|append|apply|array|auto_(?:execok|import|load|mkindex|qualify|reset)|automkindex_old|bgerror|binary|catch|cd|chan|clock|close|concat|dde|dict|encoding|eof|exec|expr|fblocked|fconfigure|fcopy|file(?:event|name)?|flush|gets|glob|history|http|incr|info|interp|join|lappend|lassign|lindex|linsert|list|llength|load|lrange|lrepeat|lreplace|lreverse|lsearch|lset|lsort|math(?:func|op)|memory|msgcat|namespace|open|package|parray|pid|pkg_mkIndex|platform|puts|pwd|re_syntax|read|refchan|regexp|registry|regsub|rename|scan|seek|set|socket|source|split|string|subst|tcl(?:_endOfWord|_findLibrary|startOf(?:Next|Previous)Word|test|vars|wordBreak(?:After|Before))|tell|time|tm|trace|unknown|unload|unset|update|uplevel|vwait)\b/m,lookbehind:!0},operator:/!=?|\*\*?|==|&&?|\|\|?|<[=<]?|>[=>]?|[-+~\/%?^]|\b(?:eq|in|ne|ni)\b/,punctuation:/[{}()\[\]]/}}ng.displayName="tt2";ng.aliases=[];function ng(e){e.register(pt),e.register(An),(function(t){t.languages.tt2=t.languages.extend("clike",{comment:/#.*|\[%#[\s\S]*?%\]/,keyword:/\b(?:BLOCK|CALL|CASE|CATCH|CLEAR|DEBUG|DEFAULT|ELSE|ELSIF|END|FILTER|FINAL|FOREACH|GET|IF|IN|INCLUDE|INSERT|LAST|MACRO|META|NEXT|PERL|PROCESS|RAWPERL|RETURN|SET|STOP|SWITCH|TAGS|THROW|TRY|UNLESS|USE|WHILE|WRAPPER)\b/,punctuation:/[[\]{},()]/}),t.languages.insertBefore("tt2","number",{operator:/=[>=]?|!=?|<=?|>=?|&&|\|\|?|\b(?:and|not|or)\b/,variable:{pattern:/\b[a-z]\w*(?:\s*\.\s*(?:\d+|\$?[a-z]\w*))*\b/i}}),t.languages.insertBefore("tt2","keyword",{delimiter:{pattern:/^(?:\[%|%%)-?|-?%\]$/,alias:"punctuation"}}),t.languages.insertBefore("tt2","string",{"single-quoted-string":{pattern:/'[^\\']*(?:\\[\s\S][^\\']*)*'/,greedy:!0,alias:"string"},"double-quoted-string":{pattern:/"[^\\"]*(?:\\[\s\S][^\\"]*)*"/,greedy:!0,alias:"string",inside:{variable:{pattern:/\$(?:[a-z]\w*(?:\.(?:\d+|\$?[a-z]\w*))*)/i}}}}),delete t.languages.tt2.string,t.hooks.add("before-tokenize",function(n){var r=/\[%[\s\S]+?%\]/g;t.languages["markup-templating"].buildPlaceholders(n,"tt2",r)}),t.hooks.add("after-tokenize",function(n){t.languages["markup-templating"].tokenizePlaceholders(n,"tt2")})})(e)}rg.displayName="toml";rg.aliases=[];function rg(e){(function(t){var n=/(?:[\w-]+|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*")/.source;function r(a){return a.replace(/__/g,function(){return n})}t.languages.toml={comment:{pattern:/#.*/,greedy:!0},table:{pattern:RegExp(r(/(^[\t ]*\[\s*(?:\[\s*)?)__(?:\s*\.\s*__)*(?=\s*\])/.source),"m"),lookbehind:!0,greedy:!0,alias:"class-name"},key:{pattern:RegExp(r(/(^[\t ]*|[{,]\s*)__(?:\s*\.\s*__)*(?=\s*=)/.source),"m"),lookbehind:!0,greedy:!0,alias:"property"},string:{pattern:/"""(?:\\[\s\S]|[^\\])*?"""|'''[\s\S]*?'''|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},date:[{pattern:/\b\d{4}-\d{2}-\d{2}(?:[T\s]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?\b/i,alias:"number"},{pattern:/\b\d{2}:\d{2}:\d{2}(?:\.\d+)?\b/,alias:"number"}],number:/(?:\b0(?:x[\da-zA-Z]+(?:_[\da-zA-Z]+)*|o[0-7]+(?:_[0-7]+)*|b[10]+(?:_[10]+)*))\b|[-+]?\b\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?\b|[-+]?\b(?:inf|nan)\b/,boolean:/\b(?:false|true)\b/,punctuation:/[.,=[\]{}]/}})(e)}ag.displayName="tremor";ag.aliases=["trickle","troy"];function ag(e){(function(t){t.languages.tremor={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},"interpolated-string":null,extractor:{pattern:/\b[a-z_]\w*\|(?:[^\r\n\\|]|\\(?:\r\n|[\s\S]))*\|/i,greedy:!0,inside:{regex:{pattern:/(^re)\|[\s\S]+/,lookbehind:!0},function:/^\w+/,value:/\|[\s\S]+/}},identifier:{pattern:/`[^`]*`/,greedy:!0},function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())\b/,keyword:/\b(?:args|as|by|case|config|connect|connector|const|copy|create|default|define|deploy|drop|each|emit|end|erase|event|flow|fn|for|from|group|having|insert|into|intrinsic|let|links|match|merge|mod|move|of|operator|patch|pipeline|recur|script|select|set|sliding|state|stream|to|tumbling|update|use|when|where|window|with)\b/,boolean:/\b(?:false|null|true)\b/i,number:/\b(?:0b[01_]*|0x[0-9a-fA-F_]*|\d[\d_]*(?:\.\d[\d_]*)?(?:[Ee][+-]?[\d_]+)?)\b/,"pattern-punctuation":{pattern:/%(?=[({[])/,alias:"punctuation"},operator:/[-+*\/%~!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?>?=?|(?:absent|and|not|or|present|xor)\b/,punctuation:/::|[;\[\]()\{\},.:]/};var n=/#\{(?:[^"{}]|\{[^{}]*\}|"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*")*\}/.source;t.languages.tremor["interpolated-string"]={pattern:RegExp(/(^|[^\\])/.source+'(?:"""(?:'+/[^"\\#]|\\[\s\S]|"(?!"")|#(?!\{)/.source+"|"+n+')*"""|"(?:'+/[^"\\\r\n#]|\\(?:\r\n|[\s\S])|#(?!\{)/.source+"|"+n+')*")'),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:RegExp(n),inside:{punctuation:/^#\{|\}$/,expression:{pattern:/[\s\S]+/,inside:t.languages.tremor}}},string:/[\s\S]+/}},t.languages.troy=t.languages.tremor,t.languages.trickle=t.languages.tremor})(e)}sg.displayName="typoscript";sg.aliases=["tsconfig"];function sg(e){(function(t){var n=/\b(?:ACT|ACTIFSUB|CARRAY|CASE|CLEARGIF|COA|COA_INT|CONSTANTS|CONTENT|CUR|EDITPANEL|EFFECT|EXT|FILE|FLUIDTEMPLATE|FORM|FRAME|FRAMESET|GIFBUILDER|GMENU|GMENU_FOLDOUT|GMENU_LAYERS|GP|HMENU|HRULER|HTML|IENV|IFSUB|IMAGE|IMGMENU|IMGMENUITEM|IMGTEXT|IMG_RESOURCE|INCLUDE_TYPOSCRIPT|JSMENU|JSMENUITEM|LLL|LOAD_REGISTER|NO|PAGE|RECORDS|RESTORE_REGISTER|TEMPLATE|TEXT|TMENU|TMENUITEM|TMENU_LAYERS|USER|USER_INT|_GIFBUILDER|global|globalString|globalVar)\b/;t.languages.typoscript={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0},{pattern:/(^|[^\\:= \t]|(?:^|[^= \t])[ \t]+)\/\/.*/,lookbehind:!0,greedy:!0},{pattern:/(^|[^"'])#.*/,lookbehind:!0,greedy:!0}],function:[{pattern:/<INCLUDE_TYPOSCRIPT:\s*source\s*=\s*(?:"[^"\r\n]*"|'[^'\r\n]*')\s*>/,inside:{string:{pattern:/"[^"\r\n]*"|'[^'\r\n]*'/,inside:{keyword:n}},keyword:{pattern:/INCLUDE_TYPOSCRIPT/}}},{pattern:/@import\s*(?:"[^"\r\n]*"|'[^'\r\n]*')/,inside:{string:/"[^"\r\n]*"|'[^'\r\n]*'/}}],string:{pattern:/^([^=]*=[< ]?)(?:(?!\]\n).)*/,lookbehind:!0,inside:{function:/\{\$.*\}/,keyword:n,number:/^\d+$/,punctuation:/[,|:]/}},keyword:n,number:{pattern:/\b\d+\s*[.{=]/,inside:{operator:/[.{=]/}},tag:{pattern:/\.?[-\w\\]+\.?/,inside:{punctuation:/\./}},punctuation:/[{}[\];(),.:|]/,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/},t.languages.tsconfig=t.languages.typoscript})(e)}ig.displayName="unrealscript";ig.aliases=["uc","uscript"];function ig(e){e.languages.unrealscript={comment:/\/\/.*|\/\*[\s\S]*?\*\//,string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},category:{pattern:/(\b(?:(?:autoexpand|hide|show)categories|var)\s*\()[^()]+(?=\))/,lookbehind:!0,greedy:!0,alias:"property"},metadata:{pattern:/(\w\s*)<\s*\w+\s*=[^<>|=\r\n]+(?:\|\s*\w+\s*=[^<>|=\r\n]+)*>/,lookbehind:!0,greedy:!0,inside:{property:/\b\w+(?=\s*=)/,operator:/=/,punctuation:/[<>|]/}},macro:{pattern:/`\w+/,alias:"property"},"class-name":{pattern:/(\b(?:class|enum|extends|interface|state(?:\(\))?|struct|within)\s+)\w+/,lookbehind:!0},keyword:/\b(?:abstract|actor|array|auto|autoexpandcategories|bool|break|byte|case|class|classgroup|client|coerce|collapsecategories|config|const|continue|default|defaultproperties|delegate|dependson|deprecated|do|dontcollapsecategories|editconst|editinlinenew|else|enum|event|exec|export|extends|final|float|for|forcescriptorder|foreach|function|goto|guid|hidecategories|hidedropdown|if|ignores|implements|inherits|input|int|interface|iterator|latent|local|material|name|native|nativereplication|noexport|nontransient|noteditinlinenew|notplaceable|operator|optional|out|pawn|perobjectconfig|perobjectlocalized|placeable|postoperator|preoperator|private|protected|reliable|replication|return|server|showcategories|simulated|singular|state|static|string|struct|structdefault|structdefaultproperties|switch|texture|transient|travel|unreliable|until|var|vector|while|within)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,boolean:/\b(?:false|true)\b/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/>>|<<|--|\+\+|\*\*|[-+*/~!=<>$@]=?|&&?|\|\|?|\^\^?|[?:%]|\b(?:ClockwiseFrom|Cross|Dot)\b/,punctuation:/[()[\]{};,.]/},e.languages.uc=e.languages.uscript=e.languages.unrealscript}og.displayName="uorazor";og.aliases=[];function og(e){e.languages.uorazor={"comment-hash":{pattern:/#.*/,alias:"comment",greedy:!0},"comment-slash":{pattern:/\/\/.*/,alias:"comment",greedy:!0},string:{pattern:/("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,inside:{punctuation:/^['"]|['"]$/},greedy:!0},"source-layers":{pattern:/\b(?:arms|backpack|blue|bracelet|cancel|clear|cloak|criminal|earrings|enemy|facialhair|friend|friendly|gloves|gray|grey|ground|hair|head|innerlegs|innertorso|innocent|lefthand|middletorso|murderer|neck|nonfriendly|onehandedsecondary|outerlegs|outertorso|pants|red|righthand|ring|self|shirt|shoes|talisman|waist)\b/i,alias:"function"},"source-commands":{pattern:/\b(?:alliance|attack|cast|clearall|clearignore|clearjournal|clearlist|clearsysmsg|createlist|createtimer|dclick|dclicktype|dclickvar|dress|dressconfig|drop|droprelloc|emote|getlabel|guild|gumpclose|gumpresponse|hotkey|ignore|lasttarget|lift|lifttype|menu|menuresponse|msg|org|organize|organizer|overhead|pause|poplist|potion|promptresponse|pushlist|removelist|removetimer|rename|restock|say|scav|scavenger|script|setability|setlasttarget|setskill|settimer|setvar|sysmsg|target|targetloc|targetrelloc|targettype|undress|unignore|unsetvar|useobject|useonce|useskill|usetype|virtue|wait|waitforgump|waitformenu|waitforprompt|waitforstat|waitforsysmsg|waitfortarget|walk|wfsysmsg|wft|whisper|yell)\b/,alias:"function"},"tag-name":{pattern:/(^\{%-?\s*)\w+/,lookbehind:!0,alias:"keyword"},delimiter:{pattern:/^\{[{%]-?|-?[%}]\}$/,alias:"punctuation"},function:/\b(?:atlist|close|closest|count|counter|counttype|dead|dex|diffhits|diffmana|diffstam|diffweight|find|findbuff|finddebuff|findlayer|findtype|findtypelist|followers|gumpexists|hidden|hits|hp|hue|human|humanoid|ingump|inlist|insysmessage|insysmsg|int|invul|lhandempty|list|listexists|mana|maxhits|maxhp|maxmana|maxstam|maxweight|monster|mounted|name|next|noto|paralyzed|poisoned|position|prev|previous|queued|rand|random|rhandempty|skill|stam|str|targetexists|timer|timerexists|varexist|warmode|weight)\b/,keyword:/\b(?:and|as|break|continue|else|elseif|endfor|endif|endwhile|for|if|loop|not|or|replay|stop|while)\b/,boolean:/\b(?:false|null|true)\b/,number:/\b0x[\dA-Fa-f]+|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee][-+]?\d+)?/,operator:[{pattern:/(\s)(?:and|b-and|b-or|b-xor|ends with|in|is|matches|not|or|same as|starts with)(?=\s)/,lookbehind:!0},/[=<>]=?|!=|\*\*?|\/\/?|\?:?|[-+~%|]/],punctuation:/[()\[\]{}:.,]/}}lg.displayName="v";lg.aliases=[];function lg(e){e.register(pt),(function(t){var n={pattern:/[\s\S]+/,inside:null};t.languages.v=t.languages.extend("clike",{string:{pattern:/r?(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,alias:"quoted-string",greedy:!0,inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:\{[^{}]*\}|\w+(?:\.\w+(?:\([^\(\)]*\))?|\[[^\[\]]+\])*)/,lookbehind:!0,inside:{"interpolation-variable":{pattern:/^\$\w[\s\S]*$/,alias:"variable"},"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},"interpolation-expression":n}}}},"class-name":{pattern:/(\b(?:enum|interface|struct|type)\s+)(?:C\.)?\w+/,lookbehind:!0},keyword:/(?:\b(?:__global|as|asm|assert|atomic|break|chan|const|continue|defer|else|embed|enum|fn|for|go(?:to)?|if|import|in|interface|is|lock|match|module|mut|none|or|pub|return|rlock|select|shared|sizeof|static|struct|type(?:of)?|union|unsafe)|\$(?:else|for|if)|#(?:flag|include))\b/,number:/\b(?:0x[a-f\d]+(?:_[a-f\d]+)*|0b[01]+(?:_[01]+)*|0o[0-7]+(?:_[0-7]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?)\b/i,operator:/~|\?|[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\.?/,builtin:/\b(?:any(?:_float|_int)?|bool|byte(?:ptr)?|charptr|f(?:32|64)|i(?:8|16|64|128|nt)|rune|size_t|string|u(?:16|32|64|128)|voidptr)\b/}),n.inside=t.languages.v,t.languages.insertBefore("v","string",{char:{pattern:/`(?:\\`|\\?[^`]{1,2})`/,alias:"rune"}}),t.languages.insertBefore("v","operator",{attribute:{pattern:/(^[\t ]*)\[(?:deprecated|direct_array_access|flag|inline|live|ref_only|typedef|unsafe_fn|windows_stdcall)\]/m,lookbehind:!0,alias:"annotation",inside:{punctuation:/[\[\]]/,keyword:/\w+/}},generic:{pattern:/<\w+>(?=\s*[\)\{])/,inside:{punctuation:/[<>]/,"class-name":/\w+/}}}),t.languages.insertBefore("v","function",{"generic-function":{pattern:/\b\w+\s*<\w+>(?=\()/,inside:{function:/^\w+/,generic:{pattern:/<\w+>/,inside:t.languages.v.generic.inside}}}})})(e)}ug.displayName="vala";ug.aliases=[];function ug(e){e.register(pt),e.languages.vala=e.languages.extend("clike",{"class-name":[{pattern:/\b[A-Z]\w*(?:\.\w+)*\b(?=(?:\?\s+|\*?\s+\*?)\w)/,inside:{punctuation:/\./}},{pattern:/(\[)[A-Z]\w*(?:\.\w+)*\b/,lookbehind:!0,inside:{punctuation:/\./}},{pattern:/(\b(?:class|interface)\s+[A-Z]\w*(?:\.\w+)*\s*:\s*)[A-Z]\w*(?:\.\w+)*\b/,lookbehind:!0,inside:{punctuation:/\./}},{pattern:/((?:\b(?:class|enum|interface|new|struct)\s+)|(?:catch\s+\())[A-Z]\w*(?:\.\w+)*\b/,lookbehind:!0,inside:{punctuation:/\./}}],keyword:/\b(?:abstract|as|assert|async|base|bool|break|case|catch|char|class|const|construct|continue|default|delegate|delete|do|double|dynamic|else|ensures|enum|errordomain|extern|finally|float|for|foreach|get|if|in|inline|int|int16|int32|int64|int8|interface|internal|is|lock|long|namespace|new|null|out|override|owned|params|private|protected|public|ref|requires|return|set|short|signal|sizeof|size_t|ssize_t|static|string|struct|switch|this|throw|throws|try|typeof|uchar|uint|uint16|uint32|uint64|uint8|ulong|unichar|unowned|ushort|using|value|var|virtual|void|volatile|weak|while|yield)\b/i,function:/\b\w+(?=\s*\()/,number:/(?:\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)(?:f|u?l?)?/i,operator:/\+\+|--|&&|\|\||<<=?|>>=?|=>|->|~|[+\-*\/%&^|=!<>]=?|\?\??|\.\.\./,punctuation:/[{}[\];(),.:]/,constant:/\b[A-Z0-9_]+\b/}),e.languages.insertBefore("vala","string",{"raw-string":{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:"string"},"template-string":{pattern:/@"[\s\S]*?"/,greedy:!0,inside:{interpolation:{pattern:/\$(?:\([^)]*\)|[a-zA-Z]\w*)/,inside:{delimiter:{pattern:/^\$\(?|\)$/,alias:"punctuation"},rest:e.languages.vala}},string:/[\s\S]+/}}}),e.languages.insertBefore("vala","keyword",{regex:{pattern:/\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[imsx]{0,4}(?=\s*(?:$|[\r\n,.;})\]]))/,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:e.languages.regex},"regex-delimiter":/^\//,"regex-flags":/^[a-z]+$/}}})}cg.displayName="velocity";cg.aliases=[];function cg(e){e.register(bn),(function(t){t.languages.velocity=t.languages.extend("markup",{});var n={variable:{pattern:/(^|[^\\](?:\\\\)*)\$!?(?:[a-z][\w-]*(?:\([^)]*\))?(?:\.[a-z][\w-]*(?:\([^)]*\))?|\[[^\]]+\])*|\{[^}]+\})/i,lookbehind:!0,inside:{}},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},number:/\b\d+\b/,boolean:/\b(?:false|true)\b/,operator:/[=!<>]=?|[+*/%-]|&&|\|\||\.\.|\b(?:eq|g[et]|l[et]|n(?:e|ot))\b/,punctuation:/[(){}[\]:,.]/};n.variable.inside={string:n.string,function:{pattern:/([^\w-])[a-z][\w-]*(?=\()/,lookbehind:!0},number:n.number,boolean:n.boolean,punctuation:n.punctuation},t.languages.insertBefore("velocity","comment",{unparsed:{pattern:/(^|[^\\])#\[\[[\s\S]*?\]\]#/,lookbehind:!0,greedy:!0,inside:{punctuation:/^#\[\[|\]\]#$/}},"velocity-comment":[{pattern:/(^|[^\\])#\*[\s\S]*?\*#/,lookbehind:!0,greedy:!0,alias:"comment"},{pattern:/(^|[^\\])##.*/,lookbehind:!0,greedy:!0,alias:"comment"}],directive:{pattern:/(^|[^\\](?:\\\\)*)#@?(?:[a-z][\w-]*|\{[a-z][\w-]*\})(?:\s*\((?:[^()]|\([^()]*\))*\))?/i,lookbehind:!0,inside:{keyword:{pattern:/^#@?(?:[a-z][\w-]*|\{[a-z][\w-]*\})|\bin\b/,inside:{punctuation:/[{}]/}},rest:n}},variable:n.variable}),t.languages.velocity.tag.inside["attr-value"].inside.rest=t.languages.velocity})(e)}dg.displayName="verilog";dg.aliases=[];function dg(e){e.languages.verilog={comment:{pattern:/\/\/.*|\/\*[\s\S]*?\*\//,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"kernel-function":{pattern:/\B\$\w+\b/,alias:"property"},constant:/\B`\w+\b/,function:/\b\w+(?=\()/,keyword:/\b(?:alias|and|assert|assign|assume|automatic|before|begin|bind|bins|binsof|bit|break|buf|bufif0|bufif1|byte|case|casex|casez|cell|chandle|class|clocking|cmos|config|const|constraint|context|continue|cover|covergroup|coverpoint|cross|deassign|default|defparam|design|disable|dist|do|edge|else|end|endcase|endclass|endclocking|endconfig|endfunction|endgenerate|endgroup|endinterface|endmodule|endpackage|endprimitive|endprogram|endproperty|endsequence|endspecify|endtable|endtask|enum|event|expect|export|extends|extern|final|first_match|for|force|foreach|forever|fork|forkjoin|function|generate|genvar|highz0|highz1|if|iff|ifnone|ignore_bins|illegal_bins|import|incdir|include|initial|inout|input|inside|instance|int|integer|interface|intersect|join|join_any|join_none|large|liblist|library|local|localparam|logic|longint|macromodule|matches|medium|modport|module|nand|negedge|new|nmos|nor|noshowcancelled|not|notif0|notif1|null|or|output|package|packed|parameter|pmos|posedge|primitive|priority|program|property|protected|pull0|pull1|pulldown|pullup|pulsestyle_ondetect|pulsestyle_onevent|pure|rand|randc|randcase|randsequence|rcmos|real|realtime|ref|reg|release|repeat|return|rnmos|rpmos|rtran|rtranif0|rtranif1|scalared|sequence|shortint|shortreal|showcancelled|signed|small|solve|specify|specparam|static|string|strong0|strong1|struct|super|supply0|supply1|table|tagged|task|this|throughout|time|timeprecision|timeunit|tran|tranif0|tranif1|tri|tri0|tri1|triand|trior|trireg|type|typedef|union|unique|unsigned|use|uwire|var|vectored|virtual|void|wait|wait_order|wand|weak0|weak1|while|wildcard|wire|with|within|wor|xnor|xor)\b/,important:/\b(?:always|always_comb|always_ff|always_latch)\b(?: *@)?/,number:/\B##?\d+|(?:\b\d+)?'[odbh] ?[\da-fzx_?]+|\b(?:\d*[._])?\d+(?:e[-+]?\d+)?/i,operator:/[-+{}^~%*\/?=!<>&|]+/,punctuation:/[[\];(),.:]/}}pg.displayName="vhdl";pg.aliases=[];function pg(e){e.languages.vhdl={comment:/--.+/,"vhdl-vectors":{pattern:/\b[oxb]"[\da-f_]+"|"[01uxzwlh-]+"/i,alias:"number"},"quoted-function":{pattern:/"\S+?"(?=\()/,alias:"function"},string:/"(?:[^\\"\r\n]|\\(?:\r\n|[\s\S]))*"/,attribute:{pattern:/\b'\w+/,alias:"attr-name"},keyword:/\b(?:access|after|alias|all|architecture|array|assert|attribute|begin|block|body|buffer|bus|case|component|configuration|constant|disconnect|downto|else|elsif|end|entity|exit|file|for|function|generate|generic|group|guarded|if|impure|in|inertial|inout|is|label|library|linkage|literal|loop|map|new|next|null|of|on|open|others|out|package|port|postponed|private|procedure|process|pure|range|record|register|reject|report|return|select|severity|shared|signal|subtype|then|to|transport|type|unaffected|units|until|use|variable|view|wait|when|while|with)\b/i,boolean:/\b(?:false|true)\b/i,function:/\w+(?=\()/,number:/'[01uxzwlh-]'|\b(?:\d+#[\da-f_.]+#|\d[\d_.]*)(?:e[-+]?\d+)?/i,operator:/[<>]=?|:=|[-+*/&=]|\b(?:abs|and|mod|nand|nor|not|or|rem|rol|ror|sla|sll|sra|srl|xnor|xor)\b/i,punctuation:/[{}[\];(),.:]/}}fg.displayName="vim";fg.aliases=[];function fg(e){e.languages.vim={string:/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\r\n]|'')*'/,comment:/".*/,function:/\b\w+(?=\()/,keyword:/\b(?:N|Next|P|Print|X|XMLent|XMLns|ab|abbreviate|abc|abclear|abo|aboveleft|al|all|ar|arga|argadd|argd|argdelete|argdo|arge|argedit|argg|argglobal|argl|arglocal|args|argu|argument|as|ascii|b|bN|bNext|ba|bad|badd|ball|bd|bdelete|be|bel|belowright|bf|bfirst|bl|blast|bm|bmodified|bn|bnext|bo|botright|bp|bprevious|br|brea|break|breaka|breakadd|breakd|breakdel|breakl|breaklist|brewind|bro|browse|bufdo|buffer|buffers|bun|bunload|bw|bwipeout|c|cN|cNext|cNfcNfile|ca|cabbrev|cabc|cabclear|cad|caddb|caddbuffer|caddexpr|caddf|caddfile|cal|call|cat|catch|cb|cbuffer|cc|ccl|cclose|cd|ce|center|cex|cexpr|cf|cfile|cfir|cfirst|cg|cgetb|cgetbuffer|cgete|cgetexpr|cgetfile|change|changes|chd|chdir|che|checkpath|checkt|checktime|cl|cla|clast|clist|clo|close|cmapc|cmapclear|cn|cnew|cnewer|cnext|cnf|cnfile|cnorea|cnoreabbrev|co|col|colder|colo|colorscheme|comc|comclear|comp|compiler|con|conf|confirm|continue|cope|copen|copy|cp|cpf|cpfile|cprevious|cq|cquit|cr|crewind|cu|cuna|cunabbrev|cunmap|cw|cwindow|d|debugg|debuggreedy|delc|delcommand|delete|delf|delfunction|delm|delmarks|di|diffg|diffget|diffoff|diffpatch|diffpu|diffput|diffsplit|diffthis|diffu|diffupdate|dig|digraphs|display|dj|djump|dl|dlist|dr|drop|ds|dsearch|dsp|dsplit|e|earlier|echoe|echoerr|echom|echomsg|echon|edit|el|else|elsei|elseif|em|emenu|en|endf|endfo|endfor|endfun|endfunction|endif|endt|endtry|endw|endwhile|ene|enew|ex|exi|exit|exu|exusage|f|file|files|filetype|fin|fina|finally|find|fini|finish|fir|first|fix|fixdel|fo|fold|foldc|foldclose|foldd|folddoc|folddoclosed|folddoopen|foldo|foldopen|for|fu|fun|function|go|goto|gr|grep|grepa|grepadd|h|ha|hardcopy|help|helpf|helpfind|helpg|helpgrep|helpt|helptags|hid|hide|his|history|ia|iabbrev|iabc|iabclear|if|ij|ijump|il|ilist|imapc|imapclear|in|inorea|inoreabbrev|isearch|isp|isplit|iu|iuna|iunabbrev|iunmap|j|join|ju|jumps|k|kee|keepalt|keepj|keepjumps|keepmarks|l|lN|lNext|lNf|lNfile|la|lad|laddb|laddbuffer|laddexpr|laddf|laddfile|lan|language|last|later|lb|lbuffer|lc|lcd|lch|lchdir|lcl|lclose|left|lefta|leftabove|let|lex|lexpr|lf|lfile|lfir|lfirst|lg|lgetb|lgetbuffer|lgete|lgetexpr|lgetfile|lgr|lgrep|lgrepa|lgrepadd|lh|lhelpgrep|list|ll|lla|llast|lli|llist|lm|lmak|lmake|lmap|lmapc|lmapclear|ln|lne|lnew|lnewer|lnext|lnf|lnfile|lnoremap|lo|loadview|loc|lockmarks|lockv|lockvar|lol|lolder|lop|lopen|lp|lpf|lpfile|lprevious|lr|lrewind|ls|lt|ltag|lu|lunmap|lv|lvimgrep|lvimgrepa|lvimgrepadd|lw|lwindow|m|ma|mak|make|mark|marks|mat|match|menut|menutranslate|mk|mkexrc|mks|mksession|mksp|mkspell|mkv|mkvie|mkview|mkvimrc|mod|mode|move|mz|mzf|mzfile|mzscheme|n|nbkey|new|next|nmapc|nmapclear|noh|nohlsearch|norea|noreabbrev|nu|number|nun|nunmap|o|omapc|omapclear|on|only|open|opt|options|ou|ounmap|p|pc|pclose|pe|ped|pedit|perl|perld|perldo|po|pop|popu|popup|pp|ppop|pre|preserve|prev|previous|print|prof|profd|profdel|profile|promptf|promptfind|promptr|promptrepl|ps|psearch|ptN|ptNext|pta|ptag|ptf|ptfirst|ptj|ptjump|ptl|ptlast|ptn|ptnext|ptp|ptprevious|ptr|ptrewind|pts|ptselect|pu|put|pw|pwd|py|pyf|pyfile|python|q|qa|qall|quit|quita|quitall|r|read|rec|recover|red|redi|redir|redo|redr|redraw|redraws|redrawstatus|reg|registers|res|resize|ret|retab|retu|return|rew|rewind|ri|right|rightb|rightbelow|ru|rub|ruby|rubyd|rubydo|rubyf|rubyfile|runtime|rv|rviminfo|sN|sNext|sa|sal|sall|san|sandbox|sargument|sav|saveas|sb|sbN|sbNext|sba|sball|sbf|sbfirst|sbl|sblast|sbm|sbmodified|sbn|sbnext|sbp|sbprevious|sbr|sbrewind|sbuffer|scrip|scripte|scriptencoding|scriptnames|se|set|setf|setfiletype|setg|setglobal|setl|setlocal|sf|sfind|sfir|sfirst|sh|shell|sign|sil|silent|sim|simalt|sl|sla|slast|sleep|sm|smagic|smap|smapc|smapclear|sme|smenu|sn|snext|sni|sniff|sno|snomagic|snor|snoremap|snoreme|snoremenu|so|sor|sort|source|sp|spe|spelld|spelldump|spellgood|spelli|spellinfo|spellr|spellrepall|spellu|spellundo|spellw|spellwrong|split|spr|sprevious|sre|srewind|st|sta|stag|star|startg|startgreplace|startinsert|startr|startreplace|stj|stjump|stop|stopi|stopinsert|sts|stselect|sun|sunhide|sunm|sunmap|sus|suspend|sv|sview|syncbind|t|tN|tNext|ta|tab|tabN|tabNext|tabc|tabclose|tabd|tabdo|tabe|tabedit|tabf|tabfind|tabfir|tabfirst|tabl|tablast|tabm|tabmove|tabn|tabnew|tabnext|tabo|tabonly|tabp|tabprevious|tabr|tabrewind|tabs|tag|tags|tc|tcl|tcld|tcldo|tclf|tclfile|te|tearoff|tf|tfirst|th|throw|tj|tjump|tl|tlast|tm|tmenu|tn|tnext|to|topleft|tp|tprevious|tr|trewind|try|ts|tselect|tu|tunmenu|u|una|unabbreviate|undo|undoj|undojoin|undol|undolist|unh|unhide|unlet|unlo|unlockvar|unm|unmap|up|update|ve|verb|verbose|version|vert|vertical|vi|vie|view|vim|vimgrep|vimgrepa|vimgrepadd|visual|viu|viusage|vmapc|vmapclear|vne|vnew|vs|vsplit|vu|vunmap|w|wN|wNext|wa|wall|wh|while|win|winc|wincmd|windo|winp|winpos|winsize|wn|wnext|wp|wprevious|wq|wqa|wqall|write|ws|wsverb|wv|wviminfo|x|xa|xall|xit|xm|xmap|xmapc|xmapclear|xme|xmenu|xn|xnoremap|xnoreme|xnoremenu|xu|xunmap|y|yank)\b/,builtin:/\b(?:acd|ai|akm|aleph|allowrevins|altkeymap|ambiwidth|ambw|anti|antialias|arab|arabic|arabicshape|ari|arshape|autochdir|autocmd|autoindent|autoread|autowrite|autowriteall|aw|awa|background|backspace|backup|backupcopy|backupdir|backupext|backupskip|balloondelay|ballooneval|balloonexpr|bdir|bdlay|beval|bex|bexpr|bg|bh|bin|binary|biosk|bioskey|bk|bkc|bomb|breakat|brk|browsedir|bs|bsdir|bsk|bt|bufhidden|buflisted|buftype|casemap|ccv|cdpath|cedit|cfu|ch|charconvert|ci|cin|cindent|cink|cinkeys|cino|cinoptions|cinw|cinwords|clipboard|cmdheight|cmdwinheight|cmp|cms|columns|com|comments|commentstring|compatible|complete|completefunc|completeopt|consk|conskey|copyindent|cot|cpo|cpoptions|cpt|cscopepathcomp|cscopeprg|cscopequickfix|cscopetag|cscopetagorder|cscopeverbose|cspc|csprg|csqf|cst|csto|csverb|cuc|cul|cursorcolumn|cursorline|cwh|debug|deco|def|define|delcombine|dex|dg|dict|dictionary|diff|diffexpr|diffopt|digraph|dip|dir|directory|dy|ea|ead|eadirection|eb|ed|edcompatible|ef|efm|ei|ek|enc|encoding|endofline|eol|ep|equalalways|equalprg|errorbells|errorfile|errorformat|esckeys|et|eventignore|expandtab|exrc|fcl|fcs|fdc|fde|fdi|fdl|fdls|fdm|fdn|fdo|fdt|fen|fenc|fencs|fex|ff|ffs|fileencoding|fileencodings|fileformat|fileformats|fillchars|fk|fkmap|flp|fml|fmr|foldcolumn|foldenable|foldexpr|foldignore|foldlevel|foldlevelstart|foldmarker|foldmethod|foldminlines|foldnestmax|foldtext|formatexpr|formatlistpat|formatoptions|formatprg|fp|fs|fsync|ft|gcr|gd|gdefault|gfm|gfn|gfs|gfw|ghr|gp|grepformat|grepprg|gtl|gtt|guicursor|guifont|guifontset|guifontwide|guiheadroom|guioptions|guipty|guitablabel|guitabtooltip|helpfile|helpheight|helplang|hf|hh|hi|hidden|highlight|hk|hkmap|hkmapp|hkp|hl|hlg|hls|hlsearch|ic|icon|iconstring|ignorecase|im|imactivatekey|imak|imc|imcmdline|imd|imdisable|imi|iminsert|ims|imsearch|inc|include|includeexpr|incsearch|inde|indentexpr|indentkeys|indk|inex|inf|infercase|insertmode|invacd|invai|invakm|invallowrevins|invaltkeymap|invanti|invantialias|invar|invarab|invarabic|invarabicshape|invari|invarshape|invautochdir|invautoindent|invautoread|invautowrite|invautowriteall|invaw|invawa|invbackup|invballooneval|invbeval|invbin|invbinary|invbiosk|invbioskey|invbk|invbl|invbomb|invbuflisted|invcf|invci|invcin|invcindent|invcompatible|invconfirm|invconsk|invconskey|invcopyindent|invcp|invcscopetag|invcscopeverbose|invcst|invcsverb|invcuc|invcul|invcursorcolumn|invcursorline|invdeco|invdelcombine|invdg|invdiff|invdigraph|invdisable|invea|inveb|inved|invedcompatible|invek|invendofline|inveol|invequalalways|inverrorbells|invesckeys|invet|invex|invexpandtab|invexrc|invfen|invfk|invfkmap|invfoldenable|invgd|invgdefault|invguipty|invhid|invhidden|invhk|invhkmap|invhkmapp|invhkp|invhls|invhlsearch|invic|invicon|invignorecase|invim|invimc|invimcmdline|invimd|invincsearch|invinf|invinfercase|invinsertmode|invis|invjoinspaces|invjs|invlazyredraw|invlbr|invlinebreak|invlisp|invlist|invloadplugins|invlpl|invlz|invma|invmacatsui|invmagic|invmh|invml|invmod|invmodeline|invmodifiable|invmodified|invmore|invmousef|invmousefocus|invmousehide|invnu|invnumber|invodev|invopendevice|invpaste|invpi|invpreserveindent|invpreviewwindow|invprompt|invpvw|invreadonly|invremap|invrestorescreen|invrevins|invri|invrightleft|invrightleftcmd|invrl|invrlc|invro|invrs|invru|invruler|invsb|invsc|invscb|invscrollbind|invscs|invsecure|invsft|invshellslash|invshelltemp|invshiftround|invshortname|invshowcmd|invshowfulltag|invshowmatch|invshowmode|invsi|invsm|invsmartcase|invsmartindent|invsmarttab|invsmd|invsn|invsol|invspell|invsplitbelow|invsplitright|invspr|invsr|invssl|invsta|invstartofline|invstmp|invswapfile|invswf|invta|invtagbsearch|invtagrelative|invtagstack|invtbi|invtbidi|invtbs|invtermbidi|invterse|invtextauto|invtextmode|invtf|invtgst|invtildeop|invtimeout|invtitle|invto|invtop|invtr|invttimeout|invttybuiltin|invttyfast|invtx|invvb|invvisualbell|invwa|invwarn|invwb|invweirdinvert|invwfh|invwfw|invwildmenu|invwinfixheight|invwinfixwidth|invwiv|invwmnu|invwrap|invwrapscan|invwrite|invwriteany|invwritebackup|invws|isf|isfname|isi|isident|isk|iskeyword|isprint|joinspaces|js|key|keymap|keymodel|keywordprg|km|kmp|kp|langmap|langmenu|laststatus|lazyredraw|lbr|lcs|linebreak|lines|linespace|lisp|lispwords|listchars|loadplugins|lpl|lsp|lz|macatsui|magic|makeef|makeprg|matchpairs|matchtime|maxcombine|maxfuncdepth|maxmapdepth|maxmem|maxmempattern|maxmemtot|mco|mef|menuitems|mfd|mh|mis|mkspellmem|ml|mls|mm|mmd|mmp|mmt|modeline|modelines|modifiable|modified|more|mouse|mousef|mousefocus|mousehide|mousem|mousemodel|mouses|mouseshape|mouset|mousetime|mp|mps|msm|mzq|mzquantum|nf|noacd|noai|noakm|noallowrevins|noaltkeymap|noanti|noantialias|noar|noarab|noarabic|noarabicshape|noari|noarshape|noautochdir|noautoindent|noautoread|noautowrite|noautowriteall|noaw|noawa|nobackup|noballooneval|nobeval|nobin|nobinary|nobiosk|nobioskey|nobk|nobl|nobomb|nobuflisted|nocf|noci|nocin|nocindent|nocompatible|noconfirm|noconsk|noconskey|nocopyindent|nocp|nocscopetag|nocscopeverbose|nocst|nocsverb|nocuc|nocul|nocursorcolumn|nocursorline|nodeco|nodelcombine|nodg|nodiff|nodigraph|nodisable|noea|noeb|noed|noedcompatible|noek|noendofline|noeol|noequalalways|noerrorbells|noesckeys|noet|noex|noexpandtab|noexrc|nofen|nofk|nofkmap|nofoldenable|nogd|nogdefault|noguipty|nohid|nohidden|nohk|nohkmap|nohkmapp|nohkp|nohls|noic|noicon|noignorecase|noim|noimc|noimcmdline|noimd|noincsearch|noinf|noinfercase|noinsertmode|nois|nojoinspaces|nojs|nolazyredraw|nolbr|nolinebreak|nolisp|nolist|noloadplugins|nolpl|nolz|noma|nomacatsui|nomagic|nomh|noml|nomod|nomodeline|nomodifiable|nomodified|nomore|nomousef|nomousefocus|nomousehide|nonu|nonumber|noodev|noopendevice|nopaste|nopi|nopreserveindent|nopreviewwindow|noprompt|nopvw|noreadonly|noremap|norestorescreen|norevins|nori|norightleft|norightleftcmd|norl|norlc|noro|nors|noru|noruler|nosb|nosc|noscb|noscrollbind|noscs|nosecure|nosft|noshellslash|noshelltemp|noshiftround|noshortname|noshowcmd|noshowfulltag|noshowmatch|noshowmode|nosi|nosm|nosmartcase|nosmartindent|nosmarttab|nosmd|nosn|nosol|nospell|nosplitbelow|nosplitright|nospr|nosr|nossl|nosta|nostartofline|nostmp|noswapfile|noswf|nota|notagbsearch|notagrelative|notagstack|notbi|notbidi|notbs|notermbidi|noterse|notextauto|notextmode|notf|notgst|notildeop|notimeout|notitle|noto|notop|notr|nottimeout|nottybuiltin|nottyfast|notx|novb|novisualbell|nowa|nowarn|nowb|noweirdinvert|nowfh|nowfw|nowildmenu|nowinfixheight|nowinfixwidth|nowiv|nowmnu|nowrap|nowrapscan|nowrite|nowriteany|nowritebackup|nows|nrformats|numberwidth|nuw|odev|oft|ofu|omnifunc|opendevice|operatorfunc|opfunc|osfiletype|pa|para|paragraphs|paste|pastetoggle|patchexpr|patchmode|path|pdev|penc|pex|pexpr|pfn|ph|pheader|pi|pm|pmbcs|pmbfn|popt|preserveindent|previewheight|previewwindow|printdevice|printencoding|printexpr|printfont|printheader|printmbcharset|printmbfont|printoptions|prompt|pt|pumheight|pvh|pvw|qe|quoteescape|readonly|remap|report|restorescreen|revins|rightleft|rightleftcmd|rl|rlc|ro|rs|rtp|ruf|ruler|rulerformat|runtimepath|sbo|sc|scb|scr|scroll|scrollbind|scrolljump|scrolloff|scrollopt|scs|sect|sections|secure|sel|selection|selectmode|sessionoptions|sft|shcf|shellcmdflag|shellpipe|shellquote|shellredir|shellslash|shelltemp|shelltype|shellxquote|shiftround|shiftwidth|shm|shortmess|shortname|showbreak|showcmd|showfulltag|showmatch|showmode|showtabline|shq|si|sidescroll|sidescrolloff|siso|sj|slm|smartcase|smartindent|smarttab|smc|smd|softtabstop|sol|spc|spell|spellcapcheck|spellfile|spelllang|spellsuggest|spf|spl|splitbelow|splitright|sps|sr|srr|ss|ssl|ssop|stal|startofline|statusline|stl|stmp|su|sua|suffixes|suffixesadd|sw|swapfile|swapsync|swb|swf|switchbuf|sws|sxq|syn|synmaxcol|syntax|t_AB|t_AF|t_AL|t_CS|t_CV|t_Ce|t_Co|t_Cs|t_DL|t_EI|t_F1|t_F2|t_F3|t_F4|t_F5|t_F6|t_F7|t_F8|t_F9|t_IE|t_IS|t_K1|t_K3|t_K4|t_K5|t_K6|t_K7|t_K8|t_K9|t_KA|t_KB|t_KC|t_KD|t_KE|t_KF|t_KG|t_KH|t_KI|t_KJ|t_KK|t_KL|t_RI|t_RV|t_SI|t_Sb|t_Sf|t_WP|t_WS|t_ZH|t_ZR|t_al|t_bc|t_cd|t_ce|t_cl|t_cm|t_cs|t_da|t_db|t_dl|t_fs|t_k1|t_k2|t_k3|t_k4|t_k5|t_k6|t_k7|t_k8|t_k9|t_kB|t_kD|t_kI|t_kN|t_kP|t_kb|t_kd|t_ke|t_kh|t_kl|t_kr|t_ks|t_ku|t_le|t_mb|t_md|t_me|t_mr|t_ms|t_nd|t_op|t_se|t_so|t_sr|t_te|t_ti|t_ts|t_ue|t_us|t_ut|t_vb|t_ve|t_vi|t_vs|t_xs|tabline|tabpagemax|tabstop|tagbsearch|taglength|tagrelative|tagstack|tal|tb|tbi|tbidi|tbis|tbs|tenc|term|termbidi|termencoding|terse|textauto|textmode|textwidth|tgst|thesaurus|tildeop|timeout|timeoutlen|title|titlelen|titleold|titlestring|toolbar|toolbariconsize|top|tpm|tsl|tsr|ttimeout|ttimeoutlen|ttm|tty|ttybuiltin|ttyfast|ttym|ttymouse|ttyscroll|ttytype|tw|tx|uc|ul|undolevels|updatecount|updatetime|ut|vb|vbs|vdir|verbosefile|vfile|viewdir|viewoptions|viminfo|virtualedit|visualbell|vop|wak|warn|wb|wc|wcm|wd|weirdinvert|wfh|wfw|whichwrap|wi|wig|wildchar|wildcharm|wildignore|wildmenu|wildmode|wildoptions|wim|winaltkeys|window|winfixheight|winfixwidth|winheight|winminheight|winminwidth|winwidth|wiv|wiw|wm|wmh|wmnu|wmw|wop|wrap|wrapmargin|wrapscan|writeany|writebackup|writedelay|ww)\b/,number:/\b(?:0x[\da-f]+|\d+(?:\.\d+)?)\b/i,operator:/\|\||&&|[-+.]=?|[=!](?:[=~][#?]?)?|[<>]=?[#?]?|[*\/%?]|\b(?:is(?:not)?)\b/,punctuation:/[{}[\](),;:]/}}mg.displayName="visual-basic";mg.aliases=["vb","vba"];function mg(e){e.languages["visual-basic"]={comment:{pattern:/(?:['‘’]|REM\b)(?:[^\r\n_]|_(?:\r\n?|\n)?)*/i,inside:{keyword:/^REM/i}},directive:{pattern:/#(?:Const|Else|ElseIf|End|ExternalChecksum|ExternalSource|If|Region)(?:\b_[ \t]*(?:\r\n?|\n)|.)+/i,alias:"property",greedy:!0},string:{pattern:/\$?["“”](?:["“”]{2}|[^"“”])*["“”]C?/i,greedy:!0},date:{pattern:/#[ \t]*(?:\d+([/-])\d+\1\d+(?:[ \t]+(?:\d+[ \t]*(?:AM|PM)|\d+:\d+(?::\d+)?(?:[ \t]*(?:AM|PM))?))?|\d+[ \t]*(?:AM|PM)|\d+:\d+(?::\d+)?(?:[ \t]*(?:AM|PM))?)[ \t]*#/i,alias:"number"},number:/(?:(?:\b\d+(?:\.\d+)?|\.\d+)(?:E[+-]?\d+)?|&[HO][\dA-F]+)(?:[FRD]|U?[ILS])?/i,boolean:/\b(?:False|Nothing|True)\b/i,keyword:/\b(?:AddHandler|AddressOf|Alias|And(?:Also)?|As|Boolean|ByRef|Byte|ByVal|Call|Case|Catch|C(?:Bool|Byte|Char|Date|Dbl|Dec|Int|Lng|Obj|SByte|Short|Sng|Str|Type|UInt|ULng|UShort)|Char|Class|Const|Continue|Currency|Date|Decimal|Declare|Default|Delegate|Dim|DirectCast|Do|Double|Each|Else(?:If)?|End(?:If)?|Enum|Erase|Error|Event|Exit|Finally|For|Friend|Function|Get(?:Type|XMLNamespace)?|Global|GoSub|GoTo|Handles|If|Implements|Imports|In|Inherits|Integer|Interface|Is|IsNot|Let|Lib|Like|Long|Loop|Me|Mod|Module|Must(?:Inherit|Override)|My(?:Base|Class)|Namespace|Narrowing|New|Next|Not(?:Inheritable|Overridable)?|Object|Of|On|Operator|Option(?:al)?|Or(?:Else)?|Out|Overloads|Overridable|Overrides|ParamArray|Partial|Private|Property|Protected|Public|RaiseEvent|ReadOnly|ReDim|RemoveHandler|Resume|Return|SByte|Select|Set|Shadows|Shared|short|Single|Static|Step|Stop|String|Structure|Sub|SyncLock|Then|Throw|To|Try|TryCast|Type|TypeOf|U(?:Integer|Long|Short)|Until|Using|Variant|Wend|When|While|Widening|With(?:Events)?|WriteOnly|Xor)\b/i,operator:/[+\-*/\\^<=>&#@$%!]|\b_(?=[ \t]*[\r\n])/,punctuation:/[{}().,:?]/},e.languages.vb=e.languages["visual-basic"],e.languages.vba=e.languages["visual-basic"]}hg.displayName="warpscript";hg.aliases=[];function hg(e){e.languages.warpscript={comment:/#.*|\/\/.*|\/\*[\s\S]*?\*\//,string:{pattern:/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'|<'(?:[^\\']|'(?!>)|\\.)*'>/,greedy:!0},variable:/\$\S+/,macro:{pattern:/@\S+/,alias:"property"},keyword:/\b(?:BREAK|CHECKMACRO|CONTINUE|CUDF|DEFINED|DEFINEDMACRO|EVAL|FAIL|FOR|FOREACH|FORSTEP|IFT|IFTE|MSGFAIL|NRETURN|RETHROW|RETURN|SWITCH|TRY|UDF|UNTIL|WHILE)\b/,number:/[+-]?\b(?:NaN|Infinity|\d+(?:\.\d*)?(?:[Ee][+-]?\d+)?|0x[\da-fA-F]+|0b[01]+)\b/,boolean:/\b(?:F|T|false|true)\b/,punctuation:/<%|%>|[{}[\]()]/,operator:/==|&&?|\|\|?|\*\*?|>>>?|<<|[<>!~]=?|[-/%^]|\+!?|\b(?:AND|NOT|OR)\b/}}gg.displayName="wasm";gg.aliases=[];function gg(e){e.languages.wasm={comment:[/\(;[\s\S]*?;\)/,{pattern:/;;.*/,greedy:!0}],string:{pattern:/"(?:\\[\s\S]|[^"\\])*"/,greedy:!0},keyword:[{pattern:/\b(?:align|offset)=/,inside:{operator:/=/}},{pattern:/\b(?:(?:f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|neg?|nearest|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|sqrt|store(?:8|16|32)?|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))?|memory\.(?:grow|size))\b/,inside:{punctuation:/\./}},/\b(?:anyfunc|block|br(?:_if|_table)?|call(?:_indirect)?|data|drop|elem|else|end|export|func|get_(?:global|local)|global|if|import|local|loop|memory|module|mut|nop|offset|param|result|return|select|set_(?:global|local)|start|table|tee_local|then|type|unreachable)\b/],variable:/\$[\w!#$%&'*+\-./:<=>?@\\^`|~]+/,number:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/,punctuation:/[()]/}}bg.displayName="web-idl";bg.aliases=["webidl"];function bg(e){(function(t){var n=/(?:\B-|\b_|\b)[A-Za-z][\w-]*(?![\w-])/.source,r="(?:"+/\b(?:unsigned\s+)?long\s+long(?![\w-])/.source+"|"+/\b(?:unrestricted|unsigned)\s+[a-z]+(?![\w-])/.source+"|"+/(?!(?:unrestricted|unsigned)\b)/.source+n+/(?:\s*<(?:[^<>]|<[^<>]*>)*>)?/.source+")"+/(?:\s*\?)?/.source,a={};t.languages["web-idl"]={comment:{pattern:/\/\/.*|\/\*[\s\S]*?\*\//,greedy:!0},string:{pattern:/"[^"]*"/,greedy:!0},namespace:{pattern:RegExp(/(\bnamespace\s+)/.source+n),lookbehind:!0},"class-name":[{pattern:/(^|[^\w-])(?:iterable|maplike|setlike)\s*<(?:[^<>]|<[^<>]*>)*>/,lookbehind:!0,inside:a},{pattern:RegExp(/(\b(?:attribute|const|deleter|getter|optional|setter)\s+)/.source+r),lookbehind:!0,inside:a},{pattern:RegExp("("+/\bcallback\s+/.source+n+/\s*=\s*/.source+")"+r),lookbehind:!0,inside:a},{pattern:RegExp(/(\btypedef\b\s*)/.source+r),lookbehind:!0,inside:a},{pattern:RegExp(/(\b(?:callback|dictionary|enum|interface(?:\s+mixin)?)\s+)(?!(?:interface|mixin)\b)/.source+n),lookbehind:!0},{pattern:RegExp(/(:\s*)/.source+n),lookbehind:!0},RegExp(n+/(?=\s+(?:implements|includes)\b)/.source),{pattern:RegExp(/(\b(?:implements|includes)\s+)/.source+n),lookbehind:!0},{pattern:RegExp(r+"(?="+/\s*(?:\.{3}\s*)?/.source+n+/\s*[(),;=]/.source+")"),inside:a}],builtin:/\b(?:ArrayBuffer|BigInt64Array|BigUint64Array|ByteString|DOMString|DataView|Float32Array|Float64Array|FrozenArray|Int16Array|Int32Array|Int8Array|ObservableArray|Promise|USVString|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray)\b/,keyword:[/\b(?:async|attribute|callback|const|constructor|deleter|dictionary|enum|getter|implements|includes|inherit|interface|mixin|namespace|null|optional|or|partial|readonly|required|setter|static|stringifier|typedef|unrestricted)\b/,/\b(?:any|bigint|boolean|byte|double|float|iterable|long|maplike|object|octet|record|sequence|setlike|short|symbol|undefined|unsigned|void)\b/],boolean:/\b(?:false|true)\b/,number:{pattern:/(^|[^\w-])-?(?:0x[0-9a-f]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|NaN|Infinity)(?![\w-])/i,lookbehind:!0},operator:/\.{3}|[=:?<>-]/,punctuation:/[(){}[\].,;]/};for(var s in t.languages["web-idl"])s!=="class-name"&&(a[s]=t.languages["web-idl"][s]);t.languages.webidl=t.languages["web-idl"]})(e)}Eg.displayName="wgsl";Eg.aliases=[];function Eg(e){e.languages.wgsl={comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},"builtin-attribute":{pattern:/(@)builtin\(.*?\)/,lookbehind:!0,inside:{attribute:{pattern:/^builtin/,alias:"attr-name"},punctuation:/[(),]/,"built-in-values":{pattern:/\b(?:frag_depth|front_facing|global_invocation_id|instance_index|local_invocation_id|local_invocation_index|num_workgroups|position|sample_index|sample_mask|vertex_index|workgroup_id)\b/,alias:"attr-value"}}},attributes:{pattern:/(@)(?:align|binding|compute|const|fragment|group|id|interpolate|invariant|location|size|vertex|workgroup_size)/i,lookbehind:!0,alias:"attr-name"},functions:{pattern:/\b(fn\s+)[_a-zA-Z]\w*(?=[(<])/,lookbehind:!0,alias:"function"},keyword:/\b(?:bitcast|break|case|const|continue|continuing|default|discard|else|enable|fallthrough|fn|for|function|if|let|loop|private|return|storage|struct|switch|type|uniform|var|while|workgroup)\b/,builtin:/\b(?:abs|acos|acosh|all|any|array|asin|asinh|atan|atan2|atanh|atomic|atomicAdd|atomicAnd|atomicCompareExchangeWeak|atomicExchange|atomicLoad|atomicMax|atomicMin|atomicOr|atomicStore|atomicSub|atomicXor|bool|ceil|clamp|cos|cosh|countLeadingZeros|countOneBits|countTrailingZeros|cross|degrees|determinant|distance|dot|dpdx|dpdxCoarse|dpdxFine|dpdy|dpdyCoarse|dpdyFine|exp|exp2|extractBits|f32|f64|faceForward|firstLeadingBit|floor|fma|fract|frexp|fwidth|fwidthCoarse|fwidthFine|i32|i64|insertBits|inverseSqrt|ldexp|length|log|log2|mat[2-4]x[2-4]|max|min|mix|modf|normalize|override|pack2x16float|pack2x16snorm|pack2x16unorm|pack4x8snorm|pack4x8unorm|pow|ptr|quantizeToF16|radians|reflect|refract|reverseBits|round|sampler|sampler_comparison|select|shiftLeft|shiftRight|sign|sin|sinh|smoothstep|sqrt|staticAssert|step|storageBarrier|tan|tanh|textureDimensions|textureGather|textureGatherCompare|textureLoad|textureNumLayers|textureNumLevels|textureNumSamples|textureSample|textureSampleBias|textureSampleCompare|textureSampleCompareLevel|textureSampleGrad|textureSampleLevel|textureStore|texture_1d|texture_2d|texture_2d_array|texture_3d|texture_cube|texture_cube_array|texture_depth_2d|texture_depth_2d_array|texture_depth_cube|texture_depth_cube_array|texture_depth_multisampled_2d|texture_multisampled_2d|texture_storage_1d|texture_storage_2d|texture_storage_2d_array|texture_storage_3d|transpose|trunc|u32|u64|unpack2x16float|unpack2x16snorm|unpack2x16unorm|unpack4x8snorm|unpack4x8unorm|vec[2-4]|workgroupBarrier)\b/,"function-calls":{pattern:/\b[_a-z]\w*(?=\()/i,alias:"function"},"class-name":/\b(?:[A-Z][A-Za-z0-9]*)\b/,"bool-literal":{pattern:/\b(?:false|true)\b/,alias:"boolean"},"hex-int-literal":{pattern:/\b0[xX][0-9a-fA-F]+[iu]?\b(?![.pP])/,alias:"number"},"hex-float-literal":{pattern:/\b0[xX][0-9a-fA-F]*(?:\.[0-9a-fA-F]*)?(?:[pP][+-]?\d+[fh]?)?/,alias:"number"},"decimal-float-literal":[{pattern:/\d*\.\d+(?:[eE](?:\+|-)?\d+)?[fh]?/,alias:"number"},{pattern:/\d+\.\d*(?:[eE](?:\+|-)?\d+)?[fh]?/,alias:"number"},{pattern:/\d+[eE](?:\+|-)?\d+[fh]?/,alias:"number"},{pattern:/\b\d+[fh]\b/,alias:"number"}],"int-literal":{pattern:/\b\d+[iu]?\b/,alias:"number"},operator:[{pattern:/(?:\^|~|\|(?!\|)|\|\||&&|<<|>>|!)(?!=)/},{pattern:/&(?![&=])/},{pattern:/(?:\+=|-=|\*=|\/=|%=|\^=|&=|\|=|<<=|>>=)/},{pattern:/(^|[^<>=!])=(?![=>])/,lookbehind:!0},{pattern:/(?:==|!=|<=|\+\+|--|(^|[^=])>=)/,lookbehind:!0},{pattern:/(?:(?:[+%]|(?:\*(?!\w)))(?!=))|(?:-(?!>))|(?:\/(?!\/))/},{pattern:/->/}],punctuation:/[@(){}[\],;<>:.]/}}xg.displayName="wiki";xg.aliases=[];function xg(e){e.register(bn),e.languages.wiki=e.languages.extend("markup",{"block-comment":{pattern:/(^|[^\\])\/\*[\s\S]*?\*\//,lookbehind:!0,alias:"comment"},heading:{pattern:/^(=+)[^=\r\n].*?\1/m,inside:{punctuation:/^=+|=+$/,important:/.+/}},emphasis:{pattern:/('{2,5}).+?\1/,inside:{"bold-italic":{pattern:/(''''').+?(?=\1)/,lookbehind:!0,alias:["bold","italic"]},bold:{pattern:/(''')[^'](?:.*?[^'])?(?=\1)/,lookbehind:!0},italic:{pattern:/('')[^'](?:.*?[^'])?(?=\1)/,lookbehind:!0},punctuation:/^''+|''+$/}},hr:{pattern:/^-{4,}/m,alias:"punctuation"},url:[/ISBN +(?:97[89][ -]?)?(?:\d[ -]?){9}[\dx]\b|(?:PMID|RFC) +\d+/i,/\[\[.+?\]\]|\[.+?\]/],variable:[/__[A-Z]+__/,/\{{3}.+?\}{3}/,/\{\{.+?\}\}/],symbol:[/^#redirect/im,/~{3,5}/],"table-tag":{pattern:/((?:^|[|!])[|!])[^|\r\n]+\|(?!\|)/m,lookbehind:!0,inside:{"table-bar":{pattern:/\|$/,alias:"punctuation"},rest:e.languages.markup.tag.inside}},punctuation:/^(?:\{\||\|\}|\|-|[*#:;!|])|\|\||!!/m}),e.languages.insertBefore("wiki","tag",{nowiki:{pattern:/<(nowiki|pre|source)\b[^>]*>[\s\S]*?<\/\1>/i,inside:{tag:{pattern:/<(?:nowiki|pre|source)\b[^>]*>|<\/(?:nowiki|pre|source)>/i,inside:e.languages.markup.tag.inside}}}})}yg.displayName="wolfram";yg.aliases=["mathematica","nb","wl"];function yg(e){e.languages.wolfram={comment:/\(\*(?:\(\*(?:[^*]|\*(?!\)))*\*\)|(?!\(\*)[\s\S])*?\*\)/,string:{pattern:/"(?:\\.|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:Abs|AbsArg|Accuracy|Block|Do|For|Function|If|Manipulate|Module|Nest|NestList|None|Return|Switch|Table|Which|While)\b/,context:{pattern:/\b\w+`+\w*/,alias:"class-name"},blank:{pattern:/\b\w+_\b/,alias:"regex"},"global-variable":{pattern:/\$\w+/,alias:"variable"},boolean:/\b(?:False|True)\b/,number:/(?:\b(?=\d)|\B(?=\.))(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?j?\b/i,operator:/\/\.|;|=\.|\^=|\^:=|:=|<<|>>|<\||\|>|:>|\|->|->|<-|@@@|@@|@|\/@|=!=|===|==|=|\+|-|\[\/-+%=\]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},e.languages.mathematica=e.languages.wolfram,e.languages.wl=e.languages.wolfram,e.languages.nb=e.languages.wolfram}Tg.displayName="wren";Tg.aliases=[];function Tg(e){e.languages.wren={comment:[{pattern:/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|\/\*(?:[^*/]|\*(?!\/)|\/(?!\*))*\*\/)*\*\/)*\*\//,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],"triple-quoted-string":{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:"string"},"string-literal":null,hashbang:{pattern:/^#!\/.+/,greedy:!0,alias:"comment"},attribute:{pattern:/#!?[ \t\u3000]*\w+/,alias:"keyword"},"class-name":[{pattern:/(\bclass\s+)\w+/,lookbehind:!0},/\b[A-Z][a-z\d_]*\b/],constant:/\b[A-Z][A-Z\d_]*\b/,null:{pattern:/\bnull\b/,alias:"keyword"},keyword:/\b(?:as|break|class|construct|continue|else|for|foreign|if|import|in|is|return|static|super|this|var|while)\b/,boolean:/\b(?:false|true)\b/,number:/\b(?:0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)\b/i,function:/\b[a-z_]\w*(?=\s*[({])/i,operator:/<<|>>|[=!<>]=?|&&|\|\||[-+*/%~^&|?:]|\.{2,3}/,punctuation:/[\[\](){}.,;]/},e.languages.wren["string-literal"]={pattern:/(^|[^\\"])"(?:[^\\"%]|\\[\s\S]|%(?!\()|%\((?:[^()]|\((?:[^()]|\([^)]*\))*\))*\))*"/,lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)%\((?:[^()]|\((?:[^()]|\([^)]*\))*\))*\)/,lookbehind:!0,inside:{expression:{pattern:/^(%\()[\s\S]+(?=\)$)/,lookbehind:!0,inside:e.languages.wren},"interpolation-punctuation":{pattern:/^%\(|\)$/,alias:"punctuation"}}},string:/[\s\S]+/}}}Sg.displayName="xeora";Sg.aliases=["xeoracube"];function Sg(e){e.register(bn),(function(t){t.languages.xeora=t.languages.extend("markup",{constant:{pattern:/\$(?:DomainContents|PageRenderDuration)\$/,inside:{punctuation:{pattern:/\$/}}},variable:{pattern:/\$@?(?:#+|[-+*~=^])?[\w.]+\$/,inside:{punctuation:{pattern:/[$.]/},operator:{pattern:/#+|[-+*~=^@]/}}},"function-inline":{pattern:/\$F:[-\w.]+\?[-\w.]+(?:,(?:(?:@[-#]*\w+\.[\w+.]\.*)*\|)*(?:(?:[\w+]|[-#*.~^]+[\w+]|=\S)(?:[^$=]|=+[^=])*=*|(?:@[-#]*\w+\.[\w+.]\.*)+(?:(?:[\w+]|[-#*~^][-#*.~^]*[\w+]|=\S)(?:[^$=]|=+[^=])*=*)?)?)?\$/,inside:{variable:{pattern:/(?:[,|])@?(?:#+|[-+*~=^])?[\w.]+/,inside:{punctuation:{pattern:/[,.|]/},operator:{pattern:/#+|[-+*~=^@]/}}},punctuation:{pattern:/\$\w:|[$:?.,|]/}},alias:"function"},"function-block":{pattern:/\$XF:\{[-\w.]+\?[-\w.]+(?:,(?:(?:@[-#]*\w+\.[\w+.]\.*)*\|)*(?:(?:[\w+]|[-#*.~^]+[\w+]|=\S)(?:[^$=]|=+[^=])*=*|(?:@[-#]*\w+\.[\w+.]\.*)+(?:(?:[\w+]|[-#*~^][-#*.~^]*[\w+]|=\S)(?:[^$=]|=+[^=])*=*)?)?)?\}:XF\$/,inside:{punctuation:{pattern:/[$:{}?.,|]/}},alias:"function"},"directive-inline":{pattern:/\$\w(?:#\d+\+?)?(?:\[[-\w.]+\])?:[-\/\w.]+\$/,inside:{punctuation:{pattern:/\$(?:\w:|C(?:\[|#\d))?|[:{[\]]/,inside:{tag:{pattern:/#\d/}}}},alias:"function"},"directive-block-open":{pattern:/\$\w+:\{|\$\w(?:#\d+\+?)?(?:\[[-\w.]+\])?:[-\w.]+:\{(?:![A-Z]+)?/,inside:{punctuation:{pattern:/\$(?:\w:|C(?:\[|#\d))?|[:{[\]]/,inside:{tag:{pattern:/#\d/}}},attribute:{pattern:/![A-Z]+$/,inside:{punctuation:{pattern:/!/}},alias:"keyword"}},alias:"function"},"directive-block-separator":{pattern:/\}:[-\w.]+:\{/,inside:{punctuation:{pattern:/[:{}]/}},alias:"function"},"directive-block-close":{pattern:/\}:[-\w.]+\$/,inside:{punctuation:{pattern:/[:{}$]/}},alias:"function"}}),t.languages.insertBefore("inside","punctuation",{variable:t.languages.xeora["function-inline"].inside.variable},t.languages.xeora["function-block"]),t.languages.xeoracube=t.languages.xeora})(e)}vg.displayName="xml-doc";vg.aliases=[];function vg(e){e.register(bn),(function(t){function n(i,o){t.languages[i]&&t.languages.insertBefore(i,"comment",{"doc-comment":o})}var r=t.languages.markup.tag,a={pattern:/\/\/\/.*/,greedy:!0,alias:"comment",inside:{tag:r}},s={pattern:/'''.*/,greedy:!0,alias:"comment",inside:{tag:r}};n("csharp",a),n("fsharp",a),n("vbnet",s)})(e)}wg.displayName="xojo";wg.aliases=[];function wg(e){e.languages.xojo={comment:{pattern:/(?:'|\/\/|Rem\b).+/i,greedy:!0},string:{pattern:/"(?:""|[^"])*"/,greedy:!0},number:[/(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:E[+-]?\d+)?/i,/&[bchou][a-z\d]+/i],directive:{pattern:/#(?:Else|ElseIf|Endif|If|Pragma)\b/i,alias:"property"},keyword:/\b(?:AddHandler|App|Array|As(?:signs)?|Auto|Boolean|Break|By(?:Ref|Val)|Byte|Call|Case|Catch|CFStringRef|CGFloat|Class|Color|Const|Continue|CString|Currency|CurrentMethodName|Declare|Delegate|Dim|Do(?:uble|wnTo)?|Each|Else(?:If)?|End|Enumeration|Event|Exception|Exit|Extends|False|Finally|For|Function|Get|GetTypeInfo|Global|GOTO|If|Implements|In|Inherits|Int(?:8|16|32|64|eger|erface)?|Lib|Loop|Me|Module|Next|Nil|Object|Optional|OSType|ParamArray|Private|Property|Protected|PString|Ptr|Raise(?:Event)?|ReDim|RemoveHandler|Return|Select(?:or)?|Self|Set|Shared|Short|Single|Soft|Static|Step|String|Sub|Super|Text|Then|To|True|Try|Ubound|UInt(?:8|16|32|64|eger)?|Until|Using|Var(?:iant)?|Wend|While|WindowPtr|WString)\b/i,operator:/<[=>]?|>=?|[+\-*\/\\^=]|\b(?:AddressOf|And|Ctype|IsA?|Mod|New|Not|Or|WeakAddressOf|Xor)\b/i,punctuation:/[.,;:()]/}}Ag.displayName="xquery";Ag.aliases=[];function Ag(e){e.register(bn),(function(t){t.languages.xquery=t.languages.extend("markup",{"xquery-comment":{pattern:/\(:[\s\S]*?:\)/,greedy:!0,alias:"comment"},string:{pattern:/(["'])(?:\1\1|(?!\1)[\s\S])*\1/,greedy:!0},extension:{pattern:/\(#.+?#\)/,alias:"symbol"},variable:/\$[-\w:]+/,axis:{pattern:/(^|[^-])(?:ancestor(?:-or-self)?|attribute|child|descendant(?:-or-self)?|following(?:-sibling)?|parent|preceding(?:-sibling)?|self)(?=::)/,lookbehind:!0,alias:"operator"},"keyword-operator":{pattern:/(^|[^:-])\b(?:and|castable as|div|eq|except|ge|gt|idiv|instance of|intersect|is|le|lt|mod|ne|or|union)\b(?=$|[^:-])/,lookbehind:!0,alias:"operator"},keyword:{pattern:/(^|[^:-])\b(?:as|ascending|at|base-uri|boundary-space|case|cast as|collation|construction|copy-namespaces|declare|default|descending|else|empty (?:greatest|least)|encoding|every|external|for|function|if|import|in|inherit|lax|let|map|module|namespace|no-inherit|no-preserve|option|order(?: by|ed|ing)?|preserve|return|satisfies|schema|some|stable|strict|strip|then|to|treat as|typeswitch|unordered|validate|variable|version|where|xquery)\b(?=$|[^:-])/,lookbehind:!0},function:/[\w-]+(?::[\w-]+)*(?=\s*\()/,"xquery-element":{pattern:/(element\s+)[\w-]+(?::[\w-]+)*/,lookbehind:!0,alias:"tag"},"xquery-attribute":{pattern:/(attribute\s+)[\w-]+(?::[\w-]+)*/,lookbehind:!0,alias:"attr-name"},builtin:{pattern:/(^|[^:-])\b(?:attribute|comment|document|element|processing-instruction|text|xs:(?:ENTITIES|ENTITY|ID|IDREFS?|NCName|NMTOKENS?|NOTATION|Name|QName|anyAtomicType|anyType|anyURI|base64Binary|boolean|byte|date|dateTime|dayTimeDuration|decimal|double|duration|float|gDay|gMonth|gMonthDay|gYear|gYearMonth|hexBinary|int|integer|language|long|negativeInteger|nonNegativeInteger|nonPositiveInteger|normalizedString|positiveInteger|short|string|time|token|unsigned(?:Byte|Int|Long|Short)|untyped(?:Atomic)?|yearMonthDuration))\b(?=$|[^:-])/,lookbehind:!0},number:/\b\d+(?:\.\d+)?(?:E[+-]?\d+)?/,operator:[/[+*=?|@]|\.\.?|:=|!=|<[=<]?|>[=>]?/,{pattern:/(\s)-(?=\s)/,lookbehind:!0}],punctuation:/[[\](){},;:/]/}),t.languages.xquery.tag.pattern=/<\/?(?!\d)[^\s>\/=$<%]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|\{(?!\{)(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])+\}|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/,t.languages.xquery.tag.inside["attr-value"].pattern=/=(?:("|')(?:\\[\s\S]|\{(?!\{)(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])+\}|(?!\1)[^\\])*\1|[^\s'">=]+)/,t.languages.xquery.tag.inside["attr-value"].inside.punctuation=/^="|"$/,t.languages.xquery.tag.inside["attr-value"].inside.expression={pattern:/\{(?!\{)(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])+\}/,inside:t.languages.xquery,alias:"language-xquery"};var n=function(a){return typeof a=="string"?a:typeof a.content=="string"?a.content:a.content.map(n).join("")},r=function(a){for(var s=[],i=0;i<a.length;i++){var o=a[i],u=!1;if(typeof o!="string"&&(o.type==="tag"&&o.content[0]&&o.content[0].type==="tag"?o.content[0].content[0].content==="</"?s.length>0&&s[s.length-1].tagName===n(o.content[0].content[1])&&s.pop():o.content[o.content.length-1].content==="/>"||s.push({tagName:n(o.content[0].content[1]),openedBraces:0}):s.length>0&&o.type==="punctuation"&&o.content==="{"&&(!a[i+1]||a[i+1].type!=="punctuation"||a[i+1].content!=="{")&&(!a[i-1]||a[i-1].type!=="plain-text"||a[i-1].content!=="{")?s[s.length-1].openedBraces++:s.length>0&&s[s.length-1].openedBraces>0&&o.type==="punctuation"&&o.content==="}"?s[s.length-1].openedBraces--:o.type!=="comment"&&(u=!0)),(u||typeof o=="string")&&s.length>0&&s[s.length-1].openedBraces===0){var c=n(o);i<a.length-1&&(typeof a[i+1]=="string"||a[i+1].type==="plain-text")&&(c+=n(a[i+1]),a.splice(i+1,1)),i>0&&(typeof a[i-1]=="string"||a[i-1].type==="plain-text")&&(c=n(a[i-1])+c,a.splice(i-1,1),i--),/^\s+$/.test(c)?a[i]=c:a[i]=new t.Token("plain-text",c,null,c)}o.content&&typeof o.content!="string"&&r(o.content)}};t.hooks.add("after-tokenize",function(a){a.language==="xquery"&&r(a.tokens)})})(e)}Ng.displayName="yang";Ng.aliases=[];function Ng(e){e.languages.yang={comment:/\/\*[\s\S]*?\*\/|\/\/.*/,string:{pattern:/"(?:[^\\"]|\\.)*"|'[^']*'/,greedy:!0},keyword:{pattern:/(^|[{};\r\n][ \t]*)[a-z_][\w.-]*/i,lookbehind:!0},namespace:{pattern:/(\s)[a-z_][\w.-]*(?=:)/i,lookbehind:!0},boolean:/\b(?:false|true)\b/,operator:/\+/,punctuation:/[{};:]/}}_g.displayName="zig";_g.aliases=[];function _g(e){(function(t){function n(c){return function(){return c}}var r=/\b(?:align|allowzero|and|anyframe|anytype|asm|async|await|break|cancel|catch|comptime|const|continue|defer|else|enum|errdefer|error|export|extern|fn|for|if|inline|linksection|nakedcc|noalias|nosuspend|null|or|orelse|packed|promise|pub|resume|return|stdcallcc|struct|suspend|switch|test|threadlocal|try|undefined|union|unreachable|usingnamespace|var|volatile|while)\b/,a="\\b(?!"+r.source+")(?!\\d)\\w+\\b",s=/align\s*\((?:[^()]|\([^()]*\))*\)/.source,i=/(?:\?|\bpromise->|(?:\[[^[\]]*\]|\*(?!\*)|\*\*)(?:\s*<ALIGN>|\s*const\b|\s*volatile\b|\s*allowzero\b)*)/.source.replace(/<ALIGN>/g,n(s)),o=/(?:\bpromise\b|(?:\berror\.)?<ID>(?:\.<ID>)*(?!\s+<ID>))/.source.replace(/<ID>/g,n(a)),u="(?!\\s)(?:!?\\s*(?:"+i+"\\s*)*"+o+")+";t.languages.zig={comment:[{pattern:/\/\/[/!].*/,alias:"doc-comment"},/\/{2}.*/],string:[{pattern:/(^|[^\\@])c?"(?:[^"\\\r\n]|\\.)*"/,lookbehind:!0,greedy:!0},{pattern:/([\r\n])([ \t]+c?\\{2}).*(?:(?:\r\n?|\n)\2.*)*/,lookbehind:!0,greedy:!0}],char:{pattern:/(^|[^\\])'(?:[^'\\\r\n]|[\uD800-\uDFFF]{2}|\\(?:.|x[a-fA-F\d]{2}|u\{[a-fA-F\d]{1,6}\}))'/,lookbehind:!0,greedy:!0},builtin:/\B@(?!\d)\w+(?=\s*\()/,label:{pattern:/(\b(?:break|continue)\s*:\s*)\w+\b|\b(?!\d)\w+\b(?=\s*:\s*(?:\{|while\b))/,lookbehind:!0},"class-name":[/\b(?!\d)\w+(?=\s*=\s*(?:(?:extern|packed)\s+)?(?:enum|struct|union)\s*[({])/,{pattern:RegExp(/(:\s*)<TYPE>(?=\s*(?:<ALIGN>\s*)?[=;,)])|<TYPE>(?=\s*(?:<ALIGN>\s*)?\{)/.source.replace(/<TYPE>/g,n(u)).replace(/<ALIGN>/g,n(s))),lookbehind:!0,inside:null},{pattern:RegExp(/(\)\s*)<TYPE>(?=\s*(?:<ALIGN>\s*)?;)/.source.replace(/<TYPE>/g,n(u)).replace(/<ALIGN>/g,n(s))),lookbehind:!0,inside:null}],"builtin-type":{pattern:/\b(?:anyerror|bool|c_u?(?:int|long|longlong|short)|c_longdouble|c_void|comptime_(?:float|int)|f(?:16|32|64|128)|[iu](?:8|16|32|64|128|size)|noreturn|type|void)\b/,alias:"keyword"},keyword:r,function:/\b(?!\d)\w+(?=\s*\()/,number:/\b(?:0b[01]+|0o[0-7]+|0x[a-fA-F\d]+(?:\.[a-fA-F\d]*)?(?:[pP][+-]?[a-fA-F\d]+)?|\d+(?:\.\d*)?(?:[eE][+-]?\d+)?)\b/,boolean:/\b(?:false|true)\b/,operator:/\.[*?]|\.{2,3}|[-=]>|\*\*|\+\+|\|\||(?:<<|>>|[-+*]%|[-+*/%^&|<>!=])=?|[?~]/,punctuation:/[.:,;(){}[\]]/},t.languages.zig["class-name"].forEach(function(c){c.inside===null&&(c.inside=t.languages.zig)})})(e)}_.register(bn);_.register(ta);_.register(pt);_.register($l);_.register(wn);_.register(Hd);_.register(Gd);_.register(Wd);_.register(Vd);_.register(qd);_.register(Yd);_.register(Zd);_.register(Kd);_.register(ps);_.register(Xd);_.register(Qd);_.register(Jd);_.register(ep);_.register(pr);_.register(Sa);_.register(Pl);_.register(tp);_.register(np);_.register(Fi);_.register(Pi);_.register(Wl);_.register(rp);_.register(ap);_.register(va);_.register(sp);_.register(ip);_.register(op);_.register(lp);_.register(up);_.register(cp);_.register(dp);_.register(pp);_.register(Bi);_.register(fp);_.register(mp);_.register(hp);_.register(gp);_.register(bp);_.register(Ep);_.register(xp);_.register(yp);_.register(Tp);_.register(Sp);_.register(vp);_.register(wp);_.register(Ap);_.register(Np);_.register(_p);_.register(Cp);_.register(kp);_.register(Ip);_.register(Rp);_.register(Dp);_.register(Op);_.register(Lp);_.register(Fp);_.register(Mp);_.register(Pp);_.register(Na);_.register(jp);_.register(Bp);_.register(Up);_.register($p);_.register(zp);_.register(Hp);_.register(Gp);_.register(Wp);_.register(Vp);_.register(qp);_.register(jl);_.register(An);_.register(Yp);_.register(Zp);_.register(Kp);_.register(Xp);_.register(Qp);_.register(Jp);_.register(ef);_.register(tf);_.register(nf);_.register(rf);_.register(Mi);_.register(af);_.register(sf);_.register(of);_.register(lf);_.register(uf);_.register(cf);_.register(df);_.register(pf);_.register(ff);_.register(mf);_.register(hf);_.register(gf);_.register(bf);_.register(Ef);_.register(xf);_.register(yf);_.register(Tf);_.register(Sf);_.register(vf);_.register(wf);_.register(Af);_.register(Nf);_.register(Bl);_.register(_f);_.register(Cf);_.register(kf);_.register(If);_.register(Hl);_.register(Xl);_.register(Rf);_.register(Df);_.register(Of);_.register(zi);_.register(Lf);_.register(Ff);_.register(Mf);_.register(Pf);_.register(jf);_.register(Bf);_.register(ds);_.register(Uf);_.register($f);_.register(zf);_.register(Hf);_.register(Gf);_.register(Wf);_.register(Vf);_.register(qf);_.register(Ul);_.register(Yf);_.register(Zf);_.register(wa);_.register(Aa);_.register(gs);_.register(Kf);_.register(Xf);_.register(Qf);_.register(Jf);_.register(em);_.register(tm);_.register(nm);_.register(fs);_.register(rm);_.register(am);_.register(sm);_.register(im);_.register(om);_.register(lm);_.register(um);_.register(cm);_.register(dm);_.register(zl);_.register(pm);_.register(fm);_.register(mm);_.register(hm);_.register(Hi);_.register(gm);_.register(bm);_.register(Em);_.register(xm);_.register(ym);_.register(Tm);_.register(Sm);_.register(vm);_.register(Gl);_.register(tu);_.register(wm);_.register(Am);_.register(Nm);_.register(_m);_.register(Cm);_.register(km);_.register(Im);_.register(Rm);_.register(Dm);_.register(Om);_.register(Lm);_.register(Fm);_.register(Mm);_.register(Pm);_.register(jm);_.register(Bm);_.register(Um);_.register($m);_.register(zm);_.register(Vl);_.register(Hm);_.register(Gm);_.register(Wm);_.register(Vm);_.register(qm);_.register(Ym);_.register(Zm);_.register(Km);_.register(Xm);_.register(Qm);_.register(Jm);_.register(eh);_.register(ql);_.register(th);_.register(nh);_.register(rh);_.register(ah);_.register(sh);_.register(ih);_.register(oh);_.register(lh);_.register(uh);_.register(ch);_.register(dh);_.register(ph);_.register(fh);_.register(mh);_.register(hh);_.register(gh);_.register(bh);_.register(Eh);_.register(ji);_.register(xh);_.register(yh);_.register(Th);_.register(Sh);_.register(Yl);_.register(vh);_.register(wh);_.register(nu);_.register(Ah);_.register(Nh);_.register(_h);_.register(Ch);_.register(kh);_.register(Ih);_.register(Rh);_.register(Dh);_.register(Oh);_.register(Zl);_.register(Lh);_.register(Kl);_.register(Fh);_.register(Mh);_.register(Ph);_.register(jh);_.register(Bh);_.register(Uh);_.register($h);_.register(zh);_.register(ru);_.register(Hh);_.register(Gh);_.register(Wh);_.register(Vh);_.register(qh);_.register(Yh);_.register(Zh);_.register(Kh);_.register(Ql);_.register(Xh);_.register(Gi);_.register(Qh);_.register(Ui);_.register(Jh);_.register(eg);_.register(tg);_.register(ng);_.register(rg);_.register(ag);_.register(sg);_.register(ig);_.register(og);_.register(lg);_.register(ug);_.register(cg);_.register(dg);_.register(pg);_.register(fg);_.register(mg);_.register(hg);_.register(gg);_.register(bg);_.register(Eg);_.register(xg);_.register(yg);_.register(Tg);_.register(Sg);_.register(vg);_.register(wg);_.register(Ag);_.register(Ng);_.register(_g);function Vc(){Vc=function(a,s){return new n(a,void 0,s)};var e=RegExp.prototype,t=new WeakMap;function n(a,s,i){var o=new RegExp(a,s);return t.set(o,i||t.get(a)),Zo(o,n.prototype)}function r(a,s){var i=t.get(s);return Object.keys(i).reduce(function(o,u){var c=i[u];if(typeof c=="number")o[u]=a[c];else{for(var p=0;a[c[p]]===void 0&&p+1<c.length;)p++;o[u]=a[c[p]]}return o},Object.create(null))}return(function(a,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(s&&s.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),Object.defineProperty(a,"prototype",{writable:!1}),s&&Zo(a,s)})(n,RegExp),n.prototype.exec=function(a){var s=e.exec.call(this,a);if(s){s.groups=r(s,this);var i=s.indices;i&&(i.groups=r(i,this))}return s},n.prototype[Symbol.replace]=function(a,s){if(typeof s=="string"){var i=t.get(this);return e[Symbol.replace].call(this,a,s.replace(/\$<([^>]+)>/g,function(u,c){var p=i[c];return"$"+(Array.isArray(p)?p.join("$"):p)}))}if(typeof s=="function"){var o=this;return e[Symbol.replace].call(this,a,function(){var u=arguments;return typeof u[u.length-1]!="object"&&(u=[].slice.call(u)).push(r(u,o)),s.apply(this,u)})}return e[Symbol.replace].call(this,a,s)},Vc.apply(this,arguments)}function Zo(e,t){return Zo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Zo(e,t)}function y0(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ju(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=(function(a,s){if(a){if(typeof a=="string")return y0(a,s);var i=Object.prototype.toString.call(a).slice(8,-1);return i==="Object"&&a.constructor&&(i=a.constructor.name),i==="Map"||i==="Set"?Array.from(a):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?y0(a,s):void 0}})(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
9
9
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var yC=function(e){return function(t){return t===void 0&&(t={}),(function(r,a){if(a&&!r.registered(a))throw new Error('The default language "'+a+'" is not registered with refractor.')})(e,t.defaultLanguage),function(r){$n(r,"element",n)};function n(r,a,s){var i,o;if(s&&s.tagName==="pre"&&r.tagName==="code"){var u=(r==null||(i=r.data)==null?void 0:i.meta)||(r==null||(o=r.properties)==null?void 0:o.metastring)||"";r.properties.className?typeof r.properties.className=="boolean"?r.properties.className=[]:Array.isArray(r.properties.className)||(r.properties.className=[r.properties.className]):r.properties.className=[];var c,p,d=(function(D){for(var N,T=ju(D.properties.className);!(N=T()).done;){var v=N.value;if(v.slice(0,9)==="language-")return v.slice(9).toLowerCase()}return null})(r);if(!d&&t.defaultLanguage&&r.properties.className.push("language-"+(d=t.defaultLanguage)),r.properties.className.push("code-highlight"),d)try{var f,m;m=(f=d)!=null&&f.includes("diff-")?d.split("-")[1]:d,c=e.highlight(Ga(r),m),s.properties.className=(s.properties.className||[]).concat("language-"+m)}catch(D){if(!t.ignoreMissing||!/Unknown language/.test(D.message))throw D;c=r}else c=r;c.children=(p=1,function D(N){return N.reduce(function(T,v){if(v.type==="text"){var R=v.value,C=(R.match(/\n/g)||"").length;if(C===0)v.position={start:{line:p,column:1},end:{line:p,column:1}},T.push(v);else for(var U,k=R.split(`
|
|
10
10
|
`),j=ju(k.entries());!(U=j()).done;){var G=U.value,$=G[0],te=G[1];T.push({type:"text",value:$===k.length-1?te:te+`
|
|
11
|
-
`,position:{start:{line:p+$,column:1},end:{line:p+$,column:1}}})}return p+=C,T}if(Object.prototype.hasOwnProperty.call(v,"children")){var H=p;return v.children=D(v.children),T.push(v),v.position={start:{line:H,column:1},end:{line:p,column:1}},T}return T.push(v),T},[])})(c.children),c.position=c.children.length>0?{start:{line:c.children[0].position.start.line,column:0},end:{line:c.children[c.children.length-1].position.end.line,column:0}}:{start:{line:0,column:0},end:{line:0,column:0}};for(var b,E=(function(D){var N=/{([\d,-]+)}/,T=D.split(",").map(function(C){return C.trim()}).join();if(N.test(T)){var v=N.exec(T)[1],R=$_(v);return function(C){return R.includes(C+1)}}return function(){return!1}})(u),x=(function(D){var N=Vc(/showLineNumbers=(\d+)/i,{lines:1});if(N.test(D)){var T=N.exec(D);return Number(T.groups.lines)}return 1})(u),y=(function(D){for(var N=new Array(D),T=0;T<D;T++)N[T]={type:"element",tagName:"span",properties:{className:[]},children:[]};return N})(c.position.end.line),S=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],w=function(){var D,N,T=b.value,v=T[0],R=T[1];R.properties.className=["code-line"];var C=P_(c,function(U){return U.position.start.line<=v+1&&U.position.end.line>=v+1});R.children=C.children,(u.toLowerCase().includes("showLineNumbers".toLowerCase())||t.showLineNumbers===!0||typeof t.showLineNumbers=="object"&&t.showLineNumbers.includes(d))&&!S.some(function(U){return u.toLowerCase().includes(U)})&&(R.properties.line=[(v+x).toString()],R.properties.className.push("line-number")),E(v)&&R.properties.className.push("highlight-line"),(d==="diff"||(D=d)!=null&&D.includes("diff-"))&&Ga(R).substring(0,1)==="-"?R.properties.className.push("deleted"):(d==="diff"||(N=d)!=null&&N.includes("diff-"))&&Ga(R).substring(0,1)==="+"&&R.properties.className.push("inserted")},A=ju(y.entries());!(b=A()).done;)w();y.length>0&&Ga(y[y.length-1]).trim()===""&&y.pop(),r.children=y}}}},C1=yC(_),jo={},qc={};function TC(e,t){for(var n=t,r=0;r<e.length;r++){var a=r===e.length-1,s=e.charAt(r),i=n[s]||(n[s]={chars:{}});a&&(i.self=e),n=i.chars}}function T0(e){if(e.length===0)return jo;for(var t={},n=0,r=e;n<r.length;n++){var a=r[n];TC(a,t)}return t}function SC(e){if(e.length===0)return qc;for(var t={},n=0,r=e;n<r.length;n++){var a=r[n];t[a]=!0}return t}var co={},S0={type:"String",optional:!0};function vC(e){var t={type:"NoArgument",optional:!1};function n(i){if(t.type&&t.type!==i&&t.type!=="NoArgument")throw new Error('Conflicting pseudo-class argument type: "'.concat(t.type,'" vs "').concat(i,'".'));t.type=i}for(var r=0,a=e;r<a.length;r++){var s=a[r];s==="NoArgument"&&(t.optional=!0),s==="Formula"&&n("Formula"),s==="FormulaOfSelector"&&(n("Formula"),t.ofSelector=!0),s==="String"&&n("String"),s==="Selector"&&n("Selector")}return t}function wC(e){for(var t={},n=0,r=Object.keys(e);n<r.length;n++){var a=r[n],s=e[a];if(s)for(var i=0,o=s;i<o.length;i++){var u=o[i];(t[u]||(t[u]=[])).push(a)}}return t}function v0(e){for(var t=wC(e),n={},r=0,a=Object.keys(t);r<a.length;r++){var s=a[r],i=t[s];i&&(n[s]=vC(i))}return n}var ts=function(){return ts=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},ts.apply(this,arguments)},AC={},Yc={wildcard:!0};function NC(e){return e?typeof e=="boolean"?Yc:e:AC}function _C(e,t){return function(n,r){return t(e(n),e(r))}}function CC(e){return function(t,n){var r=e(t,n);if(!r)throw new Error("Syntax definition cannot be null or undefined.");return r}}function w0(e,t){return function(n,r){return r===!0?e:t(n===!0?e:n,r)}}function La(e){return function(t,n){if(!n||!t)return n;if(typeof n!="object"||n===null)throw new Error("Unexpected syntax definition extension type: ".concat(n,"."));for(var r=ts({},t),a=0,s=Object.entries(n);a<s.length;a++){var i=s[a],o=i[0],u=i[1];if(o!=="latest"){var c=e[o];r[o]=c(t[o],u)}}return r}}function gr(e,t){return t!==void 0?t:e}function po(e,t){return t?e?e.concat(t):t:e}function A0(e,t){if(!t)return e;if(!e)return t;for(var n=ts({},e),r=0,a=Object.entries(t);r<a.length;r++){var s=a[r],i=s[0],o=s[1];if(!o){delete n[i];continue}var u=e[i];if(!u){n[i]=o;continue}n[i]=u.concat(o)}return n}var fa=CC(La({baseSyntax:gr,modules:po,tag:w0(Yc,La({wildcard:gr})),ids:gr,classNames:gr,nestingSelector:gr,namespace:w0(Yc,La({wildcard:gr})),combinators:po,attributes:La({operators:po,caseSensitivityModifiers:po,unknownCaseSensitivityModifiers:gr}),pseudoClasses:La({unknown:gr,definitions:A0}),pseudoElements:La({unknown:gr,notation:gr,definitions:_C(function(e){return Array.isArray(e)?{NoArgument:e}:e},A0)})})),k1={tag:{},ids:!0,classNames:!0,combinators:[],pseudoElements:{unknown:"reject",notation:"singleColon",definitions:["first-letter","first-line"]},pseudoClasses:{unknown:"reject",definitions:{NoArgument:["link","visited","active"]}}},I1=fa(k1,{tag:{wildcard:!0},combinators:[">","+"],attributes:{unknownCaseSensitivityModifiers:"reject",operators:["=","~=","|="]},pseudoElements:{definitions:["before","after"]},pseudoClasses:{unknown:"reject",definitions:{NoArgument:["hover","focus","first-child"],String:["lang"]}}}),Zc=fa(I1,{namespace:{wildcard:!0},combinators:["~"],attributes:{operators:["^=","$=","*="]},pseudoElements:{notation:"both"},pseudoClasses:{definitions:{NoArgument:["root","last-child","first-of-type","last-of-type","only-child","only-of-type","empty","target","enabled","disabled","checked","indeterminate"],Formula:["nth-child","nth-last-child","nth-of-type","nth-last-of-type"],Selector:["not"]}}}),R1=fa(Zc,{combinators:["||"],attributes:{caseSensitivityModifiers:["i","I","s","S"]},pseudoClasses:{definitions:{NoArgument:["any-link","local-link","target-within","scope","current","past","future","focus-within","focus-visible","read-write","read-only","placeholder-shown","default","valid","invalid","in-range","out-of-range","required","optional","blank","user-invalid","playing","paused","autofill","modal","fullscreen","picture-in-picture","defined","loading","popover-open"],Formula:["nth-col","nth-last-col"],String:["dir"],FormulaOfSelector:["nth-child","nth-last-child"],Selector:["current","is","where","has","state"]}},pseudoElements:{definitions:{NoArgument:["marker"]}}}),Ko={"css-position-1":{latest:!1,pseudoClasses:{definitions:{NoArgument:["static","relative","absolute"]}}},"css-position-2":{latest:!1,pseudoClasses:{definitions:{NoArgument:["static","relative","absolute","fixed"]}}},"css-position-3":{latest:!1,pseudoClasses:{definitions:{NoArgument:["sticky","fixed","absolute","relative","static"]}}},"css-position-4":{latest:!0,pseudoClasses:{definitions:{NoArgument:["sticky","fixed","absolute","relative","static","initial"]}}},"css-scoping-1":{latest:!0,pseudoClasses:{definitions:{NoArgument:["host","host-context"],Selector:["host","host-context"]}},pseudoElements:{definitions:{Selector:["slotted"]}}},"css-pseudo-4":{latest:!0,pseudoElements:{definitions:{NoArgument:["marker","selection","target-text","search-text","spelling-error","grammar-error","backdrop","file-selector-button","prefix","postfix","placeholder","details-content"],String:["highlight"]}}},"css-shadow-parts-1":{latest:!0,pseudoElements:{definitions:{String:["part"]}}},"css-nesting-1":{latest:!0,nestingSelector:!0}},D1=ts(ts({},R1),{modules:Object.entries(Ko).filter(function(e){var t=e[1].latest;return t}).map(function(e){var t=e[0];return t})}),kC=fa(D1,{pseudoElements:{unknown:"accept"},pseudoClasses:{unknown:"accept"},attributes:{unknownCaseSensitivityModifiers:"accept"}}),Kc={css1:k1,css2:I1,css3:Zc,"selectors-3":Zc,"selectors-4":R1,latest:D1,progressive:kC};function IC(){for(var e={pseudoClasses:{},pseudoElements:{}},t=["css1","css2","css3","selectors-3","selectors-4"],n=0,r=t;n<r.length;n++){var a=r[n],s=Kc[a];if(s.pseudoClasses&&typeof s.pseudoClasses=="object"){var i=s.pseudoClasses.definitions;if(i)for(var o=0,u=Object.entries(i);o<u.length;o++)for(var c=u[o],p=c[1],d=0,f=p;d<f.length;d++){var m=f[d];e.pseudoClasses[m]||(e.pseudoClasses[m]=[]),e.pseudoClasses[m].includes(a)||e.pseudoClasses[m].push(a)}}if(s.pseudoElements&&typeof s.pseudoElements=="object"){var i=s.pseudoElements.definitions;if(i)if(Array.isArray(i))for(var b=0,E=i;b<E.length;b++){var x=E[b];e.pseudoElements[x]||(e.pseudoElements[x]=[]),e.pseudoElements[x].includes(a)||e.pseudoElements[x].push(a)}else for(var y=0,S=Object.values(i);y<S.length;y++)for(var p=S[y],w=0,A=p;w<A.length;w++){var D=A[w];e.pseudoElements[D]||(e.pseudoElements[D]=[]),e.pseudoElements[D].includes(a)||e.pseudoElements[D].push(a)}}}for(var N=0,T=Object.entries(Ko);N<T.length;N++){var v=T[N],R=v[0],C=v[1];if(C.pseudoClasses&&typeof C.pseudoClasses=="object"){var i=C.pseudoClasses.definitions;if(i)for(var U=0,k=Object.values(i);U<k.length;U++)for(var p=k[U],j=0,G=p;j<G.length;j++){var $=G[j];e.pseudoClasses[$]||(e.pseudoClasses[$]=[]),e.pseudoClasses[$].includes(R)||e.pseudoClasses[$].push(R)}}if(C.pseudoElements&&typeof C.pseudoElements=="object"){var i=C.pseudoElements.definitions;if(i)if(Array.isArray(i))for(var te=0,H=i;te<H.length;te++){var se=H[te];e.pseudoElements[se]||(e.pseudoElements[se]=[]),e.pseudoElements[se].includes(R)||e.pseudoElements[se].push(R)}else for(var de=0,O=Object.values(i);de<O.length;de++)for(var p=O[de],ne=0,pe=p;ne<pe.length;ne++){var L=pe[ne];e.pseudoElements[L]||(e.pseudoElements[L]=[]),e.pseudoElements[L].includes(R)||e.pseudoElements[L].push(R)}}}return e}var N0=IC();function Os(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="-"||e==="_"||e==="\\"||e>=" "}function _0(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||e==="-"||e==="_"||e>=" "}function Ls(e){return e>="a"&&e<="f"||e>="A"&&e<="F"||e>="0"&&e<="9"}var RC={" ":!0," ":!0,"\n":!0,"\r":!0,"\f":!0},DC={'"':!0,"'":!0},Bu={0:!0,1:!0,2:!0,3:!0,4:!0,5:!0,6:!0,7:!0,8:!0,9:!0},OC=6,Uu="css-selector-parser parse error: ";function LC(e){e===void 0&&(e={});var t=e.syntax,n=t===void 0?"latest":t,r=e.substitutes,a=e.strict,s=a===void 0?!0:a,i=e.modules,o=typeof n=="object"?n:Kc[n];if(o.baseSyntax&&(o=fa(Kc[o.baseSyntax],o)),o.modules&&o.modules.length>0)for(var u=0,c=o.modules;u<c.length;u++){var p=c[u],d=Ko[p];d&&(o=fa(d,o))}if(i&&i.length>0)for(var f=0,m=i;f<m.length;f++){var b=m[f],d=Ko[b];d&&(o=fa(d,o))}var E=o.tag?[!0,!!NC(o.tag).wildcard]:[!1,!1],x=E[0],y=E[1],S=!!o.ids,w=!!o.classNames,A=!!o.nestingSelector,D=!!o.namespace,N=o.namespace&&(o.namespace===!0||o.namespace.wildcard===!0);if(D&&!x)throw new Error("".concat(Uu,"Namespaces cannot be enabled while tags are disabled."));var T=!!r,v=o.combinators?T0(o.combinators):jo,R=o.attributes?[!0,o.attributes.operators?T0(o.attributes.operators):jo,o.attributes.caseSensitivityModifiers?SC(o.attributes.caseSensitivityModifiers):qc,o.attributes.unknownCaseSensitivityModifiers==="accept"]:[!1,jo,qc,!1],C=R[0],U=R[1],k=R[2],j=R[3],G=j||Object.keys(k).length>0,$=o.pseudoClasses?[!0,o.pseudoClasses.definitions?v0(o.pseudoClasses.definitions):co,o.pseudoClasses.unknown==="accept"]:[!1,co,!1],te=$[0],H=$[1],se=$[2],de=o.pseudoElements?[!0,o.pseudoElements.notation==="singleColon"||o.pseudoElements.notation==="both",!o.pseudoElements.notation||o.pseudoElements.notation==="doubleColon"||o.pseudoElements.notation==="both",o.pseudoElements.definitions?v0(Array.isArray(o.pseudoElements.definitions)?{NoArgument:o.pseudoElements.definitions}:o.pseudoElements.definitions):co,o.pseudoElements.unknown==="accept"]:[!1,!1,!1,co,!1],O=de[0],ne=de[1],pe=de[2],L=de[3],ke=de[4],Re="",Q=Re.length,_e=0,fe="",X=function(ae){return fe===ae},Ve=function(){return X("*")||Os(fe)},ge=function(ae){_e=ae,fe=Re.charAt(_e)},me=function(){_e++,fe=Re.charAt(_e)},Te=function(){var ae=fe;return _e++,fe=Re.charAt(_e),ae};function ve(ae){var Ne=Math.min(Q-1,_e),ze=new Error("".concat(Uu).concat(ae," Pos: ").concat(Ne,"."));throw ze.position=Ne,ze.name="ParserError",ze}function ie(ae,Ne){if(!ae)return ve(Ne)}var Ze=function(){ie(_e<Q,"Unexpected end of input.")},ot=function(){return _e>=Q},rt=function(ae){ie(_e<Q,'Expected "'.concat(ae,'" but end of input reached.')),ie(fe===ae,'Expected "'.concat(ae,'" but "').concat(fe,'" found.')),_e++,fe=Re.charAt(_e)};function Ht(ae){var Ne=St(ae,_e);if(Ne)return _e+=Ne.length,fe=Re.charAt(_e),Ne}function St(ae,Ne){var ze=Re.charAt(Ne),je=ae[ze];if(je){var vt=St(je.chars,Ne+1);if(vt)return vt;if(je.self)return je.self}}function Ct(){for(var ae=Te(),Ne=1;Ls(fe)&&Ne<OC;)ae+=Te(),Ne++;return Je(),String.fromCharCode(parseInt(ae,16))}function Zt(ae){var Ne="";for(rt(ae);_e<Q;){if(X(ae))return me(),Ne;X("\\")?(me(),X(ae)?(Ne+=ae,me()):fe===`
|
|
11
|
+
`,position:{start:{line:p+$,column:1},end:{line:p+$,column:1}}})}return p+=C,T}if(Object.prototype.hasOwnProperty.call(v,"children")){var H=p;return v.children=D(v.children),T.push(v),v.position={start:{line:H,column:1},end:{line:p,column:1}},T}return T.push(v),T},[])})(c.children),c.position=c.children.length>0?{start:{line:c.children[0].position.start.line,column:0},end:{line:c.children[c.children.length-1].position.end.line,column:0}}:{start:{line:0,column:0},end:{line:0,column:0}};for(var b,E=(function(D){var N=/{([\d,-]+)}/,T=D.split(",").map(function(C){return C.trim()}).join();if(N.test(T)){var v=N.exec(T)[1],R=$_(v);return function(C){return R.includes(C+1)}}return function(){return!1}})(u),x=(function(D){var N=Vc(/showLineNumbers=(\d+)/i,{lines:1});if(N.test(D)){var T=N.exec(D);return Number(T.groups.lines)}return 1})(u),y=(function(D){for(var N=new Array(D),T=0;T<D;T++)N[T]={type:"element",tagName:"span",properties:{className:[]},children:[]};return N})(c.position.end.line),S=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],w=function(){var D,N,T=b.value,v=T[0],R=T[1];R.properties.className=["code-line"];var C=P_(c,function(U){return U.position.start.line<=v+1&&U.position.end.line>=v+1});R.children=C.children,(u.toLowerCase().includes("showLineNumbers".toLowerCase())||t.showLineNumbers===!0||typeof t.showLineNumbers=="object"&&t.showLineNumbers.includes(d))&&!S.some(function(U){return u.toLowerCase().includes(U)})&&(R.properties.line=[(v+x).toString()],R.properties.className.push("line-number")),E(v)&&R.properties.className.push("highlight-line"),(d==="diff"||(D=d)!=null&&D.includes("diff-"))&&Ga(R).substring(0,1)==="-"?R.properties.className.push("deleted"):(d==="diff"||(N=d)!=null&&N.includes("diff-"))&&Ga(R).substring(0,1)==="+"&&R.properties.className.push("inserted")},A=ju(y.entries());!(b=A()).done;)w();y.length>0&&Ga(y[y.length-1]).trim()===""&&y.pop(),r.children=y}}}},C1=yC(_),jo={},qc={};function TC(e,t){for(var n=t,r=0;r<e.length;r++){var a=r===e.length-1,s=e.charAt(r),i=n[s]||(n[s]={chars:{}});a&&(i.self=e),n=i.chars}}function T0(e){if(e.length===0)return jo;for(var t={},n=0,r=e;n<r.length;n++){var a=r[n];TC(a,t)}return t}function SC(e){if(e.length===0)return qc;for(var t={},n=0,r=e;n<r.length;n++){var a=r[n];t[a]=!0}return t}var co={},S0={type:"String",optional:!0};function vC(e){var t={type:"NoArgument",optional:!1};function n(i){if(t.type&&t.type!==i&&t.type!=="NoArgument")throw new Error('Conflicting pseudo-class argument type: "'.concat(t.type,'" vs "').concat(i,'".'));t.type=i}for(var r=0,a=e;r<a.length;r++){var s=a[r];s==="NoArgument"&&(t.optional=!0),s==="Formula"&&n("Formula"),s==="FormulaOfSelector"&&(n("Formula"),t.ofSelector=!0),s==="String"&&n("String"),s==="Selector"&&n("Selector")}return t}function wC(e){for(var t={},n=0,r=Object.keys(e);n<r.length;n++){var a=r[n],s=e[a];if(s)for(var i=0,o=s;i<o.length;i++){var u=o[i];(t[u]||(t[u]=[])).push(a)}}return t}function v0(e){for(var t=wC(e),n={},r=0,a=Object.keys(t);r<a.length;r++){var s=a[r],i=t[s];i&&(n[s]=vC(i))}return n}var ts=function(){return ts=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},ts.apply(this,arguments)},AC={},Yc={wildcard:!0};function NC(e){return e?typeof e=="boolean"?Yc:e:AC}function _C(e,t){return function(n,r){return t(e(n),e(r))}}function CC(e){return function(t,n){var r=e(t,n);if(!r)throw new Error("Syntax definition cannot be null or undefined.");return r}}function w0(e,t){return function(n,r){return r===!0?e:t(n===!0?e:n,r)}}function La(e){return function(t,n){if(!n||!t)return n;if(typeof n!="object"||n===null)throw new Error("Unexpected syntax definition extension type: ".concat(n,"."));for(var r=ts({},t),a=0,s=Object.entries(n);a<s.length;a++){var i=s[a],o=i[0],u=i[1];if(o!=="latest"){var c=e[o];r[o]=c(t[o],u)}}return r}}function gr(e,t){return t!==void 0?t:e}function po(e,t){return t?e?e.concat(t):t:e}function A0(e,t){if(!t)return e;if(!e)return t;for(var n=ts({},e),r=0,a=Object.entries(t);r<a.length;r++){var s=a[r],i=s[0],o=s[1];if(!o){delete n[i];continue}var u=e[i];if(!u){n[i]=o;continue}n[i]=u.concat(o)}return n}var fa=CC(La({baseSyntax:gr,modules:po,tag:w0(Yc,La({wildcard:gr})),ids:gr,classNames:gr,nestingSelector:gr,namespace:w0(Yc,La({wildcard:gr})),combinators:po,attributes:La({operators:po,caseSensitivityModifiers:po,unknownCaseSensitivityModifiers:gr}),pseudoClasses:La({unknown:gr,definitions:A0}),pseudoElements:La({unknown:gr,notation:gr,definitions:_C(function(e){return Array.isArray(e)?{NoArgument:e}:e},A0)})})),k1={tag:{},ids:!0,classNames:!0,combinators:[],pseudoElements:{unknown:"reject",notation:"singleColon",definitions:["first-letter","first-line"]},pseudoClasses:{unknown:"reject",definitions:{NoArgument:["link","visited","active"]}}},I1=fa(k1,{tag:{wildcard:!0},combinators:[">","+"],attributes:{unknownCaseSensitivityModifiers:"reject",operators:["=","~=","|="]},pseudoElements:{definitions:["before","after"]},pseudoClasses:{unknown:"reject",definitions:{NoArgument:["hover","focus","first-child"],String:["lang"]}}}),Zc=fa(I1,{namespace:{wildcard:!0},combinators:["~"],attributes:{operators:["^=","$=","*="]},pseudoElements:{notation:"both"},pseudoClasses:{definitions:{NoArgument:["root","last-child","first-of-type","last-of-type","only-child","only-of-type","empty","target","enabled","disabled","checked","indeterminate"],Formula:["nth-child","nth-last-child","nth-of-type","nth-last-of-type"],Selector:["not"]}}}),R1=fa(Zc,{combinators:["||"],attributes:{caseSensitivityModifiers:["i","I","s","S"]},pseudoClasses:{definitions:{NoArgument:["any-link","local-link","target-within","scope","current","past","future","focus-within","focus-visible","read-write","read-only","placeholder-shown","default","valid","invalid","in-range","out-of-range","required","optional","blank","user-invalid","playing","paused","autofill","modal","fullscreen","picture-in-picture","defined","loading","popover-open"],Formula:["nth-col","nth-last-col"],String:["dir"],FormulaOfSelector:["nth-child","nth-last-child"],Selector:["current","is","where","has","state"]}},pseudoElements:{definitions:{NoArgument:["marker"]}}}),Ko={"css-position-1":{latest:!1,pseudoClasses:{definitions:{NoArgument:["static","relative","absolute"]}}},"css-position-2":{latest:!1,pseudoClasses:{definitions:{NoArgument:["static","relative","absolute","fixed"]}}},"css-position-3":{latest:!1,pseudoClasses:{definitions:{NoArgument:["sticky","fixed","absolute","relative","static"]}}},"css-position-4":{latest:!0,pseudoClasses:{definitions:{NoArgument:["sticky","fixed","absolute","relative","static","initial"]}}},"css-scoping-1":{latest:!0,pseudoClasses:{definitions:{NoArgument:["host","host-context"],Selector:["host","host-context"]}},pseudoElements:{definitions:{Selector:["slotted"]}}},"css-pseudo-4":{latest:!0,pseudoElements:{definitions:{NoArgument:["marker","selection","target-text","search-text","spelling-error","grammar-error","backdrop","file-selector-button","prefix","postfix","placeholder","details-content"],String:["highlight"]}}},"css-shadow-parts-1":{latest:!0,pseudoElements:{definitions:{String:["part"]}}},"css-nesting-1":{latest:!0,nestingSelector:!0}},D1=ts(ts({},R1),{modules:Object.entries(Ko).filter(function(e){var t=e[1].latest;return t}).map(function(e){var t=e[0];return t})}),kC=fa(D1,{pseudoElements:{unknown:"accept"},pseudoClasses:{unknown:"accept"},attributes:{unknownCaseSensitivityModifiers:"accept"}}),Kc={css1:k1,css2:I1,css3:Zc,"selectors-3":Zc,"selectors-4":R1,latest:D1,progressive:kC};function IC(){for(var e={pseudoClasses:{},pseudoElements:{}},t=["css1","css2","css3","selectors-3","selectors-4"],n=0,r=t;n<r.length;n++){var a=r[n],s=Kc[a];if(s.pseudoClasses&&typeof s.pseudoClasses=="object"){var i=s.pseudoClasses.definitions;if(i)for(var o=0,u=Object.entries(i);o<u.length;o++)for(var c=u[o],p=c[1],d=0,f=p;d<f.length;d++){var m=f[d];e.pseudoClasses[m]||(e.pseudoClasses[m]=[]),e.pseudoClasses[m].includes(a)||e.pseudoClasses[m].push(a)}}if(s.pseudoElements&&typeof s.pseudoElements=="object"){var i=s.pseudoElements.definitions;if(i)if(Array.isArray(i))for(var b=0,E=i;b<E.length;b++){var x=E[b];e.pseudoElements[x]||(e.pseudoElements[x]=[]),e.pseudoElements[x].includes(a)||e.pseudoElements[x].push(a)}else for(var y=0,S=Object.values(i);y<S.length;y++)for(var p=S[y],w=0,A=p;w<A.length;w++){var D=A[w];e.pseudoElements[D]||(e.pseudoElements[D]=[]),e.pseudoElements[D].includes(a)||e.pseudoElements[D].push(a)}}}for(var N=0,T=Object.entries(Ko);N<T.length;N++){var v=T[N],R=v[0],C=v[1];if(C.pseudoClasses&&typeof C.pseudoClasses=="object"){var i=C.pseudoClasses.definitions;if(i)for(var U=0,k=Object.values(i);U<k.length;U++)for(var p=k[U],j=0,G=p;j<G.length;j++){var $=G[j];e.pseudoClasses[$]||(e.pseudoClasses[$]=[]),e.pseudoClasses[$].includes(R)||e.pseudoClasses[$].push(R)}}if(C.pseudoElements&&typeof C.pseudoElements=="object"){var i=C.pseudoElements.definitions;if(i)if(Array.isArray(i))for(var te=0,H=i;te<H.length;te++){var se=H[te];e.pseudoElements[se]||(e.pseudoElements[se]=[]),e.pseudoElements[se].includes(R)||e.pseudoElements[se].push(R)}else for(var de=0,O=Object.values(i);de<O.length;de++)for(var p=O[de],ne=0,pe=p;ne<pe.length;ne++){var L=pe[ne];e.pseudoElements[L]||(e.pseudoElements[L]=[]),e.pseudoElements[L].includes(R)||e.pseudoElements[L].push(R)}}}return e}var N0=IC();function Os(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="-"||e==="_"||e==="\\"||e>=" "}function _0(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||e==="-"||e==="_"||e>=" "}function Ls(e){return e>="a"&&e<="f"||e>="A"&&e<="F"||e>="0"&&e<="9"}var RC={" ":!0," ":!0,"\n":!0,"\r":!0,"\f":!0},DC={'"':!0,"'":!0},Bu={0:!0,1:!0,2:!0,3:!0,4:!0,5:!0,6:!0,7:!0,8:!0,9:!0},OC=6,Uu="css-selector-parser parse error: ";function LC(e){e===void 0&&(e={});var t=e.syntax,n=t===void 0?"latest":t,r=e.substitutes,a=e.strict,s=a===void 0?!0:a,i=e.modules,o=typeof n=="object"?n:Kc[n];if(o.baseSyntax&&(o=fa(Kc[o.baseSyntax],o)),o.modules&&o.modules.length>0)for(var u=0,c=o.modules;u<c.length;u++){var p=c[u],d=Ko[p];d&&(o=fa(d,o))}if(i&&i.length>0)for(var f=0,m=i;f<m.length;f++){var b=m[f],d=Ko[b];d&&(o=fa(d,o))}var E=o.tag?[!0,!!NC(o.tag).wildcard]:[!1,!1],x=E[0],y=E[1],S=!!o.ids,w=!!o.classNames,A=!!o.nestingSelector,D=!!o.namespace,N=o.namespace&&(o.namespace===!0||o.namespace.wildcard===!0);if(D&&!x)throw new Error("".concat(Uu,"Namespaces cannot be enabled while tags are disabled."));var T=!!r,v=o.combinators?T0(o.combinators):jo,R=o.attributes?[!0,o.attributes.operators?T0(o.attributes.operators):jo,o.attributes.caseSensitivityModifiers?SC(o.attributes.caseSensitivityModifiers):qc,o.attributes.unknownCaseSensitivityModifiers==="accept"]:[!1,jo,qc,!1],C=R[0],U=R[1],k=R[2],j=R[3],G=j||Object.keys(k).length>0,$=o.pseudoClasses?[!0,o.pseudoClasses.definitions?v0(o.pseudoClasses.definitions):co,o.pseudoClasses.unknown==="accept"]:[!1,co,!1],te=$[0],H=$[1],se=$[2],de=o.pseudoElements?[!0,o.pseudoElements.notation==="singleColon"||o.pseudoElements.notation==="both",!o.pseudoElements.notation||o.pseudoElements.notation==="doubleColon"||o.pseudoElements.notation==="both",o.pseudoElements.definitions?v0(Array.isArray(o.pseudoElements.definitions)?{NoArgument:o.pseudoElements.definitions}:o.pseudoElements.definitions):co,o.pseudoElements.unknown==="accept"]:[!1,!1,!1,co,!1],O=de[0],ne=de[1],pe=de[2],L=de[3],ke=de[4],Re="",Q=Re.length,_e=0,fe="",X=function(ae){return fe===ae},Ve=function(){return X("*")||Os(fe)},ge=function(ae){_e=ae,fe=Re.charAt(_e)},me=function(){_e++,fe=Re.charAt(_e)},Te=function(){var ae=fe;return _e++,fe=Re.charAt(_e),ae};function ve(ae){var Ne=Math.min(Q-1,_e),ze=new Error("".concat(Uu).concat(ae," Pos: ").concat(Ne,"."));throw ze.position=Ne,ze.name="ParserError",ze}function ie(ae,Ne){if(!ae)return ve(Ne)}var Ze=function(){ie(_e<Q,"Unexpected end of input.")},ot=function(){return _e>=Q},rt=function(ae){ie(_e<Q,'Expected "'.concat(ae,'" but end of input reached.')),ie(fe===ae,'Expected "'.concat(ae,'" but "').concat(fe,'" found.')),_e++,fe=Re.charAt(_e)};function Ht(ae){var Ne=St(ae,_e);if(Ne)return _e+=Ne.length,fe=Re.charAt(_e),Ne}function St(ae,Ne){var ze=Re.charAt(Ne),je=ae[ze];if(je){var vt=St(je.chars,Ne+1);if(vt)return vt;if(je.self)return je.self}}function Ct(){for(var ae=Te(),Ne=1;Ls(fe)&&Ne<OC;)ae+=Te(),Ne++;return et(),String.fromCharCode(parseInt(ae,16))}function Zt(ae){var Ne="";for(rt(ae);_e<Q;){if(X(ae))return me(),Ne;X("\\")?(me(),X(ae)?(Ne+=ae,me()):fe===`
|
|
12
12
|
`||fe==="\f"?me():fe==="\r"?(me(),X(`
|
|
13
|
-
`)&&me()):Ls(fe)?Ne+=Ct():(Ne+=fe,me())):(Ne+=fe,me())}return Ne}function at(){if(!Os(fe))return null;for(var ae="";X("-");)ae+=fe,me();for(ae==="-"&&!_0(fe)&&!X("\\")&&ve("Identifiers cannot consist of a single hyphen."),s&&ae.length>=2&&ve("Identifiers cannot start with two hyphens with strict mode on."),Bu[fe]&&ve("Identifiers cannot start with hyphens followed by digits.");_e<Q;)if(_0(fe))ae+=Te();else if(X("\\"))me(),Ze(),Ls(fe)?ae+=Ct():ae+=Te();else break;return ae}function De(){for(var ae="";_e<Q&&!X(")");)if(X("\\")){if(me(),ot()&&!s)return(ae+"\\").trim();Ze(),Ls(fe)?ae+=Ct():ae+=Te()}else ae+=Te();return ae.trim()}function
|
|
13
|
+
`)&&me()):Ls(fe)?Ne+=Ct():(Ne+=fe,me())):(Ne+=fe,me())}return Ne}function at(){if(!Os(fe))return null;for(var ae="";X("-");)ae+=fe,me();for(ae==="-"&&!_0(fe)&&!X("\\")&&ve("Identifiers cannot consist of a single hyphen."),s&&ae.length>=2&&ve("Identifiers cannot start with two hyphens with strict mode on."),Bu[fe]&&ve("Identifiers cannot start with hyphens followed by digits.");_e<Q;)if(_0(fe))ae+=Te();else if(X("\\"))me(),Ze(),Ls(fe)?ae+=Ct():ae+=Te();else break;return ae}function De(){for(var ae="";_e<Q&&!X(")");)if(X("\\")){if(me(),ot()&&!s)return(ae+"\\").trim();Ze(),Ls(fe)?ae+=Ct():ae+=Te()}else ae+=Te();return ae.trim()}function et(){if(fe===" "||fe===" "||fe==="\f"||fe===`
|
|
14
14
|
`){me();return}fe==="\r"&&me(),fe===`
|
|
15
15
|
`&&me()}function Z(){for(;RC[fe];)me()}function oe(ae){ae===void 0&&(ae=!1),Z();for(var Ne=[jt(ae)];X(",");)me(),Z(),Ne.push(jt(ae));return{type:"Selector",rules:Ne}}function J(){rt("["),Z();var ae;if(X("|")){ie(D,"Namespaces are not enabled."),me();var Ne=at();ie(Ne,"Expected attribute name."),ae={type:"Attribute",name:Ne,namespace:{type:"NoNamespace"}}}else if(X("*")){ie(D,"Namespaces are not enabled."),ie(N,"Wildcard namespace is not enabled."),me(),rt("|");var ze=at();ie(ze,"Expected attribute name."),ae={type:"Attribute",name:ze,namespace:{type:"WildcardNamespace"}}}else{var je=at();if(ie(je,"Expected attribute name."),ae={type:"Attribute",name:je},X("|")){var vt=_e;if(me(),Os(fe)){ie(D,"Namespaces are not enabled.");var Qt=at();ie(Qt,"Expected attribute name."),ae={type:"Attribute",name:Qt,namespace:{type:"NamespaceName",name:je}}}else ge(vt)}}if(ie(ae.name,"Expected attribute name."),Z(),ot()&&!s)return ae;if(X("]"))me();else{if(ae.operator=Ht(U),ie(ae.operator,"Expected a valid attribute selector operator."),Z(),Ze(),DC[fe])ae.value={type:"String",value:Zt(fe)};else if(T&&X("$")){me();var Le=at();ie(Le,"Expected substitute name."),ae.value={type:"Substitution",name:Le}}else{var ft=at();ie(ft,"Expected attribute value."),ae.value={type:"String",value:ft}}if(Z(),ot()&&!s)return ae;if(!X("]")){var Ke=at();if(ie(Ke,"Expected end of attribute selector."),ae.caseSensitivityModifier=Ke,ie(G,"Attribute case sensitivity modifiers are not enabled."),ie(j||k[ae.caseSensitivityModifier],"Unknown attribute case sensitivity modifier."),Z(),ot()&&!s)return ae}rt("]")}return ae}function ue(){for(var ae="";Bu[fe];)ae+=Te();return ie(ae!=="","Formula parse error."),parseInt(ae)}var Pe=function(){return X("-")||X("+")||Bu[fe]};function qe(){if(X("e")||X("o")){var ae=at();if(ae==="even")return Z(),[2,0];if(ae==="odd")return Z(),[2,1]}var Ne=null,ze=1;if(X("-")&&(me(),ze=-1),Pe()&&(X("+")&&me(),Ne=ue(),!X("\\")&&!X("n")))return[0,Ne*ze];Ne===null&&(Ne=1),Ne*=ze;var je;if(X("\\")?(me(),Ls(fe)?je=Ct():je=Te()):je=Te(),ie(je==="n",'Formula parse error: expected "n".'),Z(),X("+")||X("-")){var vt=X("+")?1:-1;return me(),Z(),[Ne,vt*ue()]}else return[Ne,0]}function ht(ae,Ne,ze){var je;if(X("(")){if(me(),Z(),T&&X("$")){me();var vt=at();ie(vt,"Expected substitute name."),je={type:"Substitution",name:vt}}else if(ze.type==="String")je={type:"String",value:De()},ie(je.value,"Expected ".concat(Ne," argument value."));else if(ze.type==="Selector")je=oe(!0);else if(ze.type==="Formula"){var Qt=qe(),Le=Qt[0],ft=Qt[1];if(je={type:"Formula",a:Le,b:ft},ze.ofSelector&&(Z(),X("o")||X("\\"))){var Ke=at();ie(Ke==="of","Formula of selector parse error."),Z(),je={type:"FormulaOfSelector",a:Le,b:ft,selector:jt()}}}else return ve("Invalid ".concat(Ne," signature."));if(Z(),ot()&&!s)return je;rt(")")}else ie(ze.optional,"Argument is required for ".concat(Ne,' "').concat(ae,'".'));return je}function Rt(){if(X("*"))return ie(y,"Wildcard tag name is not enabled."),me(),{type:"WildcardTag"};if(Os(fe)){ie(x,"Tag names are not enabled.");var ae=at();return ie(ae,"Expected tag name."),{type:"TagName",name:ae}}else return ve("Expected tag name.")}function kt(){if(X("*")){var ae=_e;if(me(),!X("|")||(me(),!Ve()))return ge(ae),Rt();ie(D,"Namespaces are not enabled."),ie(N,"Wildcard namespace is not enabled.");var Ne=Rt();return Ne.namespace={type:"WildcardNamespace"},Ne}else if(X("|")){ie(D,"Namespaces are not enabled."),me();var Ne=Rt();return Ne.namespace={type:"NoNamespace"},Ne}else if(Os(fe)){var ze=at();if(ie(ze,"Expected tag name."),!X("|"))return ie(x,"Tag names are not enabled."),{type:"TagName",name:ze};var ae=_e;if(me(),!Ve())return ge(ae),{type:"TagName",name:ze};ie(D,"Namespaces are not enabled.");var Ne=Rt();return Ne.namespace={type:"NamespaceName",name:ze},Ne}else return ve("Expected tag name.")}function jt(ae){var Ne,ze;ae===void 0&&(ae=!1);var je={type:"Rule",items:[]};if(ae){var vt=Ht(v);vt&&(je.combinator=vt,Z())}for(;_e<Q;)if(Ve())ie(je.items.length===0,"Unexpected tag/namespace start."),je.items.push(kt());else if(X("|")){var Qt=_e;if(me(),Ve())ie(je.items.length===0,"Unexpected tag/namespace start."),ge(Qt),je.items.push(kt());else{ge(Qt);break}}else if(X(".")){ie(w,"Class names are not enabled."),me();var Le=at();ie(Le,"Expected class name."),je.items.push({type:"ClassName",name:Le})}else if(X("#")){ie(S,"IDs are not enabled."),me();var ft=at();ie(ft,"Expected ID name."),je.items.push({type:"Id",name:ft})}else if(X("&"))ie(A,"Nesting selector is not enabled."),me(),je.items.push({type:"NestingSelector"});else if(X("["))ie(C,"Attributes are not enabled."),je.items.push(J());else if(X(":")){var Ke=!1,Dt=!1;me(),X(":")&&(ie(O,"Pseudo elements are not enabled."),ie(pe,"Pseudo elements double colon notation is not enabled."),Ke=!0,me());var nt=at();if(ie(Ke||nt,"Expected pseudo-class name."),ie(!Ke||nt,"Expected pseudo-element name."),ie(nt,"Expected pseudo-class name."),!(!Ke||ke||Object.prototype.hasOwnProperty.call(L,nt))){var Qe=N0.pseudoElements[nt],wt='Unknown pseudo-element "'.concat(nt,'"');Qe&&Qe.length>0&&(wt+=". It is defined in: ".concat(Qe.join(", "))),ve(wt+".")}if(Dt=O&&(Ke||!Ke&&ne&&Object.prototype.hasOwnProperty.call(L,nt)),Dt){var Kt=(Ne=L[nt])!==null&&Ne!==void 0?Ne:ke&&S0,W={type:"PseudoElement",name:nt},Be=ht(nt,"pseudo-element",Kt);Be&&(ie(Be.type!=="Formula"&&Be.type!=="FormulaOfSelector","Pseudo-elements cannot have formula argument."),W.argument=Be),je.items.push(W)}else{ie(te,"Pseudo-classes are not enabled.");var Kt=(ze=H[nt])!==null&&ze!==void 0?ze:se&&S0;if(!Kt){var Qe=N0.pseudoClasses[nt],wt='Unknown pseudo-class: "'.concat(nt,'"');Qe&&Qe.length>0&&(wt+=". It is defined in: ".concat(Qe.join(", "))),ve(wt+".")}var Be=ht(nt,"pseudo-class",Kt),M={type:"PseudoClass",name:nt};Be&&(M.argument=Be),je.items.push(M)}}else break;if(je.items.length===0)return ot()?ve("Expected rule but end of input reached."):ve('Expected rule but "'.concat(fe,'" found.'));if(Z(),!ot()&&!X(",")&&!X(")")){var vt=Ht(v);Z(),je.nestedRule=jt(),je.nestedRule.combinator=vt}return je}return function(ae){if(typeof ae!="string")throw new Error("".concat(Uu,"Expected string input."));return Re=ae,Q=Re.length,_e=0,fe=Re.charAt(0),oe()}}const FC=LC({syntax:"selectors-4"});function MC(e){if(typeof e!="string")throw new TypeError("Expected `string` as selector, not `"+e+"`");return FC(e)}const O1="֑-߿יִ-﷽ﹰ-ﻼ",L1="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",PC=new RegExp("^[^"+L1+"]*["+O1+"]"),jC=new RegExp("^[^"+O1+"]*["+L1+"]");function BC(e){const t=String(e||"");return PC.test(t)?"rtl":jC.test(t)?"ltr":"neutral"}function UC(e,t){const n=e.schema,r=e.language,a=e.direction,s=e.editableOrEditingHost;let i;if(t.type==="element"){const c=t.properties.xmlLang||t.properties.lang,p=t.properties.type||"text",d=C0(t);c!=null&&(e.language=String(c)),n&&n.space==="html"?(t.properties.contentEditable==="true"&&(e.editableOrEditingHost=!0),t.tagName==="svg"&&(e.schema=fr),d==="rtl"?i=d:d==="ltr"||d!=="auto"&&t.tagName==="html"||d!=="auto"&&t.tagName==="input"&&p==="tel"?i="ltr":(d==="auto"||t.tagName==="bdi")&&(t.tagName==="textarea"?i=$u(Ga(t)):t.tagName==="input"&&(p==="email"||p==="search"||p==="tel"||p==="text")?i=t.properties.value?$u(String(t.properties.value)):"ltr":$n(t,u)),i&&(e.direction=i)):e.editableOrEditingHost&&(e.editableOrEditingHost=!1)}return o;function o(){e.schema=n,e.language=r,e.direction=a,e.editableOrEditingHost=s}function u(c){if(c.type==="text")return i=$u(c.value),i?Yo:void 0;if(c!==t&&c.type==="element"&&(c.tagName==="bdi"||c.tagName==="script"||c.tagName==="style"||c.tagName==="textare"||C0(c)))return Xs}}function $u(e){const t=BC(e);return t==="neutral"?void 0:t}function C0(e){const t=e.type==="element"&&typeof e.properties.dir=="string"?e.properties.dir.toLowerCase():void 0;return t==="auto"||t==="ltr"||t==="rtl"?t:void 0}function $C(e,t,n){const r=hs(n,e.name),a=t.properties[r.property];let s=zC(a,r);if(!e.value)return s!==void 0;e.value.type;let i=e.value.value;if(e.caseSensitivityModifier==="i"&&(i=i.toLowerCase(),s&&(s=s.toLowerCase())),s!==void 0)switch(e.operator){case"=":return i===s;case"$=":return i===s.slice(-i.length);case"*=":return s.includes(i);case"^=":return i===s.slice(0,i.length);case"|=":return i===s||i===s.slice(0,i.length)&&s.charAt(i.length)==="-";case"~=":return i===s||Hc(s).includes(i)}return!1}function zC(e,t){if(e!=null)if(typeof e=="boolean"){if(e)return t.attribute}else if(Array.isArray(e)){if(e.length>0)return(t.commaSeparated?Jl:eu)(e)}else return String(e)}const HC=[];function GC(e,t){return(t.properties.className||HC).includes(e.name)}function WC(e,t){return t.properties.id===e.name}function VC(e,t){return e.name===t.tagName}function qC(e,t){return function(n,r){let a=k0(n,"tag");const s=k0(r??"*","range"),i=[];let o=-1;for(;++o<s.length;){const u=s[o].toLowerCase();if(!t&&u==="*")continue;let c=-1;const p=[];for(;++c<a.length;)if(e(a[c].toLowerCase(),u)){if(!t)return a[c];i.push(a[c])}else p.push(a[c]);a=p}return t?i:void 0}}const YC=qC(function(e,t){const n=e.split("-"),r=t.split("-");let a=0,s=0;if(r[s]!=="*"&&n[a]!==r[s])return!1;for(a++,s++;s<r.length;){if(r[s]==="*"){s++;continue}if(!n[a])return!1;if(n[a]===r[s]){a++,s++;continue}if(n[a].length===1)return!1;a++}return!0},!0);function k0(e,t){const n=e&&typeof e=="string"?[e]:e;if(!n||typeof n!="object"||!("length"in n))throw new Error("Invalid "+t+" `"+n+"`, expected non-empty string");return n}const ZC={}.hasOwnProperty;function ha(e,t){const n=e.type==="element"&&ZC.call(e.properties,t)&&e.properties[t];return n!=null&&n!==!1}const KC=/[ \t\n\f\r]/g;function Wi(e){return typeof e=="object"?e.type==="text"?I0(e.value):!1:I0(e)}function I0(e){return e.replace(KC,"")===""}const XC=new Set([9,10,12,13,32]),R0=48,QC=57;function JC(e){if(e=e.trim().toLowerCase(),e==="even")return[2,0];if(e==="odd")return[2,1];let t=0,n=0,r=s(),a=i();if(t<e.length&&e.charAt(t)==="n"&&(t++,n=r*(a??1),o(),t<e.length?(r=s(),o(),a=i()):r=a=0),a===null||t<e.length)throw new Error(`n-th rule couldn't be parsed ('${e}')`);return[n,r*a];function s(){return e.charAt(t)==="-"?(t++,-1):(e.charAt(t)==="+"&&t++,1)}function i(){const u=t;let c=0;for(;t<e.length&&e.charCodeAt(t)>=R0&&e.charCodeAt(t)<=QC;)c=c*10+(e.charCodeAt(t)-R0),t++;return t===u?null:c}function o(){for(;t<e.length&&XC.has(e.charCodeAt(t));)t++}}var zu,D0;function ek(){return D0||(D0=1,zu={trueFunc:function(){return!0},falseFunc:function(){return!1}}),zu}var tk=ek();const O0=kl(tk);function nk(e){const t=e[0],n=e[1]-1;if(n<0&&t<=0)return O0.falseFunc;if(t===-1)return s=>s<=n;if(t===0)return s=>s===n;if(t===1)return n<0?O0.trueFunc:s=>s>=n;const r=Math.abs(t),a=(n%r+r)%r;return t>1?s=>s>=n&&s%r===a:s=>s<=n&&s%r===a}function L0(e){return nk(JC(e))}const F0={}.hasOwnProperty;function au(e,t){const n=t||{};function r(a,...s){let i=r.invalid;const o=r.handlers;if(a&&F0.call(a,e)){const u=String(a[e]);i=F0.call(o,u)?o[u]:r.unknown}if(i)return i.call(this,a,...s)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const rk=L0.default||L0,ak=au("name",{handlers:{"any-link":sk,blank:ik,checked:ok,dir:lk,disabled:F1,empty:uk,enabled:ck,"first-child":dk,"first-of-type":pk,has:fk,is:M1,lang:hk,"last-child":gk,"last-of-type":bk,not:Ek,"nth-child":xk,"nth-last-child":yk,"nth-last-of-type":Tk,"nth-of-type":Sk,"only-child":vk,"only-of-type":wk,optional:Ak,"read-only":Nk,"read-write":P1,required:j1,root:_k,scope:Ck},invalid:mk,unknown:kk});function sk(e,t){return(t.tagName==="a"||t.tagName==="area"||t.tagName==="link")&&ha(t,"href")}function wr(e,t){if(e.shallow)throw new Error("Cannot use `:"+t.name+"` without parent")}function ik(e,t){return!B1(t,n);function n(r){return r.type==="element"||r.type==="text"&&!Wi(r)}}function ok(e,t){return t.tagName==="input"||t.tagName==="menuitem"?!!((t.properties.type==="checkbox"||t.properties.type==="radio")&&ha(t,"checked")):t.tagName==="option"?ha(t,"selected"):!1}function lk(e,t,n,r,a){return e.argument,e.argument.type,a.direction===e.argument.value}function F1(e,t){return(t.tagName==="button"||t.tagName==="input"||t.tagName==="select"||t.tagName==="textarea"||t.tagName==="optgroup"||t.tagName==="option"||t.tagName==="menuitem"||t.tagName==="fieldset")&&ha(t,"disabled")}function uk(e,t){return!B1(t,n);function n(r){return r.type==="element"||r.type==="text"}}function ck(e,t){return!F1(e,t)}function dk(e,t,n,r,a){return wr(a,e),a.elementIndex===0}function pk(e,t,n,r,a){return wr(a,e),a.typeIndex===0}function su(e){let t=e._cachedFn;if(!t){const n=e.argument;if(n.type!=="Formula")throw new Error("Expected `nth` formula, such as `even` or `2n+1` (`of` is not yet supported)");t=rk(n.a+"n+"+n.b),e._cachedFn=t}return t}function fk(e,t,n,r,a){e.argument,e.argument.type;const s={...a,found:!1,one:!0,results:[],rootQuery:e.argument,scopeElements:[t],shallow:!1};return Cg(s,{type:"root",children:t.children}),s.results.length>0}function mk(){}function M1(e,t,n,r,a){e.argument,e.argument.type;const s={...a,found:!1,one:!0,results:[],rootQuery:e.argument,scopeElements:[t],shallow:!1};return Cg(s,t),s.results[0]===t}function hk(e,t,n,r,a){return e.argument,e.argument.type,a.language!==""&&a.language!==void 0&&YC(a.language,zc(e.argument.value)).length>0}function gk(e,t,n,r,a){return wr(a,e),!!(a.elementCount&&a.elementIndex===a.elementCount-1)}function bk(e,t,n,r,a){return wr(a,e),typeof a.typeIndex=="number"&&typeof a.typeCount=="number"&&a.typeIndex===a.typeCount-1}function Ek(e,t,n,r,a){return!M1(e,t,n,r,a)}function xk(e,t,n,r,a){const s=su(e);return wr(a,e),typeof a.elementIndex=="number"&&s(a.elementIndex)}function yk(e,t,n,r,a){const s=su(e);return wr(a,e),!!(typeof a.elementCount=="number"&&typeof a.elementIndex=="number"&&s(a.elementCount-a.elementIndex-1))}function Tk(e,t,n,r,a){const s=su(e);return wr(a,e),typeof a.typeCount=="number"&&typeof a.typeIndex=="number"&&s(a.typeCount-1-a.typeIndex)}function Sk(e,t,n,r,a){const s=su(e);return wr(a,e),typeof a.typeIndex=="number"&&s(a.typeIndex)}function vk(e,t,n,r,a){return wr(a,e),a.elementCount===1}function wk(e,t,n,r,a){return wr(a,e),a.typeCount===1}function Ak(e,t){return!j1(e,t)}function Nk(e,t,n,r,a){return!P1(e,t,n,r,a)}function P1(e,t,n,r,a){return t.tagName==="input"||t.tagName==="textarea"?!ha(t,"readOnly")&&!ha(t,"disabled"):!!a.editableOrEditingHost}function j1(e,t){return(t.tagName==="input"||t.tagName==="textarea"||t.tagName==="select")&&ha(t,"required")}function _k(e,t,n,r,a){return!!((!r||r.type==="root")&&a.schema&&(a.schema.space==="html"||a.schema.space==="svg")&&(t.tagName==="html"||t.tagName==="svg"))}function Ck(e,t,n,r,a){return a.scopeElements.includes(t)}function B1(e,t){const n=e.children;let r=-1;for(;++r<n.length;)if(t(n[r]))return!0;return!1}function kk(e){const t=e;throw new Error("Unknown pseudo-selector `"+t.name+"`")}function Ik(e,t,n,r,a){for(const s of e.items)if(s.type==="Attribute"){if(!$C(s,t,a.schema))return!1}else if(s.type==="Id"){if(!WC(s,t))return!1}else if(s.type==="ClassName"){if(!GC(s,t))return!1}else if(s.type==="PseudoClass"){if(!ak(s,t,n,r,a))return!1}else{if(s.type==="PseudoElement")throw new Error("Invalid selector: `::"+s.name+"`");if(s.type==="TagName"&&!VC(s,t))return!1}return!0}const Rk=[];function Cg(e,t){t&&U1(e,[],t,void 0,void 0,t)}function Hu(e,t,n){const r=e[t];r?r.push(n):e[t]=[n]}function Dk(e,t,n,r){const a=Bo(t.descendant,t.directChild);let s,i=-1;const o={count:0,types:new Map},u={count:0,types:new Map};for(;++i<n.children.length;)M0(o,n.children[i]);for(i=-1;++i<n.children.length;){const c=n.children[i],p=c.type==="element"?c.tagName.toUpperCase():void 0;if(e.elementIndex=u.count,e.typeIndex=p&&u.types.get(p)||0,e.elementCount=o.count,e.typeCount=p?o.types.get(p):0,"children"in c){const d=Bo(a,s),f=U1(e,d,n.children[i],i,n,r);s=Bo(f.generalSibling,f.adjacentSibling)}if(e.one&&e.found)break;M0(u,n.children[i])}}function Ok(e,t,n,r,a){const s={adjacentSibling:void 0,descendant:void 0,directChild:void 0,generalSibling:void 0};let i=-1;for(;++i<t.length;){const o=t[i];if(e.one&&e.found)break;if(e.shallow&&o.nestedRule)throw new Error("Expected selector without nesting");if(Ik(o,n,r,a,e)){const u=o.nestedRule;if(u){const c=u.combinator==="+"?"adjacentSibling":u.combinator==="~"?"generalSibling":u.combinator===">"?"directChild":"descendant";Hu(s,c,u)}else e.found=!0,e.results.includes(n)||e.results.push(n)}o.combinator===void 0?Hu(s,"descendant",o):o.combinator==="~"&&Hu(s,"generalSibling",o)}return s}function Bo(e,t){return e&&t&&e.length>0&&t.length>0?[...e,...t]:e&&e.length>0?e:t&&t.length>0?t:Rk}function M0(e,t){if(t.type==="element"){const n=t.tagName.toUpperCase(),r=(e.types.get(n)||0)+1;e.count++,e.types.set(n,r)}}function U1(e,t,n,r,a,s){let i={adjacentSibling:void 0,descendant:void 0,directChild:void 0,generalSibling:void 0};const o=UC(e,n);if(n.type==="element"){let u=e.rootQuery.rules;a&&a!==s&&(u=e.rootQuery.rules.filter(c=>c.combinator===void 0||c.combinator===">"&&a===s)),i=Ok(e,Bo(t,u),n,r,a)}return"children"in n&&!e.shallow&&!(e.one&&e.found)&&Dk(e,i,n,s),o(),i}function Lk(e,t,n){const r=Fk(e,t);return Cg(r,t||void 0),r.results}function Fk(e,t,n){return{direction:"ltr",editableOrEditingHost:!1,elementCount:void 0,elementIndex:void 0,found:!1,language:void 0,one:!1,results:[],rootQuery:MC(e),schema:Ca,scopeElements:t?t.type==="root"?t.children:[t]:[],shallow:!1,typeIndex:void 0,typeCount:void 0}}const $1=(e=[],t="")=>(e.forEach(n=>{n.type==="text"?t+=n.value:n.type==="element"&&n.children&&Array.isArray(n.children)&&(t+=$1(n.children))}),t),Mk=e=>{const{selector:t,rewrite:n}=e||{};return r=>{if(!(!n||typeof n!="function")){if(t&&typeof t=="string"){const a=Lk(t,r);a&&a.length>0&&$n(r,a,(s,i,o)=>{n(s,i,o)});return}$n(r,(a,s,i)=>{n(a,s,i)})}}};function Pk(e,t,n,r){let a,s,i;s=t,i=n,a=r,$d(e,s,o,a);function o(u,c){const p=c[c.length-1],d=p?p.children.indexOf(u):void 0;return i(u,d,p)}}const jk=(e="")=>(e.match(/([^?=&]+)(=([^&]*))/g)||[]).reduce((t,n)=>(t[n.slice(0,n.indexOf("="))]=n.slice(n.indexOf("=")+1),t),{}),Bk=(e=[],t)=>{let n=t;for(;n>-1;){if(n--,!e[n])return;if(e[n]&&e[n].value&&e[n].value.replace(/(\n|\s)/g,"")!==""||e[n].type!=="text")return!/^rehype:/.test(e[n].value)||e[n].type!=="comment"?void 0:e[n]}},z1=(e=[],t,n,r="<!--",a="-->")=>{let s=t;for(;s<e.length;)if(s++,n){const i=e[s];if(i&&i.value&&i.value.replace(/(\n|\s)/g,"")!==""||e[s]&&e[s].type==="element")return i.tagName===n?i:void 0}else{const i=e[s];if(!i||i.type==="element")return;if(i.type==="text"){const o=z1(e,s,void 0);if(o)return o}if(i.type&&/^(comment|raw|text)$/ig.test(i.type)){const o=new RegExp(`^(s+)?${r}(.*?)${a}`);if(i.value&&!/^rehype:/.test(i.value.replace(/^(\n|\s)+/,"").replace(o,"$2")||""))return;let u=i.value.replace(/^(\n|\s)+/,"");return i.value=u,i}}},P0=({value:e=""},t="<!--",n="-->")=>{let r;try{r=new RegExp(`^${t}(.*?)${n}`)}catch{return{}}const a=e.match(r),i=(a?a[1]:e).replace(/^rehype:/,""),o=jk(i);return Object.keys(o).forEach(u=>{o[u]==="true"?o[u]=!0:o[u]==="false"?o[u]=!1:typeof o[u]=="string"&&!/^0/.test(o[u])&&!isNaN(+o[u])&&(o[u]=+o[u])}),o},j0=(e,t,n)=>n==="string"?{...e,"data-config":JSON.stringify({...t,rehyp:!0})}:n==="attr"?{...e,...t}:{...e,"data-config":{...t,rehyp:!0}},Uk=(e={})=>{const{properties:t="data",codeBlockParames:n=!0,commentStart:r="<!--",commentEnd:a="-->"}=e;return s=>{Pk(s,"element",(i,o,u)=>{if(n&&i.tagName==="pre"&&i&&Array.isArray(i.children)&&u&&Array.isArray(u.children)&&u.children.length>1){const p=i.children[0];if(p&&p.tagName==="code"&&typeof o=="number"){const d=Bk(u.children,o);if(d){const f=P0(d,r,a);Object.keys(f).length>0&&(i.properties={...i.properties,"data-type":"rehyp"},p.properties=j0(p.properties,f,t))}}}let c=u;if((/^(em|strong|b|a|i|p|pre|kbd|blockquote|h(1|2|3|4|5|6)|code|table|img|del|ul|ol)$/.test(i.tagName)||c.type=="root")&&u&&Array.isArray(u.children)&&typeof o=="number"){const p=z1(u.children,o,"",r,a);if(p){const d=P0(p,r,a);Object.keys(d).length>0&&(i.properties=j0(i.properties,d,t))}}})}},H1=-1,iu=0,Js=1,Xo=2,kg=3,Ig=4,Rg=5,Dg=6,G1=7,W1=8,{defineProperty:$k}=Object,V1=typeof self=="object"?self:globalThis,B0=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new V1[e](t)},zk=(e,t)=>{const n=(a,s)=>(e.set(s,a),a),r=a=>{if(e.has(a))return e.get(a);const[s,i]=t[a];switch(s){case iu:case H1:return n(i,a);case Js:{const o=n([],a);for(const u of i)o.push(r(u));return o}case Xo:{const o=n({},a);for(const[u,c]of i){const p=r(u),d=r(c);p==="__proto__"?$k(o,p,{value:d,configurable:!0,enumerable:!0,writable:!0}):o[p]=d}return o}case kg:return n(new Date(i),a);case Ig:{const{source:o,flags:u}=i;return n(new RegExp(o,u),a)}case Rg:{const o=n(new Map,a);for(const[u,c]of i)o.set(r(u),r(c));return o}case Dg:{const o=n(new Set,a);for(const u of i)o.add(r(u));return o}case G1:{const{name:o,message:u}=i;return n(typeof V1[o]=="function"?B0(o,u):new Error(u),a)}case W1:return n(BigInt(i),a);case"BigInt":return n(Object(BigInt(i)),a);case"ArrayBuffer":return n(new Uint8Array(i).buffer,i);case"DataView":{const{buffer:o}=new Uint8Array(i);return n(new DataView(o),i)}case"-0":return-0}return n(B0(s,i),a)};return r},U0=e=>zk(new Map,e)(0),la="",{toString:Hk}={},{keys:Gk,is:Wk}=Object,Fs=e=>{const t=typeof e;if(t!=="object"||!e)return[iu,t];const n=Hk.call(e).slice(8,-1);switch(n){case"Array":return[Js,la];case"Object":return[Xo,la];case"Date":return[kg,la];case"RegExp":return[Ig,la];case"Map":return[Rg,la];case"Set":return[Dg,la];case"DataView":return[Js,n]}return n.includes("Array")?[Js,n]:e instanceof Error?[G1,e.name||"Error"]:[Xo,n]},fo=([e,t])=>e===iu&&(t==="function"||t==="symbol"),Vk=(e,t,n,r)=>{const a=(i,o)=>{const u=r.push(i)-1;return n.set(o,u),u},s=i=>{if(n.has(i))return n.get(i);let[o,u]=Fs(i);switch(o){case iu:{let p=i;switch(u){case"bigint":o=W1,p=i.toString();break;case"number":if(!i&&Wk(i,-0))return r.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);p=null;break;case"undefined":return a([H1],i)}return a([o,p],i)}case Js:{if(u){let f=i;return u==="DataView"?f=new Uint8Array(i.buffer):u==="ArrayBuffer"&&(f=new Uint8Array(i)),a([u,[...f]],i)}const p=[],d=a([o,p],i);for(const f of i)p.push(s(f));return d}case Xo:{if(u)switch(u){case"BigInt":return a([u,i.toString()],i);case"Boolean":case"Number":case"String":return a([u,i.valueOf()],i)}if(t&&"toJSON"in i)return s(i.toJSON());const p=[],d=a([o,p],i);for(const f of Gk(i))(e||!fo(Fs(i[f])))&&p.push([s(f),s(i[f])]);return d}case kg:return a([o,isNaN(i.getTime())?la:i.toISOString()],i);case Ig:{const{source:p,flags:d}=i;return a([o,{source:p,flags:d}],i)}case Rg:{const p=[],d=a([o,p],i);for(const[f,m]of i)(e||!(fo(Fs(f))||fo(Fs(m))))&&p.push([s(f),s(m)]);return d}case Dg:{const p=[],d=a([o,p],i);for(const f of i)(e||!fo(Fs(f)))&&p.push(s(f));return d}}const{message:c}=i;return a([o,{name:u,message:c}],i)};return s},$0=(e,{json:t,lossy:n}={})=>{const r=[];return Vk(!(t||n),!!t,new Map,r)(e),r},ga=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?U0($0(e,t)):structuredClone(e):(e,t)=>U0($0(e,t));function qk(e){const t=String(e),n=[];return{toOffset:a,toPoint:r};function r(s){if(typeof s=="number"&&s>-1&&s<=t.length){let i=0;for(;;){let o=n[i];if(o===void 0){const u=z0(t,n[i-1]);o=u===-1?t.length+1:u+1,n[i]=o}if(o>s)return{line:i+1,column:s-(i>0?n[i-1]:0)+1,offset:s};i++}}}function a(s){if(s&&typeof s.line=="number"&&typeof s.column=="number"&&!Number.isNaN(s.line)&&!Number.isNaN(s.column)){for(;n.length<s.line;){const o=n[n.length-1],u=z0(t,o),c=u===-1?t.length+1:u+1;if(o===c)break;n.push(c)}const i=(s.line>1?n[s.line-2]:0)+s.column-1;if(i<n[s.line-1])return i}}}function z0(e,t){const n=e.indexOf("\r",t),r=e.indexOf(`
|
|
16
16
|
`,t);return r===-1?n:n===-1||n+1===r?r:n<r?n:r}const ca={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},q1={}.hasOwnProperty,Yk=Object.prototype;function Y1(e,t){const n=t||{};return Og({file:n.file||void 0,location:!1,schema:n.space==="svg"?fr:Ca,verbose:n.verbose||!1},e)}function Og(e,t){let n;switch(t.nodeName){case"#comment":{const r=t;return n={type:"comment",value:r.data},Uo(e,r,n),n}case"#document":case"#document-fragment":{const r=t,a="mode"in r?r.mode==="quirks"||r.mode==="limited-quirks":!1;if(n={type:"root",children:Z1(e,t.childNodes),data:{quirksMode:a}},e.file&&e.location){const s=String(e.file),i=qk(s),o=i.toPoint(0),u=i.toPoint(s.length);n.position={start:o,end:u}}return n}case"#documentType":{const r=t;return n={type:"doctype"},Uo(e,r,n),n}case"#text":{const r=t;return n={type:"text",value:r.value},Uo(e,r,n),n}default:return n=Zk(e,t),n}}function Z1(e,t){let n=-1;const r=[];for(;++n<t.length;){const a=Og(e,t[n]);r.push(a)}return r}function Zk(e,t){const n=e.schema;e.schema=t.namespaceURI===ca.svg?fr:Ca;let r=-1;const a={};for(;++r<t.attrs.length;){const o=t.attrs[r],u=(o.prefix?o.prefix+":":"")+o.name;q1.call(Yk,u)||(a[u]=o.value)}const i=(e.schema.space==="svg"?nC:S1)(t.tagName,a,Z1(e,t.childNodes));if(Uo(e,t,i),i.tagName==="template"){const o=t,u=o.sourceCodeLocation,c=u&&u.startTag&&Wa(u.startTag),p=u&&u.endTag&&Wa(u.endTag),d=Og(e,o.content);c&&p&&e.file&&(d.position={start:c.end,end:p.start}),i.content=d}return e.schema=n,i}function Uo(e,t,n){if("sourceCodeLocation"in t&&t.sourceCodeLocation&&e.file){const r=Kk(e,n,t.sourceCodeLocation);r&&(e.location=!0,n.position=r)}}function Kk(e,t,n){const r=Wa(n);if(t.type==="element"){const a=t.children[t.children.length-1];if(r&&!n.endTag&&a&&a.position&&a.position.end&&(r.end=Object.assign({},a.position.end)),e.verbose){const s={};let i;if(n.attrs)for(i in n.attrs)q1.call(n.attrs,i)&&(s[hs(e.schema,i).property]=Wa(n.attrs[i]));n.startTag;const o=Wa(n.startTag),u=n.endTag?Wa(n.endTag):void 0,c={opening:o};u&&(c.closing=u),c.properties=s,t.data={position:c}}}return r}function Wa(e){const t=H0({line:e.startLine,column:e.startCol,offset:e.startOffset}),n=H0({line:e.endLine,column:e.endCol,offset:e.endOffset});return t||n?{start:t,end:n}:void 0}function H0(e){return e.line&&e.column?e:void 0}const Xk={},Qk={}.hasOwnProperty,K1=au("type",{handlers:{root:eI,element:sI,text:rI,comment:aI,doctype:nI}});function Jk(e,t){const r=(t||Xk).space;return K1(e,r==="svg"?fr:Ca)}function eI(e,t){const n={nodeName:"#document",mode:(e.data||{}).quirksMode?"quirks":"no-quirks",childNodes:[]};return n.childNodes=Lg(e.children,n,t),bs(e,n),n}function tI(e,t){const n={nodeName:"#document-fragment",childNodes:[]};return n.childNodes=Lg(e.children,n,t),bs(e,n),n}function nI(e){const t={nodeName:"#documentType",name:"html",publicId:"",systemId:"",parentNode:null};return bs(e,t),t}function rI(e){const t={nodeName:"#text",value:e.value,parentNode:null};return bs(e,t),t}function aI(e){const t={nodeName:"#comment",data:e.value,parentNode:null};return bs(e,t),t}function sI(e,t){const n=t;let r=n;e.type==="element"&&e.tagName.toLowerCase()==="svg"&&n.space==="html"&&(r=fr);const a=[];let s;if(e.properties){for(s in e.properties)if(s!=="children"&&Qk.call(e.properties,s)){const u=iI(r,s,e.properties[s]);u&&a.push(u)}}const i=r.space,o={nodeName:e.tagName,tagName:e.tagName,attrs:a,namespaceURI:ca[i],childNodes:[],parentNode:null};return o.childNodes=Lg(e.children,o,r),bs(e,o),e.tagName==="template"&&e.content&&(o.content=tI(e.content,r)),o}function iI(e,t,n){const r=hs(e,t);if(n===!1||n===null||n===void 0||typeof n=="number"&&Number.isNaN(n)||!n&&r.boolean)return;Array.isArray(n)&&(n=r.commaSeparated?Jl(n):eu(n));const a={name:r.attribute,value:n===!0?"":String(n)};if(r.space&&r.space!=="html"&&r.space!=="svg"){const s=a.name.indexOf(":");s<0?a.prefix="":(a.name=a.name.slice(s+1),a.prefix=r.attribute.slice(0,s)),a.namespace=ca[r.space]}return a}function Lg(e,t,n){let r=-1;const a=[];if(e)for(;++r<e.length;){const s=K1(e[r],n);s.parentNode=t,a.push(s)}return a}function bs(e,t){const n=e.position;n&&n.start&&n.end&&(n.start.offset,n.end.offset,t.sourceCodeLocation={startLine:n.start.line,startCol:n.start.column,startOffset:n.start.offset,endLine:n.end.line,endCol:n.end.column,endOffset:n.end.offset})}const X1=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],oI=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]),$t="�";var I;(function(e){e[e.EOF=-1]="EOF",e[e.NULL=0]="NULL",e[e.TABULATION=9]="TABULATION",e[e.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",e[e.LINE_FEED=10]="LINE_FEED",e[e.FORM_FEED=12]="FORM_FEED",e[e.SPACE=32]="SPACE",e[e.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",e[e.QUOTATION_MARK=34]="QUOTATION_MARK",e[e.AMPERSAND=38]="AMPERSAND",e[e.APOSTROPHE=39]="APOSTROPHE",e[e.HYPHEN_MINUS=45]="HYPHEN_MINUS",e[e.SOLIDUS=47]="SOLIDUS",e[e.DIGIT_0=48]="DIGIT_0",e[e.DIGIT_9=57]="DIGIT_9",e[e.SEMICOLON=59]="SEMICOLON",e[e.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",e[e.EQUALS_SIGN=61]="EQUALS_SIGN",e[e.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",e[e.QUESTION_MARK=63]="QUESTION_MARK",e[e.LATIN_CAPITAL_A=65]="LATIN_CAPITAL_A",e[e.LATIN_CAPITAL_Z=90]="LATIN_CAPITAL_Z",e[e.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",e[e.GRAVE_ACCENT=96]="GRAVE_ACCENT",e[e.LATIN_SMALL_A=97]="LATIN_SMALL_A",e[e.LATIN_SMALL_Z=122]="LATIN_SMALL_Z"})(I||(I={}));const Bn={DASH_DASH:"--",CDATA_START:"[CDATA[",DOCTYPE:"doctype",SCRIPT:"script",PUBLIC:"public",SYSTEM:"system"};function Q1(e){return e>=55296&&e<=57343}function lI(e){return e>=56320&&e<=57343}function uI(e,t){return(e-55296)*1024+9216+t}function J1(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function eT(e){return e>=64976&&e<=65007||oI.has(e)}var ee;(function(e){e.controlCharacterInInputStream="control-character-in-input-stream",e.noncharacterInInputStream="noncharacter-in-input-stream",e.surrogateInInputStream="surrogate-in-input-stream",e.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",e.endTagWithAttributes="end-tag-with-attributes",e.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",e.unexpectedSolidusInTag="unexpected-solidus-in-tag",e.unexpectedNullCharacter="unexpected-null-character",e.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",e.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",e.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",e.missingEndTagName="missing-end-tag-name",e.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",e.unknownNamedCharacterReference="unknown-named-character-reference",e.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",e.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",e.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",e.eofBeforeTagName="eof-before-tag-name",e.eofInTag="eof-in-tag",e.missingAttributeValue="missing-attribute-value",e.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",e.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",e.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",e.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",e.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",e.missingDoctypePublicIdentifier="missing-doctype-public-identifier",e.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",e.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",e.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",e.cdataInHtmlContent="cdata-in-html-content",e.incorrectlyOpenedComment="incorrectly-opened-comment",e.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",e.eofInDoctype="eof-in-doctype",e.nestedComment="nested-comment",e.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",e.eofInComment="eof-in-comment",e.incorrectlyClosedComment="incorrectly-closed-comment",e.eofInCdata="eof-in-cdata",e.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",e.nullCharacterReference="null-character-reference",e.surrogateCharacterReference="surrogate-character-reference",e.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",e.controlCharacterReference="control-character-reference",e.noncharacterCharacterReference="noncharacter-character-reference",e.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",e.missingDoctypeName="missing-doctype-name",e.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",e.duplicateAttribute="duplicate-attribute",e.nonConformingDoctype="non-conforming-doctype",e.missingDoctype="missing-doctype",e.misplacedDoctype="misplaced-doctype",e.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",e.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",e.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",e.openElementsLeftAfterEof="open-elements-left-after-eof",e.abandonedHeadElementChild="abandoned-head-element-child",e.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",e.nestedNoscriptInHead="nested-noscript-in-head",e.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(ee||(ee={}));const cI=65536;class dI{constructor(t){this.handler=t,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=cI,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(t,n){const{line:r,col:a,offset:s}=this,i=a+n,o=s+n;return{code:t,startLine:r,endLine:r,startCol:i,endCol:i,startOffset:o,endOffset:o}}_err(t){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(t,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(t){if(this.pos!==this.html.length-1){const n=this.html.charCodeAt(this.pos+1);if(lI(n))return this.pos++,this._addGap(),uI(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,I.EOF;return this._err(ee.surrogateInInputStream),t}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(t,n){this.html.length>0?this.html+=t:this.html=t,this.endOfChunkHit=!1,this.lastChunkWritten=n}insertHtmlAtCurrentPos(t){this.html=this.html.substring(0,this.pos+1)+t+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(t,n){if(this.pos+t.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(n)return this.html.startsWith(t,this.pos);for(let r=0;r<t.length;r++)if((this.html.charCodeAt(this.pos+r)|32)!==t.charCodeAt(r))return!1;return!0}peek(t){const n=this.pos+t;if(n>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,I.EOF;const r=this.html.charCodeAt(n);return r===I.CARRIAGE_RETURN?I.LINE_FEED:r}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,I.EOF;let t=this.html.charCodeAt(this.pos);return t===I.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,I.LINE_FEED):t===I.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,Q1(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===I.LINE_FEED||t===I.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){J1(t)?this._err(ee.controlCharacterInInputStream):eT(t)&&this._err(ee.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}}var ut;(function(e){e[e.CHARACTER=0]="CHARACTER",e[e.NULL_CHARACTER=1]="NULL_CHARACTER",e[e.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",e[e.START_TAG=3]="START_TAG",e[e.END_TAG=4]="END_TAG",e[e.COMMENT=5]="COMMENT",e[e.DOCTYPE=6]="DOCTYPE",e[e.EOF=7]="EOF",e[e.HIBERNATION=8]="HIBERNATION"})(ut||(ut={}));function tT(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}const pI=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏઑඡ༉༦ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲϏϢϸontourIntegraìȹoɴ\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲy;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱còJTabcdfgorstרׯؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ߂ߐĀiyޱrc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣসে্ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४ĀnrࢃgleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpwਖਛgȀLRlr৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼અઋp;椅y;䐜Ādl੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑඞcy;䐊cute;䅃ƀaeyહાron;䅇dil;䅅;䐝ƀgswે૰ativeƀMTV૨ediumSpace;怋hiĀcn૦ëeryThiîtedĀGLଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷreak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater;EFGLSTஶஷ扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨setĀ;Eೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂෛ෧ขภยา฿ไlig;䅒cute耻Ó䃓Āiyීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲcr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬืde耻Õ䃕es;樷ml耻Ö䃖erĀBP๋Āar๐๓r;怾acĀek๚;揞et;掴arenthesis;揜ҀacfhilorsງຊຏຒດຝະrtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ檻cedesȀ;EST່້扺qual;檯lantEqual;扼ilde;找me;怳Ādpuct;戏ortionĀ;aȥl;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL憒ar;懥eftArrow;懄eiling;按oǵ\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄቕቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHcቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗ĀeiቻDzኀ\0ኇefore;戴a;䎘ĀcnኘkSpace;쀀 Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtèa;䎖r;愨pf;愤cr;쀀𝒵ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒;Eaeiopᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;eᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;eᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰᝃᝈ០៦ᠹᡐᜍ᥈ᥰot;櫭ĀcrᛶkȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀakoᠦᠵĀcn៲ᠣkƀlst֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ;敛;敘;攘;攔;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģbar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;elƀ;bhᥨᥩᥫ䁜;槅sub;柈ŬᥴlĀ;e怢t»pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭒\0᯽\0ᰌƀcprᦲute;䄇̀;abcdsᦿᧀᧄ᧕᧙戩nd;橄rcup;橉Āau᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r;Ecefms᩠ᩢᩫ᪤᪪旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ\0\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»eóɍǧ\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯delprvw᭠᭬᭷ᮂᮬᯔarrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;pᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰻᰿ᱝᱩᱵᲞᲬᲷᴍᵻᶑᶫᶻ᷆᷍ròar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂᳖᳜᳠mƀ;oș᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄĀDoḆᴴoôĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»ṺƀaeiἒἚls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₥₰₴⃰℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽ƀ;qsؾٌlanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqrⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0proør;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼ròòΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonóquigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roøurĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨íistĀ;sடr;쀀𝔫ȀEest⩦⩹⩼ƀ;qs⩭ƀ;qs⩴lanôií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast⭕⭚⭟lleìl;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖchimpqu⮽⯍⯙⬄⯤⯯Ȁ;cerല⯆ഷ⯉uå;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭ååഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñĀ;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;cⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācrir;榿;쀀𝔬ͯ\0\0\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕⶥⶨrò᪀Āirⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔǒr;榷rp;榹;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ\0\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ脀¶;l䂶leìЃɩ\0\0m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳ᤈ⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t⾴ïrel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⋢⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔ABHabcdefhilmnoprstuxけさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstwガクシスゼゾダッデナp;極Ā;fゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ìâヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘rrowĀ;tㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowóarpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓ròaòՑ;怏oustĀ;a㈞掱che»mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì耻䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;qኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫwar;椪lig耻ß䃟㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rëƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproøim»ኬsðኞĀas㚺㚮ðrn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈadempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xôheadĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roðtré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜtré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(e=>e.charCodeAt(0))),fI=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function mI(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=fI.get(e))!==null&&t!==void 0?t:e}var gn;(function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"})(gn||(gn={}));const hI=32;var Yr;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(Yr||(Yr={}));function Xc(e){return e>=gn.ZERO&&e<=gn.NINE}function gI(e){return e>=gn.UPPER_A&&e<=gn.UPPER_F||e>=gn.LOWER_A&&e<=gn.LOWER_F}function bI(e){return e>=gn.UPPER_A&&e<=gn.UPPER_Z||e>=gn.LOWER_A&&e<=gn.LOWER_Z||Xc(e)}function EI(e){return e===gn.EQUALS||bI(e)}var dn;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(dn||(dn={}));var Ir;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(Ir||(Ir={}));class xI{constructor(t,n,r){this.decodeTree=t,this.emitCodePoint=n,this.errors=r,this.state=dn.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Ir.Strict}startEntity(t){this.decodeMode=t,this.state=dn.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case dn.EntityStart:return t.charCodeAt(n)===gn.NUM?(this.state=dn.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=dn.NamedEntity,this.stateNamedEntity(t,n));case dn.NumericStart:return this.stateNumericStart(t,n);case dn.NumericDecimal:return this.stateNumericDecimal(t,n);case dn.NumericHex:return this.stateNumericHex(t,n);case dn.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|hI)===gn.LOWER_X?(this.state=dn.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=dn.NumericDecimal,this.stateNumericDecimal(t,n))}addToNumericResult(t,n,r,a){if(n!==r){const s=r-n;this.result=this.result*Math.pow(a,s)+Number.parseInt(t.substr(n,s),a),this.consumed+=s}}stateNumericHex(t,n){const r=n;for(;n<t.length;){const a=t.charCodeAt(n);if(Xc(a)||gI(a))n+=1;else return this.addToNumericResult(t,r,n,16),this.emitNumericEntity(a,3)}return this.addToNumericResult(t,r,n,16),-1}stateNumericDecimal(t,n){const r=n;for(;n<t.length;){const a=t.charCodeAt(n);if(Xc(a))n+=1;else return this.addToNumericResult(t,r,n,10),this.emitNumericEntity(a,2)}return this.addToNumericResult(t,r,n,10),-1}emitNumericEntity(t,n){var r;if(this.consumed<=n)return(r=this.errors)===null||r===void 0||r.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(t===gn.SEMI)this.consumed+=1;else if(this.decodeMode===Ir.Strict)return 0;return this.emitCodePoint(mI(this.result),this.consumed),this.errors&&(t!==gn.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(t,n){const{decodeTree:r}=this;let a=r[this.treeIndex],s=(a&Yr.VALUE_LENGTH)>>14;for(;n<t.length;n++,this.excess++){const i=t.charCodeAt(n);if(this.treeIndex=yI(r,a,this.treeIndex+Math.max(1,s),i),this.treeIndex<0)return this.result===0||this.decodeMode===Ir.Attribute&&(s===0||EI(i))?0:this.emitNotTerminatedNamedEntity();if(a=r[this.treeIndex],s=(a&Yr.VALUE_LENGTH)>>14,s!==0){if(i===gn.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==Ir.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;const{result:n,decodeTree:r}=this,a=(r[n]&Yr.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,a,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,r){const{decodeTree:a}=this;return this.emitCodePoint(n===1?a[t]&~Yr.VALUE_LENGTH:a[t+1],r),n===3&&this.emitCodePoint(a[t+2],r),r}end(){var t;switch(this.state){case dn.NamedEntity:return this.result!==0&&(this.decodeMode!==Ir.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case dn.NumericDecimal:return this.emitNumericEntity(0,2);case dn.NumericHex:return this.emitNumericEntity(0,3);case dn.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case dn.EntityStart:return 0}}}function yI(e,t,n,r){const a=(t&Yr.BRANCH_LENGTH)>>7,s=t&Yr.JUMP_TABLE;if(a===0)return s!==0&&r===s?n:-1;if(s){const u=r-s;return u<0||u>=a?-1:e[n+u]-1}let i=n,o=i+a-1;for(;i<=o;){const u=i+o>>>1,c=e[u];if(c<r)i=u+1;else if(c>r)o=u-1;else return e[u+a]}return-1}var ce;(function(e){e.HTML="http://www.w3.org/1999/xhtml",e.MATHML="http://www.w3.org/1998/Math/MathML",e.SVG="http://www.w3.org/2000/svg",e.XLINK="http://www.w3.org/1999/xlink",e.XML="http://www.w3.org/XML/1998/namespace",e.XMLNS="http://www.w3.org/2000/xmlns/"})(ce||(ce={}));var ma;(function(e){e.TYPE="type",e.ACTION="action",e.ENCODING="encoding",e.PROMPT="prompt",e.NAME="name",e.COLOR="color",e.FACE="face",e.SIZE="size"})(ma||(ma={}));var tr;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(tr||(tr={}));var q;(function(e){e.A="a",e.ADDRESS="address",e.ANNOTATION_XML="annotation-xml",e.APPLET="applet",e.AREA="area",e.ARTICLE="article",e.ASIDE="aside",e.B="b",e.BASE="base",e.BASEFONT="basefont",e.BGSOUND="bgsound",e.BIG="big",e.BLOCKQUOTE="blockquote",e.BODY="body",e.BR="br",e.BUTTON="button",e.CAPTION="caption",e.CENTER="center",e.CODE="code",e.COL="col",e.COLGROUP="colgroup",e.DD="dd",e.DESC="desc",e.DETAILS="details",e.DIALOG="dialog",e.DIR="dir",e.DIV="div",e.DL="dl",e.DT="dt",e.EM="em",e.EMBED="embed",e.FIELDSET="fieldset",e.FIGCAPTION="figcaption",e.FIGURE="figure",e.FONT="font",e.FOOTER="footer",e.FOREIGN_OBJECT="foreignObject",e.FORM="form",e.FRAME="frame",e.FRAMESET="frameset",e.H1="h1",e.H2="h2",e.H3="h3",e.H4="h4",e.H5="h5",e.H6="h6",e.HEAD="head",e.HEADER="header",e.HGROUP="hgroup",e.HR="hr",e.HTML="html",e.I="i",e.IMG="img",e.IMAGE="image",e.INPUT="input",e.IFRAME="iframe",e.KEYGEN="keygen",e.LABEL="label",e.LI="li",e.LINK="link",e.LISTING="listing",e.MAIN="main",e.MALIGNMARK="malignmark",e.MARQUEE="marquee",e.MATH="math",e.MENU="menu",e.META="meta",e.MGLYPH="mglyph",e.MI="mi",e.MO="mo",e.MN="mn",e.MS="ms",e.MTEXT="mtext",e.NAV="nav",e.NOBR="nobr",e.NOFRAMES="noframes",e.NOEMBED="noembed",e.NOSCRIPT="noscript",e.OBJECT="object",e.OL="ol",e.OPTGROUP="optgroup",e.OPTION="option",e.P="p",e.PARAM="param",e.PLAINTEXT="plaintext",e.PRE="pre",e.RB="rb",e.RP="rp",e.RT="rt",e.RTC="rtc",e.RUBY="ruby",e.S="s",e.SCRIPT="script",e.SEARCH="search",e.SECTION="section",e.SELECT="select",e.SOURCE="source",e.SMALL="small",e.SPAN="span",e.STRIKE="strike",e.STRONG="strong",e.STYLE="style",e.SUB="sub",e.SUMMARY="summary",e.SUP="sup",e.TABLE="table",e.TBODY="tbody",e.TEMPLATE="template",e.TEXTAREA="textarea",e.TFOOT="tfoot",e.TD="td",e.TH="th",e.THEAD="thead",e.TITLE="title",e.TR="tr",e.TRACK="track",e.TT="tt",e.U="u",e.UL="ul",e.SVG="svg",e.VAR="var",e.WBR="wbr",e.XMP="xmp"})(q||(q={}));var h;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.A=1]="A",e[e.ADDRESS=2]="ADDRESS",e[e.ANNOTATION_XML=3]="ANNOTATION_XML",e[e.APPLET=4]="APPLET",e[e.AREA=5]="AREA",e[e.ARTICLE=6]="ARTICLE",e[e.ASIDE=7]="ASIDE",e[e.B=8]="B",e[e.BASE=9]="BASE",e[e.BASEFONT=10]="BASEFONT",e[e.BGSOUND=11]="BGSOUND",e[e.BIG=12]="BIG",e[e.BLOCKQUOTE=13]="BLOCKQUOTE",e[e.BODY=14]="BODY",e[e.BR=15]="BR",e[e.BUTTON=16]="BUTTON",e[e.CAPTION=17]="CAPTION",e[e.CENTER=18]="CENTER",e[e.CODE=19]="CODE",e[e.COL=20]="COL",e[e.COLGROUP=21]="COLGROUP",e[e.DD=22]="DD",e[e.DESC=23]="DESC",e[e.DETAILS=24]="DETAILS",e[e.DIALOG=25]="DIALOG",e[e.DIR=26]="DIR",e[e.DIV=27]="DIV",e[e.DL=28]="DL",e[e.DT=29]="DT",e[e.EM=30]="EM",e[e.EMBED=31]="EMBED",e[e.FIELDSET=32]="FIELDSET",e[e.FIGCAPTION=33]="FIGCAPTION",e[e.FIGURE=34]="FIGURE",e[e.FONT=35]="FONT",e[e.FOOTER=36]="FOOTER",e[e.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",e[e.FORM=38]="FORM",e[e.FRAME=39]="FRAME",e[e.FRAMESET=40]="FRAMESET",e[e.H1=41]="H1",e[e.H2=42]="H2",e[e.H3=43]="H3",e[e.H4=44]="H4",e[e.H5=45]="H5",e[e.H6=46]="H6",e[e.HEAD=47]="HEAD",e[e.HEADER=48]="HEADER",e[e.HGROUP=49]="HGROUP",e[e.HR=50]="HR",e[e.HTML=51]="HTML",e[e.I=52]="I",e[e.IMG=53]="IMG",e[e.IMAGE=54]="IMAGE",e[e.INPUT=55]="INPUT",e[e.IFRAME=56]="IFRAME",e[e.KEYGEN=57]="KEYGEN",e[e.LABEL=58]="LABEL",e[e.LI=59]="LI",e[e.LINK=60]="LINK",e[e.LISTING=61]="LISTING",e[e.MAIN=62]="MAIN",e[e.MALIGNMARK=63]="MALIGNMARK",e[e.MARQUEE=64]="MARQUEE",e[e.MATH=65]="MATH",e[e.MENU=66]="MENU",e[e.META=67]="META",e[e.MGLYPH=68]="MGLYPH",e[e.MI=69]="MI",e[e.MO=70]="MO",e[e.MN=71]="MN",e[e.MS=72]="MS",e[e.MTEXT=73]="MTEXT",e[e.NAV=74]="NAV",e[e.NOBR=75]="NOBR",e[e.NOFRAMES=76]="NOFRAMES",e[e.NOEMBED=77]="NOEMBED",e[e.NOSCRIPT=78]="NOSCRIPT",e[e.OBJECT=79]="OBJECT",e[e.OL=80]="OL",e[e.OPTGROUP=81]="OPTGROUP",e[e.OPTION=82]="OPTION",e[e.P=83]="P",e[e.PARAM=84]="PARAM",e[e.PLAINTEXT=85]="PLAINTEXT",e[e.PRE=86]="PRE",e[e.RB=87]="RB",e[e.RP=88]="RP",e[e.RT=89]="RT",e[e.RTC=90]="RTC",e[e.RUBY=91]="RUBY",e[e.S=92]="S",e[e.SCRIPT=93]="SCRIPT",e[e.SEARCH=94]="SEARCH",e[e.SECTION=95]="SECTION",e[e.SELECT=96]="SELECT",e[e.SOURCE=97]="SOURCE",e[e.SMALL=98]="SMALL",e[e.SPAN=99]="SPAN",e[e.STRIKE=100]="STRIKE",e[e.STRONG=101]="STRONG",e[e.STYLE=102]="STYLE",e[e.SUB=103]="SUB",e[e.SUMMARY=104]="SUMMARY",e[e.SUP=105]="SUP",e[e.TABLE=106]="TABLE",e[e.TBODY=107]="TBODY",e[e.TEMPLATE=108]="TEMPLATE",e[e.TEXTAREA=109]="TEXTAREA",e[e.TFOOT=110]="TFOOT",e[e.TD=111]="TD",e[e.TH=112]="TH",e[e.THEAD=113]="THEAD",e[e.TITLE=114]="TITLE",e[e.TR=115]="TR",e[e.TRACK=116]="TRACK",e[e.TT=117]="TT",e[e.U=118]="U",e[e.UL=119]="UL",e[e.SVG=120]="SVG",e[e.VAR=121]="VAR",e[e.WBR=122]="WBR",e[e.XMP=123]="XMP"})(h||(h={}));const TI=new Map([[q.A,h.A],[q.ADDRESS,h.ADDRESS],[q.ANNOTATION_XML,h.ANNOTATION_XML],[q.APPLET,h.APPLET],[q.AREA,h.AREA],[q.ARTICLE,h.ARTICLE],[q.ASIDE,h.ASIDE],[q.B,h.B],[q.BASE,h.BASE],[q.BASEFONT,h.BASEFONT],[q.BGSOUND,h.BGSOUND],[q.BIG,h.BIG],[q.BLOCKQUOTE,h.BLOCKQUOTE],[q.BODY,h.BODY],[q.BR,h.BR],[q.BUTTON,h.BUTTON],[q.CAPTION,h.CAPTION],[q.CENTER,h.CENTER],[q.CODE,h.CODE],[q.COL,h.COL],[q.COLGROUP,h.COLGROUP],[q.DD,h.DD],[q.DESC,h.DESC],[q.DETAILS,h.DETAILS],[q.DIALOG,h.DIALOG],[q.DIR,h.DIR],[q.DIV,h.DIV],[q.DL,h.DL],[q.DT,h.DT],[q.EM,h.EM],[q.EMBED,h.EMBED],[q.FIELDSET,h.FIELDSET],[q.FIGCAPTION,h.FIGCAPTION],[q.FIGURE,h.FIGURE],[q.FONT,h.FONT],[q.FOOTER,h.FOOTER],[q.FOREIGN_OBJECT,h.FOREIGN_OBJECT],[q.FORM,h.FORM],[q.FRAME,h.FRAME],[q.FRAMESET,h.FRAMESET],[q.H1,h.H1],[q.H2,h.H2],[q.H3,h.H3],[q.H4,h.H4],[q.H5,h.H5],[q.H6,h.H6],[q.HEAD,h.HEAD],[q.HEADER,h.HEADER],[q.HGROUP,h.HGROUP],[q.HR,h.HR],[q.HTML,h.HTML],[q.I,h.I],[q.IMG,h.IMG],[q.IMAGE,h.IMAGE],[q.INPUT,h.INPUT],[q.IFRAME,h.IFRAME],[q.KEYGEN,h.KEYGEN],[q.LABEL,h.LABEL],[q.LI,h.LI],[q.LINK,h.LINK],[q.LISTING,h.LISTING],[q.MAIN,h.MAIN],[q.MALIGNMARK,h.MALIGNMARK],[q.MARQUEE,h.MARQUEE],[q.MATH,h.MATH],[q.MENU,h.MENU],[q.META,h.META],[q.MGLYPH,h.MGLYPH],[q.MI,h.MI],[q.MO,h.MO],[q.MN,h.MN],[q.MS,h.MS],[q.MTEXT,h.MTEXT],[q.NAV,h.NAV],[q.NOBR,h.NOBR],[q.NOFRAMES,h.NOFRAMES],[q.NOEMBED,h.NOEMBED],[q.NOSCRIPT,h.NOSCRIPT],[q.OBJECT,h.OBJECT],[q.OL,h.OL],[q.OPTGROUP,h.OPTGROUP],[q.OPTION,h.OPTION],[q.P,h.P],[q.PARAM,h.PARAM],[q.PLAINTEXT,h.PLAINTEXT],[q.PRE,h.PRE],[q.RB,h.RB],[q.RP,h.RP],[q.RT,h.RT],[q.RTC,h.RTC],[q.RUBY,h.RUBY],[q.S,h.S],[q.SCRIPT,h.SCRIPT],[q.SEARCH,h.SEARCH],[q.SECTION,h.SECTION],[q.SELECT,h.SELECT],[q.SOURCE,h.SOURCE],[q.SMALL,h.SMALL],[q.SPAN,h.SPAN],[q.STRIKE,h.STRIKE],[q.STRONG,h.STRONG],[q.STYLE,h.STYLE],[q.SUB,h.SUB],[q.SUMMARY,h.SUMMARY],[q.SUP,h.SUP],[q.TABLE,h.TABLE],[q.TBODY,h.TBODY],[q.TEMPLATE,h.TEMPLATE],[q.TEXTAREA,h.TEXTAREA],[q.TFOOT,h.TFOOT],[q.TD,h.TD],[q.TH,h.TH],[q.THEAD,h.THEAD],[q.TITLE,h.TITLE],[q.TR,h.TR],[q.TRACK,h.TRACK],[q.TT,h.TT],[q.U,h.U],[q.UL,h.UL],[q.SVG,h.SVG],[q.VAR,h.VAR],[q.WBR,h.WBR],[q.XMP,h.XMP]]);function Es(e){var t;return(t=TI.get(e))!==null&&t!==void 0?t:h.UNKNOWN}const he=h,SI={[ce.HTML]:new Set([he.ADDRESS,he.APPLET,he.AREA,he.ARTICLE,he.ASIDE,he.BASE,he.BASEFONT,he.BGSOUND,he.BLOCKQUOTE,he.BODY,he.BR,he.BUTTON,he.CAPTION,he.CENTER,he.COL,he.COLGROUP,he.DD,he.DETAILS,he.DIR,he.DIV,he.DL,he.DT,he.EMBED,he.FIELDSET,he.FIGCAPTION,he.FIGURE,he.FOOTER,he.FORM,he.FRAME,he.FRAMESET,he.H1,he.H2,he.H3,he.H4,he.H5,he.H6,he.HEAD,he.HEADER,he.HGROUP,he.HR,he.HTML,he.IFRAME,he.IMG,he.INPUT,he.LI,he.LINK,he.LISTING,he.MAIN,he.MARQUEE,he.MENU,he.META,he.NAV,he.NOEMBED,he.NOFRAMES,he.NOSCRIPT,he.OBJECT,he.OL,he.P,he.PARAM,he.PLAINTEXT,he.PRE,he.SCRIPT,he.SECTION,he.SELECT,he.SOURCE,he.STYLE,he.SUMMARY,he.TABLE,he.TBODY,he.TD,he.TEMPLATE,he.TEXTAREA,he.TFOOT,he.TH,he.THEAD,he.TITLE,he.TR,he.TRACK,he.UL,he.WBR,he.XMP]),[ce.MATHML]:new Set([he.MI,he.MO,he.MN,he.MS,he.MTEXT,he.ANNOTATION_XML]),[ce.SVG]:new Set([he.TITLE,he.FOREIGN_OBJECT,he.DESC]),[ce.XLINK]:new Set,[ce.XML]:new Set,[ce.XMLNS]:new Set},Qc=new Set([he.H1,he.H2,he.H3,he.H4,he.H5,he.H6]);q.STYLE,q.SCRIPT,q.XMP,q.IFRAME,q.NOEMBED,q.NOFRAMES,q.PLAINTEXT;var F;(function(e){e[e.DATA=0]="DATA",e[e.RCDATA=1]="RCDATA",e[e.RAWTEXT=2]="RAWTEXT",e[e.SCRIPT_DATA=3]="SCRIPT_DATA",e[e.PLAINTEXT=4]="PLAINTEXT",e[e.TAG_OPEN=5]="TAG_OPEN",e[e.END_TAG_OPEN=6]="END_TAG_OPEN",e[e.TAG_NAME=7]="TAG_NAME",e[e.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",e[e.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",e[e.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",e[e.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",e[e.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",e[e.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",e[e.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",e[e.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",e[e.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",e[e.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",e[e.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",e[e.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",e[e.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",e[e.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",e[e.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",e[e.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",e[e.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",e[e.BOGUS_COMMENT=40]="BOGUS_COMMENT",e[e.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",e[e.COMMENT_START=42]="COMMENT_START",e[e.COMMENT_START_DASH=43]="COMMENT_START_DASH",e[e.COMMENT=44]="COMMENT",e[e.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",e[e.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",e[e.COMMENT_END_DASH=49]="COMMENT_END_DASH",e[e.COMMENT_END=50]="COMMENT_END",e[e.COMMENT_END_BANG=51]="COMMENT_END_BANG",e[e.DOCTYPE=52]="DOCTYPE",e[e.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",e[e.DOCTYPE_NAME=54]="DOCTYPE_NAME",e[e.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",e[e.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",e[e.CDATA_SECTION=68]="CDATA_SECTION",e[e.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",e[e.CDATA_SECTION_END=70]="CDATA_SECTION_END",e[e.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",e[e.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(F||(F={}));const Xt={DATA:F.DATA,RCDATA:F.RCDATA,RAWTEXT:F.RAWTEXT,SCRIPT_DATA:F.SCRIPT_DATA,PLAINTEXT:F.PLAINTEXT,CDATA_SECTION:F.CDATA_SECTION};function vI(e){return e>=I.DIGIT_0&&e<=I.DIGIT_9}function Vs(e){return e>=I.LATIN_CAPITAL_A&&e<=I.LATIN_CAPITAL_Z}function wI(e){return e>=I.LATIN_SMALL_A&&e<=I.LATIN_SMALL_Z}function Ur(e){return wI(e)||Vs(e)}function G0(e){return Ur(e)||vI(e)}function mo(e){return e+32}function nT(e){return e===I.SPACE||e===I.LINE_FEED||e===I.TABULATION||e===I.FORM_FEED}function W0(e){return nT(e)||e===I.SOLIDUS||e===I.GREATER_THAN_SIGN}function AI(e){return e===I.NULL?ee.nullCharacterReference:e>1114111?ee.characterReferenceOutsideUnicodeRange:Q1(e)?ee.surrogateCharacterReference:eT(e)?ee.noncharacterCharacterReference:J1(e)||e===I.CARRIAGE_RETURN?ee.controlCharacterReference:null}class NI{constructor(t,n){this.options=t,this.handler=n,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=F.DATA,this.returnState=F.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new dI(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new xI(pI,(r,a)=>{this.preprocessor.pos=this.entityStartPos+a-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(ee.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(ee.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const a=AI(r);a&&this._err(a,1)}}:void 0)}_err(t,n=0){var r,a;(a=(r=this.handler).onParseError)===null||a===void 0||a.call(r,this.preprocessor.getError(t,n))}getCurrentLocation(t){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-t,startOffset:this.preprocessor.offset-t,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const t=this._consume();this._ensureHibernation()||this._callState(t)}this.inLoop=!1}}pause(){this.paused=!0}resume(t){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||t?.())}write(t,n,r){this.active=!0,this.preprocessor.write(t,n),this._runParsingLoop(),this.paused||r?.()}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(t){this.consumedAfterSnapshot+=t;for(let n=0;n<t;n++)this.preprocessor.advance()}_consumeSequenceIfMatch(t,n){return this.preprocessor.startsWith(t,n)?(this._advanceBy(t.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:ut.START_TAG,tagName:"",tagID:h.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:ut.END_TAG,tagName:"",tagID:h.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(t){this.currentToken={type:ut.COMMENT,data:"",location:this.getCurrentLocation(t)}}_createDoctypeToken(t){this.currentToken={type:ut.DOCTYPE,name:t,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(t,n){this.currentCharacterToken={type:t,chars:n,location:this.currentLocation}}_createAttr(t){this.currentAttr={name:t,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var t,n;const r=this.currentToken;if(tT(r,this.currentAttr.name)===null){if(r.attrs.push(this.currentAttr),r.location&&this.currentLocation){const a=(t=(n=r.location).attrs)!==null&&t!==void 0?t:n.attrs=Object.create(null);a[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(ee.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(t){this._emitCurrentCharacterToken(t.location),this.currentToken=null,t.location&&(t.location.endLine=this.preprocessor.line,t.location.endCol=this.preprocessor.col+1,t.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){const t=this.currentToken;this.prepareToken(t),t.tagID=Es(t.tagName),t.type===ut.START_TAG?(this.lastStartTagName=t.tagName,this.handler.onStartTag(t)):(t.attrs.length>0&&this._err(ee.endTagWithAttributes),t.selfClosing&&this._err(ee.endTagWithTrailingSolidus),this.handler.onEndTag(t)),this.preprocessor.dropParsedChunk()}emitCurrentComment(t){this.prepareToken(t),this.handler.onComment(t),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(t){this.prepareToken(t),this.handler.onDoctype(t),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(t){if(this.currentCharacterToken){switch(t&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=t.startLine,this.currentCharacterToken.location.endCol=t.startCol,this.currentCharacterToken.location.endOffset=t.startOffset),this.currentCharacterToken.type){case ut.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case ut.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case ut.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){const t=this.getCurrentLocation(0);t&&(t.endLine=t.startLine,t.endCol=t.startCol,t.endOffset=t.startOffset),this._emitCurrentCharacterToken(t),this.handler.onEof({type:ut.EOF,location:t}),this.active=!1}_appendCharToCurrentCharacterToken(t,n){if(this.currentCharacterToken)if(this.currentCharacterToken.type===t){this.currentCharacterToken.chars+=n;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(t,n)}_emitCodePoint(t){const n=nT(t)?ut.WHITESPACE_CHARACTER:t===I.NULL?ut.NULL_CHARACTER:ut.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(ut.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=F.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Ir.Attribute:Ir.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===F.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===F.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===F.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case F.DATA:{this._stateData(t);break}case F.RCDATA:{this._stateRcdata(t);break}case F.RAWTEXT:{this._stateRawtext(t);break}case F.SCRIPT_DATA:{this._stateScriptData(t);break}case F.PLAINTEXT:{this._statePlaintext(t);break}case F.TAG_OPEN:{this._stateTagOpen(t);break}case F.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case F.TAG_NAME:{this._stateTagName(t);break}case F.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case F.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case F.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case F.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case F.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case F.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case F.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case F.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case F.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case F.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case F.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case F.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case F.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case F.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case F.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case F.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case F.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case F.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case F.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case F.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case F.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case F.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case F.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case F.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case F.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case F.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case F.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case F.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case F.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case F.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case F.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case F.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case F.BOGUS_COMMENT:{this._stateBogusComment(t);break}case F.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case F.COMMENT_START:{this._stateCommentStart(t);break}case F.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case F.COMMENT:{this._stateComment(t);break}case F.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case F.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case F.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case F.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case F.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case F.COMMENT_END:{this._stateCommentEnd(t);break}case F.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case F.DOCTYPE:{this._stateDoctype(t);break}case F.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case F.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case F.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case F.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case F.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case F.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case F.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case F.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case F.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case F.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case F.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case F.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case F.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case F.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case F.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case F.CDATA_SECTION:{this._stateCdataSection(t);break}case F.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case F.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case F.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case F.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case I.LESS_THAN_SIGN:{this.state=F.TAG_OPEN;break}case I.AMPERSAND:{this._startCharacterReference();break}case I.NULL:{this._err(ee.unexpectedNullCharacter),this._emitCodePoint(t);break}case I.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case I.AMPERSAND:{this._startCharacterReference();break}case I.LESS_THAN_SIGN:{this.state=F.RCDATA_LESS_THAN_SIGN;break}case I.NULL:{this._err(ee.unexpectedNullCharacter),this._emitChars($t);break}case I.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case I.LESS_THAN_SIGN:{this.state=F.RAWTEXT_LESS_THAN_SIGN;break}case I.NULL:{this._err(ee.unexpectedNullCharacter),this._emitChars($t);break}case I.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case I.LESS_THAN_SIGN:{this.state=F.SCRIPT_DATA_LESS_THAN_SIGN;break}case I.NULL:{this._err(ee.unexpectedNullCharacter),this._emitChars($t);break}case I.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case I.NULL:{this._err(ee.unexpectedNullCharacter),this._emitChars($t);break}case I.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(Ur(t))this._createStartTagToken(),this.state=F.TAG_NAME,this._stateTagName(t);else switch(t){case I.EXCLAMATION_MARK:{this.state=F.MARKUP_DECLARATION_OPEN;break}case I.SOLIDUS:{this.state=F.END_TAG_OPEN;break}case I.QUESTION_MARK:{this._err(ee.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=F.BOGUS_COMMENT,this._stateBogusComment(t);break}case I.EOF:{this._err(ee.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(ee.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=F.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(Ur(t))this._createEndTagToken(),this.state=F.TAG_NAME,this._stateTagName(t);else switch(t){case I.GREATER_THAN_SIGN:{this._err(ee.missingEndTagName),this.state=F.DATA;break}case I.EOF:{this._err(ee.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break}default:this._err(ee.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=F.BOGUS_COMMENT,this._stateBogusComment(t)}}_stateTagName(t){const n=this.currentToken;switch(t){case I.SPACE:case I.LINE_FEED:case I.TABULATION:case I.FORM_FEED:{this.state=F.BEFORE_ATTRIBUTE_NAME;break}case I.SOLIDUS:{this.state=F.SELF_CLOSING_START_TAG;break}case I.GREATER_THAN_SIGN:{this.state=F.DATA,this.emitCurrentTagToken();break}case I.NULL:{this._err(ee.unexpectedNullCharacter),n.tagName+=$t;break}case I.EOF:{this._err(ee.eofInTag),this._emitEOFToken();break}default:n.tagName+=String.fromCodePoint(Vs(t)?mo(t):t)}}_stateRcdataLessThanSign(t){t===I.SOLIDUS?this.state=F.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=F.RCDATA,this._stateRcdata(t))}_stateRcdataEndTagOpen(t){Ur(t)?(this.state=F.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(t)):(this._emitChars("</"),this.state=F.RCDATA,this._stateRcdata(t))}handleSpecialEndTag(t){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();const n=this.currentToken;switch(n.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case I.SPACE:case I.LINE_FEED:case I.TABULATION:case I.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=F.BEFORE_ATTRIBUTE_NAME,!1;case I.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=F.SELF_CLOSING_START_TAG,!1;case I.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=F.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=F.RCDATA,this._stateRcdata(t))}_stateRawtextLessThanSign(t){t===I.SOLIDUS?this.state=F.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=F.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagOpen(t){Ur(t)?(this.state=F.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(t)):(this._emitChars("</"),this.state=F.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=F.RAWTEXT,this._stateRawtext(t))}_stateScriptDataLessThanSign(t){switch(t){case I.SOLIDUS:{this.state=F.SCRIPT_DATA_END_TAG_OPEN;break}case I.EXCLAMATION_MARK:{this.state=F.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break}default:this._emitChars("<"),this.state=F.SCRIPT_DATA,this._stateScriptData(t)}}_stateScriptDataEndTagOpen(t){Ur(t)?(this.state=F.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(t)):(this._emitChars("</"),this.state=F.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=F.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStart(t){t===I.HYPHEN_MINUS?(this.state=F.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=F.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStartDash(t){t===I.HYPHEN_MINUS?(this.state=F.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=F.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscaped(t){switch(t){case I.HYPHEN_MINUS:{this.state=F.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break}case I.LESS_THAN_SIGN:{this.state=F.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case I.NULL:{this._err(ee.unexpectedNullCharacter),this._emitChars($t);break}case I.EOF:{this._err(ee.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataEscapedDash(t){switch(t){case I.HYPHEN_MINUS:{this.state=F.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break}case I.LESS_THAN_SIGN:{this.state=F.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case I.NULL:{this._err(ee.unexpectedNullCharacter),this.state=F.SCRIPT_DATA_ESCAPED,this._emitChars($t);break}case I.EOF:{this._err(ee.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=F.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedDashDash(t){switch(t){case I.HYPHEN_MINUS:{this._emitChars("-");break}case I.LESS_THAN_SIGN:{this.state=F.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case I.GREATER_THAN_SIGN:{this.state=F.SCRIPT_DATA,this._emitChars(">");break}case I.NULL:{this._err(ee.unexpectedNullCharacter),this.state=F.SCRIPT_DATA_ESCAPED,this._emitChars($t);break}case I.EOF:{this._err(ee.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=F.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===I.SOLIDUS?this.state=F.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:Ur(t)?(this._emitChars("<"),this.state=F.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=F.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){Ur(t)?(this.state=F.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("</"),this.state=F.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=F.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscapeStart(t){if(this.preprocessor.startsWith(Bn.SCRIPT,!1)&&W0(this.preprocessor.peek(Bn.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n<Bn.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=F.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=F.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscaped(t){switch(t){case I.HYPHEN_MINUS:{this.state=F.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break}case I.LESS_THAN_SIGN:{this.state=F.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case I.NULL:{this._err(ee.unexpectedNullCharacter),this._emitChars($t);break}case I.EOF:{this._err(ee.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDash(t){switch(t){case I.HYPHEN_MINUS:{this.state=F.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break}case I.LESS_THAN_SIGN:{this.state=F.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case I.NULL:{this._err(ee.unexpectedNullCharacter),this.state=F.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars($t);break}case I.EOF:{this._err(ee.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=F.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDashDash(t){switch(t){case I.HYPHEN_MINUS:{this._emitChars("-");break}case I.LESS_THAN_SIGN:{this.state=F.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case I.GREATER_THAN_SIGN:{this.state=F.SCRIPT_DATA,this._emitChars(">");break}case I.NULL:{this._err(ee.unexpectedNullCharacter),this.state=F.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars($t);break}case I.EOF:{this._err(ee.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=F.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===I.SOLIDUS?(this.state=F.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=F.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(Bn.SCRIPT,!1)&&W0(this.preprocessor.peek(Bn.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n<Bn.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=F.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=F.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateBeforeAttributeName(t){switch(t){case I.SPACE:case I.LINE_FEED:case I.TABULATION:case I.FORM_FEED:break;case I.SOLIDUS:case I.GREATER_THAN_SIGN:case I.EOF:{this.state=F.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case I.EQUALS_SIGN:{this._err(ee.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=F.ATTRIBUTE_NAME;break}default:this._createAttr(""),this.state=F.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateAttributeName(t){switch(t){case I.SPACE:case I.LINE_FEED:case I.TABULATION:case I.FORM_FEED:case I.SOLIDUS:case I.GREATER_THAN_SIGN:case I.EOF:{this._leaveAttrName(),this.state=F.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case I.EQUALS_SIGN:{this._leaveAttrName(),this.state=F.BEFORE_ATTRIBUTE_VALUE;break}case I.QUOTATION_MARK:case I.APOSTROPHE:case I.LESS_THAN_SIGN:{this._err(ee.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(t);break}case I.NULL:{this._err(ee.unexpectedNullCharacter),this.currentAttr.name+=$t;break}default:this.currentAttr.name+=String.fromCodePoint(Vs(t)?mo(t):t)}}_stateAfterAttributeName(t){switch(t){case I.SPACE:case I.LINE_FEED:case I.TABULATION:case I.FORM_FEED:break;case I.SOLIDUS:{this.state=F.SELF_CLOSING_START_TAG;break}case I.EQUALS_SIGN:{this.state=F.BEFORE_ATTRIBUTE_VALUE;break}case I.GREATER_THAN_SIGN:{this.state=F.DATA,this.emitCurrentTagToken();break}case I.EOF:{this._err(ee.eofInTag),this._emitEOFToken();break}default:this._createAttr(""),this.state=F.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateBeforeAttributeValue(t){switch(t){case I.SPACE:case I.LINE_FEED:case I.TABULATION:case I.FORM_FEED:break;case I.QUOTATION_MARK:{this.state=F.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break}case I.APOSTROPHE:{this.state=F.ATTRIBUTE_VALUE_SINGLE_QUOTED;break}case I.GREATER_THAN_SIGN:{this._err(ee.missingAttributeValue),this.state=F.DATA,this.emitCurrentTagToken();break}default:this.state=F.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(t)}}_stateAttributeValueDoubleQuoted(t){switch(t){case I.QUOTATION_MARK:{this.state=F.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case I.AMPERSAND:{this._startCharacterReference();break}case I.NULL:{this._err(ee.unexpectedNullCharacter),this.currentAttr.value+=$t;break}case I.EOF:{this._err(ee.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueSingleQuoted(t){switch(t){case I.APOSTROPHE:{this.state=F.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case I.AMPERSAND:{this._startCharacterReference();break}case I.NULL:{this._err(ee.unexpectedNullCharacter),this.currentAttr.value+=$t;break}case I.EOF:{this._err(ee.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueUnquoted(t){switch(t){case I.SPACE:case I.LINE_FEED:case I.TABULATION:case I.FORM_FEED:{this._leaveAttrValue(),this.state=F.BEFORE_ATTRIBUTE_NAME;break}case I.AMPERSAND:{this._startCharacterReference();break}case I.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=F.DATA,this.emitCurrentTagToken();break}case I.NULL:{this._err(ee.unexpectedNullCharacter),this.currentAttr.value+=$t;break}case I.QUOTATION_MARK:case I.APOSTROPHE:case I.LESS_THAN_SIGN:case I.EQUALS_SIGN:case I.GRAVE_ACCENT:{this._err(ee.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(t);break}case I.EOF:{this._err(ee.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAfterAttributeValueQuoted(t){switch(t){case I.SPACE:case I.LINE_FEED:case I.TABULATION:case I.FORM_FEED:{this._leaveAttrValue(),this.state=F.BEFORE_ATTRIBUTE_NAME;break}case I.SOLIDUS:{this._leaveAttrValue(),this.state=F.SELF_CLOSING_START_TAG;break}case I.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=F.DATA,this.emitCurrentTagToken();break}case I.EOF:{this._err(ee.eofInTag),this._emitEOFToken();break}default:this._err(ee.missingWhitespaceBetweenAttributes),this.state=F.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateSelfClosingStartTag(t){switch(t){case I.GREATER_THAN_SIGN:{const n=this.currentToken;n.selfClosing=!0,this.state=F.DATA,this.emitCurrentTagToken();break}case I.EOF:{this._err(ee.eofInTag),this._emitEOFToken();break}default:this._err(ee.unexpectedSolidusInTag),this.state=F.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateBogusComment(t){const n=this.currentToken;switch(t){case I.GREATER_THAN_SIGN:{this.state=F.DATA,this.emitCurrentComment(n);break}case I.EOF:{this.emitCurrentComment(n),this._emitEOFToken();break}case I.NULL:{this._err(ee.unexpectedNullCharacter),n.data+=$t;break}default:n.data+=String.fromCodePoint(t)}}_stateMarkupDeclarationOpen(t){this._consumeSequenceIfMatch(Bn.DASH_DASH,!0)?(this._createCommentToken(Bn.DASH_DASH.length+1),this.state=F.COMMENT_START):this._consumeSequenceIfMatch(Bn.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(Bn.DOCTYPE.length+1),this.state=F.DOCTYPE):this._consumeSequenceIfMatch(Bn.CDATA_START,!0)?this.inForeignNode?this.state=F.CDATA_SECTION:(this._err(ee.cdataInHtmlContent),this._createCommentToken(Bn.CDATA_START.length+1),this.currentToken.data="[CDATA[",this.state=F.BOGUS_COMMENT):this._ensureHibernation()||(this._err(ee.incorrectlyOpenedComment),this._createCommentToken(2),this.state=F.BOGUS_COMMENT,this._stateBogusComment(t))}_stateCommentStart(t){switch(t){case I.HYPHEN_MINUS:{this.state=F.COMMENT_START_DASH;break}case I.GREATER_THAN_SIGN:{this._err(ee.abruptClosingOfEmptyComment),this.state=F.DATA;const n=this.currentToken;this.emitCurrentComment(n);break}default:this.state=F.COMMENT,this._stateComment(t)}}_stateCommentStartDash(t){const n=this.currentToken;switch(t){case I.HYPHEN_MINUS:{this.state=F.COMMENT_END;break}case I.GREATER_THAN_SIGN:{this._err(ee.abruptClosingOfEmptyComment),this.state=F.DATA,this.emitCurrentComment(n);break}case I.EOF:{this._err(ee.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=F.COMMENT,this._stateComment(t)}}_stateComment(t){const n=this.currentToken;switch(t){case I.HYPHEN_MINUS:{this.state=F.COMMENT_END_DASH;break}case I.LESS_THAN_SIGN:{n.data+="<",this.state=F.COMMENT_LESS_THAN_SIGN;break}case I.NULL:{this._err(ee.unexpectedNullCharacter),n.data+=$t;break}case I.EOF:{this._err(ee.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+=String.fromCodePoint(t)}}_stateCommentLessThanSign(t){const n=this.currentToken;switch(t){case I.EXCLAMATION_MARK:{n.data+="!",this.state=F.COMMENT_LESS_THAN_SIGN_BANG;break}case I.LESS_THAN_SIGN:{n.data+="<";break}default:this.state=F.COMMENT,this._stateComment(t)}}_stateCommentLessThanSignBang(t){t===I.HYPHEN_MINUS?this.state=F.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=F.COMMENT,this._stateComment(t))}_stateCommentLessThanSignBangDash(t){t===I.HYPHEN_MINUS?this.state=F.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=F.COMMENT_END_DASH,this._stateCommentEndDash(t))}_stateCommentLessThanSignBangDashDash(t){t!==I.GREATER_THAN_SIGN&&t!==I.EOF&&this._err(ee.nestedComment),this.state=F.COMMENT_END,this._stateCommentEnd(t)}_stateCommentEndDash(t){const n=this.currentToken;switch(t){case I.HYPHEN_MINUS:{this.state=F.COMMENT_END;break}case I.EOF:{this._err(ee.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=F.COMMENT,this._stateComment(t)}}_stateCommentEnd(t){const n=this.currentToken;switch(t){case I.GREATER_THAN_SIGN:{this.state=F.DATA,this.emitCurrentComment(n);break}case I.EXCLAMATION_MARK:{this.state=F.COMMENT_END_BANG;break}case I.HYPHEN_MINUS:{n.data+="-";break}case I.EOF:{this._err(ee.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--",this.state=F.COMMENT,this._stateComment(t)}}_stateCommentEndBang(t){const n=this.currentToken;switch(t){case I.HYPHEN_MINUS:{n.data+="--!",this.state=F.COMMENT_END_DASH;break}case I.GREATER_THAN_SIGN:{this._err(ee.incorrectlyClosedComment),this.state=F.DATA,this.emitCurrentComment(n);break}case I.EOF:{this._err(ee.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--!",this.state=F.COMMENT,this._stateComment(t)}}_stateDoctype(t){switch(t){case I.SPACE:case I.LINE_FEED:case I.TABULATION:case I.FORM_FEED:{this.state=F.BEFORE_DOCTYPE_NAME;break}case I.GREATER_THAN_SIGN:{this.state=F.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t);break}case I.EOF:{this._err(ee.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(ee.missingWhitespaceBeforeDoctypeName),this.state=F.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t)}}_stateBeforeDoctypeName(t){if(Vs(t))this._createDoctypeToken(String.fromCharCode(mo(t))),this.state=F.DOCTYPE_NAME;else switch(t){case I.SPACE:case I.LINE_FEED:case I.TABULATION:case I.FORM_FEED:break;case I.NULL:{this._err(ee.unexpectedNullCharacter),this._createDoctypeToken($t),this.state=F.DOCTYPE_NAME;break}case I.GREATER_THAN_SIGN:{this._err(ee.missingDoctypeName),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=F.DATA;break}case I.EOF:{this._err(ee.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(t)),this.state=F.DOCTYPE_NAME}}_stateDoctypeName(t){const n=this.currentToken;switch(t){case I.SPACE:case I.LINE_FEED:case I.TABULATION:case I.FORM_FEED:{this.state=F.AFTER_DOCTYPE_NAME;break}case I.GREATER_THAN_SIGN:{this.state=F.DATA,this.emitCurrentDoctype(n);break}case I.NULL:{this._err(ee.unexpectedNullCharacter),n.name+=$t;break}case I.EOF:{this._err(ee.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.name+=String.fromCodePoint(Vs(t)?mo(t):t)}}_stateAfterDoctypeName(t){const n=this.currentToken;switch(t){case I.SPACE:case I.LINE_FEED:case I.TABULATION:case I.FORM_FEED:break;case I.GREATER_THAN_SIGN:{this.state=F.DATA,this.emitCurrentDoctype(n);break}case I.EOF:{this._err(ee.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._consumeSequenceIfMatch(Bn.PUBLIC,!1)?this.state=F.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(Bn.SYSTEM,!1)?this.state=F.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(ee.invalidCharacterSequenceAfterDoctypeName),n.forceQuirks=!0,this.state=F.BOGUS_DOCTYPE,this._stateBogusDoctype(t))}}_stateAfterDoctypePublicKeyword(t){const n=this.currentToken;switch(t){case I.SPACE:case I.LINE_FEED:case I.TABULATION:case I.FORM_FEED:{this.state=F.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break}case I.QUOTATION_MARK:{this._err(ee.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=F.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case I.APOSTROPHE:{this._err(ee.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=F.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case I.GREATER_THAN_SIGN:{this._err(ee.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=F.DATA,this.emitCurrentDoctype(n);break}case I.EOF:{this._err(ee.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(ee.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=F.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypePublicIdentifier(t){const n=this.currentToken;switch(t){case I.SPACE:case I.LINE_FEED:case I.TABULATION:case I.FORM_FEED:break;case I.QUOTATION_MARK:{n.publicId="",this.state=F.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case I.APOSTROPHE:{n.publicId="",this.state=F.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case I.GREATER_THAN_SIGN:{this._err(ee.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=F.DATA,this.emitCurrentDoctype(n);break}case I.EOF:{this._err(ee.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(ee.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=F.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypePublicIdentifierDoubleQuoted(t){const n=this.currentToken;switch(t){case I.QUOTATION_MARK:{this.state=F.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case I.NULL:{this._err(ee.unexpectedNullCharacter),n.publicId+=$t;break}case I.GREATER_THAN_SIGN:{this._err(ee.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=F.DATA;break}case I.EOF:{this._err(ee.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.publicId+=String.fromCodePoint(t)}}_stateDoctypePublicIdentifierSingleQuoted(t){const n=this.currentToken;switch(t){case I.APOSTROPHE:{this.state=F.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case I.NULL:{this._err(ee.unexpectedNullCharacter),n.publicId+=$t;break}case I.GREATER_THAN_SIGN:{this._err(ee.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=F.DATA;break}case I.EOF:{this._err(ee.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.publicId+=String.fromCodePoint(t)}}_stateAfterDoctypePublicIdentifier(t){const n=this.currentToken;switch(t){case I.SPACE:case I.LINE_FEED:case I.TABULATION:case I.FORM_FEED:{this.state=F.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break}case I.GREATER_THAN_SIGN:{this.state=F.DATA,this.emitCurrentDoctype(n);break}case I.QUOTATION_MARK:{this._err(ee.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=F.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case I.APOSTROPHE:{this._err(ee.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=F.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case I.EOF:{this._err(ee.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(ee.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=F.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBetweenDoctypePublicAndSystemIdentifiers(t){const n=this.currentToken;switch(t){case I.SPACE:case I.LINE_FEED:case I.TABULATION:case I.FORM_FEED:break;case I.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=F.DATA;break}case I.QUOTATION_MARK:{n.systemId="",this.state=F.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case I.APOSTROPHE:{n.systemId="",this.state=F.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case I.EOF:{this._err(ee.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(ee.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=F.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateAfterDoctypeSystemKeyword(t){const n=this.currentToken;switch(t){case I.SPACE:case I.LINE_FEED:case I.TABULATION:case I.FORM_FEED:{this.state=F.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break}case I.QUOTATION_MARK:{this._err(ee.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=F.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case I.APOSTROPHE:{this._err(ee.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=F.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case I.GREATER_THAN_SIGN:{this._err(ee.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=F.DATA,this.emitCurrentDoctype(n);break}case I.EOF:{this._err(ee.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(ee.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=F.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypeSystemIdentifier(t){const n=this.currentToken;switch(t){case I.SPACE:case I.LINE_FEED:case I.TABULATION:case I.FORM_FEED:break;case I.QUOTATION_MARK:{n.systemId="",this.state=F.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case I.APOSTROPHE:{n.systemId="",this.state=F.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case I.GREATER_THAN_SIGN:{this._err(ee.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=F.DATA,this.emitCurrentDoctype(n);break}case I.EOF:{this._err(ee.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(ee.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=F.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypeSystemIdentifierDoubleQuoted(t){const n=this.currentToken;switch(t){case I.QUOTATION_MARK:{this.state=F.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case I.NULL:{this._err(ee.unexpectedNullCharacter),n.systemId+=$t;break}case I.GREATER_THAN_SIGN:{this._err(ee.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=F.DATA;break}case I.EOF:{this._err(ee.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.systemId+=String.fromCodePoint(t)}}_stateDoctypeSystemIdentifierSingleQuoted(t){const n=this.currentToken;switch(t){case I.APOSTROPHE:{this.state=F.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case I.NULL:{this._err(ee.unexpectedNullCharacter),n.systemId+=$t;break}case I.GREATER_THAN_SIGN:{this._err(ee.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=F.DATA;break}case I.EOF:{this._err(ee.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.systemId+=String.fromCodePoint(t)}}_stateAfterDoctypeSystemIdentifier(t){const n=this.currentToken;switch(t){case I.SPACE:case I.LINE_FEED:case I.TABULATION:case I.FORM_FEED:break;case I.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=F.DATA;break}case I.EOF:{this._err(ee.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(ee.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=F.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBogusDoctype(t){const n=this.currentToken;switch(t){case I.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=F.DATA;break}case I.NULL:{this._err(ee.unexpectedNullCharacter);break}case I.EOF:{this.emitCurrentDoctype(n),this._emitEOFToken();break}}}_stateCdataSection(t){switch(t){case I.RIGHT_SQUARE_BRACKET:{this.state=F.CDATA_SECTION_BRACKET;break}case I.EOF:{this._err(ee.eofInCdata),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateCdataSectionBracket(t){t===I.RIGHT_SQUARE_BRACKET?this.state=F.CDATA_SECTION_END:(this._emitChars("]"),this.state=F.CDATA_SECTION,this._stateCdataSection(t))}_stateCdataSectionEnd(t){switch(t){case I.GREATER_THAN_SIGN:{this.state=F.DATA;break}case I.RIGHT_SQUARE_BRACKET:{this._emitChars("]");break}default:this._emitChars("]]"),this.state=F.CDATA_SECTION,this._stateCdataSection(t)}}_stateCharacterReference(){let t=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(t<0)if(this.preprocessor.lastChunkWritten)t=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}t===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(I.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&G0(this.preprocessor.peek(1))?F.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(t){G0(t)?this._flushCodePointConsumedAsCharacterReference(t):(t===I.SEMICOLON&&this._err(ee.unknownNamedCharacterReference),this.state=this.returnState,this._callState(t))}}const rT=new Set([h.DD,h.DT,h.LI,h.OPTGROUP,h.OPTION,h.P,h.RB,h.RP,h.RT,h.RTC]),V0=new Set([...rT,h.CAPTION,h.COLGROUP,h.TBODY,h.TD,h.TFOOT,h.TH,h.THEAD,h.TR]),Qo=new Set([h.APPLET,h.CAPTION,h.HTML,h.MARQUEE,h.OBJECT,h.TABLE,h.TD,h.TEMPLATE,h.TH]),_I=new Set([...Qo,h.OL,h.UL]),CI=new Set([...Qo,h.BUTTON]),q0=new Set([h.ANNOTATION_XML,h.MI,h.MN,h.MO,h.MS,h.MTEXT]),Y0=new Set([h.DESC,h.FOREIGN_OBJECT,h.TITLE]),kI=new Set([h.TR,h.TEMPLATE,h.HTML]),II=new Set([h.TBODY,h.TFOOT,h.THEAD,h.TEMPLATE,h.HTML]),RI=new Set([h.TABLE,h.TEMPLATE,h.HTML]),DI=new Set([h.TD,h.TH]);class OI{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(t,n,r){this.treeAdapter=n,this.handler=r,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=h.UNKNOWN,this.current=t}_indexOf(t){return this.items.lastIndexOf(t,this.stackTop)}_isInTemplate(){return this.currentTagId===h.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===ce.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(t,n){this.stackTop++,this.items[this.stackTop]=t,this.current=t,this.tagIDs[this.stackTop]=n,this.currentTagId=n,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(t,n,!0)}pop(){const t=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!0)}replace(t,n){const r=this._indexOf(t);this.items[r]=n,r===this.stackTop&&(this.current=n)}insertAfter(t,n,r){const a=this._indexOf(t)+1;this.items.splice(a,0,n),this.tagIDs.splice(a,0,r),this.stackTop++,a===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,a===this.stackTop)}popUntilTagNamePopped(t){let n=this.stackTop+1;do n=this.tagIDs.lastIndexOf(t,n-1);while(n>0&&this.treeAdapter.getNamespaceURI(this.items[n])!==ce.HTML);this.shortenToLength(Math.max(n,0))}shortenToLength(t){for(;this.stackTop>=t;){const n=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(n,this.stackTop<t)}}popUntilElementPopped(t){const n=this._indexOf(t);this.shortenToLength(Math.max(n,0))}popUntilPopped(t,n){const r=this._indexOfTagNames(t,n);this.shortenToLength(Math.max(r,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(Qc,ce.HTML)}popUntilTableCellPopped(){this.popUntilPopped(DI,ce.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(t,n){for(let r=this.stackTop;r>=0;r--)if(t.has(this.tagIDs[r])&&this.treeAdapter.getNamespaceURI(this.items[r])===n)return r;return-1}clearBackTo(t,n){const r=this._indexOfTagNames(t,n);this.shortenToLength(r+1)}clearBackToTableContext(){this.clearBackTo(RI,ce.HTML)}clearBackToTableBodyContext(){this.clearBackTo(II,ce.HTML)}clearBackToTableRowContext(){this.clearBackTo(kI,ce.HTML)}remove(t){const n=this._indexOf(t);n>=0&&(n===this.stackTop?this.pop():(this.items.splice(n,1),this.tagIDs.splice(n,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===h.BODY?this.items[1]:null}contains(t){return this._indexOf(t)>-1}getCommonAncestor(t){const n=this._indexOf(t)-1;return n>=0?this.items[n]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===h.HTML}hasInDynamicScope(t,n){for(let r=this.stackTop;r>=0;r--){const a=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case ce.HTML:{if(a===t)return!0;if(n.has(a))return!1;break}case ce.SVG:{if(Y0.has(a))return!1;break}case ce.MATHML:{if(q0.has(a))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,Qo)}hasInListItemScope(t){return this.hasInDynamicScope(t,_I)}hasInButtonScope(t){return this.hasInDynamicScope(t,CI)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const n=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case ce.HTML:{if(Qc.has(n))return!0;if(Qo.has(n))return!1;break}case ce.SVG:{if(Y0.has(n))return!1;break}case ce.MATHML:{if(q0.has(n))return!1;break}}}return!0}hasInTableScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===ce.HTML)switch(this.tagIDs[n]){case t:return!0;case h.TABLE:case h.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===ce.HTML)switch(this.tagIDs[t]){case h.TBODY:case h.THEAD:case h.TFOOT:return!0;case h.TABLE:case h.HTML:return!1}return!0}hasInSelectScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===ce.HTML)switch(this.tagIDs[n]){case t:return!0;case h.OPTION:case h.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&rT.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&V0.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&V0.has(this.currentTagId);)this.pop()}}const Gu=3;var Tr;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(Tr||(Tr={}));const Z0={type:Tr.Marker};class LI{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){const r=[],a=n.length,s=this.treeAdapter.getTagName(t),i=this.treeAdapter.getNamespaceURI(t);for(let o=0;o<this.entries.length;o++){const u=this.entries[o];if(u.type===Tr.Marker)break;const{element:c}=u;if(this.treeAdapter.getTagName(c)===s&&this.treeAdapter.getNamespaceURI(c)===i){const p=this.treeAdapter.getAttrList(c);p.length===a&&r.push({idx:o,attrs:p})}}return r}_ensureNoahArkCondition(t){if(this.entries.length<Gu)return;const n=this.treeAdapter.getAttrList(t),r=this._getNoahArkConditionCandidates(t,n);if(r.length<Gu)return;const a=new Map(n.map(i=>[i.name,i.value]));let s=0;for(let i=0;i<r.length;i++){const o=r[i];o.attrs.every(u=>a.get(u.name)===u.value)&&(s+=1,s>=Gu&&this.entries.splice(o.idx,1))}}insertMarker(){this.entries.unshift(Z0)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:Tr.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:Tr.Element,element:t,token:n})}removeEntry(t){const n=this.entries.indexOf(t);n!==-1&&this.entries.splice(n,1)}clearToLastMarker(){const t=this.entries.indexOf(Z0);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(r=>r.type===Tr.Marker||this.treeAdapter.getTagName(r.element)===t);return n&&n.type===Tr.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===Tr.Element&&n.element===t)}}const $r={createDocument(){return{nodeName:"#document",mode:tr.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:"#comment",data:e,parentNode:null}},createTextNode(e){return{nodeName:"#text",value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){const r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,r){const a=e.childNodes.find(s=>s.nodeName==="#documentType");if(a)a.name=t,a.publicId=n,a.systemId=r;else{const s={nodeName:"#documentType",name:t,publicId:n,systemId:r,parentNode:null};$r.appendChild(e,s)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){const t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){const n=e.childNodes[e.childNodes.length-1];if($r.isTextNode(n)){n.value+=t;return}}$r.appendChild(e,$r.createTextNode(t))},insertTextBefore(e,t,n){const r=e.childNodes[e.childNodes.indexOf(n)-1];r&&$r.isTextNode(r)?r.value+=t:$r.insertBefore(e,$r.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(r=>r.name));for(let r=0;r<t.length;r++)n.has(t[r].name)||e.attrs.push(t[r])},getFirstChild(e){return e.childNodes[0]},getChildNodes(e){return e.childNodes},getParentNode(e){return e.parentNode},getAttrList(e){return e.attrs},getTagName(e){return e.tagName},getNamespaceURI(e){return e.namespaceURI},getTextNodeContent(e){return e.value},getCommentNodeContent(e){return e.data},getDocumentTypeNodeName(e){return e.name},getDocumentTypeNodePublicId(e){return e.publicId},getDocumentTypeNodeSystemId(e){return e.systemId},isTextNode(e){return e.nodeName==="#text"},isCommentNode(e){return e.nodeName==="#comment"},isDocumentTypeNode(e){return e.nodeName==="#documentType"},isElementNode(e){return Object.prototype.hasOwnProperty.call(e,"tagName")},setNodeSourceCodeLocation(e,t){e.sourceCodeLocation=t},getNodeSourceCodeLocation(e){return e.sourceCodeLocation},updateNodeSourceCodeLocation(e,t){e.sourceCodeLocation={...e.sourceCodeLocation,...t}}},aT="html",FI="about:legacy-compat",MI="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",sT=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"],PI=[...sT,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],jI=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),iT=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],BI=[...iT,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function K0(e,t){return t.some(n=>e.startsWith(n))}function UI(e){return e.name===aT&&e.publicId===null&&(e.systemId===null||e.systemId===FI)}function $I(e){if(e.name!==aT)return tr.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===MI)return tr.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),jI.has(n))return tr.QUIRKS;let r=t===null?PI:sT;if(K0(n,r))return tr.QUIRKS;if(r=t===null?iT:BI,K0(n,r))return tr.LIMITED_QUIRKS}return tr.NO_QUIRKS}const X0={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},zI="definitionurl",HI="definitionURL",GI=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(e=>[e.toLowerCase(),e])),WI=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:ce.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:ce.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:ce.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:ce.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:ce.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:ce.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:ce.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:ce.XML}],["xml:space",{prefix:"xml",name:"space",namespace:ce.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:ce.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:ce.XMLNS}]]),VI=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(e=>[e.toLowerCase(),e])),qI=new Set([h.B,h.BIG,h.BLOCKQUOTE,h.BODY,h.BR,h.CENTER,h.CODE,h.DD,h.DIV,h.DL,h.DT,h.EM,h.EMBED,h.H1,h.H2,h.H3,h.H4,h.H5,h.H6,h.HEAD,h.HR,h.I,h.IMG,h.LI,h.LISTING,h.MENU,h.META,h.NOBR,h.OL,h.P,h.PRE,h.RUBY,h.S,h.SMALL,h.SPAN,h.STRONG,h.STRIKE,h.SUB,h.SUP,h.TABLE,h.TT,h.U,h.UL,h.VAR]);function YI(e){const t=e.tagID;return t===h.FONT&&e.attrs.some(({name:r})=>r===ma.COLOR||r===ma.SIZE||r===ma.FACE)||qI.has(t)}function oT(e){for(let t=0;t<e.attrs.length;t++)if(e.attrs[t].name===zI){e.attrs[t].name=HI;break}}function lT(e){for(let t=0;t<e.attrs.length;t++){const n=GI.get(e.attrs[t].name);n!=null&&(e.attrs[t].name=n)}}function Fg(e){for(let t=0;t<e.attrs.length;t++){const n=WI.get(e.attrs[t].name);n&&(e.attrs[t].prefix=n.prefix,e.attrs[t].name=n.name,e.attrs[t].namespace=n.namespace)}}function ZI(e){const t=VI.get(e.tagName);t!=null&&(e.tagName=t,e.tagID=Es(e.tagName))}function KI(e,t){return t===ce.MATHML&&(e===h.MI||e===h.MO||e===h.MN||e===h.MS||e===h.MTEXT)}function XI(e,t,n){if(t===ce.MATHML&&e===h.ANNOTATION_XML){for(let r=0;r<n.length;r++)if(n[r].name===ma.ENCODING){const a=n[r].value.toLowerCase();return a===X0.TEXT_HTML||a===X0.APPLICATION_XML}}return t===ce.SVG&&(e===h.FOREIGN_OBJECT||e===h.DESC||e===h.TITLE)}function QI(e,t,n,r){return(!r||r===ce.HTML)&&XI(e,t,n)||(!r||r===ce.MATHML)&&KI(e,t)}const JI="hidden",eR=8,tR=3;var B;(function(e){e[e.INITIAL=0]="INITIAL",e[e.BEFORE_HTML=1]="BEFORE_HTML",e[e.BEFORE_HEAD=2]="BEFORE_HEAD",e[e.IN_HEAD=3]="IN_HEAD",e[e.IN_HEAD_NO_SCRIPT=4]="IN_HEAD_NO_SCRIPT",e[e.AFTER_HEAD=5]="AFTER_HEAD",e[e.IN_BODY=6]="IN_BODY",e[e.TEXT=7]="TEXT",e[e.IN_TABLE=8]="IN_TABLE",e[e.IN_TABLE_TEXT=9]="IN_TABLE_TEXT",e[e.IN_CAPTION=10]="IN_CAPTION",e[e.IN_COLUMN_GROUP=11]="IN_COLUMN_GROUP",e[e.IN_TABLE_BODY=12]="IN_TABLE_BODY",e[e.IN_ROW=13]="IN_ROW",e[e.IN_CELL=14]="IN_CELL",e[e.IN_SELECT=15]="IN_SELECT",e[e.IN_SELECT_IN_TABLE=16]="IN_SELECT_IN_TABLE",e[e.IN_TEMPLATE=17]="IN_TEMPLATE",e[e.AFTER_BODY=18]="AFTER_BODY",e[e.IN_FRAMESET=19]="IN_FRAMESET",e[e.AFTER_FRAMESET=20]="AFTER_FRAMESET",e[e.AFTER_AFTER_BODY=21]="AFTER_AFTER_BODY",e[e.AFTER_AFTER_FRAMESET=22]="AFTER_AFTER_FRAMESET"})(B||(B={}));const nR={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},uT=new Set([h.TABLE,h.TBODY,h.TFOOT,h.THEAD,h.TR]),Q0={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:$r,onParseError:null};class Jo{constructor(t,n,r=null,a=null){this.fragmentContext=r,this.scriptHandler=a,this.currentToken=null,this.stopped=!1,this.insertionMode=B.INITIAL,this.originalInsertionMode=B.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...Q0,...t},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=n??this.treeAdapter.createDocument(),this.tokenizer=new NI(this.options,this),this.activeFormattingElements=new LI(this.treeAdapter),this.fragmentContextID=r?Es(this.treeAdapter.getTagName(r)):h.UNKNOWN,this._setContextModes(r??this.document,this.fragmentContextID),this.openElements=new OI(this.document,this.treeAdapter,this)}static parse(t,n){const r=new this(n);return r.tokenizer.write(t,!0),r.document}static getFragmentParser(t,n){const r={...Q0,...n};t??(t=r.treeAdapter.createElement(q.TEMPLATE,ce.HTML,[]));const a=r.treeAdapter.createElement("documentmock",ce.HTML,[]),s=new this(r,a,t);return s.fragmentContextID===h.TEMPLATE&&s.tmplInsertionModeStack.unshift(B.IN_TEMPLATE),s._initTokenizerForFragmentParsing(),s._insertFakeRootElement(),s._resetInsertionMode(),s._findFormInFragmentContext(),s}getFragment(){const t=this.treeAdapter.getFirstChild(this.document),n=this.treeAdapter.createDocumentFragment();return this._adoptNodes(t,n),n}_err(t,n,r){var a;if(!this.onParseError)return;const s=(a=t.location)!==null&&a!==void 0?a:nR,i={code:n,startLine:s.startLine,startCol:s.startCol,startOffset:s.startOffset,endLine:r?s.startLine:s.endLine,endCol:r?s.startCol:s.endCol,endOffset:r?s.startOffset:s.endOffset};this.onParseError(i)}onItemPush(t,n,r){var a,s;(s=(a=this.treeAdapter).onItemPush)===null||s===void 0||s.call(a,t),r&&this.openElements.stackTop>0&&this._setContextModes(t,n)}onItemPop(t,n){var r,a;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(a=(r=this.treeAdapter).onItemPop)===null||a===void 0||a.call(r,t,this.openElements.current),n){let s,i;this.openElements.stackTop===0&&this.fragmentContext?(s=this.fragmentContext,i=this.fragmentContextID):{current:s,currentTagId:i}=this.openElements,this._setContextModes(s,i)}}_setContextModes(t,n){const r=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===ce.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&t!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,t)}_switchToTextParsing(t,n){this._insertElement(t,ce.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=B.TEXT}switchToPlaintextParsing(){this.insertionMode=B.TEXT,this.originalInsertionMode=B.IN_BODY,this.tokenizer.state=Xt.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let t=this.fragmentContext;for(;t;){if(this.treeAdapter.getTagName(t)===q.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==ce.HTML))switch(this.fragmentContextID){case h.TITLE:case h.TEXTAREA:{this.tokenizer.state=Xt.RCDATA;break}case h.STYLE:case h.XMP:case h.IFRAME:case h.NOEMBED:case h.NOFRAMES:case h.NOSCRIPT:{this.tokenizer.state=Xt.RAWTEXT;break}case h.SCRIPT:{this.tokenizer.state=Xt.SCRIPT_DATA;break}case h.PLAINTEXT:{this.tokenizer.state=Xt.PLAINTEXT;break}}}_setDocumentType(t){const n=t.name||"",r=t.publicId||"",a=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,r,a),t.location){const i=this.treeAdapter.getChildNodes(this.document).find(o=>this.treeAdapter.isDocumentTypeNode(o));i&&this.treeAdapter.setNodeSourceCodeLocation(i,t.location)}}_attachElementToTree(t,n){if(this.options.sourceCodeLocationInfo){const r=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(t,r)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{const r=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(r??this.document,t)}}_appendElement(t,n){const r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location)}_insertElement(t,n){const r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location),this.openElements.push(r,t.tagID)}_insertFakeElement(t,n){const r=this.treeAdapter.createElement(t,ce.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,n)}_insertTemplate(t){const n=this.treeAdapter.createElement(t.tagName,ce.HTML,t.attrs),r=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,r),this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,null)}_insertFakeRootElement(){const t=this.treeAdapter.createElement(q.HTML,ce.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,h.HTML)}_appendCommentNode(t,n){const r=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(n,r),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,t.location)}_insertCharacters(t){let n,r;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:r}=this._findFosterParentingLocation(),r?this.treeAdapter.insertTextBefore(n,t.chars,r):this.treeAdapter.insertText(n,t.chars)):(n=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(n,t.chars)),!t.location)return;const a=this.treeAdapter.getChildNodes(n),s=r?a.lastIndexOf(r):a.length,i=a[s-1];if(this.treeAdapter.getNodeSourceCodeLocation(i)){const{endLine:u,endCol:c,endOffset:p}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(i,{endLine:u,endCol:c,endOffset:p})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(i,t.location)}_adoptNodes(t,n){for(let r=this.treeAdapter.getFirstChild(t);r;r=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(r),this.treeAdapter.appendChild(n,r)}_setEndLocation(t,n){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&n.location){const r=n.location,a=this.treeAdapter.getTagName(t),s=n.type===ut.END_TAG&&a===n.tagName?{endTag:{...r},endLine:r.endLine,endCol:r.endCol,endOffset:r.endOffset}:{endLine:r.startLine,endCol:r.startCol,endOffset:r.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,s)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let n,r;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,r=this.fragmentContextID):{current:n,currentTagId:r}=this.openElements,t.tagID===h.SVG&&this.treeAdapter.getTagName(n)===q.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===ce.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===h.MGLYPH||t.tagID===h.MALIGNMARK)&&r!==void 0&&!this._isIntegrationPoint(r,n,ce.HTML)}_processToken(t){switch(t.type){case ut.CHARACTER:{this.onCharacter(t);break}case ut.NULL_CHARACTER:{this.onNullCharacter(t);break}case ut.COMMENT:{this.onComment(t);break}case ut.DOCTYPE:{this.onDoctype(t);break}case ut.START_TAG:{this._processStartTag(t);break}case ut.END_TAG:{this.onEndTag(t);break}case ut.EOF:{this.onEof(t);break}case ut.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,r){const a=this.treeAdapter.getNamespaceURI(n),s=this.treeAdapter.getAttrList(n);return QI(t,a,s,r)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(a=>a.type===Tr.Marker||this.openElements.contains(a.element)),r=n===-1?t-1:n-1;for(let a=r;a>=0;a--){const s=this.activeFormattingElements.entries[a];this._insertElement(s.token,this.treeAdapter.getNamespaceURI(s.element)),s.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=B.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(h.P),this.openElements.popUntilTagNamePopped(h.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case h.TR:{this.insertionMode=B.IN_ROW;return}case h.TBODY:case h.THEAD:case h.TFOOT:{this.insertionMode=B.IN_TABLE_BODY;return}case h.CAPTION:{this.insertionMode=B.IN_CAPTION;return}case h.COLGROUP:{this.insertionMode=B.IN_COLUMN_GROUP;return}case h.TABLE:{this.insertionMode=B.IN_TABLE;return}case h.BODY:{this.insertionMode=B.IN_BODY;return}case h.FRAMESET:{this.insertionMode=B.IN_FRAMESET;return}case h.SELECT:{this._resetInsertionModeForSelect(t);return}case h.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case h.HTML:{this.insertionMode=this.headElement?B.AFTER_HEAD:B.BEFORE_HEAD;return}case h.TD:case h.TH:{if(t>0){this.insertionMode=B.IN_CELL;return}break}case h.HEAD:{if(t>0){this.insertionMode=B.IN_HEAD;return}break}}this.insertionMode=B.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let n=t-1;n>0;n--){const r=this.openElements.tagIDs[n];if(r===h.TEMPLATE)break;if(r===h.TABLE){this.insertionMode=B.IN_SELECT_IN_TABLE;return}}this.insertionMode=B.IN_SELECT}_isElementCausesFosterParenting(t){return uT.has(t)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let t=this.openElements.stackTop;t>=0;t--){const n=this.openElements.items[t];switch(this.openElements.tagIDs[t]){case h.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===ce.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case h.TABLE:{const r=this.treeAdapter.getParentNode(n);return r?{parent:r,beforeElement:n}:{parent:this.openElements.items[t-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(t){const n=this._findFosterParentingLocation();n.beforeElement?this.treeAdapter.insertBefore(n.parent,t,n.beforeElement):this.treeAdapter.appendChild(n.parent,t)}_isSpecialElement(t,n){const r=this.treeAdapter.getNamespaceURI(t);return SI[r].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){D2(this,t);return}switch(this.insertionMode){case B.INITIAL:{Ms(this,t);break}case B.BEFORE_HTML:{ei(this,t);break}case B.BEFORE_HEAD:{ti(this,t);break}case B.IN_HEAD:{ni(this,t);break}case B.IN_HEAD_NO_SCRIPT:{ri(this,t);break}case B.AFTER_HEAD:{ai(this,t);break}case B.IN_BODY:case B.IN_CAPTION:case B.IN_CELL:case B.IN_TEMPLATE:{dT(this,t);break}case B.TEXT:case B.IN_SELECT:case B.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case B.IN_TABLE:case B.IN_TABLE_BODY:case B.IN_ROW:{Wu(this,t);break}case B.IN_TABLE_TEXT:{bT(this,t);break}case B.IN_COLUMN_GROUP:{el(this,t);break}case B.AFTER_BODY:{tl(this,t);break}case B.AFTER_AFTER_BODY:{$o(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){R2(this,t);return}switch(this.insertionMode){case B.INITIAL:{Ms(this,t);break}case B.BEFORE_HTML:{ei(this,t);break}case B.BEFORE_HEAD:{ti(this,t);break}case B.IN_HEAD:{ni(this,t);break}case B.IN_HEAD_NO_SCRIPT:{ri(this,t);break}case B.AFTER_HEAD:{ai(this,t);break}case B.TEXT:{this._insertCharacters(t);break}case B.IN_TABLE:case B.IN_TABLE_BODY:case B.IN_ROW:{Wu(this,t);break}case B.IN_COLUMN_GROUP:{el(this,t);break}case B.AFTER_BODY:{tl(this,t);break}case B.AFTER_AFTER_BODY:{$o(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){Jc(this,t);return}switch(this.insertionMode){case B.INITIAL:case B.BEFORE_HTML:case B.BEFORE_HEAD:case B.IN_HEAD:case B.IN_HEAD_NO_SCRIPT:case B.AFTER_HEAD:case B.IN_BODY:case B.IN_TABLE:case B.IN_CAPTION:case B.IN_COLUMN_GROUP:case B.IN_TABLE_BODY:case B.IN_ROW:case B.IN_CELL:case B.IN_SELECT:case B.IN_SELECT_IN_TABLE:case B.IN_TEMPLATE:case B.IN_FRAMESET:case B.AFTER_FRAMESET:{Jc(this,t);break}case B.IN_TABLE_TEXT:{Ps(this,t);break}case B.AFTER_BODY:{uR(this,t);break}case B.AFTER_AFTER_BODY:case B.AFTER_AFTER_FRAMESET:{cR(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case B.INITIAL:{dR(this,t);break}case B.BEFORE_HEAD:case B.IN_HEAD:case B.IN_HEAD_NO_SCRIPT:case B.AFTER_HEAD:{this._err(t,ee.misplacedDoctype);break}case B.IN_TABLE_TEXT:{Ps(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,ee.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?O2(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case B.INITIAL:{Ms(this,t);break}case B.BEFORE_HTML:{pR(this,t);break}case B.BEFORE_HEAD:{mR(this,t);break}case B.IN_HEAD:{mr(this,t);break}case B.IN_HEAD_NO_SCRIPT:{bR(this,t);break}case B.AFTER_HEAD:{xR(this,t);break}case B.IN_BODY:{Rn(this,t);break}case B.IN_TABLE:{ns(this,t);break}case B.IN_TABLE_TEXT:{Ps(this,t);break}case B.IN_CAPTION:{h2(this,t);break}case B.IN_COLUMN_GROUP:{jg(this,t);break}case B.IN_TABLE_BODY:{uu(this,t);break}case B.IN_ROW:{cu(this,t);break}case B.IN_CELL:{E2(this,t);break}case B.IN_SELECT:{yT(this,t);break}case B.IN_SELECT_IN_TABLE:{y2(this,t);break}case B.IN_TEMPLATE:{S2(this,t);break}case B.AFTER_BODY:{w2(this,t);break}case B.IN_FRAMESET:{A2(this,t);break}case B.AFTER_FRAMESET:{_2(this,t);break}case B.AFTER_AFTER_BODY:{k2(this,t);break}case B.AFTER_AFTER_FRAMESET:{I2(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?L2(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case B.INITIAL:{Ms(this,t);break}case B.BEFORE_HTML:{fR(this,t);break}case B.BEFORE_HEAD:{hR(this,t);break}case B.IN_HEAD:{gR(this,t);break}case B.IN_HEAD_NO_SCRIPT:{ER(this,t);break}case B.AFTER_HEAD:{yR(this,t);break}case B.IN_BODY:{lu(this,t);break}case B.TEXT:{s2(this,t);break}case B.IN_TABLE:{bi(this,t);break}case B.IN_TABLE_TEXT:{Ps(this,t);break}case B.IN_CAPTION:{g2(this,t);break}case B.IN_COLUMN_GROUP:{b2(this,t);break}case B.IN_TABLE_BODY:{ed(this,t);break}case B.IN_ROW:{xT(this,t);break}case B.IN_CELL:{x2(this,t);break}case B.IN_SELECT:{TT(this,t);break}case B.IN_SELECT_IN_TABLE:{T2(this,t);break}case B.IN_TEMPLATE:{v2(this,t);break}case B.AFTER_BODY:{vT(this,t);break}case B.IN_FRAMESET:{N2(this,t);break}case B.AFTER_FRAMESET:{C2(this,t);break}case B.AFTER_AFTER_BODY:{$o(this,t);break}}}onEof(t){switch(this.insertionMode){case B.INITIAL:{Ms(this,t);break}case B.BEFORE_HTML:{ei(this,t);break}case B.BEFORE_HEAD:{ti(this,t);break}case B.IN_HEAD:{ni(this,t);break}case B.IN_HEAD_NO_SCRIPT:{ri(this,t);break}case B.AFTER_HEAD:{ai(this,t);break}case B.IN_BODY:case B.IN_TABLE:case B.IN_CAPTION:case B.IN_COLUMN_GROUP:case B.IN_TABLE_BODY:case B.IN_ROW:case B.IN_CELL:case B.IN_SELECT:case B.IN_SELECT_IN_TABLE:{hT(this,t);break}case B.TEXT:{i2(this,t);break}case B.IN_TABLE_TEXT:{Ps(this,t);break}case B.IN_TEMPLATE:{ST(this,t);break}case B.AFTER_BODY:case B.IN_FRAMESET:case B.AFTER_FRAMESET:case B.AFTER_AFTER_BODY:case B.AFTER_AFTER_FRAMESET:{Pg(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===I.LINE_FEED)){if(t.chars.length===1)return;t.chars=t.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(t);return}switch(this.insertionMode){case B.IN_HEAD:case B.IN_HEAD_NO_SCRIPT:case B.AFTER_HEAD:case B.TEXT:case B.IN_COLUMN_GROUP:case B.IN_SELECT:case B.IN_SELECT_IN_TABLE:case B.IN_FRAMESET:case B.AFTER_FRAMESET:{this._insertCharacters(t);break}case B.IN_BODY:case B.IN_CAPTION:case B.IN_CELL:case B.IN_TEMPLATE:case B.AFTER_BODY:case B.AFTER_AFTER_BODY:case B.AFTER_AFTER_FRAMESET:{cT(this,t);break}case B.IN_TABLE:case B.IN_TABLE_BODY:case B.IN_ROW:{Wu(this,t);break}case B.IN_TABLE_TEXT:{gT(this,t);break}}}}function rR(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):mT(e,t),n}function aR(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){const a=e.openElements.items[r];if(a===t.element)break;e._isSpecialElement(a,e.openElements.tagIDs[r])&&(n=a)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function sR(e,t,n){let r=t,a=e.openElements.getCommonAncestor(t);for(let s=0,i=a;i!==n;s++,i=a){a=e.openElements.getCommonAncestor(i);const o=e.activeFormattingElements.getElementEntry(i),u=o&&s>=tR;!o||u?(u&&e.activeFormattingElements.removeEntry(o),e.openElements.remove(i)):(i=iR(e,o),r===t&&(e.activeFormattingElements.bookmark=o),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(i,r),r=i)}return r}function iR(e,t){const n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function oR(e,t,n){const r=e.treeAdapter.getTagName(t),a=Es(r);if(e._isElementCausesFosterParenting(a))e._fosterParentElement(n);else{const s=e.treeAdapter.getNamespaceURI(t);a===h.TEMPLATE&&s===ce.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function lR(e,t,n){const r=e.treeAdapter.getNamespaceURI(n.element),{token:a}=n,s=e.treeAdapter.createElement(a.tagName,r,a.attrs);e._adoptNodes(t,s),e.treeAdapter.appendChild(t,s),e.activeFormattingElements.insertElementAfterBookmark(s,a),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,s,a.tagID)}function Mg(e,t){for(let n=0;n<eR;n++){const r=rR(e,t);if(!r)break;const a=aR(e,r);if(!a)break;e.activeFormattingElements.bookmark=r;const s=sR(e,a,r.element),i=e.openElements.getCommonAncestor(r.element);e.treeAdapter.detachNode(s),i&&oR(e,i,s),lR(e,a,r)}}function Jc(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function uR(e,t){e._appendCommentNode(t,e.openElements.items[0])}function cR(e,t){e._appendCommentNode(t,e.document)}function Pg(e,t){if(e.stopped=!0,t.location){const n=e.fragmentContext?0:2;for(let r=e.openElements.stackTop;r>=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){const r=e.openElements.items[0],a=e.treeAdapter.getNodeSourceCodeLocation(r);if(a&&!a.endTag&&(e._setEndLocation(r,t),e.openElements.stackTop>=1)){const s=e.openElements.items[1],i=e.treeAdapter.getNodeSourceCodeLocation(s);i&&!i.endTag&&e._setEndLocation(s,t)}}}}function dR(e,t){e._setDocumentType(t);const n=t.forceQuirks?tr.QUIRKS:$I(t);UI(t)||e._err(t,ee.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=B.BEFORE_HTML}function Ms(e,t){e._err(t,ee.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,tr.QUIRKS),e.insertionMode=B.BEFORE_HTML,e._processToken(t)}function pR(e,t){t.tagID===h.HTML?(e._insertElement(t,ce.HTML),e.insertionMode=B.BEFORE_HEAD):ei(e,t)}function fR(e,t){const n=t.tagID;(n===h.HTML||n===h.HEAD||n===h.BODY||n===h.BR)&&ei(e,t)}function ei(e,t){e._insertFakeRootElement(),e.insertionMode=B.BEFORE_HEAD,e._processToken(t)}function mR(e,t){switch(t.tagID){case h.HTML:{Rn(e,t);break}case h.HEAD:{e._insertElement(t,ce.HTML),e.headElement=e.openElements.current,e.insertionMode=B.IN_HEAD;break}default:ti(e,t)}}function hR(e,t){const n=t.tagID;n===h.HEAD||n===h.BODY||n===h.HTML||n===h.BR?ti(e,t):e._err(t,ee.endTagWithoutMatchingOpenElement)}function ti(e,t){e._insertFakeElement(q.HEAD,h.HEAD),e.headElement=e.openElements.current,e.insertionMode=B.IN_HEAD,e._processToken(t)}function mr(e,t){switch(t.tagID){case h.HTML:{Rn(e,t);break}case h.BASE:case h.BASEFONT:case h.BGSOUND:case h.LINK:case h.META:{e._appendElement(t,ce.HTML),t.ackSelfClosing=!0;break}case h.TITLE:{e._switchToTextParsing(t,Xt.RCDATA);break}case h.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,Xt.RAWTEXT):(e._insertElement(t,ce.HTML),e.insertionMode=B.IN_HEAD_NO_SCRIPT);break}case h.NOFRAMES:case h.STYLE:{e._switchToTextParsing(t,Xt.RAWTEXT);break}case h.SCRIPT:{e._switchToTextParsing(t,Xt.SCRIPT_DATA);break}case h.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=B.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(B.IN_TEMPLATE);break}case h.HEAD:{e._err(t,ee.misplacedStartTagForHeadElement);break}default:ni(e,t)}}function gR(e,t){switch(t.tagID){case h.HEAD:{e.openElements.pop(),e.insertionMode=B.AFTER_HEAD;break}case h.BODY:case h.BR:case h.HTML:{ni(e,t);break}case h.TEMPLATE:{ka(e,t);break}default:e._err(t,ee.endTagWithoutMatchingOpenElement)}}function ka(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==h.TEMPLATE&&e._err(t,ee.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(h.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,ee.endTagWithoutMatchingOpenElement)}function ni(e,t){e.openElements.pop(),e.insertionMode=B.AFTER_HEAD,e._processToken(t)}function bR(e,t){switch(t.tagID){case h.HTML:{Rn(e,t);break}case h.BASEFONT:case h.BGSOUND:case h.HEAD:case h.LINK:case h.META:case h.NOFRAMES:case h.STYLE:{mr(e,t);break}case h.NOSCRIPT:{e._err(t,ee.nestedNoscriptInHead);break}default:ri(e,t)}}function ER(e,t){switch(t.tagID){case h.NOSCRIPT:{e.openElements.pop(),e.insertionMode=B.IN_HEAD;break}case h.BR:{ri(e,t);break}default:e._err(t,ee.endTagWithoutMatchingOpenElement)}}function ri(e,t){const n=t.type===ut.EOF?ee.openElementsLeftAfterEof:ee.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=B.IN_HEAD,e._processToken(t)}function xR(e,t){switch(t.tagID){case h.HTML:{Rn(e,t);break}case h.BODY:{e._insertElement(t,ce.HTML),e.framesetOk=!1,e.insertionMode=B.IN_BODY;break}case h.FRAMESET:{e._insertElement(t,ce.HTML),e.insertionMode=B.IN_FRAMESET;break}case h.BASE:case h.BASEFONT:case h.BGSOUND:case h.LINK:case h.META:case h.NOFRAMES:case h.SCRIPT:case h.STYLE:case h.TEMPLATE:case h.TITLE:{e._err(t,ee.abandonedHeadElementChild),e.openElements.push(e.headElement,h.HEAD),mr(e,t),e.openElements.remove(e.headElement);break}case h.HEAD:{e._err(t,ee.misplacedStartTagForHeadElement);break}default:ai(e,t)}}function yR(e,t){switch(t.tagID){case h.BODY:case h.HTML:case h.BR:{ai(e,t);break}case h.TEMPLATE:{ka(e,t);break}default:e._err(t,ee.endTagWithoutMatchingOpenElement)}}function ai(e,t){e._insertFakeElement(q.BODY,h.BODY),e.insertionMode=B.IN_BODY,ou(e,t)}function ou(e,t){switch(t.type){case ut.CHARACTER:{dT(e,t);break}case ut.WHITESPACE_CHARACTER:{cT(e,t);break}case ut.COMMENT:{Jc(e,t);break}case ut.START_TAG:{Rn(e,t);break}case ut.END_TAG:{lu(e,t);break}case ut.EOF:{hT(e,t);break}}}function cT(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function dT(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function TR(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function SR(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function vR(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,ce.HTML),e.insertionMode=B.IN_FRAMESET)}function wR(e,t){e.openElements.hasInButtonScope(h.P)&&e._closePElement(),e._insertElement(t,ce.HTML)}function AR(e,t){e.openElements.hasInButtonScope(h.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&Qc.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,ce.HTML)}function NR(e,t){e.openElements.hasInButtonScope(h.P)&&e._closePElement(),e._insertElement(t,ce.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function _R(e,t){const n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(h.P)&&e._closePElement(),e._insertElement(t,ce.HTML),n||(e.formElement=e.openElements.current))}function CR(e,t){e.framesetOk=!1;const n=t.tagID;for(let r=e.openElements.stackTop;r>=0;r--){const a=e.openElements.tagIDs[r];if(n===h.LI&&a===h.LI||(n===h.DD||n===h.DT)&&(a===h.DD||a===h.DT)){e.openElements.generateImpliedEndTagsWithExclusion(a),e.openElements.popUntilTagNamePopped(a);break}if(a!==h.ADDRESS&&a!==h.DIV&&a!==h.P&&e._isSpecialElement(e.openElements.items[r],a))break}e.openElements.hasInButtonScope(h.P)&&e._closePElement(),e._insertElement(t,ce.HTML)}function kR(e,t){e.openElements.hasInButtonScope(h.P)&&e._closePElement(),e._insertElement(t,ce.HTML),e.tokenizer.state=Xt.PLAINTEXT}function IR(e,t){e.openElements.hasInScope(h.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(h.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,ce.HTML),e.framesetOk=!1}function RR(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(q.A);n&&(Mg(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,ce.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function DR(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ce.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function OR(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(h.NOBR)&&(Mg(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,ce.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function LR(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ce.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function FR(e,t){e.treeAdapter.getDocumentMode(e.document)!==tr.QUIRKS&&e.openElements.hasInButtonScope(h.P)&&e._closePElement(),e._insertElement(t,ce.HTML),e.framesetOk=!1,e.insertionMode=B.IN_TABLE}function pT(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,ce.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function fT(e){const t=tT(e,ma.TYPE);return t!=null&&t.toLowerCase()===JI}function MR(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,ce.HTML),fT(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function PR(e,t){e._appendElement(t,ce.HTML),t.ackSelfClosing=!0}function jR(e,t){e.openElements.hasInButtonScope(h.P)&&e._closePElement(),e._appendElement(t,ce.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function BR(e,t){t.tagName=q.IMG,t.tagID=h.IMG,pT(e,t)}function UR(e,t){e._insertElement(t,ce.HTML),e.skipNextNewLine=!0,e.tokenizer.state=Xt.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=B.TEXT}function $R(e,t){e.openElements.hasInButtonScope(h.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,Xt.RAWTEXT)}function zR(e,t){e.framesetOk=!1,e._switchToTextParsing(t,Xt.RAWTEXT)}function J0(e,t){e._switchToTextParsing(t,Xt.RAWTEXT)}function HR(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ce.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===B.IN_TABLE||e.insertionMode===B.IN_CAPTION||e.insertionMode===B.IN_TABLE_BODY||e.insertionMode===B.IN_ROW||e.insertionMode===B.IN_CELL?B.IN_SELECT_IN_TABLE:B.IN_SELECT}function GR(e,t){e.openElements.currentTagId===h.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,ce.HTML)}function WR(e,t){e.openElements.hasInScope(h.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,ce.HTML)}function VR(e,t){e.openElements.hasInScope(h.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(h.RTC),e._insertElement(t,ce.HTML)}function qR(e,t){e._reconstructActiveFormattingElements(),oT(t),Fg(t),t.selfClosing?e._appendElement(t,ce.MATHML):e._insertElement(t,ce.MATHML),t.ackSelfClosing=!0}function YR(e,t){e._reconstructActiveFormattingElements(),lT(t),Fg(t),t.selfClosing?e._appendElement(t,ce.SVG):e._insertElement(t,ce.SVG),t.ackSelfClosing=!0}function eE(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ce.HTML)}function Rn(e,t){switch(t.tagID){case h.I:case h.S:case h.B:case h.U:case h.EM:case h.TT:case h.BIG:case h.CODE:case h.FONT:case h.SMALL:case h.STRIKE:case h.STRONG:{DR(e,t);break}case h.A:{RR(e,t);break}case h.H1:case h.H2:case h.H3:case h.H4:case h.H5:case h.H6:{AR(e,t);break}case h.P:case h.DL:case h.OL:case h.UL:case h.DIV:case h.DIR:case h.NAV:case h.MAIN:case h.MENU:case h.ASIDE:case h.CENTER:case h.FIGURE:case h.FOOTER:case h.HEADER:case h.HGROUP:case h.DIALOG:case h.DETAILS:case h.ADDRESS:case h.ARTICLE:case h.SEARCH:case h.SECTION:case h.SUMMARY:case h.FIELDSET:case h.BLOCKQUOTE:case h.FIGCAPTION:{wR(e,t);break}case h.LI:case h.DD:case h.DT:{CR(e,t);break}case h.BR:case h.IMG:case h.WBR:case h.AREA:case h.EMBED:case h.KEYGEN:{pT(e,t);break}case h.HR:{jR(e,t);break}case h.RB:case h.RTC:{WR(e,t);break}case h.RT:case h.RP:{VR(e,t);break}case h.PRE:case h.LISTING:{NR(e,t);break}case h.XMP:{$R(e,t);break}case h.SVG:{YR(e,t);break}case h.HTML:{TR(e,t);break}case h.BASE:case h.LINK:case h.META:case h.STYLE:case h.TITLE:case h.SCRIPT:case h.BGSOUND:case h.BASEFONT:case h.TEMPLATE:{mr(e,t);break}case h.BODY:{SR(e,t);break}case h.FORM:{_R(e,t);break}case h.NOBR:{OR(e,t);break}case h.MATH:{qR(e,t);break}case h.TABLE:{FR(e,t);break}case h.INPUT:{MR(e,t);break}case h.PARAM:case h.TRACK:case h.SOURCE:{PR(e,t);break}case h.IMAGE:{BR(e,t);break}case h.BUTTON:{IR(e,t);break}case h.APPLET:case h.OBJECT:case h.MARQUEE:{LR(e,t);break}case h.IFRAME:{zR(e,t);break}case h.SELECT:{HR(e,t);break}case h.OPTION:case h.OPTGROUP:{GR(e,t);break}case h.NOEMBED:case h.NOFRAMES:{J0(e,t);break}case h.FRAMESET:{vR(e,t);break}case h.TEXTAREA:{UR(e,t);break}case h.NOSCRIPT:{e.options.scriptingEnabled?J0(e,t):eE(e,t);break}case h.PLAINTEXT:{kR(e,t);break}case h.COL:case h.TH:case h.TD:case h.TR:case h.HEAD:case h.FRAME:case h.TBODY:case h.TFOOT:case h.THEAD:case h.CAPTION:case h.COLGROUP:break;default:eE(e,t)}}function ZR(e,t){if(e.openElements.hasInScope(h.BODY)&&(e.insertionMode=B.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function KR(e,t){e.openElements.hasInScope(h.BODY)&&(e.insertionMode=B.AFTER_BODY,vT(e,t))}function XR(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function QR(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(h.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(h.FORM):n&&e.openElements.remove(n))}function JR(e){e.openElements.hasInButtonScope(h.P)||e._insertFakeElement(q.P,h.P),e._closePElement()}function e2(e){e.openElements.hasInListItemScope(h.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(h.LI),e.openElements.popUntilTagNamePopped(h.LI))}function t2(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function n2(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function r2(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function a2(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(q.BR,h.BR),e.openElements.pop(),e.framesetOk=!1}function mT(e,t){const n=t.tagName,r=t.tagID;for(let a=e.openElements.stackTop;a>0;a--){const s=e.openElements.items[a],i=e.openElements.tagIDs[a];if(r===i&&(r!==h.UNKNOWN||e.treeAdapter.getTagName(s)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=a&&e.openElements.shortenToLength(a);break}if(e._isSpecialElement(s,i))break}}function lu(e,t){switch(t.tagID){case h.A:case h.B:case h.I:case h.S:case h.U:case h.EM:case h.TT:case h.BIG:case h.CODE:case h.FONT:case h.NOBR:case h.SMALL:case h.STRIKE:case h.STRONG:{Mg(e,t);break}case h.P:{JR(e);break}case h.DL:case h.UL:case h.OL:case h.DIR:case h.DIV:case h.NAV:case h.PRE:case h.MAIN:case h.MENU:case h.ASIDE:case h.BUTTON:case h.CENTER:case h.FIGURE:case h.FOOTER:case h.HEADER:case h.HGROUP:case h.DIALOG:case h.ADDRESS:case h.ARTICLE:case h.DETAILS:case h.SEARCH:case h.SECTION:case h.SUMMARY:case h.LISTING:case h.FIELDSET:case h.BLOCKQUOTE:case h.FIGCAPTION:{XR(e,t);break}case h.LI:{e2(e);break}case h.DD:case h.DT:{t2(e,t);break}case h.H1:case h.H2:case h.H3:case h.H4:case h.H5:case h.H6:{n2(e);break}case h.BR:{a2(e);break}case h.BODY:{ZR(e,t);break}case h.HTML:{KR(e,t);break}case h.FORM:{QR(e);break}case h.APPLET:case h.OBJECT:case h.MARQUEE:{r2(e,t);break}case h.TEMPLATE:{ka(e,t);break}default:mT(e,t)}}function hT(e,t){e.tmplInsertionModeStack.length>0?ST(e,t):Pg(e,t)}function s2(e,t){var n;t.tagID===h.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function i2(e,t){e._err(t,ee.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function Wu(e,t){if(e.openElements.currentTagId!==void 0&&uT.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=B.IN_TABLE_TEXT,t.type){case ut.CHARACTER:{bT(e,t);break}case ut.WHITESPACE_CHARACTER:{gT(e,t);break}}else Vi(e,t)}function o2(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,ce.HTML),e.insertionMode=B.IN_CAPTION}function l2(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,ce.HTML),e.insertionMode=B.IN_COLUMN_GROUP}function u2(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(q.COLGROUP,h.COLGROUP),e.insertionMode=B.IN_COLUMN_GROUP,jg(e,t)}function c2(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,ce.HTML),e.insertionMode=B.IN_TABLE_BODY}function d2(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(q.TBODY,h.TBODY),e.insertionMode=B.IN_TABLE_BODY,uu(e,t)}function p2(e,t){e.openElements.hasInTableScope(h.TABLE)&&(e.openElements.popUntilTagNamePopped(h.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function f2(e,t){fT(t)?e._appendElement(t,ce.HTML):Vi(e,t),t.ackSelfClosing=!0}function m2(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,ce.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function ns(e,t){switch(t.tagID){case h.TD:case h.TH:case h.TR:{d2(e,t);break}case h.STYLE:case h.SCRIPT:case h.TEMPLATE:{mr(e,t);break}case h.COL:{u2(e,t);break}case h.FORM:{m2(e,t);break}case h.TABLE:{p2(e,t);break}case h.TBODY:case h.TFOOT:case h.THEAD:{c2(e,t);break}case h.INPUT:{f2(e,t);break}case h.CAPTION:{o2(e,t);break}case h.COLGROUP:{l2(e,t);break}default:Vi(e,t)}}function bi(e,t){switch(t.tagID){case h.TABLE:{e.openElements.hasInTableScope(h.TABLE)&&(e.openElements.popUntilTagNamePopped(h.TABLE),e._resetInsertionMode());break}case h.TEMPLATE:{ka(e,t);break}case h.BODY:case h.CAPTION:case h.COL:case h.COLGROUP:case h.HTML:case h.TBODY:case h.TD:case h.TFOOT:case h.TH:case h.THEAD:case h.TR:break;default:Vi(e,t)}}function Vi(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,ou(e,t),e.fosterParentingEnabled=n}function gT(e,t){e.pendingCharacterTokens.push(t)}function bT(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function Ps(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)Vi(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}const ET=new Set([h.CAPTION,h.COL,h.COLGROUP,h.TBODY,h.TD,h.TFOOT,h.TH,h.THEAD,h.TR]);function h2(e,t){const n=t.tagID;ET.has(n)?e.openElements.hasInTableScope(h.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(h.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=B.IN_TABLE,ns(e,t)):Rn(e,t)}function g2(e,t){const n=t.tagID;switch(n){case h.CAPTION:case h.TABLE:{e.openElements.hasInTableScope(h.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(h.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=B.IN_TABLE,n===h.TABLE&&bi(e,t));break}case h.BODY:case h.COL:case h.COLGROUP:case h.HTML:case h.TBODY:case h.TD:case h.TFOOT:case h.TH:case h.THEAD:case h.TR:break;default:lu(e,t)}}function jg(e,t){switch(t.tagID){case h.HTML:{Rn(e,t);break}case h.COL:{e._appendElement(t,ce.HTML),t.ackSelfClosing=!0;break}case h.TEMPLATE:{mr(e,t);break}default:el(e,t)}}function b2(e,t){switch(t.tagID){case h.COLGROUP:{e.openElements.currentTagId===h.COLGROUP&&(e.openElements.pop(),e.insertionMode=B.IN_TABLE);break}case h.TEMPLATE:{ka(e,t);break}case h.COL:break;default:el(e,t)}}function el(e,t){e.openElements.currentTagId===h.COLGROUP&&(e.openElements.pop(),e.insertionMode=B.IN_TABLE,e._processToken(t))}function uu(e,t){switch(t.tagID){case h.TR:{e.openElements.clearBackToTableBodyContext(),e._insertElement(t,ce.HTML),e.insertionMode=B.IN_ROW;break}case h.TH:case h.TD:{e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(q.TR,h.TR),e.insertionMode=B.IN_ROW,cu(e,t);break}case h.CAPTION:case h.COL:case h.COLGROUP:case h.TBODY:case h.TFOOT:case h.THEAD:{e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=B.IN_TABLE,ns(e,t));break}default:ns(e,t)}}function ed(e,t){const n=t.tagID;switch(t.tagID){case h.TBODY:case h.TFOOT:case h.THEAD:{e.openElements.hasInTableScope(n)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=B.IN_TABLE);break}case h.TABLE:{e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=B.IN_TABLE,bi(e,t));break}case h.BODY:case h.CAPTION:case h.COL:case h.COLGROUP:case h.HTML:case h.TD:case h.TH:case h.TR:break;default:bi(e,t)}}function cu(e,t){switch(t.tagID){case h.TH:case h.TD:{e.openElements.clearBackToTableRowContext(),e._insertElement(t,ce.HTML),e.insertionMode=B.IN_CELL,e.activeFormattingElements.insertMarker();break}case h.CAPTION:case h.COL:case h.COLGROUP:case h.TBODY:case h.TFOOT:case h.THEAD:case h.TR:{e.openElements.hasInTableScope(h.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=B.IN_TABLE_BODY,uu(e,t));break}default:ns(e,t)}}function xT(e,t){switch(t.tagID){case h.TR:{e.openElements.hasInTableScope(h.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=B.IN_TABLE_BODY);break}case h.TABLE:{e.openElements.hasInTableScope(h.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=B.IN_TABLE_BODY,ed(e,t));break}case h.TBODY:case h.TFOOT:case h.THEAD:{(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(h.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=B.IN_TABLE_BODY,ed(e,t));break}case h.BODY:case h.CAPTION:case h.COL:case h.COLGROUP:case h.HTML:case h.TD:case h.TH:break;default:bi(e,t)}}function E2(e,t){const n=t.tagID;ET.has(n)?(e.openElements.hasInTableScope(h.TD)||e.openElements.hasInTableScope(h.TH))&&(e._closeTableCell(),cu(e,t)):Rn(e,t)}function x2(e,t){const n=t.tagID;switch(n){case h.TD:case h.TH:{e.openElements.hasInTableScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=B.IN_ROW);break}case h.TABLE:case h.TBODY:case h.TFOOT:case h.THEAD:case h.TR:{e.openElements.hasInTableScope(n)&&(e._closeTableCell(),xT(e,t));break}case h.BODY:case h.CAPTION:case h.COL:case h.COLGROUP:case h.HTML:break;default:lu(e,t)}}function yT(e,t){switch(t.tagID){case h.HTML:{Rn(e,t);break}case h.OPTION:{e.openElements.currentTagId===h.OPTION&&e.openElements.pop(),e._insertElement(t,ce.HTML);break}case h.OPTGROUP:{e.openElements.currentTagId===h.OPTION&&e.openElements.pop(),e.openElements.currentTagId===h.OPTGROUP&&e.openElements.pop(),e._insertElement(t,ce.HTML);break}case h.HR:{e.openElements.currentTagId===h.OPTION&&e.openElements.pop(),e.openElements.currentTagId===h.OPTGROUP&&e.openElements.pop(),e._appendElement(t,ce.HTML),t.ackSelfClosing=!0;break}case h.INPUT:case h.KEYGEN:case h.TEXTAREA:case h.SELECT:{e.openElements.hasInSelectScope(h.SELECT)&&(e.openElements.popUntilTagNamePopped(h.SELECT),e._resetInsertionMode(),t.tagID!==h.SELECT&&e._processStartTag(t));break}case h.SCRIPT:case h.TEMPLATE:{mr(e,t);break}}}function TT(e,t){switch(t.tagID){case h.OPTGROUP:{e.openElements.stackTop>0&&e.openElements.currentTagId===h.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===h.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===h.OPTGROUP&&e.openElements.pop();break}case h.OPTION:{e.openElements.currentTagId===h.OPTION&&e.openElements.pop();break}case h.SELECT:{e.openElements.hasInSelectScope(h.SELECT)&&(e.openElements.popUntilTagNamePopped(h.SELECT),e._resetInsertionMode());break}case h.TEMPLATE:{ka(e,t);break}}}function y2(e,t){const n=t.tagID;n===h.CAPTION||n===h.TABLE||n===h.TBODY||n===h.TFOOT||n===h.THEAD||n===h.TR||n===h.TD||n===h.TH?(e.openElements.popUntilTagNamePopped(h.SELECT),e._resetInsertionMode(),e._processStartTag(t)):yT(e,t)}function T2(e,t){const n=t.tagID;n===h.CAPTION||n===h.TABLE||n===h.TBODY||n===h.TFOOT||n===h.THEAD||n===h.TR||n===h.TD||n===h.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(h.SELECT),e._resetInsertionMode(),e.onEndTag(t)):TT(e,t)}function S2(e,t){switch(t.tagID){case h.BASE:case h.BASEFONT:case h.BGSOUND:case h.LINK:case h.META:case h.NOFRAMES:case h.SCRIPT:case h.STYLE:case h.TEMPLATE:case h.TITLE:{mr(e,t);break}case h.CAPTION:case h.COLGROUP:case h.TBODY:case h.TFOOT:case h.THEAD:{e.tmplInsertionModeStack[0]=B.IN_TABLE,e.insertionMode=B.IN_TABLE,ns(e,t);break}case h.COL:{e.tmplInsertionModeStack[0]=B.IN_COLUMN_GROUP,e.insertionMode=B.IN_COLUMN_GROUP,jg(e,t);break}case h.TR:{e.tmplInsertionModeStack[0]=B.IN_TABLE_BODY,e.insertionMode=B.IN_TABLE_BODY,uu(e,t);break}case h.TD:case h.TH:{e.tmplInsertionModeStack[0]=B.IN_ROW,e.insertionMode=B.IN_ROW,cu(e,t);break}default:e.tmplInsertionModeStack[0]=B.IN_BODY,e.insertionMode=B.IN_BODY,Rn(e,t)}}function v2(e,t){t.tagID===h.TEMPLATE&&ka(e,t)}function ST(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(h.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):Pg(e,t)}function w2(e,t){t.tagID===h.HTML?Rn(e,t):tl(e,t)}function vT(e,t){var n;if(t.tagID===h.HTML){if(e.fragmentContext||(e.insertionMode=B.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===h.HTML){e._setEndLocation(e.openElements.items[0],t);const r=e.openElements.items[1];r&&!(!((n=e.treeAdapter.getNodeSourceCodeLocation(r))===null||n===void 0)&&n.endTag)&&e._setEndLocation(r,t)}}else tl(e,t)}function tl(e,t){e.insertionMode=B.IN_BODY,ou(e,t)}function A2(e,t){switch(t.tagID){case h.HTML:{Rn(e,t);break}case h.FRAMESET:{e._insertElement(t,ce.HTML);break}case h.FRAME:{e._appendElement(t,ce.HTML),t.ackSelfClosing=!0;break}case h.NOFRAMES:{mr(e,t);break}}}function N2(e,t){t.tagID===h.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==h.FRAMESET&&(e.insertionMode=B.AFTER_FRAMESET))}function _2(e,t){switch(t.tagID){case h.HTML:{Rn(e,t);break}case h.NOFRAMES:{mr(e,t);break}}}function C2(e,t){t.tagID===h.HTML&&(e.insertionMode=B.AFTER_AFTER_FRAMESET)}function k2(e,t){t.tagID===h.HTML?Rn(e,t):$o(e,t)}function $o(e,t){e.insertionMode=B.IN_BODY,ou(e,t)}function I2(e,t){switch(t.tagID){case h.HTML:{Rn(e,t);break}case h.NOFRAMES:{mr(e,t);break}}}function R2(e,t){t.chars=$t,e._insertCharacters(t)}function D2(e,t){e._insertCharacters(t),e.framesetOk=!1}function wT(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==ce.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function O2(e,t){if(YI(t))wT(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===ce.MATHML?oT(t):r===ce.SVG&&(ZI(t),lT(t)),Fg(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function L2(e,t){if(t.tagID===h.P||t.tagID===h.BR){wT(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){const r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===ce.HTML){e._endTagOutsideForeignContent(t);break}const a=e.treeAdapter.getTagName(r);if(a.toLowerCase()===t.tagName){t.tagName=a,e.openElements.shortenToLength(n);break}}}q.AREA,q.BASE,q.BASEFONT,q.BGSOUND,q.BR,q.COL,q.EMBED,q.FRAME,q.HR,q.IMG,q.INPUT,q.KEYGEN,q.LINK,q.META,q.PARAM,q.SOURCE,q.TRACK,q.WBR;function F2(e,t){return Jo.parse(e,t)}function M2(e,t,n){typeof e=="string"&&(n=t,t=e,e=null);const r=Jo.getFragmentParser(e,n);return r.tokenizer.write(t,!0),r.getFragment()}const du=AT("end"),Ar=AT("start");function AT(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function P2(e){const t=Ar(e),n=du(e);if(t&&n)return{start:t,end:n}}const j2=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,B2=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),tE={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function NT(e,t){const n=Z2(e),r=au("type",{handlers:{root:U2,element:$2,text:z2,comment:CT,doctype:H2,raw:W2},unknown:V2}),a={parser:n?new Jo(tE):Jo.getFragmentParser(void 0,tE),handle(o){r(o,a)},stitches:!1,options:t||{}};r(e,a),xs(a,Ar());const s=n?a.parser.document:a.parser.getFragment(),i=Y1(s,{file:a.options.file});return a.stitches&&$n(i,"comment",function(o,u,c){const p=o;if(p.value.stitch&&c&&u!==void 0){const d=c.children;return d[u]=p.value.stitch,u}}),i.type==="root"&&i.children.length===1&&i.children[0].type===e.type?i.children[0]:i}function _T(e,t){let n=-1;if(e)for(;++n<e.length;)t.handle(e[n])}function U2(e,t){_T(e.children,t)}function $2(e,t){q2(e,t),_T(e.children,t),Y2(e,t)}function z2(e,t){t.parser.tokenizer.state>4&&(t.parser.tokenizer.state=0);const n={type:ut.CHARACTER,chars:e.value,location:qi(e)};xs(t,Ar(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function H2(e,t){const n={type:ut.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:qi(e)};xs(t,Ar(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function G2(e,t){t.stitches=!0;const n=K2(e);if("children"in e&&"children"in n){const r=NT({type:"root",children:e.children},t.options);n.children=r.children}CT({type:"comment",value:{stitch:n}},t)}function CT(e,t){const n=e.value,r={type:ut.COMMENT,data:n,location:qi(e)};xs(t,Ar(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function W2(e,t){if(t.parser.tokenizer.preprocessor.html="",t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,kT(t,Ar(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(j2,"<$1$2"):e.value,!1),t.parser.tokenizer._runParsingLoop(),t.parser.tokenizer.state===72||t.parser.tokenizer.state===78){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;const n=t.parser.tokenizer._consume();t.parser.tokenizer._callState(n)}}function V2(e,t){const n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))G2(n,t);else{let r="";throw B2.has(n.type)&&(r=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),new Error("Cannot compile `"+n.type+"` node"+r)}}function xs(e,t){kT(e,t);const n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=Xt.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:"",value:""}}function kT(e,t){if(t&&t.offset!==void 0){const n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function q2(e,t){const n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===Xt.PLAINTEXT)return;xs(t,Ar(e));const r=t.parser.openElements.current;let a="namespaceURI"in r?r.namespaceURI:ca.html;a===ca.html&&n==="svg"&&(a=ca.svg);const s=Jk({...e,children:[]},{space:a===ca.svg?"svg":"html"}),i={type:ut.START_TAG,tagName:n,tagID:Es(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in s?s.attrs:[],location:qi(e)};t.parser.currentToken=i,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function Y2(e,t){const n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&X1.includes(n)||t.parser.tokenizer.state===Xt.PLAINTEXT)return;xs(t,du(e));const r={type:ut.END_TAG,tagName:n,tagID:Es(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:qi(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===Xt.RCDATA||t.parser.tokenizer.state===Xt.RAWTEXT||t.parser.tokenizer.state===Xt.SCRIPT_DATA)&&(t.parser.tokenizer.state=Xt.DATA)}function Z2(e){const t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function qi(e){const t=Ar(e)||{line:void 0,column:void 0,offset:void 0},n=du(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}function K2(e){return"children"in e?ga({...e,children:[]}):ga(e)}function IT(e){return function(t,n){return NT(t,{...e,file:n})}}function Ei(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}const X2=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Q2=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,J2={};function nE(e,t){return(J2.jsx?Q2:X2).test(e)}var Fa={},Vu,rE;function eD(){if(rE)return Vu;rE=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,i=/^[;\s]*/,o=/^\s+|\s+$/g,u=`
|
|
17
17
|
`,c="/",p="*",d="",f="comment",m="declaration";function b(x,y){if(typeof x!="string")throw new TypeError("First argument must be a string");if(!x)return[];y=y||{};var S=1,w=1;function A(G){var $=G.match(t);$&&(S+=$.length);var te=G.lastIndexOf(u);w=~te?G.length-te:w+G.length}function D(){var G={line:S,column:w};return function($){return $.position=new N(G),R(),$}}function N(G){this.start=G,this.end={line:S,column:w},this.source=y.source}N.prototype.content=x;function T(G){var $=new Error(y.source+":"+S+":"+w+": "+G);if($.reason=G,$.filename=y.source,$.line=S,$.column=w,$.source=x,!y.silent)throw $}function v(G){var $=G.exec(x);if($){var te=$[0];return A(te),x=x.slice(te.length),$}}function R(){v(n)}function C(G){var $;for(G=G||[];$=U();)$!==!1&&G.push($);return G}function U(){var G=D();if(!(c!=x.charAt(0)||p!=x.charAt(1))){for(var $=2;d!=x.charAt($)&&(p!=x.charAt($)||c!=x.charAt($+1));)++$;if($+=2,d===x.charAt($-1))return T("End of comment missing");var te=x.slice(2,$-2);return w+=2,A(te),x=x.slice($),w+=2,G({type:f,comment:te})}}function k(){var G=D(),$=v(r);if($){if(U(),!v(a))return T("property missing ':'");var te=v(s),H=G({type:m,property:E($[0].replace(e,d)),value:te?E(te[0].replace(e,d)):d});return v(i),H}}function j(){var G=[];C(G);for(var $;$=k();)$!==!1&&(G.push($),C(G));return G}return R(),j()}function E(x){return x?x.replace(o,d):d}return Vu=b,Vu}var aE;function tD(){if(aE)return Fa;aE=1;var e=Fa&&Fa.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Fa,"__esModule",{value:!0}),Fa.default=n;const t=e(eD());function n(r,a){let s=null;if(!r||typeof r!="string")return s;const i=(0,t.default)(r),o=typeof a=="function";return i.forEach(u=>{if(u.type!=="declaration")return;const{property:c,value:p}=u;o?a(c,p,u):p&&(s=s||{},s[c]=p)}),s}return Fa}var js={},sE;function nD(){if(sE)return js;sE=1,Object.defineProperty(js,"__esModule",{value:!0}),js.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,s=function(c){return!c||n.test(c)||e.test(c)},i=function(c,p){return p.toUpperCase()},o=function(c,p){return"".concat(p,"-")},u=function(c,p){return p===void 0&&(p={}),s(c)?c:(c=c.toLowerCase(),p.reactCompat?c=c.replace(a,o):c=c.replace(r,o),c.replace(t,i))};return js.camelCase=u,js}var Bs,iE;function rD(){if(iE)return Bs;iE=1;var e=Bs&&Bs.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(tD()),n=nD();function r(a,s){var i={};return!a||typeof a!="string"||(0,t.default)(a,function(o,u){o&&u&&(i[(0,n.camelCase)(o,s)]=u)}),i}return r.default=r,Bs=r,Bs}var aD=rD();const sD=kl(aD);function si(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?oE(e.position):"start"in e||"end"in e?oE(e):"line"in e||"column"in e?td(e):""}function td(e){return lE(e&&e.line)+":"+lE(e&&e.column)}function oE(e){return td(e&&e.start)+"-"+td(e&&e.end)}function lE(e){return e&&typeof e=="number"?e:1}class Nn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",s={},i=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?a=t:!s.cause&&t&&(i=!0,a=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?s.ruleId=r:(s.source=r.slice(0,u),s.ruleId=r.slice(u+1))}if(!s.place&&s.ancestors&&s.ancestors){const u=s.ancestors[s.ancestors.length-1];u&&(s.place=u.position)}const o=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=o?o.line:void 0,this.name=si(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=i&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Nn.prototype.file="";Nn.prototype.name="";Nn.prototype.reason="";Nn.prototype.message="";Nn.prototype.stack="";Nn.prototype.column=void 0;Nn.prototype.line=void 0;Nn.prototype.ancestors=void 0;Nn.prototype.cause=void 0;Nn.prototype.fatal=void 0;Nn.prototype.place=void 0;Nn.prototype.ruleId=void 0;Nn.prototype.source=void 0;const Bg={}.hasOwnProperty,iD=new Map,oD=/[A-Z]/g,lD=new Set(["table","tbody","thead","tfoot","tr"]),uD=new Set(["td","th"]),RT="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function cD(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=ED(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=bD(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?fr:Ca,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=DT(a,e,void 0);return s&&typeof s!="string"?s:a.create(e,a.Fragment,{children:s||void 0},void 0)}function DT(e,t,n){if(t.type==="element")return dD(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return pD(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return mD(e,t,n);if(t.type==="mdxjsEsm")return fD(e,t);if(t.type==="root")return hD(e,t,n);if(t.type==="text")return gD(e,t)}function dD(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=fr,e.schema=a),e.ancestors.push(t);const s=LT(e,t.tagName,!1),i=xD(e,t);let o=$g(e,t);return lD.has(t.tagName)&&(o=o.filter(function(u){return typeof u=="string"?!Wi(u):!0})),OT(e,i,s,t),Ug(i,o),e.ancestors.pop(),e.schema=r,e.create(t,s,i,n)}function pD(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}xi(e,t.position)}function fD(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);xi(e,t.position)}function mD(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=fr,e.schema=a),e.ancestors.push(t);const s=t.name===null?e.Fragment:LT(e,t.name,!0),i=yD(e,t),o=$g(e,t);return OT(e,i,s,t),Ug(i,o),e.ancestors.pop(),e.schema=r,e.create(t,s,i,n)}function hD(e,t,n){const r={};return Ug(r,$g(e,t)),e.create(t,e.Fragment,r,n)}function gD(e,t){return t.value}function OT(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Ug(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function bD(e,t,n){return r;function r(a,s,i,o){const c=Array.isArray(i.children)?n:t;return o?c(s,i,o):c(s,i)}}function ED(e,t){return n;function n(r,a,s,i){const o=Array.isArray(s.children),u=Ar(r);return t(a,s,i,o,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function xD(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&Bg.call(t.properties,a)){const s=TD(e,a,t.properties[a]);if(s){const[i,o]=s;e.tableCellAlignToStyle&&i==="align"&&typeof o=="string"&&uD.has(t.tagName)?r=o:n[i]=o}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function yD(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const i=s.expression;i.type;const o=i.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else xi(e,t.position);else{const a=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,s=e.evaluater.evaluateExpression(o.expression)}else xi(e,t.position);else s=r.value===null?!0:r.value;n[a]=s}return n}function $g(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:iD;for(;++r<t.children.length;){const s=t.children[r];let i;if(e.passKeys){const u=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(u){const c=a.get(u)||0;i=u+"-"+c,a.set(u,c+1)}}const o=DT(e,s,i);o!==void 0&&n.push(o)}return n}function TD(e,t,n){const r=hs(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Jl(n):eu(n)),r.property==="style"){let a=typeof n=="object"?n:SD(e,String(n));return e.stylePropertyNameCase==="css"&&(a=vD(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&r.space?W_[r.property]||r.property:r.attribute,n]}}function SD(e,t){try{return sD(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,a=new Nn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=RT+"#cannot-parse-style-attribute",a}}function LT(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let s=-1,i;for(;++s<a.length;){const o=nE(a[s])?{type:"Identifier",name:a[s]}:{type:"Literal",value:a[s]};i=i?{type:"MemberExpression",object:i,property:o,computed:!!(s&&o.type==="Literal"),optional:!1}:o}r=i}else r=nE(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const a=r.value;return Bg.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(r);xi(e)}function xi(e,t){const n=new Nn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=RT+"#cannot-handle-mdx-estrees-without-createevaluater",n}function vD(e){const t={};let n;for(n in e)Bg.call(e,n)&&(t[wD(n)]=e[n]);return t}function wD(e){let t=e.replace(oD,AD);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function AD(e){return"-"+e.toLowerCase()}const qu={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},ND={};function zg(e,t){const n=ND,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return FT(e,r,a)}function FT(e,t,n){if(_D(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 uE(e.children,t,n)}return Array.isArray(e)?uE(e,t,n):""}function uE(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=FT(e[a],t,n);return r.join("")}function _D(e){return!!(e&&typeof e=="object")}function Vn(e,t,n,r){const a=e.length;let s=0,i;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)i=Array.from(r),i.unshift(t,n),e.splice(...i);else for(n&&e.splice(t,n);s<r.length;)i=r.slice(s,s+1e4),i.unshift(t,0),e.splice(...i),s+=1e4,t+=1e4}function nr(e,t){return e.length>0?(Vn(e,e.length,0,t),e):t}const cE={}.hasOwnProperty;function MT(e){const t={};let n=-1;for(;++n<e.length;)CD(t,e[n]);return t}function CD(e,t){let n;for(n in t){const a=(cE.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let i;if(s)for(i in s){cE.call(a,i)||(a[i]=[]);const o=s[i];kD(a[i],Array.isArray(o)?o:o?[o]:[])}}}function kD(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Vn(e,0,0,r)}function PT(e,t){const 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 lr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Fn=na(/[A-Za-z]/),In=na(/[\dA-Za-z]/),ID=na(/[#-'*+\--9=?A-Z^-~]/);function nl(e){return e!==null&&(e<32||e===127)}const nd=na(/\d/),RD=na(/[\dA-Fa-f]/),DD=na(/[!-/:-@[-`{-~]/);function He(e){return e!==null&&e<-2}function Pt(e){return e!==null&&(e<0||e===32)}function dt(e){return e===-2||e===-1||e===32}const pu=na(/\p{P}|\p{S}/u),ba=na(/\s/);function na(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function ys(e){const t=[];let n=-1,r=0,a=0;for(;++n<e.length;){const s=e.charCodeAt(n);let i="";if(s===37&&In(e.charCodeAt(n+1))&&In(e.charCodeAt(n+2)))a=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(i=String.fromCharCode(s));else if(s>55295&&s<57344){const o=e.charCodeAt(n+1);s<56320&&o>56319&&o<57344?(i=String.fromCharCode(s,o),a=1):i="�"}else i=String.fromCharCode(s);i&&(t.push(e.slice(r,n),encodeURIComponent(i)),r=n+a+1,i=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function xt(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let s=0;return i;function i(u){return dt(u)?(e.enter(n),o(u)):t(u)}function o(u){return dt(u)&&s++<a?(e.consume(u),o):(e.exit(n),t(u))}}const OD={tokenize:LD};function LD(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),xt(e,t,"linePrefix")}function a(o){return e.enter("paragraph"),s(o)}function s(o){const u=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,i(o)}function i(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return He(o)?(e.consume(o),e.exit("chunkText"),s):(e.consume(o),i)}}const FD={tokenize:MD},dE={tokenize:PD};function MD(e){const t=this,n=[];let r=0,a,s,i;return o;function o(w){if(r<n.length){const A=n[r];return t.containerState=A[1],e.attempt(A[0].continuation,u,c)(w)}return c(w)}function u(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&S();const A=t.events.length;let D=A,N;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){N=t.events[D][1].end;break}y(r);let T=A;for(;T<t.events.length;)t.events[T][1].end={...N},T++;return Vn(t.events,D+1,0,t.events.slice(A)),t.events.length=T,c(w)}return o(w)}function c(w){if(r===n.length){if(!a)return f(w);if(a.currentConstruct&&a.currentConstruct.concrete)return b(w);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(dE,p,d)(w)}function p(w){return a&&S(),y(r),f(w)}function d(w){return t.parser.lazy[t.now().line]=r!==n.length,i=t.now().offset,b(w)}function f(w){return t.containerState={},e.attempt(dE,m,b)(w)}function m(w){return r++,n.push([t.currentConstruct,t.containerState]),f(w)}function b(w){if(w===null){a&&S(),y(0),e.consume(w);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:s}),E(w)}function E(w){if(w===null){x(e.exit("chunkFlow"),!0),y(0),e.consume(w);return}return He(w)?(e.consume(w),x(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(w),E)}function x(w,A){const D=t.sliceStream(w);if(A&&D.push(null),w.previous=s,s&&(s.next=w),s=w,a.defineSkip(w.start),a.write(D),t.parser.lazy[w.start.line]){let N=a.events.length;for(;N--;)if(a.events[N][1].start.offset<i&&(!a.events[N][1].end||a.events[N][1].end.offset>i))return;const T=t.events.length;let v=T,R,C;for(;v--;)if(t.events[v][0]==="exit"&&t.events[v][1].type==="chunkFlow"){if(R){C=t.events[v][1].end;break}R=!0}for(y(r),N=T;N<t.events.length;)t.events[N][1].end={...C},N++;Vn(t.events,v+1,0,t.events.slice(T)),t.events.length=N}}function y(w){let A=n.length;for(;A-- >w;){const D=n[A];t.containerState=D[1],D[0].exit.call(t,e)}n.length=w}function S(){a.write([null]),s=void 0,a=void 0,t.containerState._closeFlow=void 0}}function PD(e,t,n){return xt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function rs(e){if(e===null||Pt(e)||ba(e))return 1;if(pu(e))return 2}function fu(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const s=e[a].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const rd={name:"attention",resolveAll:jD,tokenize:BD};function jD(e,t){let n=-1,r,a,s,i,o,u,c,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;u=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},f={...e[n][1].start};pE(d,-u),pE(f,u),i={type:u>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},o={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},s={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},a={type:u>1?"strong":"emphasis",start:{...i.start},end:{...o.end}},e[r][1].end={...i.start},e[n][1].start={...o.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=nr(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=nr(c,[["enter",a,t],["enter",i,t],["exit",i,t],["enter",s,t]]),c=nr(c,fu(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=nr(c,[["exit",s,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,c=nr(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,Vn(e,r-1,n-r+3,c),n=r+c.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function BD(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=rs(r);let s;return i;function i(u){return s=u,e.enter("attentionSequence"),o(u)}function o(u){if(u===s)return e.consume(u),o;const c=e.exit("attentionSequence"),p=rs(u),d=!p||p===2&&a||n.includes(u),f=!a||a===2&&p||n.includes(r);return c._open=!!(s===42?d:d&&(a||!f)),c._close=!!(s===42?f:f&&(p||!d)),t(u)}}function pE(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const UD={name:"autolink",tokenize:$D};function $D(e,t,n){let r=0;return a;function a(m){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(m){return Fn(m)?(e.consume(m),i):m===64?n(m):c(m)}function i(m){return m===43||m===45||m===46||In(m)?(r=1,o(m)):c(m)}function o(m){return m===58?(e.consume(m),r=0,u):(m===43||m===45||m===46||In(m))&&r++<32?(e.consume(m),o):(r=0,c(m))}function u(m){return m===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):m===null||m===32||m===60||nl(m)?n(m):(e.consume(m),u)}function c(m){return m===64?(e.consume(m),p):ID(m)?(e.consume(m),c):n(m)}function p(m){return In(m)?d(m):n(m)}function d(m){return m===46?(e.consume(m),r=0,p):m===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):f(m)}function f(m){if((m===45||In(m))&&r++<63){const b=m===45?f:d;return e.consume(m),b}return n(m)}}const Yi={partial:!0,tokenize:zD};function zD(e,t,n){return r;function r(s){return dt(s)?xt(e,a,"linePrefix")(s):a(s)}function a(s){return s===null||He(s)?t(s):n(s)}}const jT={continuation:{tokenize:GD},exit:WD,name:"blockQuote",tokenize:HD};function HD(e,t,n){const r=this;return a;function a(i){if(i===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(i),e.exit("blockQuoteMarker"),s}return n(i)}function s(i){return dt(i)?(e.enter("blockQuotePrefixWhitespace"),e.consume(i),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(i))}}function GD(e,t,n){const r=this;return a;function a(i){return dt(i)?xt(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i):s(i)}function s(i){return e.attempt(jT,t,n)(i)}}function WD(e){e.exit("blockQuote")}const BT={name:"characterEscape",tokenize:VD};function VD(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),a}function a(s){return DD(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const UT={name:"characterReference",tokenize:qD};function qD(e,t,n){const r=this;let a=0,s,i;return o;function o(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),u}function u(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),s=31,i=In,p(d))}function c(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,i=RD,p):(e.enter("characterReferenceValue"),s=7,i=nd,p(d))}function p(d){if(d===59&&a){const f=e.exit("characterReferenceValue");return i===In&&!gi(r.sliceSerialize(f))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return i(d)&&a++<s?(e.consume(d),p):n(d)}}const fE={partial:!0,tokenize:ZD},mE={concrete:!0,name:"codeFenced",tokenize:YD};function YD(e,t,n){const r=this,a={partial:!0,tokenize:D};let s=0,i=0,o;return u;function u(N){return c(N)}function c(N){const T=r.events[r.events.length-1];return s=T&&T[1].type==="linePrefix"?T[2].sliceSerialize(T[1],!0).length:0,o=N,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(N)}function p(N){return N===o?(i++,e.consume(N),p):i<3?n(N):(e.exit("codeFencedFenceSequence"),dt(N)?xt(e,d,"whitespace")(N):d(N))}function d(N){return N===null||He(N)?(e.exit("codeFencedFence"),r.interrupt?t(N):e.check(fE,E,A)(N)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(N))}function f(N){return N===null||He(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(N)):dt(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),xt(e,m,"whitespace")(N)):N===96&&N===o?n(N):(e.consume(N),f)}function m(N){return N===null||He(N)?d(N):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),b(N))}function b(N){return N===null||He(N)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(N)):N===96&&N===o?n(N):(e.consume(N),b)}function E(N){return e.attempt(a,A,x)(N)}function x(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),y}function y(N){return s>0&&dt(N)?xt(e,S,"linePrefix",s+1)(N):S(N)}function S(N){return N===null||He(N)?e.check(fE,E,A)(N):(e.enter("codeFlowValue"),w(N))}function w(N){return N===null||He(N)?(e.exit("codeFlowValue"),S(N)):(e.consume(N),w)}function A(N){return e.exit("codeFenced"),t(N)}function D(N,T,v){let R=0;return C;function C($){return N.enter("lineEnding"),N.consume($),N.exit("lineEnding"),U}function U($){return N.enter("codeFencedFence"),dt($)?xt(N,k,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):k($)}function k($){return $===o?(N.enter("codeFencedFenceSequence"),j($)):v($)}function j($){return $===o?(R++,N.consume($),j):R>=i?(N.exit("codeFencedFenceSequence"),dt($)?xt(N,G,"whitespace")($):G($)):v($)}function G($){return $===null||He($)?(N.exit("codeFencedFence"),T($)):v($)}}}function ZD(e,t,n){const r=this;return a;function a(i){return i===null?n(i):(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),s)}function s(i){return r.parser.lazy[r.now().line]?n(i):t(i)}}const Yu={name:"codeIndented",tokenize:XD},KD={partial:!0,tokenize:QD};function XD(e,t,n){const r=this;return a;function a(c){return e.enter("codeIndented"),xt(e,s,"linePrefix",5)(c)}function s(c){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?i(c):n(c)}function i(c){return c===null?u(c):He(c)?e.attempt(KD,i,u)(c):(e.enter("codeFlowValue"),o(c))}function o(c){return c===null||He(c)?(e.exit("codeFlowValue"),i(c)):(e.consume(c),o)}function u(c){return e.exit("codeIndented"),t(c)}}function QD(e,t,n){const r=this;return a;function a(i){return r.parser.lazy[r.now().line]?n(i):He(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),a):xt(e,s,"linePrefix",5)(i)}function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(i):He(i)?a(i):n(i)}}const JD={name:"codeText",previous:tO,resolve:eO,tokenize:nO};function eO(e){let t=e.length-4,n=3,r,a;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;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function tO(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function nO(e,t,n){let r=0,a,s;return i;function i(d){return e.enter("codeText"),e.enter("codeTextSequence"),o(d)}function o(d){return d===96?(e.consume(d),r++,o):(e.exit("codeTextSequence"),u(d))}function u(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),u):d===96?(s=e.enter("codeTextSequence"),a=0,p(d)):He(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):(e.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||He(d)?(e.exit("codeTextData"),u(d)):(e.consume(d),c)}function p(d){return d===96?(e.consume(d),a++,p):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(s.type="codeTextData",c(d))}}class rO{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&Us(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Us(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Us(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Us(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Us(this.left,n.reverse())}}}function Us(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 $T(e){const t={};let n=-1,r,a,s,i,o,u,c;const p=new rO(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(r=p.get(n),n&&r[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(u=r[1]._tokenizer.events,s=0,s<u.length&&u[s][1].type==="lineEndingBlank"&&(s+=2),s<u.length&&u[s][1].type==="content"))for(;++s<u.length&&u[s][1].type!=="content";)u[s][1].type==="chunkText"&&(u[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,aO(p,n)),n=t[n],c=!0);else if(r[1]._container){for(s=n,a=void 0;s--;)if(i=p.get(s),i[1].type==="lineEnding"||i[1].type==="lineEndingBlank")i[0]==="enter"&&(a&&(p.get(a)[1].type="lineEndingBlank"),i[1].type="lineEnding",a=s);else if(!(i[1].type==="linePrefix"||i[1].type==="listItemIndent"))break;a&&(r[1].end={...p.get(a)[1].start},o=p.slice(a,n),o.unshift(r),p.splice(a,n-a+1,o))}}return Vn(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!c}function aO(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const s=[];let i=n._tokenizer;i||(i=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(i._contentTypeTextTrailing=!0));const o=i.events,u=[],c={};let p,d,f=-1,m=n,b=0,E=0;const x=[E];for(;m;){for(;e.get(++a)[1]!==m;);s.push(a),m._tokenizer||(p=r.sliceStream(m),m.next||p.push(null),d&&i.defineSkip(m.start),m._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(p),m._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),d=m,m=m.next}for(m=n;++f<o.length;)o[f][0]==="exit"&&o[f-1][0]==="enter"&&o[f][1].type===o[f-1][1].type&&o[f][1].start.line!==o[f][1].end.line&&(E=f+1,x.push(E),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(i.events=[],m?(m._tokenizer=void 0,m.previous=void 0):x.pop(),f=x.length;f--;){const y=o.slice(x[f],x[f+1]),S=s.pop();u.push([S,S+y.length-1]),e.splice(S,2,y)}for(u.reverse(),f=-1;++f<u.length;)c[b+u[f][0]]=b+u[f][1],b+=u[f][1]-u[f][0]-1;return c}const sO={resolve:oO,tokenize:lO},iO={partial:!0,tokenize:uO};function oO(e){return $T(e),e}function lO(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(o)}function a(o){return o===null?s(o):He(o)?e.check(iO,i,s)(o):(e.consume(o),a)}function s(o){return e.exit("chunkContent"),e.exit("content"),t(o)}function i(o){return e.consume(o),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function uO(e,t,n){const r=this;return a;function a(i){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),xt(e,s,"linePrefix")}function s(i){if(i===null||He(i))return n(i);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function zT(e,t,n,r,a,s,i,o,u){const c=u||Number.POSITIVE_INFINITY;let p=0;return d;function d(y){return y===60?(e.enter(r),e.enter(a),e.enter(s),e.consume(y),e.exit(s),f):y===null||y===32||y===41||nl(y)?n(y):(e.enter(r),e.enter(i),e.enter(o),e.enter("chunkString",{contentType:"string"}),E(y))}function f(y){return y===62?(e.enter(s),e.consume(y),e.exit(s),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),m(y))}function m(y){return y===62?(e.exit("chunkString"),e.exit(o),f(y)):y===null||y===60||He(y)?n(y):(e.consume(y),y===92?b:m)}function b(y){return y===60||y===62||y===92?(e.consume(y),m):m(y)}function E(y){return!p&&(y===null||y===41||Pt(y))?(e.exit("chunkString"),e.exit(o),e.exit(i),e.exit(r),t(y)):p<c&&y===40?(e.consume(y),p++,E):y===41?(e.consume(y),p--,E):y===null||y===32||y===40||nl(y)?n(y):(e.consume(y),y===92?x:E)}function x(y){return y===40||y===41||y===92?(e.consume(y),E):E(y)}}function HT(e,t,n,r,a,s){const i=this;let o=0,u;return c;function c(m){return e.enter(r),e.enter(a),e.consume(m),e.exit(a),e.enter(s),p}function p(m){return o>999||m===null||m===91||m===93&&!u||m===94&&!o&&"_hiddenFootnoteSupport"in i.parser.constructs?n(m):m===93?(e.exit(s),e.enter(a),e.consume(m),e.exit(a),e.exit(r),t):He(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===null||m===91||m===93||He(m)||o++>999?(e.exit("chunkString"),p(m)):(e.consume(m),u||(u=!dt(m)),m===92?f:d)}function f(m){return m===91||m===92||m===93?(e.consume(m),o++,d):d(m)}}function GT(e,t,n,r,a,s){let i;return o;function o(f){return f===34||f===39||f===40?(e.enter(r),e.enter(a),e.consume(f),e.exit(a),i=f===40?41:f,u):n(f)}function u(f){return f===i?(e.enter(a),e.consume(f),e.exit(a),e.exit(r),t):(e.enter(s),c(f))}function c(f){return f===i?(e.exit(s),u(i)):f===null?n(f):He(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),xt(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(f))}function p(f){return f===i||f===null||He(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?d:p)}function d(f){return f===i||f===92?(e.consume(f),p):p(f)}}function ii(e,t){let n;return r;function r(a){return He(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):dt(a)?xt(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const cO={name:"definition",tokenize:pO},dO={partial:!0,tokenize:fO};function pO(e,t,n){const r=this;let a;return s;function s(m){return e.enter("definition"),i(m)}function i(m){return HT.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function o(m){return a=lr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),u):n(m)}function u(m){return Pt(m)?ii(e,c)(m):c(m)}function c(m){return zT(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function p(m){return e.attempt(dO,d,d)(m)}function d(m){return dt(m)?xt(e,f,"whitespace")(m):f(m)}function f(m){return m===null||He(m)?(e.exit("definition"),r.parser.defined.push(a),t(m)):n(m)}}function fO(e,t,n){return r;function r(o){return Pt(o)?ii(e,a)(o):n(o)}function a(o){return GT(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function s(o){return dt(o)?xt(e,i,"whitespace")(o):i(o)}function i(o){return o===null||He(o)?t(o):n(o)}}const mO={name:"hardBreakEscape",tokenize:hO};function hO(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),a}function a(s){return He(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const gO={name:"headingAtx",resolve:bO,tokenize:EO};function bO(e,t){let n=e.length-2,r=3,a,s;return 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&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Vn(e,r,n-r+1,[["enter",a,t],["enter",s,t],["exit",s,t],["exit",a,t]])),e}function EO(e,t,n){let r=0;return a;function a(p){return e.enter("atxHeading"),s(p)}function s(p){return e.enter("atxHeadingSequence"),i(p)}function i(p){return p===35&&r++<6?(e.consume(p),i):p===null||Pt(p)?(e.exit("atxHeadingSequence"),o(p)):n(p)}function o(p){return p===35?(e.enter("atxHeadingSequence"),u(p)):p===null||He(p)?(e.exit("atxHeading"),t(p)):dt(p)?xt(e,o,"whitespace")(p):(e.enter("atxHeadingText"),c(p))}function u(p){return p===35?(e.consume(p),u):(e.exit("atxHeadingSequence"),o(p))}function c(p){return p===null||p===35||Pt(p)?(e.exit("atxHeadingText"),o(p)):(e.consume(p),c)}}const xO=["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"],hE=["pre","script","style","textarea"],yO={concrete:!0,name:"htmlFlow",resolveTo:vO,tokenize:wO},TO={partial:!0,tokenize:NO},SO={partial:!0,tokenize:AO};function vO(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 wO(e,t,n){const r=this;let a,s,i,o,u;return c;function c(L){return p(L)}function p(L){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(L),d}function d(L){return L===33?(e.consume(L),f):L===47?(e.consume(L),s=!0,E):L===63?(e.consume(L),a=3,r.interrupt?t:O):Fn(L)?(e.consume(L),i=String.fromCharCode(L),x):n(L)}function f(L){return L===45?(e.consume(L),a=2,m):L===91?(e.consume(L),a=5,o=0,b):Fn(L)?(e.consume(L),a=4,r.interrupt?t:O):n(L)}function m(L){return L===45?(e.consume(L),r.interrupt?t:O):n(L)}function b(L){const ke="CDATA[";return L===ke.charCodeAt(o++)?(e.consume(L),o===ke.length?r.interrupt?t:k:b):n(L)}function E(L){return Fn(L)?(e.consume(L),i=String.fromCharCode(L),x):n(L)}function x(L){if(L===null||L===47||L===62||Pt(L)){const ke=L===47,Re=i.toLowerCase();return!ke&&!s&&hE.includes(Re)?(a=1,r.interrupt?t(L):k(L)):xO.includes(i.toLowerCase())?(a=6,ke?(e.consume(L),y):r.interrupt?t(L):k(L)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(L):s?S(L):w(L))}return L===45||In(L)?(e.consume(L),i+=String.fromCharCode(L),x):n(L)}function y(L){return L===62?(e.consume(L),r.interrupt?t:k):n(L)}function S(L){return dt(L)?(e.consume(L),S):C(L)}function w(L){return L===47?(e.consume(L),C):L===58||L===95||Fn(L)?(e.consume(L),A):dt(L)?(e.consume(L),w):C(L)}function A(L){return L===45||L===46||L===58||L===95||In(L)?(e.consume(L),A):D(L)}function D(L){return L===61?(e.consume(L),N):dt(L)?(e.consume(L),D):w(L)}function N(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(e.consume(L),u=L,T):dt(L)?(e.consume(L),N):v(L)}function T(L){return L===u?(e.consume(L),u=null,R):L===null||He(L)?n(L):(e.consume(L),T)}function v(L){return L===null||L===34||L===39||L===47||L===60||L===61||L===62||L===96||Pt(L)?D(L):(e.consume(L),v)}function R(L){return L===47||L===62||dt(L)?w(L):n(L)}function C(L){return L===62?(e.consume(L),U):n(L)}function U(L){return L===null||He(L)?k(L):dt(L)?(e.consume(L),U):n(L)}function k(L){return L===45&&a===2?(e.consume(L),te):L===60&&a===1?(e.consume(L),H):L===62&&a===4?(e.consume(L),ne):L===63&&a===3?(e.consume(L),O):L===93&&a===5?(e.consume(L),de):He(L)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(TO,pe,j)(L)):L===null||He(L)?(e.exit("htmlFlowData"),j(L)):(e.consume(L),k)}function j(L){return e.check(SO,G,pe)(L)}function G(L){return e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),$}function $(L){return L===null||He(L)?j(L):(e.enter("htmlFlowData"),k(L))}function te(L){return L===45?(e.consume(L),O):k(L)}function H(L){return L===47?(e.consume(L),i="",se):k(L)}function se(L){if(L===62){const ke=i.toLowerCase();return hE.includes(ke)?(e.consume(L),ne):k(L)}return Fn(L)&&i.length<8?(e.consume(L),i+=String.fromCharCode(L),se):k(L)}function de(L){return L===93?(e.consume(L),O):k(L)}function O(L){return L===62?(e.consume(L),ne):L===45&&a===2?(e.consume(L),O):k(L)}function ne(L){return L===null||He(L)?(e.exit("htmlFlowData"),pe(L)):(e.consume(L),ne)}function pe(L){return e.exit("htmlFlow"),t(L)}}function AO(e,t,n){const r=this;return a;function a(i){return He(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),s):n(i)}function s(i){return r.parser.lazy[r.now().line]?n(i):t(i)}}function NO(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Yi,t,n)}}const _O={name:"htmlText",tokenize:CO};function CO(e,t,n){const r=this;let a,s,i;return o;function o(O){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(O),u}function u(O){return O===33?(e.consume(O),c):O===47?(e.consume(O),D):O===63?(e.consume(O),w):Fn(O)?(e.consume(O),v):n(O)}function c(O){return O===45?(e.consume(O),p):O===91?(e.consume(O),s=0,b):Fn(O)?(e.consume(O),S):n(O)}function p(O){return O===45?(e.consume(O),m):n(O)}function d(O){return O===null?n(O):O===45?(e.consume(O),f):He(O)?(i=d,H(O)):(e.consume(O),d)}function f(O){return O===45?(e.consume(O),m):d(O)}function m(O){return O===62?te(O):O===45?f(O):d(O)}function b(O){const ne="CDATA[";return O===ne.charCodeAt(s++)?(e.consume(O),s===ne.length?E:b):n(O)}function E(O){return O===null?n(O):O===93?(e.consume(O),x):He(O)?(i=E,H(O)):(e.consume(O),E)}function x(O){return O===93?(e.consume(O),y):E(O)}function y(O){return O===62?te(O):O===93?(e.consume(O),y):E(O)}function S(O){return O===null||O===62?te(O):He(O)?(i=S,H(O)):(e.consume(O),S)}function w(O){return O===null?n(O):O===63?(e.consume(O),A):He(O)?(i=w,H(O)):(e.consume(O),w)}function A(O){return O===62?te(O):w(O)}function D(O){return Fn(O)?(e.consume(O),N):n(O)}function N(O){return O===45||In(O)?(e.consume(O),N):T(O)}function T(O){return He(O)?(i=T,H(O)):dt(O)?(e.consume(O),T):te(O)}function v(O){return O===45||In(O)?(e.consume(O),v):O===47||O===62||Pt(O)?R(O):n(O)}function R(O){return O===47?(e.consume(O),te):O===58||O===95||Fn(O)?(e.consume(O),C):He(O)?(i=R,H(O)):dt(O)?(e.consume(O),R):te(O)}function C(O){return O===45||O===46||O===58||O===95||In(O)?(e.consume(O),C):U(O)}function U(O){return O===61?(e.consume(O),k):He(O)?(i=U,H(O)):dt(O)?(e.consume(O),U):R(O)}function k(O){return O===null||O===60||O===61||O===62||O===96?n(O):O===34||O===39?(e.consume(O),a=O,j):He(O)?(i=k,H(O)):dt(O)?(e.consume(O),k):(e.consume(O),G)}function j(O){return O===a?(e.consume(O),a=void 0,$):O===null?n(O):He(O)?(i=j,H(O)):(e.consume(O),j)}function G(O){return O===null||O===34||O===39||O===60||O===61||O===96?n(O):O===47||O===62||Pt(O)?R(O):(e.consume(O),G)}function $(O){return O===47||O===62||Pt(O)?R(O):n(O)}function te(O){return O===62?(e.consume(O),e.exit("htmlTextData"),e.exit("htmlText"),t):n(O)}function H(O){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),se}function se(O){return dt(O)?xt(e,de,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):de(O)}function de(O){return e.enter("htmlTextData"),i(O)}}const Hg={name:"labelEnd",resolveAll:DO,resolveTo:OO,tokenize:LO},kO={tokenize:FO},IO={tokenize:MO},RO={tokenize:PO};function DO(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const a=r.type==="labelImage"?4:2;r.type="data",t+=a}}return e.length!==n.length&&Vn(e,0,e.length,n),e}function OO(e,t){let n=e.length,r=0,a,s,i,o;for(;n--;)if(a=e[n][1],s){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(i){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(s=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(i=n);const u={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[s][1].start},end:{...e[i][1].end}},p={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[i-2][1].start}};return o=[["enter",u,t],["enter",c,t]],o=nr(o,e.slice(s+1,s+r+3)),o=nr(o,[["enter",p,t]]),o=nr(o,fu(t.parser.constructs.insideSpan.null,e.slice(s+r+4,i-3),t)),o=nr(o,[["exit",p,t],e[i-2],e[i-1],["exit",c,t]]),o=nr(o,e.slice(i+1)),o=nr(o,[["exit",u,t]]),Vn(e,s,e.length,o),e}function LO(e,t,n){const r=this;let a=r.events.length,s,i;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){s=r.events[a][1];break}return o;function o(f){return s?s._inactive?d(f):(i=r.parser.defined.includes(lr(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),u):n(f)}function u(f){return f===40?e.attempt(kO,p,i?p:d)(f):f===91?e.attempt(IO,p,i?c:d)(f):i?p(f):d(f)}function c(f){return e.attempt(RO,p,d)(f)}function p(f){return t(f)}function d(f){return s._balanced=!0,n(f)}}function FO(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),a}function a(d){return Pt(d)?ii(e,s)(d):s(d)}function s(d){return d===41?p(d):zT(e,i,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function i(d){return Pt(d)?ii(e,u)(d):p(d)}function o(d){return n(d)}function u(d){return d===34||d===39||d===40?GT(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):p(d)}function c(d){return Pt(d)?ii(e,p)(d):p(d)}function p(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function MO(e,t,n){const r=this;return a;function a(o){return HT.call(r,e,s,i,"reference","referenceMarker","referenceString")(o)}function s(o){return r.parser.defined.includes(lr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function i(o){return n(o)}}function PO(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),a}function a(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const jO={name:"labelStartImage",resolveAll:Hg.resolveAll,tokenize:BO};function BO(e,t,n){const r=this;return a;function a(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),s}function s(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),i):n(o)}function i(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const UO={name:"labelStartLink",resolveAll:Hg.resolveAll,tokenize:$O};function $O(e,t,n){const r=this;return a;function a(i){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(i),e.exit("labelMarker"),e.exit("labelLink"),s}function s(i){return i===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(i):t(i)}}const Zu={name:"lineEnding",tokenize:zO};function zO(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),xt(e,t,"linePrefix")}}const zo={name:"thematicBreak",tokenize:HO};function HO(e,t,n){let r=0,a;return s;function s(c){return e.enter("thematicBreak"),i(c)}function i(c){return a=c,o(c)}function o(c){return c===a?(e.enter("thematicBreakSequence"),u(c)):r>=3&&(c===null||He(c))?(e.exit("thematicBreak"),t(c)):n(c)}function u(c){return c===a?(e.consume(c),r++,u):(e.exit("thematicBreakSequence"),dt(c)?xt(e,o,"whitespace")(c):o(c))}}const Un={continuation:{tokenize:qO},exit:ZO,name:"list",tokenize:VO},GO={partial:!0,tokenize:KO},WO={partial:!0,tokenize:YO};function VO(e,t,n){const r=this,a=r.events[r.events.length-1];let s=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,i=0;return o;function o(m){const b=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:nd(m)){if(r.containerState.type||(r.containerState.type=b,e.enter(b,{_container:!0})),b==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(zo,n,c)(m):c(m);if(!r.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(m)}return n(m)}function u(m){return nd(m)&&++i<10?(e.consume(m),u):(!r.interrupt||i<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),c(m)):n(m)}function c(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,e.check(Yi,r.interrupt?n:p,e.attempt(GO,f,d))}function p(m){return r.containerState.initialBlankLine=!0,s++,f(m)}function d(m){return dt(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),f):n(m)}function f(m){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function qO(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Yi,a,s);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,xt(e,t,"listItemIndent",r.containerState.size+1)(o)}function s(o){return r.containerState.furtherBlankLines||!dt(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(WO,t,i)(o))}function i(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,xt(e,e.attempt(Un,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function YO(e,t,n){const r=this;return xt(e,a,"listItemIndent",r.containerState.size+1);function a(s){const i=r.events[r.events.length-1];return i&&i[1].type==="listItemIndent"&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(s):n(s)}}function ZO(e){e.exit(this.containerState.type)}function KO(e,t,n){const r=this;return xt(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(s){const i=r.events[r.events.length-1];return!dt(s)&&i&&i[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const gE={name:"setextUnderline",resolveTo:XO,tokenize:QO};function XO(e,t){let n=e.length,r,a,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const i={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",s?(e.splice(a,0,["enter",i,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=i,e.push(["exit",i,t]),e}function QO(e,t,n){const r=this;let a;return s;function s(c){let p=r.events.length,d;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){d=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),a=c,i(c)):n(c)}function i(c){return e.enter("setextHeadingLineSequence"),o(c)}function o(c){return c===a?(e.consume(c),o):(e.exit("setextHeadingLineSequence"),dt(c)?xt(e,u,"lineSuffix")(c):u(c))}function u(c){return c===null||He(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const JO={tokenize:eL};function eL(e){const t=this,n=e.attempt(Yi,r,e.attempt(this.parser.constructs.flowInitial,a,xt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(sO,a)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const tL={resolveAll:VT()},nL=WT("string"),rL=WT("text");function WT(e){return{resolveAll:VT(e==="text"?aL:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],s=n.attempt(a,i,o);return i;function i(p){return c(p)?s(p):o(p)}function o(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),u}function u(p){return c(p)?(n.exit("data"),s(p)):(n.consume(p),u)}function c(p){if(p===null)return!0;const d=a[p];let f=-1;if(d)for(;++f<d.length;){const m=d[f];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function VT(e){return t;function t(n,r){let a=-1,s;for(;++a<=n.length;)s===void 0?n[a]&&n[a][1].type==="data"&&(s=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==s+2&&(n[s][1].end=n[a-1][1].end,n.splice(s+2,a-s-2),a=s+2),s=void 0);return e?e(n,r):n}}function aL(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],a=t.sliceStream(r);let s=a.length,i=-1,o=0,u;for(;s--;){const c=a[s];if(typeof c=="string"){for(i=c.length;c.charCodeAt(i-1)===32;)o++,i--;if(i)break;i=-1}else if(c===-2)u=!0,o++;else if(c!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(o=0),o){const c={type:n===e.length||u||o<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?i:r.start._bufferIndex+i,_index:r.start._index+s,line:r.end.line,column:r.end.column-o,offset:r.end.offset-o},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const sL={42:Un,43:Un,45:Un,48:Un,49:Un,50:Un,51:Un,52:Un,53:Un,54:Un,55:Un,56:Un,57:Un,62:jT},iL={91:cO},oL={[-2]:Yu,[-1]:Yu,32:Yu},lL={35:gO,42:zo,45:[gE,zo],60:yO,61:gE,95:zo,96:mE,126:mE},uL={38:UT,92:BT},cL={[-5]:Zu,[-4]:Zu,[-3]:Zu,33:jO,38:UT,42:rd,60:[UD,_O],91:UO,92:[mO,BT],93:Hg,95:rd,96:JD},dL={null:[rd,tL]},pL={null:[42,95]},fL={null:[]},mL=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:pL,contentInitial:iL,disable:fL,document:sL,flow:lL,flowInitial:oL,insideSpan:dL,string:uL,text:cL},Symbol.toStringTag,{value:"Module"}));function hL(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},s=[];let i=[],o=[];const u={attempt:T(D),check:T(N),consume:S,enter:w,exit:A,interrupt:T(N,{interrupt:!0})},c={code:null,containerState:{},defineSkip:E,events:[],now:b,parser:e,previous:null,sliceSerialize:f,sliceStream:m,write:d};let p=t.tokenize.call(c,u);return t.resolveAll&&s.push(t),c;function d(U){return i=nr(i,U),x(),i[i.length-1]!==null?[]:(v(t,0),c.events=fu(s,c.events,c),c.events)}function f(U,k){return bL(m(U),k)}function m(U){return gL(i,U)}function b(){const{_bufferIndex:U,_index:k,line:j,column:G,offset:$}=r;return{_bufferIndex:U,_index:k,line:j,column:G,offset:$}}function E(U){a[U.line]=U.column,C()}function x(){let U;for(;r._index<i.length;){const k=i[r._index];if(typeof k=="string")for(U=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===U&&r._bufferIndex<k.length;)y(k.charCodeAt(r._bufferIndex));else y(k)}}function y(U){p=p(U)}function S(U){He(U)?(r.line++,r.column=1,r.offset+=U===-3?2:1,C()):U!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===i[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=U}function w(U,k){const j=k||{};return j.type=U,j.start=b(),c.events.push(["enter",j,c]),o.push(j),j}function A(U){const k=o.pop();return k.end=b(),c.events.push(["exit",k,c]),k}function D(U,k){v(U,k.from)}function N(U,k){k.restore()}function T(U,k){return j;function j(G,$,te){let H,se,de,O;return Array.isArray(G)?pe(G):"tokenize"in G?pe([G]):ne(G);function ne(Q){return _e;function _e(fe){const X=fe!==null&&Q[fe],Ve=fe!==null&&Q.null,ge=[...Array.isArray(X)?X:X?[X]:[],...Array.isArray(Ve)?Ve:Ve?[Ve]:[]];return pe(ge)(fe)}}function pe(Q){return H=Q,se=0,Q.length===0?te:L(Q[se])}function L(Q){return _e;function _e(fe){return O=R(),de=Q,Q.partial||(c.currentConstruct=Q),Q.name&&c.parser.constructs.disable.null.includes(Q.name)?Re():Q.tokenize.call(k?Object.assign(Object.create(c),k):c,u,ke,Re)(fe)}}function ke(Q){return U(de,O),$}function Re(Q){return O.restore(),++se<H.length?L(H[se]):te}}}function v(U,k){U.resolveAll&&!s.includes(U)&&s.push(U),U.resolve&&Vn(c.events,k,c.events.length-k,U.resolve(c.events.slice(k),c)),U.resolveTo&&(c.events=U.resolveTo(c.events,c))}function R(){const U=b(),k=c.previous,j=c.currentConstruct,G=c.events.length,$=Array.from(o);return{from:G,restore:te};function te(){r=U,c.previous=k,c.currentConstruct=j,c.events.length=G,o=$,C()}}function C(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function gL(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,s=t.end._bufferIndex;let i;if(n===a)i=[e[n].slice(r,s)];else{if(i=e.slice(n,a),r>-1){const o=i[0];typeof o=="string"?i[0]=o.slice(r):i.shift()}s>0&&i.push(e[a].slice(0,s))}return i}function bL(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const s=e[n];let i;if(typeof s=="string")i=s;else switch(s){case-5:{i="\r";break}case-4:{i=`
|
|
18
18
|
`;break}case-3:{i=`\r
|
|
19
|
-
`;break}case-2:{i=t?" ":" ";break}case-1:{if(!t&&a)continue;i=" ";break}default:i=String.fromCharCode(s)}a=s===-2,r.push(i)}return r.join("")}function EL(e){const r={constructs:MT([mL,...(e||{}).extensions||[]]),content:a(OD),defined:[],document:a(FD),flow:a(JO),lazy:{},string:a(nL),text:a(rL)};return r;function a(s){return i;function i(o){return hL(r,s,o)}}}function xL(e){for(;!$T(e););return e}const bE=/[\0\t\n\r]/g;function yL(){let e=1,t="",n=!0,r;return a;function a(s,i,o){const u=[];let c,p,d,f,m;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(i||void 0).decode(s)),d=0,t="",n&&(s.charCodeAt(0)===65279&&d++,n=void 0);d<s.length;){if(bE.lastIndex=d,c=bE.exec(s),f=c&&c.index!==void 0?c.index:s.length,m=s.charCodeAt(f),!c){t=s.slice(d);break}if(m===10&&d===f&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),d<f&&(u.push(s.slice(d,f)),e+=f-d),m){case 0:{u.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,u.push(-2);e++<p;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:r=!0,e=1}d=f+1}return o&&(r&&u.push(-5),t&&u.push(t),u.push(null)),u}}const TL=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function SL(e){return e.replace(TL,vL)}function vL(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),s=a===120||a===88;return PT(n.slice(s?2:1),s?16:10)}return gi(n)||e}const qT={}.hasOwnProperty;function wL(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),AL(n)(xL(EL(n).document().write(yL()(e,t,!0))))}function AL(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Ht),autolinkProtocol:R,autolinkEmail:R,atxHeading:s(ie),blockQuote:s(Ve),characterEscape:R,characterReference:R,codeFenced:s(ge),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:s(ge,i),codeText:s(me,i),codeTextData:R,data:R,codeFlowValue:R,definition:s(Te),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:s(ve),hardBreakEscape:s(Ze),hardBreakTrailing:s(Ze),htmlFlow:s(ot,i),htmlFlowData:R,htmlText:s(ot,i),htmlTextData:R,image:s(rt),label:i,link:s(Ht),listItem:s(Ct),listItemValue:f,listOrdered:s(St,d),listUnordered:s(St),paragraph:s(Zt),reference:L,referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:s(ie),strong:s(at),thematicBreak:s(Je)},exit:{atxHeading:u(),atxHeadingSequence:D,autolink:u(),autolinkEmail:X,autolinkProtocol:fe,blockQuote:u(),characterEscapeValue:C,characterReferenceMarkerHexadecimal:Re,characterReferenceMarkerNumeric:Re,characterReferenceValue:Q,characterReference:_e,codeFenced:u(x),codeFencedFence:E,codeFencedFenceInfo:m,codeFencedFenceMeta:b,codeFlowValue:C,codeIndented:u(y),codeText:u($),codeTextData:C,data:C,definition:u(),definitionDestinationString:A,definitionLabelString:S,definitionTitleString:w,emphasis:u(),hardBreakEscape:u(k),hardBreakTrailing:u(k),htmlFlow:u(j),htmlFlowData:C,htmlText:u(G),htmlTextData:C,image:u(H),label:de,labelText:se,lineEnding:U,link:u(te),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:ke,resourceDestinationString:O,resourceTitleString:ne,resource:pe,setextHeading:u(v),setextHeadingLineSequence:T,setextHeadingText:N,strong:u(),thematicBreak:u()}};YT(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(Z){let oe={type:"root",children:[]};const J={stack:[oe],tokenStack:[],config:t,enter:o,exit:c,buffer:i,resume:p,data:n},ue=[];let Pe=-1;for(;++Pe<Z.length;)if(Z[Pe][1].type==="listOrdered"||Z[Pe][1].type==="listUnordered")if(Z[Pe][0]==="enter")ue.push(Pe);else{const qe=ue.pop();Pe=a(Z,qe,Pe)}for(Pe=-1;++Pe<Z.length;){const qe=t[Z[Pe][0]];qT.call(qe,Z[Pe][1].type)&&qe[Z[Pe][1].type].call(Object.assign({sliceSerialize:Z[Pe][2].sliceSerialize},J),Z[Pe][1])}if(J.tokenStack.length>0){const qe=J.tokenStack[J.tokenStack.length-1];(qe[1]||EE).call(J,void 0,qe[0])}for(oe.position={start:jr(Z.length>0?Z[0][1].start:{line:1,column:1,offset:0}),end:jr(Z.length>0?Z[Z.length-2][1].end:{line:1,column:1,offset:0})},Pe=-1;++Pe<t.transforms.length;)oe=t.transforms[Pe](oe)||oe;return oe}function a(Z,oe,J){let ue=oe-1,Pe=-1,qe=!1,ht,Rt,kt,jt;for(;++ue<=J;){const ae=Z[ue];switch(ae[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ae[0]==="enter"?Pe++:Pe--,jt=void 0;break}case"lineEndingBlank":{ae[0]==="enter"&&(ht&&!jt&&!Pe&&!kt&&(kt=ue),jt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:jt=void 0}if(!Pe&&ae[0]==="enter"&&ae[1].type==="listItemPrefix"||Pe===-1&&ae[0]==="exit"&&(ae[1].type==="listUnordered"||ae[1].type==="listOrdered")){if(ht){let Ne=ue;for(Rt=void 0;Ne--;){const ze=Z[Ne];if(ze[1].type==="lineEnding"||ze[1].type==="lineEndingBlank"){if(ze[0]==="exit")continue;Rt&&(Z[Rt][1].type="lineEndingBlank",qe=!0),ze[1].type="lineEnding",Rt=Ne}else if(!(ze[1].type==="linePrefix"||ze[1].type==="blockQuotePrefix"||ze[1].type==="blockQuotePrefixWhitespace"||ze[1].type==="blockQuoteMarker"||ze[1].type==="listItemIndent"))break}kt&&(!Rt||kt<Rt)&&(ht._spread=!0),ht.end=Object.assign({},Rt?Z[Rt][1].start:ae[1].end),Z.splice(Rt||ue,0,["exit",ht,ae[2]]),ue++,J++}if(ae[1].type==="listItemPrefix"){const Ne={type:"listItem",_spread:!1,start:Object.assign({},ae[1].start),end:void 0};ht=Ne,Z.splice(ue,0,["enter",Ne,ae[2]]),ue++,J++,kt=void 0,jt=!0}}}return Z[oe][1]._spread=qe,J}function s(Z,oe){return J;function J(ue){o.call(this,Z(ue),ue),oe&&oe.call(this,ue)}}function i(){this.stack.push({type:"fragment",children:[]})}function o(Z,oe,J){this.stack[this.stack.length-1].children.push(Z),this.stack.push(Z),this.tokenStack.push([oe,J||void 0]),Z.position={start:jr(oe.start),end:void 0}}function u(Z){return oe;function oe(J){Z&&Z.call(this,J),c.call(this,J)}}function c(Z,oe){const J=this.stack.pop(),ue=this.tokenStack.pop();if(ue)ue[0].type!==Z.type&&(oe?oe.call(this,Z,ue[0]):(ue[1]||EE).call(this,Z,ue[0]));else throw new Error("Cannot close `"+Z.type+"` ("+si({start:Z.start,end:Z.end})+"): it’s not open");J.position.end=jr(Z.end)}function p(){return zg(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(Z){if(this.data.expectingFirstListItemValue){const oe=this.stack[this.stack.length-2];oe.start=Number.parseInt(this.sliceSerialize(Z),10),this.data.expectingFirstListItemValue=void 0}}function m(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.lang=Z}function b(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.meta=Z}function E(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z.replace(/(\r?\n|\r)$/g,"")}function S(Z){const oe=this.resume(),J=this.stack[this.stack.length-1];J.label=oe,J.identifier=lr(this.sliceSerialize(Z)).toLowerCase()}function w(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.title=Z}function A(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.url=Z}function D(Z){const oe=this.stack[this.stack.length-1];if(!oe.depth){const J=this.sliceSerialize(Z).length;oe.depth=J}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function T(Z){const oe=this.stack[this.stack.length-1];oe.depth=this.sliceSerialize(Z).codePointAt(0)===61?1:2}function v(){this.data.setextHeadingSlurpLineEnding=void 0}function R(Z){const J=this.stack[this.stack.length-1].children;let ue=J[J.length-1];(!ue||ue.type!=="text")&&(ue=De(),ue.position={start:jr(Z.start),end:void 0},J.push(ue)),this.stack.push(ue)}function C(Z){const oe=this.stack.pop();oe.value+=this.sliceSerialize(Z),oe.position.end=jr(Z.end)}function U(Z){const oe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const J=oe.children[oe.children.length-1];J.position.end=jr(Z.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(oe.type)&&(R.call(this,Z),C.call(this,Z))}function k(){this.data.atHardBreak=!0}function j(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z}function G(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z}function $(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z}function te(){const Z=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";Z.type+="Reference",Z.referenceType=oe,delete Z.url,delete Z.title}else delete Z.identifier,delete Z.label;this.data.referenceType=void 0}function H(){const Z=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";Z.type+="Reference",Z.referenceType=oe,delete Z.url,delete Z.title}else delete Z.identifier,delete Z.label;this.data.referenceType=void 0}function se(Z){const oe=this.sliceSerialize(Z),J=this.stack[this.stack.length-2];J.label=SL(oe),J.identifier=lr(oe).toLowerCase()}function de(){const Z=this.stack[this.stack.length-1],oe=this.resume(),J=this.stack[this.stack.length-1];if(this.data.inReference=!0,J.type==="link"){const ue=Z.children;J.children=ue}else J.alt=oe}function O(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.url=Z}function ne(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.title=Z}function pe(){this.data.inReference=void 0}function L(){this.data.referenceType="collapsed"}function ke(Z){const oe=this.resume(),J=this.stack[this.stack.length-1];J.label=oe,J.identifier=lr(this.sliceSerialize(Z)).toLowerCase(),this.data.referenceType="full"}function Re(Z){this.data.characterReferenceType=Z.type}function Q(Z){const oe=this.sliceSerialize(Z),J=this.data.characterReferenceType;let ue;J?(ue=PT(oe,J==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ue=gi(oe);const Pe=this.stack[this.stack.length-1];Pe.value+=ue}function _e(Z){const oe=this.stack.pop();oe.position.end=jr(Z.end)}function fe(Z){C.call(this,Z);const oe=this.stack[this.stack.length-1];oe.url=this.sliceSerialize(Z)}function X(Z){C.call(this,Z);const oe=this.stack[this.stack.length-1];oe.url="mailto:"+this.sliceSerialize(Z)}function Ve(){return{type:"blockquote",children:[]}}function ge(){return{type:"code",lang:null,meta:null,value:""}}function me(){return{type:"inlineCode",value:""}}function Te(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ve(){return{type:"emphasis",children:[]}}function ie(){return{type:"heading",depth:0,children:[]}}function Ze(){return{type:"break"}}function ot(){return{type:"html",value:""}}function rt(){return{type:"image",title:null,url:"",alt:null}}function Ht(){return{type:"link",title:null,url:"",children:[]}}function St(Z){return{type:"list",ordered:Z.type==="listOrdered",start:null,spread:Z._spread,children:[]}}function Ct(Z){return{type:"listItem",spread:Z._spread,checked:null,children:[]}}function Zt(){return{type:"paragraph",children:[]}}function at(){return{type:"strong",children:[]}}function De(){return{type:"text",value:""}}function Je(){return{type:"thematicBreak"}}}function jr(e){return{line:e.line,column:e.column,offset:e.offset}}function YT(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?YT(e,r):NL(e,r)}}function NL(e,t){let n;for(n in t)if(qT.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function EE(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+si({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+si({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+si({start:t.start,end:t.end})+") is still open")}function _L(e){const t=this;t.parser=n;function n(r){return wL(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function CL(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function kL(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
19
|
+
`;break}case-2:{i=t?" ":" ";break}case-1:{if(!t&&a)continue;i=" ";break}default:i=String.fromCharCode(s)}a=s===-2,r.push(i)}return r.join("")}function EL(e){const r={constructs:MT([mL,...(e||{}).extensions||[]]),content:a(OD),defined:[],document:a(FD),flow:a(JO),lazy:{},string:a(nL),text:a(rL)};return r;function a(s){return i;function i(o){return hL(r,s,o)}}}function xL(e){for(;!$T(e););return e}const bE=/[\0\t\n\r]/g;function yL(){let e=1,t="",n=!0,r;return a;function a(s,i,o){const u=[];let c,p,d,f,m;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(i||void 0).decode(s)),d=0,t="",n&&(s.charCodeAt(0)===65279&&d++,n=void 0);d<s.length;){if(bE.lastIndex=d,c=bE.exec(s),f=c&&c.index!==void 0?c.index:s.length,m=s.charCodeAt(f),!c){t=s.slice(d);break}if(m===10&&d===f&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),d<f&&(u.push(s.slice(d,f)),e+=f-d),m){case 0:{u.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,u.push(-2);e++<p;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:r=!0,e=1}d=f+1}return o&&(r&&u.push(-5),t&&u.push(t),u.push(null)),u}}const TL=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function SL(e){return e.replace(TL,vL)}function vL(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),s=a===120||a===88;return PT(n.slice(s?2:1),s?16:10)}return gi(n)||e}const qT={}.hasOwnProperty;function wL(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),AL(n)(xL(EL(n).document().write(yL()(e,t,!0))))}function AL(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Ht),autolinkProtocol:R,autolinkEmail:R,atxHeading:s(ie),blockQuote:s(Ve),characterEscape:R,characterReference:R,codeFenced:s(ge),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:s(ge,i),codeText:s(me,i),codeTextData:R,data:R,codeFlowValue:R,definition:s(Te),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:s(ve),hardBreakEscape:s(Ze),hardBreakTrailing:s(Ze),htmlFlow:s(ot,i),htmlFlowData:R,htmlText:s(ot,i),htmlTextData:R,image:s(rt),label:i,link:s(Ht),listItem:s(Ct),listItemValue:f,listOrdered:s(St,d),listUnordered:s(St),paragraph:s(Zt),reference:L,referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:s(ie),strong:s(at),thematicBreak:s(et)},exit:{atxHeading:u(),atxHeadingSequence:D,autolink:u(),autolinkEmail:X,autolinkProtocol:fe,blockQuote:u(),characterEscapeValue:C,characterReferenceMarkerHexadecimal:Re,characterReferenceMarkerNumeric:Re,characterReferenceValue:Q,characterReference:_e,codeFenced:u(x),codeFencedFence:E,codeFencedFenceInfo:m,codeFencedFenceMeta:b,codeFlowValue:C,codeIndented:u(y),codeText:u($),codeTextData:C,data:C,definition:u(),definitionDestinationString:A,definitionLabelString:S,definitionTitleString:w,emphasis:u(),hardBreakEscape:u(k),hardBreakTrailing:u(k),htmlFlow:u(j),htmlFlowData:C,htmlText:u(G),htmlTextData:C,image:u(H),label:de,labelText:se,lineEnding:U,link:u(te),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:ke,resourceDestinationString:O,resourceTitleString:ne,resource:pe,setextHeading:u(v),setextHeadingLineSequence:T,setextHeadingText:N,strong:u(),thematicBreak:u()}};YT(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(Z){let oe={type:"root",children:[]};const J={stack:[oe],tokenStack:[],config:t,enter:o,exit:c,buffer:i,resume:p,data:n},ue=[];let Pe=-1;for(;++Pe<Z.length;)if(Z[Pe][1].type==="listOrdered"||Z[Pe][1].type==="listUnordered")if(Z[Pe][0]==="enter")ue.push(Pe);else{const qe=ue.pop();Pe=a(Z,qe,Pe)}for(Pe=-1;++Pe<Z.length;){const qe=t[Z[Pe][0]];qT.call(qe,Z[Pe][1].type)&&qe[Z[Pe][1].type].call(Object.assign({sliceSerialize:Z[Pe][2].sliceSerialize},J),Z[Pe][1])}if(J.tokenStack.length>0){const qe=J.tokenStack[J.tokenStack.length-1];(qe[1]||EE).call(J,void 0,qe[0])}for(oe.position={start:jr(Z.length>0?Z[0][1].start:{line:1,column:1,offset:0}),end:jr(Z.length>0?Z[Z.length-2][1].end:{line:1,column:1,offset:0})},Pe=-1;++Pe<t.transforms.length;)oe=t.transforms[Pe](oe)||oe;return oe}function a(Z,oe,J){let ue=oe-1,Pe=-1,qe=!1,ht,Rt,kt,jt;for(;++ue<=J;){const ae=Z[ue];switch(ae[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ae[0]==="enter"?Pe++:Pe--,jt=void 0;break}case"lineEndingBlank":{ae[0]==="enter"&&(ht&&!jt&&!Pe&&!kt&&(kt=ue),jt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:jt=void 0}if(!Pe&&ae[0]==="enter"&&ae[1].type==="listItemPrefix"||Pe===-1&&ae[0]==="exit"&&(ae[1].type==="listUnordered"||ae[1].type==="listOrdered")){if(ht){let Ne=ue;for(Rt=void 0;Ne--;){const ze=Z[Ne];if(ze[1].type==="lineEnding"||ze[1].type==="lineEndingBlank"){if(ze[0]==="exit")continue;Rt&&(Z[Rt][1].type="lineEndingBlank",qe=!0),ze[1].type="lineEnding",Rt=Ne}else if(!(ze[1].type==="linePrefix"||ze[1].type==="blockQuotePrefix"||ze[1].type==="blockQuotePrefixWhitespace"||ze[1].type==="blockQuoteMarker"||ze[1].type==="listItemIndent"))break}kt&&(!Rt||kt<Rt)&&(ht._spread=!0),ht.end=Object.assign({},Rt?Z[Rt][1].start:ae[1].end),Z.splice(Rt||ue,0,["exit",ht,ae[2]]),ue++,J++}if(ae[1].type==="listItemPrefix"){const Ne={type:"listItem",_spread:!1,start:Object.assign({},ae[1].start),end:void 0};ht=Ne,Z.splice(ue,0,["enter",Ne,ae[2]]),ue++,J++,kt=void 0,jt=!0}}}return Z[oe][1]._spread=qe,J}function s(Z,oe){return J;function J(ue){o.call(this,Z(ue),ue),oe&&oe.call(this,ue)}}function i(){this.stack.push({type:"fragment",children:[]})}function o(Z,oe,J){this.stack[this.stack.length-1].children.push(Z),this.stack.push(Z),this.tokenStack.push([oe,J||void 0]),Z.position={start:jr(oe.start),end:void 0}}function u(Z){return oe;function oe(J){Z&&Z.call(this,J),c.call(this,J)}}function c(Z,oe){const J=this.stack.pop(),ue=this.tokenStack.pop();if(ue)ue[0].type!==Z.type&&(oe?oe.call(this,Z,ue[0]):(ue[1]||EE).call(this,Z,ue[0]));else throw new Error("Cannot close `"+Z.type+"` ("+si({start:Z.start,end:Z.end})+"): it’s not open");J.position.end=jr(Z.end)}function p(){return zg(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(Z){if(this.data.expectingFirstListItemValue){const oe=this.stack[this.stack.length-2];oe.start=Number.parseInt(this.sliceSerialize(Z),10),this.data.expectingFirstListItemValue=void 0}}function m(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.lang=Z}function b(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.meta=Z}function E(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z.replace(/(\r?\n|\r)$/g,"")}function S(Z){const oe=this.resume(),J=this.stack[this.stack.length-1];J.label=oe,J.identifier=lr(this.sliceSerialize(Z)).toLowerCase()}function w(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.title=Z}function A(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.url=Z}function D(Z){const oe=this.stack[this.stack.length-1];if(!oe.depth){const J=this.sliceSerialize(Z).length;oe.depth=J}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function T(Z){const oe=this.stack[this.stack.length-1];oe.depth=this.sliceSerialize(Z).codePointAt(0)===61?1:2}function v(){this.data.setextHeadingSlurpLineEnding=void 0}function R(Z){const J=this.stack[this.stack.length-1].children;let ue=J[J.length-1];(!ue||ue.type!=="text")&&(ue=De(),ue.position={start:jr(Z.start),end:void 0},J.push(ue)),this.stack.push(ue)}function C(Z){const oe=this.stack.pop();oe.value+=this.sliceSerialize(Z),oe.position.end=jr(Z.end)}function U(Z){const oe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const J=oe.children[oe.children.length-1];J.position.end=jr(Z.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(oe.type)&&(R.call(this,Z),C.call(this,Z))}function k(){this.data.atHardBreak=!0}function j(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z}function G(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z}function $(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z}function te(){const Z=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";Z.type+="Reference",Z.referenceType=oe,delete Z.url,delete Z.title}else delete Z.identifier,delete Z.label;this.data.referenceType=void 0}function H(){const Z=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";Z.type+="Reference",Z.referenceType=oe,delete Z.url,delete Z.title}else delete Z.identifier,delete Z.label;this.data.referenceType=void 0}function se(Z){const oe=this.sliceSerialize(Z),J=this.stack[this.stack.length-2];J.label=SL(oe),J.identifier=lr(oe).toLowerCase()}function de(){const Z=this.stack[this.stack.length-1],oe=this.resume(),J=this.stack[this.stack.length-1];if(this.data.inReference=!0,J.type==="link"){const ue=Z.children;J.children=ue}else J.alt=oe}function O(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.url=Z}function ne(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.title=Z}function pe(){this.data.inReference=void 0}function L(){this.data.referenceType="collapsed"}function ke(Z){const oe=this.resume(),J=this.stack[this.stack.length-1];J.label=oe,J.identifier=lr(this.sliceSerialize(Z)).toLowerCase(),this.data.referenceType="full"}function Re(Z){this.data.characterReferenceType=Z.type}function Q(Z){const oe=this.sliceSerialize(Z),J=this.data.characterReferenceType;let ue;J?(ue=PT(oe,J==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ue=gi(oe);const Pe=this.stack[this.stack.length-1];Pe.value+=ue}function _e(Z){const oe=this.stack.pop();oe.position.end=jr(Z.end)}function fe(Z){C.call(this,Z);const oe=this.stack[this.stack.length-1];oe.url=this.sliceSerialize(Z)}function X(Z){C.call(this,Z);const oe=this.stack[this.stack.length-1];oe.url="mailto:"+this.sliceSerialize(Z)}function Ve(){return{type:"blockquote",children:[]}}function ge(){return{type:"code",lang:null,meta:null,value:""}}function me(){return{type:"inlineCode",value:""}}function Te(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ve(){return{type:"emphasis",children:[]}}function ie(){return{type:"heading",depth:0,children:[]}}function Ze(){return{type:"break"}}function ot(){return{type:"html",value:""}}function rt(){return{type:"image",title:null,url:"",alt:null}}function Ht(){return{type:"link",title:null,url:"",children:[]}}function St(Z){return{type:"list",ordered:Z.type==="listOrdered",start:null,spread:Z._spread,children:[]}}function Ct(Z){return{type:"listItem",spread:Z._spread,checked:null,children:[]}}function Zt(){return{type:"paragraph",children:[]}}function at(){return{type:"strong",children:[]}}function De(){return{type:"text",value:""}}function et(){return{type:"thematicBreak"}}}function jr(e){return{line:e.line,column:e.column,offset:e.offset}}function YT(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?YT(e,r):NL(e,r)}}function NL(e,t){let n;for(n in t)if(qT.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function EE(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+si({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+si({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+si({start:t.start,end:t.end})+") is still open")}function _L(e){const t=this;t.parser=n;function n(r){return wL(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function CL(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function kL(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
20
20
|
`}]}function IL(e,t){const n=t.value?t.value+`
|
|
21
21
|
`:"",r={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(r.className=["language-"+a[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function RL(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function DL(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function OL(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),a=ys(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let i,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),i=e.footnoteOrder.length):i=s+1,o+=1,e.footnoteCounts.set(r,o);const u={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(i)}]};e.patch(t,u);const c={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(t,c),e.applyData(t,c)}function LL(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function FL(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function ZT(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const a=e.all(t),s=a[0];s&&s.type==="text"?s.value="["+s.value:a.unshift({type:"text",value:"["});const i=a[a.length-1];return i&&i.type==="text"?i.value+=r:a.push({type:"text",value:r}),a}function ML(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return ZT(e,t);const a={src:ys(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(a.title=r.title);const s={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,s),e.applyData(t,s)}function PL(e,t){const n={src:ys(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function jL(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function BL(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return ZT(e,t);const a={href:ys(r.url||"")};r.title!==null&&r.title!==void 0&&(a.title=r.title);const s={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function UL(e,t){const n={href:ys(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function $L(e,t,n){const r=e.all(t),a=n?zL(n):KT(t),s={},i=[];if(typeof t.checked=="boolean"){const p=r[0];let d;p&&p.type==="element"&&p.tagName==="p"?d=p:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let o=-1;for(;++o<r.length;){const p=r[o];(a||o!==0||p.type!=="element"||p.tagName!=="p")&&i.push({type:"text",value:`
|
|
22
22
|
`}),p.type==="element"&&p.tagName==="p"&&!a?i.push(...p.children):i.push(p)}const u=r[r.length-1];u&&(a||u.type!=="element"||u.tagName!=="p")&&i.push({type:"text",value:`
|
|
@@ -43,7 +43,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
43
43
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:i,tableCell:u,tableRow:o}};function i(m,b,E,x){return c(p(m,E,x),m.align)}function o(m,b,E,x){const y=d(m,E,x),S=c([y]);return S.slice(0,S.indexOf(`
|
|
44
44
|
`))}function u(m,b,E,x){const y=E.enter("tableCell"),S=E.enter("phrasing"),w=E.containerPhrasing(m,{...x,before:s,after:s});return S(),y(),w}function c(m,b){return y6(m,{align:b,alignDelimiters:r,padding:n,stringLength:a})}function p(m,b,E){const x=m.children;let y=-1;const S=[],w=b.enter("table");for(;++y<x.length;)S[y]=d(x[y],b,E);return w(),S}function d(m,b,E){const x=m.children;let y=-1;const S=[],w=b.enter("tableRow");for(;++y<x.length;)S[y]=u(x[y],m,b,E);return w(),S}function f(m,b,E){let x=pS.inlineCode(m,b,E);return E.stack.includes("tableCell")&&(x=x.replace(/\|/g,"\\$&")),x}}function oF(){return{exit:{taskListCheckValueChecked:FE,taskListCheckValueUnchecked:FE,paragraph:uF}}}function lF(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:cF}}}function FE(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function uF(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const a=t.children;let s=-1,i;for(;++s<a.length;){const o=a[s];if(o.type==="paragraph"){i=o;break}}i===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function cF(e,t,n,r){const a=e.children[0],s=typeof e.checked=="boolean"&&a&&a.type==="paragraph",i="["+(e.checked?"x":" ")+"] ",o=n.createTracker(r);s&&o.move(i);let u=pS.listItem(e,t,n,{...r,...o.current()});return s&&(u=u.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),u;function c(p){return p+i}}function dF(){return[H3(),c6(),m6(),eF(),oF()]}function pF(e){return{extensions:[G3(),d6(e),h6(),iF(e),lF()]}}const fF={tokenize:xF,partial:!0},fS={tokenize:yF,partial:!0},mS={tokenize:TF,partial:!0},hS={tokenize:SF,partial:!0},mF={tokenize:vF,partial:!0},gS={name:"wwwAutolink",tokenize:bF,previous:ES},bS={name:"protocolAutolink",tokenize:EF,previous:xS},Lr={name:"emailAutolink",tokenize:gF,previous:yS},Nr={};function hF(){return{text:Nr}}let sa=48;for(;sa<123;)Nr[sa]=Lr,sa++,sa===58?sa=65:sa===91&&(sa=97);Nr[43]=Lr;Nr[45]=Lr;Nr[46]=Lr;Nr[95]=Lr;Nr[72]=[Lr,bS];Nr[104]=[Lr,bS];Nr[87]=[Lr,gS];Nr[119]=[Lr,gS];function gF(e,t,n){const r=this;let a,s;return i;function i(d){return!od(d)||!yS.call(r,r.previous)||qg(r.events)?n(d):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),o(d))}function o(d){return od(d)?(e.consume(d),o):d===64?(e.consume(d),u):n(d)}function u(d){return d===46?e.check(mF,p,c)(d):d===45||d===95||In(d)?(s=!0,e.consume(d),u):p(d)}function c(d){return e.consume(d),a=!0,u}function p(d){return s&&a&&Fn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(d)):n(d)}}function bF(e,t,n){const r=this;return a;function a(i){return i!==87&&i!==119||!ES.call(r,r.previous)||qg(r.events)?n(i):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(fF,e.attempt(fS,e.attempt(mS,s),n),n)(i))}function s(i){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(i)}}function EF(e,t,n){const r=this;let a="",s=!1;return i;function i(d){return(d===72||d===104)&&xS.call(r,r.previous)&&!qg(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(d),e.consume(d),o):n(d)}function o(d){if(Fn(d)&&a.length<5)return a+=String.fromCodePoint(d),e.consume(d),o;if(d===58){const f=a.toLowerCase();if(f==="http"||f==="https")return e.consume(d),u}return n(d)}function u(d){return d===47?(e.consume(d),s?c:(s=!0,u)):n(d)}function c(d){return d===null||nl(d)||Pt(d)||ba(d)||pu(d)?n(d):e.attempt(fS,e.attempt(mS,p),n)(d)}function p(d){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(d)}}function xF(e,t,n){let r=0;return a;function a(i){return(i===87||i===119)&&r<3?(r++,e.consume(i),a):i===46&&r===3?(e.consume(i),s):n(i)}function s(i){return i===null?n(i):t(i)}}function yF(e,t,n){let r,a,s;return i;function i(c){return c===46||c===95?e.check(hS,u,o)(c):c===null||Pt(c)||ba(c)||c!==45&&pu(c)?u(c):(s=!0,e.consume(c),i)}function o(c){return c===95?r=!0:(a=r,r=void 0),e.consume(c),i}function u(c){return a||r||!s?n(c):t(c)}}function TF(e,t){let n=0,r=0;return a;function a(i){return i===40?(n++,e.consume(i),a):i===41&&r<n?s(i):i===33||i===34||i===38||i===39||i===41||i===42||i===44||i===46||i===58||i===59||i===60||i===63||i===93||i===95||i===126?e.check(hS,t,s)(i):i===null||Pt(i)||ba(i)?t(i):(e.consume(i),a)}function s(i){return i===41&&r++,e.consume(i),a}}function SF(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),s):o===93?(e.consume(o),a):o===60||o===null||Pt(o)||ba(o)?t(o):n(o)}function a(o){return o===null||o===40||o===91||Pt(o)||ba(o)?t(o):r(o)}function s(o){return Fn(o)?i(o):n(o)}function i(o){return o===59?(e.consume(o),r):Fn(o)?(e.consume(o),i):n(o)}}function vF(e,t,n){return r;function r(s){return e.consume(s),a}function a(s){return In(s)?n(s):t(s)}}function ES(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Pt(e)}function xS(e){return!Fn(e)}function yS(e){return!(e===47||od(e))}function od(e){return e===43||e===45||e===46||e===95||In(e)}function qg(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const wF={tokenize:DF,partial:!0};function AF(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:kF,continuation:{tokenize:IF},exit:RF}},text:{91:{name:"gfmFootnoteCall",tokenize:CF},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:NF,resolveTo:_F}}}}function NF(e,t,n){const r=this;let a=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i;for(;a--;){const u=r.events[a][1];if(u.type==="labelImage"){i=u;break}if(u.type==="gfmFootnoteCall"||u.type==="labelLink"||u.type==="label"||u.type==="image"||u.type==="link")break}return o;function o(u){if(!i||!i._balanced)return n(u);const c=lr(r.sliceSerialize({start:i.end,end:r.now()}));return c.codePointAt(0)!==94||!s.includes(c.slice(1))?n(u):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),t(u))}}function _F(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},i={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},o=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...o),e}function CF(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,i;return o;function o(d){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),u}function u(d){return d!==94?n(d):(e.enter("gfmFootnoteCallMarker"),e.consume(d),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(d){if(s>999||d===93&&!i||d===null||d===91||Pt(d))return n(d);if(d===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return a.includes(lr(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(d)}return Pt(d)||(i=!0),s++,e.consume(d),d===92?p:c}function p(d){return d===91||d===92||d===93?(e.consume(d),s++,c):c(d)}}function kF(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,i=0,o;return u;function u(b){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(b){return b===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(b)}function p(b){if(i>999||b===93&&!o||b===null||b===91||Pt(b))return n(b);if(b===93){e.exit("chunkString");const E=e.exit("gfmFootnoteDefinitionLabelString");return s=lr(r.sliceSerialize(E)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return Pt(b)||(o=!0),i++,e.consume(b),b===92?d:p}function d(b){return b===91||b===92||b===93?(e.consume(b),i++,p):p(b)}function f(b){return b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),a.includes(s)||a.push(s),xt(e,m,"gfmFootnoteDefinitionWhitespace")):n(b)}function m(b){return t(b)}}function IF(e,t,n){return e.check(Yi,t,e.attempt(wF,t,n))}function RF(e){e.exit("gfmFootnoteDefinition")}function DF(e,t,n){const r=this;return xt(e,a,"gfmFootnoteDefinitionIndent",5);function a(s){const i=r.events[r.events.length-1];return i&&i[1].type==="gfmFootnoteDefinitionIndent"&&i[2].sliceSerialize(i[1],!0).length===4?t(s):n(s)}}function OF(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:a};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(i,o){let u=-1;for(;++u<i.length;)if(i[u][0]==="enter"&&i[u][1].type==="strikethroughSequenceTemporary"&&i[u][1]._close){let c=u;for(;c--;)if(i[c][0]==="exit"&&i[c][1].type==="strikethroughSequenceTemporary"&&i[c][1]._open&&i[u][1].end.offset-i[u][1].start.offset===i[c][1].end.offset-i[c][1].start.offset){i[u][1].type="strikethroughSequence",i[c][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},i[c][1].start),end:Object.assign({},i[u][1].end)},d={type:"strikethroughText",start:Object.assign({},i[c][1].end),end:Object.assign({},i[u][1].start)},f=[["enter",p,o],["enter",i[c][1],o],["exit",i[c][1],o],["enter",d,o]],m=o.parser.constructs.insideSpan.null;m&&Vn(f,f.length,0,fu(m,i.slice(c+1,u),o)),Vn(f,f.length,0,[["exit",d,o],["enter",i[u][1],o],["exit",i[u][1],o],["exit",p,o]]),Vn(i,c-1,u-c+3,f),u=c+f.length-2;break}}for(u=-1;++u<i.length;)i[u][1].type==="strikethroughSequenceTemporary"&&(i[u][1].type="data");return i}function s(i,o,u){const c=this.previous,p=this.events;let d=0;return f;function f(b){return c===126&&p[p.length-1][1].type!=="characterEscape"?u(b):(i.enter("strikethroughSequenceTemporary"),m(b))}function m(b){const E=rs(c);if(b===126)return d>1?u(b):(i.consume(b),d++,m);if(d<2&&!n)return u(b);const x=i.exit("strikethroughSequenceTemporary"),y=rs(b);return x._open=!y||y===2&&!!E,x._close=!E||E===2&&!!y,o(b)}}}class LF{constructor(){this.map=[]}add(t,n,r){FF(this,t,n,r)}consume(t){if(this.map.sort(function(s,i){return s[0]-i[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const s of a)t.push(s);a=r.pop()}this.map.length=0}}function FF(e,t,n,r){let a=0;if(!(n===0&&r.length===0)){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=n,e.map[a][2].push(...r);return}a+=1}e.map.push([t,n,r])}}function MF(e,t){let n=!1;const r=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function PF(){return{flow:{null:{name:"table",tokenize:jF,resolveAll:BF}}}}function jF(e,t,n){const r=this;let a=0,s=0,i;return o;function o(C){let U=r.events.length-1;for(;U>-1;){const G=r.events[U][1].type;if(G==="lineEnding"||G==="linePrefix")U--;else break}const k=U>-1?r.events[U][1].type:null,j=k==="tableHead"||k==="tableRow"?N:u;return j===N&&r.parser.lazy[r.now().line]?n(C):j(C)}function u(C){return e.enter("tableHead"),e.enter("tableRow"),c(C)}function c(C){return C===124||(i=!0,s+=1),p(C)}function p(C){return C===null?n(C):He(C)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),m):n(C):dt(C)?xt(e,p,"whitespace")(C):(s+=1,i&&(i=!1,a+=1),C===124?(e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),i=!0,p):(e.enter("data"),d(C)))}function d(C){return C===null||C===124||Pt(C)?(e.exit("data"),p(C)):(e.consume(C),C===92?f:d)}function f(C){return C===92||C===124?(e.consume(C),d):d(C)}function m(C){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(C):(e.enter("tableDelimiterRow"),i=!1,dt(C)?xt(e,b,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):b(C))}function b(C){return C===45||C===58?x(C):C===124?(i=!0,e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),E):D(C)}function E(C){return dt(C)?xt(e,x,"whitespace")(C):x(C)}function x(C){return C===58?(s+=1,i=!0,e.enter("tableDelimiterMarker"),e.consume(C),e.exit("tableDelimiterMarker"),y):C===45?(s+=1,y(C)):C===null||He(C)?A(C):D(C)}function y(C){return C===45?(e.enter("tableDelimiterFiller"),S(C)):D(C)}function S(C){return C===45?(e.consume(C),S):C===58?(i=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(C),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w(C))}function w(C){return dt(C)?xt(e,A,"whitespace")(C):A(C)}function A(C){return C===124?b(C):C===null||He(C)?!i||a!==s?D(C):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(C)):D(C)}function D(C){return n(C)}function N(C){return e.enter("tableRow"),T(C)}function T(C){return C===124?(e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),T):C===null||He(C)?(e.exit("tableRow"),t(C)):dt(C)?xt(e,T,"whitespace")(C):(e.enter("data"),v(C))}function v(C){return C===null||C===124||Pt(C)?(e.exit("data"),T(C)):(e.consume(C),C===92?R:v)}function R(C){return C===92||C===124?(e.consume(C),v):v(C)}}function BF(e,t){let n=-1,r=!0,a=0,s=[0,0,0,0],i=[0,0,0,0],o=!1,u=0,c,p,d;const f=new LF;for(;++n<e.length;){const m=e[n],b=m[1];m[0]==="enter"?b.type==="tableHead"?(o=!1,u!==0&&(ME(f,t,u,c,p),p=void 0,u=0),c={type:"table",start:Object.assign({},b.start),end:Object.assign({},b.end)},f.add(n,0,[["enter",c,t]])):b.type==="tableRow"||b.type==="tableDelimiterRow"?(r=!0,d=void 0,s=[0,0,0,0],i=[0,n+1,0,0],o&&(o=!1,p={type:"tableBody",start:Object.assign({},b.start),end:Object.assign({},b.end)},f.add(n,0,[["enter",p,t]])),a=b.type==="tableDelimiterRow"?2:p?3:1):a&&(b.type==="data"||b.type==="tableDelimiterMarker"||b.type==="tableDelimiterFiller")?(r=!1,i[2]===0&&(s[1]!==0&&(i[0]=i[1],d=bo(f,t,s,a,void 0,d),s=[0,0,0,0]),i[2]=n)):b.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(i[0]=i[1],d=bo(f,t,s,a,void 0,d)),s=i,i=[s[1],n,0,0])):b.type==="tableHead"?(o=!0,u=n):b.type==="tableRow"||b.type==="tableDelimiterRow"?(u=n,s[1]!==0?(i[0]=i[1],d=bo(f,t,s,a,n,d)):i[1]!==0&&(d=bo(f,t,i,a,n,d)),a=0):a&&(b.type==="data"||b.type==="tableDelimiterMarker"||b.type==="tableDelimiterFiller")&&(i[3]=n)}for(u!==0&&ME(f,t,u,c,p),f.consume(t.events),n=-1;++n<t.events.length;){const m=t.events[n];m[0]==="enter"&&m[1].type==="table"&&(m[1]._align=MF(t.events,n))}return e}function bo(e,t,n,r,a,s){const i=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",o="tableContent";n[0]!==0&&(s.end=Object.assign({},$a(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));const u=$a(t.events,n[1]);if(s={type:i,start:Object.assign({},u),end:Object.assign({},u)},e.add(n[1],0,[["enter",s,t]]),n[2]!==0){const c=$a(t.events,n[2]),p=$a(t.events,n[3]),d={type:o,start:Object.assign({},c),end:Object.assign({},p)};if(e.add(n[2],0,[["enter",d,t]]),r!==2){const f=t.events[n[2]],m=t.events[n[3]];if(f[1].end=Object.assign({},m[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const b=n[2]+1,E=n[3]-n[2]-1;e.add(b,E,[])}}e.add(n[3]+1,0,[["exit",d,t]])}return a!==void 0&&(s.end=Object.assign({},$a(t.events,a)),e.add(a,0,[["exit",s,t]]),s=void 0),s}function ME(e,t,n,r,a){const s=[],i=$a(t.events,n);a&&(a.end=Object.assign({},i),s.push(["exit",a,t])),r.end=Object.assign({},i),s.push(["exit",r,t]),e.add(n+1,0,s)}function $a(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const UF={name:"tasklistCheck",tokenize:zF};function $F(){return{text:{91:UF}}}function zF(e,t,n){const r=this;return a;function a(u){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(u):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),s)}function s(u){return Pt(u)?(e.enter("taskListCheckValueUnchecked"),e.consume(u),e.exit("taskListCheckValueUnchecked"),i):u===88||u===120?(e.enter("taskListCheckValueChecked"),e.consume(u),e.exit("taskListCheckValueChecked"),i):n(u)}function i(u){return u===93?(e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(u)}function o(u){return He(u)?t(u):dt(u)?e.check({tokenize:HF},t,n)(u):n(u)}}function HF(e,t,n){return xt(e,r,"whitespace");function r(a){return a===null?n(a):t(a)}}function GF(e){return MT([hF(),AF(),OF(e),PF(),$F()])}const WF={};function VF(e){const t=this,n=e||WF,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),i=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(GF(n)),s.push(dF()),i.push(pF(n))}const qF=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]/i,YF=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)(\/.*)?\]/i,ZF=({legacyTitle:e=!1,tagName:t="div"}={})=>n=>{$n(n,"blockquote",(r,a,s)=>{let i="",o="",u=!0,c=r.children.map(p=>{if(u&&p.type==="paragraph"){const d=p.children[0],f=d.type==="text"?d.value:"",m=e?YF:qF,b=f.match(m);if(b&&(u=!1,i=b[1].toLocaleLowerCase(),o=e&&b[2]||i.toLocaleUpperCase(),f.includes(`
|
|
45
45
|
`)&&(p.children[0]={type:"text",value:f.replace(m,"").replace(/^\n+/,"")}),!f.includes(`
|
|
46
|
-
`))){const E=[];p.children.forEach((x,y)=>{y!=0&&(y==1&&x.type==="break"||E.push(x))}),p.children=[...E]}}return p});i&&(r.data={hName:t,hProperties:{class:`markdown-alert markdown-alert-${i}`,dir:"auto"}},c.unshift({type:"paragraph",children:[KF(i),{type:"text",value:o.replace(/^\//,"")}],data:{hProperties:{class:"markdown-alert-title",dir:"auto"}}})),r.children=[...c]})};function KF(e){let t=XF[e]??"";return{type:"emphasis",data:{hName:"svg",hProperties:{class:"octicon",viewBox:"0 0 16 16",width:"16",height:"16",ariaHidden:"true"}},children:[{type:"emphasis",data:{hName:"path",hProperties:{d:t}},children:[]}]}}const XF={note:"M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z",tip:"M8 1.5c-2.363 0-4 1.69-4 3.75 0 .984.424 1.625.984 2.304l.214.253c.223.264.47.556.673.848.284.411.537.896.621 1.49a.75.75 0 0 1-1.484.211c-.04-.282-.163-.547-.37-.847a8.456 8.456 0 0 0-.542-.68c-.084-.1-.173-.205-.268-.32C3.201 7.75 2.5 6.766 2.5 5.25 2.5 2.31 4.863 0 8 0s5.5 2.31 5.5 5.25c0 1.516-.701 2.5-1.328 3.259-.095.115-.184.22-.268.319-.207.245-.383.453-.541.681-.208.3-.33.565-.37.847a.751.751 0 0 1-1.485-.212c.084-.593.337-1.078.621-1.489.203-.292.45-.584.673-.848.075-.088.147-.173.213-.253.561-.679.985-1.32.985-2.304 0-2.06-1.637-3.75-4-3.75ZM5.75 12h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM6 15.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75Z",important:"M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",warning:"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",caution:"M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25A.749.749 0 0 1 11 16H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"};function QF(e,t){if(typeof document>"u")return;const n=document.createElement("textarea");n.value=e,n.setAttribute("readonly",""),n.style={position:"absolute",left:"-9999px"},document.body.appendChild(n);const r=document.getSelection().rangeCount>0?document.getSelection().getRangeAt(0):!1;n.select();let a=!1;try{a=!!document.execCommand("copy")}catch{a=!1}document.body.removeChild(n),r&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(r)),t&&t(a)}function TS(e){if(!e)return null;var t=e;return t.dataset.code&&t.classList.contains("copied")?t:t.parentElement?TS(t.parentElement):null}function JF(e){var t=n=>{var r=TS(n.target);r&&(r.classList.add("active"),QF(r.dataset.code,function(){setTimeout(()=>{r.classList.remove("active")},2e3)}))};g.useEffect(()=>{var n,r;return(n=e.current)==null||n.removeEventListener("click",t,!1),(r=e.current)==null||r.addEventListener("click",t,!1),()=>{var a;(a=e.current)==null||a.removeEventListener("click",t,!1)}},[e])}var e4=["prefixCls","className","source","style","disableCopy","skipHtml","onScroll","onMouseOver","pluginsFilter","rehypeRewrite","wrapperElement","warpperElement","urlTransform"],t4=e=>e;const n4=et.forwardRef((e,t)=>{var n=e.prefixCls,r=n===void 0?"wmde-markdown wmde-markdown-color":n,a=e.className,s=e.source,i=e.style;e.disableCopy;var o=e.skipHtml,u=o===void 0?!0:o,c=e.onScroll,p=e.onMouseOver,d=e.pluginsFilter;e.rehypeRewrite;var f=e.wrapperElement,m=f===void 0?{}:f,b=e.warpperElement,E=b===void 0?{}:b,x=e.urlTransform,y=Ei(e,e4),S=et.useRef(null);g.useImperativeHandle(t,()=>ct({},e,{mdp:S}),[S,e]);var w=(r||"")+" "+(a||"");JF(S);var A=[...y.rehypePlugins||[]],D={allowElement:(v,R,C)=>y.allowElement?y.allowElement(v,R,C):/^[A-Za-z0-9]+$/.test(v.tagName)};u||A.push(IT);var N=[ZF,...y.remarkPlugins||[],VF],T=ct({},E,m);return l.jsx("div",ct({ref:S,onScroll:c,onMouseOver:p},T,{className:w,style:i,children:l.jsx(O3,ct({},D,y,{skipHtml:!u,urlTransform:x||t4,rehypePlugins:d?d("rehype",A):A,remarkPlugins:d?d("remark",N):N,children:s||""}))}))});var r4=function(t){return n=>{$n(n,r=>{r.type==="element"&&r.tagName==="code"&&r.data&&r.data.meta&&(r.properties=ct({},r.properties,{"data-meta":String(r.data.meta)}))})}},a4=function(t){return n=>{$n(n,r=>{if(r.type==="element"&&r.tagName==="code"&&r.properties&&r.properties.dataMeta){r.data||(r.data={});var a=r.properties.dataMeta;typeof a=="string"&&(r.data.meta=a),delete r.properties.dataMeta}})}};const s4=/[\0-\x1F!-,\.\/:-@\[-\^`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482\u0530\u0557\u0558\u055A-\u055F\u0589-\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u05CF\u05EB-\u05EE\u05F3-\u060F\u061B-\u061F\u066A-\u066D\u06D4\u06DD\u06DE\u06E9\u06FD\u06FE\u0700-\u070F\u074B\u074C\u07B2-\u07BF\u07F6-\u07F9\u07FB\u07FC\u07FE\u07FF\u082E-\u083F\u085C-\u085F\u086B-\u089F\u08B5\u08C8-\u08D2\u08E2\u0964\u0965\u0970\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09F2-\u09FB\u09FD\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF0-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B70\u0B72-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BF0-\u0BFF\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B-\u0C5F\u0C64\u0C65\u0C70-\u0C7F\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D4F-\u0D53\u0D58-\u0D5E\u0D64\u0D65\u0D70-\u0D79\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF4-\u0E00\u0E3B-\u0E3F\u0E4F\u0E5A-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F01-\u0F17\u0F1A-\u0F1F\u0F2A-\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F48\u0F6D-\u0F70\u0F85\u0F98\u0FBD-\u0FC5\u0FC7-\u0FFF\u104A-\u104F\u109E\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u1360-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16ED\u16F9-\u16FF\u170D\u1715-\u171F\u1735-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17D4-\u17D6\u17D8-\u17DB\u17DE\u17DF\u17EA-\u180A\u180E\u180F\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u1945\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DA-\u19FF\u1A1C-\u1A1F\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1AA6\u1AA8-\u1AAF\u1AC1-\u1AFF\u1B4C-\u1B4F\u1B5A-\u1B6A\u1B74-\u1B7F\u1BF4-\u1BFF\u1C38-\u1C3F\u1C4A-\u1C4C\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CCF\u1CD3\u1CFB-\u1CFF\u1DFA\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u203E\u2041-\u2053\u2055-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u20CF\u20F1-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u215F\u2189-\u24B5\u24EA-\u2BFF\u2C2F\u2C5F\u2CE5-\u2CEA\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E00-\u2E2E\u2E30-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u3040\u3097\u3098\u309B\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\u9FFD-\u9FFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA62C-\uA63F\uA673\uA67E\uA6F2-\uA716\uA720\uA721\uA789\uA78A\uA7C0\uA7C1\uA7CB-\uA7F4\uA828-\uA82B\uA82D-\uA83F\uA874-\uA87F\uA8C6-\uA8CF\uA8DA-\uA8DF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA954-\uA95F\uA97D-\uA97F\uA9C1-\uA9CE\uA9DA-\uA9DF\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A-\uAA5F\uAA77-\uAA79\uAAC3-\uAADA\uAADE\uAADF\uAAF0\uAAF1\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABEB\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFDFF\uFE10-\uFE1F\uFE30-\uFE32\uFE35-\uFE4C\uFE50-\uFE6F\uFE75\uFEFD-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF3E\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDD3F\uDD75-\uDDFC\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEE1-\uDEFF\uDF20-\uDF2C\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE36\uDE37\uDE3B-\uDE3E\uDE40-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE7-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD28-\uDD2F\uDD3A-\uDE7F\uDEAA\uDEAD-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF51-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC47-\uDC65\uDC70-\uDC7E\uDCBB-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD40-\uDD43\uDD48-\uDD4F\uDD74\uDD75\uDD77-\uDD7F\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDFF\uDE12\uDE38-\uDE3D\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC4B-\uDC4F\uDC5A-\uDC5D\uDC62-\uDC7F\uDCC6\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDC1-\uDDD7\uDDDE-\uDDFF\uDE41-\uDE43\uDE45-\uDE4F\uDE5A-\uDE7F\uDEB9-\uDEBF\uDECA-\uDEFF\uDF1B\uDF1C\uDF2C-\uDF2F\uDF3A-\uDFFF]|\uD806[\uDC3B-\uDC9F\uDCEA-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD36\uDD39\uDD3A\uDD44-\uDD4F\uDD5A-\uDD9F\uDDA8\uDDA9\uDDD8\uDDD9\uDDE2\uDDE5-\uDDFF\uDE3F-\uDE46\uDE48-\uDE4F\uDE9A-\uDE9C\uDE9E-\uDEBF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC41-\uDC4F\uDC5A-\uDC71\uDC90\uDC91\uDCA8\uDCB7-\uDCFF\uDD07\uDD0A\uDD37-\uDD39\uDD3B\uDD3E\uDD48-\uDD4F\uDD5A-\uDD5F\uDD66\uDD69\uDD8F\uDD92\uDD99-\uDD9F\uDDAA-\uDEDF\uDEF7-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80B\uD80E-\uD810\uD812-\uD819\uD824-\uD82B\uD82D\uD82E\uD830-\uD833\uD837\uD839\uD83D\uD83F\uD87B-\uD87D\uD87F\uD885-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDECF\uDEEE\uDEEF\uDEF5-\uDEFF\uDF37-\uDF3F\uDF44-\uDF4F\uDF5A-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4E\uDF88-\uDF8E\uDFA0-\uDFDF\uDFE2\uDFE5-\uDFEF\uDFF2-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82C[\uDD1F-\uDD4F\uDD53-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDC9C\uDC9F-\uDFFF]|\uD834[\uDC00-\uDD64\uDD6A-\uDD6C\uDD73-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDE41\uDE45-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC\uDFCD]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD4F-\uDEBF\uDEFA-\uDFFF]|\uD83A[\uDCC5-\uDCCF\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD83C[\uDC00-\uDD2F\uDD4A-\uDD4F\uDD6A-\uDD6F\uDD8A-\uDFFF]|\uD83E[\uDC00-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEDE-\uDEFF]|\uD86D[\uDF35-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]/g,i4=Object.hasOwnProperty;class o4{constructor(){this.occurrences,this.reset()}slug(t,n){const r=this;let a=l4(t,n===!0);const s=a;for(;i4.call(r.occurrences,a);)r.occurrences[s]++,a=s+"-"+r.occurrences[s];return r.occurrences[a]=0,a}reset(){this.occurrences=Object.create(null)}}function l4(e,t){return typeof e!="string"?"":(t||(e=e.toLowerCase()),e.replace(s4,"").replace(/ /g,"-"))}function SS(e){const t=e.type==="element"?e.tagName.toLowerCase():"",n=t.length===2&&t.charCodeAt(0)===104?t.charCodeAt(1):0;return n>48&&n<55?n-48:void 0}const u4={},PE=new o4;function c4(e){const n=(e||u4).prefix||"";return function(r){PE.reset(),$n(r,"element",function(a){SS(a)&&!a.properties.id&&(a.properties.id=n+PE.slug(Ga(a)))})}}const vS=(function(e){if(e==null)return f4;if(typeof e=="string")return p4(e);if(typeof e=="object")return d4(e);if(typeof e=="function")return Yg(e);throw new Error("Expected function, string, or array as `test`")});function d4(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=vS(e[n]);return Yg(r);function r(...a){let s=-1;for(;++s<t.length;)if(t[s].apply(this,a))return!0;return!1}}function p4(e){return Yg(t);function t(n){return n.tagName===e}}function Yg(e){return t;function t(n,r,a){return!!(m4(n)&&e.call(this,n,typeof r=="number"?r:void 0,a||void 0))}}function f4(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function m4(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const jE={type:"element",tagName:"span",properties:{className:["icon","icon-link"]},children:[]},h4={};function g4(e){const t=e||h4;let n=t.properties;const r=t.headingProperties,a=t.behavior||"prepend",s=t.content,i=t.group,o=vS(t.test);let u;return a==="after"||a==="before"?u=p:a==="wrap"?u=d:(u=c,n||(n={ariaHidden:"true",tabIndex:-1})),function(f){$n(f,"element",function(m,b,E){if(SS(m)&&m.properties.id&&o(m,b,E))return Object.assign(m.properties,Eo(r,m)),u(m,b,E)})};function c(f){const m=BE(s||jE,f);return f.children[a==="prepend"?"unshift":"push"](lc(f,Eo(n,f),m)),[Xs]}function p(f,m,b){if(typeof m!="number"||!b)return;const E=BE(s||jE,f),x=lc(f,Eo(n,f),E);let y=a==="before"?[x,f]:[f,x];if(i){const S=wS(i,f);S&&!Array.isArray(S)&&S.type==="element"&&(S.children=y,y=[S])}return b.children.splice(m,1,...y),[Xs,m+y.length]}function d(f){let m=f.children,b=[];return typeof s=="function"?(m=[],b=s(f)):s&&(b=Zg(s)),f.children=[lc(f,Eo(n,f),Array.isArray(b)?[...m,...b]:[...m,b])],[Xs]}}function Zg(e){return ga(e)}function lc(e,t,n){return{type:"element",tagName:"a",properties:{...t,href:"#"+e.properties.id},children:n}}function BE(e,t){const n=wS(e,t);return Array.isArray(n)?n:[n]}function wS(e,t){return typeof e=="function"?e(t):Zg(e)}function Eo(e,t){return typeof e=="function"?e(t):e?Zg(e):{}}const b4=(e={})=>{const{openDelimiter:t="rehype:ignore:start",closeDelimiter:n="rehype:ignore:end"}=e;return r=>{$n(r,(a,s,i)=>{if(a.type==="element"||a.type==="root"){let o=!1;a.children=a.children.filter(u=>{if(u.type==="raw"||u.type==="comment"){let c=(u.value||"").trim();if(c=c.replace(/^<!--(.*?)-->/,"$1"),c===t)return o=!0,!1;if(c===n)return o=!1,!1}return!o})}})}};var E4={type:"element",tagName:"svg",properties:{className:"octicon octicon-link",viewBox:"0 0 16 16",version:"1.1",width:"16",height:"16",ariaHidden:"true"},children:[{type:"element",tagName:"path",children:[],properties:{fillRule:"evenodd",d:"M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"}}]};function x4(e){return e===void 0&&(e=""),{type:"element",tagName:"div",properties:{class:"copied","data-code":e},children:[{type:"element",tagName:"svg",properties:{className:"octicon-copy",ariaHidden:"true",viewBox:"0 0 16 16",fill:"currentColor",height:12,width:12},children:[{type:"element",tagName:"path",properties:{fillRule:"evenodd",d:"M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"},children:[]},{type:"element",tagName:"path",properties:{fillRule:"evenodd",d:"M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"},children:[]}]},{type:"element",tagName:"svg",properties:{className:"octicon-check",ariaHidden:"true",viewBox:"0 0 16 16",fill:"currentColor",height:12,width:12},children:[{type:"element",tagName:"path",properties:{fillRule:"evenodd",d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"},children:[]}]}]}}var y4=(e,t)=>(n,r,a)=>{if(n.type==="element"&&a&&a.type==="root"&&/h(1|2|3|4|5|6)/.test(n.tagName)){var s=n.children&&n.children[0];s&&s.properties&&s.properties.ariaHidden==="true"&&(s.properties=ct({class:"anchor"},s.properties),s.children=[E4])}if(n.type==="element"&&n.tagName==="pre"&&!e){var i=$1(n.children);n.children.push(x4(i))}t&&t(n,r===null?void 0:r,a===null?void 0:a)},T4=[c4,g4,b4];const S4=et.forwardRef((e,t)=>{var n,r=[r4,IT,a4,...T4,[Mk,{rewrite:y4((n=e.disableCopy)!=null?n:!1,e.rehypeRewrite)}],[Uk,{properties:"attr"}],...e.rehypePlugins||[],[C1,{ignoreMissing:!0}]];return l.jsx(n4,ct({},e,{rehypePlugins:r,ref:t}))});function v4(e,t){return t||(t=e.slice(0)),e.raw=t,e}const w4={abandonedHeadElementChild:{reason:"Unexpected metadata element after head",description:"Unexpected element after head. Expected the element before `</head>`",url:!1},abruptClosingOfEmptyComment:{reason:"Unexpected abruptly closed empty comment",description:"Unexpected `>` or `->`. Expected `-->` to close comments"},abruptDoctypePublicIdentifier:{reason:"Unexpected abruptly closed public identifier",description:"Unexpected `>`. Expected a closing `\"` or `'` after the public identifier"},abruptDoctypeSystemIdentifier:{reason:"Unexpected abruptly closed system identifier",description:"Unexpected `>`. Expected a closing `\"` or `'` after the identifier identifier"},absenceOfDigitsInNumericCharacterReference:{reason:"Unexpected non-digit at start of numeric character reference",description:"Unexpected `%c`. Expected `[0-9]` for decimal references or `[0-9a-fA-F]` for hexadecimal references"},cdataInHtmlContent:{reason:"Unexpected CDATA section in HTML",description:"Unexpected `<![CDATA[` in HTML. Remove it, use a comment, or encode special characters instead"},characterReferenceOutsideUnicodeRange:{reason:"Unexpected too big numeric character reference",description:"Unexpectedly high character reference. Expected character references to be at most hexadecimal 10ffff (or decimal 1114111)"},closingOfElementWithOpenChildElements:{reason:"Unexpected closing tag with open child elements",description:"Unexpectedly closing tag. Expected other tags to be closed first",url:!1},controlCharacterInInputStream:{reason:"Unexpected control character",description:"Unexpected control character `%x`. Expected a non-control code point, 0x00, or ASCII whitespace"},controlCharacterReference:{reason:"Unexpected control character reference",description:"Unexpectedly control character in reference. Expected a non-control code point, 0x00, or ASCII whitespace"},disallowedContentInNoscriptInHead:{reason:"Disallowed content inside `<noscript>` in `<head>`",description:"Unexpected text character `%c`. Only use text in `<noscript>`s in `<body>`",url:!1},duplicateAttribute:{reason:"Unexpected duplicate attribute",description:"Unexpectedly double attribute. Expected attributes to occur only once"},endTagWithAttributes:{reason:"Unexpected attribute on closing tag",description:"Unexpected attribute. Expected `>` instead"},endTagWithTrailingSolidus:{reason:"Unexpected slash at end of closing tag",description:"Unexpected `%c-1`. Expected `>` instead"},endTagWithoutMatchingOpenElement:{reason:"Unexpected unopened end tag",description:"Unexpected end tag. Expected no end tag or another end tag",url:!1},eofBeforeTagName:{reason:"Unexpected end of file",description:"Unexpected end of file. Expected tag name instead"},eofInCdata:{reason:"Unexpected end of file in CDATA",description:"Unexpected end of file. Expected `]]>` to close the CDATA"},eofInComment:{reason:"Unexpected end of file in comment",description:"Unexpected end of file. Expected `-->` to close the comment"},eofInDoctype:{reason:"Unexpected end of file in doctype",description:"Unexpected end of file. Expected a valid doctype (such as `<!doctype html>`)"},eofInElementThatCanContainOnlyText:{reason:"Unexpected end of file in element that can only contain text",description:"Unexpected end of file. Expected text or a closing tag",url:!1},eofInScriptHtmlCommentLikeText:{reason:"Unexpected end of file in comment inside script",description:"Unexpected end of file. Expected `-->` to close the comment"},eofInTag:{reason:"Unexpected end of file in tag",description:"Unexpected end of file. Expected `>` to close the tag"},incorrectlyClosedComment:{reason:"Incorrectly closed comment",description:"Unexpected `%c-1`. Expected `-->` to close the comment"},incorrectlyOpenedComment:{reason:"Incorrectly opened comment",description:"Unexpected `%c`. Expected `<!--` to open the comment"},invalidCharacterSequenceAfterDoctypeName:{reason:"Invalid sequence after doctype name",description:"Unexpected sequence at `%c`. Expected `public` or `system`"},invalidFirstCharacterOfTagName:{reason:"Invalid first character in tag name",description:"Unexpected `%c`. Expected an ASCII letter instead"},misplacedDoctype:{reason:"Misplaced doctype",description:"Unexpected doctype. Expected doctype before head",url:!1},misplacedStartTagForHeadElement:{reason:"Misplaced `<head>` start tag",description:"Unexpected start tag `<head>`. Expected `<head>` directly after doctype",url:!1},missingAttributeValue:{reason:"Missing attribute value",description:"Unexpected `%c-1`. Expected an attribute value or no `%c-1` instead"},missingDoctype:{reason:"Missing doctype before other content",description:"Expected a `<!doctype html>` before anything else",url:!1},missingDoctypeName:{reason:"Missing doctype name",description:"Unexpected doctype end at `%c`. Expected `html` instead"},missingDoctypePublicIdentifier:{reason:"Missing public identifier in doctype",description:"Unexpected `%c`. Expected identifier for `public` instead"},missingDoctypeSystemIdentifier:{reason:"Missing system identifier in doctype",description:'Unexpected `%c`. Expected identifier for `system` instead (suggested: `"about:legacy-compat"`)'},missingEndTagName:{reason:"Missing name in end tag",description:"Unexpected `%c`. Expected an ASCII letter instead"},missingQuoteBeforeDoctypePublicIdentifier:{reason:"Missing quote before public identifier in doctype",description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingQuoteBeforeDoctypeSystemIdentifier:{reason:"Missing quote before system identifier in doctype",description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingSemicolonAfterCharacterReference:{reason:"Missing semicolon after character reference",description:"Unexpected `%c`. Expected `;` instead"},missingWhitespaceAfterDoctypePublicKeyword:{reason:"Missing whitespace after public identifier in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceAfterDoctypeSystemKeyword:{reason:"Missing whitespace after system identifier in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBeforeDoctypeName:{reason:"Missing whitespace before doctype name",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenAttributes:{reason:"Missing whitespace between attributes",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers:{reason:"Missing whitespace between public and system identifiers in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},nestedComment:{reason:"Unexpected nested comment",description:"Unexpected `<!--`. Expected `-->`"},nestedNoscriptInHead:{reason:"Unexpected nested `<noscript>` in `<head>`",description:"Unexpected `<noscript>`. Expected a closing tag or a meta element",url:!1},nonConformingDoctype:{reason:"Unexpected non-conforming doctype declaration",description:'Expected `<!doctype html>` or `<!doctype html system "about:legacy-compat">`',url:!1},nonVoidHtmlElementStartTagWithTrailingSolidus:{reason:"Unexpected trailing slash on start tag of non-void element",description:"Unexpected `/`. Expected `>` instead"},noncharacterCharacterReference:{reason:"Unexpected noncharacter code point referenced by character reference",description:"Unexpected code point. Do not use noncharacters in HTML"},noncharacterInInputStream:{reason:"Unexpected noncharacter character",description:"Unexpected code point `%x`. Do not use noncharacters in HTML"},nullCharacterReference:{reason:"Unexpected NULL character referenced by character reference",description:"Unexpected code point. Do not use NULL characters in HTML"},openElementsLeftAfterEof:{reason:"Unexpected end of file",description:"Unexpected end of file. Expected closing tag instead",url:!1},surrogateCharacterReference:{reason:"Unexpected surrogate character referenced by character reference",description:"Unexpected code point. Do not use lone surrogate characters in HTML"},surrogateInInputStream:{reason:"Unexpected surrogate character",description:"Unexpected code point `%x`. Do not use lone surrogate characters in HTML"},unexpectedCharacterAfterDoctypeSystemIdentifier:{reason:"Invalid character after system identifier in doctype",description:"Unexpected character at `%c`. Expected `>`"},unexpectedCharacterInAttributeName:{reason:"Unexpected character in attribute name",description:"Unexpected `%c`. Expected whitespace, `/`, `>`, `=`, or probably an ASCII letter"},unexpectedCharacterInUnquotedAttributeValue:{reason:"Unexpected character in unquoted attribute value",description:"Unexpected `%c`. Quote the attribute value to include it"},unexpectedEqualsSignBeforeAttributeName:{reason:"Unexpected equals sign before attribute name",description:"Unexpected `%c`. Add an attribute name before it"},unexpectedNullCharacter:{reason:"Unexpected NULL character",description:"Unexpected code point `%x`. Do not use NULL characters in HTML"},unexpectedQuestionMarkInsteadOfTagName:{reason:"Unexpected question mark instead of tag name",description:"Unexpected `%c`. Expected an ASCII letter instead"},unexpectedSolidusInTag:{reason:"Unexpected slash in tag",description:"Unexpected `%c-1`. Expected it followed by `>` or in a quoted attribute value"},unknownNamedCharacterReference:{reason:"Unexpected unknown named character reference",description:"Unexpected character reference. Expected known named character references"}},A4="https://html.spec.whatwg.org/multipage/parsing.html#parse-error-",N4=/-[a-z]/g,_4=/%c(?:([-+])(\d+))?/g,C4=/%x/g,k4={2:!0,1:!1,0:null},I4={};function R4(e,t){const n=t||I4,r=n.onerror,a=e instanceof rl?e:new rl(e),s=n.fragment?M2:F2,i=String(a),o=s(i,{sourceCodeLocationInfo:!0,onParseError:n.onerror?u:null,scriptingEnabled:!1});return Y1(o,{file:a,space:n.space,verbose:n.verbose});function u(c){const p=c.code,d=D4(p),f=n[d],m=f??!0,b=typeof m=="number"?m:m?1:0;if(b){const x=w4[d],y=new Nn(E(x.reason),{place:{start:{line:c.startLine,column:c.startCol,offset:c.startOffset},end:{line:c.endLine,column:c.endCol,offset:c.endOffset}},ruleId:p,source:"hast-util-from-html"});a.path&&(y.file=a.path,y.name=a.path+":"+y.name),y.fatal=k4[b],y.note=E(x.description),y.url=x.url===!1?void 0:A4+p,r(y)}function E(x){return x.replace(_4,y).replace(C4,S);function y(w,A,D){const N=(D?Number.parseInt(D,10):0)*(A==="-"?-1:1),T=i.charAt(c.startOffset+N);return L4(T)}function S(){return F4(i.charCodeAt(c.startOffset))}}}}function D4(e){return e.replace(N4,O4)}function O4(e){return e.charAt(1).toUpperCase()}function L4(e){return e==="`"?"` ` `":e}function F4(e){return"0x"+e.toString(16).toUpperCase()}function M4(e){const t=this,{emitParseErrors:n,...r}={...t.data("settings"),...e};t.parser=a;function a(s,i){return R4(s,{...r,onerror:n?function(o){i.path&&(o.name=i.path+":"+o.name,o.file=i.path),i.messages.push(o)}:void 0})}}const P4=/["&'<>`]/g,j4=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,B4=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,U4=/[|\\{}()[\]^$+*?.]/g,UE=new WeakMap;function $4(e,t){if(e=e.replace(t.subset?z4(t.subset):P4,r),t.subset||t.escapeOnly)return e;return e.replace(j4,n).replace(B4,r);function n(a,s,i){return t.format((a.charCodeAt(0)-55296)*1024+a.charCodeAt(1)-56320+65536,i.charCodeAt(s+2),t)}function r(a,s,i){return t.format(a.charCodeAt(0),i.charCodeAt(s+1),t)}}function z4(e){let t=UE.get(e);return t||(t=H4(e),UE.set(e,t)),t}function H4(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(U4,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const G4=/[\dA-Fa-f]/;function W4(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!G4.test(String.fromCharCode(t))?r:r+";"}const V4=/\d/;function q4(e,t,n){const r="&#"+String(e);return n&&t&&!V4.test(String.fromCharCode(t))?r:r+";"}const uc={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},Y4=["cent","copy","divide","gt","lt","not","para","times"],AS={}.hasOwnProperty,ld={};let xo;for(xo in uc)AS.call(uc,xo)&&(ld[uc[xo]]=xo);const Z4=/[^\dA-Za-z]/;function K4(e,t,n,r){const a=String.fromCharCode(e);if(AS.call(ld,a)){const s=ld[a],i="&"+s;return n&&v1.includes(s)&&!Y4.includes(s)&&(!r||t&&t!==61&&Z4.test(String.fromCharCode(t)))?i:i+";"}return""}function X4(e,t,n){let r=W4(e,t,n.omitOptionalSemicolons),a;if((n.useNamedReferences||n.useShortestReferences)&&(a=K4(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!a)&&n.useShortestReferences){const s=q4(e,t,n.omitOptionalSemicolons);s.length<r.length&&(r=s)}return a&&(!n.useShortestReferences||a.length<r.length)?a:r}function Ka(e,t){return $4(e,Object.assign({format:X4},t))}const Q4=/^>|^->|<!--|-->|--!>|<!-$/g,J4=[">"],eM=["<",">"];function tM(e,t,n,r){return r.settings.bogusComments?"<?"+Ka(e.value,Object.assign({},r.settings.characterReferences,{subset:J4}))+">":"<!--"+e.value.replace(Q4,a)+"-->";function a(s){return Ka(s,Object.assign({},r.settings.characterReferences,{subset:eM}))}}function nM(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}const ln=_S(1),NS=_S(-1),rM=[];function _S(e){return t;function t(n,r,a){const s=n?n.children:rM;let i=(r||0)+e,o=s[i];if(!a)for(;o&&Wi(o);)i+=e,o=s[i];return o}}const aM={}.hasOwnProperty;function CS(e){return t;function t(n,r,a){return aM.call(e,n.tagName)&&e[n.tagName](n,r,a)}}const Kg=CS({body:iM,caption:cc,colgroup:cc,dd:cM,dt:uM,head:cc,html:sM,li:lM,optgroup:dM,option:pM,p:oM,rp:$E,rt:$E,tbody:mM,td:zE,tfoot:hM,th:zE,thead:fM,tr:gM});function cc(e,t,n){const r=ln(n,t,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&Wi(r.value.charAt(0)))}function sM(e,t,n){const r=ln(n,t);return!r||r.type!=="comment"}function iM(e,t,n){const r=ln(n,t);return!r||r.type!=="comment"}function oM(e,t,n){const r=ln(n,t);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function lM(e,t,n){const r=ln(n,t);return!r||r.type==="element"&&r.tagName==="li"}function uM(e,t,n){const r=ln(n,t);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function cM(e,t,n){const r=ln(n,t);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function $E(e,t,n){const r=ln(n,t);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function dM(e,t,n){const r=ln(n,t);return!r||r.type==="element"&&r.tagName==="optgroup"}function pM(e,t,n){const r=ln(n,t);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function fM(e,t,n){const r=ln(n,t);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function mM(e,t,n){const r=ln(n,t);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function hM(e,t,n){return!ln(n,t)}function gM(e,t,n){const r=ln(n,t);return!r||r.type==="element"&&r.tagName==="tr"}function zE(e,t,n){const r=ln(n,t);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const bM=CS({body:yM,colgroup:TM,head:xM,html:EM,tbody:SM});function EM(e){const t=ln(e,-1);return!t||t.type!=="comment"}function xM(e){const t=new Set;for(const r of e.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(t.has(r.tagName))return!1;t.add(r.tagName)}const n=e.children[0];return!n||n.type==="element"}function yM(e){const t=ln(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&Wi(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function TM(e,t,n){const r=NS(n,t),a=ln(e,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&Kg(r,n.children.indexOf(r),n)?!1:!!(a&&a.type==="element"&&a.tagName==="col")}function SM(e,t,n){const r=NS(n,t),a=ln(e,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&Kg(r,n.children.indexOf(r),n)?!1:!!(a&&a.type==="element"&&a.tagName==="tr")}const yo={name:[[`
|
|
46
|
+
`))){const E=[];p.children.forEach((x,y)=>{y!=0&&(y==1&&x.type==="break"||E.push(x))}),p.children=[...E]}}return p});i&&(r.data={hName:t,hProperties:{class:`markdown-alert markdown-alert-${i}`,dir:"auto"}},c.unshift({type:"paragraph",children:[KF(i),{type:"text",value:o.replace(/^\//,"")}],data:{hProperties:{class:"markdown-alert-title",dir:"auto"}}})),r.children=[...c]})};function KF(e){let t=XF[e]??"";return{type:"emphasis",data:{hName:"svg",hProperties:{class:"octicon",viewBox:"0 0 16 16",width:"16",height:"16",ariaHidden:"true"}},children:[{type:"emphasis",data:{hName:"path",hProperties:{d:t}},children:[]}]}}const XF={note:"M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z",tip:"M8 1.5c-2.363 0-4 1.69-4 3.75 0 .984.424 1.625.984 2.304l.214.253c.223.264.47.556.673.848.284.411.537.896.621 1.49a.75.75 0 0 1-1.484.211c-.04-.282-.163-.547-.37-.847a8.456 8.456 0 0 0-.542-.68c-.084-.1-.173-.205-.268-.32C3.201 7.75 2.5 6.766 2.5 5.25 2.5 2.31 4.863 0 8 0s5.5 2.31 5.5 5.25c0 1.516-.701 2.5-1.328 3.259-.095.115-.184.22-.268.319-.207.245-.383.453-.541.681-.208.3-.33.565-.37.847a.751.751 0 0 1-1.485-.212c.084-.593.337-1.078.621-1.489.203-.292.45-.584.673-.848.075-.088.147-.173.213-.253.561-.679.985-1.32.985-2.304 0-2.06-1.637-3.75-4-3.75ZM5.75 12h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM6 15.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75Z",important:"M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",warning:"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",caution:"M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25A.749.749 0 0 1 11 16H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"};function QF(e,t){if(typeof document>"u")return;const n=document.createElement("textarea");n.value=e,n.setAttribute("readonly",""),n.style={position:"absolute",left:"-9999px"},document.body.appendChild(n);const r=document.getSelection().rangeCount>0?document.getSelection().getRangeAt(0):!1;n.select();let a=!1;try{a=!!document.execCommand("copy")}catch{a=!1}document.body.removeChild(n),r&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(r)),t&&t(a)}function TS(e){if(!e)return null;var t=e;return t.dataset.code&&t.classList.contains("copied")?t:t.parentElement?TS(t.parentElement):null}function JF(e){var t=n=>{var r=TS(n.target);r&&(r.classList.add("active"),QF(r.dataset.code,function(){setTimeout(()=>{r.classList.remove("active")},2e3)}))};g.useEffect(()=>{var n,r;return(n=e.current)==null||n.removeEventListener("click",t,!1),(r=e.current)==null||r.addEventListener("click",t,!1),()=>{var a;(a=e.current)==null||a.removeEventListener("click",t,!1)}},[e])}var e4=["prefixCls","className","source","style","disableCopy","skipHtml","onScroll","onMouseOver","pluginsFilter","rehypeRewrite","wrapperElement","warpperElement","urlTransform"],t4=e=>e;const n4=tt.forwardRef((e,t)=>{var n=e.prefixCls,r=n===void 0?"wmde-markdown wmde-markdown-color":n,a=e.className,s=e.source,i=e.style;e.disableCopy;var o=e.skipHtml,u=o===void 0?!0:o,c=e.onScroll,p=e.onMouseOver,d=e.pluginsFilter;e.rehypeRewrite;var f=e.wrapperElement,m=f===void 0?{}:f,b=e.warpperElement,E=b===void 0?{}:b,x=e.urlTransform,y=Ei(e,e4),S=tt.useRef(null);g.useImperativeHandle(t,()=>ct({},e,{mdp:S}),[S,e]);var w=(r||"")+" "+(a||"");JF(S);var A=[...y.rehypePlugins||[]],D={allowElement:(v,R,C)=>y.allowElement?y.allowElement(v,R,C):/^[A-Za-z0-9]+$/.test(v.tagName)};u||A.push(IT);var N=[ZF,...y.remarkPlugins||[],VF],T=ct({},E,m);return l.jsx("div",ct({ref:S,onScroll:c,onMouseOver:p},T,{className:w,style:i,children:l.jsx(O3,ct({},D,y,{skipHtml:!u,urlTransform:x||t4,rehypePlugins:d?d("rehype",A):A,remarkPlugins:d?d("remark",N):N,children:s||""}))}))});var r4=function(t){return n=>{$n(n,r=>{r.type==="element"&&r.tagName==="code"&&r.data&&r.data.meta&&(r.properties=ct({},r.properties,{"data-meta":String(r.data.meta)}))})}},a4=function(t){return n=>{$n(n,r=>{if(r.type==="element"&&r.tagName==="code"&&r.properties&&r.properties.dataMeta){r.data||(r.data={});var a=r.properties.dataMeta;typeof a=="string"&&(r.data.meta=a),delete r.properties.dataMeta}})}};const s4=/[\0-\x1F!-,\.\/:-@\[-\^`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482\u0530\u0557\u0558\u055A-\u055F\u0589-\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u05CF\u05EB-\u05EE\u05F3-\u060F\u061B-\u061F\u066A-\u066D\u06D4\u06DD\u06DE\u06E9\u06FD\u06FE\u0700-\u070F\u074B\u074C\u07B2-\u07BF\u07F6-\u07F9\u07FB\u07FC\u07FE\u07FF\u082E-\u083F\u085C-\u085F\u086B-\u089F\u08B5\u08C8-\u08D2\u08E2\u0964\u0965\u0970\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09F2-\u09FB\u09FD\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF0-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B70\u0B72-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BF0-\u0BFF\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B-\u0C5F\u0C64\u0C65\u0C70-\u0C7F\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D4F-\u0D53\u0D58-\u0D5E\u0D64\u0D65\u0D70-\u0D79\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF4-\u0E00\u0E3B-\u0E3F\u0E4F\u0E5A-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F01-\u0F17\u0F1A-\u0F1F\u0F2A-\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F48\u0F6D-\u0F70\u0F85\u0F98\u0FBD-\u0FC5\u0FC7-\u0FFF\u104A-\u104F\u109E\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u1360-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16ED\u16F9-\u16FF\u170D\u1715-\u171F\u1735-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17D4-\u17D6\u17D8-\u17DB\u17DE\u17DF\u17EA-\u180A\u180E\u180F\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u1945\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DA-\u19FF\u1A1C-\u1A1F\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1AA6\u1AA8-\u1AAF\u1AC1-\u1AFF\u1B4C-\u1B4F\u1B5A-\u1B6A\u1B74-\u1B7F\u1BF4-\u1BFF\u1C38-\u1C3F\u1C4A-\u1C4C\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CCF\u1CD3\u1CFB-\u1CFF\u1DFA\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u203E\u2041-\u2053\u2055-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u20CF\u20F1-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u215F\u2189-\u24B5\u24EA-\u2BFF\u2C2F\u2C5F\u2CE5-\u2CEA\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E00-\u2E2E\u2E30-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u3040\u3097\u3098\u309B\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\u9FFD-\u9FFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA62C-\uA63F\uA673\uA67E\uA6F2-\uA716\uA720\uA721\uA789\uA78A\uA7C0\uA7C1\uA7CB-\uA7F4\uA828-\uA82B\uA82D-\uA83F\uA874-\uA87F\uA8C6-\uA8CF\uA8DA-\uA8DF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA954-\uA95F\uA97D-\uA97F\uA9C1-\uA9CE\uA9DA-\uA9DF\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A-\uAA5F\uAA77-\uAA79\uAAC3-\uAADA\uAADE\uAADF\uAAF0\uAAF1\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABEB\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFDFF\uFE10-\uFE1F\uFE30-\uFE32\uFE35-\uFE4C\uFE50-\uFE6F\uFE75\uFEFD-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF3E\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDD3F\uDD75-\uDDFC\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEE1-\uDEFF\uDF20-\uDF2C\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE36\uDE37\uDE3B-\uDE3E\uDE40-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE7-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD28-\uDD2F\uDD3A-\uDE7F\uDEAA\uDEAD-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF51-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC47-\uDC65\uDC70-\uDC7E\uDCBB-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD40-\uDD43\uDD48-\uDD4F\uDD74\uDD75\uDD77-\uDD7F\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDFF\uDE12\uDE38-\uDE3D\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC4B-\uDC4F\uDC5A-\uDC5D\uDC62-\uDC7F\uDCC6\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDC1-\uDDD7\uDDDE-\uDDFF\uDE41-\uDE43\uDE45-\uDE4F\uDE5A-\uDE7F\uDEB9-\uDEBF\uDECA-\uDEFF\uDF1B\uDF1C\uDF2C-\uDF2F\uDF3A-\uDFFF]|\uD806[\uDC3B-\uDC9F\uDCEA-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD36\uDD39\uDD3A\uDD44-\uDD4F\uDD5A-\uDD9F\uDDA8\uDDA9\uDDD8\uDDD9\uDDE2\uDDE5-\uDDFF\uDE3F-\uDE46\uDE48-\uDE4F\uDE9A-\uDE9C\uDE9E-\uDEBF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC41-\uDC4F\uDC5A-\uDC71\uDC90\uDC91\uDCA8\uDCB7-\uDCFF\uDD07\uDD0A\uDD37-\uDD39\uDD3B\uDD3E\uDD48-\uDD4F\uDD5A-\uDD5F\uDD66\uDD69\uDD8F\uDD92\uDD99-\uDD9F\uDDAA-\uDEDF\uDEF7-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80B\uD80E-\uD810\uD812-\uD819\uD824-\uD82B\uD82D\uD82E\uD830-\uD833\uD837\uD839\uD83D\uD83F\uD87B-\uD87D\uD87F\uD885-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDECF\uDEEE\uDEEF\uDEF5-\uDEFF\uDF37-\uDF3F\uDF44-\uDF4F\uDF5A-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4E\uDF88-\uDF8E\uDFA0-\uDFDF\uDFE2\uDFE5-\uDFEF\uDFF2-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82C[\uDD1F-\uDD4F\uDD53-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDC9C\uDC9F-\uDFFF]|\uD834[\uDC00-\uDD64\uDD6A-\uDD6C\uDD73-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDE41\uDE45-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC\uDFCD]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD4F-\uDEBF\uDEFA-\uDFFF]|\uD83A[\uDCC5-\uDCCF\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD83C[\uDC00-\uDD2F\uDD4A-\uDD4F\uDD6A-\uDD6F\uDD8A-\uDFFF]|\uD83E[\uDC00-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEDE-\uDEFF]|\uD86D[\uDF35-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]/g,i4=Object.hasOwnProperty;class o4{constructor(){this.occurrences,this.reset()}slug(t,n){const r=this;let a=l4(t,n===!0);const s=a;for(;i4.call(r.occurrences,a);)r.occurrences[s]++,a=s+"-"+r.occurrences[s];return r.occurrences[a]=0,a}reset(){this.occurrences=Object.create(null)}}function l4(e,t){return typeof e!="string"?"":(t||(e=e.toLowerCase()),e.replace(s4,"").replace(/ /g,"-"))}function SS(e){const t=e.type==="element"?e.tagName.toLowerCase():"",n=t.length===2&&t.charCodeAt(0)===104?t.charCodeAt(1):0;return n>48&&n<55?n-48:void 0}const u4={},PE=new o4;function c4(e){const n=(e||u4).prefix||"";return function(r){PE.reset(),$n(r,"element",function(a){SS(a)&&!a.properties.id&&(a.properties.id=n+PE.slug(Ga(a)))})}}const vS=(function(e){if(e==null)return f4;if(typeof e=="string")return p4(e);if(typeof e=="object")return d4(e);if(typeof e=="function")return Yg(e);throw new Error("Expected function, string, or array as `test`")});function d4(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=vS(e[n]);return Yg(r);function r(...a){let s=-1;for(;++s<t.length;)if(t[s].apply(this,a))return!0;return!1}}function p4(e){return Yg(t);function t(n){return n.tagName===e}}function Yg(e){return t;function t(n,r,a){return!!(m4(n)&&e.call(this,n,typeof r=="number"?r:void 0,a||void 0))}}function f4(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function m4(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const jE={type:"element",tagName:"span",properties:{className:["icon","icon-link"]},children:[]},h4={};function g4(e){const t=e||h4;let n=t.properties;const r=t.headingProperties,a=t.behavior||"prepend",s=t.content,i=t.group,o=vS(t.test);let u;return a==="after"||a==="before"?u=p:a==="wrap"?u=d:(u=c,n||(n={ariaHidden:"true",tabIndex:-1})),function(f){$n(f,"element",function(m,b,E){if(SS(m)&&m.properties.id&&o(m,b,E))return Object.assign(m.properties,Eo(r,m)),u(m,b,E)})};function c(f){const m=BE(s||jE,f);return f.children[a==="prepend"?"unshift":"push"](lc(f,Eo(n,f),m)),[Xs]}function p(f,m,b){if(typeof m!="number"||!b)return;const E=BE(s||jE,f),x=lc(f,Eo(n,f),E);let y=a==="before"?[x,f]:[f,x];if(i){const S=wS(i,f);S&&!Array.isArray(S)&&S.type==="element"&&(S.children=y,y=[S])}return b.children.splice(m,1,...y),[Xs,m+y.length]}function d(f){let m=f.children,b=[];return typeof s=="function"?(m=[],b=s(f)):s&&(b=Zg(s)),f.children=[lc(f,Eo(n,f),Array.isArray(b)?[...m,...b]:[...m,b])],[Xs]}}function Zg(e){return ga(e)}function lc(e,t,n){return{type:"element",tagName:"a",properties:{...t,href:"#"+e.properties.id},children:n}}function BE(e,t){const n=wS(e,t);return Array.isArray(n)?n:[n]}function wS(e,t){return typeof e=="function"?e(t):Zg(e)}function Eo(e,t){return typeof e=="function"?e(t):e?Zg(e):{}}const b4=(e={})=>{const{openDelimiter:t="rehype:ignore:start",closeDelimiter:n="rehype:ignore:end"}=e;return r=>{$n(r,(a,s,i)=>{if(a.type==="element"||a.type==="root"){let o=!1;a.children=a.children.filter(u=>{if(u.type==="raw"||u.type==="comment"){let c=(u.value||"").trim();if(c=c.replace(/^<!--(.*?)-->/,"$1"),c===t)return o=!0,!1;if(c===n)return o=!1,!1}return!o})}})}};var E4={type:"element",tagName:"svg",properties:{className:"octicon octicon-link",viewBox:"0 0 16 16",version:"1.1",width:"16",height:"16",ariaHidden:"true"},children:[{type:"element",tagName:"path",children:[],properties:{fillRule:"evenodd",d:"M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"}}]};function x4(e){return e===void 0&&(e=""),{type:"element",tagName:"div",properties:{class:"copied","data-code":e},children:[{type:"element",tagName:"svg",properties:{className:"octicon-copy",ariaHidden:"true",viewBox:"0 0 16 16",fill:"currentColor",height:12,width:12},children:[{type:"element",tagName:"path",properties:{fillRule:"evenodd",d:"M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"},children:[]},{type:"element",tagName:"path",properties:{fillRule:"evenodd",d:"M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"},children:[]}]},{type:"element",tagName:"svg",properties:{className:"octicon-check",ariaHidden:"true",viewBox:"0 0 16 16",fill:"currentColor",height:12,width:12},children:[{type:"element",tagName:"path",properties:{fillRule:"evenodd",d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"},children:[]}]}]}}var y4=(e,t)=>(n,r,a)=>{if(n.type==="element"&&a&&a.type==="root"&&/h(1|2|3|4|5|6)/.test(n.tagName)){var s=n.children&&n.children[0];s&&s.properties&&s.properties.ariaHidden==="true"&&(s.properties=ct({class:"anchor"},s.properties),s.children=[E4])}if(n.type==="element"&&n.tagName==="pre"&&!e){var i=$1(n.children);n.children.push(x4(i))}t&&t(n,r===null?void 0:r,a===null?void 0:a)},T4=[c4,g4,b4];const S4=tt.forwardRef((e,t)=>{var n,r=[r4,IT,a4,...T4,[Mk,{rewrite:y4((n=e.disableCopy)!=null?n:!1,e.rehypeRewrite)}],[Uk,{properties:"attr"}],...e.rehypePlugins||[],[C1,{ignoreMissing:!0}]];return l.jsx(n4,ct({},e,{rehypePlugins:r,ref:t}))});function v4(e,t){return t||(t=e.slice(0)),e.raw=t,e}const w4={abandonedHeadElementChild:{reason:"Unexpected metadata element after head",description:"Unexpected element after head. Expected the element before `</head>`",url:!1},abruptClosingOfEmptyComment:{reason:"Unexpected abruptly closed empty comment",description:"Unexpected `>` or `->`. Expected `-->` to close comments"},abruptDoctypePublicIdentifier:{reason:"Unexpected abruptly closed public identifier",description:"Unexpected `>`. Expected a closing `\"` or `'` after the public identifier"},abruptDoctypeSystemIdentifier:{reason:"Unexpected abruptly closed system identifier",description:"Unexpected `>`. Expected a closing `\"` or `'` after the identifier identifier"},absenceOfDigitsInNumericCharacterReference:{reason:"Unexpected non-digit at start of numeric character reference",description:"Unexpected `%c`. Expected `[0-9]` for decimal references or `[0-9a-fA-F]` for hexadecimal references"},cdataInHtmlContent:{reason:"Unexpected CDATA section in HTML",description:"Unexpected `<![CDATA[` in HTML. Remove it, use a comment, or encode special characters instead"},characterReferenceOutsideUnicodeRange:{reason:"Unexpected too big numeric character reference",description:"Unexpectedly high character reference. Expected character references to be at most hexadecimal 10ffff (or decimal 1114111)"},closingOfElementWithOpenChildElements:{reason:"Unexpected closing tag with open child elements",description:"Unexpectedly closing tag. Expected other tags to be closed first",url:!1},controlCharacterInInputStream:{reason:"Unexpected control character",description:"Unexpected control character `%x`. Expected a non-control code point, 0x00, or ASCII whitespace"},controlCharacterReference:{reason:"Unexpected control character reference",description:"Unexpectedly control character in reference. Expected a non-control code point, 0x00, or ASCII whitespace"},disallowedContentInNoscriptInHead:{reason:"Disallowed content inside `<noscript>` in `<head>`",description:"Unexpected text character `%c`. Only use text in `<noscript>`s in `<body>`",url:!1},duplicateAttribute:{reason:"Unexpected duplicate attribute",description:"Unexpectedly double attribute. Expected attributes to occur only once"},endTagWithAttributes:{reason:"Unexpected attribute on closing tag",description:"Unexpected attribute. Expected `>` instead"},endTagWithTrailingSolidus:{reason:"Unexpected slash at end of closing tag",description:"Unexpected `%c-1`. Expected `>` instead"},endTagWithoutMatchingOpenElement:{reason:"Unexpected unopened end tag",description:"Unexpected end tag. Expected no end tag or another end tag",url:!1},eofBeforeTagName:{reason:"Unexpected end of file",description:"Unexpected end of file. Expected tag name instead"},eofInCdata:{reason:"Unexpected end of file in CDATA",description:"Unexpected end of file. Expected `]]>` to close the CDATA"},eofInComment:{reason:"Unexpected end of file in comment",description:"Unexpected end of file. Expected `-->` to close the comment"},eofInDoctype:{reason:"Unexpected end of file in doctype",description:"Unexpected end of file. Expected a valid doctype (such as `<!doctype html>`)"},eofInElementThatCanContainOnlyText:{reason:"Unexpected end of file in element that can only contain text",description:"Unexpected end of file. Expected text or a closing tag",url:!1},eofInScriptHtmlCommentLikeText:{reason:"Unexpected end of file in comment inside script",description:"Unexpected end of file. Expected `-->` to close the comment"},eofInTag:{reason:"Unexpected end of file in tag",description:"Unexpected end of file. Expected `>` to close the tag"},incorrectlyClosedComment:{reason:"Incorrectly closed comment",description:"Unexpected `%c-1`. Expected `-->` to close the comment"},incorrectlyOpenedComment:{reason:"Incorrectly opened comment",description:"Unexpected `%c`. Expected `<!--` to open the comment"},invalidCharacterSequenceAfterDoctypeName:{reason:"Invalid sequence after doctype name",description:"Unexpected sequence at `%c`. Expected `public` or `system`"},invalidFirstCharacterOfTagName:{reason:"Invalid first character in tag name",description:"Unexpected `%c`. Expected an ASCII letter instead"},misplacedDoctype:{reason:"Misplaced doctype",description:"Unexpected doctype. Expected doctype before head",url:!1},misplacedStartTagForHeadElement:{reason:"Misplaced `<head>` start tag",description:"Unexpected start tag `<head>`. Expected `<head>` directly after doctype",url:!1},missingAttributeValue:{reason:"Missing attribute value",description:"Unexpected `%c-1`. Expected an attribute value or no `%c-1` instead"},missingDoctype:{reason:"Missing doctype before other content",description:"Expected a `<!doctype html>` before anything else",url:!1},missingDoctypeName:{reason:"Missing doctype name",description:"Unexpected doctype end at `%c`. Expected `html` instead"},missingDoctypePublicIdentifier:{reason:"Missing public identifier in doctype",description:"Unexpected `%c`. Expected identifier for `public` instead"},missingDoctypeSystemIdentifier:{reason:"Missing system identifier in doctype",description:'Unexpected `%c`. Expected identifier for `system` instead (suggested: `"about:legacy-compat"`)'},missingEndTagName:{reason:"Missing name in end tag",description:"Unexpected `%c`. Expected an ASCII letter instead"},missingQuoteBeforeDoctypePublicIdentifier:{reason:"Missing quote before public identifier in doctype",description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingQuoteBeforeDoctypeSystemIdentifier:{reason:"Missing quote before system identifier in doctype",description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingSemicolonAfterCharacterReference:{reason:"Missing semicolon after character reference",description:"Unexpected `%c`. Expected `;` instead"},missingWhitespaceAfterDoctypePublicKeyword:{reason:"Missing whitespace after public identifier in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceAfterDoctypeSystemKeyword:{reason:"Missing whitespace after system identifier in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBeforeDoctypeName:{reason:"Missing whitespace before doctype name",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenAttributes:{reason:"Missing whitespace between attributes",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers:{reason:"Missing whitespace between public and system identifiers in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},nestedComment:{reason:"Unexpected nested comment",description:"Unexpected `<!--`. Expected `-->`"},nestedNoscriptInHead:{reason:"Unexpected nested `<noscript>` in `<head>`",description:"Unexpected `<noscript>`. Expected a closing tag or a meta element",url:!1},nonConformingDoctype:{reason:"Unexpected non-conforming doctype declaration",description:'Expected `<!doctype html>` or `<!doctype html system "about:legacy-compat">`',url:!1},nonVoidHtmlElementStartTagWithTrailingSolidus:{reason:"Unexpected trailing slash on start tag of non-void element",description:"Unexpected `/`. Expected `>` instead"},noncharacterCharacterReference:{reason:"Unexpected noncharacter code point referenced by character reference",description:"Unexpected code point. Do not use noncharacters in HTML"},noncharacterInInputStream:{reason:"Unexpected noncharacter character",description:"Unexpected code point `%x`. Do not use noncharacters in HTML"},nullCharacterReference:{reason:"Unexpected NULL character referenced by character reference",description:"Unexpected code point. Do not use NULL characters in HTML"},openElementsLeftAfterEof:{reason:"Unexpected end of file",description:"Unexpected end of file. Expected closing tag instead",url:!1},surrogateCharacterReference:{reason:"Unexpected surrogate character referenced by character reference",description:"Unexpected code point. Do not use lone surrogate characters in HTML"},surrogateInInputStream:{reason:"Unexpected surrogate character",description:"Unexpected code point `%x`. Do not use lone surrogate characters in HTML"},unexpectedCharacterAfterDoctypeSystemIdentifier:{reason:"Invalid character after system identifier in doctype",description:"Unexpected character at `%c`. Expected `>`"},unexpectedCharacterInAttributeName:{reason:"Unexpected character in attribute name",description:"Unexpected `%c`. Expected whitespace, `/`, `>`, `=`, or probably an ASCII letter"},unexpectedCharacterInUnquotedAttributeValue:{reason:"Unexpected character in unquoted attribute value",description:"Unexpected `%c`. Quote the attribute value to include it"},unexpectedEqualsSignBeforeAttributeName:{reason:"Unexpected equals sign before attribute name",description:"Unexpected `%c`. Add an attribute name before it"},unexpectedNullCharacter:{reason:"Unexpected NULL character",description:"Unexpected code point `%x`. Do not use NULL characters in HTML"},unexpectedQuestionMarkInsteadOfTagName:{reason:"Unexpected question mark instead of tag name",description:"Unexpected `%c`. Expected an ASCII letter instead"},unexpectedSolidusInTag:{reason:"Unexpected slash in tag",description:"Unexpected `%c-1`. Expected it followed by `>` or in a quoted attribute value"},unknownNamedCharacterReference:{reason:"Unexpected unknown named character reference",description:"Unexpected character reference. Expected known named character references"}},A4="https://html.spec.whatwg.org/multipage/parsing.html#parse-error-",N4=/-[a-z]/g,_4=/%c(?:([-+])(\d+))?/g,C4=/%x/g,k4={2:!0,1:!1,0:null},I4={};function R4(e,t){const n=t||I4,r=n.onerror,a=e instanceof rl?e:new rl(e),s=n.fragment?M2:F2,i=String(a),o=s(i,{sourceCodeLocationInfo:!0,onParseError:n.onerror?u:null,scriptingEnabled:!1});return Y1(o,{file:a,space:n.space,verbose:n.verbose});function u(c){const p=c.code,d=D4(p),f=n[d],m=f??!0,b=typeof m=="number"?m:m?1:0;if(b){const x=w4[d],y=new Nn(E(x.reason),{place:{start:{line:c.startLine,column:c.startCol,offset:c.startOffset},end:{line:c.endLine,column:c.endCol,offset:c.endOffset}},ruleId:p,source:"hast-util-from-html"});a.path&&(y.file=a.path,y.name=a.path+":"+y.name),y.fatal=k4[b],y.note=E(x.description),y.url=x.url===!1?void 0:A4+p,r(y)}function E(x){return x.replace(_4,y).replace(C4,S);function y(w,A,D){const N=(D?Number.parseInt(D,10):0)*(A==="-"?-1:1),T=i.charAt(c.startOffset+N);return L4(T)}function S(){return F4(i.charCodeAt(c.startOffset))}}}}function D4(e){return e.replace(N4,O4)}function O4(e){return e.charAt(1).toUpperCase()}function L4(e){return e==="`"?"` ` `":e}function F4(e){return"0x"+e.toString(16).toUpperCase()}function M4(e){const t=this,{emitParseErrors:n,...r}={...t.data("settings"),...e};t.parser=a;function a(s,i){return R4(s,{...r,onerror:n?function(o){i.path&&(o.name=i.path+":"+o.name,o.file=i.path),i.messages.push(o)}:void 0})}}const P4=/["&'<>`]/g,j4=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,B4=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,U4=/[|\\{}()[\]^$+*?.]/g,UE=new WeakMap;function $4(e,t){if(e=e.replace(t.subset?z4(t.subset):P4,r),t.subset||t.escapeOnly)return e;return e.replace(j4,n).replace(B4,r);function n(a,s,i){return t.format((a.charCodeAt(0)-55296)*1024+a.charCodeAt(1)-56320+65536,i.charCodeAt(s+2),t)}function r(a,s,i){return t.format(a.charCodeAt(0),i.charCodeAt(s+1),t)}}function z4(e){let t=UE.get(e);return t||(t=H4(e),UE.set(e,t)),t}function H4(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(U4,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const G4=/[\dA-Fa-f]/;function W4(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!G4.test(String.fromCharCode(t))?r:r+";"}const V4=/\d/;function q4(e,t,n){const r="&#"+String(e);return n&&t&&!V4.test(String.fromCharCode(t))?r:r+";"}const uc={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},Y4=["cent","copy","divide","gt","lt","not","para","times"],AS={}.hasOwnProperty,ld={};let xo;for(xo in uc)AS.call(uc,xo)&&(ld[uc[xo]]=xo);const Z4=/[^\dA-Za-z]/;function K4(e,t,n,r){const a=String.fromCharCode(e);if(AS.call(ld,a)){const s=ld[a],i="&"+s;return n&&v1.includes(s)&&!Y4.includes(s)&&(!r||t&&t!==61&&Z4.test(String.fromCharCode(t)))?i:i+";"}return""}function X4(e,t,n){let r=W4(e,t,n.omitOptionalSemicolons),a;if((n.useNamedReferences||n.useShortestReferences)&&(a=K4(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!a)&&n.useShortestReferences){const s=q4(e,t,n.omitOptionalSemicolons);s.length<r.length&&(r=s)}return a&&(!n.useShortestReferences||a.length<r.length)?a:r}function Ka(e,t){return $4(e,Object.assign({format:X4},t))}const Q4=/^>|^->|<!--|-->|--!>|<!-$/g,J4=[">"],eM=["<",">"];function tM(e,t,n,r){return r.settings.bogusComments?"<?"+Ka(e.value,Object.assign({},r.settings.characterReferences,{subset:J4}))+">":"<!--"+e.value.replace(Q4,a)+"-->";function a(s){return Ka(s,Object.assign({},r.settings.characterReferences,{subset:eM}))}}function nM(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}const ln=_S(1),NS=_S(-1),rM=[];function _S(e){return t;function t(n,r,a){const s=n?n.children:rM;let i=(r||0)+e,o=s[i];if(!a)for(;o&&Wi(o);)i+=e,o=s[i];return o}}const aM={}.hasOwnProperty;function CS(e){return t;function t(n,r,a){return aM.call(e,n.tagName)&&e[n.tagName](n,r,a)}}const Kg=CS({body:iM,caption:cc,colgroup:cc,dd:cM,dt:uM,head:cc,html:sM,li:lM,optgroup:dM,option:pM,p:oM,rp:$E,rt:$E,tbody:mM,td:zE,tfoot:hM,th:zE,thead:fM,tr:gM});function cc(e,t,n){const r=ln(n,t,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&Wi(r.value.charAt(0)))}function sM(e,t,n){const r=ln(n,t);return!r||r.type!=="comment"}function iM(e,t,n){const r=ln(n,t);return!r||r.type!=="comment"}function oM(e,t,n){const r=ln(n,t);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function lM(e,t,n){const r=ln(n,t);return!r||r.type==="element"&&r.tagName==="li"}function uM(e,t,n){const r=ln(n,t);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function cM(e,t,n){const r=ln(n,t);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function $E(e,t,n){const r=ln(n,t);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function dM(e,t,n){const r=ln(n,t);return!r||r.type==="element"&&r.tagName==="optgroup"}function pM(e,t,n){const r=ln(n,t);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function fM(e,t,n){const r=ln(n,t);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function mM(e,t,n){const r=ln(n,t);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function hM(e,t,n){return!ln(n,t)}function gM(e,t,n){const r=ln(n,t);return!r||r.type==="element"&&r.tagName==="tr"}function zE(e,t,n){const r=ln(n,t);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const bM=CS({body:yM,colgroup:TM,head:xM,html:EM,tbody:SM});function EM(e){const t=ln(e,-1);return!t||t.type!=="comment"}function xM(e){const t=new Set;for(const r of e.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(t.has(r.tagName))return!1;t.add(r.tagName)}const n=e.children[0];return!n||n.type==="element"}function yM(e){const t=ln(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&Wi(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function TM(e,t,n){const r=NS(n,t),a=ln(e,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&Kg(r,n.children.indexOf(r),n)?!1:!!(a&&a.type==="element"&&a.tagName==="col")}function SM(e,t,n){const r=NS(n,t),a=ln(e,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&Kg(r,n.children.indexOf(r),n)?!1:!!(a&&a.type==="element"&&a.tagName==="tr")}const yo={name:[[`
|
|
47
47
|
\f\r &/=>`.split(""),`
|
|
48
48
|
\f\r "&'/=>\``.split("")],[`\0
|
|
49
49
|
\f\r "&'/<=>`.split(""),`\0
|
|
@@ -51,8 +51,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
51
51
|
\f\r &>`.split(""),`\0
|
|
52
52
|
\f\r "&'<=>\``.split("")],[`\0
|
|
53
53
|
\f\r "&'<=>\``.split(""),`\0
|
|
54
|
-
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function vM(e,t,n,r){const a=r.schema,s=a.space==="svg"?!1:r.settings.omitOptionalTags;let i=a.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase());const o=[];let u;a.space==="html"&&e.tagName==="svg"&&(r.schema=fr);const c=wM(r,e.properties),p=r.all(a.space==="html"&&e.tagName==="template"?e.content:e);return r.schema=a,p&&(i=!1),(c||!s||!bM(e,t,n))&&(o.push("<",e.tagName,c?" "+c:""),i&&(a.space==="svg"||r.settings.closeSelfClosing)&&(u=c.charAt(c.length-1),(!r.settings.tightSelfClosing||u==="/"||u&&u!=='"'&&u!=="'")&&o.push(" "),o.push("/")),o.push(">")),o.push(p),!i&&(!s||!Kg(e,t,n))&&o.push("</"+e.tagName+">"),o.join("")}function wM(e,t){const n=[];let r=-1,a;if(t){for(a in t)if(t[a]!==null&&t[a]!==void 0){const s=AM(e,a,t[a]);s&&n.push(s)}}for(;++r<n.length;){const s=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&s!=='"'&&s!=="'"&&(n[r]+=" ")}return n.join("")}function AM(e,t,n){const r=hs(e.schema,t),a=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,s=e.settings.allowDangerousCharacters?0:1;let i=e.quote,o;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const u=Ka(r.attribute,Object.assign({},e.settings.characterReferences,{subset:yo.name[a][s]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?Jl:eu)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?u:(e.settings.preferUnquoted&&(o=Ka(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:yo.unquoted[a][s]}))),o!==n&&(e.settings.quoteSmart&&al(n,i)>al(n,e.alternative)&&(i=e.alternative),o=i+Ka(n,Object.assign({},e.settings.characterReferences,{subset:(i==="'"?yo.single:yo.double)[a][s],attribute:!0}))+i),u+(o&&"="+o))}const NM=["<","&"];function kS(e,t,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:Ka(e.value,Object.assign({},r.settings.characterReferences,{subset:NM}))}function _M(e,t,n,r){return r.settings.allowDangerousHtml?e.value:kS(e,t,n,r)}function CM(e,t,n,r){return r.all(e)}const kM=au("type",{invalid:IM,unknown:RM,handlers:{comment:tM,doctype:nM,element:vM,raw:_M,root:CM,text:kS}});function IM(e){throw new Error("Expected node, not `"+e+"`")}function RM(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const DM={},OM={},LM=[];function FM(e,t){const n=t||DM,r=n.quote||'"',a=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:MM,all:PM,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||X1,characterReferences:n.characterReferences||OM,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?fr:Ca,quote:r,alternative:a}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function MM(e,t,n){return kM(e,t,n,this)}function PM(e){const t=[],n=e&&e.children||LM;let r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}function jM(e){const t=this,n={...t.data("settings"),...e};t.compiler=r;function r(a){return FM(a,n)}}const BM=XT().use(M4).use(jM).freeze();function UM(e,t){return ct({},e,t)}var Ia=
|
|
55
|
-
</code></pre>`;if(s)try{u=BM().data("settings",{fragment:!0}).use(C1,{ignoreMissing:!0}).processSync(u).toString()}catch{}return
|
|
54
|
+
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function vM(e,t,n,r){const a=r.schema,s=a.space==="svg"?!1:r.settings.omitOptionalTags;let i=a.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase());const o=[];let u;a.space==="html"&&e.tagName==="svg"&&(r.schema=fr);const c=wM(r,e.properties),p=r.all(a.space==="html"&&e.tagName==="template"?e.content:e);return r.schema=a,p&&(i=!1),(c||!s||!bM(e,t,n))&&(o.push("<",e.tagName,c?" "+c:""),i&&(a.space==="svg"||r.settings.closeSelfClosing)&&(u=c.charAt(c.length-1),(!r.settings.tightSelfClosing||u==="/"||u&&u!=='"'&&u!=="'")&&o.push(" "),o.push("/")),o.push(">")),o.push(p),!i&&(!s||!Kg(e,t,n))&&o.push("</"+e.tagName+">"),o.join("")}function wM(e,t){const n=[];let r=-1,a;if(t){for(a in t)if(t[a]!==null&&t[a]!==void 0){const s=AM(e,a,t[a]);s&&n.push(s)}}for(;++r<n.length;){const s=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&s!=='"'&&s!=="'"&&(n[r]+=" ")}return n.join("")}function AM(e,t,n){const r=hs(e.schema,t),a=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,s=e.settings.allowDangerousCharacters?0:1;let i=e.quote,o;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const u=Ka(r.attribute,Object.assign({},e.settings.characterReferences,{subset:yo.name[a][s]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?Jl:eu)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?u:(e.settings.preferUnquoted&&(o=Ka(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:yo.unquoted[a][s]}))),o!==n&&(e.settings.quoteSmart&&al(n,i)>al(n,e.alternative)&&(i=e.alternative),o=i+Ka(n,Object.assign({},e.settings.characterReferences,{subset:(i==="'"?yo.single:yo.double)[a][s],attribute:!0}))+i),u+(o&&"="+o))}const NM=["<","&"];function kS(e,t,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:Ka(e.value,Object.assign({},r.settings.characterReferences,{subset:NM}))}function _M(e,t,n,r){return r.settings.allowDangerousHtml?e.value:kS(e,t,n,r)}function CM(e,t,n,r){return r.all(e)}const kM=au("type",{invalid:IM,unknown:RM,handlers:{comment:tM,doctype:nM,element:vM,raw:_M,root:CM,text:kS}});function IM(e){throw new Error("Expected node, not `"+e+"`")}function RM(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const DM={},OM={},LM=[];function FM(e,t){const n=t||DM,r=n.quote||'"',a=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:MM,all:PM,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||X1,characterReferences:n.characterReferences||OM,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?fr:Ca,quote:r,alternative:a}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function MM(e,t,n){return kM(e,t,n,this)}function PM(e){const t=[],n=e&&e.children||LM;let r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}function jM(e){const t=this,n={...t.data("settings"),...e};t.compiler=r;function r(a){return FM(a,n)}}const BM=XT().use(M4).use(jM).freeze();function UM(e,t){return ct({},e,t)}var Ia=tt.createContext({markdown:""}),HE;function $M(e){return e.replace(/[<&"]/g,t=>({"<":"<",">":">","&":"&",'"':"""})[t])}function zM(e){var t=e.prefixCls,n=g.useContext(Ia),r=n.markdown,a=r===void 0?"":r,s=n.highlightEnable,i=n.dispatch,o=tt.createRef();if(g.useEffect(()=>{o.current&&i&&i({textareaPre:o.current})},[]),!a)return l.jsx("pre",{ref:o,className:t+"-text-pre wmde-markdown-color"});var u='<pre class="language-markdown '+t+'-text-pre wmde-markdown-color"><code class="language-markdown">'+$M(String.raw(HE||(HE=v4(["",""])),a))+`
|
|
55
|
+
</code></pre>`;if(s)try{u=BM().data("settings",{fragment:!0}).use(C1,{ignoreMissing:!0}).processSync(u).toString()}catch{}return tt.createElement("div",{className:"wmde-markdown-color",dangerouslySetInnerHTML:{__html:u||""}})}function IS(e,t){return e===void 0&&(e=[]),t===void 0&&(t={}),e.forEach(n=>{n.children&&Array.isArray(n.children)?t=ct({},t,IS(n.children||[])):n.keyCommand&&n.shortcuts&&n.execute&&(t[n.shortcuts.toLocaleLowerCase()]=n)}),t}function RS(e,t,n,r,a){t===void 0&&(t=[]);var s=IS(t||[]),i=[];if(e.altKey&&i.push("alt"),e.shiftKey&&i.push("shift"),e.metaKey&&i.push("cmd"),e.ctrlKey&&i.push("ctrl"),i.length>0&&!/(control|alt|meta|shift)/.test(e.key.toLocaleLowerCase())&&i.push(e.key.toLocaleLowerCase()),/escape/.test(e.key.toLocaleLowerCase())&&i.push("escape"),!(i.length<1)){var o=!!s[i.join("+")],u=o?s[i.join("+")]:void 0;if(Object.keys(s).forEach(c=>{var p=c.split("+").every(d=>/ctrlcmd/.test(d)?i.includes("ctrl")||i.includes("cmd"):i.includes(d));p&&(u=s[c])}),u&&n){e.stopPropagation(),e.preventDefault(),n.executeCommand(u,r,a,i);return}}}var dc;function GE(e){if(e.nodeName!=="TEXTAREA")return!1;if(typeof dc>"u"){var t=document.createElement("textarea");t.value="1",dc=!!t.firstChild}return dc}function Xa(e,t){if(e.focus(),document.selection){var n=document.selection.createRange();n.text=t,n.collapse(!1),n.select();return}var r=!1;if(t!==""?r=document.execCommand&&document.execCommand("insertText",!1,t):r=document.execCommand&&document.execCommand("delete",!1),!r){var a=e.selectionStart,s=e.selectionEnd;if(typeof e.setRangeText=="function")e.setRangeText(t);else{var i=document.createRange(),o=document.createTextNode(t);if(GE(e)){var u=e.firstChild;if(!u)e.appendChild(o);else{for(var c=0,p=null,d=null;u&&(p===null||d===null);){var f=u.nodeValue.length;a>=c&&a<=c+f&&i.setStart(p=u,a-c),s>=c&&s<=c+f&&i.setEnd(d=u,s-c),c+=f,u=u.nextSibling}a!==s&&i.deleteContents()}}if(GE(e)&&i.commonAncestorContainer.nodeName==="#text")i.insertNode(o);else{var m=e.value;e.value=m.slice(0,a)+t+m.slice(s)}}e.setSelectionRange(a+t.length,a+t.length);var b=document.createEvent("UIEvent");b.initEvent("input",!0,!1),e.dispatchEvent(b)}}function Mn(e){var t=e.text,n=e.selection,r=e.prefix,a=e.suffix,s=a===void 0?r:a,i=n;if(t&&t.length&&n.start===n.end&&(i=HM(t,n.start)),i.start>=r.length&&i.end<=t.length-s.length){var o=t.slice(i.start-r.length,i.end+s.length);if(o.startsWith(r)&&o.endsWith(s))return{start:i.start-r.length,end:i.end+s.length}}return i}function oi(e){var t=e.text,n=e.selection,r=t.slice(0,n.start).lastIndexOf(`
|
|
56
56
|
`)+1,a=t.slice(n.end).indexOf(`
|
|
57
57
|
`)+n.end;return a===n.end-1&&(a=t.length),{start:r,end:a}}function DS(e,t){if(e===void 0&&(e=""),t===0)return 0;for(var n=2,r=!0,a=t-1;a>=0&&n>=0;a--)switch(e.charCodeAt(a)){case 32:continue;case 10:n--,r=!1;break;default:return n}return r?0:n}function OS(e,t){if(e===void 0&&(e=""),t===e.length-1)return 0;for(var n=2,r=!0,a=t;a<e.length&&n>=0;a++)switch(e.charCodeAt(a)){case 32:continue;case 10:{n--,r=!1;break}default:return n}return r?0:n}function HM(e,t){if(!e)throw Error("Argument 'text' should be truthy");for(var n=o=>o===" "||o.charCodeAt(0)===10,r=0,a=e.length,s=t;s-1>-1;s--)if(n(e[s-1])){r=s;break}for(var i=t;i<e.length;i++)if(n(e[i])){a=i;break}return{start:r,end:a}}function Sn(e){var t=e.api,n=e.selectedText,r=e.selection,a=e.prefix,s=e.suffix,i=s===void 0?a:s;n.length>=a.length+i.length&&n.startsWith(a)&&n.endsWith(i)?(t.replaceSelection(n.slice(a.length,i.length?-i.length:void 0)),t.setSelectionRange({start:r.start-a.length,end:r.end-a.length})):(t.replaceSelection(""+a+n+i),t.setSelectionRange({start:r.start+a.length,end:r.end+a.length}))}function Xg(e,t){var n=e.split(/\n/),r=0,a=n.map((s,i)=>{if(typeof t=="string")return s.startsWith(t)?(r-=t.length,s.slice(t.length)):(r+=t.length,t+s);if(typeof t=="function"){if(s.startsWith(t(s,i)))return r-=t(s,i).length,s.slice(t(s,i).length);var o=t(s,i);return r+=o.length,t(s,i)+s}throw Error("insertion is expected to be either a string or a function")}).join(`
|
|
58
58
|
`);return{modifiedText:a,insertionLength:r}}var GM={name:"bold",keyCommand:"bold",shortcuts:"ctrlcmd+b",prefix:"**",buttonProps:{"aria-label":"Add bold text (ctrl + b)",title:"Add bold text (ctrl + b)"},icon:l.jsx("svg",{role:"img",width:"12",height:"12",viewBox:"0 0 384 512",children:l.jsx("path",{fill:"currentColor",d:"M304.793 243.891c33.639-18.537 53.657-54.16 53.657-95.693 0-48.236-26.25-87.626-68.626-104.179C265.138 34.01 240.849 32 209.661 32H24c-8.837 0-16 7.163-16 16v33.049c0 8.837 7.163 16 16 16h33.113v318.53H24c-8.837 0-16 7.163-16 16V464c0 8.837 7.163 16 16 16h195.69c24.203 0 44.834-1.289 66.866-7.584C337.52 457.193 376 410.647 376 350.014c0-52.168-26.573-91.684-71.207-106.123zM142.217 100.809h67.444c16.294 0 27.536 2.019 37.525 6.717 15.828 8.479 24.906 26.502 24.906 49.446 0 35.029-20.32 56.79-53.029 56.79h-76.846V100.809zm112.642 305.475c-10.14 4.056-22.677 4.907-31.409 4.907h-81.233V281.943h84.367c39.645 0 63.057 25.38 63.057 63.057.001 28.425-13.66 52.483-34.782 61.284z"})}),execute:(e,t)=>{var n=Mn({text:e.text,selection:e.selection,prefix:e.command.prefix}),r=t.setSelectionRange(n);Sn({api:t,selectedText:r.selectedText,selection:e.selection,prefix:e.command.prefix})}},LS={name:"codeBlock",keyCommand:"codeBlock",shortcuts:"ctrlcmd+shift+j",prefix:"```",buttonProps:{"aria-label":"Insert Code Block (ctrl + shift + j)",title:"Insert Code Block (ctrl + shift +j)"},icon:l.jsx("svg",{width:"13",height:"13",role:"img",viewBox:"0 0 156 156",children:l.jsx("path",{fill:"currentColor",d:"M110.85 120.575 43.7 120.483333 43.7083334 110.091667 110.85 110.191667 110.841667 120.583333 110.85 120.575ZM85.1333334 87.1916666 43.625 86.7083332 43.7083334 76.3166666 85.2083334 76.7916666 85.1333334 87.1916666 85.1333334 87.1916666ZM110.841667 53.4166666 43.7 53.3166666 43.7083334 42.925 110.85 43.025 110.841667 53.4166666ZM36 138C27.2916666 138 20.75 136.216667 16.4 132.666667 12.1333334 129.2 10 124.308333 10 118L10 95.3333332C10 91.0666666 9.25 88.1333332 7.7333334 86.5333332 6.3166668 84.8416666 3.7333334 84 0 84L0 72C3.7333334 72 6.3083334 71.2 7.7333334 69.6 9.2416668 67.9083334 10 64.9333334 10 60.6666666L10 38C10 31.775 12.1333334 26.8833334 16.4 23.3333332 20.7583334 19.7749998 27.2916666 18 36 18L40.6666668 18 40.6666668 30 36 30C34.0212222 29.9719277 32.1263151 30.7979128 30.8 32.2666666 29.3605875 33.8216362 28.5938182 35.8823287 28.6666668 38L28.6666668 60.6666666C28.6666668 67.5083332 26.6666668 72.4 22.6666668 75.3333332 20.9317416 76.7274684 18.8640675 77.6464347 16.6666668 78 18.8916668 78.35 20.8916668 79.2416666 22.6666668 80.6666666 26.6666668 83.95 28.6666668 88.8416666 28.6666668 95.3333332L28.6666668 118C28.6666668 120.308333 29.3750002 122.216667 30.8 123.733333 32.2166666 125.241667 33.9583334 126 36 126L40.6666668 126 40.6666668 138 36 138 36 138ZM114.116667 126 118.783333 126C120.833333 126 122.566667 125.241667 123.983333 123.733333 125.422746 122.178364 126.189515 120.117671 126.116667 118L126.116667 95.3333332C126.116667 88.8333332 128.116667 83.9499998 132.116667 80.6666666 133.9 79.2416666 135.9 78.35 138.116667 78 135.919156 77.6468047 133.851391 76.7277979 132.116667 75.3333332 128.116667 72.3999998 126.116667 67.5 126.116667 60.6666666L126.116667 38C126.189515 35.8823287 125.422746 33.8216361 123.983333 32.2666666 122.657018 30.7979128 120.762111 29.9719277 118.783333 30L114.116667 30 114.116667 18 118.783333 18C127.5 18 133.983333 19.775 138.25 23.3333332 142.608333 26.8833332 144.783333 31.7749998 144.783333 38L144.783333 60.6666666C144.783333 64.9333332 145.5 67.9083332 146.916667 69.6 148.433333 71.2 151.05 72 154.783333 72L154.783333 84C151.05 84 148.433333 84.8333334 146.916667 86.5333332 145.5 88.1333332 144.783333 91.0666666 144.783333 95.3333332L144.783333 118C144.783333 124.308333 142.616667 129.2 138.25 132.666667 133.983333 136.216667 127.5 138 118.783333 138L114.116667 138 114.116667 126 114.116667 126Z"})}),execute:(e,t)=>{var n=Mn({text:e.text,selection:e.selection,prefix:"```\n",suffix:"\n```"}),r=t.setSelectionRange(n),a="\n```\n",s="\n```\n";r.selectedText.length>=a.length+s.length-2&&r.selectedText.startsWith(a)&&r.selectedText.endsWith(s)?(a="```\n",s="\n```"):((r.selection.start>=1&&e.text.slice(r.selection.start-1,r.selection.start)===`
|
|
@@ -87,8 +87,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
87
87
|
* `),(i.startsWith("- [ ]")||i.startsWith("- [X]")||i.startsWith("- [x]"))&&(w=`
|
|
88
88
|
- [ ] `),/^\d+.\s/.test(i)&&(w=`
|
|
89
89
|
`+(parseInt(i)+1)+". "),Xa(r,w)}else if(e.code&&e.code.toLowerCase()==="keyd"&&e.ctrlKey){Go(e);var A={start:r.selectionStart,end:r.selectionEnd},D=A;A=oi({text:r.value,selection:A});var N=r.value.slice(A.start,A.end);o.setSelectionRange({start:A.end,end:A.end}),Xa(r,`
|
|
90
|
-
`+N),o.setSelectionRange({start:D.start,end:D.end})}else e.code&&e.code.toLowerCase()==="arrowup"&&e.altKey?WE(e,-1):e.code&&e.code.toLowerCase()==="arrowdown"&&e.altKey&&WE(e,1)}var w5=["prefixCls","onChange"],A5=["markdown","commands","fullscreen","preview","highlightEnable","extraCommands","tabSize","defaultTabEnable","autoFocusEnd","textareaWarp","dispatch"];function N5(e){var t=e.prefixCls,n=e.onChange,r=Ei(e,w5),a=g.useContext(Ia),s=a.markdown,i=a.commands,o=a.fullscreen,u=a.preview,c=a.highlightEnable,p=a.extraCommands,d=a.tabSize,f=a.defaultTabEnable,m=a.autoFocusEnd,b=a.textareaWarp,E=a.dispatch;Ei(a,A5);var x=et.useRef(null),y=et.useRef(),S=et.useRef({fullscreen:o,preview:u});g.useEffect(()=>{S.current={fullscreen:o,preview:u,highlightEnable:c}},[o,u,c]),g.useEffect(()=>{if(x.current&&E){var A=new eb(x.current);y.current=A,E({textarea:x.current,commandOrchestrator:A})}},[]),g.useEffect(()=>{if(m&&x.current&&b){x.current.focus();var A=x.current.value.length;x.current.setSelectionRange(A,A),setTimeout(()=>{b&&(b.scrollTop=b.scrollHeight),x.current&&(x.current.scrollTop=x.current.scrollHeight)},0)}},[b]);var w=A=>{v5(A,d,f),RS(A,[...i||[],...p||[]],y.current,E,S.current)};return g.useEffect(()=>(x.current&&x.current.addEventListener("keydown",w),()=>{x.current&&x.current.removeEventListener("keydown",w)}),[]),l.jsx("textarea",ct({autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1},r,{ref:x,className:t+"-text-input "+(r.className?r.className:""),value:s,onChange:A=>{E&&E({markdown:A.target.value}),n&&n(A)}}))}var _5=["prefixCls","className","onScroll","renderTextarea"];function C5(e){var t,n=e?.Markdown,r=(t=e?.useMinHeight)!=null?t:!1;return function(s){var i=s||{},o=i.prefixCls,u=i.className,c=i.onScroll,p=i.renderTextarea,d=Ei(i,_5),f=g.useContext(Ia),m=f.markdown,b=f.scrollTop,E=f.commands,x=f.minHeight,y=f.highlightEnable,S=f.extraCommands,w=f.dispatch,A=et.useRef(null),D=et.useRef(),N=et.createRef();g.useEffect(()=>{var v={};N.current&&(v.textareaWarp=N.current||void 0,N.current.scrollTop=b||0),w&&w(ct({},v))},[]),g.useEffect(()=>{if(A.current&&w){var v=new eb(A.current);D.current=v,w({textarea:A.current,commandOrchestrator:v})}},[]);var T=n&&y?{}:{WebkitTextFillColor:"initial",overflow:"auto"};return l.jsx("div",{ref:N,className:o+"-area "+(u||""),onScroll:c,children:l.jsx("div",{className:o+"-text",style:r?{minHeight:x}:void 0,children:p?et.cloneElement(p(ct({},d,{value:m,autoComplete:"off",autoCorrect:"off",spellCheck:"false",autoCapitalize:"off",className:o+"-text-input",style:{WebkitTextFillColor:"inherit",overflow:"auto"}}),{dispatch:w,onChange:d.onChange,shortcuts:RS,useContext:{commands:E,extraCommands:S,commandOrchestrator:D.current}}),{ref:A}):l.jsxs(g.Fragment,{children:[n&&y&&l.jsx(n,{prefixCls:o}),l.jsx(N5,ct({prefixCls:o},d,{style:T}))]})})})}}const k5=C5({Markdown:zM,useMinHeight:!0});function I5(e){var t=e||{},n=t.prefixCls,r=t.groupName,a=t.commands,s=t.children,i=g.useContext(Ia),o=i.barPopup,u=o===void 0?{}:o;return g.useMemo(()=>l.jsx("div",{className:n+"-toolbar-child "+(r&&u[r]?"active":""),onClick:c=>c.stopPropagation(),children:Array.isArray(a)?l.jsx(MS,ct({commands:a},e,{isChild:!0})):s}),[a,u,r,n])}function VE(e){var t=e.prefixCls,n=e.overflow,r=g.useContext(Ia),a=r.fullscreen,s=r.preview,i=r.barPopup,o=i===void 0?{}:i,u=r.components,c=r.commandOrchestrator,p=r.dispatch,d=g.useRef("");function f(m,b){if(p){var E={barPopup:ct({},o)};m.keyCommand==="preview"&&(E.preview=m.value),m.keyCommand==="fullscreen"&&(E.fullscreen=!a),e.commands&&m.keyCommand==="group"?e.commands.forEach(x=>{b===x.groupName?E.barPopup[b]=!0:x.keyCommand&&(E.barPopup[x.groupName]=!1)}):(b||m.parent)&&Object.keys(E.barPopup||{}).forEach(x=>{E.barPopup[x]=!1}),Object.keys(E).length&&p(ct({},E)),c&&c.executeCommand(m)}}return g.useEffect(()=>{document&&n&&(a?document.body.style.overflow="hidden":(d.current||(d.current=window.getComputedStyle(document.body,null).overflow),document.body.style.overflow=d.current))},[a,d,n]),l.jsx("ul",{children:(e.commands||[]).map((m,b)=>{if(m.keyCommand==="divider")return l.jsx("li",ct({},m.liProps,{className:t+"-toolbar-divider"}),b);if(!m.keyCommand)return l.jsx(g.Fragment,{},b);var E=a&&m.keyCommand==="fullscreen"||m.keyCommand==="preview"&&s===m.value,x=m.children&&typeof m.children=="function"?m.children({getState:()=>c.getState(),textApi:c?c.textApi:void 0,close:()=>f({},m.groupName),execute:()=>f({execute:m.execute}),dispatch:p}):void 0,y=o&&s&&s==="preview"&&!/(preview|fullscreen)/.test(m.keyCommand),S=u?.toolbar||m.render,w=S&&typeof S=="function"?S(m,!!y,f,b):null;return l.jsxs("li",ct({},m.liProps,{className:E?"active":"",children:[w&&et.isValidElement(w)&&w,!w&&!m.buttonProps&&m.icon,!w&&m.buttonProps&&et.createElement("button",ct({type:"button",key:b,disabled:y,"data-name":m.name},m.buttonProps,{onClick:A=>{A.stopPropagation(),f(m,m.groupName)}}),m.icon),m.children&&l.jsx(I5,{overflow:n,groupName:m.groupName,prefixCls:t,children:x,commands:Array.isArray(m.children)?m.children:void 0})]}),b)})})}function MS(e){e===void 0&&(e={});var t=e,n=t.prefixCls,r=t.isChild,a=t.className,s=g.useContext(Ia),i=s.commands,o=s.extraCommands;return l.jsxs("div",{className:n+"-toolbar "+a,children:[l.jsx(VE,ct({},e,{commands:e.commands||i||[]})),!r&&l.jsx(VE,ct({},e,{commands:o||[]}))]})}function qE(e){var t=e.hideToolbar,n=e.toolbarBottom,r=e.placement,a=e.overflow,s=e.prefixCls;if(t||r==="bottom"&&!n||r==="top"&&n)return null;var i=n?"bottom":"";return l.jsx(MS,{prefixCls:s,overflow:a,className:i})}var R5=e=>{var t=e||{},n=t.prefixCls,r=t.onChange,a=g.useRef(null),s=g.useRef(),i=g.useRef(e.height);g.useEffect(()=>{i.current!==e.height&&(i.current=e.height)},[e.height]);function o(d){if(s.current){var f,m=d.clientY||((f=d.changedTouches[0])==null?void 0:f.clientY),b=s.current.height+m-s.current.dragY;b>=e.minHeight&&b<=e.maxHeight&&r&&r(s.current.height+(m-s.current.dragY))}}function u(){var d,f;s.current=void 0,document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",u),(d=a.current)==null||d.removeEventListener("touchmove",o),(f=a.current)==null||f.removeEventListener("touchend",u)}function c(d){var f,m,b;d.preventDefault();var E=d.clientY||((f=d.changedTouches[0])==null?void 0:f.clientY);s.current={height:i.current,dragY:E},document.addEventListener("mousemove",o),document.addEventListener("mouseup",u),(m=a.current)==null||m.addEventListener("touchmove",o,{passive:!1}),(b=a.current)==null||b.addEventListener("touchend",u,{passive:!1})}g.useEffect(()=>{if(document){var d,f;(d=a.current)==null||d.addEventListener("touchstart",c,{passive:!1}),(f=a.current)==null||f.addEventListener("mousedown",c)}return()=>{if(document){var m;(m=a.current)==null||m.removeEventListener("touchstart",c),document.removeEventListener("mousemove",o)}}},[]);var p=g.useMemo(()=>l.jsx("svg",{viewBox:"0 0 512 512",height:"100%",children:l.jsx("path",{fill:"currentColor",d:"M304 256c0 26.5-21.5 48-48 48s-48-21.5-48-48 21.5-48 48-48 48 21.5 48 48zm120-48c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48zm-336 0c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z"})}),[]);return l.jsx("div",{className:n+"-bar",ref:a,children:p})},D5=["prefixCls","className","value","commands","commandsFilter","direction","extraCommands","height","enableScroll","visibleDragbar","highlightEnable","preview","fullscreen","overflow","previewOptions","textareaProps","maxHeight","minHeight","autoFocus","autoFocusEnd","tabSize","defaultTabEnable","onChange","onStatistics","onHeightChange","hideToolbar","toolbarBottom","components","renderTextarea"];function O5(e){return e===void 0&&(e={}),Object.keys(e).forEach(t=>{e[t]=!1}),e}function L5(e){var t=e.MarkdownPreview,n=e.TextArea,r=t,a=n,s=et.forwardRef((o,u)=>{var c=o||{},p=c.prefixCls,d=p===void 0?"w-md-editor":p,f=c.className,m=c.value,b=c.commands,E=b===void 0?T5():b,x=c.commandsFilter,y=c.direction,S=c.extraCommands,w=S===void 0?S5():S,A=c.height,D=A===void 0?200:A,N=c.enableScroll,T=N===void 0?!0:N,v=c.visibleDragbar,R=v===void 0?typeof o.visiableDragbar=="boolean"?o.visiableDragbar:!0:v,C=c.highlightEnable,U=C===void 0?!0:C,k=c.preview,j=k===void 0?"live":k,G=c.fullscreen,$=G===void 0?!1:G,te=c.overflow,H=te===void 0?!0:te,se=c.previewOptions,de=se===void 0?{}:se,O=c.textareaProps,ne=c.maxHeight,pe=ne===void 0?1200:ne,L=c.minHeight,ke=L===void 0?100:L,Re=c.autoFocus,Q=c.autoFocusEnd,_e=Q===void 0?!1:Q,fe=c.tabSize,X=fe===void 0?2:fe,Ve=c.defaultTabEnable,ge=Ve===void 0?!1:Ve,me=c.onChange,Te=c.onStatistics,ve=c.onHeightChange,ie=c.hideToolbar,Ze=c.toolbarBottom,ot=Ze===void 0?!1:Ze,rt=c.components,Ht=c.renderTextarea,St=Ei(c,D5),Ct=E.map(Le=>x?x(Le,!1):Le).filter(Boolean),Zt=w.map(Le=>x?x(Le,!0):Le).filter(Boolean),at=g.useReducer(UM,{markdown:m,preview:j,components:rt,height:D,minHeight:ke,highlightEnable:U,tabSize:X,defaultTabEnable:ge,scrollTop:0,scrollTopPreview:0,commands:Ct,extraCommands:Zt,fullscreen:$,barPopup:{}}),De=at[0],Je=at[1],Z=g.useRef(null),oe=g.useRef(null),J=g.useRef(T);g.useImperativeHandle(u,()=>ct({},De,{container:Z.current,dispatch:Je})),g.useMemo(()=>J.current=T,[T]),g.useEffect(()=>{var Le={};Z.current&&(Le.container=Z.current||void 0),Le.markdown=m||"",Le.barPopup={},Je&&Je(ct({},De,Le))},[]);var ue=[f,"wmde-markdown-var",y?d+"-"+y:null,d,De.preview?d+"-show-"+De.preview:null,De.fullscreen?d+"-fullscreen":null].filter(Boolean).join(" ").trim();g.useMemo(()=>m!==De.markdown&&Je({markdown:m||""}),[m,De.markdown]),g.useMemo(()=>j!==De.preview&&Je({preview:j}),[j]),g.useMemo(()=>X!==De.tabSize&&Je({tabSize:X}),[X]),g.useMemo(()=>U!==De.highlightEnable&&Je({highlightEnable:U}),[U]),g.useMemo(()=>Re!==De.autoFocus&&Je({autoFocus:Re}),[Re]),g.useMemo(()=>_e!==De.autoFocusEnd&&Je({autoFocusEnd:_e}),[_e]),g.useMemo(()=>$!==De.fullscreen&&Je({fullscreen:$}),[$]),g.useMemo(()=>D!==De.height&&Je({height:D}),[D]),g.useMemo(()=>D!==De.height&&ve&&ve(De.height,D,De),[D,ve,De]),g.useMemo(()=>E!==De.commands&&Je({commands:Ct}),[o.commands]),g.useMemo(()=>w!==De.extraCommands&&Je({extraCommands:Zt}),[o.extraCommands]);var Pe=g.useRef(),qe=g.useRef("preview"),ht=g.useRef(!1);g.useMemo(()=>{Pe.current=De.textareaWarp,De.textareaWarp&&(De.textareaWarp.addEventListener("mouseover",()=>{qe.current="text"}),De.textareaWarp.addEventListener("mouseleave",()=>{qe.current="preview"}))},[De.textareaWarp]);var Rt=(Le,ft)=>{if(J.current){var Ke=Pe.current,Dt=oe.current?oe.current:void 0;if(ht.current||(qe.current=ft,ht.current=!0),Ke&&Dt){var nt=(Ke.scrollHeight-Ke.offsetHeight)/(Dt.scrollHeight-Dt.offsetHeight);Le.target===Ke&&qe.current==="text"&&(Dt.scrollTop=Ke.scrollTop/nt),Le.target===Dt&&qe.current==="preview"&&(Ke.scrollTop=Dt.scrollTop*nt);var Qe=0;qe.current==="text"?Qe=Ke.scrollTop||0:qe.current==="preview"&&(Qe=Dt.scrollTop||0),Je({scrollTop:Qe})}}},kt=d+"-preview "+(de.className||""),jt=Le=>Rt(Le,"preview"),ae=g.useMemo(()=>l.jsx("div",{ref:oe,className:kt,children:l.jsx(r,ct({},de,{onScroll:jt,source:De.markdown||""}))}),[kt,de,De.markdown]),Ne=rt?.preview&&rt?.preview(De.markdown||"",De,Je);Ne&&et.isValidElement(Ne)&&(ae=l.jsx("div",{className:kt,ref:oe,onScroll:jt,children:Ne}));var ze=ct({},St.style,{height:De.height||"100%"}),je=()=>Je({barPopup:ct({},O5(De.barPopup))}),vt=Le=>Je({height:Le}),Qt=Le=>{if(me&&me(Le.target.value,Le,De),O&&O.onChange&&O.onChange(Le),De.textarea&&De.textarea instanceof HTMLTextAreaElement&&Te){var ft=new eb(De.textarea),Ke=ft.getState()||{};Te(ct({},Ke,{lineCount:Le.target.value.split(`
|
|
91
|
-
`).length,length:Le.target.value.length}))}};return l.jsx(Ia.Provider,{value:ct({},De,{dispatch:Je}),children:l.jsxs("div",ct({ref:Z,className:ue},St,{onClick:je,style:ze,children:[l.jsx(qE,{hideToolbar:ie,toolbarBottom:ot,prefixCls:d,overflow:H,placement:"top"}),l.jsxs("div",{className:d+"-content",children:[/(edit|live)/.test(De.preview||"")&&l.jsx(a,ct({className:d+"-input",prefixCls:d,autoFocus:Re},O,{onChange:Qt,renderTextarea:rt?.textarea||Ht,onScroll:Le=>Rt(Le,"text")})),/(live|preview)/.test(De.preview||"")&&ae]}),R&&!De.fullscreen&&l.jsx(R5,{prefixCls:d,height:De.height,maxHeight:pe,minHeight:ke,onChange:vt}),l.jsx(qE,{hideToolbar:ie,toolbarBottom:ot,prefixCls:d,overflow:H,placement:"bottom"})]}))})}),i=s;return i.Markdown=t,i.displayName="MDEditor",i}const ol=L5({MarkdownPreview:S4,TextArea:k5}),F5={neutral:"badge-neutral",primary:"badge-primary",secondary:"badge-secondary",accent:"badge-accent",ghost:"badge-ghost",info:"badge-info",success:"badge-success",warning:"badge-warning",error:"badge-error",outline:"badge-outline"},M5={xs:"badge-xs",sm:"badge-sm",md:"badge-md",lg:"badge-lg"};function Ot({variant:e,size:t,className:n,...r}){const a=["badge",e&&F5[e],t&&M5[t],n].filter(Boolean).join(" ");return l.jsx("span",{className:a,...r})}const P5={primary:"btn-primary",ghost:"btn-ghost",error:"btn-error",outline:"btn-outline",accent:"btn-accent",warning:"btn-warning"},j5={xs:"btn-xs",sm:"btn-sm",md:"btn-md",lg:"btn-lg"};function Ge({variant:e,size:t,loading:n,asChild:r,className:a,disabled:s,children:i,...o}){const u=["btn",e&&P5[e],t&&j5[t],a].filter(Boolean).join(" ");if(r&&et.isValidElement(i)){const c=i,p=[u,c.props.className].filter(Boolean).join(" ");return et.cloneElement(c,{className:p})}return l.jsxs("button",{className:u,disabled:s||n,...o,children:[n&&l.jsx("span",{className:"loading loading-spinner"}),i]})}const B5={bordered:"card-bordered",primary:"card-primary",secondary:"card-secondary",accent:"card-accent",neutral:"card-neutral",imagefull:"card-image-full",compact:"card-compact",normal:"card-normal",side:"card-side"};function Ki({variant:e,asChild:t,className:n,children:r,...a}){const s=["card",e&&B5[e],n].filter(Boolean).join(" ");if(t&&et.isValidElement(r)){const i=r,o=[s,i.props.className].filter(Boolean).join(" ");return et.cloneElement(i,{className:o})}return l.jsx("div",{className:s,...a,children:r})}function Xi({className:e,...t}){const n=["card-body",e].filter(Boolean).join(" ");return l.jsx("div",{className:n,...t})}const U5={primary:"checkbox-primary",secondary:"checkbox-secondary",accent:"checkbox-accent",neutral:"checkbox-neutral",success:"checkbox-success",warning:"checkbox-warning",error:"checkbox-error",info:"checkbox-info"},$5={xs:"checkbox-xs",sm:"checkbox-sm",md:"checkbox-md",lg:"checkbox-lg"};function tb({variant:e,size:t,className:n,...r}){const a=["checkbox",e&&U5[e],t&&$5[t],n].filter(Boolean).join(" ");return l.jsx("input",{type:"checkbox",className:a,...r})}const z5={bordered:"input-bordered",ghost:"input-ghost",primary:"input-primary",secondary:"input-secondary",accent:"input-accent",info:"input-info",success:"input-success",warning:"input-warning",error:"input-error"},H5={xs:"input-xs",sm:"input-sm",md:"input-md",lg:"input-lg",xl:"input-xl"};function Ti({variant:e,size:t,error:n,className:r,...a}){const s=["input",e&&z5[e],t&&H5[t],n&&"input-error",r].filter(Boolean).join(" ");return l.jsx("input",{className:s,...a})}const G5={spinner:"loading-spinner",dots:"loading-dots",ring:"loading-ring",ball:"loading-ball",bars:"loading-bars",infinity:"loading-infinity"},W5={xs:"loading-xs",sm:"loading-sm",md:"loading-md",lg:"loading-lg",xl:"loading-xl"};function Ra({variant:e="spinner",size:t,className:n,...r}){const a=["loading",G5[e],t&&W5[t],n].filter(Boolean).join(" ");return l.jsx("span",{className:a,...r})}const V5={primary:"modal-primary",secondary:"modal-secondary",accent:"modal-accent",neutral:"modal-neutral",success:"modal-success",warning:"modal-warning",error:"modal-error",info:"modal-info"};function ll({variant:e,open:t,onClose:n,className:r,children:a,...s}){if(!t)return null;const i=["modal-box",e&&V5[e],r].filter(Boolean).join(" ");return l.jsx("div",{className:"modal modal-open",role:"dialog","aria-modal":"true",tabIndex:-1,onClick:o=>{o.target===o.currentTarget&&n?.()},onKeyDown:o=>{o.key==="Escape"&&n?.()},...s,children:l.jsx("div",{className:i,children:a})})}const q5={bordered:"select-bordered",ghost:"select-ghost",primary:"select-primary",secondary:"select-secondary",accent:"select-accent",info:"select-info",success:"select-success",warning:"select-warning",error:"select-error"},Y5={xs:"select-xs",sm:"select-sm",md:"select-md",lg:"select-lg"};function Xr({variant:e,size:t,className:n,children:r,...a}){const s=["select",e&&q5[e],t&&Y5[t],n].filter(Boolean).join(" ");return l.jsx("select",{className:s,...a,children:r})}const Z5={bordered:"textarea-bordered",ghost:"textarea-ghost",primary:"textarea-primary",secondary:"textarea-secondary",accent:"textarea-accent",info:"textarea-info",success:"textarea-success",warning:"textarea-warning",error:"textarea-error"},K5={xs:"textarea-xs",sm:"textarea-sm",md:"textarea-md",lg:"textarea-lg",xl:"textarea-xl"};function X5({variant:e,size:t,error:n,className:r,...a}){const s=["textarea",e&&Z5[e],t&&K5[t],n&&"textarea-error",r].filter(Boolean).join(" ");return l.jsx("textarea",{className:s,...a})}const Q5={top:"tooltip-top",bottom:"tooltip-bottom",left:"tooltip-left",right:"tooltip-right"};function J5({position:e,tip:t,className:n,...r}){const a=["tooltip",e&&Q5[e],n].filter(Boolean).join(" ");return l.jsx("span",{className:a,"data-tip":t,...r})}const PS="spur-board-layout",Ma={sidebarWidth:240,rightPanelWidth:320,sidebarCollapsed:!1,rightPanelCollapsed:!0};function eP(){try{const e=localStorage.getItem(PS);if(!e)return{...Ma};const t=JSON.parse(e);return{sidebarWidth:typeof t.sidebarWidth=="number"?t.sidebarWidth:Ma.sidebarWidth,rightPanelWidth:typeof t.rightPanelWidth=="number"?t.rightPanelWidth:Ma.rightPanelWidth,sidebarCollapsed:typeof t.sidebarCollapsed=="boolean"?t.sidebarCollapsed:Ma.sidebarCollapsed,rightPanelCollapsed:typeof t.rightPanelCollapsed=="boolean"?t.rightPanelCollapsed:Ma.rightPanelCollapsed}}catch{return{...Ma}}}function tP(e){try{localStorage.setItem(PS,JSON.stringify(e))}catch{}}const nP=[];function rP(e){return e[0]??{}}function ul(e){return Array.isArray(e)?e:e==null?[]:[e]}const YE="orpc",aP="@orpc/shared",sP="1.14.4";class iP extends Error{constructor(...t){super(...t),this.name="AbortError"}}function oP(e){let t;return()=>{if(t)return t.result;const n=e();return t={result:n},n}}function lP(e){let t=Promise.resolve();return(...n)=>t=t.catch(()=>{}).then(()=>e(...n))}const uP=2,cP=`__${aP}@${sP}/otel/config__`;function mu(){return globalThis[cP]}function nb(e,t={},n){return mu()?.tracer?.startSpan(e,t,n)}function Ea(e,t,n={}){if(!e)return;const r=dP(t);e.recordException(r),(!n.signal?.aborted||n.signal.reason!==t)&&e.setStatus({code:uP,message:r.message})}function dP(e){if(e instanceof Error){const t={message:e.message,name:e.name,stack:e.stack};return"code"in e&&(typeof e.code=="string"||typeof e.code=="number")&&(t.code=e.code),t}return{message:String(e)}}async function qs({name:e,context:t,...n},r){const a=mu()?.tracer;if(!a)return r();const s=async i=>{try{return await r(i)}catch(o){throw Ea(i,o,n),o}finally{i.end()}};return t?a.startActiveSpan(e,n,t,s):a.startActiveSpan(e,n,s)}async function as(e,t){const n=mu();if(!e||!n)return t();const r=n.trace.setSpan(n.context.active(),e);return n.context.with(r,t)}function Si(e){return!e||typeof e!="object"?!1:"next"in e&&typeof e.next=="function"&&Symbol.asyncIterator in e&&typeof e[Symbol.asyncIterator]=="function"}const pP=Symbol.for("asyncDispose"),fP=Symbol.asyncDispose??pP;class rb{#e=!1;#t=!1;#n;#r;constructor(t,n){this.#n=n,this.#r=lP(async()=>{if(this.#e)return{done:!0,value:void 0};try{const r=await t();return r.done&&(this.#e=!0),r}catch(r){throw this.#e=!0,r}finally{this.#e&&!this.#t&&(this.#t=!0,await this.#n("next"))}})}next(){return this.#r()}async return(t){return this.#e=!0,this.#t||(this.#t=!0,await this.#n("return")),{done:!0,value:t}}async throw(t){throw this.#e=!0,this.#t||(this.#t=!0,await this.#n("throw")),t}async[fP](){this.#e=!0,this.#t||(this.#t=!0,await this.#n("dispose"))}[Symbol.asyncIterator](){return this}}function ZE({name:e,...t},n){let r;return new rb(async()=>{r??=nb(e);try{const a=await as(r,()=>n.next());return r?.addEvent(a.done?"completed":"yielded"),a}catch(a){throw Ea(r,a,t),a}},async a=>{try{a!=="next"&&await as(r,()=>n.return?.())}catch(s){throw Ea(r,s,t),s}finally{r?.end()}})}function mP(e){return async(t,...n)=>{try{return await t.next()}catch(r){throw await e(r,t,...n),r}}}function ud(e,t,n){const r=(a,s)=>{const i=e[s];return i?i({...a,next:(o=a)=>r(o,s+1)}):n(a)};return r(t,0)}function Wo(e){if(e)return JSON.parse(e)}function cd(e){return JSON.stringify(e)}function hP(e){return xa(e)?Object.getPrototypeOf(e)?.constructor:null}function Zr(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||!t||!t.constructor}function xa(e){return!!e&&(typeof e=="object"||typeof e=="function")}function KE(e,t){let n=e;for(const r of t){if(!xa(n))return;n=n[r]}return n}const jS=(()=>{const e=function(){};return e.prototype=Object.create(null),Object.freeze(e.prototype),e})();function XE(e,...t){return typeof e=="function"?e(...t):e}function BS(e){return new Proxy(e,{get(t,n,r){const a=Reflect.get(t,n,r);return n!=="then"||typeof a!="function"?a:new Proxy(a,{apply(s,i,o){if(o.length!==2||o.some(c=>!bP(c)))return Reflect.apply(s,i,o);let u=!0;o[0].call(i,BS(new Proxy(t,{get:(c,p,d)=>{if(u&&p==="then"){u=!1;return}return Reflect.get(c,p,d)}})))}})}})}const gP=/^\s*function\s*\(\)\s*\{\s*\[native code\]\s*\}\s*$/;function bP(e){return typeof e=="function"&&gP.test(e.toString())}function EP(e){try{return decodeURIComponent(e)}catch{return e}}const xP="@orpc/client",yP="1.14.4",ab={BAD_REQUEST:{status:400,message:"Bad Request"},UNAUTHORIZED:{status:401,message:"Unauthorized"},FORBIDDEN:{status:403,message:"Forbidden"},NOT_FOUND:{status:404,message:"Not Found"},METHOD_NOT_SUPPORTED:{status:405,message:"Method Not Supported"},NOT_ACCEPTABLE:{status:406,message:"Not Acceptable"},TIMEOUT:{status:408,message:"Request Timeout"},CONFLICT:{status:409,message:"Conflict"},PRECONDITION_FAILED:{status:412,message:"Precondition Failed"},PAYLOAD_TOO_LARGE:{status:413,message:"Payload Too Large"},UNSUPPORTED_MEDIA_TYPE:{status:415,message:"Unsupported Media Type"},UNPROCESSABLE_CONTENT:{status:422,message:"Unprocessable Content"},TOO_MANY_REQUESTS:{status:429,message:"Too Many Requests"},CLIENT_CLOSED_REQUEST:{status:499,message:"Client Closed Request"},INTERNAL_SERVER_ERROR:{status:500,message:"Internal Server Error"},NOT_IMPLEMENTED:{status:501,message:"Not Implemented"},BAD_GATEWAY:{status:502,message:"Bad Gateway"},SERVICE_UNAVAILABLE:{status:503,message:"Service Unavailable"},GATEWAY_TIMEOUT:{status:504,message:"Gateway Timeout"}};function TP(e,t){return t??ab[e]?.status??500}function SP(e,t){return t||ab[e]?.message||e}const US=Symbol.for(`__${xP}@${yP}/error/ORPC_ERROR_CONSTRUCTORS__`);globalThis[US]??=new WeakSet;const dd=globalThis[US];class vi extends Error{defined;code;status;data;constructor(t,...n){const r=rP(n);if(r.status!==void 0&&!wi(r.status))throw new Error("[ORPCError] Invalid error status code.");const a=SP(t,r.message);super(a,r),this.code=t,this.status=TP(t,r.status),this.defined=r.defined??!1,this.data=r.data}toJSON(){return{defined:this.defined,code:this.code,status:this.status,message:this.message,data:this.data}}static[Symbol.hasInstance](t){if(dd.has(this)){const n=hP(t);if(n&&dd.has(n))return!0}return super[Symbol.hasInstance](t)}}dd.add(vi);function vP(e){return e instanceof vi?e:new vi("INTERNAL_SERVER_ERROR",{message:"Internal server error",cause:e})}function wi(e){return e<200||e>=400}function $S(e){if(!Zr(e))return!1;const t=["defined","code","status","message","data"];return Object.keys(e).some(n=>!t.includes(n))?!1:"defined"in e&&typeof e.defined=="boolean"&&"code"in e&&typeof e.code=="string"&&"status"in e&&typeof e.status=="number"&&wi(e.status)&&"message"in e&&typeof e.message=="string"}function zS(e,t={}){return new vi(e.code,{...t,...e})}class hu extends TypeError{}class wP extends TypeError{}class Ai extends Error{data;constructor(t){super(t?.message??"An error event was received",t),this.data=t?.data}}function AP(e){const t=e.replace(/\n+$/,"").split(/\n/),n={data:void 0,event:void 0,id:void 0,retry:void 0,comments:[]};for(const r of t){const a=r.indexOf(":"),s=a===-1?r:r.slice(0,a),i=a===-1?"":r.slice(a+1).replace(/^\s/,"");if(a===0)n.comments.push(i);else if(s==="data")n.data??="",n.data+=`${i}
|
|
90
|
+
`+N),o.setSelectionRange({start:D.start,end:D.end})}else e.code&&e.code.toLowerCase()==="arrowup"&&e.altKey?WE(e,-1):e.code&&e.code.toLowerCase()==="arrowdown"&&e.altKey&&WE(e,1)}var w5=["prefixCls","onChange"],A5=["markdown","commands","fullscreen","preview","highlightEnable","extraCommands","tabSize","defaultTabEnable","autoFocusEnd","textareaWarp","dispatch"];function N5(e){var t=e.prefixCls,n=e.onChange,r=Ei(e,w5),a=g.useContext(Ia),s=a.markdown,i=a.commands,o=a.fullscreen,u=a.preview,c=a.highlightEnable,p=a.extraCommands,d=a.tabSize,f=a.defaultTabEnable,m=a.autoFocusEnd,b=a.textareaWarp,E=a.dispatch;Ei(a,A5);var x=tt.useRef(null),y=tt.useRef(),S=tt.useRef({fullscreen:o,preview:u});g.useEffect(()=>{S.current={fullscreen:o,preview:u,highlightEnable:c}},[o,u,c]),g.useEffect(()=>{if(x.current&&E){var A=new eb(x.current);y.current=A,E({textarea:x.current,commandOrchestrator:A})}},[]),g.useEffect(()=>{if(m&&x.current&&b){x.current.focus();var A=x.current.value.length;x.current.setSelectionRange(A,A),setTimeout(()=>{b&&(b.scrollTop=b.scrollHeight),x.current&&(x.current.scrollTop=x.current.scrollHeight)},0)}},[b]);var w=A=>{v5(A,d,f),RS(A,[...i||[],...p||[]],y.current,E,S.current)};return g.useEffect(()=>(x.current&&x.current.addEventListener("keydown",w),()=>{x.current&&x.current.removeEventListener("keydown",w)}),[]),l.jsx("textarea",ct({autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1},r,{ref:x,className:t+"-text-input "+(r.className?r.className:""),value:s,onChange:A=>{E&&E({markdown:A.target.value}),n&&n(A)}}))}var _5=["prefixCls","className","onScroll","renderTextarea"];function C5(e){var t,n=e?.Markdown,r=(t=e?.useMinHeight)!=null?t:!1;return function(s){var i=s||{},o=i.prefixCls,u=i.className,c=i.onScroll,p=i.renderTextarea,d=Ei(i,_5),f=g.useContext(Ia),m=f.markdown,b=f.scrollTop,E=f.commands,x=f.minHeight,y=f.highlightEnable,S=f.extraCommands,w=f.dispatch,A=tt.useRef(null),D=tt.useRef(),N=tt.createRef();g.useEffect(()=>{var v={};N.current&&(v.textareaWarp=N.current||void 0,N.current.scrollTop=b||0),w&&w(ct({},v))},[]),g.useEffect(()=>{if(A.current&&w){var v=new eb(A.current);D.current=v,w({textarea:A.current,commandOrchestrator:v})}},[]);var T=n&&y?{}:{WebkitTextFillColor:"initial",overflow:"auto"};return l.jsx("div",{ref:N,className:o+"-area "+(u||""),onScroll:c,children:l.jsx("div",{className:o+"-text",style:r?{minHeight:x}:void 0,children:p?tt.cloneElement(p(ct({},d,{value:m,autoComplete:"off",autoCorrect:"off",spellCheck:"false",autoCapitalize:"off",className:o+"-text-input",style:{WebkitTextFillColor:"inherit",overflow:"auto"}}),{dispatch:w,onChange:d.onChange,shortcuts:RS,useContext:{commands:E,extraCommands:S,commandOrchestrator:D.current}}),{ref:A}):l.jsxs(g.Fragment,{children:[n&&y&&l.jsx(n,{prefixCls:o}),l.jsx(N5,ct({prefixCls:o},d,{style:T}))]})})})}}const k5=C5({Markdown:zM,useMinHeight:!0});function I5(e){var t=e||{},n=t.prefixCls,r=t.groupName,a=t.commands,s=t.children,i=g.useContext(Ia),o=i.barPopup,u=o===void 0?{}:o;return g.useMemo(()=>l.jsx("div",{className:n+"-toolbar-child "+(r&&u[r]?"active":""),onClick:c=>c.stopPropagation(),children:Array.isArray(a)?l.jsx(MS,ct({commands:a},e,{isChild:!0})):s}),[a,u,r,n])}function VE(e){var t=e.prefixCls,n=e.overflow,r=g.useContext(Ia),a=r.fullscreen,s=r.preview,i=r.barPopup,o=i===void 0?{}:i,u=r.components,c=r.commandOrchestrator,p=r.dispatch,d=g.useRef("");function f(m,b){if(p){var E={barPopup:ct({},o)};m.keyCommand==="preview"&&(E.preview=m.value),m.keyCommand==="fullscreen"&&(E.fullscreen=!a),e.commands&&m.keyCommand==="group"?e.commands.forEach(x=>{b===x.groupName?E.barPopup[b]=!0:x.keyCommand&&(E.barPopup[x.groupName]=!1)}):(b||m.parent)&&Object.keys(E.barPopup||{}).forEach(x=>{E.barPopup[x]=!1}),Object.keys(E).length&&p(ct({},E)),c&&c.executeCommand(m)}}return g.useEffect(()=>{document&&n&&(a?document.body.style.overflow="hidden":(d.current||(d.current=window.getComputedStyle(document.body,null).overflow),document.body.style.overflow=d.current))},[a,d,n]),l.jsx("ul",{children:(e.commands||[]).map((m,b)=>{if(m.keyCommand==="divider")return l.jsx("li",ct({},m.liProps,{className:t+"-toolbar-divider"}),b);if(!m.keyCommand)return l.jsx(g.Fragment,{},b);var E=a&&m.keyCommand==="fullscreen"||m.keyCommand==="preview"&&s===m.value,x=m.children&&typeof m.children=="function"?m.children({getState:()=>c.getState(),textApi:c?c.textApi:void 0,close:()=>f({},m.groupName),execute:()=>f({execute:m.execute}),dispatch:p}):void 0,y=o&&s&&s==="preview"&&!/(preview|fullscreen)/.test(m.keyCommand),S=u?.toolbar||m.render,w=S&&typeof S=="function"?S(m,!!y,f,b):null;return l.jsxs("li",ct({},m.liProps,{className:E?"active":"",children:[w&&tt.isValidElement(w)&&w,!w&&!m.buttonProps&&m.icon,!w&&m.buttonProps&&tt.createElement("button",ct({type:"button",key:b,disabled:y,"data-name":m.name},m.buttonProps,{onClick:A=>{A.stopPropagation(),f(m,m.groupName)}}),m.icon),m.children&&l.jsx(I5,{overflow:n,groupName:m.groupName,prefixCls:t,children:x,commands:Array.isArray(m.children)?m.children:void 0})]}),b)})})}function MS(e){e===void 0&&(e={});var t=e,n=t.prefixCls,r=t.isChild,a=t.className,s=g.useContext(Ia),i=s.commands,o=s.extraCommands;return l.jsxs("div",{className:n+"-toolbar "+a,children:[l.jsx(VE,ct({},e,{commands:e.commands||i||[]})),!r&&l.jsx(VE,ct({},e,{commands:o||[]}))]})}function qE(e){var t=e.hideToolbar,n=e.toolbarBottom,r=e.placement,a=e.overflow,s=e.prefixCls;if(t||r==="bottom"&&!n||r==="top"&&n)return null;var i=n?"bottom":"";return l.jsx(MS,{prefixCls:s,overflow:a,className:i})}var R5=e=>{var t=e||{},n=t.prefixCls,r=t.onChange,a=g.useRef(null),s=g.useRef(),i=g.useRef(e.height);g.useEffect(()=>{i.current!==e.height&&(i.current=e.height)},[e.height]);function o(d){if(s.current){var f,m=d.clientY||((f=d.changedTouches[0])==null?void 0:f.clientY),b=s.current.height+m-s.current.dragY;b>=e.minHeight&&b<=e.maxHeight&&r&&r(s.current.height+(m-s.current.dragY))}}function u(){var d,f;s.current=void 0,document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",u),(d=a.current)==null||d.removeEventListener("touchmove",o),(f=a.current)==null||f.removeEventListener("touchend",u)}function c(d){var f,m,b;d.preventDefault();var E=d.clientY||((f=d.changedTouches[0])==null?void 0:f.clientY);s.current={height:i.current,dragY:E},document.addEventListener("mousemove",o),document.addEventListener("mouseup",u),(m=a.current)==null||m.addEventListener("touchmove",o,{passive:!1}),(b=a.current)==null||b.addEventListener("touchend",u,{passive:!1})}g.useEffect(()=>{if(document){var d,f;(d=a.current)==null||d.addEventListener("touchstart",c,{passive:!1}),(f=a.current)==null||f.addEventListener("mousedown",c)}return()=>{if(document){var m;(m=a.current)==null||m.removeEventListener("touchstart",c),document.removeEventListener("mousemove",o)}}},[]);var p=g.useMemo(()=>l.jsx("svg",{viewBox:"0 0 512 512",height:"100%",children:l.jsx("path",{fill:"currentColor",d:"M304 256c0 26.5-21.5 48-48 48s-48-21.5-48-48 21.5-48 48-48 48 21.5 48 48zm120-48c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48zm-336 0c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z"})}),[]);return l.jsx("div",{className:n+"-bar",ref:a,children:p})},D5=["prefixCls","className","value","commands","commandsFilter","direction","extraCommands","height","enableScroll","visibleDragbar","highlightEnable","preview","fullscreen","overflow","previewOptions","textareaProps","maxHeight","minHeight","autoFocus","autoFocusEnd","tabSize","defaultTabEnable","onChange","onStatistics","onHeightChange","hideToolbar","toolbarBottom","components","renderTextarea"];function O5(e){return e===void 0&&(e={}),Object.keys(e).forEach(t=>{e[t]=!1}),e}function L5(e){var t=e.MarkdownPreview,n=e.TextArea,r=t,a=n,s=tt.forwardRef((o,u)=>{var c=o||{},p=c.prefixCls,d=p===void 0?"w-md-editor":p,f=c.className,m=c.value,b=c.commands,E=b===void 0?T5():b,x=c.commandsFilter,y=c.direction,S=c.extraCommands,w=S===void 0?S5():S,A=c.height,D=A===void 0?200:A,N=c.enableScroll,T=N===void 0?!0:N,v=c.visibleDragbar,R=v===void 0?typeof o.visiableDragbar=="boolean"?o.visiableDragbar:!0:v,C=c.highlightEnable,U=C===void 0?!0:C,k=c.preview,j=k===void 0?"live":k,G=c.fullscreen,$=G===void 0?!1:G,te=c.overflow,H=te===void 0?!0:te,se=c.previewOptions,de=se===void 0?{}:se,O=c.textareaProps,ne=c.maxHeight,pe=ne===void 0?1200:ne,L=c.minHeight,ke=L===void 0?100:L,Re=c.autoFocus,Q=c.autoFocusEnd,_e=Q===void 0?!1:Q,fe=c.tabSize,X=fe===void 0?2:fe,Ve=c.defaultTabEnable,ge=Ve===void 0?!1:Ve,me=c.onChange,Te=c.onStatistics,ve=c.onHeightChange,ie=c.hideToolbar,Ze=c.toolbarBottom,ot=Ze===void 0?!1:Ze,rt=c.components,Ht=c.renderTextarea,St=Ei(c,D5),Ct=E.map(Le=>x?x(Le,!1):Le).filter(Boolean),Zt=w.map(Le=>x?x(Le,!0):Le).filter(Boolean),at=g.useReducer(UM,{markdown:m,preview:j,components:rt,height:D,minHeight:ke,highlightEnable:U,tabSize:X,defaultTabEnable:ge,scrollTop:0,scrollTopPreview:0,commands:Ct,extraCommands:Zt,fullscreen:$,barPopup:{}}),De=at[0],et=at[1],Z=g.useRef(null),oe=g.useRef(null),J=g.useRef(T);g.useImperativeHandle(u,()=>ct({},De,{container:Z.current,dispatch:et})),g.useMemo(()=>J.current=T,[T]),g.useEffect(()=>{var Le={};Z.current&&(Le.container=Z.current||void 0),Le.markdown=m||"",Le.barPopup={},et&&et(ct({},De,Le))},[]);var ue=[f,"wmde-markdown-var",y?d+"-"+y:null,d,De.preview?d+"-show-"+De.preview:null,De.fullscreen?d+"-fullscreen":null].filter(Boolean).join(" ").trim();g.useMemo(()=>m!==De.markdown&&et({markdown:m||""}),[m,De.markdown]),g.useMemo(()=>j!==De.preview&&et({preview:j}),[j]),g.useMemo(()=>X!==De.tabSize&&et({tabSize:X}),[X]),g.useMemo(()=>U!==De.highlightEnable&&et({highlightEnable:U}),[U]),g.useMemo(()=>Re!==De.autoFocus&&et({autoFocus:Re}),[Re]),g.useMemo(()=>_e!==De.autoFocusEnd&&et({autoFocusEnd:_e}),[_e]),g.useMemo(()=>$!==De.fullscreen&&et({fullscreen:$}),[$]),g.useMemo(()=>D!==De.height&&et({height:D}),[D]),g.useMemo(()=>D!==De.height&&ve&&ve(De.height,D,De),[D,ve,De]),g.useMemo(()=>E!==De.commands&&et({commands:Ct}),[o.commands]),g.useMemo(()=>w!==De.extraCommands&&et({extraCommands:Zt}),[o.extraCommands]);var Pe=g.useRef(),qe=g.useRef("preview"),ht=g.useRef(!1);g.useMemo(()=>{Pe.current=De.textareaWarp,De.textareaWarp&&(De.textareaWarp.addEventListener("mouseover",()=>{qe.current="text"}),De.textareaWarp.addEventListener("mouseleave",()=>{qe.current="preview"}))},[De.textareaWarp]);var Rt=(Le,ft)=>{if(J.current){var Ke=Pe.current,Dt=oe.current?oe.current:void 0;if(ht.current||(qe.current=ft,ht.current=!0),Ke&&Dt){var nt=(Ke.scrollHeight-Ke.offsetHeight)/(Dt.scrollHeight-Dt.offsetHeight);Le.target===Ke&&qe.current==="text"&&(Dt.scrollTop=Ke.scrollTop/nt),Le.target===Dt&&qe.current==="preview"&&(Ke.scrollTop=Dt.scrollTop*nt);var Qe=0;qe.current==="text"?Qe=Ke.scrollTop||0:qe.current==="preview"&&(Qe=Dt.scrollTop||0),et({scrollTop:Qe})}}},kt=d+"-preview "+(de.className||""),jt=Le=>Rt(Le,"preview"),ae=g.useMemo(()=>l.jsx("div",{ref:oe,className:kt,children:l.jsx(r,ct({},de,{onScroll:jt,source:De.markdown||""}))}),[kt,de,De.markdown]),Ne=rt?.preview&&rt?.preview(De.markdown||"",De,et);Ne&&tt.isValidElement(Ne)&&(ae=l.jsx("div",{className:kt,ref:oe,onScroll:jt,children:Ne}));var ze=ct({},St.style,{height:De.height||"100%"}),je=()=>et({barPopup:ct({},O5(De.barPopup))}),vt=Le=>et({height:Le}),Qt=Le=>{if(me&&me(Le.target.value,Le,De),O&&O.onChange&&O.onChange(Le),De.textarea&&De.textarea instanceof HTMLTextAreaElement&&Te){var ft=new eb(De.textarea),Ke=ft.getState()||{};Te(ct({},Ke,{lineCount:Le.target.value.split(`
|
|
91
|
+
`).length,length:Le.target.value.length}))}};return l.jsx(Ia.Provider,{value:ct({},De,{dispatch:et}),children:l.jsxs("div",ct({ref:Z,className:ue},St,{onClick:je,style:ze,children:[l.jsx(qE,{hideToolbar:ie,toolbarBottom:ot,prefixCls:d,overflow:H,placement:"top"}),l.jsxs("div",{className:d+"-content",children:[/(edit|live)/.test(De.preview||"")&&l.jsx(a,ct({className:d+"-input",prefixCls:d,autoFocus:Re},O,{onChange:Qt,renderTextarea:rt?.textarea||Ht,onScroll:Le=>Rt(Le,"text")})),/(live|preview)/.test(De.preview||"")&&ae]}),R&&!De.fullscreen&&l.jsx(R5,{prefixCls:d,height:De.height,maxHeight:pe,minHeight:ke,onChange:vt}),l.jsx(qE,{hideToolbar:ie,toolbarBottom:ot,prefixCls:d,overflow:H,placement:"bottom"})]}))})}),i=s;return i.Markdown=t,i.displayName="MDEditor",i}const ol=L5({MarkdownPreview:S4,TextArea:k5}),F5={neutral:"badge-neutral",primary:"badge-primary",secondary:"badge-secondary",accent:"badge-accent",ghost:"badge-ghost",info:"badge-info",success:"badge-success",warning:"badge-warning",error:"badge-error",outline:"badge-outline"},M5={xs:"badge-xs",sm:"badge-sm",md:"badge-md",lg:"badge-lg"};function Ot({variant:e,size:t,className:n,...r}){const a=["badge",e&&F5[e],t&&M5[t],n].filter(Boolean).join(" ");return l.jsx("span",{className:a,...r})}const P5={primary:"btn-primary",ghost:"btn-ghost",error:"btn-error",outline:"btn-outline",accent:"btn-accent",warning:"btn-warning"},j5={xs:"btn-xs",sm:"btn-sm",md:"btn-md",lg:"btn-lg"};function Ge({variant:e,size:t,loading:n,asChild:r,className:a,disabled:s,children:i,...o}){const u=["btn",e&&P5[e],t&&j5[t],a].filter(Boolean).join(" ");if(r&&tt.isValidElement(i)){const c=i,p=[u,c.props.className].filter(Boolean).join(" ");return tt.cloneElement(c,{className:p})}return l.jsxs("button",{className:u,disabled:s||n,...o,children:[n&&l.jsx("span",{className:"loading loading-spinner"}),i]})}const B5={bordered:"card-bordered",primary:"card-primary",secondary:"card-secondary",accent:"card-accent",neutral:"card-neutral",imagefull:"card-image-full",compact:"card-compact",normal:"card-normal",side:"card-side"};function Ki({variant:e,asChild:t,className:n,children:r,...a}){const s=["card",e&&B5[e],n].filter(Boolean).join(" ");if(t&&tt.isValidElement(r)){const i=r,o=[s,i.props.className].filter(Boolean).join(" ");return tt.cloneElement(i,{className:o})}return l.jsx("div",{className:s,...a,children:r})}function Xi({className:e,...t}){const n=["card-body",e].filter(Boolean).join(" ");return l.jsx("div",{className:n,...t})}const U5={primary:"checkbox-primary",secondary:"checkbox-secondary",accent:"checkbox-accent",neutral:"checkbox-neutral",success:"checkbox-success",warning:"checkbox-warning",error:"checkbox-error",info:"checkbox-info"},$5={xs:"checkbox-xs",sm:"checkbox-sm",md:"checkbox-md",lg:"checkbox-lg"};function tb({variant:e,size:t,className:n,...r}){const a=["checkbox",e&&U5[e],t&&$5[t],n].filter(Boolean).join(" ");return l.jsx("input",{type:"checkbox",className:a,...r})}const z5={bordered:"input-bordered",ghost:"input-ghost",primary:"input-primary",secondary:"input-secondary",accent:"input-accent",info:"input-info",success:"input-success",warning:"input-warning",error:"input-error"},H5={xs:"input-xs",sm:"input-sm",md:"input-md",lg:"input-lg",xl:"input-xl"};function Ti({variant:e,size:t,error:n,className:r,...a}){const s=["input",e&&z5[e],t&&H5[t],n&&"input-error",r].filter(Boolean).join(" ");return l.jsx("input",{className:s,...a})}const G5={spinner:"loading-spinner",dots:"loading-dots",ring:"loading-ring",ball:"loading-ball",bars:"loading-bars",infinity:"loading-infinity"},W5={xs:"loading-xs",sm:"loading-sm",md:"loading-md",lg:"loading-lg",xl:"loading-xl"};function Ra({variant:e="spinner",size:t,className:n,...r}){const a=["loading",G5[e],t&&W5[t],n].filter(Boolean).join(" ");return l.jsx("span",{className:a,...r})}const V5={primary:"modal-primary",secondary:"modal-secondary",accent:"modal-accent",neutral:"modal-neutral",success:"modal-success",warning:"modal-warning",error:"modal-error",info:"modal-info"};function ll({variant:e,open:t,onClose:n,className:r,children:a,...s}){if(!t)return null;const i=["modal-box",e&&V5[e],r].filter(Boolean).join(" ");return l.jsx("div",{className:"modal modal-open",role:"dialog","aria-modal":"true",tabIndex:-1,onClick:o=>{o.target===o.currentTarget&&n?.()},onKeyDown:o=>{o.key==="Escape"&&n?.()},...s,children:l.jsx("div",{className:i,children:a})})}const q5={bordered:"select-bordered",ghost:"select-ghost",primary:"select-primary",secondary:"select-secondary",accent:"select-accent",info:"select-info",success:"select-success",warning:"select-warning",error:"select-error"},Y5={xs:"select-xs",sm:"select-sm",md:"select-md",lg:"select-lg"};function Xr({variant:e,size:t,className:n,children:r,...a}){const s=["select",e&&q5[e],t&&Y5[t],n].filter(Boolean).join(" ");return l.jsx("select",{className:s,...a,children:r})}const Z5={bordered:"textarea-bordered",ghost:"textarea-ghost",primary:"textarea-primary",secondary:"textarea-secondary",accent:"textarea-accent",info:"textarea-info",success:"textarea-success",warning:"textarea-warning",error:"textarea-error"},K5={xs:"textarea-xs",sm:"textarea-sm",md:"textarea-md",lg:"textarea-lg",xl:"textarea-xl"};function X5({variant:e,size:t,error:n,className:r,...a}){const s=["textarea",e&&Z5[e],t&&K5[t],n&&"textarea-error",r].filter(Boolean).join(" ");return l.jsx("textarea",{className:s,...a})}const Q5={top:"tooltip-top",bottom:"tooltip-bottom",left:"tooltip-left",right:"tooltip-right"};function J5({position:e,tip:t,className:n,...r}){const a=["tooltip",e&&Q5[e],n].filter(Boolean).join(" ");return l.jsx("span",{className:a,"data-tip":t,...r})}const PS="spur-board-layout",Ma={sidebarWidth:240,rightPanelWidth:320,sidebarCollapsed:!1,rightPanelCollapsed:!0};function eP(){try{const e=localStorage.getItem(PS);if(!e)return{...Ma};const t=JSON.parse(e);return{sidebarWidth:typeof t.sidebarWidth=="number"?t.sidebarWidth:Ma.sidebarWidth,rightPanelWidth:typeof t.rightPanelWidth=="number"?t.rightPanelWidth:Ma.rightPanelWidth,sidebarCollapsed:typeof t.sidebarCollapsed=="boolean"?t.sidebarCollapsed:Ma.sidebarCollapsed,rightPanelCollapsed:typeof t.rightPanelCollapsed=="boolean"?t.rightPanelCollapsed:Ma.rightPanelCollapsed}}catch{return{...Ma}}}function tP(e){try{localStorage.setItem(PS,JSON.stringify(e))}catch{}}const nP=[];function rP(e){return e[0]??{}}function ul(e){return Array.isArray(e)?e:e==null?[]:[e]}const YE="orpc",aP="@orpc/shared",sP="1.14.4";class iP extends Error{constructor(...t){super(...t),this.name="AbortError"}}function oP(e){let t;return()=>{if(t)return t.result;const n=e();return t={result:n},n}}function lP(e){let t=Promise.resolve();return(...n)=>t=t.catch(()=>{}).then(()=>e(...n))}const uP=2,cP=`__${aP}@${sP}/otel/config__`;function mu(){return globalThis[cP]}function nb(e,t={},n){return mu()?.tracer?.startSpan(e,t,n)}function Ea(e,t,n={}){if(!e)return;const r=dP(t);e.recordException(r),(!n.signal?.aborted||n.signal.reason!==t)&&e.setStatus({code:uP,message:r.message})}function dP(e){if(e instanceof Error){const t={message:e.message,name:e.name,stack:e.stack};return"code"in e&&(typeof e.code=="string"||typeof e.code=="number")&&(t.code=e.code),t}return{message:String(e)}}async function qs({name:e,context:t,...n},r){const a=mu()?.tracer;if(!a)return r();const s=async i=>{try{return await r(i)}catch(o){throw Ea(i,o,n),o}finally{i.end()}};return t?a.startActiveSpan(e,n,t,s):a.startActiveSpan(e,n,s)}async function as(e,t){const n=mu();if(!e||!n)return t();const r=n.trace.setSpan(n.context.active(),e);return n.context.with(r,t)}function Si(e){return!e||typeof e!="object"?!1:"next"in e&&typeof e.next=="function"&&Symbol.asyncIterator in e&&typeof e[Symbol.asyncIterator]=="function"}const pP=Symbol.for("asyncDispose"),fP=Symbol.asyncDispose??pP;class rb{#e=!1;#t=!1;#n;#r;constructor(t,n){this.#n=n,this.#r=lP(async()=>{if(this.#e)return{done:!0,value:void 0};try{const r=await t();return r.done&&(this.#e=!0),r}catch(r){throw this.#e=!0,r}finally{this.#e&&!this.#t&&(this.#t=!0,await this.#n("next"))}})}next(){return this.#r()}async return(t){return this.#e=!0,this.#t||(this.#t=!0,await this.#n("return")),{done:!0,value:t}}async throw(t){throw this.#e=!0,this.#t||(this.#t=!0,await this.#n("throw")),t}async[fP](){this.#e=!0,this.#t||(this.#t=!0,await this.#n("dispose"))}[Symbol.asyncIterator](){return this}}function ZE({name:e,...t},n){let r;return new rb(async()=>{r??=nb(e);try{const a=await as(r,()=>n.next());return r?.addEvent(a.done?"completed":"yielded"),a}catch(a){throw Ea(r,a,t),a}},async a=>{try{a!=="next"&&await as(r,()=>n.return?.())}catch(s){throw Ea(r,s,t),s}finally{r?.end()}})}function mP(e){return async(t,...n)=>{try{return await t.next()}catch(r){throw await e(r,t,...n),r}}}function ud(e,t,n){const r=(a,s)=>{const i=e[s];return i?i({...a,next:(o=a)=>r(o,s+1)}):n(a)};return r(t,0)}function Wo(e){if(e)return JSON.parse(e)}function cd(e){return JSON.stringify(e)}function hP(e){return xa(e)?Object.getPrototypeOf(e)?.constructor:null}function Zr(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||!t||!t.constructor}function xa(e){return!!e&&(typeof e=="object"||typeof e=="function")}function KE(e,t){let n=e;for(const r of t){if(!xa(n))return;n=n[r]}return n}const jS=(()=>{const e=function(){};return e.prototype=Object.create(null),Object.freeze(e.prototype),e})();function XE(e,...t){return typeof e=="function"?e(...t):e}function BS(e){return new Proxy(e,{get(t,n,r){const a=Reflect.get(t,n,r);return n!=="then"||typeof a!="function"?a:new Proxy(a,{apply(s,i,o){if(o.length!==2||o.some(c=>!bP(c)))return Reflect.apply(s,i,o);let u=!0;o[0].call(i,BS(new Proxy(t,{get:(c,p,d)=>{if(u&&p==="then"){u=!1;return}return Reflect.get(c,p,d)}})))}})}})}const gP=/^\s*function\s*\(\)\s*\{\s*\[native code\]\s*\}\s*$/;function bP(e){return typeof e=="function"&&gP.test(e.toString())}function EP(e){try{return decodeURIComponent(e)}catch{return e}}const xP="@orpc/client",yP="1.14.4",ab={BAD_REQUEST:{status:400,message:"Bad Request"},UNAUTHORIZED:{status:401,message:"Unauthorized"},FORBIDDEN:{status:403,message:"Forbidden"},NOT_FOUND:{status:404,message:"Not Found"},METHOD_NOT_SUPPORTED:{status:405,message:"Method Not Supported"},NOT_ACCEPTABLE:{status:406,message:"Not Acceptable"},TIMEOUT:{status:408,message:"Request Timeout"},CONFLICT:{status:409,message:"Conflict"},PRECONDITION_FAILED:{status:412,message:"Precondition Failed"},PAYLOAD_TOO_LARGE:{status:413,message:"Payload Too Large"},UNSUPPORTED_MEDIA_TYPE:{status:415,message:"Unsupported Media Type"},UNPROCESSABLE_CONTENT:{status:422,message:"Unprocessable Content"},TOO_MANY_REQUESTS:{status:429,message:"Too Many Requests"},CLIENT_CLOSED_REQUEST:{status:499,message:"Client Closed Request"},INTERNAL_SERVER_ERROR:{status:500,message:"Internal Server Error"},NOT_IMPLEMENTED:{status:501,message:"Not Implemented"},BAD_GATEWAY:{status:502,message:"Bad Gateway"},SERVICE_UNAVAILABLE:{status:503,message:"Service Unavailable"},GATEWAY_TIMEOUT:{status:504,message:"Gateway Timeout"}};function TP(e,t){return t??ab[e]?.status??500}function SP(e,t){return t||ab[e]?.message||e}const US=Symbol.for(`__${xP}@${yP}/error/ORPC_ERROR_CONSTRUCTORS__`);globalThis[US]??=new WeakSet;const dd=globalThis[US];class vi extends Error{defined;code;status;data;constructor(t,...n){const r=rP(n);if(r.status!==void 0&&!wi(r.status))throw new Error("[ORPCError] Invalid error status code.");const a=SP(t,r.message);super(a,r),this.code=t,this.status=TP(t,r.status),this.defined=r.defined??!1,this.data=r.data}toJSON(){return{defined:this.defined,code:this.code,status:this.status,message:this.message,data:this.data}}static[Symbol.hasInstance](t){if(dd.has(this)){const n=hP(t);if(n&&dd.has(n))return!0}return super[Symbol.hasInstance](t)}}dd.add(vi);function vP(e){return e instanceof vi?e:new vi("INTERNAL_SERVER_ERROR",{message:"Internal server error",cause:e})}function wi(e){return e<200||e>=400}function $S(e){if(!Zr(e))return!1;const t=["defined","code","status","message","data"];return Object.keys(e).some(n=>!t.includes(n))?!1:"defined"in e&&typeof e.defined=="boolean"&&"code"in e&&typeof e.code=="string"&&"status"in e&&typeof e.status=="number"&&wi(e.status)&&"message"in e&&typeof e.message=="string"}function zS(e,t={}){return new vi(e.code,{...t,...e})}class hu extends TypeError{}class wP extends TypeError{}class Ai extends Error{data;constructor(t){super(t?.message??"An error event was received",t),this.data=t?.data}}function AP(e){const t=e.replace(/\n+$/,"").split(/\n/),n={data:void 0,event:void 0,id:void 0,retry:void 0,comments:[]};for(const r of t){const a=r.indexOf(":"),s=a===-1?r:r.slice(0,a),i=a===-1?"":r.slice(a+1).replace(/^\s/,"");if(a===0)n.comments.push(i);else if(s==="data")n.data??="",n.data+=`${i}
|
|
92
92
|
`;else if(s==="event")n.event=i;else if(s==="id")n.id=i;else if(s==="retry"){const o=Number.parseInt(i);Number.isInteger(o)&&o>=0&&o.toString()===i&&(n.retry=o)}}return n.data=n.data?.replace(/\n$/,""),n}class NP{constructor(t={}){this.options=t}incomplete="";feed(t){this.incomplete+=t;const n=this.incomplete.lastIndexOf(`
|
|
93
93
|
|
|
94
94
|
`);if(n===-1)return;const r=this.incomplete.slice(0,n).split(/\n\n/);this.incomplete=this.incomplete.slice(n+2);for(const a of r){const s=AP(`${a}
|
|
@@ -165,14 +165,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
165
165
|
|
|
166
166
|
`)}m.write("payload.value = newResult;"),m.write("return payload;");const S=m.compile();return(w,A)=>S(f,w,A)};let s;const i=Ni,o=!ib.jitless,c=o&&ej.value,p=t.catchall;let d;e._zod.parse=(f,m)=>{d??(d=r.value);const b=f.value;return i(b)?o&&c&&m?.async===!1&&m.jitless!==!0?(s||(s=a(t.shape)),f=s(f,m),p?hv([],b,f,m,d,e):f):n(f,m):(f.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),f)}});function ix(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const a=e.filter(s=>!Va(s));return a.length===1?(t.value=a[0].value,a[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(i=>Dr(i,r,Rr())))}),t)}const gv=re("$ZodUnion",(e,t)=>{Vt.init(e,t),It(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),It(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),It(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),It(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){const r=t.options.map(a=>a._zod.pattern);return new RegExp(`^(${r.map(a=>lb(a.source)).join("|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,a)=>{if(n)return n(r,a);let s=!1;const i=[];for(const o of t.options){const u=o._zod.run({value:r.value,issues:[]},a);if(u instanceof Promise)i.push(u),s=!0;else{if(u.issues.length===0)return u;i.push(u)}}return s?Promise.all(i).then(o=>ix(o,r,e,a)):ix(i,r,e,a)}}),z8=re("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,gv.init(e,t);const n=e._zod.parse;It(e._zod,"propValues",()=>{const a={};for(const s of t.options){const i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[o,u]of Object.entries(i)){a[o]||(a[o]=new Set);for(const c of u)a[o].add(c)}}return a});const r=gu(()=>{const a=t.options,s=new Map;for(const i of a){const o=i._zod.propValues?.[t.discriminator];if(!o||o.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const u of o){if(s.has(u))throw new Error(`Duplicate discriminator value "${String(u)}"`);s.set(u,i)}}return s});e._zod.parse=(a,s)=>{const i=a.value;if(!Ni(i))return a.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),a;const o=r.value.get(i?.[t.discriminator]);return o?o._zod.run(a,s):t.unionFallback||s.direction==="backward"?n(a,s):(a.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()),input:i,path:[t.discriminator],inst:e}),a)}}),H8=re("$ZodIntersection",(e,t)=>{Vt.init(e,t),e._zod.parse=(n,r)=>{const a=n.value,s=t.left._zod.run({value:a,issues:[]},r),i=t.right._zod.run({value:a,issues:[]},r);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([u,c])=>ox(n,u,c)):ox(n,s,i)}});function md(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ss(e)&&ss(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),a={...e,...t};for(const s of r){const i=md(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};a[s]=i.data}return{valid:!0,data:a}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const a=e[r],s=t[r],i=md(a,s);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function ox(e,t,n){const r=new Map;let a;for(const o of t.issues)if(o.code==="unrecognized_keys"){a??(a=o);for(const u of o.keys)r.has(u)||r.set(u,{}),r.get(u).l=!0}else e.issues.push(o);for(const o of n.issues)if(o.code==="unrecognized_keys")for(const u of o.keys)r.has(u)||r.set(u,{}),r.get(u).r=!0;else e.issues.push(o);const s=[...r].filter(([,o])=>o.l&&o.r).map(([o])=>o);if(s.length&&a&&e.issues.push({...a,keys:s}),Va(e))return e;const i=md(t.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const G8=re("$ZodRecord",(e,t)=>{Vt.init(e,t),e._zod.parse=(n,r)=>{const a=n.value;if(!ss(a))return n.issues.push({expected:"record",code:"invalid_type",input:a,inst:e}),n;const s=[],i=t.keyType._zod.values;if(i){n.value={};const o=new Set;for(const c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){o.add(typeof c=="number"?c.toString():c);const p=t.keyType._zod.run({value:c,issues:[]},r);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(p.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map(m=>Dr(m,r,Rr())),input:c,path:[c],inst:e});continue}const d=p.value,f=t.valueType._zod.run({value:a[c],issues:[]},r);f instanceof Promise?s.push(f.then(m=>{m.issues.length&&n.issues.push(...qa(c,m.issues)),n.value[d]=m.value})):(f.issues.length&&n.issues.push(...qa(c,f.issues)),n.value[d]=f.value)}let u;for(const c in a)o.has(c)||(u=u??[],u.push(c));u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:a,inst:e,keys:u})}else{n.value={};for(const o of Reflect.ownKeys(a)){if(o==="__proto__"||!Object.prototype.propertyIsEnumerable.call(a,o))continue;let u=t.keyType._zod.run({value:o,issues:[]},r);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof o=="string"&&lv.test(o)&&u.issues.length){const d=t.keyType._zod.run({value:Number(o),issues:[]},r);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(u=d)}if(u.issues.length){t.mode==="loose"?n.value[o]=a[o]:n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(d=>Dr(d,r,Rr())),input:o,path:[o],inst:e});continue}const p=t.valueType._zod.run({value:a[o],issues:[]},r);p instanceof Promise?s.push(p.then(d=>{d.issues.length&&n.issues.push(...qa(o,d.issues)),n.value[u.value]=d.value})):(p.issues.length&&n.issues.push(...qa(o,p.issues)),n.value[u.value]=p.value)}}return s.length?Promise.all(s).then(()=>n):n}}),W8=re("$ZodEnum",(e,t)=>{Vt.init(e,t);const n=JS(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(a=>tj.has(typeof a)).map(a=>typeof a=="string"?is(a):a.toString()).join("|")})$`),e._zod.parse=(a,s)=>{const i=a.value;return r.has(i)||a.issues.push({code:"invalid_value",values:n,input:i,inst:e}),a}}),V8=re("$ZodLiteral",(e,t)=>{if(Vt.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?is(r):r?is(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,a)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),q8=re("$ZodTransform",(e,t)=>{Vt.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new QS(e.constructor.name);const a=t.transform(n.value,n);if(r.async)return(a instanceof Promise?a:Promise.resolve(a)).then(i=>(n.value=i,n.fallback=!0,n));if(a instanceof Promise)throw new Qa;return n.value=a,n.fallback=!0,n}});function lx(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const bv=re("$ZodOptional",(e,t)=>{Vt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",It(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),It(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${lb(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const a=n.value,s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(i=>lx(i,a)):lx(s,a)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Y8=re("$ZodExactOptional",(e,t)=>{bv.init(e,t),It(e._zod,"values",()=>t.innerType._zod.values),It(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Z8=re("$ZodNullable",(e,t)=>{Vt.init(e,t),It(e._zod,"optin",()=>t.innerType._zod.optin),It(e._zod,"optout",()=>t.innerType._zod.optout),It(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${lb(n.source)}|null)$`):void 0}),It(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),K8=re("$ZodDefault",(e,t)=>{Vt.init(e,t),e._zod.optin="optional",It(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(s=>ux(s,t)):ux(a,t)}});function ux(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const X8=re("$ZodPrefault",(e,t)=>{Vt.init(e,t),e._zod.optin="optional",It(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),Q8=re("$ZodNonOptional",(e,t)=>{Vt.init(e,t),It(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(s=>cx(s,e)):cx(a,e)}});function cx(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const J8=re("$ZodCatch",(e,t)=>{Vt.init(e,t),e._zod.optin="optional",It(e._zod,"optout",()=>t.innerType._zod.optout),It(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(i=>Dr(i,r,Rr()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=a.value,a.issues.length&&(n.value=t.catchValue({...n,error:{issues:a.issues.map(s=>Dr(s,r,Rr()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),Ev=re("$ZodPipe",(e,t)=>{Vt.init(e,t),It(e._zod,"values",()=>t.in._zod.values),It(e._zod,"optin",()=>t.in._zod.optin),It(e._zod,"optout",()=>t.out._zod.optout),It(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(i=>wo(i,t.in,r)):wo(s,t.in,r)}const a=t.in._zod.run(n,r);return a instanceof Promise?a.then(s=>wo(s,t.out,r)):wo(a,t.out,r)}});function wo(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const eB=re("$ZodPreprocess",(e,t)=>{Ev.init(e,t)}),tB=re("$ZodReadonly",(e,t)=>{Vt.init(e,t),It(e._zod,"propValues",()=>t.innerType._zod.propValues),It(e._zod,"values",()=>t.innerType._zod.values),It(e._zod,"optin",()=>t.innerType?._zod?.optin),It(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(dx):dx(a)}});function dx(e){return e.value=Object.freeze(e.value),e}const nB=re("$ZodCustom",(e,t)=>{Hn.init(e,t),Vt.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,a=t.fn(r);if(a instanceof Promise)return a.then(s=>px(s,n,r,e));px(a,n,r,e)}});function px(e,t,n,r){if(!e){const a={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(a.params=r._zod.def.params),t.issues.push(_i(a))}}var fx;class rB{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const a={...r,...this._map.get(t)};return Object.keys(a).length?a:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function aB(){return new rB}(fx=globalThis).__zod_globalRegistry??(fx.__zod_globalRegistry=aB());const Ys=globalThis.__zod_globalRegistry;function sB(e,t){return new e({type:"string",...$e(t)})}function iB(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...$e(t)})}function mx(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...$e(t)})}function oB(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...$e(t)})}function lB(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...$e(t)})}function uB(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...$e(t)})}function cB(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...$e(t)})}function dB(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...$e(t)})}function pB(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...$e(t)})}function fB(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...$e(t)})}function mB(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...$e(t)})}function hB(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...$e(t)})}function gB(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...$e(t)})}function bB(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...$e(t)})}function EB(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...$e(t)})}function xB(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...$e(t)})}function yB(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...$e(t)})}function TB(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...$e(t)})}function SB(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...$e(t)})}function vB(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...$e(t)})}function wB(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...$e(t)})}function AB(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...$e(t)})}function NB(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...$e(t)})}function _B(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...$e(t)})}function CB(e,t){return new e({type:"string",format:"date",check:"string_format",...$e(t)})}function kB(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...$e(t)})}function IB(e,t){return new e({type:"string",format:"duration",check:"string_format",...$e(t)})}function RB(e,t){return new e({type:"number",checks:[],...$e(t)})}function DB(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...$e(t)})}function OB(e,t){return new e({type:"boolean",...$e(t)})}function LB(e){return new e({type:"unknown"})}function FB(e,t){return new e({type:"never",...$e(t)})}function hx(e,t){return new cv({check:"less_than",...$e(t),value:e,inclusive:!1})}function pc(e,t){return new cv({check:"less_than",...$e(t),value:e,inclusive:!0})}function gx(e,t){return new dv({check:"greater_than",...$e(t),value:e,inclusive:!1})}function fc(e,t){return new dv({check:"greater_than",...$e(t),value:e,inclusive:!0})}function bx(e,t){return new Kj({check:"multiple_of",...$e(t),value:e})}function xv(e,t){return new Qj({check:"max_length",...$e(t),maximum:e})}function pl(e,t){return new Jj({check:"min_length",...$e(t),minimum:e})}function yv(e,t){return new e8({check:"length_equals",...$e(t),length:e})}function MB(e,t){return new t8({check:"string_format",format:"regex",...$e(t),pattern:e})}function PB(e){return new n8({check:"string_format",format:"lowercase",...$e(e)})}function jB(e){return new r8({check:"string_format",format:"uppercase",...$e(e)})}function BB(e,t){return new a8({check:"string_format",format:"includes",...$e(t),includes:e})}function UB(e,t){return new s8({check:"string_format",format:"starts_with",...$e(t),prefix:e})}function $B(e,t){return new i8({check:"string_format",format:"ends_with",...$e(t),suffix:e})}function Ss(e){return new o8({check:"overwrite",tx:e})}function zB(e){return Ss(t=>t.normalize(e))}function HB(){return Ss(e=>e.trim())}function GB(){return Ss(e=>e.toLowerCase())}function WB(){return Ss(e=>e.toUpperCase())}function VB(){return Ss(e=>JP(e))}function qB(e,t,n){return new e({type:"array",element:t,...$e(n)})}function YB(e,t,n){return new e({type:"custom",check:"custom",fn:t,...$e(n)})}function ZB(e,t){const n=KB(r=>(r.addIssue=a=>{if(typeof a=="string")r.issues.push(_i(a,r.value,n._zod.def));else{const s=a;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=n),s.continue??(s.continue=!n._zod.def.abort),r.issues.push(_i(s))}},e(r.value,r)),t);return n}function KB(e,t){const n=new Hn({check:"custom",...$e(t)});return n._zod.check=e,n}function Tv(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Ys,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function rn(e,t,n={path:[],schemaPath:[]}){var r;const a=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i);const o=e._zod.toJSONSchema?.();if(o)i.schema=o;else{const p={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,p);else{const f=i.schema,m=t.processors[a.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${a.type}`);m(e,t,f,p)}const d=e._zod.parent;d&&(i.ref||(i.ref=d),rn(d,t,p),t.seen.get(d).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(i.schema,u),t.io==="input"&&On(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((r=i.schema).default??(r.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function Sv(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const i of e.seen.entries()){const o=e.metadataRegistry.get(i[0])?.id;if(o){const u=r.get(o);if(u&&u!==i[0])throw new Error(`Duplicate schema id "${o}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(o,i[0])}}const a=i=>{const o=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const d=e.external.registry.get(i[0])?.id,f=e.external.uri??(b=>b);if(d)return{ref:f(d)};const m=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=m,{defId:m,ref:`${f("__shared")}#/${o}/${m}`}}if(i[1]===n)return{ref:"#"};const c=`#/${o}/`,p=i[1].schema.id??`__schema${e.counter++}`;return{defId:p,ref:c+p}},s=i=>{if(i[1].schema.$ref)return;const o=i[1],{ref:u,defId:c}=a(i);o.def={...o.schema},c&&(o.defId=c);const p=o.schema;for(const d in p)delete p[d];p.$ref=u};if(e.cycles==="throw")for(const i of e.seen.entries()){const o=i[1];if(o.cycle)throw new Error(`Cycle detected: #/${o.cycle?.join("/")}/<root>
|
|
167
167
|
|
|
168
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const o=i[1];if(t===i[0]){s(i);continue}if(e.external){const c=e.external.registry.get(i[0])?.id;if(t!==i[0]&&c){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(o.cycle){s(i);continue}if(o.count>1&&e.reused==="ref"){s(i);continue}}}function vv(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=o=>{const u=e.seen.get(o);if(u.ref===null)return;const c=u.def??u.schema,p={...c},d=u.ref;if(u.ref=null,d){r(d);const m=e.seen.get(d),b=m.schema;if(b.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(b)):Object.assign(c,b),Object.assign(c,p),o._zod.parent===d)for(const x in c)x==="$ref"||x==="allOf"||x in p||delete c[x];if(b.$ref&&m.def)for(const x in c)x==="$ref"||x==="allOf"||x in m.def&&JSON.stringify(c[x])===JSON.stringify(m.def[x])&&delete c[x]}const f=o._zod.parent;if(f&&f!==d){r(f);const m=e.seen.get(f);if(m?.schema.$ref&&(c.$ref=m.schema.$ref,m.def))for(const b in c)b==="$ref"||b==="allOf"||b in m.def&&JSON.stringify(c[b])===JSON.stringify(m.def[b])&&delete c[b]}e.override({zodSchema:o,jsonSchema:c,path:u.path??[]})};for(const o of[...e.seen.entries()].reverse())r(o[0]);const a={};if(e.target==="draft-2020-12"?a.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?a.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?a.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const o=e.external.registry.get(t)?.id;if(!o)throw new Error("Schema is missing an `id` property");a.$id=e.external.uri(o)}Object.assign(a,n.def??n.schema);const s=e.metadataRegistry.get(t)?.id;s!==void 0&&a.id===s&&delete a.id;const i=e.external?.defs??{};for(const o of e.seen.entries()){const u=o[1];u.def&&u.defId&&(u.def.id===u.defId&&delete u.def.id,i[u.defId]=u.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?a.$defs=i:a.definitions=i);try{const o=JSON.parse(JSON.stringify(a));return Object.defineProperty(o,"~standard",{value:{...t["~standard"],jsonSchema:{input:fl(t,"input",e.processors),output:fl(t,"output",e.processors)}},enumerable:!1,writable:!1}),o}catch{throw new Error("Error converting schema to JSON.")}}function On(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return On(r.element,n);if(r.type==="set")return On(r.valueType,n);if(r.type==="lazy")return On(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return On(r.innerType,n);if(r.type==="intersection")return On(r.left,n)||On(r.right,n);if(r.type==="record"||r.type==="map")return On(r.keyType,n)||On(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:On(r.in,n)||On(r.out,n);if(r.type==="object"){for(const a in r.shape)if(On(r.shape[a],n))return!0;return!1}if(r.type==="union"){for(const a of r.options)if(On(a,n))return!0;return!1}if(r.type==="tuple"){for(const a of r.items)if(On(a,n))return!0;return!!(r.rest&&On(r.rest,n))}return!1}const XB=(e,t={})=>n=>{const r=Tv({...n,processors:t});return rn(e,r),Sv(r,e),vv(r,e)},fl=(e,t,n={})=>r=>{const{libraryOptions:a,target:s}=r??{},i=Tv({...a??{},target:s,io:t,processors:n});return rn(e,i),Sv(i,e),vv(i,e)},QB={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},JB=(e,t,n,r)=>{const a=n;a.type="string";const{minimum:s,maximum:i,format:o,patterns:u,contentEncoding:c}=e._zod.bag;if(typeof s=="number"&&(a.minLength=s),typeof i=="number"&&(a.maxLength=i),o&&(a.format=QB[o]??o,a.format===""&&delete a.format,o==="time"&&delete a.format),c&&(a.contentEncoding=c),u&&u.size>0){const p=[...u];p.length===1?a.pattern=p[0].source:p.length>1&&(a.allOf=[...p.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},eU=(e,t,n,r)=>{const a=n,{minimum:s,maximum:i,format:o,multipleOf:u,exclusiveMaximum:c,exclusiveMinimum:p}=e._zod.bag;typeof o=="string"&&o.includes("int")?a.type="integer":a.type="number";const d=typeof p=="number"&&p>=(s??Number.NEGATIVE_INFINITY),f=typeof c=="number"&&c<=(i??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";d?m?(a.minimum=p,a.exclusiveMinimum=!0):a.exclusiveMinimum=p:typeof s=="number"&&(a.minimum=s),f?m?(a.maximum=c,a.exclusiveMaximum=!0):a.exclusiveMaximum=c:typeof i=="number"&&(a.maximum=i),typeof u=="number"&&(a.multipleOf=u)},tU=(e,t,n,r)=>{n.type="boolean"},nU=(e,t,n,r)=>{n.not={}},rU=(e,t,n,r)=>{},aU=(e,t,n,r)=>{const a=e._zod.def,s=JS(a.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},sU=(e,t,n,r)=>{const a=e._zod.def,s=[];for(const i of a.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){const i=s[0];n.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[i]:n.const=i}else s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),s.every(i=>typeof i=="boolean")&&(n.type="boolean"),s.every(i=>i===null)&&(n.type="null"),n.enum=s},iU=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},oU=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},lU=(e,t,n,r)=>{const a=n,s=e._zod.def,{minimum:i,maximum:o}=e._zod.bag;typeof i=="number"&&(a.minItems=i),typeof o=="number"&&(a.maxItems=o),a.type="array",a.items=rn(s.element,t,{...r,path:[...r.path,"items"]})},uU=(e,t,n,r)=>{const a=n,s=e._zod.def;a.type="object",a.properties={};const i=s.shape;for(const c in i)a.properties[c]=rn(i[c],t,{...r,path:[...r.path,"properties",c]});const o=new Set(Object.keys(i)),u=new Set([...o].filter(c=>{const p=s.shape[c]._zod;return t.io==="input"?p.optin===void 0:p.optout===void 0}));u.size>0&&(a.required=Array.from(u)),s.catchall?._zod.def.type==="never"?a.additionalProperties=!1:s.catchall?s.catchall&&(a.additionalProperties=rn(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(a.additionalProperties=!1)},cU=(e,t,n,r)=>{const a=e._zod.def,s=a.inclusive===!1,i=a.options.map((o,u)=>rn(o,t,{...r,path:[...r.path,s?"oneOf":"anyOf",u]}));s?n.oneOf=i:n.anyOf=i},dU=(e,t,n,r)=>{const a=e._zod.def,s=rn(a.left,t,{...r,path:[...r.path,"allOf",0]}),i=rn(a.right,t,{...r,path:[...r.path,"allOf",1]}),o=c=>"allOf"in c&&Object.keys(c).length===1,u=[...o(s)?s.allOf:[s],...o(i)?i.allOf:[i]];n.allOf=u},pU=(e,t,n,r)=>{const a=n,s=e._zod.def;a.type="object";const i=s.keyType,u=i._zod.bag?.patterns;if(s.mode==="loose"&&u&&u.size>0){const p=rn(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});a.patternProperties={};for(const d of u)a.patternProperties[d.source]=p}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(a.propertyNames=rn(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),a.additionalProperties=rn(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const c=i._zod.values;if(c){const p=[...c].filter(d=>typeof d=="string"||typeof d=="number");p.length>0&&(a.required=p)}},fU=(e,t,n,r)=>{const a=e._zod.def,s=rn(a.innerType,t,r),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=a.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},mU=(e,t,n,r)=>{const a=e._zod.def;rn(a.innerType,t,r);const s=t.seen.get(e);s.ref=a.innerType},hU=(e,t,n,r)=>{const a=e._zod.def;rn(a.innerType,t,r);const s=t.seen.get(e);s.ref=a.innerType,n.default=JSON.parse(JSON.stringify(a.defaultValue))},gU=(e,t,n,r)=>{const a=e._zod.def;rn(a.innerType,t,r);const s=t.seen.get(e);s.ref=a.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(a.defaultValue)))},bU=(e,t,n,r)=>{const a=e._zod.def;rn(a.innerType,t,r);const s=t.seen.get(e);s.ref=a.innerType;let i;try{i=a.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},EU=(e,t,n,r)=>{const a=e._zod.def,s=a.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?a.out:a.in:a.out;rn(i,t,r);const o=t.seen.get(e);o.ref=i},xU=(e,t,n,r)=>{const a=e._zod.def;rn(a.innerType,t,r);const s=t.seen.get(e);s.ref=a.innerType,n.readOnly=!0},wv=(e,t,n,r)=>{const a=e._zod.def;rn(a.innerType,t,r);const s=t.seen.get(e);s.ref=a.innerType},yU=re("ZodISODateTime",(e,t)=>{T8.init(e,t),Yt.init(e,t)});function TU(e){return _B(yU,e)}const SU=re("ZodISODate",(e,t)=>{S8.init(e,t),Yt.init(e,t)});function vU(e){return CB(SU,e)}const wU=re("ZodISOTime",(e,t)=>{v8.init(e,t),Yt.init(e,t)});function AU(e){return kB(wU,e)}const NU=re("ZodISODuration",(e,t)=>{w8.init(e,t),Yt.init(e,t)});function _U(e){return IB(NU,e)}const CU=(e,t)=>{rv.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>fj(e,n)},flatten:{value:n=>pj(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,fd,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,fd,2)}},isEmpty:{get(){return e.issues.length===0}}})},ir=re("ZodError",CU,{Parent:Error}),kU=cb(ir),IU=db(ir),RU=bu(ir),DU=Eu(ir),OU=gj(ir),LU=bj(ir),FU=Ej(ir),MU=xj(ir),PU=yj(ir),jU=Tj(ir),BU=Sj(ir),UU=vj(ir),Ex=new WeakMap;function Qi(e,t,n){const r=Object.getPrototypeOf(e);let a=Ex.get(r);if(a||(a=new Set,Ex.set(r,a)),!a.has(t)){a.add(t);for(const s in n){const i=n[s];Object.defineProperty(r,s,{configurable:!0,enumerable:!1,get(){const o=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:o}),o},set(o){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:o})}})}}}const qt=re("ZodType",(e,t)=>(Vt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:fl(e,"input"),output:fl(e,"output")}}),e.toJSONSchema=XB(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,r)=>kU(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>RU(e,n,r),e.parseAsync=async(n,r)=>IU(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>DU(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>OU(e,n,r),e.decode=(n,r)=>LU(e,n,r),e.encodeAsync=async(n,r)=>FU(e,n,r),e.decodeAsync=async(n,r)=>MU(e,n,r),e.safeEncode=(n,r)=>PU(e,n,r),e.safeDecode=(n,r)=>jU(e,n,r),e.safeEncodeAsync=async(n,r)=>BU(e,n,r),e.safeDecodeAsync=async(n,r)=>UU(e,n,r),Qi(e,"ZodType",{check(...n){const r=this.def;return this.clone(ra(r,{checks:[...r.checks??[],...n.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return aa(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(O7(n,r))},superRefine(n,r){return this.check(L7(n,r))},overwrite(n){return this.check(Ss(n))},optional(){return Sx(this)},exactOptional(){return y7(this)},nullable(){return vx(this)},nullish(){return Sx(vx(this))},nonoptional(n){return N7(this,n)},array(){return bt(this)},or(n){return p7([this,n])},and(n){return g7(this,n)},transform(n){return wx(this,Cv(n))},default(n){return v7(this,n)},prefault(n){return A7(this,n)},catch(n){return C7(this,n)},pipe(n){return wx(this,n)},readonly(){return R7(this)},describe(n){const r=this.clone();return Ys.add(r,{description:n}),r},meta(...n){if(n.length===0)return Ys.get(this);const r=this.clone();return Ys.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return Ys.get(e)?.description},configurable:!0}),e)),Av=re("_ZodString",(e,t)=>{pb.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(r,a,s)=>JB(e,r,a);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Qi(e,"_ZodString",{regex(...r){return this.check(MB(...r))},includes(...r){return this.check(BB(...r))},startsWith(...r){return this.check(UB(...r))},endsWith(...r){return this.check($B(...r))},min(...r){return this.check(pl(...r))},max(...r){return this.check(xv(...r))},length(...r){return this.check(yv(...r))},nonempty(...r){return this.check(pl(1,...r))},lowercase(r){return this.check(PB(r))},uppercase(r){return this.check(jB(r))},trim(){return this.check(HB())},normalize(...r){return this.check(zB(...r))},toLowerCase(){return this.check(GB())},toUpperCase(){return this.check(WB())},slugify(){return this.check(VB())}})}),$U=re("ZodString",(e,t)=>{pb.init(e,t),Av.init(e,t),e.email=n=>e.check(iB(zU,n)),e.url=n=>e.check(dB(HU,n)),e.jwt=n=>e.check(NB(a7,n)),e.emoji=n=>e.check(pB(GU,n)),e.guid=n=>e.check(mx(xx,n)),e.uuid=n=>e.check(oB(Ao,n)),e.uuidv4=n=>e.check(lB(Ao,n)),e.uuidv6=n=>e.check(uB(Ao,n)),e.uuidv7=n=>e.check(cB(Ao,n)),e.nanoid=n=>e.check(fB(WU,n)),e.guid=n=>e.check(mx(xx,n)),e.cuid=n=>e.check(mB(VU,n)),e.cuid2=n=>e.check(hB(qU,n)),e.ulid=n=>e.check(gB(YU,n)),e.base64=n=>e.check(vB(t7,n)),e.base64url=n=>e.check(wB(n7,n)),e.xid=n=>e.check(bB(ZU,n)),e.ksuid=n=>e.check(EB(KU,n)),e.ipv4=n=>e.check(xB(XU,n)),e.ipv6=n=>e.check(yB(QU,n)),e.cidrv4=n=>e.check(TB(JU,n)),e.cidrv6=n=>e.check(SB(e7,n)),e.e164=n=>e.check(AB(r7,n)),e.datetime=n=>e.check(TU(n)),e.date=n=>e.check(vU(n)),e.time=n=>e.check(AU(n)),e.duration=n=>e.check(_U(n))});function V(e){return sB($U,e)}const Yt=re("ZodStringFormat",(e,t)=>{zt.init(e,t),Av.init(e,t)}),zU=re("ZodEmail",(e,t)=>{p8.init(e,t),Yt.init(e,t)}),xx=re("ZodGUID",(e,t)=>{c8.init(e,t),Yt.init(e,t)}),Ao=re("ZodUUID",(e,t)=>{d8.init(e,t),Yt.init(e,t)}),HU=re("ZodURL",(e,t)=>{f8.init(e,t),Yt.init(e,t)}),GU=re("ZodEmoji",(e,t)=>{m8.init(e,t),Yt.init(e,t)}),WU=re("ZodNanoID",(e,t)=>{h8.init(e,t),Yt.init(e,t)}),VU=re("ZodCUID",(e,t)=>{g8.init(e,t),Yt.init(e,t)}),qU=re("ZodCUID2",(e,t)=>{b8.init(e,t),Yt.init(e,t)}),YU=re("ZodULID",(e,t)=>{E8.init(e,t),Yt.init(e,t)}),ZU=re("ZodXID",(e,t)=>{x8.init(e,t),Yt.init(e,t)}),KU=re("ZodKSUID",(e,t)=>{y8.init(e,t),Yt.init(e,t)}),XU=re("ZodIPv4",(e,t)=>{A8.init(e,t),Yt.init(e,t)}),QU=re("ZodIPv6",(e,t)=>{N8.init(e,t),Yt.init(e,t)}),JU=re("ZodCIDRv4",(e,t)=>{_8.init(e,t),Yt.init(e,t)}),e7=re("ZodCIDRv6",(e,t)=>{C8.init(e,t),Yt.init(e,t)}),t7=re("ZodBase64",(e,t)=>{k8.init(e,t),Yt.init(e,t)}),n7=re("ZodBase64URL",(e,t)=>{R8.init(e,t),Yt.init(e,t)}),r7=re("ZodE164",(e,t)=>{D8.init(e,t),Yt.init(e,t)}),a7=re("ZodJWT",(e,t)=>{L8.init(e,t),Yt.init(e,t)}),Nv=re("ZodNumber",(e,t)=>{fv.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(r,a,s)=>eU(e,r,a),Qi(e,"ZodNumber",{gt(r,a){return this.check(gx(r,a))},gte(r,a){return this.check(fc(r,a))},min(r,a){return this.check(fc(r,a))},lt(r,a){return this.check(hx(r,a))},lte(r,a){return this.check(pc(r,a))},max(r,a){return this.check(pc(r,a))},int(r){return this.check(yx(r))},safe(r){return this.check(yx(r))},positive(r){return this.check(gx(0,r))},nonnegative(r){return this.check(fc(0,r))},negative(r){return this.check(hx(0,r))},nonpositive(r){return this.check(pc(0,r))},multipleOf(r,a){return this.check(bx(r,a))},step(r,a){return this.check(bx(r,a))},finite(){return this}});const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function xe(e){return RB(Nv,e)}const s7=re("ZodNumberFormat",(e,t)=>{F8.init(e,t),Nv.init(e,t)});function yx(e){return DB(s7,e)}const i7=re("ZodBoolean",(e,t)=>{M8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>tU(e,n,r)});function Jr(e){return OB(i7,e)}const o7=re("ZodUnknown",(e,t)=>{P8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>rU()});function os(){return LB(o7)}const l7=re("ZodNever",(e,t)=>{j8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>nU(e,n,r)});function u7(e){return FB(l7,e)}const c7=re("ZodArray",(e,t)=>{B8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>lU(e,n,r,a),e.element=t.element,Qi(e,"ZodArray",{min(n,r){return this.check(pl(n,r))},nonempty(n){return this.check(pl(1,n))},max(n,r){return this.check(xv(n,r))},length(n,r){return this.check(yv(n,r))},unwrap(){return this.element}})});function bt(e,t){return qB(c7,e,t)}const d7=re("ZodObject",(e,t)=>{$8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>uU(e,n,r,a),It(e,"shape",()=>t.shape),Qi(e,"ZodObject",{keyof(){return tt(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:os()})},loose(){return this.clone({...this._zod.def,catchall:os()})},strict(){return this.clone({...this._zod.def,catchall:u7()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return ij(this,n)},safeExtend(n){return oj(this,n)},merge(n){return lj(this,n)},pick(n){return aj(this,n)},omit(n){return sj(this,n)},partial(...n){return uj(kv,this,n[0])},required(...n){return cj(Iv,this,n[0])}})});function Ae(e,t){const n={type:"object",shape:e??{},...$e(t)};return new d7(n)}const _v=re("ZodUnion",(e,t)=>{gv.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>cU(e,n,r,a),e.options=t.options});function p7(e,t){return new _v({type:"union",options:e,...$e(t)})}const f7=re("ZodDiscriminatedUnion",(e,t)=>{_v.init(e,t),z8.init(e,t)});function m7(e,t,n){return new f7({type:"union",options:t,discriminator:e,...$e(n)})}const h7=re("ZodIntersection",(e,t)=>{H8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>dU(e,n,r,a)});function g7(e,t){return new h7({type:"intersection",left:e,right:t})}const Tx=re("ZodRecord",(e,t)=>{G8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>pU(e,n,r,a),e.keyType=t.keyType,e.valueType=t.valueType});function yu(e,t,n){return!t||!t._zod?new Tx({type:"record",keyType:V(),valueType:e,...$e(t)}):new Tx({type:"record",keyType:e,valueType:t,...$e(n)})}const hd=re("ZodEnum",(e,t)=>{W8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(r,a,s)=>aU(e,r,a),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,a)=>{const s={};for(const i of r)if(n.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new hd({...t,checks:[],...$e(a),entries:s})},e.exclude=(r,a)=>{const s={...t.entries};for(const i of r)if(n.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new hd({...t,checks:[],...$e(a),entries:s})}});function tt(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new hd({type:"enum",entries:n,...$e(t)})}const b7=re("ZodLiteral",(e,t)=>{V8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>sU(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ur(e,t){return new b7({type:"literal",values:Array.isArray(e)?e:[e],...$e(t)})}const E7=re("ZodTransform",(e,t)=>{q8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>oU(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new QS(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(_i(s,n.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),n.issues.push(_i(i))}};const a=t.transform(n.value,n);return a instanceof Promise?a.then(s=>(n.value=s,n.fallback=!0,n)):(n.value=a,n.fallback=!0,n)}});function Cv(e){return new E7({type:"transform",transform:e})}const kv=re("ZodOptional",(e,t)=>{bv.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>wv(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function Sx(e){return new kv({type:"optional",innerType:e})}const x7=re("ZodExactOptional",(e,t)=>{Y8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>wv(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function y7(e){return new x7({type:"optional",innerType:e})}const T7=re("ZodNullable",(e,t)=>{Z8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>fU(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function vx(e){return new T7({type:"nullable",innerType:e})}const S7=re("ZodDefault",(e,t)=>{K8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>hU(e,n,r,a),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function v7(e,t){return new S7({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():tv(t)}})}const w7=re("ZodPrefault",(e,t)=>{X8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>gU(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function A7(e,t){return new w7({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():tv(t)}})}const Iv=re("ZodNonOptional",(e,t)=>{Q8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>mU(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function N7(e,t){return new Iv({type:"nonoptional",innerType:e,...$e(t)})}const _7=re("ZodCatch",(e,t)=>{J8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>bU(e,n,r,a),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function C7(e,t){return new _7({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Rv=re("ZodPipe",(e,t)=>{Ev.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>EU(e,n,r,a),e.in=t.in,e.out=t.out});function wx(e,t){return new Rv({type:"pipe",in:e,out:t})}const k7=re("ZodPreprocess",(e,t)=>{Rv.init(e,t),eB.init(e,t)}),I7=re("ZodReadonly",(e,t)=>{tB.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>xU(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function R7(e){return new I7({type:"readonly",innerType:e})}const D7=re("ZodCustom",(e,t)=>{nB.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>iU(e,n)});function O7(e,t={}){return YB(D7,e,t)}function L7(e,t){return ZB(e,t)}function mc(e,t){return new k7({type:"pipe",in:Cv(e),out:t})}const rr=["backlog","todo","wip","testing","blocked","done","cancelled"],vs=["backlog","active","verifying","blocked","done","cancelled"],F7={backlog:"📋",todo:"🔲",wip:"🚧",testing:"🧪",blocked:"🚫",done:"✅",cancelled:"⛔"};function fb(e){try{return F7[Ov(e)]??""}catch{return""}}const Tu=["P0","P1","P2","P3"],M7=["simple","standard","complex","research","refine","plan","unit","review","docs"],Dv=["task","issue","review","meta","brainstorm"],Su=["standard","feature-impl","issue","review","meta","brainstorm"],mb=/^[A-Z][1-9]*$/,P7={completed:"done",complete:"done","in-progress":"wip","in progress":"wip",in_progress:"wip",dropped:"cancelled",cancel:"cancelled",canceled:"cancelled",new:"backlog",pending:"backlog",blocked:"blocked",wip:"wip",testing:"testing",done:"done",cancelled:"cancelled",backlog:"backlog",todo:"todo"};function Ov(e){const t=e.trim().toLowerCase(),n=P7[t];if(n===void 0)throw new Error(`Unknown task status: ${JSON.stringify(e)} (allowed: ${rr.join(", ")})`);return n}const ml=V().min(1).refine(e=>!Number.isNaN(Date.parse(e)),{message:"must be an ISO 8601 timestamp"}),Lv=V().regex(mb,{message:"feature id must match ^[A-Z][1-9]*$ (DD-14)"}).nullable().optional(),Fv=V().regex(/^\d{4}$/,{message:"parent_wbs must be a 4-digit WBS string"}).nullable().optional();Ae({schema_version:ur(1),name:V().min(1),description:V().optional(),status:mc(e=>{if(typeof e=="string")try{return Ov(e)}catch{}return e},tt(rr)),type:tt(Dv).optional().default("task"),template:tt(Su).optional(),profile:tt(M7).optional(),feature_id:Lv,parent_wbs:Fv,priority:tt(Tu).optional(),tags:bt(V()).optional(),dependencies:bt(V()).optional(),ac_numbering:ur("task-local").optional(),ac_altitude:tt(["graduating","task-local"]).optional(),done_forced:mc(e=>typeof e=="string"?e==="true":e,Jr().optional()),done_reason:V().optional(),feature_link_declined:mc(e=>typeof e=="string"?e==="true":e,Jr().optional()),created_at:ml,updated_at:ml});Ae({schema_version:ur(1),id:V().regex(mb,{message:"feature id must match ^[A-Z][1-9]*$ (DD-14)"}),name:V().min(1),status:tt(vs),priority:tt(Tu).optional(),tags:bt(V()).optional(),created_at:ml,updated_at:ml});const j7=Ae({name:V().min(1,"name is required"),background:V().optional(),requirements:V().optional(),design:V().optional(),plan:V().optional(),acceptance_criteria:V().optional(),feature_id:Lv,parent_wbs:Fv,priority:tt(Tu).optional(),tags:bt(V()).optional(),template:tt(Su).optional()}).strict();bt(j7).min(1,"batch must contain at least one task");const B7=["NOT_FOUND","VALIDATION_FAILED","GUARD_DENIED","LOCK_TIMEOUT","CONFLICT","INTERNAL_ERROR"];function Bt(e){return Ae({ok:ur(!0),data:e})}Ae({ok:ur(!1),error:Ae({code:tt(B7),message:V(),details:os().optional()})});Ae({nextCursor:V().optional(),hasMore:Jr(),limit:xe().int().positive()});const qn=V().regex(mb,{message:"feature id must match ^[A-Z][1-9]*$ (DD-14)"}),U7=Ae({id:qn,name:V().min(1),status:tt(vs),priority:tt(Tu).optional(),parentId:qn.nullable().optional(),wbsCount:xe().int().nonnegative().optional()}),$7=Bt(bt(U7)),z7=Bt(Ae({id:qn,name:V(),status:tt(vs),frontmatter:yu(V(),os()),content:V(),filePath:V()})),H7=Ae({id:qn}),G7=Ae({name:V().min(1),parentId:qn.optional()}),W7=Bt(Ae({id:V(),filePath:V()})),V7=Ae({id:qn,toStatus:tt(vs),actor:V().optional()}),q7=Bt(Ae({id:V(),status:tt(vs)})),Y7=Ae({id:qn,body:V(),actor:V().optional()}),Z7=Bt(Ae({})),K7=tt(["brainstorm","plan"]),X7=tt(["claude","codex","gemini","pi","opencode","antigravity","openclaw"]),Q7=Ae({id:qn,action:K7,channel:X7.optional(),skipDeps:Jr().optional()}),J7=Ae({runId:V(),action:V(),status:ur("queued")}),e9=Bt(J7),t9=Ae({id:qn,name:V().min(1)}),n9=Bt(Ae({id:V(),filePath:V()})),r9=Ae({id:qn,title:V().min(1)}),a9=Bt(Ae({wbs:V(),filePath:V()})),s9=Ae({id:qn,wbs:V().regex(/^\d{4}$/)}),i9=Bt(Ae({})),Mv=tt(["pull","push"]),o9=Ae({id:qn,direction:Mv}),l9=Bt(Ae({direction:Mv,affectedTasks:xe().int().nonnegative(),applied:Jr(),newStatus:V().optional()})),u9={list:Mt.route({method:"GET",path:"/features",summary:"List features",tags:["feature"]}).output($7),show:Mt.route({method:"GET",path:"/features/{id}",summary:"Show feature detail",tags:["feature"]}).input(H7).output(z7),create:Mt.route({method:"POST",path:"/features",summary:"Create a feature",tags:["feature"]}).input(G7).output(W7),transition:Mt.route({method:"PATCH",path:"/features/{id}/status",summary:"Transition feature status",tags:["feature"]}).input(V7).output(q7),refresh:Mt.route({method:"POST",path:"/features/refresh",summary:"Refresh feature index and kanban",tags:["feature"]}).output(Bt(Ae({rebuilt:xe().int().nonnegative()}))),check:Mt.route({method:"POST",path:"/features/{id}/check",summary:"Run the four-layer feature check",tags:["feature"]}).input(Ae({id:qn})).output(Bt(Ae({id:V(),status:V(),pass:Jr(),findings:bt(Ae({layer:tt(["L1","L2","L3","L4"]),severity:tt(["error","warning","info"]),section:V(),message:V()})),requiredSections:bt(V()),missingSections:bt(V())}))),body:Mt.route({method:"PATCH",path:"/features/{id}/body",summary:"Update feature body",tags:["feature"]}).input(Y7).output(Z7),action:Mt.route({method:"POST",path:"/features/{id}/action",summary:"Run a feature workflow action",tags:["feature"]}).input(Q7).output(e9),children:Mt.route({method:"POST",path:"/features/{id}/children",summary:"Create a child feature",tags:["feature"]}).input(t9).output(n9),tasks:Mt.route({method:"POST",path:"/features/{id}/tasks",summary:"Create a task linked to feature",tags:["feature"]}).input(r9).output(a9),link:Mt.route({method:"PATCH",path:"/features/{id}/link",summary:"Link an existing task to feature",tags:["feature"]}).input(s9).output(i9),sync:Mt.route({method:"POST",path:"/features/{id}/sync",summary:"Sync feature status with linked tasks",tags:["feature"]}).input(o9).output(l9)},c9=tt(["24h","7d","30d","all","custom"]),d9=tt(["auto","5m","10m","30m","1h","4h","1d"]),p9=tt(["model","source","tool","skill"]),hl=Ae({range:c9.default("30d"),from:V().datetime().optional(),to:V().datetime().optional(),sources:bt(V()).optional(),models:bt(V()).optional(),tools:bt(V()).optional(),skills:bt(V()).optional(),bucket:d9.default("auto"),dimension:p9.default("model")}),Pv=Ae({billedTokens:xe(),cacheSavedTokens:xe(),cacheReadTokens:xe(),freshInputTokens:xe(),outputTokens:xe()}),Ax=Ae({totalBilledTokens:xe(),cacheSavedTokens:xe(),cacheSavedPercent:xe(),sessionsCount:xe(),toolCallsCount:xe(),errorRate:xe()}),f9=Ae({day:V(),totalBilledTokens:xe(),cacheSavedTokens:xe(),sessionsCount:xe(),toolCallsCount:xe(),cacheHitRatio:xe()}),Nx=Ae({bucketStart:V(),cacheHitRatio:xe(),series:yu(V(),xe())}),_x=Ae({id:V(),label:V(),color:V(),tokens:xe(),share:xe()}),m9=Ae({id:V(),count:xe(),errors:xe(),errorRate:xe()}),h9=Ae({id:V(),label:V(),color:V(),count:xe()}),g9=Ae({hitRatio:xe(),savedTokens:xe(),totalRead:xe()}),b9=Ae({kpis:Ax,timeSeries:bt(Nx),topModels:bt(_x),topSources:bt(_x),topTools:bt(m9),skillsUsed:bt(h9),cacheEfficiency:g9,kpiTrend:bt(f9),previousKpis:Ax.nullable(),skillTimeSeries:bt(Nx)}),E9=Bt(b9),x9=tt(["read","write","bash","search","run","user","assistant","unknown"]),y9=tt(["measured","inferred","unmeasured"]),T9=tt(["exact","estimated"]),S9=m7("mode",[Ae({mode:ur("session"),source:V().min(1),sessionId:V().min(1)}),Ae({mode:ur("consolidated"),filter:hl.optional(),taskWbs:V().optional(),runId:V().optional()})]),v9=Ae({seq:xe(),eventType:tt(["message","tool"]),kind:x9,title:V(),toolName:V().nullable(),durationMs:xe().nullable(),durationSource:y9,tokens:xe(),freshInputTokens:xe(),cacheReadTokens:xe(),outputTokens:xe(),promptTokens:Pv.nullable(),exitCode:xe().nullable(),payload:V().nullable(),agent:V(),model:V()}),w9=Ae({key:V(),sessionId:V(),turnIndex:xe(),timestamp:V().nullable(),source:V(),model:V(),correlationExactness:T9.nullable(),totalDurationMs:xe(),totalTokens:xe(),operationCount:xe(),events:bt(v9)}),A9=Ae({sessionId:V().nullable(),source:V().nullable(),model:V().nullable(),start:V().nullable(),end:V().nullable(),durationMs:xe(),tokens:Pv,messageCount:xe(),toolCallCount:xe(),sessionCount:xe()}),N9=Ae({mode:tt(["session","consolidated"]),scope:A9,truncated:Jr(),blocks:bt(w9)}),_9=Bt(N9),C9=Ae({id:V(),source:V(),model:V(),modelDetail:V().optional(),start:V(),durationMs:xe(),messages:xe(),toolCalls:xe(),billedTokens:xe(),cacheReadTokens:xe(),freshInputTokens:xe(),outputTokens:xe(),topTool:V(),state:V()}),k9=Ae({items:bt(C9),total:xe(),page:xe(),pageSize:xe()}),I9=Bt(k9),R9=Ae({filter:hl.optional(),page:xe().int().min(1).default(1),pageSize:xe().int().min(1).max(100).default(20),sortBy:tt(["start","duration","messages","toolCalls","billedTokens","cacheRead","freshInput"]).default("start"),sortDir:tt(["asc","desc"]).default("desc")}),D9=Ae({tool:V(),argsHint:V(),sessionId:V(),repeats:xe(),fromSeq:xe(),toSeq:xe(),wastedTokens:xe()}),O9=Ae({sessionId:V(),timestamp:V(),freshTokens:xe(),reason:V()}),L9=Ae({id:V(),source:V(),model:V(),tokens:xe(),durationMs:xe()}),Cx=Ae({stepIndex:xe(),sessionId:V(),toolName:V(),tokens:xe(),durationMs:xe().optional(),agent:V(),model:V()}),F9=Ae({model:V(),speedMsMean:xe(),cacheRatio:xe(),reliability:xe(),outputRatio:xe()}),M9=Ae({loops:bt(D9),cacheWaste:bt(O9),heavySessions:bt(L9),largestTokenSteps:bt(Cx),slowSteps:bt(Cx),modelComparison:bt(F9)}),P9=Bt(M9),j9=Ae({date:V(),tokens:xe(),sessions:xe()}),B9=Ae({id:V(),name:V(),color:V(),importPath:V(),filePattern:V(),filesCount:xe(),sizeMb:xe().nullable(),sessionCount:xe(),totalTokens:xe(),cacheSavedTokens:xe(),freshTokens:xe(),toolCalls:xe(),firstDate:V().nullable(),lastDate:V().nullable(),heatmapDays:bt(j9),maxDailyTokens:xe()}),U9=Ae({agentId:V(),agentName:V(),path:V(),matchPattern:V(),fileCount:xe(),status:tt(["active","empty","missing"])}),$9=Ae({totalFiles:xe(),corpusSizeBytes:xe(),dateCoverage:Ae({from:V().nullable(),to:V().nullable()}),totalSessions:xe(),lastImportedAt:V().nullable()}),z9=Ae({overview:$9,agents:bt(B9),roots:bt(U9)}),H9=Bt(z9),G9=Ae({mode:tt(["full","incremental"]).default("incremental")}),W9=Ae({runId:V(),status:V(),message:V()}),V9=Bt(W9),q9={getSummary:Mt.route({method:"POST",path:"/history/summary",summary:"Get conversation history analytics summary",tags:["history"]}).input(hl.optional()).output(E9),getTimeline:Mt.route({method:"POST",path:"/history/timeline",summary:"Get chronological session or consolidated execution timeline",tags:["history"]}).input(S9).output(_9),getSessions:Mt.route({method:"POST",path:"/history/sessions",summary:"List and filter conversation sessions",tags:["history"]}).input(R9).output(I9),getInsights:Mt.route({method:"POST",path:"/history/insights",summary:"Get conversation forensic insights and loops",tags:["history"]}).input(hl.optional()).output(P9),getSources:Mt.route({method:"GET",path:"/history/sources",summary:"Get all-time agent sources overview and heatmaps",tags:["history"]}).output(H9),triggerImport:Mt.route({method:"POST",path:"/history/import",summary:"Trigger history transcript import and analysis",tags:["history"]}).input(G9).output(V9)},Y9=Bt(Ae({eventName:V(),occurredAt:V().datetime(),actor:V().nullable().optional(),payload:yu(V(),os())})),Z9={stream:Mt.route({method:"GET",path:"/events/planning",summary:"Stream planning events (SSE)",tags:["events"]}).output(Y9)},K9=Ae({wbs:V().regex(/^\d{4}$/),name:V().min(1),status:tt(rr),priority:V().optional(),featureId:V().nullable().optional(),parentWbs:V().regex(/^\d{4}$/).nullable().optional(),type:tt(Dv).optional(),filePath:V(),updatedAt:V().optional()}),X9=Bt(bt(K9)),Q9=Ae({folder:V().optional(),status:V().optional(),parent:V().optional()}),J9=Bt(Ae({wbs:V(),name:V(),status:tt(rr),frontmatter:yu(V(),os()),content:V(),filePath:V()})),e$=Ae({wbs:V().regex(/^\d{4}$/)}),t$=Ae({title:V().min(1),featureId:V().optional(),parentWbs:V().regex(/^\d{4}$/).optional(),folder:V().optional(),template:tt(Su).optional()}),n$=Bt(Ae({wbs:V(),filePath:V()})),r$=Ae({wbs:V().regex(/^\d{4}$/),toStatus:tt(rr),actor:V().optional()}),a$=Bt(Ae({wbs:V(),status:tt(rr)})),s$=Ae({wbs:V().regex(/^\d{4}$/),body:V(),actor:V().optional()}),i$=Bt(Ae({wbs:V(),filePath:V()})),o$=tt(["claude","codex","gemini","pi","opencode","antigravity","openclaw"]),l$=tt(["refine","plan","run","verify","decompose","evaluate"]),u$=Ae({wbs:V().regex(/^\d{4}$/),action:l$,channel:o$.optional(),skipDeps:Jr().optional()}),c$=Bt(Ae({runId:V(),action:V(),status:ur("queued")})),d$=Ae({path:V(),label:V().optional()}),p$=Bt(bt(d$)).extend({activeFolder:V().optional()}),f$={list:Mt.route({method:"GET",path:"/tasks",summary:"List tasks",tags:["task"]}).input(Q9).output(X9),folders:Mt.route({method:"GET",path:"/tasks/folders",summary:"List configured task folders",tags:["task"]}).output(p$),show:Mt.route({method:"GET",path:"/tasks/{wbs}",summary:"Show task detail",tags:["task"]}).input(e$).output(J9),create:Mt.route({method:"POST",path:"/tasks",summary:"Create a task",tags:["task"]}).input(t$).output(n$),transition:Mt.route({method:"PATCH",path:"/tasks/{wbs}/status",summary:"Transition task status",tags:["task"]}).input(r$).output(a$),body:Mt.route({method:"PATCH",path:"/tasks/{wbs}/body",summary:"Update task body",tags:["task"]}).input(s$).output(i$),action:Mt.route({method:"POST",path:"/tasks/{wbs}/actions",summary:"Run a task action",tags:["task"]}).input(u$).output(c$)},m$=Ae({status:ur("ok"),timestamp:V(),service:ur("spur"),version:V()}),h$={health:Mt.route({method:"GET",path:"/health",summary:"Read application health",tags:["system"]}).output(m$),task:{...f$},feature:{...u9},history:{...q9},...Z9};class g$ extends KS{initRuntimeAdapter(t){for(const n of this.plugins)n.initRuntimeAdapter?.(t)}}class b${fetch;toFetchRequestOptions;adapterInterceptors;constructor(t){new g$(t.plugins).initRuntimeAdapter(t),this.fetch=t.fetch??globalThis.fetch.bind(globalThis),this.toFetchRequestOptions=t,this.adapterInterceptors=ul(t.adapterInterceptors)}async call(t,n,r,a){const s=BP(t,this.toFetchRequestOptions),i=await ud(this.adapterInterceptors,{...n,request:s,path:r,input:a,init:{redirect:"manual"}},({request:u,path:c,input:p,init:d,...f})=>this.fetch(u,d,f,c,p));return UP(i,{signal:s.signal})}}class E${maxArrayIndex;constructor(t={}){this.maxArrayIndex=t.maxBracketNotationArrayIndex??9999}serialize(t,n=[],r=[]){if(Array.isArray(t))t.forEach((a,s)=>{this.serialize(a,[...n,s],r)});else if(Zr(t))for(const a in t)this.serialize(t[a],[...n,a],r);else r.push([this.stringifyPath(n),t]);return r}deserialize(t){if(t.length===0)return{};const n=new WeakSet,r={value:[]};for(const[a,s]of t){const i=this.parsePath(a);let o=r,u="value";i.forEach((c,p)=>{!Array.isArray(o[u])&&!Zr(o[u])&&(o[u]=[]),p!==i.length-1?Array.isArray(o[u])&&!kx(c,this.maxArrayIndex)&&(n.has(o[u])?(n.delete(o[u]),o[u]=Ix(o[u])):o[u]=hc(o[u])):Array.isArray(o[u])&&(c===""?o[u].length&&!n.has(o[u])&&(o[u]=hc(o[u])):n.has(o[u])?(n.delete(o[u]),o[u]=Ix(o[u])):kx(c,this.maxArrayIndex)||(o[u]=hc(o[u]))),o=o[u],u=c}),Array.isArray(o)&&u===""?(n.add(o),o.push(s)):u in o?Array.isArray(o[u])?o[u].push(s):o[u]=[o[u],s]:o[u]=s}return r.value}stringifyPath(t){return t.map(n=>n.toString().replace(/[\\[\]]/g,r=>{switch(r){case"\\":return"\\\\";case"[":return"\\[";case"]":return"\\]";default:return r}})).reduce((n,r,a)=>a===0?r:`${n}[${r}]`,"")}parsePath(t){const n=[];let r=!1,a="",s=0;for(let i=0;i<t.length;i++){const o=t[i],u=t[i+1];r&&o==="]"&&(u===void 0||u==="[")&&s%2===0?(u===void 0&&(r=!1),n.push(a),a="",i++):n.length===0&&o==="["&&s%2===0?(r=!0,n.push(a),a=""):o==="\\"?s++:(a+="\\".repeat(s/2)+o,s=0)}return r||n.length===0?[t]:n}}function kx(e,t){return/^0$|^[1-9]\d*$/.test(e)&&Number(e)<=t}function hc(e){const t=new jS;return e.forEach((n,r)=>{t[r]=n}),t}function Ix(e){const t=new jS;return t[""]=e.length===1?e[0]:e,t}class x${customSerializers;constructor(t={}){this.customSerializers=t.customJsonSerializers??[]}serialize(t,n={value:!1}){for(const r of this.customSerializers)if(r.condition(t))return this.serialize(r.serialize(t),n);if(t instanceof Blob)return n.value=!0,[t,n.value];if(t instanceof Set)return this.serialize(Array.from(t),n);if(t instanceof Map)return this.serialize(Array.from(t.entries()),n);if(Array.isArray(t))return[t.map(a=>a===void 0?null:this.serialize(a,n)[0]),n.value];if(Zr(t)){const r={};for(const a in t)a==="toJSON"&&typeof t[a]=="function"||(r[a]=this.serialize(t[a],n)[0]);return[r,n.value]}return typeof t=="bigint"||t instanceof RegExp||t instanceof URL?[t.toString(),n.value]:t instanceof Date?[Number.isNaN(t.getTime())?null:t.toISOString(),n.value]:Number.isNaN(t)?[null,n.value]:[t,n.value]}}function gd(e){return`/${e.replace(/\/{2,}/g,"/").replace(/^\/|\/$/g,"")}`}function Rx(e){return e?gd(e).match(/\/\{[^}]+\}/g)?.map(t=>({raw:t,name:t.match(/\{\+?([^}]+)\}/)[1]})):void 0}class y${constructor(t,n,r){this.contract=t,this.serializer=n,this.baseUrl=r.url,this.headers=r.headers??{},this.customErrorResponseBodyDecoder=r.customErrorResponseBodyDecoder}baseUrl;headers;customErrorResponseBodyDecoder;async encode(t,n,r){let a=zP(await XE(this.headers,r,t,n));r.lastEventId!==void 0&&(a=QE(a,{"last-event-id":r.lastEventId}));const s=await XE(this.baseUrl,r,t,n),i=KE(this.contract,t);if(!pd(i))throw new Error(`[StandardOpenapiLinkCodec] expect a contract procedure at ${t.join(".")}`);return So("defaultInputStructure",i["~orpc"].route.inputStructure)==="compact"?this.#e(i,t,n,r,s,a):this.#t(i,t,n,r,s,a)}#e(t,n,r,a,s,i){let o=gd(t["~orpc"].route.path??ex(n)),u=r;const c=Rx(o);if(c?.length){if(!Zr(r))throw new TypeError(`[StandardOpenapiLinkCodec] Invalid input shape for "compact" structure when has dynamic params at ${n.join(".")}.`);const f={...r};for(const m of c){const b=r[m.name];o=o.replace(m.raw,`/${encodeURIComponent(`${this.serializer.serialize(b)}`)}`),delete f[m.name]}u=Object.keys(f).length?f:void 0}const p=So("defaultMethod",t["~orpc"].route.method),d=new URL(s);if(d.pathname=`${d.pathname.replace(/\/$/,"")}${o}`,p==="GET"){const f=this.serializer.serialize(u,{outputFormat:"URLSearchParams"});for(const[m,b]of f)d.searchParams.append(m,b);return{url:d,method:p,headers:i,body:void 0,signal:a.signal}}return{url:d,method:p,headers:i,body:this.serializer.serialize(u),signal:a.signal}}#t(t,n,r,a,s,i){let o=gd(t["~orpc"].route.path??ex(n));const u=Rx(o);if(!Zr(r)&&r!==void 0)throw new TypeError(`[StandardOpenapiLinkCodec] Invalid input shape for "detailed" structure at ${n.join(".")}.`);if(u?.length){if(!Zr(r?.params))throw new TypeError(`[StandardOpenapiLinkCodec] Invalid input.params shape for "detailed" structure when has dynamic params at ${n.join(".")}.`);for(const f of u){const m=r.params[f.name];o=o.replace(f.raw,`/${encodeURIComponent(`${this.serializer.serialize(m)}`)}`)}}let c=i;if(r?.headers!==void 0){if(!Zr(r.headers))throw new TypeError(`[StandardOpenapiLinkCodec] Invalid input.headers shape for "detailed" structure at ${n.join(".")}.`);c=QE(r.headers,i)}const p=So("defaultMethod",t["~orpc"].route.method),d=new URL(s);if(d.pathname=`${d.pathname.replace(/\/$/,"")}${o}`,r?.query!==void 0){const f=this.serializer.serialize(r.query,{outputFormat:"URLSearchParams"});for(const[m,b]of f)d.searchParams.append(m,b)}return p==="GET"?{url:d,method:p,headers:c,body:void 0,signal:a.signal}:{url:d,method:p,headers:c,body:this.serializer.serialize(r?.body),signal:a.signal}}async decode(t,n,r){const a=!wi(t.status),s=await(async()=>{let u=!1;try{const c=await t.body();return u=!0,this.serializer.deserialize(c)}catch(c){throw u?new Error("Invalid OpenAPI response format.",{cause:c}):new Error("Cannot parse response body, please check the response body and content-type.",{cause:c})}})();if(!a){const u=this.customErrorResponseBodyDecoder?.(s,t);throw u??($S(s)?zS(s):new vi(HP(t.status),{status:t.status,data:{...t,body:s}}))}const i=KE(this.contract,r);if(!pd(i))throw new Error(`[StandardOpenapiLinkCodec] expect a contract procedure at ${r.join(".")}`);return So("defaultOutputStructure",i["~orpc"].route.outputStructure)==="compact"?s:{status:t.status,headers:t.headers,body:s}}}class T${constructor(t,n){this.jsonSerializer=t,this.bracketNotation=n}serialize(t,n={}){return Si(t)&&!n.outputFormat?JE(t,{value:async r=>this.#e(r,{outputFormat:"plain"}),error:async r=>new Ai({data:this.#e(vP(r).toJSON(),{outputFormat:"plain"}),cause:r})}):this.#e(t,n)}#e(t,n){const[r,a]=this.jsonSerializer.serialize(t);if(n.outputFormat==="plain")return r;if(n.outputFormat==="URLSearchParams"){const i=new URLSearchParams;for(const[o,u]of this.bracketNotation.serialize(r))(typeof u=="string"||typeof u=="number"||typeof u=="boolean")&&i.append(o,u.toString());return i}if(r instanceof Blob||r===void 0||!a)return r;const s=new FormData;for(const[i,o]of this.bracketNotation.serialize(r))typeof o=="string"||typeof o=="number"||typeof o=="boolean"?s.append(i,o.toString()):o instanceof Blob&&s.append(i,o);return s}deserialize(t){return t instanceof URLSearchParams||t instanceof FormData?this.bracketNotation.deserialize(Array.from(t.entries())):Si(t)?JE(t,{value:async n=>n,error:async n=>n instanceof Ai&&$S(n.data)?zS(n.data,{cause:n}):n}):t}}class S$ extends $P{constructor(t,n,r){const a=new x$(r),s=new E$({maxBracketNotationArrayIndex:4294967294}),i=new T$(a,s),o=new y$(t,i,r);super(o,n,r)}}class v$ extends S${constructor(t,n){const r=new b$(n);super(t,r,n)}}function Nt(e=void 0,t=globalThis.location?.origin,n=!1){return e||(t&&t!=="null"?new URL("/api",t).toString():"http://localhost:3000/api")}function Tt(e,t=1e4){const n=new AbortController,r=setTimeout(()=>n.abort(),t),a=e.signal;a&&a.addEventListener("abort",()=>n.abort(),{once:!0});const s=new Request(e,{signal:n.signal});return fetch(s).finally(()=>clearTimeout(r))}function w$(e){return Tt(e)}function A$(e){typeof globalThis<"u"&&globalThis.dispatchEvent&&globalThis.dispatchEvent(new CustomEvent("api-error",{detail:{message:e instanceof Error?e.message:String(e)}}))}const sn=qS(new v$(h$,{url:Nt(),fetch:w$,adapterInterceptors:[mP(A$)]})),_r=()=>`${Nt()}/features`;async function N$(e){const t=await Tt(new Request(_r(),{signal:e}));if(!t.ok)throw new Error(`feature list fetch failed: ${t.status}`);const r=await t.json();if(!r.ok||!Array.isArray(r.data))throw new Error("feature list: invalid response shape");return r.data}async function Dx(e,t){const n=await Tt(new Request(`${_r()}/${encodeURIComponent(e)}`,{signal:t}));if(!n.ok)throw new Error(`feature show fetch failed: ${n.status}`);const a=await n.json();if(!a.ok||!a.data)throw new Error("feature show: invalid response shape");return a.data}async function _$(e,t,n){const r=await Tt(new Request(`${_r()}/${encodeURIComponent(e)}/status`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({id:e,toStatus:t}),signal:n})),a=await r.json();if(!r.ok){const i=a;throw new Error(i.error?.message??`transition failed: ${r.status}`)}return a.data?.status??t}async function C$(e,t){const n=await Tt(new Request(`${_r()}/${encodeURIComponent(e.id)}/body`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e),signal:t}));if(!n.ok){const a=await n.json();throw new Error(a.error?.message??`body update failed: ${n.status}`)}}async function k$(e,t){const n=await Tt(new Request(`${_r()}/${encodeURIComponent(e.id)}/action`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e),signal:t}));if(!n.ok){const s=await n.json();throw new Error(s.error?.message??`action dispatch failed: ${n.status}`)}return await n.json()}async function jv(e,t){const n=await Tt(new Request(`${_r()}/${encodeURIComponent(e.id)}/children`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e),signal:t}));if(!n.ok){const s=await n.json();throw new Error(s.error?.message??`create child failed: ${n.status}`)}return await n.json()}async function I$(e,t){const n=await Tt(new Request(_r(),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:e}),signal:t}));if(!n.ok){const i=await n.json();throw new Error(i.error?.message??`create feature failed: ${n.status}`)}const a=await n.json();if(!a.ok||!a.data)throw new Error("create feature: invalid response shape");return a.data}async function R$(e,t){const n=await Tt(new Request(`${_r()}/${encodeURIComponent(e.id)}/tasks`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e),signal:t}));if(!n.ok){const s=await n.json();throw new Error(s.error?.message??`create task failed: ${n.status}`)}return await n.json()}async function D$(e,t){const n=await Tt(new Request(`${_r()}/${encodeURIComponent(e.id)}/link`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e),signal:t}));if(!n.ok){const s=await n.json();throw new Error(s.error?.message??`link task failed: ${n.status}`)}return await n.json()}async function O$(e,t){const n=await Tt(new Request(`${_r()}/${encodeURIComponent(e.id)}/sync`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e),signal:t}));if(!n.ok){const s=await n.json();throw new Error(s.error?.message??`sync failed: ${n.status}`)}return await n.json()}var da=Jw();const L$=(function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"})(),F$=function(e){return"/"+e},Ox={},Bv=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){let u=function(c){return Promise.all(c.map(p=>Promise.resolve(p).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),o=i?.nonce||i?.getAttribute("nonce");a=u(n.map(c=>{if(c=F$(c),c in Ox)return;Ox[c]=!0;const p=c.endsWith(".css"),d=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=p?"stylesheet":L$,p||(f.as="script"),f.crossOrigin="",f.href=c,o&&f.setAttribute("nonce",o),document.head.appendChild(f),p)return new Promise((m,b)=>{f.addEventListener("load",m),f.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(i){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=i,window.dispatchEvent(o),!o.defaultPrevented)throw i}return a.then(i=>{for(const o of i||[])o.status==="rejected"&&s(o.reason);return t().catch(s)})};function Lx(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function M$(e){if(Array.isArray(e))return e}function P$(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,s,i,o=[],u=!0,c=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(u=(r=s.call(n)).done)&&(o.push(r.value),o.length!==t);u=!0);}catch(p){c=!0,a=p}finally{try{if(!u&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return o}}function j$(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
169
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function B$(e,t){return M$(e)||P$(e,t)||U$(e,t)||j$()}function U$(e,t){if(e){if(typeof e=="string")return Lx(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Lx(e,t):void 0}}const Uv=Object.entries,Fx=Object.setPrototypeOf,$$=Object.isFrozen,z$=Object.getPrototypeOf,H$=Object.getOwnPropertyDescriptor;let Tn=Object.freeze,vn=Object.seal,za=Object.create,$v=typeof Reflect<"u"&&Reflect,bd=$v.apply,Ed=$v.construct;Tn||(Tn=function(t){return t});vn||(vn=function(t){return t});bd||(bd=function(t,n){for(var r=arguments.length,a=new Array(r>2?r-2:0),s=2;s<r;s++)a[s-2]=arguments[s];return t.apply(n,a)});Ed||(Ed=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return new t(...r)});const $s=an(Array.prototype.forEach),G$=an(Array.prototype.lastIndexOf),Mx=an(Array.prototype.pop),Pa=an(Array.prototype.push),W$=an(Array.prototype.splice),Vr=Array.isArray,Zs=an(String.prototype.toLowerCase),gc=an(String.prototype.toString),Px=an(String.prototype.match),zs=an(String.prototype.replace),jx=an(String.prototype.indexOf),V$=an(String.prototype.trim),q$=an(Number.prototype.toString),Y$=an(Boolean.prototype.toString),Bx=typeof BigInt>"u"?null:an(BigInt.prototype.toString),Ux=typeof Symbol>"u"?null:an(Symbol.prototype.toString),pn=an(Object.prototype.hasOwnProperty),Hs=an(Object.prototype.toString),yn=an(RegExp.prototype.test),ia=Z$(TypeError);function an(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return bd(e,t,r)}}function Z$(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Ed(e,n)}}function Et(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Zs;if(Fx&&Fx(e,null),!Vr(t))return e;let r=t.length;for(;r--;){let a=t[r];if(typeof a=="string"){const s=n(a);s!==a&&($$(t)||(t[r]=s),a=s)}e[a]=!0}return e}function K$(e){for(let t=0;t<e.length;t++)pn(e,t)||(e[t]=null);return e}function Ln(e){const t=za(null);for(const r of Uv(e)){var n=B$(r,2);const a=n[0],s=n[1];pn(e,a)&&(Vr(s)?t[a]=K$(s):s&&typeof s=="object"&&s.constructor===Object?t[a]=Ln(s):t[a]=s)}return t}function X$(e){switch(typeof e){case"string":return e;case"number":return q$(e);case"boolean":return Y$(e);case"bigint":return Bx?Bx(e):"0";case"symbol":return Ux?Ux(e):"Symbol()";case"undefined":return Hs(e);case"function":case"object":{if(e===null)return Hs(e);const t=e,n=xr(t,"toString");if(typeof n=="function"){const r=n(t);return typeof r=="string"?r:Hs(r)}return Hs(e)}default:return Hs(e)}}function xr(e,t){for(;e!==null;){const r=H$(e,t);if(r){if(r.get)return an(r.get);if(typeof r.value=="function")return an(r.value)}e=z$(e)}function n(){return null}return n}function Q$(e){try{return yn(e,""),!0}catch{return!1}}const $x=Tn(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),bc=Tn(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ec=Tn(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),J$=Tn(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),xc=Tn(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),ez=Tn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),zx=Tn(["#text"]),Hx=Tn(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),yc=Tn(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Gx=Tn(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),No=Tn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),tz=vn(/{{[\w\W]*|^[\w\W]*}}/g),nz=vn(/<%[\w\W]*|^[\w\W]*%>/g),rz=vn(/\${[\w\W]*/g),az=vn(/^data-[\-\w.\u00B7-\uFFFF]+$/),sz=vn(/^aria-[\-\w]+$/),Wx=vn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),iz=vn(/^(?:\w+script|data):/i),oz=vn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),lz=vn(/^html$/i),uz=vn(/^[a-z][.\w]*(-[.\w]+)+$/i),Vx=vn(/<[/\w!]/g),cz=vn(/<[/\w]/g),dz=vn(/<\/no(script|embed|frames)/i),pz=vn(/\/>/i),br={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},fz=function(){return typeof window>"u"?null:window},mz=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const a="data-tt-policy-suffix";n&&n.hasAttribute(a)&&(r=n.getAttribute(a));const s="dompurify"+(r?"#"+r:"");try{return t.createPolicy(s,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},qx=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Br=function(t,n,r,a){return pn(t,n)&&Vr(t[n])?Et(a.base?Ln(a.base):{},t[n],a.transform):r};function zv(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:fz();const t=Se=>zv(Se);if(t.version="3.4.11",t.removed=[],!e||!e.document||e.document.nodeType!==br.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const r=n,a=r.currentScript;e.DocumentFragment;const s=e.HTMLTemplateElement,i=e.Node,o=e.Element,u=e.NodeFilter,c=e.NamedNodeMap;c===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const p=e.DOMParser,d=e.trustedTypes,f=o.prototype,m=xr(f,"cloneNode"),b=xr(f,"remove"),E=xr(f,"nextSibling"),x=xr(f,"childNodes"),y=xr(f,"parentNode"),S=xr(f,"shadowRoot"),w=xr(f,"attributes"),A=i&&i.prototype?xr(i.prototype,"nodeType"):null,D=i&&i.prototype?xr(i.prototype,"nodeName"):null;if(typeof s=="function"){const Se=n.createElement("template");Se.content&&Se.content.ownerDocument&&(n=Se.content.ownerDocument)}let N,T="",v,R=!1,C=0;const U=function(){if(C>0)throw ia('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},k=function(P){U(),C++;try{return N.createHTML(P)}finally{C--}},j=function(P){U(),C++;try{return N.createScriptURL(P)}finally{C--}},G=function(){return R||(v=mz(d,a),R=!0),v},$=n,te=$.implementation,H=$.createNodeIterator,se=$.createDocumentFragment,de=$.getElementsByTagName,O=r.importNode;let ne=qx();t.isSupported=typeof Uv=="function"&&typeof y=="function"&&te&&te.createHTMLDocument!==void 0;const pe=tz,L=nz,ke=rz,Re=az,Q=sz,_e=iz,fe=oz,X=uz;let Ve=Wx,ge=null;const me=Et({},[...$x,...bc,...Ec,...xc,...zx]);let Te=null;const ve=Et({},[...Hx,...yc,...Gx,...No]);let ie=Object.seal(za(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ze=null,ot=null;const rt=Object.seal(za(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ht=!0,St=!0,Ct=!1,Zt=!0,at=!1,De=!0,Je=!1,Z=!1,oe=null,J=null,ue=!1,Pe=!1,qe=!1,ht=!1,Rt=!0,kt=!1;const jt="user-content-";let ae=!0,Ne=!1,ze={},je=null;const vt=Et({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Qt=null;const Le=Et({},["audio","video","img","source","image","track"]);let ft=null;const Ke=Et({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Dt="http://www.w3.org/1998/Math/MathML",nt="http://www.w3.org/2000/svg",Qe="http://www.w3.org/1999/xhtml";let wt=Qe,Kt=!1,W=null;const Be=Et({},[Dt,nt,Qe],gc),M=Tn(["mi","mo","mn","ms","mtext"]);let z=Et({},M);const Y=Tn(["annotation-xml"]);let le=Et({},Y);const be=Et({},["title","style","font","a","script"]);let Ie=null;const Ce=["application/xhtml+xml","text/html"],Oe="text/html";let we=null,Fe=null;const We=n.createElement("form"),Ue=function(P){return P instanceof RegExp||P instanceof Function},mt=function(){let P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Fe&&Fe===P)return;(!P||typeof P!="object")&&(P={}),P=Ln(P),Ie=Ce.indexOf(P.PARSER_MEDIA_TYPE)===-1?Oe:P.PARSER_MEDIA_TYPE,we=Ie==="application/xhtml+xml"?gc:Zs,ge=Br(P,"ALLOWED_TAGS",me,{transform:we}),Te=Br(P,"ALLOWED_ATTR",ve,{transform:we}),W=Br(P,"ALLOWED_NAMESPACES",Be,{transform:gc}),ft=Br(P,"ADD_URI_SAFE_ATTR",Ke,{transform:we,base:Ke}),Qt=Br(P,"ADD_DATA_URI_TAGS",Le,{transform:we,base:Le}),je=Br(P,"FORBID_CONTENTS",vt,{transform:we}),Ze=Br(P,"FORBID_TAGS",Ln({}),{transform:we}),ot=Br(P,"FORBID_ATTR",Ln({}),{transform:we}),ze=pn(P,"USE_PROFILES")?P.USE_PROFILES&&typeof P.USE_PROFILES=="object"?Ln(P.USE_PROFILES):P.USE_PROFILES:!1,Ht=P.ALLOW_ARIA_ATTR!==!1,St=P.ALLOW_DATA_ATTR!==!1,Ct=P.ALLOW_UNKNOWN_PROTOCOLS||!1,Zt=P.ALLOW_SELF_CLOSE_IN_ATTR!==!1,at=P.SAFE_FOR_TEMPLATES||!1,De=P.SAFE_FOR_XML!==!1,Je=P.WHOLE_DOCUMENT||!1,Pe=P.RETURN_DOM||!1,qe=P.RETURN_DOM_FRAGMENT||!1,ht=P.RETURN_TRUSTED_TYPE||!1,ue=P.FORCE_BODY||!1,Rt=P.SANITIZE_DOM!==!1,kt=P.SANITIZE_NAMED_PROPS||!1,ae=P.KEEP_CONTENT!==!1,Ne=P.IN_PLACE||!1,Ve=Q$(P.ALLOWED_URI_REGEXP)?P.ALLOWED_URI_REGEXP:Wx,wt=typeof P.NAMESPACE=="string"?P.NAMESPACE:Qe,z=pn(P,"MATHML_TEXT_INTEGRATION_POINTS")&&P.MATHML_TEXT_INTEGRATION_POINTS&&typeof P.MATHML_TEXT_INTEGRATION_POINTS=="object"?Ln(P.MATHML_TEXT_INTEGRATION_POINTS):Et({},M),le=pn(P,"HTML_INTEGRATION_POINTS")&&P.HTML_INTEGRATION_POINTS&&typeof P.HTML_INTEGRATION_POINTS=="object"?Ln(P.HTML_INTEGRATION_POINTS):Et({},Y);const K=pn(P,"CUSTOM_ELEMENT_HANDLING")&&P.CUSTOM_ELEMENT_HANDLING&&typeof P.CUSTOM_ELEMENT_HANDLING=="object"?Ln(P.CUSTOM_ELEMENT_HANDLING):za(null);if(ie=za(null),pn(K,"tagNameCheck")&&Ue(K.tagNameCheck)&&(ie.tagNameCheck=K.tagNameCheck),pn(K,"attributeNameCheck")&&Ue(K.attributeNameCheck)&&(ie.attributeNameCheck=K.attributeNameCheck),pn(K,"allowCustomizedBuiltInElements")&&typeof K.allowCustomizedBuiltInElements=="boolean"&&(ie.allowCustomizedBuiltInElements=K.allowCustomizedBuiltInElements),vn(ie),at&&(St=!1),qe&&(Pe=!0),ze&&(ge=Et({},zx),Te=za(null),ze.html===!0&&(Et(ge,$x),Et(Te,Hx)),ze.svg===!0&&(Et(ge,bc),Et(Te,yc),Et(Te,No)),ze.svgFilters===!0&&(Et(ge,Ec),Et(Te,yc),Et(Te,No)),ze.mathMl===!0&&(Et(ge,xc),Et(Te,Gx),Et(Te,No))),rt.tagCheck=null,rt.attributeCheck=null,pn(P,"ADD_TAGS")&&(typeof P.ADD_TAGS=="function"?rt.tagCheck=P.ADD_TAGS:Vr(P.ADD_TAGS)&&(ge===me&&(ge=Ln(ge)),Et(ge,P.ADD_TAGS,we))),pn(P,"ADD_ATTR")&&(typeof P.ADD_ATTR=="function"?rt.attributeCheck=P.ADD_ATTR:Vr(P.ADD_ATTR)&&(Te===ve&&(Te=Ln(Te)),Et(Te,P.ADD_ATTR,we))),pn(P,"ADD_URI_SAFE_ATTR")&&Vr(P.ADD_URI_SAFE_ATTR)&&Et(ft,P.ADD_URI_SAFE_ATTR,we),pn(P,"FORBID_CONTENTS")&&Vr(P.FORBID_CONTENTS)&&(je===vt&&(je=Ln(je)),Et(je,P.FORBID_CONTENTS,we)),pn(P,"ADD_FORBID_CONTENTS")&&Vr(P.ADD_FORBID_CONTENTS)&&(je===vt&&(je=Ln(je)),Et(je,P.ADD_FORBID_CONTENTS,we)),ae&&(ge["#text"]=!0),Je&&Et(ge,["html","head","body"]),ge.table&&(Et(ge,["tbody"]),delete Ze.tbody),P.TRUSTED_TYPES_POLICY){if(typeof P.TRUSTED_TYPES_POLICY.createHTML!="function")throw ia('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof P.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ia('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const ye=N;N=P.TRUSTED_TYPES_POLICY;try{T=k("")}catch(Me){throw N=ye,Me}}else P.TRUSTED_TYPES_POLICY===null?(N=void 0,T=""):(N===void 0&&(N=G()),N&&typeof T=="string"&&(T=k("")));Tn&&Tn(P),Fe=P},gt=Et({},[...bc,...Ec,...J$]),Jt=Et({},[...xc,...ez]),en=function(P,K,ye){return K.namespaceURI===Qe?P==="svg":K.namespaceURI===Dt?P==="svg"&&(ye==="annotation-xml"||z[ye]):!!gt[P]},En=function(P,K,ye){return K.namespaceURI===Qe?P==="math":K.namespaceURI===nt?P==="math"&&le[ye]:!!Jt[P]},_t=function(P,K,ye){return K.namespaceURI===nt&&!le[ye]||K.namespaceURI===Dt&&!z[ye]?!1:!Jt[P]&&(be[P]||!gt[P])},jn=function(P){let K=y(P);(!K||!K.tagName)&&(K={namespaceURI:wt,tagName:"template"});const ye=Zs(P.tagName),Me=Zs(K.tagName);return W[P.namespaceURI]?P.namespaceURI===nt?en(ye,K,Me):P.namespaceURI===Dt?En(ye,K,Me):P.namespaceURI===Qe?_t(ye,K,Me):!!(Ie==="application/xhtml+xml"&&W[P.namespaceURI]):!1},_n=function(P){Pa(t.removed,{element:P});try{y(P).removeChild(P)}catch{if(b(P),!y(P))throw ia("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Fr=function(P){const K=x(P);if(K){const Me=[];$s(K,st=>{Pa(Me,st)}),$s(Me,st=>{try{b(st)}catch{}})}const ye=w(P);if(ye)for(let Me=ye.length-1;Me>=0;--Me){const st=ye[Me],yt=st&&st.name;if(typeof yt=="string")try{P.removeAttribute(yt)}catch{}}},Cn=function(P,K){try{Pa(t.removed,{attribute:K.getAttributeNode(P),from:K})}catch{Pa(t.removed,{attribute:null,from:K})}if(K.removeAttribute(P),P==="is")if(Pe||qe)try{_n(K)}catch{}else try{K.setAttribute(P,"")}catch{}},Zn=function(P){const K=w(P);if(K)for(let ye=K.length-1;ye>=0;--ye){const Me=K[ye],st=Me&&Me.name;if(!(typeof st!="string"||Te[we(st)]))try{P.removeAttribute(st)}catch{}}},_s=function(P){const K=[P];for(;K.length>0;){const ye=K.pop();(A?A(ye):ye.nodeType)===br.element&&Zn(ye);const st=x(ye);if(st)for(let yt=st.length-1;yt>=0;--yt)K.push(st[yt])}},Mr=function(P){let K=null,ye=null;if(ue)P="<remove></remove>"+P;else{const yt=Px(P,/^[\r\n\t ]+/);ye=yt&&yt[0]}Ie==="application/xhtml+xml"&&wt===Qe&&(P='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+P+"</body></html>");const Me=N?k(P):P;if(wt===Qe)try{K=new p().parseFromString(Me,Ie)}catch{}if(!K||!K.documentElement){K=te.createDocument(wt,"template",null);try{K.documentElement.innerHTML=Kt?T:Me}catch{}}const st=K.body||K.documentElement;return P&&ye&&st.insertBefore(n.createTextNode(ye),st.childNodes[0]||null),wt===Qe?de.call(K,Je?"html":"body")[0]:Je?K.documentElement:st},hr=function(P){return H.call(P.ownerDocument||P,P,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Cr=function(P){return P=zs(P,pe," "),P=zs(P,L," "),P=zs(P,ke," "),P},Pr=function(P){var K;P.normalize();const ye=H.call(P.ownerDocument||P,P,u.SHOW_TEXT|u.SHOW_COMMENT|u.SHOW_CDATA_SECTION|u.SHOW_PROCESSING_INSTRUCTION,null);let Me=ye.nextNode();for(;Me;)Me.data=Cr(Me.data),Me=ye.nextNode();const st=(K=P.querySelectorAll)===null||K===void 0?void 0:K.call(P,"template");st&&$s(st,yt=>{Gt(yt.content)&&Pr(yt.content)})},lt=function(P){const K=D?D(P):null;return typeof K!="string"||we(K)!=="form"?!1:typeof P.nodeName!="string"||typeof P.textContent!="string"||typeof P.removeChild!="function"||P.attributes!==w(P)||typeof P.removeAttribute!="function"||typeof P.setAttribute!="function"||typeof P.namespaceURI!="string"||typeof P.insertBefore!="function"||typeof P.hasChildNodes!="function"||P.nodeType!==A(P)||P.childNodes!==x(P)},Gt=function(P){if(!A||typeof P!="object"||P===null)return!1;try{return A(P)===br.documentFragment}catch{return!1}},Kn=function(P){if(!A||typeof P!="object"||P===null)return!1;try{return typeof A(P)=="number"}catch{return!1}};function xn(Se,P,K){Se.length!==0&&$s(Se,ye=>{ye.call(t,P,K,Fe)})}const Ut=function(P,K){return!!(De&&P.hasChildNodes()&&!Kn(P.firstElementChild)&&yn(Vx,P.textContent)&&yn(Vx,P.innerHTML)||De&&P.namespaceURI===Qe&&K==="style"&&Kn(P.firstElementChild)||P.nodeType===br.processingInstruction||De&&P.nodeType===br.comment&&yn(cz,P.data))},Oa=function(P,K){if(!Ze[K]&&Db(K)&&(ie.tagNameCheck instanceof RegExp&&yn(ie.tagNameCheck,K)||ie.tagNameCheck instanceof Function&&ie.tagNameCheck(K)))return!1;if(ae&&!je[K]){const ye=y(P),Me=x(P);if(Me&&ye){const st=Me.length;for(let yt=st-1;yt>=0;--yt){const un=Ne?Me[yt]:m(Me[yt],!0);ye.insertBefore(un,E(P))}}}return _n(P),!0},Cs=function(P){if(xn(ne.beforeSanitizeElements,P,null),lt(P))return _n(P),!0;const K=we(D?D(P):P.nodeName);if(xn(ne.uponSanitizeElement,P,{tagName:K,allowedTags:ge}),Ut(P,K))return _n(P),!0;if(Ze[K]||!(rt.tagCheck instanceof Function&&rt.tagCheck(K))&&!ge[K])return Oa(P,K);if((A?A(P):P.nodeType)===br.element&&!jn(P)||(K==="noscript"||K==="noembed"||K==="noframes")&&yn(dz,P.innerHTML))return _n(P),!0;if(at&&P.nodeType===br.text){const Me=Cr(P.textContent);P.textContent!==Me&&(Pa(t.removed,{element:P.cloneNode()}),P.textContent=Me)}return xn(ne.afterSanitizeElements,P,null),!1},ro=function(P,K,ye){if(ot[K]||Rt&&(K==="id"||K==="name")&&(ye in n||ye in We))return!1;const Me=Te[K]||rt.attributeCheck instanceof Function&&rt.attributeCheck(K,P);if(!(St&&yn(Re,K))){if(!(Ht&&yn(Q,K))){if(Me){if(!ft[K]){if(!yn(Ve,zs(ye,fe,""))){if(!((K==="src"||K==="xlink:href"||K==="href")&&P!=="script"&&jx(ye,"data:")===0&&Qt[P])){if(!(Ct&&!yn(_e,zs(ye,fe,"")))){if(ye)return!1}}}}}else if(!(Db(P)&&(ie.tagNameCheck instanceof RegExp&&yn(ie.tagNameCheck,P)||ie.tagNameCheck instanceof Function&&ie.tagNameCheck(P))&&(ie.attributeNameCheck instanceof RegExp&&yn(ie.attributeNameCheck,K)||ie.attributeNameCheck instanceof Function&&ie.attributeNameCheck(K,P))||K==="is"&&ie.allowCustomizedBuiltInElements&&(ie.tagNameCheck instanceof RegExp&&yn(ie.tagNameCheck,ye)||ie.tagNameCheck instanceof Function&&ie.tagNameCheck(ye))))return!1}}return!0},Zw=Et({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Db=function(P){return!Zw[Zs(P)]&&yn(X,P)},Kw=function(P,K,ye,Me){if(N&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!ye)switch(d.getAttributeType(P,K)){case"TrustedHTML":return k(Me);case"TrustedScriptURL":return j(Me)}return Me},Xw=function(P,K,ye,Me){try{ye?P.setAttributeNS(ye,K,Me):P.setAttribute(K,Me),lt(P)?_n(P):Mx(t.removed)}catch{Cn(K,P)}},Ob=function(P){xn(ne.beforeSanitizeAttributes,P,null);const K=P.attributes;if(!K||lt(P))return;const ye={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Te,forceKeepAttr:void 0};let Me=K.length;const st=we(P.nodeName);for(;Me--;){const yt=K[Me],un=yt.name,tn=yt.namespaceURI,Xn=yt.value,or=we(un),ku=Xn;let Dn=un==="value"?ku:V$(ku);if(ye.attrName=or,ye.attrValue=Dn,ye.keepAttr=!0,ye.forceKeepAttr=void 0,xn(ne.uponSanitizeAttribute,P,ye),Dn=ye.attrValue,kt&&(or==="id"||or==="name")&&jx(Dn,jt)!==0&&(Cn(un,P),Dn=jt+Dn),De&&yn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Dn)){Cn(un,P);continue}if(or==="attributename"&&Px(Dn,"href")){Cn(un,P);continue}if(!ye.forceKeepAttr){if(!ye.keepAttr){Cn(un,P);continue}if(!Zt&&yn(pz,Dn)){Cn(un,P);continue}if(at&&(Dn=Cr(Dn)),!ro(st,or,Dn)){Cn(un,P);continue}Dn=Kw(st,or,tn,Dn),Dn!==ku&&Xw(P,un,tn,Dn)}}xn(ne.afterSanitizeAttributes,P,null)},ao=function(P){let K=null;const ye=hr(P);for(xn(ne.beforeSanitizeShadowDOM,P,null);K=ye.nextNode();)if(xn(ne.uponSanitizeShadowNode,K,null),Cs(K),Ob(K),Gt(K.content)&&ao(K.content),(A?A(K):K.nodeType)===br.element){const st=S(K);Gt(st)&&(Cu(st),ao(st))}xn(ne.afterSanitizeShadowDOM,P,null)},Cu=function(P){const K=[{node:P,shadow:null}];for(;K.length>0;){const ye=K.pop();if(ye.shadow){ao(ye.shadow);continue}const Me=ye.node,yt=(A?A(Me):Me.nodeType)===br.element,un=x(Me);if(un)for(let tn=un.length-1;tn>=0;--tn)K.push({node:un[tn],shadow:null});if(yt){const tn=D?D(Me):null;if(typeof tn=="string"&&we(tn)==="template"){const Xn=Me.content;Gt(Xn)&&K.push({node:Xn,shadow:null})}}if(yt){const tn=S(Me);Gt(tn)&&K.push({node:null,shadow:tn},{node:tn,shadow:null})}}};return t.sanitize=function(Se){let P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},K=null,ye=null,Me=null,st=null;if(Kt=!Se,Kt&&(Se="<!-->"),typeof Se!="string"&&!Kn(Se)&&(Se=X$(Se),typeof Se!="string"))throw ia("dirty is not a string, aborting");if(!t.isSupported)return Se;Z?(ge=oe,Te=J):mt(P),(ne.uponSanitizeElement.length>0||ne.uponSanitizeAttribute.length>0)&&(ge=Ln(ge)),ne.uponSanitizeAttribute.length>0&&(Te=Ln(Te)),t.removed=[];const yt=Ne&&typeof Se!="string"&&Kn(Se);if(yt){const Xn=D?D(Se):Se.nodeName;if(typeof Xn=="string"){const or=we(Xn);if(!ge[or]||Ze[or])throw ia("root node is forbidden and cannot be sanitized in-place")}if(lt(Se))throw ia("root node is clobbered and cannot be sanitized in-place");try{Cu(Se)}catch(or){throw Fr(Se),or}}else if(Kn(Se))K=Mr("<!---->"),ye=K.ownerDocument.importNode(Se,!0),ye.nodeType===br.element&&ye.nodeName==="BODY"||ye.nodeName==="HTML"?K=ye:K.appendChild(ye),Cu(ye);else{if(!Pe&&!at&&!Je&&Se.indexOf("<")===-1)return N&&ht?k(Se):Se;if(K=Mr(Se),!K)return Pe?null:ht?T:""}K&&ue&&_n(K.firstChild);const un=hr(yt?Se:K);try{for(;Me=un.nextNode();)Cs(Me),Ob(Me),Gt(Me.content)&&ao(Me.content)}catch(Xn){throw yt&&Fr(Se),Xn}if(yt)return $s(t.removed,Xn=>{Xn.element&&_s(Xn.element)}),at&&Pr(Se),Se;if(Pe){if(at&&Pr(K),qe)for(st=se.call(K.ownerDocument);K.firstChild;)st.appendChild(K.firstChild);else st=K;return(Te.shadowroot||Te.shadowrootmode)&&(st=O.call(r,st,!0)),st}let tn=Je?K.outerHTML:K.innerHTML;return Je&&ge["!doctype"]&&K.ownerDocument&&K.ownerDocument.doctype&&K.ownerDocument.doctype.name&&yn(lz,K.ownerDocument.doctype.name)&&(tn="<!DOCTYPE "+K.ownerDocument.doctype.name+`>
|
|
170
|
-
`+tn),at&&(tn=Cr(tn)),N&&ht?k(tn):tn},t.setConfig=function(){let Se=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};mt(Se),Z=!0,oe=ge,J=Te},t.clearConfig=function(){Fe=null,Z=!1,oe=null,J=null,N=v,T=""},t.isValidAttribute=function(Se,P,K){Fe||mt({});const ye=we(Se),Me=we(P);return ro(ye,Me,K)},t.addHook=function(Se,P){typeof P=="function"&&pn(ne,Se)&&Pa(ne[Se],P)},t.removeHook=function(Se,P){if(pn(ne,Se)){if(P!==void 0){const K=G$(ne[Se],P);return K===-1?void 0:W$(ne[Se],K,1)[0]}return Mx(ne[Se])}},t.removeHooks=function(Se){pn(ne,Se)&&(ne[Se]=[])},t.removeAllHooks=function(){ne=qx()},t}var hz=zv();function gz({code:e}){const t=g.useId().replace(/:/g,""),n=g.useRef(null),[r,a]=g.useState(null),[s,i]=g.useState(!1);return g.useEffect(()=>{let o=!1;return(async()=>{try{const u=(await Bv(async()=>{const{default:d}=await import("./mermaid.core.
|
|
168
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const o=i[1];if(t===i[0]){s(i);continue}if(e.external){const c=e.external.registry.get(i[0])?.id;if(t!==i[0]&&c){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(o.cycle){s(i);continue}if(o.count>1&&e.reused==="ref"){s(i);continue}}}function vv(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=o=>{const u=e.seen.get(o);if(u.ref===null)return;const c=u.def??u.schema,p={...c},d=u.ref;if(u.ref=null,d){r(d);const m=e.seen.get(d),b=m.schema;if(b.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(b)):Object.assign(c,b),Object.assign(c,p),o._zod.parent===d)for(const x in c)x==="$ref"||x==="allOf"||x in p||delete c[x];if(b.$ref&&m.def)for(const x in c)x==="$ref"||x==="allOf"||x in m.def&&JSON.stringify(c[x])===JSON.stringify(m.def[x])&&delete c[x]}const f=o._zod.parent;if(f&&f!==d){r(f);const m=e.seen.get(f);if(m?.schema.$ref&&(c.$ref=m.schema.$ref,m.def))for(const b in c)b==="$ref"||b==="allOf"||b in m.def&&JSON.stringify(c[b])===JSON.stringify(m.def[b])&&delete c[b]}e.override({zodSchema:o,jsonSchema:c,path:u.path??[]})};for(const o of[...e.seen.entries()].reverse())r(o[0]);const a={};if(e.target==="draft-2020-12"?a.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?a.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?a.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const o=e.external.registry.get(t)?.id;if(!o)throw new Error("Schema is missing an `id` property");a.$id=e.external.uri(o)}Object.assign(a,n.def??n.schema);const s=e.metadataRegistry.get(t)?.id;s!==void 0&&a.id===s&&delete a.id;const i=e.external?.defs??{};for(const o of e.seen.entries()){const u=o[1];u.def&&u.defId&&(u.def.id===u.defId&&delete u.def.id,i[u.defId]=u.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?a.$defs=i:a.definitions=i);try{const o=JSON.parse(JSON.stringify(a));return Object.defineProperty(o,"~standard",{value:{...t["~standard"],jsonSchema:{input:fl(t,"input",e.processors),output:fl(t,"output",e.processors)}},enumerable:!1,writable:!1}),o}catch{throw new Error("Error converting schema to JSON.")}}function On(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return On(r.element,n);if(r.type==="set")return On(r.valueType,n);if(r.type==="lazy")return On(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return On(r.innerType,n);if(r.type==="intersection")return On(r.left,n)||On(r.right,n);if(r.type==="record"||r.type==="map")return On(r.keyType,n)||On(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:On(r.in,n)||On(r.out,n);if(r.type==="object"){for(const a in r.shape)if(On(r.shape[a],n))return!0;return!1}if(r.type==="union"){for(const a of r.options)if(On(a,n))return!0;return!1}if(r.type==="tuple"){for(const a of r.items)if(On(a,n))return!0;return!!(r.rest&&On(r.rest,n))}return!1}const XB=(e,t={})=>n=>{const r=Tv({...n,processors:t});return rn(e,r),Sv(r,e),vv(r,e)},fl=(e,t,n={})=>r=>{const{libraryOptions:a,target:s}=r??{},i=Tv({...a??{},target:s,io:t,processors:n});return rn(e,i),Sv(i,e),vv(i,e)},QB={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},JB=(e,t,n,r)=>{const a=n;a.type="string";const{minimum:s,maximum:i,format:o,patterns:u,contentEncoding:c}=e._zod.bag;if(typeof s=="number"&&(a.minLength=s),typeof i=="number"&&(a.maxLength=i),o&&(a.format=QB[o]??o,a.format===""&&delete a.format,o==="time"&&delete a.format),c&&(a.contentEncoding=c),u&&u.size>0){const p=[...u];p.length===1?a.pattern=p[0].source:p.length>1&&(a.allOf=[...p.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},eU=(e,t,n,r)=>{const a=n,{minimum:s,maximum:i,format:o,multipleOf:u,exclusiveMaximum:c,exclusiveMinimum:p}=e._zod.bag;typeof o=="string"&&o.includes("int")?a.type="integer":a.type="number";const d=typeof p=="number"&&p>=(s??Number.NEGATIVE_INFINITY),f=typeof c=="number"&&c<=(i??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";d?m?(a.minimum=p,a.exclusiveMinimum=!0):a.exclusiveMinimum=p:typeof s=="number"&&(a.minimum=s),f?m?(a.maximum=c,a.exclusiveMaximum=!0):a.exclusiveMaximum=c:typeof i=="number"&&(a.maximum=i),typeof u=="number"&&(a.multipleOf=u)},tU=(e,t,n,r)=>{n.type="boolean"},nU=(e,t,n,r)=>{n.not={}},rU=(e,t,n,r)=>{},aU=(e,t,n,r)=>{const a=e._zod.def,s=JS(a.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},sU=(e,t,n,r)=>{const a=e._zod.def,s=[];for(const i of a.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){const i=s[0];n.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[i]:n.const=i}else s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),s.every(i=>typeof i=="boolean")&&(n.type="boolean"),s.every(i=>i===null)&&(n.type="null"),n.enum=s},iU=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},oU=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},lU=(e,t,n,r)=>{const a=n,s=e._zod.def,{minimum:i,maximum:o}=e._zod.bag;typeof i=="number"&&(a.minItems=i),typeof o=="number"&&(a.maxItems=o),a.type="array",a.items=rn(s.element,t,{...r,path:[...r.path,"items"]})},uU=(e,t,n,r)=>{const a=n,s=e._zod.def;a.type="object",a.properties={};const i=s.shape;for(const c in i)a.properties[c]=rn(i[c],t,{...r,path:[...r.path,"properties",c]});const o=new Set(Object.keys(i)),u=new Set([...o].filter(c=>{const p=s.shape[c]._zod;return t.io==="input"?p.optin===void 0:p.optout===void 0}));u.size>0&&(a.required=Array.from(u)),s.catchall?._zod.def.type==="never"?a.additionalProperties=!1:s.catchall?s.catchall&&(a.additionalProperties=rn(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(a.additionalProperties=!1)},cU=(e,t,n,r)=>{const a=e._zod.def,s=a.inclusive===!1,i=a.options.map((o,u)=>rn(o,t,{...r,path:[...r.path,s?"oneOf":"anyOf",u]}));s?n.oneOf=i:n.anyOf=i},dU=(e,t,n,r)=>{const a=e._zod.def,s=rn(a.left,t,{...r,path:[...r.path,"allOf",0]}),i=rn(a.right,t,{...r,path:[...r.path,"allOf",1]}),o=c=>"allOf"in c&&Object.keys(c).length===1,u=[...o(s)?s.allOf:[s],...o(i)?i.allOf:[i]];n.allOf=u},pU=(e,t,n,r)=>{const a=n,s=e._zod.def;a.type="object";const i=s.keyType,u=i._zod.bag?.patterns;if(s.mode==="loose"&&u&&u.size>0){const p=rn(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});a.patternProperties={};for(const d of u)a.patternProperties[d.source]=p}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(a.propertyNames=rn(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),a.additionalProperties=rn(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const c=i._zod.values;if(c){const p=[...c].filter(d=>typeof d=="string"||typeof d=="number");p.length>0&&(a.required=p)}},fU=(e,t,n,r)=>{const a=e._zod.def,s=rn(a.innerType,t,r),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=a.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},mU=(e,t,n,r)=>{const a=e._zod.def;rn(a.innerType,t,r);const s=t.seen.get(e);s.ref=a.innerType},hU=(e,t,n,r)=>{const a=e._zod.def;rn(a.innerType,t,r);const s=t.seen.get(e);s.ref=a.innerType,n.default=JSON.parse(JSON.stringify(a.defaultValue))},gU=(e,t,n,r)=>{const a=e._zod.def;rn(a.innerType,t,r);const s=t.seen.get(e);s.ref=a.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(a.defaultValue)))},bU=(e,t,n,r)=>{const a=e._zod.def;rn(a.innerType,t,r);const s=t.seen.get(e);s.ref=a.innerType;let i;try{i=a.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},EU=(e,t,n,r)=>{const a=e._zod.def,s=a.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?a.out:a.in:a.out;rn(i,t,r);const o=t.seen.get(e);o.ref=i},xU=(e,t,n,r)=>{const a=e._zod.def;rn(a.innerType,t,r);const s=t.seen.get(e);s.ref=a.innerType,n.readOnly=!0},wv=(e,t,n,r)=>{const a=e._zod.def;rn(a.innerType,t,r);const s=t.seen.get(e);s.ref=a.innerType},yU=re("ZodISODateTime",(e,t)=>{T8.init(e,t),Yt.init(e,t)});function TU(e){return _B(yU,e)}const SU=re("ZodISODate",(e,t)=>{S8.init(e,t),Yt.init(e,t)});function vU(e){return CB(SU,e)}const wU=re("ZodISOTime",(e,t)=>{v8.init(e,t),Yt.init(e,t)});function AU(e){return kB(wU,e)}const NU=re("ZodISODuration",(e,t)=>{w8.init(e,t),Yt.init(e,t)});function _U(e){return IB(NU,e)}const CU=(e,t)=>{rv.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>fj(e,n)},flatten:{value:n=>pj(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,fd,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,fd,2)}},isEmpty:{get(){return e.issues.length===0}}})},ir=re("ZodError",CU,{Parent:Error}),kU=cb(ir),IU=db(ir),RU=bu(ir),DU=Eu(ir),OU=gj(ir),LU=bj(ir),FU=Ej(ir),MU=xj(ir),PU=yj(ir),jU=Tj(ir),BU=Sj(ir),UU=vj(ir),Ex=new WeakMap;function Qi(e,t,n){const r=Object.getPrototypeOf(e);let a=Ex.get(r);if(a||(a=new Set,Ex.set(r,a)),!a.has(t)){a.add(t);for(const s in n){const i=n[s];Object.defineProperty(r,s,{configurable:!0,enumerable:!1,get(){const o=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:o}),o},set(o){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:o})}})}}}const qt=re("ZodType",(e,t)=>(Vt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:fl(e,"input"),output:fl(e,"output")}}),e.toJSONSchema=XB(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,r)=>kU(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>RU(e,n,r),e.parseAsync=async(n,r)=>IU(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>DU(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>OU(e,n,r),e.decode=(n,r)=>LU(e,n,r),e.encodeAsync=async(n,r)=>FU(e,n,r),e.decodeAsync=async(n,r)=>MU(e,n,r),e.safeEncode=(n,r)=>PU(e,n,r),e.safeDecode=(n,r)=>jU(e,n,r),e.safeEncodeAsync=async(n,r)=>BU(e,n,r),e.safeDecodeAsync=async(n,r)=>UU(e,n,r),Qi(e,"ZodType",{check(...n){const r=this.def;return this.clone(ra(r,{checks:[...r.checks??[],...n.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return aa(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(O7(n,r))},superRefine(n,r){return this.check(L7(n,r))},overwrite(n){return this.check(Ss(n))},optional(){return Sx(this)},exactOptional(){return y7(this)},nullable(){return vx(this)},nullish(){return Sx(vx(this))},nonoptional(n){return N7(this,n)},array(){return bt(this)},or(n){return p7([this,n])},and(n){return g7(this,n)},transform(n){return wx(this,Cv(n))},default(n){return v7(this,n)},prefault(n){return A7(this,n)},catch(n){return C7(this,n)},pipe(n){return wx(this,n)},readonly(){return R7(this)},describe(n){const r=this.clone();return Ys.add(r,{description:n}),r},meta(...n){if(n.length===0)return Ys.get(this);const r=this.clone();return Ys.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return Ys.get(e)?.description},configurable:!0}),e)),Av=re("_ZodString",(e,t)=>{pb.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(r,a,s)=>JB(e,r,a);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Qi(e,"_ZodString",{regex(...r){return this.check(MB(...r))},includes(...r){return this.check(BB(...r))},startsWith(...r){return this.check(UB(...r))},endsWith(...r){return this.check($B(...r))},min(...r){return this.check(pl(...r))},max(...r){return this.check(xv(...r))},length(...r){return this.check(yv(...r))},nonempty(...r){return this.check(pl(1,...r))},lowercase(r){return this.check(PB(r))},uppercase(r){return this.check(jB(r))},trim(){return this.check(HB())},normalize(...r){return this.check(zB(...r))},toLowerCase(){return this.check(GB())},toUpperCase(){return this.check(WB())},slugify(){return this.check(VB())}})}),$U=re("ZodString",(e,t)=>{pb.init(e,t),Av.init(e,t),e.email=n=>e.check(iB(zU,n)),e.url=n=>e.check(dB(HU,n)),e.jwt=n=>e.check(NB(a7,n)),e.emoji=n=>e.check(pB(GU,n)),e.guid=n=>e.check(mx(xx,n)),e.uuid=n=>e.check(oB(Ao,n)),e.uuidv4=n=>e.check(lB(Ao,n)),e.uuidv6=n=>e.check(uB(Ao,n)),e.uuidv7=n=>e.check(cB(Ao,n)),e.nanoid=n=>e.check(fB(WU,n)),e.guid=n=>e.check(mx(xx,n)),e.cuid=n=>e.check(mB(VU,n)),e.cuid2=n=>e.check(hB(qU,n)),e.ulid=n=>e.check(gB(YU,n)),e.base64=n=>e.check(vB(t7,n)),e.base64url=n=>e.check(wB(n7,n)),e.xid=n=>e.check(bB(ZU,n)),e.ksuid=n=>e.check(EB(KU,n)),e.ipv4=n=>e.check(xB(XU,n)),e.ipv6=n=>e.check(yB(QU,n)),e.cidrv4=n=>e.check(TB(JU,n)),e.cidrv6=n=>e.check(SB(e7,n)),e.e164=n=>e.check(AB(r7,n)),e.datetime=n=>e.check(TU(n)),e.date=n=>e.check(vU(n)),e.time=n=>e.check(AU(n)),e.duration=n=>e.check(_U(n))});function V(e){return sB($U,e)}const Yt=re("ZodStringFormat",(e,t)=>{zt.init(e,t),Av.init(e,t)}),zU=re("ZodEmail",(e,t)=>{p8.init(e,t),Yt.init(e,t)}),xx=re("ZodGUID",(e,t)=>{c8.init(e,t),Yt.init(e,t)}),Ao=re("ZodUUID",(e,t)=>{d8.init(e,t),Yt.init(e,t)}),HU=re("ZodURL",(e,t)=>{f8.init(e,t),Yt.init(e,t)}),GU=re("ZodEmoji",(e,t)=>{m8.init(e,t),Yt.init(e,t)}),WU=re("ZodNanoID",(e,t)=>{h8.init(e,t),Yt.init(e,t)}),VU=re("ZodCUID",(e,t)=>{g8.init(e,t),Yt.init(e,t)}),qU=re("ZodCUID2",(e,t)=>{b8.init(e,t),Yt.init(e,t)}),YU=re("ZodULID",(e,t)=>{E8.init(e,t),Yt.init(e,t)}),ZU=re("ZodXID",(e,t)=>{x8.init(e,t),Yt.init(e,t)}),KU=re("ZodKSUID",(e,t)=>{y8.init(e,t),Yt.init(e,t)}),XU=re("ZodIPv4",(e,t)=>{A8.init(e,t),Yt.init(e,t)}),QU=re("ZodIPv6",(e,t)=>{N8.init(e,t),Yt.init(e,t)}),JU=re("ZodCIDRv4",(e,t)=>{_8.init(e,t),Yt.init(e,t)}),e7=re("ZodCIDRv6",(e,t)=>{C8.init(e,t),Yt.init(e,t)}),t7=re("ZodBase64",(e,t)=>{k8.init(e,t),Yt.init(e,t)}),n7=re("ZodBase64URL",(e,t)=>{R8.init(e,t),Yt.init(e,t)}),r7=re("ZodE164",(e,t)=>{D8.init(e,t),Yt.init(e,t)}),a7=re("ZodJWT",(e,t)=>{L8.init(e,t),Yt.init(e,t)}),Nv=re("ZodNumber",(e,t)=>{fv.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(r,a,s)=>eU(e,r,a),Qi(e,"ZodNumber",{gt(r,a){return this.check(gx(r,a))},gte(r,a){return this.check(fc(r,a))},min(r,a){return this.check(fc(r,a))},lt(r,a){return this.check(hx(r,a))},lte(r,a){return this.check(pc(r,a))},max(r,a){return this.check(pc(r,a))},int(r){return this.check(yx(r))},safe(r){return this.check(yx(r))},positive(r){return this.check(gx(0,r))},nonnegative(r){return this.check(fc(0,r))},negative(r){return this.check(hx(0,r))},nonpositive(r){return this.check(pc(0,r))},multipleOf(r,a){return this.check(bx(r,a))},step(r,a){return this.check(bx(r,a))},finite(){return this}});const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function xe(e){return RB(Nv,e)}const s7=re("ZodNumberFormat",(e,t)=>{F8.init(e,t),Nv.init(e,t)});function yx(e){return DB(s7,e)}const i7=re("ZodBoolean",(e,t)=>{M8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>tU(e,n,r)});function Jr(e){return OB(i7,e)}const o7=re("ZodUnknown",(e,t)=>{P8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>rU()});function os(){return LB(o7)}const l7=re("ZodNever",(e,t)=>{j8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>nU(e,n,r)});function u7(e){return FB(l7,e)}const c7=re("ZodArray",(e,t)=>{B8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>lU(e,n,r,a),e.element=t.element,Qi(e,"ZodArray",{min(n,r){return this.check(pl(n,r))},nonempty(n){return this.check(pl(1,n))},max(n,r){return this.check(xv(n,r))},length(n,r){return this.check(yv(n,r))},unwrap(){return this.element}})});function bt(e,t){return qB(c7,e,t)}const d7=re("ZodObject",(e,t)=>{$8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>uU(e,n,r,a),It(e,"shape",()=>t.shape),Qi(e,"ZodObject",{keyof(){return Je(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:os()})},loose(){return this.clone({...this._zod.def,catchall:os()})},strict(){return this.clone({...this._zod.def,catchall:u7()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return ij(this,n)},safeExtend(n){return oj(this,n)},merge(n){return lj(this,n)},pick(n){return aj(this,n)},omit(n){return sj(this,n)},partial(...n){return uj(kv,this,n[0])},required(...n){return cj(Iv,this,n[0])}})});function Ae(e,t){const n={type:"object",shape:e??{},...$e(t)};return new d7(n)}const _v=re("ZodUnion",(e,t)=>{gv.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>cU(e,n,r,a),e.options=t.options});function p7(e,t){return new _v({type:"union",options:e,...$e(t)})}const f7=re("ZodDiscriminatedUnion",(e,t)=>{_v.init(e,t),z8.init(e,t)});function m7(e,t,n){return new f7({type:"union",options:t,discriminator:e,...$e(n)})}const h7=re("ZodIntersection",(e,t)=>{H8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>dU(e,n,r,a)});function g7(e,t){return new h7({type:"intersection",left:e,right:t})}const Tx=re("ZodRecord",(e,t)=>{G8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>pU(e,n,r,a),e.keyType=t.keyType,e.valueType=t.valueType});function yu(e,t,n){return!t||!t._zod?new Tx({type:"record",keyType:V(),valueType:e,...$e(t)}):new Tx({type:"record",keyType:e,valueType:t,...$e(n)})}const hd=re("ZodEnum",(e,t)=>{W8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(r,a,s)=>aU(e,r,a),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,a)=>{const s={};for(const i of r)if(n.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new hd({...t,checks:[],...$e(a),entries:s})},e.exclude=(r,a)=>{const s={...t.entries};for(const i of r)if(n.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new hd({...t,checks:[],...$e(a),entries:s})}});function Je(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new hd({type:"enum",entries:n,...$e(t)})}const b7=re("ZodLiteral",(e,t)=>{V8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>sU(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ur(e,t){return new b7({type:"literal",values:Array.isArray(e)?e:[e],...$e(t)})}const E7=re("ZodTransform",(e,t)=>{q8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>oU(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new QS(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(_i(s,n.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),n.issues.push(_i(i))}};const a=t.transform(n.value,n);return a instanceof Promise?a.then(s=>(n.value=s,n.fallback=!0,n)):(n.value=a,n.fallback=!0,n)}});function Cv(e){return new E7({type:"transform",transform:e})}const kv=re("ZodOptional",(e,t)=>{bv.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>wv(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function Sx(e){return new kv({type:"optional",innerType:e})}const x7=re("ZodExactOptional",(e,t)=>{Y8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>wv(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function y7(e){return new x7({type:"optional",innerType:e})}const T7=re("ZodNullable",(e,t)=>{Z8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>fU(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function vx(e){return new T7({type:"nullable",innerType:e})}const S7=re("ZodDefault",(e,t)=>{K8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>hU(e,n,r,a),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function v7(e,t){return new S7({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():tv(t)}})}const w7=re("ZodPrefault",(e,t)=>{X8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>gU(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function A7(e,t){return new w7({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():tv(t)}})}const Iv=re("ZodNonOptional",(e,t)=>{Q8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>mU(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function N7(e,t){return new Iv({type:"nonoptional",innerType:e,...$e(t)})}const _7=re("ZodCatch",(e,t)=>{J8.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>bU(e,n,r,a),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function C7(e,t){return new _7({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Rv=re("ZodPipe",(e,t)=>{Ev.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>EU(e,n,r,a),e.in=t.in,e.out=t.out});function wx(e,t){return new Rv({type:"pipe",in:e,out:t})}const k7=re("ZodPreprocess",(e,t)=>{Rv.init(e,t),eB.init(e,t)}),I7=re("ZodReadonly",(e,t)=>{tB.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>xU(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function R7(e){return new I7({type:"readonly",innerType:e})}const D7=re("ZodCustom",(e,t)=>{nB.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(n,r,a)=>iU(e,n)});function O7(e,t={}){return YB(D7,e,t)}function L7(e,t){return ZB(e,t)}function mc(e,t){return new k7({type:"pipe",in:Cv(e),out:t})}const rr=["backlog","todo","wip","testing","blocked","done","cancelled"],vs=["backlog","active","verifying","blocked","done","cancelled"],F7={backlog:"📋",todo:"🔲",wip:"🚧",testing:"🧪",blocked:"🚫",done:"✅",cancelled:"⛔"};function fb(e){try{return F7[Ov(e)]??""}catch{return""}}const Tu=["P0","P1","P2","P3"],M7=["simple","standard","complex","research","refine","plan","unit","review","docs"],Dv=["task","issue","review","meta","brainstorm"],Su=["standard","feature-impl","issue","review","meta","brainstorm"],mb=/^[A-Z][1-9]*$/,P7={completed:"done",complete:"done","in-progress":"wip","in progress":"wip",in_progress:"wip",dropped:"cancelled",cancel:"cancelled",canceled:"cancelled",new:"backlog",pending:"backlog",blocked:"blocked",wip:"wip",testing:"testing",done:"done",cancelled:"cancelled",backlog:"backlog",todo:"todo"};function Ov(e){const t=e.trim().toLowerCase(),n=P7[t];if(n===void 0)throw new Error(`Unknown task status: ${JSON.stringify(e)} (allowed: ${rr.join(", ")})`);return n}const ml=V().min(1).refine(e=>!Number.isNaN(Date.parse(e)),{message:"must be an ISO 8601 timestamp"}),Lv=V().regex(mb,{message:"feature id must match ^[A-Z][1-9]*$ (DD-14)"}).nullable().optional(),Fv=V().regex(/^\d{4}$/,{message:"parent_wbs must be a 4-digit WBS string"}).nullable().optional();Ae({schema_version:ur(1),name:V().min(1),description:V().optional(),status:mc(e=>{if(typeof e=="string")try{return Ov(e)}catch{}return e},Je(rr)),type:Je(Dv).optional().default("task"),template:Je(Su).optional(),profile:Je(M7).optional(),feature_id:Lv,parent_wbs:Fv,priority:Je(Tu).optional(),tags:bt(V()).optional(),dependencies:bt(V()).optional(),ac_numbering:ur("task-local").optional(),ac_altitude:Je(["graduating","task-local"]).optional(),done_forced:mc(e=>typeof e=="string"?e==="true":e,Jr().optional()),done_reason:V().optional(),feature_link_declined:mc(e=>typeof e=="string"?e==="true":e,Jr().optional()),created_at:ml,updated_at:ml});Ae({schema_version:ur(1),id:V().regex(mb,{message:"feature id must match ^[A-Z][1-9]*$ (DD-14)"}),name:V().min(1),status:Je(vs),priority:Je(Tu).optional(),tags:bt(V()).optional(),created_at:ml,updated_at:ml});const j7=Ae({name:V().min(1,"name is required"),background:V().optional(),requirements:V().optional(),design:V().optional(),plan:V().optional(),acceptance_criteria:V().optional(),feature_id:Lv,parent_wbs:Fv,priority:Je(Tu).optional(),tags:bt(V()).optional(),template:Je(Su).optional()}).strict();bt(j7).min(1,"batch must contain at least one task");const B7=["NOT_FOUND","VALIDATION_FAILED","GUARD_DENIED","LOCK_TIMEOUT","CONFLICT","INTERNAL_ERROR"];function Bt(e){return Ae({ok:ur(!0),data:e})}Ae({ok:ur(!1),error:Ae({code:Je(B7),message:V(),details:os().optional()})});Ae({nextCursor:V().optional(),hasMore:Jr(),limit:xe().int().positive()});const qn=V().regex(mb,{message:"feature id must match ^[A-Z][1-9]*$ (DD-14)"}),U7=Ae({id:qn,name:V().min(1),status:Je(vs),priority:Je(Tu).optional(),parentId:qn.nullable().optional(),wbsCount:xe().int().nonnegative().optional()}),$7=Bt(bt(U7)),z7=Bt(Ae({id:qn,name:V(),status:Je(vs),frontmatter:yu(V(),os()),content:V(),filePath:V()})),H7=Ae({id:qn}),G7=Ae({name:V().min(1),parentId:qn.optional()}),W7=Bt(Ae({id:V(),filePath:V()})),V7=Ae({id:qn,toStatus:Je(vs),actor:V().optional()}),q7=Bt(Ae({id:V(),status:Je(vs)})),Y7=Ae({id:qn,body:V(),actor:V().optional()}),Z7=Bt(Ae({})),K7=Je(["brainstorm","plan"]),X7=Je(["claude","codex","gemini","pi","opencode","antigravity","openclaw"]),Q7=Ae({id:qn,action:K7,channel:X7.optional(),skipDeps:Jr().optional()}),J7=Ae({runId:V(),action:V(),status:ur("queued")}),e9=Bt(J7),t9=Ae({id:qn,name:V().min(1)}),n9=Bt(Ae({id:V(),filePath:V()})),r9=Ae({id:qn,title:V().min(1)}),a9=Bt(Ae({wbs:V(),filePath:V()})),s9=Ae({id:qn,wbs:V().regex(/^\d{4}$/)}),i9=Bt(Ae({})),Mv=Je(["pull","push"]),o9=Ae({id:qn,direction:Mv}),l9=Bt(Ae({direction:Mv,affectedTasks:xe().int().nonnegative(),applied:Jr(),newStatus:V().optional()})),u9={list:Mt.route({method:"GET",path:"/features",summary:"List features",tags:["feature"]}).output($7),show:Mt.route({method:"GET",path:"/features/{id}",summary:"Show feature detail",tags:["feature"]}).input(H7).output(z7),create:Mt.route({method:"POST",path:"/features",summary:"Create a feature",tags:["feature"]}).input(G7).output(W7),transition:Mt.route({method:"PATCH",path:"/features/{id}/status",summary:"Transition feature status",tags:["feature"]}).input(V7).output(q7),refresh:Mt.route({method:"POST",path:"/features/refresh",summary:"Refresh feature index and kanban",tags:["feature"]}).output(Bt(Ae({rebuilt:xe().int().nonnegative()}))),check:Mt.route({method:"POST",path:"/features/{id}/check",summary:"Run the four-layer feature check",tags:["feature"]}).input(Ae({id:qn})).output(Bt(Ae({id:V(),status:V(),pass:Jr(),findings:bt(Ae({layer:Je(["L1","L2","L3","L4"]),severity:Je(["error","warning","info"]),section:V(),message:V()})),requiredSections:bt(V()),missingSections:bt(V())}))),body:Mt.route({method:"PATCH",path:"/features/{id}/body",summary:"Update feature body",tags:["feature"]}).input(Y7).output(Z7),action:Mt.route({method:"POST",path:"/features/{id}/action",summary:"Run a feature workflow action",tags:["feature"]}).input(Q7).output(e9),children:Mt.route({method:"POST",path:"/features/{id}/children",summary:"Create a child feature",tags:["feature"]}).input(t9).output(n9),tasks:Mt.route({method:"POST",path:"/features/{id}/tasks",summary:"Create a task linked to feature",tags:["feature"]}).input(r9).output(a9),link:Mt.route({method:"PATCH",path:"/features/{id}/link",summary:"Link an existing task to feature",tags:["feature"]}).input(s9).output(i9),sync:Mt.route({method:"POST",path:"/features/{id}/sync",summary:"Sync feature status with linked tasks",tags:["feature"]}).input(o9).output(l9)},c9=Je(["24h","7d","30d","all","custom"]),d9=Je(["auto","5m","10m","30m","1h","4h","1d"]),p9=Je(["model","source","tool","skill"]),hl=Ae({range:c9.default("30d"),from:V().datetime().optional(),to:V().datetime().optional(),sources:bt(V()).optional(),models:bt(V()).optional(),tools:bt(V()).optional(),skills:bt(V()).optional(),bucket:d9.default("auto"),dimension:p9.default("model")}),Pv=Ae({billedTokens:xe(),cacheSavedTokens:xe(),cacheReadTokens:xe(),freshInputTokens:xe(),outputTokens:xe()}),Ax=Ae({totalBilledTokens:xe(),cacheSavedTokens:xe(),cacheSavedPercent:xe(),sessionsCount:xe(),toolCallsCount:xe(),errorRate:xe()}),f9=Ae({day:V(),totalBilledTokens:xe(),cacheSavedTokens:xe(),sessionsCount:xe(),toolCallsCount:xe(),cacheHitRatio:xe()}),Nx=Ae({bucketStart:V(),cacheHitRatio:xe(),series:yu(V(),xe())}),_x=Ae({id:V(),label:V(),color:V(),tokens:xe(),share:xe()}),m9=Ae({id:V(),count:xe(),errors:xe(),errorRate:xe()}),h9=Ae({id:V(),label:V(),color:V(),count:xe()}),g9=Ae({hitRatio:xe(),savedTokens:xe(),totalRead:xe()}),b9=Ae({kpis:Ax,timeSeries:bt(Nx),topModels:bt(_x),topSources:bt(_x),topTools:bt(m9),skillsUsed:bt(h9),cacheEfficiency:g9,kpiTrend:bt(f9),previousKpis:Ax.nullable(),skillTimeSeries:bt(Nx)}),E9=Bt(b9),x9=Je(["read","write","bash","search","run","user","assistant","unknown"]),y9=Je(["measured","inferred","unmeasured"]),T9=Je(["exact","estimated"]),S9=m7("mode",[Ae({mode:ur("session"),source:V().min(1),sessionId:V().min(1)}),Ae({mode:ur("consolidated"),filter:hl.optional(),taskWbs:V().optional(),runId:V().optional()})]),v9=Ae({seq:xe(),eventType:Je(["message","tool"]),kind:x9,title:V(),toolName:V().nullable(),durationMs:xe().nullable(),durationSource:y9,tokens:xe(),freshInputTokens:xe(),cacheReadTokens:xe(),outputTokens:xe(),promptTokens:Pv.nullable(),exitCode:xe().nullable(),payload:V().nullable(),agent:V(),model:V()}),w9=Ae({key:V(),sessionId:V(),turnIndex:xe(),timestamp:V().nullable(),source:V(),model:V(),correlationExactness:T9.nullable(),totalDurationMs:xe(),totalTokens:xe(),operationCount:xe(),events:bt(v9)}),A9=Ae({sessionId:V().nullable(),source:V().nullable(),model:V().nullable(),start:V().nullable(),end:V().nullable(),durationMs:xe(),tokens:Pv,messageCount:xe(),toolCallCount:xe(),sessionCount:xe()}),N9=Ae({mode:Je(["session","consolidated"]),scope:A9,truncated:Jr(),blocks:bt(w9)}),_9=Bt(N9),C9=Ae({id:V(),source:V(),model:V(),modelDetail:V().optional(),start:V(),durationMs:xe(),messages:xe(),toolCalls:xe(),billedTokens:xe(),cacheReadTokens:xe(),freshInputTokens:xe(),outputTokens:xe(),topTool:V(),state:V()}),k9=Ae({items:bt(C9),total:xe(),page:xe(),pageSize:xe()}),I9=Bt(k9),R9=Ae({filter:hl.optional(),page:xe().int().min(1).default(1),pageSize:xe().int().min(1).max(100).default(20),sortBy:Je(["start","duration","messages","toolCalls","billedTokens","cacheRead","freshInput"]).default("start"),sortDir:Je(["asc","desc"]).default("desc")}),D9=Ae({tool:V(),argsHint:V(),sessionId:V(),repeats:xe(),fromSeq:xe(),toSeq:xe(),wastedTokens:xe()}),O9=Ae({sessionId:V(),timestamp:V(),freshTokens:xe(),reason:V()}),L9=Ae({id:V(),source:V(),model:V(),tokens:xe(),durationMs:xe()}),Cx=Ae({stepIndex:xe(),sessionId:V(),toolName:V(),tokens:xe(),durationMs:xe().optional(),agent:V(),model:V()}),F9=Ae({model:V(),speedMsMean:xe(),cacheRatio:xe(),reliability:xe(),outputRatio:xe()}),M9=Ae({loops:bt(D9),cacheWaste:bt(O9),heavySessions:bt(L9),largestTokenSteps:bt(Cx),slowSteps:bt(Cx),modelComparison:bt(F9)}),P9=Bt(M9),j9=Ae({date:V(),tokens:xe(),sessions:xe()}),B9=Ae({id:V(),name:V(),color:V(),importPath:V(),filePattern:V(),filesCount:xe(),sizeMb:xe().nullable(),sessionCount:xe(),totalTokens:xe(),cacheSavedTokens:xe(),freshTokens:xe(),toolCalls:xe(),firstDate:V().nullable(),lastDate:V().nullable(),heatmapDays:bt(j9),maxDailyTokens:xe()}),U9=Ae({agentId:V(),agentName:V(),path:V(),matchPattern:V(),fileCount:xe(),status:Je(["active","empty","missing"])}),$9=Ae({totalFiles:xe(),corpusSizeBytes:xe(),dateCoverage:Ae({from:V().nullable(),to:V().nullable()}),totalSessions:xe(),lastImportedAt:V().nullable()}),z9=Ae({overview:$9,agents:bt(B9),roots:bt(U9)}),H9=Bt(z9),G9=Ae({mode:Je(["full","incremental"]).default("incremental")}),W9=Ae({runId:V(),status:Je(["queued","coalesced","already-running"]),message:V()}),V9=Bt(W9),q9={getSummary:Mt.route({method:"POST",path:"/history/summary",summary:"Get conversation history analytics summary",tags:["history"]}).input(hl.optional()).output(E9),getTimeline:Mt.route({method:"POST",path:"/history/timeline",summary:"Get chronological session or consolidated execution timeline",tags:["history"]}).input(S9).output(_9),getSessions:Mt.route({method:"POST",path:"/history/sessions",summary:"List and filter conversation sessions",tags:["history"]}).input(R9).output(I9),getInsights:Mt.route({method:"POST",path:"/history/insights",summary:"Get conversation forensic insights and loops",tags:["history"]}).input(hl.optional()).output(P9),getSources:Mt.route({method:"GET",path:"/history/sources",summary:"Get all-time agent sources overview and heatmaps",tags:["history"]}).output(H9),triggerImport:Mt.route({method:"POST",path:"/history/import",summary:"Trigger history transcript import and analysis",tags:["history"]}).input(G9).output(V9)},Y9=Bt(Ae({eventName:V(),occurredAt:V().datetime(),actor:V().nullable().optional(),payload:yu(V(),os())})),Z9={stream:Mt.route({method:"GET",path:"/events/planning",summary:"Stream planning events (SSE)",tags:["events"]}).output(Y9)},K9=Ae({wbs:V().regex(/^\d{4}$/),name:V().min(1),status:Je(rr),priority:V().optional(),featureId:V().nullable().optional(),parentWbs:V().regex(/^\d{4}$/).nullable().optional(),type:Je(Dv).optional(),filePath:V(),updatedAt:V().optional()}),X9=Bt(bt(K9)),Q9=Ae({folder:V().optional(),status:V().optional(),parent:V().optional()}),J9=Bt(Ae({wbs:V(),name:V(),status:Je(rr),frontmatter:yu(V(),os()),content:V(),filePath:V()})),e$=Ae({wbs:V().regex(/^\d{4}$/)}),t$=Ae({title:V().min(1),featureId:V().optional(),parentWbs:V().regex(/^\d{4}$/).optional(),folder:V().optional(),template:Je(Su).optional()}),n$=Bt(Ae({wbs:V(),filePath:V()})),r$=Ae({wbs:V().regex(/^\d{4}$/),toStatus:Je(rr),actor:V().optional()}),a$=Bt(Ae({wbs:V(),status:Je(rr)})),s$=Ae({wbs:V().regex(/^\d{4}$/),body:V(),actor:V().optional()}),i$=Bt(Ae({wbs:V(),filePath:V()})),o$=Je(["claude","codex","gemini","pi","opencode","antigravity","openclaw"]),l$=Je(["refine","plan","run","verify","decompose","evaluate"]),u$=Ae({wbs:V().regex(/^\d{4}$/),action:l$,channel:o$.optional(),skipDeps:Jr().optional()}),c$=Bt(Ae({runId:V(),action:V(),status:ur("queued")})),d$=Ae({path:V(),label:V().optional()}),p$=Bt(bt(d$)).extend({activeFolder:V().optional()}),f$={list:Mt.route({method:"GET",path:"/tasks",summary:"List tasks",tags:["task"]}).input(Q9).output(X9),folders:Mt.route({method:"GET",path:"/tasks/folders",summary:"List configured task folders",tags:["task"]}).output(p$),show:Mt.route({method:"GET",path:"/tasks/{wbs}",summary:"Show task detail",tags:["task"]}).input(e$).output(J9),create:Mt.route({method:"POST",path:"/tasks",summary:"Create a task",tags:["task"]}).input(t$).output(n$),transition:Mt.route({method:"PATCH",path:"/tasks/{wbs}/status",summary:"Transition task status",tags:["task"]}).input(r$).output(a$),body:Mt.route({method:"PATCH",path:"/tasks/{wbs}/body",summary:"Update task body",tags:["task"]}).input(s$).output(i$),action:Mt.route({method:"POST",path:"/tasks/{wbs}/actions",summary:"Run a task action",tags:["task"]}).input(u$).output(c$)},m$=Ae({status:ur("ok"),timestamp:V(),service:ur("spur"),version:V()}),h$={health:Mt.route({method:"GET",path:"/health",summary:"Read application health",tags:["system"]}).output(m$),task:{...f$},feature:{...u9},history:{...q9},...Z9};class g$ extends KS{initRuntimeAdapter(t){for(const n of this.plugins)n.initRuntimeAdapter?.(t)}}class b${fetch;toFetchRequestOptions;adapterInterceptors;constructor(t){new g$(t.plugins).initRuntimeAdapter(t),this.fetch=t.fetch??globalThis.fetch.bind(globalThis),this.toFetchRequestOptions=t,this.adapterInterceptors=ul(t.adapterInterceptors)}async call(t,n,r,a){const s=BP(t,this.toFetchRequestOptions),i=await ud(this.adapterInterceptors,{...n,request:s,path:r,input:a,init:{redirect:"manual"}},({request:u,path:c,input:p,init:d,...f})=>this.fetch(u,d,f,c,p));return UP(i,{signal:s.signal})}}class E${maxArrayIndex;constructor(t={}){this.maxArrayIndex=t.maxBracketNotationArrayIndex??9999}serialize(t,n=[],r=[]){if(Array.isArray(t))t.forEach((a,s)=>{this.serialize(a,[...n,s],r)});else if(Zr(t))for(const a in t)this.serialize(t[a],[...n,a],r);else r.push([this.stringifyPath(n),t]);return r}deserialize(t){if(t.length===0)return{};const n=new WeakSet,r={value:[]};for(const[a,s]of t){const i=this.parsePath(a);let o=r,u="value";i.forEach((c,p)=>{!Array.isArray(o[u])&&!Zr(o[u])&&(o[u]=[]),p!==i.length-1?Array.isArray(o[u])&&!kx(c,this.maxArrayIndex)&&(n.has(o[u])?(n.delete(o[u]),o[u]=Ix(o[u])):o[u]=hc(o[u])):Array.isArray(o[u])&&(c===""?o[u].length&&!n.has(o[u])&&(o[u]=hc(o[u])):n.has(o[u])?(n.delete(o[u]),o[u]=Ix(o[u])):kx(c,this.maxArrayIndex)||(o[u]=hc(o[u]))),o=o[u],u=c}),Array.isArray(o)&&u===""?(n.add(o),o.push(s)):u in o?Array.isArray(o[u])?o[u].push(s):o[u]=[o[u],s]:o[u]=s}return r.value}stringifyPath(t){return t.map(n=>n.toString().replace(/[\\[\]]/g,r=>{switch(r){case"\\":return"\\\\";case"[":return"\\[";case"]":return"\\]";default:return r}})).reduce((n,r,a)=>a===0?r:`${n}[${r}]`,"")}parsePath(t){const n=[];let r=!1,a="",s=0;for(let i=0;i<t.length;i++){const o=t[i],u=t[i+1];r&&o==="]"&&(u===void 0||u==="[")&&s%2===0?(u===void 0&&(r=!1),n.push(a),a="",i++):n.length===0&&o==="["&&s%2===0?(r=!0,n.push(a),a=""):o==="\\"?s++:(a+="\\".repeat(s/2)+o,s=0)}return r||n.length===0?[t]:n}}function kx(e,t){return/^0$|^[1-9]\d*$/.test(e)&&Number(e)<=t}function hc(e){const t=new jS;return e.forEach((n,r)=>{t[r]=n}),t}function Ix(e){const t=new jS;return t[""]=e.length===1?e[0]:e,t}class x${customSerializers;constructor(t={}){this.customSerializers=t.customJsonSerializers??[]}serialize(t,n={value:!1}){for(const r of this.customSerializers)if(r.condition(t))return this.serialize(r.serialize(t),n);if(t instanceof Blob)return n.value=!0,[t,n.value];if(t instanceof Set)return this.serialize(Array.from(t),n);if(t instanceof Map)return this.serialize(Array.from(t.entries()),n);if(Array.isArray(t))return[t.map(a=>a===void 0?null:this.serialize(a,n)[0]),n.value];if(Zr(t)){const r={};for(const a in t)a==="toJSON"&&typeof t[a]=="function"||(r[a]=this.serialize(t[a],n)[0]);return[r,n.value]}return typeof t=="bigint"||t instanceof RegExp||t instanceof URL?[t.toString(),n.value]:t instanceof Date?[Number.isNaN(t.getTime())?null:t.toISOString(),n.value]:Number.isNaN(t)?[null,n.value]:[t,n.value]}}function gd(e){return`/${e.replace(/\/{2,}/g,"/").replace(/^\/|\/$/g,"")}`}function Rx(e){return e?gd(e).match(/\/\{[^}]+\}/g)?.map(t=>({raw:t,name:t.match(/\{\+?([^}]+)\}/)[1]})):void 0}class y${constructor(t,n,r){this.contract=t,this.serializer=n,this.baseUrl=r.url,this.headers=r.headers??{},this.customErrorResponseBodyDecoder=r.customErrorResponseBodyDecoder}baseUrl;headers;customErrorResponseBodyDecoder;async encode(t,n,r){let a=zP(await XE(this.headers,r,t,n));r.lastEventId!==void 0&&(a=QE(a,{"last-event-id":r.lastEventId}));const s=await XE(this.baseUrl,r,t,n),i=KE(this.contract,t);if(!pd(i))throw new Error(`[StandardOpenapiLinkCodec] expect a contract procedure at ${t.join(".")}`);return So("defaultInputStructure",i["~orpc"].route.inputStructure)==="compact"?this.#e(i,t,n,r,s,a):this.#t(i,t,n,r,s,a)}#e(t,n,r,a,s,i){let o=gd(t["~orpc"].route.path??ex(n)),u=r;const c=Rx(o);if(c?.length){if(!Zr(r))throw new TypeError(`[StandardOpenapiLinkCodec] Invalid input shape for "compact" structure when has dynamic params at ${n.join(".")}.`);const f={...r};for(const m of c){const b=r[m.name];o=o.replace(m.raw,`/${encodeURIComponent(`${this.serializer.serialize(b)}`)}`),delete f[m.name]}u=Object.keys(f).length?f:void 0}const p=So("defaultMethod",t["~orpc"].route.method),d=new URL(s);if(d.pathname=`${d.pathname.replace(/\/$/,"")}${o}`,p==="GET"){const f=this.serializer.serialize(u,{outputFormat:"URLSearchParams"});for(const[m,b]of f)d.searchParams.append(m,b);return{url:d,method:p,headers:i,body:void 0,signal:a.signal}}return{url:d,method:p,headers:i,body:this.serializer.serialize(u),signal:a.signal}}#t(t,n,r,a,s,i){let o=gd(t["~orpc"].route.path??ex(n));const u=Rx(o);if(!Zr(r)&&r!==void 0)throw new TypeError(`[StandardOpenapiLinkCodec] Invalid input shape for "detailed" structure at ${n.join(".")}.`);if(u?.length){if(!Zr(r?.params))throw new TypeError(`[StandardOpenapiLinkCodec] Invalid input.params shape for "detailed" structure when has dynamic params at ${n.join(".")}.`);for(const f of u){const m=r.params[f.name];o=o.replace(f.raw,`/${encodeURIComponent(`${this.serializer.serialize(m)}`)}`)}}let c=i;if(r?.headers!==void 0){if(!Zr(r.headers))throw new TypeError(`[StandardOpenapiLinkCodec] Invalid input.headers shape for "detailed" structure at ${n.join(".")}.`);c=QE(r.headers,i)}const p=So("defaultMethod",t["~orpc"].route.method),d=new URL(s);if(d.pathname=`${d.pathname.replace(/\/$/,"")}${o}`,r?.query!==void 0){const f=this.serializer.serialize(r.query,{outputFormat:"URLSearchParams"});for(const[m,b]of f)d.searchParams.append(m,b)}return p==="GET"?{url:d,method:p,headers:c,body:void 0,signal:a.signal}:{url:d,method:p,headers:c,body:this.serializer.serialize(r?.body),signal:a.signal}}async decode(t,n,r){const a=!wi(t.status),s=await(async()=>{let u=!1;try{const c=await t.body();return u=!0,this.serializer.deserialize(c)}catch(c){throw u?new Error("Invalid OpenAPI response format.",{cause:c}):new Error("Cannot parse response body, please check the response body and content-type.",{cause:c})}})();if(!a){const u=this.customErrorResponseBodyDecoder?.(s,t);throw u??($S(s)?zS(s):new vi(HP(t.status),{status:t.status,data:{...t,body:s}}))}const i=KE(this.contract,r);if(!pd(i))throw new Error(`[StandardOpenapiLinkCodec] expect a contract procedure at ${r.join(".")}`);return So("defaultOutputStructure",i["~orpc"].route.outputStructure)==="compact"?s:{status:t.status,headers:t.headers,body:s}}}class T${constructor(t,n){this.jsonSerializer=t,this.bracketNotation=n}serialize(t,n={}){return Si(t)&&!n.outputFormat?JE(t,{value:async r=>this.#e(r,{outputFormat:"plain"}),error:async r=>new Ai({data:this.#e(vP(r).toJSON(),{outputFormat:"plain"}),cause:r})}):this.#e(t,n)}#e(t,n){const[r,a]=this.jsonSerializer.serialize(t);if(n.outputFormat==="plain")return r;if(n.outputFormat==="URLSearchParams"){const i=new URLSearchParams;for(const[o,u]of this.bracketNotation.serialize(r))(typeof u=="string"||typeof u=="number"||typeof u=="boolean")&&i.append(o,u.toString());return i}if(r instanceof Blob||r===void 0||!a)return r;const s=new FormData;for(const[i,o]of this.bracketNotation.serialize(r))typeof o=="string"||typeof o=="number"||typeof o=="boolean"?s.append(i,o.toString()):o instanceof Blob&&s.append(i,o);return s}deserialize(t){return t instanceof URLSearchParams||t instanceof FormData?this.bracketNotation.deserialize(Array.from(t.entries())):Si(t)?JE(t,{value:async n=>n,error:async n=>n instanceof Ai&&$S(n.data)?zS(n.data,{cause:n}):n}):t}}class S$ extends $P{constructor(t,n,r){const a=new x$(r),s=new E$({maxBracketNotationArrayIndex:4294967294}),i=new T$(a,s),o=new y$(t,i,r);super(o,n,r)}}class v$ extends S${constructor(t,n){const r=new b$(n);super(t,r,n)}}function Nt(e=void 0,t=globalThis.location?.origin,n=!1){return e||(t&&t!=="null"?new URL("/api",t).toString():"http://localhost:3000/api")}function Tt(e,t=1e4){const n=new AbortController,r=setTimeout(()=>n.abort(),t),a=e.signal;a&&a.addEventListener("abort",()=>n.abort(),{once:!0});const s=new Request(e,{signal:n.signal});return fetch(s).finally(()=>clearTimeout(r))}function w$(e){return Tt(e)}function A$(e){typeof globalThis<"u"&&globalThis.dispatchEvent&&globalThis.dispatchEvent(new CustomEvent("api-error",{detail:{message:e instanceof Error?e.message:String(e)}}))}const sn=qS(new v$(h$,{url:Nt(),fetch:w$,adapterInterceptors:[mP(A$)]})),_r=()=>`${Nt()}/features`;async function N$(e){const t=await Tt(new Request(_r(),{signal:e}));if(!t.ok)throw new Error(`feature list fetch failed: ${t.status}`);const r=await t.json();if(!r.ok||!Array.isArray(r.data))throw new Error("feature list: invalid response shape");return r.data}async function Dx(e,t){const n=await Tt(new Request(`${_r()}/${encodeURIComponent(e)}`,{signal:t}));if(!n.ok)throw new Error(`feature show fetch failed: ${n.status}`);const a=await n.json();if(!a.ok||!a.data)throw new Error("feature show: invalid response shape");return a.data}async function _$(e,t,n){const r=await Tt(new Request(`${_r()}/${encodeURIComponent(e)}/status`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({id:e,toStatus:t}),signal:n})),a=await r.json();if(!r.ok){const i=a;throw new Error(i.error?.message??`transition failed: ${r.status}`)}return a.data?.status??t}async function C$(e,t){const n=await Tt(new Request(`${_r()}/${encodeURIComponent(e.id)}/body`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e),signal:t}));if(!n.ok){const a=await n.json();throw new Error(a.error?.message??`body update failed: ${n.status}`)}}async function k$(e,t){const n=await Tt(new Request(`${_r()}/${encodeURIComponent(e.id)}/action`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e),signal:t}));if(!n.ok){const s=await n.json();throw new Error(s.error?.message??`action dispatch failed: ${n.status}`)}return await n.json()}async function jv(e,t){const n=await Tt(new Request(`${_r()}/${encodeURIComponent(e.id)}/children`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e),signal:t}));if(!n.ok){const s=await n.json();throw new Error(s.error?.message??`create child failed: ${n.status}`)}return await n.json()}async function I$(e,t){const n=await Tt(new Request(_r(),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:e}),signal:t}));if(!n.ok){const i=await n.json();throw new Error(i.error?.message??`create feature failed: ${n.status}`)}const a=await n.json();if(!a.ok||!a.data)throw new Error("create feature: invalid response shape");return a.data}async function R$(e,t){const n=await Tt(new Request(`${_r()}/${encodeURIComponent(e.id)}/tasks`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e),signal:t}));if(!n.ok){const s=await n.json();throw new Error(s.error?.message??`create task failed: ${n.status}`)}return await n.json()}async function D$(e,t){const n=await Tt(new Request(`${_r()}/${encodeURIComponent(e.id)}/link`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e),signal:t}));if(!n.ok){const s=await n.json();throw new Error(s.error?.message??`link task failed: ${n.status}`)}return await n.json()}async function O$(e,t){const n=await Tt(new Request(`${_r()}/${encodeURIComponent(e.id)}/sync`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e),signal:t}));if(!n.ok){const s=await n.json();throw new Error(s.error?.message??`sync failed: ${n.status}`)}return await n.json()}var da=Jw();const L$=(function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"})(),F$=function(e){return"/"+e},Ox={},Bv=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){let u=function(c){return Promise.all(c.map(p=>Promise.resolve(p).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),o=i?.nonce||i?.getAttribute("nonce");a=u(n.map(c=>{if(c=F$(c),c in Ox)return;Ox[c]=!0;const p=c.endsWith(".css"),d=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=p?"stylesheet":L$,p||(f.as="script"),f.crossOrigin="",f.href=c,o&&f.setAttribute("nonce",o),document.head.appendChild(f),p)return new Promise((m,b)=>{f.addEventListener("load",m),f.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(i){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=i,window.dispatchEvent(o),!o.defaultPrevented)throw i}return a.then(i=>{for(const o of i||[])o.status==="rejected"&&s(o.reason);return t().catch(s)})};function Lx(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function M$(e){if(Array.isArray(e))return e}function P$(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,s,i,o=[],u=!0,c=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(u=(r=s.call(n)).done)&&(o.push(r.value),o.length!==t);u=!0);}catch(p){c=!0,a=p}finally{try{if(!u&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return o}}function j$(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
169
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function B$(e,t){return M$(e)||P$(e,t)||U$(e,t)||j$()}function U$(e,t){if(e){if(typeof e=="string")return Lx(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Lx(e,t):void 0}}const Uv=Object.entries,Fx=Object.setPrototypeOf,$$=Object.isFrozen,z$=Object.getPrototypeOf,H$=Object.getOwnPropertyDescriptor;let Tn=Object.freeze,vn=Object.seal,za=Object.create,$v=typeof Reflect<"u"&&Reflect,bd=$v.apply,Ed=$v.construct;Tn||(Tn=function(t){return t});vn||(vn=function(t){return t});bd||(bd=function(t,n){for(var r=arguments.length,a=new Array(r>2?r-2:0),s=2;s<r;s++)a[s-2]=arguments[s];return t.apply(n,a)});Ed||(Ed=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return new t(...r)});const $s=an(Array.prototype.forEach),G$=an(Array.prototype.lastIndexOf),Mx=an(Array.prototype.pop),Pa=an(Array.prototype.push),W$=an(Array.prototype.splice),Vr=Array.isArray,Zs=an(String.prototype.toLowerCase),gc=an(String.prototype.toString),Px=an(String.prototype.match),zs=an(String.prototype.replace),jx=an(String.prototype.indexOf),V$=an(String.prototype.trim),q$=an(Number.prototype.toString),Y$=an(Boolean.prototype.toString),Bx=typeof BigInt>"u"?null:an(BigInt.prototype.toString),Ux=typeof Symbol>"u"?null:an(Symbol.prototype.toString),pn=an(Object.prototype.hasOwnProperty),Hs=an(Object.prototype.toString),yn=an(RegExp.prototype.test),ia=Z$(TypeError);function an(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return bd(e,t,r)}}function Z$(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Ed(e,n)}}function Et(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Zs;if(Fx&&Fx(e,null),!Vr(t))return e;let r=t.length;for(;r--;){let a=t[r];if(typeof a=="string"){const s=n(a);s!==a&&($$(t)||(t[r]=s),a=s)}e[a]=!0}return e}function K$(e){for(let t=0;t<e.length;t++)pn(e,t)||(e[t]=null);return e}function Ln(e){const t=za(null);for(const r of Uv(e)){var n=B$(r,2);const a=n[0],s=n[1];pn(e,a)&&(Vr(s)?t[a]=K$(s):s&&typeof s=="object"&&s.constructor===Object?t[a]=Ln(s):t[a]=s)}return t}function X$(e){switch(typeof e){case"string":return e;case"number":return q$(e);case"boolean":return Y$(e);case"bigint":return Bx?Bx(e):"0";case"symbol":return Ux?Ux(e):"Symbol()";case"undefined":return Hs(e);case"function":case"object":{if(e===null)return Hs(e);const t=e,n=xr(t,"toString");if(typeof n=="function"){const r=n(t);return typeof r=="string"?r:Hs(r)}return Hs(e)}default:return Hs(e)}}function xr(e,t){for(;e!==null;){const r=H$(e,t);if(r){if(r.get)return an(r.get);if(typeof r.value=="function")return an(r.value)}e=z$(e)}function n(){return null}return n}function Q$(e){try{return yn(e,""),!0}catch{return!1}}const $x=Tn(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),bc=Tn(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ec=Tn(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),J$=Tn(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),xc=Tn(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),ez=Tn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),zx=Tn(["#text"]),Hx=Tn(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),yc=Tn(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Gx=Tn(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),No=Tn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),tz=vn(/{{[\w\W]*|^[\w\W]*}}/g),nz=vn(/<%[\w\W]*|^[\w\W]*%>/g),rz=vn(/\${[\w\W]*/g),az=vn(/^data-[\-\w.\u00B7-\uFFFF]+$/),sz=vn(/^aria-[\-\w]+$/),Wx=vn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),iz=vn(/^(?:\w+script|data):/i),oz=vn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),lz=vn(/^html$/i),uz=vn(/^[a-z][.\w]*(-[.\w]+)+$/i),Vx=vn(/<[/\w!]/g),cz=vn(/<[/\w]/g),dz=vn(/<\/no(script|embed|frames)/i),pz=vn(/\/>/i),br={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},fz=function(){return typeof window>"u"?null:window},mz=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const a="data-tt-policy-suffix";n&&n.hasAttribute(a)&&(r=n.getAttribute(a));const s="dompurify"+(r?"#"+r:"");try{return t.createPolicy(s,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},qx=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Br=function(t,n,r,a){return pn(t,n)&&Vr(t[n])?Et(a.base?Ln(a.base):{},t[n],a.transform):r};function zv(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:fz();const t=Se=>zv(Se);if(t.version="3.4.11",t.removed=[],!e||!e.document||e.document.nodeType!==br.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const r=n,a=r.currentScript;e.DocumentFragment;const s=e.HTMLTemplateElement,i=e.Node,o=e.Element,u=e.NodeFilter,c=e.NamedNodeMap;c===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const p=e.DOMParser,d=e.trustedTypes,f=o.prototype,m=xr(f,"cloneNode"),b=xr(f,"remove"),E=xr(f,"nextSibling"),x=xr(f,"childNodes"),y=xr(f,"parentNode"),S=xr(f,"shadowRoot"),w=xr(f,"attributes"),A=i&&i.prototype?xr(i.prototype,"nodeType"):null,D=i&&i.prototype?xr(i.prototype,"nodeName"):null;if(typeof s=="function"){const Se=n.createElement("template");Se.content&&Se.content.ownerDocument&&(n=Se.content.ownerDocument)}let N,T="",v,R=!1,C=0;const U=function(){if(C>0)throw ia('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},k=function(P){U(),C++;try{return N.createHTML(P)}finally{C--}},j=function(P){U(),C++;try{return N.createScriptURL(P)}finally{C--}},G=function(){return R||(v=mz(d,a),R=!0),v},$=n,te=$.implementation,H=$.createNodeIterator,se=$.createDocumentFragment,de=$.getElementsByTagName,O=r.importNode;let ne=qx();t.isSupported=typeof Uv=="function"&&typeof y=="function"&&te&&te.createHTMLDocument!==void 0;const pe=tz,L=nz,ke=rz,Re=az,Q=sz,_e=iz,fe=oz,X=uz;let Ve=Wx,ge=null;const me=Et({},[...$x,...bc,...Ec,...xc,...zx]);let Te=null;const ve=Et({},[...Hx,...yc,...Gx,...No]);let ie=Object.seal(za(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ze=null,ot=null;const rt=Object.seal(za(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ht=!0,St=!0,Ct=!1,Zt=!0,at=!1,De=!0,et=!1,Z=!1,oe=null,J=null,ue=!1,Pe=!1,qe=!1,ht=!1,Rt=!0,kt=!1;const jt="user-content-";let ae=!0,Ne=!1,ze={},je=null;const vt=Et({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Qt=null;const Le=Et({},["audio","video","img","source","image","track"]);let ft=null;const Ke=Et({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Dt="http://www.w3.org/1998/Math/MathML",nt="http://www.w3.org/2000/svg",Qe="http://www.w3.org/1999/xhtml";let wt=Qe,Kt=!1,W=null;const Be=Et({},[Dt,nt,Qe],gc),M=Tn(["mi","mo","mn","ms","mtext"]);let z=Et({},M);const Y=Tn(["annotation-xml"]);let le=Et({},Y);const be=Et({},["title","style","font","a","script"]);let Ie=null;const Ce=["application/xhtml+xml","text/html"],Oe="text/html";let we=null,Fe=null;const We=n.createElement("form"),Ue=function(P){return P instanceof RegExp||P instanceof Function},mt=function(){let P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Fe&&Fe===P)return;(!P||typeof P!="object")&&(P={}),P=Ln(P),Ie=Ce.indexOf(P.PARSER_MEDIA_TYPE)===-1?Oe:P.PARSER_MEDIA_TYPE,we=Ie==="application/xhtml+xml"?gc:Zs,ge=Br(P,"ALLOWED_TAGS",me,{transform:we}),Te=Br(P,"ALLOWED_ATTR",ve,{transform:we}),W=Br(P,"ALLOWED_NAMESPACES",Be,{transform:gc}),ft=Br(P,"ADD_URI_SAFE_ATTR",Ke,{transform:we,base:Ke}),Qt=Br(P,"ADD_DATA_URI_TAGS",Le,{transform:we,base:Le}),je=Br(P,"FORBID_CONTENTS",vt,{transform:we}),Ze=Br(P,"FORBID_TAGS",Ln({}),{transform:we}),ot=Br(P,"FORBID_ATTR",Ln({}),{transform:we}),ze=pn(P,"USE_PROFILES")?P.USE_PROFILES&&typeof P.USE_PROFILES=="object"?Ln(P.USE_PROFILES):P.USE_PROFILES:!1,Ht=P.ALLOW_ARIA_ATTR!==!1,St=P.ALLOW_DATA_ATTR!==!1,Ct=P.ALLOW_UNKNOWN_PROTOCOLS||!1,Zt=P.ALLOW_SELF_CLOSE_IN_ATTR!==!1,at=P.SAFE_FOR_TEMPLATES||!1,De=P.SAFE_FOR_XML!==!1,et=P.WHOLE_DOCUMENT||!1,Pe=P.RETURN_DOM||!1,qe=P.RETURN_DOM_FRAGMENT||!1,ht=P.RETURN_TRUSTED_TYPE||!1,ue=P.FORCE_BODY||!1,Rt=P.SANITIZE_DOM!==!1,kt=P.SANITIZE_NAMED_PROPS||!1,ae=P.KEEP_CONTENT!==!1,Ne=P.IN_PLACE||!1,Ve=Q$(P.ALLOWED_URI_REGEXP)?P.ALLOWED_URI_REGEXP:Wx,wt=typeof P.NAMESPACE=="string"?P.NAMESPACE:Qe,z=pn(P,"MATHML_TEXT_INTEGRATION_POINTS")&&P.MATHML_TEXT_INTEGRATION_POINTS&&typeof P.MATHML_TEXT_INTEGRATION_POINTS=="object"?Ln(P.MATHML_TEXT_INTEGRATION_POINTS):Et({},M),le=pn(P,"HTML_INTEGRATION_POINTS")&&P.HTML_INTEGRATION_POINTS&&typeof P.HTML_INTEGRATION_POINTS=="object"?Ln(P.HTML_INTEGRATION_POINTS):Et({},Y);const K=pn(P,"CUSTOM_ELEMENT_HANDLING")&&P.CUSTOM_ELEMENT_HANDLING&&typeof P.CUSTOM_ELEMENT_HANDLING=="object"?Ln(P.CUSTOM_ELEMENT_HANDLING):za(null);if(ie=za(null),pn(K,"tagNameCheck")&&Ue(K.tagNameCheck)&&(ie.tagNameCheck=K.tagNameCheck),pn(K,"attributeNameCheck")&&Ue(K.attributeNameCheck)&&(ie.attributeNameCheck=K.attributeNameCheck),pn(K,"allowCustomizedBuiltInElements")&&typeof K.allowCustomizedBuiltInElements=="boolean"&&(ie.allowCustomizedBuiltInElements=K.allowCustomizedBuiltInElements),vn(ie),at&&(St=!1),qe&&(Pe=!0),ze&&(ge=Et({},zx),Te=za(null),ze.html===!0&&(Et(ge,$x),Et(Te,Hx)),ze.svg===!0&&(Et(ge,bc),Et(Te,yc),Et(Te,No)),ze.svgFilters===!0&&(Et(ge,Ec),Et(Te,yc),Et(Te,No)),ze.mathMl===!0&&(Et(ge,xc),Et(Te,Gx),Et(Te,No))),rt.tagCheck=null,rt.attributeCheck=null,pn(P,"ADD_TAGS")&&(typeof P.ADD_TAGS=="function"?rt.tagCheck=P.ADD_TAGS:Vr(P.ADD_TAGS)&&(ge===me&&(ge=Ln(ge)),Et(ge,P.ADD_TAGS,we))),pn(P,"ADD_ATTR")&&(typeof P.ADD_ATTR=="function"?rt.attributeCheck=P.ADD_ATTR:Vr(P.ADD_ATTR)&&(Te===ve&&(Te=Ln(Te)),Et(Te,P.ADD_ATTR,we))),pn(P,"ADD_URI_SAFE_ATTR")&&Vr(P.ADD_URI_SAFE_ATTR)&&Et(ft,P.ADD_URI_SAFE_ATTR,we),pn(P,"FORBID_CONTENTS")&&Vr(P.FORBID_CONTENTS)&&(je===vt&&(je=Ln(je)),Et(je,P.FORBID_CONTENTS,we)),pn(P,"ADD_FORBID_CONTENTS")&&Vr(P.ADD_FORBID_CONTENTS)&&(je===vt&&(je=Ln(je)),Et(je,P.ADD_FORBID_CONTENTS,we)),ae&&(ge["#text"]=!0),et&&Et(ge,["html","head","body"]),ge.table&&(Et(ge,["tbody"]),delete Ze.tbody),P.TRUSTED_TYPES_POLICY){if(typeof P.TRUSTED_TYPES_POLICY.createHTML!="function")throw ia('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof P.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ia('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const ye=N;N=P.TRUSTED_TYPES_POLICY;try{T=k("")}catch(Me){throw N=ye,Me}}else P.TRUSTED_TYPES_POLICY===null?(N=void 0,T=""):(N===void 0&&(N=G()),N&&typeof T=="string"&&(T=k("")));Tn&&Tn(P),Fe=P},gt=Et({},[...bc,...Ec,...J$]),Jt=Et({},[...xc,...ez]),en=function(P,K,ye){return K.namespaceURI===Qe?P==="svg":K.namespaceURI===Dt?P==="svg"&&(ye==="annotation-xml"||z[ye]):!!gt[P]},En=function(P,K,ye){return K.namespaceURI===Qe?P==="math":K.namespaceURI===nt?P==="math"&&le[ye]:!!Jt[P]},_t=function(P,K,ye){return K.namespaceURI===nt&&!le[ye]||K.namespaceURI===Dt&&!z[ye]?!1:!Jt[P]&&(be[P]||!gt[P])},jn=function(P){let K=y(P);(!K||!K.tagName)&&(K={namespaceURI:wt,tagName:"template"});const ye=Zs(P.tagName),Me=Zs(K.tagName);return W[P.namespaceURI]?P.namespaceURI===nt?en(ye,K,Me):P.namespaceURI===Dt?En(ye,K,Me):P.namespaceURI===Qe?_t(ye,K,Me):!!(Ie==="application/xhtml+xml"&&W[P.namespaceURI]):!1},_n=function(P){Pa(t.removed,{element:P});try{y(P).removeChild(P)}catch{if(b(P),!y(P))throw ia("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Fr=function(P){const K=x(P);if(K){const Me=[];$s(K,st=>{Pa(Me,st)}),$s(Me,st=>{try{b(st)}catch{}})}const ye=w(P);if(ye)for(let Me=ye.length-1;Me>=0;--Me){const st=ye[Me],yt=st&&st.name;if(typeof yt=="string")try{P.removeAttribute(yt)}catch{}}},Cn=function(P,K){try{Pa(t.removed,{attribute:K.getAttributeNode(P),from:K})}catch{Pa(t.removed,{attribute:null,from:K})}if(K.removeAttribute(P),P==="is")if(Pe||qe)try{_n(K)}catch{}else try{K.setAttribute(P,"")}catch{}},Zn=function(P){const K=w(P);if(K)for(let ye=K.length-1;ye>=0;--ye){const Me=K[ye],st=Me&&Me.name;if(!(typeof st!="string"||Te[we(st)]))try{P.removeAttribute(st)}catch{}}},_s=function(P){const K=[P];for(;K.length>0;){const ye=K.pop();(A?A(ye):ye.nodeType)===br.element&&Zn(ye);const st=x(ye);if(st)for(let yt=st.length-1;yt>=0;--yt)K.push(st[yt])}},Mr=function(P){let K=null,ye=null;if(ue)P="<remove></remove>"+P;else{const yt=Px(P,/^[\r\n\t ]+/);ye=yt&&yt[0]}Ie==="application/xhtml+xml"&&wt===Qe&&(P='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+P+"</body></html>");const Me=N?k(P):P;if(wt===Qe)try{K=new p().parseFromString(Me,Ie)}catch{}if(!K||!K.documentElement){K=te.createDocument(wt,"template",null);try{K.documentElement.innerHTML=Kt?T:Me}catch{}}const st=K.body||K.documentElement;return P&&ye&&st.insertBefore(n.createTextNode(ye),st.childNodes[0]||null),wt===Qe?de.call(K,et?"html":"body")[0]:et?K.documentElement:st},hr=function(P){return H.call(P.ownerDocument||P,P,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Cr=function(P){return P=zs(P,pe," "),P=zs(P,L," "),P=zs(P,ke," "),P},Pr=function(P){var K;P.normalize();const ye=H.call(P.ownerDocument||P,P,u.SHOW_TEXT|u.SHOW_COMMENT|u.SHOW_CDATA_SECTION|u.SHOW_PROCESSING_INSTRUCTION,null);let Me=ye.nextNode();for(;Me;)Me.data=Cr(Me.data),Me=ye.nextNode();const st=(K=P.querySelectorAll)===null||K===void 0?void 0:K.call(P,"template");st&&$s(st,yt=>{Gt(yt.content)&&Pr(yt.content)})},lt=function(P){const K=D?D(P):null;return typeof K!="string"||we(K)!=="form"?!1:typeof P.nodeName!="string"||typeof P.textContent!="string"||typeof P.removeChild!="function"||P.attributes!==w(P)||typeof P.removeAttribute!="function"||typeof P.setAttribute!="function"||typeof P.namespaceURI!="string"||typeof P.insertBefore!="function"||typeof P.hasChildNodes!="function"||P.nodeType!==A(P)||P.childNodes!==x(P)},Gt=function(P){if(!A||typeof P!="object"||P===null)return!1;try{return A(P)===br.documentFragment}catch{return!1}},Kn=function(P){if(!A||typeof P!="object"||P===null)return!1;try{return typeof A(P)=="number"}catch{return!1}};function xn(Se,P,K){Se.length!==0&&$s(Se,ye=>{ye.call(t,P,K,Fe)})}const Ut=function(P,K){return!!(De&&P.hasChildNodes()&&!Kn(P.firstElementChild)&&yn(Vx,P.textContent)&&yn(Vx,P.innerHTML)||De&&P.namespaceURI===Qe&&K==="style"&&Kn(P.firstElementChild)||P.nodeType===br.processingInstruction||De&&P.nodeType===br.comment&&yn(cz,P.data))},Oa=function(P,K){if(!Ze[K]&&Db(K)&&(ie.tagNameCheck instanceof RegExp&&yn(ie.tagNameCheck,K)||ie.tagNameCheck instanceof Function&&ie.tagNameCheck(K)))return!1;if(ae&&!je[K]){const ye=y(P),Me=x(P);if(Me&&ye){const st=Me.length;for(let yt=st-1;yt>=0;--yt){const un=Ne?Me[yt]:m(Me[yt],!0);ye.insertBefore(un,E(P))}}}return _n(P),!0},Cs=function(P){if(xn(ne.beforeSanitizeElements,P,null),lt(P))return _n(P),!0;const K=we(D?D(P):P.nodeName);if(xn(ne.uponSanitizeElement,P,{tagName:K,allowedTags:ge}),Ut(P,K))return _n(P),!0;if(Ze[K]||!(rt.tagCheck instanceof Function&&rt.tagCheck(K))&&!ge[K])return Oa(P,K);if((A?A(P):P.nodeType)===br.element&&!jn(P)||(K==="noscript"||K==="noembed"||K==="noframes")&&yn(dz,P.innerHTML))return _n(P),!0;if(at&&P.nodeType===br.text){const Me=Cr(P.textContent);P.textContent!==Me&&(Pa(t.removed,{element:P.cloneNode()}),P.textContent=Me)}return xn(ne.afterSanitizeElements,P,null),!1},ro=function(P,K,ye){if(ot[K]||Rt&&(K==="id"||K==="name")&&(ye in n||ye in We))return!1;const Me=Te[K]||rt.attributeCheck instanceof Function&&rt.attributeCheck(K,P);if(!(St&&yn(Re,K))){if(!(Ht&&yn(Q,K))){if(Me){if(!ft[K]){if(!yn(Ve,zs(ye,fe,""))){if(!((K==="src"||K==="xlink:href"||K==="href")&&P!=="script"&&jx(ye,"data:")===0&&Qt[P])){if(!(Ct&&!yn(_e,zs(ye,fe,"")))){if(ye)return!1}}}}}else if(!(Db(P)&&(ie.tagNameCheck instanceof RegExp&&yn(ie.tagNameCheck,P)||ie.tagNameCheck instanceof Function&&ie.tagNameCheck(P))&&(ie.attributeNameCheck instanceof RegExp&&yn(ie.attributeNameCheck,K)||ie.attributeNameCheck instanceof Function&&ie.attributeNameCheck(K,P))||K==="is"&&ie.allowCustomizedBuiltInElements&&(ie.tagNameCheck instanceof RegExp&&yn(ie.tagNameCheck,ye)||ie.tagNameCheck instanceof Function&&ie.tagNameCheck(ye))))return!1}}return!0},Zw=Et({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Db=function(P){return!Zw[Zs(P)]&&yn(X,P)},Kw=function(P,K,ye,Me){if(N&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!ye)switch(d.getAttributeType(P,K)){case"TrustedHTML":return k(Me);case"TrustedScriptURL":return j(Me)}return Me},Xw=function(P,K,ye,Me){try{ye?P.setAttributeNS(ye,K,Me):P.setAttribute(K,Me),lt(P)?_n(P):Mx(t.removed)}catch{Cn(K,P)}},Ob=function(P){xn(ne.beforeSanitizeAttributes,P,null);const K=P.attributes;if(!K||lt(P))return;const ye={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Te,forceKeepAttr:void 0};let Me=K.length;const st=we(P.nodeName);for(;Me--;){const yt=K[Me],un=yt.name,tn=yt.namespaceURI,Xn=yt.value,or=we(un),ku=Xn;let Dn=un==="value"?ku:V$(ku);if(ye.attrName=or,ye.attrValue=Dn,ye.keepAttr=!0,ye.forceKeepAttr=void 0,xn(ne.uponSanitizeAttribute,P,ye),Dn=ye.attrValue,kt&&(or==="id"||or==="name")&&jx(Dn,jt)!==0&&(Cn(un,P),Dn=jt+Dn),De&&yn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Dn)){Cn(un,P);continue}if(or==="attributename"&&Px(Dn,"href")){Cn(un,P);continue}if(!ye.forceKeepAttr){if(!ye.keepAttr){Cn(un,P);continue}if(!Zt&&yn(pz,Dn)){Cn(un,P);continue}if(at&&(Dn=Cr(Dn)),!ro(st,or,Dn)){Cn(un,P);continue}Dn=Kw(st,or,tn,Dn),Dn!==ku&&Xw(P,un,tn,Dn)}}xn(ne.afterSanitizeAttributes,P,null)},ao=function(P){let K=null;const ye=hr(P);for(xn(ne.beforeSanitizeShadowDOM,P,null);K=ye.nextNode();)if(xn(ne.uponSanitizeShadowNode,K,null),Cs(K),Ob(K),Gt(K.content)&&ao(K.content),(A?A(K):K.nodeType)===br.element){const st=S(K);Gt(st)&&(Cu(st),ao(st))}xn(ne.afterSanitizeShadowDOM,P,null)},Cu=function(P){const K=[{node:P,shadow:null}];for(;K.length>0;){const ye=K.pop();if(ye.shadow){ao(ye.shadow);continue}const Me=ye.node,yt=(A?A(Me):Me.nodeType)===br.element,un=x(Me);if(un)for(let tn=un.length-1;tn>=0;--tn)K.push({node:un[tn],shadow:null});if(yt){const tn=D?D(Me):null;if(typeof tn=="string"&&we(tn)==="template"){const Xn=Me.content;Gt(Xn)&&K.push({node:Xn,shadow:null})}}if(yt){const tn=S(Me);Gt(tn)&&K.push({node:null,shadow:tn},{node:tn,shadow:null})}}};return t.sanitize=function(Se){let P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},K=null,ye=null,Me=null,st=null;if(Kt=!Se,Kt&&(Se="<!-->"),typeof Se!="string"&&!Kn(Se)&&(Se=X$(Se),typeof Se!="string"))throw ia("dirty is not a string, aborting");if(!t.isSupported)return Se;Z?(ge=oe,Te=J):mt(P),(ne.uponSanitizeElement.length>0||ne.uponSanitizeAttribute.length>0)&&(ge=Ln(ge)),ne.uponSanitizeAttribute.length>0&&(Te=Ln(Te)),t.removed=[];const yt=Ne&&typeof Se!="string"&&Kn(Se);if(yt){const Xn=D?D(Se):Se.nodeName;if(typeof Xn=="string"){const or=we(Xn);if(!ge[or]||Ze[or])throw ia("root node is forbidden and cannot be sanitized in-place")}if(lt(Se))throw ia("root node is clobbered and cannot be sanitized in-place");try{Cu(Se)}catch(or){throw Fr(Se),or}}else if(Kn(Se))K=Mr("<!---->"),ye=K.ownerDocument.importNode(Se,!0),ye.nodeType===br.element&&ye.nodeName==="BODY"||ye.nodeName==="HTML"?K=ye:K.appendChild(ye),Cu(ye);else{if(!Pe&&!at&&!et&&Se.indexOf("<")===-1)return N&&ht?k(Se):Se;if(K=Mr(Se),!K)return Pe?null:ht?T:""}K&&ue&&_n(K.firstChild);const un=hr(yt?Se:K);try{for(;Me=un.nextNode();)Cs(Me),Ob(Me),Gt(Me.content)&&ao(Me.content)}catch(Xn){throw yt&&Fr(Se),Xn}if(yt)return $s(t.removed,Xn=>{Xn.element&&_s(Xn.element)}),at&&Pr(Se),Se;if(Pe){if(at&&Pr(K),qe)for(st=se.call(K.ownerDocument);K.firstChild;)st.appendChild(K.firstChild);else st=K;return(Te.shadowroot||Te.shadowrootmode)&&(st=O.call(r,st,!0)),st}let tn=et?K.outerHTML:K.innerHTML;return et&&ge["!doctype"]&&K.ownerDocument&&K.ownerDocument.doctype&&K.ownerDocument.doctype.name&&yn(lz,K.ownerDocument.doctype.name)&&(tn="<!DOCTYPE "+K.ownerDocument.doctype.name+`>
|
|
170
|
+
`+tn),at&&(tn=Cr(tn)),N&&ht?k(tn):tn},t.setConfig=function(){let Se=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};mt(Se),Z=!0,oe=ge,J=Te},t.clearConfig=function(){Fe=null,Z=!1,oe=null,J=null,N=v,T=""},t.isValidAttribute=function(Se,P,K){Fe||mt({});const ye=we(Se),Me=we(P);return ro(ye,Me,K)},t.addHook=function(Se,P){typeof P=="function"&&pn(ne,Se)&&Pa(ne[Se],P)},t.removeHook=function(Se,P){if(pn(ne,Se)){if(P!==void 0){const K=G$(ne[Se],P);return K===-1?void 0:W$(ne[Se],K,1)[0]}return Mx(ne[Se])}},t.removeHooks=function(Se){pn(ne,Se)&&(ne[Se]=[])},t.removeAllHooks=function(){ne=qx()},t}var hz=zv();function gz({code:e}){const t=g.useId().replace(/:/g,""),n=g.useRef(null),[r,a]=g.useState(null),[s,i]=g.useState(!1);return g.useEffect(()=>{let o=!1;return(async()=>{try{const u=(await Bv(async()=>{const{default:d}=await import("./mermaid.core.CbxtJS3Q.js").then(f=>f.bl);return{default:d}},__vite__mapDeps([0,1]))).default;u.initialize({startOnLoad:!1,theme:"dark",securityLevel:"strict"});const c=await u.render(`mermaid-${t}`,e),p=hz.sanitize(c.svg,{USE_PROFILES:{svg:!0,svgFilters:!0}});o||a(p)}catch{o||i(!0)}})(),()=>{o=!0}},[e,t]),g.useEffect(()=>{n.current&&(n.current.innerHTML=r??"")},[r]),s?l.jsx("pre",{children:l.jsx("code",{children:e})}):l.jsx("div",{ref:n,className:"mermaid-diagram flex justify-center","data-testid":"mermaid-diagram"})}function bz(e){return(e??"").match(/language-(\w+)/)?.[1]??null}function xd(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(xd).join(""):typeof e=="object"&&"props"in e?xd(e.props.children):""}function Ez({className:e,children:t,...n}){return bz(e)==="mermaid"?l.jsx(gz,{code:xd(t).trim()}):l.jsx("code",{className:e,...n,children:t})}function xz({source:e}){return l.jsx(ol.Markdown,{source:e,wrapperElement:{"data-color-mode":"light"},components:{code:Ez}})}function gl({targetVar:e,onResizeEnd:t,direction:n="horizontal",invert:r=!1}){const a=g.useRef(null),s=g.useCallback(o=>{o.preventDefault();const u=document.documentElement,p=getComputedStyle(u).getPropertyValue(e).trim(),d=parseFloat(p)||0;a.current={x:o.clientX,y:o.clientY,w:d},o.target.setPointerCapture(o.pointerId);const f=b=>{if(!a.current)return;const E=n==="horizontal"?b.clientX-a.current.x:b.clientY-a.current.y,x=r?-E:E,y=Math.max(0,a.current.w+x);u.style.setProperty(e,`${y}px`)},m=()=>{if(!a.current)return;const b=getComputedStyle(u).getPropertyValue(e).trim(),E=parseFloat(b)||a.current.w;t(Math.round(E)),a.current=null,window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",m)};window.addEventListener("pointermove",f),window.addEventListener("pointerup",m,{once:!0})},[e,t,n,r]),i=n==="horizontal";return l.jsx("hr",{"data-testid":`resize-handle-${i?"h":"v"}`,"aria-orientation":i?"vertical":"horizontal","aria-label":i?"Resize sidebar":"Resize panel",tabIndex:0,className:"resize-handle shrink-0 bg-spur-border hover:bg-spur-accent cursor-col-resize transition-colors border-0",style:{width:i?4:"100%",height:i?"100%":4,margin:0},onPointerDown:s})}const Yx="spur:new-task-panel-width",Zx=384,Tc=384;function Kx({id:e,label:t,placeholder:n,value:r,mode:a,onChange:s,onModeChange:i,disabled:o}){return l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1.5",children:[l.jsxs("label",{htmlFor:e,className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide",children:[t," ",l.jsx("span",{className:"text-spur-text-muted font-normal",children:"(optional, markdown)"})]}),l.jsxs("fieldset",{className:"flex items-center gap-1",children:[l.jsxs("legend",{className:"sr-only",children:[t," mode"]}),l.jsx(Ge,{type:"button",variant:a==="edit"?"primary":"ghost",size:"xs",onClick:()=>i("edit"),disabled:o,"aria-pressed":a==="edit",children:"Edit"}),l.jsx(Ge,{type:"button",variant:a==="preview"?"primary":"ghost",size:"xs",onClick:()=>i("preview"),disabled:o,"aria-pressed":a==="preview",children:"Preview"})]})]}),a==="edit"?l.jsx("div",{className:"min-h-40","data-testid":`${e}-editor`,children:l.jsx(ol,{value:r,onChange:u=>s(u??""),height:160,textareaProps:{id:e,placeholder:n,disabled:o,"aria-label":t},"data-color-mode":"dark"})}):l.jsx("div",{className:"min-h-40 rounded border border-spur-border bg-spur-bg p-3 text-sm text-spur-text overflow-y-auto","data-testid":`${e}-preview`,children:r.trim()?l.jsx(ol.Markdown,{source:r,"data-color-mode":"dark"}):l.jsx("p",{className:"text-xs text-spur-text-muted",children:n})})]})}function Hv({open:e,onClose:t,onCreated:n,folder:r,featureId:a}){const[s,i]=g.useState(""),[o,u]=g.useState(""),[c,p]=g.useState(""),[d,f]=g.useState("edit"),[m,b]=g.useState("edit"),[E,x]=g.useState("standard"),[y,S]=g.useState(!1),[w,A]=g.useState(""),[D,N]=g.useState(!1),[T,v]=g.useState(()=>{if(typeof window>"u")return Zx;try{const k=Number.parseFloat(window.localStorage.getItem(Yx)??"");if(Number.isFinite(k)&&k>0)return Math.max(Tc,Math.min(k,window.innerWidth*.9))}catch{}return Zx}),R=D&&s.trim()===""?"Name is required":"";g.useEffect(()=>{document.documentElement.style.setProperty("--new-task-panel-w",`${T}px`)},[T]);const C=()=>{y||(i(""),u(""),p(""),f("edit"),b("edit"),x("standard"),A(""),N(!1),t())},U=async()=>{N(!0);const k=s.trim();if(k!==""){S(!0),A("");try{const G=(await sn.task.create({title:k,folder:r,template:E,featureId:a})).data.wbs,$=[];if(o.trim()&&$.push(`### Background
|
|
171
171
|
${o.trim()}`),c.trim()&&$.push(`### Requirements
|
|
172
172
|
${c.trim()}`),$.length>0)try{await sn.task.body({wbs:G,body:$.join(`
|
|
173
173
|
|
|
174
|
-
`)})}catch(te){const H=te instanceof Error?te.message:"Body seeding failed";typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:`Task created but body seeding failed: ${H}`}}))}C(),n()}catch(j){const G=j instanceof Error?j.message:"Create failed";A(G),typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:G}}))}finally{S(!1)}}};return e?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-40",onClick:C,"aria-hidden":"true"}),l.jsxs("div",{className:"fixed inset-y-0 right-0 max-w-[90vw] bg-spur-surface border-l border-spur-border z-50 flex shadow-2xl",style:{width:T,minWidth:Tc},role:"dialog","aria-label":"New Task",children:[l.jsx(gl,{targetVar:"--new-task-panel-w",onResizeEnd:k=>{const j=typeof window<"u"?window.innerWidth*.9:k,G=Math.max(Tc,Math.min(k,j));v(G);try{window.localStorage.setItem(Yx,String(G))}catch{}},direction:"horizontal",invert:!0}),l.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[l.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-spur-border shrink-0",children:[l.jsx("h2",{className:"text-sm font-semibold text-spur-text",children:"New Task"}),l.jsx(Ge,{variant:"ghost",size:"sm",className:"text-spur-text-muted",onClick:C,"aria-label":"Close",disabled:y,children:"✕"})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[l.jsxs("div",{children:[l.jsxs("label",{htmlFor:"new-task-name",className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide block mb-1.5",children:["Name ",l.jsx("span",{className:"text-spur-error",children:"*"})]}),l.jsx(Ti,{id:"new-task-name",type:"text",variant:"bordered",size:"sm",error:!!R,className:"w-full bg-spur-bg text-spur-text",placeholder:"Task name",value:s,onChange:k=>{i(k.target.value),D||N(!0)},onBlur:()=>N(!0),disabled:y}),R&&l.jsx("p",{className:"text-xs text-spur-error mt-1",children:R})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"new-task-template",className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide block mb-1.5",children:"Template"}),l.jsx(Xr,{id:"new-task-template",variant:"bordered",size:"sm",className:"w-full bg-spur-bg text-spur-text",value:E,onChange:k=>x(k.target.value),disabled:y,children:Su.map(k=>l.jsx("option",{value:k,children:k},k))})]}),l.jsx(Kx,{id:"new-task-background",label:"Background",placeholder:"Why this task exists…",value:o,mode:d,onChange:u,onModeChange:f,disabled:y}),l.jsx(Kx,{id:"new-task-requirements",label:"Requirements",placeholder:"What must be done…",value:c,mode:m,onChange:p,onModeChange:b,disabled:y}),w&&l.jsx("div",{className:"text-xs text-spur-error bg-spur-error/10 border border-spur-error/20 rounded p-2",children:w})]}),l.jsxs("div",{className:"flex items-center justify-end gap-2 p-4 border-t border-spur-border shrink-0",children:[l.jsx(Ge,{variant:"ghost",size:"sm",className:"text-spur-text-muted",onClick:C,disabled:y,children:"Cancel"}),l.jsx(Ge,{variant:"primary",size:"sm",onClick:U,disabled:y,children:y?"Creating…":"Create Task"})]})]})]})]}):null}const yz=5e3,Tz=()=>`${Nt()}/events/planning`,Sz=async(e={})=>sn.task.list(e);class Gv{state={tasks:[],subtaskProgress:new Map,loading:!0,error:null,connected:!1,lastSyncAt:void 0};listeners=[];interval;eventSource;refCount=0;listFn;constructor(t=Sz){this.listFn=t}getState=()=>this.state;setListFn=t=>{t!==this.listFn&&(this.listFn=t,this.refresh())};subscribe=t=>(this.listeners.push(t),this.refCount++,this.refCount===1&&(this.refresh(),this.interval=setInterval(this.refresh,yz),this.connectSSE()),()=>{this.listeners=this.listeners.filter(n=>n!==t),this.refCount--,this.refCount===0&&(this.interval&&(clearInterval(this.interval),this.interval=void 0),this.disconnectSSE())});refresh=async()=>{try{const n=(await this.listFn()).data??[];this.state={tasks:n,subtaskProgress:Xx(n),loading:!1,error:null,connected:this.state.connected,lastSyncAt:Date.now()}}catch(t){this.state={...this.state,loading:!1,error:t}}this.emit()};setTasks=t=>{const n=typeof t=="function"?t(this.state.tasks):t;this.state={...this.state,tasks:n,subtaskProgress:Xx(n),lastSyncAt:Date.now()},this.emit()};handleSSEOpen=()=>{this.state={...this.state,connected:!0},this.emit()};handleSSEMessage=()=>{this.refresh()};handleSSEError=()=>{this.state={...this.state,connected:!1},this.emit()};async connectSSE(){if(this.eventSource||typeof EventSource>"u")return;const t=new EventSource(Tz());this.eventSource=t,t.onopen=this.handleSSEOpen,t.onmessage=this.handleSSEMessage,t.onerror=this.handleSSEError}disconnectSSE(){this.eventSource&&(this.eventSource.close(),this.eventSource=void 0,this.state={...this.state,connected:!1})}emit(){for(const t of this.listeners)t()}}const Wv=g.createContext(null);let Sc=null;function vz(){return Sc||(Sc=new Gv),Sc}function Xx(e){const t=new Map;for(const n of e){if(!n.parentWbs)continue;const r=t.get(n.parentWbs)??{done:0,total:0};r.total+=1,n.status==="done"&&(r.done+=1),t.set(n.parentWbs,r)}return t}function hb(e){const t=g.useContext(Wv),n=g.useRef(null);e&&!n.current&&(n.current=new Gv(e));const r=n.current??t??vz();return g.useEffect(()=>{e&&n.current&&n.current.setListFn(e)},[e]),{...g.useSyncExternalStore(r.subscribe,r.getState),setTasks:r.setTasks,store:r}}function wz({progress:e,isDismissed:t,onDismiss:n,onReopen:r}){const{status:a,runId:s,action:i,error:o}=e,u=g.useRef(null);if(g.useEffect(()=>{a==="failed"&&t&&s&&u.current!==s&&(u.current=s,typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:o||`Action ${i||"job"} failed`}})))},[a,t,s,i,o]),a==="idle"||!s)return null;const c=a==="queued"||a==="running";if(t)return c?l.jsx("div",{className:"fixed bottom-4 right-4 z-40",children:l.jsxs("button",{type:"button",onClick:r,className:"flex items-center gap-2 px-3 py-1.5 bg-spur-bg border border-spur-border hover:border-spur-primary text-spur-text text-xs rounded-full shadow-md font-medium transition-colors",children:[l.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-500 animate-pulse"}),l.jsxs("span",{children:[i?`${i.charAt(0).toUpperCase()}${i.slice(1)}`:"Action"," (",a,")"]}),l.jsx("span",{className:"text-spur-text-muted",children:"⤢"})]})}):null;const p=a==="succeeded"?"success":a==="failed"?"error":a==="running"?"accent":"warning";return l.jsxs("div",{className:"fixed bottom-4 right-4 z-40 w-80 p-4 bg-spur-bg border border-spur-border rounded-lg shadow-xl backdrop-blur flex flex-col gap-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-sm font-semibold text-spur-text",children:i?`${i.charAt(0).toUpperCase()}${i.slice(1)}`:"Action"}),l.jsx(Ot,{variant:p,children:a})]}),l.jsx("button",{type:"button",onClick:n,className:"text-spur-text-muted hover:text-spur-text text-base font-bold leading-none p-1","aria-label":"Dismiss progress panel",children:"×"})]}),l.jsxs("div",{className:"text-xs text-spur-text-muted font-mono truncate",children:["ID: ",s]}),c&&l.jsxs("div",{className:"flex items-center gap-2 text-xs text-spur-text",children:[l.jsx(Ra,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:a==="queued"?"Enqueued in job runner...":"Running agent slash command..."})]}),a==="succeeded"&&l.jsx("div",{className:"text-xs text-green-400 font-medium",children:"✓ Action completed successfully."}),a==="failed"&&l.jsxs("div",{className:"text-xs text-red-400 font-medium break-words",children:["✕ ",o||"Action job failed."]}),!c&&l.jsx("div",{className:"flex justify-end pt-1",children:l.jsx(Ge,{variant:"outline",size:"sm",onClick:n,children:"Close"})})]})}const Az={backlog:["brainstorm","plan","add-child","add-task","start","cancel"],active:["add-child","add-task","link-task","sync-status","verify","block","cancel"],verifying:["sync-status","complete","rework","cancel"],blocked:["add-child","add-task","unblock","cancel"],done:[],cancelled:[]},Er={brainstorm:"Brainstorm",plan:"Plan","add-child":"+ Child","add-task":"+ Task","link-task":"Link Task","sync-status":"Sync",start:"Start",verify:"Verify",complete:"Complete",rework:"Rework",block:"Block",unblock:"Unblock",cancel:"Cancel"},Nz={start:"primary",verify:"primary",complete:"primary",unblock:"primary",brainstorm:"secondary",plan:"secondary","add-child":"secondary","add-task":"secondary","link-task":"secondary","sync-status":"secondary",block:"hazard",rework:"hazard",cancel:"hazard"},_z={start:!0,verify:!0,complete:!0,rework:!0,block:!0,unblock:!0,cancel:!0},Cz={start:"active",verify:"verifying",complete:"done",rework:"active",block:"blocked",unblock:"active",cancel:"cancelled"};function Vv({open:e,parentId:t,onClose:n,onCreated:r}){const[a,s]=g.useState(""),[i,o]=g.useState(!1),[u,c]=g.useState(""),[p,d]=g.useState(!1),f=p&&a.trim()===""?"Name is required":"",m=()=>{s(""),d(!1),c(""),n()},b=async()=>{d(!0);const E=a.trim();if(E!==""){o(!0),c("");try{t?await jv({id:t,name:E}):await I$(E),m(),r()}catch(x){const y=x instanceof Error?x.message:"Create failed";c(y)}finally{o(!1)}}};return e?l.jsx("div",{className:"fixed inset-y-0 right-0 z-40 flex","data-new-feature-panel":!0,children:l.jsxs("div",{className:"w-96 border-l border-spur-border bg-spur-surface shadow-xl flex flex-col",children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-spur-border shrink-0",children:[l.jsx("h3",{className:"text-sm font-semibold text-spur-text",children:t?"New Child Feature":"New Feature"}),l.jsx(Ge,{variant:"ghost",size:"xs",onClick:m,"aria-label":"Close panel",children:"✕"})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[t&&l.jsxs("div",{className:"text-xs text-spur-text-muted",children:["Parent: ",l.jsx("span",{className:"font-mono text-spur-accent",children:t})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"new-feature-name",className:"block text-xs font-medium text-spur-text mb-1",children:"Feature Name *"}),l.jsx(Ti,{id:"new-feature-name",value:a,onChange:E=>{s(E.target.value),p||d(!0)},onKeyDown:E=>{E.key==="Enter"&&a.trim()&&b()},placeholder:"e.g. Authentication module",disabled:i}),f&&l.jsx("p",{className:"text-xs text-red-500 mt-1",children:f}),u&&l.jsx("p",{className:"text-xs text-red-500 mt-1",children:u})]}),l.jsx("div",{className:"text-xs text-spur-text-muted",children:t?`The feature ID will be auto-allocated (next free digit under ${t}).`:"The feature ID will be auto-allocated (next free letter A–Z)."})]}),l.jsxs("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-spur-border shrink-0",children:[l.jsx(Ge,{variant:"ghost",size:"xs",onClick:m,disabled:i,children:"Cancel"}),l.jsx(Ge,{variant:"primary",size:"xs",onClick:b,disabled:i||a.trim()==="",loading:i,children:"Create Feature"})]})]})}):null}const qv={backlog:{status:"backlog",label:"Backlog",colorClass:"text-spur-text-muted",Icon:({className:e="w-3.5 h-3.5",ariaLabel:t})=>l.jsx("svg",{className:`inline-block shrink-0 ${e}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",role:"img","aria-label":t,children:l.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"2.5",strokeDasharray:"2 2"})})},active:{status:"active",label:"Active",colorClass:"text-spur-accent",Icon:({className:e="w-3.5 h-3.5",ariaLabel:t})=>l.jsx("svg",{className:`inline-block shrink-0 ${e}`,viewBox:"0 0 16 16",fill:"currentColor",role:"img","aria-label":t,children:l.jsx("circle",{cx:"8",cy:"8",r:"4.5"})})},verifying:{status:"verifying",label:"Verifying",colorClass:"text-spur-warning",Icon:({className:e="w-3.5 h-3.5",ariaLabel:t})=>l.jsxs("svg",{className:`inline-block shrink-0 ${e}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",role:"img","aria-label":t,children:[l.jsx("path",{d:"M1.5 8s2.5-4 6.5-4 6.5 4 6.5 4-2.5 4-6.5 4-6.5-4-6.5-4z"}),l.jsx("circle",{cx:"8",cy:"8",r:"2"})]})},blocked:{status:"blocked",label:"Blocked",colorClass:"text-spur-error",Icon:({className:e="w-3.5 h-3.5",ariaLabel:t})=>l.jsxs("svg",{className:`inline-block shrink-0 ${e}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":t,children:[l.jsx("path",{d:"M8 2.5l5.5 10.5H2.5L8 2.5z"}),l.jsx("path",{d:"M8 6v3"}),l.jsx("circle",{cx:"8",cy:"11.5",r:"0.5",fill:"currentColor"})]})},done:{status:"done",label:"Done",colorClass:"text-spur-success",Icon:({className:e="w-3.5 h-3.5",ariaLabel:t})=>l.jsx("svg",{className:`inline-block shrink-0 ${e}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":t,children:l.jsx("path",{d:"M3.5 8.5l3.5 3.5 5.5-7"})})},cancelled:{status:"cancelled",label:"Cancelled",colorClass:"text-spur-text-faint",Icon:({className:e="w-3.5 h-3.5",ariaLabel:t})=>l.jsxs("svg",{className:`inline-block shrink-0 ${e}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":t,children:[l.jsx("path",{d:"M5.5 2.5h5l3 3v5l-3 3h-5l-3-3v-5l3-3z"}),l.jsx("path",{d:"M6.25 6.25l3.5 3.5M9.75 6.25l-3.5 3.5"})]})}};function Yv(e){const t=qv[e.toLowerCase()];return t?t.label:`Unknown status: ${e}`}function gb({status:e,className:t}){const n=e.toLowerCase(),r=qv[n];if(r){const a=r.Icon;return l.jsx(a,{className:`${r.colorClass} ${t??"w-3.5 h-3.5"}`,ariaLabel:r.label})}return l.jsx("svg",{className:`inline-block shrink-0 text-spur-text-muted ${t??"w-3.5 h-3.5"}`,viewBox:"0 0 16 16",fill:"currentColor",role:"img","aria-label":Yv(e),children:l.jsx("circle",{cx:"8",cy:"8",r:"4"})})}function Zv(e){return e?e.startsWith("feature.")||e.startsWith("queue.job."):!1}function kz(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.jobId=="string"&&t.jobId.length>0)return t.jobId;if(typeof t.runId=="string"&&t.runId.length>0)return t.runId;if(t.job&&typeof t.job=="object"){const n=t.job;if(typeof n.id=="string"&&n.id.length>0)return n.id;if(typeof n.jobId=="string"&&n.jobId.length>0)return n.jobId}return null}function Iz(e,t){return t?kz(e)===t:!1}const vc={status:"idle"};function Rz(e,t,n){if(e.status==="idle"||!e.runId||!Iz(n,e.runId))return e;switch(t){case"queue.job.enqueued":case"queue.job.created":return{...e,status:"queued"};case"queue.job.started":case"queue.job.running":return{...e,status:"running"};case"queue.job.completed":return{...e,status:"succeeded"};case"queue.job.failed":{const r=n&&typeof n=="object"&&typeof n.error=="string"?n.error:"Job failed";return{...e,status:"failed",error:r}}default:return e}}const Dz=()=>`${Nt()}/events/planning`;function Oz(e){const[t,n]=g.useState(vc);g.useEffect(()=>{e&&n(vc)},[e]);const r=g.useCallback((s,i)=>{n({status:"queued",runId:s,action:i})},[]),a=g.useCallback(()=>{n(vc)},[]);return g.useEffect(()=>{if(typeof EventSource>"u"||!t.runId)return;const s=new EventSource(Dz());return s.onmessage=i=>{try{const o=JSON.parse(i.data),u=o.eventName;if(!Zv(u)||!u)return;n(c=>Rz(c,u,o.payload))}catch{}},()=>{s.close()}},[t.runId]),{progress:t,trackAction:r,clearProgress:a}}function Lz({featureId:e,onClose:t,refreshKey:n=0,childFeatures:r=[],onSelectFeature:a,metadataDockRef:s}){const[i,o]=g.useState(null),[u,c]=g.useState(""),[p,d]=g.useState(""),[f,m]=g.useState("preview"),[b,E]=g.useState(!1),[x,y]=g.useState(!1),[S,w]=g.useState(null),[A,D]=g.useState({}),[N,T]=g.useState(!1),[v,R]=g.useState(null),[C,U]=g.useState(null),[k,j]=g.useState(!1),[G,$]=g.useState(null),[te,H]=g.useState(null),[se,de]=g.useState(""),[O,ne]=g.useState("claude"),[pe,L]=g.useState("push"),[ke,Re]=g.useState(!1),[Q,_e]=g.useState(!1),{progress:fe,trackAction:X}=Oz(e),[Ve,ge]=g.useState(!1),me=g.useRef(null),Te=g.useRef(f);Te.current=f,g.useEffect(()=>{if(!N||k||G||te)return;const W=Be=>{Be.key==="Escape"&&T(!1)};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[N,k,G,te]);const{tasks:ve}=hb(),ie=(ve??[]).filter(W=>W.featureId===e),Ze=g.useRef(0),ot=g.useCallback(()=>++Ze.current,[]),rt=g.useCallback(W=>W===Ze.current,[]),Ht=g.useCallback(async()=>{const W=ot(),Be=await Dx(e);return rt(W)?Be:null},[e,ot,rt]),St=g.useCallback((W,Be)=>{if(o(W),me.current=W.id,D(W.frontmatter),Be?.body!==!1){const M=Fz(W.content);c(M),d(M)}},[]),Ct=g.useCallback(async W=>{const Be=await Ht();return Be&&(St(Be,W),E(!1)),Be},[Ht,St]),Zt=g.useCallback((W,Be)=>{const M=W instanceof Error?W.message:Be;U({kind:"error",message:M}),typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:M}}))},[]),at=g.useMemo(()=>({featureId:e,generation:n}),[e,n]);g.useEffect(()=>{const{featureId:W}=at;if(!W){o(null),me.current=null,c(""),d(""),m("preview"),w(null),U(null);return}const Be=me.current===W,M=Be&&Te.current==="edit";Be||(m("preview"),E(!0)),w(null);const z=ot();(async()=>{try{const Y=await Dx(W);if(!rt(z))return;St(Y,{body:!M})}catch(Y){if(!rt(z))return;w(Y instanceof Error?Y.message:"Failed to load feature")}finally{rt(z)&&E(!1)}})()},[at,ot,rt,St]);const De=async()=>{Re(!1);try{await Ct({body:!1})}catch{}},Je=async()=>{_e(!1);try{await Ct()}catch{}};if(S)return l.jsx("div",{className:"flex items-center justify-center h-full p-4",children:l.jsx("p",{className:"text-sm text-red-500",children:S})});if(!i)return l.jsx("div",{className:"flex items-center justify-center h-full text-spur-text-muted text-sm",children:"Select a feature to view details"});const Z=()=>{d(u),m("edit")},oe=()=>{d(u),m("preview")},J=async()=>{y(!0);try{await C$({id:e,body:p}),c(p),m("preview"),await Ct()}catch(W){d(u),m("preview");const Be=W instanceof Error?W.message:"Save failed";typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:Be}}))}finally{y(!1)}},ue=W=>{if(!v){if(U(null),_z[W]){qe(W);return}if(W==="brainstorm"||W==="plan"){$(W);return}if(W==="add-child"){_e(!0);return}if(W==="add-task"){Re(!0);return}if(W==="link-task"){H(W),de("");return}if(W==="sync-status"){$("sync-status");return}}},Pe=async W=>{const Be=Cz[W];if(Be){R(W),U(null);try{const M=await _$(e,Be);o(z=>z&&{...z,status:M}),await Ct({body:!1}),U({kind:"ok",message:`${Er[W]??W}: status is now ${M}.`})}catch(M){Zt(M,"Transition failed")}finally{R(null)}}},qe=async W=>{if(W==="cancel"){j(!0);return}await Pe(W)},ht=async()=>{j(!1),await Pe("cancel")},Rt=async()=>{const W=te;if(!(!W||!se.trim())){H(null),R(W),U(null);try{W==="add-child"?await jv({id:e,name:se.trim()}):W==="add-task"?await R$({id:e,title:se.trim()}):W==="link-task"&&await D$({id:e,wbs:se.trim()}),await Ct({body:!1}),U({kind:"ok",message:`${Er[W]??W} completed.`})}catch(Be){Zt(Be,"Action failed")}finally{R(null)}}},kt=async()=>{if(!G)return;const W=G;$(null),R(W),U(null);try{if(W==="sync-status"){const Be=await O$({id:e,direction:pe});await Ct({body:!1});const M=Be.data?.applied,z=Be.data?.newStatus;U({kind:"ok",message:M?`Sync applied${z?`: status is now ${z}`:""}.`:"Sync finished — no status change was needed."})}else{const Be=await k$({id:e,action:W,channel:O});Be?.data?.runId&&(X(Be.data.runId,W),ge(!1)),await Ct({body:!1}),U({kind:"ok",message:`${Er[W]??W} dispatched on ${O}.`})}}catch(Be){Zt(Be,"Action failed")}finally{R(null)}},jt=W=>{if(!W)return"";try{const Be=new Date(W);return Number.isNaN(Be.getTime())?"":Be.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}},ae=W=>{if(!W)return"";try{const Be=new Date(W);if(Number.isNaN(Be.getTime()))return"";const M=Date.now()-Be.getTime(),z=Math.floor(M/864e5);return z===0?"today":z===1?"yesterday":z<30?`${z}d ago`:z<365?`${Math.floor(z/30)}mo ago`:`${Math.floor(z/365)}y ago`}catch{return""}},Ne=Array.isArray(A.tags)?A.tags:[],ze=jt(A.created_at),je=ae(A.created_at),vt=jt(A.updated_at),Qt=ae(A.updated_at),Le=W=>{window.location.assign(`/board/tasks/${W}`)},ft=Az[i.status]??[],Ke=W=>Nz[W]??"secondary",Dt=ft.filter(W=>Ke(W)==="primary"),nt=ft.filter(W=>Ke(W)==="secondary"),Qe=ft.filter(W=>Ke(W)==="hazard"),wt=!!s?.current,Kt=l.jsx("aside",{id:"feature-metadata-panel","data-testid":"feature-metadata-panel","aria-label":"Feature metadata","aria-hidden":!N,hidden:wt&&!N,className:`flex flex-col overflow-hidden bg-base-200 shadow-xl ${wt?"absolute top-0 bottom-0 left-[calc(100%_+_12px)] z-20 w-72 lg:w-80 rounded-lg border border-spur-border":`absolute inset-y-0 right-0 z-30 w-80 max-w-full border-l border-spur-border transition-transform duration-200 ${N?"translate-x-0":"translate-x-full"}`}`,children:N&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-spur-border bg-base-300/60 shrink-0",children:[l.jsxs("span",{className:"text-xs font-semibold text-spur-text flex items-center gap-1.5",children:[l.jsx("span",{children:"ℹ"})," Metadata"]}),l.jsx(Ge,{variant:"ghost",size:"xs",className:"text-spur-text-muted hover:text-spur-accent h-5 w-5 p-0 text-xs flex items-center justify-center",onClick:()=>T(!1),"aria-label":"Close metadata",title:"Close metadata",children:"✕"})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto p-3 space-y-3",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-xs text-spur-text-muted block mb-1.5",children:"Status"}),l.jsx("span",{className:"text-sm text-spur-text","data-testid":"metadata-status",children:i.status})]}),(ze||vt)&&l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("span",{className:"text-xs text-spur-text-muted block",children:"Dates"}),ze&&l.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[l.jsx("span",{className:"text-spur-text-muted w-14 shrink-0",children:"Created"}),l.jsx("span",{className:"text-spur-text",children:ze}),l.jsxs("span",{className:"text-spur-text-muted",children:["(",je,")"]})]}),vt&&l.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[l.jsx("span",{className:"text-spur-text-muted w-14 shrink-0",children:"Updated"}),l.jsx("span",{className:"text-spur-text",children:vt}),l.jsxs("span",{className:"text-spur-text-muted",children:["(",Qt,")"]})]})]}),Ne.length>0&&l.jsxs("div",{children:[l.jsx("span",{className:"text-xs text-spur-text-muted block mb-1.5",children:"Tags"}),l.jsx("div",{className:"flex flex-wrap gap-1",children:Ne.map(W=>l.jsx(Ot,{variant:"outline",size:"xs",className:"text-spur-text-muted",children:W},W))})]}),l.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[l.jsx("span",{className:"text-spur-text-muted w-14 shrink-0",children:"File"}),l.jsx("span",{className:"text-spur-text font-mono truncate",children:i.filePath})]}),r.length>0&&l.jsxs("div",{children:[l.jsxs("span",{className:"text-xs text-spur-text-muted block mb-1.5",children:["Child features (",r.length,")"]}),l.jsx("div",{className:"space-y-1",children:r.map(W=>l.jsxs("button",{type:"button",onClick:()=>a?.(W.id),className:"flex items-center gap-2 w-full text-xs text-left hover:underline cursor-pointer","aria-label":`Open child feature ${W.id}: ${W.name}`,children:[l.jsx("span",{className:"shrink-0 text-[13px]",title:W.status,children:l.jsx(gb,{status:W.status})}),l.jsx("span",{className:"font-mono text-spur-accent shrink-0",children:W.id}),l.jsx("span",{className:"text-spur-text truncate flex-1 min-w-0",children:W.name})]},W.id))})]}),l.jsxs("div",{children:[l.jsxs("span",{className:"text-xs text-spur-text-muted block mb-1.5",children:["Linked Tasks (",ie.length,")"]}),ie.length===0?l.jsx("span",{className:"text-xs text-spur-text-muted italic",children:"No linked tasks"}):l.jsx("div",{className:"space-y-1",children:ie.map(W=>l.jsxs("div",{className:"flex items-center gap-2 w-full text-xs",children:[l.jsx("span",{className:"shrink-0 text-[13px]",title:W.status,children:fb(W.status)}),l.jsxs("button",{type:"button",onClick:()=>Le(W.wbs),className:"flex items-center gap-2 flex-1 min-w-0 text-left hover:underline cursor-pointer","aria-label":`Go to task ${W.wbs}: ${W.name}`,children:[l.jsx("span",{className:"font-mono text-spur-accent shrink-0",children:W.wbs}),l.jsx("span",{className:"text-spur-text truncate",children:W.name})]}),l.jsx("span",{className:"px-1.5 py-0.5 rounded-full border border-spur-border text-[10px] text-spur-text-muted shrink-0",children:W.status})]},W.wbs))})]})]})]})});return l.jsxs("div",{className:"relative flex flex-col h-full",children:[l.jsxs("div",{className:"flex items-start justify-between gap-3 p-3 border-b border-spur-border shrink-0",children:[l.jsxs("div",{className:"flex flex-col gap-1 overflow-hidden",children:[l.jsxs("h3",{className:"text-sm font-semibold text-spur-text truncate",children:[i.id," — ",i.name]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-1","data-testid":"header-chips",children:[l.jsx("span",{className:"px-2 py-0.5 rounded-full border border-spur-border text-xs text-spur-text-muted","data-testid":"status-pill",children:i.status}),typeof i.frontmatter.priority=="string"&&l.jsx("span",{className:"px-2 py-0.5 rounded-full bg-spur-accent/15 text-xs text-spur-accent",children:i.frontmatter.priority}),Ne.map(W=>l.jsx("span",{className:"px-2 py-0.5 rounded-full border border-spur-border text-xs text-spur-text-muted",children:W},W))]})]}),l.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-1 shrink-0",children:[[["primary",Dt],["secondary",nt]].map(([W,Be])=>Be.map(M=>l.jsx(Ge,{variant:W==="primary"?"primary":"outline",size:"xs",onClick:()=>ue(M),disabled:v!==null,"aria-busy":v===M,"aria-label":Er[M],"data-action-tier":W,children:v===M?"…":Er[M]},M))),Qe.length>0&&l.jsx("div",{className:"flex items-center gap-1 border-l border-spur-border pl-1.5 ml-1.5",children:Qe.map(W=>l.jsx(Ge,{variant:"ghost",size:"xs",className:"text-spur-error",onClick:()=>ue(W),disabled:v!==null,"aria-busy":v===W,"aria-label":Er[W],"data-action-tier":"hazard",children:v===W?"…":Er[W]},W))}),f==="preview"?l.jsx(Ge,{variant:"ghost",size:"xs",className:"text-spur-text-muted hover:text-spur-accent",onClick:Z,disabled:b,"aria-label":"Edit body",children:"Edit"}):l.jsxs(l.Fragment,{children:[l.jsx(Ge,{variant:"primary",size:"xs",onClick:J,disabled:x,"aria-label":"Save body",children:x?"Saving…":"Save"}),l.jsx(Ge,{variant:"ghost",size:"xs",className:"text-spur-text-muted hover:text-spur-accent",onClick:oe,disabled:x,"aria-label":"Cancel edit",children:"Cancel"})]}),l.jsx(Ge,{variant:"ghost",size:"xs",className:"text-spur-text-muted",onClick:()=>T(W=>!W),"aria-expanded":N,"aria-controls":"feature-metadata-panel","data-testid":"metadata-toggle",children:"ℹ Metadata"}),t&&l.jsx(Ge,{variant:"ghost",size:"xs",className:"text-spur-text-muted",onClick:t,"aria-label":"Close detail",children:"✕"})]})]}),C&&l.jsx("div",{role:"status","data-testid":"action-feedback","data-kind":C.kind,className:`px-3 py-1.5 text-xs border-b border-spur-border shrink-0 ${C.kind==="error"?"bg-spur-error/10 text-spur-error":"bg-spur-success/10 text-spur-success"}`,children:C.message}),l.jsx("div",{className:"flex-1 flex flex-col overflow-hidden p-3","data-testid":"feature-body-section",children:b?l.jsxs("div",{className:"flex items-center gap-2 text-sm text-spur-text-muted",children:[l.jsx(Ra,{size:"xs",className:"text-spur-accent"}),"Loading body…"]}):f==="edit"?l.jsx("div",{className:"flex-1 min-h-0 w-full","data-testid":"body-editor",children:l.jsx(ol,{value:p,onChange:W=>d(W??""),height:"100%","data-color-mode":"light"})}):l.jsx("div",{className:"flex-1 overflow-y-auto w-full","data-testid":"body-preview",children:l.jsx(xz,{source:u})})}),k&&l.jsx("div",{role:"dialog","aria-modal":"true","aria-label":"Confirm cancel feature",tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:W=>{W.target===W.currentTarget&&j(!1)},onKeyDown:W=>{W.key==="Escape"&&j(!1)},children:l.jsxs("div",{className:"bg-spur-surface border border-spur-border rounded-lg shadow-xl p-4 mx-4 max-w-xs w-full",children:[l.jsxs("p",{className:"text-sm text-spur-text mb-4",children:["Cancel feature ",l.jsx("strong",{children:e}),"? This marks it as cancelled and cannot be undone from the board."]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(Ge,{variant:"ghost",size:"xs",onClick:()=>j(!1),children:"Keep"}),l.jsx(Ge,{variant:"error",size:"xs",onClick:ht,children:"Cancel feature"})]})]})}),G&&l.jsx("div",{role:"dialog","aria-modal":"true","aria-label":`Configure ${G} action`,tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:W=>{W.target===W.currentTarget&&$(null)},onKeyDown:W=>{W.key==="Escape"&&$(null)},children:l.jsxs("div",{className:"bg-spur-surface border border-spur-border rounded-lg shadow-xl p-4 mx-4 max-w-sm w-full",children:[G==="sync-status"?l.jsxs(l.Fragment,{children:[l.jsx("h4",{className:"text-sm font-semibold text-spur-text mb-3",children:"Sync Status — Direction"}),l.jsx("div",{className:"space-y-3",children:l.jsxs(Xr,{variant:"bordered",size:"sm",className:"w-full bg-spur-bg text-spur-text",value:pe,onChange:W=>L(W.target.value),children:[l.jsx("option",{value:"push",children:"Push (feature → tasks)"}),l.jsx("option",{value:"pull",children:"Pull (tasks → feature)"})]})})]}):l.jsxs(l.Fragment,{children:[l.jsxs("h4",{className:"text-sm font-semibold text-spur-text mb-3",children:[Er[G]," — Select Channel"]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(Xr,{variant:"bordered",size:"sm",className:"w-full bg-spur-bg text-spur-text",value:O,onChange:W=>ne(W.target.value),children:["claude","codex","gemini","pi","opencode","antigravity","openclaw"].map(W=>l.jsx("option",{value:W,children:W},W))}),l.jsxs("label",{htmlFor:"skip-deps",className:"flex items-center gap-2 cursor-pointer",children:[l.jsx(tb,{id:"skip-deps",size:"xs",checked:!1,onChange:()=>{}}),l.jsx("span",{className:"text-xs text-spur-text",children:"Skip dependencies"})]})]})]}),l.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[l.jsx(Ge,{variant:"ghost",size:"xs",onClick:()=>$(null),children:"Cancel"}),l.jsx(Ge,{variant:"primary",size:"xs",onClick:kt,children:v===G?"Dispatching…":"Dispatch"})]})]})}),te&&l.jsx("div",{role:"dialog","aria-modal":"true","aria-label":`${Er[te]} input`,tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:W=>{W.target===W.currentTarget&&H(null)},onKeyDown:W=>{W.key==="Escape"&&H(null)},children:l.jsxs("div",{className:"bg-spur-surface border border-spur-border rounded-lg shadow-xl p-4 mx-4 max-w-sm w-full",children:[l.jsx("h4",{className:"text-sm font-semibold text-spur-text mb-3",children:Er[te]}),te==="link-task"?l.jsxs(Xr,{variant:"bordered",size:"sm",className:"w-full bg-spur-bg text-spur-text",value:se,onChange:W=>de(W.target.value),children:[l.jsx("option",{value:"",children:"— Select a task —"}),(ve??[]).filter(W=>W.featureId!==e).map(W=>l.jsxs("option",{value:W.wbs,children:[W.wbs," — ",W.name]},W.wbs))]}):l.jsx("input",{type:"text",className:"w-full px-3 py-2 rounded border border-spur-border bg-spur-bg text-sm text-spur-text focus:outline-none focus:border-spur-accent",placeholder:"Enter child feature name",value:se,onChange:W=>de(W.target.value),onKeyDown:W=>{W.key==="Enter"&&se.trim()&&Rt()}}),l.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[l.jsx(Ge,{variant:"ghost",size:"xs",onClick:()=>H(null),children:"Cancel"}),l.jsx(Ge,{variant:"primary",size:"xs",onClick:Rt,disabled:!se.trim()||v===te,children:v===te?"…":"Create"})]})]})}),l.jsx(Hv,{open:ke,onClose:()=>Re(!1),onCreated:De,folder:["docs","tasks2"].join("/"),featureId:e}),l.jsx(Vv,{open:Q,parentId:e,onClose:()=>_e(!1),onCreated:Je}),l.jsx(wz,{progress:fe,isDismissed:Ve,onDismiss:()=>ge(!0),onReopen:()=>ge(!1)}),s?.current?da.createPortal(Kt,s.current):Kt]})}function Fz(e){const t=e.match(/^---\n[\s\S]*?\n---\n/);return t?e.slice(t[0].length):e}function Kv(e,t){return e.id.localeCompare(t.id)}function Mz({features:e,selectedId:t,onSelect:n}){const[r,a]=g.useState(()=>new Set),s=g.useCallback(u=>{a(c=>{const p=new Set(c);return p.has(u)?p.delete(u):p.add(u),p})},[]),i=e.filter(u=>u.id.length===1).slice().sort(Kv),o=Xv(e);return l.jsx("ul",{className:"py-1","data-feature-tree":!0,children:i.map(u=>l.jsx(Qv,{feature:u,childrenMap:o,selectedId:t,onSelect:n,collapsedIds:r,onToggleFold:s,depth:0},u.id))})}function Xv(e){const t=new Map;for(const n of e){if(n.id.length<=1)continue;const r=n.id.slice(0,-1),a=t.get(r);a?a.push(n):t.set(r,[n])}for(const n of t.values())n.sort(Kv);return t}function Qv({feature:e,childrenMap:t,selectedId:n,onSelect:r,collapsedIds:a,onToggleFold:s,depth:i}){const o=t.get(e.id),u=o!==void 0&&o.length>0,c=a.has(e.id),p=e.id===n,d=`${i*16}px`;return l.jsxs("li",{children:[l.jsxs("div",{className:`w-full flex items-center transition-colors hover:bg-base-300 ${p?"bg-spur-accent/10 text-spur-accent font-semibold":"text-spur-text"}`,style:{paddingLeft:`calc(0.25rem + ${d})`},children:[u?l.jsx("button",{type:"button",onClick:f=>{f.stopPropagation(),s(e.id)},"aria-expanded":!c,"aria-controls":`feature-tree-children-${e.id}`,"aria-label":`${c?"Expand":"Collapse"} ${e.id}: ${e.name}`,className:"p-1 hover:bg-base-100 rounded text-spur-text-muted hover:text-spur-text text-[10px] flex items-center justify-center shrink-0 w-5 h-5 cursor-pointer",children:l.jsx("span",{className:`inline-block transition-transform duration-150 ${c?"":"rotate-90"}`,"aria-hidden":"true",children:"▶"})}):l.jsx("span",{className:"w-5 shrink-0","aria-hidden":"true"}),l.jsxs("button",{type:"button",onClick:()=>r(e.id),className:`flex-1 flex items-center gap-1.5 px-1.5 py-1 text-left text-sm truncate min-w-0 cursor-pointer ${p?"bg-spur-accent/10 text-spur-accent font-semibold":"text-spur-text"}`,children:[l.jsx(J5,{position:"right",tip:Yv(e.status),className:"flex! w-4 shrink-0 items-center justify-center","data-testid":"feature-tree-status",children:l.jsx(gb,{status:e.status})}),l.jsx("span",{className:"text-xs font-mono text-spur-text-muted shrink-0",children:e.id}),l.jsx("span",{className:"flex-1 truncate",children:e.name})]})]}),u&&!c&&l.jsx("ul",{id:`feature-tree-children-${e.id}`,children:o.map(f=>l.jsx(Qv,{feature:f,childrenMap:t,selectedId:n,onSelect:r,collapsedIds:a,onToggleFold:s,depth:i+1},f.id))})]})}function Pz(){const[e,t]=g.useState(!1),[n,r]=g.useState(""),[a,s]=g.useState(null),i=()=>{r(""),s("Agent dispatch is not wired yet — this bar is UI only (F84 R6).")};return e?l.jsxs("div",{className:"fixed bottom-4 left-1/2 -translate-x-1/2 z-30 w-[calc(100vw-2rem)] max-w-[84rem] backdrop-blur-md bg-base-100/80 border border-spur-border shadow-2xl rounded-2xl p-2.5 flex flex-col gap-2","data-testid":"agent-bar",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Ot,{variant:"outline",size:"sm",className:"shrink-0 font-mono",children:"agent · stub"}),l.jsx(X5,{rows:1,value:n,onChange:o=>r(o.target.value),placeholder:"Ask a coding agent to refine or implement this feature…","aria-label":"Agent prompt",className:"flex-1 min-h-9 resize-none bg-transparent","data-testid":"agent-bar-input"}),l.jsx(Ge,{variant:"primary",size:"sm",disabled:n.trim().length===0,onClick:i,children:"Send"}),l.jsx(Ge,{variant:"ghost",size:"sm",onClick:()=>t(!1),"aria-label":"Collapse agent prompt bar","aria-expanded":!0,children:"▾"})]}),a&&l.jsx("p",{role:"status",className:"px-1 text-xs text-spur-text-muted",children:a})]}):l.jsx(Ge,{variant:"ghost",className:"fixed bottom-6 right-6 z-30 h-12 w-12 rounded-full backdrop-blur-md bg-base-100/80 border border-spur-border shadow-2xl text-xl",onClick:()=>t(!0),"aria-label":"Open agent prompt bar","aria-expanded":!1,"data-testid":"agent-bar-dock",children:"✨"})}const jz=()=>`${Nt()}/events/planning`;function Bz({className:e="w-3.5 h-3.5"}){return l.jsx("svg",{className:`inline-block shrink-0 ${e}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("polygon",{points:"1.5 2.5 14.5 2.5 9.5 8.5 9.5 13.5 6.5 13.5 6.5 8.5 1.5 2.5"})})}function Uz(){const[e,t]=g.useState(null),[n,r]=g.useState(null),[a,s]=g.useState(!1),[i,o]=g.useState("all"),[u,c]=g.useState(!0),[p,d]=g.useState(!1),[f,m]=g.useState(null),[b,E]=g.useState(0),x=g.useRef(null),y=g.useRef(null),S=g.useMemo(()=>Xv(e??[]),[e]),w=g.useCallback(async v=>{try{const R=await N$(v);t(R),m(null)}catch(R){if(v?.aborted)return;m(R instanceof Error?R.message:String(R))}},[]);if(g.useEffect(()=>{const v=new AbortController;return w(v.signal),()=>v.abort()},[w]),g.useEffect(()=>{if(!p)return;const v=C=>{x.current&&!x.current.contains(C.target)&&d(!1)},R=C=>{C.key==="Escape"&&d(!1)};return document.addEventListener("mousedown",v),document.addEventListener("keydown",R),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",R)}},[p]),g.useEffect(()=>{if(typeof EventSource>"u")return;const v=new EventSource(jz());return v.onmessage=R=>{try{const U=JSON.parse(R.data).eventName;if(!Zv(U))return;w(),n&&(U==="feature.updated"||U==="feature.transitioned"||U==="queue.job.completed")&&E(k=>k+1)}catch{}},()=>v.close()},[w,n]),f)return l.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load features: ",f]});if(e===null)return l.jsx("div",{className:"flex items-center justify-center h-full text-spur-text-muted text-sm",children:"Loading features…"});const A=()=>{s(!1),w()},N=(v=>{if(i==="all")return v;const R=i.toLowerCase(),C=new Set;for(const U of v)if(U.status.toLowerCase()===R){C.add(U.id);let k=U.id;for(;k.length>1;)k=k.slice(0,-1),C.add(k)}return v.filter(U=>C.has(U.id))})(e),T=n?S.get(n)??[]:[];return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"relative h-full w-full p-4 overflow-hidden","data-features-shell":!0,children:l.jsxs("div",{className:"flex flex-col h-full w-full max-w-[1600px] mx-auto gap-3","data-features-workspace":!0,children:[l.jsxs("header",{className:"flex flex-wrap items-center justify-between gap-4 border-b border-spur-border pb-3 shrink-0",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("span",{className:"text-2xl","aria-hidden":"true",children:"🎯"}),l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl font-bold tracking-tight text-spur-text",children:"Features"}),l.jsx("p",{className:"text-xs text-spur-text-muted",children:"Hierarchical feature roadmap, acceptance criteria, and lifecycle progression"})]})]}),l.jsxs("div",{className:"flex items-center gap-1","data-features-actions":!0,children:[l.jsx(Ge,{variant:"ghost",size:"xs",className:"text-spur-text-muted hover:text-spur-accent",onClick:()=>c(v=>!v),"aria-label":u?"Collapse feature tree":"Expand feature tree","aria-expanded":u,"aria-controls":"feature-tree-dock",title:u?"Collapse feature tree":"Expand feature tree",children:u?"◧":"▶"}),l.jsxs("div",{className:"relative",ref:x,children:[l.jsxs(Ge,{variant:"ghost",size:"xs",className:`relative text-spur-text-muted hover:text-spur-accent flex items-center gap-1 ${i!=="all"?"text-spur-accent font-semibold":""}`,onClick:()=>d(v=>!v),"aria-label":"Filter features by status","aria-expanded":p,title:"Filter features by status",children:[l.jsx(Bz,{className:"w-3.5 h-3.5"}),i!=="all"&&l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-spur-accent shrink-0","aria-hidden":"true"})]}),p&&l.jsxs("div",{className:"absolute right-0 top-full mt-1 z-20 w-44 rounded-md shadow-lg bg-base-100 border border-spur-border py-1 text-xs","data-filter-menu":!0,children:[l.jsxs("div",{className:"px-2.5 py-1 font-semibold text-spur-text-muted border-b border-spur-border flex items-center justify-between",children:[l.jsx("span",{children:"Filter by Status"}),i!=="all"&&l.jsx("button",{type:"button",onClick:()=>{o("all"),d(!1)},className:"text-[10px] text-spur-accent hover:underline",children:"Reset"})]}),l.jsxs("button",{type:"button",onClick:()=>{o("all"),d(!1)},className:`w-full text-left px-3 py-1.5 flex items-center gap-2 hover:bg-base-200 ${i==="all"?"font-semibold text-spur-accent bg-spur-accent/10":"text-spur-text"}`,children:[l.jsx("span",{className:"flex-1",children:"All"}),i==="all"&&l.jsx("span",{children:"✓"})]}),vs.map(v=>l.jsxs("button",{type:"button",onClick:()=>{o(v),d(!1)},className:`w-full text-left px-3 py-1.5 flex items-center gap-2 hover:bg-base-200 capitalize ${i===v?"font-semibold text-spur-accent bg-spur-accent/10":"text-spur-text"}`,children:[l.jsx(gb,{status:v}),l.jsx("span",{className:"flex-1 capitalize",children:v}),i===v&&l.jsx("span",{children:"✓"})]},v))]})]}),l.jsx(Ge,{variant:"ghost",size:"xs",className:"text-spur-text-muted hover:text-spur-accent",onClick:()=>s(!0),"aria-label":"Add root feature",title:"Add root feature",children:"+"})]})]}),l.jsxs("div",{className:"relative flex-1 min-h-0",ref:y,children:[l.jsxs("div",{id:"feature-tree-dock",hidden:!u,className:"absolute right-[calc(100%_+_12px)] top-0 bottom-0 z-20 w-72 lg:w-80 flex flex-col overflow-hidden rounded-lg border border-spur-border bg-base-200 shadow-xl",children:[l.jsx("div",{className:"flex items-center justify-between px-3 py-2 border-b border-spur-border bg-base-300/60 shrink-0",children:l.jsxs("span",{className:"text-xs font-semibold text-spur-text flex items-center gap-1.5",children:[l.jsx("span",{children:"🌳"})," Feature Tree"]})}),l.jsx("div",{className:"flex-1 overflow-y-auto p-1",children:e.length===0?l.jsx("div",{className:"p-3 text-xs text-spur-text-muted italic",children:"No features found."}):N.length===0?l.jsxs("div",{className:"p-3 text-xs text-spur-text-muted italic",children:['No features match status filter "',i,'".']}):l.jsx(Mz,{features:N,selectedId:n,onSelect:r})})]}),l.jsx("div",{className:"w-full h-full overflow-hidden rounded-lg border border-spur-border bg-base-100 relative","data-testid":"detail-workspace",children:l.jsx("div",{className:"w-full h-full overflow-y-auto",children:n?l.jsx(Lz,{featureId:n,refreshKey:b,onClose:()=>r(null),childFeatures:T,onSelectFeature:r,metadataDockRef:y}):l.jsx("div",{className:"flex items-center justify-center h-full text-sm text-spur-text-muted italic",children:"Select a feature to view details"})})})]})]})}),l.jsx(Vv,{open:a,parentId:"",onClose:()=>s(!1),onCreated:A}),l.jsx(Pz,{})]})}const $z={id:"features",name:"Feature Board",icon:"🏷️",route:"features",component:Uz,sidebarLabel:"Features"},zz=Object.freeze(Object.defineProperty({__proto__:null,module:$z},Symbol.toStringTag,{value:"Module"})),ls=({id:e})=>{const t={width:16,height:16,viewBox:"0 0 24 24",role:"img","aria-label":`${e} icon`};switch(e){case"claude":return l.jsxs("svg",{...t,fill:"none",stroke:"currentColor",strokeWidth:"2.3",strokeLinecap:"round",children:[l.jsx("title",{children:"Claude Code icon"}),l.jsx("path",{d:"M12 2.5v19M2.5 12h19M5.3 5.3l13.4 13.4M5.3 18.7l13.4-13.4"})]});case"codex":return l.jsxs("svg",{...t,fill:"currentColor",children:[l.jsx("title",{children:"Codex icon"}),l.jsx("path",{d:"M21.5 9.8a5.5 5.5 0 0 0-.5-4.2 5.6 5.6 0 0 0-4.6-2.8 5.6 5.6 0 0 0-4.2 1.4A5.5 5.5 0 0 0 7.8 3a5.6 5.6 0 0 0-4.5 3.3 5.5 5.5 0 0 0 .7 4.2 5.5 5.5 0 0 0-.7 4.2 5.6 5.6 0 0 0 4.5 3.3c.3.7.8 1.3 1.4 1.8a5.6 5.6 0 0 0 6.8-.4 5.5 5.5 0 0 0 4.4-1.4 5.6 5.6 0 0 0 1.4-4.2 5.5 5.5 0 0 0-.5-4.2zm-8.5 11.2a3.7 3.7 0 0 1-2.4-.9l2.7-1.6a1 1 0 0 0 .5-.9v-3.7l3.1 1.8v3.6a3.7 3.7 0 0 1-3.9 1.7zm-7.6-3.8a3.7 3.7 0 0 1-.4-2.5l2.7 1.6a1 1 0 0 0 1 0l3.2-1.8v3.6L6.8 20a3.7 3.7 0 0 1-1.4-2.8zm-1.3-8.3a3.7 3.7 0 0 1 2-1.6v3.2a1 1 0 0 0 .5.9l3.2 1.8-3.1 1.8-3.1-1.8a3.7 3.7 0 0 1 .5-4.3zm12.6 1.8l-3.2-1.8 3.1-1.8 3.1 1.8a3.7 3.7 0 0 1-.5 4.3 3.7 3.7 0 0 1-2 1.6v-3.2a1 1 0 0 0-.5-.9zm2.2 4.5l-2.7-1.6a1 1 0 0 0-1 0l-3.2 1.8V11.8l3.1-1.8 3.1 1.8a3.7 3.7 0 0 1 .7 4.4zm-7-1.3l-2.7-1.6 2.7-1.6 2.7 1.6-2.7 1.6z"})]});case"agy":return l.jsxs("svg",{...t,fill:"currentColor",children:[l.jsx("title",{children:"Antigravity CLI icon"}),l.jsx("path",{d:"M12 1.5C12 7.3 7.3 12 1.5 12c5.8 0 10.5 4.7 10.5 10.5 0-5.8 4.7-10.5 10.5-10.5-5.8 0-10.5-4.7-10.5-10.5z"})]});case"omp":return l.jsxs("svg",{...t,fill:"none",stroke:"currentColor",strokeWidth:"2.3",strokeLinecap:"round",children:[l.jsx("title",{children:"OMP icon"}),l.jsx("circle",{cx:"12",cy:"12",r:"9"}),l.jsx("path",{d:"M10 8.5l5 3.5-5 3.5z"})]});case"openclaw":return l.jsxs("svg",{...t,fill:"none",stroke:"currentColor",strokeWidth:"2.3",strokeLinecap:"round",children:[l.jsx("title",{children:"OpenClaw icon"}),l.jsx("path",{d:"M12 2C6.5 2 2 6.5 2 12c0 3.8 2.1 7.1 5.2 8.8L6 22l3.8-1.2C10.5 21.5 11.2 22 12 22c5.5 0 10-4.5 10-10S17.5 2 12 2zM8 11.5a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0zm5 0a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0z"})]});case"hermes":return l.jsxs("svg",{...t,fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",children:[l.jsx("title",{children:"Hermes icon"}),l.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})]});case"grok":return l.jsxs("svg",{...t,fill:"currentColor",children:[l.jsx("title",{children:"Grok Build icon"}),l.jsx("path",{d:"M18.2 3H21l-6.5 7.4L22 21h-5.8l-4.5-5.9L6.5 21H3.6l6.9-7.9L3 3h5.9l4.1 5.4L18.2 3zm-1 16.3h1.5L8.7 4.6H7.1l10.1 14.7z"})]});case"opencode":return l.jsxs("svg",{...t,fill:"none",stroke:"currentColor",strokeWidth:"2.3",strokeLinecap:"round",children:[l.jsx("title",{children:"OpenCode icon"}),l.jsx("polyline",{points:"16 18 22 12 16 6"}),l.jsx("polyline",{points:"8 6 2 12 8 18"})]});case"pi":return l.jsxs("svg",{...t,fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",children:[l.jsx("title",{children:"Pi icon"}),l.jsx("path",{d:"M4 6h16M9 6v13M15 6v11a2 2 0 0 0 2 2"})]});default:return null}},Hz=new Set(["claude","codex","agy","omp","openclaw","hermes","grok","opencode","pi"]),Gz=(e,t)=>e.includes(t)?e.filter(n=>n!==t):[...e,t],_o=({label:e,unconstrainedLabel:t,options:n,selected:r,onChange:a,open:s,onOpenChange:i,showIcon:o=!1})=>{const u=g.useRef(null),[c,p]=g.useState("");g.useEffect(()=>{if(!s)return;const x=y=>{u.current&&!u.current.contains(y.target)&&i(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[s,i]);const d=c.trim().toLowerCase(),f=d?n.filter(x=>x.label.toLowerCase().includes(d)||x.id.toLowerCase().includes(d)):n,m=x=>a(x.length>0?x:void 0),b=x=>{if(x.key==="Escape"){x.stopPropagation(),i(!1);return}if(x.key!=="ArrowDown"&&x.key!=="ArrowUp")return;x.preventDefault();const y=Array.from(u.current?.querySelectorAll('input[type="checkbox"]')??[]);if(y.length===0)return;const S=y.indexOf(document.activeElement);(x.key==="ArrowDown"?y[(S+1+y.length)%y.length]:y[(S-1+y.length)%y.length])?.focus()},E=r.length===0?t:`${r.length} selected`;return l.jsxs("div",{ref:u,className:"relative",children:[l.jsxs("button",{type:"button","aria-haspopup":"dialog","aria-expanded":s,className:"px-2.5 py-1 text-xs rounded border border-base-content/20 hover:bg-base-content/10 font-medium text-base-content",onClick:()=>i(!s),children:[e,": ",E]}),s&&l.jsxs("div",{role:"dialog","aria-label":`Filter by ${e}`,onKeyDown:b,className:"absolute left-0 mt-1 z-20 p-2 shadow-lg bg-base-300 rounded-lg border border-base-content/10 w-60 text-xs flex flex-col gap-1.5",children:[l.jsx("input",{type:"search","aria-label":`Search ${e}`,value:c,onChange:x=>p(x.target.value),placeholder:"Search…",className:"px-2 py-1 rounded border border-base-content/20 bg-base-100 text-base-content focus:outline-none focus:border-primary"}),l.jsxs("div",{className:"flex items-center justify-between gap-2 text-[10px]",children:[l.jsx("button",{type:"button",className:"text-primary hover:underline cursor-pointer",onClick:()=>m(f.map(x=>x.id)),children:"Select all"}),l.jsx("button",{type:"button",className:"text-error/80 hover:text-error underline cursor-pointer",onClick:()=>a(void 0),children:"Clear all"})]}),l.jsxs("div",{className:"flex flex-col gap-0.5 max-h-56 overflow-y-auto",children:[f.map(x=>l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer py-1 px-1.5 hover:bg-base-200 rounded",children:[o&&l.jsx("span",{className:"w-3.5 inline-flex items-center justify-center shrink-0",children:Hz.has(x.id)?l.jsx(ls,{id:x.id}):l.jsx("span",{className:"w-2.5 h-2.5 rounded-full",style:{backgroundColor:x.color??"#5e6ad2"}})}),l.jsx("span",{className:"font-mono text-[11px] flex-1 truncate",children:x.label}),l.jsx("input",{type:"checkbox",className:"h-3.5 w-3.5 rounded border-base-content/30 text-primary",checked:r.includes(x.id),onChange:()=>m(Gz(r,x.id))})]},x.id)),f.length===0&&l.jsx("span",{className:"text-base-content/50 px-1.5 py-1",children:"No matches"})]})]})]})},Wz=({filter:e,onChange:t,sourceOptions:n=[],modelOptions:r=[],toolOptions:a=[],skillOptions:s=[],scope:i})=>{const[o,u]=g.useState(null),c=f=>{t({...e,range:f})},p=(f,m)=>{const E=(e[f]||[]).filter(x=>x!==m);t({...e,[f]:E.length>0?E:void 0})},d=(f,m)=>{t({...e,[f]:m})};return l.jsxs("div",{className:"flex flex-col gap-2.5 p-3.5 bg-base-200/50 rounded-xl border border-base-content/10 mb-4",children:[l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[l.jsxs("div",{className:"flex items-center gap-1.5 bg-base-300 p-1 rounded-lg",children:[["24h","7d","30d","all"].map(f=>l.jsx("button",{type:"button",className:`px-2.5 py-1 text-xs rounded font-medium transition-colors ${e.range===f?"bg-primary text-primary-content font-bold":"text-base-content/70 hover:bg-base-content/10"}`,onClick:()=>c(f),children:f.toUpperCase()},f)),l.jsx("button",{type:"button",className:`px-2.5 py-1 text-xs rounded font-medium transition-colors ${e.range==="custom"?"bg-primary text-primary-content font-bold":"text-base-content/70 hover:bg-base-content/10"}`,onClick:()=>c("custom"),children:"Custom"})]}),i&&l.jsxs("div",{className:"flex items-center gap-2 text-xs text-base-content/70 font-mono","data-testid":"history-filter-scope",children:[l.jsx("span",{children:i.rangeLabel}),l.jsx("span",{"aria-hidden":"true",children:"·"}),l.jsx("span",{children:i.sessionCount===void 0?"… sessions":i.sessionCount===null?"— sessions":`${i.sessionCount} sessions`}),i.sourceCount!==void 0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{"aria-hidden":"true",children:"·"}),l.jsx("span",{children:e.sources?.length?`${e.sources.length} sources selected`:`${i.sourceCount} sources available`})]})]})]}),e.range==="custom"&&l.jsxs("div",{className:"flex items-center gap-3 pt-1",children:[l.jsxs("label",{className:"text-xs text-base-content/70 flex items-center gap-1",children:["From:",l.jsx("input",{type:"datetime-local",className:"px-2 py-1 text-xs rounded border border-base-content/20 bg-base-300 text-base-content",value:e.from?e.from.slice(0,16):"",onChange:f=>t({...e,from:f.target.value?new Date(f.target.value).toISOString():void 0})})]}),l.jsxs("label",{className:"text-xs text-base-content/70 flex items-center gap-1",children:["To:",l.jsx("input",{type:"datetime-local",className:"px-2 py-1 text-xs rounded border border-base-content/20 bg-base-300 text-base-content",value:e.to?e.to.slice(0,16):"",onChange:f=>t({...e,to:f.target.value?new Date(f.target.value).toISOString():void 0})})]})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1 border-t border-base-content/10",children:[l.jsx(_o,{label:"Agents",unconstrainedLabel:"All",options:n,selected:e.sources??[],onChange:f=>d("sources",f),open:o==="sources",onOpenChange:f=>u(f?"sources":null),showIcon:!0}),l.jsx(_o,{label:"Models",unconstrainedLabel:"Any",options:r,selected:e.models??[],onChange:f=>d("models",f),open:o==="models",onOpenChange:f=>u(f?"models":null)}),l.jsx(_o,{label:"Tools",unconstrainedLabel:"Any",options:a,selected:e.tools??[],onChange:f=>d("tools",f),open:o==="tools",onOpenChange:f=>u(f?"tools":null)}),l.jsx(_o,{label:"Skills",unconstrainedLabel:"Any",options:s,selected:e.skills??[],onChange:f=>d("skills",f),open:o==="skills",onOpenChange:f=>u(f?"skills":null)}),l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 ml-auto",children:[e.sources?.map(f=>l.jsxs("div",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-base-300 border border-base-content/10 text-base-content gap-1",children:[l.jsx("span",{className:"capitalize",children:f}),l.jsx("button",{type:"button",onClick:()=>p("sources",f),className:"hover:text-error",children:"×"})]},f)),e.models?.map(f=>l.jsxs("div",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-base-300 border border-base-content/10 text-base-content font-mono text-[10px] gap-1",children:[l.jsx("span",{children:f}),l.jsx("button",{type:"button",onClick:()=>p("models",f),className:"hover:text-error",children:"×"})]},f)),e.tools?.map(f=>l.jsxs("div",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-base-300 border border-base-content/10 text-base-content font-mono text-[10px] gap-1",children:[l.jsx("span",{children:f}),l.jsx("button",{type:"button",onClick:()=>p("tools",f),className:"hover:text-error",children:"×"})]},f)),e.skills?.map(f=>l.jsxs("div",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-base-300 border border-base-content/10 text-base-content font-mono text-[10px] gap-1",children:[l.jsx("span",{children:f}),l.jsx("button",{type:"button",onClick:()=>p("skills",f),className:"hover:text-error",children:"×"})]},f)),((e.sources?.length??0)>0||(e.models?.length??0)>0||(e.tools?.length??0)>0||(e.skills?.length??0)>0)&&l.jsx("button",{type:"button",className:"text-xs text-error/80 hover:text-error underline ml-1 cursor-pointer",onClick:()=>t({range:e.range,bucket:e.bucket}),children:"Clear all"})]})]})]})};function Ye(e){if(!Number.isFinite(e)||e===0)return"0";const t=Math.abs(e);return t>=1e6?`${(e/1e6).toFixed(1)}M`:t>=1e3?`${(e/1e3).toFixed(1)}K`:Math.round(e).toLocaleString()}function Jv(e){return e===0?"0":Math.abs(e)>=1e6?`${Math.round(e/1e6)}M`:Math.abs(e)>=1e3?`${Math.round(e/1e3)}K`:Math.round(e).toString()}function mn(e){return Math.round(e).toLocaleString()}function Kr(e,t=1){return`${e.toFixed(t)}%`}function ew(e){if(e<1)return"<1m";if(e<60)return`${Math.round(e)}m`;const t=Math.floor(e/60);return`${t}h ${Math.round(e-t*60)}m`}function yd(e){return e<1e3?`${Math.round(e)}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m ${Math.round(e%6e4/1e3)}s`}function Td(e,t=4){if(e<=0)return[0,1];const n=e/t,r=10**Math.floor(Math.log10(n)),a=n/r,s=(a<=1?1:a<=2?2:a<=2.5?2.5:a<=5?5:10)*r,i=[];for(let u=0;u<=e*1.0001+s/2;u+=s)i.push(u);const o=i[i.length-1];return o!==void 0&&o<e&&i.push(o+s),i}const Vz=({buckets:e,series:t,lineColor:n="#22d3ee",height:r=260})=>{const a=g.useRef(null),[s,i]=g.useState(1e3),[o,u]=g.useState(null);g.useEffect(()=>{if(!a.current)return;const $=a.current;(()=>{const se=$.clientWidth;se>0&&i(se)})();const H=new ResizeObserver(se=>{for(const de of se){const O=Math.round(de.contentRect.width);O>0&&i(O)}});return H.observe($),()=>H.disconnect()},[]);const c=s,p=54,d=50,f=16,m=26,b=Math.max(60,c-p-d),E=r-f-m,x=e.map($=>t.reduce((te,H)=>te+($.v[H.id]||0),0)),y=Math.max(1,...x),S=Td(y,4),w=S[S.length-1]||y,A=$=>f+E-$/w*E,D=$=>f+E-Math.max(0,Math.min(100,$))/100*E,N=b/Math.max(1,e.length),T=Math.max(2,N*.85),v=$=>p+$*N+N/2,R=Math.max(2,Math.floor(b/70)),C=Math.max(1,Math.ceil(e.length/R)),U=e.map(($,te)=>$.lineValue!==void 0?{x:v(te),y:D($.lineValue)}:null).filter($=>$!==null),k=U.length>1?U.map(($,te)=>`${te===0?"M":"L"}${$.x.toFixed(1)},${$.y.toFixed(1)}`).join(" "):"",j=$=>{const te=$.currentTarget.getBoundingClientRect();if(te.width<=0)return;const se=($.clientX-te.left)/te.width*c-p;if(se>=0&&se<=b){const de=Math.floor(se/N);if(de>=0&&de<e.length){u(de);return}}u(null)},G=o!==null?Math.max(110,Math.min(c-110,v(o))):c/2;return l.jsxs("div",{ref:a,className:"relative w-full overflow-hidden",children:[l.jsxs("svg",{viewBox:`0 0 ${c} ${r}`,width:"100%",height:r,className:"w-full block select-none",role:"img","aria-label":"Stacked column token chart with cache hit ratio overlay",onMouseMove:j,onMouseLeave:()=>u(null),children:[S.map($=>l.jsxs("g",{children:[l.jsx("line",{x1:p,x2:p+b,y1:A($),y2:A($),stroke:"currentColor",strokeOpacity:.1}),l.jsx("text",{x:p-8,y:A($)+3.5,textAnchor:"end",className:"text-[10px] fill-base-content/60",children:Jv($)})]},$)),[0,25,50,75,100].map($=>l.jsxs("text",{x:p+b+8,y:D($)+3.5,textAnchor:"start",fill:n,className:"text-[10px] opacity-80",children:[$,"%"]},$)),o!==null&&l.jsx("rect",{x:p+o*N,y:f,width:N,height:E,fill:"currentColor",fillOpacity:.04,rx:2}),e.map(($,te)=>{const H=p+te*N+(N-T)/2;let se=0;return l.jsxs("g",{opacity:o===null||o===te?1:.45,children:[t.slice().reverse().map(de=>{const O=$.v[de.id]||0;if(O<=0)return null;const ne=A(se+O),pe=A(se)-ne,L=Math.max(1,pe);return se+=O,l.jsx("rect",{x:H,y:ne,width:T,height:L,fill:de.color,rx:1},de.id)}),te%C===0&&l.jsx("text",{x:v(te),y:r-6,textAnchor:"middle",className:"text-[10px] fill-base-content/60",children:$.label})]},$.id??`${$.label}-${te}`)}),k&&l.jsxs(l.Fragment,{children:[l.jsx("path",{d:k,fill:"none",stroke:"currentColor",strokeWidth:4,strokeOpacity:.2,strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:k,fill:"none",stroke:n,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})]}),o!==null&&e[o]?.lineValue!==void 0&&l.jsx("circle",{cx:v(o),cy:D(e[o]?.lineValue??0),r:4.5,fill:n,stroke:"#1f2937",strokeWidth:2})]}),o!==null&&e[o]&&l.jsxs("div",{className:"absolute top-2 bg-base-300 border border-base-content/15 shadow-xl rounded-lg px-3 py-2 text-xs pointer-events-none z-20 flex flex-col gap-1 min-w-[180px] backdrop-blur-sm",style:{left:`${G}px`,transform:"translateX(-50%)"},children:[l.jsx("div",{className:"font-semibold text-base-content/90 border-b border-base-content/10 pb-1",children:e[o]?.label}),t.filter($=>(e[o]?.v[$.id]??0)>0).map($=>l.jsxs("div",{className:"flex justify-between items-center gap-2",children:[l.jsxs("span",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:$.color}}),$.label]}),l.jsx("span",{className:"font-mono",children:Ye(e[o]?.v[$.id]??0)})]},$.id)),l.jsxs("div",{className:"flex justify-between items-center font-bold pt-1 border-t border-base-content/10",children:[l.jsx("span",{children:"Total"}),l.jsx("span",{className:"font-mono",children:Ye(x[o]??0)})]}),e[o]?.lineValue!==void 0&&l.jsxs("div",{className:"flex justify-between items-center text-cyan-400",children:[l.jsx("span",{children:"Cache Hit Ratio"}),l.jsxs("span",{className:"font-mono",children:[e[o]?.lineValue,"%"]})]})]})]})},qz=({buckets:e,series:t,height:n=200})=>{const r=g.useRef(null),[a,s]=g.useState(540);g.useEffect(()=>{if(!r.current)return;const A=r.current;(()=>{const T=A.clientWidth;T>0&&s(T)})();const N=new ResizeObserver(T=>{for(const v of T){const R=Math.round(v.contentRect.width);R>0&&s(R)}});return N.observe(A),()=>N.disconnect()},[]);const i=a,o=46,u=12,c=10,p=24,d=Math.max(60,i-o-u),f=n-c-p,m=e.length,b=e.map(A=>t.reduce((D,N)=>D+(A.v[N.id]||0),0)),E=Td(Math.max(1,...b),3).pop()||1,x=A=>o+(m<=1?d/2:A/(m-1)*d),y=A=>c+f-A/E*f,S=new Array(m).fill(0),w=t.map(A=>{const D=S.slice(),N=S.map((v,R)=>v+(e[R]?.v[A.id]||0));let T=`M${x(0)},${y(N[0]||0)}`;for(let v=1;v<m;v++)T+=`L${x(v)},${y(N[v]||0)}`;for(let v=m-1;v>=0;v--)T+=`L${x(v)},${y(D[v]||0)}`;T+="Z";for(let v=0;v<m;v++)S[v]=N[v]||0;return{id:A.id,color:A.color,d:T}});return l.jsx("div",{ref:r,className:"w-full overflow-hidden",children:l.jsxs("svg",{viewBox:`0 0 ${i} ${n}`,width:"100%",height:n,className:"w-full block select-none",role:"img","aria-label":"Stacked area chart",children:[Td(E,3).map(A=>l.jsxs("g",{children:[l.jsx("line",{x1:o,x2:o+d,y1:y(A),y2:y(A),stroke:"currentColor",strokeOpacity:.1}),l.jsx("text",{x:o-7,y:y(A)+3.5,textAnchor:"end",className:"text-[10px] fill-base-content/60",children:Jv(A)})]},A)),w.map(A=>l.jsx("path",{d:A.d,fill:A.color,opacity:.8},A.id)),e.map((A,D)=>D%Math.ceil(m/6)===0?l.jsx("text",{x:x(D),y:n-6,textAnchor:"middle",className:"text-[10px] fill-base-content/60",children:A.label},A.id??A.label):null)]})})},Yz=({points:e,color:t="#3987e5",height:n=190,valueFmt:r=Kr})=>{const a=g.useRef(null),[s,i]=g.useState(540);g.useEffect(()=>{if(!a.current)return;const A=a.current;(()=>{const T=A.clientWidth;T>0&&i(T)})();const N=new ResizeObserver(T=>{for(const v of T){const R=Math.round(v.contentRect.width);R>0&&i(R)}});return N.observe(A),()=>N.disconnect()},[]);const o=s,u=44,c=12,p=14,d=24,f=Math.max(60,o-u-c),m=n-p-d,b=e.length,E=100,x=0,y=A=>u+(b<=1?f/2:A/(b-1)*f),S=A=>p+m-(A-x)/(E-x)*m;let w=`M${y(0)},${S(e[0]?.v??0)}`;for(let A=1;A<b;A++)w+=`L${y(A)},${S(e[A]?.v??0)}`;return l.jsx("div",{ref:a,className:"w-full overflow-hidden",children:l.jsxs("svg",{viewBox:`0 0 ${o} ${n}`,width:"100%",height:n,className:"w-full block select-none",role:"img","aria-label":"Line chart",children:[[0,25,50,75,100].map(A=>l.jsxs("g",{children:[l.jsx("line",{x1:u,x2:u+f,y1:S(A),y2:S(A),stroke:"currentColor",strokeOpacity:.1}),l.jsxs("text",{x:u-7,y:S(A)+3.5,textAnchor:"end",className:"text-[10px] fill-base-content/60",children:[A,"%"]})]},A)),l.jsx("path",{d:`${w}L${y(b-1)},${p+m}L${y(0)},${p+m}Z`,fill:t,opacity:.1}),l.jsx("path",{d:w,fill:"none",stroke:t,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),e.map((A,D)=>D%Math.ceil(b/6)===0||D===b-1?l.jsx("text",{x:y(D),y:n-6,textAnchor:"middle",className:"text-[10px] fill-base-content/60",children:A.label},A.id??A.label):null)]})})},Zz=({axes:e,series:t,height:n=260})=>{const s=n/2+4,i=Math.min(520/2-78,n/2-44),o=e.length,u=p=>-Math.PI/2+p/o*Math.PI*2,c=(p,d)=>[260+Math.cos(u(p))*i*d,s+Math.sin(u(p))*i*d];return l.jsxs("svg",{viewBox:`0 0 520 ${n}`,className:"w-full h-auto select-none",role:"img","aria-label":"Radar chart",children:[[.25,.5,.75,1].map(p=>{const d=`${e.map((f,m)=>{const[b,E]=c(m,p);return`${m===0?"M":"L"}${b?.toFixed(1)},${E?.toFixed(1)}`}).join(" ")}Z`;return l.jsx("path",{d,fill:"none",stroke:"currentColor",strokeOpacity:.15},p)}),e.map((p,d)=>{const[f,m]=c(d,1),[b,E]=c(d,1.2);return l.jsxs("g",{children:[l.jsx("line",{x1:260,y1:s,x2:f,y2:m,stroke:"currentColor",strokeOpacity:.2}),l.jsx("text",{x:b,y:(E??0)+3.5,textAnchor:Math.abs((b??0)-260)<6?"middle":(b??0)>260?"start":"end",className:"text-[11px] font-semibold fill-base-content/80",children:p})]},p)}),t.map(p=>{const d=`${p.values.map((f,m)=>{const[b,E]=c(m,Math.max(.04,f/100));return`${m===0?"M":"L"}${b?.toFixed(1)},${E?.toFixed(1)}`}).join(" ")}Z`;return l.jsxs("g",{children:[l.jsx("path",{d,fill:p.color,opacity:.15}),l.jsx("path",{d,fill:"none",stroke:p.color,strokeWidth:2,strokeLinejoin:"round"}),p.values.map((f,m)=>{const[b,E]=c(m,Math.max(.04,f/100));return l.jsx("circle",{cx:b,cy:E,r:3.5,fill:p.color,stroke:"#1f2937",strokeWidth:1.5},`${p.label}-${e[m]}`)})]},p.label)})]})},Qx=[0,.3,.5,.75,1],Kz=(e,t)=>{if(e<=0||t<=0)return 0;const n=e/t;return n<=.25?1:n<=.5?2:n<=.75?3:4},Xz=({days:e,color:t="#3987e5",maxDailyTokens:n=1})=>{const[r,a]=g.useState(null),s=[...e].sort((u,c)=>u.date.localeCompare(c.date)),i=[];for(let u=0;u<s.length;u+=7)i.push(s.slice(u,u+7));const o=u=>{const c=i[u]?.[0];if(!c)return"";const p=new Date(`${c.date}T00:00:00Z`).toLocaleString("en-US",{month:"short",timeZone:"UTC"});if(u===0)return p;const d=i[u-1]?.[0];return d&&d.date.slice(0,7)===c.date.slice(0,7)?"":p};return l.jsxs("section",{className:"relative flex flex-col gap-1.5 w-full","data-testid":"heatmap-calendar","aria-label":"Daily activity heatmap",onMouseLeave:()=>a(null),children:[r&&l.jsxs("div",{className:"absolute -top-1 pointer-events-none z-30 transform -translate-x-1/2 -translate-y-full flex flex-col items-center min-w-[140px] transition-all duration-75",style:{left:`${Math.max(20,Math.min(80,(r.colIdx+.5)/13*100))}%`},children:[l.jsxs("div",{className:"bg-base-100 border border-base-content/20 shadow-xl rounded-md px-2.5 py-1.5 text-[10px] font-mono text-center text-base-content backdrop-blur-md",children:[l.jsx("div",{className:"font-bold text-primary",children:r.date}),l.jsxs("div",{className:"text-base-content/90 font-medium",children:[l.jsx("span",{className:"text-base-content font-bold",children:Ye(r.tokens)})," tokens"]}),l.jsxs("div",{className:"text-base-content/60 text-[9px]",children:[r.sessions," ",r.sessions===1?"session":"sessions"]})]}),l.jsx("div",{className:"w-1.5 h-1.5 bg-base-100 border-r border-b border-base-content/20 transform rotate-45 -mt-0.5"})]}),l.jsxs("div",{className:"flex items-start gap-1 w-full",children:[l.jsx("div",{className:"w-5 shrink-0 pt-3 flex flex-col gap-[3px] text-[9px] font-mono text-base-content/50 select-none","aria-hidden":"true",children:["Mon","","Wed","","Fri","",""].map((u,c)=>l.jsx("div",{className:"w-full aspect-square flex items-center justify-end pr-1 leading-none",children:u},u||`weekday-${c}`))}),l.jsx("div",{className:"flex-1 w-full",style:{display:"grid",gridTemplateColumns:"repeat(13, minmax(0, 1fr))",gap:"3px"},children:i.map((u,c)=>{const p=u[0];return l.jsxs("div",{className:"flex flex-col gap-[3px]","data-testid":"heatmap-week",children:[l.jsx("div",{className:"h-3 text-[9px] leading-3 text-base-content/50 truncate font-mono",children:o(c)}),l.jsx("div",{className:"flex flex-col gap-[3px]",children:u.map(d=>{const f=Kz(d.tokens,n);return l.jsx("button",{type:"button",className:"w-full aspect-square rounded-[2px] p-0 border-0 transition-transform hover:scale-125 focus:scale-125 focus:outline-hidden cursor-pointer",style:f===0?{backgroundColor:"currentColor",opacity:.08}:{backgroundColor:t,opacity:Qx[f]},onMouseEnter:()=>a({...d,colIdx:c}),onFocus:()=>a({...d,colIdx:c}),onBlur:()=>a(null),title:`${d.date}: ${Ye(d.tokens)} tokens (${d.sessions} sessions)`,children:l.jsx("span",{className:"sr-only",children:`${d.date}: ${Ye(d.tokens)} tokens, ${d.sessions} sessions`})},d.date)})})]},p?.date??`week-${c}`)})})]}),l.jsx("div",{className:"flex items-center justify-end gap-1.5 pt-0.5",children:l.jsxs("div",{className:"flex items-center gap-1 text-[9px] font-mono text-base-content/50",children:[l.jsx("span",{children:"Less"}),Qx.map(u=>l.jsx("span",{className:"w-2.5 h-2.5 rounded-[2px] inline-block",style:u===0?{backgroundColor:"currentColor",opacity:.08}:{backgroundColor:t,opacity:u}},u)),l.jsx("span",{children:"More"})]})})]})},Sd=({value:e,max:t,color:n="#3987e5",height:r=6})=>{const a=Math.max(0,Math.min(100,t>0?e/t*100:0));return l.jsx("div",{className:"w-full bg-base-300 rounded-full overflow-hidden",style:{height:r},children:l.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${a}%`,backgroundColor:n}})})},Qz=({values:e,color:t="#3987e5",width:n=120,height:r=36})=>{const a=Math.max(...e,1),s=Math.min(...e,0),i=a-s||1,o=e.length,u=d=>o<=1?n/2:d/(o-1)*(n-4)+2,c=d=>r-3-(d-s)/i*(r-6);let p="";if(o>0){p=`M${u(0)},${c(e[0]??0)}`;for(let d=1;d<o;d++)p+=`L${u(d)},${c(e[d]??0)}`}return l.jsxs("svg",{viewBox:`0 0 ${n} ${r}`,className:"inline-block select-none overflow-visible",style:{width:n,height:r},role:"img","aria-label":"Trend sparkline",children:[o>1&&l.jsx("path",{d:p,fill:"none",stroke:t,strokeWidth:1.5,strokeLinecap:"round"}),o===1&&l.jsx("circle",{cx:u(0),cy:c(e[0]??0),r:2,fill:t})]})},tw=({data:e,loading:t,error:n,cacheHitTrend:r,onSelectSession:a})=>{const[s,i]=g.useState("model"),[o,u]=g.useState("asc");if(t)return l.jsx("div",{className:"flex items-center justify-center p-16",children:l.jsx("div",{className:"w-8 h-8 rounded-full border-4 border-primary border-t-transparent animate-spin"})});if(n)return l.jsx("div",{className:"p-4 rounded-lg bg-error/10 border border-error/20 text-error",children:l.jsxs("span",{children:["Failed to load insights: ",n]})});if(!e)return null;const{loops:c,cacheWaste:p,heavySessions:d,largestTokenSteps:f,slowSteps:m,modelComparison:b}=e,E=k=>{s===k?u(j=>j==="asc"?"desc":"asc"):(i(k),u(k==="model"?"asc":"desc"))},x=[...b].sort((k,j)=>{const G=o==="asc"?1:-1;return s==="model"?G*k.model.localeCompare(j.model):G*((k[s]??0)-(j[s]??0))}),y=k=>s!==k?l.jsx("span",{className:"opacity-30 ml-1 text-[10px]",children:"↕"}):l.jsx("span",{className:"text-primary ml-1 text-[10px]",children:o==="asc"?"▲":"▼"}),S=Math.max(1,...d.map(k=>k.tokens)),w=Math.max(1,...m.map(k=>k.durationMs??0)),A=["Speed","Cache Ratio","Reliability","Output Ratio"],D={"claude-opus-4.6":"#3987e5","claude-sonnet-4.6":"#199e70","gpt-5.6-sol":"#9085e9","grok-4.6":"#d95926",other:"#898781"},N=b.map(k=>k.speedMsMean),T=Math.min(...N),v=Math.max(...N),R=k=>v===T?100:Math.max(0,Math.min(100,Math.round((v-k)/(v-T)*100))),C=k=>Math.max(0,Math.min(100,Math.round(k*100))),U=b.map(k=>{const j=R(k.speedMsMean),G=C(k.cacheRatio),$=C(k.reliability),te=C(k.outputRatio*5);return{label:k.model,color:D[k.model]??"#3987e5",values:[j,G,$,te]}});return l.jsxs("div",{className:"flex flex-col gap-6",children:[l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 p-5",children:[l.jsx("h4",{className:"font-bold text-sm mb-1",children:"Top Cache-Wasting Incidents"}),l.jsx("p",{className:"text-xs text-base-content/60 mb-3",children:"Steps that re-sent full context without cache hits"}),l.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-3 items-start",children:[(r?.length??0)>1&&l.jsx("div",{"data-testid":"cache-hit-trend-chart",children:l.jsx(Yz,{points:(r??[]).map(k=>({id:k.day,label:k.day.slice(5),v:k.cacheHitRatio})),color:"#22d3ee",height:140})}),l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full text-xs text-left font-mono",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-base-content/10 text-base-content/60",children:[l.jsx("th",{className:"py-1.5",children:"Session"}),l.jsx("th",{className:"py-1.5",children:"Fresh Tokens"}),l.jsx("th",{className:"py-1.5",children:"Cause"})]})}),l.jsx("tbody",{children:p.map(k=>l.jsxs("tr",{className:"border-b border-base-content/5 hover:bg-base-300/30",children:[l.jsx("td",{className:"py-1.5",children:l.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:()=>a?.(k.sessionId),children:k.sessionId})}),l.jsx("td",{className:"py-1.5 text-error font-bold",children:Ye(k.freshTokens)}),l.jsx("td",{className:"py-1.5 text-base-content/70",children:k.reason})]},`${k.sessionId}-${k.freshTokens}-${k.timestamp}`))})]})})]})]}),l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 p-5",children:[l.jsx("h4",{className:"font-bold text-sm mb-1",children:"Heaviest Token Sessions"}),l.jsx("p",{className:"text-xs text-base-content/60 mb-3",children:"Sessions consuming highest billed volume"}),l.jsx("div",{className:"flex flex-col gap-3",children:d.map(k=>l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsxs("div",{className:"flex justify-between text-xs font-mono",children:[l.jsxs("button",{type:"button",className:"text-primary hover:underline font-bold",onClick:()=>a?.(k.id,k.source),children:[k.id," (",k.source," · ",k.model,")"]}),l.jsx("span",{children:Ye(k.tokens)})]}),l.jsx(Sd,{value:k.tokens,max:S,color:"#3987e5",height:6})]},k.id))})]})]}),l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 p-5",children:[l.jsx("h4",{className:"font-bold text-sm mb-1",children:"Top Time-Consuming Steps"}),l.jsx("p",{className:"text-xs text-base-content/60 mb-3",children:"Longest tool execution durations"}),l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full text-xs text-left font-mono",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-base-content/10 text-base-content/60",children:[l.jsx("th",{className:"py-1.5",children:"Tool / Step"}),l.jsx("th",{className:"py-1.5",children:"Session"}),l.jsx("th",{className:"py-1.5 text-right",children:"Duration"}),l.jsx("th",{className:"py-1.5 text-right",children:"Tokens"})]})}),l.jsx("tbody",{children:m.map(k=>l.jsxs("tr",{className:"border-b border-base-content/5 hover:bg-base-300/30",children:[l.jsxs("td",{className:"py-1.5 font-bold",children:[k.toolName," ",l.jsxs("span",{className:"text-[10px] text-base-content/50",children:["#",k.stepIndex]})]}),l.jsx("td",{className:"py-1.5",children:l.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:()=>a?.(k.sessionId,k.agent),children:k.sessionId})}),l.jsx("td",{className:"py-1.5 text-right text-amber-400 font-bold w-24",children:l.jsxs("div",{className:"flex flex-col items-end gap-1",children:[l.jsx("span",{children:yd(k.durationMs??0)}),l.jsx(Sd,{value:k.durationMs??0,max:w,color:"#fbbf24",height:4})]})}),l.jsx("td",{className:"py-1.5 text-right",children:Ye(k.tokens)})]},`${k.sessionId}-${k.toolName}-${k.stepIndex}`))})]})})]}),l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 p-5",children:[l.jsx("h4",{className:"font-bold text-sm mb-1",children:"Largest Token Steps"}),l.jsx("p",{className:"text-xs text-base-content/60 mb-3",children:"Single tool calls with highest token load"}),l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full text-xs text-left font-mono",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-base-content/10 text-base-content/60",children:[l.jsx("th",{className:"py-1.5",children:"Tool / Step"}),l.jsx("th",{className:"py-1.5",children:"Session"}),l.jsx("th",{className:"py-1.5",children:"Agent / Model"}),l.jsx("th",{className:"py-1.5 text-right",children:"Tokens"})]})}),l.jsx("tbody",{children:f.map(k=>l.jsxs("tr",{className:"border-b border-base-content/5 hover:bg-base-300/30",children:[l.jsxs("td",{className:"py-1.5 font-bold",children:[k.toolName," ",l.jsxs("span",{className:"text-[10px] text-base-content/50",children:["#",k.stepIndex]})]}),l.jsx("td",{className:"py-1.5",children:l.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:()=>a?.(k.sessionId,k.agent),children:k.sessionId})}),l.jsxs("td",{className:"py-1.5 text-xs text-base-content/70",children:[k.agent," · ",k.model]}),l.jsx("td",{className:"py-1.5 text-right text-primary font-bold",children:Ye(k.tokens)})]},`${k.sessionId}-${k.toolName}-${k.stepIndex}`))})]})})]})]}),l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 p-5",children:[l.jsx("h4",{className:"font-bold text-sm mb-1",children:"Model Multi-Axis Comparison"}),l.jsx("p",{className:"text-xs text-base-content/60 mb-4",children:"Speed, Cache ratio, Reliability, and Output ratio"}),l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 items-center",children:[l.jsx("div",{className:"flex justify-center",children:l.jsx(Zz,{axes:A,series:U,height:280})}),l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full text-xs text-left font-mono",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-base-content/10 text-base-content/60",children:[l.jsxs("th",{className:"py-1.5 cursor-pointer select-none hover:text-base-content",onClick:()=>E("model"),children:["Model ",y("model")]}),l.jsxs("th",{className:"py-1.5 text-right cursor-pointer select-none hover:text-base-content",onClick:()=>E("speedMsMean"),children:["Mean Speed (ms) ",y("speedMsMean")]}),l.jsxs("th",{className:"py-1.5 text-right cursor-pointer select-none hover:text-base-content",onClick:()=>E("cacheRatio"),children:["Cache Ratio ",y("cacheRatio")]}),l.jsxs("th",{className:"py-1.5 text-right cursor-pointer select-none hover:text-base-content",onClick:()=>E("reliability"),children:["Reliability ",y("reliability")]}),l.jsxs("th",{className:"py-1.5 text-right cursor-pointer select-none hover:text-base-content",onClick:()=>E("outputRatio"),children:["Output Ratio ",y("outputRatio")]})]})}),l.jsx("tbody",{children:x.map(k=>l.jsxs("tr",{className:"border-b border-base-content/5 hover:bg-base-300/30",children:[l.jsxs("td",{className:"py-1.5 font-bold flex items-center gap-1.5",children:[l.jsx("span",{className:"w-2.5 h-2.5 rounded-full",style:{background:D[k.model]??"#3987e5"}}),k.model]}),l.jsx("td",{className:"py-1.5 text-right font-mono",children:mn(k.speedMsMean)}),l.jsx("td",{className:"py-1.5 text-right text-cyan-400 font-mono",children:Kr(k.cacheRatio*100)}),l.jsx("td",{className:"py-1.5 text-right text-emerald-400 font-mono",children:Kr(k.reliability*100)}),l.jsx("td",{className:"py-1.5 text-right font-mono",children:Kr(k.outputRatio*100)})]},k.model))})]})})]})]}),c.length>0&&l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-warning/30 p-5",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("span",{className:"text-warning text-lg",children:"⚠️"}),l.jsx("h3",{className:"font-bold text-base",children:"Detected Execution Loops (Repeats ≥ 3)"})]}),l.jsx("p",{className:"text-xs text-base-content/60 mb-4",children:"Identified consecutive identical tool invocations without intervening state changes."}),l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:c.map(k=>l.jsxs("div",{className:"p-4 bg-base-300/70 rounded-xl border border-base-content/10 flex flex-col justify-between gap-3",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsxs("span",{className:"px-2 py-0.5 rounded-full text-xs font-mono font-bold bg-warning/20 text-warning border border-warning/30",children:[k.tool," × ",k.repeats," repeats"]}),l.jsx("button",{type:"button",className:"text-xs font-mono text-primary hover:underline",onClick:()=>a?.(k.sessionId),children:k.sessionId})]}),l.jsx("div",{className:"font-mono text-xs text-base-content/80 mt-2",children:k.argsHint}),l.jsxs("div",{className:"text-[11px] text-base-content/50 mt-1",children:["Step sequence: #",k.fromSeq," → #",k.toSeq]})]}),l.jsxs("div",{className:"flex justify-between items-center text-xs font-mono pt-2 border-t border-base-content/10",children:[l.jsx("span",{className:"text-base-content/60",children:"Estimated Wasted Tokens:"}),l.jsx("span",{className:"text-error font-bold",children:Ye(k.wastedTokens)})]})]},`${k.tool}-${k.sessionId}-${k.fromSeq}`))})]})]})},nw=({data:e,loading:t,error:n,sortBy:r="start",sortDir:a="desc",page:s=1,pageSize:i=20,onSortChange:o,onPageChange:u,onSelectSession:c})=>{if(t)return l.jsx("div",{className:"flex items-center justify-center p-16",children:l.jsx("div",{className:"w-8 h-8 rounded-full border-4 border-primary border-t-transparent animate-spin"})});if(n)return l.jsx("div",{className:"p-4 rounded-lg bg-error/10 border border-error/20 text-error",children:l.jsxs("span",{children:["Failed to load sessions: ",n]})});if(!e)return null;const{items:p,total:d}=e,f=Math.max(1,Math.ceil(d/i)),m=b=>r!==b?null:l.jsx("span",{className:"ml-1 text-primary",children:a==="asc"?"▲":"▼"});return l.jsxs("div",{className:"flex flex-col gap-4",children:[l.jsx("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 overflow-hidden",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full text-xs text-left font-mono",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"bg-base-300/80 text-base-content/70 border-b border-base-content/10",children:[l.jsx("th",{className:"p-3",children:"Session ID"}),l.jsx("th",{className:"p-3",children:"Agent"}),l.jsx("th",{className:"p-3",children:"Model"}),l.jsxs("th",{className:"p-3 cursor-pointer hover:text-primary transition-colors",onClick:()=>o?.("start"),children:["Start Time ",m("start")]}),l.jsxs("th",{className:"p-3 cursor-pointer hover:text-primary transition-colors text-right",onClick:()=>o?.("duration"),children:["Duration ",m("duration")]}),l.jsxs("th",{className:"p-3 cursor-pointer hover:text-primary transition-colors text-right",onClick:()=>o?.("messages"),children:["Msgs ",m("messages")]}),l.jsxs("th",{className:"p-3 cursor-pointer hover:text-primary transition-colors text-right",onClick:()=>o?.("toolCalls"),children:["Tools ",m("toolCalls")]}),l.jsxs("th",{className:"p-3 cursor-pointer hover:text-primary transition-colors text-right",onClick:()=>o?.("billedTokens"),children:["Billed Tok ",m("billedTokens")]}),l.jsxs("th",{className:"p-3 cursor-pointer hover:text-primary transition-colors text-right",onClick:()=>o?.("cacheRead"),children:["Cache Read ",m("cacheRead")]}),l.jsxs("th",{className:"p-3 cursor-pointer hover:text-primary transition-colors text-right",onClick:()=>o?.("freshInput"),children:["Fresh Input ",m("freshInput")]}),l.jsx("th",{className:"p-3",children:"Top Tool"}),l.jsx("th",{className:"p-3 text-center",children:"State"})]})}),l.jsx("tbody",{children:p.length===0?l.jsx("tr",{children:l.jsx("td",{colSpan:12,className:"text-center py-8 text-base-content/50",children:"No sessions matching the current filter."})}):p.map(b=>l.jsxs("tr",{className:"border-b border-base-content/5 hover:bg-primary/10 cursor-pointer transition-colors",onClick:()=>c?.(b.source,b.id),title:"Click to view execution timeline",children:[l.jsx("td",{className:"p-3 font-bold text-primary",children:l.jsx("span",{className:"font-mono text-xs",title:b.id,children:b.id.length>18?`${b.id.slice(0,16)}…`:b.id})}),l.jsx("td",{className:"p-3",children:l.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-base-300 uppercase font-mono text-base-content",children:b.source})}),l.jsx("td",{className:"p-3 text-base-content/70",children:b.model}),l.jsx("td",{className:"p-3",children:b.start.slice(0,19).replace("T"," ")}),l.jsx("td",{className:"p-3 text-right font-semibold tabular-nums",children:ew(b.durationMs/6e4)}),l.jsx("td",{className:"p-3 text-right tabular-nums",children:mn(b.messages)}),l.jsx("td",{className:"p-3 text-right tabular-nums",children:mn(b.toolCalls)}),l.jsx("td",{className:"p-3 text-right font-bold text-primary tabular-nums",children:Ye(b.billedTokens)}),l.jsx("td",{className:"p-3 text-right text-emerald-400 tabular-nums",children:Ye(b.cacheReadTokens)}),l.jsx("td",{className:"p-3 text-right text-base-content/70 tabular-nums",children:Ye(b.freshInputTokens)}),l.jsx("td",{className:"p-3",children:l.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] border border-base-content/20 font-mono",children:b.topTool})}),l.jsx("td",{className:"p-3 text-center",children:l.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono ${b.state==="error"?"bg-error/20 text-error font-bold":"bg-emerald-500/20 text-emerald-400 font-bold"}`,children:b.state})})]},`${b.source}:::${b.id}`))})]})})}),l.jsxs("div",{className:"flex flex-wrap justify-between items-center gap-3 px-1 text-xs",children:[l.jsxs("span",{className:"text-base-content/70",children:["Showing ",(s-1)*i+1,"–",Math.min(s*i,d)," of ",d," sessions"]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{type:"button",className:"px-2.5 py-1 text-xs rounded border border-base-content/20 hover:bg-base-content/10 font-medium disabled:opacity-40",disabled:s<=1,onClick:()=>u?.(s-1),children:"« Prev"}),l.jsxs("span",{className:"px-2.5 py-1 text-xs font-mono text-base-content/70",children:["Page ",s," / ",f]}),l.jsx("button",{type:"button",className:"px-2.5 py-1 text-xs rounded border border-base-content/20 hover:bg-base-content/10 font-medium disabled:opacity-40",disabled:s>=f,onClick:()=>u?.(s+1),children:"Next »"})]})]})]})},rw=({data:e,loading:t,error:n,onTriggerImport:r})=>{const[a,s]=g.useState(!1),[i,o]=g.useState(null),u=async()=>{s(!0),o("Running import & analytics rollup...");try{const f=await r?.("incremental");o(f?.message??"Import queued.")}catch(f){o(`Import failed: ${f instanceof Error?f.message:String(f)}`)}finally{s(!1)}};if(t)return l.jsx("div",{className:"flex items-center justify-center p-16",children:l.jsx("div",{className:"w-8 h-8 rounded-full border-4 border-primary border-t-transparent animate-spin"})});if(n)return l.jsx("div",{className:"p-4 rounded-lg bg-error/10 border border-error/20 text-error",children:l.jsxs("span",{children:["Failed to load sources registry: ",n]})});if(!e)return null;const{overview:c,agents:p,roots:d}=e;return l.jsxs("div",{className:"flex flex-col gap-6",children:[l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 p-5 flex flex-col md:flex-row justify-between items-start md:items-center gap-4",children:[l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xl",children:"🗄️"}),l.jsx("h3",{className:"font-bold text-base",children:"Transcripts Corpus & Ingestion Registry"})]}),l.jsxs("div",{className:"flex flex-wrap gap-4 text-xs font-mono text-base-content/70 mt-1",children:[l.jsxs("span",{children:["Files: ",l.jsx("strong",{className:"text-base-content",children:mn(c.totalFiles)})]}),l.jsxs("span",{children:["Corpus Size:"," ",l.jsxs("strong",{className:"text-base-content",children:[(c.corpusSizeBytes/(1024*1024)).toFixed(1)," MB"]})]}),l.jsxs("span",{children:["Total Sessions:"," ",l.jsx("strong",{className:"text-base-content",children:mn(c.totalSessions)})]}),l.jsxs("span",{children:["Coverage:"," ",l.jsxs("strong",{className:"text-base-content",children:[c.dateCoverage.from?.slice(0,10)??"N/A"," →"," ",c.dateCoverage.to?.slice(0,10)??"N/A"]})]}),l.jsxs("span",{children:["Last Import:"," ",l.jsx("strong",{className:"text-base-content",children:c.lastImportedAt?new Date(c.lastImportedAt).toLocaleString():"never imported"})]})]})]}),l.jsxs("div",{className:"flex flex-col items-end gap-1.5",children:[l.jsx("button",{type:"button",className:"px-4 py-2 rounded-lg bg-primary text-primary-content font-medium text-xs hover:bg-primary/90 transition-colors disabled:opacity-50",disabled:a,onClick:u,children:a?"Importing...":"🔄 Import & Analyze"}),i&&l.jsx("span",{className:"text-[11px] font-mono text-info","aria-live":"polite",children:i})]})]}),l.jsxs("div",{children:[l.jsx("h4",{className:"font-bold text-sm mb-3",children:"Agent Activity (90-Day Daily Heatmaps)"}),l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:p.map(f=>l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 hover:border-base-content/30 transition-all p-4 flex flex-col justify-between gap-3",children:[l.jsxs("div",{className:"flex justify-between items-start",children:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsxs("div",{className:"relative group",children:[l.jsx("button",{type:"button",className:"w-7 h-7 rounded-lg flex items-center justify-center text-white shadow-xs focus:outline-2 focus:outline-offset-2 focus:outline-primary",style:{background:f.color},"aria-label":`${f.name} source metrics`,"aria-describedby":`source-tooltip-${f.id}`,children:l.jsx(ls,{id:f.id})}),l.jsxs("div",{id:`source-tooltip-${f.id}`,role:"tooltip",className:"pointer-events-none absolute z-20 left-0 top-9 w-64 rounded-lg border border-base-content/15 bg-base-100 p-3 text-[11px] font-mono shadow-xl opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",children:[l.jsxs("div",{className:"mb-2 font-bold text-sm",children:[f.name," Summary"]}),l.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1",children:[l.jsx("span",{className:"text-base-content/60",children:"Imported Files"}),l.jsx("strong",{className:"text-right",children:mn(f.filesCount)}),l.jsx("span",{className:"text-base-content/60",children:"Sessions"}),l.jsx("strong",{className:"text-right",children:mn(f.sessionCount)}),l.jsx("span",{className:"text-base-content/60",children:"Total Tokens"}),l.jsx("strong",{className:"text-right",children:Ye(f.totalTokens)}),l.jsx("span",{className:"text-base-content/60",children:"Cache Saved"}),l.jsx("strong",{className:"text-right",children:Ye(f.cacheSavedTokens)}),l.jsx("span",{className:"text-base-content/60",children:"Tool Calls"}),l.jsx("strong",{className:"text-right",children:mn(f.toolCalls)}),l.jsx("span",{className:"text-base-content/60",children:"Date Range"}),l.jsxs("strong",{className:"text-right",children:[f.firstDate?.slice(0,10)??"N/A"," →"," ",f.lastDate?.slice(0,10)??"N/A"]})]})]})]}),l.jsxs("div",{children:[l.jsx("div",{className:"font-bold text-sm",children:f.name}),l.jsx("div",{className:"text-[10px] font-mono text-base-content/60",children:f.importPath})]})]}),l.jsxs("span",{className:"px-2 py-0.5 rounded-full text-xs font-mono font-bold bg-base-300 border border-base-content/10 text-base-content",children:[Ye(f.totalTokens)," tok"]})]}),l.jsxs("div",{className:"bg-base-300/60 p-2 rounded-lg border border-base-content/5",children:[l.jsxs("div",{className:"text-[10px] font-mono text-base-content/50 mb-1 flex justify-between",children:[l.jsx("span",{children:"90 days ago"}),l.jsx("span",{children:"Today"})]}),l.jsx(Xz,{days:f.heatmapDays,color:f.color,maxDailyTokens:f.maxDailyTokens})]}),l.jsxs("div",{className:"grid grid-cols-3 gap-2 pt-2 border-t border-base-content/10 font-mono text-[11px]",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-base-content/50 block text-[10px]",children:"Sessions"}),l.jsx("span",{className:"font-semibold",children:mn(f.sessionCount)})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-base-content/50 block text-[10px]",children:"Tool Calls"}),l.jsx("span",{className:"font-semibold",children:mn(f.toolCalls)})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-base-content/50 block text-[10px]",children:"Cache Saved"}),l.jsx("span",{className:"font-semibold text-emerald-400",children:Ye(f.cacheSavedTokens)})]})]})]},f.id))})]}),l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 p-5",children:[l.jsx("h4",{className:"font-bold text-sm mb-3",children:"Source Directories & Import Roots"}),l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full text-xs text-left font-mono",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-base-content/10 text-base-content/60",children:[l.jsx("th",{className:"py-1.5",children:"Agent"}),l.jsx("th",{className:"py-1.5",children:"Filesystem Path"}),l.jsx("th",{className:"py-1.5",children:"Match Pattern"}),l.jsx("th",{className:"py-1.5 text-right",children:"Files Count"}),l.jsx("th",{className:"py-1.5 text-center",children:"Status"})]})}),l.jsx("tbody",{children:d.map(f=>l.jsxs("tr",{className:"border-b border-base-content/5 hover:bg-base-300/30",children:[l.jsx("td",{className:"py-1.5 font-bold",children:f.agentName}),l.jsx("td",{className:"py-1.5 text-base-content/80",children:f.path}),l.jsx("td",{className:"py-1.5 text-base-content/60",children:f.matchPattern}),l.jsx("td",{className:"py-1.5 text-right font-semibold",children:mn(f.fileCount)}),l.jsx("td",{className:"py-1.5 text-center",children:l.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-emerald-500/20 text-emerald-400 uppercase font-bold",children:f.status})})]},f.agentId))})]})})]})]})},Jz=["auto","5m","10m","30m","1h","4h","1d"],eH=(e,t)=>t===void 0||t===0?null:(e-t)/Math.abs(t)*100,vd=({current:e,previous:t,invert:n=!1})=>{const r=eH(e,t);if(r===null)return l.jsx("span",{className:"text-[10px] text-base-content/40",children:"No prior baseline"});const a=r>=0,s=n?!a:a;return l.jsxs("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-bold font-mono ${s?"bg-emerald-500/15 text-emerald-400":"bg-error/15 text-error"}`,children:[a?"↑ +":"↓ ",Math.abs(r).toFixed(1),"% vs previous period"]})},Co=({label:e,value:t,sub:n,trend:r,trendColor:a,current:s,previous:i,invert:o,badge:u})=>l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 p-4",children:[l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-base-content/60",children:e}),u]}),l.jsxs("div",{className:"flex items-end justify-between gap-2 mt-1",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-2xl font-bold font-mono text-primary",children:t}),l.jsxs("div",{className:"flex items-center gap-1.5 mt-1",children:[l.jsx(vd,{current:s,previous:i,invert:o}),l.jsx("span",{className:"text-xs text-base-content/60",children:n})]})]}),r.length>1&&l.jsx(Qz,{values:r,color:a,width:100,height:34})]})]}),aw=({data:e,loading:t,error:n,dimension:r="model",onDimensionChange:a,bucket:s="auto",onBucketChange:i,loopSummary:o})=>{const[u,c]=g.useState("chart");if(t)return l.jsx("div",{className:"flex items-center justify-center p-16",children:l.jsx("div",{className:"w-8 h-8 rounded-full border-4 border-primary border-t-transparent animate-spin"})});if(n)return l.jsx("div",{className:"p-4 rounded-lg bg-error/10 border border-error/20 text-error",children:l.jsxs("span",{children:["Failed to load history summary: ",n]})});if(!e)return null;const{kpis:p,previousKpis:d,kpiTrend:f,timeSeries:m,topModels:b,topSources:E,topTools:x,skillsUsed:y,skillTimeSeries:S,cacheEfficiency:w}=e,A=d??void 0,D={billed:f.map(H=>H.totalBilledTokens),cacheSaved:f.map(H=>H.cacheSavedTokens),sessions:f.map(H=>H.sessionsCount),toolCalls:f.map(H=>H.toolCallsCount)};let N=[];if(r==="model")N=b.map(H=>({id:H.id,label:H.label,color:H.color}));else if(r==="source")N=E.map(H=>({id:H.id,label:H.label,color:H.color}));else if(r==="tool"){const H=["#199e70","#3987e5","#d95926","#9085e9","#c98500","#ec4899","#8b5cf6"];N=x.slice(0,6).map((se,de)=>({id:se.id,label:se.id,color:H[de%H.length]??"#3987e5"}))}else N=y.map(H=>({id:H.id,label:H.label,color:H.color}));const T=m.map(H=>{const se=H.bucketStart.slice(5,10);return{id:H.bucketStart,label:se,v:H.series,lineValue:H.cacheHitRatio}}),v=S.map(H=>({id:H.bucketStart,label:H.bucketStart.slice(5,10),v:H.series})),R=Math.max(...x.map(H=>H.count),1),C=p.sessionsCount>0?p.totalBilledTokens/p.sessionsCount:0,U=p.toolCallsCount>0?p.totalBilledTokens/p.toolCallsCount:0,k=A&&A.sessionsCount>0?A.totalBilledTokens/A.sessionsCount:void 0,j=A&&A.toolCallsCount>0?A.totalBilledTokens/A.toolCallsCount:void 0,G=Math.max(0,w.totalRead-w.savedTokens),$=Math.max(0,p.totalBilledTokens-G),te=S.reduce((H,se)=>{for(const[de,O]of Object.entries(se.series))H[de]=(H[de]??0)+O;return H},{});return l.jsxs("div",{className:"flex flex-col gap-6",children:[l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[l.jsx(Co,{label:"Total Billed Tokens",value:Ye(p.totalBilledTokens),sub:`Fresh ${Ye(G)} · Output ${Ye($)}`,trend:D.billed,trendColor:"#3987e5",current:p.totalBilledTokens,previous:A?.totalBilledTokens}),l.jsx(Co,{label:"Cache-Saved Tokens",value:Ye(p.cacheSavedTokens),sub:`Share ${Kr(p.cacheSavedPercent)} · Hit ${Kr(w.hitRatio)}`,trend:D.cacheSaved,trendColor:"#22d3ee",current:p.cacheSavedTokens,previous:A?.cacheSavedTokens,badge:l.jsxs("span",{className:"px-2 py-0.5 rounded-full text-xs font-bold bg-emerald-500/20 text-emerald-400 border border-emerald-500/30",children:[p.cacheSavedPercent,"% saved"]})}),l.jsx(Co,{label:"Sessions",value:mn(p.sessionsCount),sub:`${mn(p.sessionsCount>0?p.toolCallsCount/p.sessionsCount:0)} calls / session`,trend:D.sessions,trendColor:"#9085e9",current:p.sessionsCount,previous:A?.sessionsCount}),l.jsx(Co,{label:"Tool Calls",value:mn(p.toolCallsCount),sub:`${Ye(U)} billed / step`,trend:D.toolCalls,trendColor:"#c98500",current:p.toolCallsCount,previous:A?.toolCallsCount,badge:l.jsxs("span",{className:"px-2 py-0.5 rounded-full text-xs font-mono bg-amber-500/20 text-amber-400 border border-amber-500/30",children:[Kr(p.errorRate)," err"]})})]}),l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 p-5",children:[l.jsxs("div",{className:"flex flex-wrap justify-between items-center gap-3 pb-2 border-b border-base-content/10",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"font-bold text-base",children:"Token Activity & Cache Hit Ratio"}),l.jsx("p",{className:"text-xs text-base-content/60",children:"Stacked token bars (left) with Cache Hit % line overlay (right)"})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs("fieldset",{className:"flex items-center bg-base-300 p-0.5 rounded-lg text-xs border-0",children:[l.jsx("legend",{className:"sr-only",children:"Bucket interval"}),Jz.map(H=>l.jsx("button",{type:"button","aria-pressed":s===H,className:`px-2 py-1 rounded font-medium transition-colors ${s===H?"bg-base-100 text-base-content font-bold shadow-sm":"text-base-content/60 hover:bg-base-content/10"}`,onClick:()=>i?.(H),children:H},H))]}),l.jsx("div",{className:"flex items-center bg-base-300 p-0.5 rounded-lg text-xs",children:["chart","table"].map(H=>l.jsx("button",{type:"button","aria-pressed":u===H,className:`px-2.5 py-1 rounded font-medium transition-colors ${u===H?"bg-base-100 text-base-content font-bold shadow-sm":"text-base-content/60 hover:bg-base-content/10"}`,onClick:()=>c(H),children:H==="chart"?"Chart":"Table"},H))}),l.jsx("div",{className:"flex items-center bg-base-300 p-0.5 rounded-lg text-xs",children:["model","source","tool","skill"].map(H=>l.jsxs("button",{type:"button","aria-pressed":r===H,className:`px-2.5 py-1 text-xs rounded font-medium transition-colors ${r===H?"bg-primary text-primary-content font-bold":"text-base-content/70 hover:bg-base-content/10"}`,onClick:()=>a?.(H),children:["By ",H.charAt(0).toUpperCase()+H.slice(1)]},H))})]})]}),l.jsx("div",{className:"pt-3",children:u==="chart"?l.jsx(Vz,{buckets:T,series:N,height:260}):l.jsx("div",{className:"overflow-x-auto max-h-80 overflow-y-auto",children:l.jsxs("table",{className:"w-full text-xs text-left font-mono","data-testid":"summary-bucket-table",children:[l.jsx("thead",{className:"sticky top-0 bg-base-200",children:l.jsxs("tr",{className:"border-b border-base-content/10 text-base-content/60",children:[l.jsx("th",{className:"py-1.5 pr-2",children:"Bucket"}),N.map(H=>l.jsx("th",{className:"py-1.5 pr-2 text-right",children:l.jsxs("span",{className:"inline-flex items-center gap-1",children:[l.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:H.color}}),H.label]})},H.id)),l.jsx("th",{className:"py-1.5 pr-2 text-right",children:"Total"}),l.jsx("th",{className:"py-1.5 text-right",children:"Cache Hit %"})]})}),l.jsx("tbody",{children:T.map(H=>{const se=Object.values(H.v).reduce((de,O)=>de+O,0);return l.jsxs("tr",{className:"border-b border-base-content/5",children:[l.jsx("td",{className:"py-1.5 pr-2 font-bold",children:(H.id??H.label).slice(0,16).replace("T"," ")}),N.map(de=>l.jsx("td",{className:"py-1.5 pr-2 text-right tabular-nums",children:H.v[de.id]!==void 0?Ye(H.v[de.id]??0):"—"},de.id)),l.jsx("td",{className:"py-1.5 pr-2 text-right tabular-nums font-bold",children:Ye(se)}),l.jsx("td",{className:"py-1.5 text-right tabular-nums",children:H.lineValue!==void 0?`${H.lineValue.toFixed(1)}%`:"—"})]},H.id??H.label)})})]})})})]}),l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 p-5",children:[l.jsx("h4",{className:"font-bold text-sm mb-3",children:"Top Models by Billed Tokens"}),l.jsx("div",{className:"flex flex-col gap-3",children:b.map(H=>l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsxs("div",{className:"flex justify-between text-xs font-mono",children:[l.jsxs("span",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"w-2.5 h-2.5 rounded-full",style:{background:H.color}}),H.label]}),l.jsxs("span",{children:[Ye(H.tokens)," (",H.share,"%)"]})]}),l.jsx("div",{className:"w-full bg-base-300 h-2 rounded-full overflow-hidden",children:l.jsx("div",{className:"h-full rounded-full",style:{width:`${H.share}%`,background:H.color}})})]},H.id))})]}),l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 p-5",children:[l.jsx("h4",{className:"font-bold text-sm mb-3",children:"Top Agent Sources by Billed Tokens"}),l.jsx("div",{className:"flex flex-col gap-3",children:E.map(H=>l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsxs("div",{className:"flex justify-between text-xs",children:[l.jsxs("span",{className:"flex items-center gap-1.5 font-medium",children:[l.jsx("span",{className:"w-2.5 h-2.5 rounded-full",style:{background:H.color}}),H.label]}),l.jsxs("span",{className:"font-mono",children:[Ye(H.tokens)," (",H.share,"%)"]})]}),l.jsx("div",{className:"w-full bg-base-300 h-2 rounded-full overflow-hidden",children:l.jsx("div",{className:"h-full rounded-full",style:{width:`${H.share}%`,background:H.color}})})]},H.id))})]}),l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 p-5",children:[l.jsx("h4",{className:"font-bold text-sm mb-2",children:"Top Tools & Error Rates"}),l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full text-xs text-left font-mono",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-base-content/10 text-base-content/60",children:[l.jsx("th",{className:"py-1.5",children:"Tool"}),l.jsx("th",{className:"py-1.5",children:"Share"}),l.jsx("th",{className:"py-1.5 text-right",children:"Calls"}),l.jsx("th",{className:"py-1.5 text-right",children:"Errors"}),l.jsx("th",{className:"py-1.5 text-right",children:"Error Rate"})]})}),l.jsx("tbody",{children:x.map(H=>l.jsxs("tr",{className:"border-b border-base-content/5 hover:bg-base-300/30",children:[l.jsx("td",{className:"py-1.5 font-bold",children:H.id}),l.jsx("td",{className:"py-1.5 w-28",children:l.jsx(Sd,{value:H.count,max:R,color:"#3987e5"})}),l.jsx("td",{className:"py-1.5 text-right tabular-nums",children:mn(H.count)}),l.jsx("td",{className:"py-1.5 text-right tabular-nums",children:H.errors>0?mn(H.errors):"0"}),l.jsx("td",{className:"py-1.5 text-right",children:l.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] ${H.errorRate>1?"bg-error/20 text-error font-bold":"bg-base-300 text-base-content/70"}`,children:Kr(H.errorRate)})})]},H.id))})]})})]}),l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 p-5 flex flex-col gap-4",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"font-bold text-sm mb-2",children:"Cache Efficiency Overview"}),l.jsxs("div",{className:"bg-base-300/60 p-3.5 rounded-xl border border-base-content/5 mb-4",children:[l.jsxs("div",{className:"flex justify-between items-center mb-1.5 text-xs font-semibold",children:[l.jsx("span",{children:"Global Cache Hit Ratio"}),l.jsxs("span",{className:"text-cyan-400 font-mono text-sm",children:[w.hitRatio,"%"]})]}),l.jsx("div",{className:"w-full bg-base-100 h-2.5 rounded-full overflow-hidden",children:l.jsx("div",{className:"h-full bg-cyan-400 rounded-full",style:{width:`${w.hitRatio}%`}})}),l.jsxs("div",{className:"flex justify-between text-[11px] text-base-content/60 mt-2 font-mono",children:[l.jsxs("span",{children:["Saved: ",Ye(w.savedTokens)]}),l.jsxs("span",{children:["Total Read: ",Ye(w.totalRead)]})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-3 text-xs font-mono",children:[l.jsxs("div",{className:"flex flex-col gap-0.5",children:[l.jsx("span",{className:"text-base-content/60 text-[10px] uppercase tracking-wider",children:"Avg Billed / Session"}),l.jsx("span",{className:"font-bold",children:Ye(C)}),l.jsx(vd,{current:C,previous:k,invert:!0})]}),l.jsxs("div",{className:"flex flex-col gap-0.5",children:[l.jsx("span",{className:"text-base-content/60 text-[10px] uppercase tracking-wider",children:"Avg Billed / Step"}),l.jsx("span",{className:"font-bold",children:Ye(U)}),l.jsx(vd,{current:U,previous:j,invert:!0})]}),l.jsxs("div",{className:"flex flex-col gap-0.5",children:[l.jsx("span",{className:"text-base-content/60 text-[10px] uppercase tracking-wider",children:"Loop Detection Findings"}),l.jsxs("span",{className:"font-bold",children:[mn(o?.redundantCalls??0)," redundant"]}),l.jsxs("span",{className:"text-[10px] text-base-content/60",children:[Ye(o?.wastedTokens??0)," wasted"]})]})]})]}),y.length>0&&l.jsxs("div",{children:[l.jsx("h5",{className:"font-bold text-xs mb-2",children:"Skills Invocation Mix"}),l.jsx(qz,{buckets:v,series:tH(y),height:150}),l.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:y.map(H=>l.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full bg-base-300 border border-base-content/10 gap-1.5 font-mono text-[11px]",children:[l.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:H.color}}),l.jsxs("span",{children:[H.label,":"]}),l.jsxs("span",{className:"font-bold",children:[Ye(te[H.id]??0)," tokens"]})]},H.id))})]})]})]})]})},tH=e=>e.map(t=>({id:t.id,label:t.label,color:t.color})),nH=({blocks:e,start:t,end:n,onJumpToTime:r})=>{const a=g.useId(),{bins:s,maxBinTokens:i,maxBinOperations:o,startMs:u,endMs:c,hasValidRange:p}=g.useMemo(()=>{if(!t||!n||e.length===0)return{bins:[],maxBinTokens:0,maxBinOperations:0,startMs:0,endMs:0,hasValidRange:!1};const d=Date.parse(t),f=Date.parse(n);if(Number.isNaN(d)||Number.isNaN(f)||f<d)return{bins:[],maxBinTokens:0,maxBinOperations:0,startMs:0,endMs:0,hasValidRange:!1};const m=96,E=Math.max(1,f-d)/m,x=Array.from({length:m},(w,A)=>({index:A,timeMs:d+A*E,tokens:0,operations:0}));for(const w of e){if(!w.timestamp)continue;const A=Date.parse(w.timestamp);if(Number.isNaN(A)||A<d||A>f)continue;const D=Math.min(m-1,Math.max(0,Math.floor((A-d)/E))),N=x[D];N&&(N.tokens+=w.totalTokens,N.operations+=w.operationCount)}const y=Math.max(1,...x.map(w=>w.tokens)),S=Math.max(1,...x.map(w=>w.operations));return{bins:x,maxBinTokens:y,maxBinOperations:S,startMs:d,endMs:f,hasValidRange:!0}},[e,t,n]);return!p||s.length===0?null:l.jsxs("div",{"data-testid":"timeline-scrubber",className:"flex flex-col gap-1.5 p-3 bg-base-200/80 rounded-xl border border-base-content/10 font-mono text-xs",children:[l.jsxs("div",{className:"flex items-center justify-between text-[11px] text-base-content/60 px-1",children:[l.jsxs("span",{children:["Timeline Activity (",s.length," bins)"]}),l.jsxs("span",{children:["Peak: ",Ye(i)]})]}),l.jsx("div",{className:"relative h-10 w-full bg-base-300/60 rounded-lg overflow-hidden flex items-end p-1",children:l.jsx("svg",{viewBox:"0 0 96 32",preserveAspectRatio:"none",className:"w-full h-full text-primary/70","aria-hidden":"true",children:s.map(d=>{const f=d.operations>0?Math.max(2,Math.round(d.operations/o*30)):0,m=d.tokens>0?.35+d.tokens/i*.65:.25,b=32-f;return l.jsx("rect",{x:d.index,y:b,width:"0.85",height:f,fill:"currentColor",fillOpacity:m,"data-operations":d.operations,"data-tokens":d.tokens,className:"hover:text-cyan-400 transition-colors",children:l.jsx("title",{children:`${new Date(d.timeMs).toISOString()} · ${Ye(d.tokens)} · ${d.operations} ops`})},d.index)})})}),l.jsx("label",{htmlFor:a,className:"sr-only",children:"Timeline scrub slider"}),l.jsx("input",{id:a,type:"range",min:u,max:c,defaultValue:u,"aria-label":"Timeline navigation scrubber","data-testid":"timeline-scrubber-range",className:"w-full range range-xs range-primary cursor-pointer accent-primary",onInput:d=>{const f=Number(d.currentTarget.value);Number.isFinite(f)&&r?.(new Date(f).toISOString())}})]})},ja=(e,t)=>`${e}:${t}`,Ba=(e,t)=>JSON.stringify([e,t]),oa=e=>e.replace(/[^a-zA-Z0-9_-]/g,"-"),bl=(e,t,n)=>e+t+n,rH=(e,t)=>{const n=e+t;return n>0?t/n*100:0},wd=e=>e.length<=12?e:`${e.slice(0,8)}…${e.slice(-4)}`,aH=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],sw=e=>{if(!e)return"—";const t=new Date(e);if(Number.isNaN(t.getTime()))return e;const n=aH[t.getUTCMonth()],r=t.getUTCDate(),a=String(t.getUTCHours()).padStart(2,"0"),s=String(t.getUTCMinutes()).padStart(2,"0");return`${n} ${r} ${a}:${s}`},Ad=e=>{if(!e)return"—";const t=new Date(e);if(Number.isNaN(t.getTime()))return e.slice(11,19)||e;const n=String(t.getUTCHours()).padStart(2,"0"),r=String(t.getUTCMinutes()).padStart(2,"0"),a=String(t.getUTCSeconds()).padStart(2,"0");return`${n}:${r}:${a}`},Jx=e=>`${wd(e.id)} · ${e.source} · ${sw(e.start)} · ${Ye(e.tokenLoad)}`,sH=e=>{const t=e.payload?.trim();return t&&t.length>0?t:e.title},ey=e=>e.split(/\r?\n/).map(n=>n.trim()).find(n=>n.length>0)??e,ty=e=>e.kind==="assistant"||e.eventType==="message"&&e.kind!=="user",iH=e=>{const t=(e.toolName||e.kind||"").toLowerCase();return t.includes("glob")?{label:e.toolName||"glob",color:"#6366f1"}:t.includes("grep")?{label:e.toolName||"grep",color:"#a855f7"}:t.includes("edit")||t.includes("write")||t.includes("patch")?{label:e.toolName||"edit",color:"#eab308"}:t.includes("read")||t.includes("view")||t.includes("list")?{label:e.toolName||"read",color:"#10b981"}:t.includes("bash")||t.includes("exec")||t.includes("command")||t.includes("terminal")?{label:e.toolName||"bash",color:"#3b82f6"}:t.includes("search")||t.includes("find")?{label:e.toolName||"search",color:"#a855f7"}:t.includes("run")?{label:e.toolName||"run",color:"#f59e0b"}:{label:e.toolName||e.kind,color:"#64748b"}},oH=()=>l.jsxs("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":"User icon",children:[l.jsx("path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}),l.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),lH=({promptTokens:e,fullText:t,tooltipId:n})=>{const[r,a]=g.useState(!1),s=e?.freshInputTokens??0,i=e?.cacheReadTokens??0,o=e?.outputTokens??0,u=bl(s,i,o),c=t.length>0?t.split(/\r?\n/).length:0,p=t.length;return l.jsxs("div",{className:"relative inline-flex items-center z-20",children:[l.jsx("button",{type:"button","aria-label":"Show user prompt token breakdown","aria-describedby":n,"data-testid":`timeline-user-badge-${n}`,className:"p-1 rounded bg-base-300 text-cyan-400 shrink-0 hover:bg-base-content/10 focus:outline-none focus-visible:ring-1 focus-visible:ring-primary transition-colors cursor-pointer",onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),onFocus:()=>a(!0),onBlur:()=>a(!1),onKeyDown:d=>{d.key==="Escape"&&a(!1)},children:l.jsx(oH,{})}),l.jsxs("div",{id:n,role:"tooltip","data-testid":n,className:`absolute left-0 top-full z-50 mt-1.5 w-56 p-2 rounded-lg bg-base-300 border border-base-content/20 shadow-2xl text-[11px] font-mono leading-relaxed pointer-events-none ${r?"block":"hidden"}`,children:[l.jsx("div",{className:"font-bold text-base-content mb-1",children:"User Prompt Telemetry"}),l.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-2 gap-y-0.5 text-base-content/80",children:[l.jsx("span",{className:"text-base-content/60",children:"Lines / chars:"}),l.jsxs("span",{children:[c," lines (",p," chars)"]}),l.jsx("span",{className:"text-base-content/60",children:"📥 Fresh input:"}),l.jsx("span",{children:Ye(s)}),l.jsx("span",{className:"text-base-content/60",children:"💾 Cache read:"}),l.jsx("span",{className:"text-cyan-400",children:Ye(i)}),l.jsx("span",{className:"text-base-content/60",children:"📤 Output:"}),l.jsx("span",{children:Ye(o)}),l.jsx("span",{className:"text-base-content/60 border-t border-base-content/10 pt-0.5",children:"⚡ Turn load:"}),l.jsx("span",{className:"font-bold border-t border-base-content/10 pt-0.5 text-primary",children:Ye(u)})]})]})]})},ny=({agentId:e,model:t,timestamp:n,tooltipId:r})=>{const[a,s]=g.useState(!1);return l.jsxs("div",{className:"relative inline-flex items-center z-20",children:[l.jsx("button",{type:"button","aria-label":`Show ${e} metadata`,"aria-describedby":r,"data-testid":`timeline-agent-badge-${r}`,className:"inline-flex items-center justify-center p-1 rounded hover:bg-base-content/10 text-base-content focus:outline-none focus-visible:ring-1 focus-visible:ring-primary transition-colors cursor-pointer",onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),onFocus:()=>s(!0),onBlur:()=>s(!1),onKeyDown:i=>{i.key==="Escape"&&s(!1)},children:l.jsx(ls,{id:e})}),l.jsxs("div",{id:r,role:"tooltip","data-testid":r,className:`absolute left-0 top-full z-50 mt-1.5 w-56 p-2 rounded-lg bg-base-300 border border-base-content/20 shadow-2xl text-[11px] font-mono leading-relaxed pointer-events-none ${a?"block":"hidden"}`,children:[l.jsxs("div",{className:"font-bold text-base-content mb-1 flex items-center gap-1.5",children:[l.jsx(ls,{id:e}),l.jsx("span",{children:e})]}),l.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-2 gap-y-0.5 text-base-content/80",children:[l.jsx("span",{className:"text-base-content/60",children:"Model:"}),l.jsx("span",{className:"truncate",children:t}),l.jsx("span",{className:"text-base-content/60",children:"Timestamp:"}),l.jsx("span",{className:"truncate",children:Ad(n)})]})]})]})},uH=({title:e,freshInputTokens:t,cacheReadTokens:n,outputTokens:r,color:a,tooltipId:s})=>{const[i,o]=g.useState(!1),u=bl(t,n,r);return l.jsxs("div",{className:"relative inline-flex items-center z-20",children:[l.jsx("button",{type:"button","aria-describedby":s,"data-testid":`timeline-tool-badge-${s}`,className:"px-1.5 py-0.5 rounded text-[10.5px] font-mono font-medium truncate max-w-[140px] sm:max-w-[200px] border focus:outline-none focus-visible:ring-1 focus-visible:ring-primary transition-colors cursor-pointer",style:{color:a,backgroundColor:`${a}18`,borderColor:`${a}40`},onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),onFocus:()=>o(!0),onBlur:()=>o(!1),onKeyDown:c=>{c.key==="Escape"&&o(!1)},children:e}),l.jsxs("div",{id:s,role:"tooltip","data-testid":s,className:`absolute left-0 top-full z-50 mt-1.5 w-52 p-2 rounded-lg bg-base-300 border border-base-content/20 shadow-2xl text-[11px] font-mono leading-relaxed pointer-events-none ${i?"block":"hidden"}`,children:[l.jsx("div",{className:"font-bold text-base-content mb-1",children:"Token Breakdown"}),l.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-2 gap-y-0.5 text-base-content/80",children:[l.jsx("span",{className:"text-base-content/60",children:"📥 Fresh input:"}),l.jsx("span",{children:Ye(t)}),l.jsx("span",{className:"text-base-content/60",children:"💾 Cache read:"}),l.jsx("span",{className:"text-cyan-400",children:Ye(n)}),l.jsx("span",{className:"text-base-content/60",children:"📤 Output:"}),l.jsx("span",{children:Ye(r)}),l.jsx("span",{className:"text-base-content/60 border-t border-base-content/10 pt-0.5",children:"⚡ Total:"}),l.jsx("span",{className:"font-bold border-t border-base-content/10 pt-0.5 text-primary",children:Ye(u)})]})]})]})},iw=({data:e,loading:t,error:n,mode:r="session",sessionId:a,availableSessions:s=[],onSelectSession:i,onModeChange:o,consolidatedTaskWbs:u="",consolidatedRunId:c="",onConsolidatedScopeSubmit:p})=>{const d=e?.scope.sessionId,f=e?.scope.source,[m,b]=g.useState({}),[E,x]=g.useState(!0),[y,S]=g.useState(!0),[w,A]=g.useState(!0),[D,N]=g.useState(u),[T,v]=g.useState(c),R=d&&f?Ba(f,d):"consolidated",C=m[R]||{},U=Q=>{b(_e=>({..._e,[R]:Q(_e[R]||{})}))},k=(Q,_e)=>{const fe=ja(Q,_e);U(X=>({...X,[fe]:!X[fe]}))};if(t)return l.jsx("div",{className:"flex items-center justify-center p-16",children:l.jsx("div",{className:"w-8 h-8 rounded-full border-4 border-primary border-t-transparent animate-spin motion-reduce:animate-none"})});if(n)return l.jsx("div",{className:"p-4 rounded-lg bg-error/10 border border-error/20 text-error",children:l.jsxs("span",{children:["Failed to load timeline: ",n]})});if(!e)return l.jsx("div",{className:"p-4 rounded-lg bg-info/10 border border-info/20 text-info",children:l.jsx("span",{children:"No timeline data available."})});const{scope:j,blocks:G,truncated:$}=e,te=bl(j.tokens.freshInputTokens,j.tokens.cacheReadTokens,j.tokens.outputTokens),H=rH(j.tokens.freshInputTokens,j.tokens.cacheReadTokens),se=G.map(Q=>{const _e=Q.events.filter(fe=>ty(fe)?!E:fe.kind==="unknown"||fe.agent==="unknown"?!y:!(w&&!fe.payload?.trim()&&(fe.durationMs===null||fe.durationMs===0)&&bl(fe.freshInputTokens,fe.cacheReadTokens,fe.outputTokens)===0));return{...Q,events:_e}}).filter(Q=>Q.events.length>0),de=se.flatMap(Q=>Q.events.filter(_e=>!!_e.payload?.trim()).map(_e=>ja(Q.key,_e.seq))),O=de.length>0&&de.every(Q=>C[Q]),ne=()=>U(()=>O?{}:Object.fromEntries(de.map(Q=>[Q,!0]))),pe=s.findIndex(Q=>Q.id===j.sessionId&&Q.source===j.source),L=pe>0?s[pe-1]:void 0,ke=pe>=0&&pe<s.length-1?s[pe+1]:void 0,Re=Q=>{const _e=Date.parse(Q),fe=se.find(X=>{const Ve=X.timestamp?Date.parse(X.timestamp):Number.NaN;return Number.isFinite(Ve)&&Ve>=_e})??se.at(-1);fe&&document.getElementById(`timeline-block-${oa(fe.key)}`)?.scrollIntoView({behavior:"smooth",block:"center"})};return l.jsxs("div",{className:"flex flex-col gap-6",children:[l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 p-5 flex flex-col gap-4",children:[l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[l.jsx("h3",{className:"text-base font-bold tracking-tight",children:"Conversation"}),l.jsxs("fieldset",{className:"inline-flex border border-base-content/20 rounded-lg p-0.5 bg-base-300 font-mono text-xs",children:[l.jsx("legend",{className:"sr-only",children:"Timeline mode"}),l.jsx("button",{type:"button","data-testid":"timeline-mode-session","aria-pressed":r==="session",className:`px-2.5 py-1 rounded-md transition-colors ${r==="session"?"bg-primary text-primary-content font-bold":"text-base-content/70 hover:text-base-content"}`,onClick:()=>o?.("session"),children:"Single Session"}),l.jsx("button",{type:"button","data-testid":"timeline-mode-consolidated","aria-pressed":r==="consolidated",className:`px-2.5 py-1 rounded-md transition-colors ${r==="consolidated"?"bg-primary text-primary-content font-bold":"text-base-content/70 hover:text-base-content"}`,onClick:()=>o?.("consolidated"),children:"Consolidated"})]})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3",children:[r==="session"?l.jsxs(l.Fragment,{children:[l.jsxs("label",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"sr-only",children:"Session"}),l.jsx("select",{"aria-label":"Select Session","data-testid":"timeline-session-select",className:"px-3 py-1.5 min-h-[44px] text-xs rounded-lg border border-base-content/20 bg-base-300 font-mono text-base-content max-w-xs focus:outline-none focus-visible:ring-2 focus-visible:ring-primary",value:j.source&&j.sessionId?Ba(j.source,j.sessionId):"",onChange:Q=>{const _e=s.find(fe=>Ba(fe.source,fe.id)===Q.target.value);_e&&i?.(_e.source,_e.id)},children:s.length>0?s.map(Q=>l.jsx("option",{value:Ba(Q.source,Q.id),children:Jx(Q)},Ba(Q.source,Q.id))):l.jsx("option",{value:j.source&&j.sessionId?Ba(j.source,j.sessionId):"",children:j.sessionId?Jx({id:j.sessionId,source:j.source??"unknown",start:j.start??"",tokenLoad:te}):"No session selected"})})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{type:"button","aria-label":"Previous session",disabled:!L,className:"px-3 py-2 min-h-[44px] min-w-[44px] inline-flex items-center justify-center text-xs font-mono rounded-lg border border-base-content/20 bg-base-300 text-base-content/80 disabled:opacity-40 disabled:cursor-not-allowed hover:bg-base-content/10 transition-colors focus-visible:ring-2 focus-visible:ring-primary",onClick:()=>L&&i?.(L.source,L.id),children:"←"}),l.jsx("button",{type:"button","aria-label":"Next session",disabled:!ke,className:"px-3 py-2 min-h-[44px] min-w-[44px] inline-flex items-center justify-center text-xs font-mono rounded-lg border border-base-content/20 bg-base-300 text-base-content/80 disabled:opacity-40 disabled:cursor-not-allowed hover:bg-base-content/10 transition-colors focus-visible:ring-2 focus-visible:ring-primary",onClick:()=>ke&&i?.(ke.source,ke.id),children:"→"})]})]}):l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-base-300 border border-base-content/20 text-xs font-mono",children:[l.jsx("span",{className:"text-base-content/60",children:"Scope:"}),l.jsxs("span",{className:"font-semibold text-primary",children:[j.sessionCount," sessions"]})]}),l.jsxs("form",{className:"flex flex-wrap items-end gap-2",onSubmit:Q=>{Q.preventDefault(),p?.({taskWbs:D.trim(),runId:T.trim()})},children:[l.jsxs("label",{className:"flex flex-col gap-1 text-[10px] font-mono text-base-content/60",children:["Task WBS",l.jsx("input",{type:"text",value:D,onInput:Q=>N(Q.currentTarget.value),className:"min-h-[44px] w-28 rounded-lg border border-base-content/20 bg-base-300 px-2 text-xs text-base-content focus:outline-none focus-visible:ring-2 focus-visible:ring-primary"})]}),l.jsxs("label",{className:"flex flex-col gap-1 text-[10px] font-mono text-base-content/60",children:["Run ID",l.jsx("input",{type:"text",value:T,onInput:Q=>v(Q.currentTarget.value),className:"min-h-[44px] w-40 rounded-lg border border-base-content/20 bg-base-300 px-2 text-xs text-base-content focus:outline-none focus-visible:ring-2 focus-visible:ring-primary"})]}),l.jsx("button",{type:"submit",className:"min-h-[44px] rounded-lg bg-primary px-3 text-xs font-semibold text-primary-content focus-visible:ring-2 focus-visible:ring-primary",children:"Apply scope"})]})]}),l.jsx("button",{type:"button","aria-pressed":O,disabled:de.length===0,className:"px-3.5 py-2 min-h-[44px] rounded-lg text-xs font-semibold border border-primary/30 text-primary hover:bg-primary/10 disabled:opacity-40 disabled:cursor-not-allowed transition-colors focus-visible:ring-2 focus-visible:ring-primary",onClick:ne,children:O?"Collapse all":"Expand all"}),l.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs font-mono text-base-content/80",children:[l.jsxs("label",{className:"inline-flex items-center gap-1.5 cursor-pointer select-none",children:[l.jsx("input",{type:"checkbox","data-testid":"timeline-filter-assistant",className:"w-3.5 h-3.5 rounded border border-base-content/30 accent-primary focus-visible:ring-1 focus-visible:ring-primary",checked:E,onChange:Q=>x(Q.target.checked)}),l.jsx("span",{children:"Hide assistant"})]}),l.jsxs("label",{className:"inline-flex items-center gap-1.5 cursor-pointer select-none",children:[l.jsx("input",{type:"checkbox","data-testid":"timeline-filter-unknown",className:"w-3.5 h-3.5 rounded border border-base-content/30 accent-primary focus-visible:ring-1 focus-visible:ring-primary",checked:y,onChange:Q=>S(Q.target.checked)}),l.jsx("span",{children:"Hide unknown"})]}),l.jsxs("label",{className:"inline-flex items-center gap-1.5 cursor-pointer select-none",children:[l.jsx("input",{type:"checkbox","data-testid":"timeline-filter-empty",className:"w-3.5 h-3.5 rounded border border-base-content/30 accent-primary focus-visible:ring-1 focus-visible:ring-primary",checked:w,onChange:Q=>A(Q.target.checked)}),l.jsx("span",{children:"Hide other empty"})]})]})]})]}),l.jsxs("div",{"data-testid":"timeline-metadata-strip",className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-5 lg:grid-cols-9 gap-3 pt-3 border-t border-base-content/10 text-xs font-mono",children:[l.jsxs("div",{className:"flex flex-col",children:[l.jsx("span",{className:"text-[10px] uppercase tracking-wider text-base-content/60",children:r==="session"?"SESSION":"SESSIONS"}),l.jsx("span",{className:"font-semibold truncate",title:j.sessionId??`${j.sessionCount} sessions`,children:j.sessionId?wd(j.sessionId):`${j.sessionCount} total`})]}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("span",{className:"text-[10px] uppercase tracking-wider text-base-content/60",children:"AGENT"}),l.jsx("span",{className:"inline-flex items-center gap-1 font-semibold truncate",children:j.source?l.jsxs(l.Fragment,{children:[l.jsx(ls,{id:j.source}),j.source]}):"multiple"})]}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("span",{className:"text-[10px] uppercase tracking-wider text-base-content/60",children:"MODEL"}),l.jsxs("span",{className:"inline-flex items-center gap-1.5 truncate",children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-primary/70 shrink-0"}),j.model??"multiple"]})]}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("span",{className:"text-[10px] uppercase tracking-wider text-base-content/60",children:"STARTED"}),l.jsx("span",{className:"truncate",children:sw(j.start)})]}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("span",{className:"text-[10px] uppercase tracking-wider text-base-content/60",children:"DURATION"}),l.jsx("span",{className:"font-semibold truncate",children:ew(j.durationMs/6e4)})]}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("span",{className:"text-[10px] uppercase tracking-wider text-base-content/60",children:"TOTAL TOKENS"}),l.jsx("span",{className:"font-bold text-primary truncate",children:Ye(te)})]}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("span",{className:"text-[10px] uppercase tracking-wider text-base-content/60",children:"CACHE READ"}),l.jsxs("span",{className:"font-semibold text-cyan-400 truncate",children:[H.toFixed(1),"%"]})]}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("span",{className:"text-[10px] uppercase tracking-wider text-base-content/60",children:"OUTPUT TOKENS"}),l.jsx("span",{className:"truncate",children:Ye(j.tokens.outputTokens)})]}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("span",{className:"text-[10px] uppercase tracking-wider text-base-content/60",children:"TOOL CALLS"}),l.jsx("span",{className:"truncate",children:mn(j.toolCallCount)})]})]}),l.jsx(nH,{blocks:se,start:j.start,end:j.end,onJumpToTime:Re})]}),$&&l.jsxs("div",{"data-testid":"timeline-truncated-banner",className:"p-3 rounded-lg bg-info/10 border border-info/20 text-info font-mono text-xs flex items-center gap-2",children:[l.jsx("span",{children:"ℹ️"}),l.jsx("span",{children:"Showing newest 5,000 events. Apply a narrower filter or time window to inspect earlier events."})]}),l.jsx("div",{"data-testid":"timeline-rail",className:"relative py-2 sm:py-4 before:absolute before:left-2 sm:before:left-[136px] before:top-0 before:bottom-0 before:w-px before:bg-gradient-to-b before:from-transparent before:via-base-content/20 before:to-transparent flex flex-col gap-3",children:se.map(Q=>{const _e=Q.events.filter(X=>X.kind==="user"),fe=Q.events.filter(X=>X.kind!=="user");return l.jsxs("div",{id:`timeline-block-${oa(Q.key)}`,"data-testid":`timeline-block-${Q.key}`,className:"flex flex-col gap-2.5",children:[r==="consolidated"&&l.jsxs("div",{className:"flex items-center gap-2 pl-6 sm:pl-[144px] pt-2 pb-1 font-mono text-xs text-base-content/70",children:[l.jsx(ls,{id:Q.source}),l.jsx("span",{className:"font-bold text-base-content",children:Q.source}),l.jsxs("span",{children:["· ",wd(Q.sessionId)]}),l.jsxs("span",{children:["· Turn #",Q.turnIndex]}),Q.correlationExactness&&l.jsx("span",{"data-testid":`timeline-exactness-${Q.key}`,className:`px-1.5 py-0.2 rounded text-[10px] font-bold ${Q.correlationExactness==="exact"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-amber-500/10 text-amber-400 border border-amber-500/20"}`,children:Q.correlationExactness})]}),_e.map(X=>{const Ve=sH(X),ge=X.payload?.trim()??"",me=ey(Ve),Te=!!X.payload?.trim(),ve=!!C[ja(Q.key,X.seq)],ie=oa(`timeline-user-drawer-${Q.key}-${X.seq}`),Ze=oa(`user-tt-${Q.key}-${X.seq}`);return l.jsxs("div",{className:"relative flex flex-col sm:grid sm:grid-cols-[136px_minmax(0,1fr)] py-1","data-testid":`timeline-user-event-${Q.key}-${X.seq}`,children:[l.jsxs("div",{className:"hidden sm:flex flex-col items-end justify-center pr-4 font-mono text-[10.5px] text-base-content/70",children:[l.jsx("span",{className:"font-semibold text-base-content/90",children:Ad(Q.timestamp)}),l.jsxs("span",{className:"text-[10px] text-base-content/50",children:["📥 ",Ye(X.freshInputTokens)," in"]})]}),l.jsx("span",{"data-timeline-node":"prompt",className:"absolute left-[3.5px] sm:left-[131.5px] top-1/2 -translate-y-1/2 w-[9px] h-[9px] rounded-full bg-cyan-400 ring-4 ring-base-100 z-10","aria-hidden":"true"}),l.jsx("div",{className:"pl-6 sm:pl-5 min-w-0 flex justify-end",children:l.jsxs("div",{className:"w-[80%] max-w-none bg-base-100 rounded-lg border border-primary/20 hover:border-primary/40 transition-colors p-2 sm:px-3 sm:py-2 flex flex-col gap-1",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2 min-h-[32px]",children:[l.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[l.jsx(lH,{promptTokens:X.promptTokens,fullText:ge,tooltipId:Ze}),l.jsx("span",{className:"font-mono text-xs font-semibold text-base-content/90 truncate min-w-0",children:me})]}),l.jsx("div",{className:"flex items-center gap-2 shrink-0 font-mono text-[11px] text-base-content/60",children:Te?l.jsx("button",{type:"button","aria-label":ve?"Collapse full user prompt":"Expand full user prompt","aria-expanded":ve,"aria-controls":ie,onClick:()=>k(Q.key,X.seq),className:"p-1 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 inline-flex items-center justify-center text-base-content/60 hover:text-base-content transition-colors cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-primary rounded",children:l.jsx("span",{className:`text-xs font-mono transition-transform duration-150 ${ve?"rotate-90":""}`,"aria-hidden":"true",children:"›"})}):null})]}),ve&&Te&&l.jsx("div",{id:ie,className:"mt-1 p-3 bg-[#0d141f] text-slate-100 rounded-md font-mono text-xs whitespace-pre-wrap overflow-x-auto border border-white/10",children:Ve})]})})]},ja(Q.key,X.seq))}),fe.map(X=>{const Ve=iH(X),ge=!!C[ja(Q.key,X.seq)],me=!!X.payload?.trim(),Te=oa(`timeline-op-drawer-${Q.key}-${X.seq}`),ve=oa(`agent-tt-${Q.key}-${X.seq}`),ie=oa(`tool-tt-${Q.key}-${X.seq}`),Ze=ty(X);return l.jsxs("div",{className:"relative flex flex-col sm:grid sm:grid-cols-[136px_minmax(0,1fr)] py-1 hover:z-30 focus-within:z-30","data-testid":`timeline-op-event-${Q.key}-${X.seq}`,children:[l.jsxs("div",{className:"hidden sm:flex flex-col items-end justify-center pr-4 font-mono text-[10.5px] text-base-content/70",children:[l.jsx("span",{className:"font-semibold text-base-content/90",children:Ad(Q.timestamp)}),X.durationSource==="measured"&&X.durationMs!==null?l.jsxs("span",{"data-testid":`timeline-step-duration-${Q.key}-${X.seq}`,className:X.durationMs>=5e3?"font-bold text-amber-400":"text-base-content/60",children:["⏱ ",yd(X.durationMs)]}):X.durationSource==="inferred"&&X.durationMs!==null?l.jsxs("span",{"data-testid":`timeline-step-duration-${Q.key}-${X.seq}`,title:"Inferred from next event timestamp within session",className:"text-base-content/60 italic",children:["⏱ ~",yd(X.durationMs)]}):l.jsx("span",{"data-testid":`timeline-step-duration-${Q.key}-${X.seq}`,title:"Unmeasured (gap > 10m or last event)",className:"text-base-content/40",children:"⏱ —"})]}),l.jsx("span",{"data-timeline-node":"operation",className:"absolute left-[3.5px] sm:left-[131.5px] top-1/2 -translate-y-1/2 w-[9px] h-[9px] rounded-full ring-4 ring-base-100 z-10",style:{backgroundColor:Ve.color},"aria-hidden":"true"}),l.jsx("div",{className:"pl-6 sm:pl-5 min-w-0 flex justify-start",children:Ze?l.jsxs("div",{className:"w-[80%] max-w-none bg-base-100 rounded-lg border border-base-content/10 border-l-[3px] border-l-primary/70 transition-colors relative",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2 px-2.5 py-1.5 min-h-[38px]",children:[l.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[l.jsx(ny,{agentId:X.agent||Q.source,model:X.model||Q.model,timestamp:Q.timestamp,tooltipId:ve}),l.jsx("span",{className:"font-mono text-xs text-base-content/60 truncate",children:X.model}),l.jsx("span",{className:"font-mono text-xs text-base-content/90 truncate min-w-0",children:ey(X.payload||X.title)})]}),l.jsxs("div",{className:"flex items-center gap-2 shrink-0 font-mono text-[11px] text-base-content/60",children:[l.jsxs("span",{children:["📤 ",Ye(X.outputTokens)]}),me?l.jsx("button",{type:"button","aria-label":ge?"Collapse response":"Expand response","aria-expanded":ge,"aria-controls":Te,onClick:()=>k(Q.key,X.seq),className:"p-1 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 inline-flex items-center justify-center text-base-content/60 hover:text-base-content transition-colors cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-primary rounded",children:l.jsx("span",{className:`text-xs font-mono transition-transform duration-150 ${ge?"rotate-90":""}`,"aria-hidden":"true",children:"›"})}):null]})]}),ge&&X.payload&&l.jsx("div",{id:Te,className:"p-3 bg-[#0d141f] text-slate-100 font-mono text-xs whitespace-pre-wrap overflow-x-auto rounded-b-lg border-t border-base-content/10",children:X.payload})]}):l.jsxs("div",{className:"w-[80%] max-w-none bg-base-100 rounded-lg border border-base-content/10 border-l-[3px] transition-colors relative",style:{borderLeftColor:Ve.color},children:[l.jsxs("div",{className:"flex items-center justify-between gap-2 px-2.5 py-1.5 min-h-[38px]",children:[l.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[l.jsx(ny,{agentId:X.agent||Q.source,model:X.model||Q.model,timestamp:Q.timestamp,tooltipId:ve}),l.jsx(uH,{title:Ve.label,freshInputTokens:X.freshInputTokens,cacheReadTokens:X.cacheReadTokens,outputTokens:X.outputTokens,color:Ve.color,tooltipId:ie}),X.title&&X.title.trim().length>0?l.jsx("span",{className:"font-mono text-xs font-semibold text-base-content/90 truncate min-w-0",title:X.title,children:X.title}):null]}),l.jsxs("div",{className:"flex items-center gap-2 shrink-0 font-mono",children:[X.exitCode!==null&&l.jsxs("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-bold ${X.exitCode===0?"bg-emerald-500/20 text-emerald-400 border border-emerald-500/30":"bg-error/20 text-error border border-error/30"}`,children:["EXIT_CODE=",X.exitCode]}),me?l.jsx("button",{type:"button","aria-label":ge?"Collapse operation payload":"Expand operation payload","aria-expanded":ge,"aria-controls":Te,onClick:()=>k(Q.key,X.seq),className:"p-1 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 inline-flex items-center justify-center text-base-content/60 hover:text-base-content transition-colors cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-primary rounded",children:l.jsx("span",{className:`text-xs font-mono transition-transform duration-150 ${ge?"rotate-90":""}`,"aria-hidden":"true",children:"›"})}):null]})]}),ge&&X.payload&&l.jsx("div",{id:Te,className:"p-3 bg-[#0d141f] text-slate-100 font-mono text-xs whitespace-pre-wrap overflow-x-auto rounded-b-lg border-t border-base-content/10",children:X.payload})]})})]},ja(Q.key,X.seq))})]},Q.key)})})]})},cH=[{id:"summary",label:"Summary",component:aw},{id:"timeline",label:"Timeline",component:iw},{id:"sessions",label:"Sessions",component:nw},{id:"insights",label:"Insights",component:tw},{id:"sources",label:"Sources",component:rw}],ko=(e,t)=>{const n=new Map;for(const r of e)n.set(r.id,r);for(const r of t??[])n.has(r)||n.set(r,{id:r,label:r});return[...n.values()]},dH=e=>e.range==="24h"?"Last 24h":e.range==="7d"?"Last 7d":e.range==="30d"?"Last 30d":e.range==="all"?"All time":`${e.from?.slice(0,10)??"…"} → ${e.to?.slice(0,10)??"…"}`,wc=e=>e instanceof Error?e.message:String(e),pH=()=>{const[e,t]=g.useState("summary"),[n,r]=g.useState({range:"30d",bucket:"auto",dimension:"model"}),[a,s]=g.useState("session"),[i,o]=g.useState(null),[u,c]=g.useState({taskWbs:"",runId:""}),[p,d]=g.useState(1),[f,m]=g.useState("start"),[b,E]=g.useState("desc"),[x,y]=g.useState(void 0),[S,w]=g.useState(void 0),[A,D]=g.useState(void 0),[N,T]=g.useState(void 0),[v,R]=g.useState(void 0),[C,U]=g.useState([]),[k,j]=g.useState(!1),[G,$]=g.useState(!0),[te,H]=g.useState(null),[se,de]=g.useState(!0),[O,ne]=g.useState(null),[pe,L]=g.useState(!0),[ke,Re]=g.useState(null),[Q,_e]=g.useState(!1),[fe,X]=g.useState(null),[Ve,ge]=g.useState(!1),[me,Te]=g.useState(null);g.useEffect(()=>{let J=!0;return $(!0),H(null),de(!0),ne(null),(async()=>{const[ue,Pe]=await Promise.allSettled([sn.history.getSummary(n),sn.history.getInsights(n)]);J&&(ue.status==="fulfilled"&&ue.value?.data?y(ue.value.data):H("Failed to load summary"),Pe.status==="fulfilled"&&Pe.value?.data?T(Pe.value.data):ne("Failed to load insights"),$(!1),de(!1))})(),()=>{J=!1}},[n]),g.useEffect(()=>{let J=!0;return L(!0),Re(null),(async()=>{try{const ue=await sn.history.getSources();if(!J)return;ue?.data?R(ue.data):Re("Failed to load sources")}catch(ue){J&&Re(wc(ue))}finally{J&&L(!1)}})(),()=>{J=!1}},[]),g.useEffect(()=>{if(e!=="timeline")return;let J=!0;return j(!0),(async()=>{try{const ue=await sn.history.getSessions({filter:n,page:1,pageSize:100,sortBy:"start",sortDir:"desc"});if(!J)return;const Pe=(ue?.data?.items??[]).map(ht=>({id:ht.id,source:ht.source,model:ht.model,start:ht.start,tokenLoad:ht.freshInputTokens+ht.cacheReadTokens+ht.outputTokens}));U(Pe);const qe=Pe[0];qe&&!i&&o({source:qe.source,id:qe.id})}catch{J&&U([])}finally{J&&j(!1)}})(),()=>{J=!1}},[e,n,i]),g.useEffect(()=>{if(e!=="sessions")return;let J=!0;return _e(!0),X(null),(async()=>{try{const ue=await sn.history.getSessions({filter:n,page:p,pageSize:20,sortBy:f,sortDir:b});if(!J)return;ue?.data?D(ue.data):X("Failed to load sessions")}catch(ue){J&&X(wc(ue))}finally{J&&_e(!1)}})(),()=>{J=!1}},[e,n,p,f,b]),g.useEffect(()=>{if(e!=="timeline")return;if(a==="session"&&!i){const ue=C[0];!k&&ue&&o({source:ue.source,id:ue.id});return}let J=!0;return ge(!0),Te(null),(async()=>{try{const ue=a==="session"&&i?await sn.history.getTimeline({mode:"session",source:i.source,sessionId:i.id}):await sn.history.getTimeline({mode:"consolidated",filter:n,...u.taskWbs?{taskWbs:u.taskWbs}:{},...u.runId?{runId:u.runId}:{}});if(!J)return;ue?.data?w(ue.data):Te("Failed to load timeline")}catch(ue){J&&Te(wc(ue))}finally{J&&ge(!1)}})(),()=>{J=!1}},[e,a,i,n,k,C,u]);const ve=(J,ue)=>{o({source:J,id:ue}),s("session"),t("timeline")},ie=(J,ue)=>{const Pe=ue?{source:ue,id:J}:A?.items.find(qe=>qe.id===J)??C.find(qe=>qe.id===J);Pe&&ve(Pe.source,Pe.id)},Ze=async J=>(await sn.history.triggerImport({mode:J})).data,ot=te?"—":G||x===void 0?"…":String(x.kpis.sessionsCount),rt=O?"—":se||N===void 0?"…":String(N.loops.length),Ht=ke?"—":pe||v===void 0?"…":String(v.agents.length),St={summary:null,timeline:null,sessions:ot,insights:rt,sources:Ht},Ct=ke?"—":pe?"…":v?.overview.lastImportedAt?new Date(v.overview.lastImportedAt).toLocaleString():"never imported",Zt=N?{count:N.loops.length,redundantCalls:N.loops.reduce((J,ue)=>J+Math.max(0,ue.repeats-1),0),wastedTokens:N.loops.reduce((J,ue)=>J+ue.wastedTokens,0)}:void 0,at=ko(v?.agents.map(J=>({id:J.id,label:J.name,color:J.color}))??[],n.sources),De=ko(x?.topModels.map(J=>({id:J.id,label:J.label,color:J.color}))??[],n.models),Je=ko(x?.topTools.map(J=>({id:J.id,label:J.id}))??[],n.tools),Z=ko(x?.skillsUsed.map(J=>({id:J.id,label:J.label,color:J.color}))??[],n.skills),oe={rangeLabel:dH(n),sessionCount:te?null:G&&x===void 0?void 0:x?.kpis.sessionsCount,sourceCount:n.sources?.length??v?.agents.length};return l.jsxs("div",{className:"flex flex-col gap-4 p-4 max-w-[1600px] mx-auto w-full",children:[l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4 border-b border-base-content/10 pb-3",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("span",{className:"text-2xl",children:"📊"}),l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl font-bold tracking-tight",children:"History"}),l.jsx("p",{className:"text-xs text-base-content/60",children:"Transcript telemetry, session traces, and prompt cache analytics"}),l.jsxs("p",{className:"livechip mt-1 inline-flex items-center gap-1.5 rounded-full border border-base-content/10 px-2 py-0.5 text-xs text-base-content/60 font-mono","data-testid":"history-last-import",role:"status",children:[l.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${ke?"bg-error":"bg-emerald-400 animate-pulse"}`,"aria-hidden":"true"}),"last import ",Ct]})]})]}),l.jsx("div",{className:"flex items-center gap-1 bg-base-300 p-1 rounded-xl",children:cH.map(J=>l.jsxs("button",{type:"button",className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-all ${e===J.id?"bg-primary text-primary-content font-bold shadow-sm":"text-base-content/70 hover:bg-base-content/10"}`,onClick:()=>t(J.id),children:[J.label,St[J.id]!==null&&l.jsx("span",{className:"ml-1.5 px-1.5 py-0.5 rounded-full text-[10px] font-mono bg-base-content/10","data-testid":`history-badge-${J.id}`,children:St[J.id]})]},J.id))})]}),e!=="sources"&&l.jsx(Wz,{filter:n,onChange:r,sourceOptions:at,modelOptions:De,toolOptions:Je,skillOptions:Z,scope:oe}),l.jsxs("div",{className:"mt-2",children:[e==="summary"&&l.jsx(aw,{data:x,loading:G,error:te,dimension:n.dimension??"model",onDimensionChange:J=>r(ue=>({...ue,dimension:J})),bucket:n.bucket??"auto",onBucketChange:J=>r(ue=>({...ue,bucket:J})),loopSummary:Zt}),e==="timeline"&&l.jsx(iw,{data:S,loading:Ve,error:me,mode:a,sessionId:i?.id,sessionSource:i?.source,availableSessions:C,onSelectSession:ve,onModeChange:s,consolidatedTaskWbs:u.taskWbs,consolidatedRunId:u.runId,onConsolidatedScopeSubmit:c}),e==="sessions"&&l.jsx(nw,{data:A,loading:Q,error:fe,sortBy:f,sortDir:b,page:p,pageSize:20,onSortChange:J=>{f===J?E(ue=>ue==="asc"?"desc":"asc"):(m(J),E("desc"))},onPageChange:d,onSelectSession:ve}),e==="insights"&&l.jsx(tw,{data:N,loading:se,error:O,cacheHitTrend:x?.kpiTrend??[],onSelectSession:ie}),e==="sources"&&l.jsx(rw,{data:v,loading:pe,error:ke,onTriggerImport:Ze})]})]})},fH={id:"history",name:"History",icon:"📊",route:"history",component:pH,sidebarLabel:"History",order:3},mH=Object.freeze(Object.defineProperty({__proto__:null,module:fH},Symbol.toStringTag,{value:"Module"}));function hH(e){if(!e||typeof e!="object"||!("teams"in e))return null;const t=e.teams;if(!Array.isArray(t))return null;const n=[];for(const r of t){if(!r||typeof r!="object")continue;const a=r;if(typeof a.teamId!="string"||typeof a.name!="string"||!Array.isArray(a.members))continue;const s=[];for(const i of a.members){if(!i||typeof i!="object")continue;const o=i;typeof o.id!="string"||typeof o.type!="string"||typeof o.status!="string"||s.push({id:o.id,type:o.type,status:o.status,...typeof o.model=="string"&&o.model.length>0?{model:o.model}:{},...typeof o.autoStart=="boolean"?{autoStart:o.autoStart}:{},...typeof o.pid=="number"?{pid:o.pid}:{},...typeof o.role=="string"&&o.role.length>0?{role:o.role}:{},...typeof o.executor=="string"&&o.executor.length>0?{executor:o.executor}:{}})}n.push({teamId:a.teamId,name:a.name,workDir:typeof a.workDir=="string"?a.workDir:null,isCurrentProject:a.isCurrentProject===!0,members:s})}return n}const gH=()=>`${Nt()}/team/teams`,bH=5e3;function ws(){const[e,t]=g.useState([]),[n,r]=g.useState(null),a=g.useRef(!0),s=g.useCallback(async()=>{try{const i=await Tt(new Request(gH()));if(!i.ok)throw new Error(`teams fetch failed: ${i.status}`);const o=await i.json(),u=hH(o);u&&a.current&&(t(u),r(null))}catch(i){a.current&&r(i instanceof Error?i.message:String(i))}},[]);return g.useEffect(()=>{a.current=!0,s();const i=setInterval(s,bH);return()=>{a.current=!1,clearInterval(i)}},[s]),{teams:e,error:n,reload:s}}const EH=(e=50)=>`${Nt()}/messages?limit=${e}`,xH=()=>`${Nt()}/events/planning`,yH=new Set(["message.sent","message.replied"]);function ry(e,t){if(e&&typeof e=="object"){const n=e;return{agentId:typeof n.agentId=="string"&&n.agentId.length>0?n.agentId:t,...typeof n.teamId=="string"&&n.teamId?{teamId:n.teamId}:{},...typeof n.teamName=="string"&&n.teamName?{teamName:n.teamName}:{},...typeof n.memberLabel=="string"&&n.memberLabel?{memberLabel:n.memberLabel}:{},...typeof n.agentType=="string"&&n.agentType?{agentType:n.agentType}:{}}}return{agentId:t}}function TH(e){if(!e||typeof e!="object"||!("messages"in e))return null;const t=e.messages;if(!Array.isArray(t))return null;const n=[];for(const r of t){if(!r||typeof r!="object")continue;const a=r;if(typeof a.id!="string"||typeof a.toId!="string"||typeof a.body!="string"||typeof a.status!="string"||typeof a.createdAt!="string")continue;const s=a.fromId===null||a.fromId===void 0?null:typeof a.fromId=="string"?a.fromId:null;n.push({id:a.id,fromId:s,toId:a.toId,body:a.body,status:a.status,createdAt:a.createdAt,inReplyTo:typeof a.inReplyTo=="string"?a.inReplyTo:null,hasReply:a.hasReply===!0,replyCount:typeof a.replyCount=="number"&&Number.isFinite(a.replyCount)?a.replyCount:0,...s!==null?{from:ry(a.from,s)}:{},to:ry(a.to,a.toId)})}return n}function ow(e,t){return e.filter(n=>n.to.teamId===t||n.from?.teamId===t)}function bb(){const[e,t]=g.useState(null),[n,r]=g.useState(null),a=g.useCallback(async s=>{try{const i=await Tt(new Request(EH(),{signal:s}));if(!i.ok)throw new Error(`messages fetch failed: ${i.status}`);const o=TH(await i.json());o&&t(o)}catch(i){if(s?.aborted)return;r(i instanceof Error?i.message:String(i))}},[]);return g.useEffect(()=>{const s=new AbortController;a(s.signal);const i=setInterval(()=>{a(s.signal)},1e4);return()=>{s.abort(),clearInterval(i)}},[a]),g.useEffect(()=>{if(typeof EventSource>"u")return;const s=new AbortController,i=new EventSource(xH());return i.onmessage=o=>{try{const u=JSON.parse(o.data);if(u===null||typeof u!="object")return;const c=u.eventName;typeof c=="string"&&yH.has(c)&&a(s.signal)}catch{}},()=>{s.abort(),i.close()}},[a]),{messages:e,error:n}}function Eb({messages:e}){return e.length===0?l.jsx("div",{className:"p-4 text-sm text-spur-text-muted italic","data-message-feed-empty":!0,children:"No messages yet."}):l.jsx("ul",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:e.map(t=>{const n=t.from?[t.from.memberLabel??t.from.agentId,t.from.agentType].filter(Boolean).join(" · "):t.fromId??"system",r=[t.to.memberLabel??t.to.agentId,t.to.agentType].filter(Boolean).join(" · "),a=t.from?.teamName,s=t.to.teamName,i=t.status==="injected"?"injected":t.status==="queued"?"queued":null;return l.jsxs("li",{className:"p-2 bg-spur-surface-2 border border-spur-border rounded-xl text-sm",children:[l.jsxs("div",{className:"flex items-center gap-2 text-spur-text-muted text-xs",children:[l.jsxs("span",{"data-message-route":!0,className:"truncate",children:[a&&l.jsxs("span",{className:"text-xs opacity-70",children:[a," / "]}),l.jsx("span",{children:n}),l.jsx("span",{className:"mx-1",children:"→"}),s&&l.jsxs("span",{className:"text-xs opacity-70",children:[s," / "]}),l.jsx("span",{children:r})]}),i&&l.jsx("span",{className:`text-xs px-1 rounded ${i==="injected"?"bg-success/20 text-success":"bg-warning/20 text-warning"}`,"data-message-delivery":!0,children:i}),l.jsx("span",{className:`text-xs ${t.hasReply?"text-info":"text-spur-text-muted"}`,"data-message-reply-badge":!0,"data-message-reply-state":t.hasReply?"replied":"awaiting",children:t.hasReply?t.replyCount>1?`Replied (${t.replyCount})`:"Replied":"Awaiting reply"}),l.jsx("span",{className:"ml-auto font-mono text-xs text-spur-text-muted",children:t.createdAt})]}),l.jsx("p",{className:"text-spur-text mt-1 whitespace-pre-wrap break-words",children:t.body})]},t.id)})})}function SH({teamId:e}){const{messages:t,error:n}=bb();if(n)return l.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load messages: ",n]});if(t===null)return l.jsx("div",{className:"p-4 text-sm text-spur-text-muted",children:"Loading messages…"});const r=e?ow(t,e):t;return l.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-spur-bg","data-all-tab":!0,children:[l.jsx("div",{className:"px-4 py-2 border-b border-spur-border bg-spur-surface shrink-0",children:l.jsx("span",{className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide",children:e?`Message · ${e}`:"Message · all teams"})}),l.jsx(Eb,{messages:r})]})}function vH(e,t){return e.filter(n=>n.fromId===t||n.toId===t)}function wH({agentId:e}){const{messages:t,error:n}=bb();if(n)return l.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load messages: ",n]});if(t===null)return l.jsx("div",{className:"p-4 text-sm text-spur-text-muted",children:"Loading messages…"});const r=vH(t,e);return l.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-spur-bg","data-agent-tab":!0,children:[l.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-spur-surface shrink-0 flex items-center gap-2",children:[l.jsx("span",{className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide",children:"Messages"}),l.jsx("span",{className:"font-mono text-xs text-spur-text-muted",children:e})]}),l.jsx(Eb,{messages:r})]})}const ay="supervisor";function AH(e){return e.fromId===ay||e.toId===ay}function NH({teamId:e}){const{messages:t,error:n}=bb();if(n)return l.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load messages: ",n]});if(t===null)return l.jsx("div",{className:"p-4 text-sm text-spur-text-muted",children:"Loading messages…"});const r=t.filter(AH),a=e?ow(r,e):r;return l.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-spur-bg","data-supervisor-tab":!0,children:[l.jsx("div",{className:"px-4 py-2 border-b border-spur-border bg-spur-surface shrink-0",children:l.jsx("span",{className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide",children:"Message · supervisor"})}),l.jsx(Eb,{messages:a})]})}const _H=[{id:"all",label:"All"},{id:"supervisor",label:"Supervisor"}],El="agent-";function CH(e,t,n){if(e==="all")return l.jsx(SH,{teamId:n});if(e==="supervisor")return l.jsx(NH,{teamId:n});if(e.startsWith(El)){const r=e.slice(El.length);if(t.includes(r))return l.jsx(wH,{agentId:r})}return null}function lw({teamId:e}){const{teams:t}=ws(),[n,r]=g.useState(""),[a,s]=g.useState("all");g.useEffect(()=>{e||!n&&t.length>0&&r(t[0]?.teamId??"")},[e,t,n]);const i=e??n,o=t.find(d=>d.teamId===i)??t[0]??null,u=o?o.members.map(d=>d.id):[],c=a==="all"||a==="supervisor"||u.includes(a.slice(El.length))?a:"all",p=g.useMemo(()=>{const d=u.map(f=>({id:`${El}${f}`,label:f}));return[..._H,...d]},[u]);return l.jsxs("div",{className:"inbox flex flex-col h-full overflow-hidden bg-spur-bg","data-inbox-shell":!0,children:[l.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-spur-surface shrink-0 flex items-center justify-between",children:[l.jsx("span",{className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide",children:"Inbox"}),!e&&t.length>0&&l.jsxs("label",{className:"flex items-center gap-1 text-xs",htmlFor:"inbox-team-select",children:[l.jsx("span",{className:"text-spur-text-muted",children:"Team"}),l.jsxs(Xr,{id:"inbox-team-select",variant:"bordered",size:"sm",value:o?.teamId??"",onChange:d=>{r(d.target.value),s("all")},"data-inbox-team-select":!0,children:[l.jsx("option",{value:"",children:"Select team…"}),t.map(d=>l.jsx("option",{value:d.teamId,children:d.name},d.teamId))]})]})]}),l.jsx("div",{role:"tablist","aria-label":"Inbox tabs",className:"flex items-center gap-1 px-2 py-1 border-b border-spur-border bg-spur-surface shrink-0",children:p.map(d=>{const f=d.id===c;return l.jsx("button",{type:"button",role:"tab","aria-selected":f,"aria-controls":`inbox-tab-panel-${d.id}`,id:`inbox-tab-${d.id}`,onClick:()=>s(d.id),className:`px-3 py-1 rounded-lg text-xs font-medium transition-colors ${f?"bg-spur-accent text-white":"text-spur-text-muted hover:text-spur-text hover:bg-spur-surface-3"}`,"data-inbox-tab":!0,children:d.label},d.id)})}),l.jsx("div",{role:"tabpanel",id:`inbox-tab-panel-${c}`,"aria-labelledby":`inbox-tab-${c}`,className:"flex-1 overflow-hidden",children:CH(c,u,e)})]})}const kH={id:"inbox",name:"Inbox",icon:"💬",route:"inbox",component:lw,sidebarLabel:"Inbox",order:1},IH=Object.freeze(Object.defineProperty({__proto__:null,module:kH},Symbol.toStringTag,{value:"Module"})),RH=["30s","5m","1h","24h","7d","all"],DH={"30s":3e4,"5m":5*6e4,"1h":60*6e4,"24h":1440*6e4,"7d":10080*6e4,all:null};function uw(e,t=Date.now()){const n=DH[e];if(n!=null)return new Date(t-n).toISOString()}function OH(e){return e.selectedPrefixes.size>0||e.searchQuery.trim()!==""||e.searchScope!=="all"||e.severity!=="all"||e.tierFilter!=="all"||e.runId.trim()!==""}function sy({label:e,value:t,onChange:n,options:r}){return l.jsxs("fieldset",{className:"flex items-center gap-0.5 bg-base-100 border border-base-content/20 rounded-md p-0.5","aria-label":e,children:[l.jsx("legend",{className:"sr-only",children:e}),r.map(a=>{const s=a.value===t;return l.jsxs("label",{className:`flex-1 text-[11px] text-center px-2 py-0.5 rounded cursor-pointer transition-all ${s?"bg-primary text-primary-content font-bold shadow-xs":"text-base-content/70 hover:bg-base-content/10"}`,children:[l.jsx("input",{type:"radio",name:`segmented-${e}`,value:a.value,checked:s,onChange:()=>n(a.value),className:"sr-only"}),a.label]},a.value)})]})}function LH({timeRange:e,onTimeRangeChange:t,filters:n,onFiltersChange:r,onClearFilters:a,prefixOptions:s,getPrefixColor:i,liveEnabled:o,onToggleLive:u,shownCount:c,totalCount:p,actions:d}){const f=g.useMemo(()=>{let E=0;return n.selectedPrefixes.size>0&&(E+=n.selectedPrefixes.size),n.searchQuery.trim()!==""&&(E+=1),n.severity!=="all"&&(E+=1),n.tierFilter!=="all"&&(E+=1),n.runId.trim()!==""&&(E+=1),E},[n]),m=OH(n),b=E=>{r(x=>{const y=new Set(x.selectedPrefixes);return y.has(E)?y.delete(E):y.add(E),{...x,selectedPrefixes:y}})};return l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 p-3 bg-base-200/50 rounded-xl border border-base-content/10 shrink-0",children:[l.jsxs("fieldset",{className:"flex items-center gap-1 bg-base-200 p-1 rounded-lg border-0 m-0","aria-label":"Time range presets",children:[l.jsx("legend",{className:"sr-only",children:"Time range presets"}),RH.map(E=>{const x=e===E;return l.jsx("button",{type:"button",onClick:()=>t(E),"aria-pressed":x,className:`px-2.5 py-1 text-xs font-semibold rounded-md transition-all cursor-pointer ${x?"bg-primary text-primary-content font-bold shadow-sm":"text-base-content/70 hover:bg-base-content/10"}`,children:E==="all"?"All":E},E)})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsxs("span",{"aria-live":"polite",className:"text-xs font-mono text-base-content/60 whitespace-nowrap","data-testid":"observability-result-count",children:[c," of ",p," shown"]}),l.jsxs("details",{className:"relative inline-block","data-testid":"observability-filter-disclosure",children:[l.jsxs("summary",{className:"px-2.5 py-1 text-xs font-medium rounded-lg border border-base-content/20 bg-base-200 text-base-content/80 hover:bg-base-300 transition-colors cursor-pointer list-none flex items-center gap-1.5 focus:outline-none focus:ring-2 focus:ring-primary/40","aria-label":"Toggle filter panel",children:[l.jsx("span",{children:"🔍 Filter"}),f>0&&l.jsx("span",{className:"px-1.5 py-0.2 rounded-full text-[10px] font-bold bg-primary text-primary-content",children:f})]}),l.jsxs("div",{className:"absolute right-0 top-full z-30 p-3 shadow-xl bg-base-200 border border-base-content/10 rounded-xl w-80 sm:w-96 mt-2 flex flex-col gap-3",children:[l.jsxs("div",{className:"flex items-center justify-between pb-2 border-b border-base-content/10",children:[l.jsx("span",{className:"text-xs font-bold uppercase tracking-wide text-base-content/70",children:"Filters"}),m&&l.jsx("button",{type:"button",onClick:a,className:"text-xs text-error hover:underline cursor-pointer","aria-label":"Clear all filters",children:"Clear all"})]}),l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("label",{htmlFor:"filter-search-input",className:"text-[11px] font-semibold text-base-content/60",children:"Search"}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsxs("select",{value:n.searchScope,onChange:E=>r(x=>({...x,searchScope:E.target.value})),className:"bg-base-100 border border-base-content/20 rounded px-2 py-1 text-xs text-base-content focus:outline-none focus:ring-2 focus:ring-primary/40 cursor-pointer","aria-label":"Search scope",children:[l.jsx("option",{value:"all",children:"all"}),l.jsx("option",{value:"name",children:"name"}),l.jsx("option",{value:"actor",children:"actor"}),l.jsx("option",{value:"payload",children:"payload"})]}),l.jsx(Ti,{id:"filter-search-input",size:"sm",variant:"bordered",placeholder:`Search ${n.searchScope}…`,value:n.searchQuery,onChange:E=>r(x=>({...x,searchQuery:E.target.value})),className:"flex-1 input-xs","aria-label":`Search ${n.searchScope}`})]})]}),l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"text-[11px] font-semibold text-base-content/60",children:"Severity"}),l.jsx(sy,{label:"Severity",value:n.severity,onChange:E=>r(x=>({...x,severity:E})),options:[{value:"all",label:"All"},{value:"info",label:"Info"},{value:"warning",label:"Warning"},{value:"error",label:"Error"}]})]}),l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"text-[11px] font-semibold text-base-content/60",children:"Tier"}),l.jsx(sy,{label:"Tier",value:n.tierFilter,onChange:E=>r(x=>({...x,tierFilter:E})),options:[{value:"all",label:"All"},{value:"default",label:"Default"},{value:"diagnostic",label:"Diagnostic"}]})]}),s.length>0&&l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"text-[11px] font-semibold text-base-content/60",children:"Prefix"}),l.jsxs("fieldset",{className:"flex flex-wrap items-center gap-1.5 border-0 p-0 m-0","aria-label":"Filter by prefix",children:[l.jsx("legend",{className:"sr-only",children:"Filter by prefix"}),s.map(E=>{const x=n.selectedPrefixes.has(E),y=i(E);return l.jsxs("button",{type:"button",role:"switch","aria-checked":x,"aria-label":`Prefix ${E}${x?" (selected)":""}`,onClick:()=>b(E),className:`px-2 py-0.5 rounded-full text-[11px] font-mono border transition-colors cursor-pointer ${x?`${y} border-current bg-base-100 font-bold`:"text-base-content/60 border-base-content/20 hover:bg-base-100"}`,children:[E,".*"]},E)})]})]}),l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("label",{htmlFor:"filter-run-id-input",className:"text-[11px] font-semibold text-base-content/60",children:"Run ID"}),l.jsx(Ti,{id:"filter-run-id-input",size:"sm",variant:"bordered",placeholder:"Filter by run id…",value:n.runId,onChange:E=>r(x=>({...x,runId:E.target.value})),className:"w-full input-xs","aria-label":"Filter by run id"})]})]})]}),l.jsx("button",{type:"button",onClick:u,className:`px-2.5 py-1 text-xs font-semibold rounded-lg border transition-all cursor-pointer flex items-center gap-1.5 ${o?"border-emerald-500/40 bg-emerald-500/10 text-emerald-500 hover:bg-emerald-500/20":"border-amber-500/40 bg-amber-500/10 text-amber-500 hover:bg-amber-500/20"}`,"aria-label":o?"Pause live event stream":"Resume live event stream","aria-pressed":o,children:l.jsx("span",{children:o?"⏸ Pause Live":"▶ Resume Live"})}),d]})]})}const Ja=[{key:"time",label:"Time",description:"Event timestamp",defaultVisible:!0,sortable:!0,colWidth:"w-36"},{key:"severity",label:"Severity",description:"Diagnostic severity level",defaultVisible:!0,sortable:!0,colWidth:"w-24"},{key:"event",label:"Event",description:"Event name with domain prefix",defaultVisible:!0,sortable:!0,colWidth:"w-[15%]"},{key:"summary",label:"Summary",description:"Rendered human summary",defaultVisible:!0,sortable:!0,colWidth:"w-[20%]"},{key:"correlation",label:"Correlation",description:"Entity or run correlation identifier",defaultVisible:!0,sortable:!0,colWidth:"w-[16%]"},{key:"outcome",label:"Outcome",description:"Execution result or state change",defaultVisible:!0,sortable:!0,colWidth:"w-28"},{key:"agent",label:"Agent",description:"Target or actor agent role",defaultVisible:!0,sortable:!0,colWidth:"w-28"},{key:"producer",label:"Producer",description:"Subsystem or source package",defaultVisible:!1,sortable:!1,colWidth:"w-[16%]"},{key:"action",label:"Action",description:"Action link or remediation command",defaultVisible:!1,sortable:!1,colWidth:"w-[15%]"},{key:"actor",label:"Actor",description:"Originating user or system actor",defaultVisible:!1,sortable:!1,colWidth:"w-24"}],FH=new Set(Ja.map(e=>e.key)),Qr=["time","severity","event","summary","correlation","outcome","agent"],cw="spur:observability:columns:v1";function MH(e){if(!Array.isArray(e)||e.length===0)return[...Qr];const t=new Set;for(const n of e)typeof n=="string"&&FH.has(n)&&t.add(n);return t.size===0?[...Qr]:Ja.filter(n=>t.has(n.key)).map(n=>n.key)}function PH(e){try{const t=e??(typeof window<"u"?window.localStorage:void 0);if(!t)return[...Qr];const n=t.getItem(cw);if(!n)return[...Qr];const r=JSON.parse(n);return MH(r)}catch{return[...Qr]}}function iy(e,t){try{const n=t??(typeof window<"u"?window.localStorage:void 0);if(!n)return;n.setItem(cw,JSON.stringify(e))}catch{}}function jH({visibleColumns:e,onVisibleColumnsChange:t}){const n=g.useMemo(()=>new Set(e),[e]),r=s=>{const i=new Set(n);if(i.has(s)){if(i.size<=1)return;i.delete(s)}else i.add(s);const o=Ja.filter(u=>i.has(u.key)).map(u=>u.key);t(o),iy(o)},a=()=>{const s=[...Qr];t(s),iy(s)};return l.jsxs("details",{className:"relative inline-block","data-testid":"observability-column-customizer",children:[l.jsxs("summary",{className:"px-2.5 py-1 text-xs font-medium rounded-lg border border-base-content/20 bg-base-200 text-base-content/80 hover:bg-base-300 transition-colors cursor-pointer list-none flex items-center gap-1.5 focus:outline-none focus:ring-2 focus:ring-primary/40","aria-label":"Customize visible columns",children:[l.jsx("span",{children:"📊 Columns"}),l.jsxs("span",{className:"text-[10px] text-base-content/60 font-mono",children:["(",e.length,"/",Ja.length,")"]})]}),l.jsxs("div",{className:"absolute right-0 top-full z-30 p-3 shadow-xl bg-base-200 border border-base-content/10 rounded-xl w-64 mt-2 flex flex-col gap-2",children:[l.jsxs("div",{className:"flex items-center justify-between pb-2 border-b border-base-content/10",children:[l.jsx("span",{className:"text-xs font-bold uppercase tracking-wide text-base-content/70",children:"Columns"}),l.jsx("button",{type:"button",onClick:a,className:"text-xs text-primary hover:underline cursor-pointer","aria-label":"Reset columns to default",children:"Reset defaults"})]}),l.jsxs("fieldset",{className:"flex flex-col gap-1.5 border-0 p-0 m-0","aria-label":"Visible columns",children:[l.jsx("legend",{className:"sr-only",children:"Select visible columns"}),Ja.map(s=>{const i=n.has(s.key),o=i&&n.size===1,u=`observability-col-${s.key}`;return l.jsxs("label",{htmlFor:u,className:`flex items-center justify-between px-2 py-1 rounded-md text-xs transition-colors ${o?"opacity-60 cursor-not-allowed":"hover:bg-base-100 cursor-pointer text-base-content/90"}`,children:[l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(tb,{id:u,size:"xs",variant:"primary",checked:i,disabled:o,onChange:()=>r(s.key),"aria-label":s.label}),l.jsx("span",{className:"font-medium",children:s.label})]}),s.defaultVisible&&l.jsx("span",{className:"text-[10px] text-base-content/50 uppercase",children:"default"})]},s.key)})]})]})]})}const BH=()=>`${Nt()}/events/planning`,Nd=100;function xl(e){const t=`${Nt()}/events/history`,n=[],r=e.limit??Nd;return n.push(`limit=${r}`),e.prefix&&n.push(`prefix=${encodeURIComponent(e.prefix)}`),e.names&&n.push(`names=${encodeURIComponent(e.names)}`),e.actor&&n.push(`actor=${encodeURIComponent(e.actor)}`),e.runId&&n.push(`runId=${encodeURIComponent(e.runId)}`),e.since&&n.push(`since=${encodeURIComponent(e.since)}`),e.cursor&&n.push(`cursor=${encodeURIComponent(e.cursor)}`),`${t}?${n.join("&")}`}const UH={workflow:"text-cyan-400",task:"text-emerald-400",feature:"text-emerald-400",agent:"text-amber-400",rule:"text-rose-400",message:"text-sky-400",process:"text-violet-400",queue:"text-orange-400",bus:"text-pink-400",api:"text-teal-400"},oy="text-spur-text-muted";function dw(e){return e?UH[e]??oy:oy}const Ac={selectedPrefixes:new Set,searchQuery:"",searchScope:"all",severity:"all",tierFilter:"all",runId:""};function $H(){const e=g.useRef([]),[t,n]=g.useState(0);g.useEffect(()=>{const a=window.setInterval(()=>{const s=Date.now()-6e4,i=e.current.filter(o=>o>=s);e.current=i,n(i.length)},1e3);return()=>window.clearInterval(a)},[]);const r=g.useCallback(()=>{const a=Date.now(),s=a-6e4,i=e.current.filter(o=>o>=s);i.push(a),e.current=i,n(i.length)},[]);return{rate:t,recordEvent:r}}function yl(e){if(e===null||typeof e!="object"||!("events"in e)||!("count"in e))return null;const t=e.events;if(!Array.isArray(t))return null;const n=e.count;if(typeof n!="number")return null;const r=e.nextCursor,a=typeof r=="string"?r:null,s=e.hasMore,i=typeof s=="boolean"?s:!1,o=[];for(const p of t){const d=zH(p);d&&o.push(d)}const u=e.catalog,c=Array.isArray(u)?HH(u):void 0;return{events:o,count:n,nextCursor:a,hasMore:i,...c?{catalog:c}:{}}}function zH(e){if(e===null||typeof e!="object")return null;const t=e;if(typeof t.id!="string"||typeof t.eventName!="string"||typeof t.occurredAt!="string")return null;const n=typeof t.prefix=="string"?t.prefix:void 0,r=typeof t.renderer=="string"?t.renderer:void 0,a=t.actor;if(a!==null&&typeof a!="string")return null;const s=t.payload,i=typeof t.runId=="string"?t.runId:t.runId===null?null:void 0,o=typeof t.entityKind=="string"?t.entityKind:t.entityKind===null?null:void 0,u=typeof t.entityId=="string"?t.entityId:t.entityId===null?null:void 0,c=typeof t.sequence=="number"&&Number.isFinite(t.sequence)?t.sequence:t.sequence===null?null:void 0,p={id:t.id,eventName:t.eventName,occurredAt:t.occurredAt,actor:a,...n?{prefix:n}:{},...r?{renderer:r}:{}};if(s===null)return{...p,payload:null,view:ya(t.eventName,null),...Tl(i,o,u,c)};if(typeof s!="object")return null;const d=s,f=d.schemaVersion===2?d:void 0;return{...p,payload:pw(d),...f?{envelope:f}:{},view:ya(t.eventName,d),...Tl(i,o,u,c)}}function Tl(e,t,n,r){const a={};return e!==void 0&&(a.runId=e),t!==void 0&&(a.entityKind=t),n!==void 0&&(a.entityId=n),r!==void 0&&(a.sequence=r),a}function HH(e){const t=[];for(const n of e){if(n===null||typeof n!="object")return;const r=n;if(typeof r.name!="string"||typeof r.prefix!="string"||typeof r.source!="string"||typeof r.renderer!="string")return;const a=typeof r.tier=="string"?r.tier:void 0,s={name:r.name,prefix:r.prefix,source:r.source,renderer:r.renderer,...a!==void 0?{tier:a}:{}};t.push(s)}return t}function GH(e){if(e===null||typeof e!="object")return null;const t=e;if(typeof t.eventName!="string"||t.eventName.length===0||typeof t.occurredAt!="string")return null;const n=typeof t.prefix=="string"?t.prefix:void 0,r=typeof t.renderer=="string"?t.renderer:void 0,a=t.actor;if(a!==null&&typeof a!="string")return null;const s=t.payload;if(s!==null&&typeof s!="object")return null;const i=s,o=i?.schemaVersion===2?i:void 0,u=pw(i),c=t.runId??u?.runId,p=t.entityKind??u?.entityKind,d=t.entityId??u?.entityId,f=t.sequence??u?.sequence,m=typeof c=="string"?c:c===null?null:void 0,b=typeof p=="string"?p:p===null?null:void 0,E=typeof d=="string"?d:d===null?null:void 0,x=typeof f=="number"&&Number.isFinite(f)?f:f===null?null:void 0;return{eventName:t.eventName,occurredAt:t.occurredAt,actor:a,...n?{prefix:n}:{},...r?{renderer:r}:{},payload:u,...o?{envelope:o}:{},view:ya(t.eventName,i),...Tl(m,b,E,x)}}function ya(e,t){const n=WH(e);if(t?.schemaVersion!==2)return n;const r=zr(t.context),a=zr(t.presentation),s=zr(r?.project),i=zr(r?.producer),o=zr(r?.correlation);if(!r||!a||!s||!i||!o)return n;const u=a.severity==="info"||a.severity==="warning"||a.severity==="error"?a.severity:"warning",c=Array.isArray(a.fields)?a.fields.flatMap(S=>{const w=zr(S),A=fn(w?.label,64),D=fn(w?.value,256);return A&&D?[{label:A,value:D}]:[]}).slice(0,8):[],p=[],d=(S,w)=>{const A=fn(w,128);A&&p.push({label:S,value:A})};d("Run",o.runId),d("Execution",o.executionId),d("Action",o.actionId),d("Entity",qH(o.entityKind,o.entityId)),d("Job",o.jobId),typeof o.sequence=="number"&&Number.isFinite(o.sequence)&&p.push({label:"Sequence",value:String(o.sequence)});const f=fn(i.package,128)??"unavailable",m=fn(i.subsystem,128),b=VH(a.action),E=fn(a.actionLabel,128)??"unavailable",x=fn(a.agent,128),y=fn(a.correlators,512);return{severity:u,summary:fn(a.summary,512)??"unavailable",description:fn(a.description,512)??"Description unavailable.",fields:c,projectName:fn(s.name,128)??"unavailable",projectRoot:fn(s.root,256)??"unavailable",producer:m?`${f} / ${m}`:f,correlation:y??"unavailable",correlationFields:p,outcome:fn(a.outcome,128)??"unavailable",action:b,actionLabel:E,agent:x}}function WH(e){return{severity:"warning",summary:"unavailable",description:`Canonical context unavailable for ${fn(e,128)??"unknown"}.`,fields:[],projectName:"unavailable",projectRoot:"unavailable",producer:"unavailable",correlation:"unavailable",correlationFields:[],outcome:"unavailable",action:null,actionLabel:"unavailable",agent:null}}function VH(e){const t=zr(e);if(!t||t.kind!=="command"&&t.kind!=="filter"&&t.kind!=="path")return null;const n=fn(t.label,128),r=fn(t.value,256);return n&&r?{label:n,kind:t.kind,value:r}:null}function fn(e,t){return typeof e!="string"||e.length===0?null:e.length<=t?e:`${e.slice(0,t-1)}…`}function qH(e,t){const n=fn(e,64),r=fn(t,128);return n&&r?`${n}:${r}`:n??r}const YH=["Entity","Run","Execution","Action","Job"];function ZH(e,t){for(const n of YH){const r=t.correlationFields.find(a=>a.label===n);if(r!==void 0&&r.value!=="")return`${e.eventName} · ${r.value}`}return e.id!==""&&!e.id.startsWith("live-")?`${e.eventName} · ${e.id}`:e.eventName}function zr(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function pw(e){return e?.schemaVersion!==2?e:zr(e.data)}const KH=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ly(e){const t=new Date(e);if(Number.isNaN(t.getTime()))return e;const n=KH[t.getMonth()],r=t.getDate(),a=String(t.getHours()).padStart(2,"0"),s=String(t.getMinutes()).padStart(2,"0"),i=String(t.getSeconds()).padStart(2,"0");return`${n} ${r} ${a}:${s}:${i}`}function _d(e){return typeof e!="number"||!Number.isFinite(e)?null:e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function At(e){return e&&e!=="unavailable"?e:"-"}function XH(e,t="24h"){const n={};e.selectedPrefixes&&e.selectedPrefixes.size===1&&(n.prefix=[...e.selectedPrefixes][0]);const r=e.searchQuery?.trim()??"";r!==""&&e.searchScope==="name"&&(n.names=r),r!==""&&e.searchScope==="actor"&&(n.actor=r),e.runId&&e.runId.trim()!==""&&(n.runId=e.runId.trim());const a=e.timeWindow&&e.timeWindow!=="all"?e.timeWindow:t,s=uw(a);return s&&(n.since=s),n}function uy(e,t,n){if(t.selectedPrefixes.size>=1){const r=e.prefix??e.eventName.split(".")[0]??e.eventName;if(!t.selectedPrefixes.has(r))return!1}if(t.tierFilter!=="all"){const r=n.get(e.eventName);if(r!==t.tierFilter&&!(t.tierFilter==="default"&&r===void 0))return!1}if(t.severity!=="all"&&(e.view??ya(e.eventName,e.payload??null)).severity!==t.severity)return!1;if(t.searchQuery.trim()!==""){const r=t.searchQuery.toLowerCase();let a=!1;if((t.searchScope==="name"||t.searchScope==="all")&&(a=a||e.eventName.toLowerCase().includes(r)),(t.searchScope==="actor"||t.searchScope==="all")&&(a=a||(e.actor?.toLowerCase().includes(r)??!1)),t.searchScope==="payload"&&e.payload&&(a=a||JSON.stringify(e.payload).toLowerCase().includes(r)),!a)return!1}return!(t.runId.trim()!==""&&e.runId!==t.runId.trim())}const xb={key:"time",direction:"desc"};function QH(e,t=xb){const n=e.map((r,a)=>({row:r,idx:a}));return n.sort((r,a)=>{let s=0;const i=r.row.view??ya(r.row.eventName,r.row.payload??null),o=a.row.view??ya(a.row.eventName,a.row.payload??null);switch(t.key){case"time":{const u=Date.parse(r.row.occurredAt),c=Date.parse(a.row.occurredAt),p=Number.isNaN(u)?-1/0:u,d=Number.isNaN(c)?-1/0:c;s=p-d;break}case"severity":{const u=c=>c==="info"?0:c==="warning"?1:2;s=u(i.severity)-u(o.severity);break}case"event":{s=r.row.eventName.localeCompare(a.row.eventName);break}case"summary":{s=(i.summary??"").localeCompare(o.summary??"");break}case"correlation":{s=(i.correlation??"").localeCompare(o.correlation??"");break}case"agent":{s=(i.agent??"").localeCompare(o.agent??"");break}case"outcome":{s=(i.outcome??"").localeCompare(o.outcome??"");break}default:s=0}return s!==0?t.direction==="asc"?s:-s:r.idx-a.idx}),n.map(r=>r.row)}function Io({value:e,label:t}){const[n,r]=g.useState("idle"),a=async s=>{s.preventDefault(),s.stopPropagation();try{typeof navigator<"u"&&navigator.clipboard?.writeText?(await navigator.clipboard.writeText(e),r("copied"),setTimeout(()=>r("idle"),1500)):(r("failed"),setTimeout(()=>r("idle"),2e3))}catch{r("failed"),setTimeout(()=>r("idle"),2e3)}};return!e||e==="-"||e==="unavailable"?null:l.jsxs("button",{type:"button",onClick:a,className:"inline-flex items-center justify-center p-0.5 rounded text-base-content/40 hover:text-base-content hover:bg-base-content/10 transition-colors cursor-pointer shrink-0 text-[10px] focus:outline-none focus:ring-1 focus:ring-primary/40",title:n==="copied"?"Copied":n==="failed"?"Copy failed":`Copy ${t}`,"aria-label":n==="copied"?`Copied ${t}`:n==="failed"?`Copy ${t} failed`:`Copy ${t}`,children:[l.jsx("span",{"aria-hidden":"true",children:n==="copied"?"✓":n==="failed"?"!":"📋"}),l.jsx("span",{className:"sr-only","aria-live":"polite",children:n==="copied"?`${t} copied`:n==="failed"?`${t} copy failed`:""})]})}function JH({onLivenessChange:e,timeRange:t,onTimeRangeChange:n}={}){const[r,a]=g.useState("24h"),s=t??r,i=n??a,[o,u]=g.useState(()=>PH()),[c,p]=g.useState(xb),d=g.useCallback(ge=>{p(me=>me.key===ge?{key:ge,direction:me.direction==="asc"?"desc":"asc"}:{key:ge,direction:"asc"})},[]),[f,m]=g.useState(!0),[b,E]=g.useState([]),[x,y]=g.useState([]),[S,w]=g.useState("idle"),[A,D]=g.useState(null),[N,T]=g.useState(null),[v,R]=g.useState(!1),[C,U]=g.useState(!1),[k,j]=g.useState(Ac),[G,$]=g.useState(Ac),[te,H]=g.useState("connecting"),{rate:se,recordEvent:de}=$H();g.useEffect(()=>{e?.({status:f?te:"paused",rate:se,lastEventAt:b[0]?.occurredAt??null})},[f,te,se,b,e]);const O=g.useMemo(()=>{const ge=new Map;for(const me of x)me.tier&&ge.set(me.name,me.tier);return ge},[x]);g.useEffect(()=>{const ge=window.setTimeout(()=>{$(k)},250);return()=>window.clearTimeout(ge)},[k]);const ne=g.useMemo(()=>XH(G,s),[G,s]),pe=g.useRef(0);g.useEffect(()=>{const ge=++pe.current,me=new AbortController;return w("loading"),D(null),(async()=>{try{const Te=await Tt(new Request(xl({...ne,limit:Nd}),{signal:me.signal}));if(!Te.ok){const Ze=await Te.json().catch(()=>null),ot=Ze?.code;throw ot==="UNKNOWN_PREFIX"||ot==="MALFORMED_CURSOR"?new Error(`${ot}: ${Ze.error??Te.status}`):new Error(`history fetch failed: ${Te.status}`)}const ve=await Te.json(),ie=yl(ve);if(!ie)throw new Error("history response failed schema validation");if(ge!==pe.current)return;E(ie.events),ie.catalog&&y(ie.catalog),T(ie.nextCursor),R(ie.hasMore),w("loaded")}catch(Te){if(me.signal.aborted||ge!==pe.current)return;D(Te instanceof Error?Te.message:String(Te)),w("error")}})(),()=>me.abort()},[ne]);const L=g.useCallback(async()=>{if(!(!v||C||N===null)){U(!0);try{const ge=await Tt(new Request(xl({...ne,limit:Nd,cursor:N})));if(!ge.ok)throw new Error(`history fetch failed: ${ge.status}`);const me=await ge.json(),Te=yl(me);if(!Te)throw new Error("history response failed schema validation");E(ve=>{const ie=new Set(ve.map(ot=>ot.id)),Ze=Te.events.filter(ot=>!ie.has(ot.id));return[...ve,...Ze]}),Te.catalog&&y(Te.catalog),T(Te.nextCursor),R(Te.hasMore)}catch(ge){D(ge instanceof Error?ge.message:String(ge))}finally{U(!1)}}},[v,C,N,ne]),ke=g.useRef(k);ke.current=k;const Re=g.useRef(O);Re.current=O;const Q=g.useRef(s);Q.current=s,g.useEffect(()=>{if(!f||typeof EventSource>"u")return;H("connecting");const ge=new EventSource(BH());return ge.onopen=()=>{H("live")},ge.onerror=()=>{H("errored")},ge.onmessage=me=>{try{const Te=JSON.parse(me.data),ve=GH(Te);if(!ve||ve.eventName==="connected")return;const ie=ke.current,Ze=Re.current;if(!uy({eventName:ve.eventName,occurredAt:ve.occurredAt,actor:ve.actor,...ve.prefix?{prefix:ve.prefix}:{},payload:ve.payload,view:ve.view,...ve.runId!==void 0?{runId:ve.runId}:{}},ie,Ze))return;const ot={id:`live-${ve.occurredAt}-${ve.eventName}`,eventName:ve.eventName,occurredAt:ve.occurredAt,actor:ve.actor,...ve.prefix?{prefix:ve.prefix}:{},...ve.renderer?{renderer:ve.renderer}:{},payload:ve.payload,...ve.envelope?{envelope:ve.envelope}:{},view:ve.view,...Tl(ve.runId,ve.entityKind,ve.entityId,ve.sequence)};E(rt=>[ot,...rt]),de()}catch{}},()=>ge.close()},[f,de]);const _e=g.useMemo(()=>Array.from(new Set([...x.map(ge=>ge.prefix),...b.map(ge=>ge.prefix??ge.eventName.split(".")[0]??ge.eventName)])).sort(),[x,b]),fe=g.useCallback(()=>{j(Ac)},[]),X=g.useMemo(()=>b.filter(ge=>uy(ge,k,O)),[b,k,O]),Ve=g.useMemo(()=>QH(X,c),[X,c]);return S==="error"?l.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load event history: ",A]}):S==="idle"||S==="loading"?l.jsxs("div",{className:"flex items-center justify-center h-32 text-spur-text-muted text-sm",children:[l.jsx(Ra,{size:"sm"})," Loading event history…"]}):l.jsxs("div",{className:"flex flex-col gap-4","data-system-events-tab":!0,children:[l.jsx(LH,{timeRange:s,onTimeRangeChange:i,filters:k,onFiltersChange:j,onClearFilters:fe,prefixOptions:_e,getPrefixColor:dw,liveEnabled:f,onToggleLive:()=>m(ge=>!ge),shownCount:X.length,totalCount:b.length,actions:l.jsx(jH,{visibleColumns:o,onVisibleColumnsChange:u})}),l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 overflow-hidden flex flex-col",children:[Ve.length===0?l.jsx("div",{className:"p-8 text-sm text-spur-text-muted italic text-center",children:b.length===0?"No system events yet. New events from the planning bus will appear here in real time.":"No events match the active filters."}):l.jsx(tG,{rows:Ve,catalog:x,visibleColumns:o,sortState:c,onSortChange:d}),v&&l.jsx("div",{className:"px-4 py-2 border-t border-base-content/10 bg-base-200/50 shrink-0 flex justify-center",children:l.jsx("button",{type:"button",onClick:L,disabled:C,"data-load-older":!0,className:"text-[11px] text-spur-text-muted hover:text-spur-text px-3 py-1 rounded border border-spur-border/40 hover:border-spur-text/40 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-wait focus:outline-none focus:ring-2 focus:ring-spur-text/40",children:C?"Loading…":"Load older"})})]})]})}function eG(e){const[t,n]=g.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(e).matches);return g.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const r=window.matchMedia(e),a=s=>n(s.matches);return r.addEventListener("change",a),n(r.matches),()=>r.removeEventListener("change",a)},[e]),t}function tG({rows:e,catalog:t,visibleColumns:n=Qr,sortState:r=xb,onSortChange:a=()=>{}}){const s=g.useMemo(()=>{const u=new Map;for(const c of t)c.tier&&u.set(c.name,c.tier);return u},[t]),i=eG("(max-width: 639px)"),o=g.useMemo(()=>new Map(Ja.map(u=>[u.key,u])),[]);return l.jsx("section",{className:"overflow-x-auto min-w-0","data-system-events-tab":!0,"aria-label":"System events",children:l.jsxs("table",{className:`w-full ${i?"min-w-0":"min-w-[1000px]"} text-xs border-separate border-spacing-0 table-fixed`,children:[l.jsx("colgroup",{children:i?l.jsxs(l.Fragment,{children:[l.jsx("col",{className:"w-24"}),l.jsx("col",{className:"w-full"})]}):n.map(u=>l.jsx("col",{className:o.get(u)?.colWidth??"w-24"},u))}),l.jsx("thead",{className:"sticky top-0 z-10 bg-base-200",children:l.jsx("tr",{className:"text-left text-spur-text-muted uppercase tracking-wide text-[10px]",children:i?l.jsxs(l.Fragment,{children:[l.jsx("th",{scope:"col",className:"font-semibold px-3 py-1.5 border-b border-spur-border",children:"Time"}),l.jsx("th",{scope:"col",className:"font-semibold px-3 py-1.5 border-b border-spur-border",children:"Event"})]}):n.map(u=>{const c=o.get(u);if(!c)return null;const p=r.key===u,d=p?r.direction==="asc"?" ▲":" ▼":"",f=p?r.direction==="asc"?"ascending":"descending":"none";return c.sortable?l.jsx("th",{scope:"col","aria-sort":f,className:"font-semibold px-3 py-1.5 border-b border-spur-border select-none",children:l.jsxs("button",{type:"button",onClick:()=>a(u),className:"flex items-center gap-1 uppercase tracking-wide text-[10px] font-semibold text-spur-text-muted hover:text-spur-text transition-colors cursor-pointer bg-transparent border-0 p-0 focus:outline-none focus:ring-1 focus:ring-primary/40 rounded",children:[l.jsx("span",{children:c.label}),d&&l.jsx("span",{"aria-hidden":"true",children:d})]})},u):l.jsx("th",{scope:"col",className:"font-semibold px-3 py-1.5 border-b border-spur-border",children:c.label},u)})})}),l.jsx("tbody",{children:e.map(u=>l.jsx(nG,{event:u,tier:s.get(u.eventName)??"default",compact:i,visibleColumns:n},u.id))})]})})}const Nc="system-events-payload-tooltip-pin";function _c({severity:e}){const t=g.useMemo(()=>{switch(e){case"error":return{icon:"✕",badgeClass:"bg-error/15 text-error border-error/30"};case"warning":return{icon:"▲",badgeClass:"bg-warning/15 text-warning border-warning/30"};default:return{icon:"●",badgeClass:"bg-base-content/10 text-base-content/70 border-base-content/20"}}},[e]);return l.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[10px] font-semibold border ${t.badgeClass} whitespace-nowrap`,children:[l.jsx("span",{"aria-hidden":"true",children:t.icon}),l.jsx("span",{children:e})]})}function nG({event:e,tier:t,compact:n,visibleColumns:r=Qr}){const a=e.prefix??e.eventName.split(".")[0]??e.eventName,s=g.useMemo(()=>e.view??ya(e.eventName,e.payload??null),[e.eventName,e.payload,e.view]),i=dw(a),[o,u]=g.useState(!1),[c,p]=g.useState(!1),[d,f]=g.useState(!1),[m,b]=g.useState(null),E=g.useRef(null),x=g.useRef(null),y=g.useRef(0),S=g.useRef(null),w=At(e.actor),A=c||d,D=g.useCallback(()=>{S.current!==null&&(clearTimeout(S.current),S.current=null)},[]),N=g.useCallback(()=>{f(!1),b(null)},[]),T=g.useCallback((j,G)=>{y.current=performance.now()+400,f(!0),p(!1),D();const $=Number.isFinite(j)&&j>0?j:8,te=Number.isFinite(G)&&G>0?G:8;b({x:$,y:te}),window.dispatchEvent(new CustomEvent(Nc,{detail:{id:e.id}}))},[e.id,D]),v=g.useCallback((j,G,$)=>{const te=j.getBoundingClientRect(),H=G&&G>0?G:te.left,se=$&&$>0?$+4:te.bottom+6;T(H,se)},[T]);g.useEffect(()=>{const j=G=>{G.detail?.id!==e.id&&N()};return window.addEventListener(Nc,j),()=>window.removeEventListener(Nc,j)},[e.id,N]),g.useEffect(()=>{if(!d)return;const j=$=>{performance.now()<y.current||E.current?.contains($.target)||x.current?.contains($.target)||N()},G=$=>{$.key==="Escape"&&(N(),$.stopPropagation())};return document.addEventListener("pointerdown",j,!0),document.addEventListener("keydown",G,!0),()=>{document.removeEventListener("pointerdown",j,!0),document.removeEventListener("keydown",G,!0)}},[d,N]),g.useEffect(()=>()=>{D()},[D]);const R=g.useCallback(()=>u(j=>!j),[]),C=g.useCallback(j=>{if(j.key==="Escape"){if(d){N(),j.stopPropagation();return}u(!1),j.stopPropagation()}},[d,N]),U=A?l.jsxs("div",{ref:E,id:`system-event-tooltip-${e.id}`,role:"tooltip","data-testid":"system-event-payload-tooltip","data-pinned":d?"true":"false",className:d?"pointer-events-auto fixed z-50 rounded shadow-lg p-2.5 text-[11px] min-w-[min(400px,90vw)] max-w-[min(840px,95vw)] whitespace-normal border border-[#30363d] bg-[#0d1117] text-[#c9d1d9] select-text cursor-text":"pointer-events-auto absolute left-0 top-full mt-1 z-30 rounded shadow-lg p-2.5 text-[11px] min-w-[min(400px,90vw)] max-w-[min(840px,95vw)] whitespace-normal border border-[#30363d] bg-[#0d1117] text-[#c9d1d9]",style:d&&m?{top:m.y,left:m.x}:void 0,onMouseEnter:()=>{D(),p(!0)},onMouseLeave:()=>{d||(D(),S.current=setTimeout(()=>p(!1),150))},onFocusCapture:()=>p(!0),onBlurCapture:j=>{!d&&!j.currentTarget.contains(j.relatedTarget)&&p(!1)},onPointerDown:j=>{d&&j.stopPropagation()},children:[l.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1.5",children:[l.jsx("div",{className:"text-[11px] font-sans font-semibold text-[#c9d1d9] truncate","data-testid":"system-event-tooltip-title",children:ZH(e,s)}),l.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[!d&&l.jsx("button",{type:"button","data-testid":"system-event-payload-tooltip-pin",className:"text-[10px] text-[#c9d1d9] hover:text-white px-1.5 py-0.5 rounded border border-[#30363d] bg-[#21262d] cursor-pointer",onClick:j=>{j.stopPropagation(),j.preventDefault();const G=x.current;G?v(G):T(j.clientX,j.clientY)},children:"Pin"}),d&&l.jsx("button",{type:"button","data-testid":"system-event-payload-tooltip-close",className:"text-[10px] text-[#8b949e] hover:text-[#c9d1d9] px-1 rounded border border-[#30363d] cursor-pointer",onClick:j=>{j.stopPropagation(),N()},children:"close"})]})]}),l.jsx("p",{className:"mb-2 text-spur-text leading-relaxed","data-testid":"system-event-description",children:s.description}),l.jsxs("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1 max-h-80 overflow-y-auto",children:[l.jsx("dt",{className:"text-spur-text-muted",children:"Summary"}),l.jsx("dd",{className:"break-words",children:At(s.summary)}),l.jsx("dt",{className:"text-spur-text-muted",children:"Severity"}),l.jsx("dd",{children:l.jsx(_c,{severity:s.severity})}),s.fields.map(j=>l.jsxs("div",{className:"contents",children:[l.jsx("dt",{className:"text-spur-text-muted",children:j.label}),l.jsx("dd",{className:"font-mono break-all",children:At(j.value)})]},j.label+j.value)),l.jsx("dt",{className:"text-spur-text-muted",children:"Producer"}),l.jsx("dd",{className:"font-mono break-all",children:At(s.producer)}),s.correlationFields.length>0?s.correlationFields.map(j=>l.jsxs("div",{className:"contents",children:[l.jsx("dt",{className:"text-spur-text-muted",children:j.label}),l.jsx("dd",{className:"font-mono break-all",children:At(j.value)})]},`correlation-${j.label}`)):l.jsxs(l.Fragment,{children:[l.jsx("dt",{className:"text-spur-text-muted",children:"Correlation"}),l.jsx("dd",{className:"font-mono",children:"-"})]}),l.jsx("dt",{className:"text-spur-text-muted",children:"Outcome"}),l.jsx("dd",{className:"font-mono break-all",children:At(s.outcome)})]}),s.action&&l.jsxs("div",{className:"mt-2 border-t border-[#30363d] pt-2","data-testid":"system-event-remediation",children:[l.jsx("div",{className:"text-spur-text-muted",children:s.action.label}),l.jsx("code",{className:"block mt-0.5 font-mono break-all select-text",children:s.action.value})]}),l.jsx("div",{className:"mt-2 border-t border-[#30363d] pt-1.5 text-[10px] text-[#8b949e] font-sans","data-testid":"system-event-tooltip-footer",children:d?"Select to copy · Esc or outside click to close":"Click event name or Pin to lock for copy"})]}):null,k=j=>{switch(j){case"time":return l.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 font-mono text-spur-text-muted whitespace-nowrap align-middle",children:ly(e.occurredAt)},"time");case"severity":return l.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 align-middle text-[10px]",children:l.jsx(_c,{severity:s.severity})},"severity");case"event":return l.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 relative align-middle min-w-0",children:l.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[l.jsx("button",{type:"button","aria-expanded":o,"aria-controls":`detail-${e.id}`,"aria-label":`${o?"Collapse":"Expand"} detail for ${e.eventName}`,onClick:R,onKeyDown:C,className:"inline-flex items-center justify-center w-4 h-4 text-spur-text-muted hover:text-spur-text text-[10px] transition-colors cursor-pointer focus:outline-none focus:ring-2 focus:ring-spur-text/40 shrink-0",children:o?"▾":"▸"}),l.jsxs("div",{className:"relative min-w-0 max-w-full flex items-center gap-1",children:[l.jsx("button",{ref:x,type:"button",className:`font-mono font-semibold truncate block max-w-full text-left cursor-pointer bg-transparent border-0 p-0 ${i}`,"data-testid":"system-event-name","aria-label":`Context for ${e.eventName}. Hover to preview; click to pin for select and copy.`,"aria-describedby":A?`system-event-tooltip-${e.id}`:void 0,onMouseEnter:()=>{D(),p(!0)},onFocus:()=>{D(),p(!0)},onBlur:G=>{!d&&!E.current?.contains(G.relatedTarget)&&p(!1)},onMouseLeave:()=>{D(),S.current=setTimeout(()=>{d||p(!1)},200)},onClick:G=>{G.preventDefault(),G.stopPropagation(),!d&&v(G.currentTarget,G.clientX,G.clientY)},onKeyDown:G=>{if(G.key==="Enter"||G.key===" "){if(G.preventDefault(),d)return;v(G.currentTarget)}},children:e.eventName}),l.jsx(Io,{value:e.eventName,label:"event name"}),!d&&U]})]})},"event");case"summary":return l.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 text-spur-text align-middle truncate",title:At(s.summary),children:At(s.summary)},"summary");case"correlation":return l.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 font-mono text-[10px] text-spur-text-muted align-middle",children:l.jsxs("div",{className:"flex items-center gap-1 min-w-0",children:[l.jsx("span",{className:"truncate",title:At(s.correlation),children:At(s.correlation)}),s.correlation&&s.correlation!=="unavailable"&&l.jsx(Io,{value:s.correlation,label:"correlation"})]})},"correlation");case"outcome":return l.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 font-mono text-[10px] text-spur-text-muted align-middle truncate",title:At(s.outcome),children:At(s.outcome)},"outcome");case"agent":return l.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 font-mono text-[10px] text-spur-text-muted align-middle truncate",title:s.agent??"",children:s.agent??""},"agent");case"producer":return l.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 font-mono text-[10px] text-spur-text-muted align-middle truncate",title:At(s.producer),children:At(s.producer)},"producer");case"action":return l.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 font-mono text-[10px] text-spur-text-muted align-middle truncate",title:At(s.actionLabel),children:At(s.actionLabel)},"action");case"actor":return l.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 font-mono text-[10px] text-spur-text-muted align-middle truncate",title:w,children:w},"actor")}};return l.jsxs(l.Fragment,{children:[l.jsx("tr",{className:"group hover:bg-base-200/60 transition-colors",style:{height:n?void 0:28},children:n?l.jsxs(l.Fragment,{children:[l.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 font-mono text-spur-text-muted whitespace-nowrap align-middle",children:ly(e.occurredAt)}),l.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 relative align-middle min-w-0",children:l.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[l.jsx("button",{type:"button","aria-expanded":o,"aria-controls":`detail-${e.id}`,"aria-label":`${o?"Collapse":"Expand"} detail for ${e.eventName}`,onClick:R,onKeyDown:C,className:"inline-flex items-center justify-center w-4 h-4 text-spur-text-muted hover:text-spur-text text-[10px] transition-colors cursor-pointer focus:outline-none focus:ring-2 focus:ring-spur-text/40 shrink-0",children:o?"▾":"▸"}),l.jsxs("div",{className:"relative min-w-0 max-w-full flex items-center gap-1",children:[l.jsx("button",{ref:x,type:"button",className:`font-mono font-semibold truncate block max-w-full text-left cursor-pointer bg-transparent border-0 p-0 ${i}`,"data-testid":"system-event-name","aria-label":`Context for ${e.eventName}. Hover to preview; click to pin for select and copy.`,"aria-describedby":A?`system-event-tooltip-${e.id}`:void 0,onMouseEnter:()=>{D(),p(!0)},onFocus:()=>{D(),p(!0)},onBlur:j=>{!d&&!E.current?.contains(j.relatedTarget)&&p(!1)},onMouseLeave:()=>{D(),S.current=setTimeout(()=>{d||p(!1)},200)},onClick:j=>{j.preventDefault(),j.stopPropagation(),!d&&v(j.currentTarget,j.clientX,j.clientY)},onKeyDown:j=>{if(j.key==="Enter"||j.key===" "){if(j.preventDefault(),d)return;v(j.currentTarget)}},children:e.eventName}),l.jsx(Io,{value:e.eventName,label:"event name"}),!d&&U]})]}),l.jsxs("div",{className:"flex flex-col gap-0.5 text-[10px] text-spur-text-muted min-w-0",children:[l.jsx(_c,{severity:s.severity}),l.jsx("span",{className:"truncate text-spur-text",title:At(s.summary),children:At(s.summary)}),l.jsx("span",{className:"truncate",title:At(s.producer),children:At(s.producer)}),l.jsx("span",{className:"truncate",title:At(s.correlation),children:At(s.correlation)}),s.agent&&l.jsxs("span",{className:"truncate font-mono",title:s.agent,children:["agent: ",s.agent]}),l.jsxs("span",{className:"truncate",children:["outcome: ",At(s.outcome)]}),l.jsxs("span",{className:"truncate",title:At(s.actionLabel),children:["action: ",At(s.actionLabel)]})]})]})})]}):r.map(j=>k(j))}),o&&l.jsx("tr",{children:l.jsx("td",{colSpan:n?2:r.length,className:"px-3 py-2 border-b border-spur-border/40 bg-base-300/40",children:l.jsxs("section",{id:`detail-${e.id}`,"aria-label":`Detail for ${e.eventName}`,onKeyDown:C,tabIndex:-1,className:"flex flex-col gap-2 text-[11px] text-spur-text max-w-full",children:[l.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 font-mono text-[10px]",children:[l.jsxs("span",{children:[l.jsx("span",{className:"text-spur-text-muted",children:"project:"})," ",At(s.projectName)]}),l.jsxs("span",{children:[l.jsx("span",{className:"text-spur-text-muted",children:"root:"})," ",At(s.projectRoot)]}),l.jsxs("span",{children:[l.jsx("span",{className:"text-spur-text-muted",children:"producer:"})," ",At(s.producer)]}),l.jsxs("span",{children:[l.jsx("span",{className:"text-spur-text-muted",children:"correlation:"})," ",At(s.correlation)]}),e.runId&&l.jsxs("span",{className:"inline-flex items-center gap-1",children:[l.jsx("span",{className:"text-spur-text-muted",children:"runId:"})," ",e.runId," ",l.jsx(Io,{value:e.runId,label:"run ID"})]}),l.jsxs("span",{children:[l.jsx("span",{className:"text-spur-text-muted",children:"agent:"})," ",s.agent||"-"]}),l.jsxs("span",{children:[l.jsx("span",{className:"text-spur-text-muted",children:"actor:"})," ",w]}),l.jsxs("span",{children:[l.jsx("span",{className:"text-spur-text-muted",children:"prefix:"})," ",a]}),l.jsxs("span",{children:[l.jsx("span",{className:"text-spur-text-muted",children:"tier:"})," ",t]}),l.jsxs("span",{children:[l.jsx("span",{className:"text-spur-text-muted",children:"outcome:"})," ",At(s.outcome)]})]}),s.fields.length>0&&l.jsx("dl",{className:"space-y-0.5",children:s.fields.map(j=>l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("dt",{className:"text-spur-text-muted shrink-0",children:[j.label,":"]}),l.jsx("dd",{className:"font-mono break-all",children:At(j.value)})]},j.label+j.value))}),l.jsxs("div",{className:"border-t border-spur-border/40 pt-1",children:[l.jsx("div",{className:"text-spur-text-muted text-[10px] mb-0.5",children:"payload (redacted):"}),l.jsx("pre",{className:"font-mono text-[10px] text-spur-text-muted overflow-x-auto whitespace-pre-wrap break-all",children:e.envelope?JSON.stringify(e.envelope,null,2):"-"})]}),l.jsx("button",{type:"button",onClick:()=>u(!1),className:"self-start text-[10px] text-spur-text-muted hover:text-error px-2 py-0.5 rounded border border-spur-border/40 hover:border-error/40 transition-colors cursor-pointer focus:outline-none focus:ring-2 focus:ring-spur-text/40",children:"Close (Esc)"})]})})}),d&&U&&typeof document<"u"?da.createPortal(U,document.body):null]})}const rG=Nt(),aG=`${rG}/jobs/stats`,cy=50;function sG(e){if(e===null||typeof e!="object")return null;const t=e.stats;if(t===null||typeof t!="object")return null;const n=t;return typeof n.pending!="number"||typeof n.processing!="number"||typeof n.completed!="number"||typeof n.failed!="number"?null:{stats:{pending:n.pending,processing:n.processing,completed:n.completed,failed:n.failed}}}function fw(e){switch(e.split(".").pop()??""){case"enqueued":return"pending";case"retrying":return"retrying";case"completed":return"completed";case"failed":return"failed";case"executed":return"executed";default:return null}}function Sl(e,t){const n={};if(!t)return n;const r=i=>{const o=t[i];return typeof o=="string"&&o.length>0?o:void 0},a=i=>{const o=t[i];return typeof o=="number"&&Number.isFinite(o)?o:void 0},s=e.split(".").pop()??"";return n.durationMs=a("durationMs"),s==="executed"?(n.name=r("name"),n.error=r("error")):(n.jobId=r("jobId"),n.type=r("type"),(s==="failed"||s==="retrying")&&(n.attempt=a("attempt")),s==="failed"&&(n.error=r("error"))),n}function mw(e){switch(e){case"completed":case"executed":return"success";case"retrying":return"warning";case"failed":return"error";default:return"neutral"}}function iG(e,t){const n=[];let r=0,a=0;for(;r<e.length&&a<t.length;){const s=e[r],i=t[a];if(s&&i&&s.occurredAt>=i.occurredAt)n.push(s),r++;else if(i)n.push(i),a++;else if(s)n.push(s),r++;else break}for(;r<e.length;){const s=e[r];s&&n.push(s),r++}for(;a<t.length;){const s=t[a];s&&n.push(s),a++}return n}function oG(e){const t=[],n=new Map;for(const r of e){const s=r.eventName.startsWith("queue.job.")?Sl(r.eventName,r.payload).jobId:void 0;if(s!==void 0){const i=n.get(s);if(i)i.events.push(r);else{const o={kind:"thread",jobId:s,events:[r]};n.set(s,o),t.push(o)}}else t.push({kind:"standalone",row:r})}return t}function lG(e){if(e.length<2)return null;const t=Date.parse(e[0]?.occurredAt??""),n=Date.parse(e.at(-1)?.occurredAt??"");return!Number.isFinite(t)||!Number.isFinite(n)?null:Math.max(0,t-n)}function uG({timeRange:e="24h"}={}){const[t,n]=g.useState(null),[r,a]=g.useState(null),s=g.useRef(0);if(g.useEffect(()=>{const o=new AbortController,u=++s.current;return a(null),n(null),(async()=>{try{const c=uw(e),p=xl({prefix:"queue",limit:cy,...c?{since:c}:{}}),d=xl({prefix:"scheduler",limit:cy,...c?{since:c}:{}}),[f,m,b]=await Promise.all([Tt(new Request(aG,{signal:o.signal})),Tt(new Request(p,{signal:o.signal})),Tt(new Request(d,{signal:o.signal}))]);if(!f.ok)throw new Error(`job stats fetch failed: ${f.status}`);if(!m.ok)throw new Error(`queue history fetch failed: ${m.status}`);if(!b.ok)throw new Error(`scheduler history fetch failed: ${b.status}`);const E=sG(await f.json()),x=yl(await m.json()),y=yl(await b.json());if(!E)throw new Error("job stats response failed schema validation");if(!x)throw new Error("queue history response failed schema validation");if(!y)throw new Error("scheduler history response failed schema validation");const S=iG(x.events,y.events);if(o.signal.aborted||u!==s.current)return;n({stats:E.stats,events:S})}catch(c){if(o.signal.aborted||u!==s.current)return;a(c instanceof Error?c.message:String(c))}})(),()=>o.abort()},[e]),r)return l.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load jobs: ",r]});if(t===null)return l.jsxs("div",{className:"flex items-center justify-center h-32 text-spur-text-muted text-sm",children:[l.jsx(Ra,{size:"sm"})," Loading jobs…"]});const i=[["Pending",t.stats.pending,"text-spur-text"],["Processing",t.stats.processing,"text-info"],["Completed",t.stats.completed,"text-success"],["Failed",t.stats.failed,"text-error"]];return l.jsxs("div",{className:"flex flex-col gap-4","data-jobs-tab":!0,children:[l.jsxs("div",{className:"p-4 rounded-xl border border-base-content/10 bg-base-200 shadow-sm space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"Current Queue State"}),l.jsx("span",{className:"text-[11px] text-spur-text-muted",children:"Live aggregate counters from queue engine"})]}),l.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:i.map(([o,u,c])=>l.jsx(Ki,{variant:"compact",className:"bg-base-100 border border-spur-border shadow-xs",children:l.jsxs(Xi,{className:"p-3 gap-1",children:[l.jsx("span",{className:"text-[10px] uppercase text-spur-text-muted font-semibold tracking-wider",children:o}),l.jsx("span",{className:`text-xl font-semibold tabular-nums font-mono ${c}`,children:u})]})},o))})]}),l.jsxs("div",{className:"rounded-xl border border-base-content/10 bg-base-200 shadow-sm overflow-hidden flex flex-col",children:[l.jsxs("div",{className:"px-4 py-3 border-b border-base-content/10 bg-base-200 shrink-0 flex items-center justify-between flex-wrap gap-2",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"Recent Job Events"}),l.jsx(Ot,{variant:"outline",size:"xs",className:"font-mono",children:e==="all"?"All time":`Last ${e}`})]}),l.jsxs("span",{className:"text-xs text-spur-text-muted font-mono",children:[t.events.length," event(s)"]})]}),t.events.length===0?l.jsxs("div",{className:"p-8 text-center text-sm text-spur-text-muted italic","data-jobs-empty":!0,children:["No job events ",e==="all"?"recorded yet":`in the last ${e}`," — queue and scheduler have not processed events in this window."]}):l.jsx("ul",{className:"p-3 space-y-2",children:oG(t.events).map(o=>o.kind==="thread"?l.jsx(dG,{item:o},`thread-${o.jobId}`):l.jsx(cG,{row:o.row},o.row.id))})]})]})}function cG({row:e}){const t=g.useMemo(()=>Sl(e.eventName,e.payload),[e.eventName,e.payload]),n=fw(e.eventName),r=e.eventName.startsWith("scheduler."),a=r?t.name??"scheduler":t.jobId??"job",s=r?"scheduler":t.type??"unknown",i=t.durationMs!==void 0?_d(t.durationMs):null;return l.jsx("li",{children:l.jsx(Ki,{variant:"compact",className:"bg-base-200 border border-spur-border",children:l.jsxs(Xi,{className:"p-3 gap-1",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n!==null&&l.jsx(Ot,{variant:mw(n),size:"xs",children:n}),l.jsx("span",{className:"text-xs font-mono text-spur-text font-semibold",children:a}),l.jsx(Ot,{variant:"outline",size:"xs",children:s}),l.jsx("span",{className:"text-[10px] text-spur-text-muted ml-auto font-mono",children:e.occurredAt})]}),l.jsxs("div",{className:"flex items-center gap-3 flex-wrap text-[11px] text-spur-text-muted",children:[t.attempt!==void 0&&l.jsxs("span",{children:["attempt ",l.jsx("span",{className:"font-mono text-spur-text",children:t.attempt})]}),l.jsxs("span",{children:["duration ",l.jsx("span",{className:"font-mono text-spur-text",children:i??"unavailable"})]}),t.error!==void 0&&l.jsx("span",{className:"text-error truncate max-w-md",title:t.error,children:t.error}),!r&&t.type===void 0&&l.jsx("span",{className:"italic",children:"unknown job type"})]}),e.payload!==null&&Object.keys(e.payload).length>0&&l.jsxs("details",{className:"mt-1",children:[l.jsx("summary",{className:"text-[10px] text-spur-text-muted cursor-pointer select-none",children:"raw payload"}),l.jsx("pre",{className:"text-[10px] text-spur-text-muted bg-base-300 rounded p-2 overflow-x-auto mt-1",children:JSON.stringify(e.payload,null,2)})]})]})})})}function dG({item:e}){const t=e.events[0],n=g.useMemo(()=>t?Sl(t.eventName,t.payload):null,[t]);if(!t||!n)return null;const r=fw(t.eventName),a=lG(e.events),s=n.durationMs!==void 0?_d(n.durationMs):a!==null?_d(a):null;return l.jsx("li",{children:l.jsx(Ki,{variant:"compact",className:"bg-base-200 border border-spur-border",children:l.jsxs(Xi,{className:"p-3 gap-1",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r!==null&&l.jsx(Ot,{variant:mw(r),size:"xs",children:r}),l.jsx("span",{className:"text-xs font-mono text-spur-text font-semibold",children:e.jobId}),n.type!==void 0&&l.jsx(Ot,{variant:"outline",size:"xs",children:n.type}),l.jsx("span",{className:"text-[10px] text-spur-text-muted ml-auto font-mono",children:t.occurredAt})]}),l.jsxs("div",{className:"flex items-center gap-3 flex-wrap text-[11px] text-spur-text-muted",children:[n.attempt!==void 0&&l.jsxs("span",{children:["attempt ",l.jsx("span",{className:"font-mono text-spur-text",children:n.attempt})]}),l.jsxs("span",{children:["duration ",l.jsx("span",{className:"font-mono text-spur-text",children:s??"unavailable"})]}),n.error!==void 0&&l.jsx("span",{className:"text-error truncate max-w-md",title:n.error,children:n.error}),l.jsxs("span",{className:"italic",children:[e.events.length," event(s)"]})]}),e.events.length>1&&l.jsxs("details",{className:"mt-1",children:[l.jsxs("summary",{className:"text-[10px] text-spur-text-muted cursor-pointer select-none",children:["event sequence (",e.events.length,")"]}),l.jsx("ol",{className:"mt-1 space-y-1",children:e.events.map(i=>{const o=Sl(i.eventName,i.payload);return l.jsxs("li",{className:"text-[10px] text-spur-text-muted flex items-center gap-2",children:[l.jsx("span",{className:"font-mono",children:i.occurredAt}),l.jsx("span",{children:i.eventName}),o.attempt!==void 0&&l.jsxs("span",{children:["attempt ",o.attempt]})]},i.id)})})]}),t.payload!==null&&Object.keys(t.payload).length>0&&l.jsxs("details",{className:"mt-1",children:[l.jsx("summary",{className:"text-[10px] text-spur-text-muted cursor-pointer select-none",children:"raw payload"}),l.jsx("pre",{className:"text-[10px] text-spur-text-muted bg-base-300 rounded p-2 overflow-x-auto mt-1",children:JSON.stringify(t.payload,null,2)})]})]})})})}function dy(e){if(e===null||typeof e!="object")return null;const t=e;return typeof t.inputTokens!="number"||typeof t.outputTokens!="number"||typeof t.cacheReadTokens!="number"||typeof t.cacheCreationTokens!="number"||typeof t.records!="number"||typeof t.recordsWithUsage!="number"?null:{inputTokens:t.inputTokens,outputTokens:t.outputTokens,cacheReadTokens:t.cacheReadTokens,cacheCreationTokens:t.cacheCreationTokens,records:t.records,recordsWithUsage:t.recordsWithUsage}}function pG(e){if(e===null||typeof e!="object")return null;const t=e;return!(t.role===null||typeof t.role=="string")||typeof t.totalRuns!="number"||typeof t.matchedRuns!="number"||typeof t.unmeasured!="boolean"?null:{role:t.role,totalRuns:t.totalRuns,matchedRuns:t.matchedRuns,exact:dy(t.exact),estimated:dy(t.estimated),unmeasured:t.unmeasured}}function fG(e){if(e===null||typeof e!="object")return null;const t=e;return!(t.role===null||typeof t.role=="string")||typeof t.executor!="string"||!(t.source===null||typeof t.source=="string")||typeof t.runs!="number"||typeof t.escalations!="number"?null:{role:t.role,executor:t.executor,source:t.source,runs:t.runs,escalations:t.escalations}}function mG(e){if(e===null||typeof e!="object")return null;const t=e,n=t.routing,r=t.tokens;if(n===null||typeof n!="object"||r===null||typeof r!="object")return null;const a=n,s=r,i=a.window;if(i===null||typeof i!="object")return null;const o=i;if(typeof o.since!="string"||typeof o.until!="string"||!Array.isArray(a.pairs)||!Array.isArray(s.roles))return null;const u=[];for(const p of a.pairs){const d=fG(p);d&&u.push(d)}const c=[];for(const p of s.roles){const d=pG(p);d&&c.push(d)}return{window:{since:o.since,until:o.until},pairs:u,roles:c}}function hG(e){switch(e){case"explicit":return"pinned";case"role":return"resolved";case"default":return"default";case null:return"—";default:return e}}const gG=new Intl.NumberFormat("en-US");function Ya(e){return gG.format(e)}function py({label:e,totals:t}){return l.jsxs("div",{"data-token-bucket":e,className:"text-xs",children:[l.jsx(Ot,{size:"xs",variant:e==="estimated"?"warning":"success",children:e}),l.jsxs("dl",{className:"grid grid-cols-2 gap-x-4 gap-y-0.5 mt-1",children:[l.jsx("dt",{className:"text-spur-text-muted",children:"input"}),l.jsx("dd",{className:"tabular-nums text-right",children:Ya(t.inputTokens)}),l.jsx("dt",{className:"text-spur-text-muted",children:"cache read"}),l.jsx("dd",{className:"tabular-nums text-right",children:Ya(t.cacheReadTokens)}),l.jsx("dt",{className:"text-spur-text-muted",children:"cache write"}),l.jsx("dd",{className:"tabular-nums text-right",children:Ya(t.cacheCreationTokens)}),l.jsx("dt",{className:"text-spur-text-muted",children:"output"}),l.jsx("dd",{className:"tabular-nums text-right",children:Ya(t.outputTokens)})]})]})}function bG({role:e}){const t=e.role??"—";return l.jsxs("div",{className:"bg-base-100 border border-spur-border rounded-md p-3","data-role-attribution":t,children:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsx("span",{className:"text-sm font-semibold text-spur-text",children:t}),l.jsxs("span",{className:"text-[10px] text-spur-text-muted tabular-nums",children:["matched ",e.matchedRuns," of ",e.totalRuns," runs"]})]}),e.unmeasured?l.jsxs("div",{className:"mt-1 text-xs","data-unmeasured":!0,children:[l.jsx(Ot,{size:"xs",variant:"ghost",children:"unmeasured"}),l.jsx("span",{className:"ml-1 text-spur-text-muted",children:"no token data recorded for this role — not a measured zero"})]}):l.jsxs("div",{className:"mt-2 flex flex-wrap gap-4",children:[e.exact?l.jsx(py,{label:"exact",totals:e.exact}):null,e.estimated?l.jsx(py,{label:"estimated",totals:e.estimated}):null]})]})}function EG(){const[e,t]=g.useState(null),[n,r]=g.useState(null);if(g.useEffect(()=>{const s=new AbortController;return(async()=>{try{const i=await Tt(new Request(`${Nt()}/observability/routing-summary`,{signal:s.signal}));if(!i.ok)throw new Error(`routing summary fetch failed: ${i.status}`);const o=mG(await i.json());if(!o)throw new Error("routing summary response failed schema validation");t(o)}catch(i){if(s.signal.aborted)return;r(i instanceof Error?i.message:String(i))}})(),()=>s.abort()},[]),n)return l.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load routing summary: ",n]});if(e===null)return l.jsxs("div",{className:"flex items-center justify-center h-32 text-spur-text-muted text-sm",children:[l.jsx(Ra,{size:"sm"})," Loading routing summary…"]});const a=e.pairs.length===0&&e.roles.length===0;return l.jsxs("div",{className:"flex flex-col h-full overflow-hidden","data-routing-tab":!0,children:[l.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-base-200 shrink-0 flex items-baseline justify-between",children:[l.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"Routing & token consumption"}),l.jsxs("span",{className:"text-[10px] text-spur-text-muted tabular-nums","data-covered-window":!0,children:["covered ",e.window.since," → ",e.window.until]})]}),a?l.jsx("div",{className:"flex-1 flex items-center justify-center p-4","data-routing-empty":!0,children:l.jsx("div",{className:"text-sm text-spur-text-muted italic",children:"No routing attribution has been recorded in the covered window — nothing to show yet."})}):l.jsxs("div",{className:"flex-1 overflow-y-auto p-3 space-y-4",children:[e.pairs.length>0?l.jsxs("section",{className:"bg-base-100 border border-spur-border rounded-md","data-routing-table":!0,children:[l.jsxs("div",{className:"px-3 py-2 border-b border-spur-border",children:[l.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"Role → executor"}),l.jsx("span",{className:"ml-2 text-[10px] text-spur-text-muted",children:"runs and escalations per pair; pinned and role-resolved counted separately"})]}),l.jsxs("table",{className:"table table-sm w-full",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"text-[10px] uppercase text-spur-text-muted",children:[l.jsx("th",{children:"Role"}),l.jsx("th",{children:"Executor"}),l.jsx("th",{children:"Source"}),l.jsx("th",{className:"text-right",children:"Runs"}),l.jsx("th",{className:"text-right",children:"Escalations"})]})}),l.jsx("tbody",{children:e.pairs.map(s=>l.jsxs("tr",{children:[l.jsx("td",{className:"text-sm text-spur-text",children:s.role??"—"}),l.jsx("td",{className:"text-sm text-spur-text",children:s.executor}),l.jsx("td",{children:l.jsx(Ot,{size:"xs",variant:s.source==="explicit"?"warning":"ghost",children:hG(s.source)})}),l.jsx("td",{className:"text-right tabular-nums text-spur-text",children:Ya(s.runs)}),l.jsx("td",{className:"text-right tabular-nums text-spur-text",children:Ya(s.escalations)})]},`${s.role??""}:${s.executor}:${s.source??""}`))})]}),l.jsx("div",{className:"px-3 py-1.5 border-t border-spur-border text-[10px] text-spur-text-muted",children:"“—” role groups pure pins (no role recorded); escalations count runs that started too cheap on this executor."})]}):null,e.roles.length>0?l.jsxs("section",{"data-token-section":!0,children:[l.jsxs("div",{className:"px-1 pb-1.5",children:[l.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"Token consumption by role"}),l.jsx("span",{className:"ml-2 text-[10px] text-spur-text-muted",children:"input, cache read, cache write, output — token totals only"})]}),l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:e.roles.map(s=>l.jsx(bG,{role:s},s.role??"pin"))})]}):null]})]})}const Cc=[{id:"system-events",label:"System Events",component:JH},{id:"jobs",label:"Jobs",component:uG},{id:"routing",label:"Routing",component:EG}];function xG(){const[e,t]=g.useState(Cc[0]?.id??""),[n,r]=g.useState("24h"),[a,s]=g.useState({status:"connecting",rate:0,lastEventAt:null}),o=Cc.find(m=>m.id===e)?.component,u=g.useCallback(m=>{s(m)},[]),c=e==="system-events",p=c?a.status:"idle",d=c?a.status==="live"?`live tail · ${a.rate} evt/60s`:a.status==="connecting"?"connecting…":a.status==="paused"?"live tail paused":"stream error":"live tail idle",f=p==="live"?"bg-emerald-400 animate-pulse":p==="connecting"?"bg-amber-400":p==="errored"?"bg-error":"bg-base-content/40";return l.jsxs("div",{className:"flex flex-col gap-4 p-4 max-w-[1600px] mx-auto w-full","data-observability-shell":!0,children:[l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4 border-b border-base-content/10 pb-3 shrink-0",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("span",{className:"text-2xl",children:"📡"}),l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl font-bold tracking-tight",children:"Observability"}),l.jsx("p",{className:"text-xs text-base-content/60",children:"System event streams, queue execution telemetry, and routing attribution"}),l.jsxs("p",{className:"livechip mt-1 inline-flex items-center gap-1.5 rounded-full border border-base-content/10 px-2 py-0.5 text-xs text-base-content/60 font-mono","data-testid":"observability-liveness-chip",role:"status","aria-live":"polite",children:[l.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${f}`,"aria-hidden":"true"}),d,c&&a.lastEventAt&&l.jsxs(l.Fragment,{children:[" · last ",l.jsx("time",{dateTime:a.lastEventAt,children:new Date(a.lastEventAt).toLocaleTimeString()})]})]})]})]}),l.jsx("div",{role:"tablist","aria-label":"Observability tabs",className:"flex items-center gap-1 bg-base-300 p-1 rounded-xl",children:Cc.map(m=>{const b=m.id===e;return l.jsx("button",{type:"button",role:"tab","aria-selected":b,"aria-controls":`observability-tab-panel-${m.id}`,id:`observability-tab-${m.id}`,onClick:()=>t(m.id),className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer ${b?"bg-primary text-primary-content font-bold shadow-sm":"text-base-content/70 hover:bg-base-content/10"}`,children:m.label},m.id)})})]}),l.jsx("div",{role:"tabpanel",id:`observability-tab-panel-${e}`,"aria-labelledby":`observability-tab-${e}`,className:"mt-2 flex flex-col gap-4",children:o?l.jsx(o,{onLivenessChange:u,timeRange:n,onTimeRangeChange:r}):null})]})}const yG={id:"observability",name:"Observability",icon:"📡",route:"observability",component:xG,sidebarLabel:"Observability",order:0},TG=Object.freeze(Object.defineProperty({__proto__:null,module:yG},Symbol.toStringTag,{value:"Module"})),vu=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function As(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function yb(e){return"nodeType"in e}function Pn(e){var t,n;return e?As(e)?e:yb(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Tb(e){const{Document:t}=Pn(e);return e instanceof t}function Ji(e){return As(e)?!1:e instanceof Pn(e).HTMLElement}function hw(e){return e instanceof Pn(e).SVGElement}function Ns(e){return e?As(e)?e.document:yb(e)?Tb(e)?e:Ji(e)||hw(e)?e.ownerDocument:document:document:document}const Or=vu?g.useLayoutEffect:g.useEffect;function wu(e){const t=g.useRef(e);return Or(()=>{t.current=e}),g.useCallback(function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return t.current==null?void 0:t.current(...r)},[])}function SG(){const e=g.useRef(null),t=g.useCallback((r,a)=>{e.current=setInterval(r,a)},[]),n=g.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ci(e,t){t===void 0&&(t=[e]);const n=g.useRef(e);return Or(()=>{n.current!==e&&(n.current=e)},t),n}function eo(e,t){const n=g.useRef();return g.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function vl(e){const t=wu(e),n=g.useRef(null),r=g.useCallback(a=>{a!==n.current&&t?.(a,n.current),n.current=a},[]);return[n,r]}function wl(e){const t=g.useRef();return g.useEffect(()=>{t.current=e},[e]),t.current}let kc={};function Au(e,t){return g.useMemo(()=>{if(t)return t;const n=kc[e]==null?0:kc[e]+1;return kc[e]=n,e+"-"+n},[e,t])}function gw(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.reduce((s,i)=>{const o=Object.entries(i);for(const[u,c]of o){const p=s[u];p!=null&&(s[u]=p+e*c)}return s},{...t})}}const es=gw(1),Al=gw(-1);function vG(e){return"clientX"in e&&"clientY"in e}function Sb(e){if(!e)return!1;const{KeyboardEvent:t}=Pn(e.target);return t&&e instanceof t}function wG(e){if(!e)return!1;const{TouchEvent:t}=Pn(e.target);return t&&e instanceof t}function Nl(e){if(wG(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return vG(e)?{x:e.clientX,y:e.clientY}:null}const us=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[us.Translate.toString(e),us.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),fy="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function AG(e){return e.matches(fy)?e:e.querySelector(fy)}const NG={display:"none"};function _G(e){let{id:t,value:n}=e;return et.createElement("div",{id:t,style:NG},n)}function CG(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const a={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return et.createElement("div",{id:t,style:a,role:"status","aria-live":r,"aria-atomic":!0},n)}function kG(){const[e,t]=g.useState("");return{announce:g.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const bw=g.createContext(null);function IG(e){const t=g.useContext(bw);g.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function RG(){const[e]=g.useState(()=>new Set),t=g.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[g.useCallback(r=>{let{type:a,event:s}=r;e.forEach(i=>{var o;return(o=i[a])==null?void 0:o.call(i,s)})},[e]),t]}const DG={draggable:`
|
|
174
|
+
`)})}catch(te){const H=te instanceof Error?te.message:"Body seeding failed";typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:`Task created but body seeding failed: ${H}`}}))}C(),n()}catch(j){const G=j instanceof Error?j.message:"Create failed";A(G),typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:G}}))}finally{S(!1)}}};return e?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-40",onClick:C,"aria-hidden":"true"}),l.jsxs("div",{className:"fixed inset-y-0 right-0 max-w-[90vw] bg-spur-surface border-l border-spur-border z-50 flex shadow-2xl",style:{width:T,minWidth:Tc},role:"dialog","aria-label":"New Task",children:[l.jsx(gl,{targetVar:"--new-task-panel-w",onResizeEnd:k=>{const j=typeof window<"u"?window.innerWidth*.9:k,G=Math.max(Tc,Math.min(k,j));v(G);try{window.localStorage.setItem(Yx,String(G))}catch{}},direction:"horizontal",invert:!0}),l.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[l.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-spur-border shrink-0",children:[l.jsx("h2",{className:"text-sm font-semibold text-spur-text",children:"New Task"}),l.jsx(Ge,{variant:"ghost",size:"sm",className:"text-spur-text-muted",onClick:C,"aria-label":"Close",disabled:y,children:"✕"})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[l.jsxs("div",{children:[l.jsxs("label",{htmlFor:"new-task-name",className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide block mb-1.5",children:["Name ",l.jsx("span",{className:"text-spur-error",children:"*"})]}),l.jsx(Ti,{id:"new-task-name",type:"text",variant:"bordered",size:"sm",error:!!R,className:"w-full bg-spur-bg text-spur-text",placeholder:"Task name",value:s,onChange:k=>{i(k.target.value),D||N(!0)},onBlur:()=>N(!0),disabled:y}),R&&l.jsx("p",{className:"text-xs text-spur-error mt-1",children:R})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"new-task-template",className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide block mb-1.5",children:"Template"}),l.jsx(Xr,{id:"new-task-template",variant:"bordered",size:"sm",className:"w-full bg-spur-bg text-spur-text",value:E,onChange:k=>x(k.target.value),disabled:y,children:Su.map(k=>l.jsx("option",{value:k,children:k},k))})]}),l.jsx(Kx,{id:"new-task-background",label:"Background",placeholder:"Why this task exists…",value:o,mode:d,onChange:u,onModeChange:f,disabled:y}),l.jsx(Kx,{id:"new-task-requirements",label:"Requirements",placeholder:"What must be done…",value:c,mode:m,onChange:p,onModeChange:b,disabled:y}),w&&l.jsx("div",{className:"text-xs text-spur-error bg-spur-error/10 border border-spur-error/20 rounded p-2",children:w})]}),l.jsxs("div",{className:"flex items-center justify-end gap-2 p-4 border-t border-spur-border shrink-0",children:[l.jsx(Ge,{variant:"ghost",size:"sm",className:"text-spur-text-muted",onClick:C,disabled:y,children:"Cancel"}),l.jsx(Ge,{variant:"primary",size:"sm",onClick:U,disabled:y,children:y?"Creating…":"Create Task"})]})]})]})]}):null}const yz=5e3,Tz=()=>`${Nt()}/events/planning`,Sz=async(e={})=>sn.task.list(e);class Gv{state={tasks:[],subtaskProgress:new Map,loading:!0,error:null,connected:!1,lastSyncAt:void 0};listeners=[];interval;eventSource;refCount=0;listFn;constructor(t=Sz){this.listFn=t}getState=()=>this.state;setListFn=t=>{t!==this.listFn&&(this.listFn=t,this.refresh())};subscribe=t=>(this.listeners.push(t),this.refCount++,this.refCount===1&&(this.refresh(),this.interval=setInterval(this.refresh,yz),this.connectSSE()),()=>{this.listeners=this.listeners.filter(n=>n!==t),this.refCount--,this.refCount===0&&(this.interval&&(clearInterval(this.interval),this.interval=void 0),this.disconnectSSE())});refresh=async()=>{try{const n=(await this.listFn()).data??[];this.state={tasks:n,subtaskProgress:Xx(n),loading:!1,error:null,connected:this.state.connected,lastSyncAt:Date.now()}}catch(t){this.state={...this.state,loading:!1,error:t}}this.emit()};setTasks=t=>{const n=typeof t=="function"?t(this.state.tasks):t;this.state={...this.state,tasks:n,subtaskProgress:Xx(n),lastSyncAt:Date.now()},this.emit()};handleSSEOpen=()=>{this.state={...this.state,connected:!0},this.emit()};handleSSEMessage=()=>{this.refresh()};handleSSEError=()=>{this.state={...this.state,connected:!1},this.emit()};async connectSSE(){if(this.eventSource||typeof EventSource>"u")return;const t=new EventSource(Tz());this.eventSource=t,t.onopen=this.handleSSEOpen,t.onmessage=this.handleSSEMessage,t.onerror=this.handleSSEError}disconnectSSE(){this.eventSource&&(this.eventSource.close(),this.eventSource=void 0,this.state={...this.state,connected:!1})}emit(){for(const t of this.listeners)t()}}const Wv=g.createContext(null);let Sc=null;function vz(){return Sc||(Sc=new Gv),Sc}function Xx(e){const t=new Map;for(const n of e){if(!n.parentWbs)continue;const r=t.get(n.parentWbs)??{done:0,total:0};r.total+=1,n.status==="done"&&(r.done+=1),t.set(n.parentWbs,r)}return t}function hb(e){const t=g.useContext(Wv),n=g.useRef(null);e&&!n.current&&(n.current=new Gv(e));const r=n.current??t??vz();return g.useEffect(()=>{e&&n.current&&n.current.setListFn(e)},[e]),{...g.useSyncExternalStore(r.subscribe,r.getState),setTasks:r.setTasks,store:r}}function wz({progress:e,isDismissed:t,onDismiss:n,onReopen:r}){const{status:a,runId:s,action:i,error:o}=e,u=g.useRef(null);if(g.useEffect(()=>{a==="failed"&&t&&s&&u.current!==s&&(u.current=s,typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:o||`Action ${i||"job"} failed`}})))},[a,t,s,i,o]),a==="idle"||!s)return null;const c=a==="queued"||a==="running";if(t)return c?l.jsx("div",{className:"fixed bottom-4 right-4 z-40",children:l.jsxs("button",{type:"button",onClick:r,className:"flex items-center gap-2 px-3 py-1.5 bg-spur-bg border border-spur-border hover:border-spur-primary text-spur-text text-xs rounded-full shadow-md font-medium transition-colors",children:[l.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-500 animate-pulse"}),l.jsxs("span",{children:[i?`${i.charAt(0).toUpperCase()}${i.slice(1)}`:"Action"," (",a,")"]}),l.jsx("span",{className:"text-spur-text-muted",children:"⤢"})]})}):null;const p=a==="succeeded"?"success":a==="failed"?"error":a==="running"?"accent":"warning";return l.jsxs("div",{className:"fixed bottom-4 right-4 z-40 w-80 p-4 bg-spur-bg border border-spur-border rounded-lg shadow-xl backdrop-blur flex flex-col gap-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-sm font-semibold text-spur-text",children:i?`${i.charAt(0).toUpperCase()}${i.slice(1)}`:"Action"}),l.jsx(Ot,{variant:p,children:a})]}),l.jsx("button",{type:"button",onClick:n,className:"text-spur-text-muted hover:text-spur-text text-base font-bold leading-none p-1","aria-label":"Dismiss progress panel",children:"×"})]}),l.jsxs("div",{className:"text-xs text-spur-text-muted font-mono truncate",children:["ID: ",s]}),c&&l.jsxs("div",{className:"flex items-center gap-2 text-xs text-spur-text",children:[l.jsx(Ra,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:a==="queued"?"Enqueued in job runner...":"Running agent slash command..."})]}),a==="succeeded"&&l.jsx("div",{className:"text-xs text-green-400 font-medium",children:"✓ Action completed successfully."}),a==="failed"&&l.jsxs("div",{className:"text-xs text-red-400 font-medium break-words",children:["✕ ",o||"Action job failed."]}),!c&&l.jsx("div",{className:"flex justify-end pt-1",children:l.jsx(Ge,{variant:"outline",size:"sm",onClick:n,children:"Close"})})]})}const Az={backlog:["brainstorm","plan","add-child","add-task","start","cancel"],active:["add-child","add-task","link-task","sync-status","verify","block","cancel"],verifying:["sync-status","complete","rework","cancel"],blocked:["add-child","add-task","unblock","cancel"],done:[],cancelled:[]},Er={brainstorm:"Brainstorm",plan:"Plan","add-child":"+ Child","add-task":"+ Task","link-task":"Link Task","sync-status":"Sync",start:"Start",verify:"Verify",complete:"Complete",rework:"Rework",block:"Block",unblock:"Unblock",cancel:"Cancel"},Nz={start:"primary",verify:"primary",complete:"primary",unblock:"primary",brainstorm:"secondary",plan:"secondary","add-child":"secondary","add-task":"secondary","link-task":"secondary","sync-status":"secondary",block:"hazard",rework:"hazard",cancel:"hazard"},_z={start:!0,verify:!0,complete:!0,rework:!0,block:!0,unblock:!0,cancel:!0},Cz={start:"active",verify:"verifying",complete:"done",rework:"active",block:"blocked",unblock:"active",cancel:"cancelled"};function Vv({open:e,parentId:t,onClose:n,onCreated:r}){const[a,s]=g.useState(""),[i,o]=g.useState(!1),[u,c]=g.useState(""),[p,d]=g.useState(!1),f=p&&a.trim()===""?"Name is required":"",m=()=>{s(""),d(!1),c(""),n()},b=async()=>{d(!0);const E=a.trim();if(E!==""){o(!0),c("");try{t?await jv({id:t,name:E}):await I$(E),m(),r()}catch(x){const y=x instanceof Error?x.message:"Create failed";c(y)}finally{o(!1)}}};return e?l.jsx("div",{className:"fixed inset-y-0 right-0 z-40 flex","data-new-feature-panel":!0,children:l.jsxs("div",{className:"w-96 border-l border-spur-border bg-spur-surface shadow-xl flex flex-col",children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-spur-border shrink-0",children:[l.jsx("h3",{className:"text-sm font-semibold text-spur-text",children:t?"New Child Feature":"New Feature"}),l.jsx(Ge,{variant:"ghost",size:"xs",onClick:m,"aria-label":"Close panel",children:"✕"})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[t&&l.jsxs("div",{className:"text-xs text-spur-text-muted",children:["Parent: ",l.jsx("span",{className:"font-mono text-spur-accent",children:t})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"new-feature-name",className:"block text-xs font-medium text-spur-text mb-1",children:"Feature Name *"}),l.jsx(Ti,{id:"new-feature-name",value:a,onChange:E=>{s(E.target.value),p||d(!0)},onKeyDown:E=>{E.key==="Enter"&&a.trim()&&b()},placeholder:"e.g. Authentication module",disabled:i}),f&&l.jsx("p",{className:"text-xs text-red-500 mt-1",children:f}),u&&l.jsx("p",{className:"text-xs text-red-500 mt-1",children:u})]}),l.jsx("div",{className:"text-xs text-spur-text-muted",children:t?`The feature ID will be auto-allocated (next free digit under ${t}).`:"The feature ID will be auto-allocated (next free letter A–Z)."})]}),l.jsxs("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-spur-border shrink-0",children:[l.jsx(Ge,{variant:"ghost",size:"xs",onClick:m,disabled:i,children:"Cancel"}),l.jsx(Ge,{variant:"primary",size:"xs",onClick:b,disabled:i||a.trim()==="",loading:i,children:"Create Feature"})]})]})}):null}const qv={backlog:{status:"backlog",label:"Backlog",colorClass:"text-spur-text-muted",Icon:({className:e="w-3.5 h-3.5",ariaLabel:t})=>l.jsx("svg",{className:`inline-block shrink-0 ${e}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",role:"img","aria-label":t,children:l.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"2.5",strokeDasharray:"2 2"})})},active:{status:"active",label:"Active",colorClass:"text-spur-accent",Icon:({className:e="w-3.5 h-3.5",ariaLabel:t})=>l.jsx("svg",{className:`inline-block shrink-0 ${e}`,viewBox:"0 0 16 16",fill:"currentColor",role:"img","aria-label":t,children:l.jsx("circle",{cx:"8",cy:"8",r:"4.5"})})},verifying:{status:"verifying",label:"Verifying",colorClass:"text-spur-warning",Icon:({className:e="w-3.5 h-3.5",ariaLabel:t})=>l.jsxs("svg",{className:`inline-block shrink-0 ${e}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",role:"img","aria-label":t,children:[l.jsx("path",{d:"M1.5 8s2.5-4 6.5-4 6.5 4 6.5 4-2.5 4-6.5 4-6.5-4-6.5-4z"}),l.jsx("circle",{cx:"8",cy:"8",r:"2"})]})},blocked:{status:"blocked",label:"Blocked",colorClass:"text-spur-error",Icon:({className:e="w-3.5 h-3.5",ariaLabel:t})=>l.jsxs("svg",{className:`inline-block shrink-0 ${e}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":t,children:[l.jsx("path",{d:"M8 2.5l5.5 10.5H2.5L8 2.5z"}),l.jsx("path",{d:"M8 6v3"}),l.jsx("circle",{cx:"8",cy:"11.5",r:"0.5",fill:"currentColor"})]})},done:{status:"done",label:"Done",colorClass:"text-spur-success",Icon:({className:e="w-3.5 h-3.5",ariaLabel:t})=>l.jsx("svg",{className:`inline-block shrink-0 ${e}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":t,children:l.jsx("path",{d:"M3.5 8.5l3.5 3.5 5.5-7"})})},cancelled:{status:"cancelled",label:"Cancelled",colorClass:"text-spur-text-faint",Icon:({className:e="w-3.5 h-3.5",ariaLabel:t})=>l.jsxs("svg",{className:`inline-block shrink-0 ${e}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":t,children:[l.jsx("path",{d:"M5.5 2.5h5l3 3v5l-3 3h-5l-3-3v-5l3-3z"}),l.jsx("path",{d:"M6.25 6.25l3.5 3.5M9.75 6.25l-3.5 3.5"})]})}};function Yv(e){const t=qv[e.toLowerCase()];return t?t.label:`Unknown status: ${e}`}function gb({status:e,className:t}){const n=e.toLowerCase(),r=qv[n];if(r){const a=r.Icon;return l.jsx(a,{className:`${r.colorClass} ${t??"w-3.5 h-3.5"}`,ariaLabel:r.label})}return l.jsx("svg",{className:`inline-block shrink-0 text-spur-text-muted ${t??"w-3.5 h-3.5"}`,viewBox:"0 0 16 16",fill:"currentColor",role:"img","aria-label":Yv(e),children:l.jsx("circle",{cx:"8",cy:"8",r:"4"})})}function Zv(e){return e?e.startsWith("feature.")||e.startsWith("queue.job."):!1}function kz(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.jobId=="string"&&t.jobId.length>0)return t.jobId;if(typeof t.runId=="string"&&t.runId.length>0)return t.runId;if(t.job&&typeof t.job=="object"){const n=t.job;if(typeof n.id=="string"&&n.id.length>0)return n.id;if(typeof n.jobId=="string"&&n.jobId.length>0)return n.jobId}return null}function Iz(e,t){return t?kz(e)===t:!1}const vc={status:"idle"};function Rz(e,t,n){if(e.status==="idle"||!e.runId||!Iz(n,e.runId))return e;switch(t){case"queue.job.enqueued":case"queue.job.created":return{...e,status:"queued"};case"queue.job.started":case"queue.job.running":return{...e,status:"running"};case"queue.job.completed":return{...e,status:"succeeded"};case"queue.job.failed":{const r=n&&typeof n=="object"&&typeof n.error=="string"?n.error:"Job failed";return{...e,status:"failed",error:r}}default:return e}}const Dz=()=>`${Nt()}/events/planning`;function Oz(e){const[t,n]=g.useState(vc);g.useEffect(()=>{e&&n(vc)},[e]);const r=g.useCallback((s,i)=>{n({status:"queued",runId:s,action:i})},[]),a=g.useCallback(()=>{n(vc)},[]);return g.useEffect(()=>{if(typeof EventSource>"u"||!t.runId)return;const s=new EventSource(Dz());return s.onmessage=i=>{try{const o=JSON.parse(i.data),u=o.eventName;if(!Zv(u)||!u)return;n(c=>Rz(c,u,o.payload))}catch{}},()=>{s.close()}},[t.runId]),{progress:t,trackAction:r,clearProgress:a}}function Lz({featureId:e,onClose:t,refreshKey:n=0,childFeatures:r=[],onSelectFeature:a,metadataDockRef:s}){const[i,o]=g.useState(null),[u,c]=g.useState(""),[p,d]=g.useState(""),[f,m]=g.useState("preview"),[b,E]=g.useState(!1),[x,y]=g.useState(!1),[S,w]=g.useState(null),[A,D]=g.useState({}),[N,T]=g.useState(!1),[v,R]=g.useState(null),[C,U]=g.useState(null),[k,j]=g.useState(!1),[G,$]=g.useState(null),[te,H]=g.useState(null),[se,de]=g.useState(""),[O,ne]=g.useState("claude"),[pe,L]=g.useState("push"),[ke,Re]=g.useState(!1),[Q,_e]=g.useState(!1),{progress:fe,trackAction:X}=Oz(e),[Ve,ge]=g.useState(!1),me=g.useRef(null),Te=g.useRef(f);Te.current=f,g.useEffect(()=>{if(!N||k||G||te)return;const W=Be=>{Be.key==="Escape"&&T(!1)};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[N,k,G,te]);const{tasks:ve}=hb(),ie=(ve??[]).filter(W=>W.featureId===e),Ze=g.useRef(0),ot=g.useCallback(()=>++Ze.current,[]),rt=g.useCallback(W=>W===Ze.current,[]),Ht=g.useCallback(async()=>{const W=ot(),Be=await Dx(e);return rt(W)?Be:null},[e,ot,rt]),St=g.useCallback((W,Be)=>{if(o(W),me.current=W.id,D(W.frontmatter),Be?.body!==!1){const M=Fz(W.content);c(M),d(M)}},[]),Ct=g.useCallback(async W=>{const Be=await Ht();return Be&&(St(Be,W),E(!1)),Be},[Ht,St]),Zt=g.useCallback((W,Be)=>{const M=W instanceof Error?W.message:Be;U({kind:"error",message:M}),typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:M}}))},[]),at=g.useMemo(()=>({featureId:e,generation:n}),[e,n]);g.useEffect(()=>{const{featureId:W}=at;if(!W){o(null),me.current=null,c(""),d(""),m("preview"),w(null),U(null);return}const Be=me.current===W,M=Be&&Te.current==="edit";Be||(m("preview"),E(!0)),w(null);const z=ot();(async()=>{try{const Y=await Dx(W);if(!rt(z))return;St(Y,{body:!M})}catch(Y){if(!rt(z))return;w(Y instanceof Error?Y.message:"Failed to load feature")}finally{rt(z)&&E(!1)}})()},[at,ot,rt,St]);const De=async()=>{Re(!1);try{await Ct({body:!1})}catch{}},et=async()=>{_e(!1);try{await Ct()}catch{}};if(S)return l.jsx("div",{className:"flex items-center justify-center h-full p-4",children:l.jsx("p",{className:"text-sm text-red-500",children:S})});if(!i)return l.jsx("div",{className:"flex items-center justify-center h-full text-spur-text-muted text-sm",children:"Select a feature to view details"});const Z=()=>{d(u),m("edit")},oe=()=>{d(u),m("preview")},J=async()=>{y(!0);try{await C$({id:e,body:p}),c(p),m("preview"),await Ct()}catch(W){d(u),m("preview");const Be=W instanceof Error?W.message:"Save failed";typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:Be}}))}finally{y(!1)}},ue=W=>{if(!v){if(U(null),_z[W]){qe(W);return}if(W==="brainstorm"||W==="plan"){$(W);return}if(W==="add-child"){_e(!0);return}if(W==="add-task"){Re(!0);return}if(W==="link-task"){H(W),de("");return}if(W==="sync-status"){$("sync-status");return}}},Pe=async W=>{const Be=Cz[W];if(Be){R(W),U(null);try{const M=await _$(e,Be);o(z=>z&&{...z,status:M}),await Ct({body:!1}),U({kind:"ok",message:`${Er[W]??W}: status is now ${M}.`})}catch(M){Zt(M,"Transition failed")}finally{R(null)}}},qe=async W=>{if(W==="cancel"){j(!0);return}await Pe(W)},ht=async()=>{j(!1),await Pe("cancel")},Rt=async()=>{const W=te;if(!(!W||!se.trim())){H(null),R(W),U(null);try{W==="add-child"?await jv({id:e,name:se.trim()}):W==="add-task"?await R$({id:e,title:se.trim()}):W==="link-task"&&await D$({id:e,wbs:se.trim()}),await Ct({body:!1}),U({kind:"ok",message:`${Er[W]??W} completed.`})}catch(Be){Zt(Be,"Action failed")}finally{R(null)}}},kt=async()=>{if(!G)return;const W=G;$(null),R(W),U(null);try{if(W==="sync-status"){const Be=await O$({id:e,direction:pe});await Ct({body:!1});const M=Be.data?.applied,z=Be.data?.newStatus;U({kind:"ok",message:M?`Sync applied${z?`: status is now ${z}`:""}.`:"Sync finished — no status change was needed."})}else{const Be=await k$({id:e,action:W,channel:O});Be?.data?.runId&&(X(Be.data.runId,W),ge(!1)),await Ct({body:!1}),U({kind:"ok",message:`${Er[W]??W} dispatched on ${O}.`})}}catch(Be){Zt(Be,"Action failed")}finally{R(null)}},jt=W=>{if(!W)return"";try{const Be=new Date(W);return Number.isNaN(Be.getTime())?"":Be.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}},ae=W=>{if(!W)return"";try{const Be=new Date(W);if(Number.isNaN(Be.getTime()))return"";const M=Date.now()-Be.getTime(),z=Math.floor(M/864e5);return z===0?"today":z===1?"yesterday":z<30?`${z}d ago`:z<365?`${Math.floor(z/30)}mo ago`:`${Math.floor(z/365)}y ago`}catch{return""}},Ne=Array.isArray(A.tags)?A.tags:[],ze=jt(A.created_at),je=ae(A.created_at),vt=jt(A.updated_at),Qt=ae(A.updated_at),Le=W=>{window.location.assign(`/board/tasks/${W}`)},ft=Az[i.status]??[],Ke=W=>Nz[W]??"secondary",Dt=ft.filter(W=>Ke(W)==="primary"),nt=ft.filter(W=>Ke(W)==="secondary"),Qe=ft.filter(W=>Ke(W)==="hazard"),wt=!!s?.current,Kt=l.jsx("aside",{id:"feature-metadata-panel","data-testid":"feature-metadata-panel","aria-label":"Feature metadata","aria-hidden":!N,hidden:wt&&!N,className:`flex flex-col overflow-hidden bg-base-200 shadow-xl ${wt?"absolute top-0 bottom-0 left-[calc(100%_+_12px)] z-20 w-72 lg:w-80 rounded-lg border border-spur-border":`absolute inset-y-0 right-0 z-30 w-80 max-w-full border-l border-spur-border transition-transform duration-200 ${N?"translate-x-0":"translate-x-full"}`}`,children:N&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-spur-border bg-base-300/60 shrink-0",children:[l.jsxs("span",{className:"text-xs font-semibold text-spur-text flex items-center gap-1.5",children:[l.jsx("span",{children:"ℹ"})," Metadata"]}),l.jsx(Ge,{variant:"ghost",size:"xs",className:"text-spur-text-muted hover:text-spur-accent h-5 w-5 p-0 text-xs flex items-center justify-center",onClick:()=>T(!1),"aria-label":"Close metadata",title:"Close metadata",children:"✕"})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto p-3 space-y-3",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-xs text-spur-text-muted block mb-1.5",children:"Status"}),l.jsx("span",{className:"text-sm text-spur-text","data-testid":"metadata-status",children:i.status})]}),(ze||vt)&&l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("span",{className:"text-xs text-spur-text-muted block",children:"Dates"}),ze&&l.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[l.jsx("span",{className:"text-spur-text-muted w-14 shrink-0",children:"Created"}),l.jsx("span",{className:"text-spur-text",children:ze}),l.jsxs("span",{className:"text-spur-text-muted",children:["(",je,")"]})]}),vt&&l.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[l.jsx("span",{className:"text-spur-text-muted w-14 shrink-0",children:"Updated"}),l.jsx("span",{className:"text-spur-text",children:vt}),l.jsxs("span",{className:"text-spur-text-muted",children:["(",Qt,")"]})]})]}),Ne.length>0&&l.jsxs("div",{children:[l.jsx("span",{className:"text-xs text-spur-text-muted block mb-1.5",children:"Tags"}),l.jsx("div",{className:"flex flex-wrap gap-1",children:Ne.map(W=>l.jsx(Ot,{variant:"outline",size:"xs",className:"text-spur-text-muted",children:W},W))})]}),l.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[l.jsx("span",{className:"text-spur-text-muted w-14 shrink-0",children:"File"}),l.jsx("span",{className:"text-spur-text font-mono truncate",children:i.filePath})]}),r.length>0&&l.jsxs("div",{children:[l.jsxs("span",{className:"text-xs text-spur-text-muted block mb-1.5",children:["Child features (",r.length,")"]}),l.jsx("div",{className:"space-y-1",children:r.map(W=>l.jsxs("button",{type:"button",onClick:()=>a?.(W.id),className:"flex items-center gap-2 w-full text-xs text-left hover:underline cursor-pointer","aria-label":`Open child feature ${W.id}: ${W.name}`,children:[l.jsx("span",{className:"shrink-0 text-[13px]",title:W.status,children:l.jsx(gb,{status:W.status})}),l.jsx("span",{className:"font-mono text-spur-accent shrink-0",children:W.id}),l.jsx("span",{className:"text-spur-text truncate flex-1 min-w-0",children:W.name})]},W.id))})]}),l.jsxs("div",{children:[l.jsxs("span",{className:"text-xs text-spur-text-muted block mb-1.5",children:["Linked Tasks (",ie.length,")"]}),ie.length===0?l.jsx("span",{className:"text-xs text-spur-text-muted italic",children:"No linked tasks"}):l.jsx("div",{className:"space-y-1",children:ie.map(W=>l.jsxs("div",{className:"flex items-center gap-2 w-full text-xs",children:[l.jsx("span",{className:"shrink-0 text-[13px]",title:W.status,children:fb(W.status)}),l.jsxs("button",{type:"button",onClick:()=>Le(W.wbs),className:"flex items-center gap-2 flex-1 min-w-0 text-left hover:underline cursor-pointer","aria-label":`Go to task ${W.wbs}: ${W.name}`,children:[l.jsx("span",{className:"font-mono text-spur-accent shrink-0",children:W.wbs}),l.jsx("span",{className:"text-spur-text truncate",children:W.name})]}),l.jsx("span",{className:"px-1.5 py-0.5 rounded-full border border-spur-border text-[10px] text-spur-text-muted shrink-0",children:W.status})]},W.wbs))})]})]})]})});return l.jsxs("div",{className:"relative flex flex-col h-full",children:[l.jsxs("div",{className:"flex items-start justify-between gap-3 p-3 border-b border-spur-border shrink-0",children:[l.jsxs("div",{className:"flex flex-col gap-1 overflow-hidden",children:[l.jsxs("h3",{className:"text-sm font-semibold text-spur-text truncate",children:[i.id," — ",i.name]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-1","data-testid":"header-chips",children:[l.jsx("span",{className:"px-2 py-0.5 rounded-full border border-spur-border text-xs text-spur-text-muted","data-testid":"status-pill",children:i.status}),typeof i.frontmatter.priority=="string"&&l.jsx("span",{className:"px-2 py-0.5 rounded-full bg-spur-accent/15 text-xs text-spur-accent",children:i.frontmatter.priority}),Ne.map(W=>l.jsx("span",{className:"px-2 py-0.5 rounded-full border border-spur-border text-xs text-spur-text-muted",children:W},W))]})]}),l.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-1 shrink-0",children:[[["primary",Dt],["secondary",nt]].map(([W,Be])=>Be.map(M=>l.jsx(Ge,{variant:W==="primary"?"primary":"outline",size:"xs",onClick:()=>ue(M),disabled:v!==null,"aria-busy":v===M,"aria-label":Er[M],"data-action-tier":W,children:v===M?"…":Er[M]},M))),Qe.length>0&&l.jsx("div",{className:"flex items-center gap-1 border-l border-spur-border pl-1.5 ml-1.5",children:Qe.map(W=>l.jsx(Ge,{variant:"ghost",size:"xs",className:"text-spur-error",onClick:()=>ue(W),disabled:v!==null,"aria-busy":v===W,"aria-label":Er[W],"data-action-tier":"hazard",children:v===W?"…":Er[W]},W))}),f==="preview"?l.jsx(Ge,{variant:"ghost",size:"xs",className:"text-spur-text-muted hover:text-spur-accent",onClick:Z,disabled:b,"aria-label":"Edit body",children:"Edit"}):l.jsxs(l.Fragment,{children:[l.jsx(Ge,{variant:"primary",size:"xs",onClick:J,disabled:x,"aria-label":"Save body",children:x?"Saving…":"Save"}),l.jsx(Ge,{variant:"ghost",size:"xs",className:"text-spur-text-muted hover:text-spur-accent",onClick:oe,disabled:x,"aria-label":"Cancel edit",children:"Cancel"})]}),l.jsx(Ge,{variant:"ghost",size:"xs",className:"text-spur-text-muted",onClick:()=>T(W=>!W),"aria-expanded":N,"aria-controls":"feature-metadata-panel","data-testid":"metadata-toggle",children:"ℹ Metadata"}),t&&l.jsx(Ge,{variant:"ghost",size:"xs",className:"text-spur-text-muted",onClick:t,"aria-label":"Close detail",children:"✕"})]})]}),C&&l.jsx("div",{role:"status","data-testid":"action-feedback","data-kind":C.kind,className:`px-3 py-1.5 text-xs border-b border-spur-border shrink-0 ${C.kind==="error"?"bg-spur-error/10 text-spur-error":"bg-spur-success/10 text-spur-success"}`,children:C.message}),l.jsx("div",{className:"flex-1 flex flex-col overflow-hidden p-3","data-testid":"feature-body-section",children:b?l.jsxs("div",{className:"flex items-center gap-2 text-sm text-spur-text-muted",children:[l.jsx(Ra,{size:"xs",className:"text-spur-accent"}),"Loading body…"]}):f==="edit"?l.jsx("div",{className:"flex-1 min-h-0 w-full","data-testid":"body-editor",children:l.jsx(ol,{value:p,onChange:W=>d(W??""),height:"100%","data-color-mode":"light"})}):l.jsx("div",{className:"flex-1 overflow-y-auto w-full","data-testid":"body-preview",children:l.jsx(xz,{source:u})})}),k&&l.jsx("div",{role:"dialog","aria-modal":"true","aria-label":"Confirm cancel feature",tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:W=>{W.target===W.currentTarget&&j(!1)},onKeyDown:W=>{W.key==="Escape"&&j(!1)},children:l.jsxs("div",{className:"bg-spur-surface border border-spur-border rounded-lg shadow-xl p-4 mx-4 max-w-xs w-full",children:[l.jsxs("p",{className:"text-sm text-spur-text mb-4",children:["Cancel feature ",l.jsx("strong",{children:e}),"? This marks it as cancelled and cannot be undone from the board."]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(Ge,{variant:"ghost",size:"xs",onClick:()=>j(!1),children:"Keep"}),l.jsx(Ge,{variant:"error",size:"xs",onClick:ht,children:"Cancel feature"})]})]})}),G&&l.jsx("div",{role:"dialog","aria-modal":"true","aria-label":`Configure ${G} action`,tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:W=>{W.target===W.currentTarget&&$(null)},onKeyDown:W=>{W.key==="Escape"&&$(null)},children:l.jsxs("div",{className:"bg-spur-surface border border-spur-border rounded-lg shadow-xl p-4 mx-4 max-w-sm w-full",children:[G==="sync-status"?l.jsxs(l.Fragment,{children:[l.jsx("h4",{className:"text-sm font-semibold text-spur-text mb-3",children:"Sync Status — Direction"}),l.jsx("div",{className:"space-y-3",children:l.jsxs(Xr,{variant:"bordered",size:"sm",className:"w-full bg-spur-bg text-spur-text",value:pe,onChange:W=>L(W.target.value),children:[l.jsx("option",{value:"push",children:"Push (feature → tasks)"}),l.jsx("option",{value:"pull",children:"Pull (tasks → feature)"})]})})]}):l.jsxs(l.Fragment,{children:[l.jsxs("h4",{className:"text-sm font-semibold text-spur-text mb-3",children:[Er[G]," — Select Channel"]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(Xr,{variant:"bordered",size:"sm",className:"w-full bg-spur-bg text-spur-text",value:O,onChange:W=>ne(W.target.value),children:["claude","codex","gemini","pi","opencode","antigravity","openclaw"].map(W=>l.jsx("option",{value:W,children:W},W))}),l.jsxs("label",{htmlFor:"skip-deps",className:"flex items-center gap-2 cursor-pointer",children:[l.jsx(tb,{id:"skip-deps",size:"xs",checked:!1,onChange:()=>{}}),l.jsx("span",{className:"text-xs text-spur-text",children:"Skip dependencies"})]})]})]}),l.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[l.jsx(Ge,{variant:"ghost",size:"xs",onClick:()=>$(null),children:"Cancel"}),l.jsx(Ge,{variant:"primary",size:"xs",onClick:kt,children:v===G?"Dispatching…":"Dispatch"})]})]})}),te&&l.jsx("div",{role:"dialog","aria-modal":"true","aria-label":`${Er[te]} input`,tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:W=>{W.target===W.currentTarget&&H(null)},onKeyDown:W=>{W.key==="Escape"&&H(null)},children:l.jsxs("div",{className:"bg-spur-surface border border-spur-border rounded-lg shadow-xl p-4 mx-4 max-w-sm w-full",children:[l.jsx("h4",{className:"text-sm font-semibold text-spur-text mb-3",children:Er[te]}),te==="link-task"?l.jsxs(Xr,{variant:"bordered",size:"sm",className:"w-full bg-spur-bg text-spur-text",value:se,onChange:W=>de(W.target.value),children:[l.jsx("option",{value:"",children:"— Select a task —"}),(ve??[]).filter(W=>W.featureId!==e).map(W=>l.jsxs("option",{value:W.wbs,children:[W.wbs," — ",W.name]},W.wbs))]}):l.jsx("input",{type:"text",className:"w-full px-3 py-2 rounded border border-spur-border bg-spur-bg text-sm text-spur-text focus:outline-none focus:border-spur-accent",placeholder:"Enter child feature name",value:se,onChange:W=>de(W.target.value),onKeyDown:W=>{W.key==="Enter"&&se.trim()&&Rt()}}),l.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[l.jsx(Ge,{variant:"ghost",size:"xs",onClick:()=>H(null),children:"Cancel"}),l.jsx(Ge,{variant:"primary",size:"xs",onClick:Rt,disabled:!se.trim()||v===te,children:v===te?"…":"Create"})]})]})}),l.jsx(Hv,{open:ke,onClose:()=>Re(!1),onCreated:De,folder:["docs","tasks2"].join("/"),featureId:e}),l.jsx(Vv,{open:Q,parentId:e,onClose:()=>_e(!1),onCreated:et}),l.jsx(wz,{progress:fe,isDismissed:Ve,onDismiss:()=>ge(!0),onReopen:()=>ge(!1)}),s?.current?da.createPortal(Kt,s.current):Kt]})}function Fz(e){const t=e.match(/^---\n[\s\S]*?\n---\n/);return t?e.slice(t[0].length):e}function Kv(e,t){return e.id.localeCompare(t.id)}function Mz({features:e,selectedId:t,onSelect:n}){const[r,a]=g.useState(()=>new Set),s=g.useCallback(u=>{a(c=>{const p=new Set(c);return p.has(u)?p.delete(u):p.add(u),p})},[]),i=e.filter(u=>u.id.length===1).slice().sort(Kv),o=Xv(e);return l.jsx("ul",{className:"py-1","data-feature-tree":!0,children:i.map(u=>l.jsx(Qv,{feature:u,childrenMap:o,selectedId:t,onSelect:n,collapsedIds:r,onToggleFold:s,depth:0},u.id))})}function Xv(e){const t=new Map;for(const n of e){if(n.id.length<=1)continue;const r=n.id.slice(0,-1),a=t.get(r);a?a.push(n):t.set(r,[n])}for(const n of t.values())n.sort(Kv);return t}function Qv({feature:e,childrenMap:t,selectedId:n,onSelect:r,collapsedIds:a,onToggleFold:s,depth:i}){const o=t.get(e.id),u=o!==void 0&&o.length>0,c=a.has(e.id),p=e.id===n,d=`${i*16}px`;return l.jsxs("li",{children:[l.jsxs("div",{className:`w-full flex items-center transition-colors hover:bg-base-300 ${p?"bg-spur-accent/10 text-spur-accent font-semibold":"text-spur-text"}`,style:{paddingLeft:`calc(0.25rem + ${d})`},children:[u?l.jsx("button",{type:"button",onClick:f=>{f.stopPropagation(),s(e.id)},"aria-expanded":!c,"aria-controls":`feature-tree-children-${e.id}`,"aria-label":`${c?"Expand":"Collapse"} ${e.id}: ${e.name}`,className:"p-1 hover:bg-base-100 rounded text-spur-text-muted hover:text-spur-text text-[10px] flex items-center justify-center shrink-0 w-5 h-5 cursor-pointer",children:l.jsx("span",{className:`inline-block transition-transform duration-150 ${c?"":"rotate-90"}`,"aria-hidden":"true",children:"▶"})}):l.jsx("span",{className:"w-5 shrink-0","aria-hidden":"true"}),l.jsxs("button",{type:"button",onClick:()=>r(e.id),className:`flex-1 flex items-center gap-1.5 px-1.5 py-1 text-left text-sm truncate min-w-0 cursor-pointer ${p?"bg-spur-accent/10 text-spur-accent font-semibold":"text-spur-text"}`,children:[l.jsx(J5,{position:"right",tip:Yv(e.status),className:"flex! w-4 shrink-0 items-center justify-center","data-testid":"feature-tree-status",children:l.jsx(gb,{status:e.status})}),l.jsx("span",{className:"text-xs font-mono text-spur-text-muted shrink-0",children:e.id}),l.jsx("span",{className:"flex-1 truncate",children:e.name})]})]}),u&&!c&&l.jsx("ul",{id:`feature-tree-children-${e.id}`,children:o.map(f=>l.jsx(Qv,{feature:f,childrenMap:t,selectedId:n,onSelect:r,collapsedIds:a,onToggleFold:s,depth:i+1},f.id))})]})}function Pz(){const[e,t]=g.useState(!1),[n,r]=g.useState(""),[a,s]=g.useState(null),i=()=>{r(""),s("Agent dispatch is not wired yet — this bar is UI only (F84 R6).")};return e?l.jsxs("div",{className:"fixed bottom-4 left-1/2 -translate-x-1/2 z-30 w-[calc(100vw-2rem)] max-w-[84rem] backdrop-blur-md bg-base-100/80 border border-spur-border shadow-2xl rounded-2xl p-2.5 flex flex-col gap-2","data-testid":"agent-bar",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Ot,{variant:"outline",size:"sm",className:"shrink-0 font-mono",children:"agent · stub"}),l.jsx(X5,{rows:1,value:n,onChange:o=>r(o.target.value),placeholder:"Ask a coding agent to refine or implement this feature…","aria-label":"Agent prompt",className:"flex-1 min-h-9 resize-none bg-transparent","data-testid":"agent-bar-input"}),l.jsx(Ge,{variant:"primary",size:"sm",disabled:n.trim().length===0,onClick:i,children:"Send"}),l.jsx(Ge,{variant:"ghost",size:"sm",onClick:()=>t(!1),"aria-label":"Collapse agent prompt bar","aria-expanded":!0,children:"▾"})]}),a&&l.jsx("p",{role:"status",className:"px-1 text-xs text-spur-text-muted",children:a})]}):l.jsx(Ge,{variant:"ghost",className:"fixed bottom-6 right-6 z-30 h-12 w-12 rounded-full backdrop-blur-md bg-base-100/80 border border-spur-border shadow-2xl text-xl",onClick:()=>t(!0),"aria-label":"Open agent prompt bar","aria-expanded":!1,"data-testid":"agent-bar-dock",children:"✨"})}const jz=()=>`${Nt()}/events/planning`;function Bz({className:e="w-3.5 h-3.5"}){return l.jsx("svg",{className:`inline-block shrink-0 ${e}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("polygon",{points:"1.5 2.5 14.5 2.5 9.5 8.5 9.5 13.5 6.5 13.5 6.5 8.5 1.5 2.5"})})}function Uz(){const[e,t]=g.useState(null),[n,r]=g.useState(null),[a,s]=g.useState(!1),[i,o]=g.useState("all"),[u,c]=g.useState(!0),[p,d]=g.useState(!1),[f,m]=g.useState(null),[b,E]=g.useState(0),x=g.useRef(null),y=g.useRef(null),S=g.useMemo(()=>Xv(e??[]),[e]),w=g.useCallback(async v=>{try{const R=await N$(v);t(R),m(null)}catch(R){if(v?.aborted)return;m(R instanceof Error?R.message:String(R))}},[]);if(g.useEffect(()=>{const v=new AbortController;return w(v.signal),()=>v.abort()},[w]),g.useEffect(()=>{if(!p)return;const v=C=>{x.current&&!x.current.contains(C.target)&&d(!1)},R=C=>{C.key==="Escape"&&d(!1)};return document.addEventListener("mousedown",v),document.addEventListener("keydown",R),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",R)}},[p]),g.useEffect(()=>{if(typeof EventSource>"u")return;const v=new EventSource(jz());return v.onmessage=R=>{try{const U=JSON.parse(R.data).eventName;if(!Zv(U))return;w(),n&&(U==="feature.updated"||U==="feature.transitioned"||U==="queue.job.completed")&&E(k=>k+1)}catch{}},()=>v.close()},[w,n]),f)return l.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load features: ",f]});if(e===null)return l.jsx("div",{className:"flex items-center justify-center h-full text-spur-text-muted text-sm",children:"Loading features…"});const A=()=>{s(!1),w()},N=(v=>{if(i==="all")return v;const R=i.toLowerCase(),C=new Set;for(const U of v)if(U.status.toLowerCase()===R){C.add(U.id);let k=U.id;for(;k.length>1;)k=k.slice(0,-1),C.add(k)}return v.filter(U=>C.has(U.id))})(e),T=n?S.get(n)??[]:[];return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"relative h-full w-full p-4 overflow-hidden","data-features-shell":!0,children:l.jsxs("div",{className:"flex flex-col h-full w-full max-w-[1600px] mx-auto gap-3","data-features-workspace":!0,children:[l.jsxs("header",{className:"flex flex-wrap items-center justify-between gap-4 border-b border-spur-border pb-3 shrink-0",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("span",{className:"text-2xl","aria-hidden":"true",children:"🎯"}),l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl font-bold tracking-tight text-spur-text",children:"Features"}),l.jsx("p",{className:"text-xs text-spur-text-muted",children:"Hierarchical feature roadmap, acceptance criteria, and lifecycle progression"})]})]}),l.jsxs("div",{className:"flex items-center gap-1","data-features-actions":!0,children:[l.jsx(Ge,{variant:"ghost",size:"xs",className:"text-spur-text-muted hover:text-spur-accent",onClick:()=>c(v=>!v),"aria-label":u?"Collapse feature tree":"Expand feature tree","aria-expanded":u,"aria-controls":"feature-tree-dock",title:u?"Collapse feature tree":"Expand feature tree",children:u?"◧":"▶"}),l.jsxs("div",{className:"relative",ref:x,children:[l.jsxs(Ge,{variant:"ghost",size:"xs",className:`relative text-spur-text-muted hover:text-spur-accent flex items-center gap-1 ${i!=="all"?"text-spur-accent font-semibold":""}`,onClick:()=>d(v=>!v),"aria-label":"Filter features by status","aria-expanded":p,title:"Filter features by status",children:[l.jsx(Bz,{className:"w-3.5 h-3.5"}),i!=="all"&&l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-spur-accent shrink-0","aria-hidden":"true"})]}),p&&l.jsxs("div",{className:"absolute right-0 top-full mt-1 z-20 w-44 rounded-md shadow-lg bg-base-100 border border-spur-border py-1 text-xs","data-filter-menu":!0,children:[l.jsxs("div",{className:"px-2.5 py-1 font-semibold text-spur-text-muted border-b border-spur-border flex items-center justify-between",children:[l.jsx("span",{children:"Filter by Status"}),i!=="all"&&l.jsx("button",{type:"button",onClick:()=>{o("all"),d(!1)},className:"text-[10px] text-spur-accent hover:underline",children:"Reset"})]}),l.jsxs("button",{type:"button",onClick:()=>{o("all"),d(!1)},className:`w-full text-left px-3 py-1.5 flex items-center gap-2 hover:bg-base-200 ${i==="all"?"font-semibold text-spur-accent bg-spur-accent/10":"text-spur-text"}`,children:[l.jsx("span",{className:"flex-1",children:"All"}),i==="all"&&l.jsx("span",{children:"✓"})]}),vs.map(v=>l.jsxs("button",{type:"button",onClick:()=>{o(v),d(!1)},className:`w-full text-left px-3 py-1.5 flex items-center gap-2 hover:bg-base-200 capitalize ${i===v?"font-semibold text-spur-accent bg-spur-accent/10":"text-spur-text"}`,children:[l.jsx(gb,{status:v}),l.jsx("span",{className:"flex-1 capitalize",children:v}),i===v&&l.jsx("span",{children:"✓"})]},v))]})]}),l.jsx(Ge,{variant:"ghost",size:"xs",className:"text-spur-text-muted hover:text-spur-accent",onClick:()=>s(!0),"aria-label":"Add root feature",title:"Add root feature",children:"+"})]})]}),l.jsxs("div",{className:"relative flex-1 min-h-0",ref:y,children:[l.jsxs("div",{id:"feature-tree-dock",hidden:!u,className:"absolute right-[calc(100%_+_12px)] top-0 bottom-0 z-20 w-72 lg:w-80 flex flex-col overflow-hidden rounded-lg border border-spur-border bg-base-200 shadow-xl",children:[l.jsx("div",{className:"flex items-center justify-between px-3 py-2 border-b border-spur-border bg-base-300/60 shrink-0",children:l.jsxs("span",{className:"text-xs font-semibold text-spur-text flex items-center gap-1.5",children:[l.jsx("span",{children:"🌳"})," Feature Tree"]})}),l.jsx("div",{className:"flex-1 overflow-y-auto p-1",children:e.length===0?l.jsx("div",{className:"p-3 text-xs text-spur-text-muted italic",children:"No features found."}):N.length===0?l.jsxs("div",{className:"p-3 text-xs text-spur-text-muted italic",children:['No features match status filter "',i,'".']}):l.jsx(Mz,{features:N,selectedId:n,onSelect:r})})]}),l.jsx("div",{className:"w-full h-full overflow-hidden rounded-lg border border-spur-border bg-base-100 relative","data-testid":"detail-workspace",children:l.jsx("div",{className:"w-full h-full overflow-y-auto",children:n?l.jsx(Lz,{featureId:n,refreshKey:b,onClose:()=>r(null),childFeatures:T,onSelectFeature:r,metadataDockRef:y}):l.jsx("div",{className:"flex items-center justify-center h-full text-sm text-spur-text-muted italic",children:"Select a feature to view details"})})})]})]})}),l.jsx(Vv,{open:a,parentId:"",onClose:()=>s(!1),onCreated:A}),l.jsx(Pz,{})]})}const $z={id:"features",name:"Feature Board",icon:"🏷️",route:"features",component:Uz,sidebarLabel:"Features"},zz=Object.freeze(Object.defineProperty({__proto__:null,module:$z},Symbol.toStringTag,{value:"Module"})),ls=({id:e})=>{const t={width:16,height:16,viewBox:"0 0 24 24",role:"img","aria-label":`${e} icon`};switch(e){case"claude":return l.jsxs("svg",{...t,fill:"none",stroke:"currentColor",strokeWidth:"2.3",strokeLinecap:"round",children:[l.jsx("title",{children:"Claude Code icon"}),l.jsx("path",{d:"M12 2.5v19M2.5 12h19M5.3 5.3l13.4 13.4M5.3 18.7l13.4-13.4"})]});case"codex":return l.jsxs("svg",{...t,fill:"currentColor",children:[l.jsx("title",{children:"Codex icon"}),l.jsx("path",{d:"M21.5 9.8a5.5 5.5 0 0 0-.5-4.2 5.6 5.6 0 0 0-4.6-2.8 5.6 5.6 0 0 0-4.2 1.4A5.5 5.5 0 0 0 7.8 3a5.6 5.6 0 0 0-4.5 3.3 5.5 5.5 0 0 0 .7 4.2 5.5 5.5 0 0 0-.7 4.2 5.6 5.6 0 0 0 4.5 3.3c.3.7.8 1.3 1.4 1.8a5.6 5.6 0 0 0 6.8-.4 5.5 5.5 0 0 0 4.4-1.4 5.6 5.6 0 0 0 1.4-4.2 5.5 5.5 0 0 0-.5-4.2zm-8.5 11.2a3.7 3.7 0 0 1-2.4-.9l2.7-1.6a1 1 0 0 0 .5-.9v-3.7l3.1 1.8v3.6a3.7 3.7 0 0 1-3.9 1.7zm-7.6-3.8a3.7 3.7 0 0 1-.4-2.5l2.7 1.6a1 1 0 0 0 1 0l3.2-1.8v3.6L6.8 20a3.7 3.7 0 0 1-1.4-2.8zm-1.3-8.3a3.7 3.7 0 0 1 2-1.6v3.2a1 1 0 0 0 .5.9l3.2 1.8-3.1 1.8-3.1-1.8a3.7 3.7 0 0 1 .5-4.3zm12.6 1.8l-3.2-1.8 3.1-1.8 3.1 1.8a3.7 3.7 0 0 1-.5 4.3 3.7 3.7 0 0 1-2 1.6v-3.2a1 1 0 0 0-.5-.9zm2.2 4.5l-2.7-1.6a1 1 0 0 0-1 0l-3.2 1.8V11.8l3.1-1.8 3.1 1.8a3.7 3.7 0 0 1 .7 4.4zm-7-1.3l-2.7-1.6 2.7-1.6 2.7 1.6-2.7 1.6z"})]});case"agy":return l.jsxs("svg",{...t,fill:"currentColor",children:[l.jsx("title",{children:"Antigravity CLI icon"}),l.jsx("path",{d:"M12 1.5C12 7.3 7.3 12 1.5 12c5.8 0 10.5 4.7 10.5 10.5 0-5.8 4.7-10.5 10.5-10.5-5.8 0-10.5-4.7-10.5-10.5z"})]});case"omp":return l.jsxs("svg",{...t,fill:"none",stroke:"currentColor",strokeWidth:"2.3",strokeLinecap:"round",children:[l.jsx("title",{children:"OMP icon"}),l.jsx("circle",{cx:"12",cy:"12",r:"9"}),l.jsx("path",{d:"M10 8.5l5 3.5-5 3.5z"})]});case"openclaw":return l.jsxs("svg",{...t,fill:"none",stroke:"currentColor",strokeWidth:"2.3",strokeLinecap:"round",children:[l.jsx("title",{children:"OpenClaw icon"}),l.jsx("path",{d:"M12 2C6.5 2 2 6.5 2 12c0 3.8 2.1 7.1 5.2 8.8L6 22l3.8-1.2C10.5 21.5 11.2 22 12 22c5.5 0 10-4.5 10-10S17.5 2 12 2zM8 11.5a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0zm5 0a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0z"})]});case"hermes":return l.jsxs("svg",{...t,fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",children:[l.jsx("title",{children:"Hermes icon"}),l.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})]});case"grok":return l.jsxs("svg",{...t,fill:"currentColor",children:[l.jsx("title",{children:"Grok Build icon"}),l.jsx("path",{d:"M18.2 3H21l-6.5 7.4L22 21h-5.8l-4.5-5.9L6.5 21H3.6l6.9-7.9L3 3h5.9l4.1 5.4L18.2 3zm-1 16.3h1.5L8.7 4.6H7.1l10.1 14.7z"})]});case"opencode":return l.jsxs("svg",{...t,fill:"none",stroke:"currentColor",strokeWidth:"2.3",strokeLinecap:"round",children:[l.jsx("title",{children:"OpenCode icon"}),l.jsx("polyline",{points:"16 18 22 12 16 6"}),l.jsx("polyline",{points:"8 6 2 12 8 18"})]});case"pi":return l.jsxs("svg",{...t,fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",children:[l.jsx("title",{children:"Pi icon"}),l.jsx("path",{d:"M4 6h16M9 6v13M15 6v11a2 2 0 0 0 2 2"})]});default:return null}},Hz=new Set(["claude","codex","agy","omp","openclaw","hermes","grok","opencode","pi"]),Gz=(e,t)=>e.includes(t)?e.filter(n=>n!==t):[...e,t],_o=({label:e,unconstrainedLabel:t,options:n,selected:r,onChange:a,open:s,onOpenChange:i,showIcon:o=!1})=>{const u=g.useRef(null),[c,p]=g.useState("");g.useEffect(()=>{if(!s)return;const x=y=>{u.current&&!u.current.contains(y.target)&&i(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[s,i]);const d=c.trim().toLowerCase(),f=d?n.filter(x=>x.label.toLowerCase().includes(d)||x.id.toLowerCase().includes(d)):n,m=x=>a(x.length>0?x:void 0),b=x=>{if(x.key==="Escape"){x.stopPropagation(),i(!1);return}if(x.key!=="ArrowDown"&&x.key!=="ArrowUp")return;x.preventDefault();const y=Array.from(u.current?.querySelectorAll('input[type="checkbox"]')??[]);if(y.length===0)return;const S=y.indexOf(document.activeElement);(x.key==="ArrowDown"?y[(S+1+y.length)%y.length]:y[(S-1+y.length)%y.length])?.focus()},E=r.length===0?t:`${r.length} selected`;return l.jsxs("div",{ref:u,className:"relative",children:[l.jsxs("button",{type:"button","aria-haspopup":"dialog","aria-expanded":s,className:"px-2.5 py-1 text-xs rounded border border-base-content/20 hover:bg-base-content/10 font-medium text-base-content",onClick:()=>i(!s),children:[e,": ",E]}),s&&l.jsxs("div",{role:"dialog","aria-label":`Filter by ${e}`,onKeyDown:b,className:"absolute left-0 mt-1 z-20 p-2 shadow-lg bg-base-300 rounded-lg border border-base-content/10 w-60 text-xs flex flex-col gap-1.5",children:[l.jsx("input",{type:"search","aria-label":`Search ${e}`,value:c,onChange:x=>p(x.target.value),placeholder:"Search…",className:"px-2 py-1 rounded border border-base-content/20 bg-base-100 text-base-content focus:outline-none focus:border-primary"}),l.jsxs("div",{className:"flex items-center justify-between gap-2 text-[10px]",children:[l.jsx("button",{type:"button",className:"text-primary hover:underline cursor-pointer",onClick:()=>m(f.map(x=>x.id)),children:"Select all"}),l.jsx("button",{type:"button",className:"text-error/80 hover:text-error underline cursor-pointer",onClick:()=>a(void 0),children:"Clear all"})]}),l.jsxs("div",{className:"flex flex-col gap-0.5 max-h-56 overflow-y-auto",children:[f.map(x=>l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer py-1 px-1.5 hover:bg-base-200 rounded",children:[o&&l.jsx("span",{className:"w-3.5 inline-flex items-center justify-center shrink-0",children:Hz.has(x.id)?l.jsx(ls,{id:x.id}):l.jsx("span",{className:"w-2.5 h-2.5 rounded-full",style:{backgroundColor:x.color??"#5e6ad2"}})}),l.jsx("span",{className:"font-mono text-[11px] flex-1 truncate",children:x.label}),l.jsx("input",{type:"checkbox",className:"h-3.5 w-3.5 rounded border-base-content/30 text-primary",checked:r.includes(x.id),onChange:()=>m(Gz(r,x.id))})]},x.id)),f.length===0&&l.jsx("span",{className:"text-base-content/50 px-1.5 py-1",children:"No matches"})]})]})]})},Wz=({filter:e,onChange:t,sourceOptions:n=[],modelOptions:r=[],toolOptions:a=[],skillOptions:s=[],scope:i})=>{const[o,u]=g.useState(null),c=f=>{t({...e,range:f})},p=(f,m)=>{const E=(e[f]||[]).filter(x=>x!==m);t({...e,[f]:E.length>0?E:void 0})},d=(f,m)=>{t({...e,[f]:m})};return l.jsxs("div",{className:"flex flex-col gap-2.5 p-3.5 bg-base-200/50 rounded-xl border border-base-content/10 mb-4",children:[l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[l.jsxs("div",{className:"flex items-center gap-1.5 bg-base-300 p-1 rounded-lg",children:[["24h","7d","30d","all"].map(f=>l.jsx("button",{type:"button",className:`px-2.5 py-1 text-xs rounded font-medium transition-colors ${e.range===f?"bg-primary text-primary-content font-bold":"text-base-content/70 hover:bg-base-content/10"}`,onClick:()=>c(f),children:f.toUpperCase()},f)),l.jsx("button",{type:"button",className:`px-2.5 py-1 text-xs rounded font-medium transition-colors ${e.range==="custom"?"bg-primary text-primary-content font-bold":"text-base-content/70 hover:bg-base-content/10"}`,onClick:()=>c("custom"),children:"Custom"})]}),i&&l.jsxs("div",{className:"flex items-center gap-2 text-xs text-base-content/70 font-mono","data-testid":"history-filter-scope",children:[l.jsx("span",{children:i.rangeLabel}),l.jsx("span",{"aria-hidden":"true",children:"·"}),l.jsx("span",{children:i.sessionCount===void 0?"… sessions":i.sessionCount===null?"— sessions":`${i.sessionCount} sessions`}),i.sourceCount!==void 0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{"aria-hidden":"true",children:"·"}),l.jsx("span",{children:e.sources?.length?`${e.sources.length} sources selected`:`${i.sourceCount} sources available`})]})]})]}),e.range==="custom"&&l.jsxs("div",{className:"flex items-center gap-3 pt-1",children:[l.jsxs("label",{className:"text-xs text-base-content/70 flex items-center gap-1",children:["From:",l.jsx("input",{type:"datetime-local",className:"px-2 py-1 text-xs rounded border border-base-content/20 bg-base-300 text-base-content",value:e.from?e.from.slice(0,16):"",onChange:f=>t({...e,from:f.target.value?new Date(f.target.value).toISOString():void 0})})]}),l.jsxs("label",{className:"text-xs text-base-content/70 flex items-center gap-1",children:["To:",l.jsx("input",{type:"datetime-local",className:"px-2 py-1 text-xs rounded border border-base-content/20 bg-base-300 text-base-content",value:e.to?e.to.slice(0,16):"",onChange:f=>t({...e,to:f.target.value?new Date(f.target.value).toISOString():void 0})})]})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1 border-t border-base-content/10",children:[l.jsx(_o,{label:"Agents",unconstrainedLabel:"All",options:n,selected:e.sources??[],onChange:f=>d("sources",f),open:o==="sources",onOpenChange:f=>u(f?"sources":null),showIcon:!0}),l.jsx(_o,{label:"Models",unconstrainedLabel:"Any",options:r,selected:e.models??[],onChange:f=>d("models",f),open:o==="models",onOpenChange:f=>u(f?"models":null)}),l.jsx(_o,{label:"Tools",unconstrainedLabel:"Any",options:a,selected:e.tools??[],onChange:f=>d("tools",f),open:o==="tools",onOpenChange:f=>u(f?"tools":null)}),l.jsx(_o,{label:"Skills",unconstrainedLabel:"Any",options:s,selected:e.skills??[],onChange:f=>d("skills",f),open:o==="skills",onOpenChange:f=>u(f?"skills":null)}),l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 ml-auto",children:[e.sources?.map(f=>l.jsxs("div",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-base-300 border border-base-content/10 text-base-content gap-1",children:[l.jsx("span",{className:"capitalize",children:f}),l.jsx("button",{type:"button",onClick:()=>p("sources",f),className:"hover:text-error",children:"×"})]},f)),e.models?.map(f=>l.jsxs("div",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-base-300 border border-base-content/10 text-base-content font-mono text-[10px] gap-1",children:[l.jsx("span",{children:f}),l.jsx("button",{type:"button",onClick:()=>p("models",f),className:"hover:text-error",children:"×"})]},f)),e.tools?.map(f=>l.jsxs("div",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-base-300 border border-base-content/10 text-base-content font-mono text-[10px] gap-1",children:[l.jsx("span",{children:f}),l.jsx("button",{type:"button",onClick:()=>p("tools",f),className:"hover:text-error",children:"×"})]},f)),e.skills?.map(f=>l.jsxs("div",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-base-300 border border-base-content/10 text-base-content font-mono text-[10px] gap-1",children:[l.jsx("span",{children:f}),l.jsx("button",{type:"button",onClick:()=>p("skills",f),className:"hover:text-error",children:"×"})]},f)),((e.sources?.length??0)>0||(e.models?.length??0)>0||(e.tools?.length??0)>0||(e.skills?.length??0)>0)&&l.jsx("button",{type:"button",className:"text-xs text-error/80 hover:text-error underline ml-1 cursor-pointer",onClick:()=>t({range:e.range,bucket:e.bucket}),children:"Clear all"})]})]})]})};function Ye(e){if(!Number.isFinite(e)||e===0)return"0";const t=Math.abs(e);return t>=1e6?`${(e/1e6).toFixed(1)}M`:t>=1e3?`${(e/1e3).toFixed(1)}K`:Math.round(e).toLocaleString()}function Jv(e){return e===0?"0":Math.abs(e)>=1e6?`${Math.round(e/1e6)}M`:Math.abs(e)>=1e3?`${Math.round(e/1e3)}K`:Math.round(e).toString()}function mn(e){return Math.round(e).toLocaleString()}function Kr(e,t=1){return`${e.toFixed(t)}%`}function ew(e){if(e<1)return"<1m";if(e<60)return`${Math.round(e)}m`;const t=Math.floor(e/60);return`${t}h ${Math.round(e-t*60)}m`}function yd(e){return e<1e3?`${Math.round(e)}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m ${Math.round(e%6e4/1e3)}s`}function Td(e,t=4){if(e<=0)return[0,1];const n=e/t,r=10**Math.floor(Math.log10(n)),a=n/r,s=(a<=1?1:a<=2?2:a<=2.5?2.5:a<=5?5:10)*r,i=[];for(let u=0;u<=e*1.0001+s/2;u+=s)i.push(u);const o=i[i.length-1];return o!==void 0&&o<e&&i.push(o+s),i}const Vz=({buckets:e,series:t,lineColor:n="#22d3ee",height:r=260})=>{const a=g.useRef(null),[s,i]=g.useState(1e3),[o,u]=g.useState(null);g.useEffect(()=>{if(!a.current)return;const $=a.current;(()=>{const se=$.clientWidth;se>0&&i(se)})();const H=new ResizeObserver(se=>{for(const de of se){const O=Math.round(de.contentRect.width);O>0&&i(O)}});return H.observe($),()=>H.disconnect()},[]);const c=s,p=54,d=50,f=16,m=26,b=Math.max(60,c-p-d),E=r-f-m,x=e.map($=>t.reduce((te,H)=>te+($.v[H.id]||0),0)),y=Math.max(1,...x),S=Td(y,4),w=S[S.length-1]||y,A=$=>f+E-$/w*E,D=$=>f+E-Math.max(0,Math.min(100,$))/100*E,N=b/Math.max(1,e.length),T=Math.max(2,N*.85),v=$=>p+$*N+N/2,R=Math.max(2,Math.floor(b/70)),C=Math.max(1,Math.ceil(e.length/R)),U=e.map(($,te)=>$.lineValue!==void 0?{x:v(te),y:D($.lineValue)}:null).filter($=>$!==null),k=U.length>1?U.map(($,te)=>`${te===0?"M":"L"}${$.x.toFixed(1)},${$.y.toFixed(1)}`).join(" "):"",j=$=>{const te=$.currentTarget.getBoundingClientRect();if(te.width<=0)return;const se=($.clientX-te.left)/te.width*c-p;if(se>=0&&se<=b){const de=Math.floor(se/N);if(de>=0&&de<e.length){u(de);return}}u(null)},G=o!==null?Math.max(110,Math.min(c-110,v(o))):c/2;return l.jsxs("div",{ref:a,className:"relative w-full overflow-hidden",children:[l.jsxs("svg",{viewBox:`0 0 ${c} ${r}`,width:"100%",height:r,className:"w-full block select-none",role:"img","aria-label":"Stacked column token chart with cache hit ratio overlay",onMouseMove:j,onMouseLeave:()=>u(null),children:[S.map($=>l.jsxs("g",{children:[l.jsx("line",{x1:p,x2:p+b,y1:A($),y2:A($),stroke:"currentColor",strokeOpacity:.1}),l.jsx("text",{x:p-8,y:A($)+3.5,textAnchor:"end",className:"text-[10px] fill-base-content/60",children:Jv($)})]},$)),[0,25,50,75,100].map($=>l.jsxs("text",{x:p+b+8,y:D($)+3.5,textAnchor:"start",fill:n,className:"text-[10px] opacity-80",children:[$,"%"]},$)),o!==null&&l.jsx("rect",{x:p+o*N,y:f,width:N,height:E,fill:"currentColor",fillOpacity:.04,rx:2}),e.map(($,te)=>{const H=p+te*N+(N-T)/2;let se=0;return l.jsxs("g",{opacity:o===null||o===te?1:.45,children:[t.slice().reverse().map(de=>{const O=$.v[de.id]||0;if(O<=0)return null;const ne=A(se+O),pe=A(se)-ne,L=Math.max(1,pe);return se+=O,l.jsx("rect",{x:H,y:ne,width:T,height:L,fill:de.color,rx:1},de.id)}),te%C===0&&l.jsx("text",{x:v(te),y:r-6,textAnchor:"middle",className:"text-[10px] fill-base-content/60",children:$.label})]},$.id??`${$.label}-${te}`)}),k&&l.jsxs(l.Fragment,{children:[l.jsx("path",{d:k,fill:"none",stroke:"currentColor",strokeWidth:4,strokeOpacity:.2,strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:k,fill:"none",stroke:n,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})]}),o!==null&&e[o]?.lineValue!==void 0&&l.jsx("circle",{cx:v(o),cy:D(e[o]?.lineValue??0),r:4.5,fill:n,stroke:"#1f2937",strokeWidth:2})]}),o!==null&&e[o]&&l.jsxs("div",{className:"absolute top-2 bg-base-300 border border-base-content/15 shadow-xl rounded-lg px-3 py-2 text-xs pointer-events-none z-20 flex flex-col gap-1 min-w-[180px] backdrop-blur-sm",style:{left:`${G}px`,transform:"translateX(-50%)"},children:[l.jsx("div",{className:"font-semibold text-base-content/90 border-b border-base-content/10 pb-1",children:e[o]?.label}),t.filter($=>(e[o]?.v[$.id]??0)>0).map($=>l.jsxs("div",{className:"flex justify-between items-center gap-2",children:[l.jsxs("span",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:$.color}}),$.label]}),l.jsx("span",{className:"font-mono",children:Ye(e[o]?.v[$.id]??0)})]},$.id)),l.jsxs("div",{className:"flex justify-between items-center font-bold pt-1 border-t border-base-content/10",children:[l.jsx("span",{children:"Total"}),l.jsx("span",{className:"font-mono",children:Ye(x[o]??0)})]}),e[o]?.lineValue!==void 0&&l.jsxs("div",{className:"flex justify-between items-center text-cyan-400",children:[l.jsx("span",{children:"Cache Hit Ratio"}),l.jsxs("span",{className:"font-mono",children:[e[o]?.lineValue,"%"]})]})]})]})},qz=({buckets:e,series:t,height:n=200})=>{const r=g.useRef(null),[a,s]=g.useState(540);g.useEffect(()=>{if(!r.current)return;const A=r.current;(()=>{const T=A.clientWidth;T>0&&s(T)})();const N=new ResizeObserver(T=>{for(const v of T){const R=Math.round(v.contentRect.width);R>0&&s(R)}});return N.observe(A),()=>N.disconnect()},[]);const i=a,o=46,u=12,c=10,p=24,d=Math.max(60,i-o-u),f=n-c-p,m=e.length,b=e.map(A=>t.reduce((D,N)=>D+(A.v[N.id]||0),0)),E=Td(Math.max(1,...b),3).pop()||1,x=A=>o+(m<=1?d/2:A/(m-1)*d),y=A=>c+f-A/E*f,S=new Array(m).fill(0),w=t.map(A=>{const D=S.slice(),N=S.map((v,R)=>v+(e[R]?.v[A.id]||0));let T=`M${x(0)},${y(N[0]||0)}`;for(let v=1;v<m;v++)T+=`L${x(v)},${y(N[v]||0)}`;for(let v=m-1;v>=0;v--)T+=`L${x(v)},${y(D[v]||0)}`;T+="Z";for(let v=0;v<m;v++)S[v]=N[v]||0;return{id:A.id,color:A.color,d:T}});return l.jsx("div",{ref:r,className:"w-full overflow-hidden",children:l.jsxs("svg",{viewBox:`0 0 ${i} ${n}`,width:"100%",height:n,className:"w-full block select-none",role:"img","aria-label":"Stacked area chart",children:[Td(E,3).map(A=>l.jsxs("g",{children:[l.jsx("line",{x1:o,x2:o+d,y1:y(A),y2:y(A),stroke:"currentColor",strokeOpacity:.1}),l.jsx("text",{x:o-7,y:y(A)+3.5,textAnchor:"end",className:"text-[10px] fill-base-content/60",children:Jv(A)})]},A)),w.map(A=>l.jsx("path",{d:A.d,fill:A.color,opacity:.8},A.id)),e.map((A,D)=>D%Math.ceil(m/6)===0?l.jsx("text",{x:x(D),y:n-6,textAnchor:"middle",className:"text-[10px] fill-base-content/60",children:A.label},A.id??A.label):null)]})})},Yz=({points:e,color:t="#3987e5",height:n=190,valueFmt:r=Kr})=>{const a=g.useRef(null),[s,i]=g.useState(540);g.useEffect(()=>{if(!a.current)return;const A=a.current;(()=>{const T=A.clientWidth;T>0&&i(T)})();const N=new ResizeObserver(T=>{for(const v of T){const R=Math.round(v.contentRect.width);R>0&&i(R)}});return N.observe(A),()=>N.disconnect()},[]);const o=s,u=44,c=12,p=14,d=24,f=Math.max(60,o-u-c),m=n-p-d,b=e.length,E=100,x=0,y=A=>u+(b<=1?f/2:A/(b-1)*f),S=A=>p+m-(A-x)/(E-x)*m;let w=`M${y(0)},${S(e[0]?.v??0)}`;for(let A=1;A<b;A++)w+=`L${y(A)},${S(e[A]?.v??0)}`;return l.jsx("div",{ref:a,className:"w-full overflow-hidden",children:l.jsxs("svg",{viewBox:`0 0 ${o} ${n}`,width:"100%",height:n,className:"w-full block select-none",role:"img","aria-label":"Line chart",children:[[0,25,50,75,100].map(A=>l.jsxs("g",{children:[l.jsx("line",{x1:u,x2:u+f,y1:S(A),y2:S(A),stroke:"currentColor",strokeOpacity:.1}),l.jsxs("text",{x:u-7,y:S(A)+3.5,textAnchor:"end",className:"text-[10px] fill-base-content/60",children:[A,"%"]})]},A)),l.jsx("path",{d:`${w}L${y(b-1)},${p+m}L${y(0)},${p+m}Z`,fill:t,opacity:.1}),l.jsx("path",{d:w,fill:"none",stroke:t,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),e.map((A,D)=>D%Math.ceil(b/6)===0||D===b-1?l.jsx("text",{x:y(D),y:n-6,textAnchor:"middle",className:"text-[10px] fill-base-content/60",children:A.label},A.id??A.label):null)]})})},Zz=({axes:e,series:t,height:n=260})=>{const s=n/2+4,i=Math.min(520/2-78,n/2-44),o=e.length,u=p=>-Math.PI/2+p/o*Math.PI*2,c=(p,d)=>[260+Math.cos(u(p))*i*d,s+Math.sin(u(p))*i*d];return l.jsxs("svg",{viewBox:`0 0 520 ${n}`,className:"w-full h-auto select-none",role:"img","aria-label":"Radar chart",children:[[.25,.5,.75,1].map(p=>{const d=`${e.map((f,m)=>{const[b,E]=c(m,p);return`${m===0?"M":"L"}${b?.toFixed(1)},${E?.toFixed(1)}`}).join(" ")}Z`;return l.jsx("path",{d,fill:"none",stroke:"currentColor",strokeOpacity:.15},p)}),e.map((p,d)=>{const[f,m]=c(d,1),[b,E]=c(d,1.2);return l.jsxs("g",{children:[l.jsx("line",{x1:260,y1:s,x2:f,y2:m,stroke:"currentColor",strokeOpacity:.2}),l.jsx("text",{x:b,y:(E??0)+3.5,textAnchor:Math.abs((b??0)-260)<6?"middle":(b??0)>260?"start":"end",className:"text-[11px] font-semibold fill-base-content/80",children:p})]},p)}),t.map(p=>{const d=`${p.values.map((f,m)=>{const[b,E]=c(m,Math.max(.04,f/100));return`${m===0?"M":"L"}${b?.toFixed(1)},${E?.toFixed(1)}`}).join(" ")}Z`;return l.jsxs("g",{children:[l.jsx("path",{d,fill:p.color,opacity:.15}),l.jsx("path",{d,fill:"none",stroke:p.color,strokeWidth:2,strokeLinejoin:"round"}),p.values.map((f,m)=>{const[b,E]=c(m,Math.max(.04,f/100));return l.jsx("circle",{cx:b,cy:E,r:3.5,fill:p.color,stroke:"#1f2937",strokeWidth:1.5},`${p.label}-${e[m]}`)})]},p.label)})]})},Qx=[0,.3,.5,.75,1],Kz=(e,t)=>{if(e<=0||t<=0)return 0;const n=e/t;return n<=.25?1:n<=.5?2:n<=.75?3:4},Xz=({days:e,color:t="#3987e5",maxDailyTokens:n=1})=>{const[r,a]=g.useState(null),s=[...e].sort((u,c)=>u.date.localeCompare(c.date)),i=[];for(let u=0;u<s.length;u+=7)i.push(s.slice(u,u+7));const o=u=>{const c=i[u]?.[0];if(!c)return"";const p=new Date(`${c.date}T00:00:00Z`).toLocaleString("en-US",{month:"short",timeZone:"UTC"});if(u===0)return p;const d=i[u-1]?.[0];return d&&d.date.slice(0,7)===c.date.slice(0,7)?"":p};return l.jsxs("section",{className:"relative flex flex-col gap-1.5 w-full","data-testid":"heatmap-calendar","aria-label":"Daily activity heatmap",onMouseLeave:()=>a(null),children:[r&&l.jsxs("div",{className:"absolute -top-1 pointer-events-none z-30 transform -translate-x-1/2 -translate-y-full flex flex-col items-center min-w-[140px] transition-all duration-75",style:{left:`${Math.max(20,Math.min(80,(r.colIdx+.5)/13*100))}%`},children:[l.jsxs("div",{className:"bg-base-100 border border-base-content/20 shadow-xl rounded-md px-2.5 py-1.5 text-[10px] font-mono text-center text-base-content backdrop-blur-md",children:[l.jsx("div",{className:"font-bold text-primary",children:r.date}),l.jsxs("div",{className:"text-base-content/90 font-medium",children:[l.jsx("span",{className:"text-base-content font-bold",children:Ye(r.tokens)})," tokens"]}),l.jsxs("div",{className:"text-base-content/60 text-[9px]",children:[r.sessions," ",r.sessions===1?"session":"sessions"]})]}),l.jsx("div",{className:"w-1.5 h-1.5 bg-base-100 border-r border-b border-base-content/20 transform rotate-45 -mt-0.5"})]}),l.jsxs("div",{className:"flex items-start gap-1 w-full",children:[l.jsx("div",{className:"w-5 shrink-0 pt-3 flex flex-col gap-[3px] text-[9px] font-mono text-base-content/50 select-none","aria-hidden":"true",children:["Mon","","Wed","","Fri","",""].map((u,c)=>l.jsx("div",{className:"w-full aspect-square flex items-center justify-end pr-1 leading-none",children:u},u||`weekday-${c}`))}),l.jsx("div",{className:"flex-1 w-full",style:{display:"grid",gridTemplateColumns:"repeat(13, minmax(0, 1fr))",gap:"3px"},children:i.map((u,c)=>{const p=u[0];return l.jsxs("div",{className:"flex flex-col gap-[3px]","data-testid":"heatmap-week",children:[l.jsx("div",{className:"h-3 text-[9px] leading-3 text-base-content/50 truncate font-mono",children:o(c)}),l.jsx("div",{className:"flex flex-col gap-[3px]",children:u.map(d=>{const f=Kz(d.tokens,n);return l.jsx("button",{type:"button",className:"w-full aspect-square rounded-[2px] p-0 border-0 transition-transform hover:scale-125 focus:scale-125 focus:outline-hidden cursor-pointer",style:f===0?{backgroundColor:"currentColor",opacity:.08}:{backgroundColor:t,opacity:Qx[f]},onMouseEnter:()=>a({...d,colIdx:c}),onFocus:()=>a({...d,colIdx:c}),onBlur:()=>a(null),title:`${d.date}: ${Ye(d.tokens)} tokens (${d.sessions} sessions)`,children:l.jsx("span",{className:"sr-only",children:`${d.date}: ${Ye(d.tokens)} tokens, ${d.sessions} sessions`})},d.date)})})]},p?.date??`week-${c}`)})})]}),l.jsx("div",{className:"flex items-center justify-end gap-1.5 pt-0.5",children:l.jsxs("div",{className:"flex items-center gap-1 text-[9px] font-mono text-base-content/50",children:[l.jsx("span",{children:"Less"}),Qx.map(u=>l.jsx("span",{className:"w-2.5 h-2.5 rounded-[2px] inline-block",style:u===0?{backgroundColor:"currentColor",opacity:.08}:{backgroundColor:t,opacity:u}},u)),l.jsx("span",{children:"More"})]})})]})},Sd=({value:e,max:t,color:n="#3987e5",height:r=6})=>{const a=Math.max(0,Math.min(100,t>0?e/t*100:0));return l.jsx("div",{className:"w-full bg-base-300 rounded-full overflow-hidden",style:{height:r},children:l.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${a}%`,backgroundColor:n}})})},Qz=({values:e,color:t="#3987e5",width:n=120,height:r=36})=>{const a=Math.max(...e,1),s=Math.min(...e,0),i=a-s||1,o=e.length,u=d=>o<=1?n/2:d/(o-1)*(n-4)+2,c=d=>r-3-(d-s)/i*(r-6);let p="";if(o>0){p=`M${u(0)},${c(e[0]??0)}`;for(let d=1;d<o;d++)p+=`L${u(d)},${c(e[d]??0)}`}return l.jsxs("svg",{viewBox:`0 0 ${n} ${r}`,className:"inline-block select-none overflow-visible",style:{width:n,height:r},role:"img","aria-label":"Trend sparkline",children:[o>1&&l.jsx("path",{d:p,fill:"none",stroke:t,strokeWidth:1.5,strokeLinecap:"round"}),o===1&&l.jsx("circle",{cx:u(0),cy:c(e[0]??0),r:2,fill:t})]})},tw=({data:e,loading:t,error:n,cacheHitTrend:r,onSelectSession:a})=>{const[s,i]=g.useState("model"),[o,u]=g.useState("asc");if(t)return l.jsx("div",{className:"flex items-center justify-center p-16",children:l.jsx("div",{className:"w-8 h-8 rounded-full border-4 border-primary border-t-transparent animate-spin"})});if(n)return l.jsx("div",{className:"p-4 rounded-lg bg-error/10 border border-error/20 text-error",children:l.jsxs("span",{children:["Failed to load insights: ",n]})});if(!e)return null;const{loops:c,cacheWaste:p,heavySessions:d,largestTokenSteps:f,slowSteps:m,modelComparison:b}=e,E=k=>{s===k?u(j=>j==="asc"?"desc":"asc"):(i(k),u(k==="model"?"asc":"desc"))},x=[...b].sort((k,j)=>{const G=o==="asc"?1:-1;return s==="model"?G*k.model.localeCompare(j.model):G*((k[s]??0)-(j[s]??0))}),y=k=>s!==k?l.jsx("span",{className:"opacity-30 ml-1 text-[10px]",children:"↕"}):l.jsx("span",{className:"text-primary ml-1 text-[10px]",children:o==="asc"?"▲":"▼"}),S=Math.max(1,...d.map(k=>k.tokens)),w=Math.max(1,...m.map(k=>k.durationMs??0)),A=["Speed","Cache Ratio","Reliability","Output Ratio"],D={"claude-opus-4.6":"#3987e5","claude-sonnet-4.6":"#199e70","gpt-5.6-sol":"#9085e9","grok-4.6":"#d95926",other:"#898781"},N=b.map(k=>k.speedMsMean),T=Math.min(...N),v=Math.max(...N),R=k=>v===T?100:Math.max(0,Math.min(100,Math.round((v-k)/(v-T)*100))),C=k=>Math.max(0,Math.min(100,Math.round(k*100))),U=b.map(k=>{const j=R(k.speedMsMean),G=C(k.cacheRatio),$=C(k.reliability),te=C(k.outputRatio*5);return{label:k.model,color:D[k.model]??"#3987e5",values:[j,G,$,te]}});return l.jsxs("div",{className:"flex flex-col gap-6",children:[l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 p-5",children:[l.jsx("h4",{className:"font-bold text-sm mb-1",children:"Top Cache-Wasting Incidents"}),l.jsx("p",{className:"text-xs text-base-content/60 mb-3",children:"Steps that re-sent full context without cache hits"}),l.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-3 items-start",children:[(r?.length??0)>1&&l.jsx("div",{"data-testid":"cache-hit-trend-chart",children:l.jsx(Yz,{points:(r??[]).map(k=>({id:k.day,label:k.day.slice(5),v:k.cacheHitRatio})),color:"#22d3ee",height:140})}),l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full text-xs text-left font-mono",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-base-content/10 text-base-content/60",children:[l.jsx("th",{className:"py-1.5",children:"Session"}),l.jsx("th",{className:"py-1.5",children:"Fresh Tokens"}),l.jsx("th",{className:"py-1.5",children:"Cause"})]})}),l.jsx("tbody",{children:p.map(k=>l.jsxs("tr",{className:"border-b border-base-content/5 hover:bg-base-300/30",children:[l.jsx("td",{className:"py-1.5",children:l.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:()=>a?.(k.sessionId),children:k.sessionId})}),l.jsx("td",{className:"py-1.5 text-error font-bold",children:Ye(k.freshTokens)}),l.jsx("td",{className:"py-1.5 text-base-content/70",children:k.reason})]},`${k.sessionId}-${k.freshTokens}-${k.timestamp}`))})]})})]})]}),l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 p-5",children:[l.jsx("h4",{className:"font-bold text-sm mb-1",children:"Heaviest Token Sessions"}),l.jsx("p",{className:"text-xs text-base-content/60 mb-3",children:"Sessions consuming highest billed volume"}),l.jsx("div",{className:"flex flex-col gap-3",children:d.map(k=>l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsxs("div",{className:"flex justify-between text-xs font-mono",children:[l.jsxs("button",{type:"button",className:"text-primary hover:underline font-bold",onClick:()=>a?.(k.id,k.source),children:[k.id," (",k.source," · ",k.model,")"]}),l.jsx("span",{children:Ye(k.tokens)})]}),l.jsx(Sd,{value:k.tokens,max:S,color:"#3987e5",height:6})]},k.id))})]})]}),l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 p-5",children:[l.jsx("h4",{className:"font-bold text-sm mb-1",children:"Top Time-Consuming Steps"}),l.jsx("p",{className:"text-xs text-base-content/60 mb-3",children:"Longest tool execution durations"}),l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full text-xs text-left font-mono",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-base-content/10 text-base-content/60",children:[l.jsx("th",{className:"py-1.5",children:"Tool / Step"}),l.jsx("th",{className:"py-1.5",children:"Session"}),l.jsx("th",{className:"py-1.5 text-right",children:"Duration"}),l.jsx("th",{className:"py-1.5 text-right",children:"Tokens"})]})}),l.jsx("tbody",{children:m.map(k=>l.jsxs("tr",{className:"border-b border-base-content/5 hover:bg-base-300/30",children:[l.jsxs("td",{className:"py-1.5 font-bold",children:[k.toolName," ",l.jsxs("span",{className:"text-[10px] text-base-content/50",children:["#",k.stepIndex]})]}),l.jsx("td",{className:"py-1.5",children:l.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:()=>a?.(k.sessionId,k.agent),children:k.sessionId})}),l.jsx("td",{className:"py-1.5 text-right text-amber-400 font-bold w-24",children:l.jsxs("div",{className:"flex flex-col items-end gap-1",children:[l.jsx("span",{children:yd(k.durationMs??0)}),l.jsx(Sd,{value:k.durationMs??0,max:w,color:"#fbbf24",height:4})]})}),l.jsx("td",{className:"py-1.5 text-right",children:Ye(k.tokens)})]},`${k.sessionId}-${k.toolName}-${k.stepIndex}`))})]})})]}),l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 p-5",children:[l.jsx("h4",{className:"font-bold text-sm mb-1",children:"Largest Token Steps"}),l.jsx("p",{className:"text-xs text-base-content/60 mb-3",children:"Single tool calls with highest token load"}),l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full text-xs text-left font-mono",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-base-content/10 text-base-content/60",children:[l.jsx("th",{className:"py-1.5",children:"Tool / Step"}),l.jsx("th",{className:"py-1.5",children:"Session"}),l.jsx("th",{className:"py-1.5",children:"Agent / Model"}),l.jsx("th",{className:"py-1.5 text-right",children:"Tokens"})]})}),l.jsx("tbody",{children:f.map(k=>l.jsxs("tr",{className:"border-b border-base-content/5 hover:bg-base-300/30",children:[l.jsxs("td",{className:"py-1.5 font-bold",children:[k.toolName," ",l.jsxs("span",{className:"text-[10px] text-base-content/50",children:["#",k.stepIndex]})]}),l.jsx("td",{className:"py-1.5",children:l.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:()=>a?.(k.sessionId,k.agent),children:k.sessionId})}),l.jsxs("td",{className:"py-1.5 text-xs text-base-content/70",children:[k.agent," · ",k.model]}),l.jsx("td",{className:"py-1.5 text-right text-primary font-bold",children:Ye(k.tokens)})]},`${k.sessionId}-${k.toolName}-${k.stepIndex}`))})]})})]})]}),l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 p-5",children:[l.jsx("h4",{className:"font-bold text-sm mb-1",children:"Model Multi-Axis Comparison"}),l.jsx("p",{className:"text-xs text-base-content/60 mb-4",children:"Speed, Cache ratio, Reliability, and Output ratio"}),l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 items-center",children:[l.jsx("div",{className:"flex justify-center",children:l.jsx(Zz,{axes:A,series:U,height:280})}),l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full text-xs text-left font-mono",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-base-content/10 text-base-content/60",children:[l.jsxs("th",{className:"py-1.5 cursor-pointer select-none hover:text-base-content",onClick:()=>E("model"),children:["Model ",y("model")]}),l.jsxs("th",{className:"py-1.5 text-right cursor-pointer select-none hover:text-base-content",onClick:()=>E("speedMsMean"),children:["Mean Speed (ms) ",y("speedMsMean")]}),l.jsxs("th",{className:"py-1.5 text-right cursor-pointer select-none hover:text-base-content",onClick:()=>E("cacheRatio"),children:["Cache Ratio ",y("cacheRatio")]}),l.jsxs("th",{className:"py-1.5 text-right cursor-pointer select-none hover:text-base-content",onClick:()=>E("reliability"),children:["Reliability ",y("reliability")]}),l.jsxs("th",{className:"py-1.5 text-right cursor-pointer select-none hover:text-base-content",onClick:()=>E("outputRatio"),children:["Output Ratio ",y("outputRatio")]})]})}),l.jsx("tbody",{children:x.map(k=>l.jsxs("tr",{className:"border-b border-base-content/5 hover:bg-base-300/30",children:[l.jsxs("td",{className:"py-1.5 font-bold flex items-center gap-1.5",children:[l.jsx("span",{className:"w-2.5 h-2.5 rounded-full",style:{background:D[k.model]??"#3987e5"}}),k.model]}),l.jsx("td",{className:"py-1.5 text-right font-mono",children:mn(k.speedMsMean)}),l.jsx("td",{className:"py-1.5 text-right text-cyan-400 font-mono",children:Kr(k.cacheRatio*100)}),l.jsx("td",{className:"py-1.5 text-right text-emerald-400 font-mono",children:Kr(k.reliability*100)}),l.jsx("td",{className:"py-1.5 text-right font-mono",children:Kr(k.outputRatio*100)})]},k.model))})]})})]})]}),c.length>0&&l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-warning/30 p-5",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("span",{className:"text-warning text-lg",children:"⚠️"}),l.jsx("h3",{className:"font-bold text-base",children:"Detected Execution Loops (Repeats ≥ 3)"})]}),l.jsx("p",{className:"text-xs text-base-content/60 mb-4",children:"Identified consecutive identical tool invocations without intervening state changes."}),l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:c.map(k=>l.jsxs("div",{className:"p-4 bg-base-300/70 rounded-xl border border-base-content/10 flex flex-col justify-between gap-3",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsxs("span",{className:"px-2 py-0.5 rounded-full text-xs font-mono font-bold bg-warning/20 text-warning border border-warning/30",children:[k.tool," × ",k.repeats," repeats"]}),l.jsx("button",{type:"button",className:"text-xs font-mono text-primary hover:underline",onClick:()=>a?.(k.sessionId),children:k.sessionId})]}),l.jsx("div",{className:"font-mono text-xs text-base-content/80 mt-2",children:k.argsHint}),l.jsxs("div",{className:"text-[11px] text-base-content/50 mt-1",children:["Step sequence: #",k.fromSeq," → #",k.toSeq]})]}),l.jsxs("div",{className:"flex justify-between items-center text-xs font-mono pt-2 border-t border-base-content/10",children:[l.jsx("span",{className:"text-base-content/60",children:"Estimated Wasted Tokens:"}),l.jsx("span",{className:"text-error font-bold",children:Ye(k.wastedTokens)})]})]},`${k.tool}-${k.sessionId}-${k.fromSeq}`))})]})]})},nw=({data:e,loading:t,error:n,sortBy:r="start",sortDir:a="desc",page:s=1,pageSize:i=20,onSortChange:o,onPageChange:u,onSelectSession:c})=>{if(t)return l.jsx("div",{className:"flex items-center justify-center p-16",children:l.jsx("div",{className:"w-8 h-8 rounded-full border-4 border-primary border-t-transparent animate-spin"})});if(n)return l.jsx("div",{className:"p-4 rounded-lg bg-error/10 border border-error/20 text-error",children:l.jsxs("span",{children:["Failed to load sessions: ",n]})});if(!e)return null;const{items:p,total:d}=e,f=Math.max(1,Math.ceil(d/i)),m=b=>r!==b?null:l.jsx("span",{className:"ml-1 text-primary",children:a==="asc"?"▲":"▼"});return l.jsxs("div",{className:"flex flex-col gap-4",children:[l.jsx("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 overflow-hidden",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full text-xs text-left font-mono",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"bg-base-300/80 text-base-content/70 border-b border-base-content/10",children:[l.jsx("th",{className:"p-3",children:"Session ID"}),l.jsx("th",{className:"p-3",children:"Agent"}),l.jsx("th",{className:"p-3",children:"Model"}),l.jsxs("th",{className:"p-3 cursor-pointer hover:text-primary transition-colors",onClick:()=>o?.("start"),children:["Start Time ",m("start")]}),l.jsxs("th",{className:"p-3 cursor-pointer hover:text-primary transition-colors text-right",onClick:()=>o?.("duration"),children:["Duration ",m("duration")]}),l.jsxs("th",{className:"p-3 cursor-pointer hover:text-primary transition-colors text-right",onClick:()=>o?.("messages"),children:["Msgs ",m("messages")]}),l.jsxs("th",{className:"p-3 cursor-pointer hover:text-primary transition-colors text-right",onClick:()=>o?.("toolCalls"),children:["Tools ",m("toolCalls")]}),l.jsxs("th",{className:"p-3 cursor-pointer hover:text-primary transition-colors text-right",onClick:()=>o?.("billedTokens"),children:["Billed Tok ",m("billedTokens")]}),l.jsxs("th",{className:"p-3 cursor-pointer hover:text-primary transition-colors text-right",onClick:()=>o?.("cacheRead"),children:["Cache Read ",m("cacheRead")]}),l.jsxs("th",{className:"p-3 cursor-pointer hover:text-primary transition-colors text-right",onClick:()=>o?.("freshInput"),children:["Fresh Input ",m("freshInput")]}),l.jsx("th",{className:"p-3",children:"Top Tool"}),l.jsx("th",{className:"p-3 text-center",children:"State"})]})}),l.jsx("tbody",{children:p.length===0?l.jsx("tr",{children:l.jsx("td",{colSpan:12,className:"text-center py-8 text-base-content/50",children:"No sessions matching the current filter."})}):p.map(b=>l.jsxs("tr",{className:"border-b border-base-content/5 hover:bg-primary/10 cursor-pointer transition-colors",onClick:()=>c?.(b.source,b.id),title:"Click to view execution timeline",children:[l.jsx("td",{className:"p-3 font-bold text-primary",children:l.jsx("span",{className:"font-mono text-xs",title:b.id,children:b.id.length>18?`${b.id.slice(0,16)}…`:b.id})}),l.jsx("td",{className:"p-3",children:l.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-base-300 uppercase font-mono text-base-content",children:b.source})}),l.jsx("td",{className:"p-3 text-base-content/70",children:b.model}),l.jsx("td",{className:"p-3",children:b.start.slice(0,19).replace("T"," ")}),l.jsx("td",{className:"p-3 text-right font-semibold tabular-nums",children:ew(b.durationMs/6e4)}),l.jsx("td",{className:"p-3 text-right tabular-nums",children:mn(b.messages)}),l.jsx("td",{className:"p-3 text-right tabular-nums",children:mn(b.toolCalls)}),l.jsx("td",{className:"p-3 text-right font-bold text-primary tabular-nums",children:Ye(b.billedTokens)}),l.jsx("td",{className:"p-3 text-right text-emerald-400 tabular-nums",children:Ye(b.cacheReadTokens)}),l.jsx("td",{className:"p-3 text-right text-base-content/70 tabular-nums",children:Ye(b.freshInputTokens)}),l.jsx("td",{className:"p-3",children:l.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] border border-base-content/20 font-mono",children:b.topTool})}),l.jsx("td",{className:"p-3 text-center",children:l.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono ${b.state==="error"?"bg-error/20 text-error font-bold":"bg-emerald-500/20 text-emerald-400 font-bold"}`,children:b.state})})]},`${b.source}:::${b.id}`))})]})})}),l.jsxs("div",{className:"flex flex-wrap justify-between items-center gap-3 px-1 text-xs",children:[l.jsxs("span",{className:"text-base-content/70",children:["Showing ",(s-1)*i+1,"–",Math.min(s*i,d)," of ",d," sessions"]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{type:"button",className:"px-2.5 py-1 text-xs rounded border border-base-content/20 hover:bg-base-content/10 font-medium disabled:opacity-40",disabled:s<=1,onClick:()=>u?.(s-1),children:"« Prev"}),l.jsxs("span",{className:"px-2.5 py-1 text-xs font-mono text-base-content/70",children:["Page ",s," / ",f]}),l.jsx("button",{type:"button",className:"px-2.5 py-1 text-xs rounded border border-base-content/20 hover:bg-base-content/10 font-medium disabled:opacity-40",disabled:s>=f,onClick:()=>u?.(s+1),children:"Next »"})]})]})]})},rw=({data:e,loading:t,error:n,onTriggerImport:r})=>{const[a,s]=g.useState(!1),[i,o]=g.useState(null),u=async()=>{s(!0),o("Running import & analytics rollup...");try{const f=await r?.("incremental");o(f?.message??"Import queued.")}catch(f){o(`Import failed: ${f instanceof Error?f.message:String(f)}`)}finally{s(!1)}};if(t)return l.jsx("div",{className:"flex items-center justify-center p-16",children:l.jsx("div",{className:"w-8 h-8 rounded-full border-4 border-primary border-t-transparent animate-spin"})});if(n)return l.jsx("div",{className:"p-4 rounded-lg bg-error/10 border border-error/20 text-error",children:l.jsxs("span",{children:["Failed to load sources registry: ",n]})});if(!e)return null;const{overview:c,agents:p,roots:d}=e;return l.jsxs("div",{className:"flex flex-col gap-6",children:[l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 p-5 flex flex-col md:flex-row justify-between items-start md:items-center gap-4",children:[l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xl",children:"🗄️"}),l.jsx("h3",{className:"font-bold text-base",children:"Transcripts Corpus & Ingestion Registry"})]}),l.jsxs("div",{className:"flex flex-wrap gap-4 text-xs font-mono text-base-content/70 mt-1",children:[l.jsxs("span",{children:["Files: ",l.jsx("strong",{className:"text-base-content",children:mn(c.totalFiles)})]}),l.jsxs("span",{children:["Corpus Size:"," ",l.jsxs("strong",{className:"text-base-content",children:[(c.corpusSizeBytes/(1024*1024)).toFixed(1)," MB"]})]}),l.jsxs("span",{children:["Total Sessions:"," ",l.jsx("strong",{className:"text-base-content",children:mn(c.totalSessions)})]}),l.jsxs("span",{children:["Coverage:"," ",l.jsxs("strong",{className:"text-base-content",children:[c.dateCoverage.from?.slice(0,10)??"N/A"," →"," ",c.dateCoverage.to?.slice(0,10)??"N/A"]})]}),l.jsxs("span",{children:["Last Import:"," ",l.jsx("strong",{className:"text-base-content",children:c.lastImportedAt?new Date(c.lastImportedAt).toLocaleString():"never imported"})]})]})]}),l.jsxs("div",{className:"flex flex-col items-end gap-1.5",children:[l.jsx("button",{type:"button",className:"px-4 py-2 rounded-lg bg-primary text-primary-content font-medium text-xs hover:bg-primary/90 transition-colors disabled:opacity-50",disabled:a,onClick:u,children:a?"Importing...":"🔄 Import & Analyze"}),i&&l.jsx("span",{className:"text-[11px] font-mono text-info","aria-live":"polite",children:i})]})]}),l.jsxs("div",{children:[l.jsx("h4",{className:"font-bold text-sm mb-3",children:"Agent Activity (90-Day Daily Heatmaps)"}),l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:p.map(f=>l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 hover:border-base-content/30 transition-all p-4 flex flex-col justify-between gap-3",children:[l.jsxs("div",{className:"flex justify-between items-start",children:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsxs("div",{className:"relative group",children:[l.jsx("button",{type:"button",className:"w-7 h-7 rounded-lg flex items-center justify-center text-white shadow-xs focus:outline-2 focus:outline-offset-2 focus:outline-primary",style:{background:f.color},"aria-label":`${f.name} source metrics`,"aria-describedby":`source-tooltip-${f.id}`,children:l.jsx(ls,{id:f.id})}),l.jsxs("div",{id:`source-tooltip-${f.id}`,role:"tooltip",className:"pointer-events-none absolute z-20 left-0 top-9 w-64 rounded-lg border border-base-content/15 bg-base-100 p-3 text-[11px] font-mono shadow-xl opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",children:[l.jsxs("div",{className:"mb-2 font-bold text-sm",children:[f.name," Summary"]}),l.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1",children:[l.jsx("span",{className:"text-base-content/60",children:"Imported Files"}),l.jsx("strong",{className:"text-right",children:mn(f.filesCount)}),l.jsx("span",{className:"text-base-content/60",children:"Sessions"}),l.jsx("strong",{className:"text-right",children:mn(f.sessionCount)}),l.jsx("span",{className:"text-base-content/60",children:"Total Tokens"}),l.jsx("strong",{className:"text-right",children:Ye(f.totalTokens)}),l.jsx("span",{className:"text-base-content/60",children:"Cache Saved"}),l.jsx("strong",{className:"text-right",children:Ye(f.cacheSavedTokens)}),l.jsx("span",{className:"text-base-content/60",children:"Tool Calls"}),l.jsx("strong",{className:"text-right",children:mn(f.toolCalls)}),l.jsx("span",{className:"text-base-content/60",children:"Date Range"}),l.jsxs("strong",{className:"text-right",children:[f.firstDate?.slice(0,10)??"N/A"," →"," ",f.lastDate?.slice(0,10)??"N/A"]})]})]})]}),l.jsxs("div",{children:[l.jsx("div",{className:"font-bold text-sm",children:f.name}),l.jsx("div",{className:"text-[10px] font-mono text-base-content/60",children:f.importPath})]})]}),l.jsxs("span",{className:"px-2 py-0.5 rounded-full text-xs font-mono font-bold bg-base-300 border border-base-content/10 text-base-content",children:[Ye(f.totalTokens)," tok"]})]}),l.jsxs("div",{className:"bg-base-300/60 p-2 rounded-lg border border-base-content/5",children:[l.jsxs("div",{className:"text-[10px] font-mono text-base-content/50 mb-1 flex justify-between",children:[l.jsx("span",{children:"90 days ago"}),l.jsx("span",{children:"Today"})]}),l.jsx(Xz,{days:f.heatmapDays,color:f.color,maxDailyTokens:f.maxDailyTokens})]}),l.jsxs("div",{className:"grid grid-cols-3 gap-2 pt-2 border-t border-base-content/10 font-mono text-[11px]",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-base-content/50 block text-[10px]",children:"Sessions"}),l.jsx("span",{className:"font-semibold",children:mn(f.sessionCount)})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-base-content/50 block text-[10px]",children:"Tool Calls"}),l.jsx("span",{className:"font-semibold",children:mn(f.toolCalls)})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-base-content/50 block text-[10px]",children:"Cache Saved"}),l.jsx("span",{className:"font-semibold text-emerald-400",children:Ye(f.cacheSavedTokens)})]})]})]},f.id))})]}),l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 p-5",children:[l.jsx("h4",{className:"font-bold text-sm mb-3",children:"Source Directories & Import Roots"}),l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full text-xs text-left font-mono",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-base-content/10 text-base-content/60",children:[l.jsx("th",{className:"py-1.5",children:"Agent"}),l.jsx("th",{className:"py-1.5",children:"Filesystem Path"}),l.jsx("th",{className:"py-1.5",children:"Match Pattern"}),l.jsx("th",{className:"py-1.5 text-right",children:"Files Count"}),l.jsx("th",{className:"py-1.5 text-center",children:"Status"})]})}),l.jsx("tbody",{children:d.map(f=>l.jsxs("tr",{className:"border-b border-base-content/5 hover:bg-base-300/30",children:[l.jsx("td",{className:"py-1.5 font-bold",children:f.agentName}),l.jsx("td",{className:"py-1.5 text-base-content/80",children:f.path}),l.jsx("td",{className:"py-1.5 text-base-content/60",children:f.matchPattern}),l.jsx("td",{className:"py-1.5 text-right font-semibold",children:mn(f.fileCount)}),l.jsx("td",{className:"py-1.5 text-center",children:l.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-emerald-500/20 text-emerald-400 uppercase font-bold",children:f.status})})]},f.agentId))})]})})]})]})},Jz=["auto","5m","10m","30m","1h","4h","1d"],eH=(e,t)=>t===void 0||t===0?null:(e-t)/Math.abs(t)*100,vd=({current:e,previous:t,invert:n=!1})=>{const r=eH(e,t);if(r===null)return l.jsx("span",{className:"text-[10px] text-base-content/40",children:"No prior baseline"});const a=r>=0,s=n?!a:a;return l.jsxs("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-bold font-mono ${s?"bg-emerald-500/15 text-emerald-400":"bg-error/15 text-error"}`,children:[a?"↑ +":"↓ ",Math.abs(r).toFixed(1),"% vs previous period"]})},Co=({label:e,value:t,sub:n,trend:r,trendColor:a,current:s,previous:i,invert:o,badge:u})=>l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 p-4",children:[l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-base-content/60",children:e}),u]}),l.jsxs("div",{className:"flex items-end justify-between gap-2 mt-1",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-2xl font-bold font-mono text-primary",children:t}),l.jsxs("div",{className:"flex items-center gap-1.5 mt-1",children:[l.jsx(vd,{current:s,previous:i,invert:o}),l.jsx("span",{className:"text-xs text-base-content/60",children:n})]})]}),r.length>1&&l.jsx(Qz,{values:r,color:a,width:100,height:34})]})]}),aw=({data:e,loading:t,error:n,dimension:r="model",onDimensionChange:a,bucket:s="auto",onBucketChange:i,loopSummary:o})=>{const[u,c]=g.useState("chart");if(t)return l.jsx("div",{className:"flex items-center justify-center p-16",children:l.jsx("div",{className:"w-8 h-8 rounded-full border-4 border-primary border-t-transparent animate-spin"})});if(n)return l.jsx("div",{className:"p-4 rounded-lg bg-error/10 border border-error/20 text-error",children:l.jsxs("span",{children:["Failed to load history summary: ",n]})});if(!e)return null;const{kpis:p,previousKpis:d,kpiTrend:f,timeSeries:m,topModels:b,topSources:E,topTools:x,skillsUsed:y,skillTimeSeries:S,cacheEfficiency:w}=e,A=d??void 0,D={billed:f.map(H=>H.totalBilledTokens),cacheSaved:f.map(H=>H.cacheSavedTokens),sessions:f.map(H=>H.sessionsCount),toolCalls:f.map(H=>H.toolCallsCount)};let N=[];if(r==="model")N=b.map(H=>({id:H.id,label:H.label,color:H.color}));else if(r==="source")N=E.map(H=>({id:H.id,label:H.label,color:H.color}));else if(r==="tool"){const H=["#199e70","#3987e5","#d95926","#9085e9","#c98500","#ec4899","#8b5cf6"];N=x.slice(0,6).map((se,de)=>({id:se.id,label:se.id,color:H[de%H.length]??"#3987e5"}))}else N=y.map(H=>({id:H.id,label:H.label,color:H.color}));const T=m.map(H=>{const se=H.bucketStart.slice(5,10);return{id:H.bucketStart,label:se,v:H.series,lineValue:H.cacheHitRatio}}),v=S.map(H=>({id:H.bucketStart,label:H.bucketStart.slice(5,10),v:H.series})),R=Math.max(...x.map(H=>H.count),1),C=p.sessionsCount>0?p.totalBilledTokens/p.sessionsCount:0,U=p.toolCallsCount>0?p.totalBilledTokens/p.toolCallsCount:0,k=A&&A.sessionsCount>0?A.totalBilledTokens/A.sessionsCount:void 0,j=A&&A.toolCallsCount>0?A.totalBilledTokens/A.toolCallsCount:void 0,G=Math.max(0,w.totalRead-w.savedTokens),$=Math.max(0,p.totalBilledTokens-G),te=S.reduce((H,se)=>{for(const[de,O]of Object.entries(se.series))H[de]=(H[de]??0)+O;return H},{});return l.jsxs("div",{className:"flex flex-col gap-6",children:[l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[l.jsx(Co,{label:"Total Billed Tokens",value:Ye(p.totalBilledTokens),sub:`Fresh ${Ye(G)} · Output ${Ye($)}`,trend:D.billed,trendColor:"#3987e5",current:p.totalBilledTokens,previous:A?.totalBilledTokens}),l.jsx(Co,{label:"Cache-Saved Tokens",value:Ye(p.cacheSavedTokens),sub:`Share ${Kr(p.cacheSavedPercent)} · Hit ${Kr(w.hitRatio)}`,trend:D.cacheSaved,trendColor:"#22d3ee",current:p.cacheSavedTokens,previous:A?.cacheSavedTokens,badge:l.jsxs("span",{className:"px-2 py-0.5 rounded-full text-xs font-bold bg-emerald-500/20 text-emerald-400 border border-emerald-500/30",children:[p.cacheSavedPercent,"% saved"]})}),l.jsx(Co,{label:"Sessions",value:mn(p.sessionsCount),sub:`${mn(p.sessionsCount>0?p.toolCallsCount/p.sessionsCount:0)} calls / session`,trend:D.sessions,trendColor:"#9085e9",current:p.sessionsCount,previous:A?.sessionsCount}),l.jsx(Co,{label:"Tool Calls",value:mn(p.toolCallsCount),sub:`${Ye(U)} billed / step`,trend:D.toolCalls,trendColor:"#c98500",current:p.toolCallsCount,previous:A?.toolCallsCount,badge:l.jsxs("span",{className:"px-2 py-0.5 rounded-full text-xs font-mono bg-amber-500/20 text-amber-400 border border-amber-500/30",children:[Kr(p.errorRate)," err"]})})]}),l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 p-5",children:[l.jsxs("div",{className:"flex flex-wrap justify-between items-center gap-3 pb-2 border-b border-base-content/10",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"font-bold text-base",children:"Token Activity & Cache Hit Ratio"}),l.jsx("p",{className:"text-xs text-base-content/60",children:"Stacked token bars (left) with Cache Hit % line overlay (right)"})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs("fieldset",{className:"flex items-center bg-base-300 p-0.5 rounded-lg text-xs border-0",children:[l.jsx("legend",{className:"sr-only",children:"Bucket interval"}),Jz.map(H=>l.jsx("button",{type:"button","aria-pressed":s===H,className:`px-2 py-1 rounded font-medium transition-colors ${s===H?"bg-base-100 text-base-content font-bold shadow-sm":"text-base-content/60 hover:bg-base-content/10"}`,onClick:()=>i?.(H),children:H},H))]}),l.jsx("div",{className:"flex items-center bg-base-300 p-0.5 rounded-lg text-xs",children:["chart","table"].map(H=>l.jsx("button",{type:"button","aria-pressed":u===H,className:`px-2.5 py-1 rounded font-medium transition-colors ${u===H?"bg-base-100 text-base-content font-bold shadow-sm":"text-base-content/60 hover:bg-base-content/10"}`,onClick:()=>c(H),children:H==="chart"?"Chart":"Table"},H))}),l.jsx("div",{className:"flex items-center bg-base-300 p-0.5 rounded-lg text-xs",children:["model","source","tool","skill"].map(H=>l.jsxs("button",{type:"button","aria-pressed":r===H,className:`px-2.5 py-1 text-xs rounded font-medium transition-colors ${r===H?"bg-primary text-primary-content font-bold":"text-base-content/70 hover:bg-base-content/10"}`,onClick:()=>a?.(H),children:["By ",H.charAt(0).toUpperCase()+H.slice(1)]},H))})]})]}),l.jsx("div",{className:"pt-3",children:u==="chart"?l.jsx(Vz,{buckets:T,series:N,height:260}):l.jsx("div",{className:"overflow-x-auto max-h-80 overflow-y-auto",children:l.jsxs("table",{className:"w-full text-xs text-left font-mono","data-testid":"summary-bucket-table",children:[l.jsx("thead",{className:"sticky top-0 bg-base-200",children:l.jsxs("tr",{className:"border-b border-base-content/10 text-base-content/60",children:[l.jsx("th",{className:"py-1.5 pr-2",children:"Bucket"}),N.map(H=>l.jsx("th",{className:"py-1.5 pr-2 text-right",children:l.jsxs("span",{className:"inline-flex items-center gap-1",children:[l.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:H.color}}),H.label]})},H.id)),l.jsx("th",{className:"py-1.5 pr-2 text-right",children:"Total"}),l.jsx("th",{className:"py-1.5 text-right",children:"Cache Hit %"})]})}),l.jsx("tbody",{children:T.map(H=>{const se=Object.values(H.v).reduce((de,O)=>de+O,0);return l.jsxs("tr",{className:"border-b border-base-content/5",children:[l.jsx("td",{className:"py-1.5 pr-2 font-bold",children:(H.id??H.label).slice(0,16).replace("T"," ")}),N.map(de=>l.jsx("td",{className:"py-1.5 pr-2 text-right tabular-nums",children:H.v[de.id]!==void 0?Ye(H.v[de.id]??0):"—"},de.id)),l.jsx("td",{className:"py-1.5 pr-2 text-right tabular-nums font-bold",children:Ye(se)}),l.jsx("td",{className:"py-1.5 text-right tabular-nums",children:H.lineValue!==void 0?`${H.lineValue.toFixed(1)}%`:"—"})]},H.id??H.label)})})]})})})]}),l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 p-5",children:[l.jsx("h4",{className:"font-bold text-sm mb-3",children:"Top Models by Billed Tokens"}),l.jsx("div",{className:"flex flex-col gap-3",children:b.map(H=>l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsxs("div",{className:"flex justify-between text-xs font-mono",children:[l.jsxs("span",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"w-2.5 h-2.5 rounded-full",style:{background:H.color}}),H.label]}),l.jsxs("span",{children:[Ye(H.tokens)," (",H.share,"%)"]})]}),l.jsx("div",{className:"w-full bg-base-300 h-2 rounded-full overflow-hidden",children:l.jsx("div",{className:"h-full rounded-full",style:{width:`${H.share}%`,background:H.color}})})]},H.id))})]}),l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 p-5",children:[l.jsx("h4",{className:"font-bold text-sm mb-3",children:"Top Agent Sources by Billed Tokens"}),l.jsx("div",{className:"flex flex-col gap-3",children:E.map(H=>l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsxs("div",{className:"flex justify-between text-xs",children:[l.jsxs("span",{className:"flex items-center gap-1.5 font-medium",children:[l.jsx("span",{className:"w-2.5 h-2.5 rounded-full",style:{background:H.color}}),H.label]}),l.jsxs("span",{className:"font-mono",children:[Ye(H.tokens)," (",H.share,"%)"]})]}),l.jsx("div",{className:"w-full bg-base-300 h-2 rounded-full overflow-hidden",children:l.jsx("div",{className:"h-full rounded-full",style:{width:`${H.share}%`,background:H.color}})})]},H.id))})]}),l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 p-5",children:[l.jsx("h4",{className:"font-bold text-sm mb-2",children:"Top Tools & Error Rates"}),l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"w-full text-xs text-left font-mono",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-base-content/10 text-base-content/60",children:[l.jsx("th",{className:"py-1.5",children:"Tool"}),l.jsx("th",{className:"py-1.5",children:"Share"}),l.jsx("th",{className:"py-1.5 text-right",children:"Calls"}),l.jsx("th",{className:"py-1.5 text-right",children:"Errors"}),l.jsx("th",{className:"py-1.5 text-right",children:"Error Rate"})]})}),l.jsx("tbody",{children:x.map(H=>l.jsxs("tr",{className:"border-b border-base-content/5 hover:bg-base-300/30",children:[l.jsx("td",{className:"py-1.5 font-bold",children:H.id}),l.jsx("td",{className:"py-1.5 w-28",children:l.jsx(Sd,{value:H.count,max:R,color:"#3987e5"})}),l.jsx("td",{className:"py-1.5 text-right tabular-nums",children:mn(H.count)}),l.jsx("td",{className:"py-1.5 text-right tabular-nums",children:H.errors>0?mn(H.errors):"0"}),l.jsx("td",{className:"py-1.5 text-right",children:l.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] ${H.errorRate>1?"bg-error/20 text-error font-bold":"bg-base-300 text-base-content/70"}`,children:Kr(H.errorRate)})})]},H.id))})]})})]}),l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 p-5 flex flex-col gap-4",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"font-bold text-sm mb-2",children:"Cache Efficiency Overview"}),l.jsxs("div",{className:"bg-base-300/60 p-3.5 rounded-xl border border-base-content/5 mb-4",children:[l.jsxs("div",{className:"flex justify-between items-center mb-1.5 text-xs font-semibold",children:[l.jsx("span",{children:"Global Cache Hit Ratio"}),l.jsxs("span",{className:"text-cyan-400 font-mono text-sm",children:[w.hitRatio,"%"]})]}),l.jsx("div",{className:"w-full bg-base-100 h-2.5 rounded-full overflow-hidden",children:l.jsx("div",{className:"h-full bg-cyan-400 rounded-full",style:{width:`${w.hitRatio}%`}})}),l.jsxs("div",{className:"flex justify-between text-[11px] text-base-content/60 mt-2 font-mono",children:[l.jsxs("span",{children:["Saved: ",Ye(w.savedTokens)]}),l.jsxs("span",{children:["Total Read: ",Ye(w.totalRead)]})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-3 text-xs font-mono",children:[l.jsxs("div",{className:"flex flex-col gap-0.5",children:[l.jsx("span",{className:"text-base-content/60 text-[10px] uppercase tracking-wider",children:"Avg Billed / Session"}),l.jsx("span",{className:"font-bold",children:Ye(C)}),l.jsx(vd,{current:C,previous:k,invert:!0})]}),l.jsxs("div",{className:"flex flex-col gap-0.5",children:[l.jsx("span",{className:"text-base-content/60 text-[10px] uppercase tracking-wider",children:"Avg Billed / Step"}),l.jsx("span",{className:"font-bold",children:Ye(U)}),l.jsx(vd,{current:U,previous:j,invert:!0})]}),l.jsxs("div",{className:"flex flex-col gap-0.5",children:[l.jsx("span",{className:"text-base-content/60 text-[10px] uppercase tracking-wider",children:"Loop Detection Findings"}),l.jsxs("span",{className:"font-bold",children:[mn(o?.redundantCalls??0)," redundant"]}),l.jsxs("span",{className:"text-[10px] text-base-content/60",children:[Ye(o?.wastedTokens??0)," wasted"]})]})]})]}),y.length>0&&l.jsxs("div",{children:[l.jsx("h5",{className:"font-bold text-xs mb-2",children:"Skills Invocation Mix"}),l.jsx(qz,{buckets:v,series:tH(y),height:150}),l.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:y.map(H=>l.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full bg-base-300 border border-base-content/10 gap-1.5 font-mono text-[11px]",children:[l.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:H.color}}),l.jsxs("span",{children:[H.label,":"]}),l.jsxs("span",{className:"font-bold",children:[Ye(te[H.id]??0)," tokens"]})]},H.id))})]})]})]})]})},tH=e=>e.map(t=>({id:t.id,label:t.label,color:t.color})),nH=({blocks:e,start:t,end:n,onJumpToTime:r})=>{const a=g.useId(),{bins:s,maxBinTokens:i,maxBinOperations:o,startMs:u,endMs:c,hasValidRange:p}=g.useMemo(()=>{if(!t||!n||e.length===0)return{bins:[],maxBinTokens:0,maxBinOperations:0,startMs:0,endMs:0,hasValidRange:!1};const d=Date.parse(t),f=Date.parse(n);if(Number.isNaN(d)||Number.isNaN(f)||f<d)return{bins:[],maxBinTokens:0,maxBinOperations:0,startMs:0,endMs:0,hasValidRange:!1};const m=96,E=Math.max(1,f-d)/m,x=Array.from({length:m},(w,A)=>({index:A,timeMs:d+A*E,tokens:0,operations:0}));for(const w of e){if(!w.timestamp)continue;const A=Date.parse(w.timestamp);if(Number.isNaN(A)||A<d||A>f)continue;const D=Math.min(m-1,Math.max(0,Math.floor((A-d)/E))),N=x[D];N&&(N.tokens+=w.totalTokens,N.operations+=w.operationCount)}const y=Math.max(1,...x.map(w=>w.tokens)),S=Math.max(1,...x.map(w=>w.operations));return{bins:x,maxBinTokens:y,maxBinOperations:S,startMs:d,endMs:f,hasValidRange:!0}},[e,t,n]);return!p||s.length===0?null:l.jsxs("div",{"data-testid":"timeline-scrubber",className:"flex flex-col gap-1.5 p-3 bg-base-200/80 rounded-xl border border-base-content/10 font-mono text-xs",children:[l.jsxs("div",{className:"flex items-center justify-between text-[11px] text-base-content/60 px-1",children:[l.jsxs("span",{children:["Timeline Activity (",s.length," bins)"]}),l.jsxs("span",{children:["Peak: ",Ye(i)]})]}),l.jsx("div",{className:"relative h-10 w-full bg-base-300/60 rounded-lg overflow-hidden flex items-end p-1",children:l.jsx("svg",{viewBox:"0 0 96 32",preserveAspectRatio:"none",className:"w-full h-full text-primary/70","aria-hidden":"true",children:s.map(d=>{const f=d.operations>0?Math.max(2,Math.round(d.operations/o*30)):0,m=d.tokens>0?.35+d.tokens/i*.65:.25,b=32-f;return l.jsx("rect",{x:d.index,y:b,width:"0.85",height:f,fill:"currentColor",fillOpacity:m,"data-operations":d.operations,"data-tokens":d.tokens,className:"hover:text-cyan-400 transition-colors",children:l.jsx("title",{children:`${new Date(d.timeMs).toISOString()} · ${Ye(d.tokens)} · ${d.operations} ops`})},d.index)})})}),l.jsx("label",{htmlFor:a,className:"sr-only",children:"Timeline scrub slider"}),l.jsx("input",{id:a,type:"range",min:u,max:c,defaultValue:u,"aria-label":"Timeline navigation scrubber","data-testid":"timeline-scrubber-range",className:"w-full range range-xs range-primary cursor-pointer accent-primary",onInput:d=>{const f=Number(d.currentTarget.value);Number.isFinite(f)&&r?.(new Date(f).toISOString())}})]})},ja=(e,t)=>`${e}:${t}`,Ba=(e,t)=>JSON.stringify([e,t]),oa=e=>e.replace(/[^a-zA-Z0-9_-]/g,"-"),bl=(e,t,n)=>e+t+n,rH=(e,t)=>{const n=e+t;return n>0?t/n*100:0},wd=e=>e.length<=12?e:`${e.slice(0,8)}…${e.slice(-4)}`,aH=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],sw=e=>{if(!e)return"—";const t=new Date(e);if(Number.isNaN(t.getTime()))return e;const n=aH[t.getUTCMonth()],r=t.getUTCDate(),a=String(t.getUTCHours()).padStart(2,"0"),s=String(t.getUTCMinutes()).padStart(2,"0");return`${n} ${r} ${a}:${s}`},Ad=e=>{if(!e)return"—";const t=new Date(e);if(Number.isNaN(t.getTime()))return e.slice(11,19)||e;const n=String(t.getUTCHours()).padStart(2,"0"),r=String(t.getUTCMinutes()).padStart(2,"0"),a=String(t.getUTCSeconds()).padStart(2,"0");return`${n}:${r}:${a}`},Jx=e=>`${wd(e.id)} · ${e.source} · ${sw(e.start)} · ${Ye(e.tokenLoad)}`,sH=e=>{const t=e.payload?.trim();return t&&t.length>0?t:e.title},ey=e=>e.split(/\r?\n/).map(n=>n.trim()).find(n=>n.length>0)??e,ty=e=>e.kind==="assistant"||e.eventType==="message"&&e.kind!=="user",iH=e=>{const t=(e.toolName||e.kind||"").toLowerCase();return t.includes("glob")?{label:e.toolName||"glob",color:"#6366f1"}:t.includes("grep")?{label:e.toolName||"grep",color:"#a855f7"}:t.includes("edit")||t.includes("write")||t.includes("patch")?{label:e.toolName||"edit",color:"#eab308"}:t.includes("read")||t.includes("view")||t.includes("list")?{label:e.toolName||"read",color:"#10b981"}:t.includes("bash")||t.includes("exec")||t.includes("command")||t.includes("terminal")?{label:e.toolName||"bash",color:"#3b82f6"}:t.includes("search")||t.includes("find")?{label:e.toolName||"search",color:"#a855f7"}:t.includes("run")?{label:e.toolName||"run",color:"#f59e0b"}:{label:e.toolName||e.kind,color:"#64748b"}},oH=()=>l.jsxs("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":"User icon",children:[l.jsx("path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}),l.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),lH=({promptTokens:e,fullText:t,tooltipId:n})=>{const[r,a]=g.useState(!1),s=e?.freshInputTokens??0,i=e?.cacheReadTokens??0,o=e?.outputTokens??0,u=bl(s,i,o),c=t.length>0?t.split(/\r?\n/).length:0,p=t.length;return l.jsxs("div",{className:"relative inline-flex items-center z-20",children:[l.jsx("button",{type:"button","aria-label":"Show user prompt token breakdown","aria-describedby":n,"data-testid":`timeline-user-badge-${n}`,className:"p-1 rounded bg-base-300 text-cyan-400 shrink-0 hover:bg-base-content/10 focus:outline-none focus-visible:ring-1 focus-visible:ring-primary transition-colors cursor-pointer",onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),onFocus:()=>a(!0),onBlur:()=>a(!1),onKeyDown:d=>{d.key==="Escape"&&a(!1)},children:l.jsx(oH,{})}),l.jsxs("div",{id:n,role:"tooltip","data-testid":n,className:`absolute left-0 top-full z-50 mt-1.5 w-56 p-2 rounded-lg bg-base-300 border border-base-content/20 shadow-2xl text-[11px] font-mono leading-relaxed pointer-events-none ${r?"block":"hidden"}`,children:[l.jsx("div",{className:"font-bold text-base-content mb-1",children:"User Prompt Telemetry"}),l.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-2 gap-y-0.5 text-base-content/80",children:[l.jsx("span",{className:"text-base-content/60",children:"Lines / chars:"}),l.jsxs("span",{children:[c," lines (",p," chars)"]}),l.jsx("span",{className:"text-base-content/60",children:"📥 Fresh input:"}),l.jsx("span",{children:Ye(s)}),l.jsx("span",{className:"text-base-content/60",children:"💾 Cache read:"}),l.jsx("span",{className:"text-cyan-400",children:Ye(i)}),l.jsx("span",{className:"text-base-content/60",children:"📤 Output:"}),l.jsx("span",{children:Ye(o)}),l.jsx("span",{className:"text-base-content/60 border-t border-base-content/10 pt-0.5",children:"⚡ Turn load:"}),l.jsx("span",{className:"font-bold border-t border-base-content/10 pt-0.5 text-primary",children:Ye(u)})]})]})]})},ny=({agentId:e,model:t,timestamp:n,tooltipId:r})=>{const[a,s]=g.useState(!1);return l.jsxs("div",{className:"relative inline-flex items-center z-20",children:[l.jsx("button",{type:"button","aria-label":`Show ${e} metadata`,"aria-describedby":r,"data-testid":`timeline-agent-badge-${r}`,className:"inline-flex items-center justify-center p-1 rounded hover:bg-base-content/10 text-base-content focus:outline-none focus-visible:ring-1 focus-visible:ring-primary transition-colors cursor-pointer",onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),onFocus:()=>s(!0),onBlur:()=>s(!1),onKeyDown:i=>{i.key==="Escape"&&s(!1)},children:l.jsx(ls,{id:e})}),l.jsxs("div",{id:r,role:"tooltip","data-testid":r,className:`absolute left-0 top-full z-50 mt-1.5 w-56 p-2 rounded-lg bg-base-300 border border-base-content/20 shadow-2xl text-[11px] font-mono leading-relaxed pointer-events-none ${a?"block":"hidden"}`,children:[l.jsxs("div",{className:"font-bold text-base-content mb-1 flex items-center gap-1.5",children:[l.jsx(ls,{id:e}),l.jsx("span",{children:e})]}),l.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-2 gap-y-0.5 text-base-content/80",children:[l.jsx("span",{className:"text-base-content/60",children:"Model:"}),l.jsx("span",{className:"truncate",children:t}),l.jsx("span",{className:"text-base-content/60",children:"Timestamp:"}),l.jsx("span",{className:"truncate",children:Ad(n)})]})]})]})},uH=({title:e,freshInputTokens:t,cacheReadTokens:n,outputTokens:r,color:a,tooltipId:s})=>{const[i,o]=g.useState(!1),u=bl(t,n,r);return l.jsxs("div",{className:"relative inline-flex items-center z-20",children:[l.jsx("button",{type:"button","aria-describedby":s,"data-testid":`timeline-tool-badge-${s}`,className:"px-1.5 py-0.5 rounded text-[10.5px] font-mono font-medium truncate max-w-[140px] sm:max-w-[200px] border focus:outline-none focus-visible:ring-1 focus-visible:ring-primary transition-colors cursor-pointer",style:{color:a,backgroundColor:`${a}18`,borderColor:`${a}40`},onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),onFocus:()=>o(!0),onBlur:()=>o(!1),onKeyDown:c=>{c.key==="Escape"&&o(!1)},children:e}),l.jsxs("div",{id:s,role:"tooltip","data-testid":s,className:`absolute left-0 top-full z-50 mt-1.5 w-52 p-2 rounded-lg bg-base-300 border border-base-content/20 shadow-2xl text-[11px] font-mono leading-relaxed pointer-events-none ${i?"block":"hidden"}`,children:[l.jsx("div",{className:"font-bold text-base-content mb-1",children:"Token Breakdown"}),l.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-2 gap-y-0.5 text-base-content/80",children:[l.jsx("span",{className:"text-base-content/60",children:"📥 Fresh input:"}),l.jsx("span",{children:Ye(t)}),l.jsx("span",{className:"text-base-content/60",children:"💾 Cache read:"}),l.jsx("span",{className:"text-cyan-400",children:Ye(n)}),l.jsx("span",{className:"text-base-content/60",children:"📤 Output:"}),l.jsx("span",{children:Ye(r)}),l.jsx("span",{className:"text-base-content/60 border-t border-base-content/10 pt-0.5",children:"⚡ Total:"}),l.jsx("span",{className:"font-bold border-t border-base-content/10 pt-0.5 text-primary",children:Ye(u)})]})]})]})},iw=({data:e,loading:t,error:n,mode:r="session",sessionId:a,availableSessions:s=[],onSelectSession:i,onModeChange:o,consolidatedTaskWbs:u="",consolidatedRunId:c="",onConsolidatedScopeSubmit:p})=>{const d=e?.scope.sessionId,f=e?.scope.source,[m,b]=g.useState({}),[E,x]=g.useState(!0),[y,S]=g.useState(!0),[w,A]=g.useState(!0),[D,N]=g.useState(u),[T,v]=g.useState(c),R=d&&f?Ba(f,d):"consolidated",C=m[R]||{},U=Q=>{b(_e=>({..._e,[R]:Q(_e[R]||{})}))},k=(Q,_e)=>{const fe=ja(Q,_e);U(X=>({...X,[fe]:!X[fe]}))};if(t)return l.jsx("div",{className:"flex items-center justify-center p-16",children:l.jsx("div",{className:"w-8 h-8 rounded-full border-4 border-primary border-t-transparent animate-spin motion-reduce:animate-none"})});if(n)return l.jsx("div",{className:"p-4 rounded-lg bg-error/10 border border-error/20 text-error",children:l.jsxs("span",{children:["Failed to load timeline: ",n]})});if(!e)return l.jsx("div",{className:"p-4 rounded-lg bg-info/10 border border-info/20 text-info",children:l.jsx("span",{children:"No timeline data available."})});const{scope:j,blocks:G,truncated:$}=e,te=bl(j.tokens.freshInputTokens,j.tokens.cacheReadTokens,j.tokens.outputTokens),H=rH(j.tokens.freshInputTokens,j.tokens.cacheReadTokens),se=G.map(Q=>{const _e=Q.events.filter(fe=>ty(fe)?!E:fe.kind==="unknown"||fe.agent==="unknown"?!y:!(w&&!fe.payload?.trim()&&(fe.durationMs===null||fe.durationMs===0)&&bl(fe.freshInputTokens,fe.cacheReadTokens,fe.outputTokens)===0));return{...Q,events:_e}}).filter(Q=>Q.events.length>0),de=se.flatMap(Q=>Q.events.filter(_e=>!!_e.payload?.trim()).map(_e=>ja(Q.key,_e.seq))),O=de.length>0&&de.every(Q=>C[Q]),ne=()=>U(()=>O?{}:Object.fromEntries(de.map(Q=>[Q,!0]))),pe=s.findIndex(Q=>Q.id===j.sessionId&&Q.source===j.source),L=pe>0?s[pe-1]:void 0,ke=pe>=0&&pe<s.length-1?s[pe+1]:void 0,Re=Q=>{const _e=Date.parse(Q),fe=se.find(X=>{const Ve=X.timestamp?Date.parse(X.timestamp):Number.NaN;return Number.isFinite(Ve)&&Ve>=_e})??se.at(-1);fe&&document.getElementById(`timeline-block-${oa(fe.key)}`)?.scrollIntoView({behavior:"smooth",block:"center"})};return l.jsxs("div",{className:"flex flex-col gap-6",children:[l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 p-5 flex flex-col gap-4",children:[l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[l.jsx("h3",{className:"text-base font-bold tracking-tight",children:"Conversation"}),l.jsxs("fieldset",{className:"inline-flex border border-base-content/20 rounded-lg p-0.5 bg-base-300 font-mono text-xs",children:[l.jsx("legend",{className:"sr-only",children:"Timeline mode"}),l.jsx("button",{type:"button","data-testid":"timeline-mode-session","aria-pressed":r==="session",className:`px-2.5 py-1 rounded-md transition-colors ${r==="session"?"bg-primary text-primary-content font-bold":"text-base-content/70 hover:text-base-content"}`,onClick:()=>o?.("session"),children:"Single Session"}),l.jsx("button",{type:"button","data-testid":"timeline-mode-consolidated","aria-pressed":r==="consolidated",className:`px-2.5 py-1 rounded-md transition-colors ${r==="consolidated"?"bg-primary text-primary-content font-bold":"text-base-content/70 hover:text-base-content"}`,onClick:()=>o?.("consolidated"),children:"Consolidated"})]})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3",children:[r==="session"?l.jsxs(l.Fragment,{children:[l.jsxs("label",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"sr-only",children:"Session"}),l.jsx("select",{"aria-label":"Select Session","data-testid":"timeline-session-select",className:"px-3 py-1.5 min-h-[44px] text-xs rounded-lg border border-base-content/20 bg-base-300 font-mono text-base-content max-w-xs focus:outline-none focus-visible:ring-2 focus-visible:ring-primary",value:j.source&&j.sessionId?Ba(j.source,j.sessionId):"",onChange:Q=>{const _e=s.find(fe=>Ba(fe.source,fe.id)===Q.target.value);_e&&i?.(_e.source,_e.id)},children:s.length>0?s.map(Q=>l.jsx("option",{value:Ba(Q.source,Q.id),children:Jx(Q)},Ba(Q.source,Q.id))):l.jsx("option",{value:j.source&&j.sessionId?Ba(j.source,j.sessionId):"",children:j.sessionId?Jx({id:j.sessionId,source:j.source??"unknown",start:j.start??"",tokenLoad:te}):"No session selected"})})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{type:"button","aria-label":"Previous session",disabled:!L,className:"px-3 py-2 min-h-[44px] min-w-[44px] inline-flex items-center justify-center text-xs font-mono rounded-lg border border-base-content/20 bg-base-300 text-base-content/80 disabled:opacity-40 disabled:cursor-not-allowed hover:bg-base-content/10 transition-colors focus-visible:ring-2 focus-visible:ring-primary",onClick:()=>L&&i?.(L.source,L.id),children:"←"}),l.jsx("button",{type:"button","aria-label":"Next session",disabled:!ke,className:"px-3 py-2 min-h-[44px] min-w-[44px] inline-flex items-center justify-center text-xs font-mono rounded-lg border border-base-content/20 bg-base-300 text-base-content/80 disabled:opacity-40 disabled:cursor-not-allowed hover:bg-base-content/10 transition-colors focus-visible:ring-2 focus-visible:ring-primary",onClick:()=>ke&&i?.(ke.source,ke.id),children:"→"})]})]}):l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-base-300 border border-base-content/20 text-xs font-mono",children:[l.jsx("span",{className:"text-base-content/60",children:"Scope:"}),l.jsxs("span",{className:"font-semibold text-primary",children:[j.sessionCount," sessions"]})]}),l.jsxs("form",{className:"flex flex-wrap items-end gap-2",onSubmit:Q=>{Q.preventDefault(),p?.({taskWbs:D.trim(),runId:T.trim()})},children:[l.jsxs("label",{className:"flex flex-col gap-1 text-[10px] font-mono text-base-content/60",children:["Task WBS",l.jsx("input",{type:"text",value:D,onInput:Q=>N(Q.currentTarget.value),className:"min-h-[44px] w-28 rounded-lg border border-base-content/20 bg-base-300 px-2 text-xs text-base-content focus:outline-none focus-visible:ring-2 focus-visible:ring-primary"})]}),l.jsxs("label",{className:"flex flex-col gap-1 text-[10px] font-mono text-base-content/60",children:["Run ID",l.jsx("input",{type:"text",value:T,onInput:Q=>v(Q.currentTarget.value),className:"min-h-[44px] w-40 rounded-lg border border-base-content/20 bg-base-300 px-2 text-xs text-base-content focus:outline-none focus-visible:ring-2 focus-visible:ring-primary"})]}),l.jsx("button",{type:"submit",className:"min-h-[44px] rounded-lg bg-primary px-3 text-xs font-semibold text-primary-content focus-visible:ring-2 focus-visible:ring-primary",children:"Apply scope"})]})]}),l.jsx("button",{type:"button","aria-pressed":O,disabled:de.length===0,className:"px-3.5 py-2 min-h-[44px] rounded-lg text-xs font-semibold border border-primary/30 text-primary hover:bg-primary/10 disabled:opacity-40 disabled:cursor-not-allowed transition-colors focus-visible:ring-2 focus-visible:ring-primary",onClick:ne,children:O?"Collapse all":"Expand all"}),l.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs font-mono text-base-content/80",children:[l.jsxs("label",{className:"inline-flex items-center gap-1.5 cursor-pointer select-none",children:[l.jsx("input",{type:"checkbox","data-testid":"timeline-filter-assistant",className:"w-3.5 h-3.5 rounded border border-base-content/30 accent-primary focus-visible:ring-1 focus-visible:ring-primary",checked:E,onChange:Q=>x(Q.target.checked)}),l.jsx("span",{children:"Hide assistant"})]}),l.jsxs("label",{className:"inline-flex items-center gap-1.5 cursor-pointer select-none",children:[l.jsx("input",{type:"checkbox","data-testid":"timeline-filter-unknown",className:"w-3.5 h-3.5 rounded border border-base-content/30 accent-primary focus-visible:ring-1 focus-visible:ring-primary",checked:y,onChange:Q=>S(Q.target.checked)}),l.jsx("span",{children:"Hide unknown"})]}),l.jsxs("label",{className:"inline-flex items-center gap-1.5 cursor-pointer select-none",children:[l.jsx("input",{type:"checkbox","data-testid":"timeline-filter-empty",className:"w-3.5 h-3.5 rounded border border-base-content/30 accent-primary focus-visible:ring-1 focus-visible:ring-primary",checked:w,onChange:Q=>A(Q.target.checked)}),l.jsx("span",{children:"Hide other empty"})]})]})]})]}),l.jsxs("div",{"data-testid":"timeline-metadata-strip",className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-5 lg:grid-cols-9 gap-3 pt-3 border-t border-base-content/10 text-xs font-mono",children:[l.jsxs("div",{className:"flex flex-col",children:[l.jsx("span",{className:"text-[10px] uppercase tracking-wider text-base-content/60",children:r==="session"?"SESSION":"SESSIONS"}),l.jsx("span",{className:"font-semibold truncate",title:j.sessionId??`${j.sessionCount} sessions`,children:j.sessionId?wd(j.sessionId):`${j.sessionCount} total`})]}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("span",{className:"text-[10px] uppercase tracking-wider text-base-content/60",children:"AGENT"}),l.jsx("span",{className:"inline-flex items-center gap-1 font-semibold truncate",children:j.source?l.jsxs(l.Fragment,{children:[l.jsx(ls,{id:j.source}),j.source]}):"multiple"})]}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("span",{className:"text-[10px] uppercase tracking-wider text-base-content/60",children:"MODEL"}),l.jsxs("span",{className:"inline-flex items-center gap-1.5 truncate",children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-primary/70 shrink-0"}),j.model??"multiple"]})]}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("span",{className:"text-[10px] uppercase tracking-wider text-base-content/60",children:"STARTED"}),l.jsx("span",{className:"truncate",children:sw(j.start)})]}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("span",{className:"text-[10px] uppercase tracking-wider text-base-content/60",children:"DURATION"}),l.jsx("span",{className:"font-semibold truncate",children:ew(j.durationMs/6e4)})]}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("span",{className:"text-[10px] uppercase tracking-wider text-base-content/60",children:"TOTAL TOKENS"}),l.jsx("span",{className:"font-bold text-primary truncate",children:Ye(te)})]}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("span",{className:"text-[10px] uppercase tracking-wider text-base-content/60",children:"CACHE READ"}),l.jsxs("span",{className:"font-semibold text-cyan-400 truncate",children:[H.toFixed(1),"%"]})]}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("span",{className:"text-[10px] uppercase tracking-wider text-base-content/60",children:"OUTPUT TOKENS"}),l.jsx("span",{className:"truncate",children:Ye(j.tokens.outputTokens)})]}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("span",{className:"text-[10px] uppercase tracking-wider text-base-content/60",children:"TOOL CALLS"}),l.jsx("span",{className:"truncate",children:mn(j.toolCallCount)})]})]}),l.jsx(nH,{blocks:se,start:j.start,end:j.end,onJumpToTime:Re})]}),$&&l.jsxs("div",{"data-testid":"timeline-truncated-banner",className:"p-3 rounded-lg bg-info/10 border border-info/20 text-info font-mono text-xs flex items-center gap-2",children:[l.jsx("span",{children:"ℹ️"}),l.jsx("span",{children:"Showing newest 5,000 events. Apply a narrower filter or time window to inspect earlier events."})]}),l.jsx("div",{"data-testid":"timeline-rail",className:"relative py-2 sm:py-4 before:absolute before:left-2 sm:before:left-[136px] before:top-0 before:bottom-0 before:w-px before:bg-gradient-to-b before:from-transparent before:via-base-content/20 before:to-transparent flex flex-col gap-3",children:se.map(Q=>{const _e=Q.events.filter(X=>X.kind==="user"),fe=Q.events.filter(X=>X.kind!=="user");return l.jsxs("div",{id:`timeline-block-${oa(Q.key)}`,"data-testid":`timeline-block-${Q.key}`,className:"flex flex-col gap-2.5",children:[r==="consolidated"&&l.jsxs("div",{className:"flex items-center gap-2 pl-6 sm:pl-[144px] pt-2 pb-1 font-mono text-xs text-base-content/70",children:[l.jsx(ls,{id:Q.source}),l.jsx("span",{className:"font-bold text-base-content",children:Q.source}),l.jsxs("span",{children:["· ",wd(Q.sessionId)]}),l.jsxs("span",{children:["· Turn #",Q.turnIndex]}),Q.correlationExactness&&l.jsx("span",{"data-testid":`timeline-exactness-${Q.key}`,className:`px-1.5 py-0.2 rounded text-[10px] font-bold ${Q.correlationExactness==="exact"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-amber-500/10 text-amber-400 border border-amber-500/20"}`,children:Q.correlationExactness})]}),_e.map(X=>{const Ve=sH(X),ge=X.payload?.trim()??"",me=ey(Ve),Te=!!X.payload?.trim(),ve=!!C[ja(Q.key,X.seq)],ie=oa(`timeline-user-drawer-${Q.key}-${X.seq}`),Ze=oa(`user-tt-${Q.key}-${X.seq}`);return l.jsxs("div",{className:"relative flex flex-col sm:grid sm:grid-cols-[136px_minmax(0,1fr)] py-1","data-testid":`timeline-user-event-${Q.key}-${X.seq}`,children:[l.jsxs("div",{className:"hidden sm:flex flex-col items-end justify-center pr-4 font-mono text-[10.5px] text-base-content/70",children:[l.jsx("span",{className:"font-semibold text-base-content/90",children:Ad(Q.timestamp)}),l.jsxs("span",{className:"text-[10px] text-base-content/50",children:["📥 ",Ye(X.freshInputTokens)," in"]})]}),l.jsx("span",{"data-timeline-node":"prompt",className:"absolute left-[3.5px] sm:left-[131.5px] top-1/2 -translate-y-1/2 w-[9px] h-[9px] rounded-full bg-cyan-400 ring-4 ring-base-100 z-10","aria-hidden":"true"}),l.jsx("div",{className:"pl-6 sm:pl-5 min-w-0 flex justify-end",children:l.jsxs("div",{className:"w-[80%] max-w-none bg-base-100 rounded-lg border border-primary/20 hover:border-primary/40 transition-colors p-2 sm:px-3 sm:py-2 flex flex-col gap-1",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2 min-h-[32px]",children:[l.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[l.jsx(lH,{promptTokens:X.promptTokens,fullText:ge,tooltipId:Ze}),l.jsx("span",{className:"font-mono text-xs font-semibold text-base-content/90 truncate min-w-0",children:me})]}),l.jsx("div",{className:"flex items-center gap-2 shrink-0 font-mono text-[11px] text-base-content/60",children:Te?l.jsx("button",{type:"button","aria-label":ve?"Collapse full user prompt":"Expand full user prompt","aria-expanded":ve,"aria-controls":ie,onClick:()=>k(Q.key,X.seq),className:"p-1 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 inline-flex items-center justify-center text-base-content/60 hover:text-base-content transition-colors cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-primary rounded",children:l.jsx("span",{className:`text-xs font-mono transition-transform duration-150 ${ve?"rotate-90":""}`,"aria-hidden":"true",children:"›"})}):null})]}),ve&&Te&&l.jsx("div",{id:ie,className:"mt-1 p-3 bg-[#0d141f] text-slate-100 rounded-md font-mono text-xs whitespace-pre-wrap overflow-x-auto border border-white/10",children:Ve})]})})]},ja(Q.key,X.seq))}),fe.map(X=>{const Ve=iH(X),ge=!!C[ja(Q.key,X.seq)],me=!!X.payload?.trim(),Te=oa(`timeline-op-drawer-${Q.key}-${X.seq}`),ve=oa(`agent-tt-${Q.key}-${X.seq}`),ie=oa(`tool-tt-${Q.key}-${X.seq}`),Ze=ty(X);return l.jsxs("div",{className:"relative flex flex-col sm:grid sm:grid-cols-[136px_minmax(0,1fr)] py-1 hover:z-30 focus-within:z-30","data-testid":`timeline-op-event-${Q.key}-${X.seq}`,children:[l.jsxs("div",{className:"hidden sm:flex flex-col items-end justify-center pr-4 font-mono text-[10.5px] text-base-content/70",children:[l.jsx("span",{className:"font-semibold text-base-content/90",children:Ad(Q.timestamp)}),X.durationSource==="measured"&&X.durationMs!==null?l.jsxs("span",{"data-testid":`timeline-step-duration-${Q.key}-${X.seq}`,className:X.durationMs>=5e3?"font-bold text-amber-400":"text-base-content/60",children:["⏱ ",yd(X.durationMs)]}):X.durationSource==="inferred"&&X.durationMs!==null?l.jsxs("span",{"data-testid":`timeline-step-duration-${Q.key}-${X.seq}`,title:"Inferred from next event timestamp within session",className:"text-base-content/60 italic",children:["⏱ ~",yd(X.durationMs)]}):l.jsx("span",{"data-testid":`timeline-step-duration-${Q.key}-${X.seq}`,title:"Unmeasured (gap > 10m or last event)",className:"text-base-content/40",children:"⏱ —"})]}),l.jsx("span",{"data-timeline-node":"operation",className:"absolute left-[3.5px] sm:left-[131.5px] top-1/2 -translate-y-1/2 w-[9px] h-[9px] rounded-full ring-4 ring-base-100 z-10",style:{backgroundColor:Ve.color},"aria-hidden":"true"}),l.jsx("div",{className:"pl-6 sm:pl-5 min-w-0 flex justify-start",children:Ze?l.jsxs("div",{className:"w-[80%] max-w-none bg-base-100 rounded-lg border border-base-content/10 border-l-[3px] border-l-primary/70 transition-colors relative",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2 px-2.5 py-1.5 min-h-[38px]",children:[l.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[l.jsx(ny,{agentId:X.agent||Q.source,model:X.model||Q.model,timestamp:Q.timestamp,tooltipId:ve}),l.jsx("span",{className:"font-mono text-xs text-base-content/60 truncate",children:X.model}),l.jsx("span",{className:"font-mono text-xs text-base-content/90 truncate min-w-0",children:ey(X.payload||X.title)})]}),l.jsxs("div",{className:"flex items-center gap-2 shrink-0 font-mono text-[11px] text-base-content/60",children:[l.jsxs("span",{children:["📤 ",Ye(X.outputTokens)]}),me?l.jsx("button",{type:"button","aria-label":ge?"Collapse response":"Expand response","aria-expanded":ge,"aria-controls":Te,onClick:()=>k(Q.key,X.seq),className:"p-1 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 inline-flex items-center justify-center text-base-content/60 hover:text-base-content transition-colors cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-primary rounded",children:l.jsx("span",{className:`text-xs font-mono transition-transform duration-150 ${ge?"rotate-90":""}`,"aria-hidden":"true",children:"›"})}):null]})]}),ge&&X.payload&&l.jsx("div",{id:Te,className:"p-3 bg-[#0d141f] text-slate-100 font-mono text-xs whitespace-pre-wrap overflow-x-auto rounded-b-lg border-t border-base-content/10",children:X.payload})]}):l.jsxs("div",{className:"w-[80%] max-w-none bg-base-100 rounded-lg border border-base-content/10 border-l-[3px] transition-colors relative",style:{borderLeftColor:Ve.color},children:[l.jsxs("div",{className:"flex items-center justify-between gap-2 px-2.5 py-1.5 min-h-[38px]",children:[l.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[l.jsx(ny,{agentId:X.agent||Q.source,model:X.model||Q.model,timestamp:Q.timestamp,tooltipId:ve}),l.jsx(uH,{title:Ve.label,freshInputTokens:X.freshInputTokens,cacheReadTokens:X.cacheReadTokens,outputTokens:X.outputTokens,color:Ve.color,tooltipId:ie}),X.title&&X.title.trim().length>0?l.jsx("span",{className:"font-mono text-xs font-semibold text-base-content/90 truncate min-w-0",title:X.title,children:X.title}):null]}),l.jsxs("div",{className:"flex items-center gap-2 shrink-0 font-mono",children:[X.exitCode!==null&&l.jsxs("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-bold ${X.exitCode===0?"bg-emerald-500/20 text-emerald-400 border border-emerald-500/30":"bg-error/20 text-error border border-error/30"}`,children:["EXIT_CODE=",X.exitCode]}),me?l.jsx("button",{type:"button","aria-label":ge?"Collapse operation payload":"Expand operation payload","aria-expanded":ge,"aria-controls":Te,onClick:()=>k(Q.key,X.seq),className:"p-1 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 inline-flex items-center justify-center text-base-content/60 hover:text-base-content transition-colors cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-primary rounded",children:l.jsx("span",{className:`text-xs font-mono transition-transform duration-150 ${ge?"rotate-90":""}`,"aria-hidden":"true",children:"›"})}):null]})]}),ge&&X.payload&&l.jsx("div",{id:Te,className:"p-3 bg-[#0d141f] text-slate-100 font-mono text-xs whitespace-pre-wrap overflow-x-auto rounded-b-lg border-t border-base-content/10",children:X.payload})]})})]},ja(Q.key,X.seq))})]},Q.key)})})]})},cH=[{id:"summary",label:"Summary",component:aw},{id:"timeline",label:"Timeline",component:iw},{id:"sessions",label:"Sessions",component:nw},{id:"insights",label:"Insights",component:tw},{id:"sources",label:"Sources",component:rw}],ko=(e,t)=>{const n=new Map;for(const r of e)n.set(r.id,r);for(const r of t??[])n.has(r)||n.set(r,{id:r,label:r});return[...n.values()]},dH=e=>e.range==="24h"?"Last 24h":e.range==="7d"?"Last 7d":e.range==="30d"?"Last 30d":e.range==="all"?"All time":`${e.from?.slice(0,10)??"…"} → ${e.to?.slice(0,10)??"…"}`,wc=e=>e instanceof Error?e.message:String(e),pH=()=>{const[e,t]=g.useState("summary"),[n,r]=g.useState({range:"30d",bucket:"auto",dimension:"model"}),[a,s]=g.useState("session"),[i,o]=g.useState(null),[u,c]=g.useState({taskWbs:"",runId:""}),[p,d]=g.useState(1),[f,m]=g.useState("start"),[b,E]=g.useState("desc"),[x,y]=g.useState(void 0),[S,w]=g.useState(void 0),[A,D]=g.useState(void 0),[N,T]=g.useState(void 0),[v,R]=g.useState(void 0),[C,U]=g.useState([]),[k,j]=g.useState(!1),[G,$]=g.useState(!0),[te,H]=g.useState(null),[se,de]=g.useState(!0),[O,ne]=g.useState(null),[pe,L]=g.useState(!0),[ke,Re]=g.useState(null),[Q,_e]=g.useState(!1),[fe,X]=g.useState(null),[Ve,ge]=g.useState(!1),[me,Te]=g.useState(null);g.useEffect(()=>{let J=!0;return $(!0),H(null),de(!0),ne(null),(async()=>{const[ue,Pe]=await Promise.allSettled([sn.history.getSummary(n),sn.history.getInsights(n)]);J&&(ue.status==="fulfilled"&&ue.value?.data?y(ue.value.data):H("Failed to load summary"),Pe.status==="fulfilled"&&Pe.value?.data?T(Pe.value.data):ne("Failed to load insights"),$(!1),de(!1))})(),()=>{J=!1}},[n]),g.useEffect(()=>{let J=!0;return L(!0),Re(null),(async()=>{try{const ue=await sn.history.getSources();if(!J)return;ue?.data?R(ue.data):Re("Failed to load sources")}catch(ue){J&&Re(wc(ue))}finally{J&&L(!1)}})(),()=>{J=!1}},[]),g.useEffect(()=>{if(e!=="timeline")return;let J=!0;return j(!0),(async()=>{try{const ue=await sn.history.getSessions({filter:n,page:1,pageSize:100,sortBy:"start",sortDir:"desc"});if(!J)return;const Pe=(ue?.data?.items??[]).map(ht=>({id:ht.id,source:ht.source,model:ht.model,start:ht.start,tokenLoad:ht.freshInputTokens+ht.cacheReadTokens+ht.outputTokens}));U(Pe);const qe=Pe[0];qe&&!i&&o({source:qe.source,id:qe.id})}catch{J&&U([])}finally{J&&j(!1)}})(),()=>{J=!1}},[e,n,i]),g.useEffect(()=>{if(e!=="sessions")return;let J=!0;return _e(!0),X(null),(async()=>{try{const ue=await sn.history.getSessions({filter:n,page:p,pageSize:20,sortBy:f,sortDir:b});if(!J)return;ue?.data?D(ue.data):X("Failed to load sessions")}catch(ue){J&&X(wc(ue))}finally{J&&_e(!1)}})(),()=>{J=!1}},[e,n,p,f,b]),g.useEffect(()=>{if(e!=="timeline")return;if(a==="session"&&!i){const ue=C[0];!k&&ue&&o({source:ue.source,id:ue.id});return}let J=!0;return ge(!0),Te(null),(async()=>{try{const ue=a==="session"&&i?await sn.history.getTimeline({mode:"session",source:i.source,sessionId:i.id}):await sn.history.getTimeline({mode:"consolidated",filter:n,...u.taskWbs?{taskWbs:u.taskWbs}:{},...u.runId?{runId:u.runId}:{}});if(!J)return;ue?.data?w(ue.data):Te("Failed to load timeline")}catch(ue){J&&Te(wc(ue))}finally{J&&ge(!1)}})(),()=>{J=!1}},[e,a,i,n,k,C,u]);const ve=(J,ue)=>{o({source:J,id:ue}),s("session"),t("timeline")},ie=(J,ue)=>{const Pe=ue?{source:ue,id:J}:A?.items.find(qe=>qe.id===J)??C.find(qe=>qe.id===J);Pe&&ve(Pe.source,Pe.id)},Ze=async J=>(await sn.history.triggerImport({mode:J})).data,ot=te?"—":G||x===void 0?"…":String(x.kpis.sessionsCount),rt=O?"—":se||N===void 0?"…":String(N.loops.length),Ht=ke?"—":pe||v===void 0?"…":String(v.agents.length),St={summary:null,timeline:null,sessions:ot,insights:rt,sources:Ht},Ct=ke?"—":pe?"…":v?.overview.lastImportedAt?new Date(v.overview.lastImportedAt).toLocaleString():"never imported",Zt=N?{count:N.loops.length,redundantCalls:N.loops.reduce((J,ue)=>J+Math.max(0,ue.repeats-1),0),wastedTokens:N.loops.reduce((J,ue)=>J+ue.wastedTokens,0)}:void 0,at=ko(v?.agents.map(J=>({id:J.id,label:J.name,color:J.color}))??[],n.sources),De=ko(x?.topModels.map(J=>({id:J.id,label:J.label,color:J.color}))??[],n.models),et=ko(x?.topTools.map(J=>({id:J.id,label:J.id}))??[],n.tools),Z=ko(x?.skillsUsed.map(J=>({id:J.id,label:J.label,color:J.color}))??[],n.skills),oe={rangeLabel:dH(n),sessionCount:te?null:G&&x===void 0?void 0:x?.kpis.sessionsCount,sourceCount:n.sources?.length??v?.agents.length};return l.jsxs("div",{className:"flex flex-col gap-4 p-4 max-w-[1600px] mx-auto w-full",children:[l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4 border-b border-base-content/10 pb-3",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("span",{className:"text-2xl",children:"📊"}),l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl font-bold tracking-tight",children:"History"}),l.jsx("p",{className:"text-xs text-base-content/60",children:"Transcript telemetry, session traces, and prompt cache analytics"}),l.jsxs("p",{className:"livechip mt-1 inline-flex items-center gap-1.5 rounded-full border border-base-content/10 px-2 py-0.5 text-xs text-base-content/60 font-mono","data-testid":"history-last-import",role:"status",children:[l.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${ke?"bg-error":"bg-emerald-400 animate-pulse"}`,"aria-hidden":"true"}),"last import ",Ct]})]})]}),l.jsx("div",{className:"flex items-center gap-1 bg-base-300 p-1 rounded-xl",children:cH.map(J=>l.jsxs("button",{type:"button",className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-all ${e===J.id?"bg-primary text-primary-content font-bold shadow-sm":"text-base-content/70 hover:bg-base-content/10"}`,onClick:()=>t(J.id),children:[J.label,St[J.id]!==null&&l.jsx("span",{className:"ml-1.5 px-1.5 py-0.5 rounded-full text-[10px] font-mono bg-base-content/10","data-testid":`history-badge-${J.id}`,children:St[J.id]})]},J.id))})]}),e!=="sources"&&l.jsx(Wz,{filter:n,onChange:r,sourceOptions:at,modelOptions:De,toolOptions:et,skillOptions:Z,scope:oe}),l.jsxs("div",{className:"mt-2",children:[e==="summary"&&l.jsx(aw,{data:x,loading:G,error:te,dimension:n.dimension??"model",onDimensionChange:J=>r(ue=>({...ue,dimension:J})),bucket:n.bucket??"auto",onBucketChange:J=>r(ue=>({...ue,bucket:J})),loopSummary:Zt}),e==="timeline"&&l.jsx(iw,{data:S,loading:Ve,error:me,mode:a,sessionId:i?.id,sessionSource:i?.source,availableSessions:C,onSelectSession:ve,onModeChange:s,consolidatedTaskWbs:u.taskWbs,consolidatedRunId:u.runId,onConsolidatedScopeSubmit:c}),e==="sessions"&&l.jsx(nw,{data:A,loading:Q,error:fe,sortBy:f,sortDir:b,page:p,pageSize:20,onSortChange:J=>{f===J?E(ue=>ue==="asc"?"desc":"asc"):(m(J),E("desc"))},onPageChange:d,onSelectSession:ve}),e==="insights"&&l.jsx(tw,{data:N,loading:se,error:O,cacheHitTrend:x?.kpiTrend??[],onSelectSession:ie}),e==="sources"&&l.jsx(rw,{data:v,loading:pe,error:ke,onTriggerImport:Ze})]})]})},fH={id:"history",name:"History",icon:"📊",route:"history",component:pH,sidebarLabel:"History",order:3},mH=Object.freeze(Object.defineProperty({__proto__:null,module:fH},Symbol.toStringTag,{value:"Module"}));function hH(e){if(!e||typeof e!="object"||!("teams"in e))return null;const t=e.teams;if(!Array.isArray(t))return null;const n=[];for(const r of t){if(!r||typeof r!="object")continue;const a=r;if(typeof a.teamId!="string"||typeof a.name!="string"||!Array.isArray(a.members))continue;const s=[];for(const i of a.members){if(!i||typeof i!="object")continue;const o=i;typeof o.id!="string"||typeof o.type!="string"||typeof o.status!="string"||s.push({id:o.id,type:o.type,status:o.status,...typeof o.model=="string"&&o.model.length>0?{model:o.model}:{},...typeof o.autoStart=="boolean"?{autoStart:o.autoStart}:{},...typeof o.pid=="number"?{pid:o.pid}:{},...typeof o.role=="string"&&o.role.length>0?{role:o.role}:{},...typeof o.executor=="string"&&o.executor.length>0?{executor:o.executor}:{}})}n.push({teamId:a.teamId,name:a.name,workDir:typeof a.workDir=="string"?a.workDir:null,isCurrentProject:a.isCurrentProject===!0,members:s})}return n}const gH=()=>`${Nt()}/team/teams`,bH=5e3;function ws(){const[e,t]=g.useState([]),[n,r]=g.useState(null),a=g.useRef(!0),s=g.useCallback(async()=>{try{const i=await Tt(new Request(gH()));if(!i.ok)throw new Error(`teams fetch failed: ${i.status}`);const o=await i.json(),u=hH(o);u&&a.current&&(t(u),r(null))}catch(i){a.current&&r(i instanceof Error?i.message:String(i))}},[]);return g.useEffect(()=>{a.current=!0,s();const i=setInterval(s,bH);return()=>{a.current=!1,clearInterval(i)}},[s]),{teams:e,error:n,reload:s}}const EH=(e=50)=>`${Nt()}/messages?limit=${e}`,xH=()=>`${Nt()}/events/planning`,yH=new Set(["message.sent","message.replied"]);function ry(e,t){if(e&&typeof e=="object"){const n=e;return{agentId:typeof n.agentId=="string"&&n.agentId.length>0?n.agentId:t,...typeof n.teamId=="string"&&n.teamId?{teamId:n.teamId}:{},...typeof n.teamName=="string"&&n.teamName?{teamName:n.teamName}:{},...typeof n.memberLabel=="string"&&n.memberLabel?{memberLabel:n.memberLabel}:{},...typeof n.agentType=="string"&&n.agentType?{agentType:n.agentType}:{}}}return{agentId:t}}function TH(e){if(!e||typeof e!="object"||!("messages"in e))return null;const t=e.messages;if(!Array.isArray(t))return null;const n=[];for(const r of t){if(!r||typeof r!="object")continue;const a=r;if(typeof a.id!="string"||typeof a.toId!="string"||typeof a.body!="string"||typeof a.status!="string"||typeof a.createdAt!="string")continue;const s=a.fromId===null||a.fromId===void 0?null:typeof a.fromId=="string"?a.fromId:null;n.push({id:a.id,fromId:s,toId:a.toId,body:a.body,status:a.status,createdAt:a.createdAt,inReplyTo:typeof a.inReplyTo=="string"?a.inReplyTo:null,hasReply:a.hasReply===!0,replyCount:typeof a.replyCount=="number"&&Number.isFinite(a.replyCount)?a.replyCount:0,...s!==null?{from:ry(a.from,s)}:{},to:ry(a.to,a.toId)})}return n}function ow(e,t){return e.filter(n=>n.to.teamId===t||n.from?.teamId===t)}function bb(){const[e,t]=g.useState(null),[n,r]=g.useState(null),a=g.useCallback(async s=>{try{const i=await Tt(new Request(EH(),{signal:s}));if(!i.ok)throw new Error(`messages fetch failed: ${i.status}`);const o=TH(await i.json());o&&t(o)}catch(i){if(s?.aborted)return;r(i instanceof Error?i.message:String(i))}},[]);return g.useEffect(()=>{const s=new AbortController;a(s.signal);const i=setInterval(()=>{a(s.signal)},1e4);return()=>{s.abort(),clearInterval(i)}},[a]),g.useEffect(()=>{if(typeof EventSource>"u")return;const s=new AbortController,i=new EventSource(xH());return i.onmessage=o=>{try{const u=JSON.parse(o.data);if(u===null||typeof u!="object")return;const c=u.eventName;typeof c=="string"&&yH.has(c)&&a(s.signal)}catch{}},()=>{s.abort(),i.close()}},[a]),{messages:e,error:n}}function Eb({messages:e}){return e.length===0?l.jsx("div",{className:"p-4 text-sm text-spur-text-muted italic","data-message-feed-empty":!0,children:"No messages yet."}):l.jsx("ul",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:e.map(t=>{const n=t.from?[t.from.memberLabel??t.from.agentId,t.from.agentType].filter(Boolean).join(" · "):t.fromId??"system",r=[t.to.memberLabel??t.to.agentId,t.to.agentType].filter(Boolean).join(" · "),a=t.from?.teamName,s=t.to.teamName,i=t.status==="injected"?"injected":t.status==="queued"?"queued":null;return l.jsxs("li",{className:"p-2 bg-spur-surface-2 border border-spur-border rounded-xl text-sm",children:[l.jsxs("div",{className:"flex items-center gap-2 text-spur-text-muted text-xs",children:[l.jsxs("span",{"data-message-route":!0,className:"truncate",children:[a&&l.jsxs("span",{className:"text-xs opacity-70",children:[a," / "]}),l.jsx("span",{children:n}),l.jsx("span",{className:"mx-1",children:"→"}),s&&l.jsxs("span",{className:"text-xs opacity-70",children:[s," / "]}),l.jsx("span",{children:r})]}),i&&l.jsx("span",{className:`text-xs px-1 rounded ${i==="injected"?"bg-success/20 text-success":"bg-warning/20 text-warning"}`,"data-message-delivery":!0,children:i}),l.jsx("span",{className:`text-xs ${t.hasReply?"text-info":"text-spur-text-muted"}`,"data-message-reply-badge":!0,"data-message-reply-state":t.hasReply?"replied":"awaiting",children:t.hasReply?t.replyCount>1?`Replied (${t.replyCount})`:"Replied":"Awaiting reply"}),l.jsx("span",{className:"ml-auto font-mono text-xs text-spur-text-muted",children:t.createdAt})]}),l.jsx("p",{className:"text-spur-text mt-1 whitespace-pre-wrap break-words",children:t.body})]},t.id)})})}function SH({teamId:e}){const{messages:t,error:n}=bb();if(n)return l.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load messages: ",n]});if(t===null)return l.jsx("div",{className:"p-4 text-sm text-spur-text-muted",children:"Loading messages…"});const r=e?ow(t,e):t;return l.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-spur-bg","data-all-tab":!0,children:[l.jsx("div",{className:"px-4 py-2 border-b border-spur-border bg-spur-surface shrink-0",children:l.jsx("span",{className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide",children:e?`Message · ${e}`:"Message · all teams"})}),l.jsx(Eb,{messages:r})]})}function vH(e,t){return e.filter(n=>n.fromId===t||n.toId===t)}function wH({agentId:e}){const{messages:t,error:n}=bb();if(n)return l.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load messages: ",n]});if(t===null)return l.jsx("div",{className:"p-4 text-sm text-spur-text-muted",children:"Loading messages…"});const r=vH(t,e);return l.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-spur-bg","data-agent-tab":!0,children:[l.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-spur-surface shrink-0 flex items-center gap-2",children:[l.jsx("span",{className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide",children:"Messages"}),l.jsx("span",{className:"font-mono text-xs text-spur-text-muted",children:e})]}),l.jsx(Eb,{messages:r})]})}const ay="supervisor";function AH(e){return e.fromId===ay||e.toId===ay}function NH({teamId:e}){const{messages:t,error:n}=bb();if(n)return l.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load messages: ",n]});if(t===null)return l.jsx("div",{className:"p-4 text-sm text-spur-text-muted",children:"Loading messages…"});const r=t.filter(AH),a=e?ow(r,e):r;return l.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-spur-bg","data-supervisor-tab":!0,children:[l.jsx("div",{className:"px-4 py-2 border-b border-spur-border bg-spur-surface shrink-0",children:l.jsx("span",{className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide",children:"Message · supervisor"})}),l.jsx(Eb,{messages:a})]})}const _H=[{id:"all",label:"All"},{id:"supervisor",label:"Supervisor"}],El="agent-";function CH(e,t,n){if(e==="all")return l.jsx(SH,{teamId:n});if(e==="supervisor")return l.jsx(NH,{teamId:n});if(e.startsWith(El)){const r=e.slice(El.length);if(t.includes(r))return l.jsx(wH,{agentId:r})}return null}function lw({teamId:e}){const{teams:t}=ws(),[n,r]=g.useState(""),[a,s]=g.useState("all");g.useEffect(()=>{e||!n&&t.length>0&&r(t[0]?.teamId??"")},[e,t,n]);const i=e??n,o=t.find(d=>d.teamId===i)??t[0]??null,u=o?o.members.map(d=>d.id):[],c=a==="all"||a==="supervisor"||u.includes(a.slice(El.length))?a:"all",p=g.useMemo(()=>{const d=u.map(f=>({id:`${El}${f}`,label:f}));return[..._H,...d]},[u]);return l.jsxs("div",{className:"inbox flex flex-col h-full overflow-hidden bg-spur-bg","data-inbox-shell":!0,children:[l.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-spur-surface shrink-0 flex items-center justify-between",children:[l.jsx("span",{className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide",children:"Inbox"}),!e&&t.length>0&&l.jsxs("label",{className:"flex items-center gap-1 text-xs",htmlFor:"inbox-team-select",children:[l.jsx("span",{className:"text-spur-text-muted",children:"Team"}),l.jsxs(Xr,{id:"inbox-team-select",variant:"bordered",size:"sm",value:o?.teamId??"",onChange:d=>{r(d.target.value),s("all")},"data-inbox-team-select":!0,children:[l.jsx("option",{value:"",children:"Select team…"}),t.map(d=>l.jsx("option",{value:d.teamId,children:d.name},d.teamId))]})]})]}),l.jsx("div",{role:"tablist","aria-label":"Inbox tabs",className:"flex items-center gap-1 px-2 py-1 border-b border-spur-border bg-spur-surface shrink-0",children:p.map(d=>{const f=d.id===c;return l.jsx("button",{type:"button",role:"tab","aria-selected":f,"aria-controls":`inbox-tab-panel-${d.id}`,id:`inbox-tab-${d.id}`,onClick:()=>s(d.id),className:`px-3 py-1 rounded-lg text-xs font-medium transition-colors ${f?"bg-spur-accent text-white":"text-spur-text-muted hover:text-spur-text hover:bg-spur-surface-3"}`,"data-inbox-tab":!0,children:d.label},d.id)})}),l.jsx("div",{role:"tabpanel",id:`inbox-tab-panel-${c}`,"aria-labelledby":`inbox-tab-${c}`,className:"flex-1 overflow-hidden",children:CH(c,u,e)})]})}const kH={id:"inbox",name:"Inbox",icon:"💬",route:"inbox",component:lw,sidebarLabel:"Inbox",order:1},IH=Object.freeze(Object.defineProperty({__proto__:null,module:kH},Symbol.toStringTag,{value:"Module"})),RH=["30s","5m","1h","24h","7d","all"],DH={"30s":3e4,"5m":5*6e4,"1h":60*6e4,"24h":1440*6e4,"7d":10080*6e4,all:null};function uw(e,t=Date.now()){const n=DH[e];if(n!=null)return new Date(t-n).toISOString()}function OH(e){return e.selectedPrefixes.size>0||e.searchQuery.trim()!==""||e.searchScope!=="all"||e.severity!=="all"||e.tierFilter!=="all"||e.runId.trim()!==""}function sy({label:e,value:t,onChange:n,options:r}){return l.jsxs("fieldset",{className:"flex items-center gap-0.5 bg-base-100 border border-base-content/20 rounded-md p-0.5","aria-label":e,children:[l.jsx("legend",{className:"sr-only",children:e}),r.map(a=>{const s=a.value===t;return l.jsxs("label",{className:`flex-1 text-[11px] text-center px-2 py-0.5 rounded cursor-pointer transition-all ${s?"bg-primary text-primary-content font-bold shadow-xs":"text-base-content/70 hover:bg-base-content/10"}`,children:[l.jsx("input",{type:"radio",name:`segmented-${e}`,value:a.value,checked:s,onChange:()=>n(a.value),className:"sr-only"}),a.label]},a.value)})]})}function LH({timeRange:e,onTimeRangeChange:t,filters:n,onFiltersChange:r,onClearFilters:a,prefixOptions:s,getPrefixColor:i,liveEnabled:o,onToggleLive:u,shownCount:c,totalCount:p,actions:d}){const f=g.useMemo(()=>{let E=0;return n.selectedPrefixes.size>0&&(E+=n.selectedPrefixes.size),n.searchQuery.trim()!==""&&(E+=1),n.severity!=="all"&&(E+=1),n.tierFilter!=="all"&&(E+=1),n.runId.trim()!==""&&(E+=1),E},[n]),m=OH(n),b=E=>{r(x=>{const y=new Set(x.selectedPrefixes);return y.has(E)?y.delete(E):y.add(E),{...x,selectedPrefixes:y}})};return l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 p-3 bg-base-200/50 rounded-xl border border-base-content/10 shrink-0",children:[l.jsxs("fieldset",{className:"flex items-center gap-1 bg-base-200 p-1 rounded-lg border-0 m-0","aria-label":"Time range presets",children:[l.jsx("legend",{className:"sr-only",children:"Time range presets"}),RH.map(E=>{const x=e===E;return l.jsx("button",{type:"button",onClick:()=>t(E),"aria-pressed":x,className:`px-2.5 py-1 text-xs font-semibold rounded-md transition-all cursor-pointer ${x?"bg-primary text-primary-content font-bold shadow-sm":"text-base-content/70 hover:bg-base-content/10"}`,children:E==="all"?"All":E},E)})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsxs("span",{"aria-live":"polite",className:"text-xs font-mono text-base-content/60 whitespace-nowrap","data-testid":"observability-result-count",children:[c," of ",p," shown"]}),l.jsxs("details",{className:"relative inline-block","data-testid":"observability-filter-disclosure",children:[l.jsxs("summary",{className:"px-2.5 py-1 text-xs font-medium rounded-lg border border-base-content/20 bg-base-200 text-base-content/80 hover:bg-base-300 transition-colors cursor-pointer list-none flex items-center gap-1.5 focus:outline-none focus:ring-2 focus:ring-primary/40","aria-label":"Toggle filter panel",children:[l.jsx("span",{children:"🔍 Filter"}),f>0&&l.jsx("span",{className:"px-1.5 py-0.2 rounded-full text-[10px] font-bold bg-primary text-primary-content",children:f})]}),l.jsxs("div",{className:"absolute right-0 top-full z-30 p-3 shadow-xl bg-base-200 border border-base-content/10 rounded-xl w-80 sm:w-96 mt-2 flex flex-col gap-3",children:[l.jsxs("div",{className:"flex items-center justify-between pb-2 border-b border-base-content/10",children:[l.jsx("span",{className:"text-xs font-bold uppercase tracking-wide text-base-content/70",children:"Filters"}),m&&l.jsx("button",{type:"button",onClick:a,className:"text-xs text-error hover:underline cursor-pointer","aria-label":"Clear all filters",children:"Clear all"})]}),l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("label",{htmlFor:"filter-search-input",className:"text-[11px] font-semibold text-base-content/60",children:"Search"}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsxs("select",{value:n.searchScope,onChange:E=>r(x=>({...x,searchScope:E.target.value})),className:"bg-base-100 border border-base-content/20 rounded px-2 py-1 text-xs text-base-content focus:outline-none focus:ring-2 focus:ring-primary/40 cursor-pointer","aria-label":"Search scope",children:[l.jsx("option",{value:"all",children:"all"}),l.jsx("option",{value:"name",children:"name"}),l.jsx("option",{value:"actor",children:"actor"}),l.jsx("option",{value:"payload",children:"payload"})]}),l.jsx(Ti,{id:"filter-search-input",size:"sm",variant:"bordered",placeholder:`Search ${n.searchScope}…`,value:n.searchQuery,onChange:E=>r(x=>({...x,searchQuery:E.target.value})),className:"flex-1 input-xs","aria-label":`Search ${n.searchScope}`})]})]}),l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"text-[11px] font-semibold text-base-content/60",children:"Severity"}),l.jsx(sy,{label:"Severity",value:n.severity,onChange:E=>r(x=>({...x,severity:E})),options:[{value:"all",label:"All"},{value:"info",label:"Info"},{value:"warning",label:"Warning"},{value:"error",label:"Error"}]})]}),l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"text-[11px] font-semibold text-base-content/60",children:"Tier"}),l.jsx(sy,{label:"Tier",value:n.tierFilter,onChange:E=>r(x=>({...x,tierFilter:E})),options:[{value:"all",label:"All"},{value:"default",label:"Default"},{value:"diagnostic",label:"Diagnostic"}]})]}),s.length>0&&l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"text-[11px] font-semibold text-base-content/60",children:"Prefix"}),l.jsxs("fieldset",{className:"flex flex-wrap items-center gap-1.5 border-0 p-0 m-0","aria-label":"Filter by prefix",children:[l.jsx("legend",{className:"sr-only",children:"Filter by prefix"}),s.map(E=>{const x=n.selectedPrefixes.has(E),y=i(E);return l.jsxs("button",{type:"button",role:"switch","aria-checked":x,"aria-label":`Prefix ${E}${x?" (selected)":""}`,onClick:()=>b(E),className:`px-2 py-0.5 rounded-full text-[11px] font-mono border transition-colors cursor-pointer ${x?`${y} border-current bg-base-100 font-bold`:"text-base-content/60 border-base-content/20 hover:bg-base-100"}`,children:[E,".*"]},E)})]})]}),l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("label",{htmlFor:"filter-run-id-input",className:"text-[11px] font-semibold text-base-content/60",children:"Run ID"}),l.jsx(Ti,{id:"filter-run-id-input",size:"sm",variant:"bordered",placeholder:"Filter by run id…",value:n.runId,onChange:E=>r(x=>({...x,runId:E.target.value})),className:"w-full input-xs","aria-label":"Filter by run id"})]})]})]}),l.jsx("button",{type:"button",onClick:u,className:`px-2.5 py-1 text-xs font-semibold rounded-lg border transition-all cursor-pointer flex items-center gap-1.5 ${o?"border-emerald-500/40 bg-emerald-500/10 text-emerald-500 hover:bg-emerald-500/20":"border-amber-500/40 bg-amber-500/10 text-amber-500 hover:bg-amber-500/20"}`,"aria-label":o?"Pause live event stream":"Resume live event stream","aria-pressed":o,children:l.jsx("span",{children:o?"⏸ Pause Live":"▶ Resume Live"})}),d]})]})}const Ja=[{key:"time",label:"Time",description:"Event timestamp",defaultVisible:!0,sortable:!0,colWidth:"w-36"},{key:"severity",label:"Severity",description:"Diagnostic severity level",defaultVisible:!0,sortable:!0,colWidth:"w-24"},{key:"event",label:"Event",description:"Event name with domain prefix",defaultVisible:!0,sortable:!0,colWidth:"w-[15%]"},{key:"summary",label:"Summary",description:"Rendered human summary",defaultVisible:!0,sortable:!0,colWidth:"w-[20%]"},{key:"correlation",label:"Correlation",description:"Entity or run correlation identifier",defaultVisible:!0,sortable:!0,colWidth:"w-[16%]"},{key:"outcome",label:"Outcome",description:"Execution result or state change",defaultVisible:!0,sortable:!0,colWidth:"w-28"},{key:"agent",label:"Agent",description:"Target or actor agent role",defaultVisible:!0,sortable:!0,colWidth:"w-28"},{key:"producer",label:"Producer",description:"Subsystem or source package",defaultVisible:!1,sortable:!1,colWidth:"w-[16%]"},{key:"action",label:"Action",description:"Action link or remediation command",defaultVisible:!1,sortable:!1,colWidth:"w-[15%]"},{key:"actor",label:"Actor",description:"Originating user or system actor",defaultVisible:!1,sortable:!1,colWidth:"w-24"}],FH=new Set(Ja.map(e=>e.key)),Qr=["time","severity","event","summary","correlation","outcome","agent"],cw="spur:observability:columns:v1";function MH(e){if(!Array.isArray(e)||e.length===0)return[...Qr];const t=new Set;for(const n of e)typeof n=="string"&&FH.has(n)&&t.add(n);return t.size===0?[...Qr]:Ja.filter(n=>t.has(n.key)).map(n=>n.key)}function PH(e){try{const t=e??(typeof window<"u"?window.localStorage:void 0);if(!t)return[...Qr];const n=t.getItem(cw);if(!n)return[...Qr];const r=JSON.parse(n);return MH(r)}catch{return[...Qr]}}function iy(e,t){try{const n=t??(typeof window<"u"?window.localStorage:void 0);if(!n)return;n.setItem(cw,JSON.stringify(e))}catch{}}function jH({visibleColumns:e,onVisibleColumnsChange:t}){const n=g.useMemo(()=>new Set(e),[e]),r=s=>{const i=new Set(n);if(i.has(s)){if(i.size<=1)return;i.delete(s)}else i.add(s);const o=Ja.filter(u=>i.has(u.key)).map(u=>u.key);t(o),iy(o)},a=()=>{const s=[...Qr];t(s),iy(s)};return l.jsxs("details",{className:"relative inline-block","data-testid":"observability-column-customizer",children:[l.jsxs("summary",{className:"px-2.5 py-1 text-xs font-medium rounded-lg border border-base-content/20 bg-base-200 text-base-content/80 hover:bg-base-300 transition-colors cursor-pointer list-none flex items-center gap-1.5 focus:outline-none focus:ring-2 focus:ring-primary/40","aria-label":"Customize visible columns",children:[l.jsx("span",{children:"📊 Columns"}),l.jsxs("span",{className:"text-[10px] text-base-content/60 font-mono",children:["(",e.length,"/",Ja.length,")"]})]}),l.jsxs("div",{className:"absolute right-0 top-full z-30 p-3 shadow-xl bg-base-200 border border-base-content/10 rounded-xl w-64 mt-2 flex flex-col gap-2",children:[l.jsxs("div",{className:"flex items-center justify-between pb-2 border-b border-base-content/10",children:[l.jsx("span",{className:"text-xs font-bold uppercase tracking-wide text-base-content/70",children:"Columns"}),l.jsx("button",{type:"button",onClick:a,className:"text-xs text-primary hover:underline cursor-pointer","aria-label":"Reset columns to default",children:"Reset defaults"})]}),l.jsxs("fieldset",{className:"flex flex-col gap-1.5 border-0 p-0 m-0","aria-label":"Visible columns",children:[l.jsx("legend",{className:"sr-only",children:"Select visible columns"}),Ja.map(s=>{const i=n.has(s.key),o=i&&n.size===1,u=`observability-col-${s.key}`;return l.jsxs("label",{htmlFor:u,className:`flex items-center justify-between px-2 py-1 rounded-md text-xs transition-colors ${o?"opacity-60 cursor-not-allowed":"hover:bg-base-100 cursor-pointer text-base-content/90"}`,children:[l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(tb,{id:u,size:"xs",variant:"primary",checked:i,disabled:o,onChange:()=>r(s.key),"aria-label":s.label}),l.jsx("span",{className:"font-medium",children:s.label})]}),s.defaultVisible&&l.jsx("span",{className:"text-[10px] text-base-content/50 uppercase",children:"default"})]},s.key)})]})]})]})}const BH=()=>`${Nt()}/events/planning`,Nd=100;function xl(e){const t=`${Nt()}/events/history`,n=[],r=e.limit??Nd;return n.push(`limit=${r}`),e.prefix&&n.push(`prefix=${encodeURIComponent(e.prefix)}`),e.names&&n.push(`names=${encodeURIComponent(e.names)}`),e.actor&&n.push(`actor=${encodeURIComponent(e.actor)}`),e.runId&&n.push(`runId=${encodeURIComponent(e.runId)}`),e.since&&n.push(`since=${encodeURIComponent(e.since)}`),e.cursor&&n.push(`cursor=${encodeURIComponent(e.cursor)}`),`${t}?${n.join("&")}`}const UH={workflow:"text-cyan-400",task:"text-emerald-400",feature:"text-emerald-400",agent:"text-amber-400",rule:"text-rose-400",message:"text-sky-400",process:"text-violet-400",queue:"text-orange-400",bus:"text-pink-400",api:"text-teal-400"},oy="text-spur-text-muted";function dw(e){return e?UH[e]??oy:oy}const Ac={selectedPrefixes:new Set,searchQuery:"",searchScope:"all",severity:"all",tierFilter:"all",runId:""};function $H(){const e=g.useRef([]),[t,n]=g.useState(0);g.useEffect(()=>{const a=window.setInterval(()=>{const s=Date.now()-6e4,i=e.current.filter(o=>o>=s);e.current=i,n(i.length)},1e3);return()=>window.clearInterval(a)},[]);const r=g.useCallback(()=>{const a=Date.now(),s=a-6e4,i=e.current.filter(o=>o>=s);i.push(a),e.current=i,n(i.length)},[]);return{rate:t,recordEvent:r}}function yl(e){if(e===null||typeof e!="object"||!("events"in e)||!("count"in e))return null;const t=e.events;if(!Array.isArray(t))return null;const n=e.count;if(typeof n!="number")return null;const r=e.nextCursor,a=typeof r=="string"?r:null,s=e.hasMore,i=typeof s=="boolean"?s:!1,o=[];for(const p of t){const d=zH(p);d&&o.push(d)}const u=e.catalog,c=Array.isArray(u)?HH(u):void 0;return{events:o,count:n,nextCursor:a,hasMore:i,...c?{catalog:c}:{}}}function zH(e){if(e===null||typeof e!="object")return null;const t=e;if(typeof t.id!="string"||typeof t.eventName!="string"||typeof t.occurredAt!="string")return null;const n=typeof t.prefix=="string"?t.prefix:void 0,r=typeof t.renderer=="string"?t.renderer:void 0,a=t.actor;if(a!==null&&typeof a!="string")return null;const s=t.payload,i=typeof t.runId=="string"?t.runId:t.runId===null?null:void 0,o=typeof t.entityKind=="string"?t.entityKind:t.entityKind===null?null:void 0,u=typeof t.entityId=="string"?t.entityId:t.entityId===null?null:void 0,c=typeof t.sequence=="number"&&Number.isFinite(t.sequence)?t.sequence:t.sequence===null?null:void 0,p={id:t.id,eventName:t.eventName,occurredAt:t.occurredAt,actor:a,...n?{prefix:n}:{},...r?{renderer:r}:{}};if(s===null)return{...p,payload:null,view:ya(t.eventName,null),...Tl(i,o,u,c)};if(typeof s!="object")return null;const d=s,f=d.schemaVersion===2?d:void 0;return{...p,payload:pw(d),...f?{envelope:f}:{},view:ya(t.eventName,d),...Tl(i,o,u,c)}}function Tl(e,t,n,r){const a={};return e!==void 0&&(a.runId=e),t!==void 0&&(a.entityKind=t),n!==void 0&&(a.entityId=n),r!==void 0&&(a.sequence=r),a}function HH(e){const t=[];for(const n of e){if(n===null||typeof n!="object")return;const r=n;if(typeof r.name!="string"||typeof r.prefix!="string"||typeof r.source!="string"||typeof r.renderer!="string")return;const a=typeof r.tier=="string"?r.tier:void 0,s={name:r.name,prefix:r.prefix,source:r.source,renderer:r.renderer,...a!==void 0?{tier:a}:{}};t.push(s)}return t}function GH(e){if(e===null||typeof e!="object")return null;const t=e;if(typeof t.eventName!="string"||t.eventName.length===0||typeof t.occurredAt!="string")return null;const n=typeof t.prefix=="string"?t.prefix:void 0,r=typeof t.renderer=="string"?t.renderer:void 0,a=t.actor;if(a!==null&&typeof a!="string")return null;const s=t.payload;if(s!==null&&typeof s!="object")return null;const i=s,o=i?.schemaVersion===2?i:void 0,u=pw(i),c=t.runId??u?.runId,p=t.entityKind??u?.entityKind,d=t.entityId??u?.entityId,f=t.sequence??u?.sequence,m=typeof c=="string"?c:c===null?null:void 0,b=typeof p=="string"?p:p===null?null:void 0,E=typeof d=="string"?d:d===null?null:void 0,x=typeof f=="number"&&Number.isFinite(f)?f:f===null?null:void 0;return{eventName:t.eventName,occurredAt:t.occurredAt,actor:a,...n?{prefix:n}:{},...r?{renderer:r}:{},payload:u,...o?{envelope:o}:{},view:ya(t.eventName,i),...Tl(m,b,E,x)}}function ya(e,t){const n=WH(e);if(t?.schemaVersion!==2)return n;const r=zr(t.context),a=zr(t.presentation),s=zr(r?.project),i=zr(r?.producer),o=zr(r?.correlation);if(!r||!a||!s||!i||!o)return n;const u=a.severity==="info"||a.severity==="warning"||a.severity==="error"?a.severity:"warning",c=Array.isArray(a.fields)?a.fields.flatMap(S=>{const w=zr(S),A=fn(w?.label,64),D=fn(w?.value,256);return A&&D?[{label:A,value:D}]:[]}).slice(0,8):[],p=[],d=(S,w)=>{const A=fn(w,128);A&&p.push({label:S,value:A})};d("Run",o.runId),d("Execution",o.executionId),d("Action",o.actionId),d("Entity",qH(o.entityKind,o.entityId)),d("Job",o.jobId),typeof o.sequence=="number"&&Number.isFinite(o.sequence)&&p.push({label:"Sequence",value:String(o.sequence)});const f=fn(i.package,128)??"unavailable",m=fn(i.subsystem,128),b=VH(a.action),E=fn(a.actionLabel,128)??"unavailable",x=fn(a.agent,128),y=fn(a.correlators,512);return{severity:u,summary:fn(a.summary,512)??"unavailable",description:fn(a.description,512)??"Description unavailable.",fields:c,projectName:fn(s.name,128)??"unavailable",projectRoot:fn(s.root,256)??"unavailable",producer:m?`${f} / ${m}`:f,correlation:y??"unavailable",correlationFields:p,outcome:fn(a.outcome,128)??"unavailable",action:b,actionLabel:E,agent:x}}function WH(e){return{severity:"warning",summary:"unavailable",description:`Canonical context unavailable for ${fn(e,128)??"unknown"}.`,fields:[],projectName:"unavailable",projectRoot:"unavailable",producer:"unavailable",correlation:"unavailable",correlationFields:[],outcome:"unavailable",action:null,actionLabel:"unavailable",agent:null}}function VH(e){const t=zr(e);if(!t||t.kind!=="command"&&t.kind!=="filter"&&t.kind!=="path")return null;const n=fn(t.label,128),r=fn(t.value,256);return n&&r?{label:n,kind:t.kind,value:r}:null}function fn(e,t){return typeof e!="string"||e.length===0?null:e.length<=t?e:`${e.slice(0,t-1)}…`}function qH(e,t){const n=fn(e,64),r=fn(t,128);return n&&r?`${n}:${r}`:n??r}const YH=["Entity","Run","Execution","Action","Job"];function ZH(e,t){for(const n of YH){const r=t.correlationFields.find(a=>a.label===n);if(r!==void 0&&r.value!=="")return`${e.eventName} · ${r.value}`}return e.id!==""&&!e.id.startsWith("live-")?`${e.eventName} · ${e.id}`:e.eventName}function zr(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function pw(e){return e?.schemaVersion!==2?e:zr(e.data)}const KH=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ly(e){const t=new Date(e);if(Number.isNaN(t.getTime()))return e;const n=KH[t.getMonth()],r=t.getDate(),a=String(t.getHours()).padStart(2,"0"),s=String(t.getMinutes()).padStart(2,"0"),i=String(t.getSeconds()).padStart(2,"0");return`${n} ${r} ${a}:${s}:${i}`}function _d(e){return typeof e!="number"||!Number.isFinite(e)?null:e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function At(e){return e&&e!=="unavailable"?e:"-"}function XH(e,t="24h"){const n={};e.selectedPrefixes&&e.selectedPrefixes.size===1&&(n.prefix=[...e.selectedPrefixes][0]);const r=e.searchQuery?.trim()??"";r!==""&&e.searchScope==="name"&&(n.names=r),r!==""&&e.searchScope==="actor"&&(n.actor=r),e.runId&&e.runId.trim()!==""&&(n.runId=e.runId.trim());const a=e.timeWindow&&e.timeWindow!=="all"?e.timeWindow:t,s=uw(a);return s&&(n.since=s),n}function uy(e,t,n){if(t.selectedPrefixes.size>=1){const r=e.prefix??e.eventName.split(".")[0]??e.eventName;if(!t.selectedPrefixes.has(r))return!1}if(t.tierFilter!=="all"){const r=n.get(e.eventName);if(r!==t.tierFilter&&!(t.tierFilter==="default"&&r===void 0))return!1}if(t.severity!=="all"&&(e.view??ya(e.eventName,e.payload??null)).severity!==t.severity)return!1;if(t.searchQuery.trim()!==""){const r=t.searchQuery.toLowerCase();let a=!1;if((t.searchScope==="name"||t.searchScope==="all")&&(a=a||e.eventName.toLowerCase().includes(r)),(t.searchScope==="actor"||t.searchScope==="all")&&(a=a||(e.actor?.toLowerCase().includes(r)??!1)),t.searchScope==="payload"&&e.payload&&(a=a||JSON.stringify(e.payload).toLowerCase().includes(r)),!a)return!1}return!(t.runId.trim()!==""&&e.runId!==t.runId.trim())}const xb={key:"time",direction:"desc"};function QH(e,t=xb){const n=e.map((r,a)=>({row:r,idx:a}));return n.sort((r,a)=>{let s=0;const i=r.row.view??ya(r.row.eventName,r.row.payload??null),o=a.row.view??ya(a.row.eventName,a.row.payload??null);switch(t.key){case"time":{const u=Date.parse(r.row.occurredAt),c=Date.parse(a.row.occurredAt),p=Number.isNaN(u)?-1/0:u,d=Number.isNaN(c)?-1/0:c;s=p-d;break}case"severity":{const u=c=>c==="info"?0:c==="warning"?1:2;s=u(i.severity)-u(o.severity);break}case"event":{s=r.row.eventName.localeCompare(a.row.eventName);break}case"summary":{s=(i.summary??"").localeCompare(o.summary??"");break}case"correlation":{s=(i.correlation??"").localeCompare(o.correlation??"");break}case"agent":{s=(i.agent??"").localeCompare(o.agent??"");break}case"outcome":{s=(i.outcome??"").localeCompare(o.outcome??"");break}default:s=0}return s!==0?t.direction==="asc"?s:-s:r.idx-a.idx}),n.map(r=>r.row)}function Io({value:e,label:t}){const[n,r]=g.useState("idle"),a=async s=>{s.preventDefault(),s.stopPropagation();try{typeof navigator<"u"&&navigator.clipboard?.writeText?(await navigator.clipboard.writeText(e),r("copied"),setTimeout(()=>r("idle"),1500)):(r("failed"),setTimeout(()=>r("idle"),2e3))}catch{r("failed"),setTimeout(()=>r("idle"),2e3)}};return!e||e==="-"||e==="unavailable"?null:l.jsxs("button",{type:"button",onClick:a,className:"inline-flex items-center justify-center p-0.5 rounded text-base-content/40 hover:text-base-content hover:bg-base-content/10 transition-colors cursor-pointer shrink-0 text-[10px] focus:outline-none focus:ring-1 focus:ring-primary/40",title:n==="copied"?"Copied":n==="failed"?"Copy failed":`Copy ${t}`,"aria-label":n==="copied"?`Copied ${t}`:n==="failed"?`Copy ${t} failed`:`Copy ${t}`,children:[l.jsx("span",{"aria-hidden":"true",children:n==="copied"?"✓":n==="failed"?"!":"📋"}),l.jsx("span",{className:"sr-only","aria-live":"polite",children:n==="copied"?`${t} copied`:n==="failed"?`${t} copy failed`:""})]})}function JH({onLivenessChange:e,timeRange:t,onTimeRangeChange:n}={}){const[r,a]=g.useState("24h"),s=t??r,i=n??a,[o,u]=g.useState(()=>PH()),[c,p]=g.useState(xb),d=g.useCallback(ge=>{p(me=>me.key===ge?{key:ge,direction:me.direction==="asc"?"desc":"asc"}:{key:ge,direction:"asc"})},[]),[f,m]=g.useState(!0),[b,E]=g.useState([]),[x,y]=g.useState([]),[S,w]=g.useState("idle"),[A,D]=g.useState(null),[N,T]=g.useState(null),[v,R]=g.useState(!1),[C,U]=g.useState(!1),[k,j]=g.useState(Ac),[G,$]=g.useState(Ac),[te,H]=g.useState("connecting"),{rate:se,recordEvent:de}=$H();g.useEffect(()=>{e?.({status:f?te:"paused",rate:se,lastEventAt:b[0]?.occurredAt??null})},[f,te,se,b,e]);const O=g.useMemo(()=>{const ge=new Map;for(const me of x)me.tier&&ge.set(me.name,me.tier);return ge},[x]);g.useEffect(()=>{const ge=window.setTimeout(()=>{$(k)},250);return()=>window.clearTimeout(ge)},[k]);const ne=g.useMemo(()=>XH(G,s),[G,s]),pe=g.useRef(0);g.useEffect(()=>{const ge=++pe.current,me=new AbortController;return w("loading"),D(null),(async()=>{try{const Te=await Tt(new Request(xl({...ne,limit:Nd}),{signal:me.signal}));if(!Te.ok){const Ze=await Te.json().catch(()=>null),ot=Ze?.code;throw ot==="UNKNOWN_PREFIX"||ot==="MALFORMED_CURSOR"?new Error(`${ot}: ${Ze.error??Te.status}`):new Error(`history fetch failed: ${Te.status}`)}const ve=await Te.json(),ie=yl(ve);if(!ie)throw new Error("history response failed schema validation");if(ge!==pe.current)return;E(ie.events),ie.catalog&&y(ie.catalog),T(ie.nextCursor),R(ie.hasMore),w("loaded")}catch(Te){if(me.signal.aborted||ge!==pe.current)return;D(Te instanceof Error?Te.message:String(Te)),w("error")}})(),()=>me.abort()},[ne]);const L=g.useCallback(async()=>{if(!(!v||C||N===null)){U(!0);try{const ge=await Tt(new Request(xl({...ne,limit:Nd,cursor:N})));if(!ge.ok)throw new Error(`history fetch failed: ${ge.status}`);const me=await ge.json(),Te=yl(me);if(!Te)throw new Error("history response failed schema validation");E(ve=>{const ie=new Set(ve.map(ot=>ot.id)),Ze=Te.events.filter(ot=>!ie.has(ot.id));return[...ve,...Ze]}),Te.catalog&&y(Te.catalog),T(Te.nextCursor),R(Te.hasMore)}catch(ge){D(ge instanceof Error?ge.message:String(ge))}finally{U(!1)}}},[v,C,N,ne]),ke=g.useRef(k);ke.current=k;const Re=g.useRef(O);Re.current=O;const Q=g.useRef(s);Q.current=s,g.useEffect(()=>{if(!f||typeof EventSource>"u")return;H("connecting");const ge=new EventSource(BH());return ge.onopen=()=>{H("live")},ge.onerror=()=>{H("errored")},ge.onmessage=me=>{try{const Te=JSON.parse(me.data),ve=GH(Te);if(!ve||ve.eventName==="connected")return;const ie=ke.current,Ze=Re.current;if(!uy({eventName:ve.eventName,occurredAt:ve.occurredAt,actor:ve.actor,...ve.prefix?{prefix:ve.prefix}:{},payload:ve.payload,view:ve.view,...ve.runId!==void 0?{runId:ve.runId}:{}},ie,Ze))return;const ot={id:`live-${ve.occurredAt}-${ve.eventName}`,eventName:ve.eventName,occurredAt:ve.occurredAt,actor:ve.actor,...ve.prefix?{prefix:ve.prefix}:{},...ve.renderer?{renderer:ve.renderer}:{},payload:ve.payload,...ve.envelope?{envelope:ve.envelope}:{},view:ve.view,...Tl(ve.runId,ve.entityKind,ve.entityId,ve.sequence)};E(rt=>[ot,...rt]),de()}catch{}},()=>ge.close()},[f,de]);const _e=g.useMemo(()=>Array.from(new Set([...x.map(ge=>ge.prefix),...b.map(ge=>ge.prefix??ge.eventName.split(".")[0]??ge.eventName)])).sort(),[x,b]),fe=g.useCallback(()=>{j(Ac)},[]),X=g.useMemo(()=>b.filter(ge=>uy(ge,k,O)),[b,k,O]),Ve=g.useMemo(()=>QH(X,c),[X,c]);return S==="error"?l.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load event history: ",A]}):S==="idle"||S==="loading"?l.jsxs("div",{className:"flex items-center justify-center h-32 text-spur-text-muted text-sm",children:[l.jsx(Ra,{size:"sm"})," Loading event history…"]}):l.jsxs("div",{className:"flex flex-col gap-4","data-system-events-tab":!0,children:[l.jsx(LH,{timeRange:s,onTimeRangeChange:i,filters:k,onFiltersChange:j,onClearFilters:fe,prefixOptions:_e,getPrefixColor:dw,liveEnabled:f,onToggleLive:()=>m(ge=>!ge),shownCount:X.length,totalCount:b.length,actions:l.jsx(jH,{visibleColumns:o,onVisibleColumnsChange:u})}),l.jsxs("div",{className:"bg-base-200 rounded-xl shadow-sm border border-base-content/10 overflow-hidden flex flex-col",children:[Ve.length===0?l.jsx("div",{className:"p-8 text-sm text-spur-text-muted italic text-center",children:b.length===0?"No system events yet. New events from the planning bus will appear here in real time.":"No events match the active filters."}):l.jsx(tG,{rows:Ve,catalog:x,visibleColumns:o,sortState:c,onSortChange:d}),v&&l.jsx("div",{className:"px-4 py-2 border-t border-base-content/10 bg-base-200/50 shrink-0 flex justify-center",children:l.jsx("button",{type:"button",onClick:L,disabled:C,"data-load-older":!0,className:"text-[11px] text-spur-text-muted hover:text-spur-text px-3 py-1 rounded border border-spur-border/40 hover:border-spur-text/40 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-wait focus:outline-none focus:ring-2 focus:ring-spur-text/40",children:C?"Loading…":"Load older"})})]})]})}function eG(e){const[t,n]=g.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(e).matches);return g.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const r=window.matchMedia(e),a=s=>n(s.matches);return r.addEventListener("change",a),n(r.matches),()=>r.removeEventListener("change",a)},[e]),t}function tG({rows:e,catalog:t,visibleColumns:n=Qr,sortState:r=xb,onSortChange:a=()=>{}}){const s=g.useMemo(()=>{const u=new Map;for(const c of t)c.tier&&u.set(c.name,c.tier);return u},[t]),i=eG("(max-width: 639px)"),o=g.useMemo(()=>new Map(Ja.map(u=>[u.key,u])),[]);return l.jsx("section",{className:"overflow-x-auto min-w-0","data-system-events-tab":!0,"aria-label":"System events",children:l.jsxs("table",{className:`w-full ${i?"min-w-0":"min-w-[1000px]"} text-xs border-separate border-spacing-0 table-fixed`,children:[l.jsx("colgroup",{children:i?l.jsxs(l.Fragment,{children:[l.jsx("col",{className:"w-24"}),l.jsx("col",{className:"w-full"})]}):n.map(u=>l.jsx("col",{className:o.get(u)?.colWidth??"w-24"},u))}),l.jsx("thead",{className:"sticky top-0 z-10 bg-base-200",children:l.jsx("tr",{className:"text-left text-spur-text-muted uppercase tracking-wide text-[10px]",children:i?l.jsxs(l.Fragment,{children:[l.jsx("th",{scope:"col",className:"font-semibold px-3 py-1.5 border-b border-spur-border",children:"Time"}),l.jsx("th",{scope:"col",className:"font-semibold px-3 py-1.5 border-b border-spur-border",children:"Event"})]}):n.map(u=>{const c=o.get(u);if(!c)return null;const p=r.key===u,d=p?r.direction==="asc"?" ▲":" ▼":"",f=p?r.direction==="asc"?"ascending":"descending":"none";return c.sortable?l.jsx("th",{scope:"col","aria-sort":f,className:"font-semibold px-3 py-1.5 border-b border-spur-border select-none",children:l.jsxs("button",{type:"button",onClick:()=>a(u),className:"flex items-center gap-1 uppercase tracking-wide text-[10px] font-semibold text-spur-text-muted hover:text-spur-text transition-colors cursor-pointer bg-transparent border-0 p-0 focus:outline-none focus:ring-1 focus:ring-primary/40 rounded",children:[l.jsx("span",{children:c.label}),d&&l.jsx("span",{"aria-hidden":"true",children:d})]})},u):l.jsx("th",{scope:"col",className:"font-semibold px-3 py-1.5 border-b border-spur-border",children:c.label},u)})})}),l.jsx("tbody",{children:e.map(u=>l.jsx(nG,{event:u,tier:s.get(u.eventName)??"default",compact:i,visibleColumns:n},u.id))})]})})}const Nc="system-events-payload-tooltip-pin";function _c({severity:e}){const t=g.useMemo(()=>{switch(e){case"error":return{icon:"✕",badgeClass:"bg-error/15 text-error border-error/30"};case"warning":return{icon:"▲",badgeClass:"bg-warning/15 text-warning border-warning/30"};default:return{icon:"●",badgeClass:"bg-base-content/10 text-base-content/70 border-base-content/20"}}},[e]);return l.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[10px] font-semibold border ${t.badgeClass} whitespace-nowrap`,children:[l.jsx("span",{"aria-hidden":"true",children:t.icon}),l.jsx("span",{children:e})]})}function nG({event:e,tier:t,compact:n,visibleColumns:r=Qr}){const a=e.prefix??e.eventName.split(".")[0]??e.eventName,s=g.useMemo(()=>e.view??ya(e.eventName,e.payload??null),[e.eventName,e.payload,e.view]),i=dw(a),[o,u]=g.useState(!1),[c,p]=g.useState(!1),[d,f]=g.useState(!1),[m,b]=g.useState(null),E=g.useRef(null),x=g.useRef(null),y=g.useRef(0),S=g.useRef(null),w=At(e.actor),A=c||d,D=g.useCallback(()=>{S.current!==null&&(clearTimeout(S.current),S.current=null)},[]),N=g.useCallback(()=>{f(!1),b(null)},[]),T=g.useCallback((j,G)=>{y.current=performance.now()+400,f(!0),p(!1),D();const $=Number.isFinite(j)&&j>0?j:8,te=Number.isFinite(G)&&G>0?G:8;b({x:$,y:te}),window.dispatchEvent(new CustomEvent(Nc,{detail:{id:e.id}}))},[e.id,D]),v=g.useCallback((j,G,$)=>{const te=j.getBoundingClientRect(),H=G&&G>0?G:te.left,se=$&&$>0?$+4:te.bottom+6;T(H,se)},[T]);g.useEffect(()=>{const j=G=>{G.detail?.id!==e.id&&N()};return window.addEventListener(Nc,j),()=>window.removeEventListener(Nc,j)},[e.id,N]),g.useEffect(()=>{if(!d)return;const j=$=>{performance.now()<y.current||E.current?.contains($.target)||x.current?.contains($.target)||N()},G=$=>{$.key==="Escape"&&(N(),$.stopPropagation())};return document.addEventListener("pointerdown",j,!0),document.addEventListener("keydown",G,!0),()=>{document.removeEventListener("pointerdown",j,!0),document.removeEventListener("keydown",G,!0)}},[d,N]),g.useEffect(()=>()=>{D()},[D]);const R=g.useCallback(()=>u(j=>!j),[]),C=g.useCallback(j=>{if(j.key==="Escape"){if(d){N(),j.stopPropagation();return}u(!1),j.stopPropagation()}},[d,N]),U=A?l.jsxs("div",{ref:E,id:`system-event-tooltip-${e.id}`,role:"tooltip","data-testid":"system-event-payload-tooltip","data-pinned":d?"true":"false",className:d?"pointer-events-auto fixed z-50 rounded shadow-lg p-2.5 text-[11px] min-w-[min(400px,90vw)] max-w-[min(840px,95vw)] whitespace-normal border border-[#30363d] bg-[#0d1117] text-[#c9d1d9] select-text cursor-text":"pointer-events-auto absolute left-0 top-full mt-1 z-30 rounded shadow-lg p-2.5 text-[11px] min-w-[min(400px,90vw)] max-w-[min(840px,95vw)] whitespace-normal border border-[#30363d] bg-[#0d1117] text-[#c9d1d9]",style:d&&m?{top:m.y,left:m.x}:void 0,onMouseEnter:()=>{D(),p(!0)},onMouseLeave:()=>{d||(D(),S.current=setTimeout(()=>p(!1),150))},onFocusCapture:()=>p(!0),onBlurCapture:j=>{!d&&!j.currentTarget.contains(j.relatedTarget)&&p(!1)},onPointerDown:j=>{d&&j.stopPropagation()},children:[l.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1.5",children:[l.jsx("div",{className:"text-[11px] font-sans font-semibold text-[#c9d1d9] truncate","data-testid":"system-event-tooltip-title",children:ZH(e,s)}),l.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[!d&&l.jsx("button",{type:"button","data-testid":"system-event-payload-tooltip-pin",className:"text-[10px] text-[#c9d1d9] hover:text-white px-1.5 py-0.5 rounded border border-[#30363d] bg-[#21262d] cursor-pointer",onClick:j=>{j.stopPropagation(),j.preventDefault();const G=x.current;G?v(G):T(j.clientX,j.clientY)},children:"Pin"}),d&&l.jsx("button",{type:"button","data-testid":"system-event-payload-tooltip-close",className:"text-[10px] text-[#8b949e] hover:text-[#c9d1d9] px-1 rounded border border-[#30363d] cursor-pointer",onClick:j=>{j.stopPropagation(),N()},children:"close"})]})]}),l.jsx("p",{className:"mb-2 text-spur-text leading-relaxed","data-testid":"system-event-description",children:s.description}),l.jsxs("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1 max-h-80 overflow-y-auto",children:[l.jsx("dt",{className:"text-spur-text-muted",children:"Summary"}),l.jsx("dd",{className:"break-words",children:At(s.summary)}),l.jsx("dt",{className:"text-spur-text-muted",children:"Severity"}),l.jsx("dd",{children:l.jsx(_c,{severity:s.severity})}),s.fields.map(j=>l.jsxs("div",{className:"contents",children:[l.jsx("dt",{className:"text-spur-text-muted",children:j.label}),l.jsx("dd",{className:"font-mono break-all",children:At(j.value)})]},j.label+j.value)),l.jsx("dt",{className:"text-spur-text-muted",children:"Producer"}),l.jsx("dd",{className:"font-mono break-all",children:At(s.producer)}),s.correlationFields.length>0?s.correlationFields.map(j=>l.jsxs("div",{className:"contents",children:[l.jsx("dt",{className:"text-spur-text-muted",children:j.label}),l.jsx("dd",{className:"font-mono break-all",children:At(j.value)})]},`correlation-${j.label}`)):l.jsxs(l.Fragment,{children:[l.jsx("dt",{className:"text-spur-text-muted",children:"Correlation"}),l.jsx("dd",{className:"font-mono",children:"-"})]}),l.jsx("dt",{className:"text-spur-text-muted",children:"Outcome"}),l.jsx("dd",{className:"font-mono break-all",children:At(s.outcome)})]}),s.action&&l.jsxs("div",{className:"mt-2 border-t border-[#30363d] pt-2","data-testid":"system-event-remediation",children:[l.jsx("div",{className:"text-spur-text-muted",children:s.action.label}),l.jsx("code",{className:"block mt-0.5 font-mono break-all select-text",children:s.action.value})]}),l.jsx("div",{className:"mt-2 border-t border-[#30363d] pt-1.5 text-[10px] text-[#8b949e] font-sans","data-testid":"system-event-tooltip-footer",children:d?"Select to copy · Esc or outside click to close":"Click event name or Pin to lock for copy"})]}):null,k=j=>{switch(j){case"time":return l.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 font-mono text-spur-text-muted whitespace-nowrap align-middle",children:ly(e.occurredAt)},"time");case"severity":return l.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 align-middle text-[10px]",children:l.jsx(_c,{severity:s.severity})},"severity");case"event":return l.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 relative align-middle min-w-0",children:l.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[l.jsx("button",{type:"button","aria-expanded":o,"aria-controls":`detail-${e.id}`,"aria-label":`${o?"Collapse":"Expand"} detail for ${e.eventName}`,onClick:R,onKeyDown:C,className:"inline-flex items-center justify-center w-4 h-4 text-spur-text-muted hover:text-spur-text text-[10px] transition-colors cursor-pointer focus:outline-none focus:ring-2 focus:ring-spur-text/40 shrink-0",children:o?"▾":"▸"}),l.jsxs("div",{className:"relative min-w-0 max-w-full flex items-center gap-1",children:[l.jsx("button",{ref:x,type:"button",className:`font-mono font-semibold truncate block max-w-full text-left cursor-pointer bg-transparent border-0 p-0 ${i}`,"data-testid":"system-event-name","aria-label":`Context for ${e.eventName}. Hover to preview; click to pin for select and copy.`,"aria-describedby":A?`system-event-tooltip-${e.id}`:void 0,onMouseEnter:()=>{D(),p(!0)},onFocus:()=>{D(),p(!0)},onBlur:G=>{!d&&!E.current?.contains(G.relatedTarget)&&p(!1)},onMouseLeave:()=>{D(),S.current=setTimeout(()=>{d||p(!1)},200)},onClick:G=>{G.preventDefault(),G.stopPropagation(),!d&&v(G.currentTarget,G.clientX,G.clientY)},onKeyDown:G=>{if(G.key==="Enter"||G.key===" "){if(G.preventDefault(),d)return;v(G.currentTarget)}},children:e.eventName}),l.jsx(Io,{value:e.eventName,label:"event name"}),!d&&U]})]})},"event");case"summary":return l.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 text-spur-text align-middle truncate",title:At(s.summary),children:At(s.summary)},"summary");case"correlation":return l.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 font-mono text-[10px] text-spur-text-muted align-middle",children:l.jsxs("div",{className:"flex items-center gap-1 min-w-0",children:[l.jsx("span",{className:"truncate",title:At(s.correlation),children:At(s.correlation)}),s.correlation&&s.correlation!=="unavailable"&&l.jsx(Io,{value:s.correlation,label:"correlation"})]})},"correlation");case"outcome":return l.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 font-mono text-[10px] text-spur-text-muted align-middle truncate",title:At(s.outcome),children:At(s.outcome)},"outcome");case"agent":return l.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 font-mono text-[10px] text-spur-text-muted align-middle truncate",title:s.agent??"",children:s.agent??""},"agent");case"producer":return l.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 font-mono text-[10px] text-spur-text-muted align-middle truncate",title:At(s.producer),children:At(s.producer)},"producer");case"action":return l.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 font-mono text-[10px] text-spur-text-muted align-middle truncate",title:At(s.actionLabel),children:At(s.actionLabel)},"action");case"actor":return l.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 font-mono text-[10px] text-spur-text-muted align-middle truncate",title:w,children:w},"actor")}};return l.jsxs(l.Fragment,{children:[l.jsx("tr",{className:"group hover:bg-base-200/60 transition-colors",style:{height:n?void 0:28},children:n?l.jsxs(l.Fragment,{children:[l.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 font-mono text-spur-text-muted whitespace-nowrap align-middle",children:ly(e.occurredAt)}),l.jsx("td",{className:"px-3 py-1 border-b border-spur-border/40 relative align-middle min-w-0",children:l.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[l.jsx("button",{type:"button","aria-expanded":o,"aria-controls":`detail-${e.id}`,"aria-label":`${o?"Collapse":"Expand"} detail for ${e.eventName}`,onClick:R,onKeyDown:C,className:"inline-flex items-center justify-center w-4 h-4 text-spur-text-muted hover:text-spur-text text-[10px] transition-colors cursor-pointer focus:outline-none focus:ring-2 focus:ring-spur-text/40 shrink-0",children:o?"▾":"▸"}),l.jsxs("div",{className:"relative min-w-0 max-w-full flex items-center gap-1",children:[l.jsx("button",{ref:x,type:"button",className:`font-mono font-semibold truncate block max-w-full text-left cursor-pointer bg-transparent border-0 p-0 ${i}`,"data-testid":"system-event-name","aria-label":`Context for ${e.eventName}. Hover to preview; click to pin for select and copy.`,"aria-describedby":A?`system-event-tooltip-${e.id}`:void 0,onMouseEnter:()=>{D(),p(!0)},onFocus:()=>{D(),p(!0)},onBlur:j=>{!d&&!E.current?.contains(j.relatedTarget)&&p(!1)},onMouseLeave:()=>{D(),S.current=setTimeout(()=>{d||p(!1)},200)},onClick:j=>{j.preventDefault(),j.stopPropagation(),!d&&v(j.currentTarget,j.clientX,j.clientY)},onKeyDown:j=>{if(j.key==="Enter"||j.key===" "){if(j.preventDefault(),d)return;v(j.currentTarget)}},children:e.eventName}),l.jsx(Io,{value:e.eventName,label:"event name"}),!d&&U]})]}),l.jsxs("div",{className:"flex flex-col gap-0.5 text-[10px] text-spur-text-muted min-w-0",children:[l.jsx(_c,{severity:s.severity}),l.jsx("span",{className:"truncate text-spur-text",title:At(s.summary),children:At(s.summary)}),l.jsx("span",{className:"truncate",title:At(s.producer),children:At(s.producer)}),l.jsx("span",{className:"truncate",title:At(s.correlation),children:At(s.correlation)}),s.agent&&l.jsxs("span",{className:"truncate font-mono",title:s.agent,children:["agent: ",s.agent]}),l.jsxs("span",{className:"truncate",children:["outcome: ",At(s.outcome)]}),l.jsxs("span",{className:"truncate",title:At(s.actionLabel),children:["action: ",At(s.actionLabel)]})]})]})})]}):r.map(j=>k(j))}),o&&l.jsx("tr",{children:l.jsx("td",{colSpan:n?2:r.length,className:"px-3 py-2 border-b border-spur-border/40 bg-base-300/40",children:l.jsxs("section",{id:`detail-${e.id}`,"aria-label":`Detail for ${e.eventName}`,onKeyDown:C,tabIndex:-1,className:"flex flex-col gap-2 text-[11px] text-spur-text max-w-full",children:[l.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 font-mono text-[10px]",children:[l.jsxs("span",{children:[l.jsx("span",{className:"text-spur-text-muted",children:"project:"})," ",At(s.projectName)]}),l.jsxs("span",{children:[l.jsx("span",{className:"text-spur-text-muted",children:"root:"})," ",At(s.projectRoot)]}),l.jsxs("span",{children:[l.jsx("span",{className:"text-spur-text-muted",children:"producer:"})," ",At(s.producer)]}),l.jsxs("span",{children:[l.jsx("span",{className:"text-spur-text-muted",children:"correlation:"})," ",At(s.correlation)]}),e.runId&&l.jsxs("span",{className:"inline-flex items-center gap-1",children:[l.jsx("span",{className:"text-spur-text-muted",children:"runId:"})," ",e.runId," ",l.jsx(Io,{value:e.runId,label:"run ID"})]}),l.jsxs("span",{children:[l.jsx("span",{className:"text-spur-text-muted",children:"agent:"})," ",s.agent||"-"]}),l.jsxs("span",{children:[l.jsx("span",{className:"text-spur-text-muted",children:"actor:"})," ",w]}),l.jsxs("span",{children:[l.jsx("span",{className:"text-spur-text-muted",children:"prefix:"})," ",a]}),l.jsxs("span",{children:[l.jsx("span",{className:"text-spur-text-muted",children:"tier:"})," ",t]}),l.jsxs("span",{children:[l.jsx("span",{className:"text-spur-text-muted",children:"outcome:"})," ",At(s.outcome)]})]}),s.fields.length>0&&l.jsx("dl",{className:"space-y-0.5",children:s.fields.map(j=>l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("dt",{className:"text-spur-text-muted shrink-0",children:[j.label,":"]}),l.jsx("dd",{className:"font-mono break-all",children:At(j.value)})]},j.label+j.value))}),l.jsxs("div",{className:"border-t border-spur-border/40 pt-1",children:[l.jsx("div",{className:"text-spur-text-muted text-[10px] mb-0.5",children:"payload (redacted):"}),l.jsx("pre",{className:"font-mono text-[10px] text-spur-text-muted overflow-x-auto whitespace-pre-wrap break-all",children:e.envelope?JSON.stringify(e.envelope,null,2):"-"})]}),l.jsx("button",{type:"button",onClick:()=>u(!1),className:"self-start text-[10px] text-spur-text-muted hover:text-error px-2 py-0.5 rounded border border-spur-border/40 hover:border-error/40 transition-colors cursor-pointer focus:outline-none focus:ring-2 focus:ring-spur-text/40",children:"Close (Esc)"})]})})}),d&&U&&typeof document<"u"?da.createPortal(U,document.body):null]})}const rG=Nt(),aG=`${rG}/jobs/stats`,cy=50;function sG(e){if(e===null||typeof e!="object")return null;const t=e.stats;if(t===null||typeof t!="object")return null;const n=t;return typeof n.pending!="number"||typeof n.processing!="number"||typeof n.completed!="number"||typeof n.failed!="number"?null:{stats:{pending:n.pending,processing:n.processing,completed:n.completed,failed:n.failed}}}function fw(e){switch(e.split(".").pop()??""){case"enqueued":return"pending";case"retrying":return"retrying";case"completed":return"completed";case"failed":return"failed";case"executed":return"executed";default:return null}}function Sl(e,t){const n={};if(!t)return n;const r=i=>{const o=t[i];return typeof o=="string"&&o.length>0?o:void 0},a=i=>{const o=t[i];return typeof o=="number"&&Number.isFinite(o)?o:void 0},s=e.split(".").pop()??"";return n.durationMs=a("durationMs"),s==="executed"?(n.name=r("name"),n.error=r("error")):(n.jobId=r("jobId"),n.type=r("type"),(s==="failed"||s==="retrying")&&(n.attempt=a("attempt")),s==="failed"&&(n.error=r("error"))),n}function mw(e){switch(e){case"completed":case"executed":return"success";case"retrying":return"warning";case"failed":return"error";default:return"neutral"}}function iG(e,t){const n=[];let r=0,a=0;for(;r<e.length&&a<t.length;){const s=e[r],i=t[a];if(s&&i&&s.occurredAt>=i.occurredAt)n.push(s),r++;else if(i)n.push(i),a++;else if(s)n.push(s),r++;else break}for(;r<e.length;){const s=e[r];s&&n.push(s),r++}for(;a<t.length;){const s=t[a];s&&n.push(s),a++}return n}function oG(e){const t=[],n=new Map;for(const r of e){const s=r.eventName.startsWith("queue.job.")?Sl(r.eventName,r.payload).jobId:void 0;if(s!==void 0){const i=n.get(s);if(i)i.events.push(r);else{const o={kind:"thread",jobId:s,events:[r]};n.set(s,o),t.push(o)}}else t.push({kind:"standalone",row:r})}return t}function lG(e){if(e.length<2)return null;const t=Date.parse(e[0]?.occurredAt??""),n=Date.parse(e.at(-1)?.occurredAt??"");return!Number.isFinite(t)||!Number.isFinite(n)?null:Math.max(0,t-n)}function uG({timeRange:e="24h"}={}){const[t,n]=g.useState(null),[r,a]=g.useState(null),s=g.useRef(0);if(g.useEffect(()=>{const o=new AbortController,u=++s.current;return a(null),n(null),(async()=>{try{const c=uw(e),p=xl({prefix:"queue",limit:cy,...c?{since:c}:{}}),d=xl({prefix:"scheduler",limit:cy,...c?{since:c}:{}}),[f,m,b]=await Promise.all([Tt(new Request(aG,{signal:o.signal})),Tt(new Request(p,{signal:o.signal})),Tt(new Request(d,{signal:o.signal}))]);if(!f.ok)throw new Error(`job stats fetch failed: ${f.status}`);if(!m.ok)throw new Error(`queue history fetch failed: ${m.status}`);if(!b.ok)throw new Error(`scheduler history fetch failed: ${b.status}`);const E=sG(await f.json()),x=yl(await m.json()),y=yl(await b.json());if(!E)throw new Error("job stats response failed schema validation");if(!x)throw new Error("queue history response failed schema validation");if(!y)throw new Error("scheduler history response failed schema validation");const S=iG(x.events,y.events);if(o.signal.aborted||u!==s.current)return;n({stats:E.stats,events:S})}catch(c){if(o.signal.aborted||u!==s.current)return;a(c instanceof Error?c.message:String(c))}})(),()=>o.abort()},[e]),r)return l.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load jobs: ",r]});if(t===null)return l.jsxs("div",{className:"flex items-center justify-center h-32 text-spur-text-muted text-sm",children:[l.jsx(Ra,{size:"sm"})," Loading jobs…"]});const i=[["Pending",t.stats.pending,"text-spur-text"],["Processing",t.stats.processing,"text-info"],["Completed",t.stats.completed,"text-success"],["Failed",t.stats.failed,"text-error"]];return l.jsxs("div",{className:"flex flex-col gap-4","data-jobs-tab":!0,children:[l.jsxs("div",{className:"p-4 rounded-xl border border-base-content/10 bg-base-200 shadow-sm space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"Current Queue State"}),l.jsx("span",{className:"text-[11px] text-spur-text-muted",children:"Live aggregate counters from queue engine"})]}),l.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:i.map(([o,u,c])=>l.jsx(Ki,{variant:"compact",className:"bg-base-100 border border-spur-border shadow-xs",children:l.jsxs(Xi,{className:"p-3 gap-1",children:[l.jsx("span",{className:"text-[10px] uppercase text-spur-text-muted font-semibold tracking-wider",children:o}),l.jsx("span",{className:`text-xl font-semibold tabular-nums font-mono ${c}`,children:u})]})},o))})]}),l.jsxs("div",{className:"rounded-xl border border-base-content/10 bg-base-200 shadow-sm overflow-hidden flex flex-col",children:[l.jsxs("div",{className:"px-4 py-3 border-b border-base-content/10 bg-base-200 shrink-0 flex items-center justify-between flex-wrap gap-2",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"Recent Job Events"}),l.jsx(Ot,{variant:"outline",size:"xs",className:"font-mono",children:e==="all"?"All time":`Last ${e}`})]}),l.jsxs("span",{className:"text-xs text-spur-text-muted font-mono",children:[t.events.length," event(s)"]})]}),t.events.length===0?l.jsxs("div",{className:"p-8 text-center text-sm text-spur-text-muted italic","data-jobs-empty":!0,children:["No job events ",e==="all"?"recorded yet":`in the last ${e}`," — queue and scheduler have not processed events in this window."]}):l.jsx("ul",{className:"p-3 space-y-2",children:oG(t.events).map(o=>o.kind==="thread"?l.jsx(dG,{item:o},`thread-${o.jobId}`):l.jsx(cG,{row:o.row},o.row.id))})]})]})}function cG({row:e}){const t=g.useMemo(()=>Sl(e.eventName,e.payload),[e.eventName,e.payload]),n=fw(e.eventName),r=e.eventName.startsWith("scheduler."),a=r?t.name??"scheduler":t.jobId??"job",s=r?"scheduler":t.type??"unknown",i=t.durationMs!==void 0?_d(t.durationMs):null;return l.jsx("li",{children:l.jsx(Ki,{variant:"compact",className:"bg-base-200 border border-spur-border",children:l.jsxs(Xi,{className:"p-3 gap-1",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n!==null&&l.jsx(Ot,{variant:mw(n),size:"xs",children:n}),l.jsx("span",{className:"text-xs font-mono text-spur-text font-semibold",children:a}),l.jsx(Ot,{variant:"outline",size:"xs",children:s}),l.jsx("span",{className:"text-[10px] text-spur-text-muted ml-auto font-mono",children:e.occurredAt})]}),l.jsxs("div",{className:"flex items-center gap-3 flex-wrap text-[11px] text-spur-text-muted",children:[t.attempt!==void 0&&l.jsxs("span",{children:["attempt ",l.jsx("span",{className:"font-mono text-spur-text",children:t.attempt})]}),l.jsxs("span",{children:["duration ",l.jsx("span",{className:"font-mono text-spur-text",children:i??"unavailable"})]}),t.error!==void 0&&l.jsx("span",{className:"text-error truncate max-w-md",title:t.error,children:t.error}),!r&&t.type===void 0&&l.jsx("span",{className:"italic",children:"unknown job type"})]}),e.payload!==null&&Object.keys(e.payload).length>0&&l.jsxs("details",{className:"mt-1",children:[l.jsx("summary",{className:"text-[10px] text-spur-text-muted cursor-pointer select-none",children:"raw payload"}),l.jsx("pre",{className:"text-[10px] text-spur-text-muted bg-base-300 rounded p-2 overflow-x-auto mt-1",children:JSON.stringify(e.payload,null,2)})]})]})})})}function dG({item:e}){const t=e.events[0],n=g.useMemo(()=>t?Sl(t.eventName,t.payload):null,[t]);if(!t||!n)return null;const r=fw(t.eventName),a=lG(e.events),s=n.durationMs!==void 0?_d(n.durationMs):a!==null?_d(a):null;return l.jsx("li",{children:l.jsx(Ki,{variant:"compact",className:"bg-base-200 border border-spur-border",children:l.jsxs(Xi,{className:"p-3 gap-1",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r!==null&&l.jsx(Ot,{variant:mw(r),size:"xs",children:r}),l.jsx("span",{className:"text-xs font-mono text-spur-text font-semibold",children:e.jobId}),n.type!==void 0&&l.jsx(Ot,{variant:"outline",size:"xs",children:n.type}),l.jsx("span",{className:"text-[10px] text-spur-text-muted ml-auto font-mono",children:t.occurredAt})]}),l.jsxs("div",{className:"flex items-center gap-3 flex-wrap text-[11px] text-spur-text-muted",children:[n.attempt!==void 0&&l.jsxs("span",{children:["attempt ",l.jsx("span",{className:"font-mono text-spur-text",children:n.attempt})]}),l.jsxs("span",{children:["duration ",l.jsx("span",{className:"font-mono text-spur-text",children:s??"unavailable"})]}),n.error!==void 0&&l.jsx("span",{className:"text-error truncate max-w-md",title:n.error,children:n.error}),l.jsxs("span",{className:"italic",children:[e.events.length," event(s)"]})]}),e.events.length>1&&l.jsxs("details",{className:"mt-1",children:[l.jsxs("summary",{className:"text-[10px] text-spur-text-muted cursor-pointer select-none",children:["event sequence (",e.events.length,")"]}),l.jsx("ol",{className:"mt-1 space-y-1",children:e.events.map(i=>{const o=Sl(i.eventName,i.payload);return l.jsxs("li",{className:"text-[10px] text-spur-text-muted flex items-center gap-2",children:[l.jsx("span",{className:"font-mono",children:i.occurredAt}),l.jsx("span",{children:i.eventName}),o.attempt!==void 0&&l.jsxs("span",{children:["attempt ",o.attempt]})]},i.id)})})]}),t.payload!==null&&Object.keys(t.payload).length>0&&l.jsxs("details",{className:"mt-1",children:[l.jsx("summary",{className:"text-[10px] text-spur-text-muted cursor-pointer select-none",children:"raw payload"}),l.jsx("pre",{className:"text-[10px] text-spur-text-muted bg-base-300 rounded p-2 overflow-x-auto mt-1",children:JSON.stringify(t.payload,null,2)})]})]})})})}function dy(e){if(e===null||typeof e!="object")return null;const t=e;return typeof t.inputTokens!="number"||typeof t.outputTokens!="number"||typeof t.cacheReadTokens!="number"||typeof t.cacheCreationTokens!="number"||typeof t.records!="number"||typeof t.recordsWithUsage!="number"?null:{inputTokens:t.inputTokens,outputTokens:t.outputTokens,cacheReadTokens:t.cacheReadTokens,cacheCreationTokens:t.cacheCreationTokens,records:t.records,recordsWithUsage:t.recordsWithUsage}}function pG(e){if(e===null||typeof e!="object")return null;const t=e;return!(t.role===null||typeof t.role=="string")||typeof t.totalRuns!="number"||typeof t.matchedRuns!="number"||typeof t.unmeasured!="boolean"?null:{role:t.role,totalRuns:t.totalRuns,matchedRuns:t.matchedRuns,exact:dy(t.exact),estimated:dy(t.estimated),unmeasured:t.unmeasured}}function fG(e){if(e===null||typeof e!="object")return null;const t=e;return!(t.role===null||typeof t.role=="string")||typeof t.executor!="string"||!(t.source===null||typeof t.source=="string")||typeof t.runs!="number"||typeof t.escalations!="number"?null:{role:t.role,executor:t.executor,source:t.source,runs:t.runs,escalations:t.escalations}}function mG(e){if(e===null||typeof e!="object")return null;const t=e,n=t.routing,r=t.tokens;if(n===null||typeof n!="object"||r===null||typeof r!="object")return null;const a=n,s=r,i=a.window;if(i===null||typeof i!="object")return null;const o=i;if(typeof o.since!="string"||typeof o.until!="string"||!Array.isArray(a.pairs)||!Array.isArray(s.roles))return null;const u=[];for(const p of a.pairs){const d=fG(p);d&&u.push(d)}const c=[];for(const p of s.roles){const d=pG(p);d&&c.push(d)}return{window:{since:o.since,until:o.until},pairs:u,roles:c}}function hG(e){switch(e){case"explicit":return"pinned";case"role":return"resolved";case"default":return"default";case null:return"—";default:return e}}const gG=new Intl.NumberFormat("en-US");function Ya(e){return gG.format(e)}function py({label:e,totals:t}){return l.jsxs("div",{"data-token-bucket":e,className:"text-xs",children:[l.jsx(Ot,{size:"xs",variant:e==="estimated"?"warning":"success",children:e}),l.jsxs("dl",{className:"grid grid-cols-2 gap-x-4 gap-y-0.5 mt-1",children:[l.jsx("dt",{className:"text-spur-text-muted",children:"input"}),l.jsx("dd",{className:"tabular-nums text-right",children:Ya(t.inputTokens)}),l.jsx("dt",{className:"text-spur-text-muted",children:"cache read"}),l.jsx("dd",{className:"tabular-nums text-right",children:Ya(t.cacheReadTokens)}),l.jsx("dt",{className:"text-spur-text-muted",children:"cache write"}),l.jsx("dd",{className:"tabular-nums text-right",children:Ya(t.cacheCreationTokens)}),l.jsx("dt",{className:"text-spur-text-muted",children:"output"}),l.jsx("dd",{className:"tabular-nums text-right",children:Ya(t.outputTokens)})]})]})}function bG({role:e}){const t=e.role??"—";return l.jsxs("div",{className:"bg-base-100 border border-spur-border rounded-md p-3","data-role-attribution":t,children:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsx("span",{className:"text-sm font-semibold text-spur-text",children:t}),l.jsxs("span",{className:"text-[10px] text-spur-text-muted tabular-nums",children:["matched ",e.matchedRuns," of ",e.totalRuns," runs"]})]}),e.unmeasured?l.jsxs("div",{className:"mt-1 text-xs","data-unmeasured":!0,children:[l.jsx(Ot,{size:"xs",variant:"ghost",children:"unmeasured"}),l.jsx("span",{className:"ml-1 text-spur-text-muted",children:"no token data recorded for this role — not a measured zero"})]}):l.jsxs("div",{className:"mt-2 flex flex-wrap gap-4",children:[e.exact?l.jsx(py,{label:"exact",totals:e.exact}):null,e.estimated?l.jsx(py,{label:"estimated",totals:e.estimated}):null]})]})}function EG(){const[e,t]=g.useState(null),[n,r]=g.useState(null);if(g.useEffect(()=>{const s=new AbortController;return(async()=>{try{const i=await Tt(new Request(`${Nt()}/observability/routing-summary`,{signal:s.signal}));if(!i.ok)throw new Error(`routing summary fetch failed: ${i.status}`);const o=mG(await i.json());if(!o)throw new Error("routing summary response failed schema validation");t(o)}catch(i){if(s.signal.aborted)return;r(i instanceof Error?i.message:String(i))}})(),()=>s.abort()},[]),n)return l.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load routing summary: ",n]});if(e===null)return l.jsxs("div",{className:"flex items-center justify-center h-32 text-spur-text-muted text-sm",children:[l.jsx(Ra,{size:"sm"})," Loading routing summary…"]});const a=e.pairs.length===0&&e.roles.length===0;return l.jsxs("div",{className:"flex flex-col h-full overflow-hidden","data-routing-tab":!0,children:[l.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-base-200 shrink-0 flex items-baseline justify-between",children:[l.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"Routing & token consumption"}),l.jsxs("span",{className:"text-[10px] text-spur-text-muted tabular-nums","data-covered-window":!0,children:["covered ",e.window.since," → ",e.window.until]})]}),a?l.jsx("div",{className:"flex-1 flex items-center justify-center p-4","data-routing-empty":!0,children:l.jsx("div",{className:"text-sm text-spur-text-muted italic",children:"No routing attribution has been recorded in the covered window — nothing to show yet."})}):l.jsxs("div",{className:"flex-1 overflow-y-auto p-3 space-y-4",children:[e.pairs.length>0?l.jsxs("section",{className:"bg-base-100 border border-spur-border rounded-md","data-routing-table":!0,children:[l.jsxs("div",{className:"px-3 py-2 border-b border-spur-border",children:[l.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"Role → executor"}),l.jsx("span",{className:"ml-2 text-[10px] text-spur-text-muted",children:"runs and escalations per pair; pinned and role-resolved counted separately"})]}),l.jsxs("table",{className:"table table-sm w-full",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"text-[10px] uppercase text-spur-text-muted",children:[l.jsx("th",{children:"Role"}),l.jsx("th",{children:"Executor"}),l.jsx("th",{children:"Source"}),l.jsx("th",{className:"text-right",children:"Runs"}),l.jsx("th",{className:"text-right",children:"Escalations"})]})}),l.jsx("tbody",{children:e.pairs.map(s=>l.jsxs("tr",{children:[l.jsx("td",{className:"text-sm text-spur-text",children:s.role??"—"}),l.jsx("td",{className:"text-sm text-spur-text",children:s.executor}),l.jsx("td",{children:l.jsx(Ot,{size:"xs",variant:s.source==="explicit"?"warning":"ghost",children:hG(s.source)})}),l.jsx("td",{className:"text-right tabular-nums text-spur-text",children:Ya(s.runs)}),l.jsx("td",{className:"text-right tabular-nums text-spur-text",children:Ya(s.escalations)})]},`${s.role??""}:${s.executor}:${s.source??""}`))})]}),l.jsx("div",{className:"px-3 py-1.5 border-t border-spur-border text-[10px] text-spur-text-muted",children:"“—” role groups pure pins (no role recorded); escalations count runs that started too cheap on this executor."})]}):null,e.roles.length>0?l.jsxs("section",{"data-token-section":!0,children:[l.jsxs("div",{className:"px-1 pb-1.5",children:[l.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"Token consumption by role"}),l.jsx("span",{className:"ml-2 text-[10px] text-spur-text-muted",children:"input, cache read, cache write, output — token totals only"})]}),l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:e.roles.map(s=>l.jsx(bG,{role:s},s.role??"pin"))})]}):null]})]})}const Cc=[{id:"system-events",label:"System Events",component:JH},{id:"jobs",label:"Jobs",component:uG},{id:"routing",label:"Routing",component:EG}];function xG(){const[e,t]=g.useState(Cc[0]?.id??""),[n,r]=g.useState("24h"),[a,s]=g.useState({status:"connecting",rate:0,lastEventAt:null}),o=Cc.find(m=>m.id===e)?.component,u=g.useCallback(m=>{s(m)},[]),c=e==="system-events",p=c?a.status:"idle",d=c?a.status==="live"?`live tail · ${a.rate} evt/60s`:a.status==="connecting"?"connecting…":a.status==="paused"?"live tail paused":"stream error":"live tail idle",f=p==="live"?"bg-emerald-400 animate-pulse":p==="connecting"?"bg-amber-400":p==="errored"?"bg-error":"bg-base-content/40";return l.jsxs("div",{className:"flex flex-col gap-4 p-4 max-w-[1600px] mx-auto w-full","data-observability-shell":!0,children:[l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4 border-b border-base-content/10 pb-3 shrink-0",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("span",{className:"text-2xl",children:"📡"}),l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl font-bold tracking-tight",children:"Observability"}),l.jsx("p",{className:"text-xs text-base-content/60",children:"System event streams, queue execution telemetry, and routing attribution"}),l.jsxs("p",{className:"livechip mt-1 inline-flex items-center gap-1.5 rounded-full border border-base-content/10 px-2 py-0.5 text-xs text-base-content/60 font-mono","data-testid":"observability-liveness-chip",role:"status","aria-live":"polite",children:[l.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${f}`,"aria-hidden":"true"}),d,c&&a.lastEventAt&&l.jsxs(l.Fragment,{children:[" · last ",l.jsx("time",{dateTime:a.lastEventAt,children:new Date(a.lastEventAt).toLocaleTimeString()})]})]})]})]}),l.jsx("div",{role:"tablist","aria-label":"Observability tabs",className:"flex items-center gap-1 bg-base-300 p-1 rounded-xl",children:Cc.map(m=>{const b=m.id===e;return l.jsx("button",{type:"button",role:"tab","aria-selected":b,"aria-controls":`observability-tab-panel-${m.id}`,id:`observability-tab-${m.id}`,onClick:()=>t(m.id),className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer ${b?"bg-primary text-primary-content font-bold shadow-sm":"text-base-content/70 hover:bg-base-content/10"}`,children:m.label},m.id)})})]}),l.jsx("div",{role:"tabpanel",id:`observability-tab-panel-${e}`,"aria-labelledby":`observability-tab-${e}`,className:"mt-2 flex flex-col gap-4",children:o?l.jsx(o,{onLivenessChange:u,timeRange:n,onTimeRangeChange:r}):null})]})}const yG={id:"observability",name:"Observability",icon:"📡",route:"observability",component:xG,sidebarLabel:"Observability",order:0},TG=Object.freeze(Object.defineProperty({__proto__:null,module:yG},Symbol.toStringTag,{value:"Module"})),vu=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function As(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function yb(e){return"nodeType"in e}function Pn(e){var t,n;return e?As(e)?e:yb(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Tb(e){const{Document:t}=Pn(e);return e instanceof t}function Ji(e){return As(e)?!1:e instanceof Pn(e).HTMLElement}function hw(e){return e instanceof Pn(e).SVGElement}function Ns(e){return e?As(e)?e.document:yb(e)?Tb(e)?e:Ji(e)||hw(e)?e.ownerDocument:document:document:document}const Or=vu?g.useLayoutEffect:g.useEffect;function wu(e){const t=g.useRef(e);return Or(()=>{t.current=e}),g.useCallback(function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return t.current==null?void 0:t.current(...r)},[])}function SG(){const e=g.useRef(null),t=g.useCallback((r,a)=>{e.current=setInterval(r,a)},[]),n=g.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ci(e,t){t===void 0&&(t=[e]);const n=g.useRef(e);return Or(()=>{n.current!==e&&(n.current=e)},t),n}function eo(e,t){const n=g.useRef();return g.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function vl(e){const t=wu(e),n=g.useRef(null),r=g.useCallback(a=>{a!==n.current&&t?.(a,n.current),n.current=a},[]);return[n,r]}function wl(e){const t=g.useRef();return g.useEffect(()=>{t.current=e},[e]),t.current}let kc={};function Au(e,t){return g.useMemo(()=>{if(t)return t;const n=kc[e]==null?0:kc[e]+1;return kc[e]=n,e+"-"+n},[e,t])}function gw(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.reduce((s,i)=>{const o=Object.entries(i);for(const[u,c]of o){const p=s[u];p!=null&&(s[u]=p+e*c)}return s},{...t})}}const es=gw(1),Al=gw(-1);function vG(e){return"clientX"in e&&"clientY"in e}function Sb(e){if(!e)return!1;const{KeyboardEvent:t}=Pn(e.target);return t&&e instanceof t}function wG(e){if(!e)return!1;const{TouchEvent:t}=Pn(e.target);return t&&e instanceof t}function Nl(e){if(wG(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return vG(e)?{x:e.clientX,y:e.clientY}:null}const us=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[us.Translate.toString(e),us.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),fy="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function AG(e){return e.matches(fy)?e:e.querySelector(fy)}const NG={display:"none"};function _G(e){let{id:t,value:n}=e;return tt.createElement("div",{id:t,style:NG},n)}function CG(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const a={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return tt.createElement("div",{id:t,style:a,role:"status","aria-live":r,"aria-atomic":!0},n)}function kG(){const[e,t]=g.useState("");return{announce:g.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const bw=g.createContext(null);function IG(e){const t=g.useContext(bw);g.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function RG(){const[e]=g.useState(()=>new Set),t=g.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[g.useCallback(r=>{let{type:a,event:s}=r;e.forEach(i=>{var o;return(o=i[a])==null?void 0:o.call(i,s)})},[e]),t]}const DG={draggable:`
|
|
175
175
|
To pick up a draggable item, press the space bar.
|
|
176
176
|
While dragging, use the arrow keys to move the item.
|
|
177
177
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
178
|
-
`},OG={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function LG(e){let{announcements:t=OG,container:n,hiddenTextDescribedById:r,screenReaderInstructions:a=DG}=e;const{announce:s,announcement:i}=kG(),o=Au("DndLiveRegion"),[u,c]=g.useState(!1);if(g.useEffect(()=>{c(!0)},[]),IG(g.useMemo(()=>({onDragStart(d){let{active:f}=d;s(t.onDragStart({active:f}))},onDragMove(d){let{active:f,over:m}=d;t.onDragMove&&s(t.onDragMove({active:f,over:m}))},onDragOver(d){let{active:f,over:m}=d;s(t.onDragOver({active:f,over:m}))},onDragEnd(d){let{active:f,over:m}=d;s(t.onDragEnd({active:f,over:m}))},onDragCancel(d){let{active:f,over:m}=d;s(t.onDragCancel({active:f,over:m}))}}),[s,t])),!u)return null;const p=et.createElement(et.Fragment,null,et.createElement(_G,{id:r,value:a.draggable}),et.createElement(CG,{id:o,announcement:i}));return n?da.createPortal(p,n):p}var on;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(on||(on={}));function _l(){}function my(e,t){return g.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function FG(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const cr=Object.freeze({x:0,y:0});function MG(e,t){const n=Nl(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function PG(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function jG(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function BG(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),i=a-r,o=s-n;if(r<a&&n<s){const u=t.width*t.height,c=e.width*e.height,p=i*o,d=p/(u+c-p);return Number(d.toFixed(4))}return 0}const UG=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=[];for(const s of r){const{id:i}=s,o=n.get(i);if(o){const u=BG(o,t);u>0&&a.push({id:i,data:{droppableContainer:s,value:u}})}}return a.sort(PG)};function $G(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Ew(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:cr}function zG(e){return function(n){for(var r=arguments.length,a=new Array(r>1?r-1:0),s=1;s<r;s++)a[s-1]=arguments[s];return a.reduce((i,o)=>({...i,top:i.top+e*o.y,bottom:i.bottom+e*o.y,left:i.left+e*o.x,right:i.right+e*o.x}),{...n})}}const HG=zG(1);function xw(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function GG(e,t,n){const r=xw(t);if(!r)return e;const{scaleX:a,scaleY:s,x:i,y:o}=r,u=e.left-i-(1-a)*parseFloat(n),c=e.top-o-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),p=a?e.width/a:e.width,d=s?e.height/s:e.height;return{width:p,height:d,top:c,right:u+p,bottom:c+d,left:u}}const WG={ignoreTransform:!1};function to(e,t){t===void 0&&(t=WG);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:p}=Pn(e).getComputedStyle(e);c&&(n=GG(n,c,p))}const{top:r,left:a,width:s,height:i,bottom:o,right:u}=n;return{top:r,left:a,width:s,height:i,bottom:o,right:u}}function hy(e){return to(e,{ignoreTransform:!0})}function VG(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function qG(e,t){return t===void 0&&(t=Pn(e).getComputedStyle(e)),t.position==="fixed"}function YG(e,t){t===void 0&&(t=Pn(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const s=t[a];return typeof s=="string"?n.test(s):!1})}function vb(e,t){const n=[];function r(a){if(t!=null&&n.length>=t||!a)return n;if(Tb(a)&&a.scrollingElement!=null&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!Ji(a)||hw(a)||n.includes(a))return n;const s=Pn(e).getComputedStyle(a);return a!==e&&YG(a,s)&&n.push(a),qG(a,s)?n:r(a.parentNode)}return e?r(e):n}function yw(e){const[t]=vb(e,1);return t??null}function Ic(e){return!vu||!e?null:As(e)?e:yb(e)?Tb(e)||e===Ns(e).scrollingElement?window:Ji(e)?e:null:null}function Tw(e){return As(e)?e.scrollX:e.scrollLeft}function Sw(e){return As(e)?e.scrollY:e.scrollTop}function Cd(e){return{x:Tw(e),y:Sw(e)}}var hn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(hn||(hn={}));function vw(e){return!vu||!e?!1:e===document.scrollingElement}function ww(e){const t={x:0,y:0},n=vw(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},a=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,i=e.scrollTop>=r.y,o=e.scrollLeft>=r.x;return{isTop:a,isLeft:s,isBottom:i,isRight:o,maxScroll:r,minScroll:t}}const ZG={x:.2,y:.2};function KG(e,t,n,r,a){let{top:s,left:i,right:o,bottom:u}=n;r===void 0&&(r=10),a===void 0&&(a=ZG);const{isTop:c,isBottom:p,isLeft:d,isRight:f}=ww(e),m={x:0,y:0},b={x:0,y:0},E={height:t.height*a.y,width:t.width*a.x};return!c&&s<=t.top+E.height?(m.y=hn.Backward,b.y=r*Math.abs((t.top+E.height-s)/E.height)):!p&&u>=t.bottom-E.height&&(m.y=hn.Forward,b.y=r*Math.abs((t.bottom-E.height-u)/E.height)),!f&&o>=t.right-E.width?(m.x=hn.Forward,b.x=r*Math.abs((t.right-E.width-o)/E.width)):!d&&i<=t.left+E.width&&(m.x=hn.Backward,b.x=r*Math.abs((t.left+E.width-i)/E.width)),{direction:m,speed:b}}function XG(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:i}=window;return{top:0,left:0,right:s,bottom:i,width:s,height:i}}const{top:t,left:n,right:r,bottom:a}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:a,width:e.clientWidth,height:e.clientHeight}}function Aw(e){return e.reduce((t,n)=>es(t,Cd(n)),cr)}function QG(e){return e.reduce((t,n)=>t+Tw(n),0)}function JG(e){return e.reduce((t,n)=>t+Sw(n),0)}function Nw(e,t){if(t===void 0&&(t=to),!e)return;const{top:n,left:r,bottom:a,right:s}=t(e);yw(e)&&(a<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const eW=[["x",["left","right"],QG],["y",["top","bottom"],JG]];class wb{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=vb(n),a=Aw(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,i,o]of eW)for(const u of i)Object.defineProperty(this,u,{get:()=>{const c=o(r),p=a[s]-c;return this.rect[u]+p},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ui{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var a;(a=this.target)==null||a.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function tW(e){const{EventTarget:t}=Pn(e);return e instanceof t?e:Ns(e)}function Rc(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var er;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(er||(er={}));function gy(e){e.preventDefault()}function nW(e){e.stopPropagation()}var Ft;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Ft||(Ft={}));const _w={start:[Ft.Space,Ft.Enter],cancel:[Ft.Esc],end:[Ft.Space,Ft.Enter,Ft.Tab]},rW=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Ft.Right:return{...n,x:n.x+25};case Ft.Left:return{...n,x:n.x-25};case Ft.Down:return{...n,y:n.y+25};case Ft.Up:return{...n,y:n.y-25}}};class Ab{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new ui(Ns(n)),this.windowListeners=new ui(Pn(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(er.Resize,this.handleCancel),this.windowListeners.add(er.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(er.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Nw(r),n(cr)}handleKeyDown(t){if(Sb(t)){const{active:n,context:r,options:a}=this.props,{keyboardCodes:s=_w,coordinateGetter:i=rW,scrollBehavior:o="smooth"}=a,{code:u}=t;if(s.end.includes(u)){this.handleEnd(t);return}if(s.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:c}=r.current,p=c?{x:c.left,y:c.top}:cr;this.referenceCoordinates||(this.referenceCoordinates=p);const d=i(t,{active:n,context:r.current,currentCoordinates:p});if(d){const f=Al(d,p),m={x:0,y:0},{scrollableAncestors:b}=r.current;for(const E of b){const x=t.code,{isTop:y,isRight:S,isLeft:w,isBottom:A,maxScroll:D,minScroll:N}=ww(E),T=XG(E),v={x:Math.min(x===Ft.Right?T.right-T.width/2:T.right,Math.max(x===Ft.Right?T.left:T.left+T.width/2,d.x)),y:Math.min(x===Ft.Down?T.bottom-T.height/2:T.bottom,Math.max(x===Ft.Down?T.top:T.top+T.height/2,d.y))},R=x===Ft.Right&&!S||x===Ft.Left&&!w,C=x===Ft.Down&&!A||x===Ft.Up&&!y;if(R&&v.x!==d.x){const U=E.scrollLeft+f.x,k=x===Ft.Right&&U<=D.x||x===Ft.Left&&U>=N.x;if(k&&!f.y){E.scrollTo({left:U,behavior:o});return}k?m.x=E.scrollLeft-U:m.x=x===Ft.Right?E.scrollLeft-D.x:E.scrollLeft-N.x,m.x&&E.scrollBy({left:-m.x,behavior:o});break}else if(C&&v.y!==d.y){const U=E.scrollTop+f.y,k=x===Ft.Down&&U<=D.y||x===Ft.Up&&U>=N.y;if(k&&!f.x){E.scrollTo({top:U,behavior:o});return}k?m.y=E.scrollTop-U:m.y=x===Ft.Down?E.scrollTop-D.y:E.scrollTop-N.y,m.y&&E.scrollBy({top:-m.y,behavior:o});break}}this.handleMove(t,es(Al(d,this.referenceCoordinates),m))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Ab.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=_w,onActivation:a}=t,{active:s}=n;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const o=s.activatorNode.current;return o&&e.target!==o?!1:(e.preventDefault(),a?.({event:e.nativeEvent}),!0)}return!1}}];function by(e){return!!(e&&"distance"in e)}function Ey(e){return!!(e&&"delay"in e)}class Nb{constructor(t,n,r){var a;r===void 0&&(r=tW(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:s}=t,{target:i}=s;this.props=t,this.events=n,this.document=Ns(i),this.documentListeners=new ui(this.document),this.listeners=new ui(r),this.windowListeners=new ui(Pn(i)),this.initialCoordinates=(a=Nl(s))!=null?a:cr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(er.Resize,this.handleCancel),this.windowListeners.add(er.DragStart,gy),this.windowListeners.add(er.VisibilityChange,this.handleCancel),this.windowListeners.add(er.ContextMenu,gy),this.documentListeners.add(er.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ey(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(by(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:a}=this.props;a(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(er.Click,nW,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(er.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:a,props:s}=this,{onMove:i,options:{activationConstraint:o}}=s;if(!a)return;const u=(n=Nl(t))!=null?n:cr,c=Al(a,u);if(!r&&o){if(by(o)){if(o.tolerance!=null&&Rc(c,o.tolerance))return this.handleCancel();if(Rc(c,o.distance))return this.handleStart()}if(Ey(o)&&Rc(c,o.tolerance))return this.handleCancel();this.handlePending(o,c);return}t.cancelable&&t.preventDefault(),i(u)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Ft.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const aW={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class _b extends Nb{constructor(t){const{event:n}=t,r=Ns(n.target);super(t,aW,r)}}_b.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const sW={move:{name:"mousemove"},end:{name:"mouseup"}};var kd;(function(e){e[e.RightClick=2]="RightClick"})(kd||(kd={}));class iW extends Nb{constructor(t){super(t,sW,Ns(t.event.target))}}iW.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===kd.RightClick?!1:(r?.({event:n}),!0)}}];const Dc={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class oW extends Nb{constructor(t){super(t,Dc)}static setup(){return window.addEventListener(Dc.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Dc.move.name,t)};function t(){}}}oW.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:a}=n;return a.length>1?!1:(r?.({event:n}),!0)}}];var ci;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ci||(ci={}));var Cl;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Cl||(Cl={}));function lW(e){let{acceleration:t,activator:n=ci.Pointer,canScroll:r,draggingRect:a,enabled:s,interval:i=5,order:o=Cl.TreeOrder,pointerCoordinates:u,scrollableAncestors:c,scrollableAncestorRects:p,delta:d,threshold:f}=e;const m=cW({delta:d,disabled:!s}),[b,E]=SG(),x=g.useRef({x:0,y:0}),y=g.useRef({x:0,y:0}),S=g.useMemo(()=>{switch(n){case ci.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case ci.DraggableRect:return a}},[n,a,u]),w=g.useRef(null),A=g.useCallback(()=>{const N=w.current;if(!N)return;const T=x.current.x*y.current.x,v=x.current.y*y.current.y;N.scrollBy(T,v)},[]),D=g.useMemo(()=>o===Cl.TreeOrder?[...c].reverse():c,[o,c]);g.useEffect(()=>{if(!s||!c.length||!S){E();return}for(const N of D){if(r?.(N)===!1)continue;const T=c.indexOf(N),v=p[T];if(!v)continue;const{direction:R,speed:C}=KG(N,v,S,t,f);for(const U of["x","y"])m[U][R[U]]||(C[U]=0,R[U]=0);if(C.x>0||C.y>0){E(),w.current=N,b(A,i),x.current=C,y.current=R;return}}x.current={x:0,y:0},y.current={x:0,y:0},E()},[t,A,r,E,s,i,JSON.stringify(S),JSON.stringify(m),b,c,D,p,JSON.stringify(f)])}const uW={x:{[hn.Backward]:!1,[hn.Forward]:!1},y:{[hn.Backward]:!1,[hn.Forward]:!1}};function cW(e){let{delta:t,disabled:n}=e;const r=wl(t);return eo(a=>{if(n||!r||!a)return uW;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[hn.Backward]:a.x[hn.Backward]||s.x===-1,[hn.Forward]:a.x[hn.Forward]||s.x===1},y:{[hn.Backward]:a.y[hn.Backward]||s.y===-1,[hn.Forward]:a.y[hn.Forward]||s.y===1}}},[n,t,r])}function dW(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return eo(a=>{var s;return t==null?null:(s=r??a)!=null?s:null},[r,t])}function pW(e,t){return g.useMemo(()=>e.reduce((n,r)=>{const{sensor:a}=r,s=a.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,r)}));return[...n,...s]},[]),[e,t])}var ki;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ki||(ki={}));var Id;(function(e){e.Optimized="optimized"})(Id||(Id={}));const xy=new Map;function fW(e,t){let{dragging:n,dependencies:r,config:a}=t;const[s,i]=g.useState(null),{frequency:o,measure:u,strategy:c}=a,p=g.useRef(e),d=x(),f=Ci(d),m=g.useCallback(function(y){y===void 0&&(y=[]),!f.current&&i(S=>S===null?y:S.concat(y.filter(w=>!S.includes(w))))},[f]),b=g.useRef(null),E=eo(y=>{if(d&&!n)return xy;if(!y||y===xy||p.current!==e||s!=null){const S=new Map;for(let w of e){if(!w)continue;if(s&&s.length>0&&!s.includes(w.id)&&w.rect.current){S.set(w.id,w.rect.current);continue}const A=w.node.current,D=A?new wb(u(A),A):null;w.rect.current=D,D&&S.set(w.id,D)}return S}return y},[e,s,n,d,u]);return g.useEffect(()=>{p.current=e},[e]),g.useEffect(()=>{d||m()},[n,d]),g.useEffect(()=>{s&&s.length>0&&i(null)},[JSON.stringify(s)]),g.useEffect(()=>{d||typeof o!="number"||b.current!==null||(b.current=setTimeout(()=>{m(),b.current=null},o))},[o,d,m,...r]),{droppableRects:E,measureDroppableContainers:m,measuringScheduled:s!=null};function x(){switch(c){case ki.Always:return!1;case ki.BeforeDragging:return n;default:return!n}}}function Cb(e,t){return eo(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function mW(e,t){return Cb(e,t)}function hW(e){let{callback:t,disabled:n}=e;const r=wu(t),a=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return g.useEffect(()=>()=>a?.disconnect(),[a]),a}function Nu(e){let{callback:t,disabled:n}=e;const r=wu(t),a=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return g.useEffect(()=>()=>a?.disconnect(),[a]),a}function gW(e){return new wb(to(e),e)}function yy(e,t,n){t===void 0&&(t=gW);const[r,a]=g.useState(null);function s(){a(u=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=u??n)!=null?c:null}const p=t(e);return JSON.stringify(u)===JSON.stringify(p)?u:p})}const i=hW({callback(u){if(e)for(const c of u){const{type:p,target:d}=c;if(p==="childList"&&d instanceof HTMLElement&&d.contains(e)){s();break}}}}),o=Nu({callback:s});return Or(()=>{s(),e?(o?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(o?.disconnect(),i?.disconnect())},[e]),r}function bW(e){const t=Cb(e);return Ew(e,t)}const Ty=[];function EW(e){const t=g.useRef(e),n=eo(r=>e?r&&r!==Ty&&e&&t.current&&e.parentNode===t.current.parentNode?r:vb(e):Ty,[e]);return g.useEffect(()=>{t.current=e},[e]),n}function xW(e){const[t,n]=g.useState(null),r=g.useRef(e),a=g.useCallback(s=>{const i=Ic(s.target);i&&n(o=>o?(o.set(i,Cd(i)),new Map(o)):null)},[]);return g.useEffect(()=>{const s=r.current;if(e!==s){i(s);const o=e.map(u=>{const c=Ic(u);return c?(c.addEventListener("scroll",a,{passive:!0}),[c,Cd(c)]):null}).filter(u=>u!=null);n(o.length?new Map(o):null),r.current=e}return()=>{i(e),i(s)};function i(o){o.forEach(u=>{const c=Ic(u);c?.removeEventListener("scroll",a)})}},[a,e]),g.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,i)=>es(s,i),cr):Aw(e):cr,[e,t])}function Sy(e,t){t===void 0&&(t=[]);const n=g.useRef(null);return g.useEffect(()=>{n.current=null},t),g.useEffect(()=>{const r=e!==cr;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Al(e,n.current):cr}function yW(e){g.useEffect(()=>{if(!vu)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function TW(e,t){return g.useMemo(()=>e.reduce((n,r)=>{let{eventName:a,handler:s}=r;return n[a]=i=>{s(i,t)},n},{}),[e,t])}function Cw(e){return g.useMemo(()=>e?VG(e):null,[e])}const vy=[];function SW(e,t){t===void 0&&(t=to);const[n]=e,r=Cw(n?Pn(n):null),[a,s]=g.useState(vy);function i(){s(()=>e.length?e.map(u=>vw(u)?r:new wb(t(u),u)):vy)}const o=Nu({callback:i});return Or(()=>{o?.disconnect(),i(),e.forEach(u=>o?.observe(u))},[e]),a}function kw(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ji(t)?t:e}function vW(e){let{measure:t}=e;const[n,r]=g.useState(null),a=g.useCallback(c=>{for(const{target:p}of c)if(Ji(p)){r(d=>{const f=t(p);return d?{...d,width:f.width,height:f.height}:f});break}},[t]),s=Nu({callback:a}),i=g.useCallback(c=>{const p=kw(c);s?.disconnect(),p&&s?.observe(p),r(p?t(p):null)},[t,s]),[o,u]=vl(i);return g.useMemo(()=>({nodeRef:o,rect:n,setRef:u}),[n,o,u])}const wW=[{sensor:_b,options:{}},{sensor:Ab,options:{}}],AW={current:{}},Vo={draggable:{measure:hy},droppable:{measure:hy,strategy:ki.WhileDragging,frequency:Id.Optimized},dragOverlay:{measure:to}};class di extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const NW={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new di,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:_l},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Vo,measureDroppableContainers:_l,windowRect:null,measuringScheduled:!1},Iw={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:_l,draggableNodes:new Map,over:null,measureDroppableContainers:_l},no=g.createContext(Iw),Rw=g.createContext(NW);function _W(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new di}}}function CW(e,t){switch(t.type){case on.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case on.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case on.DragEnd:case on.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case on.RegisterDroppable:{const{element:n}=t,{id:r}=n,a=new di(e.droppable.containers);return a.set(r,n),{...e,droppable:{...e.droppable,containers:a}}}case on.SetDroppableDisabled:{const{id:n,key:r,disabled:a}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const i=new di(e.droppable.containers);return i.set(n,{...s,disabled:a}),{...e,droppable:{...e.droppable,containers:i}}}case on.UnregisterDroppable:{const{id:n,key:r}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const s=new di(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function kW(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:a}=g.useContext(no),s=wl(r),i=wl(n?.id);return g.useEffect(()=>{if(!t&&!r&&s&&i!=null){if(!Sb(s)||document.activeElement===s.target)return;const o=a.get(i);if(!o)return;const{activatorNode:u,node:c}=o;if(!u.current&&!c.current)return;requestAnimationFrame(()=>{for(const p of[u.current,c.current]){if(!p)continue;const d=AG(p);if(d){d.focus();break}}})}},[r,t,a,i,s]),null}function Dw(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((a,s)=>s({transform:a,...r}),n):n}function IW(e){return g.useMemo(()=>({draggable:{...Vo.draggable,...e?.draggable},droppable:{...Vo.droppable,...e?.droppable},dragOverlay:{...Vo.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function RW(e){let{activeNode:t,measure:n,initialRect:r,config:a=!0}=e;const s=g.useRef(!1),{x:i,y:o}=typeof a=="boolean"?{x:a,y:a}:a;Or(()=>{if(!i&&!o||!t){s.current=!1;return}if(s.current||!r)return;const c=t?.node.current;if(!c||c.isConnected===!1)return;const p=n(c),d=Ew(p,r);if(i||(d.x=0),o||(d.y=0),s.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const f=yw(c);f&&f.scrollBy({top:d.y,left:d.x})}},[t,i,o,r,n])}const _u=g.createContext({...cr,scaleX:1,scaleY:1});var Hr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Hr||(Hr={}));const DW=g.memo(function(t){var n,r,a,s;let{id:i,accessibility:o,autoScroll:u=!0,children:c,sensors:p=wW,collisionDetection:d=UG,measuring:f,modifiers:m,...b}=t;const E=g.useReducer(CW,void 0,_W),[x,y]=E,[S,w]=RG(),[A,D]=g.useState(Hr.Uninitialized),N=A===Hr.Initialized,{draggable:{active:T,nodes:v,translate:R},droppable:{containers:C}}=x,U=T!=null?v.get(T):null,k=g.useRef({initial:null,translated:null}),j=g.useMemo(()=>{var Le;return T!=null?{id:T,data:(Le=U?.data)!=null?Le:AW,rect:k}:null},[T,U]),G=g.useRef(null),[$,te]=g.useState(null),[H,se]=g.useState(null),de=Ci(b,Object.values(b)),O=Au("DndDescribedBy",i),ne=g.useMemo(()=>C.getEnabled(),[C]),pe=IW(f),{droppableRects:L,measureDroppableContainers:ke,measuringScheduled:Re}=fW(ne,{dragging:N,dependencies:[R.x,R.y],config:pe.droppable}),Q=dW(v,T),_e=g.useMemo(()=>H?Nl(H):null,[H]),fe=Qt(),X=mW(Q,pe.draggable.measure);RW({activeNode:T!=null?v.get(T):null,config:fe.layoutShiftCompensation,initialRect:X,measure:pe.draggable.measure});const Ve=yy(Q,pe.draggable.measure,X),ge=yy(Q?Q.parentElement:null),me=g.useRef({activatorEvent:null,active:null,activeNode:Q,collisionRect:null,collisions:null,droppableRects:L,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:C,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Te=C.getNodeFor((n=me.current.over)==null?void 0:n.id),ve=vW({measure:pe.dragOverlay.measure}),ie=(r=ve.nodeRef.current)!=null?r:Q,Ze=N?(a=ve.rect)!=null?a:Ve:null,ot=!!(ve.nodeRef.current&&ve.rect),rt=bW(ot?null:Ve),Ht=Cw(ie?Pn(ie):null),St=EW(N?Te??Q:null),Ct=SW(St),Zt=Dw(m,{transform:{x:R.x-rt.x,y:R.y-rt.y,scaleX:1,scaleY:1},activatorEvent:H,active:j,activeNodeRect:Ve,containerNodeRect:ge,draggingNodeRect:Ze,over:me.current.over,overlayNodeRect:ve.rect,scrollableAncestors:St,scrollableAncestorRects:Ct,windowRect:Ht}),at=_e?es(_e,R):null,De=xW(St),Je=Sy(De),Z=Sy(De,[Ve]),oe=es(Zt,Je),J=Ze?HG(Ze,Zt):null,ue=j&&J?d({active:j,collisionRect:J,droppableRects:L,droppableContainers:ne,pointerCoordinates:at}):null,Pe=jG(ue,"id"),[qe,ht]=g.useState(null),Rt=ot?Zt:es(Zt,Z),kt=$G(Rt,(s=qe?.rect)!=null?s:null,Ve),jt=g.useRef(null),ae=g.useCallback((Le,ft)=>{let{sensor:Ke,options:Dt}=ft;if(G.current==null)return;const nt=v.get(G.current);if(!nt)return;const Qe=Le.nativeEvent,wt=new Ke({active:G.current,activeNode:nt,event:Qe,options:Dt,context:me,onAbort(W){if(!v.get(W))return;const{onDragAbort:M}=de.current,z={id:W};M?.(z),S({type:"onDragAbort",event:z})},onPending(W,Be,M,z){if(!v.get(W))return;const{onDragPending:le}=de.current,be={id:W,constraint:Be,initialCoordinates:M,offset:z};le?.(be),S({type:"onDragPending",event:be})},onStart(W){const Be=G.current;if(Be==null)return;const M=v.get(Be);if(!M)return;const{onDragStart:z}=de.current,Y={activatorEvent:Qe,active:{id:Be,data:M.data,rect:k}};da.unstable_batchedUpdates(()=>{z?.(Y),D(Hr.Initializing),y({type:on.DragStart,initialCoordinates:W,active:Be}),S({type:"onDragStart",event:Y}),te(jt.current),se(Qe)})},onMove(W){y({type:on.DragMove,coordinates:W})},onEnd:Kt(on.DragEnd),onCancel:Kt(on.DragCancel)});jt.current=wt;function Kt(W){return async function(){const{active:M,collisions:z,over:Y,scrollAdjustedTranslate:le}=me.current;let be=null;if(M&&le){const{cancelDrop:Ie}=de.current;be={activatorEvent:Qe,active:M,collisions:z,delta:le,over:Y},W===on.DragEnd&&typeof Ie=="function"&&await Promise.resolve(Ie(be))&&(W=on.DragCancel)}G.current=null,da.unstable_batchedUpdates(()=>{y({type:W}),D(Hr.Uninitialized),ht(null),te(null),se(null),jt.current=null;const Ie=W===on.DragEnd?"onDragEnd":"onDragCancel";if(be){const Ce=de.current[Ie];Ce?.(be),S({type:Ie,event:be})}})}}},[v]),Ne=g.useCallback((Le,ft)=>(Ke,Dt)=>{const nt=Ke.nativeEvent,Qe=v.get(Dt);if(G.current!==null||!Qe||nt.dndKit||nt.defaultPrevented)return;const wt={active:Qe};Le(Ke,ft.options,wt)===!0&&(nt.dndKit={capturedBy:ft.sensor},G.current=Dt,ae(Ke,ft))},[v,ae]),ze=pW(p,Ne);yW(p),Or(()=>{Ve&&A===Hr.Initializing&&D(Hr.Initialized)},[Ve,A]),g.useEffect(()=>{const{onDragMove:Le}=de.current,{active:ft,activatorEvent:Ke,collisions:Dt,over:nt}=me.current;if(!ft||!Ke)return;const Qe={active:ft,activatorEvent:Ke,collisions:Dt,delta:{x:oe.x,y:oe.y},over:nt};da.unstable_batchedUpdates(()=>{Le?.(Qe),S({type:"onDragMove",event:Qe})})},[oe.x,oe.y]),g.useEffect(()=>{const{active:Le,activatorEvent:ft,collisions:Ke,droppableContainers:Dt,scrollAdjustedTranslate:nt}=me.current;if(!Le||G.current==null||!ft||!nt)return;const{onDragOver:Qe}=de.current,wt=Dt.get(Pe),Kt=wt&&wt.rect.current?{id:wt.id,rect:wt.rect.current,data:wt.data,disabled:wt.disabled}:null,W={active:Le,activatorEvent:ft,collisions:Ke,delta:{x:nt.x,y:nt.y},over:Kt};da.unstable_batchedUpdates(()=>{ht(Kt),Qe?.(W),S({type:"onDragOver",event:W})})},[Pe]),Or(()=>{me.current={activatorEvent:H,active:j,activeNode:Q,collisionRect:J,collisions:ue,droppableRects:L,draggableNodes:v,draggingNode:ie,draggingNodeRect:Ze,droppableContainers:C,over:qe,scrollableAncestors:St,scrollAdjustedTranslate:oe},k.current={initial:Ze,translated:J}},[j,Q,ue,J,v,ie,Ze,L,C,qe,St,oe]),lW({...fe,delta:R,draggingRect:J,pointerCoordinates:at,scrollableAncestors:St,scrollableAncestorRects:Ct});const je=g.useMemo(()=>({active:j,activeNode:Q,activeNodeRect:Ve,activatorEvent:H,collisions:ue,containerNodeRect:ge,dragOverlay:ve,draggableNodes:v,droppableContainers:C,droppableRects:L,over:qe,measureDroppableContainers:ke,scrollableAncestors:St,scrollableAncestorRects:Ct,measuringConfiguration:pe,measuringScheduled:Re,windowRect:Ht}),[j,Q,Ve,H,ue,ge,ve,v,C,L,qe,ke,St,Ct,pe,Re,Ht]),vt=g.useMemo(()=>({activatorEvent:H,activators:ze,active:j,activeNodeRect:Ve,ariaDescribedById:{draggable:O},dispatch:y,draggableNodes:v,over:qe,measureDroppableContainers:ke}),[H,ze,j,Ve,y,O,v,qe,ke]);return et.createElement(bw.Provider,{value:w},et.createElement(no.Provider,{value:vt},et.createElement(Rw.Provider,{value:je},et.createElement(_u.Provider,{value:kt},c)),et.createElement(kW,{disabled:o?.restoreFocus===!1})),et.createElement(LG,{...o,hiddenTextDescribedById:O}));function Qt(){const Le=$?.autoScrollEnabled===!1,ft=typeof u=="object"?u.enabled===!1:u===!1,Ke=N&&!Le&&!ft;return typeof u=="object"?{...u,enabled:Ke}:{enabled:Ke}}}),OW=g.createContext(null),wy="button",LW="Draggable";function FW(e){let{id:t,data:n,disabled:r=!1,attributes:a}=e;const s=Au(LW),{activators:i,activatorEvent:o,active:u,activeNodeRect:c,ariaDescribedById:p,draggableNodes:d,over:f}=g.useContext(no),{role:m=wy,roleDescription:b="draggable",tabIndex:E=0}=a??{},x=u?.id===t,y=g.useContext(x?_u:OW),[S,w]=vl(),[A,D]=vl(),N=TW(i,t),T=Ci(n);Or(()=>(d.set(t,{id:t,key:s,node:S,activatorNode:A,data:T}),()=>{const R=d.get(t);R&&R.key===s&&d.delete(t)}),[d,t]);const v=g.useMemo(()=>({role:m,tabIndex:E,"aria-disabled":r,"aria-pressed":x&&m===wy?!0:void 0,"aria-roledescription":b,"aria-describedby":p.draggable}),[r,m,E,x,b,p.draggable]);return{active:u,activatorEvent:o,activeNodeRect:c,attributes:v,isDragging:x,listeners:r?void 0:N,node:S,over:f,setNodeRef:w,setActivatorNodeRef:D,transform:y}}function MW(){return g.useContext(Rw)}const PW="Droppable",jW={timeout:25};function BW(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:a}=e;const s=Au(PW),{active:i,dispatch:o,over:u,measureDroppableContainers:c}=g.useContext(no),p=g.useRef({disabled:n}),d=g.useRef(!1),f=g.useRef(null),m=g.useRef(null),{disabled:b,updateMeasurementsFor:E,timeout:x}={...jW,...a},y=Ci(E??r),S=g.useCallback(()=>{if(!d.current){d.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{c(Array.isArray(y.current)?y.current:[y.current]),m.current=null},x)},[x]),w=Nu({callback:S,disabled:b||!i}),A=g.useCallback((v,R)=>{w&&(R&&(w.unobserve(R),d.current=!1),v&&w.observe(v))},[w]),[D,N]=vl(A),T=Ci(t);return g.useEffect(()=>{!w||!D.current||(w.disconnect(),d.current=!1,w.observe(D.current))},[D,w]),g.useEffect(()=>(o({type:on.RegisterDroppable,element:{id:r,key:s,disabled:n,node:D,rect:f,data:T}}),()=>o({type:on.UnregisterDroppable,key:s,id:r})),[r]),g.useEffect(()=>{n!==p.current.disabled&&(o({type:on.SetDroppableDisabled,id:r,key:s,disabled:n}),p.current.disabled=n)},[r,s,n,o]),{active:i,rect:f,isOver:u?.id===r,node:D,over:u,setNodeRef:N}}function UW(e){let{animation:t,children:n}=e;const[r,a]=g.useState(null),[s,i]=g.useState(null),o=wl(n);return!n&&!r&&o&&a(o),Or(()=>{if(!s)return;const u=r?.key,c=r?.props.id;if(u==null||c==null){a(null);return}Promise.resolve(t(c,s)).then(()=>{a(null)})},[t,r,s]),et.createElement(et.Fragment,null,n,r?g.cloneElement(r,{ref:i}):null)}const $W={x:0,y:0,scaleX:1,scaleY:1};function zW(e){let{children:t}=e;return et.createElement(no.Provider,{value:Iw},et.createElement(_u.Provider,{value:$W},t))}const HW={position:"fixed",touchAction:"none"},GW=e=>Sb(e)?"transform 250ms ease":void 0,WW=g.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:a,children:s,className:i,rect:o,style:u,transform:c,transition:p=GW}=e;if(!o)return null;const d=a?c:{...c,scaleX:1,scaleY:1},f={...HW,width:o.width,height:o.height,top:o.top,left:o.left,transform:us.Transform.toString(d),transformOrigin:a&&r?MG(r,o):void 0,transition:typeof p=="function"?p(r):p,...u};return et.createElement(n,{className:i,style:f,ref:t},s)}),VW=e=>t=>{let{active:n,dragOverlay:r}=t;const a={},{styles:s,className:i}=e;if(s!=null&&s.active)for(const[o,u]of Object.entries(s.active))u!==void 0&&(a[o]=n.node.style.getPropertyValue(o),n.node.style.setProperty(o,u));if(s!=null&&s.dragOverlay)for(const[o,u]of Object.entries(s.dragOverlay))u!==void 0&&r.node.style.setProperty(o,u);return i!=null&&i.active&&n.node.classList.add(i.active),i!=null&&i.dragOverlay&&r.node.classList.add(i.dragOverlay),function(){for(const[u,c]of Object.entries(a))n.node.style.setProperty(u,c);i!=null&&i.active&&n.node.classList.remove(i.active)}},qW=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:us.Transform.toString(t)},{transform:us.Transform.toString(n)}]},YW={duration:250,easing:"ease",keyframes:qW,sideEffects:VW({styles:{active:{opacity:"0"}}})};function ZW(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:a}=e;return wu((s,i)=>{if(t===null)return;const o=n.get(s);if(!o)return;const u=o.node.current;if(!u)return;const c=kw(i);if(!c)return;const{transform:p}=Pn(i).getComputedStyle(i),d=xw(p);if(!d)return;const f=typeof t=="function"?t:KW(t);return Nw(u,a.draggable.measure),f({active:{id:s,data:o.data,node:u,rect:a.draggable.measure(u)},draggableNodes:n,dragOverlay:{node:i,rect:a.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:a,transform:d})})}function KW(e){const{duration:t,easing:n,sideEffects:r,keyframes:a}={...YW,...e};return s=>{let{active:i,dragOverlay:o,transform:u,...c}=s;if(!t)return;const p={x:o.rect.left-i.rect.left,y:o.rect.top-i.rect.top},d={scaleX:u.scaleX!==1?i.rect.width*u.scaleX/o.rect.width:1,scaleY:u.scaleY!==1?i.rect.height*u.scaleY/o.rect.height:1},f={x:u.x-p.x,y:u.y-p.y,...d},m=a({...c,active:i,dragOverlay:o,transform:{initial:u,final:f}}),[b]=m,E=m[m.length-1];if(JSON.stringify(b)===JSON.stringify(E))return;const x=r?.({active:i,dragOverlay:o,...c}),y=o.node.animate(m,{duration:t,easing:n,fill:"forwards"});return new Promise(S=>{y.onfinish=()=>{x?.(),S()}})}}let Ay=0;function XW(e){return g.useMemo(()=>{if(e!=null)return Ay++,Ay},[e])}const QW=et.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:a,transition:s,modifiers:i,wrapperElement:o="div",className:u,zIndex:c=999}=e;const{activatorEvent:p,active:d,activeNodeRect:f,containerNodeRect:m,draggableNodes:b,droppableContainers:E,dragOverlay:x,over:y,measuringConfiguration:S,scrollableAncestors:w,scrollableAncestorRects:A,windowRect:D}=MW(),N=g.useContext(_u),T=XW(d?.id),v=Dw(i,{activatorEvent:p,active:d,activeNodeRect:f,containerNodeRect:m,draggingNodeRect:x.rect,over:y,overlayNodeRect:x.rect,scrollableAncestors:w,scrollableAncestorRects:A,transform:N,windowRect:D}),R=Cb(f),C=ZW({config:r,draggableNodes:b,droppableContainers:E,measuringConfiguration:S}),U=R?x.setRef:void 0;return et.createElement(zW,null,et.createElement(UW,{animation:C},d&&T?et.createElement(WW,{key:T,id:d.id,ref:U,as:o,activatorEvent:p,adjustScale:t,className:u,transition:s,rect:R,style:{zIndex:c,...a},transform:v},n):null))}),JW=6e4,eV=10080*60*1e3,tV={P1:"error",P2:"warning",P3:"neutral"},nV={backlog:"bg-spur-text-faint",todo:"bg-spur-info",wip:"bg-spur-warning",testing:"bg-spur-accent",done:"bg-spur-success",blocked:"bg-spur-error",cancelled:"bg-spur-text-faint"};function rV(e,t){const n=new Date(e).getTime(),r=t-n,a=Math.floor(r/1e3);if(a<60)return"just now";const s=Math.floor(a/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);if(i<24)return`${i}h ago`;const o=Math.floor(i/24);return o<30?`${o}d ago`:`${Math.floor(o/30)}mo ago`}function Ow({task:e,onClick:t}){const{attributes:n,listeners:r,setNodeRef:a,transform:s,isDragging:i}=FW({id:e.wbs,data:{task:e}}),[o,u]=g.useState(Date.now());g.useEffect(()=>{const m=setInterval(()=>u(Date.now()),JW);return()=>clearInterval(m)},[]);const c=s?{transform:us.Transform.toString(s),zIndex:i?50:void 0}:void 0,{subtaskProgress:p}=hb(),d=p.get(e.wbs),f=e.updatedAt?o-new Date(e.updatedAt).getTime()>eV:!1;return l.jsx(Ki,{variant:"compact",asChild:!0,className:`bg-spur-surface-2 hover:bg-spur-surface-3 rounded-xl border border-spur-border hover:border-spur-accent/40 cursor-pointer transition-colors w-full text-left ${i?"opacity-30":""}`,children:l.jsx("button",{ref:a,type:"button",style:c,onClick:()=>t(e.wbs),...r,...n,"aria-roledescription":"draggable card",children:l.jsxs(Xi,{className:"p-3 gap-1",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-mono font-semibold text-spur-text",children:[l.jsx("span",{className:`h-1.5 w-1.5 rounded-full shrink-0 ${nV[e.status]??"bg-spur-text-faint"}`,"data-status":e.status,"aria-hidden":"true"}),e.wbs]}),e.priority&&l.jsx(Ot,{variant:tV[e.priority]??"outline",size:"xs",children:e.priority})]}),l.jsx("p",{className:"text-sm font-medium text-spur-text leading-snug line-clamp-2",children:e.name}),l.jsxs("div",{className:"flex gap-1 flex-wrap items-center",children:[d&&d.total>0&&l.jsxs("div",{className:"flex items-center gap-1.5","data-testid":"subtask-progress",title:"subtasks done/total",children:[l.jsx("div",{className:"h-1 flex-1 rounded-full bg-spur-border overflow-hidden",children:l.jsx("div",{className:"h-full bg-spur-success",style:{width:`${Math.round(d.done/d.total*100)}%`}})}),l.jsxs("span",{className:"text-[10px] font-mono text-spur-text-muted shrink-0",children:[d.done,"/",d.total]})]}),e.type&&e.type!=="task"&&l.jsx(Ot,{variant:"outline",size:"xs",children:e.type}),e.featureId&&l.jsx(Ot,{variant:"outline",size:"xs",children:e.featureId}),e.updatedAt&&l.jsx("span",{className:`text-xs font-mono ml-auto ${f?"text-spur-text-faint":"text-spur-text-muted"}`,title:e.updatedAt,children:rV(e.updatedAt,o)})]})]})})})}function aV({status:e,label:t,tasks:n,onCardClick:r,sortDir:a,onSortToggle:s}){const{setNodeRef:i,isOver:o}=BW({id:e,data:{status:e}});return l.jsxs("section",{ref:i,"aria-label":`${t} column`,className:`flex flex-col flex-1 min-w-[16rem] rounded-xl border transition-colors duration-200 ${o?"bg-spur-surface-2 border-spur-accent shadow-lg":"bg-spur-surface border-spur-border"}`,children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-spur-border shrink-0",children:[l.jsxs("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:[fb(e)," ",t]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(Ot,{variant:"ghost",size:"sm",children:n.length}),s&&l.jsx(Ge,{variant:"ghost",size:"xs",className:"px-1",onClick:s,"aria-label":`Sort ${t} by WBS`,title:`Sort ${t}: ${a==="asc"?"WBS ↓":a==="desc"?"WBS ↑":"none"}`,children:a==="asc"?"↓":a==="desc"?"↑":"⇅"})]})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto p-2 space-y-2 min-h-[4rem]",children:[n.map(u=>l.jsx(Ow,{task:u,onClick:r},u.wbs)),n.length===0&&l.jsx("div",{className:"flex items-center justify-center h-16 text-xs text-spur-text-muted italic",children:"No tasks"})]})]})}const sV=g.lazy(()=>Bv(()=>import("./TaskDetail.ClAbCXom.js"),__vite__mapDeps([2,1]))),iV=rr,Lw="docs/tasks",Ny="spur:detail-width",oV=new Set(["blocked","cancelled"]);function lV(e,t){return t?e.filter(n=>!(t.status!==void 0&&!t.status.split(",").includes(n.status)||t.featureId&&!n.featureId?.toLowerCase().includes(t.featureId.toLowerCase())||t.parentWbs&&n.parentWbs!==t.parentWbs)):e}function Fw(e){const{onSelectTask:t,filters:n,folder:r,hiddenColumns:a,onConnectionChange:s,onSyncChange:i}=e,[o,u]=g.useState({}),[c,p]=g.useState(Lw),[d,f]=g.useState(null),[m,b]=g.useState(()=>{const ne=typeof window<"u"?Math.min(1728,window.innerWidth*.8):1728;if(typeof window>"u")return ne;try{const pe=Number.parseFloat(window.localStorage.getItem(Ny)??"");if(Number.isFinite(pe)&&pe>0)return Math.min(pe,window.innerWidth*.8)}catch{}return ne}),E=r??c,x=a??oV,y=g.useCallback(()=>sn.task.list({folder:E}),[E]),{tasks:S,loading:w,error:A,connected:D,lastSyncAt:N,setTasks:T,store:v}=hb(y),[R,C]=g.useState(null);g.useEffect(()=>{s?.(D)},[D,s]),g.useEffect(()=>{i?.(N)},[N,i]),g.useEffect(()=>{typeof sn.task.folders=="function"&&sn.task.folders({}).then(ne=>{const{data:pe,activeFolder:L}=ne,ke=L??pe?.[0]?.path;ke!==void 0&&p(ke)}).catch(()=>{})},[]),g.useEffect(()=>{document.documentElement.style.setProperty("--detail-w",`${m}px`)},[m]),g.useEffect(()=>{if(!d)return;const ne=pe=>{pe.key==="Escape"&&f(null)};return window.addEventListener("keydown",ne),()=>window.removeEventListener("keydown",ne)},[d]);const U=sr();g.useEffect(()=>{const ne=U.pathname.split("/"),pe=ne.indexOf("tasks"),L=pe>=0?ne[pe+1]:void 0;L&&/^\d{4}$/.test(L)&&f(L)},[U.pathname]);const k=my(_b,{activationConstraint:{distance:5}}),j=my(Ab),G=FG(k,j),$=lV(S,n),te=ne=>{u(pe=>{const L={...pe};return pe[ne]==="asc"?L[ne]="desc":pe[ne]==="desc"?delete L[ne]:L[ne]="asc",L})},H=ne=>{const pe=$.filter(ke=>ke.status===ne),L=o[ne]??"desc";return[...pe].sort((ke,Re)=>{const Q=ke.wbs.localeCompare(Re.wbs);return L==="asc"?Q:-Q})},se=ne=>S.find(pe=>pe.wbs===ne),de=ne=>{C(String(ne.active.id))},O=ne=>{C(null);const{active:pe,over:L}=ne;if(!L)return;const ke=String(pe.id),Re=String(L.id),Q=se(ke);if(!Q||Q.status===Re)return;const _e=[...S];T(fe=>fe.map(X=>X.wbs===ke?{...X,status:Re}:X)),sn.task.transition({wbs:ke,toStatus:Re}).catch(fe=>{T(_e);const X=fe instanceof Error?fe.message:"Transition failed";typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:X}}))})};return w?l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx(Ra,{size:"lg",className:"text-spur-accent"})}):A?l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsxs("div",{className:"text-center text-spur-text-muted",children:[l.jsx("p",{className:"text-lg font-semibold",children:"Failed to load tasks"}),l.jsx("p",{className:"text-sm",children:A.message})]})}):l.jsx(Wv.Provider,{value:v,children:l.jsxs(DW,{sensors:G,onDragStart:de,onDragEnd:O,children:[l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsx("div",{className:"flex gap-3 overflow-x-auto h-full p-4",children:iV.filter(ne=>!x.has(ne)).map(ne=>l.jsx(aV,{status:ne,label:ne,tasks:H(ne),onCardClick:pe=>{f(pe),t(pe)},sortDir:o[ne],onSortToggle:()=>te(ne)},ne))}),d&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button","aria-label":"Close task detail",className:"fixed inset-0 z-50 bg-black/40 border-0 p-0 cursor-default",onClick:()=>f(null)}),l.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Task detail",className:"fixed top-0 right-0 h-full z-50 bg-spur-surface border-l border-spur-border shadow-2xl flex",style:{width:"var(--detail-w)",minWidth:"36rem",maxWidth:"80vw"},children:[l.jsx(gl,{targetVar:"--detail-w",onResizeEnd:ne=>{const pe=Math.max(576,Math.min(ne,window.innerWidth*.8));b(pe);try{window.localStorage.setItem(Ny,String(pe))}catch{}},direction:"horizontal",invert:!0}),l.jsx("div",{className:"flex flex-col flex-1 overflow-hidden",children:l.jsx("div",{className:"flex-1 overflow-y-auto","data-testid":"detail-body",children:(()=>{const ne=S.find(pe=>pe.wbs===d);return ne?l.jsx(g.Suspense,{fallback:l.jsx("div",{className:"flex items-center justify-center h-32 text-spur-text-muted text-sm",children:"Loading detail..."}),children:l.jsx(sV,{task:ne,onClose:()=>f(null),onTransition:(pe,L)=>{T(ke=>ke.map(Re=>Re.wbs===pe?{...Re,status:L}:Re)),sn.task.transition({wbs:pe,toStatus:L}).catch(ke=>{const Re=ke instanceof Error?ke.message:"Transition failed";typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:Re}}))})}})}):null})()})})]})]})]}),l.jsx(QW,{dropAnimation:null,children:R?(()=>{const ne=se(R);return ne?l.jsx("div",{className:"opacity-90",children:l.jsx(Ow,{task:ne,onClick:()=>{}})}):null})():null})]})})}const Oc=[{id:"kanban",label:"Kanban",component:Fw}];function Mw(){const[e,t]=S_(),n=sr(),r=Ll(),a=g.useMemo(()=>{const u=n.pathname.split("/"),c=u.indexOf("tasks"),p=c>=0?u[c+1]:void 0;return p&&/^\d{4}$/.test(p)?p:e.get("selected")},[n.pathname,e]),s=g.useMemo(()=>{const u={},c=e.get("status"),p=e.get("feature"),d=e.get("parent"),f=e.get("assignee"),m=e.get("folder");return c!==null&&(u.status=c),p&&(u.featureId=p),d&&(u.parentWbs=d),f&&(u.assignee=f),m&&(u.folder=m),u},[e]);return{selected:a,filters:s,selectTask:u=>{const c=new URLSearchParams(e);c.delete("selected");const p=c.toString(),d=u?`/board/tasks/${u}`:"/board/tasks";r(`${d}${p?`?${p}`:""}`,{replace:!0})},setFilter:(u,c)=>{t(p=>{const d=new URLSearchParams(p);return u==="feature"&&d.delete("parent"),u==="parent"&&d.delete("feature"),c!==null?d.set(u,c):d.delete(u),d},{replace:!0})}}}function uV(e){const t=e.trim();return/^\d{4}$/.test(t)?{kind:"navigate",wbs:t}:t.includes(".")?{kind:"filter",key:"parent",value:t}:{kind:"filter",key:"feature",value:t}}function cV(){const{selectTask:e,setFilter:t,filters:n}=Mw(),[r,a]=g.useState(Lw),[s,i]=g.useState([]),[o,u]=g.useState("kanban"),[c,p]=g.useState(!1),[d,f]=g.useState(""),[m,b]=g.useState(!1),[E,x]=g.useState(void 0),y=n.folder??r,S=new Set(n.status===void 0?rr.filter(T=>T!=="blocked"&&T!=="cancelled"):n.status.split(",").filter(T=>rr.some(v=>v===T))),w=new Set(rr.filter(T=>!S.has(T)));g.useEffect(()=>{f(n.featureId??n.parentWbs??"")},[n.featureId,n.parentWbs]),g.useEffect(()=>{typeof sn.task.folders=="function"&&sn.task.folders({}).then(T=>{const{data:v,activeFolder:R}=T,C=R??v?.[0]?.path;v&&i(v),C!==void 0&&a(C)}).catch(()=>{})},[]);const A=T=>{const v=new Set(S);v.has(T)?v.delete(T):v.add(T),t("status",rr.filter(R=>v.has(R)).join(","))},D=T=>{T.preventDefault();const v=uV(d);if(v.kind==="navigate"){e(v.wbs),f("");return}t(v.key,v.value||null)},N=(Oc.find(T=>T.id===o)??Oc[0]).component;return l.jsxs("div",{className:"task-kanban flex flex-col h-full",children:[l.jsx("header",{className:"mx-auto w-full max-w-[1600px] shrink-0 px-4 pt-3",children:l.jsxs("div",{className:"flex flex-nowrap items-center justify-between gap-4 border-b border-base-content/10 pb-3",children:[l.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[l.jsx("span",{className:"text-2xl","aria-hidden":"true",children:"📋"}),l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl font-bold tracking-tight text-spur-text",children:"Tasks"}),l.jsx("p",{className:"text-xs text-spur-text-muted",children:"Task corpus, kanban lanes, and phase filters"}),l.jsxs("p",{className:"mt-1 inline-flex items-center gap-1.5 rounded-full border border-spur-border px-2 py-0.5 text-xs text-spur-text-muted font-mono",role:"status","data-testid":"tasks-live-chip",children:[l.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${m?"bg-spur-success":"bg-spur-error"}`,"aria-hidden":"true"}),"last sync ",E?new Date(E).toLocaleString():"—"]})]})]}),l.jsxs("div",{className:"flex min-w-0 flex-nowrap items-center gap-2 overflow-x-auto",children:[l.jsx(Xr,{variant:"ghost",size:"xs",className:"text-xs shrink-0 w-44",value:y,onChange:T=>t("folder",T.target.value),"aria-label":"Task phase folder",children:s.map(T=>l.jsx("option",{value:T.path,children:T.label?`${T.label} (${T.path})`:T.path},T.path))}),l.jsx("div",{className:"flex shrink-0 items-center gap-1",children:rr.map(T=>l.jsxs("label",{htmlFor:`tasks-status-${T}`,className:"flex items-center gap-1 cursor-pointer",children:[l.jsx(tb,{id:`tasks-status-${T}`,size:"xs",checked:!w.has(T),onChange:()=>A(T)}),l.jsxs("span",{className:"text-[10px] text-spur-text-muted",children:[fb(T)," ",T]})]},T))}),l.jsx("form",{onSubmit:D,className:"flex shrink-0 items-center",children:l.jsx(Ti,{"aria-label":"Filter by WBS or feature",type:"text",placeholder:"WBS or feature",variant:"bordered",size:"xs",className:"w-36",value:d,onChange:T=>f(T.target.value)})}),l.jsx(Ge,{variant:"primary",size:"sm",className:"shrink-0",onClick:()=>p(!0),children:"+ New Task"}),l.jsx("div",{className:"flex shrink-0 items-center gap-1 bg-base-300 p-1 rounded-xl",children:Oc.map(T=>l.jsx("button",{type:"button",className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-all ${o===T.id?"bg-primary text-primary-content font-bold shadow-sm":"text-base-content/70 hover:bg-base-content/10"}`,onClick:()=>u(T.id),children:T.label},T.id))})]})]})}),l.jsx("div",{"data-kanban-board":!0,className:"flex-1 overflow-hidden",children:l.jsx(N,{onSelectTask:e,filters:n,folder:y,hiddenColumns:w,onConnectionChange:b,onSyncChange:x})}),l.jsx(Hv,{open:c,onClose:()=>p(!1),onCreated:()=>{},folder:y})]})}function dV(e,t){sn.task.transition({wbs:e,toStatus:t}).catch(n=>{const r=n instanceof Error?n.message:"Transition failed";typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:r}}))})}function Pw(){const{filters:e,selectTask:t}=Mw();return l.jsx("div",{className:"task-kanban flex flex-col h-full",children:l.jsx("div",{"data-kanban-board":!0,className:"flex-1 overflow-hidden",children:l.jsx(Fw,{onSelectTask:t,filters:e})})})}const pV={id:"tasks",name:"Tasks",icon:"📋",route:"tasks",component:cV},fV=Object.freeze(Object.defineProperty({__proto__:null,TaskKanbanView:Pw,module:pV,transition:dV},Symbol.toStringTag,{value:"Module"}));function jw(e){const t=new Map;for(const n of e)for(const r of n.members)t.set(r.id,{teamId:n.teamId,memberLabel:r.id,agentType:r.type});return t}function Bw(e,t){if(e.teamId&&e.memberLabel&&e.agentType)return e;const n=e.memberLabel??e.actor;if(!n)return e;const r=t.get(n);return r?{...e,teamId:e.teamId??r.teamId,memberLabel:e.memberLabel??r.memberLabel,agentType:e.agentType??r.agentType}:e}const Rd=100;function Uw(e,t){const n=[t,...e??[]];return n.length>Rd&&(n.length=Rd),n}const $w=()=>`${Nt()}/events/history?limit=${Rd}`,zw=()=>`${Nt()}/events/planning`,mV=["agent.","message.","team.","supervisor.","process."];function hV(e){return mV.some(t=>e.startsWith(t))}function kb(e){if(e===null||typeof e!="object")return null;const t=e;if(typeof t.eventName!="string"||typeof t.occurredAt!="string"||!hV(t.eventName))return null;const n=t.payload!==null&&typeof t.payload=="object"?t.payload:null,r=n&&typeof n.teamId=="string"&&n.teamId.length>0?n.teamId:void 0,a=n&&typeof n.agentType=="string"&&n.agentType.length>0?n.agentType:void 0,s=n&&typeof n.memberLabel=="string"&&n.memberLabel.length>0?n.memberLabel:n&&typeof n.agentId=="string"&&n.agentId.length>0?n.agentId:void 0,i=typeof t.actor=="string"&&t.actor.length>0?t.actor:n&&typeof n.agentId=="string"&&n.agentId.length>0?n.agentId:null;return{id:typeof t.id=="string"?t.id:`${t.eventName}-${t.occurredAt}`,eventName:t.eventName,occurredAt:t.occurredAt,actor:i,...r?{teamId:r}:{},...s?{memberLabel:s}:{},...a?{agentType:a}:{}}}function Hw(e){if(e===null||typeof e!="object"||!("events"in e))return null;const t=e.events;if(!Array.isArray(t))return null;const n=[];for(const r of t){const a=kb(r);a&&n.push(a)}return n}function gV({teamId:e}){const[t,n]=g.useState(null),[r,a]=g.useState(null),{teams:s}=ws(),i=g.useMemo(()=>jw(s),[s]),o=g.useCallback(async()=>{try{const c=await Tt(new Request($w()));if(!c.ok)throw new Error(`events fetch failed: ${c.status}`);const p=Hw(await c.json());if(!p)throw new Error("events response failed schema validation");n(p)}catch(c){a(c instanceof Error?c.message:String(c))}},[]);g.useEffect(()=>{o()},[o]),g.useEffect(()=>{if(typeof EventSource>"u")return;const c=new EventSource(zw());return c.onmessage=p=>{try{const d=kb(JSON.parse(p.data));d&&n(f=>Uw(f,d))}catch{}},()=>c.close()},[]);const u=g.useMemo(()=>t===null?null:t.map(c=>Bw(c,i)).filter(c=>!e||c.teamId===e),[t,i,e]);return r?l.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load activity: ",r]}):u===null?l.jsx("div",{className:"p-4 text-sm text-spur-text-muted",children:"Loading activity…"}):l.jsx("div",{className:"flex flex-col h-full overflow-y-auto","data-activity-tab":!0,children:u.length===0?l.jsx("div",{className:"p-4 text-sm text-spur-text-muted italic",children:"No team activity yet."}):l.jsxs("table",{className:"w-full text-xs",children:[l.jsx("thead",{className:"sticky top-0 bg-base-200",children:l.jsxs("tr",{className:"text-left text-spur-text-muted",children:[l.jsx("th",{className:"px-3 py-1 font-medium",children:"Time"}),l.jsx("th",{className:"px-3 py-1 font-medium",children:"Event"}),l.jsx("th",{className:"px-3 py-1 font-medium",children:"Team"}),l.jsx("th",{className:"px-3 py-1 font-medium",children:"Member"}),l.jsx("th",{className:"px-3 py-1 font-medium",children:"Agent"}),l.jsx("th",{className:"px-3 py-1 font-medium",children:"Actor"})]})}),l.jsx("tbody",{children:u.map(c=>l.jsxs("tr",{className:"border-t border-spur-border","data-activity-row":c.eventName,children:[l.jsx("td",{className:"px-3 py-1 font-mono text-spur-text-muted",children:c.occurredAt}),l.jsx("td",{className:"px-3 py-1 text-spur-text",children:c.eventName}),l.jsx("td",{className:"px-3 py-1 font-mono text-spur-text-muted",children:c.teamId??"—"}),l.jsx("td",{className:"px-3 py-1 text-spur-text-muted",children:c.memberLabel??"—"}),l.jsx("td",{className:"px-3 py-1 text-spur-text-muted",children:c.agentType??"—"}),l.jsx("td",{className:"px-3 py-1 text-spur-text-muted",children:c.actor??"system"})]},c.id))})]})})}const bV=3e3,EV=()=>`${Nt()}/team/processes`;function xV(e,t){const n=e.map(s=>({key:`sup:${s.agentId}`,label:s.agentId,agentId:s.agentId,pid:s.pid,status:s.status,startedAt:s.startedAt,source:"supervisor",teamId:s.teamId??null})),r=new Set(e.map(s=>s.agentId)),a=new Set(e.map(s=>s.pid).filter(s=>s!=null));for(const s of t)s.agentId&&r.has(s.agentId)||s.pid!=null&&a.has(s.pid)||n.push({key:`reg:${s.id}`,label:s.label||s.command,agentId:s.agentId??void 0,pid:s.pid,status:s.status,startedAt:s.startedAt,source:s.source,teamId:s.teamId??null});return n}function yV(e,t){return e.filter(n=>{if(t.runningOnly&&n.status!=="running")return!1;if(t.source==="other"){if(n.source==="supervisor"||n.source==="one-shot")return!1}else if(t.source!=="all"&&n.source!==t.source)return!1;if(t.team==="unassigned"){if(n.teamId!=null)return!1}else if(t.team!=="all"&&n.teamId!==t.team)return!1;return!0})}function _y({filters:e,onFilters:t,teamIds:n,totalCount:r,shownCount:a}){return l.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-2 text-xs","data-processes-filters":!0,children:[l.jsxs("label",{className:"flex items-center gap-1","data-processes-filter-running":!0,children:[l.jsx("input",{type:"checkbox",checked:e.runningOnly,onChange:s=>t({...e,runningOnly:s.target.checked}),"data-processes-filter-running-input":!0}),l.jsx("span",{children:"Running only"})]}),l.jsxs("label",{className:"flex items-center gap-1",children:[l.jsx("span",{children:"Source"}),l.jsxs("select",{value:e.source,onChange:s=>t({...e,source:s.target.value}),className:"border border-spur-border rounded px-1 py-0.5 bg-spur-bg text-spur-text","data-processes-filter-source":!0,"aria-label":"Source filter",children:[l.jsx("option",{value:"all",children:"all"}),l.jsx("option",{value:"supervisor",children:"supervisor"}),l.jsx("option",{value:"one-shot",children:"one-shot"}),l.jsx("option",{value:"other",children:"other"})]})]}),l.jsxs("label",{className:"flex items-center gap-1",children:[l.jsx("span",{children:"Team"}),l.jsxs("select",{value:e.team,onChange:s=>t({...e,team:s.target.value}),className:"border border-spur-border rounded px-1 py-0.5 bg-spur-bg text-spur-text","data-processes-filter-team":!0,"aria-label":"Team filter",children:[l.jsx("option",{value:"all",children:"all teams"}),l.jsx("option",{value:"unassigned",children:"unassigned"}),n.map(s=>l.jsx("option",{value:s,children:s},s))]})]}),l.jsx("button",{type:"button",className:"border border-spur-border rounded px-2 py-0.5 text-spur-text hover:bg-base-200 transition-colors cursor-pointer",onClick:()=>t({runningOnly:!1,source:"all",team:"all"}),"data-processes-filter-clear":!0,children:"Clear"}),l.jsxs("span",{className:"text-spur-text-muted","data-processes-filter-count":!0,children:[a,"/",r," shown"]})]})}function TV({teamId:e}){const[t,n]=g.useState(null),[r,a]=g.useState(null),[s,i]=g.useState({runningOnly:!1,source:"all",team:"all"}),o=g.useRef(!0),u=g.useCallback(async b=>{try{const E=await Tt(new Request(EV(),{signal:b}));if(!E.ok)throw new Error(`processes fetch failed: ${E.status}`);const y=await E.json();o.current&&(n({processes:y.processes??[],count:y.count??0,executions:y.executions??[],executionsCount:y.executionsCount??0}),a(null))}catch(E){if(b.aborted)return;o.current&&a(E instanceof Error?E.message:String(E))}},[]);g.useEffect(()=>{o.current=!0;let b=null;const E=()=>{b?.abort(),b=new AbortController,u(b.signal)};E();const x=setInterval(E,bV);return()=>{o.current=!1,b?.abort(),clearInterval(x)}},[u]);const c=g.useMemo(()=>t?xV(t.processes,t.executions):[],[t]),p=g.useMemo(()=>{const b=e?c.filter(E=>E.teamId===e):c;return yV(b,s)},[c,s,e]),d=g.useMemo(()=>{const b=new Set;for(const E of t?.processes??[])E.teamId&&b.add(E.teamId);for(const E of t?.executions??[])E.teamId&&b.add(E.teamId);return[...b].sort()},[t]);if(r&&(!t||c.length===0))return l.jsxs("div",{className:"p-4 text-sm text-error",role:"alert","data-processes-tab-error":!0,children:["Failed to load processes: ",r]});if(!t)return l.jsx("div",{className:"p-4","data-processes-tab-loading":!0,children:l.jsx(Ra,{size:"sm"})});if(c.length===0)return l.jsxs("div",{className:"p-4 text-sm text-spur-text-muted","data-processes-tab-empty":!0,children:["No processes. Start a team agent from the Terminal tab or via"," ",l.jsx("code",{className:"font-mono",children:"spur team start"}),"."]});if(p.length===0)return l.jsxs("div",{className:"p-3 overflow-auto h-full","data-processes-tab":!0,"data-processes-tab-filtered-empty":!0,children:[l.jsx(_y,{filters:s,onFilters:i,teamIds:d,totalCount:c.length,shownCount:0}),l.jsx("div",{className:"p-4 text-sm text-spur-text-muted","data-processes-tab-no-matches":!0,children:"No processes match the current filters. Adjust or clear filters to see rows."})]});const f=t.processes.length,m=Math.max(0,c.length-f);return l.jsxs("div",{className:"p-3 overflow-auto h-full","data-processes-tab":!0,children:[l.jsx(_y,{filters:s,onFilters:i,teamIds:d,totalCount:c.length,shownCount:p.length}),l.jsxs("div",{className:"flex items-center gap-2 mb-2 text-xs text-spur-text-muted",children:[l.jsxs("span",{"data-processes-header":!0,children:["Process watch list (",c.length,f>0||m>0?` · ${f} supervised${m>0?` · ${m} other`:""}`:"",")"]}),l.jsx("span",{className:"italic",children:"— ProcessExecutor registry (ts-runtime)"})]}),l.jsxs("table",{className:"table table-xs",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Name"}),l.jsx("th",{children:"Source"}),l.jsx("th",{children:"Team"}),l.jsx("th",{children:"PID"}),l.jsx("th",{children:"Status"}),l.jsx("th",{children:"Started"})]})}),l.jsx("tbody",{children:p.map(b=>{const E=b.status==="running";return l.jsxs("tr",{"data-processes-row":b.key,children:[l.jsx("td",{className:"font-mono text-xs",children:b.label}),l.jsx("td",{className:"text-xs text-spur-text-muted","data-process-source":b.source,children:b.source}),l.jsx("td",{className:"font-mono text-xs text-spur-text-muted","data-process-team":b.teamId??"",children:b.teamId??"—"}),l.jsx("td",{className:"font-mono text-xs text-spur-text-muted",children:b.pid??"—"}),l.jsx("td",{children:l.jsx(Ot,{variant:E?"success":"ghost",size:"xs",children:b.status})}),l.jsx("td",{className:"text-xs text-spur-text-muted",children:new Date(b.startedAt).toLocaleTimeString()})]},b.key)})})]})]})}const SV=e=>`${Nt()}/team/agents/${encodeURIComponent(e)}/start`,vV=e=>`${Nt()}/team/agents/${encodeURIComponent(e)}/stop`,wV=e=>`${Nt()}/team/${encodeURIComponent(e)}/up`,AV=e=>`${Nt()}/team/${encodeURIComponent(e)}/down`;function NV(e){if(e<0)return"-";const t=Math.floor(e/1e3),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),a=Math.floor(t%3600/60),s=t%60;return n>0?`${n}d ${r}h ${a}m`:r>0?`${r}h ${a}m`:a>0?`${a}m ${s}s`:`${s}s`}function Cy(e){try{return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}}function _V(e){const t=new Map;for(const n of e){if(!n.teamId||!n.memberLabel)continue;const r=`${n.teamId}:${n.memberLabel}`;let a=t.get(r);a||(a={startedAt:null,lastActivity:null},t.set(r,a)),n.eventName==="team.member.started"&&(!a.startedAt||n.occurredAt>a.startedAt)&&(a.startedAt=n.occurredAt),(!a.lastActivity||n.occurredAt>a.lastActivity.time)&&(a.lastActivity={time:n.occurredAt,eventName:n.eventName})}return t}function CV({teamId:e}){const{teams:t,error:n,reload:r}=ws(),[a,s]=g.useState(null),[i,o]=g.useState(null),[u,c]=g.useState(!1),[p,d]=g.useState(null),[f,m]=g.useState(null),[b,E]=g.useState(null),[x,y]=g.useState(()=>Date.now()),S=g.useMemo(()=>e?t.filter(v=>v.teamId===e):t,[t,e]),w=g.useMemo(()=>jw(S),[S]);g.useEffect(()=>{let v=!1;return(async()=>{try{const R=await Tt(new Request($w()));if(v)return;if(!R.ok)throw new Error(`events fetch failed: ${R.status}`);const C=Hw(await R.json());if(v)return;if(!C)throw new Error("events response failed schema validation");s(C)}catch(R){if(v)return;o(R instanceof Error?R.message:String(R))}})(),()=>{v=!0}},[]),g.useEffect(()=>{if(typeof EventSource>"u")return;const v=new EventSource(zw());return v.onmessage=R=>{try{const C=kb(JSON.parse(R.data));C&&s(U=>Uw(U,C))}catch{}},()=>v.close()},[]),g.useEffect(()=>{const v=setInterval(()=>y(Date.now()),1e3);return()=>clearInterval(v)},[]);const A=g.useMemo(()=>a===null?null:a.map(v=>Bw(v,w)).filter(v=>!e||v.teamId===e),[a,w,e]),D=g.useMemo(()=>A===null?new Map:_V(A),[A]),N=g.useCallback(async(v,R)=>{c(!0),d(null);try{const C=R?vV(v):SV(v),U=await Tt(new Request(C,{method:"POST"}));if(!U.ok){const k=await U.json().catch(()=>null),j=k&&typeof k=="object"&&"error"in k&&typeof k.error=="string"?k.error:`request failed (${U.status})`;d(j)}}catch(C){d(C instanceof Error?C.message:String(C))}finally{c(!1),r()}},[r]),T=g.useCallback(async(v,R)=>{c(!0),d(null);try{const C=R==="up"?wV(v):AV(v),U=await Tt(new Request(C,{method:"POST"}));if(!U.ok){const k=await U.json().catch(()=>null),j=k&&typeof k=="object"&&"error"in k&&typeof k.error=="string"?k.error:`request failed (${U.status})`;d(j)}}catch(C){d(C instanceof Error?C.message:String(C))}finally{c(!1),r()}},[r]);return l.jsxs("div",{className:"flex flex-col h-full overflow-y-auto","data-supervisor-tab":!0,children:[n&&S.length===0?l.jsxs("div",{className:"p-4 text-sm text-error",role:"alert","data-supervisor-tab-error":!0,children:["Failed to load teams: ",n,". Event-derived activity remains available below."]}):n&&l.jsxs("div",{className:"px-3 py-1 text-xs text-error bg-error/10 border-b border-error/30",role:"alert","data-supervisor-roster-error":!0,children:["Roster feed error: ",n,". Showing last-known state."]}),S.length===0&&!n&&l.jsx("div",{className:"p-4 text-sm text-spur-text-muted","data-supervisor-tab-loading":!0,children:"Loading teams…"}),p&&l.jsx("div",{className:"px-3 py-1 text-xs text-error",role:"alert","data-supervisor-action-error":!0,children:p}),i&&l.jsxs("div",{className:"px-3 py-1 text-xs text-warning",role:"alert","data-supervisor-event-error":!0,children:["Activity feed error: ",i,". Live updates may be delayed."]}),l.jsx("div",{className:"p-2 space-y-2",children:S.map(v=>l.jsx(Ki,{variant:"compact",className:"bg-base-200 border border-spur-border",children:l.jsxs(Xi,{className:"p-3 gap-2",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx("span",{className:"text-sm font-semibold text-spur-text",children:v.name}),l.jsx(Ot,{variant:"outline",size:"xs",children:v.teamId}),l.jsxs("span",{className:"text-[10px] text-spur-text-muted",children:[v.members.length," member(s)"]}),l.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[l.jsx(Ge,{type:"button",variant:"ghost",size:"xs",disabled:u,onClick:()=>{T(v.teamId,"up")},"data-supervisor-team-up":v.teamId,children:"Up"}),l.jsx(Ge,{type:"button",variant:"ghost",size:"xs",disabled:u,onClick:()=>E(v.teamId),"data-supervisor-team-down":v.teamId,children:"Down"})]})]}),v.members.length===0?l.jsx("div",{className:"text-xs text-spur-text-muted italic py-2","data-supervisor-empty-roster":v.teamId,children:"No members configured for this team."}):l.jsx("ul",{className:"space-y-1",children:v.members.map(R=>{const C=R.status==="running",U=`${v.teamId}:${R.id}`,k=D.get(U),j=C&&k?.startedAt?NV(x-Date.parse(k.startedAt)):"-",G=k?.lastActivity??null;return l.jsxs("li",{className:"text-xs flex items-center gap-2 flex-wrap py-1 border-b border-spur-border/50 last:border-b-0","data-supervisor-member-row":R.id,children:[l.jsx(Ot,{variant:C?"success":"ghost",size:"xs",children:R.status}),l.jsx("span",{className:"font-mono text-spur-text",children:R.id}),l.jsx(Ot,{variant:"outline",size:"xs",children:R.type}),l.jsx(Ot,{variant:R.role!==void 0?"accent":"ghost",size:"xs","data-supervisor-member-role":R.id,children:R.role??"unset"}),l.jsxs("span",{className:"text-[10px] text-spur-text-muted font-mono","data-supervisor-uptime":R.id,children:["up ",j]}),G?l.jsxs("span",{className:"text-[10px] text-spur-text-muted","data-supervisor-last-activity":R.id,children:["last: ",Cy(G.time)," (",G.eventName,")"]}):l.jsx("span",{className:"text-[10px] text-spur-text-muted","data-supervisor-last-activity":R.id,children:"last: -"}),l.jsx(Ge,{type:"button",variant:C?"ghost":"primary",size:"xs",disabled:u,className:"ml-auto",onClick:()=>{C?m(R.id):N(R.id,!1)},"data-supervisor-toggle":R.id,children:C?"Stop":"Start"})]},R.id)})})]})},v.teamId))}),A!==null&&l.jsxs("section",{className:"border-t border-spur-border bg-base-300/40","aria-label":"Recent team activity","data-supervisor-activity":!0,children:[l.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wide font-semibold text-spur-text-muted",children:"Recent team activity"}),A.length===0?l.jsx("div",{className:"px-3 pb-3 text-xs text-spur-text-muted italic",children:"No team activity yet."}):l.jsx("ul",{className:"px-3 pb-3 space-y-1",children:A.slice(0,20).map(v=>l.jsxs("li",{className:"flex items-center gap-2 flex-wrap text-[10px] text-spur-text-muted","data-supervisor-activity-row":v.eventName,children:[l.jsx("span",{className:"font-mono",children:Cy(v.occurredAt)}),l.jsx(Ot,{variant:"outline",size:"xs",children:v.eventName}),v.teamId&&l.jsx("span",{children:v.teamId}),v.memberLabel&&l.jsx("span",{className:"font-mono",children:v.memberLabel}),v.actor&&l.jsx("span",{children:v.actor})]},v.id))})]}),l.jsxs(ll,{open:f!==null,variant:"warning",onClose:()=>m(null),"data-stop-confirm-modal":!0,children:[l.jsx("h3",{className:"text-lg font-bold text-warning",children:"Stop member?"}),l.jsxs("p",{className:"py-3 text-sm text-spur-text",children:["Stopping ",l.jsx("span",{className:"font-mono",children:f})," will terminate its running process. Input to this member will be disabled until it is restarted."]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(Ge,{type:"button",variant:"ghost",size:"sm",onClick:()=>m(null),"data-stop-confirm-cancel":!0,children:"Cancel"}),l.jsx(Ge,{type:"button",variant:"warning",size:"sm",disabled:u,onClick:()=>{if(!f)return;const v=f;m(null),N(v,!0)},"data-stop-confirm-confirm":!0,children:"Stop"})]})]}),l.jsxs(ll,{open:b!==null,variant:"warning",onClose:()=>E(null),"data-down-confirm-modal":!0,children:[l.jsx("h3",{className:"text-lg font-bold text-warning",children:"Bring team down?"}),l.jsxs("p",{className:"py-3 text-sm text-spur-text",children:["This will stop all running members of ",l.jsx("span",{className:"font-mono",children:b}),"."]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(Ge,{type:"button",variant:"ghost",size:"sm",onClick:()=>E(null),"data-down-confirm-cancel":!0,children:"Cancel"}),l.jsx(Ge,{type:"button",variant:"warning",size:"sm",disabled:u,onClick:()=>{if(!b)return;const v=b;E(null),T(v,"down")},"data-down-confirm-confirm":!0,children:"Bring Down"})]})]})]})}const Ro=1e3,Lc=[1e3,2e3,4e3,8e3,15e3],kV=15e3;function IV(e){if(e===null||typeof e!="object")return null;const t=e;if(typeof t.stream!="string"||typeof t.ts!="string"||typeof t.line!="string")return null;const n=t.stream;if(n!=="stdout"&&n!=="stderr"&&n!=="meta")return null;const r=t.seq;return r!==void 0&&typeof r!="number"?null:{stream:n,ts:t.ts,line:t.line,...r!==void 0?{seq:r}:{}}}function RV(e){return e<0?Lc[0]:e>=Lc.length?kV:Lc[e]}function ky(e,t,n){if(t.seq===void 0){const a=[...e,t];return a.length>Ro&&a.splice(0,a.length-Ro),{frames:a,lastSeq:n}}if(t.seq<=n)return{frames:e,lastSeq:n};const r=[...e,t];return r.length>Ro&&r.splice(0,r.length-Ro),{frames:r,lastSeq:t.seq}}const DV=(e,t)=>t!==void 0?`${Nt()}/team/processes/${encodeURIComponent(e)}/stream?sinceSeq=${t}`:`${Nt()}/team/processes/${encodeURIComponent(e)}/stream`,OV=3e3;function LV(e){if(e===null||typeof e!="object")return null;const t=e;if(!Array.isArray(t.processes))return null;const n=[];for(const r of t.processes){if(r===null||typeof r!="object")return null;const a=r;if(typeof a.agentId!="string"||typeof a.status!="string"||typeof a.startedAt!="string"||typeof a.pid!="number")return null;const s=a.exitCode;if(s!==null&&typeof s!="number")return null;n.push({agentId:a.agentId,pid:a.pid,status:a.status,startedAt:a.startedAt,exitCode:s})}return n}const FV=e=>`${Nt()}/team/processes/${encodeURIComponent(e)}/stdin`,MV=()=>`${Nt()}/messages`,PV=()=>`${Nt()}/team/processes`;function jV({agentId:e}){const[t,n]=g.useState([]),[r,a]=g.useState("unknown"),[s,i]=g.useState(""),[o,u]=g.useState(null),[c,p]=g.useState(!1),d=g.useRef(-1),f=g.useRef(null),m=g.useRef(void 0),b=g.useRef(0),E=g.useRef(!0),x=g.useRef(null),y=g.useCallback(async N=>{try{const T=await Tt(new Request(PV(),{signal:N}));if(!T.ok)return;const v=await T.json(),R=LV(v);if(!R)return;const C=R.find(U=>U.agentId===e);C&&E.current&&a(C.status)}catch{}},[e]);g.useEffect(()=>{E.current=!0;let N=null;const T=()=>{N?.abort(),N=new AbortController,y(N.signal)};T();const v=setInterval(T,OV);return()=>{E.current=!1,N?.abort(),clearInterval(v)}},[y]);const S=g.useCallback(()=>{if(!E.current)return;const N=new EventSource(DV(e,d.current>-1?d.current:void 0));f.current=N,N.onmessage=T=>{try{const v=JSON.parse(T.data),R=IV(v);if(!R)return;n(C=>{const U=ky(C,R,d.current);return d.current=U.lastSeq,U.frames}),b.current=0,p(!0)}catch{}},N.onerror=()=>{if(N.close(),f.current=null,p(!1),!E.current)return;const T=RV(b.current);b.current+=1,m.current=setTimeout(S,T)}},[e]);g.useEffect(()=>(S(),()=>{E.current=!1,f.current?.close(),f.current=null,m.current&&clearTimeout(m.current)}),[S]),g.useEffect(()=>{x.current&&t.length>0&&(x.current.scrollTop=x.current.scrollHeight)},[t]);const w=g.useCallback(async()=>{const N=s;if(N.length===0)return;u(null);const T={stream:"meta",ts:new Date().toISOString(),line:`> ${N}`};n(v=>ky(v,T,d.current).frames);try{const v=await Tt(new Request(FV(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({line:N})}));if(Tt(new Request(MV(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:"terminal",to:e,body:N})})).catch(()=>{}),!v.ok){const C=(await v.json().catch(()=>null))?.error??`stdin POST failed: ${v.status}`;u(C);return}i("")}catch(v){u(v instanceof Error?v.message:String(v))}},[e,s]),A=r==="running",D=N=>{N.key==="Enter"&&A&&(N.preventDefault(),w())};return l.jsxs("div",{className:"flex flex-col h-full overflow-hidden","data-member-terminal":e,children:[l.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-base-200 shrink-0 flex items-center gap-2",children:[l.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"Terminal"}),l.jsx("span",{className:"font-mono text-xs text-spur-text-muted",children:e}),l.jsx(Ot,{variant:A?"success":"ghost",size:"xs","data-terminal-status":!0,children:r}),l.jsx("span",{className:"text-[10px] text-spur-text-muted","data-terminal-connected":!0,children:c?"connected":"reconnecting…"})]}),!A&&l.jsxs("div",{className:"px-4 py-1 text-xs text-warning border-b border-spur-border",role:"status","data-status-banner":!0,children:["Member is ",r," — input disabled."]}),l.jsx("pre",{ref:x,className:"flex-1 overflow-y-auto p-2 text-xs font-mono leading-snug bg-base-100","data-terminal-output":!0,children:t.length===0?l.jsxs("span",{className:"text-spur-text-muted italic",children:["Waiting for output from ",e,"…"]}):t.map((N,T)=>l.jsx("div",{className:N.stream==="stderr"?"text-error":N.stream==="meta"?"text-spur-text-muted italic":"text-spur-text","data-stream":N.stream,children:N.line},N.seq??`meta-${T}`))}),o&&l.jsx("div",{className:"px-4 py-1 text-xs text-error border-t border-spur-border",role:"alert","data-input-error":!0,children:o}),l.jsx("div",{className:"flex items-center gap-2 px-2 py-2 border-t border-spur-border bg-base-200 shrink-0",children:l.jsx("input",{type:"text",value:s,onChange:N=>i(N.target.value),onKeyDown:D,disabled:!A,placeholder:A?"Type a line and press Enter…":"Input disabled (member not running)",className:"flex-1 input input-sm font-mono","data-terminal-input":!0})})]})}const BV=e=>`${Nt()}/team/agents/${encodeURIComponent(e)}/start`,UV=e=>`${Nt()}/team/agents/${encodeURIComponent(e)}/stop`,$V=e=>`${Nt()}/team/${encodeURIComponent(e)}/up`,zV=e=>`${Nt()}/team/${encodeURIComponent(e)}/down`,Ib="spur:board:teams:lastTerminal";function HV(){try{const e=globalThis.localStorage?.getItem(Ib);if(!e)return null;const t=JSON.parse(e);if(t&&typeof t=="object"&&"teamId"in t&&"memberId"in t&&typeof t.teamId=="string"&&typeof t.memberId=="string"){const n=t;return{teamId:n.teamId,memberId:n.memberId}}}catch{}return null}function GV(e){try{globalThis.localStorage?.setItem(Ib,JSON.stringify(e))}catch{}}function WV(){try{globalThis.localStorage?.removeItem(Ib)}catch{}}function VV({teamId:e}){const{teams:t,error:n,reload:r}=ws(),[a,s]=g.useState(""),[i,o]=g.useState(""),[u,c]=g.useState(null),[p,d]=g.useState(null),[f,m]=g.useState(null),[b,E]=g.useState(!1),[x]=g.useState({done:!1}),y=g.useMemo(()=>e?t.filter(R=>R.teamId===e):t,[t,e]),S=e??a;g.useEffect(()=>{if(x.done||y.length===0)return;x.done=!0;const R=HV();if(!R)return;const C=y.find(k=>k.teamId===R.teamId),U=C?.members.find(k=>k.id===R.memberId);if(!C||!U){WV();return}s(R.teamId),o(R.memberId)},[y,x]);const w=y.find(R=>R.teamId===S),A=w?.members.find(R=>R.id===i)??null;g.useEffect(()=>{i&&w&&!w.members.some(R=>R.id===i)&&o("")},[i,w]),g.useEffect(()=>{S&&i&&GV({teamId:S,memberId:i})},[S,i]);const D=g.useCallback(async(R,C)=>{E(!0);try{const U=C?UV(R):BV(R),k=await Tt(new Request(U,{method:"POST"}));if(!k.ok){const j=await k.json().catch(()=>null),G=j&&typeof j=="object"&&"error"in j&&typeof j.error=="string"?j.error:`request failed (${k.status})`;c(G)}}catch(U){c(U instanceof Error?U.message:String(U))}finally{E(!1),r()}},[r]),N=g.useCallback(async(R,C)=>{E(!0),c(null);try{const U=C==="up"?$V(R):zV(R),k=await Tt(new Request(U,{method:"POST"}));if(!k.ok){const j=await k.json().catch(()=>null),G=j&&typeof j=="object"&&"error"in j&&typeof j.error=="string"?j.error:`request failed (${k.status})`;c(G)}}catch(U){c(U instanceof Error?U.message:String(U))}finally{E(!1),r()}},[r]),T=g.useCallback(R=>{o(R)},[]);if(n&&y.length===0)return l.jsxs("div",{className:"p-4 text-sm text-error",role:"alert","data-terminal-tab-error":!0,children:["Failed to load teams: ",n]});if(y.length===0)return l.jsxs("div",{className:"p-4 text-sm text-spur-text-muted","data-terminal-tab-empty":!0,children:["No teams defined in ",l.jsx("code",{className:"font-mono",children:".spur/config.yaml"}),". Configure"," ",l.jsx("code",{className:"font-mono",children:"agent.team"})," entries to open a terminal."]});const v=A?.status==="running";return l.jsxs("div",{className:"flex flex-col h-full overflow-hidden","data-terminal-tab":!0,children:[l.jsxs("div",{className:"px-3 py-2 border-b border-spur-border bg-base-200 shrink-0 flex items-center justify-between","data-terminal-toolbar":!0,children:[l.jsxs("div",{className:"flex items-center gap-2","data-terminal-focus":!0,children:[l.jsxs("label",{className:"flex items-center gap-1 text-xs",htmlFor:"terminal-team-select",children:[l.jsx("span",{className:"text-spur-text-muted",children:"Team"}),l.jsxs(Xr,{id:"terminal-team-select",variant:"bordered",size:"sm",disabled:!!e,value:S,onChange:R=>{s(R.target.value),o("")},"data-terminal-team-select":!0,children:[!e&&l.jsx("option",{value:"",children:"Select team…"}),y.map(R=>l.jsx("option",{value:R.teamId,children:R.name},R.teamId))]})]}),l.jsxs("label",{className:"flex items-center gap-1 text-xs",htmlFor:"terminal-member-select",children:[l.jsx("span",{className:"text-spur-text-muted",children:"Member"}),l.jsxs(Xr,{id:"terminal-member-select",variant:"bordered",size:"sm",value:i,onChange:R=>o(R.target.value),disabled:!w,"data-terminal-member-select":!0,children:[l.jsx("option",{value:"",children:"Select member…"}),w?.members.map(R=>l.jsxs("option",{value:R.id,children:[R.id," · ",R.type]},R.id))]})]}),A?.model?l.jsx("span",{className:"text-xs text-spur-text-muted font-mono","data-terminal-model":!0,children:A.model}):null,A&&l.jsxs(l.Fragment,{children:[l.jsx(Ot,{variant:v?"success":"ghost",size:"xs","data-terminal-status-badge":!0,children:A.status}),l.jsx(Ge,{type:"button",variant:v?"warning":"primary",size:"xs",disabled:b,onClick:()=>{v?d(A.id):D(A.id,!1)},"data-terminal-toggle-btn":!0,children:v?"Stop":"Start"})]})]}),l.jsxs("div",{className:"flex items-center gap-2","data-terminal-roster":!0,children:[w?.members.map(R=>l.jsx("button",{type:"button",title:`${R.id} · ${R.type}`,onClick:()=>T(R.id),className:"cursor-pointer p-0 bg-transparent border-0","data-terminal-roster-chip":!0,children:l.jsx(Ot,{variant:R.id===i?"accent":R.status==="running"?"success":"ghost",size:"xs",children:R.id})},R.id)),l.jsx("div",{className:"border-l border-spur-border mx-1 h-5","aria-hidden":"true"}),l.jsx(Ge,{type:"button",variant:"ghost",size:"xs",disabled:b||!w,onClick:()=>w&&N(w.teamId,"up"),"data-terminal-up-btn":!0,children:"Up"}),l.jsx(Ge,{type:"button",variant:"ghost",size:"xs",disabled:b||!w,onClick:()=>w&&m(w.teamId),"data-terminal-down-btn":!0,children:"Down"})]})]}),u&&l.jsx("div",{className:"px-3 py-1 text-xs text-error",role:"alert","data-terminal-tab-action-error":!0,children:u}),i&&A?l.jsx(jV,{agentId:i}):l.jsx("div",{className:"p-4 text-sm text-spur-text-muted italic","data-terminal-tab-prompt":!0,children:"Choose a team and member above to open a terminal."}),l.jsxs(ll,{open:p!==null,variant:"warning",onClose:()=>d(null),"data-stop-confirm-modal":!0,children:[l.jsx("h3",{className:"text-lg font-bold text-warning",children:"Stop member?"}),l.jsxs("p",{className:"py-3 text-sm text-spur-text",children:["Stopping ",l.jsx("span",{className:"font-mono",children:p})," will terminate its running process. Input to this member will be disabled until it is restarted."]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(Ge,{type:"button",variant:"ghost",size:"sm",onClick:()=>d(null),"data-stop-confirm-cancel":!0,children:"Cancel"}),l.jsx(Ge,{type:"button",variant:"warning",size:"sm",disabled:b,onClick:()=>{if(!p)return;const R=p;d(null),D(R,!0)},"data-stop-confirm-confirm":!0,children:"Stop"})]})]}),l.jsxs(ll,{open:f!==null,variant:"warning",onClose:()=>m(null),"data-down-confirm-modal":!0,children:[l.jsx("h3",{className:"text-lg font-bold text-warning",children:"Bring team down?"}),l.jsxs("p",{className:"py-3 text-sm text-spur-text",children:["This will stop all running members of ",l.jsx("span",{className:"font-mono",children:f}),"."]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(Ge,{type:"button",variant:"ghost",size:"sm",onClick:()=>m(null),"data-down-confirm-cancel":!0,children:"Cancel"}),l.jsx(Ge,{type:"button",variant:"warning",size:"sm",disabled:b,onClick:()=>{if(!f)return;const R=f;m(null),N(R,"down")},"data-down-confirm-confirm":!0,children:"Bring Down"})]})]})]})}const Iy=[{id:"supervisor",label:"Supervisor",component:CV},{id:"terminal",label:"Terminal",component:VV},{id:"processes",label:"Process",component:TV},{id:"activity",label:"Activity",component:gV}];function Gw({teamId:e}){const[t,n]=g.useState("supervisor"),a=Iy.find(s=>s.id===t)?.component;return l.jsxs("div",{className:"flex flex-col h-full overflow-hidden","data-teams-shell":!0,children:[l.jsx("div",{role:"tablist","aria-label":"Teams tabs",className:"flex items-center gap-1 px-2 py-1 border-b border-spur-border bg-base-200 shrink-0",children:Iy.map(s=>{const i=s.id===t;return l.jsx("button",{type:"button",role:"tab","aria-selected":i,"aria-controls":`teams-tab-panel-${s.id}`,id:`teams-tab-${s.id}`,onClick:()=>n(s.id),className:`px-3 py-1 rounded text-xs font-medium transition-colors ${i?"bg-spur-accent text-white":"text-spur-text-muted hover:text-spur-text hover:bg-base-300"}`,children:s.label},s.id)})}),l.jsx("div",{role:"tabpanel",id:`teams-tab-panel-${t}`,"aria-labelledby":`teams-tab-${t}`,className:"flex-1 overflow-hidden",children:a?l.jsx(a,{teamId:e}):null})]})}const qV={id:"teams",name:"Teams",icon:"👥",route:"teams",component:Gw,sidebarLabel:"Teams",order:2},YV=Object.freeze(Object.defineProperty({__proto__:null,module:qV},Symbol.toStringTag,{value:"Module"}));function ZV(e){try{return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}}function KV({teamId:e}){const{teams:t}=ws(),n=e?t.find(r=>r.teamId===e):t.find(r=>r.isCurrentProject);return n?l.jsxs("div",{className:"flex flex-col h-full overflow-y-auto bg-spur-bg","data-workspace-overview":!0,children:[l.jsxs("div",{className:"px-4 py-3 border-b border-spur-border bg-spur-surface",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx("span",{className:"text-sm font-semibold text-spur-text","data-workspace-overview-name":!0,children:n.name}),l.jsx(Ot,{variant:"outline",size:"xs",children:n.teamId}),l.jsx(Ot,{variant:n.isCurrentProject?"success":"ghost",size:"xs",children:"current project"})]}),n.workDir&&l.jsx("div",{className:"mt-1 font-mono text-xs text-spur-text-muted","data-workspace-overview-workdir":!0,children:n.workDir})]}),l.jsxs("div",{className:"p-3",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-wide font-semibold text-spur-text-muted mb-2",children:"Members"}),n.members.length===0?l.jsx("div",{className:"text-xs text-spur-text-muted italic","data-workspace-overview-no-members":!0,children:"No members materialized for this team yet."}):l.jsx("ul",{className:"space-y-1",children:n.members.map(r=>l.jsxs("li",{className:"text-xs flex items-center gap-2 py-1 border-b border-spur-border/50 last:border-b-0","data-workspace-overview-member":r.id,children:[l.jsx(Ot,{variant:r.status==="running"?"success":"ghost",size:"xs",children:r.status}),l.jsx("span",{className:"font-mono text-spur-text",children:r.id}),l.jsx(Ot,{variant:"outline",size:"xs",children:r.type}),r.model&&l.jsx("span",{className:"font-mono text-[10px] text-spur-text-muted",children:r.model})]},r.id))}),l.jsxs("div",{className:"mt-3 text-[10px] text-spur-text-faint",children:["Last refresh: ",ZV(new Date().toISOString())]})]})]}):l.jsx("div",{className:"p-4 text-sm text-spur-text-muted","data-workspace-overview-empty":!0,children:"No team selected for this workspace."})}const Ry=[{id:"overview",label:"Overview",component:KV},{id:"team",label:"Team",component:Gw},{id:"inbox",label:"Inbox",component:lw},{id:"tasks",label:"Tasks",component:Pw}];function XV(){const{teams:e}=ws(),t=g.useMemo(()=>e.filter(c=>c.isCurrentProject),[e]),[n,r]=g.useState(""),[a,s]=g.useState("overview");g.useEffect(()=>{!n&&t.length>0&&r(t[0]?.teamId??"")},[t,n]);const i=t.find(c=>c.teamId===n)??null,u=Ry.find(c=>c.id===a)?.component;return t.length===0?l.jsxs("div",{className:"workspace flex flex-col h-full items-center justify-center gap-3 p-6 bg-spur-bg","data-workspace-empty":!0,children:[l.jsx("div",{className:"text-sm font-semibold text-spur-text",children:"No project-local team"}),l.jsxs("p",{className:"text-xs text-spur-text-muted max-w-sm text-center",children:["No configured team resolves to this project's working directory. Add an"," ",l.jsx("code",{className:"font-mono",children:"agent.team"})," entry in"," ",l.jsx("code",{className:"font-mono",children:".spur/config.yaml"})," whose"," ",l.jsx("code",{className:"font-mono",children:"work_dir"})," points at the current project to compose a Workspace."]})]}):l.jsxs("div",{className:"workspace flex flex-col h-full overflow-hidden bg-spur-bg","data-workspace-shell":!0,children:[l.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-spur-surface shrink-0 flex items-center gap-2",children:[l.jsx("span",{className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide",children:"Workspace"}),l.jsx("select",{value:i?.teamId??"",onChange:c=>{r(c.target.value),s("overview")},"aria-label":"Workspace team","data-workspace-team-select":!0,className:"border border-spur-border rounded px-1 py-0.5 bg-spur-bg text-spur-text text-xs",children:t.map(c=>l.jsx("option",{value:c.teamId,children:c.name},c.teamId))})]}),l.jsx("div",{role:"tablist","aria-label":"Workspace tabs",className:"flex items-center gap-1 px-2 py-1 border-b border-spur-border bg-spur-surface shrink-0",children:Ry.map(c=>{const p=c.id===a;return l.jsx("button",{type:"button",role:"tab","aria-selected":p,"aria-controls":`workspace-tab-panel-${c.id}`,id:`workspace-tab-${c.id}`,onClick:()=>s(c.id),className:`px-3 py-1 rounded-lg text-xs font-medium transition-colors ${p?"bg-spur-accent text-white":"text-spur-text-muted hover:text-spur-text hover:bg-spur-surface-3"}`,"data-workspace-tab":!0,children:c.label},c.id)})}),l.jsx("div",{role:"tabpanel",id:`workspace-tab-panel-${a}`,"aria-labelledby":`workspace-tab-${a}`,className:"flex-1 overflow-hidden",children:u?l.jsx(u,{teamId:i?.teamId}):null})]})}const QV={id:"workspace",name:"Workspace",icon:"🧩",route:"workspace",component:XV,sidebarLabel:"Workspace",order:0},JV=Object.freeze(Object.defineProperty({__proto__:null,module:QV},Symbol.toStringTag,{value:"Module"}));function Ww(e){return e===null||typeof e!="object"?null:"module"in e&&Dy(e.module)?e.module:"default"in e&&Dy(e.default)?e.default:null}function Dy(e){return e===null||typeof e!="object"?!1:"id"in e&&typeof e.id=="string"&&"name"in e&&typeof e.name=="string"&&"icon"in e&&typeof e.icon=="string"&&"route"in e&&typeof e.route=="string"&&"component"in e&&typeof e.component=="function"}function Vw(e,t){const n=typeof e.order=="number",r=typeof t.order=="number";return n&&r?e.order-t.order:n?-1:r?1:0}function eq(e){const t=[],n=e("./*/index.{ts,tsx}",{eager:!0});for(const r of Object.values(n)){const a=Ww(r);a&&t.push(a)}return t.sort((r,a)=>r.id.localeCompare(a.id)),t.sort(Vw),t}function tq(){try{return eq(()=>Object.assign({"./features/index.tsx":zz,"./history/index.tsx":mH,"./inbox/index.tsx":IH,"./observability/index.tsx":TG,"./task-kanban/index.tsx":fV,"./teams/index.tsx":YV,"./workspace/index.tsx":JV}))}catch(a){if(typeof require!="function")throw a}const e=require("node:fs"),t=require("node:path"),n=require("node:url"),r=typeof __dirname<"u"?__dirname:t.dirname(n.fileURLToPath(import.meta.url));return nq(r,{readdirSync:(a,s)=>e.readdirSync(a,s),tryRequire:a=>require(a)})}function nq(e,t){const n=require("node:path"),r=[];let a=[];try{a=t.readdirSync(e,{withFileTypes:!0})}catch{return r}const s=a.filter(i=>i.isDirectory()).map(i=>i.name).sort((i,o)=>i.localeCompare(o));for(const i of s)for(const o of["tsx","ts"]){const u=n.join(e,i,`index.${o}`);try{const c=t.tryRequire(u),p=Ww(c);if(p){r.push(p);break}}catch{}}return r.sort(Vw),r}function rq(e,t){const n=new Set(t?.disabled??[]),r=e.slice(),a=new Set(n);function s(){return r.filter(i=>!a.has(i.id))}return aq(r),{get modules(){return s()},getModule(i){return s().find(o=>o.id===i)},get defaultModule(){return s()[0]},disableModule(i){a.add(i)},enableModule(i){a.delete(i)},getEnabledModules(){return s().map(i=>i.id)},registerModuleRoot(i){}}}function aq(e){const t=new Map,n=new Map;for(const r of e){const a=t.get(r.id);if(a!==void 0)throw new Error(`Duplicate module id "${r.id}" discovered in two sources: ${a} and ${Do(r)}`);t.set(r.id,Do(r));const s=n.get(r.route);if(s!==void 0)throw new Error(`Duplicate module route "${r.route}" discovered in two sources: ${s} and ${Do(r)}`);n.set(r.route,Do(r))}}function Do(e){return e.id}const Rb=rq(tq(),{disabled:nP}),qw=Rb.modules;function sq(e){return Rb.getModule(e)}const Oo=Rb.defaultModule;function iq(){const[e,t]=g.useState([]);return g.useEffect(()=>{if(typeof window>"u")return;const n=r=>{const s=r.detail?.message||"An error occurred",i=`${Date.now()}-${Math.random().toString(36).slice(2,7)}`;t(o=>[...o,{id:i,message:s}]),setTimeout(()=>{t(o=>o.filter(u=>u.id!==i))},5e3)};return window.addEventListener("api-error",n),()=>{window.removeEventListener("api-error",n)}},[]),e.length===0?null:l.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-2 max-w-md w-full px-4 pointer-events-none",children:e.map(n=>l.jsxs("div",{className:"pointer-events-auto flex items-center justify-between gap-3 p-3 bg-red-950/90 border border-red-500/40 text-red-200 text-sm rounded-md shadow-lg backdrop-blur",role:"alert",children:[l.jsx("span",{className:"flex-1 break-words",children:n.message}),l.jsx("button",{type:"button",className:"text-red-400 hover:text-red-100 text-base font-bold leading-none px-1",onClick:()=>t(r=>r.filter(a=>a.id!==n.id)),"aria-label":"Close error toast",children:"×"})]},n.id))})}function oq({currentName:e}){const[t,n]=g.useState(!1),[r,a]=g.useState([]),[s,i]=g.useState(null),[o,u]=g.useState(null),c=g.useRef(null);g.useEffect(()=>{if(!t)return;const d=new AbortController;return Tt(new Request(`${Nt()}/projects`,{signal:d.signal})).then(async f=>{if(!f.ok)return;const m=await f.json();a(m.projects??[])}).catch(()=>{u("Failed to load projects")}),()=>d.abort()},[t]),g.useEffect(()=>{if(!t)return;const d=m=>{m.key==="Escape"&&n(!1)},f=m=>{c.current&&!c.current.contains(m.target)&&n(!1)};return document.addEventListener("keydown",d),document.addEventListener("mousedown",f),()=>{document.removeEventListener("keydown",d),document.removeEventListener("mousedown",f)}},[t]);const p=async d=>{if(d.current){n(!1);return}if(d.running&&d.port>0){window.location.href=`http://localhost:${d.port}/board`;return}i(d.name);try{const f=await Tt(new Request(`${Nt()}/projects/start`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:d.name,path:d.path})}));if(!f.ok)throw new Error("Failed to start project");const m=await f.json();window.location.href=m.url||`http://localhost:${m.port}/board`}catch(f){u(f instanceof Error?f.message:"Start failed"),i(null)}};return l.jsxs("div",{className:"relative min-w-0 flex-1",ref:c,children:[l.jsxs("button",{type:"button",onClick:()=>n(d=>!d),"aria-haspopup":"listbox","aria-expanded":t,"aria-label":"Switch project",title:e,"data-testid":"project-switcher-trigger",className:"flex w-full items-center justify-between gap-1 rounded-md px-1.5 py-1 text-left text-sm font-semibold text-spur-text hover:bg-spur-border/30 focus-visible:outline focus-visible:outline-2 focus-visible:outline-spur-accent",children:[l.jsx("span",{className:"font-semibold truncate",children:e}),l.jsx("svg",{className:`h-4 w-4 shrink-0 transition-transform ${t?"rotate-180":""}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),t&&l.jsxs("div",{role:"listbox","aria-label":"Registered projects","data-testid":"project-switcher-menu",className:"absolute left-0 top-full z-50 mt-1 w-64 rounded-md border border-spur-border bg-spur-surface p-1 shadow-lg",children:[l.jsx("div",{className:"px-2 py-1 text-xs font-medium text-spur-text-muted border-b border-spur-border/50 mb-1",children:"Projects"}),r.length===0?l.jsx("div",{className:"px-2 py-1.5 text-xs text-spur-text-muted",children:o||"No projects registered"}):r.map(d=>l.jsxs("button",{type:"button",role:"option","aria-selected":d.current,disabled:s===d.name,onClick:()=>p(d),"data-testid":`project-item-${d.name}`,className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-xs text-left transition-colors ${d.current?"bg-spur-accent/15 text-spur-accent font-medium":"text-spur-text hover:bg-spur-border/30"}`,children:[l.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[l.jsx("span",{className:`h-2 w-2 rounded-full shrink-0 ${d.running?"bg-green-500":"bg-gray-400"}`,title:d.running?`Running on port ${d.port}`:"Stopped"}),l.jsx("span",{className:"truncate",children:d.name})]}),s===d.name?l.jsx("span",{className:"text-[10px] text-spur-accent animate-pulse",children:"Starting..."}):d.current?l.jsx("span",{className:"text-[10px] font-semibold text-spur-accent",children:"current"}):d.running?l.jsxs("span",{className:"text-[10px] text-spur-text-muted",children:[":",d.port]}):l.jsx("span",{className:"text-[10px] text-spur-text-muted",children:"stopped"})]},d.path))]})]})}const Yw="spur-theme";function lq(){try{const e=localStorage.getItem(Yw);if(e==="light"||e==="dark")return e}catch{}return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function uq(e){document.documentElement.setAttribute("data-theme",e);try{localStorage.setItem(Yw,e)}catch{}}function cq(e){const t=e==="dark"?"light":"dark";return uq(t),t}function dq(){const[e,t]=g.useState(lq);g.useEffect(()=>{const r=window.matchMedia("(prefers-color-scheme: dark)"),a=s=>{if(!(()=>{try{return localStorage.getItem("spur-theme")}catch{return null}})()){const o=s.matches?"dark":"light";t(o),document.documentElement.setAttribute("data-theme",o)}};return r.addEventListener("change",a),()=>r.removeEventListener("change",a)},[]);const n=g.useCallback(()=>t(cq),[]);return l.jsx(Ge,{variant:"ghost",size:"sm",onClick:n,className:"text-spur-text-muted","aria-label":e==="dark"?"Switch to light mode":"Switch to dark mode",children:e==="dark"?"☀️":"🌙"})}const pq="Modules";function fq(){const[e,t]=g.useState(pq);return g.useEffect(()=>{const n=new AbortController;return Tt(new Request(`${Nt()}/project`,{signal:n.signal})).then(async r=>{if(!r.ok)return;const a=await r.json();a.name&&t(a.name)}).catch(()=>{}),()=>n.abort()},[]),e}function mq({direction:e}){const t=e==="expand";return l.jsx("svg",{className:"h-4 w-4 shrink-0",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:t?l.jsx("path",{d:"M6 3l5 5-5 5"}):l.jsx("path",{d:"M10 3L5 8l5 5"})})}function Oy({collapsed:e,onToggle:t}){const n=e?"Expand sidebar":"Collapse sidebar";return l.jsx("button",{type:"button",onClick:t,"aria-label":n,title:n,"data-testid":e?"sidebar-expand":"sidebar-collapse",className:"flex h-8 w-8 items-center justify-center rounded-md text-spur-text-muted hover:bg-spur-accent/20 hover:text-spur-accent focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-spur-accent",children:l.jsx(mq,{direction:e?"expand":"collapse"})})}function hq({collapsed:e,onToggle:t,onMobileClose:n}){const r=fq();return l.jsxs("aside",{className:"flex flex-col bg-spur-surface border-r border-spur-border overflow-hidden",children:[e?l.jsx("div",{className:"flex items-center justify-center border-b border-spur-border shrink-0 py-1",children:l.jsx(Oy,{collapsed:!0,onToggle:t})}):l.jsxs("div",{className:"flex items-center justify-between gap-1 p-3 border-b border-spur-border shrink-0",children:[l.jsx(oq,{currentName:r}),l.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[l.jsx(Oy,{collapsed:!1,onToggle:t}),l.jsx(dq,{}),n&&l.jsx(Ge,{variant:"ghost",size:"sm",className:"text-spur-text-muted md:hidden",onClick:n,"aria-label":"Close navigation",children:"✕"})]})]}),l.jsx("nav",{className:"flex-1 overflow-y-auto",children:qw.map(a=>l.jsxs(c1,{to:`/board/${a.route}`,className:({isActive:s})=>`flex items-center gap-2 px-3 py-2 text-sm transition-colors ${s?"bg-spur-accent/20 text-spur-accent":"text-spur-text-muted hover:text-spur-text hover:bg-spur-border/30"} ${e?"justify-center py-3":""}`,title:e?a.name:void 0,children:[l.jsx("span",{className:"text-lg",children:a.icon}),!e&&l.jsx("span",{children:a.sidebarLabel??a.name})]},a.id))})]})}function gq({children:e,mobileHeader:t}){return l.jsxs("main",{className:"flex flex-col h-full overflow-hidden bg-spur-bg",children:[t,l.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:e})]})}function bq({collapsed:e,onToggle:t,onMobileClose:n,children:r,actions:a}){return l.jsxs("aside",{className:"flex flex-col bg-spur-surface border-l border-spur-border overflow-hidden",children:[n&&l.jsx("div",{className:"hidden max-md:flex items-center justify-center py-2 shrink-0",children:l.jsx("div",{className:"w-10 h-1 rounded-full bg-spur-border"})}),l.jsxs("div",{className:"flex items-center justify-between p-3 border-b border-spur-border shrink-0",children:[!e&&l.jsx("span",{className:"text-sm font-semibold text-spur-text",children:r?"Context":""}),l.jsx("div",{className:"flex items-center gap-1",children:a}),l.jsxs("div",{className:"flex items-center gap-1",children:[n&&l.jsx(Ge,{variant:"ghost",size:"sm",className:"text-spur-text-muted md:hidden",onClick:n,"aria-label":"Close panel",children:"✕"}),l.jsx(Ge,{variant:"ghost",size:"sm",className:"text-spur-text-muted hidden md:inline-flex",onClick:t,"aria-label":e?"Expand panel":"Collapse panel",children:e?"◀":"▶"})]})]}),!e&&l.jsx("div",{className:"flex-1 overflow-y-auto p-3",children:r})]})}const Eq=g.createContext(void 0);function xq(){const[e,t]=g.useState(()=>eP()),[n,r]=g.useState(!1),[a,s]=g.useState(!1),i=sr(),o=(()=>{const S=i.pathname.split("/"),w=S.indexOf("board"),A=w>=0?S[w+1]:void 0;return sq(A??"")})();g.useLayoutEffect(()=>{const S=document.documentElement;S.style.setProperty("--sidebar-w",`${e.sidebarWidth}px`),S.style.setProperty("--rightpanel-w",`${e.rightPanelWidth}px`)},[e.sidebarWidth,e.rightPanelWidth]);const u=g.useCallback(S=>tP(S),[]),c=g.useCallback(()=>{t(S=>{const w={...S,sidebarCollapsed:!S.sidebarCollapsed};return u(w),w})},[u]),p=g.useCallback(()=>{t(S=>{const w={...S,rightPanelCollapsed:!S.rightPanelCollapsed};return u(w),w})},[u]),d=g.useCallback(S=>t(w=>{const A={...w,sidebarWidth:S};return u(A),A}),[u]),f=g.useCallback(S=>t(w=>{const A={...w,rightPanelWidth:S};return u(A),A}),[u]),m=g.useCallback(()=>{r(!1),s(!1)},[]),b=g.useCallback(S=>{S.key==="Escape"&&m()},[m]),E=o?.rightPanelComponent;g.useLayoutEffect(()=>{E&&e.rightPanelCollapsed&&t(S=>({...S,rightPanelCollapsed:!1}))},[E,e.rightPanelCollapsed]);const x=l.jsxs("div",{className:"mobile-bar",children:[l.jsx(Ge,{variant:"ghost",size:"sm",className:"text-spur-text",onClick:()=>r(!0),"aria-label":"Open navigation",children:"☰"}),l.jsx("span",{className:"text-sm font-semibold text-spur-text",children:o?.name??"Spur"}),l.jsx(Ge,{variant:"ghost",size:"sm",className:"text-spur-text",onClick:()=>s(!0),"aria-label":"Open panel",children:"◧"})]}),y=n||a;return l.jsxs(l.Fragment,{children:[y&&l.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 md:hidden",onClick:m,onKeyDown:b,"aria-hidden":"true"}),l.jsx("div",{className:"board-layout","data-sidebar-collapsed":String(e.sidebarCollapsed),"data-rightpanel-collapsed":String(e.rightPanelCollapsed),"data-mobile-sidebar-open":String(n),"data-mobile-panel-open":String(a),children:l.jsxs(Eq.Provider,{value:o,children:[l.jsx(hq,{collapsed:e.sidebarCollapsed,onToggle:c,onMobileClose:m}),l.jsx(gl,{targetVar:"--sidebar-w",onResizeEnd:d}),l.jsx(gq,{mobileHeader:x,children:l.jsx(GN,{})}),l.jsx(gl,{targetVar:"--rightpanel-w",onResizeEnd:f}),l.jsx(bq,{collapsed:e.rightPanelCollapsed,onToggle:p,onMobileClose:m,children:E?l.jsx(E,{}):null})]})}),l.jsx(iq,{})]})}const yq=[{path:"/board",element:l.jsx(xq,{}),children:[{index:!0,element:l.jsx(u0,{to:Oo?Oo.route:"/board",replace:!0})},...qw.flatMap(e=>[{path:e.route,element:l.jsx(e.component,{})},{path:`${e.route}/*`,element:l.jsx(e.component,{})}])]},{path:"/",element:l.jsx(u0,{to:Oo?`/board/${Oo.route}`:"/board",replace:!0})}];function Tq(){return g_(yq)}function vq(){const[e]=g.useState(Tq);return l.jsx($N,{router:e})}export{Ge as B,tb as C,Ra as L,ol as M,Xr as S,Bv as _,sn as a,Ot as b,xz as c,vq as d,l as j,hz as p,fb as t,hb as u};
|
|
178
|
+
`},OG={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function LG(e){let{announcements:t=OG,container:n,hiddenTextDescribedById:r,screenReaderInstructions:a=DG}=e;const{announce:s,announcement:i}=kG(),o=Au("DndLiveRegion"),[u,c]=g.useState(!1);if(g.useEffect(()=>{c(!0)},[]),IG(g.useMemo(()=>({onDragStart(d){let{active:f}=d;s(t.onDragStart({active:f}))},onDragMove(d){let{active:f,over:m}=d;t.onDragMove&&s(t.onDragMove({active:f,over:m}))},onDragOver(d){let{active:f,over:m}=d;s(t.onDragOver({active:f,over:m}))},onDragEnd(d){let{active:f,over:m}=d;s(t.onDragEnd({active:f,over:m}))},onDragCancel(d){let{active:f,over:m}=d;s(t.onDragCancel({active:f,over:m}))}}),[s,t])),!u)return null;const p=tt.createElement(tt.Fragment,null,tt.createElement(_G,{id:r,value:a.draggable}),tt.createElement(CG,{id:o,announcement:i}));return n?da.createPortal(p,n):p}var on;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(on||(on={}));function _l(){}function my(e,t){return g.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function FG(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const cr=Object.freeze({x:0,y:0});function MG(e,t){const n=Nl(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function PG(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function jG(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function BG(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),i=a-r,o=s-n;if(r<a&&n<s){const u=t.width*t.height,c=e.width*e.height,p=i*o,d=p/(u+c-p);return Number(d.toFixed(4))}return 0}const UG=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=[];for(const s of r){const{id:i}=s,o=n.get(i);if(o){const u=BG(o,t);u>0&&a.push({id:i,data:{droppableContainer:s,value:u}})}}return a.sort(PG)};function $G(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Ew(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:cr}function zG(e){return function(n){for(var r=arguments.length,a=new Array(r>1?r-1:0),s=1;s<r;s++)a[s-1]=arguments[s];return a.reduce((i,o)=>({...i,top:i.top+e*o.y,bottom:i.bottom+e*o.y,left:i.left+e*o.x,right:i.right+e*o.x}),{...n})}}const HG=zG(1);function xw(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function GG(e,t,n){const r=xw(t);if(!r)return e;const{scaleX:a,scaleY:s,x:i,y:o}=r,u=e.left-i-(1-a)*parseFloat(n),c=e.top-o-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),p=a?e.width/a:e.width,d=s?e.height/s:e.height;return{width:p,height:d,top:c,right:u+p,bottom:c+d,left:u}}const WG={ignoreTransform:!1};function to(e,t){t===void 0&&(t=WG);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:p}=Pn(e).getComputedStyle(e);c&&(n=GG(n,c,p))}const{top:r,left:a,width:s,height:i,bottom:o,right:u}=n;return{top:r,left:a,width:s,height:i,bottom:o,right:u}}function hy(e){return to(e,{ignoreTransform:!0})}function VG(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function qG(e,t){return t===void 0&&(t=Pn(e).getComputedStyle(e)),t.position==="fixed"}function YG(e,t){t===void 0&&(t=Pn(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const s=t[a];return typeof s=="string"?n.test(s):!1})}function vb(e,t){const n=[];function r(a){if(t!=null&&n.length>=t||!a)return n;if(Tb(a)&&a.scrollingElement!=null&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!Ji(a)||hw(a)||n.includes(a))return n;const s=Pn(e).getComputedStyle(a);return a!==e&&YG(a,s)&&n.push(a),qG(a,s)?n:r(a.parentNode)}return e?r(e):n}function yw(e){const[t]=vb(e,1);return t??null}function Ic(e){return!vu||!e?null:As(e)?e:yb(e)?Tb(e)||e===Ns(e).scrollingElement?window:Ji(e)?e:null:null}function Tw(e){return As(e)?e.scrollX:e.scrollLeft}function Sw(e){return As(e)?e.scrollY:e.scrollTop}function Cd(e){return{x:Tw(e),y:Sw(e)}}var hn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(hn||(hn={}));function vw(e){return!vu||!e?!1:e===document.scrollingElement}function ww(e){const t={x:0,y:0},n=vw(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},a=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,i=e.scrollTop>=r.y,o=e.scrollLeft>=r.x;return{isTop:a,isLeft:s,isBottom:i,isRight:o,maxScroll:r,minScroll:t}}const ZG={x:.2,y:.2};function KG(e,t,n,r,a){let{top:s,left:i,right:o,bottom:u}=n;r===void 0&&(r=10),a===void 0&&(a=ZG);const{isTop:c,isBottom:p,isLeft:d,isRight:f}=ww(e),m={x:0,y:0},b={x:0,y:0},E={height:t.height*a.y,width:t.width*a.x};return!c&&s<=t.top+E.height?(m.y=hn.Backward,b.y=r*Math.abs((t.top+E.height-s)/E.height)):!p&&u>=t.bottom-E.height&&(m.y=hn.Forward,b.y=r*Math.abs((t.bottom-E.height-u)/E.height)),!f&&o>=t.right-E.width?(m.x=hn.Forward,b.x=r*Math.abs((t.right-E.width-o)/E.width)):!d&&i<=t.left+E.width&&(m.x=hn.Backward,b.x=r*Math.abs((t.left+E.width-i)/E.width)),{direction:m,speed:b}}function XG(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:i}=window;return{top:0,left:0,right:s,bottom:i,width:s,height:i}}const{top:t,left:n,right:r,bottom:a}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:a,width:e.clientWidth,height:e.clientHeight}}function Aw(e){return e.reduce((t,n)=>es(t,Cd(n)),cr)}function QG(e){return e.reduce((t,n)=>t+Tw(n),0)}function JG(e){return e.reduce((t,n)=>t+Sw(n),0)}function Nw(e,t){if(t===void 0&&(t=to),!e)return;const{top:n,left:r,bottom:a,right:s}=t(e);yw(e)&&(a<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const eW=[["x",["left","right"],QG],["y",["top","bottom"],JG]];class wb{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=vb(n),a=Aw(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,i,o]of eW)for(const u of i)Object.defineProperty(this,u,{get:()=>{const c=o(r),p=a[s]-c;return this.rect[u]+p},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ui{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var a;(a=this.target)==null||a.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function tW(e){const{EventTarget:t}=Pn(e);return e instanceof t?e:Ns(e)}function Rc(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var er;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(er||(er={}));function gy(e){e.preventDefault()}function nW(e){e.stopPropagation()}var Ft;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Ft||(Ft={}));const _w={start:[Ft.Space,Ft.Enter],cancel:[Ft.Esc],end:[Ft.Space,Ft.Enter,Ft.Tab]},rW=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Ft.Right:return{...n,x:n.x+25};case Ft.Left:return{...n,x:n.x-25};case Ft.Down:return{...n,y:n.y+25};case Ft.Up:return{...n,y:n.y-25}}};class Ab{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new ui(Ns(n)),this.windowListeners=new ui(Pn(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(er.Resize,this.handleCancel),this.windowListeners.add(er.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(er.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Nw(r),n(cr)}handleKeyDown(t){if(Sb(t)){const{active:n,context:r,options:a}=this.props,{keyboardCodes:s=_w,coordinateGetter:i=rW,scrollBehavior:o="smooth"}=a,{code:u}=t;if(s.end.includes(u)){this.handleEnd(t);return}if(s.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:c}=r.current,p=c?{x:c.left,y:c.top}:cr;this.referenceCoordinates||(this.referenceCoordinates=p);const d=i(t,{active:n,context:r.current,currentCoordinates:p});if(d){const f=Al(d,p),m={x:0,y:0},{scrollableAncestors:b}=r.current;for(const E of b){const x=t.code,{isTop:y,isRight:S,isLeft:w,isBottom:A,maxScroll:D,minScroll:N}=ww(E),T=XG(E),v={x:Math.min(x===Ft.Right?T.right-T.width/2:T.right,Math.max(x===Ft.Right?T.left:T.left+T.width/2,d.x)),y:Math.min(x===Ft.Down?T.bottom-T.height/2:T.bottom,Math.max(x===Ft.Down?T.top:T.top+T.height/2,d.y))},R=x===Ft.Right&&!S||x===Ft.Left&&!w,C=x===Ft.Down&&!A||x===Ft.Up&&!y;if(R&&v.x!==d.x){const U=E.scrollLeft+f.x,k=x===Ft.Right&&U<=D.x||x===Ft.Left&&U>=N.x;if(k&&!f.y){E.scrollTo({left:U,behavior:o});return}k?m.x=E.scrollLeft-U:m.x=x===Ft.Right?E.scrollLeft-D.x:E.scrollLeft-N.x,m.x&&E.scrollBy({left:-m.x,behavior:o});break}else if(C&&v.y!==d.y){const U=E.scrollTop+f.y,k=x===Ft.Down&&U<=D.y||x===Ft.Up&&U>=N.y;if(k&&!f.x){E.scrollTo({top:U,behavior:o});return}k?m.y=E.scrollTop-U:m.y=x===Ft.Down?E.scrollTop-D.y:E.scrollTop-N.y,m.y&&E.scrollBy({top:-m.y,behavior:o});break}}this.handleMove(t,es(Al(d,this.referenceCoordinates),m))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Ab.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=_w,onActivation:a}=t,{active:s}=n;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const o=s.activatorNode.current;return o&&e.target!==o?!1:(e.preventDefault(),a?.({event:e.nativeEvent}),!0)}return!1}}];function by(e){return!!(e&&"distance"in e)}function Ey(e){return!!(e&&"delay"in e)}class Nb{constructor(t,n,r){var a;r===void 0&&(r=tW(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:s}=t,{target:i}=s;this.props=t,this.events=n,this.document=Ns(i),this.documentListeners=new ui(this.document),this.listeners=new ui(r),this.windowListeners=new ui(Pn(i)),this.initialCoordinates=(a=Nl(s))!=null?a:cr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(er.Resize,this.handleCancel),this.windowListeners.add(er.DragStart,gy),this.windowListeners.add(er.VisibilityChange,this.handleCancel),this.windowListeners.add(er.ContextMenu,gy),this.documentListeners.add(er.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ey(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(by(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:a}=this.props;a(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(er.Click,nW,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(er.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:a,props:s}=this,{onMove:i,options:{activationConstraint:o}}=s;if(!a)return;const u=(n=Nl(t))!=null?n:cr,c=Al(a,u);if(!r&&o){if(by(o)){if(o.tolerance!=null&&Rc(c,o.tolerance))return this.handleCancel();if(Rc(c,o.distance))return this.handleStart()}if(Ey(o)&&Rc(c,o.tolerance))return this.handleCancel();this.handlePending(o,c);return}t.cancelable&&t.preventDefault(),i(u)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Ft.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const aW={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class _b extends Nb{constructor(t){const{event:n}=t,r=Ns(n.target);super(t,aW,r)}}_b.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const sW={move:{name:"mousemove"},end:{name:"mouseup"}};var kd;(function(e){e[e.RightClick=2]="RightClick"})(kd||(kd={}));class iW extends Nb{constructor(t){super(t,sW,Ns(t.event.target))}}iW.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===kd.RightClick?!1:(r?.({event:n}),!0)}}];const Dc={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class oW extends Nb{constructor(t){super(t,Dc)}static setup(){return window.addEventListener(Dc.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Dc.move.name,t)};function t(){}}}oW.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:a}=n;return a.length>1?!1:(r?.({event:n}),!0)}}];var ci;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ci||(ci={}));var Cl;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Cl||(Cl={}));function lW(e){let{acceleration:t,activator:n=ci.Pointer,canScroll:r,draggingRect:a,enabled:s,interval:i=5,order:o=Cl.TreeOrder,pointerCoordinates:u,scrollableAncestors:c,scrollableAncestorRects:p,delta:d,threshold:f}=e;const m=cW({delta:d,disabled:!s}),[b,E]=SG(),x=g.useRef({x:0,y:0}),y=g.useRef({x:0,y:0}),S=g.useMemo(()=>{switch(n){case ci.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case ci.DraggableRect:return a}},[n,a,u]),w=g.useRef(null),A=g.useCallback(()=>{const N=w.current;if(!N)return;const T=x.current.x*y.current.x,v=x.current.y*y.current.y;N.scrollBy(T,v)},[]),D=g.useMemo(()=>o===Cl.TreeOrder?[...c].reverse():c,[o,c]);g.useEffect(()=>{if(!s||!c.length||!S){E();return}for(const N of D){if(r?.(N)===!1)continue;const T=c.indexOf(N),v=p[T];if(!v)continue;const{direction:R,speed:C}=KG(N,v,S,t,f);for(const U of["x","y"])m[U][R[U]]||(C[U]=0,R[U]=0);if(C.x>0||C.y>0){E(),w.current=N,b(A,i),x.current=C,y.current=R;return}}x.current={x:0,y:0},y.current={x:0,y:0},E()},[t,A,r,E,s,i,JSON.stringify(S),JSON.stringify(m),b,c,D,p,JSON.stringify(f)])}const uW={x:{[hn.Backward]:!1,[hn.Forward]:!1},y:{[hn.Backward]:!1,[hn.Forward]:!1}};function cW(e){let{delta:t,disabled:n}=e;const r=wl(t);return eo(a=>{if(n||!r||!a)return uW;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[hn.Backward]:a.x[hn.Backward]||s.x===-1,[hn.Forward]:a.x[hn.Forward]||s.x===1},y:{[hn.Backward]:a.y[hn.Backward]||s.y===-1,[hn.Forward]:a.y[hn.Forward]||s.y===1}}},[n,t,r])}function dW(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return eo(a=>{var s;return t==null?null:(s=r??a)!=null?s:null},[r,t])}function pW(e,t){return g.useMemo(()=>e.reduce((n,r)=>{const{sensor:a}=r,s=a.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,r)}));return[...n,...s]},[]),[e,t])}var ki;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ki||(ki={}));var Id;(function(e){e.Optimized="optimized"})(Id||(Id={}));const xy=new Map;function fW(e,t){let{dragging:n,dependencies:r,config:a}=t;const[s,i]=g.useState(null),{frequency:o,measure:u,strategy:c}=a,p=g.useRef(e),d=x(),f=Ci(d),m=g.useCallback(function(y){y===void 0&&(y=[]),!f.current&&i(S=>S===null?y:S.concat(y.filter(w=>!S.includes(w))))},[f]),b=g.useRef(null),E=eo(y=>{if(d&&!n)return xy;if(!y||y===xy||p.current!==e||s!=null){const S=new Map;for(let w of e){if(!w)continue;if(s&&s.length>0&&!s.includes(w.id)&&w.rect.current){S.set(w.id,w.rect.current);continue}const A=w.node.current,D=A?new wb(u(A),A):null;w.rect.current=D,D&&S.set(w.id,D)}return S}return y},[e,s,n,d,u]);return g.useEffect(()=>{p.current=e},[e]),g.useEffect(()=>{d||m()},[n,d]),g.useEffect(()=>{s&&s.length>0&&i(null)},[JSON.stringify(s)]),g.useEffect(()=>{d||typeof o!="number"||b.current!==null||(b.current=setTimeout(()=>{m(),b.current=null},o))},[o,d,m,...r]),{droppableRects:E,measureDroppableContainers:m,measuringScheduled:s!=null};function x(){switch(c){case ki.Always:return!1;case ki.BeforeDragging:return n;default:return!n}}}function Cb(e,t){return eo(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function mW(e,t){return Cb(e,t)}function hW(e){let{callback:t,disabled:n}=e;const r=wu(t),a=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return g.useEffect(()=>()=>a?.disconnect(),[a]),a}function Nu(e){let{callback:t,disabled:n}=e;const r=wu(t),a=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return g.useEffect(()=>()=>a?.disconnect(),[a]),a}function gW(e){return new wb(to(e),e)}function yy(e,t,n){t===void 0&&(t=gW);const[r,a]=g.useState(null);function s(){a(u=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=u??n)!=null?c:null}const p=t(e);return JSON.stringify(u)===JSON.stringify(p)?u:p})}const i=hW({callback(u){if(e)for(const c of u){const{type:p,target:d}=c;if(p==="childList"&&d instanceof HTMLElement&&d.contains(e)){s();break}}}}),o=Nu({callback:s});return Or(()=>{s(),e?(o?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(o?.disconnect(),i?.disconnect())},[e]),r}function bW(e){const t=Cb(e);return Ew(e,t)}const Ty=[];function EW(e){const t=g.useRef(e),n=eo(r=>e?r&&r!==Ty&&e&&t.current&&e.parentNode===t.current.parentNode?r:vb(e):Ty,[e]);return g.useEffect(()=>{t.current=e},[e]),n}function xW(e){const[t,n]=g.useState(null),r=g.useRef(e),a=g.useCallback(s=>{const i=Ic(s.target);i&&n(o=>o?(o.set(i,Cd(i)),new Map(o)):null)},[]);return g.useEffect(()=>{const s=r.current;if(e!==s){i(s);const o=e.map(u=>{const c=Ic(u);return c?(c.addEventListener("scroll",a,{passive:!0}),[c,Cd(c)]):null}).filter(u=>u!=null);n(o.length?new Map(o):null),r.current=e}return()=>{i(e),i(s)};function i(o){o.forEach(u=>{const c=Ic(u);c?.removeEventListener("scroll",a)})}},[a,e]),g.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,i)=>es(s,i),cr):Aw(e):cr,[e,t])}function Sy(e,t){t===void 0&&(t=[]);const n=g.useRef(null);return g.useEffect(()=>{n.current=null},t),g.useEffect(()=>{const r=e!==cr;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Al(e,n.current):cr}function yW(e){g.useEffect(()=>{if(!vu)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function TW(e,t){return g.useMemo(()=>e.reduce((n,r)=>{let{eventName:a,handler:s}=r;return n[a]=i=>{s(i,t)},n},{}),[e,t])}function Cw(e){return g.useMemo(()=>e?VG(e):null,[e])}const vy=[];function SW(e,t){t===void 0&&(t=to);const[n]=e,r=Cw(n?Pn(n):null),[a,s]=g.useState(vy);function i(){s(()=>e.length?e.map(u=>vw(u)?r:new wb(t(u),u)):vy)}const o=Nu({callback:i});return Or(()=>{o?.disconnect(),i(),e.forEach(u=>o?.observe(u))},[e]),a}function kw(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ji(t)?t:e}function vW(e){let{measure:t}=e;const[n,r]=g.useState(null),a=g.useCallback(c=>{for(const{target:p}of c)if(Ji(p)){r(d=>{const f=t(p);return d?{...d,width:f.width,height:f.height}:f});break}},[t]),s=Nu({callback:a}),i=g.useCallback(c=>{const p=kw(c);s?.disconnect(),p&&s?.observe(p),r(p?t(p):null)},[t,s]),[o,u]=vl(i);return g.useMemo(()=>({nodeRef:o,rect:n,setRef:u}),[n,o,u])}const wW=[{sensor:_b,options:{}},{sensor:Ab,options:{}}],AW={current:{}},Vo={draggable:{measure:hy},droppable:{measure:hy,strategy:ki.WhileDragging,frequency:Id.Optimized},dragOverlay:{measure:to}};class di extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const NW={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new di,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:_l},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Vo,measureDroppableContainers:_l,windowRect:null,measuringScheduled:!1},Iw={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:_l,draggableNodes:new Map,over:null,measureDroppableContainers:_l},no=g.createContext(Iw),Rw=g.createContext(NW);function _W(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new di}}}function CW(e,t){switch(t.type){case on.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case on.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case on.DragEnd:case on.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case on.RegisterDroppable:{const{element:n}=t,{id:r}=n,a=new di(e.droppable.containers);return a.set(r,n),{...e,droppable:{...e.droppable,containers:a}}}case on.SetDroppableDisabled:{const{id:n,key:r,disabled:a}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const i=new di(e.droppable.containers);return i.set(n,{...s,disabled:a}),{...e,droppable:{...e.droppable,containers:i}}}case on.UnregisterDroppable:{const{id:n,key:r}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const s=new di(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function kW(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:a}=g.useContext(no),s=wl(r),i=wl(n?.id);return g.useEffect(()=>{if(!t&&!r&&s&&i!=null){if(!Sb(s)||document.activeElement===s.target)return;const o=a.get(i);if(!o)return;const{activatorNode:u,node:c}=o;if(!u.current&&!c.current)return;requestAnimationFrame(()=>{for(const p of[u.current,c.current]){if(!p)continue;const d=AG(p);if(d){d.focus();break}}})}},[r,t,a,i,s]),null}function Dw(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((a,s)=>s({transform:a,...r}),n):n}function IW(e){return g.useMemo(()=>({draggable:{...Vo.draggable,...e?.draggable},droppable:{...Vo.droppable,...e?.droppable},dragOverlay:{...Vo.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function RW(e){let{activeNode:t,measure:n,initialRect:r,config:a=!0}=e;const s=g.useRef(!1),{x:i,y:o}=typeof a=="boolean"?{x:a,y:a}:a;Or(()=>{if(!i&&!o||!t){s.current=!1;return}if(s.current||!r)return;const c=t?.node.current;if(!c||c.isConnected===!1)return;const p=n(c),d=Ew(p,r);if(i||(d.x=0),o||(d.y=0),s.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const f=yw(c);f&&f.scrollBy({top:d.y,left:d.x})}},[t,i,o,r,n])}const _u=g.createContext({...cr,scaleX:1,scaleY:1});var Hr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Hr||(Hr={}));const DW=g.memo(function(t){var n,r,a,s;let{id:i,accessibility:o,autoScroll:u=!0,children:c,sensors:p=wW,collisionDetection:d=UG,measuring:f,modifiers:m,...b}=t;const E=g.useReducer(CW,void 0,_W),[x,y]=E,[S,w]=RG(),[A,D]=g.useState(Hr.Uninitialized),N=A===Hr.Initialized,{draggable:{active:T,nodes:v,translate:R},droppable:{containers:C}}=x,U=T!=null?v.get(T):null,k=g.useRef({initial:null,translated:null}),j=g.useMemo(()=>{var Le;return T!=null?{id:T,data:(Le=U?.data)!=null?Le:AW,rect:k}:null},[T,U]),G=g.useRef(null),[$,te]=g.useState(null),[H,se]=g.useState(null),de=Ci(b,Object.values(b)),O=Au("DndDescribedBy",i),ne=g.useMemo(()=>C.getEnabled(),[C]),pe=IW(f),{droppableRects:L,measureDroppableContainers:ke,measuringScheduled:Re}=fW(ne,{dragging:N,dependencies:[R.x,R.y],config:pe.droppable}),Q=dW(v,T),_e=g.useMemo(()=>H?Nl(H):null,[H]),fe=Qt(),X=mW(Q,pe.draggable.measure);RW({activeNode:T!=null?v.get(T):null,config:fe.layoutShiftCompensation,initialRect:X,measure:pe.draggable.measure});const Ve=yy(Q,pe.draggable.measure,X),ge=yy(Q?Q.parentElement:null),me=g.useRef({activatorEvent:null,active:null,activeNode:Q,collisionRect:null,collisions:null,droppableRects:L,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:C,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Te=C.getNodeFor((n=me.current.over)==null?void 0:n.id),ve=vW({measure:pe.dragOverlay.measure}),ie=(r=ve.nodeRef.current)!=null?r:Q,Ze=N?(a=ve.rect)!=null?a:Ve:null,ot=!!(ve.nodeRef.current&&ve.rect),rt=bW(ot?null:Ve),Ht=Cw(ie?Pn(ie):null),St=EW(N?Te??Q:null),Ct=SW(St),Zt=Dw(m,{transform:{x:R.x-rt.x,y:R.y-rt.y,scaleX:1,scaleY:1},activatorEvent:H,active:j,activeNodeRect:Ve,containerNodeRect:ge,draggingNodeRect:Ze,over:me.current.over,overlayNodeRect:ve.rect,scrollableAncestors:St,scrollableAncestorRects:Ct,windowRect:Ht}),at=_e?es(_e,R):null,De=xW(St),et=Sy(De),Z=Sy(De,[Ve]),oe=es(Zt,et),J=Ze?HG(Ze,Zt):null,ue=j&&J?d({active:j,collisionRect:J,droppableRects:L,droppableContainers:ne,pointerCoordinates:at}):null,Pe=jG(ue,"id"),[qe,ht]=g.useState(null),Rt=ot?Zt:es(Zt,Z),kt=$G(Rt,(s=qe?.rect)!=null?s:null,Ve),jt=g.useRef(null),ae=g.useCallback((Le,ft)=>{let{sensor:Ke,options:Dt}=ft;if(G.current==null)return;const nt=v.get(G.current);if(!nt)return;const Qe=Le.nativeEvent,wt=new Ke({active:G.current,activeNode:nt,event:Qe,options:Dt,context:me,onAbort(W){if(!v.get(W))return;const{onDragAbort:M}=de.current,z={id:W};M?.(z),S({type:"onDragAbort",event:z})},onPending(W,Be,M,z){if(!v.get(W))return;const{onDragPending:le}=de.current,be={id:W,constraint:Be,initialCoordinates:M,offset:z};le?.(be),S({type:"onDragPending",event:be})},onStart(W){const Be=G.current;if(Be==null)return;const M=v.get(Be);if(!M)return;const{onDragStart:z}=de.current,Y={activatorEvent:Qe,active:{id:Be,data:M.data,rect:k}};da.unstable_batchedUpdates(()=>{z?.(Y),D(Hr.Initializing),y({type:on.DragStart,initialCoordinates:W,active:Be}),S({type:"onDragStart",event:Y}),te(jt.current),se(Qe)})},onMove(W){y({type:on.DragMove,coordinates:W})},onEnd:Kt(on.DragEnd),onCancel:Kt(on.DragCancel)});jt.current=wt;function Kt(W){return async function(){const{active:M,collisions:z,over:Y,scrollAdjustedTranslate:le}=me.current;let be=null;if(M&&le){const{cancelDrop:Ie}=de.current;be={activatorEvent:Qe,active:M,collisions:z,delta:le,over:Y},W===on.DragEnd&&typeof Ie=="function"&&await Promise.resolve(Ie(be))&&(W=on.DragCancel)}G.current=null,da.unstable_batchedUpdates(()=>{y({type:W}),D(Hr.Uninitialized),ht(null),te(null),se(null),jt.current=null;const Ie=W===on.DragEnd?"onDragEnd":"onDragCancel";if(be){const Ce=de.current[Ie];Ce?.(be),S({type:Ie,event:be})}})}}},[v]),Ne=g.useCallback((Le,ft)=>(Ke,Dt)=>{const nt=Ke.nativeEvent,Qe=v.get(Dt);if(G.current!==null||!Qe||nt.dndKit||nt.defaultPrevented)return;const wt={active:Qe};Le(Ke,ft.options,wt)===!0&&(nt.dndKit={capturedBy:ft.sensor},G.current=Dt,ae(Ke,ft))},[v,ae]),ze=pW(p,Ne);yW(p),Or(()=>{Ve&&A===Hr.Initializing&&D(Hr.Initialized)},[Ve,A]),g.useEffect(()=>{const{onDragMove:Le}=de.current,{active:ft,activatorEvent:Ke,collisions:Dt,over:nt}=me.current;if(!ft||!Ke)return;const Qe={active:ft,activatorEvent:Ke,collisions:Dt,delta:{x:oe.x,y:oe.y},over:nt};da.unstable_batchedUpdates(()=>{Le?.(Qe),S({type:"onDragMove",event:Qe})})},[oe.x,oe.y]),g.useEffect(()=>{const{active:Le,activatorEvent:ft,collisions:Ke,droppableContainers:Dt,scrollAdjustedTranslate:nt}=me.current;if(!Le||G.current==null||!ft||!nt)return;const{onDragOver:Qe}=de.current,wt=Dt.get(Pe),Kt=wt&&wt.rect.current?{id:wt.id,rect:wt.rect.current,data:wt.data,disabled:wt.disabled}:null,W={active:Le,activatorEvent:ft,collisions:Ke,delta:{x:nt.x,y:nt.y},over:Kt};da.unstable_batchedUpdates(()=>{ht(Kt),Qe?.(W),S({type:"onDragOver",event:W})})},[Pe]),Or(()=>{me.current={activatorEvent:H,active:j,activeNode:Q,collisionRect:J,collisions:ue,droppableRects:L,draggableNodes:v,draggingNode:ie,draggingNodeRect:Ze,droppableContainers:C,over:qe,scrollableAncestors:St,scrollAdjustedTranslate:oe},k.current={initial:Ze,translated:J}},[j,Q,ue,J,v,ie,Ze,L,C,qe,St,oe]),lW({...fe,delta:R,draggingRect:J,pointerCoordinates:at,scrollableAncestors:St,scrollableAncestorRects:Ct});const je=g.useMemo(()=>({active:j,activeNode:Q,activeNodeRect:Ve,activatorEvent:H,collisions:ue,containerNodeRect:ge,dragOverlay:ve,draggableNodes:v,droppableContainers:C,droppableRects:L,over:qe,measureDroppableContainers:ke,scrollableAncestors:St,scrollableAncestorRects:Ct,measuringConfiguration:pe,measuringScheduled:Re,windowRect:Ht}),[j,Q,Ve,H,ue,ge,ve,v,C,L,qe,ke,St,Ct,pe,Re,Ht]),vt=g.useMemo(()=>({activatorEvent:H,activators:ze,active:j,activeNodeRect:Ve,ariaDescribedById:{draggable:O},dispatch:y,draggableNodes:v,over:qe,measureDroppableContainers:ke}),[H,ze,j,Ve,y,O,v,qe,ke]);return tt.createElement(bw.Provider,{value:w},tt.createElement(no.Provider,{value:vt},tt.createElement(Rw.Provider,{value:je},tt.createElement(_u.Provider,{value:kt},c)),tt.createElement(kW,{disabled:o?.restoreFocus===!1})),tt.createElement(LG,{...o,hiddenTextDescribedById:O}));function Qt(){const Le=$?.autoScrollEnabled===!1,ft=typeof u=="object"?u.enabled===!1:u===!1,Ke=N&&!Le&&!ft;return typeof u=="object"?{...u,enabled:Ke}:{enabled:Ke}}}),OW=g.createContext(null),wy="button",LW="Draggable";function FW(e){let{id:t,data:n,disabled:r=!1,attributes:a}=e;const s=Au(LW),{activators:i,activatorEvent:o,active:u,activeNodeRect:c,ariaDescribedById:p,draggableNodes:d,over:f}=g.useContext(no),{role:m=wy,roleDescription:b="draggable",tabIndex:E=0}=a??{},x=u?.id===t,y=g.useContext(x?_u:OW),[S,w]=vl(),[A,D]=vl(),N=TW(i,t),T=Ci(n);Or(()=>(d.set(t,{id:t,key:s,node:S,activatorNode:A,data:T}),()=>{const R=d.get(t);R&&R.key===s&&d.delete(t)}),[d,t]);const v=g.useMemo(()=>({role:m,tabIndex:E,"aria-disabled":r,"aria-pressed":x&&m===wy?!0:void 0,"aria-roledescription":b,"aria-describedby":p.draggable}),[r,m,E,x,b,p.draggable]);return{active:u,activatorEvent:o,activeNodeRect:c,attributes:v,isDragging:x,listeners:r?void 0:N,node:S,over:f,setNodeRef:w,setActivatorNodeRef:D,transform:y}}function MW(){return g.useContext(Rw)}const PW="Droppable",jW={timeout:25};function BW(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:a}=e;const s=Au(PW),{active:i,dispatch:o,over:u,measureDroppableContainers:c}=g.useContext(no),p=g.useRef({disabled:n}),d=g.useRef(!1),f=g.useRef(null),m=g.useRef(null),{disabled:b,updateMeasurementsFor:E,timeout:x}={...jW,...a},y=Ci(E??r),S=g.useCallback(()=>{if(!d.current){d.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{c(Array.isArray(y.current)?y.current:[y.current]),m.current=null},x)},[x]),w=Nu({callback:S,disabled:b||!i}),A=g.useCallback((v,R)=>{w&&(R&&(w.unobserve(R),d.current=!1),v&&w.observe(v))},[w]),[D,N]=vl(A),T=Ci(t);return g.useEffect(()=>{!w||!D.current||(w.disconnect(),d.current=!1,w.observe(D.current))},[D,w]),g.useEffect(()=>(o({type:on.RegisterDroppable,element:{id:r,key:s,disabled:n,node:D,rect:f,data:T}}),()=>o({type:on.UnregisterDroppable,key:s,id:r})),[r]),g.useEffect(()=>{n!==p.current.disabled&&(o({type:on.SetDroppableDisabled,id:r,key:s,disabled:n}),p.current.disabled=n)},[r,s,n,o]),{active:i,rect:f,isOver:u?.id===r,node:D,over:u,setNodeRef:N}}function UW(e){let{animation:t,children:n}=e;const[r,a]=g.useState(null),[s,i]=g.useState(null),o=wl(n);return!n&&!r&&o&&a(o),Or(()=>{if(!s)return;const u=r?.key,c=r?.props.id;if(u==null||c==null){a(null);return}Promise.resolve(t(c,s)).then(()=>{a(null)})},[t,r,s]),tt.createElement(tt.Fragment,null,n,r?g.cloneElement(r,{ref:i}):null)}const $W={x:0,y:0,scaleX:1,scaleY:1};function zW(e){let{children:t}=e;return tt.createElement(no.Provider,{value:Iw},tt.createElement(_u.Provider,{value:$W},t))}const HW={position:"fixed",touchAction:"none"},GW=e=>Sb(e)?"transform 250ms ease":void 0,WW=g.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:a,children:s,className:i,rect:o,style:u,transform:c,transition:p=GW}=e;if(!o)return null;const d=a?c:{...c,scaleX:1,scaleY:1},f={...HW,width:o.width,height:o.height,top:o.top,left:o.left,transform:us.Transform.toString(d),transformOrigin:a&&r?MG(r,o):void 0,transition:typeof p=="function"?p(r):p,...u};return tt.createElement(n,{className:i,style:f,ref:t},s)}),VW=e=>t=>{let{active:n,dragOverlay:r}=t;const a={},{styles:s,className:i}=e;if(s!=null&&s.active)for(const[o,u]of Object.entries(s.active))u!==void 0&&(a[o]=n.node.style.getPropertyValue(o),n.node.style.setProperty(o,u));if(s!=null&&s.dragOverlay)for(const[o,u]of Object.entries(s.dragOverlay))u!==void 0&&r.node.style.setProperty(o,u);return i!=null&&i.active&&n.node.classList.add(i.active),i!=null&&i.dragOverlay&&r.node.classList.add(i.dragOverlay),function(){for(const[u,c]of Object.entries(a))n.node.style.setProperty(u,c);i!=null&&i.active&&n.node.classList.remove(i.active)}},qW=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:us.Transform.toString(t)},{transform:us.Transform.toString(n)}]},YW={duration:250,easing:"ease",keyframes:qW,sideEffects:VW({styles:{active:{opacity:"0"}}})};function ZW(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:a}=e;return wu((s,i)=>{if(t===null)return;const o=n.get(s);if(!o)return;const u=o.node.current;if(!u)return;const c=kw(i);if(!c)return;const{transform:p}=Pn(i).getComputedStyle(i),d=xw(p);if(!d)return;const f=typeof t=="function"?t:KW(t);return Nw(u,a.draggable.measure),f({active:{id:s,data:o.data,node:u,rect:a.draggable.measure(u)},draggableNodes:n,dragOverlay:{node:i,rect:a.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:a,transform:d})})}function KW(e){const{duration:t,easing:n,sideEffects:r,keyframes:a}={...YW,...e};return s=>{let{active:i,dragOverlay:o,transform:u,...c}=s;if(!t)return;const p={x:o.rect.left-i.rect.left,y:o.rect.top-i.rect.top},d={scaleX:u.scaleX!==1?i.rect.width*u.scaleX/o.rect.width:1,scaleY:u.scaleY!==1?i.rect.height*u.scaleY/o.rect.height:1},f={x:u.x-p.x,y:u.y-p.y,...d},m=a({...c,active:i,dragOverlay:o,transform:{initial:u,final:f}}),[b]=m,E=m[m.length-1];if(JSON.stringify(b)===JSON.stringify(E))return;const x=r?.({active:i,dragOverlay:o,...c}),y=o.node.animate(m,{duration:t,easing:n,fill:"forwards"});return new Promise(S=>{y.onfinish=()=>{x?.(),S()}})}}let Ay=0;function XW(e){return g.useMemo(()=>{if(e!=null)return Ay++,Ay},[e])}const QW=tt.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:a,transition:s,modifiers:i,wrapperElement:o="div",className:u,zIndex:c=999}=e;const{activatorEvent:p,active:d,activeNodeRect:f,containerNodeRect:m,draggableNodes:b,droppableContainers:E,dragOverlay:x,over:y,measuringConfiguration:S,scrollableAncestors:w,scrollableAncestorRects:A,windowRect:D}=MW(),N=g.useContext(_u),T=XW(d?.id),v=Dw(i,{activatorEvent:p,active:d,activeNodeRect:f,containerNodeRect:m,draggingNodeRect:x.rect,over:y,overlayNodeRect:x.rect,scrollableAncestors:w,scrollableAncestorRects:A,transform:N,windowRect:D}),R=Cb(f),C=ZW({config:r,draggableNodes:b,droppableContainers:E,measuringConfiguration:S}),U=R?x.setRef:void 0;return tt.createElement(zW,null,tt.createElement(UW,{animation:C},d&&T?tt.createElement(WW,{key:T,id:d.id,ref:U,as:o,activatorEvent:p,adjustScale:t,className:u,transition:s,rect:R,style:{zIndex:c,...a},transform:v},n):null))}),JW=6e4,eV=10080*60*1e3,tV={P1:"error",P2:"warning",P3:"neutral"},nV={backlog:"bg-spur-text-faint",todo:"bg-spur-info",wip:"bg-spur-warning",testing:"bg-spur-accent",done:"bg-spur-success",blocked:"bg-spur-error",cancelled:"bg-spur-text-faint"};function rV(e,t){const n=new Date(e).getTime(),r=t-n,a=Math.floor(r/1e3);if(a<60)return"just now";const s=Math.floor(a/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);if(i<24)return`${i}h ago`;const o=Math.floor(i/24);return o<30?`${o}d ago`:`${Math.floor(o/30)}mo ago`}function Ow({task:e,onClick:t}){const{attributes:n,listeners:r,setNodeRef:a,transform:s,isDragging:i}=FW({id:e.wbs,data:{task:e}}),[o,u]=g.useState(Date.now());g.useEffect(()=>{const m=setInterval(()=>u(Date.now()),JW);return()=>clearInterval(m)},[]);const c=s?{transform:us.Transform.toString(s),zIndex:i?50:void 0}:void 0,{subtaskProgress:p}=hb(),d=p.get(e.wbs),f=e.updatedAt?o-new Date(e.updatedAt).getTime()>eV:!1;return l.jsx(Ki,{variant:"compact",asChild:!0,className:`bg-spur-surface-2 hover:bg-spur-surface-3 rounded-xl border border-spur-border hover:border-spur-accent/40 cursor-pointer transition-colors w-full text-left ${i?"opacity-30":""}`,children:l.jsx("button",{ref:a,type:"button",style:c,onClick:()=>t(e.wbs),...r,...n,"aria-roledescription":"draggable card",children:l.jsxs(Xi,{className:"p-3 gap-1",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-mono font-semibold text-spur-text",children:[l.jsx("span",{className:`h-1.5 w-1.5 rounded-full shrink-0 ${nV[e.status]??"bg-spur-text-faint"}`,"data-status":e.status,"aria-hidden":"true"}),e.wbs]}),e.priority&&l.jsx(Ot,{variant:tV[e.priority]??"outline",size:"xs",children:e.priority})]}),l.jsx("p",{className:"text-sm font-medium text-spur-text leading-snug line-clamp-2",children:e.name}),l.jsxs("div",{className:"flex gap-1 flex-wrap items-center",children:[d&&d.total>0&&l.jsxs("div",{className:"flex items-center gap-1.5","data-testid":"subtask-progress",title:"subtasks done/total",children:[l.jsx("div",{className:"h-1 flex-1 rounded-full bg-spur-border overflow-hidden",children:l.jsx("div",{className:"h-full bg-spur-success",style:{width:`${Math.round(d.done/d.total*100)}%`}})}),l.jsxs("span",{className:"text-[10px] font-mono text-spur-text-muted shrink-0",children:[d.done,"/",d.total]})]}),e.type&&e.type!=="task"&&l.jsx(Ot,{variant:"outline",size:"xs",children:e.type}),e.featureId&&l.jsx(Ot,{variant:"outline",size:"xs",children:e.featureId}),e.updatedAt&&l.jsx("span",{className:`text-xs font-mono ml-auto ${f?"text-spur-text-faint":"text-spur-text-muted"}`,title:e.updatedAt,children:rV(e.updatedAt,o)})]})]})})})}function aV({status:e,label:t,tasks:n,onCardClick:r,sortDir:a,onSortToggle:s}){const{setNodeRef:i,isOver:o}=BW({id:e,data:{status:e}});return l.jsxs("section",{ref:i,"aria-label":`${t} column`,className:`flex flex-col flex-1 min-w-[16rem] rounded-xl border transition-colors duration-200 ${o?"bg-spur-surface-2 border-spur-accent shadow-lg":"bg-spur-surface border-spur-border"}`,children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-spur-border shrink-0",children:[l.jsxs("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:[fb(e)," ",t]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(Ot,{variant:"ghost",size:"sm",children:n.length}),s&&l.jsx(Ge,{variant:"ghost",size:"xs",className:"px-1",onClick:s,"aria-label":`Sort ${t} by WBS`,title:`Sort ${t}: ${a==="asc"?"WBS ↓":a==="desc"?"WBS ↑":"none"}`,children:a==="asc"?"↓":a==="desc"?"↑":"⇅"})]})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto p-2 space-y-2 min-h-[4rem]",children:[n.map(u=>l.jsx(Ow,{task:u,onClick:r},u.wbs)),n.length===0&&l.jsx("div",{className:"flex items-center justify-center h-16 text-xs text-spur-text-muted italic",children:"No tasks"})]})]})}const sV=g.lazy(()=>Bv(()=>import("./TaskDetail.Dl2Eaj1w.js"),__vite__mapDeps([2,1]))),iV=rr,Lw="docs/tasks",Ny="spur:detail-width",oV=new Set(["blocked","cancelled"]);function lV(e,t){return t?e.filter(n=>!(t.status!==void 0&&!t.status.split(",").includes(n.status)||t.featureId&&!n.featureId?.toLowerCase().includes(t.featureId.toLowerCase())||t.parentWbs&&n.parentWbs!==t.parentWbs)):e}function Fw(e){const{onSelectTask:t,filters:n,folder:r,hiddenColumns:a,onConnectionChange:s,onSyncChange:i}=e,[o,u]=g.useState({}),[c,p]=g.useState(Lw),[d,f]=g.useState(null),[m,b]=g.useState(()=>{const ne=typeof window<"u"?Math.min(1728,window.innerWidth*.8):1728;if(typeof window>"u")return ne;try{const pe=Number.parseFloat(window.localStorage.getItem(Ny)??"");if(Number.isFinite(pe)&&pe>0)return Math.min(pe,window.innerWidth*.8)}catch{}return ne}),E=r??c,x=a??oV,y=g.useCallback(()=>sn.task.list({folder:E}),[E]),{tasks:S,loading:w,error:A,connected:D,lastSyncAt:N,setTasks:T,store:v}=hb(y),[R,C]=g.useState(null);g.useEffect(()=>{s?.(D)},[D,s]),g.useEffect(()=>{i?.(N)},[N,i]),g.useEffect(()=>{typeof sn.task.folders=="function"&&sn.task.folders({}).then(ne=>{const{data:pe,activeFolder:L}=ne,ke=L??pe?.[0]?.path;ke!==void 0&&p(ke)}).catch(()=>{})},[]),g.useEffect(()=>{document.documentElement.style.setProperty("--detail-w",`${m}px`)},[m]),g.useEffect(()=>{if(!d)return;const ne=pe=>{pe.key==="Escape"&&f(null)};return window.addEventListener("keydown",ne),()=>window.removeEventListener("keydown",ne)},[d]);const U=sr();g.useEffect(()=>{const ne=U.pathname.split("/"),pe=ne.indexOf("tasks"),L=pe>=0?ne[pe+1]:void 0;L&&/^\d{4}$/.test(L)&&f(L)},[U.pathname]);const k=my(_b,{activationConstraint:{distance:5}}),j=my(Ab),G=FG(k,j),$=lV(S,n),te=ne=>{u(pe=>{const L={...pe};return pe[ne]==="asc"?L[ne]="desc":pe[ne]==="desc"?delete L[ne]:L[ne]="asc",L})},H=ne=>{const pe=$.filter(ke=>ke.status===ne),L=o[ne]??"desc";return[...pe].sort((ke,Re)=>{const Q=ke.wbs.localeCompare(Re.wbs);return L==="asc"?Q:-Q})},se=ne=>S.find(pe=>pe.wbs===ne),de=ne=>{C(String(ne.active.id))},O=ne=>{C(null);const{active:pe,over:L}=ne;if(!L)return;const ke=String(pe.id),Re=String(L.id),Q=se(ke);if(!Q||Q.status===Re)return;const _e=[...S];T(fe=>fe.map(X=>X.wbs===ke?{...X,status:Re}:X)),sn.task.transition({wbs:ke,toStatus:Re}).catch(fe=>{T(_e);const X=fe instanceof Error?fe.message:"Transition failed";typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:X}}))})};return w?l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx(Ra,{size:"lg",className:"text-spur-accent"})}):A?l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsxs("div",{className:"text-center text-spur-text-muted",children:[l.jsx("p",{className:"text-lg font-semibold",children:"Failed to load tasks"}),l.jsx("p",{className:"text-sm",children:A.message})]})}):l.jsx(Wv.Provider,{value:v,children:l.jsxs(DW,{sensors:G,onDragStart:de,onDragEnd:O,children:[l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsx("div",{className:"flex gap-3 overflow-x-auto h-full p-4",children:iV.filter(ne=>!x.has(ne)).map(ne=>l.jsx(aV,{status:ne,label:ne,tasks:H(ne),onCardClick:pe=>{f(pe),t(pe)},sortDir:o[ne],onSortToggle:()=>te(ne)},ne))}),d&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button","aria-label":"Close task detail",className:"fixed inset-0 z-50 bg-black/40 border-0 p-0 cursor-default",onClick:()=>f(null)}),l.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Task detail",className:"fixed top-0 right-0 h-full z-50 bg-spur-surface border-l border-spur-border shadow-2xl flex",style:{width:"var(--detail-w)",minWidth:"36rem",maxWidth:"80vw"},children:[l.jsx(gl,{targetVar:"--detail-w",onResizeEnd:ne=>{const pe=Math.max(576,Math.min(ne,window.innerWidth*.8));b(pe);try{window.localStorage.setItem(Ny,String(pe))}catch{}},direction:"horizontal",invert:!0}),l.jsx("div",{className:"flex flex-col flex-1 overflow-hidden",children:l.jsx("div",{className:"flex-1 overflow-y-auto","data-testid":"detail-body",children:(()=>{const ne=S.find(pe=>pe.wbs===d);return ne?l.jsx(g.Suspense,{fallback:l.jsx("div",{className:"flex items-center justify-center h-32 text-spur-text-muted text-sm",children:"Loading detail..."}),children:l.jsx(sV,{task:ne,onClose:()=>f(null),onTransition:(pe,L)=>{T(ke=>ke.map(Re=>Re.wbs===pe?{...Re,status:L}:Re)),sn.task.transition({wbs:pe,toStatus:L}).catch(ke=>{const Re=ke instanceof Error?ke.message:"Transition failed";typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:Re}}))})}})}):null})()})})]})]})]}),l.jsx(QW,{dropAnimation:null,children:R?(()=>{const ne=se(R);return ne?l.jsx("div",{className:"opacity-90",children:l.jsx(Ow,{task:ne,onClick:()=>{}})}):null})():null})]})})}const Oc=[{id:"kanban",label:"Kanban",component:Fw}];function Mw(){const[e,t]=S_(),n=sr(),r=Ll(),a=g.useMemo(()=>{const u=n.pathname.split("/"),c=u.indexOf("tasks"),p=c>=0?u[c+1]:void 0;return p&&/^\d{4}$/.test(p)?p:e.get("selected")},[n.pathname,e]),s=g.useMemo(()=>{const u={},c=e.get("status"),p=e.get("feature"),d=e.get("parent"),f=e.get("assignee"),m=e.get("folder");return c!==null&&(u.status=c),p&&(u.featureId=p),d&&(u.parentWbs=d),f&&(u.assignee=f),m&&(u.folder=m),u},[e]);return{selected:a,filters:s,selectTask:u=>{const c=new URLSearchParams(e);c.delete("selected");const p=c.toString(),d=u?`/board/tasks/${u}`:"/board/tasks";r(`${d}${p?`?${p}`:""}`,{replace:!0})},setFilter:(u,c)=>{t(p=>{const d=new URLSearchParams(p);return u==="feature"&&d.delete("parent"),u==="parent"&&d.delete("feature"),c!==null?d.set(u,c):d.delete(u),d},{replace:!0})}}}function uV(e){const t=e.trim();return/^\d{4}$/.test(t)?{kind:"navigate",wbs:t}:t.includes(".")?{kind:"filter",key:"parent",value:t}:{kind:"filter",key:"feature",value:t}}function cV(){const{selectTask:e,setFilter:t,filters:n}=Mw(),[r,a]=g.useState(Lw),[s,i]=g.useState([]),[o,u]=g.useState("kanban"),[c,p]=g.useState(!1),[d,f]=g.useState(""),[m,b]=g.useState(!1),[E,x]=g.useState(void 0),y=n.folder??r,S=new Set(n.status===void 0?rr.filter(T=>T!=="blocked"&&T!=="cancelled"):n.status.split(",").filter(T=>rr.some(v=>v===T))),w=new Set(rr.filter(T=>!S.has(T)));g.useEffect(()=>{f(n.featureId??n.parentWbs??"")},[n.featureId,n.parentWbs]),g.useEffect(()=>{typeof sn.task.folders=="function"&&sn.task.folders({}).then(T=>{const{data:v,activeFolder:R}=T,C=R??v?.[0]?.path;v&&i(v),C!==void 0&&a(C)}).catch(()=>{})},[]);const A=T=>{const v=new Set(S);v.has(T)?v.delete(T):v.add(T),t("status",rr.filter(R=>v.has(R)).join(","))},D=T=>{T.preventDefault();const v=uV(d);if(v.kind==="navigate"){e(v.wbs),f("");return}t(v.key,v.value||null)},N=(Oc.find(T=>T.id===o)??Oc[0]).component;return l.jsxs("div",{className:"task-kanban flex flex-col h-full",children:[l.jsx("header",{className:"mx-auto w-full max-w-[1600px] shrink-0 px-4 pt-3",children:l.jsxs("div",{className:"flex flex-nowrap items-center justify-between gap-4 border-b border-base-content/10 pb-3",children:[l.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[l.jsx("span",{className:"text-2xl","aria-hidden":"true",children:"📋"}),l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl font-bold tracking-tight text-spur-text",children:"Tasks"}),l.jsx("p",{className:"text-xs text-spur-text-muted",children:"Task corpus, kanban lanes, and phase filters"}),l.jsxs("p",{className:"mt-1 inline-flex items-center gap-1.5 rounded-full border border-spur-border px-2 py-0.5 text-xs text-spur-text-muted font-mono",role:"status","data-testid":"tasks-live-chip",children:[l.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${m?"bg-spur-success":"bg-spur-error"}`,"aria-hidden":"true"}),"last sync ",E?new Date(E).toLocaleString():"—"]})]})]}),l.jsxs("div",{className:"flex min-w-0 flex-nowrap items-center gap-2 overflow-x-auto",children:[l.jsx(Xr,{variant:"ghost",size:"xs",className:"text-xs shrink-0 w-44",value:y,onChange:T=>t("folder",T.target.value),"aria-label":"Task phase folder",children:s.map(T=>l.jsx("option",{value:T.path,children:T.label?`${T.label} (${T.path})`:T.path},T.path))}),l.jsx("div",{className:"flex shrink-0 items-center gap-1",children:rr.map(T=>l.jsxs("label",{htmlFor:`tasks-status-${T}`,className:"flex items-center gap-1 cursor-pointer",children:[l.jsx(tb,{id:`tasks-status-${T}`,size:"xs",checked:!w.has(T),onChange:()=>A(T)}),l.jsxs("span",{className:"text-[10px] text-spur-text-muted",children:[fb(T)," ",T]})]},T))}),l.jsx("form",{onSubmit:D,className:"flex shrink-0 items-center",children:l.jsx(Ti,{"aria-label":"Filter by WBS or feature",type:"text",placeholder:"WBS or feature",variant:"bordered",size:"xs",className:"w-36",value:d,onChange:T=>f(T.target.value)})}),l.jsx(Ge,{variant:"primary",size:"sm",className:"shrink-0",onClick:()=>p(!0),children:"+ New Task"}),l.jsx("div",{className:"flex shrink-0 items-center gap-1 bg-base-300 p-1 rounded-xl",children:Oc.map(T=>l.jsx("button",{type:"button",className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-all ${o===T.id?"bg-primary text-primary-content font-bold shadow-sm":"text-base-content/70 hover:bg-base-content/10"}`,onClick:()=>u(T.id),children:T.label},T.id))})]})]})}),l.jsx("div",{"data-kanban-board":!0,className:"flex-1 overflow-hidden",children:l.jsx(N,{onSelectTask:e,filters:n,folder:y,hiddenColumns:w,onConnectionChange:b,onSyncChange:x})}),l.jsx(Hv,{open:c,onClose:()=>p(!1),onCreated:()=>{},folder:y})]})}function dV(e,t){sn.task.transition({wbs:e,toStatus:t}).catch(n=>{const r=n instanceof Error?n.message:"Transition failed";typeof window<"u"&&window.dispatchEvent(new CustomEvent("api-error",{detail:{message:r}}))})}function Pw(){const{filters:e,selectTask:t}=Mw();return l.jsx("div",{className:"task-kanban flex flex-col h-full",children:l.jsx("div",{"data-kanban-board":!0,className:"flex-1 overflow-hidden",children:l.jsx(Fw,{onSelectTask:t,filters:e})})})}const pV={id:"tasks",name:"Tasks",icon:"📋",route:"tasks",component:cV},fV=Object.freeze(Object.defineProperty({__proto__:null,TaskKanbanView:Pw,module:pV,transition:dV},Symbol.toStringTag,{value:"Module"}));function jw(e){const t=new Map;for(const n of e)for(const r of n.members)t.set(r.id,{teamId:n.teamId,memberLabel:r.id,agentType:r.type});return t}function Bw(e,t){if(e.teamId&&e.memberLabel&&e.agentType)return e;const n=e.memberLabel??e.actor;if(!n)return e;const r=t.get(n);return r?{...e,teamId:e.teamId??r.teamId,memberLabel:e.memberLabel??r.memberLabel,agentType:e.agentType??r.agentType}:e}const Rd=100;function Uw(e,t){const n=[t,...e??[]];return n.length>Rd&&(n.length=Rd),n}const $w=()=>`${Nt()}/events/history?limit=${Rd}`,zw=()=>`${Nt()}/events/planning`,mV=["agent.","message.","team.","supervisor.","process."];function hV(e){return mV.some(t=>e.startsWith(t))}function kb(e){if(e===null||typeof e!="object")return null;const t=e;if(typeof t.eventName!="string"||typeof t.occurredAt!="string"||!hV(t.eventName))return null;const n=t.payload!==null&&typeof t.payload=="object"?t.payload:null,r=n&&typeof n.teamId=="string"&&n.teamId.length>0?n.teamId:void 0,a=n&&typeof n.agentType=="string"&&n.agentType.length>0?n.agentType:void 0,s=n&&typeof n.memberLabel=="string"&&n.memberLabel.length>0?n.memberLabel:n&&typeof n.agentId=="string"&&n.agentId.length>0?n.agentId:void 0,i=typeof t.actor=="string"&&t.actor.length>0?t.actor:n&&typeof n.agentId=="string"&&n.agentId.length>0?n.agentId:null;return{id:typeof t.id=="string"?t.id:`${t.eventName}-${t.occurredAt}`,eventName:t.eventName,occurredAt:t.occurredAt,actor:i,...r?{teamId:r}:{},...s?{memberLabel:s}:{},...a?{agentType:a}:{}}}function Hw(e){if(e===null||typeof e!="object"||!("events"in e))return null;const t=e.events;if(!Array.isArray(t))return null;const n=[];for(const r of t){const a=kb(r);a&&n.push(a)}return n}function gV({teamId:e}){const[t,n]=g.useState(null),[r,a]=g.useState(null),{teams:s}=ws(),i=g.useMemo(()=>jw(s),[s]),o=g.useCallback(async()=>{try{const c=await Tt(new Request($w()));if(!c.ok)throw new Error(`events fetch failed: ${c.status}`);const p=Hw(await c.json());if(!p)throw new Error("events response failed schema validation");n(p)}catch(c){a(c instanceof Error?c.message:String(c))}},[]);g.useEffect(()=>{o()},[o]),g.useEffect(()=>{if(typeof EventSource>"u")return;const c=new EventSource(zw());return c.onmessage=p=>{try{const d=kb(JSON.parse(p.data));d&&n(f=>Uw(f,d))}catch{}},()=>c.close()},[]);const u=g.useMemo(()=>t===null?null:t.map(c=>Bw(c,i)).filter(c=>!e||c.teamId===e),[t,i,e]);return r?l.jsxs("div",{className:"p-4 text-sm text-error",role:"alert",children:["Failed to load activity: ",r]}):u===null?l.jsx("div",{className:"p-4 text-sm text-spur-text-muted",children:"Loading activity…"}):l.jsx("div",{className:"flex flex-col h-full overflow-y-auto","data-activity-tab":!0,children:u.length===0?l.jsx("div",{className:"p-4 text-sm text-spur-text-muted italic",children:"No team activity yet."}):l.jsxs("table",{className:"w-full text-xs",children:[l.jsx("thead",{className:"sticky top-0 bg-base-200",children:l.jsxs("tr",{className:"text-left text-spur-text-muted",children:[l.jsx("th",{className:"px-3 py-1 font-medium",children:"Time"}),l.jsx("th",{className:"px-3 py-1 font-medium",children:"Event"}),l.jsx("th",{className:"px-3 py-1 font-medium",children:"Team"}),l.jsx("th",{className:"px-3 py-1 font-medium",children:"Member"}),l.jsx("th",{className:"px-3 py-1 font-medium",children:"Agent"}),l.jsx("th",{className:"px-3 py-1 font-medium",children:"Actor"})]})}),l.jsx("tbody",{children:u.map(c=>l.jsxs("tr",{className:"border-t border-spur-border","data-activity-row":c.eventName,children:[l.jsx("td",{className:"px-3 py-1 font-mono text-spur-text-muted",children:c.occurredAt}),l.jsx("td",{className:"px-3 py-1 text-spur-text",children:c.eventName}),l.jsx("td",{className:"px-3 py-1 font-mono text-spur-text-muted",children:c.teamId??"—"}),l.jsx("td",{className:"px-3 py-1 text-spur-text-muted",children:c.memberLabel??"—"}),l.jsx("td",{className:"px-3 py-1 text-spur-text-muted",children:c.agentType??"—"}),l.jsx("td",{className:"px-3 py-1 text-spur-text-muted",children:c.actor??"system"})]},c.id))})]})})}const bV=3e3,EV=()=>`${Nt()}/team/processes`;function xV(e,t){const n=e.map(s=>({key:`sup:${s.agentId}`,label:s.agentId,agentId:s.agentId,pid:s.pid,status:s.status,startedAt:s.startedAt,source:"supervisor",teamId:s.teamId??null})),r=new Set(e.map(s=>s.agentId)),a=new Set(e.map(s=>s.pid).filter(s=>s!=null));for(const s of t)s.agentId&&r.has(s.agentId)||s.pid!=null&&a.has(s.pid)||n.push({key:`reg:${s.id}`,label:s.label||s.command,agentId:s.agentId??void 0,pid:s.pid,status:s.status,startedAt:s.startedAt,source:s.source,teamId:s.teamId??null});return n}function yV(e,t){return e.filter(n=>{if(t.runningOnly&&n.status!=="running")return!1;if(t.source==="other"){if(n.source==="supervisor"||n.source==="one-shot")return!1}else if(t.source!=="all"&&n.source!==t.source)return!1;if(t.team==="unassigned"){if(n.teamId!=null)return!1}else if(t.team!=="all"&&n.teamId!==t.team)return!1;return!0})}function _y({filters:e,onFilters:t,teamIds:n,totalCount:r,shownCount:a}){return l.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-2 text-xs","data-processes-filters":!0,children:[l.jsxs("label",{className:"flex items-center gap-1","data-processes-filter-running":!0,children:[l.jsx("input",{type:"checkbox",checked:e.runningOnly,onChange:s=>t({...e,runningOnly:s.target.checked}),"data-processes-filter-running-input":!0}),l.jsx("span",{children:"Running only"})]}),l.jsxs("label",{className:"flex items-center gap-1",children:[l.jsx("span",{children:"Source"}),l.jsxs("select",{value:e.source,onChange:s=>t({...e,source:s.target.value}),className:"border border-spur-border rounded px-1 py-0.5 bg-spur-bg text-spur-text","data-processes-filter-source":!0,"aria-label":"Source filter",children:[l.jsx("option",{value:"all",children:"all"}),l.jsx("option",{value:"supervisor",children:"supervisor"}),l.jsx("option",{value:"one-shot",children:"one-shot"}),l.jsx("option",{value:"other",children:"other"})]})]}),l.jsxs("label",{className:"flex items-center gap-1",children:[l.jsx("span",{children:"Team"}),l.jsxs("select",{value:e.team,onChange:s=>t({...e,team:s.target.value}),className:"border border-spur-border rounded px-1 py-0.5 bg-spur-bg text-spur-text","data-processes-filter-team":!0,"aria-label":"Team filter",children:[l.jsx("option",{value:"all",children:"all teams"}),l.jsx("option",{value:"unassigned",children:"unassigned"}),n.map(s=>l.jsx("option",{value:s,children:s},s))]})]}),l.jsx("button",{type:"button",className:"border border-spur-border rounded px-2 py-0.5 text-spur-text hover:bg-base-200 transition-colors cursor-pointer",onClick:()=>t({runningOnly:!1,source:"all",team:"all"}),"data-processes-filter-clear":!0,children:"Clear"}),l.jsxs("span",{className:"text-spur-text-muted","data-processes-filter-count":!0,children:[a,"/",r," shown"]})]})}function TV({teamId:e}){const[t,n]=g.useState(null),[r,a]=g.useState(null),[s,i]=g.useState({runningOnly:!1,source:"all",team:"all"}),o=g.useRef(!0),u=g.useCallback(async b=>{try{const E=await Tt(new Request(EV(),{signal:b}));if(!E.ok)throw new Error(`processes fetch failed: ${E.status}`);const y=await E.json();o.current&&(n({processes:y.processes??[],count:y.count??0,executions:y.executions??[],executionsCount:y.executionsCount??0}),a(null))}catch(E){if(b.aborted)return;o.current&&a(E instanceof Error?E.message:String(E))}},[]);g.useEffect(()=>{o.current=!0;let b=null;const E=()=>{b?.abort(),b=new AbortController,u(b.signal)};E();const x=setInterval(E,bV);return()=>{o.current=!1,b?.abort(),clearInterval(x)}},[u]);const c=g.useMemo(()=>t?xV(t.processes,t.executions):[],[t]),p=g.useMemo(()=>{const b=e?c.filter(E=>E.teamId===e):c;return yV(b,s)},[c,s,e]),d=g.useMemo(()=>{const b=new Set;for(const E of t?.processes??[])E.teamId&&b.add(E.teamId);for(const E of t?.executions??[])E.teamId&&b.add(E.teamId);return[...b].sort()},[t]);if(r&&(!t||c.length===0))return l.jsxs("div",{className:"p-4 text-sm text-error",role:"alert","data-processes-tab-error":!0,children:["Failed to load processes: ",r]});if(!t)return l.jsx("div",{className:"p-4","data-processes-tab-loading":!0,children:l.jsx(Ra,{size:"sm"})});if(c.length===0)return l.jsxs("div",{className:"p-4 text-sm text-spur-text-muted","data-processes-tab-empty":!0,children:["No processes. Start a team agent from the Terminal tab or via"," ",l.jsx("code",{className:"font-mono",children:"spur team start"}),"."]});if(p.length===0)return l.jsxs("div",{className:"p-3 overflow-auto h-full","data-processes-tab":!0,"data-processes-tab-filtered-empty":!0,children:[l.jsx(_y,{filters:s,onFilters:i,teamIds:d,totalCount:c.length,shownCount:0}),l.jsx("div",{className:"p-4 text-sm text-spur-text-muted","data-processes-tab-no-matches":!0,children:"No processes match the current filters. Adjust or clear filters to see rows."})]});const f=t.processes.length,m=Math.max(0,c.length-f);return l.jsxs("div",{className:"p-3 overflow-auto h-full","data-processes-tab":!0,children:[l.jsx(_y,{filters:s,onFilters:i,teamIds:d,totalCount:c.length,shownCount:p.length}),l.jsxs("div",{className:"flex items-center gap-2 mb-2 text-xs text-spur-text-muted",children:[l.jsxs("span",{"data-processes-header":!0,children:["Process watch list (",c.length,f>0||m>0?` · ${f} supervised${m>0?` · ${m} other`:""}`:"",")"]}),l.jsx("span",{className:"italic",children:"— ProcessExecutor registry (ts-runtime)"})]}),l.jsxs("table",{className:"table table-xs",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Name"}),l.jsx("th",{children:"Source"}),l.jsx("th",{children:"Team"}),l.jsx("th",{children:"PID"}),l.jsx("th",{children:"Status"}),l.jsx("th",{children:"Started"})]})}),l.jsx("tbody",{children:p.map(b=>{const E=b.status==="running";return l.jsxs("tr",{"data-processes-row":b.key,children:[l.jsx("td",{className:"font-mono text-xs",children:b.label}),l.jsx("td",{className:"text-xs text-spur-text-muted","data-process-source":b.source,children:b.source}),l.jsx("td",{className:"font-mono text-xs text-spur-text-muted","data-process-team":b.teamId??"",children:b.teamId??"—"}),l.jsx("td",{className:"font-mono text-xs text-spur-text-muted",children:b.pid??"—"}),l.jsx("td",{children:l.jsx(Ot,{variant:E?"success":"ghost",size:"xs",children:b.status})}),l.jsx("td",{className:"text-xs text-spur-text-muted",children:new Date(b.startedAt).toLocaleTimeString()})]},b.key)})})]})]})}const SV=e=>`${Nt()}/team/agents/${encodeURIComponent(e)}/start`,vV=e=>`${Nt()}/team/agents/${encodeURIComponent(e)}/stop`,wV=e=>`${Nt()}/team/${encodeURIComponent(e)}/up`,AV=e=>`${Nt()}/team/${encodeURIComponent(e)}/down`;function NV(e){if(e<0)return"-";const t=Math.floor(e/1e3),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),a=Math.floor(t%3600/60),s=t%60;return n>0?`${n}d ${r}h ${a}m`:r>0?`${r}h ${a}m`:a>0?`${a}m ${s}s`:`${s}s`}function Cy(e){try{return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}}function _V(e){const t=new Map;for(const n of e){if(!n.teamId||!n.memberLabel)continue;const r=`${n.teamId}:${n.memberLabel}`;let a=t.get(r);a||(a={startedAt:null,lastActivity:null},t.set(r,a)),n.eventName==="team.member.started"&&(!a.startedAt||n.occurredAt>a.startedAt)&&(a.startedAt=n.occurredAt),(!a.lastActivity||n.occurredAt>a.lastActivity.time)&&(a.lastActivity={time:n.occurredAt,eventName:n.eventName})}return t}function CV({teamId:e}){const{teams:t,error:n,reload:r}=ws(),[a,s]=g.useState(null),[i,o]=g.useState(null),[u,c]=g.useState(!1),[p,d]=g.useState(null),[f,m]=g.useState(null),[b,E]=g.useState(null),[x,y]=g.useState(()=>Date.now()),S=g.useMemo(()=>e?t.filter(v=>v.teamId===e):t,[t,e]),w=g.useMemo(()=>jw(S),[S]);g.useEffect(()=>{let v=!1;return(async()=>{try{const R=await Tt(new Request($w()));if(v)return;if(!R.ok)throw new Error(`events fetch failed: ${R.status}`);const C=Hw(await R.json());if(v)return;if(!C)throw new Error("events response failed schema validation");s(C)}catch(R){if(v)return;o(R instanceof Error?R.message:String(R))}})(),()=>{v=!0}},[]),g.useEffect(()=>{if(typeof EventSource>"u")return;const v=new EventSource(zw());return v.onmessage=R=>{try{const C=kb(JSON.parse(R.data));C&&s(U=>Uw(U,C))}catch{}},()=>v.close()},[]),g.useEffect(()=>{const v=setInterval(()=>y(Date.now()),1e3);return()=>clearInterval(v)},[]);const A=g.useMemo(()=>a===null?null:a.map(v=>Bw(v,w)).filter(v=>!e||v.teamId===e),[a,w,e]),D=g.useMemo(()=>A===null?new Map:_V(A),[A]),N=g.useCallback(async(v,R)=>{c(!0),d(null);try{const C=R?vV(v):SV(v),U=await Tt(new Request(C,{method:"POST"}));if(!U.ok){const k=await U.json().catch(()=>null),j=k&&typeof k=="object"&&"error"in k&&typeof k.error=="string"?k.error:`request failed (${U.status})`;d(j)}}catch(C){d(C instanceof Error?C.message:String(C))}finally{c(!1),r()}},[r]),T=g.useCallback(async(v,R)=>{c(!0),d(null);try{const C=R==="up"?wV(v):AV(v),U=await Tt(new Request(C,{method:"POST"}));if(!U.ok){const k=await U.json().catch(()=>null),j=k&&typeof k=="object"&&"error"in k&&typeof k.error=="string"?k.error:`request failed (${U.status})`;d(j)}}catch(C){d(C instanceof Error?C.message:String(C))}finally{c(!1),r()}},[r]);return l.jsxs("div",{className:"flex flex-col h-full overflow-y-auto","data-supervisor-tab":!0,children:[n&&S.length===0?l.jsxs("div",{className:"p-4 text-sm text-error",role:"alert","data-supervisor-tab-error":!0,children:["Failed to load teams: ",n,". Event-derived activity remains available below."]}):n&&l.jsxs("div",{className:"px-3 py-1 text-xs text-error bg-error/10 border-b border-error/30",role:"alert","data-supervisor-roster-error":!0,children:["Roster feed error: ",n,". Showing last-known state."]}),S.length===0&&!n&&l.jsx("div",{className:"p-4 text-sm text-spur-text-muted","data-supervisor-tab-loading":!0,children:"Loading teams…"}),p&&l.jsx("div",{className:"px-3 py-1 text-xs text-error",role:"alert","data-supervisor-action-error":!0,children:p}),i&&l.jsxs("div",{className:"px-3 py-1 text-xs text-warning",role:"alert","data-supervisor-event-error":!0,children:["Activity feed error: ",i,". Live updates may be delayed."]}),l.jsx("div",{className:"p-2 space-y-2",children:S.map(v=>l.jsx(Ki,{variant:"compact",className:"bg-base-200 border border-spur-border",children:l.jsxs(Xi,{className:"p-3 gap-2",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx("span",{className:"text-sm font-semibold text-spur-text",children:v.name}),l.jsx(Ot,{variant:"outline",size:"xs",children:v.teamId}),l.jsxs("span",{className:"text-[10px] text-spur-text-muted",children:[v.members.length," member(s)"]}),l.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[l.jsx(Ge,{type:"button",variant:"ghost",size:"xs",disabled:u,onClick:()=>{T(v.teamId,"up")},"data-supervisor-team-up":v.teamId,children:"Up"}),l.jsx(Ge,{type:"button",variant:"ghost",size:"xs",disabled:u,onClick:()=>E(v.teamId),"data-supervisor-team-down":v.teamId,children:"Down"})]})]}),v.members.length===0?l.jsx("div",{className:"text-xs text-spur-text-muted italic py-2","data-supervisor-empty-roster":v.teamId,children:"No members configured for this team."}):l.jsx("ul",{className:"space-y-1",children:v.members.map(R=>{const C=R.status==="running",U=`${v.teamId}:${R.id}`,k=D.get(U),j=C&&k?.startedAt?NV(x-Date.parse(k.startedAt)):"-",G=k?.lastActivity??null;return l.jsxs("li",{className:"text-xs flex items-center gap-2 flex-wrap py-1 border-b border-spur-border/50 last:border-b-0","data-supervisor-member-row":R.id,children:[l.jsx(Ot,{variant:C?"success":"ghost",size:"xs",children:R.status}),l.jsx("span",{className:"font-mono text-spur-text",children:R.id}),l.jsx(Ot,{variant:"outline",size:"xs",children:R.type}),l.jsx(Ot,{variant:R.role!==void 0?"accent":"ghost",size:"xs","data-supervisor-member-role":R.id,children:R.role??"unset"}),l.jsxs("span",{className:"text-[10px] text-spur-text-muted font-mono","data-supervisor-uptime":R.id,children:["up ",j]}),G?l.jsxs("span",{className:"text-[10px] text-spur-text-muted","data-supervisor-last-activity":R.id,children:["last: ",Cy(G.time)," (",G.eventName,")"]}):l.jsx("span",{className:"text-[10px] text-spur-text-muted","data-supervisor-last-activity":R.id,children:"last: -"}),l.jsx(Ge,{type:"button",variant:C?"ghost":"primary",size:"xs",disabled:u,className:"ml-auto",onClick:()=>{C?m(R.id):N(R.id,!1)},"data-supervisor-toggle":R.id,children:C?"Stop":"Start"})]},R.id)})})]})},v.teamId))}),A!==null&&l.jsxs("section",{className:"border-t border-spur-border bg-base-300/40","aria-label":"Recent team activity","data-supervisor-activity":!0,children:[l.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wide font-semibold text-spur-text-muted",children:"Recent team activity"}),A.length===0?l.jsx("div",{className:"px-3 pb-3 text-xs text-spur-text-muted italic",children:"No team activity yet."}):l.jsx("ul",{className:"px-3 pb-3 space-y-1",children:A.slice(0,20).map(v=>l.jsxs("li",{className:"flex items-center gap-2 flex-wrap text-[10px] text-spur-text-muted","data-supervisor-activity-row":v.eventName,children:[l.jsx("span",{className:"font-mono",children:Cy(v.occurredAt)}),l.jsx(Ot,{variant:"outline",size:"xs",children:v.eventName}),v.teamId&&l.jsx("span",{children:v.teamId}),v.memberLabel&&l.jsx("span",{className:"font-mono",children:v.memberLabel}),v.actor&&l.jsx("span",{children:v.actor})]},v.id))})]}),l.jsxs(ll,{open:f!==null,variant:"warning",onClose:()=>m(null),"data-stop-confirm-modal":!0,children:[l.jsx("h3",{className:"text-lg font-bold text-warning",children:"Stop member?"}),l.jsxs("p",{className:"py-3 text-sm text-spur-text",children:["Stopping ",l.jsx("span",{className:"font-mono",children:f})," will terminate its running process. Input to this member will be disabled until it is restarted."]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(Ge,{type:"button",variant:"ghost",size:"sm",onClick:()=>m(null),"data-stop-confirm-cancel":!0,children:"Cancel"}),l.jsx(Ge,{type:"button",variant:"warning",size:"sm",disabled:u,onClick:()=>{if(!f)return;const v=f;m(null),N(v,!0)},"data-stop-confirm-confirm":!0,children:"Stop"})]})]}),l.jsxs(ll,{open:b!==null,variant:"warning",onClose:()=>E(null),"data-down-confirm-modal":!0,children:[l.jsx("h3",{className:"text-lg font-bold text-warning",children:"Bring team down?"}),l.jsxs("p",{className:"py-3 text-sm text-spur-text",children:["This will stop all running members of ",l.jsx("span",{className:"font-mono",children:b}),"."]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(Ge,{type:"button",variant:"ghost",size:"sm",onClick:()=>E(null),"data-down-confirm-cancel":!0,children:"Cancel"}),l.jsx(Ge,{type:"button",variant:"warning",size:"sm",disabled:u,onClick:()=>{if(!b)return;const v=b;E(null),T(v,"down")},"data-down-confirm-confirm":!0,children:"Bring Down"})]})]})]})}const Ro=1e3,Lc=[1e3,2e3,4e3,8e3,15e3],kV=15e3;function IV(e){if(e===null||typeof e!="object")return null;const t=e;if(typeof t.stream!="string"||typeof t.ts!="string"||typeof t.line!="string")return null;const n=t.stream;if(n!=="stdout"&&n!=="stderr"&&n!=="meta")return null;const r=t.seq;return r!==void 0&&typeof r!="number"?null:{stream:n,ts:t.ts,line:t.line,...r!==void 0?{seq:r}:{}}}function RV(e){return e<0?Lc[0]:e>=Lc.length?kV:Lc[e]}function ky(e,t,n){if(t.seq===void 0){const a=[...e,t];return a.length>Ro&&a.splice(0,a.length-Ro),{frames:a,lastSeq:n}}if(t.seq<=n)return{frames:e,lastSeq:n};const r=[...e,t];return r.length>Ro&&r.splice(0,r.length-Ro),{frames:r,lastSeq:t.seq}}const DV=(e,t)=>t!==void 0?`${Nt()}/team/processes/${encodeURIComponent(e)}/stream?sinceSeq=${t}`:`${Nt()}/team/processes/${encodeURIComponent(e)}/stream`,OV=3e3;function LV(e){if(e===null||typeof e!="object")return null;const t=e;if(!Array.isArray(t.processes))return null;const n=[];for(const r of t.processes){if(r===null||typeof r!="object")return null;const a=r;if(typeof a.agentId!="string"||typeof a.status!="string"||typeof a.startedAt!="string"||typeof a.pid!="number")return null;const s=a.exitCode;if(s!==null&&typeof s!="number")return null;n.push({agentId:a.agentId,pid:a.pid,status:a.status,startedAt:a.startedAt,exitCode:s})}return n}const FV=e=>`${Nt()}/team/processes/${encodeURIComponent(e)}/stdin`,MV=()=>`${Nt()}/messages`,PV=()=>`${Nt()}/team/processes`;function jV({agentId:e}){const[t,n]=g.useState([]),[r,a]=g.useState("unknown"),[s,i]=g.useState(""),[o,u]=g.useState(null),[c,p]=g.useState(!1),d=g.useRef(-1),f=g.useRef(null),m=g.useRef(void 0),b=g.useRef(0),E=g.useRef(!0),x=g.useRef(null),y=g.useCallback(async N=>{try{const T=await Tt(new Request(PV(),{signal:N}));if(!T.ok)return;const v=await T.json(),R=LV(v);if(!R)return;const C=R.find(U=>U.agentId===e);C&&E.current&&a(C.status)}catch{}},[e]);g.useEffect(()=>{E.current=!0;let N=null;const T=()=>{N?.abort(),N=new AbortController,y(N.signal)};T();const v=setInterval(T,OV);return()=>{E.current=!1,N?.abort(),clearInterval(v)}},[y]);const S=g.useCallback(()=>{if(!E.current)return;const N=new EventSource(DV(e,d.current>-1?d.current:void 0));f.current=N,N.onmessage=T=>{try{const v=JSON.parse(T.data),R=IV(v);if(!R)return;n(C=>{const U=ky(C,R,d.current);return d.current=U.lastSeq,U.frames}),b.current=0,p(!0)}catch{}},N.onerror=()=>{if(N.close(),f.current=null,p(!1),!E.current)return;const T=RV(b.current);b.current+=1,m.current=setTimeout(S,T)}},[e]);g.useEffect(()=>(S(),()=>{E.current=!1,f.current?.close(),f.current=null,m.current&&clearTimeout(m.current)}),[S]),g.useEffect(()=>{x.current&&t.length>0&&(x.current.scrollTop=x.current.scrollHeight)},[t]);const w=g.useCallback(async()=>{const N=s;if(N.length===0)return;u(null);const T={stream:"meta",ts:new Date().toISOString(),line:`> ${N}`};n(v=>ky(v,T,d.current).frames);try{const v=await Tt(new Request(FV(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({line:N})}));if(Tt(new Request(MV(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:"terminal",to:e,body:N})})).catch(()=>{}),!v.ok){const C=(await v.json().catch(()=>null))?.error??`stdin POST failed: ${v.status}`;u(C);return}i("")}catch(v){u(v instanceof Error?v.message:String(v))}},[e,s]),A=r==="running",D=N=>{N.key==="Enter"&&A&&(N.preventDefault(),w())};return l.jsxs("div",{className:"flex flex-col h-full overflow-hidden","data-member-terminal":e,children:[l.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-base-200 shrink-0 flex items-center gap-2",children:[l.jsx("span",{className:"text-xs font-semibold text-spur-text uppercase tracking-wide",children:"Terminal"}),l.jsx("span",{className:"font-mono text-xs text-spur-text-muted",children:e}),l.jsx(Ot,{variant:A?"success":"ghost",size:"xs","data-terminal-status":!0,children:r}),l.jsx("span",{className:"text-[10px] text-spur-text-muted","data-terminal-connected":!0,children:c?"connected":"reconnecting…"})]}),!A&&l.jsxs("div",{className:"px-4 py-1 text-xs text-warning border-b border-spur-border",role:"status","data-status-banner":!0,children:["Member is ",r," — input disabled."]}),l.jsx("pre",{ref:x,className:"flex-1 overflow-y-auto p-2 text-xs font-mono leading-snug bg-base-100","data-terminal-output":!0,children:t.length===0?l.jsxs("span",{className:"text-spur-text-muted italic",children:["Waiting for output from ",e,"…"]}):t.map((N,T)=>l.jsx("div",{className:N.stream==="stderr"?"text-error":N.stream==="meta"?"text-spur-text-muted italic":"text-spur-text","data-stream":N.stream,children:N.line},N.seq??`meta-${T}`))}),o&&l.jsx("div",{className:"px-4 py-1 text-xs text-error border-t border-spur-border",role:"alert","data-input-error":!0,children:o}),l.jsx("div",{className:"flex items-center gap-2 px-2 py-2 border-t border-spur-border bg-base-200 shrink-0",children:l.jsx("input",{type:"text",value:s,onChange:N=>i(N.target.value),onKeyDown:D,disabled:!A,placeholder:A?"Type a line and press Enter…":"Input disabled (member not running)",className:"flex-1 input input-sm font-mono","data-terminal-input":!0})})]})}const BV=e=>`${Nt()}/team/agents/${encodeURIComponent(e)}/start`,UV=e=>`${Nt()}/team/agents/${encodeURIComponent(e)}/stop`,$V=e=>`${Nt()}/team/${encodeURIComponent(e)}/up`,zV=e=>`${Nt()}/team/${encodeURIComponent(e)}/down`,Ib="spur:board:teams:lastTerminal";function HV(){try{const e=globalThis.localStorage?.getItem(Ib);if(!e)return null;const t=JSON.parse(e);if(t&&typeof t=="object"&&"teamId"in t&&"memberId"in t&&typeof t.teamId=="string"&&typeof t.memberId=="string"){const n=t;return{teamId:n.teamId,memberId:n.memberId}}}catch{}return null}function GV(e){try{globalThis.localStorage?.setItem(Ib,JSON.stringify(e))}catch{}}function WV(){try{globalThis.localStorage?.removeItem(Ib)}catch{}}function VV({teamId:e}){const{teams:t,error:n,reload:r}=ws(),[a,s]=g.useState(""),[i,o]=g.useState(""),[u,c]=g.useState(null),[p,d]=g.useState(null),[f,m]=g.useState(null),[b,E]=g.useState(!1),[x]=g.useState({done:!1}),y=g.useMemo(()=>e?t.filter(R=>R.teamId===e):t,[t,e]),S=e??a;g.useEffect(()=>{if(x.done||y.length===0)return;x.done=!0;const R=HV();if(!R)return;const C=y.find(k=>k.teamId===R.teamId),U=C?.members.find(k=>k.id===R.memberId);if(!C||!U){WV();return}s(R.teamId),o(R.memberId)},[y,x]);const w=y.find(R=>R.teamId===S),A=w?.members.find(R=>R.id===i)??null;g.useEffect(()=>{i&&w&&!w.members.some(R=>R.id===i)&&o("")},[i,w]),g.useEffect(()=>{S&&i&&GV({teamId:S,memberId:i})},[S,i]);const D=g.useCallback(async(R,C)=>{E(!0);try{const U=C?UV(R):BV(R),k=await Tt(new Request(U,{method:"POST"}));if(!k.ok){const j=await k.json().catch(()=>null),G=j&&typeof j=="object"&&"error"in j&&typeof j.error=="string"?j.error:`request failed (${k.status})`;c(G)}}catch(U){c(U instanceof Error?U.message:String(U))}finally{E(!1),r()}},[r]),N=g.useCallback(async(R,C)=>{E(!0),c(null);try{const U=C==="up"?$V(R):zV(R),k=await Tt(new Request(U,{method:"POST"}));if(!k.ok){const j=await k.json().catch(()=>null),G=j&&typeof j=="object"&&"error"in j&&typeof j.error=="string"?j.error:`request failed (${k.status})`;c(G)}}catch(U){c(U instanceof Error?U.message:String(U))}finally{E(!1),r()}},[r]),T=g.useCallback(R=>{o(R)},[]);if(n&&y.length===0)return l.jsxs("div",{className:"p-4 text-sm text-error",role:"alert","data-terminal-tab-error":!0,children:["Failed to load teams: ",n]});if(y.length===0)return l.jsxs("div",{className:"p-4 text-sm text-spur-text-muted","data-terminal-tab-empty":!0,children:["No teams defined in ",l.jsx("code",{className:"font-mono",children:".spur/config.yaml"}),". Configure"," ",l.jsx("code",{className:"font-mono",children:"agent.team"})," entries to open a terminal."]});const v=A?.status==="running";return l.jsxs("div",{className:"flex flex-col h-full overflow-hidden","data-terminal-tab":!0,children:[l.jsxs("div",{className:"px-3 py-2 border-b border-spur-border bg-base-200 shrink-0 flex items-center justify-between","data-terminal-toolbar":!0,children:[l.jsxs("div",{className:"flex items-center gap-2","data-terminal-focus":!0,children:[l.jsxs("label",{className:"flex items-center gap-1 text-xs",htmlFor:"terminal-team-select",children:[l.jsx("span",{className:"text-spur-text-muted",children:"Team"}),l.jsxs(Xr,{id:"terminal-team-select",variant:"bordered",size:"sm",disabled:!!e,value:S,onChange:R=>{s(R.target.value),o("")},"data-terminal-team-select":!0,children:[!e&&l.jsx("option",{value:"",children:"Select team…"}),y.map(R=>l.jsx("option",{value:R.teamId,children:R.name},R.teamId))]})]}),l.jsxs("label",{className:"flex items-center gap-1 text-xs",htmlFor:"terminal-member-select",children:[l.jsx("span",{className:"text-spur-text-muted",children:"Member"}),l.jsxs(Xr,{id:"terminal-member-select",variant:"bordered",size:"sm",value:i,onChange:R=>o(R.target.value),disabled:!w,"data-terminal-member-select":!0,children:[l.jsx("option",{value:"",children:"Select member…"}),w?.members.map(R=>l.jsxs("option",{value:R.id,children:[R.id," · ",R.type]},R.id))]})]}),A?.model?l.jsx("span",{className:"text-xs text-spur-text-muted font-mono","data-terminal-model":!0,children:A.model}):null,A&&l.jsxs(l.Fragment,{children:[l.jsx(Ot,{variant:v?"success":"ghost",size:"xs","data-terminal-status-badge":!0,children:A.status}),l.jsx(Ge,{type:"button",variant:v?"warning":"primary",size:"xs",disabled:b,onClick:()=>{v?d(A.id):D(A.id,!1)},"data-terminal-toggle-btn":!0,children:v?"Stop":"Start"})]})]}),l.jsxs("div",{className:"flex items-center gap-2","data-terminal-roster":!0,children:[w?.members.map(R=>l.jsx("button",{type:"button",title:`${R.id} · ${R.type}`,onClick:()=>T(R.id),className:"cursor-pointer p-0 bg-transparent border-0","data-terminal-roster-chip":!0,children:l.jsx(Ot,{variant:R.id===i?"accent":R.status==="running"?"success":"ghost",size:"xs",children:R.id})},R.id)),l.jsx("div",{className:"border-l border-spur-border mx-1 h-5","aria-hidden":"true"}),l.jsx(Ge,{type:"button",variant:"ghost",size:"xs",disabled:b||!w,onClick:()=>w&&N(w.teamId,"up"),"data-terminal-up-btn":!0,children:"Up"}),l.jsx(Ge,{type:"button",variant:"ghost",size:"xs",disabled:b||!w,onClick:()=>w&&m(w.teamId),"data-terminal-down-btn":!0,children:"Down"})]})]}),u&&l.jsx("div",{className:"px-3 py-1 text-xs text-error",role:"alert","data-terminal-tab-action-error":!0,children:u}),i&&A?l.jsx(jV,{agentId:i}):l.jsx("div",{className:"p-4 text-sm text-spur-text-muted italic","data-terminal-tab-prompt":!0,children:"Choose a team and member above to open a terminal."}),l.jsxs(ll,{open:p!==null,variant:"warning",onClose:()=>d(null),"data-stop-confirm-modal":!0,children:[l.jsx("h3",{className:"text-lg font-bold text-warning",children:"Stop member?"}),l.jsxs("p",{className:"py-3 text-sm text-spur-text",children:["Stopping ",l.jsx("span",{className:"font-mono",children:p})," will terminate its running process. Input to this member will be disabled until it is restarted."]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(Ge,{type:"button",variant:"ghost",size:"sm",onClick:()=>d(null),"data-stop-confirm-cancel":!0,children:"Cancel"}),l.jsx(Ge,{type:"button",variant:"warning",size:"sm",disabled:b,onClick:()=>{if(!p)return;const R=p;d(null),D(R,!0)},"data-stop-confirm-confirm":!0,children:"Stop"})]})]}),l.jsxs(ll,{open:f!==null,variant:"warning",onClose:()=>m(null),"data-down-confirm-modal":!0,children:[l.jsx("h3",{className:"text-lg font-bold text-warning",children:"Bring team down?"}),l.jsxs("p",{className:"py-3 text-sm text-spur-text",children:["This will stop all running members of ",l.jsx("span",{className:"font-mono",children:f}),"."]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(Ge,{type:"button",variant:"ghost",size:"sm",onClick:()=>m(null),"data-down-confirm-cancel":!0,children:"Cancel"}),l.jsx(Ge,{type:"button",variant:"warning",size:"sm",disabled:b,onClick:()=>{if(!f)return;const R=f;m(null),N(R,"down")},"data-down-confirm-confirm":!0,children:"Bring Down"})]})]})]})}const Iy=[{id:"supervisor",label:"Supervisor",component:CV},{id:"terminal",label:"Terminal",component:VV},{id:"processes",label:"Process",component:TV},{id:"activity",label:"Activity",component:gV}];function Gw({teamId:e}){const[t,n]=g.useState("supervisor"),a=Iy.find(s=>s.id===t)?.component;return l.jsxs("div",{className:"flex flex-col h-full overflow-hidden","data-teams-shell":!0,children:[l.jsx("div",{role:"tablist","aria-label":"Teams tabs",className:"flex items-center gap-1 px-2 py-1 border-b border-spur-border bg-base-200 shrink-0",children:Iy.map(s=>{const i=s.id===t;return l.jsx("button",{type:"button",role:"tab","aria-selected":i,"aria-controls":`teams-tab-panel-${s.id}`,id:`teams-tab-${s.id}`,onClick:()=>n(s.id),className:`px-3 py-1 rounded text-xs font-medium transition-colors ${i?"bg-spur-accent text-white":"text-spur-text-muted hover:text-spur-text hover:bg-base-300"}`,children:s.label},s.id)})}),l.jsx("div",{role:"tabpanel",id:`teams-tab-panel-${t}`,"aria-labelledby":`teams-tab-${t}`,className:"flex-1 overflow-hidden",children:a?l.jsx(a,{teamId:e}):null})]})}const qV={id:"teams",name:"Teams",icon:"👥",route:"teams",component:Gw,sidebarLabel:"Teams",order:2},YV=Object.freeze(Object.defineProperty({__proto__:null,module:qV},Symbol.toStringTag,{value:"Module"}));function ZV(e){try{return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}}function KV({teamId:e}){const{teams:t}=ws(),n=e?t.find(r=>r.teamId===e):t.find(r=>r.isCurrentProject);return n?l.jsxs("div",{className:"flex flex-col h-full overflow-y-auto bg-spur-bg","data-workspace-overview":!0,children:[l.jsxs("div",{className:"px-4 py-3 border-b border-spur-border bg-spur-surface",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx("span",{className:"text-sm font-semibold text-spur-text","data-workspace-overview-name":!0,children:n.name}),l.jsx(Ot,{variant:"outline",size:"xs",children:n.teamId}),l.jsx(Ot,{variant:n.isCurrentProject?"success":"ghost",size:"xs",children:"current project"})]}),n.workDir&&l.jsx("div",{className:"mt-1 font-mono text-xs text-spur-text-muted","data-workspace-overview-workdir":!0,children:n.workDir})]}),l.jsxs("div",{className:"p-3",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-wide font-semibold text-spur-text-muted mb-2",children:"Members"}),n.members.length===0?l.jsx("div",{className:"text-xs text-spur-text-muted italic","data-workspace-overview-no-members":!0,children:"No members materialized for this team yet."}):l.jsx("ul",{className:"space-y-1",children:n.members.map(r=>l.jsxs("li",{className:"text-xs flex items-center gap-2 py-1 border-b border-spur-border/50 last:border-b-0","data-workspace-overview-member":r.id,children:[l.jsx(Ot,{variant:r.status==="running"?"success":"ghost",size:"xs",children:r.status}),l.jsx("span",{className:"font-mono text-spur-text",children:r.id}),l.jsx(Ot,{variant:"outline",size:"xs",children:r.type}),r.model&&l.jsx("span",{className:"font-mono text-[10px] text-spur-text-muted",children:r.model})]},r.id))}),l.jsxs("div",{className:"mt-3 text-[10px] text-spur-text-faint",children:["Last refresh: ",ZV(new Date().toISOString())]})]})]}):l.jsx("div",{className:"p-4 text-sm text-spur-text-muted","data-workspace-overview-empty":!0,children:"No team selected for this workspace."})}const Ry=[{id:"overview",label:"Overview",component:KV},{id:"team",label:"Team",component:Gw},{id:"inbox",label:"Inbox",component:lw},{id:"tasks",label:"Tasks",component:Pw}];function XV(){const{teams:e}=ws(),t=g.useMemo(()=>e.filter(c=>c.isCurrentProject),[e]),[n,r]=g.useState(""),[a,s]=g.useState("overview");g.useEffect(()=>{!n&&t.length>0&&r(t[0]?.teamId??"")},[t,n]);const i=t.find(c=>c.teamId===n)??null,u=Ry.find(c=>c.id===a)?.component;return t.length===0?l.jsxs("div",{className:"workspace flex flex-col h-full items-center justify-center gap-3 p-6 bg-spur-bg","data-workspace-empty":!0,children:[l.jsx("div",{className:"text-sm font-semibold text-spur-text",children:"No project-local team"}),l.jsxs("p",{className:"text-xs text-spur-text-muted max-w-sm text-center",children:["No configured team resolves to this project's working directory. Add an"," ",l.jsx("code",{className:"font-mono",children:"agent.team"})," entry in"," ",l.jsx("code",{className:"font-mono",children:".spur/config.yaml"})," whose"," ",l.jsx("code",{className:"font-mono",children:"work_dir"})," points at the current project to compose a Workspace."]})]}):l.jsxs("div",{className:"workspace flex flex-col h-full overflow-hidden bg-spur-bg","data-workspace-shell":!0,children:[l.jsxs("div",{className:"px-4 py-2 border-b border-spur-border bg-spur-surface shrink-0 flex items-center gap-2",children:[l.jsx("span",{className:"text-xs font-semibold text-spur-text-muted uppercase tracking-wide",children:"Workspace"}),l.jsx("select",{value:i?.teamId??"",onChange:c=>{r(c.target.value),s("overview")},"aria-label":"Workspace team","data-workspace-team-select":!0,className:"border border-spur-border rounded px-1 py-0.5 bg-spur-bg text-spur-text text-xs",children:t.map(c=>l.jsx("option",{value:c.teamId,children:c.name},c.teamId))})]}),l.jsx("div",{role:"tablist","aria-label":"Workspace tabs",className:"flex items-center gap-1 px-2 py-1 border-b border-spur-border bg-spur-surface shrink-0",children:Ry.map(c=>{const p=c.id===a;return l.jsx("button",{type:"button",role:"tab","aria-selected":p,"aria-controls":`workspace-tab-panel-${c.id}`,id:`workspace-tab-${c.id}`,onClick:()=>s(c.id),className:`px-3 py-1 rounded-lg text-xs font-medium transition-colors ${p?"bg-spur-accent text-white":"text-spur-text-muted hover:text-spur-text hover:bg-spur-surface-3"}`,"data-workspace-tab":!0,children:c.label},c.id)})}),l.jsx("div",{role:"tabpanel",id:`workspace-tab-panel-${a}`,"aria-labelledby":`workspace-tab-${a}`,className:"flex-1 overflow-hidden",children:u?l.jsx(u,{teamId:i?.teamId}):null})]})}const QV={id:"workspace",name:"Workspace",icon:"🧩",route:"workspace",component:XV,sidebarLabel:"Workspace",order:0},JV=Object.freeze(Object.defineProperty({__proto__:null,module:QV},Symbol.toStringTag,{value:"Module"}));function Ww(e){return e===null||typeof e!="object"?null:"module"in e&&Dy(e.module)?e.module:"default"in e&&Dy(e.default)?e.default:null}function Dy(e){return e===null||typeof e!="object"?!1:"id"in e&&typeof e.id=="string"&&"name"in e&&typeof e.name=="string"&&"icon"in e&&typeof e.icon=="string"&&"route"in e&&typeof e.route=="string"&&"component"in e&&typeof e.component=="function"}function Vw(e,t){const n=typeof e.order=="number",r=typeof t.order=="number";return n&&r?e.order-t.order:n?-1:r?1:0}function eq(e){const t=[],n=e("./*/index.{ts,tsx}",{eager:!0});for(const r of Object.values(n)){const a=Ww(r);a&&t.push(a)}return t.sort((r,a)=>r.id.localeCompare(a.id)),t.sort(Vw),t}function tq(){try{return eq(()=>Object.assign({"./features/index.tsx":zz,"./history/index.tsx":mH,"./inbox/index.tsx":IH,"./observability/index.tsx":TG,"./task-kanban/index.tsx":fV,"./teams/index.tsx":YV,"./workspace/index.tsx":JV}))}catch(a){if(typeof require!="function")throw a}const e=require("node:fs"),t=require("node:path"),n=require("node:url"),r=typeof __dirname<"u"?__dirname:t.dirname(n.fileURLToPath(import.meta.url));return nq(r,{readdirSync:(a,s)=>e.readdirSync(a,s),tryRequire:a=>require(a)})}function nq(e,t){const n=require("node:path"),r=[];let a=[];try{a=t.readdirSync(e,{withFileTypes:!0})}catch{return r}const s=a.filter(i=>i.isDirectory()).map(i=>i.name).sort((i,o)=>i.localeCompare(o));for(const i of s)for(const o of["tsx","ts"]){const u=n.join(e,i,`index.${o}`);try{const c=t.tryRequire(u),p=Ww(c);if(p){r.push(p);break}}catch{}}return r.sort(Vw),r}function rq(e,t){const n=new Set(t?.disabled??[]),r=e.slice(),a=new Set(n);function s(){return r.filter(i=>!a.has(i.id))}return aq(r),{get modules(){return s()},getModule(i){return s().find(o=>o.id===i)},get defaultModule(){return s()[0]},disableModule(i){a.add(i)},enableModule(i){a.delete(i)},getEnabledModules(){return s().map(i=>i.id)},registerModuleRoot(i){}}}function aq(e){const t=new Map,n=new Map;for(const r of e){const a=t.get(r.id);if(a!==void 0)throw new Error(`Duplicate module id "${r.id}" discovered in two sources: ${a} and ${Do(r)}`);t.set(r.id,Do(r));const s=n.get(r.route);if(s!==void 0)throw new Error(`Duplicate module route "${r.route}" discovered in two sources: ${s} and ${Do(r)}`);n.set(r.route,Do(r))}}function Do(e){return e.id}const Rb=rq(tq(),{disabled:nP}),qw=Rb.modules;function sq(e){return Rb.getModule(e)}const Oo=Rb.defaultModule;function iq(){const[e,t]=g.useState([]);return g.useEffect(()=>{if(typeof window>"u")return;const n=r=>{const s=r.detail?.message||"An error occurred",i=`${Date.now()}-${Math.random().toString(36).slice(2,7)}`;t(o=>[...o,{id:i,message:s}]),setTimeout(()=>{t(o=>o.filter(u=>u.id!==i))},5e3)};return window.addEventListener("api-error",n),()=>{window.removeEventListener("api-error",n)}},[]),e.length===0?null:l.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-2 max-w-md w-full px-4 pointer-events-none",children:e.map(n=>l.jsxs("div",{className:"pointer-events-auto flex items-center justify-between gap-3 p-3 bg-red-950/90 border border-red-500/40 text-red-200 text-sm rounded-md shadow-lg backdrop-blur",role:"alert",children:[l.jsx("span",{className:"flex-1 break-words",children:n.message}),l.jsx("button",{type:"button",className:"text-red-400 hover:text-red-100 text-base font-bold leading-none px-1",onClick:()=>t(r=>r.filter(a=>a.id!==n.id)),"aria-label":"Close error toast",children:"×"})]},n.id))})}function oq({currentName:e}){const[t,n]=g.useState(!1),[r,a]=g.useState([]),[s,i]=g.useState(null),[o,u]=g.useState(null),c=g.useRef(null);g.useEffect(()=>{if(!t)return;const d=new AbortController;return Tt(new Request(`${Nt()}/projects`,{signal:d.signal})).then(async f=>{if(!f.ok)return;const m=await f.json();a(m.projects??[])}).catch(()=>{u("Failed to load projects")}),()=>d.abort()},[t]),g.useEffect(()=>{if(!t)return;const d=m=>{m.key==="Escape"&&n(!1)},f=m=>{c.current&&!c.current.contains(m.target)&&n(!1)};return document.addEventListener("keydown",d),document.addEventListener("mousedown",f),()=>{document.removeEventListener("keydown",d),document.removeEventListener("mousedown",f)}},[t]);const p=async d=>{if(d.current){n(!1);return}if(d.running&&d.port>0){window.location.href=`http://localhost:${d.port}/board`;return}i(d.name);try{const f=await Tt(new Request(`${Nt()}/projects/start`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:d.name,path:d.path})}));if(!f.ok)throw new Error("Failed to start project");const m=await f.json();window.location.href=m.url||`http://localhost:${m.port}/board`}catch(f){u(f instanceof Error?f.message:"Start failed"),i(null)}};return l.jsxs("div",{className:"relative min-w-0 flex-1",ref:c,children:[l.jsxs("button",{type:"button",onClick:()=>n(d=>!d),"aria-haspopup":"listbox","aria-expanded":t,"aria-label":"Switch project",title:e,"data-testid":"project-switcher-trigger",className:"flex w-full items-center justify-between gap-1 rounded-md px-1.5 py-1 text-left text-sm font-semibold text-spur-text hover:bg-spur-border/30 focus-visible:outline focus-visible:outline-2 focus-visible:outline-spur-accent",children:[l.jsx("span",{className:"font-semibold truncate",children:e}),l.jsx("svg",{className:`h-4 w-4 shrink-0 transition-transform ${t?"rotate-180":""}`,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),t&&l.jsxs("div",{role:"listbox","aria-label":"Registered projects","data-testid":"project-switcher-menu",className:"absolute left-0 top-full z-50 mt-1 w-64 rounded-md border border-spur-border bg-spur-surface p-1 shadow-lg",children:[l.jsx("div",{className:"px-2 py-1 text-xs font-medium text-spur-text-muted border-b border-spur-border/50 mb-1",children:"Projects"}),r.length===0?l.jsx("div",{className:"px-2 py-1.5 text-xs text-spur-text-muted",children:o||"No projects registered"}):r.map(d=>l.jsxs("button",{type:"button",role:"option","aria-selected":d.current,disabled:s===d.name,onClick:()=>p(d),"data-testid":`project-item-${d.name}`,className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-xs text-left transition-colors ${d.current?"bg-spur-accent/15 text-spur-accent font-medium":"text-spur-text hover:bg-spur-border/30"}`,children:[l.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[l.jsx("span",{className:`h-2 w-2 rounded-full shrink-0 ${d.running?"bg-green-500":"bg-gray-400"}`,title:d.running?`Running on port ${d.port}`:"Stopped"}),l.jsx("span",{className:"truncate",children:d.name})]}),s===d.name?l.jsx("span",{className:"text-[10px] text-spur-accent animate-pulse",children:"Starting..."}):d.current?l.jsx("span",{className:"text-[10px] font-semibold text-spur-accent",children:"current"}):d.running?l.jsxs("span",{className:"text-[10px] text-spur-text-muted",children:[":",d.port]}):l.jsx("span",{className:"text-[10px] text-spur-text-muted",children:"stopped"})]},d.path))]})]})}const Yw="spur-theme";function lq(){try{const e=localStorage.getItem(Yw);if(e==="light"||e==="dark")return e}catch{}return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function uq(e){document.documentElement.setAttribute("data-theme",e);try{localStorage.setItem(Yw,e)}catch{}}function cq(e){const t=e==="dark"?"light":"dark";return uq(t),t}function dq(){const[e,t]=g.useState(lq);g.useEffect(()=>{const r=window.matchMedia("(prefers-color-scheme: dark)"),a=s=>{if(!(()=>{try{return localStorage.getItem("spur-theme")}catch{return null}})()){const o=s.matches?"dark":"light";t(o),document.documentElement.setAttribute("data-theme",o)}};return r.addEventListener("change",a),()=>r.removeEventListener("change",a)},[]);const n=g.useCallback(()=>t(cq),[]);return l.jsx(Ge,{variant:"ghost",size:"sm",onClick:n,className:"text-spur-text-muted","aria-label":e==="dark"?"Switch to light mode":"Switch to dark mode",children:e==="dark"?"☀️":"🌙"})}const pq="Modules";function fq(){const[e,t]=g.useState(pq);return g.useEffect(()=>{const n=new AbortController;return Tt(new Request(`${Nt()}/project`,{signal:n.signal})).then(async r=>{if(!r.ok)return;const a=await r.json();a.name&&t(a.name)}).catch(()=>{}),()=>n.abort()},[]),e}function mq({direction:e}){const t=e==="expand";return l.jsx("svg",{className:"h-4 w-4 shrink-0",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:t?l.jsx("path",{d:"M6 3l5 5-5 5"}):l.jsx("path",{d:"M10 3L5 8l5 5"})})}function Oy({collapsed:e,onToggle:t}){const n=e?"Expand sidebar":"Collapse sidebar";return l.jsx("button",{type:"button",onClick:t,"aria-label":n,title:n,"data-testid":e?"sidebar-expand":"sidebar-collapse",className:"flex h-8 w-8 items-center justify-center rounded-md text-spur-text-muted hover:bg-spur-accent/20 hover:text-spur-accent focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-spur-accent",children:l.jsx(mq,{direction:e?"expand":"collapse"})})}function hq({collapsed:e,onToggle:t,onMobileClose:n}){const r=fq();return l.jsxs("aside",{className:"flex flex-col bg-spur-surface border-r border-spur-border overflow-hidden",children:[e?l.jsx("div",{className:"flex items-center justify-center border-b border-spur-border shrink-0 py-1",children:l.jsx(Oy,{collapsed:!0,onToggle:t})}):l.jsxs("div",{className:"flex items-center justify-between gap-1 p-3 border-b border-spur-border shrink-0",children:[l.jsx(oq,{currentName:r}),l.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[l.jsx(Oy,{collapsed:!1,onToggle:t}),l.jsx(dq,{}),n&&l.jsx(Ge,{variant:"ghost",size:"sm",className:"text-spur-text-muted md:hidden",onClick:n,"aria-label":"Close navigation",children:"✕"})]})]}),l.jsx("nav",{className:"flex-1 overflow-y-auto",children:qw.map(a=>l.jsxs(c1,{to:`/board/${a.route}`,className:({isActive:s})=>`flex items-center gap-2 px-3 py-2 text-sm transition-colors ${s?"bg-spur-accent/20 text-spur-accent":"text-spur-text-muted hover:text-spur-text hover:bg-spur-border/30"} ${e?"justify-center py-3":""}`,title:e?a.name:void 0,children:[l.jsx("span",{className:"text-lg",children:a.icon}),!e&&l.jsx("span",{children:a.sidebarLabel??a.name})]},a.id))})]})}function gq({children:e,mobileHeader:t}){return l.jsxs("main",{className:"flex flex-col h-full overflow-hidden bg-spur-bg",children:[t,l.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:e})]})}function bq({collapsed:e,onToggle:t,onMobileClose:n,children:r,actions:a}){return l.jsxs("aside",{className:"flex flex-col bg-spur-surface border-l border-spur-border overflow-hidden",children:[n&&l.jsx("div",{className:"hidden max-md:flex items-center justify-center py-2 shrink-0",children:l.jsx("div",{className:"w-10 h-1 rounded-full bg-spur-border"})}),l.jsxs("div",{className:"flex items-center justify-between p-3 border-b border-spur-border shrink-0",children:[!e&&l.jsx("span",{className:"text-sm font-semibold text-spur-text",children:r?"Context":""}),l.jsx("div",{className:"flex items-center gap-1",children:a}),l.jsxs("div",{className:"flex items-center gap-1",children:[n&&l.jsx(Ge,{variant:"ghost",size:"sm",className:"text-spur-text-muted md:hidden",onClick:n,"aria-label":"Close panel",children:"✕"}),l.jsx(Ge,{variant:"ghost",size:"sm",className:"text-spur-text-muted hidden md:inline-flex",onClick:t,"aria-label":e?"Expand panel":"Collapse panel",children:e?"◀":"▶"})]})]}),!e&&l.jsx("div",{className:"flex-1 overflow-y-auto p-3",children:r})]})}const Eq=g.createContext(void 0);function xq(){const[e,t]=g.useState(()=>eP()),[n,r]=g.useState(!1),[a,s]=g.useState(!1),i=sr(),o=(()=>{const S=i.pathname.split("/"),w=S.indexOf("board"),A=w>=0?S[w+1]:void 0;return sq(A??"")})();g.useLayoutEffect(()=>{const S=document.documentElement;S.style.setProperty("--sidebar-w",`${e.sidebarWidth}px`),S.style.setProperty("--rightpanel-w",`${e.rightPanelWidth}px`)},[e.sidebarWidth,e.rightPanelWidth]);const u=g.useCallback(S=>tP(S),[]),c=g.useCallback(()=>{t(S=>{const w={...S,sidebarCollapsed:!S.sidebarCollapsed};return u(w),w})},[u]),p=g.useCallback(()=>{t(S=>{const w={...S,rightPanelCollapsed:!S.rightPanelCollapsed};return u(w),w})},[u]),d=g.useCallback(S=>t(w=>{const A={...w,sidebarWidth:S};return u(A),A}),[u]),f=g.useCallback(S=>t(w=>{const A={...w,rightPanelWidth:S};return u(A),A}),[u]),m=g.useCallback(()=>{r(!1),s(!1)},[]),b=g.useCallback(S=>{S.key==="Escape"&&m()},[m]),E=o?.rightPanelComponent;g.useLayoutEffect(()=>{E&&e.rightPanelCollapsed&&t(S=>({...S,rightPanelCollapsed:!1}))},[E,e.rightPanelCollapsed]);const x=l.jsxs("div",{className:"mobile-bar",children:[l.jsx(Ge,{variant:"ghost",size:"sm",className:"text-spur-text",onClick:()=>r(!0),"aria-label":"Open navigation",children:"☰"}),l.jsx("span",{className:"text-sm font-semibold text-spur-text",children:o?.name??"Spur"}),l.jsx(Ge,{variant:"ghost",size:"sm",className:"text-spur-text",onClick:()=>s(!0),"aria-label":"Open panel",children:"◧"})]}),y=n||a;return l.jsxs(l.Fragment,{children:[y&&l.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 md:hidden",onClick:m,onKeyDown:b,"aria-hidden":"true"}),l.jsx("div",{className:"board-layout","data-sidebar-collapsed":String(e.sidebarCollapsed),"data-rightpanel-collapsed":String(e.rightPanelCollapsed),"data-mobile-sidebar-open":String(n),"data-mobile-panel-open":String(a),children:l.jsxs(Eq.Provider,{value:o,children:[l.jsx(hq,{collapsed:e.sidebarCollapsed,onToggle:c,onMobileClose:m}),l.jsx(gl,{targetVar:"--sidebar-w",onResizeEnd:d}),l.jsx(gq,{mobileHeader:x,children:l.jsx(GN,{})}),l.jsx(gl,{targetVar:"--rightpanel-w",onResizeEnd:f}),l.jsx(bq,{collapsed:e.rightPanelCollapsed,onToggle:p,onMobileClose:m,children:E?l.jsx(E,{}):null})]})}),l.jsx(iq,{})]})}const yq=[{path:"/board",element:l.jsx(xq,{}),children:[{index:!0,element:l.jsx(u0,{to:Oo?Oo.route:"/board",replace:!0})},...qw.flatMap(e=>[{path:e.route,element:l.jsx(e.component,{})},{path:`${e.route}/*`,element:l.jsx(e.component,{})}])]},{path:"/",element:l.jsx(u0,{to:Oo?`/board/${Oo.route}`:"/board",replace:!0})}];function Tq(){return g_(yq)}function vq(){const[e]=g.useState(Tq);return l.jsx($N,{router:e})}export{Ge as B,tb as C,Ra as L,ol as M,Xr as S,Bv as _,sn as a,Ot as b,xz as c,vq as d,l as j,hz as p,fb as t,hb as u};
|