xedoc-cli 0.1.17 → 0.1.20
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/README.md +42 -0
- package/bin/xedoc.mjs +578 -50
- package/build/client/assets/app-layout-Bnly6Mpc.js +1 -0
- package/build/client/assets/chat-D31IhueQ.js +1 -0
- package/build/client/assets/{manifest-dbfd578d.js → manifest-299669d5.js} +1 -1
- package/build/client/assets/root-B8vUNgcI.css +2 -0
- package/build/server/index.js +1 -1
- package/package.json +1 -1
- package/build/client/assets/app-layout-DcqaA3vs.js +0 -1
- package/build/client/assets/chat-C98BY8zv.js +0 -1
- package/build/client/assets/root-C6Tru0U5.css +0 -2
- /package/build/client/assets/{root-BU4hb_em.js → root-Bu-oywbm.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{F as e,I as t,L as n,M as r,R as i,j as o,s,t as a}from"./jsx-runtime-BD6xVgfN.js";import{Ht as l,Wt as c}from"./usePositioner-DoPOYGgd.js";import{Ct as u,G as d,I as f,L as p,M as m,N as h,O as g,T as x,U as y,_t as v,c as b,h as k,j as w,l as j,mt as C,pt as N,u as I,wt as S,xt as A,yt as P}from"./popover-DTbjnDSA.js";import{A as E,B as T,E as M,F as D,M as L,R as F,U as R,Ut as O,V as z,Wt as _,_ as q,f as B,g as U,h as H,n as $}from"./api-Bq1vju8d.js";import{a as V,c as Q,d as W,f as G,h as K,i as Y,l as X,m as J,n as Z,o as ee,p as te,r as ne,s as re,t as ie,u as oe}from"./composer-controls-C-i2mGP0.js";import{A as se,D as ae,O as le,a as ce,c as ue,d as de,f as fe,i as pe,n as me,o as he,r as ge,s as xe,u as ye}from"./header-menu-BZ8Qg4Vi.js";import{t as ve}from"./triangle-alert-CX-fS3B2.js";import{c as be,t as ke}from"./input-DmJ6N0Sh.js";var we=_("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),je=_("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),Ce=_("code-xml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]),Ne=_("file-code",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]]),Ie=_("lock-keyhole",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]]),Se=_("pencil-line",[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]),Ae=_("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),Pe=i(e(),1),Ee=(0,Pe.createContext)(null),Te=a();function Me({disabled:e,messages:t,onReview:n,onUndo:r,pending:i}){const o=(0,Pe.useMemo)(()=>function(e){const t=[...e].sort((e,t)=>e.sequence-t.sequence),n=new Map,r=new Set,i=[];for(const s of t){const e=We(s.metadata);e?.status&&r.add(e.status),e?.diff?.trim()&&i.push(e.diff.trim());for(const t of De(e)){const e=n.get(t.path);e?n.set(t.path,{action:Ve(e.action,t.action),additions:e.additions+t.additions,deletions:e.deletions+t.deletions,diff:Qe(e.diff,t.diff),path:e.path.length<=t.path.length?e.path:t.path}):n.set(t.path,t)}}const o=Array.from(n.values());return{additions:o.reduce((e,t)=>e+t.additions,0),deletions:o.reduce((e,t)=>e+t.deletions,0),diff:Qe(...i),entries:o,message:t.at(-1)??e[0],statuses:Array.from(r)}}(t),[t]),s=(0,Pe.useContext)(Ee),a=!(e||i||t.some(e=>"STREAMING"===e.status||"PENDING"===e.status))&&o.entries.length>0;return(0,Te.jsxs)("div",{className:"min-w-0 max-w-full overflow-hidden rounded-lg border bg-background text-sm",children:[(0,Te.jsxs)("div",{className:"grid min-w-0 grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-3 px-3 py-3",children:[(0,Te.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,Te.jsx)(ae,{className:"mt-0.5 size-4 shrink-0 text-muted-foreground"}),(0,Te.jsxs)("div",{className:"min-w-0",children:[(0,Te.jsx)("div",{className:"truncate font-medium",children:o.entries.length?`${Re(o.entries)} ${o.entries.length} ${1===o.entries.length?"file":"files"}`:"File changes"}),(0,Te.jsx)(_e,{additions:o.additions,deletions:o.deletions})]})]}),(0,Te.jsx)("div",{}),(0,Te.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[(0,Te.jsxs)(be,{disabled:!a||!r,size:"sm",type:"button",variant:"ghost",onClick:()=>r?.({message:o.message,prompt:ze(o)}),children:[i?(0,Te.jsx)(O,{className:"animate-spin"}):(0,Te.jsx)(Ae,{}),"Undo"]}),(0,Te.jsxs)(be,{disabled:!a||!n,size:"sm",type:"button",variant:"outline",onClick:()=>n?.({message:o.message,prompt:Oe(o)}),children:[i?(0,Te.jsx)(O,{className:"animate-spin"}):(0,Te.jsx)(le,{}),"Review"]})]})]}),(0,Te.jsx)("div",{className:"grid min-w-0 divide-y border-t",children:o.entries.length?o.entries.map(e=>(0,Te.jsxs)(he,{children:[(0,Te.jsxs)("div",{className:"grid min-w-0 grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-3 px-3 py-2 transition-colors hover:bg-muted/50",children:[(0,Te.jsx)("button",{className:"min-w-0 truncate text-left font-mono text-xs underline-offset-2 hover:underline",type:"button",onClick:()=>s?.({path:e.path}),children:e.path}),(0,Te.jsx)(_e,{additions:e.additions,deletions:e.deletions}),(0,Te.jsxs)(fe,{render:(0,Te.jsx)(be,{size:"icon-sm",variant:"ghost"}),children:[(0,Te.jsx)(se,{className:"-rotate-90 size-4 text-muted-foreground"}),(0,Te.jsx)("span",{className:"sr-only",children:"Open diff"})]})]}),(0,Te.jsxs)(xe,{className:"max-w-5xl",children:[(0,Te.jsxs)(ye,{children:[(0,Te.jsx)(de,{children:e.path}),(0,Te.jsxs)(ue,{children:[e.action??"Edited"," file change reported by Codex."]})]}),(0,Te.jsx)("pre",{className:"max-h-[70vh] min-w-0 max-w-full overflow-auto rounded-md bg-muted p-3 font-mono text-xs leading-5",children:e.diff?.trim()||o.diff?.trim()||"No diff body was reported for this file."})]})]},e.path)):(0,Te.jsx)("div",{className:"px-3 py-2 text-muted-foreground",children:"Changes detected."})}),o.statuses.length?(0,Te.jsx)("div",{className:"flex min-w-0 flex-wrap gap-1 border-t px-3 py-2",children:o.statuses.map(e=>(0,Te.jsx)(y,{variant:"secondary",children:e},e))}):null]})}function De(e){if(!e)return[];const t=function(e){const t=e?.trim();return t?function(e){const t=e.split("\n"),n=[];let r=[];for(const i of t)i.startsWith("diff --git ")&&r.length&&(n.push(r),r=[]),r.push(i);r.length&&n.push(r);return n.map(e=>e.join("\n").trim()).filter(Boolean)}(t).reduce((e,t)=>{const n=t.split("\n"),r=function(e){for(const t of["+++ ","--- "])for(const n of e){if(!n.startsWith(t))continue;const e=Fe(n.slice(t.length));if(e&&"/dev/null"!==e)return e}for(const t of e){if(!t.startsWith("diff --git "))continue;const e=t.split(/\s+/),n=Fe(e[3]??e[2]??"");if(n)return n}return null}(n);return r?(e.push({action:Le(n),additions:n.filter(e=>e.startsWith("+")&&!e.startsWith("+++")).length,deletions:n.filter(e=>e.startsWith("-")&&!e.startsWith("---")).length,diff:t,path:r}),e):e},[]):[]}(e.diff),n=(e.changes??[]).reduce((e,t)=>{if(!t||"object"!=typeof t||Array.isArray(t))return e;const n=t,r=qe(n.path,n.filePath,n.file,n.name);return r?(e.push({action:Ue(qe(n.action,n.kind,n.type)??"Edited"),additions:Be(n.additions),deletions:Be(n.deletions),path:r}),e):e},[]);if(n.length)return[...n.map(e=>{const n=t.find(t=>He(t.path,e.path));return n?{...e,additions:e.additions||n.additions,deletions:e.deletions||n.deletions,diff:n.diff}:e}),...t.filter(e=>!n.some(t=>He(t.path,e.path)))];if(t.length)return t;const r=e.paths??[];if(!r.length)return[];const i=e.additions??0,o=e.deletions??0;return r.map((e,t)=>({action:"Edited",additions:1===r.length||0===t?i:0,deletions:1===r.length||0===t?o:0,path:e}))}function Le(e){return e.some(e=>e.startsWith("new file mode ")||"--- /dev/null"===e)?"Created":e.some(e=>e.startsWith("deleted file mode ")||"+++ /dev/null"===e)?"Deleted":e.some(e=>e.startsWith("rename from ")||e.startsWith("rename to "))?"Renamed":"Edited"}function Fe(e){const t=e.trim().replace(/^"|"$/g,"");return t.startsWith("a/")||t.startsWith("b/")?t.slice(2):t}function Re(e){const t=new Set(e.map(e=>e.action??"Edited"));return 1===t.size?Array.from(t)[0]??"Edited":"Edited"}function Oe(e){return["Review the changes from the latest completed editing turn.","Look for bugs, regressions, missed requirements, and risky assumptions. Do not modify files unless I explicitly ask.","","Changed files:",...e.entries.map(e=>`- ${e.path} (+${e.additions} -${e.deletions})`)].join("\n")}function ze(e){return["Undo the changes from the latest completed editing turn.","Revert only the files listed below. Preserve unrelated user edits and stop with an explanation if the reverse patch cannot be applied cleanly.","","Target files:",...e.entries.map(e=>`- ${e.path} (+${e.additions} -${e.deletions})`)].join("\n")}function _e({additions:e,deletions:t}){return e||t?(0,Te.jsxs)("span",{className:"shrink-0 whitespace-nowrap font-mono text-xs",children:[(0,Te.jsxs)("span",{className:"text-emerald-600 dark:text-emerald-400",children:["+",e]}),(0,Te.jsx)("span",{className:"mx-1 text-muted-foreground",children:" "}),(0,Te.jsxs)("span",{className:"text-red-600 dark:text-red-400",children:["-",t]})]}):null}function qe(...e){for(const t of e)if("string"==typeof t&&t.trim())return t.trim();return null}function Be(e){if("number"==typeof e&&Number.isFinite(e))return e;if("string"==typeof e){const t=Number(e);return Number.isFinite(t)?t:0}return 0}function Ue(e){const t=e.trim();return t?`${t.charAt(0).toUpperCase()}${t.slice(1)}`:"Edited"}function He(e,t){return $e(e)===$e(t)}function $e(e){return Fe(e).replace(/\\/g,"/").replace(/^\.\//,"")}function Ve(e,t){return e?t&&e!==t?"Created"===e||"Created"===t?"Created":"Deleted"===e||"Deleted"===t?"Deleted":"Renamed"===e||"Renamed"===t?"Renamed":"Edited":e:t??"Edited"}function Qe(...e){const t=e.map(e=>e?.trim()).filter(e=>!!e);if(t.length)return Array.from(new Set(t)).join("\n\n")}function We(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:void 0}function Ge(e){return function(e){const t=[];let n=[];const r=()=>{n.length&&(n.length<=Ke?t.push(...n.map(e=>({id:`message:${e.id}`,message:e,type:"message"}))):t.push({id:`tool-burst:${n.map(e=>e.id).join(":")}`,messages:n,type:"toolBurst"}),n=[])};for(const i of e)if("previousActions"!==i.type&&"fileChanges"!==i.type){if(gt(i.message)){if(at(i.message)){r(),t.push({id:`message:${i.message.id}`,message:i.message,type:"message"});continue}const e=n.at(-1);if(!e||xt(e,i.message)){n.push(i.message);continue}r(),n.push(i.message);continue}r(),t.push({id:`message:${i.message.id}`,message:i.message,type:"message"})}else r(),t.push({id:`${i.type}:${i.messages.map(e=>e.id).join(":")}`,messages:i.messages,type:i.type});return r(),t}(function(e){const t=[];let n=[];const r=()=>{if(!n.length)return;const e=Math.min(...n.map(e=>e.sequence));t.push({messages:n,sequence:e,type:"fileChanges"}),n=[]};for(const i of e){if("message"!==i.type||"FILE_CHANGE"!==i.message.kind){r(),t.push(i);continue}const e=n.at(-1);e&&yt(e)!==yt(i.message)&&r(),n.push(i.message)}return r(),t}(function(e){if(e.some(at))return e.map(e=>({message:e,sequence:e.sequence,type:"message"}));const t=function(e){const t=[...e].reverse().filter(e=>"ASSISTANT"===e.role&&"CHAT"===e.kind&&e.content.trim().length>0);return t.find(e=>function(e){return"final_answer"===mt(e)}(e))??t.find(e=>!pt(e))??t[0]}(e),n=[],r=[];for(const l of e)ft(l,t)?n.push(l):r.push(l);const i=r.map(e=>({message:e,sequence:e.sequence,type:"message"}));if(!n.length)return i;const o=Math.min(...n.map(e=>e.sequence)),s=i.findIndex(e=>e.sequence>o),a={messages:n,sequence:o,type:"previousActions"};return s<0?[...i,a]:[...i.slice(0,s),a,...i.slice(s)]}(function(e){const t=new Set,n=new Map;for(const r of e){if("TOOL_ACTIVITY"!==r.kind)continue;const e=it(r);e&&n.set(e,r)}return e.map(e=>{if("COMMAND_EXECUTION"!==e.kind)return e;const r=it(e),i=r?n.get(r):void 0;if(!i)return e;t.add(i.id);const o=kt(e.metadata);return{...e,metadata:{...o,callId:r,kind:"command",output:i.content}}}).filter(e=>!t.has(e.id))}(function(e){const t=[];let n=[],r=null;const i=()=>{n.length&&(t.push(function(e){return 1===e.length?e[0]:{...e[e.length-1],content:ot(e.map(e=>e.content)),id:e.map(e=>e.id).join(":"),status:st(e)}}(n)),n=[],r=null)};for(const o of e){if("ASSISTANT"===o.role&&"CHAT"===o.kind){if(at(o)){i(),t.push(o);continue}const e=rt(o);r&&r!==e&&i(),r=e,n.push(o);continue}i(),t.push(o)}return i(),t}([...e].sort((e,t)=>e.sequence-t.sequence))))))}var Ke=5;function Ye(e){const t=Xe([...e]).filter(e=>!ut(e)).sort((e,t)=>e.sequence-t.sequence),n=new Map;for(const r of t){const e=r.turnId?`turn:${r.turnId}`:`message:${r.id}`,t=n.get(e);t?t.push(r):n.set(e,[r])}return Array.from(n.values()).flatMap(e=>e.some(at)?e:[...e.filter(e=>"FILE_CHANGE"!==e.kind),...e.filter(e=>"FILE_CHANGE"===e.kind)])}function Xe(e){const t=[...e].sort((e,t)=>e.sequence-t.sequence),n=[],r=new Map;for(const i of t){const e=Je(i);if(!e){n.push(i);continue}const t=r.get(e);void 0!==t?n[t]=Ze(n[t],i):(r.set(e,n.length),n.push(i))}return n}function Je(e){return e.requestId?`${e.runId??e.chatId}:${e.kind}:request:${e.requestId}`:e.itemId?`${e.runId??e.chatId}:${e.kind}:item:${e.itemId}`:null}function Ze(e,t){return"PLAN"===e.kind?t.content.length>e.content.length?t:et(t.status)>et(e.status)?{...e,status:t.status}:e:et(t.status)>et(e.status)||t.sequence>=e.sequence?t:e}function et(e){switch(e){case"FAILED":return 4;case"COMPLETED":return 3;case"STREAMING":return 2;default:return 1}}function tt(e,t){return"ASSISTANT"===e?.role&&"CHAT"===e.kind&&"ASSISTANT"===t.role&&"CHAT"===t.kind}function nt(e){return e.runId?`codex-run:${e.runId}`:e.turnId?`codex-turn:${e.turnId}`:`codex-message:${e.id}`}function rt(e){const t=mt(e);return"final_answer"===t||"commentary"===t?t:e.itemId?`item:${e.itemId}`:"assistant"}function it(e){const t=ht((e.metadata&&"object"==typeof e.metadata?e.metadata:null)?.callId);if(t)return t;const n=e.rawPayload&&"object"==typeof e.rawPayload?e.rawPayload:null;return ht((n?.payload&&"object"==typeof n.payload?n.payload:null)?.callId)}function ot(e){const t=[];for(const n of e)if(n.trim()&&!(t.findIndex(e=>e===n||e.startsWith(n))>=0)){for(let e=t.length-1;e>=0;e-=1)n.startsWith(t[e])&&t.splice(e,1);t.push(n)}return t.join("\n\n")}function st(e){return e.some(e=>"FAILED"===e.status)?"FAILED":e.some(e=>"STREAMING"===e.status)?"STREAMING":e.some(e=>"PENDING"===e.status)?"PENDING":"COMPLETED"}function at(e){return"STREAMING"===e.status||"PENDING"===e.status}function lt(e){return{pendingRequest:Xe(e).sort((e,t)=>t.sequence-e.sequence).find(ct)}}function ct(e){if("APPROVAL"!==e.kind&&"USER_INPUT_PROMPT"!==e.kind)return!1;if("COMPLETED"===e.status||"FAILED"===e.status)return!1;const t=kt(e.metadata);return"resolved"!==t?.status&&"expired"!==t?.status}function ut(e){return!!dt(e)||(!!function(e){return"THINKING"===e.kind&&"thinking..."===e.content.trim().toLowerCase()}(e)||"CHAT"===e.kind&&"ASSISTANT"===e.role&&(0===e.content.trim().length&&"PENDING"!==e.status&&"STREAMING"!==e.status))}function dt(e){if("PLAN"!==e.kind)return!1;const t=kt(e.metadata);return 0===e.content.trim().length&&!t?.explanation?.trim()&&!t?.steps?.length}function ft(e,t){return e.id!==t?.id&&("ERROR"!==e.kind&&"FILE_CHANGE"!==e.kind&&"PLAN"!==e.kind&&(!ct(e)&&("APPROVAL"===e.kind||"USER_INPUT_PROMPT"===e.kind||("THINKING"===e.kind||"TOOL_ACTIVITY"===e.kind||("COMMAND_EXECUTION"===e.kind?"FAILED"!==e.status:"ASSISTANT"===e.role&&"CHAT"===e.kind&&(!(!t||!pt(e))||!!t&&t.content.includes(e.content.trim())))))))}function pt(e){return"commentary"===mt(e)}function mt(e){const t=ht((e.metadata&&"object"==typeof e.metadata?e.metadata:null)?.phase);return t?t.trim().replace(/([a-z])([A-Z])/g,"$1_$2").replace(/[\s-]+/g,"_").toLowerCase():null}function ht(e){return"string"==typeof e&&e.trim()?e:null}function gt(e){return"COMMAND_EXECUTION"===e.kind||"TOOL_ACTIVITY"===e.kind}function xt(e,t){return yt(e)===yt(t)}function yt(e){return e.runId??e.turnId??e.chatId}function vt(e){return"COMMAND_EXECUTION"===e.kind?(0,Te.jsx)(C,{className:"mt-0.5 size-3.5 text-muted-foreground"}):"APPROVAL"===e.kind||"USER_INPUT_PROMPT"===e.kind?(0,Te.jsx)(Ie,{className:"mt-0.5 size-3.5 text-muted-foreground"}):"THINKING"===e.kind?(0,Te.jsx)(bt,{}):(0,Te.jsx)(Ce,{className:"mt-0.5 size-3.5 text-muted-foreground"})}function bt(){return(0,Te.jsx)(v,{className:"mt-0.5 size-3.5 text-muted-foreground"})}function kt(e){return e&&"object"==typeof e?e:void 0}function wt(e){const t=e.metadata;return Array.isArray(t?.attachments)?t.attachments.filter(e=>{if(!e||"object"!=typeof e)return!1;const t=e.kind;return"image"===t||"file"===t}):[]}function jt({chatId:e,onClose:t,session:n,target:r}){const i=S({enabled:!!r,queryKey:["workspace-file",e,r?.path,r?.line??null],queryFn:()=>L(n,e,r.path,r.line??null),retry:!1});return(0,Te.jsx)(he,{open:!!r,onOpenChange:e=>!e&&t(),children:(0,Te.jsxs)(xe,{className:"flex max-h-[88vh] max-w-5xl flex-col overflow-hidden p-0",children:[(0,Te.jsxs)(ye,{className:"gap-1 px-4 pb-2 pt-4",children:[(0,Te.jsxs)(de,{className:"flex min-w-0 items-center gap-2",children:[(0,Te.jsx)(Ne,{className:"size-4 shrink-0"}),(0,Te.jsx)("span",{className:"min-w-0 truncate",children:i.data?.relativePath??r?.path??"File"})]}),(0,Te.jsx)(ue,{className:"truncate",children:Nt(i.data)})]}),(0,Te.jsx)("div",{className:"min-h-0 border-t",children:i.isLoading?(0,Te.jsxs)("div",{className:"grid h-72 place-items-center text-sm text-muted-foreground",children:[(0,Te.jsx)(O,{className:"mb-2 size-5 animate-spin"}),"Loading file..."]}):i.error?(0,Te.jsx)("div",{className:"m-4 rounded-md border border-destructive/30 bg-destructive/10 p-3 text-sm text-destructive",children:i.error.message}):i.data?(0,Te.jsx)(Ct,{file:i.data}):null})]})})}function Ct({file:e}){const t=(0,Pe.useRef)({}),n=(0,Pe.useMemo)(()=>(e.content??"").split(/\r?\n/),[e.content]);return(0,Pe.useEffect)(()=>{e.line&&t.current[e.line]?.scrollIntoView({block:"center"})},[e.line,n.length]),e.isBinary?(0,Te.jsx)("div",{className:"m-4 rounded-md border bg-muted/30 p-3 text-sm text-muted-foreground",children:"Binary files are not displayed."}):(0,Te.jsx)(p,{className:"h-[70vh]",children:(0,Te.jsxs)("div",{className:"min-w-0 overflow-x-auto bg-background p-3",children:[(0,Te.jsx)("pre",{className:"min-w-max font-mono text-xs leading-5",children:n.map((n,r)=>{const i=r+1;return(0,Te.jsxs)("div",{className:R("grid grid-cols-[3.5rem_minmax(0,1fr)] rounded-sm",e.line===i&&"bg-primary/10"),ref:e=>{t.current[i]=e},children:[(0,Te.jsx)("span",{className:"select-none pr-3 text-right text-muted-foreground",children:i}),(0,Te.jsx)("code",{className:"whitespace-pre",dangerouslySetInnerHTML:{__html:pe(n||" ",e.language)}})]},i)})}),e.truncated?(0,Te.jsx)("div",{className:"mt-3 rounded-md border bg-muted/35 p-2 text-xs text-muted-foreground",children:"File preview truncated at 1 MB."}):null]})})}function Nt(e){return e?[It(e.size),e.language,e.line?`line ${e.line}`:null].filter(Boolean).join(" · "):"Read-only workspace file viewer."}function It(e){return e>=1048576?`${(e/1024/1024).toFixed(1)} MB`:e>=1024?`${Math.round(e/1024)} KB`:`${e} B`}var St=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,At=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Pt={};function Et(e,t){return((t||Pt).jsx?At:St).test(e)}var Tt=/[ \t\n\f\r]/g;function Mt(e){return""===e.replace(Tt,"")}var Dt=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};function Lt(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Dt(n,r,t)}function Ft(e){return e.toLowerCase()}Dt.prototype.normal={},Dt.prototype.property={},Dt.prototype.space=void 0;var Rt=class{constructor(e,t){this.attribute=t,this.property=e}};Rt.prototype.attribute="",Rt.prototype.booleanish=!1,Rt.prototype.boolean=!1,Rt.prototype.commaOrSpaceSeparated=!1,Rt.prototype.commaSeparated=!1,Rt.prototype.defined=!1,Rt.prototype.mustUseProperty=!1,Rt.prototype.number=!1,Rt.prototype.overloadedBoolean=!1,Rt.prototype.property="",Rt.prototype.spaceSeparated=!1,Rt.prototype.space=void 0;var Ot=n({boolean:()=>_t,booleanish:()=>qt,commaOrSpaceSeparated:()=>Vt,commaSeparated:()=>$t,number:()=>Ut,overloadedBoolean:()=>Bt,spaceSeparated:()=>Ht}),zt=0,_t=Qt(),qt=Qt(),Bt=Qt(),Ut=Qt(),Ht=Qt(),$t=Qt(),Vt=Qt();function Qt(){return 2**++zt}var Wt=Object.keys(Ot),Gt=class extends Rt{constructor(e,t,n,r){let i=-1;if(super(e,t),Kt(this,"space",r),"number"==typeof n)for(;++i<Wt.length;){const e=Wt[i];Kt(this,Wt[i],(n&Ot[e])===Ot[e])}}};function Kt(e,t,n){n&&(e[t]=n)}function Yt(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const o=new Gt(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[Ft(r)]=r,n[Ft(o.attribute)]=r}return new Dt(t,n,e.space)}Gt.prototype.defined=!0;var Xt=Yt({properties:{ariaActiveDescendant:null,ariaAtomic:qt,ariaAutoComplete:null,ariaBusy:qt,ariaChecked:qt,ariaColCount:Ut,ariaColIndex:Ut,ariaColSpan:Ut,ariaControls:Ht,ariaCurrent:null,ariaDescribedBy:Ht,ariaDetails:null,ariaDisabled:qt,ariaDropEffect:Ht,ariaErrorMessage:null,ariaExpanded:qt,ariaFlowTo:Ht,ariaGrabbed:qt,ariaHasPopup:null,ariaHidden:qt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ht,ariaLevel:Ut,ariaLive:null,ariaModal:qt,ariaMultiLine:qt,ariaMultiSelectable:qt,ariaOrientation:null,ariaOwns:Ht,ariaPlaceholder:null,ariaPosInSet:Ut,ariaPressed:qt,ariaReadOnly:qt,ariaRelevant:null,ariaRequired:qt,ariaRoleDescription:Ht,ariaRowCount:Ut,ariaRowIndex:Ut,ariaRowSpan:Ut,ariaSelected:qt,ariaSetSize:Ut,ariaSort:null,ariaValueMax:Ut,ariaValueMin:Ut,ariaValueNow:Ut,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function Jt(e,t){return t in e?e[t]:t}function Zt(e,t){return Jt(e,t.toLowerCase())}var en=Yt({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:$t,acceptCharset:Ht,accessKey:Ht,action:null,allow:null,allowFullScreen:_t,allowPaymentRequest:_t,allowUserMedia:_t,alt:null,as:null,async:_t,autoCapitalize:null,autoComplete:Ht,autoFocus:_t,autoPlay:_t,blocking:Ht,capture:null,charSet:null,checked:_t,cite:null,className:Ht,cols:Ut,colSpan:null,content:null,contentEditable:qt,controls:_t,controlsList:Ht,coords:Ut|$t,crossOrigin:null,data:null,dateTime:null,decoding:null,default:_t,defer:_t,dir:null,dirName:null,disabled:_t,download:Bt,draggable:qt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:_t,formTarget:null,headers:Ht,height:Ut,hidden:Bt,high:Ut,href:null,hrefLang:null,htmlFor:Ht,httpEquiv:Ht,id:null,imageSizes:null,imageSrcSet:null,inert:_t,inputMode:null,integrity:null,is:null,isMap:_t,itemId:null,itemProp:Ht,itemRef:Ht,itemScope:_t,itemType:Ht,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:_t,low:Ut,manifest:null,max:null,maxLength:Ut,media:null,method:null,min:null,minLength:Ut,multiple:_t,muted:_t,name:null,nonce:null,noModule:_t,noValidate:_t,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:_t,optimum:Ut,pattern:null,ping:Ht,placeholder:null,playsInline:_t,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:_t,referrerPolicy:null,rel:Ht,required:_t,reversed:_t,rows:Ut,rowSpan:Ut,sandbox:Ht,scope:null,scoped:_t,seamless:_t,selected:_t,shadowRootClonable:_t,shadowRootDelegatesFocus:_t,shadowRootMode:null,shape:null,size:Ut,sizes:null,slot:null,span:Ut,spellCheck:qt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ut,step:null,style:null,tabIndex:Ut,target:null,title:null,translate:null,type:null,typeMustMatch:_t,useMap:null,value:qt,width:Ut,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ht,axis:null,background:null,bgColor:null,border:Ut,borderColor:null,bottomMargin:Ut,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:_t,declare:_t,event:null,face:null,frame:null,frameBorder:null,hSpace:Ut,leftMargin:Ut,link:null,longDesc:null,lowSrc:null,marginHeight:Ut,marginWidth:Ut,noResize:_t,noHref:_t,noShade:_t,noWrap:_t,object:null,profile:null,prompt:null,rev:null,rightMargin:Ut,rules:null,scheme:null,scrolling:qt,standby:null,summary:null,text:null,topMargin:Ut,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ut,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:_t,disableRemotePlayback:_t,prefix:null,property:null,results:Ut,security:null,unselectable:null},space:"html",transform:Zt}),tn=Yt({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Vt,accentHeight:Ut,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ut,amplitude:Ut,arabicForm:null,ascent:Ut,attributeName:null,attributeType:null,azimuth:Ut,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ut,by:null,calcMode:null,capHeight:Ut,className:Ht,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ut,diffuseConstant:Ut,direction:null,display:null,dur:null,divisor:Ut,dominantBaseline:null,download:_t,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ut,enableBackground:null,end:null,event:null,exponent:Ut,externalResourcesRequired:null,fill:null,fillOpacity:Ut,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:$t,g2:$t,glyphName:$t,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ut,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ut,horizOriginX:Ut,horizOriginY:Ut,id:null,ideographic:Ut,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ut,k:Ut,k1:Ut,k2:Ut,k3:Ut,k4:Ut,kernelMatrix:Vt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ut,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ut,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Ut,overlineThickness:Ut,paintOrder:null,panose1:null,path:null,pathLength:Ut,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ht,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ut,pointsAtY:Ut,pointsAtZ:Ut,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Vt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Vt,rev:Vt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Vt,requiredFeatures:Vt,requiredFonts:Vt,requiredFormats:Vt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Ut,specularExponent:Ut,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ut,strikethroughThickness:Ut,string:null,stroke:null,strokeDashArray:Vt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ut,strokeOpacity:Ut,strokeWidth:null,style:null,surfaceScale:Ut,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Vt,tabIndex:Ut,tableValues:null,target:null,targetX:Ut,targetY:Ut,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Vt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ut,underlineThickness:Ut,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ut,values:null,vAlphabetic:Ut,vMathematical:Ut,vectorEffect:null,vHanging:Ut,vIdeographic:Ut,version:null,vertAdvY:Ut,vertOriginX:Ut,vertOriginY:Ut,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ut,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Jt}),nn=Yt({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),rn=Yt({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Zt}),on=Yt({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),sn={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},an=/[A-Z]/g,ln=/-[a-z]/g,cn=/^data[-\w.:]+$/i;function un(e){return"-"+e.toLowerCase()}function dn(e){return e.charAt(1).toUpperCase()}var fn=Lt([Xt,en,nn,rn,on],"html"),pn=Lt([Xt,tn,nn,rn,on],"svg");var mn=t((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,o=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,c=/^\s+|\s+$/g,u="";function d(e){return e?e.replace(c,u):u}t.exports=function(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var c=1,f=1;function p(e){var t=e.match(r);t&&(c+=t.length);var n=e.lastIndexOf("\n");f=~n?e.length-n:f+e.length}function m(){var e={line:c,column:f};return function(t){return t.position=new h(e),y(),t}}function h(e){this.start=e,this.end={line:c,column:f},this.source=t.source}function g(n){var r=new Error(t.source+":"+c+":"+f+": "+n);if(r.reason=n,r.filename=t.source,r.line=c,r.column=f,r.source=e,!t.silent)throw r}function x(t){var n=t.exec(e);if(n){var r=n[0];return p(r),e=e.slice(r.length),n}}function y(){x(i)}function v(e){var t;for(e=e||[];t=b();)!1!==t&&e.push(t);return e}function b(){var t=m();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var n=2;u!=e.charAt(n)&&("*"!=e.charAt(n)||"/"!=e.charAt(n+1));)++n;if(n+=2,u===e.charAt(n-1))return g("End of comment missing");var r=e.slice(2,n-2);return f+=2,p(r),e=e.slice(n),f+=2,t({type:"comment",comment:r})}}function k(){var e=m(),t=x(o);if(t){if(b(),!x(s))return g("property missing ':'");var r=x(a),i=e({type:"declaration",property:d(t[0].replace(n,u)),value:r?d(r[0].replace(n,u)):u});return x(l),i}}return h.prototype.content=e,y(),function(){var e,t=[];for(v(t);e=k();)!1!==e&&(t.push(e),v(t));return t}()}}),hn=t(e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(e,t){let r=null;if(!e||"string"!=typeof e)return r;const i=(0,n.default)(e),o="function"==typeof t;return i.forEach(e=>{if("declaration"!==e.type)return;const{property:n,value:i}=e;o?t(n,i,e):i&&(r=r||{},r[n]=i)}),r};var n=t(mn())}),gn=t(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,s=function(e,t){return t.toUpperCase()},a=function(e,t){return"".concat(t,"-")};e.camelCase=function(e,l){return void 0===l&&(l={}),function(e){return!e||r.test(e)||t.test(e)}(e)?e:(e=e.toLowerCase(),(e=l.reactCompat?e.replace(o,a):e.replace(i,a)).replace(n,s))}}),xn=t((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(hn()),r=gn();function i(e,t){var i={};return e&&"string"==typeof e?((0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i):i}i.default=i,t.exports=i}),yn=bn("end"),vn=bn("start");function bn(e){return function(t){const n=t&&t.position&&t.position[e]||{};if("number"==typeof n.line&&n.line>0&&"number"==typeof n.column&&n.column>0)return{line:n.line,column:n.column,offset:"number"==typeof n.offset&&n.offset>-1?n.offset:void 0}}}function kn(e){return e&&"object"==typeof e?"position"in e||"type"in e?jn(e.position):"start"in e||"end"in e?jn(e):"line"in e||"column"in e?wn(e):"":""}function wn(e){return Cn(e&&e.line)+":"+Cn(e&&e.column)}function jn(e){return wn(e&&e.start)+"-"+wn(e&&e.end)}function Cn(e){return e&&"number"==typeof e?e:1}var Nn=class extends Error{constructor(e,t,n){super(),"string"==typeof t&&(n=t,t=void 0);let r="",i={},o=!1;if(t&&(i="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?r=e:!i.cause&&e&&(o=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&"string"==typeof n){const e=n.indexOf(":");-1===e?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){const e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}const s=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=s?s.line:void 0,this.name=kn(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&"string"==typeof i.cause.stack?i.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;var In=i(xn(),1),Sn={}.hasOwnProperty,An=new Map,Pn=/[A-Z]/g,En=new Set(["table","tbody","thead","tfoot","tr"]),Tn=new Set(["td","th"]),Mn="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Dn(e,t){if(!t||void 0===t.Fragment)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if("function"!=typeof t.jsxDEV)throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=function(e,t){return n;function n(n,r,i,o){const s=Array.isArray(i.children),a=vn(n);return t(r,i,o,s,{columnNumber:a?a.column-1:void 0,fileName:e,lineNumber:a?a.line:void 0},void 0)}}(n,t.jsxDEV)}else{if("function"!=typeof t.jsx)throw new TypeError("Expected `jsx` in production options");if("function"!=typeof t.jsxs)throw new TypeError("Expected `jsxs` in production options");r=function(e,t,n){return r;function r(e,r,i,o){const s=Array.isArray(i.children)?n:t;return o?s(r,i,o):s(r,i)}}(0,t.jsx,t.jsxs)}const i={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:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?pn:fn,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},o=Ln(i,e,void 0);return o&&"string"!=typeof o?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function Ln(e,t,n){return"element"===t.type?function(e,t,n){const r=e.schema;let i=r;"svg"===t.tagName.toLowerCase()&&"html"===r.space&&(i=pn,e.schema=i);e.ancestors.push(t);const o=_n(e,t.tagName,!1),s=function(e,t){const n={};let r,i;for(i in t.properties)if("children"!==i&&Sn.call(t.properties,i)){const o=zn(e,i,t.properties[i]);if(o){const[i,s]=o;e.tableCellAlignToStyle&&"align"===i&&"string"==typeof s&&Tn.has(t.tagName)?r=s:n[i]=s}}if(r){(n.style||(n.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=r}return n}(e,t);let a=On(e,t);En.has(t.tagName)&&(a=a.filter(function(e){return"string"!=typeof e||!("object"==typeof(t=e)?"text"===t.type&&Mt(t.value):Mt(t));var t}));return Fn(e,s,o,t),Rn(s,a),e.ancestors.pop(),e.schema=r,e.create(t,o,s,n)}(e,t,n):"mdxFlowExpression"===t.type||"mdxTextExpression"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater){const n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}qn(e,t.position)}(e,t):"mdxJsxFlowElement"===t.type||"mdxJsxTextElement"===t.type?function(e,t,n){const r=e.schema;let i=r;"svg"===t.name&&"html"===r.space&&(i=pn,e.schema=i);e.ancestors.push(t);const o=null===t.name?e.Fragment:_n(e,t.name,!0),s=function(e,t){const n={};for(const r of t.attributes)if("mdxJsxExpressionAttribute"===r.type)if(r.data&&r.data.estree&&e.evaluater){const t=r.data.estree.body[0];t.type;const i=t.expression;i.type;const o=i.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else qn(e,t.position);else{const i=r.name;let o;if(r.value&&"object"==typeof r.value)if(r.value.data&&r.value.data.estree&&e.evaluater){const t=r.value.data.estree.body[0];t.type,o=e.evaluater.evaluateExpression(t.expression)}else qn(e,t.position);else o=null===r.value||r.value;n[i]=o}return n}(e,t),a=On(e,t);return Fn(e,s,o,t),Rn(s,a),e.ancestors.pop(),e.schema=r,e.create(t,o,s,n)}(e,t,n):"mdxjsEsm"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);qn(e,t.position)}(e,t):"root"===t.type?function(e,t,n){const r={};return Rn(r,On(e,t)),e.create(t,e.Fragment,r,n)}(e,t,n):"text"===t.type?function(e,t){return t.value}(0,t):void 0}function Fn(e,t,n,r){"string"!=typeof n&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Rn(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function On(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:An;for(;++r<t.children.length;){const o=t.children[r];let s;if(e.passKeys){const e="element"===o.type?o.tagName:"mdxJsxFlowElement"===o.type||"mdxJsxTextElement"===o.type?o.name:void 0;if(e){const t=i.get(e)||0;s=e+"-"+t,i.set(e,t+1)}}const a=Ln(e,o,s);void 0!==a&&n.push(a)}return n}function zn(e,t,n){const r=function(e,t){const n=Ft(t);let r=t,i=Rt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&cn.test(t)){if("-"===t.charAt(4)){const e=t.slice(5).replace(ln,dn);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=t.slice(4);if(!ln.test(e)){let n=e.replace(an,un);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}i=Gt}return new i(r,t)}(e.schema,t);if(!(null==n||"number"==typeof n&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?function(e,t){const n=t||{};return(""===e[e.length-1]?[...e,""]:e).join((n.padRight?" ":"")+","+(!1===n.padLeft?"":" ")).trim()}(n):n.join(" ").trim()),"style"===r.property){let t="object"==typeof n?n:function(e,t){try{return(0,In.default)(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const t=n,r=new Nn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:t,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=Mn+"#cannot-parse-style-attribute",r}}(e,String(n));return"css"===e.stylePropertyNameCase&&(t=function(e){const t={};let n;for(n in e)Sn.call(e,n)&&(t[Bn(n)]=e[n]);return t}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&r.space?sn[r.property]||r.property:r.attribute,n]}}function _n(e,t,n){let r;if(n)if(t.includes(".")){const e=t.split(".");let n,i=-1;for(;++i<e.length;){const t=Et(e[i])?{type:"Identifier",name:e[i]}:{type:"Literal",value:e[i]};n=n?{type:"MemberExpression",object:n,property:t,computed:Boolean(i&&"Literal"===t.type),optional:!1}:t}r=n}else r=Et(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};else r={type:"Literal",value:t};if("Literal"===r.type){const t=r.value;return Sn.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);qn(e)}function qn(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=Mn+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Bn(e){let t=e.replace(Pn,Un);return"ms-"===t.slice(0,3)&&(t="-"+t),t}function Un(e){return"-"+e.toLowerCase()}var Hn={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"]},$n={};function Vn(e,t){const n=t||$n;return Qn(e,"boolean"!=typeof n.includeImageAlt||n.includeImageAlt,"boolean"!=typeof n.includeHtml||n.includeHtml)}function Qn(e,t,n){if(function(e){return Boolean(e&&"object"==typeof e)}(e)){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Wn(e.children,t,n)}return Array.isArray(e)?Wn(e,t,n):""}function Wn(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=Qn(e[i],t,n);return r.join("")}var Gn=document.createElement("i");function Kn(e){const t="&"+e+";";Gn.innerHTML=t;const n=Gn.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&(n!==t&&n)}function Yn(e,t,n,r){const i=e.length;let o,s=0;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function Xn(e,t){return e.length>0?(Yn(e,e.length,0,t),e):t}var Jn={}.hasOwnProperty;function Zn(e){const t={};let n=-1;for(;++n<e.length;)er(t,e[n]);return t}function er(e,t){let n;for(n in t){const r=(Jn.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){Jn.call(r,o)||(r[o]=[]);const e=i[o];tr(r[o],Array.isArray(e)?e:e?[e]:[])}}}function tr(e,t){let n=-1;const r=[];for(;++n<t.length;)("after"===t[n].add?e:r).push(t[n]);Yn(e,0,0,r)}function nr(e,t){const n=Number.parseInt(e,t);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||!(65535&~n)||65534==(65535&n)||n>1114111?"�":String.fromCodePoint(n)}function rr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var ir=gr(/[A-Za-z]/),or=gr(/[\dA-Za-z]/),sr=gr(/[#-'*+\--9=?A-Z^-~]/);function ar(e){return null!==e&&(e<32||127===e)}var lr=gr(/\d/),cr=gr(/[\dA-Fa-f]/),ur=gr(/[!-/:-@[-`{-~]/);function dr(e){return null!==e&&e<-2}function fr(e){return null!==e&&(e<0||32===e)}function pr(e){return-2===e||-1===e||32===e}var mr=gr(/\p{P}|\p{S}/u),hr=gr(/\s/);function gr(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function xr(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const o=e.charCodeAt(n);let s="";if(37===o&&or(e.charCodeAt(n+1))&&or(e.charCodeAt(n+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(s=String.fromCharCode(o));else if(o>55295&&o<57344){const t=e.charCodeAt(n+1);o<56320&&t>56319&&t<57344?(s=String.fromCharCode(o,t),i=1):s="�"}else s=String.fromCharCode(o);s&&(t.push(e.slice(r,n),encodeURIComponent(s)),r=n+i+1,s=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function yr(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return function(r){if(pr(r))return e.enter(n),s(r);return t(r)};function s(r){return pr(r)&&o++<i?(e.consume(r),s):(e.exit(n),t(r))}}var vr={tokenize:function(e){const t=e.attempt(this.parser.constructs.contentInitial,function(n){if(null===n)return void e.consume(n);return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),yr(e,t,"linePrefix")},function(t){return e.enter("paragraph"),r(t)});let n;return t;function r(t){const r=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=r),n=r,i(t)}function i(t){return null===t?(e.exit("chunkText"),e.exit("paragraph"),void e.consume(t)):dr(t)?(e.consume(t),e.exit("chunkText"),r):(e.consume(t),i)}}};var br={tokenize:function(e){const t=this,n=[];let r,i,o,s=0;return a;function a(r){if(s<n.length){const i=n[s];return t.containerState=i[1],e.attempt(i[0].continuation,l,c)(r)}return c(r)}function l(e){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&y();const n=t.events.length;let i,o=n;for(;o--;)if("exit"===t.events[o][0]&&"chunkFlow"===t.events[o][1].type){i=t.events[o][1].end;break}x(s);let a=n;for(;a<t.events.length;)t.events[a][1].end={...i},a++;return Yn(t.events,o+1,0,t.events.slice(n)),t.events.length=a,c(e)}return a(e)}function c(i){if(s===n.length){if(!r)return f(i);if(r.currentConstruct&&r.currentConstruct.concrete)return m(i);t.interrupt=Boolean(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(kr,u,d)(i)}function u(e){return r&&y(),x(s),f(e)}function d(e){return t.parser.lazy[t.now().line]=s!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(kr,p,m)(n)}function p(e){return s++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){return null===n?(r&&y(),x(0),void e.consume(n)):(r=r||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:r,contentType:"flow",previous:i}),h(n))}function h(n){return null===n?(g(e.exit("chunkFlow"),!0),x(0),void e.consume(n)):dr(n)?(e.consume(n),g(e.exit("chunkFlow")),s=0,t.interrupt=void 0,a):(e.consume(n),h)}function g(e,n){const a=t.sliceStream(e);if(n&&a.push(null),e.previous=i,i&&(i.next=e),i=e,r.defineSkip(e.start),r.write(a),t.parser.lazy[e.start.line]){let e=r.events.length;for(;e--;)if(r.events[e][1].start.offset<o&&(!r.events[e][1].end||r.events[e][1].end.offset>o))return;const n=t.events.length;let i,a,l=n;for(;l--;)if("exit"===t.events[l][0]&&"chunkFlow"===t.events[l][1].type){if(i){a=t.events[l][1].end;break}i=!0}for(x(s),e=n;e<t.events.length;)t.events[e][1].end={...a},e++;Yn(t.events,l+1,0,t.events.slice(n)),t.events.length=e}}function x(r){let i=n.length;for(;i-- >r;){const r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function y(){r.write([null]),i=void 0,r=void 0,t.containerState._closeFlow=void 0}}},kr={tokenize:function(e,t,n){return yr(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};function wr(e){return null===e||fr(e)||hr(e)?1:mr(e)?2:void 0}function jr(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}var Cr={name:"attention",resolveAll:function(e,t){let n,r,i,o,s,a,l,c,u=-1;for(;++u<e.length;)if("enter"===e[u][0]&&"attentionSequence"===e[u][1].type&&e[u][1]._close)for(n=u;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[u][1]).charCodeAt(0)){if((e[n][1]._close||e[u][1]._open)&&(e[u][1].end.offset-e[u][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[u][1].end.offset-e[u][1].start.offset)%3))continue;a=e[n][1].end.offset-e[n][1].start.offset>1&&e[u][1].end.offset-e[u][1].start.offset>1?2:1;const d={...e[n][1].end},f={...e[u][1].start};Nr(d,-a),Nr(f,a),o={type:a>1?"strongSequence":"emphasisSequence",start:d,end:{...e[n][1].end}},s={type:a>1?"strongSequence":"emphasisSequence",start:{...e[u][1].start},end:f},i={type:a>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[u][1].start}},r={type:a>1?"strong":"emphasis",start:{...o.start},end:{...s.end}},e[n][1].end={...o.start},e[u][1].start={...s.end},l=[],e[n][1].end.offset-e[n][1].start.offset&&(l=Xn(l,[["enter",e[n][1],t],["exit",e[n][1],t]])),l=Xn(l,[["enter",r,t],["enter",o,t],["exit",o,t],["enter",i,t]]),l=Xn(l,jr(t.parser.constructs.insideSpan.null,e.slice(n+1,u),t)),l=Xn(l,[["exit",i,t],["enter",s,t],["exit",s,t],["exit",r,t]]),e[u][1].end.offset-e[u][1].start.offset?(c=2,l=Xn(l,[["enter",e[u][1],t],["exit",e[u][1],t]])):c=0,Yn(e,n-1,u-n+3,l),u=n+l.length-c-2;break}u=-1;for(;++u<e.length;)"attentionSequence"===e[u][1].type&&(e[u][1].type="data");return e},tokenize:function(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=wr(r);let o;return function(t){return o=t,e.enter("attentionSequence"),s(t)};function s(a){if(a===o)return e.consume(a),s;const l=e.exit("attentionSequence"),c=wr(a),u=!c||2===c&&i||n.includes(a),d=!i||2===i&&c||n.includes(r);return l._open=Boolean(42===o?u:u&&(i||!d)),l._close=Boolean(42===o?d:d&&(c||!u)),t(a)}}};function Nr(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Ir={name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i};function i(t){return ir(t)?(e.consume(t),o):64===t?n(t):l(t)}function o(e){return 43===e||45===e||46===e||or(e)?(r=1,s(e)):l(e)}function s(t){return 58===t?(e.consume(t),r=0,a):(43===t||45===t||46===t||or(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function a(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||ar(r)?n(r):(e.consume(r),a)}function l(t){return 64===t?(e.consume(t),c):sr(t)?(e.consume(t),l):n(t)}function c(e){return or(e)?u(e):n(e)}function u(n){return 46===n?(e.consume(n),r=0,c):62===n?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(n),e.exit("autolinkMarker"),e.exit("autolink"),t):d(n)}function d(t){if((45===t||or(t))&&r++<63){const n=45===t?d:u;return e.consume(t),n}return n(t)}}};var Sr={partial:!0,tokenize:function(e,t,n){return function(t){return pr(t)?yr(e,r,"linePrefix")(t):r(t)};function r(e){return null===e||dr(e)?t(e):n(e)}}};var Ar={continuation:{tokenize:function(e,t,n){const r=this;return function(t){return pr(t)?yr(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):i(t)};function i(r){return e.attempt(Ar,t,n)(r)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,n){const r=this;return function(t){if(62===t){const n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),i}return n(t)};function i(n){return pr(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}}};var Pr={name:"characterEscape",tokenize:function(e,t,n){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),r};function r(r){return ur(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}};var Er={name:"characterReference",tokenize:function(e,t,n){const r=this;let i,o,s=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),a};function a(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),i=31,o=or,c(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=cr,c):(e.enter("characterReferenceValue"),i=7,o=lr,c(t))}function c(a){if(59===a&&s){const i=e.exit("characterReferenceValue");return o!==or||Kn(r.sliceSerialize(i))?(e.enter("characterReferenceMarker"),e.consume(a),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(a)}return o(a)&&s++<i?(e.consume(a),c):n(a)}}};var Tr={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){return null===t?n(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},Mr={concrete:!0,name:"codeFenced",tokenize:function(e,t,n){const r=this,i={partial:!0,tokenize:function(e,t,n){let i=0;return s;function s(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),l}function l(t){return e.enter("codeFencedFence"),pr(t)?yr(e,c,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):c(t)}function c(t){return t===o?(e.enter("codeFencedFenceSequence"),u(t)):n(t)}function u(t){return t===o?(i++,e.consume(t),u):i>=a?(e.exit("codeFencedFenceSequence"),pr(t)?yr(e,d,"whitespace")(t):d(t)):n(t)}function d(r){return null===r||dr(r)?(e.exit("codeFencedFence"),t(r)):n(r)}}};let o,s=0,a=0;return function(t){return function(t){const n=r.events[r.events.length-1];return s=n&&"linePrefix"===n[1].type?n[2].sliceSerialize(n[1],!0).length:0,o=t,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),l(t)}(t)};function l(t){return t===o?(a++,e.consume(t),l):a<3?n(t):(e.exit("codeFencedFenceSequence"),pr(t)?yr(e,c,"whitespace")(t):c(t))}function c(n){return null===n||dr(n)?(e.exit("codeFencedFence"),r.interrupt?t(n):e.check(Tr,p,y)(n)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),u(n))}function u(t){return null===t||dr(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(t)):pr(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),yr(e,d,"whitespace")(t)):96===t&&t===o?n(t):(e.consume(t),u)}function d(t){return null===t||dr(t)?c(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),f(t))}function f(t){return null===t||dr(t)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(t)):96===t&&t===o?n(t):(e.consume(t),f)}function p(t){return e.attempt(i,y,m)(t)}function m(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),h}function h(t){return s>0&&pr(t)?yr(e,g,"linePrefix",s+1)(t):g(t)}function g(t){return null===t||dr(t)?e.check(Tr,p,y)(t):(e.enter("codeFlowValue"),x(t))}function x(t){return null===t||dr(t)?(e.exit("codeFlowValue"),g(t)):(e.consume(t),x)}function y(n){return e.exit("codeFenced"),t(n)}}};var Dr={name:"codeIndented",tokenize:function(e,t,n){const r=this;return function(t){return e.enter("codeIndented"),yr(e,i,"linePrefix",5)(t)};function i(e){const t=r.events[r.events.length-1];return t&&"linePrefix"===t[1].type&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return null===t?a(t):dr(t)?e.attempt(Lr,o,a)(t):(e.enter("codeFlowValue"),s(t))}function s(t){return null===t||dr(t)?(e.exit("codeFlowValue"),o(t)):(e.consume(t),s)}function a(n){return e.exit("codeIndented"),t(n)}}},Lr={partial:!0,tokenize:function(e,t,n){const r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):dr(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):yr(e,o,"linePrefix",5)(t)}function o(e){const o=r.events[r.events.length-1];return o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?t(e):dr(e)?i(e):n(e)}}};var Fr={name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,n,r=e.length-4,i=3;if(!("lineEnding"!==e[i][1].type&&"space"!==e[i][1].type||"lineEnding"!==e[r][1].type&&"space"!==e[r][1].type))for(t=i;++t<r;)if("codeTextData"===e[t][1].type){e[i][1].type="codeTextPadding",e[r][1].type="codeTextPadding",i+=2,r-=2;break}t=i-1,r++;for(;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):t!==r&&"lineEnding"!==e[t][1].type||(e[n][1].type="codeTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e},tokenize:function(e,t,n){let r,i,o=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),s(t)};function s(t){return 96===t?(e.consume(t),o++,s):(e.exit("codeTextSequence"),a(t))}function a(t){return null===t?n(t):32===t?(e.enter("space"),e.consume(t),e.exit("space"),a):96===t?(i=e.enter("codeTextSequence"),r=0,c(t)):dr(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a):(e.enter("codeTextData"),l(t))}function l(t){return null===t||32===t||96===t||dr(t)?(e.exit("codeTextData"),a(t)):(e.consume(t),l)}function c(n){return 96===n?(e.consume(n),r++,c):r===o?(e.exit("codeTextSequence"),e.exit("codeText"),t(n)):(i.type="codeTextData",l(n))}}};var Rr=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){const n=null==t?Number.POSITIVE_INFINITY:t;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){const r=t||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return n&&Or(this.left,n),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Or(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Or(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&0===this.right.length||e<0&&0===this.left.length))if(e<this.left.length){const t=this.left.splice(e,Number.POSITIVE_INFINITY);Or(this.right,t.reverse())}else{const t=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Or(this.left,t.reverse())}}};function Or(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 zr(e){const t={};let n,r,i,o,s,a,l,c=-1;const u=new Rr(e);for(;++c<u.length;){for(;c in t;)c=t[c];if(n=u.get(c),c&&"chunkFlow"===n[1].type&&"listItemPrefix"===u.get(c-1)[1].type&&(a=n[1]._tokenizer.events,i=0,i<a.length&&"lineEndingBlank"===a[i][1].type&&(i+=2),i<a.length&&"content"===a[i][1].type))for(;++i<a.length&&"content"!==a[i][1].type;)"chunkText"===a[i][1].type&&(a[i][1]._isInFirstContentOfListItem=!0,i++);if("enter"===n[0])n[1].contentType&&(Object.assign(t,_r(u,c)),c=t[c],l=!0);else if(n[1]._container){for(i=c,r=void 0;i--;)if(o=u.get(i),"lineEnding"===o[1].type||"lineEndingBlank"===o[1].type)"enter"===o[0]&&(r&&(u.get(r)[1].type="lineEndingBlank"),o[1].type="lineEnding",r=i);else if("linePrefix"!==o[1].type&&"listItemIndent"!==o[1].type)break;r&&(n[1].end={...u.get(r)[1].start},s=u.slice(r,c),s.unshift(n),u.splice(r,c-r+1,s))}}return Yn(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!l}function _r(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const o=[];let s=n._tokenizer;s||(s=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(s._contentTypeTextTrailing=!0));const a=s.events,l=[],c={};let u,d,f=-1,p=n,m=0,h=0;const g=[h];for(;p;){for(;e.get(++i)[1]!==p;);o.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&s.defineSkip(p.start),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(u),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<a.length;)"exit"===a[f][0]&&"enter"===a[f-1][0]&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(s.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){const t=a.slice(g[f],g[f+1]),n=o.pop();l.push([n,n+t.length-1]),e.splice(n,2,t)}for(l.reverse(),f=-1;++f<l.length;)c[m+l[f][0]]=m+l[f][1],m+=l[f][1]-l[f][0]-1;return c}var qr={resolve:function(e){return zr(e),e},tokenize:function(e,t){let n;return function(t){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(t)};function r(t){return null===t?i(t):dr(t)?e.check(Br,o,i)(t):(e.consume(t),r)}function i(n){return e.exit("chunkContent"),e.exit("content"),t(n)}function o(t){return e.consume(t),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}},Br={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),yr(e,i,"linePrefix")};function i(i){if(null===i||dr(i))return n(i);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}};function Ur(e,t,n,r,i,o,s,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return function(t){if(60===t)return e.enter(r),e.enter(i),e.enter(o),e.consume(t),e.exit(o),d;return null===t||32===t||41===t||ar(t)?n(t):(e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),m(t))};function d(n){return 62===n?(e.enter(o),e.consume(n),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),f(n))}function f(t){return 62===t?(e.exit("chunkString"),e.exit(a),d(t)):null===t||60===t||dr(t)?n(t):(e.consume(t),92===t?p:f)}function p(t){return 60===t||62===t||92===t?(e.consume(t),f):f(t)}function m(i){return u||null!==i&&41!==i&&!fr(i)?u<c&&40===i?(e.consume(i),u++,m):41===i?(e.consume(i),u--,m):null===i||32===i||40===i||ar(i)?n(i):(e.consume(i),92===i?h:m):(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),t(i))}function h(t){return 40===t||41===t||92===t?(e.consume(t),m):m(t)}}function Hr(e,t,n,r,i,o){const s=this;let a,l=0;return function(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(o),c};function c(d){return l>999||null===d||91===d||93===d&&!a||94===d&&!l&&"_hiddenFootnoteSupport"in s.parser.constructs?n(d):93===d?(e.exit(o),e.enter(i),e.consume(d),e.exit(i),e.exit(r),t):dr(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),u(d))}function u(t){return null===t||91===t||93===t||dr(t)||l++>999?(e.exit("chunkString"),c(t)):(e.consume(t),a||(a=!pr(t)),92===t?d:u)}function d(t){return 91===t||92===t||93===t?(e.consume(t),l++,u):u(t)}}function $r(e,t,n,r,i,o){let s;return function(t){if(34===t||39===t||40===t)return e.enter(r),e.enter(i),e.consume(t),e.exit(i),s=40===t?41:t,a;return n(t)};function a(n){return n===s?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(o),l(n))}function l(t){return t===s?(e.exit(o),a(s)):null===t?n(t):dr(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),yr(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(t))}function c(t){return t===s||null===t||dr(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?u:c)}function u(t){return t===s||92===t?(e.consume(t),c):c(t)}}function Vr(e,t){let n;return function r(i){if(dr(i))return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r;return pr(i)?yr(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}var Qr={name:"definition",tokenize:function(e,t,n){const r=this;let i;return function(t){return e.enter("definition"),function(t){return Hr.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(t)}(t)};function o(t){return i=rr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),s):n(t)}function s(t){return fr(t)?Vr(e,a)(t):a(t)}function a(t){return Ur(e,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(Wr,c,c)(t)}function c(t){return pr(t)?yr(e,u,"whitespace")(t):u(t)}function u(o){return null===o||dr(o)?(e.exit("definition"),r.parser.defined.push(i),t(o)):n(o)}}},Wr={partial:!0,tokenize:function(e,t,n){return function(t){return fr(t)?Vr(e,r)(t):n(t)};function r(t){return $r(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function i(t){return pr(t)?yr(e,o,"whitespace")(t):o(t)}function o(e){return null===e||dr(e)?t(e):n(e)}}};var Gr={name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return dr(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}};var Kr={name:"headingAtx",resolve:function(e,t){let n,r,i=e.length-2,o=3;"whitespace"===e[o][1].type&&(o+=2);i-2>o&&"whitespace"===e[i][1].type&&(i-=2);"atxHeadingSequence"===e[i][1].type&&(o===i-1||i-4>o&&"whitespace"===e[i-2][1].type)&&(i-=o+1===i?2:4);i>o&&(n={type:"atxHeadingText",start:e[o][1].start,end:e[i][1].end},r={type:"chunkText",start:e[o][1].start,end:e[i][1].end,contentType:"text"},Yn(e,o,i-o+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]]));return e},tokenize:function(e,t,n){let r=0;return function(t){return e.enter("atxHeading"),function(t){return e.enter("atxHeadingSequence"),i(t)}(t)};function i(t){return 35===t&&r++<6?(e.consume(t),i):null===t||fr(t)?(e.exit("atxHeadingSequence"),o(t)):n(t)}function o(n){return 35===n?(e.enter("atxHeadingSequence"),s(n)):null===n||dr(n)?(e.exit("atxHeading"),t(n)):pr(n)?yr(e,o,"whitespace")(n):(e.enter("atxHeadingText"),a(n))}function s(t){return 35===t?(e.consume(t),s):(e.exit("atxHeadingSequence"),o(t))}function a(t){return null===t||35===t||fr(t)?(e.exit("atxHeadingText"),o(t)):(e.consume(t),a)}}};var Yr=["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"],Xr=["pre","script","style","textarea"],Jr={concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2));return e},tokenize:function(e,t,n){const r=this;let i,o,s,a,l;return function(t){return function(t){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(t),c}(t)};function c(a){return 33===a?(e.consume(a),u):47===a?(e.consume(a),o=!0,p):63===a?(e.consume(a),i=3,r.interrupt?t:L):ir(a)?(e.consume(a),s=String.fromCharCode(a),m):n(a)}function u(o){return 45===o?(e.consume(o),i=2,d):91===o?(e.consume(o),i=5,a=0,f):ir(o)?(e.consume(o),i=4,r.interrupt?t:L):n(o)}function d(i){return 45===i?(e.consume(i),r.interrupt?t:L):n(i)}function f(i){return i==="CDATA[".charCodeAt(a++)?(e.consume(i),6===a?r.interrupt?t:I:f):n(i)}function p(t){return ir(t)?(e.consume(t),s=String.fromCharCode(t),m):n(t)}function m(a){if(null===a||47===a||62===a||fr(a)){const l=47===a,c=s.toLowerCase();return l||o||!Xr.includes(c)?Yr.includes(s.toLowerCase())?(i=6,l?(e.consume(a),h):r.interrupt?t(a):I(a)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(a):o?g(a):x(a)):(i=1,r.interrupt?t(a):I(a))}return 45===a||or(a)?(e.consume(a),s+=String.fromCharCode(a),m):n(a)}function h(i){return 62===i?(e.consume(i),r.interrupt?t:I):n(i)}function g(t){return pr(t)?(e.consume(t),g):C(t)}function x(t){return 47===t?(e.consume(t),C):58===t||95===t||ir(t)?(e.consume(t),y):pr(t)?(e.consume(t),x):C(t)}function y(t){return 45===t||46===t||58===t||95===t||or(t)?(e.consume(t),y):v(t)}function v(t){return 61===t?(e.consume(t),b):pr(t)?(e.consume(t),v):x(t)}function b(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),l=t,k):pr(t)?(e.consume(t),b):w(t)}function k(t){return t===l?(e.consume(t),l=null,j):null===t||dr(t)?n(t):(e.consume(t),k)}function w(t){return null===t||34===t||39===t||47===t||60===t||61===t||62===t||96===t||fr(t)?v(t):(e.consume(t),w)}function j(e){return 47===e||62===e||pr(e)?x(e):n(e)}function C(t){return 62===t?(e.consume(t),N):n(t)}function N(t){return null===t||dr(t)?I(t):pr(t)?(e.consume(t),N):n(t)}function I(t){return 45===t&&2===i?(e.consume(t),E):60===t&&1===i?(e.consume(t),T):62===t&&4===i?(e.consume(t),F):63===t&&3===i?(e.consume(t),L):93===t&&5===i?(e.consume(t),D):!dr(t)||6!==i&&7!==i?null===t||dr(t)?(e.exit("htmlFlowData"),S(t)):(e.consume(t),I):(e.exit("htmlFlowData"),e.check(Zr,R,S)(t))}function S(t){return e.check(ei,A,R)(t)}function A(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),P}function P(t){return null===t||dr(t)?S(t):(e.enter("htmlFlowData"),I(t))}function E(t){return 45===t?(e.consume(t),L):I(t)}function T(t){return 47===t?(e.consume(t),s="",M):I(t)}function M(t){if(62===t){const n=s.toLowerCase();return Xr.includes(n)?(e.consume(t),F):I(t)}return ir(t)&&s.length<8?(e.consume(t),s+=String.fromCharCode(t),M):I(t)}function D(t){return 93===t?(e.consume(t),L):I(t)}function L(t){return 62===t?(e.consume(t),F):45===t&&2===i?(e.consume(t),L):I(t)}function F(t){return null===t||dr(t)?(e.exit("htmlFlowData"),R(t)):(e.consume(t),F)}function R(n){return e.exit("htmlFlow"),t(n)}}},Zr={partial:!0,tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(Sr,t,n)}}},ei={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){if(dr(t))return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i;return n(t)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}};var ti={name:"htmlText",tokenize:function(e,t,n){const r=this;let i,o,s;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),a};function a(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),b):63===t?(e.consume(t),y):ir(t)?(e.consume(t),j):n(t)}function l(t){return 45===t?(e.consume(t),c):91===t?(e.consume(t),o=0,p):ir(t)?(e.consume(t),x):n(t)}function c(t){return 45===t?(e.consume(t),f):n(t)}function u(t){return null===t?n(t):45===t?(e.consume(t),d):dr(t)?(s=u,M(t)):(e.consume(t),u)}function d(t){return 45===t?(e.consume(t),f):u(t)}function f(e){return 62===e?T(e):45===e?d(e):u(e)}function p(t){return t==="CDATA[".charCodeAt(o++)?(e.consume(t),6===o?m:p):n(t)}function m(t){return null===t?n(t):93===t?(e.consume(t),h):dr(t)?(s=m,M(t)):(e.consume(t),m)}function h(t){return 93===t?(e.consume(t),g):m(t)}function g(t){return 62===t?T(t):93===t?(e.consume(t),g):m(t)}function x(t){return null===t||62===t?T(t):dr(t)?(s=x,M(t)):(e.consume(t),x)}function y(t){return null===t?n(t):63===t?(e.consume(t),v):dr(t)?(s=y,M(t)):(e.consume(t),y)}function v(e){return 62===e?T(e):y(e)}function b(t){return ir(t)?(e.consume(t),k):n(t)}function k(t){return 45===t||or(t)?(e.consume(t),k):w(t)}function w(t){return dr(t)?(s=w,M(t)):pr(t)?(e.consume(t),w):T(t)}function j(t){return 45===t||or(t)?(e.consume(t),j):47===t||62===t||fr(t)?C(t):n(t)}function C(t){return 47===t?(e.consume(t),T):58===t||95===t||ir(t)?(e.consume(t),N):dr(t)?(s=C,M(t)):pr(t)?(e.consume(t),C):T(t)}function N(t){return 45===t||46===t||58===t||95===t||or(t)?(e.consume(t),N):I(t)}function I(t){return 61===t?(e.consume(t),S):dr(t)?(s=I,M(t)):pr(t)?(e.consume(t),I):C(t)}function S(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),i=t,A):dr(t)?(s=S,M(t)):pr(t)?(e.consume(t),S):(e.consume(t),P)}function A(t){return t===i?(e.consume(t),i=void 0,E):null===t?n(t):dr(t)?(s=A,M(t)):(e.consume(t),A)}function P(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||fr(t)?C(t):(e.consume(t),P)}function E(e){return 47===e||62===e||fr(e)?C(e):n(e)}function T(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function M(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),D}function D(t){return pr(t)?yr(e,L,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):L(t)}function L(t){return e.enter("htmlTextData"),s(t)}}};var ni={name:"labelEnd",resolveAll:function(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),"labelImage"===r.type||"labelLink"===r.type||"labelEnd"===r.type){const e="labelImage"===r.type?4:2;r.type="data",t+=e}}e.length!==n.length&&Yn(e,0,e.length,n);return e},resolveTo:function(e,t){let n,r,i,o,s=e.length,a=0;for(;s--;)if(n=e[s][1],r){if("link"===n.type||"labelLink"===n.type&&n._inactive)break;"enter"===e[s][0]&&"labelLink"===n.type&&(n._inactive=!0)}else if(i){if("enter"===e[s][0]&&("labelImage"===n.type||"labelLink"===n.type)&&!n._balanced&&(r=s,"labelLink"!==n.type)){a=2;break}}else"labelEnd"===n.type&&(i=s);const l={type:"labelLink"===e[r][1].type?"link":"image",start:{...e[r][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[r][1].start},end:{...e[i][1].end}},u={type:"labelText",start:{...e[r+a+2][1].end},end:{...e[i-2][1].start}};return o=[["enter",l,t],["enter",c,t]],o=Xn(o,e.slice(r+1,r+a+3)),o=Xn(o,[["enter",u,t]]),o=Xn(o,jr(t.parser.constructs.insideSpan.null,e.slice(r+a+4,i-3),t)),o=Xn(o,[["exit",u,t],e[i-2],e[i-1],["exit",c,t]]),o=Xn(o,e.slice(i+1)),o=Xn(o,[["exit",l,t]]),Yn(e,r,e.length,o),e},tokenize:function(e,t,n){const r=this;let i,o,s=r.events.length;for(;s--;)if(("labelImage"===r.events[s][1].type||"labelLink"===r.events[s][1].type)&&!r.events[s][1]._balanced){i=r.events[s][1];break}return function(t){return i?i._inactive?u(t):(o=r.parser.defined.includes(rr(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),a):n(t)};function a(t){return 40===t?e.attempt(ri,c,o?c:u)(t):91===t?e.attempt(ii,c,o?l:u)(t):o?c(t):u(t)}function l(t){return e.attempt(oi,c,u)(t)}function c(e){return t(e)}function u(e){return i._balanced=!0,n(e)}}},ri={tokenize:function(e,t,n){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),r};function r(t){return fr(t)?Vr(e,i)(t):i(t)}function i(t){return 41===t?c(t):Ur(e,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function o(t){return fr(t)?Vr(e,a)(t):c(t)}function s(e){return n(e)}function a(t){return 34===t||39===t||40===t?$r(e,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):c(t)}function l(t){return fr(t)?Vr(e,c)(t):c(t)}function c(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),t):n(r)}}},ii={tokenize:function(e,t,n){const r=this;return function(t){return Hr.call(r,e,i,o,"reference","referenceMarker","referenceString")(t)};function i(e){return r.parser.defined.includes(rr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}},oi={tokenize:function(e,t,n){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),r};function r(r){return 93===r?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),t):n(r)}}};var si={name:"labelStartImage",resolveAll:ni.resolveAll,tokenize:function(e,t,n){const r=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),i};function i(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),o):n(t)}function o(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}};var ai={name:"labelStartLink",resolveAll:ni.resolveAll,tokenize:function(e,t,n){const r=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),i};function i(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}};var li={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),yr(e,t,"linePrefix")}}};var ci={name:"thematicBreak",tokenize:function(e,t,n){let r,i=0;return function(t){return e.enter("thematicBreak"),function(e){return r=e,o(e)}(t)};function o(o){return o===r?(e.enter("thematicBreakSequence"),s(o)):i>=3&&(null===o||dr(o))?(e.exit("thematicBreak"),t(o)):n(o)}function s(t){return t===r?(e.consume(t),i++,s):(e.exit("thematicBreakSequence"),pr(t)?yr(e,o,"whitespace")(t):o(t))}}};var ui={continuation:{tokenize:function(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Sr,i,o);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,yr(e,t,"listItemIndent",r.containerState.size+1)(n)}function o(n){return r.containerState.furtherBlankLines||!pr(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(fi,t,s)(n))}function s(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,yr(e,e.attempt(ui,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0,s=0;return function(t){const i=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===i?!r.containerState.marker||t===r.containerState.marker:lr(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),"listUnordered"===i)return e.enter("listItemPrefix"),42===t||45===t?e.check(ci,n,l)(t):l(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),a(t)}return n(t)};function a(t){return lr(t)&&++s<10?(e.consume(t),a):(!r.interrupt||s<2)&&(r.containerState.marker?t===r.containerState.marker:41===t||46===t)?(e.exit("listItemValue"),l(t)):n(t)}function l(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||t,e.check(Sr,r.interrupt?n:c,e.attempt(di,d,u))}function c(e){return r.containerState.initialBlankLine=!0,o++,d(e)}function u(t){return pr(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),d):n(t)}function d(n){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}}},di={partial:!0,tokenize:function(e,t,n){const r=this;return yr(e,function(e){const i=r.events[r.events.length-1];return!pr(e)&&i&&"listItemPrefixWhitespace"===i[1].type?t(e):n(e)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},fi={partial:!0,tokenize:function(e,t,n){const r=this;return yr(e,function(e){const i=r.events[r.events.length-1];return i&&"listItemIndent"===i[1].type&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)},"listItemIndent",r.containerState.size+1)}};var pi={name:"setextUnderline",resolveTo:function(e,t){let n,r,i,o=e.length;for(;o--;)if("enter"===e[o][0]){if("content"===e[o][1].type){n=o;break}"paragraph"===e[o][1].type&&(r=o)}else"content"===e[o][1].type&&e.splice(o,1),i||"definition"!==e[o][1].type||(i=o);const s={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};e[r][1].type="setextHeadingText",i?(e.splice(r,0,["enter",s,t]),e.splice(i+1,0,["exit",e[n][1],t]),e[n][1].end={...e[i][1].end}):e[n][1]=s;return e.push(["exit",s,t]),e},tokenize:function(e,t,n){const r=this;let i;return function(t){let s,a=r.events.length;for(;a--;)if("lineEnding"!==r.events[a][1].type&&"linePrefix"!==r.events[a][1].type&&"content"!==r.events[a][1].type){s="paragraph"===r.events[a][1].type;break}if(!r.parser.lazy[r.now().line]&&(r.interrupt||s))return e.enter("setextHeadingLine"),i=t,function(t){return e.enter("setextHeadingLineSequence"),o(t)}(t);return n(t)};function o(t){return t===i?(e.consume(t),o):(e.exit("setextHeadingLineSequence"),pr(t)?yr(e,s,"lineSuffix")(t):s(t))}function s(r){return null===r||dr(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}}};var mi={tokenize:function(e){const t=this,n=e.attempt(Sr,function(r){if(null===r)return void e.consume(r);return e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n},e.attempt(this.parser.constructs.flowInitial,r,yr(e,e.attempt(this.parser.constructs.flow,r,e.attempt(qr,r)),"linePrefix")));return n;function r(r){if(null!==r)return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n;e.consume(r)}}};var hi={resolveAll:vi()},gi=yi("string"),xi=yi("text");function yi(e){return{resolveAll:vi("text"===e?bi:void 0),tokenize:function(t){const n=this,r=this.parser.constructs[e],i=t.attempt(r,o,s);return o;function o(e){return l(e)?i(e):s(e)}function s(e){if(null!==e)return t.enter("data"),t.consume(e),a;t.consume(e)}function a(e){return l(e)?(t.exit("data"),i(e)):(t.consume(e),a)}function l(e){if(null===e)return!0;const t=r[e];let i=-1;if(t)for(;++i<t.length;){const e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}}function vi(e){return function(t,n){let r,i=-1;for(;++i<=t.length;)void 0===r?t[i]&&"data"===t[i][1].type&&(r=i,i++):t[i]&&"data"===t[i][1].type||(i!==r+2&&(t[r][1].end=t[i-1][1].end,t.splice(r+2,i-r-2),i=r+2),r=void 0);return e?e(t,n):t}}function bi(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||"lineEnding"===e[n][1].type)&&"data"===e[n-1][1].type){const r=e[n-1][1],i=t.sliceStream(r);let o,s=i.length,a=-1,l=0;for(;s--;){const e=i[s];if("string"==typeof e){for(a=e.length;32===e.charCodeAt(a-1);)l++,a--;if(a)break;a=-1}else if(-2===e)o=!0,l++;else if(-1!==e){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const i={type:n===e.length||o||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?a:r.start._bufferIndex+a,_index:r.start._index+s,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,["enter",i,t],["exit",i,t]),n+=2)}n++}return e}var ki=n({attentionMarkers:()=>Pi,contentInitial:()=>ji,disable:()=>Ei,document:()=>wi,flow:()=>Ni,flowInitial:()=>Ci,insideSpan:()=>Ai,string:()=>Ii,text:()=>Si}),wi={42:ui,43:ui,45:ui,48:ui,49:ui,50:ui,51:ui,52:ui,53:ui,54:ui,55:ui,56:ui,57:ui,62:Ar},ji={91:Qr},Ci={[-2]:Dr,[-1]:Dr,32:Dr},Ni={35:Kr,42:ci,45:[pi,ci],60:Jr,61:pi,95:ci,96:Mr,126:Mr},Ii={38:Er,92:Pr},Si={[-5]:li,[-4]:li,[-3]:li,33:si,38:Er,42:Cr,60:[Ir,ti],91:ai,92:[Gr,Pr],93:ni,95:Cr,96:Fr},Ai={null:[Cr,hi]},Pi={null:[42,95]},Ei={null:[]};function Ti(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 i={},o=[];let s=[],a=[];const l={attempt:g(function(e,t){x(e,t.from)}),check:g(h),consume:function(e){dr(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,y()):-1!==e&&(r.column++,r.offset++);r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++));c.previous=e},enter:function(e,t){const n=t||{};return n.type=e,n.start=f(),c.events.push(["enter",n,c]),a.push(n),n},exit:function(e){const t=a.pop();return t.end=f(),c.events.push(["exit",t,c]),t},interrupt:g(h,{interrupt:!0})},c={code:null,containerState:{},defineSkip:function(e){i[e.line]=e.column,y()},events:[],now:f,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const o=e[n];let s;if("string"==typeof o)s=o;else switch(o){case-5:s="\r";break;case-4:s="\n";break;case-3:s="\r\n";break;case-2:s=t?" ":"\t";break;case-1:if(!t&&i)continue;s=" ";break;default:s=String.fromCharCode(o)}i=-2===o,r.push(s)}return r.join("")}(d(e),t)},sliceStream:d,write:function(e){return s=Xn(s,e),p(),null!==s[s.length-1]?[]:(x(t,0),c.events=jr(o,c.events,c),c.events)}};let u=t.tokenize.call(c,l);return t.resolveAll&&o.push(t),c;function d(e){return function(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let s;if(n===i)s=[e[n].slice(r,o)];else{if(s=e.slice(n,i),r>-1){const e=s[0];"string"==typeof e?s[0]=e.slice(r):s.shift()}o>0&&s.push(e[i].slice(0,o))}return s}(s,e)}function f(){const{_bufferIndex:e,_index:t,line:n,column:i,offset:o}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:o}}function p(){let e;for(;r._index<s.length;){const t=s[r._index];if("string"==typeof t)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)m(t.charCodeAt(r._bufferIndex));else m(t)}}function m(e){u=u(e)}function h(e,t){t.restore()}function g(e,t){return function(n,i,o){let s,u,d,p;return Array.isArray(n)?m(n):"tokenize"in n?m([n]):function(e){return t;function t(t){const n=null!==t&&e[t],r=null!==t&&e.null;return m([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}(n);function m(e){return s=e,u=0,0===e.length?o:h(e[u])}function h(e){return function(n){p=function(){const e=f(),t=c.previous,n=c.currentConstruct,i=c.events.length,o=Array.from(a);return{from:i,restore:s};function s(){r=e,c.previous=t,c.currentConstruct=n,c.events.length=i,a=o,y()}}(),d=e,e.partial||(c.currentConstruct=e);return e.name&&c.parser.constructs.disable.null.includes(e.name)?x(n):e.tokenize.call(t?Object.assign(Object.create(c),t):c,l,g,x)(n)}}function g(t){return e(d,p),i}function x(e){return p.restore(),++u<s.length?h(s[u]):o}}}function x(e,t){e.resolveAll&&!o.includes(e)&&o.push(e),e.resolve&&Yn(c.events,t,c.events.length-t,e.resolve(c.events.slice(t),c)),e.resolveTo&&(c.events=e.resolveTo(c.events,c))}function y(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}var Mi=/[\0\t\n\r]/g;var Di=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Li(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){const e=n.charCodeAt(1),t=120===e||88===e;return nr(n.slice(t?2:1),t?16:10)}return Kn(n)||e}var Fi={}.hasOwnProperty;function Ri(e,t,n){return t&&"object"==typeof t&&(n=t,t=void 0),function(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(te),autolinkProtocol:N,autolinkEmail:N,atxHeading:o(X),blockQuote:o(Q),characterEscape:N,characterReference:N,codeFenced:o(W),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:o(W,s),codeText:o(G,s),codeTextData:N,data:N,codeFlowValue:N,definition:o(K),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:o(Y),hardBreakEscape:o(J),hardBreakTrailing:o(J),htmlFlow:o(Z,s),htmlFlowData:N,htmlText:o(Z,s),htmlTextData:N,image:o(ee),label:s,link:o(te),listItem:o(re),listItemValue:f,listOrdered:o(ne,d),listUnordered:o(ne),paragraph:o(ie),reference:_,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:o(X),strong:o(oe),thematicBreak:o(ae)},exit:{atxHeading:l(),atxHeadingSequence:k,autolink:l(),autolinkEmail:V,autolinkProtocol:$,blockQuote:l(),characterEscapeValue:I,characterReferenceMarkerHexadecimal:B,characterReferenceMarkerNumeric:B,characterReferenceValue:U,characterReference:H,codeFenced:l(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:I,codeIndented:l(x),codeText:l(T),codeTextData:I,data:I,definition:l(),definitionDestinationString:b,definitionLabelString:y,definitionTitleString:v,emphasis:l(),hardBreakEscape:l(A),hardBreakTrailing:l(A),htmlFlow:l(P),htmlFlowData:I,htmlText:l(E),htmlTextData:I,image:l(D),label:F,labelText:L,lineEnding:S,link:l(M),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:q,resourceDestinationString:R,resourceTitleString:O,resource:z,setextHeading:l(C),setextHeadingLineSequence:j,setextHeadingText:w,strong:l(),thematicBreak:l()}};zi(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(e){let r={type:"root",children:[]};const o={stack:[r],tokenStack:[],config:t,enter:a,exit:c,buffer:s,resume:u,data:n},l=[];let d=-1;for(;++d<e.length;)"listOrdered"!==e[d][1].type&&"listUnordered"!==e[d][1].type||("enter"===e[d][0]?l.push(d):d=i(e,l.pop(),d));for(d=-1;++d<e.length;){const n=t[e[d][0]];Fi.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},o),e[d][1])}if(o.tokenStack.length>0){const e=o.tokenStack[o.tokenStack.length-1];(e[1]||qi).call(o,void 0,e[0])}for(r.position={start:Oi(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Oi(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r,i,o,s,a=t-1,l=-1,c=!1;for(;++a<=n;){const t=e[a];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?l++:l--,s=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(!r||s||l||o||(o=a),s=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:s=void 0}if(!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(r){let s=a;for(i=void 0;s--;){const t=e[s];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;i&&(e[i][1].type="lineEndingBlank",c=!0),t[1].type="lineEnding",i=s}else if("linePrefix"!==t[1].type&&"blockQuotePrefix"!==t[1].type&&"blockQuotePrefixWhitespace"!==t[1].type&&"blockQuoteMarker"!==t[1].type&&"listItemIndent"!==t[1].type)break}o&&(!i||o<i)&&(r._spread=!0),r.end=Object.assign({},i?e[i][1].start:t[1].end),e.splice(i||a,0,["exit",r,t[2]]),a++,n++}if("listItemPrefix"===t[1].type){const i={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};r=i,e.splice(a,0,["enter",i,t[2]]),a++,n++,o=void 0,s=!0}}}return e[t][1]._spread=c,n}function o(e,t){return n;function n(n){a.call(this,e(n),n),t&&t.call(this,n)}}function s(){this.stack.push({type:"fragment",children:[]})}function a(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:Oi(t.start),end:void 0}}function l(e){return t;function t(t){e&&e.call(this,t),c.call(this,t)}}function c(e,t){const n=this.stack.pop(),r=this.tokenStack.pop();if(!r)throw new Error("Cannot close `"+e.type+"` ("+kn({start:e.start,end:e.end})+"): it’s not open");r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||qi).call(this,e,r[0])),n.position.end=Oi(e.end)}function u(){return Vn(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){const e=this.resume();this.stack[this.stack.length-1].lang=e}function m(){const e=this.resume();this.stack[this.stack.length-1].meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}function y(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=rr(this.sliceSerialize(e)).toLowerCase()}function v(){const e=this.resume();this.stack[this.stack.length-1].title=e}function b(){const e=this.resume();this.stack[this.stack.length-1].url=e}function k(e){const t=this.stack[this.stack.length-1];t.depth||(t.depth=this.sliceSerialize(e).length)}function w(){this.data.setextHeadingSlurpLineEnding=!0}function j(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2}function C(){this.data.setextHeadingSlurpLineEnding=void 0}function N(e){const t=this.stack[this.stack.length-1].children;let n=t[t.length-1];n&&"text"===n.type||(n=se(),n.position={start:Oi(e.start),end:void 0},t.push(n)),this.stack.push(n)}function I(e){const t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=Oi(e.end)}function S(e){const n=this.stack[this.stack.length-1];if(this.data.atHardBreak){return n.children[n.children.length-1].position.end=Oi(e.end),void(this.data.atHardBreak=void 0)}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(N.call(this,e),I.call(this,e))}function A(){this.data.atHardBreak=!0}function P(){const e=this.resume();this.stack[this.stack.length-1].value=e}function E(){const e=this.resume();this.stack[this.stack.length-1].value=e}function T(){const e=this.resume();this.stack[this.stack.length-1].value=e}function M(){const e=this.stack[this.stack.length-1];if(this.data.inReference){const t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function D(){const e=this.stack[this.stack.length-1];if(this.data.inReference){const t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function L(e){const t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=function(e){return e.replace(Di,Li)}(t),n.identifier=rr(t).toLowerCase()}function F(){const e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,"link"===n.type?n.children=e.children:n.alt=t}function R(){const e=this.resume();this.stack[this.stack.length-1].url=e}function O(){const e=this.resume();this.stack[this.stack.length-1].title=e}function z(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function q(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=rr(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"}function B(e){this.data.characterReferenceType=e.type}function U(e){const t=this.sliceSerialize(e),n=this.data.characterReferenceType;let r;n?(r=nr(t,"characterReferenceMarkerNumeric"===n?10:16),this.data.characterReferenceType=void 0):r=Kn(t);this.stack[this.stack.length-1].value+=r}function H(e){this.stack.pop().position.end=Oi(e.end)}function $(e){I.call(this,e);this.stack[this.stack.length-1].url=this.sliceSerialize(e)}function V(e){I.call(this,e);this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)}function Q(){return{type:"blockquote",children:[]}}function W(){return{type:"code",lang:null,meta:null,value:""}}function G(){return{type:"inlineCode",value:""}}function K(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Y(){return{type:"emphasis",children:[]}}function X(){return{type:"heading",depth:0,children:[]}}function J(){return{type:"break"}}function Z(){return{type:"html",value:""}}function ee(){return{type:"image",title:null,url:"",alt:null}}function te(){return{type:"link",title:null,url:"",children:[]}}function ne(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}function re(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}function ie(){return{type:"paragraph",children:[]}}function oe(){return{type:"strong",children:[]}}function se(){return{type:"text",value:""}}function ae(){return{type:"thematicBreak"}}}(n)(function(e){for(;!zr(e););return e}(function(e){const t={constructs:Zn([ki,...(e||{}).extensions||[]]),content:n(vr),defined:[],document:n(br),flow:n(mi),lazy:{},string:n(gi),text:n(xi)};return t;function n(e){return function(n){return Ti(t,e,n)}}}(n).document().write(function(){let e,t=1,n="",r=!0;return function(i,o,s){const a=[];let l,c,u,d,f;for(i=n+("string"==typeof i?i.toString():new TextDecoder(o||void 0).decode(i)),u=0,n="",r&&(65279===i.charCodeAt(0)&&u++,r=void 0);u<i.length;){if(Mi.lastIndex=u,l=Mi.exec(i),d=l&&void 0!==l.index?l.index:i.length,f=i.charCodeAt(d),!l){n=i.slice(u);break}if(10===f&&u===d&&e)a.push(-3),e=void 0;else switch(e&&(a.push(-5),e=void 0),u<d&&(a.push(i.slice(u,d)),t+=d-u),f){case 0:a.push(65533),t++;break;case 9:for(c=4*Math.ceil(t/4),a.push(-2);t++<c;)a.push(-1);break;case 10:a.push(-4),t=1;break;default:e=!0,t=1}u=d+1}return s&&(e&&a.push(-5),n&&a.push(n),a.push(null)),a}}()(e,t,!0))))}function Oi(e){return{line:e.line,column:e.column,offset:e.offset}}function zi(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?zi(e,r):_i(e,r)}}function _i(e,t){let n;for(n in t)if(Fi.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 qi(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+kn({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+kn({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+kn({start:t.start,end:t.end})+") is still open")}function Bi(e){const t=this;t.parser=function(n){return Ri(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Ui(e,t){const n=t.referenceType;let r="]";if("collapsed"===n?r+="[]":"full"===n&&(r+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),o=i[0];o&&"text"===o.type?o.value="["+o.value:i.unshift({type:"text",value:"["});const s=i[i.length-1];return s&&"text"===s.type?s.value+=r:i.push({type:"text",value:r}),i}function Hi(e){const t=e.spread;return null==t?e.children.length>1:t}function $i(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const o=[];for(;r;)o.push(Vi(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return o.push(Vi(t.slice(i),i>0,!1)),o.join("")}function Vi(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;9===t||32===t;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;9===t||32===t;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}var Qi={blockquote:function(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)},break:function(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:"\n"}]},code:function(e,t){const n=t.value?t.value+"\n":"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o},delete:function(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},emphasis:function(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:function(e,t){const n="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=xr(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let s,a=e.footnoteCounts.get(r);void 0===a?(a=0,e.footnoteOrder.push(r),s=e.footnoteOrder.length):s=o+1,a+=1,e.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(s)}]};e.patch(t,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)},heading:function(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},html:function(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}},imageReference:function(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Ui(e,t);const i={src:xr(r.url||""),alt:t.alt};null!==r.title&&void 0!==r.title&&(i.title=r.title);const o={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,o),e.applyData(t,o)},image:function(e,t){const n={src:xr(t.url)};null!==t.alt&&void 0!==t.alt&&(n.alt=t.alt),null!==t.title&&void 0!==t.title&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)},inlineCode:function(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)},linkReference:function(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Ui(e,t);const i={href:xr(r.url||"")};null!==r.title&&void 0!==r.title&&(i.title=r.title);const o={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)},link:function(e,t){const n={href:xr(t.url)};null!==t.title&&void 0!==t.title&&(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)},listItem:function(e,t,n){const r=e.all(t),i=n?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=Hi(n[r])}return t}(n):Hi(t),o={},s=[];if("boolean"==typeof t.checked){const e=r[0];let n;e&&"element"===e.type&&"p"===e.tagName?n=e:(n={type:"element",tagName:"p",properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:"text",value:" "}),n.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const e=r[a];(i||0!==a||"element"!==e.type||"p"!==e.tagName)&&s.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||i?s.push(e):s.push(...e.children)}const l=r[r.length-1];l&&(i||"element"!==l.type||"p"!==l.tagName)&&s.push({type:"text",value:"\n"});const c={type:"element",tagName:"li",properties:o,children:s};return e.patch(t,c),e.applyData(t,c)},list:function(e,t){const n={},r=e.all(t);let i=-1;for("number"==typeof t.start&&1!==t.start&&(n.start=t.start);++i<r.length;){const e=r[i];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)},paragraph:function(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},root:function(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)},strong:function(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},table:function(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const n={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){const r={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=vn(t.children[1]),s=yn(t.children[t.children.length-1]);o&&s&&(r.position={start:o,end:s}),i.push(r)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)},tableCell:function(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},tableRow:function(e,t,n){const r=n?n.children:void 0,i=0===(r?r.indexOf(t):1)?"th":"td",o=n&&"table"===n.type?n.align:void 0,s=o?o.length:t.children.length;let a=-1;const l=[];for(;++a<s;){const n=t.children[a],r={},s=o?o[a]:void 0;s&&(r.align=s);let c={type:"element",tagName:i,properties:r,children:[]};n&&(c.children=e.all(n),e.patch(n,c),c=e.applyData(n,c)),l.push(c)}const c={type:"element",tagName:"tr",properties:{},children:e.wrap(l,!0)};return e.patch(t,c),e.applyData(t,c)},text:function(e,t){const n={type:"text",value:$i(String(t.value))};return e.patch(t,n),e.applyData(t,n)},thematicBreak:function(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)},toml:Wi,yaml:Wi,definition:Wi,footnoteDefinition:Wi};function Wi(){}var Gi="object"==typeof self?self:globalThis,Ki=(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 Gi[e](t)},Yi=e=>((e,t)=>{const n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);const[o,s]=t[i];switch(o){case 0:case-1:return n(s,i);case 1:{const e=n([],i);for(const t of s)e.push(r(t));return e}case 2:{const e=n({},i);for(const[t,n]of s)e[r(t)]=r(n);return e}case 3:return n(new Date(s),i);case 4:{const{source:e,flags:t}=s;return n(new RegExp(e,t),i)}case 5:{const e=n(new Map,i);for(const[t,n]of s)e.set(r(t),r(n));return e}case 6:{const e=n(new Set,i);for(const t of s)e.add(r(t));return e}case 7:{const{name:e,message:t}=s;return n(Ki(e,t),i)}case 8:return n(BigInt(s),i);case"BigInt":return n(Object(BigInt(s)),i);case"ArrayBuffer":return n(new Uint8Array(s).buffer,s);case"DataView":{const{buffer:e}=new Uint8Array(s);return n(new DataView(e),s)}}return n(Ki(o,s),i)};return r})(new Map,e)(0),Xi="",{toString:Ji}={},{keys:Zi}=Object,eo=e=>{const t=typeof e;if("object"!==t||!e)return[0,t];const n=Ji.call(e).slice(8,-1);switch(n){case"Array":return[1,Xi];case"Object":return[2,Xi];case"Date":return[3,Xi];case"RegExp":return[4,Xi];case"Map":return[5,Xi];case"Set":return[6,Xi];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},to=([e,t])=>0===e&&("function"===t||"symbol"===t),no=(e,{json:t,lossy:n}={})=>{const r=[];return((e,t,n,r)=>{const i=(e,t)=>{const i=r.push(e)-1;return n.set(t,i),i},o=r=>{if(n.has(r))return n.get(r);let[s,a]=eo(r);switch(s){case 0:{let t=r;switch(a){case"bigint":s=8,t=r.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+a);t=null;break;case"undefined":return i([-1],r)}return i([s,t],r)}case 1:{if(a){let e=r;return"DataView"===a?e=new Uint8Array(r.buffer):"ArrayBuffer"===a&&(e=new Uint8Array(r)),i([a,[...e]],r)}const e=[],t=i([s,e],r);for(const n of r)e.push(o(n));return t}case 2:{if(a)switch(a){case"BigInt":return i([a,r.toString()],r);case"Boolean":case"Number":case"String":return i([a,r.valueOf()],r)}if(t&&"toJSON"in r)return o(r.toJSON());const n=[],l=i([s,n],r);for(const t of Zi(r))!e&&to(eo(r[t]))||n.push([o(t),o(r[t])]);return l}case 3:return i([s,r.toISOString()],r);case 4:{const{source:e,flags:t}=r;return i([s,{source:e,flags:t}],r)}case 5:{const t=[],n=i([s,t],r);for(const[i,s]of r)(e||!to(eo(i))&&!to(eo(s)))&&t.push([o(i),o(s)]);return n}case 6:{const t=[],n=i([s,t],r);for(const i of r)!e&&to(eo(i))||t.push(o(i));return n}}const{message:l}=r;return i([s,{name:a,message:l}],r)};return o})(!(t||n),!!t,new Map,r)(e),r},ro="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?Yi(no(e,t)):structuredClone(e):(e,t)=>Yi(no(e,t));function io(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function oo(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}var so=function(e){if(null==e)return lo;if("function"==typeof e)return ao(e);if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=so(e[n]);return ao(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}(e):function(e){const t=e;return ao(n);function n(n){const r=n;let i;for(i in e)if(r[i]!==t[i])return!1;return!0}}(e);if("string"==typeof e)return function(e){return ao(t);function t(t){return t&&t.type===e}}(e);throw new Error("Expected function, string, or object as test")};function ao(e){return function(t,n,r){return Boolean(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof n?n:void 0,r||void 0))}}function lo(){return!0}var co=[];function uo(e,t,n,r){let i;"function"==typeof t&&"function"!=typeof n?(r=n,n=t):i=t;const o=so(i),s=r?-1:1;!function e(i,a,l){const c=i&&"object"==typeof i?i:{};if("string"==typeof c.type){const e="string"==typeof c.tagName?c.tagName:"string"==typeof c.name?c.name:void 0;Object.defineProperty(u,"name",{value:"node ("+i.type+(e?"<"+e+">":"")+")"})}return u;function u(){let c,u,d,f=co;if((!t||o(i,a,l[l.length-1]||void 0))&&(f=function(e){return Array.isArray(e)?e:"number"==typeof e?[!0,e]:null==e?co:[e]}(n(i,l)),!1===f[0]))return f;if("children"in i&&i.children){const t=i;if(t.children&&"skip"!==f[0])for(u=(r?t.children.length:-1)+s,d=l.concat(t);u>-1&&u<t.children.length;){const n=t.children[u];if(c=e(n,u,d)(),!1===c[0])return c;u="number"==typeof c[1]?c[1]:u+s}}return f}}(e,void 0,[])()}function fo(e,t,n,r){let i,o,s;"function"==typeof t&&"function"!=typeof n?(o=void 0,s=t,i=n):(o=t,s=n,i=r),uo(e,o,function(e,t){const n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return s(e,r,n)},i)}var po={}.hasOwnProperty,mo={};function ho(e,t){const n=t||mo,r=new Map,i=new Map,o={all:function(e){const t=[];if("children"in e){const n=e.children;let r=-1;for(;++r<n.length;){const i=o.one(n[r],e);if(i){if(r&&"break"===n[r-1].type&&(Array.isArray(i)||"text"!==i.type||(i.value=bo(i.value)),!Array.isArray(i)&&"element"===i.type)){const e=i.children[0];e&&"text"===e.type&&(e.value=bo(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t},applyData:xo,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...Qi,...n.handlers},one:function(e,t){const n=e.type,r=o.handlers[n];if(po.call(o.handlers,n)&&r)return r(o,e,t);if(o.options.passThrough&&o.options.passThrough.includes(n)){if("children"in e){const{children:t,...n}=e,r=ro(n);return r.children=o.all(e),r}return ro(e)}return(o.options.unknownHandler||yo)(o,e,t)},options:n,patch:go,wrap:vo};return fo(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){const t="definition"===e.type?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),o}function go(e,t){e.position&&(t.position=function(e){const t=vn(e),n=yn(e);if(t&&n)return{start:t,end:n}}(e))}function xo(e,t){let n=t;if(e&&e.data){const t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;"string"==typeof t&&("element"===n.type?n.tagName=t:n={type:"element",tagName:t,properties:{},children:"children"in n?n.children:[n]}),"element"===n.type&&i&&Object.assign(n.properties,ro(i)),"children"in n&&n.children&&null!=r&&(n.children=r)}return n}function yo(e,t){const n=t.data||{},r=!("value"in t)||po.call(n,"hProperties")||po.call(n,"hChildren")?{type:"element",tagName:"div",properties:{},children:e.all(t)}:{type:"text",value:t.value};return e.patch(t,r),e.applyData(t,r)}function vo(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:"\n"});++r<e.length;)r&&n.push({type:"text",value:"\n"}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:"\n"}),n}function bo(e){let t=0,n=e.charCodeAt(t);for(;9===n||32===n;)t++,n=e.charCodeAt(t);return e.slice(t)}function ko(e,t){const n=ho(e,t),r=n.one(e,void 0),i=function(e){const t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||io,r=e.options.footnoteBackLabel||oo,i=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",s=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<e.footnoteOrder.length;){const i=e.footnoteById.get(e.footnoteOrder[l]);if(!i)continue;const o=e.all(i),s=String(i.identifier).toUpperCase(),c=xr(s.toLowerCase());let u=0;const d=[],f=e.footnoteCounts.get(s);for(;void 0!==f&&++u<=f;){d.length>0&&d.push({type:"text",value:" "});let e="string"==typeof n?n:n(l,u);"string"==typeof e&&(e={type:"text",value:e}),d.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+c+(u>1?"-"+u:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof r?r:r(l,u),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}const p=o[o.length-1];if(p&&"element"===p.type&&"p"===p.tagName){const e=p.children[p.children.length-1];e&&"text"===e.type?e.value+=" ":p.children.push({type:"text",value:" "}),p.children.push(...d)}else o.push(...d);const m={type:"element",tagName:"li",properties:{id:t+"fn-"+c},children:e.wrap(o,!0)};e.patch(i,m),a.push(m)}if(0!==a.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...ro(s),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:"\n"}]}}(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:"\n"},i),o}function wo(e,t){return e&&"run"in e?async function(n,r){const i=ko(n,{file:r,...t});await e.run(i,r)}:function(n,r){return ko(n,{file:r,...e||t})}}function jo(e){if(e)throw e}var Co=t((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===r.call(e)},a=function(e){if(!e||"[object Object]"!==r.call(e))return!1;var t,i=n.call(e,"constructor"),o=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!i&&!o)return!1;for(t in e);return void 0===t||n.call(e,t)},l=function(e,t){i&&"__proto__"===t.name?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},c=function(e,t){if("__proto__"===t){if(!n.call(e,t))return;if(o)return o(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,o,u,d=arguments[0],f=1,p=arguments.length,m=!1;for("boolean"==typeof d&&(m=d,d=arguments[1]||{},f=2),(null==d||"object"!=typeof d&&"function"!=typeof d)&&(d={});f<p;++f)if(null!=(t=arguments[f]))for(n in t)r=c(d,n),d!==(i=c(t,n))&&(m&&i&&(a(i)||(o=s(i)))?(o?(o=!1,u=r&&s(r)?r:[]):u=r&&a(r)?r:{},l(d,{name:n,newValue:e(m,u,i)})):void 0!==i&&l(d,{name:n,newValue:i}));return d}});function No(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)}function Io(){const e=[],t={run:function(...t){let n=-1;const r=t.pop();if("function"!=typeof r)throw new TypeError("Expected function as last argument, not "+r);!function i(o,...s){const a=e[++n];let l=-1;if(o)r(o);else{for(;++l<t.length;)null!==s[l]&&void 0!==s[l]||(s[l]=t[l]);t=s,a?function(e,t){let n;return r;function r(...t){const r=e.length>t.length;let a;r&&t.push(i);try{a=e.apply(this,t)}catch(o){if(r&&n)throw o;return i(o)}r||(a&&a.then&&"function"==typeof a.then?a.then(s,i):a instanceof Error?i(a):s(a))}function i(e,...r){n||(n=!0,t(e,...r))}function s(e){i(null,e)}}(a,i)(...s):r(null,...s)}}(null,...t)},use:function(n){if("function"!=typeof n)throw new TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}var So={basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');Ao(e);let n,r=0,i=-1,o=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;o--;)if(47===e.codePointAt(o)){if(n){r=o+1;break}}else i<0&&(n=!0,i=o+1);return i<0?"":e.slice(r,i)}if(t===e)return"";let s=-1,a=t.length-1;for(;o--;)if(47===e.codePointAt(o)){if(n){r=o+1;break}}else s<0&&(n=!0,s=o+1),a>-1&&(e.codePointAt(o)===t.codePointAt(a--)?a<0&&(i=o):(a=-1,i=s));r===i?i=s:i<0&&(i=e.length);return e.slice(r,i)},dirname:function(e){if(Ao(e),0===e.length)return".";let t,n=-1,r=e.length;for(;--r;)if(47===e.codePointAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.codePointAt(0)?"/":".":1===n&&47===e.codePointAt(0)?"//":e.slice(0,n)},extname:function(e){Ao(e);let t,n=e.length,r=-1,i=0,o=-1,s=0;for(;n--;){const a=e.codePointAt(n);if(47!==a)r<0&&(t=!0,r=n+1),46===a?o<0?o=n:1!==s&&(s=1):o>-1&&(s=-1);else if(t){i=n+1;break}}return o<0||r<0||0===s||1===s&&o===r-1&&o===i+1?"":e.slice(o,r)},join:function(...e){let t,n=-1;for(;++n<e.length;)Ao(e[n]),e[n]&&(t=void 0===t?e[n]:t+"/"+e[n]);return void 0===t?".":function(e){Ao(e);const t=47===e.codePointAt(0);let n=function(e,t){let n,r,i="",o=0,s=-1,a=0,l=-1;for(;++l<=e.length;){if(l<e.length)n=e.codePointAt(l);else{if(47===n)break;n=47}if(47===n){if(s===l-1||1===a);else if(s!==l-1&&2===a){if(i.length<2||2!==o||46!==i.codePointAt(i.length-1)||46!==i.codePointAt(i.length-2))if(i.length>2){if(r=i.lastIndexOf("/"),r!==i.length-1){r<0?(i="",o=0):(i=i.slice(0,r),o=i.length-1-i.lastIndexOf("/")),s=l,a=0;continue}}else if(i.length>0){i="",o=0,s=l,a=0;continue}t&&(i=i.length>0?i+"/..":"..",o=2)}else i.length>0?i+="/"+e.slice(s+1,l):i=e.slice(s+1,l),o=l-s-1;s=l,a=0}else 46===n&&a>-1?a++:a=-1}return i}(e,!t);0!==n.length||t||(n=".");n.length>0&&47===e.codePointAt(e.length-1)&&(n+="/");return t?"/"+n:n}(t)},sep:"/"};function Ao(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}var Po={cwd:function(){return"/"}};function Eo(e){return Boolean(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}function To(e){if("string"==typeof e)e=new URL(e);else if(!Eo(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if("file:"!==e.protocol){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){const e=new TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}const t=e.pathname;let n=-1;for(;++n<t.length;)if(37===t.codePointAt(n)&&50===t.codePointAt(n+1)){const e=t.codePointAt(n+2);if(70===e||102===e){const e=new TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}var Mo=["history","path","basename","stem","extname","dirname"],Do=class{constructor(e){let t;t=e?Eo(e)?{path:e}:"string"==typeof e||function(e){return Boolean(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":Po.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n,r=-1;for(;++r<Mo.length;){const e=Mo[r];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(n in t)Mo.includes(n)||(this[n]=t[n])}get basename(){return"string"==typeof this.path?So.basename(this.path):void 0}set basename(e){Fo(e,"basename"),Lo(e,"basename"),this.path=So.join(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?So.dirname(this.path):void 0}set dirname(e){Ro(this.basename,"dirname"),this.path=So.join(e||"",this.basename)}get extname(){return"string"==typeof this.path?So.extname(this.path):void 0}set extname(e){if(Lo(e,"extname"),Ro(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=So.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Eo(e)&&(e=To(e)),Fo(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?So.basename(this.path,this.extname):void 0}set stem(e){Fo(e,"stem"),Lo(e,"stem"),this.path=So.join(this.dirname||"",e+(this.extname||""))}fail(e,t,n){const r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){const r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){const r=new Nn(e,t,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(e||void 0).decode(this.value)}};function Lo(e,t){if(e&&e.includes(So.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+So.sep+"`")}function Fo(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Ro(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}var Oo=function(e){const t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r},zo=i(Co(),1),_o={}.hasOwnProperty,qo=(new class e extends Oo{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Io()}copy(){const t=new e;let n=-1;for(;++n<this.attachers.length;){const e=this.attachers[n];t.use(...e)}return t.data((0,zo.default)(!0,{},this.namespace)),t}data(e,t){return"string"==typeof e?2===arguments.length?(Ho("data",this.frozen),this.namespace[e]=t,this):_o.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Ho("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[t,...n]=this.attachers[this.freezeIndex];if(!1===n[0])continue;!0===n[0]&&(n[0]=void 0);const r=t.call(e,...n);"function"==typeof r&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const t=Qo(e),n=this.parser||this.Parser;return Bo("parse",n),n(String(t),t)}process(e,t){const n=this;return this.freeze(),Bo("process",this.parser||this.Parser),Uo("process",this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){const o=Qo(e),s=n.parse(o);function a(e,n){e||!n?i(e):r?r(n):t(void 0,n)}n.run(s,o,function(e,t,r){if(e||!t||!r)return a(e);const i=t,o=n.stringify(i,r);var s;"string"==typeof(s=o)||function(e){return Boolean(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(s)?r.value=o:r.result=o,a(e,r)})}}processSync(e){let t,n=!1;return this.freeze(),Bo("processSync",this.parser||this.Parser),Uo("processSync",this.compiler||this.Compiler),this.process(e,function(e,r){n=!0,jo(e),t=r}),Vo("processSync","process",n),t}run(e,t,n){$o(e),this.freeze();const r=this.transformers;return n||"function"!=typeof t||(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,o){const s=Qo(t);r.run(e,s,function(t,r,s){const a=r||e;t?o(t):i?i(a):n(void 0,a,s)})}}runSync(e,t){let n,r=!1;return this.run(e,t,function(e,t){jo(e),n=t,r=!0}),Vo("runSync","run",r),n}stringify(e,t){this.freeze();const n=Qo(t),r=this.compiler||this.Compiler;return Uo("stringify",r),$o(e),r(e,n)}use(e,...t){const n=this.attachers,r=this.namespace;if(Ho("use",this.frozen),null==e);else if("function"==typeof e)a(e,t);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");Array.isArray(e)?s(e):o(e)}return this;function i(e){if("function"==typeof e)a(e,[]);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");if(Array.isArray(e)){const[t,...n]=e;a(t,n)}else o(e)}}function o(e){if(!("plugins"in e)&&!("settings"in e))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");s(e.plugins),e.settings&&(r.settings=(0,zo.default)(!0,r.settings,e.settings))}function s(e){let t=-1;if(null==e);else{if(!Array.isArray(e))throw new TypeError("Expected a list of plugins, not `"+e+"`");for(;++t<e.length;){i(e[t])}}}function a(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(-1===i)n.push([e,...t]);else if(t.length>0){let[r,...o]=t;const s=n[i][1];No(s)&&No(r)&&(r=(0,zo.default)(!0,s,r)),n[i]=[e,r,...o]}}}}).freeze();function Bo(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `parser`")}function Uo(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ho(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function $o(e){if(!No(e)||"string"!=typeof e.type)throw new TypeError("Expected node, got `"+e+"`")}function Vo(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Qo(e){return function(e){return Boolean(e&&"object"==typeof e&&"message"in e&&"messages"in e)}(e)?e:new Do(e)}var Wo=[],Go={allowDangerousHtml:!0},Ko=/^(https?|ircs?|mailto|xmpp)$/i,Yo=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Xo(e){const t=function(e){const t=e.rehypePlugins||Wo,n=e.remarkPlugins||Wo,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Go}:Go;return qo().use(Bi).use(n).use(wo,r).use(t)}(e),n=function(e){const t=e.children||"",n=new Do;"string"==typeof t&&(n.value=t);return n}(e);return function(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,o=t.disallowedElements,s=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||Jo;for(const u of Yo)Object.hasOwn(t,u.from)&&(u.from,u.to&&u.to,u.id);return fo(e,c),Dn(e,{Fragment:Te.Fragment,components:i,ignoreInvalidStyle:!0,jsx:Te.jsx,jsxs:Te.jsxs,passKeys:!0,passNode:!0});function c(e,t,i){if("raw"===e.type&&i&&"number"==typeof t)return s?i.children.splice(t,1):i.children[t]={type:"text",value:e.value},t;if("element"===e.type){let t;for(t in Hn)if(Object.hasOwn(Hn,t)&&Object.hasOwn(e.properties,t)){const n=e.properties[t],r=Hn[t];(null===r||r.includes(e.tagName))&&(e.properties[t]=l(String(n||""),t,e))}}if("element"===e.type){let s=n?!n.includes(e.tagName):!!o&&o.includes(e.tagName);if(!s&&r&&"number"==typeof t&&(s=!r(e,t,i)),s&&i&&"number"==typeof t)return a&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}(t.runSync(t.parse(n),n),e)}function Jo(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return-1===t||-1!==i&&t>i||-1!==n&&t>n||-1!==r&&t>r||Ko.test(e.slice(0,t))?e:""}function Zo(e,t){const n=String(e);if("string"!=typeof t)throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;-1!==i;)r++,i=n.indexOf(t,i+t.length);return r}function es(e,t,n){const r=so((n||{}).ignore||[]),i=function(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const e=n[r];t.push([ts(e[0]),ns(e[1])])}return t}(t);let o=-1;for(;++o<i.length;)uo(e,"text",s);function s(e,t){let n,s=-1;for(;++s<t.length;){const e=t[s],i=n?n.children:void 0;if(r(e,i?i.indexOf(e):void 0,n))return;n=e}if(n)return function(e,t){const n=t[t.length-1],r=i[o][0],s=i[o][1];let a=0;const l=n.children.indexOf(e);let c=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){const n=d.index,i={index:d.index,input:d.input,stack:[...t,e]};let o=s(...d,i);if("string"==typeof o&&(o=o.length>0?{type:"text",value:o}:void 0),!1===o?r.lastIndex=n+1:(a!==n&&u.push({type:"text",value:e.value.slice(a,n)}),Array.isArray(o)?u.push(...o):o&&u.push(o),a=n+d[0].length,c=!0),!r.global)break;d=r.exec(e.value)}c?(a<e.value.length&&u.push({type:"text",value:e.value.slice(a)}),n.children.splice(l,1,...u)):u=[e];return l+u.length}(e,t)}}function ts(e){return"string"==typeof e?new RegExp(function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(e),"g"):e}function ns(e){return"function"==typeof e?e:function(){return e}}var rs="phrasing",is=["autolink","link","image","label"];function os(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function ss(e){this.config.enter.autolinkProtocol.call(this,e)}function as(e){this.config.exit.autolinkProtocol.call(this,e)}function ls(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function cs(e){this.config.exit.autolinkEmail.call(this,e)}function us(e){this.exit(e)}function ds(e){es(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,fs],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,ps]],{ignore:["link","linkReference"]})}function fs(e,t,n,r,i){let o="";if(!ms(i))return!1;if(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!function(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}(n))return!1;const s=function(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=Zo(e,"(");let o=Zo(e,")");for(;-1!==r&&i>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}(n+r);if(!s[0])return!1;const a={type:"link",title:null,url:o+t+s[0],children:[{type:"text",value:t+s[0]}]};return s[1]?[a,{type:"text",value:s[1]}]:a}function ps(e,t,n,r){return!(!ms(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function ms(e,t){const n=e.input.charCodeAt(e.index-1);return(0===e.index||hr(n)||mr(n))&&(!t||47!==n)}function hs(){this.buffer()}function gs(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function xs(){this.buffer()}function ys(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function vs(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=rr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function bs(e){this.exit(e)}function ks(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=rr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function ws(e){this.exit(e)}function js(e,t,n,r){const i=n.createTracker(r);let o=i.move("[^");const s=n.enter("footnoteReference"),a=n.enter("reference");return o+=i.move(n.safe(n.associationId(e),{after:"]",before:o})),a(),s(),o+=i.move("]"),o}function Cs(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:function(e,n,r,i){const o=r.createTracker(i);let s=o.move("[^");const a=r.enter("footnoteDefinition"),l=r.enter("label");s+=o.move(r.safe(r.associationId(e),{before:s,after:"]"})),l(),s+=o.move("]:"),e.children&&e.children.length>0&&(o.shift(4),s+=o.move((t?"\n":" ")+r.indentLines(r.containerFlow(e,o.current()),t?Is:Ns)));return a(),s},footnoteReference:js},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}}function Ns(e,t,n){return 0===t?e:Is(e,t,n)}function Is(e,t,n){return(n?"":" ")+e}js.peek=function(){return"["};var Ss=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function As(e){this.enter({type:"delete",children:[]},e)}function Ps(e){this.exit(e)}function Es(e,t,n,r){const i=n.createTracker(r),o=n.enter("strikethrough");let s=i.move("~~");return s+=n.containerPhrasing(e,{...i.current(),before:s,after:"~"}),s+=i.move("~~"),o(),s}function Ts(e){return e.length}function Ms(e){return null==e?"":String(e)}function Ds(e){const t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:82===t||114===t?114:0}function Ls(e,t,n){return">"+(n?"":" ")+e}function Fs(e,t){return Rs(e,t.inConstruct,!0)&&!Rs(e,t.notInConstruct,!1)}function Rs(e,t,n){if("string"==typeof t&&(t=[t]),!t||0===t.length)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function Os(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if("\n"===n.unsafe[i].character&&Fs(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return"\\\n"}function zs(e,t,n){return(n?"":" ")+e}function _s(e){const t=e.options.quote||'"';if('"'!==t&&"'"!==t)throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function qs(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Bs(e,t,n){const r=wr(e),i=wr(t);return void 0===r?void 0===i?"_"===n?{inside:!0,outside:!0}:{inside:!1,outside:!1}:1===i?{inside:!0,outside:!0}:{inside:!1,outside:!0}:1===r?void 0===i?{inside:!1,outside:!1}:1===i?{inside:!0,outside:!0}:{inside:!1,outside:!1}:void 0===i?{inside:!1,outside:!1}:1===i?{inside:!0,outside:!1}:{inside:!1,outside:!1}}function Us(e,t,n,r){const i=function(e){const t=e.options.emphasis||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}(n),o=n.enter("emphasis"),s=n.createTracker(r),a=s.move(i);let l=s.move(n.containerPhrasing(e,{after:i,before:a,...s.current()}));const c=l.charCodeAt(0),u=Bs(r.before.charCodeAt(r.before.length-1),c,i);u.inside&&(l=qs(c)+l.slice(1));const d=l.charCodeAt(l.length-1),f=Bs(r.after.charCodeAt(0),d,i);f.inside&&(l=l.slice(0,-1)+qs(d));const p=s.move(i);return o(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+p}function Hs(e){return e.value||""}function $s(e,t,n,r){const i=_s(n),o='"'===i?"Quote":"Apostrophe",s=n.enter("image");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("![");return c+=l.move(n.safe(e.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),a(),e.title&&(a=n.enter(`title${o}`),c+=l.move(" "+i),c+=l.move(n.safe(e.title,{before:c,after:i,...l.current()})),c+=l.move(i),a()),c+=l.move(")"),s(),c}function Vs(e,t,n,r){const i=e.referenceType,o=n.enter("imageReference");let s=n.enter("label");const a=n.createTracker(r);let l=a.move("![");const c=n.safe(e.alt,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),s();const u=n.stack;n.stack=[],s=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return s(),n.stack=u,o(),"full"!==i&&c&&c===d?"shortcut"===i?l=l.slice(0,-1):l+=a.move("]"):l+=a.move(d+"]"),l}function Qs(e,t,n){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const e=n.unsafe[o],t=n.compilePattern(e);let i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;10===r.charCodeAt(e)&&13===r.charCodeAt(e-1)&&e--,r=r.slice(0,e)+" "+r.slice(i.index+1)}}return i+r+i}function Ws(e,t){const n=Vn(e);return Boolean(!t.options.resourceLink&&e.url&&!e.title&&e.children&&1===e.children.length&&"text"===e.children[0].type&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}function Gs(e,t,n,r){const i=_s(n),o='"'===i?"Quote":"Apostrophe",s=n.createTracker(r);let a,l;if(Ws(e,n)){const t=n.stack;n.stack=[],a=n.enter("autolink");let r=s.move("<");return r+=s.move(n.containerPhrasing(e,{before:r,after:">",...s.current()})),r+=s.move(">"),a(),n.stack=t,r}a=n.enter("link"),l=n.enter("label");let c=s.move("[");return c+=s.move(n.containerPhrasing(e,{before:c,after:"](",...s.current()})),c+=s.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=s.move("<"),c+=s.move(n.safe(e.url,{before:c,after:">",...s.current()})),c+=s.move(">")):(l=n.enter("destinationRaw"),c+=s.move(n.safe(e.url,{before:c,after:e.title?" ":")",...s.current()}))),l(),e.title&&(l=n.enter(`title${o}`),c+=s.move(" "+i),c+=s.move(n.safe(e.title,{before:c,after:i,...s.current()})),c+=s.move(i),l()),c+=s.move(")"),a(),c}function Ks(e,t,n,r){const i=e.referenceType,o=n.enter("linkReference");let s=n.enter("label");const a=n.createTracker(r);let l=a.move("[");const c=n.containerPhrasing(e,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),s();const u=n.stack;n.stack=[],s=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return s(),n.stack=u,o(),"full"!==i&&c&&c===d?"shortcut"===i?l=l.slice(0,-1):l+=a.move("]"):l+=a.move(d+"]"),l}function Ys(e){const t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Xs(e){const t=e.options.rule||"*";if("*"!==t&&"-"!==t&&"_"!==t)throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}Es.peek=function(){return"~"},Us.peek=function(e,t,n){return n.options.emphasis||"*"},Hs.peek=function(){return"<"},$s.peek=function(){return"!"},Vs.peek=function(){return"!"},Qs.peek=function(){return"`"},Gs.peek=function(e,t,n){return Ws(e,n)?"<":"["},Ks.peek=function(){return"["};var Js=so(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Zs(e,t,n,r){const i=function(e){const t=e.options.strong||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}(n),o=n.enter("strong"),s=n.createTracker(r),a=s.move(i+i);let l=s.move(n.containerPhrasing(e,{after:i,before:a,...s.current()}));const c=l.charCodeAt(0),u=Bs(r.before.charCodeAt(r.before.length-1),c,i);u.inside&&(l=qs(c)+l.slice(1));const d=l.charCodeAt(l.length-1),f=Bs(r.after.charCodeAt(0),d,i);f.inside&&(l=l.slice(0,-1)+qs(d));const p=s.move(i+i);return o(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+p}Zs.peek=function(e,t,n){return n.options.strong||"*"};var ea={blockquote:function(e,t,n,r){const i=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const s=n.indentLines(n.containerFlow(e,o.current()),Ls);return i(),s},break:Os,code:function(e,t,n,r){const i=function(e){const t=e.options.fence||"`";if("`"!==t&&"~"!==t)throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}(n),o=e.value||"",s="`"===i?"GraveAccent":"Tilde";if(function(e,t){return Boolean(!1===t.options.fences&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}(e,n)){const e=n.enter("codeIndented"),t=n.indentLines(o,zs);return e(),t}const a=n.createTracker(r),l=i.repeat(Math.max(function(e,t){const n=String(e);let r=n.indexOf(t),i=r,o=0,s=0;if("string"!=typeof t)throw new TypeError("Expected substring");for(;-1!==r;)r===i?++o>s&&(s=o):o=1,i=r+t.length,r=n.indexOf(t,i);return s}(o,i)+1,3)),c=n.enter("codeFenced");let u=a.move(l);if(e.lang){const t=n.enter(`codeFencedLang${s}`);u+=a.move(n.safe(e.lang,{before:u,after:" ",encode:["`"],...a.current()})),t()}if(e.lang&&e.meta){const t=n.enter(`codeFencedMeta${s}`);u+=a.move(" "),u+=a.move(n.safe(e.meta,{before:u,after:"\n",encode:["`"],...a.current()})),t()}return u+=a.move("\n"),o&&(u+=a.move(o+"\n")),u+=a.move(l),c(),u},definition:function(e,t,n,r){const i=_s(n),o='"'===i?"Quote":"Apostrophe",s=n.enter("definition");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("[");return c+=l.move(n.safe(n.associationId(e),{before:c,after:"]",...l.current()})),c+=l.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":"\n",...l.current()}))),a(),e.title&&(a=n.enter(`title${o}`),c+=l.move(" "+i),c+=l.move(n.safe(e.title,{before:c,after:i,...l.current()})),c+=l.move(i),a()),s(),c},emphasis:Us,hardBreak:Os,heading:function(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(function(e,t){let n=!1;return fo(e,function(e){if("value"in e&&/\r?\n|\r/.test(e.value)||"break"===e.type)return n=!0,!1}),Boolean((!e.depth||e.depth<3)&&Vn(e)&&(t.options.setext||n))}(e,n)){const t=n.enter("headingSetext"),r=n.enter("phrasing"),s=n.containerPhrasing(e,{...o.current(),before:"\n",after:"\n"});return r(),t(),s+"\n"+(1===i?"=":"-").repeat(s.length-(Math.max(s.lastIndexOf("\r"),s.lastIndexOf("\n"))+1))}const s="#".repeat(i),a=n.enter("headingAtx"),l=n.enter("phrasing");o.move(s+" ");let c=n.containerPhrasing(e,{before:"# ",after:"\n",...o.current()});return/^[\t ]/.test(c)&&(c=qs(c.charCodeAt(0))+c.slice(1)),c=c?s+" "+c:s,n.options.closeAtx&&(c+=" "+s),l(),a(),c},html:Hs,image:$s,imageReference:Vs,inlineCode:Qs,link:Gs,linkReference:Ks,list:function(e,t,n,r){const i=n.enter("list"),o=n.bulletCurrent;let s=e.ordered?function(e){const t=e.options.bulletOrdered||".";if("."!==t&&")"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}(n):Ys(n);const a=e.ordered?"."===s?")":".":function(e){const t=Ys(e),n=e.options.bulletOther;if(!n)return"*"===t?"-":"*";if("*"!==n&&"+"!==n&&"-"!==n)throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}(n);let l=!(!t||!n.bulletLastUsed)&&s===n.bulletLastUsed;if(!e.ordered){const t=e.children?e.children[0]:void 0;if("*"!==s&&"-"!==s||!t||t.children&&t.children[0]||"list"!==n.stack[n.stack.length-1]||"listItem"!==n.stack[n.stack.length-2]||"list"!==n.stack[n.stack.length-3]||"listItem"!==n.stack[n.stack.length-4]||0!==n.indexStack[n.indexStack.length-1]||0!==n.indexStack[n.indexStack.length-2]||0!==n.indexStack[n.indexStack.length-3]||(l=!0),Xs(n)===s&&t){let t=-1;for(;++t<e.children.length;){const n=e.children[t];if(n&&"listItem"===n.type&&n.children&&n.children[0]&&"thematicBreak"===n.children[0].type){l=!0;break}}}}l&&(s=a),n.bulletCurrent=s;const c=n.containerFlow(e,r);return n.bulletLastUsed=s,n.bulletCurrent=o,i(),c},listItem:function(e,t,n,r){const i=function(e){const t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n);let o=n.bulletCurrent||Ys(n);t&&"list"===t.type&&t.ordered&&(o=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+o);let s=o.length+1;("tab"===i||"mixed"===i&&(t&&"list"===t.type&&t.spread||e.spread))&&(s=4*Math.ceil(s/4));const a=n.createTracker(r);a.move(o+" ".repeat(s-o.length)),a.shift(s);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,a.current()),function(e,t,n){return t?(n?"":" ".repeat(s))+e:(n?o:o+" ".repeat(s-o.length))+e});return l(),c},paragraph:function(e,t,n,r){const i=n.enter("paragraph"),o=n.enter("phrasing"),s=n.containerPhrasing(e,r);return o(),i(),s},root:function(e,t,n,r){return(e.children.some(function(e){return Js(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)},strong:Zs,text:function(e,t,n,r){return n.safe(e.value,r)},thematicBreak:function(e,t,n){const r=(Xs(n)+(n.options.ruleSpaces?" ":"")).repeat(function(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}(n));return n.options.ruleSpaces?r.slice(0,-1):r}};function ta(e){const t=e._align;this.enter({type:"table",align:t.map(function(e){return"none"===e?null:e}),children:[]},e),this.data.inTable=!0}function na(e){this.exit(e),this.data.inTable=void 0}function ra(e){this.enter({type:"tableRow",children:[]},e)}function ia(e){this.exit(e)}function oa(e){this.enter({type:"tableCell",children:[]},e)}function sa(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,aa));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function aa(e,t){return"|"===t?t:e}function la(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[\t :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,n){let r=ea.inlineCode(e,t,n);n.stack.includes("tableCell")&&(r=r.replace(/\|/g,"\\$&"));return r},table:function(e,t,n,r){return a(function(e,t,n){const r=e.children;let i=-1;const o=[],s=t.enter("table");for(;++i<r.length;)o[i]=l(r[i],t,n);return s(),o}(e,n,r),e.align)},tableCell:s,tableRow:function(e,t,n,r){const i=a([l(e,n,r)]);return i.slice(0,i.indexOf("\n"))}}};function s(e,t,n,r){const i=n.enter("tableCell"),s=n.enter("phrasing"),a=n.containerPhrasing(e,{...r,before:o,after:o});return s(),i(),a}function a(e,t){return function(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Ts,o=[],s=[],a=[],l=[];let c=0,u=-1;for(;++u<e.length;){const t=[],r=[];let o=-1;for(e[u].length>c&&(c=e[u].length);++o<e[u].length;){const s=Ms(e[u][o]);if(!1!==n.alignDelimiters){const e=i(s);r[o]=e,(void 0===l[o]||e>l[o])&&(l[o]=e)}t.push(s)}s[u]=t,a[u]=r}let d=-1;if("object"==typeof r&&"length"in r)for(;++d<c;)o[d]=Ds(r[d]);else{const e=Ds(r);for(;++d<c;)o[d]=e}d=-1;const f=[],p=[];for(;++d<c;){const e=o[d];let t="",r="";99===e?(t=":",r=":"):108===e?t=":":114===e&&(r=":");let i=!1===n.alignDelimiters?1:Math.max(1,l[d]-t.length-r.length);const s=t+"-".repeat(i)+r;!1!==n.alignDelimiters&&(i=t.length+i+r.length,i>l[d]&&(l[d]=i),p[d]=i),f[d]=s}s.splice(1,0,f),a.splice(1,0,p),u=-1;const m=[];for(;++u<s.length;){const e=s[u],t=a[u];d=-1;const r=[];for(;++d<c;){const i=e[d]||"";let s="",a="";if(!1!==n.alignDelimiters){const e=l[d]-(t[d]||0),n=o[d];114===n?s=" ".repeat(e):99===n?e%2?(s=" ".repeat(e/2+.5),a=" ".repeat(e/2-.5)):(s=" ".repeat(e/2),a=s):a=" ".repeat(e)}!1===n.delimiterStart||d||r.push("|"),!1===n.padding||!1===n.alignDelimiters&&""===i||!1===n.delimiterStart&&!d||r.push(" "),!1!==n.alignDelimiters&&r.push(s),r.push(i),!1!==n.alignDelimiters&&r.push(a),!1!==n.padding&&r.push(" "),!1===n.delimiterEnd&&d===c-1||r.push("|")}m.push(!1===n.delimiterEnd?r.join("").replace(/ +$/,""):r.join(""))}return m.join("\n")}(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function l(e,t,n){const r=e.children;let i=-1;const o=[],a=t.enter("tableRow");for(;++i<r.length;)o[i]=s(r[i],0,t,n);return a(),o}}function ca(e){const t=this.stack[this.stack.length-2];t.type,t.checked="taskListCheckValueChecked"===e.type}function ua(e){const t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){const e=this.stack[this.stack.length-1];e.type;const n=e.children[0];if(n&&"text"===n.type){const r=t.children;let i,o=-1;for(;++o<r.length;){const e=r[o];if("paragraph"===e.type){i=e;break}}i===e&&(n.value=n.value.slice(1),0===n.value.length?e.children.shift():e.position&&n.position&&"number"==typeof n.position.start.offset&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function da(e,t,n,r){const i=e.children[0],o="boolean"==typeof e.checked&&i&&"paragraph"===i.type,s="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);o&&a.move(s);let l=ea.listItem(e,t,n,{...r,...a.current()});return o&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+s})),l}var fa={tokenize:function(e,t,n){let r=0;return function t(o){if((87===o||119===o)&&r<3)return r++,e.consume(o),t;if(46===o&&3===r)return e.consume(o),i;return n(o)};function i(e){return null===e?n(e):t(e)}},partial:!0},pa={tokenize:function(e,t,n){let r,i,o;return s;function s(t){return 46===t||95===t?e.check(ha,l,a)(t):null===t||fr(t)||hr(t)||45!==t&&mr(t)?l(t):(o=!0,e.consume(t),s)}function a(t){return 95===t?r=!0:(i=r,r=void 0),e.consume(t),s}function l(e){return i||r||!o?n(e):t(e)}},partial:!0},ma={tokenize:function(e,t){let n=0,r=0;return i;function i(s){return 40===s?(n++,e.consume(s),i):41===s&&r<n?o(s):33===s||34===s||38===s||39===s||41===s||42===s||44===s||46===s||58===s||59===s||60===s||63===s||93===s||95===s||126===s?e.check(ha,t,o)(s):null===s||fr(s)||hr(s)?t(s):(e.consume(s),i)}function o(t){return 41===t&&r++,e.consume(t),i}},partial:!0},ha={tokenize:function(e,t,n){return r;function r(s){return 33===s||34===s||39===s||41===s||42===s||44===s||46===s||58===s||59===s||63===s||95===s||126===s?(e.consume(s),r):38===s?(e.consume(s),o):93===s?(e.consume(s),i):60===s||null===s||fr(s)||hr(s)?t(s):n(s)}function i(e){return null===e||40===e||91===e||fr(e)||hr(e)?t(e):r(e)}function o(e){return ir(e)?s(e):n(e)}function s(t){return 59===t?(e.consume(t),r):ir(t)?(e.consume(t),s):n(t)}},partial:!0},ga={tokenize:function(e,t,n){return function(t){return e.consume(t),r};function r(e){return or(e)?n(e):t(e)}},partial:!0},xa={name:"wwwAutolink",tokenize:function(e,t,n){const r=this;return function(t){return 87!==t&&119!==t||!wa.call(r,r.previous)||Ia(r.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(fa,e.attempt(pa,e.attempt(ma,i),n),n)(t))};function i(n){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(n)}},previous:wa},ya={name:"protocolAutolink",tokenize:function(e,t,n){const r=this;let i="",o=!1;return function(t){if((72===t||104===t)&&ja.call(r,r.previous)&&!Ia(r.events))return e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(t),e.consume(t),s;return n(t)};function s(t){if(ir(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(58===t){const n=i.toLowerCase();if("http"===n||"https"===n)return e.consume(t),a}return n(t)}function a(t){return 47===t?(e.consume(t),o?l:(o=!0,a)):n(t)}function l(t){return null===t||ar(t)||fr(t)||hr(t)||mr(t)?n(t):e.attempt(pa,e.attempt(ma,c),n)(t)}function c(n){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(n)}},previous:ja},va={name:"emailAutolink",tokenize:function(e,t,n){const r=this;let i,o;return function(t){return Na(t)&&Ca.call(r,r.previous)&&!Ia(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),s(t)):n(t)};function s(t){return Na(t)?(e.consume(t),s):64===t?(e.consume(t),a):n(t)}function a(t){return 46===t?e.check(ga,c,l)(t):45===t||95===t||or(t)?(o=!0,e.consume(t),a):c(t)}function l(t){return e.consume(t),i=!0,a}function c(s){return o&&i&&ir(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(s)):n(s)}},previous:Ca},ba={};for(var ka=48;ka<123;)ba[ka]=va,58===++ka?ka=65:91===ka&&(ka=97);function wa(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||fr(e)}function ja(e){return!ir(e)}function Ca(e){return!(47===e||Na(e))}function Na(e){return 43===e||45===e||46===e||95===e||or(e)}function Ia(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}ba[43]=va,ba[45]=va,ba[46]=va,ba[95]=va,ba[72]=[va,ya],ba[104]=[va,ya],ba[87]=[va,xa],ba[119]=[va,xa];var Sa={tokenize:function(e,t,n){const r=this;return yr(e,function(e){const i=r.events[r.events.length-1];return i&&"gfmFootnoteDefinitionIndent"===i[1].type&&4===i[2].sliceSerialize(i[1],!0).length?t(e):n(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function Aa(e,t,n){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;i--;){const e=r.events[i][1];if("labelImage"===e.type){s=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(i){if(!s||!s._balanced)return n(i);const a=rr(r.sliceSerialize({start:s.end,end:r.now()}));return 94===a.codePointAt(0)&&o.includes(a.slice(1))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(i),e.exit("gfmFootnoteCallLabelMarker"),t(i)):n(i)}}function Pa(e,t){let n=e.length;for(;n--;)if("labelImage"===e[n][1].type&&"enter"===e[n][0]){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)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",o,t],["enter",s,t],["exit",s,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function Ea(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,s=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),a};function a(t){return 94!==t?n(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",l)}function l(a){if(s>999||93===a&&!o||null===a||91===a||fr(a))return n(a);if(93===a){e.exit("chunkString");const o=e.exit("gfmFootnoteCallString");return i.includes(rr(r.sliceSerialize(o)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(a)}return fr(a)||(o=!0),s++,e.consume(a),92===a?c:l}function c(t){return 91===t||92===t||93===t?(e.consume(t),s++,l):l(t)}}function Ta(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,s,a=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),l};function l(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(t)}function c(t){if(a>999||93===t&&!s||null===t||91===t||fr(t))return n(t);if(93===t){e.exit("chunkString");const n=e.exit("gfmFootnoteDefinitionLabelString");return o=rr(r.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return fr(t)||(s=!0),a++,e.consume(t),92===t?u:c}function u(t){return 91===t||92===t||93===t?(e.consume(t),a++,c):c(t)}function d(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),i.includes(o)||i.push(o),yr(e,f,"gfmFootnoteDefinitionWhitespace")):n(t)}function f(e){return t(e)}}function Ma(e,t,n){return e.check(Sr,t,e.attempt(Sa,t,n))}function Da(e){e.exit("gfmFootnoteDefinition")}function La(e){let t=(e||{}).singleTilde;const n={name:"strikethrough",tokenize:function(e,n,r){const i=this.previous,o=this.events;let s=0;return function(t){return 126===i&&"characterEscape"!==o[o.length-1][1].type?r(t):(e.enter("strikethroughSequenceTemporary"),a(t))};function a(o){const l=wr(i);if(126===o)return s>1?r(o):(e.consume(o),s++,a);if(s<2&&!t)return r(o);const c=e.exit("strikethroughSequenceTemporary"),u=wr(o);return c._open=!u||2===u&&Boolean(l),c._close=!l||2===l&&Boolean(u),n(o)}},resolveAll:function(e,t){let n=-1;for(;++n<e.length;)if("enter"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._close){let r=n;for(;r--;)if("exit"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type="strikethroughSequence",e[r][1].type="strikethroughSequence";const i={type:"strikethrough",start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},o={type:"strikethroughText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},s=[["enter",i,t],["enter",e[r][1],t],["exit",e[r][1],t],["enter",o,t]],a=t.parser.constructs.insideSpan.null;a&&Yn(s,s.length,0,jr(a,e.slice(r+1,n),t)),Yn(s,s.length,0,[["exit",o,t],["enter",e[n][1],t],["exit",e[n][1],t],["exit",i,t]]),Yn(e,r-1,n-r+3,s),n=r+s.length-2;break}}n=-1;for(;++n<e.length;)"strikethroughSequenceTemporary"===e[n][1].type&&(e[n][1].type="data");return e}};return null==t&&(t=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}}}var Fa=class{constructor(){this.map=[]}add(e,t,n){!function(e,t,n,r){let i=0;if(0===n&&0===r.length)return;for(;i<e.map.length;){if(e.map[i][0]===t)return e.map[i][1]+=n,void e.map[i][2].push(...r);i+=1}e.map.push([t,n,r])}(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),0===this.map.length)return;let t=this.map.length;const n=[];for(;t>0;)t-=1,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(const t of r)e.push(t);r=n.pop()}this.map.length=0}};function Ra(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if("enter"===i[0])"tableContent"===i[1].type&&r.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===i[1].type){if("tableDelimiterMarker"===e[t-1][1].type){const e=r.length-1;r[e]="left"===r[e]?"center":"right"}}else if("tableDelimiterRow"===i[1].type)break}else"enter"===i[0]&&"tableDelimiterRow"===i[1].type&&(n=!0);t+=1}return r}function Oa(e,t,n){const r=this;let i,o=0,s=0;return function(e){let t=r.events.length-1;for(;t>-1;){const e=r.events[t][1].type;if("lineEnding"!==e&&"linePrefix"!==e)break;t--}const i=t>-1?r.events[t][1].type:null,o="tableHead"===i||"tableRow"===i?b:a;return o===b&&r.parser.lazy[r.now().line]?n(e):o(e)};function a(t){return e.enter("tableHead"),e.enter("tableRow"),function(e){return 124===e||(i=!0,s+=1),l(e)}(t)}function l(t){return null===t?n(t):dr(t)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),d):n(t):pr(t)?yr(e,l,"whitespace")(t):(s+=1,i&&(i=!1,o+=1),124===t?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),i=!0,l):(e.enter("data"),c(t)))}function c(t){return null===t||124===t||fr(t)?(e.exit("data"),l(t)):(e.consume(t),92===t?u:c)}function u(t){return 92===t||124===t?(e.consume(t),c):c(t)}function d(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter("tableDelimiterRow"),i=!1,pr(t)?yr(e,f,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):f(t))}function f(t){return 45===t||58===t?m(t):124===t?(i=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),p):v(t)}function p(t){return pr(t)?yr(e,m,"whitespace")(t):m(t)}function m(t){return 58===t?(s+=1,i=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),h):45===t?(s+=1,h(t)):null===t||dr(t)?y(t):v(t)}function h(t){return 45===t?(e.enter("tableDelimiterFiller"),g(t)):v(t)}function g(t){return 45===t?(e.consume(t),g):58===t?(i=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),x):(e.exit("tableDelimiterFiller"),x(t))}function x(t){return pr(t)?yr(e,y,"whitespace")(t):y(t)}function y(n){return 124===n?f(n):(null===n||dr(n))&&i&&o===s?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(n)):v(n)}function v(e){return n(e)}function b(t){return e.enter("tableRow"),k(t)}function k(n){return 124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),k):null===n||dr(n)?(e.exit("tableRow"),t(n)):pr(n)?yr(e,k,"whitespace")(n):(e.enter("data"),w(n))}function w(t){return null===t||124===t||fr(t)?(e.exit("data"),k(t)):(e.consume(t),92===t?j:w)}function j(t){return 92===t||124===t?(e.consume(t),w):w(t)}}function za(e,t){let n,r,i,o=-1,s=!0,a=0,l=[0,0,0,0],c=[0,0,0,0],u=!1,d=0;const f=new Fa;for(;++o<e.length;){const p=e[o],m=p[1];"enter"===p[0]?"tableHead"===m.type?(u=!1,0!==d&&(qa(f,t,d,n,r),r=void 0,d=0),n={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(o,0,[["enter",n,t]])):"tableRow"===m.type||"tableDelimiterRow"===m.type?(s=!0,i=void 0,l=[0,0,0,0],c=[0,o+1,0,0],u&&(u=!1,r={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(o,0,[["enter",r,t]])),a="tableDelimiterRow"===m.type?2:r?3:1):!a||"data"!==m.type&&"tableDelimiterMarker"!==m.type&&"tableDelimiterFiller"!==m.type?"tableCellDivider"===m.type&&(s?s=!1:(0!==l[1]&&(c[0]=c[1],i=_a(f,t,l,a,void 0,i)),l=c,c=[l[1],o,0,0])):(s=!1,0===c[2]&&(0!==l[1]&&(c[0]=c[1],i=_a(f,t,l,a,void 0,i),l=[0,0,0,0]),c[2]=o)):"tableHead"===m.type?(u=!0,d=o):"tableRow"===m.type||"tableDelimiterRow"===m.type?(d=o,0!==l[1]?(c[0]=c[1],i=_a(f,t,l,a,o,i)):0!==c[1]&&(i=_a(f,t,c,a,o,i)),a=0):!a||"data"!==m.type&&"tableDelimiterMarker"!==m.type&&"tableDelimiterFiller"!==m.type||(c[3]=o)}for(0!==d&&qa(f,t,d,n,r),f.consume(t.events),o=-1;++o<t.events.length;){const e=t.events[o];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=Ra(t.events,o))}return e}function _a(e,t,n,r,i,o){const s=1===r?"tableHeader":2===r?"tableDelimiter":"tableData";0!==n[0]&&(o.end=Object.assign({},Ba(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const a=Ba(t.events,n[1]);if(o={type:s,start:Object.assign({},a),end:Object.assign({},a)},e.add(n[1],0,[["enter",o,t]]),0!==n[2]){const i=Ba(t.events,n[2]),o=Ba(t.events,n[3]),s={type:"tableContent",start:Object.assign({},i),end:Object.assign({},o)};if(e.add(n[2],0,[["enter",s,t]]),2!==r){const r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type="chunkText",r[1].contentType="text",n[3]>n[2]+1){const t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[["exit",s,t]])}return void 0!==i&&(o.end=Object.assign({},Ba(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function qa(e,t,n,r,i){const o=[],s=Ba(t.events,n);i&&(i.end=Object.assign({},s),o.push(["exit",i,t])),r.end=Object.assign({},s),o.push(["exit",r,t]),e.add(n+1,0,o)}function Ba(e,t){const n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}var Ua={name:"tasklistCheck",tokenize:function(e,t,n){const r=this;return function(t){return null===r.previous&&r._gfmTasklistFirstContentOfListItem?(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),i):n(t)};function i(t){return fr(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),o):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),o):n(t)}function o(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),s):n(t)}function s(r){return dr(r)?t(r):pr(r)?e.check({tokenize:Ha},t,n)(r):n(r)}}};function Ha(e,t,n){return yr(e,function(e){return null===e?n(e):t(e)},"whitespace")}var $a={};function Va(e){const t=e||$a,n=this.data(),r=n.micromarkExtensions||(n.micromarkExtensions=[]),i=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);r.push(function(e){return Zn([{text:ba},{document:{91:{name:"gfmFootnoteDefinition",tokenize:Ta,continuation:{tokenize:Ma},exit:Da}},text:{91:{name:"gfmFootnoteCall",tokenize:Ea},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Aa,resolveTo:Pa}}},La(e),{flow:{null:{name:"table",tokenize:Oa,resolveAll:za}}},{text:{91:Ua}}])}(t)),i.push([{transforms:[ds],enter:{literalAutolink:os,literalAutolinkEmail:ss,literalAutolinkHttp:ss,literalAutolinkWww:ss},exit:{literalAutolink:us,literalAutolinkEmail:cs,literalAutolinkHttp:as,literalAutolinkWww:ls}},{enter:{gfmFootnoteCallString:hs,gfmFootnoteCall:gs,gfmFootnoteDefinitionLabelString:xs,gfmFootnoteDefinition:ys},exit:{gfmFootnoteCallString:vs,gfmFootnoteCall:bs,gfmFootnoteDefinitionLabelString:ks,gfmFootnoteDefinition:ws}},{canContainEols:["delete"],enter:{strikethrough:As},exit:{strikethrough:Ps}},{enter:{table:ta,tableData:oa,tableHeader:oa,tableRow:ra},exit:{codeText:sa,table:na,tableData:ia,tableHeader:ia,tableRow:ia}},{exit:{taskListCheckValueChecked:ca,taskListCheckValueUnchecked:ca,paragraph:ua}}]),o.push(function(e){return{extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:rs,notInConstruct:is},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:rs,notInConstruct:is},{character:":",before:"[ps]",after:"\\/",inConstruct:rs,notInConstruct:is}]},Cs(e),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Ss}],handlers:{delete:Es}},la(e),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:da}}]}}(t))}function Qa({text:e}){const t=(0,Pe.useContext)(Ee);return(0,Te.jsx)("div",{className:"min-w-0 max-w-full overflow-hidden break-words px-1 text-sm leading-6",children:(0,Te.jsx)(Xo,{remarkPlugins:[Va],components:{a:({children:e,className:n,href:r,...i})=>{const o=function(e){const t=function(e){try{return decodeURIComponent(e)}catch{return e}}(e.trim()).replace(/^<|>$/g,"");if(!t||t.startsWith("#")||/^[a-z][a-z0-9+.-]*:/i.test(t)&&!t.startsWith("file://"))return null;const n=t.startsWith("file://")?t.slice(7):t,r=/^(.*)#L(\d+)(?:-L?\d+)?$/i.exec(n);if(r)return{line:Number(r[2]),path:r[1]};const i=/^(.+):(\d+)(?::\d+)?$/.exec(n);return i&&!/^[A-Za-z]:\\/.test(n)?{line:Number(i[2]),path:i[1]}:{path:n}}(r??"");return o&&t?(0,Te.jsx)("button",{className:R("inline min-w-0 break-words text-left underline underline-offset-2",n),type:"button",onClick:()=>t(o),children:e}):(0,Te.jsx)("a",{className:R("underline underline-offset-2",n),href:r,rel:"noreferrer",target:"_blank",...i,children:e})},blockquote:({className:e,...t})=>(0,Te.jsx)("blockquote",{className:R("my-3 border-l-2 border-border pl-3 text-muted-foreground",e),...t}),code:({className:e,children:t,...n})=>(0,Te.jsx)("code",{className:R("string"==typeof e&&e.includes("language-")?"block bg-transparent p-0 font-mono text-xs leading-5":"whitespace-pre-wrap break-words rounded bg-muted px-1 py-0.5 font-mono text-[0.92em] font-medium",e),...n,children:t}),del:({className:e,...t})=>(0,Te.jsx)("del",{className:R("text-muted-foreground line-through",e),...t}),em:({className:e,...t})=>(0,Te.jsx)("em",{className:R("italic",e),...t}),h1:({className:e,...t})=>(0,Te.jsx)("h1",{className:R("mb-2 mt-4 text-xl font-semibold tracking-normal",e),...t}),h2:({className:e,...t})=>(0,Te.jsx)("h2",{className:R("mb-2 mt-4 text-lg font-semibold tracking-normal",e),...t}),h3:({className:e,...t})=>(0,Te.jsx)("h3",{className:R("mb-2 mt-3 text-base font-semibold tracking-normal",e),...t}),h4:({className:e,...t})=>(0,Te.jsx)("h4",{className:R("mb-1.5 mt-3 text-sm font-semibold tracking-normal",e),...t}),h5:({className:e,...t})=>(0,Te.jsx)("h5",{className:R("mb-1.5 mt-3 text-sm font-semibold tracking-normal",e),...t}),h6:({className:e,...t})=>(0,Te.jsx)("h6",{className:R("mb-1 mt-3 text-xs font-semibold uppercase tracking-normal text-muted-foreground",e),...t}),hr:({className:e,...t})=>(0,Te.jsx)("hr",{className:R("my-4 border-border",e),...t}),img:({className:e,...t})=>(0,Te.jsx)("img",{className:R("my-3 max-w-full rounded-md border border-border",e),loading:"lazy",...t}),input:({className:e,type:t,...n})=>"checkbox"===t?(0,Te.jsx)("input",{className:R("mr-2 size-3.5 align-middle accent-primary disabled:opacity-70",e),type:t,...n}):(0,Te.jsx)("input",{className:e,type:t,...n}),li:({className:e,...t})=>(0,Te.jsx)("li",{className:R("pl-1 [&>p]:my-0",e),...t}),ol:({className:e,...t})=>(0,Te.jsx)("ol",{className:R("my-2 ml-5 list-decimal space-y-1 marker:text-muted-foreground",e),...t}),p:({className:e,...t})=>(0,Te.jsx)("p",{className:R("my-2 first:mt-0 last:mb-0",e),...t}),pre:({className:e,...t})=>(0,Te.jsx)("pre",{className:R("my-3 min-w-0 max-w-full overflow-x-auto rounded-md bg-muted p-3 font-mono text-xs leading-5 [&_code]:block [&_code]:rounded-none [&_code]:bg-transparent [&_code]:p-0 [&_code]:font-normal",e),...t}),strong:({className:e,...t})=>(0,Te.jsx)("strong",{className:R("font-semibold",e),...t}),table:({className:e,...t})=>(0,Te.jsx)("div",{className:"my-3 max-w-full overflow-x-auto",children:(0,Te.jsx)("table",{className:R("w-full border-collapse text-left text-sm [&_tbody_tr:nth-child(odd)]:bg-muted/30 [&_td]:border [&_td]:border-border [&_td]:px-2 [&_td]:py-1 [&_th]:border [&_th]:border-border [&_th]:bg-muted/60 [&_th]:px-2 [&_th]:py-1 [&_th]:font-semibold",e),...t})}),ul:({className:e,...t})=>(0,Te.jsx)("ul",{className:R("my-2 ml-5 list-disc space-y-1 marker:text-muted-foreground",e),...t})},children:Ga(e)})})}function Wa(e){return e.map(e=>"text"===e.type?e.text:"").join("").trim()}function Ga(e){return Ka(e).map(e=>"image"===e.type?`\n\n.replace(/\)/g,"%29")})\n\n`:e.text).join("")}function Ka(e){const t=[],n=/<image>\s*([\s\S]*?)\s*<\/image>/gi;let r,i=0;for(;r=n.exec(e);){r.index>i&&t.push({text:e.slice(i,r.index),type:"text"});const o=Ya(r[1]);t.push(o?{src:o,type:"image"}:{text:r[0],type:"text"});const s=/^\s*<\/image>/i.exec(e.slice(n.lastIndex));o&&s&&(n.lastIndex+=s[0].length),i=n.lastIndex}return i<e.length&&t.push({text:e.slice(i),type:"text"}),t.length?t:[{text:e,type:"text"}]}function Ya(e){let t=e.trim();for(;/^<image>/i.test(t);)t=t.replace(/^<image>\s*/i,"").trim();for(;/<\/image>$/i.test(t);)t=t.replace(/\s*<\/image>$/i,"").trim();return!t||/[\u0000-\u001f\u007f]/.test(t)||t.includes("\n")||t.includes("\r")?null:t.startsWith("/")||t.startsWith("data:image/")||/^https?:\/\//i.test(t)?t:null}function Xa({chatId:e,hiddenMessageIds:t,messages:n,onImplementPlan:r,onRevisePlan:i,onReviewFileChanges:o,onUndoFileChanges:s,fileChangeActionDisabled:a,fileChangeActionPending:l,onSteerQueuedMessage:c,planActionDisabled:u,planActionPending:d,queuedMessageActionDisabled:f,queuedMessageActionPendingId:p,showProcessingTail:m,session:h}){const g=(0,Pe.useMemo)(()=>new Set(t??[]),[t]),x=(0,Pe.useMemo)(()=>Ye(n).filter(e=>!g.has(e.id)),[g,n]),y=(0,Pe.useMemo)(()=>function(e){const t=[];for(const n of e){if("USER"===n.role){t.push({id:`user:${n.id}`,message:n,type:"user"});continue}const e=nt(n),r=t.at(-1);"codex"!==r?.type||r.id!==e?"codex"===r?.type&&tt(r.messages.at(-1),n)?r.messages.push(n):t.push({id:e,messages:[n],type:"codex"}):r.messages.push(n)}return t}(x),[x]),v=(0,Pe.useMemo)(()=>function(e){for(let t=e.length-1;t>=0;t-=1){const n=e[t];if("COMPLETED"===n.status&&El(n))return n.id}return null}(x),[x]),[b,k]=(0,Pe.useState)(null);return(0,Te.jsxs)(Ee.Provider,{value:k,children:[y.map(t=>(0,Te.jsx)(tl,{chatId:e,entry:t,fileChangeActionDisabled:a,fileChangeActionPending:l,latestProposedPlanMessageId:v,onImplementPlan:r,onRevisePlan:i,onReviewFileChanges:o,onSteerQueuedMessage:c,onUndoFileChanges:s,planActionDisabled:u,planActionPending:d,queuedMessageActionDisabled:f,queuedMessageActionPendingId:p,session:h},t.id)),m?(0,Te.jsx)(ul,{}):null,(0,Te.jsx)(jt,{chatId:e,session:h,target:b,onClose:()=>k(null)})]})}function Ja({chatId:e,messages:t,session:n}){const r=(0,Pe.useMemo)(()=>lt(t),[t]);return r.pendingRequest?(0,Te.jsx)("div",{className:"grid min-w-0 gap-1.5 overflow-hidden border-b bg-background px-3 py-2",children:(0,Te.jsx)("div",{className:"mx-auto grid w-full min-w-0 max-w-3xl gap-1.5 overflow-hidden",children:(0,Te.jsx)(gl,{chatId:e,compact:!0,message:r.pendingRequest,session:n})})}):null}function Za({message:e}){if(!e)return null;const t=kt(e.metadata),n=t?.steps??[],r=n.filter(e=>jl(e.status)).length,i=function(e){const t=e.findIndex(e=>Cl(e.status));if(t>=0)return t;const n=e.findIndex(e=>!jl(e.status));return n>=0?n:e.length?e.length-1:-1}(n),o=(i>=0?n[i]:void 0)?.step??Il(t?.explanation)??Il(e.content)??"Planning...",s=function(e,t){return t.some(e=>Cl(e.status))||at(e)?"in progress":t.length?"pending":"planning"}(e,n);return(0,Te.jsx)("section",{"aria-label":"Active plan","aria-live":"polite",className:"border-b bg-background px-3 py-2",children:(0,Te.jsx)("div",{className:"mx-auto w-full min-w-0 max-w-3xl",children:(0,Te.jsx)("div",{className:"min-w-0 overflow-hidden rounded-lg border bg-muted/20 shadow-sm",children:(0,Te.jsxs)("div",{className:"grid min-w-0 gap-2 p-3",children:[(0,Te.jsxs)("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[(0,Te.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[(0,Te.jsx)("div",{className:"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-md bg-background text-muted-foreground",children:(0,Te.jsx)(v,{className:"size-4"})}),(0,Te.jsxs)("div",{className:"min-w-0",children:[(0,Te.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,Te.jsx)("span",{className:"text-sm font-medium",children:"Plan"}),(0,Te.jsx)(y,{variant:"secondary",children:s})]}),(0,Te.jsx)("div",{className:"mt-0.5 min-w-0 truncate text-xs text-muted-foreground",children:o})]})]}),n.length?(0,Te.jsxs)(y,{className:"shrink-0",variant:"outline",children:[r,"/",n.length]}):null]}),n.length?(0,Te.jsx)("div",{className:"grid max-h-44 min-w-0 gap-1.5 overflow-y-auto pr-1",children:n.map((e,t)=>{const n=t===i;return(0,Te.jsxs)("div",{className:R("grid min-w-0 grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-2 rounded-md px-2 py-1.5 text-xs",n?"border bg-background shadow-xs":"text-muted-foreground"),children:[(0,Te.jsx)(wl,{highlighted:n,status:e.status}),(0,Te.jsx)("div",{className:"min-w-0 break-words leading-5 text-foreground",children:e.step}),(0,Te.jsx)("span",{className:"shrink-0 rounded bg-background px-1.5 py-0.5 text-[11px] text-muted-foreground",children:(r=e.status,r.trim().replace(/[_-]+/g," ").toLowerCase()||"pending")})]},`${e.step}-${t}`);var r})}):null]})})})})}function el({disabled:e,messages:t,onSteerQueuedMessage:n,pendingQueueId:r}){return t.length?(0,Te.jsx)("section",{className:"border-b bg-background px-3 py-2",children:(0,Te.jsx)("div",{className:"mx-auto grid w-full min-w-0 max-w-3xl gap-1.5",children:(0,Te.jsxs)("div",{className:"min-w-0 overflow-hidden rounded-lg border bg-muted/20 shadow-sm",children:[(0,Te.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-2 border-b px-3 py-2",children:[(0,Te.jsxs)("div",{className:"flex min-w-0 items-center gap-2 text-sm font-medium",children:[(0,Te.jsx)(P,{className:"size-4 shrink-0 text-muted-foreground"}),(0,Te.jsx)("span",{children:"Queued messages"})]}),(0,Te.jsx)(y,{variant:"outline",children:t.length})]}),(0,Te.jsx)("div",{className:"grid max-h-44 min-w-0 gap-1 overflow-y-auto p-2",children:t.map(t=>{const i=fl(t)?.queueId,o=r===i;return(0,Te.jsxs)("div",{className:"grid min-w-0 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2 rounded-md bg-background px-2 py-1.5 text-xs",children:[(0,Te.jsx)(P,{className:"size-3.5 text-muted-foreground"}),(0,Te.jsxs)("div",{className:"min-w-0",children:[(0,Te.jsx)("div",{className:"truncate text-foreground",children:ml(t)}),(0,Te.jsx)("div",{className:"text-muted-foreground",children:"Queued after the current task"})]}),(0,Te.jsxs)(be,{className:"h-7 shrink-0 px-2 text-xs",disabled:e||o||!i||!n,size:"sm",type:"button",variant:"outline",onClick:()=>{i&&n?.({message:t,queueId:i})},children:[o?(0,Te.jsx)(O,{className:"animate-spin"}):(0,Te.jsx)(je,{}),"Steer"]})]},t.id)})})]})})}):null}function tl({chatId:e,entry:t,fileChangeActionDisabled:n,fileChangeActionPending:r,latestProposedPlanMessageId:i,onImplementPlan:o,onRevisePlan:s,onReviewFileChanges:a,onSteerQueuedMessage:l,onUndoFileChanges:c,planActionDisabled:u,planActionPending:d,queuedMessageActionDisabled:f,queuedMessageActionPendingId:p,session:m}){return"user"===t.type?(0,Te.jsx)(cl,{message:t.message,queuedMessageActionDisabled:f,queuedMessageActionPendingId:p,onSteerQueuedMessage:l}):(0,Te.jsx)(nl,{chatId:e,fileChangeActionDisabled:n,fileChangeActionPending:r,latestProposedPlanMessageId:i,messages:t.messages,onImplementPlan:o,onRevisePlan:s,onReviewFileChanges:a,onUndoFileChanges:c,planActionDisabled:u,planActionPending:d,session:m})}function nl({chatId:e,fileChangeActionDisabled:t,fileChangeActionPending:n,latestProposedPlanMessageId:r,messages:i,onImplementPlan:o,onRevisePlan:s,onReviewFileChanges:a,onUndoFileChanges:l,planActionDisabled:c,planActionPending:u,session:d}){const f=(0,Pe.useMemo)(()=>Ge(i),[i]),p=(0,Pe.useMemo)(()=>function(e){if(e.some(at))return null;if(!e.some(e=>"ASSISTANT"===e.role&&"CHAT"===e.kind))return null;const t=e.filter(il);if(!t.length)return null;const n=function(e,t){const n=e.map(e=>sl(e[t])).filter(e=>null!==e);return n.length?Math.min(...n):null}(t,"createdAt"),r=ol(e,"completedAt")??ol(e,"createdAt"),i=n&&r&&r>n?al(r-n):null;return{actionCount:t.length,durationLabel:i}}(i),[i]),m=i.reduce((e,t)=>"FAILED"===t.status?"FAILED":"STREAMING"===t.status?"FAILED"===e?e:"STREAMING":"PENDING"===t.status?"FAILED"===e||"STREAMING"===e?e:"PENDING":e,null);return(0,Te.jsx)("article",{className:"mx-auto flex w-full min-w-0 max-w-full justify-start overflow-hidden",children:(0,Te.jsxs)("div",{className:"min-w-0 flex-1 overflow-hidden",children:[(0,Te.jsxs)("div",{className:"mb-1 flex items-center gap-2 pl-1",children:[(0,Te.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Codex"}),m?(0,Te.jsx)(ce,{status:m}):null]}),(0,Te.jsxs)("div",{className:"grid min-w-0 gap-2",children:[f.map(i=>(0,Te.jsx)(ll,{chatId:e,fileChangeActionDisabled:t,fileChangeActionPending:n,item:i,latestProposedPlanMessageId:r,onImplementPlan:o,onRevisePlan:s,onReviewFileChanges:a,onUndoFileChanges:l,planActionDisabled:c,planActionPending:u,session:d},i.id)),p?(0,Te.jsx)(rl,{summary:p}):null]})]})})}function rl({summary:e}){const t=e.durationLabel?`Worked for ${e.durationLabel}`:`${e.actionCount} ${1===e.actionCount?"action":"actions"}`;return(0,Te.jsxs)("div",{className:"flex min-w-0 items-center gap-2 py-1 text-xs text-muted-foreground",children:[(0,Te.jsx)("div",{className:"h-px min-w-4 flex-1 bg-border"}),(0,Te.jsx)("span",{className:"shrink-0",children:t}),(0,Te.jsx)("div",{className:"h-px min-w-4 flex-1 bg-border"})]})}function il(e){return"COMMAND_EXECUTION"===e.kind||"TOOL_ACTIVITY"===e.kind||"FILE_CHANGE"===e.kind}function ol(e,t){const n=e.map(e=>sl(e[t])).filter(e=>null!==e);return n.length?Math.max(...n):null}function sl(e){if(!e)return null;const t=e instanceof Date?e.getTime():Date.parse(e);return Number.isFinite(t)?t:null}function al(e){const t=Math.max(1,Math.round(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}h ${r.toString().padStart(2,"0")}m`:r>0?`${r}m ${i.toString().padStart(2,"0")}s`:`${i}s`}function ll({chatId:e,fileChangeActionDisabled:t,fileChangeActionPending:n,item:r,latestProposedPlanMessageId:i,onImplementPlan:o,onRevisePlan:s,onReviewFileChanges:a,onUndoFileChanges:l,planActionDisabled:c,planActionPending:u,session:d}){return"toolBurst"===r.type?(0,Te.jsx)(Ml,{messages:r.messages}):"previousActions"===r.type?(0,Te.jsx)(Dl,{messages:r.messages}):"fileChanges"===r.type?(0,Te.jsx)(Me,{disabled:t,messages:r.messages,pending:n,onReview:a,onUndo:l}):(0,Te.jsx)(gl,{chatId:e,fileChangeActionDisabled:t,fileChangeActionPending:n,latestProposedPlanMessageId:i,message:r.message,onImplementPlan:o,onRevisePlan:s,onReviewFileChanges:a,onUndoFileChanges:l,planActionDisabled:c,planActionPending:u,session:d})}function cl({message:e,onSteerQueuedMessage:t,queuedMessageActionDisabled:n,queuedMessageActionPendingId:r}){const i=wt(e),o=fl(e),s=(0,Pe.useMemo)(()=>Ka(e.content),[e.content]),a=Wa(s),l=(0,Pe.useMemo)(()=>function(e,t){const n=[],r=new Set,i=e=>{r.has(e.src)||(r.add(e.src),n.push(e))};return e.forEach((e,t)=>{"image"===e.type&&i({id:`inline-image:${t}:${e.src}`,name:"Attached image",src:e.src})}),t.forEach(e=>{"image"===e.kind&&i({id:e.id,name:e.name,src:e.url})}),n}(s,i),[i,s]),c=i.filter(e=>"file"===e.kind),[u,d]=(0,Pe.useState)(null),f=a||c.length;return(0,Te.jsxs)("article",{className:"flex min-w-0 max-w-full justify-end overflow-hidden",children:[(0,Te.jsxs)("div",{className:"flex min-w-0 max-w-[84%] flex-col items-end gap-2 overflow-hidden",children:[l.length?(0,Te.jsx)("div",{className:"flex max-w-full flex-wrap justify-end gap-1.5",children:l.map(e=>(0,Te.jsx)("button",{className:"size-16 overflow-hidden rounded-lg border bg-muted outline-none ring-offset-background transition-opacity hover:opacity-90 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",title:e.name,type:"button",onClick:()=>d(e),children:(0,Te.jsx)("img",{alt:e.name,className:"size-full object-cover",loading:"lazy",src:e.src})},e.id))}):null,f?(0,Te.jsxs)("div",{className:"min-w-0 max-w-full overflow-hidden rounded-lg border border-border bg-card px-3 py-2 text-sm leading-6 text-card-foreground",children:[(0,Te.jsxs)("div",{className:"mb-1 flex min-w-0 items-center justify-between gap-2 text-muted-foreground",children:[(0,Te.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,Te.jsx)(N,{className:"size-3.5 opacity-80"}),(0,Te.jsx)("span",{className:"text-xs font-medium",children:"You"})]}),o?(0,Te.jsx)(y,{className:"shrink-0",variant:o.badgeVariant,children:o.label}):null]}),a?(0,Te.jsx)("div",{className:"whitespace-pre-wrap break-words",children:a}):null,c.length?(0,Te.jsx)("div",{className:"mt-2 flex min-w-0 flex-wrap gap-1.5",children:c.map(e=>(0,Te.jsxs)("span",{className:"inline-flex max-w-full items-center gap-1 rounded-md border bg-muted/35 px-2 py-1 text-xs text-muted-foreground",children:[(0,Te.jsx)(Ne,{className:"size-3.5 shrink-0 opacity-80"}),(0,Te.jsx)("span",{className:"min-w-0 truncate",children:e.path})]},e.id))}):null,o?(0,Te.jsx)(dl,{delivery:o,disabled:n,pending:r===o.queueId,onSteerQueuedMessage:o.queueId?()=>t?.({message:e,queueId:o.queueId}):void 0}):null]}):null]}),(0,Te.jsx)(he,{open:!!u,onOpenChange:e=>{e||d(null)},children:(0,Te.jsxs)(xe,{className:"flex h-[min(90vh,900px)] w-[min(92vw,1000px)] max-w-none flex-col overflow-hidden p-0",children:[(0,Te.jsxs)(ye,{className:"sr-only",children:[(0,Te.jsx)(de,{children:u?.name??"Image preview"}),(0,Te.jsx)(ue,{children:"Full size image preview."})]}),u?(0,Te.jsx)("div",{className:"flex min-h-0 flex-1 items-center justify-center bg-black p-2",children:(0,Te.jsx)("img",{alt:u.name,className:"max-h-full max-w-full object-contain",src:u.src})}):null]})})]})}function ul(){return(0,Te.jsx)("article",{className:"mx-auto flex w-full min-w-0 max-w-full justify-start overflow-hidden",children:(0,Te.jsxs)("div",{className:"flex min-w-0 items-center gap-2 rounded-md px-1 py-2 text-xs text-muted-foreground",children:[(0,Te.jsx)(O,{className:"size-3.5 animate-spin"}),(0,Te.jsx)("span",{children:"Codex is processing"})]})})}function dl({delivery:e,disabled:t,onSteerQueuedMessage:n,pending:r}){const i=e.canSteer&&!!n&&!t&&!r;return(0,Te.jsxs)("div",{className:"mt-2 flex min-w-0 flex-wrap items-center justify-between gap-2 border-t pt-2 text-xs text-muted-foreground",children:[(0,Te.jsx)("span",{className:"min-w-0 break-words leading-5",children:e.detail}),e.canSteer?(0,Te.jsxs)(be,{className:"h-7 shrink-0 px-2 text-xs",disabled:!i,size:"sm",type:"button",variant:"outline",onClick:n,children:[r?(0,Te.jsx)(O,{className:"animate-spin"}):(0,Te.jsx)(je,{}),"Steer"]}):null]})}function fl(e){const t=kt(e.metadata),n=hl(t?.delivery),r=hl(t?.queueStatus),i=hl(t?.queueId),o=hl(t?.error);if("queue"===n||i){const e=r??"queued";return"failed"===e?{badgeVariant:"destructive",canSteer:!1,detail:o?`Queue failed: ${o}`:"Queued message failed.",label:"failed",queueId:i}:"running"===e?{badgeVariant:"secondary",canSteer:!1,detail:"Queued message is now running.",label:"running",queueId:i}:"steered"===e||"steer"===n?{badgeVariant:"secondary",canSteer:!1,detail:"Steered into the active task.",label:"steered",queueId:i}:{badgeVariant:"outline",canSteer:!!i,detail:"Queued after the current task.",label:"queued",queueId:i}}return"steer"===n?{badgeVariant:"secondary",canSteer:!1,detail:"Steered into the active task.",label:"steered"}:null}function pl(e){return"USER"===e.role&&!0===fl(e)?.canSteer}function ml(e){const t=Wa(Ka(e.content)).trim();if(t)return t.length>160?`${t.slice(0,160)}...`:t;const n=wt(e);return n.length?`${n.length} ${1===n.length?"attachment":"attachments"}`:"Queued message"}function hl(e){return"string"==typeof e?e:void 0}function gl({chatId:e,compact:t,fileChangeActionDisabled:n,fileChangeActionPending:r,latestProposedPlanMessageId:i,message:o,onImplementPlan:s,onRevisePlan:a,onReviewFileChanges:l,onUndoFileChanges:c,planActionDisabled:u,planActionPending:d,session:f}){switch(o.kind){case"CHAT":return o.content.trim()?(0,Te.jsx)(vl,{latestProposedPlanMessageId:i,message:o,onImplementPlan:s,onRevisePlan:a,planActionDisabled:u,planActionPending:d}):"STREAMING"===o.status||"PENDING"===o.status?(0,Te.jsx)(xl,{}):null;case"THINKING":return(0,Te.jsx)(yl,{message:o});case"PLAN":return(0,Te.jsx)(bl,{metadata:kt(o.metadata),message:o,latestProposedPlanMessageId:i,onImplementPlan:s,onRevisePlan:a,planActionDisabled:u,planActionPending:d});case"COMMAND_EXECUTION":return(0,Te.jsx)(Tl,{message:o,metadata:kt(o.metadata)});case"FILE_CHANGE":return(0,Te.jsx)(Me,{disabled:n,messages:[o],pending:r,onReview:l,onUndo:c});case"APPROVAL":return(0,Te.jsx)(Rl,{chatId:e,compact:t,message:o,metadata:kt(o.metadata),session:f});case"USER_INPUT_PROMPT":return(0,Te.jsx)(Ol,{chatId:e,compact:t,message:o,metadata:kt(o.metadata),session:f});case"ERROR":return(0,Te.jsx)(Vl,{metadata:kt(o.metadata),text:o.content});default:return(0,Te.jsx)(Ql,{text:o.content})}}function xl(){return(0,Te.jsx)("div",{"aria-label":"Codex is thinking",className:"flex items-center gap-1 px-1 py-2",children:[0,1,2].map(e=>(0,Te.jsx)("span",{className:"size-1.5 animate-bounce rounded-full bg-muted-foreground",style:{animationDelay:120*e+"ms"}},e))})}function yl({message:e}){const t=function(e){const t=e.trim();return t.toLowerCase().startsWith("thinking...")?t.slice(11).trim():"thinking"===t.toLowerCase()?"":t}(e.content),n=function(e){const t=e.split(/\r?\n/).map(e=>e.trim()).find(Boolean);return t?t.length>96?`${t.slice(0,96)}...`:t:null}(t),r="STREAMING"===e.status||"PENDING"===e.status;return(0,Te.jsxs)("details",{className:"group min-w-0 max-w-full overflow-hidden text-sm",open:r,children:[(0,Te.jsxs)("summary",{className:"flex min-w-0 cursor-pointer list-none items-start gap-2 px-1 py-1.5 text-muted-foreground",children:[(0,Te.jsx)(se,{className:"mt-0.5 size-4 shrink-0 transition-transform group-open:rotate-180"}),(0,Te.jsx)("div",{className:"min-w-0 flex-1",children:(0,Te.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,Te.jsx)("span",{className:"size-1.5 shrink-0 rounded-full bg-muted-foreground/60"}),(0,Te.jsx)("span",{className:"shrink-0 font-medium",children:r?"Thinking":"Reasoned"}),n?(0,Te.jsx)("span",{className:"min-w-0 truncate text-xs",children:n}):null]})})]}),t?(0,Te.jsx)("div",{className:"min-w-0 whitespace-pre-wrap break-words px-7 pb-2 text-muted-foreground",children:t}):null]})}function vl({latestProposedPlanMessageId:e,message:t,onImplementPlan:n,onRevisePlan:r,planActionDisabled:i,planActionPending:o}){const s=El(t),a="envelope"===s?.source?s.surroundingText:t.content,l=!!s&&e===t.id&&"COMPLETED"===t.status;return(0,Te.jsxs)("div",{className:"grid min-w-0 gap-2",children:[a.trim()?(0,Te.jsx)(Qa,{text:a}):null,s?(0,Te.jsx)(Sl,{disabled:i,message:t,pending:o,planBody:s.body,showActions:l,onImplementPlan:n,onRevisePlan:r}):null]})}function bl({latestProposedPlanMessageId:e,message:t,metadata:n,onImplementPlan:r,onRevisePlan:i,planActionDisabled:o,planActionPending:s}){const a=n?.steps??[],l=El(t),c=(l?.body??t.content).trim(),u=!!l&&e===t.id&&"COMPLETED"===t.status;return(0,Te.jsxs)("div",{className:"min-w-0 max-w-full overflow-hidden rounded-md border bg-background p-3 text-sm",children:[(0,Te.jsxs)("div",{className:"mb-2 flex items-center gap-2 font-medium",children:[(0,Te.jsx)(v,{className:"size-4"}),u?"Proposed plan":"Plan"]}),c?(0,Te.jsx)(Qa,{text:c}):n?.explanation?(0,Te.jsx)("div",{className:"mb-3 text-muted-foreground",children:n.explanation}):(0,Te.jsx)(Ql,{text:"Planning..."}),a.length?(0,Te.jsx)("div",{className:"mt-3 grid min-w-0 gap-2",children:a.map((e,t)=>(0,Te.jsxs)("div",{className:"flex items-start gap-2",children:[(0,Te.jsx)(y,{variant:"completed"===e.status?"default":"secondary",children:e.status}),(0,Te.jsx)("div",{className:"min-w-0 flex-1",children:e.step})]},`${e.step}-${t}`))}):null,u&&l?(0,Te.jsx)(Al,{disabled:o,message:t,pending:s,planBody:l.body,onImplementPlan:r,onRevisePlan:i}):null]})}function kl(e){if("SYSTEM"!==e.role||"PLAN"!==e.kind)return!1;if("FAILED"===e.status||dt(e))return!1;const t=kt(e.metadata);if("progress"!==t?.presentation)return!1;const n=t.steps??[];return(!n.length||!n.every(e=>jl(e.status)))&&(n.length>0||at(e)||!!Il(t.explanation)||!!Il(e.content))}function wl({highlighted:e,status:t}){return jl(t)?(0,Te.jsx)(A,{className:"mt-0.5 size-3.5 text-primary"}):Cl(t)?(0,Te.jsx)(O,{className:"mt-0.5 size-3.5 animate-spin text-muted-foreground"}):(0,Te.jsx)("span",{className:R("mt-1.5 size-2 rounded-full",e?"bg-primary":"bg-muted-foreground/35")})}function jl(e){return["complete","completed","done","success","succeeded"].includes(Nl(e))}function Cl(e){return["active","in_progress","running","started","streaming","working"].includes(Nl(e))}function Nl(e){return e.trim().toLowerCase().replace(/[\s-]+/g,"_")}function Il(e){const t=e?.trim();return t?["...","planning..."].includes(t.toLowerCase())?null:t:null}function Sl({disabled:e,message:t,onImplementPlan:n,onRevisePlan:r,pending:i,planBody:o,showActions:s}){return(0,Te.jsxs)("div",{className:"min-w-0 max-w-full overflow-hidden rounded-md border bg-background p-3 text-sm",children:[(0,Te.jsxs)("div",{className:"mb-2 flex items-center gap-2 font-medium",children:[(0,Te.jsx)(v,{className:"size-4"}),"Proposed plan"]}),(0,Te.jsx)(Qa,{text:o}),s?(0,Te.jsx)(Al,{disabled:e,message:t,pending:i,planBody:o,onImplementPlan:n,onRevisePlan:r}):null]})}function Al({disabled:e,message:t,onImplementPlan:n,onRevisePlan:r,pending:i,planBody:o}){const[s,a]=(0,Pe.useState)(""),[l,c]=(0,Pe.useState)(!1),u=e||i,f=!!r&&s.trim().length>0&&!u;return(0,Te.jsxs)("div",{className:"mt-3 flex min-w-0 flex-wrap items-center gap-2 border-t pt-3",children:[(0,Te.jsxs)(be,{disabled:u||!n,size:"sm",type:"button",onClick:()=>n?.({message:t,planBody:o}),children:[i?(0,Te.jsx)(O,{className:"animate-spin"}):(0,Te.jsx)(je,{}),"Implement plan"]}),(0,Te.jsxs)(he,{open:l,onOpenChange:c,children:[(0,Te.jsxs)(fe,{render:(0,Te.jsx)(be,{disabled:u||!r,size:"sm",type:"button",variant:"outline"}),children:[(0,Te.jsx)(Se,{}),"Tell Codex what to change"]}),(0,Te.jsxs)(xe,{children:[(0,Te.jsxs)(ye,{children:[(0,Te.jsx)(de,{children:"Tell Codex What To Change"}),(0,Te.jsx)(ue,{children:"Describe what should be adjusted. Codex will revise the plan before implementing."})]}),(0,Te.jsxs)("div",{className:"grid gap-3",children:[(0,Te.jsx)(d,{className:"min-h-32 resize-y",placeholder:"Change the plan to...",value:s,onChange:e=>a(e.target.value)}),(0,Te.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,Te.jsx)(be,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),(0,Te.jsxs)(be,{disabled:!f,type:"button",onClick:()=>{const e=s.trim();e&&(r?.({feedback:e,message:t,planBody:o}),a(""),c(!1))},children:[i?(0,Te.jsx)(O,{className:"animate-spin"}):(0,Te.jsx)(Se,{}),"Send changes"]})]})]})]})]})]})}var Pl=/<proposed_plan\b[^>]*>([\s\S]*?)<\/proposed_plan>/i;function El(e){const t=e.content.trim();if(!t||"Planning..."===t)return null;const n=Pl.exec(e.content);return n?.[1]?.trim()?{body:n[1].trim(),source:"envelope",surroundingText:e.content.replace(Pl,"").trim()}:"PLAN"!==e.kind||"result"!==kt(e.metadata)?.presentation?null:{body:t,source:"planItem",surroundingText:""}}function Tl({message:e,metadata:t}){const n=t?.status??"running",r="STREAMING"===e.status||"PENDING"===e.status,i="FAILED"===e.status||n.toLowerCase().includes("fail")||"number"==typeof t?.exitCode&&0!==t.exitCode,o=(t?.command??e.content.trim())||"command",s=t?.output?.trim()??"",a=s?s.split(/\r?\n/):[],[l,c]=(0,Pe.useState)(!1),u=l?a:a.slice(0,Kl),d=Math.max(0,a.length-u.length);return(0,Te.jsx)("div",{className:"min-w-0 max-w-full overflow-hidden py-1 text-sm",children:(0,Te.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[(0,Te.jsx)("span",{className:R("mt-2 size-1.5 shrink-0 rounded-full",i?"bg-destructive":r?"animate-pulse bg-primary":"bg-muted-foreground/70")}),(0,Te.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,Te.jsxs)("div",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-1",children:[(0,Te.jsx)("span",{className:"shrink-0 font-medium",children:Fl(e,t)}),(0,Te.jsx)("code",{className:"min-w-0 max-w-full break-words rounded bg-muted px-1.5 py-0.5 font-mono text-xs",children:o}),t?.durationMs?(0,Te.jsx)("span",{className:"text-xs text-muted-foreground",children:al(t.durationMs)}):null,"number"==typeof t?.exitCode?(0,Te.jsx)(y,{variant:0===t.exitCode?"secondary":"destructive",children:0===t.exitCode?"ok":t.exitCode}):null]}),t?.cwd?(0,Te.jsx)("div",{className:"mt-1 truncate text-xs text-muted-foreground",children:t.cwd}):null,u.length?(0,Te.jsx)("pre",{className:"mt-2 min-w-0 max-w-full overflow-x-auto rounded-md bg-muted/70 px-3 py-2 font-mono text-xs leading-5 text-muted-foreground",children:u.join("\n")}):r?null:(0,Te.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:"(no output)"}),d>0?(0,Te.jsxs)(be,{className:"mt-1 h-7 px-2 text-xs text-muted-foreground",size:"sm",type:"button",variant:"ghost",onClick:()=>c(!0),children:["Show ",d," more"," ",1===d?"line":"lines"]}):null]})]})})}function Ml({messages:e}){const[t,n]=(0,Pe.useState)(!1),r=[...e].reverse().find(e=>"STREAMING"===e.status||"PENDING"===e.status),i=t?e:function(e){const t=new Set;return e.filter(e=>!t.has(e.id)&&(t.add(e.id),!0))}([...e.slice(0,Gl),...r?[r]:[]]),o=Math.max(0,e.length-i.length),s=st(e);return(0,Te.jsxs)("div",{className:"grid min-w-0 gap-1.5 py-1 text-sm",children:[(0,Te.jsxs)("div",{className:"flex min-w-0 items-center gap-2 px-1 text-xs text-muted-foreground",children:[(0,Te.jsx)(C,{className:"size-3.5 shrink-0"}),(0,Te.jsxs)("span",{className:"min-w-0 truncate",children:[e.length," ",1===e.length?"tool call":"tool calls"]}),(0,Te.jsx)(y,{className:"shrink-0",variant:"secondary",children:s.toLowerCase()})]}),i.map(e=>(0,Te.jsx)(Ll,{message:e},e.id)),o>0?(0,Te.jsxs)(be,{className:"h-7 justify-start px-2 text-xs text-muted-foreground",size:"sm",type:"button",variant:"ghost",onClick:()=>n(!0),children:["Show ",o," more"," ",1===o?"tool call":"tool calls"]}):null]})}function Dl({messages:e}){const[t,n]=(0,Pe.useState)(!1),r=1===e.length?"1 previous message":`${e.length} previous messages`;return(0,Te.jsxs)("div",{className:"grid min-w-0 gap-2 py-1 text-sm",children:[(0,Te.jsxs)("button",{className:"flex min-w-0 items-center gap-2 text-left text-muted-foreground",type:"button",onClick:()=>n(e=>!e),children:[(0,Te.jsx)(se,{className:R("size-4 shrink-0 transition-transform",t?"rotate-0":"-rotate-90")}),(0,Te.jsx)("span",{className:"shrink-0 text-xs",children:r}),(0,Te.jsx)("span",{className:"h-px min-w-4 flex-1 bg-border"})]}),t?(0,Te.jsx)("div",{className:"grid min-w-0 gap-1.5 pl-6",children:e.map(e=>(0,Te.jsx)(Ll,{message:e},e.id))}):null]})}function Ll({message:e}){const t=kt(e.metadata),n=kt(e.metadata),r=function(e,t){return"COMMAND_EXECUTION"===e.kind?(kt(t)?.command??e.content.trim())||"Command":"TOOL_ACTIVITY"===e.kind?e.content.trim()||"Tool activity":"THINKING"===e.kind?"Reasoning":"APPROVAL"===e.kind?"permissions"===kt(t)?.requestKind?"Permission request":"Approval request":"USER_INPUT_PROMPT"===e.kind?"Input request":"CHAT"===e.kind?"Assistant message":e.kind.toLowerCase().replaceAll("_"," ")}(e,t),i="COMMAND_EXECUTION"===e.kind?n?.output||n?.cwd:e.content.trim();return(0,Te.jsxs)("div",{className:"grid min-w-0 max-w-full grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-2 overflow-hidden rounded-md bg-muted/45 px-2 py-1.5",children:[vt(e),(0,Te.jsxs)("div",{className:"min-w-0",children:[(0,Te.jsx)("div",{className:"truncate text-xs font-medium",children:r}),i?(0,Te.jsx)("div",{className:"line-clamp-2 break-words text-xs leading-4 text-muted-foreground",children:i}):null]}),(0,Te.jsx)(y,{variant:"secondary",children:e.status.toLowerCase()})]})}function Fl(e,t){if("STREAMING"===e.status||"PENDING"===e.status)return"Running";const n=function(e){return e?.status?e.status:"number"==typeof e?.exitCode?0===e.exitCode?"completed":"failed":"running"}(t).toLowerCase();return"FAILED"===e.status||n.includes("fail")||n.includes("error")||"number"==typeof t?.exitCode&&0!==t.exitCode?"Failed":"Ran"}function Rl({chatId:e,compact:t=!1,message:n,metadata:r,session:i}){const o="resolved"===r?.status||"COMPLETED"===n.status,s=Wl(e,n,i),a=e=>s.mutate(e);return o||"expired"===r?.status?(0,Te.jsx)(zl,{icon:(0,Te.jsx)(Ie,{className:"size-4"}),status:r?.status??(o?"resolved":void 0),title:"permissions"===r?.requestKind?"Permission request":"Approval request",value:_l(r)}):(0,Te.jsxs)("div",{className:R("min-w-0 max-w-full overflow-hidden rounded-md border bg-muted/35 text-sm text-foreground",t?"p-2":"p-3"),children:[(0,Te.jsxs)("div",{className:R("flex items-center gap-2 font-medium",t?"mb-1.5":"mb-2"),children:[(0,Te.jsx)(Ie,{className:"size-4"}),"permissions"===r?.requestKind?"Permission request":"Approval required"]}),r?.reason?(0,Te.jsx)("div",{className:R("text-sm",t?"mb-1.5 line-clamp-2":"mb-2"),children:r.reason}):null,r?.command?(0,Te.jsx)("code",{className:"block min-w-0 max-w-full overflow-x-auto rounded border bg-background px-2 py-1 font-mono text-xs",children:r.command}):null,(0,Te.jsx)("div",{className:R("flex flex-wrap gap-2",t?"mt-2":"mt-3"),children:o?(0,Te.jsxs)(y,{variant:"secondary",children:[(0,Te.jsx)(A,{className:"size-3"}),"resolved"]}):(0,Te.jsxs)(Te.Fragment,{children:[(0,Te.jsxs)(be,{disabled:s.isPending,size:"sm",onClick:()=>a("permissions"===r?.requestKind?{kind:"permissions",result:{scope:"turn",permissions:!0}}:{decision:"accept",kind:"approval"}),children:[s.isPending?(0,Te.jsx)(O,{className:"animate-spin"}):(0,Te.jsx)(A,{}),"Accept"]}),(0,Te.jsx)(be,{disabled:s.isPending,size:"sm",variant:"outline",onClick:()=>a("permissions"===r?.requestKind?{kind:"permissions",result:{scope:"session",permissions:!0}}:{decision:"acceptForSession",kind:"approval"}),children:"Accept for session"}),(0,Te.jsx)(be,{disabled:s.isPending,size:"sm",variant:"outline",onClick:()=>a("permissions"===r?.requestKind?{kind:"permissions",result:{permissions:!1}}:{decision:"decline",kind:"approval"}),children:"Decline"})]})})]})}function Ol({chatId:e,compact:t=!1,message:n,metadata:r,session:i}){const[o,s]=(0,Pe.useState)({}),[a,c]=(0,Pe.useState)(0),u=Wl(e,n,i),d=r?.questions?.length?r.questions:[{id:"answer",question:r?.message??"Answer"}],f="resolved"===r?.status||"COMPLETED"===n.status,p=function(e){const t=e;return"request_user_input"===t?.toolName||"function_call"===t?.sourcePayloadType}(r),m=Math.min(a,Math.max(d.length-1,0)),h=d[m],g=!!h&&$l(h,o[h.id]).length>0,x=d.every(e=>$l(e,o[e.id]).length>0),v=m>=d.length-1,b=()=>c(e=>Math.min(e+1,d.length-1));if(f||"expired"===r?.status)return(0,Te.jsx)(zl,{icon:(0,Te.jsx)(A,{className:"size-4"}),status:r?.status??(f?"resolved":void 0),title:"Input request",value:ql(r)});return(0,Te.jsxs)("div",{className:R("min-w-0 max-w-full overflow-hidden rounded-md border bg-background text-sm",t?"p-2":"p-3"),children:[(0,Te.jsxs)("div",{className:R("flex items-center justify-between gap-3",t?"mb-2":"mb-3"),children:[(0,Te.jsx)("div",{className:"min-w-0 font-medium",children:t?"Input needed":"Codex needs input"}),(0,Te.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[(0,Te.jsx)(be,{"aria-label":"Previous question",disabled:f||u.isPending||0===m,size:"icon-xs",variant:"ghost",onClick:()=>c(e=>Math.max(e-1,0)),children:(0,Te.jsx)(we,{})}),(0,Te.jsxs)(y,{variant:"secondary",children:[m+1," / ",d.length]}),(0,Te.jsx)(be,{"aria-label":"Next question",disabled:f||u.isPending||v||!p&&!g,size:"icon-xs",variant:"ghost",onClick:b,children:(0,Te.jsx)(je,{})}),f?(0,Te.jsx)(y,{variant:"secondary",children:"resolved"}):null]})]}),h?(0,Te.jsx)(Ul,{compact:t,disabled:f||u.isPending||p,question:h,value:o[h.id]??Bl,onChange:e=>s(t=>({...t,[h.id]:e})),onAutoAdvance:v?void 0:b}):null,p?(0,Te.jsx)("div",{className:R("text-xs leading-4 text-muted-foreground",t?"mt-2":"mt-4"),children:"Answer this in the Codex client that started the turn."}):v?(0,Te.jsx)("div",{className:R("flex justify-end",t?"mt-2":"mt-4"),children:(0,Te.jsxs)(be,{disabled:f||u.isPending||!x,size:"sm",onClick:()=>{x?u.mutate({kind:"userInput",result:Hl(d,o)}):l.error("Answer every question before submitting.")},children:[u.isPending?(0,Te.jsx)(O,{className:"animate-spin"}):(0,Te.jsx)(A,{}),"Submit"]})}):null]})}function zl({icon:e,status:t,title:n,value:r}){return(0,Te.jsxs)("div",{className:"grid min-w-0 max-w-full gap-1 overflow-hidden rounded-md border bg-muted/25 px-2.5 py-2 text-sm",children:[(0,Te.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,Te.jsx)("span",{className:"text-muted-foreground",children:e}),(0,Te.jsx)("span",{className:"min-w-0 flex-1 font-medium",children:n}),t?(0,Te.jsx)(y,{variant:"secondary",children:t}):null]}),r?(0,Te.jsx)("div",{className:"line-clamp-2 break-words text-xs leading-4 text-muted-foreground",children:r}):null]})}function _l(e){if(!e)return"No decision details.";const t=e.decision??e.result;return void 0===t?"expired"===e.status?"The request expired before a decision was sent.":"Decision sent.":`Decision: ${function(e){return"string"==typeof e?e:"number"==typeof e||"boolean"==typeof e?String(e):null===e?"none":JSON.stringify(e)}(t)}`}function ql(e){if(!e)return"No answer details.";if("expired"===e.status)return"The request expired before an answer was sent.";const t=function(e){const t=e.result;if(!t||"object"!=typeof t||Array.isArray(t))return[];const n=t.answers;return!n||"object"!=typeof n||Array.isArray(n)?[]:Object.entries(n).map(([t,n])=>{const r=e.questions?.find(e=>e.id===t),i=function(e){if(!e||"object"!=typeof e||Array.isArray(e))return[];const t=e.answers;return Array.isArray(t)?t.filter(e=>"string"==typeof e).map(e=>e.trim()).filter(Boolean):[]}(n);return i.length?`${r?.header??r?.question??t}: ${i.join(", ")}`:null}).filter(e=>!!e)}(e);return t.length?t.join("; "):"Answer sent."}var Bl={other:"",values:[]};function Ul({compact:e=!1,disabled:t,onChange:n,onAutoAdvance:r,question:i,value:o}){const s=i.options??[],a=function(e){if(!e.options?.length)return;return e.selectionLimit&&e.selectionLimit>0?e.selectionLimit:1}(i),l=o.values??[],c=o.other??"",u=e=>n({other:c,values:l,...e});return(0,Te.jsxs)("div",{className:"grid min-w-0 max-w-full gap-2 overflow-hidden",children:[(0,Te.jsxs)("div",{className:"grid min-w-0 gap-1",children:[(0,Te.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:i.header??i.question}),i.header?(0,Te.jsx)("span",{className:R("text-sm",e?"leading-4":"leading-5"),children:i.question}):null]}),s.length?(0,Te.jsx)("div",{className:R("grid min-w-0",e?"gap-1":"gap-2"),children:s.map(n=>{const i=l.includes(n.label),o="number"==typeof a&&a>1&&l.length>=a;return(0,Te.jsxs)(be,{"aria-pressed":i,className:R("h-auto w-full min-w-0 justify-start overflow-hidden whitespace-normal text-left",e?"min-h-9 px-2.5 py-1.5":"min-h-12 px-3 py-2"),disabled:t||!i&&o,size:"default",type:"button",variant:i?"default":"outline",onClick:()=>(e=>{if(!t){if(1===a){const t=l.includes(e);return u({values:t?[]:[e]}),void(t||r?.())}l.includes(e)?u({values:l.filter(t=>t!==e)}):"number"==typeof a&&l.length>=a||u({values:[...l,e]})}})(n.label),children:[(0,Te.jsxs)("span",{className:R("grid min-w-0 flex-1 overflow-hidden",e?"gap-0.5":"gap-1"),children:[(0,Te.jsx)("span",{children:n.label}),n.description?(0,Te.jsx)("span",{className:R("text-xs font-normal leading-4 opacity-75",e&&"line-clamp-2"),children:n.description}):null]}),i?(0,Te.jsx)(A,{className:"ml-2 shrink-0"}):null]},n.label)})}):i.isSecret?(0,Te.jsx)(ke,{disabled:t,type:"password",value:c,onChange:e=>u({other:e.target.value})}):(0,Te.jsx)(d,{className:e?"min-h-14":"min-h-20",disabled:t,value:c,onChange:e=>u({other:e.target.value})}),i.isOther&&s.length?(0,Te.jsx)(d,{className:e?"min-h-12":"min-h-16",disabled:t,placeholder:"Other answer",value:c,onChange:e=>u({other:e.target.value})}):null,"number"==typeof a&&a>1?(0,Te.jsxs)("span",{className:"text-xs text-muted-foreground",children:["Select up to ",a,"."]}):null]})}function Hl(e,t){return{answers:Object.fromEntries(e.map(e=>[e.id,{answers:$l(e,t[e.id])}]))}}function $l(e,t){const n=t?.values??[],r=t?.other??"";return[...n,...e.isOther||!e.options?.length?[r]:[]].map(e=>e.trim()).filter(Boolean)}function Vl({metadata:e,text:t}){return(0,Te.jsxs)("div",{className:"min-w-0 max-w-full overflow-hidden rounded-md border border-destructive/30 bg-destructive/10 p-3 text-sm text-destructive",children:[(0,Te.jsxs)("div",{className:"mb-1 flex items-center gap-2 font-medium",children:[(0,Te.jsx)(ve,{className:"size-4"}),"Error"]}),(0,Te.jsx)("div",{className:"min-w-0 whitespace-pre-wrap break-words",children:e?.message??t})]})}function Ql({text:e}){return(0,Te.jsx)("div",{className:"min-w-0 whitespace-pre-wrap break-words text-sm text-muted-foreground",children:e})}function Wl(e,t,n){const r=c();return u({mutationFn:r=>{if(!t.requestId)throw new Error("Request id is missing.");return D(n,e,t.requestId,r)},onError:e=>l.error(function(e){return e instanceof Error?e.message:"Request failed."}(e)),onSuccess:t=>{r.setQueryData(["messages",e],e=>$(e,t))}})}var Gl=5,Kl=5;function Yl(e,t){if(!e?.data.length)return t;const n=[...t.data];for(const i of e.data)Xl(i,n)||n.push(i);const r=Math.max(0,e.nextCursor??0,t.nextCursor??0,...n.map(e=>e.sequence));return{data:n.sort(Zl),nextCursor:r||null}}function Xl(e,t){return t.some(t=>t.id===e.id||function(e,t){if(e.chatId!==t.chatId||e.role!==t.role||e.kind!==t.kind)return!1;if(e.requestId&&t.requestId)return e.requestId===t.requestId;if(e.itemId&&t.itemId)return e.itemId===t.itemId;if("CHAT"!==e.kind)return!1;const n=Jl(e.content),r=Jl(t.content);return!(!n||!r)&&(n===r||function(e){return"PENDING"===e.status||"STREAMING"===e.status}(t)&&n.includes(r))}(t,e))}function Jl(e){return e.replace(/\s+/g," ").trim()}function Zl(e,t){return e.sequence-t.sequence||new Date(e.createdAt).getTime()-new Date(t.createdAt).getTime()||e.id.localeCompare(t.id)}function ec(){const{chatId:e}=o(),{accounts:t,accountRateLimitFetching:n,accountRateLimitSnapshots:r,accountUsageSummaries:i,connectedAccounts:a,openWorkspacePicker:y,session:v,setActiveProjectPath:C,setTerminalOpen:N,terminalCount:A,terminalOpen:P,terminalSocket:D,terminalSocketConnected:L}=J(),[_,se]=(0,Pe.useState)(""),[ae,le]=(0,Pe.useState)([]),[ce,ue]=(0,Pe.useState)(null),de=(0,Pe.useRef)(null),fe=(0,Pe.useRef)(null),pe=(0,Pe.useRef)(!0),he=c(),xe=(0,Pe.useMemo)(()=>["chat",e],[e]),ye=(0,Pe.useMemo)(()=>["messages",e],[e]);(0,Pe.useEffect)(()=>{ue(null),le([])},[e]);const ve=S({enabled:!!e,queryKey:xe,queryFn:()=>H(v,e),refetchInterval:2500}),be=S({enabled:!!e,queryKey:ye,queryFn:()=>q(v,e,0),refetchInterval:2500,structuralSharing:(e,t)=>Yl(e,t)}),ke=S({enabled:!!e&&!ce,queryKey:["chat-context",e],queryFn:()=>U(v,e),retry:!1,staleTime:3e4});(0,Pe.useEffect)(()=>{ke.data?.usage&&!ce&&ue(ke.data.usage)},[ke.data?.usage,ce]);const we=(0,Pe.useMemo)(()=>be.data?.data??[],[be.data]),je=ve.data;(0,Pe.useEffect)(()=>{je&&he.setQueryData(["chats"],e=>e?.map(e=>e.id===je.id?je:e))},[je,he]);const Ce=t.find(e=>e.id===je?.accountId),Ne="RUNNING"===je?.status,Ie=(0,Pe.useMemo)(()=>lt(we),[we]),Se=(0,Pe.useMemo)(()=>function(e,t){if(!t)return null;const n=Xe(e).filter(e=>!ut(e)).sort((e,t)=>e.sequence-t.sequence);for(let r=n.length-1;r>=0;r-=1){const e=n[r];if(kl(e))return e}return null}(we,Ne),[Ne,we]),Ae=(0,Pe.useMemo)(()=>function(e){return Ye(e).filter(pl)}(we),[we]),Ee=!(P&&je?.workingDirectory),Me=(0,Pe.useMemo)(()=>[Ie.pendingRequest?.id,Ee?Se?.id:void 0,...Ee?Ae.map(e=>e.id):[]].filter(e=>!!e),[Ee,Ae,Se?.id,Ie.pendingRequest?.id]),De=(0,Pe.useMemo)(()=>function(e){if(!e)return"";const t=kt(e.metadata),n=(t?.steps??[]).map(e=>`${e.status}:${e.step}`).join("|");return[e.id,e.status,e.content.length,t?.explanation?.length??0,n].join(":")}(Se),[Se]),Le=(0,Pe.useMemo)(()=>we.map(e=>`${e.id}:${e.sequence}:${e.status}:${e.content.length}`).join("|"),[we]);(0,Pe.useEffect)(()=>(C(je?.workingDirectory?.trim()??""),()=>C("")),[je?.workingDirectory,C]);const Fe=(0,Pe.useCallback)(e=>e.scrollHeight-e.scrollTop-e.clientHeight<96,[]),Re=(0,Pe.useCallback)((e="auto")=>{const t=de.current;t&&t.scrollTo({behavior:e,top:t.scrollHeight})},[]),Oe=S({enabled:!!Ce?.id&&"CONNECTED"===Ce.status,queryKey:["models",Ce?.id],queryFn:()=>E(v,Ce.id),staleTime:3e5});(0,Pe.useEffect)(()=>{x(Oe.error)&&he.invalidateQueries({queryKey:["accounts"]})},[Oe.error,he]);const ze=Ce?.id?r[Ce.id]:void 0,_e=!!Ce?.id&&!!n[Ce.id],qe=u({mutationFn:t=>z(v,e,{accountId:t.accountId}),onError:e=>l.error(g(e)),onSuccess:(e,t)=>{he.setQueryData(xe,e),he.invalidateQueries({queryKey:["chats"]}),!1!==t.notify&&l.success("Chat account updated.")}}),Be=u({mutationFn:t=>z(v,e,t),onError:e=>l.error(g(e)),onSuccess:e=>{he.setQueryData(xe,e),he.invalidateQueries({queryKey:["chats"]})}}),Ue=u({mutationFn:({accountId:e,settings:t})=>T(v,e,t),onError:e=>l.error(g(e)),onSuccess:e=>{he.setQueryData(["accounts"],t=>h(t,e))}}),He=u({mutationFn:t=>B(v,e,{attachments:t?.attachments,collaborationMode:t?.collaborationMode,content:(t?.content??_).trim(),delivery:t?.delivery,metadata:t?.metadata}),onError:e=>l.error(g(e)),onSuccess:(e,t)=>{pe.current=!0,(t?.clearComposer??1)&&(se(""),le([])),he.setQueryData(ye,t=>b(t,k(e))),he.invalidateQueries({queryKey:xe}),he.invalidateQueries({queryKey:["chats"]})}}),$e=u({mutationFn:()=>M(v,e),onError:e=>l.error(g(e)),onSuccess:()=>{l.message("Stop requested.")}}),Ve=u({mutationFn:t=>F(v,e,t.queueId),onError:e=>l.error(g(e)),onSuccess:e=>{he.setQueryData(ye,t=>$(t,e)),he.invalidateQueries({queryKey:xe}),he.invalidateQueries({queryKey:["chats"]})}}),Qe=(0,Pe.useMemo)(()=>w(a,r),[r,a]),We=(0,Pe.useMemo)(()=>j(je,Ce,Qe,r),[r,Qe,Ce,je])?.id;(0,Pe.useEffect)(()=>{!We||qe.isPending||He.isPending||qe.mutate({accountId:We,notify:!1})},[We,He.isPending,qe.isPending]);const Ge=(0,Pe.useCallback)(e=>{e?.length&&W(e).then(e=>{le(t=>[...t,...e])}).catch(e=>l.error(g(e)))},[]),Ke=(0,Pe.useCallback)(()=>{y({initialPath:ve.data?.workingDirectory,mode:"file",onSelect:e=>{le(t=>[...t,oe(e)])}})},[ve.data?.workingDirectory,y]),Je=(0,Pe.useCallback)(e=>{He.mutate({clearComposer:!1,collaborationMode:"default",content:"Implement the latest approved plan from the most recent proposed plan in this thread.",metadata:{action:"implementPlan",planMessageId:e.message.id,source:"proposedPlan"}})},[He]),Ze=(0,Pe.useCallback)(e=>{var t;He.mutate({clearComposer:!1,collaborationMode:"plan",content:(t=e.feedback,["Revise the latest proposed plan from this thread using the following requested changes.","Do not implement yet. Return an updated proposed plan.","",t].join("\n")),metadata:{action:"revisePlan",planMessageId:e.message.id,source:"proposedPlan"}})},[He]),et=(0,Pe.useCallback)(e=>{He.mutate({clearComposer:!1,collaborationMode:"default",content:e.prompt,metadata:{action:"reviewFileChanges",fileChangeMessageId:e.message.id,source:"fileChangeSummary"}})},[He]),tt=(0,Pe.useCallback)(e=>{He.mutate({clearComposer:!1,collaborationMode:"default",content:e.prompt,metadata:{action:"undoFileChanges",fileChangeMessageId:e.message.id,source:"fileChangeSummary"}})},[He]);if((0,Pe.useEffect)(()=>{if(!e)return;return function(e,t,n){let r=!1;const i=f(e.serverUrl||window.location.origin,{auth:{token:e.token},path:"/socket.io",reconnection:!0,transports:["websocket"]});return i.on("connect",()=>{i.emit("chat:join",t,e=>{r||(e?.ok?n.onOpen?.():n.onError?.(new Error(e?.message??"Unable to join chat stream.")))})}),i.on("chat:event",e=>{r||e.chatId!==t||n.onEvent(e.type,e.payload)}),i.on("disconnect",()=>{r||n.onClose?.()}),i.on("connect_error",e=>{r||n.onError?.(e)}),()=>{r=!0,i.connected&&i.emit("chat:leave",t),i.disconnect()}}(v,e,{onError:e=>l.error(g(e)),onEvent:(e,n)=>{"chat.updated"!==e?"context.updated"!==e?(he.setQueryData(ye,t=>function(e,t,n){if("message.created"===t||"message.updated"===t||"message.completed"===t)return $(e,n);if("message.failed"===t)return $(e,n);if("message.delta"===t){const t=n;return e?{...e,data:e.data.map(e=>e.id===t.messageId?{...e,content:t.content,status:"STREAMING"}:e)}:e}return e}(t,e,n)),"message.completed"!==e&&"message.failed"!==e||(he.invalidateQueries({queryKey:ye}),he.invalidateQueries({queryKey:xe}),he.invalidateQueries({queryKey:["chats"]}))):ue(n):t(n)},onOpen:()=>{q(v,e,0).then(e=>{he.setQueryData(ye,t=>Yl(t,e))}).catch(e=>l.error(g(e))),H(v,e).then(t).catch(e=>l.error(g(e)))}});function t(e){he.setQueryData(xe,e),he.setQueryData(["chats"],t=>t?.map(t=>t.id===e.id?e:t))}},[e,xe,ye,he,v]),(0,Pe.useEffect)(()=>{pe.current=!0;const e=requestAnimationFrame(()=>Re("auto"));return()=>cancelAnimationFrame(e)},[e,Re]),(0,Pe.useEffect)(()=>{if(!pe.current)return;let e=0;const t=requestAnimationFrame(()=>{Re("auto"),e=requestAnimationFrame(()=>Re("auto"))});return()=>{cancelAnimationFrame(t),cancelAnimationFrame(e)}},[De,Le,Re]),!e)return(0,Te.jsx)(s,{replace:!0,to:"/"});if(ve.isLoading||be.isLoading)return(0,Te.jsx)("main",{className:"flex min-h-0 min-w-0 flex-1 items-center justify-center overflow-hidden bg-background",children:(0,Te.jsx)(O,{className:"size-5 animate-spin text-muted-foreground"})});if(ve.error)return(0,Te.jsx)("main",{className:"flex min-h-0 min-w-0 flex-1 items-center justify-center overflow-hidden p-6",children:(0,Te.jsxs)("div",{className:"max-w-md rounded-md border border-destructive/30 bg-destructive/10 p-4 text-sm text-destructive",children:[(0,Te.jsx)("div",{className:"font-medium",children:"Chat not available"}),(0,Te.jsx)("div",{className:"mt-1 whitespace-pre-wrap",children:ve.error.message})]})});const nt=je,rt=Ce,it=Oe.data?.data??[],ot=!!nt&&!Ne&&a.length>0,st=m(it,nt?.model),at=st?.supportedReasoningEfforts.map(e=>e.reasoningEffort)??[],ct=nt?.reasoningEffort??st?.defaultReasoningEffort??null,dt=st?.additionalSpeedTiers??[],ft=_.trim().length>0||ae.length>0,pt=I(_,nt?.workingDirectory??"",rt,ae);return(0,Te.jsxs)("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-sidebar",children:[(0,Te.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-b-xl bg-background",children:[(0,Te.jsx)(p,{className:"min-h-0 min-w-0 flex-1 overflow-hidden",viewportRef:de,viewportProps:{className:"overflow-x-hidden",onScroll:e=>{pe.current=Fe(e.currentTarget)}},children:(0,Te.jsx)("div",{className:"mx-auto flex w-full min-w-0 max-w-3xl flex-col gap-5 overflow-hidden px-4 pb-12 pt-6",children:we.length?(0,Te.jsx)(Xa,{chatId:e,fileChangeActionDisabled:Ne,fileChangeActionPending:He.isPending,hiddenMessageIds:Me,messages:we,onImplementPlan:Je,onRevisePlan:Ze,onReviewFileChanges:et,onSteerQueuedMessage:e=>Ve.mutate(e),onUndoFileChanges:tt,planActionDisabled:Ne,planActionPending:He.isPending,queuedMessageActionDisabled:!Ne||Ve.isPending,queuedMessageActionPendingId:Ve.variables?.queueId??null,session:v,showProcessingTail:Ne&&!Ie.pendingRequest}):(0,Te.jsx)("div",{className:"py-20 text-center text-sm text-muted-foreground",children:"No messages yet."})})}),(0,Te.jsx)("div",{className:R("min-w-0 border-t bg-background",P&&nt?.workingDirectory?"overflow-y-auto max-sm:max-h-[calc(100svh-3.5rem)]":"overflow-hidden"),children:P&&nt?.workingDirectory?(0,Te.jsx)("div",{className:"p-2",children:(0,Te.jsx)("div",{className:"mx-auto max-w-5xl",children:(0,Te.jsx)(K,{onClosePanel:()=>N(!1),projectPath:nt.workingDirectory,socket:D,socketConnected:L})})}):(0,Te.jsxs)(Te.Fragment,{children:[(0,Te.jsx)(Za,{message:Se}),(0,Te.jsx)(el,{disabled:!Ne||Ve.isPending,messages:Ae,pendingQueueId:Ve.variables?.queueId??null,onSteerQueuedMessage:e=>Ve.mutate(e)}),(0,Te.jsx)(Ja,{chatId:e,messages:we,session:v}),(0,Te.jsx)("div",{className:"p-2",children:(0,Te.jsxs)("div",{className:"mx-auto grid min-w-0 max-w-3xl gap-2 overflow-hidden rounded-xl border bg-background p-2 shadow-sm",children:[(0,Te.jsxs)("div",{className:"relative min-w-0",children:[(0,Te.jsx)(ie,{visible:"plan"===(nt?.collaborationMode??"default")}),(0,Te.jsx)(d,{className:R("max-h-32 min-h-12 bg-transparent! text-xs resize-none border-0 px-1 shadow-none focus-visible:ring-0","plan"===(nt?.collaborationMode??"default")&&"pr-24"),placeholder:nt?.workingDirectory?rt?"Message Codex":"Choose an account first":"Choose a directory first",value:_,onChange:e=>se(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),pt&&He.mutate({attachments:X(ae),clearComposer:!0,delivery:Ne?"queue":void 0}))},onPaste:e=>{const t=G(e.clipboardData);t.length&&Ge(t)}})]}),(0,Te.jsx)(Q,{attachments:ae,imageInputRef:fe,onAttachImages:Ge,onRemove:e=>le(t=>t.filter(t=>t.id!==e))}),(0,Te.jsxs)("div",{className:"flex items-center justify-between gap-1 sm:gap-2",children:[(0,Te.jsxs)("div",{className:"flex min-w-0 flex-1 flex-nowrap items-center gap-1 overflow-hidden sm:flex-wrap",children:[(0,Te.jsx)(ee,{attachmentDisabled:He.isPending,disabled:!nt,modeDisabled:Ne,mode:nt?.collaborationMode??"default",onAttachFile:Ke,onAttachImage:()=>fe.current?.click(),pending:Be.isPending,onSelectMode:e=>Be.mutate({collaborationMode:e})}),(0,Te.jsx)(te,{account:rt,autoRotate:nt?.autoRotateAccount??!1,autoRotateDisabled:!nt||Be.isPending,connectedAccounts:a,disabled:!nt||!a.length,pending:qe.isPending,selectedAccountId:nt?.accountId??"",selectionDisabled:!ot,usageSummaries:i,onAutoRotateChange:e=>Be.mutate({autoRotateAccount:e}),onSelect:e=>qe.mutate({accountId:e})}),(0,Te.jsx)(Z,{activeReasoningEffort:ct,disabled:!nt||Ne||!rt,modelOptions:it,modelValue:nt?.model??"",pending:Oe.isFetching||Be.isPending,reasoningOptions:at,reasoningValue:nt?.reasoningEffort??"",selectedModel:st,serviceTierOptions:dt,serviceTierValue:nt?.serviceTier??"",onSelectModel:e=>{nt?.accountId&&Ue.mutate({accountId:nt.accountId,settings:{defaultModel:e||null,defaultReasoningEffort:null,defaultServiceTier:null}}),Be.mutate({model:e||null,reasoningEffort:null,serviceTier:null})},onSelectReasoning:e=>{const t=e||null;nt?.accountId&&Ue.mutate({accountId:nt.accountId,settings:{defaultModel:nt.model??null,defaultReasoningEffort:t,defaultServiceTier:nt.serviceTier??null}}),Be.mutate({reasoningEffort:t})},onSelectServiceTier:e=>{const t=e||null;nt?.accountId&&Ue.mutate({accountId:nt.accountId,settings:{defaultModel:nt.model??null,defaultReasoningEffort:nt.reasoningEffort??null,defaultServiceTier:t}}),Be.mutate({serviceTier:t})}}),(0,Te.jsx)(V,{disabled:!nt,mode:nt?.permissionMode??"default",pending:Be.isPending,onSelectMode:e=>{nt?.accountId&&Ue.mutate({accountId:nt.accountId,settings:{defaultPermissionMode:e}}),Be.mutate({permissionMode:e})}})]}),(0,Te.jsxs)("div",{className:"flex shrink-0 items-center gap-1 sm:gap-2",children:[(0,Te.jsx)(Y,{usage:ce}),(0,Te.jsx)(re,{pending:_e,snapshot:ze}),(0,Te.jsx)(ne,{loading:He.isPending,running:Ne,hasDraft:ft,sendDisabled:!pt,stopPending:$e.isPending,onSend:()=>He.mutate({attachments:X(ae),clearComposer:!0,delivery:Ne?"queue":void 0}),steerDisabled:!Ne||He.isPending||!pt,onSteer:()=>He.mutate({attachments:X(ae),clearComposer:!0,delivery:"steer"}),onStop:()=>$e.mutate()})]})]})]})})]})})]}),nt?(0,Te.jsxs)("div",{className:"hidden min-h-9 shrink-0 items-center justify-end gap-1 bg-sidebar px-3 py-1 md:-mb-2 md:flex",children:[(0,Te.jsx)(me,{active:P,className:R("hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",P?"text-sidebar-accent-foreground":"text-sidebar-foreground/75"),count:A,disabled:!nt.workingDirectory?.trim(),onToggle:()=>N(!P)}),(0,Te.jsx)(ge,{chatId:nt.id,className:"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground aria-expanded:bg-sidebar-accent aria-expanded:text-sidebar-accent-foreground",disabled:Ne,session:v})]}):null]})}var tc=r(function(){return(0,Te.jsx)(ec,{})});export{tc as default};
|