@inkeep/open-knowledge 0.80.0-beta.3 → 0.80.0-beta.5
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/dist/cli.mjs +6 -6
- package/dist/constants-BZiqchuc.mjs +1 -0
- package/dist/{dist-LKhxaIqd.mjs → dist-CuWl8z8W.mjs} +1 -1
- package/dist/{dist-DIt2A6O3.mjs → dist-DZXRg1jC.mjs} +483 -483
- package/dist/index.mjs +107 -105
- package/dist/{init-BGBPXL0D.mjs → init-Boyt6ulg.mjs} +2 -2
- package/dist/init-Bx1lz5rE.mjs +1 -0
- package/dist/{launch-json-removal-DIzQ3twn.mjs → launch-json-removal-B7LKMRLc.mjs} +1 -1
- package/dist/loader-C5L_-7Kf.mjs +1 -0
- package/dist/{loader-D1pgp7cf.mjs → loader-DXL-jEwi.mjs} +1 -1
- package/dist/{md-manager-BGnqyqi1-Kd9RuPsT.mjs → md-manager-BGnqyqi1-LuKRfqxD.mjs} +31 -29
- package/dist/{open-browser-C_W051pq.mjs → open-browser-B_00nhl_.mjs} +1 -1
- package/dist/parse-worker.mjs +1 -1
- package/dist/{preview-p2PvxfBS.mjs → preview-B_9MsldP.mjs} +1 -1
- package/dist/preview-C2LIBolB.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-BAPXGHWo.js → ActivityModeContent-Fa2Bc7H7.js} +1 -1
- package/dist/public/assets/{AddPropertiesButton-DaM5tzpb.js → AddPropertiesButton-CY_aojnI.js} +2 -2
- package/dist/public/assets/{AgentDiffPane-CjZnjfGe.js → AgentDiffPane-VQlod0uk.js} +1 -1
- package/dist/public/assets/{AgentThreadClientBinder-BSPGAh_E.js → AgentThreadClientBinder-D83Ifc_u.js} +1 -1
- package/dist/public/assets/{BugReportHistory-CJiUb73a.js → BugReportHistory-DNPLKDE6.js} +1 -1
- package/dist/public/assets/{BugReportHistoryDialog-CtByXbBx.js → BugReportHistoryDialog-BMwN9BIK.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-6Z5ZMAPQ.js → CodeMirrorPropInput-q5OQqF4N.js} +1 -1
- package/dist/public/assets/{ConsentDialogBody-DpXOW8ek.js → ConsentDialogBody-BarwUkfl.js} +1 -1
- package/dist/public/assets/{DeleteConfirmationDialog-BHaoO6w5.js → DeleteConfirmationDialog-tv35CpzH.js} +1 -1
- package/dist/public/assets/{DiffViewBoundary-B3HbMKFC.js → DiffViewBoundary-Df7pBeha.js} +1 -1
- package/dist/public/assets/{DocumentContext-Cn9J8crD.js → DocumentContext-VRYqEU-B.js} +1 -1
- package/dist/public/assets/{EditorModeToggle-AmfJVzHm.js → EditorModeToggle-Ey6xkZS2.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-C9TkBHT5.js → EnableSyncConfirmDialog-Di9qhAZg.js} +1 -1
- package/dist/public/assets/{ExcalidrawDocEditor-qQa8ZSkt.js → ExcalidrawDocEditor-CjG9RZeu.js} +1 -1
- package/dist/public/assets/FeedbackForm-0otENm61.js +1 -0
- package/dist/public/assets/{GraphPanel-DrXj04wO.js → GraphPanel-sDvfmrPI.js} +1 -1
- package/dist/public/assets/{ImageAttachments-BCZsZ1sq.js → ImageAttachments-COJDM7Zs.js} +1 -1
- package/dist/public/assets/{ImportSkillDialog-DQxxrVN7.js → ImportSkillDialog-DZI_Ymxz.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-ConhfeLc.js → LintConfigEditor-CMCb-_WR.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-C-JL8uLM.js +1 -0
- package/dist/public/assets/{ManagedArtifactProperties-CX6Vb1JW.js → ManagedArtifactProperties-C-o6w1oB.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-BsGXHGGp.js → MermaidDocEditor-af9-qY7T.js} +1 -1
- package/dist/public/assets/{OpenInAgentMenuItem-nGXqEk1W.js → OpenInAgentMenuItem-lbV79xn9.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-DzMc70ZS.js → PropertyDisplayRow-CbnGGdQB.js} +1 -1
- package/dist/public/assets/{RegisteredAgentIcon-Csy_gtym.js → RegisteredAgentIcon-Btbw9w2J.js} +1 -1
- package/dist/public/assets/{ReportBugDialogBody-DYDHbNSq.js → ReportBugDialogBody-B1H-65Sn.js} +1 -1
- package/dist/public/assets/{ReportBugMenuTrigger-BI86cMBx.js → ReportBugMenuTrigger-B-ySnIcK.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-CAUyzvxl.js → SchemaConfigEditor-T4_tM4AM.js} +1 -1
- package/dist/public/assets/{SessionsHost-BlOe2SwN.js → SessionsHost-Df6cK8IF.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-bGbz3rU_.js → SettingsDialogBody-7ULgKnMJ.js} +1 -1
- package/dist/public/assets/{ShareBranchSwitchDialog-B1uJs5Bn.js → ShareBranchSwitchDialog-ycuaed88.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-D5zztXCK.js → ShareReceiveDialog-DmE16_gX.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-DTEfqcON.js → ShareReceiveMissDialog-DqsqkZ98.js} +1 -1
- package/dist/public/assets/{SkillCostValue-ak3JKnDm.js → SkillCostValue-C43y1frw.js} +1 -1
- package/dist/public/assets/{SkillEditBanner-B5rEaInO.js → SkillEditBanner-DttpBxOJ.js} +1 -1
- package/dist/public/assets/{SkillForkDialog-Cu7JHqqd.js → SkillForkDialog-Dzre8M2R.js} +1 -1
- package/dist/public/assets/{SkillInstallMenu-B7K9elQU.js → SkillInstallMenu-B0JB7kZB.js} +1 -1
- package/dist/public/assets/{SkillOriginInline-DYbcJg7P.js → SkillOriginInline-CShk5VBB.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-DcbvW2T6.js → SkillToolbarControls-1BYcSekj.js} +1 -1
- package/dist/public/assets/{SlidesToolbarControls-7LjoJy_5.js → SlidesToolbarControls-CIR9Gt5P.js} +1 -1
- package/dist/public/assets/{SourceEditor-C8ffIHwr.js → SourceEditor-dlengKQr.js} +1 -1
- package/dist/public/assets/{TerminalPanel-CiqML_vV.js → TerminalPanel-DVVYNGxU.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-BeNUbLdQ.js → TerminalWindowApp-Dbf1LEIb.js} +1 -1
- package/dist/public/assets/{TextDocEditor-Dp7FK75S.js → TextDocEditor-Bfgflu7Y.js} +1 -1
- package/dist/public/assets/{ThreadView-9tYfJB3u.js → ThreadView-BAqefrNB.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-CBzWQFjK.js → TimelineDiffPane-C5Pk8YKQ.js} +1 -1
- package/dist/public/assets/{agent-connections-BeE3-bph.js → agent-connections-36VzA4Nj.js} +1 -1
- package/dist/public/assets/{auth-state-cache--dIcIe7G.js → auth-state-cache-y7ZNLaEX.js} +1 -1
- package/dist/public/assets/{bug-report-send-manager-DNdGRps_.js → bug-report-send-manager-WZvhB30v.js} +1 -1
- package/dist/public/assets/{client-version-DUN6viBa.js → client-version-DAE_LnJT.js} +1 -1
- package/dist/public/assets/{comment-chips-TcK52Do9.js → comment-chips-mEcLNjUa.js} +1 -1
- package/dist/public/assets/{config-provider-CG9gR7T8.js → config-provider-Dc4ERnKv.js} +1 -1
- package/dist/public/assets/{css-color-to-hex-Z8frkoC6.js → css-color-to-hex-HXZok3qq.js} +1 -1
- package/dist/public/assets/{diagnostic-breadcrumb-CntZqCsY.js → diagnostic-breadcrumb-Da90WJfg.js} +1 -1
- package/dist/public/assets/{dist-DWDffHoo.js → dist-BXv2iH4t.js} +30 -28
- package/dist/public/assets/{doc-paths-DApIJEsY.js → doc-paths-DbP8RoCY.js} +1 -1
- package/dist/public/assets/{doc-undo-manager-BsCVxADi.js → doc-undo-manager-BuQfcH7g.js} +1 -1
- package/dist/public/assets/{documents-events-D3WFvAcg.js → documents-events-B9_p7FnW.js} +1 -1
- package/dist/public/assets/{file-tree-adapter-BBZoex3H.js → file-tree-adapter-CC3PZmuz.js} +1 -1
- package/dist/public/assets/{file-tree-utils-MSwqAf_Q.js → file-tree-utils-SoxHR8nZ.js} +1 -1
- package/dist/public/assets/{folder-config-api-CTSvuorZ.js → folder-config-api-D2T7lLE2.js} +1 -1
- package/dist/public/assets/{index-z4pOD0dV.js → index-ZJRhdCXy.js} +8 -8
- package/dist/public/assets/{lint-config-client-DPGrXD4q.js → lint-config-client-ByyVt3Ji.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-CAHOja9n.js → markdownlint-rule-browser-DLR8ICzt.js} +1 -1
- package/dist/public/assets/{navigation-targets-CU6rzUlp.js → navigation-targets-CPBRP2pX.js} +1 -1
- package/dist/public/assets/{page-list-cache-BqFWbREg.js → page-list-cache-DP6EykyZ.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-D3aYtYmc.js → pending-receive-nav-store-BiglQO8z.js} +1 -1
- package/dist/public/assets/{preferred-session-events-DAmmw5gh.js → preferred-session-events-Bw6PF8j6.js} +1 -1
- package/dist/public/assets/{progress-sy7HQozy.js → progress-3N7lmUHc.js} +1 -1
- package/dist/public/assets/{project-paths-ZxQBkNtH.js → project-paths-WwDCX6Wj.js} +1 -1
- package/dist/public/assets/{prop-types-DKh1WKWf.js → prop-types-D7m1bgZd.js} +1 -1
- package/dist/public/assets/{receive-store-MDSlAMS-.js → receive-store-s0TOnYEX.js} +1 -1
- package/dist/public/assets/{selection-context-W5wdYOgq.js → selection-context-DFvB64m4.js} +1 -1
- package/dist/public/assets/{sign-in-terminal-events-hpuzOw8T.js → sign-in-terminal-events-n2711hbP.js} +1 -1
- package/dist/public/assets/{skill-scope-Bez3g3qc.js → skill-scope-BEZoxlA_.js} +1 -1
- package/dist/public/assets/{skills-api-Dg4Bu4bF.js → skills-api-xEJYLsBT.js} +1 -1
- package/dist/public/assets/{src-BnWuP41K.js → src-DW6dj9Em.js} +1 -1
- package/dist/public/assets/{startup-marks-BANMGjlj.js → startup-marks-BI3f20Ai.js} +1 -1
- package/dist/public/assets/{tag-pill-input-X411ZGOD.js → tag-pill-input-9A5egJpq.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-BC3uQ8d6.js → target-navigation-intent-KL1RgeS2.js} +1 -1
- package/dist/public/assets/{telemetry-startup-C1Pox6wt.js → telemetry-startup-D5AbtRQp.js} +1 -1
- package/dist/public/assets/{terminal-command-events-DhjWRdh7.js → terminal-command-events-Cwnlls-2.js} +1 -1
- package/dist/public/assets/{terminal-launch-events-BdwMO1Yd.js → terminal-launch-events-BeaRJslN.js} +1 -1
- package/dist/public/assets/{terminal-telemetry-CkRgU6v9.js → terminal-telemetry-B-Ex6x4P.js} +1 -1
- package/dist/public/assets/{thread-client-Cs7m3o_c.js → thread-client-BohJshIz.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-DYnzK_Dw.js → typing-burst-detector-CRC92mGc.js} +1 -1
- package/dist/public/assets/{uninstall-D-JcCb1g.js → uninstall-BI1OhVGa.js} +1 -1
- package/dist/public/assets/{use-activity-panel-E7Mh-Ezq.js → use-activity-panel-DSA7U3E8.js} +1 -1
- package/dist/public/assets/{use-apply-config-language-D6tEZ9VT.js → use-apply-config-language-BQbUd-j-.js} +1 -1
- package/dist/public/assets/{use-collab-url-D86Y_0c-.js → use-collab-url-BLYPZ3GH.js} +1 -1
- package/dist/public/assets/{use-conflicts-DX3qdaOd.js → use-conflicts-Bk4ek4CK.js} +1 -1
- package/dist/public/assets/{use-git-sync-status-CD2DOuM6.js → use-git-sync-status-CDLRE1Yh.js} +1 -1
- package/dist/public/assets/{use-installed-clis-Cwk9Ej-5.js → use-installed-clis-e8k5ayDZ.js} +2 -2
- package/dist/public/assets/{use-live-xterm-theme-CuUImHB-.js → use-live-xterm-theme-CumqDZtn.js} +1 -1
- package/dist/public/assets/{use-open-skill-D7-vvik5.js → use-open-skill-LwyclBox.js} +1 -1
- package/dist/public/assets/{use-settings-route-Cgem-_t0.js → use-settings-route-4si6XFq0.js} +1 -1
- package/dist/public/assets/{use-skill-origin-B_Jm5scu.js → use-skill-origin-BuNz7780.js} +1 -1
- package/dist/public/assets/{use-skills-BDkMItFj.js → use-skills-C1ayg_tU.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-CE0TRk5u.js → use-terminal-enabled-DH9NZVb3.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-D2HtWDOo.js → use-timeline-entry-diff-x56ANf6r.js} +1 -1
- package/dist/public/assets/{use-workspace-CUF62sEC.js → use-workspace-DkzDvF62.js} +1 -1
- package/dist/public/index.html +59 -59
- package/dist/public/uninstall.html +3 -3
- package/dist/{registry-probes-C_CjBt1X.mjs → registry-probes-3L8CRnGg.mjs} +1 -1
- package/dist/{removal-file-path-Dpgj65Fm.mjs → removal-file-path-3ZpUklLl.mjs} +1 -1
- package/dist/{repair-launch-json-D2_vTIDM.mjs → repair-launch-json-CMMYwCjW.mjs} +1 -1
- package/dist/{repair-mcp-configs-B7iHsYuV.mjs → repair-mcp-configs-DzGALib-.mjs} +1 -1
- package/dist/{src-BXartIQO.mjs → src-DU6Xx1gD.mjs} +1 -1
- package/dist/src-DjmVymt-.mjs +1 -0
- package/dist/start-B8Yg-ZtE.mjs +1 -0
- package/dist/{start-B02FL8wC.mjs → start-Jnb5yYdV.mjs} +3 -3
- package/package.json +5 -5
- package/dist/constants-B-aUCjZp.mjs +0 -1
- package/dist/init-BJXU6KnD.mjs +0 -1
- package/dist/loader-DS_Yxo5c.mjs +0 -1
- package/dist/preview-CQAChk_4.mjs +0 -1
- package/dist/public/assets/FeedbackForm-DFC9eU2O.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-DhhC3S2j.js +0 -1
- package/dist/src-CFZDRhgI.mjs +0 -1
- package/dist/start-D8xMsLwv.mjs +0 -1
package/dist/index.mjs
CHANGED
|
@@ -341,7 +341,7 @@ ${t.slice(l+2)}`,d+=1;else break}t.push({indent:l,number:parseInt(s,10),content:
|
|
|
341
341
|
`)],d);let{effectiveConfig:_,rulesEnabled:v,rulesSeverity:y}=EL(e,i,o),b=[...v.keys()];return s=new Map(v),c=s,u(t,p),u(t,m,h),u(t,g),{effectiveConfig:_,enabledRulesPerLineNumber:l,enabledRuleList:e.filter(e=>{let t=e.names[0].toUpperCase();return l.some(e=>e.get(t))}),rulesSeverity:y}}function OL(t,n,r,i,a,o,s,c,l,u,d,f){let p=e=>f(e instanceof Error?e:Error(e));i=i.replace(/^\uFEFF/,``);let m=wL(i,c),{frontMatterLines:h}=m;i=m.content;let{effectiveConfig:g,enabledRulesPerLineNumber:_,enabledRuleList:v,rulesSeverity:y}=DL(t,i.split(Q.newLineRe),h,u,o,s,n),b=v.some(e=>e.parser===`markdownit`||e.parser===void 0),x=v.some(e=>e.parser===`micromark`),S=t.length!==xL.length,C=x?WF(i,{freezeTokens:S}):[],w=i;i=Q.clearHtmlCommentText(i);let T=i.split(Q.newLineRe),E=e=>{let t=Object.freeze({markdownit:Object.freeze({tokens:e})}),n=Object.freeze({micromark:Object.freeze({tokens:C})}),i=Object.freeze({}),a={name:r,version:eP,lines:Object.freeze(T),frontMatterLines:Object.freeze(h)};YN({...a,parsers:n,config:{}});let o=[],s=s=>{let c=s.names[0].toUpperCase(),u={},d=i;s.parser===void 0?(u.tokens=e,d=t):s.parser===`markdownit`?d=t:s.parser===`micromark`&&(d=n);let f=Object.freeze({...a,...u,parsers:d,config:g[c]});function p(e){throw Error(`Value of '${e}' passed to onError by '${c}' is incorrect for '${r}'.`)}function m(e){(!e||!Q.isNumber(e.lineNumber)||e.lineNumber<1||e.lineNumber>T.length)&&p(`lineNumber`);let t=e.lineNumber+h.length;if(!_[t].get(c))return;e.detail&&!Q.isString(e.detail)&&p(`detail`),e.context&&!Q.isString(e.context)&&p(`context`),e.information&&!Q.isUrl(e.information)&&p(`information`),e.range&&(!Array.isArray(e.range)||e.range.length!==2||!Q.isNumber(e.range[0])||e.range[0]<1||!Q.isNumber(e.range[1])||e.range[1]<1||e.range[0]+e.range[1]-1>T[e.lineNumber-1].length)&&p(`range`);let n=e.fixInfo,r={};if(n){Q.isObject(n)||p(`fixInfo`),n.lineNumber!==void 0&&((!Q.isNumber(n.lineNumber)||n.lineNumber<1||n.lineNumber>T.length)&&p(`fixInfo.lineNumber`),r.lineNumber=n.lineNumber+h.length);let t=n.lineNumber||e.lineNumber;n.editColumn!==void 0&&((!Q.isNumber(n.editColumn)||n.editColumn<1||n.editColumn>T[t-1].length+1)&&p(`fixInfo.editColumn`),r.editColumn=n.editColumn),n.deleteCount!==void 0&&((!Q.isNumber(n.deleteCount)||n.deleteCount<-1||n.deleteCount>T[t-1].length)&&p(`fixInfo.deleteCount`),r.deleteCount=n.deleteCount),n.insertText!==void 0&&(Q.isString(n.insertText)||p(`fixInfo.insertText`),r.insertText=n.insertText)}let i=e.information||s.information;o.push({lineNumber:t,ruleNames:s.names,ruleDescription:s.description,ruleInformation:i?i.href:null,errorDetail:e.detail?.replace(Q.newLineRe,` `)||null,errorContext:e.context?.replace(Q.newLineRe,` `)||null,errorRange:e.range?[...e.range]:null,fixInfo:n?r:null,severity:y.get(c)})}let v=e=>m({lineNumber:1,detail:`This rule threw an exception: ${e.message||e}`}),b=()=>s.function(f,m);if(s.asynchronous){let e=Promise.resolve().then(b);return l?e.catch(v):e}try{b()}catch(e){if(l)v(e);else throw e}return null},c=()=>(o.sort((e,t)=>e.ruleNames[0].localeCompare(t.ruleNames[0])||e.lineNumber-t.lineNumber),o),u=v.filter(e=>e.asynchronous),d=v.filter(e=>!e.asynchronous),m=[...u,...d],b=()=>f(null,c());try{let e=m.map(s);u.length>0?Promise.all(e.slice(0,u.length)).then(b).catch(p):b()}catch(e){p(e)}finally{YN()}};!b||d?E(b?(0,iP.requireMarkdownItCjs)().getMarkdownItTokens(a(),w,T):[]):Promise.all([Promise.resolve().then(()=>e(tP(),1)),new Promise(e=>e(a()))]).then(([e,t])=>{let n=e.getMarkdownItTokens(t,w,T);E(n)}).catch(p)}function kL(e,t,n,r,i,a,o,s,c,l,u,d){function f(l,f){return l?d(l):OL(e,t,n,f,r,i,a,o,s,c,u,d)}u?f(null,l.readFileSync(n,`utf8`)):l.readFile(n,`utf8`,f)}function AL(e,t,n){e||={},n||=()=>{};let r=[e.customRules||[]].flat().map(e=>({names:Q.cloneIfArray(e.names),description:e.description,information:Q.cloneIfUrl(e.information),tags:Q.cloneIfArray(e.tags),parser:e.parser,asynchronous:e.asynchronous,function:e.function})),i=xL.concat(r),a=CL(i,t);if(a){n(a);return}let o=[];Array.isArray(e.files)?o=[...e.files]:e.files&&(o=[String(e.files)]);let s=e.strings||{},c=Object.keys(s),l=e.config||{default:!0},u=e.configParsers||void 0,d=e.frontMatter===void 0?Q.frontMatterRe:e.frontMatter,f=!!e.handleRuleFailures,p=!!e.noInlineConfig,m=e.markdownItFactory||(()=>{throw Error(`The option 'markdownItFactory' was required (due to the option 'customRules' including a rule requiring the 'markdown-it' parser), but 'markdownItFactory' was not set.`)}),h=e.fs||HN,g=TL(i),_={},v=!1,y=0;function b(){let e;function r(r,i){return y--,r?(v=!0,n(r)):(_[e]=i,t||b(),null)}if(!v){if(e=o.shift())y++,kL(i,g,e,m,l,u,d,f,p,h,t,r);else if(e=c.shift())y++,OL(i,g,e,s[e]||``,m,l,u,d,f,p,t,r);else if(y===0){v=!0;let e=Object.entries(_);e.sort(([e],[t])=>e.localeCompare(t));let t=Object.fromEntries(e);return n(null,t)}}return null}if(t)for(;!v;)b();else b(),b(),b(),b(),b(),b(),b(),b()}function jL(e){let t=null;return AL(e,!0,function(e,n){if(e)throw e;t=n}),t}function ML(e,t=0){return{lineNumber:e.lineNumber||t,editColumn:e.editColumn||1,deleteCount:e.deleteCount||0,insertText:e.insertText||``}}function NL(e,t,n=`
|
|
342
342
|
`){let{editColumn:r,deleteCount:i,insertText:a}=ML(t),o=r-1;return i===-1?null:e.slice(0,o)+a.replace(/\n/g,n)+e.slice(o+i)}function PL(e,t){let n=Q.getPreferredLineEnding(e,UN),r=e.split(Q.newLineRe),i=t.filter(e=>e.fixInfo).map(e=>ML(e.fixInfo,e.lineNumber));i.sort((e,t)=>{let n=e.deleteCount===-1,r=t.deleteCount===-1;return t.lineNumber-e.lineNumber||(n?1:r?-1:0)||t.editColumn-e.editColumn||t.insertText.length-e.insertText.length});let a={};i=i.filter(e=>{let t=e.lineNumber!==a.lineNumber||e.editColumn!==a.editColumn||e.deleteCount!==a.deleteCount||e.insertText!==a.insertText;return a=e,t}),a={lineNumber:-1};for(let e of i)e.lineNumber===a.lineNumber&&e.editColumn===a.editColumn&&!e.insertText&&e.deleteCount>0&&a.insertText&&!a.deleteCount&&(e.insertText=a.insertText,a.lineNumber=0),a=e;i=i.filter(e=>e.lineNumber);let o=-1,s=-1;for(let e of i){let{lineNumber:t,editColumn:i,deleteCount:a}=e,c=t-1,l=i-1;(c!==o||a===-1||l+a<=s-(a>0?0:1))&&(r[c]=NL(r[c],e,n)),o=c,s=l}return r.filter(e=>e!==null).join(n)}function FL(e,t){let n=typeof e==`string`?e:e.origin,r=typeof e==`string`?void 0:e.url,i=n.split(`:`),a=i[1]?i[0]:void 0,o=i[1];return Object.defineProperty(s,"name",{value:n}),s;function s(e){let[n,i]=IL(o,e),s=n===2;if(n)return function(e,n,c){let l=n.messages.length-1;DO(t,function(e){let t=n.messages;if(e&&!t.includes(e))try{n.fail(e)}catch{}for(;++l<t.length;)Object.assign(t[l],{fatal:s,ruleId:o,source:a,url:r});c()})(e,n,i)}}}function IL(e,t){if(Array.isArray(t)){let[n,r]=t;switch(n){case!1:case 0:case`off`:return[0,r];case!0:case 1:case`on`:case`warn`:return[1,r];case 2:case`error`:return[2,r];default:if(typeof n==`number`)throw Error("Incorrect severity `"+n+"` for `"+e+"`, expected 0, 1, or 2");return[1,t]}}return[1,t]}var LL={SINGLE_TILDE:0,COMPARISON_OPERATORS:5,HTML_TAGS:10,SETEXT_HEADINGS:15,LINKS:20,BOLD_ITALIC:30,BOLD:35,ITALIC_DOUBLE_UNDERSCORE:40,ITALIC_SINGLE_ASTERISK:41,ITALIC_SINGLE_UNDERSCORE:42,INLINE_CODE:50,STRIKETHROUGH:60,KATEX:70,INLINE_KATEX:75,DEFAULT:100};LL.SINGLE_TILDE,LL.COMPARISON_OPERATORS,LL.HTML_TAGS,LL.SETEXT_HEADINGS,LL.LINKS,LL.BOLD_ITALIC,LL.BOLD,LL.ITALIC_DOUBLE_UNDERSCORE,LL.ITALIC_SINGLE_ASTERISK,LL.ITALIC_SINGLE_UNDERSCORE,LL.INLINE_CODE,LL.STRIKETHROUGH,LL.KATEX,LL.INLINE_KATEX,new Set(bu),[{id:`mcp-preapproval`,piece:`mcp`,scope:`project`,requiredStrictness:`pre-approval-exact`,revokedByForeignEntry:!1},{id:`tool-autoapprove`,piece:`mcp`,requiredStrictness:`pre-approval-exact`,revokedByForeignEntry:!0}].map(e=>e.id),U([`count-unverified`,`not-count`]),U([`acp-catalog-supported`,`harness-cli-on-path`,`os-scheme-handler`]),Cu.filter(e=>e!==`session`);const RL={agent:xu},zL={"followup.enable-manually":{params:oi(RL)},"guidance.mcp.user-config":{params:oi(RL)},"guidance.mcp.project-config":{params:oi(RL)},"guidance.mcp.session-injection":{params:oi(RL)},"guidance.mcp.managed-file":{params:oi(RL)},"guidance.skill.project":{params:oi(RL)},"guidance.skill.user":{params:oi(RL)},"guidance.skill.central-store":{params:oi(RL)},"troubleshooting.claude.project-entry-not-approved":{params:oi(RL)},"troubleshooting.claude-desktop.per-tool-approval":{params:oi(RL)},"troubleshooting.cursor.project-entry-not-loaded":{params:oi({...RL,server:F().optional()})},"troubleshooting.codex.desktop-project-config":{params:oi({...RL,honoredByDesktop:L()})},"troubleshooting.codex.folder-trust":{params:oi(RL)},"troubleshooting.copilot.shared-workspace-config":{params:oi({...RL,sourceAgent:xu})},"troubleshooting.openclaw.central-store-missing":{params:oi(RL)},"troubleshooting.pi.folder-trust":{params:oi(RL)},"troubleshooting.lm-studio.config-path-mismatch":{params:oi(RL)}};Object.keys(zL).sort(),Zu.flatMap(e=>e.probe.mode===`probeable`?[{satisfierId:e.id,agent:e.agent,piece:e.piece,scope:e.scope,kind:e.kind,pathId:e.pathId??null,strictness:e.probe.strictness}]:[]).map(e=>e.satisfierId);const BL=U(su),VL=B({kind:U([`source-read`,`measured`,`vendor-doc`,`upstream-issue`,`observation`]),ref:F().min(1),note:F().optional()}),HL=B({version:F().min(1).optional(),observedAt:F().min(1)}),UL=ui(`confidence`,[B({confidence:W(`verified`),evidence:z(VL).min(1),verifiedAgainst:HL.optional()}),B({confidence:W(`assumed`),evidence:z(VL).min(1),verifiedAgainst:HL.optional()}),B({confidence:W(`contested`),evidence:z(VL).min(1),verifiedAgainst:HL})]),WL=B({id:Eie,params:H(F(),V([F(),I(),L()])).optional()}),GL=ui(`mode`,[B({mode:W(`probeable`),strictness:z(yu).min(1)}),B({mode:W(`unprobeable`),reason:U([`no-readable-state`,`different-machine`,`no-programmatic-path`,`session-scoped`]),note:F().optional()})]),KL=U([`this-project`,`this-user`,`this-machine`]),qL=U([`installable`,`user-completes`,`not-installable`]),JL=B({id:Tu,agent:xu,piece:Su,scope:wu,kind:vie,pathId:Tie.optional(),sharedWith:z(xu).default([]),prerequisites:z(Tu).default([]),consentClass:yie.default(`none`),probe:GL,attestation:UL,audience:KL,installability:qL.default(`installable`),notInstallableReason:U([`no-non-interactive-verb`,`session-scoped`,`no-surface`]).optional(),preferred:L().default(!1),guidance:WL.optional(),followup:WL.optional(),troubleshooting:z(WL).default([])}),YL=B({piece:Su,level:xie,satisfiedByAny:z(Tu)}),XL=B({acpAgentId:F().min(1),featuredOrder:I().int().nonnegative().nullable(),harnessCli:Cie.nullable(),harnessReadsEditorConfig:BL.nullable(),harnessReadsEditorConfigAttestation:UL,verifiedPosture:U([`asks`,`self-managed`,`autonomous`]).nullable()}),ZL=B({cliId:F().min(1)}),QL=B({targetId:wie,knownOrder:I().int().nonnegative(),visible:L(),displayName:F().min(1),appBrandName:F().min(1).optional(),schemes:z(F().min(1)),installUrl:F().min(1),tagline:F().min(1).optional()}),$L=B({requirements:z(YL),caveats:z(WL).default([])});B({id:xu,setupDocSlug:F().min(1).nullable(),offerOnlyWhenDetected:L().default(!1),offersConnectionRow:L().default(!1),detectionSources:z(F().min(1)).default([]),satisfiers:z(JL),modes:gi(Sie,$L),acp:XL.optional(),terminal:ZL.optional(),external:QL.optional()}),B({id:F().min(1),requiredStrictness:yu,scope:wu.optional(),piece:Su,revokedByForeignEntry:L().default(!1),guidance:WL.optional()}),new pd.default;const eR=B({path:z(V([F(),I()])),message:F(),issueCode:F()});ui(`code`,[B({code:W(`SCHEMA_INVALID`),issues:z(eR)}),B({code:W(`WRITE_ERROR`),detail:F()})]),Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`form-write`})});function tR(e,t){return e>=(t===`leading`?2:1)?e:0}function nR(e,t){let n={line:e,column:1,offset:t};return{type:`paragraph`,children:[],position:{start:n,end:{...n}}}}function rR(e,t){let n=e.children,r=n.length===0||t.leading===void 0?0:tR(t.leading.length,`leading`),i=n.length===0||t.trailing===void 0?0:tR(t.trailing.length-1,`trailing`);if(r===0&&i===0)return t;let a=n[n.length-1]?.position?.end,o=[],s=[];if(r>0)for(let e=0;e<r;e++)o.push(nR(1+e,e));if(i>0&&typeof a?.offset==`number`&&typeof a.line==`number`)for(let e=0;e<i;e++)s.push(nR(a.line+1+e,a.offset+1+e));if(o.length===0&&s.length===0||(e.children=[...o,...n,...s],o.length>0&&delete t.leading,s.length>0&&delete t.trailing,t.bom!==void 0||t.leading!==void 0||t.trailing!==void 0))return t;e.data!==void 0&&delete e.data.sourceDocBoundary}const iR=new pd.default;iR.Match_Threshold=.5;function aR(e,t){let n=0;for(let r=0;r<t.length&&n<e.length;r++)e[n]===t[r]&&n++;return n===e.length}const oR=new Set([`sourceRaw`,`sourceDirty`,`position`]),sR=new Set([`jsxComponent`,`table`,`tableRow`,`tableCell`,`tableHeader`,`list`,`listItem`,`blockquote`,`codeBlock`,`heading`]),cR={type:`__br__`},lR=/^<br\s*\/?>$/i;function uR(e){let t=hR(e,uR);return(t.type===`tableCell`||t.type===`tableHeader`)&&t.content?{...t,content:dR(t.content)}:t}function dR(e){let t=[];for(let n of e){let e=fR(n);e.length!==0&&(t.length>0&&t.push(cR),t.push(...e))}return t}function fR(e){return e.text!==void 0||e.type===`hardBreak`||e.type===`jsxInline`?[e]:!e.content||e.content.length===0?[]:e.content.some(e=>e.text===void 0&&e.type!==`hardBreak`&&e.type!==`jsxInline`&&!!e.content)?dR(e.content):e.content}function pR(e){return e.type===`hardBreak`||e.type===cR.type||e.text!==void 0&&lR.test(e.text.trim())?cR:hR(e,pR)}const mR=[{label:`table-cell-block-flatten`,severity:`pm-model-caused`,rationale:`GFM table cells have no block spelling; a block placed in a cell is flattened to inline on serialize, so a cell-with-blocks and a cell-with-inline describe the same persisted document.`,proofPointer:`markdown/table-cell-flatten.ts flattenCellBlocks (table-cell-flatten-dropped-block event)`,canonicalize:uR},{label:`void-hardbreak-br`,severity:`serializer-caused`,rationale:`A void hardBreak inside a table cell or heading serializes to a literal <br /> that a fresh parse keeps as text; the node form and the literal form are the same break.`,proofPointer:`markdown/void-br-promoter.ts + markdown/to-markdown-handlers.ts break handler`,canonicalize:pR}];function hR(e,t){return e.content?{...e,content:e.content.map(t)}:e}function gR(e,t){let n={};e.type!==void 0&&(n.type=e.type),e.text!==void 0&&(n.text=e.text);let r=_R(e.attrs,t);return r&&(n.attrs=r),e.marks&&e.marks.length>0&&(n.marks=[...e.marks].map(e=>({type:e.type,attrs:_R(e.attrs,t)})).sort((e,t)=>yR(e).localeCompare(yR(t)))),e.content&&e.content.length>0&&(n.content=e.content.map(e=>gR(e,t))),n}function _R(e,t){if(!e)return null;let n={};for(let r of Object.keys(e).sort()){if(oR.has(r)||t?.(r))continue;let i=e[r];i!=null&&(n[r]=t?vR(i,t):i)}return Object.keys(n).length>0?n:null}function vR(e,t){if(Array.isArray(e))return e.map(e=>vR(e,t));if(e&&typeof e==`object`){let n={};for(let[r,i]of Object.entries(e))t(r)||(n[r]=vR(i,t));return n}return e}function yR(e){return JSON.stringify(e,(e,t)=>{if(t&&typeof t==`object`&&!Array.isArray(t)){let e={};for(let n of Object.keys(t).sort())e[n]=t[n];return e}return t})}function bR(e,t=!1){let n=``,r=e=>{if(!(t&&e.type===`rawMdxFallback`)&&(e.text!==void 0&&(n+=e.text),e.content))for(let t of e.content)r(t)};return r(e),n.replace(/\s+/g,``)}function xR(e){let t=[],n=e=>{if(e.type&&sR.has(e.type)){let n=e.type===`jsxComponent`?String(e.attrs?.componentName??``):``;t.push(n?`${e.type}:${n}`:e.type)}if(e.content)for(let t of e.content)n(t)};return n(e),t.sort()}function SR(e){let t=e,n=[];for(let e of mR){let r=yR(t),i=e.canonicalize(t);yR(i)!==r&&n.push(e.label),t=i}return{normalized:t,fired:n}}function CR(e,t,n={}){let r=SR(e),i=SR(t),a=[...new Set([...r.fired,...i.fired])],o=aR(bR(r.normalized),bR(i.normalized)),s=!o&&n.rawSourceSide===`expected`&&aR(bR(r.normalized,!0),bR(i.normalized,!0));if(!o&&!s)return{equivalent:!1,level:`L1`,reason:`content-loss`,appliedDegrades:a,detail:`authored text did not survive the round-trip`};let c=xR(r.normalized),l=xR(i.normalized);if(yR(c)!==yR(l))return{equivalent:!1,level:`L1`,reason:`structural-shatter`,appliedDegrades:a,detail:`container multiset diverged: [${c.join(`, `)}] vs [${l.join(`, `)}]`};let u=gR(r.normalized,n.ignoreAttrs),d=gR(i.normalized,n.ignoreAttrs);return yR(u)===yR(d)?{equivalent:!0,level:a.length>0?`L2`:`L1`,appliedDegrades:a}:{equivalent:!1,level:`L2`,reason:`structural-divergence`,appliedDegrades:a,detail:wR(u,d)}}function wR(e,t,n=`doc`){let r=e,i=t;if(!r||!i)return`${n}: node presence differs`;if(r.type!==i.type)return`${n}: type ${String(r.type)} vs ${String(i.type)}`;let a=r.content??[],o=i.content??[];if(a.length!==o.length)return`${n}(${String(r.type)}): child count ${a.length} vs ${o.length}`;for(let e=0;e<a.length;e++)if(yR(a[e])!==yR(o[e]))return wR(a[e],o[e],`${n}>${String(r.type)}[${e}]`);return`${n}(${String(r.type)}): attrs or marks differ`}function TR(e,t,n){return!CR(e,t,{ignoreAttrs:n}).equivalent}const ER=new Set([`src`,`href`,`size`]),DR=new Set([`WikiEmbedImage`,`WikiEmbedVideo`,`WikiEmbedAudio`,`WikiEmbedFile`]);function OR(e){if(Array.isArray(e))return e.map(e=>OR(e));if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))ER.has(n)||(t[n]=OR(r));return t}return e}function kR(e){return e.type===`jsxComponent`&&typeof e.attrs?.componentName==`string`&&DR.has(e.attrs.componentName)?OR(e):e.content?{...e,content:e.content.map(kR)}:e}function AR(e){if(Array.isArray(e))return e.map(e=>AR(e));if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))n!==`position`&&(t[n]=AR(r));return t}return e}function jR(e){if(e.type===`jsxComponent`)return e;if(e.content)for(let t of e.content){let e=jR(t);if(e)return e}}function MR(e){let t=e.cacheLimit??2048,n=new Map,r=r=>{let i=n.get(r);if(i!==void 0)return i;let a=jR(e.parse(r)),o=a?kR(AR(a)):null;if(n.size>=t){let e=n.keys().next().value;e!==void 0&&n.delete(e)}return n.set(r,o),o};return{isDiverged(e){if(e.type!==`jsxComponent`||!e.attrs||e.attrs.kind===`expression`)return!1;let t=e.attrs.sourceRaw;if(typeof t!=`string`||t.length===0)return!1;let n=r(t);return n?TR(n,kR(AR(e))):!1}}}const NR=`state/bug-reports`,PR=si({at:F(),transport:F(),outcome:F(),reference:F().optional(),error:F().optional(),errorCode:F().optional()}),FR=si({reason:F(),at:F(),errorCode:F().optional()});si({version:I().int().catch(1),id:F(),createdAt:F(),bundleLevel:F(),zipBytes:I().int().nonnegative().catch(0),zipDeleted:L().optional(),state:F(),systemWide:L().optional(),projectSlug:F().nullable().optional(),reference:F().optional(),lastError:FR.optional(),attempts:z(PR).optional(),note:F().optional()}),si({version:I().int().catch(1),id:F().optional(),sentAt:F().optional(),reference:F().optional()});const IR=new Map([[32,` `],[9,` `],[160,`\xA0`]]);function LR(e){let t=/^&#(x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);$/.exec(e);if(!t)return null;let n=t[1],r=n[0]===`x`||n[0]===`X`,i=Number.parseInt(r?n.slice(1):n,r?16:10);return Number.isNaN(i)?null:i}function RR(e){let t=LR(e);return t!==null&&IR.has(t)}function zR(e){let t=LR(e);return t===null?null:IR.get(t)??null}const BR=/&#(?:x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);/g;function VR(e){BR.lastIndex=0;let t=e.match(BR);if(t===null||t.join(``)!==e)return null;let n=``;for(let e of t){let t=zR(e);if(t===null)return null;n+=t}return n}const HR=new Map([[`PORT`,[`server`,`port`]],[`OK_BIND`,[`server`,`bind`]],[`OK_EXTERNAL_URL`,[`server`,`externalUrl`]],[`OK_ALLOW_EXTERNAL`,[`server`,`allowExternal`]],[`OK_OPEN_BROWSER`,[`server`,`openBrowser`]],[`OK_IDLE_SHUTDOWN`,[`server`,`idleShutdown`]]]);function UR(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).toUpperCase()}function WR(e){return`OK_${(e[0]===`server`?e.slice(1):e).map(UR).join(`_`)}`}function GR(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function KR(e){let{value:t,file:n,source:r,doc:i}=e,a=[],o=(e,t)=>{if(t.length>0){let e=Mc(kc,t);if(e!==void 0){if(e.scope===`project-local`){let e=WR(t),o;i!=null&&r!=null&&n!=null&&(o=Ic({file:n,source:r,doc:i,path:t})),a.push({path:[...t],...HR.has(e)?{envVar:e}:{},...o===void 0?{}:{source:o}})}return}}if(GR(e))for(let[n,r]of Object.entries(e))o(r,[...t,n])};return o(t,[]),a}function qR(e,t,n){return JR([e,t,n],[])}function JR(e,t){if(t.length>0){let n=Mc(kc,t);if(n?.scope===`user`)return e[0];if(n?.scope===`project`)return e[1]??e[0];if(n?.scope===`project-local`)return e[2]??e[0]}let n=YR(e);if(n===void 0)return;if(n===null)return null;if(Array.isArray(n)||typeof n!=`object`)return n;let r=e.map(e=>XR(e)?e:void 0),i=new Set;for(let e of r)if(e!==void 0)for(let t of Object.keys(e))i.add(t);let a={};for(let e of i)a[e]=JR(r.map(t=>t===void 0?void 0:t[e]),[...t,e]);return a}function YR(e){for(let t=e.length-1;t>=0;t--)if(e[t]!==void 0)return e[t]}function XR(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const ZR=`(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)`;RegExp(`^127\\.${ZR}\\.${ZR}\\.${ZR}$`);const QR=[`.mdx`,`.md`],$R={cursor:/\bCursor(?:\([^)]+\))?\/\d/,codex:/\bCodex(?:\([^)]+\))?\/\d/,"claude-desktop":/\bClaude(?:\([^)]+\))?\/\d/};function ez(e,t){return e===`unix-chain`?`# ok-mcp${t}-v`:`# ok-mcp${t}-win-v`}function tz(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);if(n<=0)return t;let r=t.slice(n).toLowerCase();return QR.includes(r)?t.slice(0,n):t}const nz=Object.freeze([{value:`workflow-fit`,label:`It didn't fit into my workflow`},{value:`missing-feature`,label:`It was missing a feature I needed`},{value:`hard-to-start`,label:`It was too hard to set up or get started`},{value:`unreliable`,label:`Bugs, crashes, or it felt unreliable`},{value:`switched-tool`,label:`I'm switching to another tool`},{value:`one-off`,label:`It was a trial or one-off project`},{value:`other`,label:`Something else`}]);new Set(nz.map(e=>e.value));const rz=Lce.extend({priority:60,addAttributes(){return{...this.parent?.(),fenceDelimiter:{default:"`"},fenceLength:{default:3},meta:{default:null},sourceStyle:{default:`fenced`},sourceClosingFenceLength:{default:null,rendered:!1},sourceUnclosedFence:{default:!1,rendered:!1},sourceFenceIndent:{default:null,rendered:!1},sourceInfoPadding:{default:null,rendered:!1},sourceIndents:{default:null,rendered:!1}}}}),iz=_y.extend({name:`emphasis`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`*`}}},addInputRules(){return[Yv({find:fy,type:this.type,getAttributes:{sourceDelimiter:`*`}}),Yv({find:my,type:this.type,getAttributes:{sourceDelimiter:`_`}})]}}),az=dy.extend({name:`strong`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`**`}}},addInputRules(){return[Yv({find:cy,type:this.type,getAttributes:{sourceDelimiter:`**`}}),Yv({find:ly,type:this.type,getAttributes:{sourceDelimiter:`__`}})]}}),oz=Kv.create({name:`escapeMark`,priority:10,excludes:``,inclusive:!1,parseHTML(){return[{tag:`span[data-escape-mark]`}]},renderHTML(){return[`span`,{"data-escape-mark":``},0]}}),sz=ry.create({name:`footnoteDefinition`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){let e=e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}};return[{tag:`aside[data-footnote-def]`,getAttrs:e},{tag:`aside.footnote-def`,getAttrs:e}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.identifier??``);return[`aside`,{...t,"data-footnote-def":``,"data-footnote-id":n,id:`fn-${n}`,class:`footnote-def`},[`div`,{class:`footnote-body`},0],[`a`,{href:`#fnref-${n}`,class:`footnote-backref`,contentEditable:`false`,"aria-label":`Back to reference`},`↩`]]},addCommands(){return{insertFootnoteDefinition:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e},content:[{type:`paragraph`}]})}}});function cz({node:e}){return``.repeat(e.nodeSize-e.content.size)}const lz=ry.create({name:`footnoteReference`,marks:`_`,group:`inline`,inline:!0,atom:!0,selectable:!0,draggable:!1,priority:60,renderText:cz,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){return[{tag:`sup[data-footnote-ref]`,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}}}]},renderHTML({node:e}){let t=String(e.attrs.identifier??``);return[`sup`,{id:`fnref-${t}`,"data-footnote-ref":``,"data-footnote-id":t,class:`footnote-ref`},[`a`,{href:`#fn-${t}`,class:`footnote-ref-link`},`[${t}]`]]},addCommands(){return{insertFootnoteReference:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e}})}}}),uz=yy.extend({marks:`_`,priority:60,addAttributes(){return{...this.parent?.(),hardBreakStyle:{default:`backslash`},sourceRaw:{default:null}}}}),dz=xy.extend({priority:60,addAttributes(){return{...this.parent?.(),headingStyle:{default:`atx`},sourceTrailingHashes:{default:null},sourceUnderlineLength:{default:null},sourceContiguousNext:{default:!1},sourceLeadingIndent:{default:null,rendered:!1},sourceInteriorSpacing:{default:null,rendered:!1}}}}),fz=ry.create({name:`htmlBlock`,group:`block`,atom:!0,priority:60,addAttributes(){return{content:{default:``}}},parseHTML(){return[{tag:`div[data-html-block]`}]},renderHTML({node:e}){return[`div`,{"data-html-block":``,class:`html-block`},e.attrs.content]}}),pz=ry.create({name:`imageReference`,marks:`_`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:cz,addAttributes(){return{alt:{default:``},label:{default:``},identifier:{default:``},referenceType:{default:`shortcut`}}},parseHTML(){return[{tag:`img[data-image-reference]`}]},renderHTML({node:e}){let{alt:t,label:n,referenceType:r}=e.attrs;return[`img`,{"data-image-reference":``,"data-reference-type":r,"data-label":n,alt:t||n}]}});function mz(e){if(typeof e!=`string`||!e.startsWith(`/`))return e;let t=globalThis.window?.okDesktop?.config?.apiOrigin;return typeof t==`string`&&t?t+e:e}const hz=Cy.extend({marks:`_`,priority:60,renderText:cz,addAttributes(){return{...this.parent?.(),sourceUrl:{default:null,rendered:!1}}},renderHTML({HTMLAttributes:e}){let t=Dv(this.options.HTMLAttributes,e);return typeof t.src==`string`&&(t.src=mz(t.src)),[`img`,t]}}),gz=ry.create({name:`jsxComponent`,group:`block`,atom:!1,content:`block*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{componentName:{default:``},kind:{default:`element`},attributes:{default:[]},sourceRaw:{default:``},sourceDirty:{default:!1},props:{default:{}}}},parseHTML(){return[{tag:`div[data-jsx-component]`,getAttrs:e=>typeof e!=`string`&&{componentName:e.getAttribute(`data-component-name`)||``,sourceRaw:e.getAttribute(`data-source-raw`)||``}}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-jsx-component":``,"data-component-name":e.componentName,"data-source-raw":e.sourceRaw},0]},addCommands(){return{insertJsxComponent:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{sourceRaw:e}})}}}),_z=ry.create({name:`jsxInline`,group:`inline`,inline:!0,atom:!1,content:`text*`,isolating:!1,selectable:!0,priority:60,renderText:cz,addAttributes(){return{componentName:{default:``},kind:{default:`element`},attributes:{default:[]},sourceRaw:{default:``},sourceDirty:{default:!1},props:{default:{}}}},parseHTML(){return[{tag:`span[data-jsx-inline]`,getAttrs:e=>typeof e!=`string`&&{componentName:e.getAttribute(`data-component-name`)||``,sourceRaw:e.getAttribute(`data-source-raw`)||``}}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-jsx-inline":``,"data-component-name":e.componentName,"data-source-raw":e.sourceRaw},0]}}),vz=[`https`,`http`,`mailto`,`tel`,`ftp`,`sms`],yz=vz.map(e=>`${e}:`).join(`|`);RegExp(`^(?:${yz}|\\/|#|\\?|\\.\\/|\\.\\.\\/)`,`i`);function bz(e){let t=e.trim();if(t===``)return!0;let n=t.indexOf(`:`);if(n===-1)return!0;let r=t.indexOf(`/`),i=t.indexOf(`?`),a=t.indexOf(`#`);return n>Math.min(r===-1?1/0:r,i===-1?1/0:i,a===-1?1/0:a)}const xz=new Set(vz.map(e=>`${e}:`));function Sz(e){try{let t=new URL(e,`https://placeholder.invalid`);return xz.has(t.protocol.toLowerCase())}catch{return!1}}const Cz=`LinkFidelity must be derived from the Link extension`,wz=Fy.extend({priority:60,addOptions(){let e=this.parent?.();if(e===void 0)throw Error(Cz);return{...e,openOnClick:!1,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer`},isAllowedUri:Sz,shouldAutoLink:()=>!0}},addAttributes(){let e=this.parent?.();if(e===void 0)throw Error(Cz);return{...e,linkStyle:{default:`inline`,rendered:!1},refLabel:{default:null,rendered:!1},sourceForm:{default:null,rendered:!1},target:{default:null,rendered:!1},anchor:{default:null,rendered:!1},alias:{default:null,rendered:!1},sourceUrlForm:{default:null,rendered:!1},sourceTitleMarker:{default:null,rendered:!1},sourceTarget:{default:null,rendered:!1},sourceAnchor:{default:null,rendered:!1},sourceAlias:{default:null,rendered:!1}}}}),Tz=ry.create({name:`linkRefDef`,group:`block`,atom:!0,priority:60,addAttributes(){return{label:{default:``},href:{default:``},title:{default:null},sourceLayout:{default:null},sourceTitleMarker:{default:null}}},parseHTML(){return[{tag:`div[data-link-ref-def]`}]},renderHTML({node:e}){let{label:t,href:n,title:r}=e.attrs;return[`div`,{"data-link-ref-def":``,class:`link-ref-def`},r?`[${t}]: ${n} "${r}"`:`[${t}]: ${n}`]}});function Ez(e){return e.type.name===`list`&&!e.attrs.ordered}function Dz(e){return e.type.name===`list`&&!!e.attrs.ordered}function Oz(e){let t=!1;return e.forEach(e=>{e.type.name===`listItem`&&e.attrs.checked!==null&&(t=!0)}),t}function kz(e,t,n,r,i,a,o){let s=xv(e=>e.type.name===`list`)(e.selection);if(s&&i(s.node)){let{$from:n,$to:i}=e.selection;return n.blockRange(i)?Gp(r)(e,t):!1}if(s){if(!t)return!0;let{tr:n}=e;return n.setNodeMarkup(s.pos,void 0,{...s.node.attrs,...a}),o!==void 0&&s.node.forEach((e,t)=>{if(e.type.name===`listItem`){let r=s.pos+1+t;n.setNodeMarkup(r,void 0,{...e.attrs,...o})}}),t(n),!0}return Wp(n,a)(e,void 0)?!t||Wp(n,a)(e,n=>{if(o){let t=n.mapping.map(e.selection.$from.pos),r=n.doc.resolve(t);for(let e=r.depth;e>0;e--){let t=r.node(e);if(t.type.name===`listItem`){n.setNodeMarkup(r.before(e),void 0,{...t.attrs,...o});break}}}t(n)}):!1}function Az(e){return e===`x`||e===`X`}function jz(e){return e===`X`?`X`:null}function Mz(e,t,n,r){let i=e.schema.nodes.list;if(!i)return!1;let a=e.doc.resolve(t.from),o=a.depth-1;if(o>0&&a.node(o).type.name===`listItem`&&a.index(o)===0){let i=a.node(o);return e.tr.delete(t.from,t.to).setNodeMarkup(a.before(o),void 0,{...i.attrs,checked:n,sourceCheckboxChar:r}),!0}let s=a.blockRange();if(!s)return!1;let c=jf(s,i,{ordered:!1});if(!c)return!1;let l=e.tr;l.wrap(s,c),l.delete(l.mapping.map(t.from),l.mapping.map(t.to));let u=l.doc.resolve(l.mapping.map(t.from));for(let e=u.depth;e>0;e--){let t=u.node(e);if(t.type.name===`listItem`){l.setNodeMarkup(u.before(e),void 0,{...t.attrs,checked:n,sourceCheckboxChar:r});break}}return!0}const Nz=/^\s*([-+*])\s$/,Pz=/^\s*(\d+)([.)])\s$/,Fz=/^\s*[-*+]\s\[([ xX]?)\]\s$/,Iz=/^\s*\[([ xX]?)\]\s$/,Lz=ry.create({name:`list`,group:`block list`,content:`listItem+`,priority:60,addAttributes(){return{ordered:{default:!1},start:{default:1},spread:{default:!1},bulletMarker:{default:null},listMarkerDelimiter:{default:null}}},parseHTML(){return[{tag:`ul`,getAttrs:()=>({ordered:!1})},{tag:`ol`,getAttrs:e=>({ordered:!0,start:e.getAttribute(`start`)?Number(e.getAttribute(`start`)):1})}]},renderHTML({node:e,HTMLAttributes:t}){let n=e.attrs.ordered?`ol`:`ul`,r={};return e.attrs.ordered&&e.attrs.start!==1&&(r.start=e.attrs.start),[n,Dv(t,r),0]},addCommands(){return{toggleBulletList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:kz(e,t,n,r,e=>Ez(e)&&!Oz(e),{ordered:!1},{checked:null})},toggleOrderedList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:kz(e,t,n,r,e=>Dz(e),{ordered:!0},{checked:null})},toggleTaskList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:kz(e,t,n,r,e=>Ez(e)&&Oz(e),{ordered:!1},{checked:!1})}}},addInputRules(){return[Qv({find:Nz,type:this.type,getAttributes:e=>({ordered:!1,bulletMarker:e[1]}),joinPredicate:(e,t)=>t.attrs.ordered===!1}),Qv({find:Pz,type:this.type,getAttributes:e=>({ordered:!0,start:Number(e[1]),listMarkerDelimiter:e[2]}),joinPredicate:(e,t)=>t.attrs.ordered===!0}),new Hv({find:Fz,handler:({state:e,range:t,match:n})=>Mz(e,t,Az(n[1]),jz(n[1]))?void 0:null}),new Hv({find:Iz,handler:({state:e,range:t,match:n})=>Mz(e,t,Az(n[1]),jz(n[1]))?void 0:null})]},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList(),"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList(),"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),Rz=ry.create({name:`listItem`,content:`paragraph block*`,defining:!0,addAttributes(){return{checked:{default:null},spread:{default:!1},sourceMarkerSpacing:{default:null,rendered:!1},sourceOrdinal:{default:null,rendered:!1},sourceCheckboxChar:{default:null,rendered:!1},sourceContinuationIndent:{default:null,rendered:!1}}},parseHTML(){return[{tag:`li`,getAttrs:e=>{let t=e.querySelector(`input[type="checkbox"]`);return{checked:t?t.checked:null}}}]},renderHTML({node:e,HTMLAttributes:t}){return e.attrs.checked===null?[`li`,Dv(t),0]:[`li`,Dv(t,{"data-type":`taskItem`,"data-checked":e.attrs.checked?`true`:`false`}),[`label`,{contenteditable:`false`},[`input`,{type:`checkbox`,...e.attrs.checked?{checked:`checked`}:{}}]],[`div`,0]]},addNodeView(){return({node:e,getPos:t,editor:n,HTMLAttributes:r})=>{let i=document.createElement(`li`);Object.entries(Dv(r,e.attrs.checked===null?{}:{"data-type":`taskItem`,"data-checked":String(!!e.attrs.checked)})).forEach(([e,t])=>{t!=null&&i.setAttribute(e,String(t))});let a=null,o=null,s=document.createElement(`div`),c=()=>{o&&(o.disabled=!n.isEditable)};return e.attrs.checked!==null&&(a=document.createElement(`label`),a.contentEditable=`false`,o=document.createElement(`input`),o.type=`checkbox`,o.checked=!!e.attrs.checked,c(),n.on(`update`,c),o.addEventListener(`change`,()=>{let r=t();r!==void 0&&typeof r==`number`&&n.view.dispatch(n.view.state.tr.setNodeMarkup(r,void 0,{...e.attrs,checked:o?.checked??!1}))}),a.appendChild(o),i.appendChild(a)),i.appendChild(s),{dom:i,contentDOM:s,update(t){return t.type!==e.type||t.attrs.checked!==null!=(e.attrs.checked!==null)?!1:(o&&t.attrs.checked!==null&&(o.checked=!!t.attrs.checked,o.disabled=!n.isEditable,i.setAttribute(`data-checked`,String(!!t.attrs.checked))),e=t,!0)},destroy(){n.off(`update`,c)}}}},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.sinkListItem(this.name);return!1},"Shift-Tab":()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.liftListItem(this.name);return!1}}}}),zz=Lz,Bz=Rz,Vz=ry.create({name:`mathInline`,marks:`_`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,renderText:cz,addAttributes(){return{formula:{default:``},id:{default:null},language:{default:`latex`},sourceDelimiter:{default:null,rendered:!1}}},parseHTML(){return[{tag:`span[data-math-inline]`,getAttrs:e=>typeof e!=`string`&&{formula:e.getAttribute(`data-formula`)||``,id:e.getAttribute(`id`)||null,language:e.getAttribute(`data-language`)||`latex`}}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-math-inline":``,"data-formula":e.formula,"data-language":e.language,...e.id?{id:e.id}:{}}]},addCommands(){return{insertMathInline:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{formula:e}})}}}),Hz=ry.create({name:`rawMdxFallback`,group:`block`,atom:!1,content:`text*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{reason:{default:``},originalSpan:{default:{start:0,end:0}}}},parseHTML(){let e=e=>typeof e!=`string`&&{reason:e.getAttribute(`data-reason`)||``};return[{tag:`div[data-raw-mdx-fallback]`,getAttrs:e},{tag:`pre[data-raw-mdx-fallback]`,getAttrs:e}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-raw-mdx-fallback":``,"data-raw-badge":`raw`,"data-reason":e.reason,contenteditable:`false`,class:`raw-mdx-fallback`},0]},addNodeView(){return({HTMLAttributes:e})=>{let t=document.createElement(`div`);t.setAttribute(`data-raw-mdx-fallback`,``),t.setAttribute(`data-raw-badge`,`raw`),t.setAttribute(`contenteditable`,`false`),t.classList.add(`raw-mdx-fallback`),e.reason&&t.setAttribute(`data-reason`,e.reason);let n=document.createElement(`pre`);return n.classList.add(`raw-mdx-fallback-content`),n.setAttribute(`contenteditable`,`false`),t.appendChild(n),{dom:t,contentDOM:n,ignoreMutation:()=>!0}}}}),Uz=Kx.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceMarkerSpacings:{default:null}}}}),Wz=Xx.extend({excludes:``,addAttributes(){return{...this.parent?.(),sourceFenceChar:{default:"`"},sourceFenceLength:{default:1},sourcePadded:{default:!1,rendered:!1}}}}),Gz=ry.create({name:`commentBlock`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}},sourceLayout:{default:`block`,parseHTML:e=>e.getAttribute(`data-source-layout`)===`inline`?`inline`:`block`,renderHTML:e=>e.sourceLayout===`inline`?{"data-source-layout":`inline`}:{}}}},parseHTML(){return[{tag:`aside[data-comment-block]`},{tag:`aside.comment-block`}]},renderHTML({HTMLAttributes:e}){return[`aside`,{"data-comment-block":``,"data-clipboard-omit":`true`,class:`comment-block`,...e},0]},addCommands(){return{setCommentBlock:()=>({commands:e})=>e.wrapIn(this.name),toggleCommentBlock:()=>({commands:e})=>e.toggleWrap(this.name),unsetCommentBlock:()=>({commands:e})=>e.lift(this.name)}}}),Kz=Kv.create({name:`comment`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}}}},parseHTML(){return[{tag:`span[data-comment-mark]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-comment-mark":``,"data-clipboard-omit":`true`,class:`comment-mark`,...e},0]},addCommands(){return{setComment:()=>({commands:e})=>e.setMark(this.name),toggleComment:()=>({commands:e})=>e.toggleMark(this.name),unsetComment:()=>({commands:e})=>e.unsetMark(this.name)}}}),qz=qv.create({name:`docFidelity`,addGlobalAttributes(){return[{types:[`doc`],attributes:{sourceDocBoundary:{default:null,rendered:!1}}}]}});function Jz(e){for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return t;return null}function Yz(e){let t=!1;return e.descendants(e=>!t&&(e.type.name===`list`&&(t=!0),!t)),t}function Xz(e){let{selection:t}=e;return t instanceof ip?t.$cursor:null}function Zz(e){let t=Xz(e);if(t?.parentOffset!==0)return!1;let n=Jz(t);if(n===null||t.depth!==n+1||t.index(n)!==0)return!1;let r=t.index(n-1);return r!==0&&Yz(t.node(n-1).child(r-1))}function Qz(e,t){for(let n=t-1;n>=0;n--){let t=e.node(n),r=e.index(n);if(r<t.childCount-1){let e=t.child(r+1),i=n+1;for(;e.type.name===`list`&&e.firstChild;)e=e.firstChild,i+=1;return e.type.name===`listItem`?i:null}}return null}function $z(e){let t=Xz(e);if(!t||t.parentOffset!==t.parent.content.size)return!1;let n=Jz(t);if(n===null)return!1;for(let e=t.depth;e>n;e--)if(t.index(e-1)!==t.node(e-1).childCount-1)return!1;let r=Qz(t,n);return r!==null&&r<n}const eB=qv.create({name:`listBoundaryMerge`,addKeyboardShortcuts(){let e=()=>{let{editor:e}=this;if(!Zz(e.state))return!1;if(e.commands.undoInputRule())return!0;let{state:t,view:n}=e;return bp(t,n.dispatch,n)},t=()=>{let{editor:e}=this;if(!$z(e.state))return!1;let{state:t,view:n}=e;return xp(t,n.dispatch,n)};return{Backspace:e,"Mod-Backspace":e,Delete:t,"Mod-Delete":t}}}),tB=qv.create({name:`plainTextClipboard`,priority:1e3,addProseMirrorPlugins(){return[new pp({key:new gp(`okPlainTextClipboard`),props:{clipboardTextSerializer:e=>e.content.textBetween(0,e.content.size,`
|
|
343
343
|
|
|
344
|
-
`)}})]}}),nB=Kv.create({name:`sourceLiteral`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceRaw:{default:``}}},parseHTML(){return[{tag:`span[data-source-literal]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-source-literal":``,...e},0]}});function rB(e,t){if(typeof e!=`string`||typeof t!=`string`||/[\x00-\x1F\x7F]/.test(e))return!1;let n=e.replaceAll(`\xA0`,` `),r=t.replaceAll(`\xA0`,` `);return n===r||iB(n)===r||VR(e)===t}function iB(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}const aB=IS.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`~~`,rendered:!1}}}}),oB=Ux.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDashCounts:{default:null},sourceOuterPipes:{default:null,rendered:!1},sourceAlignmentPadding:{default:null,rendered:!1}}}}),sB=Ox.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),cB=kx.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),lB=ry.create({name:`tag`,marks:`_`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,renderText:cz,addAttributes(){return{value:{default:``}}},parseHTML(){return[{tag:`a[data-tag]`,getAttrs:e=>typeof e!=`string`&&{value:e.getAttribute(`data-tag`)||``}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.value??``);return[`a`,{...t,"data-tag":n,href:`#tag/${n}`,class:`tag`},`#${n}`]},addCommands(){return{insertTag:e=>({chain:t})=>t().insertContent({type:`tag`,attrs:{value:e}}).run()}}}),uB=/^(?:---|—-|___\s|\*\*\*\s)$/;function dB(e){let t=String(e[0]??``).replace(/\s+$/,``);return t===`—-`?`---`:t}const fB=$x.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}},addInputRules(){return[Xv({find:uB,type:this.type,getAttributes:e=>({sourceRaw:dB(e)})})]}}),pB=zS.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceForm:{default:`u`,rendered:!1}}}});function mB(e,t){let{target:n,anchor:r,alias:i}=e;if(!t.separatorCrossed)return e;if(r!==null){let e=vB(r);return{target:n,anchor:e.length>0?e:null,alias:i===null?null:yB(i)}}return{target:vB(n),anchor:null,alias:i===null?null:yB(i)}}function hB(e,t,n){let r=e.trim();return r===t?!0:n===`alias`?yB(r)===t:vB(r)===t}function gB(e,t,n){return typeof e==`string`&&hB(e,t,n)?e:t}function _B(e){return vB(e.trim())===``}function vB(e){return e.endsWith(`\\`)?e.slice(0,-1):e}function yB(e){return e.replace(/\\\|/g,`|`)}function bB(e){let t=``,n=0;for(let r of e)r===`\\`?n++:(r===`|`&&n%2==0&&(t+=`\\`),n=0),t+=r;return t}function xB(e){return e.replace(/\|/g,`\\|`)}function SB(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function CB(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const wB=ry.create({name:`wikiLink`,marks:`_`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:cz,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolved:{default:!1},sourceTarget:{default:null,rendered:!1},sourceAnchor:{default:null,rendered:!1},sourceAlias:{default:null,rendered:!1}}},parseHTML(){return[{tag:`span[data-wiki-link]`,getAttrs:e=>typeof e!=`string`&&{target:e.getAttribute(`data-target`)||``,alias:SB(e.getAttribute(`data-alias`)),anchor:SB(e.getAttribute(`data-anchor`)),resolved:e.getAttribute(`data-resolved`)===`true`}},{tag:`a.wiki-link[data-target]`,priority:100,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-target`)??``;return t?{target:t,alias:SB(e.getAttribute(`data-alias`)),anchor:SB(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=SB(e.attrs.alias),i=SB(e.attrs.anchor),a=e.attrs.resolved===!0;return[`span`,{...t,"data-wiki-link":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,"data-resolved":a?`true`:`false`},CB({target:n,alias:r,anchor:i})]}});function TB(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function EB(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const DB=[gz,Hz,_z,Vz,wB,ry.create({name:`wikiLinkEmbed`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:cz,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolvedSrc:{default:null,rendered:!1,parseHTML:()=>null}}},parseHTML(){let e=e=>typeof e==`string`||!e.hasAttribute(`data-wiki-embed`)?!1:{target:e.getAttribute(`data-target`)||``,alias:SB(e.getAttribute(`data-alias`)),anchor:SB(e.getAttribute(`data-anchor`))};return[{tag:`img[data-wiki-embed]`,getAttrs:e,priority:100},{tag:`a[data-wiki-embed]`,getAttrs:e,priority:100}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=SB(e.attrs.alias),i=SB(e.attrs.anchor),a=SB(e.attrs.resolvedSrc),o=TB(n);if(vs.has(o))return[`img`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,src:a??n,alt:r??n}];let s=a??n;return[`a`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,href:i?`${s}#${i}`:s,target:`_blank`,rel:`noopener noreferrer`},EB({target:n,alias:r,anchor:i})]}}),lB,zz,Bz,iz,az,aB,pB,Wz,rz,Uz,dz,fB,wz,fz,Tz,uz,oz,qz,nB,tB,kC.configure({trailingNode:!1,undoRedo:!1,bulletList:!1,orderedList:!1,listItem:!1,listKeymap:{listTypes:[{itemName:`listItem`,wrapperNames:[`list`]}]},italic:!1,bold:!1,strike:!1,underline:!1,code:!1,codeBlock:!1,heading:!1,horizontalRule:!1,hardBreak:!1,link:!1,blockquote:!1,dropcursor:{color:`color-mix(in oklch, var(--primary) 50%, transparent)`,width:2}}),eB,oB.configure({resizable:!0}),Ax,cB,sB,hz.configure({inline:!0}),pz,Ry,Kz,Gz,lz,sz],OB=B({changes:z(ui(`kind`,[B({key:F(),kind:W(`added`),after:nd}).loose(),B({key:F(),kind:W(`removed`),before:nd}).loose(),B({key:F(),kind:W(`changed`),before:nd,after:nd}).loose()])),unparseable:B({before:F(),after:F()}).loose().nullable()}).loose();function kB(e){if(e===``)throw Error(`toPathspec: empty path. ":(literal)" is an empty pattern that matches every tracked path; pass "." if you meant the repo root.`);return`:(literal)${e}`}function AB(e){if(e.length===0)throw Error(`pathspecArgs: empty path list. A bare "--" removes the pathspec restriction rather than selecting nothing.`);return[`--`,...e.map(e=>kB(e))]}3072-jB("This is an OpenKnowledge project: load the `open-knowledge` skill and use the OpenKnowledge MCP tools for all markdown — don't probe for `.ok/` or use native file tools on `.md` / `.mdx`. ",`cursor`),new TextEncoder;function jB(e,t){let n=encodeURIComponent(e);return t===`cursor`?encodeURIComponent(n).length:n.length}function MB(e){if(e.length===0)return{ok:!1,reason:`docName must not be empty`};if(e.trim().length===0)return{ok:!1,reason:`docName must not be blank (whitespace only)`};if(e!==e.trim())return{ok:!1,reason:`docName must not have leading or trailing whitespace`};for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return{ok:!1,reason:`docName must not contain control characters`}}if(e.includes(`..`)||e.startsWith(`/`)||e.includes(`\\`))return{ok:!1,reason:`docName must not contain "..", a leading "/", or a backslash`};for(let t of e.split(`/`)){if(t.length===0)return{ok:!1,reason:`docName must not contain empty path segments (no leading, trailing, or doubled "/")`};if(t.startsWith(`.`))return{ok:!1,reason:`docName path segments must not start with "." (hidden files are not addressable)`}}return{ok:!0}}function NB(e,t){let n=MB(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}const PB=F().superRefine(NB).optional(),FB=F().superRefine(NB),IB={agentId:F().optional(),agentName:F().optional(),colorSeed:F().optional(),clientName:F().optional(),clientVersion:F().optional(),label:F().optional()},LB=F().optional(),RB=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;ui(`kind`,[B({kind:W(`doc`),docPath:F().min(1)}).loose(),B({kind:W(`folder`),folderPath:F()}).loose()]);const zB=U([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`,`unsupported-share-url`]),BB=U([`current`,`stale`,`absent`,`empty`]);ui(`ok`,[B({ok:W(!0),shareUrl:F().min(1),sharedUrl:F().min(1),branch:F().min(1),freshness:BB.optional().catch(void 0)}).loose(),B({ok:W(!1),error:zB,branch:F().min(1).optional()}).loose()]);const VB=U([`user`,`org`]),HB=B({login:F().min(1),kind:VB,avatarUrl:F().optional()}).loose(),UB=U([`auth-required`,`network`]);ui(`ok`,[B({ok:W(!0),owners:z(HB)}).loose(),B({ok:W(!1),error:UB}).loose()]),ui(`ok`,[B({ok:W(!0),available:L()}).loose(),B({ok:W(!1),error:UB}).loose()]);const WB=U([`public`,`private`]);B({owner:F().min(1),name:F().min(1),visibility:WB,description:F().optional()}).loose();const GB=U([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]);ui(`ok`,[B({ok:W(!0),ownerLogin:F().min(1),repoName:F().min(1),cloneUrl:F().min(1),defaultBranch:F().min(1)}).loose(),B({ok:W(!1),error:GB}).loose()]);function KB(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}const qB=e=>e.refine(KB,`invalid branch name`),JB={shareTargetExists:L(),dirtyConflicts:B({conflicts:L(),files:z(F().min(1))}).loose(),branchIsLocal:L(),shareTargetOnOriginBranch:L().optional()};ui(`detached`,[B({detached:W(!1),currentBranch:F().min(1).nullable(),currentHeadSha:ni(),...JB}).loose(),B({detached:W(!0),currentBranch:ni(),currentHeadSha:F().min(1),...JB}).loose()]),B({branch:qB(F().min(1)),principalId:F().optional(),fastForward:L().optional()}).loose();const YB=U([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`,`ff-diverged`]);ui(`ok`,[B({ok:W(!0)}).loose(),B({ok:W(!1),reason:YB,files:z(F().min(1)).optional(),otherWorktreePath:F().min(1).optional()}).loose()]),U([`on-origin`,`renamed`,`deleted`,`never-on-branch`,`changed-locally`,`unknown`]),B({branch:qB(F().min(1)),path:F(),kind:U([`doc`,`folder`]),contentRootDepth:I().int().min(1).max(65535).optional()}).loose(),ui(`verdict`,[B({verdict:W(`on-origin`)}).loose(),B({verdict:W(`renamed`),renamedTo:F().min(1)}).loose(),B({verdict:W(`deleted`)}).loose(),B({verdict:W(`never-on-branch`)}).loose(),B({verdict:W(`changed-locally`)}).loose(),B({verdict:W(`unknown`)}).loose()]).catch({verdict:`unknown`});const XB=B({startedAt:F().min(1),httpListenMs:I().nonnegative().optional(),seedWalkMs:I().nonnegative().optional(),indexesMs:I().nonnegative().optional(),readyMs:I().nonnegative().optional(),fileCount:I().nonnegative().optional()});B({serverInstanceId:F().min(1),currentBranch:F().min(1).optional(),currentDiskAckSVs:H(F().min(1),F().min(1)).optional(),boot:XB.optional(),collabClients:I().int().nonnegative().optional()}).loose(),B({id:F().min(1),display_name:F().min(1),display_email:F(),source:U([`git-config`,`synthesized`]),created_at:F().min(1)}).loose(),B({collabUrl:F().nullable(),previewUrl:F().nullable(),port:I(),singleFile:L().default(!1)}).loose();const ZB=U(`urn:ok:error:malformed-upload.urn:ok:error:collision-exhaustion.urn:ok:error:storage-full.urn:ok:error:storage-readonly.urn:ok:error:storage-error.urn:ok:error:no-file-received.urn:ok:error:path-escape.urn:ok:error:symlink-refused.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:payload-too-large.urn:ok:error:request-timeout.urn:ok:error:internal-server-error.urn:ok:error:derived-index-unavailable.urn:ok:error:loopback-required.urn:ok:error:invalid-origin.urn:ok:error:url-not-allowed.urn:ok:error:dir-outside-home.urn:ok:error:concurrent-operation.urn:ok:error:clone-failed.urn:ok:error:clone-timeout.urn:ok:error:server-start-failed.urn:ok:error:reserved-doc-name.urn:ok:error:target-not-found.urn:ok:error:stale-target.urn:ok:error:frontmatter-edit-not-supported.urn:ok:error:invalid-frontmatter-patch.urn:ok:error:frontmatter-malformed.urn:ok:error:no-active-session.urn:ok:error:too-many-agent-sessions.urn:ok:error:disk-divergence.urn:ok:error:stale-external-write.urn:ok:error:store-refused.urn:ok:error:doc-removed.urn:ok:error:doc-not-found.urn:ok:error:doc-already-exists.urn:ok:error:doc-not-open.urn:ok:error:rollback-not-configured.urn:ok:error:doc-not-available.urn:ok:error:backlink-index-not-configured.urn:ok:error:file-rescan-not-configured.urn:ok:error:shadow-not-configured.urn:ok:error:host-not-allowed.urn:ok:error:principal-not-available.urn:ok:error:not-found.urn:ok:error:auth-failed.urn:ok:error:no-project-dir.urn:ok:error:non-github-origin.urn:ok:error:server-open-failed.urn:ok:error:doc-in-conflict.urn:ok:error:concurrent-overwrite-refused.urn:ok:error:unresolved-conflict-markers.urn:ok:error:no-conflict-tracked.urn:ok:error:no-blocking-changes.urn:ok:error:sync-not-active.urn:ok:error:project-repo-not-configured.urn:ok:error:seed-prerequisite-missing.urn:ok:error:seed-invalid-root.urn:ok:error:tag-index-not-configured.urn:ok:error:template-not-found.urn:ok:error:unsupported-asset-type.urn:ok:error:asset-not-found.urn:ok:error:single-file-mode.urn:ok:error:collab-server-not-running.urn:ok:error:gateway-timeout.urn:ok:error:cursor-not-installed.urn:ok:error:cursor-spawn-timeout.urn:ok:error:cursor-spawn-failed.urn:ok:error:handoff-target-not-installed.urn:ok:error:handoff-spawn-timeout.urn:ok:error:handoff-spawn-failed.urn:ok:error:registry-unreachable.urn:ok:error:config-not-writable.urn:ok:error:audit-superseded.urn:ok:error:theme-name-taken.urn:ok:error:theme-name-invalid`.split(`.`)),QB=B({type:ZB,title:F().min(1),status:I().int().min(400).max(599),instance:F().regex(RB,`instance must be urn:uuid:<uuid>`).optional(),detail:F().optional()}).loose();B({parentDocName:F().min(1),placement:U([`configured-attachments`,`parent-dir`]).default(`configured-attachments`),agentId:F().min(1).optional(),agentName:F().min(1).optional()}).loose(),B({src:F().min(1),path:F().min(1).optional(),deduped:L().optional()}).loose(),B({url:F().min(1),dir:F().min(1),branch:F().min(1).refine(KB,`invalid branch name`).optional()}).loose(),B({type:W(`error`),problem:QB}).loose();function $B(e,t){let n=t.map(e=>[dl(e),e]);for(let t of e){let e=dl(t);if(e===null)continue;let r=n.find(([t])=>t===e);if(r!==void 0)return r[1]}}function eV(e){let{override:t,storedPreference:n,preferenceList:r,supportedLocales:i}=e,a=e.autoDetectableLocales??i;if(t!==void 0){let e=$B([t],i);if(e!==void 0)return{locale:e,source:`override`}}if(n!==void 0&&n!==`system`&&i.includes(n))return{locale:n,source:`explicit`};let o=$B(r,a);return o===void 0?{locale:`en`,source:`fallback`}:{locale:o,source:`system`}}const tV=[`.ok`,`local`,`installed-skills.json`],nV=U(ad),rV=si({hosts:z(F()),scope:nV,scripts:L(),installedAt:Fr(),projection:U([`symlink`,`copy`]).optional(),contentHash:F().optional()}),iV=si({schema:W(1),skills:H(F(),rV).default({})});function aV(e){let t;try{t=JSON.parse(e)}catch{return null}let n=iV.safeParse(t);return n.success?n.data:null}function oV(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===45||e===95}function sV(e){if(!e.includes(`eyJ`))return null;let t=[],n=[];for(let r=0;r<e.length;r+=1)if(oV(e.charCodeAt(r))){for(t.push(r);r<e.length&&oV(e.charCodeAt(r));)r+=1;n.push(r)}let r=[];for(let t=e.indexOf(`eyJ`);t!==-1;t=e.indexOf(`eyJ`,t+1))r.push(t);let i=r=>r+1<t.length&&e[n[r]??-1]===`.`&&t[r+1]===(n[r]??-1)+1,a=[],o=0,s=0;for(let c=0;c+2<t.length;c+=1){let l=t[c]??0,u=n[c]??0;for(;s<r.length&&(r[s]??0)<l;)s+=1;if(!i(c)||!i(c+1))continue;let d=t[c+1]??0,f=n[c+1]??0,p=(n[c+2]??0)-(t[c+2]??0);if(!e.startsWith(`eyJ`,d)||f-d<11||p<8)continue;let m=r[s];m===void 0||m>=u||u-m<11||(a.push(e.slice(o,m),`[REDACTED-JWT]`),o=n[c+2]??e.length,c+=2)}return a.length===0?null:(a.push(e.slice(o)),a.join(``))}function cV(e){return RegExp(`(?:\\b|(?<=(?:\\[|\\u009b)[0-?]*[ -/]*[@-~]))${e.source}`,`g`)}const lV=[{name:`github-pat`,regex:/(ghp_|gho_|ghu_|ghs_|ghr_)[A-Za-z0-9]{36,}\b/g,replacement:`[REDACTED-GH-PAT]`},{name:`aws-access-key`,regex:cV(/(AKIA|ASIA|ABIA)[A-Z2-7]{16}\b/),replacement:`[REDACTED-AWS-KEY]`},{name:`anthropic-key`,regex:/sk-ant-api03-[A-Za-z0-9_-]{20,}\b/g,replacement:`[REDACTED-ANTHROPIC]`},{name:`openai-key`,regex:cV(/sk-[A-Za-z0-9]{20,}\b/),replacement:`[REDACTED-OPENAI]`},{name:`bearer-token`,regex:/([Aa]uthorization:\s*[Bb]earer\s+)(?:\\"[^\s"\\]+\\"|"[A-Za-z0-9\-._~+/=]+"|[^\s"\\]+)/g,replacement:`$1[REDACTED]`},{name:`jwt`,redact:sV},{name:`url-credentials`,regex:/:\/\/[^/\s:@"]+:[^/\s:@"]+@/g,replacement:`://[REDACTED]@`},{name:`github-pat-fine-grained`,regex:/github_pat_[0-9A-Za-z_]{20,}/g,replacement:`[REDACTED-GH-PAT]`},{name:`openai-key-modern`,regex:cV(/sk-(?:proj|svcacct|admin|None)-[A-Za-z0-9_-]{20,}/),replacement:`[REDACTED-OPENAI]`},{name:`slack-token`,regex:/xox[a-z]-[A-Za-z0-9-]{10,}/g,replacement:`[REDACTED-SLACK]`},{name:`google-api-key`,regex:/AIza[0-9A-Za-z_-]{35}/g,replacement:`[REDACTED-GOOGLE]`},{name:`stripe-secret-key`,regex:cV(/(?:sk|rk)_live_[0-9A-Za-z]{16,}\b/),replacement:`[REDACTED-STRIPE]`},{name:`gitlab-pat`,regex:/glpat-[0-9A-Za-z_-]{20,}/g,replacement:`[REDACTED-GITLAB]`},{name:`bearer-token-json`,regex:/("[Aa]uthorization"\s*:\s*"[Bb]earer\s+)(?:\\"[^"\\]+\\"|[^"\\]+)/g,replacement:`$1[REDACTED]`},{name:`macos-home-path`,regex:/\/Users\/[^/"\r]*[^/"\r\\]/g,replacement:`~`},{name:`linux-home-path`,regex:/\/home\/[^/"\r]*[^/"\r\\]/g,replacement:`~`},{name:`windows-home-path`,regex:/[A-Za-z]:\\{1,2}Users\\{1,2}(?:(?![A-Za-z]:\\)[^\\"\r])+/gi,replacement:`~`}],uV=lV.map(e=>e.name);function dV(e){let t=new Set,n=0;return{redacted:e.split(`
|
|
344
|
+
`)}})]}}),nB=Kv.create({name:`sourceLiteral`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceRaw:{default:``}}},parseHTML(){return[{tag:`span[data-source-literal]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-source-literal":``,...e},0]}});function rB(e,t){if(typeof e!=`string`||typeof t!=`string`||/[\x00-\x1F\x7F]/.test(e))return!1;let n=e.replaceAll(`\xA0`,` `),r=t.replaceAll(`\xA0`,` `);return n===r||iB(n)===r||VR(e)===t}function iB(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}const aB=IS.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`~~`,rendered:!1}}}}),oB=Ux.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDashCounts:{default:null},sourceOuterPipes:{default:null,rendered:!1},sourceAlignmentPadding:{default:null,rendered:!1}}}}),sB=Ox.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),cB=kx.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),lB=ry.create({name:`tag`,marks:`_`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,renderText:cz,addAttributes(){return{value:{default:``}}},parseHTML(){return[{tag:`a[data-tag]`,getAttrs:e=>typeof e!=`string`&&{value:e.getAttribute(`data-tag`)||``}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.value??``);return[`a`,{...t,"data-tag":n,href:`#tag/${n}`,class:`tag`},`#${n}`]},addCommands(){return{insertTag:e=>({chain:t})=>t().insertContent({type:`tag`,attrs:{value:e}}).run()}}}),uB=/^(?:---|—-|___\s|\*\*\*\s)$/;function dB(e){let t=String(e[0]??``).replace(/\s+$/,``);return t===`—-`?`---`:t}const fB=$x.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}},addInputRules(){return[Xv({find:uB,type:this.type,getAttributes:e=>({sourceRaw:dB(e)})})]}}),pB=zS.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceForm:{default:`u`,rendered:!1}}}});function mB(e,t){let{target:n,anchor:r,alias:i}=e;if(!t.separatorCrossed)return e;if(r!==null){let e=vB(r);return{target:n,anchor:e.length>0?e:null,alias:i===null?null:yB(i)}}return{target:vB(n),anchor:null,alias:i===null?null:yB(i)}}function hB(e,t,n){let r=e.trim();return r===t?!0:n===`alias`?yB(r)===t:vB(r)===t}function gB(e,t,n){return typeof e==`string`&&hB(e,t,n)?e:t}function _B(e){return vB(e.trim())===``}function vB(e){return e.endsWith(`\\`)?e.slice(0,-1):e}function yB(e){return e.replace(/\\\|/g,`|`)}function bB(e){let t=``,n=0;for(let r of e)r===`\\`?n++:(r===`|`&&n%2==0&&(t+=`\\`),n=0),t+=r;return t}function xB(e){return e.replace(/\|/g,`\\|`)}function SB(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function CB(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const wB=ry.create({name:`wikiLink`,marks:`_`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:cz,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolved:{default:!1},sourceTarget:{default:null,rendered:!1},sourceAnchor:{default:null,rendered:!1},sourceAlias:{default:null,rendered:!1}}},parseHTML(){return[{tag:`span[data-wiki-link]`,getAttrs:e=>typeof e!=`string`&&{target:e.getAttribute(`data-target`)||``,alias:SB(e.getAttribute(`data-alias`)),anchor:SB(e.getAttribute(`data-anchor`)),resolved:e.getAttribute(`data-resolved`)===`true`}},{tag:`a.wiki-link[data-target]`,priority:100,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-target`)??``;return t?{target:t,alias:SB(e.getAttribute(`data-alias`)),anchor:SB(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=SB(e.attrs.alias),i=SB(e.attrs.anchor),a=e.attrs.resolved===!0;return[`span`,{...t,"data-wiki-link":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,"data-resolved":a?`true`:`false`},CB({target:n,alias:r,anchor:i})]}});function TB(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function EB(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const DB=[gz,Hz,_z,Vz,wB,ry.create({name:`wikiLinkEmbed`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:cz,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolvedSrc:{default:null,rendered:!1,parseHTML:()=>null}}},parseHTML(){let e=e=>typeof e==`string`||!e.hasAttribute(`data-wiki-embed`)?!1:{target:e.getAttribute(`data-target`)||``,alias:SB(e.getAttribute(`data-alias`)),anchor:SB(e.getAttribute(`data-anchor`))};return[{tag:`img[data-wiki-embed]`,getAttrs:e,priority:100},{tag:`a[data-wiki-embed]`,getAttrs:e,priority:100}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=SB(e.attrs.alias),i=SB(e.attrs.anchor),a=SB(e.attrs.resolvedSrc),o=TB(n);if(vs.has(o))return[`img`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,src:a??n,alt:r??n}];let s=a??n;return[`a`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,href:i?`${s}#${i}`:s,target:`_blank`,rel:`noopener noreferrer`},EB({target:n,alias:r,anchor:i})]}}),lB,zz,Bz,iz,az,aB,pB,Wz,rz,Uz,dz,fB,wz,fz,Tz,uz,oz,qz,nB,tB,kC.configure({trailingNode:!1,undoRedo:!1,bulletList:!1,orderedList:!1,listItem:!1,listKeymap:{listTypes:[{itemName:`listItem`,wrapperNames:[`list`]}]},italic:!1,bold:!1,strike:!1,underline:!1,code:!1,codeBlock:!1,heading:!1,horizontalRule:!1,hardBreak:!1,link:!1,blockquote:!1,dropcursor:{color:`color-mix(in oklch, var(--primary) 50%, transparent)`,width:2}}),eB,oB.configure({resizable:!0}),Ax,cB,sB,hz.configure({inline:!0}),pz,Ry,Kz,Gz,lz,sz],OB=B({changes:z(ui(`kind`,[B({key:F(),kind:W(`added`),after:nd}).loose(),B({key:F(),kind:W(`removed`),before:nd}).loose(),B({key:F(),kind:W(`changed`),before:nd,after:nd}).loose()])),unparseable:B({before:F(),after:F()}).loose().nullable()}).loose();function kB(e){if(e===``)throw Error(`toPathspec: empty path. ":(literal)" is an empty pattern that matches every tracked path; pass "." if you meant the repo root.`);return`:(literal)${e}`}function AB(e){if(e.length===0)throw Error(`pathspecArgs: empty path list. A bare "--" removes the pathspec restriction rather than selecting nothing.`);return[`--`,...e.map(e=>kB(e))]}3072-jB("This is an OpenKnowledge project: load the `open-knowledge` skill and use the OpenKnowledge MCP tools for all markdown — don't probe for `.ok/` or use native file tools on `.md` / `.mdx`. ",`cursor`),new TextEncoder;function jB(e,t){let n=encodeURIComponent(e);return t===`cursor`?encodeURIComponent(n).length:n.length}function MB(e){if(e.length===0)return{ok:!1,reason:`docName must not be empty`};if(e.trim().length===0)return{ok:!1,reason:`docName must not be blank (whitespace only)`};if(e!==e.trim())return{ok:!1,reason:`docName must not have leading or trailing whitespace`};for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return{ok:!1,reason:`docName must not contain control characters`}}if(e.includes(`..`)||e.startsWith(`/`)||e.includes(`\\`))return{ok:!1,reason:`docName must not contain "..", a leading "/", or a backslash`};for(let t of e.split(`/`)){if(t.length===0)return{ok:!1,reason:`docName must not contain empty path segments (no leading, trailing, or doubled "/")`};if(t.startsWith(`.`))return{ok:!1,reason:`docName path segments must not start with "." (hidden files are not addressable)`}}return{ok:!0}}function NB(e,t){let n=MB(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}const PB=F().superRefine(NB).optional(),FB=F().superRefine(NB),IB={agentId:F().optional(),agentName:F().optional(),colorSeed:F().optional(),clientName:F().optional(),clientVersion:F().optional(),label:F().optional()},LB=F().optional(),RB=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;ui(`kind`,[B({kind:W(`doc`),docPath:F().min(1)}).loose(),B({kind:W(`folder`),folderPath:F()}).loose()]);const zB=U([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`,`unsupported-share-url`]),BB=U([`current`,`stale`,`absent`,`empty`]);ui(`ok`,[B({ok:W(!0),shareUrl:F().min(1),sharedUrl:F().min(1),branch:F().min(1),freshness:BB.optional().catch(void 0)}).loose(),B({ok:W(!1),error:zB,branch:F().min(1).optional()}).loose()]);const VB=U([`user`,`org`]),HB=B({login:F().min(1),kind:VB,avatarUrl:F().optional()}).loose(),UB=U([`auth-required`,`network`]);ui(`ok`,[B({ok:W(!0),owners:z(HB)}).loose(),B({ok:W(!1),error:UB}).loose()]),ui(`ok`,[B({ok:W(!0),available:L()}).loose(),B({ok:W(!1),error:UB}).loose()]);const WB=U([`public`,`private`]);B({owner:F().min(1),name:F().min(1),visibility:WB,description:F().optional()}).loose();const GB=U([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]);ui(`ok`,[B({ok:W(!0),ownerLogin:F().min(1),repoName:F().min(1),cloneUrl:F().min(1),defaultBranch:F().min(1)}).loose(),B({ok:W(!1),error:GB}).loose()]);function KB(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}const qB=e=>e.refine(KB,`invalid branch name`),JB={shareTargetExists:L(),dirtyConflicts:B({conflicts:L(),files:z(F().min(1))}).loose(),branchIsLocal:L(),shareTargetOnOriginBranch:L().optional()};ui(`detached`,[B({detached:W(!1),currentBranch:F().min(1).nullable(),currentHeadSha:ni(),...JB}).loose(),B({detached:W(!0),currentBranch:ni(),currentHeadSha:F().min(1),...JB}).loose()]),B({branch:qB(F().min(1)),principalId:F().optional(),fastForward:L().optional()}).loose();const YB=U([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`,`ff-diverged`]);ui(`ok`,[B({ok:W(!0)}).loose(),B({ok:W(!1),reason:YB,files:z(F().min(1)).optional(),otherWorktreePath:F().min(1).optional()}).loose()]),U([`on-origin`,`renamed`,`deleted`,`never-on-branch`,`changed-locally`,`unknown`]),B({branch:qB(F().min(1)),path:F(),kind:U([`doc`,`folder`]),contentRootDepth:I().int().min(1).max(65535).optional()}).loose(),ui(`verdict`,[B({verdict:W(`on-origin`)}).loose(),B({verdict:W(`renamed`),renamedTo:F().min(1)}).loose(),B({verdict:W(`deleted`)}).loose(),B({verdict:W(`never-on-branch`)}).loose(),B({verdict:W(`changed-locally`)}).loose(),B({verdict:W(`unknown`)}).loose()]).catch({verdict:`unknown`});const XB=B({startedAt:F().min(1),httpListenMs:I().nonnegative().optional(),seedWalkMs:I().nonnegative().optional(),indexesMs:I().nonnegative().optional(),readyMs:I().nonnegative().optional(),fileCount:I().nonnegative().optional()});B({serverInstanceId:F().min(1),currentBranch:F().min(1).optional(),currentDiskAckSVs:H(F().min(1),F().min(1)).optional(),boot:XB.optional(),collabClients:I().int().nonnegative().optional()}).loose(),B({id:F().min(1),display_name:F().min(1),display_email:F(),source:U([`git-config`,`synthesized`]),created_at:F().min(1)}).loose(),B({collabUrl:F().nullable(),previewUrl:F().nullable(),port:I(),singleFile:L().default(!1)}).loose();const ZB=U(`urn:ok:error:malformed-upload.urn:ok:error:collision-exhaustion.urn:ok:error:storage-full.urn:ok:error:storage-readonly.urn:ok:error:storage-error.urn:ok:error:no-file-received.urn:ok:error:path-escape.urn:ok:error:symlink-refused.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:unsupported-media-type.urn:ok:error:payload-too-large.urn:ok:error:request-timeout.urn:ok:error:internal-server-error.urn:ok:error:derived-index-unavailable.urn:ok:error:loopback-required.urn:ok:error:invalid-origin.urn:ok:error:url-not-allowed.urn:ok:error:dir-outside-home.urn:ok:error:concurrent-operation.urn:ok:error:clone-failed.urn:ok:error:clone-timeout.urn:ok:error:server-start-failed.urn:ok:error:reserved-doc-name.urn:ok:error:target-not-found.urn:ok:error:stale-target.urn:ok:error:frontmatter-edit-not-supported.urn:ok:error:invalid-frontmatter-patch.urn:ok:error:frontmatter-malformed.urn:ok:error:no-active-session.urn:ok:error:too-many-agent-sessions.urn:ok:error:disk-divergence.urn:ok:error:stale-external-write.urn:ok:error:store-refused.urn:ok:error:doc-removed.urn:ok:error:doc-not-found.urn:ok:error:doc-already-exists.urn:ok:error:doc-not-open.urn:ok:error:rollback-not-configured.urn:ok:error:doc-not-available.urn:ok:error:backlink-index-not-configured.urn:ok:error:file-rescan-not-configured.urn:ok:error:shadow-not-configured.urn:ok:error:host-not-allowed.urn:ok:error:principal-not-available.urn:ok:error:not-found.urn:ok:error:auth-failed.urn:ok:error:no-project-dir.urn:ok:error:non-github-origin.urn:ok:error:server-open-failed.urn:ok:error:doc-in-conflict.urn:ok:error:concurrent-overwrite-refused.urn:ok:error:unresolved-conflict-markers.urn:ok:error:no-conflict-tracked.urn:ok:error:no-blocking-changes.urn:ok:error:sync-not-active.urn:ok:error:project-repo-not-configured.urn:ok:error:seed-prerequisite-missing.urn:ok:error:seed-invalid-root.urn:ok:error:tag-index-not-configured.urn:ok:error:template-not-found.urn:ok:error:unsupported-asset-type.urn:ok:error:asset-not-found.urn:ok:error:single-file-mode.urn:ok:error:collab-server-not-running.urn:ok:error:gateway-timeout.urn:ok:error:cursor-not-installed.urn:ok:error:cursor-spawn-timeout.urn:ok:error:cursor-spawn-failed.urn:ok:error:handoff-target-not-installed.urn:ok:error:handoff-spawn-timeout.urn:ok:error:handoff-spawn-failed.urn:ok:error:registry-unreachable.urn:ok:error:config-not-writable.urn:ok:error:audit-superseded.urn:ok:error:theme-name-taken.urn:ok:error:theme-name-invalid`.split(`.`)),QB=B({type:ZB,title:F().min(1),status:I().int().min(400).max(599),instance:F().regex(RB,`instance must be urn:uuid:<uuid>`).optional(),detail:F().optional()}).loose();B({parentDocName:F().min(1),placement:U([`configured-attachments`,`parent-dir`]).default(`configured-attachments`),agentId:F().min(1).optional(),agentName:F().min(1).optional()}).loose(),B({src:F().min(1),path:F().min(1).optional(),deduped:L().optional()}).loose(),B({url:F().min(1),dir:F().min(1),branch:F().min(1).refine(KB,`invalid branch name`).optional()}).loose(),B({type:W(`error`),problem:QB}).loose();function $B(e,t){let n=t.map(e=>[dl(e),e]);for(let t of e){let e=dl(t);if(e===null)continue;let r=n.find(([t])=>t===e);if(r!==void 0)return r[1]}}function eV(e){let{override:t,storedPreference:n,preferenceList:r,supportedLocales:i}=e,a=e.autoDetectableLocales??i;if(t!==void 0){let e=$B([t],i);if(e!==void 0)return{locale:e,source:`override`}}if(n!==void 0&&n!==`system`&&i.includes(n))return{locale:n,source:`explicit`};let o=$B(r,a);return o===void 0?{locale:`en`,source:`fallback`}:{locale:o,source:`system`}}const tV=[`.ok`,`local`,`installed-skills.json`],nV=U(ad),rV=si({hosts:z(F()),scope:nV,scripts:L(),installedAt:Fr(),projection:U([`symlink`,`copy`]).optional(),contentHash:F().optional()}),iV=si({schema:W(1),skills:H(F(),rV).default({})});function aV(e){let t;try{t=JSON.parse(e)}catch{return null}let n=iV.safeParse(t);return n.success?n.data:null}function oV(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===45||e===95}function sV(e){if(!e.includes(`eyJ`))return null;let t=[],n=[];for(let r=0;r<e.length;r+=1)if(oV(e.charCodeAt(r))){for(t.push(r);r<e.length&&oV(e.charCodeAt(r));)r+=1;n.push(r)}let r=[];for(let t=e.indexOf(`eyJ`);t!==-1;t=e.indexOf(`eyJ`,t+1))r.push(t);let i=r=>r+1<t.length&&e[n[r]??-1]===`.`&&t[r+1]===(n[r]??-1)+1,a=[],o=0,s=0;for(let c=0;c+2<t.length;c+=1){let l=t[c]??0,u=n[c]??0;for(;s<r.length&&(r[s]??0)<l;)s+=1;if(!i(c)||!i(c+1))continue;let d=t[c+1]??0,f=n[c+1]??0,p=(n[c+2]??0)-(t[c+2]??0);if(!e.startsWith(`eyJ`,d)||f-d<11||p<8)continue;let m=r[s];m===void 0||m>=u||u-m<11||(a.push(e.slice(o,m),`[REDACTED-JWT]`),o=n[c+2]??e.length,c+=2)}return a.length===0?null:(a.push(e.slice(o)),a.join(``))}function cV(e){return RegExp(`(?:\\b|(?<=(?:\\[|\\u009b)[0-?]*[ -/]*[@-~]))${e.source}`,`g`)}const lV=[{name:`github-pat`,regex:/(ghp_|gho_|ghu_|ghs_|ghr_)[A-Za-z0-9]{36,}\b/g,replacement:`[REDACTED-GH-PAT]`},{name:`aws-access-key`,regex:cV(/(AKIA|ASIA|ABIA)[A-Z2-7]{16}\b/),replacement:`[REDACTED-AWS-KEY]`},{name:`anthropic-key`,regex:/sk-ant-api03-[A-Za-z0-9_-]{20,}\b/g,replacement:`[REDACTED-ANTHROPIC]`},{name:`openai-key`,regex:cV(/sk-[A-Za-z0-9]{20,}\b/),replacement:`[REDACTED-OPENAI]`},{name:`bearer-token`,regex:/([Aa]uthorization:\s*[Bb]earer\s+)(?:\\"[^\s"\\]+\\"|"[A-Za-z0-9\-._~+/=]+"|[^\s"\\]+)/g,replacement:`$1[REDACTED]`},{name:`jwt`,redact:sV},{name:`url-credentials`,regex:/:\/\/[^/\s:@"]+:[^/\s:@"]+@/g,replacement:`://[REDACTED]@`},{name:`github-pat-fine-grained`,regex:/github_pat_[0-9A-Za-z_]{20,}/g,replacement:`[REDACTED-GH-PAT]`},{name:`openai-key-modern`,regex:cV(/sk-(?:proj|svcacct|admin|None)-[A-Za-z0-9_-]{20,}/),replacement:`[REDACTED-OPENAI]`},{name:`slack-token`,regex:/xox[a-z]-[A-Za-z0-9-]{10,}/g,replacement:`[REDACTED-SLACK]`},{name:`google-api-key`,regex:/AIza[0-9A-Za-z_-]{35}/g,replacement:`[REDACTED-GOOGLE]`},{name:`stripe-secret-key`,regex:cV(/(?:sk|rk)_live_[0-9A-Za-z]{16,}\b/),replacement:`[REDACTED-STRIPE]`},{name:`gitlab-pat`,regex:/glpat-[0-9A-Za-z_-]{20,}/g,replacement:`[REDACTED-GITLAB]`},{name:`bearer-token-json`,regex:/("[Aa]uthorization"\s*:\s*"[Bb]earer\s+)(?:\\"[^"\\]+\\"|[^"\\]+)/g,replacement:`$1[REDACTED]`},{name:`macos-home-path`,regex:/\/Users\/[^/"\r]*[^/"\r\\]/g,replacement:`~`},{name:`linux-home-path`,regex:/\/home\/[^/"\r]*[^/"\r\\]/g,replacement:`~`},{name:`windows-home-path`,regex:/[A-Za-z]:\\{1,2}Users\\{1,2}(?:(?![A-Za-z]:\\)[^\\"\r])+/gi,replacement:`~`}],uV=lV.map(e=>e.name);function dV(e){let t=new Set,n=0;return{redacted:e.split(`
|
|
345
345
|
`).map(e=>{let r=e,i=!1;for(let e of lV){if(`redact`in e){let n=e.redact(r);if(n===null)continue;t.add(e.name),i=!0,r=n;continue}let{name:n,regex:a,replacement:o}=e;a.lastIndex=0,a.test(r)&&(t.add(n),i=!0,a.lastIndex=0,r=r.replace(a,o))}return i&&n++,r}).join(`
|
|
346
346
|
`),patterns:[...t],lineCount:n}}function fV(e,t,n=3){let r=RegExp(`^ {0,3}(\\${e}+)[ \\t]*$`),i=Math.max(3,n);for(let e of t.split(`
|
|
347
347
|
`)){let t=r.exec(e);t&&t[1].length>=i&&(i=t[1].length+1)}return i}function pV(e){let t=[],n=0,r=()=>{t.length>0&&(n+=1)},i=e=>{for(;n>0;)t.push({type:`break`}),--n;t.push(e)},a=e=>{e.split(`
|
|
@@ -349,26 +349,28 @@ ${t.slice(l+2)}`,d+=1;else break}t.push({indent:l,number:parseInt(s,10),content:
|
|
|
349
349
|
<Tab label="Two">Body of the second tab panel.</Tab>`,serialize:(e,t)=>_V(`Tabs`,e,t,GV)},{name:`Tab`,surface:`canonical`,hasChildren:!0,props:KV,icon:`PanelTop`,category:`content`,displayName:`Tab`,description:"A single tab panel inside a `<Tabs>` container — carries the strip label and the block-content body.",searchTerms:[`tab`,`panel`],exampleBody:"Panel content — must be nested inside a `<Tabs>` parent.",serialize:(e,t)=>_V(`Tab`,e,t,KV)},{name:`Math`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:qV,icon:`Sigma`,category:`content`,displayName:`Math`,description:`Block math equation rendered with KaTeX from a LaTeX source string`,searchTerms:[`math`,`latex`,`equation`,`formula`,`katex`,`tex`],serialize:(e,t)=>_V(`Math`,e,t,qV)},{name:`MermaidFence`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:XV,icon:`Workflow`,category:`content`,displayName:`Mermaid`,placeholder:{label:`Add a Mermaid diagram`},description:"Diagram rendered from Mermaid source (flowchart, sequence, class, state, ER, gantt, pie). Authored exclusively as ` ```mermaid ` fenced code.",searchTerms:[`mermaid`,`diagram`,`flowchart`,`graph`,`sequence`,`sequencediagram`,`class`,`state`,`er`,`erdiagram`,`gantt`,`pie`,`chart`],serialize:e=>({type:`code`,lang:`mermaid`,meta:null,value:e.attrs.props?.chart??``})},{name:`Mirror`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:tH,icon:`CopyPlus`,category:`content`,displayName:`Mirror`,description:"Render a read-only copy of a `<MirrorSource>` block from another doc. Use to keep the same content in sync across multiple docs without copy-paste — edits land at the source, every Mirror reflects the change.",searchTerms:[`mirror`,`sync`,`synced`,`transclude`,`embed`,`reference`,`shared block`],serialize:(e,t)=>_V(`Mirror`,e,t,tH)},{name:`MirrorSource`,surface:`canonical`,hasChildren:!0,props:nH,icon:`GitBranch`,category:`content`,displayName:`Mirror Source`,description:'Mark a block as the source of truth for content that appears in multiple docs. Wrap any block content; `<Mirror src="…" anchor="<id>">` references render this verbatim read-only at every call-site. Edit here, propagate everywhere.',searchTerms:[`mirror source`,`sync source`,`source block`,`master block`,`shared`],exampleBody:"Authoritative content lives inside this block — edits here propagate to every `<Mirror>` that references this id.",serialize:(e,t)=>_V(`MirrorSource`,e,t,nH)},{name:`GFMCallout`,surface:`compat`,hasChildren:!0,props:RV,icon:`MessageSquareWarning`,category:`content`,displayName:`GFM Callout`,description:"GFM blockquote alert (`> [!NOTE]`) — read-only compat. Preserves `> [!NOTE]` syntax on round-trip; insert a fresh Callout block for the full prop surface.",rendersAs:`Callout`,translateProps:e=>e,serialize:(e,t)=>{let n=e.attrs.props,r=new Set([`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`]),i=n?.type??`note`;return{type:`blockquote`,children:[{type:`html`,value:`[!${(r.has(i.toLowerCase())?i:`note`).toUpperCase()}]${n?.collapsible?n.defaultOpen===!1?`-`:`+`:``}${n?.title?` ${n.title}`:``}`},...t.all(e).filter(e=>{if(e.type!==`paragraph`)return!0;let t=e;return Array.isArray(t.children)&&t.children.length>0})]}}},{name:`CommonMarkImage`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:zV,icon:`Image`,category:`media`,displayName:`CommonMark Image`,description:'CommonMark image (``) — read-only compat. Preserves `` syntax on round-trip; insert a fresh Image block for the full HTML-native attribute surface (srcset, sizes, decoding, etc.).',rendersAs:`img`,translateProps:e=>e,serialize:e=>{let t=e.attrs.props;return{type:`paragraph`,children:[{type:`image`,url:t?.sourceUrl??t?.src??``,alt:t?.alt??``,title:t?.title??null}]}}},{name:`WikiEmbedImage`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:HV,icon:`ZoomIn`,category:`media`,displayName:`Wiki Embed Image`,description:"Obsidian-style `![[file.png]]` wiki-embed — read-only compat. Edit the alt-text via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`img`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,alt:t??n}},serialize:aH},{name:`WikiEmbedVideo`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:UV,icon:`Film`,category:`media`,displayName:`Wiki Embed Video`,description:"Obsidian-style `![[clip.mp4]]` wiki-embed — read-only compat. Edit the title via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`video`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,title:t??n}},serialize:aH},{name:`WikiEmbedAudio`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:WV,icon:`Volume2`,category:`media`,displayName:`Wiki Embed Audio`,description:"Obsidian-style `![[song.mp3]]` wiki-embed — read-only compat. Edit the title via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`audio`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,title:t??n}},serialize:aH},{name:`WikiEmbedFile`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:ZV,icon:`Paperclip`,category:`media`,displayName:`Wiki Embed File`,description:"Obsidian-style `![[file.zip]]` wiki-embed — read-only compat for arbitrary downloadable attachments. Renders through the `File` canonical (inline row with file-up icon + bold name + optional dim size). Edit the display name via the alias slot.",rendersAs:`File`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.size==`string`&&e.size.length>0?e.size:null;return{src:e.src,name:t??void 0,size:n??void 0}},serialize:aH},{name:`HtmlDetailsAccordion`,surface:`compat`,hasChildren:!0,props:BV,icon:`ChevronRight`,category:`content`,displayName:`HTML5 Details`,description:"HTML5 `<details><summary>` collapsible — read-only compat. Preserves `<details>` syntax on round-trip; insert a fresh Accordion block for icon / description / group-name props.",rendersAs:`Accordion`,translateProps:e=>e,serialize:(e,t)=>{let n=e.attrs.props,r=n?.defaultOpen?` open`:``,i=n?.name?` name="${rH(n.name)}"`:``,a=n?.id?` id="${rH(n.id)}"`:``,o=n?.title?.trim(),s=o?`<summary>${iH(o)}</summary>`:``;return{type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:[],children:t.all(e),data:{htmlBoundary:{opener:`<details${r}${i}${a}>\n${s}`,closer:`</details>`}}}}},{name:`HtmlAlignBlock`,surface:`canonical`,hasChildren:!0,props:VV,icon:`AlignCenter`,category:`content`,displayName:`Align block`,description:"GitHub-style `<div align>` wrapper. Children render as normal blocks with the alignment applied; the `<div align>` syntax is preserved on round-trip.",searchTerms:[`align`,`center`,`centered`,`div`],serialize:(e,t)=>{let n=e.attrs.props,r=n?.tag===`center`?`center`:`div`,i=typeof n?.align==`string`&&n.align?n.align:null,a=typeof n?.sourceAttrs==`string`?n.sourceAttrs:``,o=/(\balign\s*=\s*)(?:"[^"]*"|'[^']*'|[^\s"'<>]+)/i;return i!==null&&(r===`div`||i!==`center`)?a=o.test(a)?a.replace(o,`$1"${rH(i)}"`):`${a} align="${rH(i)}"`:(i===null||r===`center`&&i===`center`)&&(a=a.replace(RegExp(`\\s*${o.source}`,`i`),``)),{type:`mdxJsxFlowElement`,name:`HtmlAlignBlock`,attributes:[],children:t.all(e),data:{htmlBoundary:{opener:`<${r}${a}>`,closer:`</${r}>`}}}}},{name:`DollarMath`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:JV,icon:`Sigma`,category:`content`,displayName:`Dollar Math`,description:"Block math via `$$…$$` syntax — read-only compat. Preserves `$$…$$` form on round-trip; insert a fresh Math block for the full prop surface (id, language).",rendersAs:`Math`,translateProps:e=>e,serialize:e=>({type:`math`,value:e.attrs.props?.formula??``})},{name:`MathFence`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:YV,icon:`Sigma`,category:`content`,displayName:`Math Fence`,description:"Block math via ` ```math ` fenced code syntax — read-only compat. Preserves the fence form on round-trip; insert a fresh Math block for the full prop surface (id, language).",rendersAs:`Math`,translateProps:e=>e,serialize:e=>({type:`code`,lang:`math`,meta:null,value:e.attrs.props?.formula??``})}],sH={name:`*`,surface:`canonical`,hasChildren:!0,props:[],description:`Unregistered component — children editable as markdown`,serialize:(e,t)=>_V(e.attrs.componentName||`*`,e,t)};function cH(){let e=new Map;e.set(`*`,sH);for(let t of oH)e.set(t.name,t);return{get(t){return e.get(t)},getOrWildcard(t){return e.get(t)??e.get(`*`)},set(t,n){e.set(t,n)},has(t){return e.has(t)},entries(){return e.entries()}}}const lH={parseFallback:{blockLevel:0,wholeDoc:0,wholeDocBudget:0},jsxRenderFailure:{},jsxAutoConvertFailed:{},jsxAutoConvertSucceeded:{},jsxActionAborted:{},jsxPropDropped:{},jsxMoveFailed:{},jsxStuckCopyFailed:{},jsxStuckDeleteFailed:{},jsxPopoverCloseRestoreFailed:{},jsxKeyboardDeleteFailed:{},jsxChromeDeleteFailed:{},blockGripClickSelectFailed:{},jsxArrowNodeSelectFailed:{}};function uH(){lH.parseFallback.blockLevel++}function dH(){lH.parseFallback.wholeDoc++}function fH(){lH.parseFallback.wholeDocBudget++}const pH=/^(`{3,}|~{3,})/gm;function mH(e){let t=[],n=null;for(let r of e.matchAll(pH)){let e=r[1],i=r.index;n?e[0]===n.marker[0]&&e.length>=n.marker.length&&(t.push([n.offset,i+r[0].length]),n=null):n={marker:e,offset:i}}return n&&t.push([n.offset,e.length]),t}function hH(e,t){return t.some(([t,n])=>e>=t&&e<n)}const gH=/`+/g;function _H(e){let t=[];gH.lastIndex=0;for(let n of e.matchAll(gH))t.push({offset:n.index,length:n[0].length});let n=[];for(let e=0;e<t.length;e++){let r=t[e];for(let i=e+1;i<t.length;i++){let a=t[i];if(a.length===r.length){n.push([r.offset,a.offset+a.length]),e=i;break}}}return n}const vH=/^[ \t]{0,3}\[([^\]]+)\]:\s*(\S+)(\s+(?:"[^"]*"|'[^']*'|\([^)]*\)))?\s*$/gm;function yH(e){let t=mH(e),n=[];for(let r of e.matchAll(vH))hH(r.index,t)||n.push(r[0].trimEnd());return n.length>0?`${n.join(`
|
|
350
350
|
`)}\n\n`:``}function bH(e,t){let n={startMs:typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),calls:0};return CH(e,t.parse,0,n)}function xH(e){return e.calls>=1e3||(typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now())-e.startMs>=500}function SH(e){return e instanceof Error?{name:e.name,message:e.message.slice(0,500),stack:e.stack?.split(`
|
|
351
351
|
`).slice(0,4).join(`
|
|
352
|
-
`)}:{name:`UnknownError`,message:String(e??`unknown`).slice(0,500)}}function CH(e,t,n,r){if(n>20)return dH(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`MAX_SPLIT_DEPTH exceeded`})),MH(e);if(r){if(xH(r))return fH(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`parse budget exhausted`,calls:r.calls})),MH(e);r.calls+=1}try{return t(e)}catch(i){let a=wH(i),o=SH(i);if(a===void 0){if(n===0){let n=jH(e,t,i,r);if(n)return n}return dH(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:o.message,error:o})),MH(e)}uH(),console.warn(JSON.stringify({event:`mdx-block-fallback`,offset:a,reason:o.message,error:o}));try{let i=kH(e,a),s=e.slice(i.start,i.end),c=e.slice(0,i.start).replace(/\n+$/,``),l=e.slice(i.end).replace(/^\n+/,``),u=c.trim()?CH(c,t,n+1,r):{type:`doc`,content:[]},d=l.trim()?CH(yH(c)+l,t,n+1,r):{type:`doc`,content:[]},f={type:`rawMdxFallback`,attrs:{reason:o.message,originalSpan:{start:i.start,end:i.end}},content:s?[{type:`text`,text:s}]:[]},p=[...u.content??[],f,...d.content??[]];return{type:`doc`,content:p.length>0?p:[{type:`paragraph`,content:[]}]}}catch(t){dH();let n=SH(t);return console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`Recovery failed: ${n.message}`,recoveryPath:`block-split-then-rejoin`,error:n,originalError:o})),MH(e)}}}function wH(e){if(!e||typeof e!=`object`)return;let t=e;if(t.place&&typeof t.place.offset==`number`)return t.place.offset;if(t.place?.start&&typeof t.place.start.offset==`number`)return t.place.start.offset;if(t.position&&typeof t.position.offset==`number`)return t.position.offset;if(t.position?.start&&typeof t.position.start.offset==`number`)return t.position.start.offset}function TH(e,t){let n=/\n\s*\n/g,r=null;for(let i of e.matchAll(n)){if(i.index>=t)break;r=i.index+i[0].length}return r}function EH(e,t){for(let n of e.matchAll(/\n\s*\n/g))if(n.index>=t)return n.index;return null}function DH(e,t){let n=[];for(let r of e.matchAll(/<(\/?)([A-Z][A-Za-z0-9.]*)/g)){let i=r.index;if(hH(i,t))continue;let a=r[1]===`/`,o=r[2],s=i+r[0].length,c=Math.min(e.length,s+32768),l=!1,u=0,d=-1,f=!1;for(let t=s;t<c;t++){let n=e[t];if(l){n===`"`&&(l=!1),n===`\\`&&t+1<c&&t++;continue}if(n===`"`){l=!0;continue}if(n===`{`){u++;continue}if(n===`}`&&u>0){u--;continue}if(!(u>0)&&n===`>`){d=t,t>0&&e[t-1]===`/`&&(f=!0);break}}if(d===-1)continue;let p=d+1;a?n.push({kind:`close`,name:o,start:i,end:p}):f?n.push({kind:`self-close`,name:o,start:i,end:p}):n.push({kind:`open`,name:o,start:i,end:p})}return n}function OH(e){let t=DH(e,mH(e)),n=[],r=[];for(let i of t){if(i.kind===`self-close`)continue;if(i.kind===`open`){n.push(i);continue}let t=-1;for(let e=n.length-1;e>=0;e--)if(n[e].name===i.name){t=e;break}if(t!==-1){for(let a=n.length-1;a>t;a--){let t=n[a],o=EH(e,t.start)??e.length;r.push({start:t.start,end:Math.min(i.start,o),source:`unmatched`})}r.push({start:n[t].start,end:i.end,source:`pair`}),n.length=t}}for(let t of n){let n=EH(e,t.start)??e.length;r.push({start:t.start,end:Math.min(e.length,n),source:`unmatched`})}return r}function kH(e,t){let n=OH(e),r=null;for(let e of n)e.start<=t&&t<=e.end&&(!r||e.end-e.start<r.end-r.start)&&(r=e);return r?{start:r.start,end:r.end}:{start:TH(e,t)??0,end:EH(e,t)??e.length}}function AH(e){let t=mH(e),n=/\n[ \t]*\n/g,r=[0];for(let i of e.matchAll(n)){let e=i.index;hH(e,t)||r.push(e+i[0].length)}r.push(e.length);let i=[];for(let t=0;t<r.length-1;t++){let n=r[t],a=r[t+1];if(a<=n)continue;let o=e.slice(n,a);o.trim()&&i.push({src:o,start:n,end:a})}return i}function jH(e,t,n,r){let i=AH(e);if(i.length<2)return null;let a=[],o=!1,s=``;for(let e of i){if(r&&xH(r))break;r&&(r.calls+=1);let i=s+e.src;try{let n=t(i).content??[];s+=yH(e.src);let r=n.filter(e=>e.type!==`paragraph`||Array.isArray(e.content)&&e.content.length>0);if(r.length===0&&n.length>0){o=!0;continue}a.push(...r),o=!0}catch(t){uH();let r=t?.message?.slice(0,200)??`unknown block error`,i=n?.message?.slice(0,160)??`unknown`;console.warn(JSON.stringify({event:`mdx-block-fallback`,offset:e.start,reason:`Per-block recovery after position-less error: ${i}`,blockError:r,blockErrorName:t?.name})),a.push({type:`rawMdxFallback`,attrs:{reason:r,originalSpan:{start:e.start,end:e.end}},content:[{type:`text`,text:e.src}]})}}return o?{type:`doc`,content:a.length>0?a:[{type:`paragraph`,content:[]}]}:null}function MH(e){return{type:`doc`,content:[{type:`paragraph`,content:[{type:`text`,text:e}]}]}}function NH(e){if(typeof e!=`object`||!e||!Object.hasOwn(e,`escapedChars`))return{kind:`absent`};let t=e.escapedChars;return Array.isArray(t)&&t.every(e=>{if(typeof e!=`object`||!e)return!1;let t=e.offset;return typeof t==`number`&&Number.isInteger(t)&&t>=0&&typeof e.char==`string`})?{kind:`valid`,data:{escapedChars:t}}:{kind:`malformed`}}function PH(e){return NH(e).kind===`valid`}const FH=[[``,``],[``,``],[``,``],[``,``],[``,``]],IH=/[\uE000-\uE004]/,LH=/[\uE005-\uE009]/,RH=FH.map(([e,t])=>({from:e,to:t})),zH=/<([a-zA-Z][a-zA-Z0-9+.-]*:[^\s<>]+)>/g,BH=/<!--[\s\S]*?-->/g,VH=/<\/([a-z][a-z0-9]*)\s*>/g,HH=/<([a-z][a-z0-9]*)(\s[^>]*)?\/?>/g,UH=new Set([`img`,`video`,`audio`]),WH=new Set([`mark`,`u`,`ins`]);function GH(e,t,n,r){let i=0,a=0,o=`<${t}`;for(;a<n;){let t=e.indexOf(o,a);if(t===-1||t>=n)break;a=t+o.length;let s=e[t+o.length];if(s!==void 0&&s!==`>`&&s!==`/`&&!/\s/.test(s)||hH(t,r))continue;let c=e.indexOf(`>`,t);(c===-1||e[c-1]!==`/`)&&i++}return i}const KH=/<\/([A-Z][A-Za-z0-9.]*)>/g;function qH(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>>1;e[i]<t?n=i+1:r=i}return n}function JH(e){let t=new Map,n=new RegExp(KH.source,`g`),r=n.exec(e);for(;r!==null;){let i=t.get(r[1]);i?i.push(r.index):t.set(r[1],[r.index]),r=n.exec(e)}return t}function YH(e){let t=[],n=/\n\s*\n/g,r=n.exec(e);for(;r!==null;)t.push(r.index),r=n.exec(e);return t}function XH(e){let t=[],n=e.indexOf(`>`);for(;n!==-1;)t.push(n),n=e.indexOf(`>`,n+1);return t}
|
|
353
|
-
`||n===`\r`||n==="`")return!1;if(n!==`[`&&n!==`]`)continue;let r=0;for(let n=e-1;n>=0&&t[n]===`\\`;n--)r++;if(r%2!=1){if(n===`]`||t[e+1]===`^`||t[e-1]===`]`)return!1;i=!0;break}}if(!i)return!1;let o=!1,s=-1,c=Math.min(t.length,e+1+ZH);for(let n=e+1;n<c;n++){let e=t[n];if(e===`>`){s=n;break}if(e===`<`||e===`\\`||e===`
|
|
354
|
-
`||e===`\r`||e===``||e===``||e===``||e===``||e===``)return!1;(e===` `||e===` `)&&(o=!0)}return s===-1||!o?!1:t[s+1]===`)`}function $H(e,t,n,r){let i=qH(n,e);if(i>=n.length)return!1;let a=n[i],o=qH(r,e);return a>=(o<r.length?r[o]:t.length)?!1:t[a-1]===`/`}function eU(e){let t=[];for(let n of e.matchAll(/<\/?([A-Z][A-Za-z0-9.]*)/g)){let r=n.index;if(t.length>0){let[e,n]=t[t.length-1];if(r>e&&r<=n)continue}let i=r+n[0].length,a=!1,o=!1,s=!1,c=0,l=-1;for(;i<e.length;){let t=e[i];if(a)t===`'`?a=!1:t===`\\`&&i+1<e.length&&i++;else if(o)t===`"`?o=!1:t===`\\`&&i+1<e.length&&i++;else if(s)t==="`"?s=!1:t===`\\`&&i+1<e.length&&i++;else if(t===`'`)a=!0;else if(t===`"`)o=!0;else if(t==="`")s=!0;else if(t===`{`)c++;else if(t===`}`&&c>0)c--;else if(c===0&&t===`>`){l=i;break}i++}if(l!==-1){if(e.slice(r,l).includes(`
|
|
352
|
+
`)}:{name:`UnknownError`,message:String(e??`unknown`).slice(0,500)}}function CH(e,t,n,r){if(n>20)return dH(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`MAX_SPLIT_DEPTH exceeded`})),MH(e);if(r){if(xH(r))return fH(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`parse budget exhausted`,calls:r.calls})),MH(e);r.calls+=1}try{return t(e)}catch(i){let a=wH(i),o=SH(i);if(a===void 0){if(n===0){let n=jH(e,t,i,r);if(n)return n}return dH(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:o.message,error:o})),MH(e)}uH(),console.warn(JSON.stringify({event:`mdx-block-fallback`,offset:a,reason:o.message,error:o}));try{let i=kH(e,a),s=e.slice(i.start,i.end),c=e.slice(0,i.start).replace(/\n+$/,``),l=e.slice(i.end).replace(/^\n+/,``),u=c.trim()?CH(c,t,n+1,r):{type:`doc`,content:[]},d=l.trim()?CH(yH(c)+l,t,n+1,r):{type:`doc`,content:[]},f={type:`rawMdxFallback`,attrs:{reason:o.message,originalSpan:{start:i.start,end:i.end}},content:s?[{type:`text`,text:s}]:[]},p=[...u.content??[],f,...d.content??[]];return{type:`doc`,content:p.length>0?p:[{type:`paragraph`,content:[]}]}}catch(t){dH();let n=SH(t);return console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`Recovery failed: ${n.message}`,recoveryPath:`block-split-then-rejoin`,error:n,originalError:o})),MH(e)}}}function wH(e){if(!e||typeof e!=`object`)return;let t=e;if(t.place&&typeof t.place.offset==`number`)return t.place.offset;if(t.place?.start&&typeof t.place.start.offset==`number`)return t.place.start.offset;if(t.position&&typeof t.position.offset==`number`)return t.position.offset;if(t.position?.start&&typeof t.position.start.offset==`number`)return t.position.start.offset}function TH(e,t){let n=/\n\s*\n/g,r=null;for(let i of e.matchAll(n)){if(i.index>=t)break;r=i.index+i[0].length}return r}function EH(e,t){for(let n of e.matchAll(/\n\s*\n/g))if(n.index>=t)return n.index;return null}function DH(e,t){let n=[];for(let r of e.matchAll(/<(\/?)([A-Z][A-Za-z0-9.]*)/g)){let i=r.index;if(hH(i,t))continue;let a=r[1]===`/`,o=r[2],s=i+r[0].length,c=Math.min(e.length,s+32768),l=!1,u=0,d=-1,f=!1;for(let t=s;t<c;t++){let n=e[t];if(l){n===`"`&&(l=!1),n===`\\`&&t+1<c&&t++;continue}if(n===`"`){l=!0;continue}if(n===`{`){u++;continue}if(n===`}`&&u>0){u--;continue}if(!(u>0)&&n===`>`){d=t,t>0&&e[t-1]===`/`&&(f=!0);break}}if(d===-1)continue;let p=d+1;a?n.push({kind:`close`,name:o,start:i,end:p}):f?n.push({kind:`self-close`,name:o,start:i,end:p}):n.push({kind:`open`,name:o,start:i,end:p})}return n}function OH(e){let t=DH(e,mH(e)),n=[],r=[];for(let i of t){if(i.kind===`self-close`)continue;if(i.kind===`open`){n.push(i);continue}let t=-1;for(let e=n.length-1;e>=0;e--)if(n[e].name===i.name){t=e;break}if(t!==-1){for(let a=n.length-1;a>t;a--){let t=n[a],o=EH(e,t.start)??e.length;r.push({start:t.start,end:Math.min(i.start,o),source:`unmatched`})}r.push({start:n[t].start,end:i.end,source:`pair`}),n.length=t}}for(let t of n){let n=EH(e,t.start)??e.length;r.push({start:t.start,end:Math.min(e.length,n),source:`unmatched`})}return r}function kH(e,t){let n=OH(e),r=null;for(let e of n)e.start<=t&&t<=e.end&&(!r||e.end-e.start<r.end-r.start)&&(r=e);return r?{start:r.start,end:r.end}:{start:TH(e,t)??0,end:EH(e,t)??e.length}}function AH(e){let t=mH(e),n=/\n[ \t]*\n/g,r=[0];for(let i of e.matchAll(n)){let e=i.index;hH(e,t)||r.push(e+i[0].length)}r.push(e.length);let i=[];for(let t=0;t<r.length-1;t++){let n=r[t],a=r[t+1];if(a<=n)continue;let o=e.slice(n,a);o.trim()&&i.push({src:o,start:n,end:a})}return i}function jH(e,t,n,r){let i=AH(e);if(i.length<2)return null;let a=[],o=!1,s=``;for(let e of i){if(r&&xH(r))break;r&&(r.calls+=1);let i=s+e.src;try{let n=t(i).content??[];s+=yH(e.src);let r=n.filter(e=>e.type!==`paragraph`||Array.isArray(e.content)&&e.content.length>0);if(r.length===0&&n.length>0){o=!0;continue}a.push(...r),o=!0}catch(t){uH();let r=t?.message?.slice(0,200)??`unknown block error`,i=n?.message?.slice(0,160)??`unknown`;console.warn(JSON.stringify({event:`mdx-block-fallback`,offset:e.start,reason:`Per-block recovery after position-less error: ${i}`,blockError:r,blockErrorName:t?.name})),a.push({type:`rawMdxFallback`,attrs:{reason:r,originalSpan:{start:e.start,end:e.end}},content:[{type:`text`,text:e.src}]})}}return o?{type:`doc`,content:a.length>0?a:[{type:`paragraph`,content:[]}]}:null}function MH(e){return{type:`doc`,content:[{type:`paragraph`,content:[{type:`text`,text:e}]}]}}function NH(e){if(typeof e!=`object`||!e||!Object.hasOwn(e,`escapedChars`))return{kind:`absent`};let t=e.escapedChars;return Array.isArray(t)&&t.every(e=>{if(typeof e!=`object`||!e)return!1;let t=e.offset;return typeof t==`number`&&Number.isInteger(t)&&t>=0&&typeof e.char==`string`})?{kind:`valid`,data:{escapedChars:t}}:{kind:`malformed`}}function PH(e){return NH(e).kind===`valid`}const FH=[[``,``],[``,``],[``,``],[``,``],[``,``]],IH=/[\uE000-\uE004]/,LH=/[\uE005-\uE009]/,RH=FH.map(([e,t])=>({from:e,to:t})),zH=/<([a-zA-Z][a-zA-Z0-9+.-]*:[^\s<>]+)>/g,BH=/<!--[\s\S]*?-->/g,VH=/<\/([a-z][a-z0-9]*)\s*>/g,HH=/<([a-z][a-z0-9]*)(\s[^>]*)?\/?>/g,UH=new Set([`img`,`video`,`audio`]),WH=new Set([`mark`,`u`,`ins`]);function GH(e,t,n,r){let i=0,a=0,o=`<${t}`;for(;a<n;){let t=e.indexOf(o,a);if(t===-1||t>=n)break;a=t+o.length;let s=e[t+o.length];if(s!==void 0&&s!==`>`&&s!==`/`&&!/\s/.test(s)||hH(t,r))continue;let c=e.indexOf(`>`,t);(c===-1||e[c-1]!==`/`)&&i++}return i}const KH=/<\/([A-Z][A-Za-z0-9.]*)>/g;function qH(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>>1;e[i]<t?n=i+1:r=i}return n}function JH(e){let t=new Map,n=new RegExp(KH.source,`g`),r=n.exec(e);for(;r!==null;){let i=t.get(r[1]);i?i.push(r.index):t.set(r[1],[r.index]),r=n.exec(e)}return t}function YH(e){let t=[],n=/\n\s*\n/g,r=n.exec(e);for(;r!==null;)t.push(r.index),r=n.exec(e);return t}function XH(e){let t=[],n=e.indexOf(`>`);for(;n!==-1;)t.push(n),n=e.indexOf(`>`,n+1);return t}function ZH(e){let t=[],n=e.indexOf(`
|
|
355
353
|
|
|
356
|
-
`)
|
|
354
|
+
`);for(;n!==-1;)t.push(n),n=e.indexOf(`
|
|
355
|
+
|
|
356
|
+
`,n+1);return t}const QH=1024;function $H(e,t){if(t[e-1]!==`(`||t[e-2]!==`]`)return!1;let n=e-2,r=0;for(let e=n-1;e>=0&&t[e]===`\\`;e--)r++;if(r%2==1)return!1;let i=!1,a=Math.max(0,n-QH);for(let e=n-1;e>=a;e--){let n=t[e];if(n===`
|
|
357
|
+
`||n===`\r`||n==="`")return!1;if(n!==`[`&&n!==`]`)continue;let r=0;for(let n=e-1;n>=0&&t[n]===`\\`;n--)r++;if(r%2!=1){if(n===`]`||t[e+1]===`^`||t[e-1]===`]`)return!1;i=!0;break}}if(!i)return!1;let o=!1,s=-1,c=Math.min(t.length,e+1+QH);for(let n=e+1;n<c;n++){let e=t[n];if(e===`>`){s=n;break}if(e===`<`||e===`\\`||e===`
|
|
358
|
+
`||e===`\r`||e===``||e===``||e===``||e===``||e===``)return!1;(e===` `||e===` `)&&(o=!0)}return s===-1||!o?!1:t[s+1]===`)`}function eU(e,t,n,r){let i=qH(n,e);if(i>=n.length)return!1;let a=n[i],o=qH(r,e);return a>=(o<r.length?r[o]:t.length)?!1:t[a-1]===`/`}function tU(e){let t=[],n=ZH(e);for(let r of e.matchAll(/<\/?([A-Z][A-Za-z0-9.]*)/g)){let i=r.index;if(t.length>0){let[e,n]=t[t.length-1];if(i>e&&i<=n)continue}let a=i+r[0].length,o=qH(n,i),s=o<n.length?n[o]:e.length,c=!1,l=!1,u=!1,d=0,f=-1;for(;a<s;){let t=e[a];if(c)t===`'`?c=!1:t===`\\`&&a+1<e.length&&a++;else if(l)t===`"`?l=!1:t===`\\`&&a+1<e.length&&a++;else if(u)t==="`"?u=!1:t===`\\`&&a+1<e.length&&a++;else if(t===`'`)c=!0;else if(t===`"`)l=!0;else if(t==="`")u=!0;else if(t===`{`)d++;else if(t===`}`&&d>0)d--;else if(d===0&&t===`>`){f=a;break}a++}f!==-1&&t.push([i,f])}return t}function nU(e,t){if(t.length===0)return!1;let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>>1,[a,o]=t[i];if(e<=a)r=i-1;else if(e>o)n=i+1;else return!0}return!1}function rU(e,t,n){let r=Math.min(t.length,n),i=!1,a=0;for(let n=e;n<r;n++){let e=t[n];if(i){e===`"`&&(i=!1),e===`\\`&&n+1<r&&n++;continue}if(e===`"`){i=!0;continue}if(e===`{`){a++;continue}if(e===`}`&&a>0){a--;continue}if(!(a>0)&&e===`>`)return n>0&&t[n-1]===`/`}return!1}function iU(e,t){let n=aU(e,t.escapeAware),r=new Set(n),i=[],a=[];return oU(e,t.escapeAware,{onFlush:()=>{a.length=0},onBrace:(e,t)=>{if(!r.has(e)){if(t===`{`)a.push(e);else if(a.length>0){let t=a.pop();a.length===0&&i.push({start:t,end:e+1})}}}}),{matched:i,unmatched:n}}function aU(e,t){let n=[],r=[];return oU(e,t,{onFlush:()=>{n.push(...r),r.length=0},onBrace:(e,t)=>{t===`{`?r.push(e):r.length>0&&r.pop()}}),n.push(...r),n}function oU(e,t,n){for(let r=0;r<e.length;r++){if(e[r]===`
|
|
357
359
|
`){let t=e[r+1];if(t===`
|
|
358
360
|
`||t===`>`){if(n.onFlush(),t===`
|
|
359
361
|
`)for(;e[r+1]===`
|
|
360
|
-
`;)r++;continue}}let i=e[r];if(i===`{`||i===`}`){if(t){let t=0;for(let n=r-1;n>=0&&e[n]===`\\`;n--)t++;if(t%2==1)continue}n.onBrace(r,i)}}}function
|
|
361
|
-
`,t),r=(n===-1?e.slice(t):e.slice(t,n)).match(
|
|
362
|
-
`?
|
|
363
|
-
`?(n+=1,r=1):r+=1;return{line:n,column:r,offset:t}}function
|
|
362
|
+
`;)r++;continue}}let i=e[r];if(i===`{`||i===`}`){if(t){let t=0;for(let n=r-1;n>=0&&e[n]===`\\`;n--)t++;if(t%2==1)continue}n.onBrace(r,i)}}}function sU(e){let t=e;if(IH.test(t))for(let[e,n]of FH)t=t.replaceAll(e,n);t=t.replace(BH,e=>e.replace(/</g,``).replace(/>/g,``)),t=t.replace(zH,(e,t)=>`${t.replaceAll(`:`,``).replaceAll(`@`,``)}`);let n=new Map,r=[...mH(t),..._H(t)];t=t.replace(VH,(e,i,a)=>{if(WH.has(i)){let o=n.get(i)??0;if(o<GH(t,i,a,r))return n.set(i,o+1),e}return e.replace(/</g,``).replace(/>/g,``)}),t=t.replace(HH,(e,t)=>UH.has(t)&&e.endsWith(`/>`)||WH.has(t)?e:t[0]===t[0].toLowerCase()&&t[0]!==t[0].toUpperCase()?e.replace(/</g,``).replace(/>/g,``):e),t=t.replace(/<>/g,``);let i=JH(t),a=YH(t),o=XH(t),s=tU(t);t=t.replace(/</g,(e,n)=>{if($H(n,t)||nU(n,s))return e;let r=t.slice(n,n+256);if(r[1]===`/`)return/^<\/[a-zA-Z][a-zA-Z0-9.]*[ \t]*>/.test(r)?e:``;let c=/^<([a-z][a-z0-9]*)/.exec(r);if(c&&UH.has(c[1])&&eU(n,t,o,a))return e;let l=/^<([a-z][a-z0-9]*)([\s/>])/.exec(r);if(l&&WH.has(l[1])){let i=l[1];return r.startsWith(`<${i}/>`)||t.indexOf(`</${i}>`,n)!==-1?e:``}let u=/^<([A-Z][a-zA-Z0-9.]*)[\s/>]/.exec(r);if(!u)return``;let d=u[1],f=qH(a,n),p=f<a.length?a[f]:t.length;if(rU(n+1+d.length,t,p))return e;let m=i.get(d);return m&&qH(m,n)<m.length?e:``});{let{unmatched:e}=iU(t,{escapeAware:!0});if(e.length>0){let n=t.split(``);for(let t of e)n[t]=``;t=n.join(``)}}return t}function cU(e){return IH.test(e)||LH.test(e)}function lU(){return e=>{EE(e,e=>{let t=e;typeof t.value==`string`&&cU(t.value)&&(t.value=uU(t.value)),typeof t.url==`string`&&cU(t.url)&&(t.url=uU(t.url)),typeof t.title==`string`&&cU(t.title)&&(t.title=uU(t.title)),typeof t.alt==`string`&&cU(t.alt)&&(t.alt=uU(t.alt)),typeof t.lang==`string`&&cU(t.lang)&&(t.lang=uU(t.lang)),typeof t.meta==`string`&&cU(t.meta)&&(t.meta=uU(t.meta))})}}function uU(e){let t=e.replaceAll(``,`<`).replaceAll(``,`>`).replaceAll(``,`:`).replaceAll(``,`@`).replaceAll(``,`{`);if(LH.test(t))for(let[e,n]of FH)t=t.replaceAll(n,e);return t}const dU=[{from:`&`,to:``},{from:`;`,to:``}],fU=/&(?:[A-Za-z][A-Za-z0-9]*|#[0-9]+|#[xX][0-9A-Fa-f]+);/g;function pU(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;r--)n++;return n}function mU(e,t,n){return t.lastIndex=0,e.replace(t,(t,r)=>typeof r!=`number`||pU(e,r)%2==1?t:n(t))}function hU(e){return mU(e,fU,e=>`${e.slice(1,-1)}`)}const gU=RegExp(`([^]+)`,`g`);function _U(e){if(!e.includes(``))return{value:e,spans:[]};let t=[],n=``,r=0;gU.lastIndex=0;let i=gU.exec(e);for(;i!==null;){i.index>r&&(n+=e.slice(r,i.index));let a=`&${i[1]??``};`;t.push({offset:n.length,length:a.length,raw:a}),n+=a,r=i.index+i[0].length,i=gU.exec(e)}return r<e.length&&(n+=e.slice(r)),{value:n,spans:t}}function vU(){return e=>{EE(e,e=>{let t=e;if(typeof t.value==`string`&&t.value.includes(``)){let{value:n,spans:r}=_U(t.value);if(t.value=n,e.type===`text`&&r.length>0){let t=e;t.data??={},t.data.entityRefSpans=r}}for(let e of[`url`,`title`,`alt`,`lang`,`meta`]){let n=t[e];typeof n==`string`&&n.includes(``)&&(t[e]=_U(n).value)}})}}const yU=[{from:`\\`,to:``}],bU=/\\</g;function xU(e){return mU(e,bU,e=>`${e.slice(1)}`)}function SU(){return e=>{EE(e,e=>{let t=e;if(typeof t.value==`string`&&t.value.includes(``)){if(e.type===`text`){let t=e.value,n=Array(t.length+1),r=[],i=``;for(let e=0;e<t.length;e+=1)n[e]=i.length,t[e]===``?r.push({offset:i.length,char:t[e+1]??``}):i+=t[e];n[t.length]=i.length;let a=[...(e.data?.escapedChars??[]).map(e=>({...e,offset:n[e.offset]??e.offset})),...r].map(e=>({...e})).sort((e,t)=>e.offset-t.offset||e.char.localeCompare(t.char)).filter((e,t,n)=>t===0||e.offset!==n[t-1]?.offset||e.char!==n[t-1]?.char),o=e.data?.entityRefSpans?.map(e=>{let t=n[e.offset]??e.offset,r=n[e.offset+e.length]??e.offset+e.length;return{...e,offset:t,length:r-t}});e.value=i,e.data??={},e.data.escapedChars=a,o&&(e.data.entityRefSpans=o)}else t.value=t.value.split(``).join(``)}for(let e of[`url`,`title`,`alt`]){let n=t[e];typeof n==`string`&&n.includes(``)&&(t[e]=n.split(``).join(``))}})}}const CU=new Set([`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`]),wU={note:`note`,tip:`tip`,important:`important`,warning:`warning`,caution:`caution`,abstract:`abstract`,info:`info`,todo:`todo`,success:`success`,question:`question`,failure:`failure`,danger:`danger`,bug:`bug`,example:`example`,quote:`quote`,summary:`abstract`,tldr:`abstract`,check:`success`,done:`success`,help:`question`,faq:`question`,fail:`failure`,missing:`failure`,error:`danger`,cite:`quote`,idea:`tip`,hint:`tip`,warn:`warning`,attention:`warning`},TU=`ok-alert`,EU=RegExp(`(?:^|\\s)${TU}-(\\w+)(?:\\s|$)`),DU=/^>\s*\[!(\w+)\]([+-])?(?:\s+(.*?))?\s*$/i;function OU(e,t){if(t<0||t>=e.length)return null;let n=e.indexOf(`
|
|
363
|
+
`,t),r=(n===-1?e.slice(t):e.slice(t,n)).match(DU);return r?{rawType:r[1],foldableMarker:r[2]===`+`||r[2]===`-`?r[2]:null,title:r[3]?.trim()||null}:null}function kU(e){if(e.data?.hName!==`div`)return null;let t=e.data?.hProperties?.class;if(typeof t!=`string`)return null;let n=t.match(EU);return n?n[1].toLowerCase():null}function AU(e){let t=e.toLowerCase();return wU[t]??null}function jU(e,t,n,r,i=null){let a=[{type:`mdxJsxAttribute`,name:`type`,value:t}];n&&a.push({type:`mdxJsxAttribute`,name:`title`,value:n}),i&&a.push({type:`mdxJsxAttribute`,name:`data-authored-as`,value:i}),r!==null&&(a.push({type:`mdxJsxAttribute`,name:`collapsible`,value:null}),r===`+`?a.push({type:`mdxJsxAttribute`,name:`defaultOpen`,value:null}):a.push({type:`mdxJsxAttribute`,name:`defaultOpen`,value:{type:`mdxJsxAttributeValueExpression`,value:`false`}}));let o=e.children.slice(1),s=e.position?.start.line;return{type:`mdxJsxFlowElement`,name:`GFMCallout`,attributes:a,children:n&&o.length>0&&s!==void 0&&MU(o[0],s)?o.slice(1):o,position:e.position}}function MU(e,t){if(!e||typeof e!=`object`)return!1;let n=e;if(n.type!==`paragraph`)return!1;let r=n.position?.start?.line,i=n.position?.end?.line;return r===t&&i===t}function NU(e){if(!e||typeof e!=`object`||e.type!==`paragraph`)return!1;let t=e.data?.hProperties?.class;return typeof t==`string`&&t.includes(`${TU}-title`)}function PU(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;EE(e,`blockquote`,(e,t,r)=>{if(r===void 0||typeof t!=`number`)return;let i=kU(e);if(!i)return;let a=AU(i),o=null,s=null;e.position?.start?.offset!==void 0&&(s=OU(n,e.position.start.offset),s&&(o=s.title,a||=AU(s.rawType)));let c=a??`note`,l=s&&CU.has(c)?s.foldableMarker:null,u=(()=>{if(e.position?.start?.offset!==void 0){let t=OU(n,e.position.start.offset);if(t?.rawType)return t.rawType}return i})(),d=u.toLowerCase()===c?null:u;if(!NU(e.children[0]))return;let f=jU(e,c,o,l,d);r.children[t]=f})}}const FU={markers:`*`,classPrefix:TU,matchCaseSensitive:!1,icons:new Proxy({},{get:()=>`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"></svg>`})};function IU(e,t,n){return e[t]===`\\`&&t+1<e.length&&e[t+1]===n}function LU(e,t,n,r){let i=t,a=0;for(;a<r&&i<e.length;){let t=a>0&&n[a-1]===`
|
|
364
|
+
`?zU(e,i,n[a]):null;t!==null&&(i=t),i+=IU(e,i,n[a])?2:1,a+=1}return i}function RU(e,t,n){return e[t]===n||IU(e,t,n)}function zU(e,t,n){let r=t,i=!1;for(;;){let t=r;for(;r<e.length&&(e[r]===` `||e[r]===` `);)r+=1;if(e[r]===`>`){r+=1,(e[r]===` `||e[r]===` `)&&(r+=1),i=!0;continue}r>t&&(i=!0);break}return i&&RU(e,r,n)?r:null}function BU(e){return PH(e.data)?new Set(e.data.escapedChars.map(e=>e.offset)):null}function VU(e,t,n){return e.filter(e=>e.offset>=t&&e.offset<n).map(e=>({...e,offset:e.offset-t}))}function HU(e,t,n){return e.filter(e=>e.offset>=t&&e.offset+e.length<=n).map(e=>({...e,offset:e.offset-t}))}function UU(e,t,n,r){let i={type:`text`,value:t.value.slice(n,r)},a=qU(e,t,n,r);a&&(i.position=a);let o;if(PH(t.data)&&(o={escapedChars:VU(t.data.escapedChars,n,r)}),t.data?.entityRefSpans?.length){let e=HU(t.data.entityRefSpans,n,r);e.length>0&&(o={...o,entityRefSpans:e})}return o&&(i.data=o),i}function WU(e,t,n){if(e===null||e.size===0)return!1;for(let r=0;r<n;r++)if(e.has(t+r))return!0;return!1}function GU(e,t){let n=1,r=1;for(let i=0;i<t&&i<e.length;i++)e[i]===`
|
|
365
|
+
`?(n+=1,r=1):r+=1;return{line:n,column:r,offset:t}}function KU(e,t,n){return{start:GU(e,t),end:GU(e,n)}}function qU(e,t,n,r){if(!e||!t.position||typeof t.position.start?.offset!=`number`)return;let i=t.position.start.offset;return KU(e,LU(e,i,t.value,n),LU(e,i,t.value,r))}const JU=/(?<!%)%%([^\n]*?[^\n%])%%(?!%)/g,YU=/<!--([\s\S]*?)-->/g;function XU(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;QU(e,n),EE(e,`text`,(e,t,r)=>{if(r===void 0||t==null)return;let i=e.value;if(i.indexOf(`%%`)===-1&&i.indexOf(`<!--`)===-1)return;let a=ZU(i,BU(e));if(a.length===0)return;let o=[],s=0;for(let t of a){t.start>s&&o.push(UU(n,e,s,t.start));let r=t.sourceForm===`html`?4:2,a=t.start+r,c=t.sourceForm===`html`?a+i.slice(a,t.end-3).indexOf(t.body):a,l={type:`comment`,children:[UU(n,e,c,c+t.body.length)],data:{sourceForm:t.sourceForm}},u=qU(n,e,t.start,t.end);u&&(l.position=u),o.push(l),s=t.end}return s<i.length&&o.push(UU(n,e,s,i.length)),r.children.splice(t,1,...o),[wE,t+o.length]}),cW(e,n)}}function ZU(e,t){let n=[];JU.lastIndex=0;let r;for(;(r=JU.exec(e))!==null;){if(WU(t,r.index,2)||WU(t,r.index+r[0].length-2,2)){JU.lastIndex=r.index+1;continue}r[1].trim().length!==0&&n.push({start:r.index,end:r.index+r[0].length,body:r[1],sourceForm:`percent`})}YU.lastIndex=0;let i;for(;(i=YU.exec(e))!==null;){if(WU(t,i.index,4)||WU(t,i.index+i[0].length-3,3)){YU.lastIndex=i.index+1;continue}let e=i[1].trim();e!==``&&n.push({start:i.index,end:i.index+i[0].length,body:e,sourceForm:`html`})}n.sort((e,t)=>e.start-t.start);let a=[],o=-1;for(let e of n)e.start<o||(a.push(e),o=e.end);return a}function QU(e,t){let n=e.children,r=0;for(;r<n.length;){let e=n[r];if(e.type===`paragraph`){let i=tW(e);if(i!==null){let t=e.children[0],a,o=()=>(a===void 0&&(a=BU(t)),a),s=nW(i);if(s!==null&&!WU(o(),0,2)&&!WU(o(),i.length-2,2)){let e={type:`commentBlock`,children:[{type:`paragraph`,children:[{type:`text`,value:s}]}],data:{sourceForm:`percent`,sourceLayout:`block`}};n.splice(r,1,e),r+=1;continue}let c=rW(i);if(c!==null&&!WU(o(),i.length-i.trimStart().length,4)&&!WU(o(),i.trimEnd().length-3,3)){let e={type:`commentBlock`,children:[{type:`paragraph`,children:[{type:`text`,value:c}]}],data:{sourceForm:`html`,sourceLayout:`inline`}};n.splice(r,1,e),r+=1;continue}}let a=iW(e,t);if(a!==null&&!eW(e,4,3)){let e={type:`commentBlock`,children:[a],data:{sourceForm:`html`,sourceLayout:`inline`}};n.splice(r,1,e),r+=1;continue}let o=aW(e,t);if(o!==null&&!eW(e,2,2)){let e={type:`commentBlock`,children:[o],data:{sourceForm:`percent`,sourceLayout:`inline`}};n.splice(r,1,e),r+=1;continue}}if(e.type===`paragraph`&&sW(e)){let e=r+1;for(;e<n.length;){let t=n[e];if(t.type===`paragraph`&&sW(t))break;e+=1}if(e<n.length&&e>r+1){let t={type:`commentBlock`,children:n.slice(r+1,e),data:{sourceForm:`percent`,sourceLayout:`block`}};n.splice(r,e-r+1,t),r+=1;continue}}r+=1}}function $U(e,t,n){return WU(BU(e),t,n)}function eW(e,t,n){let r=e.children[0],i=e.children[e.children.length-1];if(r.type!==`text`||i.type!==`text`)return!1;let a=r.value.length-r.value.trimStart().length,o=i.value.trimEnd().length-n,s=BU(r);return WU(s,a,t)?!0:WU(i===r?s:BU(i),o,n)}function tW(e){if(e.children.length!==1)return null;let t=e.children[0];return t.type===`text`?t.value:null}function nW(e){let t=e.match(/^%%\n((?:.|\n(?!\n))+?)\n%%$/);return t===null?null:t[1]}function rW(e){let t=e.trim();if(!t.startsWith(`<!--`)||!t.endsWith(`-->`))return null;let n=t.slice(4,-3);if(n.includes(`-->`)||n.includes(`<!--`))return null;let r=n.trim();return r===``?null:r}function iW(e,t){if(e.children.length<2)return null;let n=e.children[0],r=e.children[e.children.length-1];if(n.type!==`text`||r.type!==`text`)return null;let i=n.value.trimStart();if(!i.startsWith(`<!--`))return null;let a=r.value.trimEnd();if(!a.endsWith(`-->`))return null;for(let t=0;t<e.children.length;t++){let n=e.children[t];if(n.type!==`text`)continue;let r=n.value;if(t===0){if(oW(r,`<!--`)>1||oW(r,`-->`)>0)return null}else if(t===e.children.length-1){if(oW(r,`<!--`)>0||oW(r,`-->`)>1)return null}else if(r.includes(`<!--`)||r.includes(`-->`))return null}let o=n.value.length-i.length+4;n.value[o]===` `&&(o+=1);let s=a.length-3;r.value[s-1]===` `&&--s;let c=[];o<n.value.length&&c.push(UU(t,n,o,n.value.length));for(let t=1;t<e.children.length-1;t++)c.push(e.children[t]);return s>0&&c.push(UU(t,r,0,s)),c.length===0?null:{type:`paragraph`,children:c}}function aW(e,t){if(e.children.length<2)return null;let n=e.children[0],r=e.children[e.children.length-1];if(n.type!==`text`||r.type!==`text`)return null;let i=n.value.trimStart();if(!i.startsWith(`%%`)||i.startsWith(`%%%`))return null;let a=r.value.trimEnd();if(!a.endsWith(`%%`)||a.endsWith(`%%%`))return null;let o=n.value.length-i.length+2;n.value[o]===` `&&(o+=1);let s=a.length-2;r.value[s-1]===` `&&--s;let c=n.value.slice(o),l=r.value.slice(0,s);if(c.indexOf(`%%`)!==-1||l.indexOf(`%%`)!==-1)return null;for(let t=1;t<e.children.length-1;t++){let n=e.children[t];if(n.type===`text`&&n.value.indexOf(`%%`)!==-1)return null}if(!(e.children.slice(1,-1).some(e=>e.type!==`text`||e.value.trim().length>0)||c.trim().length>0||l.trim().length>0))return null;let u=[];c.length>0&&u.push(UU(t,n,o,n.value.length));for(let t=1;t<e.children.length-1;t++)u.push(e.children[t]);return l.length>0&&u.push(UU(t,r,0,s)),u.length===0?null:{type:`paragraph`,children:u}}function oW(e,t){if(!t)return 0;let n=0,r=0;for(;;){let i=e.indexOf(t,r);if(i===-1)break;n+=1,r=i+t.length}return n}function sW(e){let t=tW(e);return t===null||t.trim()!==`%%`?!1:!$U(e.children[0],t.indexOf(`%%`),2)}function cW(e,t){(t.indexOf(`%%`)!==-1||t.indexOf(`<!--`)!==-1)&&EE(e,e=>{if(!lW.has(e.type))return;let n=e.children;if(!(n===void 0||n.length<2)){for(let e of uW)if(fW(n,t,e))return}})}const lW=new Set([`paragraph`,`heading`,`tableCell`]),uW=[{sourceForm:`html`,open:`<!--`,close:`-->`},{sourceForm:`percent`,open:`%%`,close:`%%`}];function dW(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r];if(i.type!==`text`)continue;let a=0;for(;;){let e=i.value.indexOf(t,a);if(e===-1)break;n.push({index:r,offset:e}),a=e+t.length}}return n}function fW(e,t,n){let r,i;if(n.sourceForm===`percent`){let t=dW(e,`%%`);if(t.length!==2)return!1;[r,i]=t}else{let t=dW(e,`<!--`),n=dW(e,`-->`);if(t.length!==1||n.length!==1)return!1;r=t[0],i=n[0]}if(r.index>=i.index)return!1;let a=e[r.index],o=e[i.index];if(n.sourceForm===`percent`&&(a.value[r.offset-1]===`%`||a.value[r.offset+2]===`%`||o.value[i.offset-1]===`%`||o.value[i.offset+2]===`%`)||mW(e,n,r,i)||$U(a,r.offset,n.open.length)||$U(o,i.offset,n.close.length))return!1;for(let t=r.index+1;t<i.index;t++)if(gW(e[t]))return!1;if(r.offset===0&&gW(e[r.index-1])||i.offset+n.close.length===o.value.length&&gW(e[i.index+1]))return!1;let s=pW(e,n,r,i,t);if(s===null)return!1;let c=[];a.value.slice(0,r.offset).length>0&&c.push(UU(t,a,0,r.offset));let l={type:`comment`,children:s,data:{sourceForm:n.sourceForm}},u=qU(t,a,r.offset,a.value.length),d=qU(t,o,0,i.offset+n.close.length);u&&d&&(l.position={start:u.start,end:d.end}),c.push(l);let f=i.offset+n.close.length;return o.value.slice(f).length>0&&c.push(UU(t,o,f,o.value.length)),e.splice(r.index,i.index-r.index+1,...c),!0}function pW(e,t,n,r,i){let a=e[n.index],o=e[r.index],s=n.offset+t.open.length,c=a.value.length,l=r.offset;if(t.sourceForm===`html`){for(;s<c&&/\s/.test(a.value[s]);)s+=1;for(;l>0&&/\s/.test(o.value[l-1]);)--l}let u=[];s<c&&u.push(UU(i,a,s,c));for(let t=n.index+1;t<r.index;t++)u.push(e[t]);return 0<l&&u.push(UU(i,o,0,l)),u.length===0||!u.some(e=>e.type!==`text`||e.value.trim().length>0)||!u.some(e=>e.type===`text`)?null:u}function mW(e,t,n,r){let i=e[n.index],a=e[r.index];if(i.value.indexOf(`
|
|
364
366
|
`,n.offset+t.open.length)!==-1||a.value.lastIndexOf(`
|
|
365
|
-
`,r.offset)!==-1)return!0;for(let t=n.index+1;t<r.index;t++)if(
|
|
366
|
-
`)!==-1:Array.isArray(t?.children)&&t.children.some(
|
|
367
|
-
`;)r--;let i=e.slice(r,n===t-1?n:n+1);if(i.trim().length===0){n=r-2;continue}return _W.test(i)}return!1}function yW(e){if(!e.includes(`</`))return e;let t=mH(e),n=!1,r=e.replace(gW,(r,i,a,o,s)=>hH(s,t)||!vW(e,s)?r:(n=!0,`${a}${o}`));return n?r:e}const bW=/^<details(\s[^>]*)?>\s*<summary>([\s\S]*?)<\/summary>([\s\S]*?)<\/details>\s*$/,xW=/^<details(\s[^>]*)?>(?:\s*<summary>([\s\S]*?)<\/summary>)?[\s\S]*$/,SW=/^\s*<\/details>\s*$/;function CW(e){let t=!1,n=null,r=null;if(!e)return{defaultOpen:t,name:n,id:r};let i=/(\w+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'<>]+)))?/g,a=i.exec(e);for(;a!==null;){let o=a[1].toLowerCase(),s=a[2]??a[3]??a[4]??null;o===`open`?t=!0:o===`name`?n=s:o===`id`&&(r=s),a=i.exec(e)}return{defaultOpen:t,name:n,id:r}}function wW(e){let t=[];return e.title!==null&&t.push({type:`mdxJsxAttribute`,name:`title`,value:e.title}),e.defaultOpen&&t.push({type:`mdxJsxAttribute`,name:`defaultOpen`,value:null}),e.name!==null&&t.push({type:`mdxJsxAttribute`,name:`name`,value:e.name}),e.id!==null&&t.push({type:`mdxJsxAttribute`,name:`id`,value:e.id}),t}function TW(e){if(e.type!==`paragraph`)return!1;let t=e.children;return t.length===1&&t[0].type===`text`}function EW(e){return e.children[0].value??``}function DW(e){if(!TW(e))return null;let t=EW(e).match(bW);if(!t)return null;let{defaultOpen:n,name:r,id:i}=CW(t[1]),a=t[2].trim()||null,o=t[3].trim(),s=o?[{type:`paragraph`,children:[{type:`text`,value:o}]}]:[];return{type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:wW({title:a,defaultOpen:n,name:r,id:i}),children:s,position:e.position}}function OW(e,t){let n=e[t];if(!TW(n))return null;let r=EW(n);if(!r.startsWith(`<details`)||r.includes(`</details>`))return null;let i=r.match(xW);if(!i)return null;let{defaultOpen:a,name:o,id:s}=CW(i[1]),c=i[2]?.trim()||null;for(let n=t+1;n<e.length;n++){let t=e[n];if(!TW(t))continue;let r=EW(t);if(SW.test(r))return{closerIdx:n,title:c,defaultOpen:a,name:o,id:s};if(r.includes(`</details>`))return null}return null}function kW(e){let t=e.children,n=0;for(;n<t.length;){let e=t[n];if(TW(e)){let r=DW(e);if(r){t[n]=r,n++;continue}let i=OW(t,n);if(i){let r=e,a=t[i.closerIdx],o=n+1,s=i.closerIdx,c=t.slice(o,s),l=r.position,u=a.position,d={type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:wW(i),children:c,position:l&&u?{start:l.start,end:u.end}:void 0},f=i.closerIdx-n+1;t.splice(n,f,d),n++;continue}}n++}}function AW(){return e=>{EE(e,e=>{`children`in e&&Array.isArray(e.children)&&kW(e)})}}const jW=/^<(div|center)(\s[^>]*?)?\s*>$/i,MW=new Set([`center`,`left`,`right`,`justify`]);function NW(e){if(!e)return null;let t=e.match(/\balign\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'<>]+))/i);if(!t)return null;let n=(t[1]??t[2]??t[3]??``).toLowerCase();return MW.has(n)?n:null}function PW(e){if(e.type!==`paragraph`)return!1;let t=e.children;return t.length===1&&t[0].type===`text`}function FW(e){return e.children[0].value??``}function IW(e){if(!PW(e))return null;let t=FW(e).trim().match(jW);if(!t)return null;let n=t[1].toLowerCase(),r=t[2]??``;return{tag:n,align:NW(r)??(n===`center`?`center`:null),sourceAttrs:r}}function LW(e,t,n){let r=new RegExp(String.raw`^\s*</${n}>\s*$`,`i`);for(let i=t+1;i<e.length;i++){let t=e[i];if(!PW(t))continue;let a=FW(t);if(r.test(a))return i;let o=a.trimStart().toLowerCase();if(o.startsWith(`<div`)||o.startsWith(`<center`)||o.includes(`</${n}>`))return null}return null}function RW(e){let t=e.children,n=0;for(;n<t.length;){let e=IW(t[n]);if(e!==null){let r=LW(t,n,e.tag);if(r!==null){let i=t[n],a=t[r],o=t.slice(n+1,r),s=i.position,c=a.position,l={type:`mdxJsxFlowElement`,name:`HtmlAlignBlock`,attributes:[...e.align===null?[]:[{type:`mdxJsxAttribute`,name:`align`,value:e.align}],{type:`mdxJsxAttribute`,name:`tag`,value:e.tag},{type:`mdxJsxAttribute`,name:`sourceAttrs`,value:e.sourceAttrs}],children:o,position:s&&c?{start:s.start,end:c.end}:void 0};t.splice(n,r-n+1,l),n++;continue}}n++}}function zW(){return e=>{EE(e,e=>{`children`in e&&Array.isArray(e.children)&&RW(e)})}}const BW=` `;function VW(e){return e.type===`listItem`&&typeof e.checked==`boolean`}function HW(e){let t=e.children??[];if(t.length!==1)return!1;let n=t[0];return n?.type===`paragraph`&&(n.children?.length??0)===0}function UW(e){let t=e.children??[];if(t.length!==1)return!1;let n=t[0];if(n?.type!==`paragraph`||(n.children?.length??0)!==1)return!1;let r=n.children[0];if(r?.type!==`text`||r.value!==BW)return!1;let i=r.data?.entityRefSpans;if(!Array.isArray(i)||i.length!==1)return!1;let a=i[0];return a?.offset===0&&a.length===6&&a.raw===BW}function WW(e){EE(e,`listItem`,e=>{if(!VW(e)||!HW(e))return;let t=e.children[0];t.children=[{type:`text`,value:` `,data:{sourceRaw:BW}}]})}function GW(e){EE(e,`listItem`,e=>{!VW(e)||!UW(e)||(e.children[0].children=[])})}function KW(){return e=>{GW(e)}}const qW=57856,JW=63743,YW=/&(?:[A-Za-z][A-Za-z0-9]*|#[0-9]+|#[xX][0-9A-Fa-f]+);/g;function XW(e){return YW.lastIndex=0,e.replace(YW,e=>{let t=e.slice(1,-1);if(t.startsWith(`#`)){let e=t[1]===`x`||t[1]===`X`;return ED(t.slice(e?2:1),e?16:10)}let n=TD(t);return n===!1?e:n})}function ZW(e){let t=new Set,n=0;for(let r of e){let e=0;for(let i of r){let r=i.codePointAt(0);r!==void 0&&(r>=qW&&r<=JW&&t.add(r),r===qW?(e+=1,n=Math.max(n,e)):e=0)}}return{occupied:t,longestStartRun:n}}function QW(e){let{occupied:t,longestStartRun:n}=ZW([e,XW(e)]);for(let e=qW;e<=JW;e+=1)if(!t.has(e))return String.fromCharCode(e);return``.repeat(n+1)+``}function $W(e){return{exit:{characterEscapeValue(t){let n=this.stack.pop();n.value+=e+this.sliceSerialize(t),n.position&&(n.position.end={line:t.end.line,column:t.end.column,offset:t.end.offset})}},transforms:[t=>(EE(t,t=>{if(t.type===`text`){let n=[],r=``,i=0;for(;;){let a=t.value.indexOf(e,i);if(a===-1)break;r+=t.value.slice(i,a);let o=t.value.slice(a+e.length,a+e.length+1);n.push({offset:r.length,char:o}),i=a+e.length}r+=t.value.slice(i),t.value=r,t.data??={},t.data.escapedChars=n;return}let n=t;for(let[t,r]of Object.entries(n))typeof r==`string`&&(n[t]=r.replaceAll(e,``))}),t)]}}function eG(e,t){let n;return(r,i)=>{let a=t.data();a.fromMarkdownExtensions??=[];let o=a.fromMarkdownExtensions,s=$W(QW(r)),c=n,l=c?o.lastIndexOf(c):-1;l>=0?o.splice(l,1,s):o.push(s),n=s;try{return e(r,i)}finally{let e=o.lastIndexOf(s);e>=0&&(c&&l>=0?o.splice(e,1,c):o.splice(e,1)),n=c}}}const tG=function(){let e=this;e.parser=eG(e.parser,e)},nG=/(?<!=)==(?=\S)([^\n]*?[^\s=])==(?!=)/g;function rG(e){return e.type===`strong`||e.type===`emphasis`||e.type===`delete`||e.type===`inlineCode`}function iG(e){return e.type===`text`||e.type===`inlineCode`?e.value.length>0?e.value.charAt(0):null:`children`in e&&Array.isArray(e.children)&&e.children.length>0?iG(e.children[0]):null}function aG(e){if(e.type===`text`||e.type===`inlineCode`)return e.value.length>0?e.value.slice(-1):null;if(`children`in e&&Array.isArray(e.children)&&e.children.length>0){let t=e.children;return aG(t[t.length-1])}return null}function oG(e,t){let n=e.children,r=new Map,i=e=>{let t=r.get(e);if(t!==void 0)return t;let n=zU(e);return r.set(e,n),n},a=0;for(;a<n.length;){let e=n[a];if(e.type!==`text`){a++;continue}let r=e.value,o=-1;for(let t=0;t<=r.length-2;t++){if(r.charCodeAt(t)!==61||r.charCodeAt(t+1)!==61||t>0&&r.charCodeAt(t-1)===61||UU(i(e),t,2))continue;let s;if(t+2<r.length)s=r.charAt(t+2);else{let e=n[a+1];if(!e)continue;s=iG(e)}if(!(s===null||/\s/.test(s))){o=t;break}}if(o===-1){a++;continue}let s=-1,c=-1,l=!1;for(let t=o+3;t<=r.length-2;t++){if(r.charCodeAt(t)!==61||r.charCodeAt(t+1)!==61||UU(i(e),t,2))continue;let o=r.charAt(t-1);if(/[\s=]/.test(o))continue;let c;if(t+2<r.length)c=r.charAt(t+2);else{let e=n[a+1];c=e?e.type===`text`?e.value[0]??null:iG(e):null}if(c!==`=`){s=-2;break}}if(s===-2){a++;continue}for(let e=a+1;e<n.length;e++){let t=n[e];if(t.type===`text`){for(let r=0;r<=t.value.length-2;r++){if(t.value.charCodeAt(r)!==61||t.value.charCodeAt(r+1)!==61||UU(i(t),r,2))continue;let a;if(r>0)a=t.value.charAt(r-1);else{let t=n[e-1];a=aG(t)}if(a===null||/[\s=]/.test(a))continue;let o;if(r+2<t.value.length)o=t.value.charAt(r+2);else{let t=n[e+1];o=t?t.type===`text`?t.value[0]??null:iG(t):null}if(o!==`=`){s=e,c=r,l=!0;break}}if(s>=0)break}else if(!rG(t))break}if(s<0){a++;continue}let u=n[s],d=r.slice(0,o),f=r.slice(o+2),p=u.value.slice(0,c),m=u.value.slice(c+2),h=[];f.length>0&&h.push(HU(t,e,o+2,r.length));for(let e=a+1;e<s;e++)h.push(n[e]);if(p.length>0&&h.push(HU(t,u,0,c)),!l){a++;continue}let g={type:`mark`,children:h},_=[];d.length>0&&_.push(HU(t,e,0,o)),_.push(g),m.length>0&&_.push(HU(t,u,c+2,u.value.length)),n.splice(a,s-a+1,..._),a+=+(d.length>0)+1}}function sG(e,t){if(`children`in e&&Array.isArray(e.children)){oG(e,t);for(let n of e.children)sG(n,t)}}function cG(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;EE(e,`text`,(e,t,r)=>{if(r===void 0||t==null)return;let i=e.value;if(i.indexOf(`==`)===-1)return;let a=zU(e);nG.lastIndex=0;let o=[],s;for(;(s=nG.exec(i))!==null;){let e=s.index,t=e+s[0].length;if(UU(a,e,2)||UU(a,t-2,2)){nG.lastIndex=e+1;continue}o.push(s)}if(o.length===0)return;let c=[],l=0;for(let t of o){let r=t.index,i=r+t[0].length;r>l&&c.push(HU(n,e,l,r));let a={type:`mark`,children:[HU(n,e,r+2,i-2)]},o=KU(n,e,r,i);o&&(a.position=o),c.push(a),l=i}return l<i.length&&c.push(HU(n,e,l,i.length)),r.children.splice(t,1,...c),[wE,t+c.length]}),sG(e,n),EE(e,`mdxJsxTextElement`,(e,t,n)=>{if(n===void 0||t==null||e.name!==`mark`)return;let r={type:`mark`,children:e.children??[]};return n.children.splice(t,1,r),t+1})}}function lG(){return e=>{EE(e,`paragraph`,(e,t,n)=>{if(!n||t==null||e.children.length!==1)return;let r=e.children[0];if(r?.type!==`image`)return;let i=uG(r,e);n.children[t]=i})}}function uG(e,t){let n=[{type:`mdxJsxAttribute`,name:`src`,value:e.url}];typeof e.alt==`string`&&n.push({type:`mdxJsxAttribute`,name:`alt`,value:e.alt}),e.title&&n.push({type:`mdxJsxAttribute`,name:`title`,value:e.title});let r={type:`mdxJsxFlowElement`,name:`CommonMarkImage`,attributes:n,children:[]};return t.position&&(r.position=t.position),r}const dG=/^( {4}|\t)/;function fG(e){let t=e.split(`
|
|
368
|
-
`),n=!1;for(let e of t)if(e.length!==0&&(n=!0,!
|
|
367
|
+
`,r.offset)!==-1)return!0;for(let t=n.index+1;t<r.index;t++)if(hW(e[t]))return!0;return!1}function hW(e){let t=e;return t?.type===`break`?!0:t?.type===`text`?(t.value??``).indexOf(`
|
|
368
|
+
`)!==-1:Array.isArray(t?.children)&&t.children.some(hW)}function gW(e){if(e==null)return!1;if(e.type===`comment`)return!0;let t=e.children;return Array.isArray(t)&&t.some(gW)}const _W=/^([ ]{1,3})(<\/[A-Z][A-Za-z0-9_]*\s*>)([ \t]*)$/gm,vW=/^[ ]{0,3}([-*+]|\d{1,9}[.)])([ \t]|$)/;function yW(e,t){if(t===0)return!1;let n=t-1;for(;n>=0;){let r=n;for(;r>0&&e[r-1]!==`
|
|
369
|
+
`;)r--;let i=e.slice(r,n===t-1?n:n+1);if(i.trim().length===0){n=r-2;continue}return vW.test(i)}return!1}function bW(e){if(!e.includes(`</`))return e;let t=mH(e),n=!1,r=e.replace(_W,(r,i,a,o,s)=>hH(s,t)||!yW(e,s)?r:(n=!0,`${a}${o}`));return n?r:e}const xW=/^<details(\s[^>]*)?>\s*<summary>([\s\S]*?)<\/summary>([\s\S]*?)<\/details>\s*$/,SW=/^<details(\s[^>]*)?>(?:\s*<summary>([\s\S]*?)<\/summary>)?[\s\S]*$/,CW=/^\s*<\/details>\s*$/;function wW(e){let t=!1,n=null,r=null;if(!e)return{defaultOpen:t,name:n,id:r};let i=/(\w+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'<>]+)))?/g,a=i.exec(e);for(;a!==null;){let o=a[1].toLowerCase(),s=a[2]??a[3]??a[4]??null;o===`open`?t=!0:o===`name`?n=s:o===`id`&&(r=s),a=i.exec(e)}return{defaultOpen:t,name:n,id:r}}function TW(e){let t=[];return e.title!==null&&t.push({type:`mdxJsxAttribute`,name:`title`,value:e.title}),e.defaultOpen&&t.push({type:`mdxJsxAttribute`,name:`defaultOpen`,value:null}),e.name!==null&&t.push({type:`mdxJsxAttribute`,name:`name`,value:e.name}),e.id!==null&&t.push({type:`mdxJsxAttribute`,name:`id`,value:e.id}),t}function EW(e){if(e.type!==`paragraph`)return!1;let t=e.children;return t.length===1&&t[0].type===`text`}function DW(e){return e.children[0].value??``}function OW(e){if(!EW(e))return null;let t=DW(e).match(xW);if(!t)return null;let{defaultOpen:n,name:r,id:i}=wW(t[1]),a=t[2].trim()||null,o=t[3].trim(),s=o?[{type:`paragraph`,children:[{type:`text`,value:o}]}]:[];return{type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:TW({title:a,defaultOpen:n,name:r,id:i}),children:s,position:e.position}}function kW(e,t){let n=e[t];if(!EW(n))return null;let r=DW(n);if(!r.startsWith(`<details`)||r.includes(`</details>`))return null;let i=r.match(SW);if(!i)return null;let{defaultOpen:a,name:o,id:s}=wW(i[1]),c=i[2]?.trim()||null;for(let n=t+1;n<e.length;n++){let t=e[n];if(!EW(t))continue;let r=DW(t);if(CW.test(r))return{closerIdx:n,title:c,defaultOpen:a,name:o,id:s};if(r.includes(`</details>`))return null}return null}function AW(e){let t=e.children,n=0;for(;n<t.length;){let e=t[n];if(EW(e)){let r=OW(e);if(r){t[n]=r,n++;continue}let i=kW(t,n);if(i){let r=e,a=t[i.closerIdx],o=n+1,s=i.closerIdx,c=t.slice(o,s),l=r.position,u=a.position,d={type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:TW(i),children:c,position:l&&u?{start:l.start,end:u.end}:void 0},f=i.closerIdx-n+1;t.splice(n,f,d),n++;continue}}n++}}function jW(){return e=>{EE(e,e=>{`children`in e&&Array.isArray(e.children)&&AW(e)})}}const MW=/^<(div|center)(\s[^>]*?)?\s*>$/i,NW=new Set([`center`,`left`,`right`,`justify`]);function PW(e){if(!e)return null;let t=e.match(/\balign\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'<>]+))/i);if(!t)return null;let n=(t[1]??t[2]??t[3]??``).toLowerCase();return NW.has(n)?n:null}function FW(e){if(e.type!==`paragraph`)return!1;let t=e.children;return t.length===1&&t[0].type===`text`}function IW(e){return e.children[0].value??``}function LW(e){if(!FW(e))return null;let t=IW(e).trim().match(MW);if(!t)return null;let n=t[1].toLowerCase(),r=t[2]??``;return{tag:n,align:PW(r)??(n===`center`?`center`:null),sourceAttrs:r}}function RW(e,t,n){let r=new RegExp(String.raw`^\s*</${n}>\s*$`,`i`);for(let i=t+1;i<e.length;i++){let t=e[i];if(!FW(t))continue;let a=IW(t);if(r.test(a))return i;let o=a.trimStart().toLowerCase();if(o.startsWith(`<div`)||o.startsWith(`<center`)||o.includes(`</${n}>`))return null}return null}function zW(e){let t=e.children,n=0;for(;n<t.length;){let e=LW(t[n]);if(e!==null){let r=RW(t,n,e.tag);if(r!==null){let i=t[n],a=t[r],o=t.slice(n+1,r),s=i.position,c=a.position,l={type:`mdxJsxFlowElement`,name:`HtmlAlignBlock`,attributes:[...e.align===null?[]:[{type:`mdxJsxAttribute`,name:`align`,value:e.align}],{type:`mdxJsxAttribute`,name:`tag`,value:e.tag},{type:`mdxJsxAttribute`,name:`sourceAttrs`,value:e.sourceAttrs}],children:o,position:s&&c?{start:s.start,end:c.end}:void 0};t.splice(n,r-n+1,l),n++;continue}}n++}}function BW(){return e=>{EE(e,e=>{`children`in e&&Array.isArray(e.children)&&zW(e)})}}const VW=` `;function HW(e){return e.type===`listItem`&&typeof e.checked==`boolean`}function UW(e){let t=e.children??[];if(t.length!==1)return!1;let n=t[0];return n?.type===`paragraph`&&(n.children?.length??0)===0}function WW(e){let t=e.children??[];if(t.length!==1)return!1;let n=t[0];if(n?.type!==`paragraph`||(n.children?.length??0)!==1)return!1;let r=n.children[0];if(r?.type!==`text`||r.value!==VW)return!1;let i=r.data?.entityRefSpans;if(!Array.isArray(i)||i.length!==1)return!1;let a=i[0];return a?.offset===0&&a.length===6&&a.raw===VW}function GW(e){EE(e,`listItem`,e=>{if(!HW(e)||!UW(e))return;let t=e.children[0];t.children=[{type:`text`,value:` `,data:{sourceRaw:VW}}]})}function KW(e){EE(e,`listItem`,e=>{!HW(e)||!WW(e)||(e.children[0].children=[])})}function qW(){return e=>{KW(e)}}const JW=57856,YW=63743,XW=/&(?:[A-Za-z][A-Za-z0-9]*|#[0-9]+|#[xX][0-9A-Fa-f]+);/g;function ZW(e){return XW.lastIndex=0,e.replace(XW,e=>{let t=e.slice(1,-1);if(t.startsWith(`#`)){let e=t[1]===`x`||t[1]===`X`;return ED(t.slice(e?2:1),e?16:10)}let n=TD(t);return n===!1?e:n})}function QW(e){let t=new Set,n=0;for(let r of e){let e=0;for(let i of r){let r=i.codePointAt(0);r!==void 0&&(r>=JW&&r<=YW&&t.add(r),r===JW?(e+=1,n=Math.max(n,e)):e=0)}}return{occupied:t,longestStartRun:n}}function $W(e){let{occupied:t,longestStartRun:n}=QW([e,ZW(e)]);for(let e=JW;e<=YW;e+=1)if(!t.has(e))return String.fromCharCode(e);return``.repeat(n+1)+``}function eG(e){return{exit:{characterEscapeValue(t){let n=this.stack.pop();n.value+=e+this.sliceSerialize(t),n.position&&(n.position.end={line:t.end.line,column:t.end.column,offset:t.end.offset})}},transforms:[t=>(EE(t,t=>{if(t.type===`text`){let n=[],r=``,i=0;for(;;){let a=t.value.indexOf(e,i);if(a===-1)break;r+=t.value.slice(i,a);let o=t.value.slice(a+e.length,a+e.length+1);n.push({offset:r.length,char:o}),i=a+e.length}r+=t.value.slice(i),t.value=r,t.data??={},t.data.escapedChars=n;return}let n=t;for(let[t,r]of Object.entries(n))typeof r==`string`&&(n[t]=r.replaceAll(e,``))}),t)]}}function tG(e,t){let n;return(r,i)=>{let a=t.data();a.fromMarkdownExtensions??=[];let o=a.fromMarkdownExtensions,s=eG($W(r)),c=n,l=c?o.lastIndexOf(c):-1;l>=0?o.splice(l,1,s):o.push(s),n=s;try{return e(r,i)}finally{let e=o.lastIndexOf(s);e>=0&&(c&&l>=0?o.splice(e,1,c):o.splice(e,1)),n=c}}}const nG=function(){let e=this;e.parser=tG(e.parser,e)},rG=/(?<!=)==(?=\S)([^\n]*?[^\s=])==(?!=)/g;function iG(e){return e.type===`strong`||e.type===`emphasis`||e.type===`delete`||e.type===`inlineCode`}function aG(e){return e.type===`text`||e.type===`inlineCode`?e.value.length>0?e.value.charAt(0):null:`children`in e&&Array.isArray(e.children)&&e.children.length>0?aG(e.children[0]):null}function oG(e){if(e.type===`text`||e.type===`inlineCode`)return e.value.length>0?e.value.slice(-1):null;if(`children`in e&&Array.isArray(e.children)&&e.children.length>0){let t=e.children;return oG(t[t.length-1])}return null}function sG(e,t){let n=e.children,r=new Map,i=e=>{let t=r.get(e);if(t!==void 0)return t;let n=BU(e);return r.set(e,n),n},a=0;for(;a<n.length;){let e=n[a];if(e.type!==`text`){a++;continue}let r=e.value,o=-1;for(let t=0;t<=r.length-2;t++){if(r.charCodeAt(t)!==61||r.charCodeAt(t+1)!==61||t>0&&r.charCodeAt(t-1)===61||WU(i(e),t,2))continue;let s;if(t+2<r.length)s=r.charAt(t+2);else{let e=n[a+1];if(!e)continue;s=aG(e)}if(!(s===null||/\s/.test(s))){o=t;break}}if(o===-1){a++;continue}let s=-1,c=-1,l=!1;for(let t=o+3;t<=r.length-2;t++){if(r.charCodeAt(t)!==61||r.charCodeAt(t+1)!==61||WU(i(e),t,2))continue;let o=r.charAt(t-1);if(/[\s=]/.test(o))continue;let c;if(t+2<r.length)c=r.charAt(t+2);else{let e=n[a+1];c=e?e.type===`text`?e.value[0]??null:aG(e):null}if(c!==`=`){s=-2;break}}if(s===-2){a++;continue}for(let e=a+1;e<n.length;e++){let t=n[e];if(t.type===`text`){for(let r=0;r<=t.value.length-2;r++){if(t.value.charCodeAt(r)!==61||t.value.charCodeAt(r+1)!==61||WU(i(t),r,2))continue;let a;if(r>0)a=t.value.charAt(r-1);else{let t=n[e-1];a=oG(t)}if(a===null||/[\s=]/.test(a))continue;let o;if(r+2<t.value.length)o=t.value.charAt(r+2);else{let t=n[e+1];o=t?t.type===`text`?t.value[0]??null:aG(t):null}if(o!==`=`){s=e,c=r,l=!0;break}}if(s>=0)break}else if(!iG(t))break}if(s<0){a++;continue}let u=n[s],d=r.slice(0,o),f=r.slice(o+2),p=u.value.slice(0,c),m=u.value.slice(c+2),h=[];f.length>0&&h.push(UU(t,e,o+2,r.length));for(let e=a+1;e<s;e++)h.push(n[e]);if(p.length>0&&h.push(UU(t,u,0,c)),!l){a++;continue}let g={type:`mark`,children:h},_=[];d.length>0&&_.push(UU(t,e,0,o)),_.push(g),m.length>0&&_.push(UU(t,u,c+2,u.value.length)),n.splice(a,s-a+1,..._),a+=+(d.length>0)+1}}function cG(e,t){if(`children`in e&&Array.isArray(e.children)){sG(e,t);for(let n of e.children)cG(n,t)}}function lG(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;EE(e,`text`,(e,t,r)=>{if(r===void 0||t==null)return;let i=e.value;if(i.indexOf(`==`)===-1)return;let a=BU(e);rG.lastIndex=0;let o=[],s;for(;(s=rG.exec(i))!==null;){let e=s.index,t=e+s[0].length;if(WU(a,e,2)||WU(a,t-2,2)){rG.lastIndex=e+1;continue}o.push(s)}if(o.length===0)return;let c=[],l=0;for(let t of o){let r=t.index,i=r+t[0].length;r>l&&c.push(UU(n,e,l,r));let a={type:`mark`,children:[UU(n,e,r+2,i-2)]},o=qU(n,e,r,i);o&&(a.position=o),c.push(a),l=i}return l<i.length&&c.push(UU(n,e,l,i.length)),r.children.splice(t,1,...c),[wE,t+c.length]}),cG(e,n),EE(e,`mdxJsxTextElement`,(e,t,n)=>{if(n===void 0||t==null||e.name!==`mark`)return;let r={type:`mark`,children:e.children??[]};return n.children.splice(t,1,r),t+1})}}function uG(){return e=>{EE(e,`paragraph`,(e,t,n)=>{if(!n||t==null||e.children.length!==1)return;let r=e.children[0];if(r?.type!==`image`)return;let i=dG(r,e);n.children[t]=i})}}function dG(e,t){let n=[{type:`mdxJsxAttribute`,name:`src`,value:e.url}];typeof e.alt==`string`&&n.push({type:`mdxJsxAttribute`,name:`alt`,value:e.alt}),e.title&&n.push({type:`mdxJsxAttribute`,name:`title`,value:e.title});let r={type:`mdxJsxFlowElement`,name:`CommonMarkImage`,attributes:n,children:[]};return t.position&&(r.position=t.position),r}const fG=/^( {4}|\t)/;function pG(e){let t=e.split(`
|
|
370
|
+
`),n=!1;for(let e of t)if(e.length!==0&&(n=!0,!fG.test(e)))return!1;return n}function mG(e){return e.split(`
|
|
369
371
|
`).map(e=>e.length===0?e:e.startsWith(` `)?e.slice(4):e.startsWith(` `)?e.slice(1):e).join(`
|
|
370
|
-
`)}function
|
|
371
|
-
`;)a--;if(a===r)return null;let o=t.slice(a,r);if(!
|
|
372
|
+
`)}function hG(e,t){let n=e.position;if(!n||typeof n.start.offset!=`number`||typeof n.end.offset!=`number`)return null;let r=n.start.offset,i=n.end.offset;if(r<0||i>t.length||r>=i)return null;let a=r;for(;a>0&&t[a-1]!==`
|
|
373
|
+
`;)a--;if(a===r)return null;let o=t.slice(a,r);if(!fG.test(o))return null;let s=t.slice(a,i);if(!pG(s))return null;let c={start:{line:n.start.line,column:1,offset:a},end:n.end};return{type:`code`,lang:null,meta:null,value:mG(s).replace(/\n+$/,``),position:c,data:{sourceStyle:`indented`}}}const gG=function(){return(e,t)=>{let n=String(t.value??``);n&&EE(e,`paragraph`,(e,t,r)=>{if(r?.type!==`root`||t==null)return;let i=r.children[t-1];if(i&&i.type===`list`)return;let a=hG(e,n);a&&(r.children[t]=a)})}},_G=/^\n+$/;function vG(e){return e.length<3||!_G.test(e)?0:e.length-2}function yG(e,t){let n=[],r=e.children;for(let e=1;e<r.length;e++){let i=r[e-1],a=r[e],o=i?.position?.end?.offset,s=i?.position?.end?.line,c=a?.position?.start?.offset;if(typeof o!=`number`||typeof c!=`number`||typeof s!=`number`||c<o)continue;let l=vG(t.slice(o,c));if(l===0)continue;let u=[],d=[];for(let e=0;e<l;e++)u.push(s+2+e),d.push(o+2+e);n.push({beforeChildIndex:e,lines:u,offsets:d})}return n}function bG(e,t){let n=yG(e,t);if(n.length===0)return;let r=[],i=0;for(let t=0;t<e.children.length;t++){let a=n[i];if(a&&a.beforeChildIndex===t){for(let e=0;e<a.lines.length;e++)r.push(xG(a.lines[e],a.offsets[e]));i+=1}r.push(e.children[t])}e.children=r}function xG(e,t){let n={line:e,column:1,offset:t};return{type:`paragraph`,children:[],position:{start:n,end:{...n}}}}function SG(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}function CG(e){let t=e.identifier??e.label;if(typeof t!=`string`)return null;let n=SG(t);return n.length>0?n:null}function wG(e){let t=new Map;return EE(e,`definition`,e=>{let n=CG(e);n&&!t.has(n)&&t.set(n,e)}),t}function TG(){return e=>{let t=wG(e);t.size!==0&&EE(e,`linkReference`,e=>{let n=CG(e);if(!n)return;let r=t.get(n);r&&(e.data={...e.data,resolvedUrl:r.url,resolvedTitle:r.title??null})})}}function EG(e,t,n){let r={type:`mdxJsxFlowElement`,name:e,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t}],children:[]};return n&&(r.position=n),r}function DG(){return e=>{EE(e,`math`,(e,t,n)=>{if(!n||t==null)return;let r=EG(`DollarMath`,typeof e.value==`string`?e.value:``,e.position);n.children[t]=r}),EE(e,`code`,(e,t,n)=>{if(!n||t==null||e.lang!==`math`)return;let r=EG(`MathFence`,typeof e.value==`string`?e.value:``,e.position);n.children[t]=r})}}const OG=/<([a-zA-Z][a-zA-Z0-9+.-]*:[^\s<>]+)>/g;function kG(e,t=``){let n=[],r=!1;for(let i of e.children){if(i.type!==`text`){n.push(i);continue}let e=i.value,a=BU(i);OG.lastIndex=0;let o=[],s=0;for(;;){let n=OG.exec(e);if(n===null)break;let c=n[0],l=n[1],u=n.index;if(WU(a,u,1))continue;u>s&&o.push(UU(t,i,s,u));let d={type:`link`,url:l,title:null,children:[UU(t,i,u+1,u+1+l.length)],data:{sourceStyle:`autolink`}},f=qU(t,i,u,u+c.length);f&&(d.position=f),o.push(d),s=u+c.length,r=!0}o.length===0?n.push(i):(s<e.length&&o.push(UU(t,i,s,e.length)),n.push(...o))}r&&(e.children=n)}const AG=new Set(`!"#$%&'()*+,-./:;<=>?@[\\]^_\`{|}~`.split(``));function jG(e){let t=[],n=``;for(let r=0;r<e.length;r++){let i=e[r];if(i===`\\`&&r+1<e.length&&e[r+1]===`|`){n+=`${i}|`,r++;continue}if(i===`|`){t.push(n),n=``;continue}n+=i}return t.push(n),t}function MG(e,t,n=!1,r){if(!t)return;let i=e.position;if(!i||typeof i.start?.offset!=`number`){n&&console.warn(`[position-slice] node type=${e.type} has no position — fidelity defaults apply`);return}let a=i.start.offset,o=i.end?.offset??a;if(a<0||o>t.length){n&&console.warn(`[position-slice] node type=${e.type} position out of bounds: start=${a} end=${o} sourceLen=${t.length}`);return}switch(e.data??={},e.type){case`text`:{let n=t.slice(a,o),r=e.value??``;if(!PH(e.data)&&n.length>r.length&&n.includes(`\\`)){let t=[],i=0,a=0;for(;i<n.length&&a<r.length;)n[i]===`\\`&&i+1<n.length&&AG.has(n[i+1])&&r[a]===n[i+1]?(t.push({offset:a,char:n[i+1]}),i+=2,a+=1):(i++,a++);t.length>0&&(e.data.escapedChars=t)}n.endsWith(`\\`)&&r.endsWith(`\\`)&&(e.data.sourceRaw=n);break}case`emphasis`:{let n=t[a];(n===`*`||n===`_`)&&(e.data.sourceDelimiter=n);break}case`strong`:{let n=t.slice(a,a+2);(n===`**`||n===`__`)&&(e.data.sourceDelimiter=n);break}case`heading`:{let n=t[a],i=t.slice(a,o);if(n===`#`){if(e.data.sourceStyle=`atx`,r?.type===`root`){let n=a;for(;n>0&&t[n-1]!==`
|
|
372
374
|
`;)n--;let r=t.slice(n,a);r.length>=1&&r.length<=3&&/^ +$/.test(r)&&(e.data.sourceLeadingIndent=r.length)}let n=/^#+( {2,})[^ ]/.exec(i);n&&(e.data.sourceInteriorSpacing=n[1].length);let o=/^.*?[ \t](#+)[ \t]*$/.exec(i);o&&(e.data.sourceTrailingHashes=o[1].length)}else{let t=/\n(=+)[ \t]*$/.exec(i),n=/\n(-+)[ \t]*$/.exec(i),r=t??n;r?(e.data.sourceStyle=`setext`,e.data.sourceUnderlineLength=r[1].length):e.data.sourceStyle=`atx`}break}case`blockquote`:{let n=a;for(;n>0&&t[n-1]!==`
|
|
373
375
|
`;)n--;let r=!1;for(let e=n;e<a;e++)if(t[e]===`>`){r=!0;break}let i=t.slice(a,o).split(`
|
|
374
376
|
`),s=[];for(let e=0;e<i.length;e++){let t=i[e];if(t.trim().length===0)continue;if(r&&e>0)break;let n=t.replace(/^ {1,3}/,``);if(n[0]!==`>`){e>0&&t.trimStart()[0]!==`>`&&s.push(`lazy`);continue}if(n.slice(1).trimEnd()!==``){if(n[1]===` `)s.push(1);else{let e=0;for(;n[1+e]===` `;)e++;s.push(e)}}}s.length>0&&(e.data.sourceMarkerSpacings=s);break}case`list`:{let n=e.children?.[0];if(n?.position?.start?.offset!=null){let r=n.position.start.offset;if(r>=0&&r<t.length){let n=t[r];if(!e.ordered&&(n===`-`||n===`*`||n===`+`))e.data.bulletMarker=n;else if(e.ordered){let n=t.slice(r,Math.min(r+10,t.length)).match(/^\d+([.)])/);n&&(e.data.listMarkerDelimiter=n[1])}}}break}case`listItem`:{let n=t.slice(a,o),r=/^(?:([-+*])|(\d{1,9})[.)])( *)/.exec(n);if(!r)break;let s=r[1]?1:(r[2]?.length??0)+1,c=r[3].length;c>=2&&c<=4&&(e.data.sourceMarkerSpacing=c),r[2]&&(e.data.sourceOrdinal=Number.parseInt(r[2],10)),e.checked!=null&&/^\[([xX])\] /.exec(n.slice(s+Math.max(c,1)))?.[1]===`X`&&(e.data.sourceCheckboxChar=`X`);let l=s+(c>=2&&c<=4?c:1),u=a;for(;u>0&&t[u-1]!==`
|
|
@@ -378,17 +380,17 @@ ${t.slice(l+2)}`,d+=1;else break}t.push({indent:l,number:parseInt(s,10),content:
|
|
|
378
380
|
`),r=(e.value??``).split(`
|
|
379
381
|
`);if(n.length===r.length){let t=[],i=!1,a=!0;for(let e=0;e<n.length;e++){let o=n[e],s=r[e];if(!o.endsWith(s)){a=!1;break}let c=o.slice(0,o.length-s.length);if(!/^[ \t]*$/.test(c)){a=!1;break}t.push(c),c!==(s.length>0?` `:``)&&(i=!0)}a&&i&&(e.data.sourceIndents=t)}}break}case`inlineCode`:{let n=t[a];if(n==="`"||n===`~`){e.data.sourceFenceChar=n;let r=0;for(;a+r<t.length&&t[a+r]===n;)r++;r>=1&&(e.data.sourceFenceLength=r);let i=t.slice(a+r,o-r),s=e.value??``;i!==s&&i===` ${s} `&&(e.data.sourcePadded=!0)}break}case`inlineMath`:if(t[a]===`$`){let n=0;for(;a+n<t.length&&t[a+n]===`$`;)n++;e.data.sourceDelimiter=`$`.repeat(n)}break;case`thematicBreak`:e.data.sourceRaw=t.slice(a,o);break;case`table`:{let n=t.slice(a,o),r=n.indexOf(`
|
|
380
382
|
`);if(r===-1)break;let i=n.slice(r+1),s=i.indexOf(`
|
|
381
|
-
`),c=s===-1?i:i.slice(0,s),l=c.trim().replace(/^\|/,``).replace(/\|$/,``).split(`|`),u=[];for(let e of l){let t=e.match(/-/g);u.push(t?t.length:0)}u.some(e=>e>0)&&(e.data.sourceDashCounts=u);{let t=c.trim(),n=
|
|
383
|
+
`),c=s===-1?i:i.slice(0,s),l=c.trim().replace(/^\|/,``).replace(/\|$/,``).split(`|`),u=[];for(let e of l){let t=e.match(/-/g);u.push(t?t.length:0)}u.some(e=>e>0)&&(e.data.sourceDashCounts=u);{let t=c.trim(),n=jG(t);n.length>0&&n[0]===``&&t.startsWith(`|`)&&n.shift(),n.length>0&&n[n.length-1]===``&&t.endsWith(`|`)&&n.pop();let r=n.every(e=>/^[-: ]+$/.test(e)),i=[];for(let e of n){let t=0;for(;t<e.length&&e[t]===` `;)t++;let n=0;for(;n<e.length-t&&e[e.length-1-n]===` `;)n++;i.push({left:t,right:n})}r&&i.length>0&&(e.data.sourceAlignmentPadding=i)}{let t=n.split(`
|
|
382
384
|
`).filter(e=>e.trim().length>0);if(t.length>=2){let n=t.map(e=>e.trimStart().startsWith(`|`)),r=t.map(e=>/(^|[^\\])\|$/.test(e.trimEnd())),i=n.every(e=>e===n[0]),a=r.every(e=>e===r[0]);if(i&&a){let t=n[0],i=r[0];(!t||!i)&&(e.data.sourceOuterPipes={leading:t,trailing:i})}}}for(let n of e.children??[]){if(n.type!==`tableRow`||!n.position)continue;let e=n.position.start.offset,r=n.position.end.offset;if(typeof e!=`number`||typeof r!=`number`)continue;let i=t.slice(e,r),a=i.indexOf(`
|
|
383
|
-
`);a!==-1&&(i=i.slice(0,a));let o=
|
|
385
|
+
`);a!==-1&&(i=i.slice(0,a));let o=jG(i);o.length>0&&o[0]===``&&i.startsWith(`|`)&&o.shift(),o.length>0&&o[o.length-1]===``&&i.endsWith(`|`)&&o.pop();let s=n.children??[],c=Math.min(s.length,o.length);for(let e=0;e<c;e++){let t=s[e];if(t.type!==`tableCell`)continue;let n=o[e],r=0;for(;r<n.length&&n[r]===` `;)r++;let i=0;for(;i<n.length-r&&n[n.length-1-i]===` `;)i++;t.data||={},t.data.sourcePadding={left:r,right:i}}}break}case`link`:case`linkReference`:if(`children`in e&&e.children.length===0&&(e.data.sourceRaw=t.slice(a,o)),e.type===`link`){let n=t[a];if(n!==`[`&&n!==`<`&&!e.title)e.data.sourceStyle=`gfm-autolink`;else if(n===`[`){let n=t.slice(a,o),r=n.lastIndexOf(`](`);if(r!==-1){let t=r+2;for(;t<n.length&&(n[t]===` `||n[t]===` `);)t++;if(n[t]===`<`&&(e.data.sourceUrlForm=`angle-bracketed`),e.title!==void 0&&e.title!==null&&n[n.length-1]===`)`){let t=n.length-2;for(;t>r+1&&(n[t]===` `||n[t]===` `||n[t]===`
|
|
384
386
|
`);)t--;n[t]===`"`?e.data.sourceTitleMarker=`double`:n[t]===`'`?e.data.sourceTitleMarker=`single`:n[t]===`)`&&(e.data.sourceTitleMarker=`paren`)}}}}break;case`definition`:{let n=t.slice(a,o);if(e.data.sourceLayout=n.includes(`
|
|
385
|
-
`)?`multiline`:`inline`,typeof e.title==`string`&&n.length>0){let t=n[n.length-1];t===`"`?e.data.sourceTitleMarker=`double`:t===`'`?e.data.sourceTitleMarker=`single`:t===`)`&&(e.data.sourceTitleMarker=`paren`)}break}case`mdxJsxFlowElement`:case`mdxJsxTextElement`:case`mdxFlowExpression`:case`mdxTextExpression`:e.data.sourceRaw=t.slice(a,o);break;case`break`:if(e.data.sourceRaw)break;t.slice(a,o).includes(`\\`)?e.data.sourceStyle=`backslash`:e.data.sourceStyle=`spaces`}}function
|
|
387
|
+
`)?`multiline`:`inline`,typeof e.title==`string`&&n.length>0){let t=n[n.length-1];t===`"`?e.data.sourceTitleMarker=`double`:t===`'`?e.data.sourceTitleMarker=`single`:t===`)`&&(e.data.sourceTitleMarker=`paren`)}break}case`mdxJsxFlowElement`:case`mdxJsxTextElement`:case`mdxFlowExpression`:case`mdxTextExpression`:e.data.sourceRaw=t.slice(a,o);break;case`break`:if(e.data.sourceRaw)break;t.slice(a,o).includes(`\\`)?e.data.sourceStyle=`backslash`:e.data.sourceStyle=`spaces`}}function NG(){return RegExp(`(^|\\s)#([a-zA-Z][\\w/-]*)`,`g`)}const PG=NG();function FG(e,t=``){let n=[],r=!1;for(let i of e.children){if(i.type!==`text`){n.push(i);continue}let e=i.value,a=BU(i);PG.lastIndex=0;let o=[],s=0;for(;;){let n=PG.exec(e);if(n===null)break;let c=n[1]??``,l=n[2]??``,u=n.index+c.length;if(WU(a,u,1))continue;u>s&&o.push(UU(t,i,s,u));let d={type:`tag`,value:l},f=qU(t,i,u,u+1+l.length);f&&(d.position=f),o.push(d),s=u+1+l.length,r=!0}o.length===0?n.push(i):(s<e.length&&o.push(UU(t,i,s,e.length)),n.push(...o))}r&&(e.children=n)}const IG=new Set(`root.paragraph.heading.text.emphasis.strong.blockquote.list.listItem.code.inlineCode.link.image.linkReference.imageReference.definition.html.thematicBreak.break.yaml.toml.table.tableRow.tableCell.delete.footnoteDefinition.footnoteReference.mdxFlowExpression.mdxJsxFlowElement.mdxJsxTextElement.mdxTextExpression.wikiLink.wikiLinkEmbed.tag.math.inlineMath.mark.underline.comment.commentBlock.rawMdxFallbackMdast`.split(`.`));function LG(e,t){if(!e||typeof e!=`object`)return null;if(typeof e.offset==`number`)return e.offset>=0&&e.offset<=t.length?e.offset:null;let{line:n,column:r}=e;if(typeof n!=`number`||typeof r!=`number`||n<1||r<1)return null;let i=0;for(let e=1;e<n;e++){let e=t.indexOf(`
|
|
386
388
|
`,i);if(e===-1)return null;i=e+1}let a=t.indexOf(`
|
|
387
|
-
`,i),o=a===-1?t.length:a,s=i+r-1;return s<=o?s:null}function
|
|
389
|
+
`,i),o=a===-1?t.length:a,s=i+r-1;return s<=o?s:null}function RG(e,t){if(!e)return null;let n=LG(e.start,t),r=LG(e.end,t);return n===null||r===null||r<n?null:t.slice(n,r)}function zG(e,t){let n=RG(e.position,t);return{type:`rawMdxFallbackMdast`,originalType:e.type??`unknown`,value:n??``,unresolvedPosition:n===null,position:e.position}}function BG(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``,r=typeof process<`u`&&process.env?.OK_DEBUG_POSITION_SLICE===`1`;EE(e,(e,t,i)=>{if(i!==void 0&&typeof t==`number`&&typeof e.type==`string`&&!IG.has(e.type)){let r=zG(e,n);return i.children[t]=r,wE}if(`children`in e&&Array.isArray(e.children)){let t=e;t.children.some(e=>e.type===`text`)&&(kG(t,n),FG(t,n))}if(MG(e,n,r,i),e.type===`heading`&&i!==void 0&&typeof t==`number`){let n=e.position?.end?.line,r=i.children[t+1],a=r?.position?.start?.line;if(r?.type===`paragraph`&&typeof n==`number`&&typeof a==`number`&&a===n+1){let t=e;t.data??={},t.data.sourceContiguousNext=!0}}})}}function VG(e,t){let n={type:`mdxJsxFlowElement`,name:`MermaidFence`,attributes:[{type:`mdxJsxAttribute`,name:`chart`,value:e}],children:[]};return t&&(n.position=t),n}function HG(){return e=>{EE(e,`code`,(e,t,n)=>{if(!n||t==null||e.lang!==`mermaid`)return;let r=VG(typeof e.value==`string`?e.value:``,e.position);n.children[t]=r})}}function UG(){let e=!1,t=``,n=0;return r=>{let i=WG(r);return e?(i&&i.char===t&&i.len>=n&&!i.hasInfo&&(e=!1,t=``,n=0),!0):i?(e=!0,t=i.char,n=i.len,!0):!1}}function WG(e){let t=(e.endsWith(`\r`)?e.slice(0,-1):e).match(/^ {0,3}([`~])(\1{2,})(.*)$/);return t?{char:t[1],len:1+t[2].length,hasInfo:t[3].trim()!==``}:null}function GG(e,t,n){for(let r=t;r<n;r++)e[r]=` `}function KG(e,t){if(e[t]!==`<`)return null;let n=e.slice(t).toLowerCase();for(let r of[`pre`,`code`]){if(!n.startsWith(`<${r}`))continue;let i=e[t+r.length+1];if(i===`>`||i===`/`||i===` `||i===` `)return r}return null}function qG(e,t){let n=null;for(let r=t;r<e.length;r++){let t=e[r];if(n!==null)t===n&&(n=null);else if(t===`"`||t===`'`)n=t;else if(t===`>`)return r+1}return null}function JG(e,t,n){let r=RegExp(`</${n}\\s*>`,`i`).exec(e.slice(t));return r?.index===void 0?null:t+r.index+r[0].length}function YG(e,t){let n=0;for(;e[t+n]==="`";)n+=1;if(n===0)return null;let r=t+n,i=r;for(;i<e.length;){if(e[i]!=="`"){i+=1;continue}let t=0;for(;e[i+t]==="`";)t+=1;if(t===n)return i+n;i+=t}return r}function XG(e){let t=UG(),n=!1,r=null;return e.map(({text:e,start:i})=>{if(r===null&&!n&&t(e))return{text:` `.repeat(e.length),start:i};let a=e.split(``),o=0;for(;o<e.length;){if(n){let t=e.indexOf(`-->`,o),r=t<0?e.length:t+3;if(GG(a,o,r),o=r,t<0)break;n=!1;continue}if(r!==null){let t=JG(e,o,r);if(GG(a,o,t??e.length),t===null)break;o=t,r=null;continue}let t=e.indexOf(`<!--`,o),i=-1,s=null;for(let t=o;t<e.length;t++){let n=KG(e,t);if(n!==null){i=t,s=n;break}}let c=e.indexOf("`",o),l=t<0?i:i<0?t:Math.min(t,i);if(c>=0&&(l<0||c<l)){o=YG(e,c)??c+1;continue}if(t<0&&i<0)break;if(t>=0&&(i<0||t<i)){let r=e.indexOf(`-->`,t+4),i=r<0?e.length:r+3;if(GG(a,t,i),o=i,n=r<0,n)break;continue}let u=qG(e,i);if(u===null||s===null)break;let d=JG(e,u,s),f=d??e.length;if(GG(a,i,f),o=f,r=d===null?s:null,r!==null)break}return{text:a.join(``),start:i}})}function ZG(e){let t=[],n=0;for(let r=0;r<e.length;r++){let i=e[r];i===`
|
|
388
390
|
`?(t.push({text:e.slice(n,r),start:n}),n=r+1):i===`\r`&&(t.push({text:e.slice(n,r),start:n}),e[r+1]===`
|
|
389
|
-
`&&(r+=1),n=r+1)}t.push({text:e.slice(n),start:n});let r=
|
|
390
|
-
`:` `;l+=s.move(u);let d=String(e.url??``);if(!d||/[\0- ]/.test(d)){let e=n.enter(`destinationLiteral`);l+=s.move(`<`),l+=s.move(n.safe(d,{before:l,after:`>`,...s.current()})),l+=s.move(`>`),e()}else{let e=n.enter(`destinationRaw`);l+=s.move(
|
|
391
|
-
`:` `;l+=s.move(
|
|
391
|
+
`&&(r+=1),n=r+1)}t.push({text:e.slice(n),start:n});let r=XG(t),i=e.split(``);for(let e of r)for(let t=0;t<e.text.length;t++)i[e.start+t]=e.text[t];return i.join(``)}function QG(e,t,n,r){return r<=n||e.slice(n,r).trim().length===0?!1:t.slice(n,r).trim().length===0}function $G(e){return e.type===`link`||e.type===`linkReference`}function eK(e,t,n,r){let i=n.position?.start.offset,a=n.position?.end.offset;if(i===void 0||a===void 0)return;let o=r.slice(i,a),s={type:`text`,value:o,data:{sourceRaw:o},position:n.position};e.children.splice(t,1,s)}function tK(){return(e,t)=>{let n=typeof t.value==`string`?t.value:String(t.value??``);if(n.length===0||!n.includes(`<!--`)&&!/<(pre|code)[\s/>]/i.test(n))return;let r=ZG(n),i=e=>{for(let t=e.children.length-1;t>=0;t--){let a=e.children[t];if(!a||(`children`in a&&Array.isArray(a.children)&&i(a),!$G(a)))continue;let o=a.position?.start.offset,s=a.position?.end.offset;o!==void 0&&s!==void 0&&QG(n,r,o,s)&&eK(e,t,a,n)}};i(e)}}const nK=Fj(),rK=$A(),iK=ej();function aK(){let e=this.data();e.micromarkExtensions||=[],e.fromMarkdownExtensions||=[],e.toMarkdownExtensions||=[];let t=e.micromarkExtensions;t.some(e=>e===nK)||t.push(nK);let n=e.fromMarkdownExtensions;n.some(e=>e===rK)||n.push(rK);let r=e.toMarkdownExtensions;r.some(e=>e===iK)||r.push(iK)}const oK=Object.assign(jK,{peek:()=>`$`}),sK=Object.assign(MK,{peek:()=>`~`}),cK=(()=>{for(let e of iK.extensions??[]){let t=e?.handlers?.mdxJsxFlowElement;if(typeof t==`function`)return t}throw Error(`mdast-util-mdx-jsx mdxJsxFlowElement to-markdown handler not found — the dirty MDX JSX serialize path cannot bind. Likely a breaking change in mdast-util-mdx-jsx (pinned in the root overrides); re-run the markdown-pipeline upgrade protocol (test:fidelity).`)})(),lK=/^[ \t]*(?:$|#{1,6}(?:[ \t]|[ \t]*$)|>|(?:[-+*]|\d{1,9}[.)])[ \t]|`{3,}|~{3,}|=+[ \t]*$|-+[ \t]*$|(?:\*[ \t]*){3,}$|(?:_[ \t]*){3,}$)/;function uK(e){let t=e;return t.type===`rawMdxFallback`?{type:`mdxJsxFlowElement`,name:null,attributes:[],children:[],data:{sourceRaw:t.value??``}}:e}const dK={text(e,t,n,r){if(typeof e.data?.sourceRaw==`string`&&rB(e.data.sourceRaw,e.value??``))return e.data.sourceRaw;let i=NH(e.data);if(i.kind===`malformed`&&typeof process<`u`&&process.env?.OK_DEBUG_POSITION_SLICE===`1`&&console.warn(`[escape-provenance] malformed escapedChars metadata: CommonMark-safe serialization applies`),i.kind===`valid`&&i.data.escapedChars.length>0){let t=e.value??``,a=i.data.escapedChars,o=``,s=0,c,l=(e,t)=>{if(!e)return;let i=c===`<`?e.indexOf(`>`):-1;i>=0&&(o+=SK(n,e.slice(0,i+1),{...r,before:r.before+o,after:e.slice(i+1,i+2)||t},!0),e=e.slice(i+1)),e&&(o+=SK(n,e,{...r,before:r.before+o,after:t}))};for(let{offset:e,char:n}of a)e>s&&l(t.slice(s,e),`\\`),o+=`\\${n}`,s=e+1,c=n;return s<t.length&&l(t.slice(s),r.after),o}return SK(n,e.value??``,r)},emphasis(e,t,n,r){let i=e.data?.sourceDelimiter??`*`,a=n.createTracker(r),o=n.enter(`emphasis`),s=a.move(i);return s+=OK(n.containerPhrasing(e,{before:s,after:i,...a.current()}),r,i),s+=a.move(i),o(),s},strong(e,t,n,r){let i=e.data?.sourceDelimiter??`**`,a=n.createTracker(r),o=n.enter(`strong`),s=a.move(i);return s+=OK(n.containerPhrasing(e,{before:s,after:i,...a.current()}),r,i),s+=a.move(i),o(),s},link(e,t,n,r){if(e.data?.sourceStyle===`autolink`)return`<${e.url??``}>`;if(e.data?.sourceStyle===`gfm-autolink`){let t=e.children?.length===1?e.children[0]:null;if(t?.type===`text`&&typeof t.value==`string`)return t.value}let i=n.createTracker(r),a=n.enter(`link`),o=n.enter(`label`),s=i.move(`[`);s+=i.move(n.containerPhrasing(e,{before:s,after:`](`,...i.current()})),s+=i.move(`](`),o();let c=n.enter(`destinationRaw`),l=String(e.url??``),u=e.data?.sourceUrlForm===`angle-bracketed`,d=l.startsWith(`<`)&&l.endsWith(`>`),f=u&&!d?`<${l}>`:gK(l);if(s+=i.move(f),c(),e.title){let t=e.data?.sourceTitleMarker??`double`;s+=i.move(hK(e.title,t))}return s+=i.move(`)`),a(),s},image(e,t,n,r){let i=n.createTracker(r),a=n.enter(`image`),o=n.enter(`label`),s=i.move(`})),s+=i.move(`](`),o();let c=n.enter(`destinationRaw`);if(s+=i.move(gK(String(e.url??``))),c(),e.title){let t=n.enter(`titleQuote`);s+=i.move(` "`),s+=i.move(n.safe(e.title,{before:s,after:`"`,...i.current()})),s+=i.move(`"`),t()}return s+=i.move(`)`),a(),s},definition(e,t,n,r){let i=e.data?.sourceLayout??`inline`,a=e.data?.sourceTitleMarker??`double`,o=n.enter(`definition`),s=n.createTracker(r),c=n.enter(`label`),l=s.move(`[`);l+=s.move(n.safe(n.associationId(e),{before:l,after:`]`,...s.current()})),l+=s.move(`]:`),c();let u=i===`multiline`?`
|
|
392
|
+
`:` `;l+=s.move(u);let d=String(e.url??``);if(!d||/[\0- ]/.test(d)){let e=n.enter(`destinationLiteral`);l+=s.move(`<`),l+=s.move(n.safe(d,{before:l,after:`>`,...s.current()})),l+=s.move(`>`),e()}else{let e=n.enter(`destinationRaw`);l+=s.move(gK(d)),e()}if(e.title){let t=i===`multiline`?`
|
|
393
|
+
`:` `;l+=s.move(hK(e.title,a,t))}return o(),l},thematicBreak(e){return e.data?.sourceRaw??`---`},break(e,t,n){let r=e.data?.sourceRaw;return typeof r==`string`&&r.length>0?r:n.stack.includes(`tableCell`)||n.stack.includes(`okAtxHeading`)?`<br />`:e.data?.sourceStyle===`backslash`?`\\
|
|
392
394
|
`:`
|
|
393
395
|
`},code(e,t){let n=e.value??``;if(e.data?.sourceStyle===`indented`){let t=n.split(`
|
|
394
396
|
`),r=e.data.sourceIndents;return Array.isArray(r)&&r.length===t.length?t.map((e,t)=>`${r[t]??(e.length>0?` `:``)}${e}`).join(`
|
|
@@ -397,7 +399,7 @@ ${t.slice(l+2)}`,d+=1;else break}t.push({indent:l,number:parseInt(s,10),content:
|
|
|
397
399
|
`).map(e=>e.length>0?`${c}${e}`:e).join(`
|
|
398
400
|
`):e}let m=`${u}${f}${d}${p}\n${n}\n${r.repeat(o)}`;return c?m.split(`
|
|
399
401
|
`).map(e=>e.length>0?`${c}${e}`:e).join(`
|
|
400
|
-
`):m},inlineCode(e,t,n){let r=e.value??``,i=e.data?.sourceFenceChar===`~`?`~`:"`",a=typeof e.data?.sourceFenceLength==`number`&&e.data.sourceFenceLength>0?e.data.sourceFenceLength:1,o=i==="`"?"`":`~`,s=a;for(;RegExp(`(^|[^${o}])${o.repeat(s)}([^${o}]|$)`).test(r);)s+=1;let c=i.repeat(s);/[^ \r\n]/.test(r)&&(e.data?.sourcePadded===!0||/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||r.startsWith(i)||r.endsWith(i))&&(r=` ${r} `);let l=`${c}${r}${c}`;return n.stack.includes(`tableCell`)?xB(l):l},inlineMath:
|
|
402
|
+
`):m},inlineCode(e,t,n){let r=e.value??``,i=e.data?.sourceFenceChar===`~`?`~`:"`",a=typeof e.data?.sourceFenceLength==`number`&&e.data.sourceFenceLength>0?e.data.sourceFenceLength:1,o=i==="`"?"`":`~`,s=a;for(;RegExp(`(^|[^${o}])${o.repeat(s)}([^${o}]|$)`).test(r);)s+=1;let c=i.repeat(s);/[^ \r\n]/.test(r)&&(e.data?.sourcePadded===!0||/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||r.startsWith(i)||r.endsWith(i))&&(r=` ${r} `);let l=`${c}${r}${c}`;return n.stack.includes(`tableCell`)?xB(l):l},inlineMath:oK,delete:sK,heading(e,t,n,r){let i=e.data?.sourceStyle??`atx`,a=e.depth;if(i===`setext`&&(a===1||a===2)){let t=n.containerPhrasing(e,{...r,before:`
|
|
401
403
|
`,after:`
|
|
402
404
|
`}),i=e.data?.sourceUnderlineLength,o=typeof i==`number`&&i>=1?i:Math.max(t.length,3);return`${t}\n${(a===1?`=`:`-`).repeat(o)}`}let o=e.data?.sourceLeadingIndent,s=typeof o==`number`&&o>=1&&o<=3?` `.repeat(o):``,c=e.data?.sourceInteriorSpacing,l=typeof c==`number`&&c>=2?` `.repeat(c):` `,u=`#`.repeat(a),d=n.enter(`okAtxHeading`),f=n.containerPhrasing(e,{...r,before:`${u} `,after:`
|
|
403
405
|
`});d();let p=e.data?.sourceTrailingHashes;if(typeof p==`number`&&p>0){let e=`#`.repeat(p);return f?`${s}${u}${l}${f} ${e}`:`${s}${u} ${e}`}return f?`${s}${u}${l}${f}`:`${s}${u}`},list(e,t,n,r){let i=n.options.bullet||`-`,a=!!e.ordered,o=n.bulletCurrent,s=n.bulletLastUsed;if(!a){let t=e.data?.bulletMarker;(t===`-`||t===`*`||t===`+`)&&(n.bulletCurrent=t)}let c=e.children||[],l=[],u=a?e.data?.listMarkerDelimiter??`.`:null,d=e.start??1;for(let t=0;t<c.length;t++){let o=c[t],s=o.data?.sourceOrdinal,f=typeof s==`number`&&s>=0?s:d+t,p=a?`${f}${u}`:e.data?.bulletMarker??i,m=o.data?.sourceMarkerSpacing,h=typeof m==`number`&&m>=2&&m<=4?m:1,g=` `.repeat(h),_=p;o.checked===!0?_+=`${g}[${o.data?.sourceCheckboxChar===`X`?`X`:`x`}]`:o.checked===!1&&(_+=`${g}[ ]`);let v=o.data?.sourceContinuationIndent,y=p.length+h,b=typeof v==`number`&&v>=y&&v<=y+3?v:y,x=` `.repeat(b),S=o.checked===null||o.checked===void 0?g:` `,C=o.children??[],w=C[0]?.type===`list`,T;if(w){let e=o.checked!==null&&o.checked!==void 0,t=n.containerFlow({...o,children:[C[0]]},r),i=C.slice(1),a=i.length?n.containerFlow({...o,children:i},r):``,s=t.split(`
|
|
@@ -411,13 +413,13 @@ ${t.slice(l+2)}`,d+=1;else break}t.push({indent:l,number:parseInt(s,10),content:
|
|
|
411
413
|
|
|
412
414
|
`:`
|
|
413
415
|
`;return l.join(f)},table(e,t,n,r){let i=n.enter(`table`),a=[],o=[],s=e.children??[];for(let e of s){let t=e.children??[],i=[],s=[];for(let e of t){let t=n.enter(`tableCell`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,{...r,before:` `,after:` `});a(),t(),i.push(o);let c=e.data?.sourcePadding;s.push(c&&typeof c.left==`number`&&typeof c.right==`number`?{left:c.left,right:c.right}:null)}a.push(i),o.push(s)}i();let c=e.align??[],l=e.data?.sourceDashCounts,u=a[0]?.length??0,d=a.slice(1).reduce((e,t)=>Math.max(e,t.length),0),f=Math.max(u,d,c.length);if(f===0)return console.warn(JSON.stringify({event:`table-serialize-dropped-empty`,rows:s.length})),``;let p=[];for(let e=0;e<f;e++){let t=c[e],n=``,r=``;t===`center`?(n=`:`,r=`:`):t===`left`?n=`:`:t===`right`&&(r=`:`);let i=l?.[e],a=typeof i==`number`&&i>=1?i:1;p.push(n+`-`.repeat(a)+r)}let m=(e,t)=>{let n=[];for(let r=0;r<f;r++){let i=e[r]??``,a=t[r]??{left:1,right:1};n.push(` `.repeat(a.left)+i+` `.repeat(a.right))}let r=v&&!v.leading?``:`|`,i=v&&!v.trailing?``:`|`;return`${r}${n.join(`|`)}${i}`},h=e.data?.sourceAlignmentPadding,g=Array.from({length:f},(e,t)=>{let n=h?.[t];return n&&typeof n.left==`number`&&typeof n.right==`number`?n:null}),_=e.data?.sourceOuterPipes,v=_&&f>=2&&a.every(e=>{let t=(e[0]??``).trim(),n=(e[f-1]??``).trim();return(_.leading||t.length>0)&&(_.trailing||n.length>0&&!n.endsWith(`\\`))})?_:null;if(a.length===0)return m(p,g);let y=[];y.push(m(a[0],o[0]??[])),y.push(m(p,g));for(let e=1;e<a.length;e++)y.push(m(a[e],o[e]??[]));return y.join(`
|
|
414
|
-
`)},mdxJsxFlowElement(e,t,n,r){let i=e,a=i.data?.sourceRaw;if(typeof a==`string`)return a;let o=i.data?.htmlBoundary;if(o&&typeof o.opener==`string`&&typeof o.closer==`string`){let e=n.containerFlow({type:`root`,children:i.children??[]},r);return`${o.opener}\n\n${e}\n\n${o.closer}`}let s=i.name??``,c=
|
|
415
|
-
]|$)`};return delete t._compiled,t});let a;try{a=e.safe(
|
|
416
|
-
`||e[r]===`\r`;let i=n.after.charCodeAt(0);return Number.isNaN(i)||i===10||i===13}function EK(e,t){let n=``,r=0;for(;r<e.length;){let i=e.charAt(r);if(i===`\\`){n+=e.slice(r,r+2),r+=2;continue}if(i===`*`||i===`_`||i===`~`||i===`=`){let a=r+1;for(;a<e.length&&e.charAt(a)===i;)a++;let o=r===0?t.before.charCodeAt(t.before.length-1):e.charCodeAt(r-1);if(i===`=`)n+=(Number.isNaN(o)||o===10||o===13)&&TK(e,a,t)?`\\${e.slice(r,a)}`:e.slice(r,a);else{let s=a<e.length?e.charCodeAt(a):t.after.charCodeAt(0);n+=wK(i,o,s)?`\\${i}`.repeat(a-r):e.slice(r,a)}r=a;continue}n+=i,r+=1}return n}function DK(e,t,n){let r=n.startsWith(`_`)?`_`:`*`,i=t.before??``,a=t.after??``,o=e,s=o.charCodeAt(0);OK(i.charCodeAt(i.length-1),s,r)&&(o=kK(s)+o.slice(1));let c=o.charCodeAt(o.length-1);return OK(a.charCodeAt(0),c,r)&&(o=o.slice(0,-1)+kK(c)),o}function OK(e,t,n){return!(cD(t)!==1||n===`_`&&cD(e)===void 0)}function kK(e){return`&#x${e.toString(16).toUpperCase()};`}function AK(e,t,n,r){let i=e.value??``,a=e.data?.sourceDelimiter,o=typeof a==`string`&&/^\$+$/.test(a)?a.length:2;for(o===1&&!MK(i,r)&&(o=2);RegExp(`(^|[^$])${`\\$`.repeat(o)}([^$]|$)`).test(i);)o++;let s=`$`.repeat(o);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=` ${i} `);let c=-1;for(;++c<n.unsafe.length;){let e=n.unsafe[c];if(!e.atBreak)continue;let t=n.compilePattern(e),r;for(;(r=t.exec(i))!==null;){let e=r.index;i.codePointAt(e)===10&&i.codePointAt(e-1)===13&&e--,i=`${i.slice(0,e)} ${i.slice(r.index+1)}`}}return s+i+s}function jK(e,t,n,r){let i=e.data?.sourceDelimiter===`~`?`~`:`~~`,a=n.createTracker(r),o=n.enter(`strikethrough`),s=a.move(i);return s+=DK(n.containerPhrasing(e,{...a.current(),before:s,after:`~`}),r,i),s+=a.move(i),o(),s}function MK(e,t){return!(e.length===0||!/^\S/.test(e)||!/\S$/.test(e)||/[$\r\n]/.test(e)||e.endsWith(`\\`)||/\\[!-/:-@[-`{-~]/.test(e)||/^\d/.test(t.after)||t.before.endsWith(`\\`))}const NK=[{mode:`protecting`,protect:bU,reservations:vU},{mode:`protecting`,protect:oU,reservations:RH},{mode:`protecting`,protect:mU,reservations:uU},{mode:`serializer-only`,reservations:[{to:``}]}];new Set(NK.flatMap(({reservations:e})=>e.map(({to:e})=>e)));function PK(e,t){switch(t.mode){case`protecting`:return t.protect(e);case`serializer-only`:return e}}function FK(e){return NK.reduce(PK,e)}function IK(e){return e.data?.sourceRaw}function LK(e){return e.type===`text`?e.value===``:e.type===`mdxJsxTextElement`&&IK(e)===``}function RK(e){return e.type===`paragraph`&&(e.children??[]).every(LK)}function zK(e){let t=e.children??[],n=t[0]?.children?.length??0,r=0;for(let e=1;e<t.length;e++)r=Math.max(r,t[e]?.children?.length??0);let i=e.align??[];return Math.max(n,r,i.length)}function BK(e){switch(e.type){case`table`:return zK(e)===0;case`code`:return e.data?.sourceStyle===`indented`&&/^\n*$/.test(e.value??``);case`thematicBreak`:return IK(e)===``;case`html`:return(e.value??``)===``;case`mdxJsxFlowElement`:return IK(e)===void 0&&e.data?.htmlBoundary===void 0&&(e.children??[]).length===0&&!e.name;case`list`:return(e.children??[]).length===0;default:return!1}}function VK(e){let t=[];for(let n of e.children){if(n.type===`table`&&zK(n)===0){console.warn(JSON.stringify({event:`table-serialize-dropped-empty`,rows:(n.children??[]).length}));continue}BK(n)||(n.type===`paragraph`&&n.children.length>0&&RK(n)&&(n.children=[]),t.push(n))}e.children=t}function HK(e,t){let n=e,r=t;return n.type===`heading`&&n.data?.sourceContiguousNext===!0&&r.type===`paragraph`}const UK=(e,t)=>{if(RK(e)||HK(e,t))return 0;let n=e.position,r=t.position;if(!n||!r)return;let i=r.start.line-n.end.line-1;return i>=1?i:void 0},WK=/(?<!\\)\$(?=\S)([^$\n]*?[^\s$])\$(?!\d)/g;function GK(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;EE(e,`text`,(e,t,r)=>{if(r===void 0||t==null)return;let i=e.value;if(i.indexOf(`$`)===-1)return;let a=zU(e);WK.lastIndex=0;let o=[],s;for(;(s=WK.exec(i))!==null;){let e=s.index,t=e+s[0].length;if(UU(a,e,1)||UU(a,t-1,1)){WK.lastIndex=e+1;continue}o.push(s)}if(o.length===0)return;let c=[],l=0;for(let t of o){let r=t.index,i=r+t[0].length;r>l&&c.push(HU(n,e,l,r));let a={type:`inlineMath`,value:t[1]},o=KU(n,e,r,i);o&&(a.position=o),c.push(a),l=i}return l<i.length&&c.push(HU(n,e,l,i.length)),r.children.splice(t,1,...c),[wE,t+c.length]})}}const KK=new Set([`strong`,`emphasis`,`delete`,`link`,`mark`,`comment`]);function qK(e){if(e?.type!==`break`)return!1;let t=e.data?.sourceRaw;return typeof t!=`string`||t.length===0}function JK(e){e.data??={},e.data.sourceRaw=`<br />`,e.data.sourceStyle=`html`}function YK(e){if(e?.type!==`text`)return!1;let t=e.data?.sourceRaw;return typeof t!=`string`||t.length===0}const XK=/[ \t]+$/,ZK=/^[ \t]*$/;function QK(e){return e.some(e=>!(YK(e)&&ZK.test(e.value)))}function $K(e,t=!1){for(;e.length>0;){let n=e[e.length-1];if(qK(n)){JK(n);break}if(n&&KK.has(n.type)&&`children`in n){let t=n.children;if($K(t,!0),t.length===0){e.pop();continue}}if(!t&&YK(n)&&XK.test(n.value)){let t=n.value.replace(XK,``);if(t.length>0){n.value=t;continue}if(QK(e.slice(0,-1))){e.pop();continue}if(e.every(e=>YK(e)&&ZK.test(e.value))){let t=e[0];t.value=t.value.charAt(0),e.splice(1)}}break}}const eq=new Set([`paragraph`,`heading`,`tableCell`]);function tq(e){let t=e=>{if(eq.has(e.type)&&`children`in e&&$K(e.children),`children`in e)for(let n of e.children)t(n)};t(e)}const nq={handlers:{tag:e=>`#${e.value}`},unsafe:[{character:`#`,inConstruct:[`phrasing`],before:`\\s`,after:`[a-zA-Z]`}]};function rq(){let e=this.data();e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===nq)||e.toMarkdownExtensions.push(nq)}const iq=new Set([`u`,`ins`]);function aq(){return e=>{EE(e,`mdxJsxTextElement`,(e,t,n)=>{if(n===void 0||t==null||e.name===null||!iq.has(e.name)||(e.attributes??[]).length>0)return;let r={type:`underline`,children:e.children??[],data:{sourceForm:e.name===`ins`?`ins`:`u`}};return e.position&&(r.position=e.position),n.children.splice(t,1,r),t+1})}}const oq=/(?<!\uE102)<br[ \t]*\/?>/g,sq=new Set([`mdxJsxTextElement`,`mdxJsxFlowElement`]);function cq(e,t){let n=[],r=!1;for(let i of e.children){if(i.type!==`text`){n.push(i);continue}let e=i.value;oq.lastIndex=0;let a=[],o=0;for(;;){let n=oq.exec(e);if(n===null)break;let s=n.index;s>o&&a.push(HU(t,i,o,s));let c={type:`break`,data:{sourceStyle:`html`,sourceRaw:n[0]}},l=KU(t,i,s,s+n[0].length);l&&(c.position=l),a.push(c),o=s+n[0].length,r=!0}a.length===0?n.push(i):(o<e.length&&a.push(HU(t,i,o,e.length)),n.push(...a))}r&&(e.children=n)}function lq(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;EE(e,e=>{if(sq.has(e.type))return wE;let t=e;Array.isArray(t.children)&&cq(e,n)})}}function uq(e){return e===-2?` `:e===-1?` `:String.fromCharCode(e)}const dq={name:`wikiLink`,tokenize:(e,t,n)=>{let r=0,i=0,a=``;return o;function o(t){return t===91?(e.enter(`wikiLink`),e.enter(`wikiLinkMarker`),e.consume(t),s):n(t)}function s(t){return t===91?(e.consume(t),e.exit(`wikiLinkMarker`),e.enter(`wikiLinkTarget`),c):n(t)}function c(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?a.trim()===``?n(t):(e.exit(`wikiLinkTarget`),d(t)):t===35?a.trim()===``?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAnchor`),l):t===124?_B(a)?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),u):(e.consume(t),a+=uq(t),c)}function l(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?r===0?n(t):(e.exit(`wikiLinkAnchor`),d(t)):t===124?r===0?n(t):(e.exit(`wikiLinkAnchor`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),u):(e.consume(t),r++,l)}function u(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?i===0?n(t):(e.exit(`wikiLinkAlias`),d(t)):(e.consume(t),i++,u)}function d(t){return t===93?(e.enter(`wikiLinkMarker`),e.consume(t),f):n(t)}function f(r){return r===93?(e.consume(r),e.exit(`wikiLinkMarker`),e.exit(`wikiLink`),t):n(r)}}},fq={name:`wikiLinkEmbed`,tokenize:(e,t,n)=>{let r=0,i=0,a=``;return o;function o(t){return t===33?(e.enter(`wikiLinkEmbed`),e.enter(`wikiLinkEmbedBang`),e.consume(t),e.exit(`wikiLinkEmbedBang`),s):n(t)}function s(t){return t===91?(e.enter(`wikiLinkMarker`),e.consume(t),c):n(t)}function c(t){return t===91?(e.consume(t),e.exit(`wikiLinkMarker`),e.enter(`wikiLinkTarget`),l):n(t)}function l(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?a.trim()===``?n(t):(e.exit(`wikiLinkTarget`),f(t)):t===35?a.trim()===``?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAnchor`),u):t===124?_B(a)?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),d):(e.consume(t),a+=uq(t),l)}function u(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?r===0?n(t):(e.exit(`wikiLinkAnchor`),f(t)):t===124?r===0?n(t):(e.exit(`wikiLinkAnchor`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),d):(e.consume(t),r++,u)}function d(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?i===0?n(t):(e.exit(`wikiLinkAlias`),f(t)):(e.consume(t),i++,d)}function f(t){return t===93?(e.enter(`wikiLinkMarker`),e.consume(t),p):n(t)}function p(r){return r===93?(e.consume(r),e.exit(`wikiLinkMarker`),e.exit(`wikiLinkEmbed`),t):n(r)}}};function pq(){return{text:{91:dq,33:fq}}}function mq(e){this.enter({type:`wikiLink`,value:``,data:{target:``,anchor:null,alias:null},children:[]},e)}function hq(e){this.enter({type:`wikiLinkEmbed`,value:``,data:{target:``,anchor:null,alias:null},children:[]},e)}function gq(e){return e.stack[e.stack.length-1]}function _q(e){let t=gq(this),n=this.sliceSerialize(e);t.data.target=n.trim(),n!==t.data.target&&(t.data.sourceTarget=n)}function vq(e){let t=gq(this),n=this.sliceSerialize(e),r=n.trim();t.data.anchor=r.length?r:null,t.data.anchor!==null&&n!==r&&(t.data.sourceAnchor=n)}function yq(e){let t=gq(this),n=this.sliceSerialize(e),r=n.trim();t.data.alias=r.length?r:null,n!==r&&(t.data.sourceAlias=n)}function bq(e){let t={target:e.data.target,anchor:e.data.anchor??null,alias:e.data.alias??null},n=mB(t,{separatorCrossed:t.alias!==null||e.data.sourceAlias!=null});n.target!==t.target&&(e.data.sourceTarget??=t.target,e.data.target=n.target),n.anchor!==t.anchor&&(e.data.sourceAnchor??=t.anchor,e.data.anchor=n.anchor),n.alias!==t.alias&&(e.data.sourceAlias??=t.alias,e.data.alias=n.alias)}function xq(e){bq(e);let{target:t,anchor:n,alias:r}=e.data,i=r||(n?`${t}#${n}`:t);e.value=i,e.children=[{type:`text`,value:i}]}function Sq(e){xq(gq(this)),this.exit(e)}function Cq(e){xq(gq(this)),this.exit(e)}const wq={enter:{wikiLink:mq,wikiLinkEmbed:hq},exit:{wikiLinkTarget:_q,wikiLinkAnchor:vq,wikiLinkAlias:yq,wikiLink:Sq,wikiLinkEmbed:Cq}};function Tq(e){return(t,n,r,i)=>{let a=t.data,o=r.stack.includes(`tableCell`),s=e=>o?bB(e):e,c=a?.target??``,l=a?.anchor,u=a?.alias,d=`${e}${s(gB(a?.sourceTarget,c,`separatorAdjacent`))}`;if(l)d+=`#${s(gB(a?.sourceAnchor,l,`separatorAdjacent`))}`;else{let e=s(gB(a?.sourceAnchor,``,`separatorAdjacent`));e.length>0&&(d+=`#${e}`)}let f=u?gB(a?.sourceAlias,u,`alias`):gB(a?.sourceAlias,``,`alias`);if(f.length>0){let e=o&&!d.endsWith(`\\`)?`\\|`:`|`;d+=`${e}${s(f)}`}return`${d}]]`}}const Eq={handlers:{wikiLink:Tq(`[[`),wikiLinkEmbed:Tq(`![[`)},unsafe:[{character:`[`,inConstruct:[`phrasing`]}]},Dq=pq();function Oq(){let e=this.data();e.micromarkExtensions||=[],e.micromarkExtensions.some(e=>e===Dq)||e.micromarkExtensions.push(Dq),e.fromMarkdownExtensions||=[],e.fromMarkdownExtensions.some(e=>e===wq)||e.fromMarkdownExtensions.push(wq),e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===Eq)||e.toMarkdownExtensions.push(Eq)}function kq(e){return e.children.some(e=>{let t=e.type;return t!==`yaml`&&t!==`toml`})?e:{...e,children:[...e.children,{type:`paragraph`,children:[]}]}}const Aq=[{name:`remark-parse`,plugin:pA},{name:`escape-provenance`,plugin:tG},{name:`remark-mdx-agnostic`,plugin:iK},{name:`remark-gfm`,plugin:wO},{name:`remark-math`,plugin:Ok,options:{singleDollarTextMath:!1}},{name:`remark-wiki-link`,plugin:Oq},{name:`remark-github-alerts`,plugin:gk,options:PU},{name:`callout-transformer`,plugin:NU},{name:`restore-from-mdx`,plugin:cU},{name:`void-br-promoter`,plugin:lq},{name:`restore-entity-refs`,plugin:_U},{name:`restore-backslash-escapes`,plugin:xU},{name:`details-accordion-promoter`,plugin:AW},{name:`div-align-promoter`,plugin:zW},{name:`image-promoter`,plugin:lG},{name:`indented-code-promoter`,plugin:hG},{name:`math-promoter`,plugin:EG},{name:`single-dollar-math-promoter`,plugin:GK},{name:`highlight-promoter`,plugin:cG},{name:`underline-promoter`,plugin:aq},{name:`mermaid-promoter`,plugin:VG},{name:`comment-promoter`,plugin:YU},{name:`merged-post-parse-walker`,plugin:zG},{name:`empty-task-item-unmint`,plugin:KW},{name:`link-reference-destination`,plugin:wG},{name:`non-rendering-context-demote`,plugin:eK},{name:`ensure-non-empty-doc`,plugin:()=>kq}];function jq(e){let t=kO();for(let e of Aq)t=`options`in e&&e.options!==void 0?t.use(e.plugin,e.options):t.use(e.plugin);return t=t.use(HO,{schema:e.schema,handlers:e.handlers}),t.freeze(),t}function Mq(e){let t=kO().use(fk,[`yaml`]).use(wO,{tablePipeAlign:!1}).use(Ok,{singleDollarTextMath:!1}).use(iK).use(Oq).use(rq).use(bhe,{bullet:`-`,fences:!0,rule:`-`,join:[UK],...e.toMarkdownHandlers?{handlers:e.toMarkdownHandlers}:{}});return t.freeze(),t}function Nq(e){return e.charCodeAt(0)===65279?{source:e.slice(1),hadBom:!0}:{source:e,hadBom:!1}}const Pq=/^\n+$/,Fq=/^\n{2,}$/;function Iq(e,t,n){let r,i,a=e.children;if(a.length>0){let e=a[0]?.position?.start?.offset;if(typeof e==`number`&&e>0){let n=t.slice(0,e);Pq.test(n)&&(r=n)}let n=a[a.length-1]?.position?.end?.offset;if(typeof n==`number`&&n<=t.length){let e=t.slice(n);Fq.test(e)&&(i=e)}}if(!n&&r===void 0&&i===void 0)return;let o={...n?{bom:!0}:{},...r===void 0?{}:{leading:r},...i===void 0?{}:{trailing:i}};return e.data??={},e.data.sourceDocBoundary=o,o}function Lq(e){if(typeof e!=`object`||!e)return;let t=e,n={};return t.bom===!0&&(n.bom=!0),typeof t.leading==`string`&&Pq.test(t.leading)&&(n.leading=t.leading),typeof t.trailing==`string`&&Fq.test(t.trailing)&&(n.trailing=t.trailing),n.bom||n.leading||n.trailing?n:void 0}function Rq(e,t){let{source:n,hadBom:r}=Nq(e),i=yW(n),a=new hE(FK(i)),o=t.parse(a);a.value=i;let s=t.runSync(o,a);yG(s,i);let c=Iq(s,i,r),l=c?rR(s,c):void 0,u=t.stringify(s);return l?u.type.create({...u.attrs,sourceDocBoundary:l},u.content,u.marks):u}function zq(e,t){return Vq(e,t,!1)}function Bq(e,t){return Vq(e,t,!0)}function Vq(e,t,n){let{source:r,hadBom:i}=Nq(e),a=yW(r),o=new hE(FK(a)),s=t.parse(o);o.value=a;let c=t.runSync(s,o);n&&yG(c,a);let l=Iq(c,a,i);return n&&l&&rR(c,l),c}function Hq(e,t,n){let r=WO(e,{schema:n.schema,nodeHandlers:n.pmNodeHandlers,markHandlers:n.pmMarkHandlers});Uq(r),WW(r),tq(r),VK(r);let i=Lq(e.attrs?.sourceDocBoundary),a=String(t.stringify(r));return i?.leading&&(a=i.leading+a),i?.trailing&&(a=a.replace(/\n+$/,``)+i.trailing),i?.bom&&(a=`\uFEFF${a}`),a}function Uq(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)Uq(t);for(let t=0;t+1<e.children.length;){let n=e.children[t],r=e.children[t+1],i=n?.data,a=r?.data,o=PH(i)?i.escapedChars:null,s=PH(a)?a.escapedChars:null;if(n?.type!==`text`||r?.type!==`text`||typeof n.data?.sourceRaw==`string`||typeof r.data?.sourceRaw==`string`||o===null&&s===null){t+=1;continue}let c=n.value.length;n.value+=r.value,n.data??={},n.data.escapedChars=[...o??[],...(s??[]).map(e=>({...e,offset:e.offset+c}))],r.data?.entityRefSpans?.length&&(n.data.entityRefSpans=[...n.data.entityRefSpans??[],...r.data.entityRefSpans.map(e=>({...e,offset:e.offset+c}))]),e.children.splice(t+1,1)}}}function Wq(){return typeof process>`u`||!process.env?!1:process.env.NODE_ENV===`development`||process.env.NODE_ENV===`test`}function Gq(e){let t=e.lastIndexOf(`/`);return t===-1?``:t===0?`/`:e.slice(0,t)}function Kq(e,t){let n=e?`${e}/${t}`:t,r=n.startsWith(`/`),i=[];for(let e of n.split(`/`))if(e!==``&&e!==`.`){if(e===`..`){let e=i[i.length-1];i.length>0&&e!==`..`?i.pop():r||i.push(`..`);continue}i.push(e)}let a=i.join(`/`);return r?`/${a}`:a}function qq(e,t){if(typeof e!=`string`||e===``||!t||e.startsWith(`/`)||!bz(e))return e;let n=Kq(Gq(t),e);return n===``||n===`..`||n.startsWith(`../`)?(Wq()&&console.warn(`[resolve-image-url] doc-relative path escapes contentDir; emitting raw URL: ${e} (from sourcePath ${t})`),e):`/${n}`}function Jq(e){if(!Number.isFinite(e)||e<0)return``;if(e<1024)return`${e} B`;let t=[`KiB`,`MiB`,`GiB`,`TiB`],n=e/1024,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(1).replace(/\.0$/,``)} ${t[r]}`}var Yq=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};freshnessHolder={checker:void 0};constructor(e){this.schema=Mv(e.extensions),this.handlers=aJ(this.schema,this.parseCtx),this.freshnessHolder.checker=e.deriveStructuralFreshness?MR({parse:e=>this.parseWithFallback(e)}):void 0;let{nodeHandlers:t,markHandlers:n}=oJ(this.schema,this.freshnessHolder);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=jq({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=Mq({toMarkdownHandlers:uK})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return Rq(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?zq(e,this.parseProcessor):{type:`root`,children:[]}}parseToEditorMdast(e){return e.trim()?Bq(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?bH(e,{parse:e=>this.parse(e,t)}):{type:`doc`,content:[{type:`paragraph`,content:[]}]}}serialize(e,t){let n;try{n=this.schema.nodeFromJSON(e)}catch(t){let n=`MarkdownManager.serialize() failed: schema rejected JSONContent (type=${e.type}, childCount=${e.content?.length??0})`;throw Error(n,{cause:t})}let r=this.freshnessHolder.checker;t?.skipFreshnessDerive&&(this.freshnessHolder.checker=void 0);try{return Hq(n,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}finally{this.freshnessHolder.checker=r}}};const Xq=cH();function Zq(e,t){let n=new Map;for(let e of t)n.set(e.name,e);let r={};for(let t of e){if(t.type===`mdxJsxExpressionAttribute`)continue;let e=t.name,i=n.get(e);if(t.value===null||t.value===void 0){r[e]=!0;continue}if(typeof t.value==`string`){if(i?.type===`number`){let n=Number(t.value);r[e]=Number.isNaN(n)?t.value:n}else r[e]=i?.type===`boolean`?t.value===`true`:t.value;continue}let a=t.value.value;try{r[e]=JSON.parse(a)}catch{r[e]=a}}return r}function Qq(e){let t=!1;return e.descendants(e=>t?!1:e.type.name===`jsxInline`?(e.attrs.sourceDirty&&(t=!0),!1):e.type.name===`jsxComponent`&&e.attrs.sourceDirty?(t=!0,!1):!0),t}function $q(e,t){return e.attrs.sourceDirty||Qq(e)?!0:t?t.isDiverged(e.toJSON()):!1}function eJ(e){if(e.type!==`paragraph`)return!1;let t=e.children??[];return t.length===0||t.every(e=>e.type===`text`&&e.value===``)}function tJ(e,t){if(!t)return e;let n={};return t.sourceFenceChar&&(n.sourceFenceChar=t.sourceFenceChar),typeof t.sourceFenceLength==`number`&&(n.sourceFenceLength=t.sourceFenceLength),t.sourcePadded===!0&&(n.sourcePadded=!0),Object.keys(n).length===0?e:{...e,data:n}}function nJ(e,t){if(e.length===0)return tJ({type:`inlineCode`,value:``},t);if(e.every(e=>e.type===`text`))return tJ({type:`inlineCode`,value:e.map(e=>e.value).join(``)},t);if(e.length===1&&`children`in e[0]){let n=e[0];return{...n,children:[nJ(n.children,t)]}}return tJ({type:`inlineCode`,value:rJ(e)},t)}function rJ(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=rJ(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}const iJ=vs;function aJ(e,t){let n=e.nodes,r=e.marks,i={};n.paragraph&&(i.paragraph=(e,t,r)=>{let i=r.all(e).flat(),a=i.some(e=>e?.isBlock&&!e?.isInline),o=i.some(e=>e?.isInline||e?.isText||e?.isTextblock);if(a&&!o)return i.length===1?i[0]:i;if(a&&o){let e=i.filter(e=>!e?.isBlock||e?.isInline),t=i.filter(e=>e?.isBlock&&!e?.isInline),r=[],a=n.paragraph.createAndFill(null,e.length>0?e:null);return a&&r.push(a),r.push(...t),r.length===1?r[0]:r}return n.paragraph.createAndFill(null,i.length>0?i:null)}),n.blockquote&&(i.blockquote=BO(n.blockquote,e=>({sourceMarkerSpacings:e.data?.sourceMarkerSpacings??null}))),n.tableCell&&(i.tableCell=(e=>(t,r,i)=>{let a=i.all(t).flat();if(a.length>0&&n.paragraph){let t=n.paragraph.create(null,a);return e.createAndFill(null,[t])}return e.createAndFill(null,null)})(n.tableCell)),n.tableRow&&(i.tableRow=BO(n.tableRow)),n.table&&n.tableRow&&n.tableCell&&(i.table=(e,t,r)=>{let i=e.align??[],a=e.children??[],o=[];for(let e=0;e<a.length;e++){let t=a[e];if(t.type!==`tableRow`)continue;let s=t.children??[],c=[];for(let t=0;t<s.length;t++){let a=s[t];if(a.type!==`tableCell`)continue;let o=r.all(a).flat(),l=o.length>0&&n.paragraph?[n.paragraph.create(null,o)]:null,u=i[t]??null,d=e===0&&n.tableHeader?n.tableHeader:n.tableCell,f=a.data?.sourcePadding??null,p=d.createAndFill({align:u,sourcePadding:f},l);p&&c.push(p)}let l=n.tableRow.createAndFill(null,c.length>0?c:null);l&&o.push(l)}let s=e.data?.sourceDashCounts??null,c=e.data?.sourceOuterPipes??null,l=e.data?.sourceAlignmentPadding??null;return n.table.createAndFill({sourceDashCounts:s,sourceOuterPipes:c,sourceAlignmentPadding:l},o.length>0?o:null)}),n.image&&(i.image=e=>{let r=e.url??``,i=qq(r,t.current.sourcePath);return n.image.createAndFill({src:i,alt:e.alt??null,title:e.title??null,sourceUrl:i===r?null:r})},i.imageReference=n.imageReference?e=>n.imageReference.createAndFill({alt:e.alt??``,label:e.label??e.identifier??``,identifier:e.identifier??``,referenceType:e.referenceType??`shortcut`}):e=>n.image.createAndFill({src:``,alt:e.alt??null,title:null})),r.escapeMark&&(i.text=t=>{let n=t.value??``,i=typeof t.data?.sourceRaw==`string`?t.data.sourceRaw:null;if(!n&&!i)return null;if(i)return r.sourceLiteral?e.text(n,[r.sourceLiteral.create({sourceRaw:i})]):e.text(n);let a=t.data?.escapedChars,o=t.data?.entityRefSpans;if(!a?.length&&!o?.length)return e.text(n);let s=[...(a??[]).map(e=>({kind:`escape`,offset:e.offset,length:1})),...(o??[]).map(e=>({kind:`entity`,offset:e.offset,length:e.length,raw:e.raw}))];s.sort((e,t)=>e.offset-t.offset);let c=[];for(let e of s){let t=c[c.length-1];e.kind===`entity`&&t?.kind===`entity`&&t.offset+t.length===e.offset&&VR(t.raw)!==null&&RR(e.raw)?c[c.length-1]={kind:`entity`,offset:t.offset,length:t.length+e.length,raw:t.raw+e.raw}:c.push(e)}let l=[],u=0;for(let t of c){if(t.offset>u){let r=n.slice(u,t.offset);r&&l.push(e.text(r))}if(t.offset<n.length){let i=n.slice(t.offset,t.offset+t.length);if(i){if(t.kind===`escape`)l.push(e.text(i,[r.escapeMark.create()]));else if(r.sourceLiteral){let n=VR(t.raw);l.push(e.text(n??i,[r.sourceLiteral.create({sourceRaw:t.raw})]))}else l.push(e.text(i))}u=t.offset+t.length}}if(u<n.length){let t=n.slice(u);t&&l.push(e.text(t))}return l.length===1?l[0]:l}),r.code&&(i.inlineCode=t=>e.text(t.value,[r.code.create({sourceFenceChar:t.data?.sourceFenceChar??"`",sourceFenceLength:typeof t.data?.sourceFenceLength==`number`?t.data.sourceFenceLength:1,sourcePadded:t.data?.sourcePadded===!0})]));let a=r.strike??r.delete;if(a&&(i.delete=VO(a,e=>({sourceDelimiter:e.data?.sourceDelimiter===`~`?`~`:`~~`}))),r.highlight&&(i.mark=VO(r.highlight)),r.underline&&(i.underline=VO(r.underline,e=>({sourceForm:e.data?.sourceForm===`ins`?`ins`:`u`}))),r.comment&&(i.comment=VO(r.comment,e=>({sourceForm:e.data?.sourceForm??`percent`}))),n.commentBlock&&(i.commentBlock=BO(n.commentBlock,e=>({sourceForm:e.data?.sourceForm??`percent`,sourceLayout:e.data?.sourceLayout??`block`}))),r.emphasis&&(i.emphasis=VO(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=VO(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=BO(n.heading,e=>({level:e.depth,headingStyle:e.data?.sourceStyle??`atx`,sourceTrailingHashes:e.data?.sourceTrailingHashes??null,sourceUnderlineLength:e.data?.sourceUnderlineLength??null,sourceContiguousNext:e.data?.sourceContiguousNext??!1,sourceLeadingIndent:e.data?.sourceLeadingIndent??null,sourceInteriorSpacing:e.data?.sourceInteriorSpacing??null}))),n.codeBlock&&(i.code=t=>{let r=t.value?[e.text(t.value)]:[];return n.codeBlock.createAndFill({language:t.lang??null,meta:t.meta??null,fenceDelimiter:t.data?.sourceFenceChar??"`",fenceLength:t.data?.sourceFenceLength??3,sourceStyle:t.data?.sourceStyle??`fenced`,sourceClosingFenceLength:t.data?.sourceClosingFenceLength??null,sourceUnclosedFence:t.data?.sourceUnclosedFence??!1,sourceFenceIndent:t.data?.sourceFenceIndent??null,sourceInfoPadding:t.data?.sourceInfoPadding??null,sourceIndents:t.data?.sourceIndents??null},r)}),n.thematicBreak&&(i.thematicBreak=e=>n.thematicBreak.createAndFill({sourceRaw:e.data?.sourceRaw??`---`})),n.hardBreak&&(i.break=e=>n.hardBreak.createAndFill({hardBreakStyle:e.data?.sourceStyle??`spaces`,sourceRaw:e.data?.sourceRaw??null})),n.list&&(i.list=BO(n.list,e=>({ordered:!!e.ordered,start:e.start??1,spread:!!e.spread,bulletMarker:e.data?.bulletMarker??null,listMarkerDelimiter:e.data?.listMarkerDelimiter??null}))),n.listItem&&(i.listItem=BO(n.listItem,e=>({checked:e.checked??null,spread:!!e.spread,sourceMarkerSpacing:e.data?.sourceMarkerSpacing??null,sourceOrdinal:e.data?.sourceOrdinal??null,sourceCheckboxChar:e.data?.sourceCheckboxChar??null,sourceContinuationIndent:e.data?.sourceContinuationIndent??null}))),r.link){let t=r.sourceLiteral;i.link=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[](${n.url??``})`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.url??``,title:n.title??null,linkStyle:n.data?.sourceStyle??`inline`,refLabel:null,sourceUrlForm:n.data?.sourceUrlForm??null,sourceTitleMarker:n.data?.sourceTitleMarker??null});return o.map(e=>e.mark(s.addToSet(e.marks)))},i.linkReference=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[${n.label??``}][${n.identifier??``}]`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.data?.resolvedUrl??``,title:n.data?.resolvedTitle??null,linkStyle:n.referenceType??`shortcut`,refLabel:n.label??n.identifier??null});return o.map(e=>e.mark(s.addToSet(e.marks)))}}n.htmlBlock&&(i.html=e=>n.htmlBlock.createAndFill({content:e.value??``}));let o=n.linkDefinition??n.linkRefDef;if(o){let e=!!o.spec.attrs?.url,t=!!o.spec.attrs?.href,n=!!o.spec.attrs?.identifier,r=!!o.spec.attrs?.sourceLayout,a=!!o.spec.attrs?.sourceTitleMarker;i.definition=i=>{let s={title:i.title??null};return n&&(s.identifier=i.identifier??``),s.label=i.label??i.identifier??``,e?s.url=i.url??``:t&&(s.href=i.url??``),r&&(s.sourceLayout=i.data?.sourceLayout??null),a&&(s.sourceTitleMarker=i.data?.sourceTitleMarker??null),o.createAndFill(s)}}if(n.jsxComponent){let r=e=>{if(e&&typeof e==`object`&&`sourceRaw`in e){let t=e.sourceRaw;if(typeof t==`string`)return t}};i.mdxJsxFlowElement=(e,i,a)=>{let o=e.name??``,s=Xq.getOrWildcard(o),c=Zq(e.attributes,s.props);if(o===`CommonMarkImage`&&typeof c.src==`string`){let e=c.src,n=qq(e,t.current.sourcePath);n!==e&&(c.src=n,c.sourceUrl=e)}let l=a.all(e).flat();return n.jsxComponent.createAndFill({componentName:o,kind:`element`,attributes:e.attributes,sourceRaw:r(e.data)??``,sourceDirty:!1,props:c},l.length?l:void 0)};let a=(e,t)=>{let n=e.attributes?.find(e=>e.type===`mdxJsxAttribute`&&e.name===t);return n&&typeof n.value==`string`?n.value:null};i.mdxJsxTextElement=t=>{if(t.name===`InlineMath`&&n.mathInline){let e=a(t,`formula`)??``,r=a(t,`id`);return n.mathInline.create({formula:e,id:r??null})}if(t.name===`Tag`&&n.tag){let e=a(t,`value`)??``;return n.tag.create({value:e})}let i=t.name??``,o=i?Xq.get(i):void 0;if(o&&n.jsxInline){let e=Zq(t.attributes,o.props),a=r(t.data)??``,s=(t.children??[]).map(e=>e&&typeof e==`object`&&`value`in e?String(e.value??``):``).join(``);return s&&(e.children=s),n.jsxInline.createAndFill({componentName:i,attributes:t.attributes,sourceRaw:a,sourceDirty:!1,props:e})}if(n.jsxInline){let i=r(t.data)??``;return n.jsxInline.createAndFill({},i?[e.text(i)]:null)}return n.jsxComponent.createAndFill({sourceRaw:r(t.data)??``})},i.mdxFlowExpression=e=>{let t=r(e.data)??`{${e.value??``}}`;return n.jsxComponent.createAndFill({kind:`expression`,sourceRaw:t,sourceDirty:!1})},i.mdxTextExpression=t=>{let n=r(t.data)??`{${t.value??``}}`;return e.text(n)}}return n.wikiLink&&(i.wikiLink=e=>n.wikiLink.createAndFill({target:e.data?.target??``,alias:e.data?.alias??null,anchor:e.data?.anchor??null,sourceTarget:e.data?.sourceTarget??null,sourceAnchor:e.data?.sourceAnchor??null,sourceAlias:e.data?.sourceAlias??null})),n.tag&&(i.tag=e=>n.tag.createAndFill({value:e.value})),n.wikiLinkEmbed&&(i.wikiLinkEmbed=(i,a)=>{let o=i.data?.target??``,s=i.data?.alias??null,c=i.data?.anchor??null,l=i.data?.sourceTarget??null,u=i.data?.sourceAnchor??null,d=i.data?.sourceAlias??null,f=TB(o),{resolveEmbed:p,sourcePath:m}=t.current,h=p&&m?p(o,m)??null:null,g=h?`/${h}`:o,_=a?.type===`paragraph`&&Array.isArray(a.children)&&a.children.length===1;if(_&&iJ.has(f)&&n.jsxComponent&&Xq.has(`WikiEmbedImage`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedImage`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:g,alt:s??o,target:o,anchor:c,alias:s,sourceTarget:l,sourceAnchor:u,sourceAlias:d}});if(_&&ys.has(f)&&n.jsxComponent&&Xq.has(`WikiEmbedVideo`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedVideo`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:g,title:s??o,target:o,anchor:c,alias:s,sourceTarget:l,sourceAnchor:u,sourceAlias:d}});if(_&&bs.has(f)&&n.jsxComponent&&Xq.has(`WikiEmbedAudio`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedAudio`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:g,title:s??o,target:o,anchor:c,alias:s,sourceTarget:l,sourceAnchor:u,sourceAlias:d}});if(_&&xs.has(f)&&n.jsxComponent&&Xq.has(`WikiEmbedFile`)){let{resolveSize:e}=t.current,r=e&&m?e(o,m)??null:null,i=r===null?null:Jq(r);return n.jsxComponent.createAndFill({componentName:`WikiEmbedFile`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:g,target:o,anchor:c,alias:s,size:i,sourceTarget:l,sourceAnchor:u,sourceAlias:d}})}let v=s||(c?`${o}#${c}`:o);if(r.link){let t=r.link.create({href:g,title:null,linkStyle:`inline`,refLabel:null,sourceForm:`wikiembed`,target:o,anchor:c,alias:s,sourceTarget:l,sourceAnchor:u,sourceAlias:d});return e.text(v,[t])}throw Error("[wikiLinkEmbed handler] schema lacks `link` mark — cannot dispatch without violating the STOP rule against emitting PM wikiLinkEmbed server-side")}),n.mathInline&&(i.inlineMath=e=>n.mathInline.create({formula:e.value??``,sourceDelimiter:e.data?.sourceDelimiter??null})),i.math||=t=>{let r=t.value==null?`«unknown:${t.type}»`:t.value;return n.rawMdxFallback?(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled block mdast: ${t.type}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled block mdast: ${t.type}`},r?[e.text(r)]:null)):null},i.inlineMath||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled inline mdast: ${t.type}`})),t.value==null?e.text(`«unknown:${t.type}»`):e.text(t.value)),n.footnoteReference?i.footnoteReference=e=>n.footnoteReference.create({identifier:e.identifier,label:e.label??e.identifier}):i.footnoteReference||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteReference`,reason:`FootnoteReference extension missing — recovering [^id] source`})),e.text(`[^${t.label??t.identifier}]`)),n.footnoteDefinition?i.footnoteDefinition=BO(n.footnoteDefinition,e=>{let t=e;return{identifier:t.identifier,label:t.label??t.identifier}}):i.footnoteDefinition||=t=>{console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteDefinition`,reason:`FootnoteDefinition extension missing — recovering [^id]: marker`}));let r=`[^${t.label??t.identifier}]: `;return n.paragraph?n.paragraph.create(null,e.text(r)):null},i.rawMdxFallbackMdast=t=>{if(!n.rawMdxFallback)return null;let r=t.position?{start:t.position.start?.offset??0,end:t.position.end?.offset??0}:{start:0,end:0};return console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.originalType,reason:`Unhandled mdast: ${t.originalType}`,unresolvedPosition:t.unresolvedPosition??!1})),n.rawMdxFallback.createAndFill({reason:`Unhandled mdast: ${t.originalType}`,originalSpan:r},t.value?[e.text(t.value)]:null)},i}function oJ(e,t){let n={},r={},i=e.nodes,a=e.marks;i.paragraph&&(n.paragraph=GO(`paragraph`)),i.blockquote&&(n.blockquote=GO(`blockquote`,e=>{let t=e.attrs.sourceMarkerSpacings,n={};return Array.isArray(t)&&t.length>0&&(n.sourceMarkerSpacings=t),Object.keys(n).length>0?{data:n}:{}})),i.heading&&(n.heading=GO(`heading`,e=>({depth:e.attrs.level,data:{sourceStyle:e.attrs.headingStyle,sourceTrailingHashes:e.attrs.sourceTrailingHashes??void 0,sourceUnderlineLength:e.attrs.sourceUnderlineLength??void 0,sourceContiguousNext:e.attrs.sourceContiguousNext===!0||void 0,sourceLeadingIndent:e.attrs.sourceLeadingIndent??void 0,sourceInteriorSpacing:e.attrs.sourceInteriorSpacing??void 0}}))),i.codeBlock&&(n.codeBlock=e=>{let t=e.attrs.sourceStyle===`indented`?`indented`:`fenced`;return{type:`code`,lang:t===`indented`?null:e.attrs.language??null,meta:t===`indented`?null:e.attrs.meta??null,value:e.textContent??``,data:{sourceFenceChar:e.attrs.fenceDelimiter,sourceFenceLength:e.attrs.fenceLength,sourceStyle:t,sourceClosingFenceLength:e.attrs.sourceClosingFenceLength??void 0,sourceUnclosedFence:e.attrs.sourceUnclosedFence===!0||void 0,sourceFenceIndent:e.attrs.sourceFenceIndent??void 0,sourceInfoPadding:e.attrs.sourceInfoPadding??void 0,sourceIndents:e.attrs.sourceIndents??void 0}}}),i.thematicBreak&&(n.thematicBreak=e=>({type:`thematicBreak`,data:{sourceRaw:e.attrs.sourceRaw}})),i.hardBreak&&(n.hardBreak=e=>({type:`break`,data:{sourceStyle:e.attrs.hardBreakStyle,...typeof e.attrs.sourceRaw==`string`&&e.attrs.sourceRaw.length>0?{sourceRaw:e.attrs.sourceRaw}:{}}})),i.list&&(n.list=GO(`list`,e=>({ordered:e.attrs.ordered??!1,start:e.attrs.ordered?e.attrs.start??1:null,spread:e.attrs.spread??!1,data:{bulletMarker:e.attrs.bulletMarker,listMarkerDelimiter:e.attrs.listMarkerDelimiter}}))),i.listItem&&(n.listItem=(e,t,n)=>{let r=n.all(e),i=r.length>1&&eJ(r[0])?r.slice(1):r,a={};return typeof e.attrs.sourceMarkerSpacing==`number`&&(a.sourceMarkerSpacing=e.attrs.sourceMarkerSpacing),typeof e.attrs.sourceOrdinal==`number`&&(a.sourceOrdinal=e.attrs.sourceOrdinal),e.attrs.sourceCheckboxChar===`X`&&(a.sourceCheckboxChar=`X`),typeof e.attrs.sourceContinuationIndent==`number`&&(a.sourceContinuationIndent=e.attrs.sourceContinuationIndent),{type:`listItem`,checked:e.attrs.checked??null,spread:e.attrs.spread??!1,...Object.keys(a).length>0?{data:a}:{},children:i}}),i.table&&(n.table=(e,t,n)=>{let r=n.all(e),i=[],a=e.firstChild;a&&a.forEach(e=>{let t=e.attrs.align;i.push(t===`left`||t===`right`||t===`center`?t:null)});let o=r.filter(e=>e.type===`tableRow`),s=e.attrs.sourceDashCounts,c={};Array.isArray(s)&&s.length>0&&(c.sourceDashCounts=s);let l=e.attrs.sourceOuterPipes;typeof l==`object`&&l&&typeof l.leading==`boolean`&&typeof l.trailing==`boolean`&&(c.sourceOuterPipes=l);let u=e.attrs.sourceAlignmentPadding;Array.isArray(u)&&u.length>0&&(c.sourceAlignmentPadding=u);let d=Object.keys(c).length>0?c:void 0,f={type:`table`,align:i,children:o};return d&&(f.data=d),f}),i.tableRow&&(n.tableRow=GO(`tableRow`));let o=(e,t)=>{let n={type:`tableCell`,children:pV(t)},r=e.attrs.sourcePadding;return typeof r==`object`&&r&&typeof r.left==`number`&&typeof r.right==`number`&&(n.data={sourcePadding:r}),n};if(i.tableCell&&(n.tableCell=(e,t,n)=>o(e,n.all(e))),i.tableHeader&&(n.tableHeader=(e,t,n)=>o(e,n.all(e))),i.image&&(n.image=e=>({type:`image`,url:e.attrs.sourceUrl??e.attrs.src,alt:e.attrs.alt,title:e.attrs.title})),i.imageReference&&(n.imageReference=e=>{let t=e.attrs.label??``,n=e.attrs.identifier??t;return{type:`imageReference`,alt:e.attrs.alt??``,identifier:n,label:t||n,referenceType:e.attrs.referenceType??`shortcut`}}),i.htmlBlock&&(n.htmlBlock=e=>({type:`html`,value:e.attrs.content})),i.linkDefinition??i.linkRefDef){let e=i.linkDefinition?`linkDefinition`:`linkRefDef`;n[e]=e=>{let t={},n=e.attrs.sourceLayout;(n===`multiline`||n===`inline`)&&(t.sourceLayout=n);let r=e.attrs.sourceTitleMarker;(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r);let i={type:`definition`,identifier:e.attrs.identifier??e.attrs.label??``,label:e.attrs.label??e.attrs.identifier??``,url:e.attrs.url??e.attrs.href??``,title:e.attrs.title};return Object.keys(t).length>0&&(i.data=t),i}}if(i.jsxComponent&&(n.jsxComponent=(e,n,r)=>{if(e.attrs.kind===`expression`)return{type:`html`,value:e.attrs.sourceRaw??``};let i=e.attrs.componentName||null,a=Array.isArray(e.attrs.attributes)?e.attrs.attributes:[];return!$q(e,t.checker)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:i,attributes:a,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:Xq.getOrWildcard(i??`*`).serialize(e,{all:e=>r.all(e),registry:Xq,serializeChildren:()=>{throw Error(`SerializeContext.serializeChildren is not available in the PM→mdast handler. Compat descriptors that need markdown-byte body rendering must emit a marker mdast node and let the to-markdown handler render the body via state.containerFlow.`)}})}),i.rawMdxFallback&&(n.rawMdxFallback=e=>{let t=e.textContent??``,n=typeof e.attrs.reason==`string`?e.attrs.reason:``,r=e.attrs.originalSpan;return{type:`rawMdxFallback`,value:t,data:{reason:n,originalSpan:r&&typeof r==`object`&&`start`in r&&`end`in r?{start:Number(r.start)||0,end:Number(r.end)||0}:{start:0,end:0}}}}),i.jsxInline&&(n.jsxInline=e=>{let t=e.attrs.componentName||``;if(t&&e.attrs.sourceDirty)return vV(t,e,Xq.get(t)?.props);let n=e.attrs.attributes,r=e.attrs.sourceRaw||e.textContent||``;return{type:`mdxJsxTextElement`,name:t||null,attributes:Array.isArray(n)?n:[],children:[],data:{sourceRaw:String(r)}}}),i.mathInline&&(n.mathInline=e=>{let t=e.attrs.formula??``,n=e.attrs.id;if(typeof n==`string`&&n.length>0)return{type:`mdxJsxTextElement`,name:`InlineMath`,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t},{type:`mdxJsxAttribute`,name:`id`,value:n}],children:[]};let r=e.attrs.sourceDelimiter;return{type:`inlineMath`,value:t,...typeof r==`string`&&r.length>0?{data:{sourceDelimiter:r}}:{}}}),i.wikiLink&&(n.wikiLink=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLink`,value:i,data:{target:t,anchor:n,alias:r,sourceTarget:typeof e.attrs.sourceTarget==`string`?e.attrs.sourceTarget:null,sourceAnchor:typeof e.attrs.sourceAnchor==`string`?e.attrs.sourceAnchor:null,sourceAlias:typeof e.attrs.sourceAlias==`string`?e.attrs.sourceAlias:null},children:[{type:`text`,value:i}]}}),i.tag&&(n.tag=e=>({type:`tag`,value:String(e.attrs.value??``)})),i.wikiLinkEmbed&&(n.wikiLinkEmbed=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),a.emphasis&&(r.emphasis=KO(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.strong&&(r.strong=KO(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.code&&(r.code=(e,t,n)=>{let r=e.attrs.sourceFenceChar,i=e.attrs.sourceFenceLength;return nJ(n,{sourceFenceChar:r,sourceFenceLength:i,sourcePadded:e.attrs.sourcePadded===!0||void 0})}),a.strike??a.delete){let e=a.strike?`strike`:`delete`;r[e]=KO(`delete`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter===`~`?`~`:`~~`}}))}return a.highlight&&(r.highlight=KO(`mark`)),a.underline&&(r.underline=KO(`underline`,e=>({data:{sourceForm:e.attrs.sourceForm===`ins`?`ins`:`u`}}))),a.comment&&(r.comment=KO(`comment`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`}}))),i.commentBlock&&(n.commentBlock=GO(`commentBlock`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`,sourceLayout:e.attrs.sourceLayout===`inline`?`inline`:`block`}}))),i.footnoteReference&&(n.footnoteReference=e=>{let t=String(e.attrs.identifier??``);return{type:`footnoteReference`,identifier:t,label:e.attrs.label?String(e.attrs.label):t}}),i.footnoteDefinition&&(n.footnoteDefinition=GO(`footnoteDefinition`,e=>({identifier:String(e.attrs.identifier??``),label:e.attrs.label?String(e.attrs.label):String(e.attrs.identifier??``)}))),a.link&&(r.link=(e,t,n)=>{if(e.attrs.sourceForm===`wikiembed`){let t=typeof e.attrs.target==`string`&&e.attrs.target.length>0?e.attrs.target:e.attrs.href??``,r=typeof e.attrs.anchor==`string`&&e.attrs.anchor.length>0?e.attrs.anchor:null,i=typeof e.attrs.alias==`string`&&e.attrs.alias.length>0?e.attrs.alias:null,a=typeof e.attrs.sourceTarget==`string`?e.attrs.sourceTarget:null,o=typeof e.attrs.sourceAnchor==`string`?e.attrs.sourceAnchor:null,s=typeof e.attrs.sourceAlias==`string`?e.attrs.sourceAlias:null,c=i||(r?`${t}#${r}`:t),l=n.map(e=>`value`in e&&typeof e.value==`string`?e.value:``).join(``);return l!==c&&l.trim().length>0&&!l.includes(`]]`)&&(i=l,c=l),{type:`wikiLinkEmbed`,value:c,data:{target:t,anchor:r,alias:i,sourceTarget:a,sourceAnchor:o,sourceAlias:s},children:[{type:`text`,value:c}]}}let r=e.attrs.linkStyle;if(r===`autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`autolink`}};if(r===`gfm-autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`gfm-autolink`}};if(r===`inline`||!r){let t={};e.attrs.sourceUrlForm===`angle-bracketed`&&(t.sourceUrlForm=`angle-bracketed`);let r=e.attrs.sourceTitleMarker;return(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r),{type:`link`,url:e.attrs.href??``,title:e.attrs.title??null,children:n,...Object.keys(t).length>0?{data:t}:{}}}return{type:`linkReference`,identifier:(e.attrs.refLabel??``).toLowerCase(),label:e.attrs.refLabel,referenceType:r,children:n}}),a.escapeMark&&(r.escapeMark=(e,t,n)=>{for(let e of n)if(e.type===`text`&&e.value){let t=e;t.data??={},t.data.escapedChars??=[];for(let e=0;e<t.value.length;e++)t.data.escapedChars.push({offset:e,char:t.value[e]})}return n.length===1?n[0]:n}),a.sourceLiteral&&(r.sourceLiteral=(e,t,n)=>{let r=typeof e.attrs.sourceRaw==`string`?e.attrs.sourceRaw:``;if(n.length===1&&n[0]?.type===`text`){let e=n[0],t=r||e.value;return rB(t,e.value)&&(e.data??={},e.data.sourceRaw=t),e}return{type:`text`,value:n.filter(e=>e.type===`text`).map(e=>e.value??``).join(``)||r}}),{nodeHandlers:n,markHandlers:r}}const sJ={default:!0,MD013:!1};function cJ(e){return e??sJ}function lJ(e){let t=e.replace(/\\/g,`/`);for(;t.startsWith(`./`);)t=t.slice(2);let n=t.toLowerCase();for(let e of QR)if(n.endsWith(e))return t.slice(0,-e.length);return t}function uJ(e){let t=(e===void 0?[]:Array.isArray(e)?e:[e]).map(e=>e.trim()).filter(e=>e.length>0),n=[],r=[],i=[],a=[],o=0;for(let e of t){let t=e.startsWith(`!`),s=t?e.slice(1):e;if(t||(o+=1),s.length===0){n.push({pattern:e,detail:`empty pattern`});continue}try{let e=(0,VN.default)(s,{dot:!0,strictBrackets:!0});(t?a:i).push(e)}catch(t){n.push({pattern:e,detail:t instanceof Error?t.message:String(t)});continue}if(s.endsWith(`/`))r.push({pattern:e,reason:`trailing-slash`});else if(s.startsWith(`/`))r.push({pattern:e,reason:`leading-slash`});else{let t=s.toLowerCase();QR.some(e=>t.endsWith(e))&&r.push({pattern:e,reason:`doc-extension`})}}let s=o===0;return{invalidPatterns:n,suspiciousPatterns:r,matches(e){if(e===void 0||e===``)return!1;let t=lJ(e);return t===``||!(s||i.some(e=>e(t)))?!1:!a.some(e=>e(t))}}}function dJ(e,t){let n=new Set,r=[];for(let i of e){if(i.enabled===!1||!i.schema||!uJ(i.appliesTo).matches(t))continue;let e=i.key??i.file;n.has(e)||(n.add(e),r.push({file:i.file,schema:i.schema}))}return r}const fJ={"draft-06":`http://json-schema.org/draft-06/schema#`,"draft-07":`http://json-schema.org/draft-07/schema#`,"2019-09":`https://json-schema.org/draft/2019-09/schema`,"2020-12":`https://json-schema.org/draft/2020-12/schema`},pJ=Object.keys(fJ),mJ=new Map(pJ.map(e=>[hJ(fJ[e]),e]));function hJ(e){return e.replace(/^https?:\/\//,``).replace(/#$/,``)}function gJ(e){let t=e.$schema;return t===void 0?`draft-07`:typeof t==`string`?mJ.get(hJ(t))??null:null}const _J=new Map;function vJ(e){throw Error(`Unhandled FrontmatterSchemaDialect: ${JSON.stringify(e)}`)}function yJ(e){let t=_J.get(e);if(t)return t;let n={allErrors:!0,strict:!1},r;switch(e){case`2020-12`:r=new zN.default(n);break;case`2019-09`:r=new RN.default(n);break;case`draft-06`:case`draft-07`:r=new LN.default(n);break;default:return vJ(e)}return(0,BN.default)(r),_J.set(e,r),r}function Ihe(e){let{$schema:t,...n}=e;return n}function Lhe(e,t){let n=yJ(e),r=t.$id;return typeof r==`string`&&r!==``&&n.removeSchema(r),n.compile(Ihe(t))}const bJ=new Map;function Rhe(e){let t=JSON.stringify(e),n=bJ.get(t);if(n!==void 0)return n;let r=null,i=gJ(e);if(i!==null)try{r=Lhe(i,e)}catch{r=null}return bJ.size>=256&&bJ.clear(),bJ.set(t,r),r}function zhe(e){let t=new Map;if(!id.test(e))return{data:{},keyLines:t};let{frontmatter:n}=Iie(e),r=Lie(n);if(r.trim()===``)return{data:{},keyLines:t};let i=(0,cs.parseDocument)(r,{uniqueKeys:!1});if(i.errors.length>0)return{data:{},keyLines:t};let a=i.toJS();if(typeof a!=`object`||!a||Array.isArray(a))return{data:{},keyLines:t};if((0,cs.isMap)(i.contents))for(let e of i.contents.items){let n=e.key;if(!(0,cs.isScalar)(n)||typeof n.value!=`string`||!n.range)continue;let i=0,a=Math.min(n.range[0],r.length);for(let e=0;e<a;e++)r.charCodeAt(e)===10&&i++;t.has(n.value)||t.set(n.value,i+1)}return{data:a,keyLines:t}}const Bhe={"date-time":`an ISO 8601 datetime with an explicit UTC offset, for example "2026-09-23T00:00:00Z"`};function xJ(e){let t=e.format;return typeof t==`string`?Bhe[t]:void 0}function SJ(e){if(e===void 0)return``;let t;if(typeof e==`string`)t=`"${e}"`;else try{t=JSON.stringify(e)??String(e)}catch{t=String(e)}return t.length>60&&(t=`${t.slice(0,57)}…`),` (got ${t})`}function Vhe(e){if(!e.startsWith(`/`))return null;let t=e.slice(1).split(`/`)[0]??``;return t===``?null:t.replace(/~1/g,`/`).replace(/~0/g,`~`)}function Hhe(e){return e.split(`/`).slice(1).map(e=>e.replace(/~1/g,`/`).replace(/~0/g,`~`)).join(`.`)}function CJ(e,t,n){if(t.length===0)return[];let r=n?.source??`frontmatter`,{data:i,keyLines:a}=zhe(e),o=e.split(`
|
|
417
|
-
`),s=e=>({start:{line:e,character:0},end:{line:e,character:o[e]?.length??0}}),c=[];for(let{schema:e,ruleId:n}of t){let t=Rhe(e);if(t&&!t(i))for(let e of t.errors??[]){let t=e.keyword;if(t===`if`)continue;let o=0,l,u=`invalid`,d;if(t===`maxProperties`&&e.instancePath===``)l=`This document must not have frontmatter`;else if(t===`required`&&e.instancePath===``){let t=String(e.params.missingProperty??``);l=`Frontmatter property "${t}" is required`,u=`missing`,t!==``&&(d=t)}else if(e.instancePath===``)l=`Frontmatter ${e.message??`violates "${t}"`}`;else{let n=Vhe(e.instancePath);n!==null&&(o=a.get(n)??0);let r=Hhe(e.instancePath),s=n!==null&&r===n?i[n]:void 0;if(t===`enum`)l=`Frontmatter property "${r}" must be one of: ${(e.params.allowedValues??[]).map(String).join(`, `)}${
|
|
418
|
-
`),i=Ghe(t);return n.map(e=>qhe(e,r,Khe(e,i)))}function Ghe(e){let t=new Map;return Object.entries(e).forEach(([e,n],r)=>{let i=e.toUpperCase();if(i===`DEFAULT`)return;let a=null;if(n===`error`||n===`warning`)a=n;else if(typeof n==`object`&&n&&!Array.isArray(n)){let e=n.severity;(e===`error`||e===`warning`)&&(a=e)}a!==null&&t.set(i,{entryIndex:r,severity:a})}),t}function Khe(e,t){let n;for(let r of e.ruleNames){let e=t.get(r.toUpperCase());e!==void 0&&(n===void 0||e.entryIndex>n.entryIndex)&&(n=e)}return n?.severity??`warning`}function qhe(e,t,n){let[r,i]=e.errorRange??[1,null],a=e.lineNumber-1,o=(r??1)-1,s=t[a]?.length??0,c=i==null?s:Math.min(o+i,s),l=e.fixInfo?[Jhe(e.fixInfo,e.lineNumber,t)]:void 0;return{range:{start:{line:a,character:o},end:{line:a,character:Math.max(c,o)}},severity:n,source:`markdownlint`,code:e.ruleNames[0]??`MD000`,message:e.errorDetail?`${e.ruleDescription}: ${e.errorDetail}`:e.ruleDescription,...l?{fixes:l}:{}}}function Jhe(e,t,n){let r=e.lineNumber??t,i=r-1;if(e.deleteCount===-1){if(r<n.length)return{range:{start:{line:i,character:0},end:{line:i+1,character:0}},newText:``};if(i>0){let e=n[i-1]?.length??0;return{range:{start:{line:i-1,character:e},end:{line:i,character:n[i]?.length??0}},newText:``}}return{range:{start:{line:0,character:0},end:{line:0,character:n[0]?.length??0}},newText:``}}let a=(e.editColumn??1)-1;return{range:{start:{line:i,character:a},end:{line:i,character:a+Math.max(0,e.deleteCount??0)}},newText:e.insertText??``}}const Yhe=[`no-wiki-links`,`log-shape`,`index-shape`,`reserved-casing`,`frontmatter-required`,`frontmatter-recommended`,`frontmatter-provenance`,`frontmatter-computation`,`frontmatter-reserved-index`,`frontmatter-root-index`,`project-no-mdx`];function wJ(e,t){return e?.[t]!==!1}function Xhe(e){return`${e.replace(/^frontmatter-/,``)}.schema.json`}function TJ(e){return`.ok/okf/${Xhe(e)}`}const Zhe={$schema:`http://json-schema.org/draft-07/schema#`,title:`OKF v0.2 — required frontmatter`,description:"The OKF v0.2 conformance floor. A bundle is conformant when every non-reserved .md file contains a parseable YAML frontmatter block whose `type` is non-empty. This schema is the whole of that floor: a concept carrying only `type` is fully conformant. Section numbers cite OKF v0.2: https://github.com/GoogleCloudPlatform/open-knowledge-format/blob/ad30107c31c06aec8a7d5636e0d1058118604e6f/SPEC.md#11-conformance",type:`object`,required:[`type`],properties:{type:{type:`string`,pattern:`\\S`,description:"REQUIRED, and the only always-required key in OKF. A short string identifying the kind of concept; consumers use it for routing, filtering, and presentation. Type values are not registered centrally — pick something descriptive and self-explanatory (`BigQuery Table`, `BigQuery Dataset`, `API Endpoint`, `Metric`, `Playbook`, `Reference`, `Attested Computation`). Consumers must tolerate unknown types, typically by treating them as generic concepts. The `\\S` pattern is what makes §11 rule 2 mean what it says, and it replaces a `minLength` rather than joining one: a length check alone accepts a whitespace-only value that no consumer can route on, and having both would report one mistake twice. OKF v0.2 §4.1, §11."}}},EJ={$schema:`http://json-schema.org/draft-07/schema#`,title:`OKF v0.2 — recommended frontmatter`,description:"Shapes for the OKF v0.2 recommended keys. Every key here is optional, and nothing is constrained beyond the shape OKF states: declaring a key pins its YAML type when present (so `tags` written as a comma-separated string warns) and advertises it to agents at read time. Section numbers cite OKF v0.2: https://github.com/GoogleCloudPlatform/open-knowledge-format/blob/ad30107c31c06aec8a7d5636e0d1058118604e6f/SPEC.md#41-frontmatter",type:`object`,properties:{title:{type:`string`,description:`Human-readable display name. If omitted, consumers MAY derive a title from the filename. OKF v0.2 §4.1.`},description:{type:`string`,description:"A single sentence summarizing the concept. Used by `index.md` generators, search snippets, and previews. OKF v0.2 §4.1."},resource:{type:`string`,format:`uri-reference`,description:"A URI that uniquely identifies the underlying asset the concept describes. Absent for concepts that describe abstract ideas rather than physical resources. Path-valued: an absolute URL, a bundle-relative path beginning with `/`, or an ordinary relative path — hence `uri-reference`, not `uri`, which would reject `/tables/customers.md`. OKF v0.2 §4.1, §6.2."},tags:{type:`array`,items:{type:`string`},description:`A YAML list of short strings for cross-cutting categorization. Tags stay a first-class concept through this field; OKF specifies no separate per-tag file format, so a consumer that wants a tag-browsing view synthesizes one by scanning frontmatter. OKF v0.2 §3.1, §4.1.`},timestamp:{description:"LEGACY (OKF v0.1), superseded by `generated.at` in v0.2 — one of the two deliberate breaking changes. Consumers MAY fall back to it when `generated` is absent; new documents SHOULD write `generated: { by, at }` instead. Documented here so agents are told what it is and what replaced it, but deliberately left unconstrained: v0.2 does not define it as a producer field, so validating its shape would be a rule OKF no longer has. OKF v0.2 §5.2, §13.1."}}},Qhe={$schema:`http://json-schema.org/draft-07/schema#`,title:`OKF v0.2 — provenance, trust, and lifecycle frontmatter`,description:'The optional OKF v0.2 families that make "where did this come from", "how much should I trust it", and "is it still current" answerable from frontmatter alone. Every key is optional, and absence carries meaning rather than being an error: a concept with no `verified` is unverified, and a consumer must not reject it. Only `sources[].resource` and `generated.by` are required-when-their-parent-is-present, because those are the two fields OKF marks REQUIRED in this family; every other field is described but not mandated, so nothing else is enforced. Section numbers cite OKF v0.2: https://github.com/GoogleCloudPlatform/open-knowledge-format/blob/ad30107c31c06aec8a7d5636e0d1058118604e6f/SPEC.md#5-provenance-trust-and-lifecycle',type:`object`,properties:{sources:{type:`array`,description:"The materials this concept derives from, external or internal to the bundle. Lineage is expressed through links rather than a dedicated field: when an entry's `resource` points at another OKF concept, the derivation edge already exists in the bundle graph, so a consumer may recurse into that source's own `sources`. OKF v0.2 §5.1.",items:{type:`object`,required:[`resource`],properties:{resource:{type:`string`,description:"REQUIRED within an entry. Either a concrete artifact a consumer can follow (an absolute URL, a bundle-relative path, or a path into a `references/` subdirectory) or a population or scope descriptor it cannot, for example `all queries in BigQuery project X`. Deliberately NOT format-constrained: a scope descriptor is prose, so a `uri-reference` check here would warn on conformant documents. OKF v0.2 §5.1, §6.2, §6.3."},id:{type:`string`,description:"Optional. A stable key used to attribute individual claims: a markdown footnote whose label is this id (`[^ga4-schema]`) attributes the claim it follows. SHOULD be present when the body cites the source. Keyed rather than positional because agents constantly rewrite these documents — a positional index misattributes silently the moment the list is reordered. OKF v0.2 §5.1."},title:{type:`string`,description:`Optional. Human-readable label for the source. OKF v0.2 §5.1.`},author:{type:`string`,description:"Optional credibility signal — an authority signal: who or what produced the source. OKF describes this as following the actor convention (§7), but its own examples use a `team:<id>` prefix that the three §7 forms do not cover, so no pattern is enforced. OKF v0.2 §5.1, §7."},usage_count:{type:`integer`,description:"Optional credibility signal — an adoption and liveness signal: how often `resource` was exercised (dashboard views, query executions, page reads) over `usage_window`. For a single artifact it is that artifact's own exercise count; for a scope descriptor it is the number of exercises within the scope that touch the concept. Coarse by design: comparable at the alive-versus-dead and order-of-magnitude level and against a source's own history, but not a precise cross-kind ranking. Read as liveness and trend, not as a score. OKF v0.2 §5.1."},last_modified:{type:`string`,format:`date-time`,description:"Optional credibility signal — a recency signal: when the source itself last changed, as an ISO 8601 datetime with an explicit UTC offset (`2026-06-15T00:00:00Z`). Distinct from `generated.at`, which records when the concept was written. OKF v0.2 §5, §5.1."},usage_window:{type:`object`,description:"Optional per-entry override of the `usage_window` written as a sibling of `sources`. OKF v0.2 §5.1.",properties:{from:{type:`string`,format:`date-time`,description:"Start of the window framing this entry's `usage_count`, as an ISO 8601 datetime with an explicit UTC offset (`2026-06-01T00:00:00Z`). OKF v0.2 §5, §5.1."},to:{type:`string`,format:`date-time`,description:"End of the window framing this entry's `usage_count`, as an ISO 8601 datetime with an explicit UTC offset (`2026-06-30T00:00:00Z`). OKF v0.2 §5, §5.1."}}}}}},usage_window:{type:`object`,description:"Written once as a sibling of `sources`, this frames every `usage_count` in the list with a `{ from, to }` range. A single entry may carry its own `usage_window` to override it. OKF v0.2 §5, §5.1.",properties:{from:{type:`string`,format:`date-time`,description:"Start of the shared usage window, as an ISO 8601 datetime with an explicit UTC offset (`2026-06-01T00:00:00Z`). OKF v0.2 §5, §5.1."},to:{type:`string`,format:`date-time`,description:"End of the shared usage window, as an ISO 8601 datetime with an explicit UTC offset (`2026-06-30T00:00:00Z`). OKF v0.2 §5, §5.1."}}},generated:{type:`object`,required:[`by`],description:"How the current content was produced. Kept distinct from `verified` because who wrote a concept need not be who confirmed it. OKF v0.2 §5.2.",properties:{by:{type:`string`,description:"REQUIRED within `generated`. An actor in the OKF convention: `<producer>/<version>` for agents and tools (`reference_agent/gemini-2.5-pro`), `human:<id>` for a person (`human:ahormati`), or `process:<id>` for an automated process (`process:finance-nightly`). Consumers that classify trust key off the `human:` prefix, so producers MUST use it for hand-authored or human-confirmed content — a rule about which form to pick for which content, which frontmatter alone cannot check, so the three forms are documented here rather than enforced by a pattern. OKF v0.2 §5.2, §7."},at:{type:`string`,format:`date-time`,description:"An ISO 8601 datetime with an explicit UTC offset (`2026-06-30T14:00:00Z`) marking the content's last meaningful change. Consumers use it to tell a recent edit from a stale fact. Supersedes v0.1's top-level `timestamp`. OKF v0.2 §5, §5.2, §13.1."}}},verified:{description:'Who or what has confirmed the content against its sources or `resource` — a list of verification events. Multiple entries capture independent checks, for example a human sign-off plus a nightly process; "how recently" is the latest `at`. Independent of `generated.at`: content can change without re-confirmation, and facts can be re-confirmed without regeneration. A single verifier MAY be written as one bare `{ by, at }` mapping without the list dash, and consumers MUST treat that as a one-element list — hence the two accepted shapes here. Absence means unverified, which is a valid state, never a rejection. OKF v0.2 §5.2, §5.3, §11.',anyOf:[{type:`object`,description:`The bare single-verifier mapping form. OKF v0.2 §5.2.`,properties:{by:{type:`string`,description:"The verifying actor: `<producer>/<version>`, `human:<id>`, or `process:<id>`. A `human:` verifier is what raises the trust tier to human-reviewed; non-human verifiers alone yield machine-confirmed. OKF v0.2 §5.2, §5.3, §7."},at:{type:`string`,format:`date-time`,description:"An ISO 8601 datetime with an explicit UTC offset (`2026-07-01T09:00:00Z`) recording when the verification event happened. OKF v0.2 §5, §5.2."}}},{type:`array`,description:`The list form: one entry per independent verification event. OKF v0.2 §5.2.`,items:{type:`object`,properties:{by:{type:`string`,description:"The verifying actor: `<producer>/<version>`, `human:<id>`, or `process:<id>`. A `human:` verifier is what raises the trust tier to human-reviewed; non-human verifiers alone yield machine-confirmed. OKF v0.2 §5.2, §5.3, §7."},at:{type:`string`,format:`date-time`,description:"An ISO 8601 datetime with an explicit UTC offset (`2026-07-01T09:00:00Z`) recording when the verification event happened. OKF v0.2 §5, §5.2."}}}}]},status:{enum:[`draft`,`stable`,`deprecated`],description:"Lifecycle state. `draft` = not yet reviewed, possibly incomplete. `stable` = ready for consumption. `deprecated` = kept for links and history, no longer current. Absent means `stable`, so the key is only worth writing to say draft or deprecated. These three values are the whole set OKF defines, which is why this is the pack's only enum. OKF v0.2 §5.4."},stale_after:{type:`string`,format:`date-time`,description:"An absolute instant, an ISO 8601 datetime with an explicit UTC offset (`2026-12-31T00:00:00Z`): the concept is stale when `now >= stale_after`. Absolute rather than a relative TTL so staleness stays a plain comparison with no reference to when the concept was read. An instant in the past is a freshness signal for consumers, not a violation. OKF v0.2 §5, §5.5, §10.5."}}},$he={$schema:`http://json-schema.org/draft-07/schema#`,title:`OKF v0.2 — Attested Computation frontmatter`,description:'Shapes for the OKF v0.2 computation keys, which turn a concept into a sanctioned way to compute a value so a consumer can confirm the agent ran the blessed computation instead of improvising its own. Provenance answers "where did this claim come from"; attestation answers "was this number produced the way we said it must be". This file also carries the one value-shaped rule in the pack: `runtime` is the single key OKF marks REQUIRED here, and only when `type` is `Attested Computation`. Ordinary concepts never match that condition and are unaffected, and no other key in the family is mandated. OKF records the computation and the means to check it and executes nothing itself; receipts and verdicts are runtime artifacts that are never stored in the bundle. Section numbers cite OKF v0.2: https://github.com/GoogleCloudPlatform/open-knowledge-format/blob/ad30107c31c06aec8a7d5636e0d1058118604e6f/SPEC.md#10-attested-computations-concept',type:`object`,if:{required:[`type`],properties:{type:{const:`Attested Computation`,description:"The condition, not a constraint: everything in `then` applies only to documents whose `type` is exactly `Attested Computation`. An ordinary concept never matches, so nothing in this schema is ever asked of it. `type` is also required inside the condition so a document with no type at all fails the conformance floor once, rather than also being told it is missing a `runtime` for a type it never claimed."}}},then:{required:[`runtime`]},properties:{runtime:{type:`string`,description:"REQUIRED for `type: Attested Computation`. The single field that says how to run the computation, and therefore how the executor and attester interpret it and what `parameters` mean — a parameter is a SQL bind variable, a dbt var, or a Python argument depending on the runtime. Keeping `runtime` and `parameters` in one frontmatter is what makes the binding semantics self-evident. Example values: `bigquery`, `postgres`, `dbt`, `python`, `Looker`. Not a closed set, so no enum. OKF v0.2 §10.1, §10.2."},parameters:{type:`array`,description:`The typed, named holes the agent may fill. An agent MAY only supply values for these parameters; it MUST NOT author or edit the computation. That parameter-only surface is what makes "did the sanctioned thing run" a mechanical comparison rather than a judgement call. OKF v0.2 §10.2, §10.3.`,items:{type:`object`,properties:{name:{type:`string`,description:"The parameter name the computation binds, for example `year` bound as `@year` in BigQuery SQL or `{{ var('year') }}` in dbt. OKF v0.2 §10.2, §10.3."},type:{type:`string`,description:"The parameter's type, interpreted by `runtime` (`integer`, `string`, and so on). Deliberately not constrained to JSON Schema type names, because the vocabulary belongs to the runtime. OKF v0.2 §10.2."},required:{type:`boolean`,description:`Whether the agent must supply a value for this parameter. OKF v0.2 §10.2.`}}}},computation:{type:`string`,format:`uri-reference`,description:"Optional. A path to a file holding the computation, used instead of an inline body fence — best for a long or generated computation, or one already kept as a real file shared with non-OKF tooling. When absent, the body's `# Computation` fence IS the computation. Path-valued: an absolute URL, a bundle-relative path beginning with `/`, or a relative path. OKF v0.2 §6.2, §10.2, §10.3."},executor:{type:`object`,description:"How the computation is run. A runner — an agent, or deterministic consumer code — follows `resource`, and the run returns a receipt shaped by `receipt`. Binding the computation with the parameter values into the executable artifact is the consumer's job. OKF v0.2 §10.2, §10.5.",properties:{resource:{type:`string`,format:`uri-reference`,description:"Names the run instructions or code. What sits behind it — a Skill, a script, a container — is a packaging choice; OKF fixes the interface, not the packaging. Conventionally points into a `references/` subdirectory, for example `references/skills/run-on-bq.md`. OKF v0.2 §1, §6.2, §6.3, §10.2."},receipt:{type:`array`,items:{type:`string`},description:"Declares the fields a run must return — the evidence the attester inspects, for example `[job_id, executed_sql, result]` for BigQuery or `[run_id, compiled_sql, result]` for dbt. Because the attester compares the expanded, compiled artifact the receipt carries, a rewritten query, a swapped computation file, or a mutated dependency fails the check. The receipt itself is a runtime artifact and is never stored in the bundle. OKF v0.2 §10.2, §10.3, §10.5."}}},attester:{type:`object`,description:"The deterministic check that inspects a receipt and returns a verdict. Meant to run consumer-side. Distinct from `verified`: `verified` confirms the definition still matches policy and is recorded in the bundle, while attestation confirms a single run produced the value the sanctioned way and is not stored. OKF v0.2 §10.2, §10.6.",properties:{resource:{type:`string`,format:`uri-reference`,description:"Names code — no LLM — that takes a receipt and returns a verdict, independently re-deriving the binding of `computation` with the claimed parameter values to compare against what actually ran. Conventionally points into a `references/` subdirectory, for example `references/attesters/sql-equality.py`. OKF v0.2 §6.2, §6.3, §10.2, §10.3."}}}}},ege={$schema:`http://json-schema.org/draft-07/schema#`,title:`OKF v0.2 — index files carry no frontmatter`,description:"`index.md` is a reserved filename at any level of the hierarchy and must not be used for a concept document. Index files contain no frontmatter, with exactly one exception — a bundle-root `index.md` may carry `okf_version` — which the scope carves out with a `!index` exclusion rather than a keyword here. `maxProperties: 0` is the mechanism rather than the boolean schema `false`, because a document with no frontmatter block validates as `{}` and `false` would reject that too, flagging the very documents that are correct. `log.md` is deliberately NOT covered: §9 constrains a log's date headings, ordering, and prose entries but never its frontmatter, and OKF's own reference bundle ships a `log.md` carrying `type` and `title`. Section numbers cite OKF v0.2: https://github.com/GoogleCloudPlatform/open-knowledge-format/blob/ad30107c31c06aec8a7d5636e0d1058118604e6f/SPEC.md#8-index-files",type:`object`,maxProperties:0},tge={$schema:`http://json-schema.org/draft-07/schema#`,title:`OKF v0.2 — bundle-root index.md`,description:"The bundle-root `index.md` is the only index file OKF permits frontmatter in, and `okf_version` is the key it names there. OKF states the declaration as a MAY, so it is not required here. Nor is the frontmatter closed to other keys: §8 grants the exception for `okf_version` specifically, but §11 tells consumers not to reject a bundle over unknown additional keys, and that ambiguity is resolved in favor of the looser reading. The one thing pinned is the value's shape, because a YAML float is provably lossy where a version string is not. Section numbers cite OKF v0.2: https://github.com/GoogleCloudPlatform/open-knowledge-format/blob/ad30107c31c06aec8a7d5636e0d1058118604e6f/SPEC.md#12-versioning",type:`object`,properties:{okf_version:{type:`string`,pattern:`^[0-9]+\\.[0-9]+$`,description:'The OKF version this bundle targets, as `<major>.<minor>` — currently `"0.2"`. Quote it: unquoted `0.2` parses as a YAML number, so a consumer comparing version strings sees a float instead, and `0.10` would silently become `0.1`. A minor bump is backward-compatible additions; a major bump may rename required fields or change reserved filenames. Consumers that do not understand the declared version should attempt best-effort consumption rather than refusing the bundle. OKF v0.2 §12.'}}},DJ=[`**`,`!**/{index,log}`],OJ=[{id:`frontmatter-required`,appliesTo:DJ,schema:Zhe},{id:`frontmatter-recommended`,appliesTo:DJ,schema:EJ},{id:`frontmatter-provenance`,appliesTo:DJ,schema:Qhe},{id:`frontmatter-computation`,appliesTo:DJ,schema:$he},{id:`frontmatter-reserved-index`,appliesTo:[`**/index`,`!index`],schema:ege},{id:`frontmatter-root-index`,appliesTo:[`index`],schema:tge}],nge=Object.fromEntries(Yhe.filter(e=>!OJ.some(t=>t.id===e)).map(e=>[e,!1]));function kJ(e,t){return t===void 0?[]:OJ.filter(n=>wJ(e,n.id)&&uJ([...n.appliesTo]).matches(t))}function rge(e){return OJ.filter(t=>wJ(e,t.id)).map(e=>({appliesTo:[...e.appliesTo],file:TJ(e.id)}))}function ige(e,t,n){let r=kJ(t,n);return r.length===0?[]:CJ(e,r.map(e=>({file:TJ(e.id),schema:e.schema,ruleId:e.id})),{source:`okf`})}function AJ(e,t){return FL(`okf:${e}`,(n,r)=>{try{t(n,r)}catch(t){console.warn(`[lint] OKF rule "${e}" failed${r.data.okfDocName?` on "${r.data.okfDocName}"`:``}`,t)}})}function jJ(e,t,n){let r=uJ(t);return AJ(e,(e,t)=>{r.matches(t.data.okfDocName)&&n(e,t)})}const MJ=e=>({line:e.line-1,character:e.column-1});function age(e,t){if(e&&`start`in e)return{start:MJ(e.start),end:MJ(e.end)};if(e){let n=MJ(e);return{start:n,end:{line:n.line,character:t[n.line]?.length??0}}}return{start:{line:0,character:0},end:{line:0,character:t[0]?.length??0}}}function oge(e,t){return{range:age(e.place,t),severity:`warning`,source:`okf`,code:e.ruleId??`okf`,message:e.reason}}function sge(e,t,n){if(t.length===0)return[];let r=kO().use(pA).use(wO).use(fk,[`yaml`]);for(let e of t)r.use(e);let i=new hE({value:e});n!==void 0&&(i.data.okfDocName=n);let a=r.parse(i);r.runSync(a,i);let o=e.split(`
|
|
419
|
-
`);return i.messages.map(e=>
|
|
420
|
-
`?(c+=1,l=1):l+=1;return{line:c,column:l}};for(let e of o.matchAll(mge)){let{index:i}=e;if((a===void 0?o[i-1]:n[a+i-1])===`!`)continue;let s=r&&a!==void 0?{start:u(i),end:u(i+e[0].length)}:void 0;t.message(hge(e[0]),s)}})}),_ge=[`index`,`log`],vge=AJ(`reserved-casing`,(e,t)=>{let n=t.data.okfDocName;if(n===void 0)return;let r=tz(n),i=r.toLowerCase();_ge.includes(i)&&r!==i&&t.message(`This file is named "${r}", but the Open Knowledge Format only recognizes "${i}". On a case-sensitive filesystem a consumer reads it as an ordinary concept document rather than the reserved file it is meant to be.`)}),PJ=[{id:`no-wiki-links`,rule:gge},{id:`log-shape`,rule:pge},{id:`index-shape`,rule:lge},{id:`reserved-casing`,rule:vge}],yge=PJ.map(e=>e.rule);function bge(e){return e===void 0?yge:PJ.filter(t=>wJ(e,t.id)).map(e=>e.rule)}const xge=V([L(),U(die),H(F(),R())]),Sge={id:`markdownlint`,sliceSchema:B({enabled:L(),rules:H(F(),xge)}),defaultSlice:{enabled:!1,rules:sJ},async lint(e,t){return Whe(e,cJ(t.rules))},fix(e,t){return Uhe(e,cJ(t.rules))}},Cge=B({appliesTo:V([F(),z(F())]).optional(),file:F(),enabled:L().optional(),key:F().optional(),schema:H(F(),R()).optional()}),FJ=[Sge,{id:`frontmatter`,sliceSchema:B({enabled:L(),schemas:z(Cge)}),defaultSlice:{enabled:!1,schemas:[]},async lint(e,t,n){return CJ(e,dJ(t.schemas,n.docName))},frontmatter:{schemasForDoc:(e,t)=>dJ(e.schemas,t),narrowSliceToFrontmatter:e=>e,advertisedMappings:e=>e.schemas}},{id:`okf`,sliceSchema:B({enabled:L(),rules:H(F(),L()).optional(),generate:B({index:L().optional()}).optional()}),defaultSlice:{enabled:!1},async lint(e,t,n){return[...sge(e,bge(t.rules),n.docName),...ige(e,t.rules,n.docName)]},frontmatter:{schemasForDoc:(e,t)=>kJ(e.rules,t),narrowSliceToFrontmatter:e=>({...e,rules:{...e.rules,...nge}}),advertisedMappings:e=>rge(e.rules)}}];Object.fromEntries(FJ.map(e=>[e.id,e.defaultSlice])),B({docName:PB,summary:LB,content:F().optional(),...IB}).loose(),B({docName:PB,summary:LB,markdown:F(),position:U([`append`,`prepend`,`replace`]).optional(),extension:U(QR).optional(),...IB}).loose(),B({docName:PB,summary:LB,find:F().min(1),replace:F(),offset:I().int().nonnegative().optional(),...IB}).loose(),B({docName:PB,connectionId:F().min(1),scope:U([`last`,`session`,`file`,`count`]).optional(),count:I().int().positive().optional(),...IB}).loose().refine(e=>e.scope!==`count`||e.count!==void 0,{message:`count is required when scope is 'count'`,path:[`count`]});const IJ=B({value:F(),truncatedFrom:I().int().nonnegative().optional(),hint:F().optional()}).loose(),wge=ui(`kind`,[B({kind:W(`inline`),content:F()}),B({kind:W(`truncated`),byteLength:I().int().nonnegative(),hint:F()})]),LJ=B({kind:W(`content-divergence`),intendedBytes:I().int().nonnegative(),actualBytes:I().int().nonnegative(),byteDelta:I().int(),divergenceType:F().optional(),currentState:wge.optional(),hint:F().optional()}).loose(),Tge=B({type:W(`orphan`),parentCandidates:z(F()),message:F()}).loose(),RJ=B({kind:W(`disk-edit-reconciled`),intendedBytes:I().int().nonnegative(),actualBytes:I().int().nonnegative(),byteDelta:I().int(),mergeOutcome:F().optional(),hint:F().optional()}).loose();ui(`kind`,[LJ,RJ]);const Ege=Object.keys({"content-divergence":!0,"disk-edit-reconciled":!0}),Dge=B({kind:W(`mermaid-parse-error`),fenceIndex:I().int().positive(),fenceFirstLine:F(),message:F(),line:I().int().positive().optional()}).loose(),zJ=B({href:F(),targetKind:F(),role:F(),sourceForm:F(),resolvedTarget:F().nullable(),reason:F(),resolutionMethod:F(),fallbackTarget:F().nullable().optional(),definition:B({line:I().int().nonnegative(),label:F()}).loose().optional()}).loose(),BJ=ui(`kind`,[LJ,RJ,Dge,B({kind:W(`lint-violation`),source:F(),code:F(),message:F(),severity:U([`error`,`warning`,`info`,`hint`]),line:I().int().positive(),column:I().int().positive(),linkTarget:F().optional(),localTarget:zJ.optional()}).loose()]),VJ=z(BJ).min(1),HJ=B({href:F(),resolvedTo:F().nullable(),reason:U([`no-such-doc`,`no-such-file`,`unresolvable`]),localTarget:zJ.optional()}).loose(),UJ=z(HJ),WJ=B({reason:F().min(1),count:I().int().positive()}).loose();B({timestamp:F().min(1),summary:IJ.optional(),warnings:VJ.optional()}).loose(),B({timestamp:F().min(1),subscriberCount:I().int().nonnegative(),systemSubscriberCount:I().int().nonnegative(),hints:z(Tge).optional(),summary:IJ.optional(),warnings:VJ.optional(),brokenLinks:UJ,brokenLinkSuppression:WJ.optional()}).loose(),B({timestamp:F().min(1),subscriberCount:I().int().nonnegative(),systemSubscriberCount:I().int().nonnegative(),summary:IJ.optional(),warnings:VJ.optional(),brokenLinks:UJ,brokenLinkSuppression:WJ.optional()}).loose(),B({docName:F().min(1),scope:U([`last`,`session`,`count`]),undone:L()}).loose(),B({docs:z(B({docName:FB,markdown:F(),position:U([`append`,`prepend`,`replace`]).optional(),extension:U(QR).optional(),summary:LB}).loose()).min(1).max(100),...IB}).loose();const Oge=B({type:ZB,title:F(),detail:F().optional()}).loose(),kge=ui(`status`,[B({status:W(`written`),docName:F().min(1),summary:IJ.optional(),warnings:VJ.optional(),brokenLinks:UJ,brokenLinkSuppression:WJ.optional()}).loose(),B({status:W(`error`),docName:F().min(1),error:Oge}).loose()]);B({timestamp:F().min(1),results:z(kge),written:I().int().nonnegative(),failed:I().int().nonnegative()}).loose(),B({docName:PB,patch:H(F(),V([nd,ni()])),types:H(F(),U(ed)).optional(),summary:LB,...IB}).loose(),B({timestamp:F().min(1),subscriberCount:I().int().nonnegative(),systemSubscriberCount:I().int().nonnegative(),appliedKeys:z(F()),summary:IJ.optional(),warnings:VJ.optional(),brokenLinks:UJ,brokenLinkSuppression:WJ.optional()}).loose();const Age=Object.fromEntries(FJ.map(e=>[e.id,e.sliceSchema]));B({effective:B({enabled:L(),plugins:B(Age)}),configFile:F().nullable().optional(),configProblems:z(F()).optional()});const jge=V([L(),H(F(),R())]),Mge=new Set([`__proto__`]),GJ=F().min(1).max(256).refine(e=>!Mge.has(e),{message:`schema property name cannot be __proto__`});B({ruleId:F().min(1).max(64).regex(/^[A-Za-z][A-Za-z0-9_-]*$/),value:V([jge,ni()])}),B({file:F().min(1).max(512),delete:W(!0).optional(),field:GJ.optional(),parentPath:z(V([GJ,B({items:W(!0)}).strict()])).max(8).optional(),removeField:W(!0).optional(),renameTo:GJ.optional(),constraint:B({type:U([`string`,`number`,`boolean`,`array`,`object`]).nullable().optional(),enum:z(V([F(),I(),L()])).nullable().optional(),itemsEnum:z(V([F(),I(),L()])).nullable().optional(),itemsType:U([`string`,`number`,`boolean`,`object`]).nullable().optional(),pattern:F().nullable().optional(),format:F().nullable().optional(),description:F().max(2048).nullable().optional(),required:L().optional()}).optional()}).refine(e=>e.delete===void 0||e.field===void 0&&e.constraint===void 0&&e.removeField===void 0&&e.renameTo===void 0,{message:`delete cannot be combined with a field edit`}).refine(e=>[e.constraint,e.removeField,e.renameTo].filter(e=>e!==void 0).length<=1,{message:`constraint, removeField, and renameTo are mutually exclusive`}).refine(e=>e.removeField===void 0&&e.renameTo===void 0||e.field!==void 0,{message:`removeField and renameTo require field`}).refine(e=>e.parentPath===void 0||e.field!==void 0,{message:`parentPath requires field`}).refine(e=>e.field===void 0?e.constraint===void 0:e.constraint!==void 0||e.removeField!==void 0||e.renameTo!==void 0,{message:`field requires constraint, removeField, or renameTo`}),B({schemas:z(F()),truncated:L()}).strict();const KJ=B({line:I(),character:I()}),qJ=B({start:KJ,end:KJ}),JJ=B({range:qJ,severity:U([`error`,`warning`,`info`,`hint`]),source:F(),code:F(),message:F(),fixes:z(B({range:qJ,newText:F()})).optional(),frontmatterScope:U(lie).optional(),frontmatterProperty:F().optional()}),YJ=z(F()).optional();B({files:z(B({file:F(),diagnostics:z(JJ),ran:YJ,warnings:z(F()).optional()})),fileCount:I(),errorCount:I(),warningCount:I(),warnings:z(F()),ran:YJ});const Nge=JJ.extend({linkTarget:F().optional(),localTarget:zJ.optional()});B({files:z(B({file:F(),diagnostics:z(Nge)})),fileCount:I(),errorCount:I(),warningCount:I(),warnings:z(F()),ran:YJ,brokenLinkSuppression:WJ.optional()});const XJ=B({errorCount:I().int().nonnegative(),warningCount:I().int().nonnegative()});B({files:z(B({file:F(),lint:XJ,links:XJ})),fileCount:I().int().nonnegative(),errorCount:I().int().nonnegative(),warningCount:I().int().nonnegative(),warnings:z(F()),brokenLinkSuppression:WJ.optional()}),B({docName:PB,summary:LB,...IB}).loose();const Pge=B({reason:U([`re-lint-threw`,`source-went-blind`]),message:F().min(1)});B({file:F(),fixedCount:I(),diagnostics:z(JJ),errorCount:I(),warningCount:I(),ran:YJ,warnings:z(F()).optional(),diagnosticsArePreFix:L().optional(),reLintFailure:Pge.optional()});const Fge=[{id:`MD001`,alias:`heading-increment`,aliases:[`heading-increment`],name:`Heading levels should only increment by one level at a time`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md001.md`,tags:[`headings`],options:[{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`}]},{id:`MD003`,alias:`heading-style`,aliases:[`heading-style`],name:`Heading style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md003.md`,tags:[`headings`],options:[{key:`style`,type:`enum`,description:`Heading style`,enum:[`consistent`,`atx`,`atx_closed`,`setext`,`setext_with_atx`,`setext_with_atx_closed`],default:`consistent`}]},{id:`MD004`,alias:`ul-style`,aliases:[`ul-style`],name:`Unordered list style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md004.md`,tags:[`bullet`,`ul`],options:[{key:`style`,type:`enum`,description:`List style`,enum:[`consistent`,`asterisk`,`plus`,`dash`,`sublist`],default:`consistent`}]},{id:`MD005`,alias:`list-indent`,aliases:[`list-indent`],name:`Inconsistent indentation for list items at the same level`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md005.md`,tags:[`bullet`,`ul`,`indentation`],options:[]},{id:`MD007`,alias:`ul-indent`,aliases:[`ul-indent`],name:`Unordered list indentation`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md007.md`,tags:[`bullet`,`ul`,`indentation`],options:[{key:`indent`,type:`integer`,description:`Spaces for indent`,default:2,minimum:1},{key:`start_indented`,type:`boolean`,description:`Whether to indent the first level of the list`,default:!1},{key:`start_indent`,type:`integer`,description:`Spaces for first level indent (when start_indented is set)`,default:2,minimum:1}]},{id:`MD009`,alias:`no-trailing-spaces`,aliases:[`no-trailing-spaces`],name:`Trailing spaces`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md009.md`,tags:[`whitespace`],options:[{key:`br_spaces`,type:`integer`,description:`Spaces for line break`,default:2,minimum:0},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!1},{key:`list_item_empty_lines`,type:`boolean`,description:`Allow spaces for empty lines in list items`,default:!1},{key:`strict`,type:`boolean`,description:`Include unnecessary breaks`,default:!1}]},{id:`MD010`,alias:`no-hard-tabs`,aliases:[`no-hard-tabs`],name:`Hard tabs`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md010.md`,tags:[`whitespace`,`hard_tab`],options:[{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`ignore_code_languages`,type:`string-array`,description:`Fenced code languages to ignore`,default:[]},{key:`spaces_per_tab`,type:`integer`,description:`Number of spaces for each hard tab`,default:1,minimum:0}]},{id:`MD011`,alias:`no-reversed-links`,aliases:[`no-reversed-links`],name:`Reversed link syntax`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md011.md`,tags:[`links`],options:[]},{id:`MD012`,alias:`no-multiple-blanks`,aliases:[`no-multiple-blanks`],name:`Multiple consecutive blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md012.md`,tags:[`whitespace`,`blank_lines`],options:[{key:`maximum`,type:`integer`,description:`Consecutive blank lines`,default:1,minimum:1}]},{id:`MD013`,alias:`line-length`,aliases:[`line-length`],name:`Line length`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md013.md`,tags:[`line_length`],options:[{key:`line_length`,type:`integer`,description:`Number of characters`,default:80,minimum:1},{key:`heading_line_length`,type:`integer`,description:`Number of characters for headings`,default:80,minimum:1},{key:`code_block_line_length`,type:`integer`,description:`Number of characters for code blocks`,default:80,minimum:1},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`tables`,type:`boolean`,description:`Include tables`,default:!0},{key:`headings`,type:`boolean`,description:`Include headings`,default:!0},{key:`strict`,type:`boolean`,description:`Strict length checking`,default:!1},{key:`stern`,type:`boolean`,description:`Stern length checking`,default:!1}]},{id:`MD014`,alias:`commands-show-output`,aliases:[`commands-show-output`],name:`Dollar signs used before commands without showing output`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md014.md`,tags:[`code`],options:[]},{id:`MD018`,alias:`no-missing-space-atx`,aliases:[`no-missing-space-atx`],name:`No space after hash on atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md018.md`,tags:[`headings`,`atx`,`spaces`],options:[]},{id:`MD019`,alias:`no-multiple-space-atx`,aliases:[`no-multiple-space-atx`],name:`Multiple spaces after hash on atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md019.md`,tags:[`headings`,`atx`,`spaces`],options:[]},{id:`MD020`,alias:`no-missing-space-closed-atx`,aliases:[`no-missing-space-closed-atx`],name:`No space inside hashes on closed atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md020.md`,tags:[`headings`,`spaces`,`atx_closed`],options:[]},{id:`MD021`,alias:`no-multiple-space-closed-atx`,aliases:[`no-multiple-space-closed-atx`],name:`Multiple spaces inside hashes on closed atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md021.md`,tags:[`headings`,`spaces`,`atx_closed`],options:[]},{id:`MD022`,alias:`blanks-around-headings`,aliases:[`blanks-around-headings`],name:`Headings should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md022.md`,tags:[`headings`,`blank_lines`],options:[{key:`include_front_matter`,type:`boolean`,description:`Include front matter content`,default:!1},{key:`lines_above`,type:`unsupported`,description:`Blank lines above heading`,default:1},{key:`lines_below`,type:`unsupported`,description:`Blank lines below heading`,default:1}]},{id:`MD023`,alias:`heading-start-left`,aliases:[`heading-start-left`],name:`Headings must start at the beginning of the line`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md023.md`,tags:[`headings`,`spaces`],options:[]},{id:`MD024`,alias:`no-duplicate-heading`,aliases:[`no-duplicate-heading`],name:`Multiple headings with the same content`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md024.md`,tags:[`headings`],options:[{key:`siblings_only`,type:`boolean`,description:`Only check sibling headings`,default:!1}]},{id:`MD025`,alias:`single-title`,aliases:[`single-title`,`single-h1`],name:`Multiple top-level headings in the same document`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md025.md`,tags:[`headings`],options:[{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`},{key:`level`,type:`integer`,description:`Heading level`,default:1,minimum:1,maximum:6}]},{id:`MD026`,alias:`no-trailing-punctuation`,aliases:[`no-trailing-punctuation`],name:`Trailing punctuation in heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md026.md`,tags:[`headings`],options:[{key:`punctuation`,type:`string`,description:`Punctuation characters`,default:`.,;:!。,;:!`}]},{id:`MD027`,alias:`no-multiple-space-blockquote`,aliases:[`no-multiple-space-blockquote`],name:`Multiple spaces after blockquote symbol`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md027.md`,tags:[`indentation`,`whitespace`,`blockquote`],options:[{key:`list_items`,type:`boolean`,description:`Include list items`,default:!0}]},{id:`MD028`,alias:`no-blanks-blockquote`,aliases:[`no-blanks-blockquote`],name:`Blank line inside blockquote`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md028.md`,tags:[`whitespace`,`blockquote`],options:[]},{id:`MD029`,alias:`ol-prefix`,aliases:[`ol-prefix`],name:`Ordered list item prefix`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md029.md`,tags:[`ol`],options:[{key:`style`,type:`enum`,description:`List style`,enum:[`one`,`ordered`,`one_or_ordered`,`zero`],default:`one_or_ordered`}]},{id:`MD030`,alias:`list-marker-space`,aliases:[`list-marker-space`],name:`Spaces after list markers`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md030.md`,tags:[`ul`,`whitespace`,`ol`],options:[{key:`ul_single`,type:`integer`,description:`Spaces for single-line unordered list items`,default:1,minimum:1},{key:`ol_single`,type:`integer`,description:`Spaces for single-line ordered list items`,default:1,minimum:1},{key:`ul_multi`,type:`integer`,description:`Spaces for multi-line unordered list items`,default:1,minimum:1},{key:`ol_multi`,type:`integer`,description:`Spaces for multi-line ordered list items`,default:1,minimum:1}]},{id:`MD031`,alias:`blanks-around-fences`,aliases:[`blanks-around-fences`],name:`Fenced code blocks should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md031.md`,tags:[`blank_lines`,`code`],options:[{key:`list_items`,type:`boolean`,description:`Include list items`,default:!0}]},{id:`MD032`,alias:`blanks-around-lists`,aliases:[`blanks-around-lists`],name:`Lists should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md032.md`,tags:[`bullet`,`ul`,`blank_lines`,`ol`],options:[]},{id:`MD033`,alias:`no-inline-html`,aliases:[`no-inline-html`],name:`Inline HTML`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md033.md`,tags:[`html`],options:[{key:`allowed_elements`,type:`string-array`,description:`Allowed elements`,default:[]},{key:`table_allowed_elements`,type:`string-array`,description:`Allowed elements in tables`,default:[]}]},{id:`MD034`,alias:`no-bare-urls`,aliases:[`no-bare-urls`],name:`Bare URL used`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md034.md`,tags:[`links`,`url`],options:[]},{id:`MD035`,alias:`hr-style`,aliases:[`hr-style`],name:`Horizontal rule style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md035.md`,tags:[`hr`],options:[{key:`style`,type:`string`,description:`Horizontal rule style`,default:`consistent`}]},{id:`MD036`,alias:`no-emphasis-as-heading`,aliases:[`no-emphasis-as-heading`],name:`Emphasis used instead of a heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md036.md`,tags:[`headings`,`emphasis`],options:[{key:`punctuation`,type:`string`,description:`Punctuation characters`,default:`.,;:!?。,;:!?`}]},{id:`MD037`,alias:`no-space-in-emphasis`,aliases:[`no-space-in-emphasis`],name:`Spaces inside emphasis markers`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md037.md`,tags:[`whitespace`,`emphasis`],options:[]},{id:`MD038`,alias:`no-space-in-code`,aliases:[`no-space-in-code`],name:`Spaces inside code span elements`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md038.md`,tags:[`whitespace`,`code`],options:[]},{id:`MD039`,alias:`no-space-in-links`,aliases:[`no-space-in-links`],name:`Spaces inside link text`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md039.md`,tags:[`whitespace`,`links`],options:[]},{id:`MD040`,alias:`fenced-code-language`,aliases:[`fenced-code-language`],name:`Fenced code blocks should have a language specified`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md040.md`,tags:[`code`,`language`],options:[{key:`allowed_languages`,type:`string-array`,description:`List of languages`,default:[]},{key:`language_only`,type:`boolean`,description:`Require language only`,default:!1}]},{id:`MD041`,alias:`first-line-heading`,aliases:[`first-line-heading`,`first-line-h1`],name:`First line in a file should be a top-level heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md041.md`,tags:[`headings`],options:[{key:`allow_preamble`,type:`boolean`,description:`Allow content before first heading`,default:!1},{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`},{key:`level`,type:`integer`,description:`Heading level`,default:1,minimum:1,maximum:6}]},{id:`MD042`,alias:`no-empty-links`,aliases:[`no-empty-links`],name:`No empty links`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md042.md`,tags:[`links`],options:[]},{id:`MD043`,alias:`required-headings`,aliases:[`required-headings`],name:`Required heading structure`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md043.md`,tags:[`headings`],options:[{key:`headings`,type:`string-array`,description:`List of headings`,default:[]},{key:`match_case`,type:`boolean`,description:`Match case of headings`,default:!1}]},{id:`MD044`,alias:`proper-names`,aliases:[`proper-names`],name:`Proper names should have the correct capitalization`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md044.md`,tags:[`spelling`],options:[{key:`names`,type:`string-array`,description:`List of proper names`,default:[]},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`html_elements`,type:`boolean`,description:`Include HTML elements`,default:!0}]},{id:`MD045`,alias:`no-alt-text`,aliases:[`no-alt-text`],name:`Images should have alternate text (alt text)`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md045.md`,tags:[`accessibility`,`images`],options:[]},{id:`MD046`,alias:`code-block-style`,aliases:[`code-block-style`],name:`Code block style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md046.md`,tags:[`code`],options:[{key:`style`,type:`enum`,description:`Block style`,enum:[`consistent`,`fenced`,`indented`],default:`consistent`}]},{id:`MD047`,alias:`single-trailing-newline`,aliases:[`single-trailing-newline`],name:`Files should end with a single newline character`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md047.md`,tags:[`blank_lines`],options:[]},{id:`MD048`,alias:`code-fence-style`,aliases:[`code-fence-style`],name:`Code fence style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md048.md`,tags:[`code`],options:[{key:`style`,type:`enum`,description:`Code fence style`,enum:[`consistent`,`backtick`,`tilde`],default:`consistent`}]},{id:`MD049`,alias:`emphasis-style`,aliases:[`emphasis-style`],name:`Emphasis style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md049.md`,tags:[`emphasis`],options:[{key:`style`,type:`enum`,description:`Emphasis style`,enum:[`consistent`,`asterisk`,`underscore`],default:`consistent`}]},{id:`MD050`,alias:`strong-style`,aliases:[`strong-style`],name:`Strong style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md050.md`,tags:[`emphasis`],options:[{key:`style`,type:`enum`,description:`Strong style`,enum:[`consistent`,`asterisk`,`underscore`],default:`consistent`}]},{id:`MD051`,alias:`link-fragments`,aliases:[`link-fragments`],name:`Link fragments should be valid`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md051.md`,tags:[`links`],options:[{key:`ignore_case`,type:`boolean`,description:`Ignore case of fragments`,default:!1},{key:`ignored_pattern`,type:`string`,description:`Pattern for ignoring additional fragments`,default:``}]},{id:`MD052`,alias:`reference-links-images`,aliases:[`reference-links-images`],name:`Reference links and images should use a label that is defined`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md052.md`,tags:[`links`,`images`],options:[{key:`ignored_labels`,type:`string-array`,description:`Ignored link labels`,default:[`x`]},{key:`shortcut_syntax`,type:`boolean`,description:`Include shortcut syntax`,default:!1}]},{id:`MD053`,alias:`link-image-reference-definitions`,aliases:[`link-image-reference-definitions`],name:`Link and image reference definitions should be needed`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md053.md`,tags:[`links`,`images`],options:[{key:`ignored_definitions`,type:`string-array`,description:`Ignored definitions`,default:[`//`]}]},{id:`MD054`,alias:`link-image-style`,aliases:[`link-image-style`],name:`Link and image style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md054.md`,tags:[`links`,`images`],options:[{key:`autolink`,type:`boolean`,description:`Allow autolinks`,default:!0},{key:`inline`,type:`boolean`,description:`Allow inline links and images`,default:!0},{key:`full`,type:`boolean`,description:`Allow full reference links and images`,default:!0},{key:`collapsed`,type:`boolean`,description:`Allow collapsed reference links and images`,default:!0},{key:`shortcut`,type:`boolean`,description:`Allow shortcut reference links and images`,default:!0},{key:`url_inline`,type:`boolean`,description:`Allow URLs as inline links`,default:!0}]},{id:`MD055`,alias:`table-pipe-style`,aliases:[`table-pipe-style`],name:`Table pipe style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md055.md`,tags:[`table`],options:[{key:`style`,type:`enum`,description:`Table pipe style`,enum:[`consistent`,`leading_only`,`trailing_only`,`leading_and_trailing`,`no_leading_or_trailing`],default:`consistent`}]},{id:`MD056`,alias:`table-column-count`,aliases:[`table-column-count`],name:`Table column count`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md056.md`,tags:[`table`],options:[]},{id:`MD058`,alias:`blanks-around-tables`,aliases:[`blanks-around-tables`],name:`Tables should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md058.md`,tags:[`table`],options:[]},{id:`MD059`,alias:`descriptive-link-text`,aliases:[`descriptive-link-text`],name:`Link text should be descriptive`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md059.md`,tags:[`links`,`accessibility`],options:[{key:`prohibited_texts`,type:`string-array`,description:`Prohibited link texts`,default:[`click here`,`here`,`link`,`more`]}]},{id:`MD060`,alias:`table-column-style`,aliases:[`table-column-style`],name:`Table column style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md060.md`,tags:[`table`],options:[{key:`style`,type:`enum`,description:`Table column style`,enum:[`any`,`aligned`,`compact`,`tight`],default:`any`},{key:`aligned_delimiter`,type:`boolean`,description:`Aligned delimiter columns`,default:!1}]}];(()=>{let e=new Map;for(let t of Fge){e.set(t.id.toUpperCase(),t.id);for(let n of t.aliases)e.set(n.toUpperCase(),t.id)}return e})();const Ige=new Set([`img`,`video`,`audio`,`mark`,`u`,`ins`]);new Map(oH.flatMap(e=>e.surface===`compat`&&Ige.has(e.rendersAs)?[[e.name,e]]:[])),Rpe(`<>`),kO().use(pA).use(wO);const ZJ=[{tagName:`Mirror`,attrName:`src`,resolution:`bare-doc-name`},{tagName:`Excalidraw`,attrName:`src`,resolution:`doc-relative`}];for(let e of ZJ){let t=oH.find(t=>t.name===e.tagName);if(!t)throw Error(`JSX_SRC_REF_TAGS: no built-in component descriptor named '${e.tagName}' — the rename-rewrite and backlink passes for this entry would silently never match. Fix the tagName to match a descriptor in builtInComponents.`);if(!t.props.some(t=>t.name===e.attrName))throw Error(`JSX_SRC_REF_TAGS: component '${e.tagName}' declares no prop named '${e.attrName}' — the rename-rewrite and backlink passes for this entry would silently never match. Fix the attrName to match one of the descriptor's props.`)}Fj(),$A(),ej();function Lge(){return oH.filter(e=>e.surface===`canonical`&&e.name!==`*`)}function Rge(){return Lge().filter(e=>{let t=zge(e);return t!==`fence`&&t!==`html`})}function zge(e){return e.name===`MermaidFence`?`fence`:e.name===`HtmlAlignBlock`?`html`:e.hasChildren?`jsx-block`:`jsx-void`}B({intents:z(B({satisfierId:F().min(1),desired:U([`present`,`absent`])}).loose()),...IB,summary:LB}).loose();const Bge=B({satisfierId:F(),agentId:F(),piece:F(),scope:F(),kind:F(),pathId:F().optional(),desired:U([`present`,`absent`]),action:U(bu),errorId:F().optional()}).loose(),Vge=B({kind:F(),satisfierIds:z(F()),agentIds:z(F()),pathId:F().optional(),blockedReason:F().optional()}).loose(),Hge=B({state:F(),strictness:z(U(vu)).optional()}).loose(),Uge=B({probes:B({env:U([`desktop`,`local-web`,`remote-web`]),satisfiers:H(F(),Hge)}).loose(),detection:B({detected:z(F()),probed:L()}).loose()}).loose();B({actions:z(Bge),conflicts:z(Vge),withheld:z(F()),snapshot:Uge}).loose(),B({entries:z(B({level:U([`info`,`warn`,`error`]),message:F().max(8192),event:F().optional(),fields:H(F(),R()).optional(),ts:I().optional(),sourceId:F().optional(),lineNumber:I().optional()}).loose()).max(100),droppedSinceLastFlush:I().int().min(0).optional()}).loose(),B({accepted:I().int().min(0)}).loose();const Wge=B({exact:F().min(1),prefix:F(),suffix:F(),start:I().int().nonnegative(),end:I().int().nonnegative()}),Gge=z(V([F(),I().int().nonnegative()])),Kge=ui(`kind`,[B({kind:W(`body`)}),B({kind:W(`property`),key:F().min(1),path:Gge.default([])})]).default({kind:`body`}),qge=U([`anchored`,`orphaned`,`resolved`]),QJ=B({threadId:F().min(1),docName:F().min(1),target:Kge,anchor:Wge.nullable(),state:qge,queued:L(),latestComment:F(),createdBy:F().min(1),createdAt:I(),updatedAt:I().optional()}),$J=B({docName:F(),instruction:F(),property:F().nullable(),passage:B({exact:F(),prefix:F(),suffix:F()}).nullable(),anchorLost:L(),passageRepeats:L()}).loose(),eY=B({threadId:F(),ok:W(!0)}),tY=B({threadId:F(),ok:W(!1),error:W(`not-found`)});B({threads:z(QJ)}).loose(),B({meta:QJ,orphaned:L()}).loose(),B({threadId:F()}).loose(),B({meta:QJ,payload:$J}).loose(),B({results:z(V([eY.extend({meta:QJ,payload:$J}),tY]))}).loose(),B({results:z(V([eY.extend({meta:QJ}),tY]))}).loose();const Jge=B({status:F().min(1),reason:F()}).loose();B({docName:F().min(1),content:F(),lifecycle:Jge.nullable()}).loose(),B({documents:z(B({kind:U([`document`,`asset`,`folder`,`file`]).default(`document`),docName:F().min(1).optional(),docExt:F().min(1).default(`.md`),size:I().int().nonnegative(),modified:F().min(1),isSymlink:L().default(!1),canonicalDocName:F().nullable().default(null),targetPath:F().nullable().default(null),path:F().min(1).optional(),assetExt:F().min(1).optional(),mediaKind:U([`image`,`video`,`audio`,`pdf`,`text`,`mermaid`,`excalidraw`]).nullable().optional(),referencedBy:z(F().min(1)).optional(),hasChildren:L().optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.kind===`file`?e.path!==void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder/file kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName; file → path, no mediaKind/referencedBy/hasChildren)`})),truncated:L().optional()}).loose();const Yge=B({source:F().min(1),anchor:F().nullable(),title:F(),snippet:F().nullable()}).loose();B({docName:F().min(1),backlinks:z(Yge)}).loose(),B({counts:H(F().min(1),I().int().nonnegative())}).loose(),B({counts:H(F().min(1),I().int().nonnegative())}).loose();const Xge=ui(`kind`,[B({kind:W(`doc`),docName:F().min(1),anchor:F().nullable(),title:F(),snippet:F().nullable()}).loose(),B({kind:W(`external`),url:F().min(1),title:F(),snippet:F().nullable()}).loose()]),Zge=B({role:F().min(1),sourceForm:F().min(1),targetKind:F().min(1),href:F(),resolvedTarget:F().nullable(),status:F().min(1),reason:F().nullable(),resolutionMethod:F().min(1),fallbackTarget:F().nullable().default(null),range:B({start:I().int().nonnegative(),end:I().int().nonnegative()}),line:I().int().nonnegative(),column:I().int().nonnegative(),definition:B({label:F(),line:I().int().nonnegative()}).nullable().default(null)}).loose();B({docName:F().min(1),forwardLinks:z(Xge),localTargets:z(Zge).optional()}).loose();const Qge=ui(`kind`,[B({id:F().min(1),kind:W(`doc`),docName:F().min(1),anchor:F().nullable(),label:F(),cluster:F().nullable(),category:F().nullable(),tags:z(F()).nullable(),managed:L().optional()}).loose(),B({id:F().min(1),kind:W(`external`),url:F().min(1),label:F()}).loose()]),$ge=B({source:F().min(1),target:F().min(1)}).loose();B({nodes:z(Qge),links:z($ge)}).loose();const e_e=B({ts:I().int().min(0),url:F(),method:F(),ua:F().optional(),origin:F().optional(),referer:F().optional(),host:F().optional(),remote:F().optional(),secChUa:F().optional(),secChUaMobile:F().optional(),secChUaPlatform:F().optional(),secFetchSite:F().optional(),secFetchDest:F().optional(),secFetchMode:F().optional(),secFetchUser:F().optional()}).loose(),t_e=B({app:V([W(`cursor`),W(`codex`),W(`claude`),ni()]),signals_fired:z(F())}).loose();B({entries:z(e_e),count:I().int().min(0),detection:t_e}).loose();const nY=B({path:F().min(1),code:U([`M`,`A`,`D`,`R`,`C`,`U`,`T`,`?`,`!`,` `]),origPath:F().min(1).optional(),syncScoped:L(),open:ui(`kind`,[B({kind:W(`doc`),docName:F().min(1)}),B({kind:W(`asset`),path:F().min(1)})]).optional()}).loose();B({branch:F().nullable(),detached:L(),upstream:F().nullable(),staged:z(nY),notStaged:z(nY),untracked:z(nY),incoming:z(nY),truncated:L(),readable:L().default(!0)}).loose();const n_e=U([`AWAITING_CHECKS`,`LOCKED`,`MERGEABLE`,`QUEUED`,`UNMERGEABLE`]),r_e=U([`BEHIND`,`BLOCKED`,`CLEAN`,`DIRTY`,`DRAFT`,`HAS_HOOKS`,`UNKNOWN`,`UNSTABLE`]),i_e=U([`APPROVED`,`CHANGES_REQUESTED`,`REVIEW_REQUIRED`]),a_e=U([`ERROR`,`EXPECTED`,`FAILURE`,`PENDING`,`SUCCESS`]),o_e=B({mergeQueue:B({position:I().int().nonnegative(),state:n_e.nullable().catch(null)}).nullable().catch(null),autoMerge:L(),mergeState:r_e.nullable().catch(null),reviewDecision:i_e.nullable().catch(null),checks:a_e.nullable().catch(null)}).loose(),s_e=B({kind:U([`pull`,`issue`]),repo:F().min(1),number:I().int().positive(),title:F(),author:F().nullable(),createdAt:F(),lifecycle:U([`open`,`draft`,`merged`,`closed`,`completed`,`not-planned`]),additions:I().int().nonnegative().optional(),deletions:I().int().nonnegative().optional(),status:o_e.optional()}).loose();B({url:F()}).loose(),ui(`ok`,[B({ok:W(!0),preview:s_e}).loose(),B({ok:W(!1),reason:F()}).loose()]),B({writers:z(B({id:F().min(1),name:F().optional(),email:F().optional()}).loose()).optional(),summary:LB,...IB}).loose(),B({checkpointRef:F().min(1)}).loose();const c_e=B({v:I().int().optional(),id:F().min(1),name:F().min(1),colorSeed:F().optional(),docs:z(F()),summaries:z(F()).optional()}).loose();B({entries:z(B({sha:F().min(1),timestamp:F().min(1),author:F(),authorEmail:F(),type:U([`checkpoint`,`wip`,`upstream`,`park`]),message:F(),contributors:z(c_e),checkpoint:R().nullable(),parentSha:F().nullable().optional()}).loose()),total:I().int().nonnegative().optional(),truncated:L().optional(),hasMore:L().optional()}).loose(),B({sha:F().regex(/^[0-9a-f]{40}$/i),content:F(),timestamp:F(),author:F()}).loose(),B({contentDir:F().min(1),pathSeparator:U([`/`,`\\`]),symlinkResolved:L()}).loose(),z(ui(`source`,[B({docName:F().min(1),timestamp:F().min(1),size:I().int().nonnegative(),source:W(`flat`)}).loose(),B({docName:F().min(1),timestamp:F().min(1),source:W(`timeline`),sha:F().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."});const l_e=B({domain:F().min(1),title:F().optional(),description:F().optional(),siteName:F().optional(),faviconDataUri:F().optional()}).loose();B({url:F()}).loose(),ui(`ok`,[B({ok:W(!0),metadata:l_e}).loose(),B({ok:W(!1),reason:F()}).loose()]),B({orphans:z(B({docName:F().min(1),title:F()}).loose())}).loose(),B({hubs:z(B({docName:F().min(1),title:F(),count:I().int().nonnegative()}).loose())}).loose();const u_e=B({source:F().min(1),title:F(),snippet:F().nullable()}).loose();B({deadLinks:z(B({target:F().min(1),sources:z(u_e)}).loose())}).loose(),B({target:B({docName:F().min(1),title:F(),aliases:z(F())}).loose(),mentions:z(B({source:F().min(1),excerpt:F(),offset:I().int().nonnegative()}).loose()),truncated:L()}).loose(),B({projectPath:F().min(1)}).loose();const d_e=U([`not-a-git-worktree`,`init-failed`]);ui(`ok`,[B({ok:W(!0),projectPath:F().min(1)}).loose(),B({ok:W(!1),reason:d_e,message:F().min(1)}).loose()]),B({host:F().min(1).optional()}).loose(),B({host:F().min(1).optional(),token:F().min(1)}).loose(),B({host:F(),login:F()}).loose(),B({key:F().min(1)}).loose(),B({keyPresent:L()}).loose();const f_e=U([`no_key`,`invalid_endpoint`,`rate_limit`,`timeout`,`http_error`,`network`,`dims_mismatch`,`malformed_response`]);ui(`ok`,[B({ok:W(!0),endpoint:F().min(1),model:F().min(1),dimensions:I().int().positive()}).loose(),B({ok:W(!1),endpoint:F().min(1),model:F().min(1),reason:f_e,status:I().int().optional()}).loose()]),B({name:F().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:F().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),B({authenticated:L()}).loose(),B({channel:U([`login`,`gh-login`]).default(`login`)}).loose(),B({}).loose();const p_e=B({stackIndex:I().int().min(0),ts:I().int().min(0),additions:I().int().min(0),deletions:I().int().min(0)}).loose(),m_e=B({docName:F().min(1),additionsTotal:I().int().min(0),deletionsTotal:I().int().min(0),lastTs:I().int().min(0),bursts:z(p_e)}).loose(),h_e=B({displayName:F().min(1),color:F().min(1),icon:F().optional(),connectionId:F().min(1)}).loose();B({sessionAlive:L(),agent:h_e.nullable(),files:z(m_e)}).loose(),B({diff:F(),before:F(),after:F(),properties:OB,generatedAt:I().int().min(0)}).loose(),B({}).loose(),B({}).loose(),B({}).loose(),B({}).loose(),B({}).loose(),B({}).loose();const g_e=B({displayName:F().min(1),icon:F(),color:F().min(1),currentDoc:F().nullable(),mode:U([`idle`,`writing`]),ts:I().int().min(0)}).loose();B({presence:H(F().min(1),g_e)}).loose();const __e=B({sessionId:F().min(1),agentType:F().min(1),ts:I().int().min(0),insertedChars:I().int().min(0),deletedChars:I().int().min(0)}).loose();B({effects:z(B({"doc.name":F().min(1),entries:z(__e)}).loose())}).loose(),B({decisions:z(B({ts:I().int().min(0),decision:F().min(1),kind:F().min(1),"doc.name":F().min(1),pathRole:F().min(1)}).loose())}).loose(),H(F().min(1),L()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`}),B({path:F().min(1,`path must be non-empty`)}).loose(),B({}).loose();const v_e=B({fromDocName:F().min(1),toDocName:F().min(1)}).loose(),y_e=B({fromPath:F().min(1),toPath:F().min(1)}).loose();B({}).loose(),B({path:F().min(1),...IB,summary:LB}).loose(),B({docName:F().min(1)}).loose(),B({path:F().min(1),...IB,summary:LB}).loose(),B({path:F().min(1)}).loose(),B({kind:U([`file`,`folder`]),path:F().min(1),...IB,summary:LB}).loose(),B({kind:U([`file`,`folder`]),path:F().min(1),duplicatedDocNames:z(F().min(1))}).loose(),B({pages:z(B({docName:F().min(1),title:F(),docExt:F().min(1),size:I().int().nonnegative(),modified:F().min(1),icon:F().min(1).max(2048).optional()}).loose())}).loose();const b_e=B({level:I().int().min(1).max(6),text:F(),slug:F()}).loose();B({docName:F().min(1),headings:z(b_e)}).loose();const x_e=B({docName:F().min(1),rewrites:I().int().nonnegative()}).loose();B({kind:U([`file`,`folder`,`asset`]),fromPath:F().min(1),toPath:F().min(1),...IB,summary:LB}).loose(),B({renamed:z(v_e),renamedAssets:z(y_e),rewrittenDocs:z(x_e).optional(),summary:IJ.optional()}).loose(),B({kind:U([`file`,`folder`,`asset`]),path:F().min(1),...IB}).loose(),B({deletedDocNames:z(F().min(1))}).loose(),B({kind:U([`file`,`folder`,`asset`]),path:F().min(1),...IB,summary:LB}).loose(),B({deletedDocNames:z(F().min(1))}).loose(),B({docName:F().min(1),commitSha:F().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:LB,...IB}).loose(),B({restoredFrom:F().min(1),timestamp:F().min(1),summary:IJ.optional(),warnings:VJ.optional()}).loose();const S_e=/^#[0-9a-fA-F]{6}$/,C_e=B(Object.fromEntries(Ns.map(e=>[e,F().regex(S_e,`must be a #rrggbb hex color`)]))),rY=F().min(1).refine(Rs,{message:`must contain a non-whitespace character`}),iY=B({name:rY,author:rY.optional(),variant:U([`dark`,`light`]),palette:C_e}).loose();B({name:F().min(1),scheme:iY,stem:F().min(1).optional(),extension:U([`.yaml`,`.yml`]).optional()}).loose(),B({id:F().min(1),filename:F().min(1)}).loose(),B({id:F().min(1),scheme:iY}).loose(),B({id:F().min(1),filename:F().min(1)}).loose(),ui(`existed`,[B({existed:W(!1)}).loose(),B({existed:W(!0),filename:F().min(1),scheme:iY}).loose()]),B({themes:z(ui(`ok`,[B({ok:W(!0),id:F().min(1),filename:F().min(1),scheme:iY}),B({ok:W(!1),filename:F().min(1),id:F().min(1).optional(),code:F().min(1),conflictingFilenames:z(F().min(1)).min(2).optional()})])),truncated:L()}).loose();const w_e=U([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),T_e=B({label:F().min(1),webUrl:Gr().nullable()}).loose(),E_e=ui(`checkStatus`,[B({checkStatus:W(`allowed`)}).loose(),B({checkStatus:W(`denied`),deniedReason:U([`no-collaborator`,`private-no-access`,`repo-not-found`,`not-authenticated`]),resolvedLogin:F().optional(),declaredLogin:F().optional(),declaredSource:F().optional()}).loose(),B({checkStatus:W(`unknown`),unknownError:U([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`,`ssh-unverified`]).optional()}).loose()]),aY=U([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`auth-not-found-as-identity`,`semantic-protected-branch`]),D_e=U(Bre),O_e=U([`succeeded`,`up-to-date`,`conflict`,`refused`,`error`]);B({state:w_e,lastSyncUtc:F().nullable(),lastRunUtc:F().nullable().optional(),lastPullOkUtc:F().nullable().optional(),lastPushOkUtc:F().nullable().optional(),lastFetchUtc:F().nullable(),lastPushedSha:F().nullable(),ahead:I().int().min(0),behind:I().int().min(0),consecutiveFailures:I().int().min(0),consecutivePushFailures:I().int().min(0).optional(),conflictCount:I().int().min(0),hasRemote:L(),syncEnabled:L(),identityUnresolved:L(),remote:T_e.nullable().optional(),pushError:F().optional(),pushErrorCode:aY.optional(),pullError:F().optional(),pullErrorCode:aY.optional(),pausedReason:F().optional(),blockingPaths:z(F().min(1)).optional(),pushPermission:E_e.optional(),syncMode:D_e.optional(),lastPullUtc:F().nullable().optional(),lastPullOutcome:O_e.nullable().optional()}).loose(),B({action:U([`commit`]),paths:z(F().min(1)),commitSha:F().optional()}).loose(),B({action:U([`commit`])}).loose(),B({op:U([`sync`,`push`,`pull`,`fetch`]).optional()}).loose(),B({op:U([`sync`,`push`,`pull`,`fetch`])}).loose();const oY=U([`merge-native`,`working-tree`,`reconcile`]),sY=U([`merged-with-markers`,`refused-conflict-markers`,`refused-no-base`,`refused-too-large`,`disk-markers`,`stale-external-write`]),k_e=U([`mine`,`theirs`,`content`,`delete`]);B({conflicts:z(B({file:F().min(1),detectedAt:F().min(1),conflict:oY,reason:sY.optional().catch(void 0),conflictKind:U([`git`,`stale-external-write`]).optional(),docName:F().nullable(),theirsSha:F().optional(),baseSha:F().optional()}).loose())}).loose(),B({file:F().min(1),strategy:U([`mine`,`theirs`,`content`,`delete`]),content:F().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0,{message:`content must be provided when strategy is 'content' (an empty string keeps an empty file)`,path:[`content`]}),B({}).loose(),B({file:F().min(1),base:F(),ours:F(),theirs:F(),kind:U([`both-modified`,`delete-modify`,`modify-delete`]),conflict:oY,reason:sY.optional().catch(void 0),conflictKind:U([`git`,`stale-external-write`]).optional(),resolutionOptions:z(k_e)}).loose(),B({plan:Pi(e=>e!==void 0,{message:`plan is required`})}).loose(),B({plan:Pi(e=>e!==void 0,{message:`plan is required`})}).loose(),B({result:Pi(e=>e!==void 0,{message:`result is required`})}).loose(),B({packId:F().min(1)}).strict(),B({installedHosts:z(F()),skills:z(B({name:F().min(1),created:L()}).strict())}).strict();const A_e=B({path:F().min(1),summary:F().min(1)}).loose(),j_e=B({files:I().int().nonnegative(),folders:I().int().nonnegative()}).loose();B({packs:z(B({id:F().min(1),name:F().min(1),description:F().min(1),defaultSubfolder:F().optional(),folders:z(A_e),entryCounts:j_e}).loose())}).loose(),B({noOpen:L().optional(),out:F().min(1).optional()}).loose();const M_e=B({reason:U([`unsupported-platform`,`spawn-error`]),message:F()}).loose();ui(`status`,[B({status:W(`installed`),outputPath:F(),size:I().int().nonnegative(),sha256:F(),skillVersion:F()}).loose(),B({status:W(`built`),outputPath:F(),size:I().int().nonnegative(),sha256:F(),skillVersion:F(),handoffError:M_e.optional()}).loose(),B({status:W(`failed`),buildError:F()}).loose(),B({status:W(`skip-current`),skillVersion:F(),recordedAt:F().optional()}).loose()]);const cY=U(du),N_e=U(pie),P_e=B({alwaysOn:I().int().nonnegative(),onTrigger:I().int().nonnegative(),onDemand:I().int().nonnegative()}).strict();B({tags:z(B({name:F().min(1),count:I().int().nonnegative(),isLeaf:L()}).loose())}).loose();const F_e=B({docName:F().min(1),title:F(),matchingTags:z(F().min(1)),snippet:F().nullable()}).loose();B({name:F().min(1),docs:z(F_e)}).loose(),B({folder:R(),frontmatter_local:H(F(),R()).nullable(),warnings:z(F()).optional().meta({description:"Non-fatal degradations of this response, one per entry; the field each affects is absent, null, or incomplete — the aligned `warningCodes` entry names which field and how."}),warningCodes:z(U([`symlink-refused`,`malformed-yaml`,`unverifiable`,`templates-symlink-refused`,`templates-unverifiable`])).optional().meta({description:"Machine-readable codes aligned 1:1 with `warnings`; switch on these, never on the English. `symlink-refused` / `malformed-yaml` / `unverifiable`: this folder's own `.ok/frontmatter.yml` (a symlink, malformed YAML, or an lstat failure) — `frontmatter_local` is null. `templates-symlink-refused` / `templates-unverifiable`: the `.ok/templates` directory on this folder, or a `.ok` or `.ok/templates` directory on an ancestor it inherits from — a symlink (wherever it points, dangling included), or a non-ENOTDIR `lstat` failure — `folder.templates_available` omits that directory's templates and may still list others. A non-directory `.ok` / `.ok/templates` (ENOTDIR) is treated as empty and yields no `templates-*` code. This folder's own symlinked `.ok` is a 400, never a warning."})}).loose(),B({path:F(),frontmatter:H(F(),R()).optional()}).loose(),B({applied:R()}).loose();const lY=H(F(),R()).meta({description:`Free-form frontmatter map embedded in template payloads.`});B({template:B({name:F().min(1),folder:F(),scope:U([`local`,`inherited`]),path:F().min(1),frontmatter:lY,body:F()}).strict()}).strict(),B({templates:z(B({name:F().min(1),title:F().optional(),description:F().optional(),path:F().min(1),source_folder:F()}).strict()),truncated:L()}).strict(),B({folder:F(),name:F(),body:F().optional(),frontmatter:lY.optional(),...IB,summary:LB}).strict(),B({path:F().min(1),created:L(),warnings:z(F())}).strict(),B({sourcePath:F().min(1),targetFolder:F(),name:F().optional(),title:F().optional(),deleteSource:L().optional(),...IB,summary:LB}).strict(),B({path:F().min(1),created:L(),warnings:z(F())}).strict(),B({existed:L(),path:F().min(1)}).strict(),B({fromFolder:F(),fromName:F(),toFolder:F(),toName:F(),body:F().optional(),frontmatter:lY.optional(),...IB,summary:LB}).strict(),B({from:F().min(1),to:F().min(1),committed:L()}).strict();const uY=U(ad),I_e=/^[a-z0-9-]+$/,dY=B({name:F(),description:F(),metadata:B({pack:F()}).strict().optional()}).strict();B({skill:B({name:F().min(1),scope:uY,path:F().min(1),frontmatter:dY,body:F(),files:z(B({path:F().min(1),text:F().nullable()})).optional(),managed:L().optional()}).strict()}).strict();const L_e=B({source:F().min(1),publisher:F().optional(),skill:F().optional(),marketplaceUrl:F().optional(),importedAt:F().min(1),autoUpdate:L().optional()}).strict(),R_e=B({name:F().min(1),description:F().optional(),scope:uY,path:F().min(1),canonicalPath:F().min(1).optional(),filePaths:z(F()).optional(),absolutePath:F().min(1).optional(),installed:L(),hosts:z(F()),hostQualifier:F().optional().meta({description:"Set on a GLOBAL entry that shares its name with a distinct-content bundle in another host dir AND is not the by-name default: the host id whose root holds THIS bundle. Doc-name builders append it (`__skill__/global/<name>@<host>`) so each same-named bundle keeps its own tab and its own write-back path; the default bundle keeps the stable unqualified name."}),driftPaths:z(F()).optional().meta({description:`Recorded locations whose on-disk form (copy vs symlink) no longer matches what OK last wrote there — evidence another tool rewrote the path.`}),hostAliases:H(F(),F()).optional().meta({description:`Host skills roots that are symlink ALIASES of another location (host id → base-relative target root). An aliased folder is a derived view — no menu row, never a write target; the host's icon rides the target root's row.`}),conflictHosts:z(F()).optional().meta({description:`Hosts whose dir holds a DIFFERENT same-name skill (fork/conflict) — occupied, not this skill.`}),symlinkedHosts:z(F()).optional(),installableEditors:z(F()).optional(),hubOffered:L().optional().meta({description:"Whether the vendor-neutral `.agents/skills` hub is a live destination at this scope on THIS machine — server-computed via the same predicate that filters the Folders surface, so the install menu and Settings cannot disagree. True when the project already uses the hub OR a host that reads it is installed (`HUB_READER_EDITORS`)."}),linkMode:L().optional(),customPlacements:z(B({path:F(),mode:U([`copy`,`link`])}).strict()).optional(),plugin:B({name:F().min(1),marketplace:F().min(1),provider:F().min(1),url:F().optional()}).strict().optional(),managed:L().optional(),origin:L_e.optional(),pack:F().optional(),modified:L().optional(),revertable:L().optional(),ignored:L().optional(),size:P_e.optional()}).strict();B({name:F().min(1),scope:uY,apply:L().optional()}).strict(),B({line:F().min(1),gitignorePath:F().min(1),applied:L(),alreadyTracked:L().optional()}).strict(),B({skills:z(R_e),truncated:L()}).strict(),B({scope:uY.default(`project`),name:F().meta({description:`Managed skill name to create or update.`}),body:F().optional(),frontmatter:dY,...IB,summary:LB}).strict();const fY=[`skill-name-vendor-word`,`skill-body-too-long`],pY=z(U(fY)).meta({description:"Machine-readable codes aligned 1:1 with `warnings` (`warnings[i]` is the display text for `warningCodes[i]`)."});B({path:F().min(1),created:L(),warnings:z(F()),warningCodes:pY}).strict(),B({scope:uY.default(`project`),name:F(),dryRun:L().optional(),setAutoUpdate:L().optional(),...IB,summary:LB}).strict(),B({name:F().min(1),updated:L(),source:F().min(1),localBody:F().optional(),upstreamBody:F().optional(),gitTracked:L().optional(),warnings:z(F()),warningCodes:pY}).strict(),B({scope:uY.default(`project`),name:F(),...IB,summary:LB}).strict(),B({name:F().min(1),baselineRef:F().min(1),restoredFiles:z(F()),warnings:z(F())}).strict();const mY=`This member also carries the one bookkeeping failure that does not undo the operation: the content change landed, but a state file this server keeps beside it refused to be rewritten because it could not be read, so the install or import records still describe the old state until an operator repairs that file. Absent when there is nothing to report; a server that predates this member omits it, so treat its absence as no warning rather than as an error.`;B({existed:L(),path:F().min(1),warnings:z(F()).optional().meta({description:`Present when this delete removed a directory a retention record ties to a recovery copy an earlier failed move kept, whose source was never verified unchanged — either because this server verified the deleted directory against the copy that record describes, or because it could not read the directory and so could not confirm either way. Each entry says which of the two it is; neither claims more than the check established. ${mY}`})}).strict(),B({scope:uY.default(`project`),fromName:F(),toName:F(),body:F().optional(),frontmatter:dY.optional(),...IB,summary:LB}).strict(),B({from:F().min(1),to:F().min(1),committed:L(),warnings:z(F()).optional().meta({description:`Present when the rename itself completed but something beside it did not. ${mY}`})}).strict(),B({name:F(),toName:F().optional().meta({description:"Name for the skill at the destination scope; defaults to `name`. The SKILL.md `name` frontmatter is rewritten to match."}),fromScope:uY,toScope:uY,...IB,summary:LB}).strict(),B({scope:uY,path:F().optional(),droppedLocations:z(F()).default([]).meta({description:"Locations the skill occupied at the source that were removed and not re-created at the destination: the `agents` hub and custom roots, which projection does not cover. Entries are install location ids, so they can be passed straight back as an install `add` list with `scope` set to the destination scope; custom roots resolve against that scope's base."}),warnings:z(F()).optional().meta({description:`Present when the move itself completed but something beside it did not. ${mY}`})}).strict().meta({description:"Scope-move result. Rename paths deliberately do not emit authoring warnings, consistent with same-scope rename and duplicate. Content-authoring and import responses carry those warnings and their codes. The Skills Studio client parses `droppedLocations` off the wire but deliberately does not render it yet; how a human is told what was removed is an open product decision."}),B({scope:uY,name:F(),toName:F(),...IB,summary:LB}).strict(),B({name:F().min(1)}).strict(),B({name:F(),home:F().min(1)}).strict(),B({docName:F().min(1)}).strict();const hY=U([`reference`,`script`,`file`]);B({scope:uY.default(`project`),name:F(),path:F().min(1),content:F(),...IB,summary:LB}).strict(),B({path:F().min(1),created:L(),kind:hY,content:L()}).strict(),B({scope:uY.default(`project`),name:F(),from:F().min(1),to:F().min(1),...IB,summary:LB}).strict(),B({from:F().min(1),to:F().min(1),fromDocName:F().optional(),toDocName:F().optional()}).strict(),B({path:F().min(1),kind:hY,text:F()}).strict(),B({path:F().min(1),existed:L(),kind:hY}).strict();const gY=V([N_e,W(`agents`)]),_Y=F().min(1).refine(e=>!e.startsWith(`/`)&&!e.startsWith(`~`)&&!/^[A-Za-z]:/.test(e),{error:`a custom root is base-relative (e.g. ".tim/skills"), not absolute or ~-prefixed`}).refine(e=>e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`),{error:`a custom root may not contain "..", "." or empty path segments`}).refine(e=>e.includes(`/`),{error:`a custom root is a path (e.g. ".tim/skills") — bare editor names are host ids`}),vY=V([gY,_Y]);B({scope:uY.default(`project`),name:F(),targets:z(gY).optional().meta({description:'SET-EXACT install targets (editor ids, plus "agents" for the .agents hub — in-place skills only): the COMPLETE resulting host set. Omit to use project-configured editors; pass [] to uninstall everywhere. Stateless callers should prefer `add`/`remove`.'}),add:z(vY).optional().meta({description:`Locations to ADD the skill to (everything else untouched). Editor ids fan out a managed copy/symlink; a custom root path (".tim/skills") places the bundle there.`}),remove:z(vY).optional().meta({description:"Locations to REMOVE the skill from (lossless only — a hand-edited fork is refused, never deleted). The source cannot be removed; move it first with `source`."}),mode:U([`copy`,`link`]).optional().meta({description:`"link": one real folder (the source); every other location becomes a symlink to it. "copy": independent real folders, refreshed from the source until hand-edited (a hand-edit forks that copy). Converts existing locations losslessly. Omit to follow the form the skill already uses.`}),source:vY.optional().meta({description:`Move the skill's REAL folder to this location (the old source becomes a symlink to it — never a removal). Sticky across rescans.`}),linkMode:L().optional(),setSource:F().min(1).optional(),place:B({dir:F().min(1).meta({description:`Project-relative directory the bundle dir is created under (e.g. ".windsurf/skills").`}),mode:U([`copy`,`link`])}).strict().optional(),convert:B({target:vY.meta({description:`The installed location to convert — an editor id, "agents", or a recorded custom placement path.`}),mode:U([`copy`,`link`]).meta({description:`"link": replace this location with a symlink to the source. "copy": replace it with an independent real folder.`})}).strict().optional(),unplace:B({path:F().min(1).meta({description:`The recorded placement bundle path (e.g. ".windsurf/skills/my-skill").`})}).strict().optional(),...IB,summary:LB,fork:B({editor:F().min(1),action:U([`align`,`make-source`,`rename`]),toName:F().optional()}).strict().optional()}).strict().refine(e=>e.targets===void 0||e.add===void 0&&e.remove===void 0,{error:"`targets` is set-exact; `add`/`remove` are additive — use one style per call"}).refine(e=>e.fork===void 0||e.targets===void 0&&e.add===void 0&&e.remove===void 0&&e.source===void 0&&e.setSource===void 0,{error:"`fork` is its own operation — run it in a separate call"}).refine(e=>e.fork?.action!==`rename`||e.fork.toName!==void 0,{error:"`fork.rename` requires `toName`"}).refine(e=>e.source===void 0||e.add===void 0&&e.remove===void 0,{error:"a `source` move is its own operation — run it in a separate call from `add`/`remove`"}).refine(e=>[e.targets!==void 0||e.add!==void 0||e.remove!==void 0,e.place!==void 0,e.unplace!==void 0,e.convert!==void 0,e.source!==void 0||e.setSource!==void 0,e.fork!==void 0].filter(Boolean).length<=1,{error:"one operation per call — membership (`targets`/`add`/`remove`), `place`, `unplace`, `convert`, `source`, and `fork` are mutually exclusive"});const yY=[`no-targets`,`scripts-present`,`name-conflict`,`no-description`,`skill-fork-name-unpatched`,`place-path-invalid`,`place-fork-refused`];B({name:F().min(1).meta({description:`Managed skill name installed or uninstalled.`}),hosts:z(F()).meta({description:`Editor ids the skill is projected into after the operation; [] is expected after uninstall.`}),scripts:L().meta({description:`True when the skill ships executable scripts, projected but never run.`}),warnings:z(F()).meta({description:`Non-fatal install/uninstall warnings from target projection.`}),warningCodes:z(U(yY)).meta({description:"Machine-readable warning codes aligned with `warnings`."}),placedAt:F().optional(),sourceMovedTo:F().optional()}).strict(),B({scope:uY.default(`project`),name:F().meta({description:`Managed skill name to uninstall without deleting source.`})}).strict(),B({name:F().min(1).meta({description:`Managed skill name requested for uninstall.`}),uninstalled:L().meta({description:`True when an install marker existed and was removed; false for an idempotent no-op.`})}).strict(),B({targets:z(cY),configured:L(),folders:z(B({scope:uY,host:F(),root:F(),state:U([`own`,`linked`,`linked-parent`,`absent`]),target:F().optional(),drift:W(!0).optional(),expected:F().optional()}).strict()).optional()}).strict();const bY=B({action:W(`link`),scope:uY,root:F().min(1).meta({description:`The folder to link (e.g. ".codex/skills").`}),target:F().min(1).meta({description:`The root it merges into (e.g. ".agents/skills"). Required.`})}),xY=B({action:W(`unlink`),scope:uY,root:F().min(1).meta({description:`The linked folder to materialize back.`}),exclude:z(F().min(1)).optional().meta({description:`Skill names to LEAVE OUT when materializing — the folder keeps every other skill it currently sees (as per-skill links) and stops auto-following the target root.`})}).strict(),SY=B({action:W(`add-root`),scope:uY,root:_Y.meta({description:`New custom skills root to declare (base-relative, e.g. ".team/skills").`})}).strict(),z_e=ui(`action`,[bY.extend({preview:L().optional().meta({description:`Return the merge plan only (moves, drops, removes, conflicts, strays) — nothing is written.`})}).strict(),xY,SY]);ui(`action`,[bY.strict(),xY,SY]),B({folderAction:z_e}).strict();const B_e=B({moves:z(F()),drops:z(F()),removes:z(F()),replaces:z(F()),conflicts:z(F()),strays:z(F())}).strict();B({targets:z(cY),reprojected:z(B({name:F(),hosts:z(F())}).strict()),bundleHosts:z(F()),removedFrom:z(F()),folder:B({moved:z(F()),dropped:z(F()),linked:z(F())}).strict().optional(),preview:B_e.optional()}).strict(),B({scope:uY.default(`project`),name:F(),version:F().regex(/^[0-9a-f]{40}$/i),...IB,summary:LB}).strict(),B({name:F().min(1),version:F(),restoredFiles:z(F()),warnings:z(F())}).strict(),B({query:F().optional(),intent:U([`autocomplete`,`full_text`,`omnibar`]).optional(),ranking:U([`navigation`,`relevance`]).optional(),scopes:z(U([`page`,`folder`,`content`,`file`])).optional(),scope:F().optional(),limit:I().int().nonnegative().optional(),semantic:L().optional(),source:U([`omnibar`,`mcp`,`http`]).optional()}).loose();const V_e=B({kind:U([`page`,`folder`,`content`,`file`]),path:F().min(1),title:F(),score:I(),signals:H(F(),R()),snippet:F().optional()}).loose(),H_e=U([`applied`,`no_match`,`warming`,`incapable`,`provider_error`,`restart_required`,`query_too_short`]),CY=U([`warm`,`corpus`,`query`,`dimensions`,`configured_dimensions`]),wY=B({capable:L(),applied:L(),outcome:H_e,providerErrorReason:CY.nullable().optional().catch(null),coverage:B({embedded:I().int().nonnegative(),total:I().int().nonnegative()})}).loose();B({enabled:L(),keyPresent:L(),keyNotRequired:L(),keySource:U([`project`,`file`,`env`]).nullable(),keyHint:F().nullable(),ready:L(),capable:L(),providerError:L().optional(),providerErrorReason:CY.nullable().optional().catch(null),embedded:I().int().nonnegative(),total:I().int().nonnegative()}).loose(),B({query:F(),intent:U([`autocomplete`,`full_text`,`omnibar`]),results:z(V_e),elapsedMs:I().nonnegative(),semantic:wY.optional(),truncated:L().optional(),ready:L().optional()}).loose();const U_e=B({version:F().min(1),recordedAt:F().min(1)}).loose();B({currentVersion:F().min(1),targets:H(F(),U_e.nullable())}).loose(),B({scope:uY.default(`project`),source:F().min(1).meta({description:`External skill source: full skills.sh skill-page URL (https://www.skills.sh/<owner>/<repo>/<skill>, or https://www.skills.sh/site/<hostname>/<skill> for a website catalog), GitHub owner/repo[/subpath], git URL, or local/file path.`}),skill:F().min(1).optional().meta({description:`Specific skill name to import from a multi-skill source.`}),install:L().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection (the caller installs explicitly afterwards). Default true.`}),marketplace:L().optional().meta({description:"The source came from a skills.sh listing the user chose (the Explore tab), so the install is reported to skills.sh and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...IB,summary:LB}).strict(),B({scope:uY.default(`project`),source:F().min(1).meta({description:`External skill source: full skills.sh skill-page URL, GitHub owner/repo[/subpath], git URL, or local/file path.`}),skills:z(F().min(1)).min(1).max(100).meta({description:`Skill names to import from the source.`}),install:L().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection. Default true.`}),marketplace:L().optional().meta({description:"The source came from a skills.sh listing the user chose (a marketplace plugin bundle), so the import is reported to skills.sh as one batched install event and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...IB,summary:LB}).strict(),B({results:z(B({requested:F(),status:U([`imported`,`already-imported`,`not-found`,`failed`]),name:F().optional(),collisionRenamedFrom:F().optional(),warnings:z(F()),warningCodes:pY,error:F().optional()}).loose()),imported:I(),alreadyImported:I(),failed:I()}).loose(),B({scope:uY.default(`project`),names:z(F().min(1)).min(1).max(100).meta({description:`Managed skill names to refresh from their recorded upstreams.`}),...IB,summary:LB}).strict(),B({results:z(B({requested:F(),status:U([`updated`,`up-to-date`,`not-found`,`failed`]),source:F().optional(),warnings:z(F()),warningCodes:pY,error:F().optional()}).loose()),updated:I(),upToDate:I(),failed:I()}).loose();const W_e=B({source:F(),ref:F().optional(),contentHash:F(),publisher:F().optional()}).loose();B({name:F().min(1).meta({description:`Managed skill name created or matched.`}),path:F().min(1).meta({description:`Store-relative path to the imported skill source.`}),created:L().meta({description:`True when this request created new source files.`}),alreadyImported:L().meta({description:`True when identical content was already present and no files changed.`}),collisionRenamedFrom:F().optional().meta({description:`Original source name when collision handling renamed the import.`}),provenance:W_e,warnings:z(F()).meta({description:`Non-fatal import warnings, such as skipped unsupported files.`}),warningCodes:pY}).loose();const G_e=U([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`,`comments`,`lint-config`,`local-targets`]);B({v:W(1),ch:W(`server-info`),seq:I(),serverInstanceId:F().min(1),currentBranch:F().min(1).optional()}).loose(),B({v:W(1),ch:W(`branch-switched`),seq:I(),branch:F().min(1)}).loose(),B({v:W(1),ch:G_e,seq:I()}).loose(),B({v:W(1),ch:W(`disk-ack`),seq:I(),docName:F().min(1),sv:F().min(1)}).loose(),B({v:W(1),ch:W(`config-validation-rejected`),seq:I(),docName:F().min(1),error:Yc}).loose(),B({v:W(1),ch:W(`config-ignore-nested-error`),seq:I(),path:F().min(1),error:F().min(1)}).loose(),(()=>{let e=globalThis.Intl.Segmenter;return e?new e(`en`,{granularity:`word`}):null})();const TY=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),EY=globalThis;EY[TY]===void 0&&(EY[TY]=mr());const DY=EY[TY],OY=si({version:F().regex(/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(DY,{description:`Recorded skill version for this target.`}),recordedAt:Fr().register(DY,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:U([`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`]).register(DY,{description:`Install-source surface that recorded this entry.`}).optional()}),K_e=si({enabled:L().register(DY,{description:`Whether this user-global skill bundle is opted in.`}),decidedAt:Fr().register(DY,{description:`ISO 8601 timestamp of the opt-in / opt-out decision.`})});si({schema:W(1).register(DY,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:si({"claude-cowork":OY.optional(),"cli-hosts":OY.optional()}).register(DY,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({}),bundles:H(F(),K_e).register(DY,{description:`Per-bundle opt-in decisions keyed by install name. Absent key = no recorded decision.`}).optional(),installsReported:z(F()).register(DY,{description:"Skill installs already reported to skills.sh from this machine, as `<owner/repo>#<skill>`. Append-only; presence suppresses a re-report."}).optional()});const q_e=[`auth-error`,`detached-head`,`dirty-tree`,`diverged-local-commits`,`external-changes-pending`,`git-index-locked`,`git-operation-in-progress`,`no-commits-yet`,`no-push-permission`,`non-content-merge-failure`,`protected-branch`],kY=e=>e*8+4;kY(92),kY(40),Array.from({length:256},(e,t)=>(t+256).toString(16).slice(1));const AY={fileSystem:`File System`,gitUpstream:`Git (upstream)`,service:`OpenKnowledge (service)`,generator:`OpenKnowledge (generated)`};
|
|
416
|
+
`)},mdxJsxFlowElement(e,t,n,r){let i=e,a=i.data?.sourceRaw;if(typeof a==`string`)return a;let o=i.data?.htmlBoundary;if(o&&typeof o.opener==`string`&&typeof o.closer==`string`){let e=n.containerFlow({type:`root`,children:i.children??[]},r);return`${o.opener}\n\n${e}\n\n${o.closer}`}let s=i.name??``,c=fK(i.attributes??[]);if(!i.children||i.children.length===0)return s?c?`<${s} ${c} />`:`<${s} />`:``;let l={...i,attributes:(i.attributes??[]).map(mK),children:(i.children??[]).map(uK)};return cK(l,t,n,r)},mark(e,t,n,r){let i=n.createTracker(r),a=n.enter(`mark`),o=i.move(`==`);return o+=OK(n.containerPhrasing(e,{before:o,after:`==`,...i.current()}),r,`==`),o+=i.move(`==`),a(),o},underline(e,t,n,r){let i=e.data?.sourceForm===`ins`?`<ins>`:`<u>`,a=e.data?.sourceForm===`ins`?`</ins>`:`</u>`,o=n.createTracker(r),s=n.enter(`underline`),c=o.move(i);return c+=n.containerPhrasing(e,{before:c,after:a,...o.current()}),c+=o.move(a),s(),c},comment(e,t,n,r){let i=e.data?.sourceForm,a=i===`html`?`<!-- `:`%%`,o=i===`html`?` -->`:`%%`,s=n.createTracker(r),c=n.enter(`comment`),l=s.move(a);return l+=n.containerPhrasing(e,{before:l,after:o,...s.current()}),l+=s.move(o),c(),l},commentBlock(e,t,n,r){let i=n.createTracker(r),a=n.enter(`commentBlock`),o=e.children??[],s=e.data?.sourceForm,c=e.data?.sourceLayout,l=o.length===1&&o[0]?.type===`paragraph`;if(s===`html`&&l){let e=o[0],t=n.containerPhrasing(e,{before:`<!-- `,after:` -->`,...i.current()});return a(),`<!-- ${t} -->`}if(c===`inline`&&l){let e=o[0],t=n.containerPhrasing(e,{before:`%% `,after:` %%`,...i.current()});return a(),`%% ${t} %%`}let u=n.containerFlow(e,i.current());return a(),`%%\n\n${u}\n\n%%`},mdxJsxTextElement(e){let t=e.data?.sourceRaw;if(typeof t==`string`)return t;let n=e.name??``,r=fK(e.attributes??[]),i=(e.children??[]).map(e=>e&&typeof e==`object`&&`value`in e?String(e.value??``):``).join(``);return i?r?`<${n} ${r}>${i}</${n}>`:`<${n}>${i}</${n}>`:r?`<${n} ${r} />`:`<${n}/>`},rawMdxFallback(e){return e.value??``},blockquote(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.containerFlow(e,a.current());i();let s=e.data?.sourceMarkerSpacings,c=0;return n.indentLines(o,(e,t,n)=>{if(n)return`>`;let r=c++,i=s?.[r];return i===`lazy`&&r>0&&!lK.test(e)?e:i===`none`||i===0?`>${e}`:typeof i==`number`&&i>=2&&!e.startsWith(` `)?`>${` `.repeat(i)}${e}`:`> ${e}`})}};function fK(e){let t=[];for(let n of e){if(n.type===`mdxJsxExpressionAttribute`){t.push(`{${n.value}}`);continue}let e=n.name;if(n.value===null||n.value===void 0){t.push(e);continue}if(typeof n.value==`string`){n.value.includes(`"`)?t.push(`${e}={${pK(n.value)}}`):t.push(`${e}="${n.value}"`);continue}t.push(`${e}={${n.value.value}}`)}return t.join(` `)}function pK(e){return`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function mK(e){return e.type===`mdxJsxAttribute`&&typeof e.value==`string`&&e.value.includes(`"`)?{type:`mdxJsxAttribute`,name:e.name,value:{type:`mdxJsxAttributeValueExpression`,value:pK(e.value)}}:e}function hK(e,t,n=` `){return t===`single`?`${n}'${e.replace(/'/g,`\\'`)}'`:t===`paren`?`${n}(${e.replace(/[()]/g,`\\$&`)})`:`${n}"${e.replace(/"/g,`\\"`)}"`}function gK(e){if(!e)return``;let t=0,n=!0;for(let r of e)r===`(`?t++:r===`)`&&(t--,t<0&&(n=!1));return t!==0&&(n=!1),n?e:e.replace(/[\\()]/g,`\\$&`)}function _K(e){return e.replace(/(?<!\\)&(?=(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z][A-Za-z0-9]*);)/g,(e,t)=>vK(t)?e:`\\${e}`)}function vK(e){if(e.charCodeAt(0)!==35)return!1;let t=e[1]===`x`||e[1]===`X`?Number.parseInt(e.slice(2),16):Number.parseInt(e.slice(1),10);return t===9||t===10||t===11||t===12||t===13||t===32||t===160}const yK=/&#(?:x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);/g;function bK(e){return e.replace(yK,e=>RR(e)?``+e.slice(1):e)}function xK(e){return/[\r\n][\t ]*$/.test(e)}function SK(e,t,n,r=!1){let{matched:i}=iU(t,{escapeAware:!1});if(i.length===0)return CK(e,t,n,r);let a=``,o=0,s=i=>{i>o&&(a+=CK(e,t.slice(o,i),{...n,before:n.before+a,after:t.slice(i,i+1)||n.after},r)),o=i};for(let e of i)s(e.start),!xK(n.before+a)&&(a+=t.slice(e.start,e.end),o=e.end);return s(t.length),a}function CK(e,t,n,r=!1){let i=e.unsafe;e.unsafe=i.filter(e=>!(e.character===`&`&&e.after===`[#A-Za-z]`||e.character===`<`||e.character===`[`||e.character===`(`||e.character===`!`&&e.after===`\\[`&&e.inConstruct===`phrasing`||e.character===`@`&&e.before===`[+\\-.\\w]`||r&&e.character===`:`&&e.before===`[ps]`&&e.after===`\\/`||e.character===`{`&&Array.isArray(e.inConstruct)&&e.inConstruct.includes(`phrasing`)||e.character==="`"||(e.character===`*`||e.character===`_`||e.character===`~`)&&e.inConstruct===`phrasing`||e.character===`=`&&e.atBreak===!0||e.character===` `&&e.inConstruct===`phrasing`&&e.after===`[\\r\\n]`||e.character===` `&&e.inConstruct===`phrasing`&&e.after===`[\\r\\n]`)),e.unsafe=e.unsafe.map(e=>{if(e.character!==`)`||e.atBreak!==!0||e.before!==`\\d+`||e.after!==void 0)return e;let t={...e,after:`(?:[ \r
|
|
417
|
+
]|$)`};return delete t._compiled,t});let a;try{a=e.safe(bK(t),n)}finally{e.unsafe=i}return a=a.replaceAll(``,`\\&`),_K(DK(a,n))}function wK(e){if(Number.isNaN(e))return`ws`;let t=cD(e);return t===1?`ws`:t===2?`punct`:`other`}function TK(e,t,n){let r=wK(t),i=wK(n),a=i!==`ws`&&(i===`other`||r!==`other`),o=r!==`ws`&&(r===`other`||i!==`other`);return e===`_`?a&&(!o||r===`punct`)||o&&(!a||i===`punct`):a||o}function EK(e,t,n){let r=t;for(;r<e.length&&(e[r]===` `||e[r]===` `);)r++;if(r<e.length)return e[r]===`
|
|
418
|
+
`||e[r]===`\r`;let i=n.after.charCodeAt(0);return Number.isNaN(i)||i===10||i===13}function DK(e,t){let n=``,r=0;for(;r<e.length;){let i=e.charAt(r);if(i===`\\`){n+=e.slice(r,r+2),r+=2;continue}if(i===`*`||i===`_`||i===`~`||i===`=`){let a=r+1;for(;a<e.length&&e.charAt(a)===i;)a++;let o=r===0?t.before.charCodeAt(t.before.length-1):e.charCodeAt(r-1);if(i===`=`)n+=(Number.isNaN(o)||o===10||o===13)&&EK(e,a,t)?`\\${e.slice(r,a)}`:e.slice(r,a);else{let s=a<e.length?e.charCodeAt(a):t.after.charCodeAt(0);n+=TK(i,o,s)?`\\${i}`.repeat(a-r):e.slice(r,a)}r=a;continue}n+=i,r+=1}return n}function OK(e,t,n){let r=n.startsWith(`_`)?`_`:`*`,i=t.before??``,a=t.after??``,o=e,s=o.charCodeAt(0);kK(i.charCodeAt(i.length-1),s,r)&&(o=AK(s)+o.slice(1));let c=o.charCodeAt(o.length-1);return kK(a.charCodeAt(0),c,r)&&(o=o.slice(0,-1)+AK(c)),o}function kK(e,t,n){return!(cD(t)!==1||n===`_`&&cD(e)===void 0)}function AK(e){return`&#x${e.toString(16).toUpperCase()};`}function jK(e,t,n,r){let i=e.value??``,a=e.data?.sourceDelimiter,o=typeof a==`string`&&/^\$+$/.test(a)?a.length:2;for(o===1&&!NK(i,r)&&(o=2);RegExp(`(^|[^$])${`\\$`.repeat(o)}([^$]|$)`).test(i);)o++;let s=`$`.repeat(o);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=` ${i} `);let c=-1;for(;++c<n.unsafe.length;){let e=n.unsafe[c];if(!e.atBreak)continue;let t=n.compilePattern(e),r;for(;(r=t.exec(i))!==null;){let e=r.index;i.codePointAt(e)===10&&i.codePointAt(e-1)===13&&e--,i=`${i.slice(0,e)} ${i.slice(r.index+1)}`}}return s+i+s}function MK(e,t,n,r){let i=e.data?.sourceDelimiter===`~`?`~`:`~~`,a=n.createTracker(r),o=n.enter(`strikethrough`),s=a.move(i);return s+=OK(n.containerPhrasing(e,{...a.current(),before:s,after:`~`}),r,i),s+=a.move(i),o(),s}function NK(e,t){return!(e.length===0||!/^\S/.test(e)||!/\S$/.test(e)||/[$\r\n]/.test(e)||e.endsWith(`\\`)||/\\[!-/:-@[-`{-~]/.test(e)||/^\d/.test(t.after)||t.before.endsWith(`\\`))}const PK=[{mode:`protecting`,protect:xU,reservations:yU},{mode:`protecting`,protect:sU,reservations:RH},{mode:`protecting`,protect:hU,reservations:dU},{mode:`serializer-only`,reservations:[{to:``}]}];new Set(PK.flatMap(({reservations:e})=>e.map(({to:e})=>e)));function FK(e,t){switch(t.mode){case`protecting`:return t.protect(e);case`serializer-only`:return e}}function IK(e){return PK.reduce(FK,e)}function LK(e){return e.data?.sourceRaw}function RK(e){return e.type===`text`?e.value===``:e.type===`mdxJsxTextElement`&&LK(e)===``}function zK(e){return e.type===`paragraph`&&(e.children??[]).every(RK)}function BK(e){let t=e.children??[],n=t[0]?.children?.length??0,r=0;for(let e=1;e<t.length;e++)r=Math.max(r,t[e]?.children?.length??0);let i=e.align??[];return Math.max(n,r,i.length)}function VK(e){switch(e.type){case`table`:return BK(e)===0;case`code`:return e.data?.sourceStyle===`indented`&&/^\n*$/.test(e.value??``);case`thematicBreak`:return LK(e)===``;case`html`:return(e.value??``)===``;case`mdxJsxFlowElement`:return LK(e)===void 0&&e.data?.htmlBoundary===void 0&&(e.children??[]).length===0&&!e.name;case`list`:return(e.children??[]).length===0;default:return!1}}function HK(e){let t=[];for(let n of e.children){if(n.type===`table`&&BK(n)===0){console.warn(JSON.stringify({event:`table-serialize-dropped-empty`,rows:(n.children??[]).length}));continue}VK(n)||(n.type===`paragraph`&&n.children.length>0&&zK(n)&&(n.children=[]),t.push(n))}e.children=t}function UK(e,t){let n=e,r=t;return n.type===`heading`&&n.data?.sourceContiguousNext===!0&&r.type===`paragraph`}const WK=(e,t)=>{if(zK(e)||UK(e,t))return 0;let n=e.position,r=t.position;if(!n||!r)return;let i=r.start.line-n.end.line-1;return i>=1?i:void 0},GK=/(?<!\\)\$(?=\S)([^$\n]*?[^\s$])\$(?!\d)/g;function KK(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;EE(e,`text`,(e,t,r)=>{if(r===void 0||t==null)return;let i=e.value;if(i.indexOf(`$`)===-1)return;let a=BU(e);GK.lastIndex=0;let o=[],s;for(;(s=GK.exec(i))!==null;){let e=s.index,t=e+s[0].length;if(WU(a,e,1)||WU(a,t-1,1)){GK.lastIndex=e+1;continue}o.push(s)}if(o.length===0)return;let c=[],l=0;for(let t of o){let r=t.index,i=r+t[0].length;r>l&&c.push(UU(n,e,l,r));let a={type:`inlineMath`,value:t[1]},o=qU(n,e,r,i);o&&(a.position=o),c.push(a),l=i}return l<i.length&&c.push(UU(n,e,l,i.length)),r.children.splice(t,1,...c),[wE,t+c.length]})}}const qK=new Set([`strong`,`emphasis`,`delete`,`link`,`mark`,`comment`]);function JK(e){if(e?.type!==`break`)return!1;let t=e.data?.sourceRaw;return typeof t!=`string`||t.length===0}function YK(e){e.data??={},e.data.sourceRaw=`<br />`,e.data.sourceStyle=`html`}function XK(e){if(e?.type!==`text`)return!1;let t=e.data?.sourceRaw;return typeof t!=`string`||t.length===0}const ZK=/[ \t]+$/,QK=/^[ \t]*$/;function $K(e){return e.some(e=>!(XK(e)&&QK.test(e.value)))}function eq(e,t=!1){for(;e.length>0;){let n=e[e.length-1];if(JK(n)){YK(n);break}if(n&&qK.has(n.type)&&`children`in n){let t=n.children;if(eq(t,!0),t.length===0){e.pop();continue}}if(!t&&XK(n)&&ZK.test(n.value)){let t=n.value.replace(ZK,``);if(t.length>0){n.value=t;continue}if($K(e.slice(0,-1))){e.pop();continue}if(e.every(e=>XK(e)&&QK.test(e.value))){let t=e[0];t.value=t.value.charAt(0),e.splice(1)}}break}}const tq=new Set([`paragraph`,`heading`,`tableCell`]);function nq(e){let t=e=>{if(tq.has(e.type)&&`children`in e&&eq(e.children),`children`in e)for(let n of e.children)t(n)};t(e)}const rq={handlers:{tag:e=>`#${e.value}`},unsafe:[{character:`#`,inConstruct:[`phrasing`],before:`\\s`,after:`[a-zA-Z]`}]};function iq(){let e=this.data();e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===rq)||e.toMarkdownExtensions.push(rq)}const aq=new Set([`u`,`ins`]);function oq(){return e=>{EE(e,`mdxJsxTextElement`,(e,t,n)=>{if(n===void 0||t==null||e.name===null||!aq.has(e.name)||(e.attributes??[]).length>0)return;let r={type:`underline`,children:e.children??[],data:{sourceForm:e.name===`ins`?`ins`:`u`}};return e.position&&(r.position=e.position),n.children.splice(t,1,r),t+1})}}const sq=/(?<!\uE102)<br[ \t]*\/?>/g,cq=new Set([`mdxJsxTextElement`,`mdxJsxFlowElement`]);function lq(e,t){let n=[],r=!1;for(let i of e.children){if(i.type!==`text`){n.push(i);continue}let e=i.value;sq.lastIndex=0;let a=[],o=0;for(;;){let n=sq.exec(e);if(n===null)break;let s=n.index;s>o&&a.push(UU(t,i,o,s));let c={type:`break`,data:{sourceStyle:`html`,sourceRaw:n[0]}},l=qU(t,i,s,s+n[0].length);l&&(c.position=l),a.push(c),o=s+n[0].length,r=!0}a.length===0?n.push(i):(o<e.length&&a.push(UU(t,i,o,e.length)),n.push(...a))}r&&(e.children=n)}function uq(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;EE(e,e=>{if(cq.has(e.type))return wE;let t=e;Array.isArray(t.children)&&lq(e,n)})}}function dq(e){return e===-2?` `:e===-1?` `:String.fromCharCode(e)}const fq={name:`wikiLink`,tokenize:(e,t,n)=>{let r=0,i=0,a=``;return o;function o(t){return t===91?(e.enter(`wikiLink`),e.enter(`wikiLinkMarker`),e.consume(t),s):n(t)}function s(t){return t===91?(e.consume(t),e.exit(`wikiLinkMarker`),e.enter(`wikiLinkTarget`),c):n(t)}function c(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?a.trim()===``?n(t):(e.exit(`wikiLinkTarget`),d(t)):t===35?a.trim()===``?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAnchor`),l):t===124?_B(a)?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),u):(e.consume(t),a+=dq(t),c)}function l(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?r===0?n(t):(e.exit(`wikiLinkAnchor`),d(t)):t===124?r===0?n(t):(e.exit(`wikiLinkAnchor`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),u):(e.consume(t),r++,l)}function u(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?i===0?n(t):(e.exit(`wikiLinkAlias`),d(t)):(e.consume(t),i++,u)}function d(t){return t===93?(e.enter(`wikiLinkMarker`),e.consume(t),f):n(t)}function f(r){return r===93?(e.consume(r),e.exit(`wikiLinkMarker`),e.exit(`wikiLink`),t):n(r)}}},pq={name:`wikiLinkEmbed`,tokenize:(e,t,n)=>{let r=0,i=0,a=``;return o;function o(t){return t===33?(e.enter(`wikiLinkEmbed`),e.enter(`wikiLinkEmbedBang`),e.consume(t),e.exit(`wikiLinkEmbedBang`),s):n(t)}function s(t){return t===91?(e.enter(`wikiLinkMarker`),e.consume(t),c):n(t)}function c(t){return t===91?(e.consume(t),e.exit(`wikiLinkMarker`),e.enter(`wikiLinkTarget`),l):n(t)}function l(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?a.trim()===``?n(t):(e.exit(`wikiLinkTarget`),f(t)):t===35?a.trim()===``?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAnchor`),u):t===124?_B(a)?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),d):(e.consume(t),a+=dq(t),l)}function u(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?r===0?n(t):(e.exit(`wikiLinkAnchor`),f(t)):t===124?r===0?n(t):(e.exit(`wikiLinkAnchor`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),d):(e.consume(t),r++,u)}function d(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?i===0?n(t):(e.exit(`wikiLinkAlias`),f(t)):(e.consume(t),i++,d)}function f(t){return t===93?(e.enter(`wikiLinkMarker`),e.consume(t),p):n(t)}function p(r){return r===93?(e.consume(r),e.exit(`wikiLinkMarker`),e.exit(`wikiLinkEmbed`),t):n(r)}}};function mq(){return{text:{91:fq,33:pq}}}function hq(e){this.enter({type:`wikiLink`,value:``,data:{target:``,anchor:null,alias:null},children:[]},e)}function gq(e){this.enter({type:`wikiLinkEmbed`,value:``,data:{target:``,anchor:null,alias:null},children:[]},e)}function _q(e){return e.stack[e.stack.length-1]}function vq(e){let t=_q(this),n=this.sliceSerialize(e);t.data.target=n.trim(),n!==t.data.target&&(t.data.sourceTarget=n)}function yq(e){let t=_q(this),n=this.sliceSerialize(e),r=n.trim();t.data.anchor=r.length?r:null,t.data.anchor!==null&&n!==r&&(t.data.sourceAnchor=n)}function bq(e){let t=_q(this),n=this.sliceSerialize(e),r=n.trim();t.data.alias=r.length?r:null,n!==r&&(t.data.sourceAlias=n)}function xq(e){let t={target:e.data.target,anchor:e.data.anchor??null,alias:e.data.alias??null},n=mB(t,{separatorCrossed:t.alias!==null||e.data.sourceAlias!=null});n.target!==t.target&&(e.data.sourceTarget??=t.target,e.data.target=n.target),n.anchor!==t.anchor&&(e.data.sourceAnchor??=t.anchor,e.data.anchor=n.anchor),n.alias!==t.alias&&(e.data.sourceAlias??=t.alias,e.data.alias=n.alias)}function Sq(e){xq(e);let{target:t,anchor:n,alias:r}=e.data,i=r||(n?`${t}#${n}`:t);e.value=i,e.children=[{type:`text`,value:i}]}function Cq(e){Sq(_q(this)),this.exit(e)}function wq(e){Sq(_q(this)),this.exit(e)}const Tq={enter:{wikiLink:hq,wikiLinkEmbed:gq},exit:{wikiLinkTarget:vq,wikiLinkAnchor:yq,wikiLinkAlias:bq,wikiLink:Cq,wikiLinkEmbed:wq}};function Eq(e){return(t,n,r,i)=>{let a=t.data,o=r.stack.includes(`tableCell`),s=e=>o?bB(e):e,c=a?.target??``,l=a?.anchor,u=a?.alias,d=`${e}${s(gB(a?.sourceTarget,c,`separatorAdjacent`))}`;if(l)d+=`#${s(gB(a?.sourceAnchor,l,`separatorAdjacent`))}`;else{let e=s(gB(a?.sourceAnchor,``,`separatorAdjacent`));e.length>0&&(d+=`#${e}`)}let f=u?gB(a?.sourceAlias,u,`alias`):gB(a?.sourceAlias,``,`alias`);if(f.length>0){let e=o&&!d.endsWith(`\\`)?`\\|`:`|`;d+=`${e}${s(f)}`}return`${d}]]`}}const Dq={handlers:{wikiLink:Eq(`[[`),wikiLinkEmbed:Eq(`![[`)},unsafe:[{character:`[`,inConstruct:[`phrasing`]}]},Oq=mq();function kq(){let e=this.data();e.micromarkExtensions||=[],e.micromarkExtensions.some(e=>e===Oq)||e.micromarkExtensions.push(Oq),e.fromMarkdownExtensions||=[],e.fromMarkdownExtensions.some(e=>e===Tq)||e.fromMarkdownExtensions.push(Tq),e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===Dq)||e.toMarkdownExtensions.push(Dq)}function Aq(e){return e.children.some(e=>{let t=e.type;return t!==`yaml`&&t!==`toml`})?e:{...e,children:[...e.children,{type:`paragraph`,children:[]}]}}const jq=[{name:`remark-parse`,plugin:pA},{name:`escape-provenance`,plugin:nG},{name:`remark-mdx-agnostic`,plugin:aK},{name:`remark-gfm`,plugin:wO},{name:`remark-math`,plugin:Ok,options:{singleDollarTextMath:!1}},{name:`remark-wiki-link`,plugin:kq},{name:`remark-github-alerts`,plugin:gk,options:FU},{name:`callout-transformer`,plugin:PU},{name:`restore-from-mdx`,plugin:lU},{name:`void-br-promoter`,plugin:uq},{name:`restore-entity-refs`,plugin:vU},{name:`restore-backslash-escapes`,plugin:SU},{name:`details-accordion-promoter`,plugin:jW},{name:`div-align-promoter`,plugin:BW},{name:`image-promoter`,plugin:uG},{name:`indented-code-promoter`,plugin:gG},{name:`math-promoter`,plugin:DG},{name:`single-dollar-math-promoter`,plugin:KK},{name:`highlight-promoter`,plugin:lG},{name:`underline-promoter`,plugin:oq},{name:`mermaid-promoter`,plugin:HG},{name:`comment-promoter`,plugin:XU},{name:`merged-post-parse-walker`,plugin:BG},{name:`empty-task-item-unmint`,plugin:qW},{name:`link-reference-destination`,plugin:TG},{name:`non-rendering-context-demote`,plugin:tK},{name:`ensure-non-empty-doc`,plugin:()=>Aq}];function Mq(e){let t=kO();for(let e of jq)t=`options`in e&&e.options!==void 0?t.use(e.plugin,e.options):t.use(e.plugin);return t=t.use(HO,{schema:e.schema,handlers:e.handlers}),t.freeze(),t}function Nq(e){let t=kO().use(fk,[`yaml`]).use(wO,{tablePipeAlign:!1}).use(Ok,{singleDollarTextMath:!1}).use(aK).use(kq).use(iq).use(bhe,{bullet:`-`,fences:!0,rule:`-`,join:[WK],...e.toMarkdownHandlers?{handlers:e.toMarkdownHandlers}:{}});return t.freeze(),t}function Pq(e){return e.charCodeAt(0)===65279?{source:e.slice(1),hadBom:!0}:{source:e,hadBom:!1}}const Fq=/^\n+$/,Iq=/^\n{2,}$/;function Lq(e,t,n){let r,i,a=e.children;if(a.length>0){let e=a[0]?.position?.start?.offset;if(typeof e==`number`&&e>0){let n=t.slice(0,e);Fq.test(n)&&(r=n)}let n=a[a.length-1]?.position?.end?.offset;if(typeof n==`number`&&n<=t.length){let e=t.slice(n);Iq.test(e)&&(i=e)}}if(!n&&r===void 0&&i===void 0)return;let o={...n?{bom:!0}:{},...r===void 0?{}:{leading:r},...i===void 0?{}:{trailing:i}};return e.data??={},e.data.sourceDocBoundary=o,o}function Rq(e){if(typeof e!=`object`||!e)return;let t=e,n={};return t.bom===!0&&(n.bom=!0),typeof t.leading==`string`&&Fq.test(t.leading)&&(n.leading=t.leading),typeof t.trailing==`string`&&Iq.test(t.trailing)&&(n.trailing=t.trailing),n.bom||n.leading||n.trailing?n:void 0}function zq(e,t){let{source:n,hadBom:r}=Pq(e),i=bW(n),a=new hE(IK(i)),o=t.parse(a);a.value=i;let s=t.runSync(o,a);bG(s,i);let c=Lq(s,i,r),l=c?rR(s,c):void 0,u=t.stringify(s);return l?u.type.create({...u.attrs,sourceDocBoundary:l},u.content,u.marks):u}function Bq(e,t){return Hq(e,t,!1)}function Vq(e,t){return Hq(e,t,!0)}function Hq(e,t,n){let{source:r,hadBom:i}=Pq(e),a=bW(r),o=new hE(IK(a)),s=t.parse(o);o.value=a;let c=t.runSync(s,o);n&&bG(c,a);let l=Lq(c,a,i);return n&&l&&rR(c,l),c}function Uq(e,t,n){let r=WO(e,{schema:n.schema,nodeHandlers:n.pmNodeHandlers,markHandlers:n.pmMarkHandlers});Wq(r),GW(r),nq(r),HK(r);let i=Rq(e.attrs?.sourceDocBoundary),a=String(t.stringify(r));return i?.leading&&(a=i.leading+a),i?.trailing&&(a=a.replace(/\n+$/,``)+i.trailing),i?.bom&&(a=`\uFEFF${a}`),a}function Wq(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)Wq(t);for(let t=0;t+1<e.children.length;){let n=e.children[t],r=e.children[t+1],i=n?.data,a=r?.data,o=PH(i)?i.escapedChars:null,s=PH(a)?a.escapedChars:null;if(n?.type!==`text`||r?.type!==`text`||typeof n.data?.sourceRaw==`string`||typeof r.data?.sourceRaw==`string`||o===null&&s===null){t+=1;continue}let c=n.value.length;n.value+=r.value,n.data??={},n.data.escapedChars=[...o??[],...(s??[]).map(e=>({...e,offset:e.offset+c}))],r.data?.entityRefSpans?.length&&(n.data.entityRefSpans=[...n.data.entityRefSpans??[],...r.data.entityRefSpans.map(e=>({...e,offset:e.offset+c}))]),e.children.splice(t+1,1)}}}function Gq(){return typeof process>`u`||!process.env?!1:process.env.NODE_ENV===`development`||process.env.NODE_ENV===`test`}function Kq(e){let t=e.lastIndexOf(`/`);return t===-1?``:t===0?`/`:e.slice(0,t)}function qq(e,t){let n=e?`${e}/${t}`:t,r=n.startsWith(`/`),i=[];for(let e of n.split(`/`))if(e!==``&&e!==`.`){if(e===`..`){let e=i[i.length-1];i.length>0&&e!==`..`?i.pop():r||i.push(`..`);continue}i.push(e)}let a=i.join(`/`);return r?`/${a}`:a}function Jq(e,t){if(typeof e!=`string`||e===``||!t||e.startsWith(`/`)||!bz(e))return e;let n=qq(Kq(t),e);return n===``||n===`..`||n.startsWith(`../`)?(Gq()&&console.warn(`[resolve-image-url] doc-relative path escapes contentDir; emitting raw URL: ${e} (from sourcePath ${t})`),e):`/${n}`}function Yq(e){if(!Number.isFinite(e)||e<0)return``;if(e<1024)return`${e} B`;let t=[`KiB`,`MiB`,`GiB`,`TiB`],n=e/1024,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(1).replace(/\.0$/,``)} ${t[r]}`}var Xq=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};freshnessHolder={checker:void 0};constructor(e){this.schema=Mv(e.extensions),this.handlers=oJ(this.schema,this.parseCtx),this.freshnessHolder.checker=e.deriveStructuralFreshness?MR({parse:e=>this.parseWithFallback(e)}):void 0;let{nodeHandlers:t,markHandlers:n}=sJ(this.schema,this.freshnessHolder);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=Mq({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=Nq({toMarkdownHandlers:dK})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return zq(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?Bq(e,this.parseProcessor):{type:`root`,children:[]}}parseToEditorMdast(e){return e.trim()?Vq(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?bH(e,{parse:e=>this.parse(e,t)}):{type:`doc`,content:[{type:`paragraph`,content:[]}]}}serialize(e,t){let n;try{n=this.schema.nodeFromJSON(e)}catch(t){let n=`MarkdownManager.serialize() failed: schema rejected JSONContent (type=${e.type}, childCount=${e.content?.length??0})`;throw Error(n,{cause:t})}let r=this.freshnessHolder.checker;t?.skipFreshnessDerive&&(this.freshnessHolder.checker=void 0);try{return Uq(n,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}finally{this.freshnessHolder.checker=r}}};const Zq=cH();function Qq(e,t){let n=new Map;for(let e of t)n.set(e.name,e);let r={};for(let t of e){if(t.type===`mdxJsxExpressionAttribute`)continue;let e=t.name,i=n.get(e);if(t.value===null||t.value===void 0){r[e]=!0;continue}if(typeof t.value==`string`){if(i?.type===`number`){let n=Number(t.value);r[e]=Number.isNaN(n)?t.value:n}else r[e]=i?.type===`boolean`?t.value===`true`:t.value;continue}let a=t.value.value;try{r[e]=JSON.parse(a)}catch{r[e]=a}}return r}function $q(e){let t=!1;return e.descendants(e=>t?!1:e.type.name===`jsxInline`?(e.attrs.sourceDirty&&(t=!0),!1):e.type.name===`jsxComponent`&&e.attrs.sourceDirty?(t=!0,!1):!0),t}function eJ(e,t){return e.attrs.sourceDirty||$q(e)?!0:t?t.isDiverged(e.toJSON()):!1}function tJ(e){if(e.type!==`paragraph`)return!1;let t=e.children??[];return t.length===0||t.every(e=>e.type===`text`&&e.value===``)}function nJ(e,t){if(!t)return e;let n={};return t.sourceFenceChar&&(n.sourceFenceChar=t.sourceFenceChar),typeof t.sourceFenceLength==`number`&&(n.sourceFenceLength=t.sourceFenceLength),t.sourcePadded===!0&&(n.sourcePadded=!0),Object.keys(n).length===0?e:{...e,data:n}}function rJ(e,t){if(e.length===0)return nJ({type:`inlineCode`,value:``},t);if(e.every(e=>e.type===`text`))return nJ({type:`inlineCode`,value:e.map(e=>e.value).join(``)},t);if(e.length===1&&`children`in e[0]){let n=e[0];return{...n,children:[rJ(n.children,t)]}}return nJ({type:`inlineCode`,value:iJ(e)},t)}function iJ(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=iJ(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}const aJ=vs;function oJ(e,t){let n=e.nodes,r=e.marks,i={};n.paragraph&&(i.paragraph=(e,t,r)=>{let i=r.all(e).flat(),a=i.some(e=>e?.isBlock&&!e?.isInline),o=i.some(e=>e?.isInline||e?.isText||e?.isTextblock);if(a&&!o)return i.length===1?i[0]:i;if(a&&o){let e=i.filter(e=>!e?.isBlock||e?.isInline),t=i.filter(e=>e?.isBlock&&!e?.isInline),r=[],a=n.paragraph.createAndFill(null,e.length>0?e:null);return a&&r.push(a),r.push(...t),r.length===1?r[0]:r}return n.paragraph.createAndFill(null,i.length>0?i:null)}),n.blockquote&&(i.blockquote=BO(n.blockquote,e=>({sourceMarkerSpacings:e.data?.sourceMarkerSpacings??null}))),n.tableCell&&(i.tableCell=(e=>(t,r,i)=>{let a=i.all(t).flat();if(a.length>0&&n.paragraph){let t=n.paragraph.create(null,a);return e.createAndFill(null,[t])}return e.createAndFill(null,null)})(n.tableCell)),n.tableRow&&(i.tableRow=BO(n.tableRow)),n.table&&n.tableRow&&n.tableCell&&(i.table=(e,t,r)=>{let i=e.align??[],a=e.children??[],o=[];for(let e=0;e<a.length;e++){let t=a[e];if(t.type!==`tableRow`)continue;let s=t.children??[],c=[];for(let t=0;t<s.length;t++){let a=s[t];if(a.type!==`tableCell`)continue;let o=r.all(a).flat(),l=o.length>0&&n.paragraph?[n.paragraph.create(null,o)]:null,u=i[t]??null,d=e===0&&n.tableHeader?n.tableHeader:n.tableCell,f=a.data?.sourcePadding??null,p=d.createAndFill({align:u,sourcePadding:f},l);p&&c.push(p)}let l=n.tableRow.createAndFill(null,c.length>0?c:null);l&&o.push(l)}let s=e.data?.sourceDashCounts??null,c=e.data?.sourceOuterPipes??null,l=e.data?.sourceAlignmentPadding??null;return n.table.createAndFill({sourceDashCounts:s,sourceOuterPipes:c,sourceAlignmentPadding:l},o.length>0?o:null)}),n.image&&(i.image=e=>{let r=e.url??``,i=Jq(r,t.current.sourcePath);return n.image.createAndFill({src:i,alt:e.alt??null,title:e.title??null,sourceUrl:i===r?null:r})},i.imageReference=n.imageReference?e=>n.imageReference.createAndFill({alt:e.alt??``,label:e.label??e.identifier??``,identifier:e.identifier??``,referenceType:e.referenceType??`shortcut`}):e=>n.image.createAndFill({src:``,alt:e.alt??null,title:null})),r.escapeMark&&(i.text=t=>{let n=t.value??``,i=typeof t.data?.sourceRaw==`string`?t.data.sourceRaw:null;if(!n&&!i)return null;if(i)return r.sourceLiteral?e.text(n,[r.sourceLiteral.create({sourceRaw:i})]):e.text(n);let a=t.data?.escapedChars,o=t.data?.entityRefSpans;if(!a?.length&&!o?.length)return e.text(n);let s=[...(a??[]).map(e=>({kind:`escape`,offset:e.offset,length:1})),...(o??[]).map(e=>({kind:`entity`,offset:e.offset,length:e.length,raw:e.raw}))];s.sort((e,t)=>e.offset-t.offset);let c=[];for(let e of s){let t=c[c.length-1];e.kind===`entity`&&t?.kind===`entity`&&t.offset+t.length===e.offset&&VR(t.raw)!==null&&RR(e.raw)?c[c.length-1]={kind:`entity`,offset:t.offset,length:t.length+e.length,raw:t.raw+e.raw}:c.push(e)}let l=[],u=0;for(let t of c){if(t.offset>u){let r=n.slice(u,t.offset);r&&l.push(e.text(r))}if(t.offset<n.length){let i=n.slice(t.offset,t.offset+t.length);if(i){if(t.kind===`escape`)l.push(e.text(i,[r.escapeMark.create()]));else if(r.sourceLiteral){let n=VR(t.raw);l.push(e.text(n??i,[r.sourceLiteral.create({sourceRaw:t.raw})]))}else l.push(e.text(i))}u=t.offset+t.length}}if(u<n.length){let t=n.slice(u);t&&l.push(e.text(t))}return l.length===1?l[0]:l}),r.code&&(i.inlineCode=t=>e.text(t.value,[r.code.create({sourceFenceChar:t.data?.sourceFenceChar??"`",sourceFenceLength:typeof t.data?.sourceFenceLength==`number`?t.data.sourceFenceLength:1,sourcePadded:t.data?.sourcePadded===!0})]));let a=r.strike??r.delete;if(a&&(i.delete=VO(a,e=>({sourceDelimiter:e.data?.sourceDelimiter===`~`?`~`:`~~`}))),r.highlight&&(i.mark=VO(r.highlight)),r.underline&&(i.underline=VO(r.underline,e=>({sourceForm:e.data?.sourceForm===`ins`?`ins`:`u`}))),r.comment&&(i.comment=VO(r.comment,e=>({sourceForm:e.data?.sourceForm??`percent`}))),n.commentBlock&&(i.commentBlock=BO(n.commentBlock,e=>({sourceForm:e.data?.sourceForm??`percent`,sourceLayout:e.data?.sourceLayout??`block`}))),r.emphasis&&(i.emphasis=VO(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=VO(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=BO(n.heading,e=>({level:e.depth,headingStyle:e.data?.sourceStyle??`atx`,sourceTrailingHashes:e.data?.sourceTrailingHashes??null,sourceUnderlineLength:e.data?.sourceUnderlineLength??null,sourceContiguousNext:e.data?.sourceContiguousNext??!1,sourceLeadingIndent:e.data?.sourceLeadingIndent??null,sourceInteriorSpacing:e.data?.sourceInteriorSpacing??null}))),n.codeBlock&&(i.code=t=>{let r=t.value?[e.text(t.value)]:[];return n.codeBlock.createAndFill({language:t.lang??null,meta:t.meta??null,fenceDelimiter:t.data?.sourceFenceChar??"`",fenceLength:t.data?.sourceFenceLength??3,sourceStyle:t.data?.sourceStyle??`fenced`,sourceClosingFenceLength:t.data?.sourceClosingFenceLength??null,sourceUnclosedFence:t.data?.sourceUnclosedFence??!1,sourceFenceIndent:t.data?.sourceFenceIndent??null,sourceInfoPadding:t.data?.sourceInfoPadding??null,sourceIndents:t.data?.sourceIndents??null},r)}),n.thematicBreak&&(i.thematicBreak=e=>n.thematicBreak.createAndFill({sourceRaw:e.data?.sourceRaw??`---`})),n.hardBreak&&(i.break=e=>n.hardBreak.createAndFill({hardBreakStyle:e.data?.sourceStyle??`spaces`,sourceRaw:e.data?.sourceRaw??null})),n.list&&(i.list=BO(n.list,e=>({ordered:!!e.ordered,start:e.start??1,spread:!!e.spread,bulletMarker:e.data?.bulletMarker??null,listMarkerDelimiter:e.data?.listMarkerDelimiter??null}))),n.listItem&&(i.listItem=BO(n.listItem,e=>({checked:e.checked??null,spread:!!e.spread,sourceMarkerSpacing:e.data?.sourceMarkerSpacing??null,sourceOrdinal:e.data?.sourceOrdinal??null,sourceCheckboxChar:e.data?.sourceCheckboxChar??null,sourceContinuationIndent:e.data?.sourceContinuationIndent??null}))),r.link){let t=r.sourceLiteral;i.link=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[](${n.url??``})`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.url??``,title:n.title??null,linkStyle:n.data?.sourceStyle??`inline`,refLabel:null,sourceUrlForm:n.data?.sourceUrlForm??null,sourceTitleMarker:n.data?.sourceTitleMarker??null});return o.map(e=>e.mark(s.addToSet(e.marks)))},i.linkReference=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[${n.label??``}][${n.identifier??``}]`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.data?.resolvedUrl??``,title:n.data?.resolvedTitle??null,linkStyle:n.referenceType??`shortcut`,refLabel:n.label??n.identifier??null});return o.map(e=>e.mark(s.addToSet(e.marks)))}}n.htmlBlock&&(i.html=e=>n.htmlBlock.createAndFill({content:e.value??``}));let o=n.linkDefinition??n.linkRefDef;if(o){let e=!!o.spec.attrs?.url,t=!!o.spec.attrs?.href,n=!!o.spec.attrs?.identifier,r=!!o.spec.attrs?.sourceLayout,a=!!o.spec.attrs?.sourceTitleMarker;i.definition=i=>{let s={title:i.title??null};return n&&(s.identifier=i.identifier??``),s.label=i.label??i.identifier??``,e?s.url=i.url??``:t&&(s.href=i.url??``),r&&(s.sourceLayout=i.data?.sourceLayout??null),a&&(s.sourceTitleMarker=i.data?.sourceTitleMarker??null),o.createAndFill(s)}}if(n.jsxComponent){let r=e=>{if(e&&typeof e==`object`&&`sourceRaw`in e){let t=e.sourceRaw;if(typeof t==`string`)return t}};i.mdxJsxFlowElement=(e,i,a)=>{let o=e.name??``,s=Zq.getOrWildcard(o),c=Qq(e.attributes,s.props);if(o===`CommonMarkImage`&&typeof c.src==`string`){let e=c.src,n=Jq(e,t.current.sourcePath);n!==e&&(c.src=n,c.sourceUrl=e)}let l=a.all(e).flat();return n.jsxComponent.createAndFill({componentName:o,kind:`element`,attributes:e.attributes,sourceRaw:r(e.data)??``,sourceDirty:!1,props:c},l.length?l:void 0)};let a=(e,t)=>{let n=e.attributes?.find(e=>e.type===`mdxJsxAttribute`&&e.name===t);return n&&typeof n.value==`string`?n.value:null};i.mdxJsxTextElement=t=>{if(t.name===`InlineMath`&&n.mathInline){let e=a(t,`formula`)??``,r=a(t,`id`);return n.mathInline.create({formula:e,id:r??null})}if(t.name===`Tag`&&n.tag){let e=a(t,`value`)??``;return n.tag.create({value:e})}let i=t.name??``,o=i?Zq.get(i):void 0;if(o&&n.jsxInline){let e=Qq(t.attributes,o.props),a=r(t.data)??``,s=(t.children??[]).map(e=>e&&typeof e==`object`&&`value`in e?String(e.value??``):``).join(``);return s&&(e.children=s),n.jsxInline.createAndFill({componentName:i,attributes:t.attributes,sourceRaw:a,sourceDirty:!1,props:e})}if(n.jsxInline){let i=r(t.data)??``;return n.jsxInline.createAndFill({},i?[e.text(i)]:null)}return n.jsxComponent.createAndFill({sourceRaw:r(t.data)??``})},i.mdxFlowExpression=e=>{let t=r(e.data)??`{${e.value??``}}`;return n.jsxComponent.createAndFill({kind:`expression`,sourceRaw:t,sourceDirty:!1})},i.mdxTextExpression=t=>{let n=r(t.data)??`{${t.value??``}}`;return e.text(n)}}return n.wikiLink&&(i.wikiLink=e=>n.wikiLink.createAndFill({target:e.data?.target??``,alias:e.data?.alias??null,anchor:e.data?.anchor??null,sourceTarget:e.data?.sourceTarget??null,sourceAnchor:e.data?.sourceAnchor??null,sourceAlias:e.data?.sourceAlias??null})),n.tag&&(i.tag=e=>n.tag.createAndFill({value:e.value})),n.wikiLinkEmbed&&(i.wikiLinkEmbed=(i,a)=>{let o=i.data?.target??``,s=i.data?.alias??null,c=i.data?.anchor??null,l=i.data?.sourceTarget??null,u=i.data?.sourceAnchor??null,d=i.data?.sourceAlias??null,f=TB(o),{resolveEmbed:p,sourcePath:m}=t.current,h=p&&m?p(o,m)??null:null,g=h?`/${h}`:o,_=a?.type===`paragraph`&&Array.isArray(a.children)&&a.children.length===1;if(_&&aJ.has(f)&&n.jsxComponent&&Zq.has(`WikiEmbedImage`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedImage`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:g,alt:s??o,target:o,anchor:c,alias:s,sourceTarget:l,sourceAnchor:u,sourceAlias:d}});if(_&&ys.has(f)&&n.jsxComponent&&Zq.has(`WikiEmbedVideo`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedVideo`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:g,title:s??o,target:o,anchor:c,alias:s,sourceTarget:l,sourceAnchor:u,sourceAlias:d}});if(_&&bs.has(f)&&n.jsxComponent&&Zq.has(`WikiEmbedAudio`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedAudio`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:g,title:s??o,target:o,anchor:c,alias:s,sourceTarget:l,sourceAnchor:u,sourceAlias:d}});if(_&&xs.has(f)&&n.jsxComponent&&Zq.has(`WikiEmbedFile`)){let{resolveSize:e}=t.current,r=e&&m?e(o,m)??null:null,i=r===null?null:Yq(r);return n.jsxComponent.createAndFill({componentName:`WikiEmbedFile`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:g,target:o,anchor:c,alias:s,size:i,sourceTarget:l,sourceAnchor:u,sourceAlias:d}})}let v=s||(c?`${o}#${c}`:o);if(r.link){let t=r.link.create({href:g,title:null,linkStyle:`inline`,refLabel:null,sourceForm:`wikiembed`,target:o,anchor:c,alias:s,sourceTarget:l,sourceAnchor:u,sourceAlias:d});return e.text(v,[t])}throw Error("[wikiLinkEmbed handler] schema lacks `link` mark — cannot dispatch without violating the STOP rule against emitting PM wikiLinkEmbed server-side")}),n.mathInline&&(i.inlineMath=e=>n.mathInline.create({formula:e.value??``,sourceDelimiter:e.data?.sourceDelimiter??null})),i.math||=t=>{let r=t.value==null?`«unknown:${t.type}»`:t.value;return n.rawMdxFallback?(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled block mdast: ${t.type}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled block mdast: ${t.type}`},r?[e.text(r)]:null)):null},i.inlineMath||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled inline mdast: ${t.type}`})),t.value==null?e.text(`«unknown:${t.type}»`):e.text(t.value)),n.footnoteReference?i.footnoteReference=e=>n.footnoteReference.create({identifier:e.identifier,label:e.label??e.identifier}):i.footnoteReference||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteReference`,reason:`FootnoteReference extension missing — recovering [^id] source`})),e.text(`[^${t.label??t.identifier}]`)),n.footnoteDefinition?i.footnoteDefinition=BO(n.footnoteDefinition,e=>{let t=e;return{identifier:t.identifier,label:t.label??t.identifier}}):i.footnoteDefinition||=t=>{console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteDefinition`,reason:`FootnoteDefinition extension missing — recovering [^id]: marker`}));let r=`[^${t.label??t.identifier}]: `;return n.paragraph?n.paragraph.create(null,e.text(r)):null},i.rawMdxFallbackMdast=t=>{if(!n.rawMdxFallback)return null;let r=t.position?{start:t.position.start?.offset??0,end:t.position.end?.offset??0}:{start:0,end:0};return console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.originalType,reason:`Unhandled mdast: ${t.originalType}`,unresolvedPosition:t.unresolvedPosition??!1})),n.rawMdxFallback.createAndFill({reason:`Unhandled mdast: ${t.originalType}`,originalSpan:r},t.value?[e.text(t.value)]:null)},i}function sJ(e,t){let n={},r={},i=e.nodes,a=e.marks;i.paragraph&&(n.paragraph=GO(`paragraph`)),i.blockquote&&(n.blockquote=GO(`blockquote`,e=>{let t=e.attrs.sourceMarkerSpacings,n={};return Array.isArray(t)&&t.length>0&&(n.sourceMarkerSpacings=t),Object.keys(n).length>0?{data:n}:{}})),i.heading&&(n.heading=GO(`heading`,e=>({depth:e.attrs.level,data:{sourceStyle:e.attrs.headingStyle,sourceTrailingHashes:e.attrs.sourceTrailingHashes??void 0,sourceUnderlineLength:e.attrs.sourceUnderlineLength??void 0,sourceContiguousNext:e.attrs.sourceContiguousNext===!0||void 0,sourceLeadingIndent:e.attrs.sourceLeadingIndent??void 0,sourceInteriorSpacing:e.attrs.sourceInteriorSpacing??void 0}}))),i.codeBlock&&(n.codeBlock=e=>{let t=e.attrs.sourceStyle===`indented`?`indented`:`fenced`;return{type:`code`,lang:t===`indented`?null:e.attrs.language??null,meta:t===`indented`?null:e.attrs.meta??null,value:e.textContent??``,data:{sourceFenceChar:e.attrs.fenceDelimiter,sourceFenceLength:e.attrs.fenceLength,sourceStyle:t,sourceClosingFenceLength:e.attrs.sourceClosingFenceLength??void 0,sourceUnclosedFence:e.attrs.sourceUnclosedFence===!0||void 0,sourceFenceIndent:e.attrs.sourceFenceIndent??void 0,sourceInfoPadding:e.attrs.sourceInfoPadding??void 0,sourceIndents:e.attrs.sourceIndents??void 0}}}),i.thematicBreak&&(n.thematicBreak=e=>({type:`thematicBreak`,data:{sourceRaw:e.attrs.sourceRaw}})),i.hardBreak&&(n.hardBreak=e=>({type:`break`,data:{sourceStyle:e.attrs.hardBreakStyle,...typeof e.attrs.sourceRaw==`string`&&e.attrs.sourceRaw.length>0?{sourceRaw:e.attrs.sourceRaw}:{}}})),i.list&&(n.list=GO(`list`,e=>({ordered:e.attrs.ordered??!1,start:e.attrs.ordered?e.attrs.start??1:null,spread:e.attrs.spread??!1,data:{bulletMarker:e.attrs.bulletMarker,listMarkerDelimiter:e.attrs.listMarkerDelimiter}}))),i.listItem&&(n.listItem=(e,t,n)=>{let r=n.all(e),i=r.length>1&&tJ(r[0])?r.slice(1):r,a={};return typeof e.attrs.sourceMarkerSpacing==`number`&&(a.sourceMarkerSpacing=e.attrs.sourceMarkerSpacing),typeof e.attrs.sourceOrdinal==`number`&&(a.sourceOrdinal=e.attrs.sourceOrdinal),e.attrs.sourceCheckboxChar===`X`&&(a.sourceCheckboxChar=`X`),typeof e.attrs.sourceContinuationIndent==`number`&&(a.sourceContinuationIndent=e.attrs.sourceContinuationIndent),{type:`listItem`,checked:e.attrs.checked??null,spread:e.attrs.spread??!1,...Object.keys(a).length>0?{data:a}:{},children:i}}),i.table&&(n.table=(e,t,n)=>{let r=n.all(e),i=[],a=e.firstChild;a&&a.forEach(e=>{let t=e.attrs.align;i.push(t===`left`||t===`right`||t===`center`?t:null)});let o=r.filter(e=>e.type===`tableRow`),s=e.attrs.sourceDashCounts,c={};Array.isArray(s)&&s.length>0&&(c.sourceDashCounts=s);let l=e.attrs.sourceOuterPipes;typeof l==`object`&&l&&typeof l.leading==`boolean`&&typeof l.trailing==`boolean`&&(c.sourceOuterPipes=l);let u=e.attrs.sourceAlignmentPadding;Array.isArray(u)&&u.length>0&&(c.sourceAlignmentPadding=u);let d=Object.keys(c).length>0?c:void 0,f={type:`table`,align:i,children:o};return d&&(f.data=d),f}),i.tableRow&&(n.tableRow=GO(`tableRow`));let o=(e,t)=>{let n={type:`tableCell`,children:pV(t)},r=e.attrs.sourcePadding;return typeof r==`object`&&r&&typeof r.left==`number`&&typeof r.right==`number`&&(n.data={sourcePadding:r}),n};if(i.tableCell&&(n.tableCell=(e,t,n)=>o(e,n.all(e))),i.tableHeader&&(n.tableHeader=(e,t,n)=>o(e,n.all(e))),i.image&&(n.image=e=>({type:`image`,url:e.attrs.sourceUrl??e.attrs.src,alt:e.attrs.alt,title:e.attrs.title})),i.imageReference&&(n.imageReference=e=>{let t=e.attrs.label??``,n=e.attrs.identifier??t;return{type:`imageReference`,alt:e.attrs.alt??``,identifier:n,label:t||n,referenceType:e.attrs.referenceType??`shortcut`}}),i.htmlBlock&&(n.htmlBlock=e=>({type:`html`,value:e.attrs.content})),i.linkDefinition??i.linkRefDef){let e=i.linkDefinition?`linkDefinition`:`linkRefDef`;n[e]=e=>{let t={},n=e.attrs.sourceLayout;(n===`multiline`||n===`inline`)&&(t.sourceLayout=n);let r=e.attrs.sourceTitleMarker;(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r);let i={type:`definition`,identifier:e.attrs.identifier??e.attrs.label??``,label:e.attrs.label??e.attrs.identifier??``,url:e.attrs.url??e.attrs.href??``,title:e.attrs.title};return Object.keys(t).length>0&&(i.data=t),i}}if(i.jsxComponent&&(n.jsxComponent=(e,n,r)=>{if(e.attrs.kind===`expression`)return{type:`html`,value:e.attrs.sourceRaw??``};let i=e.attrs.componentName||null,a=Array.isArray(e.attrs.attributes)?e.attrs.attributes:[];return!eJ(e,t.checker)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:i,attributes:a,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:Zq.getOrWildcard(i??`*`).serialize(e,{all:e=>r.all(e),registry:Zq,serializeChildren:()=>{throw Error(`SerializeContext.serializeChildren is not available in the PM→mdast handler. Compat descriptors that need markdown-byte body rendering must emit a marker mdast node and let the to-markdown handler render the body via state.containerFlow.`)}})}),i.rawMdxFallback&&(n.rawMdxFallback=e=>{let t=e.textContent??``,n=typeof e.attrs.reason==`string`?e.attrs.reason:``,r=e.attrs.originalSpan;return{type:`rawMdxFallback`,value:t,data:{reason:n,originalSpan:r&&typeof r==`object`&&`start`in r&&`end`in r?{start:Number(r.start)||0,end:Number(r.end)||0}:{start:0,end:0}}}}),i.jsxInline&&(n.jsxInline=e=>{let t=e.attrs.componentName||``;if(t&&e.attrs.sourceDirty)return vV(t,e,Zq.get(t)?.props);let n=e.attrs.attributes,r=e.attrs.sourceRaw||e.textContent||``;return{type:`mdxJsxTextElement`,name:t||null,attributes:Array.isArray(n)?n:[],children:[],data:{sourceRaw:String(r)}}}),i.mathInline&&(n.mathInline=e=>{let t=e.attrs.formula??``,n=e.attrs.id;if(typeof n==`string`&&n.length>0)return{type:`mdxJsxTextElement`,name:`InlineMath`,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t},{type:`mdxJsxAttribute`,name:`id`,value:n}],children:[]};let r=e.attrs.sourceDelimiter;return{type:`inlineMath`,value:t,...typeof r==`string`&&r.length>0?{data:{sourceDelimiter:r}}:{}}}),i.wikiLink&&(n.wikiLink=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLink`,value:i,data:{target:t,anchor:n,alias:r,sourceTarget:typeof e.attrs.sourceTarget==`string`?e.attrs.sourceTarget:null,sourceAnchor:typeof e.attrs.sourceAnchor==`string`?e.attrs.sourceAnchor:null,sourceAlias:typeof e.attrs.sourceAlias==`string`?e.attrs.sourceAlias:null},children:[{type:`text`,value:i}]}}),i.tag&&(n.tag=e=>({type:`tag`,value:String(e.attrs.value??``)})),i.wikiLinkEmbed&&(n.wikiLinkEmbed=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),a.emphasis&&(r.emphasis=KO(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.strong&&(r.strong=KO(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.code&&(r.code=(e,t,n)=>{let r=e.attrs.sourceFenceChar,i=e.attrs.sourceFenceLength;return rJ(n,{sourceFenceChar:r,sourceFenceLength:i,sourcePadded:e.attrs.sourcePadded===!0||void 0})}),a.strike??a.delete){let e=a.strike?`strike`:`delete`;r[e]=KO(`delete`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter===`~`?`~`:`~~`}}))}return a.highlight&&(r.highlight=KO(`mark`)),a.underline&&(r.underline=KO(`underline`,e=>({data:{sourceForm:e.attrs.sourceForm===`ins`?`ins`:`u`}}))),a.comment&&(r.comment=KO(`comment`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`}}))),i.commentBlock&&(n.commentBlock=GO(`commentBlock`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`,sourceLayout:e.attrs.sourceLayout===`inline`?`inline`:`block`}}))),i.footnoteReference&&(n.footnoteReference=e=>{let t=String(e.attrs.identifier??``);return{type:`footnoteReference`,identifier:t,label:e.attrs.label?String(e.attrs.label):t}}),i.footnoteDefinition&&(n.footnoteDefinition=GO(`footnoteDefinition`,e=>({identifier:String(e.attrs.identifier??``),label:e.attrs.label?String(e.attrs.label):String(e.attrs.identifier??``)}))),a.link&&(r.link=(e,t,n)=>{if(e.attrs.sourceForm===`wikiembed`){let t=typeof e.attrs.target==`string`&&e.attrs.target.length>0?e.attrs.target:e.attrs.href??``,r=typeof e.attrs.anchor==`string`&&e.attrs.anchor.length>0?e.attrs.anchor:null,i=typeof e.attrs.alias==`string`&&e.attrs.alias.length>0?e.attrs.alias:null,a=typeof e.attrs.sourceTarget==`string`?e.attrs.sourceTarget:null,o=typeof e.attrs.sourceAnchor==`string`?e.attrs.sourceAnchor:null,s=typeof e.attrs.sourceAlias==`string`?e.attrs.sourceAlias:null,c=i||(r?`${t}#${r}`:t),l=n.map(e=>`value`in e&&typeof e.value==`string`?e.value:``).join(``);return l!==c&&l.trim().length>0&&!l.includes(`]]`)&&(i=l,c=l),{type:`wikiLinkEmbed`,value:c,data:{target:t,anchor:r,alias:i,sourceTarget:a,sourceAnchor:o,sourceAlias:s},children:[{type:`text`,value:c}]}}let r=e.attrs.linkStyle;if(r===`autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`autolink`}};if(r===`gfm-autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`gfm-autolink`}};if(r===`inline`||!r){let t={};e.attrs.sourceUrlForm===`angle-bracketed`&&(t.sourceUrlForm=`angle-bracketed`);let r=e.attrs.sourceTitleMarker;return(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r),{type:`link`,url:e.attrs.href??``,title:e.attrs.title??null,children:n,...Object.keys(t).length>0?{data:t}:{}}}return{type:`linkReference`,identifier:(e.attrs.refLabel??``).toLowerCase(),label:e.attrs.refLabel,referenceType:r,children:n}}),a.escapeMark&&(r.escapeMark=(e,t,n)=>{for(let e of n)if(e.type===`text`&&e.value){let t=e;t.data??={},t.data.escapedChars??=[];for(let e=0;e<t.value.length;e++)t.data.escapedChars.push({offset:e,char:t.value[e]})}return n.length===1?n[0]:n}),a.sourceLiteral&&(r.sourceLiteral=(e,t,n)=>{let r=typeof e.attrs.sourceRaw==`string`?e.attrs.sourceRaw:``;if(n.length===1&&n[0]?.type===`text`){let e=n[0],t=r||e.value;return rB(t,e.value)&&(e.data??={},e.data.sourceRaw=t),e}return{type:`text`,value:n.filter(e=>e.type===`text`).map(e=>e.value??``).join(``)||r}}),{nodeHandlers:n,markHandlers:r}}const cJ={default:!0,MD013:!1};function lJ(e){return e??cJ}function uJ(e){let t=e.replace(/\\/g,`/`);for(;t.startsWith(`./`);)t=t.slice(2);let n=t.toLowerCase();for(let e of QR)if(n.endsWith(e))return t.slice(0,-e.length);return t}function dJ(e){let t=(e===void 0?[]:Array.isArray(e)?e:[e]).map(e=>e.trim()).filter(e=>e.length>0),n=[],r=[],i=[],a=[],o=0;for(let e of t){let t=e.startsWith(`!`),s=t?e.slice(1):e;if(t||(o+=1),s.length===0){n.push({pattern:e,detail:`empty pattern`});continue}try{let e=(0,VN.default)(s,{dot:!0,strictBrackets:!0});(t?a:i).push(e)}catch(t){n.push({pattern:e,detail:t instanceof Error?t.message:String(t)});continue}if(s.endsWith(`/`))r.push({pattern:e,reason:`trailing-slash`});else if(s.startsWith(`/`))r.push({pattern:e,reason:`leading-slash`});else{let t=s.toLowerCase();QR.some(e=>t.endsWith(e))&&r.push({pattern:e,reason:`doc-extension`})}}let s=o===0;return{invalidPatterns:n,suspiciousPatterns:r,matches(e){if(e===void 0||e===``)return!1;let t=uJ(e);return t===``||!(s||i.some(e=>e(t)))?!1:!a.some(e=>e(t))}}}function fJ(e,t){let n=new Set,r=[];for(let i of e){if(i.enabled===!1||!i.schema||!dJ(i.appliesTo).matches(t))continue;let e=i.key??i.file;n.has(e)||(n.add(e),r.push({file:i.file,schema:i.schema}))}return r}const pJ={"draft-06":`http://json-schema.org/draft-06/schema#`,"draft-07":`http://json-schema.org/draft-07/schema#`,"2019-09":`https://json-schema.org/draft/2019-09/schema`,"2020-12":`https://json-schema.org/draft/2020-12/schema`},mJ=Object.keys(pJ),hJ=new Map(mJ.map(e=>[gJ(pJ[e]),e]));function gJ(e){return e.replace(/^https?:\/\//,``).replace(/#$/,``)}function _J(e){let t=e.$schema;return t===void 0?`draft-07`:typeof t==`string`?hJ.get(gJ(t))??null:null}const vJ=new Map;function yJ(e){throw Error(`Unhandled FrontmatterSchemaDialect: ${JSON.stringify(e)}`)}function Ihe(e){let t=vJ.get(e);if(t)return t;let n={allErrors:!0,strict:!1},r;switch(e){case`2020-12`:r=new zN.default(n);break;case`2019-09`:r=new RN.default(n);break;case`draft-06`:case`draft-07`:r=new LN.default(n);break;default:return yJ(e)}return(0,BN.default)(r),vJ.set(e,r),r}function bJ(e){let{$schema:t,...n}=e;return n}function Lhe(e,t){let n=Ihe(e),r=t.$id;return typeof r==`string`&&r!==``&&n.removeSchema(r),n.compile(bJ(t))}const xJ=new Map;function Rhe(e){let t=JSON.stringify(e),n=xJ.get(t);if(n!==void 0)return n;let r=null,i=_J(e);if(i!==null)try{r=Lhe(i,e)}catch{r=null}return xJ.size>=256&&xJ.clear(),xJ.set(t,r),r}function zhe(e){let t=new Map;if(!id.test(e))return{data:{},keyLines:t};let{frontmatter:n}=Iie(e),r=Lie(n);if(r.trim()===``)return{data:{},keyLines:t};let i=(0,cs.parseDocument)(r,{uniqueKeys:!1});if(i.errors.length>0)return{data:{},keyLines:t};let a=i.toJS();if(typeof a!=`object`||!a||Array.isArray(a))return{data:{},keyLines:t};if((0,cs.isMap)(i.contents))for(let e of i.contents.items){let n=e.key;if(!(0,cs.isScalar)(n)||typeof n.value!=`string`||!n.range)continue;let i=0,a=Math.min(n.range[0],r.length);for(let e=0;e<a;e++)r.charCodeAt(e)===10&&i++;t.has(n.value)||t.set(n.value,i+1)}return{data:a,keyLines:t}}const Bhe={"date-time":`an ISO 8601 datetime with an explicit UTC offset, for example "2026-09-23T00:00:00Z"`};function SJ(e){let t=e.format;return typeof t==`string`?Bhe[t]:void 0}function CJ(e){if(e===void 0)return``;let t;if(typeof e==`string`)t=`"${e}"`;else try{t=JSON.stringify(e)??String(e)}catch{t=String(e)}return t.length>60&&(t=`${t.slice(0,57)}…`),` (got ${t})`}function Vhe(e){if(!e.startsWith(`/`))return null;let t=e.slice(1).split(`/`)[0]??``;return t===``?null:t.replace(/~1/g,`/`).replace(/~0/g,`~`)}function Hhe(e){return e.split(`/`).slice(1).map(e=>e.replace(/~1/g,`/`).replace(/~0/g,`~`)).join(`.`)}function wJ(e,t,n){if(t.length===0)return[];let r=n?.source??`frontmatter`,{data:i,keyLines:a}=zhe(e),o=e.split(`
|
|
419
|
+
`),s=e=>({start:{line:e,character:0},end:{line:e,character:o[e]?.length??0}}),c=[];for(let{schema:e,ruleId:n}of t){let t=Rhe(e);if(t&&!t(i))for(let e of t.errors??[]){let t=e.keyword;if(t===`if`)continue;let o=0,l,u=`invalid`,d;if(t===`maxProperties`&&e.instancePath===``)l=`This document must not have frontmatter`;else if(t===`required`&&e.instancePath===``){let t=String(e.params.missingProperty??``);l=`Frontmatter property "${t}" is required`,u=`missing`,t!==``&&(d=t)}else if(e.instancePath===``)l=`Frontmatter ${e.message??`violates "${t}"`}`;else{let n=Vhe(e.instancePath);n!==null&&(o=a.get(n)??0);let r=Hhe(e.instancePath),s=n!==null&&r===n?i[n]:void 0;if(t===`enum`)l=`Frontmatter property "${r}" must be one of: ${(e.params.allowedValues??[]).map(String).join(`, `)}${CJ(s)}`;else if(t===`format`&&SJ(e.params)!==void 0){let t=e.params.format;l=`Frontmatter property "${r}" must be ${SJ(e.params)} (format "${String(t)}")${CJ(s)}`}else l=`Frontmatter property "${r}" ${e.message??`violates "${t}"`}`}c.push({range:s(o),severity:`warning`,source:r,code:n??t,message:l,frontmatterScope:u,...d===void 0?{}:{frontmatterProperty:d}})}}return c}function Uhe(e,t){return PL(e,jL({strings:{doc:e},config:t}).doc??[])}function Whe(e,t){let n=jL({strings:{doc:e},config:t}).doc??[],r=e.split(`
|
|
420
|
+
`),i=Ghe(t);return n.map(e=>qhe(e,r,Khe(e,i)))}function Ghe(e){let t=new Map;return Object.entries(e).forEach(([e,n],r)=>{let i=e.toUpperCase();if(i===`DEFAULT`)return;let a=null;if(n===`error`||n===`warning`)a=n;else if(typeof n==`object`&&n&&!Array.isArray(n)){let e=n.severity;(e===`error`||e===`warning`)&&(a=e)}a!==null&&t.set(i,{entryIndex:r,severity:a})}),t}function Khe(e,t){let n;for(let r of e.ruleNames){let e=t.get(r.toUpperCase());e!==void 0&&(n===void 0||e.entryIndex>n.entryIndex)&&(n=e)}return n?.severity??`warning`}function qhe(e,t,n){let[r,i]=e.errorRange??[1,null],a=e.lineNumber-1,o=(r??1)-1,s=t[a]?.length??0,c=i==null?s:Math.min(o+i,s),l=e.fixInfo?[Jhe(e.fixInfo,e.lineNumber,t)]:void 0;return{range:{start:{line:a,character:o},end:{line:a,character:Math.max(c,o)}},severity:n,source:`markdownlint`,code:e.ruleNames[0]??`MD000`,message:e.errorDetail?`${e.ruleDescription}: ${e.errorDetail}`:e.ruleDescription,...l?{fixes:l}:{}}}function Jhe(e,t,n){let r=e.lineNumber??t,i=r-1;if(e.deleteCount===-1){if(r<n.length)return{range:{start:{line:i,character:0},end:{line:i+1,character:0}},newText:``};if(i>0){let e=n[i-1]?.length??0;return{range:{start:{line:i-1,character:e},end:{line:i,character:n[i]?.length??0}},newText:``}}return{range:{start:{line:0,character:0},end:{line:0,character:n[0]?.length??0}},newText:``}}let a=(e.editColumn??1)-1;return{range:{start:{line:i,character:a},end:{line:i,character:a+Math.max(0,e.deleteCount??0)}},newText:e.insertText??``}}const Yhe=[`no-wiki-links`,`log-shape`,`index-shape`,`reserved-casing`,`frontmatter-required`,`frontmatter-recommended`,`frontmatter-provenance`,`frontmatter-computation`,`frontmatter-reserved-index`,`frontmatter-root-index`,`project-no-mdx`];function TJ(e,t){return e?.[t]!==!1}function Xhe(e){return`${e.replace(/^frontmatter-/,``)}.schema.json`}function EJ(e){return`.ok/okf/${Xhe(e)}`}const Zhe={$schema:`http://json-schema.org/draft-07/schema#`,title:`OKF v0.2 — required frontmatter`,description:"The OKF v0.2 conformance floor. A bundle is conformant when every non-reserved .md file contains a parseable YAML frontmatter block whose `type` is non-empty. This schema is the whole of that floor: a concept carrying only `type` is fully conformant. Section numbers cite OKF v0.2: https://github.com/GoogleCloudPlatform/open-knowledge-format/blob/ad30107c31c06aec8a7d5636e0d1058118604e6f/SPEC.md#11-conformance",type:`object`,required:[`type`],properties:{type:{type:`string`,pattern:`\\S`,description:"REQUIRED, and the only always-required key in OKF. A short string identifying the kind of concept; consumers use it for routing, filtering, and presentation. Type values are not registered centrally — pick something descriptive and self-explanatory (`BigQuery Table`, `BigQuery Dataset`, `API Endpoint`, `Metric`, `Playbook`, `Reference`, `Attested Computation`). Consumers must tolerate unknown types, typically by treating them as generic concepts. The `\\S` pattern is what makes §11 rule 2 mean what it says, and it replaces a `minLength` rather than joining one: a length check alone accepts a whitespace-only value that no consumer can route on, and having both would report one mistake twice. OKF v0.2 §4.1, §11."}}},Qhe={$schema:`http://json-schema.org/draft-07/schema#`,title:`OKF v0.2 — recommended frontmatter`,description:"Shapes for the OKF v0.2 recommended keys. Every key here is optional, and nothing is constrained beyond the shape OKF states: declaring a key pins its YAML type when present (so `tags` written as a comma-separated string warns) and advertises it to agents at read time. Section numbers cite OKF v0.2: https://github.com/GoogleCloudPlatform/open-knowledge-format/blob/ad30107c31c06aec8a7d5636e0d1058118604e6f/SPEC.md#41-frontmatter",type:`object`,properties:{title:{type:`string`,description:`Human-readable display name. If omitted, consumers MAY derive a title from the filename. OKF v0.2 §4.1.`},description:{type:`string`,description:"A single sentence summarizing the concept. Used by `index.md` generators, search snippets, and previews. OKF v0.2 §4.1."},resource:{type:`string`,format:`uri-reference`,description:"A URI that uniquely identifies the underlying asset the concept describes. Absent for concepts that describe abstract ideas rather than physical resources. Path-valued: an absolute URL, a bundle-relative path beginning with `/`, or an ordinary relative path — hence `uri-reference`, not `uri`, which would reject `/tables/customers.md`. OKF v0.2 §4.1, §6.2."},tags:{type:`array`,items:{type:`string`},description:`A YAML list of short strings for cross-cutting categorization. Tags stay a first-class concept through this field; OKF specifies no separate per-tag file format, so a consumer that wants a tag-browsing view synthesizes one by scanning frontmatter. OKF v0.2 §3.1, §4.1.`},timestamp:{description:"LEGACY (OKF v0.1), superseded by `generated.at` in v0.2 — one of the two deliberate breaking changes. Consumers MAY fall back to it when `generated` is absent; new documents SHOULD write `generated: { by, at }` instead. Documented here so agents are told what it is and what replaced it, but deliberately left unconstrained: v0.2 does not define it as a producer field, so validating its shape would be a rule OKF no longer has. OKF v0.2 §5.2, §13.1."}}},$he={$schema:`http://json-schema.org/draft-07/schema#`,title:`OKF v0.2 — provenance, trust, and lifecycle frontmatter`,description:'The optional OKF v0.2 families that make "where did this come from", "how much should I trust it", and "is it still current" answerable from frontmatter alone. Every key is optional, and absence carries meaning rather than being an error: a concept with no `verified` is unverified, and a consumer must not reject it. Only `sources[].resource` and `generated.by` are required-when-their-parent-is-present, because those are the two fields OKF marks REQUIRED in this family; every other field is described but not mandated, so nothing else is enforced. Section numbers cite OKF v0.2: https://github.com/GoogleCloudPlatform/open-knowledge-format/blob/ad30107c31c06aec8a7d5636e0d1058118604e6f/SPEC.md#5-provenance-trust-and-lifecycle',type:`object`,properties:{sources:{type:`array`,description:"The materials this concept derives from, external or internal to the bundle. Lineage is expressed through links rather than a dedicated field: when an entry's `resource` points at another OKF concept, the derivation edge already exists in the bundle graph, so a consumer may recurse into that source's own `sources`. OKF v0.2 §5.1.",items:{type:`object`,required:[`resource`],properties:{resource:{type:`string`,description:"REQUIRED within an entry. Either a concrete artifact a consumer can follow (an absolute URL, a bundle-relative path, or a path into a `references/` subdirectory) or a population or scope descriptor it cannot, for example `all queries in BigQuery project X`. Deliberately NOT format-constrained: a scope descriptor is prose, so a `uri-reference` check here would warn on conformant documents. OKF v0.2 §5.1, §6.2, §6.3."},id:{type:`string`,description:"Optional. A stable key used to attribute individual claims: a markdown footnote whose label is this id (`[^ga4-schema]`) attributes the claim it follows. SHOULD be present when the body cites the source. Keyed rather than positional because agents constantly rewrite these documents — a positional index misattributes silently the moment the list is reordered. OKF v0.2 §5.1."},title:{type:`string`,description:`Optional. Human-readable label for the source. OKF v0.2 §5.1.`},author:{type:`string`,description:"Optional credibility signal — an authority signal: who or what produced the source. OKF describes this as following the actor convention (§7), but its own examples use a `team:<id>` prefix that the three §7 forms do not cover, so no pattern is enforced. OKF v0.2 §5.1, §7."},usage_count:{type:`integer`,description:"Optional credibility signal — an adoption and liveness signal: how often `resource` was exercised (dashboard views, query executions, page reads) over `usage_window`. For a single artifact it is that artifact's own exercise count; for a scope descriptor it is the number of exercises within the scope that touch the concept. Coarse by design: comparable at the alive-versus-dead and order-of-magnitude level and against a source's own history, but not a precise cross-kind ranking. Read as liveness and trend, not as a score. OKF v0.2 §5.1."},last_modified:{type:`string`,format:`date-time`,description:"Optional credibility signal — a recency signal: when the source itself last changed, as an ISO 8601 datetime with an explicit UTC offset (`2026-06-15T00:00:00Z`). Distinct from `generated.at`, which records when the concept was written. OKF v0.2 §5, §5.1."},usage_window:{type:`object`,description:"Optional per-entry override of the `usage_window` written as a sibling of `sources`. OKF v0.2 §5.1.",properties:{from:{type:`string`,format:`date-time`,description:"Start of the window framing this entry's `usage_count`, as an ISO 8601 datetime with an explicit UTC offset (`2026-06-01T00:00:00Z`). OKF v0.2 §5, §5.1."},to:{type:`string`,format:`date-time`,description:"End of the window framing this entry's `usage_count`, as an ISO 8601 datetime with an explicit UTC offset (`2026-06-30T00:00:00Z`). OKF v0.2 §5, §5.1."}}}}}},usage_window:{type:`object`,description:"Written once as a sibling of `sources`, this frames every `usage_count` in the list with a `{ from, to }` range. A single entry may carry its own `usage_window` to override it. OKF v0.2 §5, §5.1.",properties:{from:{type:`string`,format:`date-time`,description:"Start of the shared usage window, as an ISO 8601 datetime with an explicit UTC offset (`2026-06-01T00:00:00Z`). OKF v0.2 §5, §5.1."},to:{type:`string`,format:`date-time`,description:"End of the shared usage window, as an ISO 8601 datetime with an explicit UTC offset (`2026-06-30T00:00:00Z`). OKF v0.2 §5, §5.1."}}},generated:{type:`object`,required:[`by`],description:"How the current content was produced. Kept distinct from `verified` because who wrote a concept need not be who confirmed it. OKF v0.2 §5.2.",properties:{by:{type:`string`,description:"REQUIRED within `generated`. An actor in the OKF convention: `<producer>/<version>` for agents and tools (`reference_agent/gemini-2.5-pro`), `human:<id>` for a person (`human:ahormati`), or `process:<id>` for an automated process (`process:finance-nightly`). Consumers that classify trust key off the `human:` prefix, so producers MUST use it for hand-authored or human-confirmed content — a rule about which form to pick for which content, which frontmatter alone cannot check, so the three forms are documented here rather than enforced by a pattern. OKF v0.2 §5.2, §7."},at:{type:`string`,format:`date-time`,description:"An ISO 8601 datetime with an explicit UTC offset (`2026-06-30T14:00:00Z`) marking the content's last meaningful change. Consumers use it to tell a recent edit from a stale fact. Supersedes v0.1's top-level `timestamp`. OKF v0.2 §5, §5.2, §13.1."}}},verified:{description:'Who or what has confirmed the content against its sources or `resource` — a list of verification events. Multiple entries capture independent checks, for example a human sign-off plus a nightly process; "how recently" is the latest `at`. Independent of `generated.at`: content can change without re-confirmation, and facts can be re-confirmed without regeneration. A single verifier MAY be written as one bare `{ by, at }` mapping without the list dash, and consumers MUST treat that as a one-element list — hence the two accepted shapes here. Absence means unverified, which is a valid state, never a rejection. OKF v0.2 §5.2, §5.3, §11.',anyOf:[{type:`object`,description:`The bare single-verifier mapping form. OKF v0.2 §5.2.`,properties:{by:{type:`string`,description:"The verifying actor: `<producer>/<version>`, `human:<id>`, or `process:<id>`. A `human:` verifier is what raises the trust tier to human-reviewed; non-human verifiers alone yield machine-confirmed. OKF v0.2 §5.2, §5.3, §7."},at:{type:`string`,format:`date-time`,description:"An ISO 8601 datetime with an explicit UTC offset (`2026-07-01T09:00:00Z`) recording when the verification event happened. OKF v0.2 §5, §5.2."}}},{type:`array`,description:`The list form: one entry per independent verification event. OKF v0.2 §5.2.`,items:{type:`object`,properties:{by:{type:`string`,description:"The verifying actor: `<producer>/<version>`, `human:<id>`, or `process:<id>`. A `human:` verifier is what raises the trust tier to human-reviewed; non-human verifiers alone yield machine-confirmed. OKF v0.2 §5.2, §5.3, §7."},at:{type:`string`,format:`date-time`,description:"An ISO 8601 datetime with an explicit UTC offset (`2026-07-01T09:00:00Z`) recording when the verification event happened. OKF v0.2 §5, §5.2."}}}}]},status:{enum:[`draft`,`stable`,`deprecated`],description:"Lifecycle state. `draft` = not yet reviewed, possibly incomplete. `stable` = ready for consumption. `deprecated` = kept for links and history, no longer current. Absent means `stable`, so the key is only worth writing to say draft or deprecated. These three values are the whole set OKF defines, which is why this is the pack's only enum. OKF v0.2 §5.4."},stale_after:{type:`string`,format:`date-time`,description:"An absolute instant, an ISO 8601 datetime with an explicit UTC offset (`2026-12-31T00:00:00Z`): the concept is stale when `now >= stale_after`. Absolute rather than a relative TTL so staleness stays a plain comparison with no reference to when the concept was read. An instant in the past is a freshness signal for consumers, not a violation. OKF v0.2 §5, §5.5, §10.5."}}},ege={$schema:`http://json-schema.org/draft-07/schema#`,title:`OKF v0.2 — Attested Computation frontmatter`,description:'Shapes for the OKF v0.2 computation keys, which turn a concept into a sanctioned way to compute a value so a consumer can confirm the agent ran the blessed computation instead of improvising its own. Provenance answers "where did this claim come from"; attestation answers "was this number produced the way we said it must be". This file also carries the one value-shaped rule in the pack: `runtime` is the single key OKF marks REQUIRED here, and only when `type` is `Attested Computation`. Ordinary concepts never match that condition and are unaffected, and no other key in the family is mandated. OKF records the computation and the means to check it and executes nothing itself; receipts and verdicts are runtime artifacts that are never stored in the bundle. Section numbers cite OKF v0.2: https://github.com/GoogleCloudPlatform/open-knowledge-format/blob/ad30107c31c06aec8a7d5636e0d1058118604e6f/SPEC.md#10-attested-computations-concept',type:`object`,if:{required:[`type`],properties:{type:{const:`Attested Computation`,description:"The condition, not a constraint: everything in `then` applies only to documents whose `type` is exactly `Attested Computation`. An ordinary concept never matches, so nothing in this schema is ever asked of it. `type` is also required inside the condition so a document with no type at all fails the conformance floor once, rather than also being told it is missing a `runtime` for a type it never claimed."}}},then:{required:[`runtime`]},properties:{runtime:{type:`string`,description:"REQUIRED for `type: Attested Computation`. The single field that says how to run the computation, and therefore how the executor and attester interpret it and what `parameters` mean — a parameter is a SQL bind variable, a dbt var, or a Python argument depending on the runtime. Keeping `runtime` and `parameters` in one frontmatter is what makes the binding semantics self-evident. Example values: `bigquery`, `postgres`, `dbt`, `python`, `Looker`. Not a closed set, so no enum. OKF v0.2 §10.1, §10.2."},parameters:{type:`array`,description:`The typed, named holes the agent may fill. An agent MAY only supply values for these parameters; it MUST NOT author or edit the computation. That parameter-only surface is what makes "did the sanctioned thing run" a mechanical comparison rather than a judgement call. OKF v0.2 §10.2, §10.3.`,items:{type:`object`,properties:{name:{type:`string`,description:"The parameter name the computation binds, for example `year` bound as `@year` in BigQuery SQL or `{{ var('year') }}` in dbt. OKF v0.2 §10.2, §10.3."},type:{type:`string`,description:"The parameter's type, interpreted by `runtime` (`integer`, `string`, and so on). Deliberately not constrained to JSON Schema type names, because the vocabulary belongs to the runtime. OKF v0.2 §10.2."},required:{type:`boolean`,description:`Whether the agent must supply a value for this parameter. OKF v0.2 §10.2.`}}}},computation:{type:`string`,format:`uri-reference`,description:"Optional. A path to a file holding the computation, used instead of an inline body fence — best for a long or generated computation, or one already kept as a real file shared with non-OKF tooling. When absent, the body's `# Computation` fence IS the computation. Path-valued: an absolute URL, a bundle-relative path beginning with `/`, or a relative path. OKF v0.2 §6.2, §10.2, §10.3."},executor:{type:`object`,description:"How the computation is run. A runner — an agent, or deterministic consumer code — follows `resource`, and the run returns a receipt shaped by `receipt`. Binding the computation with the parameter values into the executable artifact is the consumer's job. OKF v0.2 §10.2, §10.5.",properties:{resource:{type:`string`,format:`uri-reference`,description:"Names the run instructions or code. What sits behind it — a Skill, a script, a container — is a packaging choice; OKF fixes the interface, not the packaging. Conventionally points into a `references/` subdirectory, for example `references/skills/run-on-bq.md`. OKF v0.2 §1, §6.2, §6.3, §10.2."},receipt:{type:`array`,items:{type:`string`},description:"Declares the fields a run must return — the evidence the attester inspects, for example `[job_id, executed_sql, result]` for BigQuery or `[run_id, compiled_sql, result]` for dbt. Because the attester compares the expanded, compiled artifact the receipt carries, a rewritten query, a swapped computation file, or a mutated dependency fails the check. The receipt itself is a runtime artifact and is never stored in the bundle. OKF v0.2 §10.2, §10.3, §10.5."}}},attester:{type:`object`,description:"The deterministic check that inspects a receipt and returns a verdict. Meant to run consumer-side. Distinct from `verified`: `verified` confirms the definition still matches policy and is recorded in the bundle, while attestation confirms a single run produced the value the sanctioned way and is not stored. OKF v0.2 §10.2, §10.6.",properties:{resource:{type:`string`,format:`uri-reference`,description:"Names code — no LLM — that takes a receipt and returns a verdict, independently re-deriving the binding of `computation` with the claimed parameter values to compare against what actually ran. Conventionally points into a `references/` subdirectory, for example `references/attesters/sql-equality.py`. OKF v0.2 §6.2, §6.3, §10.2, §10.3."}}}}},tge={$schema:`http://json-schema.org/draft-07/schema#`,title:`OKF v0.2 — index files carry no frontmatter`,description:"`index.md` is a reserved filename at any level of the hierarchy and must not be used for a concept document. Index files contain no frontmatter, with exactly one exception — a bundle-root `index.md` may carry `okf_version` — which the scope carves out with a `!index` exclusion rather than a keyword here. `maxProperties: 0` is the mechanism rather than the boolean schema `false`, because a document with no frontmatter block validates as `{}` and `false` would reject that too, flagging the very documents that are correct. `log.md` is deliberately NOT covered: §9 constrains a log's date headings, ordering, and prose entries but never its frontmatter, and OKF's own reference bundle ships a `log.md` carrying `type` and `title`. Section numbers cite OKF v0.2: https://github.com/GoogleCloudPlatform/open-knowledge-format/blob/ad30107c31c06aec8a7d5636e0d1058118604e6f/SPEC.md#8-index-files",type:`object`,maxProperties:0},nge={$schema:`http://json-schema.org/draft-07/schema#`,title:`OKF v0.2 — bundle-root index.md`,description:"The bundle-root `index.md` is the only index file OKF permits frontmatter in, and `okf_version` is the key it names there. OKF states the declaration as a MAY, so it is not required here. Nor is the frontmatter closed to other keys: §8 grants the exception for `okf_version` specifically, but §11 tells consumers not to reject a bundle over unknown additional keys, and that ambiguity is resolved in favor of the looser reading. The one thing pinned is the value's shape, because a YAML float is provably lossy where a version string is not. Section numbers cite OKF v0.2: https://github.com/GoogleCloudPlatform/open-knowledge-format/blob/ad30107c31c06aec8a7d5636e0d1058118604e6f/SPEC.md#12-versioning",type:`object`,properties:{okf_version:{type:`string`,pattern:`^[0-9]+\\.[0-9]+$`,description:'The OKF version this bundle targets, as `<major>.<minor>` — currently `"0.2"`. Quote it: unquoted `0.2` parses as a YAML number, so a consumer comparing version strings sees a float instead, and `0.10` would silently become `0.1`. A minor bump is backward-compatible additions; a major bump may rename required fields or change reserved filenames. Consumers that do not understand the declared version should attempt best-effort consumption rather than refusing the bundle. OKF v0.2 §12.'}}},DJ=[`**`,`!**/{index,log}`],OJ=[{id:`frontmatter-required`,appliesTo:DJ,schema:Zhe},{id:`frontmatter-recommended`,appliesTo:DJ,schema:Qhe},{id:`frontmatter-provenance`,appliesTo:DJ,schema:$he},{id:`frontmatter-computation`,appliesTo:DJ,schema:ege},{id:`frontmatter-reserved-index`,appliesTo:[`**/index`,`!index`],schema:tge},{id:`frontmatter-root-index`,appliesTo:[`index`],schema:nge}],rge=Object.fromEntries(Yhe.filter(e=>!OJ.some(t=>t.id===e)).map(e=>[e,!1]));function kJ(e,t){return t===void 0?[]:OJ.filter(n=>TJ(e,n.id)&&dJ([...n.appliesTo]).matches(t))}function ige(e){return OJ.filter(t=>TJ(e,t.id)).map(e=>({appliesTo:[...e.appliesTo],file:EJ(e.id)}))}function age(e,t,n){let r=kJ(t,n);return r.length===0?[]:wJ(e,r.map(e=>({file:EJ(e.id),schema:e.schema,ruleId:e.id})),{source:`okf`})}function AJ(e,t){return FL(`okf:${e}`,(n,r)=>{try{t(n,r)}catch(t){console.warn(`[lint] OKF rule "${e}" failed${r.data.okfDocName?` on "${r.data.okfDocName}"`:``}`,t)}})}function jJ(e,t,n){let r=dJ(t);return AJ(e,(e,t)=>{r.matches(t.data.okfDocName)&&n(e,t)})}const MJ=e=>({line:e.line-1,character:e.column-1});function oge(e,t){if(e&&`start`in e)return{start:MJ(e.start),end:MJ(e.end)};if(e){let n=MJ(e);return{start:n,end:{line:n.line,character:t[n.line]?.length??0}}}return{start:{line:0,character:0},end:{line:0,character:t[0]?.length??0}}}function sge(e,t){return{range:oge(e.place,t),severity:`warning`,source:`okf`,code:e.ruleId??`okf`,message:e.reason}}function cge(e,t,n){if(t.length===0)return[];let r=kO().use(pA).use(wO).use(fk,[`yaml`]);for(let e of t)r.use(e);let i=new hE({value:e});n!==void 0&&(i.data.okfDocName=n);let a=r.parse(i);r.runSync(a,i);let o=e.split(`
|
|
421
|
+
`);return i.messages.map(e=>sge(e,o))}function lge(e){let t=!1;return EE(e,[`link`,`linkReference`],()=>(t=!0,!1)),t}const uge=jJ(`index-shape`,`**/index`,(e,t)=>{let n=!1;for(let r of e.children){if(r.type===`heading`){n=!0;continue}r.type===`list`&&!n&&t.message(`This index list is not under a section heading, so an Open Knowledge Format consumer reading the file as navigation has no name to file its entries under — an index is one or more heading-led sections of bulleted links.`,r)}EE(e,`listItem`,e=>{e.children.some(e=>e.type===`list`)||lge(e)||t.message(`This index entry has no link, so an Open Knowledge Format consumer reading the file as navigation has nowhere to follow it. Every entry in the format's own reference bundles is a link followed by a short description.`,e)})}),dge=/^\s*(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])(?!\d)/;function fge(e,t,n){let r=new Date(Date.UTC(e,t-1,n));return r.getUTCFullYear()===e&&r.getUTCMonth()===t-1&&r.getUTCDate()===n}const pge=/^\s*\d{4}[-/.]\d{1,2}[-/.]\d{1,2}/;function NJ(e){let t=e.trim();return t.length>60?`${t.slice(0,59)}…`:t}const mge=jJ(`log-shape`,`**/log`,(e,t)=>{let n;EE(e,`heading`,e=>{if(e.depth!==2)return;let r=DE(e),i=dge.exec(r);if(!i){t.message(pge.test(r)?`Log date heading "${NJ(r)}" is not in ISO 8601 YYYY-MM-DD form, the one form an Open Knowledge Format log requires of its date headings.`:`Log entry heading "${NJ(r)}" is not a date, so it falls outside the dated-entry format an Open Knowledge Format consumer reads a log as — nothing under it reaches the change-history timeline.`,e);return}let a=`${i[1]}-${i[2]}-${i[3]}`;if(!fge(Number(i[1]),Number(i[2]),Number(i[3]))){t.message(`Log date heading "${a}" is not a real calendar date, so it is not ISO 8601 — the one form an Open Knowledge Format log requires of its date headings.`,e);return}n!==void 0&&a>n&&t.message(`Log date heading "${a}" is newer than the entry above it — an Open Knowledge Format log is a flat list of date-grouped entries, newest first.`,e),n=a})}),hge=/\[\[[^[\]\n]+\]\]/g;function gge(e){let t=`Wiki-link ${e} won't resolve for an external Open Knowledge Format consumer — it renders as literal text and its graph edge is lost.`;return e.includes(`|`)?`${t} The alias "|" also splits a GFM table cell.`:t}const _ge=AJ(`no-wiki-links`,(e,t)=>{let n=typeof t.value==`string`?t.value:String(t.value);EE(e,`text`,e=>{let r=e.position?.start,i=e.position?.end,a=r?.offset,o=a===void 0||i?.offset===void 0?e.value:n.slice(a,i.offset),s=0,c=r?.line??0,l=r?.column??0,u=e=>{for(;s<e;s+=1)o[s]===`
|
|
422
|
+
`?(c+=1,l=1):l+=1;return{line:c,column:l}};for(let e of o.matchAll(hge)){let{index:i}=e;if((a===void 0?o[i-1]:n[a+i-1])===`!`)continue;let s=r&&a!==void 0?{start:u(i),end:u(i+e[0].length)}:void 0;t.message(gge(e[0]),s)}})}),vge=[`index`,`log`],yge=AJ(`reserved-casing`,(e,t)=>{let n=t.data.okfDocName;if(n===void 0)return;let r=tz(n),i=r.toLowerCase();vge.includes(i)&&r!==i&&t.message(`This file is named "${r}", but the Open Knowledge Format only recognizes "${i}". On a case-sensitive filesystem a consumer reads it as an ordinary concept document rather than the reserved file it is meant to be.`)}),PJ=[{id:`no-wiki-links`,rule:_ge},{id:`log-shape`,rule:mge},{id:`index-shape`,rule:uge},{id:`reserved-casing`,rule:yge}],bge=PJ.map(e=>e.rule);function xge(e){return e===void 0?bge:PJ.filter(t=>TJ(e,t.id)).map(e=>e.rule)}const Sge=V([L(),U(die),H(F(),R())]),Cge={id:`markdownlint`,sliceSchema:B({enabled:L(),rules:H(F(),Sge)}),defaultSlice:{enabled:!1,rules:cJ},async lint(e,t){return Whe(e,lJ(t.rules))},fix(e,t){return Uhe(e,lJ(t.rules))}},wge=B({appliesTo:V([F(),z(F())]).optional(),file:F(),enabled:L().optional(),key:F().optional(),schema:H(F(),R()).optional()}),FJ=[Cge,{id:`frontmatter`,sliceSchema:B({enabled:L(),schemas:z(wge)}),defaultSlice:{enabled:!1,schemas:[]},async lint(e,t,n){return wJ(e,fJ(t.schemas,n.docName))},frontmatter:{schemasForDoc:(e,t)=>fJ(e.schemas,t),narrowSliceToFrontmatter:e=>e,advertisedMappings:e=>e.schemas}},{id:`okf`,sliceSchema:B({enabled:L(),rules:H(F(),L()).optional(),generate:B({index:L().optional()}).optional()}),defaultSlice:{enabled:!1},async lint(e,t,n){return[...cge(e,xge(t.rules),n.docName),...age(e,t.rules,n.docName)]},frontmatter:{schemasForDoc:(e,t)=>kJ(e.rules,t),narrowSliceToFrontmatter:e=>({...e,rules:{...e.rules,...rge}}),advertisedMappings:e=>ige(e.rules)}}];Object.fromEntries(FJ.map(e=>[e.id,e.defaultSlice])),B({docName:PB,summary:LB,content:F().optional(),...IB}).loose(),B({docName:PB,summary:LB,markdown:F(),position:U([`append`,`prepend`,`replace`]).optional(),extension:U(QR).optional(),...IB}).loose(),B({docName:PB,summary:LB,find:F().min(1),replace:F(),offset:I().int().nonnegative().optional(),...IB}).loose(),B({docName:PB,connectionId:F().min(1),scope:U([`last`,`session`,`file`,`count`]).optional(),count:I().int().positive().optional(),...IB}).loose().refine(e=>e.scope!==`count`||e.count!==void 0,{message:`count is required when scope is 'count'`,path:[`count`]});const IJ=B({value:F(),truncatedFrom:I().int().nonnegative().optional(),hint:F().optional()}).loose(),Tge=ui(`kind`,[B({kind:W(`inline`),content:F()}),B({kind:W(`truncated`),byteLength:I().int().nonnegative(),hint:F()})]),LJ=B({kind:W(`content-divergence`),intendedBytes:I().int().nonnegative(),actualBytes:I().int().nonnegative(),byteDelta:I().int(),divergenceType:F().optional(),currentState:Tge.optional(),hint:F().optional()}).loose(),Ege=B({type:W(`orphan`),parentCandidates:z(F()),message:F()}).loose(),RJ=B({kind:W(`disk-edit-reconciled`),intendedBytes:I().int().nonnegative(),actualBytes:I().int().nonnegative(),byteDelta:I().int(),mergeOutcome:F().optional(),hint:F().optional()}).loose();ui(`kind`,[LJ,RJ]);const Dge=Object.keys({"content-divergence":!0,"disk-edit-reconciled":!0}),Oge=B({kind:W(`mermaid-parse-error`),fenceIndex:I().int().positive(),fenceFirstLine:F(),message:F(),line:I().int().positive().optional()}).loose(),zJ=B({href:F(),targetKind:F(),role:F(),sourceForm:F(),resolvedTarget:F().nullable(),reason:F(),resolutionMethod:F(),fallbackTarget:F().nullable().optional(),definition:B({line:I().int().nonnegative(),label:F()}).loose().optional()}).loose(),BJ=ui(`kind`,[LJ,RJ,Oge,B({kind:W(`lint-violation`),source:F(),code:F(),message:F(),severity:U([`error`,`warning`,`info`,`hint`]),line:I().int().positive(),column:I().int().positive(),linkTarget:F().optional(),localTarget:zJ.optional()}).loose()]),VJ=z(BJ).min(1),HJ=B({href:F(),resolvedTo:F().nullable(),reason:U([`no-such-doc`,`no-such-file`,`unresolvable`]),localTarget:zJ.optional()}).loose(),UJ=z(HJ),WJ=B({reason:F().min(1),count:I().int().positive()}).loose();B({timestamp:F().min(1),summary:IJ.optional(),warnings:VJ.optional()}).loose(),B({timestamp:F().min(1),subscriberCount:I().int().nonnegative(),systemSubscriberCount:I().int().nonnegative(),hints:z(Ege).optional(),summary:IJ.optional(),warnings:VJ.optional(),brokenLinks:UJ,brokenLinkSuppression:WJ.optional()}).loose(),B({timestamp:F().min(1),subscriberCount:I().int().nonnegative(),systemSubscriberCount:I().int().nonnegative(),summary:IJ.optional(),warnings:VJ.optional(),brokenLinks:UJ,brokenLinkSuppression:WJ.optional()}).loose(),B({docName:F().min(1),scope:U([`last`,`session`,`count`]),undone:L()}).loose(),B({docs:z(B({docName:FB,markdown:F(),position:U([`append`,`prepend`,`replace`]).optional(),extension:U(QR).optional(),summary:LB}).loose()).min(1).max(100),...IB}).loose();const kge=B({type:ZB,title:F(),detail:F().optional()}).loose(),Age=ui(`status`,[B({status:W(`written`),docName:F().min(1),summary:IJ.optional(),warnings:VJ.optional(),brokenLinks:UJ,brokenLinkSuppression:WJ.optional()}).loose(),B({status:W(`error`),docName:F().min(1),error:kge}).loose()]);B({timestamp:F().min(1),results:z(Age),written:I().int().nonnegative(),failed:I().int().nonnegative()}).loose(),B({docName:PB,patch:H(F(),V([nd,ni()])),types:H(F(),U(ed)).optional(),summary:LB,...IB}).loose(),B({timestamp:F().min(1),subscriberCount:I().int().nonnegative(),systemSubscriberCount:I().int().nonnegative(),appliedKeys:z(F()),summary:IJ.optional(),warnings:VJ.optional(),brokenLinks:UJ,brokenLinkSuppression:WJ.optional()}).loose();const jge=Object.fromEntries(FJ.map(e=>[e.id,e.sliceSchema]));B({effective:B({enabled:L(),plugins:B(jge)}),configFile:F().nullable().optional(),configProblems:z(F()).optional()});const Mge=V([L(),H(F(),R())]),Nge=new Set([`__proto__`]),GJ=F().min(1).max(256).refine(e=>!Nge.has(e),{message:`schema property name cannot be __proto__`});B({ruleId:F().min(1).max(64).regex(/^[A-Za-z][A-Za-z0-9_-]*$/),value:V([Mge,ni()])}),B({file:F().min(1).max(512),delete:W(!0).optional(),field:GJ.optional(),parentPath:z(V([GJ,B({items:W(!0)}).strict()])).max(8).optional(),removeField:W(!0).optional(),renameTo:GJ.optional(),constraint:B({type:U([`string`,`number`,`boolean`,`array`,`object`]).nullable().optional(),enum:z(V([F(),I(),L()])).nullable().optional(),itemsEnum:z(V([F(),I(),L()])).nullable().optional(),itemsType:U([`string`,`number`,`boolean`,`object`]).nullable().optional(),pattern:F().nullable().optional(),format:F().nullable().optional(),description:F().max(2048).nullable().optional(),required:L().optional()}).optional()}).refine(e=>e.delete===void 0||e.field===void 0&&e.constraint===void 0&&e.removeField===void 0&&e.renameTo===void 0,{message:`delete cannot be combined with a field edit`}).refine(e=>[e.constraint,e.removeField,e.renameTo].filter(e=>e!==void 0).length<=1,{message:`constraint, removeField, and renameTo are mutually exclusive`}).refine(e=>e.removeField===void 0&&e.renameTo===void 0||e.field!==void 0,{message:`removeField and renameTo require field`}).refine(e=>e.parentPath===void 0||e.field!==void 0,{message:`parentPath requires field`}).refine(e=>e.field===void 0?e.constraint===void 0:e.constraint!==void 0||e.removeField!==void 0||e.renameTo!==void 0,{message:`field requires constraint, removeField, or renameTo`}),B({schemas:z(F()),truncated:L()}).strict();const KJ=B({line:I(),character:I()}),qJ=B({start:KJ,end:KJ}),JJ=B({range:qJ,severity:U([`error`,`warning`,`info`,`hint`]),source:F(),code:F(),message:F(),fixes:z(B({range:qJ,newText:F()})).optional(),frontmatterScope:U(lie).optional(),frontmatterProperty:F().optional()}),YJ=z(F()).optional();B({files:z(B({file:F(),diagnostics:z(JJ),ran:YJ,warnings:z(F()).optional()})),fileCount:I(),errorCount:I(),warningCount:I(),warnings:z(F()),ran:YJ});const Pge=JJ.extend({linkTarget:F().optional(),localTarget:zJ.optional()});B({files:z(B({file:F(),diagnostics:z(Pge)})),fileCount:I(),errorCount:I(),warningCount:I(),warnings:z(F()),ran:YJ,brokenLinkSuppression:WJ.optional()});const XJ=B({errorCount:I().int().nonnegative(),warningCount:I().int().nonnegative()});B({files:z(B({file:F(),lint:XJ,links:XJ})),fileCount:I().int().nonnegative(),errorCount:I().int().nonnegative(),warningCount:I().int().nonnegative(),warnings:z(F()),brokenLinkSuppression:WJ.optional()}),B({docName:PB,summary:LB,...IB}).loose();const Fge=B({reason:U([`re-lint-threw`,`source-went-blind`]),message:F().min(1)});B({file:F(),fixedCount:I(),diagnostics:z(JJ),errorCount:I(),warningCount:I(),ran:YJ,warnings:z(F()).optional(),diagnosticsArePreFix:L().optional(),reLintFailure:Fge.optional()});const Ige=[{id:`MD001`,alias:`heading-increment`,aliases:[`heading-increment`],name:`Heading levels should only increment by one level at a time`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md001.md`,tags:[`headings`],options:[{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`}]},{id:`MD003`,alias:`heading-style`,aliases:[`heading-style`],name:`Heading style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md003.md`,tags:[`headings`],options:[{key:`style`,type:`enum`,description:`Heading style`,enum:[`consistent`,`atx`,`atx_closed`,`setext`,`setext_with_atx`,`setext_with_atx_closed`],default:`consistent`}]},{id:`MD004`,alias:`ul-style`,aliases:[`ul-style`],name:`Unordered list style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md004.md`,tags:[`bullet`,`ul`],options:[{key:`style`,type:`enum`,description:`List style`,enum:[`consistent`,`asterisk`,`plus`,`dash`,`sublist`],default:`consistent`}]},{id:`MD005`,alias:`list-indent`,aliases:[`list-indent`],name:`Inconsistent indentation for list items at the same level`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md005.md`,tags:[`bullet`,`ul`,`indentation`],options:[]},{id:`MD007`,alias:`ul-indent`,aliases:[`ul-indent`],name:`Unordered list indentation`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md007.md`,tags:[`bullet`,`ul`,`indentation`],options:[{key:`indent`,type:`integer`,description:`Spaces for indent`,default:2,minimum:1},{key:`start_indented`,type:`boolean`,description:`Whether to indent the first level of the list`,default:!1},{key:`start_indent`,type:`integer`,description:`Spaces for first level indent (when start_indented is set)`,default:2,minimum:1}]},{id:`MD009`,alias:`no-trailing-spaces`,aliases:[`no-trailing-spaces`],name:`Trailing spaces`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md009.md`,tags:[`whitespace`],options:[{key:`br_spaces`,type:`integer`,description:`Spaces for line break`,default:2,minimum:0},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!1},{key:`list_item_empty_lines`,type:`boolean`,description:`Allow spaces for empty lines in list items`,default:!1},{key:`strict`,type:`boolean`,description:`Include unnecessary breaks`,default:!1}]},{id:`MD010`,alias:`no-hard-tabs`,aliases:[`no-hard-tabs`],name:`Hard tabs`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md010.md`,tags:[`whitespace`,`hard_tab`],options:[{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`ignore_code_languages`,type:`string-array`,description:`Fenced code languages to ignore`,default:[]},{key:`spaces_per_tab`,type:`integer`,description:`Number of spaces for each hard tab`,default:1,minimum:0}]},{id:`MD011`,alias:`no-reversed-links`,aliases:[`no-reversed-links`],name:`Reversed link syntax`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md011.md`,tags:[`links`],options:[]},{id:`MD012`,alias:`no-multiple-blanks`,aliases:[`no-multiple-blanks`],name:`Multiple consecutive blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md012.md`,tags:[`whitespace`,`blank_lines`],options:[{key:`maximum`,type:`integer`,description:`Consecutive blank lines`,default:1,minimum:1}]},{id:`MD013`,alias:`line-length`,aliases:[`line-length`],name:`Line length`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md013.md`,tags:[`line_length`],options:[{key:`line_length`,type:`integer`,description:`Number of characters`,default:80,minimum:1},{key:`heading_line_length`,type:`integer`,description:`Number of characters for headings`,default:80,minimum:1},{key:`code_block_line_length`,type:`integer`,description:`Number of characters for code blocks`,default:80,minimum:1},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`tables`,type:`boolean`,description:`Include tables`,default:!0},{key:`headings`,type:`boolean`,description:`Include headings`,default:!0},{key:`strict`,type:`boolean`,description:`Strict length checking`,default:!1},{key:`stern`,type:`boolean`,description:`Stern length checking`,default:!1}]},{id:`MD014`,alias:`commands-show-output`,aliases:[`commands-show-output`],name:`Dollar signs used before commands without showing output`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md014.md`,tags:[`code`],options:[]},{id:`MD018`,alias:`no-missing-space-atx`,aliases:[`no-missing-space-atx`],name:`No space after hash on atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md018.md`,tags:[`headings`,`atx`,`spaces`],options:[]},{id:`MD019`,alias:`no-multiple-space-atx`,aliases:[`no-multiple-space-atx`],name:`Multiple spaces after hash on atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md019.md`,tags:[`headings`,`atx`,`spaces`],options:[]},{id:`MD020`,alias:`no-missing-space-closed-atx`,aliases:[`no-missing-space-closed-atx`],name:`No space inside hashes on closed atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md020.md`,tags:[`headings`,`spaces`,`atx_closed`],options:[]},{id:`MD021`,alias:`no-multiple-space-closed-atx`,aliases:[`no-multiple-space-closed-atx`],name:`Multiple spaces inside hashes on closed atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md021.md`,tags:[`headings`,`spaces`,`atx_closed`],options:[]},{id:`MD022`,alias:`blanks-around-headings`,aliases:[`blanks-around-headings`],name:`Headings should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md022.md`,tags:[`headings`,`blank_lines`],options:[{key:`include_front_matter`,type:`boolean`,description:`Include front matter content`,default:!1},{key:`lines_above`,type:`unsupported`,description:`Blank lines above heading`,default:1},{key:`lines_below`,type:`unsupported`,description:`Blank lines below heading`,default:1}]},{id:`MD023`,alias:`heading-start-left`,aliases:[`heading-start-left`],name:`Headings must start at the beginning of the line`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md023.md`,tags:[`headings`,`spaces`],options:[]},{id:`MD024`,alias:`no-duplicate-heading`,aliases:[`no-duplicate-heading`],name:`Multiple headings with the same content`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md024.md`,tags:[`headings`],options:[{key:`siblings_only`,type:`boolean`,description:`Only check sibling headings`,default:!1}]},{id:`MD025`,alias:`single-title`,aliases:[`single-title`,`single-h1`],name:`Multiple top-level headings in the same document`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md025.md`,tags:[`headings`],options:[{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`},{key:`level`,type:`integer`,description:`Heading level`,default:1,minimum:1,maximum:6}]},{id:`MD026`,alias:`no-trailing-punctuation`,aliases:[`no-trailing-punctuation`],name:`Trailing punctuation in heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md026.md`,tags:[`headings`],options:[{key:`punctuation`,type:`string`,description:`Punctuation characters`,default:`.,;:!。,;:!`}]},{id:`MD027`,alias:`no-multiple-space-blockquote`,aliases:[`no-multiple-space-blockquote`],name:`Multiple spaces after blockquote symbol`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md027.md`,tags:[`indentation`,`whitespace`,`blockquote`],options:[{key:`list_items`,type:`boolean`,description:`Include list items`,default:!0}]},{id:`MD028`,alias:`no-blanks-blockquote`,aliases:[`no-blanks-blockquote`],name:`Blank line inside blockquote`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md028.md`,tags:[`whitespace`,`blockquote`],options:[]},{id:`MD029`,alias:`ol-prefix`,aliases:[`ol-prefix`],name:`Ordered list item prefix`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md029.md`,tags:[`ol`],options:[{key:`style`,type:`enum`,description:`List style`,enum:[`one`,`ordered`,`one_or_ordered`,`zero`],default:`one_or_ordered`}]},{id:`MD030`,alias:`list-marker-space`,aliases:[`list-marker-space`],name:`Spaces after list markers`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md030.md`,tags:[`ul`,`whitespace`,`ol`],options:[{key:`ul_single`,type:`integer`,description:`Spaces for single-line unordered list items`,default:1,minimum:1},{key:`ol_single`,type:`integer`,description:`Spaces for single-line ordered list items`,default:1,minimum:1},{key:`ul_multi`,type:`integer`,description:`Spaces for multi-line unordered list items`,default:1,minimum:1},{key:`ol_multi`,type:`integer`,description:`Spaces for multi-line ordered list items`,default:1,minimum:1}]},{id:`MD031`,alias:`blanks-around-fences`,aliases:[`blanks-around-fences`],name:`Fenced code blocks should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md031.md`,tags:[`blank_lines`,`code`],options:[{key:`list_items`,type:`boolean`,description:`Include list items`,default:!0}]},{id:`MD032`,alias:`blanks-around-lists`,aliases:[`blanks-around-lists`],name:`Lists should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md032.md`,tags:[`bullet`,`ul`,`blank_lines`,`ol`],options:[]},{id:`MD033`,alias:`no-inline-html`,aliases:[`no-inline-html`],name:`Inline HTML`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md033.md`,tags:[`html`],options:[{key:`allowed_elements`,type:`string-array`,description:`Allowed elements`,default:[]},{key:`table_allowed_elements`,type:`string-array`,description:`Allowed elements in tables`,default:[]}]},{id:`MD034`,alias:`no-bare-urls`,aliases:[`no-bare-urls`],name:`Bare URL used`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md034.md`,tags:[`links`,`url`],options:[]},{id:`MD035`,alias:`hr-style`,aliases:[`hr-style`],name:`Horizontal rule style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md035.md`,tags:[`hr`],options:[{key:`style`,type:`string`,description:`Horizontal rule style`,default:`consistent`}]},{id:`MD036`,alias:`no-emphasis-as-heading`,aliases:[`no-emphasis-as-heading`],name:`Emphasis used instead of a heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md036.md`,tags:[`headings`,`emphasis`],options:[{key:`punctuation`,type:`string`,description:`Punctuation characters`,default:`.,;:!?。,;:!?`}]},{id:`MD037`,alias:`no-space-in-emphasis`,aliases:[`no-space-in-emphasis`],name:`Spaces inside emphasis markers`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md037.md`,tags:[`whitespace`,`emphasis`],options:[]},{id:`MD038`,alias:`no-space-in-code`,aliases:[`no-space-in-code`],name:`Spaces inside code span elements`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md038.md`,tags:[`whitespace`,`code`],options:[]},{id:`MD039`,alias:`no-space-in-links`,aliases:[`no-space-in-links`],name:`Spaces inside link text`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md039.md`,tags:[`whitespace`,`links`],options:[]},{id:`MD040`,alias:`fenced-code-language`,aliases:[`fenced-code-language`],name:`Fenced code blocks should have a language specified`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md040.md`,tags:[`code`,`language`],options:[{key:`allowed_languages`,type:`string-array`,description:`List of languages`,default:[]},{key:`language_only`,type:`boolean`,description:`Require language only`,default:!1}]},{id:`MD041`,alias:`first-line-heading`,aliases:[`first-line-heading`,`first-line-h1`],name:`First line in a file should be a top-level heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md041.md`,tags:[`headings`],options:[{key:`allow_preamble`,type:`boolean`,description:`Allow content before first heading`,default:!1},{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`},{key:`level`,type:`integer`,description:`Heading level`,default:1,minimum:1,maximum:6}]},{id:`MD042`,alias:`no-empty-links`,aliases:[`no-empty-links`],name:`No empty links`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md042.md`,tags:[`links`],options:[]},{id:`MD043`,alias:`required-headings`,aliases:[`required-headings`],name:`Required heading structure`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md043.md`,tags:[`headings`],options:[{key:`headings`,type:`string-array`,description:`List of headings`,default:[]},{key:`match_case`,type:`boolean`,description:`Match case of headings`,default:!1}]},{id:`MD044`,alias:`proper-names`,aliases:[`proper-names`],name:`Proper names should have the correct capitalization`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md044.md`,tags:[`spelling`],options:[{key:`names`,type:`string-array`,description:`List of proper names`,default:[]},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`html_elements`,type:`boolean`,description:`Include HTML elements`,default:!0}]},{id:`MD045`,alias:`no-alt-text`,aliases:[`no-alt-text`],name:`Images should have alternate text (alt text)`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md045.md`,tags:[`accessibility`,`images`],options:[]},{id:`MD046`,alias:`code-block-style`,aliases:[`code-block-style`],name:`Code block style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md046.md`,tags:[`code`],options:[{key:`style`,type:`enum`,description:`Block style`,enum:[`consistent`,`fenced`,`indented`],default:`consistent`}]},{id:`MD047`,alias:`single-trailing-newline`,aliases:[`single-trailing-newline`],name:`Files should end with a single newline character`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md047.md`,tags:[`blank_lines`],options:[]},{id:`MD048`,alias:`code-fence-style`,aliases:[`code-fence-style`],name:`Code fence style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md048.md`,tags:[`code`],options:[{key:`style`,type:`enum`,description:`Code fence style`,enum:[`consistent`,`backtick`,`tilde`],default:`consistent`}]},{id:`MD049`,alias:`emphasis-style`,aliases:[`emphasis-style`],name:`Emphasis style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md049.md`,tags:[`emphasis`],options:[{key:`style`,type:`enum`,description:`Emphasis style`,enum:[`consistent`,`asterisk`,`underscore`],default:`consistent`}]},{id:`MD050`,alias:`strong-style`,aliases:[`strong-style`],name:`Strong style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md050.md`,tags:[`emphasis`],options:[{key:`style`,type:`enum`,description:`Strong style`,enum:[`consistent`,`asterisk`,`underscore`],default:`consistent`}]},{id:`MD051`,alias:`link-fragments`,aliases:[`link-fragments`],name:`Link fragments should be valid`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md051.md`,tags:[`links`],options:[{key:`ignore_case`,type:`boolean`,description:`Ignore case of fragments`,default:!1},{key:`ignored_pattern`,type:`string`,description:`Pattern for ignoring additional fragments`,default:``}]},{id:`MD052`,alias:`reference-links-images`,aliases:[`reference-links-images`],name:`Reference links and images should use a label that is defined`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md052.md`,tags:[`links`,`images`],options:[{key:`ignored_labels`,type:`string-array`,description:`Ignored link labels`,default:[`x`]},{key:`shortcut_syntax`,type:`boolean`,description:`Include shortcut syntax`,default:!1}]},{id:`MD053`,alias:`link-image-reference-definitions`,aliases:[`link-image-reference-definitions`],name:`Link and image reference definitions should be needed`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md053.md`,tags:[`links`,`images`],options:[{key:`ignored_definitions`,type:`string-array`,description:`Ignored definitions`,default:[`//`]}]},{id:`MD054`,alias:`link-image-style`,aliases:[`link-image-style`],name:`Link and image style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md054.md`,tags:[`links`,`images`],options:[{key:`autolink`,type:`boolean`,description:`Allow autolinks`,default:!0},{key:`inline`,type:`boolean`,description:`Allow inline links and images`,default:!0},{key:`full`,type:`boolean`,description:`Allow full reference links and images`,default:!0},{key:`collapsed`,type:`boolean`,description:`Allow collapsed reference links and images`,default:!0},{key:`shortcut`,type:`boolean`,description:`Allow shortcut reference links and images`,default:!0},{key:`url_inline`,type:`boolean`,description:`Allow URLs as inline links`,default:!0}]},{id:`MD055`,alias:`table-pipe-style`,aliases:[`table-pipe-style`],name:`Table pipe style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md055.md`,tags:[`table`],options:[{key:`style`,type:`enum`,description:`Table pipe style`,enum:[`consistent`,`leading_only`,`trailing_only`,`leading_and_trailing`,`no_leading_or_trailing`],default:`consistent`}]},{id:`MD056`,alias:`table-column-count`,aliases:[`table-column-count`],name:`Table column count`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md056.md`,tags:[`table`],options:[]},{id:`MD058`,alias:`blanks-around-tables`,aliases:[`blanks-around-tables`],name:`Tables should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md058.md`,tags:[`table`],options:[]},{id:`MD059`,alias:`descriptive-link-text`,aliases:[`descriptive-link-text`],name:`Link text should be descriptive`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md059.md`,tags:[`links`,`accessibility`],options:[{key:`prohibited_texts`,type:`string-array`,description:`Prohibited link texts`,default:[`click here`,`here`,`link`,`more`]}]},{id:`MD060`,alias:`table-column-style`,aliases:[`table-column-style`],name:`Table column style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md060.md`,tags:[`table`],options:[{key:`style`,type:`enum`,description:`Table column style`,enum:[`any`,`aligned`,`compact`,`tight`],default:`any`},{key:`aligned_delimiter`,type:`boolean`,description:`Aligned delimiter columns`,default:!1}]}];(()=>{let e=new Map;for(let t of Ige){e.set(t.id.toUpperCase(),t.id);for(let n of t.aliases)e.set(n.toUpperCase(),t.id)}return e})();const Lge=new Set([`img`,`video`,`audio`,`mark`,`u`,`ins`]);new Map(oH.flatMap(e=>e.surface===`compat`&&Lge.has(e.rendersAs)?[[e.name,e]]:[])),Rpe(`<>`),kO().use(pA).use(wO);const ZJ=[{tagName:`Mirror`,attrName:`src`,resolution:`bare-doc-name`},{tagName:`Excalidraw`,attrName:`src`,resolution:`doc-relative`}];for(let e of ZJ){let t=oH.find(t=>t.name===e.tagName);if(!t)throw Error(`JSX_SRC_REF_TAGS: no built-in component descriptor named '${e.tagName}' — the rename-rewrite and backlink passes for this entry would silently never match. Fix the tagName to match a descriptor in builtInComponents.`);if(!t.props.some(t=>t.name===e.attrName))throw Error(`JSX_SRC_REF_TAGS: component '${e.tagName}' declares no prop named '${e.attrName}' — the rename-rewrite and backlink passes for this entry would silently never match. Fix the attrName to match one of the descriptor's props.`)}Fj(),$A(),ej();function Rge(){return oH.filter(e=>e.surface===`canonical`&&e.name!==`*`)}function zge(){return Rge().filter(e=>{let t=Bge(e);return t!==`fence`&&t!==`html`})}function Bge(e){return e.name===`MermaidFence`?`fence`:e.name===`HtmlAlignBlock`?`html`:e.hasChildren?`jsx-block`:`jsx-void`}B({intents:z(B({satisfierId:F().min(1),desired:U([`present`,`absent`])}).loose()),...IB,summary:LB}).loose();const Vge=B({satisfierId:F(),agentId:F(),piece:F(),scope:F(),kind:F(),pathId:F().optional(),desired:U([`present`,`absent`]),action:U(bu),errorId:F().optional()}).loose(),Hge=B({kind:F(),satisfierIds:z(F()),agentIds:z(F()),pathId:F().optional(),blockedReason:F().optional()}).loose(),Uge=B({state:F(),strictness:z(U(vu)).optional()}).loose(),Wge=B({probes:B({env:U([`desktop`,`local-web`,`remote-web`]),satisfiers:H(F(),Uge)}).loose(),detection:B({detected:z(F()),probed:L()}).loose()}).loose();B({actions:z(Vge),conflicts:z(Hge),withheld:z(F()),snapshot:Wge}).loose(),B({entries:z(B({level:U([`info`,`warn`,`error`]),message:F().max(8192),event:F().optional(),fields:H(F(),R()).optional(),ts:I().optional(),sourceId:F().optional(),lineNumber:I().optional()}).loose()).max(100),droppedSinceLastFlush:I().int().min(0).optional()}).loose(),B({accepted:I().int().min(0)}).loose();const Gge=B({exact:F().min(1),prefix:F(),suffix:F(),start:I().int().nonnegative(),end:I().int().nonnegative()}),Kge=z(V([F(),I().int().nonnegative()])),qge=ui(`kind`,[B({kind:W(`body`)}),B({kind:W(`property`),key:F().min(1),path:Kge.default([])})]).default({kind:`body`}),Jge=U([`anchored`,`orphaned`,`resolved`]),QJ=B({threadId:F().min(1),docName:F().min(1),target:qge,anchor:Gge.nullable(),state:Jge,queued:L(),latestComment:F(),createdBy:F().min(1),createdAt:I(),updatedAt:I().optional()}),$J=B({docName:F(),instruction:F(),property:F().nullable(),passage:B({exact:F(),prefix:F(),suffix:F()}).nullable(),anchorLost:L(),passageRepeats:L()}).loose(),eY=B({threadId:F(),ok:W(!0)}),tY=B({threadId:F(),ok:W(!1),error:W(`not-found`)});B({threads:z(QJ)}).loose(),B({meta:QJ,orphaned:L()}).loose(),B({threadId:F()}).loose(),B({meta:QJ,payload:$J}).loose(),B({results:z(V([eY.extend({meta:QJ,payload:$J}),tY]))}).loose(),B({results:z(V([eY.extend({meta:QJ}),tY]))}).loose();const Yge=B({status:F().min(1),reason:F()}).loose();B({docName:F().min(1),content:F(),lifecycle:Yge.nullable()}).loose(),B({documents:z(B({kind:U([`document`,`asset`,`folder`,`file`]).default(`document`),docName:F().min(1).optional(),docExt:F().min(1).default(`.md`),size:I().int().nonnegative(),modified:F().min(1),isSymlink:L().default(!1),canonicalDocName:F().nullable().default(null),targetPath:F().nullable().default(null),path:F().min(1).optional(),assetExt:F().min(1).optional(),mediaKind:U([`image`,`video`,`audio`,`pdf`,`text`,`mermaid`,`excalidraw`]).nullable().optional(),referencedBy:z(F().min(1)).optional(),hasChildren:L().optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.kind===`file`?e.path!==void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder/file kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName; file → path, no mediaKind/referencedBy/hasChildren)`})),truncated:L().optional()}).loose();const Xge=B({source:F().min(1),anchor:F().nullable(),title:F(),snippet:F().nullable()}).loose();B({docName:F().min(1),backlinks:z(Xge)}).loose(),B({counts:H(F().min(1),I().int().nonnegative())}).loose(),B({counts:H(F().min(1),I().int().nonnegative())}).loose();const Zge=ui(`kind`,[B({kind:W(`doc`),docName:F().min(1),anchor:F().nullable(),title:F(),snippet:F().nullable()}).loose(),B({kind:W(`external`),url:F().min(1),title:F(),snippet:F().nullable()}).loose()]),Qge=B({role:F().min(1),sourceForm:F().min(1),targetKind:F().min(1),href:F(),resolvedTarget:F().nullable(),status:F().min(1),reason:F().nullable(),resolutionMethod:F().min(1),fallbackTarget:F().nullable().default(null),range:B({start:I().int().nonnegative(),end:I().int().nonnegative()}),line:I().int().nonnegative(),column:I().int().nonnegative(),definition:B({label:F(),line:I().int().nonnegative()}).nullable().default(null)}).loose();B({docName:F().min(1),forwardLinks:z(Zge),localTargets:z(Qge).optional()}).loose();const $ge=ui(`kind`,[B({id:F().min(1),kind:W(`doc`),docName:F().min(1),anchor:F().nullable(),label:F(),cluster:F().nullable(),category:F().nullable(),tags:z(F()).nullable(),managed:L().optional()}).loose(),B({id:F().min(1),kind:W(`external`),url:F().min(1),label:F()}).loose()]),e_e=B({source:F().min(1),target:F().min(1)}).loose();B({nodes:z($ge),links:z(e_e)}).loose();const t_e=B({ts:I().int().min(0),url:F(),method:F(),ua:F().optional(),origin:F().optional(),referer:F().optional(),host:F().optional(),remote:F().optional(),secChUa:F().optional(),secChUaMobile:F().optional(),secChUaPlatform:F().optional(),secFetchSite:F().optional(),secFetchDest:F().optional(),secFetchMode:F().optional(),secFetchUser:F().optional()}).loose(),n_e=B({app:V([W(`cursor`),W(`codex`),W(`claude`),ni()]),signals_fired:z(F())}).loose();B({entries:z(t_e),count:I().int().min(0),detection:n_e}).loose();const nY=B({path:F().min(1),code:U([`M`,`A`,`D`,`R`,`C`,`U`,`T`,`?`,`!`,` `]),origPath:F().min(1).optional(),syncScoped:L(),open:ui(`kind`,[B({kind:W(`doc`),docName:F().min(1)}),B({kind:W(`asset`),path:F().min(1)})]).optional()}).loose();B({branch:F().nullable(),detached:L(),upstream:F().nullable(),staged:z(nY),notStaged:z(nY),untracked:z(nY),incoming:z(nY),truncated:L(),readable:L().default(!0)}).loose();const r_e=U([`AWAITING_CHECKS`,`LOCKED`,`MERGEABLE`,`QUEUED`,`UNMERGEABLE`]),i_e=U([`BEHIND`,`BLOCKED`,`CLEAN`,`DIRTY`,`DRAFT`,`HAS_HOOKS`,`UNKNOWN`,`UNSTABLE`]),a_e=U([`APPROVED`,`CHANGES_REQUESTED`,`REVIEW_REQUIRED`]),o_e=U([`ERROR`,`EXPECTED`,`FAILURE`,`PENDING`,`SUCCESS`]),s_e=B({mergeQueue:B({position:I().int().nonnegative(),state:r_e.nullable().catch(null)}).nullable().catch(null),autoMerge:L(),mergeState:i_e.nullable().catch(null),reviewDecision:a_e.nullable().catch(null),checks:o_e.nullable().catch(null)}).loose(),c_e=B({kind:U([`pull`,`issue`]),repo:F().min(1),number:I().int().positive(),title:F(),author:F().nullable(),createdAt:F(),lifecycle:U([`open`,`draft`,`merged`,`closed`,`completed`,`not-planned`]),additions:I().int().nonnegative().optional(),deletions:I().int().nonnegative().optional(),status:s_e.optional()}).loose();B({url:F()}).loose(),ui(`ok`,[B({ok:W(!0),preview:c_e}).loose(),B({ok:W(!1),reason:F()}).loose()]),B({writers:z(B({id:F().min(1),name:F().optional(),email:F().optional()}).loose()).optional(),summary:LB,...IB}).loose(),B({checkpointRef:F().min(1)}).loose();const l_e=B({v:I().int().optional(),id:F().min(1),name:F().min(1),colorSeed:F().optional(),docs:z(F()),summaries:z(F()).optional()}).loose();B({entries:z(B({sha:F().min(1),timestamp:F().min(1),author:F(),authorEmail:F(),type:U([`checkpoint`,`wip`,`upstream`,`park`]),message:F(),contributors:z(l_e),checkpoint:R().nullable(),parentSha:F().nullable().optional()}).loose()),total:I().int().nonnegative().optional(),truncated:L().optional(),hasMore:L().optional()}).loose(),B({sha:F().regex(/^[0-9a-f]{40}$/i),content:F(),timestamp:F(),author:F()}).loose(),B({contentDir:F().min(1),pathSeparator:U([`/`,`\\`]),symlinkResolved:L()}).loose(),z(ui(`source`,[B({docName:F().min(1),timestamp:F().min(1),size:I().int().nonnegative(),source:W(`flat`)}).loose(),B({docName:F().min(1),timestamp:F().min(1),source:W(`timeline`),sha:F().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."});const u_e=B({domain:F().min(1),title:F().optional(),description:F().optional(),siteName:F().optional(),faviconDataUri:F().optional()}).loose();B({url:F()}).loose(),ui(`ok`,[B({ok:W(!0),metadata:u_e}).loose(),B({ok:W(!1),reason:F()}).loose()]),B({orphans:z(B({docName:F().min(1),title:F()}).loose())}).loose(),B({hubs:z(B({docName:F().min(1),title:F(),count:I().int().nonnegative()}).loose())}).loose();const d_e=B({source:F().min(1),title:F(),snippet:F().nullable()}).loose();B({deadLinks:z(B({target:F().min(1),sources:z(d_e)}).loose())}).loose(),B({target:B({docName:F().min(1),title:F(),aliases:z(F())}).loose(),mentions:z(B({source:F().min(1),excerpt:F(),offset:I().int().nonnegative()}).loose()),truncated:L()}).loose(),B({projectPath:F().min(1)}).loose();const f_e=U([`not-a-git-worktree`,`init-failed`]);ui(`ok`,[B({ok:W(!0),projectPath:F().min(1)}).loose(),B({ok:W(!1),reason:f_e,message:F().min(1)}).loose()]),B({host:F().min(1).optional()}).loose(),B({host:F().min(1).optional(),token:F().min(1)}).loose(),B({host:F(),login:F()}).loose(),B({key:F().min(1)}).loose(),B({keyPresent:L()}).loose();const p_e=U([`no_key`,`invalid_endpoint`,`rate_limit`,`timeout`,`http_error`,`network`,`dims_mismatch`,`malformed_response`]);ui(`ok`,[B({ok:W(!0),endpoint:F().min(1),model:F().min(1),dimensions:I().int().positive()}).loose(),B({ok:W(!1),endpoint:F().min(1),model:F().min(1),reason:p_e,status:I().int().optional()}).loose()]),B({name:F().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:F().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),B({authenticated:L()}).loose(),B({channel:U([`login`,`gh-login`]).default(`login`)}).loose(),B({}).loose();const m_e=B({stackIndex:I().int().min(0),ts:I().int().min(0),additions:I().int().min(0),deletions:I().int().min(0)}).loose(),h_e=B({docName:F().min(1),additionsTotal:I().int().min(0),deletionsTotal:I().int().min(0),lastTs:I().int().min(0),bursts:z(m_e)}).loose(),g_e=B({displayName:F().min(1),color:F().min(1),icon:F().optional(),connectionId:F().min(1)}).loose();B({sessionAlive:L(),agent:g_e.nullable(),files:z(h_e)}).loose(),B({diff:F(),before:F(),after:F(),properties:OB,generatedAt:I().int().min(0)}).loose(),B({}).loose(),B({}).loose(),B({}).loose(),B({}).loose(),B({}).loose(),B({}).loose();const __e=B({displayName:F().min(1),icon:F(),color:F().min(1),currentDoc:F().nullable(),mode:U([`idle`,`writing`]),ts:I().int().min(0)}).loose();B({presence:H(F().min(1),__e)}).loose();const v_e=B({sessionId:F().min(1),agentType:F().min(1),ts:I().int().min(0),insertedChars:I().int().min(0),deletedChars:I().int().min(0)}).loose();B({effects:z(B({"doc.name":F().min(1),entries:z(v_e)}).loose())}).loose(),B({decisions:z(B({ts:I().int().min(0),decision:F().min(1),kind:F().min(1),"doc.name":F().min(1),pathRole:F().min(1)}).loose())}).loose(),H(F().min(1),L()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`}),B({path:F().min(1,`path must be non-empty`)}).loose(),B({}).loose();const y_e=B({fromDocName:F().min(1),toDocName:F().min(1)}).loose(),b_e=B({fromPath:F().min(1),toPath:F().min(1)}).loose();B({}).loose(),B({path:F().min(1),...IB,summary:LB}).loose(),B({docName:F().min(1)}).loose(),B({path:F().min(1),...IB,summary:LB}).loose(),B({path:F().min(1)}).loose(),B({kind:U([`file`,`folder`]),path:F().min(1),...IB,summary:LB}).loose(),B({kind:U([`file`,`folder`]),path:F().min(1),duplicatedDocNames:z(F().min(1))}).loose(),B({pages:z(B({docName:F().min(1),title:F(),docExt:F().min(1),size:I().int().nonnegative(),modified:F().min(1),icon:F().min(1).max(2048).optional()}).loose())}).loose();const x_e=B({level:I().int().min(1).max(6),text:F(),slug:F()}).loose();B({docName:F().min(1),headings:z(x_e)}).loose();const S_e=B({docName:F().min(1),rewrites:I().int().nonnegative()}).loose();B({kind:U([`file`,`folder`,`asset`]),fromPath:F().min(1),toPath:F().min(1),...IB,summary:LB}).loose(),B({renamed:z(y_e),renamedAssets:z(b_e),rewrittenDocs:z(S_e).optional(),summary:IJ.optional()}).loose(),B({kind:U([`file`,`folder`,`asset`]),path:F().min(1),...IB}).loose(),B({deletedDocNames:z(F().min(1))}).loose(),B({kind:U([`file`,`folder`,`asset`]),path:F().min(1),...IB,summary:LB}).loose(),B({deletedDocNames:z(F().min(1))}).loose(),B({docName:F().min(1),commitSha:F().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:LB,...IB}).loose(),B({restoredFrom:F().min(1),timestamp:F().min(1),summary:IJ.optional(),warnings:VJ.optional()}).loose();const C_e=/^#[0-9a-fA-F]{6}$/,w_e=B(Object.fromEntries(Ns.map(e=>[e,F().regex(C_e,`must be a #rrggbb hex color`)]))),rY=F().min(1).refine(Rs,{message:`must contain a non-whitespace character`}),iY=B({name:rY,author:rY.optional(),variant:U([`dark`,`light`]),palette:w_e}).loose();B({name:F().min(1),scheme:iY,stem:F().min(1).optional(),extension:U([`.yaml`,`.yml`]).optional()}).loose(),B({id:F().min(1),filename:F().min(1)}).loose(),B({id:F().min(1),scheme:iY}).loose(),B({id:F().min(1),filename:F().min(1)}).loose(),ui(`existed`,[B({existed:W(!1)}).loose(),B({existed:W(!0),filename:F().min(1),scheme:iY}).loose()]),B({themes:z(ui(`ok`,[B({ok:W(!0),id:F().min(1),filename:F().min(1),scheme:iY}),B({ok:W(!1),filename:F().min(1),id:F().min(1).optional(),code:F().min(1),conflictingFilenames:z(F().min(1)).min(2).optional()})])),truncated:L()}).loose();const T_e=U([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),E_e=B({label:F().min(1),webUrl:Gr().nullable()}).loose(),D_e=ui(`checkStatus`,[B({checkStatus:W(`allowed`)}).loose(),B({checkStatus:W(`denied`),deniedReason:U([`no-collaborator`,`private-no-access`,`repo-not-found`,`not-authenticated`]),resolvedLogin:F().optional(),declaredLogin:F().optional(),declaredSource:F().optional()}).loose(),B({checkStatus:W(`unknown`),unknownError:U([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`,`ssh-unverified`]).optional()}).loose()]),aY=U([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`auth-not-found-as-identity`,`semantic-protected-branch`]),O_e=U(Bre),k_e=U([`succeeded`,`up-to-date`,`conflict`,`refused`,`error`]);B({state:T_e,lastSyncUtc:F().nullable(),lastRunUtc:F().nullable().optional(),lastPullOkUtc:F().nullable().optional(),lastPushOkUtc:F().nullable().optional(),lastFetchUtc:F().nullable(),lastPushedSha:F().nullable(),ahead:I().int().min(0),behind:I().int().min(0),consecutiveFailures:I().int().min(0),consecutivePushFailures:I().int().min(0).optional(),conflictCount:I().int().min(0),hasRemote:L(),syncEnabled:L(),identityUnresolved:L(),remote:E_e.nullable().optional(),pushError:F().optional(),pushErrorCode:aY.optional(),pullError:F().optional(),pullErrorCode:aY.optional(),pausedReason:F().optional(),blockingPaths:z(F().min(1)).optional(),pushPermission:D_e.optional(),syncMode:O_e.optional(),lastPullUtc:F().nullable().optional(),lastPullOutcome:k_e.nullable().optional()}).loose(),B({action:U([`commit`]),paths:z(F().min(1)),commitSha:F().optional()}).loose(),B({action:U([`commit`])}).loose(),B({op:U([`sync`,`push`,`pull`,`fetch`]).optional()}).loose(),B({op:U([`sync`,`push`,`pull`,`fetch`])}).loose();const oY=U([`merge-native`,`working-tree`,`reconcile`]),sY=U([`merged-with-markers`,`refused-conflict-markers`,`refused-no-base`,`refused-too-large`,`disk-markers`,`stale-external-write`]),A_e=U([`mine`,`theirs`,`content`,`delete`]);B({conflicts:z(B({file:F().min(1),detectedAt:F().min(1),conflict:oY,reason:sY.optional().catch(void 0),conflictKind:U([`git`,`stale-external-write`]).optional(),docName:F().nullable(),theirsSha:F().optional(),baseSha:F().optional()}).loose())}).loose(),B({file:F().min(1),strategy:U([`mine`,`theirs`,`content`,`delete`]),content:F().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0,{message:`content must be provided when strategy is 'content' (an empty string keeps an empty file)`,path:[`content`]}),B({}).loose(),B({file:F().min(1),base:F(),ours:F(),theirs:F(),kind:U([`both-modified`,`delete-modify`,`modify-delete`]),conflict:oY,reason:sY.optional().catch(void 0),conflictKind:U([`git`,`stale-external-write`]).optional(),resolutionOptions:z(A_e)}).loose(),B({plan:Pi(e=>e!==void 0,{message:`plan is required`})}).loose(),B({plan:Pi(e=>e!==void 0,{message:`plan is required`})}).loose(),B({result:Pi(e=>e!==void 0,{message:`result is required`})}).loose(),B({packId:F().min(1)}).strict(),B({installedHosts:z(F()),skills:z(B({name:F().min(1),created:L()}).strict())}).strict();const j_e=B({path:F().min(1),summary:F().min(1)}).loose(),M_e=B({files:I().int().nonnegative(),folders:I().int().nonnegative()}).loose();B({packs:z(B({id:F().min(1),name:F().min(1),description:F().min(1),defaultSubfolder:F().optional(),folders:z(j_e),entryCounts:M_e}).loose())}).loose(),B({noOpen:L().optional(),out:F().min(1).optional()}).loose();const N_e=B({reason:U([`unsupported-platform`,`spawn-error`]),message:F()}).loose();ui(`status`,[B({status:W(`installed`),outputPath:F(),size:I().int().nonnegative(),sha256:F(),skillVersion:F()}).loose(),B({status:W(`built`),outputPath:F(),size:I().int().nonnegative(),sha256:F(),skillVersion:F(),handoffError:N_e.optional()}).loose(),B({status:W(`failed`),buildError:F()}).loose(),B({status:W(`skip-current`),skillVersion:F(),recordedAt:F().optional()}).loose()]);const cY=U(du),P_e=U(pie),F_e=B({alwaysOn:I().int().nonnegative(),onTrigger:I().int().nonnegative(),onDemand:I().int().nonnegative()}).strict();B({tags:z(B({name:F().min(1),count:I().int().nonnegative(),isLeaf:L()}).loose())}).loose();const I_e=B({docName:F().min(1),title:F(),matchingTags:z(F().min(1)),snippet:F().nullable()}).loose();B({name:F().min(1),docs:z(I_e)}).loose(),B({folder:R(),frontmatter_local:H(F(),R()).nullable(),warnings:z(F()).optional().meta({description:"Non-fatal degradations of this response, one per entry; the field each affects is absent, null, or incomplete — the aligned `warningCodes` entry names which field and how."}),warningCodes:z(U([`symlink-refused`,`malformed-yaml`,`unverifiable`,`templates-symlink-refused`,`templates-unverifiable`])).optional().meta({description:"Machine-readable codes aligned 1:1 with `warnings`; switch on these, never on the English. `symlink-refused` / `malformed-yaml` / `unverifiable`: this folder's own `.ok/frontmatter.yml` (a symlink, malformed YAML, or an lstat failure) — `frontmatter_local` is null. `templates-symlink-refused` / `templates-unverifiable`: the `.ok/templates` directory on this folder, or a `.ok` or `.ok/templates` directory on an ancestor it inherits from — a symlink (wherever it points, dangling included), or a non-ENOTDIR `lstat` failure — `folder.templates_available` omits that directory's templates and may still list others. A non-directory `.ok` / `.ok/templates` (ENOTDIR) is treated as empty and yields no `templates-*` code. This folder's own symlinked `.ok` is a 400, never a warning."})}).loose(),B({path:F(),frontmatter:H(F(),R()).optional()}).loose(),B({applied:R()}).loose();const lY=H(F(),R()).meta({description:`Free-form frontmatter map embedded in template payloads.`});B({template:B({name:F().min(1),folder:F(),scope:U([`local`,`inherited`]),path:F().min(1),frontmatter:lY,body:F()}).strict()}).strict(),B({templates:z(B({name:F().min(1),title:F().optional(),description:F().optional(),path:F().min(1),source_folder:F()}).strict()),truncated:L()}).strict(),B({folder:F(),name:F(),body:F().optional(),frontmatter:lY.optional(),...IB,summary:LB}).strict(),B({path:F().min(1),created:L(),warnings:z(F())}).strict(),B({sourcePath:F().min(1),targetFolder:F(),name:F().optional(),title:F().optional(),deleteSource:L().optional(),...IB,summary:LB}).strict(),B({path:F().min(1),created:L(),warnings:z(F())}).strict(),B({existed:L(),path:F().min(1)}).strict(),B({fromFolder:F(),fromName:F(),toFolder:F(),toName:F(),body:F().optional(),frontmatter:lY.optional(),...IB,summary:LB}).strict(),B({from:F().min(1),to:F().min(1),committed:L()}).strict();const uY=U(ad),L_e=/^[a-z0-9-]+$/,dY=B({name:F(),description:F(),metadata:B({pack:F()}).strict().optional()}).strict();B({skill:B({name:F().min(1),scope:uY,path:F().min(1),frontmatter:dY,body:F(),files:z(B({path:F().min(1),text:F().nullable()})).optional(),managed:L().optional()}).strict()}).strict();const R_e=B({source:F().min(1),publisher:F().optional(),skill:F().optional(),marketplaceUrl:F().optional(),importedAt:F().min(1),autoUpdate:L().optional()}).strict(),z_e=B({name:F().min(1),description:F().optional(),scope:uY,path:F().min(1),canonicalPath:F().min(1).optional(),filePaths:z(F()).optional(),absolutePath:F().min(1).optional(),installed:L(),hosts:z(F()),hostQualifier:F().optional().meta({description:"Set on a GLOBAL entry that shares its name with a distinct-content bundle in another host dir AND is not the by-name default: the host id whose root holds THIS bundle. Doc-name builders append it (`__skill__/global/<name>@<host>`) so each same-named bundle keeps its own tab and its own write-back path; the default bundle keeps the stable unqualified name."}),driftPaths:z(F()).optional().meta({description:`Recorded locations whose on-disk form (copy vs symlink) no longer matches what OK last wrote there — evidence another tool rewrote the path.`}),hostAliases:H(F(),F()).optional().meta({description:`Host skills roots that are symlink ALIASES of another location (host id → base-relative target root). An aliased folder is a derived view — no menu row, never a write target; the host's icon rides the target root's row.`}),conflictHosts:z(F()).optional().meta({description:`Hosts whose dir holds a DIFFERENT same-name skill (fork/conflict) — occupied, not this skill.`}),symlinkedHosts:z(F()).optional(),installableEditors:z(F()).optional(),hubOffered:L().optional().meta({description:"Whether the vendor-neutral `.agents/skills` hub is a live destination at this scope on THIS machine — server-computed via the same predicate that filters the Folders surface, so the install menu and Settings cannot disagree. True when the project already uses the hub OR a host that reads it is installed (`HUB_READER_EDITORS`)."}),linkMode:L().optional(),customPlacements:z(B({path:F(),mode:U([`copy`,`link`])}).strict()).optional(),plugin:B({name:F().min(1),marketplace:F().min(1),provider:F().min(1),url:F().optional()}).strict().optional(),managed:L().optional(),origin:R_e.optional(),pack:F().optional(),modified:L().optional(),revertable:L().optional(),ignored:L().optional(),size:F_e.optional()}).strict();B({name:F().min(1),scope:uY,apply:L().optional()}).strict(),B({line:F().min(1),gitignorePath:F().min(1),applied:L(),alreadyTracked:L().optional()}).strict(),B({skills:z(z_e),truncated:L()}).strict(),B({scope:uY.default(`project`),name:F().meta({description:`Managed skill name to create or update.`}),body:F().optional(),frontmatter:dY,...IB,summary:LB}).strict();const fY=[`skill-name-vendor-word`,`skill-body-too-long`],pY=z(U(fY)).meta({description:"Machine-readable codes aligned 1:1 with `warnings` (`warnings[i]` is the display text for `warningCodes[i]`)."});B({path:F().min(1),created:L(),warnings:z(F()),warningCodes:pY}).strict(),B({scope:uY.default(`project`),name:F(),dryRun:L().optional(),setAutoUpdate:L().optional(),...IB,summary:LB}).strict(),B({name:F().min(1),updated:L(),source:F().min(1),localBody:F().optional(),upstreamBody:F().optional(),gitTracked:L().optional(),warnings:z(F()),warningCodes:pY}).strict(),B({scope:uY.default(`project`),name:F(),...IB,summary:LB}).strict(),B({name:F().min(1),baselineRef:F().min(1),restoredFiles:z(F()),warnings:z(F())}).strict();const mY=`This member also carries the one bookkeeping failure that does not undo the operation: the content change landed, but a state file this server keeps beside it refused to be rewritten because it could not be read, so the install or import records still describe the old state until an operator repairs that file. Absent when there is nothing to report; a server that predates this member omits it, so treat its absence as no warning rather than as an error.`;B({existed:L(),path:F().min(1),warnings:z(F()).optional().meta({description:`Present when this delete removed a directory a retention record ties to a recovery copy an earlier failed move kept, whose source was never verified unchanged — either because this server verified the deleted directory against the copy that record describes, or because it could not read the directory and so could not confirm either way. Each entry says which of the two it is; neither claims more than the check established. ${mY}`})}).strict(),B({scope:uY.default(`project`),fromName:F(),toName:F(),body:F().optional(),frontmatter:dY.optional(),...IB,summary:LB}).strict(),B({from:F().min(1),to:F().min(1),committed:L(),warnings:z(F()).optional().meta({description:`Present when the rename itself completed but something beside it did not. ${mY}`})}).strict(),B({name:F(),toName:F().optional().meta({description:"Name for the skill at the destination scope; defaults to `name`. The SKILL.md `name` frontmatter is rewritten to match."}),fromScope:uY,toScope:uY,...IB,summary:LB}).strict(),B({scope:uY,path:F().optional(),droppedLocations:z(F()).default([]).meta({description:"Locations the skill occupied at the source that were removed and not re-created at the destination: the `agents` hub and custom roots, which projection does not cover. Entries are install location ids, so they can be passed straight back as an install `add` list with `scope` set to the destination scope; custom roots resolve against that scope's base."}),warnings:z(F()).optional().meta({description:`Present when the move itself completed but something beside it did not. ${mY}`})}).strict().meta({description:"Scope-move result. Rename paths deliberately do not emit authoring warnings, consistent with same-scope rename and duplicate. Content-authoring and import responses carry those warnings and their codes. The Skills Studio client parses `droppedLocations` off the wire but deliberately does not render it yet; how a human is told what was removed is an open product decision."}),B({scope:uY,name:F(),toName:F(),...IB,summary:LB}).strict(),B({name:F().min(1)}).strict(),B({name:F(),home:F().min(1)}).strict(),B({docName:F().min(1)}).strict();const hY=U([`reference`,`script`,`file`]);B({scope:uY.default(`project`),name:F(),path:F().min(1),content:F(),...IB,summary:LB}).strict(),B({path:F().min(1),created:L(),kind:hY,content:L()}).strict(),B({scope:uY.default(`project`),name:F(),from:F().min(1),to:F().min(1),...IB,summary:LB}).strict(),B({from:F().min(1),to:F().min(1),fromDocName:F().optional(),toDocName:F().optional()}).strict(),B({path:F().min(1),kind:hY,text:F()}).strict(),B({path:F().min(1),existed:L(),kind:hY}).strict();const gY=V([P_e,W(`agents`)]),_Y=F().min(1).refine(e=>!e.startsWith(`/`)&&!e.startsWith(`~`)&&!/^[A-Za-z]:/.test(e),{error:`a custom root is base-relative (e.g. ".tim/skills"), not absolute or ~-prefixed`}).refine(e=>e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`),{error:`a custom root may not contain "..", "." or empty path segments`}).refine(e=>e.includes(`/`),{error:`a custom root is a path (e.g. ".tim/skills") — bare editor names are host ids`}),vY=V([gY,_Y]);B({scope:uY.default(`project`),name:F(),targets:z(gY).optional().meta({description:'SET-EXACT install targets (editor ids, plus "agents" for the .agents hub — in-place skills only): the COMPLETE resulting host set. Omit to use project-configured editors; pass [] to uninstall everywhere. Stateless callers should prefer `add`/`remove`.'}),add:z(vY).optional().meta({description:`Locations to ADD the skill to (everything else untouched). Editor ids fan out a managed copy/symlink; a custom root path (".tim/skills") places the bundle there.`}),remove:z(vY).optional().meta({description:"Locations to REMOVE the skill from (lossless only — a hand-edited fork is refused, never deleted). The source cannot be removed; move it first with `source`."}),mode:U([`copy`,`link`]).optional().meta({description:`"link": one real folder (the source); every other location becomes a symlink to it. "copy": independent real folders, refreshed from the source until hand-edited (a hand-edit forks that copy). Converts existing locations losslessly. Omit to follow the form the skill already uses.`}),source:vY.optional().meta({description:`Move the skill's REAL folder to this location (the old source becomes a symlink to it — never a removal). Sticky across rescans.`}),linkMode:L().optional(),setSource:F().min(1).optional(),place:B({dir:F().min(1).meta({description:`Project-relative directory the bundle dir is created under (e.g. ".windsurf/skills").`}),mode:U([`copy`,`link`])}).strict().optional(),convert:B({target:vY.meta({description:`The installed location to convert — an editor id, "agents", or a recorded custom placement path.`}),mode:U([`copy`,`link`]).meta({description:`"link": replace this location with a symlink to the source. "copy": replace it with an independent real folder.`})}).strict().optional(),unplace:B({path:F().min(1).meta({description:`The recorded placement bundle path (e.g. ".windsurf/skills/my-skill").`})}).strict().optional(),...IB,summary:LB,fork:B({editor:F().min(1),action:U([`align`,`make-source`,`rename`]),toName:F().optional()}).strict().optional()}).strict().refine(e=>e.targets===void 0||e.add===void 0&&e.remove===void 0,{error:"`targets` is set-exact; `add`/`remove` are additive — use one style per call"}).refine(e=>e.fork===void 0||e.targets===void 0&&e.add===void 0&&e.remove===void 0&&e.source===void 0&&e.setSource===void 0,{error:"`fork` is its own operation — run it in a separate call"}).refine(e=>e.fork?.action!==`rename`||e.fork.toName!==void 0,{error:"`fork.rename` requires `toName`"}).refine(e=>e.source===void 0||e.add===void 0&&e.remove===void 0,{error:"a `source` move is its own operation — run it in a separate call from `add`/`remove`"}).refine(e=>[e.targets!==void 0||e.add!==void 0||e.remove!==void 0,e.place!==void 0,e.unplace!==void 0,e.convert!==void 0,e.source!==void 0||e.setSource!==void 0,e.fork!==void 0].filter(Boolean).length<=1,{error:"one operation per call — membership (`targets`/`add`/`remove`), `place`, `unplace`, `convert`, `source`, and `fork` are mutually exclusive"});const yY=[`no-targets`,`scripts-present`,`name-conflict`,`no-description`,`skill-fork-name-unpatched`,`place-path-invalid`,`place-fork-refused`];B({name:F().min(1).meta({description:`Managed skill name installed or uninstalled.`}),hosts:z(F()).meta({description:`Editor ids the skill is projected into after the operation; [] is expected after uninstall.`}),scripts:L().meta({description:`True when the skill ships executable scripts, projected but never run.`}),warnings:z(F()).meta({description:`Non-fatal install/uninstall warnings from target projection.`}),warningCodes:z(U(yY)).meta({description:"Machine-readable warning codes aligned with `warnings`."}),placedAt:F().optional(),sourceMovedTo:F().optional()}).strict(),B({scope:uY.default(`project`),name:F().meta({description:`Managed skill name to uninstall without deleting source.`})}).strict(),B({name:F().min(1).meta({description:`Managed skill name requested for uninstall.`}),uninstalled:L().meta({description:`True when an install marker existed and was removed; false for an idempotent no-op.`})}).strict(),B({targets:z(cY),configured:L(),folders:z(B({scope:uY,host:F(),root:F(),state:U([`own`,`linked`,`linked-parent`,`absent`]),target:F().optional(),drift:W(!0).optional(),expected:F().optional()}).strict()).optional()}).strict();const bY=B({action:W(`link`),scope:uY,root:F().min(1).meta({description:`The folder to link (e.g. ".codex/skills").`}),target:F().min(1).meta({description:`The root it merges into (e.g. ".agents/skills"). Required.`})}),xY=B({action:W(`unlink`),scope:uY,root:F().min(1).meta({description:`The linked folder to materialize back.`}),exclude:z(F().min(1)).optional().meta({description:`Skill names to LEAVE OUT when materializing — the folder keeps every other skill it currently sees (as per-skill links) and stops auto-following the target root.`})}).strict(),SY=B({action:W(`add-root`),scope:uY,root:_Y.meta({description:`New custom skills root to declare (base-relative, e.g. ".team/skills").`})}).strict(),B_e=ui(`action`,[bY.extend({preview:L().optional().meta({description:`Return the merge plan only (moves, drops, removes, conflicts, strays) — nothing is written.`})}).strict(),xY,SY]);ui(`action`,[bY.strict(),xY,SY]),B({folderAction:B_e}).strict();const V_e=B({moves:z(F()),drops:z(F()),removes:z(F()),replaces:z(F()),conflicts:z(F()),strays:z(F())}).strict();B({targets:z(cY),reprojected:z(B({name:F(),hosts:z(F())}).strict()),bundleHosts:z(F()),removedFrom:z(F()),folder:B({moved:z(F()),dropped:z(F()),linked:z(F())}).strict().optional(),preview:V_e.optional()}).strict(),B({scope:uY.default(`project`),name:F(),version:F().regex(/^[0-9a-f]{40}$/i),...IB,summary:LB}).strict(),B({name:F().min(1),version:F(),restoredFiles:z(F()),warnings:z(F())}).strict(),B({query:F().optional(),intent:U([`autocomplete`,`full_text`,`omnibar`]).optional(),ranking:U([`navigation`,`relevance`]).optional(),scopes:z(U([`page`,`folder`,`content`,`file`])).optional(),scope:F().optional(),limit:I().int().nonnegative().optional(),semantic:L().optional(),source:U([`omnibar`,`mcp`,`http`]).optional()}).loose();const H_e=B({kind:U([`page`,`folder`,`content`,`file`]),path:F().min(1),title:F(),score:I(),signals:H(F(),R()),snippet:F().optional()}).loose(),U_e=U([`applied`,`no_match`,`warming`,`incapable`,`provider_error`,`restart_required`,`query_too_short`]),CY=U([`warm`,`corpus`,`query`,`dimensions`,`configured_dimensions`]),wY=B({capable:L(),applied:L(),outcome:U_e,providerErrorReason:CY.nullable().optional().catch(null),coverage:B({embedded:I().int().nonnegative(),total:I().int().nonnegative()})}).loose();B({enabled:L(),keyPresent:L(),keyNotRequired:L(),keySource:U([`project`,`file`,`env`]).nullable(),keyHint:F().nullable(),ready:L(),capable:L(),providerError:L().optional(),providerErrorReason:CY.nullable().optional().catch(null),embedded:I().int().nonnegative(),total:I().int().nonnegative()}).loose(),B({query:F(),intent:U([`autocomplete`,`full_text`,`omnibar`]),results:z(H_e),elapsedMs:I().nonnegative(),semantic:wY.optional(),truncated:L().optional(),ready:L().optional()}).loose();const W_e=B({version:F().min(1),recordedAt:F().min(1)}).loose();B({currentVersion:F().min(1),targets:H(F(),W_e.nullable())}).loose(),B({scope:uY.default(`project`),source:F().min(1).meta({description:`External skill source: full skills.sh skill-page URL (https://www.skills.sh/<owner>/<repo>/<skill>, or https://www.skills.sh/site/<hostname>/<skill> for a website catalog), GitHub owner/repo[/subpath], git URL, or local/file path.`}),skill:F().min(1).optional().meta({description:`Specific skill name to import from a multi-skill source.`}),install:L().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection (the caller installs explicitly afterwards). Default true.`}),marketplace:L().optional().meta({description:"The source came from a skills.sh listing the user chose (the Explore tab), so the install is reported to skills.sh and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...IB,summary:LB}).strict(),B({scope:uY.default(`project`),source:F().min(1).meta({description:`External skill source: full skills.sh skill-page URL, GitHub owner/repo[/subpath], git URL, or local/file path.`}),skills:z(F().min(1)).min(1).max(100).meta({description:`Skill names to import from the source.`}),install:L().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection. Default true.`}),marketplace:L().optional().meta({description:"The source came from a skills.sh listing the user chose (a marketplace plugin bundle), so the import is reported to skills.sh as one batched install event and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...IB,summary:LB}).strict(),B({results:z(B({requested:F(),status:U([`imported`,`already-imported`,`not-found`,`failed`]),name:F().optional(),collisionRenamedFrom:F().optional(),warnings:z(F()),warningCodes:pY,error:F().optional()}).loose()),imported:I(),alreadyImported:I(),failed:I()}).loose(),B({scope:uY.default(`project`),names:z(F().min(1)).min(1).max(100).meta({description:`Managed skill names to refresh from their recorded upstreams.`}),...IB,summary:LB}).strict(),B({results:z(B({requested:F(),status:U([`updated`,`up-to-date`,`not-found`,`failed`]),source:F().optional(),warnings:z(F()),warningCodes:pY,error:F().optional()}).loose()),updated:I(),upToDate:I(),failed:I()}).loose();const G_e=B({source:F(),ref:F().optional(),contentHash:F(),publisher:F().optional()}).loose();B({name:F().min(1).meta({description:`Managed skill name created or matched.`}),path:F().min(1).meta({description:`Store-relative path to the imported skill source.`}),created:L().meta({description:`True when this request created new source files.`}),alreadyImported:L().meta({description:`True when identical content was already present and no files changed.`}),collisionRenamedFrom:F().optional().meta({description:`Original source name when collision handling renamed the import.`}),provenance:G_e,warnings:z(F()).meta({description:`Non-fatal import warnings, such as skipped unsupported files.`}),warningCodes:pY}).loose();const K_e=U([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`,`comments`,`lint-config`,`local-targets`]);B({v:W(1),ch:W(`server-info`),seq:I(),serverInstanceId:F().min(1),currentBranch:F().min(1).optional()}).loose(),B({v:W(1),ch:W(`branch-switched`),seq:I(),branch:F().min(1)}).loose(),B({v:W(1),ch:K_e,seq:I()}).loose(),B({v:W(1),ch:W(`disk-ack`),seq:I(),docName:F().min(1),sv:F().min(1)}).loose(),B({v:W(1),ch:W(`config-validation-rejected`),seq:I(),docName:F().min(1),error:Yc}).loose(),B({v:W(1),ch:W(`config-ignore-nested-error`),seq:I(),path:F().min(1),error:F().min(1)}).loose(),(()=>{let e=globalThis.Intl.Segmenter;return e?new e(`en`,{granularity:`word`}):null})();const TY=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),EY=globalThis;EY[TY]===void 0&&(EY[TY]=mr());const DY=EY[TY],OY=si({version:F().regex(/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(DY,{description:`Recorded skill version for this target.`}),recordedAt:Fr().register(DY,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:U([`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`]).register(DY,{description:`Install-source surface that recorded this entry.`}).optional()}),q_e=si({enabled:L().register(DY,{description:`Whether this user-global skill bundle is opted in.`}),decidedAt:Fr().register(DY,{description:`ISO 8601 timestamp of the opt-in / opt-out decision.`})});si({schema:W(1).register(DY,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:si({"claude-cowork":OY.optional(),"cli-hosts":OY.optional()}).register(DY,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({}),bundles:H(F(),q_e).register(DY,{description:`Per-bundle opt-in decisions keyed by install name. Absent key = no recorded decision.`}).optional(),installsReported:z(F()).register(DY,{description:"Skill installs already reported to skills.sh from this machine, as `<owner/repo>#<skill>`. Append-only; presence suppresses a re-report."}).optional()});const J_e=[`auth-error`,`detached-head`,`dirty-tree`,`diverged-local-commits`,`external-changes-pending`,`git-index-locked`,`git-operation-in-progress`,`no-commits-yet`,`no-push-permission`,`non-content-merge-failure`,`protected-branch`],kY=e=>e*8+4;kY(92),kY(40),Array.from({length:256},(e,t)=>(t+256).toString(16).slice(1));const AY={fileSystem:`File System`,gitUpstream:`Git (upstream)`,service:`OpenKnowledge (service)`,generator:`OpenKnowledge (generated)`};
|
|
421
423
|
/*!
|
|
422
424
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
423
425
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -445,7 +447,7 @@ ${t.slice(l+2)}`,d+=1;else break}t.push({indent:l,number:parseInt(s,10),content:
|
|
|
445
447
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
446
448
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
447
449
|
*/
|
|
448
|
-
let
|
|
450
|
+
let Y_e=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;var X_e=class e extends Date{#e=!1;#t=!1;#n=null;constructor(e){let t=!0,n=!0,r=`Z`;if(typeof e==`string`){let i=e.match(Y_e);i?(i[1]||(t=!1,e=`0000-01-01T${e}`),n=!!i[2],n&&e[10]===` `&&(e=e.replace(` `,`T`)),i[2]&&+i[2]>23?e=``:(r=i[3]||null,e=e.toUpperCase(),!r&&n&&(e+=`Z`))):e=``}super(e),isNaN(this.getTime())||(this.#e=t,this.#t=n,this.#n=r)}isDateTime(){return this.#e&&this.#t}isLocal(){return!this.#e||!this.#t||!this.#n}isDate(){return this.#e&&!this.#t}isTime(){return this.#t&&!this.#e}isValid(){return this.#e||this.#t}toISOString(){let e=super.toISOString();if(this.isDate())return e.slice(0,10);if(this.isTime())return e.slice(11,23);if(this.#n===null)return e.slice(0,-1);if(this.#n===`Z`)return e;let t=this.#n.slice(1,3)*60+ +this.#n.slice(4,6);return t=this.#n[0]===`-`?t:-t,new Date(this.getTime()-t*6e4).toISOString().slice(0,-1)+this.#n}static wrapAsOffsetDateTime(t,n=`Z`){let r=new e(t);return r.#n=n,r}static wrapAsLocalDateTime(t){let n=new e(t);return n.#n=null,n}static wrapAsLocalDate(t){let n=new e(t);return n.#t=!1,n.#n=null,n}static wrapAsLocalTime(t){let n=new e(t);return n.#e=!1,n.#n=null,n}};
|
|
449
451
|
/*!
|
|
450
452
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
451
453
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -473,9 +475,9 @@ let J_e=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+
|
|
|
473
475
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
474
476
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
475
477
|
*/
|
|
476
|
-
function
|
|
478
|
+
function Z_e(e,t){let n=e.slice(0,t).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}function Q_e(e,t,n){let r=e.split(/\r\n|\n|\r/g),i=``,a=(Math.log10(t+1)|0)+1;for(let e=t-1;e<=t+1;e++){let o=r[e-1];o&&(i+=e.toString().padEnd(a,` `),i+=`: `,i+=o,i+=`
|
|
477
479
|
`,e===t&&(i+=` `.repeat(a+n+2),i+=`^
|
|
478
|
-
`))}return i}var jY=class extends Error{line;column;codeblock;constructor(e,t){let[n,r]=
|
|
480
|
+
`))}return i}var jY=class extends Error{line;column;codeblock;constructor(e,t){let[n,r]=Z_e(t.toml,t.ptr),i=Q_e(t.toml,n,r);super(`Invalid TOML document: ${e}\n\n${i}`,t),this.line=n,this.column=r,this.codeblock=i}};
|
|
479
481
|
/*!
|
|
480
482
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
481
483
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -503,12 +505,12 @@ function X_e(e,t){let n=e.slice(0,t).split(/\r\n|\n|\r/g);return[n.length,n.pop(
|
|
|
503
505
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
504
506
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
505
507
|
*/
|
|
506
|
-
let
|
|
508
|
+
let $_e=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,eve=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,tve=/^[+-]?0[0-9_]/;function MY(e,t){let n=e[t++],r=n,i=n===`'`,a=n===e[t]&&n===e[t+1];a&&(e[t+=2]===`
|
|
507
509
|
`?t++:e[t]===`\r`&&e[t+1]===`
|
|
508
510
|
`&&(t+=2));let o=``,s=t,c=0;for(let l=t;l<e.length;l++)if(n=e[l],a&&(n===`
|
|
509
511
|
`||n===`\r`&&e[l+1]===`
|
|
510
512
|
`))c&&=3;else if(n<` `&&n!==` `||n===``)throw new jY(`control characters are not allowed in strings`,{toml:e,ptr:l});else if((!c||c===3)&&n===r&&(!a||e[l+1]===r&&e[l+2]===r))return a&&(e[l+3]===r&&l++,e[l+3]===r&&l++),[c?o:o+e.slice(s,l),l+(a?3:1)];else if(!c)!i&&n===`\\`&&(o+=e.slice(s,s=l),c=1);else if(c===1){if(n===`x`||n===`u`||n===`U`){let t=0,r=n===`x`?2:n===`u`?4:8;for(let n=0;n<r;n++,l++){let n=e.charCodeAt(l+1),r=n>=48&&n<=57?n-48:n>=65&&n<=70?n-65+10:n>=97&&n<=102?n-97+10:-1;if(r<0)throw new jY(`invalid non-hex character in unicode escape`,{toml:e,ptr:l+1});t=t<<4|r}if(t<0||t>1114111||t>=55296&&t<=57343)throw new jY(`invalid unicode escape`,{toml:e,ptr:l});o+=String.fromCodePoint(t),s=l+1,c=0}else if(n===` `||n===` `)c=2;else{if(n===`b`)o+=`\b`;else if(n===`t`)o+=` `;else if(n===`n`)o+=`
|
|
511
|
-
`;else if(n===`f`)o+=`\f`;else if(n===`r`)o+=`\r`;else if(n===`e`)o+=`\x1B`;else if(n===`"`)o+=`"`;else if(n===`\\`)o+=`\\`;else throw new jY(`unrecognized escape sequence`,{toml:e,ptr:l});s=l+1,c=0}}else if(n!==` `&&n!==` `){if(c===2)throw new jY(`invalid escape: only line-ending whitespace may be escaped`,{toml:e,ptr:s});c=+(!i&&n===`\\`),s=l}throw new jY(`unfinished string`,{toml:e,ptr:t})}function
|
|
513
|
+
`;else if(n===`f`)o+=`\f`;else if(n===`r`)o+=`\r`;else if(n===`e`)o+=`\x1B`;else if(n===`"`)o+=`"`;else if(n===`\\`)o+=`\\`;else throw new jY(`unrecognized escape sequence`,{toml:e,ptr:l});s=l+1,c=0}}else if(n!==` `&&n!==` `){if(c===2)throw new jY(`invalid escape: only line-ending whitespace may be escaped`,{toml:e,ptr:s});c=+(!i&&n===`\\`),s=l}throw new jY(`unfinished string`,{toml:e,ptr:t})}function nve(e,t,n,r){if(e===`true`)return!0;if(e===`false`)return!1;if(e===`-inf`)return-1/0;if(e===`inf`||e===`+inf`)return 1/0;if(e===`nan`||e===`+nan`||e===`-nan`)return NaN;if(e===`-0`)return r?0n:0;let i=$_e.test(e);if(i||eve.test(e)){if(tve.test(e))throw new jY(`leading zeroes are not allowed`,{toml:t,ptr:n});e=e.replace(/_/g,``);let a=+e;if(isNaN(a))throw new jY(`invalid number`,{toml:t,ptr:n});if(i){if((i=!Number.isSafeInteger(a))&&!r)throw new jY(`integer value cannot be represented losslessly`,{toml:t,ptr:n});(i||r===!0)&&(a=BigInt(e))}return a}let a=new X_e(e);if(!a.isValid())throw new jY(`invalid value`,{toml:t,ptr:n});return a}
|
|
512
514
|
/*!
|
|
513
515
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
514
516
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -541,7 +543,7 @@ function NY(e,t=0,n=e.length){let r=e.indexOf(`
|
|
|
541
543
|
`)return n;if(r===`\r`&&e[n+1]===`
|
|
542
544
|
`)return n+1;if(r<` `&&r!==` `||r===``)throw new jY(`control characters are not allowed in comments`,{toml:e,ptr:t})}return e.length}function FY(e,t,n,r){let i;for(;;){for(;(i=e[t])===` `||i===` `||!n&&(i===`
|
|
543
545
|
`||i===`\r`&&e[t+1]===`
|
|
544
|
-
`);)t++;if(r||i!==`#`)break;t=PY(e,t)}return t}function
|
|
546
|
+
`);)t++;if(r||i!==`#`)break;t=PY(e,t)}return t}function rve(e,t,n,r,i=!1){if(!r)return t=NY(e,t),t<0?e.length:t;for(let a=t;a<e.length;a++){let t=e[a];if(t===`#`)a=NY(e,a);else if(t===n)return a+1;else if(t===r||i&&(t===`
|
|
545
547
|
`||t===`\r`&&e[a+1]===`
|
|
546
548
|
`))return a}throw new jY(`cannot find end of structure`,{toml:e,ptr:t})}
|
|
547
549
|
/*!
|
|
@@ -571,8 +573,8 @@ function NY(e,t=0,n=e.length){let r=e.indexOf(`
|
|
|
571
573
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
572
574
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
573
575
|
*/
|
|
574
|
-
function
|
|
575
|
-
`&&e[i]!==`\r`)throw new jY(`unexpected character encountered`,{toml:e,ptr:i});e[i]===`,`&&i++}return[r,i]}let o=
|
|
576
|
+
function ive(e,t,n){let r=e.slice(t,n),i=r.indexOf(`#`);return i>-1&&(PY(e,i),r=r.slice(0,i)),[r.trimEnd(),i]}function IY(e,t,n,r,i){if(r===0)throw new jY(`document contains excessively nested structures. aborting.`,{toml:e,ptr:t});let a=e[t];if(a===`[`||a===`{`){let[o,s]=a===`[`?sve(e,t,r,i):ove(e,t,r,i);if(n){if(s=FY(e,s),e[s]===`,`)s++;else if(e[s]!==n)throw new jY(`expected comma or end of structure`,{toml:e,ptr:s})}return[o,s]}if(a===`"`||a===`'`){let[r,i]=MY(e,t);if(n){if(i=FY(e,i),e[i]&&e[i]!==`,`&&e[i]!==n&&e[i]!==`
|
|
577
|
+
`&&e[i]!==`\r`)throw new jY(`unexpected character encountered`,{toml:e,ptr:i});e[i]===`,`&&i++}return[r,i]}let o=rve(e,t,`,`,n),s=ive(e,t,o-+(e[o-1]===`,`));if(!s[0])throw new jY(`incomplete key-value declaration: no value specified`,{toml:e,ptr:t});return n&&s[1]>-1&&(o=FY(e,t+s[1]),e[o]===`,`&&o++),[nve(s[0],e,t,i),o]}
|
|
576
578
|
/*!
|
|
577
579
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
578
580
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -600,8 +602,8 @@ function rve(e,t,n){let r=e.slice(t,n),i=r.indexOf(`#`);return i>-1&&(PY(e,i),r=
|
|
|
600
602
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
601
603
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
602
604
|
*/
|
|
603
|
-
let
|
|
604
|
-
`&&o!==`\r`){let o,s=i,c=!1,[l,u]=LY(e,t-1);for(let n=0;n<l.length;n++){if(n&&(s=c?s[o]:s[o]={}),o=l[n],(c=Object.hasOwn(s,o))&&(typeof s[o]!=`object`||a.has(s[o])))throw new jY(`trying to redefine an already defined value`,{toml:e,ptr:t});!c&&o===`__proto__`&&Object.defineProperty(s,o,{enumerable:!0,configurable:!0,writable:!0})}if(c)throw new jY(`trying to redefine an already defined value`,{toml:e,ptr:t});let[d,f]=IY(e,u,`}`,n-1,r);a.add(d),s[o]=d,t=f}if(!o)throw new jY(`unfinished table encountered`,{toml:e,ptr:t});return[i,t]}function
|
|
605
|
+
let ave=/^[a-zA-Z0-9-_]+[ \t]*$/;function LY(e,t,n=`=`){let r=t-1,i=[],a=e.indexOf(n,t);if(a<0)throw new jY(`incomplete key-value: cannot find end of key`,{toml:e,ptr:t});do{let o=e[t=++r];if(o!==` `&&o!==` `){if(o===`"`||o===`'`){if(o===e[t+1]&&o===e[t+2])throw new jY(`multiline strings are not allowed in keys`,{toml:e,ptr:t});let[s,c]=MY(e,t);r=e.indexOf(`.`,c);let l=e.slice(c,r<0||r>a?a:r),u=NY(l);if(u>-1)throw new jY(`newlines are not allowed in keys`,{toml:e,ptr:t+r+u});if(l.trimStart())throw new jY(`found extra tokens after the string part`,{toml:e,ptr:c});if(a<c&&(a=e.indexOf(n,c),a<0))throw new jY(`incomplete key-value: cannot find end of key`,{toml:e,ptr:t});i.push(s)}else{r=e.indexOf(`.`,t);let n=e.slice(t,r<0||r>a?a:r);if(!ave.test(n))throw new jY(`only letter, numbers, dashes and underscores are allowed in keys`,{toml:e,ptr:t});i.push(n.trimEnd())}}}while(r+1&&r<a);return[i,FY(e,a+1,!0,!0)]}function ove(e,t,n,r){let i={},a=new Set,o;for(t++;(o=e[t++])!==`}`&&o;)if(o===`,`)throw new jY(`expected value, found comma`,{toml:e,ptr:t-1});else if(o===`#`)t=PY(e,t);else if(o!==` `&&o!==` `&&o!==`
|
|
606
|
+
`&&o!==`\r`){let o,s=i,c=!1,[l,u]=LY(e,t-1);for(let n=0;n<l.length;n++){if(n&&(s=c?s[o]:s[o]={}),o=l[n],(c=Object.hasOwn(s,o))&&(typeof s[o]!=`object`||a.has(s[o])))throw new jY(`trying to redefine an already defined value`,{toml:e,ptr:t});!c&&o===`__proto__`&&Object.defineProperty(s,o,{enumerable:!0,configurable:!0,writable:!0})}if(c)throw new jY(`trying to redefine an already defined value`,{toml:e,ptr:t});let[d,f]=IY(e,u,`}`,n-1,r);a.add(d),s[o]=d,t=f}if(!o)throw new jY(`unfinished table encountered`,{toml:e,ptr:t});return[i,t]}function sve(e,t,n,r){let i=[],a;for(t++;(a=e[t++])!==`]`&&a;)if(a===`,`)throw new jY(`expected value, found comma`,{toml:e,ptr:t-1});else if(a===`#`)t=PY(e,t);else if(a!==` `&&a!==` `&&a!==`
|
|
605
607
|
`&&a!==`\r`){let a=IY(e,t-1,`]`,n-1,r);i.push(a[0]),t=a[1]}if(!a)throw new jY(`unfinished array encountered`,{toml:e,ptr:t});return[i,t]}
|
|
606
608
|
/*!
|
|
607
609
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
@@ -630,7 +632,7 @@ let ive=/^[a-zA-Z0-9-_]+[ \t]*$/;function LY(e,t,n=`=`){let r=t-1,i=[],a=e.index
|
|
|
630
632
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
631
633
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
632
634
|
*/
|
|
633
|
-
function RY(e,t,n,r){let i=t,a=n,o,s=!1,c;for(let t=0;t<e.length;t++){if(t){if(i=s?i[o]:i[o]={},a=(c=a[o]).c,r===0&&(c.t===1||c.t===2))return null;if(c.t===2){let e=i.length-1;i=i[e],a=a[e].c}}if(o=e[t],(s=Object.hasOwn(i,o))&&a[o]?.t===0&&a[o]?.d)return null;s||(o===`__proto__`&&(Object.defineProperty(i,o,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(a,o,{enumerable:!0,configurable:!0,writable:!0})),a[o]={t:t<e.length-1&&r===2?3:r,d:!1,i:0,c:{}})}if(c=a[o],c.t!==r&&(r!==1||c.t!==3)||(r===2&&(c.d||(c.d=!0,i[o]=[]),i[o].push(i={}),c.c[c.i++]=c={t:1,d:!1,i:0,c:{}}),c.d))return null;if(c.d=!0,r===1)i=s?i[o]:i[o]={};else if(r===0&&s)return null;return[o,i,c.c]}function
|
|
635
|
+
function RY(e,t,n,r){let i=t,a=n,o,s=!1,c;for(let t=0;t<e.length;t++){if(t){if(i=s?i[o]:i[o]={},a=(c=a[o]).c,r===0&&(c.t===1||c.t===2))return null;if(c.t===2){let e=i.length-1;i=i[e],a=a[e].c}}if(o=e[t],(s=Object.hasOwn(i,o))&&a[o]?.t===0&&a[o]?.d)return null;s||(o===`__proto__`&&(Object.defineProperty(i,o,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(a,o,{enumerable:!0,configurable:!0,writable:!0})),a[o]={t:t<e.length-1&&r===2?3:r,d:!1,i:0,c:{}})}if(c=a[o],c.t!==r&&(r!==1||c.t!==3)||(r===2&&(c.d||(c.d=!0,i[o]=[]),i[o].push(i={}),c.c[c.i++]=c={t:1,d:!1,i:0,c:{}}),c.d))return null;if(c.d=!0,r===1)i=s?i[o]:i[o]={};else if(r===0&&s)return null;return[o,i,c.c]}function cve(e,{maxDepth:t=1e3,integersAsBigInt:n}={}){let r={},i={},a=r,o=i;for(let s=FY(e,0);s<e.length;){if(e[s]===`[`){let t=e[++s]===`[`,n=LY(e,s+=+t,`]`);if(t){if(e[n[1]-1]!==`]`)throw new jY(`expected end of table declaration`,{toml:e,ptr:n[1]-1});n[1]++}let c=RY(n[0],r,i,t?2:1);if(!c)throw new jY(`trying to redefine an already defined table or value`,{toml:e,ptr:s});o=c[2],a=c[1],s=n[1]}else{let r=LY(e,s),i=RY(r[0],a,o,0);if(!i)throw new jY(`trying to redefine an already defined table or value`,{toml:e,ptr:s});let c=IY(e,r[1],void 0,t,n);i[1][i[0]]=c[0],s=c[1]}if(s=FY(e,s,!0),e[s]&&e[s]!==`
|
|
634
636
|
`&&e[s]!==`\r`)throw new jY(`each key-value declaration must be followed by an end-of-line`,{toml:e,ptr:s});s=FY(e,s)}return r}
|
|
635
637
|
/*!
|
|
636
638
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
@@ -659,13 +661,13 @@ function RY(e,t,n,r){let i=t,a=n,o,s=!1,c;for(let t=0;t<e.length;t++){if(t){if(i
|
|
|
659
661
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
660
662
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
661
663
|
*/
|
|
662
|
-
let zY=/^[a-z0-9-_]+$/i;function BY(e){let t=typeof e;if(t===`object`){if(Array.isArray(e))return`array`;if(e instanceof Date)return`date`}return t}function
|
|
663
|
-
`}[[${t}]]\n`,i+=UY(0,e[a],t,n,r);return i}function UY(e,t,n,r,i){if(r===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);let a=``,o=``,s=Object.keys(t);for(let e=0;e<s.length;e++){let c=s[e];if(t[c]!==null&&t[c]!==void 0){let e=BY(t[c]);if(e===`symbol`||e===`function`)throw TypeError(`cannot serialize values of type '${e}'`);let s=zY.test(c)?c:VY(c);if(e===`array`&&
|
|
664
|
-
`)+
|
|
664
|
+
let zY=/^[a-z0-9-_]+$/i;function BY(e){let t=typeof e;if(t===`object`){if(Array.isArray(e))return`array`;if(e instanceof Date)return`date`}return t}function lve(e){for(let t=0;t<e.length;t++)if(BY(e[t])!==`object`)return!1;return e.length!=0}function VY(e){return JSON.stringify(e).replace(/\x7f/g,`\\u007f`)}function HY(e,t,n,r){if(n===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);if(t===`number`)return isNaN(e)?`nan`:e===1/0?`inf`:e===-1/0?`-inf`:Number.isInteger(e)&&(r||!Number.isSafeInteger(e))?e.toFixed(1):e.toString();if(t===`bigint`||t===`boolean`)return e.toString();if(t===`string`)return VY(e);if(t===`date`){if(isNaN(e.getTime()))throw TypeError(`cannot serialize invalid date`);return e.toISOString()}if(t===`object`)return uve(e,n,r);if(t===`array`)return dve(e,n,r)}function uve(e,t,n){let r=Object.keys(e);if(r.length===0)return`{}`;let i=`{ `;for(let a=0;a<r.length;a++){let o=r[a];a&&(i+=`, `),i+=zY.test(o)?o:VY(o),i+=` = `,i+=HY(e[o],BY(e[o]),t-1,n)}return i+` }`}function dve(e,t,n){if(e.length===0)return`[]`;let r=`[ `;for(let i=0;i<e.length;i++){if(i&&(r+=`, `),e[i]===null||e[i]===void 0)throw TypeError(`arrays cannot contain null or undefined values`);r+=HY(e[i],BY(e[i]),t-1,n)}return r+` ]`}function fve(e,t,n,r){if(n===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);let i=``;for(let a=0;a<e.length;a++)i+=`${i&&`
|
|
665
|
+
`}[[${t}]]\n`,i+=UY(0,e[a],t,n,r);return i}function UY(e,t,n,r,i){if(r===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);let a=``,o=``,s=Object.keys(t);for(let e=0;e<s.length;e++){let c=s[e];if(t[c]!==null&&t[c]!==void 0){let e=BY(t[c]);if(e===`symbol`||e===`function`)throw TypeError(`cannot serialize values of type '${e}'`);let s=zY.test(c)?c:VY(c);if(e===`array`&&lve(t[c]))o+=(o&&`
|
|
666
|
+
`)+fve(t[c],n?`${n}.${s}`:s,r-1,i);else if(e===`object`){let e=n?`${n}.${s}`:s;o+=(o&&`
|
|
665
667
|
`)+UY(e,t[c],e,r-1,i)}else a+=s,a+=` = `,a+=HY(t[c],e,r,i),a+=`
|
|
666
|
-
`}}return e&&(a||!o)&&(a=a?`[${e}]\n${a}`:`[${e}]`),a&&o?`${a}\n${o}`:a||o}function
|
|
668
|
+
`}}return e&&(a||!o)&&(a=a?`[${e}]\n${a}`:`[${e}]`),a&&o?`${a}\n${o}`:a||o}function pve(e,{maxDepth:t=1e3,numbersAsFloat:n=!1}={}){if(BY(e)!==`object`)throw TypeError(`stringify can only be called with an object`);let r=UY(0,e,``,t,n);return r[r.length-1]===`
|
|
667
669
|
`?r:r+`
|
|
668
|
-
`}function WY(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function GY(e){let t=e&&typeof e==`object`&&`code`in e?e.code:void 0;return t===`MODULE_NOT_FOUND`||t===`ERR_MODULE_NOT_FOUND`}function
|
|
670
|
+
`}function WY(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function GY(e){let t=e&&typeof e==`object`&&`code`in e?e.code:void 0;return t===`MODULE_NOT_FOUND`||t===`ERR_MODULE_NOT_FOUND`}function mve(e){return!e||typeof e!=`object`?String(e):`${typeof e} keys=[${Object.keys(e).join(`,`)}]`}function hve(e,t){let n=[],r=new WeakSet,i=t;for(;i instanceof Error&&!r.has(i);)r.add(i),n.push(i.message),i=i.cause;return n.length===0?`${e}: ${mve(t)}`:`${e}: ${n.reverse().slice(0,5).join(` -> `)}`}function KY(e,t){process.env.OK_DEBUG_NATIVE&&process.stderr.write(`[ok] native-config ${hve(e,t)}\n`)}const gve=[`native`,`index.js`];function qY(e={},t=KY){let n=e.moduleUrl??import.meta.url,r=e.requireModule??a(n);try{let e=M(Ae(n));return r(N(e,...gve))}catch(e){GY(e)||t(`bundled loader failed to load`,e)}try{return r(`@inkeep/open-knowledge-native-config`)}catch(e){return GY(e)||t(`workspace addon failed to load`,e),null}}function _ve(){let e=qY();return e&&typeof e.parseTomlToJson==`function`?e:null}function vve(e){try{let t=e.parseTomlToJson(`probe = 1`);return typeof t==`string`&&t.includes(`probe`)}catch(e){return KY(`addon loaded but probe failed`,e),!1}}function JY(e){if(!WY(e))throw Error(`TOML root is not a table`);return e}function yve(e){return{backend:`native`,parseToObject(t){return JY(JSON.parse(e.parseTomlToJson(t)))},upsertEntry(t,n,r){let i=e.upsertMcpServer(t,n,JSON.stringify(r));return{text:i.text,existed:i.existed}},removeEntry(t,n){let r=e.removeMcpServer(t,n);return{text:r.text,existed:r.existed}},removeEntryKey(t,n,r){let i=e.removeMcpServerKey(t,n,r);return{text:i.text,existed:i.existed}}}}function bve(){return{backend:`fallback`,parseToObject(e){return JY(cve(e))}}}function xve(e=_ve){let t=e();return t&&vve(t)?yve(t):bve()}let YY=null;function XY(){return YY===null&&(YY=xve()),YY}function Sve(){let e=XY();return e.backend===`native`?e:void 0}const ZY=su,QY=fie,Cve=mie,$Y=`node`,eX={MCP_DEBUG:`1`,OK_LOG_FILE:`/tmp/ok-mcp.log`},tX=`@inkeep/open-knowledge`;function nX(e){return`${ez(`unix-chain`,e.mcpChainTag)}2`}function rX(e){return`${ez(`windows-chain`,e.mcpChainTag)}1`}function iX(e){let t=eu[e],n=`${tX}@${t.npmDistTag}`,r=e===`stable`?``:`\nexport ${tu}=${e}`;return`${nX(t)}${r}
|
|
669
671
|
USER_BUNDLE="$HOME/Applications/${t.productName}.app/Contents/Resources/cli/bin/ok.sh"
|
|
670
672
|
[ -f "$USER_BUNDLE" ] && [ -x "$USER_BUNDLE" ] && exec "$USER_BUNDLE" mcp
|
|
671
673
|
BUNDLE="/Applications/${t.productName}.app/Contents/Resources/cli/bin/ok.sh"
|
|
@@ -701,41 +703,41 @@ foreach ($d in $dirs) {
|
|
|
701
703
|
if (Test-Path -LiteralPath $probe -PathType Leaf) { & $probe -y '${n}' mcp; exit $LASTEXITCODE }
|
|
702
704
|
}
|
|
703
705
|
[Console]::Error.WriteLine('OpenKnowledge: install Node.js 24+ (npm i -g ${i}), then restart your editor')
|
|
704
|
-
exit 127`}nX(eu.stable),iX(`stable`),rX(eu.stable),aX(`stable`);function oX(e){return`// ok-pi-bridge${e.mcpChainTag}`}function sX(e){return`${oX(e)}-v1`}oX(eu.stable),sX(eu.stable);function cX(e){if(typeof e!=`object`||!e)return!1;let t=au(),n=e;if(n.command===`/bin/sh`){if(!Array.isArray(n.args)||n.args[0]!==`-l`||n.args[1]!==`-c`)return!1;let e=n.args[2];return hX(e,nX(t))}if(n.command===`powershell`){if(!Array.isArray(n.args)||n.args[0]!==`-NoProfile`||n.args[1]!==`-NonInteractive`||n.args[2]!==`-Command`)return!1;let e=n.args[3];return hX(e,rX(t))}if(n.type===`local`&&Array.isArray(n.command)){if(n.command[0]===`/bin/sh`){if(n.command[1]!==`-l`||n.command[2]!==`-c`)return!1;let e=n.command[3];return hX(e,nX(t))}if(n.command[0]===`powershell`){if(n.command[1]!==`-NoProfile`||n.command[2]!==`-NonInteractive`||n.command[3]!==`-Command`)return!1;let e=n.command[4];return hX(e,rX(t))}return!1}if(n.command===`ok-pi-managed-extension`){if(!Array.isArray(n.args))return!1;let e=n.args[0];return typeof e==`string`&&e.startsWith(sX(t))}return!1}function lX(e=process.argv[1]){if(!e)throw Error(`Cannot infer the local CLI entry for --dev-mcp because process.argv[1] is empty.`);let t=be(e);if(me(t)===`cli.mjs`&&me(M(t))===`dist`)return t;let n=t.split(xe),r=n.lastIndexOf(`packages`);if(r===-1||n[r+1]!==`cli`)throw Error(`Cannot infer the repo root for --dev-mcp from ${t}. Run the local CLI from this repo so the built dist path can be derived.`);let i=n.slice(0,r),a=i.length===0?xe:i.join(xe);return N(a,`packages`,`cli`,`dist`,`cli.mjs`)}function uX(e={}){return e.mode===`dev`?{command:$Y,args:[lX(),`mcp`],env:{...eX}}:(e.platformName??process.platform)===`win32`?{command:`powershell`,args:[`-NoProfile`,`-NonInteractive`,`-Command`,aX(iu())]}:{command:`/bin/sh`,args:[`-l`,`-c`,iX(iu())]}}function Cve(e={}){return e.mode===`dev`?{type:`local`,enabled:!0,command:[$Y,lX(),`mcp`],environment:{...eX}}:(e.platformName??process.platform)===`win32`?{type:`local`,enabled:!0,command:[`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,aX(iu())]}:{type:`local`,enabled:!0,command:[`/bin/sh`,`-l`,`-c`,iX(iu())]}}function dX(e){if(typeof e!=`object`||!e)return!1;let t=e;return fX(t,uX({mode:`published`,platformName:`darwin`}))||fX(t,uX({mode:`published`,platformName:`win32`}))}function fX(e,t){return Object.keys(e).length===Object.keys(t).length&&wve(e,t)}function wve(e,t){if(e.command!==t.command)return!1;let n=t.args;return!Array.isArray(n)||!Array.isArray(e.args)||e.args.length!==n.length?!1:e.args.every((e,t)=>e===n[t])}function pX(e,t){let n=e=>gX(e);return t===`/bin/sh`?e[0]===`-l`&&e[1]===`-c`&&n(e[2]):t===`powershell`&&e[0]===`-NoProfile`&&e[1]===`-NonInteractive`&&e[2]===`-Command`&&n(e[3])}function Tve(e){return e.format===`toml`?XY().backend===`native`:e.format===`json`||e.format===`yaml`}function mX(e){return Array.isArray(e.command)?e.command:[e.command,...Array.isArray(e.args)?e.args:[]]}function hX(e,t){return typeof e==`string`&&e.trimStart().startsWith(t)}function gX(e){return hX(e,`# ok-mcp`)}function Eve(e){return typeof e==`string`&&(e===tX||e.startsWith(`${tX}@`))}function _X(e){if(typeof e!=`object`||!e)return!1;let t=mX(e),n=t.findIndex(e=>e===`-c`||e===`-Command`);return n>=0&&gX(t[n+1])?!0:t.some(Eve)}function Dve(e){if(typeof e!=`object`||!e)return!1;let t=mX(e);if(t[0]!==$Y||t[2]!==`mcp`)return!1;try{return t[1]===lX()}catch{return!1}}const Ove=[`command`,`args`,`env`],kve=[`type`,`command`,`environment`];function vX(e){return e.type===`local`&&Array.isArray(e.command)?kve:Ove}function yX(e,t){if(typeof e!=`object`||!e)return[];let n=e;return vX(t).filter(e=>t[e]===void 0&&n[e]!==void 0)}function Ave(e,t){return e.format===`file`?null:e.buildEntry(t,{})}function jve(e,t){return yX(e,t).length>0}function Mve(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.enabled===!1||typeof t.command!=`string`||!Array.isArray(t.args)?!1:pX(t.args,t.command)}function Nve(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.type!==`local`||t.enabled===!1||!Array.isArray(t.command))return!1;let[n,...r]=t.command;return typeof n==`string`&&pX(r,n)}function bX(e){return e===`win32`?Se:ve}function Pve(e={}){let t=e.platformName??process.platform,n=e.home??k();return bX(t).join(n,`.claude.json`)}function xX(e={}){let t=e.platformName??process.platform,n=e.home??k(),r=e.env??process.env;if(t===`darwin`)return ve.join(n,`Library`,`Application Support`,`Claude`,`claude_desktop_config.json`);if(t===`win32`){let e=r.APPDATA??Se.join(n,`AppData`,`Roaming`);return Se.join(e,`Claude`,`claude_desktop_config.json`)}throw Error(`Claude Desktop is not available on ${t}. Supported: macOS, Windows.`)}function SX(e={}){let t=e.platformName??process.platform,n=e.home??k();return bX(t).join(n,`.cursor`,`mcp.json`)}function Fve(e={}){let t=e.platformName??process.platform,n=e.home??k();return(e.env??process.env).CODEX_HOME??bX(t).join(n,`.codex`)}function CX(e={}){return bX(e.platformName??process.platform).join(Fve(e),`config.toml`)}function wX(e={}){let t=e.platformName??process.platform,n=e.home??k(),r=(e.env??process.env).COPILOT_HOME??bX(t).join(n,`.copilot`);return bX(t).join(r,`mcp-config.json`)}function Ive(e={}){let t=e.platformName??process.platform,n=e.home??k(),r=e.env??process.env,i=bX(t);if(t===`win32`){let e=r.APPDATA??i.join(n,`AppData`,`Roaming`);return i.join(e,`opencode`)}let a=r.XDG_CONFIG_HOME??i.join(n,`.config`);return i.join(a,`opencode`)}function TX(e={}){return bX(e.platformName??process.platform).join(Ive(e),`opencode.json`)}function Lve(e={}){let t=e.platformName??process.platform,n=e.home??k();return bX(t).join(n,`.openclaw`,`openclaw.json`)}function Rve(e={}){let t=e.platformName??process.platform,n=e.home??k();return bX(t).join(n,`.hermes`,`config.yaml`)}function EX(e={}){let t=e.platformName??process.platform,n=e.home??k();return(e.env??process.env).PI_CODING_AGENT_DIR??bX(t).join(n,`.pi`,`agent`)}function zve(e={}){let t=e.platformName??process.platform,n=e.home??k();return bX(t).join(n,`.gemini`,`config`,`mcp_config.json`)}function Bve(e,t){let n=bX(t);return[{file:n.join(e,`.lmstudio`,`mcp.json`),dir:n.join(e,`.lmstudio`)},{file:n.join(e,`.cache`,`lm-studio`,`mcp.json`),dir:n.join(e,`.cache`,`lm-studio`)}]}function Vve(e){try{return w(e).length>0}catch{return!1}}function DX(e={}){let t=e.platformName??process.platform,[n,r]=Bve(e.home??k(),t),i=[n,r].find(e=>g(e.file));return i?i.file:Vve(r.dir)?r.file:n.file}function Hve(e){let t=e.serverName(``);return e.format===`toml`?`[${e.topLevelKey}.${t}]`:[e.topLevelKey,e.serverMapSubKey,t].filter(Boolean).join(`.`)}function Uve(e,t){let n;try{n=e.configPath(``,t)}catch{return null}return n.startsWith(`${t}/`)?`~${n.slice(t.length)}`:n}const OX={claude:{id:`claude`,label:QY.claude,configPath:(e,t)=>Pve({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>ou(),buildEntry:(e,t)=>uX(t),scope:`global`,detectPath:(e,t)=>N(t??k(),`.claude`),projectConfigPath:e=>N(e,`.mcp.json`),projectSkillPath:e=>N(e,`.claude`,`skills`,`open-knowledge`,`SKILL.md`)},"claude-desktop":{id:`claude-desktop`,label:QY[`claude-desktop`],configPath:(e,t)=>xX({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>ou(),buildEntry:(e,t)=>uX(t),scope:`global`,detectPath:(e,t)=>M(xX({home:t}))},cursor:{id:`cursor`,label:QY.cursor,configPath:(e,t)=>SX({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>ou(),buildEntry:(e,t)=>uX(t),scope:`global`,detectPath:(e,t)=>M(SX({home:t})),projectConfigPath:e=>N(e,`.cursor`,`mcp.json`),projectSkillPath:e=>N(e,`.cursor`,`skills`,`open-knowledge`,`SKILL.md`)},codex:{id:`codex`,label:QY.codex,configPath:(e,t)=>CX({home:t}),format:`toml`,topLevelKey:`mcp_servers`,serverName:()=>ou(),buildEntry:(e,t)=>uX(t),scope:`global`,detectPath:(e,t)=>M(CX({home:t})),projectConfigPath:e=>N(e,`.codex`,`config.toml`),projectSkillPath:e=>N(e,`.codex`,`skills`,`open-knowledge`,`SKILL.md`)},copilot:{id:`copilot`,label:QY.copilot,configPath:(e,t)=>wX({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>ou(),buildEntry:(e,t)=>uX(t),scope:`global`,detectPath:(e,t)=>M(wX({home:t})),projectSkillPath:e=>N(e,`.github`,`skills`,`open-knowledge`,`SKILL.md`)},opencode:{id:`opencode`,label:QY.opencode,configPath:(e,t)=>TX({home:t}),format:`json`,topLevelKey:`mcp`,serverName:()=>ou(),buildEntry:(e,t)=>Cve(t),scope:`global`,detectPath:(e,t)=>M(TX({home:t})),projectConfigPath:e=>N(e,`opencode.json`),projectSkillPath:e=>N(e,`.opencode`,`skills`,`open-knowledge`,`SKILL.md`)},openclaw:{id:`openclaw`,label:QY.openclaw,configPath:(e,t)=>Lve({home:t}),format:`json`,topLevelKey:`mcp`,serverMapSubKey:`servers`,serverName:()=>ou(),buildEntry:(e,t)=>uX(t),scope:`global`,detectPath:(e,t)=>N(t??k(),`.openclaw`),offerOnlyWhenDetected:!0},pi:{id:`pi`,label:QY.pi,configPath:()=>{throw Error(`Pi has no user-global MCP config; OK's integration is the project-scoped bridge extension at ${hu(au())} (run \`ok init\` in the project).`)},format:`file`,topLevelKey:`mcpServers`,serverName:()=>ou(),scope:`project`,detectPath:(e,t)=>EX({home:t}),projectConfigPath:e=>N(e,hu(au())),projectSkillPath:e=>N(e,`.pi`,`skills`,`open-knowledge`,`SKILL.md`)},antigravity:{id:`antigravity`,label:QY.antigravity,configPath:(e,t)=>zve({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>ou(),buildEntry:(e,t)=>uX(t),scope:`global`,detectPath:(e,t)=>N(t??k(),`.gemini`),offerOnlyWhenDetected:!0},"lm-studio":{id:`lm-studio`,label:QY[`lm-studio`],configPath:(e,t)=>DX({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>ou(),buildEntry:(e,t)=>uX(t),scope:`global`,detectPath:(e,t)=>M(DX({home:t})),offerOnlyWhenDetected:!0},hermes:{id:`hermes`,label:QY.hermes,configPath:(e,t)=>Rve({home:t}),format:`yaml`,topLevelKey:`mcp_servers`,serverName:()=>ou(),buildEntry:(e,t)=>uX(t),scope:`global`,detectPath:(e,t)=>N(t??k(),`.hermes`),offerOnlyWhenDetected:!0}};function Wve(e){let t=e.filter(e=>!Object.hasOwn(OX,e));if(t.length>0)throw Error(`Unknown editor(s): ${t.join(`, `)}. Valid options: ${ZY.join(`, `)}`);return e.map(e=>OX[e])}ss();var Gve=Object.create,kX=Object.defineProperty,Kve=Object.getOwnPropertyDescriptor,qve=Object.getOwnPropertyNames,Jve=Object.getPrototypeOf,AX=Object.prototype.hasOwnProperty,jX=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),Yve=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=qve(t),a=0,o=i.length,s;a<o;a++)s=i[a],!AX.call(e,s)&&s!==n&&kX(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Kve(t,s))||r.enumerable});return e},MX=(e,t,n)=>(n=e==null?{}:Gve(Jve(e)),Yve(t||!e||!e.__esModule||!AX.call(e,`default`)?kX(n,`default`,{value:e,enumerable:!0}):n,e)),NX=a(import.meta.url),PX=jX(((e,t)=>{let n=e=>e&&typeof e.message==`string`,r=e=>{if(!e)return;let t=e.cause;if(typeof t==`function`){let t=e.cause();return n(t)?t:void 0}return n(t)?t:void 0},i=(e,t)=>{if(!n(e))return``;let a=e.stack||``;if(t.has(e))return a+`
|
|
706
|
+
exit 127`}nX(eu.stable),iX(`stable`),rX(eu.stable),aX(`stable`);function oX(e){return`// ok-pi-bridge${e.mcpChainTag}`}function sX(e){return`${oX(e)}-v1`}oX(eu.stable),sX(eu.stable);function cX(e){if(typeof e!=`object`||!e)return!1;let t=au(),n=e;if(n.command===`/bin/sh`){if(!Array.isArray(n.args)||n.args[0]!==`-l`||n.args[1]!==`-c`)return!1;let e=n.args[2];return hX(e,nX(t))}if(n.command===`powershell`){if(!Array.isArray(n.args)||n.args[0]!==`-NoProfile`||n.args[1]!==`-NonInteractive`||n.args[2]!==`-Command`)return!1;let e=n.args[3];return hX(e,rX(t))}if(n.type===`local`&&Array.isArray(n.command)){if(n.command[0]===`/bin/sh`){if(n.command[1]!==`-l`||n.command[2]!==`-c`)return!1;let e=n.command[3];return hX(e,nX(t))}if(n.command[0]===`powershell`){if(n.command[1]!==`-NoProfile`||n.command[2]!==`-NonInteractive`||n.command[3]!==`-Command`)return!1;let e=n.command[4];return hX(e,rX(t))}return!1}if(n.command===`ok-pi-managed-extension`){if(!Array.isArray(n.args))return!1;let e=n.args[0];return typeof e==`string`&&e.startsWith(sX(t))}return!1}function lX(e=process.argv[1]){if(!e)throw Error(`Cannot infer the local CLI entry for --dev-mcp because process.argv[1] is empty.`);let t=be(e);if(me(t)===`cli.mjs`&&me(M(t))===`dist`)return t;let n=t.split(xe),r=n.lastIndexOf(`packages`);if(r===-1||n[r+1]!==`cli`)throw Error(`Cannot infer the repo root for --dev-mcp from ${t}. Run the local CLI from this repo so the built dist path can be derived.`);let i=n.slice(0,r),a=i.length===0?xe:i.join(xe);return N(a,`packages`,`cli`,`dist`,`cli.mjs`)}function uX(e={}){return e.mode===`dev`?{command:$Y,args:[lX(),`mcp`],env:{...eX}}:(e.platformName??process.platform)===`win32`?{command:`powershell`,args:[`-NoProfile`,`-NonInteractive`,`-Command`,aX(iu())]}:{command:`/bin/sh`,args:[`-l`,`-c`,iX(iu())]}}function wve(e={}){return e.mode===`dev`?{type:`local`,enabled:!0,command:[$Y,lX(),`mcp`],environment:{...eX}}:(e.platformName??process.platform)===`win32`?{type:`local`,enabled:!0,command:[`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,aX(iu())]}:{type:`local`,enabled:!0,command:[`/bin/sh`,`-l`,`-c`,iX(iu())]}}function dX(e){if(typeof e!=`object`||!e)return!1;let t=e;return fX(t,uX({mode:`published`,platformName:`darwin`}))||fX(t,uX({mode:`published`,platformName:`win32`}))}function fX(e,t){return Object.keys(e).length===Object.keys(t).length&&Tve(e,t)}function Tve(e,t){if(e.command!==t.command)return!1;let n=t.args;return!Array.isArray(n)||!Array.isArray(e.args)||e.args.length!==n.length?!1:e.args.every((e,t)=>e===n[t])}function pX(e,t){let n=e=>gX(e);return t===`/bin/sh`?e[0]===`-l`&&e[1]===`-c`&&n(e[2]):t===`powershell`&&e[0]===`-NoProfile`&&e[1]===`-NonInteractive`&&e[2]===`-Command`&&n(e[3])}function Eve(e){return e.format===`toml`?XY().backend===`native`:e.format===`json`||e.format===`yaml`}function mX(e){return Array.isArray(e.command)?e.command:[e.command,...Array.isArray(e.args)?e.args:[]]}function hX(e,t){return typeof e==`string`&&e.trimStart().startsWith(t)}function gX(e){return hX(e,`# ok-mcp`)}function Dve(e){return typeof e==`string`&&(e===tX||e.startsWith(`${tX}@`))}function _X(e){if(typeof e!=`object`||!e)return!1;let t=mX(e),n=t.findIndex(e=>e===`-c`||e===`-Command`);return n>=0&&gX(t[n+1])?!0:t.some(Dve)}function Ove(e){if(typeof e!=`object`||!e)return!1;let t=mX(e);if(t[0]!==$Y||t[2]!==`mcp`)return!1;try{return t[1]===lX()}catch{return!1}}const kve=[`command`,`args`,`env`],Ave=[`type`,`command`,`environment`];function vX(e){return e.type===`local`&&Array.isArray(e.command)?Ave:kve}function yX(e,t){if(typeof e!=`object`||!e)return[];let n=e;return vX(t).filter(e=>t[e]===void 0&&n[e]!==void 0)}function jve(e,t){return e.format===`file`?null:e.buildEntry(t,{})}function Mve(e,t){return yX(e,t).length>0}function Nve(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.enabled===!1||typeof t.command!=`string`||!Array.isArray(t.args)?!1:pX(t.args,t.command)}function Pve(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.type!==`local`||t.enabled===!1||!Array.isArray(t.command))return!1;let[n,...r]=t.command;return typeof n==`string`&&pX(r,n)}function bX(e){return e===`win32`?Se:ve}function Fve(e={}){let t=e.platformName??process.platform,n=e.home??k();return bX(t).join(n,`.claude.json`)}function xX(e={}){let t=e.platformName??process.platform,n=e.home??k(),r=e.env??process.env;if(t===`darwin`)return ve.join(n,`Library`,`Application Support`,`Claude`,`claude_desktop_config.json`);if(t===`win32`){let e=r.APPDATA??Se.join(n,`AppData`,`Roaming`);return Se.join(e,`Claude`,`claude_desktop_config.json`)}throw Error(`Claude Desktop is not available on ${t}. Supported: macOS, Windows.`)}function SX(e={}){let t=e.platformName??process.platform,n=e.home??k();return bX(t).join(n,`.cursor`,`mcp.json`)}function Ive(e={}){let t=e.platformName??process.platform,n=e.home??k();return(e.env??process.env).CODEX_HOME??bX(t).join(n,`.codex`)}function CX(e={}){return bX(e.platformName??process.platform).join(Ive(e),`config.toml`)}function wX(e={}){let t=e.platformName??process.platform,n=e.home??k(),r=(e.env??process.env).COPILOT_HOME??bX(t).join(n,`.copilot`);return bX(t).join(r,`mcp-config.json`)}function Lve(e={}){let t=e.platformName??process.platform,n=e.home??k(),r=e.env??process.env,i=bX(t);if(t===`win32`){let e=r.APPDATA??i.join(n,`AppData`,`Roaming`);return i.join(e,`opencode`)}let a=r.XDG_CONFIG_HOME??i.join(n,`.config`);return i.join(a,`opencode`)}function TX(e={}){return bX(e.platformName??process.platform).join(Lve(e),`opencode.json`)}function Rve(e={}){let t=e.platformName??process.platform,n=e.home??k();return bX(t).join(n,`.openclaw`,`openclaw.json`)}function zve(e={}){let t=e.platformName??process.platform,n=e.home??k();return bX(t).join(n,`.hermes`,`config.yaml`)}function EX(e={}){let t=e.platformName??process.platform,n=e.home??k();return(e.env??process.env).PI_CODING_AGENT_DIR??bX(t).join(n,`.pi`,`agent`)}function Bve(e={}){let t=e.platformName??process.platform,n=e.home??k();return bX(t).join(n,`.gemini`,`config`,`mcp_config.json`)}function Vve(e,t){let n=bX(t);return[{file:n.join(e,`.lmstudio`,`mcp.json`),dir:n.join(e,`.lmstudio`)},{file:n.join(e,`.cache`,`lm-studio`,`mcp.json`),dir:n.join(e,`.cache`,`lm-studio`)}]}function Hve(e){try{return w(e).length>0}catch{return!1}}function DX(e={}){let t=e.platformName??process.platform,[n,r]=Vve(e.home??k(),t),i=[n,r].find(e=>g(e.file));return i?i.file:Hve(r.dir)?r.file:n.file}function Uve(e){let t=e.serverName(``);return e.format===`toml`?`[${e.topLevelKey}.${t}]`:[e.topLevelKey,e.serverMapSubKey,t].filter(Boolean).join(`.`)}function Wve(e,t){let n;try{n=e.configPath(``,t)}catch{return null}return n.startsWith(`${t}/`)?`~${n.slice(t.length)}`:n}const OX={claude:{id:`claude`,label:QY.claude,configPath:(e,t)=>Fve({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>ou(),buildEntry:(e,t)=>uX(t),scope:`global`,detectPath:(e,t)=>N(t??k(),`.claude`),projectConfigPath:e=>N(e,`.mcp.json`),projectSkillPath:e=>N(e,`.claude`,`skills`,`open-knowledge`,`SKILL.md`)},"claude-desktop":{id:`claude-desktop`,label:QY[`claude-desktop`],configPath:(e,t)=>xX({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>ou(),buildEntry:(e,t)=>uX(t),scope:`global`,detectPath:(e,t)=>M(xX({home:t}))},cursor:{id:`cursor`,label:QY.cursor,configPath:(e,t)=>SX({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>ou(),buildEntry:(e,t)=>uX(t),scope:`global`,detectPath:(e,t)=>M(SX({home:t})),projectConfigPath:e=>N(e,`.cursor`,`mcp.json`),projectSkillPath:e=>N(e,`.cursor`,`skills`,`open-knowledge`,`SKILL.md`)},codex:{id:`codex`,label:QY.codex,configPath:(e,t)=>CX({home:t}),format:`toml`,topLevelKey:`mcp_servers`,serverName:()=>ou(),buildEntry:(e,t)=>uX(t),scope:`global`,detectPath:(e,t)=>M(CX({home:t})),projectConfigPath:e=>N(e,`.codex`,`config.toml`),projectSkillPath:e=>N(e,`.codex`,`skills`,`open-knowledge`,`SKILL.md`)},copilot:{id:`copilot`,label:QY.copilot,configPath:(e,t)=>wX({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>ou(),buildEntry:(e,t)=>uX(t),scope:`global`,detectPath:(e,t)=>M(wX({home:t})),projectSkillPath:e=>N(e,`.github`,`skills`,`open-knowledge`,`SKILL.md`)},opencode:{id:`opencode`,label:QY.opencode,configPath:(e,t)=>TX({home:t}),format:`json`,topLevelKey:`mcp`,serverName:()=>ou(),buildEntry:(e,t)=>wve(t),scope:`global`,detectPath:(e,t)=>M(TX({home:t})),projectConfigPath:e=>N(e,`opencode.json`),projectSkillPath:e=>N(e,`.opencode`,`skills`,`open-knowledge`,`SKILL.md`)},openclaw:{id:`openclaw`,label:QY.openclaw,configPath:(e,t)=>Rve({home:t}),format:`json`,topLevelKey:`mcp`,serverMapSubKey:`servers`,serverName:()=>ou(),buildEntry:(e,t)=>uX(t),scope:`global`,detectPath:(e,t)=>N(t??k(),`.openclaw`),offerOnlyWhenDetected:!0},pi:{id:`pi`,label:QY.pi,configPath:()=>{throw Error(`Pi has no user-global MCP config; OK's integration is the project-scoped bridge extension at ${hu(au())} (run \`ok init\` in the project).`)},format:`file`,topLevelKey:`mcpServers`,serverName:()=>ou(),scope:`project`,detectPath:(e,t)=>EX({home:t}),projectConfigPath:e=>N(e,hu(au())),projectSkillPath:e=>N(e,`.pi`,`skills`,`open-knowledge`,`SKILL.md`)},antigravity:{id:`antigravity`,label:QY.antigravity,configPath:(e,t)=>Bve({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>ou(),buildEntry:(e,t)=>uX(t),scope:`global`,detectPath:(e,t)=>N(t??k(),`.gemini`),offerOnlyWhenDetected:!0},"lm-studio":{id:`lm-studio`,label:QY[`lm-studio`],configPath:(e,t)=>DX({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>ou(),buildEntry:(e,t)=>uX(t),scope:`global`,detectPath:(e,t)=>M(DX({home:t})),offerOnlyWhenDetected:!0},hermes:{id:`hermes`,label:QY.hermes,configPath:(e,t)=>zve({home:t}),format:`yaml`,topLevelKey:`mcp_servers`,serverName:()=>ou(),buildEntry:(e,t)=>uX(t),scope:`global`,detectPath:(e,t)=>N(t??k(),`.hermes`),offerOnlyWhenDetected:!0}};function Gve(e){let t=e.filter(e=>!Object.hasOwn(OX,e));if(t.length>0)throw Error(`Unknown editor(s): ${t.join(`, `)}. Valid options: ${ZY.join(`, `)}`);return e.map(e=>OX[e])}ss();var Kve=Object.create,kX=Object.defineProperty,qve=Object.getOwnPropertyDescriptor,Jve=Object.getOwnPropertyNames,Yve=Object.getPrototypeOf,AX=Object.prototype.hasOwnProperty,jX=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),Xve=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=Jve(t),a=0,o=i.length,s;a<o;a++)s=i[a],!AX.call(e,s)&&s!==n&&kX(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=qve(t,s))||r.enumerable});return e},MX=(e,t,n)=>(n=e==null?{}:Kve(Yve(e)),Xve(t||!e||!e.__esModule||!AX.call(e,`default`)?kX(n,`default`,{value:e,enumerable:!0}):n,e)),NX=a(import.meta.url),PX=jX(((e,t)=>{let n=e=>e&&typeof e.message==`string`,r=e=>{if(!e)return;let t=e.cause;if(typeof t==`function`){let t=e.cause();return n(t)?t:void 0}return n(t)?t:void 0},i=(e,t)=>{if(!n(e))return``;let a=e.stack||``;if(t.has(e))return a+`
|
|
705
707
|
causes have become circular...`;let o=r(e);return o?(t.add(e),a+`
|
|
706
|
-
caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?``:e.message||``;if(t.has(e))return a+`: ...`;let s=r(e);if(s){t.add(e);let n=typeof e.cause==`function`;return a+(n?``:`: `)+o(s,t,n)}return a};t.exports={isErrorLike:n,getErrorCause:r,stackWithCauses:a,messageWithCauses:e=>o(e,new Set)}})),FX=jX(((e,t)=>{let n=Symbol(`circular-ref-tag`),r=Symbol(`pino-raw-err-ref`),i=Object.create({},{type:{enumerable:!0,writable:!0,value:void 0},message:{enumerable:!0,writable:!0,value:void 0},stack:{enumerable:!0,writable:!0,value:void 0},aggregateErrors:{enumerable:!0,writable:!0,value:void 0},raw:{enumerable:!1,get:function(){return this[r]},set:function(e){this[r]=e}}});Object.defineProperty(i,r,{writable:!0,value:{}}),t.exports={pinoErrProto:i,pinoErrorSymbols:{seen:n,rawSymbol:r}}})),Xve=jX(((e,t)=>{t.exports=l;let{messageWithCauses:n,stackWithCauses:r,isErrorLike:i}=PX(),{pinoErrProto:a,pinoErrorSymbols:o}=FX(),{seen:s}=o,{toString:c}=Object.prototype;function l(e){if(!i(e))return e;e[s]=void 0;let t=Object.create(a);t.type=c.call(e.constructor)===`[object Function]`?e.constructor.name:e.name,t.message=n(e),t.stack=r(e),Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(e=>l(e)));for(let n in e)if(t[n]===void 0){let r=e[n];i(r)?n!==`cause`&&!Object.prototype.hasOwnProperty.call(r,s)&&(t[n]=l(r)):t[n]=r}return delete e[s],t.raw=e,t}})),Zve=jX(((e,t)=>{t.exports=s;let{isErrorLike:n}=PX(),{pinoErrProto:r,pinoErrorSymbols:i}=FX(),{seen:a}=i,{toString:o}=Object.prototype;function s(e){if(!n(e))return e;e[a]=void 0;let t=Object.create(r);t.type=o.call(e.constructor)===`[object Function]`?e.constructor.name:e.name,t.message=e.message,t.stack=e.stack,Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(e=>s(e))),n(e.cause)&&!Object.prototype.hasOwnProperty.call(e.cause,a)&&(t.cause=s(e.cause));for(let r in e)if(t[r]===void 0){let i=e[r];n(i)?Object.prototype.hasOwnProperty.call(i,a)||(t[r]=s(i)):t[r]=i}return delete e[a],t.raw=e,t}})),Qve=jX(((e,t)=>{t.exports={mapHttpRequest:a,reqSerializer:i};let n=Symbol(`pino-raw-req-ref`),r=Object.create({},{id:{enumerable:!0,writable:!0,value:``},method:{enumerable:!0,writable:!0,value:``},url:{enumerable:!0,writable:!0,value:``},query:{enumerable:!0,writable:!0,value:``},params:{enumerable:!0,writable:!0,value:``},headers:{enumerable:!0,writable:!0,value:{}},remoteAddress:{enumerable:!0,writable:!0,value:``},remotePort:{enumerable:!0,writable:!0,value:``},raw:{enumerable:!1,get:function(){return this[n]},set:function(e){this[n]=e}}});Object.defineProperty(r,n,{writable:!0,value:{}});function i(e){let t=e.info||e.socket,n=Object.create(r);if(n.id=typeof e.id==`function`?e.id():e.id||(e.info?e.info.id:void 0),n.method=e.method,e.originalUrl)n.url=e.originalUrl;else{let t=e.path;n.url=typeof t==`string`?t:e.url?e.url.path||e.url:void 0}return e.query&&(n.query=e.query),e.params&&(n.params=e.params),n.headers=e.headers,n.remoteAddress=t&&t.remoteAddress,n.remotePort=t&&t.remotePort,n.raw=e.raw||e,n}function a(e){return{req:i(e)}}})),$ve=jX(((e,t)=>{t.exports={mapHttpResponse:a,resSerializer:i};let n=Symbol(`pino-raw-res-ref`),r=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:``},raw:{enumerable:!1,get:function(){return this[n]},set:function(e){this[n]=e}}});Object.defineProperty(r,n,{writable:!0,value:{}});function i(e){let t=Object.create(r);return t.statusCode=e.headersSent?e.statusCode:null,t.headers=e.getHeaders?e.getHeaders():e._headers,t.raw=e,t}function a(e){return{res:i(e)}}})),IX=jX(((e,t)=>{let n=Xve(),r=Zve(),i=Qve(),a=$ve();t.exports={err:n,errWithCause:r,mapHttpRequest:i.mapHttpRequest,mapHttpResponse:a.mapHttpResponse,req:i.reqSerializer,res:a.resSerializer,wrapErrorSerializer:function(e){return e===n?e:function(t){return e(n(t))}},wrapRequestSerializer:function(e){return e===i.reqSerializer?e:function(t){return e(i.reqSerializer(t))}},wrapResponseSerializer:function(e){return e===a.resSerializer?e:function(t){return e(a.resSerializer(t))}}}})),LX=jX(((e,t)=>{function n(e,t){return t}t.exports=function(){let e=Error.prepareStackTrace;Error.prepareStackTrace=n;let t=Error().stack;if(Error.prepareStackTrace=e,!Array.isArray(t))return;let r=t.slice(2),i=[];for(let e of r)e&&i.push(e.getFileName());return i}})),eye=jX(((e,t)=>{function n(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof Array){let t=[];for(let r=0;r<e.length;r++)t[r]=n(e[r]);return t}if(typeof e==`object`){let t=Object.create(Object.getPrototypeOf(e));for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=n(e[r]));return t}return e}function r(e){let t=[],n=``,r=!1,i=!1,a=``;for(let o=0;o<e.length;o++){let s=e[o];!r&&s===`.`?n&&=(t.push(n),``):s===`[`?(n&&=(t.push(n),``),r=!0):s===`]`&&r?(t.push(n),n=``,r=!1,i=!1):(s===`"`||s===`'`)&&r?i?s===a?(i=!1,a=``):n+=s:(i=!0,a=s):n+=s}return n&&t.push(n),t}function i(e,t,n){let r=e;for(let e=0;e<t.length-1;e++){let n=t[e];if(typeof r!=`object`||!r||!(n in r)||typeof r[n]!=`object`||r[n]===null)return!1;r=r[n]}let i=t[t.length-1];if(i===`*`){if(Array.isArray(r))for(let e=0;e<r.length;e++)r[e]=n;else if(typeof r==`object`&&r)for(let e in r)Object.prototype.hasOwnProperty.call(r,e)&&(r[e]=n)}else typeof r==`object`&&r&&i in r&&Object.prototype.hasOwnProperty.call(r,i)&&(r[i]=n);return!0}function a(e,t){let n=e;for(let e=0;e<t.length-1;e++){let r=t[e];if(typeof n!=`object`||!n||!(r in n)||typeof n[r]!=`object`||n[r]===null)return!1;n=n[r]}let r=t[t.length-1];if(r===`*`){if(Array.isArray(n))for(let e=0;e<n.length;e++)n[e]=void 0;else if(typeof n==`object`&&n)for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&delete n[e]}else typeof n==`object`&&n&&r in n&&Object.prototype.hasOwnProperty.call(n,r)&&delete n[r];return!0}let o=Symbol(`PATH_NOT_FOUND`);function s(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||!n||!(e in n))return o;n=n[e]}return n}function c(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||!n)return;n=n[e]}return n}function l(e,t,n,c=!1){for(let l of t){let t=r(l);if(t.includes(`*`))u(e,t,n,l,c);else if(c)a(e,t);else{let r=s(e,t);if(r===o)continue;i(e,t,typeof n==`function`?n(r,t):n)}}}function u(e,t,n,r,i=!1){let a=t.indexOf(`*`);if(a===t.length-1){let r=t.slice(0,-1),a=e;for(let e of r){if(typeof a!=`object`||!a||!a)return;a=a[e]}if(Array.isArray(a)){if(i)for(let e=0;e<a.length;e++)a[e]=void 0;else for(let e=0;e<a.length;e++){let t=[...r,e.toString()],i=typeof n==`function`?n(a[e],t):n;a[e]=i}}else if(typeof a==`object`&&a){if(i){let e=[];for(let t in a)Object.prototype.hasOwnProperty.call(a,t)&&e.push(t);for(let t of e)delete a[t]}else for(let e in a){let t=[...r,e],i=typeof n==`function`?n(a[e],t):n;a[e]=i}}}else d(e,t,n,a,r,i)}function d(e,t,n,r,o,s=!1){let l=t.slice(0,r),d=t.slice(r+1),f=[];function p(e,t){if(t===l.length){if(Array.isArray(e))for(let n=0;n<e.length;n++)f[t]=n.toString(),p(e[n],t+1);else if(typeof e==`object`&&e)for(let n in e)f[t]=n,p(e[n],t+1)}else if(t<l.length){let n=l[t];e&&typeof e==`object`&&e&&n in e&&(f[t]=n,p(e[n],t+1))}else if(d.includes(`*`))u(e,d,typeof n==`function`?(e,r)=>n(e,[...f.slice(0,t),...r]):n,o,s);else if(s)a(e,d);else{let r=typeof n==`function`?n(c(e,d),[...f.slice(0,t),...d]):n;i(e,d,r)}}if(l.length===0)p(e,0);else{let t=e;for(let e=0;e<l.length;e++){let n=l[e];if(typeof t!=`object`||!t||!t)return;t=t[n],f[e]=n}t!=null&&p(t,l.length)}}function f(e){if(e.length===0)return null;let t=new Map;for(let n of e){let e=r(n),i=t;for(let t=0;t<e.length;t++){let n=e[t];i.has(n)||i.set(n,new Map),i=i.get(n)}}return t}function p(e,t){if(!t)return e;function n(e,t,r=0){if(!t||t.size===0||typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){let r=[];for(let i=0;i<e.length;i++){let a=i.toString();t.has(a)||t.has(`*`)?r[i]=n(e[i],t.get(a)||t.get(`*`)):r[i]=e[i]}return r}let i=Object.create(Object.getPrototypeOf(e));for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=t.has(r)||t.has(`*`)?n(e[r],t.get(r)||t.get(`*`)):e[r]);return i}return n(e,t)}function m(e){if(typeof e!=`string`)throw Error(`Paths must be (non-empty) strings`);if(e===``)throw Error(`Invalid redaction path ()`);if(e.includes(`..`)||e.includes(`,`))throw Error(`Invalid redaction path (${e})`);let t=0,n=!1,r=``;for(let i=0;i<e.length;i++){let a=e[i];if((a===`"`||a===`'`)&&t>0)n?a===r&&(n=!1,r=``):(n=!0,r=a);else if(a===`[`&&!n)t++;else if(a===`]`&&!n&&(t--,t<0))throw Error(`Invalid redaction path (${e})`)}if(t!==0)throw Error(`Invalid redaction path (${e})`)}function h(e){if(!Array.isArray(e))throw TypeError(`paths must be an array`);for(let t of e)m(t)}function g(e={}){let{paths:t=[],censor:r=`[REDACTED]`,serialize:i=JSON.stringify,strict:a=!0,remove:o=!1}=e;h(t);let s=f(t);return function(e){if(a&&(typeof e!=`object`||!e)&&(typeof e!=`object`||!e))return i?i(e):e;let c=p(e,s),u=e,d=r;return typeof r==`function`&&(d=r),l(c,t,d,o),i===!1?(c.restore=function(){return n(u)},c):typeof i==`function`?i(c):JSON.stringify(c)}}t.exports=g})),RX=jX(((e,t)=>{let n=Symbol(`pino.setLevel`),r=Symbol(`pino.getLevel`),i=Symbol(`pino.levelVal`),a=Symbol(`pino.levelComp`),o=Symbol(`pino.useLevelLabels`),s=Symbol(`pino.useOnlyCustomLevels`),c=Symbol(`pino.mixin`),l=Symbol(`pino.lsCache`),u=Symbol(`pino.chindings`),d=Symbol(`pino.asJson`),f=Symbol(`pino.write`),p=Symbol(`pino.redactFmt`),m=Symbol(`pino.time`),h=Symbol(`pino.timeSliceIndex`),g=Symbol(`pino.stream`),_=Symbol(`pino.stringify`),v=Symbol(`pino.stringifySafe`),y=Symbol(`pino.stringifiers`),b=Symbol(`pino.end`),x=Symbol(`pino.formatOpts`),S=Symbol(`pino.messageKey`),C=Symbol(`pino.errorKey`),w=Symbol(`pino.nestedKey`),T=Symbol(`pino.nestedKeyStr`),E=Symbol(`pino.mixinMergeStrategy`),D=Symbol(`pino.msgPrefix`),O=Symbol(`pino.wildcardFirst`),ee=Symbol.for(`pino.serializers`),te=Symbol.for(`pino.formatters`),ne=Symbol.for(`pino.hooks`);t.exports={setLevelSym:n,getLevelSym:r,levelValSym:i,levelCompSym:a,useLevelLabelsSym:o,mixinSym:c,lsCacheSym:l,chindingsSym:u,asJsonSym:d,writeSym:f,serializersSym:ee,redactFmtSym:p,timeSym:m,timeSliceIndexSym:h,streamSym:g,stringifySym:_,stringifySafeSym:v,stringifiersSym:y,endSym:b,formatOptsSym:x,messageKeySym:S,errorKeySym:C,nestedKeySym:w,wildcardFirstSym:O,needsMetadataGsym:Symbol.for(`pino.metadata`),useOnlyCustomLevelsSym:s,formattersSym:te,hooksSym:ne,nestedKeyStrSym:T,mixinMergeStrategySym:E,msgPrefixSym:D}})),zX=jX(((e,t)=>{let n=eye(),{redactFmtSym:r,wildcardFirstSym:i}=RX(),a=/[^.[\]]+|\[([^[\]]*?)\]/g,o=`[Redacted]`;function s(e,t){let{paths:o,censor:s,remove:l}=c(e),u=o.reduce((e,t)=>{a.lastIndex=0;let n=a.exec(t),r=a.exec(t),o=n[1]===void 0?n[0]:n[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,`$1`);if(o===`*`&&(o=i),r===null)return e[o]=null,e;if(e[o]===null)return e;let{index:s}=r,c=`${t.substr(s,t.length-1)}`;return e[o]=e[o]||[],o!==i&&e[o].length===0&&e[o].push(...e[i]||[]),o===i&&Object.keys(e).forEach(function(t){e[t]&&e[t].push(c)}),e[o].push(c),e},{}),d={[r]:n({paths:o,censor:s,serialize:t,strict:!1,remove:l})},f=(...e)=>t(typeof s==`function`?s(...e):s);return[...Object.keys(u),...Object.getOwnPropertySymbols(u)].reduce((e,r)=>{if(u[r]===null)e[r]=e=>f(e,[r]);else{let i=typeof s==`function`?(e,t)=>s(e,[r,...t]):s;e[r]=n({paths:u[r],censor:i,serialize:t,strict:!1,remove:l})}return e},d)}function c(e){if(Array.isArray(e))return e={paths:e,censor:o},e;let{paths:t,censor:n=o,remove:r}=e;if(Array.isArray(t)===!1)throw Error(`pino – redact must contain an array of strings`);return r===!0&&(n=void 0),{paths:t,censor:n,remove:r}}t.exports=s})),tye=jX(((e,t)=>{let n=()=>``,r=()=>`,"time":${Date.now()}`,i=()=>`,"time":${Math.round(Date.now()/1e3)}`,a=()=>`,"time":"${new Date(Date.now()).toISOString()}"`,o=1000000000n,s=BigInt(Date.now())*1000000n,c=process.hrtime.bigint();t.exports={nullTime:n,epochTime:r,unixTime:i,isoTime:a,isoTimeNano:()=>{let e=process.hrtime.bigint()-c,t=s+e,n=t/o,r=t%o,i=Number(n*1000n+r/1000000n),a=new Date(i);return`,"time":"${a.getUTCFullYear()}-${(a.getUTCMonth()+1).toString().padStart(2,`0`)}-${a.getUTCDate().toString().padStart(2,`0`)}T${a.getUTCHours().toString().padStart(2,`0`)}:${a.getUTCMinutes().toString().padStart(2,`0`)}:${a.getUTCSeconds().toString().padStart(2,`0`)}.${r.toString().padStart(9,`0`)}Z"`}}})),nye=jX(((e,t)=>{function n(e){try{return JSON.stringify(e)}catch{return`"[Circular]"`}}t.exports=r;function r(e,t,r){var i=r&&r.stringify||n,a=1;if(typeof e==`object`&&e){var o=t.length+a;if(o===1)return e;var s=Array(o);s[0]=i(e);for(var c=1;c<o;c++)s[c]=i(t[c]);return s.join(` `)}if(typeof e!=`string`)return e;var l=t.length;if(l===0)return e;for(var u=``,d=1-a,f=-1,p=e&&e.length||0,m=0;m<p;){if(e.charCodeAt(m)===37&&m+1<p){switch(f=f>-1?f:0,e.charCodeAt(m+1)){case 100:case 102:if(d>=l||t[d]==null)break;f<m&&(u+=e.slice(f,m)),u+=Number(t[d]),f=m+2,m++;break;case 105:if(d>=l||t[d]==null)break;f<m&&(u+=e.slice(f,m)),u+=Math.floor(Number(t[d])),f=m+2,m++;break;case 79:case 111:case 106:if(d>=l||t[d]===void 0)break;f<m&&(u+=e.slice(f,m));var h=typeof t[d];if(h===`string`){u+=`'`+t[d]+`'`,f=m+2,m++;break}if(h===`function`){u+=t[d].name||`<anonymous>`,f=m+2,m++;break}u+=i(t[d]),f=m+2,m++;break;case 115:if(d>=l)break;f<m&&(u+=e.slice(f,m)),u+=String(t[d]),f=m+2,m++;break;case 37:f<m&&(u+=e.slice(f,m)),u+=`%`,f=m+2,m++,d--}++d}++m}return f===-1?e:(f<p&&(u+=e.slice(f)),u)}})),BX=jX(((e,t)=>{if(typeof SharedArrayBuffer<`u`&&typeof Atomics<`u`){let e=new Int32Array(new SharedArrayBuffer(4));function n(t){if(!(t>0&&t<1/0))throw typeof t!=`number`&&typeof t!=`bigint`?TypeError(`sleep: ms must be a number`):RangeError(`sleep: ms must be a number that is greater than 0 but less than Infinity`);Atomics.wait(e,0,0,Number(t))}t.exports=n}else{function e(e){if(!(e>0&&e<1/0))throw typeof e!=`number`&&typeof e!=`bigint`?TypeError(`sleep: ms must be a number`):RangeError(`sleep: ms must be a number that is greater than 0 but less than Infinity`);let t=Date.now()+Number(e);for(;t>Date.now(););}t.exports=e}})),VX=jX(((e,t)=>{let n=NX(`fs`),r=NX(`events`),i=NX(`util`).inherits,a=NX(`path`),o=BX(),s=NX(`assert`),c=Buffer.allocUnsafe(0),l=`buffer`,u=`utf8`,[d,f]=(process.versions.node||`0.0`).split(`.`).map(Number),p=d>=22&&f>=7;function m(e,t){t._opening=!0,t._writing=!0,t._asyncDrainScheduled=!1;function r(n,r){if(n){t._reopening=!1,t._writing=!1,t._opening=!1,t.sync?process.nextTick(()=>{t.listenerCount(`error`)>0&&t.emit(`error`,n)}):t.emit(`error`,n);return}let i=t._reopening;t.fd=r,t.file=e,t._reopening=!1,t._opening=!1,t._writing=!1,t.sync?process.nextTick(()=>t.emit(`ready`)):t.emit(`ready`),!t.destroyed&&(!t._writing&&t._len>t.minLength||t._flushPending?t._actualWrite():i&&process.nextTick(()=>t.emit(`drain`)))}let i=t.append?`a`:`w`,o=t.mode;if(t.sync)try{t.mkdir&&n.mkdirSync(a.dirname(e),{recursive:!0}),r(null,n.openSync(e,i,o))}catch(e){throw r(e),e}else t.mkdir?n.mkdir(a.dirname(e),{recursive:!0},t=>{if(t)return r(t);n.open(e,i,o,r)}):n.open(e,i,o,r)}function h(e){if(!(this instanceof h))return new h(e);let{fd:t,dest:r,minLength:i,maxLength:a,maxWrite:s,periodicFlush:d,sync:f,append:p=!0,mkdir:v,retryEAGAIN:x,fsync:ee,contentMode:te,mode:ne}=e||{};t||=r,this._len=0,this.fd=-1,this._bufs=[],this._lens=[],this._writing=!1,this._ending=!1,this._reopening=!1,this._asyncDrainScheduled=!1,this._flushPending=!1,this._hwm=Math.max(i||0,16387),this.file=null,this.destroyed=!1,this.minLength=i||0,this.maxLength=a||0,this.maxWrite=s||16384,this._periodicFlush=d||0,this._periodicFlushTimer=void 0,this.sync=f||!1,this.writable=!0,this._fsync=ee||!1,this.append=p||!1,this.mode=ne,this.retryEAGAIN=x||(()=>!0),this.mkdir=v||!1;let re,ie;if(te===l)this._writingBuf=c,this.write=b,this.flush=C,this.flushSync=T,this._actualWrite=D,re=()=>n.writeSync(this.fd,this._writingBuf),ie=()=>n.write(this.fd,this._writingBuf,this.release);else if(te===void 0||te===u)this._writingBuf=``,this.write=y,this.flush=S,this.flushSync=w,this._actualWrite=E,re=()=>Buffer.isBuffer(this._writingBuf)?n.writeSync(this.fd,this._writingBuf):n.writeSync(this.fd,this._writingBuf,`utf8`),ie=()=>Buffer.isBuffer(this._writingBuf)?n.write(this.fd,this._writingBuf,this.release):n.write(this.fd,this._writingBuf,`utf8`,this.release);else throw Error(`SonicBoom supports "${u}" and "${l}", but passed ${te}`);if(typeof t==`number`)this.fd=t,process.nextTick(()=>this.emit(`ready`));else if(typeof t==`string`)m(t,this);else throw Error(`SonicBoom supports only file descriptors and files`);if(this.minLength>=this.maxWrite)throw Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);this.release=(e,t)=>{if(e){if((e.code===`EAGAIN`||e.code===`EBUSY`)&&this.retryEAGAIN(e,this._writingBuf.length,this._len-this._writingBuf.length)){if(this.sync)try{o(100),this.release(void 0,0)}catch(e){this.release(e)}else setTimeout(ie,100)}else this._writing=!1,this.emit(`error`,e);return}this.emit(`write`,t);let r=g(this._writingBuf,this._len,t);if(this._len=r.len,this._writingBuf=r.writingBuf,this._writingBuf.length){if(!this.sync){ie();return}try{do{let e=re(),t=g(this._writingBuf,this._len,e);this._len=t.len,this._writingBuf=t.writingBuf}while(this._writingBuf.length)}catch(e){this.release(e);return}}this._fsync&&n.fsyncSync(this.fd);let i=this._len;this._reopening?(this._writing=!1,this._reopening=!1,this.reopen()):i>this.minLength?this._actualWrite():this._ending?i>0?this._actualWrite():(this._writing=!1,O(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(_,this)):this.emit(`drain`))},this.on(`newListener`,function(e){e===`drain`&&(this._asyncDrainScheduled=!1)}),this._periodicFlush!==0&&(this._periodicFlushTimer=setInterval(()=>this.flush(null),this._periodicFlush),this._periodicFlushTimer.unref())}function g(e,t,n){return typeof e==`string`&&(e=Buffer.from(e)),t=Math.max(t-n,0),e=e.subarray(n),{writingBuf:e,len:t}}function _(e){e.listenerCount(`drain`)>0&&(e._asyncDrainScheduled=!1,e.emit(`drain`))}i(h,r);function v(e,t){return e.length===0?c:e.length===1?e[0]:Buffer.concat(e,t)}function y(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);e=``+e;let t=Buffer.byteLength(e),n=this._len+t,r=this._bufs;return this.maxLength&&n>this.maxLength?(this.emit(`drop`,e),this._len<this._hwm):(r.length===0||Buffer.byteLength(r[r.length-1])+t>this.maxWrite?r.push(e):r[r.length-1]+=e,this._len=n,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function b(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);let t=this._len+e.length,n=this._bufs,r=this._lens;return this.maxLength&&t>this.maxLength?(this.emit(`drop`,e),this._len<this._hwm):(n.length===0||r[r.length-1]+e.length>this.maxWrite?(n.push([e]),r.push(e.length)):(n[n.length-1].push(e),r[r.length-1]+=e.length),this._len=t,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function x(e){this._flushPending=!0;let t=()=>{if(this._fsync)this._flushPending=!1,e();else try{n.fsync(this.fd,t=>{this._flushPending=!1,e(t)})}catch(t){e(t)}this.off(`error`,r)},r=n=>{this._flushPending=!1,e(n),this.off(`drain`,t)};this.once(`drain`,t),this.once(`error`,r)}function S(e){if(e!=null&&typeof e!=`function`)throw Error(`flush cb must be a function`);if(this.destroyed){let t=Error(`SonicBoom destroyed`);if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&x.call(this,e),!this._writing&&(this._bufs.length===0&&this._bufs.push(``),this._actualWrite())}function C(e){if(e!=null&&typeof e!=`function`)throw Error(`flush cb must be a function`);if(this.destroyed){let t=Error(`SonicBoom destroyed`);if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&x.call(this,e),!this._writing&&(this._bufs.length===0&&(this._bufs.push([]),this._lens.push(0)),this._actualWrite())}h.prototype.reopen=function(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this._opening){this.once(`ready`,()=>{this.reopen(e)});return}if(this._ending)return;if(!this.file)throw Error(`Unable to reopen a file descriptor, you must pass a file to SonicBoom`);if(e&&(this.file=e),this._reopening=!0,this._writing)return;let t=this.fd;this.once(`ready`,()=>{t!==this.fd&&n.close(t,e=>{if(e)return this.emit(`error`,e)})}),m(this.file,this)},h.prototype.end=function(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this._opening){this.once(`ready`,()=>{this.end()});return}this._ending||(this._ending=!0,!this._writing&&(this._len>0&&this.fd>=0?this._actualWrite():O(this)))};function w(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this.fd<0)throw Error(`sonic boom is not ready yet`);!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift(this._writingBuf),this._writingBuf=``);let e=``;for(;this._bufs.length||e.length;){e.length<=0&&(e=this._bufs[0]);try{let t=Buffer.isBuffer(e)?n.writeSync(this.fd,e):n.writeSync(this.fd,e,`utf8`),r=g(e,this._len,t);e=r.writingBuf,this._len=r.len,e.length<=0&&this._bufs.shift()}catch(t){if((t.code===`EAGAIN`||t.code===`EBUSY`)&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;o(100)}}try{n.fsyncSync(this.fd)}catch{}}function T(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this.fd<0)throw Error(`sonic boom is not ready yet`);!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift([this._writingBuf]),this._writingBuf=c);let e=c;for(;this._bufs.length||e.length;){e.length<=0&&(e=v(this._bufs[0],this._lens[0]));try{let t=n.writeSync(this.fd,e);e=e.subarray(t),this._len=Math.max(this._len-t,0),e.length<=0&&(this._bufs.shift(),this._lens.shift())}catch(t){if((t.code===`EAGAIN`||t.code===`EBUSY`)&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;o(100)}}}h.prototype.destroy=function(){this.destroyed||O(this)};function E(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:this._bufs.shift()||``,this.sync)try{e(null,Buffer.isBuffer(this._writingBuf)?n.writeSync(this.fd,this._writingBuf):n.writeSync(this.fd,this._writingBuf,`utf8`))}catch(t){e(t)}else n.write(this.fd,this._writingBuf,e)}function D(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:v(this._bufs.shift(),this._lens.shift()),this.sync)try{e(null,n.writeSync(this.fd,this._writingBuf))}catch(t){e(t)}else p&&(this._writingBuf=Buffer.from(this._writingBuf)),n.write(this.fd,this._writingBuf,e)}function O(e){if(e.fd===-1){e.once(`ready`,O.bind(null,e));return}e._periodicFlushTimer!==void 0&&clearInterval(e._periodicFlushTimer),e.destroyed=!0,e._bufs=[],e._lens=[],s(typeof e.fd==`number`,`sonic.fd must be a number, got ${typeof e.fd}`);try{n.fsync(e.fd,t)}catch{}function t(){e.fd!==1&&e.fd!==2?n.close(e.fd,r):r()}function r(t){if(t){e.emit(`error`,t);return}e._ending&&!e._writing&&e.emit(`finish`),e.emit(`close`)}}h.SonicBoom=h,h.default=h,t.exports=h})),HX=jX(((e,t)=>{let n={exit:[],beforeExit:[]},r={exit:c,beforeExit:l},i;function a(){i===void 0&&(i=new FinalizationRegistry(d))}function o(e){n[e].length>0||process.on(e,r[e])}function s(e){n[e].length>0||(process.removeListener(e,r[e]),n.exit.length===0&&n.beforeExit.length===0&&(i=void 0))}function c(){u(`exit`)}function l(){u(`beforeExit`)}function u(e){for(let t of n[e]){let n=t.deref(),r=t.fn;n!==void 0&&r(n,e)}n[e]=[]}function d(e){for(let t of[`exit`,`beforeExit`]){let r=n[t].indexOf(e);n[t].splice(r,r+1),s(t)}}function f(e,t,r){if(t===void 0)throw Error(`the object can't be undefined`);o(e);let s=new WeakRef(t);s.fn=r,a(),i.register(t,s),n[e].push(s)}function p(e,t){f(`exit`,e,t)}function m(e,t){f(`beforeExit`,e,t)}function h(e){if(i!==void 0){i.unregister(e);for(let t of[`exit`,`beforeExit`])n[t]=n[t].filter(t=>{let n=t.deref();return n&&n!==e}),s(t)}}t.exports={register:p,registerBeforeExit:m,unregister:h}})),rye=jX(((e,t)=>{t.exports={name:`thread-stream`,version:`4.2.0`,description:`A streaming way to send data to a Node.js Worker Thread`,main:`index.js`,types:`index.d.ts`,engines:{node:`>=20`},dependencies:{"real-require":`^1.0.0`},devDependencies:{"@types/node":`^25.0.2`,"@yao-pkg/pkg":`^6.0.0`,borp:`^1.0.0`,desm:`^1.3.0`,eslint:`^9.39.1`,fastbench:`^1.0.1`,neostandard:`^0.13.0`,"pino-elasticsearch":`^9.0.0`,"sonic-boom":`^5.0.0`,"ts-node":`^10.8.0`,typescript:`~5.7.3`},scripts:{build:`tsc --noEmit`,lint:`eslint`,test:`npm run lint && npm run build && npm run transpile && borp --pattern "test/*.test.{js,mjs}"`,"test:ci":`npm run lint && npm run transpile && borp --pattern "test/*.test.{js,mjs}"`,"test:yarn":`npm run transpile && borp --pattern "test/*.test.js"`,transpile:`sh ./test/ts/transpile.sh`},repository:{type:`git`,url:`git+https://github.com/mcollina/thread-stream.git`},keywords:[`worker`,`thread`,`threads`,`stream`],author:`Matteo Collina <hello@matteocollina.com>`,license:`MIT`,bugs:{url:`https://github.com/mcollina/thread-stream/issues`},homepage:`https://github.com/mcollina/thread-stream#readme`}})),iye=jX(((e,t)=>{let n=1e4;function r(e,t,r,i,a){let o=i===1/0?1/0:Date.now()+i,s=()=>{let i=Atomics.load(e,t);if(i===r){a(null,`ok`);return}if(o!==1/0&&Date.now()>o){a(null,`timed-out`);return}let c=o===1/0?n:Math.min(n,Math.max(1,o-Date.now())),l=Atomics.waitAsync(e,t,i,c);l.async?l.value.then(s):setImmediate(s)};s()}function i(e,t,r,i,a){let o=i===1/0?1/0:Date.now()+i,s=()=>{if(Atomics.load(e,t)!==r){a(null,`ok`);return}if(o!==1/0&&Date.now()>o){a(null,`timed-out`);return}let i=o===1/0?n:Math.min(n,Math.max(1,o-Date.now())),c=Atomics.waitAsync(e,t,r,i);c.async?c.value.then(e=>{if(e===`ok`){a(null,`ok`);return}s()}):setImmediate(s)};s()}t.exports={wait:r,waitDiff:i}})),aye=jX(((e,t)=>{t.exports={WRITE_INDEX:4,READ_INDEX:8,SEQ_INDEX:2}})),oye=jX(((e,t)=>{let{version:n}=rye(),{EventEmitter:r}=NX(`events`),{Worker:i}=NX(`worker_threads`),{join:a}=NX(`path`),{pathToFileURL:o}=NX(`url`),{wait:s}=iye(),{WRITE_INDEX:c,READ_INDEX:l,SEQ_INDEX:u}=aye(),d=NX(`buffer`),f=NX(`assert`),p=Symbol(`kImpl`),m=d.constants.MAX_STRING_LENGTH;function h(){}function g(e,t){Atomics.add(e[p].state,u,1),t(),Atomics.add(e[p].state,u,1),Atomics.notify(e[p].state,u)}function _(e){g(e,()=>{Atomics.store(e[p].state,l,0),Atomics.store(e[p].state,c,0)})}var v=class{constructor(e){this._value=e}deref(){return this._value}},y=class{register(){}unregister(){}};let b=process.env.NODE_V8_COVERAGE?y:global.FinalizationRegistry||y,x=process.env.NODE_V8_COVERAGE?v:global.WeakRef||v,S=new b(e=>{e.exited||e.terminate()});function C(e,t){let{filename:r,workerData:s}=t,c=(`__bundlerPathsOverrides`in globalThis?globalThis.__bundlerPathsOverrides:{})[`thread-stream-worker`]||a(__dirname,`lib`,`worker.js`),l=new i(c,{...t.workerOpts,name:t.workerOpts?.name||`thread-stream`,trackUnmanagedFds:!1,workerData:{filename:r.indexOf(`file://`)===0?r:o(r).href,dataBuf:e[p].dataBuf,stateBuf:e[p].stateBuf,workerData:{$context:{threadStreamVersion:n},...s}}});return l.stream=new v(e),l.on(`message`,E),l.on(`exit`,D),S.register(e,l),l}function w(e){f(!e[p].sync),e[p].needDrain&&(e[p].needDrain=!1,e.emit(`drain`))}function T(e){for(;;){let t=Atomics.load(e[p].state,c),n=e[p].data.length-t;if(n>0){if(e[p].bufLen===0){e[p].flushing=!1,e[p].ending?se(e):e[p].needDrain&&process.nextTick(w,e);return}oe(e,n,h);continue}if(n===0){if(t===0&&e[p].bufLen===0)return;te(e,()=>{e.destroyed||(_(e),T(e))});return}ae(e,Error(`overwritten`));return}}function E(e){let t=this.stream.deref();if(t===void 0){this.exited=!0,this.terminate();return}if(e?.code!=null)switch(e.code){case`READY`:this.stream=new x(t),te(t,()=>{t[p].ready=!0,t.emit(`ready`)});break;case`ERROR`:ae(t,e.err);break;case`EVENT`:Array.isArray(e.args)?t.emit(e.name,...e.args):t.emit(e.name,e.args);break;case`FLUSHED`:{if(e.context!==`thread-stream`){ae(t,Error(`this should not happen: `+e.code));break}let n=t[p].flushCallbacks.get(e.id);n&&(t[p].flushCallbacks.delete(e.id),process.nextTick(n));break}case`WARNING`:process.emitWarning(e.err);break;default:ae(t,Error(`this should not happen: `+e.code))}}function D(e){let t=this.stream.deref();t!==void 0&&(S.unregister(t),t.worker.exited=!0,t.worker.off(`exit`,D),ae(t,e===0?null:Error(`the worker thread exited`)))}var O=class extends r{constructor(e={}){if(super(),e.bufferSize<4)throw Error(`bufferSize must at least fit a 4-byte utf-8 char`);this[p]={},this[p].stateBuf=new SharedArrayBuffer(128),this[p].state=new Int32Array(this[p].stateBuf),this[p].dataBuf=new SharedArrayBuffer(e.bufferSize||4194304),this[p].data=Buffer.from(this[p].dataBuf),this[p].sync=e.sync||!1,this[p].ending=!1,this[p].ended=!1,this[p].needDrain=!1,this[p].destroyed=!1,this[p].flushing=!1,this[p].ready=!1,this[p].finished=!1,this[p].errored=null,this[p].closed=!1,this[p].buf=[],this[p].bufHead=0,this[p].bufLen=0,this[p].flushCallbacks=new Map,this[p].nextFlushId=0,this.worker=C(this,e),this.on(`message`,(e,t)=>{this.worker.postMessage(e,t)})}write(e){let t=Buffer.isBuffer(e)?e:Buffer.from(e);if(this[p].destroyed)return ie(this,Error(`the worker has exited`)),!1;if(this[p].ending)return ie(this,Error(`the worker is ending`)),!1;if(this[p].flushing&&this[p].bufLen+t.length>=m)try{k(this),this[p].flushing=!0}catch(e){return ae(this,e),!1}if(this[p].buf.push(t),this[p].bufLen+=t.length,this[p].sync)try{return k(this),!0}catch(e){return ae(this,e),!1}return this[p].flushing||(this[p].flushing=!0,setImmediate(T,this)),this[p].needDrain=this[p].data.length-this[p].bufLen-Atomics.load(this[p].state,c)<=0,!this[p].needDrain}end(){this[p].destroyed||(this[p].ending=!0,se(this))}flush(e){e=typeof e==`function`?e:h,ee(this,t=>{if(t){process.nextTick(e,t);return}ne(this,e)})}flushSync(){this[p].destroyed||(k(this),ce(this))}unref(){this.worker.unref()}ref(){this.worker.ref()}get ready(){return this[p].ready}get destroyed(){return this[p].destroyed}get closed(){return this[p].closed}get writable(){return!this[p].destroyed&&!this[p].ending}get writableEnded(){return this[p].ending}get writableFinished(){return this[p].finished}get writableNeedDrain(){return this[p].needDrain}get writableObjectMode(){return!1}get writableErrored(){return this[p].errored}};function ee(e,t){if(e[p].destroyed){process.nextTick(t,Error(`the worker has exited`));return}if(!e[p].sync&&(e[p].flushing||e[p].bufLen>0)){setImmediate(ee,e,t);return}te(e,t)}function te(e,t){let n=Atomics.load(e[p].state,c);s(e[p].state,l,n,1/0,(n,r)=>{if(n){ae(e,n),t(n);return}if(r!==`ok`){te(e,t);return}t()})}function ne(e,t){if(e[p].destroyed){process.nextTick(t,Error(`the worker has exited`));return}if(!e[p].ready){let n=()=>{i(),ne(e,t)},r=()=>{i(),process.nextTick(t,Error(`the worker has exited`))},i=()=>{e.off(`ready`,n),e.off(`close`,r)};e.once(`ready`,n),e.once(`close`,r);return}let n=++e[p].nextFlushId;e[p].flushCallbacks.set(n,t);try{e.worker.postMessage({code:`FLUSH`,context:`thread-stream`,id:n})}catch(r){e[p].flushCallbacks.delete(n),ae(e,r),process.nextTick(t,r)}}function re(e,t){let n=e[p].flushCallbacks;if(n.size===0)return;let r=t||Error(`the worker has exited`);for(let e of n.values())process.nextTick(e,r);n.clear()}function ie(e,t){setImmediate(()=>{e.emit(`error`,t)})}function ae(e,t){e[p].destroyed||(e[p].destroyed=!0,re(e,t),t&&(e[p].errored=t,ie(e,t)),e.worker.exited?setImmediate(()=>{e[p].closed=!0,e.emit(`close`)}):e.worker.terminate().catch(()=>{}).then(()=>{e[p].closed=!0,e.emit(`close`)}))}function oe(e,t,n){let r=Atomics.load(e[p].state,c),i=t;for(;i>0&&e[p].bufLen!==0;){let t=e[p].bufHead,n=e[p].buf[t];if(n.length<=i){n.copy(e[p].data,r),r+=n.length,i-=n.length,e[p].bufLen-=n.length,e[p].bufHead=t+1,e[p].bufHead===e[p].buf.length?(e[p].buf.length=0,e[p].bufHead=0):e[p].bufHead>=1024&&e[p].bufHead*2>=e[p].buf.length&&(e[p].buf.splice(0,e[p].bufHead),e[p].bufHead=0);continue}n.copy(e[p].data,r,0,i),e[p].buf[t]=n.subarray(i),e[p].bufLen-=i,r+=i,i=0}return g(e,()=>{Atomics.store(e[p].state,c,r)}),n(),!0}function se(e){if(!(e[p].ended||!e[p].ending||e[p].flushing)){e[p].ended=!0;try{e.flushSync();let t=Atomics.load(e[p].state,l);g(e,()=>{Atomics.store(e[p].state,c,-1)});let n=0;for(;t!==-1;){if(Atomics.wait(e[p].state,l,t,1e3),t=Atomics.load(e[p].state,l),t===-2){ae(e,Error(`end() failed`));return}if(++n===10){ae(e,Error(`end() took too long (10s)`));return}}process.nextTick(()=>{e[p].finished=!0,e.emit(`finish`)})}catch(t){ae(e,t)}}}function k(e){let t=()=>{e[p].ending?se(e):e[p].needDrain&&process.nextTick(w,e)};for(e[p].flushing=!1;e[p].bufLen!==0;){let n=Atomics.load(e[p].state,c),r=e[p].data.length-n;if(r===0){ce(e),_(e);continue}if(r<0)throw Error(`overwritten`);oe(e,r,t)}}function ce(e){if(e[p].flushing)throw Error(`unable to flush while flushing`);let t=Atomics.load(e[p].state,c),n=0;for(;;){let r=Atomics.load(e[p].state,l);if(r===-2)throw Error(`_flushSync failed`);if(r!==t)Atomics.wait(e[p].state,l,r,1e3);else break;if(++n===10)throw Error(`_flushSync took too long (10s)`)}}t.exports=O})),UX=jX(((e,t)=>{let{createRequire:n}=NX(`module`),{existsSync:r}=NX(`node:fs`),i=LX(),{join:a,isAbsolute:o,sep:s}=NX(`node:path`),{fileURLToPath:c}=NX(`node:url`),l=BX(),u=HX(),d=oye();function f(e){u.register(e,v),u.registerBeforeExit(e,y),e.on(`close`,function(){u.unregister(e)})}function p(){let e=process.execArgv;for(let t=0;t<e.length;t++){let n=e[t];if(n===`--import`||n===`--require`||n===`-r`||n.startsWith(`--import=`)||n.startsWith(`--require=`)||n.startsWith(`-r=`))return!0}return!1}function m(e){let t=e.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g);if(!t)return e;let n=[],r=!1;for(let e=0;e<t.length;e++){let i=t[e];if(i===`--require`||i===`-r`||i===`--import`){let a=t[e+1];if(a&&h(a)){r=!0,e++;continue}n.push(i),a&&(n.push(a),e++);continue}if((i.startsWith(`--require=`)||i.startsWith(`-r=`)||i.startsWith(`--import=`))&&h(i.slice(i.indexOf(`=`)+1))){r=!0;continue}n.push(i)}return r?n.join(` `):e}function h(e){let t=g(e);if(!t)return!1;let n=t;if(n.startsWith(`file://`))try{n=c(n)}catch{return!1}return o(n)&&!r(n)}function g(e){let t=e[0],n=e[e.length-1];return t===`"`&&n===`"`||t===`'`&&n===`'`?e.slice(1,-1):e}function _(e,t,n,r,i){if(!n.execArgv&&p()&&NX.main===void 0&&(n={...n,execArgv:[]}),!n.env&&process.env.NODE_OPTIONS){let e=m(process.env.NODE_OPTIONS);e!==process.env.NODE_OPTIONS&&(n={...n,env:{...process.env,NODE_OPTIONS:e}})}n={...n,name:i};let a=new d({filename:e,workerData:t,workerOpts:n,sync:r});a.on(`ready`,o),a.on(`close`,function(){process.removeListener(`exit`,s)}),process.on(`exit`,s);function o(){process.removeListener(`exit`,s),a.unref(),n.autoEnd!==!1&&f(a)}function s(){a.closed||(a.flushSync(),l(100),a.end())}return a}function v(e){e.ref(),e.flushSync(),e.end(),e.once(`close`,function(){e.unref()})}function y(e){e.flushSync()}function b(e){let{pipeline:t,targets:r,levels:c,dedupe:l,worker:u={},caller:d=i(),sync:f=!1}=e,p={...e.options},m=typeof d==`string`?[d]:d,h=typeof globalThis==`object`&&Object.prototype.hasOwnProperty.call(globalThis,`__bundlerPathsOverrides`)&&globalThis.__bundlerPathsOverrides&&typeof globalThis.__bundlerPathsOverrides==`object`?globalThis.__bundlerPathsOverrides:Object.create(null),g=e.target;if(g&&r)throw Error(`only one of target or targets can be specified`);r?(g=h[`pino-worker`]||a(__dirname,`worker.js`),p.targets=r.filter(e=>e.target).map(e=>({...e,target:y(e.target)})),p.pipelines=r.filter(e=>e.pipeline).map(e=>e.pipeline.map(t=>({...t,level:e.level,target:y(t.target)})))):t&&(g=h[`pino-worker`]||a(__dirname,`worker.js`),p.pipelines=[t.map(e=>({...e,target:y(e.target)}))]),c&&(p.levels=c),l&&(p.dedupe=l),p.pinoWillSendConfig=!0;let v=r||t?`pino.transport`:g;return _(y(g),p,u,f,v);function y(e){if(e=h[e]||e,o(e)||e.indexOf(`file://`)===0)return e;if(e===`pino/file`)return a(__dirname,`..`,`file.js`);let t;for(let r of m)try{let i=r===`node:repl`?process.cwd()+s:r;t=n(i).resolve(e);break}catch{continue}if(!t)throw Error(`unable to determine transport target for "${e}"`);return t}}t.exports=b})),WX=jX(((e,t)=>{let n=NX(`node:diagnostics_channel`),r=nye(),{mapHttpRequest:i,mapHttpResponse:a}=IX(),o=VX(),s=HX(),{lsCacheSym:c,chindingsSym:l,writeSym:u,serializersSym:d,formatOptsSym:f,endSym:p,stringifiersSym:m,stringifySym:h,stringifySafeSym:g,wildcardFirstSym:_,nestedKeySym:v,formattersSym:y,messageKeySym:b,errorKeySym:x,nestedKeyStrSym:S,msgPrefixSym:C}=RX(),{isMainThread:w}=NX(`worker_threads`),T=UX(),[E]=process.versions.node.split(`.`).map(e=>Number(e)),D=n.tracingChannel(`pino_asJson`),O=E>=25?e=>JSON.stringify(e):ne;function ee(){}function te(e,t){if(!t)return n;return function(...r){t.call(this,r,n,e)};function n(t,...n){if(typeof t==`object`){let o=t;t!==null&&(t.method&&t.headers&&t.socket?t=i(t):typeof t.setHeader==`function`&&(t=a(t)));let s;o===null&&n.length===0?s=[null]:(o=n.shift(),s=n),typeof this[C]==`string`&&o!=null&&(o=this[C]+o),this[u](t,r(o,s,this[f]),e)}else{let i=t===void 0?n.shift():t;typeof this[C]==`string`&&i!=null&&(i=this[C]+i),this[u](null,r(i,n,this[f]),e)}}}function ne(e){let t=``,n=0,r=!1,i=255,a=e.length;if(a>100)return JSON.stringify(e);for(var o=0;o<a&&i>=32;o++)i=e.charCodeAt(o),(i===34||i===92)&&(t+=e.slice(n,o)+`\\`,n=o,r=!0);return r?t+=e.slice(n):t=e,i<32?JSON.stringify(e):`"`+t+`"`}function re(e,t,n,r){if(D.hasSubscribers===!1)return ie.call(this,e,t,n,r);let i={instance:this,arguments};return D.traceSync(ie,i,this,e,t,n,r)}function ie(e,t,n,r){let i=this[h],a=this[g],o=this[m],s=this[p],u=this[l],f=this[d],C=this[y],w=this[b],T=this[x],E=this[c][n]+r;E+=u;let D;C.log&&(e=C.log(e));let ee=o[_],te=``;for(let t in e)if(D=e[t],Object.prototype.hasOwnProperty.call(e,t)&&D!==void 0){f[t]?D=f[t](D):t===T&&f.err&&(D=f.err(D));let e=o[t]||ee;switch(typeof D){case`undefined`:case`function`:continue;case`number`:Number.isFinite(D)===!1&&(D=null);case`boolean`:e&&(D=e(D));break;case`string`:D=(e||O)(D);break;default:D=(e||i)(D,a)}if(D===void 0)continue;let n=O(t);te+=`,`+n+`:`+D}let ne=``;if(t!==void 0){D=f[w]?f[w](t):t;let e=o[w]||ee;switch(typeof D){case`function`:break;case`number`:Number.isFinite(D)===!1&&(D=null);case`boolean`:e&&(D=e(D)),ne=`,"`+w+`":`+D;break;case`string`:D=(e||O)(D),ne=`,"`+w+`":`+D;break;default:D=(e||i)(D,a),ne=`,"`+w+`":`+D}}return this[v]&&te?E+this[S]+te.slice(1)+`}`+ne+s:E+te+ne+s}function ae(e,t){let n,r=e[l],i=e[h],a=e[g],o=e[m],s=o[_],c=e[d],u=e[y].bindings;t=u(t);for(let e in t)if(n=t[e],((e.length<5||e!==`level`&&e!==`serializers`&&e!==`formatters`&&e!==`customLevels`)&&t.hasOwnProperty(e)&&n!==void 0)===!0){if(n=c[e]?c[e](n):n,n=(o[e]||s||i)(n,a),n===void 0)continue;r+=`,"`+e+`":`+n}return r}function oe(e){return e.write!==e.constructor.prototype.write}function se(e){let t=new o(e);return t.on(`error`,n),!e.sync&&w&&(s.register(t,k),t.on(`close`,function(){s.unregister(t)})),t;function n(e){if(e.code===`EPIPE`){t.write=ee,t.end=ee,t.flushSync=ee,t.destroy=ee;return}t.removeListener(`error`,n),t.emit(`error`,e)}}function k(e,t){e.destroyed||(t===`beforeExit`?(e.flush(),e.on(`drain`,function(){e.end()})):e.flushSync())}function ce(e){return function(t,n,r={},i){if(typeof r==`string`)i=se({dest:r}),r={};else if(typeof i==`string`){if(r&&r.transport)throw Error(`only one of option.transport or stream can be specified`);i=se({dest:i})}else if(r instanceof o||r.writable||r._writableState)i=r,r={};else if(r.transport){if(r.transport instanceof o||r.transport.writable||r.transport._writableState)throw Error(`option.transport do not allow stream, please pass to option directly. e.g. pino(transport)`);if(r.transport.targets&&r.transport.targets.length&&r.formatters&&typeof r.formatters.level==`function`)throw Error(`option.transport.targets do not allow custom level formatters`);let e;r.customLevels&&(e=r.useOnlyCustomLevels?r.customLevels:Object.assign({},r.levels,r.customLevels)),i=T({caller:n,...r.transport,levels:e})}if(r=Object.assign({},e,r),r.serializers=Object.assign({},e.serializers,r.serializers),r.formatters=Object.assign({},e.formatters,r.formatters),r.prettyPrint)throw Error(`prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)`);let{enabled:a,onChild:s}=r;return a===!1&&(r.level=`silent`),s||(r.onChild=ee),i||=oe(process.stdout)?process.stdout:se({fd:process.stdout.fd||1}),{opts:r,stream:i}}}function le(e,t){try{return JSON.stringify(e)}catch{try{return(t||this[g])(e)}catch{return`"[unable to serialize, circular reference is too complex to analyze]"`}}}function ue(e,t,n){return{level:e,bindings:t,log:n}}function A(e){let t=Number(e);return typeof e==`string`&&Number.isFinite(t)?t:e===void 0?1:e}t.exports={noop:ee,buildSafeSonicBoom:se,asChindings:ae,asJson:re,genLog:te,createArgsNormalizer:ce,stringify:le,buildFormatters:ue,normalizeDestFileDescriptor:A}})),GX=jX(((e,t)=>{t.exports={DEFAULT_LEVELS:{trace:10,debug:20,info:30,warn:40,error:50,fatal:60},SORTING_ORDER:{ASC:`ASC`,DESC:`DESC`}}})),KX=jX(((e,t)=>{let{lsCacheSym:n,levelValSym:r,useOnlyCustomLevelsSym:i,streamSym:a,formattersSym:o,hooksSym:s,levelCompSym:c}=RX(),{noop:l,genLog:u}=WX(),{DEFAULT_LEVELS:d,SORTING_ORDER:f}=GX(),p={fatal:e=>{let t=u(d.fatal,e);return function(...e){let n=this[a];if(t.call(this,...e),typeof n.flushSync==`function`)try{n.flushSync()}catch{}}},error:e=>u(d.error,e),warn:e=>u(d.warn,e),info:e=>u(d.info,e),debug:e=>u(d.debug,e),trace:e=>u(d.trace,e)},m=Object.keys(d).reduce((e,t)=>(e[d[t]]=t,e),{}),h=Object.keys(m).reduce((e,t)=>(e[t]=`{"level":`+Number(t),e),{});function g(e){let t=e[o].level,{labels:r}=e.levels,i={};for(let e in r){let n=t(r[e],Number(e));i[e]=JSON.stringify(n).slice(0,-1)}return e[n]=i,e}function _(e,t){if(t)return!1;switch(e){case`fatal`:case`error`:case`warn`:case`info`:case`debug`:case`trace`:return!0;default:return!1}}function v(e){let{labels:t,values:n}=this.levels;if(typeof e==`number`){if(t[e]===void 0)throw Error(`unknown level value`+e);e=t[e]}if(n[e]===void 0)throw Error(`unknown level `+e);let a=this[r],o=this[r]=n[e],d=this[i],f=this[c],m=this[s].logMethod;for(let e in n){if(f(n[e],o)===!1){this[e]=l;continue}this[e]=_(e,d)?p[e](m):u(n[e],m)}this.emit(`level-change`,e,o,t[a],a,this)}function y(e){let{levels:t,levelVal:n}=this;return t&&t.labels?t.labels[n]:``}function b(e){let{values:t}=this.levels,n=t[e];return n!==void 0&&this[c](n,this[r])}function x(e,t,n){return e===f.DESC?t<=n:t>=n}function S(e){return typeof e==`string`?x.bind(null,e):e}function C(e=null,t=!1){let n=e?Object.keys(e).reduce((t,n)=>(t[e[n]]=n,t),{}):null;return{labels:Object.assign(Object.create(Object.prototype,{Infinity:{value:`silent`}}),t?null:m,n),values:Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),t?null:d,e)}}function w(e,t,n){if(typeof e==`number`){if(![].concat(Object.keys(t||{}).map(e=>t[e]),n?[]:Object.keys(m).map(e=>+e),1/0).includes(e))throw Error(`default level:${e} must be included in custom levels`);return}if(!(e in Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),n?null:d,t)))throw Error(`default level:${e} must be included in custom levels`)}function T(e,t){let{labels:n,values:r}=e;for(let e in t){if(e in r)throw Error(`levels cannot be overridden`);if(t[e]in n)throw Error(`pre-existing level values cannot be used for new levels`)}}function E(e){if(typeof e!=`function`&&!(typeof e==`string`&&Object.values(f).includes(e)))throw Error(`Levels comparison should be one of "ASC", "DESC" or "function" type`)}t.exports={initialLsCache:h,genLsCache:g,levelMethods:p,getLevel:y,setLevel:v,isLevelEnabled:b,mappings:C,assertNoLevelCollisions:T,assertDefaultLevelFound:w,genLevelComparison:S,assertLevelComparison:E}})),qX=jX(((e,t)=>{t.exports={version:`10.3.1`}})),sye=jX(((e,t)=>{let{EventEmitter:n}=NX(`node:events`),{lsCacheSym:r,levelValSym:i,setLevelSym:a,getLevelSym:o,chindingsSym:s,mixinSym:c,asJsonSym:l,writeSym:u,mixinMergeStrategySym:d,timeSym:f,timeSliceIndexSym:p,streamSym:m,serializersSym:h,formattersSym:g,errorKeySym:_,messageKeySym:v,useOnlyCustomLevelsSym:y,needsMetadataGsym:b,redactFmtSym:x,stringifySym:S,formatOptsSym:C,stringifiersSym:w,msgPrefixSym:T,hooksSym:E}=RX(),{getLevel:D,setLevel:O,isLevelEnabled:ee,mappings:te,initialLsCache:ne,genLsCache:re,assertNoLevelCollisions:ie}=KX(),{asChindings:ae,asJson:oe,buildFormatters:se,stringify:k,noop:ce}=WX(),{version:le}=qX(),ue=zX(),A={constructor:class{},child:de,bindings:fe,setBindings:pe,flush:he,isLevelEnabled:ee,version:le,get level(){return this[o]()},set level(e){this[a](e)},get levelVal(){return this[i]},set levelVal(e){throw Error(`levelVal is read-only`)},get msgPrefix(){return this[T]},get[Symbol.toStringTag](){return`Pino`},[r]:ne,[u]:M,[l]:oe,[o]:D,[a]:O};Object.setPrototypeOf(A,n.prototype),t.exports=function(){return Object.create(A)};let j=e=>e;function de(e,t){if(!e)throw Error(`missing bindings for child Pino`);let n=this[h],r=this[g],i=Object.create(this);if(t==null)return i[g].bindings!==j&&(i[g]=se(r.level,j,r.log)),i[s]=ae(i,e),this.onChild!==ce&&this.onChild(i),i;if(t.hasOwnProperty(`serializers`)===!0){i[h]=Object.create(null);for(let e in n)i[h][e]=n[e];let e=Object.getOwnPropertySymbols(n);for(var o=0;o<e.length;o++){let t=e[o];i[h][t]=n[t]}for(let e in t.serializers)i[h][e]=t.serializers[e];let r=Object.getOwnPropertySymbols(t.serializers);for(var c=0;c<r.length;c++){let e=r[c];i[h][e]=t.serializers[e]}}else i[h]=n;if(t.hasOwnProperty(`formatters`)){let{level:e,bindings:n,log:a}=t.formatters;i[g]=se(e||r.level,n||j,a||r.log)}else i[g]=se(r.level,j,r.log);if(t.hasOwnProperty(`customLevels`)===!0&&(ie(this.levels,t.customLevels),i.levels=te(t.customLevels,i[y]),re(i)),typeof t.redact==`object`&&t.redact!==null||Array.isArray(t.redact)){i.redact=t.redact;let e=ue(i.redact,k),n={stringify:e[x]};i[S]=k,i[w]=e,i[C]=n}if(typeof t.msgPrefix==`string`&&(i[T]=(this[T]||``)+t.msgPrefix),i[s]=ae(i,e),t.level!==void 0&&t.level!==this.level||t.hasOwnProperty(`customLevels`)){let e=t.level||this.level;i[a](e)}return this.onChild(i),i}function fe(){let e=`{${this[s].substr(1)}}`,t=JSON.parse(e);return delete t.pid,delete t.hostname,t}function pe(e){let t=ae(this,e);this[s]=t}function me(e,t){return Object.assign(t,e)}function M(e,t,n){let r=this[f](),i=this[c],a=this[_],o=this[v],s=this[d]||me,u,h=this[E].streamWrite;e==null?u={}:e instanceof Error?(u={[a]:e},t===void 0&&(t=e.message)):(u=e,t===void 0&&e[o]===void 0&&e[a]&&(t=e[a].message)),i&&(u=s(u,i(u,n,this)));let g=this[l](u,t,n,r),y=this[m];y[b]===!0&&(y.lastLevel=n,y.lastObj=u,y.lastMsg=t,y.lastTime=r.slice(this[p]),y.lastLogger=this),y.write(h?h(g):g)}function he(e){if(e!=null&&typeof e!=`function`)throw Error(`callback must be a function`);let t=this[m];typeof t.flush==`function`?t.flush(e||ce):e&&e()}})),cye=jX(((e,t)=>{let{hasOwnProperty:n}=Object.prototype,r=_();r.configure=_,r.stringify=r,r.default=r,e.stringify=r,e.configure=_,t.exports=r;let i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function a(e){return e.length<5e3&&!i.test(e)?`"${e}"`:JSON.stringify(e)}function o(e,t){if(e.length>200||t)return e.sort(t);for(let t=1;t<e.length;t++){let n=e[t],r=t;for(;r!==0&&e[r-1]>n;)e[r]=e[r-1],r--;e[r]=n}return e}let s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function c(e){return s.call(e)!==void 0&&e.length!==0}function l(e,t,n){e.length<n&&(n=e.length);let r=t===`,`?``:` `,i=`"0":${r}${e[0]}`;for(let a=1;a<n;a++)i+=`${t}"${a}":${r}${e[a]}`;return i}function u(e){if(n.call(e,`circularValue`)){let t=e.circularValue;if(typeof t==`string`)return`"${t}"`;if(t==null)return t;if(t===Error||t===TypeError)return{toString(){throw TypeError(`Converting circular structure to JSON`)}};throw TypeError(`The "circularValue" argument must be of type string or the value null or undefined`)}return`"[Circular]"`}function d(e){let t;if(n.call(e,`deterministic`)&&(t=e.deterministic,typeof t!=`boolean`&&typeof t!=`function`))throw TypeError(`The "deterministic" argument must be of type boolean or comparator function`);return t===void 0||t}function f(e,t){let r;if(n.call(e,t)&&(r=e[t],typeof r!=`boolean`))throw TypeError(`The "${t}" argument must be of type boolean`);return r===void 0||r}function p(e,t){let r;if(n.call(e,t)){if(r=e[t],typeof r!=`number`)throw TypeError(`The "${t}" argument must be of type number`);if(!Number.isInteger(r))throw TypeError(`The "${t}" argument must be an integer`);if(r<1)throw RangeError(`The "${t}" argument must be >= 1`)}return r===void 0?1/0:r}function m(e){return e===1?`1 item`:`${e} items`}function h(e){let t=new Set;for(let n of e)(typeof n==`string`||typeof n==`number`)&&t.add(String(n));return t}function g(e){if(n.call(e,`strict`)){let t=e.strict;if(typeof t!=`boolean`)throw TypeError(`The "strict" argument must be of type boolean`);if(t)return e=>{let t=`Object can not safely be stringified. Received type ${typeof e}`;throw typeof e!=`function`&&(t+=` (${e.toString()})`),Error(t)}}}function _(e){e={...e};let t=g(e);t&&(e.bigint===void 0&&(e.bigint=!1),`circularValue`in e||(e.circularValue=Error));let n=u(e),r=f(e,`bigint`),i=d(e),s=typeof i==`function`?i:void 0,_=p(e,`maximumDepth`),v=p(e,`maximumBreadth`);function y(e,l,u,d,f,p){let h=l[e];switch(typeof h==`object`&&h&&typeof h.toJSON==`function`&&(h=h.toJSON(e)),h=d.call(l,e,h),typeof h){case`string`:return a(h);case`object`:{if(h===null)return`null`;if(u.indexOf(h)!==-1)return n;let e=``,t=`,`,r=p;if(Array.isArray(h)){if(h.length===0)return`[]`;if(_<u.length+1)return`"[Array]"`;u.push(h),f!==``&&(p+=f,e+=`\n${p}`,t=`,\n${p}`);let n=Math.min(h.length,v),i=0;for(;i<n-1;i++){let n=y(String(i),h,u,d,f,p);e+=n===void 0?`null`:n,e+=t}let a=y(String(i),h,u,d,f,p);if(e+=a===void 0?`null`:a,h.length-1>v){let n=h.length-v-1;e+=`${t}"... ${m(n)} not stringified"`}return f!==``&&(e+=`\n${r}`),u.pop(),`[${e}]`}let l=Object.keys(h),g=l.length;if(g===0)return`{}`;if(_<u.length+1)return`"[Object]"`;let b=``,x=``;f!==``&&(p+=f,t=`,\n${p}`,b=` `);let S=Math.min(g,v);i&&!c(h)&&(l=o(l,s)),u.push(h);for(let n=0;n<S;n++){let r=l[n],i=y(r,h,u,d,f,p);i!==void 0&&(e+=`${x}${a(r)}:${b}${i}`,x=t)}if(g>v){let n=g-v;e+=`${x}"...":${b}"${m(n)} not stringified"`,x=t}return f!==``&&x.length>1&&(e=`\n${p}${e}\n${r}`),u.pop(),`{${e}}`}case`number`:return isFinite(h)?String(h):t?t(h):`null`;case`boolean`:return h===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(h);default:return t?t(h):void 0}}function b(e,i,o,s,c,l){switch(typeof i==`object`&&i&&typeof i.toJSON==`function`&&(i=i.toJSON(e)),typeof i){case`string`:return a(i);case`object`:{if(i===null)return`null`;if(o.indexOf(i)!==-1)return n;let e=l,t=``,r=`,`;if(Array.isArray(i)){if(i.length===0)return`[]`;if(_<o.length+1)return`"[Array]"`;o.push(i),c!==``&&(l+=c,t+=`\n${l}`,r=`,\n${l}`);let n=Math.min(i.length,v),a=0;for(;a<n-1;a++){let e=b(String(a),i[a],o,s,c,l);t+=e===void 0?`null`:e,t+=r}let u=b(String(a),i[a],o,s,c,l);if(t+=u===void 0?`null`:u,i.length-1>v){let e=i.length-v-1;t+=`${r}"... ${m(e)} not stringified"`}return c!==``&&(t+=`\n${e}`),o.pop(),`[${t}]`}o.push(i);let u=``;c!==``&&(l+=c,r=`,\n${l}`,u=` `);let d=``;for(let e of s){let n=b(e,i[e],o,s,c,l);n!==void 0&&(t+=`${d}${a(e)}:${u}${n}`,d=r)}return c!==``&&d.length>1&&(t=`\n${l}${t}\n${e}`),o.pop(),`{${t}}`}case`number`:return isFinite(i)?String(i):t?t(i):`null`;case`boolean`:return i===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(i);default:return t?t(i):void 0}}function x(e,u,d,f,p){switch(typeof u){case`string`:return a(u);case`object`:{if(u===null)return`null`;if(typeof u.toJSON==`function`){if(u=u.toJSON(e),typeof u!=`object`)return x(e,u,d,f,p);if(u===null)return`null`}if(d.indexOf(u)!==-1)return n;let t=p;if(Array.isArray(u)){if(u.length===0)return`[]`;if(_<d.length+1)return`"[Array]"`;d.push(u),p+=f;let e=`\n${p}`,n=`,\n${p}`,r=Math.min(u.length,v),i=0;for(;i<r-1;i++){let t=x(String(i),u[i],d,f,p);e+=t===void 0?`null`:t,e+=n}let a=x(String(i),u[i],d,f,p);if(e+=a===void 0?`null`:a,u.length-1>v){let t=u.length-v-1;e+=`${n}"... ${m(t)} not stringified"`}return e+=`\n${t}`,d.pop(),`[${e}]`}let r=Object.keys(u),h=r.length;if(h===0)return`{}`;if(_<d.length+1)return`"[Object]"`;p+=f;let g=`,\n${p}`,y=``,b=``,S=Math.min(h,v);c(u)&&(y+=l(u,g,v),r=r.slice(u.length),S-=u.length,b=g),i&&(r=o(r,s)),d.push(u);for(let e=0;e<S;e++){let t=r[e],n=x(t,u[t],d,f,p);n!==void 0&&(y+=`${b}${a(t)}: ${n}`,b=g)}if(h>v){let e=h-v;y+=`${b}"...": "${m(e)} not stringified"`,b=g}return b!==``&&(y=`\n${p}${y}\n${t}`),d.pop(),`{${y}}`}case`number`:return isFinite(u)?String(u):t?t(u):`null`;case`boolean`:return u===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(u);default:return t?t(u):void 0}}function S(e,u,d){switch(typeof u){case`string`:return a(u);case`object`:{if(u===null)return`null`;if(typeof u.toJSON==`function`){if(u=u.toJSON(e),typeof u!=`object`)return S(e,u,d);if(u===null)return`null`}if(d.indexOf(u)!==-1)return n;let t=``,r=u.length!==void 0;if(r&&Array.isArray(u)){if(u.length===0)return`[]`;if(_<d.length+1)return`"[Array]"`;d.push(u);let e=Math.min(u.length,v),n=0;for(;n<e-1;n++){let e=S(String(n),u[n],d);t+=e===void 0?`null`:e,t+=`,`}let r=S(String(n),u[n],d);if(t+=r===void 0?`null`:r,u.length-1>v){let e=u.length-v-1;t+=`,"... ${m(e)} not stringified"`}return d.pop(),`[${t}]`}let f=Object.keys(u),p=f.length;if(p===0)return`{}`;if(_<d.length+1)return`"[Object]"`;let h=``,g=Math.min(p,v);r&&c(u)&&(t+=l(u,`,`,v),f=f.slice(u.length),g-=u.length,h=`,`),i&&(f=o(f,s)),d.push(u);for(let e=0;e<g;e++){let n=f[e],r=S(n,u[n],d);r!==void 0&&(t+=`${h}${a(n)}:${r}`,h=`,`)}if(p>v){let e=p-v;t+=`${h}"...":"${m(e)} not stringified"`}return d.pop(),`{${t}}`}case`number`:return isFinite(u)?String(u):t?t(u):`null`;case`boolean`:return u===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(u);default:return t?t(u):void 0}}function C(e,t,n){if(arguments.length>1){let r=``;if(typeof n==`number`?r=` `.repeat(Math.min(n,10)):typeof n==`string`&&(r=n.slice(0,10)),t!=null){if(typeof t==`function`)return y(``,{"":e},[],t,r,``);if(Array.isArray(t))return b(``,e,[],h(t),r,``)}if(r.length!==0)return x(``,e,[],r,``)}return S(``,e,[])}return C}})),lye=jX(((e,t)=>{let n=Symbol.for(`pino.metadata`),{DEFAULT_LEVELS:r}=GX(),i=r.info;function a(e,t){e||=[],t||={dedupe:!1};let a=Object.create(r);a.silent=1/0,t.levels&&typeof t.levels==`object`&&Object.keys(t.levels).forEach(e=>{a[e]=t.levels[e]});let u={write:d,add:m,remove:h,emit:f,flushSync:p,end:g,minLevel:0,lastId:0,streams:[],clone:_,[n]:!0,streamLevels:a};return Array.isArray(e)?e.forEach(m,u):m.call(u,e),e=null,u;function d(e){let r,i=this.lastLevel,{streams:a}=this,o=0,u;for(let d=s(a.length,t.dedupe);l(d,a.length,t.dedupe);d=c(d,t.dedupe))if(r=a[d],r.level<=i){if(o!==0&&o!==r.level)break;if(u=r.stream,u[n]){let{lastTime:e,lastMsg:t,lastObj:n,lastLogger:r}=this;u.lastLevel=i,u.lastTime=e,u.lastMsg=t,u.lastObj=n,u.lastLogger=r}u.write(e),t.dedupe&&(o=r.level)}else if(!t.dedupe)break}function f(...e){for(let{stream:t}of this.streams)typeof t.emit==`function`&&t.emit(...e)}function p(){for(let{stream:e}of this.streams)typeof e.flushSync==`function`&&e.flushSync()}function m(e){if(!e)return u;let t=typeof e.write==`function`||e.stream,n=e.write?e:e.stream;if(!t)throw Error(`stream object needs to implement either StreamEntry or DestinationStream interface`);let{streams:r,streamLevels:a}=this,s;s=typeof e.levelVal==`number`?e.levelVal:typeof e.level==`string`?a[e.level]:typeof e.level==`number`?e.level:i;let c={stream:n,level:s,levelVal:void 0,id:++u.lastId};return r.unshift(c),r.sort(o),this.minLevel=r[0].level,u}function h(e){let{streams:t}=this,n=t.findIndex(t=>t.id===e);return n>=0&&(t.splice(n,1),t.sort(o),this.minLevel=t.length>0?t[0].level:-1),u}function g(){for(let{stream:e}of this.streams)typeof e.flushSync==`function`&&e.flushSync(),e.end()}function _(e){let t=Array(this.streams.length);for(let n=0;n<t.length;n++)t[n]={level:e,stream:this.streams[n].stream};return{write:d,add:m,remove:h,minLevel:e,streams:t,clone:_,emit:f,flushSync:p,[n]:!0}}}function o(e,t){return e.level-t.level}function s(e,t){return t?e-1:0}function c(e,t){return t?e-1:e+1}function l(e,t,n){return n?e>=0:e<t}t.exports=a})),JX=jX(((e,t)=>{let n=NX(`node:os`),r=IX(),i=LX(),a=zX(),o=tye(),s=sye(),c=RX(),{configure:l}=cye(),{assertDefaultLevelFound:u,mappings:d,genLsCache:f,genLevelComparison:p,assertLevelComparison:m}=KX(),{DEFAULT_LEVELS:h,SORTING_ORDER:g}=GX(),{createArgsNormalizer:_,asChindings:v,buildSafeSonicBoom:y,buildFormatters:b,stringify:x,normalizeDestFileDescriptor:S,noop:C}=WX(),{version:w}=qX(),{chindingsSym:T,redactFmtSym:E,serializersSym:D,timeSym:O,timeSliceIndexSym:ee,streamSym:te,stringifySym:ne,stringifySafeSym:re,stringifiersSym:ie,setLevelSym:ae,endSym:oe,formatOptsSym:se,messageKeySym:k,errorKeySym:ce,nestedKeySym:le,mixinSym:ue,levelCompSym:A,useOnlyCustomLevelsSym:j,formattersSym:de,hooksSym:fe,nestedKeyStrSym:pe,mixinMergeStrategySym:me,msgPrefixSym:M}=c,{epochTime:he,nullTime:ge}=o,{pid:N}=process,_e=n.hostname(),ve=r.err,ye=_({level:`info`,levelComparison:g.ASC,levels:h,messageKey:`msg`,errorKey:`err`,nestedKey:null,enabled:!0,base:{pid:N,hostname:_e},serializers:Object.assign(Object.create(null),{err:ve}),formatters:Object.assign(Object.create(null),{bindings(e){return e},level(e,t){return{level:t}}}),hooks:{logMethod:void 0,streamWrite:void 0},timestamp:he,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100}),be=Object.assign(Object.create(null),r);function xe(...e){let t={},{opts:n,stream:r}=ye(t,i(),...e);n.level&&typeof n.level==`string`&&h[n.level.toLowerCase()]!==void 0&&(n.level=n.level.toLowerCase());let{redact:o,crlf:c,serializers:g,timestamp:_,messageKey:y,errorKey:S,nestedKey:w,base:N,name:_e,level:ve,customLevels:be,levelComparison:xe,mixin:Se,mixinMergeStrategy:Ce,useOnlyCustomLevels:we,formatters:Te,hooks:Ee,depthLimit:De,edgeLimit:Oe,onChild:ke,msgPrefix:Ae}=n,je=l({maximumDepth:De,maximumBreadth:Oe}),Me=b(Te.level,Te.bindings,Te.log),Ne=x.bind({[re]:je}),Pe=o?a(o,Ne):{},Fe=o?{stringify:Pe[E]}:{stringify:Ne},Ie=`}`+(c?`\r
|
|
708
|
+
caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?``:e.message||``;if(t.has(e))return a+`: ...`;let s=r(e);if(s){t.add(e);let n=typeof e.cause==`function`;return a+(n?``:`: `)+o(s,t,n)}return a};t.exports={isErrorLike:n,getErrorCause:r,stackWithCauses:a,messageWithCauses:e=>o(e,new Set)}})),FX=jX(((e,t)=>{let n=Symbol(`circular-ref-tag`),r=Symbol(`pino-raw-err-ref`),i=Object.create({},{type:{enumerable:!0,writable:!0,value:void 0},message:{enumerable:!0,writable:!0,value:void 0},stack:{enumerable:!0,writable:!0,value:void 0},aggregateErrors:{enumerable:!0,writable:!0,value:void 0},raw:{enumerable:!1,get:function(){return this[r]},set:function(e){this[r]=e}}});Object.defineProperty(i,r,{writable:!0,value:{}}),t.exports={pinoErrProto:i,pinoErrorSymbols:{seen:n,rawSymbol:r}}})),Zve=jX(((e,t)=>{t.exports=l;let{messageWithCauses:n,stackWithCauses:r,isErrorLike:i}=PX(),{pinoErrProto:a,pinoErrorSymbols:o}=FX(),{seen:s}=o,{toString:c}=Object.prototype;function l(e){if(!i(e))return e;e[s]=void 0;let t=Object.create(a);t.type=c.call(e.constructor)===`[object Function]`?e.constructor.name:e.name,t.message=n(e),t.stack=r(e),Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(e=>l(e)));for(let n in e)if(t[n]===void 0){let r=e[n];i(r)?n!==`cause`&&!Object.prototype.hasOwnProperty.call(r,s)&&(t[n]=l(r)):t[n]=r}return delete e[s],t.raw=e,t}})),Qve=jX(((e,t)=>{t.exports=s;let{isErrorLike:n}=PX(),{pinoErrProto:r,pinoErrorSymbols:i}=FX(),{seen:a}=i,{toString:o}=Object.prototype;function s(e){if(!n(e))return e;e[a]=void 0;let t=Object.create(r);t.type=o.call(e.constructor)===`[object Function]`?e.constructor.name:e.name,t.message=e.message,t.stack=e.stack,Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(e=>s(e))),n(e.cause)&&!Object.prototype.hasOwnProperty.call(e.cause,a)&&(t.cause=s(e.cause));for(let r in e)if(t[r]===void 0){let i=e[r];n(i)?Object.prototype.hasOwnProperty.call(i,a)||(t[r]=s(i)):t[r]=i}return delete e[a],t.raw=e,t}})),$ve=jX(((e,t)=>{t.exports={mapHttpRequest:a,reqSerializer:i};let n=Symbol(`pino-raw-req-ref`),r=Object.create({},{id:{enumerable:!0,writable:!0,value:``},method:{enumerable:!0,writable:!0,value:``},url:{enumerable:!0,writable:!0,value:``},query:{enumerable:!0,writable:!0,value:``},params:{enumerable:!0,writable:!0,value:``},headers:{enumerable:!0,writable:!0,value:{}},remoteAddress:{enumerable:!0,writable:!0,value:``},remotePort:{enumerable:!0,writable:!0,value:``},raw:{enumerable:!1,get:function(){return this[n]},set:function(e){this[n]=e}}});Object.defineProperty(r,n,{writable:!0,value:{}});function i(e){let t=e.info||e.socket,n=Object.create(r);if(n.id=typeof e.id==`function`?e.id():e.id||(e.info?e.info.id:void 0),n.method=e.method,e.originalUrl)n.url=e.originalUrl;else{let t=e.path;n.url=typeof t==`string`?t:e.url?e.url.path||e.url:void 0}return e.query&&(n.query=e.query),e.params&&(n.params=e.params),n.headers=e.headers,n.remoteAddress=t&&t.remoteAddress,n.remotePort=t&&t.remotePort,n.raw=e.raw||e,n}function a(e){return{req:i(e)}}})),eye=jX(((e,t)=>{t.exports={mapHttpResponse:a,resSerializer:i};let n=Symbol(`pino-raw-res-ref`),r=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:``},raw:{enumerable:!1,get:function(){return this[n]},set:function(e){this[n]=e}}});Object.defineProperty(r,n,{writable:!0,value:{}});function i(e){let t=Object.create(r);return t.statusCode=e.headersSent?e.statusCode:null,t.headers=e.getHeaders?e.getHeaders():e._headers,t.raw=e,t}function a(e){return{res:i(e)}}})),IX=jX(((e,t)=>{let n=Zve(),r=Qve(),i=$ve(),a=eye();t.exports={err:n,errWithCause:r,mapHttpRequest:i.mapHttpRequest,mapHttpResponse:a.mapHttpResponse,req:i.reqSerializer,res:a.resSerializer,wrapErrorSerializer:function(e){return e===n?e:function(t){return e(n(t))}},wrapRequestSerializer:function(e){return e===i.reqSerializer?e:function(t){return e(i.reqSerializer(t))}},wrapResponseSerializer:function(e){return e===a.resSerializer?e:function(t){return e(a.resSerializer(t))}}}})),LX=jX(((e,t)=>{function n(e,t){return t}t.exports=function(){let e=Error.prepareStackTrace;Error.prepareStackTrace=n;let t=Error().stack;if(Error.prepareStackTrace=e,!Array.isArray(t))return;let r=t.slice(2),i=[];for(let e of r)e&&i.push(e.getFileName());return i}})),tye=jX(((e,t)=>{function n(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof Array){let t=[];for(let r=0;r<e.length;r++)t[r]=n(e[r]);return t}if(typeof e==`object`){let t=Object.create(Object.getPrototypeOf(e));for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=n(e[r]));return t}return e}function r(e){let t=[],n=``,r=!1,i=!1,a=``;for(let o=0;o<e.length;o++){let s=e[o];!r&&s===`.`?n&&=(t.push(n),``):s===`[`?(n&&=(t.push(n),``),r=!0):s===`]`&&r?(t.push(n),n=``,r=!1,i=!1):(s===`"`||s===`'`)&&r?i?s===a?(i=!1,a=``):n+=s:(i=!0,a=s):n+=s}return n&&t.push(n),t}function i(e,t,n){let r=e;for(let e=0;e<t.length-1;e++){let n=t[e];if(typeof r!=`object`||!r||!(n in r)||typeof r[n]!=`object`||r[n]===null)return!1;r=r[n]}let i=t[t.length-1];if(i===`*`){if(Array.isArray(r))for(let e=0;e<r.length;e++)r[e]=n;else if(typeof r==`object`&&r)for(let e in r)Object.prototype.hasOwnProperty.call(r,e)&&(r[e]=n)}else typeof r==`object`&&r&&i in r&&Object.prototype.hasOwnProperty.call(r,i)&&(r[i]=n);return!0}function a(e,t){let n=e;for(let e=0;e<t.length-1;e++){let r=t[e];if(typeof n!=`object`||!n||!(r in n)||typeof n[r]!=`object`||n[r]===null)return!1;n=n[r]}let r=t[t.length-1];if(r===`*`){if(Array.isArray(n))for(let e=0;e<n.length;e++)n[e]=void 0;else if(typeof n==`object`&&n)for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&delete n[e]}else typeof n==`object`&&n&&r in n&&Object.prototype.hasOwnProperty.call(n,r)&&delete n[r];return!0}let o=Symbol(`PATH_NOT_FOUND`);function s(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||!n||!(e in n))return o;n=n[e]}return n}function c(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||!n)return;n=n[e]}return n}function l(e,t,n,c=!1){for(let l of t){let t=r(l);if(t.includes(`*`))u(e,t,n,l,c);else if(c)a(e,t);else{let r=s(e,t);if(r===o)continue;i(e,t,typeof n==`function`?n(r,t):n)}}}function u(e,t,n,r,i=!1){let a=t.indexOf(`*`);if(a===t.length-1){let r=t.slice(0,-1),a=e;for(let e of r){if(typeof a!=`object`||!a||!a)return;a=a[e]}if(Array.isArray(a)){if(i)for(let e=0;e<a.length;e++)a[e]=void 0;else for(let e=0;e<a.length;e++){let t=[...r,e.toString()],i=typeof n==`function`?n(a[e],t):n;a[e]=i}}else if(typeof a==`object`&&a){if(i){let e=[];for(let t in a)Object.prototype.hasOwnProperty.call(a,t)&&e.push(t);for(let t of e)delete a[t]}else for(let e in a){let t=[...r,e],i=typeof n==`function`?n(a[e],t):n;a[e]=i}}}else d(e,t,n,a,r,i)}function d(e,t,n,r,o,s=!1){let l=t.slice(0,r),d=t.slice(r+1),f=[];function p(e,t){if(t===l.length){if(Array.isArray(e))for(let n=0;n<e.length;n++)f[t]=n.toString(),p(e[n],t+1);else if(typeof e==`object`&&e)for(let n in e)f[t]=n,p(e[n],t+1)}else if(t<l.length){let n=l[t];e&&typeof e==`object`&&e&&n in e&&(f[t]=n,p(e[n],t+1))}else if(d.includes(`*`))u(e,d,typeof n==`function`?(e,r)=>n(e,[...f.slice(0,t),...r]):n,o,s);else if(s)a(e,d);else{let r=typeof n==`function`?n(c(e,d),[...f.slice(0,t),...d]):n;i(e,d,r)}}if(l.length===0)p(e,0);else{let t=e;for(let e=0;e<l.length;e++){let n=l[e];if(typeof t!=`object`||!t||!t)return;t=t[n],f[e]=n}t!=null&&p(t,l.length)}}function f(e){if(e.length===0)return null;let t=new Map;for(let n of e){let e=r(n),i=t;for(let t=0;t<e.length;t++){let n=e[t];i.has(n)||i.set(n,new Map),i=i.get(n)}}return t}function p(e,t){if(!t)return e;function n(e,t,r=0){if(!t||t.size===0||typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){let r=[];for(let i=0;i<e.length;i++){let a=i.toString();t.has(a)||t.has(`*`)?r[i]=n(e[i],t.get(a)||t.get(`*`)):r[i]=e[i]}return r}let i=Object.create(Object.getPrototypeOf(e));for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=t.has(r)||t.has(`*`)?n(e[r],t.get(r)||t.get(`*`)):e[r]);return i}return n(e,t)}function m(e){if(typeof e!=`string`)throw Error(`Paths must be (non-empty) strings`);if(e===``)throw Error(`Invalid redaction path ()`);if(e.includes(`..`)||e.includes(`,`))throw Error(`Invalid redaction path (${e})`);let t=0,n=!1,r=``;for(let i=0;i<e.length;i++){let a=e[i];if((a===`"`||a===`'`)&&t>0)n?a===r&&(n=!1,r=``):(n=!0,r=a);else if(a===`[`&&!n)t++;else if(a===`]`&&!n&&(t--,t<0))throw Error(`Invalid redaction path (${e})`)}if(t!==0)throw Error(`Invalid redaction path (${e})`)}function h(e){if(!Array.isArray(e))throw TypeError(`paths must be an array`);for(let t of e)m(t)}function g(e={}){let{paths:t=[],censor:r=`[REDACTED]`,serialize:i=JSON.stringify,strict:a=!0,remove:o=!1}=e;h(t);let s=f(t);return function(e){if(a&&(typeof e!=`object`||!e)&&(typeof e!=`object`||!e))return i?i(e):e;let c=p(e,s),u=e,d=r;return typeof r==`function`&&(d=r),l(c,t,d,o),i===!1?(c.restore=function(){return n(u)},c):typeof i==`function`?i(c):JSON.stringify(c)}}t.exports=g})),RX=jX(((e,t)=>{let n=Symbol(`pino.setLevel`),r=Symbol(`pino.getLevel`),i=Symbol(`pino.levelVal`),a=Symbol(`pino.levelComp`),o=Symbol(`pino.useLevelLabels`),s=Symbol(`pino.useOnlyCustomLevels`),c=Symbol(`pino.mixin`),l=Symbol(`pino.lsCache`),u=Symbol(`pino.chindings`),d=Symbol(`pino.asJson`),f=Symbol(`pino.write`),p=Symbol(`pino.redactFmt`),m=Symbol(`pino.time`),h=Symbol(`pino.timeSliceIndex`),g=Symbol(`pino.stream`),_=Symbol(`pino.stringify`),v=Symbol(`pino.stringifySafe`),y=Symbol(`pino.stringifiers`),b=Symbol(`pino.end`),x=Symbol(`pino.formatOpts`),S=Symbol(`pino.messageKey`),C=Symbol(`pino.errorKey`),w=Symbol(`pino.nestedKey`),T=Symbol(`pino.nestedKeyStr`),E=Symbol(`pino.mixinMergeStrategy`),D=Symbol(`pino.msgPrefix`),O=Symbol(`pino.wildcardFirst`),ee=Symbol.for(`pino.serializers`),te=Symbol.for(`pino.formatters`),ne=Symbol.for(`pino.hooks`);t.exports={setLevelSym:n,getLevelSym:r,levelValSym:i,levelCompSym:a,useLevelLabelsSym:o,mixinSym:c,lsCacheSym:l,chindingsSym:u,asJsonSym:d,writeSym:f,serializersSym:ee,redactFmtSym:p,timeSym:m,timeSliceIndexSym:h,streamSym:g,stringifySym:_,stringifySafeSym:v,stringifiersSym:y,endSym:b,formatOptsSym:x,messageKeySym:S,errorKeySym:C,nestedKeySym:w,wildcardFirstSym:O,needsMetadataGsym:Symbol.for(`pino.metadata`),useOnlyCustomLevelsSym:s,formattersSym:te,hooksSym:ne,nestedKeyStrSym:T,mixinMergeStrategySym:E,msgPrefixSym:D}})),zX=jX(((e,t)=>{let n=tye(),{redactFmtSym:r,wildcardFirstSym:i}=RX(),a=/[^.[\]]+|\[([^[\]]*?)\]/g,o=`[Redacted]`;function s(e,t){let{paths:o,censor:s,remove:l}=c(e),u=o.reduce((e,t)=>{a.lastIndex=0;let n=a.exec(t),r=a.exec(t),o=n[1]===void 0?n[0]:n[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,`$1`);if(o===`*`&&(o=i),r===null)return e[o]=null,e;if(e[o]===null)return e;let{index:s}=r,c=`${t.substr(s,t.length-1)}`;return e[o]=e[o]||[],o!==i&&e[o].length===0&&e[o].push(...e[i]||[]),o===i&&Object.keys(e).forEach(function(t){e[t]&&e[t].push(c)}),e[o].push(c),e},{}),d={[r]:n({paths:o,censor:s,serialize:t,strict:!1,remove:l})},f=(...e)=>t(typeof s==`function`?s(...e):s);return[...Object.keys(u),...Object.getOwnPropertySymbols(u)].reduce((e,r)=>{if(u[r]===null)e[r]=e=>f(e,[r]);else{let i=typeof s==`function`?(e,t)=>s(e,[r,...t]):s;e[r]=n({paths:u[r],censor:i,serialize:t,strict:!1,remove:l})}return e},d)}function c(e){if(Array.isArray(e))return e={paths:e,censor:o},e;let{paths:t,censor:n=o,remove:r}=e;if(Array.isArray(t)===!1)throw Error(`pino – redact must contain an array of strings`);return r===!0&&(n=void 0),{paths:t,censor:n,remove:r}}t.exports=s})),nye=jX(((e,t)=>{let n=()=>``,r=()=>`,"time":${Date.now()}`,i=()=>`,"time":${Math.round(Date.now()/1e3)}`,a=()=>`,"time":"${new Date(Date.now()).toISOString()}"`,o=1000000000n,s=BigInt(Date.now())*1000000n,c=process.hrtime.bigint();t.exports={nullTime:n,epochTime:r,unixTime:i,isoTime:a,isoTimeNano:()=>{let e=process.hrtime.bigint()-c,t=s+e,n=t/o,r=t%o,i=Number(n*1000n+r/1000000n),a=new Date(i);return`,"time":"${a.getUTCFullYear()}-${(a.getUTCMonth()+1).toString().padStart(2,`0`)}-${a.getUTCDate().toString().padStart(2,`0`)}T${a.getUTCHours().toString().padStart(2,`0`)}:${a.getUTCMinutes().toString().padStart(2,`0`)}:${a.getUTCSeconds().toString().padStart(2,`0`)}.${r.toString().padStart(9,`0`)}Z"`}}})),rye=jX(((e,t)=>{function n(e){try{return JSON.stringify(e)}catch{return`"[Circular]"`}}t.exports=r;function r(e,t,r){var i=r&&r.stringify||n,a=1;if(typeof e==`object`&&e){var o=t.length+a;if(o===1)return e;var s=Array(o);s[0]=i(e);for(var c=1;c<o;c++)s[c]=i(t[c]);return s.join(` `)}if(typeof e!=`string`)return e;var l=t.length;if(l===0)return e;for(var u=``,d=1-a,f=-1,p=e&&e.length||0,m=0;m<p;){if(e.charCodeAt(m)===37&&m+1<p){switch(f=f>-1?f:0,e.charCodeAt(m+1)){case 100:case 102:if(d>=l||t[d]==null)break;f<m&&(u+=e.slice(f,m)),u+=Number(t[d]),f=m+2,m++;break;case 105:if(d>=l||t[d]==null)break;f<m&&(u+=e.slice(f,m)),u+=Math.floor(Number(t[d])),f=m+2,m++;break;case 79:case 111:case 106:if(d>=l||t[d]===void 0)break;f<m&&(u+=e.slice(f,m));var h=typeof t[d];if(h===`string`){u+=`'`+t[d]+`'`,f=m+2,m++;break}if(h===`function`){u+=t[d].name||`<anonymous>`,f=m+2,m++;break}u+=i(t[d]),f=m+2,m++;break;case 115:if(d>=l)break;f<m&&(u+=e.slice(f,m)),u+=String(t[d]),f=m+2,m++;break;case 37:f<m&&(u+=e.slice(f,m)),u+=`%`,f=m+2,m++,d--}++d}++m}return f===-1?e:(f<p&&(u+=e.slice(f)),u)}})),BX=jX(((e,t)=>{if(typeof SharedArrayBuffer<`u`&&typeof Atomics<`u`){let e=new Int32Array(new SharedArrayBuffer(4));function n(t){if(!(t>0&&t<1/0))throw typeof t!=`number`&&typeof t!=`bigint`?TypeError(`sleep: ms must be a number`):RangeError(`sleep: ms must be a number that is greater than 0 but less than Infinity`);Atomics.wait(e,0,0,Number(t))}t.exports=n}else{function e(e){if(!(e>0&&e<1/0))throw typeof e!=`number`&&typeof e!=`bigint`?TypeError(`sleep: ms must be a number`):RangeError(`sleep: ms must be a number that is greater than 0 but less than Infinity`);let t=Date.now()+Number(e);for(;t>Date.now(););}t.exports=e}})),VX=jX(((e,t)=>{let n=NX(`fs`),r=NX(`events`),i=NX(`util`).inherits,a=NX(`path`),o=BX(),s=NX(`assert`),c=Buffer.allocUnsafe(0),l=`buffer`,u=`utf8`,[d,f]=(process.versions.node||`0.0`).split(`.`).map(Number),p=d>=22&&f>=7;function m(e,t){t._opening=!0,t._writing=!0,t._asyncDrainScheduled=!1;function r(n,r){if(n){t._reopening=!1,t._writing=!1,t._opening=!1,t.sync?process.nextTick(()=>{t.listenerCount(`error`)>0&&t.emit(`error`,n)}):t.emit(`error`,n);return}let i=t._reopening;t.fd=r,t.file=e,t._reopening=!1,t._opening=!1,t._writing=!1,t.sync?process.nextTick(()=>t.emit(`ready`)):t.emit(`ready`),!t.destroyed&&(!t._writing&&t._len>t.minLength||t._flushPending?t._actualWrite():i&&process.nextTick(()=>t.emit(`drain`)))}let i=t.append?`a`:`w`,o=t.mode;if(t.sync)try{t.mkdir&&n.mkdirSync(a.dirname(e),{recursive:!0}),r(null,n.openSync(e,i,o))}catch(e){throw r(e),e}else t.mkdir?n.mkdir(a.dirname(e),{recursive:!0},t=>{if(t)return r(t);n.open(e,i,o,r)}):n.open(e,i,o,r)}function h(e){if(!(this instanceof h))return new h(e);let{fd:t,dest:r,minLength:i,maxLength:a,maxWrite:s,periodicFlush:d,sync:f,append:p=!0,mkdir:v,retryEAGAIN:x,fsync:ee,contentMode:te,mode:ne}=e||{};t||=r,this._len=0,this.fd=-1,this._bufs=[],this._lens=[],this._writing=!1,this._ending=!1,this._reopening=!1,this._asyncDrainScheduled=!1,this._flushPending=!1,this._hwm=Math.max(i||0,16387),this.file=null,this.destroyed=!1,this.minLength=i||0,this.maxLength=a||0,this.maxWrite=s||16384,this._periodicFlush=d||0,this._periodicFlushTimer=void 0,this.sync=f||!1,this.writable=!0,this._fsync=ee||!1,this.append=p||!1,this.mode=ne,this.retryEAGAIN=x||(()=>!0),this.mkdir=v||!1;let re,ie;if(te===l)this._writingBuf=c,this.write=b,this.flush=C,this.flushSync=T,this._actualWrite=D,re=()=>n.writeSync(this.fd,this._writingBuf),ie=()=>n.write(this.fd,this._writingBuf,this.release);else if(te===void 0||te===u)this._writingBuf=``,this.write=y,this.flush=S,this.flushSync=w,this._actualWrite=E,re=()=>Buffer.isBuffer(this._writingBuf)?n.writeSync(this.fd,this._writingBuf):n.writeSync(this.fd,this._writingBuf,`utf8`),ie=()=>Buffer.isBuffer(this._writingBuf)?n.write(this.fd,this._writingBuf,this.release):n.write(this.fd,this._writingBuf,`utf8`,this.release);else throw Error(`SonicBoom supports "${u}" and "${l}", but passed ${te}`);if(typeof t==`number`)this.fd=t,process.nextTick(()=>this.emit(`ready`));else if(typeof t==`string`)m(t,this);else throw Error(`SonicBoom supports only file descriptors and files`);if(this.minLength>=this.maxWrite)throw Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);this.release=(e,t)=>{if(e){if((e.code===`EAGAIN`||e.code===`EBUSY`)&&this.retryEAGAIN(e,this._writingBuf.length,this._len-this._writingBuf.length)){if(this.sync)try{o(100),this.release(void 0,0)}catch(e){this.release(e)}else setTimeout(ie,100)}else this._writing=!1,this.emit(`error`,e);return}this.emit(`write`,t);let r=g(this._writingBuf,this._len,t);if(this._len=r.len,this._writingBuf=r.writingBuf,this._writingBuf.length){if(!this.sync){ie();return}try{do{let e=re(),t=g(this._writingBuf,this._len,e);this._len=t.len,this._writingBuf=t.writingBuf}while(this._writingBuf.length)}catch(e){this.release(e);return}}this._fsync&&n.fsyncSync(this.fd);let i=this._len;this._reopening?(this._writing=!1,this._reopening=!1,this.reopen()):i>this.minLength?this._actualWrite():this._ending?i>0?this._actualWrite():(this._writing=!1,O(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(_,this)):this.emit(`drain`))},this.on(`newListener`,function(e){e===`drain`&&(this._asyncDrainScheduled=!1)}),this._periodicFlush!==0&&(this._periodicFlushTimer=setInterval(()=>this.flush(null),this._periodicFlush),this._periodicFlushTimer.unref())}function g(e,t,n){return typeof e==`string`&&(e=Buffer.from(e)),t=Math.max(t-n,0),e=e.subarray(n),{writingBuf:e,len:t}}function _(e){e.listenerCount(`drain`)>0&&(e._asyncDrainScheduled=!1,e.emit(`drain`))}i(h,r);function v(e,t){return e.length===0?c:e.length===1?e[0]:Buffer.concat(e,t)}function y(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);e=``+e;let t=Buffer.byteLength(e),n=this._len+t,r=this._bufs;return this.maxLength&&n>this.maxLength?(this.emit(`drop`,e),this._len<this._hwm):(r.length===0||Buffer.byteLength(r[r.length-1])+t>this.maxWrite?r.push(e):r[r.length-1]+=e,this._len=n,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function b(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);let t=this._len+e.length,n=this._bufs,r=this._lens;return this.maxLength&&t>this.maxLength?(this.emit(`drop`,e),this._len<this._hwm):(n.length===0||r[r.length-1]+e.length>this.maxWrite?(n.push([e]),r.push(e.length)):(n[n.length-1].push(e),r[r.length-1]+=e.length),this._len=t,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function x(e){this._flushPending=!0;let t=()=>{if(this._fsync)this._flushPending=!1,e();else try{n.fsync(this.fd,t=>{this._flushPending=!1,e(t)})}catch(t){e(t)}this.off(`error`,r)},r=n=>{this._flushPending=!1,e(n),this.off(`drain`,t)};this.once(`drain`,t),this.once(`error`,r)}function S(e){if(e!=null&&typeof e!=`function`)throw Error(`flush cb must be a function`);if(this.destroyed){let t=Error(`SonicBoom destroyed`);if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&x.call(this,e),!this._writing&&(this._bufs.length===0&&this._bufs.push(``),this._actualWrite())}function C(e){if(e!=null&&typeof e!=`function`)throw Error(`flush cb must be a function`);if(this.destroyed){let t=Error(`SonicBoom destroyed`);if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&x.call(this,e),!this._writing&&(this._bufs.length===0&&(this._bufs.push([]),this._lens.push(0)),this._actualWrite())}h.prototype.reopen=function(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this._opening){this.once(`ready`,()=>{this.reopen(e)});return}if(this._ending)return;if(!this.file)throw Error(`Unable to reopen a file descriptor, you must pass a file to SonicBoom`);if(e&&(this.file=e),this._reopening=!0,this._writing)return;let t=this.fd;this.once(`ready`,()=>{t!==this.fd&&n.close(t,e=>{if(e)return this.emit(`error`,e)})}),m(this.file,this)},h.prototype.end=function(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this._opening){this.once(`ready`,()=>{this.end()});return}this._ending||(this._ending=!0,!this._writing&&(this._len>0&&this.fd>=0?this._actualWrite():O(this)))};function w(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this.fd<0)throw Error(`sonic boom is not ready yet`);!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift(this._writingBuf),this._writingBuf=``);let e=``;for(;this._bufs.length||e.length;){e.length<=0&&(e=this._bufs[0]);try{let t=Buffer.isBuffer(e)?n.writeSync(this.fd,e):n.writeSync(this.fd,e,`utf8`),r=g(e,this._len,t);e=r.writingBuf,this._len=r.len,e.length<=0&&this._bufs.shift()}catch(t){if((t.code===`EAGAIN`||t.code===`EBUSY`)&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;o(100)}}try{n.fsyncSync(this.fd)}catch{}}function T(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this.fd<0)throw Error(`sonic boom is not ready yet`);!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift([this._writingBuf]),this._writingBuf=c);let e=c;for(;this._bufs.length||e.length;){e.length<=0&&(e=v(this._bufs[0],this._lens[0]));try{let t=n.writeSync(this.fd,e);e=e.subarray(t),this._len=Math.max(this._len-t,0),e.length<=0&&(this._bufs.shift(),this._lens.shift())}catch(t){if((t.code===`EAGAIN`||t.code===`EBUSY`)&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;o(100)}}}h.prototype.destroy=function(){this.destroyed||O(this)};function E(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:this._bufs.shift()||``,this.sync)try{e(null,Buffer.isBuffer(this._writingBuf)?n.writeSync(this.fd,this._writingBuf):n.writeSync(this.fd,this._writingBuf,`utf8`))}catch(t){e(t)}else n.write(this.fd,this._writingBuf,e)}function D(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:v(this._bufs.shift(),this._lens.shift()),this.sync)try{e(null,n.writeSync(this.fd,this._writingBuf))}catch(t){e(t)}else p&&(this._writingBuf=Buffer.from(this._writingBuf)),n.write(this.fd,this._writingBuf,e)}function O(e){if(e.fd===-1){e.once(`ready`,O.bind(null,e));return}e._periodicFlushTimer!==void 0&&clearInterval(e._periodicFlushTimer),e.destroyed=!0,e._bufs=[],e._lens=[],s(typeof e.fd==`number`,`sonic.fd must be a number, got ${typeof e.fd}`);try{n.fsync(e.fd,t)}catch{}function t(){e.fd!==1&&e.fd!==2?n.close(e.fd,r):r()}function r(t){if(t){e.emit(`error`,t);return}e._ending&&!e._writing&&e.emit(`finish`),e.emit(`close`)}}h.SonicBoom=h,h.default=h,t.exports=h})),HX=jX(((e,t)=>{let n={exit:[],beforeExit:[]},r={exit:c,beforeExit:l},i;function a(){i===void 0&&(i=new FinalizationRegistry(d))}function o(e){n[e].length>0||process.on(e,r[e])}function s(e){n[e].length>0||(process.removeListener(e,r[e]),n.exit.length===0&&n.beforeExit.length===0&&(i=void 0))}function c(){u(`exit`)}function l(){u(`beforeExit`)}function u(e){for(let t of n[e]){let n=t.deref(),r=t.fn;n!==void 0&&r(n,e)}n[e]=[]}function d(e){for(let t of[`exit`,`beforeExit`]){let r=n[t].indexOf(e);n[t].splice(r,r+1),s(t)}}function f(e,t,r){if(t===void 0)throw Error(`the object can't be undefined`);o(e);let s=new WeakRef(t);s.fn=r,a(),i.register(t,s),n[e].push(s)}function p(e,t){f(`exit`,e,t)}function m(e,t){f(`beforeExit`,e,t)}function h(e){if(i!==void 0){i.unregister(e);for(let t of[`exit`,`beforeExit`])n[t]=n[t].filter(t=>{let n=t.deref();return n&&n!==e}),s(t)}}t.exports={register:p,registerBeforeExit:m,unregister:h}})),iye=jX(((e,t)=>{t.exports={name:`thread-stream`,version:`4.2.0`,description:`A streaming way to send data to a Node.js Worker Thread`,main:`index.js`,types:`index.d.ts`,engines:{node:`>=20`},dependencies:{"real-require":`^1.0.0`},devDependencies:{"@types/node":`^25.0.2`,"@yao-pkg/pkg":`^6.0.0`,borp:`^1.0.0`,desm:`^1.3.0`,eslint:`^9.39.1`,fastbench:`^1.0.1`,neostandard:`^0.13.0`,"pino-elasticsearch":`^9.0.0`,"sonic-boom":`^5.0.0`,"ts-node":`^10.8.0`,typescript:`~5.7.3`},scripts:{build:`tsc --noEmit`,lint:`eslint`,test:`npm run lint && npm run build && npm run transpile && borp --pattern "test/*.test.{js,mjs}"`,"test:ci":`npm run lint && npm run transpile && borp --pattern "test/*.test.{js,mjs}"`,"test:yarn":`npm run transpile && borp --pattern "test/*.test.js"`,transpile:`sh ./test/ts/transpile.sh`},repository:{type:`git`,url:`git+https://github.com/mcollina/thread-stream.git`},keywords:[`worker`,`thread`,`threads`,`stream`],author:`Matteo Collina <hello@matteocollina.com>`,license:`MIT`,bugs:{url:`https://github.com/mcollina/thread-stream/issues`},homepage:`https://github.com/mcollina/thread-stream#readme`}})),aye=jX(((e,t)=>{let n=1e4;function r(e,t,r,i,a){let o=i===1/0?1/0:Date.now()+i,s=()=>{let i=Atomics.load(e,t);if(i===r){a(null,`ok`);return}if(o!==1/0&&Date.now()>o){a(null,`timed-out`);return}let c=o===1/0?n:Math.min(n,Math.max(1,o-Date.now())),l=Atomics.waitAsync(e,t,i,c);l.async?l.value.then(s):setImmediate(s)};s()}function i(e,t,r,i,a){let o=i===1/0?1/0:Date.now()+i,s=()=>{if(Atomics.load(e,t)!==r){a(null,`ok`);return}if(o!==1/0&&Date.now()>o){a(null,`timed-out`);return}let i=o===1/0?n:Math.min(n,Math.max(1,o-Date.now())),c=Atomics.waitAsync(e,t,r,i);c.async?c.value.then(e=>{if(e===`ok`){a(null,`ok`);return}s()}):setImmediate(s)};s()}t.exports={wait:r,waitDiff:i}})),oye=jX(((e,t)=>{t.exports={WRITE_INDEX:4,READ_INDEX:8,SEQ_INDEX:2}})),sye=jX(((e,t)=>{let{version:n}=iye(),{EventEmitter:r}=NX(`events`),{Worker:i}=NX(`worker_threads`),{join:a}=NX(`path`),{pathToFileURL:o}=NX(`url`),{wait:s}=aye(),{WRITE_INDEX:c,READ_INDEX:l,SEQ_INDEX:u}=oye(),d=NX(`buffer`),f=NX(`assert`),p=Symbol(`kImpl`),m=d.constants.MAX_STRING_LENGTH;function h(){}function g(e,t){Atomics.add(e[p].state,u,1),t(),Atomics.add(e[p].state,u,1),Atomics.notify(e[p].state,u)}function _(e){g(e,()=>{Atomics.store(e[p].state,l,0),Atomics.store(e[p].state,c,0)})}var v=class{constructor(e){this._value=e}deref(){return this._value}},y=class{register(){}unregister(){}};let b=process.env.NODE_V8_COVERAGE?y:global.FinalizationRegistry||y,x=process.env.NODE_V8_COVERAGE?v:global.WeakRef||v,S=new b(e=>{e.exited||e.terminate()});function C(e,t){let{filename:r,workerData:s}=t,c=(`__bundlerPathsOverrides`in globalThis?globalThis.__bundlerPathsOverrides:{})[`thread-stream-worker`]||a(__dirname,`lib`,`worker.js`),l=new i(c,{...t.workerOpts,name:t.workerOpts?.name||`thread-stream`,trackUnmanagedFds:!1,workerData:{filename:r.indexOf(`file://`)===0?r:o(r).href,dataBuf:e[p].dataBuf,stateBuf:e[p].stateBuf,workerData:{$context:{threadStreamVersion:n},...s}}});return l.stream=new v(e),l.on(`message`,E),l.on(`exit`,D),S.register(e,l),l}function w(e){f(!e[p].sync),e[p].needDrain&&(e[p].needDrain=!1,e.emit(`drain`))}function T(e){for(;;){let t=Atomics.load(e[p].state,c),n=e[p].data.length-t;if(n>0){if(e[p].bufLen===0){e[p].flushing=!1,e[p].ending?se(e):e[p].needDrain&&process.nextTick(w,e);return}oe(e,n,h);continue}if(n===0){if(t===0&&e[p].bufLen===0)return;te(e,()=>{e.destroyed||(_(e),T(e))});return}ae(e,Error(`overwritten`));return}}function E(e){let t=this.stream.deref();if(t===void 0){this.exited=!0,this.terminate();return}if(e?.code!=null)switch(e.code){case`READY`:this.stream=new x(t),te(t,()=>{t[p].ready=!0,t.emit(`ready`)});break;case`ERROR`:ae(t,e.err);break;case`EVENT`:Array.isArray(e.args)?t.emit(e.name,...e.args):t.emit(e.name,e.args);break;case`FLUSHED`:{if(e.context!==`thread-stream`){ae(t,Error(`this should not happen: `+e.code));break}let n=t[p].flushCallbacks.get(e.id);n&&(t[p].flushCallbacks.delete(e.id),process.nextTick(n));break}case`WARNING`:process.emitWarning(e.err);break;default:ae(t,Error(`this should not happen: `+e.code))}}function D(e){let t=this.stream.deref();t!==void 0&&(S.unregister(t),t.worker.exited=!0,t.worker.off(`exit`,D),ae(t,e===0?null:Error(`the worker thread exited`)))}var O=class extends r{constructor(e={}){if(super(),e.bufferSize<4)throw Error(`bufferSize must at least fit a 4-byte utf-8 char`);this[p]={},this[p].stateBuf=new SharedArrayBuffer(128),this[p].state=new Int32Array(this[p].stateBuf),this[p].dataBuf=new SharedArrayBuffer(e.bufferSize||4194304),this[p].data=Buffer.from(this[p].dataBuf),this[p].sync=e.sync||!1,this[p].ending=!1,this[p].ended=!1,this[p].needDrain=!1,this[p].destroyed=!1,this[p].flushing=!1,this[p].ready=!1,this[p].finished=!1,this[p].errored=null,this[p].closed=!1,this[p].buf=[],this[p].bufHead=0,this[p].bufLen=0,this[p].flushCallbacks=new Map,this[p].nextFlushId=0,this.worker=C(this,e),this.on(`message`,(e,t)=>{this.worker.postMessage(e,t)})}write(e){let t=Buffer.isBuffer(e)?e:Buffer.from(e);if(this[p].destroyed)return ie(this,Error(`the worker has exited`)),!1;if(this[p].ending)return ie(this,Error(`the worker is ending`)),!1;if(this[p].flushing&&this[p].bufLen+t.length>=m)try{k(this),this[p].flushing=!0}catch(e){return ae(this,e),!1}if(this[p].buf.push(t),this[p].bufLen+=t.length,this[p].sync)try{return k(this),!0}catch(e){return ae(this,e),!1}return this[p].flushing||(this[p].flushing=!0,setImmediate(T,this)),this[p].needDrain=this[p].data.length-this[p].bufLen-Atomics.load(this[p].state,c)<=0,!this[p].needDrain}end(){this[p].destroyed||(this[p].ending=!0,se(this))}flush(e){e=typeof e==`function`?e:h,ee(this,t=>{if(t){process.nextTick(e,t);return}ne(this,e)})}flushSync(){this[p].destroyed||(k(this),ce(this))}unref(){this.worker.unref()}ref(){this.worker.ref()}get ready(){return this[p].ready}get destroyed(){return this[p].destroyed}get closed(){return this[p].closed}get writable(){return!this[p].destroyed&&!this[p].ending}get writableEnded(){return this[p].ending}get writableFinished(){return this[p].finished}get writableNeedDrain(){return this[p].needDrain}get writableObjectMode(){return!1}get writableErrored(){return this[p].errored}};function ee(e,t){if(e[p].destroyed){process.nextTick(t,Error(`the worker has exited`));return}if(!e[p].sync&&(e[p].flushing||e[p].bufLen>0)){setImmediate(ee,e,t);return}te(e,t)}function te(e,t){let n=Atomics.load(e[p].state,c);s(e[p].state,l,n,1/0,(n,r)=>{if(n){ae(e,n),t(n);return}if(r!==`ok`){te(e,t);return}t()})}function ne(e,t){if(e[p].destroyed){process.nextTick(t,Error(`the worker has exited`));return}if(!e[p].ready){let n=()=>{i(),ne(e,t)},r=()=>{i(),process.nextTick(t,Error(`the worker has exited`))},i=()=>{e.off(`ready`,n),e.off(`close`,r)};e.once(`ready`,n),e.once(`close`,r);return}let n=++e[p].nextFlushId;e[p].flushCallbacks.set(n,t);try{e.worker.postMessage({code:`FLUSH`,context:`thread-stream`,id:n})}catch(r){e[p].flushCallbacks.delete(n),ae(e,r),process.nextTick(t,r)}}function re(e,t){let n=e[p].flushCallbacks;if(n.size===0)return;let r=t||Error(`the worker has exited`);for(let e of n.values())process.nextTick(e,r);n.clear()}function ie(e,t){setImmediate(()=>{e.emit(`error`,t)})}function ae(e,t){e[p].destroyed||(e[p].destroyed=!0,re(e,t),t&&(e[p].errored=t,ie(e,t)),e.worker.exited?setImmediate(()=>{e[p].closed=!0,e.emit(`close`)}):e.worker.terminate().catch(()=>{}).then(()=>{e[p].closed=!0,e.emit(`close`)}))}function oe(e,t,n){let r=Atomics.load(e[p].state,c),i=t;for(;i>0&&e[p].bufLen!==0;){let t=e[p].bufHead,n=e[p].buf[t];if(n.length<=i){n.copy(e[p].data,r),r+=n.length,i-=n.length,e[p].bufLen-=n.length,e[p].bufHead=t+1,e[p].bufHead===e[p].buf.length?(e[p].buf.length=0,e[p].bufHead=0):e[p].bufHead>=1024&&e[p].bufHead*2>=e[p].buf.length&&(e[p].buf.splice(0,e[p].bufHead),e[p].bufHead=0);continue}n.copy(e[p].data,r,0,i),e[p].buf[t]=n.subarray(i),e[p].bufLen-=i,r+=i,i=0}return g(e,()=>{Atomics.store(e[p].state,c,r)}),n(),!0}function se(e){if(!(e[p].ended||!e[p].ending||e[p].flushing)){e[p].ended=!0;try{e.flushSync();let t=Atomics.load(e[p].state,l);g(e,()=>{Atomics.store(e[p].state,c,-1)});let n=0;for(;t!==-1;){if(Atomics.wait(e[p].state,l,t,1e3),t=Atomics.load(e[p].state,l),t===-2){ae(e,Error(`end() failed`));return}if(++n===10){ae(e,Error(`end() took too long (10s)`));return}}process.nextTick(()=>{e[p].finished=!0,e.emit(`finish`)})}catch(t){ae(e,t)}}}function k(e){let t=()=>{e[p].ending?se(e):e[p].needDrain&&process.nextTick(w,e)};for(e[p].flushing=!1;e[p].bufLen!==0;){let n=Atomics.load(e[p].state,c),r=e[p].data.length-n;if(r===0){ce(e),_(e);continue}if(r<0)throw Error(`overwritten`);oe(e,r,t)}}function ce(e){if(e[p].flushing)throw Error(`unable to flush while flushing`);let t=Atomics.load(e[p].state,c),n=0;for(;;){let r=Atomics.load(e[p].state,l);if(r===-2)throw Error(`_flushSync failed`);if(r!==t)Atomics.wait(e[p].state,l,r,1e3);else break;if(++n===10)throw Error(`_flushSync took too long (10s)`)}}t.exports=O})),UX=jX(((e,t)=>{let{createRequire:n}=NX(`module`),{existsSync:r}=NX(`node:fs`),i=LX(),{join:a,isAbsolute:o,sep:s}=NX(`node:path`),{fileURLToPath:c}=NX(`node:url`),l=BX(),u=HX(),d=sye();function f(e){u.register(e,v),u.registerBeforeExit(e,y),e.on(`close`,function(){u.unregister(e)})}function p(){let e=process.execArgv;for(let t=0;t<e.length;t++){let n=e[t];if(n===`--import`||n===`--require`||n===`-r`||n.startsWith(`--import=`)||n.startsWith(`--require=`)||n.startsWith(`-r=`))return!0}return!1}function m(e){let t=e.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g);if(!t)return e;let n=[],r=!1;for(let e=0;e<t.length;e++){let i=t[e];if(i===`--require`||i===`-r`||i===`--import`){let a=t[e+1];if(a&&h(a)){r=!0,e++;continue}n.push(i),a&&(n.push(a),e++);continue}if((i.startsWith(`--require=`)||i.startsWith(`-r=`)||i.startsWith(`--import=`))&&h(i.slice(i.indexOf(`=`)+1))){r=!0;continue}n.push(i)}return r?n.join(` `):e}function h(e){let t=g(e);if(!t)return!1;let n=t;if(n.startsWith(`file://`))try{n=c(n)}catch{return!1}return o(n)&&!r(n)}function g(e){let t=e[0],n=e[e.length-1];return t===`"`&&n===`"`||t===`'`&&n===`'`?e.slice(1,-1):e}function _(e,t,n,r,i){if(!n.execArgv&&p()&&NX.main===void 0&&(n={...n,execArgv:[]}),!n.env&&process.env.NODE_OPTIONS){let e=m(process.env.NODE_OPTIONS);e!==process.env.NODE_OPTIONS&&(n={...n,env:{...process.env,NODE_OPTIONS:e}})}n={...n,name:i};let a=new d({filename:e,workerData:t,workerOpts:n,sync:r});a.on(`ready`,o),a.on(`close`,function(){process.removeListener(`exit`,s)}),process.on(`exit`,s);function o(){process.removeListener(`exit`,s),a.unref(),n.autoEnd!==!1&&f(a)}function s(){a.closed||(a.flushSync(),l(100),a.end())}return a}function v(e){e.ref(),e.flushSync(),e.end(),e.once(`close`,function(){e.unref()})}function y(e){e.flushSync()}function b(e){let{pipeline:t,targets:r,levels:c,dedupe:l,worker:u={},caller:d=i(),sync:f=!1}=e,p={...e.options},m=typeof d==`string`?[d]:d,h=typeof globalThis==`object`&&Object.prototype.hasOwnProperty.call(globalThis,`__bundlerPathsOverrides`)&&globalThis.__bundlerPathsOverrides&&typeof globalThis.__bundlerPathsOverrides==`object`?globalThis.__bundlerPathsOverrides:Object.create(null),g=e.target;if(g&&r)throw Error(`only one of target or targets can be specified`);r?(g=h[`pino-worker`]||a(__dirname,`worker.js`),p.targets=r.filter(e=>e.target).map(e=>({...e,target:y(e.target)})),p.pipelines=r.filter(e=>e.pipeline).map(e=>e.pipeline.map(t=>({...t,level:e.level,target:y(t.target)})))):t&&(g=h[`pino-worker`]||a(__dirname,`worker.js`),p.pipelines=[t.map(e=>({...e,target:y(e.target)}))]),c&&(p.levels=c),l&&(p.dedupe=l),p.pinoWillSendConfig=!0;let v=r||t?`pino.transport`:g;return _(y(g),p,u,f,v);function y(e){if(e=h[e]||e,o(e)||e.indexOf(`file://`)===0)return e;if(e===`pino/file`)return a(__dirname,`..`,`file.js`);let t;for(let r of m)try{let i=r===`node:repl`?process.cwd()+s:r;t=n(i).resolve(e);break}catch{continue}if(!t)throw Error(`unable to determine transport target for "${e}"`);return t}}t.exports=b})),WX=jX(((e,t)=>{let n=NX(`node:diagnostics_channel`),r=rye(),{mapHttpRequest:i,mapHttpResponse:a}=IX(),o=VX(),s=HX(),{lsCacheSym:c,chindingsSym:l,writeSym:u,serializersSym:d,formatOptsSym:f,endSym:p,stringifiersSym:m,stringifySym:h,stringifySafeSym:g,wildcardFirstSym:_,nestedKeySym:v,formattersSym:y,messageKeySym:b,errorKeySym:x,nestedKeyStrSym:S,msgPrefixSym:C}=RX(),{isMainThread:w}=NX(`worker_threads`),T=UX(),[E]=process.versions.node.split(`.`).map(e=>Number(e)),D=n.tracingChannel(`pino_asJson`),O=E>=25?e=>JSON.stringify(e):ne;function ee(){}function te(e,t){if(!t)return n;return function(...r){t.call(this,r,n,e)};function n(t,...n){if(typeof t==`object`){let o=t;t!==null&&(t.method&&t.headers&&t.socket?t=i(t):typeof t.setHeader==`function`&&(t=a(t)));let s;o===null&&n.length===0?s=[null]:(o=n.shift(),s=n),typeof this[C]==`string`&&o!=null&&(o=this[C]+o),this[u](t,r(o,s,this[f]),e)}else{let i=t===void 0?n.shift():t;typeof this[C]==`string`&&i!=null&&(i=this[C]+i),this[u](null,r(i,n,this[f]),e)}}}function ne(e){let t=``,n=0,r=!1,i=255,a=e.length;if(a>100)return JSON.stringify(e);for(var o=0;o<a&&i>=32;o++)i=e.charCodeAt(o),(i===34||i===92)&&(t+=e.slice(n,o)+`\\`,n=o,r=!0);return r?t+=e.slice(n):t=e,i<32?JSON.stringify(e):`"`+t+`"`}function re(e,t,n,r){if(D.hasSubscribers===!1)return ie.call(this,e,t,n,r);let i={instance:this,arguments};return D.traceSync(ie,i,this,e,t,n,r)}function ie(e,t,n,r){let i=this[h],a=this[g],o=this[m],s=this[p],u=this[l],f=this[d],C=this[y],w=this[b],T=this[x],E=this[c][n]+r;E+=u;let D;C.log&&(e=C.log(e));let ee=o[_],te=``;for(let t in e)if(D=e[t],Object.prototype.hasOwnProperty.call(e,t)&&D!==void 0){f[t]?D=f[t](D):t===T&&f.err&&(D=f.err(D));let e=o[t]||ee;switch(typeof D){case`undefined`:case`function`:continue;case`number`:Number.isFinite(D)===!1&&(D=null);case`boolean`:e&&(D=e(D));break;case`string`:D=(e||O)(D);break;default:D=(e||i)(D,a)}if(D===void 0)continue;let n=O(t);te+=`,`+n+`:`+D}let ne=``;if(t!==void 0){D=f[w]?f[w](t):t;let e=o[w]||ee;switch(typeof D){case`function`:break;case`number`:Number.isFinite(D)===!1&&(D=null);case`boolean`:e&&(D=e(D)),ne=`,"`+w+`":`+D;break;case`string`:D=(e||O)(D),ne=`,"`+w+`":`+D;break;default:D=(e||i)(D,a),ne=`,"`+w+`":`+D}}return this[v]&&te?E+this[S]+te.slice(1)+`}`+ne+s:E+te+ne+s}function ae(e,t){let n,r=e[l],i=e[h],a=e[g],o=e[m],s=o[_],c=e[d],u=e[y].bindings;t=u(t);for(let e in t)if(n=t[e],((e.length<5||e!==`level`&&e!==`serializers`&&e!==`formatters`&&e!==`customLevels`)&&t.hasOwnProperty(e)&&n!==void 0)===!0){if(n=c[e]?c[e](n):n,n=(o[e]||s||i)(n,a),n===void 0)continue;r+=`,"`+e+`":`+n}return r}function oe(e){return e.write!==e.constructor.prototype.write}function se(e){let t=new o(e);return t.on(`error`,n),!e.sync&&w&&(s.register(t,k),t.on(`close`,function(){s.unregister(t)})),t;function n(e){if(e.code===`EPIPE`){t.write=ee,t.end=ee,t.flushSync=ee,t.destroy=ee;return}t.removeListener(`error`,n),t.emit(`error`,e)}}function k(e,t){e.destroyed||(t===`beforeExit`?(e.flush(),e.on(`drain`,function(){e.end()})):e.flushSync())}function ce(e){return function(t,n,r={},i){if(typeof r==`string`)i=se({dest:r}),r={};else if(typeof i==`string`){if(r&&r.transport)throw Error(`only one of option.transport or stream can be specified`);i=se({dest:i})}else if(r instanceof o||r.writable||r._writableState)i=r,r={};else if(r.transport){if(r.transport instanceof o||r.transport.writable||r.transport._writableState)throw Error(`option.transport do not allow stream, please pass to option directly. e.g. pino(transport)`);if(r.transport.targets&&r.transport.targets.length&&r.formatters&&typeof r.formatters.level==`function`)throw Error(`option.transport.targets do not allow custom level formatters`);let e;r.customLevels&&(e=r.useOnlyCustomLevels?r.customLevels:Object.assign({},r.levels,r.customLevels)),i=T({caller:n,...r.transport,levels:e})}if(r=Object.assign({},e,r),r.serializers=Object.assign({},e.serializers,r.serializers),r.formatters=Object.assign({},e.formatters,r.formatters),r.prettyPrint)throw Error(`prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)`);let{enabled:a,onChild:s}=r;return a===!1&&(r.level=`silent`),s||(r.onChild=ee),i||=oe(process.stdout)?process.stdout:se({fd:process.stdout.fd||1}),{opts:r,stream:i}}}function le(e,t){try{return JSON.stringify(e)}catch{try{return(t||this[g])(e)}catch{return`"[unable to serialize, circular reference is too complex to analyze]"`}}}function ue(e,t,n){return{level:e,bindings:t,log:n}}function A(e){let t=Number(e);return typeof e==`string`&&Number.isFinite(t)?t:e===void 0?1:e}t.exports={noop:ee,buildSafeSonicBoom:se,asChindings:ae,asJson:re,genLog:te,createArgsNormalizer:ce,stringify:le,buildFormatters:ue,normalizeDestFileDescriptor:A}})),GX=jX(((e,t)=>{t.exports={DEFAULT_LEVELS:{trace:10,debug:20,info:30,warn:40,error:50,fatal:60},SORTING_ORDER:{ASC:`ASC`,DESC:`DESC`}}})),KX=jX(((e,t)=>{let{lsCacheSym:n,levelValSym:r,useOnlyCustomLevelsSym:i,streamSym:a,formattersSym:o,hooksSym:s,levelCompSym:c}=RX(),{noop:l,genLog:u}=WX(),{DEFAULT_LEVELS:d,SORTING_ORDER:f}=GX(),p={fatal:e=>{let t=u(d.fatal,e);return function(...e){let n=this[a];if(t.call(this,...e),typeof n.flushSync==`function`)try{n.flushSync()}catch{}}},error:e=>u(d.error,e),warn:e=>u(d.warn,e),info:e=>u(d.info,e),debug:e=>u(d.debug,e),trace:e=>u(d.trace,e)},m=Object.keys(d).reduce((e,t)=>(e[d[t]]=t,e),{}),h=Object.keys(m).reduce((e,t)=>(e[t]=`{"level":`+Number(t),e),{});function g(e){let t=e[o].level,{labels:r}=e.levels,i={};for(let e in r){let n=t(r[e],Number(e));i[e]=JSON.stringify(n).slice(0,-1)}return e[n]=i,e}function _(e,t){if(t)return!1;switch(e){case`fatal`:case`error`:case`warn`:case`info`:case`debug`:case`trace`:return!0;default:return!1}}function v(e){let{labels:t,values:n}=this.levels;if(typeof e==`number`){if(t[e]===void 0)throw Error(`unknown level value`+e);e=t[e]}if(n[e]===void 0)throw Error(`unknown level `+e);let a=this[r],o=this[r]=n[e],d=this[i],f=this[c],m=this[s].logMethod;for(let e in n){if(f(n[e],o)===!1){this[e]=l;continue}this[e]=_(e,d)?p[e](m):u(n[e],m)}this.emit(`level-change`,e,o,t[a],a,this)}function y(e){let{levels:t,levelVal:n}=this;return t&&t.labels?t.labels[n]:``}function b(e){let{values:t}=this.levels,n=t[e];return n!==void 0&&this[c](n,this[r])}function x(e,t,n){return e===f.DESC?t<=n:t>=n}function S(e){return typeof e==`string`?x.bind(null,e):e}function C(e=null,t=!1){let n=e?Object.keys(e).reduce((t,n)=>(t[e[n]]=n,t),{}):null;return{labels:Object.assign(Object.create(Object.prototype,{Infinity:{value:`silent`}}),t?null:m,n),values:Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),t?null:d,e)}}function w(e,t,n){if(typeof e==`number`){if(![].concat(Object.keys(t||{}).map(e=>t[e]),n?[]:Object.keys(m).map(e=>+e),1/0).includes(e))throw Error(`default level:${e} must be included in custom levels`);return}if(!(e in Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),n?null:d,t)))throw Error(`default level:${e} must be included in custom levels`)}function T(e,t){let{labels:n,values:r}=e;for(let e in t){if(e in r)throw Error(`levels cannot be overridden`);if(t[e]in n)throw Error(`pre-existing level values cannot be used for new levels`)}}function E(e){if(typeof e!=`function`&&!(typeof e==`string`&&Object.values(f).includes(e)))throw Error(`Levels comparison should be one of "ASC", "DESC" or "function" type`)}t.exports={initialLsCache:h,genLsCache:g,levelMethods:p,getLevel:y,setLevel:v,isLevelEnabled:b,mappings:C,assertNoLevelCollisions:T,assertDefaultLevelFound:w,genLevelComparison:S,assertLevelComparison:E}})),qX=jX(((e,t)=>{t.exports={version:`10.3.1`}})),cye=jX(((e,t)=>{let{EventEmitter:n}=NX(`node:events`),{lsCacheSym:r,levelValSym:i,setLevelSym:a,getLevelSym:o,chindingsSym:s,mixinSym:c,asJsonSym:l,writeSym:u,mixinMergeStrategySym:d,timeSym:f,timeSliceIndexSym:p,streamSym:m,serializersSym:h,formattersSym:g,errorKeySym:_,messageKeySym:v,useOnlyCustomLevelsSym:y,needsMetadataGsym:b,redactFmtSym:x,stringifySym:S,formatOptsSym:C,stringifiersSym:w,msgPrefixSym:T,hooksSym:E}=RX(),{getLevel:D,setLevel:O,isLevelEnabled:ee,mappings:te,initialLsCache:ne,genLsCache:re,assertNoLevelCollisions:ie}=KX(),{asChindings:ae,asJson:oe,buildFormatters:se,stringify:k,noop:ce}=WX(),{version:le}=qX(),ue=zX(),A={constructor:class{},child:de,bindings:fe,setBindings:pe,flush:he,isLevelEnabled:ee,version:le,get level(){return this[o]()},set level(e){this[a](e)},get levelVal(){return this[i]},set levelVal(e){throw Error(`levelVal is read-only`)},get msgPrefix(){return this[T]},get[Symbol.toStringTag](){return`Pino`},[r]:ne,[u]:M,[l]:oe,[o]:D,[a]:O};Object.setPrototypeOf(A,n.prototype),t.exports=function(){return Object.create(A)};let j=e=>e;function de(e,t){if(!e)throw Error(`missing bindings for child Pino`);let n=this[h],r=this[g],i=Object.create(this);if(t==null)return i[g].bindings!==j&&(i[g]=se(r.level,j,r.log)),i[s]=ae(i,e),this.onChild!==ce&&this.onChild(i),i;if(t.hasOwnProperty(`serializers`)===!0){i[h]=Object.create(null);for(let e in n)i[h][e]=n[e];let e=Object.getOwnPropertySymbols(n);for(var o=0;o<e.length;o++){let t=e[o];i[h][t]=n[t]}for(let e in t.serializers)i[h][e]=t.serializers[e];let r=Object.getOwnPropertySymbols(t.serializers);for(var c=0;c<r.length;c++){let e=r[c];i[h][e]=t.serializers[e]}}else i[h]=n;if(t.hasOwnProperty(`formatters`)){let{level:e,bindings:n,log:a}=t.formatters;i[g]=se(e||r.level,n||j,a||r.log)}else i[g]=se(r.level,j,r.log);if(t.hasOwnProperty(`customLevels`)===!0&&(ie(this.levels,t.customLevels),i.levels=te(t.customLevels,i[y]),re(i)),typeof t.redact==`object`&&t.redact!==null||Array.isArray(t.redact)){i.redact=t.redact;let e=ue(i.redact,k),n={stringify:e[x]};i[S]=k,i[w]=e,i[C]=n}if(typeof t.msgPrefix==`string`&&(i[T]=(this[T]||``)+t.msgPrefix),i[s]=ae(i,e),t.level!==void 0&&t.level!==this.level||t.hasOwnProperty(`customLevels`)){let e=t.level||this.level;i[a](e)}return this.onChild(i),i}function fe(){let e=`{${this[s].substr(1)}}`,t=JSON.parse(e);return delete t.pid,delete t.hostname,t}function pe(e){let t=ae(this,e);this[s]=t}function me(e,t){return Object.assign(t,e)}function M(e,t,n){let r=this[f](),i=this[c],a=this[_],o=this[v],s=this[d]||me,u,h=this[E].streamWrite;e==null?u={}:e instanceof Error?(u={[a]:e},t===void 0&&(t=e.message)):(u=e,t===void 0&&e[o]===void 0&&e[a]&&(t=e[a].message)),i&&(u=s(u,i(u,n,this)));let g=this[l](u,t,n,r),y=this[m];y[b]===!0&&(y.lastLevel=n,y.lastObj=u,y.lastMsg=t,y.lastTime=r.slice(this[p]),y.lastLogger=this),y.write(h?h(g):g)}function he(e){if(e!=null&&typeof e!=`function`)throw Error(`callback must be a function`);let t=this[m];typeof t.flush==`function`?t.flush(e||ce):e&&e()}})),lye=jX(((e,t)=>{let{hasOwnProperty:n}=Object.prototype,r=_();r.configure=_,r.stringify=r,r.default=r,e.stringify=r,e.configure=_,t.exports=r;let i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function a(e){return e.length<5e3&&!i.test(e)?`"${e}"`:JSON.stringify(e)}function o(e,t){if(e.length>200||t)return e.sort(t);for(let t=1;t<e.length;t++){let n=e[t],r=t;for(;r!==0&&e[r-1]>n;)e[r]=e[r-1],r--;e[r]=n}return e}let s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function c(e){return s.call(e)!==void 0&&e.length!==0}function l(e,t,n){e.length<n&&(n=e.length);let r=t===`,`?``:` `,i=`"0":${r}${e[0]}`;for(let a=1;a<n;a++)i+=`${t}"${a}":${r}${e[a]}`;return i}function u(e){if(n.call(e,`circularValue`)){let t=e.circularValue;if(typeof t==`string`)return`"${t}"`;if(t==null)return t;if(t===Error||t===TypeError)return{toString(){throw TypeError(`Converting circular structure to JSON`)}};throw TypeError(`The "circularValue" argument must be of type string or the value null or undefined`)}return`"[Circular]"`}function d(e){let t;if(n.call(e,`deterministic`)&&(t=e.deterministic,typeof t!=`boolean`&&typeof t!=`function`))throw TypeError(`The "deterministic" argument must be of type boolean or comparator function`);return t===void 0||t}function f(e,t){let r;if(n.call(e,t)&&(r=e[t],typeof r!=`boolean`))throw TypeError(`The "${t}" argument must be of type boolean`);return r===void 0||r}function p(e,t){let r;if(n.call(e,t)){if(r=e[t],typeof r!=`number`)throw TypeError(`The "${t}" argument must be of type number`);if(!Number.isInteger(r))throw TypeError(`The "${t}" argument must be an integer`);if(r<1)throw RangeError(`The "${t}" argument must be >= 1`)}return r===void 0?1/0:r}function m(e){return e===1?`1 item`:`${e} items`}function h(e){let t=new Set;for(let n of e)(typeof n==`string`||typeof n==`number`)&&t.add(String(n));return t}function g(e){if(n.call(e,`strict`)){let t=e.strict;if(typeof t!=`boolean`)throw TypeError(`The "strict" argument must be of type boolean`);if(t)return e=>{let t=`Object can not safely be stringified. Received type ${typeof e}`;throw typeof e!=`function`&&(t+=` (${e.toString()})`),Error(t)}}}function _(e){e={...e};let t=g(e);t&&(e.bigint===void 0&&(e.bigint=!1),`circularValue`in e||(e.circularValue=Error));let n=u(e),r=f(e,`bigint`),i=d(e),s=typeof i==`function`?i:void 0,_=p(e,`maximumDepth`),v=p(e,`maximumBreadth`);function y(e,l,u,d,f,p){let h=l[e];switch(typeof h==`object`&&h&&typeof h.toJSON==`function`&&(h=h.toJSON(e)),h=d.call(l,e,h),typeof h){case`string`:return a(h);case`object`:{if(h===null)return`null`;if(u.indexOf(h)!==-1)return n;let e=``,t=`,`,r=p;if(Array.isArray(h)){if(h.length===0)return`[]`;if(_<u.length+1)return`"[Array]"`;u.push(h),f!==``&&(p+=f,e+=`\n${p}`,t=`,\n${p}`);let n=Math.min(h.length,v),i=0;for(;i<n-1;i++){let n=y(String(i),h,u,d,f,p);e+=n===void 0?`null`:n,e+=t}let a=y(String(i),h,u,d,f,p);if(e+=a===void 0?`null`:a,h.length-1>v){let n=h.length-v-1;e+=`${t}"... ${m(n)} not stringified"`}return f!==``&&(e+=`\n${r}`),u.pop(),`[${e}]`}let l=Object.keys(h),g=l.length;if(g===0)return`{}`;if(_<u.length+1)return`"[Object]"`;let b=``,x=``;f!==``&&(p+=f,t=`,\n${p}`,b=` `);let S=Math.min(g,v);i&&!c(h)&&(l=o(l,s)),u.push(h);for(let n=0;n<S;n++){let r=l[n],i=y(r,h,u,d,f,p);i!==void 0&&(e+=`${x}${a(r)}:${b}${i}`,x=t)}if(g>v){let n=g-v;e+=`${x}"...":${b}"${m(n)} not stringified"`,x=t}return f!==``&&x.length>1&&(e=`\n${p}${e}\n${r}`),u.pop(),`{${e}}`}case`number`:return isFinite(h)?String(h):t?t(h):`null`;case`boolean`:return h===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(h);default:return t?t(h):void 0}}function b(e,i,o,s,c,l){switch(typeof i==`object`&&i&&typeof i.toJSON==`function`&&(i=i.toJSON(e)),typeof i){case`string`:return a(i);case`object`:{if(i===null)return`null`;if(o.indexOf(i)!==-1)return n;let e=l,t=``,r=`,`;if(Array.isArray(i)){if(i.length===0)return`[]`;if(_<o.length+1)return`"[Array]"`;o.push(i),c!==``&&(l+=c,t+=`\n${l}`,r=`,\n${l}`);let n=Math.min(i.length,v),a=0;for(;a<n-1;a++){let e=b(String(a),i[a],o,s,c,l);t+=e===void 0?`null`:e,t+=r}let u=b(String(a),i[a],o,s,c,l);if(t+=u===void 0?`null`:u,i.length-1>v){let e=i.length-v-1;t+=`${r}"... ${m(e)} not stringified"`}return c!==``&&(t+=`\n${e}`),o.pop(),`[${t}]`}o.push(i);let u=``;c!==``&&(l+=c,r=`,\n${l}`,u=` `);let d=``;for(let e of s){let n=b(e,i[e],o,s,c,l);n!==void 0&&(t+=`${d}${a(e)}:${u}${n}`,d=r)}return c!==``&&d.length>1&&(t=`\n${l}${t}\n${e}`),o.pop(),`{${t}}`}case`number`:return isFinite(i)?String(i):t?t(i):`null`;case`boolean`:return i===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(i);default:return t?t(i):void 0}}function x(e,u,d,f,p){switch(typeof u){case`string`:return a(u);case`object`:{if(u===null)return`null`;if(typeof u.toJSON==`function`){if(u=u.toJSON(e),typeof u!=`object`)return x(e,u,d,f,p);if(u===null)return`null`}if(d.indexOf(u)!==-1)return n;let t=p;if(Array.isArray(u)){if(u.length===0)return`[]`;if(_<d.length+1)return`"[Array]"`;d.push(u),p+=f;let e=`\n${p}`,n=`,\n${p}`,r=Math.min(u.length,v),i=0;for(;i<r-1;i++){let t=x(String(i),u[i],d,f,p);e+=t===void 0?`null`:t,e+=n}let a=x(String(i),u[i],d,f,p);if(e+=a===void 0?`null`:a,u.length-1>v){let t=u.length-v-1;e+=`${n}"... ${m(t)} not stringified"`}return e+=`\n${t}`,d.pop(),`[${e}]`}let r=Object.keys(u),h=r.length;if(h===0)return`{}`;if(_<d.length+1)return`"[Object]"`;p+=f;let g=`,\n${p}`,y=``,b=``,S=Math.min(h,v);c(u)&&(y+=l(u,g,v),r=r.slice(u.length),S-=u.length,b=g),i&&(r=o(r,s)),d.push(u);for(let e=0;e<S;e++){let t=r[e],n=x(t,u[t],d,f,p);n!==void 0&&(y+=`${b}${a(t)}: ${n}`,b=g)}if(h>v){let e=h-v;y+=`${b}"...": "${m(e)} not stringified"`,b=g}return b!==``&&(y=`\n${p}${y}\n${t}`),d.pop(),`{${y}}`}case`number`:return isFinite(u)?String(u):t?t(u):`null`;case`boolean`:return u===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(u);default:return t?t(u):void 0}}function S(e,u,d){switch(typeof u){case`string`:return a(u);case`object`:{if(u===null)return`null`;if(typeof u.toJSON==`function`){if(u=u.toJSON(e),typeof u!=`object`)return S(e,u,d);if(u===null)return`null`}if(d.indexOf(u)!==-1)return n;let t=``,r=u.length!==void 0;if(r&&Array.isArray(u)){if(u.length===0)return`[]`;if(_<d.length+1)return`"[Array]"`;d.push(u);let e=Math.min(u.length,v),n=0;for(;n<e-1;n++){let e=S(String(n),u[n],d);t+=e===void 0?`null`:e,t+=`,`}let r=S(String(n),u[n],d);if(t+=r===void 0?`null`:r,u.length-1>v){let e=u.length-v-1;t+=`,"... ${m(e)} not stringified"`}return d.pop(),`[${t}]`}let f=Object.keys(u),p=f.length;if(p===0)return`{}`;if(_<d.length+1)return`"[Object]"`;let h=``,g=Math.min(p,v);r&&c(u)&&(t+=l(u,`,`,v),f=f.slice(u.length),g-=u.length,h=`,`),i&&(f=o(f,s)),d.push(u);for(let e=0;e<g;e++){let n=f[e],r=S(n,u[n],d);r!==void 0&&(t+=`${h}${a(n)}:${r}`,h=`,`)}if(p>v){let e=p-v;t+=`${h}"...":"${m(e)} not stringified"`}return d.pop(),`{${t}}`}case`number`:return isFinite(u)?String(u):t?t(u):`null`;case`boolean`:return u===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(u);default:return t?t(u):void 0}}function C(e,t,n){if(arguments.length>1){let r=``;if(typeof n==`number`?r=` `.repeat(Math.min(n,10)):typeof n==`string`&&(r=n.slice(0,10)),t!=null){if(typeof t==`function`)return y(``,{"":e},[],t,r,``);if(Array.isArray(t))return b(``,e,[],h(t),r,``)}if(r.length!==0)return x(``,e,[],r,``)}return S(``,e,[])}return C}})),uye=jX(((e,t)=>{let n=Symbol.for(`pino.metadata`),{DEFAULT_LEVELS:r}=GX(),i=r.info;function a(e,t){e||=[],t||={dedupe:!1};let a=Object.create(r);a.silent=1/0,t.levels&&typeof t.levels==`object`&&Object.keys(t.levels).forEach(e=>{a[e]=t.levels[e]});let u={write:d,add:m,remove:h,emit:f,flushSync:p,end:g,minLevel:0,lastId:0,streams:[],clone:_,[n]:!0,streamLevels:a};return Array.isArray(e)?e.forEach(m,u):m.call(u,e),e=null,u;function d(e){let r,i=this.lastLevel,{streams:a}=this,o=0,u;for(let d=s(a.length,t.dedupe);l(d,a.length,t.dedupe);d=c(d,t.dedupe))if(r=a[d],r.level<=i){if(o!==0&&o!==r.level)break;if(u=r.stream,u[n]){let{lastTime:e,lastMsg:t,lastObj:n,lastLogger:r}=this;u.lastLevel=i,u.lastTime=e,u.lastMsg=t,u.lastObj=n,u.lastLogger=r}u.write(e),t.dedupe&&(o=r.level)}else if(!t.dedupe)break}function f(...e){for(let{stream:t}of this.streams)typeof t.emit==`function`&&t.emit(...e)}function p(){for(let{stream:e}of this.streams)typeof e.flushSync==`function`&&e.flushSync()}function m(e){if(!e)return u;let t=typeof e.write==`function`||e.stream,n=e.write?e:e.stream;if(!t)throw Error(`stream object needs to implement either StreamEntry or DestinationStream interface`);let{streams:r,streamLevels:a}=this,s;s=typeof e.levelVal==`number`?e.levelVal:typeof e.level==`string`?a[e.level]:typeof e.level==`number`?e.level:i;let c={stream:n,level:s,levelVal:void 0,id:++u.lastId};return r.unshift(c),r.sort(o),this.minLevel=r[0].level,u}function h(e){let{streams:t}=this,n=t.findIndex(t=>t.id===e);return n>=0&&(t.splice(n,1),t.sort(o),this.minLevel=t.length>0?t[0].level:-1),u}function g(){for(let{stream:e}of this.streams)typeof e.flushSync==`function`&&e.flushSync(),e.end()}function _(e){let t=Array(this.streams.length);for(let n=0;n<t.length;n++)t[n]={level:e,stream:this.streams[n].stream};return{write:d,add:m,remove:h,minLevel:e,streams:t,clone:_,emit:f,flushSync:p,[n]:!0}}}function o(e,t){return e.level-t.level}function s(e,t){return t?e-1:0}function c(e,t){return t?e-1:e+1}function l(e,t,n){return n?e>=0:e<t}t.exports=a})),JX=jX(((e,t)=>{let n=NX(`node:os`),r=IX(),i=LX(),a=zX(),o=nye(),s=cye(),c=RX(),{configure:l}=lye(),{assertDefaultLevelFound:u,mappings:d,genLsCache:f,genLevelComparison:p,assertLevelComparison:m}=KX(),{DEFAULT_LEVELS:h,SORTING_ORDER:g}=GX(),{createArgsNormalizer:_,asChindings:v,buildSafeSonicBoom:y,buildFormatters:b,stringify:x,normalizeDestFileDescriptor:S,noop:C}=WX(),{version:w}=qX(),{chindingsSym:T,redactFmtSym:E,serializersSym:D,timeSym:O,timeSliceIndexSym:ee,streamSym:te,stringifySym:ne,stringifySafeSym:re,stringifiersSym:ie,setLevelSym:ae,endSym:oe,formatOptsSym:se,messageKeySym:k,errorKeySym:ce,nestedKeySym:le,mixinSym:ue,levelCompSym:A,useOnlyCustomLevelsSym:j,formattersSym:de,hooksSym:fe,nestedKeyStrSym:pe,mixinMergeStrategySym:me,msgPrefixSym:M}=c,{epochTime:he,nullTime:ge}=o,{pid:N}=process,_e=n.hostname(),ve=r.err,ye=_({level:`info`,levelComparison:g.ASC,levels:h,messageKey:`msg`,errorKey:`err`,nestedKey:null,enabled:!0,base:{pid:N,hostname:_e},serializers:Object.assign(Object.create(null),{err:ve}),formatters:Object.assign(Object.create(null),{bindings(e){return e},level(e,t){return{level:t}}}),hooks:{logMethod:void 0,streamWrite:void 0},timestamp:he,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100}),be=Object.assign(Object.create(null),r);function xe(...e){let t={},{opts:n,stream:r}=ye(t,i(),...e);n.level&&typeof n.level==`string`&&h[n.level.toLowerCase()]!==void 0&&(n.level=n.level.toLowerCase());let{redact:o,crlf:c,serializers:g,timestamp:_,messageKey:y,errorKey:S,nestedKey:w,base:N,name:_e,level:ve,customLevels:be,levelComparison:xe,mixin:Se,mixinMergeStrategy:Ce,useOnlyCustomLevels:we,formatters:Te,hooks:Ee,depthLimit:De,edgeLimit:Oe,onChild:ke,msgPrefix:Ae}=n,je=l({maximumDepth:De,maximumBreadth:Oe}),Me=b(Te.level,Te.bindings,Te.log),Ne=x.bind({[re]:je}),Pe=o?a(o,Ne):{},Fe=o?{stringify:Pe[E]}:{stringify:Ne},Ie=`}`+(c?`\r
|
|
707
709
|
`:`
|
|
708
|
-
`),Le=v.bind(null,{[T]:``,[D]:g,[ie]:Pe,[ne]:x,[re]:je,[de]:Me}),Re=``;N!==null&&(Re=Le(_e===void 0?N:Object.assign({},N,{name:_e})));let ze=_ instanceof Function?_:_?he:ge,Be=ze().indexOf(`:`)+1;if(we&&!be)throw Error(`customLevels is required if useOnlyCustomLevels is set true`);if(Se&&typeof Se!=`function`)throw Error(`Unknown mixin type "${typeof Se}" - expected "function"`);if(Ae&&typeof Ae!=`string`)throw Error(`Unknown msgPrefix type "${typeof Ae}" - expected "string"`);u(ve,be,we);let Ve=d(be,we);typeof r.emit==`function`&&r.emit(`message`,{code:`PINO_CONFIG`,config:{levels:Ve,messageKey:y,errorKey:S}}),m(xe);let He=p(xe);return Object.assign(t,{levels:Ve,[A]:He,[j]:we,[te]:r,[O]:ze,[ee]:Be,[ne]:x,[re]:je,[ie]:Pe,[oe]:Ie,[se]:Fe,[k]:y,[ce]:S,[le]:w,[pe]:w?`,${JSON.stringify(w)}:{`:``,[D]:g,[ue]:Se,[me]:Ce,[T]:Re,[de]:Me,[fe]:Ee,silent:C,onChild:ke,[M]:Ae}),Object.setPrototypeOf(t,s()),f(t),t[ae](ve),t}t.exports=xe,t.exports.destination=(e=process.stdout.fd)=>typeof e==`object`?(e.dest=S(e.dest||process.stdout.fd),y(e)):y({dest:S(e),minLength:0}),t.exports.transport=UX(),t.exports.multistream=lye(),t.exports.levels=d(),t.exports.stdSerializers=be,t.exports.stdTimeFunctions=Object.assign({},o),t.exports.symbols=c,t.exports.version=w,t.exports.default=xe,t.exports.pino=xe})),YX=jX((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=NX(`tty`);function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var r=n(t);let{env:i={},argv:a=[],platform:o=``}=typeof process>`u`?{}:process,s=`NO_COLOR`in i||a.includes(`--no-color`),c=`FORCE_COLOR`in i||a.includes(`--color`),l=o===`win32`,u=i.TERM===`dumb`,d=r&&r.isatty&&r.isatty(1)&&i.TERM&&!u,f=`CI`in i&&(`GITHUB_ACTIONS`in i||`GITLAB_CI`in i||`CIRCLECI`in i),p=!s&&(c||l&&!u||d||f),m=(e,t,n,r,i=t.substring(0,e)+r,a=t.substring(e+n.length),o=a.indexOf(n))=>i+(o<0?a:m(o,a,n,r)),h=(e,t,n,r,i)=>e<0?n+t+r:n+m(e,t,r,i)+r,g=(e,t,n=e,r=e.length+1)=>i=>i||i!==``&&i!==void 0?h((``+i).indexOf(t,r),i,e,t,n):``,_=(e,t,n)=>g(`\x1b[${e}m`,`\x1b[${t}m`,n),v={reset:_(0,0),bold:_(1,22,`\x1B[22m\x1B[1m`),dim:_(2,22,`\x1B[22m\x1B[2m`),italic:_(3,23),underline:_(4,24),inverse:_(7,27),hidden:_(8,28),strikethrough:_(9,29),black:_(30,39),red:_(31,39),green:_(32,39),yellow:_(33,39),blue:_(34,39),magenta:_(35,39),cyan:_(36,39),white:_(37,39),gray:_(90,39),bgBlack:_(40,49),bgRed:_(41,49),bgGreen:_(42,49),bgYellow:_(43,49),bgBlue:_(44,49),bgMagenta:_(45,49),bgCyan:_(46,49),bgWhite:_(47,49),blackBright:_(90,39),redBright:_(91,39),greenBright:_(92,39),yellowBright:_(93,39),blueBright:_(94,39),magentaBright:_(95,39),cyanBright:_(96,39),whiteBright:_(97,39),bgBlackBright:_(100,49),bgRedBright:_(101,49),bgGreenBright:_(102,49),bgYellowBright:_(103,49),bgBlueBright:_(104,49),bgMagentaBright:_(105,49),bgCyanBright:_(106,49),bgWhiteBright:_(107,49)},y=({useColor:e=p}={})=>e?v:Object.keys(v).reduce((e,t)=>({...e,[t]:String}),{}),{reset:b,bold:x,dim:S,italic:C,underline:w,inverse:T,hidden:E,strikethrough:D,black:O,red:ee,green:te,yellow:ne,blue:re,magenta:ie,cyan:ae,white:oe,gray:se,bgBlack:k,bgRed:ce,bgGreen:le,bgYellow:ue,bgBlue:A,bgMagenta:j,bgCyan:de,bgWhite:fe,blackBright:pe,redBright:me,greenBright:M,yellowBright:he,blueBright:ge,magentaBright:N,cyanBright:_e,whiteBright:ve,bgBlackBright:ye,bgRedBright:be,bgGreenBright:xe,bgYellowBright:Se,bgBlueBright:Ce,bgMagentaBright:we,bgCyanBright:Te,bgWhiteBright:Ee}=y();e.bgBlack=k,e.bgBlackBright=ye,e.bgBlue=A,e.bgBlueBright=Ce,e.bgCyan=de,e.bgCyanBright=Te,e.bgGreen=le,e.bgGreenBright=xe,e.bgMagenta=j,e.bgMagentaBright=we,e.bgRed=ce,e.bgRedBright=be,e.bgWhite=fe,e.bgWhiteBright=Ee,e.bgYellow=ue,e.bgYellowBright=Se,e.black=O,e.blackBright=pe,e.blue=re,e.blueBright=ge,e.bold=x,e.createColors=y,e.cyan=ae,e.cyanBright=_e,e.dim=S,e.gray=se,e.green=te,e.greenBright=M,e.hidden=E,e.inverse=T,e.isColorSupported=p,e.italic=C,e.magenta=ie,e.magentaBright=N,e.red=ee,e.redBright=me,e.reset=b,e.strikethrough=D,e.underline=w,e.white=oe,e.whiteBright=ve,e.yellow=ne,e.yellowBright=he})),uye=jX(((e,t)=>{t.exports=n;function n(e,t){if(e&&t)return n(e)(t);if(typeof e!=`function`)throw TypeError(`need wrapper function`);return Object.keys(e).forEach(function(t){r[t]=e[t]}),r;function r(){for(var t=Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];var r=e.apply(this,t),i=t[t.length-1];return typeof r==`function`&&r!==i&&Object.keys(i).forEach(function(e){r[e]=i[e]}),r}}})),XX=jX(((e,t)=>{var n=uye();t.exports=n(r),t.exports.strict=n(i),r.proto=r(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return r(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return i(this)},configurable:!0})});function r(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function i(e){var t=function(){if(t.called)throw Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)};return t.onceError=(e.name||"Function wrapped with `once`")+` shouldn't be called more than once`,t.called=!1,t}})),dye=jX(((e,t)=>{var n=XX(),r=function(){},i=global.Bare?queueMicrotask:process.nextTick.bind(process),a=function(e){return e.setHeader&&typeof e.abort==`function`},o=function(e){return e.stdio&&Array.isArray(e.stdio)&&e.stdio.length===3},s=function(e,t,c){if(typeof t==`function`)return s(e,null,t);t||={},c=n(c||r);var l=e._writableState,u=e._readableState,d=t.readable||t.readable!==!1&&e.readable,f=t.writable||t.writable!==!1&&e.writable,p=!1,m=function(){e.writable||h()},h=function(){f=!1,d||c.call(e)},g=function(){d=!1,f||c.call(e)},_=function(t){c.call(e,t?Error(`exited with error code: `+t):null)},v=function(t){c.call(e,t)},y=function(){i(b)},b=function(){if(!p&&(d&&!(u&&u.ended&&!u.destroyed)||f&&!(l&&l.ended&&!l.destroyed)))return c.call(e,Error(`premature close`))},x=function(){e.req.on(`finish`,h)};return a(e)?(e.on(`complete`,h),e.on(`abort`,y),e.req?x():e.on(`request`,x)):f&&!l&&(e.on(`end`,m),e.on(`close`,m)),o(e)&&e.on(`exit`,_),e.on(`end`,g),e.on(`finish`,h),t.error!==!1&&e.on(`error`,v),e.on(`close`,y),function(){p=!0,e.removeListener(`complete`,h),e.removeListener(`abort`,y),e.removeListener(`request`,x),e.req&&e.req.removeListener(`finish`,h),e.removeListener(`end`,m),e.removeListener(`close`,m),e.removeListener(`finish`,h),e.removeListener(`exit`,_),e.removeListener(`end`,g),e.removeListener(`error`,v),e.removeListener(`close`,y)}};t.exports=s})),fye=jX(((e,t)=>{var n=XX(),r=dye(),i;try{i=NX(`fs`)}catch{}var a=function(){},o=typeof process>`u`?!1:/^v?\.0/.test(process.version),s=function(e){return typeof e==`function`},c=function(e){return!o||!i?!1:(e instanceof(i.ReadStream||a)||e instanceof(i.WriteStream||a))&&s(e.close)},l=function(e){return e.setHeader&&s(e.abort)},u=function(e,t,i,o){o=n(o);var u=!1;e.on(`close`,function(){u=!0}),r(e,{readable:t,writable:i},function(e){if(e)return o(e);u=!0,o()});var d=!1;return function(t){if(!u&&!d){if(d=!0,c(e))return e.close(a);if(l(e))return e.abort();if(s(e.destroy))return e.destroy();o(t||Error(`stream was destroyed`))}}},d=function(e){e()},f=function(e,t){return e.pipe(t)};t.exports=function(){var e=Array.prototype.slice.call(arguments),t=s(e[e.length-1]||a)&&e.pop()||a;if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw Error(`pump requires two streams per minimum`);var n,r=e.map(function(i,a){var o=a<e.length-1;return u(i,o,a>0,function(e){n||=e,e&&r.forEach(d),!o&&(r.forEach(d),t(n))})});return e.reduce(f)}})),pye=jX(((e,t)=>{let{Transform:n}=NX(`stream`),{StringDecoder:r}=NX(`string_decoder`),i=Symbol(`last`),a=Symbol(`decoder`);function o(e,t,n){let r;if(this.overflow){if(r=this[a].write(e).split(this.matcher),r.length===1)return n();r.shift(),this.overflow=!1}else this[i]+=this[a].write(e),r=this[i].split(this.matcher);this[i]=r.pop();for(let e=0;e<r.length;e++)try{c(this,this.mapper(r[e]))}catch(e){return n(e)}if(this.overflow=this[i].length>this.maxLength,this.overflow&&!this.skipOverflow){n(Error(`maximum buffer reached`));return}n()}function s(e){if(this[i]+=this[a].end(),this[i])try{c(this,this.mapper(this[i]))}catch(t){return e(t)}e()}function c(e,t){t!==void 0&&e.push(t)}function l(e){return e}function u(e,t,c){switch(e||=/\r?\n/,t||=l,c||={},arguments.length){case 1:typeof e==`function`?(t=e,e=/\r?\n/):typeof e==`object`&&!(e instanceof RegExp)&&!e[Symbol.split]&&(c=e,e=/\r?\n/);break;case 2:typeof e==`function`?(c=t,t=e,e=/\r?\n/):typeof t==`object`&&(c=t,t=l)}c=Object.assign({},c),c.autoDestroy=!0,c.transform=o,c.flush=s,c.readableObjectMode=!0;let u=new n(c);return u[i]=``,u[a]=new r(`utf8`),u.matcher=e,u.mapper=t,u.maxLength=c.maxLength,u.skipOverflow=c.skipOverflow||!1,u.overflow=!1,u._destroy=function(e,t){this._writableState.errorEmitted=!1,t(e)},u}t.exports=u})),mye=jX(((e,t)=>{let n=Symbol.for(`pino.metadata`),r=pye(),{Duplex:i}=NX(`stream`),{parentPort:a,workerData:o}=NX(`worker_threads`);function s(){let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n}t.exports=function(e,t={}){let l=t.expectPinoConfig===!0&&o?.workerData?.pinoWillSendConfig===!0,u=t.parse===`lines`,d=typeof t.parseLine==`function`?t.parseLine:JSON.parse,f=t.close||c,p=r(function(e){let t;try{t=d(e)}catch(t){this.emit(`unknown`,e,t);return}if(t===null){this.emit(`unknown`,e,`Null value ignored`);return}return typeof t!=`object`&&(t={data:t,time:Date.now()}),p[n]&&(p.lastTime=t.time,p.lastLevel=t.level,p.lastObj=t),u?e:t},{autoDestroy:!0});if(p._destroy=function(e,t){let n=f(e,t);n&&typeof n.then==`function`&&n.then(t,t)},t.expectPinoConfig===!0&&o?.workerData?.pinoWillSendConfig!==!0&&setImmediate(()=>{p.emit(`error`,Error(`This transport is not compatible with the current version of pino. Please upgrade pino to the latest version.`))}),t.metadata!==!1&&(p[n]=!0,p.lastTime=0,p.lastLevel=0,p.lastObj=null),l){let e={},t=s();return a.on(`message`,function n(r){r.code===`PINO_CONFIG`&&(e=r.config,t.resolve(),a.off(`message`,n))}),Object.defineProperties(p,{levels:{get(){return e.levels}},messageKey:{get(){return e.messageKey}},errorKey:{get(){return e.errorKey}}}),t.then(m)}return m();function m(){let n=e(p);if(n&&typeof n.catch==`function`)n.catch(e=>{p.destroy(e)}),n=null;else if(t.enablePipelining&&n)return i.from({writable:p,readable:n});return p}};function c(e,t){process.nextTick(t,e)}})),ZX=jX(((e,t)=>{t.exports={DATE_FORMAT:`yyyy-mm-dd HH:MM:ss.l o`,DATE_FORMAT_SIMPLE:`HH:MM:ss.l`,ERROR_LIKE_KEYS:[`err`,`error`],MESSAGE_KEY:`msg`,LEVEL_KEY:`level`,LEVEL_LABEL:`levelLabel`,TIMESTAMP_KEY:`time`,LEVELS:{default:`USERLVL`,60:`FATAL`,50:`ERROR`,40:`WARN`,30:`INFO`,20:`DEBUG`,10:`TRACE`},LEVEL_NAMES:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},LOGGER_KEYS:[`pid`,`hostname`,`name`,`level`,`time`,`timestamp`,`caller`]}})),QX=jX(((e,t)=>{t.exports=i;let{LEVELS:n,LEVEL_NAMES:r}=ZX();function i(e,t,i){let a=e?t||n:Object.assign({},n,t),o=e?i||r:Object.assign({},r,i);return function(e){let t=`default`;return t=Number.isInteger(+e)?Object.prototype.hasOwnProperty.call(a,e)?e:t:Object.prototype.hasOwnProperty.call(o,e.toLowerCase())?o[e.toLowerCase()]:t,[a[t],t]}}})),$X=jX(((e,t)=>{let n=e=>e,r={default:n,60:n,50:n,40:n,30:n,20:n,10:n,message:n,greyMessage:n,property:n},{createColors:i}=YX(),a=QX(),o=i({useColor:!0}),{white:s,bgRed:c,red:l,yellow:u,green:d,blue:f,gray:p,cyan:m,magenta:h}=o,g={default:s,60:c,50:l,40:u,30:d,20:f,10:p,message:m,greyMessage:p,property:h};function _(e){return e.reduce(function(e,[t,n]){return e[t]=typeof o[n]==`function`?o[n]:s,e},{default:s,message:m,greyMessage:p,property:h})}function v(e){return function(t,n,{customLevels:r,customLevelNames:i}={}){let[o,s]=a(e,r,i)(t);return Object.prototype.hasOwnProperty.call(n,s)?n[s](o):n.default(o)}}function y(e){let t=v(e),n=function(e,n){return t(e,r,n)};return n.message=r.message,n.greyMessage=r.greyMessage,n.property=r.property,n.colors=i({useColor:!1}),n}function b(e){let t=v(e),n=function(e,n){return t(e,g,n)};return n.message=g.message,n.property=g.property,n.greyMessage=g.greyMessage,n.colors=o,n}function x(e,t){let n=_(e),r=t?n:Object.assign({},g,n),i=v(t),a=function(e,t){return i(e,r,t)};return a.colors=o,a.message=a.message||r.message,a.property=a.property||r.property,a.greyMessage=a.greyMessage||r.greyMessage,a}t.exports=function(e=!1,t,n){return e&&t!==void 0?x(t,n):e?b(n):y(n)}})),eZ=jX(((e,t)=>{t.exports=function(){}})),hye=jX(((e,t)=>{t.exports=a;let{isMainThread:n}=NX(`node:worker_threads`),r=VX(),i=eZ();function a(e){let t=new r(e);return t.on(`error`,a),!e.sync&&n&&o(t),t;function a(e){if(e.code===`EPIPE`){t.write=i,t.end=i,t.flushSync=i,t.destroy=i;return}t.removeListener(`error`,a)}}function o(e){if(global.WeakRef&&global.WeakMap&&global.FinalizationRegistry){let t=HX();t.register(e,s),e.on(`close`,function(){t.unregister(e)})}}function s(e,t){e.destroyed||(t===`beforeExit`?(e.flush(),e.on(`drain`,function(){e.end()})):e.flushSync())}})),tZ=jX(((e,t)=>{t.exports=n;function n(e){return e instanceof Date&&!Number.isNaN(e.getTime())}})),nZ=jX(((e,t)=>{t.exports=r;let n=tZ();function r(e){let t=new Date(e);return n(t)||(t=new Date(+e)),t}})),rZ=jX(((e,t)=>{t.exports=n;function n(e){let t=[],n=!1,r=``;for(let i=0;i<e.length;i++){let a=e.charAt(i);if(a===`\\`){n=!0;continue}if(n){n=!1,r+=a;continue}if(a===`.`){t.push(r),r=``;continue}r+=a}return r.length&&t.push(r),t}})),iZ=jX(((e,t)=>{t.exports=r;let n=rZ();function r(e,t){let r=Array.isArray(t)?t:n(t);for(let t of r){if(!Object.prototype.hasOwnProperty.call(e,t))return;e=e[t]}return e}})),aZ=jX(((e,t)=>{t.exports=i;let n=iZ(),r=rZ();function i(e,t){let i=r(t),a=i.pop();e=n(e,i),typeof e==`object`&&e&&Object.prototype.hasOwnProperty.call(e,a)&&delete e[a]}})),gye=jX((e=>{let t=Function.prototype.toString,n=Object.prototype.toString;function r(e){if(!e)return Object.create(null);let n=e.constructor;if(n===Object)return e===Object.prototype?{}:Object.create(e);if(n&&~t.call(n).indexOf(`[native code]`))try{return new n}catch{}return Object.create(e)}function i(e){let t=e[Symbol.toStringTag];if(t)return t;let r=n.call(e);return r.substring(8,r.length-1)}let{propertyIsEnumerable:a}=Object.prototype;function o(e,t,n,r){let i=Object.getOwnPropertyDescriptor(e,n)||{configurable:!0,enumerable:!0,value:e[n],writable:!0},a=i.get||i.set?i:{configurable:i.configurable,enumerable:i.enumerable,value:r.copier(i.value,r),writable:i.writable};try{Object.defineProperty(t,n,a)}catch{t[n]=a.get?a.get():a.value}}function s(e,t,n){for(let r of Object.getOwnPropertyNames(e))o(e,t,r,n);for(let r of Object.getOwnPropertySymbols(e))o(e,t,r,n);return t}function c(e,t){let n=new t.Constructor;t.cache.set(e,n);for(let r=0;r<e.length;++r)n[r]=t.copier(e[r],t);return n}function l(e,t){let n=new t.Constructor;return t.cache.set(e,n),s(e,n,t)}function u(e,t){return e.slice(0)}function d(e,t){return e.slice(0,e.size,e.type)}function f(e,t){return new t.Constructor(u(e.buffer))}function p(e,t){return new t.Constructor(e.getTime())}function m(e,t){let n=new t.Constructor;t.cache.set(e,n);for(let[r,i]of e)n.set(r,t.copier(i,t));return n}function h(e,t){return s(e,m(e,t),t)}function g(e,t){let n=r(t.prototype);t.cache.set(e,n);for(let r of Object.keys(e))n[r]=t.copier(e[r],t);for(let r of Object.getOwnPropertySymbols(e))a.call(e,r)&&(n[r]=t.copier(e[r],t));return n}function _(e,t){let n=r(t.prototype);return t.cache.set(e,n),s(e,n,t)}function v(e,t){return new t.Constructor(e.valueOf())}function y(e,t){let n=new t.Constructor(e.source,e.flags);return n.lastIndex=e.lastIndex,n}function b(e,t){return e}function x(e,t){let n=new t.Constructor;t.cache.set(e,n);for(let r of e)n.add(t.copier(r,t));return n}function S(e,t){return s(e,x(e,t),t)}function C(){return new WeakMap}function w({createCache:e,methods:t,strict:n}){let r={array:n?l:c,arrayBuffer:u,asyncGenerator:b,blob:d,dataView:f,date:p,error:b,generator:b,map:n?h:m,object:n?_:g,regExp:y,set:n?S:x},i=t?Object.assign(r,t):r,a=T(i),o=e||C;if(!a.Object||!a.Array)throw Error(`An object and array copier must be provided.`);return{createCache:o,copiers:a,methods:i,strict:!!n}}function T(e){return{Arguments:e.object,Array:e.array,ArrayBuffer:e.arrayBuffer,AsyncGenerator:e.asyncGenerator,BigInt64Array:e.arrayBuffer,BigUint64Array:e.arrayBuffer,Blob:e.blob,Boolean:v,DataView:e.dataView,Date:e.date,Error:e.error,Float32Array:e.arrayBuffer,Float64Array:e.arrayBuffer,Generator:e.generator,Int8Array:e.arrayBuffer,Int16Array:e.arrayBuffer,Int32Array:e.arrayBuffer,Map:e.map,Number:v,Object:e.object,Promise:b,RegExp:e.regExp,Set:e.set,String:v,WeakMap:b,WeakSet:b,Uint8Array:e.arrayBuffer,Uint8ClampedArray:e.arrayBuffer,Uint16Array:e.arrayBuffer,Uint32Array:e.arrayBuffer}}function E(e={}){let{createCache:t,copiers:n}=w(e),{Array:r,Object:a}=n;function o(e,t){if(t.prototype=t.Constructor=void 0,!e||typeof e!=`object`)return e;if(t.cache.has(e))return t.cache.get(e);if(t.prototype=Object.getPrototypeOf(e),t.Constructor=t.prototype&&t.prototype.constructor,!t.Constructor||t.Constructor===Object)return a(e,t);if(Array.isArray(e))return r(e,t);let o=n[i(e)];return o?o(e,t):typeof e.then==`function`?e:a(e,t)}return function(e){return o(e,{Constructor:void 0,cache:t(),copier:o,prototype:void 0})}}let D=E({strict:!0});e.copy=E(),e.copyStrict=D,e.createCopier=E})),oZ=jX(((e,t)=>{t.exports=a;let{createCopier:n}=gye(),r=n({}),i=aZ();function a({log:e,context:t}){let{ignoreKeys:n,includeKeys:a}=t,o=r(e);if(a){let e={};return a.forEach(t=>{e[t]=o[t]}),e}return n.forEach(e=>{i(o,e)}),o}})),_ye=jX(((e,t)=>{function n(e){"@babel/helpers - typeof";return n=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},n(e)}(function(r){var i=arguments,a=function(){var e=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,t=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,n=/[^-+\dA-Z]/g;return function(r,d,f,p){if(i.length===1&&u(r)===`string`&&!/\d/.test(r)&&(d=r,r=void 0),r=r||r===0?r:new Date,r instanceof Date||(r=new Date(r)),isNaN(r))throw TypeError(`Invalid date`);d=String(a.masks[d]||d||a.masks.default);var m=d.slice(0,4);(m===`UTC:`||m===`GMT:`)&&(d=d.slice(4),f=!0,m===`GMT:`&&(p=!0));var h=function(){return f?`getUTC`:`get`},g=function(){return r[h()+`Date`]()},_=function(){return r[h()+`Day`]()},v=function(){return r[h()+`Month`]()},y=function(){return r[h()+`FullYear`]()},b=function(){return r[h()+`Hours`]()},x=function(){return r[h()+`Minutes`]()},S=function(){return r[h()+`Seconds`]()},C=function(){return r[h()+`Milliseconds`]()},w=function(){return f?0:r.getTimezoneOffset()},T=function(){return c(r)},E=function(){return l(r)},D={d:function(){return g()},dd:function(){return o(g())},ddd:function(){return a.i18n.dayNames[_()]},DDD:function(){return s({y:y(),m:v(),d:g(),_:h(),dayName:a.i18n.dayNames[_()],short:!0})},dddd:function(){return a.i18n.dayNames[_()+7]},DDDD:function(){return s({y:y(),m:v(),d:g(),_:h(),dayName:a.i18n.dayNames[_()+7]})},m:function(){return v()+1},mm:function(){return o(v()+1)},mmm:function(){return a.i18n.monthNames[v()]},mmmm:function(){return a.i18n.monthNames[v()+12]},yy:function(){return String(y()).slice(2)},yyyy:function(){return o(y(),4)},h:function(){return b()%12||12},hh:function(){return o(b()%12||12)},H:function(){return b()},HH:function(){return o(b())},M:function(){return x()},MM:function(){return o(x())},s:function(){return S()},ss:function(){return o(S())},l:function(){return o(C(),3)},L:function(){return o(Math.floor(C()/10))},t:function(){return b()<12?a.i18n.timeNames[0]:a.i18n.timeNames[1]},tt:function(){return b()<12?a.i18n.timeNames[2]:a.i18n.timeNames[3]},T:function(){return b()<12?a.i18n.timeNames[4]:a.i18n.timeNames[5]},TT:function(){return b()<12?a.i18n.timeNames[6]:a.i18n.timeNames[7]},Z:function(){return p?`GMT`:f?`UTC`:(String(r).match(t)||[``]).pop().replace(n,``).replace(/GMT\+0000/g,`UTC`)},o:function(){return(w()>0?`-`:`+`)+o(Math.floor(Math.abs(w())/60)*100+Math.abs(w())%60,4)},p:function(){return(w()>0?`-`:`+`)+o(Math.floor(Math.abs(w())/60),2)+`:`+o(Math.floor(Math.abs(w())%60),2)},S:function(){return[`th`,`st`,`nd`,`rd`][g()%10>3?0:(g()%100-g()%10!=10)*g()%10]},W:function(){return T()},WW:function(){return o(T())},N:function(){return E()}};return d.replace(e,function(e){return e in D?D[e]():e.slice(1,e.length-1)})}}();a.masks={default:`ddd mmm dd yyyy HH:MM:ss`,shortDate:`m/d/yy`,paddedShortDate:`mm/dd/yyyy`,mediumDate:`mmm d, yyyy`,longDate:`mmmm d, yyyy`,fullDate:`dddd, mmmm d, yyyy`,shortTime:`h:MM TT`,mediumTime:`h:MM:ss TT`,longTime:`h:MM:ss TT Z`,isoDate:`yyyy-mm-dd`,isoTime:`HH:MM:ss`,isoDateTime:`yyyy-mm-dd'T'HH:MM:sso`,isoUtcDateTime:`UTC:yyyy-mm-dd'T'HH:MM:ss'Z'`,expiresHeaderFormat:`ddd, dd mmm yyyy HH:MM:ss Z`},a.i18n={dayNames:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],monthNames:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`,`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],timeNames:[`a`,`p`,`am`,`pm`,`A`,`P`,`AM`,`PM`]};var o=function(e,t){for(e=String(e),t||=2;e.length<t;)e=`0`+e;return e},s=function(e){var t=e.y,n=e.m,r=e.d,i=e._,a=e.dayName,o=e.short,s=o!==void 0&&o,c=new Date,l=new Date;l.setDate(l[i+`Date`]()-1);var u=new Date;return u.setDate(u[i+`Date`]()+1),function(){return c[i+`FullYear`]()}()===t&&function(){return c[i+`Month`]()}()===n&&function(){return c[i+`Date`]()}()===r?s?`Tdy`:`Today`:function(){return l[i+`FullYear`]()}()===t&&function(){return l[i+`Month`]()}()===n&&function(){return l[i+`Date`]()}()===r?s?`Ysd`:`Yesterday`:function(){return u[i+`FullYear`]()}()===t&&function(){return u[i+`Month`]()}()===n&&function(){return u[i+`Date`]()}()===r?s?`Tmw`:`Tomorrow`:a},c=function(e){var t=new Date(e.getFullYear(),e.getMonth(),e.getDate());t.setDate(t.getDate()-(t.getDay()+6)%7+3);var n=new Date(t.getFullYear(),0,4);n.setDate(n.getDate()-(n.getDay()+6)%7+3);var r=t.getTimezoneOffset()-n.getTimezoneOffset();t.setHours(t.getHours()-r);var i=(t-n)/6048e5;return 1+Math.floor(i)},l=function(e){var t=e.getDay();return t===0&&(t=7),t},u=function(e){return e===null?`null`:e===void 0?`undefined`:n(e)===`object`?Array.isArray(e)?`array`:{}.toString.call(e).slice(8,-1).toLowerCase():n(e)};typeof define==`function`&&define.amd?define(function(){return a}):(e===void 0?`undefined`:n(e))===`object`?t.exports=a:r.dateFormat=a})(void 0)})),sZ=jX(((e,t)=>{t.exports=s;let{DATE_FORMAT:n,DATE_FORMAT_SIMPLE:r}=ZX(),i=_ye(),a=nZ(),o=tZ();function s(e,t=!1){if(t===!1)return e;let s=a(e);if(!o(s))return e;if(t===!0)return i(s,r);let c=t.toUpperCase();if(c===`SYS:STANDARD`)return i(s,n);let l=c.substr(0,4);return l===`SYS:`||l===`UTC:`?l===`UTC:`?i(s,t):i(s,t.slice(4)):i(s,`UTC:${t}`)}})),cZ=jX(((e,t)=>{t.exports=n;function n(e){return e?typeof e==`string`?e.split(`,`).reduce((e,t,n)=>{let[r,i=n]=t.split(`:`);return e[r.toLowerCase()]=i,e},{}):Object.prototype.toString.call(e)===`[object Object]`?Object.keys(e).reduce((t,n)=>(t[n.toLowerCase()]=e[n],t),{}):{}:{}}})),lZ=jX(((e,t)=>{t.exports=n;function n(e){return e?typeof e==`string`?e.split(`,`).reduce((e,t,n)=>{let[r,i=n]=t.split(`:`);return e[i]=r.toUpperCase(),e},{default:`USERLVL`}):Object.prototype.toString.call(e)===`[object Object]`?Object.keys(e).reduce((t,n)=>(t[e[n]]=n.toUpperCase(),t),{default:`USERLVL`}):{}:{}}})),uZ=jX(((e,t)=>{t.exports=r;let n=iZ();function r(e,t){return e=e.replace(/{if (.*?)}(.*?){end}/g,r),e=e.replace(/{if (.*?)}/g,``),e=e.replace(/{end}/g,``),e.replace(/\s+/g,` `).trim();function r(e,r,i){let a=n(t,r);return a&&i.includes(r)?i.replace(RegExp(`{`+r+`}`,`g`),a):``}}})),dZ=jX(((e,t)=>{t.exports=n;function n(e){return Object.prototype.toString.apply(e)===`[object Object]`}})),fZ=jX(((e,t)=>{t.exports=n;function n({input:e,ident:t=` `,eol:n=`
|
|
709
|
-
`}){let r=e.split(/\r?\n/);for(let e=1;e<r.length;e+=1)r[e]=t+r[e];return r.join(n)}})),
|
|
710
|
+
`),Le=v.bind(null,{[T]:``,[D]:g,[ie]:Pe,[ne]:x,[re]:je,[de]:Me}),Re=``;N!==null&&(Re=Le(_e===void 0?N:Object.assign({},N,{name:_e})));let ze=_ instanceof Function?_:_?he:ge,Be=ze().indexOf(`:`)+1;if(we&&!be)throw Error(`customLevels is required if useOnlyCustomLevels is set true`);if(Se&&typeof Se!=`function`)throw Error(`Unknown mixin type "${typeof Se}" - expected "function"`);if(Ae&&typeof Ae!=`string`)throw Error(`Unknown msgPrefix type "${typeof Ae}" - expected "string"`);u(ve,be,we);let Ve=d(be,we);typeof r.emit==`function`&&r.emit(`message`,{code:`PINO_CONFIG`,config:{levels:Ve,messageKey:y,errorKey:S}}),m(xe);let He=p(xe);return Object.assign(t,{levels:Ve,[A]:He,[j]:we,[te]:r,[O]:ze,[ee]:Be,[ne]:x,[re]:je,[ie]:Pe,[oe]:Ie,[se]:Fe,[k]:y,[ce]:S,[le]:w,[pe]:w?`,${JSON.stringify(w)}:{`:``,[D]:g,[ue]:Se,[me]:Ce,[T]:Re,[de]:Me,[fe]:Ee,silent:C,onChild:ke,[M]:Ae}),Object.setPrototypeOf(t,s()),f(t),t[ae](ve),t}t.exports=xe,t.exports.destination=(e=process.stdout.fd)=>typeof e==`object`?(e.dest=S(e.dest||process.stdout.fd),y(e)):y({dest:S(e),minLength:0}),t.exports.transport=UX(),t.exports.multistream=uye(),t.exports.levels=d(),t.exports.stdSerializers=be,t.exports.stdTimeFunctions=Object.assign({},o),t.exports.symbols=c,t.exports.version=w,t.exports.default=xe,t.exports.pino=xe})),YX=jX((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=NX(`tty`);function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var r=n(t);let{env:i={},argv:a=[],platform:o=``}=typeof process>`u`?{}:process,s=`NO_COLOR`in i||a.includes(`--no-color`),c=`FORCE_COLOR`in i||a.includes(`--color`),l=o===`win32`,u=i.TERM===`dumb`,d=r&&r.isatty&&r.isatty(1)&&i.TERM&&!u,f=`CI`in i&&(`GITHUB_ACTIONS`in i||`GITLAB_CI`in i||`CIRCLECI`in i),p=!s&&(c||l&&!u||d||f),m=(e,t,n,r,i=t.substring(0,e)+r,a=t.substring(e+n.length),o=a.indexOf(n))=>i+(o<0?a:m(o,a,n,r)),h=(e,t,n,r,i)=>e<0?n+t+r:n+m(e,t,r,i)+r,g=(e,t,n=e,r=e.length+1)=>i=>i||i!==``&&i!==void 0?h((``+i).indexOf(t,r),i,e,t,n):``,_=(e,t,n)=>g(`\x1b[${e}m`,`\x1b[${t}m`,n),v={reset:_(0,0),bold:_(1,22,`\x1B[22m\x1B[1m`),dim:_(2,22,`\x1B[22m\x1B[2m`),italic:_(3,23),underline:_(4,24),inverse:_(7,27),hidden:_(8,28),strikethrough:_(9,29),black:_(30,39),red:_(31,39),green:_(32,39),yellow:_(33,39),blue:_(34,39),magenta:_(35,39),cyan:_(36,39),white:_(37,39),gray:_(90,39),bgBlack:_(40,49),bgRed:_(41,49),bgGreen:_(42,49),bgYellow:_(43,49),bgBlue:_(44,49),bgMagenta:_(45,49),bgCyan:_(46,49),bgWhite:_(47,49),blackBright:_(90,39),redBright:_(91,39),greenBright:_(92,39),yellowBright:_(93,39),blueBright:_(94,39),magentaBright:_(95,39),cyanBright:_(96,39),whiteBright:_(97,39),bgBlackBright:_(100,49),bgRedBright:_(101,49),bgGreenBright:_(102,49),bgYellowBright:_(103,49),bgBlueBright:_(104,49),bgMagentaBright:_(105,49),bgCyanBright:_(106,49),bgWhiteBright:_(107,49)},y=({useColor:e=p}={})=>e?v:Object.keys(v).reduce((e,t)=>({...e,[t]:String}),{}),{reset:b,bold:x,dim:S,italic:C,underline:w,inverse:T,hidden:E,strikethrough:D,black:O,red:ee,green:te,yellow:ne,blue:re,magenta:ie,cyan:ae,white:oe,gray:se,bgBlack:k,bgRed:ce,bgGreen:le,bgYellow:ue,bgBlue:A,bgMagenta:j,bgCyan:de,bgWhite:fe,blackBright:pe,redBright:me,greenBright:M,yellowBright:he,blueBright:ge,magentaBright:N,cyanBright:_e,whiteBright:ve,bgBlackBright:ye,bgRedBright:be,bgGreenBright:xe,bgYellowBright:Se,bgBlueBright:Ce,bgMagentaBright:we,bgCyanBright:Te,bgWhiteBright:Ee}=y();e.bgBlack=k,e.bgBlackBright=ye,e.bgBlue=A,e.bgBlueBright=Ce,e.bgCyan=de,e.bgCyanBright=Te,e.bgGreen=le,e.bgGreenBright=xe,e.bgMagenta=j,e.bgMagentaBright=we,e.bgRed=ce,e.bgRedBright=be,e.bgWhite=fe,e.bgWhiteBright=Ee,e.bgYellow=ue,e.bgYellowBright=Se,e.black=O,e.blackBright=pe,e.blue=re,e.blueBright=ge,e.bold=x,e.createColors=y,e.cyan=ae,e.cyanBright=_e,e.dim=S,e.gray=se,e.green=te,e.greenBright=M,e.hidden=E,e.inverse=T,e.isColorSupported=p,e.italic=C,e.magenta=ie,e.magentaBright=N,e.red=ee,e.redBright=me,e.reset=b,e.strikethrough=D,e.underline=w,e.white=oe,e.whiteBright=ve,e.yellow=ne,e.yellowBright=he})),dye=jX(((e,t)=>{t.exports=n;function n(e,t){if(e&&t)return n(e)(t);if(typeof e!=`function`)throw TypeError(`need wrapper function`);return Object.keys(e).forEach(function(t){r[t]=e[t]}),r;function r(){for(var t=Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];var r=e.apply(this,t),i=t[t.length-1];return typeof r==`function`&&r!==i&&Object.keys(i).forEach(function(e){r[e]=i[e]}),r}}})),XX=jX(((e,t)=>{var n=dye();t.exports=n(r),t.exports.strict=n(i),r.proto=r(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return r(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return i(this)},configurable:!0})});function r(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function i(e){var t=function(){if(t.called)throw Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)};return t.onceError=(e.name||"Function wrapped with `once`")+` shouldn't be called more than once`,t.called=!1,t}})),fye=jX(((e,t)=>{var n=XX(),r=function(){},i=global.Bare?queueMicrotask:process.nextTick.bind(process),a=function(e){return e.setHeader&&typeof e.abort==`function`},o=function(e){return e.stdio&&Array.isArray(e.stdio)&&e.stdio.length===3},s=function(e,t,c){if(typeof t==`function`)return s(e,null,t);t||={},c=n(c||r);var l=e._writableState,u=e._readableState,d=t.readable||t.readable!==!1&&e.readable,f=t.writable||t.writable!==!1&&e.writable,p=!1,m=function(){e.writable||h()},h=function(){f=!1,d||c.call(e)},g=function(){d=!1,f||c.call(e)},_=function(t){c.call(e,t?Error(`exited with error code: `+t):null)},v=function(t){c.call(e,t)},y=function(){i(b)},b=function(){if(!p&&(d&&!(u&&u.ended&&!u.destroyed)||f&&!(l&&l.ended&&!l.destroyed)))return c.call(e,Error(`premature close`))},x=function(){e.req.on(`finish`,h)};return a(e)?(e.on(`complete`,h),e.on(`abort`,y),e.req?x():e.on(`request`,x)):f&&!l&&(e.on(`end`,m),e.on(`close`,m)),o(e)&&e.on(`exit`,_),e.on(`end`,g),e.on(`finish`,h),t.error!==!1&&e.on(`error`,v),e.on(`close`,y),function(){p=!0,e.removeListener(`complete`,h),e.removeListener(`abort`,y),e.removeListener(`request`,x),e.req&&e.req.removeListener(`finish`,h),e.removeListener(`end`,m),e.removeListener(`close`,m),e.removeListener(`finish`,h),e.removeListener(`exit`,_),e.removeListener(`end`,g),e.removeListener(`error`,v),e.removeListener(`close`,y)}};t.exports=s})),pye=jX(((e,t)=>{var n=XX(),r=fye(),i;try{i=NX(`fs`)}catch{}var a=function(){},o=typeof process>`u`?!1:/^v?\.0/.test(process.version),s=function(e){return typeof e==`function`},c=function(e){return!o||!i?!1:(e instanceof(i.ReadStream||a)||e instanceof(i.WriteStream||a))&&s(e.close)},l=function(e){return e.setHeader&&s(e.abort)},u=function(e,t,i,o){o=n(o);var u=!1;e.on(`close`,function(){u=!0}),r(e,{readable:t,writable:i},function(e){if(e)return o(e);u=!0,o()});var d=!1;return function(t){if(!u&&!d){if(d=!0,c(e))return e.close(a);if(l(e))return e.abort();if(s(e.destroy))return e.destroy();o(t||Error(`stream was destroyed`))}}},d=function(e){e()},f=function(e,t){return e.pipe(t)};t.exports=function(){var e=Array.prototype.slice.call(arguments),t=s(e[e.length-1]||a)&&e.pop()||a;if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw Error(`pump requires two streams per minimum`);var n,r=e.map(function(i,a){var o=a<e.length-1;return u(i,o,a>0,function(e){n||=e,e&&r.forEach(d),!o&&(r.forEach(d),t(n))})});return e.reduce(f)}})),mye=jX(((e,t)=>{let{Transform:n}=NX(`stream`),{StringDecoder:r}=NX(`string_decoder`),i=Symbol(`last`),a=Symbol(`decoder`);function o(e,t,n){let r;if(this.overflow){if(r=this[a].write(e).split(this.matcher),r.length===1)return n();r.shift(),this.overflow=!1}else this[i]+=this[a].write(e),r=this[i].split(this.matcher);this[i]=r.pop();for(let e=0;e<r.length;e++)try{c(this,this.mapper(r[e]))}catch(e){return n(e)}if(this.overflow=this[i].length>this.maxLength,this.overflow&&!this.skipOverflow){n(Error(`maximum buffer reached`));return}n()}function s(e){if(this[i]+=this[a].end(),this[i])try{c(this,this.mapper(this[i]))}catch(t){return e(t)}e()}function c(e,t){t!==void 0&&e.push(t)}function l(e){return e}function u(e,t,c){switch(e||=/\r?\n/,t||=l,c||={},arguments.length){case 1:typeof e==`function`?(t=e,e=/\r?\n/):typeof e==`object`&&!(e instanceof RegExp)&&!e[Symbol.split]&&(c=e,e=/\r?\n/);break;case 2:typeof e==`function`?(c=t,t=e,e=/\r?\n/):typeof t==`object`&&(c=t,t=l)}c=Object.assign({},c),c.autoDestroy=!0,c.transform=o,c.flush=s,c.readableObjectMode=!0;let u=new n(c);return u[i]=``,u[a]=new r(`utf8`),u.matcher=e,u.mapper=t,u.maxLength=c.maxLength,u.skipOverflow=c.skipOverflow||!1,u.overflow=!1,u._destroy=function(e,t){this._writableState.errorEmitted=!1,t(e)},u}t.exports=u})),hye=jX(((e,t)=>{let n=Symbol.for(`pino.metadata`),r=mye(),{Duplex:i}=NX(`stream`),{parentPort:a,workerData:o}=NX(`worker_threads`);function s(){let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n}t.exports=function(e,t={}){let l=t.expectPinoConfig===!0&&o?.workerData?.pinoWillSendConfig===!0,u=t.parse===`lines`,d=typeof t.parseLine==`function`?t.parseLine:JSON.parse,f=t.close||c,p=r(function(e){let t;try{t=d(e)}catch(t){this.emit(`unknown`,e,t);return}if(t===null){this.emit(`unknown`,e,`Null value ignored`);return}return typeof t!=`object`&&(t={data:t,time:Date.now()}),p[n]&&(p.lastTime=t.time,p.lastLevel=t.level,p.lastObj=t),u?e:t},{autoDestroy:!0});if(p._destroy=function(e,t){let n=f(e,t);n&&typeof n.then==`function`&&n.then(t,t)},t.expectPinoConfig===!0&&o?.workerData?.pinoWillSendConfig!==!0&&setImmediate(()=>{p.emit(`error`,Error(`This transport is not compatible with the current version of pino. Please upgrade pino to the latest version.`))}),t.metadata!==!1&&(p[n]=!0,p.lastTime=0,p.lastLevel=0,p.lastObj=null),l){let e={},t=s();return a.on(`message`,function n(r){r.code===`PINO_CONFIG`&&(e=r.config,t.resolve(),a.off(`message`,n))}),Object.defineProperties(p,{levels:{get(){return e.levels}},messageKey:{get(){return e.messageKey}},errorKey:{get(){return e.errorKey}}}),t.then(m)}return m();function m(){let n=e(p);if(n&&typeof n.catch==`function`)n.catch(e=>{p.destroy(e)}),n=null;else if(t.enablePipelining&&n)return i.from({writable:p,readable:n});return p}};function c(e,t){process.nextTick(t,e)}})),ZX=jX(((e,t)=>{t.exports={DATE_FORMAT:`yyyy-mm-dd HH:MM:ss.l o`,DATE_FORMAT_SIMPLE:`HH:MM:ss.l`,ERROR_LIKE_KEYS:[`err`,`error`],MESSAGE_KEY:`msg`,LEVEL_KEY:`level`,LEVEL_LABEL:`levelLabel`,TIMESTAMP_KEY:`time`,LEVELS:{default:`USERLVL`,60:`FATAL`,50:`ERROR`,40:`WARN`,30:`INFO`,20:`DEBUG`,10:`TRACE`},LEVEL_NAMES:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},LOGGER_KEYS:[`pid`,`hostname`,`name`,`level`,`time`,`timestamp`,`caller`]}})),QX=jX(((e,t)=>{t.exports=i;let{LEVELS:n,LEVEL_NAMES:r}=ZX();function i(e,t,i){let a=e?t||n:Object.assign({},n,t),o=e?i||r:Object.assign({},r,i);return function(e){let t=`default`;return t=Number.isInteger(+e)?Object.prototype.hasOwnProperty.call(a,e)?e:t:Object.prototype.hasOwnProperty.call(o,e.toLowerCase())?o[e.toLowerCase()]:t,[a[t],t]}}})),$X=jX(((e,t)=>{let n=e=>e,r={default:n,60:n,50:n,40:n,30:n,20:n,10:n,message:n,greyMessage:n,property:n},{createColors:i}=YX(),a=QX(),o=i({useColor:!0}),{white:s,bgRed:c,red:l,yellow:u,green:d,blue:f,gray:p,cyan:m,magenta:h}=o,g={default:s,60:c,50:l,40:u,30:d,20:f,10:p,message:m,greyMessage:p,property:h};function _(e){return e.reduce(function(e,[t,n]){return e[t]=typeof o[n]==`function`?o[n]:s,e},{default:s,message:m,greyMessage:p,property:h})}function v(e){return function(t,n,{customLevels:r,customLevelNames:i}={}){let[o,s]=a(e,r,i)(t);return Object.prototype.hasOwnProperty.call(n,s)?n[s](o):n.default(o)}}function y(e){let t=v(e),n=function(e,n){return t(e,r,n)};return n.message=r.message,n.greyMessage=r.greyMessage,n.property=r.property,n.colors=i({useColor:!1}),n}function b(e){let t=v(e),n=function(e,n){return t(e,g,n)};return n.message=g.message,n.property=g.property,n.greyMessage=g.greyMessage,n.colors=o,n}function x(e,t){let n=_(e),r=t?n:Object.assign({},g,n),i=v(t),a=function(e,t){return i(e,r,t)};return a.colors=o,a.message=a.message||r.message,a.property=a.property||r.property,a.greyMessage=a.greyMessage||r.greyMessage,a}t.exports=function(e=!1,t,n){return e&&t!==void 0?x(t,n):e?b(n):y(n)}})),eZ=jX(((e,t)=>{t.exports=function(){}})),gye=jX(((e,t)=>{t.exports=a;let{isMainThread:n}=NX(`node:worker_threads`),r=VX(),i=eZ();function a(e){let t=new r(e);return t.on(`error`,a),!e.sync&&n&&o(t),t;function a(e){if(e.code===`EPIPE`){t.write=i,t.end=i,t.flushSync=i,t.destroy=i;return}t.removeListener(`error`,a)}}function o(e){if(global.WeakRef&&global.WeakMap&&global.FinalizationRegistry){let t=HX();t.register(e,s),e.on(`close`,function(){t.unregister(e)})}}function s(e,t){e.destroyed||(t===`beforeExit`?(e.flush(),e.on(`drain`,function(){e.end()})):e.flushSync())}})),tZ=jX(((e,t)=>{t.exports=n;function n(e){return e instanceof Date&&!Number.isNaN(e.getTime())}})),nZ=jX(((e,t)=>{t.exports=r;let n=tZ();function r(e){let t=new Date(e);return n(t)||(t=new Date(+e)),t}})),rZ=jX(((e,t)=>{t.exports=n;function n(e){let t=[],n=!1,r=``;for(let i=0;i<e.length;i++){let a=e.charAt(i);if(a===`\\`){n=!0;continue}if(n){n=!1,r+=a;continue}if(a===`.`){t.push(r),r=``;continue}r+=a}return r.length&&t.push(r),t}})),iZ=jX(((e,t)=>{t.exports=r;let n=rZ();function r(e,t){let r=Array.isArray(t)?t:n(t);for(let t of r){if(!Object.prototype.hasOwnProperty.call(e,t))return;e=e[t]}return e}})),aZ=jX(((e,t)=>{t.exports=i;let n=iZ(),r=rZ();function i(e,t){let i=r(t),a=i.pop();e=n(e,i),typeof e==`object`&&e&&Object.prototype.hasOwnProperty.call(e,a)&&delete e[a]}})),_ye=jX((e=>{let t=Function.prototype.toString,n=Object.prototype.toString;function r(e){if(!e)return Object.create(null);let n=e.constructor;if(n===Object)return e===Object.prototype?{}:Object.create(e);if(n&&~t.call(n).indexOf(`[native code]`))try{return new n}catch{}return Object.create(e)}function i(e){let t=e[Symbol.toStringTag];if(t)return t;let r=n.call(e);return r.substring(8,r.length-1)}let{propertyIsEnumerable:a}=Object.prototype;function o(e,t,n,r){let i=Object.getOwnPropertyDescriptor(e,n)||{configurable:!0,enumerable:!0,value:e[n],writable:!0},a=i.get||i.set?i:{configurable:i.configurable,enumerable:i.enumerable,value:r.copier(i.value,r),writable:i.writable};try{Object.defineProperty(t,n,a)}catch{t[n]=a.get?a.get():a.value}}function s(e,t,n){for(let r of Object.getOwnPropertyNames(e))o(e,t,r,n);for(let r of Object.getOwnPropertySymbols(e))o(e,t,r,n);return t}function c(e,t){let n=new t.Constructor;t.cache.set(e,n);for(let r=0;r<e.length;++r)n[r]=t.copier(e[r],t);return n}function l(e,t){let n=new t.Constructor;return t.cache.set(e,n),s(e,n,t)}function u(e,t){return e.slice(0)}function d(e,t){return e.slice(0,e.size,e.type)}function f(e,t){return new t.Constructor(u(e.buffer))}function p(e,t){return new t.Constructor(e.getTime())}function m(e,t){let n=new t.Constructor;t.cache.set(e,n);for(let[r,i]of e)n.set(r,t.copier(i,t));return n}function h(e,t){return s(e,m(e,t),t)}function g(e,t){let n=r(t.prototype);t.cache.set(e,n);for(let r of Object.keys(e))n[r]=t.copier(e[r],t);for(let r of Object.getOwnPropertySymbols(e))a.call(e,r)&&(n[r]=t.copier(e[r],t));return n}function _(e,t){let n=r(t.prototype);return t.cache.set(e,n),s(e,n,t)}function v(e,t){return new t.Constructor(e.valueOf())}function y(e,t){let n=new t.Constructor(e.source,e.flags);return n.lastIndex=e.lastIndex,n}function b(e,t){return e}function x(e,t){let n=new t.Constructor;t.cache.set(e,n);for(let r of e)n.add(t.copier(r,t));return n}function S(e,t){return s(e,x(e,t),t)}function C(){return new WeakMap}function w({createCache:e,methods:t,strict:n}){let r={array:n?l:c,arrayBuffer:u,asyncGenerator:b,blob:d,dataView:f,date:p,error:b,generator:b,map:n?h:m,object:n?_:g,regExp:y,set:n?S:x},i=t?Object.assign(r,t):r,a=T(i),o=e||C;if(!a.Object||!a.Array)throw Error(`An object and array copier must be provided.`);return{createCache:o,copiers:a,methods:i,strict:!!n}}function T(e){return{Arguments:e.object,Array:e.array,ArrayBuffer:e.arrayBuffer,AsyncGenerator:e.asyncGenerator,BigInt64Array:e.arrayBuffer,BigUint64Array:e.arrayBuffer,Blob:e.blob,Boolean:v,DataView:e.dataView,Date:e.date,Error:e.error,Float32Array:e.arrayBuffer,Float64Array:e.arrayBuffer,Generator:e.generator,Int8Array:e.arrayBuffer,Int16Array:e.arrayBuffer,Int32Array:e.arrayBuffer,Map:e.map,Number:v,Object:e.object,Promise:b,RegExp:e.regExp,Set:e.set,String:v,WeakMap:b,WeakSet:b,Uint8Array:e.arrayBuffer,Uint8ClampedArray:e.arrayBuffer,Uint16Array:e.arrayBuffer,Uint32Array:e.arrayBuffer}}function E(e={}){let{createCache:t,copiers:n}=w(e),{Array:r,Object:a}=n;function o(e,t){if(t.prototype=t.Constructor=void 0,!e||typeof e!=`object`)return e;if(t.cache.has(e))return t.cache.get(e);if(t.prototype=Object.getPrototypeOf(e),t.Constructor=t.prototype&&t.prototype.constructor,!t.Constructor||t.Constructor===Object)return a(e,t);if(Array.isArray(e))return r(e,t);let o=n[i(e)];return o?o(e,t):typeof e.then==`function`?e:a(e,t)}return function(e){return o(e,{Constructor:void 0,cache:t(),copier:o,prototype:void 0})}}let D=E({strict:!0});e.copy=E(),e.copyStrict=D,e.createCopier=E})),oZ=jX(((e,t)=>{t.exports=a;let{createCopier:n}=_ye(),r=n({}),i=aZ();function a({log:e,context:t}){let{ignoreKeys:n,includeKeys:a}=t,o=r(e);if(a){let e={};return a.forEach(t=>{e[t]=o[t]}),e}return n.forEach(e=>{i(o,e)}),o}})),vye=jX(((e,t)=>{function n(e){"@babel/helpers - typeof";return n=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},n(e)}(function(r){var i=arguments,a=function(){var e=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,t=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,n=/[^-+\dA-Z]/g;return function(r,d,f,p){if(i.length===1&&u(r)===`string`&&!/\d/.test(r)&&(d=r,r=void 0),r=r||r===0?r:new Date,r instanceof Date||(r=new Date(r)),isNaN(r))throw TypeError(`Invalid date`);d=String(a.masks[d]||d||a.masks.default);var m=d.slice(0,4);(m===`UTC:`||m===`GMT:`)&&(d=d.slice(4),f=!0,m===`GMT:`&&(p=!0));var h=function(){return f?`getUTC`:`get`},g=function(){return r[h()+`Date`]()},_=function(){return r[h()+`Day`]()},v=function(){return r[h()+`Month`]()},y=function(){return r[h()+`FullYear`]()},b=function(){return r[h()+`Hours`]()},x=function(){return r[h()+`Minutes`]()},S=function(){return r[h()+`Seconds`]()},C=function(){return r[h()+`Milliseconds`]()},w=function(){return f?0:r.getTimezoneOffset()},T=function(){return c(r)},E=function(){return l(r)},D={d:function(){return g()},dd:function(){return o(g())},ddd:function(){return a.i18n.dayNames[_()]},DDD:function(){return s({y:y(),m:v(),d:g(),_:h(),dayName:a.i18n.dayNames[_()],short:!0})},dddd:function(){return a.i18n.dayNames[_()+7]},DDDD:function(){return s({y:y(),m:v(),d:g(),_:h(),dayName:a.i18n.dayNames[_()+7]})},m:function(){return v()+1},mm:function(){return o(v()+1)},mmm:function(){return a.i18n.monthNames[v()]},mmmm:function(){return a.i18n.monthNames[v()+12]},yy:function(){return String(y()).slice(2)},yyyy:function(){return o(y(),4)},h:function(){return b()%12||12},hh:function(){return o(b()%12||12)},H:function(){return b()},HH:function(){return o(b())},M:function(){return x()},MM:function(){return o(x())},s:function(){return S()},ss:function(){return o(S())},l:function(){return o(C(),3)},L:function(){return o(Math.floor(C()/10))},t:function(){return b()<12?a.i18n.timeNames[0]:a.i18n.timeNames[1]},tt:function(){return b()<12?a.i18n.timeNames[2]:a.i18n.timeNames[3]},T:function(){return b()<12?a.i18n.timeNames[4]:a.i18n.timeNames[5]},TT:function(){return b()<12?a.i18n.timeNames[6]:a.i18n.timeNames[7]},Z:function(){return p?`GMT`:f?`UTC`:(String(r).match(t)||[``]).pop().replace(n,``).replace(/GMT\+0000/g,`UTC`)},o:function(){return(w()>0?`-`:`+`)+o(Math.floor(Math.abs(w())/60)*100+Math.abs(w())%60,4)},p:function(){return(w()>0?`-`:`+`)+o(Math.floor(Math.abs(w())/60),2)+`:`+o(Math.floor(Math.abs(w())%60),2)},S:function(){return[`th`,`st`,`nd`,`rd`][g()%10>3?0:(g()%100-g()%10!=10)*g()%10]},W:function(){return T()},WW:function(){return o(T())},N:function(){return E()}};return d.replace(e,function(e){return e in D?D[e]():e.slice(1,e.length-1)})}}();a.masks={default:`ddd mmm dd yyyy HH:MM:ss`,shortDate:`m/d/yy`,paddedShortDate:`mm/dd/yyyy`,mediumDate:`mmm d, yyyy`,longDate:`mmmm d, yyyy`,fullDate:`dddd, mmmm d, yyyy`,shortTime:`h:MM TT`,mediumTime:`h:MM:ss TT`,longTime:`h:MM:ss TT Z`,isoDate:`yyyy-mm-dd`,isoTime:`HH:MM:ss`,isoDateTime:`yyyy-mm-dd'T'HH:MM:sso`,isoUtcDateTime:`UTC:yyyy-mm-dd'T'HH:MM:ss'Z'`,expiresHeaderFormat:`ddd, dd mmm yyyy HH:MM:ss Z`},a.i18n={dayNames:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],monthNames:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`,`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],timeNames:[`a`,`p`,`am`,`pm`,`A`,`P`,`AM`,`PM`]};var o=function(e,t){for(e=String(e),t||=2;e.length<t;)e=`0`+e;return e},s=function(e){var t=e.y,n=e.m,r=e.d,i=e._,a=e.dayName,o=e.short,s=o!==void 0&&o,c=new Date,l=new Date;l.setDate(l[i+`Date`]()-1);var u=new Date;return u.setDate(u[i+`Date`]()+1),function(){return c[i+`FullYear`]()}()===t&&function(){return c[i+`Month`]()}()===n&&function(){return c[i+`Date`]()}()===r?s?`Tdy`:`Today`:function(){return l[i+`FullYear`]()}()===t&&function(){return l[i+`Month`]()}()===n&&function(){return l[i+`Date`]()}()===r?s?`Ysd`:`Yesterday`:function(){return u[i+`FullYear`]()}()===t&&function(){return u[i+`Month`]()}()===n&&function(){return u[i+`Date`]()}()===r?s?`Tmw`:`Tomorrow`:a},c=function(e){var t=new Date(e.getFullYear(),e.getMonth(),e.getDate());t.setDate(t.getDate()-(t.getDay()+6)%7+3);var n=new Date(t.getFullYear(),0,4);n.setDate(n.getDate()-(n.getDay()+6)%7+3);var r=t.getTimezoneOffset()-n.getTimezoneOffset();t.setHours(t.getHours()-r);var i=(t-n)/6048e5;return 1+Math.floor(i)},l=function(e){var t=e.getDay();return t===0&&(t=7),t},u=function(e){return e===null?`null`:e===void 0?`undefined`:n(e)===`object`?Array.isArray(e)?`array`:{}.toString.call(e).slice(8,-1).toLowerCase():n(e)};typeof define==`function`&&define.amd?define(function(){return a}):(e===void 0?`undefined`:n(e))===`object`?t.exports=a:r.dateFormat=a})(void 0)})),sZ=jX(((e,t)=>{t.exports=s;let{DATE_FORMAT:n,DATE_FORMAT_SIMPLE:r}=ZX(),i=vye(),a=nZ(),o=tZ();function s(e,t=!1){if(t===!1)return e;let s=a(e);if(!o(s))return e;if(t===!0)return i(s,r);let c=t.toUpperCase();if(c===`SYS:STANDARD`)return i(s,n);let l=c.substr(0,4);return l===`SYS:`||l===`UTC:`?l===`UTC:`?i(s,t):i(s,t.slice(4)):i(s,`UTC:${t}`)}})),cZ=jX(((e,t)=>{t.exports=n;function n(e){return e?typeof e==`string`?e.split(`,`).reduce((e,t,n)=>{let[r,i=n]=t.split(`:`);return e[r.toLowerCase()]=i,e},{}):Object.prototype.toString.call(e)===`[object Object]`?Object.keys(e).reduce((t,n)=>(t[n.toLowerCase()]=e[n],t),{}):{}:{}}})),lZ=jX(((e,t)=>{t.exports=n;function n(e){return e?typeof e==`string`?e.split(`,`).reduce((e,t,n)=>{let[r,i=n]=t.split(`:`);return e[i]=r.toUpperCase(),e},{default:`USERLVL`}):Object.prototype.toString.call(e)===`[object Object]`?Object.keys(e).reduce((t,n)=>(t[e[n]]=n.toUpperCase(),t),{default:`USERLVL`}):{}:{}}})),uZ=jX(((e,t)=>{t.exports=r;let n=iZ();function r(e,t){return e=e.replace(/{if (.*?)}(.*?){end}/g,r),e=e.replace(/{if (.*?)}/g,``),e=e.replace(/{end}/g,``),e.replace(/\s+/g,` `).trim();function r(e,r,i){let a=n(t,r);return a&&i.includes(r)?i.replace(RegExp(`{`+r+`}`,`g`),a):``}}})),dZ=jX(((e,t)=>{t.exports=n;function n(e){return Object.prototype.toString.apply(e)===`[object Object]`}})),fZ=jX(((e,t)=>{t.exports=n;function n({input:e,ident:t=` `,eol:n=`
|
|
711
|
+
`}){let r=e.split(/\r?\n/);for(let e=1;e<r.length;e+=1)r[e]=t+r[e];return r.join(n)}})),yye=jX(((e,t)=>{t.exports=s;let{LEVEL_NAMES:n}=ZX(),r=$X(),i=lZ(),a=cZ(),o=QX();function s(e){let t=e.crlf?`\r
|
|
710
712
|
`:`
|
|
711
|
-
`,{customPrettifiers:s,errorLikeObjectKeys:c,hideObject:l,levelFirst:u,levelKey:d,levelLabel:f,messageFormat:p,messageKey:m,minimumLevel:h,singleLine:g,timestampKey:_,translateTime:v}=e,y=e.errorProps.split(`,`),b=typeof e.useOnlyCustomProps==`boolean`?e.useOnlyCustomProps:e.useOnlyCustomProps===`true`,x=i(e.customLevels),S=a(e.customLevels),C=o(b,x,S),w;if(e.customColors){if(typeof e.customColors==`string`)w=e.customColors.split(`,`).reduce((t,r)=>{let[i,a]=r.split(`:`),o=(b?e.customLevels:S[i]!==void 0)?S[i]:n[i],s=o===void 0?i:o;return t.push([s,a]),t},[]);else if(typeof e.customColors==`object`)w=Object.keys(e.customColors).reduce((t,r)=>{let[i,a]=[r,e.customColors[r]],o=(b?e.customLevels:S[i]!==void 0)?S[i]:n[i],s=o===void 0?i:o;return t.push([s,a]),t},[]);else throw Error(`options.customColors must be of type string or object.`)}let T={customLevels:x,customLevelNames:S};b===!0&&!e.customLevels&&(T.customLevels=void 0,T.customLevelNames=void 0);let E=e.include===void 0?void 0:new Set(e.include.split(`,`)),D=!E&&e.ignore?new Set(e.ignore.split(`,`)):void 0,O=r(e.colorize,w,b),ee=e.colorizeObjects?O:r(!1,[],!1);return{EOL:t,IDENT:` `,colorizer:O,customColors:w,customLevelNames:S,customLevels:x,customPrettifiers:s,customProperties:T,errorLikeObjectKeys:c,errorProps:y,getLevelLabelData:C,hideObject:l,ignoreKeys:D,includeKeys:E,levelFirst:u,levelKey:d,levelLabel:f,messageFormat:p,messageKey:m,minimumLevel:h,objectColorizer:ee,singleLine:g,timestampKey:_,translateTime:v,useOnlyCustomProps:b}}})),yye=jX(((e,t)=>{t.exports=s,s.default=s,s.stable=d,s.stableStringify=d;var n=`[...]`,r=`[Circular]`,i=[],a=[];function o(){return{depthLimit:2**53-1,edgesLimit:2**53-1}}function s(e,t,n,r){r===void 0&&(r=o()),l(e,``,0,[],void 0,0,r);var s;try{s=a.length===0?JSON.stringify(e,t,n):JSON.stringify(e,p(t),n)}catch{return JSON.stringify(`[unable to serialize, circular reference is too complex to analyze]`)}finally{for(;i.length!==0;){var c=i.pop();c.length===4?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}}return s}function c(e,t,n,r){var o=Object.getOwnPropertyDescriptor(r,n);o.get===void 0?(r[n]=e,i.push([r,n,t])):o.configurable?(Object.defineProperty(r,n,{value:e}),i.push([r,n,t,o])):a.push([t,n,e])}function l(e,t,i,a,o,s,u){s+=1;var d;if(typeof e==`object`&&e){for(d=0;d<a.length;d++)if(a[d]===e){c(r,e,t,o);return}if(u.depthLimit!==void 0&&s>u.depthLimit){c(n,e,t,o);return}if(u.edgesLimit!==void 0&&i+1>u.edgesLimit){c(n,e,t,o);return}if(a.push(e),Array.isArray(e))for(d=0;d<e.length;d++)l(e[d],d,d,a,e,s,u);else{var f=Object.keys(e);for(d=0;d<f.length;d++){var p=f[d];l(e[p],p,d,a,e,s,u)}}a.pop()}}function u(e,t){return e<t?-1:+(e>t)}function d(e,t,n,r){r===void 0&&(r=o());var s=f(e,``,0,[],void 0,0,r)||e,c;try{c=a.length===0?JSON.stringify(s,t,n):JSON.stringify(s,p(t),n)}catch{return JSON.stringify(`[unable to serialize, circular reference is too complex to analyze]`)}finally{for(;i.length!==0;){var l=i.pop();l.length===4?Object.defineProperty(l[0],l[1],l[3]):l[0][l[1]]=l[2]}}return c}function f(e,t,a,o,s,l,d){l+=1;var p;if(typeof e==`object`&&e){for(p=0;p<o.length;p++)if(o[p]===e){c(r,e,t,s);return}try{if(typeof e.toJSON==`function`)return}catch{return}if(d.depthLimit!==void 0&&l>d.depthLimit){c(n,e,t,s);return}if(d.edgesLimit!==void 0&&a+1>d.edgesLimit){c(n,e,t,s);return}if(o.push(e),Array.isArray(e))for(p=0;p<e.length;p++)f(e[p],p,p,o,e,l,d);else{var m={},h=Object.keys(e).sort(u);for(p=0;p<h.length;p++){var g=h[p];f(e[g],g,p,o,e,l,d),m[g]=e[g]}if(s!==void 0)i.push([s,t,e]),s[t]=m;else return m}o.pop()}}function p(e){return e=e===void 0?function(e,t){return t}:e,function(t,n){if(a.length>0)for(var r=0;r<a.length;r++){var i=a[r];if(i[1]===t&&i[0]===n){n=i[2],a.splice(r,1);break}}return e.call(this,t,n)}}})),pZ=jX(((e,t)=>{t.exports=r;let n=fZ();function r({keyName:e,lines:t,eol:r,ident:i}){let a=``,o=`${i}${e}: ${n({input:t,ident:i,eol:r})}${r}`.split(r);for(let e=0;e<o.length;e+=1){e!==0&&(a+=r);let t=o[e];if(/^\s*"stack"/.test(t)){let e=/^(\s*"stack":)\s*(".*"),?$/.exec(t);if(e&&e.length===3){let n=/^\s*/.exec(t)[0].length+4,i=` `.repeat(n),o=e[2];a+=e[1]+r+i+JSON.parse(o).replace(/\n/g,r+i)}else a+=t}else a+=t}return a}})),mZ=jX(((e,t)=>{t.exports=o;let{LOGGER_KEYS:n}=ZX(),r=yye(),i=fZ(),a=pZ();function o({log:e,excludeLoggerKeys:t=!0,skipKeys:o=[],context:s}){let{EOL:c,IDENT:l,customPrettifiers:u,errorLikeObjectKeys:d,objectColorizer:f,singleLine:p,colorizer:m}=s,h=[].concat(o);t===!0&&Array.prototype.push.apply(h,n);let g=``,{plain:_,errors:v}=Object.entries(e).reduce(({plain:t,errors:n},[r,i])=>{if(h.includes(r)===!1){let a=typeof u[r]==`function`?u[r](i,r,e,{colors:m.colors}):i;d.includes(r)?n[r]=a:t[r]=a}return{plain:t,errors:n}},{plain:{},errors:{}});return p?(Object.keys(_).length>0&&(g+=f.greyMessage(r(_))),g+=c,g=g.replace(/\\\\/gi,`\\`)):Object.entries(_).forEach(([e,t])=>{let n=typeof u[e]==`function`?t:r(t,null,2);if(n===void 0)return;n=n.replace(/\\\\/gi,`\\`);let a=i({input:n,ident:l,eol:c});g+=`${l}${f.property(e)}:${a.startsWith(c)?``:` `}${a}${c}`}),Object.entries(v).forEach(([e,t])=>{let n=typeof u[e]==`function`?t:r(t,null,2);n!==void 0&&(g+=a({keyName:e,lines:n,eol:c,ident:l}))}),g}})),hZ=jX(((e,t)=>{t.exports=o;let{LOGGER_KEYS:n}=ZX(),r=dZ(),i=fZ(),a=mZ();function o({log:e,context:t}){let{EOL:o,IDENT:s,errorProps:c,messageKey:l}=t,u=e.stack,d=`${s}${i({input:u,ident:s,eol:o})}${o}`;if(c.length>0){let i=n.concat(l,`type`,`stack`),u;u=c[0]===`*`?Object.keys(e).filter(e=>i.includes(e)===!1):c.filter(e=>i.includes(e)===!1);for(let n=0;n<u.length;n+=1){let i=u[n];if(i in e){if(r(e[i])){let n=a({log:e[i],excludeLoggerKeys:!1,context:{...t,IDENT:s+s}});d=`${d}${s}${i}: {${o}${n}${s}}${o}`;continue}d=`${d}${s}${i}: ${e[i]}${o}`}}}return d}})),gZ=jX(((e,t)=>{t.exports=r;let n=iZ();function r({log:e,context:t}){let{colorizer:r,customLevels:i,customLevelNames:a,levelKey:o,getLevelLabelData:s}=t,c=t.customPrettifiers?.level,l=n(e,o);if(l===void 0)return;let u=r(l,{customLevels:i,customLevelNames:a});if(c){let[t]=s(l);return c(l,o,e,{label:t,labelColorized:u,colors:r.colors})}return u}})),_Z=jX(((e,t)=>{t.exports=a;let{LEVELS:n}=ZX(),r=iZ(),i=uZ();function a({log:e,context:t}){let{colorizer:a,customLevels:o,levelKey:s,levelLabel:c,messageFormat:l,messageKey:u,useOnlyCustomProps:d}=t;if(l&&typeof l==`string`){let t=i(l,e),u=String(t).replace(/{([^{}]+)}/g,function(t,i){let a;if(i===c&&(a=r(e,s))!==void 0)return(d?o===void 0:o[a]===void 0)?n[a]:o[a];let l=r(e,i);return l===void 0?``:l});return a.message(u)}if(l&&typeof l==`function`){let t=l(e,u,c,{colors:a.colors});return a.message(t)}if(u in e&&(typeof e[u]==`string`||typeof e[u]==`number`||typeof e[u]==`boolean`))return a.message(e[u])}})),vZ=jX(((e,t)=>{t.exports=n;function n({log:e,context:t}){let{customPrettifiers:n,colorizer:r}=t,i=``;if(e.name||e.pid||e.hostname){if(i+=`(`,e.name&&(i+=n.name?n.name(e.name,`name`,e,{colors:r.colors}):e.name),e.pid){let t=n.pid?n.pid(e.pid,`pid`,e,{colors:r.colors}):e.pid;e.name&&e.pid?i+=`/`+t:i+=t}if(e.hostname){let t=n.hostname?n.hostname(e.hostname,`hostname`,e,{colors:r.colors}):e.hostname;i+=`${i===`(`?`on`:` on`} ${t}`}i+=`)`}if(e.caller){let t=n.caller?n.caller(e.caller,`caller`,e,{colors:r.colors}):e.caller;i+=`${i===``?``:` `}<${t}>`}if(i!==``)return i}})),yZ=jX(((e,t)=>{t.exports=r;let n=sZ();function r({log:e,context:t}){let{timestampKey:r,translateTime:i}=t,a=t.customPrettifiers?.time,o=null;if(r in e?o=e[r]:`timestamp`in e&&(o=e.timestamp),o===null)return;let s=i?n(o,i):o;return a?a(s):`[${s}]`}})),bye=jX(((e,t)=>{t.exports={buildSafeSonicBoom:hye(),createDate:nZ(),deleteLogProperty:aZ(),filterLog:oZ(),formatTime:sZ(),getPropertyValue:iZ(),handleCustomLevelsNamesOpts:cZ(),handleCustomLevelsOpts:lZ(),interpretConditionals:uZ(),isObject:dZ(),isValidDate:tZ(),joinLinesWithIndentation:fZ(),noop:eZ(),parseFactoryOptions:vye(),prettifyErrorLog:hZ(),prettifyError:pZ(),prettifyLevel:gZ(),prettifyMessage:_Z(),prettifyMetadata:vZ(),prettifyObject:mZ(),prettifyTime:yZ(),splitPropertyKey:rZ(),getLevelLabelData:QX()}})),xye=jX(((e,t)=>{let n=typeof Buffer<`u`,r=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,i=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function a(e,t,a){a==null&&typeof t==`object`&&t&&(a=t,t=void 0),n&&Buffer.isBuffer(e)&&(e=e.toString()),e&&e.charCodeAt(0)===65279&&(e=e.slice(1));let s=JSON.parse(e,t);if(typeof s!=`object`||!s)return s;let c=a&&a.protoAction||`error`,l=a&&a.constructorAction||`error`;if(c===`ignore`&&l===`ignore`)return s;if(c!==`ignore`&&l!==`ignore`){if(r.test(e)===!1&&i.test(e)===!1)return s}else if(c!==`ignore`&&l===`ignore`){if(r.test(e)===!1)return s}else if(i.test(e)===!1)return s;return o(s,{protoAction:c,constructorAction:l,safe:a&&a.safe})}function o(e,{protoAction:t=`error`,constructorAction:n=`error`,safe:r}={}){let i=[e];for(;i.length;){let e=i;i=[];for(let a of e){if(t!==`ignore`&&Object.prototype.hasOwnProperty.call(a,`__proto__`)){if(r===!0)return null;if(t===`error`)throw SyntaxError(`Object contains forbidden prototype property`);delete a.__proto__}if(n!==`ignore`&&Object.prototype.hasOwnProperty.call(a,`constructor`)&&a.constructor!==null&&typeof a.constructor==`object`&&Object.prototype.hasOwnProperty.call(a.constructor,`prototype`)){if(r===!0)return null;if(n===`error`)throw SyntaxError(`Object contains forbidden prototype property`);delete a.constructor}for(let e in a){let t=a[e];t&&typeof t==`object`&&i.push(t)}}}return e}function s(e,t,n){let{stackTraceLimit:r}=Error;Error.stackTraceLimit=0;try{return a(e,t,n)}finally{Error.stackTraceLimit=r}}function c(e,t){let{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return a(e,t,{safe:!0})}catch{return}finally{Error.stackTraceLimit=n}}t.exports=s,t.exports.default=s,t.exports.parse=s,t.exports.safeParse=c,t.exports.scan=o})),Sye=jX(((e,t)=>{t.exports=h;let n=xye(),r=dZ(),i=hZ(),a=gZ(),o=_Z(),s=vZ(),c=mZ(),l=yZ(),u=oZ(),{LEVELS:d,LEVEL_KEY:f,LEVEL_NAMES:p}=ZX(),m=e=>{try{return{value:n.parse(e,{protoAction:`remove`})}}catch(e){return{err:e}}};function h(e){let t;if(r(e))t=e;else{let n=m(e);if(n.err||!r(n.value))return e+this.EOL;t=n.value}if(this.minimumLevel){let e;e=this.useOnlyCustomProps?this.customLevels:this.customLevelNames[this.minimumLevel]!==void 0;let n;if(n=e?this.customLevelNames[this.minimumLevel]:p[this.minimumLevel],n||=typeof this.minimumLevel==`string`?p[this.minimumLevel]:p[d[this.minimumLevel].toLowerCase()],t[this.levelKey===void 0?f:this.levelKey]<n)return}let n=o({log:t,context:this.context});(this.ignoreKeys||this.includeKeys)&&(t=u({log:t,context:this.context}));let h=a({log:t,context:{...this.context,...this.context.customProperties}}),g=s({log:t,context:this.context}),_=l({log:t,context:this.context}),v=``;if(this.levelFirst&&h&&(v=`${h}`),_&&v===``?v=`${_}`:_&&(v=`${v} ${_}`),!this.levelFirst&&h&&(v=v.length>0?`${v} ${h}`:h),g&&(v=v.length>0?`${v} ${g}:`:g),v.endsWith(`:`)===!1&&v!==``&&(v+=`:`),n!==void 0&&(v=v.length>0?`${v} ${n}`:n),v.length>0&&!this.singleLine&&(v+=this.EOL),t.type===`Error`&&typeof t.stack==`string`){let e=i({log:t,context:this.context});this.singleLine&&(v+=this.EOL),v+=e}else if(this.hideObject===!1){let e=[this.messageKey,this.levelKey,this.timestampKey].map(e=>e.replaceAll(/\\/g,``)).filter(e=>typeof t[e]==`string`||typeof t[e]==`number`||typeof t[e]==`boolean`),n=c({log:t,skipKeys:e,context:this.context});this.singleLine&&!/^\s$/.test(n)&&(v+=` `),v+=n}return v}})),Cye=jX(((e,t)=>{let{isColorSupported:n}=YX(),r=fye(),{Transform:i}=NX(`node:stream`),a=mye(),o=$X(),{ERROR_LIKE_KEYS:s,LEVEL_KEY:c,LEVEL_LABEL:l,MESSAGE_KEY:u,TIMESTAMP_KEY:d}=ZX(),{buildSafeSonicBoom:f,parseFactoryOptions:p}=bye(),m=Sye(),h={colorize:n,colorizeObjects:!0,crlf:!1,customColors:null,customLevels:null,customPrettifiers:{},errorLikeObjectKeys:s,errorProps:``,hideObject:!1,ignore:`hostname`,include:void 0,levelFirst:!1,levelKey:c,levelLabel:l,messageFormat:null,messageKey:u,minimumLevel:void 0,outputStream:process.stdout,singleLine:!1,timestampKey:d,translateTime:!0,useOnlyCustomProps:!0};function g(e){let t=p(Object.assign({},h,e));return m.bind({...t,context:t})}function _(e={}){let t=g(e),n;return a(function(a){a.on(`message`,function n(r){!r||r.code!==`PINO_CONFIG`||(Object.assign(e,{messageKey:r.config.messageKey,errorLikeObjectKeys:Array.from(new Set([...e.errorLikeObjectKeys||s,r.config.errorKey])),customLevels:r.config.levels.values}),t=g(e),a.off(`message`,n))});let o=new i({objectMode:!0,autoDestroy:!0,transform(e,n,r){r(null,t(e))}});return n=typeof e.destination==`object`&&typeof e.destination.write==`function`?e.destination:f({dest:e.destination||1,append:e.append,mkdir:e.mkdir,sync:e.sync}),a.on(`unknown`,function(e){n.write(e+`
|
|
712
|
-
`)}),r(a,o,n),o},{parse:`lines`,close(e,t){n.on(`close`,()=>{t(e)})}})}t.exports=_,t.exports.build=_,t.exports.PinoPretty=_,t.exports.prettyFactory=g,t.exports.colorizerFactory=o,t.exports.isColorSupported=n,t.exports.default=_})),bZ=MX(JX(),1),wye=MX(Cye(),1);const xZ=new Map;function Tye(e){let t=xZ.get(e);return t||(t={chain:Promise.resolve(),parentDirEnsured:!1},xZ.set(e,t)),t}var Eye=class{#e;#t;#n;#r;constructor(e){this.#e=e.currentPath,this.#t=e.previousPath,this.#n=e.maxBytes,this.#r=Tye(e.currentPath)}append(e){let t=this.#r.chain.catch(()=>void 0).then(()=>this.#i(e));return this.#r.chain=t,t}async drain(){await this.#r.chain.catch(()=>void 0)}async#i(e){this.#r.parentDirEnsured||(await Ce(M(this.#e),{recursive:!0}),this.#r.parentDirEnsured=!0),await Ee(this.#e,e,{flag:`a`});let t;try{t=te(this.#e).size}catch{this.#r.parentDirEnsured=!1;return}if(t>this.#n)try{await Te(this.#e,this.#t)}catch(e){if(e?.code!==`ENOENT`)throw e}}};const SZ=[`.ok`,`local`,`logs`];function Dye(e){return N(e,...SZ,`server-current.jsonl`)}function Oye(e){return N(e,...SZ,`server-prev.jsonl`)}var CZ=class extends Fe{#e;#t=0;#n=0;constructor(e){super({decodeStrings:!1}),this.#e=new Eye({currentPath:Dye(e.projectDir),previousPath:Oye(e.projectDir),maxBytes:e.maxBytes})}_write(e,t,n){this.#e.append(e).then(()=>n(),e=>{this.#r(e),n()})}#r(e){let t=Date.now();if(t-this.#t<5e3){this.#n++;return}this.#i(e instanceof Error?e.message:String(e),t)}#i(e,t){let n=this.#n;this.#n=0,this.#t=t,console.error(JSON.stringify({event:`pino-file-sink-write-dropped`,error:e,suppressed:n}))}async drain(){await this.#e.drain(),this.#n>0&&this.#i(`flushed at drain`,Date.now())}};function kye(){let e=as.getSpan(ns.active());if(!e)return{};let t=e.spanContext();return{trace_id:t.traceId,span_id:t.spanId,trace_flags:t.traceFlags}}function Aye(){return process.env.NO_COLOR&&process.env.NO_COLOR!==``?!1:process.stdout.isTTY??!1}const wZ=new Set([`fatal`,`error`,`warn`,`info`,`debug`,`trace`,`silent`]);function TZ(e){return e===`silent`?1/0:bZ.default.levels.values[e]??bZ.default.levels.values.info}function EZ(e,t){return TZ(e)<=TZ(t)?e:t}var jye=class{name;transportConfigs=[];fileSinkOpts;redactPaths;activeFileSink;pinoInstance;options;constructor(e,t={}){this.name=e,this.options={name:this.name,level:process.env.LOG_LEVEL||(process.env.NODE_ENV===`test`?`silent`:`info`),serializers:{err:bZ.default.stdSerializers.err,error:bZ.default.stdSerializers.err},mixin:kye,...t.options},t.transportConfigs&&(this.transportConfigs=t.transportConfigs),t.fileSink&&(this.fileSinkOpts=t.fileSink),t.redactPaths&&t.redactPaths.length>0&&(this.redactPaths=t.redactPaths,this.options={...this.options,redact:{paths:[...t.redactPaths],censor:`[REDACTED]`}}),this.pinoInstance=this.buildInstance()}resolveStreamLevels(){let e=this.options.level??`info`,t=process.env.OK_FILE_LEVEL?.toLowerCase(),n=t&&wZ.has(t)?t:e===`silent`?`silent`:EZ(e,`debug`),r=process.env.OK_CONSOLE_LEVEL?.toLowerCase(),i=r&&wZ.has(r)?r:e;return{fileLevel:n,consoleLevel:i,instanceLevel:EZ(n,i)}}buildInstance(){this.activeFileSink=void 0;let{fileLevel:e,consoleLevel:t,instanceLevel:n}=this.resolveStreamLevels();if(this.transportConfigs.length>0)return(0,bZ.default)(this.options,bZ.default.transport({targets:this.transportConfigs}));let r;try{r=(0,wye.default)({colorize:Aye(),translateTime:`HH:MM:ss`,ignore:`pid,hostname`})}catch(r){if(console.warn(`[PinoLogger] pino-pretty failed, falling back to JSON:`,r),this.fileSinkOpts){let t=new CZ(this.fileSinkOpts);return this.activeFileSink=t,(0,bZ.default)({...this.options,level:n},bZ.default.multistream([{stream:t,level:e}]))}return(0,bZ.default)({...this.options,level:t})}if(this.fileSinkOpts){let i=new CZ(this.fileSinkOpts);return this.activeFileSink=i,(0,bZ.default)({...this.options,level:n},bZ.default.multistream([{stream:r,level:t},{stream:i,level:e}]))}return(0,bZ.default)({...this.options,level:t},r)}recreateInstance(){typeof this.pinoInstance.flush==`function`&&this.pinoInstance.flush(),this.pinoInstance=this.buildInstance()}addTransport(e){this.transportConfigs.push(e),this.recreateInstance()}removeTransport(e){e>=0&&e<this.transportConfigs.length&&(this.transportConfigs.splice(e,1),this.recreateInstance())}getTransports(){return[...this.transportConfigs]}updateOptions(e){this.options={...this.options,...e},this.recreateInstance()}reconfigure(e){e.options&&(this.options={...this.options,...e.options}),e.transportConfigs&&(this.transportConfigs=e.transportConfigs),e.fileSink&&(this.fileSinkOpts=e.fileSink),e.redactPaths&&e.redactPaths.length>0&&(this.redactPaths=e.redactPaths,this.options={...this.options,redact:{paths:[...e.redactPaths],censor:`[REDACTED]`}}),this.recreateInstance()}getPinoInstance(){return this.pinoInstance}async flushFileSink(){this.activeFileSink&&await this.activeFileSink.drain()}error(e,t){this.pinoInstance.error(e,t)}warn(e,t){this.pinoInstance.warn(e,t)}info(e,t){this.pinoInstance.info(e,t)}debug(e,t){this.pinoInstance.debug(e,t)}};const Mye=new class{config={};loggers=new Map;configure(e){if(this.config=e,e.pinoConfig&&!e.defaultLogger&&!e.loggerFactory){for(let t of this.loggers.values())t.reconfigure(e.pinoConfig);return}this.loggers.clear()}getLogger(e){let t=this.loggers.get(e);if(t)return t;let n;return n=this.config.loggerFactory?this.config.loggerFactory(e):this.config.defaultLogger?this.config.defaultLogger:new jye(e,this.config.pinoConfig),this.loggers.set(e,n),n}reset(){this.config={},this.loggers.clear()}async flushAllFileSinks(){let e=[];for(let t of this.loggers.values())e.push(t.flushFileSink());await Promise.all(e)}};function DZ(e){return Mye.getLogger(e)}new Yq({extensions:DB,deriveStructuralFreshness:!0}),Mv(DB);var OZ=class{kind;projectRoot;projectSubPath;gitPath;gitDir;cachedCommonDir;constructor(e,t,n,r,i){this.kind=e,this.projectRoot=t,this.projectSubPath=n,this.gitPath=r,this.gitDir=i}readCommonDir(){if(this.cachedCommonDir!==void 0)return{kind:`resolved`,path:this.cachedCommonDir};let e=this.gitDir;try{let t=S(N(this.gitDir,`commondir`),`utf-8`).trim();t.length>0&&(e=ge(t)?t:be(this.gitDir,t))}catch(e){if(!AZ(e))return{kind:`unreadable`,cause:e}}return this.cachedCommonDir=e,{kind:`resolved`,path:e}}readHead(){let e;try{e=S(N(this.gitDir,`HEAD`),`utf-8`).trim()}catch(e){return AZ(e)?{kind:`absent`}:{kind:`unreadable`,cause:e}}let t=/^ref:[ \t]*(refs\/heads\/(.+))$/.exec(e);return t?.[2]?{kind:`branch`,branch:t[2],ref:t[1]}:MZ(e)?{kind:`detached`,oid:e}:{kind:`malformed`,raw:e}}readRemoteUrl(e){let t=this.readCommonDir();if(t.kind===`unreadable`)return t;let n;try{n=S(N(t.path,`config`),`utf-8`)}catch(e){return AZ(e)?{kind:`absent`,reason:`config-missing`}:{kind:`unreadable`,cause:e}}let r=Fye(n,e);return r===null?{kind:`absent`,reason:`remote-missing`}:{kind:`configured`,url:r}}readRef(e){if(!jZ(e))return{kind:`invalid`};let t=this.readCommonDir();if(t.kind===`unreadable`)return t;let n=be(t.path,e),r=ye(t.path,n);if(r.startsWith(`..`)||ge(r))return{kind:`invalid`};try{let e=S(n,`utf-8`).trim(),t=Rye(e);return t===null?{kind:`malformed`,raw:e}:{kind:`present`,storage:`loose`,value:t}}catch(e){if(!AZ(e))return{kind:`unreadable`,cause:e}}let i;try{i=S(N(t.path,`packed-refs`),`utf-8`)}catch(e){return AZ(e)?{kind:`absent`}:{kind:`unreadable`,cause:e}}for(let t of i.split(/\r?\n/)){let n=t.trim();if(n.length===0||n.startsWith(`#`)||n.startsWith(`^`))continue;let r=n.split(/\s+/);if(r.length===2&&r[1]===e)return MZ(r[0])?{kind:`present`,storage:`packed`,value:{kind:`oid`,oid:r[0]}}:{kind:`malformed`,raw:n}}return{kind:`absent`}}};function Nye(e){return kZ(be(e),``)}function Pye(e){let t=be(e),n=be(k());if(t===n)return{kind:`absent`};let r=kZ(t,``);if(r.kind!==`absent`)return r;let i=t;for(let e=0;e<64;e++){if(i===n)return{kind:`absent`};let e=M(i);if(e===i||e===n)return{kind:`absent`};let r=kZ(e,ye(e,t));if(r.kind!==`absent`)return r;i=e}return{kind:`absent`}}function kZ(e,t){let n=N(e,`.git`),r;try{r=te(n)}catch(e){return AZ(e)?{kind:`absent`}:{kind:`inaccessible`,gitPath:n,cause:e}}if(r.isDirectory())return{kind:`repository`,repository:new OZ(`directory`,e,t,n,n)};if(!r.isFile())return{kind:`absent`};let i;try{i=S(n,`utf-8`).trim()}catch(e){return{kind:`malformed-pointer`,gitPath:n,target:``,cause:e}}let a=/^gitdir:[ \t]*(.+)$/.exec(i);if(!a)return{kind:`malformed-pointer`,gitPath:n,target:``};let o=a[1].trim(),s=ge(o)?o:be(e,o);try{if(!te(s).isDirectory())return{kind:`malformed-pointer`,gitPath:n,target:s}}catch(e){return{kind:`malformed-pointer`,gitPath:n,target:s,cause:e}}return{kind:`repository`,repository:new OZ(`linked`,e,t,n,s)}}function Fye(e,t){let n=!1;for(let r of e.split(/\r?\n/)){let e=Iye(r);if(e.length===0)continue;if(e.startsWith(`[`)){n=/^\[\s*remote\s+["'](.+)["']\s*\]$/.exec(e)?.[1]===t;continue}if(!n)continue;let i=/^url\s*=\s*(.*)$/.exec(e);if(!i)continue;let a=Lye(i[1]);if(a.length>0)return a}return null}function Iye(e){let t=e.search(/[;#]/);return(t===-1?e:e.slice(0,t)).trim()}function Lye(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?t.slice(1,-1):t}function AZ(e){let t=e?.code;return t===`ENOENT`||t===`ENOTDIR`}function jZ(e){return e.startsWith(`refs/`)&&!e.includes(`\0`)&&!e.includes(`\\`)&&!e.includes(`..`)&&!e.includes(`//`)&&!e.endsWith(`/`)}function Rye(e){if(e.length===0)return null;let t=/^ref:[ \t]*(refs\/.+)$/.exec(e);return t?jZ(t[1])?{kind:`symbolic`,target:t[1]}:null:MZ(e)?{kind:`oid`,oid:e}:null}function MZ(e){return/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(e)}new Set(Yie);const zye=[`-dev`,...Object.values(eu).map(e=>e.mcpServerName.slice(Jie.length)).filter(e=>e!==``)];RegExp(`^open[-_ ]?knowledge(?:${zye.join(`|`)})?$`),new Set(Object.values(eu).map(gu));const NZ={initialize:`initialize`,authenticate:`authenticate`,providers_list:`providers/list`,providers_set:`providers/set`,providers_disable:`providers/disable`,session_new:`session/new`,session_load:`session/load`,session_set_mode:`session/set_mode`,session_set_config_option:`session/set_config_option`,session_prompt:`session/prompt`,session_cancel:`session/cancel`,mcp_message:`mcp/message`,session_list:`session/list`,session_delete:`session/delete`,session_fork:`session/fork`,session_resume:`session/resume`,session_close:`session/close`,logout:`logout`,nes_start:`nes/start`,nes_suggest:`nes/suggest`,nes_accept:`nes/accept`,nes_reject:`nes/reject`,nes_close:`nes/close`,document_did_open:`document/didOpen`,document_did_change:`document/didChange`,document_did_close:`document/didClose`,document_did_save:`document/didSave`,document_did_focus:`document/didFocus`},PZ={session_request_permission:`session/request_permission`,session_update:`session/update`,fs_write_text_file:`fs/write_text_file`,fs_read_text_file:`fs/read_text_file`,terminal_create:`terminal/create`,terminal_output:`terminal/output`,terminal_release:`terminal/release`,terminal_wait_for_exit:`terminal/wait_for_exit`,terminal_kill:`terminal/kill`,mcp_connect:`mcp/connect`,mcp_message:`mcp/message`,mcp_disconnect:`mcp/disconnect`,elicitation_create:`elicitation/create`,elicitation_complete:`elicitation/complete`},Bye={cancel_request:`$/cancel_request`},FZ=Symbol(`skippedItem`);function $(e,t){return e.catch(t)}function IZ(e,t){let n=e.catch(t);return R().transform((e,t)=>e===void 0?(t.addIssue({code:`custom`,message:`Required value is missing`}),nt):n.parse(e))}function LZ(e,t){if(typeof e!=`object`||!e||Array.isArray(e))return;let n=e[t];return typeof n==`string`?n:void 0}function RZ(e,t,n){return e.superRefine((e,r)=>{let i=LZ(e,t);i!==void 0&&n.includes(i)&&r.addIssue({code:`custom`,path:[t],message:`${t} ${JSON.stringify(i)} is reserved by a known variant, but the value does not match that variant's schema`})})}function zZ(e,t,n){return R().transform((r,i)=>{let a=e.safeParse(r);if(!a.success){for(let e of a.error.issues)i.addIssue({...e,input:r});return nt}let o=a.data,s=LZ(r,t);if(s!==void 0&&!n.includes(s)){let e=r;for(let[t,n]of Object.entries(e))t!==`__proto__`&&(Object.hasOwn(o,t)||(o[t]=n))}return o})}function BZ(e){return z(e.catch(FZ)).transform(e=>e.filter(e=>e!==FZ))}const VZ=V([I(),F()]).nullable(),HZ=F(),UZ=B({sessionId:HZ,path:F(),content:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),WZ=B({sessionId:HZ,path:F(),line:$($r().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),limit:$($r().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),GZ=F(),KZ=V([W(`read`),W(`edit`),W(`delete`),W(`move`),W(`search`),W(`execute`),W(`think`),W(`fetch`),W(`switch_mode`),W(`other`)]),qZ=V([W(`pending`),W(`in_progress`),W(`completed`),W(`failed`)]),JZ=B({audience:$(BZ(V([W(`assistant`),W(`user`)])).nullish(),()=>void 0),lastModified:$(F().nullish(),()=>void 0),priority:$(I().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Vye=B({annotations:$(JZ.nullish(),()=>void 0),text:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Hye=B({annotations:$(JZ.nullish(),()=>void 0),data:F(),mimeType:F(),uri:$(F().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Uye=B({annotations:$(JZ.nullish(),()=>void 0),data:F(),mimeType:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Wye=B({annotations:$(JZ.nullish(),()=>void 0),description:$(F().nullish(),()=>void 0),mimeType:$(F().nullish(),()=>void 0),name:F(),size:$(I().nullish(),()=>void 0),title:$(F().nullish(),()=>void 0),uri:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Gye=V([B({mimeType:$(F().nullish(),()=>void 0),text:F(),uri:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),B({blob:F(),mimeType:$(F().nullish(),()=>void 0),uri:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)})]),Kye=B({annotations:$(JZ.nullish(),()=>void 0),resource:Gye,_meta:$(H(F(),R()).nullish(),()=>void 0)}),YZ=V([Vye.and(B({type:W(`text`)})),Hye.and(B({type:W(`image`)})),Uye.and(B({type:W(`audio`)})),Wye.and(B({type:W(`resource_link`)})),Kye.and(B({type:W(`resource`)}))]),qye=B({content:YZ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),Jye=B({path:F(),oldText:$(F().nullish(),()=>void 0),newText:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),XZ=F(),Yye=B({terminalId:XZ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),ZZ=V([qye.and(B({type:W(`content`)})),Jye.and(B({type:W(`diff`)})),Yye.and(B({type:W(`terminal`)}))]),QZ=B({path:F(),line:$($r().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),$Z=B({toolCallId:GZ,kind:$(KZ.nullish(),()=>void 0),status:$(qZ.nullish(),()=>void 0),title:$(F().nullish(),()=>void 0),content:$(BZ(ZZ).nullish(),()=>void 0),locations:$(BZ(QZ).nullish(),()=>void 0),rawInput:$(R().optional(),()=>void 0),rawOutput:$(R().optional(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),eQ=F(),Xye=V([W(`allow_once`),W(`allow_always`),W(`reject_once`),W(`reject_always`)]),tQ=B({sessionId:HZ,toolCall:$Z,options:z(B({optionId:eQ,name:F(),kind:Xye,_meta:$(H(F(),R()).nullish(),()=>void 0)})),_meta:$(H(F(),R()).nullish(),()=>void 0)}),nQ=B({name:F(),value:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),rQ=B({sessionId:HZ,command:F(),args:$(BZ(F()).optional(),()=>[]),env:$(BZ(nQ).optional(),()=>[]),cwd:$(F().nullish(),()=>void 0),outputByteLimit:$(I().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),iQ=B({sessionId:HZ,terminalId:XZ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),aQ=B({sessionId:HZ,terminalId:XZ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),oQ=B({sessionId:HZ,terminalId:XZ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),sQ=B({sessionId:HZ,terminalId:XZ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),cQ=B({sessionId:HZ,toolCallId:$(GZ.nullish(),()=>void 0)}),lQ=B({requestId:VZ}),Zye=W(`object`),Qye=V([W(`email`),W(`uri`),W(`date`),W(`date-time`)]),uQ=B({const:F(),title:F(),description:$(F().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),dQ=B({title:$(F().nullish(),()=>void 0),description:$(F().nullish(),()=>void 0),minLength:$r().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),maxLength:$r().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),pattern:F().nullish(),format:Qye.nullish(),default:$(F().nullish(),()=>void 0),enum:z(F()).nullish(),oneOf:z(uQ).nullish(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),fQ=B({title:$(F().nullish(),()=>void 0),description:$(F().nullish(),()=>void 0),minimum:I().nullish(),maximum:I().nullish(),default:$(I().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),pQ=B({title:$(F().nullish(),()=>void 0),description:$(F().nullish(),()=>void 0),minimum:I().nullish(),maximum:I().nullish(),default:$(I().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),mQ=B({title:$(F().nullish(),()=>void 0),description:$(F().nullish(),()=>void 0),default:$(L().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),hQ=B({enum:z(F()),_meta:$(H(F(),R()).nullish(),()=>void 0)}),$ye=B({anyOf:z(uQ),_meta:$(H(F(),R()).nullish(),()=>void 0)}),ebe=zZ(V([hQ.and(B({type:W(`string`)})),RZ(B({type:F()}),`type`,[`string`]),$ye]),`type`,[`string`]),gQ=B({title:$(F().nullish(),()=>void 0),description:$(F().nullish(),()=>void 0),minItems:I().nullish(),maxItems:I().nullish(),items:ebe,default:$(BZ(F()).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),tbe=zZ(V([dQ.and(B({type:W(`string`)})),fQ.and(B({type:W(`number`)})),pQ.and(B({type:W(`integer`)})),mQ.and(B({type:W(`boolean`)})),gQ.and(B({type:W(`array`)})),RZ(B({type:F()}),`type`,[`array`,`boolean`,`integer`,`number`,`string`])]),`type`,[`array`,`boolean`,`integer`,`number`,`string`]),nbe=B({type:$(Zye.optional().default(`object`),()=>`object`),title:$(F().nullish(),()=>void 0),properties:H(F(),tbe).optional().default({}),required:z(F()).nullish(),description:$(F().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),_Q=fi(V([cQ,lQ]),B({requestedSchema:nbe})),vQ=F(),yQ=fi(V([cQ,lQ]),B({elicitationId:vQ,url:Gr()})),bQ=zZ(fi(V([_Q.and(B({mode:W(`form`)})),yQ.and(B({mode:W(`url`)})),RZ(fi(V([cQ,lQ]),B({mode:F()})),`mode`,[`form`,`url`])]),B({message:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)})),`mode`,[`form`,`url`]),xQ=F(),rbe=B({serverId:xQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),SQ=F(),CQ=B({connectionId:SQ,method:F(),params:H(F(),R()).nullish(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),ibe=B({connectionId:SQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),wQ=R();B({id:VZ,method:F(),params:V([UZ,WZ,tQ,rQ,iQ,aQ,oQ,sQ,bQ,rbe,CQ,ibe,wQ]).nullish()});const TQ=$r().gte(0).lte(65535),abe=B({image:$(L().optional().default(!1),()=>!1),audio:$(L().optional().default(!1),()=>!1),embeddedContext:$(L().optional().default(!1),()=>!1),_meta:$(H(F(),R()).nullish(),()=>void 0)}),obe=B({http:$(L().optional().default(!1),()=>!1),sse:$(L().optional().default(!1),()=>!1),acp:$(L().optional().default(!1),()=>!1),_meta:$(H(F(),R()).nullish(),()=>void 0)}),sbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),cbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),lbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),ube=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),dbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),fbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),pbe=B({list:$(sbe.nullish(),()=>void 0),delete:$(cbe.nullish(),()=>void 0),additionalDirectories:$(lbe.nullish(),()=>void 0),fork:$(ube.nullish(),()=>void 0),resume:$(dbe.nullish(),()=>void 0),close:$(fbe.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),mbe=B({logout:$(B({_meta:$(H(F(),R()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),hbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),gbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),_be=B({syncKind:V([W(`full`),W(`incremental`)]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),vbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),ybe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),bbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),xbe=B({document:$(B({didOpen:$(gbe.nullish(),()=>void 0),didChange:$(_be.nullish(),()=>void 0),didClose:$(vbe.nullish(),()=>void 0),didSave:$(ybe.nullish(),()=>void 0),didFocus:$(bbe.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Sbe=B({maxCount:$($r().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Cbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),wbe=B({maxCount:$($r().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Tbe=B({maxCount:$($r().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Ebe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),Dbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),Obe=B({recentFiles:$(Sbe.nullish(),()=>void 0),relatedSnippets:$(Cbe.nullish(),()=>void 0),editHistory:$(wbe.nullish(),()=>void 0),userActions:$(Tbe.nullish(),()=>void 0),openFiles:$(Ebe.nullish(),()=>void 0),diagnostics:$(Dbe.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),kbe=B({events:$(xbe.nullish(),()=>void 0),context:$(Obe.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),EQ=V([W(`utf-16`),W(`utf-32`),W(`utf-8`)]),Abe=B({loadSession:$(L().optional().default(!1),()=>!1),promptCapabilities:$(abe.optional().default({image:!1,audio:!1,embeddedContext:!1}),()=>({image:!1,audio:!1,embeddedContext:!1})),mcpCapabilities:$(obe.optional().default({http:!1,sse:!1,acp:!1}),()=>({http:!1,sse:!1,acp:!1})),sessionCapabilities:$(pbe.optional().default({}),()=>({})),auth:$(mbe.optional().default({}),()=>({})),providers:$(hbe.nullish(),()=>void 0),nes:$(kbe.nullish(),()=>void 0),positionEncoding:$(EQ.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),DQ=F(),jbe=B({name:F(),label:$(F().nullish(),()=>void 0),secret:$(L().optional().default(!0),()=>!0),optional:$(L().optional().default(!1),()=>!1),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Mbe=B({id:DQ,name:F(),description:$(F().nullish(),()=>void 0),vars:IZ(BZ(jbe),()=>[]),link:$(F().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Nbe=B({id:DQ,name:F(),description:$(F().nullish(),()=>void 0),args:$(BZ(F()).optional(),()=>[]),env:$(H(F(),F()).optional(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Pbe=B({id:DQ,name:F(),description:$(F().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Fbe=V([Mbe.and(B({type:W(`env_var`)})),Nbe.and(B({type:W(`terminal`)})),Pbe]),OQ=B({name:F(),title:$(F().nullish(),()=>void 0),version:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Ibe=B({protocolVersion:TQ,agentCapabilities:$(Abe.optional().default({loadSession:!1,promptCapabilities:{image:!1,audio:!1,embeddedContext:!1},mcpCapabilities:{http:!1,sse:!1,acp:!1},sessionCapabilities:{},auth:{}}),()=>({loadSession:!1,promptCapabilities:{image:!1,audio:!1,embeddedContext:!1},mcpCapabilities:{http:!1,sse:!1,acp:!1},sessionCapabilities:{},auth:{}})),authMethods:$(BZ(Fbe).optional().default([]),()=>[]),agentInfo:$(OQ.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Lbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),kQ=F(),AQ=V([W(`anthropic`),W(`openai`),W(`azure`),W(`vertex`),W(`bedrock`),F()]),Rbe=B({apiType:AQ,baseUrl:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),zbe=B({providers:z(B({providerId:kQ,supported:IZ(BZ(AQ),()=>[]),required:L(),current:Rbe.nullish(),_meta:$(H(F(),R()).nullish(),()=>void 0)})),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Bbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),Vbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),Hbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),jQ=F(),MQ=B({currentModeId:jQ,availableModes:IZ(BZ(B({id:jQ,name:F(),description:$(F().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)})),()=>[]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),NQ=F(),Ube=V([W(`mode`),W(`model`),W(`model_config`),W(`thought_level`),F()]),PQ=F(),FQ=B({value:PQ,name:F(),description:$(F().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Wbe=B({group:F(),name:F(),options:IZ(BZ(FQ),()=>[]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Gbe=B({currentValue:PQ,options:V([z(FQ),z(Wbe)])}),Kbe=B({currentValue:L()}),IQ=fi(V([Gbe.and(B({type:W(`select`)})),Kbe.and(B({type:W(`boolean`)}))]),B({id:NQ,name:F(),description:$(F().nullish(),()=>void 0),category:$(Ube.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)})),qbe=B({sessionId:HZ,modes:$(MQ.nullish(),()=>void 0),configOptions:$(BZ(IQ).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Jbe=B({modes:$(MQ.nullish(),()=>void 0),configOptions:$(BZ(IQ).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Ybe=B({sessions:IZ(BZ(B({sessionId:HZ,cwd:F(),additionalDirectories:$(BZ(F()).optional(),()=>[]),title:$(F().nullish(),()=>void 0),updatedAt:$(F().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)})),()=>[]),nextCursor:$(F().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Xbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),Zbe=B({sessionId:HZ,modes:$(MQ.nullish(),()=>void 0),configOptions:$(BZ(IQ).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Qbe=B({modes:$(MQ.nullish(),()=>void 0),configOptions:$(BZ(IQ).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),$be=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),exe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),txe=B({configOptions:IZ(BZ(IQ),()=>[]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),nxe=B({stopReason:V([W(`end_turn`),W(`max_tokens`),W(`max_turn_requests`),W(`refusal`),W(`cancelled`)]),usage:$(B({totalTokens:I(),inputTokens:I(),outputTokens:I(),thoughtTokens:$(I().nullish(),()=>void 0),cachedReadTokens:$(I().nullish(),()=>void 0),cachedWriteTokens:$(I().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),rxe=B({sessionId:HZ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),LQ=F(),RQ=B({line:$r().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}),character:$r().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}),_meta:$(H(F(),R()).nullish(),()=>void 0)}),zQ=B({start:RQ,end:RQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),ixe=B({range:zQ,newText:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),axe=B({id:LQ,uri:F(),edits:z(ixe),cursorPosition:$(RQ.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),oxe=B({id:LQ,uri:F(),position:RQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),sxe=B({id:LQ,uri:F(),position:RQ,newName:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),cxe=B({id:LQ,uri:F(),search:F(),replace:F(),isRegex:L().nullish(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),lxe=B({suggestions:z(V([axe.and(B({kind:W(`edit`)})),oxe.and(B({kind:W(`jump`)})),sxe.and(B({kind:W(`rename`)})),cxe.and(B({kind:W(`searchAndReplace`)}))])),_meta:$(H(F(),R()).nullish(),()=>void 0)}),uxe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),BQ=R(),VQ=R(),HQ=B({code:V([W(-32700),W(-32600),W(-32601),W(-32602),W(-32603),W(-32800),W(-32e3),W(-32002),$r().min(-2147483648,{error:`Invalid value: Expected int32 to be >= -2147483648`}).max(2147483647,{error:`Invalid value: Expected int32 to be <= 2147483647`})]),message:F(),data:$(R().optional(),()=>void 0)});V([B({id:VZ,result:V([Ibe,Lbe,zbe,Bbe,Vbe,Hbe,qbe,Jbe,Ybe,Xbe,Zbe,Qbe,$be,exe,txe,nxe,rxe,lxe,uxe,BQ,VQ])}),B({id:VZ,error:HQ})]);const UQ=B({content:YZ,messageId:$(F().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),dxe=B({toolCallId:GZ,title:F(),kind:$(KZ.optional(),()=>void 0),status:$(qZ.optional(),()=>void 0),content:$(BZ(ZZ).optional(),()=>[]),locations:$(BZ(QZ).optional(),()=>[]),rawInput:$(R().optional(),()=>void 0),rawOutput:$(R().optional(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),fxe=V([W(`high`),W(`medium`),W(`low`)]),pxe=V([W(`pending`),W(`in_progress`),W(`completed`)]),WQ=B({content:F(),priority:fxe,status:pxe,_meta:$(H(F(),R()).nullish(),()=>void 0)}),mxe=B({entries:IZ(BZ(WQ),()=>[]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),GQ=F(),hxe=B({planId:GQ,entries:IZ(BZ(WQ),()=>[]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),gxe=B({planId:GQ,uri:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),_xe=B({planId:GQ,content:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),vxe=B({plan:V([hxe.and(B({type:W(`items`)})),gxe.and(B({type:W(`file`)})),_xe.and(B({type:W(`markdown`)}))]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),yxe=B({planId:GQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),bxe=B({hint:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),xxe=B({availableCommands:IZ(BZ(B({name:F(),description:F(),input:$(bxe.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)})),()=>[]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Sxe=B({currentModeId:jQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),Cxe=B({configOptions:IZ(BZ(IQ),()=>[]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),wxe=B({title:$(F().nullish(),()=>void 0),updatedAt:$(F().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Txe=B({amount:I(),currency:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Exe=B({used:I(),size:I(),cost:$(Txe.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),KQ=B({sessionId:HZ,update:V([UQ.and(B({sessionUpdate:W(`user_message_chunk`)})),UQ.and(B({sessionUpdate:W(`agent_message_chunk`)})),UQ.and(B({sessionUpdate:W(`agent_thought_chunk`)})),dxe.and(B({sessionUpdate:W(`tool_call`)})),$Z.and(B({sessionUpdate:W(`tool_call_update`)})),mxe.and(B({sessionUpdate:W(`plan`)})),vxe.and(B({sessionUpdate:W(`plan_update`)})),yxe.and(B({sessionUpdate:W(`plan_removed`)})),xxe.and(B({sessionUpdate:W(`available_commands_update`)})),Sxe.and(B({sessionUpdate:W(`current_mode_update`)})),Cxe.and(B({sessionUpdate:W(`config_option_update`)})),wxe.and(B({sessionUpdate:W(`session_info_update`)})),Exe.and(B({sessionUpdate:W(`usage_update`)}))]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),qQ=B({elicitationId:vQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),JQ=B({connectionId:SQ,method:F(),params:$(H(F(),R()).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),YQ=R();B({method:F(),params:V([KQ,qQ,JQ,YQ]).nullish()});const Dxe=B({readTextFile:$(L().optional().default(!1),()=>!1),writeTextFile:$(L().optional().default(!1),()=>!1),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Oxe=B({configOptions:$(B({boolean:$(B({_meta:$(H(F(),R()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),kxe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),Axe=B({terminal:$(L().optional().default(!1),()=>!1),_meta:$(H(F(),R()).nullish(),()=>void 0)}),jxe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),Mxe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),Nxe=B({form:$(jxe.nullish(),()=>void 0),url:$(Mxe.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Pxe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),Fxe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),Ixe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),Lxe=B({jump:$(Pxe.nullish(),()=>void 0),rename:$(Fxe.nullish(),()=>void 0),searchAndReplace:$(Ixe.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),XQ=B({protocolVersion:TQ,clientCapabilities:$(B({fs:$(Dxe.optional().default({readTextFile:!1,writeTextFile:!1}),()=>({readTextFile:!1,writeTextFile:!1})),terminal:$(L().optional().default(!1),()=>!1),session:$(Oxe.nullish(),()=>void 0),plan:$(kxe.nullish(),()=>void 0),auth:$(Axe.optional().default({terminal:!1}),()=>({terminal:!1})),elicitation:$(Nxe.nullish(),()=>void 0),nes:$(Lxe.nullish(),()=>void 0),positionEncodings:$(BZ(EQ).optional(),()=>[]),_meta:$(H(F(),R()).nullish(),()=>void 0)}).optional().default({fs:{readTextFile:!1,writeTextFile:!1},terminal:!1,auth:{terminal:!1}}),()=>({fs:{readTextFile:!1,writeTextFile:!1},terminal:!1,auth:{terminal:!1}})),clientInfo:$(OQ.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),ZQ=B({methodId:DQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),QQ=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),$Q=B({providerId:kQ,apiType:AQ,baseUrl:F(),headers:H(F(),F()).optional(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),e$=B({providerId:kQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),t$=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),n$=B({name:F(),value:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Rxe=B({name:F(),url:F(),headers:z(n$),_meta:$(H(F(),R()).nullish(),()=>void 0)}),zxe=B({name:F(),url:F(),headers:z(n$),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Bxe=B({name:F(),serverId:xQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),Vxe=B({name:F(),command:F(),args:z(F()),env:z(nQ),_meta:$(H(F(),R()).nullish(),()=>void 0)}),r$=V([Rxe.and(B({type:W(`http`)})),zxe.and(B({type:W(`sse`)})),Bxe.and(B({type:W(`acp`)})),Vxe]),i$=B({cwd:F(),additionalDirectories:$(BZ(F()).optional(),()=>[]),mcpServers:IZ(BZ(r$),()=>[]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),a$=B({mcpServers:IZ(BZ(r$),()=>[]),cwd:F(),additionalDirectories:$(BZ(F()).optional(),()=>[]),sessionId:HZ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),o$=B({cwd:F().nullish(),cursor:F().nullish(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),s$=B({sessionId:HZ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),c$=B({sessionId:HZ,cwd:F(),additionalDirectories:$(BZ(F()).optional(),()=>[]),mcpServers:$(BZ(r$).optional(),()=>[]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),l$=B({sessionId:HZ,cwd:F(),additionalDirectories:$(BZ(F()).optional(),()=>[]),mcpServers:$(BZ(r$).optional(),()=>[]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),u$=B({sessionId:HZ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),d$=B({sessionId:HZ,modeId:jQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),f$=fi(V([B({value:L(),type:W(`boolean`)}),B({value:PQ})]),B({sessionId:HZ,configId:NQ,_meta:$(H(F(),R()).nullish(),()=>void 0)})),p$=B({sessionId:HZ,prompt:z(YZ),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Hxe=B({uri:F(),name:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Uxe=B({name:F(),owner:F(),remoteUrl:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),m$=B({workspaceUri:$(F().nullish(),()=>void 0),workspaceFolders:z(Hxe).nullish(),repository:$(Uxe.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Wxe=V([W(`automatic`),W(`diagnostic`),W(`manual`)]),Gxe=B({uri:F(),languageId:F(),text:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Kxe=B({startLine:$r().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}),endLine:$r().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}),text:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),qxe=B({uri:F(),excerpts:z(Kxe),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Jxe=B({uri:F(),diff:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Yxe=B({action:F(),uri:F(),position:RQ,timestampMs:I(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Xxe=B({uri:F(),languageId:F(),visibleRange:$(zQ.nullish(),()=>void 0),lastFocusedMs:$(I().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Zxe=V([W(`error`),W(`warning`),W(`information`),W(`hint`)]),Qxe=B({uri:F(),range:zQ,severity:Zxe,message:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),$xe=B({recentFiles:z(Gxe).nullish(),relatedSnippets:z(qxe).nullish(),editHistory:z(Jxe).nullish(),userActions:z(Yxe).nullish(),openFiles:z(Xxe).nullish(),diagnostics:z(Qxe).nullish(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),h$=B({sessionId:HZ,uri:F(),version:I(),position:RQ,selection:zQ.nullish(),triggerKind:Wxe,context:$xe.nullish(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),g$=B({sessionId:HZ,_meta:$(H(F(),R()).nullish(),()=>void 0)});B({id:VZ,method:F(),params:V([XQ,ZQ,QQ,$Q,e$,t$,i$,a$,o$,s$,c$,l$,u$,d$,f$,p$,m$,h$,g$,CQ,wQ]).nullish()});const eSe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),tSe=B({content:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),nSe=B({optionId:eQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),rSe=B({outcome:V([B({outcome:W(`cancelled`)}),nSe.and(B({outcome:W(`selected`)}))]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),iSe=B({terminalId:XZ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),aSe=B({exitCode:$($r().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),signal:$(F().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),oSe=B({output:F(),truncated:L(),exitStatus:$(aSe.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),sSe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),cSe=B({exitCode:$($r().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),signal:$(F().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),lSe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),uSe=V([F(),I(),I(),L(),z(F())]),_$=B({content:H(F(),uSe).nullish()});V([B({id:VZ,result:V([eSe,tSe,rSe,iSe,oSe,sSe,cSe,lSe,zZ(fi(V([_$.and(B({action:W(`accept`)})),B({action:W(`decline`)}),B({action:W(`cancel`)}),RZ(B({action:F()}),`action`,[`accept`,`cancel`,`decline`])]),B({_meta:$(H(F(),R()).nullish(),()=>void 0)})),`action`,[`accept`,`cancel`,`decline`]),B({connectionId:SQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),VQ,BQ])}),B({id:VZ,error:HQ})]);const v$=B({sessionId:HZ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),y$=B({sessionId:HZ,uri:F(),languageId:F(),version:I(),text:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),dSe=B({range:zQ.nullish(),text:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),b$=B({sessionId:HZ,uri:F(),version:I(),contentChanges:IZ(BZ(dSe),()=>[]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),x$=B({sessionId:HZ,uri:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),S$=B({sessionId:HZ,uri:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),C$=B({sessionId:HZ,uri:F(),version:I(),position:RQ,visibleRange:zQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),w$=B({sessionId:HZ,id:LQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),T$=B({sessionId:HZ,id:LQ,reason:$(V([W(`rejected`),W(`ignored`),W(`replaced`),W(`cancelled`)]).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)});B({method:F(),params:V([v$,y$,b$,x$,S$,C$,w$,T$,JQ,YQ]).nullish()}),B({requestId:VZ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),_Q.and(B({mode:W(`form`)})).and(B({message:F()})),yQ.and(B({mode:W(`url`)})).and(B({message:F()})),V([cQ,lQ]).and(B({message:F()})),dQ.and(B({type:W(`string`)})),fQ.and(B({type:W(`number`)})),pQ.and(B({type:W(`integer`)})),mQ.and(B({type:W(`boolean`)})),gQ.and(B({type:W(`array`)})),hQ.and(B({type:W(`string`)})),_$.and(B({action:W(`accept`)})),B({action:W(`decline`)}),B({action:W(`cancel`)});function E$(e){return e??{}}NZ.initialize,NZ.authenticate,NZ.logout,NZ.providers_list,NZ.providers_set,NZ.providers_disable,NZ.session_new,NZ.session_load,NZ.session_list,NZ.session_delete,NZ.session_fork,NZ.session_resume,NZ.session_close,NZ.session_set_mode,NZ.session_set_config_option,NZ.session_prompt,NZ.session_cancel,NZ.nes_start,NZ.nes_suggest,NZ.nes_accept,NZ.nes_reject,NZ.nes_close,NZ.document_did_open,NZ.document_did_change,NZ.document_did_close,NZ.document_did_save,NZ.document_did_focus,PZ.session_request_permission,PZ.session_update,PZ.fs_write_text_file,PZ.fs_read_text_file,PZ.terminal_create,PZ.terminal_output,PZ.terminal_release,PZ.terminal_wait_for_exit,PZ.terminal_kill,PZ.elicitation_create,PZ.elicitation_complete,Bye.cancel_request;function D$(e,t,n){return{method:e,params:t,mapResponse:n}}function O$(e,t){return{method:e,params:t}}function k$(e){let t={};for(let n of Object.values(e))t[n.method]=n;return t}const fSe={initialize:D$(NZ.initialize,XQ),newSession:D$(NZ.session_new,i$),loadSession:D$(NZ.session_load,a$,E$),unstable_forkSession:D$(NZ.session_fork,c$),listSessions:D$(NZ.session_list,o$),deleteSession:D$(NZ.session_delete,s$,E$),resumeSession:D$(NZ.session_resume,l$),closeSession:D$(NZ.session_close,u$,E$),setSessionMode:D$(NZ.session_set_mode,d$,E$),setSessionConfigOption:D$(NZ.session_set_config_option,f$),authenticate:D$(NZ.authenticate,ZQ,E$),unstable_listProviders:D$(NZ.providers_list,QQ),unstable_setProvider:D$(NZ.providers_set,$Q,E$),unstable_disableProvider:D$(NZ.providers_disable,e$,E$),logout:D$(NZ.logout,t$,E$),prompt:D$(NZ.session_prompt,p$),unstable_startNes:D$(NZ.nes_start,m$),unstable_suggestNes:D$(NZ.nes_suggest,h$),unstable_closeNes:D$(NZ.nes_close,g$,E$)},pSe={cancel:O$(NZ.session_cancel,v$),unstable_didOpenDocument:O$(NZ.document_did_open,y$),unstable_didChangeDocument:O$(NZ.document_did_change,b$),unstable_didCloseDocument:O$(NZ.document_did_close,x$),unstable_didSaveDocument:O$(NZ.document_did_save,S$),unstable_didFocusDocument:O$(NZ.document_did_focus,C$),unstable_acceptNes:O$(NZ.nes_accept,w$),unstable_rejectNes:O$(NZ.nes_reject,T$)},mSe={requestPermission:D$(PZ.session_request_permission,tQ),writeTextFile:D$(PZ.fs_write_text_file,UZ,E$),readTextFile:D$(PZ.fs_read_text_file,WZ),createTerminal:D$(PZ.terminal_create,rQ),terminalOutput:D$(PZ.terminal_output,iQ),releaseTerminal:D$(PZ.terminal_release,aQ,E$),waitForTerminalExit:D$(PZ.terminal_wait_for_exit,oQ),killTerminal:D$(PZ.terminal_kill,sQ,E$),unstable_createElicitation:D$(PZ.elicitation_create,bQ)},hSe={sessionUpdate:O$(PZ.session_update,KQ),unstable_completeElicitation:O$(PZ.elicitation_complete,qQ)};k$(fSe),k$(pSe),k$(mSe),k$(hSe),NZ.initialize,NZ.authenticate,NZ.providers_list,NZ.providers_set,NZ.providers_disable,NZ.session_new,NZ.session_load,NZ.session_set_mode,NZ.session_set_config_option,NZ.session_prompt,NZ.session_list,NZ.session_delete,NZ.session_fork,NZ.session_resume,NZ.session_close,NZ.logout,NZ.nes_start,NZ.nes_suggest,NZ.nes_close,NZ.session_cancel,NZ.nes_accept,NZ.nes_reject,NZ.document_did_open,NZ.document_did_change,NZ.document_did_close,NZ.document_did_save,NZ.document_did_focus,PZ.session_request_permission,PZ.fs_write_text_file,PZ.fs_read_text_file,PZ.terminal_create,PZ.terminal_output,PZ.terminal_release,PZ.terminal_wait_for_exit,PZ.terminal_kill,PZ.elicitation_create,PZ.session_update,PZ.elicitation_complete;var gSe=i(((e,t)=>{var n=1e3,r=n*60,i=r*60,a=i*24,o=a*7,s=a*365.25;t.exports=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return c(e);if(n===`number`&&isFinite(e))return t.long?u(e):l(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function c(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var c=parseFloat(t[1]);switch((t[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return c*s;case`weeks`:case`week`:case`w`:return c*o;case`days`:case`day`:case`d`:return c*a;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return c*i;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return c*r;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return c*n;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return c;default:return}}}}function l(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+`d`:t>=i?Math.round(e/i)+`h`:t>=r?Math.round(e/r)+`m`:t>=n?Math.round(e/n)+`s`:e+`ms`}function u(e){var t=Math.abs(e);return t>=a?d(e,t,a,`day`):t>=i?d(e,t,i,`hour`):t>=r?d(e,t,r,`minute`):t>=n?d(e,t,n,`second`):e+` ms`}function d(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}})),A$=i(((e,t)=>{function n(e){n.debug=n,n.default=n,n.coerce=c,n.disable=o,n.enable=i,n.enabled=s,n.humanize=gSe(),n.destroy=l,Object.keys(e).forEach(t=>{n[t]=e[t]}),n.names=[],n.skips=[],n.formatters={};function t(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return n.colors[Math.abs(t)%n.colors.length]}n.selectColor=t;function n(e){let t,i=null,a,o;function s(...e){if(!s.enabled)return;let r=s,i=Number(new Date);r.diff=i-(t||i),r.prev=t,r.curr=i,t=i,e[0]=n.coerce(e[0]),typeof e[0]!=`string`&&e.unshift(`%O`);let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(t,i)=>{if(t===`%%`)return`%`;a++;let o=n.formatters[i];if(typeof o==`function`){let n=e[a];t=o.call(r,n),e.splice(a,1),a--}return t}),n.formatArgs.call(r,e),(r.log||n.log).apply(r,e)}return s.namespace=e,s.useColors=n.useColors(),s.color=n.selectColor(e),s.extend=r,s.destroy=n.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>i===null?(a!==n.namespaces&&(a=n.namespaces,o=n.enabled(e)),o):i,set:e=>{i=e}}),typeof n.init==`function`&&n.init(s),s}function r(e,t){let r=n(this.namespace+(t===void 0?`:`:t)+e);return r.log=this.log,r}function i(e){n.save(e),n.namespaces=e,n.names=[],n.skips=[];let t=(typeof e==`string`?e:``).trim().replace(/\s+/g,`,`).split(`,`).filter(Boolean);for(let e of t)e[0]===`-`?n.skips.push(e.slice(1)):n.names.push(e)}function a(e,t){let n=0,r=0,i=-1,a=0;for(;n<e.length;)if(r<t.length&&(t[r]===e[n]||t[r]===`*`))t[r]===`*`?(i=r,a=n,r++):(n++,r++);else if(i!==-1)r=i+1,a++,n=a;else return!1;for(;r<t.length&&t[r]===`*`;)r++;return r===t.length}function o(){let e=[...n.names,...n.skips.map(e=>`-`+e)].join(`,`);return n.enable(``),e}function s(e){for(let t of n.skips)if(a(e,t))return!1;for(let t of n.names)if(a(e,t))return!0;return!1}function c(e){return e instanceof Error?e.stack||e.message:e}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}t.exports=n})),_Se=i(((e,t)=>{e.formatArgs=r,e.save=i,e.load=a,e.useColors=n,e.storage=o(),e.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=`#0000CC.#0000FF.#0033CC.#0033FF.#0066CC.#0066FF.#0099CC.#0099FF.#00CC00.#00CC33.#00CC66.#00CC99.#00CCCC.#00CCFF.#3300CC.#3300FF.#3333CC.#3333FF.#3366CC.#3366FF.#3399CC.#3399FF.#33CC00.#33CC33.#33CC66.#33CC99.#33CCCC.#33CCFF.#6600CC.#6600FF.#6633CC.#6633FF.#66CC00.#66CC33.#9900CC.#9900FF.#9933CC.#9933FF.#99CC00.#99CC33.#CC0000.#CC0033.#CC0066.#CC0099.#CC00CC.#CC00FF.#CC3300.#CC3333.#CC3366.#CC3399.#CC33CC.#CC33FF.#CC6600.#CC6633.#CC9900.#CC9933.#CCCC00.#CCCC33.#FF0000.#FF0033.#FF0066.#FF0099.#FF00CC.#FF00FF.#FF3300.#FF3333.#FF3366.#FF3399.#FF33CC.#FF33FF.#FF6600.#FF6633.#FF9900.#FF9933.#FFCC00.#FFCC33`.split(`.`);function n(){if(typeof window<`u`&&window.process&&(window.process.type===`renderer`||window.process.__nwjs))return!0;if(typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<`u`&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<`u`&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<`u`&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function r(e){if(e[0]=(this.useColors?`%c`:``)+this.namespace+(this.useColors?` %c`:` `)+e[0]+(this.useColors?`%c `:` `)+`+`+t.exports.humanize(this.diff),!this.useColors)return;let n=`color: `+this.color;e.splice(1,0,n,`color: inherit`);let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,e=>{e!==`%%`&&(r++,e===`%c`&&(i=r))}),e.splice(i,0,n)}e.log=console.debug||console.log||(()=>{});function i(t){try{t?e.storage.setItem(`debug`,t):e.storage.removeItem(`debug`)}catch{}}function a(){let t;try{t=e.storage.getItem(`debug`)||e.storage.getItem(`DEBUG`)}catch{}return!t&&typeof process<`u`&&`env`in process&&(t=process.env.DEBUG),t}function o(){try{return localStorage}catch{}}t.exports=A$()(e);let{formatters:s}=t.exports;s.j=function(e){try{return JSON.stringify(e)}catch(e){return`[UnexpectedJSONParseError]: `+e.message}}})),vSe=i(((e,t)=>{t.exports=(e,t=process.argv)=>{let n=e.startsWith(`-`)?``:e.length===1?`-`:`--`,r=t.indexOf(n+e),i=t.indexOf(`--`);return r!==-1&&(i===-1||r<i)}})),ySe=i(((e,n)=>{let r=t(`os`),i=t(`tty`),a=vSe(),{env:o}=process,s;a(`no-color`)||a(`no-colors`)||a(`color=false`)||a(`color=never`)?s=0:(a(`color`)||a(`colors`)||a(`color=true`)||a(`color=always`))&&(s=1),`FORCE_COLOR`in o&&(s=o.FORCE_COLOR===`true`?1:o.FORCE_COLOR===`false`?0:o.FORCE_COLOR.length===0?1:Math.min(parseInt(o.FORCE_COLOR,10),3));function c(e){return e!==0&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function l(e,t){if(s===0)return 0;if(a(`color=16m`)||a(`color=full`)||a(`color=truecolor`))return 3;if(a(`color=256`))return 2;if(e&&!t&&s===void 0)return 0;let n=s||0;if(o.TERM===`dumb`)return n;if(process.platform===`win32`){let e=r.release().split(`.`);return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if(`CI`in o)return[`TRAVIS`,`CIRCLECI`,`APPVEYOR`,`GITLAB_CI`,`GITHUB_ACTIONS`,`BUILDKITE`].some(e=>e in o)||o.CI_NAME===`codeship`?1:n;if(`TEAMCITY_VERSION`in o)return+!!/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(o.TEAMCITY_VERSION);if(o.COLORTERM===`truecolor`)return 3;if(`TERM_PROGRAM`in o){let e=parseInt((o.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(o.TERM_PROGRAM){case`iTerm.app`:return e>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(o.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(o.TERM)||`COLORTERM`in o?1:n}function u(e){return c(l(e,e&&e.isTTY))}n.exports={supportsColor:u,stdout:c(l(!0,i.isatty(1))),stderr:c(l(!0,i.isatty(2)))}})),bSe=i(((e,n)=>{let r=t(`tty`),i=t(`util`);e.init=d,e.log=c,e.formatArgs=o,e.save=l,e.load=u,e.useColors=a,e.destroy=i.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),e.colors=[6,2,3,4,5,1];try{let t=ySe();t&&(t.stderr||t).level>=2&&(e.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}e.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{let n=t.substring(6).toLowerCase().replace(/_([a-z])/g,(e,t)=>t.toUpperCase()),r=process.env[t];return r=/^(yes|on|true|enabled)$/i.test(r)?!0:/^(no|off|false|disabled)$/i.test(r)?!1:r===`null`?null:Number(r),e[n]=r,e},{});function a(){return`colors`in e.inspectOpts?!!e.inspectOpts.colors:r.isatty(process.stderr.fd)}function o(e){let{namespace:t,useColors:r}=this;if(r){let r=this.color,i=`\x1B[3`+(r<8?r:`8;5;`+r),a=` ${i};1m${t} \u001B[0m`;e[0]=a+e[0].split(`
|
|
713
|
+
`,{customPrettifiers:s,errorLikeObjectKeys:c,hideObject:l,levelFirst:u,levelKey:d,levelLabel:f,messageFormat:p,messageKey:m,minimumLevel:h,singleLine:g,timestampKey:_,translateTime:v}=e,y=e.errorProps.split(`,`),b=typeof e.useOnlyCustomProps==`boolean`?e.useOnlyCustomProps:e.useOnlyCustomProps===`true`,x=i(e.customLevels),S=a(e.customLevels),C=o(b,x,S),w;if(e.customColors){if(typeof e.customColors==`string`)w=e.customColors.split(`,`).reduce((t,r)=>{let[i,a]=r.split(`:`),o=(b?e.customLevels:S[i]!==void 0)?S[i]:n[i],s=o===void 0?i:o;return t.push([s,a]),t},[]);else if(typeof e.customColors==`object`)w=Object.keys(e.customColors).reduce((t,r)=>{let[i,a]=[r,e.customColors[r]],o=(b?e.customLevels:S[i]!==void 0)?S[i]:n[i],s=o===void 0?i:o;return t.push([s,a]),t},[]);else throw Error(`options.customColors must be of type string or object.`)}let T={customLevels:x,customLevelNames:S};b===!0&&!e.customLevels&&(T.customLevels=void 0,T.customLevelNames=void 0);let E=e.include===void 0?void 0:new Set(e.include.split(`,`)),D=!E&&e.ignore?new Set(e.ignore.split(`,`)):void 0,O=r(e.colorize,w,b),ee=e.colorizeObjects?O:r(!1,[],!1);return{EOL:t,IDENT:` `,colorizer:O,customColors:w,customLevelNames:S,customLevels:x,customPrettifiers:s,customProperties:T,errorLikeObjectKeys:c,errorProps:y,getLevelLabelData:C,hideObject:l,ignoreKeys:D,includeKeys:E,levelFirst:u,levelKey:d,levelLabel:f,messageFormat:p,messageKey:m,minimumLevel:h,objectColorizer:ee,singleLine:g,timestampKey:_,translateTime:v,useOnlyCustomProps:b}}})),bye=jX(((e,t)=>{t.exports=s,s.default=s,s.stable=d,s.stableStringify=d;var n=`[...]`,r=`[Circular]`,i=[],a=[];function o(){return{depthLimit:2**53-1,edgesLimit:2**53-1}}function s(e,t,n,r){r===void 0&&(r=o()),l(e,``,0,[],void 0,0,r);var s;try{s=a.length===0?JSON.stringify(e,t,n):JSON.stringify(e,p(t),n)}catch{return JSON.stringify(`[unable to serialize, circular reference is too complex to analyze]`)}finally{for(;i.length!==0;){var c=i.pop();c.length===4?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}}return s}function c(e,t,n,r){var o=Object.getOwnPropertyDescriptor(r,n);o.get===void 0?(r[n]=e,i.push([r,n,t])):o.configurable?(Object.defineProperty(r,n,{value:e}),i.push([r,n,t,o])):a.push([t,n,e])}function l(e,t,i,a,o,s,u){s+=1;var d;if(typeof e==`object`&&e){for(d=0;d<a.length;d++)if(a[d]===e){c(r,e,t,o);return}if(u.depthLimit!==void 0&&s>u.depthLimit){c(n,e,t,o);return}if(u.edgesLimit!==void 0&&i+1>u.edgesLimit){c(n,e,t,o);return}if(a.push(e),Array.isArray(e))for(d=0;d<e.length;d++)l(e[d],d,d,a,e,s,u);else{var f=Object.keys(e);for(d=0;d<f.length;d++){var p=f[d];l(e[p],p,d,a,e,s,u)}}a.pop()}}function u(e,t){return e<t?-1:+(e>t)}function d(e,t,n,r){r===void 0&&(r=o());var s=f(e,``,0,[],void 0,0,r)||e,c;try{c=a.length===0?JSON.stringify(s,t,n):JSON.stringify(s,p(t),n)}catch{return JSON.stringify(`[unable to serialize, circular reference is too complex to analyze]`)}finally{for(;i.length!==0;){var l=i.pop();l.length===4?Object.defineProperty(l[0],l[1],l[3]):l[0][l[1]]=l[2]}}return c}function f(e,t,a,o,s,l,d){l+=1;var p;if(typeof e==`object`&&e){for(p=0;p<o.length;p++)if(o[p]===e){c(r,e,t,s);return}try{if(typeof e.toJSON==`function`)return}catch{return}if(d.depthLimit!==void 0&&l>d.depthLimit){c(n,e,t,s);return}if(d.edgesLimit!==void 0&&a+1>d.edgesLimit){c(n,e,t,s);return}if(o.push(e),Array.isArray(e))for(p=0;p<e.length;p++)f(e[p],p,p,o,e,l,d);else{var m={},h=Object.keys(e).sort(u);for(p=0;p<h.length;p++){var g=h[p];f(e[g],g,p,o,e,l,d),m[g]=e[g]}if(s!==void 0)i.push([s,t,e]),s[t]=m;else return m}o.pop()}}function p(e){return e=e===void 0?function(e,t){return t}:e,function(t,n){if(a.length>0)for(var r=0;r<a.length;r++){var i=a[r];if(i[1]===t&&i[0]===n){n=i[2],a.splice(r,1);break}}return e.call(this,t,n)}}})),pZ=jX(((e,t)=>{t.exports=r;let n=fZ();function r({keyName:e,lines:t,eol:r,ident:i}){let a=``,o=`${i}${e}: ${n({input:t,ident:i,eol:r})}${r}`.split(r);for(let e=0;e<o.length;e+=1){e!==0&&(a+=r);let t=o[e];if(/^\s*"stack"/.test(t)){let e=/^(\s*"stack":)\s*(".*"),?$/.exec(t);if(e&&e.length===3){let n=/^\s*/.exec(t)[0].length+4,i=` `.repeat(n),o=e[2];a+=e[1]+r+i+JSON.parse(o).replace(/\n/g,r+i)}else a+=t}else a+=t}return a}})),mZ=jX(((e,t)=>{t.exports=o;let{LOGGER_KEYS:n}=ZX(),r=bye(),i=fZ(),a=pZ();function o({log:e,excludeLoggerKeys:t=!0,skipKeys:o=[],context:s}){let{EOL:c,IDENT:l,customPrettifiers:u,errorLikeObjectKeys:d,objectColorizer:f,singleLine:p,colorizer:m}=s,h=[].concat(o);t===!0&&Array.prototype.push.apply(h,n);let g=``,{plain:_,errors:v}=Object.entries(e).reduce(({plain:t,errors:n},[r,i])=>{if(h.includes(r)===!1){let a=typeof u[r]==`function`?u[r](i,r,e,{colors:m.colors}):i;d.includes(r)?n[r]=a:t[r]=a}return{plain:t,errors:n}},{plain:{},errors:{}});return p?(Object.keys(_).length>0&&(g+=f.greyMessage(r(_))),g+=c,g=g.replace(/\\\\/gi,`\\`)):Object.entries(_).forEach(([e,t])=>{let n=typeof u[e]==`function`?t:r(t,null,2);if(n===void 0)return;n=n.replace(/\\\\/gi,`\\`);let a=i({input:n,ident:l,eol:c});g+=`${l}${f.property(e)}:${a.startsWith(c)?``:` `}${a}${c}`}),Object.entries(v).forEach(([e,t])=>{let n=typeof u[e]==`function`?t:r(t,null,2);n!==void 0&&(g+=a({keyName:e,lines:n,eol:c,ident:l}))}),g}})),hZ=jX(((e,t)=>{t.exports=o;let{LOGGER_KEYS:n}=ZX(),r=dZ(),i=fZ(),a=mZ();function o({log:e,context:t}){let{EOL:o,IDENT:s,errorProps:c,messageKey:l}=t,u=e.stack,d=`${s}${i({input:u,ident:s,eol:o})}${o}`;if(c.length>0){let i=n.concat(l,`type`,`stack`),u;u=c[0]===`*`?Object.keys(e).filter(e=>i.includes(e)===!1):c.filter(e=>i.includes(e)===!1);for(let n=0;n<u.length;n+=1){let i=u[n];if(i in e){if(r(e[i])){let n=a({log:e[i],excludeLoggerKeys:!1,context:{...t,IDENT:s+s}});d=`${d}${s}${i}: {${o}${n}${s}}${o}`;continue}d=`${d}${s}${i}: ${e[i]}${o}`}}}return d}})),gZ=jX(((e,t)=>{t.exports=r;let n=iZ();function r({log:e,context:t}){let{colorizer:r,customLevels:i,customLevelNames:a,levelKey:o,getLevelLabelData:s}=t,c=t.customPrettifiers?.level,l=n(e,o);if(l===void 0)return;let u=r(l,{customLevels:i,customLevelNames:a});if(c){let[t]=s(l);return c(l,o,e,{label:t,labelColorized:u,colors:r.colors})}return u}})),_Z=jX(((e,t)=>{t.exports=a;let{LEVELS:n}=ZX(),r=iZ(),i=uZ();function a({log:e,context:t}){let{colorizer:a,customLevels:o,levelKey:s,levelLabel:c,messageFormat:l,messageKey:u,useOnlyCustomProps:d}=t;if(l&&typeof l==`string`){let t=i(l,e),u=String(t).replace(/{([^{}]+)}/g,function(t,i){let a;if(i===c&&(a=r(e,s))!==void 0)return(d?o===void 0:o[a]===void 0)?n[a]:o[a];let l=r(e,i);return l===void 0?``:l});return a.message(u)}if(l&&typeof l==`function`){let t=l(e,u,c,{colors:a.colors});return a.message(t)}if(u in e&&(typeof e[u]==`string`||typeof e[u]==`number`||typeof e[u]==`boolean`))return a.message(e[u])}})),vZ=jX(((e,t)=>{t.exports=n;function n({log:e,context:t}){let{customPrettifiers:n,colorizer:r}=t,i=``;if(e.name||e.pid||e.hostname){if(i+=`(`,e.name&&(i+=n.name?n.name(e.name,`name`,e,{colors:r.colors}):e.name),e.pid){let t=n.pid?n.pid(e.pid,`pid`,e,{colors:r.colors}):e.pid;e.name&&e.pid?i+=`/`+t:i+=t}if(e.hostname){let t=n.hostname?n.hostname(e.hostname,`hostname`,e,{colors:r.colors}):e.hostname;i+=`${i===`(`?`on`:` on`} ${t}`}i+=`)`}if(e.caller){let t=n.caller?n.caller(e.caller,`caller`,e,{colors:r.colors}):e.caller;i+=`${i===``?``:` `}<${t}>`}if(i!==``)return i}})),yZ=jX(((e,t)=>{t.exports=r;let n=sZ();function r({log:e,context:t}){let{timestampKey:r,translateTime:i}=t,a=t.customPrettifiers?.time,o=null;if(r in e?o=e[r]:`timestamp`in e&&(o=e.timestamp),o===null)return;let s=i?n(o,i):o;return a?a(s):`[${s}]`}})),xye=jX(((e,t)=>{t.exports={buildSafeSonicBoom:gye(),createDate:nZ(),deleteLogProperty:aZ(),filterLog:oZ(),formatTime:sZ(),getPropertyValue:iZ(),handleCustomLevelsNamesOpts:cZ(),handleCustomLevelsOpts:lZ(),interpretConditionals:uZ(),isObject:dZ(),isValidDate:tZ(),joinLinesWithIndentation:fZ(),noop:eZ(),parseFactoryOptions:yye(),prettifyErrorLog:hZ(),prettifyError:pZ(),prettifyLevel:gZ(),prettifyMessage:_Z(),prettifyMetadata:vZ(),prettifyObject:mZ(),prettifyTime:yZ(),splitPropertyKey:rZ(),getLevelLabelData:QX()}})),Sye=jX(((e,t)=>{let n=typeof Buffer<`u`,r=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,i=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function a(e,t,a){a==null&&typeof t==`object`&&t&&(a=t,t=void 0),n&&Buffer.isBuffer(e)&&(e=e.toString()),e&&e.charCodeAt(0)===65279&&(e=e.slice(1));let s=JSON.parse(e,t);if(typeof s!=`object`||!s)return s;let c=a&&a.protoAction||`error`,l=a&&a.constructorAction||`error`;if(c===`ignore`&&l===`ignore`)return s;if(c!==`ignore`&&l!==`ignore`){if(r.test(e)===!1&&i.test(e)===!1)return s}else if(c!==`ignore`&&l===`ignore`){if(r.test(e)===!1)return s}else if(i.test(e)===!1)return s;return o(s,{protoAction:c,constructorAction:l,safe:a&&a.safe})}function o(e,{protoAction:t=`error`,constructorAction:n=`error`,safe:r}={}){let i=[e];for(;i.length;){let e=i;i=[];for(let a of e){if(t!==`ignore`&&Object.prototype.hasOwnProperty.call(a,`__proto__`)){if(r===!0)return null;if(t===`error`)throw SyntaxError(`Object contains forbidden prototype property`);delete a.__proto__}if(n!==`ignore`&&Object.prototype.hasOwnProperty.call(a,`constructor`)&&a.constructor!==null&&typeof a.constructor==`object`&&Object.prototype.hasOwnProperty.call(a.constructor,`prototype`)){if(r===!0)return null;if(n===`error`)throw SyntaxError(`Object contains forbidden prototype property`);delete a.constructor}for(let e in a){let t=a[e];t&&typeof t==`object`&&i.push(t)}}}return e}function s(e,t,n){let{stackTraceLimit:r}=Error;Error.stackTraceLimit=0;try{return a(e,t,n)}finally{Error.stackTraceLimit=r}}function c(e,t){let{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return a(e,t,{safe:!0})}catch{return}finally{Error.stackTraceLimit=n}}t.exports=s,t.exports.default=s,t.exports.parse=s,t.exports.safeParse=c,t.exports.scan=o})),Cye=jX(((e,t)=>{t.exports=h;let n=Sye(),r=dZ(),i=hZ(),a=gZ(),o=_Z(),s=vZ(),c=mZ(),l=yZ(),u=oZ(),{LEVELS:d,LEVEL_KEY:f,LEVEL_NAMES:p}=ZX(),m=e=>{try{return{value:n.parse(e,{protoAction:`remove`})}}catch(e){return{err:e}}};function h(e){let t;if(r(e))t=e;else{let n=m(e);if(n.err||!r(n.value))return e+this.EOL;t=n.value}if(this.minimumLevel){let e;e=this.useOnlyCustomProps?this.customLevels:this.customLevelNames[this.minimumLevel]!==void 0;let n;if(n=e?this.customLevelNames[this.minimumLevel]:p[this.minimumLevel],n||=typeof this.minimumLevel==`string`?p[this.minimumLevel]:p[d[this.minimumLevel].toLowerCase()],t[this.levelKey===void 0?f:this.levelKey]<n)return}let n=o({log:t,context:this.context});(this.ignoreKeys||this.includeKeys)&&(t=u({log:t,context:this.context}));let h=a({log:t,context:{...this.context,...this.context.customProperties}}),g=s({log:t,context:this.context}),_=l({log:t,context:this.context}),v=``;if(this.levelFirst&&h&&(v=`${h}`),_&&v===``?v=`${_}`:_&&(v=`${v} ${_}`),!this.levelFirst&&h&&(v=v.length>0?`${v} ${h}`:h),g&&(v=v.length>0?`${v} ${g}:`:g),v.endsWith(`:`)===!1&&v!==``&&(v+=`:`),n!==void 0&&(v=v.length>0?`${v} ${n}`:n),v.length>0&&!this.singleLine&&(v+=this.EOL),t.type===`Error`&&typeof t.stack==`string`){let e=i({log:t,context:this.context});this.singleLine&&(v+=this.EOL),v+=e}else if(this.hideObject===!1){let e=[this.messageKey,this.levelKey,this.timestampKey].map(e=>e.replaceAll(/\\/g,``)).filter(e=>typeof t[e]==`string`||typeof t[e]==`number`||typeof t[e]==`boolean`),n=c({log:t,skipKeys:e,context:this.context});this.singleLine&&!/^\s$/.test(n)&&(v+=` `),v+=n}return v}})),wye=jX(((e,t)=>{let{isColorSupported:n}=YX(),r=pye(),{Transform:i}=NX(`node:stream`),a=hye(),o=$X(),{ERROR_LIKE_KEYS:s,LEVEL_KEY:c,LEVEL_LABEL:l,MESSAGE_KEY:u,TIMESTAMP_KEY:d}=ZX(),{buildSafeSonicBoom:f,parseFactoryOptions:p}=xye(),m=Cye(),h={colorize:n,colorizeObjects:!0,crlf:!1,customColors:null,customLevels:null,customPrettifiers:{},errorLikeObjectKeys:s,errorProps:``,hideObject:!1,ignore:`hostname`,include:void 0,levelFirst:!1,levelKey:c,levelLabel:l,messageFormat:null,messageKey:u,minimumLevel:void 0,outputStream:process.stdout,singleLine:!1,timestampKey:d,translateTime:!0,useOnlyCustomProps:!0};function g(e){let t=p(Object.assign({},h,e));return m.bind({...t,context:t})}function _(e={}){let t=g(e),n;return a(function(a){a.on(`message`,function n(r){!r||r.code!==`PINO_CONFIG`||(Object.assign(e,{messageKey:r.config.messageKey,errorLikeObjectKeys:Array.from(new Set([...e.errorLikeObjectKeys||s,r.config.errorKey])),customLevels:r.config.levels.values}),t=g(e),a.off(`message`,n))});let o=new i({objectMode:!0,autoDestroy:!0,transform(e,n,r){r(null,t(e))}});return n=typeof e.destination==`object`&&typeof e.destination.write==`function`?e.destination:f({dest:e.destination||1,append:e.append,mkdir:e.mkdir,sync:e.sync}),a.on(`unknown`,function(e){n.write(e+`
|
|
714
|
+
`)}),r(a,o,n),o},{parse:`lines`,close(e,t){n.on(`close`,()=>{t(e)})}})}t.exports=_,t.exports.build=_,t.exports.PinoPretty=_,t.exports.prettyFactory=g,t.exports.colorizerFactory=o,t.exports.isColorSupported=n,t.exports.default=_})),bZ=MX(JX(),1),Tye=MX(wye(),1);const xZ=new Map;function Eye(e){let t=xZ.get(e);return t||(t={chain:Promise.resolve(),parentDirEnsured:!1},xZ.set(e,t)),t}var Dye=class{#e;#t;#n;#r;constructor(e){this.#e=e.currentPath,this.#t=e.previousPath,this.#n=e.maxBytes,this.#r=Eye(e.currentPath)}append(e){let t=this.#r.chain.catch(()=>void 0).then(()=>this.#i(e));return this.#r.chain=t,t}async drain(){await this.#r.chain.catch(()=>void 0)}async#i(e){this.#r.parentDirEnsured||(await Ce(M(this.#e),{recursive:!0}),this.#r.parentDirEnsured=!0),await Ee(this.#e,e,{flag:`a`});let t;try{t=te(this.#e).size}catch{this.#r.parentDirEnsured=!1;return}if(t>this.#n)try{await Te(this.#e,this.#t)}catch(e){if(e?.code!==`ENOENT`)throw e}}};const SZ=[`.ok`,`local`,`logs`];function Oye(e){return N(e,...SZ,`server-current.jsonl`)}function kye(e){return N(e,...SZ,`server-prev.jsonl`)}var CZ=class extends Fe{#e;#t=0;#n=0;constructor(e){super({decodeStrings:!1}),this.#e=new Dye({currentPath:Oye(e.projectDir),previousPath:kye(e.projectDir),maxBytes:e.maxBytes})}_write(e,t,n){this.#e.append(e).then(()=>n(),e=>{this.#r(e),n()})}#r(e){let t=Date.now();if(t-this.#t<5e3){this.#n++;return}this.#i(e instanceof Error?e.message:String(e),t)}#i(e,t){let n=this.#n;this.#n=0,this.#t=t,console.error(JSON.stringify({event:`pino-file-sink-write-dropped`,error:e,suppressed:n}))}async drain(){await this.#e.drain(),this.#n>0&&this.#i(`flushed at drain`,Date.now())}};function Aye(){let e=as.getSpan(ns.active());if(!e)return{};let t=e.spanContext();return{trace_id:t.traceId,span_id:t.spanId,trace_flags:t.traceFlags}}function jye(){return process.env.NO_COLOR&&process.env.NO_COLOR!==``?!1:process.stdout.isTTY??!1}const wZ=new Set([`fatal`,`error`,`warn`,`info`,`debug`,`trace`,`silent`]);function TZ(e){return e===`silent`?1/0:bZ.default.levels.values[e]??bZ.default.levels.values.info}function EZ(e,t){return TZ(e)<=TZ(t)?e:t}var Mye=class{name;transportConfigs=[];fileSinkOpts;redactPaths;activeFileSink;pinoInstance;options;constructor(e,t={}){this.name=e,this.options={name:this.name,level:process.env.LOG_LEVEL||(process.env.NODE_ENV===`test`?`silent`:`info`),serializers:{err:bZ.default.stdSerializers.err,error:bZ.default.stdSerializers.err},mixin:Aye,...t.options},t.transportConfigs&&(this.transportConfigs=t.transportConfigs),t.fileSink&&(this.fileSinkOpts=t.fileSink),t.redactPaths&&t.redactPaths.length>0&&(this.redactPaths=t.redactPaths,this.options={...this.options,redact:{paths:[...t.redactPaths],censor:`[REDACTED]`}}),this.pinoInstance=this.buildInstance()}resolveStreamLevels(){let e=this.options.level??`info`,t=process.env.OK_FILE_LEVEL?.toLowerCase(),n=t&&wZ.has(t)?t:e===`silent`?`silent`:EZ(e,`debug`),r=process.env.OK_CONSOLE_LEVEL?.toLowerCase(),i=r&&wZ.has(r)?r:e;return{fileLevel:n,consoleLevel:i,instanceLevel:EZ(n,i)}}buildInstance(){this.activeFileSink=void 0;let{fileLevel:e,consoleLevel:t,instanceLevel:n}=this.resolveStreamLevels();if(this.transportConfigs.length>0)return(0,bZ.default)(this.options,bZ.default.transport({targets:this.transportConfigs}));let r;try{r=(0,Tye.default)({colorize:jye(),translateTime:`HH:MM:ss`,ignore:`pid,hostname`})}catch(r){if(console.warn(`[PinoLogger] pino-pretty failed, falling back to JSON:`,r),this.fileSinkOpts){let t=new CZ(this.fileSinkOpts);return this.activeFileSink=t,(0,bZ.default)({...this.options,level:n},bZ.default.multistream([{stream:t,level:e}]))}return(0,bZ.default)({...this.options,level:t})}if(this.fileSinkOpts){let i=new CZ(this.fileSinkOpts);return this.activeFileSink=i,(0,bZ.default)({...this.options,level:n},bZ.default.multistream([{stream:r,level:t},{stream:i,level:e}]))}return(0,bZ.default)({...this.options,level:t},r)}recreateInstance(){typeof this.pinoInstance.flush==`function`&&this.pinoInstance.flush(),this.pinoInstance=this.buildInstance()}addTransport(e){this.transportConfigs.push(e),this.recreateInstance()}removeTransport(e){e>=0&&e<this.transportConfigs.length&&(this.transportConfigs.splice(e,1),this.recreateInstance())}getTransports(){return[...this.transportConfigs]}updateOptions(e){this.options={...this.options,...e},this.recreateInstance()}reconfigure(e){e.options&&(this.options={...this.options,...e.options}),e.transportConfigs&&(this.transportConfigs=e.transportConfigs),e.fileSink&&(this.fileSinkOpts=e.fileSink),e.redactPaths&&e.redactPaths.length>0&&(this.redactPaths=e.redactPaths,this.options={...this.options,redact:{paths:[...e.redactPaths],censor:`[REDACTED]`}}),this.recreateInstance()}getPinoInstance(){return this.pinoInstance}async flushFileSink(){this.activeFileSink&&await this.activeFileSink.drain()}error(e,t){this.pinoInstance.error(e,t)}warn(e,t){this.pinoInstance.warn(e,t)}info(e,t){this.pinoInstance.info(e,t)}debug(e,t){this.pinoInstance.debug(e,t)}};const Nye=new class{config={};loggers=new Map;configure(e){if(this.config=e,e.pinoConfig&&!e.defaultLogger&&!e.loggerFactory){for(let t of this.loggers.values())t.reconfigure(e.pinoConfig);return}this.loggers.clear()}getLogger(e){let t=this.loggers.get(e);if(t)return t;let n;return n=this.config.loggerFactory?this.config.loggerFactory(e):this.config.defaultLogger?this.config.defaultLogger:new Mye(e,this.config.pinoConfig),this.loggers.set(e,n),n}reset(){this.config={},this.loggers.clear()}async flushAllFileSinks(){let e=[];for(let t of this.loggers.values())e.push(t.flushFileSink());await Promise.all(e)}};function DZ(e){return Nye.getLogger(e)}new Xq({extensions:DB,deriveStructuralFreshness:!0}),Mv(DB);var OZ=class{kind;projectRoot;projectSubPath;gitPath;gitDir;cachedCommonDir;constructor(e,t,n,r,i){this.kind=e,this.projectRoot=t,this.projectSubPath=n,this.gitPath=r,this.gitDir=i}readCommonDir(){if(this.cachedCommonDir!==void 0)return{kind:`resolved`,path:this.cachedCommonDir};let e=this.gitDir;try{let t=S(N(this.gitDir,`commondir`),`utf-8`).trim();t.length>0&&(e=ge(t)?t:be(this.gitDir,t))}catch(e){if(!AZ(e))return{kind:`unreadable`,cause:e}}return this.cachedCommonDir=e,{kind:`resolved`,path:e}}readHead(){let e;try{e=S(N(this.gitDir,`HEAD`),`utf-8`).trim()}catch(e){return AZ(e)?{kind:`absent`}:{kind:`unreadable`,cause:e}}let t=/^ref:[ \t]*(refs\/heads\/(.+))$/.exec(e);return t?.[2]?{kind:`branch`,branch:t[2],ref:t[1]}:MZ(e)?{kind:`detached`,oid:e}:{kind:`malformed`,raw:e}}readRemoteUrl(e){let t=this.readCommonDir();if(t.kind===`unreadable`)return t;let n;try{n=S(N(t.path,`config`),`utf-8`)}catch(e){return AZ(e)?{kind:`absent`,reason:`config-missing`}:{kind:`unreadable`,cause:e}}let r=Iye(n,e);return r===null?{kind:`absent`,reason:`remote-missing`}:{kind:`configured`,url:r}}readRef(e){if(!jZ(e))return{kind:`invalid`};let t=this.readCommonDir();if(t.kind===`unreadable`)return t;let n=be(t.path,e),r=ye(t.path,n);if(r.startsWith(`..`)||ge(r))return{kind:`invalid`};try{let e=S(n,`utf-8`).trim(),t=zye(e);return t===null?{kind:`malformed`,raw:e}:{kind:`present`,storage:`loose`,value:t}}catch(e){if(!AZ(e))return{kind:`unreadable`,cause:e}}let i;try{i=S(N(t.path,`packed-refs`),`utf-8`)}catch(e){return AZ(e)?{kind:`absent`}:{kind:`unreadable`,cause:e}}for(let t of i.split(/\r?\n/)){let n=t.trim();if(n.length===0||n.startsWith(`#`)||n.startsWith(`^`))continue;let r=n.split(/\s+/);if(r.length===2&&r[1]===e)return MZ(r[0])?{kind:`present`,storage:`packed`,value:{kind:`oid`,oid:r[0]}}:{kind:`malformed`,raw:n}}return{kind:`absent`}}};function Pye(e){return kZ(be(e),``)}function Fye(e){let t=be(e),n=be(k());if(t===n)return{kind:`absent`};let r=kZ(t,``);if(r.kind!==`absent`)return r;let i=t;for(let e=0;e<64;e++){if(i===n)return{kind:`absent`};let e=M(i);if(e===i||e===n)return{kind:`absent`};let r=kZ(e,ye(e,t));if(r.kind!==`absent`)return r;i=e}return{kind:`absent`}}function kZ(e,t){let n=N(e,`.git`),r;try{r=te(n)}catch(e){return AZ(e)?{kind:`absent`}:{kind:`inaccessible`,gitPath:n,cause:e}}if(r.isDirectory())return{kind:`repository`,repository:new OZ(`directory`,e,t,n,n)};if(!r.isFile())return{kind:`absent`};let i;try{i=S(n,`utf-8`).trim()}catch(e){return{kind:`malformed-pointer`,gitPath:n,target:``,cause:e}}let a=/^gitdir:[ \t]*(.+)$/.exec(i);if(!a)return{kind:`malformed-pointer`,gitPath:n,target:``};let o=a[1].trim(),s=ge(o)?o:be(e,o);try{if(!te(s).isDirectory())return{kind:`malformed-pointer`,gitPath:n,target:s}}catch(e){return{kind:`malformed-pointer`,gitPath:n,target:s,cause:e}}return{kind:`repository`,repository:new OZ(`linked`,e,t,n,s)}}function Iye(e,t){let n=!1;for(let r of e.split(/\r?\n/)){let e=Lye(r);if(e.length===0)continue;if(e.startsWith(`[`)){n=/^\[\s*remote\s+["'](.+)["']\s*\]$/.exec(e)?.[1]===t;continue}if(!n)continue;let i=/^url\s*=\s*(.*)$/.exec(e);if(!i)continue;let a=Rye(i[1]);if(a.length>0)return a}return null}function Lye(e){let t=e.search(/[;#]/);return(t===-1?e:e.slice(0,t)).trim()}function Rye(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?t.slice(1,-1):t}function AZ(e){let t=e?.code;return t===`ENOENT`||t===`ENOTDIR`}function jZ(e){return e.startsWith(`refs/`)&&!e.includes(`\0`)&&!e.includes(`\\`)&&!e.includes(`..`)&&!e.includes(`//`)&&!e.endsWith(`/`)}function zye(e){if(e.length===0)return null;let t=/^ref:[ \t]*(refs\/.+)$/.exec(e);return t?jZ(t[1])?{kind:`symbolic`,target:t[1]}:null:MZ(e)?{kind:`oid`,oid:e}:null}function MZ(e){return/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(e)}new Set(Yie);const Bye=[`-dev`,...Object.values(eu).map(e=>e.mcpServerName.slice(Jie.length)).filter(e=>e!==``)];RegExp(`^open[-_ ]?knowledge(?:${Bye.join(`|`)})?$`),new Set(Object.values(eu).map(gu));const NZ={initialize:`initialize`,authenticate:`authenticate`,providers_list:`providers/list`,providers_set:`providers/set`,providers_disable:`providers/disable`,session_new:`session/new`,session_load:`session/load`,session_set_mode:`session/set_mode`,session_set_config_option:`session/set_config_option`,session_prompt:`session/prompt`,session_cancel:`session/cancel`,mcp_message:`mcp/message`,session_list:`session/list`,session_delete:`session/delete`,session_fork:`session/fork`,session_resume:`session/resume`,session_close:`session/close`,logout:`logout`,nes_start:`nes/start`,nes_suggest:`nes/suggest`,nes_accept:`nes/accept`,nes_reject:`nes/reject`,nes_close:`nes/close`,document_did_open:`document/didOpen`,document_did_change:`document/didChange`,document_did_close:`document/didClose`,document_did_save:`document/didSave`,document_did_focus:`document/didFocus`},PZ={session_request_permission:`session/request_permission`,session_update:`session/update`,fs_write_text_file:`fs/write_text_file`,fs_read_text_file:`fs/read_text_file`,terminal_create:`terminal/create`,terminal_output:`terminal/output`,terminal_release:`terminal/release`,terminal_wait_for_exit:`terminal/wait_for_exit`,terminal_kill:`terminal/kill`,mcp_connect:`mcp/connect`,mcp_message:`mcp/message`,mcp_disconnect:`mcp/disconnect`,elicitation_create:`elicitation/create`,elicitation_complete:`elicitation/complete`},Vye={cancel_request:`$/cancel_request`},FZ=Symbol(`skippedItem`);function $(e,t){return e.catch(t)}function IZ(e,t){let n=e.catch(t);return R().transform((e,t)=>e===void 0?(t.addIssue({code:`custom`,message:`Required value is missing`}),nt):n.parse(e))}function LZ(e,t){if(typeof e!=`object`||!e||Array.isArray(e))return;let n=e[t];return typeof n==`string`?n:void 0}function RZ(e,t,n){return e.superRefine((e,r)=>{let i=LZ(e,t);i!==void 0&&n.includes(i)&&r.addIssue({code:`custom`,path:[t],message:`${t} ${JSON.stringify(i)} is reserved by a known variant, but the value does not match that variant's schema`})})}function zZ(e,t,n){return R().transform((r,i)=>{let a=e.safeParse(r);if(!a.success){for(let e of a.error.issues)i.addIssue({...e,input:r});return nt}let o=a.data,s=LZ(r,t);if(s!==void 0&&!n.includes(s)){let e=r;for(let[t,n]of Object.entries(e))t!==`__proto__`&&(Object.hasOwn(o,t)||(o[t]=n))}return o})}function BZ(e){return z(e.catch(FZ)).transform(e=>e.filter(e=>e!==FZ))}const VZ=V([I(),F()]).nullable(),HZ=F(),UZ=B({sessionId:HZ,path:F(),content:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),WZ=B({sessionId:HZ,path:F(),line:$($r().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),limit:$($r().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),GZ=F(),KZ=V([W(`read`),W(`edit`),W(`delete`),W(`move`),W(`search`),W(`execute`),W(`think`),W(`fetch`),W(`switch_mode`),W(`other`)]),qZ=V([W(`pending`),W(`in_progress`),W(`completed`),W(`failed`)]),JZ=B({audience:$(BZ(V([W(`assistant`),W(`user`)])).nullish(),()=>void 0),lastModified:$(F().nullish(),()=>void 0),priority:$(I().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Hye=B({annotations:$(JZ.nullish(),()=>void 0),text:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Uye=B({annotations:$(JZ.nullish(),()=>void 0),data:F(),mimeType:F(),uri:$(F().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Wye=B({annotations:$(JZ.nullish(),()=>void 0),data:F(),mimeType:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Gye=B({annotations:$(JZ.nullish(),()=>void 0),description:$(F().nullish(),()=>void 0),mimeType:$(F().nullish(),()=>void 0),name:F(),size:$(I().nullish(),()=>void 0),title:$(F().nullish(),()=>void 0),uri:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Kye=V([B({mimeType:$(F().nullish(),()=>void 0),text:F(),uri:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),B({blob:F(),mimeType:$(F().nullish(),()=>void 0),uri:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)})]),qye=B({annotations:$(JZ.nullish(),()=>void 0),resource:Kye,_meta:$(H(F(),R()).nullish(),()=>void 0)}),YZ=V([Hye.and(B({type:W(`text`)})),Uye.and(B({type:W(`image`)})),Wye.and(B({type:W(`audio`)})),Gye.and(B({type:W(`resource_link`)})),qye.and(B({type:W(`resource`)}))]),Jye=B({content:YZ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),Yye=B({path:F(),oldText:$(F().nullish(),()=>void 0),newText:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),XZ=F(),Xye=B({terminalId:XZ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),ZZ=V([Jye.and(B({type:W(`content`)})),Yye.and(B({type:W(`diff`)})),Xye.and(B({type:W(`terminal`)}))]),QZ=B({path:F(),line:$($r().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),$Z=B({toolCallId:GZ,kind:$(KZ.nullish(),()=>void 0),status:$(qZ.nullish(),()=>void 0),title:$(F().nullish(),()=>void 0),content:$(BZ(ZZ).nullish(),()=>void 0),locations:$(BZ(QZ).nullish(),()=>void 0),rawInput:$(R().optional(),()=>void 0),rawOutput:$(R().optional(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),eQ=F(),Zye=V([W(`allow_once`),W(`allow_always`),W(`reject_once`),W(`reject_always`)]),tQ=B({sessionId:HZ,toolCall:$Z,options:z(B({optionId:eQ,name:F(),kind:Zye,_meta:$(H(F(),R()).nullish(),()=>void 0)})),_meta:$(H(F(),R()).nullish(),()=>void 0)}),nQ=B({name:F(),value:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),rQ=B({sessionId:HZ,command:F(),args:$(BZ(F()).optional(),()=>[]),env:$(BZ(nQ).optional(),()=>[]),cwd:$(F().nullish(),()=>void 0),outputByteLimit:$(I().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),iQ=B({sessionId:HZ,terminalId:XZ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),aQ=B({sessionId:HZ,terminalId:XZ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),oQ=B({sessionId:HZ,terminalId:XZ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),sQ=B({sessionId:HZ,terminalId:XZ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),cQ=B({sessionId:HZ,toolCallId:$(GZ.nullish(),()=>void 0)}),lQ=B({requestId:VZ}),Qye=W(`object`),$ye=V([W(`email`),W(`uri`),W(`date`),W(`date-time`)]),uQ=B({const:F(),title:F(),description:$(F().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),dQ=B({title:$(F().nullish(),()=>void 0),description:$(F().nullish(),()=>void 0),minLength:$r().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),maxLength:$r().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),pattern:F().nullish(),format:$ye.nullish(),default:$(F().nullish(),()=>void 0),enum:z(F()).nullish(),oneOf:z(uQ).nullish(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),fQ=B({title:$(F().nullish(),()=>void 0),description:$(F().nullish(),()=>void 0),minimum:I().nullish(),maximum:I().nullish(),default:$(I().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),pQ=B({title:$(F().nullish(),()=>void 0),description:$(F().nullish(),()=>void 0),minimum:I().nullish(),maximum:I().nullish(),default:$(I().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),mQ=B({title:$(F().nullish(),()=>void 0),description:$(F().nullish(),()=>void 0),default:$(L().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),hQ=B({enum:z(F()),_meta:$(H(F(),R()).nullish(),()=>void 0)}),ebe=B({anyOf:z(uQ),_meta:$(H(F(),R()).nullish(),()=>void 0)}),tbe=zZ(V([hQ.and(B({type:W(`string`)})),RZ(B({type:F()}),`type`,[`string`]),ebe]),`type`,[`string`]),gQ=B({title:$(F().nullish(),()=>void 0),description:$(F().nullish(),()=>void 0),minItems:I().nullish(),maxItems:I().nullish(),items:tbe,default:$(BZ(F()).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),nbe=zZ(V([dQ.and(B({type:W(`string`)})),fQ.and(B({type:W(`number`)})),pQ.and(B({type:W(`integer`)})),mQ.and(B({type:W(`boolean`)})),gQ.and(B({type:W(`array`)})),RZ(B({type:F()}),`type`,[`array`,`boolean`,`integer`,`number`,`string`])]),`type`,[`array`,`boolean`,`integer`,`number`,`string`]),rbe=B({type:$(Qye.optional().default(`object`),()=>`object`),title:$(F().nullish(),()=>void 0),properties:H(F(),nbe).optional().default({}),required:z(F()).nullish(),description:$(F().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),_Q=fi(V([cQ,lQ]),B({requestedSchema:rbe})),vQ=F(),yQ=fi(V([cQ,lQ]),B({elicitationId:vQ,url:Gr()})),bQ=zZ(fi(V([_Q.and(B({mode:W(`form`)})),yQ.and(B({mode:W(`url`)})),RZ(fi(V([cQ,lQ]),B({mode:F()})),`mode`,[`form`,`url`])]),B({message:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)})),`mode`,[`form`,`url`]),xQ=F(),ibe=B({serverId:xQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),SQ=F(),CQ=B({connectionId:SQ,method:F(),params:H(F(),R()).nullish(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),abe=B({connectionId:SQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),wQ=R();B({id:VZ,method:F(),params:V([UZ,WZ,tQ,rQ,iQ,aQ,oQ,sQ,bQ,ibe,CQ,abe,wQ]).nullish()});const TQ=$r().gte(0).lte(65535),obe=B({image:$(L().optional().default(!1),()=>!1),audio:$(L().optional().default(!1),()=>!1),embeddedContext:$(L().optional().default(!1),()=>!1),_meta:$(H(F(),R()).nullish(),()=>void 0)}),sbe=B({http:$(L().optional().default(!1),()=>!1),sse:$(L().optional().default(!1),()=>!1),acp:$(L().optional().default(!1),()=>!1),_meta:$(H(F(),R()).nullish(),()=>void 0)}),cbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),lbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),ube=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),dbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),fbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),pbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),mbe=B({list:$(cbe.nullish(),()=>void 0),delete:$(lbe.nullish(),()=>void 0),additionalDirectories:$(ube.nullish(),()=>void 0),fork:$(dbe.nullish(),()=>void 0),resume:$(fbe.nullish(),()=>void 0),close:$(pbe.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),hbe=B({logout:$(B({_meta:$(H(F(),R()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),gbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),_be=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),vbe=B({syncKind:V([W(`full`),W(`incremental`)]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),ybe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),bbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),xbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),Sbe=B({document:$(B({didOpen:$(_be.nullish(),()=>void 0),didChange:$(vbe.nullish(),()=>void 0),didClose:$(ybe.nullish(),()=>void 0),didSave:$(bbe.nullish(),()=>void 0),didFocus:$(xbe.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Cbe=B({maxCount:$($r().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),wbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),Tbe=B({maxCount:$($r().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Ebe=B({maxCount:$($r().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Dbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),Obe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),kbe=B({recentFiles:$(Cbe.nullish(),()=>void 0),relatedSnippets:$(wbe.nullish(),()=>void 0),editHistory:$(Tbe.nullish(),()=>void 0),userActions:$(Ebe.nullish(),()=>void 0),openFiles:$(Dbe.nullish(),()=>void 0),diagnostics:$(Obe.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Abe=B({events:$(Sbe.nullish(),()=>void 0),context:$(kbe.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),EQ=V([W(`utf-16`),W(`utf-32`),W(`utf-8`)]),jbe=B({loadSession:$(L().optional().default(!1),()=>!1),promptCapabilities:$(obe.optional().default({image:!1,audio:!1,embeddedContext:!1}),()=>({image:!1,audio:!1,embeddedContext:!1})),mcpCapabilities:$(sbe.optional().default({http:!1,sse:!1,acp:!1}),()=>({http:!1,sse:!1,acp:!1})),sessionCapabilities:$(mbe.optional().default({}),()=>({})),auth:$(hbe.optional().default({}),()=>({})),providers:$(gbe.nullish(),()=>void 0),nes:$(Abe.nullish(),()=>void 0),positionEncoding:$(EQ.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),DQ=F(),Mbe=B({name:F(),label:$(F().nullish(),()=>void 0),secret:$(L().optional().default(!0),()=>!0),optional:$(L().optional().default(!1),()=>!1),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Nbe=B({id:DQ,name:F(),description:$(F().nullish(),()=>void 0),vars:IZ(BZ(Mbe),()=>[]),link:$(F().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Pbe=B({id:DQ,name:F(),description:$(F().nullish(),()=>void 0),args:$(BZ(F()).optional(),()=>[]),env:$(H(F(),F()).optional(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Fbe=B({id:DQ,name:F(),description:$(F().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Ibe=V([Nbe.and(B({type:W(`env_var`)})),Pbe.and(B({type:W(`terminal`)})),Fbe]),OQ=B({name:F(),title:$(F().nullish(),()=>void 0),version:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Lbe=B({protocolVersion:TQ,agentCapabilities:$(jbe.optional().default({loadSession:!1,promptCapabilities:{image:!1,audio:!1,embeddedContext:!1},mcpCapabilities:{http:!1,sse:!1,acp:!1},sessionCapabilities:{},auth:{}}),()=>({loadSession:!1,promptCapabilities:{image:!1,audio:!1,embeddedContext:!1},mcpCapabilities:{http:!1,sse:!1,acp:!1},sessionCapabilities:{},auth:{}})),authMethods:$(BZ(Ibe).optional().default([]),()=>[]),agentInfo:$(OQ.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Rbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),kQ=F(),AQ=V([W(`anthropic`),W(`openai`),W(`azure`),W(`vertex`),W(`bedrock`),F()]),zbe=B({apiType:AQ,baseUrl:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Bbe=B({providers:z(B({providerId:kQ,supported:IZ(BZ(AQ),()=>[]),required:L(),current:zbe.nullish(),_meta:$(H(F(),R()).nullish(),()=>void 0)})),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Vbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),Hbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),Ube=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),jQ=F(),MQ=B({currentModeId:jQ,availableModes:IZ(BZ(B({id:jQ,name:F(),description:$(F().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)})),()=>[]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),NQ=F(),Wbe=V([W(`mode`),W(`model`),W(`model_config`),W(`thought_level`),F()]),PQ=F(),FQ=B({value:PQ,name:F(),description:$(F().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Gbe=B({group:F(),name:F(),options:IZ(BZ(FQ),()=>[]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Kbe=B({currentValue:PQ,options:V([z(FQ),z(Gbe)])}),qbe=B({currentValue:L()}),IQ=fi(V([Kbe.and(B({type:W(`select`)})),qbe.and(B({type:W(`boolean`)}))]),B({id:NQ,name:F(),description:$(F().nullish(),()=>void 0),category:$(Wbe.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)})),Jbe=B({sessionId:HZ,modes:$(MQ.nullish(),()=>void 0),configOptions:$(BZ(IQ).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Ybe=B({modes:$(MQ.nullish(),()=>void 0),configOptions:$(BZ(IQ).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Xbe=B({sessions:IZ(BZ(B({sessionId:HZ,cwd:F(),additionalDirectories:$(BZ(F()).optional(),()=>[]),title:$(F().nullish(),()=>void 0),updatedAt:$(F().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)})),()=>[]),nextCursor:$(F().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Zbe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),Qbe=B({sessionId:HZ,modes:$(MQ.nullish(),()=>void 0),configOptions:$(BZ(IQ).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),$be=B({modes:$(MQ.nullish(),()=>void 0),configOptions:$(BZ(IQ).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),exe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),txe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),nxe=B({configOptions:IZ(BZ(IQ),()=>[]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),rxe=B({stopReason:V([W(`end_turn`),W(`max_tokens`),W(`max_turn_requests`),W(`refusal`),W(`cancelled`)]),usage:$(B({totalTokens:I(),inputTokens:I(),outputTokens:I(),thoughtTokens:$(I().nullish(),()=>void 0),cachedReadTokens:$(I().nullish(),()=>void 0),cachedWriteTokens:$(I().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),ixe=B({sessionId:HZ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),LQ=F(),RQ=B({line:$r().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}),character:$r().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}),_meta:$(H(F(),R()).nullish(),()=>void 0)}),zQ=B({start:RQ,end:RQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),axe=B({range:zQ,newText:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),oxe=B({id:LQ,uri:F(),edits:z(axe),cursorPosition:$(RQ.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),sxe=B({id:LQ,uri:F(),position:RQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),cxe=B({id:LQ,uri:F(),position:RQ,newName:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),lxe=B({id:LQ,uri:F(),search:F(),replace:F(),isRegex:L().nullish(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),uxe=B({suggestions:z(V([oxe.and(B({kind:W(`edit`)})),sxe.and(B({kind:W(`jump`)})),cxe.and(B({kind:W(`rename`)})),lxe.and(B({kind:W(`searchAndReplace`)}))])),_meta:$(H(F(),R()).nullish(),()=>void 0)}),dxe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),BQ=R(),VQ=R(),HQ=B({code:V([W(-32700),W(-32600),W(-32601),W(-32602),W(-32603),W(-32800),W(-32e3),W(-32002),$r().min(-2147483648,{error:`Invalid value: Expected int32 to be >= -2147483648`}).max(2147483647,{error:`Invalid value: Expected int32 to be <= 2147483647`})]),message:F(),data:$(R().optional(),()=>void 0)});V([B({id:VZ,result:V([Lbe,Rbe,Bbe,Vbe,Hbe,Ube,Jbe,Ybe,Xbe,Zbe,Qbe,$be,exe,txe,nxe,rxe,ixe,uxe,dxe,BQ,VQ])}),B({id:VZ,error:HQ})]);const UQ=B({content:YZ,messageId:$(F().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),fxe=B({toolCallId:GZ,title:F(),kind:$(KZ.optional(),()=>void 0),status:$(qZ.optional(),()=>void 0),content:$(BZ(ZZ).optional(),()=>[]),locations:$(BZ(QZ).optional(),()=>[]),rawInput:$(R().optional(),()=>void 0),rawOutput:$(R().optional(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),pxe=V([W(`high`),W(`medium`),W(`low`)]),mxe=V([W(`pending`),W(`in_progress`),W(`completed`)]),WQ=B({content:F(),priority:pxe,status:mxe,_meta:$(H(F(),R()).nullish(),()=>void 0)}),hxe=B({entries:IZ(BZ(WQ),()=>[]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),GQ=F(),gxe=B({planId:GQ,entries:IZ(BZ(WQ),()=>[]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),_xe=B({planId:GQ,uri:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),vxe=B({planId:GQ,content:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),yxe=B({plan:V([gxe.and(B({type:W(`items`)})),_xe.and(B({type:W(`file`)})),vxe.and(B({type:W(`markdown`)}))]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),bxe=B({planId:GQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),xxe=B({hint:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Sxe=B({availableCommands:IZ(BZ(B({name:F(),description:F(),input:$(xxe.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)})),()=>[]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Cxe=B({currentModeId:jQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),wxe=B({configOptions:IZ(BZ(IQ),()=>[]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Txe=B({title:$(F().nullish(),()=>void 0),updatedAt:$(F().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Exe=B({amount:I(),currency:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Dxe=B({used:I(),size:I(),cost:$(Exe.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),KQ=B({sessionId:HZ,update:V([UQ.and(B({sessionUpdate:W(`user_message_chunk`)})),UQ.and(B({sessionUpdate:W(`agent_message_chunk`)})),UQ.and(B({sessionUpdate:W(`agent_thought_chunk`)})),fxe.and(B({sessionUpdate:W(`tool_call`)})),$Z.and(B({sessionUpdate:W(`tool_call_update`)})),hxe.and(B({sessionUpdate:W(`plan`)})),yxe.and(B({sessionUpdate:W(`plan_update`)})),bxe.and(B({sessionUpdate:W(`plan_removed`)})),Sxe.and(B({sessionUpdate:W(`available_commands_update`)})),Cxe.and(B({sessionUpdate:W(`current_mode_update`)})),wxe.and(B({sessionUpdate:W(`config_option_update`)})),Txe.and(B({sessionUpdate:W(`session_info_update`)})),Dxe.and(B({sessionUpdate:W(`usage_update`)}))]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),qQ=B({elicitationId:vQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),JQ=B({connectionId:SQ,method:F(),params:$(H(F(),R()).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),YQ=R();B({method:F(),params:V([KQ,qQ,JQ,YQ]).nullish()});const Oxe=B({readTextFile:$(L().optional().default(!1),()=>!1),writeTextFile:$(L().optional().default(!1),()=>!1),_meta:$(H(F(),R()).nullish(),()=>void 0)}),kxe=B({configOptions:$(B({boolean:$(B({_meta:$(H(F(),R()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Axe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),jxe=B({terminal:$(L().optional().default(!1),()=>!1),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Mxe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),Nxe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),Pxe=B({form:$(Mxe.nullish(),()=>void 0),url:$(Nxe.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Fxe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),Ixe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),Lxe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),Rxe=B({jump:$(Fxe.nullish(),()=>void 0),rename:$(Ixe.nullish(),()=>void 0),searchAndReplace:$(Lxe.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),XQ=B({protocolVersion:TQ,clientCapabilities:$(B({fs:$(Oxe.optional().default({readTextFile:!1,writeTextFile:!1}),()=>({readTextFile:!1,writeTextFile:!1})),terminal:$(L().optional().default(!1),()=>!1),session:$(kxe.nullish(),()=>void 0),plan:$(Axe.nullish(),()=>void 0),auth:$(jxe.optional().default({terminal:!1}),()=>({terminal:!1})),elicitation:$(Pxe.nullish(),()=>void 0),nes:$(Rxe.nullish(),()=>void 0),positionEncodings:$(BZ(EQ).optional(),()=>[]),_meta:$(H(F(),R()).nullish(),()=>void 0)}).optional().default({fs:{readTextFile:!1,writeTextFile:!1},terminal:!1,auth:{terminal:!1}}),()=>({fs:{readTextFile:!1,writeTextFile:!1},terminal:!1,auth:{terminal:!1}})),clientInfo:$(OQ.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),ZQ=B({methodId:DQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),QQ=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),$Q=B({providerId:kQ,apiType:AQ,baseUrl:F(),headers:H(F(),F()).optional(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),e$=B({providerId:kQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),t$=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),n$=B({name:F(),value:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),zxe=B({name:F(),url:F(),headers:z(n$),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Bxe=B({name:F(),url:F(),headers:z(n$),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Vxe=B({name:F(),serverId:xQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),Hxe=B({name:F(),command:F(),args:z(F()),env:z(nQ),_meta:$(H(F(),R()).nullish(),()=>void 0)}),r$=V([zxe.and(B({type:W(`http`)})),Bxe.and(B({type:W(`sse`)})),Vxe.and(B({type:W(`acp`)})),Hxe]),i$=B({cwd:F(),additionalDirectories:$(BZ(F()).optional(),()=>[]),mcpServers:IZ(BZ(r$),()=>[]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),a$=B({mcpServers:IZ(BZ(r$),()=>[]),cwd:F(),additionalDirectories:$(BZ(F()).optional(),()=>[]),sessionId:HZ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),o$=B({cwd:F().nullish(),cursor:F().nullish(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),s$=B({sessionId:HZ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),c$=B({sessionId:HZ,cwd:F(),additionalDirectories:$(BZ(F()).optional(),()=>[]),mcpServers:$(BZ(r$).optional(),()=>[]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),l$=B({sessionId:HZ,cwd:F(),additionalDirectories:$(BZ(F()).optional(),()=>[]),mcpServers:$(BZ(r$).optional(),()=>[]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),u$=B({sessionId:HZ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),d$=B({sessionId:HZ,modeId:jQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),f$=fi(V([B({value:L(),type:W(`boolean`)}),B({value:PQ})]),B({sessionId:HZ,configId:NQ,_meta:$(H(F(),R()).nullish(),()=>void 0)})),p$=B({sessionId:HZ,prompt:z(YZ),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Uxe=B({uri:F(),name:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Wxe=B({name:F(),owner:F(),remoteUrl:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),m$=B({workspaceUri:$(F().nullish(),()=>void 0),workspaceFolders:z(Uxe).nullish(),repository:$(Wxe.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Gxe=V([W(`automatic`),W(`diagnostic`),W(`manual`)]),Kxe=B({uri:F(),languageId:F(),text:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),qxe=B({startLine:$r().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}),endLine:$r().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}),text:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Jxe=B({uri:F(),excerpts:z(qxe),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Yxe=B({uri:F(),diff:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Xxe=B({action:F(),uri:F(),position:RQ,timestampMs:I(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Zxe=B({uri:F(),languageId:F(),visibleRange:$(zQ.nullish(),()=>void 0),lastFocusedMs:$(I().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),Qxe=V([W(`error`),W(`warning`),W(`information`),W(`hint`)]),$xe=B({uri:F(),range:zQ,severity:Qxe,message:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),eSe=B({recentFiles:z(Kxe).nullish(),relatedSnippets:z(Jxe).nullish(),editHistory:z(Yxe).nullish(),userActions:z(Xxe).nullish(),openFiles:z(Zxe).nullish(),diagnostics:z($xe).nullish(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),h$=B({sessionId:HZ,uri:F(),version:I(),position:RQ,selection:zQ.nullish(),triggerKind:Gxe,context:eSe.nullish(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),g$=B({sessionId:HZ,_meta:$(H(F(),R()).nullish(),()=>void 0)});B({id:VZ,method:F(),params:V([XQ,ZQ,QQ,$Q,e$,t$,i$,a$,o$,s$,c$,l$,u$,d$,f$,p$,m$,h$,g$,CQ,wQ]).nullish()});const tSe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),nSe=B({content:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),rSe=B({optionId:eQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),iSe=B({outcome:V([B({outcome:W(`cancelled`)}),rSe.and(B({outcome:W(`selected`)}))]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),aSe=B({terminalId:XZ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),oSe=B({exitCode:$($r().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),signal:$(F().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),sSe=B({output:F(),truncated:L(),exitStatus:$(oSe.nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),cSe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),lSe=B({exitCode:$($r().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),signal:$(F().nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)}),uSe=B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),dSe=V([F(),I(),I(),L(),z(F())]),_$=B({content:H(F(),dSe).nullish()});V([B({id:VZ,result:V([tSe,nSe,iSe,aSe,sSe,cSe,lSe,uSe,zZ(fi(V([_$.and(B({action:W(`accept`)})),B({action:W(`decline`)}),B({action:W(`cancel`)}),RZ(B({action:F()}),`action`,[`accept`,`cancel`,`decline`])]),B({_meta:$(H(F(),R()).nullish(),()=>void 0)})),`action`,[`accept`,`cancel`,`decline`]),B({connectionId:SQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),B({_meta:$(H(F(),R()).nullish(),()=>void 0)}),VQ,BQ])}),B({id:VZ,error:HQ})]);const v$=B({sessionId:HZ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),y$=B({sessionId:HZ,uri:F(),languageId:F(),version:I(),text:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),fSe=B({range:zQ.nullish(),text:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),b$=B({sessionId:HZ,uri:F(),version:I(),contentChanges:IZ(BZ(fSe),()=>[]),_meta:$(H(F(),R()).nullish(),()=>void 0)}),x$=B({sessionId:HZ,uri:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),S$=B({sessionId:HZ,uri:F(),_meta:$(H(F(),R()).nullish(),()=>void 0)}),C$=B({sessionId:HZ,uri:F(),version:I(),position:RQ,visibleRange:zQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),w$=B({sessionId:HZ,id:LQ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),T$=B({sessionId:HZ,id:LQ,reason:$(V([W(`rejected`),W(`ignored`),W(`replaced`),W(`cancelled`)]).nullish(),()=>void 0),_meta:$(H(F(),R()).nullish(),()=>void 0)});B({method:F(),params:V([v$,y$,b$,x$,S$,C$,w$,T$,JQ,YQ]).nullish()}),B({requestId:VZ,_meta:$(H(F(),R()).nullish(),()=>void 0)}),_Q.and(B({mode:W(`form`)})).and(B({message:F()})),yQ.and(B({mode:W(`url`)})).and(B({message:F()})),V([cQ,lQ]).and(B({message:F()})),dQ.and(B({type:W(`string`)})),fQ.and(B({type:W(`number`)})),pQ.and(B({type:W(`integer`)})),mQ.and(B({type:W(`boolean`)})),gQ.and(B({type:W(`array`)})),hQ.and(B({type:W(`string`)})),_$.and(B({action:W(`accept`)})),B({action:W(`decline`)}),B({action:W(`cancel`)});function E$(e){return e??{}}NZ.initialize,NZ.authenticate,NZ.logout,NZ.providers_list,NZ.providers_set,NZ.providers_disable,NZ.session_new,NZ.session_load,NZ.session_list,NZ.session_delete,NZ.session_fork,NZ.session_resume,NZ.session_close,NZ.session_set_mode,NZ.session_set_config_option,NZ.session_prompt,NZ.session_cancel,NZ.nes_start,NZ.nes_suggest,NZ.nes_accept,NZ.nes_reject,NZ.nes_close,NZ.document_did_open,NZ.document_did_change,NZ.document_did_close,NZ.document_did_save,NZ.document_did_focus,PZ.session_request_permission,PZ.session_update,PZ.fs_write_text_file,PZ.fs_read_text_file,PZ.terminal_create,PZ.terminal_output,PZ.terminal_release,PZ.terminal_wait_for_exit,PZ.terminal_kill,PZ.elicitation_create,PZ.elicitation_complete,Vye.cancel_request;function D$(e,t,n){return{method:e,params:t,mapResponse:n}}function O$(e,t){return{method:e,params:t}}function k$(e){let t={};for(let n of Object.values(e))t[n.method]=n;return t}const pSe={initialize:D$(NZ.initialize,XQ),newSession:D$(NZ.session_new,i$),loadSession:D$(NZ.session_load,a$,E$),unstable_forkSession:D$(NZ.session_fork,c$),listSessions:D$(NZ.session_list,o$),deleteSession:D$(NZ.session_delete,s$,E$),resumeSession:D$(NZ.session_resume,l$),closeSession:D$(NZ.session_close,u$,E$),setSessionMode:D$(NZ.session_set_mode,d$,E$),setSessionConfigOption:D$(NZ.session_set_config_option,f$),authenticate:D$(NZ.authenticate,ZQ,E$),unstable_listProviders:D$(NZ.providers_list,QQ),unstable_setProvider:D$(NZ.providers_set,$Q,E$),unstable_disableProvider:D$(NZ.providers_disable,e$,E$),logout:D$(NZ.logout,t$,E$),prompt:D$(NZ.session_prompt,p$),unstable_startNes:D$(NZ.nes_start,m$),unstable_suggestNes:D$(NZ.nes_suggest,h$),unstable_closeNes:D$(NZ.nes_close,g$,E$)},mSe={cancel:O$(NZ.session_cancel,v$),unstable_didOpenDocument:O$(NZ.document_did_open,y$),unstable_didChangeDocument:O$(NZ.document_did_change,b$),unstable_didCloseDocument:O$(NZ.document_did_close,x$),unstable_didSaveDocument:O$(NZ.document_did_save,S$),unstable_didFocusDocument:O$(NZ.document_did_focus,C$),unstable_acceptNes:O$(NZ.nes_accept,w$),unstable_rejectNes:O$(NZ.nes_reject,T$)},hSe={requestPermission:D$(PZ.session_request_permission,tQ),writeTextFile:D$(PZ.fs_write_text_file,UZ,E$),readTextFile:D$(PZ.fs_read_text_file,WZ),createTerminal:D$(PZ.terminal_create,rQ),terminalOutput:D$(PZ.terminal_output,iQ),releaseTerminal:D$(PZ.terminal_release,aQ,E$),waitForTerminalExit:D$(PZ.terminal_wait_for_exit,oQ),killTerminal:D$(PZ.terminal_kill,sQ,E$),unstable_createElicitation:D$(PZ.elicitation_create,bQ)},gSe={sessionUpdate:O$(PZ.session_update,KQ),unstable_completeElicitation:O$(PZ.elicitation_complete,qQ)};k$(pSe),k$(mSe),k$(hSe),k$(gSe),NZ.initialize,NZ.authenticate,NZ.providers_list,NZ.providers_set,NZ.providers_disable,NZ.session_new,NZ.session_load,NZ.session_set_mode,NZ.session_set_config_option,NZ.session_prompt,NZ.session_list,NZ.session_delete,NZ.session_fork,NZ.session_resume,NZ.session_close,NZ.logout,NZ.nes_start,NZ.nes_suggest,NZ.nes_close,NZ.session_cancel,NZ.nes_accept,NZ.nes_reject,NZ.document_did_open,NZ.document_did_change,NZ.document_did_close,NZ.document_did_save,NZ.document_did_focus,PZ.session_request_permission,PZ.fs_write_text_file,PZ.fs_read_text_file,PZ.terminal_create,PZ.terminal_output,PZ.terminal_release,PZ.terminal_wait_for_exit,PZ.terminal_kill,PZ.elicitation_create,PZ.session_update,PZ.elicitation_complete;var _Se=i(((e,t)=>{var n=1e3,r=n*60,i=r*60,a=i*24,o=a*7,s=a*365.25;t.exports=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return c(e);if(n===`number`&&isFinite(e))return t.long?u(e):l(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function c(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var c=parseFloat(t[1]);switch((t[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return c*s;case`weeks`:case`week`:case`w`:return c*o;case`days`:case`day`:case`d`:return c*a;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return c*i;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return c*r;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return c*n;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return c;default:return}}}}function l(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+`d`:t>=i?Math.round(e/i)+`h`:t>=r?Math.round(e/r)+`m`:t>=n?Math.round(e/n)+`s`:e+`ms`}function u(e){var t=Math.abs(e);return t>=a?d(e,t,a,`day`):t>=i?d(e,t,i,`hour`):t>=r?d(e,t,r,`minute`):t>=n?d(e,t,n,`second`):e+` ms`}function d(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}})),A$=i(((e,t)=>{function n(e){n.debug=n,n.default=n,n.coerce=c,n.disable=o,n.enable=i,n.enabled=s,n.humanize=_Se(),n.destroy=l,Object.keys(e).forEach(t=>{n[t]=e[t]}),n.names=[],n.skips=[],n.formatters={};function t(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return n.colors[Math.abs(t)%n.colors.length]}n.selectColor=t;function n(e){let t,i=null,a,o;function s(...e){if(!s.enabled)return;let r=s,i=Number(new Date);r.diff=i-(t||i),r.prev=t,r.curr=i,t=i,e[0]=n.coerce(e[0]),typeof e[0]!=`string`&&e.unshift(`%O`);let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(t,i)=>{if(t===`%%`)return`%`;a++;let o=n.formatters[i];if(typeof o==`function`){let n=e[a];t=o.call(r,n),e.splice(a,1),a--}return t}),n.formatArgs.call(r,e),(r.log||n.log).apply(r,e)}return s.namespace=e,s.useColors=n.useColors(),s.color=n.selectColor(e),s.extend=r,s.destroy=n.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>i===null?(a!==n.namespaces&&(a=n.namespaces,o=n.enabled(e)),o):i,set:e=>{i=e}}),typeof n.init==`function`&&n.init(s),s}function r(e,t){let r=n(this.namespace+(t===void 0?`:`:t)+e);return r.log=this.log,r}function i(e){n.save(e),n.namespaces=e,n.names=[],n.skips=[];let t=(typeof e==`string`?e:``).trim().replace(/\s+/g,`,`).split(`,`).filter(Boolean);for(let e of t)e[0]===`-`?n.skips.push(e.slice(1)):n.names.push(e)}function a(e,t){let n=0,r=0,i=-1,a=0;for(;n<e.length;)if(r<t.length&&(t[r]===e[n]||t[r]===`*`))t[r]===`*`?(i=r,a=n,r++):(n++,r++);else if(i!==-1)r=i+1,a++,n=a;else return!1;for(;r<t.length&&t[r]===`*`;)r++;return r===t.length}function o(){let e=[...n.names,...n.skips.map(e=>`-`+e)].join(`,`);return n.enable(``),e}function s(e){for(let t of n.skips)if(a(e,t))return!1;for(let t of n.names)if(a(e,t))return!0;return!1}function c(e){return e instanceof Error?e.stack||e.message:e}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}t.exports=n})),vSe=i(((e,t)=>{e.formatArgs=r,e.save=i,e.load=a,e.useColors=n,e.storage=o(),e.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=`#0000CC.#0000FF.#0033CC.#0033FF.#0066CC.#0066FF.#0099CC.#0099FF.#00CC00.#00CC33.#00CC66.#00CC99.#00CCCC.#00CCFF.#3300CC.#3300FF.#3333CC.#3333FF.#3366CC.#3366FF.#3399CC.#3399FF.#33CC00.#33CC33.#33CC66.#33CC99.#33CCCC.#33CCFF.#6600CC.#6600FF.#6633CC.#6633FF.#66CC00.#66CC33.#9900CC.#9900FF.#9933CC.#9933FF.#99CC00.#99CC33.#CC0000.#CC0033.#CC0066.#CC0099.#CC00CC.#CC00FF.#CC3300.#CC3333.#CC3366.#CC3399.#CC33CC.#CC33FF.#CC6600.#CC6633.#CC9900.#CC9933.#CCCC00.#CCCC33.#FF0000.#FF0033.#FF0066.#FF0099.#FF00CC.#FF00FF.#FF3300.#FF3333.#FF3366.#FF3399.#FF33CC.#FF33FF.#FF6600.#FF6633.#FF9900.#FF9933.#FFCC00.#FFCC33`.split(`.`);function n(){if(typeof window<`u`&&window.process&&(window.process.type===`renderer`||window.process.__nwjs))return!0;if(typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<`u`&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<`u`&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<`u`&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function r(e){if(e[0]=(this.useColors?`%c`:``)+this.namespace+(this.useColors?` %c`:` `)+e[0]+(this.useColors?`%c `:` `)+`+`+t.exports.humanize(this.diff),!this.useColors)return;let n=`color: `+this.color;e.splice(1,0,n,`color: inherit`);let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,e=>{e!==`%%`&&(r++,e===`%c`&&(i=r))}),e.splice(i,0,n)}e.log=console.debug||console.log||(()=>{});function i(t){try{t?e.storage.setItem(`debug`,t):e.storage.removeItem(`debug`)}catch{}}function a(){let t;try{t=e.storage.getItem(`debug`)||e.storage.getItem(`DEBUG`)}catch{}return!t&&typeof process<`u`&&`env`in process&&(t=process.env.DEBUG),t}function o(){try{return localStorage}catch{}}t.exports=A$()(e);let{formatters:s}=t.exports;s.j=function(e){try{return JSON.stringify(e)}catch(e){return`[UnexpectedJSONParseError]: `+e.message}}})),ySe=i(((e,t)=>{t.exports=(e,t=process.argv)=>{let n=e.startsWith(`-`)?``:e.length===1?`-`:`--`,r=t.indexOf(n+e),i=t.indexOf(`--`);return r!==-1&&(i===-1||r<i)}})),bSe=i(((e,n)=>{let r=t(`os`),i=t(`tty`),a=ySe(),{env:o}=process,s;a(`no-color`)||a(`no-colors`)||a(`color=false`)||a(`color=never`)?s=0:(a(`color`)||a(`colors`)||a(`color=true`)||a(`color=always`))&&(s=1),`FORCE_COLOR`in o&&(s=o.FORCE_COLOR===`true`?1:o.FORCE_COLOR===`false`?0:o.FORCE_COLOR.length===0?1:Math.min(parseInt(o.FORCE_COLOR,10),3));function c(e){return e!==0&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function l(e,t){if(s===0)return 0;if(a(`color=16m`)||a(`color=full`)||a(`color=truecolor`))return 3;if(a(`color=256`))return 2;if(e&&!t&&s===void 0)return 0;let n=s||0;if(o.TERM===`dumb`)return n;if(process.platform===`win32`){let e=r.release().split(`.`);return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if(`CI`in o)return[`TRAVIS`,`CIRCLECI`,`APPVEYOR`,`GITLAB_CI`,`GITHUB_ACTIONS`,`BUILDKITE`].some(e=>e in o)||o.CI_NAME===`codeship`?1:n;if(`TEAMCITY_VERSION`in o)return+!!/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(o.TEAMCITY_VERSION);if(o.COLORTERM===`truecolor`)return 3;if(`TERM_PROGRAM`in o){let e=parseInt((o.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(o.TERM_PROGRAM){case`iTerm.app`:return e>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(o.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(o.TERM)||`COLORTERM`in o?1:n}function u(e){return c(l(e,e&&e.isTTY))}n.exports={supportsColor:u,stdout:c(l(!0,i.isatty(1))),stderr:c(l(!0,i.isatty(2)))}})),xSe=i(((e,n)=>{let r=t(`tty`),i=t(`util`);e.init=d,e.log=c,e.formatArgs=o,e.save=l,e.load=u,e.useColors=a,e.destroy=i.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),e.colors=[6,2,3,4,5,1];try{let t=bSe();t&&(t.stderr||t).level>=2&&(e.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}e.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{let n=t.substring(6).toLowerCase().replace(/_([a-z])/g,(e,t)=>t.toUpperCase()),r=process.env[t];return r=/^(yes|on|true|enabled)$/i.test(r)?!0:/^(no|off|false|disabled)$/i.test(r)?!1:r===`null`?null:Number(r),e[n]=r,e},{});function a(){return`colors`in e.inspectOpts?!!e.inspectOpts.colors:r.isatty(process.stderr.fd)}function o(e){let{namespace:t,useColors:r}=this;if(r){let r=this.color,i=`\x1B[3`+(r<8?r:`8;5;`+r),a=` ${i};1m${t} \u001B[0m`;e[0]=a+e[0].split(`
|
|
713
715
|
`).join(`
|
|
714
716
|
`+a),e.push(i+`m+`+n.exports.humanize(this.diff)+`\x1B[0m`)}else e[0]=s()+t+` `+e[0]}function s(){return e.inspectOpts.hideDate?``:new Date().toISOString()+` `}function c(...t){return process.stderr.write(i.formatWithOptions(e.inspectOpts,...t)+`
|
|
715
717
|
`)}function l(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function u(){return process.env.DEBUG}function d(t){t.inspectOpts={};let n=Object.keys(e.inspectOpts);for(let r=0;r<n.length;r++)t.inspectOpts[n[r]]=e.inspectOpts[n[r]]}n.exports=A$()(e);let{formatters:f}=n.exports;f.o=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts).split(`
|
|
716
|
-
`).map(e=>e.trim()).join(` `)},f.O=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts)}})),j$=i(((e,t)=>{t.exports=typeof process>`u`||process.type===`renderer`||process.browser===!0||process.__nwjs?
|
|
717
|
-
`){return e.split(n).reduce((e,n)=>{let r=t?n.trim():n;return r&&e.push(r),e},[])}function a1(e,t){return i1(e,!0).map(e=>t(e))}function o1(e){return(0,M$.exists)(e,M$.FOLDER)}function s1(e,t){return Array.isArray(e)?e.includes(t)||e.push(t):e.add(t),t}function
|
|
718
|
+
`).map(e=>e.trim()).join(` `)},f.O=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts)}})),j$=i(((e,t)=>{t.exports=typeof process>`u`||process.type===`renderer`||process.browser===!0||process.__nwjs?vSe():xSe()})),SSe=i((e=>{var n=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0});let r=t(`fs`),i=n(j$()).default(`@kwsites/file-exists`);function a(e,t,n){i(`checking %s`,e);try{let a=r.statSync(e);return a.isFile()&&t?(i(`[OK] path represents a file`),!0):a.isDirectory()&&n?(i(`[OK] path represents a directory`),!0):(i(`[FAIL] path represents something other than a file or directory`),!1)}catch(e){if(e.code===`ENOENT`)return i(`[FAIL] path is not accessible: %o`,e),!1;throw i(`[FATAL] %o`,e),e}}function o(t,n=e.READABLE){return a(t,(n&e.FILE)>0,(n&e.FOLDER)>0)}e.exists=o,e.FILE=1,e.FOLDER=2,e.READABLE=e.FILE+e.FOLDER})),M$=i((e=>{function t(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),t(SSe())}))();const N$=new WeakMap;function P$(...e){let t=new String(e);return N$.set(t,e),t}function F$(e){return e instanceof String&&N$.has(e)}var CSe=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createDeferred=e.deferred=void 0;function t(){let e,t,n=`pending`;return{promise:new Promise((n,r)=>{e=n,t=r}),done(t){n===`pending`&&(n=`resolved`,e(t))},fail(e){n===`pending`&&(n=`rejected`,t(e))},get fulfilled(){return n!==`pending`},get status(){return n}}}e.deferred=t,e.createDeferred=t})),I$=e(j$()),L$=CSe();new Map([[`C`,!0],[`P`,!1],[`h`,!1],[`p`,!1],[`v`,!1],...{short:new Map([[`c`,!0]])}.short.entries()]);function R$(e,t,n=String(e)){let r=typeof e==`string`?RegExp(`\\s*${e.toLowerCase()}`):e;return function(e){if(r.test(e))return{category:t,message:`Configuring ${n} is not permitted without enabling ${t}`}}}function z$(e,t){return R$(RegExp(`\\s*${e.toLowerCase().replace(/\./g,`(..+)?.`)}`),t,e)}R$(`alias`,`allowUnsafeAlias`),R$(`core.askPass`,`allowUnsafeAskPass`),R$(`core.editor`,`allowUnsafeEditor`),R$(`core.fsmonitor`,`allowUnsafeFsMonitor`),R$(`core.gitProxy`,`allowUnsafeGitProxy`),R$(`core.hooksPath`,`allowUnsafeHooksPath`),R$(`core.pager`,`allowUnsafePager`),R$(`core.sshCommand`,`allowUnsafeSshCommand`),z$(`credential.helper`,`allowUnsafeCredentialHelper`),z$(`diff.command`,`allowUnsafeDiffExternal`),R$(`diff.external`,`allowUnsafeDiffExternal`),z$(`diff.textconv`,`allowUnsafeDiffTextConv`),z$(`filter.clean`,`allowUnsafeFilter`),z$(`filter.smudge`,`allowUnsafeFilter`),z$(`gpg.program`,`allowUnsafeGpgProgram`),R$(`init.templateDir`,`allowUnsafeTemplateDir`),z$(`merge.driver`,`allowUnsafeMergeDriver`),z$(`mergetool.path`,`allowUnsafeMergeDriver`),z$(`mergetool.cmd`,`allowUnsafeMergeDriver`),z$(`protocol.allow`,`allowUnsafeProtocolOverride`),z$(`remote.receivepack`,`allowUnsafePack`),z$(`remote.uploadpack`,`allowUnsafePack`),R$(`sequence.editor`,`allowUnsafeEditor`);function B$(e,t,n,r=String(t)){let i=typeof t==`string`?RegExp(`\\s*${t.toLowerCase()}`):t,a=`Use of ${e?`${e} with option `:``}${r} is not permitted without enabling ${n}`;return function(t,r){if((!e||t===e)&&i.test(r))return{category:n,message:a}}}B$(null,/--(upload|receive)-pack/,`allowUnsafePack`,`--upload-pack or --receive-pack`),B$(`clone`,/^-\w*u/,`allowUnsafePack`),B$(`clone`,`--u`,`allowUnsafePack`),B$(`push`,`--exec`,`allowUnsafePack`),B$(null,`--template`,`allowUnsafeTemplateDir`);var V$=Object.defineProperty,wSe=Object.getOwnPropertyDescriptor,H$=Object.getOwnPropertyNames,TSe=Object.prototype.hasOwnProperty,U$=(e,t)=>function(){return e&&(t=(0,e[H$(e)[0]])(e=0)),t},ESe=(e,t)=>function(){return t||(0,e[H$(e)[0]])((t={exports:{}}).exports,t),t.exports},W$=(e,t)=>{for(var n in t)V$(e,n,{get:t[n],enumerable:!0})},DSe=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of H$(t))!TSe.call(e,i)&&i!==n&&V$(e,i,{get:()=>t[i],enumerable:!(r=wSe(t,i))||r.enumerable});return e},G$=e=>DSe(V$({},`__esModule`,{value:!0}),e),K$,q$=U$({"src/lib/errors/git-error.ts"(){K$=class extends Error{constructor(e,t){super(t),this.task=e,Object.setPrototypeOf(this,new.target.prototype)}}}}),J$,Y$=U$({"src/lib/errors/git-response-error.ts"(){q$(),J$=class extends K${constructor(e,t){super(void 0,t||String(e)),this.git=e}}}}),X$,Z$=U$({"src/lib/errors/task-configuration-error.ts"(){q$(),X$=class extends K${constructor(e){super(void 0,e)}}}});function Q$(e){return typeof e==`function`?e:_1}function $$(e){return typeof e==`function`&&e!==_1}function e1(e,t){let n=e.indexOf(t);return n<=0?[e,``]:[e.substr(0,n),e.substr(n+1)]}function t1(e,t=0){return r1(e)&&e.length>t?e[t]:void 0}function n1(e,t=0){if(r1(e)&&e.length>t)return e[e.length-1-t]}function r1(e){return O1(e)}function i1(e=``,t=!0,n=`
|
|
719
|
+
`){return e.split(n).reduce((e,n)=>{let r=t?n.trim():n;return r&&e.push(r),e},[])}function a1(e,t){return i1(e,!0).map(e=>t(e))}function o1(e){return(0,M$.exists)(e,M$.FOLDER)}function s1(e,t){return Array.isArray(e)?e.includes(t)||e.push(t):e.add(t),t}function OSe(e,t){return Array.isArray(e)&&!e.includes(t)&&e.push(t),e}function c1(e,t){if(Array.isArray(e)){let n=e.indexOf(t);n>=0&&e.splice(n,1)}else e.delete(t);return t}function l1(e){return Array.isArray(e)?e:[e]}function u1(e){return e.replace(/[\s-]+(.)/g,(e,t)=>t.toUpperCase())}function d1(e){return l1(e).map(e=>e instanceof String?e:String(e))}function f1(e,t=0){if(e==null)return t;let n=parseInt(e,10);return Number.isNaN(n)?t:n}function p1(e,t){let n=[];for(let r=0,i=e.length;r<i;r++)n.push(t,e[r]);return n}function m1(e){return(Array.isArray(e)?Buffer.concat(e):e).toString(`utf-8`)}function kSe(e,t){let n={};return t.forEach(t=>{e[t]!==void 0&&(n[t]=e[t])}),n}function ASe(e=0){return new Promise(t=>setTimeout(t,e))}function h1(e){if(e!==!1)return e}var g1,_1,v1,y1=U$({"src/lib/utils/util.ts"(){k1(),g1=`\0`,_1=()=>{},v1=Object.prototype.toString.call.bind(Object.prototype.toString)}});function b1(e,t,n){return t(e)?e:arguments.length>2?n:void 0}function x1(e,t){let n=F$(e)?`string`:typeof e;return/number|string|boolean/.test(n)&&(!t||!t.includes(n))}function S1(e){return!!e&&v1(e)===`[object Object]`}function C1(e){return typeof e==`function`}var w1,T1,E1,D1,O1,k1=U$({"src/lib/utils/argument-filters.ts"(){y1(),w1=e=>Array.isArray(e),T1=e=>typeof e==`number`,E1=e=>typeof e==`string`||F$(e),D1=e=>E1(e)||Array.isArray(e)&&e.every(E1),O1=e=>e==null||`number|boolean|function`.includes(typeof e)?!1:typeof e.length==`number`}}),A1,jSe=U$({"src/lib/utils/exit-codes.ts"(){A1=(e=>(e[e.SUCCESS=0]=`SUCCESS`,e[e.ERROR=1]=`ERROR`,e[e.NOT_FOUND=-2]=`NOT_FOUND`,e[e.UNCLEAN=128]=`UNCLEAN`,e))(A1||{})}}),j1,MSe=U$({"src/lib/utils/git-output-streams.ts"(){j1=class e{constructor(e,t){this.stdOut=e,this.stdErr=t}asStrings(){return new e(this.stdOut.toString(`utf8`),this.stdErr.toString(`utf8`))}}}});function NSe(){throw Error(`LineParser:useMatches not implemented`)}var M1,N1,PSe=U$({"src/lib/utils/line-parser.ts"(){M1=class{constructor(e,t){this.matches=[],this.useMatches=NSe,this.parse=(e,t)=>(this.resetMatches(),this._regExp.every((t,n)=>this.addMatch(t,n,e(n)))?this.useMatches(t,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(e)?e:[e],t&&(this.useMatches=t)}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(e,t,n){let r=n&&e.exec(n);return r&&this.pushMatch(t,r),!!r}pushMatch(e,t){this.matches.push(...t.slice(1))}},N1=class extends M1{addMatch(e,t,n){return/^remote:\s/.test(String(n))&&super.addMatch(e,t,n)}pushMatch(e,t){(e>0||t.length>1)&&super.pushMatch(e,t)}}}});function FSe(...e){let t=process.cwd(),n=Object.assign({baseDir:t,...P1},...e.filter(e=>typeof e==`object`&&e));return n.baseDir=n.baseDir||t,n.trimmed=n.trimmed===!0,n}var P1,ISe=U$({"src/lib/utils/simple-git-options.ts"(){P1={binary:`git`,maxConcurrentProcesses:5,config:[],trimmed:!1}}});function F1(e,t=[]){return S1(e)?Object.keys(e).reduce((t,n)=>{let r=e[n];if(F$(r))t.push(r);else if(x1(r,[`boolean`]))t.push(n+`=`+r);else if(Array.isArray(r))for(let e of r)x1(e,[`string`,`number`])||t.push(n+`=`+e);else t.push(n);return t},t):t}function I1(e,t=0,n=!1){let r=[];for(let n=0,i=t<0?e.length:t;n<i;n++)`string|number`.includes(typeof e[n])&&r.push(String(e[n]));return F1(L1(e),r),n||r.push(...LSe(e)),r}function LSe(e){return d1(b1(n1(e,+(typeof n1(e)==`function`)),w1,[]))}function L1(e){return b1(n1(e,+!!C1(n1(e))),S1)}function R1(e,t=!0){let n=Q$(n1(e));return t||$$(n)?n:void 0}var RSe=U$({"src/lib/utils/task-options.ts"(){k1(),y1()}});function z1(e,t){return e(t.stdOut,t.stdErr)}function B1(e,t,n,r=!0){return l1(n).forEach(n=>{for(let i=i1(n,r),a=0,o=i.length;a<o;a++){let n=(e=0)=>{if(!(a+e>=o))return i[a+e]};t.some(({parse:t})=>t(n,e))}}),e}var zSe=U$({"src/lib/utils/task-parser.ts"(){y1()}}),V1={};W$(V1,{ExitCodes:()=>A1,GitOutputStreams:()=>j1,LineParser:()=>M1,NOOP:()=>_1,NULL:()=>g1,RemoteLineParser:()=>N1,append:()=>s1,appendTaskOptions:()=>F1,asArray:()=>l1,asCamelCase:()=>u1,asFunction:()=>Q$,asNumber:()=>f1,asStringArray:()=>d1,bufferToString:()=>m1,callTaskParser:()=>z1,createInstanceConfig:()=>FSe,delay:()=>ASe,filterArray:()=>w1,filterFunction:()=>C1,filterHasLength:()=>O1,filterNumber:()=>T1,filterPlainObject:()=>S1,filterPrimitives:()=>x1,filterString:()=>E1,filterStringOrStringArray:()=>D1,filterType:()=>b1,first:()=>t1,folderExists:()=>o1,forEachLineWithContent:()=>a1,getTrailingOptions:()=>I1,including:()=>OSe,isUserFunction:()=>$$,last:()=>n1,objectToString:()=>v1,orVoid:()=>h1,parseStringResponse:()=>B1,pick:()=>kSe,prefixedArray:()=>p1,remove:()=>c1,splitOn:()=>e1,toLinesWithContent:()=>i1,trailingFunctionArgument:()=>R1,trailingOptionsArgument:()=>L1});var H1=U$({"src/lib/utils/index.ts"(){k1(),jSe(),MSe(),PSe(),ISe(),RSe(),zSe(),y1()}}),U1={};W$(U1,{CheckRepoActions:()=>K1,checkIsBareRepoTask:()=>G1,checkIsRepoRootTask:()=>W1,checkIsRepoTask:()=>BSe});function BSe(e){switch(e){case`bare`:return G1();case`root`:return W1()}return{commands:[`rev-parse`,`--is-inside-work-tree`],format:`utf-8`,onError:q1,parser:J1}}function W1(){return{commands:[`rev-parse`,`--git-dir`],format:`utf-8`,onError:q1,parser(e){return/^\.(git)?$/.test(e.trim())}}}function G1(){return{commands:[`rev-parse`,`--is-bare-repository`],format:`utf-8`,onError:q1,parser:J1}}function VSe(e){return/(Not a git repository|Kein Git-Repository)/i.test(String(e))}var K1,q1,J1,Y1=U$({"src/lib/tasks/check-is-repo.ts"(){H1(),K1=(e=>(e.BARE=`bare`,e.IN_TREE=`tree`,e.IS_REPO_ROOT=`root`,e))(K1||{}),q1=({exitCode:e},t,n,r)=>{if(e===128&&VSe(t))return n(Buffer.from(`false`));r(t)},J1=e=>e.trim()===`true`}});function HSe(e,t){let n=new X1(e),r=e?Q1:Z1;return i1(t).forEach(e=>{let t=e.replace(r,``);n.paths.push(t),($1.test(t)?n.folders:n.files).push(t)}),n}var X1,Z1,Q1,$1,USe=U$({"src/lib/responses/CleanSummary.ts"(){H1(),X1=class{constructor(e){this.dryRun=e,this.paths=[],this.files=[],this.folders=[]}},Z1=/^[a-z]+\s*/i,Q1=/^[a-z]+\s+[a-z]+\s*/i,$1=/\/$/}}),e0={};W$(e0,{EMPTY_COMMANDS:()=>s0,adhocExecTask:()=>t0,configurationErrorTask:()=>n0,isBufferTask:()=>a0,isEmptyTask:()=>o0,straightThroughBufferTask:()=>i0,straightThroughStringTask:()=>r0});function t0(e){return{commands:s0,format:`empty`,parser:e}}function n0(e){return{commands:s0,format:`empty`,parser(){throw typeof e==`string`?new X$(e):e}}}function r0(e,t=!1){return{commands:e,format:`utf-8`,parser(e){return t?String(e).trim():e}}}function i0(e){return{commands:e,format:`buffer`,parser(e){return e}}}function a0(e){return e.format===`buffer`}function o0(e){return e.format===`empty`||!e.commands.length}var s0,c0=U$({"src/lib/tasks/task.ts"(){Z$(),s0=[]}}),l0={};W$(l0,{CONFIG_ERROR_INTERACTIVE_MODE:()=>d0,CONFIG_ERROR_MODE_REQUIRED:()=>f0,CONFIG_ERROR_UNKNOWN_OPTION:()=>p0,CleanOptions:()=>m0,cleanTask:()=>u0,cleanWithOptionsTask:()=>WSe,isCleanOptionsArray:()=>GSe});function WSe(e,t){let{cleanMode:n,options:r,valid:i}=KSe(e);return n?i.options?(r.push(...t),r.some(YSe)?n0(d0):u0(n,r)):n0(p0+JSON.stringify(e)):n0(f0)}function u0(e,t){return{commands:[`clean`,`-${e}`,...t],format:`utf-8`,parser(t){return HSe(e===`n`,t)}}}function GSe(e){return Array.isArray(e)&&e.every(e=>h0.has(e))}function KSe(e){let t,n=[],r={cleanMode:!1,options:!0};return e.replace(/[^a-z]i/g,``).split(``).forEach(e=>{qSe(e)?(t=e,r.cleanMode=!0):r.options=r.options&&JSe(n[n.length]=`-${e}`)}),{cleanMode:t,options:n,valid:r}}function qSe(e){return e===`f`||e===`n`}function JSe(e){return/^-[a-z]$/i.test(e)&&h0.has(e.charAt(1))}function YSe(e){return/^-[^\-]/.test(e)?e.indexOf(`i`)>0:e===`--interactive`}var d0,f0,p0,m0,h0,g0=U$({"src/lib/tasks/clean.ts"(){USe(),H1(),c0(),d0=`Git clean interactive mode is not supported`,f0=`Git clean mode parameter ("n" or "f") is required`,p0=`Git clean unknown option found in: `,m0=(e=>(e.DRY_RUN=`n`,e.FORCE=`f`,e.IGNORED_INCLUDED=`x`,e.IGNORED_ONLY=`X`,e.EXCLUDING=`e`,e.QUIET=`q`,e.RECURSIVE=`d`,e))(m0||{}),h0=new Set([`i`,...d1(Object.values(m0))])}});function XSe(e){let t=new v0;for(let n of _0(e))t.addValue(n.file,String(n.key),n.value);return t}function ZSe(e,t){let n=null,r=[],i=new Map;for(let a of _0(e,t))a.key===t&&(r.push(n=a.value),i.has(a.file)||i.set(a.file,[]),i.get(a.file).push(n));return{key:t,paths:Array.from(i.keys()),scopes:i,value:n,values:r}}function QSe(e){return e.replace(/^(file):/,``)}function*_0(e,t=null){let n=e.split(`\0`);for(let e=0,r=n.length-1;e<r;){let r=QSe(n[e++]),i=n[e++],a=t;if(i.includes(`
|
|
718
720
|
`)){let e=e1(i,`
|
|
719
|
-
`);a=e[0],i=e[1]}yield{file:r,key:a,value:i}}}var v0,QSe=U$({"src/lib/responses/ConfigList.ts"(){H1(),v0=class{constructor(){this.files=[],this.values=Object.create(null)}get all(){return this._all||=this.files.reduce((e,t)=>Object.assign(e,this.values[t]),{}),this._all}addFile(e){if(!(e in this.values)){let t=n1(this.files);this.values[e]=t?Object.create(this.values[t]):{},this.files.push(e)}return this.values[e]}addValue(e,t,n){let r=this.addFile(e);Object.hasOwn(r,t)?Array.isArray(r[t])?r[t].push(n):r[t]=[r[t],n]:r[t]=n,this._all=void 0}}}});function y0(e,t){return typeof e==`string`&&Object.hasOwn(b0,e)?e:t}function $Se(e,t,n,r){let i=[`config`,`--${r}`];return n&&i.push(`--add`),i.push(e,t),{commands:i,format:`utf-8`,parser(e){return e}}}function eCe(e,t){let n=[`config`,`--null`,`--show-origin`,`--get-all`,e];return t&&n.splice(1,0,`--${t}`),{commands:n,format:`utf-8`,parser(t){return XSe(t,e)}}}function tCe(e){let t=[`config`,`--list`,`--show-origin`,`--null`];return e&&t.push(`--${e}`),{commands:t,format:`utf-8`,parser(e){return YSe(e)}}}function nCe(){return{addConfig(e,t,...n){return this._runTask($Se(e,t,n[0]===!0,y0(n[1],`local`)),R1(arguments))},getConfig(e,t){return this._runTask(eCe(e,y0(t,void 0)),R1(arguments))},listConfig(...e){return this._runTask(tCe(y0(e[0],void 0)),R1(arguments))}}}var b0,x0=U$({"src/lib/tasks/config.ts"(){QSe(),H1(),b0=(e=>(e.system=`system`,e.global=`global`,e.local=`local`,e.worktree=`worktree`,e))(b0||{})}});function rCe(e){return C0.has(e)}var S0,C0,w0=U$({"src/lib/tasks/diff-name-status.ts"(){S0=(e=>(e.ADDED=`A`,e.COPIED=`C`,e.DELETED=`D`,e.MODIFIED=`M`,e.RENAMED=`R`,e.CHANGED=`T`,e.UNMERGED=`U`,e.UNKNOWN=`X`,e.BROKEN=`B`,e))(S0||{}),C0=new Set(Object.values(S0))}});function iCe(...e){return new O0().param(...e)}function aCe(e){let t=new Set,n={};return a1(e,e=>{let[r,i,a]=e.split(g1);t.add(r),(n[r]=n[r]||[]).push({line:f1(i),path:r,preview:a})}),{paths:t,results:n}}function oCe(){return{grep(e){let t=R1(arguments),n=I1(arguments);for(let e of T0)if(n.includes(e))return this._runTask(n0(`git.grep: use of "${e}" is not supported.`),t);typeof e==`string`&&(e=iCe().param(e));let r=[`grep`,`--null`,`-n`,`--full-name`,...n,...e];return this._runTask({commands:r,format:`utf-8`,parser(e){return aCe(e)}},t)}}}var T0,E0,D0,O0,k0=U$({"src/lib/tasks/grep.ts"(){H1(),c0(),T0=[`-h`],E0=Symbol(`grepQuery`),O0=class{constructor(){this[D0]=[]}*[(D0=E0,Symbol.iterator)](){for(let e of this[E0])yield e}and(...e){return e.length&&this[E0].push(`--and`,`(`,...p1(e,`-e`),`)`),this}param(...e){return this[E0].push(...p1(e,`-e`)),this}}}}),A0={};W$(A0,{ResetMode:()=>M0,getResetMode:()=>cCe,resetTask:()=>sCe});function sCe(e,t){let n=[`reset`];return j0(e)&&n.push(`--${e}`),n.push(...t),r0(n)}function cCe(e){if(j0(e))return e;switch(typeof e){case`string`:case`undefined`:return`soft`}}function j0(e){return typeof e==`string`&&N0.includes(e)}var M0,N0,P0=U$({"src/lib/tasks/reset.ts"(){H1(),c0(),M0=(e=>(e.MIXED=`mixed`,e.SOFT=`soft`,e.HARD=`hard`,e.MERGE=`merge`,e.KEEP=`keep`,e))(M0||{}),N0=d1(Object.values(M0))}});function lCe(){return(0,I$.default)(`simple-git`)}function F0(e,t,n){return!t||!String(t).replace(/\s*/,``)?n?(t,...r)=>{e(t,...r),n(t,...r)}:e:(r,...i)=>{e(`%s ${r}`,t,...i),n&&n(r,...i)}}function uCe(e,t,{namespace:n}){if(typeof e==`string`)return e;let r=t&&t.namespace||``;return r.startsWith(n)?r.substr(n.length+1):r||n}function I0(e,t,n,r=lCe()){let i=e&&`[${e}]`||``,a=[],o=typeof t==`string`?r.extend(t):t,s=uCe(b1(t,E1),o,r);return l(n);function c(t,n){return s1(a,I0(e,s.replace(/^[^:]+/,t),n,r))}function l(t){let n=t&&`[${t}]`||``,a=o&&F0(o,n)||_1,s=F0(r,`${i} ${n}`,a);return Object.assign(o?a:s,{label:e,sibling:c,info:s,step:l})}}var L0=U$({"src/lib/git-logger.ts"(){H1(),I$.default.formatters.L=e=>String(O1(e)?e.length:`-`),I$.default.formatters.B=e=>Buffer.isBuffer(e)?e.toString(`utf8`):v1(e)}}),R0,dCe=U$({"src/lib/runners/tasks-pending-queue.ts"(){q$(),L0(),R0=class e{constructor(e=`GitExecutor`){this.logLabel=e,this._queue=new Map}withProgress(e){return this._queue.get(e)}createProgress(t){let n=e.getName(t.commands[0]);return{task:t,logger:I0(this.logLabel,n),name:n}}push(e){let t=this.createProgress(e);return t.logger(`Adding task to the queue, commands = %o`,e.commands),this._queue.set(e,t),t}fatal(e){for(let[t,{logger:n}]of Array.from(this._queue.entries()))t===e.task?(n.info(`Failed %o`,e),n(`Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`)):n.info(`A fatal exception occurred in a previous task, the queue has been purged: %o`,e.message),this.complete(t);if(this._queue.size!==0)throw Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(e){this.withProgress(e)&&this._queue.delete(e)}attempt(e){let t=this.withProgress(e);if(!t)throw new K$(void 0,`TasksPendingQueue: attempt called for an unknown task`);return t.logger(`Starting task`),t}static getName(t=`empty`){return`task:${t}:${++e.counter}`}static{this.counter=0}}}});function z0(e,t){return{method:t1(e.commands)||``,commands:t}}function fCe(e,t){return n=>{t(`[ERROR] child process exception %o`,n),e.push(Buffer.from(String(n.stack),`ascii`))}}function B0(e,t,n,r){return i=>{n(`%s received %L bytes`,t,i),r(`%B`,i),e.push(i)}}var V0,pCe=U$({"src/lib/runners/git-executor-chain.ts"(){q$(),c0(),H1(),dCe(),V0=class{constructor(e,t,n){this._executor=e,this._scheduler=t,this._plugins=n,this._chain=Promise.resolve(),this._queue=new R0}get cwd(){return this._cwd||this._executor.cwd}set cwd(e){this._cwd=e}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(e){return this._queue.push(e),this._chain=this._chain.then(()=>this.attemptTask(e))}async attemptTask(e){let t=await this._scheduler.next(),n=()=>this._queue.complete(e);try{let{logger:t}=this._queue.attempt(e);return await(o0(e)?this.attemptEmptyTask(e,t):this.attemptRemoteTask(e,t))}catch(t){throw this.onFatalException(e,t)}finally{n(),t()}}onFatalException(e,t){let n=t instanceof K$?Object.assign(t,{task:e}):new K$(e,t&&String(t));return this._chain=Promise.resolve(),this._queue.fatal(n),n}async attemptRemoteTask(e,t){let n=this._plugins.exec(`spawn.binary`,``,z0(e,e.commands)),r=this._plugins.exec(`spawn.args`,[...e.commands],{...z0(e,e.commands),env:{...this.env}}),i=await this.gitResponse(e,n,r,this.outputHandler,t.step(`SPAWN`)),a=await this.handleTaskData(e,r,i,t.step(`HANDLE`));return t(`passing response to task's parser as a %s`,e.format),a0(e)?z1(e.parser,a):z1(e.parser,a.asStrings())}async attemptEmptyTask(e,t){return t(`empty task bypassing child process to call to task's parser`),e.parser(this)}handleTaskData(e,t,n,r){let{exitCode:i,rejection:a,stdOut:o,stdErr:s}=n;return new Promise((c,l)=>{r(`Preparing to handle process response exitCode=%d stdOut=`,i);let{error:u}=this._plugins.exec(`task.error`,{error:a},{...z0(e,t),...n});if(u&&e.onError)return r.info(`exitCode=%s handling with custom error handler`),e.onError(n,u,e=>{r.info(`custom error handler treated as success`),r(`custom error returned a %s`,v1(e)),c(new j1(Array.isArray(e)?Buffer.concat(e):e,Buffer.concat(s)))},l);if(u)return r.info(`handling as error: exitCode=%s stdErr=%s rejection=%o`,i,s.length,a),l(u);r.info(`retrieving task output complete`),c(new j1(Buffer.concat(o),Buffer.concat(s)))})}async gitResponse(e,t,n,r,i){let a=i.sibling(`output`),o=this._plugins.exec(`spawn.options`,{cwd:this.cwd,env:this.env,windowsHide:!0},z0(e,e.commands));return new Promise(s=>{let c=[],l=[];i.info(`%s %o`,t,n),i(`%O`,o);let u=this._beforeSpawn(e,n);if(u)return s({stdOut:c,stdErr:l,exitCode:9901,rejection:u});this._plugins.exec(`spawn.before`,void 0,{...z0(e,n),kill(e){u=e||u}});let d=Re(t,n,o);d.stdout.on(`data`,B0(c,`stdOut`,i,a.step(`stdOut`))),d.stderr.on(`data`,B0(l,`stdErr`,i,a.step(`stdErr`))),d.on(`error`,fCe(l,i)),r&&(i(`Passing child process stdOut/stdErr to custom outputHandler`),r(t,d.stdout,d.stderr,[...n])),this._plugins.exec(`spawn.after`,void 0,{...z0(e,n),spawned:d,close(e,t){s({stdOut:c,stdErr:l,exitCode:e,rejection:u||t})},kill(e){d.killed||(u=e,d.kill(`SIGINT`))}})})}_beforeSpawn(e,t){let n;return this._plugins.exec(`spawn.before`,void 0,{...z0(e,t),kill(e){n=e||n}}),n}}}}),H0={};W$(H0,{GitExecutor:()=>U0});var U0,mCe=U$({"src/lib/runners/git-executor.ts"(){pCe(),U0=class{constructor(e,t,n){this.cwd=e,this._scheduler=t,this._plugins=n,this._chain=new V0(this,this._scheduler,this._plugins)}chain(){return new V0(this,this._scheduler,this._plugins)}push(e){return this._chain.push(e)}}}});function hCe(e,t,n=_1){t.then(e=>{n(null,e)},t=>{t?.task===e&&n(t instanceof J$?gCe(t):t,void 0)})}function gCe(e){let t=e=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${e} should be GitResponseError.git.${e}, this will no longer be available in version 3`),t=_1};return Object.create(e,Object.getOwnPropertyNames(e.git).reduce(n,{}));function n(n,r){return r in e||(n[r]={enumerable:!1,configurable:!1,get(){return t(r),e.git[r]}}),n}}var _Ce=U$({"src/lib/task-callback.ts"(){Y$(),H1()}});function W0(e,t){return t0(n=>{if(!o1(e))throw Error(`Git.cwd: cannot change to non-directory "${e}"`);return(t||n).cwd=e})}var vCe=U$({"src/lib/tasks/change-working-directory.ts"(){H1(),c0()}});function G0(e){let t=[`checkout`,...e];return t[1]===`-b`&&t.includes(`-B`)&&(t[1]=c1(t,`-B`)),r0(t)}function yCe(){return{checkout(){return this._runTask(G0(I1(arguments,1)),R1(arguments))},checkoutBranch(e,t){return this._runTask(G0([`-b`,e,t,...I1(arguments)]),R1(arguments))},checkoutLocalBranch(e){return this._runTask(G0([`-b`,e,...I1(arguments)]),R1(arguments))}}}var bCe=U$({"src/lib/tasks/checkout.ts"(){H1(),c0()}});function xCe(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}function SCe(){return{countObjects(){return this._runTask({commands:[`count-objects`,`--verbose`],format:`utf-8`,parser(e){return B1(xCe(),[K0],e)}})}}}var K0,CCe=U$({"src/lib/tasks/count-objects.ts"(){H1(),K0=new M1(/([a-z-]+): (\d+)$/,(e,[t,n])=>{let r=u1(t);Object.hasOwn(e,r)&&(e[r]=f1(n))})}});function wCe(e){return B1({author:null,branch:``,commit:``,root:!1,summary:{changes:0,insertions:0,deletions:0}},q0,e)}var q0,TCe=U$({"src/lib/parsers/parse-commit.ts"(){H1(),q0=[new M1(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(e,[t,n,r])=>{e.branch=t,e.commit=r,e.root=!!n}),new M1(/\s*Author:\s(.+)/i,(e,[t])=>{let n=t.split(`<`),r=n.pop();!r||!r.includes(`@`)||(e.author={email:r.substr(0,r.length-1),name:n.join(`<`).trim()})}),new M1(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,(e,[t,n,r])=>{e.summary.changes=parseInt(t,10)||0,e.summary.insertions=parseInt(n,10)||0,e.summary.deletions=parseInt(r,10)||0}),new M1(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,(e,[t,n,r])=>{e.summary.changes=parseInt(t,10)||0;let i=parseInt(n,10)||0;r===`-`?e.summary.deletions=i:r===`+`&&(e.summary.insertions=i)})]}});function ECe(e,t,n){return{commands:[`-c`,`core.abbrev=40`,`commit`,...p1(e,`-m`),...t,...n],format:`utf-8`,parser:wCe}}function DCe(){return{commit(t,...n){let r=R1(arguments),i=e(t)||ECe(l1(t),l1(b1(n[0],D1,[])),[...d1(b1(n[1],w1,[])),...I1(arguments,0,!0)]);return this._runTask(i,r)}};function e(e){return!D1(e)&&n0(`git.commit: requires the commit message to be supplied as a string/string[]`)}}var OCe=U$({"src/lib/tasks/commit.ts"(){TCe(),H1(),c0()}});function kCe(){return{firstCommit(){return this._runTask(r0([`rev-list`,`--max-parents=0`,`HEAD`],!0),R1(arguments))}}}var ACe=U$({"src/lib/tasks/first-commit.ts"(){H1(),c0()}});function jCe(e,t){let n=[`hash-object`,e];return t&&n.push(`-w`),r0(n,!0)}var MCe=U$({"src/lib/tasks/hash-object.ts"(){c0()}});function NCe(e,t,n){let r=String(n).trim(),i;if(i=Y0.exec(r))return new J0(e,t,!1,i[1]);if(i=X0.exec(r))return new J0(e,t,!0,i[1]);let a=``,o=r.split(` `);for(;o.length;)if(o.shift()===`in`){a=o.join(` `);break}return new J0(e,t,/^re/i.test(r),a)}var J0,Y0,X0,PCe=U$({"src/lib/responses/InitSummary.ts"(){J0=class{constructor(e,t,n,r){this.bare=e,this.path=t,this.existing=n,this.gitDir=r}},Y0=/^Init.+ repository in (.+)$/,X0=/^Rein.+ in (.+)$/}});function FCe(e){return e.includes(Z0)}function ICe(e=!1,t,n){let r=[`init`,...n];return e&&!FCe(r)&&r.splice(1,0,Z0),{commands:r,format:`utf-8`,parser(e){return NCe(r.includes(`--bare`),t,e)}}}var Z0,LCe=U$({"src/lib/tasks/init.ts"(){PCe(),Z0=`--bare`}});function Q0(e){for(let t=0;t<e.length;t++){let n=$0.exec(e[t]);if(n)return`--${n[1]}`}return``}function RCe(e){return $0.test(e)}var $0,e2=U$({"src/lib/args/log-format.ts"(){$0=/^--(stat|numstat|name-only|name-status)(=|$)/}}),t2,zCe=U$({"src/lib/responses/DiffSummary.ts"(){t2=class{constructor(){this.changed=0,this.deletions=0,this.insertions=0,this.files=[]}}}});function n2(e=``){let t=s2[e];return e=>B1(new t2,t,e,!1)}var r2,i2,a2,o2,s2,c2=U$({"src/lib/parsers/parse-diff-summary.ts"(){e2(),zCe(),w0(),H1(),r2=[new M1(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(e,[t,n,r=``])=>{e.files.push({file:t.trim(),changes:f1(n),insertions:r.replace(/[^+]/g,``).length,deletions:r.replace(/[^-]/g,``).length,binary:!1})}),new M1(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(e,[t,n,r])=>{e.files.push({file:t.trim(),before:f1(n),after:f1(r),binary:!0})}),new M1(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(e,[t,n])=>{let r=/(\d+) i/.exec(n),i=/(\d+) d/.exec(n);e.changed=f1(t),e.insertions=f1(r?.[1]),e.deletions=f1(i?.[1])})],i2=[new M1(/(\d+)\t(\d+)\t(.+)$/,(e,[t,n,r])=>{let i=f1(t),a=f1(n);e.changed++,e.insertions+=i,e.deletions+=a,e.files.push({file:r,changes:i+a,insertions:i,deletions:a,binary:!1})}),new M1(/-\t-\t(.+)$/,(e,[t])=>{e.changed++,e.files.push({file:t,after:0,before:0,binary:!0})})],a2=[new M1(/(.+)$/,(e,[t])=>{e.changed++,e.files.push({file:t,changes:0,insertions:0,deletions:0,binary:!1})})],o2=[new M1(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,(e,[t,n,r,i,a])=>{e.changed++,e.files.push({file:a??r,changes:0,insertions:0,deletions:0,binary:!1,status:h1(rCe(t)&&t),from:h1(!!a&&r!==a&&r),similarity:f1(n)})})],s2={"":r2,"--stat":r2,"--numstat":i2,"--name-status":o2,"--name-only":a2}}});function BCe(e,t){return t.reduce((t,n,r)=>(t[n]=e[r]||``,t),Object.create({diff:null}))}function l2(e=f2,t=p2,n=``){let r=n2(n);return function(n){let i=i1(n.trim(),!1,u2).map(function(n){let i=n.split(d2),a=BCe(i[0].split(e),t);return i.length>1&&i[1].trim()&&(a.diff=r(i[1])),a});return{all:i,latest:i.length&&i[0]||null,total:i.length}}}var u2,d2,f2,p2,m2=U$({"src/lib/parsers/parse-list-log-summary.ts"(){H1(),c2(),e2(),u2=`òòòòòò `,d2=` òò`,f2=` ò `,p2=[`hash`,`date`,`message`,`refs`,`author_name`,`author_email`]}}),h2={};W$(h2,{diffSummaryTask:()=>VCe,validateLogFormatConfig:()=>g2});function VCe(e){let t=Q0(e),n=[`diff`];return t===``&&(t=`--stat`,n.push(`--stat=4096`)),n.push(...e),g2(n)||{commands:n,format:`utf-8`,parser:n2(t)}}function g2(e){let t=e.filter(RCe);if(t.length>1)return n0(`Summary flags are mutually exclusive - pick one of ${t.join(`,`)}`);if(t.length&&e.includes(`-z`))return n0(`Summary flag ${t} parsing is not compatible with null termination option '-z'`)}var _2=U$({"src/lib/tasks/diff.ts"(){e2(),c2(),c0()}});function HCe(e,t){let n=[],r=[];return Object.keys(e).forEach(t=>{n.push(t),r.push(String(e[t]))}),[n,r.join(t)]}function UCe(e){return Object.keys(e).reduce((t,n)=>(n in y2||(t[n]=e[n]),t),{})}function v2(e={},t=[]){let n=b1(e.splitter,E1,f2),[r,i]=HCe(S1(e.format)?e.format:{hash:`%H`,date:e.strictDate===!1?`%ai`:`%aI`,message:`%s`,refs:`%D`,body:e.multiLine?`%B`:`%b`,author_name:e.mailMap===!1?`%an`:`%aN`,author_email:e.mailMap===!1?`%ae`:`%aE`},n),a=[],o=[`--pretty=format:${u2}${i}${d2}`,...t],s=e.n||e[`max-count`]||e.maxCount;if(s&&o.push(`--max-count=${s}`),e.from||e.to){let t=e.symmetric===!1?`..`:`...`;a.push(`${e.from||``}${t}${e.to||``}`)}return E1(e.file)&&o.push(`--follow`,P$(e.file)),F1(UCe(e),o),{fields:r,splitter:n,commands:[...o,...a]}}function WCe(e,t,n){let r=l2(e,t,Q0(n));return{commands:[`log`,...n],format:`utf-8`,parser:r}}function GCe(){return{log(...n){let r=R1(arguments),i=v2(L1(arguments),d1(b1(arguments[0],w1,[]))),a=t(...n)||g2(i.commands)||e(i);return this._runTask(a,r)}};function e(e){return WCe(e.splitter,e.fields,e.commands)}function t(e,t){return E1(e)&&E1(t)&&n0(`git.log(string, string) should be replaced with git.log({ from: string, to: string })`)}}var y2,b2=U$({"src/lib/tasks/log.ts"(){e2(),m2(),H1(),c0(),_2(),y2=(e=>(e[e[`--pretty`]=0]=`--pretty`,e[e[`max-count`]=1]=`max-count`,e[e.maxCount=2]=`maxCount`,e[e.n=3]=`n`,e[e.file=4]=`file`,e[e.format=5]=`format`,e[e.from=6]=`from`,e[e.to=7]=`to`,e[e.splitter=8]=`splitter`,e[e.symmetric=9]=`symmetric`,e[e.mailMap=10]=`mailMap`,e[e.multiLine=11]=`multiLine`,e[e.strictDate=12]=`strictDate`,e))(y2||{})}}),x2,S2,KCe=U$({"src/lib/responses/MergeSummary.ts"(){x2=class{constructor(e,t=null,n){this.reason=e,this.file=t,this.meta=n}toString(){return`${this.file}:${this.reason}`}},S2=class{constructor(){this.conflicts=[],this.merges=[],this.result=`success`}get failed(){return this.conflicts.length>0}get reason(){return this.result}toString(){return this.conflicts.length?`CONFLICTS: ${this.conflicts.join(`, `)}`:`OK`}}}}),C2,w2,qCe=U$({"src/lib/responses/PullSummary.ts"(){C2=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},w2=class{constructor(){this.remote=``,this.hash={local:``,remote:``},this.branch={local:``,remote:``},this.message=``}toString(){return this.message}}}});function T2(e){return e.objects=e.objects||{compressing:0,counting:0,enumerating:0,packReused:0,reused:{count:0,delta:0},total:{count:0,delta:0}}}function E2(e){let t=/^\s*(\d+)/.exec(e),n=/delta (\d+)/i.exec(e);return{count:f1(t&&t[1]||`0`),delta:f1(n&&n[1]||`0`)}}var D2,JCe=U$({"src/lib/parsers/parse-remote-objects.ts"(){H1(),D2=[new N1(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(e,[t,n])=>{let r=t.toLowerCase(),i=T2(e.remoteMessages);Object.assign(i,{[r]:f1(n)})}),new N1(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(e,[t,n])=>{let r=t.toLowerCase(),i=T2(e.remoteMessages);Object.assign(i,{[r]:f1(n)})}),new N1(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(e,[t,n,r])=>{let i=T2(e.remoteMessages);i.total=E2(t),i.reused=E2(n),i.packReused=f1(r)})]}});function O2(e,t){return B1({remoteMessages:new A2},k2,t)}var k2,A2,j2=U$({"src/lib/parsers/parse-remote-messages.ts"(){H1(),JCe(),k2=[new N1(/^remote:\s*(.+)$/,(e,[t])=>(e.remoteMessages.all.push(t.trim()),!1)),...D2,new N1([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(e,[t])=>{e.remoteMessages.pullRequestUrl=t}),new N1([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(e,[t,n,r])=>{e.remoteMessages.vulnerabilities={count:f1(t),summary:n,url:r}})],A2=class{constructor(){this.all=[]}}}});function YCe(e,t){let n=B1(new w2,I2,[e,t]);return n.message&&n}var M2,N2,P2,F2,I2,L2,R2,z2=U$({"src/lib/parsers/parse-pull.ts"(){qCe(),H1(),j2(),M2=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,N2=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,P2=/^(create|delete) mode \d+ (.+)/,F2=[new M1(M2,(e,[t,n,r])=>{e.files.push(t),n&&(e.insertions[t]=n.length),r&&(e.deletions[t]=r.length)}),new M1(N2,(e,[t,,n,,r])=>n!==void 0||r!==void 0?(e.summary.changes=+t||0,e.summary.insertions=+n||0,e.summary.deletions=+r||0,!0):!1),new M1(P2,(e,[t,n])=>{s1(e.files,n),s1(t===`create`?e.created:e.deleted,n)})],I2=[new M1(/^from\s(.+)$/i,(e,[t])=>void(e.remote=t)),new M1(/^fatal:\s(.+)$/,(e,[t])=>void(e.message=t)),new M1(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,(e,[t,n,r,i])=>{e.branch.local=r,e.hash.local=t,e.branch.remote=i,e.hash.remote=n})],L2=(e,t)=>B1(new C2,F2,[e,t]),R2=(e,t)=>Object.assign(new C2,L2(e,t),O2(e,t))}}),B2,V2,H2,XCe=U$({"src/lib/parsers/parse-merge.ts"(){KCe(),H1(),z2(),B2=[new M1(/^Auto-merging\s+(.+)$/,(e,[t])=>{e.merges.push(t)}),new M1(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(e,[t,n])=>{e.conflicts.push(new x2(t,n))}),new M1(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(e,[t,n,r])=>{e.conflicts.push(new x2(t,n,{deleteRef:r}))}),new M1(/^CONFLICT\s+\((.+)\):/,(e,[t])=>{e.conflicts.push(new x2(t,null))}),new M1(/^Automatic merge failed;\s+(.+)$/,(e,[t])=>{e.result=t})],V2=(e,t)=>Object.assign(H2(e,t),R2(e,t)),H2=e=>B1(new S2,B2,e)}});function U2(e){return e.length?{commands:[`merge`,...e],format:`utf-8`,parser(e,t){let n=V2(e,t);if(n.failed)throw new J$(n);return n}}:n0(`Git.merge requires at least one option`)}var ZCe=U$({"src/lib/tasks/merge.ts"(){Y$(),XCe(),c0()}});function QCe(e,t,n){let r=n.includes(`deleted`),i=n.includes(`tag`)||/^refs\/tags/.test(e),a=!n.includes(`new`);return{deleted:r,tag:i,branch:!i,new:!a,alreadyUpdated:a,local:e,remote:t}}var W2,G2,K2,$Ce=U$({"src/lib/parsers/parse-push.ts"(){H1(),j2(),W2=[new M1(/^Pushing to (.+)$/,(e,[t])=>{e.repo=t}),new M1(/^updating local tracking ref '(.+)'/,(e,[t])=>{e.ref={...e.ref||{},local:t}}),new M1(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(e,[t,n,r])=>{e.pushed.push(QCe(t,n,r))}),new M1(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(e,[t,n,r])=>{e.branch={...e.branch||{},local:t,remote:n,remoteName:r}}),new M1(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,(e,[t,n,r,i])=>{e.update={head:{local:t,remote:n},hash:{from:r,to:i}}})],G2=(e,t)=>{let n=K2(e,t),r=O2(e,t);return{...n,...r}},K2=(e,t)=>B1({pushed:[]},W2,[e,t])}}),q2={};W$(q2,{pushTagsTask:()=>ewe,pushTask:()=>J2});function ewe(e={},t){return s1(t,`--tags`),J2(e,t)}function J2(e={},t){let n=[`push`,...t];return e.branch&&n.splice(1,0,e.branch),e.remote&&n.splice(1,0,e.remote),c1(n,`-v`),s1(n,`--verbose`),s1(n,`--porcelain`),{commands:n,format:`utf-8`,parser:G2}}var Y2=U$({"src/lib/tasks/push.ts"(){$Ce(),H1()}});function twe(){return{showBuffer(){let e=[`show`,...I1(arguments,1)];return e.includes(`--binary`)||e.splice(1,0,`--binary`),this._runTask(i0(e),R1(arguments))},show(){let e=[`show`,...I1(arguments,1)];return this._runTask(r0(e),R1(arguments))}}}var nwe=U$({"src/lib/tasks/show.ts"(){H1(),c0()}}),X2,Z2,rwe=U$({"src/lib/responses/FileStatusSummary.ts"(){X2=/^(.+)\0(.+)$/,Z2=class{constructor(e,t,n){if(this.path=e,this.index=t,this.working_dir=n,t===`R`||n===`R`){let t=X2.exec(e)||[null,e,e];this.from=t[2]||``,this.path=t[1]||``}}}}});function Q2(e){let[t,n]=e.split(g1);return{from:n||t,to:t}}function $2(e,t,n){return[`${e}${t}`,n]}function e4(e,...t){return t.map(t=>$2(e,t,(e,t)=>e.conflicted.push(t)))}function iwe(e,t){let n=t.trim();switch(` `){case n.charAt(2):return r(n.charAt(0),n.charAt(1),n.slice(3));case n.charAt(1):return r(` `,n.charAt(0),n.slice(2));default:return}function r(t,n,r){let i=`${t}${n}`,a=n4.get(i);a&&a(e,r),i!==`##`&&i!==`!!`&&e.files.push(new Z2(r,t,n))}}var t4,n4,r4,awe=U$({"src/lib/responses/StatusSummary.ts"(){H1(),rwe(),t4=class{constructor(){this.not_added=[],this.conflicted=[],this.created=[],this.deleted=[],this.ignored=void 0,this.modified=[],this.renamed=[],this.files=[],this.staged=[],this.ahead=0,this.behind=0,this.current=null,this.tracking=null,this.detached=!1,this.isClean=()=>!this.files.length}},n4=new Map([$2(` `,`A`,(e,t)=>e.created.push(t)),$2(` `,`D`,(e,t)=>e.deleted.push(t)),$2(` `,`M`,(e,t)=>e.modified.push(t)),$2(`A`,` `,(e,t)=>{e.created.push(t),e.staged.push(t)}),$2(`A`,`M`,(e,t)=>{e.created.push(t),e.staged.push(t),e.modified.push(t)}),$2(`D`,` `,(e,t)=>{e.deleted.push(t),e.staged.push(t)}),$2(`M`,` `,(e,t)=>{e.modified.push(t),e.staged.push(t)}),$2(`M`,`M`,(e,t)=>{e.modified.push(t),e.staged.push(t)}),$2(`R`,` `,(e,t)=>{e.renamed.push(Q2(t))}),$2(`R`,`M`,(e,t)=>{let n=Q2(t);e.renamed.push(n),e.modified.push(n.to)}),$2(`!`,`!`,(e,t)=>{(e.ignored=e.ignored||[]).push(t)}),$2(`?`,`?`,(e,t)=>e.not_added.push(t)),...e4(`A`,`A`,`U`),...e4(`D`,`D`,`U`),...e4(`U`,`A`,`D`,`U`),[`##`,(e,t)=>{let n=/ahead (\d+)/,r=/behind (\d+)/,i=/^(.+?(?=(?:\.{3}|\s|$)))/,a=/\.{3}(\S*)/,o=/\son\s(\S+?)(?=\.{3}|$)/,s=n.exec(t);e.ahead=s&&+s[1]||0,s=r.exec(t),e.behind=s&&+s[1]||0,s=i.exec(t),e.current=b1(s?.[1],E1,null),s=a.exec(t),e.tracking=b1(s?.[1],E1,null),s=o.exec(t),s&&(e.current=b1(s?.[1],E1,e.current)),e.detached=/\(no branch\)/.test(t)}]]),r4=function(e){let t=e.split(g1),n=new t4;for(let e=0,r=t.length;e<r;){let r=t[e++].trim();r&&(r.charAt(0)===`R`&&(r+=g1+(t[e++]||``)),iwe(n,r))}return n}}});function owe(e){return{format:`utf-8`,commands:[`status`,`--porcelain`,`-b`,`-u`,`--null`,...e.filter(e=>!i4.includes(e))],parser(e){return r4(e)}}}var i4,swe=U$({"src/lib/tasks/status.ts"(){awe(),i4=[`--null`,`-z`]}});function a4(e=0,t=0,n=0,r=``,i=!0){return Object.defineProperty({major:e,minor:t,patch:n,agent:r,installed:i},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}function cwe(){return a4(0,0,0,``,!1)}function lwe(){return{version(){return this._runTask({commands:[`--version`],format:`utf-8`,parser:uwe,onError(e,t,n,r){if(e.exitCode===-2)return n(Buffer.from(o4));r(t)}})}}}function uwe(e){return e===o4?cwe():B1(a4(0,0,0,e),s4,e)}var o4,s4,dwe=U$({"src/lib/tasks/version.ts"(){H1(),o4=`installed=false`,s4=[new M1(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(e,[t,n,r,i=``])=>{Object.assign(e,a4(f1(t),f1(n),f1(r),i))}),new M1(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(e,[t,n,r,i=``])=>{Object.assign(e,a4(f1(t),f1(n),r,i))})]}});function c4(e,t,n,...r){return E1(n)?t(n,b1(r[0],E1),I1(arguments)):n0(`git.${e}() requires a string 'repoPath'`)}function fwe(){return{clone(e,...t){return this._runTask(c4(`clone`,l4,b1(e,E1),...t),R1(arguments))},mirror(e,...t){return this._runTask(c4(`mirror`,u4,b1(e,E1),...t),R1(arguments))}}}var l4,u4,pwe=U$({"src/lib/tasks/clone.ts"(){c0(),H1(),l4=(e,t,n)=>{let r=[`clone`,...n];return E1(e)&&r.push(P$(e)),E1(t)&&r.push(P$(t)),r0(r)},u4=(e,t,n)=>(s1(n,`--mirror`),l4(e,t,n))}}),d4={};W$(d4,{SimpleGitApi:()=>f4});var f4,mwe=U$({"src/lib/simple-git-api.ts"(){_Ce(),vCe(),bCe(),CCe(),OCe(),x0(),ACe(),k0(),MCe(),LCe(),b2(),ZCe(),Y2(),nwe(),swe(),c0(),dwe(),H1(),pwe(),f4=class{constructor(e){this._executor=e}_runTask(e,t){let n=this._executor.chain(),r=n.push(e);return t&&hCe(e,r,t),Object.create(this,{then:{value:r.then.bind(r)},catch:{value:r.catch.bind(r)},_executor:{value:n}})}add(e){return this._runTask(r0([`add`,...l1(e)]),R1(arguments))}cwd(e){let t=R1(arguments);return typeof e==`string`?this._runTask(W0(e,this._executor),t):typeof e?.path==`string`?this._runTask(W0(e.path,e.root&&this._executor||void 0),t):this._runTask(n0(`Git.cwd: workingDirectory must be supplied as a string`),t)}hashObject(e,t){return this._runTask(jCe(e,t===!0),R1(arguments))}init(e){return this._runTask(ICe(e===!0,this._executor.cwd,I1(arguments)),R1(arguments))}merge(){return this._runTask(U2(I1(arguments)),R1(arguments))}mergeFromTo(e,t){return E1(e)&&E1(t)?this._runTask(U2([e,t,...I1(arguments)]),R1(arguments,!1)):this._runTask(n0(`Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`))}outputHandler(e){return this._executor.outputHandler=e,this}push(){let e=J2({remote:b1(arguments[0],E1),branch:b1(arguments[1],E1)},I1(arguments));return this._runTask(e,R1(arguments))}stash(){return this._runTask(r0([`stash`,...I1(arguments)]),R1(arguments))}status(){return this._runTask(owe(I1(arguments)),R1(arguments))}},Object.assign(f4.prototype,yCe(),fwe(),DCe(),nCe(),SCe(),kCe(),oCe(),GCe(),twe(),lwe())}}),p4={};W$(p4,{Scheduler:()=>h4});var m4,h4,hwe=U$({"src/lib/runners/scheduler.ts"(){H1(),L0(),m4=(()=>{let e=0;return()=>{e++;let{promise:t,done:n}=(0,L$.createDeferred)();return{promise:t,done:n,id:e}}})(),h4=class{constructor(e=2){this.concurrency=e,this.logger=I0(``,`scheduler`),this.pending=[],this.running=[],this.logger(`Constructed, concurrency=%s`,e)}schedule(){if(!this.pending.length||this.running.length>=this.concurrency){this.logger(`Schedule attempt ignored, pending=%s running=%s concurrency=%s`,this.pending.length,this.running.length,this.concurrency);return}let e=s1(this.running,this.pending.shift());this.logger(`Attempting id=%s`,e.id),e.done(()=>{this.logger(`Completing id=`,e.id),c1(this.running,e),this.schedule()})}next(){let{promise:e,id:t}=s1(this.pending,m4());return this.logger(`Scheduling id=%s`,t),this.schedule(),e}}}}),g4={};W$(g4,{applyPatchTask:()=>gwe});function gwe(e,t){return r0([`apply`,...t,...e])}var _we=U$({"src/lib/tasks/apply-patch.ts"(){c0()}});function vwe(e,t){return{branch:e,hash:t,success:!0}}function ywe(e){return{branch:e,hash:null,success:!1}}var _4,bwe=U$({"src/lib/responses/BranchDeleteSummary.ts"(){_4=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}});function v4(e,t){return t===1&&b4.test(e)}var y4,b4,x4,S4,xwe=U$({"src/lib/parsers/parse-branch-delete.ts"(){bwe(),H1(),y4=/(\S+)\s+\(\S+\s([^)]+)\)/,b4=/^error[^']+'([^']+)'/m,x4=[new M1(y4,(e,[t,n])=>{let r=vwe(t,n);e.all.push(r),e.branches[t]=r}),new M1(b4,(e,[t])=>{let n=ywe(t);e.errors.push(n),e.all.push(n),e.branches[t]=n})],S4=(e,t)=>B1(new _4,x4,[e,t])}}),C4,Swe=U$({"src/lib/responses/BranchSummary.ts"(){C4=class{constructor(){this.all=[],this.branches={},this.current=``,this.detached=!1}push(e,t,n,r,i){e===`*`&&(this.detached=t,this.current=n),this.all.push(n),this.branches[n]={current:e===`*`,linkedWorkTree:e===`+`,name:n,commit:r,label:i}}}}});function w4(e){return e?e.charAt(0):``}function T4(e,t=!1){return B1(new C4,t?[D4]:E4,e)}var E4,D4,Cwe=U$({"src/lib/parsers/parse-branch.ts"(){Swe(),H1(),E4=[new M1(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(e,[t,n,r,i])=>{e.push(w4(t),!0,n,r,i)}),new M1(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,(e,[t,n,r,i])=>{e.push(w4(t),!1,n,r,i)})],D4=new M1(/^(\S+)$/s,(e,[t])=>{e.push(`*`,!1,t,``,``)})}}),O4={};W$(O4,{branchLocalTask:()=>Twe,branchTask:()=>wwe,containsDeleteBranchCommand:()=>k4,deleteBranchTask:()=>Dwe,deleteBranchesTask:()=>Ewe});function k4(e){let t=[`-d`,`-D`,`--delete`];return e.some(e=>t.includes(e))}function wwe(e){let t=k4(e),n=e.includes(`--show-current`),r=[`branch`,...e];return r.length===1&&r.push(`-a`),r.includes(`-v`)||r.splice(1,0,`-v`),{format:`utf-8`,commands:r,parser(e,r){return t?S4(e,r).all[0]:T4(e,n)}}}function Twe(){return{format:`utf-8`,commands:[`branch`,`-v`],parser(e){return T4(e)}}}function Ewe(e,t=!1){return{format:`utf-8`,commands:[`branch`,`-v`,t?`-D`:`-d`,...e],parser(e,t){return S4(e,t)},onError({exitCode:e,stdOut:t},n,r,i){if(!v4(String(n),e))return i(n);r(t)}}}function Dwe(e,t=!1){let n={format:`utf-8`,commands:[`branch`,`-v`,t?`-D`:`-d`,e],parser(t,n){return S4(t,n).branches[e]},onError({exitCode:e,stdErr:t,stdOut:r},i,a,o){if(!v4(String(i),e))return o(i);throw new J$(n.parser(m1(r),m1(t)),String(i))}};return n}var Owe=U$({"src/lib/tasks/branch.ts"(){Y$(),xwe(),Cwe(),H1()}});function kwe(e){let t=e.trim().replace(/^["']|["']$/g,``);return t&&_e(t)}var A4,Awe=U$({"src/lib/responses/CheckIgnore.ts"(){A4=e=>e.split(/\n/g).map(kwe).filter(Boolean)}}),j4={};W$(j4,{checkIgnoreTask:()=>jwe});function jwe(e){return{commands:[`check-ignore`,...e],format:`utf-8`,parser:A4}}var Mwe=U$({"src/lib/tasks/check-ignore.ts"(){Awe()}});function Nwe(e,t){return B1({raw:e,remote:null,branches:[],tags:[],updated:[],deleted:[]},M4,[e,t])}var M4,Pwe=U$({"src/lib/parsers/parse-fetch.ts"(){H1(),M4=[new M1(/From (.+)$/,(e,[t])=>{e.remote=t}),new M1(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(e,[t,n])=>{e.branches.push({name:t,tracking:n})}),new M1(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(e,[t,n])=>{e.tags.push({name:t,tracking:n})}),new M1(/- \[deleted]\s+\S+\s*-> (.+)$/,(e,[t])=>{e.deleted.push({tracking:t})}),new M1(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(e,[t,n,r,i])=>{e.updated.push({name:r,tracking:i,to:n,from:t})})]}}),N4={};W$(N4,{fetchTask:()=>Iwe});function Fwe(e){return/^--upload-pack(=|$)/.test(e)}function Iwe(e,t,n){let r=[`fetch`,...n];return e&&t&&r.push(e,t),r.find(Fwe)?n0(`git.fetch: potential exploit argument blocked.`):{commands:r,format:`utf-8`,parser:Nwe}}var Lwe=U$({"src/lib/tasks/fetch.ts"(){Pwe(),c0()}});function Rwe(e){return B1({moves:[]},P4,e)}var P4,zwe=U$({"src/lib/parsers/parse-move.ts"(){H1(),P4=[new M1(/^Renaming (.+) to (.+)$/,(e,[t,n])=>{e.moves.push({from:t,to:n})})]}}),F4={};W$(F4,{moveTask:()=>Bwe});function Bwe(e,t){return{commands:[`mv`,`-v`,...l1(e),t],format:`utf-8`,parser:Rwe}}var Vwe=U$({"src/lib/tasks/move.ts"(){zwe(),H1()}}),I4={};W$(I4,{pullTask:()=>Hwe});function Hwe(e,t,n){let r=[`pull`,...n];return e&&t&&r.splice(1,0,e,t),{commands:r,format:`utf-8`,parser(e,t){return R2(e,t)},onError(e,t,n,r){let i=YCe(m1(e.stdOut),m1(e.stdErr));if(i)return r(new J$(i));r(t)}}}var Uwe=U$({"src/lib/tasks/pull.ts"(){Y$(),z2(),H1()}});function Wwe(e){let t={};return L4(e,([e])=>t[e]={name:e}),Object.values(t)}function Gwe(e){let t={};return L4(e,([e,n,r])=>{Object.hasOwn(t,e)||(t[e]={name:e,refs:{fetch:``,push:``}}),r&&n&&(t[e].refs[r.replace(/[^a-z]/g,``)]=n)}),Object.values(t)}function L4(e,t){a1(e,e=>t(e.split(/\s+/)))}var Kwe=U$({"src/lib/responses/GetRemoteSummary.ts"(){H1()}}),R4={};W$(R4,{addRemoteTask:()=>qwe,getRemotesTask:()=>Jwe,listRemotesTask:()=>Ywe,remoteTask:()=>Xwe,removeRemoteTask:()=>Zwe});function qwe(e,t,n){return r0([`remote`,`add`,...n,e,t])}function Jwe(e){let t=[`remote`];return e&&t.push(`-v`),{commands:t,format:`utf-8`,parser:e?Gwe:Wwe}}function Ywe(e){let t=[...e];return t[0]!==`ls-remote`&&t.unshift(`ls-remote`),r0(t)}function Xwe(e){let t=[...e];return t[0]!==`remote`&&t.unshift(`remote`),r0(t)}function Zwe(e){return r0([`remote`,`remove`,e])}var Qwe=U$({"src/lib/tasks/remote.ts"(){Kwe(),c0()}}),z4={};W$(z4,{stashListTask:()=>$we});function $we(e={},t){let n=v2(e),r=[`stash`,`list`,...n.commands,...t],i=l2(n.splitter,n.fields,Q0(r));return g2(r)||{commands:r,format:`utf-8`,parser:i}}var eTe=U$({"src/lib/tasks/stash-list.ts"(){e2(),m2(),_2(),b2()}}),B4={};W$(B4,{addSubModuleTask:()=>tTe,initSubModuleTask:()=>nTe,subModuleTask:()=>V4,updateSubModuleTask:()=>rTe});function tTe(e,t){return V4([`add`,e,t])}function nTe(e){return V4([`init`,...e])}function V4(e){let t=[...e];return t[0]!==`submodule`&&t.unshift(`submodule`),r0(t)}function rTe(e){return V4([`update`,...e])}var iTe=U$({"src/lib/tasks/sub-module.ts"(){c0()}});function aTe(e,t){let n=Number.isNaN(e);return n===Number.isNaN(t)?n?H4(e,t):0:n?1:-1}function H4(e,t){return e===t?0:e>t?1:-1}function oTe(e){return e.trim()}function U4(e){return typeof e==`string`&&parseInt(e.replace(/^\D+/g,``),10)||0}var W4,G4,sTe=U$({"src/lib/responses/TagList.ts"(){W4=class{constructor(e,t){this.all=e,this.latest=t}},G4=function(e,t=!1){let n=e.split(`
|
|
720
|
-
`).map(oTe).filter(Boolean);t||n.sort(function(e,t){let n=e.split(`.`),r=t.split(`.`);if(n.length===1||r.length===1)return aTe(U4(n[0]),U4(r[0]));for(let e=0,t=Math.max(n.length,r.length);e<t;e++){let t=H4(U4(n[e]),U4(r[e]));if(t)return t}return 0});let r=t?n[0]:[...n].reverse().find(e=>e.indexOf(`.`)>=0);return new W4(n,r)}}}),K4={};W$(K4,{addAnnotatedTagTask:()=>uTe,addTagTask:()=>lTe,tagListTask:()=>cTe});function cTe(e=[]){let t=e.some(e=>/^--sort=/.test(e));return{format:`utf-8`,commands:[`tag`,`-l`,...e],parser(e){return G4(e,t)}}}function lTe(e){return{format:`utf-8`,commands:[`tag`,e],parser(){return{name:e}}}}function uTe(e,t){return{format:`utf-8`,commands:[`tag`,`-a`,`-m`,t,e],parser(){return{name:e}}}}var dTe=U$({"src/lib/tasks/tag.ts"(){sTe()}}),fTe=TSe({"src/git.js"(e,t){var{GitExecutor:n}=(mCe(),G$(H0)),{SimpleGitApi:r}=(mwe(),G$(d4)),{Scheduler:i}=(hwe(),G$(p4)),{adhocExecTask:a,configurationErrorTask:o}=(c0(),G$(e0)),{asArray:s,filterArray:c,filterPrimitives:l,filterString:u,filterStringOrStringArray:d,filterType:f,getTrailingOptions:p,trailingFunctionArgument:m,trailingOptionsArgument:h}=(H1(),G$(V1)),{applyPatchTask:g}=(_we(),G$(g4)),{branchTask:_,branchLocalTask:v,deleteBranchesTask:y,deleteBranchTask:b}=(Owe(),G$(O4)),{checkIgnoreTask:x}=(Mwe(),G$(j4)),{checkIsRepoTask:S}=(Y1(),G$(U1)),{cleanWithOptionsTask:C,isCleanOptionsArray:w}=(g0(),G$(l0)),{diffSummaryTask:T}=(_2(),G$(h2)),{fetchTask:E}=(Lwe(),G$(N4)),{moveTask:D}=(Vwe(),G$(F4)),{pullTask:O}=(Uwe(),G$(I4)),{pushTagsTask:ee}=(Y2(),G$(q2)),{addRemoteTask:te,getRemotesTask:ne,listRemotesTask:re,remoteTask:ie,removeRemoteTask:ae}=(Qwe(),G$(R4)),{getResetMode:oe,resetTask:se}=(P0(),G$(A0)),{stashListTask:k}=(eTe(),G$(z4)),{addSubModuleTask:ce,initSubModuleTask:le,subModuleTask:ue,updateSubModuleTask:A}=(iTe(),G$(B4)),{addAnnotatedTagTask:j,addTagTask:de,tagListTask:fe}=(dTe(),G$(K4)),{straightThroughBufferTask:pe,straightThroughStringTask:me}=(c0(),G$(e0));function M(e,t){this._plugins=t,this._executor=new n(e.baseDir,new i(e.maxConcurrentProcesses),t),this._trimmed=e.trimmed}(M.prototype=Object.create(r.prototype)).constructor=M,M.prototype.customBinary=function(e){return this._plugins.reconfigure(`binary`,e),this},M.prototype.env=function(e,t){return arguments.length===1&&typeof e==`object`?this._executor.env=e:(this._executor.env=this._executor.env||{})[e]=t,this},M.prototype.stashList=function(e){return this._runTask(k(h(arguments)||{},c(e)&&e||[]),m(arguments))},M.prototype.mv=function(e,t){return this._runTask(D(e,t),m(arguments))},M.prototype.checkoutLatestTag=function(e){var t=this;return this.pull(function(){t.tags(function(n,r){t.checkout(r.latest,e)})})},M.prototype.pull=function(e,t,n,r){return this._runTask(O(f(e,u),f(t,u),p(arguments)),m(arguments))},M.prototype.fetch=function(e,t){return this._runTask(E(f(e,u),f(t,u),p(arguments)),m(arguments))},M.prototype.silent=function(e){return this._runTask(a(()=>console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this method will be removed.")))},M.prototype.tags=function(e,t){return this._runTask(fe(p(arguments)),m(arguments))},M.prototype.rebase=function(){return this._runTask(me([`rebase`,...p(arguments)]),m(arguments))},M.prototype.reset=function(e){return this._runTask(se(oe(e),p(arguments)),m(arguments))},M.prototype.revert=function(e){let t=m(arguments);return typeof e==`string`?this._runTask(me([`revert`,...p(arguments,0,!0),e]),t):this._runTask(o(`Commit must be a string`),t)},M.prototype.addTag=function(e){let t=typeof e==`string`?de(e):o(`Git.addTag requires a tag name`);return this._runTask(t,m(arguments))},M.prototype.addAnnotatedTag=function(e,t){return this._runTask(j(e,t),m(arguments))},M.prototype.deleteLocalBranch=function(e,t,n){return this._runTask(b(e,typeof t==`boolean`&&t),m(arguments))},M.prototype.deleteLocalBranches=function(e,t,n){return this._runTask(y(e,typeof t==`boolean`&&t),m(arguments))},M.prototype.branch=function(e,t){return this._runTask(_(p(arguments)),m(arguments))},M.prototype.branchLocal=function(e){return this._runTask(v(),m(arguments))},M.prototype.raw=function(e){let t=!Array.isArray(e),n=[].slice.call(t?arguments:e,0);for(let e=0;e<n.length&&t;e++)if(!l(n[e])){n.splice(e,n.length-e);break}n.push(...p(arguments,0,!0));var r=m(arguments);return n.length?this._runTask(me(n,this._trimmed),r):this._runTask(o(`Raw: must supply one or more command to execute`),r)},M.prototype.submoduleAdd=function(e,t,n){return this._runTask(ce(e,t),m(arguments))},M.prototype.submoduleUpdate=function(e,t){return this._runTask(A(p(arguments,!0)),m(arguments))},M.prototype.submoduleInit=function(e,t){return this._runTask(le(p(arguments,!0)),m(arguments))},M.prototype.subModule=function(e,t){return this._runTask(ue(p(arguments)),m(arguments))},M.prototype.listRemote=function(){return this._runTask(re(p(arguments)),m(arguments))},M.prototype.addRemote=function(e,t,n){return this._runTask(te(e,t,p(arguments)),m(arguments))},M.prototype.removeRemote=function(e,t){return this._runTask(ae(e),m(arguments))},M.prototype.getRemotes=function(e,t){return this._runTask(ne(e===!0),m(arguments))},M.prototype.remote=function(e,t){return this._runTask(ie(p(arguments)),m(arguments))},M.prototype.tag=function(e,t){let n=p(arguments);return n[0]!==`tag`&&n.unshift(`tag`),this._runTask(me(n),m(arguments))},M.prototype.updateServerInfo=function(e){return this._runTask(me([`update-server-info`]),m(arguments))},M.prototype.pushTags=function(e,t){let n=ee({remote:f(e,u)},p(arguments));return this._runTask(n,m(arguments))},M.prototype.rm=function(e){return this._runTask(me([`rm`,`-f`,...s(e)]),m(arguments))},M.prototype.rmKeepLocal=function(e){return this._runTask(me([`rm`,`--cached`,...s(e)]),m(arguments))},M.prototype.catFile=function(e,t){return this._catFile(`utf-8`,arguments)},M.prototype.binaryCatFile=function(){return this._catFile(`buffer`,arguments)},M.prototype._catFile=function(e,t){var n=m(t),r=[`cat-file`],i=t[0];if(typeof i==`string`)return this._runTask(o(`Git.catFile: options must be supplied as an array of strings`),n);Array.isArray(i)&&r.push.apply(r,i);let a=e===`buffer`?pe(r):me(r);return this._runTask(a,n)},M.prototype.diff=function(e,t){let n=u(e)?o(`git.diff: supplying options as a single string is no longer supported, switch to an array of strings`):me([`diff`,...p(arguments)]);return this._runTask(n,m(arguments))},M.prototype.diffSummary=function(){return this._runTask(T(p(arguments,1)),m(arguments))},M.prototype.applyPatch=function(e){let t=d(e)?g(s(e),p([].slice.call(arguments,1))):o(`git.applyPatch requires one or more string patches as the first argument`);return this._runTask(t,m(arguments))},M.prototype.revparse=function(){let e=[`rev-parse`,...p(arguments,!0)];return this._runTask(me(e,!0),m(arguments))},M.prototype.clean=function(e,t,n){let r=w(e),i=r&&e.join(``)||f(e,u)||``,a=p([].slice.call(arguments,+!!r));return this._runTask(C(i,a),m(arguments))},M.prototype.exec=function(e){return this._runTask({commands:[],format:`utf-8`,parser(){typeof e==`function`&&e()}})},M.prototype.clearQueue=function(){return this._runTask(a(()=>console.warn(`simple-git deprecation notice: clearQueue() is deprecated and will be removed, switch to using the abortPlugin instead.`)))},M.prototype.checkIgnore=function(e,t){return this._runTask(x(s(f(e,d,[]))),m(arguments))},M.prototype.checkIsRepo=function(e,t){return this._runTask(S(f(e,u)),m(arguments))},t.exports=M}});q$(),q$(),q$(),Y$(),Z$(),Y1(),g0(),x0(),w0(),k0(),P0(),H1(),H1(),(0,L$.deferred)().promise,H1(),q$(),H1(),H1(),H1(),H1(),fTe(),Y$();var pTe=i(((e,t)=>{function n(e){return Array.isArray(e)?e:[e]}let r=/^\s+$/,i=/(?:[^\\]|^)\\$/,a=/^\\!/,o=/^\\#/,s=/\r?\n/g,c=/^\.*\/|^\.+$/,l=`node-ignore`;typeof Symbol<`u`&&(l=Symbol.for(`node-ignore`));let u=l,d=(e,t,n)=>Object.defineProperty(e,t,{value:n}),f=/([0-z])-([0-z])/g,p=()=>!1,m=e=>e.replace(f,(e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:``),h=e=>{let{length:t}=e;return e.slice(0,t-t%2)},g=[[/^\uFEFF/,()=>``],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(n.indexOf(`\\`)===0?` `:``)],[/(\\+?)\s/g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+` `}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>`[^/]`],[/^\//,()=>`^`],[/\//g,()=>`\\/`],[/^\^*\\\*\\\*\\\//,()=>`^(?:.*\\/)?`],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?`^`:`(?:^|\\/)`}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?`(?:\\/[^\\/]+)*`:`\\/.+`],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,`[^\\/]*`)],[/\\\\\\(?=[$.|*+(){^])/g,()=>`\\`],[/\\\\/g,()=>`\\`],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r,i)=>t===`\\`?`\\[${n}${h(r)}${i}`:i===`]`&&r.length%2==0?`[${m(n)}${r}]`:`[]`],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:`[^/]*`}(?=$|\\/$)`]],_=Object.create(null),v=(e,t)=>{let n=_[e];return n||(n=g.reduce((t,[n,r])=>t.replace(n,r.bind(e)),e),_[e]=n),t?new RegExp(n,`i`):new RegExp(n)},y=e=>typeof e==`string`,b=e=>e&&y(e)&&!r.test(e)&&!i.test(e)&&e.indexOf(`#`)!==0,x=e=>e.split(s);var S=class{constructor(e,t,n,r){this.origin=e,this.pattern=t,this.negative=n,this.regex=r}};let C=(e,t)=>{let n=e,r=!1;e.indexOf(`!`)===0&&(r=!0,e=e.substr(1)),e=e.replace(a,`!`).replace(o,`#`);let i=v(e,t);return new S(n,e,r,i)},w=(e,t)=>{throw new t(e)},T=(e,t,n)=>y(e)?e?!T.isNotRelative(e)||n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):n(`path must not be empty`,TypeError):n(`path must be a string, but got \`${t}\``,TypeError),E=e=>c.test(e);T.isNotRelative=E,T.convert=e=>e;var D=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){d(this,u,!0),this._rules=[],this._ignoreCase=t,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[u]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(b(e)){let t=C(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,n(y(e)?x(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,t){let n=!1,r=!1;return this._rules.forEach(i=>{let{negative:a}=i;r===a&&n!==r||a&&!n&&!r&&!t||i.regex.test(e)&&(n=!a,r=a)}),{ignored:n,unignored:r}}_test(e,t,n,r){let i=e&&T.convert(e);return T(i,e,this._allowRelativePaths?p:w),this._t(i,t,n,r)}_t(e,t,n,r){if(e in t)return t[e];if(r||=e.split(`/`),r.pop(),!r.length)return t[e]=this._testOne(e,n);let i=this._t(r.join(`/`)+`/`,t,n,r);return t[e]=i.ignored?i:this._testOne(e,n)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return n(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};let O=e=>new D(e);if(O.isPathValid=e=>T(e&&T.convert(e),e,p),O.default=O,t.exports=O,typeof process<`u`&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform===`win32`)){T.convert=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,`/`);let e=/^[a-z]:\//i;T.isNotRelative=t=>e.test(t)||E(t)}})),mTe=i(((e,t)=>{function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}let r=new Int32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function i(e){if(Buffer.isBuffer(e))return e;if(typeof e==`number`)return Buffer.alloc(e);if(typeof e==`string`)return Buffer.from(e);throw Error(`input must be buffer, number, or string, received `+typeof e)}function a(e){let t=i(4);return t.writeInt32BE(e,0),t}function o(e,t){e=i(e),Buffer.isBuffer(t)&&(t=t.readUInt32BE(0));let n=~~t^-1;for(var a=0;a<e.length;a++)n=r[(n^e[a])&255]^n>>>8;return n^-1}function s(){return a(o.apply(null,arguments))}s.signed=function(){return o.apply(null,arguments)},s.unsigned=function(){return o.apply(null,arguments)>>>0},t.exports=n(s)})),q4=i((e=>{var n=t(`fs`),r=t(`stream`).Transform,i=t(`stream`).PassThrough,a=t(`zlib`),o=t(`util`),s=t(`events`).EventEmitter,c=t(`events`).errorMonitor,l=mTe();e.ZipFile=u,e.dateToDosDateTime=ce,o.inherits(u,s);function u(){this.outputStream=new i,this.entries=[],this.outputStreamCursor=0,this.ended=!1,this.allDone=!1,this.forceZip64Eocd=!1,this.errored=!1,this.on(c,function(){this.errored=!0})}u.prototype.addFile=function(e,t,r){var i=this;if(t=S(t,!1),r??={},!_(i)){var a=new w(t,!1,r);i.entries.push(a),n.stat(e,function(t,o){if(t)return i.emit(`error`,t);if(!o.isFile())return i.emit(`error`,Error(`not a file: `+e));a.uncompressedSize=o.size,r.mtime??a.setLastModDate(o.mtime),r.mode??a.setFileAttributesMode(o.mode),a.setFileDataPumpFunction(function(){var t=n.createReadStream(e);a.state=w.FILE_DATA_IN_PROGRESS,t.on(`error`,function(e){i.emit(`error`,e)}),p(i,a,t)}),h(i)})}},u.prototype.addReadStream=function(e,t,n){this.addReadStreamLazy(t,n,function(t){t(null,e)})},u.prototype.addReadStreamLazy=function(e,t,n){var r=this;if(typeof t==`function`&&(n=t,t=null),t??={},e=S(e,!1),!_(r)){var i=new w(e,!1,t);r.entries.push(i),i.setFileDataPumpFunction(function(){i.state=w.FILE_DATA_IN_PROGRESS,n(function(e,t){if(e)return r.emit(`error`,e);p(r,i,t)})}),h(r)}},u.prototype.addBuffer=function(e,t,n){var r=this;if(t=S(t,!1),e.length>1073741823)throw Error(`buffer too large: `+e.length+` > 1073741823`);if(n??={},n.size!=null)throw Error(`options.size not allowed`);if(_(r))return;var i=new w(t,!1,n);i.uncompressedSize=e.length,i.crc32=l.unsigned(e),i.crcAndFileSizeKnown=!0,r.entries.push(i),i.compressionLevel===0?o(e):a.deflateRaw(e,{level:i.compressionLevel},function(e,t){o(t)});function o(e){i.compressedSize=e.length,i.setFileDataPumpFunction(function(){f(r,e),f(r,i.getDataDescriptor()),i.state=w.FILE_DATA_DONE,setImmediate(function(){h(r)})}),h(r)}},u.prototype.addEmptyDirectory=function(e,t){var n=this;if(e=S(e,!0),t??={},t.size!=null)throw Error(`options.size not allowed`);if(t.compress!=null)throw Error(`options.compress not allowed`);if(t.compressionLevel!=null)throw Error(`options.compressionLevel not allowed`);if(!_(n)){var r=new w(e,!0,t);n.entries.push(r),r.setFileDataPumpFunction(function(){f(n,r.getDataDescriptor()),r.state=w.FILE_DATA_DONE,h(n)}),h(n)}};var d=me([80,75,5,6]);u.prototype.end=function(e,t){if(typeof e==`function`&&(t=e,e=null),e??={},!this.ended&&(this.ended=!0,!this.errored)){if(this.calculatedTotalSizeCallback=t,this.forceZip64Eocd=!!e.forceZip64Format,e.comment){if(this.comment=typeof e.comment==`string`?fe(e.comment):e.comment,this.comment.length>65535)throw Error(`comment is too large`);if(M(this.comment,d))throw Error(`comment contains end of central directory record signature`)}else this.comment=C;h(this)}};function f(e,t){e.outputStream.write(t),e.outputStreamCursor+=t.length}function p(e,t,n){var r=new A,o=new ue,s=t.compressionLevel===0?new i:new a.DeflateRaw({level:t.compressionLevel}),c=new ue;n.pipe(r).pipe(o).pipe(s).pipe(c).pipe(e.outputStream,{end:!1}),c.on(`end`,function(){if(t.crc32=r.crc32,t.uncompressedSize==null)t.uncompressedSize=o.byteCount;else if(t.uncompressedSize!==o.byteCount)return e.emit(`error`,Error(`file data stream has unexpected number of bytes`));t.compressedSize=c.byteCount,e.outputStreamCursor+=t.compressedSize,f(e,t.getDataDescriptor()),t.state=w.FILE_DATA_DONE,h(e)})}function m(e){if(e.compress!=null&&e.compressionLevel!=null&&!!e.compress!=!!e.compressionLevel)throw Error(`conflicting settings for compress and compressionLevel`);return e.compressionLevel==null?e.compress===!1?0:6:e.compressionLevel}function h(e){if(e.allDone||e.errored)return;if(e.ended&&e.calculatedTotalSizeCallback!=null){var t=g(e);t!=null&&(e.calculatedTotalSizeCallback(t),e.calculatedTotalSizeCallback=null)}var n=r();function r(){for(var t=0;t<e.entries.length;t++){var n=e.entries[t];if(n.state<w.FILE_DATA_DONE)return n}return null}if(n!=null){if(n.state<w.READY_TO_PUMP_FILE_DATA||n.state===w.FILE_DATA_IN_PROGRESS)return;n.relativeOffsetOfLocalHeader=e.outputStreamCursor,f(e,n.getLocalFileHeader()),n.doFileDataPump()}else e.ended&&(e.offsetOfStartOfCentralDirectory=e.outputStreamCursor,e.entries.forEach(function(t){f(e,t.getCentralDirectoryRecord())}),f(e,x(e)),e.outputStream.end(),e.allDone=!0)}function g(e){for(var t=0,n=0,r=0;r<e.entries.length;r++){var i=e.entries[r];if(i.compressionLevel!==0)return-1;if(i.state>=w.READY_TO_PUMP_FILE_DATA){if(i.uncompressedSize==null)return-1}else if(i.uncompressedSize==null)return null;i.relativeOffsetOfLocalHeader=t;var a=i.useZip64Format();t+=T+i.utf8FileName.length,t+=i.uncompressedSize,i.crcAndFileSizeKnown||(t+=a?re:ne),n+=ie+i.utf8FileName.length+i.fileComment.length,i.forceDosTimestamp||(n+=ae),a&&(n+=oe)}var o=0;return(e.forceZip64Eocd||e.entries.length>=65535||n>=65535||t>=4294967295)&&(o+=v+y),o+=b+e.comment.length,t+n+o}function _(e){if(e.ended)throw Error(`cannot add entries after calling end()`);return!!e.errored}var v=56,y=20,b=22;function x(e,t){var n=!1,r=e.entries.length;(e.forceZip64Eocd||e.entries.length>=65535)&&(r=65535,n=!0);var i=e.outputStreamCursor-e.offsetOfStartOfCentralDirectory,a=i;(e.forceZip64Eocd||i>=4294967295)&&(a=4294967295,n=!0);var o=e.offsetOfStartOfCentralDirectory;if((e.forceZip64Eocd||e.offsetOfStartOfCentralDirectory>=4294967295)&&(o=4294967295,n=!0),t)return n?v+y+b:b;var s=pe(b+e.comment.length);if(s.writeUInt32LE(101010256,0),s.writeUInt16LE(0,4),s.writeUInt16LE(0,6),s.writeUInt16LE(r,8),s.writeUInt16LE(r,10),s.writeUInt32LE(a,12),s.writeUInt32LE(o,16),s.writeUInt16LE(e.comment.length,20),e.comment.copy(s,22),!n)return s;var c=pe(v);c.writeUInt32LE(101075792,0),le(c,v-12,4),c.writeUInt16LE(O,12),c.writeUInt16LE(D,14),c.writeUInt32LE(0,16),c.writeUInt32LE(0,20),le(c,e.entries.length,24),le(c,e.entries.length,32),le(c,i,40),le(c,e.offsetOfStartOfCentralDirectory,48);var l=pe(y);return l.writeUInt32LE(117853008,0),l.writeUInt32LE(0,4),le(l,e.outputStreamCursor,8),l.writeUInt32LE(1,16),Buffer.concat([c,l,s])}function S(e,t){if(e===``)throw Error(`empty metadataPath`);if(e=e.replace(/\\/g,`/`),/^[a-zA-Z]:/.test(e)||/^\//.test(e))throw Error(`absolute path: `+e);if(e.split(`/`).indexOf(`..`)!==-1)throw Error(`invalid relative path: `+e);var n=/\/$/.test(e);if(t)n||(e+=`/`);else if(n)throw Error(`file path cannot end with '/': `+e);return e}var C=pe(0);function w(e,t,n){if(this.utf8FileName=me(e),this.utf8FileName.length>65535)throw Error(`utf8 file name too long. `+utf8FileName.length+` > 65535`);if(this.isDirectory=t,this.state=w.WAITING_FOR_METADATA,this.setLastModDate(n.mtime==null?new Date:n.mtime),this.forceDosTimestamp=!!n.forceDosTimestamp,n.mode==null?this.setFileAttributesMode(t?16893:33204):this.setFileAttributesMode(n.mode),t?(this.crcAndFileSizeKnown=!0,this.crc32=0,this.uncompressedSize=0,this.compressedSize=0):(this.crcAndFileSizeKnown=!1,this.crc32=null,this.uncompressedSize=null,this.compressedSize=null,n.size!=null&&(this.uncompressedSize=n.size)),this.compressionLevel=t?0:m(n),this.forceZip64Format=!!n.forceZip64Format,n.fileComment){if(this.fileComment=typeof n.fileComment==`string`?me(n.fileComment,`utf-8`):n.fileComment,this.fileComment.length>65535)throw Error(`fileComment is too large`)}else this.fileComment=C}w.WAITING_FOR_METADATA=0,w.READY_TO_PUMP_FILE_DATA=1,w.FILE_DATA_IN_PROGRESS=2,w.FILE_DATA_DONE=3,w.prototype.setLastModDate=function(e){this.mtime=e;var t=ce(e);this.lastModFileTime=t.time,this.lastModFileDate=t.date},w.prototype.setFileAttributesMode=function(e){if((e&65535)!==e)throw Error(`invalid mode. expected: 0 <= `+e+` <= 65535`);this.externalFileAttributes=e<<16>>>0},w.prototype.setFileDataPumpFunction=function(e){this.doFileDataPump=e,this.state=w.READY_TO_PUMP_FILE_DATA},w.prototype.useZip64Format=function(){return this.forceZip64Format||this.uncompressedSize!=null&&this.uncompressedSize>4294967294||this.compressedSize!=null&&this.compressedSize>4294967294||this.relativeOffsetOfLocalHeader!=null&&this.relativeOffsetOfLocalHeader>4294967294};var T=30,E=20,D=45,O=831,ee=2048,te=8;w.prototype.getLocalFileHeader=function(){var e=0,t=0,n=0;this.crcAndFileSizeKnown&&(e=this.crc32,t=this.compressedSize,n=this.uncompressedSize);var r=pe(T),i=ee;return this.crcAndFileSizeKnown||(i|=te),r.writeUInt32LE(67324752,0),r.writeUInt16LE(E,4),r.writeUInt16LE(i,6),r.writeUInt16LE(this.getCompressionMethod(),8),r.writeUInt16LE(this.lastModFileTime,10),r.writeUInt16LE(this.lastModFileDate,12),r.writeUInt32LE(e,14),r.writeUInt32LE(t,18),r.writeUInt32LE(n,22),r.writeUInt16LE(this.utf8FileName.length,26),r.writeUInt16LE(0,28),Buffer.concat([r,this.utf8FileName])};var ne=16,re=24;w.prototype.getDataDescriptor=function(){if(this.crcAndFileSizeKnown)return C;if(this.useZip64Format()){var e=pe(re);return e.writeUInt32LE(134695760,0),e.writeUInt32LE(this.crc32,4),le(e,this.compressedSize,8),le(e,this.uncompressedSize,16),e}var e=pe(ne);return e.writeUInt32LE(134695760,0),e.writeUInt32LE(this.crc32,4),e.writeUInt32LE(this.compressedSize,8),e.writeUInt32LE(this.uncompressedSize,12),e};var ie=46,ae=9,oe=28;w.prototype.getCentralDirectoryRecord=function(){var e=pe(ie),t=ee;this.crcAndFileSizeKnown||(t|=te);var n=C;if(!this.forceDosTimestamp){n=pe(ae),n.writeUInt16LE(21589,0),n.writeUInt16LE(ae-4,2),n.writeUInt8(3,4);var r=Math.floor(this.mtime.getTime()/1e3);r<-2147483648&&(r=-2147483648),r>2147483647&&(r=2147483647),n.writeUInt32LE(r,5)}var i=this.compressedSize,a=this.uncompressedSize,o=this.relativeOffsetOfLocalHeader,s=E,c=C;return this.useZip64Format()&&(i=4294967295,a=4294967295,o=4294967295,s=D,c=pe(oe),c.writeUInt16LE(1,0),c.writeUInt16LE(oe-4,2),le(c,this.uncompressedSize,4),le(c,this.compressedSize,12),le(c,this.relativeOffsetOfLocalHeader,20)),e.writeUInt32LE(33639248,0),e.writeUInt16LE(O,4),e.writeUInt16LE(s,6),e.writeUInt16LE(t,8),e.writeUInt16LE(this.getCompressionMethod(),10),e.writeUInt16LE(this.lastModFileTime,12),e.writeUInt16LE(this.lastModFileDate,14),e.writeUInt32LE(this.crc32,16),e.writeUInt32LE(i,20),e.writeUInt32LE(a,24),e.writeUInt16LE(this.utf8FileName.length,28),e.writeUInt16LE(n.length+c.length,30),e.writeUInt16LE(this.fileComment.length,32),e.writeUInt16LE(0,34),e.writeUInt16LE(0,36),e.writeUInt32LE(this.externalFileAttributes,38),e.writeUInt32LE(o,42),Buffer.concat([e,this.utf8FileName,n,c,this.fileComment])},w.prototype.getCompressionMethod=function(){return this.compressionLevel===0?0:8};var se=new Date(1980,0,1),k=new Date(2107,11,31,23,59,58);function ce(e){e<se?e=se:e>k&&(e=k);var t=0;t|=e.getDate()&31,t|=(e.getMonth()+1&15)<<5,t|=(e.getFullYear()-1980&127)<<9;var n=0;return n|=Math.floor(e.getSeconds()/2),n|=(e.getMinutes()&63)<<5,n|=(e.getHours()&31)<<11,{date:t,time:n}}function le(e,t,n){var r=Math.floor(t/4294967296),i=t%4294967296;e.writeUInt32LE(i,n),e.writeUInt32LE(r,n+4)}o.inherits(ue,r);function ue(e){r.call(this,e),this.byteCount=0}ue.prototype._transform=function(e,t,n){this.byteCount+=e.length,n(null,e)},o.inherits(A,r);function A(e){r.call(this,e),this.crc32=0}A.prototype._transform=function(e,t,n){this.crc32=l.unsigned(e,this.crc32),n(null,e)};var j=`\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\xA0`;if(j.length!==256)throw Error(`assertion failure`);var de=null;function fe(e){if(/^[\x20-\x7e]*$/.test(e))return me(e,`utf-8`);if(de==null){de={};for(var t=0;t<j.length;t++)de[j[t]]=t}for(var n=pe(e.length),t=0;t<e.length;t++){var r=de[e[t]];if(r==null)throw Error(`character not encodable in CP437: `+JSON.stringify(e[t]));n[t]=r}return n}function pe(e){pe=t;try{return pe(e)}catch{return pe=n,pe(e)}function t(e){return Buffer.allocUnsafe(e)}function n(e){return new Buffer(e)}}function me(e,t){me=n;try{return me(e,t)}catch{return me=r,me(e,t)}function n(e,t){return Buffer.from(e,t)}function r(e,t){return new Buffer(e,t)}}function M(e,t){M=n;try{return M(e,t)}catch{return M=r,M(e,t)}function n(e,t){return e.includes(t)}function r(e,t){for(var n=0;n<=e.length-t.length;n++)for(var r=0;;r++){if(r===t.length)return!0;if(e[n+r]!==t[r])break}return!1}}})),J4=e(pTe(),1),hTe=e(q4(),1);Ne(o);const gTe=si({source:F(),pluginProvider:F().optional(),skill:F().optional(),ref:F().optional(),contentHash:F(),files:z(F()).optional(),localHash:F().optional(),baselineRef:F().optional(),publisher:F().optional(),importedAt:Fr(),autoUpdate:L().optional()});si({schema:W(1),skills:H(F(),gTe).default({})}),new Set(Object.values(sd)),[...new Set([`.git`,`node_modules`])];const Y4=[`agents`,`claude`,`cursor`,`codex`,`opencode`,`pi`,`copilot`];var _Te=i(((e,t)=>{t.exports=n;function n(){this.pending=0,this.max=1/0,this.listeners=[],this.waiting=[],this.error=null}n.prototype.go=function(e){this.pending<this.max?i(this,e):this.waiting.push(e)},n.prototype.wait=function(e){this.pending===0?e(this.error):this.listeners.push(e)},n.prototype.hold=function(){return r(this)};function r(e){e.pending+=1;var t=!1;return n;function n(n){if(t)throw Error(`callback called twice`);if(t=!0,e.error=e.error||n,--e.pending,e.waiting.length>0&&e.pending<e.max)i(e,e.waiting.shift());else if(e.pending===0){var a=e.listeners;e.listeners=[],a.forEach(r)}}function r(t){t(e.error)}}function i(e,t){t(r(e))}})),vTe=i((e=>{var n=t(`fs`),r=t(`util`),i=t(`stream`),a=i.Readable,o=i.PassThrough,s=_Te(),c=t(`events`).EventEmitter;e.BufferSlicer=d,e.FdSlicer=l,r.inherits(l,c);function l(e){c.call(this),this.fd=e,this.pend=new s,this.pend.max=1,this.refCount=0}l.prototype.read=function(e,t,r,i,a){var o=this;o.pend.go(function(s){n.read(o.fd,e,t,r,i,function(e,t,n){s(),a(e,t,n)})})},l.prototype.createReadStream=function(e){return new u(this,e)},l.prototype.ref=function(){this.refCount+=1},l.prototype.unref=function(){var e=this;if(--e.refCount,e.refCount<0)throw Error(`invalid unref`);if(e.refCount>0)return;n.close(e.fd,t);function t(t){t?e.emit(`error`,t):e.emit(`close`)}},r.inherits(u,a);function u(e,t){t||={},a.call(this,t),this.context=e,this.context.ref(),this.start=t.start||0,this.endOffset=t.end,this.pos=this.start}u.prototype._read=function(e){var t=this,r=Math.min(t._readableState.highWaterMark,e);if(t.endOffset!=null&&(r=Math.min(r,t.endOffset-t.pos)),r<=0){t.push(null),this._cleanup();return}t.context.pend.go(function(e){var i=Buffer.allocUnsafe(r);n.read(t.context.fd,i,0,r,t.pos,function(n,r){n?t.destroy(n):r===0?(t.push(null),t._cleanup()):(t.pos+=r,t.push(i.slice(0,r))),e()})})},u.prototype._destroy=function(e,t){this._cleanup(),t(e)},u.prototype._cleanup=function(){this.context!=null&&(this.context.unref(),this.context=null)},r.inherits(d,c);function d(e){c.call(this),this.refCount=0,this.buffer=e}d.prototype.read=function(e,t,n,r,i){if(!(0<=t&&t<=e.length))throw RangeError(`offset outside buffer: 0 <= `+t+` <= `+e.length);if(r<0)throw RangeError(`position is negative: `+r);if(t+n>e.length&&(n=e.length-t),r+n>this.buffer.length&&(n=this.buffer.length-r),n<=0){setImmediate(function(){i(null,0)});return}this.buffer.copy(e,t,r,r+n),setImmediate(function(){i(null,n)})},d.prototype.createReadStream=function(e){e||={};var t=new o(e);t.start=e.start||0,t.endOffset=e.end,t.pos=t.endOffset||this.buffer.length;for(var n=this.buffer.slice(t.start,t.pos),r=65536,i=0;;){var a=i+r;if(a>=n.length){i<n.length&&t.write(n.slice(i,n.length));break}t.write(n.slice(i,a)),i=a}return t.end(),t},d.prototype.ref=function(){this.refCount+=1},d.prototype.unref=function(){if(--this.refCount,this.refCount<0)throw Error(`invalid unref`)}})),yTe=i(((e,t)=>{let n=new Int32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function r(e){let t=-1;for(let r of e)t=n[(t^r)&255]^t>>>8;return(t^-1)>>>0}t.exports=r})),bTe=i((e=>{t(`fs`);var n=t(`zlib`);vTe();var r=t(`util`),i=t(`events`).EventEmitter,a=t(`stream`).Transform,o=t(`stream`).PassThrough,s=t(`stream`).Writable;let c=typeof n.crc32==`function`?n.crc32:yTe();r.inherits(l,i);function l(e,t,n,r,a,o,s,c,l,u){var f=this;i.call(f),f.reader=e,f.reader.on(`error`,function(e){d(f,e)}),f.reader.once(`close`,function(){f.emit(`close`)}),f.readEntryCursor=t,f.fileSize=n,f.entryCount=r,f.comment=a,f.entriesRead=0,f.autoClose=!!o,f.lazyEntries=!!s,f.decodeStrings=!!c,f.validateEntrySizes=!!l,f.strictFileNames=!!u,f.isOpen=!0,f.emittedError=!1,f.hasEachEntryBeenCalled=!1,f.lazyEntries||f._readEntry()}l.prototype.close=function(){this.isOpen&&(this.isOpen=!1,this.reader.unref())};function u(e,t){e.autoClose&&e.close(),d(e,t)}function d(e,t){e.emittedError||(e.emittedError=!0,e.emit(`error`,t))}l.prototype.readEntry=function(){if(!this.lazyEntries)throw Error(`readEntry() called without lazyEntries:true`);this._readEntry()},l.prototype._readEntry=function(){var e=this;if(e.entryCount===e.entriesRead){setImmediate(function(){e.autoClose&&e.close(),!e.emittedError&&e.emit(`end`)});return}if(!e.emittedError){var t=T(46);v(e.reader,t,0,t.length,e.readEntryCursor,function(n){if(n)return u(e,n);if(!e.emittedError){var r=new f,i=t.readUInt32LE(0);if(i!==33639248)return u(e,Error(`invalid central directory file header signature: 0x`+i.toString(16)));if(r.versionMadeBy=t.readUInt16LE(4),r.versionNeededToExtract=t.readUInt16LE(6),r.generalPurposeBitFlag=t.readUInt16LE(8),r.compressionMethod=t.readUInt16LE(10),r.lastModFileTime=t.readUInt16LE(12),r.lastModFileDate=t.readUInt16LE(14),r.crc32=t.readUInt32LE(16),r.compressedSize=t.readUInt32LE(20),r.uncompressedSize=t.readUInt32LE(24),r.fileNameLength=t.readUInt16LE(28),r.extraFieldLength=t.readUInt16LE(30),r.fileCommentLength=t.readUInt16LE(32),r.internalFileAttributes=t.readUInt16LE(36),r.externalFileAttributes=t.readUInt32LE(38),r.relativeOffsetOfLocalHeader=t.readUInt32LE(42),r.generalPurposeBitFlag&64)return u(e,Error(`strong encryption is not supported`));e.readEntryCursor+=46,t=T(r.fileNameLength+r.extraFieldLength+r.fileCommentLength),v(e.reader,t,0,t.length,e.readEntryCursor,function(n){if(n)return u(e,n);if(!e.emittedError){r.fileNameRaw=t.subarray(0,r.fileNameLength);var i=r.fileNameLength+r.extraFieldLength;r.extraFieldRaw=t.subarray(r.fileNameLength,i),r.fileCommentRaw=t.subarray(i,i+r.fileCommentLength);try{r.extraFields=_(r.extraFieldRaw)}catch(t){return u(e,t)}if(e.decodeStrings){var a=!!(r.generalPurposeBitFlag&2048);r.fileComment=C(r.fileCommentRaw,a),r.fileName=h(r.generalPurposeBitFlag,r.fileNameRaw,r.extraFields,e.strictFileNames);var o=g(r.fileName);if(o!=null)return u(e,Error(o))}else r.fileComment=r.fileCommentRaw,r.fileName=r.fileNameRaw;r.comment=r.fileComment,e.readEntryCursor+=t.length,e.entriesRead+=1;for(var s=0;s<r.extraFields.length;s++){var c=r.extraFields[s];if(c.id===1){var l=c.data,d=0;if(r.uncompressedSize===4294967295){if(d+8>l.length)return u(e,Error(`zip64 extended information extra field does not include uncompressed size`));r.uncompressedSize=w(l,d),d+=8}if(r.compressedSize===4294967295){if(d+8>l.length)return u(e,Error(`zip64 extended information extra field does not include compressed size`));r.compressedSize=w(l,d),d+=8}if(r.relativeOffsetOfLocalHeader===4294967295){if(d+8>l.length)return u(e,Error(`zip64 extended information extra field does not include relative header offset`));r.relativeOffsetOfLocalHeader=w(l,d),d+=8}break}}if(e.validateEntrySizes&&r.compressionMethod===0){var f=r.uncompressedSize;if(r.isEncrypted()&&(f+=12),r.compressedSize!==f){var p=`compressed/uncompressed size mismatch for stored file: `+r.compressedSize+` != `+r.uncompressedSize;return u(e,Error(p))}}e.emit(`entry`,r),e.lazyEntries||e._readEntry()}})}})}},l.prototype.eachEntry=function(){let e=this;if(!e.lazyEntries)throw Error(`eachEntry() requires lazyEntries: true`);if(e.hasEachEntryBeenCalled)throw Error(`eachEntry() must only be called once per ZipFile`);e.hasEachEntryBeenCalled=!0;let t=null;e.on(`entry`,r),e.on(`end`,i),e.on(`error`,a);function n(){e.removeListener(`entry`,r),e.removeListener(`end`,i),e.removeListener(`error`,a),e.autoClose&&e.close()}function r(e){let{resolve:n}=t;t=null,n({value:e})}function i(){let{resolve:e}=t;t=null,n(),e({done:!0})}function a(e){let{reject:r}=t;t=null,n(),r(e)}return{[Symbol.asyncIterator](){return this},next(){let n=new Promise((e,n)=>{if(t!=null)throw Error(`next() called before previous Promise was resolved.`);t={resolve:e,reject:n}});return e.readEntry(),n},return(e){return n(),Promise.resolve({done:!0,value:e})},throw(e){return n(),Promise.reject(e)}}},l.prototype.openReadStream=function(e,t,n){var r=this,i=0,a=e.compressedSize;if(n??(n=t,t=null),t==null)t={};else{if(t.decodeFileData===!1){if(t.decrypt!=null)throw Error(`cannot use options.decrypt when options.decodeFileData === false`);if(t.decompress!=null)throw Error(`cannot use options.decompress when options.decodeFileData === false`)}else{if(t.decrypt!=null){if(!e.isEncrypted())throw Error(`options.decrypt can only be specified for encrypted entries. See also option decodeFileData.`);if(t.decrypt!==!1)throw Error(`invalid options.decrypt value: `+t.decrypt);if(e.isCompressed()&&t.decompress!==!1)throw Error(`entry is encrypted and compressed, and options.decompress !== false. See also option decodeFileData.`)}if(t.decompress!=null){if(!e.isCompressed())throw Error(`options.decompress can only be specified for compressed entries. See also option decodeFileData.`);if(t.decompress!==!1&&t.decompress!==!0)throw Error(`invalid options.decompress value: `+t.decompress);s=t.decompress}}if(t.start!=null){if(i=t.start,i<0)throw Error(`options.start < 0`);if(i>e.compressedSize)throw Error(`options.start > entry.compressedSize`)}if(t.end!=null){if(a=t.end,a<0)throw Error(`options.end < 0`);if(a>e.compressedSize)throw Error(`options.end > entry.compressedSize`);if(a<i)throw Error(`options.end < options.start`)}}var o=t.decodeFileData===!1||(e.compressionMethod===0||e.compressionMethod===8&&t.decompress===!1)&&(!e.isEncrypted()||t.decrypt===!1);if((t.start!=null||t.end!=null)&&!o)throw Error(`start/end range require options.decodeFileData === false for non-trivial encoded entries.`);if(!r.isOpen)return n(Error(`closed`));if(e.isEncrypted()&&!o&&t.decrypt!==!1)return n(Error(`entry is encrypted, and options.decodeFileData !== false`));var s;if(o)s=!1;else if(e.compressionMethod===8)s=t.decodeFileData!==!0;else return n(Error(`unsupported compression method: `+e.compressionMethod));r.readLocalFileHeader(e,{minimal:!0},function(t,o){if(t)return n(t);r.openReadStreamLowLevel(o.fileDataStart,e.compressedSize,i,a,s,e.uncompressedSize,n)})},l.prototype.openReadStreamLowLevel=function(e,t,r,i,a,o,s){var c=this;e+t;var l=c.reader.createReadStream({start:e+r,end:e+i}),u=l;if(a){var d=!1,f=n.createInflateRaw();l.on(`error`,function(e){setImmediate(function(){d||f.emit(`error`,e)})}),l.pipe(f),c.validateEntrySizes?(u=new y(o),f.on(`error`,function(e){setImmediate(function(){d||u.emit(`error`,e)})}),f.pipe(u)):u=f,E(u,function(){d=!0,f!==u&&f.unpipe(u),l.unpipe(f),l.destroy()})}s(null,u)},l.prototype.readLocalFileHeader=function(e,t,n){var r=this;n??(n=t,t=null),t??={},r.reader.ref();var i=T(30);v(r.reader,i,0,i.length,e.relativeOffsetOfLocalHeader,function(a){try{if(a)return n(a);var o=i.readUInt32LE(0);if(o!==67324752)return n(Error(`invalid local file header signature: 0x`+o.toString(16)));var s=i.readUInt16LE(26),c=i.readUInt16LE(28),l=e.relativeOffsetOfLocalHeader+30+s+c;if(l+e.compressedSize>r.fileSize)return n(Error(`file data overflows file bounds: `+l+` + `+e.compressedSize+` > `+r.fileSize));if(t.minimal)return n(null,{fileDataStart:l});var u=new p;u.fileDataStart=l,u.versionNeededToExtract=i.readUInt16LE(4),u.generalPurposeBitFlag=i.readUInt16LE(6),u.compressionMethod=i.readUInt16LE(8),u.lastModFileTime=i.readUInt16LE(10),u.lastModFileDate=i.readUInt16LE(12),u.crc32=i.readUInt32LE(14),u.compressedSize=i.readUInt32LE(18),u.uncompressedSize=i.readUInt32LE(22),u.fileNameLength=s,u.extraFieldLength=c,i=T(s+c),r.reader.ref(),v(r.reader,i,0,i.length,e.relativeOffsetOfLocalHeader+30,function(e){try{return e?n(e):(u.fileName=i.subarray(0,s),u.extraField=i.subarray(s),n(null,u))}finally{r.reader.unref()}})}finally{r.reader.unref()}})},l.prototype.openReadStreamPromise=function(e,t){return new Promise((n,r)=>{this.openReadStream(e,t,function(e,t){if(e)return r(e);n(t)})})},l.prototype.openReadStreamLowLevelPromise=function(e,t,n,r,i,a){return new Promise((o,s)=>{this.openReadStream(e,t,n,r,i,a,function(e,t){if(e)return s(e);o(t)})})},l.prototype.readLocalFileHeaderPromise=function(e,t){return new Promise((n,r)=>{this.readLocalFileHeader(e,t,function(e,t){if(e)return r(e);n(t)})})};function f(){}f.prototype.getLastModDate=function(e){if(e??={},!e.forceDosFormat)for(var t=0;t<this.extraFields.length;t++){var n=this.extraFields[t];if(n.id===21589){var r=n.data;if(r.length<5||!(r[0]&1))continue;var i=r.readInt32LE(1);return new Date(i*1e3)}if(n.id===10){var r=n.data;if(r.length!==32||r.readUInt16LE(4)!==1||r.readUInt16LE(6)!==24)continue;var a=(r.readUInt32LE(8)+4294967296*r.readInt32LE(12))/1e4-0xa9730b66800;return new Date(a)}}return m(this.lastModFileDate,this.lastModFileTime,e.timezone)},f.prototype.canDecodeFileData=function(){return!this.isEncrypted()&&(this.compressionMethod===0||this.compressionMethod===8)},f.prototype.isEncrypted=function(){return!!(this.generalPurposeBitFlag&1)},f.prototype.isCompressed=function(){return this.compressionMethod===8};function p(){}function m(e,t,n){var r=e&31,i=(e>>5&15)-1,a=(e>>9&127)+1980,o=0,s=(t&31)*2,c=t>>5&63,l=t>>11&31;if(n==null||n===`local`)return new Date(a,i,r,l,c,s,o);if(n===`UTC`)return new Date(Date.UTC(a,i,r,l,c,s,o));throw Error(`unrecognized options.timezone: `+options.timezone)}function h(e,t,n,r){for(var i=null,a=0;a<n.length;a++){var o=n[a];if(o.id===28789){if(o.data.length<6||o.data.readUInt8(0)!==1)continue;var s=o.data.readUInt32LE(1);if(c(t)!==s)continue;i=C(o.data.subarray(5),!0);break}}return i??=C(t,!!(e&2048)),r||(i=i.replace(/\\/g,`/`)),i}function g(e){return e.indexOf(`\\`)===-1?/^[a-zA-Z]:/.test(e)||/^\//.test(e)?`absolute path: `+e:e.split(`/`).indexOf(`..`)===-1?null:`invalid relative path: `+e:`invalid characters in fileName: `+e}function _(e){for(var t=[],n=0;n<e.length-3;){var r=e.readUInt16LE(n+0),i=e.readUInt16LE(n+2),a=n+4,o=a+i;if(o>e.length)throw Error(`extra field length exceeds extra field buffer size`);var s=e.subarray(a,o);t.push({id:r,data:s}),n=o}return t}function v(e,t,n,r,i,a){if(r===0)return setImmediate(function(){a(null,T(0))});e.read(t,n,r,i,function(e,t){if(e)return a(e);if(t<r)return a(Error(`unexpected EOF`));a()})}r.inherits(y,a);function y(e){a.call(this),this.actualByteCount=0,this.expectedByteCount=e}y.prototype._transform=function(e,t,n){if(this.actualByteCount+=e.length,this.actualByteCount>this.expectedByteCount){var r=`too many bytes in the stream. expected `+this.expectedByteCount+`. got at least `+this.actualByteCount;return n(Error(r))}n(null,e)},y.prototype._flush=function(e){if(this.actualByteCount<this.expectedByteCount){var t=`not enough bytes in the stream. expected `+this.expectedByteCount+`. got only `+this.actualByteCount;return e(Error(t))}e()},r.inherits(b,i);function b(){i.call(this),this.refCount=0}b.prototype.ref=function(){this.refCount+=1},b.prototype.unref=function(){var e=this;if(--e.refCount,e.refCount>0)return;if(e.refCount<0)throw Error(`invalid unref`);e.close(t);function t(t){if(t)return e.emit(`error`,t);e.emit(`close`)}},b.prototype.createReadStream=function(e){e??={};var t=e.start,n=e.end;if(t===n){var r=new o;return setImmediate(function(){r.end()}),r}var i=this._readStreamForRange(t,n),a=!1,s=new x(this);i.on(`error`,function(e){setImmediate(function(){a||s.emit(`error`,e)})}),E(s,function(){i.unpipe(s),s.unref(),i.destroy()});var c=new y(n-t);return s.on(`error`,function(e){setImmediate(function(){a||c.emit(`error`,e)})}),E(c,function(){a=!0,s.unpipe(c),s.destroy()}),i.pipe(s).pipe(c)},b.prototype._readStreamForRange=function(e,t){throw Error(`not implemented`)},b.prototype.read=function(e,t,n,r,i){var a=this.createReadStream({start:r,end:r+n}),o=new s,c=0;o._write=function(n,r,i){n.copy(e,t+c,0,n.length),c+=n.length,i()},o.on(`finish`,i),a.on(`error`,function(e){i(e)}),a.pipe(o)},b.prototype.close=function(e){setImmediate(e)},r.inherits(x,o);function x(e){o.call(this),this.context=e,this.context.ref(),this.unreffedYet=!1}x.prototype._flush=function(e){this.unref(),e()},x.prototype.unref=function(e){this.unreffedYet||(this.unreffedYet=!0,this.context.unref())};var S=`\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\xA0`;function C(e,t){if(t)return e.toString(`utf8`);for(var n=``,r=0;r<e.length;r++)n+=S[e[r]];return n}function w(e,t){var n=e.readUInt32LE(t);return e.readUInt32LE(t+4)*4294967296+n}var T=typeof Buffer.allocUnsafe==`function`?function(e){return Buffer.allocUnsafe(e)}:function(e){return new Buffer(e)};function E(e,t){typeof e.destroy==`function`?e._destroy=function(e,n){t(),n?.(e)}:e.destroy=t}})),X4=i(((e,t)=>{function n(e){if(e.length===0)return;let t=Object.create(null),n=0;for(;n<e.length;++n){let t=e.charCodeAt(n);if(u[t]!==1){if(t!==47||n===0)return;break}}if(n===e.length)return;let i=e.slice(0,n).toLowerCase(),a=++n;for(;n<e.length;++n){let i=e.charCodeAt(n);if(u[i]!==1){if(n===a||r(e,n,t)===void 0)return;break}}if(n!==a)return{type:i,subtype:e.slice(a,n).toLowerCase(),params:t}}function r(e,t,n){for(;t<e.length;){for(;t<e.length;++t){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}if(t===e.length)break;if(e.charCodeAt(t++)!==59)return;for(;t<e.length;++t){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}if(t===e.length)return;let r,i=t;for(;t<e.length;++t){let n=e.charCodeAt(t);if(u[n]!==1){if(n!==61)return;break}}if(t===e.length||(r=e.slice(i,t),++t,t===e.length))return;let a=``,o;if(e.charCodeAt(t)===34){o=++t;let n=!1;for(;t<e.length;++t){let r=e.charCodeAt(t);if(r===92){n?(o=t,n=!1):(a+=e.slice(o,t),n=!0);continue}if(r===34){if(n){o=t,n=!1;continue}a+=e.slice(o,t);break}if(n&&=(o=t-1,!1),d[r]!==1)return}if(t===e.length)return;++t}else{for(o=t;t<e.length;++t){let n=e.charCodeAt(t);if(u[n]!==1){if(t===o)return;break}}a=e.slice(o,t)}r=r.toLowerCase(),n[r]===void 0&&(n[r]=a)}return n}function i(e,t){if(e.length===0)return;let n=Object.create(null),r=0;for(;r<e.length;++r){let i=e.charCodeAt(r);if(u[i]!==1){if(a(e,r,n,t)===void 0)return;break}}return{type:e.slice(0,r).toLowerCase(),params:n}}function a(e,t,n,r){for(;t<e.length;){for(;t<e.length;++t){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}if(t===e.length)break;if(e.charCodeAt(t++)!==59)return;for(;t<e.length;++t){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}if(t===e.length)return;let i,a=t;for(;t<e.length;++t){let n=e.charCodeAt(t);if(u[n]!==1){if(n===61)break;return}}if(t===e.length)return;let o=``,s,l;if(i=e.slice(a,t),i.charCodeAt(i.length-1)===42){let n=++t;for(;t<e.length;++t){let n=e.charCodeAt(t);if(f[n]!==1){if(n!==39)return;break}}if(t===e.length)return;for(l=e.slice(n,t),++t;t<e.length&&e.charCodeAt(t)!==39;++t);if(t===e.length||(++t,t===e.length))return;s=t;let r=0;for(;t<e.length;++t){let n=e.charCodeAt(t);if(p[n]!==1){if(n===37){let n,i;if(t+2<e.length&&(n=m[e.charCodeAt(t+1)])!==-1&&(i=m[e.charCodeAt(t+2)])!==-1){let a=(n<<4)+i;o+=e.slice(s,t),o+=String.fromCharCode(a),t+=2,s=t+1,a>=128?r=2:r===0&&(r=1);continue}return}break}}if(o+=e.slice(s,t),o=c(o,l,r),o===void 0)return}else{if(++t,t===e.length)return;if(e.charCodeAt(t)===34){s=++t;let n=!1;for(;t<e.length;++t){let r=e.charCodeAt(t);if(r===92){n?(s=t,n=!1):(o+=e.slice(s,t),n=!0);continue}if(r===34){if(n){s=t,n=!1;continue}o+=e.slice(s,t);break}if(n&&=(s=t-1,!1),d[r]!==1)return}if(t===e.length)return;++t}else{for(s=t;t<e.length;++t){let n=e.charCodeAt(t);if(u[n]!==1){if(t===s)return;break}}o=e.slice(s,t)}if(o=r(o,2),o===void 0)return}i=i.toLowerCase(),n[i]===void 0&&(n[i]=o)}return n}function o(e){let t;for(;;)switch(e){case`utf-8`:case`utf8`:return s.utf8;case`latin1`:case`ascii`:case`us-ascii`:case`iso-8859-1`:case`iso8859-1`:case`iso88591`:case`iso_8859-1`:case`windows-1252`:case`iso_8859-1:1987`:case`cp1252`:case`x-cp1252`:return s.latin1;case`utf16le`:case`utf-16le`:case`ucs2`:case`ucs-2`:return s.utf16le;case`base64`:return s.base64;default:if(t===void 0){t=!0,e=e.toLowerCase();continue}return s.other.bind(e)}}let s={utf8:(e,t)=>{if(e.length===0)return``;if(typeof e==`string`){if(t<2)return e;e=Buffer.from(e,`latin1`)}return e.utf8Slice(0,e.length)},latin1:(e,t)=>e.length===0?``:typeof e==`string`?e:e.latin1Slice(0,e.length),utf16le:(e,t)=>e.length===0?``:(typeof e==`string`&&(e=Buffer.from(e,`latin1`)),e.ucs2Slice(0,e.length)),base64:(e,t)=>e.length===0?``:(typeof e==`string`&&(e=Buffer.from(e,`latin1`)),e.base64Slice(0,e.length)),other:(t,n)=>{if(t.length===0)return``;typeof t==`string`&&(t=Buffer.from(t,`latin1`));try{return new TextDecoder(e).decode(t)}catch{}}};function c(e,t,n){let r=o(t);if(r)return r(e,n)}function l(e){if(typeof e!=`string`)return``;for(let t=e.length-1;t>=0;--t)switch(e.charCodeAt(t)){case 47:case 92:return e=e.slice(t+1),e===`..`||e===`.`?``:e}return e===`..`||e===`.`?``:e}let u=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],d=[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],f=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,1,0,1,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],p=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,1,0,0,0,0,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],m=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1];t.exports={basename:l,convertToUTF8:c,getDecoder:o,parseContentType:n,parseDisposition:i}})),xTe=i(((e,t)=>{function n(e,t,n,r,i){for(let a=0;a<i;++a)if(e[t+a]!==n[r+a])return!1;return!0}var r=class{constructor(e,t){if(typeof t!=`function`)throw Error(`Missing match callback`);if(typeof e==`string`)e=Buffer.from(e);else if(!Buffer.isBuffer(e))throw Error(`Expected Buffer for needle, got ${typeof e}`);let n=e.length;if(this.maxMatches=1/0,this.matches=0,this._cb=t,this._lookbehindSize=0,this._needle=e,this._bufPos=0,this._lookbehind=Buffer.allocUnsafe(n),this._occ=[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],n>1)for(let t=0;t<n-1;++t)this._occ[e[t]]=n-1-t}reset(){this.matches=0,this._lookbehindSize=0,this._bufPos=0}push(e,t){let n;Buffer.isBuffer(e)||(e=Buffer.from(e,`latin1`));let r=e.length;for(this._bufPos=t||0;n!==r&&this.matches<this.maxMatches;)n=i(this,e);return n}destroy(){let e=this._lookbehindSize;e&&this._cb(!1,this._lookbehind,0,e,!1),this.reset()}};function i(e,t){let r=t.length,i=e._needle,o=i.length,s=-e._lookbehindSize,c=o-1,l=i[c],u=r-o,d=e._occ,f=e._lookbehind;if(s<0){for(;s<0&&s<=u;){let n=s+c,r=n<0?f[e._lookbehindSize+n]:t[n];if(r===l&&a(e,t,s,c))return e._lookbehindSize=0,++e.matches,s>-e._lookbehindSize?e._cb(!0,f,0,e._lookbehindSize+s,!1):e._cb(!0,void 0,0,0,!0),e._bufPos=s+o;s+=d[r]}for(;s<0&&!a(e,t,s,r-s);)++s;if(s<0){let n=e._lookbehindSize+s;return n>0&&e._cb(!1,f,0,n,!1),e._lookbehindSize-=n,f.copy(f,0,n,e._lookbehindSize),f.set(t,e._lookbehindSize),e._lookbehindSize+=r,e._bufPos=r,r}e._cb(!1,f,0,e._lookbehindSize,!1),e._lookbehindSize=0}s+=e._bufPos;let p=i[0];for(;s<=u;){let r=t[s+c];if(r===l&&t[s]===p&&n(i,0,t,s,c))return++e.matches,s>0?e._cb(!0,t,e._bufPos,s,!0):e._cb(!0,void 0,0,0,!0),e._bufPos=s+o;s+=d[r]}for(;s<r;){if(t[s]!==p||!n(t,s,i,0,r-s)){++s;continue}t.copy(f,0,s,r),e._lookbehindSize=r-s;break}return s>0&&e._cb(!1,t,e._bufPos,s<r?s:r,!0),e._bufPos=r,r}function a(e,t,n,r){let i=e._lookbehind,a=e._lookbehindSize,o=e._needle;for(let e=0;e<r;++e,++n)if((n<0?i[a+n]:t[n])!==o[e])return!1;return!0}t.exports=r})),STe=i(((e,n)=>{let{Readable:r,Writable:i}=t(`stream`),a=xTe(),{basename:o,convertToUTF8:s,getDecoder:c,parseContentType:l,parseDisposition:u}=X4(),d=Buffer.from(`\r
|
|
721
|
-
`),f=Buffer.from(`\r`),p=Buffer.from(`-`);function m(){}let h=16384;var g=class{constructor(e){this.header=Object.create(null),this.pairCount=0,this.byteCount=0,this.state=0,this.name=``,this.value=``,this.crlf=0,this.cb=e}reset(){this.header=Object.create(null),this.pairCount=0,this.byteCount=0,this.state=0,this.name=``,this.value=``,this.crlf=0}push(e,t,n){let r=t;for(;t<n;)switch(this.state){case 0:{let i=!1;for(;t<n;++t){if(this.byteCount===h)return-1;++this.byteCount;let n=e[t];if(w[n]!==1){if(n!==58||(this.name+=e.latin1Slice(r,t),this.name.length===0))return-1;++t,i=!0,this.state=1;break}}if(!i){this.name+=e.latin1Slice(r,t);break}}case 1:{let i=!1;for(;t<n;++t){if(this.byteCount===h)return-1;++this.byteCount;let n=e[t];if(n!==32&&n!==9){r=t,i=!0,this.state=2;break}}if(!i)break}case 2:switch(this.crlf){case 0:for(;t<n;++t){if(this.byteCount===h)return-1;++this.byteCount;let n=e[t];if(T[n]!==1){if(n!==13)return-1;++this.crlf;break}}this.value+=e.latin1Slice(r,t++);break;case 1:if(this.byteCount===h||(++this.byteCount,e[t++]!==10))return-1;++this.crlf;break;case 2:{if(this.byteCount===h)return-1;++this.byteCount;let n=e[t];n===32||n===9?(r=t,this.crlf=0):(++this.pairCount<2e3&&(this.name=this.name.toLowerCase(),this.header[this.name]===void 0?this.header[this.name]=[this.value]:this.header[this.name].push(this.value)),n===13?(++this.crlf,++t):(r=t,this.crlf=0,this.state=0,this.name=``,this.value=``));break}case 3:{if(this.byteCount===h||(++this.byteCount,e[t++]!==10))return-1;let n=this.header;return this.reset(),this.cb(n),t}}}return t}},_=class extends r{constructor(e,t){super(e),this.truncated=!1,this._readcb=null,this.once(`end`,()=>{if(this._read(),--t._fileEndsLeft===0&&t._finalcb){let e=t._finalcb;t._finalcb=null,process.nextTick(e)}})}_read(e){let t=this._readcb;t&&(this._readcb=null,t())}};let v={push:(e,t)=>{},destroy:()=>{}};function y(e,t){let n=e._writecb;e._writecb=null,t?e.destroy(t):n&&n()}function b(e,t){return e}var x=class extends i{constructor(e){let t={autoDestroy:!0,emitClose:!0,highWaterMark:typeof e.highWaterMark==`number`?e.highWaterMark:void 0};if(super(t),!e.conType.params||typeof e.conType.params.boundary!=`string`)throw Error(`Multipart: Boundary not found`);let n=e.conType.params.boundary,r=typeof e.defParamCharset==`string`&&e.defParamCharset?c(e.defParamCharset):b,i=e.defCharset||`utf8`,h=e.preservePath,y={autoDestroy:!0,emitClose:!0,highWaterMark:typeof e.fileHwm==`number`?e.fileHwm:void 0},x=e.limits,S=x&&typeof x.fieldSize==`number`?x.fieldSize:1048576,C=x&&typeof x.fileSize==`number`?x.fileSize:1/0,w=x&&typeof x.files==`number`?x.files:1/0,T=x&&typeof x.fields==`number`?x.fields:1/0,E=x&&typeof x.parts==`number`?x.parts:1/0,D=-1,O=0,ee=0,te=!1;this._fileEndsLeft=0,this._fileStream=void 0,this._complete=!1;let ne=0,re,ie=0,ae,oe,se,k,ce=!1,le=!1,ue=!1;this._hparser=null;let A=new g(e=>{this._hparser=null,te=!1,se=`text/plain`,ae=i,oe=`7bit`,k=void 0,ce=!1;let t;if(!e[`content-disposition`]){te=!0;return}let n=u(e[`content-disposition`][0],r);if(!n||n.type!==`form-data`){te=!0;return}if(n.params&&(n.params.name&&(k=n.params.name),n.params[`filename*`]?t=n.params[`filename*`]:n.params.filename&&(t=n.params.filename),t!==void 0&&!h&&(t=o(t))),e[`content-type`]){let t=l(e[`content-type`][0]);t&&(se=`${t.type}/${t.subtype}`,t.params&&typeof t.params.charset==`string`&&(ae=t.params.charset.toLowerCase()))}if(e[`content-transfer-encoding`]&&(oe=e[`content-transfer-encoding`][0].toLowerCase()),se===`application/octet-stream`||t!==void 0){if(ee===w){le||(le=!0,this.emit(`filesLimit`)),te=!0;return}if(++ee,this.listenerCount(`file`)===0){te=!0;return}ne=0,this._fileStream=new _(y,this),++this._fileEndsLeft,this.emit(`file`,k,this._fileStream,{filename:t,encoding:oe,mimeType:se})}else{if(O===T){ue||(ue=!0,this.emit(`fieldsLimit`)),te=!0;return}if(++O,this.listenerCount(`field`)===0){te=!0;return}re=[],ie=0}}),j=0,de=(e,t,n,r,i)=>{retrydata:for(;t;){if(this._hparser!==null){let e=this._hparser.push(t,n,r);if(e===-1){this._hparser=null,A.reset(),this.emit(`error`,Error(`Malformed part header`));break}n=e}if(n===r)break;if(j!==0){if(j===1){switch(t[n]){case 45:j=2,++n;break;case 13:j=3,++n;break;default:j=0}if(n===r)return}if(j===2){if(j=0,t[n]===45){this._complete=!0,this._bparser=v;return}let e=this._writecb;this._writecb=m,de(!1,p,0,1,!1),this._writecb=e}else if(j===3){if(j=0,t[n]===10){if(++n,D>=E||(this._hparser=A,n===r))break;continue retrydata}{let e=this._writecb;this._writecb=m,de(!1,f,0,1,!1),this._writecb=e}}}if(!te){if(this._fileStream){let e,a=Math.min(r-n,C-ne);i?e=t.slice(n,n+a):(e=Buffer.allocUnsafe(a),t.copy(e,0,n,n+a)),ne+=e.length,ne===C?(e.length>0&&this._fileStream.push(e),this._fileStream.emit(`limit`),this._fileStream.truncated=!0,te=!0):this._fileStream.push(e)||(this._writecb&&(this._fileStream._readcb=this._writecb),this._writecb=null)}else if(re!==void 0){let e,a=Math.min(r-n,S-ie);i?e=t.slice(n,n+a):(e=Buffer.allocUnsafe(a),t.copy(e,0,n,n+a)),ie+=a,re.push(e),ie===S&&(te=!0,ce=!0)}}break}if(e){if(j=1,this._fileStream)this._fileStream.push(null),this._fileStream=null;else if(re!==void 0){let e;switch(re.length){case 0:e=``;break;case 1:e=s(re[0],ae,0);break;default:e=s(Buffer.concat(re,ie),ae,0)}re=void 0,ie=0,this.emit(`field`,k,e,{nameTruncated:!1,valueTruncated:ce,encoding:oe,mimeType:se})}++D===E&&this.emit(`partsLimit`)}};this._bparser=new a(`\r\n--${n}`,de),this._writecb=null,this._finalcb=null,this.write(d)}static detect(e){return e.type===`multipart`&&e.subtype===`form-data`}_write(e,t,n){this._writecb=n,this._bparser.push(e,0),this._writecb&&y(this)}_destroy(e,t){this._hparser=null,this._bparser=v,e||=C(this);let n=this._fileStream;n&&(this._fileStream=null,n.destroy(e)),t(e)}_final(e){if(this._bparser.destroy(),!this._complete)return e(Error(`Unexpected end of form`));this._fileEndsLeft?this._finalcb=S.bind(null,this,e):S(this,e)}};function S(e,t,n){if(n)return t(n);n=C(e),t(n)}function C(e){if(e._hparser)return Error(`Malformed part header`);let t=e._fileStream;if(t&&(e._fileStream=null,t.destroy(Error(`Unexpected end of file`))),!e._complete)return Error(`Unexpected end of form`)}let w=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],T=[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];n.exports=x})),CTe=i(((e,n)=>{let{Writable:r}=t(`stream`),{getDecoder:i}=X4();var a=class extends r{constructor(e){let t={autoDestroy:!0,emitClose:!0,highWaterMark:typeof e.highWaterMark==`number`?e.highWaterMark:void 0};super(t);let n=e.defCharset||`utf8`;e.conType.params&&typeof e.conType.params.charset==`string`&&(n=e.conType.params.charset),this.charset=n;let r=e.limits;this.fieldSizeLimit=r&&typeof r.fieldSize==`number`?r.fieldSize:1048576,this.fieldsLimit=r&&typeof r.fields==`number`?r.fields:1/0,this.fieldNameSizeLimit=r&&typeof r.fieldNameSize==`number`?r.fieldNameSize:100,this._inKey=!0,this._keyTrunc=!1,this._valTrunc=!1,this._bytesKey=0,this._bytesVal=0,this._fields=0,this._key=``,this._val=``,this._byte=-2,this._lastPos=0,this._encode=0,this._decoder=i(n)}static detect(e){return e.type===`application`&&e.subtype===`x-www-form-urlencoded`}_write(e,t,n){if(this._fields>=this.fieldsLimit)return n();let r=0,i=e.length;if(this._lastPos=0,this._byte!==-2){if(r=o(this,e,r,i),r===-1)return n(Error(`Malformed urlencoded form`));if(r>=i)return n();this._inKey?++this._bytesKey:++this._bytesVal}main:for(;r<i;)if(this._inKey){for(r=s(this,e,r,i);r<i;){switch(e[r]){case 61:this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r)),this._lastPos=++r,this._key=this._decoder(this._key,this._encode),this._encode=0,this._inKey=!1;continue main;case 38:if(this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r)),this._lastPos=++r,this._key=this._decoder(this._key,this._encode),this._encode=0,this._bytesKey>0&&this.emit(`field`,this._key,``,{nameTruncated:this._keyTrunc,valueTruncated:!1,encoding:this.charset,mimeType:`text/plain`}),this._key=``,this._val=``,this._keyTrunc=!1,this._valTrunc=!1,this._bytesKey=0,this._bytesVal=0,++this._fields>=this.fieldsLimit)return this.emit(`fieldsLimit`),n();continue;case 43:this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r)),this._key+=` `,this._lastPos=r+1;break;case 37:if(this._encode===0&&(this._encode=1),this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r)),this._lastPos=r+1,this._byte=-1,r=o(this,e,r+1,i),r===-1)return n(Error(`Malformed urlencoded form`));if(r>=i)return n();++this._bytesKey,r=s(this,e,r,i);continue}++r,++this._bytesKey,r=s(this,e,r,i)}this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r))}else{for(r=c(this,e,r,i);r<i;){switch(e[r]){case 38:if(this._lastPos<r&&(this._val+=e.latin1Slice(this._lastPos,r)),this._lastPos=++r,this._inKey=!0,this._val=this._decoder(this._val,this._encode),this._encode=0,(this._bytesKey>0||this._bytesVal>0)&&this.emit(`field`,this._key,this._val,{nameTruncated:this._keyTrunc,valueTruncated:this._valTrunc,encoding:this.charset,mimeType:`text/plain`}),this._key=``,this._val=``,this._keyTrunc=!1,this._valTrunc=!1,this._bytesKey=0,this._bytesVal=0,++this._fields>=this.fieldsLimit)return this.emit(`fieldsLimit`),n();continue main;case 43:this._lastPos<r&&(this._val+=e.latin1Slice(this._lastPos,r)),this._val+=` `,this._lastPos=r+1;break;case 37:if(this._encode===0&&(this._encode=1),this._lastPos<r&&(this._val+=e.latin1Slice(this._lastPos,r)),this._lastPos=r+1,this._byte=-1,r=o(this,e,r+1,i),r===-1)return n(Error(`Malformed urlencoded form`));if(r>=i)return n();++this._bytesVal,r=c(this,e,r,i);continue}++r,++this._bytesVal,r=c(this,e,r,i)}this._lastPos<r&&(this._val+=e.latin1Slice(this._lastPos,r))}n()}_final(e){if(this._byte!==-2)return e(Error(`Malformed urlencoded form`));(!this._inKey||this._bytesKey>0||this._bytesVal>0)&&(this._inKey?this._key=this._decoder(this._key,this._encode):this._val=this._decoder(this._val,this._encode),this.emit(`field`,this._key,this._val,{nameTruncated:this._keyTrunc,valueTruncated:this._valTrunc,encoding:this.charset,mimeType:`text/plain`})),e()}};function o(e,t,n,r){if(n>=r)return r;if(e._byte===-1){let i=l[t[n++]];if(i===-1)return-1;if(i>=8&&(e._encode=2),n<r){let r=l[t[n++]];if(r===-1)return-1;e._inKey?e._key+=String.fromCharCode((i<<4)+r):e._val+=String.fromCharCode((i<<4)+r),e._byte=-2,e._lastPos=n}else e._byte=i}else{let r=l[t[n++]];if(r===-1)return-1;e._inKey?e._key+=String.fromCharCode((e._byte<<4)+r):e._val+=String.fromCharCode((e._byte<<4)+r),e._byte=-2,e._lastPos=n}return n}function s(e,t,n,r){if(e._bytesKey>e.fieldNameSizeLimit){for(e._keyTrunc||e._lastPos<n&&(e._key+=t.latin1Slice(e._lastPos,n-1)),e._keyTrunc=!0;n<r;++n){let r=t[n];if(r===61||r===38)break;++e._bytesKey}e._lastPos=n}return n}function c(e,t,n,r){if(e._bytesVal>e.fieldSizeLimit){for(e._valTrunc||e._lastPos<n&&(e._val+=t.latin1Slice(e._lastPos,n-1)),e._valTrunc=!0;n<r&&t[n]!==38;++n)++e._bytesVal;e._lastPos=n}return n}let l=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1];n.exports=a})),wTe=i(((e,t)=>{let{parseContentType:n}=X4();function r(e){let t=e.headers,r=n(t[`content-type`]);if(!r)throw Error(`Malformed content type`);for(let n of i){if(!n.detect(r))continue;let i={limits:e.limits,headers:t,conType:r,highWaterMark:void 0,fileHwm:void 0,defCharset:void 0,defParamCharset:void 0,preservePath:!1};return e.highWaterMark&&(i.highWaterMark=e.highWaterMark),e.fileHwm&&(i.fileHwm=e.fileHwm),i.defCharset=e.defCharset,i.defParamCharset=e.defParamCharset,i.preservePath=e.preservePath,new n(i)}throw Error(`Unsupported content type: ${t[`content-type`]}`)}let i=[STe(),CTe()].filter(function(e){return typeof e.detect==`function`});t.exports=e=>{if((typeof e!=`object`||!e)&&(e={}),typeof e.headers!=`object`||e.headers===null||typeof e.headers[`content-type`]!=`string`)throw Error(`Missing Content-Type`);return r(e)}}));bTe(),wTe();function Z4(e,t=!1){let n=e.length,r=0,i=``,a=0,o=16,s=0,c=0,l=0,u=0,d=0;function f(t,n){let i=0,a=0;for(;i<t||!n;){let t=e.charCodeAt(r);if(t>=48&&t<=57)a=a*16+t-48;else if(t>=65&&t<=70)a=a*16+t-65+10;else if(t>=97&&t<=102)a=a*16+t-97+10;else break;r++,i++}return i<t&&(a=-1),a}function p(e){r=e,i=``,a=0,o=16,d=0}function m(){let t=r;if(e.charCodeAt(r)===48)r++;else for(r++;r<e.length&&e3(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46){if(r++,r<e.length&&e3(e.charCodeAt(r)))for(r++;r<e.length&&e3(e.charCodeAt(r));)r++;else return d=3,e.substring(t,r)}let n=r;if(r<e.length&&(e.charCodeAt(r)===69||e.charCodeAt(r)===101)){if(r++,(r<e.length&&e.charCodeAt(r)===43||e.charCodeAt(r)===45)&&r++,r<e.length&&e3(e.charCodeAt(r))){for(r++;r<e.length&&e3(e.charCodeAt(r));)r++;n=r}else d=3}return e.substring(t,n)}function h(){let t=``,i=r;for(;;){if(r>=n){t+=e.substring(i,r),d=2;break}let a=e.charCodeAt(r);if(a===34){t+=e.substring(i,r),r++;break}if(a===92){if(t+=e.substring(i,r),r++,r>=n){d=2;break}switch(e.charCodeAt(r++)){case 34:t+=`"`;break;case 92:t+=`\\`;break;case 47:t+=`/`;break;case 98:t+=`\b`;break;case 102:t+=`\f`;break;case 110:t+=`
|
|
721
|
+
`);a=e[0],i=e[1]}yield{file:r,key:a,value:i}}}var v0,$Se=U$({"src/lib/responses/ConfigList.ts"(){H1(),v0=class{constructor(){this.files=[],this.values=Object.create(null)}get all(){return this._all||=this.files.reduce((e,t)=>Object.assign(e,this.values[t]),{}),this._all}addFile(e){if(!(e in this.values)){let t=n1(this.files);this.values[e]=t?Object.create(this.values[t]):{},this.files.push(e)}return this.values[e]}addValue(e,t,n){let r=this.addFile(e);Object.hasOwn(r,t)?Array.isArray(r[t])?r[t].push(n):r[t]=[r[t],n]:r[t]=n,this._all=void 0}}}});function y0(e,t){return typeof e==`string`&&Object.hasOwn(b0,e)?e:t}function eCe(e,t,n,r){let i=[`config`,`--${r}`];return n&&i.push(`--add`),i.push(e,t),{commands:i,format:`utf-8`,parser(e){return e}}}function tCe(e,t){let n=[`config`,`--null`,`--show-origin`,`--get-all`,e];return t&&n.splice(1,0,`--${t}`),{commands:n,format:`utf-8`,parser(t){return ZSe(t,e)}}}function nCe(e){let t=[`config`,`--list`,`--show-origin`,`--null`];return e&&t.push(`--${e}`),{commands:t,format:`utf-8`,parser(e){return XSe(e)}}}function rCe(){return{addConfig(e,t,...n){return this._runTask(eCe(e,t,n[0]===!0,y0(n[1],`local`)),R1(arguments))},getConfig(e,t){return this._runTask(tCe(e,y0(t,void 0)),R1(arguments))},listConfig(...e){return this._runTask(nCe(y0(e[0],void 0)),R1(arguments))}}}var b0,x0=U$({"src/lib/tasks/config.ts"(){$Se(),H1(),b0=(e=>(e.system=`system`,e.global=`global`,e.local=`local`,e.worktree=`worktree`,e))(b0||{})}});function iCe(e){return C0.has(e)}var S0,C0,w0=U$({"src/lib/tasks/diff-name-status.ts"(){S0=(e=>(e.ADDED=`A`,e.COPIED=`C`,e.DELETED=`D`,e.MODIFIED=`M`,e.RENAMED=`R`,e.CHANGED=`T`,e.UNMERGED=`U`,e.UNKNOWN=`X`,e.BROKEN=`B`,e))(S0||{}),C0=new Set(Object.values(S0))}});function aCe(...e){return new O0().param(...e)}function oCe(e){let t=new Set,n={};return a1(e,e=>{let[r,i,a]=e.split(g1);t.add(r),(n[r]=n[r]||[]).push({line:f1(i),path:r,preview:a})}),{paths:t,results:n}}function sCe(){return{grep(e){let t=R1(arguments),n=I1(arguments);for(let e of T0)if(n.includes(e))return this._runTask(n0(`git.grep: use of "${e}" is not supported.`),t);typeof e==`string`&&(e=aCe().param(e));let r=[`grep`,`--null`,`-n`,`--full-name`,...n,...e];return this._runTask({commands:r,format:`utf-8`,parser(e){return oCe(e)}},t)}}}var T0,E0,D0,O0,k0=U$({"src/lib/tasks/grep.ts"(){H1(),c0(),T0=[`-h`],E0=Symbol(`grepQuery`),O0=class{constructor(){this[D0]=[]}*[(D0=E0,Symbol.iterator)](){for(let e of this[E0])yield e}and(...e){return e.length&&this[E0].push(`--and`,`(`,...p1(e,`-e`),`)`),this}param(...e){return this[E0].push(...p1(e,`-e`)),this}}}}),A0={};W$(A0,{ResetMode:()=>M0,getResetMode:()=>lCe,resetTask:()=>cCe});function cCe(e,t){let n=[`reset`];return j0(e)&&n.push(`--${e}`),n.push(...t),r0(n)}function lCe(e){if(j0(e))return e;switch(typeof e){case`string`:case`undefined`:return`soft`}}function j0(e){return typeof e==`string`&&N0.includes(e)}var M0,N0,P0=U$({"src/lib/tasks/reset.ts"(){H1(),c0(),M0=(e=>(e.MIXED=`mixed`,e.SOFT=`soft`,e.HARD=`hard`,e.MERGE=`merge`,e.KEEP=`keep`,e))(M0||{}),N0=d1(Object.values(M0))}});function uCe(){return(0,I$.default)(`simple-git`)}function F0(e,t,n){return!t||!String(t).replace(/\s*/,``)?n?(t,...r)=>{e(t,...r),n(t,...r)}:e:(r,...i)=>{e(`%s ${r}`,t,...i),n&&n(r,...i)}}function dCe(e,t,{namespace:n}){if(typeof e==`string`)return e;let r=t&&t.namespace||``;return r.startsWith(n)?r.substr(n.length+1):r||n}function I0(e,t,n,r=uCe()){let i=e&&`[${e}]`||``,a=[],o=typeof t==`string`?r.extend(t):t,s=dCe(b1(t,E1),o,r);return l(n);function c(t,n){return s1(a,I0(e,s.replace(/^[^:]+/,t),n,r))}function l(t){let n=t&&`[${t}]`||``,a=o&&F0(o,n)||_1,s=F0(r,`${i} ${n}`,a);return Object.assign(o?a:s,{label:e,sibling:c,info:s,step:l})}}var L0=U$({"src/lib/git-logger.ts"(){H1(),I$.default.formatters.L=e=>String(O1(e)?e.length:`-`),I$.default.formatters.B=e=>Buffer.isBuffer(e)?e.toString(`utf8`):v1(e)}}),R0,fCe=U$({"src/lib/runners/tasks-pending-queue.ts"(){q$(),L0(),R0=class e{constructor(e=`GitExecutor`){this.logLabel=e,this._queue=new Map}withProgress(e){return this._queue.get(e)}createProgress(t){let n=e.getName(t.commands[0]);return{task:t,logger:I0(this.logLabel,n),name:n}}push(e){let t=this.createProgress(e);return t.logger(`Adding task to the queue, commands = %o`,e.commands),this._queue.set(e,t),t}fatal(e){for(let[t,{logger:n}]of Array.from(this._queue.entries()))t===e.task?(n.info(`Failed %o`,e),n(`Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`)):n.info(`A fatal exception occurred in a previous task, the queue has been purged: %o`,e.message),this.complete(t);if(this._queue.size!==0)throw Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(e){this.withProgress(e)&&this._queue.delete(e)}attempt(e){let t=this.withProgress(e);if(!t)throw new K$(void 0,`TasksPendingQueue: attempt called for an unknown task`);return t.logger(`Starting task`),t}static getName(t=`empty`){return`task:${t}:${++e.counter}`}static{this.counter=0}}}});function z0(e,t){return{method:t1(e.commands)||``,commands:t}}function pCe(e,t){return n=>{t(`[ERROR] child process exception %o`,n),e.push(Buffer.from(String(n.stack),`ascii`))}}function B0(e,t,n,r){return i=>{n(`%s received %L bytes`,t,i),r(`%B`,i),e.push(i)}}var V0,mCe=U$({"src/lib/runners/git-executor-chain.ts"(){q$(),c0(),H1(),fCe(),V0=class{constructor(e,t,n){this._executor=e,this._scheduler=t,this._plugins=n,this._chain=Promise.resolve(),this._queue=new R0}get cwd(){return this._cwd||this._executor.cwd}set cwd(e){this._cwd=e}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(e){return this._queue.push(e),this._chain=this._chain.then(()=>this.attemptTask(e))}async attemptTask(e){let t=await this._scheduler.next(),n=()=>this._queue.complete(e);try{let{logger:t}=this._queue.attempt(e);return await(o0(e)?this.attemptEmptyTask(e,t):this.attemptRemoteTask(e,t))}catch(t){throw this.onFatalException(e,t)}finally{n(),t()}}onFatalException(e,t){let n=t instanceof K$?Object.assign(t,{task:e}):new K$(e,t&&String(t));return this._chain=Promise.resolve(),this._queue.fatal(n),n}async attemptRemoteTask(e,t){let n=this._plugins.exec(`spawn.binary`,``,z0(e,e.commands)),r=this._plugins.exec(`spawn.args`,[...e.commands],{...z0(e,e.commands),env:{...this.env}}),i=await this.gitResponse(e,n,r,this.outputHandler,t.step(`SPAWN`)),a=await this.handleTaskData(e,r,i,t.step(`HANDLE`));return t(`passing response to task's parser as a %s`,e.format),a0(e)?z1(e.parser,a):z1(e.parser,a.asStrings())}async attemptEmptyTask(e,t){return t(`empty task bypassing child process to call to task's parser`),e.parser(this)}handleTaskData(e,t,n,r){let{exitCode:i,rejection:a,stdOut:o,stdErr:s}=n;return new Promise((c,l)=>{r(`Preparing to handle process response exitCode=%d stdOut=`,i);let{error:u}=this._plugins.exec(`task.error`,{error:a},{...z0(e,t),...n});if(u&&e.onError)return r.info(`exitCode=%s handling with custom error handler`),e.onError(n,u,e=>{r.info(`custom error handler treated as success`),r(`custom error returned a %s`,v1(e)),c(new j1(Array.isArray(e)?Buffer.concat(e):e,Buffer.concat(s)))},l);if(u)return r.info(`handling as error: exitCode=%s stdErr=%s rejection=%o`,i,s.length,a),l(u);r.info(`retrieving task output complete`),c(new j1(Buffer.concat(o),Buffer.concat(s)))})}async gitResponse(e,t,n,r,i){let a=i.sibling(`output`),o=this._plugins.exec(`spawn.options`,{cwd:this.cwd,env:this.env,windowsHide:!0},z0(e,e.commands));return new Promise(s=>{let c=[],l=[];i.info(`%s %o`,t,n),i(`%O`,o);let u=this._beforeSpawn(e,n);if(u)return s({stdOut:c,stdErr:l,exitCode:9901,rejection:u});this._plugins.exec(`spawn.before`,void 0,{...z0(e,n),kill(e){u=e||u}});let d=Re(t,n,o);d.stdout.on(`data`,B0(c,`stdOut`,i,a.step(`stdOut`))),d.stderr.on(`data`,B0(l,`stdErr`,i,a.step(`stdErr`))),d.on(`error`,pCe(l,i)),r&&(i(`Passing child process stdOut/stdErr to custom outputHandler`),r(t,d.stdout,d.stderr,[...n])),this._plugins.exec(`spawn.after`,void 0,{...z0(e,n),spawned:d,close(e,t){s({stdOut:c,stdErr:l,exitCode:e,rejection:u||t})},kill(e){d.killed||(u=e,d.kill(`SIGINT`))}})})}_beforeSpawn(e,t){let n;return this._plugins.exec(`spawn.before`,void 0,{...z0(e,t),kill(e){n=e||n}}),n}}}}),H0={};W$(H0,{GitExecutor:()=>U0});var U0,hCe=U$({"src/lib/runners/git-executor.ts"(){mCe(),U0=class{constructor(e,t,n){this.cwd=e,this._scheduler=t,this._plugins=n,this._chain=new V0(this,this._scheduler,this._plugins)}chain(){return new V0(this,this._scheduler,this._plugins)}push(e){return this._chain.push(e)}}}});function gCe(e,t,n=_1){t.then(e=>{n(null,e)},t=>{t?.task===e&&n(t instanceof J$?_Ce(t):t,void 0)})}function _Ce(e){let t=e=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${e} should be GitResponseError.git.${e}, this will no longer be available in version 3`),t=_1};return Object.create(e,Object.getOwnPropertyNames(e.git).reduce(n,{}));function n(n,r){return r in e||(n[r]={enumerable:!1,configurable:!1,get(){return t(r),e.git[r]}}),n}}var vCe=U$({"src/lib/task-callback.ts"(){Y$(),H1()}});function W0(e,t){return t0(n=>{if(!o1(e))throw Error(`Git.cwd: cannot change to non-directory "${e}"`);return(t||n).cwd=e})}var yCe=U$({"src/lib/tasks/change-working-directory.ts"(){H1(),c0()}});function G0(e){let t=[`checkout`,...e];return t[1]===`-b`&&t.includes(`-B`)&&(t[1]=c1(t,`-B`)),r0(t)}function bCe(){return{checkout(){return this._runTask(G0(I1(arguments,1)),R1(arguments))},checkoutBranch(e,t){return this._runTask(G0([`-b`,e,t,...I1(arguments)]),R1(arguments))},checkoutLocalBranch(e){return this._runTask(G0([`-b`,e,...I1(arguments)]),R1(arguments))}}}var xCe=U$({"src/lib/tasks/checkout.ts"(){H1(),c0()}});function SCe(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}function CCe(){return{countObjects(){return this._runTask({commands:[`count-objects`,`--verbose`],format:`utf-8`,parser(e){return B1(SCe(),[K0],e)}})}}}var K0,wCe=U$({"src/lib/tasks/count-objects.ts"(){H1(),K0=new M1(/([a-z-]+): (\d+)$/,(e,[t,n])=>{let r=u1(t);Object.hasOwn(e,r)&&(e[r]=f1(n))})}});function TCe(e){return B1({author:null,branch:``,commit:``,root:!1,summary:{changes:0,insertions:0,deletions:0}},q0,e)}var q0,ECe=U$({"src/lib/parsers/parse-commit.ts"(){H1(),q0=[new M1(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(e,[t,n,r])=>{e.branch=t,e.commit=r,e.root=!!n}),new M1(/\s*Author:\s(.+)/i,(e,[t])=>{let n=t.split(`<`),r=n.pop();!r||!r.includes(`@`)||(e.author={email:r.substr(0,r.length-1),name:n.join(`<`).trim()})}),new M1(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,(e,[t,n,r])=>{e.summary.changes=parseInt(t,10)||0,e.summary.insertions=parseInt(n,10)||0,e.summary.deletions=parseInt(r,10)||0}),new M1(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,(e,[t,n,r])=>{e.summary.changes=parseInt(t,10)||0;let i=parseInt(n,10)||0;r===`-`?e.summary.deletions=i:r===`+`&&(e.summary.insertions=i)})]}});function DCe(e,t,n){return{commands:[`-c`,`core.abbrev=40`,`commit`,...p1(e,`-m`),...t,...n],format:`utf-8`,parser:TCe}}function OCe(){return{commit(t,...n){let r=R1(arguments),i=e(t)||DCe(l1(t),l1(b1(n[0],D1,[])),[...d1(b1(n[1],w1,[])),...I1(arguments,0,!0)]);return this._runTask(i,r)}};function e(e){return!D1(e)&&n0(`git.commit: requires the commit message to be supplied as a string/string[]`)}}var kCe=U$({"src/lib/tasks/commit.ts"(){ECe(),H1(),c0()}});function ACe(){return{firstCommit(){return this._runTask(r0([`rev-list`,`--max-parents=0`,`HEAD`],!0),R1(arguments))}}}var jCe=U$({"src/lib/tasks/first-commit.ts"(){H1(),c0()}});function MCe(e,t){let n=[`hash-object`,e];return t&&n.push(`-w`),r0(n,!0)}var NCe=U$({"src/lib/tasks/hash-object.ts"(){c0()}});function PCe(e,t,n){let r=String(n).trim(),i;if(i=Y0.exec(r))return new J0(e,t,!1,i[1]);if(i=X0.exec(r))return new J0(e,t,!0,i[1]);let a=``,o=r.split(` `);for(;o.length;)if(o.shift()===`in`){a=o.join(` `);break}return new J0(e,t,/^re/i.test(r),a)}var J0,Y0,X0,FCe=U$({"src/lib/responses/InitSummary.ts"(){J0=class{constructor(e,t,n,r){this.bare=e,this.path=t,this.existing=n,this.gitDir=r}},Y0=/^Init.+ repository in (.+)$/,X0=/^Rein.+ in (.+)$/}});function ICe(e){return e.includes(Z0)}function LCe(e=!1,t,n){let r=[`init`,...n];return e&&!ICe(r)&&r.splice(1,0,Z0),{commands:r,format:`utf-8`,parser(e){return PCe(r.includes(`--bare`),t,e)}}}var Z0,RCe=U$({"src/lib/tasks/init.ts"(){FCe(),Z0=`--bare`}});function Q0(e){for(let t=0;t<e.length;t++){let n=$0.exec(e[t]);if(n)return`--${n[1]}`}return``}function zCe(e){return $0.test(e)}var $0,e2=U$({"src/lib/args/log-format.ts"(){$0=/^--(stat|numstat|name-only|name-status)(=|$)/}}),t2,BCe=U$({"src/lib/responses/DiffSummary.ts"(){t2=class{constructor(){this.changed=0,this.deletions=0,this.insertions=0,this.files=[]}}}});function n2(e=``){let t=s2[e];return e=>B1(new t2,t,e,!1)}var r2,i2,a2,o2,s2,c2=U$({"src/lib/parsers/parse-diff-summary.ts"(){e2(),BCe(),w0(),H1(),r2=[new M1(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(e,[t,n,r=``])=>{e.files.push({file:t.trim(),changes:f1(n),insertions:r.replace(/[^+]/g,``).length,deletions:r.replace(/[^-]/g,``).length,binary:!1})}),new M1(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(e,[t,n,r])=>{e.files.push({file:t.trim(),before:f1(n),after:f1(r),binary:!0})}),new M1(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(e,[t,n])=>{let r=/(\d+) i/.exec(n),i=/(\d+) d/.exec(n);e.changed=f1(t),e.insertions=f1(r?.[1]),e.deletions=f1(i?.[1])})],i2=[new M1(/(\d+)\t(\d+)\t(.+)$/,(e,[t,n,r])=>{let i=f1(t),a=f1(n);e.changed++,e.insertions+=i,e.deletions+=a,e.files.push({file:r,changes:i+a,insertions:i,deletions:a,binary:!1})}),new M1(/-\t-\t(.+)$/,(e,[t])=>{e.changed++,e.files.push({file:t,after:0,before:0,binary:!0})})],a2=[new M1(/(.+)$/,(e,[t])=>{e.changed++,e.files.push({file:t,changes:0,insertions:0,deletions:0,binary:!1})})],o2=[new M1(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,(e,[t,n,r,i,a])=>{e.changed++,e.files.push({file:a??r,changes:0,insertions:0,deletions:0,binary:!1,status:h1(iCe(t)&&t),from:h1(!!a&&r!==a&&r),similarity:f1(n)})})],s2={"":r2,"--stat":r2,"--numstat":i2,"--name-status":o2,"--name-only":a2}}});function VCe(e,t){return t.reduce((t,n,r)=>(t[n]=e[r]||``,t),Object.create({diff:null}))}function l2(e=f2,t=p2,n=``){let r=n2(n);return function(n){let i=i1(n.trim(),!1,u2).map(function(n){let i=n.split(d2),a=VCe(i[0].split(e),t);return i.length>1&&i[1].trim()&&(a.diff=r(i[1])),a});return{all:i,latest:i.length&&i[0]||null,total:i.length}}}var u2,d2,f2,p2,m2=U$({"src/lib/parsers/parse-list-log-summary.ts"(){H1(),c2(),e2(),u2=`òòòòòò `,d2=` òò`,f2=` ò `,p2=[`hash`,`date`,`message`,`refs`,`author_name`,`author_email`]}}),h2={};W$(h2,{diffSummaryTask:()=>HCe,validateLogFormatConfig:()=>g2});function HCe(e){let t=Q0(e),n=[`diff`];return t===``&&(t=`--stat`,n.push(`--stat=4096`)),n.push(...e),g2(n)||{commands:n,format:`utf-8`,parser:n2(t)}}function g2(e){let t=e.filter(zCe);if(t.length>1)return n0(`Summary flags are mutually exclusive - pick one of ${t.join(`,`)}`);if(t.length&&e.includes(`-z`))return n0(`Summary flag ${t} parsing is not compatible with null termination option '-z'`)}var _2=U$({"src/lib/tasks/diff.ts"(){e2(),c2(),c0()}});function UCe(e,t){let n=[],r=[];return Object.keys(e).forEach(t=>{n.push(t),r.push(String(e[t]))}),[n,r.join(t)]}function WCe(e){return Object.keys(e).reduce((t,n)=>(n in y2||(t[n]=e[n]),t),{})}function v2(e={},t=[]){let n=b1(e.splitter,E1,f2),[r,i]=UCe(S1(e.format)?e.format:{hash:`%H`,date:e.strictDate===!1?`%ai`:`%aI`,message:`%s`,refs:`%D`,body:e.multiLine?`%B`:`%b`,author_name:e.mailMap===!1?`%an`:`%aN`,author_email:e.mailMap===!1?`%ae`:`%aE`},n),a=[],o=[`--pretty=format:${u2}${i}${d2}`,...t],s=e.n||e[`max-count`]||e.maxCount;if(s&&o.push(`--max-count=${s}`),e.from||e.to){let t=e.symmetric===!1?`..`:`...`;a.push(`${e.from||``}${t}${e.to||``}`)}return E1(e.file)&&o.push(`--follow`,P$(e.file)),F1(WCe(e),o),{fields:r,splitter:n,commands:[...o,...a]}}function GCe(e,t,n){let r=l2(e,t,Q0(n));return{commands:[`log`,...n],format:`utf-8`,parser:r}}function KCe(){return{log(...n){let r=R1(arguments),i=v2(L1(arguments),d1(b1(arguments[0],w1,[]))),a=t(...n)||g2(i.commands)||e(i);return this._runTask(a,r)}};function e(e){return GCe(e.splitter,e.fields,e.commands)}function t(e,t){return E1(e)&&E1(t)&&n0(`git.log(string, string) should be replaced with git.log({ from: string, to: string })`)}}var y2,b2=U$({"src/lib/tasks/log.ts"(){e2(),m2(),H1(),c0(),_2(),y2=(e=>(e[e[`--pretty`]=0]=`--pretty`,e[e[`max-count`]=1]=`max-count`,e[e.maxCount=2]=`maxCount`,e[e.n=3]=`n`,e[e.file=4]=`file`,e[e.format=5]=`format`,e[e.from=6]=`from`,e[e.to=7]=`to`,e[e.splitter=8]=`splitter`,e[e.symmetric=9]=`symmetric`,e[e.mailMap=10]=`mailMap`,e[e.multiLine=11]=`multiLine`,e[e.strictDate=12]=`strictDate`,e))(y2||{})}}),x2,S2,qCe=U$({"src/lib/responses/MergeSummary.ts"(){x2=class{constructor(e,t=null,n){this.reason=e,this.file=t,this.meta=n}toString(){return`${this.file}:${this.reason}`}},S2=class{constructor(){this.conflicts=[],this.merges=[],this.result=`success`}get failed(){return this.conflicts.length>0}get reason(){return this.result}toString(){return this.conflicts.length?`CONFLICTS: ${this.conflicts.join(`, `)}`:`OK`}}}}),C2,w2,JCe=U$({"src/lib/responses/PullSummary.ts"(){C2=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},w2=class{constructor(){this.remote=``,this.hash={local:``,remote:``},this.branch={local:``,remote:``},this.message=``}toString(){return this.message}}}});function T2(e){return e.objects=e.objects||{compressing:0,counting:0,enumerating:0,packReused:0,reused:{count:0,delta:0},total:{count:0,delta:0}}}function E2(e){let t=/^\s*(\d+)/.exec(e),n=/delta (\d+)/i.exec(e);return{count:f1(t&&t[1]||`0`),delta:f1(n&&n[1]||`0`)}}var D2,YCe=U$({"src/lib/parsers/parse-remote-objects.ts"(){H1(),D2=[new N1(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(e,[t,n])=>{let r=t.toLowerCase(),i=T2(e.remoteMessages);Object.assign(i,{[r]:f1(n)})}),new N1(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(e,[t,n])=>{let r=t.toLowerCase(),i=T2(e.remoteMessages);Object.assign(i,{[r]:f1(n)})}),new N1(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(e,[t,n,r])=>{let i=T2(e.remoteMessages);i.total=E2(t),i.reused=E2(n),i.packReused=f1(r)})]}});function O2(e,t){return B1({remoteMessages:new A2},k2,t)}var k2,A2,j2=U$({"src/lib/parsers/parse-remote-messages.ts"(){H1(),YCe(),k2=[new N1(/^remote:\s*(.+)$/,(e,[t])=>(e.remoteMessages.all.push(t.trim()),!1)),...D2,new N1([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(e,[t])=>{e.remoteMessages.pullRequestUrl=t}),new N1([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(e,[t,n,r])=>{e.remoteMessages.vulnerabilities={count:f1(t),summary:n,url:r}})],A2=class{constructor(){this.all=[]}}}});function XCe(e,t){let n=B1(new w2,I2,[e,t]);return n.message&&n}var M2,N2,P2,F2,I2,L2,R2,z2=U$({"src/lib/parsers/parse-pull.ts"(){JCe(),H1(),j2(),M2=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,N2=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,P2=/^(create|delete) mode \d+ (.+)/,F2=[new M1(M2,(e,[t,n,r])=>{e.files.push(t),n&&(e.insertions[t]=n.length),r&&(e.deletions[t]=r.length)}),new M1(N2,(e,[t,,n,,r])=>n!==void 0||r!==void 0?(e.summary.changes=+t||0,e.summary.insertions=+n||0,e.summary.deletions=+r||0,!0):!1),new M1(P2,(e,[t,n])=>{s1(e.files,n),s1(t===`create`?e.created:e.deleted,n)})],I2=[new M1(/^from\s(.+)$/i,(e,[t])=>void(e.remote=t)),new M1(/^fatal:\s(.+)$/,(e,[t])=>void(e.message=t)),new M1(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,(e,[t,n,r,i])=>{e.branch.local=r,e.hash.local=t,e.branch.remote=i,e.hash.remote=n})],L2=(e,t)=>B1(new C2,F2,[e,t]),R2=(e,t)=>Object.assign(new C2,L2(e,t),O2(e,t))}}),B2,V2,H2,ZCe=U$({"src/lib/parsers/parse-merge.ts"(){qCe(),H1(),z2(),B2=[new M1(/^Auto-merging\s+(.+)$/,(e,[t])=>{e.merges.push(t)}),new M1(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(e,[t,n])=>{e.conflicts.push(new x2(t,n))}),new M1(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(e,[t,n,r])=>{e.conflicts.push(new x2(t,n,{deleteRef:r}))}),new M1(/^CONFLICT\s+\((.+)\):/,(e,[t])=>{e.conflicts.push(new x2(t,null))}),new M1(/^Automatic merge failed;\s+(.+)$/,(e,[t])=>{e.result=t})],V2=(e,t)=>Object.assign(H2(e,t),R2(e,t)),H2=e=>B1(new S2,B2,e)}});function U2(e){return e.length?{commands:[`merge`,...e],format:`utf-8`,parser(e,t){let n=V2(e,t);if(n.failed)throw new J$(n);return n}}:n0(`Git.merge requires at least one option`)}var QCe=U$({"src/lib/tasks/merge.ts"(){Y$(),ZCe(),c0()}});function $Ce(e,t,n){let r=n.includes(`deleted`),i=n.includes(`tag`)||/^refs\/tags/.test(e),a=!n.includes(`new`);return{deleted:r,tag:i,branch:!i,new:!a,alreadyUpdated:a,local:e,remote:t}}var W2,G2,K2,ewe=U$({"src/lib/parsers/parse-push.ts"(){H1(),j2(),W2=[new M1(/^Pushing to (.+)$/,(e,[t])=>{e.repo=t}),new M1(/^updating local tracking ref '(.+)'/,(e,[t])=>{e.ref={...e.ref||{},local:t}}),new M1(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(e,[t,n,r])=>{e.pushed.push($Ce(t,n,r))}),new M1(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(e,[t,n,r])=>{e.branch={...e.branch||{},local:t,remote:n,remoteName:r}}),new M1(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,(e,[t,n,r,i])=>{e.update={head:{local:t,remote:n},hash:{from:r,to:i}}})],G2=(e,t)=>{let n=K2(e,t),r=O2(e,t);return{...n,...r}},K2=(e,t)=>B1({pushed:[]},W2,[e,t])}}),q2={};W$(q2,{pushTagsTask:()=>twe,pushTask:()=>J2});function twe(e={},t){return s1(t,`--tags`),J2(e,t)}function J2(e={},t){let n=[`push`,...t];return e.branch&&n.splice(1,0,e.branch),e.remote&&n.splice(1,0,e.remote),c1(n,`-v`),s1(n,`--verbose`),s1(n,`--porcelain`),{commands:n,format:`utf-8`,parser:G2}}var Y2=U$({"src/lib/tasks/push.ts"(){ewe(),H1()}});function nwe(){return{showBuffer(){let e=[`show`,...I1(arguments,1)];return e.includes(`--binary`)||e.splice(1,0,`--binary`),this._runTask(i0(e),R1(arguments))},show(){let e=[`show`,...I1(arguments,1)];return this._runTask(r0(e),R1(arguments))}}}var rwe=U$({"src/lib/tasks/show.ts"(){H1(),c0()}}),X2,Z2,iwe=U$({"src/lib/responses/FileStatusSummary.ts"(){X2=/^(.+)\0(.+)$/,Z2=class{constructor(e,t,n){if(this.path=e,this.index=t,this.working_dir=n,t===`R`||n===`R`){let t=X2.exec(e)||[null,e,e];this.from=t[2]||``,this.path=t[1]||``}}}}});function Q2(e){let[t,n]=e.split(g1);return{from:n||t,to:t}}function $2(e,t,n){return[`${e}${t}`,n]}function e4(e,...t){return t.map(t=>$2(e,t,(e,t)=>e.conflicted.push(t)))}function awe(e,t){let n=t.trim();switch(` `){case n.charAt(2):return r(n.charAt(0),n.charAt(1),n.slice(3));case n.charAt(1):return r(` `,n.charAt(0),n.slice(2));default:return}function r(t,n,r){let i=`${t}${n}`,a=n4.get(i);a&&a(e,r),i!==`##`&&i!==`!!`&&e.files.push(new Z2(r,t,n))}}var t4,n4,r4,owe=U$({"src/lib/responses/StatusSummary.ts"(){H1(),iwe(),t4=class{constructor(){this.not_added=[],this.conflicted=[],this.created=[],this.deleted=[],this.ignored=void 0,this.modified=[],this.renamed=[],this.files=[],this.staged=[],this.ahead=0,this.behind=0,this.current=null,this.tracking=null,this.detached=!1,this.isClean=()=>!this.files.length}},n4=new Map([$2(` `,`A`,(e,t)=>e.created.push(t)),$2(` `,`D`,(e,t)=>e.deleted.push(t)),$2(` `,`M`,(e,t)=>e.modified.push(t)),$2(`A`,` `,(e,t)=>{e.created.push(t),e.staged.push(t)}),$2(`A`,`M`,(e,t)=>{e.created.push(t),e.staged.push(t),e.modified.push(t)}),$2(`D`,` `,(e,t)=>{e.deleted.push(t),e.staged.push(t)}),$2(`M`,` `,(e,t)=>{e.modified.push(t),e.staged.push(t)}),$2(`M`,`M`,(e,t)=>{e.modified.push(t),e.staged.push(t)}),$2(`R`,` `,(e,t)=>{e.renamed.push(Q2(t))}),$2(`R`,`M`,(e,t)=>{let n=Q2(t);e.renamed.push(n),e.modified.push(n.to)}),$2(`!`,`!`,(e,t)=>{(e.ignored=e.ignored||[]).push(t)}),$2(`?`,`?`,(e,t)=>e.not_added.push(t)),...e4(`A`,`A`,`U`),...e4(`D`,`D`,`U`),...e4(`U`,`A`,`D`,`U`),[`##`,(e,t)=>{let n=/ahead (\d+)/,r=/behind (\d+)/,i=/^(.+?(?=(?:\.{3}|\s|$)))/,a=/\.{3}(\S*)/,o=/\son\s(\S+?)(?=\.{3}|$)/,s=n.exec(t);e.ahead=s&&+s[1]||0,s=r.exec(t),e.behind=s&&+s[1]||0,s=i.exec(t),e.current=b1(s?.[1],E1,null),s=a.exec(t),e.tracking=b1(s?.[1],E1,null),s=o.exec(t),s&&(e.current=b1(s?.[1],E1,e.current)),e.detached=/\(no branch\)/.test(t)}]]),r4=function(e){let t=e.split(g1),n=new t4;for(let e=0,r=t.length;e<r;){let r=t[e++].trim();r&&(r.charAt(0)===`R`&&(r+=g1+(t[e++]||``)),awe(n,r))}return n}}});function swe(e){return{format:`utf-8`,commands:[`status`,`--porcelain`,`-b`,`-u`,`--null`,...e.filter(e=>!i4.includes(e))],parser(e){return r4(e)}}}var i4,cwe=U$({"src/lib/tasks/status.ts"(){owe(),i4=[`--null`,`-z`]}});function a4(e=0,t=0,n=0,r=``,i=!0){return Object.defineProperty({major:e,minor:t,patch:n,agent:r,installed:i},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}function lwe(){return a4(0,0,0,``,!1)}function uwe(){return{version(){return this._runTask({commands:[`--version`],format:`utf-8`,parser:dwe,onError(e,t,n,r){if(e.exitCode===-2)return n(Buffer.from(o4));r(t)}})}}}function dwe(e){return e===o4?lwe():B1(a4(0,0,0,e),s4,e)}var o4,s4,fwe=U$({"src/lib/tasks/version.ts"(){H1(),o4=`installed=false`,s4=[new M1(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(e,[t,n,r,i=``])=>{Object.assign(e,a4(f1(t),f1(n),f1(r),i))}),new M1(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(e,[t,n,r,i=``])=>{Object.assign(e,a4(f1(t),f1(n),r,i))})]}});function c4(e,t,n,...r){return E1(n)?t(n,b1(r[0],E1),I1(arguments)):n0(`git.${e}() requires a string 'repoPath'`)}function pwe(){return{clone(e,...t){return this._runTask(c4(`clone`,l4,b1(e,E1),...t),R1(arguments))},mirror(e,...t){return this._runTask(c4(`mirror`,u4,b1(e,E1),...t),R1(arguments))}}}var l4,u4,mwe=U$({"src/lib/tasks/clone.ts"(){c0(),H1(),l4=(e,t,n)=>{let r=[`clone`,...n];return E1(e)&&r.push(P$(e)),E1(t)&&r.push(P$(t)),r0(r)},u4=(e,t,n)=>(s1(n,`--mirror`),l4(e,t,n))}}),d4={};W$(d4,{SimpleGitApi:()=>f4});var f4,hwe=U$({"src/lib/simple-git-api.ts"(){vCe(),yCe(),xCe(),wCe(),kCe(),x0(),jCe(),k0(),NCe(),RCe(),b2(),QCe(),Y2(),rwe(),cwe(),c0(),fwe(),H1(),mwe(),f4=class{constructor(e){this._executor=e}_runTask(e,t){let n=this._executor.chain(),r=n.push(e);return t&&gCe(e,r,t),Object.create(this,{then:{value:r.then.bind(r)},catch:{value:r.catch.bind(r)},_executor:{value:n}})}add(e){return this._runTask(r0([`add`,...l1(e)]),R1(arguments))}cwd(e){let t=R1(arguments);return typeof e==`string`?this._runTask(W0(e,this._executor),t):typeof e?.path==`string`?this._runTask(W0(e.path,e.root&&this._executor||void 0),t):this._runTask(n0(`Git.cwd: workingDirectory must be supplied as a string`),t)}hashObject(e,t){return this._runTask(MCe(e,t===!0),R1(arguments))}init(e){return this._runTask(LCe(e===!0,this._executor.cwd,I1(arguments)),R1(arguments))}merge(){return this._runTask(U2(I1(arguments)),R1(arguments))}mergeFromTo(e,t){return E1(e)&&E1(t)?this._runTask(U2([e,t,...I1(arguments)]),R1(arguments,!1)):this._runTask(n0(`Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`))}outputHandler(e){return this._executor.outputHandler=e,this}push(){let e=J2({remote:b1(arguments[0],E1),branch:b1(arguments[1],E1)},I1(arguments));return this._runTask(e,R1(arguments))}stash(){return this._runTask(r0([`stash`,...I1(arguments)]),R1(arguments))}status(){return this._runTask(swe(I1(arguments)),R1(arguments))}},Object.assign(f4.prototype,bCe(),pwe(),OCe(),rCe(),CCe(),ACe(),sCe(),KCe(),nwe(),uwe())}}),p4={};W$(p4,{Scheduler:()=>h4});var m4,h4,gwe=U$({"src/lib/runners/scheduler.ts"(){H1(),L0(),m4=(()=>{let e=0;return()=>{e++;let{promise:t,done:n}=(0,L$.createDeferred)();return{promise:t,done:n,id:e}}})(),h4=class{constructor(e=2){this.concurrency=e,this.logger=I0(``,`scheduler`),this.pending=[],this.running=[],this.logger(`Constructed, concurrency=%s`,e)}schedule(){if(!this.pending.length||this.running.length>=this.concurrency){this.logger(`Schedule attempt ignored, pending=%s running=%s concurrency=%s`,this.pending.length,this.running.length,this.concurrency);return}let e=s1(this.running,this.pending.shift());this.logger(`Attempting id=%s`,e.id),e.done(()=>{this.logger(`Completing id=`,e.id),c1(this.running,e),this.schedule()})}next(){let{promise:e,id:t}=s1(this.pending,m4());return this.logger(`Scheduling id=%s`,t),this.schedule(),e}}}}),g4={};W$(g4,{applyPatchTask:()=>_we});function _we(e,t){return r0([`apply`,...t,...e])}var vwe=U$({"src/lib/tasks/apply-patch.ts"(){c0()}});function ywe(e,t){return{branch:e,hash:t,success:!0}}function bwe(e){return{branch:e,hash:null,success:!1}}var _4,xwe=U$({"src/lib/responses/BranchDeleteSummary.ts"(){_4=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}});function v4(e,t){return t===1&&b4.test(e)}var y4,b4,x4,S4,Swe=U$({"src/lib/parsers/parse-branch-delete.ts"(){xwe(),H1(),y4=/(\S+)\s+\(\S+\s([^)]+)\)/,b4=/^error[^']+'([^']+)'/m,x4=[new M1(y4,(e,[t,n])=>{let r=ywe(t,n);e.all.push(r),e.branches[t]=r}),new M1(b4,(e,[t])=>{let n=bwe(t);e.errors.push(n),e.all.push(n),e.branches[t]=n})],S4=(e,t)=>B1(new _4,x4,[e,t])}}),C4,Cwe=U$({"src/lib/responses/BranchSummary.ts"(){C4=class{constructor(){this.all=[],this.branches={},this.current=``,this.detached=!1}push(e,t,n,r,i){e===`*`&&(this.detached=t,this.current=n),this.all.push(n),this.branches[n]={current:e===`*`,linkedWorkTree:e===`+`,name:n,commit:r,label:i}}}}});function w4(e){return e?e.charAt(0):``}function T4(e,t=!1){return B1(new C4,t?[D4]:E4,e)}var E4,D4,wwe=U$({"src/lib/parsers/parse-branch.ts"(){Cwe(),H1(),E4=[new M1(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(e,[t,n,r,i])=>{e.push(w4(t),!0,n,r,i)}),new M1(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,(e,[t,n,r,i])=>{e.push(w4(t),!1,n,r,i)})],D4=new M1(/^(\S+)$/s,(e,[t])=>{e.push(`*`,!1,t,``,``)})}}),O4={};W$(O4,{branchLocalTask:()=>Ewe,branchTask:()=>Twe,containsDeleteBranchCommand:()=>k4,deleteBranchTask:()=>Owe,deleteBranchesTask:()=>Dwe});function k4(e){let t=[`-d`,`-D`,`--delete`];return e.some(e=>t.includes(e))}function Twe(e){let t=k4(e),n=e.includes(`--show-current`),r=[`branch`,...e];return r.length===1&&r.push(`-a`),r.includes(`-v`)||r.splice(1,0,`-v`),{format:`utf-8`,commands:r,parser(e,r){return t?S4(e,r).all[0]:T4(e,n)}}}function Ewe(){return{format:`utf-8`,commands:[`branch`,`-v`],parser(e){return T4(e)}}}function Dwe(e,t=!1){return{format:`utf-8`,commands:[`branch`,`-v`,t?`-D`:`-d`,...e],parser(e,t){return S4(e,t)},onError({exitCode:e,stdOut:t},n,r,i){if(!v4(String(n),e))return i(n);r(t)}}}function Owe(e,t=!1){let n={format:`utf-8`,commands:[`branch`,`-v`,t?`-D`:`-d`,e],parser(t,n){return S4(t,n).branches[e]},onError({exitCode:e,stdErr:t,stdOut:r},i,a,o){if(!v4(String(i),e))return o(i);throw new J$(n.parser(m1(r),m1(t)),String(i))}};return n}var kwe=U$({"src/lib/tasks/branch.ts"(){Y$(),Swe(),wwe(),H1()}});function Awe(e){let t=e.trim().replace(/^["']|["']$/g,``);return t&&_e(t)}var A4,jwe=U$({"src/lib/responses/CheckIgnore.ts"(){A4=e=>e.split(/\n/g).map(Awe).filter(Boolean)}}),j4={};W$(j4,{checkIgnoreTask:()=>Mwe});function Mwe(e){return{commands:[`check-ignore`,...e],format:`utf-8`,parser:A4}}var Nwe=U$({"src/lib/tasks/check-ignore.ts"(){jwe()}});function Pwe(e,t){return B1({raw:e,remote:null,branches:[],tags:[],updated:[],deleted:[]},M4,[e,t])}var M4,Fwe=U$({"src/lib/parsers/parse-fetch.ts"(){H1(),M4=[new M1(/From (.+)$/,(e,[t])=>{e.remote=t}),new M1(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(e,[t,n])=>{e.branches.push({name:t,tracking:n})}),new M1(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(e,[t,n])=>{e.tags.push({name:t,tracking:n})}),new M1(/- \[deleted]\s+\S+\s*-> (.+)$/,(e,[t])=>{e.deleted.push({tracking:t})}),new M1(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(e,[t,n,r,i])=>{e.updated.push({name:r,tracking:i,to:n,from:t})})]}}),N4={};W$(N4,{fetchTask:()=>Lwe});function Iwe(e){return/^--upload-pack(=|$)/.test(e)}function Lwe(e,t,n){let r=[`fetch`,...n];return e&&t&&r.push(e,t),r.find(Iwe)?n0(`git.fetch: potential exploit argument blocked.`):{commands:r,format:`utf-8`,parser:Pwe}}var Rwe=U$({"src/lib/tasks/fetch.ts"(){Fwe(),c0()}});function zwe(e){return B1({moves:[]},P4,e)}var P4,Bwe=U$({"src/lib/parsers/parse-move.ts"(){H1(),P4=[new M1(/^Renaming (.+) to (.+)$/,(e,[t,n])=>{e.moves.push({from:t,to:n})})]}}),F4={};W$(F4,{moveTask:()=>Vwe});function Vwe(e,t){return{commands:[`mv`,`-v`,...l1(e),t],format:`utf-8`,parser:zwe}}var Hwe=U$({"src/lib/tasks/move.ts"(){Bwe(),H1()}}),I4={};W$(I4,{pullTask:()=>Uwe});function Uwe(e,t,n){let r=[`pull`,...n];return e&&t&&r.splice(1,0,e,t),{commands:r,format:`utf-8`,parser(e,t){return R2(e,t)},onError(e,t,n,r){let i=XCe(m1(e.stdOut),m1(e.stdErr));if(i)return r(new J$(i));r(t)}}}var Wwe=U$({"src/lib/tasks/pull.ts"(){Y$(),z2(),H1()}});function Gwe(e){let t={};return L4(e,([e])=>t[e]={name:e}),Object.values(t)}function Kwe(e){let t={};return L4(e,([e,n,r])=>{Object.hasOwn(t,e)||(t[e]={name:e,refs:{fetch:``,push:``}}),r&&n&&(t[e].refs[r.replace(/[^a-z]/g,``)]=n)}),Object.values(t)}function L4(e,t){a1(e,e=>t(e.split(/\s+/)))}var qwe=U$({"src/lib/responses/GetRemoteSummary.ts"(){H1()}}),R4={};W$(R4,{addRemoteTask:()=>Jwe,getRemotesTask:()=>Ywe,listRemotesTask:()=>Xwe,remoteTask:()=>Zwe,removeRemoteTask:()=>Qwe});function Jwe(e,t,n){return r0([`remote`,`add`,...n,e,t])}function Ywe(e){let t=[`remote`];return e&&t.push(`-v`),{commands:t,format:`utf-8`,parser:e?Kwe:Gwe}}function Xwe(e){let t=[...e];return t[0]!==`ls-remote`&&t.unshift(`ls-remote`),r0(t)}function Zwe(e){let t=[...e];return t[0]!==`remote`&&t.unshift(`remote`),r0(t)}function Qwe(e){return r0([`remote`,`remove`,e])}var $we=U$({"src/lib/tasks/remote.ts"(){qwe(),c0()}}),z4={};W$(z4,{stashListTask:()=>eTe});function eTe(e={},t){let n=v2(e),r=[`stash`,`list`,...n.commands,...t],i=l2(n.splitter,n.fields,Q0(r));return g2(r)||{commands:r,format:`utf-8`,parser:i}}var tTe=U$({"src/lib/tasks/stash-list.ts"(){e2(),m2(),_2(),b2()}}),B4={};W$(B4,{addSubModuleTask:()=>nTe,initSubModuleTask:()=>rTe,subModuleTask:()=>V4,updateSubModuleTask:()=>iTe});function nTe(e,t){return V4([`add`,e,t])}function rTe(e){return V4([`init`,...e])}function V4(e){let t=[...e];return t[0]!==`submodule`&&t.unshift(`submodule`),r0(t)}function iTe(e){return V4([`update`,...e])}var aTe=U$({"src/lib/tasks/sub-module.ts"(){c0()}});function oTe(e,t){let n=Number.isNaN(e);return n===Number.isNaN(t)?n?H4(e,t):0:n?1:-1}function H4(e,t){return e===t?0:e>t?1:-1}function sTe(e){return e.trim()}function U4(e){return typeof e==`string`&&parseInt(e.replace(/^\D+/g,``),10)||0}var W4,G4,cTe=U$({"src/lib/responses/TagList.ts"(){W4=class{constructor(e,t){this.all=e,this.latest=t}},G4=function(e,t=!1){let n=e.split(`
|
|
722
|
+
`).map(sTe).filter(Boolean);t||n.sort(function(e,t){let n=e.split(`.`),r=t.split(`.`);if(n.length===1||r.length===1)return oTe(U4(n[0]),U4(r[0]));for(let e=0,t=Math.max(n.length,r.length);e<t;e++){let t=H4(U4(n[e]),U4(r[e]));if(t)return t}return 0});let r=t?n[0]:[...n].reverse().find(e=>e.indexOf(`.`)>=0);return new W4(n,r)}}}),K4={};W$(K4,{addAnnotatedTagTask:()=>dTe,addTagTask:()=>uTe,tagListTask:()=>lTe});function lTe(e=[]){let t=e.some(e=>/^--sort=/.test(e));return{format:`utf-8`,commands:[`tag`,`-l`,...e],parser(e){return G4(e,t)}}}function uTe(e){return{format:`utf-8`,commands:[`tag`,e],parser(){return{name:e}}}}function dTe(e,t){return{format:`utf-8`,commands:[`tag`,`-a`,`-m`,t,e],parser(){return{name:e}}}}var fTe=U$({"src/lib/tasks/tag.ts"(){cTe()}}),pTe=ESe({"src/git.js"(e,t){var{GitExecutor:n}=(hCe(),G$(H0)),{SimpleGitApi:r}=(hwe(),G$(d4)),{Scheduler:i}=(gwe(),G$(p4)),{adhocExecTask:a,configurationErrorTask:o}=(c0(),G$(e0)),{asArray:s,filterArray:c,filterPrimitives:l,filterString:u,filterStringOrStringArray:d,filterType:f,getTrailingOptions:p,trailingFunctionArgument:m,trailingOptionsArgument:h}=(H1(),G$(V1)),{applyPatchTask:g}=(vwe(),G$(g4)),{branchTask:_,branchLocalTask:v,deleteBranchesTask:y,deleteBranchTask:b}=(kwe(),G$(O4)),{checkIgnoreTask:x}=(Nwe(),G$(j4)),{checkIsRepoTask:S}=(Y1(),G$(U1)),{cleanWithOptionsTask:C,isCleanOptionsArray:w}=(g0(),G$(l0)),{diffSummaryTask:T}=(_2(),G$(h2)),{fetchTask:E}=(Rwe(),G$(N4)),{moveTask:D}=(Hwe(),G$(F4)),{pullTask:O}=(Wwe(),G$(I4)),{pushTagsTask:ee}=(Y2(),G$(q2)),{addRemoteTask:te,getRemotesTask:ne,listRemotesTask:re,remoteTask:ie,removeRemoteTask:ae}=($we(),G$(R4)),{getResetMode:oe,resetTask:se}=(P0(),G$(A0)),{stashListTask:k}=(tTe(),G$(z4)),{addSubModuleTask:ce,initSubModuleTask:le,subModuleTask:ue,updateSubModuleTask:A}=(aTe(),G$(B4)),{addAnnotatedTagTask:j,addTagTask:de,tagListTask:fe}=(fTe(),G$(K4)),{straightThroughBufferTask:pe,straightThroughStringTask:me}=(c0(),G$(e0));function M(e,t){this._plugins=t,this._executor=new n(e.baseDir,new i(e.maxConcurrentProcesses),t),this._trimmed=e.trimmed}(M.prototype=Object.create(r.prototype)).constructor=M,M.prototype.customBinary=function(e){return this._plugins.reconfigure(`binary`,e),this},M.prototype.env=function(e,t){return arguments.length===1&&typeof e==`object`?this._executor.env=e:(this._executor.env=this._executor.env||{})[e]=t,this},M.prototype.stashList=function(e){return this._runTask(k(h(arguments)||{},c(e)&&e||[]),m(arguments))},M.prototype.mv=function(e,t){return this._runTask(D(e,t),m(arguments))},M.prototype.checkoutLatestTag=function(e){var t=this;return this.pull(function(){t.tags(function(n,r){t.checkout(r.latest,e)})})},M.prototype.pull=function(e,t,n,r){return this._runTask(O(f(e,u),f(t,u),p(arguments)),m(arguments))},M.prototype.fetch=function(e,t){return this._runTask(E(f(e,u),f(t,u),p(arguments)),m(arguments))},M.prototype.silent=function(e){return this._runTask(a(()=>console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this method will be removed.")))},M.prototype.tags=function(e,t){return this._runTask(fe(p(arguments)),m(arguments))},M.prototype.rebase=function(){return this._runTask(me([`rebase`,...p(arguments)]),m(arguments))},M.prototype.reset=function(e){return this._runTask(se(oe(e),p(arguments)),m(arguments))},M.prototype.revert=function(e){let t=m(arguments);return typeof e==`string`?this._runTask(me([`revert`,...p(arguments,0,!0),e]),t):this._runTask(o(`Commit must be a string`),t)},M.prototype.addTag=function(e){let t=typeof e==`string`?de(e):o(`Git.addTag requires a tag name`);return this._runTask(t,m(arguments))},M.prototype.addAnnotatedTag=function(e,t){return this._runTask(j(e,t),m(arguments))},M.prototype.deleteLocalBranch=function(e,t,n){return this._runTask(b(e,typeof t==`boolean`&&t),m(arguments))},M.prototype.deleteLocalBranches=function(e,t,n){return this._runTask(y(e,typeof t==`boolean`&&t),m(arguments))},M.prototype.branch=function(e,t){return this._runTask(_(p(arguments)),m(arguments))},M.prototype.branchLocal=function(e){return this._runTask(v(),m(arguments))},M.prototype.raw=function(e){let t=!Array.isArray(e),n=[].slice.call(t?arguments:e,0);for(let e=0;e<n.length&&t;e++)if(!l(n[e])){n.splice(e,n.length-e);break}n.push(...p(arguments,0,!0));var r=m(arguments);return n.length?this._runTask(me(n,this._trimmed),r):this._runTask(o(`Raw: must supply one or more command to execute`),r)},M.prototype.submoduleAdd=function(e,t,n){return this._runTask(ce(e,t),m(arguments))},M.prototype.submoduleUpdate=function(e,t){return this._runTask(A(p(arguments,!0)),m(arguments))},M.prototype.submoduleInit=function(e,t){return this._runTask(le(p(arguments,!0)),m(arguments))},M.prototype.subModule=function(e,t){return this._runTask(ue(p(arguments)),m(arguments))},M.prototype.listRemote=function(){return this._runTask(re(p(arguments)),m(arguments))},M.prototype.addRemote=function(e,t,n){return this._runTask(te(e,t,p(arguments)),m(arguments))},M.prototype.removeRemote=function(e,t){return this._runTask(ae(e),m(arguments))},M.prototype.getRemotes=function(e,t){return this._runTask(ne(e===!0),m(arguments))},M.prototype.remote=function(e,t){return this._runTask(ie(p(arguments)),m(arguments))},M.prototype.tag=function(e,t){let n=p(arguments);return n[0]!==`tag`&&n.unshift(`tag`),this._runTask(me(n),m(arguments))},M.prototype.updateServerInfo=function(e){return this._runTask(me([`update-server-info`]),m(arguments))},M.prototype.pushTags=function(e,t){let n=ee({remote:f(e,u)},p(arguments));return this._runTask(n,m(arguments))},M.prototype.rm=function(e){return this._runTask(me([`rm`,`-f`,...s(e)]),m(arguments))},M.prototype.rmKeepLocal=function(e){return this._runTask(me([`rm`,`--cached`,...s(e)]),m(arguments))},M.prototype.catFile=function(e,t){return this._catFile(`utf-8`,arguments)},M.prototype.binaryCatFile=function(){return this._catFile(`buffer`,arguments)},M.prototype._catFile=function(e,t){var n=m(t),r=[`cat-file`],i=t[0];if(typeof i==`string`)return this._runTask(o(`Git.catFile: options must be supplied as an array of strings`),n);Array.isArray(i)&&r.push.apply(r,i);let a=e===`buffer`?pe(r):me(r);return this._runTask(a,n)},M.prototype.diff=function(e,t){let n=u(e)?o(`git.diff: supplying options as a single string is no longer supported, switch to an array of strings`):me([`diff`,...p(arguments)]);return this._runTask(n,m(arguments))},M.prototype.diffSummary=function(){return this._runTask(T(p(arguments,1)),m(arguments))},M.prototype.applyPatch=function(e){let t=d(e)?g(s(e),p([].slice.call(arguments,1))):o(`git.applyPatch requires one or more string patches as the first argument`);return this._runTask(t,m(arguments))},M.prototype.revparse=function(){let e=[`rev-parse`,...p(arguments,!0)];return this._runTask(me(e,!0),m(arguments))},M.prototype.clean=function(e,t,n){let r=w(e),i=r&&e.join(``)||f(e,u)||``,a=p([].slice.call(arguments,+!!r));return this._runTask(C(i,a),m(arguments))},M.prototype.exec=function(e){return this._runTask({commands:[],format:`utf-8`,parser(){typeof e==`function`&&e()}})},M.prototype.clearQueue=function(){return this._runTask(a(()=>console.warn(`simple-git deprecation notice: clearQueue() is deprecated and will be removed, switch to using the abortPlugin instead.`)))},M.prototype.checkIgnore=function(e,t){return this._runTask(x(s(f(e,d,[]))),m(arguments))},M.prototype.checkIsRepo=function(e,t){return this._runTask(S(f(e,u)),m(arguments))},t.exports=M}});q$(),q$(),q$(),Y$(),Z$(),Y1(),g0(),x0(),w0(),k0(),P0(),H1(),H1(),(0,L$.deferred)().promise,H1(),q$(),H1(),H1(),H1(),H1(),pTe(),Y$();var mTe=i(((e,t)=>{function n(e){return Array.isArray(e)?e:[e]}let r=/^\s+$/,i=/(?:[^\\]|^)\\$/,a=/^\\!/,o=/^\\#/,s=/\r?\n/g,c=/^\.*\/|^\.+$/,l=`node-ignore`;typeof Symbol<`u`&&(l=Symbol.for(`node-ignore`));let u=l,d=(e,t,n)=>Object.defineProperty(e,t,{value:n}),f=/([0-z])-([0-z])/g,p=()=>!1,m=e=>e.replace(f,(e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:``),h=e=>{let{length:t}=e;return e.slice(0,t-t%2)},g=[[/^\uFEFF/,()=>``],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(n.indexOf(`\\`)===0?` `:``)],[/(\\+?)\s/g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+` `}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>`[^/]`],[/^\//,()=>`^`],[/\//g,()=>`\\/`],[/^\^*\\\*\\\*\\\//,()=>`^(?:.*\\/)?`],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?`^`:`(?:^|\\/)`}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?`(?:\\/[^\\/]+)*`:`\\/.+`],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,`[^\\/]*`)],[/\\\\\\(?=[$.|*+(){^])/g,()=>`\\`],[/\\\\/g,()=>`\\`],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r,i)=>t===`\\`?`\\[${n}${h(r)}${i}`:i===`]`&&r.length%2==0?`[${m(n)}${r}]`:`[]`],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:`[^/]*`}(?=$|\\/$)`]],_=Object.create(null),v=(e,t)=>{let n=_[e];return n||(n=g.reduce((t,[n,r])=>t.replace(n,r.bind(e)),e),_[e]=n),t?new RegExp(n,`i`):new RegExp(n)},y=e=>typeof e==`string`,b=e=>e&&y(e)&&!r.test(e)&&!i.test(e)&&e.indexOf(`#`)!==0,x=e=>e.split(s);var S=class{constructor(e,t,n,r){this.origin=e,this.pattern=t,this.negative=n,this.regex=r}};let C=(e,t)=>{let n=e,r=!1;e.indexOf(`!`)===0&&(r=!0,e=e.substr(1)),e=e.replace(a,`!`).replace(o,`#`);let i=v(e,t);return new S(n,e,r,i)},w=(e,t)=>{throw new t(e)},T=(e,t,n)=>y(e)?e?!T.isNotRelative(e)||n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):n(`path must not be empty`,TypeError):n(`path must be a string, but got \`${t}\``,TypeError),E=e=>c.test(e);T.isNotRelative=E,T.convert=e=>e;var D=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){d(this,u,!0),this._rules=[],this._ignoreCase=t,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[u]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(b(e)){let t=C(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,n(y(e)?x(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,t){let n=!1,r=!1;return this._rules.forEach(i=>{let{negative:a}=i;r===a&&n!==r||a&&!n&&!r&&!t||i.regex.test(e)&&(n=!a,r=a)}),{ignored:n,unignored:r}}_test(e,t,n,r){let i=e&&T.convert(e);return T(i,e,this._allowRelativePaths?p:w),this._t(i,t,n,r)}_t(e,t,n,r){if(e in t)return t[e];if(r||=e.split(`/`),r.pop(),!r.length)return t[e]=this._testOne(e,n);let i=this._t(r.join(`/`)+`/`,t,n,r);return t[e]=i.ignored?i:this._testOne(e,n)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return n(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};let O=e=>new D(e);if(O.isPathValid=e=>T(e&&T.convert(e),e,p),O.default=O,t.exports=O,typeof process<`u`&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform===`win32`)){T.convert=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,`/`);let e=/^[a-z]:\//i;T.isNotRelative=t=>e.test(t)||E(t)}})),hTe=i(((e,t)=>{function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}let r=new Int32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function i(e){if(Buffer.isBuffer(e))return e;if(typeof e==`number`)return Buffer.alloc(e);if(typeof e==`string`)return Buffer.from(e);throw Error(`input must be buffer, number, or string, received `+typeof e)}function a(e){let t=i(4);return t.writeInt32BE(e,0),t}function o(e,t){e=i(e),Buffer.isBuffer(t)&&(t=t.readUInt32BE(0));let n=~~t^-1;for(var a=0;a<e.length;a++)n=r[(n^e[a])&255]^n>>>8;return n^-1}function s(){return a(o.apply(null,arguments))}s.signed=function(){return o.apply(null,arguments)},s.unsigned=function(){return o.apply(null,arguments)>>>0},t.exports=n(s)})),q4=i((e=>{var n=t(`fs`),r=t(`stream`).Transform,i=t(`stream`).PassThrough,a=t(`zlib`),o=t(`util`),s=t(`events`).EventEmitter,c=t(`events`).errorMonitor,l=hTe();e.ZipFile=u,e.dateToDosDateTime=ce,o.inherits(u,s);function u(){this.outputStream=new i,this.entries=[],this.outputStreamCursor=0,this.ended=!1,this.allDone=!1,this.forceZip64Eocd=!1,this.errored=!1,this.on(c,function(){this.errored=!0})}u.prototype.addFile=function(e,t,r){var i=this;if(t=S(t,!1),r??={},!_(i)){var a=new w(t,!1,r);i.entries.push(a),n.stat(e,function(t,o){if(t)return i.emit(`error`,t);if(!o.isFile())return i.emit(`error`,Error(`not a file: `+e));a.uncompressedSize=o.size,r.mtime??a.setLastModDate(o.mtime),r.mode??a.setFileAttributesMode(o.mode),a.setFileDataPumpFunction(function(){var t=n.createReadStream(e);a.state=w.FILE_DATA_IN_PROGRESS,t.on(`error`,function(e){i.emit(`error`,e)}),p(i,a,t)}),h(i)})}},u.prototype.addReadStream=function(e,t,n){this.addReadStreamLazy(t,n,function(t){t(null,e)})},u.prototype.addReadStreamLazy=function(e,t,n){var r=this;if(typeof t==`function`&&(n=t,t=null),t??={},e=S(e,!1),!_(r)){var i=new w(e,!1,t);r.entries.push(i),i.setFileDataPumpFunction(function(){i.state=w.FILE_DATA_IN_PROGRESS,n(function(e,t){if(e)return r.emit(`error`,e);p(r,i,t)})}),h(r)}},u.prototype.addBuffer=function(e,t,n){var r=this;if(t=S(t,!1),e.length>1073741823)throw Error(`buffer too large: `+e.length+` > 1073741823`);if(n??={},n.size!=null)throw Error(`options.size not allowed`);if(_(r))return;var i=new w(t,!1,n);i.uncompressedSize=e.length,i.crc32=l.unsigned(e),i.crcAndFileSizeKnown=!0,r.entries.push(i),i.compressionLevel===0?o(e):a.deflateRaw(e,{level:i.compressionLevel},function(e,t){o(t)});function o(e){i.compressedSize=e.length,i.setFileDataPumpFunction(function(){f(r,e),f(r,i.getDataDescriptor()),i.state=w.FILE_DATA_DONE,setImmediate(function(){h(r)})}),h(r)}},u.prototype.addEmptyDirectory=function(e,t){var n=this;if(e=S(e,!0),t??={},t.size!=null)throw Error(`options.size not allowed`);if(t.compress!=null)throw Error(`options.compress not allowed`);if(t.compressionLevel!=null)throw Error(`options.compressionLevel not allowed`);if(!_(n)){var r=new w(e,!0,t);n.entries.push(r),r.setFileDataPumpFunction(function(){f(n,r.getDataDescriptor()),r.state=w.FILE_DATA_DONE,h(n)}),h(n)}};var d=me([80,75,5,6]);u.prototype.end=function(e,t){if(typeof e==`function`&&(t=e,e=null),e??={},!this.ended&&(this.ended=!0,!this.errored)){if(this.calculatedTotalSizeCallback=t,this.forceZip64Eocd=!!e.forceZip64Format,e.comment){if(this.comment=typeof e.comment==`string`?fe(e.comment):e.comment,this.comment.length>65535)throw Error(`comment is too large`);if(M(this.comment,d))throw Error(`comment contains end of central directory record signature`)}else this.comment=C;h(this)}};function f(e,t){e.outputStream.write(t),e.outputStreamCursor+=t.length}function p(e,t,n){var r=new A,o=new ue,s=t.compressionLevel===0?new i:new a.DeflateRaw({level:t.compressionLevel}),c=new ue;n.pipe(r).pipe(o).pipe(s).pipe(c).pipe(e.outputStream,{end:!1}),c.on(`end`,function(){if(t.crc32=r.crc32,t.uncompressedSize==null)t.uncompressedSize=o.byteCount;else if(t.uncompressedSize!==o.byteCount)return e.emit(`error`,Error(`file data stream has unexpected number of bytes`));t.compressedSize=c.byteCount,e.outputStreamCursor+=t.compressedSize,f(e,t.getDataDescriptor()),t.state=w.FILE_DATA_DONE,h(e)})}function m(e){if(e.compress!=null&&e.compressionLevel!=null&&!!e.compress!=!!e.compressionLevel)throw Error(`conflicting settings for compress and compressionLevel`);return e.compressionLevel==null?e.compress===!1?0:6:e.compressionLevel}function h(e){if(e.allDone||e.errored)return;if(e.ended&&e.calculatedTotalSizeCallback!=null){var t=g(e);t!=null&&(e.calculatedTotalSizeCallback(t),e.calculatedTotalSizeCallback=null)}var n=r();function r(){for(var t=0;t<e.entries.length;t++){var n=e.entries[t];if(n.state<w.FILE_DATA_DONE)return n}return null}if(n!=null){if(n.state<w.READY_TO_PUMP_FILE_DATA||n.state===w.FILE_DATA_IN_PROGRESS)return;n.relativeOffsetOfLocalHeader=e.outputStreamCursor,f(e,n.getLocalFileHeader()),n.doFileDataPump()}else e.ended&&(e.offsetOfStartOfCentralDirectory=e.outputStreamCursor,e.entries.forEach(function(t){f(e,t.getCentralDirectoryRecord())}),f(e,x(e)),e.outputStream.end(),e.allDone=!0)}function g(e){for(var t=0,n=0,r=0;r<e.entries.length;r++){var i=e.entries[r];if(i.compressionLevel!==0)return-1;if(i.state>=w.READY_TO_PUMP_FILE_DATA){if(i.uncompressedSize==null)return-1}else if(i.uncompressedSize==null)return null;i.relativeOffsetOfLocalHeader=t;var a=i.useZip64Format();t+=T+i.utf8FileName.length,t+=i.uncompressedSize,i.crcAndFileSizeKnown||(t+=a?re:ne),n+=ie+i.utf8FileName.length+i.fileComment.length,i.forceDosTimestamp||(n+=ae),a&&(n+=oe)}var o=0;return(e.forceZip64Eocd||e.entries.length>=65535||n>=65535||t>=4294967295)&&(o+=v+y),o+=b+e.comment.length,t+n+o}function _(e){if(e.ended)throw Error(`cannot add entries after calling end()`);return!!e.errored}var v=56,y=20,b=22;function x(e,t){var n=!1,r=e.entries.length;(e.forceZip64Eocd||e.entries.length>=65535)&&(r=65535,n=!0);var i=e.outputStreamCursor-e.offsetOfStartOfCentralDirectory,a=i;(e.forceZip64Eocd||i>=4294967295)&&(a=4294967295,n=!0);var o=e.offsetOfStartOfCentralDirectory;if((e.forceZip64Eocd||e.offsetOfStartOfCentralDirectory>=4294967295)&&(o=4294967295,n=!0),t)return n?v+y+b:b;var s=pe(b+e.comment.length);if(s.writeUInt32LE(101010256,0),s.writeUInt16LE(0,4),s.writeUInt16LE(0,6),s.writeUInt16LE(r,8),s.writeUInt16LE(r,10),s.writeUInt32LE(a,12),s.writeUInt32LE(o,16),s.writeUInt16LE(e.comment.length,20),e.comment.copy(s,22),!n)return s;var c=pe(v);c.writeUInt32LE(101075792,0),le(c,v-12,4),c.writeUInt16LE(O,12),c.writeUInt16LE(D,14),c.writeUInt32LE(0,16),c.writeUInt32LE(0,20),le(c,e.entries.length,24),le(c,e.entries.length,32),le(c,i,40),le(c,e.offsetOfStartOfCentralDirectory,48);var l=pe(y);return l.writeUInt32LE(117853008,0),l.writeUInt32LE(0,4),le(l,e.outputStreamCursor,8),l.writeUInt32LE(1,16),Buffer.concat([c,l,s])}function S(e,t){if(e===``)throw Error(`empty metadataPath`);if(e=e.replace(/\\/g,`/`),/^[a-zA-Z]:/.test(e)||/^\//.test(e))throw Error(`absolute path: `+e);if(e.split(`/`).indexOf(`..`)!==-1)throw Error(`invalid relative path: `+e);var n=/\/$/.test(e);if(t)n||(e+=`/`);else if(n)throw Error(`file path cannot end with '/': `+e);return e}var C=pe(0);function w(e,t,n){if(this.utf8FileName=me(e),this.utf8FileName.length>65535)throw Error(`utf8 file name too long. `+utf8FileName.length+` > 65535`);if(this.isDirectory=t,this.state=w.WAITING_FOR_METADATA,this.setLastModDate(n.mtime==null?new Date:n.mtime),this.forceDosTimestamp=!!n.forceDosTimestamp,n.mode==null?this.setFileAttributesMode(t?16893:33204):this.setFileAttributesMode(n.mode),t?(this.crcAndFileSizeKnown=!0,this.crc32=0,this.uncompressedSize=0,this.compressedSize=0):(this.crcAndFileSizeKnown=!1,this.crc32=null,this.uncompressedSize=null,this.compressedSize=null,n.size!=null&&(this.uncompressedSize=n.size)),this.compressionLevel=t?0:m(n),this.forceZip64Format=!!n.forceZip64Format,n.fileComment){if(this.fileComment=typeof n.fileComment==`string`?me(n.fileComment,`utf-8`):n.fileComment,this.fileComment.length>65535)throw Error(`fileComment is too large`)}else this.fileComment=C}w.WAITING_FOR_METADATA=0,w.READY_TO_PUMP_FILE_DATA=1,w.FILE_DATA_IN_PROGRESS=2,w.FILE_DATA_DONE=3,w.prototype.setLastModDate=function(e){this.mtime=e;var t=ce(e);this.lastModFileTime=t.time,this.lastModFileDate=t.date},w.prototype.setFileAttributesMode=function(e){if((e&65535)!==e)throw Error(`invalid mode. expected: 0 <= `+e+` <= 65535`);this.externalFileAttributes=e<<16>>>0},w.prototype.setFileDataPumpFunction=function(e){this.doFileDataPump=e,this.state=w.READY_TO_PUMP_FILE_DATA},w.prototype.useZip64Format=function(){return this.forceZip64Format||this.uncompressedSize!=null&&this.uncompressedSize>4294967294||this.compressedSize!=null&&this.compressedSize>4294967294||this.relativeOffsetOfLocalHeader!=null&&this.relativeOffsetOfLocalHeader>4294967294};var T=30,E=20,D=45,O=831,ee=2048,te=8;w.prototype.getLocalFileHeader=function(){var e=0,t=0,n=0;this.crcAndFileSizeKnown&&(e=this.crc32,t=this.compressedSize,n=this.uncompressedSize);var r=pe(T),i=ee;return this.crcAndFileSizeKnown||(i|=te),r.writeUInt32LE(67324752,0),r.writeUInt16LE(E,4),r.writeUInt16LE(i,6),r.writeUInt16LE(this.getCompressionMethod(),8),r.writeUInt16LE(this.lastModFileTime,10),r.writeUInt16LE(this.lastModFileDate,12),r.writeUInt32LE(e,14),r.writeUInt32LE(t,18),r.writeUInt32LE(n,22),r.writeUInt16LE(this.utf8FileName.length,26),r.writeUInt16LE(0,28),Buffer.concat([r,this.utf8FileName])};var ne=16,re=24;w.prototype.getDataDescriptor=function(){if(this.crcAndFileSizeKnown)return C;if(this.useZip64Format()){var e=pe(re);return e.writeUInt32LE(134695760,0),e.writeUInt32LE(this.crc32,4),le(e,this.compressedSize,8),le(e,this.uncompressedSize,16),e}var e=pe(ne);return e.writeUInt32LE(134695760,0),e.writeUInt32LE(this.crc32,4),e.writeUInt32LE(this.compressedSize,8),e.writeUInt32LE(this.uncompressedSize,12),e};var ie=46,ae=9,oe=28;w.prototype.getCentralDirectoryRecord=function(){var e=pe(ie),t=ee;this.crcAndFileSizeKnown||(t|=te);var n=C;if(!this.forceDosTimestamp){n=pe(ae),n.writeUInt16LE(21589,0),n.writeUInt16LE(ae-4,2),n.writeUInt8(3,4);var r=Math.floor(this.mtime.getTime()/1e3);r<-2147483648&&(r=-2147483648),r>2147483647&&(r=2147483647),n.writeUInt32LE(r,5)}var i=this.compressedSize,a=this.uncompressedSize,o=this.relativeOffsetOfLocalHeader,s=E,c=C;return this.useZip64Format()&&(i=4294967295,a=4294967295,o=4294967295,s=D,c=pe(oe),c.writeUInt16LE(1,0),c.writeUInt16LE(oe-4,2),le(c,this.uncompressedSize,4),le(c,this.compressedSize,12),le(c,this.relativeOffsetOfLocalHeader,20)),e.writeUInt32LE(33639248,0),e.writeUInt16LE(O,4),e.writeUInt16LE(s,6),e.writeUInt16LE(t,8),e.writeUInt16LE(this.getCompressionMethod(),10),e.writeUInt16LE(this.lastModFileTime,12),e.writeUInt16LE(this.lastModFileDate,14),e.writeUInt32LE(this.crc32,16),e.writeUInt32LE(i,20),e.writeUInt32LE(a,24),e.writeUInt16LE(this.utf8FileName.length,28),e.writeUInt16LE(n.length+c.length,30),e.writeUInt16LE(this.fileComment.length,32),e.writeUInt16LE(0,34),e.writeUInt16LE(0,36),e.writeUInt32LE(this.externalFileAttributes,38),e.writeUInt32LE(o,42),Buffer.concat([e,this.utf8FileName,n,c,this.fileComment])},w.prototype.getCompressionMethod=function(){return this.compressionLevel===0?0:8};var se=new Date(1980,0,1),k=new Date(2107,11,31,23,59,58);function ce(e){e<se?e=se:e>k&&(e=k);var t=0;t|=e.getDate()&31,t|=(e.getMonth()+1&15)<<5,t|=(e.getFullYear()-1980&127)<<9;var n=0;return n|=Math.floor(e.getSeconds()/2),n|=(e.getMinutes()&63)<<5,n|=(e.getHours()&31)<<11,{date:t,time:n}}function le(e,t,n){var r=Math.floor(t/4294967296),i=t%4294967296;e.writeUInt32LE(i,n),e.writeUInt32LE(r,n+4)}o.inherits(ue,r);function ue(e){r.call(this,e),this.byteCount=0}ue.prototype._transform=function(e,t,n){this.byteCount+=e.length,n(null,e)},o.inherits(A,r);function A(e){r.call(this,e),this.crc32=0}A.prototype._transform=function(e,t,n){this.crc32=l.unsigned(e,this.crc32),n(null,e)};var j=`\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\xA0`;if(j.length!==256)throw Error(`assertion failure`);var de=null;function fe(e){if(/^[\x20-\x7e]*$/.test(e))return me(e,`utf-8`);if(de==null){de={};for(var t=0;t<j.length;t++)de[j[t]]=t}for(var n=pe(e.length),t=0;t<e.length;t++){var r=de[e[t]];if(r==null)throw Error(`character not encodable in CP437: `+JSON.stringify(e[t]));n[t]=r}return n}function pe(e){pe=t;try{return pe(e)}catch{return pe=n,pe(e)}function t(e){return Buffer.allocUnsafe(e)}function n(e){return new Buffer(e)}}function me(e,t){me=n;try{return me(e,t)}catch{return me=r,me(e,t)}function n(e,t){return Buffer.from(e,t)}function r(e,t){return new Buffer(e,t)}}function M(e,t){M=n;try{return M(e,t)}catch{return M=r,M(e,t)}function n(e,t){return e.includes(t)}function r(e,t){for(var n=0;n<=e.length-t.length;n++)for(var r=0;;r++){if(r===t.length)return!0;if(e[n+r]!==t[r])break}return!1}}})),J4=e(mTe(),1),gTe=e(q4(),1);Ne(o);const _Te=si({source:F(),pluginProvider:F().optional(),skill:F().optional(),ref:F().optional(),contentHash:F(),files:z(F()).optional(),localHash:F().optional(),baselineRef:F().optional(),publisher:F().optional(),importedAt:Fr(),autoUpdate:L().optional()});si({schema:W(1),skills:H(F(),_Te).default({})}),new Set(Object.values(sd)),[...new Set([`.git`,`node_modules`])];const Y4=[`agents`,`claude`,`cursor`,`codex`,`opencode`,`pi`,`copilot`];var vTe=i(((e,t)=>{t.exports=n;function n(){this.pending=0,this.max=1/0,this.listeners=[],this.waiting=[],this.error=null}n.prototype.go=function(e){this.pending<this.max?i(this,e):this.waiting.push(e)},n.prototype.wait=function(e){this.pending===0?e(this.error):this.listeners.push(e)},n.prototype.hold=function(){return r(this)};function r(e){e.pending+=1;var t=!1;return n;function n(n){if(t)throw Error(`callback called twice`);if(t=!0,e.error=e.error||n,--e.pending,e.waiting.length>0&&e.pending<e.max)i(e,e.waiting.shift());else if(e.pending===0){var a=e.listeners;e.listeners=[],a.forEach(r)}}function r(t){t(e.error)}}function i(e,t){t(r(e))}})),yTe=i((e=>{var n=t(`fs`),r=t(`util`),i=t(`stream`),a=i.Readable,o=i.PassThrough,s=vTe(),c=t(`events`).EventEmitter;e.BufferSlicer=d,e.FdSlicer=l,r.inherits(l,c);function l(e){c.call(this),this.fd=e,this.pend=new s,this.pend.max=1,this.refCount=0}l.prototype.read=function(e,t,r,i,a){var o=this;o.pend.go(function(s){n.read(o.fd,e,t,r,i,function(e,t,n){s(),a(e,t,n)})})},l.prototype.createReadStream=function(e){return new u(this,e)},l.prototype.ref=function(){this.refCount+=1},l.prototype.unref=function(){var e=this;if(--e.refCount,e.refCount<0)throw Error(`invalid unref`);if(e.refCount>0)return;n.close(e.fd,t);function t(t){t?e.emit(`error`,t):e.emit(`close`)}},r.inherits(u,a);function u(e,t){t||={},a.call(this,t),this.context=e,this.context.ref(),this.start=t.start||0,this.endOffset=t.end,this.pos=this.start}u.prototype._read=function(e){var t=this,r=Math.min(t._readableState.highWaterMark,e);if(t.endOffset!=null&&(r=Math.min(r,t.endOffset-t.pos)),r<=0){t.push(null),this._cleanup();return}t.context.pend.go(function(e){var i=Buffer.allocUnsafe(r);n.read(t.context.fd,i,0,r,t.pos,function(n,r){n?t.destroy(n):r===0?(t.push(null),t._cleanup()):(t.pos+=r,t.push(i.slice(0,r))),e()})})},u.prototype._destroy=function(e,t){this._cleanup(),t(e)},u.prototype._cleanup=function(){this.context!=null&&(this.context.unref(),this.context=null)},r.inherits(d,c);function d(e){c.call(this),this.refCount=0,this.buffer=e}d.prototype.read=function(e,t,n,r,i){if(!(0<=t&&t<=e.length))throw RangeError(`offset outside buffer: 0 <= `+t+` <= `+e.length);if(r<0)throw RangeError(`position is negative: `+r);if(t+n>e.length&&(n=e.length-t),r+n>this.buffer.length&&(n=this.buffer.length-r),n<=0){setImmediate(function(){i(null,0)});return}this.buffer.copy(e,t,r,r+n),setImmediate(function(){i(null,n)})},d.prototype.createReadStream=function(e){e||={};var t=new o(e);t.start=e.start||0,t.endOffset=e.end,t.pos=t.endOffset||this.buffer.length;for(var n=this.buffer.slice(t.start,t.pos),r=65536,i=0;;){var a=i+r;if(a>=n.length){i<n.length&&t.write(n.slice(i,n.length));break}t.write(n.slice(i,a)),i=a}return t.end(),t},d.prototype.ref=function(){this.refCount+=1},d.prototype.unref=function(){if(--this.refCount,this.refCount<0)throw Error(`invalid unref`)}})),bTe=i(((e,t)=>{let n=new Int32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function r(e){let t=-1;for(let r of e)t=n[(t^r)&255]^t>>>8;return(t^-1)>>>0}t.exports=r})),xTe=i((e=>{t(`fs`);var n=t(`zlib`);yTe();var r=t(`util`),i=t(`events`).EventEmitter,a=t(`stream`).Transform,o=t(`stream`).PassThrough,s=t(`stream`).Writable;let c=typeof n.crc32==`function`?n.crc32:bTe();r.inherits(l,i);function l(e,t,n,r,a,o,s,c,l,u){var f=this;i.call(f),f.reader=e,f.reader.on(`error`,function(e){d(f,e)}),f.reader.once(`close`,function(){f.emit(`close`)}),f.readEntryCursor=t,f.fileSize=n,f.entryCount=r,f.comment=a,f.entriesRead=0,f.autoClose=!!o,f.lazyEntries=!!s,f.decodeStrings=!!c,f.validateEntrySizes=!!l,f.strictFileNames=!!u,f.isOpen=!0,f.emittedError=!1,f.hasEachEntryBeenCalled=!1,f.lazyEntries||f._readEntry()}l.prototype.close=function(){this.isOpen&&(this.isOpen=!1,this.reader.unref())};function u(e,t){e.autoClose&&e.close(),d(e,t)}function d(e,t){e.emittedError||(e.emittedError=!0,e.emit(`error`,t))}l.prototype.readEntry=function(){if(!this.lazyEntries)throw Error(`readEntry() called without lazyEntries:true`);this._readEntry()},l.prototype._readEntry=function(){var e=this;if(e.entryCount===e.entriesRead){setImmediate(function(){e.autoClose&&e.close(),!e.emittedError&&e.emit(`end`)});return}if(!e.emittedError){var t=T(46);v(e.reader,t,0,t.length,e.readEntryCursor,function(n){if(n)return u(e,n);if(!e.emittedError){var r=new f,i=t.readUInt32LE(0);if(i!==33639248)return u(e,Error(`invalid central directory file header signature: 0x`+i.toString(16)));if(r.versionMadeBy=t.readUInt16LE(4),r.versionNeededToExtract=t.readUInt16LE(6),r.generalPurposeBitFlag=t.readUInt16LE(8),r.compressionMethod=t.readUInt16LE(10),r.lastModFileTime=t.readUInt16LE(12),r.lastModFileDate=t.readUInt16LE(14),r.crc32=t.readUInt32LE(16),r.compressedSize=t.readUInt32LE(20),r.uncompressedSize=t.readUInt32LE(24),r.fileNameLength=t.readUInt16LE(28),r.extraFieldLength=t.readUInt16LE(30),r.fileCommentLength=t.readUInt16LE(32),r.internalFileAttributes=t.readUInt16LE(36),r.externalFileAttributes=t.readUInt32LE(38),r.relativeOffsetOfLocalHeader=t.readUInt32LE(42),r.generalPurposeBitFlag&64)return u(e,Error(`strong encryption is not supported`));e.readEntryCursor+=46,t=T(r.fileNameLength+r.extraFieldLength+r.fileCommentLength),v(e.reader,t,0,t.length,e.readEntryCursor,function(n){if(n)return u(e,n);if(!e.emittedError){r.fileNameRaw=t.subarray(0,r.fileNameLength);var i=r.fileNameLength+r.extraFieldLength;r.extraFieldRaw=t.subarray(r.fileNameLength,i),r.fileCommentRaw=t.subarray(i,i+r.fileCommentLength);try{r.extraFields=_(r.extraFieldRaw)}catch(t){return u(e,t)}if(e.decodeStrings){var a=!!(r.generalPurposeBitFlag&2048);r.fileComment=C(r.fileCommentRaw,a),r.fileName=h(r.generalPurposeBitFlag,r.fileNameRaw,r.extraFields,e.strictFileNames);var o=g(r.fileName);if(o!=null)return u(e,Error(o))}else r.fileComment=r.fileCommentRaw,r.fileName=r.fileNameRaw;r.comment=r.fileComment,e.readEntryCursor+=t.length,e.entriesRead+=1;for(var s=0;s<r.extraFields.length;s++){var c=r.extraFields[s];if(c.id===1){var l=c.data,d=0;if(r.uncompressedSize===4294967295){if(d+8>l.length)return u(e,Error(`zip64 extended information extra field does not include uncompressed size`));r.uncompressedSize=w(l,d),d+=8}if(r.compressedSize===4294967295){if(d+8>l.length)return u(e,Error(`zip64 extended information extra field does not include compressed size`));r.compressedSize=w(l,d),d+=8}if(r.relativeOffsetOfLocalHeader===4294967295){if(d+8>l.length)return u(e,Error(`zip64 extended information extra field does not include relative header offset`));r.relativeOffsetOfLocalHeader=w(l,d),d+=8}break}}if(e.validateEntrySizes&&r.compressionMethod===0){var f=r.uncompressedSize;if(r.isEncrypted()&&(f+=12),r.compressedSize!==f){var p=`compressed/uncompressed size mismatch for stored file: `+r.compressedSize+` != `+r.uncompressedSize;return u(e,Error(p))}}e.emit(`entry`,r),e.lazyEntries||e._readEntry()}})}})}},l.prototype.eachEntry=function(){let e=this;if(!e.lazyEntries)throw Error(`eachEntry() requires lazyEntries: true`);if(e.hasEachEntryBeenCalled)throw Error(`eachEntry() must only be called once per ZipFile`);e.hasEachEntryBeenCalled=!0;let t=null;e.on(`entry`,r),e.on(`end`,i),e.on(`error`,a);function n(){e.removeListener(`entry`,r),e.removeListener(`end`,i),e.removeListener(`error`,a),e.autoClose&&e.close()}function r(e){let{resolve:n}=t;t=null,n({value:e})}function i(){let{resolve:e}=t;t=null,n(),e({done:!0})}function a(e){let{reject:r}=t;t=null,n(),r(e)}return{[Symbol.asyncIterator](){return this},next(){let n=new Promise((e,n)=>{if(t!=null)throw Error(`next() called before previous Promise was resolved.`);t={resolve:e,reject:n}});return e.readEntry(),n},return(e){return n(),Promise.resolve({done:!0,value:e})},throw(e){return n(),Promise.reject(e)}}},l.prototype.openReadStream=function(e,t,n){var r=this,i=0,a=e.compressedSize;if(n??(n=t,t=null),t==null)t={};else{if(t.decodeFileData===!1){if(t.decrypt!=null)throw Error(`cannot use options.decrypt when options.decodeFileData === false`);if(t.decompress!=null)throw Error(`cannot use options.decompress when options.decodeFileData === false`)}else{if(t.decrypt!=null){if(!e.isEncrypted())throw Error(`options.decrypt can only be specified for encrypted entries. See also option decodeFileData.`);if(t.decrypt!==!1)throw Error(`invalid options.decrypt value: `+t.decrypt);if(e.isCompressed()&&t.decompress!==!1)throw Error(`entry is encrypted and compressed, and options.decompress !== false. See also option decodeFileData.`)}if(t.decompress!=null){if(!e.isCompressed())throw Error(`options.decompress can only be specified for compressed entries. See also option decodeFileData.`);if(t.decompress!==!1&&t.decompress!==!0)throw Error(`invalid options.decompress value: `+t.decompress);s=t.decompress}}if(t.start!=null){if(i=t.start,i<0)throw Error(`options.start < 0`);if(i>e.compressedSize)throw Error(`options.start > entry.compressedSize`)}if(t.end!=null){if(a=t.end,a<0)throw Error(`options.end < 0`);if(a>e.compressedSize)throw Error(`options.end > entry.compressedSize`);if(a<i)throw Error(`options.end < options.start`)}}var o=t.decodeFileData===!1||(e.compressionMethod===0||e.compressionMethod===8&&t.decompress===!1)&&(!e.isEncrypted()||t.decrypt===!1);if((t.start!=null||t.end!=null)&&!o)throw Error(`start/end range require options.decodeFileData === false for non-trivial encoded entries.`);if(!r.isOpen)return n(Error(`closed`));if(e.isEncrypted()&&!o&&t.decrypt!==!1)return n(Error(`entry is encrypted, and options.decodeFileData !== false`));var s;if(o)s=!1;else if(e.compressionMethod===8)s=t.decodeFileData!==!0;else return n(Error(`unsupported compression method: `+e.compressionMethod));r.readLocalFileHeader(e,{minimal:!0},function(t,o){if(t)return n(t);r.openReadStreamLowLevel(o.fileDataStart,e.compressedSize,i,a,s,e.uncompressedSize,n)})},l.prototype.openReadStreamLowLevel=function(e,t,r,i,a,o,s){var c=this;e+t;var l=c.reader.createReadStream({start:e+r,end:e+i}),u=l;if(a){var d=!1,f=n.createInflateRaw();l.on(`error`,function(e){setImmediate(function(){d||f.emit(`error`,e)})}),l.pipe(f),c.validateEntrySizes?(u=new y(o),f.on(`error`,function(e){setImmediate(function(){d||u.emit(`error`,e)})}),f.pipe(u)):u=f,E(u,function(){d=!0,f!==u&&f.unpipe(u),l.unpipe(f),l.destroy()})}s(null,u)},l.prototype.readLocalFileHeader=function(e,t,n){var r=this;n??(n=t,t=null),t??={},r.reader.ref();var i=T(30);v(r.reader,i,0,i.length,e.relativeOffsetOfLocalHeader,function(a){try{if(a)return n(a);var o=i.readUInt32LE(0);if(o!==67324752)return n(Error(`invalid local file header signature: 0x`+o.toString(16)));var s=i.readUInt16LE(26),c=i.readUInt16LE(28),l=e.relativeOffsetOfLocalHeader+30+s+c;if(l+e.compressedSize>r.fileSize)return n(Error(`file data overflows file bounds: `+l+` + `+e.compressedSize+` > `+r.fileSize));if(t.minimal)return n(null,{fileDataStart:l});var u=new p;u.fileDataStart=l,u.versionNeededToExtract=i.readUInt16LE(4),u.generalPurposeBitFlag=i.readUInt16LE(6),u.compressionMethod=i.readUInt16LE(8),u.lastModFileTime=i.readUInt16LE(10),u.lastModFileDate=i.readUInt16LE(12),u.crc32=i.readUInt32LE(14),u.compressedSize=i.readUInt32LE(18),u.uncompressedSize=i.readUInt32LE(22),u.fileNameLength=s,u.extraFieldLength=c,i=T(s+c),r.reader.ref(),v(r.reader,i,0,i.length,e.relativeOffsetOfLocalHeader+30,function(e){try{return e?n(e):(u.fileName=i.subarray(0,s),u.extraField=i.subarray(s),n(null,u))}finally{r.reader.unref()}})}finally{r.reader.unref()}})},l.prototype.openReadStreamPromise=function(e,t){return new Promise((n,r)=>{this.openReadStream(e,t,function(e,t){if(e)return r(e);n(t)})})},l.prototype.openReadStreamLowLevelPromise=function(e,t,n,r,i,a){return new Promise((o,s)=>{this.openReadStream(e,t,n,r,i,a,function(e,t){if(e)return s(e);o(t)})})},l.prototype.readLocalFileHeaderPromise=function(e,t){return new Promise((n,r)=>{this.readLocalFileHeader(e,t,function(e,t){if(e)return r(e);n(t)})})};function f(){}f.prototype.getLastModDate=function(e){if(e??={},!e.forceDosFormat)for(var t=0;t<this.extraFields.length;t++){var n=this.extraFields[t];if(n.id===21589){var r=n.data;if(r.length<5||!(r[0]&1))continue;var i=r.readInt32LE(1);return new Date(i*1e3)}if(n.id===10){var r=n.data;if(r.length!==32||r.readUInt16LE(4)!==1||r.readUInt16LE(6)!==24)continue;var a=(r.readUInt32LE(8)+4294967296*r.readInt32LE(12))/1e4-0xa9730b66800;return new Date(a)}}return m(this.lastModFileDate,this.lastModFileTime,e.timezone)},f.prototype.canDecodeFileData=function(){return!this.isEncrypted()&&(this.compressionMethod===0||this.compressionMethod===8)},f.prototype.isEncrypted=function(){return!!(this.generalPurposeBitFlag&1)},f.prototype.isCompressed=function(){return this.compressionMethod===8};function p(){}function m(e,t,n){var r=e&31,i=(e>>5&15)-1,a=(e>>9&127)+1980,o=0,s=(t&31)*2,c=t>>5&63,l=t>>11&31;if(n==null||n===`local`)return new Date(a,i,r,l,c,s,o);if(n===`UTC`)return new Date(Date.UTC(a,i,r,l,c,s,o));throw Error(`unrecognized options.timezone: `+options.timezone)}function h(e,t,n,r){for(var i=null,a=0;a<n.length;a++){var o=n[a];if(o.id===28789){if(o.data.length<6||o.data.readUInt8(0)!==1)continue;var s=o.data.readUInt32LE(1);if(c(t)!==s)continue;i=C(o.data.subarray(5),!0);break}}return i??=C(t,!!(e&2048)),r||(i=i.replace(/\\/g,`/`)),i}function g(e){return e.indexOf(`\\`)===-1?/^[a-zA-Z]:/.test(e)||/^\//.test(e)?`absolute path: `+e:e.split(`/`).indexOf(`..`)===-1?null:`invalid relative path: `+e:`invalid characters in fileName: `+e}function _(e){for(var t=[],n=0;n<e.length-3;){var r=e.readUInt16LE(n+0),i=e.readUInt16LE(n+2),a=n+4,o=a+i;if(o>e.length)throw Error(`extra field length exceeds extra field buffer size`);var s=e.subarray(a,o);t.push({id:r,data:s}),n=o}return t}function v(e,t,n,r,i,a){if(r===0)return setImmediate(function(){a(null,T(0))});e.read(t,n,r,i,function(e,t){if(e)return a(e);if(t<r)return a(Error(`unexpected EOF`));a()})}r.inherits(y,a);function y(e){a.call(this),this.actualByteCount=0,this.expectedByteCount=e}y.prototype._transform=function(e,t,n){if(this.actualByteCount+=e.length,this.actualByteCount>this.expectedByteCount){var r=`too many bytes in the stream. expected `+this.expectedByteCount+`. got at least `+this.actualByteCount;return n(Error(r))}n(null,e)},y.prototype._flush=function(e){if(this.actualByteCount<this.expectedByteCount){var t=`not enough bytes in the stream. expected `+this.expectedByteCount+`. got only `+this.actualByteCount;return e(Error(t))}e()},r.inherits(b,i);function b(){i.call(this),this.refCount=0}b.prototype.ref=function(){this.refCount+=1},b.prototype.unref=function(){var e=this;if(--e.refCount,e.refCount>0)return;if(e.refCount<0)throw Error(`invalid unref`);e.close(t);function t(t){if(t)return e.emit(`error`,t);e.emit(`close`)}},b.prototype.createReadStream=function(e){e??={};var t=e.start,n=e.end;if(t===n){var r=new o;return setImmediate(function(){r.end()}),r}var i=this._readStreamForRange(t,n),a=!1,s=new x(this);i.on(`error`,function(e){setImmediate(function(){a||s.emit(`error`,e)})}),E(s,function(){i.unpipe(s),s.unref(),i.destroy()});var c=new y(n-t);return s.on(`error`,function(e){setImmediate(function(){a||c.emit(`error`,e)})}),E(c,function(){a=!0,s.unpipe(c),s.destroy()}),i.pipe(s).pipe(c)},b.prototype._readStreamForRange=function(e,t){throw Error(`not implemented`)},b.prototype.read=function(e,t,n,r,i){var a=this.createReadStream({start:r,end:r+n}),o=new s,c=0;o._write=function(n,r,i){n.copy(e,t+c,0,n.length),c+=n.length,i()},o.on(`finish`,i),a.on(`error`,function(e){i(e)}),a.pipe(o)},b.prototype.close=function(e){setImmediate(e)},r.inherits(x,o);function x(e){o.call(this),this.context=e,this.context.ref(),this.unreffedYet=!1}x.prototype._flush=function(e){this.unref(),e()},x.prototype.unref=function(e){this.unreffedYet||(this.unreffedYet=!0,this.context.unref())};var S=`\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\xA0`;function C(e,t){if(t)return e.toString(`utf8`);for(var n=``,r=0;r<e.length;r++)n+=S[e[r]];return n}function w(e,t){var n=e.readUInt32LE(t);return e.readUInt32LE(t+4)*4294967296+n}var T=typeof Buffer.allocUnsafe==`function`?function(e){return Buffer.allocUnsafe(e)}:function(e){return new Buffer(e)};function E(e,t){typeof e.destroy==`function`?e._destroy=function(e,n){t(),n?.(e)}:e.destroy=t}})),X4=i(((e,t)=>{function n(e){if(e.length===0)return;let t=Object.create(null),n=0;for(;n<e.length;++n){let t=e.charCodeAt(n);if(u[t]!==1){if(t!==47||n===0)return;break}}if(n===e.length)return;let i=e.slice(0,n).toLowerCase(),a=++n;for(;n<e.length;++n){let i=e.charCodeAt(n);if(u[i]!==1){if(n===a||r(e,n,t)===void 0)return;break}}if(n!==a)return{type:i,subtype:e.slice(a,n).toLowerCase(),params:t}}function r(e,t,n){for(;t<e.length;){for(;t<e.length;++t){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}if(t===e.length)break;if(e.charCodeAt(t++)!==59)return;for(;t<e.length;++t){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}if(t===e.length)return;let r,i=t;for(;t<e.length;++t){let n=e.charCodeAt(t);if(u[n]!==1){if(n!==61)return;break}}if(t===e.length||(r=e.slice(i,t),++t,t===e.length))return;let a=``,o;if(e.charCodeAt(t)===34){o=++t;let n=!1;for(;t<e.length;++t){let r=e.charCodeAt(t);if(r===92){n?(o=t,n=!1):(a+=e.slice(o,t),n=!0);continue}if(r===34){if(n){o=t,n=!1;continue}a+=e.slice(o,t);break}if(n&&=(o=t-1,!1),d[r]!==1)return}if(t===e.length)return;++t}else{for(o=t;t<e.length;++t){let n=e.charCodeAt(t);if(u[n]!==1){if(t===o)return;break}}a=e.slice(o,t)}r=r.toLowerCase(),n[r]===void 0&&(n[r]=a)}return n}function i(e,t){if(e.length===0)return;let n=Object.create(null),r=0;for(;r<e.length;++r){let i=e.charCodeAt(r);if(u[i]!==1){if(a(e,r,n,t)===void 0)return;break}}return{type:e.slice(0,r).toLowerCase(),params:n}}function a(e,t,n,r){for(;t<e.length;){for(;t<e.length;++t){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}if(t===e.length)break;if(e.charCodeAt(t++)!==59)return;for(;t<e.length;++t){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}if(t===e.length)return;let i,a=t;for(;t<e.length;++t){let n=e.charCodeAt(t);if(u[n]!==1){if(n===61)break;return}}if(t===e.length)return;let o=``,s,l;if(i=e.slice(a,t),i.charCodeAt(i.length-1)===42){let n=++t;for(;t<e.length;++t){let n=e.charCodeAt(t);if(f[n]!==1){if(n!==39)return;break}}if(t===e.length)return;for(l=e.slice(n,t),++t;t<e.length&&e.charCodeAt(t)!==39;++t);if(t===e.length||(++t,t===e.length))return;s=t;let r=0;for(;t<e.length;++t){let n=e.charCodeAt(t);if(p[n]!==1){if(n===37){let n,i;if(t+2<e.length&&(n=m[e.charCodeAt(t+1)])!==-1&&(i=m[e.charCodeAt(t+2)])!==-1){let a=(n<<4)+i;o+=e.slice(s,t),o+=String.fromCharCode(a),t+=2,s=t+1,a>=128?r=2:r===0&&(r=1);continue}return}break}}if(o+=e.slice(s,t),o=c(o,l,r),o===void 0)return}else{if(++t,t===e.length)return;if(e.charCodeAt(t)===34){s=++t;let n=!1;for(;t<e.length;++t){let r=e.charCodeAt(t);if(r===92){n?(s=t,n=!1):(o+=e.slice(s,t),n=!0);continue}if(r===34){if(n){s=t,n=!1;continue}o+=e.slice(s,t);break}if(n&&=(s=t-1,!1),d[r]!==1)return}if(t===e.length)return;++t}else{for(s=t;t<e.length;++t){let n=e.charCodeAt(t);if(u[n]!==1){if(t===s)return;break}}o=e.slice(s,t)}if(o=r(o,2),o===void 0)return}i=i.toLowerCase(),n[i]===void 0&&(n[i]=o)}return n}function o(e){let t;for(;;)switch(e){case`utf-8`:case`utf8`:return s.utf8;case`latin1`:case`ascii`:case`us-ascii`:case`iso-8859-1`:case`iso8859-1`:case`iso88591`:case`iso_8859-1`:case`windows-1252`:case`iso_8859-1:1987`:case`cp1252`:case`x-cp1252`:return s.latin1;case`utf16le`:case`utf-16le`:case`ucs2`:case`ucs-2`:return s.utf16le;case`base64`:return s.base64;default:if(t===void 0){t=!0,e=e.toLowerCase();continue}return s.other.bind(e)}}let s={utf8:(e,t)=>{if(e.length===0)return``;if(typeof e==`string`){if(t<2)return e;e=Buffer.from(e,`latin1`)}return e.utf8Slice(0,e.length)},latin1:(e,t)=>e.length===0?``:typeof e==`string`?e:e.latin1Slice(0,e.length),utf16le:(e,t)=>e.length===0?``:(typeof e==`string`&&(e=Buffer.from(e,`latin1`)),e.ucs2Slice(0,e.length)),base64:(e,t)=>e.length===0?``:(typeof e==`string`&&(e=Buffer.from(e,`latin1`)),e.base64Slice(0,e.length)),other:(t,n)=>{if(t.length===0)return``;typeof t==`string`&&(t=Buffer.from(t,`latin1`));try{return new TextDecoder(e).decode(t)}catch{}}};function c(e,t,n){let r=o(t);if(r)return r(e,n)}function l(e){if(typeof e!=`string`)return``;for(let t=e.length-1;t>=0;--t)switch(e.charCodeAt(t)){case 47:case 92:return e=e.slice(t+1),e===`..`||e===`.`?``:e}return e===`..`||e===`.`?``:e}let u=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],d=[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],f=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,1,0,1,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],p=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,1,0,0,0,0,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],m=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1];t.exports={basename:l,convertToUTF8:c,getDecoder:o,parseContentType:n,parseDisposition:i}})),STe=i(((e,t)=>{function n(e,t,n,r,i){for(let a=0;a<i;++a)if(e[t+a]!==n[r+a])return!1;return!0}var r=class{constructor(e,t){if(typeof t!=`function`)throw Error(`Missing match callback`);if(typeof e==`string`)e=Buffer.from(e);else if(!Buffer.isBuffer(e))throw Error(`Expected Buffer for needle, got ${typeof e}`);let n=e.length;if(this.maxMatches=1/0,this.matches=0,this._cb=t,this._lookbehindSize=0,this._needle=e,this._bufPos=0,this._lookbehind=Buffer.allocUnsafe(n),this._occ=[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],n>1)for(let t=0;t<n-1;++t)this._occ[e[t]]=n-1-t}reset(){this.matches=0,this._lookbehindSize=0,this._bufPos=0}push(e,t){let n;Buffer.isBuffer(e)||(e=Buffer.from(e,`latin1`));let r=e.length;for(this._bufPos=t||0;n!==r&&this.matches<this.maxMatches;)n=i(this,e);return n}destroy(){let e=this._lookbehindSize;e&&this._cb(!1,this._lookbehind,0,e,!1),this.reset()}};function i(e,t){let r=t.length,i=e._needle,o=i.length,s=-e._lookbehindSize,c=o-1,l=i[c],u=r-o,d=e._occ,f=e._lookbehind;if(s<0){for(;s<0&&s<=u;){let n=s+c,r=n<0?f[e._lookbehindSize+n]:t[n];if(r===l&&a(e,t,s,c))return e._lookbehindSize=0,++e.matches,s>-e._lookbehindSize?e._cb(!0,f,0,e._lookbehindSize+s,!1):e._cb(!0,void 0,0,0,!0),e._bufPos=s+o;s+=d[r]}for(;s<0&&!a(e,t,s,r-s);)++s;if(s<0){let n=e._lookbehindSize+s;return n>0&&e._cb(!1,f,0,n,!1),e._lookbehindSize-=n,f.copy(f,0,n,e._lookbehindSize),f.set(t,e._lookbehindSize),e._lookbehindSize+=r,e._bufPos=r,r}e._cb(!1,f,0,e._lookbehindSize,!1),e._lookbehindSize=0}s+=e._bufPos;let p=i[0];for(;s<=u;){let r=t[s+c];if(r===l&&t[s]===p&&n(i,0,t,s,c))return++e.matches,s>0?e._cb(!0,t,e._bufPos,s,!0):e._cb(!0,void 0,0,0,!0),e._bufPos=s+o;s+=d[r]}for(;s<r;){if(t[s]!==p||!n(t,s,i,0,r-s)){++s;continue}t.copy(f,0,s,r),e._lookbehindSize=r-s;break}return s>0&&e._cb(!1,t,e._bufPos,s<r?s:r,!0),e._bufPos=r,r}function a(e,t,n,r){let i=e._lookbehind,a=e._lookbehindSize,o=e._needle;for(let e=0;e<r;++e,++n)if((n<0?i[a+n]:t[n])!==o[e])return!1;return!0}t.exports=r})),CTe=i(((e,n)=>{let{Readable:r,Writable:i}=t(`stream`),a=STe(),{basename:o,convertToUTF8:s,getDecoder:c,parseContentType:l,parseDisposition:u}=X4(),d=Buffer.from(`\r
|
|
723
|
+
`),f=Buffer.from(`\r`),p=Buffer.from(`-`);function m(){}let h=16384;var g=class{constructor(e){this.header=Object.create(null),this.pairCount=0,this.byteCount=0,this.state=0,this.name=``,this.value=``,this.crlf=0,this.cb=e}reset(){this.header=Object.create(null),this.pairCount=0,this.byteCount=0,this.state=0,this.name=``,this.value=``,this.crlf=0}push(e,t,n){let r=t;for(;t<n;)switch(this.state){case 0:{let i=!1;for(;t<n;++t){if(this.byteCount===h)return-1;++this.byteCount;let n=e[t];if(w[n]!==1){if(n!==58||(this.name+=e.latin1Slice(r,t),this.name.length===0))return-1;++t,i=!0,this.state=1;break}}if(!i){this.name+=e.latin1Slice(r,t);break}}case 1:{let i=!1;for(;t<n;++t){if(this.byteCount===h)return-1;++this.byteCount;let n=e[t];if(n!==32&&n!==9){r=t,i=!0,this.state=2;break}}if(!i)break}case 2:switch(this.crlf){case 0:for(;t<n;++t){if(this.byteCount===h)return-1;++this.byteCount;let n=e[t];if(T[n]!==1){if(n!==13)return-1;++this.crlf;break}}this.value+=e.latin1Slice(r,t++);break;case 1:if(this.byteCount===h||(++this.byteCount,e[t++]!==10))return-1;++this.crlf;break;case 2:{if(this.byteCount===h)return-1;++this.byteCount;let n=e[t];n===32||n===9?(r=t,this.crlf=0):(++this.pairCount<2e3&&(this.name=this.name.toLowerCase(),this.header[this.name]===void 0?this.header[this.name]=[this.value]:this.header[this.name].push(this.value)),n===13?(++this.crlf,++t):(r=t,this.crlf=0,this.state=0,this.name=``,this.value=``));break}case 3:{if(this.byteCount===h||(++this.byteCount,e[t++]!==10))return-1;let n=this.header;return this.reset(),this.cb(n),t}}}return t}},_=class extends r{constructor(e,t){super(e),this.truncated=!1,this._readcb=null,this.once(`end`,()=>{if(this._read(),--t._fileEndsLeft===0&&t._finalcb){let e=t._finalcb;t._finalcb=null,process.nextTick(e)}})}_read(e){let t=this._readcb;t&&(this._readcb=null,t())}};let v={push:(e,t)=>{},destroy:()=>{}};function y(e,t){let n=e._writecb;e._writecb=null,t?e.destroy(t):n&&n()}function b(e,t){return e}var x=class extends i{constructor(e){let t={autoDestroy:!0,emitClose:!0,highWaterMark:typeof e.highWaterMark==`number`?e.highWaterMark:void 0};if(super(t),!e.conType.params||typeof e.conType.params.boundary!=`string`)throw Error(`Multipart: Boundary not found`);let n=e.conType.params.boundary,r=typeof e.defParamCharset==`string`&&e.defParamCharset?c(e.defParamCharset):b,i=e.defCharset||`utf8`,h=e.preservePath,y={autoDestroy:!0,emitClose:!0,highWaterMark:typeof e.fileHwm==`number`?e.fileHwm:void 0},x=e.limits,S=x&&typeof x.fieldSize==`number`?x.fieldSize:1048576,C=x&&typeof x.fileSize==`number`?x.fileSize:1/0,w=x&&typeof x.files==`number`?x.files:1/0,T=x&&typeof x.fields==`number`?x.fields:1/0,E=x&&typeof x.parts==`number`?x.parts:1/0,D=-1,O=0,ee=0,te=!1;this._fileEndsLeft=0,this._fileStream=void 0,this._complete=!1;let ne=0,re,ie=0,ae,oe,se,k,ce=!1,le=!1,ue=!1;this._hparser=null;let A=new g(e=>{this._hparser=null,te=!1,se=`text/plain`,ae=i,oe=`7bit`,k=void 0,ce=!1;let t;if(!e[`content-disposition`]){te=!0;return}let n=u(e[`content-disposition`][0],r);if(!n||n.type!==`form-data`){te=!0;return}if(n.params&&(n.params.name&&(k=n.params.name),n.params[`filename*`]?t=n.params[`filename*`]:n.params.filename&&(t=n.params.filename),t!==void 0&&!h&&(t=o(t))),e[`content-type`]){let t=l(e[`content-type`][0]);t&&(se=`${t.type}/${t.subtype}`,t.params&&typeof t.params.charset==`string`&&(ae=t.params.charset.toLowerCase()))}if(e[`content-transfer-encoding`]&&(oe=e[`content-transfer-encoding`][0].toLowerCase()),se===`application/octet-stream`||t!==void 0){if(ee===w){le||(le=!0,this.emit(`filesLimit`)),te=!0;return}if(++ee,this.listenerCount(`file`)===0){te=!0;return}ne=0,this._fileStream=new _(y,this),++this._fileEndsLeft,this.emit(`file`,k,this._fileStream,{filename:t,encoding:oe,mimeType:se})}else{if(O===T){ue||(ue=!0,this.emit(`fieldsLimit`)),te=!0;return}if(++O,this.listenerCount(`field`)===0){te=!0;return}re=[],ie=0}}),j=0,de=(e,t,n,r,i)=>{retrydata:for(;t;){if(this._hparser!==null){let e=this._hparser.push(t,n,r);if(e===-1){this._hparser=null,A.reset(),this.emit(`error`,Error(`Malformed part header`));break}n=e}if(n===r)break;if(j!==0){if(j===1){switch(t[n]){case 45:j=2,++n;break;case 13:j=3,++n;break;default:j=0}if(n===r)return}if(j===2){if(j=0,t[n]===45){this._complete=!0,this._bparser=v;return}let e=this._writecb;this._writecb=m,de(!1,p,0,1,!1),this._writecb=e}else if(j===3){if(j=0,t[n]===10){if(++n,D>=E||(this._hparser=A,n===r))break;continue retrydata}{let e=this._writecb;this._writecb=m,de(!1,f,0,1,!1),this._writecb=e}}}if(!te){if(this._fileStream){let e,a=Math.min(r-n,C-ne);i?e=t.slice(n,n+a):(e=Buffer.allocUnsafe(a),t.copy(e,0,n,n+a)),ne+=e.length,ne===C?(e.length>0&&this._fileStream.push(e),this._fileStream.emit(`limit`),this._fileStream.truncated=!0,te=!0):this._fileStream.push(e)||(this._writecb&&(this._fileStream._readcb=this._writecb),this._writecb=null)}else if(re!==void 0){let e,a=Math.min(r-n,S-ie);i?e=t.slice(n,n+a):(e=Buffer.allocUnsafe(a),t.copy(e,0,n,n+a)),ie+=a,re.push(e),ie===S&&(te=!0,ce=!0)}}break}if(e){if(j=1,this._fileStream)this._fileStream.push(null),this._fileStream=null;else if(re!==void 0){let e;switch(re.length){case 0:e=``;break;case 1:e=s(re[0],ae,0);break;default:e=s(Buffer.concat(re,ie),ae,0)}re=void 0,ie=0,this.emit(`field`,k,e,{nameTruncated:!1,valueTruncated:ce,encoding:oe,mimeType:se})}++D===E&&this.emit(`partsLimit`)}};this._bparser=new a(`\r\n--${n}`,de),this._writecb=null,this._finalcb=null,this.write(d)}static detect(e){return e.type===`multipart`&&e.subtype===`form-data`}_write(e,t,n){this._writecb=n,this._bparser.push(e,0),this._writecb&&y(this)}_destroy(e,t){this._hparser=null,this._bparser=v,e||=C(this);let n=this._fileStream;n&&(this._fileStream=null,n.destroy(e)),t(e)}_final(e){if(this._bparser.destroy(),!this._complete)return e(Error(`Unexpected end of form`));this._fileEndsLeft?this._finalcb=S.bind(null,this,e):S(this,e)}};function S(e,t,n){if(n)return t(n);n=C(e),t(n)}function C(e){if(e._hparser)return Error(`Malformed part header`);let t=e._fileStream;if(t&&(e._fileStream=null,t.destroy(Error(`Unexpected end of file`))),!e._complete)return Error(`Unexpected end of form`)}let w=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],T=[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];n.exports=x})),wTe=i(((e,n)=>{let{Writable:r}=t(`stream`),{getDecoder:i}=X4();var a=class extends r{constructor(e){let t={autoDestroy:!0,emitClose:!0,highWaterMark:typeof e.highWaterMark==`number`?e.highWaterMark:void 0};super(t);let n=e.defCharset||`utf8`;e.conType.params&&typeof e.conType.params.charset==`string`&&(n=e.conType.params.charset),this.charset=n;let r=e.limits;this.fieldSizeLimit=r&&typeof r.fieldSize==`number`?r.fieldSize:1048576,this.fieldsLimit=r&&typeof r.fields==`number`?r.fields:1/0,this.fieldNameSizeLimit=r&&typeof r.fieldNameSize==`number`?r.fieldNameSize:100,this._inKey=!0,this._keyTrunc=!1,this._valTrunc=!1,this._bytesKey=0,this._bytesVal=0,this._fields=0,this._key=``,this._val=``,this._byte=-2,this._lastPos=0,this._encode=0,this._decoder=i(n)}static detect(e){return e.type===`application`&&e.subtype===`x-www-form-urlencoded`}_write(e,t,n){if(this._fields>=this.fieldsLimit)return n();let r=0,i=e.length;if(this._lastPos=0,this._byte!==-2){if(r=o(this,e,r,i),r===-1)return n(Error(`Malformed urlencoded form`));if(r>=i)return n();this._inKey?++this._bytesKey:++this._bytesVal}main:for(;r<i;)if(this._inKey){for(r=s(this,e,r,i);r<i;){switch(e[r]){case 61:this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r)),this._lastPos=++r,this._key=this._decoder(this._key,this._encode),this._encode=0,this._inKey=!1;continue main;case 38:if(this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r)),this._lastPos=++r,this._key=this._decoder(this._key,this._encode),this._encode=0,this._bytesKey>0&&this.emit(`field`,this._key,``,{nameTruncated:this._keyTrunc,valueTruncated:!1,encoding:this.charset,mimeType:`text/plain`}),this._key=``,this._val=``,this._keyTrunc=!1,this._valTrunc=!1,this._bytesKey=0,this._bytesVal=0,++this._fields>=this.fieldsLimit)return this.emit(`fieldsLimit`),n();continue;case 43:this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r)),this._key+=` `,this._lastPos=r+1;break;case 37:if(this._encode===0&&(this._encode=1),this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r)),this._lastPos=r+1,this._byte=-1,r=o(this,e,r+1,i),r===-1)return n(Error(`Malformed urlencoded form`));if(r>=i)return n();++this._bytesKey,r=s(this,e,r,i);continue}++r,++this._bytesKey,r=s(this,e,r,i)}this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r))}else{for(r=c(this,e,r,i);r<i;){switch(e[r]){case 38:if(this._lastPos<r&&(this._val+=e.latin1Slice(this._lastPos,r)),this._lastPos=++r,this._inKey=!0,this._val=this._decoder(this._val,this._encode),this._encode=0,(this._bytesKey>0||this._bytesVal>0)&&this.emit(`field`,this._key,this._val,{nameTruncated:this._keyTrunc,valueTruncated:this._valTrunc,encoding:this.charset,mimeType:`text/plain`}),this._key=``,this._val=``,this._keyTrunc=!1,this._valTrunc=!1,this._bytesKey=0,this._bytesVal=0,++this._fields>=this.fieldsLimit)return this.emit(`fieldsLimit`),n();continue main;case 43:this._lastPos<r&&(this._val+=e.latin1Slice(this._lastPos,r)),this._val+=` `,this._lastPos=r+1;break;case 37:if(this._encode===0&&(this._encode=1),this._lastPos<r&&(this._val+=e.latin1Slice(this._lastPos,r)),this._lastPos=r+1,this._byte=-1,r=o(this,e,r+1,i),r===-1)return n(Error(`Malformed urlencoded form`));if(r>=i)return n();++this._bytesVal,r=c(this,e,r,i);continue}++r,++this._bytesVal,r=c(this,e,r,i)}this._lastPos<r&&(this._val+=e.latin1Slice(this._lastPos,r))}n()}_final(e){if(this._byte!==-2)return e(Error(`Malformed urlencoded form`));(!this._inKey||this._bytesKey>0||this._bytesVal>0)&&(this._inKey?this._key=this._decoder(this._key,this._encode):this._val=this._decoder(this._val,this._encode),this.emit(`field`,this._key,this._val,{nameTruncated:this._keyTrunc,valueTruncated:this._valTrunc,encoding:this.charset,mimeType:`text/plain`})),e()}};function o(e,t,n,r){if(n>=r)return r;if(e._byte===-1){let i=l[t[n++]];if(i===-1)return-1;if(i>=8&&(e._encode=2),n<r){let r=l[t[n++]];if(r===-1)return-1;e._inKey?e._key+=String.fromCharCode((i<<4)+r):e._val+=String.fromCharCode((i<<4)+r),e._byte=-2,e._lastPos=n}else e._byte=i}else{let r=l[t[n++]];if(r===-1)return-1;e._inKey?e._key+=String.fromCharCode((e._byte<<4)+r):e._val+=String.fromCharCode((e._byte<<4)+r),e._byte=-2,e._lastPos=n}return n}function s(e,t,n,r){if(e._bytesKey>e.fieldNameSizeLimit){for(e._keyTrunc||e._lastPos<n&&(e._key+=t.latin1Slice(e._lastPos,n-1)),e._keyTrunc=!0;n<r;++n){let r=t[n];if(r===61||r===38)break;++e._bytesKey}e._lastPos=n}return n}function c(e,t,n,r){if(e._bytesVal>e.fieldSizeLimit){for(e._valTrunc||e._lastPos<n&&(e._val+=t.latin1Slice(e._lastPos,n-1)),e._valTrunc=!0;n<r&&t[n]!==38;++n)++e._bytesVal;e._lastPos=n}return n}let l=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1];n.exports=a})),TTe=i(((e,t)=>{let{parseContentType:n}=X4();function r(e){let t=e.headers,r=n(t[`content-type`]);if(!r)throw Error(`Malformed content type`);for(let n of i){if(!n.detect(r))continue;let i={limits:e.limits,headers:t,conType:r,highWaterMark:void 0,fileHwm:void 0,defCharset:void 0,defParamCharset:void 0,preservePath:!1};return e.highWaterMark&&(i.highWaterMark=e.highWaterMark),e.fileHwm&&(i.fileHwm=e.fileHwm),i.defCharset=e.defCharset,i.defParamCharset=e.defParamCharset,i.preservePath=e.preservePath,new n(i)}throw Error(`Unsupported content type: ${t[`content-type`]}`)}let i=[CTe(),wTe()].filter(function(e){return typeof e.detect==`function`});t.exports=e=>{if((typeof e!=`object`||!e)&&(e={}),typeof e.headers!=`object`||e.headers===null||typeof e.headers[`content-type`]!=`string`)throw Error(`Missing Content-Type`);return r(e)}}));xTe(),TTe();function Z4(e,t=!1){let n=e.length,r=0,i=``,a=0,o=16,s=0,c=0,l=0,u=0,d=0;function f(t,n){let i=0,a=0;for(;i<t||!n;){let t=e.charCodeAt(r);if(t>=48&&t<=57)a=a*16+t-48;else if(t>=65&&t<=70)a=a*16+t-65+10;else if(t>=97&&t<=102)a=a*16+t-97+10;else break;r++,i++}return i<t&&(a=-1),a}function p(e){r=e,i=``,a=0,o=16,d=0}function m(){let t=r;if(e.charCodeAt(r)===48)r++;else for(r++;r<e.length&&e3(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46){if(r++,r<e.length&&e3(e.charCodeAt(r)))for(r++;r<e.length&&e3(e.charCodeAt(r));)r++;else return d=3,e.substring(t,r)}let n=r;if(r<e.length&&(e.charCodeAt(r)===69||e.charCodeAt(r)===101)){if(r++,(r<e.length&&e.charCodeAt(r)===43||e.charCodeAt(r)===45)&&r++,r<e.length&&e3(e.charCodeAt(r))){for(r++;r<e.length&&e3(e.charCodeAt(r));)r++;n=r}else d=3}return e.substring(t,n)}function h(){let t=``,i=r;for(;;){if(r>=n){t+=e.substring(i,r),d=2;break}let a=e.charCodeAt(r);if(a===34){t+=e.substring(i,r),r++;break}if(a===92){if(t+=e.substring(i,r),r++,r>=n){d=2;break}switch(e.charCodeAt(r++)){case 34:t+=`"`;break;case 92:t+=`\\`;break;case 47:t+=`/`;break;case 98:t+=`\b`;break;case 102:t+=`\f`;break;case 110:t+=`
|
|
722
724
|
`;break;case 114:t+=`\r`;break;case 116:t+=` `;break;case 117:let e=f(4,!0);e>=0?t+=String.fromCharCode(e):d=4;break;default:d=5}i=r;continue}if(a>=0&&a<=31){if($4(a)){t+=e.substring(i,r),d=2;break}d=6}r++}return t}function g(){if(i=``,d=0,a=r,c=s,u=l,r>=n)return a=n,o=17;let t=e.charCodeAt(r);if(Q4(t)){do r++,i+=String.fromCharCode(t),t=e.charCodeAt(r);while(Q4(t));return o=15}if($4(t))return r++,i+=String.fromCharCode(t),t===13&&e.charCodeAt(r)===10&&(r++,i+=`
|
|
723
|
-
`),s++,l=r,o=14;switch(t){case 123:return r++,o=1;case 125:return r++,o=2;case 91:return r++,o=3;case 93:return r++,o=4;case 58:return r++,o=6;case 44:return r++,o=5;case 34:return r++,i=h(),o=10;case 47:let c=r-1;if(e.charCodeAt(r+1)===47){for(r+=2;r<n&&!$4(e.charCodeAt(r));)r++;return i=e.substring(c,r),o=12}if(e.charCodeAt(r+1)===42){r+=2;let t=n-1,a=!1;for(;r<t;){let t=e.charCodeAt(r);if(t===42&&e.charCodeAt(r+1)===47){r+=2,a=!0;break}r++,$4(t)&&(t===13&&e.charCodeAt(r)===10&&r++,s++,l=r)}return a||(r++,d=1),i=e.substring(c,r),o=13}return i+=String.fromCharCode(t),r++,o=16;case 45:if(i+=String.fromCharCode(t),r++,r===n||!e3(e.charCodeAt(r)))return o=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=m(),o=11;default:for(;r<n&&_(t);)r++,t=e.charCodeAt(r);if(a!==r){switch(i=e.substring(a,r),i){case`true`:return o=8;case`false`:return o=9;case`null`:return o=7}return o=16}return i+=String.fromCharCode(t),r++,o=16}}function _(e){if(Q4(e)||$4(e))return!1;switch(e){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function v(){let e;do e=g();while(e>=12&&e<=15);return e}return{setPosition:p,getPosition:()=>r,scan:t?v:g,getToken:()=>o,getTokenValue:()=>i,getTokenOffset:()=>a,getTokenLength:()=>r-a,getTokenStartLine:()=>c,getTokenStartCharacter:()=>a-u,getTokenError:()=>d}}function Q4(e){return e===32||e===9}function $4(e){return e===10||e===13}function e3(e){return e>=48&&e<=57}var
|
|
725
|
+
`),s++,l=r,o=14;switch(t){case 123:return r++,o=1;case 125:return r++,o=2;case 91:return r++,o=3;case 93:return r++,o=4;case 58:return r++,o=6;case 44:return r++,o=5;case 34:return r++,i=h(),o=10;case 47:let c=r-1;if(e.charCodeAt(r+1)===47){for(r+=2;r<n&&!$4(e.charCodeAt(r));)r++;return i=e.substring(c,r),o=12}if(e.charCodeAt(r+1)===42){r+=2;let t=n-1,a=!1;for(;r<t;){let t=e.charCodeAt(r);if(t===42&&e.charCodeAt(r+1)===47){r+=2,a=!0;break}r++,$4(t)&&(t===13&&e.charCodeAt(r)===10&&r++,s++,l=r)}return a||(r++,d=1),i=e.substring(c,r),o=13}return i+=String.fromCharCode(t),r++,o=16;case 45:if(i+=String.fromCharCode(t),r++,r===n||!e3(e.charCodeAt(r)))return o=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=m(),o=11;default:for(;r<n&&_(t);)r++,t=e.charCodeAt(r);if(a!==r){switch(i=e.substring(a,r),i){case`true`:return o=8;case`false`:return o=9;case`null`:return o=7}return o=16}return i+=String.fromCharCode(t),r++,o=16}}function _(e){if(Q4(e)||$4(e))return!1;switch(e){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function v(){let e;do e=g();while(e>=12&&e<=15);return e}return{setPosition:p,getPosition:()=>r,scan:t?v:g,getToken:()=>o,getTokenValue:()=>i,getTokenOffset:()=>a,getTokenLength:()=>r-a,getTokenStartLine:()=>c,getTokenStartCharacter:()=>a-u,getTokenError:()=>d}}function Q4(e){return e===32||e===9}function $4(e){return e===10||e===13}function e3(e){return e>=48&&e<=57}var ETe;(function(e){e[e.lineFeed=10]=`lineFeed`,e[e.carriageReturn=13]=`carriageReturn`,e[e.space=32]=`space`,e[e._0=48]=`_0`,e[e._1=49]=`_1`,e[e._2=50]=`_2`,e[e._3=51]=`_3`,e[e._4=52]=`_4`,e[e._5=53]=`_5`,e[e._6=54]=`_6`,e[e._7=55]=`_7`,e[e._8=56]=`_8`,e[e._9=57]=`_9`,e[e.a=97]=`a`,e[e.b=98]=`b`,e[e.c=99]=`c`,e[e.d=100]=`d`,e[e.e=101]=`e`,e[e.f=102]=`f`,e[e.g=103]=`g`,e[e.h=104]=`h`,e[e.i=105]=`i`,e[e.j=106]=`j`,e[e.k=107]=`k`,e[e.l=108]=`l`,e[e.m=109]=`m`,e[e.n=110]=`n`,e[e.o=111]=`o`,e[e.p=112]=`p`,e[e.q=113]=`q`,e[e.r=114]=`r`,e[e.s=115]=`s`,e[e.t=116]=`t`,e[e.u=117]=`u`,e[e.v=118]=`v`,e[e.w=119]=`w`,e[e.x=120]=`x`,e[e.y=121]=`y`,e[e.z=122]=`z`,e[e.A=65]=`A`,e[e.B=66]=`B`,e[e.C=67]=`C`,e[e.D=68]=`D`,e[e.E=69]=`E`,e[e.F=70]=`F`,e[e.G=71]=`G`,e[e.H=72]=`H`,e[e.I=73]=`I`,e[e.J=74]=`J`,e[e.K=75]=`K`,e[e.L=76]=`L`,e[e.M=77]=`M`,e[e.N=78]=`N`,e[e.O=79]=`O`,e[e.P=80]=`P`,e[e.Q=81]=`Q`,e[e.R=82]=`R`,e[e.S=83]=`S`,e[e.T=84]=`T`,e[e.U=85]=`U`,e[e.V=86]=`V`,e[e.W=87]=`W`,e[e.X=88]=`X`,e[e.Y=89]=`Y`,e[e.Z=90]=`Z`,e[e.asterisk=42]=`asterisk`,e[e.backslash=92]=`backslash`,e[e.closeBrace=125]=`closeBrace`,e[e.closeBracket=93]=`closeBracket`,e[e.colon=58]=`colon`,e[e.comma=44]=`comma`,e[e.dot=46]=`dot`,e[e.doubleQuote=34]=`doubleQuote`,e[e.minus=45]=`minus`,e[e.openBrace=123]=`openBrace`,e[e.openBracket=91]=`openBracket`,e[e.plus=43]=`plus`,e[e.slash=47]=`slash`,e[e.formFeed=12]=`formFeed`,e[e.tab=9]=`tab`})(ETe||={});const t3=Array(20).fill(0).map((e,t)=>` `.repeat(t)),n3={" ":{"\n":Array(200).fill(0).map((e,t)=>`
|
|
724
726
|
`+` `.repeat(t)),"\r":Array(200).fill(0).map((e,t)=>`\r`+` `.repeat(t)),"\r\n":Array(200).fill(0).map((e,t)=>`\r
|
|
725
727
|
`+` `.repeat(t))}," ":{"\n":Array(200).fill(0).map((e,t)=>`
|
|
726
728
|
`+` `.repeat(t)),"\r":Array(200).fill(0).map((e,t)=>`\r`+` `.repeat(t)),"\r\n":Array(200).fill(0).map((e,t)=>`\r
|
|
727
|
-
`+` `.repeat(t))}},
|
|
729
|
+
`+` `.repeat(t))}},DTe=[`
|
|
728
730
|
`,`\r`,`\r
|
|
729
|
-
`];function
|
|
731
|
+
`];function OTe(e,t,n){let r,i,a,o,s;if(t){for(o=t.offset,s=o+t.length,a=o;a>0&&!i3(e,a-1);)a--;let c=s;for(;c<e.length&&!i3(e,c);)c++;i=e.substring(a,c),r=kTe(i,n)}else i=e,r=0,a=0,o=0,s=e.length;let c=ATe(n,e),l=DTe.includes(c),u=0,d=0,f;f=n.insertSpaces?t3[n.tabSize||4]??r3(t3[1],n.tabSize||4):` `;let p=f===` `?` `:` `,m=Z4(i,!1),h=!1;function g(){if(u>1)return r3(c,u)+r3(f,r+d);let e=f.length*(r+d);return!l||e>n3[p][c].length?c+r3(f,r+d):e<=0?c:n3[p][c][e]}function _(){let e=m.scan();for(u=0;e===15||e===14;)e===14&&n.keepLines?u+=1:e===14&&(u=1),e=m.scan();return h=e===16||m.getTokenError()!==0,e}let v=[];function y(n,r,i){!h&&(!t||r<s&&i>o)&&e.substring(r,i)!==n&&v.push({offset:r,length:i-r,content:n})}let b=_();if(n.keepLines&&u>0&&y(r3(c,u),0,0),b!==17){let e=m.getTokenOffset()+a;y(f.length*r<20&&n.insertSpaces?t3[f.length*r]:r3(f,r),a,e)}for(;b!==17;){let e=m.getTokenOffset()+m.getTokenLength()+a,t=_(),r=``,i=!1;for(;u===0&&(t===12||t===13);){let n=m.getTokenOffset()+a;y(t3[1],e,n),e=m.getTokenOffset()+m.getTokenLength()+a,i=t===12,r=i?g():``,t=_()}if(t===2)b!==1&&d--,n.keepLines&&u>0||!n.keepLines&&b!==1?r=g():n.keepLines&&(r=t3[1]);else if(t===4)b!==3&&d--,n.keepLines&&u>0||!n.keepLines&&b!==3?r=g():n.keepLines&&(r=t3[1]);else{switch(b){case 3:case 1:d++,r=n.keepLines&&u>0||!n.keepLines?g():t3[1];break;case 5:r=n.keepLines&&u>0||!n.keepLines?g():t3[1];break;case 12:r=g();break;case 13:u>0?r=g():i||(r=t3[1]);break;case 6:n.keepLines&&u>0?r=g():i||(r=t3[1]);break;case 10:n.keepLines&&u>0?r=g():t===6&&!i&&(r=``);break;case 7:case 8:case 9:case 11:case 2:case 4:n.keepLines&&u>0?r=g():(t===12||t===13)&&!i?r=t3[1]:t!==5&&t!==17&&(h=!0);break;case 16:h=!0}u>0&&(t===12||t===13)&&(r=g())}t===17&&(r=n.keepLines&&u>0?g():n.insertFinalNewline?c:``);let o=m.getTokenOffset()+a;y(r,e,o),b=t}return v}function r3(e,t){let n=``;for(let r=0;r<t;r++)n+=e;return n}function kTe(e,t){let n=0,r=0,i=t.tabSize||4;for(;n<e.length;){let t=e.charAt(n);if(t===t3[1])r++;else if(t===` `)r+=i;else break;n++}return Math.floor(r/i)}function ATe(e,t){for(let e=0;e<t.length;e++){let n=t.charAt(e);if(n===`\r`)return e+1<t.length&&t.charAt(e+1)===`
|
|
730
732
|
`?`\r
|
|
731
733
|
`:`\r`;if(n===`
|
|
732
734
|
`)return`
|
|
733
735
|
`}return e&&e.eol||`
|
|
734
736
|
`}function i3(e,t){return`\r
|
|
735
|
-
`.indexOf(e.charAt(t))!==-1}var a3;(function(e){e.DEFAULT={allowTrailingComma:!1}})(a3||={});function ATe(e,t=[],n=a3.DEFAULT){let r=null,i=[],a=[];function o(e){Array.isArray(i)?i.push(e):r!==null&&(i[r]=e)}return l3(e,{onObjectBegin:()=>{let e={};o(e),a.push(i),i=e,r=null},onObjectProperty:e=>{r=e},onObjectEnd:()=>{i=a.pop()},onArrayBegin:()=>{let e=[];o(e),a.push(i),i=e,r=null},onArrayEnd:()=>{i=a.pop()},onLiteralValue:o,onError:(e,n,r)=>{t.push({error:e,offset:n,length:r})}},n),i[0]}function o3(e,t=[],n=a3.DEFAULT){let r={type:`array`,offset:-1,length:-1,children:[],parent:void 0};function i(e){r.type===`property`&&(r.length=e-r.offset,r=r.parent)}function a(e){return r.children.push(e),e}l3(e,{onObjectBegin:e=>{r=a({type:`object`,offset:e,length:-1,parent:r,children:[]})},onObjectProperty:(e,t,n)=>{r=a({type:`property`,offset:t,length:-1,parent:r,children:[]}),r.children.push({type:`string`,value:e,offset:t,length:n,parent:r})},onObjectEnd:(e,t)=>{i(e+t),r.length=e+t-r.offset,r=r.parent,i(e+t)},onArrayBegin:(e,t)=>{r=a({type:`array`,offset:e,length:-1,parent:r,children:[]})},onArrayEnd:(e,t)=>{r.length=e+t-r.offset,r=r.parent,i(e+t)},onLiteralValue:(e,t,n)=>{a({type:jTe(e),offset:t,length:n,parent:r,value:e}),i(t+n)},onSeparator:(e,t,n)=>{r.type===`property`&&(e===`:`?r.colonOffset=t:e===`,`&&i(t))},onError:(e,n,r)=>{t.push({error:e,offset:n,length:r})}},n);let o=r.children[0];return o&&delete o.parent,o}function s3(e,t){if(!e)return;let n=e;for(let e of t)if(typeof e==`string`){if(n.type!==`object`||!Array.isArray(n.children))return;let t=!1;for(let r of n.children)if(Array.isArray(r.children)&&r.children[0].value===e&&r.children.length===2){n=r.children[1],t=!0;break}if(!t)return}else{let t=e;if(n.type!==`array`||t<0||!Array.isArray(n.children)||t>=n.children.length)return;n=n.children[t]}return n}function c3(e){switch(e.type){case`array`:return e.children.map(c3);case`object`:let t=Object.create(null);for(let n of e.children){let e=n.children[1];e&&(t[n.children[0].value]=c3(e))}return t;case`null`:case`string`:case`number`:case`boolean`:return e.value;default:return}}function l3(e,t,n=a3.DEFAULT){let r=Z4(e,!1),i=[],a=0;function o(e){return e?()=>a===0&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function s(e){return e?t=>a===0&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function c(e){return e?t=>a===0&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice()):()=>!0}function l(e){return e?()=>{a>0?a++:e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice())===!1&&(a=1)}:()=>!0}function u(e){return e?()=>{a>0&&a--,a===0&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}let d=l(t.onObjectBegin),f=c(t.onObjectProperty),p=u(t.onObjectEnd),m=l(t.onArrayBegin),h=u(t.onArrayEnd),g=c(t.onLiteralValue),_=s(t.onSeparator),v=o(t.onComment),y=s(t.onError),b=n&&n.disallowComments,x=n&&n.allowTrailingComma;function S(){for(;;){let e=r.scan();switch(r.getTokenError()){case 4:C(14);break;case 5:C(15);break;case 3:C(13);break;case 1:b||C(11);break;case 2:C(12);break;case 6:C(16)}switch(e){case 12:case 13:b?C(10):v();break;case 16:C(1);break;case 15:case 14:break;default:return e}}}function C(e,t=[],n=[]){if(y(e),t.length+n.length>0){let e=r.getToken();for(;e!==17;){if(t.indexOf(e)!==-1){S();break}if(n.indexOf(e)!==-1)break;e=S()}}}function w(e){let t=r.getTokenValue();return e?g(t):(f(t),i.push(t)),S(),!0}function T(){switch(r.getToken()){case 11:let e=r.getTokenValue(),t=Number(e);isNaN(t)&&(C(2),t=0),g(t);break;case 7:g(null);break;case 8:g(!0);break;case 9:g(!1);break;default:return!1}return S(),!0}function E(){return r.getToken()===10?(w(!1),r.getToken()===6?(_(`:`),S(),ee()||C(4,[],[2,5])):C(5,[],[2,5]),i.pop(),!0):(C(3,[],[2,5]),!1)}function D(){d(),S();let e=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(e||C(4,[],[]),_(`,`),S(),r.getToken()===2&&x)break}else e&&C(6,[],[]);E()||C(4,[],[2,5]),e=!0}return p(),r.getToken()===2?S():C(7,[2],[]),!0}function O(){m(),S();let e=!0,t=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(t||C(4,[],[]),_(`,`),S(),r.getToken()===4&&x)break}else t&&C(6,[],[]);e?(i.push(0),e=!1):i[i.length-1]++,ee()||C(4,[],[4,5]),t=!0}return h(),e||i.pop(),r.getToken()===4?S():C(8,[4],[]),!0}function ee(){switch(r.getToken()){case 3:return O();case 1:return D();case 10:return w(!0);default:return T()}}return S(),r.getToken()===17?n.allowEmptyContent?!0:(C(4,[],[]),!1):ee()?(r.getToken()!==17&&C(9,[],[]),!0):(C(4,[],[]),!1)}function jTe(e){switch(typeof e){case`boolean`:return`boolean`;case`number`:return`number`;case`string`:return`string`;case`object`:return e?Array.isArray(e)?`array`:`object`:`null`;default:return`null`}}function MTe(e,t,n,r){let i=t.slice(),a=o3(e,[]),o,s;for(;i.length>0&&(s=i.pop(),o=s3(a,i),o===void 0&&n!==void 0);)n=typeof s==`string`?{[s]:n}:[n];if(!o){if(n===void 0)throw Error(`Can not delete in empty document`);return u3(e,{offset:a?a.offset:0,length:a?a.length:0,content:JSON.stringify(n)},r)}if(o.type===`object`&&typeof s==`string`&&Array.isArray(o.children)){let t=s3(o,[s]);if(t!==void 0){if(n===void 0){if(!t.parent)throw Error(`Malformed AST`);let n=o.children.indexOf(t.parent),i,a=t.parent.offset+t.parent.length;if(n>0){let e=o.children[n-1];i=e.offset+e.length}else i=o.offset+1,o.children.length>1&&(a=o.children[1].offset);return u3(e,{offset:i,length:a-i,content:``},r)}return u3(e,{offset:t.offset,length:t.length,content:JSON.stringify(n)},r)}{if(n===void 0)return[];let t=`${JSON.stringify(s)}: ${JSON.stringify(n)}`,i=r.getInsertionIndex?r.getInsertionIndex(o.children.map(e=>e.children[0].value)):o.children.length,a;if(i>0){let e=o.children[i-1];a={offset:e.offset+e.length,length:0,content:`,`+t}}else a=o.children.length===0?{offset:o.offset+1,length:0,content:t}:{offset:o.offset+1,length:0,content:t+`,`};return u3(e,a,r)}}if(o.type===`array`&&typeof s==`number`&&Array.isArray(o.children)){let t=s;if(t===-1){let t=`${JSON.stringify(n)}`,i;if(o.children.length===0)i={offset:o.offset+1,length:0,content:t};else{let e=o.children[o.children.length-1];i={offset:e.offset+e.length,length:0,content:`,`+t}}return u3(e,i,r)}if(n===void 0&&o.children.length>=0){let t=s,n=o.children[t],i;if(o.children.length===1)i={offset:o.offset+1,length:o.length-2,content:``};else if(o.children.length-1===t){let e=o.children[t-1],n=e.offset+e.length;i={offset:n,length:o.offset+o.length-2-n,content:``}}else i={offset:n.offset,length:o.children[t+1].offset-n.offset,content:``};return u3(e,i,r)}if(n!==void 0){let t,i=`${JSON.stringify(n)}`;if(!r.isArrayInsertion&&o.children.length>s){let e=o.children[s];t={offset:e.offset,length:e.length,content:i}}else if(o.children.length===0||s===0)t={offset:o.offset+1,length:0,content:o.children.length===0?i:i+`,`};else{let e=s>o.children.length?o.children.length:s,n=o.children[e-1];t={offset:n.offset+n.length,length:0,content:`,`+i}}return u3(e,t,r)}throw Error(`Can not ${n===void 0?`remove`:r.isArrayInsertion?`insert`:`modify`} Array index ${t} as length is not sufficient`)}throw Error(`Can not add ${typeof s==`number`?`property`:`index`} to parent of type ${o.type}`)}function u3(e,t,n){if(!n.formattingOptions)return[t];let r=d3(e,t),i=t.offset,a=t.offset+t.content.length;if(t.length===0||t.content.length===0){for(;i>0&&!i3(r,i-1);)i--;for(;a<r.length&&!i3(r,a);)a++}let o=DTe(r,{offset:i,length:a-i},{...n.formattingOptions,keepLines:!1});for(let e=o.length-1;e>=0;e--){let t=o[e];r=d3(r,t),i=Math.min(i,t.offset),a=Math.max(a,t.offset+t.length),a+=t.content.length-t.length}let s=e.length-(r.length-a)-i;return[{offset:i,length:s,content:r.substring(i,a)}]}function d3(e,t){return e.substring(0,t.offset)+t.content+e.substring(t.offset+t.length)}var NTe;(function(e){e[e.None=0]=`None`,e[e.UnexpectedEndOfComment=1]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=2]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=3]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=4]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=5]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=6]=`InvalidCharacter`})(NTe||={});var PTe;(function(e){e[e.OpenBraceToken=1]=`OpenBraceToken`,e[e.CloseBraceToken=2]=`CloseBraceToken`,e[e.OpenBracketToken=3]=`OpenBracketToken`,e[e.CloseBracketToken=4]=`CloseBracketToken`,e[e.CommaToken=5]=`CommaToken`,e[e.ColonToken=6]=`ColonToken`,e[e.NullKeyword=7]=`NullKeyword`,e[e.TrueKeyword=8]=`TrueKeyword`,e[e.FalseKeyword=9]=`FalseKeyword`,e[e.StringLiteral=10]=`StringLiteral`,e[e.NumericLiteral=11]=`NumericLiteral`,e[e.LineCommentTrivia=12]=`LineCommentTrivia`,e[e.BlockCommentTrivia=13]=`BlockCommentTrivia`,e[e.LineBreakTrivia=14]=`LineBreakTrivia`,e[e.Trivia=15]=`Trivia`,e[e.Unknown=16]=`Unknown`,e[e.EOF=17]=`EOF`})(PTe||={});const FTe=ATe,ITe=o3,f3=c3;var LTe;(function(e){e[e.InvalidSymbol=1]=`InvalidSymbol`,e[e.InvalidNumberFormat=2]=`InvalidNumberFormat`,e[e.PropertyNameExpected=3]=`PropertyNameExpected`,e[e.ValueExpected=4]=`ValueExpected`,e[e.ColonExpected=5]=`ColonExpected`,e[e.CommaExpected=6]=`CommaExpected`,e[e.CloseBraceExpected=7]=`CloseBraceExpected`,e[e.CloseBracketExpected=8]=`CloseBracketExpected`,e[e.EndOfFileExpected=9]=`EndOfFileExpected`,e[e.InvalidCommentToken=10]=`InvalidCommentToken`,e[e.UnexpectedEndOfComment=11]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=12]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=13]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=14]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=15]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=16]=`InvalidCharacter`})(LTe||={});function p3(e,t,n,r){return MTe(e,t,n,r)}function m3(e,t){let n=t.slice(0).sort((e,t)=>{let n=e.offset-t.offset;return n===0?e.length-t.length:n}),r=e.length;for(let t=n.length-1;t>=0;t--){let i=n[t];if(i.offset+i.length<=r)e=d3(e,i);else throw Error(`Overlapping edit`);r=i.offset}return e}const RTe=global.Request;var h3=class extends RTe{constructor(e,t){if(typeof e==`object`&&C3 in e){let n=t!==void 0&&`body`in t&&t.body!=null;if(e[M3]&&!n)throw TypeError(`Cannot construct a Request with a Request object that has already been used.`);e=e[C3]()}t?.body?.getReader!==void 0&&(t.duplex??=`half`),super(e,t)}};const g3=e=>{let t=[],n=e.rawHeaders;for(let e=0,r=n.length;e<r;e+=2){let r=n[e];r.charCodeAt(0)!==58&&t.push([r,n[e+1]])}return new Headers(t)},zTe=Symbol(`wrapBodyStream`),BTe=new Set([`latin1`,`binary`,`hex`,`base64`,`base64url`]),VTe=e=>e===null||BTe.has(e),_3=Symbol(`bodyBufferedBeforeDisconnect`),v3=Symbol(`bodyBufferedLengthBeforeDisconnect`),y3=(e,t)=>Buffer.isBuffer(e)?e:Buffer.from(e,t??`utf8`),b3=e=>!(e instanceof Be)&&!!e.complete&&!!e.readableAborted&&typeof e.read==`function`&&VTe(e.readableEncoding),x3=(e,t)=>{if(e.readableDidRead&&!t||!b3(e))return;let n=e;if(n[_3]!==void 0)return n[_3];let r,i=e.errored;if(i&&i.code!==`ECONNRESET`)r=i;else if(n[v3]!==void 0&&e.readableLength!==n[v3])r=F3();else{let n=t??[],i=e.read();i!==null&&n.push(y3(i,e.readableEncoding));let a=n.length===1?n[0]:Buffer.concat(n);r=a;let o=e.headers[`content-length`];if(typeof o==`string`&&/^\d+$/.test(o)){let e=Number(o);Number.isSafeInteger(e)&&a.length!==e&&(r=F3())}}return n[_3]=r,r},S3=(e,t)=>{if(t instanceof Error){e.error(t);return}t.length>0&&e.enqueue(t),e.close()},HTe=(e,t,n,r,i)=>{let a={method:e,headers:n,signal:i.signal};if(e===`TRACE`){a.method=`GET`;let e=new h3(t,a);return Object.defineProperty(e,"method",{get(){return`TRACE`}}),e}if(e!==`GET`&&e!==`HEAD`){if(`rawBody`in r&&r.rawBody instanceof Buffer)a.body=new ReadableStream({start(e){e.enqueue(r.rawBody),e.close()}});else if(r[zTe]){let e;a.body=new ReadableStream({async pull(t){try{if(!e){let e=x3(r);if(e!==void 0){S3(t,e);return}}e||=Pe.toWeb(r).getReader();let{done:n,value:i}=await e.read();n?t.close():t.enqueue(i)}catch(e){t.error(e)}}})}else{let e=x3(r);a.body=e===void 0?Pe.toWeb(r):new ReadableStream({start(t){S3(t,e)}})}}return new h3(t,a)},C3=Symbol(`getRequestCache`),w3=Symbol(`requestCache`),T3=Symbol(`incomingKey`),E3=Symbol(`urlKey`),UTe=Symbol(`methodKey`),D3=Symbol(`headersKey`),O3=Symbol(`abortControllerKey`),k3=Symbol(`getAbortController`),WTe=Symbol(`abortRequest`),A3=Symbol(`bodyBuffer`),j3=Symbol(`bodyReadPromise`),M3=Symbol(`bodyConsumedDirectly`),N3=Symbol(`bodyLockReader`),P3=Symbol(`abortReason`),F3=()=>TypeError(`Body is unusable`),I3=()=>Promise.reject(F3()),GTe=new TextDecoder,KTe=e=>{if(e[M3])return I3();e[M3]=!0},qTe=e=>e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),JTe=e=>(e[D3]||=g3(e[T3])).get(`content-type`)||``,YTe=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,XTe=e=>{if(!YTe.test(e))return TypeError(`'${e}' is not a valid HTTP method.`);let t=e.toUpperCase();if(t===`CONNECT`||t===`TRACK`||t===`TRACE`&&e!==`TRACE`)return TypeError(`'${e}' HTTP method is unsupported.`)},L3=(e,t,n)=>{if(e[M3])return I3();let r=e.method;if(r===`GET`||r===`HEAD`)return e[C3]()[t]();let i=XTe(r);if(i)return Promise.reject(i);if(e[w3]&&r!==`TRACE`)return e[w3][t]();let a=KTe(e);if(a)return a;let o=ZTe(e);if(o){let t=Promise.resolve(n(o,e));return e[A3]=void 0,t}return QTe(e).then(t=>{let r=n(t,e);return e[A3]=void 0,r})},ZTe=e=>{let t=e[T3];if(`rawBody`in t&&t.rawBody instanceof Buffer)return t.rawBody},R3=(e,t)=>{if(t.errored)return t.errored;let n=e[P3];return n===void 0?Error(`Client connection prematurely closed.`):n instanceof Error?n:Error(String(n))},QTe=e=>{if(e[A3])return Promise.resolve(e[A3]);if(e[j3])return e[j3];let t=e[T3];if(t.readableDidRead)return I3();let n=x3(t);if(n!==void 0)return n instanceof Error?Promise.reject(n):(e[A3]=n,Promise.resolve(n));let r=new Promise((n,r)=>{let i=[],a=!1,o=e=>{a||(a=!0,f(),e())},s=a=>{let s=t.errored??a;return!b3(t)||s&&s.code!==`ECONNRESET`?!1:(o(()=>{let o=x3(t,i);o instanceof Error?r(o):o===void 0?r(a??R3(e,t)):(e[A3]=o,n(o))}),!0)},c=e=>{i.push(y3(e,t.readableEncoding))},l=()=>{o(()=>{let t=i.length===1?i[0]:Buffer.concat(i);e[A3]=t,n(t)})},u=e=>{s(e)||o(()=>{r(e)})},d=()=>{if(t.readableEnded){l();return}s()||o(()=>{r(R3(e,t))})},f=()=>{t.off(`data`,c),t.off(`end`,l),t.off(`error`,u),t.off(`close`,d),e[j3]=void 0};t.on(`data`,c),t.on(`end`,l),t.on(`error`,u),t.on(`close`,d),queueMicrotask(()=>{a||(t.readableEnded?l():t.errored?u(t.errored):t.destroyed&&d())})});return e[j3]=r,r},z3={get method(){return this[UTe]},get url(){return this[E3]},get headers(){return this[D3]||=g3(this[T3])},[WTe](e){this[P3]===void 0&&(this[P3]=e);let t=this[O3];t&&!t.signal.aborted&&t.abort(e)},[k3](){return this[O3]||=new AbortController,this[P3]!==void 0&&!this[O3].signal.aborted&&this[O3].abort(this[P3]),this[O3]},[C3](){let e=this[k3]();if(this[w3])return this[w3];let t=this.method;if(this[M3]&&t!==`GET`&&t!==`HEAD`){this[A3]=void 0;let n={method:t===`TRACE`?`GET`:t,headers:this.headers,signal:e.signal};t!==`TRACE`&&(n.body=new ReadableStream({start(e){e.close()}}),n.duplex=`half`);let r=new h3(this[E3],n);return t===`TRACE`&&Object.defineProperty(r,"method",{get(){return`TRACE`}}),this[w3]=r}return this[w3]=HTe(this.method,this[E3],this.headers,this[T3],e)},get body(){if(!this[M3])return this[C3]().body;let e=this[C3]();return!this[N3]&&e.body&&(this[N3]=e.body.getReader()),e.body},get bodyUsed(){return this[M3]?!0:this[w3]?this[w3].bodyUsed:!1}};Object.defineProperty(z3,"signal",{get(){return this[k3]().signal}}),[`cache`,`credentials`,`destination`,`integrity`,`mode`,`redirect`,`referrer`,`referrerPolicy`,`keepalive`].forEach(e=>{Object.defineProperty(z3,e,{get(){return this[C3]()[e]}})}),[`clone`,`formData`].forEach(e=>{Object.defineProperty(z3,e,{value:function(){if(this[M3]){if(e===`clone`)throw F3();return I3()}return this[C3]()[e]()}})}),Object.defineProperty(z3,"text",{value:function(){return L3(this,`text`,e=>GTe.decode(e))}}),Object.defineProperty(z3,"arrayBuffer",{value:function(){return L3(this,`arrayBuffer`,e=>qTe(e))}}),Object.defineProperty(z3,"blob",{value:function(){return L3(this,`blob`,(e,t)=>{let n=JTe(t);return new Response(e,n?{headers:{"content-type":n}}:void 0).blob()})}}),Object.defineProperty(z3,"json",{value:function(){return this[M3]?I3():this.text().then(JSON.parse)}}),Object.defineProperty(z3,Symbol.for(`nodejs.util.inspect.custom`),{value:function(e,t,n){return`Request (lightweight) ${n({method:this.method,url:this.url,headers:this.headers,nativeRequest:this[w3]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf(z3,h3.prototype);const B3=Symbol(`responseCache`),V3=Symbol(`getResponseCache`),H3=Symbol(`cache`),U3=global.Response;var W3=class e{#e;#t;[V3](){let e=this[H3],t=e&&e[2]instanceof Headers?e[2]:void 0;return delete this[H3],this[B3]||=new U3(this.#e,t?{status:this.#t?.status,statusText:this.#t?.statusText,headers:t}:this.#t)}constructor(t,n){let r;if(this.#e=t,n instanceof U3){let t=n[B3];if(t){this.#t=t,this[V3]();return}this.#t=n instanceof e?n.#t:n,r=new Headers(n.headers)}else this.#t=n;(t==null||typeof t==`string`||t?.getReader!==void 0||t instanceof Blob||t instanceof Uint8Array)&&(this[H3]=[n?.status||200,t??null,r||n?.headers])}get headers(){let e=this[H3];return e?(e[2]instanceof Headers||(e[2]=new Headers(e[2]||(e[1]===null?void 0:{"content-type":`text/plain; charset=UTF-8`}))),e[2]):this[V3]().headers}get status(){return this[H3]?.[0]??this[V3]().status}get ok(){let e=this.status;return e>=200&&e<300}};[`body`,`bodyUsed`,`redirected`,`statusText`,`trailers`,`type`,`url`].forEach(e=>{Object.defineProperty(W3.prototype,e,{get(){return this[V3]()[e]}})}),[`arrayBuffer`,`blob`,`clone`,`formData`,`json`,`text`].forEach(e=>{Object.defineProperty(W3.prototype,e,{value:function(){return this[V3]()[e]()}})}),Object.defineProperty(W3.prototype,Symbol.for(`nodejs.util.inspect.custom`),{value:function(e,t,n){return`Response (lightweight) ${n({status:this.status,headers:this.headers,ok:this.ok,nativeResponse:this[B3]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf(W3,U3),Object.setPrototypeOf(W3.prototype,U3.prototype);const $Te=/^https?:\/\/[!#-;=?-[\]_a-z~A-Z]+$/,eEe=e=>e instanceof URL?e.href:$Te.test(e)?e:new URL(e).href,tEe=new Set([301,302,303,307,308]);Object.defineProperty(W3,"redirect",{value:function(e,t=302){if(!tEe.has(t))throw RangeError(`Invalid status code`);return new W3(null,{status:t,headers:{location:eEe(e)}})},writable:!0,configurable:!0}),Object.defineProperty(W3,"json",{value:function(e,t){let n=JSON.stringify(e);if(n===void 0)throw TypeError(`The data is not JSON serializable`);let r=t?.headers,i;return r?(i=new Headers(r),i.has(`content-type`)||i.set(`content-type`,`application/json`)):i={"content-type":`application/json`},new W3(n,{status:t?.status??200,statusText:t?.statusText,headers:i})},writable:!0,configurable:!0}),globalThis.CloseEvent,globalThis.ErrorEvent,new Response(null,{headers:{"x-hono-already-sent":`true`}});function nEe(e,t){let n;try{n=E(e)}catch{return t.map(({editor:e,root:t})=>({host:e,root:t,state:`absent`}))}let r=e=>{let t=ye(n,e);if(!(t===``||t.startsWith(`..`)||ge(t)))return t.split(xe).join(`/`)};return t.map(({editor:t,root:i})=>{let a=N(e,i),o;try{o=_(a)}catch{return{host:t,root:i,state:`absent`}}let s;try{s=E(a)}catch{return{host:t,root:i,state:`absent`}}if(o.isSymbolicLink()){let e=r(s);return{host:t,root:i,state:`linked`,real:s,...e?{target:e}:{}}}if(s!==N(n,i)){let e=r(s);return{host:t,root:i,state:`linked-parent`,real:s,...e?{target:e}:{}}}return{host:t,root:i,state:`own`,real:s}})}i(((e,t)=>{(function(e){let n=`(0?\\d+|0x[a-f0-9]+)`,r={fourOctet:RegExp(`^${n}\\.${n}\\.${n}\\.${n}$`,`i`),threeOctet:RegExp(`^${n}\\.${n}\\.${n}$`,`i`),twoOctet:RegExp(`^${n}\\.${n}$`,`i`),longValue:RegExp(`^${n}$`,`i`)},i=RegExp(`^0[0-7]+$`,`i`),a=RegExp(`^0x[a-f0-9]+$`,`i`),o=`%[0-9a-z]{1,}`,s=`(?:[0-9a-f]+::?)+`,c={zoneIndex:RegExp(o,`i`),native:RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${o})?$`,`i`),deprecatedTransitional:RegExp(`^(?:::)(${n}\\.${n}\\.${n}\\.${n}(${o})?)$`,`i`),transitional:RegExp(`^((?:${s})|(?:::)(?:${s})?)${n}\\.${n}\\.${n}\\.${n}(${o})?$`,`i`)};function l(e,t){if(e.indexOf(`::`)!==e.lastIndexOf(`::`))return null;let n=0,r=-1,i=(e.match(c.zoneIndex)||[])[0],a,o;for(i&&(i=i.substring(1),e=e.replace(/%.+$/,``));(r=e.indexOf(`:`,r+1))>=0;)n++;if(e.substr(0,2)===`::`&&n--,e.substr(-2,2)===`::`&&n--,n>t)return null;for(o=t-n,a=`:`;o--;)a+=`0:`;return e=e.replace(`::`,a),e[0]===`:`&&(e=e.slice(1)),e[e.length-1]===`:`&&(e=e.slice(0,-1)),t=(function(){let t=e.split(`:`),n=[];for(let e=0;e<t.length;e++)n.push(parseInt(t[e],16));return n})(),{parts:t,zoneId:i}}function u(e,t,n,r){if(e.length!==t.length)throw Error(`ipaddr: cannot match CIDR for objects with different lengths`);let i=0,a;for(;r>0;){if(a=n-r,a<0&&(a=0),e[i]>>a!==t[i]>>a)return!1;r-=n,i+=1}return!0}function d(e){if(a.test(e))return parseInt(e,16);if(e[0]===`0`&&!isNaN(parseInt(e[1],10))){if(i.test(e))return parseInt(e,8);throw Error(`ipaddr: cannot parse ${e} as octal`)}return parseInt(e,10)}function f(e,t){for(;e.length<t;)e=`0${e}`;return e}let p={};p.IPv4=(function(){function e(e){if(e.length!==4)throw Error(`ipaddr: ipv4 octet count should be 4`);let t,n;for(t=0;t<e.length;t++)if(n=e[t],!(0<=n&&n<=255))throw Error(`ipaddr: ipv4 octet should fit in 8 bits`);this.octets=e}return e.prototype.SpecialRanges={unspecified:[[new e([0,0,0,0]),8]],broadcast:[[new e([255,255,255,255]),32]],multicast:[[new e([224,0,0,0]),4]],linkLocal:[[new e([169,254,0,0]),16]],loopback:[[new e([127,0,0,0]),8]],carrierGradeNat:[[new e([100,64,0,0]),10]],private:[[new e([10,0,0,0]),8],[new e([172,16,0,0]),12],[new e([192,168,0,0]),16]],reserved:[[new e([192,0,0,0]),24],[new e([192,0,2,0]),24],[new e([192,88,99,0]),24],[new e([198,18,0,0]),15],[new e([198,51,100,0]),24],[new e([203,0,113,0]),24],[new e([240,0,0,0]),4]],as112:[[new e([192,175,48,0]),24],[new e([192,31,196,0]),24]],amt:[[new e([192,52,193,0]),24]]},e.prototype.kind=function(){return`ipv4`},e.prototype.match=function(e,t){let n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv4`)throw Error(`ipaddr: cannot match ipv4 address with non-ipv4 one`);return u(this.octets,e.octets,8,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1,n={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},r,i,a;for(r=3;r>=0;--r)if(i=this.octets[r],i in n){if(a=n[i],t&&a!==0)return null;a!==8&&(t=!0),e+=a}else return null;return 32-e},e.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return p.IPv6.parse(`::ffff:${this.toString()}`)},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(`.`)},e})(),p.IPv4.broadcastAddressFromCIDR=function(e){try{let t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],a=0;for(;a<4;)i.push(parseInt(n[a],10)|parseInt(r[a],10)^255),a++;return new this(i)}catch{throw Error(`ipaddr: the address does not have IPv4 CIDR format`)}},p.IPv4.isIPv4=function(e){return this.parser(e)!==null},p.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch{return!1}},p.IPv4.isValidCIDR=function(e){try{return this.parseCIDR(e),!0}catch{return!1}},p.IPv4.isValidFourPartDecimal=function(e){return!!(p.IPv4.isValid(e)&&e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},p.IPv4.isValidCIDRFourPartDecimal=function(e){let t=e.match(/^(.+)\/(\d+)$/);return!p.IPv4.isValidCIDR(e)||!t?!1:p.IPv4.isValidFourPartDecimal(t[1])},p.IPv4.networkAddressFromCIDR=function(e){let t,n,r,i,a;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),a=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<4;)i.push(parseInt(r[n],10)&parseInt(a[n],10)),n++;return new this(i)}catch{throw Error(`ipaddr: the address does not have IPv4 CIDR format`)}},p.IPv4.parse=function(e){let t=this.parser(e);if(t===null)throw Error(`ipaddr: string is not formatted like an IPv4 Address`);return new this(t)},p.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){let e=parseInt(t[2]);if(e>=0&&e<=32){let n=[this.parse(t[1]),e];return Object.defineProperty(n,"toString",{value:function(){return this.join(`/`)}}),n}}throw Error(`ipaddr: string is not formatted like an IPv4 CIDR range`)},p.IPv4.parser=function(e){let t,n,i;if(t=e.match(r.fourOctet))return(function(){let e=t.slice(1,6),r=[];for(let t=0;t<e.length;t++)n=e[t],r.push(d(n));return r})();if(t=e.match(r.longValue)){if(i=d(t[1]),i>4294967295||i<0)throw Error(`ipaddr: address outside defined range`);return(function(){let e=[],t;for(t=0;t<=24;t+=8)e.push(i>>t&255);return e})().reverse()}return(t=e.match(r.twoOctet))?(function(){let e=t.slice(1,4),n=[];if(i=d(e[1]),i>16777215||i<0)throw Error(`ipaddr: address outside defined range`);return n.push(d(e[0])),n.push(i>>16&255),n.push(i>>8&255),n.push(i&255),n})():(t=e.match(r.threeOctet))?(function(){let e=t.slice(1,5),n=[];if(i=d(e[2]),i>65535||i<0)throw Error(`ipaddr: address outside defined range`);return n.push(d(e[0])),n.push(d(e[1])),n.push(i>>8&255),n.push(i&255),n})():null},p.IPv4.subnetMaskFromPrefixLength=function(e){if(e=parseInt(e),e<0||e>32)throw Error(`ipaddr: invalid IPv4 prefix length`);let t=[0,0,0,0],n=0,r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<4&&(t[r]=2**(e%8)-1<<8-e%8),new this(t)},p.IPv6=(function(){function e(e,t){let n,r;if(e.length===16)for(this.parts=[],n=0;n<=14;n+=2)this.parts.push(e[n]<<8|e[n+1]);else if(e.length===8)this.parts=e;else throw Error(`ipaddr: ipv6 part count should be 8 or 16`);for(n=0;n<this.parts.length;n++)if(r=this.parts[n],!(0<=r&&r<=65535))throw Error(`ipaddr: ipv6 part should fit in 16 bits`);t&&(this.zoneId=t)}return e.prototype.SpecialRanges={unspecified:[new e([0,0,0,0,0,0,0,0]),128],linkLocal:[new e([65152,0,0,0,0,0,0,0]),10],multicast:[new e([65280,0,0,0,0,0,0,0]),8],loopback:[new e([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new e([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new e([0,0,0,0,0,65535,0,0]),96],deprecatedSiteLocal:[new e([65216,0,0,0,0,0,0,0]),10],discard:[new e([256,0,0,0,0,0,0,0]),64],rfc6145:[new e([0,0,0,0,65535,0,0,0]),96],rfc6052:[[new e([100,65435,0,0,0,0,0,0]),96],[new e([100,65435,1,0,0,0,0,0]),48]],"6to4":[new e([8194,0,0,0,0,0,0,0]),16],teredo:[new e([8193,0,0,0,0,0,0,0]),32],benchmarking:[new e([8193,2,0,0,0,0,0,0]),48],amt:[new e([8193,3,0,0,0,0,0,0]),32],as112v6:[[new e([8193,4,274,0,0,0,0,0]),48],[new e([9760,79,32768,0,0,0,0,0]),48]],deprecatedOrchid:[new e([8193,16,0,0,0,0,0,0]),28],orchid2:[new e([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new e([8193,48,0,0,0,0,0,0]),28],segmentRouting:[new e([24320,0,0,0,0,0,0,0]),16],reserved:[[new e([8193,0,0,0,0,0,0,0]),23],[new e([8193,3512,0,0,0,0,0,0]),32],[new e([16383,0,0,0,0,0,0,0]),20]]},e.prototype.isIPv4MappedAddress=function(){return this.range()===`ipv4Mapped`},e.prototype.kind=function(){return`ipv6`},e.prototype.match=function(e,t){let n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv6`)throw Error(`ipaddr: cannot match ipv6 address with non-ipv6 one`);return u(this.parts,e.parts,16,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1,n={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},r,i;for(let a=7;a>=0;--a)if(r=this.parts[a],r in n){if(i=n[r],t&&i!==0)return null;i!==16&&(t=!0),e+=i}else return null;return 128-e},e.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let e,t=[],n=this.parts;for(let r=0;r<n.length;r++)e=n[r],t.push(e>>8),t.push(e&255);return t},e.prototype.toFixedLengthString=function(){let e=(function(){let e=[];for(let t=0;t<this.parts.length;t++)e.push(f(this.parts[t].toString(16),4));return e}).call(this).join(`:`),t=``;return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw Error(`ipaddr: trying to convert a generic ipv6 address to ipv4`);let e=this.parts.slice(-2),t=e[0],n=e[1];return new p.IPv4([t>>8,t&255,n>>8,n&255])},e.prototype.toNormalizedString=function(){let e=(function(){let e=[];for(let t=0;t<this.parts.length;t++)e.push(this.parts[t].toString(16));return e}).call(this).join(`:`),t=``;return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toRFC5952String=function(){let e=/((^|:)(0(:|$)){2,})/g,t=this.toNormalizedString(),n=0,r=-1,i;for(;i=e.exec(t);)i[0].length>r&&(n=i.index,r=i[0].length);return r<0?t:`${t.substring(0,n)}::${t.substring(n+r)}`},e.prototype.toString=function(){return this.toRFC5952String()},e})(),p.IPv6.broadcastAddressFromCIDR=function(e){try{let t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],a=0;for(;a<16;)i.push(parseInt(n[a],10)|parseInt(r[a],10)^255),a++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},p.IPv6.isIPv6=function(e){return this.parser(e)!==null},p.IPv6.isValid=function(e){if(typeof e==`string`&&e.indexOf(`:`)===-1)return!1;try{let t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch{return!1}},p.IPv6.isValidCIDR=function(e){if(typeof e==`string`&&e.indexOf(`:`)===-1)return!1;try{return this.parseCIDR(e),!0}catch{return!1}},p.IPv6.networkAddressFromCIDR=function(e){let t,n,r,i,a;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),a=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<16;)i.push(parseInt(r[n],10)&parseInt(a[n],10)),n++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},p.IPv6.parse=function(e){let t=this.parser(e);if(t.parts===null)throw Error(`ipaddr: string is not formatted like an IPv6 Address`);return new this(t.parts,t.zoneId)},p.IPv6.parseCIDR=function(e){let t,n,r;if((n=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(n[2]),t>=0&&t<=128))return r=[this.parse(n[1]),t],Object.defineProperty(r,"toString",{value:function(){return this.join(`/`)}}),r;throw Error(`ipaddr: string is not formatted like an IPv6 CIDR range`)},p.IPv6.parser=function(e){let t,n,r,i,a,o;if(r=e.match(c.deprecatedTransitional))return this.parser(`::ffff:${r[1]}`);if(c.native.test(e))return l(e,8);if((r=e.match(c.transitional))&&(o=r[6]||``,t=r[1],r[1].endsWith(`::`)||(t=t.slice(0,-1)),t=l(t+o,6),t.parts)){for(a=[parseInt(r[2]),parseInt(r[3]),parseInt(r[4]),parseInt(r[5])],n=0;n<a.length;n++)if(i=a[n],!(0<=i&&i<=255))return null;return t.parts.push(a[0]<<8|a[1]),t.parts.push(a[2]<<8|a[3]),{parts:t.parts,zoneId:t.zoneId}}return null},p.IPv6.subnetMaskFromPrefixLength=function(e){if(e=parseInt(e),e<0||e>128)throw Error(`ipaddr: invalid IPv6 prefix length`);let t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n=0,r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<16&&(t[r]=2**(e%8)-1<<8-e%8),new this(t)},p.fromByteArray=function(e){let t=e.length;if(t===4)return new p.IPv4(e);if(t===16)return new p.IPv6(e);throw Error(`ipaddr: the binary input is neither an IPv6 nor IPv4 address`)},p.isValid=function(e){return p.IPv6.isValid(e)||p.IPv4.isValid(e)},p.isValidCIDR=function(e){return p.IPv6.isValidCIDR(e)||p.IPv4.isValidCIDR(e)},p.parse=function(e){if(p.IPv6.isValid(e))return p.IPv6.parse(e);if(p.IPv4.isValid(e))return p.IPv4.parse(e);throw Error(`ipaddr: the address has neither IPv6 nor IPv4 format`)},p.parseCIDR=function(e){try{return p.IPv6.parseCIDR(e)}catch{try{return p.IPv4.parseCIDR(e)}catch{throw Error(`ipaddr: the address has neither IPv6 nor IPv4 CIDR format`)}}},p.process=function(e){let t=this.parse(e);return t.kind()===`ipv6`&&t.isIPv4MappedAddress()?t.toIPv4Address():t},p.subnetMatch=function(e,t,n){let r,i,a,o;for(i in n??=`unicast`,t)if(Object.prototype.hasOwnProperty.call(t,i)){for(a=t[i],a[0]&&!(a[0]instanceof Array)&&(a=[a]),r=0;r<a.length;r++)if(o=a[r],e.kind()===o[0].kind()&&e.match.apply(e,o))return i}return n},t!==void 0&&t.exports?t.exports=p:e.ipaddr=p})(e)}))();const rEe={"3g2":`video/3gpp2`,"3gp":`video/3gpp`,"3gpp":`video/3gpp`,"3mf":`model/3mf`,aac:`audio/aac`,ac:`application/pkix-attr-cert`,adp:`audio/adpcm`,adts:`audio/aac`,ai:`application/postscript`,aml:`application/automationml-aml+xml`,amlx:`application/automationml-amlx+zip`,amr:`audio/amr`,apng:`image/apng`,appcache:`text/cache-manifest`,appinstaller:`application/appinstaller`,appx:`application/appx`,appxbundle:`application/appxbundle`,asc:`application/pgp-keys`,atom:`application/atom+xml`,atomcat:`application/atomcat+xml`,atomdeleted:`application/atomdeleted+xml`,atomsvc:`application/atomsvc+xml`,au:`audio/basic`,avci:`image/avci`,avcs:`image/avcs`,avif:`image/avif`,aw:`application/applixware`,bdoc:`application/bdoc`,bin:`application/octet-stream`,bmp:`image/bmp`,bpk:`application/octet-stream`,btf:`image/prs.btif`,btif:`image/prs.btif`,buffer:`application/octet-stream`,ccxml:`application/ccxml+xml`,cdfx:`application/cdfx+xml`,cdmia:`application/cdmi-capability`,cdmic:`application/cdmi-container`,cdmid:`application/cdmi-domain`,cdmio:`application/cdmi-object`,cdmiq:`application/cdmi-queue`,cer:`application/pkix-cert`,cgm:`image/cgm`,cjs:`application/node`,class:`application/java-vm`,coffee:`text/coffeescript`,conf:`text/plain`,cpl:`application/cpl+xml`,cpt:`application/mac-compactpro`,crl:`application/pkix-crl`,css:`text/css`,csv:`text/csv`,cu:`application/cu-seeme`,cwl:`application/cwl`,cww:`application/prs.cww`,davmount:`application/davmount+xml`,dbk:`application/docbook+xml`,deb:`application/octet-stream`,def:`text/plain`,deploy:`application/octet-stream`,dib:`image/bmp`,"disposition-notification":`message/disposition-notification`,dist:`application/octet-stream`,distz:`application/octet-stream`,dll:`application/octet-stream`,dmg:`application/octet-stream`,dms:`application/octet-stream`,doc:`application/msword`,dot:`application/msword`,dpx:`image/dpx`,drle:`image/dicom-rle`,dsc:`text/prs.lines.tag`,dssc:`application/dssc+der`,dtd:`application/xml-dtd`,dump:`application/octet-stream`,dwd:`application/atsc-dwd+xml`,ear:`application/java-archive`,ecma:`application/ecmascript`,elc:`application/octet-stream`,emf:`image/emf`,eml:`message/rfc822`,emma:`application/emma+xml`,emotionml:`application/emotionml+xml`,eps:`application/postscript`,epub:`application/epub+zip`,exe:`application/octet-stream`,exi:`application/exi`,exp:`application/express`,exr:`image/aces`,ez:`application/andrew-inset`,fdf:`application/fdf`,fdt:`application/fdt+xml`,fits:`image/fits`,g3:`image/g3fax`,gbr:`application/rpki-ghostbusters`,geojson:`application/geo+json`,gif:`image/gif`,glb:`model/gltf-binary`,gltf:`model/gltf+json`,gml:`application/gml+xml`,gpx:`application/gpx+xml`,gram:`application/srgs`,grxml:`application/srgs+xml`,gxf:`application/gxf`,gz:`application/gzip`,h261:`video/h261`,h263:`video/h263`,h264:`video/h264`,heic:`image/heic`,heics:`image/heic-sequence`,heif:`image/heif`,heifs:`image/heif-sequence`,hej2:`image/hej2k`,held:`application/atsc-held+xml`,hjson:`application/hjson`,hlp:`application/winhlp`,hqx:`application/mac-binhex40`,hsj2:`image/hsj2`,htm:`text/html`,html:`text/html`,ics:`text/calendar`,ief:`image/ief`,ifb:`text/calendar`,iges:`model/iges`,igs:`model/iges`,img:`application/octet-stream`,in:`text/plain`,ini:`text/plain`,ink:`application/inkml+xml`,inkml:`application/inkml+xml`,ipfix:`application/ipfix`,iso:`application/octet-stream`,its:`application/its+xml`,jade:`text/jade`,jar:`application/java-archive`,jhc:`image/jphc`,jls:`image/jls`,jp2:`image/jp2`,jpe:`image/jpeg`,jpeg:`image/jpeg`,jpf:`image/jpx`,jpg:`image/jpeg`,jpg2:`image/jp2`,jpgm:`image/jpm`,jpgv:`video/jpeg`,jph:`image/jph`,jpm:`image/jpm`,jpx:`image/jpx`,js:`text/javascript`,json:`application/json`,json5:`application/json5`,jsonld:`application/ld+json`,jsonml:`application/jsonml+json`,jsx:`text/jsx`,jt:`model/jt`,jxl:`image/jxl`,jxr:`image/jxr`,jxra:`image/jxra`,jxrs:`image/jxrs`,jxs:`image/jxs`,jxsc:`image/jxsc`,jxsi:`image/jxsi`,jxss:`image/jxss`,kar:`audio/midi`,ktx:`image/ktx`,ktx2:`image/ktx2`,less:`text/less`,lgr:`application/lgr+xml`,list:`text/plain`,litcoffee:`text/coffeescript`,log:`text/plain`,lostxml:`application/lost+xml`,lrf:`application/octet-stream`,m1v:`video/mpeg`,m21:`application/mp21`,m2a:`audio/mpeg`,m2t:`video/mp2t`,m2ts:`video/mp2t`,m2v:`video/mpeg`,m3a:`audio/mpeg`,m4a:`audio/mp4`,m4p:`application/mp4`,m4s:`video/iso.segment`,ma:`application/mathematica`,mads:`application/mads+xml`,maei:`application/mmt-aei+xml`,man:`text/troff`,manifest:`text/cache-manifest`,map:`application/json`,mar:`application/octet-stream`,markdown:`text/markdown`,mathml:`application/mathml+xml`,mb:`application/mathematica`,mbox:`application/mbox`,md:`text/markdown`,mdx:`text/mdx`,me:`text/troff`,mesh:`model/mesh`,meta4:`application/metalink4+xml`,metalink:`application/metalink+xml`,mets:`application/mets+xml`,mft:`application/rpki-manifest`,mid:`audio/midi`,midi:`audio/midi`,mime:`message/rfc822`,mj2:`video/mj2`,mjp2:`video/mj2`,mjs:`text/javascript`,mml:`text/mathml`,mods:`application/mods+xml`,mov:`video/quicktime`,mp2:`audio/mpeg`,mp21:`application/mp21`,mp2a:`audio/mpeg`,mp3:`audio/mpeg`,mp4:`video/mp4`,mp4a:`audio/mp4`,mp4s:`application/mp4`,mp4v:`video/mp4`,mpd:`application/dash+xml`,mpe:`video/mpeg`,mpeg:`video/mpeg`,mpf:`application/media-policy-dataset+xml`,mpg:`video/mpeg`,mpg4:`video/mp4`,mpga:`audio/mpeg`,mpp:`application/dash-patch+xml`,mrc:`application/marc`,mrcx:`application/marcxml+xml`,ms:`text/troff`,mscml:`application/mediaservercontrol+xml`,msh:`model/mesh`,msi:`application/octet-stream`,msix:`application/msix`,msixbundle:`application/msixbundle`,msm:`application/octet-stream`,msp:`application/octet-stream`,mtl:`model/mtl`,mts:`video/mp2t`,musd:`application/mmt-usd+xml`,mxf:`application/mxf`,mxmf:`audio/mobile-xmf`,mxml:`application/xv+xml`,n3:`text/n3`,nb:`application/mathematica`,nq:`application/n-quads`,nt:`application/n-triples`,obj:`model/obj`,oda:`application/oda`,oga:`audio/ogg`,ogg:`audio/ogg`,ogv:`video/ogg`,ogx:`application/ogg`,omdoc:`application/omdoc+xml`,onepkg:`application/onenote`,onetmp:`application/onenote`,onetoc:`application/onenote`,onetoc2:`application/onenote`,opf:`application/oebps-package+xml`,opus:`audio/ogg`,otf:`font/otf`,owl:`application/rdf+xml`,oxps:`application/oxps`,p10:`application/pkcs10`,p7c:`application/pkcs7-mime`,p7m:`application/pkcs7-mime`,p7s:`application/pkcs7-signature`,p8:`application/pkcs8`,pdf:`application/pdf`,pfr:`application/font-tdpfr`,pgp:`application/pgp-encrypted`,pkg:`application/octet-stream`,pki:`application/pkixcmp`,pkipath:`application/pkix-pkipath`,pls:`application/pls+xml`,png:`image/png`,prc:`model/prc`,prf:`application/pics-rules`,provx:`application/provenance+xml`,ps:`application/postscript`,pskcxml:`application/pskc+xml`,pti:`image/prs.pti`,qt:`video/quicktime`,raml:`application/raml+yaml`,rapd:`application/route-apd+xml`,rdf:`application/rdf+xml`,relo:`application/p2p-overlay+xml`,rif:`application/reginfo+xml`,rl:`application/resource-lists+xml`,rld:`application/resource-lists-diff+xml`,rmi:`audio/midi`,rnc:`application/relax-ng-compact-syntax`,rng:`application/xml`,roa:`application/rpki-roa`,roff:`text/troff`,rq:`application/sparql-query`,rs:`application/rls-services+xml`,rsat:`application/atsc-rsat+xml`,rsd:`application/rsd+xml`,rsheet:`application/urc-ressheet+xml`,rss:`application/rss+xml`,rtf:`text/rtf`,rtx:`text/richtext`,rusd:`application/route-usd+xml`,s3m:`audio/s3m`,sbml:`application/sbml+xml`,scq:`application/scvp-cv-request`,scs:`application/scvp-cv-response`,sdp:`application/sdp`,senmlx:`application/senml+xml`,sensmlx:`application/sensml+xml`,ser:`application/java-serialized-object`,setpay:`application/set-payment-initiation`,setreg:`application/set-registration-initiation`,sgi:`image/sgi`,sgm:`text/sgml`,sgml:`text/sgml`,shex:`text/shex`,shf:`application/shf+xml`,shtml:`text/html`,sieve:`application/sieve`,sig:`application/pgp-signature`,sil:`audio/silk`,silo:`model/mesh`,siv:`application/sieve`,slim:`text/slim`,slm:`text/slim`,sls:`application/route-s-tsid+xml`,smi:`application/smil+xml`,smil:`application/smil+xml`,snd:`audio/basic`,so:`application/octet-stream`,spdx:`text/spdx`,spp:`application/scvp-vp-response`,spq:`application/scvp-vp-request`,spx:`audio/ogg`,sql:`application/sql`,sru:`application/sru+xml`,srx:`application/sparql-results+xml`,ssdl:`application/ssdl+xml`,ssml:`application/ssml+xml`,stk:`application/hyperstudio`,stl:`model/stl`,stpx:`model/step+xml`,stpxz:`model/step-xml+zip`,stpz:`model/step+zip`,styl:`text/stylus`,stylus:`text/stylus`,svg:`image/svg+xml`,svgz:`image/svg+xml`,swidtag:`application/swid+xml`,t:`text/troff`,t38:`image/t38`,td:`application/urc-targetdesc+xml`,tei:`application/tei+xml`,teicorpus:`application/tei+xml`,text:`text/plain`,tfi:`application/thraud+xml`,tfx:`image/tiff-fx`,tif:`image/tiff`,tiff:`image/tiff`,toml:`application/toml`,tr:`text/troff`,trig:`application/trig`,ts:`video/mp2t`,tsd:`application/timestamped-data`,tsv:`text/tab-separated-values`,ttc:`font/collection`,ttf:`font/ttf`,ttl:`text/turtle`,ttml:`application/ttml+xml`,txt:`text/plain`,u3d:`model/u3d`,u8dsn:`message/global-delivery-status`,u8hdr:`message/global-headers`,u8mdn:`message/global-disposition-notification`,u8msg:`message/global`,ubj:`application/ubjson`,uri:`text/uri-list`,uris:`text/uri-list`,urls:`text/uri-list`,vcard:`text/vcard`,vrml:`model/vrml`,vtt:`text/vtt`,vxml:`application/voicexml+xml`,war:`application/java-archive`,wasm:`application/wasm`,wav:`audio/wav`,weba:`audio/webm`,webm:`video/webm`,webmanifest:`application/manifest+json`,webp:`image/webp`,wgsl:`text/wgsl`,wgt:`application/widget`,wif:`application/watcherinfo+xml`,wmf:`image/wmf`,woff:`font/woff`,woff2:`font/woff2`,wrl:`model/vrml`,wsdl:`application/wsdl+xml`,wspolicy:`application/wspolicy+xml`,x3d:`model/x3d+xml`,x3db:`model/x3d+fastinfoset`,x3dbz:`model/x3d+binary`,x3dv:`model/x3d-vrml`,x3dvz:`model/x3d+vrml`,x3dz:`model/x3d+xml`,xaml:`application/xaml+xml`,xav:`application/xcap-att+xml`,xca:`application/xcap-caps+xml`,xcs:`application/calendar+xml`,xdf:`application/xcap-diff+xml`,xdssc:`application/dssc+xml`,xel:`application/xcap-el+xml`,xenc:`application/xenc+xml`,xer:`application/patch-ops-error+xml`,xfdf:`application/xfdf`,xht:`application/xhtml+xml`,xhtml:`application/xhtml+xml`,xhvml:`application/xv+xml`,xlf:`application/xliff+xml`,xm:`audio/xm`,xml:`text/xml`,xns:`application/xcap-ns+xml`,xop:`application/xop+xml`,xpl:`application/xproc+xml`,xsd:`application/xml`,xsf:`application/prs.xsf+xml`,xsl:`application/xml`,xslt:`application/xml`,xspf:`application/xspf+xml`,xvm:`application/xv+xml`,xvml:`application/xv+xml`,yaml:`text/yaml`,yang:`application/yang`,yin:`application/yin+xml`,yml:`text/yaml`,zip:`application/zip`},G3=Pi(e=>e!==null&&(typeof e==`object`||typeof e==`function`)),K3=V([F(),I().int()]),q3=F();si({ttl:I().optional(),pollInterval:I().optional()});const iEe=B({ttl:I().optional()}),aEe=B({taskId:F()}),J3=si({progressToken:K3.optional(),"io.modelcontextprotocol/related-task":aEe.optional()}),Y3=B({_meta:J3.optional()}),X3=Y3.extend({task:iEe.optional()}),Z3=B({method:F(),params:Y3.loose().optional()}),Q3=B({_meta:J3.optional()}),$3=B({method:F(),params:Q3.loose().optional()}),e6=si({_meta:J3.optional()}),t6=V([F(),I().int()]),oEe=B({jsonrpc:W(`2.0`),id:t6,...Z3.shape}).strict(),sEe=B({jsonrpc:W(`2.0`),...$3.shape}).strict(),n6=B({jsonrpc:W(`2.0`),id:t6,result:e6}).strict();var cEe;(function(e){e[e.ConnectionClosed=-32e3]=`ConnectionClosed`,e[e.RequestTimeout=-32001]=`RequestTimeout`,e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`})(cEe||={});const r6=B({jsonrpc:W(`2.0`),id:t6.optional(),error:B({code:I().int(),message:F(),data:R().optional()})}).strict();V([oEe,sEe,n6,r6]),V([n6,r6]);const i6=e6.strict(),lEe=Q3.extend({requestId:t6.optional(),reason:F().optional()}),a6=$3.extend({method:W(`notifications/cancelled`),params:lEe}),o6=B({icons:z(B({src:F(),mimeType:F().optional(),sizes:z(F()).optional(),theme:U([`light`,`dark`]).optional()})).optional()}),s6=B({name:F(),title:F().optional()}),c6=s6.extend({...s6.shape,...o6.shape,version:F(),websiteUrl:F().optional(),description:F().optional()}),uEe=Fi(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,fi(B({form:fi(B({applyDefaults:L().optional()}),H(F(),R())).optional(),url:G3.optional()}),H(F(),R()).optional())),dEe=si({list:G3.optional(),cancel:G3.optional(),requests:si({sampling:si({createMessage:G3.optional()}).optional(),elicitation:si({create:G3.optional()}).optional()}).optional()}),fEe=si({list:G3.optional(),cancel:G3.optional(),requests:si({tools:si({call:G3.optional()}).optional()}).optional()}),pEe=B({experimental:H(F(),G3).optional(),sampling:B({context:G3.optional(),tools:G3.optional()}).optional(),elicitation:uEe.optional(),roots:B({listChanged:L().optional()}).optional(),tasks:dEe.optional(),extensions:H(F(),G3).optional()}),mEe=Y3.extend({protocolVersion:F(),capabilities:pEe,clientInfo:c6}),hEe=Z3.extend({method:W(`initialize`),params:mEe}),gEe=B({experimental:H(F(),G3).optional(),logging:G3.optional(),completions:G3.optional(),prompts:B({listChanged:L().optional()}).optional(),resources:B({subscribe:L().optional(),listChanged:L().optional()}).optional(),tools:B({listChanged:L().optional()}).optional(),tasks:fEe.optional(),extensions:H(F(),G3).optional()}),_Ee=e6.extend({protocolVersion:F(),capabilities:gEe,serverInfo:c6,instructions:F().optional()}),vEe=$3.extend({method:W(`notifications/initialized`),params:Q3.optional()}),l6=Z3.extend({method:W(`ping`),params:Y3.optional()}),yEe=B({progress:I(),total:Si(I()),message:Si(F())}),bEe=B({...Q3.shape,...yEe.shape,progressToken:K3}),u6=$3.extend({method:W(`notifications/progress`),params:bEe}),xEe=Y3.extend({cursor:q3.optional()}),d6=Z3.extend({params:xEe.optional()}),f6=e6.extend({nextCursor:q3.optional()}),SEe=U([`working`,`input_required`,`completed`,`failed`,`cancelled`]),p6=B({taskId:F(),status:SEe,ttl:V([I(),ni()]),createdAt:F(),lastUpdatedAt:F(),pollInterval:Si(I()),statusMessage:Si(F())}),m6=e6.extend({task:p6}),CEe=Q3.merge(p6),h6=$3.extend({method:W(`notifications/tasks/status`),params:CEe}),g6=Z3.extend({method:W(`tasks/get`),params:Y3.extend({taskId:F()})}),_6=e6.merge(p6),v6=Z3.extend({method:W(`tasks/result`),params:Y3.extend({taskId:F()})});e6.loose();const y6=d6.extend({method:W(`tasks/list`)}),b6=f6.extend({tasks:z(p6)}),x6=Z3.extend({method:W(`tasks/cancel`),params:Y3.extend({taskId:F()})});e6.merge(p6);const S6=B({uri:F(),mimeType:Si(F()),_meta:H(F(),R()).optional()}),C6=S6.extend({text:F()}),w6=F().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),T6=S6.extend({blob:w6}),E6=U([`user`,`assistant`]),D6=B({audience:z(E6).optional(),priority:I().min(0).max(1).optional(),lastModified:Fr({offset:!0}).optional()}),O6=B({...s6.shape,...o6.shape,uri:F(),description:Si(F()),mimeType:Si(F()),size:Si(I()),annotations:D6.optional(),_meta:Si(si({}))}),wEe=B({...s6.shape,...o6.shape,uriTemplate:F(),description:Si(F()),mimeType:Si(F()),annotations:D6.optional(),_meta:Si(si({}))}),TEe=d6.extend({method:W(`resources/list`)}),EEe=f6.extend({resources:z(O6)}),DEe=d6.extend({method:W(`resources/templates/list`)}),OEe=f6.extend({resourceTemplates:z(wEe)}),k6=Y3.extend({uri:F()}),kEe=k6,AEe=Z3.extend({method:W(`resources/read`),params:kEe}),jEe=e6.extend({contents:z(V([C6,T6]))}),MEe=$3.extend({method:W(`notifications/resources/list_changed`),params:Q3.optional()}),NEe=k6,PEe=Z3.extend({method:W(`resources/subscribe`),params:NEe}),FEe=k6,IEe=Z3.extend({method:W(`resources/unsubscribe`),params:FEe}),LEe=Q3.extend({uri:F()}),REe=$3.extend({method:W(`notifications/resources/updated`),params:LEe}),zEe=B({name:F(),description:Si(F()),required:Si(L())}),BEe=B({...s6.shape,...o6.shape,description:Si(F()),arguments:Si(z(zEe)),_meta:Si(si({}))}),VEe=d6.extend({method:W(`prompts/list`)}),HEe=f6.extend({prompts:z(BEe)}),UEe=Y3.extend({name:F(),arguments:H(F(),F()).optional()}),WEe=Z3.extend({method:W(`prompts/get`),params:UEe}),A6=B({type:W(`text`),text:F(),annotations:D6.optional(),_meta:H(F(),R()).optional()}),j6=B({type:W(`image`),data:w6,mimeType:F(),annotations:D6.optional(),_meta:H(F(),R()).optional()}),M6=B({type:W(`audio`),data:w6,mimeType:F(),annotations:D6.optional(),_meta:H(F(),R()).optional()}),GEe=B({type:W(`tool_use`),name:F(),id:F(),input:H(F(),R()),_meta:H(F(),R()).optional()}),KEe=B({type:W(`resource`),resource:V([C6,T6]),annotations:D6.optional(),_meta:H(F(),R()).optional()}),N6=V([A6,j6,M6,O6.extend({type:W(`resource_link`)}),KEe]),qEe=B({role:E6,content:N6}),JEe=e6.extend({description:F().optional(),messages:z(qEe)}),YEe=$3.extend({method:W(`notifications/prompts/list_changed`),params:Q3.optional()}),XEe=B({title:F().optional(),readOnlyHint:L().optional(),destructiveHint:L().optional(),idempotentHint:L().optional(),openWorldHint:L().optional()}),ZEe=B({taskSupport:U([`required`,`optional`,`forbidden`]).optional()}),P6=B({...s6.shape,...o6.shape,description:F().optional(),inputSchema:B({type:W(`object`),properties:H(F(),G3).optional(),required:z(F()).optional()}).catchall(R()),outputSchema:B({type:W(`object`),properties:H(F(),G3).optional(),required:z(F()).optional()}).catchall(R()).optional(),annotations:XEe.optional(),execution:ZEe.optional(),_meta:H(F(),R()).optional()}),QEe=d6.extend({method:W(`tools/list`)}),$Ee=f6.extend({tools:z(P6)}),F6=e6.extend({content:z(N6).default([]),structuredContent:H(F(),R()).optional(),isError:L().optional()});F6.or(e6.extend({toolResult:R()}));const eDe=X3.extend({name:F(),arguments:H(F(),R()).optional()}),tDe=Z3.extend({method:W(`tools/call`),params:eDe}),nDe=$3.extend({method:W(`notifications/tools/list_changed`),params:Q3.optional()});B({autoRefresh:L().default(!0),debounceMs:I().int().nonnegative().default(300)});const I6=U([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),rDe=Y3.extend({level:I6}),iDe=Z3.extend({method:W(`logging/setLevel`),params:rDe}),aDe=Q3.extend({level:I6,logger:F().optional(),data:R()}),oDe=$3.extend({method:W(`notifications/message`),params:aDe}),sDe=B({hints:z(B({name:F().optional()})).optional(),costPriority:I().min(0).max(1).optional(),speedPriority:I().min(0).max(1).optional(),intelligencePriority:I().min(0).max(1).optional()}),cDe=B({mode:U([`auto`,`required`,`none`]).optional()}),lDe=B({type:W(`tool_result`),toolUseId:F().describe(`The unique identifier for the corresponding tool call.`),content:z(N6).default([]),structuredContent:B({}).loose().optional(),isError:L().optional(),_meta:H(F(),R()).optional()}),uDe=ui(`type`,[A6,j6,M6]),L6=ui(`type`,[A6,j6,M6,GEe,lDe]),dDe=B({role:E6,content:V([L6,z(L6)]),_meta:H(F(),R()).optional()}),fDe=X3.extend({messages:z(dDe),modelPreferences:sDe.optional(),systemPrompt:F().optional(),includeContext:U([`none`,`thisServer`,`allServers`]).optional(),temperature:I().optional(),maxTokens:I().int(),stopSequences:z(F()).optional(),metadata:G3.optional(),tools:z(P6).optional(),toolChoice:cDe.optional()}),pDe=Z3.extend({method:W(`sampling/createMessage`),params:fDe}),mDe=e6.extend({model:F(),stopReason:Si(U([`endTurn`,`stopSequence`,`maxTokens`]).or(F())),role:E6,content:uDe}),hDe=e6.extend({model:F(),stopReason:Si(U([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(F())),role:E6,content:V([L6,z(L6)])}),gDe=B({type:W(`boolean`),title:F().optional(),description:F().optional(),default:L().optional()}),_De=B({type:W(`string`),title:F().optional(),description:F().optional(),minLength:I().optional(),maxLength:I().optional(),format:U([`email`,`uri`,`date`,`date-time`]).optional(),default:F().optional()}),vDe=B({type:U([`number`,`integer`]),title:F().optional(),description:F().optional(),minimum:I().optional(),maximum:I().optional(),default:I().optional()}),yDe=B({type:W(`string`),title:F().optional(),description:F().optional(),enum:z(F()),default:F().optional()}),bDe=B({type:W(`string`),title:F().optional(),description:F().optional(),oneOf:z(B({const:F(),title:F()})),default:F().optional()}),xDe=V([V([B({type:W(`string`),title:F().optional(),description:F().optional(),enum:z(F()),enumNames:z(F()).optional(),default:F().optional()}),V([yDe,bDe]),V([B({type:W(`array`),title:F().optional(),description:F().optional(),minItems:I().optional(),maxItems:I().optional(),items:B({type:W(`string`),enum:z(F())}),default:z(F()).optional()}),B({type:W(`array`),title:F().optional(),description:F().optional(),minItems:I().optional(),maxItems:I().optional(),items:B({anyOf:z(B({const:F(),title:F()}))}),default:z(F()).optional()})])]),gDe,_De,vDe]),SDe=V([X3.extend({mode:W(`form`).optional(),message:F(),requestedSchema:B({type:W(`object`),properties:H(F(),xDe),required:z(F()).optional()})}),X3.extend({mode:W(`url`),message:F(),elicitationId:F(),url:F().url()})]),CDe=Z3.extend({method:W(`elicitation/create`),params:SDe}),wDe=Q3.extend({elicitationId:F()}),TDe=$3.extend({method:W(`notifications/elicitation/complete`),params:wDe}),EDe=e6.extend({action:U([`accept`,`decline`,`cancel`]),content:Fi(e=>e===null?void 0:e,H(F(),V([F(),I(),L(),z(F())])).optional())}),DDe=B({type:W(`ref/resource`),uri:F()}),ODe=B({type:W(`ref/prompt`),name:F()}),kDe=Y3.extend({ref:V([ODe,DDe]),argument:B({name:F(),value:F()}),context:B({arguments:H(F(),F()).optional()}).optional()}),ADe=Z3.extend({method:W(`completion/complete`),params:kDe}),jDe=e6.extend({completion:si({values:z(F()).max(100),total:Si(I().int()),hasMore:Si(L())})}),MDe=B({uri:F().startsWith(`file://`),name:F().optional(),_meta:H(F(),R()).optional()}),NDe=Z3.extend({method:W(`roots/list`),params:Y3.optional()}),PDe=e6.extend({roots:z(MDe)}),FDe=$3.extend({method:W(`notifications/roots/list_changed`),params:Q3.optional()});V([l6,hEe,ADe,iDe,WEe,VEe,TEe,DEe,AEe,PEe,IEe,tDe,QEe,g6,v6,y6,x6]),V([a6,u6,vEe,FDe,h6]),V([i6,mDe,hDe,EDe,PDe,_6,b6,m6]),V([l6,pDe,CDe,NDe,g6,v6,y6,x6]),V([a6,u6,oDe,REe,MEe,nDe,YEe,h6,TDe]),V([i6,_Ee,jDe,JEe,HEe,EEe,OEe,jEe,F6,$Ee,_6,b6,m6]);var IDe;(function(e){e.Completable=`McpCompletable`})(IDe||={});var LDe=global.Request,R6=class extends LDe{constructor(e,t){typeof e==`object`&&z6 in e&&(e=e[z6]()),t?.body?.getReader!==void 0&&(t.duplex??=`half`),super(e,t)}},RDe=e=>{let t=[],n=e.rawHeaders;for(let e=0;e<n.length;e+=2){let{[e]:r,[e+1]:i}=n;r.charCodeAt(0)!==58&&t.push([r,i])}return new Headers(t)},zDe=Symbol(`wrapBodyStream`),BDe=(e,t,n,r,i)=>{let a={method:e,headers:n,signal:i.signal};if(e===`TRACE`){a.method=`GET`;let e=new R6(t,a);return Object.defineProperty(e,"method",{get(){return`TRACE`}}),e}if(e!==`GET`&&e!==`HEAD`){if(`rawBody`in r&&r.rawBody instanceof Buffer)a.body=new ReadableStream({start(e){e.enqueue(r.rawBody),e.close()}});else if(r[zDe]){let e;a.body=new ReadableStream({async pull(t){try{e||=Le.toWeb(r).getReader();let{done:n,value:i}=await e.read();n?t.close():t.enqueue(i)}catch(e){t.error(e)}}})}else a.body=Le.toWeb(r)}return new R6(t,a)},z6=Symbol(`getRequestCache`),B6=Symbol(`requestCache`),V6=Symbol(`incomingKey`),H6=Symbol(`urlKey`),VDe=Symbol(`headersKey`),U6=Symbol(`abortControllerKey`),W6={get method(){return this[V6].method||`GET`},get url(){return this[H6]},get headers(){return this[VDe]||=RDe(this[V6])},[Symbol(`getAbortController`)](){return this[z6](),this[U6]},[z6](){return this[U6]||=new AbortController,this[B6]||=BDe(this.method,this[H6],this.headers,this[V6],this[U6])}};[`body`,`bodyUsed`,`cache`,`credentials`,`destination`,`integrity`,`mode`,`redirect`,`referrer`,`referrerPolicy`,`signal`,`keepalive`].forEach(e=>{Object.defineProperty(W6,e,{get(){return this[z6]()[e]}})}),[`arrayBuffer`,`blob`,`clone`,`formData`,`json`,`text`].forEach(e=>{Object.defineProperty(W6,e,{value:function(){return this[z6]()[e]()}})}),Object.defineProperty(W6,Symbol.for(`nodejs.util.inspect.custom`),{value:function(e,t,n){return`Request (lightweight) ${n({method:this.method,url:this.url,headers:this.headers,nativeRequest:this[B6]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf(W6,R6.prototype);var G6=Symbol(`responseCache`),K6=Symbol(`getResponseCache`),q6=Symbol(`cache`),J6=global.Response,Y6=class e{#e;#t;[K6](){return delete this[q6],this[G6]||=new J6(this.#e,this.#t)}constructor(t,n){let r;if(this.#e=t,n instanceof e){let e=n[G6];if(e){this.#t=e,this[K6]();return}this.#t=n.#t,r=new Headers(n.#t.headers)}else this.#t=n;(typeof t==`string`||t?.getReader!==void 0||t instanceof Blob||t instanceof Uint8Array)&&(this[q6]=[n?.status||200,t,r||n?.headers])}get headers(){let e=this[q6];return e?(e[2]instanceof Headers||(e[2]=new Headers(e[2]||{"content-type":`text/plain; charset=UTF-8`})),e[2]):this[K6]().headers}get status(){return this[q6]?.[0]??this[K6]().status}get ok(){let e=this.status;return e>=200&&e<300}};[`body`,`bodyUsed`,`redirected`,`statusText`,`trailers`,`type`,`url`].forEach(e=>{Object.defineProperty(Y6.prototype,e,{get(){return this[K6]()[e]}})}),[`arrayBuffer`,`blob`,`clone`,`formData`,`json`,`text`].forEach(e=>{Object.defineProperty(Y6.prototype,e,{value:function(){return this[K6]()[e]()}})}),Object.defineProperty(Y6.prototype,Symbol.for(`nodejs.util.inspect.custom`),{value:function(e,t,n){return`Response (lightweight) ${n({status:this.status,headers:this.headers,ok:this.ok,nativeResponse:this[G6]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf(Y6,J6),Object.setPrototypeOf(Y6.prototype,J6.prototype),global.crypto===void 0&&(global.crypto=Ie);var HDe=i(((e,t)=>{var n=[`||`,`&&`,`;;`,`|&`,`<(`,`<<<`,`>>`,`>&`,`<&`,`&`,`;`,`(`,`)`,`|`,`<`,`>`],r=/[\n\r\u2028\u2029]/,i=/[\s#!"$&'():;<=>@\\^`|]/g;t.exports=function(e){return e.map(function(e){if(e===``)return`''`;if(e&&typeof e==`object`){if(`op`in e&&e.op===`glob`){if(typeof e.pattern!=`string`)throw TypeError("glob token requires a string `pattern`");if(r.test(e.pattern))throw TypeError("glob `pattern` must not contain line terminators");return e.pattern.replace(i,`\\$&`)}if(`op`in e&&typeof e.op==`string`){if(n.indexOf(e.op)<0)throw TypeError("invalid `op` value: "+JSON.stringify(e.op));return e.op.replace(/[\s\S]/g,`\\$&`)}if(`comment`in e&&typeof e.comment==`string`){if(r.test(e.comment))throw TypeError("`comment` must not contain line terminators");return`#`+e.comment}throw TypeError(`unrecognized object token shape`)}return/["\s\\]/.test(e)&&!/'/.test(e)?`'`+e.replace(/(['])/g,`\\$1`)+`'`:/["'\s]/.test(e)?`"`+e.replace(/(["\\$`!])/g,`\\$1`)+`"`:String(e).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}~])/g,`$1\\$2`)}).join(` `)}})),UDe=i(((e,t)=>{for(var n=`(?:`+[`\\|\\|`,`\\&\\&`,`;;`,`\\|\\&`,`\\<\\(`,`\\<\\<\\<`,`>>`,`>\\&`,`<\\&`,`[&;()|<>]`].join(`|`)+`)`,r=RegExp(`^`+n+`$`),i=`|&;()<> \\t`,a=`'([^']*?)'`,o=`"((\\\\"|[^"])*?)"`,s=/^#$/,c=`'`,l=`"`,u=`$`,d=``,f=4294967296,p=0;p<4;p++)d+=(f*Math.random()).toString(16);var m=RegExp(`^`+d);function h(e,t){for(var n=t.lastIndex,r=[],i;i=t.exec(e);)r[r.length]=i,t.lastIndex===i.index&&(t.lastIndex+=1);return t.lastIndex=n,r}function g(e,t,n){var r=typeof e==`function`?e(n):e[n];return r===void 0&&n!=``?r=``:r===void 0&&(r=`$`),typeof r==`object`?t+d+JSON.stringify(r)+d:t+r}function _(e,t,d){d||={};var f=d.escape||`\\`,p=d.splitUnquoted===!0?`
|
|
737
|
+
`.indexOf(e.charAt(t))!==-1}var a3;(function(e){e.DEFAULT={allowTrailingComma:!1}})(a3||={});function jTe(e,t=[],n=a3.DEFAULT){let r=null,i=[],a=[];function o(e){Array.isArray(i)?i.push(e):r!==null&&(i[r]=e)}return l3(e,{onObjectBegin:()=>{let e={};o(e),a.push(i),i=e,r=null},onObjectProperty:e=>{r=e},onObjectEnd:()=>{i=a.pop()},onArrayBegin:()=>{let e=[];o(e),a.push(i),i=e,r=null},onArrayEnd:()=>{i=a.pop()},onLiteralValue:o,onError:(e,n,r)=>{t.push({error:e,offset:n,length:r})}},n),i[0]}function o3(e,t=[],n=a3.DEFAULT){let r={type:`array`,offset:-1,length:-1,children:[],parent:void 0};function i(e){r.type===`property`&&(r.length=e-r.offset,r=r.parent)}function a(e){return r.children.push(e),e}l3(e,{onObjectBegin:e=>{r=a({type:`object`,offset:e,length:-1,parent:r,children:[]})},onObjectProperty:(e,t,n)=>{r=a({type:`property`,offset:t,length:-1,parent:r,children:[]}),r.children.push({type:`string`,value:e,offset:t,length:n,parent:r})},onObjectEnd:(e,t)=>{i(e+t),r.length=e+t-r.offset,r=r.parent,i(e+t)},onArrayBegin:(e,t)=>{r=a({type:`array`,offset:e,length:-1,parent:r,children:[]})},onArrayEnd:(e,t)=>{r.length=e+t-r.offset,r=r.parent,i(e+t)},onLiteralValue:(e,t,n)=>{a({type:MTe(e),offset:t,length:n,parent:r,value:e}),i(t+n)},onSeparator:(e,t,n)=>{r.type===`property`&&(e===`:`?r.colonOffset=t:e===`,`&&i(t))},onError:(e,n,r)=>{t.push({error:e,offset:n,length:r})}},n);let o=r.children[0];return o&&delete o.parent,o}function s3(e,t){if(!e)return;let n=e;for(let e of t)if(typeof e==`string`){if(n.type!==`object`||!Array.isArray(n.children))return;let t=!1;for(let r of n.children)if(Array.isArray(r.children)&&r.children[0].value===e&&r.children.length===2){n=r.children[1],t=!0;break}if(!t)return}else{let t=e;if(n.type!==`array`||t<0||!Array.isArray(n.children)||t>=n.children.length)return;n=n.children[t]}return n}function c3(e){switch(e.type){case`array`:return e.children.map(c3);case`object`:let t=Object.create(null);for(let n of e.children){let e=n.children[1];e&&(t[n.children[0].value]=c3(e))}return t;case`null`:case`string`:case`number`:case`boolean`:return e.value;default:return}}function l3(e,t,n=a3.DEFAULT){let r=Z4(e,!1),i=[],a=0;function o(e){return e?()=>a===0&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function s(e){return e?t=>a===0&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function c(e){return e?t=>a===0&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice()):()=>!0}function l(e){return e?()=>{a>0?a++:e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice())===!1&&(a=1)}:()=>!0}function u(e){return e?()=>{a>0&&a--,a===0&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}let d=l(t.onObjectBegin),f=c(t.onObjectProperty),p=u(t.onObjectEnd),m=l(t.onArrayBegin),h=u(t.onArrayEnd),g=c(t.onLiteralValue),_=s(t.onSeparator),v=o(t.onComment),y=s(t.onError),b=n&&n.disallowComments,x=n&&n.allowTrailingComma;function S(){for(;;){let e=r.scan();switch(r.getTokenError()){case 4:C(14);break;case 5:C(15);break;case 3:C(13);break;case 1:b||C(11);break;case 2:C(12);break;case 6:C(16)}switch(e){case 12:case 13:b?C(10):v();break;case 16:C(1);break;case 15:case 14:break;default:return e}}}function C(e,t=[],n=[]){if(y(e),t.length+n.length>0){let e=r.getToken();for(;e!==17;){if(t.indexOf(e)!==-1){S();break}if(n.indexOf(e)!==-1)break;e=S()}}}function w(e){let t=r.getTokenValue();return e?g(t):(f(t),i.push(t)),S(),!0}function T(){switch(r.getToken()){case 11:let e=r.getTokenValue(),t=Number(e);isNaN(t)&&(C(2),t=0),g(t);break;case 7:g(null);break;case 8:g(!0);break;case 9:g(!1);break;default:return!1}return S(),!0}function E(){return r.getToken()===10?(w(!1),r.getToken()===6?(_(`:`),S(),ee()||C(4,[],[2,5])):C(5,[],[2,5]),i.pop(),!0):(C(3,[],[2,5]),!1)}function D(){d(),S();let e=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(e||C(4,[],[]),_(`,`),S(),r.getToken()===2&&x)break}else e&&C(6,[],[]);E()||C(4,[],[2,5]),e=!0}return p(),r.getToken()===2?S():C(7,[2],[]),!0}function O(){m(),S();let e=!0,t=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(t||C(4,[],[]),_(`,`),S(),r.getToken()===4&&x)break}else t&&C(6,[],[]);e?(i.push(0),e=!1):i[i.length-1]++,ee()||C(4,[],[4,5]),t=!0}return h(),e||i.pop(),r.getToken()===4?S():C(8,[4],[]),!0}function ee(){switch(r.getToken()){case 3:return O();case 1:return D();case 10:return w(!0);default:return T()}}return S(),r.getToken()===17?n.allowEmptyContent?!0:(C(4,[],[]),!1):ee()?(r.getToken()!==17&&C(9,[],[]),!0):(C(4,[],[]),!1)}function MTe(e){switch(typeof e){case`boolean`:return`boolean`;case`number`:return`number`;case`string`:return`string`;case`object`:return e?Array.isArray(e)?`array`:`object`:`null`;default:return`null`}}function NTe(e,t,n,r){let i=t.slice(),a=o3(e,[]),o,s;for(;i.length>0&&(s=i.pop(),o=s3(a,i),o===void 0&&n!==void 0);)n=typeof s==`string`?{[s]:n}:[n];if(!o){if(n===void 0)throw Error(`Can not delete in empty document`);return u3(e,{offset:a?a.offset:0,length:a?a.length:0,content:JSON.stringify(n)},r)}if(o.type===`object`&&typeof s==`string`&&Array.isArray(o.children)){let t=s3(o,[s]);if(t!==void 0){if(n===void 0){if(!t.parent)throw Error(`Malformed AST`);let n=o.children.indexOf(t.parent),i,a=t.parent.offset+t.parent.length;if(n>0){let e=o.children[n-1];i=e.offset+e.length}else i=o.offset+1,o.children.length>1&&(a=o.children[1].offset);return u3(e,{offset:i,length:a-i,content:``},r)}return u3(e,{offset:t.offset,length:t.length,content:JSON.stringify(n)},r)}{if(n===void 0)return[];let t=`${JSON.stringify(s)}: ${JSON.stringify(n)}`,i=r.getInsertionIndex?r.getInsertionIndex(o.children.map(e=>e.children[0].value)):o.children.length,a;if(i>0){let e=o.children[i-1];a={offset:e.offset+e.length,length:0,content:`,`+t}}else a=o.children.length===0?{offset:o.offset+1,length:0,content:t}:{offset:o.offset+1,length:0,content:t+`,`};return u3(e,a,r)}}if(o.type===`array`&&typeof s==`number`&&Array.isArray(o.children)){let t=s;if(t===-1){let t=`${JSON.stringify(n)}`,i;if(o.children.length===0)i={offset:o.offset+1,length:0,content:t};else{let e=o.children[o.children.length-1];i={offset:e.offset+e.length,length:0,content:`,`+t}}return u3(e,i,r)}if(n===void 0&&o.children.length>=0){let t=s,n=o.children[t],i;if(o.children.length===1)i={offset:o.offset+1,length:o.length-2,content:``};else if(o.children.length-1===t){let e=o.children[t-1],n=e.offset+e.length;i={offset:n,length:o.offset+o.length-2-n,content:``}}else i={offset:n.offset,length:o.children[t+1].offset-n.offset,content:``};return u3(e,i,r)}if(n!==void 0){let t,i=`${JSON.stringify(n)}`;if(!r.isArrayInsertion&&o.children.length>s){let e=o.children[s];t={offset:e.offset,length:e.length,content:i}}else if(o.children.length===0||s===0)t={offset:o.offset+1,length:0,content:o.children.length===0?i:i+`,`};else{let e=s>o.children.length?o.children.length:s,n=o.children[e-1];t={offset:n.offset+n.length,length:0,content:`,`+i}}return u3(e,t,r)}throw Error(`Can not ${n===void 0?`remove`:r.isArrayInsertion?`insert`:`modify`} Array index ${t} as length is not sufficient`)}throw Error(`Can not add ${typeof s==`number`?`property`:`index`} to parent of type ${o.type}`)}function u3(e,t,n){if(!n.formattingOptions)return[t];let r=d3(e,t),i=t.offset,a=t.offset+t.content.length;if(t.length===0||t.content.length===0){for(;i>0&&!i3(r,i-1);)i--;for(;a<r.length&&!i3(r,a);)a++}let o=OTe(r,{offset:i,length:a-i},{...n.formattingOptions,keepLines:!1});for(let e=o.length-1;e>=0;e--){let t=o[e];r=d3(r,t),i=Math.min(i,t.offset),a=Math.max(a,t.offset+t.length),a+=t.content.length-t.length}let s=e.length-(r.length-a)-i;return[{offset:i,length:s,content:r.substring(i,a)}]}function d3(e,t){return e.substring(0,t.offset)+t.content+e.substring(t.offset+t.length)}var PTe;(function(e){e[e.None=0]=`None`,e[e.UnexpectedEndOfComment=1]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=2]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=3]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=4]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=5]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=6]=`InvalidCharacter`})(PTe||={});var FTe;(function(e){e[e.OpenBraceToken=1]=`OpenBraceToken`,e[e.CloseBraceToken=2]=`CloseBraceToken`,e[e.OpenBracketToken=3]=`OpenBracketToken`,e[e.CloseBracketToken=4]=`CloseBracketToken`,e[e.CommaToken=5]=`CommaToken`,e[e.ColonToken=6]=`ColonToken`,e[e.NullKeyword=7]=`NullKeyword`,e[e.TrueKeyword=8]=`TrueKeyword`,e[e.FalseKeyword=9]=`FalseKeyword`,e[e.StringLiteral=10]=`StringLiteral`,e[e.NumericLiteral=11]=`NumericLiteral`,e[e.LineCommentTrivia=12]=`LineCommentTrivia`,e[e.BlockCommentTrivia=13]=`BlockCommentTrivia`,e[e.LineBreakTrivia=14]=`LineBreakTrivia`,e[e.Trivia=15]=`Trivia`,e[e.Unknown=16]=`Unknown`,e[e.EOF=17]=`EOF`})(FTe||={});const ITe=jTe,LTe=o3,f3=c3;var RTe;(function(e){e[e.InvalidSymbol=1]=`InvalidSymbol`,e[e.InvalidNumberFormat=2]=`InvalidNumberFormat`,e[e.PropertyNameExpected=3]=`PropertyNameExpected`,e[e.ValueExpected=4]=`ValueExpected`,e[e.ColonExpected=5]=`ColonExpected`,e[e.CommaExpected=6]=`CommaExpected`,e[e.CloseBraceExpected=7]=`CloseBraceExpected`,e[e.CloseBracketExpected=8]=`CloseBracketExpected`,e[e.EndOfFileExpected=9]=`EndOfFileExpected`,e[e.InvalidCommentToken=10]=`InvalidCommentToken`,e[e.UnexpectedEndOfComment=11]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=12]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=13]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=14]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=15]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=16]=`InvalidCharacter`})(RTe||={});function p3(e,t,n,r){return NTe(e,t,n,r)}function m3(e,t){let n=t.slice(0).sort((e,t)=>{let n=e.offset-t.offset;return n===0?e.length-t.length:n}),r=e.length;for(let t=n.length-1;t>=0;t--){let i=n[t];if(i.offset+i.length<=r)e=d3(e,i);else throw Error(`Overlapping edit`);r=i.offset}return e}const zTe=global.Request;var h3=class extends zTe{constructor(e,t){if(typeof e==`object`&&C3 in e){let n=t!==void 0&&`body`in t&&t.body!=null;if(e[M3]&&!n)throw TypeError(`Cannot construct a Request with a Request object that has already been used.`);e=e[C3]()}t?.body?.getReader!==void 0&&(t.duplex??=`half`),super(e,t)}};const g3=e=>{let t=[],n=e.rawHeaders;for(let e=0,r=n.length;e<r;e+=2){let r=n[e];r.charCodeAt(0)!==58&&t.push([r,n[e+1]])}return new Headers(t)},BTe=Symbol(`wrapBodyStream`),VTe=new Set([`latin1`,`binary`,`hex`,`base64`,`base64url`]),HTe=e=>e===null||VTe.has(e),_3=Symbol(`bodyBufferedBeforeDisconnect`),v3=Symbol(`bodyBufferedLengthBeforeDisconnect`),y3=(e,t)=>Buffer.isBuffer(e)?e:Buffer.from(e,t??`utf8`),b3=e=>!(e instanceof Be)&&!!e.complete&&!!e.readableAborted&&typeof e.read==`function`&&HTe(e.readableEncoding),x3=(e,t)=>{if(e.readableDidRead&&!t||!b3(e))return;let n=e;if(n[_3]!==void 0)return n[_3];let r,i=e.errored;if(i&&i.code!==`ECONNRESET`)r=i;else if(n[v3]!==void 0&&e.readableLength!==n[v3])r=F3();else{let n=t??[],i=e.read();i!==null&&n.push(y3(i,e.readableEncoding));let a=n.length===1?n[0]:Buffer.concat(n);r=a;let o=e.headers[`content-length`];if(typeof o==`string`&&/^\d+$/.test(o)){let e=Number(o);Number.isSafeInteger(e)&&a.length!==e&&(r=F3())}}return n[_3]=r,r},S3=(e,t)=>{if(t instanceof Error){e.error(t);return}t.length>0&&e.enqueue(t),e.close()},UTe=(e,t,n,r,i)=>{let a={method:e,headers:n,signal:i.signal};if(e===`TRACE`){a.method=`GET`;let e=new h3(t,a);return Object.defineProperty(e,"method",{get(){return`TRACE`}}),e}if(e!==`GET`&&e!==`HEAD`){if(`rawBody`in r&&r.rawBody instanceof Buffer)a.body=new ReadableStream({start(e){e.enqueue(r.rawBody),e.close()}});else if(r[BTe]){let e;a.body=new ReadableStream({async pull(t){try{if(!e){let e=x3(r);if(e!==void 0){S3(t,e);return}}e||=Pe.toWeb(r).getReader();let{done:n,value:i}=await e.read();n?t.close():t.enqueue(i)}catch(e){t.error(e)}}})}else{let e=x3(r);a.body=e===void 0?Pe.toWeb(r):new ReadableStream({start(t){S3(t,e)}})}}return new h3(t,a)},C3=Symbol(`getRequestCache`),w3=Symbol(`requestCache`),T3=Symbol(`incomingKey`),E3=Symbol(`urlKey`),WTe=Symbol(`methodKey`),D3=Symbol(`headersKey`),O3=Symbol(`abortControllerKey`),k3=Symbol(`getAbortController`),GTe=Symbol(`abortRequest`),A3=Symbol(`bodyBuffer`),j3=Symbol(`bodyReadPromise`),M3=Symbol(`bodyConsumedDirectly`),N3=Symbol(`bodyLockReader`),P3=Symbol(`abortReason`),F3=()=>TypeError(`Body is unusable`),I3=()=>Promise.reject(F3()),KTe=new TextDecoder,qTe=e=>{if(e[M3])return I3();e[M3]=!0},JTe=e=>e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),YTe=e=>(e[D3]||=g3(e[T3])).get(`content-type`)||``,XTe=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,ZTe=e=>{if(!XTe.test(e))return TypeError(`'${e}' is not a valid HTTP method.`);let t=e.toUpperCase();if(t===`CONNECT`||t===`TRACK`||t===`TRACE`&&e!==`TRACE`)return TypeError(`'${e}' HTTP method is unsupported.`)},L3=(e,t,n)=>{if(e[M3])return I3();let r=e.method;if(r===`GET`||r===`HEAD`)return e[C3]()[t]();let i=ZTe(r);if(i)return Promise.reject(i);if(e[w3]&&r!==`TRACE`)return e[w3][t]();let a=qTe(e);if(a)return a;let o=QTe(e);if(o){let t=Promise.resolve(n(o,e));return e[A3]=void 0,t}return $Te(e).then(t=>{let r=n(t,e);return e[A3]=void 0,r})},QTe=e=>{let t=e[T3];if(`rawBody`in t&&t.rawBody instanceof Buffer)return t.rawBody},R3=(e,t)=>{if(t.errored)return t.errored;let n=e[P3];return n===void 0?Error(`Client connection prematurely closed.`):n instanceof Error?n:Error(String(n))},$Te=e=>{if(e[A3])return Promise.resolve(e[A3]);if(e[j3])return e[j3];let t=e[T3];if(t.readableDidRead)return I3();let n=x3(t);if(n!==void 0)return n instanceof Error?Promise.reject(n):(e[A3]=n,Promise.resolve(n));let r=new Promise((n,r)=>{let i=[],a=!1,o=e=>{a||(a=!0,f(),e())},s=a=>{let s=t.errored??a;return!b3(t)||s&&s.code!==`ECONNRESET`?!1:(o(()=>{let o=x3(t,i);o instanceof Error?r(o):o===void 0?r(a??R3(e,t)):(e[A3]=o,n(o))}),!0)},c=e=>{i.push(y3(e,t.readableEncoding))},l=()=>{o(()=>{let t=i.length===1?i[0]:Buffer.concat(i);e[A3]=t,n(t)})},u=e=>{s(e)||o(()=>{r(e)})},d=()=>{if(t.readableEnded){l();return}s()||o(()=>{r(R3(e,t))})},f=()=>{t.off(`data`,c),t.off(`end`,l),t.off(`error`,u),t.off(`close`,d),e[j3]=void 0};t.on(`data`,c),t.on(`end`,l),t.on(`error`,u),t.on(`close`,d),queueMicrotask(()=>{a||(t.readableEnded?l():t.errored?u(t.errored):t.destroyed&&d())})});return e[j3]=r,r},z3={get method(){return this[WTe]},get url(){return this[E3]},get headers(){return this[D3]||=g3(this[T3])},[GTe](e){this[P3]===void 0&&(this[P3]=e);let t=this[O3];t&&!t.signal.aborted&&t.abort(e)},[k3](){return this[O3]||=new AbortController,this[P3]!==void 0&&!this[O3].signal.aborted&&this[O3].abort(this[P3]),this[O3]},[C3](){let e=this[k3]();if(this[w3])return this[w3];let t=this.method;if(this[M3]&&t!==`GET`&&t!==`HEAD`){this[A3]=void 0;let n={method:t===`TRACE`?`GET`:t,headers:this.headers,signal:e.signal};t!==`TRACE`&&(n.body=new ReadableStream({start(e){e.close()}}),n.duplex=`half`);let r=new h3(this[E3],n);return t===`TRACE`&&Object.defineProperty(r,"method",{get(){return`TRACE`}}),this[w3]=r}return this[w3]=UTe(this.method,this[E3],this.headers,this[T3],e)},get body(){if(!this[M3])return this[C3]().body;let e=this[C3]();return!this[N3]&&e.body&&(this[N3]=e.body.getReader()),e.body},get bodyUsed(){return this[M3]?!0:this[w3]?this[w3].bodyUsed:!1}};Object.defineProperty(z3,"signal",{get(){return this[k3]().signal}}),[`cache`,`credentials`,`destination`,`integrity`,`mode`,`redirect`,`referrer`,`referrerPolicy`,`keepalive`].forEach(e=>{Object.defineProperty(z3,e,{get(){return this[C3]()[e]}})}),[`clone`,`formData`].forEach(e=>{Object.defineProperty(z3,e,{value:function(){if(this[M3]){if(e===`clone`)throw F3();return I3()}return this[C3]()[e]()}})}),Object.defineProperty(z3,"text",{value:function(){return L3(this,`text`,e=>KTe.decode(e))}}),Object.defineProperty(z3,"arrayBuffer",{value:function(){return L3(this,`arrayBuffer`,e=>JTe(e))}}),Object.defineProperty(z3,"blob",{value:function(){return L3(this,`blob`,(e,t)=>{let n=YTe(t);return new Response(e,n?{headers:{"content-type":n}}:void 0).blob()})}}),Object.defineProperty(z3,"json",{value:function(){return this[M3]?I3():this.text().then(JSON.parse)}}),Object.defineProperty(z3,Symbol.for(`nodejs.util.inspect.custom`),{value:function(e,t,n){return`Request (lightweight) ${n({method:this.method,url:this.url,headers:this.headers,nativeRequest:this[w3]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf(z3,h3.prototype);const B3=Symbol(`responseCache`),V3=Symbol(`getResponseCache`),H3=Symbol(`cache`),U3=global.Response;var W3=class e{#e;#t;[V3](){let e=this[H3],t=e&&e[2]instanceof Headers?e[2]:void 0;return delete this[H3],this[B3]||=new U3(this.#e,t?{status:this.#t?.status,statusText:this.#t?.statusText,headers:t}:this.#t)}constructor(t,n){let r;if(this.#e=t,n instanceof U3){let t=n[B3];if(t){this.#t=t,this[V3]();return}this.#t=n instanceof e?n.#t:n,r=new Headers(n.headers)}else this.#t=n;(t==null||typeof t==`string`||t?.getReader!==void 0||t instanceof Blob||t instanceof Uint8Array)&&(this[H3]=[n?.status||200,t??null,r||n?.headers])}get headers(){let e=this[H3];return e?(e[2]instanceof Headers||(e[2]=new Headers(e[2]||(e[1]===null?void 0:{"content-type":`text/plain; charset=UTF-8`}))),e[2]):this[V3]().headers}get status(){return this[H3]?.[0]??this[V3]().status}get ok(){let e=this.status;return e>=200&&e<300}};[`body`,`bodyUsed`,`redirected`,`statusText`,`trailers`,`type`,`url`].forEach(e=>{Object.defineProperty(W3.prototype,e,{get(){return this[V3]()[e]}})}),[`arrayBuffer`,`blob`,`clone`,`formData`,`json`,`text`].forEach(e=>{Object.defineProperty(W3.prototype,e,{value:function(){return this[V3]()[e]()}})}),Object.defineProperty(W3.prototype,Symbol.for(`nodejs.util.inspect.custom`),{value:function(e,t,n){return`Response (lightweight) ${n({status:this.status,headers:this.headers,ok:this.ok,nativeResponse:this[B3]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf(W3,U3),Object.setPrototypeOf(W3.prototype,U3.prototype);const eEe=/^https?:\/\/[!#-;=?-[\]_a-z~A-Z]+$/,tEe=e=>e instanceof URL?e.href:eEe.test(e)?e:new URL(e).href,nEe=new Set([301,302,303,307,308]);Object.defineProperty(W3,"redirect",{value:function(e,t=302){if(!nEe.has(t))throw RangeError(`Invalid status code`);return new W3(null,{status:t,headers:{location:tEe(e)}})},writable:!0,configurable:!0}),Object.defineProperty(W3,"json",{value:function(e,t){let n=JSON.stringify(e);if(n===void 0)throw TypeError(`The data is not JSON serializable`);let r=t?.headers,i;return r?(i=new Headers(r),i.has(`content-type`)||i.set(`content-type`,`application/json`)):i={"content-type":`application/json`},new W3(n,{status:t?.status??200,statusText:t?.statusText,headers:i})},writable:!0,configurable:!0}),globalThis.CloseEvent,globalThis.ErrorEvent,new Response(null,{headers:{"x-hono-already-sent":`true`}});function rEe(e,t){let n;try{n=E(e)}catch{return t.map(({editor:e,root:t})=>({host:e,root:t,state:`absent`}))}let r=e=>{let t=ye(n,e);if(!(t===``||t.startsWith(`..`)||ge(t)))return t.split(xe).join(`/`)};return t.map(({editor:t,root:i})=>{let a=N(e,i),o;try{o=_(a)}catch{return{host:t,root:i,state:`absent`}}let s;try{s=E(a)}catch{return{host:t,root:i,state:`absent`}}if(o.isSymbolicLink()){let e=r(s);return{host:t,root:i,state:`linked`,real:s,...e?{target:e}:{}}}if(s!==N(n,i)){let e=r(s);return{host:t,root:i,state:`linked-parent`,real:s,...e?{target:e}:{}}}return{host:t,root:i,state:`own`,real:s}})}i(((e,t)=>{(function(e){let n=`(0?\\d+|0x[a-f0-9]+)`,r={fourOctet:RegExp(`^${n}\\.${n}\\.${n}\\.${n}$`,`i`),threeOctet:RegExp(`^${n}\\.${n}\\.${n}$`,`i`),twoOctet:RegExp(`^${n}\\.${n}$`,`i`),longValue:RegExp(`^${n}$`,`i`)},i=RegExp(`^0[0-7]+$`,`i`),a=RegExp(`^0x[a-f0-9]+$`,`i`),o=`%[0-9a-z]{1,}`,s=`(?:[0-9a-f]+::?)+`,c={zoneIndex:RegExp(o,`i`),native:RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${o})?$`,`i`),deprecatedTransitional:RegExp(`^(?:::)(${n}\\.${n}\\.${n}\\.${n}(${o})?)$`,`i`),transitional:RegExp(`^((?:${s})|(?:::)(?:${s})?)${n}\\.${n}\\.${n}\\.${n}(${o})?$`,`i`)};function l(e,t){if(e.indexOf(`::`)!==e.lastIndexOf(`::`))return null;let n=0,r=-1,i=(e.match(c.zoneIndex)||[])[0],a,o;for(i&&(i=i.substring(1),e=e.replace(/%.+$/,``));(r=e.indexOf(`:`,r+1))>=0;)n++;if(e.substr(0,2)===`::`&&n--,e.substr(-2,2)===`::`&&n--,n>t)return null;for(o=t-n,a=`:`;o--;)a+=`0:`;return e=e.replace(`::`,a),e[0]===`:`&&(e=e.slice(1)),e[e.length-1]===`:`&&(e=e.slice(0,-1)),t=(function(){let t=e.split(`:`),n=[];for(let e=0;e<t.length;e++)n.push(parseInt(t[e],16));return n})(),{parts:t,zoneId:i}}function u(e,t,n,r){if(e.length!==t.length)throw Error(`ipaddr: cannot match CIDR for objects with different lengths`);let i=0,a;for(;r>0;){if(a=n-r,a<0&&(a=0),e[i]>>a!==t[i]>>a)return!1;r-=n,i+=1}return!0}function d(e){if(a.test(e))return parseInt(e,16);if(e[0]===`0`&&!isNaN(parseInt(e[1],10))){if(i.test(e))return parseInt(e,8);throw Error(`ipaddr: cannot parse ${e} as octal`)}return parseInt(e,10)}function f(e,t){for(;e.length<t;)e=`0${e}`;return e}let p={};p.IPv4=(function(){function e(e){if(e.length!==4)throw Error(`ipaddr: ipv4 octet count should be 4`);let t,n;for(t=0;t<e.length;t++)if(n=e[t],!(0<=n&&n<=255))throw Error(`ipaddr: ipv4 octet should fit in 8 bits`);this.octets=e}return e.prototype.SpecialRanges={unspecified:[[new e([0,0,0,0]),8]],broadcast:[[new e([255,255,255,255]),32]],multicast:[[new e([224,0,0,0]),4]],linkLocal:[[new e([169,254,0,0]),16]],loopback:[[new e([127,0,0,0]),8]],carrierGradeNat:[[new e([100,64,0,0]),10]],private:[[new e([10,0,0,0]),8],[new e([172,16,0,0]),12],[new e([192,168,0,0]),16]],reserved:[[new e([192,0,0,0]),24],[new e([192,0,2,0]),24],[new e([192,88,99,0]),24],[new e([198,18,0,0]),15],[new e([198,51,100,0]),24],[new e([203,0,113,0]),24],[new e([240,0,0,0]),4]],as112:[[new e([192,175,48,0]),24],[new e([192,31,196,0]),24]],amt:[[new e([192,52,193,0]),24]]},e.prototype.kind=function(){return`ipv4`},e.prototype.match=function(e,t){let n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv4`)throw Error(`ipaddr: cannot match ipv4 address with non-ipv4 one`);return u(this.octets,e.octets,8,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1,n={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},r,i,a;for(r=3;r>=0;--r)if(i=this.octets[r],i in n){if(a=n[i],t&&a!==0)return null;a!==8&&(t=!0),e+=a}else return null;return 32-e},e.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return p.IPv6.parse(`::ffff:${this.toString()}`)},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(`.`)},e})(),p.IPv4.broadcastAddressFromCIDR=function(e){try{let t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],a=0;for(;a<4;)i.push(parseInt(n[a],10)|parseInt(r[a],10)^255),a++;return new this(i)}catch{throw Error(`ipaddr: the address does not have IPv4 CIDR format`)}},p.IPv4.isIPv4=function(e){return this.parser(e)!==null},p.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch{return!1}},p.IPv4.isValidCIDR=function(e){try{return this.parseCIDR(e),!0}catch{return!1}},p.IPv4.isValidFourPartDecimal=function(e){return!!(p.IPv4.isValid(e)&&e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},p.IPv4.isValidCIDRFourPartDecimal=function(e){let t=e.match(/^(.+)\/(\d+)$/);return!p.IPv4.isValidCIDR(e)||!t?!1:p.IPv4.isValidFourPartDecimal(t[1])},p.IPv4.networkAddressFromCIDR=function(e){let t,n,r,i,a;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),a=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<4;)i.push(parseInt(r[n],10)&parseInt(a[n],10)),n++;return new this(i)}catch{throw Error(`ipaddr: the address does not have IPv4 CIDR format`)}},p.IPv4.parse=function(e){let t=this.parser(e);if(t===null)throw Error(`ipaddr: string is not formatted like an IPv4 Address`);return new this(t)},p.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){let e=parseInt(t[2]);if(e>=0&&e<=32){let n=[this.parse(t[1]),e];return Object.defineProperty(n,"toString",{value:function(){return this.join(`/`)}}),n}}throw Error(`ipaddr: string is not formatted like an IPv4 CIDR range`)},p.IPv4.parser=function(e){let t,n,i;if(t=e.match(r.fourOctet))return(function(){let e=t.slice(1,6),r=[];for(let t=0;t<e.length;t++)n=e[t],r.push(d(n));return r})();if(t=e.match(r.longValue)){if(i=d(t[1]),i>4294967295||i<0)throw Error(`ipaddr: address outside defined range`);return(function(){let e=[],t;for(t=0;t<=24;t+=8)e.push(i>>t&255);return e})().reverse()}return(t=e.match(r.twoOctet))?(function(){let e=t.slice(1,4),n=[];if(i=d(e[1]),i>16777215||i<0)throw Error(`ipaddr: address outside defined range`);return n.push(d(e[0])),n.push(i>>16&255),n.push(i>>8&255),n.push(i&255),n})():(t=e.match(r.threeOctet))?(function(){let e=t.slice(1,5),n=[];if(i=d(e[2]),i>65535||i<0)throw Error(`ipaddr: address outside defined range`);return n.push(d(e[0])),n.push(d(e[1])),n.push(i>>8&255),n.push(i&255),n})():null},p.IPv4.subnetMaskFromPrefixLength=function(e){if(e=parseInt(e),e<0||e>32)throw Error(`ipaddr: invalid IPv4 prefix length`);let t=[0,0,0,0],n=0,r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<4&&(t[r]=2**(e%8)-1<<8-e%8),new this(t)},p.IPv6=(function(){function e(e,t){let n,r;if(e.length===16)for(this.parts=[],n=0;n<=14;n+=2)this.parts.push(e[n]<<8|e[n+1]);else if(e.length===8)this.parts=e;else throw Error(`ipaddr: ipv6 part count should be 8 or 16`);for(n=0;n<this.parts.length;n++)if(r=this.parts[n],!(0<=r&&r<=65535))throw Error(`ipaddr: ipv6 part should fit in 16 bits`);t&&(this.zoneId=t)}return e.prototype.SpecialRanges={unspecified:[new e([0,0,0,0,0,0,0,0]),128],linkLocal:[new e([65152,0,0,0,0,0,0,0]),10],multicast:[new e([65280,0,0,0,0,0,0,0]),8],loopback:[new e([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new e([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new e([0,0,0,0,0,65535,0,0]),96],deprecatedSiteLocal:[new e([65216,0,0,0,0,0,0,0]),10],discard:[new e([256,0,0,0,0,0,0,0]),64],rfc6145:[new e([0,0,0,0,65535,0,0,0]),96],rfc6052:[[new e([100,65435,0,0,0,0,0,0]),96],[new e([100,65435,1,0,0,0,0,0]),48]],"6to4":[new e([8194,0,0,0,0,0,0,0]),16],teredo:[new e([8193,0,0,0,0,0,0,0]),32],benchmarking:[new e([8193,2,0,0,0,0,0,0]),48],amt:[new e([8193,3,0,0,0,0,0,0]),32],as112v6:[[new e([8193,4,274,0,0,0,0,0]),48],[new e([9760,79,32768,0,0,0,0,0]),48]],deprecatedOrchid:[new e([8193,16,0,0,0,0,0,0]),28],orchid2:[new e([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new e([8193,48,0,0,0,0,0,0]),28],segmentRouting:[new e([24320,0,0,0,0,0,0,0]),16],reserved:[[new e([8193,0,0,0,0,0,0,0]),23],[new e([8193,3512,0,0,0,0,0,0]),32],[new e([16383,0,0,0,0,0,0,0]),20]]},e.prototype.isIPv4MappedAddress=function(){return this.range()===`ipv4Mapped`},e.prototype.kind=function(){return`ipv6`},e.prototype.match=function(e,t){let n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv6`)throw Error(`ipaddr: cannot match ipv6 address with non-ipv6 one`);return u(this.parts,e.parts,16,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1,n={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},r,i;for(let a=7;a>=0;--a)if(r=this.parts[a],r in n){if(i=n[r],t&&i!==0)return null;i!==16&&(t=!0),e+=i}else return null;return 128-e},e.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let e,t=[],n=this.parts;for(let r=0;r<n.length;r++)e=n[r],t.push(e>>8),t.push(e&255);return t},e.prototype.toFixedLengthString=function(){let e=(function(){let e=[];for(let t=0;t<this.parts.length;t++)e.push(f(this.parts[t].toString(16),4));return e}).call(this).join(`:`),t=``;return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw Error(`ipaddr: trying to convert a generic ipv6 address to ipv4`);let e=this.parts.slice(-2),t=e[0],n=e[1];return new p.IPv4([t>>8,t&255,n>>8,n&255])},e.prototype.toNormalizedString=function(){let e=(function(){let e=[];for(let t=0;t<this.parts.length;t++)e.push(this.parts[t].toString(16));return e}).call(this).join(`:`),t=``;return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toRFC5952String=function(){let e=/((^|:)(0(:|$)){2,})/g,t=this.toNormalizedString(),n=0,r=-1,i;for(;i=e.exec(t);)i[0].length>r&&(n=i.index,r=i[0].length);return r<0?t:`${t.substring(0,n)}::${t.substring(n+r)}`},e.prototype.toString=function(){return this.toRFC5952String()},e})(),p.IPv6.broadcastAddressFromCIDR=function(e){try{let t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],a=0;for(;a<16;)i.push(parseInt(n[a],10)|parseInt(r[a],10)^255),a++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},p.IPv6.isIPv6=function(e){return this.parser(e)!==null},p.IPv6.isValid=function(e){if(typeof e==`string`&&e.indexOf(`:`)===-1)return!1;try{let t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch{return!1}},p.IPv6.isValidCIDR=function(e){if(typeof e==`string`&&e.indexOf(`:`)===-1)return!1;try{return this.parseCIDR(e),!0}catch{return!1}},p.IPv6.networkAddressFromCIDR=function(e){let t,n,r,i,a;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),a=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<16;)i.push(parseInt(r[n],10)&parseInt(a[n],10)),n++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},p.IPv6.parse=function(e){let t=this.parser(e);if(t.parts===null)throw Error(`ipaddr: string is not formatted like an IPv6 Address`);return new this(t.parts,t.zoneId)},p.IPv6.parseCIDR=function(e){let t,n,r;if((n=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(n[2]),t>=0&&t<=128))return r=[this.parse(n[1]),t],Object.defineProperty(r,"toString",{value:function(){return this.join(`/`)}}),r;throw Error(`ipaddr: string is not formatted like an IPv6 CIDR range`)},p.IPv6.parser=function(e){let t,n,r,i,a,o;if(r=e.match(c.deprecatedTransitional))return this.parser(`::ffff:${r[1]}`);if(c.native.test(e))return l(e,8);if((r=e.match(c.transitional))&&(o=r[6]||``,t=r[1],r[1].endsWith(`::`)||(t=t.slice(0,-1)),t=l(t+o,6),t.parts)){for(a=[parseInt(r[2]),parseInt(r[3]),parseInt(r[4]),parseInt(r[5])],n=0;n<a.length;n++)if(i=a[n],!(0<=i&&i<=255))return null;return t.parts.push(a[0]<<8|a[1]),t.parts.push(a[2]<<8|a[3]),{parts:t.parts,zoneId:t.zoneId}}return null},p.IPv6.subnetMaskFromPrefixLength=function(e){if(e=parseInt(e),e<0||e>128)throw Error(`ipaddr: invalid IPv6 prefix length`);let t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n=0,r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<16&&(t[r]=2**(e%8)-1<<8-e%8),new this(t)},p.fromByteArray=function(e){let t=e.length;if(t===4)return new p.IPv4(e);if(t===16)return new p.IPv6(e);throw Error(`ipaddr: the binary input is neither an IPv6 nor IPv4 address`)},p.isValid=function(e){return p.IPv6.isValid(e)||p.IPv4.isValid(e)},p.isValidCIDR=function(e){return p.IPv6.isValidCIDR(e)||p.IPv4.isValidCIDR(e)},p.parse=function(e){if(p.IPv6.isValid(e))return p.IPv6.parse(e);if(p.IPv4.isValid(e))return p.IPv4.parse(e);throw Error(`ipaddr: the address has neither IPv6 nor IPv4 format`)},p.parseCIDR=function(e){try{return p.IPv6.parseCIDR(e)}catch{try{return p.IPv4.parseCIDR(e)}catch{throw Error(`ipaddr: the address has neither IPv6 nor IPv4 CIDR format`)}}},p.process=function(e){let t=this.parse(e);return t.kind()===`ipv6`&&t.isIPv4MappedAddress()?t.toIPv4Address():t},p.subnetMatch=function(e,t,n){let r,i,a,o;for(i in n??=`unicast`,t)if(Object.prototype.hasOwnProperty.call(t,i)){for(a=t[i],a[0]&&!(a[0]instanceof Array)&&(a=[a]),r=0;r<a.length;r++)if(o=a[r],e.kind()===o[0].kind()&&e.match.apply(e,o))return i}return n},t!==void 0&&t.exports?t.exports=p:e.ipaddr=p})(e)}))();const iEe={"3g2":`video/3gpp2`,"3gp":`video/3gpp`,"3gpp":`video/3gpp`,"3mf":`model/3mf`,aac:`audio/aac`,ac:`application/pkix-attr-cert`,adp:`audio/adpcm`,adts:`audio/aac`,ai:`application/postscript`,aml:`application/automationml-aml+xml`,amlx:`application/automationml-amlx+zip`,amr:`audio/amr`,apng:`image/apng`,appcache:`text/cache-manifest`,appinstaller:`application/appinstaller`,appx:`application/appx`,appxbundle:`application/appxbundle`,asc:`application/pgp-keys`,atom:`application/atom+xml`,atomcat:`application/atomcat+xml`,atomdeleted:`application/atomdeleted+xml`,atomsvc:`application/atomsvc+xml`,au:`audio/basic`,avci:`image/avci`,avcs:`image/avcs`,avif:`image/avif`,aw:`application/applixware`,bdoc:`application/bdoc`,bin:`application/octet-stream`,bmp:`image/bmp`,bpk:`application/octet-stream`,btf:`image/prs.btif`,btif:`image/prs.btif`,buffer:`application/octet-stream`,ccxml:`application/ccxml+xml`,cdfx:`application/cdfx+xml`,cdmia:`application/cdmi-capability`,cdmic:`application/cdmi-container`,cdmid:`application/cdmi-domain`,cdmio:`application/cdmi-object`,cdmiq:`application/cdmi-queue`,cer:`application/pkix-cert`,cgm:`image/cgm`,cjs:`application/node`,class:`application/java-vm`,coffee:`text/coffeescript`,conf:`text/plain`,cpl:`application/cpl+xml`,cpt:`application/mac-compactpro`,crl:`application/pkix-crl`,css:`text/css`,csv:`text/csv`,cu:`application/cu-seeme`,cwl:`application/cwl`,cww:`application/prs.cww`,davmount:`application/davmount+xml`,dbk:`application/docbook+xml`,deb:`application/octet-stream`,def:`text/plain`,deploy:`application/octet-stream`,dib:`image/bmp`,"disposition-notification":`message/disposition-notification`,dist:`application/octet-stream`,distz:`application/octet-stream`,dll:`application/octet-stream`,dmg:`application/octet-stream`,dms:`application/octet-stream`,doc:`application/msword`,dot:`application/msword`,dpx:`image/dpx`,drle:`image/dicom-rle`,dsc:`text/prs.lines.tag`,dssc:`application/dssc+der`,dtd:`application/xml-dtd`,dump:`application/octet-stream`,dwd:`application/atsc-dwd+xml`,ear:`application/java-archive`,ecma:`application/ecmascript`,elc:`application/octet-stream`,emf:`image/emf`,eml:`message/rfc822`,emma:`application/emma+xml`,emotionml:`application/emotionml+xml`,eps:`application/postscript`,epub:`application/epub+zip`,exe:`application/octet-stream`,exi:`application/exi`,exp:`application/express`,exr:`image/aces`,ez:`application/andrew-inset`,fdf:`application/fdf`,fdt:`application/fdt+xml`,fits:`image/fits`,g3:`image/g3fax`,gbr:`application/rpki-ghostbusters`,geojson:`application/geo+json`,gif:`image/gif`,glb:`model/gltf-binary`,gltf:`model/gltf+json`,gml:`application/gml+xml`,gpx:`application/gpx+xml`,gram:`application/srgs`,grxml:`application/srgs+xml`,gxf:`application/gxf`,gz:`application/gzip`,h261:`video/h261`,h263:`video/h263`,h264:`video/h264`,heic:`image/heic`,heics:`image/heic-sequence`,heif:`image/heif`,heifs:`image/heif-sequence`,hej2:`image/hej2k`,held:`application/atsc-held+xml`,hjson:`application/hjson`,hlp:`application/winhlp`,hqx:`application/mac-binhex40`,hsj2:`image/hsj2`,htm:`text/html`,html:`text/html`,ics:`text/calendar`,ief:`image/ief`,ifb:`text/calendar`,iges:`model/iges`,igs:`model/iges`,img:`application/octet-stream`,in:`text/plain`,ini:`text/plain`,ink:`application/inkml+xml`,inkml:`application/inkml+xml`,ipfix:`application/ipfix`,iso:`application/octet-stream`,its:`application/its+xml`,jade:`text/jade`,jar:`application/java-archive`,jhc:`image/jphc`,jls:`image/jls`,jp2:`image/jp2`,jpe:`image/jpeg`,jpeg:`image/jpeg`,jpf:`image/jpx`,jpg:`image/jpeg`,jpg2:`image/jp2`,jpgm:`image/jpm`,jpgv:`video/jpeg`,jph:`image/jph`,jpm:`image/jpm`,jpx:`image/jpx`,js:`text/javascript`,json:`application/json`,json5:`application/json5`,jsonld:`application/ld+json`,jsonml:`application/jsonml+json`,jsx:`text/jsx`,jt:`model/jt`,jxl:`image/jxl`,jxr:`image/jxr`,jxra:`image/jxra`,jxrs:`image/jxrs`,jxs:`image/jxs`,jxsc:`image/jxsc`,jxsi:`image/jxsi`,jxss:`image/jxss`,kar:`audio/midi`,ktx:`image/ktx`,ktx2:`image/ktx2`,less:`text/less`,lgr:`application/lgr+xml`,list:`text/plain`,litcoffee:`text/coffeescript`,log:`text/plain`,lostxml:`application/lost+xml`,lrf:`application/octet-stream`,m1v:`video/mpeg`,m21:`application/mp21`,m2a:`audio/mpeg`,m2t:`video/mp2t`,m2ts:`video/mp2t`,m2v:`video/mpeg`,m3a:`audio/mpeg`,m4a:`audio/mp4`,m4p:`application/mp4`,m4s:`video/iso.segment`,ma:`application/mathematica`,mads:`application/mads+xml`,maei:`application/mmt-aei+xml`,man:`text/troff`,manifest:`text/cache-manifest`,map:`application/json`,mar:`application/octet-stream`,markdown:`text/markdown`,mathml:`application/mathml+xml`,mb:`application/mathematica`,mbox:`application/mbox`,md:`text/markdown`,mdx:`text/mdx`,me:`text/troff`,mesh:`model/mesh`,meta4:`application/metalink4+xml`,metalink:`application/metalink+xml`,mets:`application/mets+xml`,mft:`application/rpki-manifest`,mid:`audio/midi`,midi:`audio/midi`,mime:`message/rfc822`,mj2:`video/mj2`,mjp2:`video/mj2`,mjs:`text/javascript`,mml:`text/mathml`,mods:`application/mods+xml`,mov:`video/quicktime`,mp2:`audio/mpeg`,mp21:`application/mp21`,mp2a:`audio/mpeg`,mp3:`audio/mpeg`,mp4:`video/mp4`,mp4a:`audio/mp4`,mp4s:`application/mp4`,mp4v:`video/mp4`,mpd:`application/dash+xml`,mpe:`video/mpeg`,mpeg:`video/mpeg`,mpf:`application/media-policy-dataset+xml`,mpg:`video/mpeg`,mpg4:`video/mp4`,mpga:`audio/mpeg`,mpp:`application/dash-patch+xml`,mrc:`application/marc`,mrcx:`application/marcxml+xml`,ms:`text/troff`,mscml:`application/mediaservercontrol+xml`,msh:`model/mesh`,msi:`application/octet-stream`,msix:`application/msix`,msixbundle:`application/msixbundle`,msm:`application/octet-stream`,msp:`application/octet-stream`,mtl:`model/mtl`,mts:`video/mp2t`,musd:`application/mmt-usd+xml`,mxf:`application/mxf`,mxmf:`audio/mobile-xmf`,mxml:`application/xv+xml`,n3:`text/n3`,nb:`application/mathematica`,nq:`application/n-quads`,nt:`application/n-triples`,obj:`model/obj`,oda:`application/oda`,oga:`audio/ogg`,ogg:`audio/ogg`,ogv:`video/ogg`,ogx:`application/ogg`,omdoc:`application/omdoc+xml`,onepkg:`application/onenote`,onetmp:`application/onenote`,onetoc:`application/onenote`,onetoc2:`application/onenote`,opf:`application/oebps-package+xml`,opus:`audio/ogg`,otf:`font/otf`,owl:`application/rdf+xml`,oxps:`application/oxps`,p10:`application/pkcs10`,p7c:`application/pkcs7-mime`,p7m:`application/pkcs7-mime`,p7s:`application/pkcs7-signature`,p8:`application/pkcs8`,pdf:`application/pdf`,pfr:`application/font-tdpfr`,pgp:`application/pgp-encrypted`,pkg:`application/octet-stream`,pki:`application/pkixcmp`,pkipath:`application/pkix-pkipath`,pls:`application/pls+xml`,png:`image/png`,prc:`model/prc`,prf:`application/pics-rules`,provx:`application/provenance+xml`,ps:`application/postscript`,pskcxml:`application/pskc+xml`,pti:`image/prs.pti`,qt:`video/quicktime`,raml:`application/raml+yaml`,rapd:`application/route-apd+xml`,rdf:`application/rdf+xml`,relo:`application/p2p-overlay+xml`,rif:`application/reginfo+xml`,rl:`application/resource-lists+xml`,rld:`application/resource-lists-diff+xml`,rmi:`audio/midi`,rnc:`application/relax-ng-compact-syntax`,rng:`application/xml`,roa:`application/rpki-roa`,roff:`text/troff`,rq:`application/sparql-query`,rs:`application/rls-services+xml`,rsat:`application/atsc-rsat+xml`,rsd:`application/rsd+xml`,rsheet:`application/urc-ressheet+xml`,rss:`application/rss+xml`,rtf:`text/rtf`,rtx:`text/richtext`,rusd:`application/route-usd+xml`,s3m:`audio/s3m`,sbml:`application/sbml+xml`,scq:`application/scvp-cv-request`,scs:`application/scvp-cv-response`,sdp:`application/sdp`,senmlx:`application/senml+xml`,sensmlx:`application/sensml+xml`,ser:`application/java-serialized-object`,setpay:`application/set-payment-initiation`,setreg:`application/set-registration-initiation`,sgi:`image/sgi`,sgm:`text/sgml`,sgml:`text/sgml`,shex:`text/shex`,shf:`application/shf+xml`,shtml:`text/html`,sieve:`application/sieve`,sig:`application/pgp-signature`,sil:`audio/silk`,silo:`model/mesh`,siv:`application/sieve`,slim:`text/slim`,slm:`text/slim`,sls:`application/route-s-tsid+xml`,smi:`application/smil+xml`,smil:`application/smil+xml`,snd:`audio/basic`,so:`application/octet-stream`,spdx:`text/spdx`,spp:`application/scvp-vp-response`,spq:`application/scvp-vp-request`,spx:`audio/ogg`,sql:`application/sql`,sru:`application/sru+xml`,srx:`application/sparql-results+xml`,ssdl:`application/ssdl+xml`,ssml:`application/ssml+xml`,stk:`application/hyperstudio`,stl:`model/stl`,stpx:`model/step+xml`,stpxz:`model/step-xml+zip`,stpz:`model/step+zip`,styl:`text/stylus`,stylus:`text/stylus`,svg:`image/svg+xml`,svgz:`image/svg+xml`,swidtag:`application/swid+xml`,t:`text/troff`,t38:`image/t38`,td:`application/urc-targetdesc+xml`,tei:`application/tei+xml`,teicorpus:`application/tei+xml`,text:`text/plain`,tfi:`application/thraud+xml`,tfx:`image/tiff-fx`,tif:`image/tiff`,tiff:`image/tiff`,toml:`application/toml`,tr:`text/troff`,trig:`application/trig`,ts:`video/mp2t`,tsd:`application/timestamped-data`,tsv:`text/tab-separated-values`,ttc:`font/collection`,ttf:`font/ttf`,ttl:`text/turtle`,ttml:`application/ttml+xml`,txt:`text/plain`,u3d:`model/u3d`,u8dsn:`message/global-delivery-status`,u8hdr:`message/global-headers`,u8mdn:`message/global-disposition-notification`,u8msg:`message/global`,ubj:`application/ubjson`,uri:`text/uri-list`,uris:`text/uri-list`,urls:`text/uri-list`,vcard:`text/vcard`,vrml:`model/vrml`,vtt:`text/vtt`,vxml:`application/voicexml+xml`,war:`application/java-archive`,wasm:`application/wasm`,wav:`audio/wav`,weba:`audio/webm`,webm:`video/webm`,webmanifest:`application/manifest+json`,webp:`image/webp`,wgsl:`text/wgsl`,wgt:`application/widget`,wif:`application/watcherinfo+xml`,wmf:`image/wmf`,woff:`font/woff`,woff2:`font/woff2`,wrl:`model/vrml`,wsdl:`application/wsdl+xml`,wspolicy:`application/wspolicy+xml`,x3d:`model/x3d+xml`,x3db:`model/x3d+fastinfoset`,x3dbz:`model/x3d+binary`,x3dv:`model/x3d-vrml`,x3dvz:`model/x3d+vrml`,x3dz:`model/x3d+xml`,xaml:`application/xaml+xml`,xav:`application/xcap-att+xml`,xca:`application/xcap-caps+xml`,xcs:`application/calendar+xml`,xdf:`application/xcap-diff+xml`,xdssc:`application/dssc+xml`,xel:`application/xcap-el+xml`,xenc:`application/xenc+xml`,xer:`application/patch-ops-error+xml`,xfdf:`application/xfdf`,xht:`application/xhtml+xml`,xhtml:`application/xhtml+xml`,xhvml:`application/xv+xml`,xlf:`application/xliff+xml`,xm:`audio/xm`,xml:`text/xml`,xns:`application/xcap-ns+xml`,xop:`application/xop+xml`,xpl:`application/xproc+xml`,xsd:`application/xml`,xsf:`application/prs.xsf+xml`,xsl:`application/xml`,xslt:`application/xml`,xspf:`application/xspf+xml`,xvm:`application/xv+xml`,xvml:`application/xv+xml`,yaml:`text/yaml`,yang:`application/yang`,yin:`application/yin+xml`,yml:`text/yaml`,zip:`application/zip`},G3=Pi(e=>e!==null&&(typeof e==`object`||typeof e==`function`)),K3=V([F(),I().int()]),q3=F();si({ttl:I().optional(),pollInterval:I().optional()});const aEe=B({ttl:I().optional()}),oEe=B({taskId:F()}),J3=si({progressToken:K3.optional(),"io.modelcontextprotocol/related-task":oEe.optional()}),Y3=B({_meta:J3.optional()}),X3=Y3.extend({task:aEe.optional()}),Z3=B({method:F(),params:Y3.loose().optional()}),Q3=B({_meta:J3.optional()}),$3=B({method:F(),params:Q3.loose().optional()}),e6=si({_meta:J3.optional()}),t6=V([F(),I().int()]),sEe=B({jsonrpc:W(`2.0`),id:t6,...Z3.shape}).strict(),cEe=B({jsonrpc:W(`2.0`),...$3.shape}).strict(),n6=B({jsonrpc:W(`2.0`),id:t6,result:e6}).strict();var lEe;(function(e){e[e.ConnectionClosed=-32e3]=`ConnectionClosed`,e[e.RequestTimeout=-32001]=`RequestTimeout`,e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`})(lEe||={});const r6=B({jsonrpc:W(`2.0`),id:t6.optional(),error:B({code:I().int(),message:F(),data:R().optional()})}).strict();V([sEe,cEe,n6,r6]),V([n6,r6]);const i6=e6.strict(),uEe=Q3.extend({requestId:t6.optional(),reason:F().optional()}),a6=$3.extend({method:W(`notifications/cancelled`),params:uEe}),o6=B({icons:z(B({src:F(),mimeType:F().optional(),sizes:z(F()).optional(),theme:U([`light`,`dark`]).optional()})).optional()}),s6=B({name:F(),title:F().optional()}),c6=s6.extend({...s6.shape,...o6.shape,version:F(),websiteUrl:F().optional(),description:F().optional()}),dEe=Fi(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,fi(B({form:fi(B({applyDefaults:L().optional()}),H(F(),R())).optional(),url:G3.optional()}),H(F(),R()).optional())),fEe=si({list:G3.optional(),cancel:G3.optional(),requests:si({sampling:si({createMessage:G3.optional()}).optional(),elicitation:si({create:G3.optional()}).optional()}).optional()}),pEe=si({list:G3.optional(),cancel:G3.optional(),requests:si({tools:si({call:G3.optional()}).optional()}).optional()}),mEe=B({experimental:H(F(),G3).optional(),sampling:B({context:G3.optional(),tools:G3.optional()}).optional(),elicitation:dEe.optional(),roots:B({listChanged:L().optional()}).optional(),tasks:fEe.optional(),extensions:H(F(),G3).optional()}),hEe=Y3.extend({protocolVersion:F(),capabilities:mEe,clientInfo:c6}),gEe=Z3.extend({method:W(`initialize`),params:hEe}),_Ee=B({experimental:H(F(),G3).optional(),logging:G3.optional(),completions:G3.optional(),prompts:B({listChanged:L().optional()}).optional(),resources:B({subscribe:L().optional(),listChanged:L().optional()}).optional(),tools:B({listChanged:L().optional()}).optional(),tasks:pEe.optional(),extensions:H(F(),G3).optional()}),vEe=e6.extend({protocolVersion:F(),capabilities:_Ee,serverInfo:c6,instructions:F().optional()}),yEe=$3.extend({method:W(`notifications/initialized`),params:Q3.optional()}),l6=Z3.extend({method:W(`ping`),params:Y3.optional()}),bEe=B({progress:I(),total:Si(I()),message:Si(F())}),xEe=B({...Q3.shape,...bEe.shape,progressToken:K3}),u6=$3.extend({method:W(`notifications/progress`),params:xEe}),SEe=Y3.extend({cursor:q3.optional()}),d6=Z3.extend({params:SEe.optional()}),f6=e6.extend({nextCursor:q3.optional()}),CEe=U([`working`,`input_required`,`completed`,`failed`,`cancelled`]),p6=B({taskId:F(),status:CEe,ttl:V([I(),ni()]),createdAt:F(),lastUpdatedAt:F(),pollInterval:Si(I()),statusMessage:Si(F())}),m6=e6.extend({task:p6}),wEe=Q3.merge(p6),h6=$3.extend({method:W(`notifications/tasks/status`),params:wEe}),g6=Z3.extend({method:W(`tasks/get`),params:Y3.extend({taskId:F()})}),_6=e6.merge(p6),v6=Z3.extend({method:W(`tasks/result`),params:Y3.extend({taskId:F()})});e6.loose();const y6=d6.extend({method:W(`tasks/list`)}),b6=f6.extend({tasks:z(p6)}),x6=Z3.extend({method:W(`tasks/cancel`),params:Y3.extend({taskId:F()})});e6.merge(p6);const S6=B({uri:F(),mimeType:Si(F()),_meta:H(F(),R()).optional()}),C6=S6.extend({text:F()}),w6=F().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),T6=S6.extend({blob:w6}),E6=U([`user`,`assistant`]),D6=B({audience:z(E6).optional(),priority:I().min(0).max(1).optional(),lastModified:Fr({offset:!0}).optional()}),O6=B({...s6.shape,...o6.shape,uri:F(),description:Si(F()),mimeType:Si(F()),size:Si(I()),annotations:D6.optional(),_meta:Si(si({}))}),TEe=B({...s6.shape,...o6.shape,uriTemplate:F(),description:Si(F()),mimeType:Si(F()),annotations:D6.optional(),_meta:Si(si({}))}),EEe=d6.extend({method:W(`resources/list`)}),DEe=f6.extend({resources:z(O6)}),OEe=d6.extend({method:W(`resources/templates/list`)}),kEe=f6.extend({resourceTemplates:z(TEe)}),k6=Y3.extend({uri:F()}),AEe=k6,jEe=Z3.extend({method:W(`resources/read`),params:AEe}),MEe=e6.extend({contents:z(V([C6,T6]))}),NEe=$3.extend({method:W(`notifications/resources/list_changed`),params:Q3.optional()}),PEe=k6,FEe=Z3.extend({method:W(`resources/subscribe`),params:PEe}),IEe=k6,LEe=Z3.extend({method:W(`resources/unsubscribe`),params:IEe}),REe=Q3.extend({uri:F()}),zEe=$3.extend({method:W(`notifications/resources/updated`),params:REe}),BEe=B({name:F(),description:Si(F()),required:Si(L())}),VEe=B({...s6.shape,...o6.shape,description:Si(F()),arguments:Si(z(BEe)),_meta:Si(si({}))}),HEe=d6.extend({method:W(`prompts/list`)}),UEe=f6.extend({prompts:z(VEe)}),WEe=Y3.extend({name:F(),arguments:H(F(),F()).optional()}),GEe=Z3.extend({method:W(`prompts/get`),params:WEe}),A6=B({type:W(`text`),text:F(),annotations:D6.optional(),_meta:H(F(),R()).optional()}),j6=B({type:W(`image`),data:w6,mimeType:F(),annotations:D6.optional(),_meta:H(F(),R()).optional()}),M6=B({type:W(`audio`),data:w6,mimeType:F(),annotations:D6.optional(),_meta:H(F(),R()).optional()}),KEe=B({type:W(`tool_use`),name:F(),id:F(),input:H(F(),R()),_meta:H(F(),R()).optional()}),qEe=B({type:W(`resource`),resource:V([C6,T6]),annotations:D6.optional(),_meta:H(F(),R()).optional()}),N6=V([A6,j6,M6,O6.extend({type:W(`resource_link`)}),qEe]),JEe=B({role:E6,content:N6}),YEe=e6.extend({description:F().optional(),messages:z(JEe)}),XEe=$3.extend({method:W(`notifications/prompts/list_changed`),params:Q3.optional()}),ZEe=B({title:F().optional(),readOnlyHint:L().optional(),destructiveHint:L().optional(),idempotentHint:L().optional(),openWorldHint:L().optional()}),QEe=B({taskSupport:U([`required`,`optional`,`forbidden`]).optional()}),P6=B({...s6.shape,...o6.shape,description:F().optional(),inputSchema:B({type:W(`object`),properties:H(F(),G3).optional(),required:z(F()).optional()}).catchall(R()),outputSchema:B({type:W(`object`),properties:H(F(),G3).optional(),required:z(F()).optional()}).catchall(R()).optional(),annotations:ZEe.optional(),execution:QEe.optional(),_meta:H(F(),R()).optional()}),$Ee=d6.extend({method:W(`tools/list`)}),eDe=f6.extend({tools:z(P6)}),F6=e6.extend({content:z(N6).default([]),structuredContent:H(F(),R()).optional(),isError:L().optional()});F6.or(e6.extend({toolResult:R()}));const tDe=X3.extend({name:F(),arguments:H(F(),R()).optional()}),nDe=Z3.extend({method:W(`tools/call`),params:tDe}),rDe=$3.extend({method:W(`notifications/tools/list_changed`),params:Q3.optional()});B({autoRefresh:L().default(!0),debounceMs:I().int().nonnegative().default(300)});const I6=U([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),iDe=Y3.extend({level:I6}),aDe=Z3.extend({method:W(`logging/setLevel`),params:iDe}),oDe=Q3.extend({level:I6,logger:F().optional(),data:R()}),sDe=$3.extend({method:W(`notifications/message`),params:oDe}),cDe=B({hints:z(B({name:F().optional()})).optional(),costPriority:I().min(0).max(1).optional(),speedPriority:I().min(0).max(1).optional(),intelligencePriority:I().min(0).max(1).optional()}),lDe=B({mode:U([`auto`,`required`,`none`]).optional()}),uDe=B({type:W(`tool_result`),toolUseId:F().describe(`The unique identifier for the corresponding tool call.`),content:z(N6).default([]),structuredContent:B({}).loose().optional(),isError:L().optional(),_meta:H(F(),R()).optional()}),dDe=ui(`type`,[A6,j6,M6]),L6=ui(`type`,[A6,j6,M6,KEe,uDe]),fDe=B({role:E6,content:V([L6,z(L6)]),_meta:H(F(),R()).optional()}),pDe=X3.extend({messages:z(fDe),modelPreferences:cDe.optional(),systemPrompt:F().optional(),includeContext:U([`none`,`thisServer`,`allServers`]).optional(),temperature:I().optional(),maxTokens:I().int(),stopSequences:z(F()).optional(),metadata:G3.optional(),tools:z(P6).optional(),toolChoice:lDe.optional()}),mDe=Z3.extend({method:W(`sampling/createMessage`),params:pDe}),hDe=e6.extend({model:F(),stopReason:Si(U([`endTurn`,`stopSequence`,`maxTokens`]).or(F())),role:E6,content:dDe}),gDe=e6.extend({model:F(),stopReason:Si(U([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(F())),role:E6,content:V([L6,z(L6)])}),_De=B({type:W(`boolean`),title:F().optional(),description:F().optional(),default:L().optional()}),vDe=B({type:W(`string`),title:F().optional(),description:F().optional(),minLength:I().optional(),maxLength:I().optional(),format:U([`email`,`uri`,`date`,`date-time`]).optional(),default:F().optional()}),yDe=B({type:U([`number`,`integer`]),title:F().optional(),description:F().optional(),minimum:I().optional(),maximum:I().optional(),default:I().optional()}),bDe=B({type:W(`string`),title:F().optional(),description:F().optional(),enum:z(F()),default:F().optional()}),xDe=B({type:W(`string`),title:F().optional(),description:F().optional(),oneOf:z(B({const:F(),title:F()})),default:F().optional()}),SDe=V([V([B({type:W(`string`),title:F().optional(),description:F().optional(),enum:z(F()),enumNames:z(F()).optional(),default:F().optional()}),V([bDe,xDe]),V([B({type:W(`array`),title:F().optional(),description:F().optional(),minItems:I().optional(),maxItems:I().optional(),items:B({type:W(`string`),enum:z(F())}),default:z(F()).optional()}),B({type:W(`array`),title:F().optional(),description:F().optional(),minItems:I().optional(),maxItems:I().optional(),items:B({anyOf:z(B({const:F(),title:F()}))}),default:z(F()).optional()})])]),_De,vDe,yDe]),CDe=V([X3.extend({mode:W(`form`).optional(),message:F(),requestedSchema:B({type:W(`object`),properties:H(F(),SDe),required:z(F()).optional()})}),X3.extend({mode:W(`url`),message:F(),elicitationId:F(),url:F().url()})]),wDe=Z3.extend({method:W(`elicitation/create`),params:CDe}),TDe=Q3.extend({elicitationId:F()}),EDe=$3.extend({method:W(`notifications/elicitation/complete`),params:TDe}),DDe=e6.extend({action:U([`accept`,`decline`,`cancel`]),content:Fi(e=>e===null?void 0:e,H(F(),V([F(),I(),L(),z(F())])).optional())}),ODe=B({type:W(`ref/resource`),uri:F()}),kDe=B({type:W(`ref/prompt`),name:F()}),ADe=Y3.extend({ref:V([kDe,ODe]),argument:B({name:F(),value:F()}),context:B({arguments:H(F(),F()).optional()}).optional()}),jDe=Z3.extend({method:W(`completion/complete`),params:ADe}),MDe=e6.extend({completion:si({values:z(F()).max(100),total:Si(I().int()),hasMore:Si(L())})}),NDe=B({uri:F().startsWith(`file://`),name:F().optional(),_meta:H(F(),R()).optional()}),PDe=Z3.extend({method:W(`roots/list`),params:Y3.optional()}),FDe=e6.extend({roots:z(NDe)}),IDe=$3.extend({method:W(`notifications/roots/list_changed`),params:Q3.optional()});V([l6,gEe,jDe,aDe,GEe,HEe,EEe,OEe,jEe,FEe,LEe,nDe,$Ee,g6,v6,y6,x6]),V([a6,u6,yEe,IDe,h6]),V([i6,hDe,gDe,DDe,FDe,_6,b6,m6]),V([l6,mDe,wDe,PDe,g6,v6,y6,x6]),V([a6,u6,sDe,zEe,NEe,rDe,XEe,h6,EDe]),V([i6,vEe,MDe,YEe,UEe,DEe,kEe,MEe,F6,eDe,_6,b6,m6]);var LDe;(function(e){e.Completable=`McpCompletable`})(LDe||={});var RDe=global.Request,R6=class extends RDe{constructor(e,t){typeof e==`object`&&z6 in e&&(e=e[z6]()),t?.body?.getReader!==void 0&&(t.duplex??=`half`),super(e,t)}},zDe=e=>{let t=[],n=e.rawHeaders;for(let e=0;e<n.length;e+=2){let{[e]:r,[e+1]:i}=n;r.charCodeAt(0)!==58&&t.push([r,i])}return new Headers(t)},BDe=Symbol(`wrapBodyStream`),VDe=(e,t,n,r,i)=>{let a={method:e,headers:n,signal:i.signal};if(e===`TRACE`){a.method=`GET`;let e=new R6(t,a);return Object.defineProperty(e,"method",{get(){return`TRACE`}}),e}if(e!==`GET`&&e!==`HEAD`){if(`rawBody`in r&&r.rawBody instanceof Buffer)a.body=new ReadableStream({start(e){e.enqueue(r.rawBody),e.close()}});else if(r[BDe]){let e;a.body=new ReadableStream({async pull(t){try{e||=Le.toWeb(r).getReader();let{done:n,value:i}=await e.read();n?t.close():t.enqueue(i)}catch(e){t.error(e)}}})}else a.body=Le.toWeb(r)}return new R6(t,a)},z6=Symbol(`getRequestCache`),B6=Symbol(`requestCache`),V6=Symbol(`incomingKey`),H6=Symbol(`urlKey`),HDe=Symbol(`headersKey`),U6=Symbol(`abortControllerKey`),W6={get method(){return this[V6].method||`GET`},get url(){return this[H6]},get headers(){return this[HDe]||=zDe(this[V6])},[Symbol(`getAbortController`)](){return this[z6](),this[U6]},[z6](){return this[U6]||=new AbortController,this[B6]||=VDe(this.method,this[H6],this.headers,this[V6],this[U6])}};[`body`,`bodyUsed`,`cache`,`credentials`,`destination`,`integrity`,`mode`,`redirect`,`referrer`,`referrerPolicy`,`signal`,`keepalive`].forEach(e=>{Object.defineProperty(W6,e,{get(){return this[z6]()[e]}})}),[`arrayBuffer`,`blob`,`clone`,`formData`,`json`,`text`].forEach(e=>{Object.defineProperty(W6,e,{value:function(){return this[z6]()[e]()}})}),Object.defineProperty(W6,Symbol.for(`nodejs.util.inspect.custom`),{value:function(e,t,n){return`Request (lightweight) ${n({method:this.method,url:this.url,headers:this.headers,nativeRequest:this[B6]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf(W6,R6.prototype);var G6=Symbol(`responseCache`),K6=Symbol(`getResponseCache`),q6=Symbol(`cache`),J6=global.Response,Y6=class e{#e;#t;[K6](){return delete this[q6],this[G6]||=new J6(this.#e,this.#t)}constructor(t,n){let r;if(this.#e=t,n instanceof e){let e=n[G6];if(e){this.#t=e,this[K6]();return}this.#t=n.#t,r=new Headers(n.#t.headers)}else this.#t=n;(typeof t==`string`||t?.getReader!==void 0||t instanceof Blob||t instanceof Uint8Array)&&(this[q6]=[n?.status||200,t,r||n?.headers])}get headers(){let e=this[q6];return e?(e[2]instanceof Headers||(e[2]=new Headers(e[2]||{"content-type":`text/plain; charset=UTF-8`})),e[2]):this[K6]().headers}get status(){return this[q6]?.[0]??this[K6]().status}get ok(){let e=this.status;return e>=200&&e<300}};[`body`,`bodyUsed`,`redirected`,`statusText`,`trailers`,`type`,`url`].forEach(e=>{Object.defineProperty(Y6.prototype,e,{get(){return this[K6]()[e]}})}),[`arrayBuffer`,`blob`,`clone`,`formData`,`json`,`text`].forEach(e=>{Object.defineProperty(Y6.prototype,e,{value:function(){return this[K6]()[e]()}})}),Object.defineProperty(Y6.prototype,Symbol.for(`nodejs.util.inspect.custom`),{value:function(e,t,n){return`Response (lightweight) ${n({status:this.status,headers:this.headers,ok:this.ok,nativeResponse:this[G6]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf(Y6,J6),Object.setPrototypeOf(Y6.prototype,J6.prototype),global.crypto===void 0&&(global.crypto=Ie);var UDe=i(((e,t)=>{var n=[`||`,`&&`,`;;`,`|&`,`<(`,`<<<`,`>>`,`>&`,`<&`,`&`,`;`,`(`,`)`,`|`,`<`,`>`],r=/[\n\r\u2028\u2029]/,i=/[\s#!"$&'():;<=>@\\^`|]/g;t.exports=function(e){return e.map(function(e){if(e===``)return`''`;if(e&&typeof e==`object`){if(`op`in e&&e.op===`glob`){if(typeof e.pattern!=`string`)throw TypeError("glob token requires a string `pattern`");if(r.test(e.pattern))throw TypeError("glob `pattern` must not contain line terminators");return e.pattern.replace(i,`\\$&`)}if(`op`in e&&typeof e.op==`string`){if(n.indexOf(e.op)<0)throw TypeError("invalid `op` value: "+JSON.stringify(e.op));return e.op.replace(/[\s\S]/g,`\\$&`)}if(`comment`in e&&typeof e.comment==`string`){if(r.test(e.comment))throw TypeError("`comment` must not contain line terminators");return`#`+e.comment}throw TypeError(`unrecognized object token shape`)}return/["\s\\]/.test(e)&&!/'/.test(e)?`'`+e.replace(/(['])/g,`\\$1`)+`'`:/["'\s]/.test(e)?`"`+e.replace(/(["\\$`!])/g,`\\$1`)+`"`:String(e).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}~])/g,`$1\\$2`)}).join(` `)}})),WDe=i(((e,t)=>{for(var n=`(?:`+[`\\|\\|`,`\\&\\&`,`;;`,`\\|\\&`,`\\<\\(`,`\\<\\<\\<`,`>>`,`>\\&`,`<\\&`,`[&;()|<>]`].join(`|`)+`)`,r=RegExp(`^`+n+`$`),i=`|&;()<> \\t`,a=`'([^']*?)'`,o=`"((\\\\"|[^"])*?)"`,s=/^#$/,c=`'`,l=`"`,u=`$`,d=``,f=4294967296,p=0;p<4;p++)d+=(f*Math.random()).toString(16);var m=RegExp(`^`+d);function h(e,t){for(var n=t.lastIndex,r=[],i;i=t.exec(e);)r[r.length]=i,t.lastIndex===i.index&&(t.lastIndex+=1);return t.lastIndex=n,r}function g(e,t,n){var r=typeof e==`function`?e(n):e[n];return r===void 0&&n!=``?r=``:r===void 0&&(r=`$`),typeof r==`object`?t+d+JSON.stringify(r)+d:t+r}function _(e,t,d){d||={};var f=d.escape||`\\`,p=d.splitUnquoted===!0?`
|
|
736
738
|
`:typeof d.splitUnquoted==`string`?d.splitUnquoted:``,m=`(\\`+f+`['"`+i+`]|[^\\s'"`+i+`])+`,_=h(e,new RegExp([`(`+n+`)`,`(`+m+`|`+o+`|`+a+`)+`].join(`|`),`g`));if(_.length===0)return[];t||={};var v=!1;return _.map(function(n){var i=n[0];if(!i||v)return;if(r.test(i))return{op:i};var a=!1,o=!1,d=``,m=[],h=!1,_=null,y=!1,b;function x(){b+=1;var e,n,r=i.charAt(b);if(r===`{`){if(b+=1,i.charAt(b)===`}`)throw Error(`Bad substitution: `+i.slice(b-2,b+1));var a=1;for(e=b;a>0&&e<i.length;)i.charAt(e)===`{`&&i.charAt(e-1)===`$`?a+=1:i.charAt(e)===`}`&&--a,e+=1;if(a!==0)throw Error(`Bad substitution: `+i.slice(b));--e,n=i.slice(b,e),b=e}else if(/[*@#?$!_-]/.test(r))n=r,b+=1;else{var o=i.slice(b);e=o.match(/[^\w\d_]/),e?(n=o.slice(0,e.index),b+=e.index-1):(n=o,b=i.length)}return g(t,``,n)}function S(){if(_!==null){if(_===0)d!==``&&(m[m.length]=d,d=``);else{m[m.length]=d,d=``;for(var e=1;e<_;e+=1)m[m.length]=``}_=null}}for(b=0;b<i.length;b++){var C=i.charAt(b);if(p&&C!==u&&S(),y||=!a&&(C===`*`||C===`?`),o)d+=C,o=!1;else if(a)C===a?a=!1:a==c?d+=C:C===f?(b+=1,C=i.charAt(b),d+=C===l||C===f||C===u?C:f+C):d+=C===u?x():C;else if(C===l||C===c)a=C,h=!0;else if(r.test(C))return{op:i};else if(s.test(C)){v=!0;var w={comment:e.slice(n.index+b+1)};return d.length?[d,w]:[w]}else if(C===f)o=!0;else if(C===u){var T=x();if(!p)d+=T;else for(var E=0;E<T.length;E+=1){var D=T.charAt(E);p.indexOf(D)<0?(S(),d+=D):_===null?_=D===` `||D===` `||D===`
|
|
737
739
|
`?0:1:D!==` `&&D!==` `&&D!==`
|
|
738
|
-
`&&(_+=1)}}else d+=C}if(y)return{op:`glob`,pattern:d};if(p){if(_!==null&&_>0){m[m.length]=d,d=``;for(var O=1;O<_;O+=1)m[m.length]=``}return(d!==``||h&&m.length===0)&&(m[m.length]=d),m}return d}).reduce(function(e,t){return t===void 0||[].concat(t).forEach(function(t){e[e.length]=t}),e},[])}t.exports=function(e,t,n){var r=_(e,t,n);return typeof t==`function`?r.reduce(function(e,t){if(typeof t==`object`)return e[e.length]=t,e;var n=t.split(RegExp(`(`+d+`.*?`+d+`)`,`g`));return n.length===1?(e[e.length]=n[0],e):(n.filter(Boolean).forEach(function(t){e[e.length]=m.test(t)?JSON.parse(t.split(d)[1]):t}),e)},[]):r}}));i((e=>{e.quote=HDe(),e.parse=UDe()}))();var X6;(function(e){e.EOF=`EOF`,e.NEWLINE=`NEWLINE`,e.SEMICOLON=`SEMICOLON`,e.AMP=`AMP`,e.PIPE=`PIPE`,e.PIPE_AMP=`PIPE_AMP`,e.AND_AND=`AND_AND`,e.OR_OR=`OR_OR`,e.BANG=`BANG`,e.LESS=`LESS`,e.GREAT=`GREAT`,e.DLESS=`DLESS`,e.DGREAT=`DGREAT`,e.LESSAND=`LESSAND`,e.GREATAND=`GREATAND`,e.LESSGREAT=`LESSGREAT`,e.DLESSDASH=`DLESSDASH`,e.CLOBBER=`CLOBBER`,e.TLESS=`TLESS`,e.AND_GREAT=`AND_GREAT`,e.AND_DGREAT=`AND_DGREAT`,e.LPAREN=`LPAREN`,e.RPAREN=`RPAREN`,e.LBRACE=`LBRACE`,e.RBRACE=`RBRACE`,e.DSEMI=`DSEMI`,e.SEMI_AND=`SEMI_AND`,e.SEMI_SEMI_AND=`SEMI_SEMI_AND`,e.DBRACK_START=`DBRACK_START`,e.DBRACK_END=`DBRACK_END`,e.DPAREN_START=`DPAREN_START`,e.DPAREN_END=`DPAREN_END`,e.IF=`IF`,e.THEN=`THEN`,e.ELSE=`ELSE`,e.ELIF=`ELIF`,e.FI=`FI`,e.FOR=`FOR`,e.WHILE=`WHILE`,e.UNTIL=`UNTIL`,e.DO=`DO`,e.DONE=`DONE`,e.CASE=`CASE`,e.ESAC=`ESAC`,e.IN=`IN`,e.FUNCTION=`FUNCTION`,e.SELECT=`SELECT`,e.TIME=`TIME`,e.COPROC=`COPROC`,e.WORD=`WORD`,e.NAME=`NAME`,e.NUMBER=`NUMBER`,e.ASSIGNMENT_WORD=`ASSIGNMENT_WORD`,e.FD_VARIABLE=`FD_VARIABLE`,e.COMMENT=`COMMENT`,e.HEREDOC_CONTENT=`HEREDOC_CONTENT`})(X6||={}),X6.IF,X6.THEN,X6.ELSE,X6.ELIF,X6.FI,X6.FOR,X6.WHILE,X6.UNTIL,X6.DO,X6.DONE,X6.CASE,X6.ESAC,X6.IN,X6.FUNCTION,X6.SELECT,X6.TIME,X6.COPROC,X6.SEMI_SEMI_AND,X6.TLESS,X6.AND_DGREAT,X6.DBRACK_START,X6.DBRACK_END,X6.DPAREN_START,X6.DPAREN_END,X6.AND_AND,X6.OR_OR,X6.DSEMI,X6.SEMI_AND,X6.PIPE_AMP,X6.DGREAT,X6.LESSAND,X6.GREATAND,X6.LESSGREAT,X6.CLOBBER,X6.AND_GREAT,X6.PIPE,X6.AMP,X6.SEMICOLON,X6.LPAREN,X6.RPAREN,X6.LESS,X6.GREAT,X6.LESS,X6.GREAT,X6.DLESS,X6.DGREAT,X6.LESSAND,X6.GREATAND,X6.LESSGREAT,X6.DLESSDASH,X6.CLOBBER,X6.TLESS,X6.AND_GREAT,X6.AND_DGREAT,X6.LESS,X6.GREAT,X6.DLESS,X6.DGREAT,X6.LESSAND,X6.GREATAND,X6.LESSGREAT,X6.DLESSDASH,X6.CLOBBER,X6.TLESS,X6.LESS,X6.GREAT,X6.DLESS,X6.DGREAT,X6.LESSAND,X6.GREATAND,X6.LESSGREAT,X6.DLESSDASH,X6.CLOBBER,X6.TLESS,X6.AND_GREAT,X6.AND_DGREAT,X6.AMP,X6.PIPE,X6.PIPE_AMP,X6.SEMICOLON,X6.AND_AND,X6.OR_OR,X6.DSEMI,X6.SEMI_AND,X6.SEMI_SEMI_AND;var Z6=[{name:`echo`,load:async()=>(await import(`./echo-O45JWWI2-DGiwQF55.mjs`)).echoCommand},{name:`cat`,load:async()=>(await import(`./cat-RDUMLXKC-m8-l0dJv.mjs`)).catCommand},{name:`printf`,load:async()=>(await import(`./printf-CX64KX2P-Br1Ug2Ut.mjs`)).printfCommand},{name:`ls`,load:async()=>(await import(`./ls-KSXFZCWH-CDtp05HC.mjs`)).lsCommand},{name:`mkdir`,load:async()=>(await import(`./mkdir-TDEMSB6C-uC_QraB2.mjs`)).mkdirCommand},{name:`rmdir`,load:async()=>(await import(`./rmdir-XTQXT7RK-Cw3ocqh1.mjs`)).rmdirCommand},{name:`touch`,load:async()=>(await import(`./touch-DX2IJOQ4-uq_8eRY4.mjs`)).touchCommand},{name:`rm`,load:async()=>(await import(`./rm-RTZG23RL-BnOWGONG.mjs`)).rmCommand},{name:`cp`,load:async()=>(await import(`./cp-XOYR4ABJ-D42CslL1.mjs`)).cpCommand},{name:`mv`,load:async()=>(await import(`./mv-Z6MORUFL-B9PTkiG2.mjs`)).mvCommand},{name:`ln`,load:async()=>(await import(`./ln-4TRFBYAT-C2NklMBi.mjs`)).lnCommand},{name:`chmod`,load:async()=>(await import(`./chmod-SYMGL4JA-DTlWPHuG.mjs`)).chmodCommand},{name:`pwd`,load:async()=>(await import(`./pwd-D4OZ7N27-P0N9Gpk_.mjs`)).pwdCommand},{name:`readlink`,load:async()=>(await import(`./readlink-MI4GCHJF-wDvdfdV7.mjs`)).readlinkCommand},{name:`head`,load:async()=>(await import(`./head-HT2B6D2J-9R__Yy5p.mjs`)).headCommand},{name:`tail`,load:async()=>(await import(`./tail-S5ULNTJU-CnLzyp7W.mjs`)).tailCommand},{name:`wc`,load:async()=>(await import(`./wc-TQB3VNOX-CKtInFV_.mjs`)).wcCommand},{name:`stat`,load:async()=>(await import(`./stat-BT5A227F-DTts8oaN.mjs`)).statCommand},{name:`grep`,load:async()=>(await import(`./grep-2HUTXO5U-Bvpc71YZ.mjs`)).grepCommand},{name:`fgrep`,load:async()=>(await import(`./grep-2HUTXO5U-Bvpc71YZ.mjs`)).fgrepCommand},{name:`egrep`,load:async()=>(await import(`./grep-2HUTXO5U-Bvpc71YZ.mjs`)).egrepCommand},{name:`rg`,load:async()=>(await import(`./rg-XNF3R3II-DKI4o3y8.mjs`)).rgCommand},{name:`sed`,load:async()=>(await import(`./sed-JAPPVBEU-y4kzwh-U.mjs`)).sedCommand},{name:`awk`,load:async()=>(await import(`./awk2-BBAGSFUB-wDlbOPdF.mjs`)).awkCommand2},{name:`sort`,load:async()=>(await import(`./sort-DCNRDA7U-BRNZXaM9.mjs`)).sortCommand},{name:`uniq`,load:async()=>(await import(`./uniq-SUNANL47-C_dQux5r.mjs`)).uniqCommand},{name:`comm`,load:async()=>(await import(`./comm-5SLSESQG-B160yVYr.mjs`)).commCommand},{name:`cut`,load:async()=>(await import(`./cut-OPC3VAGB-DyTb922x.mjs`)).cutCommand},{name:`paste`,load:async()=>(await import(`./paste-7N6AFSDS-BbuyICrx.mjs`)).pasteCommand},{name:`tr`,load:async()=>(await import(`./tr-2HXZRDSW-BjPZn8n7.mjs`)).trCommand},{name:`rev`,load:async()=>(await import(`./rev-XOSYPP45-DJ7MH0ty.mjs`)).rev},{name:`nl`,load:async()=>(await import(`./nl-U5YJDM32-BioDr4pn.mjs`)).nl},{name:`fold`,load:async()=>(await import(`./fold-LDSORVYE-DzcV-vp8.mjs`)).fold},{name:`expand`,load:async()=>(await import(`./expand-DTNXU4LQ-Bpnv4ghU.mjs`)).expand},{name:`unexpand`,load:async()=>(await import(`./unexpand-RGTMIGZM-kHLFypbk.mjs`)).unexpand},{name:`strings`,load:async()=>(await import(`./strings-7PLOGTPD-DcSwox5x.mjs`)).strings},{name:`split`,load:async()=>(await import(`./split-SITCSYCZ-CXEcy-ww.mjs`)).split},{name:`column`,load:async()=>(await import(`./column-WLPMMSTS-DL3_07Lu.mjs`)).column},{name:`join`,load:async()=>(await import(`./join-GG2LDHE5-B2crRcrv.mjs`)).join},{name:`tee`,load:async()=>(await import(`./tee-O7VXZDCO-CPDtNjnw.mjs`)).teeCommand},{name:`find`,load:async()=>(await import(`./find-DH2ALKQS-CVRGx4iG.mjs`)).findCommand},{name:`basename`,load:async()=>(await import(`./basename-AA2KJYZQ-CZ6ADlYI.mjs`)).basenameCommand},{name:`dirname`,load:async()=>(await import(`./dirname-LEMTZZFS-DuDN0dhi.mjs`)).dirnameCommand},{name:`tree`,load:async()=>(await import(`./tree-LYXBS7DC-CIx1Kfia.mjs`)).treeCommand},{name:`du`,load:async()=>(await import(`./du-WO2ENHXQ-DZrvHJqf.mjs`)).duCommand},{name:`env`,load:async()=>(await import(`./env-5EPCWSXR-Cbpw0Lim.mjs`)).envCommand},{name:`printenv`,load:async()=>(await import(`./env-5EPCWSXR-Cbpw0Lim.mjs`)).printenvCommand},{name:`alias`,load:async()=>(await import(`./alias-JE7RI5QX-DXCJ-qLD.mjs`)).aliasCommand},{name:`unalias`,load:async()=>(await import(`./alias-JE7RI5QX-DXCJ-qLD.mjs`)).unaliasCommand},{name:`history`,load:async()=>(await import(`./history-J4QRNGRO-Co6e9xUo.mjs`)).historyCommand},{name:`xargs`,load:async()=>(await import(`./xargs-I6EZUCYF-BxxszDkV.mjs`)).xargsCommand},{name:`true`,load:async()=>(await import(`./true-WHJNXCHG-w3ayCUR8.mjs`)).trueCommand},{name:`false`,load:async()=>(await import(`./true-WHJNXCHG-w3ayCUR8.mjs`)).falseCommand},{name:`clear`,load:async()=>(await import(`./clear-5CZ5X4YR-BIhQHuOh.mjs`)).clearCommand},{name:`bash`,load:async()=>(await import(`./bash-IJWYRKFO-DcYpwzkU.mjs`)).bashCommand},{name:`sh`,load:async()=>(await import(`./bash-IJWYRKFO-DcYpwzkU.mjs`)).shCommand},{name:`jq`,load:async()=>(await import(`./jq-LYZFFBZB-BMLmD0PS.mjs`)).jqCommand},{name:`base64`,load:async()=>(await import(`./base64-4YMZCVJ5-DWBbgBRj.mjs`)).base64Command},{name:`diff`,load:async()=>(await import(`./diff-HJF2MPDN-DmTjb9f0.mjs`)).diffCommand},{name:`date`,load:async()=>(await import(`./date-DD7FVA2V-BSrLXaCI.mjs`)).dateCommand},{name:`sleep`,load:async()=>(await import(`./sleep-VZFPZFWA-DPmPUpYL.mjs`)).sleepCommand},{name:`timeout`,load:async()=>(await import(`./timeout-VRKMCG72-G3DVszag.mjs`)).timeoutCommand},{name:`time`,load:async()=>(await import(`./time-DEUO3QV2-CdVsJ04Z.mjs`)).timeCommand},{name:`seq`,load:async()=>(await import(`./seq-RN5ZUASB-PVf-rQ-S.mjs`)).seqCommand},{name:`expr`,load:async()=>(await import(`./expr-YYCVMXE3-BDOVRayn.mjs`)).exprCommand},{name:`md5sum`,load:async()=>(await import(`./md5sum-INMIK4DX-CRDOz6nr.mjs`)).md5sumCommand},{name:`sha1sum`,load:async()=>(await import(`./sha1sum-VJPNLNU6-BU98q8gr.mjs`)).sha1sumCommand},{name:`sha256sum`,load:async()=>(await import(`./sha256sum-PI32XWXY-CeL32a6r.mjs`)).sha256sumCommand},{name:`file`,load:async()=>(await import(`./file-IGDTDPLG-CUqZAlKT.mjs`)).fileCommand},{name:`html-to-markdown`,load:async()=>(await import(`./html-to-markdown-TFCECAGV-BDXFAacx.mjs`)).htmlToMarkdownCommand},{name:`help`,load:async()=>(await import(`./help-VVWX7SA5-Defr0Q9g.mjs`)).helpCommand},{name:`which`,load:async()=>(await import(`./which-XZHEH76L-BpfGDIeg.mjs`)).whichCommand},{name:`tac`,load:async()=>(await import(`./tac-SJGXQ4T2-vsCjLe3q.mjs`)).tac},{name:`hostname`,load:async()=>(await import(`./hostname-BK6HG2DE-CL_ll-mo.mjs`)).hostname},{name:`whoami`,load:async()=>(await import(`./whoami-DGKU3D2X-CbRRBIk3.mjs`)).whoami},{name:`od`,load:async()=>(await import(`./od-VJEF2UR5-DcvNzw_D.mjs`)).od},{name:`gzip`,load:async()=>(await import(`./gzip-AQXSGOVS-DkFr6f8Z.mjs`)).gzipCommand},{name:`gunzip`,load:async()=>(await import(`./gzip-AQXSGOVS-DkFr6f8Z.mjs`)).gunzipCommand},{name:`zcat`,load:async()=>(await import(`./gzip-AQXSGOVS-DkFr6f8Z.mjs`)).zcatCommand}];(typeof __BROWSER__>`u`||!__BROWSER__)&&(Z6.push({name:`tar`,load:async()=>(await import(`./tar-MZQD7NO4-JRjaVj6V.mjs`)).tarCommand}),Z6.push({name:`yq`,load:async()=>(await import(`./yq-OAKYHSXH-KGmxWF1Q.mjs`)).yqCommand}),Z6.push({name:`xan`,load:async()=>(await import(`./xan-UD7JYIL2-DmdWvgSg.mjs`)).xanCommand}),Z6.push({name:`sqlite3`,load:async()=>(await import(`./sqlite3-TE5AIOTF-DxxxT49W.mjs`)).sqlite3Command}));var Q6=[];(typeof __BROWSER__>`u`||!__BROWSER__)&&(Q6.push({name:`python3`,load:async()=>(await import(`./python3-DNGS4G3E-Cm5Hwa-u.mjs`)).python3Command}),Q6.push({name:`python`,load:async()=>(await import(`./python3-DNGS4G3E-Cm5Hwa-u.mjs`)).pythonCommand}));var $6=[];(typeof __BROWSER__>`u`||!__BROWSER__)&&($6.push({name:`js-exec`,load:async()=>(await import(`./js-exec-VXN6TZ7U-B4rL1N_3.mjs`)).jsExecCommand}),$6.push({name:`node`,load:async()=>(await import(`./js-exec-VXN6TZ7U-B4rL1N_3.mjs`)).nodeStubCommand})),new TextEncoder,Object.freeze({stdout:``,stderr:``,exitCode:0}),[...new Map([[`:`,[`: [arguments]`,`Null command.
|
|
740
|
+
`&&(_+=1)}}else d+=C}if(y)return{op:`glob`,pattern:d};if(p){if(_!==null&&_>0){m[m.length]=d,d=``;for(var O=1;O<_;O+=1)m[m.length]=``}return(d!==``||h&&m.length===0)&&(m[m.length]=d),m}return d}).reduce(function(e,t){return t===void 0||[].concat(t).forEach(function(t){e[e.length]=t}),e},[])}t.exports=function(e,t,n){var r=_(e,t,n);return typeof t==`function`?r.reduce(function(e,t){if(typeof t==`object`)return e[e.length]=t,e;var n=t.split(RegExp(`(`+d+`.*?`+d+`)`,`g`));return n.length===1?(e[e.length]=n[0],e):(n.filter(Boolean).forEach(function(t){e[e.length]=m.test(t)?JSON.parse(t.split(d)[1]):t}),e)},[]):r}}));i((e=>{e.quote=UDe(),e.parse=WDe()}))();var X6;(function(e){e.EOF=`EOF`,e.NEWLINE=`NEWLINE`,e.SEMICOLON=`SEMICOLON`,e.AMP=`AMP`,e.PIPE=`PIPE`,e.PIPE_AMP=`PIPE_AMP`,e.AND_AND=`AND_AND`,e.OR_OR=`OR_OR`,e.BANG=`BANG`,e.LESS=`LESS`,e.GREAT=`GREAT`,e.DLESS=`DLESS`,e.DGREAT=`DGREAT`,e.LESSAND=`LESSAND`,e.GREATAND=`GREATAND`,e.LESSGREAT=`LESSGREAT`,e.DLESSDASH=`DLESSDASH`,e.CLOBBER=`CLOBBER`,e.TLESS=`TLESS`,e.AND_GREAT=`AND_GREAT`,e.AND_DGREAT=`AND_DGREAT`,e.LPAREN=`LPAREN`,e.RPAREN=`RPAREN`,e.LBRACE=`LBRACE`,e.RBRACE=`RBRACE`,e.DSEMI=`DSEMI`,e.SEMI_AND=`SEMI_AND`,e.SEMI_SEMI_AND=`SEMI_SEMI_AND`,e.DBRACK_START=`DBRACK_START`,e.DBRACK_END=`DBRACK_END`,e.DPAREN_START=`DPAREN_START`,e.DPAREN_END=`DPAREN_END`,e.IF=`IF`,e.THEN=`THEN`,e.ELSE=`ELSE`,e.ELIF=`ELIF`,e.FI=`FI`,e.FOR=`FOR`,e.WHILE=`WHILE`,e.UNTIL=`UNTIL`,e.DO=`DO`,e.DONE=`DONE`,e.CASE=`CASE`,e.ESAC=`ESAC`,e.IN=`IN`,e.FUNCTION=`FUNCTION`,e.SELECT=`SELECT`,e.TIME=`TIME`,e.COPROC=`COPROC`,e.WORD=`WORD`,e.NAME=`NAME`,e.NUMBER=`NUMBER`,e.ASSIGNMENT_WORD=`ASSIGNMENT_WORD`,e.FD_VARIABLE=`FD_VARIABLE`,e.COMMENT=`COMMENT`,e.HEREDOC_CONTENT=`HEREDOC_CONTENT`})(X6||={}),X6.IF,X6.THEN,X6.ELSE,X6.ELIF,X6.FI,X6.FOR,X6.WHILE,X6.UNTIL,X6.DO,X6.DONE,X6.CASE,X6.ESAC,X6.IN,X6.FUNCTION,X6.SELECT,X6.TIME,X6.COPROC,X6.SEMI_SEMI_AND,X6.TLESS,X6.AND_DGREAT,X6.DBRACK_START,X6.DBRACK_END,X6.DPAREN_START,X6.DPAREN_END,X6.AND_AND,X6.OR_OR,X6.DSEMI,X6.SEMI_AND,X6.PIPE_AMP,X6.DGREAT,X6.LESSAND,X6.GREATAND,X6.LESSGREAT,X6.CLOBBER,X6.AND_GREAT,X6.PIPE,X6.AMP,X6.SEMICOLON,X6.LPAREN,X6.RPAREN,X6.LESS,X6.GREAT,X6.LESS,X6.GREAT,X6.DLESS,X6.DGREAT,X6.LESSAND,X6.GREATAND,X6.LESSGREAT,X6.DLESSDASH,X6.CLOBBER,X6.TLESS,X6.AND_GREAT,X6.AND_DGREAT,X6.LESS,X6.GREAT,X6.DLESS,X6.DGREAT,X6.LESSAND,X6.GREATAND,X6.LESSGREAT,X6.DLESSDASH,X6.CLOBBER,X6.TLESS,X6.LESS,X6.GREAT,X6.DLESS,X6.DGREAT,X6.LESSAND,X6.GREATAND,X6.LESSGREAT,X6.DLESSDASH,X6.CLOBBER,X6.TLESS,X6.AND_GREAT,X6.AND_DGREAT,X6.AMP,X6.PIPE,X6.PIPE_AMP,X6.SEMICOLON,X6.AND_AND,X6.OR_OR,X6.DSEMI,X6.SEMI_AND,X6.SEMI_SEMI_AND;var Z6=[{name:`echo`,load:async()=>(await import(`./echo-O45JWWI2-DGiwQF55.mjs`)).echoCommand},{name:`cat`,load:async()=>(await import(`./cat-RDUMLXKC-m8-l0dJv.mjs`)).catCommand},{name:`printf`,load:async()=>(await import(`./printf-CX64KX2P-Br1Ug2Ut.mjs`)).printfCommand},{name:`ls`,load:async()=>(await import(`./ls-KSXFZCWH-CDtp05HC.mjs`)).lsCommand},{name:`mkdir`,load:async()=>(await import(`./mkdir-TDEMSB6C-uC_QraB2.mjs`)).mkdirCommand},{name:`rmdir`,load:async()=>(await import(`./rmdir-XTQXT7RK-Cw3ocqh1.mjs`)).rmdirCommand},{name:`touch`,load:async()=>(await import(`./touch-DX2IJOQ4-uq_8eRY4.mjs`)).touchCommand},{name:`rm`,load:async()=>(await import(`./rm-RTZG23RL-BnOWGONG.mjs`)).rmCommand},{name:`cp`,load:async()=>(await import(`./cp-XOYR4ABJ-D42CslL1.mjs`)).cpCommand},{name:`mv`,load:async()=>(await import(`./mv-Z6MORUFL-B9PTkiG2.mjs`)).mvCommand},{name:`ln`,load:async()=>(await import(`./ln-4TRFBYAT-C2NklMBi.mjs`)).lnCommand},{name:`chmod`,load:async()=>(await import(`./chmod-SYMGL4JA-DTlWPHuG.mjs`)).chmodCommand},{name:`pwd`,load:async()=>(await import(`./pwd-D4OZ7N27-P0N9Gpk_.mjs`)).pwdCommand},{name:`readlink`,load:async()=>(await import(`./readlink-MI4GCHJF-wDvdfdV7.mjs`)).readlinkCommand},{name:`head`,load:async()=>(await import(`./head-HT2B6D2J-9R__Yy5p.mjs`)).headCommand},{name:`tail`,load:async()=>(await import(`./tail-S5ULNTJU-CnLzyp7W.mjs`)).tailCommand},{name:`wc`,load:async()=>(await import(`./wc-TQB3VNOX-CKtInFV_.mjs`)).wcCommand},{name:`stat`,load:async()=>(await import(`./stat-BT5A227F-DTts8oaN.mjs`)).statCommand},{name:`grep`,load:async()=>(await import(`./grep-2HUTXO5U-Bvpc71YZ.mjs`)).grepCommand},{name:`fgrep`,load:async()=>(await import(`./grep-2HUTXO5U-Bvpc71YZ.mjs`)).fgrepCommand},{name:`egrep`,load:async()=>(await import(`./grep-2HUTXO5U-Bvpc71YZ.mjs`)).egrepCommand},{name:`rg`,load:async()=>(await import(`./rg-XNF3R3II-DKI4o3y8.mjs`)).rgCommand},{name:`sed`,load:async()=>(await import(`./sed-JAPPVBEU-y4kzwh-U.mjs`)).sedCommand},{name:`awk`,load:async()=>(await import(`./awk2-BBAGSFUB-wDlbOPdF.mjs`)).awkCommand2},{name:`sort`,load:async()=>(await import(`./sort-DCNRDA7U-BRNZXaM9.mjs`)).sortCommand},{name:`uniq`,load:async()=>(await import(`./uniq-SUNANL47-C_dQux5r.mjs`)).uniqCommand},{name:`comm`,load:async()=>(await import(`./comm-5SLSESQG-B160yVYr.mjs`)).commCommand},{name:`cut`,load:async()=>(await import(`./cut-OPC3VAGB-DyTb922x.mjs`)).cutCommand},{name:`paste`,load:async()=>(await import(`./paste-7N6AFSDS-BbuyICrx.mjs`)).pasteCommand},{name:`tr`,load:async()=>(await import(`./tr-2HXZRDSW-BjPZn8n7.mjs`)).trCommand},{name:`rev`,load:async()=>(await import(`./rev-XOSYPP45-DJ7MH0ty.mjs`)).rev},{name:`nl`,load:async()=>(await import(`./nl-U5YJDM32-BioDr4pn.mjs`)).nl},{name:`fold`,load:async()=>(await import(`./fold-LDSORVYE-DzcV-vp8.mjs`)).fold},{name:`expand`,load:async()=>(await import(`./expand-DTNXU4LQ-Bpnv4ghU.mjs`)).expand},{name:`unexpand`,load:async()=>(await import(`./unexpand-RGTMIGZM-kHLFypbk.mjs`)).unexpand},{name:`strings`,load:async()=>(await import(`./strings-7PLOGTPD-DcSwox5x.mjs`)).strings},{name:`split`,load:async()=>(await import(`./split-SITCSYCZ-CXEcy-ww.mjs`)).split},{name:`column`,load:async()=>(await import(`./column-WLPMMSTS-DL3_07Lu.mjs`)).column},{name:`join`,load:async()=>(await import(`./join-GG2LDHE5-B2crRcrv.mjs`)).join},{name:`tee`,load:async()=>(await import(`./tee-O7VXZDCO-CPDtNjnw.mjs`)).teeCommand},{name:`find`,load:async()=>(await import(`./find-DH2ALKQS-CVRGx4iG.mjs`)).findCommand},{name:`basename`,load:async()=>(await import(`./basename-AA2KJYZQ-CZ6ADlYI.mjs`)).basenameCommand},{name:`dirname`,load:async()=>(await import(`./dirname-LEMTZZFS-DuDN0dhi.mjs`)).dirnameCommand},{name:`tree`,load:async()=>(await import(`./tree-LYXBS7DC-CIx1Kfia.mjs`)).treeCommand},{name:`du`,load:async()=>(await import(`./du-WO2ENHXQ-DZrvHJqf.mjs`)).duCommand},{name:`env`,load:async()=>(await import(`./env-5EPCWSXR-Cbpw0Lim.mjs`)).envCommand},{name:`printenv`,load:async()=>(await import(`./env-5EPCWSXR-Cbpw0Lim.mjs`)).printenvCommand},{name:`alias`,load:async()=>(await import(`./alias-JE7RI5QX-DXCJ-qLD.mjs`)).aliasCommand},{name:`unalias`,load:async()=>(await import(`./alias-JE7RI5QX-DXCJ-qLD.mjs`)).unaliasCommand},{name:`history`,load:async()=>(await import(`./history-J4QRNGRO-Co6e9xUo.mjs`)).historyCommand},{name:`xargs`,load:async()=>(await import(`./xargs-I6EZUCYF-BxxszDkV.mjs`)).xargsCommand},{name:`true`,load:async()=>(await import(`./true-WHJNXCHG-w3ayCUR8.mjs`)).trueCommand},{name:`false`,load:async()=>(await import(`./true-WHJNXCHG-w3ayCUR8.mjs`)).falseCommand},{name:`clear`,load:async()=>(await import(`./clear-5CZ5X4YR-BIhQHuOh.mjs`)).clearCommand},{name:`bash`,load:async()=>(await import(`./bash-IJWYRKFO-DcYpwzkU.mjs`)).bashCommand},{name:`sh`,load:async()=>(await import(`./bash-IJWYRKFO-DcYpwzkU.mjs`)).shCommand},{name:`jq`,load:async()=>(await import(`./jq-LYZFFBZB-BMLmD0PS.mjs`)).jqCommand},{name:`base64`,load:async()=>(await import(`./base64-4YMZCVJ5-DWBbgBRj.mjs`)).base64Command},{name:`diff`,load:async()=>(await import(`./diff-HJF2MPDN-DmTjb9f0.mjs`)).diffCommand},{name:`date`,load:async()=>(await import(`./date-DD7FVA2V-BSrLXaCI.mjs`)).dateCommand},{name:`sleep`,load:async()=>(await import(`./sleep-VZFPZFWA-DPmPUpYL.mjs`)).sleepCommand},{name:`timeout`,load:async()=>(await import(`./timeout-VRKMCG72-G3DVszag.mjs`)).timeoutCommand},{name:`time`,load:async()=>(await import(`./time-DEUO3QV2-CdVsJ04Z.mjs`)).timeCommand},{name:`seq`,load:async()=>(await import(`./seq-RN5ZUASB-PVf-rQ-S.mjs`)).seqCommand},{name:`expr`,load:async()=>(await import(`./expr-YYCVMXE3-BDOVRayn.mjs`)).exprCommand},{name:`md5sum`,load:async()=>(await import(`./md5sum-INMIK4DX-CRDOz6nr.mjs`)).md5sumCommand},{name:`sha1sum`,load:async()=>(await import(`./sha1sum-VJPNLNU6-BU98q8gr.mjs`)).sha1sumCommand},{name:`sha256sum`,load:async()=>(await import(`./sha256sum-PI32XWXY-CeL32a6r.mjs`)).sha256sumCommand},{name:`file`,load:async()=>(await import(`./file-IGDTDPLG-CUqZAlKT.mjs`)).fileCommand},{name:`html-to-markdown`,load:async()=>(await import(`./html-to-markdown-TFCECAGV-BDXFAacx.mjs`)).htmlToMarkdownCommand},{name:`help`,load:async()=>(await import(`./help-VVWX7SA5-Defr0Q9g.mjs`)).helpCommand},{name:`which`,load:async()=>(await import(`./which-XZHEH76L-BpfGDIeg.mjs`)).whichCommand},{name:`tac`,load:async()=>(await import(`./tac-SJGXQ4T2-vsCjLe3q.mjs`)).tac},{name:`hostname`,load:async()=>(await import(`./hostname-BK6HG2DE-CL_ll-mo.mjs`)).hostname},{name:`whoami`,load:async()=>(await import(`./whoami-DGKU3D2X-CbRRBIk3.mjs`)).whoami},{name:`od`,load:async()=>(await import(`./od-VJEF2UR5-DcvNzw_D.mjs`)).od},{name:`gzip`,load:async()=>(await import(`./gzip-AQXSGOVS-DkFr6f8Z.mjs`)).gzipCommand},{name:`gunzip`,load:async()=>(await import(`./gzip-AQXSGOVS-DkFr6f8Z.mjs`)).gunzipCommand},{name:`zcat`,load:async()=>(await import(`./gzip-AQXSGOVS-DkFr6f8Z.mjs`)).zcatCommand}];(typeof __BROWSER__>`u`||!__BROWSER__)&&(Z6.push({name:`tar`,load:async()=>(await import(`./tar-MZQD7NO4-JRjaVj6V.mjs`)).tarCommand}),Z6.push({name:`yq`,load:async()=>(await import(`./yq-OAKYHSXH-KGmxWF1Q.mjs`)).yqCommand}),Z6.push({name:`xan`,load:async()=>(await import(`./xan-UD7JYIL2-DmdWvgSg.mjs`)).xanCommand}),Z6.push({name:`sqlite3`,load:async()=>(await import(`./sqlite3-TE5AIOTF-DxxxT49W.mjs`)).sqlite3Command}));var Q6=[];(typeof __BROWSER__>`u`||!__BROWSER__)&&(Q6.push({name:`python3`,load:async()=>(await import(`./python3-DNGS4G3E-Cm5Hwa-u.mjs`)).python3Command}),Q6.push({name:`python`,load:async()=>(await import(`./python3-DNGS4G3E-Cm5Hwa-u.mjs`)).pythonCommand}));var $6=[];(typeof __BROWSER__>`u`||!__BROWSER__)&&($6.push({name:`js-exec`,load:async()=>(await import(`./js-exec-VXN6TZ7U-B4rL1N_3.mjs`)).jsExecCommand}),$6.push({name:`node`,load:async()=>(await import(`./js-exec-VXN6TZ7U-B4rL1N_3.mjs`)).nodeStubCommand})),new TextEncoder,Object.freeze({stdout:``,stderr:``,exitCode:0}),[...new Map([[`:`,[`: [arguments]`,`Null command.
|
|
739
741
|
No effect; the command does nothing.
|
|
740
742
|
Exit Status:
|
|
741
743
|
Always succeeds.`]],[`.`,[`. filename [arguments]`,`Execute commands from a file in the current shell.
|
|
@@ -1082,37 +1084,37 @@ caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?
|
|
|
1082
1084
|
job specification, and reports its termination status.
|
|
1083
1085
|
Exit Status:
|
|
1084
1086
|
Returns the status of the last ID; fails if ID is invalid or an invalid
|
|
1085
|
-
option is given.`]]]).keys()].sort(),new TextDecoder(`utf-8`,{fatal:!0});var e8=i(((e,t)=>{let n=[`nodebuffer`,`arraybuffer`,`fragments`],r=typeof Blob<`u`;r&&n.push(`blob`),t.exports={BINARY_TYPES:n,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:`258EAFA5-E914-47DA-95CA-C5AB0DC85B11`,hasBlob:r,kForOnEventAttribute:Symbol(`kIsForOnEventAttribute`),kListener:Symbol(`kListener`),kStatusCode:Symbol(`status-code`),kWebSocket:Symbol(`websocket`),NOOP:()=>{}}})),t8=i(((e,n)=>{let{EMPTY_BUFFER:r}=e8(),i=Buffer[Symbol.species];function a(e,t){if(e.length===0)return r;if(e.length===1)return e[0];let n=Buffer.allocUnsafe(t),a=0;for(let t=0;t<e.length;t++){let r=e[t];n.set(r,a),a+=r.length}return a<t?new i(n.buffer,n.byteOffset,a):n}function o(e,t,n,r,i){for(let a=0;a<i;a++)n[r+a]=e[a]^t[a&3]}function s(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}function c(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function l(e){if(l.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new i(e):ArrayBuffer.isView(e)?t=new i(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),l.readOnly=!1),t}if(n.exports={concat:a,mask:o,toArrayBuffer:c,toBuffer:l,unmask:s},!process.env.WS_NO_BUFFER_UTIL)try{let e=t(`bufferutil`);n.exports.mask=function(t,n,r,i,a){a<48?o(t,n,r,i,a):e.mask(t,n,r,i,a)},n.exports.unmask=function(t,n){t.length<32?s(t,n):e.unmask(t,n)}}catch{}})),WDe=i(((e,t)=>{let n=Symbol(`kDone`),r=Symbol(`kRun`);t.exports=class{constructor(e){this[n]=()=>{this.pending--,this[r]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[r]()}[r](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[n])}}}})),n8=i(((e,n)=>{let r=t(`zlib`),i=t8(),a=WDe(),{kStatusCode:o}=e8(),s=Buffer[Symbol.species],c=Buffer.from([0,0,255,255]),l=Symbol(`permessage-deflate`),u=Symbol(`total-length`),d=Symbol(`callback`),f=Symbol(`buffers`),p=Symbol(`error`),m;n.exports=class{constructor(e){if(this._options=e||{},this._threshold=this._options.threshold===void 0?1024:this._options.threshold,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!m){let e=this._options.concurrencyLimit===void 0?10:this._options.concurrencyLimit;m=new a(e)}}static get extensionName(){return`permessage-deflate`}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits??(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&=(this._inflate.close(),null),this._deflate){let e=this._deflate[d];this._deflate.close(),this._deflate=null,e&&e(Error(`The deflate stream was closed while data was being processed`))}}acceptAsServer(e){let t=this._options,n=e.find(e=>!(t.serverNoContextTakeover===!1&&e.server_no_context_takeover||e.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits==`number`&&t.serverMaxWindowBits>e.server_max_window_bits)||typeof t.clientMaxWindowBits==`number`&&!e.client_max_window_bits));if(!n)throw Error(`None of the extension offers can be accepted`);return t.serverNoContextTakeover&&(n.server_no_context_takeover=!0),t.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof t.serverMaxWindowBits==`number`&&(n.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits==`number`?n.client_max_window_bits=t.clientMaxWindowBits:(n.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw Error(`Unexpected parameter "client_no_context_takeover"`);if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits==`number`&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==`number`&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw Error(`Unexpected or invalid parameter "client_max_window_bits"`);return t}normalizeParams(e){return e.forEach(e=>{Object.keys(e).forEach(t=>{let n=e[t];if(n.length>1)throw Error(`Parameter "${t}" must have only a single value`);if(n=n[0],t===`client_max_window_bits`){if(n!==!0){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else if(t===`server_max_window_bits`){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(t===`client_no_context_takeover`||t===`server_no_context_takeover`){if(n!==!0)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else throw Error(`Unknown parameter "${t}"`);e[t]=n})}),e}decompress(e,t,n){m.add(r=>{this._decompress(e,t,(e,t)=>{r(),n(e,t)})})}compress(e,t,n){m.add(r=>{this._compress(e,t,(e,t)=>{r(),n(e,t)})})}_decompress(e,t,n){let a=this._isServer?`client`:`server`;if(!this._inflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:r.Z_DEFAULT_WINDOWBITS;this._inflate=r.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[l]=this,this._inflate[u]=0,this._inflate[f]=[],this._inflate.on(`error`,_),this._inflate.on(`data`,g)}this._inflate[d]=n,this._inflate.write(e),t&&this._inflate.write(c),this._inflate.flush(()=>{let e=this._inflate[p];if(e){this._inflate.close(),this._inflate=null,n(e);return}let r=i.concat(this._inflate[f],this._inflate[u]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[u]=0,this._inflate[f]=[],t&&this.params[`${a}_no_context_takeover`]&&this._inflate.reset()),n(null,r)})}_compress(e,t,n){let a=this._isServer?`server`:`client`;if(!this._deflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:r.Z_DEFAULT_WINDOWBITS;this._deflate=r.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[u]=0,this._deflate[f]=[],this._deflate.on(`data`,h)}this._deflate[d]=n,this._deflate.write(e),this._deflate.flush(r.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let e=i.concat(this._deflate[f],this._deflate[u]);t&&(e=new s(e.buffer,e.byteOffset,e.length-4)),this._deflate[d]=null,this._deflate[u]=0,this._deflate[f]=[],t&&this.params[`${a}_no_context_takeover`]&&this._deflate.reset(),n(null,e)})}};function h(e){this[f].push(e),this[u]+=e.length}function g(e){if(this[u]+=e.length,this[l]._maxPayload<1||this[u]<=this[l]._maxPayload){this[f].push(e);return}this[p]=RangeError(`Max payload size exceeded`),this[p].code=`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`,this[p][o]=1009,this.removeListener(`data`,g),this.reset()}function _(e){if(this[l]._inflate=null,this[p]){this[d](this[p]);return}e[o]=1007,this[d](e)}})),r8=i(((e,n)=>{let{isUtf8:r}=t(`buffer`),{hasBlob:i}=e8(),a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function o(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function s(e){let t=e.length,n=0;for(;n<t;)if(!(e[n]&128))n++;else if((e[n]&224)==192){if(n+1===t||(e[n+1]&192)!=128||(e[n]&254)==192)return!1;n+=2}else if((e[n]&240)==224){if(n+2>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||e[n]===224&&(e[n+1]&224)==128||e[n]===237&&(e[n+1]&224)==160)return!1;n+=3}else if((e[n]&248)==240){if(n+3>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||(e[n+3]&192)!=128||e[n]===240&&(e[n+1]&240)==128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}function c(e){return i&&typeof e==`object`&&typeof e.arrayBuffer==`function`&&typeof e.type==`string`&&typeof e.stream==`function`&&(e[Symbol.toStringTag]===`Blob`||e[Symbol.toStringTag]===`File`)}if(n.exports={isBlob:c,isValidStatusCode:o,isValidUTF8:s,tokenChars:a},r)n.exports.isValidUTF8=function(e){return e.length<24?s(e):r(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=t(`utf-8-validate`);n.exports.isValidUTF8=function(t){return t.length<32?s(t):e(t)}}catch{}})),i8=i(((e,n)=>{let{Writable:r}=t(`stream`),i=n8(),{BINARY_TYPES:a,EMPTY_BUFFER:o,kStatusCode:s,kWebSocket:c}=e8(),{concat:l,toArrayBuffer:u,unmask:d}=t8(),{isValidStatusCode:f,isValidUTF8:p}=r8(),m=Buffer[Symbol.species];n.exports=class extends r{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents===void 0||e.allowSynchronousEvents,this._binaryType=e.binaryType||a[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxBufferedChunks=e.maxBufferedChunks|0,this._maxFragments=e.maxFragments|0,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[c]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(e,t,n){if(this._opcode===8&&this._state==0)return n();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){n(this.createError(RangeError,`Too many buffered chunks`,!1,1008,`WS_ERR_TOO_MANY_BUFFERED_PARTS`));return}this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let t=this._buffers[0];return this._buffers[0]=new m(t.buffer,t.byteOffset+e,t.length-e),new m(t.buffer,t.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let n=this._buffers[0],r=t.length-e;e>=n.length?t.set(this._buffers.shift(),r):(t.set(new Uint8Array(n.buffer,n.byteOffset,e),r),this._buffers[0]=new m(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if(t[0]&48){e(this.createError(RangeError,`RSV2 and RSV3 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_2_3`));return}let n=(t[0]&64)==64;if(n&&!this._extensions[i.extensionName]){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._fin=(t[0]&128)==128,this._opcode=t[0]&15,this._payloadLength=t[1]&127,this._opcode===0){if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(!this._fragmented){e(this.createError(RangeError,`invalid opcode 0`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){e(this.createError(RangeError,`FIN must be set`,!0,1002,`WS_ERR_EXPECTED_FIN`));return}if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){e(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,`WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH`));return}}else{e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(t[1]&128)==128,this._isServer){if(!this._masked){e(this.createError(RangeError,`MASK must be set`,!0,1002,`WS_ERR_EXPECTED_MASK`));return}}else if(this._masked){e(this.createError(RangeError,`MASK must be clear`,!0,1002,`WS_ERR_UNEXPECTED_MASK`));return}this._payloadLength===126?this._state=1:this._payloadLength===127?this._state=2:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),n=t.readUInt32BE(0);if(n>2**21-1){e(this.createError(RangeError,`Unsupported WebSocket frame: payload length > 2^53 - 1`,!1,1009,`WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH`));return}this._payloadLength=n*2**32+t.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){e(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._state=this._masked?3:4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(e){let t=o;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&d(t,this._mask)}if(this._opcode>7){this.controlMessage(t,e);return}if(this._compressed){this._state=5,this.decompress(t,e);return}if(t.length){if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){e(this.createError(RangeError,`Too many message fragments`,!1,1008,`WS_ERR_TOO_MANY_BUFFERED_PARTS`));return}this._messageLength=this._totalPayloadLength,this._fragments.push(t)}this.dataMessage(e)}decompress(e,t){this._extensions[i.extensionName].decompress(e,this._fin,(e,n)=>{if(e)return t(e);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0){t(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){t(this.createError(RangeError,`Too many message fragments`,!1,1008,`WS_ERR_TOO_MANY_BUFFERED_PARTS`));return}this._fragments.push(n)}this.dataMessage(t),this._state===0&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=0;return}let t=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;r=this._binaryType===`nodebuffer`?l(n,t):this._binaryType===`arraybuffer`?u(l(n,t)):this._binaryType===`blob`?new Blob(n):n,this._allowSynchronousEvents?(this.emit(`message`,r,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!0),this._state=0,this.startLoop(e)}))}else{let r=l(n,t);if(!this._skipUTF8Validation&&!p(r)){e(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._state===5||this._allowSynchronousEvents?(this.emit(`message`,r,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!1),this._state=0,this.startLoop(e)}))}}controlMessage(e,t){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit(`conclude`,1005,o),this.end();else{let n=e.readUInt16BE(0);if(!f(n)){t(this.createError(RangeError,`invalid status code ${n}`,!0,1002,`WS_ERR_INVALID_CLOSE_CODE`));return}let r=new m(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!p(r)){t(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._loop=!1,this.emit(`conclude`,n,r),this.end()}this._state=0;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0):(this._state=6,setImmediate(()=>{this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0,this.startLoop(t)}))}createError(e,t,n,r,i){this._loop=!1,this._errored=!0;let a=new e(n?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(a,this.createError),a.code=i,a[s]=r,a}}})),a8=i(((e,n)=>{let{Duplex:r}=t(`stream`),{randomFillSync:i}=t(`crypto`),{types:{isUint8Array:a}}=t(`util`),o=n8(),{EMPTY_BUFFER:s,kWebSocket:c,NOOP:l}=e8(),{isBlob:u,isValidStatusCode:d}=r8(),{mask:f,toBuffer:p}=t8(),m=Symbol(`kByteLength`),h=Buffer.alloc(4),g=8192,_,v=g;n.exports=class e{constructor(e,t,n){this._extensions=t||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=l,this[c]=void 0}static frame(e,t){let n,r=!1,a=2,o=!1;t.mask&&(n=t.maskBuffer||h,t.generateMask?t.generateMask(n):(v===g&&(_===void 0&&(_=Buffer.alloc(g)),i(_,0,g),v=0),n[0]=_[v++],n[1]=_[v++],n[2]=_[v++],n[3]=_[v++]),o=(n[0]|n[1]|n[2]|n[3])===0,a=6);let s;typeof e==`string`?(!t.mask||o)&&t[m]!==void 0?s=t[m]:(e=Buffer.from(e),s=e.length):(s=e.length,r=t.mask&&t.readOnly&&!o);let c=s;s>=65536?(a+=8,c=127):s>125&&(a+=2,c=126);let l=Buffer.allocUnsafe(r?s+a:a);return l[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(l[0]|=64),l[1]=c,c===126?l.writeUInt16BE(s,2):c===127&&(l[2]=l[3]=0,l.writeUIntBE(s,4,6)),!t.mask||(l[1]|=128,l[a-4]=n[0],l[a-3]=n[1],l[a-2]=n[2],l[a-1]=n[3],o)?[l,e]:r?(f(e,n,l,a,s),[l]):(f(e,n,e,0,s),[l,e])}close(t,n,r,i){let o;if(t===void 0)o=s;else if(typeof t!=`number`||!d(t))throw TypeError(`First argument must be a valid error code number`);else if(n===void 0||!n.length)o=Buffer.allocUnsafe(2),o.writeUInt16BE(t,0);else{let e=Buffer.byteLength(n);if(e>123)throw RangeError(`The message must not be greater than 123 bytes`);if(o=Buffer.allocUnsafe(2+e),o.writeUInt16BE(t,0),typeof n==`string`)o.write(n,2);else if(a(n))o.set(n,2);else throw TypeError(`Second argument must be a string or a Uint8Array`)}let c={[m]:o.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state===0?this.sendFrame(e.frame(o,c),i):this.enqueue([this.dispatch,o,!1,c,i])}ping(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):u(t)?(i=t.size,a=!1):(t=p(t),i=t.length,a=p.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[m]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};u(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}pong(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):u(t)?(i=t.size,a=!1):(t=p(t),i=t.length,a=p.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[m]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};u(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}send(e,t,n){let r=this._extensions[o.extensionName],i=t.binary?2:1,a=t.compress,s,c;typeof e==`string`?(s=Buffer.byteLength(e),c=!1):u(e)?(s=e.size,c=!1):(e=p(e),s=e.length,c=p.readOnly),this._firstFragment?(this._firstFragment=!1,a&&r&&r.params[r._isServer?`server_no_context_takeover`:`client_no_context_takeover`]&&(a=s>=r._threshold),this._compress=a):(a=!1,i=0),t.fin&&(this._firstFragment=!0);let l={[m]:s,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:i,readOnly:c,rsv1:a};u(e)?this._state===0?this.getBlobData(e,this._compress,l,n):this.enqueue([this.getBlobData,e,this._compress,l,n]):this._state===0?this.dispatch(e,this._compress,l,n):this.enqueue([this.dispatch,e,this._compress,l,n])}getBlobData(t,n,r,i){this._bufferedBytes+=r[m],this._state=2,t.arrayBuffer().then(t=>{if(this._socket.destroyed){let e=Error(`The socket was closed while the blob was being read`);process.nextTick(y,this,e,i);return}this._bufferedBytes-=r[m];let a=p(t);n?this.dispatch(a,n,r,i):(this._state=0,this.sendFrame(e.frame(a,r),i),this.dequeue())}).catch(e=>{process.nextTick(b,this,e,i)})}dispatch(t,n,r,i){if(!n){this.sendFrame(e.frame(t,r),i);return}let a=this._extensions[o.extensionName];this._bufferedBytes+=r[m],this._state=1,a.compress(t,r.fin,(t,n)=>{if(this._socket.destroyed){let e=Error(`The socket was closed while data was being compressed`);y(this,e,i);return}this._bufferedBytes-=r[m],this._state=0,r.readOnly=!1,this.sendFrame(e.frame(n,r),i),this.dequeue()})}dequeue(){for(;this._state===0&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][m],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][m],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};function y(e,t,n){typeof n==`function`&&n(t);for(let n=0;n<e._queue.length;n++){let r=e._queue[n],i=r[r.length-1];typeof i==`function`&&i(t)}}function b(e,t,n){y(e,t,n),e.onerror(t)}})),GDe=i(((e,t)=>{let{kForOnEventAttribute:n,kListener:r}=e8(),i=Symbol(`kCode`),a=Symbol(`kData`),o=Symbol(`kError`),s=Symbol(`kMessage`),c=Symbol(`kReason`),l=Symbol(`kTarget`),u=Symbol(`kType`),d=Symbol(`kWasClean`);var f=class{constructor(e){this[l]=null,this[u]=e}get target(){return this[l]}get type(){return this[u]}};Object.defineProperty(f.prototype,"target",{enumerable:!0}),Object.defineProperty(f.prototype,"type",{enumerable:!0});var p=class extends f{constructor(e,t={}){super(e),this[i]=t.code===void 0?0:t.code,this[c]=t.reason===void 0?``:t.reason,this[d]=t.wasClean!==void 0&&t.wasClean}get code(){return this[i]}get reason(){return this[c]}get wasClean(){return this[d]}};Object.defineProperty(p.prototype,"code",{enumerable:!0}),Object.defineProperty(p.prototype,"reason",{enumerable:!0}),Object.defineProperty(p.prototype,"wasClean",{enumerable:!0});var m=class extends f{constructor(e,t={}){super(e),this[o]=t.error===void 0?null:t.error,this[s]=t.message===void 0?``:t.message}get error(){return this[o]}get message(){return this[s]}};Object.defineProperty(m.prototype,"error",{enumerable:!0}),Object.defineProperty(m.prototype,"message",{enumerable:!0});var h=class extends f{constructor(e,t={}){super(e),this[a]=t.data===void 0?null:t.data}get data(){return this[a]}};Object.defineProperty(h.prototype,"data",{enumerable:!0}),t.exports={CloseEvent:p,ErrorEvent:m,Event:f,EventTarget:{addEventListener(e,t,i={}){for(let a of this.listeners(e))if(!i[n]&&a[r]===t&&!a[n])return;let a;if(e===`message`)a=function(e,n){let r=new h(`message`,{data:n?e:e.toString()});r[l]=this,g(t,this,r)};else if(e===`close`)a=function(e,n){let r=new p(`close`,{code:e,reason:n.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[l]=this,g(t,this,r)};else if(e===`error`)a=function(e){let n=new m(`error`,{error:e,message:e.message});n[l]=this,g(t,this,n)};else if(e===`open`)a=function(){let e=new f(`open`);e[l]=this,g(t,this,e)};else return;a[n]=!!i[n],a[r]=t,i.once?this.once(e,a):this.on(e,a)},removeEventListener(e,t){for(let i of this.listeners(e))if(i[r]===t&&!i[n]){this.removeListener(e,i);break}}},MessageEvent:h};function g(e,t,n){typeof e==`object`&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}})),o8=i(((e,t)=>{let{tokenChars:n}=r8();function r(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}function i(e){let t=Object.create(null),i=Object.create(null),a=!1,o=!1,s=!1,c,l,u=-1,d=-1,f=-1,p=0;for(;p<e.length;p++)if(d=e.charCodeAt(p),c===void 0){if(f===-1&&n[d]===1)u===-1&&(u=p);else if(p!==0&&(d===32||d===9))f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);d===44?(r(t,n,i),i=Object.create(null)):c=n,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`)}else if(l===void 0){if(f===-1&&n[d]===1)u===-1&&(u=p);else if(d===32||d===9)f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p),r(i,e.slice(u,f),!0),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),u=f=-1}else if(d===61&&u!==-1&&f===-1)l=e.slice(u,p),u=f=-1;else throw SyntaxError(`Unexpected character at index ${p}`)}else if(o){if(n[d]!==1)throw SyntaxError(`Unexpected character at index ${p}`);u===-1?u=p:a||=!0,o=!1}else if(s){if(n[d]===1)u===-1&&(u=p);else if(d===34&&u!==-1)s=!1,f=p;else if(d===92)o=!0;else throw SyntaxError(`Unexpected character at index ${p}`)}else if(d===34&&e.charCodeAt(p-1)===61)s=!0;else if(f===-1&&n[d]===1)u===-1&&(u=p);else if(u!==-1&&(d===32||d===9))f===-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);a&&=(n=n.replace(/\\/g,``),!1),r(i,l,n),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),l=void 0,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);if(u===-1||s||d===32||d===9)throw SyntaxError(`Unexpected end of input`);f===-1&&(f=p);let m=e.slice(u,f);return c===void 0?r(t,m,i):(l===void 0?r(i,m,!0):a?r(i,l,m.replace(/\\/g,``)):r(i,l,m),r(t,c,i)),t}function a(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>[t].concat(Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>e===!0?t:`${t}=${e}`).join(`; `)})).join(`; `)).join(`, `)}).join(`, `)}t.exports={format:a,parse:i}})),s8=i(((e,n)=>{let r=t(`events`),i=t(`https`),a=t(`http`),o=t(`net`),s=t(`tls`),{randomBytes:c,createHash:l}=t(`crypto`),{Duplex:u,Readable:d}=t(`stream`),{URL:f}=t(`url`),p=n8(),m=i8(),h=a8(),{isBlob:g}=r8(),{BINARY_TYPES:_,CLOSE_TIMEOUT:v,EMPTY_BUFFER:y,GUID:b,kForOnEventAttribute:x,kListener:S,kStatusCode:C,kWebSocket:w,NOOP:T}=e8(),{EventTarget:{addEventListener:E,removeEventListener:D}}=GDe(),{format:O,parse:ee}=o8(),{toBuffer:te}=t8(),ne=Symbol(`kAborted`),re=[8,13],ie=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],ae=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;var oe=class e extends r{constructor(t,n,r){super(),this._binaryType=_[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=y,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol=``,this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t===null?(this._autoPong=r.autoPong,this._closeTimeout=r.closeTimeout,this._isServer=!0):(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,n===void 0?n=[]:Array.isArray(n)||(typeof n==`object`&&n?(r=n,n=[]):n=[n]),se(this,t,n,r))}get binaryType(){return this._binaryType}set binaryType(e){_.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,n,r){let i=new m({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:r.maxBufferedChunks,maxFragments:r.maxFragments,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),a=new h(t,this._extensions,r.generateMask);this._receiver=i,this._sender=a,this._socket=t,i[w]=this,a[w]=this,t[w]=this,i.on(`conclude`,j),i.on(`drain`,de),i.on(`error`,fe),i.on(`message`,me),i.on(`ping`,M),i.on(`pong`,he),a.onerror=N,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on(`close`,ve),t.on(`data`,ye),t.on(`end`,be),t.on(`error`,xe),this._readyState=e.OPEN,this.emit(`open`)}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage);return}this._extensions[p.extensionName]&&this._extensions[p.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage)}close(t,n){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){ue(this,this._req,`WebSocket was closed before the connection was established`);return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,n,!this._isServer,e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),_e(this)}}pause(){this.readyState!==e.CONNECTING&&this.readyState!==e.CLOSED&&(this._paused=!0,this._socket.pause())}ping(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){A(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.ping(t||y,n,r)}pong(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){A(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.pong(t||y,n,r)}resume(){this.readyState!==e.CONNECTING&&this.readyState!==e.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof n==`function`&&(r=n,n={}),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){A(this,t,r);return}let i={binary:typeof t!=`string`,mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[p.extensionName]||(i.compress=!1),this._sender.send(t||y,i,r)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){ue(this,this._req,`WebSocket was closed before the connection was established`);return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(oe,"CONNECTING",{enumerable:!0,value:ie.indexOf(`CONNECTING`)}),Object.defineProperty(oe.prototype,"CONNECTING",{enumerable:!0,value:ie.indexOf(`CONNECTING`)}),Object.defineProperty(oe,"OPEN",{enumerable:!0,value:ie.indexOf(`OPEN`)}),Object.defineProperty(oe.prototype,"OPEN",{enumerable:!0,value:ie.indexOf(`OPEN`)}),Object.defineProperty(oe,"CLOSING",{enumerable:!0,value:ie.indexOf(`CLOSING`)}),Object.defineProperty(oe.prototype,"CLOSING",{enumerable:!0,value:ie.indexOf(`CLOSING`)}),Object.defineProperty(oe,"CLOSED",{enumerable:!0,value:ie.indexOf(`CLOSED`)}),Object.defineProperty(oe.prototype,"CLOSED",{enumerable:!0,value:ie.indexOf(`CLOSED`)}),[`binaryType`,`bufferedAmount`,`extensions`,`isPaused`,`protocol`,`readyState`,`url`].forEach(e=>{Object.defineProperty(oe.prototype,e,{enumerable:!0})}),[`open`,`error`,`close`,`message`].forEach(e=>{Object.defineProperty(oe.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[x])return t[S];return null},set(t){for(let t of this.listeners(e))if(t[x]){this.removeListener(e,t);break}typeof t==`function`&&this.addEventListener(e,t,{[x]:!0})}})}),oe.prototype.addEventListener=E,oe.prototype.removeEventListener=D,n.exports=oe;function se(e,t,n,r){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:v,protocolVersion:re[1],maxBufferedChunks:1048576,maxFragments:131072,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:`GET`,host:void 0,path:void 0,port:void 0};if(e._autoPong=o.autoPong,e._closeTimeout=o.closeTimeout,!re.includes(o.protocolVersion))throw RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${re.join(`, `)})`);let s;if(t instanceof f)s=t;else try{s=new f(t)}catch{throw SyntaxError(`Invalid URL: ${t}`)}s.protocol===`http:`?s.protocol=`ws:`:s.protocol===`https:`&&(s.protocol=`wss:`),e._url=s.href;let u=s.protocol===`wss:`,d=s.protocol===`ws+unix:`,m;if(s.protocol!==`ws:`&&!u&&!d?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:d&&!s.pathname?m=`The URL's pathname is empty`:s.hash&&(m=`The URL contains a fragment identifier`),m){let t=SyntaxError(m);if(e._redirects===0)throw t;k(e,t);return}let h=u?443:80,g=c(16).toString(`base64`),_=u?i.request:a.request,y=new Set,x;if(o.createConnection=o.createConnection||(u?le:ce),o.defaultPort=o.defaultPort||h,o.port=s.port||h,o.host=s.hostname.startsWith(`[`)?s.hostname.slice(1,-1):s.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":g,Connection:`Upgrade`,Upgrade:`websocket`},o.path=s.pathname+s.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(x=new p({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers[`Sec-WebSocket-Extensions`]=O({[p.extensionName]:x.offer()})),n.length){for(let e of n){if(typeof e!=`string`||!ae.test(e)||y.has(e))throw SyntaxError(`An invalid or duplicated subprotocol was specified`);y.add(e)}o.headers[`Sec-WebSocket-Protocol`]=n.join(`,`)}if(o.origin&&(o.protocolVersion<13?o.headers[`Sec-WebSocket-Origin`]=o.origin:o.headers.Origin=o.origin),(s.username||s.password)&&(o.auth=`${s.username}:${s.password}`),d){let e=o.path.split(`:`);o.socketPath=e[0],o.path=e[1]}let S;if(o.followRedirects){if(e._redirects===0){e._originalIpc=d,e._originalSecure=u,e._originalHostOrSocketPath=d?o.socketPath:s.host;let t=r&&r.headers;if(r={...r,headers:{}},t)for(let[e,n]of Object.entries(t))r.headers[e.toLowerCase()]=n}else if(e.listenerCount(`redirect`)===0){let t=d?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:!e._originalIpc&&s.host===e._originalHostOrSocketPath;(!t||e._originalSecure&&!u)&&(delete o.headers.authorization,delete o.headers.cookie,t||delete o.headers.host,o.auth=void 0)}o.auth&&!r.headers.authorization&&(r.headers.authorization=`Basic `+Buffer.from(o.auth).toString(`base64`)),S=e._req=_(o),e._redirects&&e.emit(`redirect`,e.url,S)}else S=e._req=_(o);o.timeout&&S.on(`timeout`,()=>{ue(e,S,`Opening handshake has timed out`)}),S.on(`error`,t=>{S===null||S[ne]||(S=e._req=null,k(e,t))}),S.on(`response`,i=>{let a=i.headers.location,s=i.statusCode;if(a&&o.followRedirects&&s>=300&&s<400){if(++e._redirects>o.maxRedirects){ue(e,S,`Maximum redirects exceeded`);return}S.abort();let i;try{i=new f(a,t)}catch{k(e,SyntaxError(`Invalid URL: ${a}`));return}se(e,i,n,r)}else e.emit(`unexpected-response`,S,i)||ue(e,S,`Unexpected server response: ${i.statusCode}`)}),S.on(`upgrade`,(t,n,r)=>{if(e.emit(`upgrade`,t),e.readyState!==oe.CONNECTING)return;S=e._req=null;let i=t.headers.upgrade;if(i===void 0||i.toLowerCase()!==`websocket`){ue(e,n,`Invalid Upgrade header`);return}let a=l(`sha1`).update(g+b).digest(`base64`);if(t.headers[`sec-websocket-accept`]!==a){ue(e,n,`Invalid Sec-WebSocket-Accept header`);return}let s=t.headers[`sec-websocket-protocol`],c;if(s===void 0?y.size&&(c=`Server sent no subprotocol`):y.size?y.has(s)||(c=`Server sent an invalid subprotocol`):c=`Server sent a subprotocol but none was requested`,c){ue(e,n,c);return}s&&(e._protocol=s);let u=t.headers[`sec-websocket-extensions`];if(u!==void 0){if(!x){ue(e,n,`Server sent a Sec-WebSocket-Extensions header but no extension was requested`);return}let t;try{t=ee(u)}catch{ue(e,n,`Invalid Sec-WebSocket-Extensions header`);return}let r=Object.keys(t);if(r.length!==1||r[0]!==p.extensionName){ue(e,n,`Server indicated an extension that was not requested`);return}try{x.accept(t[p.extensionName])}catch{ue(e,n,`Invalid Sec-WebSocket-Extensions header`);return}e._extensions[p.extensionName]=x}e.setSocket(n,r,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(S,e):S.end()}function k(e,t){e._readyState=oe.CLOSING,e._errorEmitted=!0,e.emit(`error`,t),e.emitClose()}function ce(e){return e.path=e.socketPath,o.connect(e)}function le(e){return e.path=void 0,!e.servername&&e.servername!==``&&(e.servername=o.isIP(e.host)?``:e.host),s.connect(e)}function ue(e,t,n){e._readyState=oe.CLOSING;let r=Error(n);Error.captureStackTrace(r,ue),t.setHeader?(t[ne]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(k,e,r)):(t.destroy(r),t.once(`error`,e.emit.bind(e,`error`)),t.once(`close`,e.emitClose.bind(e)))}function A(e,t,n){if(t){let n=g(t)?t.size:te(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(n){let t=Error(`WebSocket is not open: readyState ${e.readyState} (${ie[e.readyState]})`);process.nextTick(n,t)}}function j(e,t){let n=this[w];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[w]!==void 0&&(n._socket.removeListener(`data`,ye),process.nextTick(ge,n._socket),e===1005?n.close():n.close(e,t))}function de(){let e=this[w];e.isPaused||e._socket.resume()}function fe(e){let t=this[w];t._socket[w]!==void 0&&(t._socket.removeListener(`data`,ye),process.nextTick(ge,t._socket),t.close(e[C])),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e))}function pe(){this[w].emitClose()}function me(e,t){this[w].emit(`message`,e,t)}function M(e){let t=this[w];t._autoPong&&t.pong(e,!this._isServer,T),t.emit(`ping`,e)}function he(e){this[w].emit(`pong`,e)}function ge(e){e.resume()}function N(e){let t=this[w];t.readyState!==oe.CLOSED&&(t.readyState===oe.OPEN&&(t._readyState=oe.CLOSING,_e(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e)))}function _e(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function ve(){let e=this[w];if(this.removeListener(`close`,ve),this.removeListener(`data`,ye),this.removeListener(`end`,be),e._readyState=oe.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[w]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on(`error`,pe),e._receiver.on(`finish`,pe))}function ye(e){this[w]._receiver.write(e)||this.pause()}function be(){let e=this[w];e._readyState=oe.CLOSING,e._receiver.end(),this.end()}function xe(){let e=this[w];this.removeListener(`error`,xe),this.on(`error`,T),e&&(e._readyState=oe.CLOSING,this.destroy())}})),KDe=i(((e,n)=>{s8();let{Duplex:r}=t(`stream`);function i(e){e.emit(`close`)}function a(){!this.destroyed&&this._writableState.finished&&this.destroy()}function o(e){this.removeListener(`error`,o),this.destroy(),this.listenerCount(`error`)===0&&this.emit(`error`,e)}function s(e,t){let n=!0,s=new r({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on(`message`,function(t,n){let r=!n&&s._readableState.objectMode?t.toString():t;s.push(r)||e.pause()}),e.once(`error`,function(e){s.destroyed||(n=!1,s.destroy(e))}),e.once(`close`,function(){s.destroyed||s.push(null)}),s._destroy=function(t,r){if(e.readyState===e.CLOSED){r(t),process.nextTick(i,s);return}let a=!1;e.once(`error`,function(e){a=!0,r(e)}),e.once(`close`,function(){a||r(t),process.nextTick(i,s)}),n&&e.terminate()},s._final=function(t){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._final(t)});return}e._socket!==null&&(e._socket._writableState.finished?(t(),s._readableState.endEmitted&&s.destroy()):(e._socket.once(`finish`,function(){t()}),e.close()))},s._read=function(){e.isPaused&&e.resume()},s._write=function(t,n,r){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._write(t,n,r)});return}e.send(t,r)},s.on(`end`,a),s.on(`error`,o),s}n.exports=s})),c8=i(((e,t)=>{let{tokenChars:n}=r8();function r(e){let t=new Set,r=-1,i=-1,a=0;for(;a<e.length;a++){let o=e.charCodeAt(a);if(i===-1&&n[o]===1)r===-1&&(r=a);else if(a!==0&&(o===32||o===9))i===-1&&r!==-1&&(i=a);else if(o===44){if(r===-1)throw SyntaxError(`Unexpected character at index ${a}`);i===-1&&(i=a);let n=e.slice(r,i);if(t.has(n))throw SyntaxError(`The "${n}" subprotocol is duplicated`);t.add(n),r=i=-1}else throw SyntaxError(`Unexpected character at index ${a}`)}if(r===-1||i!==-1)throw SyntaxError(`Unexpected end of input`);let o=e.slice(r,a);if(t.has(o))throw SyntaxError(`The "${o}" subprotocol is duplicated`);return t.add(o),t}t.exports={parse:r}})),qDe=i(((e,n)=>{let r=t(`events`),i=t(`http`),{Duplex:a}=t(`stream`),{createHash:o}=t(`crypto`),s=o8(),c=n8(),l=c8(),u=s8(),{CLOSE_TIMEOUT:d,GUID:f,kWebSocket:p}=e8(),m=/^[+/0-9A-Za-z]{22}==$/;n.exports=class extends r{constructor(e,t){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:1048576,maxFragments:131072,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:d,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:u,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw TypeError(`One and only one of the "port", "server", or "noServer" options must be specified`);if(e.port==null?e.server&&(this._server=e.server):(this._server=i.createServer((e,t)=>{let n=i.STATUS_CODES[426];t.writeHead(426,{"Content-Length":n.length,"Content-Type":`text/plain`}),t.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)),this._server){let e=this.emit.bind(this,`connection`);this._removeListeners=h(this._server,{listening:this.emit.bind(this,`listening`),error:this.emit.bind(this,`error`),upgrade:(t,n,r)=>{this.handleUpgrade(t,n,r,e)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw Error(`The server is operating in "noServer" mode`);return this._server?this._server.address():null}close(e){if(this._state===2){e&&this.once(`close`,()=>{e(Error(`The server is not running`))}),process.nextTick(g,this);return}if(e&&this.once(`close`,e),this._state!==1){if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(g,this);else{let e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{g(this)})}}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf(`?`);if((t===-1?e.url:e.url.slice(0,t))!==this.options.path)return!1}return!0}handleUpgrade(e,t,n,r){t.on(`error`,_);let i=e.headers[`sec-websocket-key`],a=e.headers.upgrade,o=+e.headers[`sec-websocket-version`];if(e.method!==`GET`){y(this,e,t,405,`Invalid HTTP method`);return}if(a===void 0||a.toLowerCase()!==`websocket`){y(this,e,t,400,`Invalid Upgrade header`);return}if(i===void 0||!m.test(i)){y(this,e,t,400,`Missing or invalid Sec-WebSocket-Key header`);return}if(o!==13&&o!==8){y(this,e,t,400,`Missing or invalid Sec-WebSocket-Version header`,{"Sec-WebSocket-Version":`13, 8`});return}if(!this.shouldHandle(e)){v(t,400);return}let u=e.headers[`sec-websocket-protocol`],d=new Set;if(u!==void 0)try{d=l.parse(u)}catch{y(this,e,t,400,`Invalid Sec-WebSocket-Protocol header`);return}let f=e.headers[`sec-websocket-extensions`],p={};if(this.options.perMessageDeflate&&f!==void 0){let n=new c({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let e=s.parse(f);e[c.extensionName]&&(n.accept(e[c.extensionName]),p[c.extensionName]=n)}catch{y(this,e,t,400,`Invalid or unacceptable Sec-WebSocket-Extensions header`);return}}if(this.options.verifyClient){let a={origin:e.headers[`${o===8?`sec-websocket-origin`:`origin`}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(a,(a,o,s,c)=>{if(!a)return v(t,o||401,s,c);this.completeUpgrade(p,i,d,e,t,n,r)});return}if(!this.options.verifyClient(a))return v(t,401)}this.completeUpgrade(p,i,d,e,t,n,r)}completeUpgrade(e,t,n,r,i,a,l){if(!i.readable||!i.writable)return i.destroy();if(i[p])throw Error(`server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration`);if(this._state>0)return v(i,503);let u=[`HTTP/1.1 101 Switching Protocols`,`Upgrade: websocket`,`Connection: Upgrade`,`Sec-WebSocket-Accept: ${o(`sha1`).update(t+f).digest(`base64`)}`],d=new this.options.WebSocket(null,void 0,this.options);if(n.size){let e=this.options.handleProtocols?this.options.handleProtocols(n,r):n.values().next().value;e&&(u.push(`Sec-WebSocket-Protocol: ${e}`),d._protocol=e)}if(e[c.extensionName]){let t=e[c.extensionName].params,n=s.format({[c.extensionName]:[t]});u.push(`Sec-WebSocket-Extensions: ${n}`),d._extensions=e}this.emit(`headers`,u,r),i.write(u.concat(`\r
|
|
1087
|
+
option is given.`]]]).keys()].sort(),new TextDecoder(`utf-8`,{fatal:!0});var e8=i(((e,t)=>{let n=[`nodebuffer`,`arraybuffer`,`fragments`],r=typeof Blob<`u`;r&&n.push(`blob`),t.exports={BINARY_TYPES:n,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:`258EAFA5-E914-47DA-95CA-C5AB0DC85B11`,hasBlob:r,kForOnEventAttribute:Symbol(`kIsForOnEventAttribute`),kListener:Symbol(`kListener`),kStatusCode:Symbol(`status-code`),kWebSocket:Symbol(`websocket`),NOOP:()=>{}}})),t8=i(((e,n)=>{let{EMPTY_BUFFER:r}=e8(),i=Buffer[Symbol.species];function a(e,t){if(e.length===0)return r;if(e.length===1)return e[0];let n=Buffer.allocUnsafe(t),a=0;for(let t=0;t<e.length;t++){let r=e[t];n.set(r,a),a+=r.length}return a<t?new i(n.buffer,n.byteOffset,a):n}function o(e,t,n,r,i){for(let a=0;a<i;a++)n[r+a]=e[a]^t[a&3]}function s(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}function c(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function l(e){if(l.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new i(e):ArrayBuffer.isView(e)?t=new i(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),l.readOnly=!1),t}if(n.exports={concat:a,mask:o,toArrayBuffer:c,toBuffer:l,unmask:s},!process.env.WS_NO_BUFFER_UTIL)try{let e=t(`bufferutil`);n.exports.mask=function(t,n,r,i,a){a<48?o(t,n,r,i,a):e.mask(t,n,r,i,a)},n.exports.unmask=function(t,n){t.length<32?s(t,n):e.unmask(t,n)}}catch{}})),GDe=i(((e,t)=>{let n=Symbol(`kDone`),r=Symbol(`kRun`);t.exports=class{constructor(e){this[n]=()=>{this.pending--,this[r]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[r]()}[r](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[n])}}}})),n8=i(((e,n)=>{let r=t(`zlib`),i=t8(),a=GDe(),{kStatusCode:o}=e8(),s=Buffer[Symbol.species],c=Buffer.from([0,0,255,255]),l=Symbol(`permessage-deflate`),u=Symbol(`total-length`),d=Symbol(`callback`),f=Symbol(`buffers`),p=Symbol(`error`),m;n.exports=class{constructor(e){if(this._options=e||{},this._threshold=this._options.threshold===void 0?1024:this._options.threshold,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!m){let e=this._options.concurrencyLimit===void 0?10:this._options.concurrencyLimit;m=new a(e)}}static get extensionName(){return`permessage-deflate`}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits??(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&=(this._inflate.close(),null),this._deflate){let e=this._deflate[d];this._deflate.close(),this._deflate=null,e&&e(Error(`The deflate stream was closed while data was being processed`))}}acceptAsServer(e){let t=this._options,n=e.find(e=>!(t.serverNoContextTakeover===!1&&e.server_no_context_takeover||e.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits==`number`&&t.serverMaxWindowBits>e.server_max_window_bits)||typeof t.clientMaxWindowBits==`number`&&!e.client_max_window_bits));if(!n)throw Error(`None of the extension offers can be accepted`);return t.serverNoContextTakeover&&(n.server_no_context_takeover=!0),t.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof t.serverMaxWindowBits==`number`&&(n.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits==`number`?n.client_max_window_bits=t.clientMaxWindowBits:(n.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw Error(`Unexpected parameter "client_no_context_takeover"`);if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits==`number`&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==`number`&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw Error(`Unexpected or invalid parameter "client_max_window_bits"`);return t}normalizeParams(e){return e.forEach(e=>{Object.keys(e).forEach(t=>{let n=e[t];if(n.length>1)throw Error(`Parameter "${t}" must have only a single value`);if(n=n[0],t===`client_max_window_bits`){if(n!==!0){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else if(t===`server_max_window_bits`){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(t===`client_no_context_takeover`||t===`server_no_context_takeover`){if(n!==!0)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else throw Error(`Unknown parameter "${t}"`);e[t]=n})}),e}decompress(e,t,n){m.add(r=>{this._decompress(e,t,(e,t)=>{r(),n(e,t)})})}compress(e,t,n){m.add(r=>{this._compress(e,t,(e,t)=>{r(),n(e,t)})})}_decompress(e,t,n){let a=this._isServer?`client`:`server`;if(!this._inflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:r.Z_DEFAULT_WINDOWBITS;this._inflate=r.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[l]=this,this._inflate[u]=0,this._inflate[f]=[],this._inflate.on(`error`,_),this._inflate.on(`data`,g)}this._inflate[d]=n,this._inflate.write(e),t&&this._inflate.write(c),this._inflate.flush(()=>{let e=this._inflate[p];if(e){this._inflate.close(),this._inflate=null,n(e);return}let r=i.concat(this._inflate[f],this._inflate[u]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[u]=0,this._inflate[f]=[],t&&this.params[`${a}_no_context_takeover`]&&this._inflate.reset()),n(null,r)})}_compress(e,t,n){let a=this._isServer?`server`:`client`;if(!this._deflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:r.Z_DEFAULT_WINDOWBITS;this._deflate=r.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[u]=0,this._deflate[f]=[],this._deflate.on(`data`,h)}this._deflate[d]=n,this._deflate.write(e),this._deflate.flush(r.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let e=i.concat(this._deflate[f],this._deflate[u]);t&&(e=new s(e.buffer,e.byteOffset,e.length-4)),this._deflate[d]=null,this._deflate[u]=0,this._deflate[f]=[],t&&this.params[`${a}_no_context_takeover`]&&this._deflate.reset(),n(null,e)})}};function h(e){this[f].push(e),this[u]+=e.length}function g(e){if(this[u]+=e.length,this[l]._maxPayload<1||this[u]<=this[l]._maxPayload){this[f].push(e);return}this[p]=RangeError(`Max payload size exceeded`),this[p].code=`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`,this[p][o]=1009,this.removeListener(`data`,g),this.reset()}function _(e){if(this[l]._inflate=null,this[p]){this[d](this[p]);return}e[o]=1007,this[d](e)}})),r8=i(((e,n)=>{let{isUtf8:r}=t(`buffer`),{hasBlob:i}=e8(),a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function o(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function s(e){let t=e.length,n=0;for(;n<t;)if(!(e[n]&128))n++;else if((e[n]&224)==192){if(n+1===t||(e[n+1]&192)!=128||(e[n]&254)==192)return!1;n+=2}else if((e[n]&240)==224){if(n+2>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||e[n]===224&&(e[n+1]&224)==128||e[n]===237&&(e[n+1]&224)==160)return!1;n+=3}else if((e[n]&248)==240){if(n+3>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||(e[n+3]&192)!=128||e[n]===240&&(e[n+1]&240)==128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}function c(e){return i&&typeof e==`object`&&typeof e.arrayBuffer==`function`&&typeof e.type==`string`&&typeof e.stream==`function`&&(e[Symbol.toStringTag]===`Blob`||e[Symbol.toStringTag]===`File`)}if(n.exports={isBlob:c,isValidStatusCode:o,isValidUTF8:s,tokenChars:a},r)n.exports.isValidUTF8=function(e){return e.length<24?s(e):r(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=t(`utf-8-validate`);n.exports.isValidUTF8=function(t){return t.length<32?s(t):e(t)}}catch{}})),i8=i(((e,n)=>{let{Writable:r}=t(`stream`),i=n8(),{BINARY_TYPES:a,EMPTY_BUFFER:o,kStatusCode:s,kWebSocket:c}=e8(),{concat:l,toArrayBuffer:u,unmask:d}=t8(),{isValidStatusCode:f,isValidUTF8:p}=r8(),m=Buffer[Symbol.species];n.exports=class extends r{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents===void 0||e.allowSynchronousEvents,this._binaryType=e.binaryType||a[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxBufferedChunks=e.maxBufferedChunks|0,this._maxFragments=e.maxFragments|0,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[c]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(e,t,n){if(this._opcode===8&&this._state==0)return n();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){n(this.createError(RangeError,`Too many buffered chunks`,!1,1008,`WS_ERR_TOO_MANY_BUFFERED_PARTS`));return}this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let t=this._buffers[0];return this._buffers[0]=new m(t.buffer,t.byteOffset+e,t.length-e),new m(t.buffer,t.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let n=this._buffers[0],r=t.length-e;e>=n.length?t.set(this._buffers.shift(),r):(t.set(new Uint8Array(n.buffer,n.byteOffset,e),r),this._buffers[0]=new m(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if(t[0]&48){e(this.createError(RangeError,`RSV2 and RSV3 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_2_3`));return}let n=(t[0]&64)==64;if(n&&!this._extensions[i.extensionName]){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._fin=(t[0]&128)==128,this._opcode=t[0]&15,this._payloadLength=t[1]&127,this._opcode===0){if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(!this._fragmented){e(this.createError(RangeError,`invalid opcode 0`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){e(this.createError(RangeError,`FIN must be set`,!0,1002,`WS_ERR_EXPECTED_FIN`));return}if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){e(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,`WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH`));return}}else{e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(t[1]&128)==128,this._isServer){if(!this._masked){e(this.createError(RangeError,`MASK must be set`,!0,1002,`WS_ERR_EXPECTED_MASK`));return}}else if(this._masked){e(this.createError(RangeError,`MASK must be clear`,!0,1002,`WS_ERR_UNEXPECTED_MASK`));return}this._payloadLength===126?this._state=1:this._payloadLength===127?this._state=2:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),n=t.readUInt32BE(0);if(n>2**21-1){e(this.createError(RangeError,`Unsupported WebSocket frame: payload length > 2^53 - 1`,!1,1009,`WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH`));return}this._payloadLength=n*2**32+t.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){e(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._state=this._masked?3:4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(e){let t=o;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&d(t,this._mask)}if(this._opcode>7){this.controlMessage(t,e);return}if(this._compressed){this._state=5,this.decompress(t,e);return}if(t.length){if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){e(this.createError(RangeError,`Too many message fragments`,!1,1008,`WS_ERR_TOO_MANY_BUFFERED_PARTS`));return}this._messageLength=this._totalPayloadLength,this._fragments.push(t)}this.dataMessage(e)}decompress(e,t){this._extensions[i.extensionName].decompress(e,this._fin,(e,n)=>{if(e)return t(e);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0){t(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){t(this.createError(RangeError,`Too many message fragments`,!1,1008,`WS_ERR_TOO_MANY_BUFFERED_PARTS`));return}this._fragments.push(n)}this.dataMessage(t),this._state===0&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=0;return}let t=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;r=this._binaryType===`nodebuffer`?l(n,t):this._binaryType===`arraybuffer`?u(l(n,t)):this._binaryType===`blob`?new Blob(n):n,this._allowSynchronousEvents?(this.emit(`message`,r,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!0),this._state=0,this.startLoop(e)}))}else{let r=l(n,t);if(!this._skipUTF8Validation&&!p(r)){e(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._state===5||this._allowSynchronousEvents?(this.emit(`message`,r,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!1),this._state=0,this.startLoop(e)}))}}controlMessage(e,t){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit(`conclude`,1005,o),this.end();else{let n=e.readUInt16BE(0);if(!f(n)){t(this.createError(RangeError,`invalid status code ${n}`,!0,1002,`WS_ERR_INVALID_CLOSE_CODE`));return}let r=new m(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!p(r)){t(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._loop=!1,this.emit(`conclude`,n,r),this.end()}this._state=0;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0):(this._state=6,setImmediate(()=>{this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0,this.startLoop(t)}))}createError(e,t,n,r,i){this._loop=!1,this._errored=!0;let a=new e(n?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(a,this.createError),a.code=i,a[s]=r,a}}})),a8=i(((e,n)=>{let{Duplex:r}=t(`stream`),{randomFillSync:i}=t(`crypto`),{types:{isUint8Array:a}}=t(`util`),o=n8(),{EMPTY_BUFFER:s,kWebSocket:c,NOOP:l}=e8(),{isBlob:u,isValidStatusCode:d}=r8(),{mask:f,toBuffer:p}=t8(),m=Symbol(`kByteLength`),h=Buffer.alloc(4),g=8192,_,v=g;n.exports=class e{constructor(e,t,n){this._extensions=t||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=l,this[c]=void 0}static frame(e,t){let n,r=!1,a=2,o=!1;t.mask&&(n=t.maskBuffer||h,t.generateMask?t.generateMask(n):(v===g&&(_===void 0&&(_=Buffer.alloc(g)),i(_,0,g),v=0),n[0]=_[v++],n[1]=_[v++],n[2]=_[v++],n[3]=_[v++]),o=(n[0]|n[1]|n[2]|n[3])===0,a=6);let s;typeof e==`string`?(!t.mask||o)&&t[m]!==void 0?s=t[m]:(e=Buffer.from(e),s=e.length):(s=e.length,r=t.mask&&t.readOnly&&!o);let c=s;s>=65536?(a+=8,c=127):s>125&&(a+=2,c=126);let l=Buffer.allocUnsafe(r?s+a:a);return l[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(l[0]|=64),l[1]=c,c===126?l.writeUInt16BE(s,2):c===127&&(l[2]=l[3]=0,l.writeUIntBE(s,4,6)),!t.mask||(l[1]|=128,l[a-4]=n[0],l[a-3]=n[1],l[a-2]=n[2],l[a-1]=n[3],o)?[l,e]:r?(f(e,n,l,a,s),[l]):(f(e,n,e,0,s),[l,e])}close(t,n,r,i){let o;if(t===void 0)o=s;else if(typeof t!=`number`||!d(t))throw TypeError(`First argument must be a valid error code number`);else if(n===void 0||!n.length)o=Buffer.allocUnsafe(2),o.writeUInt16BE(t,0);else{let e=Buffer.byteLength(n);if(e>123)throw RangeError(`The message must not be greater than 123 bytes`);if(o=Buffer.allocUnsafe(2+e),o.writeUInt16BE(t,0),typeof n==`string`)o.write(n,2);else if(a(n))o.set(n,2);else throw TypeError(`Second argument must be a string or a Uint8Array`)}let c={[m]:o.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state===0?this.sendFrame(e.frame(o,c),i):this.enqueue([this.dispatch,o,!1,c,i])}ping(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):u(t)?(i=t.size,a=!1):(t=p(t),i=t.length,a=p.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[m]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};u(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}pong(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):u(t)?(i=t.size,a=!1):(t=p(t),i=t.length,a=p.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[m]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};u(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}send(e,t,n){let r=this._extensions[o.extensionName],i=t.binary?2:1,a=t.compress,s,c;typeof e==`string`?(s=Buffer.byteLength(e),c=!1):u(e)?(s=e.size,c=!1):(e=p(e),s=e.length,c=p.readOnly),this._firstFragment?(this._firstFragment=!1,a&&r&&r.params[r._isServer?`server_no_context_takeover`:`client_no_context_takeover`]&&(a=s>=r._threshold),this._compress=a):(a=!1,i=0),t.fin&&(this._firstFragment=!0);let l={[m]:s,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:i,readOnly:c,rsv1:a};u(e)?this._state===0?this.getBlobData(e,this._compress,l,n):this.enqueue([this.getBlobData,e,this._compress,l,n]):this._state===0?this.dispatch(e,this._compress,l,n):this.enqueue([this.dispatch,e,this._compress,l,n])}getBlobData(t,n,r,i){this._bufferedBytes+=r[m],this._state=2,t.arrayBuffer().then(t=>{if(this._socket.destroyed){let e=Error(`The socket was closed while the blob was being read`);process.nextTick(y,this,e,i);return}this._bufferedBytes-=r[m];let a=p(t);n?this.dispatch(a,n,r,i):(this._state=0,this.sendFrame(e.frame(a,r),i),this.dequeue())}).catch(e=>{process.nextTick(b,this,e,i)})}dispatch(t,n,r,i){if(!n){this.sendFrame(e.frame(t,r),i);return}let a=this._extensions[o.extensionName];this._bufferedBytes+=r[m],this._state=1,a.compress(t,r.fin,(t,n)=>{if(this._socket.destroyed){let e=Error(`The socket was closed while data was being compressed`);y(this,e,i);return}this._bufferedBytes-=r[m],this._state=0,r.readOnly=!1,this.sendFrame(e.frame(n,r),i),this.dequeue()})}dequeue(){for(;this._state===0&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][m],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][m],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};function y(e,t,n){typeof n==`function`&&n(t);for(let n=0;n<e._queue.length;n++){let r=e._queue[n],i=r[r.length-1];typeof i==`function`&&i(t)}}function b(e,t,n){y(e,t,n),e.onerror(t)}})),KDe=i(((e,t)=>{let{kForOnEventAttribute:n,kListener:r}=e8(),i=Symbol(`kCode`),a=Symbol(`kData`),o=Symbol(`kError`),s=Symbol(`kMessage`),c=Symbol(`kReason`),l=Symbol(`kTarget`),u=Symbol(`kType`),d=Symbol(`kWasClean`);var f=class{constructor(e){this[l]=null,this[u]=e}get target(){return this[l]}get type(){return this[u]}};Object.defineProperty(f.prototype,"target",{enumerable:!0}),Object.defineProperty(f.prototype,"type",{enumerable:!0});var p=class extends f{constructor(e,t={}){super(e),this[i]=t.code===void 0?0:t.code,this[c]=t.reason===void 0?``:t.reason,this[d]=t.wasClean!==void 0&&t.wasClean}get code(){return this[i]}get reason(){return this[c]}get wasClean(){return this[d]}};Object.defineProperty(p.prototype,"code",{enumerable:!0}),Object.defineProperty(p.prototype,"reason",{enumerable:!0}),Object.defineProperty(p.prototype,"wasClean",{enumerable:!0});var m=class extends f{constructor(e,t={}){super(e),this[o]=t.error===void 0?null:t.error,this[s]=t.message===void 0?``:t.message}get error(){return this[o]}get message(){return this[s]}};Object.defineProperty(m.prototype,"error",{enumerable:!0}),Object.defineProperty(m.prototype,"message",{enumerable:!0});var h=class extends f{constructor(e,t={}){super(e),this[a]=t.data===void 0?null:t.data}get data(){return this[a]}};Object.defineProperty(h.prototype,"data",{enumerable:!0}),t.exports={CloseEvent:p,ErrorEvent:m,Event:f,EventTarget:{addEventListener(e,t,i={}){for(let a of this.listeners(e))if(!i[n]&&a[r]===t&&!a[n])return;let a;if(e===`message`)a=function(e,n){let r=new h(`message`,{data:n?e:e.toString()});r[l]=this,g(t,this,r)};else if(e===`close`)a=function(e,n){let r=new p(`close`,{code:e,reason:n.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[l]=this,g(t,this,r)};else if(e===`error`)a=function(e){let n=new m(`error`,{error:e,message:e.message});n[l]=this,g(t,this,n)};else if(e===`open`)a=function(){let e=new f(`open`);e[l]=this,g(t,this,e)};else return;a[n]=!!i[n],a[r]=t,i.once?this.once(e,a):this.on(e,a)},removeEventListener(e,t){for(let i of this.listeners(e))if(i[r]===t&&!i[n]){this.removeListener(e,i);break}}},MessageEvent:h};function g(e,t,n){typeof e==`object`&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}})),o8=i(((e,t)=>{let{tokenChars:n}=r8();function r(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}function i(e){let t=Object.create(null),i=Object.create(null),a=!1,o=!1,s=!1,c,l,u=-1,d=-1,f=-1,p=0;for(;p<e.length;p++)if(d=e.charCodeAt(p),c===void 0){if(f===-1&&n[d]===1)u===-1&&(u=p);else if(p!==0&&(d===32||d===9))f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);d===44?(r(t,n,i),i=Object.create(null)):c=n,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`)}else if(l===void 0){if(f===-1&&n[d]===1)u===-1&&(u=p);else if(d===32||d===9)f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p),r(i,e.slice(u,f),!0),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),u=f=-1}else if(d===61&&u!==-1&&f===-1)l=e.slice(u,p),u=f=-1;else throw SyntaxError(`Unexpected character at index ${p}`)}else if(o){if(n[d]!==1)throw SyntaxError(`Unexpected character at index ${p}`);u===-1?u=p:a||=!0,o=!1}else if(s){if(n[d]===1)u===-1&&(u=p);else if(d===34&&u!==-1)s=!1,f=p;else if(d===92)o=!0;else throw SyntaxError(`Unexpected character at index ${p}`)}else if(d===34&&e.charCodeAt(p-1)===61)s=!0;else if(f===-1&&n[d]===1)u===-1&&(u=p);else if(u!==-1&&(d===32||d===9))f===-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);a&&=(n=n.replace(/\\/g,``),!1),r(i,l,n),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),l=void 0,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);if(u===-1||s||d===32||d===9)throw SyntaxError(`Unexpected end of input`);f===-1&&(f=p);let m=e.slice(u,f);return c===void 0?r(t,m,i):(l===void 0?r(i,m,!0):a?r(i,l,m.replace(/\\/g,``)):r(i,l,m),r(t,c,i)),t}function a(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>[t].concat(Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>e===!0?t:`${t}=${e}`).join(`; `)})).join(`; `)).join(`, `)}).join(`, `)}t.exports={format:a,parse:i}})),s8=i(((e,n)=>{let r=t(`events`),i=t(`https`),a=t(`http`),o=t(`net`),s=t(`tls`),{randomBytes:c,createHash:l}=t(`crypto`),{Duplex:u,Readable:d}=t(`stream`),{URL:f}=t(`url`),p=n8(),m=i8(),h=a8(),{isBlob:g}=r8(),{BINARY_TYPES:_,CLOSE_TIMEOUT:v,EMPTY_BUFFER:y,GUID:b,kForOnEventAttribute:x,kListener:S,kStatusCode:C,kWebSocket:w,NOOP:T}=e8(),{EventTarget:{addEventListener:E,removeEventListener:D}}=KDe(),{format:O,parse:ee}=o8(),{toBuffer:te}=t8(),ne=Symbol(`kAborted`),re=[8,13],ie=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],ae=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;var oe=class e extends r{constructor(t,n,r){super(),this._binaryType=_[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=y,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol=``,this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t===null?(this._autoPong=r.autoPong,this._closeTimeout=r.closeTimeout,this._isServer=!0):(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,n===void 0?n=[]:Array.isArray(n)||(typeof n==`object`&&n?(r=n,n=[]):n=[n]),se(this,t,n,r))}get binaryType(){return this._binaryType}set binaryType(e){_.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,n,r){let i=new m({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:r.maxBufferedChunks,maxFragments:r.maxFragments,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),a=new h(t,this._extensions,r.generateMask);this._receiver=i,this._sender=a,this._socket=t,i[w]=this,a[w]=this,t[w]=this,i.on(`conclude`,j),i.on(`drain`,de),i.on(`error`,fe),i.on(`message`,me),i.on(`ping`,M),i.on(`pong`,he),a.onerror=N,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on(`close`,ve),t.on(`data`,ye),t.on(`end`,be),t.on(`error`,xe),this._readyState=e.OPEN,this.emit(`open`)}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage);return}this._extensions[p.extensionName]&&this._extensions[p.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage)}close(t,n){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){ue(this,this._req,`WebSocket was closed before the connection was established`);return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,n,!this._isServer,e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),_e(this)}}pause(){this.readyState!==e.CONNECTING&&this.readyState!==e.CLOSED&&(this._paused=!0,this._socket.pause())}ping(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){A(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.ping(t||y,n,r)}pong(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){A(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.pong(t||y,n,r)}resume(){this.readyState!==e.CONNECTING&&this.readyState!==e.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof n==`function`&&(r=n,n={}),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){A(this,t,r);return}let i={binary:typeof t!=`string`,mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[p.extensionName]||(i.compress=!1),this._sender.send(t||y,i,r)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){ue(this,this._req,`WebSocket was closed before the connection was established`);return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(oe,"CONNECTING",{enumerable:!0,value:ie.indexOf(`CONNECTING`)}),Object.defineProperty(oe.prototype,"CONNECTING",{enumerable:!0,value:ie.indexOf(`CONNECTING`)}),Object.defineProperty(oe,"OPEN",{enumerable:!0,value:ie.indexOf(`OPEN`)}),Object.defineProperty(oe.prototype,"OPEN",{enumerable:!0,value:ie.indexOf(`OPEN`)}),Object.defineProperty(oe,"CLOSING",{enumerable:!0,value:ie.indexOf(`CLOSING`)}),Object.defineProperty(oe.prototype,"CLOSING",{enumerable:!0,value:ie.indexOf(`CLOSING`)}),Object.defineProperty(oe,"CLOSED",{enumerable:!0,value:ie.indexOf(`CLOSED`)}),Object.defineProperty(oe.prototype,"CLOSED",{enumerable:!0,value:ie.indexOf(`CLOSED`)}),[`binaryType`,`bufferedAmount`,`extensions`,`isPaused`,`protocol`,`readyState`,`url`].forEach(e=>{Object.defineProperty(oe.prototype,e,{enumerable:!0})}),[`open`,`error`,`close`,`message`].forEach(e=>{Object.defineProperty(oe.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[x])return t[S];return null},set(t){for(let t of this.listeners(e))if(t[x]){this.removeListener(e,t);break}typeof t==`function`&&this.addEventListener(e,t,{[x]:!0})}})}),oe.prototype.addEventListener=E,oe.prototype.removeEventListener=D,n.exports=oe;function se(e,t,n,r){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:v,protocolVersion:re[1],maxBufferedChunks:1048576,maxFragments:131072,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:`GET`,host:void 0,path:void 0,port:void 0};if(e._autoPong=o.autoPong,e._closeTimeout=o.closeTimeout,!re.includes(o.protocolVersion))throw RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${re.join(`, `)})`);let s;if(t instanceof f)s=t;else try{s=new f(t)}catch{throw SyntaxError(`Invalid URL: ${t}`)}s.protocol===`http:`?s.protocol=`ws:`:s.protocol===`https:`&&(s.protocol=`wss:`),e._url=s.href;let u=s.protocol===`wss:`,d=s.protocol===`ws+unix:`,m;if(s.protocol!==`ws:`&&!u&&!d?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:d&&!s.pathname?m=`The URL's pathname is empty`:s.hash&&(m=`The URL contains a fragment identifier`),m){let t=SyntaxError(m);if(e._redirects===0)throw t;k(e,t);return}let h=u?443:80,g=c(16).toString(`base64`),_=u?i.request:a.request,y=new Set,x;if(o.createConnection=o.createConnection||(u?le:ce),o.defaultPort=o.defaultPort||h,o.port=s.port||h,o.host=s.hostname.startsWith(`[`)?s.hostname.slice(1,-1):s.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":g,Connection:`Upgrade`,Upgrade:`websocket`},o.path=s.pathname+s.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(x=new p({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers[`Sec-WebSocket-Extensions`]=O({[p.extensionName]:x.offer()})),n.length){for(let e of n){if(typeof e!=`string`||!ae.test(e)||y.has(e))throw SyntaxError(`An invalid or duplicated subprotocol was specified`);y.add(e)}o.headers[`Sec-WebSocket-Protocol`]=n.join(`,`)}if(o.origin&&(o.protocolVersion<13?o.headers[`Sec-WebSocket-Origin`]=o.origin:o.headers.Origin=o.origin),(s.username||s.password)&&(o.auth=`${s.username}:${s.password}`),d){let e=o.path.split(`:`);o.socketPath=e[0],o.path=e[1]}let S;if(o.followRedirects){if(e._redirects===0){e._originalIpc=d,e._originalSecure=u,e._originalHostOrSocketPath=d?o.socketPath:s.host;let t=r&&r.headers;if(r={...r,headers:{}},t)for(let[e,n]of Object.entries(t))r.headers[e.toLowerCase()]=n}else if(e.listenerCount(`redirect`)===0){let t=d?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:!e._originalIpc&&s.host===e._originalHostOrSocketPath;(!t||e._originalSecure&&!u)&&(delete o.headers.authorization,delete o.headers.cookie,t||delete o.headers.host,o.auth=void 0)}o.auth&&!r.headers.authorization&&(r.headers.authorization=`Basic `+Buffer.from(o.auth).toString(`base64`)),S=e._req=_(o),e._redirects&&e.emit(`redirect`,e.url,S)}else S=e._req=_(o);o.timeout&&S.on(`timeout`,()=>{ue(e,S,`Opening handshake has timed out`)}),S.on(`error`,t=>{S===null||S[ne]||(S=e._req=null,k(e,t))}),S.on(`response`,i=>{let a=i.headers.location,s=i.statusCode;if(a&&o.followRedirects&&s>=300&&s<400){if(++e._redirects>o.maxRedirects){ue(e,S,`Maximum redirects exceeded`);return}S.abort();let i;try{i=new f(a,t)}catch{k(e,SyntaxError(`Invalid URL: ${a}`));return}se(e,i,n,r)}else e.emit(`unexpected-response`,S,i)||ue(e,S,`Unexpected server response: ${i.statusCode}`)}),S.on(`upgrade`,(t,n,r)=>{if(e.emit(`upgrade`,t),e.readyState!==oe.CONNECTING)return;S=e._req=null;let i=t.headers.upgrade;if(i===void 0||i.toLowerCase()!==`websocket`){ue(e,n,`Invalid Upgrade header`);return}let a=l(`sha1`).update(g+b).digest(`base64`);if(t.headers[`sec-websocket-accept`]!==a){ue(e,n,`Invalid Sec-WebSocket-Accept header`);return}let s=t.headers[`sec-websocket-protocol`],c;if(s===void 0?y.size&&(c=`Server sent no subprotocol`):y.size?y.has(s)||(c=`Server sent an invalid subprotocol`):c=`Server sent a subprotocol but none was requested`,c){ue(e,n,c);return}s&&(e._protocol=s);let u=t.headers[`sec-websocket-extensions`];if(u!==void 0){if(!x){ue(e,n,`Server sent a Sec-WebSocket-Extensions header but no extension was requested`);return}let t;try{t=ee(u)}catch{ue(e,n,`Invalid Sec-WebSocket-Extensions header`);return}let r=Object.keys(t);if(r.length!==1||r[0]!==p.extensionName){ue(e,n,`Server indicated an extension that was not requested`);return}try{x.accept(t[p.extensionName])}catch{ue(e,n,`Invalid Sec-WebSocket-Extensions header`);return}e._extensions[p.extensionName]=x}e.setSocket(n,r,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(S,e):S.end()}function k(e,t){e._readyState=oe.CLOSING,e._errorEmitted=!0,e.emit(`error`,t),e.emitClose()}function ce(e){return e.path=e.socketPath,o.connect(e)}function le(e){return e.path=void 0,!e.servername&&e.servername!==``&&(e.servername=o.isIP(e.host)?``:e.host),s.connect(e)}function ue(e,t,n){e._readyState=oe.CLOSING;let r=Error(n);Error.captureStackTrace(r,ue),t.setHeader?(t[ne]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(k,e,r)):(t.destroy(r),t.once(`error`,e.emit.bind(e,`error`)),t.once(`close`,e.emitClose.bind(e)))}function A(e,t,n){if(t){let n=g(t)?t.size:te(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(n){let t=Error(`WebSocket is not open: readyState ${e.readyState} (${ie[e.readyState]})`);process.nextTick(n,t)}}function j(e,t){let n=this[w];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[w]!==void 0&&(n._socket.removeListener(`data`,ye),process.nextTick(ge,n._socket),e===1005?n.close():n.close(e,t))}function de(){let e=this[w];e.isPaused||e._socket.resume()}function fe(e){let t=this[w];t._socket[w]!==void 0&&(t._socket.removeListener(`data`,ye),process.nextTick(ge,t._socket),t.close(e[C])),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e))}function pe(){this[w].emitClose()}function me(e,t){this[w].emit(`message`,e,t)}function M(e){let t=this[w];t._autoPong&&t.pong(e,!this._isServer,T),t.emit(`ping`,e)}function he(e){this[w].emit(`pong`,e)}function ge(e){e.resume()}function N(e){let t=this[w];t.readyState!==oe.CLOSED&&(t.readyState===oe.OPEN&&(t._readyState=oe.CLOSING,_e(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e)))}function _e(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function ve(){let e=this[w];if(this.removeListener(`close`,ve),this.removeListener(`data`,ye),this.removeListener(`end`,be),e._readyState=oe.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[w]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on(`error`,pe),e._receiver.on(`finish`,pe))}function ye(e){this[w]._receiver.write(e)||this.pause()}function be(){let e=this[w];e._readyState=oe.CLOSING,e._receiver.end(),this.end()}function xe(){let e=this[w];this.removeListener(`error`,xe),this.on(`error`,T),e&&(e._readyState=oe.CLOSING,this.destroy())}})),qDe=i(((e,n)=>{s8();let{Duplex:r}=t(`stream`);function i(e){e.emit(`close`)}function a(){!this.destroyed&&this._writableState.finished&&this.destroy()}function o(e){this.removeListener(`error`,o),this.destroy(),this.listenerCount(`error`)===0&&this.emit(`error`,e)}function s(e,t){let n=!0,s=new r({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on(`message`,function(t,n){let r=!n&&s._readableState.objectMode?t.toString():t;s.push(r)||e.pause()}),e.once(`error`,function(e){s.destroyed||(n=!1,s.destroy(e))}),e.once(`close`,function(){s.destroyed||s.push(null)}),s._destroy=function(t,r){if(e.readyState===e.CLOSED){r(t),process.nextTick(i,s);return}let a=!1;e.once(`error`,function(e){a=!0,r(e)}),e.once(`close`,function(){a||r(t),process.nextTick(i,s)}),n&&e.terminate()},s._final=function(t){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._final(t)});return}e._socket!==null&&(e._socket._writableState.finished?(t(),s._readableState.endEmitted&&s.destroy()):(e._socket.once(`finish`,function(){t()}),e.close()))},s._read=function(){e.isPaused&&e.resume()},s._write=function(t,n,r){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._write(t,n,r)});return}e.send(t,r)},s.on(`end`,a),s.on(`error`,o),s}n.exports=s})),c8=i(((e,t)=>{let{tokenChars:n}=r8();function r(e){let t=new Set,r=-1,i=-1,a=0;for(;a<e.length;a++){let o=e.charCodeAt(a);if(i===-1&&n[o]===1)r===-1&&(r=a);else if(a!==0&&(o===32||o===9))i===-1&&r!==-1&&(i=a);else if(o===44){if(r===-1)throw SyntaxError(`Unexpected character at index ${a}`);i===-1&&(i=a);let n=e.slice(r,i);if(t.has(n))throw SyntaxError(`The "${n}" subprotocol is duplicated`);t.add(n),r=i=-1}else throw SyntaxError(`Unexpected character at index ${a}`)}if(r===-1||i!==-1)throw SyntaxError(`Unexpected end of input`);let o=e.slice(r,a);if(t.has(o))throw SyntaxError(`The "${o}" subprotocol is duplicated`);return t.add(o),t}t.exports={parse:r}})),JDe=i(((e,n)=>{let r=t(`events`),i=t(`http`),{Duplex:a}=t(`stream`),{createHash:o}=t(`crypto`),s=o8(),c=n8(),l=c8(),u=s8(),{CLOSE_TIMEOUT:d,GUID:f,kWebSocket:p}=e8(),m=/^[+/0-9A-Za-z]{22}==$/;n.exports=class extends r{constructor(e,t){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:1048576,maxFragments:131072,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:d,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:u,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw TypeError(`One and only one of the "port", "server", or "noServer" options must be specified`);if(e.port==null?e.server&&(this._server=e.server):(this._server=i.createServer((e,t)=>{let n=i.STATUS_CODES[426];t.writeHead(426,{"Content-Length":n.length,"Content-Type":`text/plain`}),t.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)),this._server){let e=this.emit.bind(this,`connection`);this._removeListeners=h(this._server,{listening:this.emit.bind(this,`listening`),error:this.emit.bind(this,`error`),upgrade:(t,n,r)=>{this.handleUpgrade(t,n,r,e)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw Error(`The server is operating in "noServer" mode`);return this._server?this._server.address():null}close(e){if(this._state===2){e&&this.once(`close`,()=>{e(Error(`The server is not running`))}),process.nextTick(g,this);return}if(e&&this.once(`close`,e),this._state!==1){if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(g,this);else{let e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{g(this)})}}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf(`?`);if((t===-1?e.url:e.url.slice(0,t))!==this.options.path)return!1}return!0}handleUpgrade(e,t,n,r){t.on(`error`,_);let i=e.headers[`sec-websocket-key`],a=e.headers.upgrade,o=+e.headers[`sec-websocket-version`];if(e.method!==`GET`){y(this,e,t,405,`Invalid HTTP method`);return}if(a===void 0||a.toLowerCase()!==`websocket`){y(this,e,t,400,`Invalid Upgrade header`);return}if(i===void 0||!m.test(i)){y(this,e,t,400,`Missing or invalid Sec-WebSocket-Key header`);return}if(o!==13&&o!==8){y(this,e,t,400,`Missing or invalid Sec-WebSocket-Version header`,{"Sec-WebSocket-Version":`13, 8`});return}if(!this.shouldHandle(e)){v(t,400);return}let u=e.headers[`sec-websocket-protocol`],d=new Set;if(u!==void 0)try{d=l.parse(u)}catch{y(this,e,t,400,`Invalid Sec-WebSocket-Protocol header`);return}let f=e.headers[`sec-websocket-extensions`],p={};if(this.options.perMessageDeflate&&f!==void 0){let n=new c({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let e=s.parse(f);e[c.extensionName]&&(n.accept(e[c.extensionName]),p[c.extensionName]=n)}catch{y(this,e,t,400,`Invalid or unacceptable Sec-WebSocket-Extensions header`);return}}if(this.options.verifyClient){let a={origin:e.headers[`${o===8?`sec-websocket-origin`:`origin`}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(a,(a,o,s,c)=>{if(!a)return v(t,o||401,s,c);this.completeUpgrade(p,i,d,e,t,n,r)});return}if(!this.options.verifyClient(a))return v(t,401)}this.completeUpgrade(p,i,d,e,t,n,r)}completeUpgrade(e,t,n,r,i,a,l){if(!i.readable||!i.writable)return i.destroy();if(i[p])throw Error(`server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration`);if(this._state>0)return v(i,503);let u=[`HTTP/1.1 101 Switching Protocols`,`Upgrade: websocket`,`Connection: Upgrade`,`Sec-WebSocket-Accept: ${o(`sha1`).update(t+f).digest(`base64`)}`],d=new this.options.WebSocket(null,void 0,this.options);if(n.size){let e=this.options.handleProtocols?this.options.handleProtocols(n,r):n.values().next().value;e&&(u.push(`Sec-WebSocket-Protocol: ${e}`),d._protocol=e)}if(e[c.extensionName]){let t=e[c.extensionName].params,n=s.format({[c.extensionName]:[t]});u.push(`Sec-WebSocket-Extensions: ${n}`),d._extensions=e}this.emit(`headers`,u,r),i.write(u.concat(`\r
|
|
1086
1088
|
`).join(`\r
|
|
1087
1089
|
`)),i.removeListener(`error`,_),d.setSocket(i,a,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(d),d.on(`close`,()=>{this.clients.delete(d),this._shouldEmitClose&&!this.clients.size&&process.nextTick(g,this)})),l(d,r)}};function h(e,t){for(let n of Object.keys(t))e.on(n,t[n]);return function(){for(let n of Object.keys(t))e.removeListener(n,t[n])}}function g(e){e._state=2,e.emit(`close`)}function _(){this.destroy()}function v(e,t,n,r){n||=i.STATUS_CODES[t],r={Connection:`close`,"Content-Type":`text/html`,"Content-Length":Buffer.byteLength(n),...r},e.once(`finish`,e.destroy),e.end(`HTTP/1.1 ${t} ${i.STATUS_CODES[t]}\r\n`+Object.keys(r).map(e=>`${e}: ${r[e]}`).join(`\r
|
|
1088
1090
|
`)+`\r
|
|
1089
1091
|
\r
|
|
1090
|
-
`+n)}function y(e,t,n,r,i,a){if(e.listenerCount(`wsClientError`)){let r=Error(i);Error.captureStackTrace(r,y),e.emit(`wsClientError`,r,n,t)}else v(n,r,i,a)}}));KDe(),o8(),n8(),i8(),a8(),c8(),s8(),qDe();let l8,u8,d8,f8,p8=!0;typeof process<`u`&&({FORCE_COLOR:l8,NODE_DISABLE_COLORS:u8,NO_COLOR:d8,TERM:f8}=process.env||{},p8=process.stdout&&process.stdout.isTTY);const m8={enabled:!u8&&d8==null&&f8!==`dumb`&&(l8!=null&&l8!==`0`||p8),reset:g8(0,0),bold:g8(1,22),dim:g8(2,22),italic:g8(3,23),underline:g8(4,24),inverse:g8(7,27),hidden:g8(8,28),strikethrough:g8(9,29),black:g8(30,39),red:g8(31,39),green:g8(32,39),yellow:g8(33,39),blue:g8(34,39),magenta:g8(35,39),cyan:g8(36,39),white:g8(37,39),gray:g8(90,39),grey:g8(90,39),bgBlack:g8(40,49),bgRed:g8(41,49),bgGreen:g8(42,49),bgYellow:g8(43,49),bgBlue:g8(44,49),bgMagenta:g8(45,49),bgCyan:g8(46,49),bgWhite:g8(47,49)};function h8(e,t){let n=0,r,i=``,a=``;for(;n<e.length;n++)r=e[n],i+=r.open,a+=r.close,~t.indexOf(r.close)&&(t=t.replace(r.rgx,r.close+r.open));return i+t+a}function JDe(e,t){let n={has:e,keys:t};return n.reset=m8.reset.bind(n),n.bold=m8.bold.bind(n),n.dim=m8.dim.bind(n),n.italic=m8.italic.bind(n),n.underline=m8.underline.bind(n),n.inverse=m8.inverse.bind(n),n.hidden=m8.hidden.bind(n),n.strikethrough=m8.strikethrough.bind(n),n.black=m8.black.bind(n),n.red=m8.red.bind(n),n.green=m8.green.bind(n),n.yellow=m8.yellow.bind(n),n.blue=m8.blue.bind(n),n.magenta=m8.magenta.bind(n),n.cyan=m8.cyan.bind(n),n.white=m8.white.bind(n),n.gray=m8.gray.bind(n),n.grey=m8.grey.bind(n),n.bgBlack=m8.bgBlack.bind(n),n.bgRed=m8.bgRed.bind(n),n.bgGreen=m8.bgGreen.bind(n),n.bgYellow=m8.bgYellow.bind(n),n.bgBlue=m8.bgBlue.bind(n),n.bgMagenta=m8.bgMagenta.bind(n),n.bgCyan=m8.bgCyan.bind(n),n.bgWhite=m8.bgWhite.bind(n),n}function g8(e,t){let n={open:`\x1b[${e}m`,close:`\x1b[${t}m`,rgx:RegExp(`\\x1b\\[${t}m`,`g`)};return function(t){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(e)||(this.has.push(e),this.keys.push(n)),t===void 0?this:m8.enabled?h8(this.keys,t+``):t+``):t===void 0?JDe([e],[n]):m8.enabled?h8([n],t+``):t+``}}Number.isNaN,Number.isInteger,Number.isNaN,Number.parseInt,Array.from,Array.isArray;const YDe=String.fromCharCode;String.fromCodePoint,YDe(65535);const _8=typeof TextEncoder<`u`?new TextEncoder:null;let v8=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});v8&&v8.decode(new Uint8Array).length===1&&(v8=null);const y8=e=>Error(e);new Uint8Array(3e4).length/3,_8&&_8.encodeInto,y8(`Unexpected end of array`),y8(`Integer out of Range`),Date.now;var b8=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),x8=a(import.meta.url),S8=b8(((e,t)=>{let n=[`nodebuffer`,`arraybuffer`,`fragments`],r=typeof Blob<`u`;r&&n.push(`blob`),t.exports={BINARY_TYPES:n,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:`258EAFA5-E914-47DA-95CA-C5AB0DC85B11`,hasBlob:r,kForOnEventAttribute:Symbol(`kIsForOnEventAttribute`),kListener:Symbol(`kListener`),kStatusCode:Symbol(`status-code`),kWebSocket:Symbol(`websocket`),NOOP:()=>{}}})),C8=b8(((e,t)=>{let{EMPTY_BUFFER:n}=S8(),r=Buffer[Symbol.species];function i(e,t){if(e.length===0)return n;if(e.length===1)return e[0];let i=Buffer.allocUnsafe(t),a=0;for(let t=0;t<e.length;t++){let n=e[t];i.set(n,a),a+=n.length}return a<t?new r(i.buffer,i.byteOffset,a):i}function a(e,t,n,r,i){for(let a=0;a<i;a++)n[r+a]=e[a]^t[a&3]}function o(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}function s(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function c(e){if(c.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new r(e):ArrayBuffer.isView(e)?t=new r(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),c.readOnly=!1),t}if(t.exports={concat:i,mask:a,toArrayBuffer:s,toBuffer:c,unmask:o},!process.env.WS_NO_BUFFER_UTIL)try{let e=x8(`bufferutil`);t.exports.mask=function(t,n,r,i,o){o<48?a(t,n,r,i,o):e.mask(t,n,r,i,o)},t.exports.unmask=function(t,n){t.length<32?o(t,n):e.unmask(t,n)}}catch{}})),XDe=b8(((e,t)=>{let n=Symbol(`kDone`),r=Symbol(`kRun`);t.exports=class{constructor(e){this[n]=()=>{this.pending--,this[r]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[r]()}[r](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[n])}}}})),w8=b8(((e,t)=>{let n=x8(`zlib`),r=C8(),i=XDe(),{kStatusCode:a}=S8(),o=Buffer[Symbol.species],s=Buffer.from([0,0,255,255]),c=Symbol(`permessage-deflate`),l=Symbol(`total-length`),u=Symbol(`callback`),d=Symbol(`buffers`),f=Symbol(`error`),p;t.exports=class{constructor(e,t,n){this._maxPayload=n|0,this._options=e||{},this._threshold=this._options.threshold===void 0?1024:this._options.threshold,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,p||=new i(this._options.concurrencyLimit===void 0?10:this._options.concurrencyLimit)}static get extensionName(){return`permessage-deflate`}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits??(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&=(this._inflate.close(),null),this._deflate){let e=this._deflate[u];this._deflate.close(),this._deflate=null,e&&e(Error(`The deflate stream was closed while data was being processed`))}}acceptAsServer(e){let t=this._options,n=e.find(e=>!(t.serverNoContextTakeover===!1&&e.server_no_context_takeover||e.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits==`number`&&t.serverMaxWindowBits>e.server_max_window_bits)||typeof t.clientMaxWindowBits==`number`&&!e.client_max_window_bits));if(!n)throw Error(`None of the extension offers can be accepted`);return t.serverNoContextTakeover&&(n.server_no_context_takeover=!0),t.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof t.serverMaxWindowBits==`number`&&(n.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits==`number`?n.client_max_window_bits=t.clientMaxWindowBits:(n.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw Error(`Unexpected parameter "client_no_context_takeover"`);if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits==`number`&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==`number`&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw Error(`Unexpected or invalid parameter "client_max_window_bits"`);return t}normalizeParams(e){return e.forEach(e=>{Object.keys(e).forEach(t=>{let n=e[t];if(n.length>1)throw Error(`Parameter "${t}" must have only a single value`);if(n=n[0],t===`client_max_window_bits`){if(n!==!0){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else if(t===`server_max_window_bits`){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(t===`client_no_context_takeover`||t===`server_no_context_takeover`){if(n!==!0)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else throw Error(`Unknown parameter "${t}"`);e[t]=n})}),e}decompress(e,t,n){p.add(r=>{this._decompress(e,t,(e,t)=>{r(),n(e,t)})})}compress(e,t,n){p.add(r=>{this._compress(e,t,(e,t)=>{r(),n(e,t)})})}_decompress(e,t,i){let a=this._isServer?`client`:`server`;if(!this._inflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:n.Z_DEFAULT_WINDOWBITS;this._inflate=n.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[c]=this,this._inflate[l]=0,this._inflate[d]=[],this._inflate.on(`error`,g),this._inflate.on(`data`,h)}this._inflate[u]=i,this._inflate.write(e),t&&this._inflate.write(s),this._inflate.flush(()=>{let e=this._inflate[f];if(e){this._inflate.close(),this._inflate=null,i(e);return}let n=r.concat(this._inflate[d],this._inflate[l]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[l]=0,this._inflate[d]=[],t&&this.params[`${a}_no_context_takeover`]&&this._inflate.reset()),i(null,n)})}_compress(e,t,i){let a=this._isServer?`server`:`client`;if(!this._deflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:n.Z_DEFAULT_WINDOWBITS;this._deflate=n.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[l]=0,this._deflate[d]=[],this._deflate.on(`data`,m)}this._deflate[u]=i,this._deflate.write(e),this._deflate.flush(n.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let e=r.concat(this._deflate[d],this._deflate[l]);t&&(e=new o(e.buffer,e.byteOffset,e.length-4)),this._deflate[u]=null,this._deflate[l]=0,this._deflate[d]=[],t&&this.params[`${a}_no_context_takeover`]&&this._deflate.reset(),i(null,e)})}};function m(e){this[d].push(e),this[l]+=e.length}function h(e){if(this[l]+=e.length,this[c]._maxPayload<1||this[l]<=this[c]._maxPayload){this[d].push(e);return}this[f]=RangeError(`Max payload size exceeded`),this[f].code=`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`,this[f][a]=1009,this.removeListener(`data`,h),this.reset()}function g(e){if(this[c]._inflate=null,this[f]){this[u](this[f]);return}e[a]=1007,this[u](e)}})),T8=b8(((e,t)=>{let{isUtf8:n}=x8(`buffer`),{hasBlob:r}=S8(),i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function a(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function o(e){let t=e.length,n=0;for(;n<t;)if(!(e[n]&128))n++;else if((e[n]&224)==192){if(n+1===t||(e[n+1]&192)!=128||(e[n]&254)==192)return!1;n+=2}else if((e[n]&240)==224){if(n+2>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||e[n]===224&&(e[n+1]&224)==128||e[n]===237&&(e[n+1]&224)==160)return!1;n+=3}else if((e[n]&248)==240){if(n+3>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||(e[n+3]&192)!=128||e[n]===240&&(e[n+1]&240)==128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}function s(e){return r&&typeof e==`object`&&typeof e.arrayBuffer==`function`&&typeof e.type==`string`&&typeof e.stream==`function`&&(e[Symbol.toStringTag]===`Blob`||e[Symbol.toStringTag]===`File`)}if(t.exports={isBlob:s,isValidStatusCode:a,isValidUTF8:o,tokenChars:i},n)t.exports.isValidUTF8=function(e){return e.length<24?o(e):n(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=x8(`utf-8-validate`);t.exports.isValidUTF8=function(t){return t.length<32?o(t):e(t)}}catch{}})),E8=b8(((e,t)=>{let{Writable:n}=x8(`stream`),r=w8(),{BINARY_TYPES:i,EMPTY_BUFFER:a,kStatusCode:o,kWebSocket:s}=S8(),{concat:c,toArrayBuffer:l,unmask:u}=C8(),{isValidStatusCode:d,isValidUTF8:f}=T8(),p=Buffer[Symbol.species];t.exports=class extends n{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents===void 0||e.allowSynchronousEvents,this._binaryType=e.binaryType||i[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[s]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(e,t,n){if(this._opcode===8&&this._state==0)return n();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let t=this._buffers[0];return this._buffers[0]=new p(t.buffer,t.byteOffset+e,t.length-e),new p(t.buffer,t.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let n=this._buffers[0],r=t.length-e;e>=n.length?t.set(this._buffers.shift(),r):(t.set(new Uint8Array(n.buffer,n.byteOffset,e),r),this._buffers[0]=new p(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if(t[0]&48){e(this.createError(RangeError,`RSV2 and RSV3 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_2_3`));return}let n=(t[0]&64)==64;if(n&&!this._extensions[r.extensionName]){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._fin=(t[0]&128)==128,this._opcode=t[0]&15,this._payloadLength=t[1]&127,this._opcode===0){if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(!this._fragmented){e(this.createError(RangeError,`invalid opcode 0`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){e(this.createError(RangeError,`FIN must be set`,!0,1002,`WS_ERR_EXPECTED_FIN`));return}if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){e(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,`WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH`));return}}else{e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(t[1]&128)==128,this._isServer){if(!this._masked){e(this.createError(RangeError,`MASK must be set`,!0,1002,`WS_ERR_EXPECTED_MASK`));return}}else if(this._masked){e(this.createError(RangeError,`MASK must be clear`,!0,1002,`WS_ERR_UNEXPECTED_MASK`));return}this._payloadLength===126?this._state=1:this._payloadLength===127?this._state=2:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),n=t.readUInt32BE(0);if(n>2**21-1){e(this.createError(RangeError,`Unsupported WebSocket frame: payload length > 2^53 - 1`,!1,1009,`WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH`));return}this._payloadLength=n*2**32+t.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){e(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._state=this._masked?3:4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(e){let t=a;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&u(t,this._mask)}if(this._opcode>7){this.controlMessage(t,e);return}if(this._compressed){this._state=5,this.decompress(t,e);return}t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage(e)}decompress(e,t){this._extensions[r.extensionName].decompress(e,this._fin,(e,n)=>{if(e)return t(e);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0){t(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._fragments.push(n)}this.dataMessage(t),this._state===0&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=0;return}let t=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;r=this._binaryType===`nodebuffer`?c(n,t):this._binaryType===`arraybuffer`?l(c(n,t)):this._binaryType===`blob`?new Blob(n):n,this._allowSynchronousEvents?(this.emit(`message`,r,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!0),this._state=0,this.startLoop(e)}))}else{let r=c(n,t);if(!this._skipUTF8Validation&&!f(r)){e(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._state===5||this._allowSynchronousEvents?(this.emit(`message`,r,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!1),this._state=0,this.startLoop(e)}))}}controlMessage(e,t){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit(`conclude`,1005,a),this.end();else{let n=e.readUInt16BE(0);if(!d(n)){t(this.createError(RangeError,`invalid status code ${n}`,!0,1002,`WS_ERR_INVALID_CLOSE_CODE`));return}let r=new p(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!f(r)){t(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._loop=!1,this.emit(`conclude`,n,r),this.end()}this._state=0;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0):(this._state=6,setImmediate(()=>{this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0,this.startLoop(t)}))}createError(e,t,n,r,i){this._loop=!1,this._errored=!0;let a=new e(n?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(a,this.createError),a.code=i,a[o]=r,a}}})),D8=b8(((e,t)=>{let{Duplex:n}=x8(`stream`),{randomFillSync:r}=x8(`crypto`),i=w8(),{EMPTY_BUFFER:a,kWebSocket:o,NOOP:s}=S8(),{isBlob:c,isValidStatusCode:l}=T8(),{mask:u,toBuffer:d}=C8(),f=Symbol(`kByteLength`),p=Buffer.alloc(4),m=8192,h,g=m;t.exports=class e{constructor(e,t,n){this._extensions=t||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=s,this[o]=void 0}static frame(e,t){let n,i=!1,a=2,o=!1;t.mask&&(n=t.maskBuffer||p,t.generateMask?t.generateMask(n):(g===m&&(h===void 0&&(h=Buffer.alloc(m)),r(h,0,m),g=0),n[0]=h[g++],n[1]=h[g++],n[2]=h[g++],n[3]=h[g++]),o=(n[0]|n[1]|n[2]|n[3])===0,a=6);let s;typeof e==`string`?(!t.mask||o)&&t[f]!==void 0?s=t[f]:(e=Buffer.from(e),s=e.length):(s=e.length,i=t.mask&&t.readOnly&&!o);let c=s;s>=65536?(a+=8,c=127):s>125&&(a+=2,c=126);let l=Buffer.allocUnsafe(i?s+a:a);return l[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(l[0]|=64),l[1]=c,c===126?l.writeUInt16BE(s,2):c===127&&(l[2]=l[3]=0,l.writeUIntBE(s,4,6)),!t.mask||(l[1]|=128,l[a-4]=n[0],l[a-3]=n[1],l[a-2]=n[2],l[a-1]=n[3],o)?[l,e]:i?(u(e,n,l,a,s),[l]):(u(e,n,e,0,s),[l,e])}close(t,n,r,i){let o;if(t===void 0)o=a;else if(typeof t!=`number`||!l(t))throw TypeError(`First argument must be a valid error code number`);else if(n===void 0||!n.length)o=Buffer.allocUnsafe(2),o.writeUInt16BE(t,0);else{let e=Buffer.byteLength(n);if(e>123)throw RangeError(`The message must not be greater than 123 bytes`);o=Buffer.allocUnsafe(2+e),o.writeUInt16BE(t,0),typeof n==`string`?o.write(n,2):o.set(n,2)}let s={[f]:o.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state===0?this.sendFrame(e.frame(o,s),i):this.enqueue([this.dispatch,o,!1,s,i])}ping(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):c(t)?(i=t.size,a=!1):(t=d(t),i=t.length,a=d.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[f]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};c(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}pong(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):c(t)?(i=t.size,a=!1):(t=d(t),i=t.length,a=d.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[f]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};c(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}send(e,t,n){let r=this._extensions[i.extensionName],a=t.binary?2:1,o=t.compress,s,l;typeof e==`string`?(s=Buffer.byteLength(e),l=!1):c(e)?(s=e.size,l=!1):(e=d(e),s=e.length,l=d.readOnly),this._firstFragment?(this._firstFragment=!1,o&&r&&r.params[r._isServer?`server_no_context_takeover`:`client_no_context_takeover`]&&(o=s>=r._threshold),this._compress=o):(o=!1,a=0),t.fin&&(this._firstFragment=!0);let u={[f]:s,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:l,rsv1:o};c(e)?this._state===0?this.getBlobData(e,this._compress,u,n):this.enqueue([this.getBlobData,e,this._compress,u,n]):this._state===0?this.dispatch(e,this._compress,u,n):this.enqueue([this.dispatch,e,this._compress,u,n])}getBlobData(t,n,r,i){this._bufferedBytes+=r[f],this._state=2,t.arrayBuffer().then(t=>{if(this._socket.destroyed){let e=Error(`The socket was closed while the blob was being read`);process.nextTick(_,this,e,i);return}this._bufferedBytes-=r[f];let a=d(t);n?this.dispatch(a,n,r,i):(this._state=0,this.sendFrame(e.frame(a,r),i),this.dequeue())}).catch(e=>{process.nextTick(v,this,e,i)})}dispatch(t,n,r,a){if(!n){this.sendFrame(e.frame(t,r),a);return}let o=this._extensions[i.extensionName];this._bufferedBytes+=r[f],this._state=1,o.compress(t,r.fin,(t,n)=>{if(this._socket.destroyed){_(this,Error(`The socket was closed while data was being compressed`),a);return}this._bufferedBytes-=r[f],this._state=0,r.readOnly=!1,this.sendFrame(e.frame(n,r),a),this.dequeue()})}dequeue(){for(;this._state===0&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][f],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][f],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};function _(e,t,n){typeof n==`function`&&n(t);for(let n=0;n<e._queue.length;n++){let r=e._queue[n],i=r[r.length-1];typeof i==`function`&&i(t)}}function v(e,t,n){_(e,t,n),e.onerror(t)}})),ZDe=b8(((e,t)=>{let{kForOnEventAttribute:n,kListener:r}=S8(),i=Symbol(`kCode`),a=Symbol(`kData`),o=Symbol(`kError`),s=Symbol(`kMessage`),c=Symbol(`kReason`),l=Symbol(`kTarget`),u=Symbol(`kType`),d=Symbol(`kWasClean`);var f=class{constructor(e){this[l]=null,this[u]=e}get target(){return this[l]}get type(){return this[u]}};Object.defineProperty(f.prototype,"target",{enumerable:!0}),Object.defineProperty(f.prototype,"type",{enumerable:!0});var p=class extends f{constructor(e,t={}){super(e),this[i]=t.code===void 0?0:t.code,this[c]=t.reason===void 0?``:t.reason,this[d]=t.wasClean!==void 0&&t.wasClean}get code(){return this[i]}get reason(){return this[c]}get wasClean(){return this[d]}};Object.defineProperty(p.prototype,"code",{enumerable:!0}),Object.defineProperty(p.prototype,"reason",{enumerable:!0}),Object.defineProperty(p.prototype,"wasClean",{enumerable:!0});var m=class extends f{constructor(e,t={}){super(e),this[o]=t.error===void 0?null:t.error,this[s]=t.message===void 0?``:t.message}get error(){return this[o]}get message(){return this[s]}};Object.defineProperty(m.prototype,"error",{enumerable:!0}),Object.defineProperty(m.prototype,"message",{enumerable:!0});var h=class extends f{constructor(e,t={}){super(e),this[a]=t.data===void 0?null:t.data}get data(){return this[a]}};Object.defineProperty(h.prototype,"data",{enumerable:!0}),t.exports={CloseEvent:p,ErrorEvent:m,Event:f,EventTarget:{addEventListener(e,t,i={}){for(let a of this.listeners(e))if(!i[n]&&a[r]===t&&!a[n])return;let a;if(e===`message`)a=function(e,n){let r=new h(`message`,{data:n?e:e.toString()});r[l]=this,g(t,this,r)};else if(e===`close`)a=function(e,n){let r=new p(`close`,{code:e,reason:n.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[l]=this,g(t,this,r)};else if(e===`error`)a=function(e){let n=new m(`error`,{error:e,message:e.message});n[l]=this,g(t,this,n)};else if(e===`open`)a=function(){let e=new f(`open`);e[l]=this,g(t,this,e)};else return;a[n]=!!i[n],a[r]=t,i.once?this.once(e,a):this.on(e,a)},removeEventListener(e,t){for(let i of this.listeners(e))if(i[r]===t&&!i[n]){this.removeListener(e,i);break}}},MessageEvent:h};function g(e,t,n){typeof e==`object`&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}})),O8=b8(((e,t)=>{let{tokenChars:n}=T8();function r(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}function i(e){let t=Object.create(null),i=Object.create(null),a=!1,o=!1,s=!1,c,l,u=-1,d=-1,f=-1,p=0;for(;p<e.length;p++)if(d=e.charCodeAt(p),c===void 0){if(f===-1&&n[d]===1)u===-1&&(u=p);else if(p!==0&&(d===32||d===9))f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);d===44?(r(t,n,i),i=Object.create(null)):c=n,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`)}else if(l===void 0){if(f===-1&&n[d]===1)u===-1&&(u=p);else if(d===32||d===9)f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p),r(i,e.slice(u,f),!0),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),u=f=-1}else if(d===61&&u!==-1&&f===-1)l=e.slice(u,p),u=f=-1;else throw SyntaxError(`Unexpected character at index ${p}`)}else if(o){if(n[d]!==1)throw SyntaxError(`Unexpected character at index ${p}`);u===-1?u=p:a||=!0,o=!1}else if(s){if(n[d]===1)u===-1&&(u=p);else if(d===34&&u!==-1)s=!1,f=p;else if(d===92)o=!0;else throw SyntaxError(`Unexpected character at index ${p}`)}else if(d===34&&e.charCodeAt(p-1)===61)s=!0;else if(f===-1&&n[d]===1)u===-1&&(u=p);else if(u!==-1&&(d===32||d===9))f===-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);a&&=(n=n.replace(/\\/g,``),!1),r(i,l,n),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),l=void 0,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);if(u===-1||s||d===32||d===9)throw SyntaxError(`Unexpected end of input`);f===-1&&(f=p);let m=e.slice(u,f);return c===void 0?r(t,m,i):(l===void 0?r(i,m,!0):a?r(i,l,m.replace(/\\/g,``)):r(i,l,m),r(t,c,i)),t}function a(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>[t].concat(Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>e===!0?t:`${t}=${e}`).join(`; `)})).join(`; `)).join(`, `)}).join(`, `)}t.exports={format:a,parse:i}})),k8=b8(((e,t)=>{let n=x8(`events`),r=x8(`https`),i=x8(`http`),a=x8(`net`),o=x8(`tls`),{randomBytes:s,createHash:c}=x8(`crypto`),{Duplex:l,Readable:u}=x8(`stream`),{URL:d}=x8(`url`),f=w8(),p=E8(),m=D8(),{isBlob:h}=T8(),{BINARY_TYPES:g,CLOSE_TIMEOUT:_,EMPTY_BUFFER:v,GUID:y,kForOnEventAttribute:b,kListener:x,kStatusCode:S,kWebSocket:C,NOOP:w}=S8(),{EventTarget:{addEventListener:T,removeEventListener:E}}=ZDe(),{format:D,parse:O}=O8(),{toBuffer:ee}=C8(),te=Symbol(`kAborted`),ne=[8,13],re=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],ie=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;var ae=class e extends n{constructor(t,n,r){super(),this._binaryType=g[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=v,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol=``,this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t===null?(this._autoPong=r.autoPong,this._closeTimeout=r.closeTimeout,this._isServer=!0):(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,n===void 0?n=[]:Array.isArray(n)||(typeof n==`object`&&n?(r=n,n=[]):n=[n]),oe(this,t,n,r))}get binaryType(){return this._binaryType}set binaryType(e){g.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,n,r){let i=new p({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),a=new m(t,this._extensions,r.generateMask);this._receiver=i,this._sender=a,this._socket=t,i[C]=this,a[C]=this,t[C]=this,i.on(`conclude`,A),i.on(`drain`,j),i.on(`error`,de),i.on(`message`,pe),i.on(`ping`,me),i.on(`pong`,M),a.onerror=ge,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on(`close`,_e),t.on(`data`,ve),t.on(`end`,ye),t.on(`error`,be),this._readyState=e.OPEN,this.emit(`open`)}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage);return}this._extensions[f.extensionName]&&this._extensions[f.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage)}close(t,n){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){le(this,this._req,`WebSocket was closed before the connection was established`);return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,n,!this._isServer,e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),N(this)}}pause(){this.readyState!==e.CONNECTING&&this.readyState!==e.CLOSED&&(this._paused=!0,this._socket.pause())}ping(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){ue(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.ping(t||v,n,r)}pong(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){ue(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.pong(t||v,n,r)}resume(){this.readyState!==e.CONNECTING&&this.readyState!==e.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof n==`function`&&(r=n,n={}),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){ue(this,t,r);return}let i={binary:typeof t!=`string`,mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[f.extensionName]||(i.compress=!1),this._sender.send(t||v,i,r)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){le(this,this._req,`WebSocket was closed before the connection was established`);return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(ae,"CONNECTING",{enumerable:!0,value:re.indexOf(`CONNECTING`)}),Object.defineProperty(ae.prototype,"CONNECTING",{enumerable:!0,value:re.indexOf(`CONNECTING`)}),Object.defineProperty(ae,"OPEN",{enumerable:!0,value:re.indexOf(`OPEN`)}),Object.defineProperty(ae.prototype,"OPEN",{enumerable:!0,value:re.indexOf(`OPEN`)}),Object.defineProperty(ae,"CLOSING",{enumerable:!0,value:re.indexOf(`CLOSING`)}),Object.defineProperty(ae.prototype,"CLOSING",{enumerable:!0,value:re.indexOf(`CLOSING`)}),Object.defineProperty(ae,"CLOSED",{enumerable:!0,value:re.indexOf(`CLOSED`)}),Object.defineProperty(ae.prototype,"CLOSED",{enumerable:!0,value:re.indexOf(`CLOSED`)}),[`binaryType`,`bufferedAmount`,`extensions`,`isPaused`,`protocol`,`readyState`,`url`].forEach(e=>{Object.defineProperty(ae.prototype,e,{enumerable:!0})}),[`open`,`error`,`close`,`message`].forEach(e=>{Object.defineProperty(ae.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[b])return t[x];return null},set(t){for(let t of this.listeners(e))if(t[b]){this.removeListener(e,t);break}typeof t==`function`&&this.addEventListener(e,t,{[b]:!0})}})}),ae.prototype.addEventListener=T,ae.prototype.removeEventListener=E,t.exports=ae;function oe(e,t,n,a){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:_,protocolVersion:ne[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...a,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:`GET`,host:void 0,path:void 0,port:void 0};if(e._autoPong=o.autoPong,e._closeTimeout=o.closeTimeout,!ne.includes(o.protocolVersion))throw RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${ne.join(`, `)})`);let l;if(t instanceof d)l=t;else try{l=new d(t)}catch{throw SyntaxError(`Invalid URL: ${t}`)}l.protocol===`http:`?l.protocol=`ws:`:l.protocol===`https:`&&(l.protocol=`wss:`),e._url=l.href;let u=l.protocol===`wss:`,p=l.protocol===`ws+unix:`,m;if(l.protocol!==`ws:`&&!u&&!p?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:p&&!l.pathname?m=`The URL's pathname is empty`:l.hash&&(m=`The URL contains a fragment identifier`),m){let t=SyntaxError(m);if(e._redirects===0)throw t;se(e,t);return}let h=u?443:80,g=s(16).toString(`base64`),v=u?r.request:i.request,b=new Set,x;if(o.createConnection=o.createConnection||(u?ce:k),o.defaultPort=o.defaultPort||h,o.port=l.port||h,o.host=l.hostname.startsWith(`[`)?l.hostname.slice(1,-1):l.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":g,Connection:`Upgrade`,Upgrade:`websocket`},o.path=l.pathname+l.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(x=new f(o.perMessageDeflate===!0?{}:o.perMessageDeflate,!1,o.maxPayload),o.headers[`Sec-WebSocket-Extensions`]=D({[f.extensionName]:x.offer()})),n.length){for(let e of n){if(typeof e!=`string`||!ie.test(e)||b.has(e))throw SyntaxError(`An invalid or duplicated subprotocol was specified`);b.add(e)}o.headers[`Sec-WebSocket-Protocol`]=n.join(`,`)}if(o.origin&&(o.protocolVersion<13?o.headers[`Sec-WebSocket-Origin`]=o.origin:o.headers.Origin=o.origin),(l.username||l.password)&&(o.auth=`${l.username}:${l.password}`),p){let e=o.path.split(`:`);o.socketPath=e[0],o.path=e[1]}let S;if(o.followRedirects){if(e._redirects===0){e._originalIpc=p,e._originalSecure=u,e._originalHostOrSocketPath=p?o.socketPath:l.host;let t=a&&a.headers;if(a={...a,headers:{}},t)for(let[e,n]of Object.entries(t))a.headers[e.toLowerCase()]=n}else if(e.listenerCount(`redirect`)===0){let t=p?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:!e._originalIpc&&l.host===e._originalHostOrSocketPath;(!t||e._originalSecure&&!u)&&(delete o.headers.authorization,delete o.headers.cookie,t||delete o.headers.host,o.auth=void 0)}o.auth&&!a.headers.authorization&&(a.headers.authorization=`Basic `+Buffer.from(o.auth).toString(`base64`)),S=e._req=v(o),e._redirects&&e.emit(`redirect`,e.url,S)}else S=e._req=v(o);o.timeout&&S.on(`timeout`,()=>{le(e,S,`Opening handshake has timed out`)}),S.on(`error`,t=>{S===null||S[te]||(S=e._req=null,se(e,t))}),S.on(`response`,r=>{let i=r.headers.location,s=r.statusCode;if(i&&o.followRedirects&&s>=300&&s<400){if(++e._redirects>o.maxRedirects){le(e,S,`Maximum redirects exceeded`);return}S.abort();let r;try{r=new d(i,t)}catch{se(e,SyntaxError(`Invalid URL: ${i}`));return}oe(e,r,n,a)}else e.emit(`unexpected-response`,S,r)||le(e,S,`Unexpected server response: ${r.statusCode}`)}),S.on(`upgrade`,(t,n,r)=>{if(e.emit(`upgrade`,t),e.readyState!==ae.CONNECTING)return;S=e._req=null;let i=t.headers.upgrade;if(i===void 0||i.toLowerCase()!==`websocket`){le(e,n,`Invalid Upgrade header`);return}let a=c(`sha1`).update(g+y).digest(`base64`);if(t.headers[`sec-websocket-accept`]!==a){le(e,n,`Invalid Sec-WebSocket-Accept header`);return}let s=t.headers[`sec-websocket-protocol`],l;if(s===void 0?b.size&&(l=`Server sent no subprotocol`):b.size?b.has(s)||(l=`Server sent an invalid subprotocol`):l=`Server sent a subprotocol but none was requested`,l){le(e,n,l);return}s&&(e._protocol=s);let u=t.headers[`sec-websocket-extensions`];if(u!==void 0){if(!x){le(e,n,`Server sent a Sec-WebSocket-Extensions header but no extension was requested`);return}let t;try{t=O(u)}catch{le(e,n,`Invalid Sec-WebSocket-Extensions header`);return}let r=Object.keys(t);if(r.length!==1||r[0]!==f.extensionName){le(e,n,`Server indicated an extension that was not requested`);return}try{x.accept(t[f.extensionName])}catch{le(e,n,`Invalid Sec-WebSocket-Extensions header`);return}e._extensions[f.extensionName]=x}e.setSocket(n,r,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(S,e):S.end()}function se(e,t){e._readyState=ae.CLOSING,e._errorEmitted=!0,e.emit(`error`,t),e.emitClose()}function k(e){return e.path=e.socketPath,a.connect(e)}function ce(e){return e.path=void 0,!e.servername&&e.servername!==``&&(e.servername=a.isIP(e.host)?``:e.host),o.connect(e)}function le(e,t,n){e._readyState=ae.CLOSING;let r=Error(n);Error.captureStackTrace(r,le),t.setHeader?(t[te]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(se,e,r)):(t.destroy(r),t.once(`error`,e.emit.bind(e,`error`)),t.once(`close`,e.emitClose.bind(e)))}function ue(e,t,n){if(t){let n=h(t)?t.size:ee(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(n){let t=Error(`WebSocket is not open: readyState ${e.readyState} (${re[e.readyState]})`);process.nextTick(n,t)}}function A(e,t){let n=this[C];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[C]!==void 0&&(n._socket.removeListener(`data`,ve),process.nextTick(he,n._socket),e===1005?n.close():n.close(e,t))}function j(){let e=this[C];e.isPaused||e._socket.resume()}function de(e){let t=this[C];t._socket[C]!==void 0&&(t._socket.removeListener(`data`,ve),process.nextTick(he,t._socket),t.close(e[S])),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e))}function fe(){this[C].emitClose()}function pe(e,t){this[C].emit(`message`,e,t)}function me(e){let t=this[C];t._autoPong&&t.pong(e,!this._isServer,w),t.emit(`ping`,e)}function M(e){this[C].emit(`pong`,e)}function he(e){e.resume()}function ge(e){let t=this[C];t.readyState!==ae.CLOSED&&(t.readyState===ae.OPEN&&(t._readyState=ae.CLOSING,N(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e)))}function N(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function _e(){let e=this[C];if(this.removeListener(`close`,_e),this.removeListener(`data`,ve),this.removeListener(`end`,ye),e._readyState=ae.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[C]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on(`error`,fe),e._receiver.on(`finish`,fe))}function ve(e){this[C]._receiver.write(e)||this.pause()}function ye(){let e=this[C];e._readyState=ae.CLOSING,e._receiver.end(),this.end()}function be(){let e=this[C];this.removeListener(`error`,be),this.on(`error`,w),e&&(e._readyState=ae.CLOSING,this.destroy())}})),QDe=b8(((e,t)=>{k8();let{Duplex:n}=x8(`stream`);function r(e){e.emit(`close`)}function i(){!this.destroyed&&this._writableState.finished&&this.destroy()}function a(e){this.removeListener(`error`,a),this.destroy(),this.listenerCount(`error`)===0&&this.emit(`error`,e)}function o(e,t){let o=!0,s=new n({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on(`message`,function(t,n){let r=!n&&s._readableState.objectMode?t.toString():t;s.push(r)||e.pause()}),e.once(`error`,function(e){s.destroyed||(o=!1,s.destroy(e))}),e.once(`close`,function(){s.destroyed||s.push(null)}),s._destroy=function(t,n){if(e.readyState===e.CLOSED){n(t),process.nextTick(r,s);return}let i=!1;e.once(`error`,function(e){i=!0,n(e)}),e.once(`close`,function(){i||n(t),process.nextTick(r,s)}),o&&e.terminate()},s._final=function(t){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._final(t)});return}e._socket!==null&&(e._socket._writableState.finished?(t(),s._readableState.endEmitted&&s.destroy()):(e._socket.once(`finish`,function(){t()}),e.close()))},s._read=function(){e.isPaused&&e.resume()},s._write=function(t,n,r){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._write(t,n,r)});return}e.send(t,r)},s.on(`end`,i),s.on(`error`,a),s}t.exports=o})),$De=b8(((e,t)=>{let{tokenChars:n}=T8();function r(e){let t=new Set,r=-1,i=-1,a=0;for(;a<e.length;a++){let o=e.charCodeAt(a);if(i===-1&&n[o]===1)r===-1&&(r=a);else if(a!==0&&(o===32||o===9))i===-1&&r!==-1&&(i=a);else if(o===44){if(r===-1)throw SyntaxError(`Unexpected character at index ${a}`);i===-1&&(i=a);let n=e.slice(r,i);if(t.has(n))throw SyntaxError(`The "${n}" subprotocol is duplicated`);t.add(n),r=i=-1}else throw SyntaxError(`Unexpected character at index ${a}`)}if(r===-1||i!==-1)throw SyntaxError(`Unexpected end of input`);let o=e.slice(r,a);if(t.has(o))throw SyntaxError(`The "${o}" subprotocol is duplicated`);return t.add(o),t}t.exports={parse:r}})),eOe=b8(((e,t)=>{let n=x8(`events`),r=x8(`http`),{Duplex:i}=x8(`stream`),{createHash:a}=x8(`crypto`),o=O8(),s=w8(),c=$De(),l=k8(),{CLOSE_TIMEOUT:u,GUID:d,kWebSocket:f}=S8(),p=/^[+/0-9A-Za-z]{22}==$/;t.exports=class extends n{constructor(e,t){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:u,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:l,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw TypeError(`One and only one of the "port", "server", or "noServer" options must be specified`);if(e.port==null?e.server&&(this._server=e.server):(this._server=r.createServer((e,t)=>{let n=r.STATUS_CODES[426];t.writeHead(426,{"Content-Length":n.length,"Content-Type":`text/plain`}),t.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)),this._server){let e=this.emit.bind(this,`connection`);this._removeListeners=m(this._server,{listening:this.emit.bind(this,`listening`),error:this.emit.bind(this,`error`),upgrade:(t,n,r)=>{this.handleUpgrade(t,n,r,e)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw Error(`The server is operating in "noServer" mode`);return this._server?this._server.address():null}close(e){if(this._state===2){e&&this.once(`close`,()=>{e(Error(`The server is not running`))}),process.nextTick(h,this);return}if(e&&this.once(`close`,e),this._state!==1){if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(h,this);else{let e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{h(this)})}}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf(`?`);if((t===-1?e.url:e.url.slice(0,t))!==this.options.path)return!1}return!0}handleUpgrade(e,t,n,r){t.on(`error`,g);let i=e.headers[`sec-websocket-key`],a=e.headers.upgrade,l=+e.headers[`sec-websocket-version`];if(e.method!==`GET`){v(this,e,t,405,`Invalid HTTP method`);return}if(a===void 0||a.toLowerCase()!==`websocket`){v(this,e,t,400,`Invalid Upgrade header`);return}if(i===void 0||!p.test(i)){v(this,e,t,400,`Missing or invalid Sec-WebSocket-Key header`);return}if(l!==13&&l!==8){v(this,e,t,400,`Missing or invalid Sec-WebSocket-Version header`,{"Sec-WebSocket-Version":`13, 8`});return}if(!this.shouldHandle(e)){_(t,400);return}let u=e.headers[`sec-websocket-protocol`],d=new Set;if(u!==void 0)try{d=c.parse(u)}catch{v(this,e,t,400,`Invalid Sec-WebSocket-Protocol header`);return}let f=e.headers[`sec-websocket-extensions`],m={};if(this.options.perMessageDeflate&&f!==void 0){let n=new s(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let e=o.parse(f);e[s.extensionName]&&(n.accept(e[s.extensionName]),m[s.extensionName]=n)}catch{v(this,e,t,400,`Invalid or unacceptable Sec-WebSocket-Extensions header`);return}}if(this.options.verifyClient){let a={origin:e.headers[`${l===8?`sec-websocket-origin`:`origin`}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(a,(a,o,s,c)=>{if(!a)return _(t,o||401,s,c);this.completeUpgrade(m,i,d,e,t,n,r)});return}if(!this.options.verifyClient(a))return _(t,401)}this.completeUpgrade(m,i,d,e,t,n,r)}completeUpgrade(e,t,n,r,i,c,l){if(!i.readable||!i.writable)return i.destroy();if(i[f])throw Error(`server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration`);if(this._state>0)return _(i,503);let u=[`HTTP/1.1 101 Switching Protocols`,`Upgrade: websocket`,`Connection: Upgrade`,`Sec-WebSocket-Accept: ${a(`sha1`).update(t+d).digest(`base64`)}`],p=new this.options.WebSocket(null,void 0,this.options);if(n.size){let e=this.options.handleProtocols?this.options.handleProtocols(n,r):n.values().next().value;e&&(u.push(`Sec-WebSocket-Protocol: ${e}`),p._protocol=e)}if(e[s.extensionName]){let t=e[s.extensionName].params,n=o.format({[s.extensionName]:[t]});u.push(`Sec-WebSocket-Extensions: ${n}`),p._extensions=e}this.emit(`headers`,u,r),i.write(u.concat(`\r
|
|
1092
|
+
`+n)}function y(e,t,n,r,i,a){if(e.listenerCount(`wsClientError`)){let r=Error(i);Error.captureStackTrace(r,y),e.emit(`wsClientError`,r,n,t)}else v(n,r,i,a)}}));qDe(),o8(),n8(),i8(),a8(),c8(),s8(),JDe();let l8,u8,d8,f8,p8=!0;typeof process<`u`&&({FORCE_COLOR:l8,NODE_DISABLE_COLORS:u8,NO_COLOR:d8,TERM:f8}=process.env||{},p8=process.stdout&&process.stdout.isTTY);const m8={enabled:!u8&&d8==null&&f8!==`dumb`&&(l8!=null&&l8!==`0`||p8),reset:g8(0,0),bold:g8(1,22),dim:g8(2,22),italic:g8(3,23),underline:g8(4,24),inverse:g8(7,27),hidden:g8(8,28),strikethrough:g8(9,29),black:g8(30,39),red:g8(31,39),green:g8(32,39),yellow:g8(33,39),blue:g8(34,39),magenta:g8(35,39),cyan:g8(36,39),white:g8(37,39),gray:g8(90,39),grey:g8(90,39),bgBlack:g8(40,49),bgRed:g8(41,49),bgGreen:g8(42,49),bgYellow:g8(43,49),bgBlue:g8(44,49),bgMagenta:g8(45,49),bgCyan:g8(46,49),bgWhite:g8(47,49)};function h8(e,t){let n=0,r,i=``,a=``;for(;n<e.length;n++)r=e[n],i+=r.open,a+=r.close,~t.indexOf(r.close)&&(t=t.replace(r.rgx,r.close+r.open));return i+t+a}function YDe(e,t){let n={has:e,keys:t};return n.reset=m8.reset.bind(n),n.bold=m8.bold.bind(n),n.dim=m8.dim.bind(n),n.italic=m8.italic.bind(n),n.underline=m8.underline.bind(n),n.inverse=m8.inverse.bind(n),n.hidden=m8.hidden.bind(n),n.strikethrough=m8.strikethrough.bind(n),n.black=m8.black.bind(n),n.red=m8.red.bind(n),n.green=m8.green.bind(n),n.yellow=m8.yellow.bind(n),n.blue=m8.blue.bind(n),n.magenta=m8.magenta.bind(n),n.cyan=m8.cyan.bind(n),n.white=m8.white.bind(n),n.gray=m8.gray.bind(n),n.grey=m8.grey.bind(n),n.bgBlack=m8.bgBlack.bind(n),n.bgRed=m8.bgRed.bind(n),n.bgGreen=m8.bgGreen.bind(n),n.bgYellow=m8.bgYellow.bind(n),n.bgBlue=m8.bgBlue.bind(n),n.bgMagenta=m8.bgMagenta.bind(n),n.bgCyan=m8.bgCyan.bind(n),n.bgWhite=m8.bgWhite.bind(n),n}function g8(e,t){let n={open:`\x1b[${e}m`,close:`\x1b[${t}m`,rgx:RegExp(`\\x1b\\[${t}m`,`g`)};return function(t){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(e)||(this.has.push(e),this.keys.push(n)),t===void 0?this:m8.enabled?h8(this.keys,t+``):t+``):t===void 0?YDe([e],[n]):m8.enabled?h8([n],t+``):t+``}}Number.isNaN,Number.isInteger,Number.isNaN,Number.parseInt,Array.from,Array.isArray;const XDe=String.fromCharCode;String.fromCodePoint,XDe(65535);const _8=typeof TextEncoder<`u`?new TextEncoder:null;let v8=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});v8&&v8.decode(new Uint8Array).length===1&&(v8=null);const y8=e=>Error(e);new Uint8Array(3e4).length/3,_8&&_8.encodeInto,y8(`Unexpected end of array`),y8(`Integer out of Range`),Date.now;var b8=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),x8=a(import.meta.url),S8=b8(((e,t)=>{let n=[`nodebuffer`,`arraybuffer`,`fragments`],r=typeof Blob<`u`;r&&n.push(`blob`),t.exports={BINARY_TYPES:n,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:`258EAFA5-E914-47DA-95CA-C5AB0DC85B11`,hasBlob:r,kForOnEventAttribute:Symbol(`kIsForOnEventAttribute`),kListener:Symbol(`kListener`),kStatusCode:Symbol(`status-code`),kWebSocket:Symbol(`websocket`),NOOP:()=>{}}})),C8=b8(((e,t)=>{let{EMPTY_BUFFER:n}=S8(),r=Buffer[Symbol.species];function i(e,t){if(e.length===0)return n;if(e.length===1)return e[0];let i=Buffer.allocUnsafe(t),a=0;for(let t=0;t<e.length;t++){let n=e[t];i.set(n,a),a+=n.length}return a<t?new r(i.buffer,i.byteOffset,a):i}function a(e,t,n,r,i){for(let a=0;a<i;a++)n[r+a]=e[a]^t[a&3]}function o(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}function s(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function c(e){if(c.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new r(e):ArrayBuffer.isView(e)?t=new r(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),c.readOnly=!1),t}if(t.exports={concat:i,mask:a,toArrayBuffer:s,toBuffer:c,unmask:o},!process.env.WS_NO_BUFFER_UTIL)try{let e=x8(`bufferutil`);t.exports.mask=function(t,n,r,i,o){o<48?a(t,n,r,i,o):e.mask(t,n,r,i,o)},t.exports.unmask=function(t,n){t.length<32?o(t,n):e.unmask(t,n)}}catch{}})),ZDe=b8(((e,t)=>{let n=Symbol(`kDone`),r=Symbol(`kRun`);t.exports=class{constructor(e){this[n]=()=>{this.pending--,this[r]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[r]()}[r](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[n])}}}})),w8=b8(((e,t)=>{let n=x8(`zlib`),r=C8(),i=ZDe(),{kStatusCode:a}=S8(),o=Buffer[Symbol.species],s=Buffer.from([0,0,255,255]),c=Symbol(`permessage-deflate`),l=Symbol(`total-length`),u=Symbol(`callback`),d=Symbol(`buffers`),f=Symbol(`error`),p;t.exports=class{constructor(e,t,n){this._maxPayload=n|0,this._options=e||{},this._threshold=this._options.threshold===void 0?1024:this._options.threshold,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,p||=new i(this._options.concurrencyLimit===void 0?10:this._options.concurrencyLimit)}static get extensionName(){return`permessage-deflate`}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits??(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&=(this._inflate.close(),null),this._deflate){let e=this._deflate[u];this._deflate.close(),this._deflate=null,e&&e(Error(`The deflate stream was closed while data was being processed`))}}acceptAsServer(e){let t=this._options,n=e.find(e=>!(t.serverNoContextTakeover===!1&&e.server_no_context_takeover||e.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits==`number`&&t.serverMaxWindowBits>e.server_max_window_bits)||typeof t.clientMaxWindowBits==`number`&&!e.client_max_window_bits));if(!n)throw Error(`None of the extension offers can be accepted`);return t.serverNoContextTakeover&&(n.server_no_context_takeover=!0),t.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof t.serverMaxWindowBits==`number`&&(n.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits==`number`?n.client_max_window_bits=t.clientMaxWindowBits:(n.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw Error(`Unexpected parameter "client_no_context_takeover"`);if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits==`number`&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==`number`&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw Error(`Unexpected or invalid parameter "client_max_window_bits"`);return t}normalizeParams(e){return e.forEach(e=>{Object.keys(e).forEach(t=>{let n=e[t];if(n.length>1)throw Error(`Parameter "${t}" must have only a single value`);if(n=n[0],t===`client_max_window_bits`){if(n!==!0){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else if(t===`server_max_window_bits`){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(t===`client_no_context_takeover`||t===`server_no_context_takeover`){if(n!==!0)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else throw Error(`Unknown parameter "${t}"`);e[t]=n})}),e}decompress(e,t,n){p.add(r=>{this._decompress(e,t,(e,t)=>{r(),n(e,t)})})}compress(e,t,n){p.add(r=>{this._compress(e,t,(e,t)=>{r(),n(e,t)})})}_decompress(e,t,i){let a=this._isServer?`client`:`server`;if(!this._inflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:n.Z_DEFAULT_WINDOWBITS;this._inflate=n.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[c]=this,this._inflate[l]=0,this._inflate[d]=[],this._inflate.on(`error`,g),this._inflate.on(`data`,h)}this._inflate[u]=i,this._inflate.write(e),t&&this._inflate.write(s),this._inflate.flush(()=>{let e=this._inflate[f];if(e){this._inflate.close(),this._inflate=null,i(e);return}let n=r.concat(this._inflate[d],this._inflate[l]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[l]=0,this._inflate[d]=[],t&&this.params[`${a}_no_context_takeover`]&&this._inflate.reset()),i(null,n)})}_compress(e,t,i){let a=this._isServer?`server`:`client`;if(!this._deflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:n.Z_DEFAULT_WINDOWBITS;this._deflate=n.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[l]=0,this._deflate[d]=[],this._deflate.on(`data`,m)}this._deflate[u]=i,this._deflate.write(e),this._deflate.flush(n.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let e=r.concat(this._deflate[d],this._deflate[l]);t&&(e=new o(e.buffer,e.byteOffset,e.length-4)),this._deflate[u]=null,this._deflate[l]=0,this._deflate[d]=[],t&&this.params[`${a}_no_context_takeover`]&&this._deflate.reset(),i(null,e)})}};function m(e){this[d].push(e),this[l]+=e.length}function h(e){if(this[l]+=e.length,this[c]._maxPayload<1||this[l]<=this[c]._maxPayload){this[d].push(e);return}this[f]=RangeError(`Max payload size exceeded`),this[f].code=`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`,this[f][a]=1009,this.removeListener(`data`,h),this.reset()}function g(e){if(this[c]._inflate=null,this[f]){this[u](this[f]);return}e[a]=1007,this[u](e)}})),T8=b8(((e,t)=>{let{isUtf8:n}=x8(`buffer`),{hasBlob:r}=S8(),i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function a(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function o(e){let t=e.length,n=0;for(;n<t;)if(!(e[n]&128))n++;else if((e[n]&224)==192){if(n+1===t||(e[n+1]&192)!=128||(e[n]&254)==192)return!1;n+=2}else if((e[n]&240)==224){if(n+2>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||e[n]===224&&(e[n+1]&224)==128||e[n]===237&&(e[n+1]&224)==160)return!1;n+=3}else if((e[n]&248)==240){if(n+3>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||(e[n+3]&192)!=128||e[n]===240&&(e[n+1]&240)==128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}function s(e){return r&&typeof e==`object`&&typeof e.arrayBuffer==`function`&&typeof e.type==`string`&&typeof e.stream==`function`&&(e[Symbol.toStringTag]===`Blob`||e[Symbol.toStringTag]===`File`)}if(t.exports={isBlob:s,isValidStatusCode:a,isValidUTF8:o,tokenChars:i},n)t.exports.isValidUTF8=function(e){return e.length<24?o(e):n(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=x8(`utf-8-validate`);t.exports.isValidUTF8=function(t){return t.length<32?o(t):e(t)}}catch{}})),E8=b8(((e,t)=>{let{Writable:n}=x8(`stream`),r=w8(),{BINARY_TYPES:i,EMPTY_BUFFER:a,kStatusCode:o,kWebSocket:s}=S8(),{concat:c,toArrayBuffer:l,unmask:u}=C8(),{isValidStatusCode:d,isValidUTF8:f}=T8(),p=Buffer[Symbol.species];t.exports=class extends n{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents===void 0||e.allowSynchronousEvents,this._binaryType=e.binaryType||i[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[s]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(e,t,n){if(this._opcode===8&&this._state==0)return n();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let t=this._buffers[0];return this._buffers[0]=new p(t.buffer,t.byteOffset+e,t.length-e),new p(t.buffer,t.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let n=this._buffers[0],r=t.length-e;e>=n.length?t.set(this._buffers.shift(),r):(t.set(new Uint8Array(n.buffer,n.byteOffset,e),r),this._buffers[0]=new p(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if(t[0]&48){e(this.createError(RangeError,`RSV2 and RSV3 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_2_3`));return}let n=(t[0]&64)==64;if(n&&!this._extensions[r.extensionName]){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._fin=(t[0]&128)==128,this._opcode=t[0]&15,this._payloadLength=t[1]&127,this._opcode===0){if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(!this._fragmented){e(this.createError(RangeError,`invalid opcode 0`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){e(this.createError(RangeError,`FIN must be set`,!0,1002,`WS_ERR_EXPECTED_FIN`));return}if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){e(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,`WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH`));return}}else{e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(t[1]&128)==128,this._isServer){if(!this._masked){e(this.createError(RangeError,`MASK must be set`,!0,1002,`WS_ERR_EXPECTED_MASK`));return}}else if(this._masked){e(this.createError(RangeError,`MASK must be clear`,!0,1002,`WS_ERR_UNEXPECTED_MASK`));return}this._payloadLength===126?this._state=1:this._payloadLength===127?this._state=2:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),n=t.readUInt32BE(0);if(n>2**21-1){e(this.createError(RangeError,`Unsupported WebSocket frame: payload length > 2^53 - 1`,!1,1009,`WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH`));return}this._payloadLength=n*2**32+t.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){e(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._state=this._masked?3:4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(e){let t=a;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&u(t,this._mask)}if(this._opcode>7){this.controlMessage(t,e);return}if(this._compressed){this._state=5,this.decompress(t,e);return}t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage(e)}decompress(e,t){this._extensions[r.extensionName].decompress(e,this._fin,(e,n)=>{if(e)return t(e);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0){t(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._fragments.push(n)}this.dataMessage(t),this._state===0&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=0;return}let t=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;r=this._binaryType===`nodebuffer`?c(n,t):this._binaryType===`arraybuffer`?l(c(n,t)):this._binaryType===`blob`?new Blob(n):n,this._allowSynchronousEvents?(this.emit(`message`,r,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!0),this._state=0,this.startLoop(e)}))}else{let r=c(n,t);if(!this._skipUTF8Validation&&!f(r)){e(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._state===5||this._allowSynchronousEvents?(this.emit(`message`,r,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!1),this._state=0,this.startLoop(e)}))}}controlMessage(e,t){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit(`conclude`,1005,a),this.end();else{let n=e.readUInt16BE(0);if(!d(n)){t(this.createError(RangeError,`invalid status code ${n}`,!0,1002,`WS_ERR_INVALID_CLOSE_CODE`));return}let r=new p(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!f(r)){t(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._loop=!1,this.emit(`conclude`,n,r),this.end()}this._state=0;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0):(this._state=6,setImmediate(()=>{this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0,this.startLoop(t)}))}createError(e,t,n,r,i){this._loop=!1,this._errored=!0;let a=new e(n?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(a,this.createError),a.code=i,a[o]=r,a}}})),D8=b8(((e,t)=>{let{Duplex:n}=x8(`stream`),{randomFillSync:r}=x8(`crypto`),i=w8(),{EMPTY_BUFFER:a,kWebSocket:o,NOOP:s}=S8(),{isBlob:c,isValidStatusCode:l}=T8(),{mask:u,toBuffer:d}=C8(),f=Symbol(`kByteLength`),p=Buffer.alloc(4),m=8192,h,g=m;t.exports=class e{constructor(e,t,n){this._extensions=t||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=s,this[o]=void 0}static frame(e,t){let n,i=!1,a=2,o=!1;t.mask&&(n=t.maskBuffer||p,t.generateMask?t.generateMask(n):(g===m&&(h===void 0&&(h=Buffer.alloc(m)),r(h,0,m),g=0),n[0]=h[g++],n[1]=h[g++],n[2]=h[g++],n[3]=h[g++]),o=(n[0]|n[1]|n[2]|n[3])===0,a=6);let s;typeof e==`string`?(!t.mask||o)&&t[f]!==void 0?s=t[f]:(e=Buffer.from(e),s=e.length):(s=e.length,i=t.mask&&t.readOnly&&!o);let c=s;s>=65536?(a+=8,c=127):s>125&&(a+=2,c=126);let l=Buffer.allocUnsafe(i?s+a:a);return l[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(l[0]|=64),l[1]=c,c===126?l.writeUInt16BE(s,2):c===127&&(l[2]=l[3]=0,l.writeUIntBE(s,4,6)),!t.mask||(l[1]|=128,l[a-4]=n[0],l[a-3]=n[1],l[a-2]=n[2],l[a-1]=n[3],o)?[l,e]:i?(u(e,n,l,a,s),[l]):(u(e,n,e,0,s),[l,e])}close(t,n,r,i){let o;if(t===void 0)o=a;else if(typeof t!=`number`||!l(t))throw TypeError(`First argument must be a valid error code number`);else if(n===void 0||!n.length)o=Buffer.allocUnsafe(2),o.writeUInt16BE(t,0);else{let e=Buffer.byteLength(n);if(e>123)throw RangeError(`The message must not be greater than 123 bytes`);o=Buffer.allocUnsafe(2+e),o.writeUInt16BE(t,0),typeof n==`string`?o.write(n,2):o.set(n,2)}let s={[f]:o.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state===0?this.sendFrame(e.frame(o,s),i):this.enqueue([this.dispatch,o,!1,s,i])}ping(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):c(t)?(i=t.size,a=!1):(t=d(t),i=t.length,a=d.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[f]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};c(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}pong(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):c(t)?(i=t.size,a=!1):(t=d(t),i=t.length,a=d.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[f]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};c(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}send(e,t,n){let r=this._extensions[i.extensionName],a=t.binary?2:1,o=t.compress,s,l;typeof e==`string`?(s=Buffer.byteLength(e),l=!1):c(e)?(s=e.size,l=!1):(e=d(e),s=e.length,l=d.readOnly),this._firstFragment?(this._firstFragment=!1,o&&r&&r.params[r._isServer?`server_no_context_takeover`:`client_no_context_takeover`]&&(o=s>=r._threshold),this._compress=o):(o=!1,a=0),t.fin&&(this._firstFragment=!0);let u={[f]:s,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:l,rsv1:o};c(e)?this._state===0?this.getBlobData(e,this._compress,u,n):this.enqueue([this.getBlobData,e,this._compress,u,n]):this._state===0?this.dispatch(e,this._compress,u,n):this.enqueue([this.dispatch,e,this._compress,u,n])}getBlobData(t,n,r,i){this._bufferedBytes+=r[f],this._state=2,t.arrayBuffer().then(t=>{if(this._socket.destroyed){let e=Error(`The socket was closed while the blob was being read`);process.nextTick(_,this,e,i);return}this._bufferedBytes-=r[f];let a=d(t);n?this.dispatch(a,n,r,i):(this._state=0,this.sendFrame(e.frame(a,r),i),this.dequeue())}).catch(e=>{process.nextTick(v,this,e,i)})}dispatch(t,n,r,a){if(!n){this.sendFrame(e.frame(t,r),a);return}let o=this._extensions[i.extensionName];this._bufferedBytes+=r[f],this._state=1,o.compress(t,r.fin,(t,n)=>{if(this._socket.destroyed){_(this,Error(`The socket was closed while data was being compressed`),a);return}this._bufferedBytes-=r[f],this._state=0,r.readOnly=!1,this.sendFrame(e.frame(n,r),a),this.dequeue()})}dequeue(){for(;this._state===0&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][f],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][f],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};function _(e,t,n){typeof n==`function`&&n(t);for(let n=0;n<e._queue.length;n++){let r=e._queue[n],i=r[r.length-1];typeof i==`function`&&i(t)}}function v(e,t,n){_(e,t,n),e.onerror(t)}})),QDe=b8(((e,t)=>{let{kForOnEventAttribute:n,kListener:r}=S8(),i=Symbol(`kCode`),a=Symbol(`kData`),o=Symbol(`kError`),s=Symbol(`kMessage`),c=Symbol(`kReason`),l=Symbol(`kTarget`),u=Symbol(`kType`),d=Symbol(`kWasClean`);var f=class{constructor(e){this[l]=null,this[u]=e}get target(){return this[l]}get type(){return this[u]}};Object.defineProperty(f.prototype,"target",{enumerable:!0}),Object.defineProperty(f.prototype,"type",{enumerable:!0});var p=class extends f{constructor(e,t={}){super(e),this[i]=t.code===void 0?0:t.code,this[c]=t.reason===void 0?``:t.reason,this[d]=t.wasClean!==void 0&&t.wasClean}get code(){return this[i]}get reason(){return this[c]}get wasClean(){return this[d]}};Object.defineProperty(p.prototype,"code",{enumerable:!0}),Object.defineProperty(p.prototype,"reason",{enumerable:!0}),Object.defineProperty(p.prototype,"wasClean",{enumerable:!0});var m=class extends f{constructor(e,t={}){super(e),this[o]=t.error===void 0?null:t.error,this[s]=t.message===void 0?``:t.message}get error(){return this[o]}get message(){return this[s]}};Object.defineProperty(m.prototype,"error",{enumerable:!0}),Object.defineProperty(m.prototype,"message",{enumerable:!0});var h=class extends f{constructor(e,t={}){super(e),this[a]=t.data===void 0?null:t.data}get data(){return this[a]}};Object.defineProperty(h.prototype,"data",{enumerable:!0}),t.exports={CloseEvent:p,ErrorEvent:m,Event:f,EventTarget:{addEventListener(e,t,i={}){for(let a of this.listeners(e))if(!i[n]&&a[r]===t&&!a[n])return;let a;if(e===`message`)a=function(e,n){let r=new h(`message`,{data:n?e:e.toString()});r[l]=this,g(t,this,r)};else if(e===`close`)a=function(e,n){let r=new p(`close`,{code:e,reason:n.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[l]=this,g(t,this,r)};else if(e===`error`)a=function(e){let n=new m(`error`,{error:e,message:e.message});n[l]=this,g(t,this,n)};else if(e===`open`)a=function(){let e=new f(`open`);e[l]=this,g(t,this,e)};else return;a[n]=!!i[n],a[r]=t,i.once?this.once(e,a):this.on(e,a)},removeEventListener(e,t){for(let i of this.listeners(e))if(i[r]===t&&!i[n]){this.removeListener(e,i);break}}},MessageEvent:h};function g(e,t,n){typeof e==`object`&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}})),O8=b8(((e,t)=>{let{tokenChars:n}=T8();function r(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}function i(e){let t=Object.create(null),i=Object.create(null),a=!1,o=!1,s=!1,c,l,u=-1,d=-1,f=-1,p=0;for(;p<e.length;p++)if(d=e.charCodeAt(p),c===void 0){if(f===-1&&n[d]===1)u===-1&&(u=p);else if(p!==0&&(d===32||d===9))f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);d===44?(r(t,n,i),i=Object.create(null)):c=n,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`)}else if(l===void 0){if(f===-1&&n[d]===1)u===-1&&(u=p);else if(d===32||d===9)f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p),r(i,e.slice(u,f),!0),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),u=f=-1}else if(d===61&&u!==-1&&f===-1)l=e.slice(u,p),u=f=-1;else throw SyntaxError(`Unexpected character at index ${p}`)}else if(o){if(n[d]!==1)throw SyntaxError(`Unexpected character at index ${p}`);u===-1?u=p:a||=!0,o=!1}else if(s){if(n[d]===1)u===-1&&(u=p);else if(d===34&&u!==-1)s=!1,f=p;else if(d===92)o=!0;else throw SyntaxError(`Unexpected character at index ${p}`)}else if(d===34&&e.charCodeAt(p-1)===61)s=!0;else if(f===-1&&n[d]===1)u===-1&&(u=p);else if(u!==-1&&(d===32||d===9))f===-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);a&&=(n=n.replace(/\\/g,``),!1),r(i,l,n),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),l=void 0,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);if(u===-1||s||d===32||d===9)throw SyntaxError(`Unexpected end of input`);f===-1&&(f=p);let m=e.slice(u,f);return c===void 0?r(t,m,i):(l===void 0?r(i,m,!0):a?r(i,l,m.replace(/\\/g,``)):r(i,l,m),r(t,c,i)),t}function a(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>[t].concat(Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>e===!0?t:`${t}=${e}`).join(`; `)})).join(`; `)).join(`, `)}).join(`, `)}t.exports={format:a,parse:i}})),k8=b8(((e,t)=>{let n=x8(`events`),r=x8(`https`),i=x8(`http`),a=x8(`net`),o=x8(`tls`),{randomBytes:s,createHash:c}=x8(`crypto`),{Duplex:l,Readable:u}=x8(`stream`),{URL:d}=x8(`url`),f=w8(),p=E8(),m=D8(),{isBlob:h}=T8(),{BINARY_TYPES:g,CLOSE_TIMEOUT:_,EMPTY_BUFFER:v,GUID:y,kForOnEventAttribute:b,kListener:x,kStatusCode:S,kWebSocket:C,NOOP:w}=S8(),{EventTarget:{addEventListener:T,removeEventListener:E}}=QDe(),{format:D,parse:O}=O8(),{toBuffer:ee}=C8(),te=Symbol(`kAborted`),ne=[8,13],re=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],ie=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;var ae=class e extends n{constructor(t,n,r){super(),this._binaryType=g[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=v,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol=``,this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t===null?(this._autoPong=r.autoPong,this._closeTimeout=r.closeTimeout,this._isServer=!0):(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,n===void 0?n=[]:Array.isArray(n)||(typeof n==`object`&&n?(r=n,n=[]):n=[n]),oe(this,t,n,r))}get binaryType(){return this._binaryType}set binaryType(e){g.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,n,r){let i=new p({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),a=new m(t,this._extensions,r.generateMask);this._receiver=i,this._sender=a,this._socket=t,i[C]=this,a[C]=this,t[C]=this,i.on(`conclude`,A),i.on(`drain`,j),i.on(`error`,de),i.on(`message`,pe),i.on(`ping`,me),i.on(`pong`,M),a.onerror=ge,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on(`close`,_e),t.on(`data`,ve),t.on(`end`,ye),t.on(`error`,be),this._readyState=e.OPEN,this.emit(`open`)}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage);return}this._extensions[f.extensionName]&&this._extensions[f.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage)}close(t,n){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){le(this,this._req,`WebSocket was closed before the connection was established`);return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,n,!this._isServer,e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),N(this)}}pause(){this.readyState!==e.CONNECTING&&this.readyState!==e.CLOSED&&(this._paused=!0,this._socket.pause())}ping(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){ue(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.ping(t||v,n,r)}pong(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){ue(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.pong(t||v,n,r)}resume(){this.readyState!==e.CONNECTING&&this.readyState!==e.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof n==`function`&&(r=n,n={}),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){ue(this,t,r);return}let i={binary:typeof t!=`string`,mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[f.extensionName]||(i.compress=!1),this._sender.send(t||v,i,r)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){le(this,this._req,`WebSocket was closed before the connection was established`);return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(ae,"CONNECTING",{enumerable:!0,value:re.indexOf(`CONNECTING`)}),Object.defineProperty(ae.prototype,"CONNECTING",{enumerable:!0,value:re.indexOf(`CONNECTING`)}),Object.defineProperty(ae,"OPEN",{enumerable:!0,value:re.indexOf(`OPEN`)}),Object.defineProperty(ae.prototype,"OPEN",{enumerable:!0,value:re.indexOf(`OPEN`)}),Object.defineProperty(ae,"CLOSING",{enumerable:!0,value:re.indexOf(`CLOSING`)}),Object.defineProperty(ae.prototype,"CLOSING",{enumerable:!0,value:re.indexOf(`CLOSING`)}),Object.defineProperty(ae,"CLOSED",{enumerable:!0,value:re.indexOf(`CLOSED`)}),Object.defineProperty(ae.prototype,"CLOSED",{enumerable:!0,value:re.indexOf(`CLOSED`)}),[`binaryType`,`bufferedAmount`,`extensions`,`isPaused`,`protocol`,`readyState`,`url`].forEach(e=>{Object.defineProperty(ae.prototype,e,{enumerable:!0})}),[`open`,`error`,`close`,`message`].forEach(e=>{Object.defineProperty(ae.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[b])return t[x];return null},set(t){for(let t of this.listeners(e))if(t[b]){this.removeListener(e,t);break}typeof t==`function`&&this.addEventListener(e,t,{[b]:!0})}})}),ae.prototype.addEventListener=T,ae.prototype.removeEventListener=E,t.exports=ae;function oe(e,t,n,a){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:_,protocolVersion:ne[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...a,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:`GET`,host:void 0,path:void 0,port:void 0};if(e._autoPong=o.autoPong,e._closeTimeout=o.closeTimeout,!ne.includes(o.protocolVersion))throw RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${ne.join(`, `)})`);let l;if(t instanceof d)l=t;else try{l=new d(t)}catch{throw SyntaxError(`Invalid URL: ${t}`)}l.protocol===`http:`?l.protocol=`ws:`:l.protocol===`https:`&&(l.protocol=`wss:`),e._url=l.href;let u=l.protocol===`wss:`,p=l.protocol===`ws+unix:`,m;if(l.protocol!==`ws:`&&!u&&!p?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:p&&!l.pathname?m=`The URL's pathname is empty`:l.hash&&(m=`The URL contains a fragment identifier`),m){let t=SyntaxError(m);if(e._redirects===0)throw t;se(e,t);return}let h=u?443:80,g=s(16).toString(`base64`),v=u?r.request:i.request,b=new Set,x;if(o.createConnection=o.createConnection||(u?ce:k),o.defaultPort=o.defaultPort||h,o.port=l.port||h,o.host=l.hostname.startsWith(`[`)?l.hostname.slice(1,-1):l.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":g,Connection:`Upgrade`,Upgrade:`websocket`},o.path=l.pathname+l.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(x=new f(o.perMessageDeflate===!0?{}:o.perMessageDeflate,!1,o.maxPayload),o.headers[`Sec-WebSocket-Extensions`]=D({[f.extensionName]:x.offer()})),n.length){for(let e of n){if(typeof e!=`string`||!ie.test(e)||b.has(e))throw SyntaxError(`An invalid or duplicated subprotocol was specified`);b.add(e)}o.headers[`Sec-WebSocket-Protocol`]=n.join(`,`)}if(o.origin&&(o.protocolVersion<13?o.headers[`Sec-WebSocket-Origin`]=o.origin:o.headers.Origin=o.origin),(l.username||l.password)&&(o.auth=`${l.username}:${l.password}`),p){let e=o.path.split(`:`);o.socketPath=e[0],o.path=e[1]}let S;if(o.followRedirects){if(e._redirects===0){e._originalIpc=p,e._originalSecure=u,e._originalHostOrSocketPath=p?o.socketPath:l.host;let t=a&&a.headers;if(a={...a,headers:{}},t)for(let[e,n]of Object.entries(t))a.headers[e.toLowerCase()]=n}else if(e.listenerCount(`redirect`)===0){let t=p?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:!e._originalIpc&&l.host===e._originalHostOrSocketPath;(!t||e._originalSecure&&!u)&&(delete o.headers.authorization,delete o.headers.cookie,t||delete o.headers.host,o.auth=void 0)}o.auth&&!a.headers.authorization&&(a.headers.authorization=`Basic `+Buffer.from(o.auth).toString(`base64`)),S=e._req=v(o),e._redirects&&e.emit(`redirect`,e.url,S)}else S=e._req=v(o);o.timeout&&S.on(`timeout`,()=>{le(e,S,`Opening handshake has timed out`)}),S.on(`error`,t=>{S===null||S[te]||(S=e._req=null,se(e,t))}),S.on(`response`,r=>{let i=r.headers.location,s=r.statusCode;if(i&&o.followRedirects&&s>=300&&s<400){if(++e._redirects>o.maxRedirects){le(e,S,`Maximum redirects exceeded`);return}S.abort();let r;try{r=new d(i,t)}catch{se(e,SyntaxError(`Invalid URL: ${i}`));return}oe(e,r,n,a)}else e.emit(`unexpected-response`,S,r)||le(e,S,`Unexpected server response: ${r.statusCode}`)}),S.on(`upgrade`,(t,n,r)=>{if(e.emit(`upgrade`,t),e.readyState!==ae.CONNECTING)return;S=e._req=null;let i=t.headers.upgrade;if(i===void 0||i.toLowerCase()!==`websocket`){le(e,n,`Invalid Upgrade header`);return}let a=c(`sha1`).update(g+y).digest(`base64`);if(t.headers[`sec-websocket-accept`]!==a){le(e,n,`Invalid Sec-WebSocket-Accept header`);return}let s=t.headers[`sec-websocket-protocol`],l;if(s===void 0?b.size&&(l=`Server sent no subprotocol`):b.size?b.has(s)||(l=`Server sent an invalid subprotocol`):l=`Server sent a subprotocol but none was requested`,l){le(e,n,l);return}s&&(e._protocol=s);let u=t.headers[`sec-websocket-extensions`];if(u!==void 0){if(!x){le(e,n,`Server sent a Sec-WebSocket-Extensions header but no extension was requested`);return}let t;try{t=O(u)}catch{le(e,n,`Invalid Sec-WebSocket-Extensions header`);return}let r=Object.keys(t);if(r.length!==1||r[0]!==f.extensionName){le(e,n,`Server indicated an extension that was not requested`);return}try{x.accept(t[f.extensionName])}catch{le(e,n,`Invalid Sec-WebSocket-Extensions header`);return}e._extensions[f.extensionName]=x}e.setSocket(n,r,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(S,e):S.end()}function se(e,t){e._readyState=ae.CLOSING,e._errorEmitted=!0,e.emit(`error`,t),e.emitClose()}function k(e){return e.path=e.socketPath,a.connect(e)}function ce(e){return e.path=void 0,!e.servername&&e.servername!==``&&(e.servername=a.isIP(e.host)?``:e.host),o.connect(e)}function le(e,t,n){e._readyState=ae.CLOSING;let r=Error(n);Error.captureStackTrace(r,le),t.setHeader?(t[te]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(se,e,r)):(t.destroy(r),t.once(`error`,e.emit.bind(e,`error`)),t.once(`close`,e.emitClose.bind(e)))}function ue(e,t,n){if(t){let n=h(t)?t.size:ee(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(n){let t=Error(`WebSocket is not open: readyState ${e.readyState} (${re[e.readyState]})`);process.nextTick(n,t)}}function A(e,t){let n=this[C];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[C]!==void 0&&(n._socket.removeListener(`data`,ve),process.nextTick(he,n._socket),e===1005?n.close():n.close(e,t))}function j(){let e=this[C];e.isPaused||e._socket.resume()}function de(e){let t=this[C];t._socket[C]!==void 0&&(t._socket.removeListener(`data`,ve),process.nextTick(he,t._socket),t.close(e[S])),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e))}function fe(){this[C].emitClose()}function pe(e,t){this[C].emit(`message`,e,t)}function me(e){let t=this[C];t._autoPong&&t.pong(e,!this._isServer,w),t.emit(`ping`,e)}function M(e){this[C].emit(`pong`,e)}function he(e){e.resume()}function ge(e){let t=this[C];t.readyState!==ae.CLOSED&&(t.readyState===ae.OPEN&&(t._readyState=ae.CLOSING,N(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e)))}function N(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function _e(){let e=this[C];if(this.removeListener(`close`,_e),this.removeListener(`data`,ve),this.removeListener(`end`,ye),e._readyState=ae.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[C]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on(`error`,fe),e._receiver.on(`finish`,fe))}function ve(e){this[C]._receiver.write(e)||this.pause()}function ye(){let e=this[C];e._readyState=ae.CLOSING,e._receiver.end(),this.end()}function be(){let e=this[C];this.removeListener(`error`,be),this.on(`error`,w),e&&(e._readyState=ae.CLOSING,this.destroy())}})),$De=b8(((e,t)=>{k8();let{Duplex:n}=x8(`stream`);function r(e){e.emit(`close`)}function i(){!this.destroyed&&this._writableState.finished&&this.destroy()}function a(e){this.removeListener(`error`,a),this.destroy(),this.listenerCount(`error`)===0&&this.emit(`error`,e)}function o(e,t){let o=!0,s=new n({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on(`message`,function(t,n){let r=!n&&s._readableState.objectMode?t.toString():t;s.push(r)||e.pause()}),e.once(`error`,function(e){s.destroyed||(o=!1,s.destroy(e))}),e.once(`close`,function(){s.destroyed||s.push(null)}),s._destroy=function(t,n){if(e.readyState===e.CLOSED){n(t),process.nextTick(r,s);return}let i=!1;e.once(`error`,function(e){i=!0,n(e)}),e.once(`close`,function(){i||n(t),process.nextTick(r,s)}),o&&e.terminate()},s._final=function(t){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._final(t)});return}e._socket!==null&&(e._socket._writableState.finished?(t(),s._readableState.endEmitted&&s.destroy()):(e._socket.once(`finish`,function(){t()}),e.close()))},s._read=function(){e.isPaused&&e.resume()},s._write=function(t,n,r){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._write(t,n,r)});return}e.send(t,r)},s.on(`end`,i),s.on(`error`,a),s}t.exports=o})),eOe=b8(((e,t)=>{let{tokenChars:n}=T8();function r(e){let t=new Set,r=-1,i=-1,a=0;for(;a<e.length;a++){let o=e.charCodeAt(a);if(i===-1&&n[o]===1)r===-1&&(r=a);else if(a!==0&&(o===32||o===9))i===-1&&r!==-1&&(i=a);else if(o===44){if(r===-1)throw SyntaxError(`Unexpected character at index ${a}`);i===-1&&(i=a);let n=e.slice(r,i);if(t.has(n))throw SyntaxError(`The "${n}" subprotocol is duplicated`);t.add(n),r=i=-1}else throw SyntaxError(`Unexpected character at index ${a}`)}if(r===-1||i!==-1)throw SyntaxError(`Unexpected end of input`);let o=e.slice(r,a);if(t.has(o))throw SyntaxError(`The "${o}" subprotocol is duplicated`);return t.add(o),t}t.exports={parse:r}})),tOe=b8(((e,t)=>{let n=x8(`events`),r=x8(`http`),{Duplex:i}=x8(`stream`),{createHash:a}=x8(`crypto`),o=O8(),s=w8(),c=eOe(),l=k8(),{CLOSE_TIMEOUT:u,GUID:d,kWebSocket:f}=S8(),p=/^[+/0-9A-Za-z]{22}==$/;t.exports=class extends n{constructor(e,t){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:u,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:l,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw TypeError(`One and only one of the "port", "server", or "noServer" options must be specified`);if(e.port==null?e.server&&(this._server=e.server):(this._server=r.createServer((e,t)=>{let n=r.STATUS_CODES[426];t.writeHead(426,{"Content-Length":n.length,"Content-Type":`text/plain`}),t.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)),this._server){let e=this.emit.bind(this,`connection`);this._removeListeners=m(this._server,{listening:this.emit.bind(this,`listening`),error:this.emit.bind(this,`error`),upgrade:(t,n,r)=>{this.handleUpgrade(t,n,r,e)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw Error(`The server is operating in "noServer" mode`);return this._server?this._server.address():null}close(e){if(this._state===2){e&&this.once(`close`,()=>{e(Error(`The server is not running`))}),process.nextTick(h,this);return}if(e&&this.once(`close`,e),this._state!==1){if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(h,this);else{let e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{h(this)})}}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf(`?`);if((t===-1?e.url:e.url.slice(0,t))!==this.options.path)return!1}return!0}handleUpgrade(e,t,n,r){t.on(`error`,g);let i=e.headers[`sec-websocket-key`],a=e.headers.upgrade,l=+e.headers[`sec-websocket-version`];if(e.method!==`GET`){v(this,e,t,405,`Invalid HTTP method`);return}if(a===void 0||a.toLowerCase()!==`websocket`){v(this,e,t,400,`Invalid Upgrade header`);return}if(i===void 0||!p.test(i)){v(this,e,t,400,`Missing or invalid Sec-WebSocket-Key header`);return}if(l!==13&&l!==8){v(this,e,t,400,`Missing or invalid Sec-WebSocket-Version header`,{"Sec-WebSocket-Version":`13, 8`});return}if(!this.shouldHandle(e)){_(t,400);return}let u=e.headers[`sec-websocket-protocol`],d=new Set;if(u!==void 0)try{d=c.parse(u)}catch{v(this,e,t,400,`Invalid Sec-WebSocket-Protocol header`);return}let f=e.headers[`sec-websocket-extensions`],m={};if(this.options.perMessageDeflate&&f!==void 0){let n=new s(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let e=o.parse(f);e[s.extensionName]&&(n.accept(e[s.extensionName]),m[s.extensionName]=n)}catch{v(this,e,t,400,`Invalid or unacceptable Sec-WebSocket-Extensions header`);return}}if(this.options.verifyClient){let a={origin:e.headers[`${l===8?`sec-websocket-origin`:`origin`}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(a,(a,o,s,c)=>{if(!a)return _(t,o||401,s,c);this.completeUpgrade(m,i,d,e,t,n,r)});return}if(!this.options.verifyClient(a))return _(t,401)}this.completeUpgrade(m,i,d,e,t,n,r)}completeUpgrade(e,t,n,r,i,c,l){if(!i.readable||!i.writable)return i.destroy();if(i[f])throw Error(`server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration`);if(this._state>0)return _(i,503);let u=[`HTTP/1.1 101 Switching Protocols`,`Upgrade: websocket`,`Connection: Upgrade`,`Sec-WebSocket-Accept: ${a(`sha1`).update(t+d).digest(`base64`)}`],p=new this.options.WebSocket(null,void 0,this.options);if(n.size){let e=this.options.handleProtocols?this.options.handleProtocols(n,r):n.values().next().value;e&&(u.push(`Sec-WebSocket-Protocol: ${e}`),p._protocol=e)}if(e[s.extensionName]){let t=e[s.extensionName].params,n=o.format({[s.extensionName]:[t]});u.push(`Sec-WebSocket-Extensions: ${n}`),p._extensions=e}this.emit(`headers`,u,r),i.write(u.concat(`\r
|
|
1091
1093
|
`).join(`\r
|
|
1092
1094
|
`)),i.removeListener(`error`,g),p.setSocket(i,c,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(p),p.on(`close`,()=>{this.clients.delete(p),this._shouldEmitClose&&!this.clients.size&&process.nextTick(h,this)})),l(p,r)}};function m(e,t){for(let n of Object.keys(t))e.on(n,t[n]);return function(){for(let n of Object.keys(t))e.removeListener(n,t[n])}}function h(e){e._state=2,e.emit(`close`)}function g(){this.destroy()}function _(e,t,n,i){n||=r.STATUS_CODES[t],i={Connection:`close`,"Content-Type":`text/html`,"Content-Length":Buffer.byteLength(n),...i},e.once(`finish`,e.destroy),e.end(`HTTP/1.1 ${t} ${r.STATUS_CODES[t]}\r\n`+Object.keys(i).map(e=>`${e}: ${i[e]}`).join(`\r
|
|
1093
1095
|
`)+`\r
|
|
1094
1096
|
\r
|
|
1095
|
-
`+n)}function v(e,t,n,r,i,a){if(e.listenerCount(`wsClientError`)){let r=Error(i);Error.captureStackTrace(r,v),e.emit(`wsClientError`,r,n,t)}else _(n,r,i,a)}}))
|
|
1097
|
+
`+n)}function v(e,t,n,r,i,a){if(e.listenerCount(`wsClientError`)){let r=Error(i);Error.captureStackTrace(r,v),e.emit(`wsClientError`,r,n,t)}else _(n,r,i,a)}}));$De(),E8(),D8(),k8(),tOe(),ss(),new Set(gie);const nOe=new Set;function A8(e){nOe.add(e)}function rOe(){return as.getTracer(`open-knowledge-server`)}async function iOe(e,t,n){return rOe().startActiveSpan(e,t??{},async e=>{try{let t=await n(e);return e.isRecording(),t}catch(t){throw e.recordException(t),e.setStatus({code:ts.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}DZ(`loss-capture`),B({ts:I(),schemaVersion:I(),seq:I(),event:F(),docName:F(),writerId:F().nullable(),site:F().optional(),direction:F().optional(),lostLen:I().optional(),digest:F().optional(),checkpointSha:F().optional(),which:F().optional(),witnessAvailable:L().optional(),connections:I().optional()}),DZ(`checkpoint-chain`);function j8(e){try{return E.native(e)}catch{return e}}`${vl.map(e=>`${e}/`).join(`
|
|
1096
1098
|
`)}${ml.join(`
|
|
1097
|
-
`)}`;function
|
|
1098
|
-
`)}`,N8.flatMap(e=>[`-x`,e]),AY.fileSystem,AY.gitUpstream,AY.service,AY.generator,DZ(`bridge-loss-detector`),DZ(`checkpoint`);function P8(e){let t=he(e).toLowerCase();return QR.includes(t)}function
|
|
1099
|
+
`)}`;function aOe(e){try{return process.kill(e,0),`signalable`}catch(e){return e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`?`foreign`:`absent`}}function M8(e){return aOe(e)!==`absent`}function oOe(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}DZ(`shadow-lock`),DZ(`shadow-op-gate`),DZ(`shadow-repo`),(()=>{let e=process.env.OK_GIT_TIMEOUT_MS;if(!e)return 3e4;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:3e4})(),(()=>{let e=process.env.OK_SHADOW_MAINTENANCE_GC_TIMEOUT_MS;if(!e)return 6e5;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:6e5})(),(()=>{let e=process.env.OK_SHADOW_STAGE_TIMEOUT_MS;if(!e)return 3e5;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:3e5})();const sOe=gl.map(e=>`.ok/${e}/`),cOe=ml.map(e=>`.ok/${e}`),N8=[...sOe.map(e=>`**/${e}`),...cOe.map(e=>`**/${e}`),jl];`${N8.join(`
|
|
1100
|
+
`)}`,N8.flatMap(e=>[`-x`,e]),AY.fileSystem,AY.gitUpstream,AY.service,AY.generator,DZ(`bridge-loss-detector`),DZ(`checkpoint`);function P8(e){let t=he(e).toLowerCase();return QR.includes(t)}function lOe(e){let t=e.toLowerCase();for(let n of QR)if(t.endsWith(n))return e.slice(0,-n.length);return e}function uOe(e){return e===`__system__`}const dOe=new Set(Rie);function fOe(e){return dOe.has(e)}function pOe(e){return zie(e)}function mOe(e){return uOe(e)||fOe(e)||pOe(e)}function F8(e){return{...e,windowsHide:!0}}function I8(e){try{return te(be(e,`.ok/config.yml`)).isFile()}catch(e){let t=e?.code;if(t===`ENOENT`||t===`ENOTDIR`)return!1;throw e}}function L8(e){return e.replace(/\\/g,`/`)}const R8=DZ(`content-filter`);Ne(o);const z8=[`.claude`,`.cursor`,`.codex`,`.agents`,`.opencode`,`.pi`],B8=new Set([`node_modules`,`.venv`,`venv`,`env`,`__pycache__`,`vendor`,`dist`,`build`,`out`,`output`,`.next`,`.nuxt`,`.svelte-kit`,`.astro`,`.turbo`,`.cache`,`.parcel-cache`,`coverage`,`.git`,`.ok`,`.open-knowledge`,`.openknowledge`,...z8,`Library`,`Applications`,`.Trash`]),V8=new Set([`.git`,`node_modules`,`.ok`,`.open-knowledge`,`.openknowledge`,...z8]),H8=new Set([`worktrees`,`local`]);function U8(e){return B8.has(e)||V8.has(e.toLowerCase())}function W8(e){let t=Dc(e);if(!Oc(t))throw Error(`Invalid attachment folder path`);if(t===`./`)return{kind:`sibling`};if(t===`/`||t===`.`)return{kind:`content-root`};let n=t.startsWith(`./`),r=(n?t.slice(2):t).split(`/`).filter(e=>e!==``&&e!==`.`).join(`/`);return r===``?n?{kind:`sibling`}:{kind:`content-root`}:{kind:n?`doc-relative`:`fixed`,path:r}}function hOe(e){throw Error(`[AttachmentFolderShape] unhandled variant: ${JSON.stringify(e)}`)}function gOe(e,t,n){let r=he(e).slice(1).toLowerCase();if(!As.has(r)||t.kind===`sibling`)return!1;let i=e.lastIndexOf(`/`),a=i===-1?``:e.slice(0,i);if(t.kind===`content-root`)return a===``;if(t.kind===`fixed`)return a===t.path||a.startsWith(`${t.path}/`);if(t.kind===`doc-relative`){let e=a===``?[]:a.split(`/`),r=t.path.split(`/`);for(let t=0;t<=e.length-r.length;t++)if(r.every((n,r)=>e[t+r]===n)&&n(e.slice(0,t).join(`/`)))return!0;return!1}return hOe(t)}function G8(e,t){let n=e.split(`/`);for(let e=0;e<n.length;e++){let r=n[e].toLowerCase();if(V8.has(r)&&!(t&&r===`.ok`&&!H8.has((n[e+1]??``).toLowerCase())))return!0}return!1}function _Oe(e){return G8(e)||$8(e)}function K8(e,t){return _Oe(e.slice(t.length+1))}function q8(e){return e.startsWith(`.ok/skills/`)&&!K8(e,`.ok/skills`)}function vOe(e){return e===`.ok`||e===`.ok/skills`||q8(e)}const J8=new Set([`.ok`,...z8]),yOe=new Set([...B8].filter(e=>!J8.has(e))),bOe=[`.git`,`node_modules`,`.ok/local`,`.ok/worktrees`].flatMap(e=>[e,`${e}/**`,`**/${e}`,`**/${e}/**`]);function xOe(e){let t=e.replace(/^\/+/,``).replace(/\/+$/,``).split(`/`);return t.includes(`..`)?!1:t.some(e=>yOe.has(e))?!0:t.some((e,n)=>e.toLowerCase()===`.ok`&&H8.has((t[n+1]??``).toLowerCase()))}const SOe=[`.gitignore`,`.ok`,`.ok/config.yml`,`.ok/.gitignore`,`.ok/schemas/frontmatter.json`,`.ok/templates/example.md`,`.ok/skills/example/SKILL.md`,`docs/.ok`,`docs/.ok/frontmatter.yml`,`docs/.ok/templates/example.md`,...z8.flatMap(e=>[e,`${e}/skills/example/SKILL.md`])];function COe(e){let t=e.trim();if(!t||t.startsWith(`!`)||t.startsWith(`#`))return!1;let n=t.replace(/^\/+/,``).replace(/\/+$/,``).split(`/`);if(n.includes(`..`))return!0;if(xOe(t))return!1;if(n.some(e=>J8.has(e)))return!0;try{let e=(0,J4.default)().add(t);return SOe.some(t=>e.ignores(t))}catch{return!0}}function wOe(e){let t=e.filter(e=>e.length>0&&!e.startsWith(`!`)&&!e.startsWith(`#`)&&!COe(e));return[...new Set([...t,...bOe])]}function Y8(e,t){for(let n=0;n<t;n++)if(U8(e[n]))return!0;return!1}function X8(e){let t=e.split(`/`),n=t.length;return n<3||t[n-3]!==`.ok`||t[n-2]!==`templates`||he(t[n-1])!==`.md`?!1:!Y8(t,n-3)}function Z8(e){let t=e.split(`/`),n=t.length;return t[n-1]===`.ok`?!Y8(t,n-1):n>=2&&t[n-1]===`templates`&&t[n-2]===`.ok`&&!Y8(t,n-2)}function TOe(e){let t=e.split(`/`),n=t.length;return t[0]===`.ok`&&(n===2&&(t[1]===`config.yml`||t[1]===`.gitignore`)||n===3&&t[1]===`schemas`&&t[2].toLowerCase().endsWith(`.json`))||X8(e)?!0:n>=2&&t[n-1]===`frontmatter.yml`&&t[n-2]===`.ok`&&!Y8(t,n-2)}function EOe(e){return e===`.ok`||e===`.ok/schemas`||Z8(e)}function DOe(e,t){for(let n of t)if(e===n||e.startsWith(`${n}/`))return!0;return!1}function Q8(e,t){if(t.size===0)return!1;for(let n of t)if(e.startsWith(`${n}/`)&&!K8(e,n))return!0;return!1}function OOe(e,t){if(t.size===0)return!1;for(let n of t)if(n===e||n.startsWith(`${e}/`)||e.startsWith(`${n}/`)&&!K8(e,n))return!0;return!1}const kOe=new Set([`.ds_store`,`.localized`,`thumbs.db`,`desktop.ini`,`.directory`]);function $8(e){return kOe.has(e.slice(e.lastIndexOf(`/`)+1).toLowerCase())}const AOe=new Set([`.ssh`,`.aws`,`.gnupg`,`.kube`,`.docker`]);function e5(e){for(let t of e.split(`/`))if(AOe.has(t.toLowerCase()))return!0;return!1}const jOe=new Set([`credentials`,`.netrc`,`.npmrc`,`.pgpass`,`.git-credentials`]),MOe=[`.pem`,`.key`,`.p12`,`.pfx`,`.keystore`,`.jks`,`.ppk`];function t5(e){let t=e.slice(e.lastIndexOf(`/`)+1).toLowerCase();if(t===`.env`||t.startsWith(`.env.`)||jOe.has(t)||t.startsWith(`id_rsa`)||t.startsWith(`id_ed25519`)||t.startsWith(`id_ecdsa`)||t.startsWith(`id_dsa`))return!0;for(let e of MOe)if(t.endsWith(e))return!0;return!1}function NOe(e,t){return t===e||t.startsWith(`${e}/`)}function POe(e,t,n){let r=n===void 0,i=new Map;function a(e){let t=i.get(e);if(t!==void 0)return t;let n;try{n=I8(e)}catch{return!1}return i.set(e,n),n}return{isInside(n,i){if(!r||n===``)return!1;let o=i?.pathBase===`project`?e:t;for(let e of n.split(`/`))if(o=N(o,e),a(o))return!0;return!1},reset(){i.clear()}}}const n5=[`.gitignore`,`.okignore`];function FOe(e,t){let n=IOe(e);if(n===null)return[];let r=[];r5(N(n,`info`,`exclude`),t,r,`info/exclude`);let i=LOe(e);return i&&r5(i,t,r,`global excludesfile`),r}function IOe(e){let t=l(`git`,[`rev-parse`,`--git-common-dir`],F8({cwd:e,encoding:`utf-8`,timeout:5e3}));return t.status!==0||!t.stdout?null:be(e,t.stdout.trim())}function LOe(e){let t=l(`git`,[`config`,`--get`,`--type=path`,`core.excludesfile`],F8({cwd:e,encoding:`utf-8`,timeout:5e3}));if(t.status===0&&t.stdout){let e=t.stdout.trim();if(e)return e}return ROe()}function ROe(){let e=process.env.XDG_CONFIG_HOME?.trim(),t=e&&e.length>0?e:N(k(),`.config`);return N(t,`git`,`ignore`)}function r5(e,t,n,r){if(g(e))try{let r=S(e,`utf-8`);t.value+=r.length,n.push(...a5(r))}catch(t){R8.warn({path:e,err:t},`Failed to read ${r} at ${e}`)}}function zOe(e){let{projectDir:t,contentDir:n,onAfterRebuild:r,singleDocRelPath:i}=e,a=e.inPlaceSkillDirs??new Set,o=W8(e.attachmentFolderPath??`./`),s=e.skillRootPaths??new Set,c=POe(t,n,i),l=L8(ye(t,n)),u=l.startsWith(`..`),d,f,p,m,h=0,_=0,v=0;function y(){let e=(0,J4.default)(),r=(0,J4.default)();e.add(`.git`);let i=[],a=0,o=0;for(let n of n5){let o=N(t,n);if(g(o))try{let t=S(o,`utf-8`);a+=t.length;let s=a5(t);i.push(...s),e.add(s),n===`.okignore`&&r.add(s)}catch(e){R8.warn({path:o,err:e},`Failed to read ${n} at ${o}`)}}if(l&&!u)for(let t of n5){let i=N(n,t);if(g(i))try{let n=S(i,`utf-8`);a+=n.length,o++;let s=a5(n).map(e=>o5(e,l));e.add(s),t===`.okignore`&&r.add(s)}catch(e){R8.warn({path:i,err:e},`Failed to read ${t} at ${i}`)}}let s={value:a};o+=s5(n,t,e,r,s),a=s.value;let c=FOe(t,s);a=s.value,c.length>0&&(i.push(...c),e.add(c));let y=wOe(i);return d=e,f=r,p=i,m=y,h=i.length,_=o,v=a,{patternCount:h,nestedFileCount:_,bytes:v}}y();let b=new Map;function x(e,t){if(u&&t?.pathBase!==`project`)return!1;let n=t?.pathBase===`project`||!l?e:`${l}/${e}`;return!n.startsWith(`..`)&&d.ignores(n)}function C(e,t){return t.pathBase===`project`||!l?e:`${l}/${e}`}function w(e){if(u)return!1;let t=l?`${l}/${e}`:e;return f.ignores(t)}let T=()=>{i===void 0&&i5(n,``,x,b)};T();function E(e){return mOe(lOe(e))}function D(e){for(let t of e.split(`/`))if(U8(t))return!0;return!u&&x(e)}let O=null,ee=null;return{isExcluded(e,t){if(E(e)||t5(e)||e5(e)||c.isInside(e,t?.syncScope)||!t?.bypassFilters&&DOe(e,s)&&!Q8(e,a))return!0;if(!t?.bypassFilters&&(q8(e)||Q8(e,a)&&!x(e))){if(i!==void 0)return e!==i;if(P8(e))return!1;let t=he(e).slice(1).toLowerCase();return!As.has(t)}if(!t?.bypassFilters&&X8(e)||!t?.bypassFilters&&t?.syncScope!==void 0&&TOe(C(e,t.syncScope))&&!x(e,t.syncScope))return i!==void 0&&e!==i;if(G8(e,t?.showOk)||$8(e))return!0;if(i!==void 0)return e!==i;if(t?.bypassFilters)return t.respectOkignore===!0&&w(e);if(D(e))return!0;if(P8(e)||gOe(e,o,e=>(b.get(e)??0)>0))return!1;let n=he(e).slice(1).toLowerCase();if(As.has(n)){let t=M(e),n=t===`.`?``:t;if((b.get(n)??0)>0)return!1}return!0},isDirExcluded(e,t){if(e5(e)||c.isInside(e,t?.syncScope))return!0;if(!t?.bypassFilters&&(vOe(e)||Z8(e)||t?.syncScope!==void 0&&EOe(C(e,t.syncScope))||OOe(e,a)))return!1;if(G8(e,t?.showOk))return!0;if(i!==void 0)return!NOe(e,i);if(t?.bypassFilters)return t.respectOkignore===!0&&(w(e)||w(`${e}/`));for(let t of e.split(`/`))if(U8(t))return!0;return u?!1:x(e,t?.syncScope)||x(`${e}/`,t?.syncScope)},isPathIgnored(e,t){return E(e)||t5(e)||e5(e)?!0:q8(e)||Q8(e,a)&&!x(e)||X8(e)?!1:G8(e)||$8(e)?!0:!t?.bypassFilters&&D(e)},getWatcherIgnoreGlobs(){return m},incrementMdDir(e){let t=e===`.`?``:e;b.set(t,(b.get(t)??0)+1)},decrementMdDir(e){let t=e===`.`?``:e,n=b.get(t)??0;n<=1?b.delete(t):b.set(t,n-1)},rebuildDirCount(){let e=new Map(b);b.clear();try{T()}catch(t){for(let[t,n]of e)b.set(t,n);R8.warn({err:t instanceof Error?t:Error(String(t))},`content-filter rebuildDirCount walk failed — retaining previous counts`)}},setAttachmentFolderPath(e){o=W8(e)},refreshInPlaceSkillDirs(){if(e.rescanInPlaceSkillDirs)try{a=e.rescanInPlaceSkillDirs()}catch(e){R8.warn({err:e},`in-place skill re-scan failed — keeping previous allow-list`)}},inPlaceSkillDirsFingerprint(){return[...a].sort().join(`
|
|
1099
1101
|
`)},peekFreshInPlaceSkillDirsFingerprint(){if(!e.rescanInPlaceSkillDirs)return[...a].sort().join(`
|
|
1100
1102
|
`);try{return[...e.rescanInPlaceSkillDirs()].sort().join(`
|
|
1101
1103
|
`)}catch{return[...a].sort().join(`
|
|
1102
|
-
`)}},async rebuildIgnorePatterns(){let t=e=>(O=e().finally(()=>{O=null}),O),o=async()=>{if(c.reset(),e.rescanInPlaceSkillDirs)try{a=e.rescanInPlaceSkillDirs()}catch(e){R8.warn({err:e},`in-place skill re-scan failed — keeping previous allow-list`)}let t=d,o=f,s=p,l=m,u=h,g=_,S=v,C=Date.now();return
|
|
1103
|
-
`).map(e=>e.trim()).filter(e=>e.length>0&&!e.startsWith(`#`))}function o5(e,t){let n=e.startsWith(`!`),r=n?e.slice(1):e,i=r.startsWith(`/`)?r.slice(1):r,a=i.endsWith(`/`)?i.slice(0,-1):i,o=r.startsWith(`/`)||a.includes(`/`)?`${t}/${i}`:`${t}/**/${i}`;return n?`!${o}`:o}function s5(e,t,n,r,i){let a;try{a=w(e,{withFileTypes:!0})}catch(t){return R8.warn({dir:e,err:t},`Failed to read directory ${e}`),0}let o=0;for(let s of a){if(!s.isDirectory()||U8(s.name))continue;let a=N(e,s.name),c=L8(ye(t,a));if(!c.startsWith(`..`)&&!(n.ignores(c)||n.ignores(`${c}/`))){for(let e of n5){let t=N(a,e);if(g(t))try{let a=S(t,`utf-8`);i.value+=a.length;let s=a5(a).map(e=>o5(e,c));n.add(s),e===`.okignore`&&r.add(s),o++}catch(n){R8.warn({path:t,err:n},`Failed to read nested ${e} at ${t}`)}}o+=s5(a,t,n,r,i)}}return o}RegExp(`<(${ZJ.map(e=>e.tagName).join(`|`)})\\b([^>]*)\\/>`,`y`);const
|
|
1104
|
+
`)}},async rebuildIgnorePatterns(){let t=e=>(O=e().finally(()=>{O=null}),O),o=async()=>{if(c.reset(),e.rescanInPlaceSkillDirs)try{a=e.rescanInPlaceSkillDirs()}catch(e){R8.warn({err:e},`in-place skill re-scan failed — keeping previous allow-list`)}let t=d,o=f,s=p,l=m,u=h,g=_,S=v,C=Date.now();return iOe(`config.ignore.rebuild`,{attributes:{}},async e=>{try{let t=y();b.clear(),i===void 0&&await BOe(n,x,b);let a=Date.now()-C;if(e.setAttributes({"ok.ignore.pattern_count":t.patternCount,"ok.ignore.nested_file_count":t.nestedFileCount,"ok.ignore.bytes":t.bytes}),R8.info({patternCount:t.patternCount,nestedFileCount:t.nestedFileCount,bytes:t.bytes,durationMs:a},`content-filter rebuild succeeded`),r)try{r()}catch(e){R8.warn({err:e instanceof Error?e:Error(String(e))},`content-filter onAfterRebuild callback threw — derived views may be stale`)}return{ok:!0,patternCount:t.patternCount,nestedFileCount:t.nestedFileCount,bytes:t.bytes,durationMs:a}}catch(e){d=t,f=o,p=s,m=l,h=u,_=g,v=S,b.clear();try{T()}catch(e){R8.warn({err:e instanceof Error?e:Error(String(e))},`content-filter rollback dirCount re-walk failed — sibling-asset counts may be stale until next rebuild`)}let n=e instanceof Error?e.message:String(e);return R8.warn({err:e instanceof Error?e:Error(n)},`content-filter rebuild failed — rolled back to previous state`),{ok:!1,error:{message:n}}}})};return O===null?t(o):(ee===null&&(ee=O.catch(()=>null).then(()=>(ee=null,t(o)))),ee)}}}async function BOe(e,t,n){let r=[{dir:e,relPath:``}],i=0;for(;r.length>0;){let{dir:e,relPath:a}=r.pop();i+=1,i>=50&&(i=0,await new Promise(e=>setImmediate(e)));let o;try{o=w(e,{withFileTypes:!0})}catch(t){R8.warn({dir:e,err:t},`Failed to read directory for dir-count: ${e}`);continue}for(let i of o){let o=a?`${a}/${i.name}`:i.name;if(i.isDirectory()){if(U8(i.name)||t(o)||t(`${o}/`))continue;r.push({dir:N(e,i.name),relPath:o})}else i.isFile()&&P8(i.name)&&!t(o)&&n.set(a,(n.get(a)??0)+1)}}}function i5(e,t,n,r){let i;try{i=w(e,{withFileTypes:!0})}catch(t){R8.warn({dir:e,err:t},`Failed to read directory for dir-count: ${e}`);return}for(let a of i){let i=t?`${t}/${a.name}`:a.name;if(a.isDirectory()){if(U8(a.name)||n(i)||n(`${i}/`))continue;i5(N(e,a.name),i,n,r)}else a.isFile()&&P8(a.name)&&!n(i)&&r.set(t,(r.get(t)??0)+1)}}function a5(e){return e.split(`
|
|
1105
|
+
`).map(e=>e.trim()).filter(e=>e.length>0&&!e.startsWith(`#`))}function o5(e,t){let n=e.startsWith(`!`),r=n?e.slice(1):e,i=r.startsWith(`/`)?r.slice(1):r,a=i.endsWith(`/`)?i.slice(0,-1):i,o=r.startsWith(`/`)||a.includes(`/`)?`${t}/${i}`:`${t}/**/${i}`;return n?`!${o}`:o}function s5(e,t,n,r,i){let a;try{a=w(e,{withFileTypes:!0})}catch(t){return R8.warn({dir:e,err:t},`Failed to read directory ${e}`),0}let o=0;for(let s of a){if(!s.isDirectory()||U8(s.name))continue;let a=N(e,s.name),c=L8(ye(t,a));if(!c.startsWith(`..`)&&!(n.ignores(c)||n.ignores(`${c}/`))){for(let e of n5){let t=N(a,e);if(g(t))try{let a=S(t,`utf-8`);i.value+=a.length;let s=a5(a).map(e=>o5(e,c));n.add(s),e===`.okignore`&&r.add(s),o++}catch(n){R8.warn({path:t,err:n},`Failed to read nested ${e} at ${t}`)}}o+=s5(a,t,n,r,i)}}return o}RegExp(`<(${ZJ.map(e=>e.tagName).join(`|`)})\\b([^>]*)\\/>`,`y`);const VOe=String.raw`\[\[([^\n#[\]|]+)(?:#([^\n[\]|]+))?(?:\|([^\n[\]]+))?\]\]`,HOe=String.raw`\((<[^>\n]+>|[^)\s\n]+)((?:\s+(?:"[^"\n]*"|'[^'\n]*'|\([^)\n]*\)))?)\)`,c5=String.raw`([^\]\n]*)`,l5=String.raw`([^\]\n]*(?:\][^[\]\n]*)?)`,u5=e=>RegExp(`(!?)${VOe}`,e),d5=(e,t)=>RegExp(`(!?)\\[${e}\\]${HOe}`,t);u5(`y`),u5(`g`),d5(c5,`y`),d5(l5,`y`),d5(c5,`g`),d5(l5,`g`);const UOe=String.raw`(!?)\[([^\]\n]*)\](?:\[([^\]\n]*)\])?`;new RegExp(UOe,`y`),DZ(`file-watcher`),DZ(`conflict-authority`),DZ(`parse-pool`),Math.max(1,Math.min(4,oe()-1)),A8(()=>{}),DZ(`bridge-watchdog`),A8(()=>{}),DZ(`server-observers`),DZ(`server-observers`),DZ(`agent-sessions`),new class{writes=new WeakMap;record(e,t,n){let r=this.writes.get(e)??new Map;for(let[e,t]of r)WOe(t,n)||r.delete(e);r.set(t,n),this.writes.set(e,r)}hasRecentPeer(e,t,n){let r=this.writes.get(e);if(r===void 0)return!1;for(let[e,i]of r){let a=n-i;if(Math.abs(a)>=2e3){r.delete(e);continue}if(e!==t)return!0}return!1}};function WOe(e,t){return e!==void 0&&Math.abs(t-e)<2e3}const f5={discovery:`open-knowledge-discovery`,project:`open-knowledge`,"write-skill":`open-knowledge-write-skill`};new Set(Object.values(f5));const GOe=Object.keys(f5),KOe={discovery:`user`,project:`project`,"write-skill":`user`},p5=GOe.filter(e=>KOe[e]===`user`);new Set(p5.map(e=>f5[e]));const m5=`OpenKnowledge.app/Contents/Resources/cli/dist/assets/skills`;function h5(e){return new URL(e).pathname.endsWith(`.ts`)}function qOe(e,t,n){let r=n.platform??process.platform,i=n.checkDesktop??!1,a=n.home??k(),o=[],s=process.env.NODE_ENV===`test`;return i&&r===`darwin`&&(s||o.push(N(`/Applications`,m5,e)),(!s||n.home!==void 0)&&o.push(N(a,`Applications`,m5,e))),h5(t)?(o.push(Ae(new URL(`../assets/skills/${e}`,t))),o):(o.push(Ae(new URL(`../dist/assets/skills/${e}`,t))),o.push(Ae(new URL(`../assets/skills/${e}`,t))),o.push(Ae(new URL(`./assets/skills/${e}`,t))),o)}function JOe(e,t,n){let r=h5(t)?`Running from source, only the source assets are read, so the bundle name is unknown or its directory under packages/server/assets/skills is missing.`:"This usually means the package build did not copy packages/server/assets into dist/assets. Run `pnpm run build` in the package that ships the skills before publishing.";return`Bundled skill asset directory not found for bundle '${e}'. Tried: ${n.join(`, `)}. ${r}`}function g5(e,t={}){let n=qOe(e,import.meta.url,t);for(let e of n)if(g(e))return e;throw Error(JOe(e,import.meta.url,n))}function YOe(){try{let e=M(Ae(import.meta.url)),t=be(e,`..`,`package.json`),n=JSON.parse(S(t,`utf-8`));if(typeof n.version==`string`&&n.version.length>0)return n.version}catch{}return`0.0.0-unknown`}YOe();function XOe(e,t,n){let[r,i,a,...o]=process.argv.slice(1);(r===void 0||i===void 0||a===void 0)&&(process.stderr.write(`ok-browser relay: missing the folder, files or command argument
|
|
1104
1106
|
`),process.exit(2));let s=new Set(n),c={roots:[{uri:t.pathToFileURL(i).href,name:`chat files`}]},l=e.spawn(a,o,{cwd:r,stdio:[`pipe`,`pipe`,`inherit`],windowsHide:!0}),u=l.stdin,d=l.stdout;(u===null||d===null)&&(process.stderr.write(`ok-browser relay: the browser server has no pipes
|
|
1105
1107
|
`),process.exit(1));let f=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:null,p=e=>{u.write(`${JSON.stringify(e)}\n`)},m=e=>{process.stdout.write(`${JSON.stringify(e)}\n`)},h=(e,t)=>{process.stderr.write(`ok-browser relay: dropped a ${e} line that ${t}\n`)},g=(e,t,n)=>{if(e.trim()===``)return null;let r;try{r=JSON.parse(e)}catch{return h(t,`is not JSON`),null}let i=f(r);if(i!==null)return i;if(Array.isArray(r))for(let e of r){let t=f(e);t?.method!==void 0&&t.id!==void 0&&n({jsonrpc:`2.0`,id:t.id,error:{code:-32600,message:`Batched messages are not supported`}})}return h(t,`is not a single JSON-RPC message`),null},_=e=>{let t=g(e,`client`,m);if(t===null||t.method===`notifications/roots/list_changed`)return null;let n=f(t.params),r=n?.name;return t.method===`tools/call`&&(typeof r!=`string`||!s.has(r))?(t.id!==void 0&&m({jsonrpc:`2.0`,id:t.id,error:{code:-32602,message:`Tool ${String(r)} is not available`}}),null):(t.method===`initialize`&&n!==null&&(n.capabilities={...f(n.capabilities),roots:{listChanged:!1}}),JSON.stringify(t))},v=e=>{let t=g(e,`server`,p);if(t===null)return null;if(t.method===`roots/list`)return t.id!==void 0&&p({jsonrpc:`2.0`,id:t.id,result:c}),null;let n=f(t.result),r=n?.tools;if(n===null||!Array.isArray(r))return e;let i=r.filter(e=>{let t=f(e)?.name;return typeof t==`string`&&s.has(t)});for(let e of i){let t=f(f(e)?.annotations);t!==null&&(t.readOnlyHint=!1)}return n.tools=i,JSON.stringify(t)},y=(e,t,n,r)=>{let i=``,a=e=>{let r=n(e);r!==null&&t.write(`${r}\n`)};e.setEncoding(`utf8`),e.on(`data`,e=>{i+=String(e);let t=i.indexOf(`
|
|
1106
1108
|
`);for(;t!==-1;)a(i.slice(0,t)),i=i.slice(t+1),t=i.indexOf(`
|
|
1107
|
-
`)}),e.on(`end`,()=>{i!==``&&a(i),r&&t.end()})};u.on(`error`,()=>{}),y(process.stdin,u,_,!0),y(d,process.stdout,v,!1);for(let e of[`SIGINT`,`SIGTERM`,`SIGHUP`])process.on(e,()=>l.kill());l.on(`error`,e=>{process.stderr.write(`${e.message}\n`),process.exit(1)}),l.on(`close`,e=>{process.exitCode=e??1,process.stdin.destroy()})}`${YOe.toString()}${JSON.stringify([`browser_click`,`browser_close`,`browser_console_messages`,`browser_drag`,`browser_drop`,`browser_emulate_media`,`browser_evaluate`,`browser_file_upload`,`browser_fill_form`,`browser_find`,`browser_handle_dialog`,`browser_hover`,`browser_navigate`,`browser_navigate_back`,`browser_network_request`,`browser_network_requests`,`browser_press_key`,`browser_resize`,`browser_select_option`,`browser_snapshot`,`browser_tabs`,`browser_take_screenshot`,`browser_type`,`browser_wait_for`])}`;const _5=B({name:F(),version:F().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/)});V([z(_5),H(F(),_5).transform(e=>Object.values(e))]).pipe(mi([_5])),RegExp(`^(?:${`do you mind.i would like you to.i'd like you to.i want you to.i need you to.i would like to.i'd like to.i want to.i need to.we need to.we want to.we should.go ahead and.take a look at.have a look at.look into.look at.help me with.help me to.help me.can you.could you.would you.will you.can we.could we.should we.let's.lets.try to.please.kindly.hello.alright.actually.anyway.also.okay.hey.hi.yo.ok.so.pls.plz.just.maybe`.split(`.`).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`)})\\b(?:[\\s,:;!.\\-–—]+|$)`,`i`),Ne(x),DZ(`agent-registry-apply`),DZ(`local-op-security`),new class{capacity;store;writeIndex=0;filled=!1;constructor(e){if(!Number.isInteger(e)||e<=0)throw RangeError(`RingBuffer capacity must be a positive integer, got ${e}`);this.capacity=e,this.store=Array(e)}push(e){this.store[this.writeIndex]=e,this.writeIndex=(this.writeIndex+1)%this.capacity,this.writeIndex===0&&(this.filled=!0)}read(){let e=[],t=this.filled?this.capacity:this.writeIndex;for(let n=1;n<=t;n++){let t=(this.writeIndex-n+this.capacity)%this.capacity,r=this.store[t];r!==void 0&&e.push(r)}return e}get size(){return this.filled?this.capacity:this.writeIndex}}(256),$R.cursor,$R.codex,$R[`claude-desktop`],A8(()=>{}),Object.freeze({source:`local`,skipStoreHooks:!0,context:Object.freeze({origin:`effect-capture`,paired:!1})}),DZ(`external-change-attribution`),DZ(`mermaid-validator`),DZ(`rename-log`),DZ(`history`),DZ(`backlinks`);function v5(e){return pu.filter(t=>g(N(e,t.hostDir)))}function y5(e,t){return[...Object.entries(e).filter(e=>e[1]!==null).map(([e,t])=>({editor:e,root:t})),{editor:`agents`,root:t}]}y5(cu,od),[...y5(lu,od)].sort((e,t)=>{let n=Y4.indexOf(e.editor),r=Y4.indexOf(t.editor);return(n===-1?Y4.length:n)-(r===-1?Y4.length:r)||e.editor.localeCompare(t.editor)}),DZ(`installed-skills-marker`),DZ(`skill-import`),DZ(`tag-index`),DZ(`derived-document-index`),new class{_tail=Promise.resolve();enqueue(e){let t=this._tail.then(()=>e());return this._tail=t.catch(()=>void 0),t}};const b5={start:I().int().nonnegative().optional(),end:I().int().nonnegative().optional(),quote:F().min(1).optional(),prefix:F().max(1e3).optional(),suffix:F().max(1e3).optional()};B({docName:F().min(1),...b5,propertyKey:F().min(1).optional(),propertyPath:z(V([F(),I().int().nonnegative()])).optional(),body:F(),queue:L().optional(),summary:F().optional()});const x5=Qne();ui(`action`,[B({action:W(`edit`),id:x5,body:F(),summary:F().optional()}),B({action:W(`resolve`),id:x5,summary:F().optional()}),B({action:W(`reopen`),id:x5,summary:F().optional()}),B({action:W(`replace`),id:x5,...b5,summary:F().optional()}),B({action:W(`queue`),id:x5,summary:F().optional()}),B({action:W(`unqueue`),id:x5,summary:F().optional()}),B({action:W(`dispatch-prepare`),id:x5,summary:F().optional()}),B({action:W(`dispatch-complete`),id:x5,summary:F().optional()}),B({action:W(`dispatch-prepare-batch`),ids:z(x5).min(1).max(200),summary:F().optional()}),B({action:W(`dispatch-complete-batch`),ids:z(x5).min(1).max(200),summary:F().optional()})]),DZ(`embeddings`),DZ(`embeddings`);function XOe(e){try{let t=new URL(e),n=t.pathname.replace(/\/+$/,``);return`${t.protocol}//${t.host.toLowerCase()}${n}`}catch{return e.trim().replace(/\/+$/,``)}}XOe(_c),DZ(`embeddings`),DZ(`embeddings`);const ZOe=/^[A-Za-z0-9-]{8,64}$/;let S5=null;function QOe(e){return N(e??k(),`.ok`,`machine-id`)}function $Oe(e){if(e===void 0&&S5!==null)return S5;let t=QOe(e),n=null;try{let e=S(t,`utf-8`).trim();ZOe.test(e)&&(n=e)}catch{}if(n===null){n=Oe();try{v(M(t),{recursive:!0}),re(t,`${n}\n`,{encoding:`utf-8`,mode:384})}catch(e){DZ(`machine-id`).warn({path:t,err:e},`Failed to persist ${t} — using an ephemeral per-process id; lock ownership checks will fail closed (collision) instead of recognizing this machine: ${e instanceof Error?e.message:String(e)}`)}}return e===void 0&&(S5=n),n}DZ(`process-lock`);function eke(e,t){return be(e,`${t}.lock`)}function tke(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`)return null;let n=t.hostname;return n===`localhost`||n===`[::1]`||/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(n)?t.origin:null}function nke(e,t){if(typeof e.url==`string`&&e.url.length>0){let t=tke(e.url);if(t!==null)return t}if(e.port>0){let n=t?.fallbackHost??`localhost`;return`http://${n===`0.0.0.0`||n===`::`?`localhost`:n.includes(`:`)&&!n.startsWith(`[`)?`[${n}]`:n}:${e.port}`}return null}DZ(`asset-references`),DZ(`file-ops`),DZ(`upload-streaming`);const C5=`Absolute OK project/worktree path. Routed stdio: required until set unless one client root exists. Project-bound HTTP: optional, confined to its root.`,w5=`Canonical ids: ${Rge().map(e=>e.name).join(`, `)}. Call palette({components:[ids]}) before authoring for syntax/props, markdown-native forms, Mermaid and themed html preview for interactive charts/demos. Other JSX stays raw MDX when no canonical fits.`;F().max(200).optional().describe(`Optional one-line user-outcome description (≤80 chars). Appears as a bullet in the timeline.`),F().length(40).regex(/^[0-9a-f]+$/i).describe("A 40-character commit SHA identifying a saved version. Produced by `checkpoint`, listed by `history` as `entries[].version`, and consumed here — the same `version` field name across all three."),F().nullable().describe("Route-only preview URL (`/#/<doc>`, no host:port), or null when no UI is running."),F().optional().describe(`How the previewUrl was resolved (e.g. the UI lock).`),F().optional().describe(`Route of the prior/removed path, for closing a stale preview tab.`);const rke=B({value:F(),truncatedFrom:I().optional(),hint:F().optional()}).describe(`Normalized change-note summary, when one was recorded.`),ike=z(H(F(),R()));H(F(),R()).optional().describe("Preview-attach hint (`{ action, previewUrl?, message? }`) when relevant."),z(HJ).describe('Outbound internal links in the just-written doc that do not resolve. Always present — `[]` means every link resolves UNLESS `brokenLinkSuppression` is also present, in which case a project policy withheld findings. A withholding that arrives in a shape this build cannot validate is dropped rather than relayed, so `brokenLinkSuppression` stays absent even though findings were withheld. The `audit` tool is the surface that discloses that case, through its `warnings`. Each: `{ href (as written), resolvedTo (the docName or content-root file path it pointed at, or null), reason: "no-such-doc" | "no-such-file" | "unresolvable" }`. Report-only — the write landed regardless; fix in a follow-up edit.'),WJ.optional().describe('Present ONLY when a project policy omitted detected broken links from `brokenLinks` — so an empty `brokenLinks` beside it does NOT mean every link resolves. `{ reason, count }`; `reason` today is `"reserved-log-policy"` (a reserved `log.md` records history whose links are expected not to resolve) and is an open token, so treat one you do not recognize as a withholding policy all the same. `count` is how many findings were withheld; the hrefs are deliberately not returned, because none of them is yours to repair.'),rke.optional(),z(BJ).min(1).optional().describe("Advisory entries discriminated by `kind`. Write-integrity kinds — `content-divergence` (converged Y.Text didn't byte-match what you composed) and `disk-edit-reconciled` (an out-of-band disk edit was folded in before your write) — mean re-read the doc. The renderability kind `mermaid-parse-error` means the write landed but that fence will not render — fix it and re-edit."),z(B({name:F(),description:F().optional()})).min(1).optional().describe("Templates the parent folder offers, present only when a create passed no `template`. A nudge — the write already landed; pass `template` next time to match the folder's shape.");const ake=F().optional().describe("Auto-duplicated body text. `textPlusStructured` mirrors the visible body here as a Claude / Claude Desktop client-quirk workaround (those clients hide `content[]` when `structuredContent` is present). Internal — programmatic consumers should prefer the `content[0].text` channel.");function T5(e){return{text:ake,...e}}function oke(e){return`Machine-readable codes aligned 1:1 with \`warnings\` (\`warnings[i]\` is the display text for \`warningCodes[i]\`) — switch on these, never on the English. Absent when ${e} sent warning text it did not pair with codes, or paired one with a code this build does not recognise; \`warnings\` still carries the full text either way, so treat a missing field as unknown rather than as an all-clear.`}oke(`the server`);function ske(e){return`Always emitted, \`[]\` when there were none. \`warningCodes\` accompanies this list 1:1 whenever ${e} paired every warning it sent with a code this build recognises; otherwise \`warningCodes\` is absent and this list still carries the full text. \`content[0].text\` lists every warning either way. A \`warnings\` payload in a shape this build cannot read at all becomes one entry saying so, with \`warningCodes\` absent — \`[]\` never means "unreadable".`}ske(`the server`),DZ(`git-checkout`),DZ(`git-worktree-status`),DZ(`git-context`),DZ(`managed-artifact-persistence`),DZ(`timeline`),DZ(`suggest-links`),DZ(`clone-flow`),Ne(o),f5.project,Object.fromEntries(Object.entries(sd).map(([e,t])=>[t,e])),[`These are patterns to adapt to your domain, not a layout to copy verbatim.`,"To build a variant: create your own folders (via `write` or your editor) and reuse only the ideas that fit.","To adopt this pack as-is: re-run without `--dry-run`."].join(`
|
|
1108
|
-
`),DZ(`skills-leaderboard`),DZ(`handoff-dispatch`),B({target:U(Object.keys({"claude-cowork":{type:`app-bundle`,appName:`Claude`,urlScheme:`claude:`,probeScheme:`claude`,quitFirst:!1},"claude-code":{type:`app-bundle`,appName:`Claude`,urlScheme:`claude:`,probeScheme:`claude`,quitFirst:!1},codex:{type:`app-bundle`,appName:`Codex`,urlScheme:`codex:`,probeScheme:`codex`,quitFirst:!0},cursor:{type:`cli-binary`,binaryName:`cursor`,urlScheme:`cursor:`}})),url:F().min(1).max(4096),workspacePath:F().optional()}),B({}).loose(),DZ(`github-permissions`),DZ(`github-reference`),DZ(`github-reference`),DZ(`link-preview.guarded-fetch`),DZ(`link-preview.cache`),DZ(`saved-themes`),B({enabled:L(),active:L(),git:B({state:U([`not-applicable`,`ready`,`missing`,`conflict`,`unavailable`]),ownership:U([`open-knowledge`,`existing`]).optional()}),applied:L().optional(),reason:U([`git-conflict`,`git-unavailable`,`config-write`]).optional()}),B({enabled:L()}).strict(),DZ(`managed-rename`),Object.assign(
|
|
1109
|
+
`)}),e.on(`end`,()=>{i!==``&&a(i),r&&t.end()})};u.on(`error`,()=>{}),y(process.stdin,u,_,!0),y(d,process.stdout,v,!1);for(let e of[`SIGINT`,`SIGTERM`,`SIGHUP`])process.on(e,()=>l.kill());l.on(`error`,e=>{process.stderr.write(`${e.message}\n`),process.exit(1)}),l.on(`close`,e=>{process.exitCode=e??1,process.stdin.destroy()})}`${XOe.toString()}${JSON.stringify([`browser_click`,`browser_close`,`browser_console_messages`,`browser_drag`,`browser_drop`,`browser_emulate_media`,`browser_evaluate`,`browser_file_upload`,`browser_fill_form`,`browser_find`,`browser_handle_dialog`,`browser_hover`,`browser_navigate`,`browser_navigate_back`,`browser_network_request`,`browser_network_requests`,`browser_press_key`,`browser_resize`,`browser_select_option`,`browser_snapshot`,`browser_tabs`,`browser_take_screenshot`,`browser_type`,`browser_wait_for`])}`;const _5=B({name:F(),version:F().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/)});V([z(_5),H(F(),_5).transform(e=>Object.values(e))]).pipe(mi([_5])),RegExp(`^(?:${`do you mind.i would like you to.i'd like you to.i want you to.i need you to.i would like to.i'd like to.i want to.i need to.we need to.we want to.we should.go ahead and.take a look at.have a look at.look into.look at.help me with.help me to.help me.can you.could you.would you.will you.can we.could we.should we.let's.lets.try to.please.kindly.hello.alright.actually.anyway.also.okay.hey.hi.yo.ok.so.pls.plz.just.maybe`.split(`.`).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`)})\\b(?:[\\s,:;!.\\-–—]+|$)`,`i`),Ne(x),DZ(`agent-registry-apply`),DZ(`local-op-security`),new class{capacity;store;writeIndex=0;filled=!1;constructor(e){if(!Number.isInteger(e)||e<=0)throw RangeError(`RingBuffer capacity must be a positive integer, got ${e}`);this.capacity=e,this.store=Array(e)}push(e){this.store[this.writeIndex]=e,this.writeIndex=(this.writeIndex+1)%this.capacity,this.writeIndex===0&&(this.filled=!0)}read(){let e=[],t=this.filled?this.capacity:this.writeIndex;for(let n=1;n<=t;n++){let t=(this.writeIndex-n+this.capacity)%this.capacity,r=this.store[t];r!==void 0&&e.push(r)}return e}get size(){return this.filled?this.capacity:this.writeIndex}}(256),$R.cursor,$R.codex,$R[`claude-desktop`],A8(()=>{}),Object.freeze({source:`local`,skipStoreHooks:!0,context:Object.freeze({origin:`effect-capture`,paired:!1})}),DZ(`external-change-attribution`),DZ(`mermaid-validator`),DZ(`rename-log`),DZ(`history`),DZ(`backlinks`);function v5(e){return pu.filter(t=>g(N(e,t.hostDir)))}function y5(e,t){return[...Object.entries(e).filter(e=>e[1]!==null).map(([e,t])=>({editor:e,root:t})),{editor:`agents`,root:t}]}y5(cu,od),[...y5(lu,od)].sort((e,t)=>{let n=Y4.indexOf(e.editor),r=Y4.indexOf(t.editor);return(n===-1?Y4.length:n)-(r===-1?Y4.length:r)||e.editor.localeCompare(t.editor)}),DZ(`installed-skills-marker`),DZ(`skill-import`),DZ(`tag-index`),DZ(`derived-document-index`),new class{_tail=Promise.resolve();enqueue(e){let t=this._tail.then(()=>e());return this._tail=t.catch(()=>void 0),t}};const b5={start:I().int().nonnegative().optional(),end:I().int().nonnegative().optional(),quote:F().min(1).optional(),prefix:F().max(1e3).optional(),suffix:F().max(1e3).optional()};B({docName:F().min(1),...b5,propertyKey:F().min(1).optional(),propertyPath:z(V([F(),I().int().nonnegative()])).optional(),body:F(),queue:L().optional(),summary:F().optional()});const x5=Qne();ui(`action`,[B({action:W(`edit`),id:x5,body:F(),summary:F().optional()}),B({action:W(`resolve`),id:x5,summary:F().optional()}),B({action:W(`reopen`),id:x5,summary:F().optional()}),B({action:W(`replace`),id:x5,...b5,summary:F().optional()}),B({action:W(`queue`),id:x5,summary:F().optional()}),B({action:W(`unqueue`),id:x5,summary:F().optional()}),B({action:W(`dispatch-prepare`),id:x5,summary:F().optional()}),B({action:W(`dispatch-complete`),id:x5,summary:F().optional()}),B({action:W(`dispatch-prepare-batch`),ids:z(x5).min(1).max(200),summary:F().optional()}),B({action:W(`dispatch-complete-batch`),ids:z(x5).min(1).max(200),summary:F().optional()})]),DZ(`embeddings`),DZ(`embeddings`);function ZOe(e){try{let t=new URL(e),n=t.pathname.replace(/\/+$/,``);return`${t.protocol}//${t.host.toLowerCase()}${n}`}catch{return e.trim().replace(/\/+$/,``)}}ZOe(_c),DZ(`embeddings`),DZ(`embeddings`);const QOe=/^[A-Za-z0-9-]{8,64}$/;let S5=null;function $Oe(e){return N(e??k(),`.ok`,`machine-id`)}function eke(e){if(e===void 0&&S5!==null)return S5;let t=$Oe(e),n=null;try{let e=S(t,`utf-8`).trim();QOe.test(e)&&(n=e)}catch{}if(n===null){n=Oe();try{v(M(t),{recursive:!0}),re(t,`${n}\n`,{encoding:`utf-8`,mode:384})}catch(e){DZ(`machine-id`).warn({path:t,err:e},`Failed to persist ${t} — using an ephemeral per-process id; lock ownership checks will fail closed (collision) instead of recognizing this machine: ${e instanceof Error?e.message:String(e)}`)}}return e===void 0&&(S5=n),n}DZ(`process-lock`);function tke(e,t){return be(e,`${t}.lock`)}function nke(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`)return null;let n=t.hostname;return n===`localhost`||n===`[::1]`||/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(n)?t.origin:null}function rke(e,t){if(typeof e.url==`string`&&e.url.length>0){let t=nke(e.url);if(t!==null)return t}if(e.port>0){let n=t?.fallbackHost??`localhost`;return`http://${n===`0.0.0.0`||n===`::`?`localhost`:n.includes(`:`)&&!n.startsWith(`[`)?`[${n}]`:n}:${e.port}`}return null}DZ(`asset-references`),DZ(`file-ops`),DZ(`upload-streaming`);const C5=`Absolute OK project/worktree path. Routed stdio: required until set unless one client root exists. Project-bound HTTP: optional, confined to its root.`,w5=`Canonical ids: ${zge().map(e=>e.name).join(`, `)}. Call palette({components:[ids]}) before authoring for syntax/props, markdown-native forms, Mermaid and themed html preview for interactive charts/demos. Other JSX stays raw MDX when no canonical fits.`;F().max(200).optional().describe(`Optional one-line user-outcome description (≤80 chars). Appears as a bullet in the timeline.`),F().length(40).regex(/^[0-9a-f]+$/i).describe("A 40-character commit SHA identifying a saved version. Produced by `checkpoint`, listed by `history` as `entries[].version`, and consumed here — the same `version` field name across all three."),F().nullable().describe("Route-only preview URL (`/#/<doc>`, no host:port), or null when no UI is running."),F().optional().describe(`How the previewUrl was resolved (e.g. the UI lock).`),F().optional().describe(`Route of the prior/removed path, for closing a stale preview tab.`);const ike=B({value:F(),truncatedFrom:I().optional(),hint:F().optional()}).describe(`Normalized change-note summary, when one was recorded.`),ake=z(H(F(),R()));H(F(),R()).optional().describe("Preview-attach hint (`{ action, previewUrl?, message? }`) when relevant."),z(HJ).describe('Outbound internal links in the just-written doc that do not resolve. Always present — `[]` means every link resolves UNLESS `brokenLinkSuppression` is also present, in which case a project policy withheld findings. A withholding that arrives in a shape this build cannot validate is dropped rather than relayed, so `brokenLinkSuppression` stays absent even though findings were withheld. The `audit` tool is the surface that discloses that case, through its `warnings`. Each: `{ href (as written), resolvedTo (the docName or content-root file path it pointed at, or null), reason: "no-such-doc" | "no-such-file" | "unresolvable" }`. Report-only — the write landed regardless; fix in a follow-up edit.'),WJ.optional().describe('Present ONLY when a project policy omitted detected broken links from `brokenLinks` — so an empty `brokenLinks` beside it does NOT mean every link resolves. `{ reason, count }`; `reason` today is `"reserved-log-policy"` (a reserved `log.md` records history whose links are expected not to resolve) and is an open token, so treat one you do not recognize as a withholding policy all the same. `count` is how many findings were withheld; the hrefs are deliberately not returned, because none of them is yours to repair.'),ike.optional(),z(BJ).min(1).optional().describe("Advisory entries discriminated by `kind`. Write-integrity kinds — `content-divergence` (converged Y.Text didn't byte-match what you composed) and `disk-edit-reconciled` (an out-of-band disk edit was folded in before your write) — mean re-read the doc. The renderability kind `mermaid-parse-error` means the write landed but that fence will not render — fix it and re-edit."),z(B({name:F(),description:F().optional()})).min(1).optional().describe("Templates the parent folder offers, present only when a create passed no `template`. A nudge — the write already landed; pass `template` next time to match the folder's shape.");const oke=F().optional().describe("Auto-duplicated body text. `textPlusStructured` mirrors the visible body here as a Claude / Claude Desktop client-quirk workaround (those clients hide `content[]` when `structuredContent` is present). Internal — programmatic consumers should prefer the `content[0].text` channel.");function T5(e){return{text:oke,...e}}function ske(e){return`Machine-readable codes aligned 1:1 with \`warnings\` (\`warnings[i]\` is the display text for \`warningCodes[i]\`) — switch on these, never on the English. Absent when ${e} sent warning text it did not pair with codes, or paired one with a code this build does not recognise; \`warnings\` still carries the full text either way, so treat a missing field as unknown rather than as an all-clear.`}ske(`the server`);function cke(e){return`Always emitted, \`[]\` when there were none. \`warningCodes\` accompanies this list 1:1 whenever ${e} paired every warning it sent with a code this build recognises; otherwise \`warningCodes\` is absent and this list still carries the full text. \`content[0].text\` lists every warning either way. A \`warnings\` payload in a shape this build cannot read at all becomes one entry saying so, with \`warningCodes\` absent — \`[]\` never means "unreadable".`}cke(`the server`),DZ(`git-checkout`),DZ(`git-worktree-status`),DZ(`git-context`),DZ(`managed-artifact-persistence`),DZ(`timeline`),DZ(`suggest-links`),DZ(`clone-flow`),Ne(o),f5.project,Object.fromEntries(Object.entries(sd).map(([e,t])=>[t,e])),[`These are patterns to adapt to your domain, not a layout to copy verbatim.`,"To build a variant: create your own folders (via `write` or your editor) and reuse only the ideas that fit.","To adopt this pack as-is: re-run without `--dry-run`."].join(`
|
|
1110
|
+
`),DZ(`skills-leaderboard`),DZ(`handoff-dispatch`),B({target:U(Object.keys({"claude-cowork":{type:`app-bundle`,appName:`Claude`,urlScheme:`claude:`,probeScheme:`claude`,quitFirst:!1},"claude-code":{type:`app-bundle`,appName:`Claude`,urlScheme:`claude:`,probeScheme:`claude`,quitFirst:!1},codex:{type:`app-bundle`,appName:`Codex`,urlScheme:`codex:`,probeScheme:`codex`,quitFirst:!0},cursor:{type:`cli-binary`,binaryName:`cursor`,urlScheme:`cursor:`}})),url:F().min(1).max(4096),workspacePath:F().optional()}),B({}).loose(),DZ(`github-permissions`),DZ(`github-reference`),DZ(`github-reference`),DZ(`link-preview.guarded-fetch`),DZ(`link-preview.cache`),DZ(`saved-themes`),B({enabled:L(),active:L(),git:B({state:U([`not-applicable`,`ready`,`missing`,`conflict`,`unavailable`]),ownership:U([`open-knowledge`,`existing`]).optional()}),applied:L().optional(),reason:U([`git-conflict`,`git-unavailable`,`config-write`]).optional()}),B({enabled:L()}).strict(),DZ(`managed-rename`),Object.assign(iEe,{m4v:`video/mp4`,mkv:`video/x-matroska`,flac:`audio/flac`,toml:`application/toml`,lock:`text/plain`,"7z":`application/x-7z-compressed`,tar:`application/x-tar`,rar:`application/vnd.rar`,xls:`application/vnd.ms-excel`,ppt:`application/vnd.ms-powerpoint`,odt:`application/vnd.oasis.opendocument.text`,ods:`application/vnd.oasis.opendocument.spreadsheet`,odp:`application/vnd.oasis.opendocument.presentation`,pages:`application/vnd.apple.pages`,numbers:`application/vnd.apple.numbers`,key:`application/vnd.apple.keynote`,mobi:`application/x-mobipocket-ebook`}),DZ(`search`),DZ(`skill-install`),DZ(`api`),B({principalId:F().optional(),tabSessionId:F().optional(),expectedServerInstanceId:F().optional(),expectedBranch:F().optional(),expectedDocLineageEpoch:F().optional(),clientProtocolVersion:I().optional(),clientRuntimeVersion:F().optional(),clientKind:F().optional()}).loose(),new Ve,A8(()=>{}),[...Dge],["Read-only validation of markdownlint, frontmatter, OKF and broken internal links. Requires the Hocuspocus server. No args scans all in-scope .md/.mdx; `path` narrows to file/folder. `links` is the navigation/graph tool.","ran names selected `markdownlint`, `frontmatter`, `okf`, `links`. A family absent from `ran` was not checked. A selected family remains in ran if degraded; warnings explain why and it may still have contributed findings. okf covers document and project-tree OKF checks here.",`Broken links are reported under the source doc. Default-on validation.suppressLogLinkAdvisories omits links inside lowercase log.md/log.mdx at any depth; LOG.md is ordinary. brokenLinkSuppression reports reason reserved-log-policy and count without paths/hrefs. Logs are append-only history: never rewrite old entries to clear links. links({kind:'dead'}) reads raw state.`,`Diagnostics carry source, code, message, 0-based LSP range (link columns approximate) and severity. Broken links default to warning; validation.links can raise/hide them. Only problematic files are listed; fileCount/errorCount/warningCount reflect full scan. Output is capped at 10 files × 10 diagnostics each and project-wide at 10 warnings; omittedWarningCount reports dropped warnings. Narrow path reduces competing files; per-file caps still apply. Follow runtime hints for document lint and raw dead links; project-tree OKF findings remain capped.`,`Nothing is modified. Auto-fix document lint with lint({document,fix:true}); fix broken links with edit/write.`].join(`
|
|
1109
1111
|
`),[`Save a project-wide checkpoint of every document. Requires the Hocuspocus server. Optional summary ≤80 chars defaults to "Checkpoint version"; avoid secrets or PII because it persists in git history. Returns version (40-char SHA). Find it with history and restore one doc with restore_version({document,version}).`].join(`
|
|
1110
1112
|
`),[`Read effective config merged defaults → user → project; no running OK server needed. Optional key is a dotted path (content, appearance.theme); omit for the full config. All fields are readable. Re-read after disk changes or before relying on an old value.`,"Removed server.*, mcp.*, github.*, preview.baseUrl and preview.scriptSrc return exists:false; appearance.preview.autoOpen remains live. This is a pure read. Use `install` skillFolders for folder topology."].join(`
|
|
1111
|
-
`),F().optional().describe(`Dotted config key (e.g. "appearance.theme"). Omit to return the full merged config.`),F().optional().describe(C5),T5({value:R().describe(`Resolved config value at the requested path (or full config).`),exists:L().optional().describe('Whether the requested path resolved to a value. `false` distinguishes "path absent" from "path explicitly set to null". Always emitted — `true` on a full-config read.'),key:F().optional().describe(`Echo of the requested dotted key (absent when reading the full config).`)});const
|
|
1113
|
+
`),F().optional().describe(`Dotted config key (e.g. "appearance.theme"). Omit to return the full merged config.`),F().optional().describe(C5),T5({value:R().describe(`Resolved config value at the requested path (or full config).`),exists:L().optional().describe('Whether the requested path resolved to a value. `false` distinguishes "path absent" from "path explicitly set to null". Always emitted — `true` on a full-config read.'),key:F().optional().describe(`Echo of the requested dotted key (absent when reading the full config).`)});const lke=[`lock`],uke=V([nd,ni()]),dke=V([F(),I(),L(),z(R()),H(F(),R()),ni()]);H(F(),dke).superRefine((e,t)=>{for(let[n,r]of Object.entries(e))uke.safeParse(r).success||t.addIssue({code:`custom`,path:[n],message:`invalid frontmatter value — allowed: a scalar (string | number | boolean), a scalar array, a nested object, or an array of objects; a top-level key may be null to delete it, but nested null is not allowed`})}).describe(`Metadata as a key→value map. Values may be a scalar (string | number | boolean), a scalar array, a nested object, or an array of objects. Merge-patch: include a top-level key to set it, set a top-level key to null to delete it; keys you omit are unchanged. A nested object REPLACES the existing subtree at that key (send the full subtree you want). Example: { title: "Q3 Planning", tags: ["planning"], metadata: { version: "1.0", author: "Inkeep" } }.`),U([`append`,`prepend`,`replace`]).describe(`Where content lands. replace = overwrite the whole body (default for a new doc; required for an existing doc). append / prepend = add to the end / start.`),U(QR).describe("File format for a NEW doc: `.md` (default) or `.mdx` (Markdown + JSX components). Honored only on create — an existing doc keeps its on-disk extension. Takes precedence over an extension typed into `path`."),U(ad).describe(`Level: "project" (default — a Project skill: lives in this KB wherever its folder is, shared with teammates via git) or "global" (a Global skill: lives under your user home, available in every project on this machine — not shared, not version-tracked). Pass the literal value "global" for a Global skill.`),new Set(fY),[`Delete exactly one document, folder, template, skill or asset. Requires the Hocuspocus server. Irreversible; deleting a doc leaves inbound redlinks. Call links({kind:'backlinks',document}) BEFORE deleting.`,`document: path or paths array; folder: recursive folder path; template: {path:'<folder>/<name>'}; asset: {path:'<folder>/<file.ext>'}. skill: {name} deletes the whole bundle, or {name,files:['references/x.md']} deletes selected files. Template/skill deletion is attributed and cleans empty .ok/ directories.`].join(`
|
|
1112
1114
|
`),["Edit exactly one `document`, `folder`, `template`, or `skill`: body find/replace OR metadata, never both in one call. Requires the Hocuspocus server.","`document: {path, find, replace, occurrence?}` edits body only; frontmatter-intersecting finds are rejected. occurrence selects a match (1 = first). `{path, frontmatter}` merge-patches metadata; null deletes a key.","`folder: {path, frontmatter}` patches metadata (no body). `template: {path: '<folder>/<name>', ...}` takes body find/replace/occurrence or frontmatter.","`skill: {name, ...}` takes body find/replace/occurrence OR description (its only metadata leaf). Recorded, unedited copies refresh from the source on watcher/startup sync; links reflect edits immediately. Hand-edited copies are preserved.",`Optional summary: one-line outcome ≤80 chars for any edit, persisted to git history; avoid secrets or PII.`,`Read structuredContent.document.warnings: content-divergence/disk-edit-reconciled means re-read with exec; mermaid-parse-error means the edit landed but fix the fence and re-edit.`,w5].join(`
|
|
1113
|
-
`);const
|
|
1115
|
+
`);const fke=[`node_modules`,`.git`,`dist`,`build`,`.next`,`.turbo`,`.nuxt`,`coverage`,`.cache`,`.parcel-cache`,`.vercel`,`.ok`,`.claude`];[...new Set([`-name`,`-iname`,`-path`,`-ipath`,`-regex`,`-iregex`,`-lname`,`-ilname`])],new Set(fke),DZ(`mcp:exec`),["STOP: with `.ok/`, use exec for in-scope .md/.mdx; native Read/Grep/Glob omit wiki context. Native tools are for source code, non-markdown or projects without .ok/. See the open-knowledge skill for the full rule and escape hatch.",`Read-only bash-like command; returns stdout and enrichedPaths with frontmatter, backlinks/forward links, unresolved comments, shadow-repo activity and git history with human/agent attribution. Unresolved comments are open human review requests: consider before editing and report them.`,`Allowlist: cat, ls, grep, find, head, tail, wc, sort, uniq, cut. One command or pipe per call. No &&, ;, subshells, writes or redirection (including <). Use multiple paths or separate calls.`,`cwd: command paths resolve inside explicit absolute cwd, or the client's sole advertised root. With zero/multiple roots pass cwd; traversal above it is rejected.`,`Stdout provenance: ls <dir>/ labels the directory; single-file cat/head/tail labels its path. Multi-file cat has no header; enrichedPaths still lists files. Piped head/tail preserve upstream provenance.`,`Examples: exec({command:'cat notes/a.md'}); exec({command:'grep -rn oauth notes/ | head -5'}); exec({command:'ls',cwd:'/abs/project'}).`].join(`
|
|
1114
1116
|
`),[`Get the full browser URL for this project or a document/folder/skill, or an absolute markdown file outside the project. Opening is demand: auto-starts OK under the normal OK_MCP_AUTOSTART gate and waits briefly for UI; cold calls can take seconds. Other tools return route-only previewUrl paths; use this tool for an openable URL, never guess ports or hunt via ok ps/status.`,`Choose one: document (extension-less), folder (trailing-slash route), skill:{name,scope?} (project default), or file (absolute .md/.mdx in a loose-file/worktree session). file ignores cwd; other targets use current project. Omit targets for UI root.`,`When YOUR host opens URLs, navigate its embedded browser to url; Claude Code Desktop uses preview_start({url}) then navigate({url}). Only a stdio host without a browser tool should open the URL in the system browser. A CLI without a browser can use ok open <doc> for OK Desktop. This tool forces browser access even when Desktop is installed.`,`INSIDE OK's terminal/agent panel, use returned okOpenCommand instead; never paste url in the answer. If no UI is reachable, returns url:null, baseUrl:null, running:false, autoOpen plus state-specific recovery text (autostart disabled, no spawn authority or UI timeout). Follow it.`].join(`
|
|
1115
|
-
`),F().optional().describe(`Extension-less doc path to resolve a preview URL for (e.g. "specs/foo/SPEC"). Omit to get the UI root URL.`),F().min(1).optional().describe('Folder path to resolve a folder-route preview URL for (e.g. "specs/foo"); returns the `…/#/<folder>/` route. Mutually exclusive with `document`.'),B({name:F().min(1).regex(
|
|
1117
|
+
`),F().optional().describe(`Extension-less doc path to resolve a preview URL for (e.g. "specs/foo/SPEC"). Omit to get the UI root URL.`),F().min(1).optional().describe('Folder path to resolve a folder-route preview URL for (e.g. "specs/foo"); returns the `…/#/<folder>/` route. Mutually exclusive with `document`.'),B({name:F().min(1).regex(L_e,`Skill name must be lowercase letters, digits, and hyphens only.`).describe(`Skill name (the bundle-dir identity, wherever the skill lives).`),scope:U(ad).optional().describe("Skill scope; defaults to `project`.")}).optional().describe("Skill to resolve an editor preview URL for; returns the `…/#/__skill__/<scope>/<name>` route. Mutually exclusive with `document`/`folder`/`file`."),F().optional().describe("Absolute path to a single markdown file to open, including one OUTSIDE any Open Knowledge project. Resolves to the running single-file (or worktree) session whose content directory contains it and returns that session’s `url`. Mutually exclusive with `document` / `folder` / `skill`. When `file` is set, `cwd` is ignored."),F().optional().describe(C5),T5({url:F().nullable().describe("Browser-reachable URL — the UI base joined with the doc route when `document` is given, else the UI root. `null` when no UI is running."),baseUrl:F().nullable().describe("Browser-reachable origin of the running UI (e.g. `http://localhost:5173`). `null` when no UI is running."),running:L().describe(`Whether a UI is running for the project.`),autoOpen:L().describe("User-scoped preview-auto-open preference (`appearance.preview.autoOpen`). When `true`, the agent should route the preview using capability-based routing (in-app browser if available, system browser as fallback). When `false`, the user is managing their own preview view (OK Desktop window, a browser tab they opened, etc.) — the agent must NOT open or refresh any preview UI, and should surface this URL only on direct user ask. Resolved fresh on every call; defaults to `true`."),okOpenCommand:F().nullable().optional().describe("Machine-readable form of the hosted-agent steer: when the calling agent runs inside an OpenKnowledge surface (the desktop app’s built-in terminal, or its in-app agent panel) AND a doc/folder/skill target was given, the exact `ok open …` command to run to bring it up for the user. Run it INSTEAD of navigating `url`, and do not paste `url` into your reply — the user is already in the app it points at. `null`/absent in every other context (navigate `url` per your host instead).")}),B({version:F().describe("40-char commit SHA for this entry — pass to `restore_version({ document, version })`."),timestamp:F().describe(`ISO timestamp of the entry.`),author:F().describe(`Author display name.`),authorEmail:F().describe(`Author email.`),kind:U([`checkpoint`,`wip`,`upstream`]).describe(`Entry kind: checkpoint / wip / upstream.`),message:F().describe(`Commit subject (the checkpoint summary, when one was set).`),contributors:ake.describe(`Per-contributor records parsed from the commit (writer id, name, docs, summaries).`),checkpoint:R().nullable().describe(`Checkpoint metadata when this entry is a checkpoint, else null.`)}),[`Read version history: pass exactly one document, folder or skill. Requires the Hocuspocus server. Returns shadow-repo entries newest first; version is a 40-char SHA for restore_version({document,version}) or restore_version({skill,version}).`,`document accepts optional .md/.mdx. folder lists attributed template/frontmatter activity; empty string is project root. skill is a project-scope name; global skills are unversioned. Optional branch (current default), limit (50 default, 200 max), offset (0), kind (checkpoint/upstream/wip), author and excludeAuthor (name/email).`].join(`
|
|
1116
1118
|
`),[...fY,...yY],[`Import an external agentskills.io/skills.sh skill as managed content. Requires the Hocuspocus server. source accepts a full skills.sh page URL (including website catalogs), owner/repo[/subpath], git URL, or local/file:// path. skill picks one from a multi-skill source. scope: project (default, versioned/shared) or global (user-wide, unversioned).`,`Writes the .agents/skills/<name>/ hub with provenance in .ok/skills-lock.json. Scripts are NEVER executed. add selects editor locations; import always places the skill somewhere. Use install later to change placement/form/source. Name collisions use <name>-imported, never overwrite; identical content-hash re-import is a no-op.`].join(`
|
|
1117
1119
|
`),new Set(yY),["Manage where a SKILL is available: `{name, add?, remove?, convert?, mode?, source?, scope?}` or `{skillFolders: {...}}` alone. Requires the Hocuspocus server. One real source folder plus managed copies/symlinks; the source still loads with no extra locations. Use delete to remove the skill everywhere.",`name is the bundle identity: lowercase letters/digits/hyphens, ≤64 chars. Locations: claude/cursor/codex/copilot/opencode/pi, agents (.agents/skills), or custom root containing '/' such as .team/skills. Custom roots are project-relative, home-relative at global scope. scope: project (default, shared via git) or global (user-wide).`,`add/remove change membership; omitting both installs to configured editors. remove cannot remove the source; folder aliases unfollow minus this skill and keep others. Differing copies are preserved; editor removal may succeed and leave them in place.`,`mode: link = live symlink for source updates; copy = separate folder, refreshed on watcher/startup sync while unedited. Hand-edited copies fork; differing copies are preserved and cannot be converted. Requires add or convert; affects named locations only, no skill-wide default. Omit mode on add to inherit form. convert requires mode and changes form without membership; name all locations for uniformity.`,`source moves the real folder; its old location becomes a symlink. Run alone, not with add/remove. Source SKILL.md with conflict markers, invalid/missing frontmatter, XML in name/description or reserved open-knowledge* names is refused before projection.`,`skillFolders runs alone without name. link: {action:'link', scope, root, target}; target required, merge then symlink root; equal entries deduplicate, differing skills abort, interrupted merges can rerun. unlink: {action:'unlink', scope, root, exclude?}; makes a real directory of per-skill symlinks, excluding named skills and retaining others. add-root: {action:'add-root', scope, root}; declares a custom root for install/link.`].join(`
|
|
1118
1120
|
`),[`Read the wiki-link graph. Requires the Hocuspocus server. kind is one value or an array; results merge, failures go in errors. Use audit for validation.`,"`backlinks`/`forward`/`suggest` require document. suggest finds unlinked prose mentions; excerpt is normalized context, NOT edit-ready text. Re-read with exec, locate the real text using offset, then edit into a wiki-link.","`dead` lists raw unresolved internal targets; sourceDocuments optionally filters with OR semantics. Includes skill docs and lowercase log.md/log.mdx: inspect deliberately, never use as a repair queue or rewrite existing log entries to clear findings.","`orphans` finds disconnected pages; mode incoming/outgoing/both. `hubs` lists most-linked pages; limit defaults 20."].join(`
|
|
@@ -1121,10 +1123,10 @@ caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?
|
|
|
1121
1123
|
`),[`Read the authoring palette: markdown-native components/examples/guidance, themed html preview embedPatterns (charts, stat cards, SVG, interactive controls), and CSS tokens. No running OK server needed. Optional components:[ids] adds full JSX props in componentDetails plus notFound; ids are case-sensitive, max 32. cwd selects project.`,`Prefer native forms: > [!NOTE], <details>, mermaid fences, $math$. For interactive HTML/JS/CSS use html preview starters and var(--chart-1)/var(--foreground) tokens for light/dark themes. Inside SVG use style="fill: var(--chart-1)", not a fill presentation attribute.`,`Delimiters are live even in ordinary prose: ==highlight==, $inline math$/$$block math$$, %%comment%% and <!-- comment --> (HIDES text), ~~strikethrough~~. Keep literal pairs in an inline code span or backslash-escape either delimiter. For ~~ escape BOTH tildes on both sides; one-sided escaping is rewritten on save.`,`Preview iframes have open network access for external HTTPS resources/fetch/fonts/maps. They are sandboxed null-origin frames and cannot access the knowledge base, cookies or auth.`].join(`
|
|
1122
1124
|
`),z(F().min(1)).max(32).optional().describe("Canonical ids to expand to full JSX-form detail (max 32, case-sensitive). Returns `componentDetails` + `notFound`."),F().optional().describe(C5),T5({version:W(1).describe(`Schema version stamp — bump for breaking shape changes.`),components:z(B({id:F(),displayName:F(),description:F(),authoring:U([`markdown`,`jsx`]).describe("`markdown` — write the markdown-native form OK auto-promotes; `jsx` — write the JSX tag directly (no markdown-native form exists)."),example:F().describe(`Copy-ready source for the authoring form.`),guidance:F().describe(`One line on when / how to use this construct.`)})).describe(`Canonical authoring constructs, keyed by the form an agent should write.`),embedPatterns:z(B({id:F(),title:F(),description:F(),snippet:F().describe("A complete, theme-wired ```html preview fenced block.")})).describe("Copy-ready themed `html preview` starters."),tokens:z(B({name:F().describe("CSS custom-property name, e.g. `--chart-1`."),light:F(),dark:F()})).describe("Theme tokens injected into every preview iframe — reference with `var(--name)`."),componentDetails:z(H(F(),R())).optional().describe("Full JSX-form prop schema for the requested `components` ids (when provided)."),notFound:z(F()).optional().describe("Requested `components` ids that did not match any canonical.")}),[`Restore exactly one document or skill to version (40-char SHA from history). Requires the Hocuspocus server. document accepts optional .md/.mdx; restore is append-only through CRDT and visible to connected editors. skill is a PROJECT-scope name (global is unversioned); its folder is rewritten. Recorded, unedited copies refresh on watcher/startup sync; links reflect edits immediately. Hand-edited copies are preserved.`,`Optional summary ≤80 chars; avoid secrets or PII, persisted to git history. content-divergence in structuredContent.warnings means restore landed but bytes differ: re-read with exec to see the converged result.`].join(`
|
|
1123
1125
|
`),DZ(`mcp:search`),[`Ranked search across ALL non-ignored files and folders. Requires the Hocuspocus server. All file name/path values are indexed; only markdown bodies are indexed. Run in parallel with exec grep for exhaustive literal content search, especially code/config/data.`,`Pass query; intent full_text (default) includes bodies, omnibar searches title/path/folders. scopes: page/folder/file/content; defaults follow intent. limit: 20 default, 100 max. Ranking combines title boost, BM25 and recency; hits include signals, and pages include snippets (other files are name-only).`,`When workspace semantic search is enabled, full_text adds embeddings by default; query and matching content go to the configured provider. Set semantic:false for lexical-only/no embedding egress. Response semantic reports coverage.`,`ready:false means an incomplete cold index, not an authoritative empty result. Wait 2–3 seconds before retrying; after 2–3 retries use exec grep. If the server is down, follow recovery text; exec grep is the server-free search fallback.`].join(`
|
|
1124
|
-
`),F().describe(`Search query — title, path, or body terms.`),U([`omnibar`,`full_text`]).optional().describe(`'omnibar' for title/path/folder only (fast); 'full_text' includes body content. Default 'full_text'.`),z(U([`page`,`folder`,`content`,`file`])).optional().describe(`Override the default scope set. Members: 'page', 'folder', 'file', 'content'. Defaults derive from intent.`),I().int().min(1).max(100).optional().describe(`Max rows; default 20, max 100.`),L().optional().describe(`Set false to force pure-lexical ranking for this call even when semantic search is enabled. Omit to use semantic when available.`),F().optional().describe(C5);const
|
|
1125
|
-
`),T5({ok:L().describe(`Success discriminator.`),shareUrl:F().optional().describe(`Marketing share URL (success only).`),sharedUrl:F().optional().describe(`Unencoded GitHub blob/tree URL (success only).`),branch:F().optional().describe(`Branch the share URL pins to (success only).`),resolvedKind:U([`doc`,`folder`]).optional().describe(`Kind the target resolved to (success only).`),freshness:BB.optional().describe(`Whether the shared target matches origin (success only): current, stale (unpushed edits), absent (not on origin, a push fixes it), or empty (a folder holding nothing git can track, which no push fixes). Omitted when the probe could not run.`),error:U([...zB.options,`target-not-found`,`kind-mismatch`,`unknown`]).optional().describe(`Failure code (error path only).`),message:F().optional().describe(`Agent-actionable error message (error path only).`),previewUrl:F().nullable().optional().describe("Route-only preview URL (no host:port): `/#/<doc>` for a doc, `/#/<folder>/` for a folder, `/#/` for the content root. `null` when no UI is running."),previewUrlSource:F().optional().describe(`Internal: preview-URL provenance.`)});const E5="Which level the skill lives at. `project` = lives in this KB (wherever its folder is; shared via git); `global` = user-level under your home dir (available in every project on this machine, not shared).",
|
|
1126
|
+
`),F().describe(`Search query — title, path, or body terms.`),U([`omnibar`,`full_text`]).optional().describe(`'omnibar' for title/path/folder only (fast); 'full_text' includes body content. Default 'full_text'.`),z(U([`page`,`folder`,`content`,`file`])).optional().describe(`Override the default scope set. Members: 'page', 'folder', 'file', 'content'. Defaults derive from intent.`),I().int().min(1).max(100).optional().describe(`Max rows; default 20, max 100.`),L().optional().describe(`Set false to force pure-lexical ranking for this call even when semantic search is enabled. Omit to use semantic when available.`),F().optional().describe(C5);const pke=B({kind:U([`page`,`folder`,`file`]),path:F(),docName:F(),title:F().nullable(),score:I(),signals:B({lexical:I(),fullText:I(),recency:I(),vector:I().optional()}),snippet:F().optional(),previewUrl:F().nullable(),previewUrlSource:U(lke).optional()});T5({cwd:F(),query:F(),intent:F(),resultCount:I().int(),results:z(pke),elapsedMs:I().nullable(),semantic:wY.optional(),ready:W(!1).optional()}),[`Build a shareable GitHub-substrate URL for a teammate to receive a doc/folder subtree in OpenKnowledge, pinned to current branch. Requires the Hocuspocus server. Read-only, no commits/pushes/fetch. Publishing is a user act: agents do NOT publish; a missing remote returns Share-wizard guidance.`,"`path` is content-relative, docs accept .md/.mdx, empty string means root folder. `kind` doc/folder is optional for auto-probe (.mdx → .md → directory); REQUIRED when `path` is empty (use folder). Optional `cwd` selects project. Requires a named branch, GitHub/GH Enterprise origin, and branch already pushed."].join(`
|
|
1127
|
+
`),T5({ok:L().describe(`Success discriminator.`),shareUrl:F().optional().describe(`Marketing share URL (success only).`),sharedUrl:F().optional().describe(`Unencoded GitHub blob/tree URL (success only).`),branch:F().optional().describe(`Branch the share URL pins to (success only).`),resolvedKind:U([`doc`,`folder`]).optional().describe(`Kind the target resolved to (success only).`),freshness:BB.optional().describe(`Whether the shared target matches origin (success only): current, stale (unpushed edits), absent (not on origin, a push fixes it), or empty (a folder holding nothing git can track, which no push fixes). Omitted when the probe could not run.`),error:U([...zB.options,`target-not-found`,`kind-mismatch`,`unknown`]).optional().describe(`Failure code (error path only).`),message:F().optional().describe(`Agent-actionable error message (error path only).`),previewUrl:F().nullable().optional().describe("Route-only preview URL (no host:port): `/#/<doc>` for a doc, `/#/<folder>/` for a folder, `/#/` for the content root. `null` when no UI is running."),previewUrlSource:F().optional().describe(`Internal: preview-URL provenance.`)});const E5="Which level the skill lives at. `project` = lives in this KB (wherever its folder is; shared via git); `global` = user-level under your home dir (available in every project on this machine, not shared).",mke=B({id:F().describe("Location id — editor host id, `agents`, or a custom root path. Pass to `install`."),path:F().describe('Base-relative bundle dir (e.g. ".claude/skills/x"). INFORMATIONAL — for showing a user where a location lives. Skills are addressed by `name` + `scope`: pass `id` to `install`, and read bundle files with `skills({ name, file })`, never by handing this path to `exec` or a native file tool.'),role:U([`source`,`copy`,`symlink`]).describe(`source = the REAL folder (the skill itself); copy = independent folder, refreshed from the source on watcher/startup sync while unedited (hand edits fork it); symlink = live link to the source.`),audience:z(F()).optional().describe(`Folders that RESOLVE INTO this location (folder-level symlinks) — their agents read what lands here.`),drift:L().optional().describe(`Something outside OK rewrote this path since OK last wrote it.`)});B({name:F().describe("Skill name (its identity; pass to `edit`/`move`/`delete`/`install`)."),scope:U([`project`,`global`]).describe(E5),description:F().optional().describe(`The skill's one-line description (when present).`),installed:L().describe('Always true for a managed skill — its source folder IS the skill, so it is never "not installed". Read `locations[]` for where it actually lives.'),hosts:z(F()).describe(`Flat location ids (locations[].id), SOURCE first — legacy projection.`),locations:z(mke).describe("Everywhere the skill lives. Exactly one `source` (the skill's real folder); every other entry is a managed copy or symlink of it."),mode:U([`copy`,`link`]).describe("The form a NEW location would take, derived from the ones the skill already uses. Not a stored preference and not a claim about existing locations — read `locations[].role` for those."),conflicts:z(F()).optional().describe(`Host ids where a DIFFERENT skill with this name occupies the slot.`)});const hke=B({path:F().describe(`Skill-relative path (e.g. "references/tiers.md").`),kind:U([`reference`,`script`]).describe("`script` for anything under scripts/; `reference` for every other bundle file.")});B({name:F().describe(`Skill name (its identity).`),scope:U([`project`,`global`]).describe(E5),description:F().describe(`The skill's one-line description (empty if none).`),body:F().describe(`The SKILL.md body (markdown, frontmatter stripped).`),files:z(hke).describe("Bundle files beside SKILL.md (path + kind, no inline text). Read one via `file`.")}),B({path:F().describe(`Skill-relative path read.`),kind:U([`reference`,`script`]).describe("`reference` or `script`."),text:F().describe(`Full text of the bundle file.`)}),B({name:F().describe("Skill name to pass as `skill` to `import`."),source:F().describe("Import-ready repository coordinates or website hostname. Pass this exact value to `import`."),description:F().describe(`Marketplace description for deciding whether the skill matches the task.`),installs:I().int().nonnegative().nullable().describe(`skills.sh install count, if known.`),publisher:F().nullable().describe(`Publisher, website, or GitHub owner, if known.`)}),[`Read-only skill discovery. Requires the Hocuspocus server. query searches the skills.sh marketplace and returns import-ready name/source/description/publisher/install-count rows. Import a chosen row with import({source,skill:name}); external rows are not managed or active editor content until imported/projected.`,`Omit name to list Project and Global managed skills with scope/description/hosts. name reads description/body plus a bundle files list (path/kind, no inline text); name+file reads one reference/script/bundle file. Optional scope; name-only prefers Project. Address skills by name/scope, never raw .ok/ paths or native cat.`,`Built-in open-knowledge* runtime skills are already in your skill list; do not fetch them here. Use write/edit/delete/move/install for changes.`].join(`
|
|
1126
1128
|
`),["Create/replace exactly one `document`, `folder`, `template`, `skill`, or `asset`; use `documents` for an ordered batch. Requires the Hocuspocus server.","Nested paths such as `guides/overview` can be documents; put all requested blocks in one `document.content`. Use `folder` only for separate pages.","`document: {path, content|template, frontmatter?, position?}`: content and template are exclusive. Existing docs require position: replace/append/prepend; new docs default replace. frontmatter with literal content forces replace, even with append/prepend. Recent edits by another writer can refuse replace; follow the recovery response; append/prepend/edit bypass this refusal. Peers are per MCP connection; own writes and writers sharing a connection do not refuse each other; connected editors can. No agentId is needed.","`folder: {path, frontmatter?}` creates NEW folders; edit existing ones. `template: {path: '<folder>/<name>', content, frontmatter: {title, description?, tags?}}` creates reusable doc templates.","`skill: {name, description, body, scope?}` writes agent guidance; lowercase letters/digits/hyphens name is identity, description is when to use it. New skills use the default skill home; existing ones keep their real folder. Use install for editors.","`asset: {path, content|source}` uploads binary image/file: base64 content or local source path. `documents` takes document specs and reports each result.",`Optional summary: one-line outcome ≤80 chars, persisted to git history; avoid secrets or PII. Batches need per-entry summary; top-level is ignored.`,`Read response warnings: content-divergence/disk-edit-reconciled means re-read; mermaid-parse-error means the write landed but fix the fence.`,w5].join(`
|
|
1127
|
-
`),DZ(`config-persistence`),DZ(`generated-index-git-attributes`),DZ(`head-watcher`),DZ(`shadow-gc`),DZ(`shadow-maintenance`),(()=>{let e=process.env.OK_SHADOW_MAINTENANCE_DEAD_CHAIN_THRESHOLD;if(!e)return 5;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:5})(),(()=>{let e=process.env.OK_SHADOW_MAINTENANCE_CONSOLIDATION_SPACING_MS;if(!e)return 6e5;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:6e5})(),DZ(`mermaid-persistence`),DZ(`persistence`),DZ(`persistence-staleness`),DZ(`recovered-file-target`),DZ(`removed-docs-journal`),DZ(`server-observers`),DZ(`github-account`),DZ(`sync-engine`),Ne(o),new Set(
|
|
1129
|
+
`),DZ(`config-persistence`),DZ(`generated-index-git-attributes`),DZ(`head-watcher`),DZ(`shadow-gc`),DZ(`shadow-maintenance`),(()=>{let e=process.env.OK_SHADOW_MAINTENANCE_DEAD_CHAIN_THRESHOLD;if(!e)return 5;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:5})(),(()=>{let e=process.env.OK_SHADOW_MAINTENANCE_CONSOLIDATION_SPACING_MS;if(!e)return 6e5;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:6e5})(),DZ(`mermaid-persistence`),DZ(`persistence`),DZ(`persistence-staleness`),DZ(`recovered-file-target`),DZ(`removed-docs-journal`),DZ(`server-observers`),DZ(`github-account`),DZ(`sync-engine`),Ne(o),new Set(J_e);const D5=[`no-push-permission`,`auth-error`,`git-index-locked`,`git-operation-in-progress`,`no-commits-yet`];new Set(D5),[...D5],(()=>{let e=Object.freeze({origin:`park-snapshot`,paired:!0});return Object.freeze({source:`local`,skipStoreHooks:!1,context:e})})(),(()=>{let e=Object.freeze({origin:`generated-index`,paired:!0});return Object.freeze({source:`local`,skipStoreHooks:!1,context:e})})();let O5=null;A8(()=>{O5?.disable(),O5=null}),DZ(`skill-migrate`);function k5(e){return[{host:`agents`,root:od},...Object.entries(e).filter(e=>e[1]!==null).map(([e,t])=>({host:e,root:t}))].sort((e,t)=>{let n=Y4.indexOf(e.host),r=Y4.indexOf(t.host);return(n===-1?Y4.length:n)-(r===-1?Y4.length:r)||e.host.localeCompare(t.host)})}k5(cu),k5(lu),Number(process.env.OK_DESTROY_STEP_TIMEOUT_MS);const gke=kc;JX(),N(k(),`.ok`,`logs`),Ne(o),DZ(`project-git`);var A5=i((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),j5=i((e=>{let{InvalidArgumentError:t}=A5();var n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),M5=i((e=>{let{humanReadableArgName:t}=j5();var n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
|
|
1128
1130
|
`)}displayWidth(e){return r(e).length}styleTitle(e){return e}styleUsage(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e===`[command]`?this.styleSubcommandText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleCommandText(e)).join(` `)}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleSubcommandText(e)).join(` `)}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,r){let i=` `.repeat(2);if(!n)return i+e;let a=e.padEnd(t+e.length-r.displayWidth(e)),o=(this.helpWidth??80)-t-2-2,s;return s=o<this.minWidthToWrap||r.preformatted(n)?n:r.boxWrap(n,o).replace(/\n/g,`
|
|
1129
1131
|
`+` `.repeat(t+2)),i+a+` `.repeat(2)+s.replace(/\n/g,`\n${i}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),r=/[\s]*[^\s]+/g,i=[];return n.forEach(e=>{let n=e.match(r);if(n===null){i.push(``);return}let a=[n.shift()],o=this.displayWidth(a[0]);n.forEach(e=>{let n=this.displayWidth(e);if(o+n<=t){a.push(e),o+=n;return}i.push(a.join(``));let r=e.trimStart();a=[r],o=this.displayWidth(r)}),i.push(a.join(``))}),i.join(`
|
|
1130
1132
|
`)}};function r(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,``)}e.Help=n,e.stripColor=r})),N5=i((e=>{let{InvalidArgumentError:t}=A5();var n=class{constructor(e,t){this.flags=e,this.description=t||``,this.required=e.includes(`<`),this.optional=e.includes(`[`),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=a(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith(`--no-`)),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e==`string`&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}name(){return this.long?this.long.replace(/^--/,``):this.short.replace(/^-/,``)}attributeName(){return this.negate?i(this.name().replace(/^no-/,``)):i(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},r=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let r=this.negativeOptions.get(n).presetArg,i=r!==void 0&&r;return t.negate===(i===e)}};function i(e){return e.split(`-`).reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function a(e){let t,n,r=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat(`guard`);if(r.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&r.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=n,n=a.shift()),a[0].startsWith(`-`)){let t=a[0],n=`option creation failed due to '${t}' in option flags '${e}'`;throw/^-[^-][^-]/.test(t)?Error(`${n}
|
|
@@ -1133,7 +1135,7 @@ caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?
|
|
|
1133
1135
|
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`):r.test(t)?Error(`${n}
|
|
1134
1136
|
- too many short flags`):i.test(t)?Error(`${n}
|
|
1135
1137
|
- too many long flags`):Error(`${n}
|
|
1136
|
-
- unrecognised flag format`)}if(t===void 0&&n===void 0)throw Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:n}}e.Option=n,e.DualOptions=r})),
|
|
1138
|
+
- unrecognised flag format`)}if(t===void 0&&n===void 0)throw Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:n}}e.Option=n,e.DualOptions=r})),_ke=i((e=>{function t(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let n=[];for(let t=0;t<=e.length;t++)n[t]=[t];for(let e=0;e<=t.length;e++)n[0][e]=e;for(let r=1;r<=t.length;r++)for(let i=1;i<=e.length;i++){let a=1;a=e[i-1]===t[r-1]?0:1,n[i][r]=Math.min(n[i-1][r]+1,n[i][r-1]+1,n[i-1][r-1]+a),i>1&&r>1&&e[i-1]===t[r-2]&&e[i-2]===t[r-1]&&(n[i][r]=Math.min(n[i][r],n[i-2][r-2]+1))}return n[e.length][t.length]}function n(e,n){if(!n||n.length===0)return``;n=Array.from(new Set(n));let r=e.startsWith(`--`);r&&(e=e.slice(2),n=n.map(e=>e.slice(2)));let i=[],a=3;return n.forEach(n=>{if(n.length<=1)return;let r=t(e,n),o=Math.max(e.length,n.length);(o-r)/o>.4&&(r<a?(a=r,i=[n]):r===a&&i.push(n))}),i.sort((e,t)=>e.localeCompare(t)),r&&(i=i.map(e=>`--${e}`)),i.length>1?`\n(Did you mean one of ${i.join(`, `)}?)`:i.length===1?`\n(Did you mean ${i[0]}?)`:``}e.suggestSimilar=n})),vke=i((e=>{let n=t(`node:events`).EventEmitter,r=t(`node:child_process`),i=t(`node:path`),a=t(`node:fs`),o=t(`node:process`),{Argument:s,humanReadableArgName:c}=j5(),{CommanderError:l}=A5(),{Help:u,stripColor:d}=M5(),{Option:f,DualOptions:p}=N5(),{suggestSimilar:m}=_ke();var h=class e extends n{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||``,this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description=``,this._summary=``,this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:e=>o.stdout.write(e),writeErr:e=>o.stderr.write(e),outputError:(e,t)=>t(e),getOutHelpWidth:()=>o.stdout.isTTY?o.stdout.columns:void 0,getErrHelpWidth:()=>o.stderr.isTTY?o.stderr.columns:void 0,getOutHasColors:()=>_()??(o.stdout.isTTY&&o.stdout.hasColors?.()),getErrHasColors:()=>_()??(o.stderr.isTTY&&o.stderr.hasColors?.()),stripColor:e=>d(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let r=t,i=n;typeof r==`object`&&r&&(i=r,r=null),i||={};let[,a,o]=e.match(/([^ ]+) *(.*)/),s=this.createCommand(a);return r&&(s.description(r),s._executableHandler=!0),i.isDefault&&(this._defaultCommandName=s._name),s._hidden=!!(i.noHelp||i.hidden),s._executableFile=i.executableFile||null,o&&s.arguments(o),this._registerCommand(s),s.parent=this,s.copyInheritedSettings(this),r?this:s}createCommand(t){return new e(t)}createHelp(){return Object.assign(new u,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!=`string`&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw Error(`Command passed to .addCommand() must have a name
|
|
1137
1139
|
- specify the name in Command constructor or using .name()`);return t||={},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new s(e,t)}argument(e,t,n,r){let i=this.createArgument(e,t);return typeof n==`function`?i.default(r).argParser(n):i.default(n),this.addArgument(i),this}arguments(e){return e.trim().split(/ +/).forEach(e=>{this.argument(e)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t?.variadic)throw Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e==`boolean`)return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let[,n,r]=(e??`help [command]`).match(/([^ ]+) *(.*)/),i=t??`display help for command`,a=this.createCommand(n);return a.helpOption(!1),r&&a.arguments(r),i&&a.description(i),this._addImplicitHelpCommand=!0,this._helpCommand=a,(e||t)&&this._initCommandGroup(a),this}addHelpCommand(e,t){return typeof e==`object`?(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this):(this.helpCommand(e,t),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand(`help`))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let n=[`preSubcommand`,`preAction`,`postAction`];if(!n.includes(e))throw Error(`Unexpected value for event passed to hook : '${e}'.
|
|
1138
1140
|
Expecting one of '${n.join(`', '`)}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return this._exitCallback=e||(e=>{if(e.code!==`commander.executeSubCommandAsync`)throw e}),this}_exit(e,t,n){this._exitCallback&&this._exitCallback(new l(e,t,n)),o.exit(e)}action(e){let t=t=>{let n=this.registeredArguments.length,r=t.slice(0,n);return r[n]=this._storeOptionsAsProperties?this:this.opts(),r.push(this),e.apply(this,r)};return this._actionHandler=t,this}createOption(e,t){return new f(e,t)}_callParseArg(e,t,n,r){try{return e.parseArg(t,n)}catch(e){if(e.code===`commander.invalidArgument`){let t=`${r} ${e.message}`;this.error(t,{exitCode:e.exitCode,code:e.code})}throw e}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
|
|
1139
1141
|
- already used by option '${t.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let t=e=>[e.name()].concat(e.aliases()),n=t(e).find(e=>this._findCommand(e));if(n){let r=t(this._findCommand(n)).join(`|`),i=t(e).join(`|`);throw Error(`cannot add command '${i}' as already have command '${r}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),n=e.attributeName();if(e.negate){let t=e.long.replace(/^--no-/,`--`);this._findOption(t)||this.setOptionValueWithSource(n,e.defaultValue===void 0||e.defaultValue,`default`)}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,`default`);let r=(t,r,i)=>{t==null&&e.presetArg!==void 0&&(t=e.presetArg);let a=this.getOptionValue(n);t!==null&&e.parseArg?t=this._callParseArg(e,t,a,r):t!==null&&e.variadic&&(t=e._collectValue(t,a)),t??=e.negate?!1:e.isBoolean()||e.optional?!0:``,this.setOptionValueWithSource(n,t,i)};return this.on(`option:`+t,t=>{let n=`error: option '${e.flags}' argument '${t}' is invalid.`;r(t,n,`cli`)}),e.envVar&&this.on(`optionEnv:`+t,t=>{let n=`error: option '${e.flags}' value '${t}' from env '${e.envVar}' is invalid.`;r(t,n,`env`)}),this}_optionEx(e,t,n,r,i){if(typeof t==`object`&&t instanceof f)throw Error(`To add an Option object use addOption() instead of option() or requiredOption()`);let a=this.createOption(t,n);if(a.makeOptionMandatory(!!e.mandatory),typeof r==`function`)a.default(i).argParser(r);else if(r instanceof RegExp){let e=r;r=(t,n)=>{let r=e.exec(t);return r?r[0]:n},a.default(i).argParser(r)}else a.default(r);return this.addOption(a)}option(e,t,n,r){return this._optionEx({},e,t,n,r)}requiredOption(e,t,n,r){return this._optionEx({mandatory:!0},e,t,n,r)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw Error(`call .storeOptionsAsProperties() before adding options`);if(Object.keys(this._optionValues).length)throw Error(`call .storeOptionsAsProperties() before setting option values`);return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,n){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(t=n.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw Error(`first parameter to parse must be array or undefined`);if(t||={},e===void 0&&t.from===void 0){o.versions?.electron&&(t.from=`electron`);let e=o.execArgv??[];(e.includes(`-e`)||e.includes(`--eval`)||e.includes(`-p`)||e.includes(`--print`))&&(t.from=`eval`)}e===void 0&&(e=o.argv),this.rawArgs=e.slice();let n;switch(t.from){case void 0:case`node`:this._scriptPath=e[1],n=e.slice(2);break;case`electron`:o.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case`user`:n=e.slice(0);break;case`eval`:n=e.slice(1);break;default:throw Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||`program`,n}parse(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return this._parseCommand([],n),this}async parseAsync(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
|
|
@@ -1142,7 +1144,7 @@ Expecting one of '${n.join(`', '`)}'`);return this._lifeCycleHooks[e]?this._life
|
|
|
1142
1144
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
1143
1145
|
- ${t?`searched for local subcommand relative to directory '${t}'`:`no directory for search for local subcommand, use .executableDir() to supply a custom directory`}`;throw Error(r)}_executeSubCommand(e,t){t=t.slice();let n=!1,s=[`.js`,`.ts`,`.tsx`,`.mjs`,`.cjs`];function c(e,t){let n=i.resolve(e,t);if(a.existsSync(n))return n;if(s.includes(i.extname(t)))return;let r=s.find(e=>a.existsSync(`${n}${e}`));if(r)return`${n}${r}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let u=e._executableFile||`${this._name}-${e._name}`,d=this._executableDir||``;if(this._scriptPath){let e;try{e=a.realpathSync(this._scriptPath)}catch{e=this._scriptPath}d=i.resolve(i.dirname(e),d)}if(d){let t=c(d,u);if(!t&&!e._executableFile&&this._scriptPath){let n=i.basename(this._scriptPath,i.extname(this._scriptPath));n!==this._name&&(t=c(d,`${n}-${e._name}`))}u=t||u}n=s.includes(i.extname(u));let f;o.platform===`win32`?(this._checkForMissingExecutable(u,d,e._name),t.unshift(u),t=g(o.execArgv).concat(t),f=r.spawn(o.execPath,t,{stdio:`inherit`})):n?(t.unshift(u),t=g(o.execArgv).concat(t),f=r.spawn(o.argv[0],t,{stdio:`inherit`})):f=r.spawn(u,t,{stdio:`inherit`}),f.killed||[`SIGUSR1`,`SIGUSR2`,`SIGTERM`,`SIGINT`,`SIGHUP`].forEach(e=>{o.on(e,()=>{f.killed===!1&&f.exitCode===null&&f.kill(e)})});let p=this._exitCallback;f.on(`close`,e=>{e??=1,p?p(new l(e,`commander.executeSubCommandAsync`,`(close)`)):o.exit(e)}),f.on(`error`,t=>{if(t.code===`ENOENT`)this._checkForMissingExecutable(u,d,e._name);else if(t.code===`EACCES`)throw Error(`'${u}' not executable`);if(!p)o.exit(1);else{let e=new l(1,`commander.executeSubCommandAsync`,`(error)`);e.nestedError=t,p(e)}}),this.runningCommand=f}_dispatchSubcommand(e,t,n){let r=this._findCommand(e);r||this.help({error:!0}),r._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,r,`preSubcommand`),i=this._chainOrCall(i,()=>{if(r._executableHandler)this._executeSubCommand(r,t.concat(n));else return r._parseCommand(t,n)}),i}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??`--help`])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(e,t,n)=>{let r=t;if(t!==null&&e.parseArg){let i=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;r=this._callParseArg(e,t,n,i)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,r)=>{let i=n.defaultValue;n.variadic?r<this.args.length?(i=this.args.slice(r),n.parseArg&&(i=i.reduce((t,r)=>e(n,r,t),n.defaultValue))):i===void 0&&(i=[]):r<this.args.length&&(i=this.args[r],n.parseArg&&(i=e(n,i,n.defaultValue))),t[r]=i}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then==`function`?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,r=[];return this._getCommandAndAncestors().reverse().filter(e=>e._lifeCycleHooks[t]!==void 0).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{r.push({hookedCommand:e,callback:t})})}),t===`postAction`&&r.reverse(),r.forEach(e=>{n=this._chainOrCall(n,()=>e.callback(e.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let r=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(e=>{r=this._chainOrCall(r,()=>e(this,t))}),r}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){r(),this._processArguments();let n;return n=this._chainOrCallHooks(n,`preAction`),n=this._chainOrCall(n,()=>this._actionHandler(this.processedArgs)),this.parent&&(n=this._chainOrCall(n,()=>{this.parent.emit(i,e,t)})),n=this._chainOrCallHooks(n,`postAction`),n}if(this.parent?.listenerCount(i))r(),this._processArguments(),this.parent.emit(i,e,t);else if(e.length){if(this._findCommand(`*`))return this._dispatchSubcommand(`*`,e,t);this.listenerCount(`command:*`)?this.emit(`command:*`,e,t):this.commands.length?this.unknownCommand():(r(),this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(e=>{let t=e.attributeName();return this.getOptionValue(t)!==void 0&&this.getOptionValueSource(t)!=="default"});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{let n=e.find(e=>t.conflictsWith.includes(e.attributeName()));n&&this._conflictingOption(t,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],r=t;function i(e){return e.length>1&&e[0]===`-`}let a=e=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(e)?!this._getCommandAndAncestors().some(e=>e.options.map(e=>e.short).some(e=>/^-\d$/.test(e))):!1,o=null,s=null,c=0;for(;c<e.length||s;){let l=s??e[c++];if(s=null,l===`--`){r===n&&r.push(l),r.push(...e.slice(c));break}if(o&&(!i(l)||a(l))){this.emit(`option:${o.name()}`,l);continue}if(o=null,i(l)){let t=this._findOption(l);if(t){if(t.required){let n=e[c++];n===void 0&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,n)}else if(t.optional){let n=null;c<e.length&&(!i(e[c])||a(e[c]))&&(n=e[c++]),this.emit(`option:${t.name()}`,n)}else this.emit(`option:${t.name()}`);o=t.variadic?t:null;continue}}if(l.length>2&&l[0]===`-`&&l[1]!==`-`){let e=this._findOption(`-${l[1]}`);if(e){e.required||e.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${e.name()}`,l.slice(2)):(this.emit(`option:${e.name()}`),s=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let e=l.indexOf(`=`),t=this._findOption(l.slice(0,e));if(t&&(t.required||t.optional)){this.emit(`option:${t.name()}`,l.slice(e+1));continue}}if(r===t&&i(l)&&!(this.commands.length===0&&a(l))&&(r=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(l)){t.push(l),n.push(...e.slice(c));break}if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l,...e.slice(c));break}if(this._defaultCommandName){n.push(l,...e.slice(c));break}}if(this._passThroughOptions){r.push(l,...e.slice(c));break}r.push(l)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let t=this.options[n].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==`string`?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
1144
1146
|
`),this.outputHelp({error:!0}));let n=t||{},r=n.exitCode||1,i=n.code||`commander.error`;this._exit(r,i,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in o.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||[`default`,`config`,`env`].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,o.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new p(this.options),t=e=>this.getOptionValue(e)!==void 0&&![`default`,`implied`].includes(this.getOptionValueSource(e));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(e=>{Object.keys(e.implied).filter(e=>!t(e)).forEach(t=>{this.setOptionValueWithSource(t,e.implied[t],`implied`)})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:`commander.missingArgument`})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:`commander.optionMissingArgument`})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:`commander.missingMandatoryOptionValue`})}_conflictingOption(e,t){let n=e=>{let t=e.attributeName(),n=this.getOptionValue(t),r=this.options.find(e=>e.negate&&t===e.attributeName()),i=this.options.find(e=>!e.negate&&t===e.attributeName());return r&&(r.presetArg===void 0&&n===!1||r.presetArg!==void 0&&n===r.presetArg)?r:i||e},r=e=>{let t=n(e),r=t.attributeName();return this.getOptionValueSource(r)===`env`?`environment variable '${t.envVar}'`:`option '${t.flags}'`},i=`error: ${r(e)} cannot be used with ${r(t)}`;this.error(i,{code:`commander.conflictingOption`})}unknownOption(e){if(this._allowUnknownOption)return;let t=``;if(e.startsWith(`--`)&&this._showSuggestionAfterError){let n=[],r=this;do{let e=r.createHelp().visibleOptions(r).filter(e=>e.long).map(e=>e.long);n=n.concat(e),r=r.parent}while(r&&!r._enablePositionalOptions);t=m(e,n)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:`commander.unknownOption`})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?``:`s`,r=`error: too many arguments${this.parent?` for '${this.name()}'`:``}. Expected ${t} argument${n} but got ${e.length}.`;this.error(r,{code:`commander.excessArguments`})}unknownCommand(){let e=this.args[0],t=``;if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(e=>{n.push(e.name()),e.alias()&&n.push(e.alias())}),t=m(e,n)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:`commander.unknownCommand`})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t||=`-V, --version`,n||=`output the version number`;let r=this.createOption(t,n);return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on(`option:`+r.name(),()=>{this._outputConfiguration.writeOut(`${e}\n`),this._exit(0,`commander.version`,e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw Error(`Command alias can't be the same as its name`);let n=this.parent?._findCommand(e);if(n){let t=[n.name()].concat(n.aliases()).join(`|`);throw Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${t}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let e=this.registeredArguments.map(e=>c(e));return[].concat(this.options.length||this._helpOption!==null?`[options]`:[],this.commands.length?`[command]`:[],this.registeredArguments.length?e:[]).join(` `)}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??``:(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??``:(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??``:(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=i.basename(e,i.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),n=this._getOutputContext(e);t.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let r=t.formatHelp(this,t);return n.hasColors?r:this._outputConfiguration.stripColor(r)}_getOutputContext(e){e||={};let t=!!e.error,n,r,i;return t?(n=e=>this._outputConfiguration.writeErr(e),r=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(n=e=>this._outputConfiguration.writeOut(e),r=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:t,write:e=>(r||(e=this._outputConfiguration.stripColor(e)),n(e)),hasColors:r,helpWidth:i}}outputHelp(e){let t;typeof e==`function`&&(t=e,e=void 0);let n=this._getOutputContext(e),r={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(e=>e.emit(`beforeAllHelp`,r)),this.emit(`beforeHelp`,r);let i=this.helpInformation({error:n.error});if(t&&(i=t(i),typeof i!=`string`&&!Buffer.isBuffer(i)))throw Error(`outputHelp callback must return a string or a Buffer`);n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit(`afterHelp`,r),this._getCommandAndAncestors().forEach(e=>e.emit(`afterAllHelp`,r))}helpOption(e,t){return typeof e==`boolean`?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??`-h, --help`,t??`display help for command`),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(o.exitCode??0);t===0&&e&&typeof e!=`function`&&e.error&&(t=1),this._exit(t,`commander.help`,`(outputHelp)`)}addHelpText(e,t){let n=[`beforeAll`,`before`,`after`,`afterAll`];if(!n.includes(e))throw Error(`Unexpected value for position to addHelpText.
|
|
1145
|
-
Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function g(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function _(){if(o.env.NO_COLOR||o.env.FORCE_COLOR===`0`||o.env.FORCE_COLOR===`false`)return!1;if(o.env.FORCE_COLOR||o.env.CLICOLOR_FORCE!==void 0)return!0}e.Command=h,e.useColor=_}));const{program:
|
|
1147
|
+
Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function g(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function _(){if(o.env.NO_COLOR||o.env.FORCE_COLOR===`0`||o.env.FORCE_COLOR===`false`)return!1;if(o.env.FORCE_COLOR||o.env.CLICOLOR_FORCE!==void 0)return!0}e.Command=h,e.useColor=_}));const{program:yke,createCommand:bke,createArgument:xke,createOption:Ske,CommanderError:Cke,InvalidArgumentError:wke,InvalidOptionArgumentError:Tke,Command:Eke,Argument:Dke,Option:Oke,Help:kke}=e(i((e=>{let{Argument:t}=j5(),{Command:n}=vke(),{CommanderError:r,InvalidArgumentError:i}=A5(),{Help:a}=M5(),{Option:o}=N5();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i}))(),1).default;function Ake(e){let{projectDir:t,contentDir:n,sampleCap:r=5}=e,i=[],a=[];try{_(n)}catch(e){return{totalCount:0,sample:[],contentDir:n,warnings:[`cannot access content directory ${n}: ${e instanceof Error?e.message:String(e)}`]}}let o;try{o=zOe({projectDir:t,contentDir:n})}catch(e){return{totalCount:0,sample:[],contentDir:n,warnings:[e instanceof Error?e.message:String(e)]}}function s(e){let t;try{t=w(e,{withFileTypes:!0})}catch(t){let r=t instanceof Error?t.message:String(t);i.push(`could not read directory ${ye(n,e)||`.`}: ${r}`);return}for(let r of t){let t=N(e,r.name);if(r.isSymbolicLink()){let e;try{e=E(t)}catch(e){let r=e.code;r===`ENOENT`||r===`ELOOP`?i.push(`broken or cyclic symlink: ${ye(n,t)}`):i.push(`cannot resolve symlink ${ye(n,t)}: ${r??`unknown error`}`);continue}let r;try{r=te(e)}catch{continue}if(r.isDirectory()){let e=ye(n,t);if(o.isDirExcluded(e))continue;s(t)}else if(r.isFile()){let e=ye(n,t);if(o.isExcluded(e))continue;a.push(e)}}else if(r.isDirectory()){let e=ye(n,t);if(o.isDirExcluded(e))continue;s(t)}else if(r.isFile()){let e=ye(n,t);if(o.isExcluded(e))continue;a.push(e)}}}return s(n),{totalCount:a.length,sample:a.slice(0,r),contentDir:n,warnings:i}}function jke(e){let t=oX(au());return e.startsWith(t)?Object.values(eu).map(oX).every(n=>n.length<=t.length||!e.startsWith(n)):!1}function P5(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.command!==`ok-pi-managed-extension`||!Array.isArray(t.args))return!1;let n=t.args[0];return typeof n==`string`&&jke(n)}function Mke(e){return{command:`ok-pi-managed-extension`,args:[e]}}function F5(e={}){let t=e.mode===`dev`,n=au(),r=t?`${oX(n)}-dev`:sX(n),i=`${gu(n)}_`,a={unix:uX({...e,platformName:`darwin`}),win32:uX({...e,platformName:`win32`})};return`${r}
|
|
1146
1148
|
/**
|
|
1147
1149
|
* Open Knowledge bridge for Pi — MANAGED FILE, written by \`ok init\`.
|
|
1148
1150
|
* Hand edits are overwritten whenever OK re-syncs this project; remove it
|
|
@@ -1485,56 +1487,56 @@ export default function okBridge(pi: {
|
|
|
1485
1487
|
}
|
|
1486
1488
|
});
|
|
1487
1489
|
}
|
|
1488
|
-
`}function
|
|
1490
|
+
`}function Nke(e,t){let n=ye(j8(t),j8(e));return n.length>0&&!n.startsWith(`..`)&&!ge(n)}const Pke=e=>{try{let t=s(`git`,[`rev-parse`,`--show-toplevel`],F8({cwd:e,encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]})).trim();return t.length>0?t:null}catch{return null}};function Fke(e,t={}){let n=t.homeDir??k(),r=t.gitTopLevel??Pke,i=be(e),a;try{a=E(i)}catch{a=i}let o=a,s=0;for(;s<30&&o!==n&&o!==`/`&&o!==``;){if(I8(o))return{projectRoot:o,defaultContentDir:`.`,ancestorPromoted:o!==a,gitRootPromoted:!1};let e=M(o);if(e===o)break;o=e,s+=1}let c=r(a);return c!==null&&Nke(c,n)?c===a?{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}:{projectRoot:c,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!0}:{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}}var I5=class extends Error{name=`ProjectPathSafetyError`;code=`PROJECT_PATH_SAFETY`};function L5(e,t){let n;try{n=_(e)}catch(e){if(e.code!==`ENOENT`)throw e}if(n?.isSymbolicLink())throw new I5(`Refusing to write through a symbolic link at ${e}. Remove the symlink and re-run project setup.`);R5(e,t)}function Ike(e,t){R5(e,t)}function R5(e,t){z5(e,t)}function z5(e,t){let n=t,r;try{r=E(n)}catch{r=be(n)}let i=M(e);for(;i.length>1&&i!==xe;){let t;try{t=E(i)}catch(e){if(e.code===`ENOENT`){i=M(i);continue}throw e}let n=ye(r,t);if(n===``||!n.startsWith(`..`)&&!ge(n))return;throw new I5(`Refusing to write at ${e}: ancestor ${i} resolves to ${t}, which is outside the project directory ${r}. A symbolic link in the path likely escapes the project. Remove the symlink and re-run project setup.`)}}function B5(e,t){let n=M(t),r=g(t)?`overwritten`:`written`;if(r===`written`&&g(n))throw Error(`Refusing to replace ${n}: it exists but holds no SKILL.md, so it is not a bundle OpenKnowledge wrote. Move it aside and try again.`);return O(n,{recursive:!0,force:!0}),v(M(n),{recursive:!0}),m(e,n,{recursive:!0}),r}function V5(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function H5(e,t,n){try{if(te(n).size>10485760)return!1}catch{return!1}let r;try{r=S(n,`utf-8`)}catch{return!1}let i=[],a=ITe(r.charCodeAt(0)===65279?r.slice(1):r,i,{allowTrailingComma:!0,disallowComments:!1});if(i.length>0||!V5(a))return!1;let o=a[e.topLevelKey];if(!V5(o))return!1;let s=e.serverMapSubKey?o[e.serverMapSubKey]:o;if(!V5(s))return!1;let c=s[e.serverName(t)];return V5(c)&&c.enabled===!1?!1:_X(c)||Ove(c)}function Lke(e){let t=Xu[e]?.satisfiers.find(e=>e.piece===`mcp`&&e.scope===`project`),n=t?.pathId===void 0?null:Au(t.pathId);return n===null||n.kind!==`editor-project-config`||n.editor===e?null:OX[n.editor]??null}function Rke(e,t,n={}){if(!hie.includes(e.id))return!0;let r=Lke(e.id),i=r?.projectConfigPath?.(t);if(r!==null&&i!==void 0&&H5(r,t,i))return!0;try{return H5(e,t,e.configPath(t,n.home))}catch{return!1}}function zke(e){let t=new Set(uu.filter(e=>e.scope===`project`).map(e=>e.editorId));return e.filter(e=>t.has(e))}function Bke(e,t){if(zke(t).length===0)return null;let n=N(e,od,fu,`SKILL.md`);try{let t=g5(`project`,{checkDesktop:!0});return L5(M(n),e),{editorId:`agents`,label:`.agents hub`,action:B5(t,n),path:n}}catch(e){return{editorId:`agents`,label:`.agents hub`,action:`failed`,path:n,error:e instanceof Error?e.message:String(e)}}}function U5(e,t,n={}){let r=e.projectSkillPath?.(t);if(!r)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};if(!Rke(e,t,n))return{editorId:e.id,label:e.label,action:`skipped-prerequisite`,path:r};try{let n=g5(`project`,{checkDesktop:!0});L5(M(r),t);let i=B5(n,r);return{editorId:e.id,label:e.label,action:i,path:r}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}function Vke(e,t){let n=e.projectSkillPath?.(t);if(!n)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};try{let r=M(n);return g(n)?(Ike(r,t),O(r,{recursive:!0,force:!0}),{editorId:e.id,label:e.label,action:`removed`,path:n}):{editorId:e.id,label:e.label,action:`not-present`,path:n}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function Hke(){let e=qY();return e&&typeof e.resolveSymlinkWritePath==`function`?e:null}function Uke(e){let t=e,n=new Set;for(;;){let r;try{r=_(t).isSymbolicLink()}catch(n){return n.code===`ENOENT`?{readPath:t,writePath:t}:{readPath:null,writePath:e}}if(!r)return{readPath:t,writePath:t};if(n.has(t))return{readPath:null,writePath:e};n.add(t);let i;try{i=T(t)}catch(t){return KY(`readlinkSync threw during symlink walk`,t),{readPath:null,writePath:e}}t=ge(i)?i:N(M(t),i)}}let W5;function Wke(){return W5===void 0&&(W5=Hke()),W5}function G5(e,t=Wke){let n=t();if(n)try{let t=n.resolveSymlinkWritePath(e);return{readPath:t.readPath??null,writePath:t.writePath}}catch(e){KY(`resolveSymlinkWritePath threw`,e)}return Uke(e)}const K5=`**/.ok/*`,q5=`!**/.ok/skills/`;function J5(e){let t=[`.ok/`,`.okignore`];for(let n of ZY){let r=OX[n];r.projectConfigPath&&t.push(Qke(r.projectConfigPath(e),e))}return t.push(`.claude/launch.json`),Array.from(new Set(t))}function Y5(e){let t=N(e,...tV);if(!g(t))return[];try{let e=aV(S(t,`utf-8`));if(!e)return[];let n=[];for(let[t,r]of Object.entries(e.skills))if(t!==`open-knowledge`)for(let e of r.hosts){let r=cu[e];r&&n.push(`${r}/${t}/`)}return Array.from(new Set(n))}catch{return[]}}function Gke(e,t){let n=X5(e,t).tracked;if(n.length>0)return{kind:`refused-tracked`,tracked:n,remediation:Z5(n)};let r=Q5(e);if(r.kind!==`ok`)return r.result;let i=g(r.path)?S(r.path,`utf-8`):``,a=new Set(Y5(e)),o=[],s=a.size===0?i:i.split(`
|
|
1489
1491
|
`).filter(e=>{let t=e.trim();return!a.has(t)||(o.push(t),!1)}).join(`
|
|
1490
1492
|
`),c=t7(s),l=[],u=[];for(let e of t)e7(c,e)?u.push(e):l.push(e);if(l.length===0&&o.length===0)return{kind:`updated`,appended:l,alreadyPresent:u,removed:[]};let d=l.length===0||s.length===0||s.endsWith(`
|
|
1491
1493
|
`)?``:`
|
|
1492
1494
|
`,f=l.length===0?``:`${l.join(`
|
|
1493
|
-
`)}\n`;try{re(r.path,`${s}${d}${f}`,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}return{kind:`updated`,appended:l,alreadyPresent:u,removed:o}}function
|
|
1495
|
+
`)}\n`;try{re(r.path,`${s}${d}${f}`,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}return{kind:`updated`,appended:l,alreadyPresent:u,removed:o}}function Kke(e,t){let n=Q5(e);if(n.kind!==`ok`)return n.result;if(!g(n.path))return{kind:`updated`,appended:[],alreadyPresent:[],removed:[]};let r=t.map(e=>$5(e)),i=new Set;for(let e of r)for(let t of e)i.add(t);i.add(K5),i.add(q5);for(let t of Y5(e))i.add(t);let a;try{a=S(n.path,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}let o=a.split(`
|
|
1494
1496
|
`),s=new Set,c=[];for(let e of o){let t=e.trim();if(i.has(t)){s.add(t);continue}c.push(e)}let l=[...s];if(s.size===0)return{kind:`updated`,appended:[],alreadyPresent:[],removed:[]};let u=c.join(`
|
|
1495
|
-
`);if(u!==a)try{re(n.path,u,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}return{kind:`updated`,appended:[],alreadyPresent:[],removed:l}}function
|
|
1496
|
-
`)}function Q5(e){let t=
|
|
1497
|
-
`)){let e=n.trim();e.length!==0&&t.add(e)}return t}function
|
|
1498
|
-
`)){let e=t.trimStart();if(e.length!==0&&e.length!==t.length)return t.charCodeAt(0)===9?{insertSpaces:!1,tabSize:1}:{insertSpaces:!0,tabSize:t.length-e.length}}return{insertSpaces:!0,tabSize:2}}function i7(e){let t=(e.match(/\r\n/g)??[]).length;return t!==0&&t>=(e.match(/\n/g)??[]).length-t}function a7(e){try{return te(e).mode&511}catch{return}}function
|
|
1497
|
+
`);if(u!==a)try{re(n.path,u,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}return{kind:`updated`,appended:[],alreadyPresent:[],removed:l}}function qke(e){let t=Q5(e);if(t.kind!==`ok`)return t.result.reason===`no-git`||t.result.reason===`malformed-pointer`||t.result.reason===`inaccessible`?`no-git`:`shared`;if(!g(t.path))return`shared`;let n;try{n=S(t.path,`utf-8`)}catch{return`shared`}let r=t7(n),i=J5(e);for(let e of i)if(e7(r,e))return`local-only`;return r.has(K5)?`local-only`:`shared`}function Jke(e){let t=Q5(e);if(t.kind!==`ok`||!g(t.path))return[];let n;try{n=S(t.path,`utf-8`)}catch{return[]}let r=t7(n),i=[...J5(e),...Y5(e)].filter(e=>e7(r,e)),a=new Set(i),o=[];for(let e of Object.values(cu))e!==null&&o.push(e);let s=[];for(let e of r){if(a.has(e))continue;if(e===K5||e===q5){s.push(e);continue}let t=e.replace(/^\//,``).replace(/\/$/,``);o.some(e=>t.startsWith(`${e}/`)&&t.length>e.length+1)&&s.push(e)}return[...i,...s]}function X5(e,t){let n=[];for(let r of t){let t=be(e,r);if(g(t))try{s(`git`,[`ls-files`,`--error-unmatch`,...AB([r])],F8({cwd:e,stdio:[`ignore`,`ignore`,`ignore`]})),n.push(r)}catch{}}return{tracked:n}}const Yke=/^[\w.\-/]+$/;function Xke(e){return process.platform===`win32`?`"${e.replaceAll(`"`,``)}"`:`'${e.replaceAll(`'`,`'\\''`)}'`}function Zke(e){return Yke.test(e)?e:Xke(kB(e))}function Z5(e){let t=[];t.push(`Cannot switch OpenKnowledge to local-only — these OK files are tracked upstream:`),t.push(``);for(let n of e)t.push(` ${n}`);t.push(``),t.push(`.git/info/exclude only hides files that git isn't already tracking. To proceed, untrack them first:`),t.push(``);for(let n of e){let e=n.replace(/\/$/,``),r=n.endsWith(`/`)?`-r `:``;t.push(` git rm --cached ${r}-- ${Zke(e)}`)}return t.push(``),t.push("Then re-run the command. Note: `git rm --cached` removes the files from the index — your teammates will see a deletion on their next pull. If you don't want that, leave sharing mode set to 'shared'."),t.join(`
|
|
1498
|
+
`)}function Q5(e){let t=Fye(e);switch(t.kind){case`repository`:{let e=t.repository.readCommonDir();if(e.kind===`unreadable`)return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`inaccessible`}};let n=N(e.path,`info`);return g(n)?{kind:`ok`,path:N(n,`exclude`)}:{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`no-info-dir`}}}case`absent`:return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`no-git`}};case`malformed-pointer`:return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`malformed-pointer`}};case`inaccessible`:return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`inaccessible`}}}}function $5(e){let t=e.replace(/\/$/,``);return new Set([e,t,`/${e}`,`/${t}`])}function e7(e,t){for(let n of $5(t))if(e.has(n))return!0;return!1}function t7(e){let t=new Set;for(let n of e.split(`
|
|
1499
|
+
`)){let e=n.trim();e.length!==0&&t.add(e)}return t}function Qke(e,t){return $ke(ye(t,e))}function $ke(e){return xe===`/`?e:e.split(xe).join(`/`)}function n7(e){switch(e?.code){case`EACCES`:case`EPERM`:return`permission-denied`;case`ELOOP`:return`unresolved-symlink`;case`EISDIR`:case`ENOTDIR`:return`not-a-file`;case`ENOENT`:return`disappeared`;default:return`unreadable`}}function r7(e){switch(e){case`permission-denied`:return`permission denied; check file and parent-directory permissions, then retry`;case`missing-symlink-target`:return`the symlink target is missing; restore the target or correct the symlink, then retry`;case`unresolved-symlink`:return`the path or symlink could not be resolved; check path permissions and repair any symlink cycle, then retry`;case`not-a-file`:return`the path is not a regular file; restore the intended configuration file, then retry`;case`disappeared`:return`the file disappeared; retry to check its current state`;case`unreadable`:return`the file could not be read; check that the path is accessible, then retry`;default:throw Error(`unhandled configuration file decline reason: ${e}`)}}function eAe(e){for(let t of e.split(`
|
|
1500
|
+
`)){let e=t.trimStart();if(e.length!==0&&e.length!==t.length)return t.charCodeAt(0)===9?{insertSpaces:!1,tabSize:1}:{insertSpaces:!0,tabSize:t.length-e.length}}return{insertSpaces:!0,tabSize:2}}function i7(e){let t=(e.match(/\r\n/g)??[]).length;return t!==0&&t>=(e.match(/\n/g)??[]).length-t}function a7(e){try{return te(e).mode&511}catch{return}}function tAe(e,t){let n=e.charCodeAt(0)===65279,r=n?e.slice(1):e,i=r.includes(`\r
|
|
1499
1501
|
`)?`\r
|
|
1500
1502
|
`:`
|
|
1501
|
-
`,a=p3(r,t,void 0,{formattingOptions:{
|
|
1502
|
-
`)?n:`${n}\n`)}function
|
|
1503
|
-
`)?n:`${n}\n`)}const l7=10485760;function u7(e,t){if(e===t)return!0;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((e,n)=>u7(e,t[n]));if(WY(e)&&WY(t)){let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>Object.hasOwn(t,n)&&u7(e[n],t[n]))}return!1}function
|
|
1504
|
-
`)){let e=t.trimStart();if(e.length!==0&&e.length!==t.length)return t.charCodeAt(0)===9?{insertSpaces:!1,tabSize:1}:{insertSpaces:!0,tabSize:t.length-e.length}}return{insertSpaces:!0,tabSize:2}}function d7(e,t,n){return t===void 0?[e,n]:[e,t,n]}function f7(e,t,n,r){let i={[n]:r};return{[e]:t===void 0?i:{[t]:i}}}function p7(e,t,n){let r=e[t];return n===void 0?r:WY(r)?r[n]:void 0}function
|
|
1503
|
+
`,a=p3(r,t,void 0,{formattingOptions:{...eAe(r),eol:i}});if(a.length===0)return{text:e,changed:!1};let o=`${n?``:``}${m3(r,a)}`;return{text:o,changed:o!==e}}const nAe={allowTrailingComma:!0,disallowComments:!1};function rAe(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function o7(e){let t=[],n=LTe(e,t,nAe);return t.some(t=>!rAe(t,e))||n?.type!==`object`?null:n}function s7(e,t){let n=0;for(let r of e.children??[]){let e=r.children?.[0];e!==void 0&&f3(e)===t&&(n+=1)}return n}function c7(e,t){Pl(e,`${JSON.stringify(t,null,2)}\n`)}function iAe(e,t){let n=pve(t);Pl(e,n.endsWith(`
|
|
1504
|
+
`)?n:`${n}\n`)}function aAe(e,t){let n=(0,cs.stringify)(t);Pl(e,n.endsWith(`
|
|
1505
|
+
`)?n:`${n}\n`)}const l7=10485760;function u7(e,t){if(e===t)return!0;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((e,n)=>u7(e,t[n]));if(WY(e)&&WY(t)){let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>Object.hasOwn(t,n)&&u7(e[n],t[n]))}return!1}function oAe(e,t,n){return WY(e)&&n.every(n=>u7(e[n],t[n]))}function sAe(e){for(let t of e.split(`
|
|
1506
|
+
`)){let e=t.trimStart();if(e.length!==0&&e.length!==t.length)return t.charCodeAt(0)===9?{insertSpaces:!1,tabSize:1}:{insertSpaces:!0,tabSize:t.length-e.length}}return{insertSpaces:!0,tabSize:2}}function d7(e,t,n){return t===void 0?[e,n]:[e,t,n]}function f7(e,t,n,r){let i={[n]:r};return{[e]:t===void 0?i:{[t]:i}}}function p7(e,t,n){let r=e[t];return n===void 0?r:WY(r)?r[n]:void 0}function cAe(e,t,n,r,i,a=!1,o=!1){if(!g(e))return o?{kind:`unchanged`}:(c7(e,f7(t,i,n,r)),{kind:`written`});let s;try{s=S(e,`utf-8`)}catch(e){return KY(`json config read failed`,e),{kind:`declined`,reason:n7(e)}}if(s.trim()===``)return o?{kind:`unchanged`}:(c7(e,f7(t,i,n,r)),{kind:`written`});if(Buffer.byteLength(s,`utf-8`)>l7)return{kind:`declined`,reason:`oversize`};let c=o7(s);if(!c)return{kind:`declined`,reason:`unparseable`};if(s7(c,t)>1)return{kind:`declined`,reason:`duplicate-container`};let l=p7(f3(c),t,i),u=WY(l)?l[n]:void 0,d=u!==void 0,f=vX(r);if(d&&a?dX(u):d&&oAe(u,r,f))return{kind:o?`unchanged`:`overwritten`};let p=s.charCodeAt(0)===65279,m=p?s.slice(1):s,h=m.includes(`\r
|
|
1505
1507
|
`)?`\r
|
|
1506
1508
|
`:`
|
|
1507
|
-
`,_={...
|
|
1508
|
-
`),p,m=!1;try{let t=
|
|
1509
|
+
`,_={...sAe(m),eol:h},v=d7(t,i,n),y=m;if(o)for(let e of d?yX(u,r):[]){let t=p3(y,[...v,e],void 0,{formattingOptions:_});y=m3(y,t)}else if(d&&!a&&_X(u))for(let e of f){let t=p3(y,[...v,e],r[e],{formattingOptions:_});y=m3(y,t)}else{let e=p3(y,v,r,{formattingOptions:_});y=m3(y,e)}let b=`${p?``:``}${y}`;return b!==s&&Pl(e,b,{mode:a7(e)}),o&&b===s?{kind:`unchanged`}:{kind:d?`overwritten`:`written`}}function lAe(e,t,n,r,i,a=!1,o=!1){let s=``;if(g(t))try{s=S(t,`utf-8`)}catch(e){return KY(`toml config read failed`,e),{kind:`declined`,reason:n7(e)}}let c=s.trim()===``;if(c&&o)return{kind:`unchanged`};if(e.backend===`fallback`)return c?(iAe(t,{[n]:{[r]:i}}),{kind:`written`}):{kind:`declined`,reason:`no-native-writer`};let l=s.charCodeAt(0)===65279,u=l?s.slice(1):s,d=i7(u),f=c||u.endsWith(`
|
|
1510
|
+
`),p,m=!1;try{let t=uAe(e,u,n,r);if(o){let n=u;for(let a of t===void 0?[]:yX(t,i))n=e.removeEntryKey(n,r,a).text;p={text:n,existed:t!==void 0}}else{let n=dAe(t,i,a);m=n.kind===`replace`;let o=m?e.removeEntry(u,r).text:u;if(n.kind===`merge`)for(let t of n.prune)o=e.removeEntryKey(o,r,t).text;p=e.upsertEntry(o,r,i)}}catch(e){return KY(`upsertEntry failed`,e),{kind:`declined`,reason:`unparseable`}}let h=p.text;f?h.endsWith(`
|
|
1509
1511
|
`)||(h=`${h}\n`):h=h.replace(/\n+$/,``),d&&(h=h.replace(/\r\n/g,`
|
|
1510
1512
|
`).replace(/\n/g,`\r
|
|
1511
|
-
`));let _=`${l?``:``}${h}`;return _!==s&&Pl(t,_,{mode:a7(t)}),o&&_===s?{kind:`unchanged`}:{kind:p.existed||m?`overwritten`:`written`}}function
|
|
1513
|
+
`));let _=`${l?``:``}${h}`;return _!==s&&Pl(t,_,{mode:a7(t)}),o&&_===s?{kind:`unchanged`}:{kind:p.existed||m?`overwritten`:`written`}}function uAe(e,t,n,r){if(t.trim()===``)return;let i=e.parseToObject(t)[n],a=WY(i)?i[r]:void 0;return WY(a)?a:void 0}function dAe(e,t,n){return e===void 0||dX(e)?{kind:`merge`,prune:[]}:n||!_X(e)?{kind:`replace`}:{kind:`merge`,prune:yX(e,t)}}function fAe(e,t,n,r,i=!1,a=!1){let o=``;if(g(e))try{o=S(e,`utf-8`)}catch(e){return KY(`yaml config read failed`,e),{kind:`declined`,reason:n7(e)}}if(o.trim()===``)return a?{kind:`unchanged`}:(aAe(e,{[t]:{[n]:r}}),{kind:`written`});if(Buffer.byteLength(o,`utf-8`)>l7)return{kind:`declined`,reason:`oversize`};let s=o.charCodeAt(0)===65279,c=s?o.slice(1):o,l=(0,cs.parseDocument)(c);if(l.errors.length>0)return{kind:`declined`,reason:`unparseable`};let u=[t,n],d=l.hasIn(u);l.hasIn([t])&&!(0,cs.isCollection)(l.getIn([t],!0))&&l.deleteIn([t]);let f=l.getIn(u,!0),p=d&&(0,cs.isCollection)(f)&&(i?dX(f.toJSON()):_X(f.toJSON()));if(a){if(d&&(0,cs.isCollection)(f))for(let e of yX(f.toJSON(),r))l.deleteIn([...u,e])}else if(p)for(let e of vX(r))r[e]===void 0?l.deleteIn([...u,e]):l.setIn([...u,e],l.createNode(r[e]));else l.setIn(u,l.createNode(r));let m=l.toString(),h=i7(c);c.endsWith(`
|
|
1512
1514
|
`)?m.endsWith(`
|
|
1513
1515
|
`)||(m=`${m}\n`):m=m.replace(/\n+$/,``),h&&(m=m.replace(/\r\n/g,`
|
|
1514
1516
|
`).replace(/\n/g,`\r
|
|
1515
|
-
`));let _=`${s?``:``}${m}`;return _!==o&&Pl(e,_,{mode:a7(e)}),a&&_===o?{kind:`unchanged`}:{kind:d?`overwritten`:`written`}}const fAe=`open-knowledge-ui`;function m7(e,t,n){try{let r=e.detectPath?.(t,n)??M(e.configPath(t,n));return g(r)}catch{return!1}}function h7(e,t,n){try{let r=be(M(e.configPath(t,n))),i=be(e.detectPath?.(t,n)??r);return i===r||r.startsWith(i+xe)}catch{return!1}}function g7(e,t,n,r,i){let a=e.serverName(t),o;try{o=i??e.configPath(t,r)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:``,serverName:a,error:t instanceof Error?t.message:String(t)}}let s=n.pruneOnly===!0;if(s&&(e.format===`file`||!g(o)))return{editorId:e.id,label:e.label,action:`skipped-flag`,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}};let c=!n.skipAvailabilityCheck||e.offerOnlyWhenDetected===!0||h7(e,t,r);if(!i&&c&&!m7(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{L5(o,t)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),configScope:`project`}}if(e.format===`file`)return mAe(e,o,a,n,{isProjectScope:i!==void 0});let l;try{l=e.buildEntry(t,n)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}try{s||v(M(o),{recursive:!0})}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}let u={action:`written`},d;try{Rl(`${o}.lock`,()=>{let t=G5(o).writePath;if(s||v(M(t),{recursive:!0}),e.format===`toml`){let r=cAe(XY(),t,e.topLevelKey,a,l,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason);return}if(e.format===`yaml`){let r=dAe(t,e.topLevelKey,a,l,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason);return}let r=sAe(t,e.topLevelKey,a,l,e.serverMapSubKey,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason)},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){d=e instanceof Error?e:Error(String(e))}return d?{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:d.message,...i===void 0?{}:{configScope:`project`}}:u.action===`declined`?{editorId:e.id,label:e.label,action:`declined`,configPath:o,serverName:a,declineReason:u.declineReason,...i===void 0?{}:{configScope:`project`}}:{editorId:e.id,label:e.label,action:u.action===`unchanged`?`skipped-flag`:u.action,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}const pAe={pi:F5};function mAe(e,t,n,r,i){let a=i.isProjectScope?{configScope:`project`}:{},o=r=>({editorId:e.id,label:e.label,action:`failed`,configPath:t,serverName:n,error:r instanceof Error?r.message:String(r),...a}),s=pAe[e.id];if(!s)return o(Error(`No managed-file builder registered for editor "${e.id}" (format: 'file' targets need a MANAGED_FILE_BUILDERS entry).`));let c;try{c=s(r)}catch(e){return o(e)}try{v(M(t),{recursive:!0})}catch(e){return o(e)}let l={action:`written`};try{Rl(`${t}.lock`,()=>{let e=null;try{e=S(t,`utf-8`)}catch{e=null}if(e===c){l.action=`overwritten`;return}Pl(t,c,e===null?void 0:{mode:a7(t)}),l.action=e===null?`written`:`overwritten`},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){return o(e)}return{editorId:e.id,label:e.label,action:l.action,configPath:t,serverName:n,...a}}async function hAe(e){let t=Wve(e.editors).filter(e=>e.scope===`global`),n={mode:`published`,skipAvailabilityCheck:!0,...e.replaceEntry===!0?{replaceEntry:!0}:{},...e.pruneOnly===!0?{pruneOnly:!0}:{}};return t.map(t=>g7(t,``,n,e.home))}function _7(e,t,n,r){let i=y7(e,t,n,r);return i.kind===`present`?i.entry:null}function v7(e,t,n,r){let i=p7(e,t,r);if(!WY(i))return{kind:`no-entry`};let a=i[n];return WY(a)?{kind:`present`,entry:a}:{kind:`no-entry`}}function y7(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!g(i))return{kind:`absent`};try{if(te(i).size>l7)return{kind:`decline`,reason:`oversize`}}catch(e){return{kind:`decline`,reason:n7(e)}}let a;try{a=S(i,`utf-8`)}catch(e){return{kind:`decline`,reason:n7(e)}}if(a.trim()===``)return{kind:`absent`};if(e.format===`file`)return{kind:`present`,entry:jke(a)};let o=e.serverName(t);if(e.format===`toml`){let t;try{t=XY().parseToObject(a)}catch{return{kind:`decline`,reason:`unparseable`}}return v7(t,e.topLevelKey,o,e.serverMapSubKey)}if(e.format===`yaml`){let t=(0,cs.parseDocument)(a.charCodeAt(0)===65279?a.slice(1):a);return t.errors.length>0?{kind:`decline`,reason:`unparseable`}:v7(t.toJS()??{},e.topLevelKey,o,e.serverMapSubKey)}let s=o7(a);return s?s7(s,e.topLevelKey)>1?{kind:`decline`,reason:`duplicate-container`}:v7(f3(s),e.topLevelKey,o,e.serverMapSubKey):{kind:`decline`,reason:`unparseable`}}function gAe(e,t){let n=[];for(let r of ZY)r!==`claude-desktop`&&m7(OX[r],e,t)&&n.push(r);return n}function b7(e){return e===`opencode`?Nve:Mve}function _Ae(e,t,n){let r=OX[e],i=b7(e),a=[],o=r.projectConfigPath?.(t);o!==void 0&&a.push({scope:`project`,configPath:o});try{a.push({scope:`user`,configPath:r.configPath(t,n)})}catch{}for(let o of a){let a=_7(r,t,n,o.configPath);if(a!==null&&i(a))return{editorId:e,scope:o.scope,configPath:o.configPath}}return null}const x7=8192;function S7(e,t){if(e.outcome===`not-present`)return`not-present (no DiagnosticReports directory)`;if(e.outcome===`unreadable-directory`)return`unreadable (${e.directoryErrorCode??`unknown`} reading DiagnosticReports)`;let n=[`${e.windowDays}d`,`${e.foreignIgnored} other-process report(s) ignored`,`${e.unparseable} unparseable`];e.droppedOverCap>0&&n.push(`${e.droppedOverCap} older dropped over cap`);let r=e.files.length-t;return r>0&&n.push(`${r} vanished before staging`),e.outcome===`none-in-window`?`none found in window (${n.join(`; `)})`:`${t} collected (${n.join(`; `)})`}function vAe(e){return e.replace(/\\+\/?/g,e=>{if(!e.endsWith(`/`))return e;let t=e.length-1;return`${`\\`.repeat(t-t%2)}/`})}const yAe=RegExp(`("(?:${[`crashReporterKey`,`bootSessionUUID`,`deviceIdentifierForVendor`].join(`|`)})"\\s*:\\s*)"[^"]*"`,`g`);function bAe(e){return e.replace(yAe,`$1"[REDACTED-DEVICE-ID]"`)}function C7(e){return bAe(vAe(e))}const xAe=/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})(\.\d+)? ([+-]\d{2})(\d{2})$/;function SAe(e){if(typeof e!=`string`)return null;let t=xAe.exec(e.trim());if(t===null)return null;let[,n,r,i=``,a,o]=t,s=Date.parse(`${n}T${r}${i}${a}:${o}`);return Number.isNaN(s)?null:s}function CAe(e){let t=b(e,`r`);try{let e=Buffer.alloc(x7),n=0,r=!1;for(;n<x7;){let i=C(t,e,n,x7-n,n);if(i===0){r=!0;break}let a=n;n+=i;let o=e.subarray(0,n).indexOf(10,a);if(o!==-1)return e.subarray(0,o).toString(`utf-8`)}return r?e.subarray(0,n).toString(`utf-8`):null}finally{f(t)}}function wAe(e){try{let t=CAe(e);if(t===null)return{kind:`unreadable`};let n=JSON.parse(t);if(typeof n!=`object`||!n)return{kind:`unreadable`};let{name:r,app_name:i,timestamp:a}=n,o=typeof r==`string`?r:typeof i==`string`?i:null;return o===null?{kind:`unreadable`}:{kind:`named`,name:o,timestampMs:SAe(a)}}catch{return{kind:`unreadable`}}}function TAe(e){return e===`OpenKnowledge`||e.startsWith(`OpenKnowledge `)}function EAe(e,t){let n={files:[],foreignIgnored:0,unparseable:0,droppedOverCap:0,windowDays:7},r;try{r=w(e,{withFileTypes:!0})}catch(e){let t=e.code;return t===`ENOENT`?{...n,outcome:`not-present`}:{...n,outcome:`unreadable-directory`,directoryErrorCode:t??`unknown`}}let i=t.getTime()-6048e5,a=[],o=0,s=0;for(let t of r){if(!t.isFile()||!t.name.endsWith(`.ips`))continue;let n=N(e,t.name),r;try{r=te(n).mtimeMs}catch{continue}if(r<i)continue;let c=wAe(n),l=c.kind===`named`&&c.timestampMs!==null?c.timestampMs:r;if(c.kind===`unreadable`){s+=1;continue}if(!TAe(c.name)){o+=1;continue}a.push({path:n,atMs:l})}a.sort((e,t)=>t.atMs-e.atMs);let c=a.slice(0,25),l={foreignIgnored:o,unparseable:s,droppedOverCap:a.length-c.length,windowDays:7};return c.length===0?{...l,files:[],outcome:`none-in-window`}:{...l,files:c.map(e=>e.path),outcome:`collected`}}const DAe=eu.stable.appId;eu.stable,eu.beta;function w7(){return N(k(),`.ok`,`bug-reports`)}function OAe(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=w7(),r=`${t}-bugreport`,i=N(n,`${r}.zip`);for(let e=2;g(i);e+=1)i=N(n,`${r}-${e}.zip`);return i}function T7(e,t){let{scrubbed:n}=e;return n!==void 0&&n.patterns.length>0?{file:t,lineCount:n.lineCount,patterns:[...n.patterns]}:null}function E7(e,t){let n=N(e,`.ok`,`config.yml`);if(g(n))try{let e=S(n,`utf8`).match(/^\s*name:\s*['"]?(.+?)['"]?\s*$/m);if(e?.[1])return e[1]}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml for project slug; using path-hash fallback`)}return g(N(e,`.ok`))?De(`sha256`).update(be(e)).digest(`hex`).slice(0,12):null}function kAe(){let e={timestamp:new Date().toISOString(),platform:le(),osType:de(),osRelease:ue(),hostname:`[redacted]`,uptime:fe(),freeMem:se(),totalMem:j(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=c(`sw_vers -productVersion 2>/dev/null`,F8({encoding:`utf8`})).trim()}catch{}try{let t=N(__dirname,`..`,`..`,`package.json`);g(t)&&(e.okVersion=JSON.parse(S(t,`utf8`)).version)}catch{}return e}const AAe=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function D7(e){let t=me(e);return AAe.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function jAe(e,t){return A7(e,t).files}const MAe=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function O7(e,t=DAe){let n=N(e,`${t}.ShipIt`);if(!g(n))return[];let r;try{r=w(n)}catch{return[]}return MAe.flatMap(e=>r.map(t=>{if(t===e)return{entry:t,suffix:-1};if(!t.startsWith(`${e}.`))return null;let n=t.slice(e.length+1);return/^\d+$/.test(n)?{entry:t,suffix:Number(n)}:null}).filter(e=>e!==null).sort((e,t)=>e.suffix-t.suffix).slice(0,4).map(e=>N(n,e.entry)))}function k7(e){if(!g(e))return[];try{let t=new Map;for(let n of w(e).filter(e=>e.endsWith(`.yaml`)).sort()){let e=n.endsWith(`.sent.yaml`)?n.slice(0,-10):n.slice(0,-5),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}return[...t.values()].slice(-25).flat().map(t=>N(e,t))}catch{return[]}}function A7(e,t){if(!g(t))return{files:[],excludedByProjectSlug:0};let n=w(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>N(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(D7),i=[],a=r.filter(t=>{try{return S(t,`utf8`).includes(`"project":"${e}"`)}catch{return i.push(t),!1}});if(a.length===0)return{files:n,excludedByProjectSlug:0};let o=new Set([...a,...i]);return{files:n.filter(e=>!D7(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function NAe(e){let t=N(e,`.ok`,`local`);return g(t)?{files:[`server.lock`,`last-spawn-error.log`,ll,sl].map(e=>N(t,e)).filter(e=>g(e))}:{files:[]}}function PAe(e){let t=N(e,`.ok`,`local`,`logs`);return g(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>N(t,e)).filter(e=>g(e))}:{files:[]}}function FAe(e){let t=0,n=new Map,r=e.replace(/("(?:docName|doc\.name|documentName)"\s*:\s*")((?:[^"\\]|\\.)*)"/g,(e,r,i)=>{t+=1;let a=n.get(i);return a===void 0&&(a=`doc#${De(`sha256`).update(i).digest(`hex`).slice(0,12)}`,n.set(i,a)),`${r}${a}"`});for(let[e,i]of[...n].sort(([e],[t])=>t.length-e.length)){if(e.length===0||!r.includes(e))continue;let n=r.split(e);t+=n.length-1,r=n.join(i)}return{text:r,count:t}}function j7(e){let t=e.revealDocNames?e.content:FAe(e.content).text;if(e.redact){let{redacted:n,patterns:r,lineCount:i}=dV(t);e.zipfile.addBuffer(Buffer.from(n,`utf8`),e.name),e.bundleFiles.push(e.name),r.length>0&&e.redactions.push({file:e.name,lineCount:i,patterns:r})}else e.zipfile.addBuffer(Buffer.from(t,`utf8`),e.name),e.bundleFiles.push(e.name)}function M7(e){for(let t of e.files)try{let n=S(t,`utf8`);j7({zipfile:e.zipfile,name:`${e.prefix}/${me(t)}`,content:t.endsWith(`.ips`)?C7(n):n,redact:e.redact,revealDocNames:e.revealDocNames,bundleFiles:e.bundleFiles,redactions:e.redactions})}catch(n){e.logger?.warn({file:t,prefix:e.prefix,err:n},`bug-report: skipped unreadable file`)}}async function IAe(t){let{redact:n,outputPath:r,logger:i}=t,a=t.revealDocNames??!1,o=t.userLogsDir??N(k(),`.ok`,`logs`),s=t.projectDir?E7(t.projectDir,i):null;v(M(r),{recursive:!0}),i?.info({projectSlug:s},`gathering diagnostic data`);let c=kAe();c.desktop=t.desktop??null,c.language=t.language??null;let{files:l,excludedByProjectSlug:u}=A7(s,o),{files:d}=t.projectDir?NAe(t.projectDir):{files:[]},{files:f}=t.projectDir?PAe(t.projectDir):{files:[]},p=t.shipItLogFiles??[],m=t.diagnosticReports?.files??[];i?.info({logFileCount:l.length,logFilesExcludedByProjectSlug:u,lockFileCount:d.length,localSinkFileCount:f.length,shipItLogFileCount:p.length,diagnosticReportCount:m.length},`files collected`);let g=[],_=[],{ZipFile:y}=await Promise.resolve().then(()=>e(q4(),1)),b=new y;M7({zipfile:b,files:[...l,...p],prefix:`logs`,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i}),M7({zipfile:b,files:d,prefix:`lockdir`,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i}),M7({zipfile:b,files:f,prefix:`local-logs`,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i}),M7({zipfile:b,files:t.bugReportLedgerFiles??[],prefix:NR,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i}),M7({zipfile:b,files:m,prefix:`diagnostic-reports`,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i});for(let e of t.extraFiles??[])try{let t=S(e.sourcePath),n=`extra/${e.zipName??me(e.sourcePath)}`;b.addBuffer(t,n),_.push(n);let r=T7(e,n);r!==null&&g.push(r)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&j7({zipfile:b,name:`note.txt`,content:t.note,redact:n,revealDocNames:a,bundleFiles:_,redactions:g});let x=new Set(m.map(e=>`diagnostic-reports/${me(e)}`)),C=_.filter(e=>x.has(e)),w=t.diagnosticReports===void 0?`not-collected (no collection attempted)`:S7(t.diagnosticReports,C.length);b.addBuffer(Buffer.from(`${w}\n`,`utf8`),`state/diagnostic-reports-status.txt`),_.push(`state/diagnostic-reports-status.txt`);let T=JSON.stringify(c,null,2);b.addBuffer(Buffer.from(T,`utf8`),`sysinfo.json`),_.push(`sysinfo.json`);let E={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:s,files:_,redactions:g,sysinfo:c};b.addBuffer(Buffer.from(JSON.stringify(E,null,2),`utf8`),`MANIFEST.json`);let D=g.reduce((e,t)=>e+t.lineCount,0),O=new Set(p.map(e=>`logs/${me(e)}`)),ee=_.filter(e=>O.has(e)),te=new Set((t.bugReportLedgerFiles??[]).map(e=>`${NR}/${me(e)}`)),ne=_.filter(e=>te.has(e)),re=s?_.filter(e=>e.startsWith(`logs/`)&&!D7(e)&&!O.has(e)):[],ie=C.length>0?[`Crash reports under diagnostic-reports/ are rewritten on the way in,`,`independently of this setting: escaped path separators are normalised`,`so the scrub above can read them, and the identifiers that link this`,`machine's bundles to each other are replaced. Nothing else is changed;`,`they are not byte-identical to the files macOS wrote.`]:[],ae=ie.length>0?[`Redaction was disabled for this bundle; file contents are unmodified,`,`with one exception.`,...ie]:[`Redaction was disabled for this bundle; file contents are unmodified.`],oe=[`# Bug Report Bundle`,``,`Generated: ${E.generatedAt}`,`Project: ${s??`(unscoped)`}`,`Discipline version: ${E.disciplineVersion}`,``,`## Contents`,``,..._.map(e=>`- ${e}`),``,`## Privacy`,``,...re.length>0?[`Scope: some collected logs are user-wide rather than project-scoped.`,`These are written once per machine per day and can contain activity`,`from other projects open on this machine, including captured console`,`output:`,...re.map(e=>`- ${e}`),``]:[],...ee.length>0?[`Installer logs: written by the macOS update helper rather than by`,`OpenKnowledge itself, and machine-wide rather than scoped to any one`,`project. They record the install and update history of this app on`,`this machine. Only this app is collected, never other applications`,`that use the same update mechanism:`,...ee.map(e=>`- ${e}`),``]:[],...C.length>0?[`Crash reports: written by macOS itself rather than by OpenKnowledge,`,`and machine-wide rather than scoped to any one project. They record`,`why the operating system ended a process of this app — the signal or`,`exception, the code-signing verdict, and whatever text the process`,`left behind as it died. They also carry machine details the OS puts`,`in every report: the account uid, the Mac model, and the name of the`,`process that launched this app, which on a managed machine can be`,`internal tooling. The identifiers that would link this machine's`,`bundles to each other are replaced before bundling. Only this`,`app's own reports are collected, never another application's, though`,`a report of ours still names the processes it ran alongside:`,...C.map(e=>`- ${e}`),``]:[],...ne.length>0?[`Send history: a small record for each bug report previously generated`,`on this machine — when it was generated, whether sending it`,`succeeded, and why it failed if it did. This is what makes a failed`,`send diagnosable at all. It is machine-wide rather than scoped to`,`this project, so it names the other projects reports were filed`,`from. It carries no document content:`,...ne.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${uV.join(`, `)}`,D>0?`${D} line(s) were scrubbed across ${g.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,...ie,``,`This bundle is safe to attach to a GitHub issue.`]:ae].join(`
|
|
1516
|
-
`);b.addBuffer(Buffer.from(oe,`utf8`),`README.md`),b.end();let se=h(r);return b.outputStream.pipe(se),await new Promise((e,t)=>{se.on(`close`,e),se.on(`error`,t)}),i?.info({bundlePath:r,fileCount:_.length,redactionCount:D},`bundle written`),{zipPath:r,summary:{projectSlug:s,files:_,redactions:g,redactedLineCount:D,generatedAt:E.generatedAt}}}function N7(e){return e.replace(/[\p{Cc}\p{Zl}\p{Zp}\p{Bidi_Control}\u200b\ufeff]/gu,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`)}function P7(e){return De(`sha256`).update(e).digest(`hex`)}function F7(e){return N(be(e),`.ok`,`pi-trust`)}function I7(e,t){return N(F7(e),P7(be(t)))}function L7(e,t,n){return N(I7(e,t),`${P7(n)}.json`)}var R7=class extends Error{constructor(e,t,n,r){super(`Pi trust receipt at ${N7(e)} ${N7(t)}; ${N7(n)}`,{cause:r}),this.name=`PiTrustReceiptError`}};function z7(e,t,n){let r=n.code,i=n instanceof Error?n.message:String(n),a;switch(r){case`EACCES`:case`EPERM`:a=`check receipt and parent-directory permissions, then retry`;break;case`ENOENT`:a=`the location no longer exists; restore access to its expected location, then retry`;break;default:a=`check the path and available storage, then retry`}return new R7(e,`could not ${t}: ${i}`,a,n)}function B7(e){let t;try{t=_(e)}catch(t){if(t.code===`ENOENT`)return!1;throw z7(e,`be inspected`,t)}if(!t.isDirectory())throw new R7(e,`is not a regular directory`,`restore the intended receipt directory without a symlink, then retry`);return!0}function V7(e,t){return Object.keys(e).length===t.length&&t.every(t=>Object.hasOwn(e,t))}function H7(e,t){if(!WY(e)||!V7(e,[`version`,`cwd`,`configuredTrustPath`,`canonicalTrustPath`,`state`,`previous`])||e.version!==1||typeof e.cwd!=`string`||e.cwd!==be(e.cwd)||typeof e.configuredTrustPath!=`string`||e.configuredTrustPath!==be(e.configuredTrustPath)||typeof e.canonicalTrustPath!=`string`||e.canonicalTrustPath!==be(e.canonicalTrustPath)||e.state!==`pending`&&e.state!==`committed`||!WY(e.previous))throw new R7(t,`has invalid contents`,`restore a valid ownership record from a backup without guessing its trust decision, then retry`);let n;if(e.previous.present===!1&&V7(e.previous,[`present`]))n={present:!1};else if(e.previous.present===!0&&V7(e.previous,[`present`,`value`]))n={present:!0,value:e.previous.value};else throw new R7(t,`has an invalid previous decision`,`restore the recorded previous decision from a backup without guessing its value, then retry`);return{version:1,cwd:e.cwd,configuredTrustPath:e.configuredTrustPath,canonicalTrustPath:e.canonicalTrustPath,state:e.state,previous:n}}function U7(e,t,n){let r;try{r=_(n)}catch(e){throw z7(n,`be inspected`,e)}if(!r.isFile())throw new R7(n,`is not a regular file`,`restore the intended receipt as a regular file without a symlink, then retry`);let i;try{i=S(n,`utf8`)}catch(e){throw z7(n,`be read`,e)}let a;try{a=JSON.parse(i)}catch(e){throw new R7(n,`is not valid JSON`,`repair its JSON syntax without changing the recorded decision, then retry`,e)}let o=H7(a,n);if(o.cwd!==be(t)||n!==L7(e,t,o.canonicalTrustPath))throw new R7(n,`does not match its project or trust-store location`,`restore the ownership record to its original project and trust-store location, then retry`);return{path:n,record:o}}function W7(e,t){let{record:n,path:r}=t;for(let t of[F7(e),I7(e,n.cwd)])if(!B7(t))throw new R7(t,`no longer exists`,`restore access to the expected receipt directory, then retry`);let i=U7(e,n.cwd,r);if(!Me(i.record,n))throw new R7(r,`changed while its trust decision was being updated`,`retry to read its current ownership record`);return i}function LAe(e,t,n,r,i){let a={version:1,cwd:be(t),configuredTrustPath:be(n),canonicalTrustPath:be(r),state:`pending`,previous:i},o=L7(e,a.cwd,a.canonicalTrustPath),s=`${JSON.stringify(a,null,2)}\n`;if(!Me(H7(JSON.parse(s),o),a))throw new R7(o,`cannot preserve the previous decision as JSON`,`provide the original decision as a JSON value before retrying`);B7(F7(e)),B7(M(o));try{v(M(o),{recursive:!0,mode:448})}catch(e){throw z7(M(o),`be created`,e)}let c;try{c=_(o,{throwIfNoEntry:!1})}catch(e){throw z7(o,`be inspected`,e)}if(c)throw new R7(o,`already exists`,`reconcile the existing ownership record before recording another grant`);try{Pl(o,s,{mode:384})}catch(e){throw z7(o,`be written`,e)}return{path:o,record:a}}function RAe(e,t){let n=W7(e,t);if(n.record.state!==`pending`)throw new R7(n.path,`is already committed`,`use the current ownership record without committing it again`);let r={...n.record,state:`committed`};try{Pl(n.path,`${JSON.stringify(r,null,2)}\n`,{mode:384})}catch(e){throw z7(n.path,`be committed`,e)}return{path:n.path,record:r}}function G7(e,t){if(!B7(F7(e)))return[];let n=I7(e,t);if(!B7(n))return[];let r;try{r=w(n).sort()}catch(e){throw z7(n,`be listed`,e)}return r.filter(e=>/^[a-f0-9]{64}\.json$/.test(e)).map(r=>U7(e,t,N(n,r)))}function K7(e,t){let n=W7(e,t);try{ne(n.path)}catch(e){throw z7(n.path,`be removed after reconciling its grant`,e)}for(let t of[M(n.path),F7(e)])try{ee(t)}catch(e){let n=e.code;if(n!==`ENOTEMPTY`&&n!==`EEXIST`&&n!==`ENOENT`)throw z7(t,`be removed after reconciling its grant`,e)}}var zAe=i(((e,n)=>{var r=t(`constants`),i=process.cwd,a=null,o=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return a||=i.call(process),a};try{process.cwd()}catch{}if(typeof process.chdir==`function`){var s=process.chdir;process.chdir=function(e){a=null,s.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,s)}n.exports=c;function c(e){r.hasOwnProperty(`O_SYMLINK`)&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&t(e),e.lutimes||n(e),e.chown=s(e.chown),e.fchown=s(e.fchown),e.lchown=s(e.lchown),e.chmod=i(e.chmod),e.fchmod=i(e.fchmod),e.lchmod=i(e.lchmod),e.chownSync=c(e.chownSync),e.fchownSync=c(e.fchownSync),e.lchownSync=c(e.lchownSync),e.chmodSync=a(e.chmodSync),e.fchmodSync=a(e.fchmodSync),e.lchmodSync=a(e.lchmodSync),e.stat=l(e.stat),e.fstat=l(e.fstat),e.lstat=l(e.lstat),e.statSync=u(e.statSync),e.fstatSync=u(e.fstatSync),e.lstatSync=u(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(e,t,n){n&&process.nextTick(n)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(e,t,n,r){r&&process.nextTick(r)},e.lchownSync=function(){}),o===`win32`&&(e.rename=typeof e.rename==`function`?(function(t){function n(n,r,i){var a=Date.now(),o=0;t(n,r,function s(c){if(c&&(c.code===`EACCES`||c.code===`EPERM`||c.code===`EBUSY`)&&Date.now()-a<6e4){setTimeout(function(){e.stat(r,function(e,a){e&&e.code===`ENOENT`?t(n,r,s):i(c)})},o),o<100&&(o+=10);return}i&&i(c)})}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n})(e.rename):e.rename),e.read=typeof e.read==`function`?(function(t){function n(n,r,i,a,o,s){var c;if(s&&typeof s==`function`){var l=0;c=function(u,d,f){if(u&&u.code===`EAGAIN`&&l<10)return l++,t.call(e,n,r,i,a,o,c);s.apply(this,arguments)}}return t.call(e,n,r,i,a,o,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n})(e.read):e.read,e.readSync=typeof e.readSync==`function`?(function(t){return function(n,r,i,a,o){for(var s=0;;)try{return t.call(e,n,r,i,a,o)}catch(e){if(e.code===`EAGAIN`&&s<10){s++;continue}throw e}}})(e.readSync):e.readSync;function t(e){e.lchmod=function(t,n,i){e.open(t,r.O_WRONLY|r.O_SYMLINK,n,function(t,r){if(t){i&&i(t);return}e.fchmod(r,n,function(t){e.close(r,function(e){i&&i(t||e)})})})},e.lchmodSync=function(t,n){var i=e.openSync(t,r.O_WRONLY|r.O_SYMLINK,n),a=!0,o;try{o=e.fchmodSync(i,n),a=!1}finally{if(a)try{e.closeSync(i)}catch{}else e.closeSync(i)}return o}}function n(e){r.hasOwnProperty(`O_SYMLINK`)&&e.futimes?(e.lutimes=function(t,n,i,a){e.open(t,r.O_SYMLINK,function(t,r){if(t){a&&a(t);return}e.futimes(r,n,i,function(t){e.close(r,function(e){a&&a(t||e)})})})},e.lutimesSync=function(t,n,i){var a=e.openSync(t,r.O_SYMLINK),o,s=!0;try{o=e.futimesSync(a,n,i),s=!1}finally{if(s)try{e.closeSync(a)}catch{}else e.closeSync(a)}return o}):e.futimes&&(e.lutimes=function(e,t,n,r){r&&process.nextTick(r)},e.lutimesSync=function(){})}function i(t){return t&&function(n,r,i){return t.call(e,n,r,function(e){d(e)&&(e=null),i&&i.apply(this,arguments)})}}function a(t){return t&&function(n,r){try{return t.call(e,n,r)}catch(e){if(!d(e))throw e}}}function s(t){return t&&function(n,r,i,a){return t.call(e,n,r,i,function(e){d(e)&&(e=null),a&&a.apply(this,arguments)})}}function c(t){return t&&function(n,r,i){try{return t.call(e,n,r,i)}catch(e){if(!d(e))throw e}}}function l(t){return t&&function(n,r,i){typeof r==`function`&&(i=r,r=null);function a(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),i&&i.apply(this,arguments)}return r?t.call(e,n,r,a):t.call(e,n,a)}}function u(t){return t&&function(n,r){var i=r?t.call(e,n,r):t.call(e,n);return i&&(i.uid<0&&(i.uid+=4294967296),i.gid<0&&(i.gid+=4294967296)),i}}function d(e){return!e||e.code===`ENOSYS`||(!process.getuid||process.getuid()!==0)&&(e.code===`EINVAL`||e.code===`EPERM`)}}})),BAe=i(((e,n)=>{var r=t(`stream`).Stream;n.exports=i;function i(e){return{ReadStream:t,WriteStream:n};function t(n,i){if(!(this instanceof t))return new t(n,i);r.call(this);var a=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags=`r`,this.mode=438,this.bufferSize=65536,i||={};for(var o=Object.keys(i),s=0,c=o.length;s<c;s++){var l=o[s];this[l]=i[l]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!=`number`)throw TypeError(`start must be a Number`);if(this.end===void 0)this.end=1/0;else if(typeof this.end!=`number`)throw TypeError(`end must be a Number`);if(this.start>this.end)throw Error(`start must be <= end`);this.pos=this.start}if(this.fd!==null){process.nextTick(function(){a._read()});return}e.open(this.path,this.flags,this.mode,function(e,t){if(e){a.emit(`error`,e),a.readable=!1;return}a.fd=t,a.emit(`open`,t),a._read()})}function n(t,i){if(!(this instanceof n))return new n(t,i);r.call(this),this.path=t,this.fd=null,this.writable=!0,this.flags=`w`,this.encoding=`binary`,this.mode=438,this.bytesWritten=0,i||={};for(var a=Object.keys(i),o=0,s=a.length;o<s;o++){var c=a[o];this[c]=i[c]}if(this.start!==void 0){if(typeof this.start!=`number`)throw TypeError(`start must be a Number`);if(this.start<0)throw Error(`start must be >= zero`);this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}})),VAe=i(((e,t)=>{t.exports=r;var n=Object.getPrototypeOf||function(e){return e.__proto__};function r(e){if(typeof e!=`object`||!e)return e;if(e instanceof Object)var t={__proto__:n(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}),t}})),q7=i(((e,n)=>{var r=t(`fs`),i=zAe(),a=BAe(),o=VAe(),s=t(`util`),c,l;typeof Symbol==`function`&&typeof Symbol.for==`function`?(c=Symbol.for(`graceful-fs.queue`),l=Symbol.for(`graceful-fs.previous`)):(c=`___graceful-fs.queue`,l=`___graceful-fs.previous`);function u(){}function d(e,t){Object.defineProperty(e,c,{get:function(){return t}})}var f=u;s.debuglog?f=s.debuglog(`gfs4`):/\bgfs4\b/i.test(process.env.NODE_DEBUG||``)&&(f=function(){var e=s.format.apply(s,arguments);e=`GFS4: `+e.split(/\n/).join(`
|
|
1517
|
-
GFS4: `),console.error(e)}),r[c]||(d(r,global[c]||[]),r.close=(function(e){function t(t,n){return e.call(r,t,function(e){e||g(),typeof n==`function`&&n.apply(this,arguments)})}return Object.defineProperty(t,l,{value:e}),t})(r.close),r.closeSync=(function(e){function t(t){e.apply(r,arguments),g()}return Object.defineProperty(t,l,{value:e}),t})(r.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||``)&&process.on(`exit`,function(){f(r[c]),t(`assert`).equal(r[c].length,0)})),global[c]||d(global,r[c]),n.exports=p(o(r)),process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!r.__patched&&(n.exports=p(r),r.__patched=!0);function p(e){i(e),e.gracefulify=p,e.createReadStream=T,e.createWriteStream=E;var t=e.readFile;e.readFile=n;function n(e,n,r){return typeof n==`function`&&(r=n,n=null),i(e,n,r);function i(e,n,r,a){return t(e,n,function(t){t&&(t.code===`EMFILE`||t.code===`ENFILE`)?m([i,[e,n,r],t,a||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}var r=e.writeFile;e.writeFile=o;function o(e,t,n,i){return typeof n==`function`&&(i=n,n=null),a(e,t,n,i);function a(e,t,n,i,o){return r(e,t,n,function(r){r&&(r.code===`EMFILE`||r.code===`ENFILE`)?m([a,[e,t,n,i],r,o||Date.now(),Date.now()]):typeof i==`function`&&i.apply(this,arguments)})}}var s=e.appendFile;s&&(e.appendFile=c);function c(e,t,n,r){return typeof n==`function`&&(r=n,n=null),i(e,t,n,r);function i(e,t,n,r,a){return s(e,t,n,function(o){o&&(o.code===`EMFILE`||o.code===`ENFILE`)?m([i,[e,t,n,r],o,a||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}var l=e.copyFile;l&&(e.copyFile=u);function u(e,t,n,r){return typeof n==`function`&&(r=n,n=0),i(e,t,n,r);function i(e,t,n,r,a){return l(e,t,n,function(o){o&&(o.code===`EMFILE`||o.code===`ENFILE`)?m([i,[e,t,n,r],o,a||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}var d=e.readdir;e.readdir=h;var f=/^v[0-5]\./;function h(e,t,n){typeof t==`function`&&(n=t,t=null);var r=f.test(process.version)?function(e,t,n,r){return d(e,i(e,t,n,r))}:function(e,t,n,r){return d(e,t,i(e,t,n,r))};return r(e,t,n);function i(e,t,n,i){return function(a,o){a&&(a.code===`EMFILE`||a.code===`ENFILE`)?m([r,[e,t,n],a,i||Date.now(),Date.now()]):(o&&o.sort&&o.sort(),typeof n==`function`&&n.call(this,a,o))}}}if(process.version.substr(0,4)===`v0.8`){var g=a(e);x=g.ReadStream,C=g.WriteStream}var _=e.ReadStream;_&&(x.prototype=Object.create(_.prototype),x.prototype.open=S);var v=e.WriteStream;v&&(C.prototype=Object.create(v.prototype),C.prototype.open=w),Object.defineProperty(e,"ReadStream",{get:function(){return x},set:function(e){x=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return C},set:function(e){C=e},enumerable:!0,configurable:!0});var y=x;Object.defineProperty(e,"FileReadStream",{get:function(){return y},set:function(e){y=e},enumerable:!0,configurable:!0});var b=C;Object.defineProperty(e,"FileWriteStream",{get:function(){return b},set:function(e){b=e},enumerable:!0,configurable:!0});function x(e,t){return this instanceof x?(_.apply(this,arguments),this):x.apply(Object.create(x.prototype),arguments)}function S(){var e=this;O(e.path,e.flags,e.mode,function(t,n){t?(e.autoClose&&e.destroy(),e.emit(`error`,t)):(e.fd=n,e.emit(`open`,n),e.read())})}function C(e,t){return this instanceof C?(v.apply(this,arguments),this):C.apply(Object.create(C.prototype),arguments)}function w(){var e=this;O(e.path,e.flags,e.mode,function(t,n){t?(e.destroy(),e.emit(`error`,t)):(e.fd=n,e.emit(`open`,n))})}function T(t,n){return new e.ReadStream(t,n)}function E(t,n){return new e.WriteStream(t,n)}var D=e.open;e.open=O;function O(e,t,n,r){return typeof n==`function`&&(r=n,n=null),i(e,t,n,r);function i(e,t,n,r,a){return D(e,t,n,function(o,s){o&&(o.code===`EMFILE`||o.code===`ENFILE`)?m([i,[e,t,n,r],o,a||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}return e}function m(e){f(`ENQUEUE`,e[0].name,e[1]),r[c].push(e),_()}var h;function g(){for(var e=Date.now(),t=0;t<r[c].length;++t)r[c][t].length>2&&(r[c][t][3]=e,r[c][t][4]=e);_()}function _(){if(clearTimeout(h),h=void 0,r[c].length!==0){var e=r[c].shift(),t=e[0],n=e[1],i=e[2],a=e[3],o=e[4];if(a===void 0)f(`RETRY`,t.name,n),t.apply(null,n);else if(Date.now()-a>=6e4){f(`TIMEOUT`,t.name,n);var s=n.pop();typeof s==`function`&&s.call(null,i)}else{var l=Date.now()-o,u=Math.max(o-a,1);l>=Math.min(u*1.2,100)?(f(`RETRY`,t.name,n),t.apply(null,n.concat([a]))):r[c].push(e)}h===void 0&&(h=setTimeout(_,0))}}})),HAe=i(((e,t)=>{function n(e,t){typeof t==`boolean`&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}t.exports=n,n.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},n.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},n.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error(`RetryOperation timeout occurred`)),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0){if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),n=this._timeouts.shift();else return!1}var r=this,i=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n);return this._options.unref&&i.unref(),!0},n.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},n.prototype.try=function(e){console.log(`Using RetryOperation.try() is deprecated`),this.attempt(e)},n.prototype.start=function(e){console.log(`Using RetryOperation.start() is deprecated`),this.attempt(e)},n.prototype.start=n.prototype.try,n.prototype.errors=function(){return this._errors},n.prototype.attempts=function(){return this._attempts},n.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var i=this._errors[r],a=i.message,o=(e[a]||0)+1;e[a]=o,o>=n&&(t=i,n=o)}return t}})),UAe=i((e=>{var t=HAe();e.operation=function(n){return new t(e.timeouts(n),{forever:n&&n.forever,unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw Error(`minTimeout is greater than maxTimeout`);for(var r=[],i=0;i<t.retries;i++)r.push(this.createTimeout(i,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(i,t)),r.sort(function(e,t){return e-t}),r},e.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*t.minTimeout*t.factor**+e);return r=Math.min(r,t.maxTimeout),r},e.wrap=function(t,n,r){if(n instanceof Array&&(r=n,n=null),!r)for(var i in r=[],t)typeof t[i]==`function`&&r.push(i);for(var a=0;a<r.length;a++){var o=r[a],s=t[o];t[o]=function(r){var i=e.operation(n),a=Array.prototype.slice.call(arguments,1),o=a.pop();a.push(function(e){i.retry(e)||(e&&(arguments[0]=i.mainError()),o.apply(this,arguments))}),i.attempt(function(){r.apply(t,a)})}.bind(t,s),t[o].options=n}}})),WAe=i(((e,t)=>{t.exports=UAe()})),GAe=i(((e,t)=>{t.exports=[`SIGABRT`,`SIGALRM`,`SIGHUP`,`SIGINT`,`SIGTERM`],process.platform!==`win32`&&t.exports.push(`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&t.exports.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`,`SIGUNUSED`)})),KAe=i(((e,n)=>{var r=global.process;let i=function(e){return e&&typeof e==`object`&&typeof e.removeListener==`function`&&typeof e.emit==`function`&&typeof e.reallyExit==`function`&&typeof e.listeners==`function`&&typeof e.kill==`function`&&typeof e.pid==`number`&&typeof e.on==`function`};if(!i(r))n.exports=function(){return function(){}};else{var a=t(`assert`),o=GAe(),s=/^win/i.test(r.platform),c=t(`events`);typeof c!=`function`&&(c=c.EventEmitter);var l;r.__signal_exit_emitter__?l=r.__signal_exit_emitter__:(l=r.__signal_exit_emitter__=new c,l.count=0,l.emitted={}),l.infinite||(l.setMaxListeners(1/0),l.infinite=!0),n.exports=function(e,t){if(!i(global.process))return function(){};a.equal(typeof e,`function`,`a callback must be provided for exit handler`),p===!1&&m();var n=`exit`;return t&&t.alwaysLast&&(n=`afterexit`),l.on(n,e),function(){l.removeListener(n,e),l.listeners(`exit`).length===0&&l.listeners(`afterexit`).length===0&&u()}};var u=function(){!p||!i(global.process)||(p=!1,o.forEach(function(e){try{r.removeListener(e,f[e])}catch{}}),r.emit=_,r.reallyExit=h,--l.count)};n.exports.unload=u;var d=function(e,t,n){l.emitted[e]||(l.emitted[e]=!0,l.emit(e,t,n))},f={};o.forEach(function(e){f[e]=function(){i(global.process)&&r.listeners(e).length===l.count&&(u(),d(`exit`,null,e),d(`afterexit`,null,e),s&&e===`SIGHUP`&&(e=`SIGINT`),r.kill(r.pid,e))}}),n.exports.signals=function(){return o};var p=!1,m=function(){p||!i(global.process)||(p=!0,l.count+=1,o=o.filter(function(e){try{return r.on(e,f[e]),!0}catch{return!1}}),r.emit=v,r.reallyExit=g)};n.exports.load=m;var h=r.reallyExit,g=function(e){i(global.process)&&(r.exitCode=e||0,d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),h.call(r,r.exitCode))},_=r.emit,v=function(e,t){if(e===`exit`&&i(global.process)){t!==void 0&&(r.exitCode=t);var n=_.apply(this,arguments);return d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),n}return _.apply(this,arguments)}}})),qAe=i(((e,t)=>{let n=Symbol();function r(e,t,r){let i=t[n];if(i)return t.stat(e,(e,t)=>{if(e)return r(e);r(null,t.mtime,i)});let a=new Date(Math.ceil(Date.now()/1e3)*1e3+5);t.utimes(e,a,a,i=>{if(i)return r(i);t.stat(e,(e,i)=>{if(e)return r(e);let a=i.mtime.getTime()%1e3==0?`s`:`ms`;Object.defineProperty(t,n,{value:a}),r(null,i.mtime,a)})})}function i(e){let t=Date.now();return e===`s`&&(t=Math.ceil(t/1e3)*1e3),new Date(t)}t.exports.probe=r,t.exports.getMtime=i})),JAe=i(((e,n)=>{let r=t(`path`),i=q7(),a=WAe(),o=KAe(),s=qAe(),c={};function l(e,t){return t.lockfilePath||`${e}.lock`}function u(e,t,n){if(!t.realpath)return n(null,r.resolve(e));t.fs.realpath(e,n)}function d(e,t,n){let r=l(e,t);t.fs.mkdir(r,i=>{if(!i)return s.probe(r,t.fs,(e,i,a)=>{if(e)return t.fs.rmdir(r,()=>{}),n(e);n(null,i,a)});if(i.code!==`EEXIST`)return n(i);if(t.stale<=0)return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));t.fs.stat(r,(r,i)=>{if(r)return r.code===`ENOENT`?d(e,{...t,stale:0},n):n(r);if(!f(i,t))return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));p(e,t,r=>{if(r)return n(r);d(e,{...t,stale:0},n)})})})}function f(e,t){return e.mtime.getTime()<Date.now()-t.stale}function p(e,t,n){t.fs.rmdir(l(e,t),e=>{if(e&&e.code!==`ENOENT`)return n(e);n()})}function m(e,t){let n=c[e];n.updateTimeout||(n.updateDelay=n.updateDelay||t.update,n.updateTimeout=setTimeout(()=>{n.updateTimeout=null,t.fs.stat(n.lockfilePath,(r,i)=>{let a=n.lastUpdate+t.stale<Date.now();if(r)return r.code===`ENOENT`||a?h(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,m(e,t));if(n.mtime.getTime()!==i.mtime.getTime())return h(e,n,Object.assign(Error(`Unable to update lock within the stale threshold`),{code:`ECOMPROMISED`}));let o=s.getMtime(n.mtimePrecision);t.fs.utimes(n.lockfilePath,o,o,r=>{let i=n.lastUpdate+t.stale<Date.now();if(!n.released){if(r)return r.code===`ENOENT`||i?h(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,m(e,t));n.mtime=o,n.lastUpdate=Date.now(),n.updateDelay=null,m(e,t)}})})},n.updateDelay),n.updateTimeout.unref&&n.updateTimeout.unref())}function h(e,t,n){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),c[e]===t&&delete c[e],t.options.onCompromised(n)}function g(e,t,n){t={stale:1e4,update:null,realpath:!0,retries:0,fs:i,onCompromised:e=>{throw e},...t},t.retries=t.retries||0,t.retries=typeof t.retries==`number`?{retries:t.retries}:t.retries,t.stale=Math.max(t.stale||0,2e3),t.update=t.update==null?t.stale/2:t.update||0,t.update=Math.max(Math.min(t.update,t.stale/2),1e3),u(e,t,(e,r)=>{if(e)return n(e);let i=a.operation(t.retries);i.attempt(()=>{d(r,t,(e,a,o)=>{if(i.retry(e))return;if(e)return n(i.mainError());let s=c[r]={lockfilePath:l(r,t),mtime:a,mtimePrecision:o,options:t,lastUpdate:Date.now()};m(r,t),n(null,e=>{if(s.released)return e&&e(Object.assign(Error(`Lock is already released`),{code:`ERELEASED`}));_(r,{...t,realpath:!1},e)})})})})}function _(e,t,n){t={fs:i,realpath:!0,...t},u(e,t,(e,r)=>{if(e)return n(e);let i=c[r];if(!i)return n(Object.assign(Error(`Lock is not acquired/owned by you`),{code:`ENOTACQUIRED`}));i.updateTimeout&&clearTimeout(i.updateTimeout),i.released=!0,delete c[r],p(r,t,n)})}function v(e,t,n){t={stale:1e4,realpath:!0,fs:i,...t},t.stale=Math.max(t.stale||0,2e3),u(e,t,(e,r)=>{if(e)return n(e);t.fs.stat(l(r,t),(e,r)=>e?e.code===`ENOENT`?n(null,!1):n(e):n(null,!f(r,t)))})}function y(){return c}o(()=>{for(let e in c){let t=c[e].options;try{t.fs.rmdirSync(l(e,t))}catch{}}}),n.exports.lock=g,n.exports.unlock=_,n.exports.check=v,n.exports.getLocks=y})),YAe=i(((e,t)=>{let n=q7();function r(e){let t=[`mkdir`,`realpath`,`stat`,`rmdir`,`utimes`],n={...e};return t.forEach(t=>{n[t]=(...n)=>{let r=n.pop(),i;try{i=e[`${t}Sync`](...n)}catch(e){return r(e)}r(null,i)}}),n}function i(e){return(...t)=>new Promise((n,r)=>{t.push((e,t)=>{e?r(e):n(t)}),e(...t)})}function a(e){return(...t)=>{let n,r;if(t.push((e,t)=>{n=e,r=t}),e(...t),n)throw n;return r}}function o(e){if(e={...e},e.fs=r(e.fs||n),typeof e.retries==`number`&&e.retries>0||e.retries&&typeof e.retries.retries==`number`&&e.retries.retries>0)throw Object.assign(Error(`Cannot use retries with the sync api`),{code:`ESYNC`});return e}t.exports={toPromise:i,toSync:a,toSyncOptions:o}})),J7=e(i(((e,t)=>{let n=JAe(),{toPromise:r,toSync:i,toSyncOptions:a}=YAe();async function o(e,t){let i=await r(n.lock)(e,t);return r(i)}function s(e,t){let r=i(n.lock)(e,a(t));return i(r)}function c(e,t){return r(n.unlock)(e,t)}function l(e,t){return i(n.unlock)(e,a(t))}function u(e,t){return r(n.check)(e,t)}function d(e,t){return i(n.check)(e,a(t))}t.exports=o,t.exports.lock=o,t.exports.unlock=c,t.exports.lockSync=s,t.exports.unlockSync=l,t.exports.check=u,t.exports.checkSync=d}))(),1);const Y7=5e3;function X7(e,t,n){if(!(e instanceof Error)||!(`code`in e)||e.code!==`ELOCKED`)throw e;let r=t-performance.now();if(r<=0)throw Object.assign(Error(`Could not acquire Pi trust lock at ${n}.lock within ${Y7}ms`,{cause:e}),{code:`ELOCKED`});return Math.min(25,r)}function Z7(e,t){}function Q7(e,t){if(e.length===0)return;if(e.length===1)throw e[0];let[n,r]=e,i=n instanceof Error?n.message:String(n),a=r instanceof Error?r.message:String(r);throw AggregateError(e,`Pi trust update failed: ${i}\nReleasing Pi trust lock ${t}.lock also failed: ${a}`)}async function XAe(e,t,n){await Il(`${t}.ok.lock`,async()=>{let t=performance.now()+Y7,r;for(;;)try{r=await J7.default.lock(M(e),{realpath:!1,lockfilePath:`${e}.lock`});break}catch(n){await ze(X7(n,t,e))}let i=[];try{n()}catch(e){i.push(e)}finally{try{await r()}catch(e){i.push(e)}}Q7(i,e)},{onWarn:Z7})}function ZAe(e,t,n){Rl(`${t}.ok.lock`,()=>{let t=performance.now()+Y7,r=new Int32Array(new SharedArrayBuffer(4)),i;for(;;)try{i=J7.default.lockSync(M(e),{realpath:!1,lockfilePath:`${e}.lock`});break}catch(n){Atomics.wait(r,0,0,X7(n,t,e))}let a=[];try{n()}catch(e){a.push(e)}finally{try{i()}catch(e){a.push(e)}}Q7(a,e)},{onWarn:Z7})}const QAe=[`settings.json`,`prompts`,`themes`,`SYSTEM.md`,`APPEND_SYSTEM.md`];var $7=class extends Error{name=`PiResourceInspectionError`};function e9(e){let t;try{t=_(e)}catch(e){if(e.code===`ENOENT`)return!1;throw e}let n;try{n=te(e)}catch(e){throw t.isSymbolicLink()&&e.code===`ENOENT`?new $7(r7(`missing-symlink-target`),{cause:e}):e}return d(e,p.R_OK|(n.isDirectory()?p.X_OK:0)),!0}function $Ae(e){return e===`open-knowledge`||e.startsWith(`open-knowledge-`)}function eje(e,t,n){let r=e;try{let i=E(e),a;r=t;try{a=E(t)}catch(e){if(e.code!==`ENOENT`)throw e;a=be(t)}let o=N(a,`.agents`,`skills`),s=[];for(let e of QAe)r=N(i,`.pi`,e),e9(r)&&s.push(r);if(r=N(i,`.pi`,`extensions`),e9(r))for(let t of w(r).sort()){let i=N(r,t);be(n)!==N(be(e),`.pi`,`extensions`,t)&&s.push(i)}for(let e of[N(i,`.pi`,`skills`),N(i,`.agents`,`skills`)])if(e!==o&&(r=e,e9(e)))for(let t of w(e).sort())$Ae(t)||s.push(N(e,t));let c=M(i);for(;c!==i;){r=N(c,`.agents`,`skills`),r!==o&&e9(r)&&s.push(r);let e=M(c);if(e===c)break;c=e}return s.length===0?{kind:`none`}:{kind:`shared`,paths:s.sort()}}catch(e){return{kind:`unreadable`,error:`Could not inspect Pi project resources at ${N7(r)}: ${e instanceof $7?e.message:r7(n7(e))}`}}}function t9(e){let t;try{t=_(e).isSymbolicLink()}catch(e){return e.code===`ENOENT`?{kind:`not-present`}:{kind:`declined`,reason:n7(e)}}let n=G5(e);if(n.readPath===null)return{kind:`declined`,reason:`unresolved-symlink`};try{if(!te(n.readPath).isFile())return{kind:`declined`,reason:`not-a-file`}}catch(e){return{kind:`declined`,reason:t&&e.code===`ENOENT`?`missing-symlink-target`:n7(e)}}return{kind:`ready`,path:n.writePath,symlink:t}}function n9(e,t,n){let r=be(e),i=EX({home:t,env:n??(t===void 0?process.env:{})});return{cwd:r,bridgePath:OX.pi.projectConfigPath(r),trustPath:N(i,`trust.json`)}}function r9(e){try{let t=E(e);return te(t).isDirectory()?(d(t,p.X_OK),{kind:`ready`,project:{path:e,canonical:t}}):{kind:`refused`,error:`Pi project path ${N7(e)} is not a directory; restore the intended project directory, then retry`}}catch(t){return{kind:`refused`,error:`Pi project directory ${N7(e)} could not be resolved or accessed: ${N7(t instanceof Error?t.message:String(t))}; restore the directory or symlink and check its permissions, then retry`}}}function i9(e){let t=r9(e.path);if(t.kind===`refused`)return t.error;if(t.project.canonical!==e.canonical)return`Pi project path ${N7(e.path)} changed while waiting for its trust lock; restore the intended project location, then retry`}function a9(e,t,n){let r=y7(OX.pi,e,n,t);if(r.kind===`absent`)return{state:`absent`,text:null};if(r.kind!==`present`)return{state:`unreadable`,text:null};let i=r.entry,a=Array.isArray(i.args)&&typeof i.args[0]==`string`?i.args[0]:null;return cX(i)?{state:`own-current`,text:a}:P5(i)?{state:`own-stale`,text:a}:{state:`foreign`,text:a}}function o9(e,t){let n;try{n=S(e.path,`utf-8`)}catch(t){let n=t.code;return e.kind===`missing`&&n===`ENOENT`?{state:`untrusted`,entries:{},trailingNewline:!1}:{state:`unreadable`,reason:n7(t)}}if(n.trim()===``)return{state:`untrusted`,entries:{},trailingNewline:!1};let r;try{r=JSON.parse(n)}catch{return{state:`unreadable`,reason:`invalid-json`}}return WY(r)?{state:r[t]===!0?`trusted`:`untrusted`,entries:r,trailingNewline:n.endsWith(`
|
|
1518
|
-
`)}:{state:`unreadable`,reason:`invalid-json`}}function
|
|
1519
|
-
`:``),f=a7(s.path);Pl(s.path,d,f===void 0?void 0:{mode:f}),d9(n,()=>
|
|
1517
|
+
`));let _=`${s?``:``}${m}`;return _!==o&&Pl(e,_,{mode:a7(e)}),a&&_===o?{kind:`unchanged`}:{kind:d?`overwritten`:`written`}}const pAe=`open-knowledge-ui`;function m7(e,t,n){try{let r=e.detectPath?.(t,n)??M(e.configPath(t,n));return g(r)}catch{return!1}}function h7(e,t,n){try{let r=be(M(e.configPath(t,n))),i=be(e.detectPath?.(t,n)??r);return i===r||r.startsWith(i+xe)}catch{return!1}}function g7(e,t,n,r,i){let a=e.serverName(t),o;try{o=i??e.configPath(t,r)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:``,serverName:a,error:t instanceof Error?t.message:String(t)}}let s=n.pruneOnly===!0;if(s&&(e.format===`file`||!g(o)))return{editorId:e.id,label:e.label,action:`skipped-flag`,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}};let c=!n.skipAvailabilityCheck||e.offerOnlyWhenDetected===!0||h7(e,t,r);if(!i&&c&&!m7(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{L5(o,t)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),configScope:`project`}}if(e.format===`file`)return hAe(e,o,a,n,{isProjectScope:i!==void 0});let l;try{l=e.buildEntry(t,n)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}try{s||v(M(o),{recursive:!0})}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}let u={action:`written`},d;try{Rl(`${o}.lock`,()=>{let t=G5(o).writePath;if(s||v(M(t),{recursive:!0}),e.format===`toml`){let r=lAe(XY(),t,e.topLevelKey,a,l,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason);return}if(e.format===`yaml`){let r=fAe(t,e.topLevelKey,a,l,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason);return}let r=cAe(t,e.topLevelKey,a,l,e.serverMapSubKey,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason)},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){d=e instanceof Error?e:Error(String(e))}return d?{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:d.message,...i===void 0?{}:{configScope:`project`}}:u.action===`declined`?{editorId:e.id,label:e.label,action:`declined`,configPath:o,serverName:a,declineReason:u.declineReason,...i===void 0?{}:{configScope:`project`}}:{editorId:e.id,label:e.label,action:u.action===`unchanged`?`skipped-flag`:u.action,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}const mAe={pi:F5};function hAe(e,t,n,r,i){let a=i.isProjectScope?{configScope:`project`}:{},o=r=>({editorId:e.id,label:e.label,action:`failed`,configPath:t,serverName:n,error:r instanceof Error?r.message:String(r),...a}),s=mAe[e.id];if(!s)return o(Error(`No managed-file builder registered for editor "${e.id}" (format: 'file' targets need a MANAGED_FILE_BUILDERS entry).`));let c;try{c=s(r)}catch(e){return o(e)}try{v(M(t),{recursive:!0})}catch(e){return o(e)}let l={action:`written`};try{Rl(`${t}.lock`,()=>{let e=null;try{e=S(t,`utf-8`)}catch{e=null}if(e===c){l.action=`overwritten`;return}Pl(t,c,e===null?void 0:{mode:a7(t)}),l.action=e===null?`written`:`overwritten`},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){return o(e)}return{editorId:e.id,label:e.label,action:l.action,configPath:t,serverName:n,...a}}async function gAe(e){let t=Gve(e.editors).filter(e=>e.scope===`global`),n={mode:`published`,skipAvailabilityCheck:!0,...e.replaceEntry===!0?{replaceEntry:!0}:{},...e.pruneOnly===!0?{pruneOnly:!0}:{}};return t.map(t=>g7(t,``,n,e.home))}function _7(e,t,n,r){let i=y7(e,t,n,r);return i.kind===`present`?i.entry:null}function v7(e,t,n,r){let i=p7(e,t,r);if(!WY(i))return{kind:`no-entry`};let a=i[n];return WY(a)?{kind:`present`,entry:a}:{kind:`no-entry`}}function y7(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!g(i))return{kind:`absent`};try{if(te(i).size>l7)return{kind:`decline`,reason:`oversize`}}catch(e){return{kind:`decline`,reason:n7(e)}}let a;try{a=S(i,`utf-8`)}catch(e){return{kind:`decline`,reason:n7(e)}}if(a.trim()===``)return{kind:`absent`};if(e.format===`file`)return{kind:`present`,entry:Mke(a)};let o=e.serverName(t);if(e.format===`toml`){let t;try{t=XY().parseToObject(a)}catch{return{kind:`decline`,reason:`unparseable`}}return v7(t,e.topLevelKey,o,e.serverMapSubKey)}if(e.format===`yaml`){let t=(0,cs.parseDocument)(a.charCodeAt(0)===65279?a.slice(1):a);return t.errors.length>0?{kind:`decline`,reason:`unparseable`}:v7(t.toJS()??{},e.topLevelKey,o,e.serverMapSubKey)}let s=o7(a);return s?s7(s,e.topLevelKey)>1?{kind:`decline`,reason:`duplicate-container`}:v7(f3(s),e.topLevelKey,o,e.serverMapSubKey):{kind:`decline`,reason:`unparseable`}}function _Ae(e,t){let n=[];for(let r of ZY)r!==`claude-desktop`&&m7(OX[r],e,t)&&n.push(r);return n}function b7(e){return e===`opencode`?Pve:Nve}function vAe(e,t,n){let r=OX[e],i=b7(e),a=[],o=r.projectConfigPath?.(t);o!==void 0&&a.push({scope:`project`,configPath:o});try{a.push({scope:`user`,configPath:r.configPath(t,n)})}catch{}for(let o of a){let a=_7(r,t,n,o.configPath);if(a!==null&&i(a))return{editorId:e,scope:o.scope,configPath:o.configPath}}return null}const x7=8192;function S7(e,t){if(e.outcome===`not-present`)return`not-present (no DiagnosticReports directory)`;if(e.outcome===`unreadable-directory`)return`unreadable (${e.directoryErrorCode??`unknown`} reading DiagnosticReports)`;let n=[`${e.windowDays}d`,`${e.foreignIgnored} other-process report(s) ignored`,`${e.unparseable} unparseable`];e.droppedOverCap>0&&n.push(`${e.droppedOverCap} older dropped over cap`);let r=e.files.length-t;return r>0&&n.push(`${r} vanished before staging`),e.outcome===`none-in-window`?`none found in window (${n.join(`; `)})`:`${t} collected (${n.join(`; `)})`}function yAe(e){return e.replace(/\\+\/?/g,e=>{if(!e.endsWith(`/`))return e;let t=e.length-1;return`${`\\`.repeat(t-t%2)}/`})}const bAe=RegExp(`("(?:${[`crashReporterKey`,`bootSessionUUID`,`deviceIdentifierForVendor`].join(`|`)})"\\s*:\\s*)"[^"]*"`,`g`);function xAe(e){return e.replace(bAe,`$1"[REDACTED-DEVICE-ID]"`)}function C7(e){return xAe(yAe(e))}const SAe=/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})(\.\d+)? ([+-]\d{2})(\d{2})$/;function CAe(e){if(typeof e!=`string`)return null;let t=SAe.exec(e.trim());if(t===null)return null;let[,n,r,i=``,a,o]=t,s=Date.parse(`${n}T${r}${i}${a}:${o}`);return Number.isNaN(s)?null:s}function wAe(e){let t=b(e,`r`);try{let e=Buffer.alloc(x7),n=0,r=!1;for(;n<x7;){let i=C(t,e,n,x7-n,n);if(i===0){r=!0;break}let a=n;n+=i;let o=e.subarray(0,n).indexOf(10,a);if(o!==-1)return e.subarray(0,o).toString(`utf-8`)}return r?e.subarray(0,n).toString(`utf-8`):null}finally{f(t)}}function TAe(e){try{let t=wAe(e);if(t===null)return{kind:`unreadable`};let n=JSON.parse(t);if(typeof n!=`object`||!n)return{kind:`unreadable`};let{name:r,app_name:i,timestamp:a}=n,o=typeof r==`string`?r:typeof i==`string`?i:null;return o===null?{kind:`unreadable`}:{kind:`named`,name:o,timestampMs:CAe(a)}}catch{return{kind:`unreadable`}}}function EAe(e){return e===`OpenKnowledge`||e.startsWith(`OpenKnowledge `)}function DAe(e,t){let n={files:[],foreignIgnored:0,unparseable:0,droppedOverCap:0,windowDays:7},r;try{r=w(e,{withFileTypes:!0})}catch(e){let t=e.code;return t===`ENOENT`?{...n,outcome:`not-present`}:{...n,outcome:`unreadable-directory`,directoryErrorCode:t??`unknown`}}let i=t.getTime()-6048e5,a=[],o=0,s=0;for(let t of r){if(!t.isFile()||!t.name.endsWith(`.ips`))continue;let n=N(e,t.name),r;try{r=te(n).mtimeMs}catch{continue}if(r<i)continue;let c=TAe(n),l=c.kind===`named`&&c.timestampMs!==null?c.timestampMs:r;if(c.kind===`unreadable`){s+=1;continue}if(!EAe(c.name)){o+=1;continue}a.push({path:n,atMs:l})}a.sort((e,t)=>t.atMs-e.atMs);let c=a.slice(0,25),l={foreignIgnored:o,unparseable:s,droppedOverCap:a.length-c.length,windowDays:7};return c.length===0?{...l,files:[],outcome:`none-in-window`}:{...l,files:c.map(e=>e.path),outcome:`collected`}}const OAe=eu.stable.appId;eu.stable,eu.beta;function w7(){return N(k(),`.ok`,`bug-reports`)}function kAe(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=w7(),r=`${t}-bugreport`,i=N(n,`${r}.zip`);for(let e=2;g(i);e+=1)i=N(n,`${r}-${e}.zip`);return i}function T7(e,t){let{scrubbed:n}=e;return n!==void 0&&n.patterns.length>0?{file:t,lineCount:n.lineCount,patterns:[...n.patterns]}:null}function E7(e,t){let n=N(e,`.ok`,`config.yml`);if(g(n))try{let e=S(n,`utf8`).match(/^\s*name:\s*['"]?(.+?)['"]?\s*$/m);if(e?.[1])return e[1]}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml for project slug; using path-hash fallback`)}return g(N(e,`.ok`))?De(`sha256`).update(be(e)).digest(`hex`).slice(0,12):null}function AAe(){let e={timestamp:new Date().toISOString(),platform:le(),osType:de(),osRelease:ue(),hostname:`[redacted]`,uptime:fe(),freeMem:se(),totalMem:j(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=c(`sw_vers -productVersion 2>/dev/null`,F8({encoding:`utf8`})).trim()}catch{}try{let t=N(__dirname,`..`,`..`,`package.json`);g(t)&&(e.okVersion=JSON.parse(S(t,`utf8`)).version)}catch{}return e}const jAe=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function D7(e){let t=me(e);return jAe.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function MAe(e,t){return A7(e,t).files}const NAe=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function O7(e,t=OAe){let n=N(e,`${t}.ShipIt`);if(!g(n))return[];let r;try{r=w(n)}catch{return[]}return NAe.flatMap(e=>r.map(t=>{if(t===e)return{entry:t,suffix:-1};if(!t.startsWith(`${e}.`))return null;let n=t.slice(e.length+1);return/^\d+$/.test(n)?{entry:t,suffix:Number(n)}:null}).filter(e=>e!==null).sort((e,t)=>e.suffix-t.suffix).slice(0,4).map(e=>N(n,e.entry)))}function k7(e){if(!g(e))return[];try{let t=new Map;for(let n of w(e).filter(e=>e.endsWith(`.yaml`)).sort()){let e=n.endsWith(`.sent.yaml`)?n.slice(0,-10):n.slice(0,-5),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}return[...t.values()].slice(-25).flat().map(t=>N(e,t))}catch{return[]}}function A7(e,t){if(!g(t))return{files:[],excludedByProjectSlug:0};let n=w(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>N(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(D7),i=[],a=r.filter(t=>{try{return S(t,`utf8`).includes(`"project":"${e}"`)}catch{return i.push(t),!1}});if(a.length===0)return{files:n,excludedByProjectSlug:0};let o=new Set([...a,...i]);return{files:n.filter(e=>!D7(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function PAe(e){let t=N(e,`.ok`,`local`);return g(t)?{files:[`server.lock`,`last-spawn-error.log`,ll,sl].map(e=>N(t,e)).filter(e=>g(e))}:{files:[]}}function FAe(e){let t=N(e,`.ok`,`local`,`logs`);return g(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>N(t,e)).filter(e=>g(e))}:{files:[]}}function IAe(e){let t=0,n=new Map,r=e.replace(/("(?:docName|doc\.name|documentName)"\s*:\s*")((?:[^"\\]|\\.)*)"/g,(e,r,i)=>{t+=1;let a=n.get(i);return a===void 0&&(a=`doc#${De(`sha256`).update(i).digest(`hex`).slice(0,12)}`,n.set(i,a)),`${r}${a}"`});for(let[e,i]of[...n].sort(([e],[t])=>t.length-e.length)){if(e.length===0||!r.includes(e))continue;let n=r.split(e);t+=n.length-1,r=n.join(i)}return{text:r,count:t}}function j7(e){let t=e.revealDocNames?e.content:IAe(e.content).text;if(e.redact){let{redacted:n,patterns:r,lineCount:i}=dV(t);e.zipfile.addBuffer(Buffer.from(n,`utf8`),e.name),e.bundleFiles.push(e.name),r.length>0&&e.redactions.push({file:e.name,lineCount:i,patterns:r})}else e.zipfile.addBuffer(Buffer.from(t,`utf8`),e.name),e.bundleFiles.push(e.name)}function M7(e){for(let t of e.files)try{let n=S(t,`utf8`);j7({zipfile:e.zipfile,name:`${e.prefix}/${me(t)}`,content:t.endsWith(`.ips`)?C7(n):n,redact:e.redact,revealDocNames:e.revealDocNames,bundleFiles:e.bundleFiles,redactions:e.redactions})}catch(n){e.logger?.warn({file:t,prefix:e.prefix,err:n},`bug-report: skipped unreadable file`)}}async function LAe(t){let{redact:n,outputPath:r,logger:i}=t,a=t.revealDocNames??!1,o=t.userLogsDir??N(k(),`.ok`,`logs`),s=t.projectDir?E7(t.projectDir,i):null;v(M(r),{recursive:!0}),i?.info({projectSlug:s},`gathering diagnostic data`);let c=AAe();c.desktop=t.desktop??null,c.language=t.language??null;let{files:l,excludedByProjectSlug:u}=A7(s,o),{files:d}=t.projectDir?PAe(t.projectDir):{files:[]},{files:f}=t.projectDir?FAe(t.projectDir):{files:[]},p=t.shipItLogFiles??[],m=t.diagnosticReports?.files??[];i?.info({logFileCount:l.length,logFilesExcludedByProjectSlug:u,lockFileCount:d.length,localSinkFileCount:f.length,shipItLogFileCount:p.length,diagnosticReportCount:m.length},`files collected`);let g=[],_=[],{ZipFile:y}=await Promise.resolve().then(()=>e(q4(),1)),b=new y;M7({zipfile:b,files:[...l,...p],prefix:`logs`,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i}),M7({zipfile:b,files:d,prefix:`lockdir`,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i}),M7({zipfile:b,files:f,prefix:`local-logs`,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i}),M7({zipfile:b,files:t.bugReportLedgerFiles??[],prefix:NR,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i}),M7({zipfile:b,files:m,prefix:`diagnostic-reports`,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i});for(let e of t.extraFiles??[])try{let t=S(e.sourcePath),n=`extra/${e.zipName??me(e.sourcePath)}`;b.addBuffer(t,n),_.push(n);let r=T7(e,n);r!==null&&g.push(r)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&j7({zipfile:b,name:`note.txt`,content:t.note,redact:n,revealDocNames:a,bundleFiles:_,redactions:g});let x=new Set(m.map(e=>`diagnostic-reports/${me(e)}`)),C=_.filter(e=>x.has(e)),w=t.diagnosticReports===void 0?`not-collected (no collection attempted)`:S7(t.diagnosticReports,C.length);b.addBuffer(Buffer.from(`${w}\n`,`utf8`),`state/diagnostic-reports-status.txt`),_.push(`state/diagnostic-reports-status.txt`);let T=JSON.stringify(c,null,2);b.addBuffer(Buffer.from(T,`utf8`),`sysinfo.json`),_.push(`sysinfo.json`);let E={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:s,files:_,redactions:g,sysinfo:c};b.addBuffer(Buffer.from(JSON.stringify(E,null,2),`utf8`),`MANIFEST.json`);let D=g.reduce((e,t)=>e+t.lineCount,0),O=new Set(p.map(e=>`logs/${me(e)}`)),ee=_.filter(e=>O.has(e)),te=new Set((t.bugReportLedgerFiles??[]).map(e=>`${NR}/${me(e)}`)),ne=_.filter(e=>te.has(e)),re=s?_.filter(e=>e.startsWith(`logs/`)&&!D7(e)&&!O.has(e)):[],ie=C.length>0?[`Crash reports under diagnostic-reports/ are rewritten on the way in,`,`independently of this setting: escaped path separators are normalised`,`so the scrub above can read them, and the identifiers that link this`,`machine's bundles to each other are replaced. Nothing else is changed;`,`they are not byte-identical to the files macOS wrote.`]:[],ae=ie.length>0?[`Redaction was disabled for this bundle; file contents are unmodified,`,`with one exception.`,...ie]:[`Redaction was disabled for this bundle; file contents are unmodified.`],oe=[`# Bug Report Bundle`,``,`Generated: ${E.generatedAt}`,`Project: ${s??`(unscoped)`}`,`Discipline version: ${E.disciplineVersion}`,``,`## Contents`,``,..._.map(e=>`- ${e}`),``,`## Privacy`,``,...re.length>0?[`Scope: some collected logs are user-wide rather than project-scoped.`,`These are written once per machine per day and can contain activity`,`from other projects open on this machine, including captured console`,`output:`,...re.map(e=>`- ${e}`),``]:[],...ee.length>0?[`Installer logs: written by the macOS update helper rather than by`,`OpenKnowledge itself, and machine-wide rather than scoped to any one`,`project. They record the install and update history of this app on`,`this machine. Only this app is collected, never other applications`,`that use the same update mechanism:`,...ee.map(e=>`- ${e}`),``]:[],...C.length>0?[`Crash reports: written by macOS itself rather than by OpenKnowledge,`,`and machine-wide rather than scoped to any one project. They record`,`why the operating system ended a process of this app — the signal or`,`exception, the code-signing verdict, and whatever text the process`,`left behind as it died. They also carry machine details the OS puts`,`in every report: the account uid, the Mac model, and the name of the`,`process that launched this app, which on a managed machine can be`,`internal tooling. The identifiers that would link this machine's`,`bundles to each other are replaced before bundling. Only this`,`app's own reports are collected, never another application's, though`,`a report of ours still names the processes it ran alongside:`,...C.map(e=>`- ${e}`),``]:[],...ne.length>0?[`Send history: a small record for each bug report previously generated`,`on this machine — when it was generated, whether sending it`,`succeeded, and why it failed if it did. This is what makes a failed`,`send diagnosable at all. It is machine-wide rather than scoped to`,`this project, so it names the other projects reports were filed`,`from. It carries no document content:`,...ne.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${uV.join(`, `)}`,D>0?`${D} line(s) were scrubbed across ${g.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,...ie,``,`This bundle is safe to attach to a GitHub issue.`]:ae].join(`
|
|
1518
|
+
`);b.addBuffer(Buffer.from(oe,`utf8`),`README.md`),b.end();let se=h(r);return b.outputStream.pipe(se),await new Promise((e,t)=>{se.on(`close`,e),se.on(`error`,t)}),i?.info({bundlePath:r,fileCount:_.length,redactionCount:D},`bundle written`),{zipPath:r,summary:{projectSlug:s,files:_,redactions:g,redactedLineCount:D,generatedAt:E.generatedAt}}}function N7(e){return e.replace(/[\p{Cc}\p{Zl}\p{Zp}\p{Bidi_Control}\u200b\ufeff]/gu,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`)}function P7(e){return De(`sha256`).update(e).digest(`hex`)}function F7(e){return N(be(e),`.ok`,`pi-trust`)}function I7(e,t){return N(F7(e),P7(be(t)))}function L7(e,t,n){return N(I7(e,t),`${P7(n)}.json`)}var R7=class extends Error{constructor(e,t,n,r){super(`Pi trust receipt at ${N7(e)} ${N7(t)}; ${N7(n)}`,{cause:r}),this.name=`PiTrustReceiptError`}};function z7(e,t,n){let r=n.code,i=n instanceof Error?n.message:String(n),a;switch(r){case`EACCES`:case`EPERM`:a=`check receipt and parent-directory permissions, then retry`;break;case`ENOENT`:a=`the location no longer exists; restore access to its expected location, then retry`;break;default:a=`check the path and available storage, then retry`}return new R7(e,`could not ${t}: ${i}`,a,n)}function B7(e){let t;try{t=_(e)}catch(t){if(t.code===`ENOENT`)return!1;throw z7(e,`be inspected`,t)}if(!t.isDirectory())throw new R7(e,`is not a regular directory`,`restore the intended receipt directory without a symlink, then retry`);return!0}function V7(e,t){return Object.keys(e).length===t.length&&t.every(t=>Object.hasOwn(e,t))}function H7(e,t){if(!WY(e)||!V7(e,[`version`,`cwd`,`configuredTrustPath`,`canonicalTrustPath`,`state`,`previous`])||e.version!==1||typeof e.cwd!=`string`||e.cwd!==be(e.cwd)||typeof e.configuredTrustPath!=`string`||e.configuredTrustPath!==be(e.configuredTrustPath)||typeof e.canonicalTrustPath!=`string`||e.canonicalTrustPath!==be(e.canonicalTrustPath)||e.state!==`pending`&&e.state!==`committed`||!WY(e.previous))throw new R7(t,`has invalid contents`,`restore a valid ownership record from a backup without guessing its trust decision, then retry`);let n;if(e.previous.present===!1&&V7(e.previous,[`present`]))n={present:!1};else if(e.previous.present===!0&&V7(e.previous,[`present`,`value`]))n={present:!0,value:e.previous.value};else throw new R7(t,`has an invalid previous decision`,`restore the recorded previous decision from a backup without guessing its value, then retry`);return{version:1,cwd:e.cwd,configuredTrustPath:e.configuredTrustPath,canonicalTrustPath:e.canonicalTrustPath,state:e.state,previous:n}}function U7(e,t,n){let r;try{r=_(n)}catch(e){throw z7(n,`be inspected`,e)}if(!r.isFile())throw new R7(n,`is not a regular file`,`restore the intended receipt as a regular file without a symlink, then retry`);let i;try{i=S(n,`utf8`)}catch(e){throw z7(n,`be read`,e)}let a;try{a=JSON.parse(i)}catch(e){throw new R7(n,`is not valid JSON`,`repair its JSON syntax without changing the recorded decision, then retry`,e)}let o=H7(a,n);if(o.cwd!==be(t)||n!==L7(e,t,o.canonicalTrustPath))throw new R7(n,`does not match its project or trust-store location`,`restore the ownership record to its original project and trust-store location, then retry`);return{path:n,record:o}}function W7(e,t){let{record:n,path:r}=t;for(let t of[F7(e),I7(e,n.cwd)])if(!B7(t))throw new R7(t,`no longer exists`,`restore access to the expected receipt directory, then retry`);let i=U7(e,n.cwd,r);if(!Me(i.record,n))throw new R7(r,`changed while its trust decision was being updated`,`retry to read its current ownership record`);return i}function RAe(e,t,n,r,i){let a={version:1,cwd:be(t),configuredTrustPath:be(n),canonicalTrustPath:be(r),state:`pending`,previous:i},o=L7(e,a.cwd,a.canonicalTrustPath),s=`${JSON.stringify(a,null,2)}\n`;if(!Me(H7(JSON.parse(s),o),a))throw new R7(o,`cannot preserve the previous decision as JSON`,`provide the original decision as a JSON value before retrying`);B7(F7(e)),B7(M(o));try{v(M(o),{recursive:!0,mode:448})}catch(e){throw z7(M(o),`be created`,e)}let c;try{c=_(o,{throwIfNoEntry:!1})}catch(e){throw z7(o,`be inspected`,e)}if(c)throw new R7(o,`already exists`,`reconcile the existing ownership record before recording another grant`);try{Pl(o,s,{mode:384})}catch(e){throw z7(o,`be written`,e)}return{path:o,record:a}}function zAe(e,t){let n=W7(e,t);if(n.record.state!==`pending`)throw new R7(n.path,`is already committed`,`use the current ownership record without committing it again`);let r={...n.record,state:`committed`};try{Pl(n.path,`${JSON.stringify(r,null,2)}\n`,{mode:384})}catch(e){throw z7(n.path,`be committed`,e)}return{path:n.path,record:r}}function G7(e,t){if(!B7(F7(e)))return[];let n=I7(e,t);if(!B7(n))return[];let r;try{r=w(n).sort()}catch(e){throw z7(n,`be listed`,e)}return r.filter(e=>/^[a-f0-9]{64}\.json$/.test(e)).map(r=>U7(e,t,N(n,r)))}function K7(e,t){let n=W7(e,t);try{ne(n.path)}catch(e){throw z7(n.path,`be removed after reconciling its grant`,e)}for(let t of[M(n.path),F7(e)])try{ee(t)}catch(e){let n=e.code;if(n!==`ENOTEMPTY`&&n!==`EEXIST`&&n!==`ENOENT`)throw z7(t,`be removed after reconciling its grant`,e)}}var BAe=i(((e,n)=>{var r=t(`constants`),i=process.cwd,a=null,o=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return a||=i.call(process),a};try{process.cwd()}catch{}if(typeof process.chdir==`function`){var s=process.chdir;process.chdir=function(e){a=null,s.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,s)}n.exports=c;function c(e){r.hasOwnProperty(`O_SYMLINK`)&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&t(e),e.lutimes||n(e),e.chown=s(e.chown),e.fchown=s(e.fchown),e.lchown=s(e.lchown),e.chmod=i(e.chmod),e.fchmod=i(e.fchmod),e.lchmod=i(e.lchmod),e.chownSync=c(e.chownSync),e.fchownSync=c(e.fchownSync),e.lchownSync=c(e.lchownSync),e.chmodSync=a(e.chmodSync),e.fchmodSync=a(e.fchmodSync),e.lchmodSync=a(e.lchmodSync),e.stat=l(e.stat),e.fstat=l(e.fstat),e.lstat=l(e.lstat),e.statSync=u(e.statSync),e.fstatSync=u(e.fstatSync),e.lstatSync=u(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(e,t,n){n&&process.nextTick(n)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(e,t,n,r){r&&process.nextTick(r)},e.lchownSync=function(){}),o===`win32`&&(e.rename=typeof e.rename==`function`?(function(t){function n(n,r,i){var a=Date.now(),o=0;t(n,r,function s(c){if(c&&(c.code===`EACCES`||c.code===`EPERM`||c.code===`EBUSY`)&&Date.now()-a<6e4){setTimeout(function(){e.stat(r,function(e,a){e&&e.code===`ENOENT`?t(n,r,s):i(c)})},o),o<100&&(o+=10);return}i&&i(c)})}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n})(e.rename):e.rename),e.read=typeof e.read==`function`?(function(t){function n(n,r,i,a,o,s){var c;if(s&&typeof s==`function`){var l=0;c=function(u,d,f){if(u&&u.code===`EAGAIN`&&l<10)return l++,t.call(e,n,r,i,a,o,c);s.apply(this,arguments)}}return t.call(e,n,r,i,a,o,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n})(e.read):e.read,e.readSync=typeof e.readSync==`function`?(function(t){return function(n,r,i,a,o){for(var s=0;;)try{return t.call(e,n,r,i,a,o)}catch(e){if(e.code===`EAGAIN`&&s<10){s++;continue}throw e}}})(e.readSync):e.readSync;function t(e){e.lchmod=function(t,n,i){e.open(t,r.O_WRONLY|r.O_SYMLINK,n,function(t,r){if(t){i&&i(t);return}e.fchmod(r,n,function(t){e.close(r,function(e){i&&i(t||e)})})})},e.lchmodSync=function(t,n){var i=e.openSync(t,r.O_WRONLY|r.O_SYMLINK,n),a=!0,o;try{o=e.fchmodSync(i,n),a=!1}finally{if(a)try{e.closeSync(i)}catch{}else e.closeSync(i)}return o}}function n(e){r.hasOwnProperty(`O_SYMLINK`)&&e.futimes?(e.lutimes=function(t,n,i,a){e.open(t,r.O_SYMLINK,function(t,r){if(t){a&&a(t);return}e.futimes(r,n,i,function(t){e.close(r,function(e){a&&a(t||e)})})})},e.lutimesSync=function(t,n,i){var a=e.openSync(t,r.O_SYMLINK),o,s=!0;try{o=e.futimesSync(a,n,i),s=!1}finally{if(s)try{e.closeSync(a)}catch{}else e.closeSync(a)}return o}):e.futimes&&(e.lutimes=function(e,t,n,r){r&&process.nextTick(r)},e.lutimesSync=function(){})}function i(t){return t&&function(n,r,i){return t.call(e,n,r,function(e){d(e)&&(e=null),i&&i.apply(this,arguments)})}}function a(t){return t&&function(n,r){try{return t.call(e,n,r)}catch(e){if(!d(e))throw e}}}function s(t){return t&&function(n,r,i,a){return t.call(e,n,r,i,function(e){d(e)&&(e=null),a&&a.apply(this,arguments)})}}function c(t){return t&&function(n,r,i){try{return t.call(e,n,r,i)}catch(e){if(!d(e))throw e}}}function l(t){return t&&function(n,r,i){typeof r==`function`&&(i=r,r=null);function a(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),i&&i.apply(this,arguments)}return r?t.call(e,n,r,a):t.call(e,n,a)}}function u(t){return t&&function(n,r){var i=r?t.call(e,n,r):t.call(e,n);return i&&(i.uid<0&&(i.uid+=4294967296),i.gid<0&&(i.gid+=4294967296)),i}}function d(e){return!e||e.code===`ENOSYS`||(!process.getuid||process.getuid()!==0)&&(e.code===`EINVAL`||e.code===`EPERM`)}}})),VAe=i(((e,n)=>{var r=t(`stream`).Stream;n.exports=i;function i(e){return{ReadStream:t,WriteStream:n};function t(n,i){if(!(this instanceof t))return new t(n,i);r.call(this);var a=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags=`r`,this.mode=438,this.bufferSize=65536,i||={};for(var o=Object.keys(i),s=0,c=o.length;s<c;s++){var l=o[s];this[l]=i[l]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!=`number`)throw TypeError(`start must be a Number`);if(this.end===void 0)this.end=1/0;else if(typeof this.end!=`number`)throw TypeError(`end must be a Number`);if(this.start>this.end)throw Error(`start must be <= end`);this.pos=this.start}if(this.fd!==null){process.nextTick(function(){a._read()});return}e.open(this.path,this.flags,this.mode,function(e,t){if(e){a.emit(`error`,e),a.readable=!1;return}a.fd=t,a.emit(`open`,t),a._read()})}function n(t,i){if(!(this instanceof n))return new n(t,i);r.call(this),this.path=t,this.fd=null,this.writable=!0,this.flags=`w`,this.encoding=`binary`,this.mode=438,this.bytesWritten=0,i||={};for(var a=Object.keys(i),o=0,s=a.length;o<s;o++){var c=a[o];this[c]=i[c]}if(this.start!==void 0){if(typeof this.start!=`number`)throw TypeError(`start must be a Number`);if(this.start<0)throw Error(`start must be >= zero`);this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}})),HAe=i(((e,t)=>{t.exports=r;var n=Object.getPrototypeOf||function(e){return e.__proto__};function r(e){if(typeof e!=`object`||!e)return e;if(e instanceof Object)var t={__proto__:n(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}),t}})),q7=i(((e,n)=>{var r=t(`fs`),i=BAe(),a=VAe(),o=HAe(),s=t(`util`),c,l;typeof Symbol==`function`&&typeof Symbol.for==`function`?(c=Symbol.for(`graceful-fs.queue`),l=Symbol.for(`graceful-fs.previous`)):(c=`___graceful-fs.queue`,l=`___graceful-fs.previous`);function u(){}function d(e,t){Object.defineProperty(e,c,{get:function(){return t}})}var f=u;s.debuglog?f=s.debuglog(`gfs4`):/\bgfs4\b/i.test(process.env.NODE_DEBUG||``)&&(f=function(){var e=s.format.apply(s,arguments);e=`GFS4: `+e.split(/\n/).join(`
|
|
1519
|
+
GFS4: `),console.error(e)}),r[c]||(d(r,global[c]||[]),r.close=(function(e){function t(t,n){return e.call(r,t,function(e){e||g(),typeof n==`function`&&n.apply(this,arguments)})}return Object.defineProperty(t,l,{value:e}),t})(r.close),r.closeSync=(function(e){function t(t){e.apply(r,arguments),g()}return Object.defineProperty(t,l,{value:e}),t})(r.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||``)&&process.on(`exit`,function(){f(r[c]),t(`assert`).equal(r[c].length,0)})),global[c]||d(global,r[c]),n.exports=p(o(r)),process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!r.__patched&&(n.exports=p(r),r.__patched=!0);function p(e){i(e),e.gracefulify=p,e.createReadStream=T,e.createWriteStream=E;var t=e.readFile;e.readFile=n;function n(e,n,r){return typeof n==`function`&&(r=n,n=null),i(e,n,r);function i(e,n,r,a){return t(e,n,function(t){t&&(t.code===`EMFILE`||t.code===`ENFILE`)?m([i,[e,n,r],t,a||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}var r=e.writeFile;e.writeFile=o;function o(e,t,n,i){return typeof n==`function`&&(i=n,n=null),a(e,t,n,i);function a(e,t,n,i,o){return r(e,t,n,function(r){r&&(r.code===`EMFILE`||r.code===`ENFILE`)?m([a,[e,t,n,i],r,o||Date.now(),Date.now()]):typeof i==`function`&&i.apply(this,arguments)})}}var s=e.appendFile;s&&(e.appendFile=c);function c(e,t,n,r){return typeof n==`function`&&(r=n,n=null),i(e,t,n,r);function i(e,t,n,r,a){return s(e,t,n,function(o){o&&(o.code===`EMFILE`||o.code===`ENFILE`)?m([i,[e,t,n,r],o,a||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}var l=e.copyFile;l&&(e.copyFile=u);function u(e,t,n,r){return typeof n==`function`&&(r=n,n=0),i(e,t,n,r);function i(e,t,n,r,a){return l(e,t,n,function(o){o&&(o.code===`EMFILE`||o.code===`ENFILE`)?m([i,[e,t,n,r],o,a||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}var d=e.readdir;e.readdir=h;var f=/^v[0-5]\./;function h(e,t,n){typeof t==`function`&&(n=t,t=null);var r=f.test(process.version)?function(e,t,n,r){return d(e,i(e,t,n,r))}:function(e,t,n,r){return d(e,t,i(e,t,n,r))};return r(e,t,n);function i(e,t,n,i){return function(a,o){a&&(a.code===`EMFILE`||a.code===`ENFILE`)?m([r,[e,t,n],a,i||Date.now(),Date.now()]):(o&&o.sort&&o.sort(),typeof n==`function`&&n.call(this,a,o))}}}if(process.version.substr(0,4)===`v0.8`){var g=a(e);x=g.ReadStream,C=g.WriteStream}var _=e.ReadStream;_&&(x.prototype=Object.create(_.prototype),x.prototype.open=S);var v=e.WriteStream;v&&(C.prototype=Object.create(v.prototype),C.prototype.open=w),Object.defineProperty(e,"ReadStream",{get:function(){return x},set:function(e){x=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return C},set:function(e){C=e},enumerable:!0,configurable:!0});var y=x;Object.defineProperty(e,"FileReadStream",{get:function(){return y},set:function(e){y=e},enumerable:!0,configurable:!0});var b=C;Object.defineProperty(e,"FileWriteStream",{get:function(){return b},set:function(e){b=e},enumerable:!0,configurable:!0});function x(e,t){return this instanceof x?(_.apply(this,arguments),this):x.apply(Object.create(x.prototype),arguments)}function S(){var e=this;O(e.path,e.flags,e.mode,function(t,n){t?(e.autoClose&&e.destroy(),e.emit(`error`,t)):(e.fd=n,e.emit(`open`,n),e.read())})}function C(e,t){return this instanceof C?(v.apply(this,arguments),this):C.apply(Object.create(C.prototype),arguments)}function w(){var e=this;O(e.path,e.flags,e.mode,function(t,n){t?(e.destroy(),e.emit(`error`,t)):(e.fd=n,e.emit(`open`,n))})}function T(t,n){return new e.ReadStream(t,n)}function E(t,n){return new e.WriteStream(t,n)}var D=e.open;e.open=O;function O(e,t,n,r){return typeof n==`function`&&(r=n,n=null),i(e,t,n,r);function i(e,t,n,r,a){return D(e,t,n,function(o,s){o&&(o.code===`EMFILE`||o.code===`ENFILE`)?m([i,[e,t,n,r],o,a||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}return e}function m(e){f(`ENQUEUE`,e[0].name,e[1]),r[c].push(e),_()}var h;function g(){for(var e=Date.now(),t=0;t<r[c].length;++t)r[c][t].length>2&&(r[c][t][3]=e,r[c][t][4]=e);_()}function _(){if(clearTimeout(h),h=void 0,r[c].length!==0){var e=r[c].shift(),t=e[0],n=e[1],i=e[2],a=e[3],o=e[4];if(a===void 0)f(`RETRY`,t.name,n),t.apply(null,n);else if(Date.now()-a>=6e4){f(`TIMEOUT`,t.name,n);var s=n.pop();typeof s==`function`&&s.call(null,i)}else{var l=Date.now()-o,u=Math.max(o-a,1);l>=Math.min(u*1.2,100)?(f(`RETRY`,t.name,n),t.apply(null,n.concat([a]))):r[c].push(e)}h===void 0&&(h=setTimeout(_,0))}}})),UAe=i(((e,t)=>{function n(e,t){typeof t==`boolean`&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}t.exports=n,n.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},n.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},n.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error(`RetryOperation timeout occurred`)),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0){if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),n=this._timeouts.shift();else return!1}var r=this,i=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n);return this._options.unref&&i.unref(),!0},n.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},n.prototype.try=function(e){console.log(`Using RetryOperation.try() is deprecated`),this.attempt(e)},n.prototype.start=function(e){console.log(`Using RetryOperation.start() is deprecated`),this.attempt(e)},n.prototype.start=n.prototype.try,n.prototype.errors=function(){return this._errors},n.prototype.attempts=function(){return this._attempts},n.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var i=this._errors[r],a=i.message,o=(e[a]||0)+1;e[a]=o,o>=n&&(t=i,n=o)}return t}})),WAe=i((e=>{var t=UAe();e.operation=function(n){return new t(e.timeouts(n),{forever:n&&n.forever,unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw Error(`minTimeout is greater than maxTimeout`);for(var r=[],i=0;i<t.retries;i++)r.push(this.createTimeout(i,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(i,t)),r.sort(function(e,t){return e-t}),r},e.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*t.minTimeout*t.factor**+e);return r=Math.min(r,t.maxTimeout),r},e.wrap=function(t,n,r){if(n instanceof Array&&(r=n,n=null),!r)for(var i in r=[],t)typeof t[i]==`function`&&r.push(i);for(var a=0;a<r.length;a++){var o=r[a],s=t[o];t[o]=function(r){var i=e.operation(n),a=Array.prototype.slice.call(arguments,1),o=a.pop();a.push(function(e){i.retry(e)||(e&&(arguments[0]=i.mainError()),o.apply(this,arguments))}),i.attempt(function(){r.apply(t,a)})}.bind(t,s),t[o].options=n}}})),GAe=i(((e,t)=>{t.exports=WAe()})),KAe=i(((e,t)=>{t.exports=[`SIGABRT`,`SIGALRM`,`SIGHUP`,`SIGINT`,`SIGTERM`],process.platform!==`win32`&&t.exports.push(`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&t.exports.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`,`SIGUNUSED`)})),qAe=i(((e,n)=>{var r=global.process;let i=function(e){return e&&typeof e==`object`&&typeof e.removeListener==`function`&&typeof e.emit==`function`&&typeof e.reallyExit==`function`&&typeof e.listeners==`function`&&typeof e.kill==`function`&&typeof e.pid==`number`&&typeof e.on==`function`};if(!i(r))n.exports=function(){return function(){}};else{var a=t(`assert`),o=KAe(),s=/^win/i.test(r.platform),c=t(`events`);typeof c!=`function`&&(c=c.EventEmitter);var l;r.__signal_exit_emitter__?l=r.__signal_exit_emitter__:(l=r.__signal_exit_emitter__=new c,l.count=0,l.emitted={}),l.infinite||(l.setMaxListeners(1/0),l.infinite=!0),n.exports=function(e,t){if(!i(global.process))return function(){};a.equal(typeof e,`function`,`a callback must be provided for exit handler`),p===!1&&m();var n=`exit`;return t&&t.alwaysLast&&(n=`afterexit`),l.on(n,e),function(){l.removeListener(n,e),l.listeners(`exit`).length===0&&l.listeners(`afterexit`).length===0&&u()}};var u=function(){!p||!i(global.process)||(p=!1,o.forEach(function(e){try{r.removeListener(e,f[e])}catch{}}),r.emit=_,r.reallyExit=h,--l.count)};n.exports.unload=u;var d=function(e,t,n){l.emitted[e]||(l.emitted[e]=!0,l.emit(e,t,n))},f={};o.forEach(function(e){f[e]=function(){i(global.process)&&r.listeners(e).length===l.count&&(u(),d(`exit`,null,e),d(`afterexit`,null,e),s&&e===`SIGHUP`&&(e=`SIGINT`),r.kill(r.pid,e))}}),n.exports.signals=function(){return o};var p=!1,m=function(){p||!i(global.process)||(p=!0,l.count+=1,o=o.filter(function(e){try{return r.on(e,f[e]),!0}catch{return!1}}),r.emit=v,r.reallyExit=g)};n.exports.load=m;var h=r.reallyExit,g=function(e){i(global.process)&&(r.exitCode=e||0,d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),h.call(r,r.exitCode))},_=r.emit,v=function(e,t){if(e===`exit`&&i(global.process)){t!==void 0&&(r.exitCode=t);var n=_.apply(this,arguments);return d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),n}return _.apply(this,arguments)}}})),JAe=i(((e,t)=>{let n=Symbol();function r(e,t,r){let i=t[n];if(i)return t.stat(e,(e,t)=>{if(e)return r(e);r(null,t.mtime,i)});let a=new Date(Math.ceil(Date.now()/1e3)*1e3+5);t.utimes(e,a,a,i=>{if(i)return r(i);t.stat(e,(e,i)=>{if(e)return r(e);let a=i.mtime.getTime()%1e3==0?`s`:`ms`;Object.defineProperty(t,n,{value:a}),r(null,i.mtime,a)})})}function i(e){let t=Date.now();return e===`s`&&(t=Math.ceil(t/1e3)*1e3),new Date(t)}t.exports.probe=r,t.exports.getMtime=i})),YAe=i(((e,n)=>{let r=t(`path`),i=q7(),a=GAe(),o=qAe(),s=JAe(),c={};function l(e,t){return t.lockfilePath||`${e}.lock`}function u(e,t,n){if(!t.realpath)return n(null,r.resolve(e));t.fs.realpath(e,n)}function d(e,t,n){let r=l(e,t);t.fs.mkdir(r,i=>{if(!i)return s.probe(r,t.fs,(e,i,a)=>{if(e)return t.fs.rmdir(r,()=>{}),n(e);n(null,i,a)});if(i.code!==`EEXIST`)return n(i);if(t.stale<=0)return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));t.fs.stat(r,(r,i)=>{if(r)return r.code===`ENOENT`?d(e,{...t,stale:0},n):n(r);if(!f(i,t))return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));p(e,t,r=>{if(r)return n(r);d(e,{...t,stale:0},n)})})})}function f(e,t){return e.mtime.getTime()<Date.now()-t.stale}function p(e,t,n){t.fs.rmdir(l(e,t),e=>{if(e&&e.code!==`ENOENT`)return n(e);n()})}function m(e,t){let n=c[e];n.updateTimeout||(n.updateDelay=n.updateDelay||t.update,n.updateTimeout=setTimeout(()=>{n.updateTimeout=null,t.fs.stat(n.lockfilePath,(r,i)=>{let a=n.lastUpdate+t.stale<Date.now();if(r)return r.code===`ENOENT`||a?h(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,m(e,t));if(n.mtime.getTime()!==i.mtime.getTime())return h(e,n,Object.assign(Error(`Unable to update lock within the stale threshold`),{code:`ECOMPROMISED`}));let o=s.getMtime(n.mtimePrecision);t.fs.utimes(n.lockfilePath,o,o,r=>{let i=n.lastUpdate+t.stale<Date.now();if(!n.released){if(r)return r.code===`ENOENT`||i?h(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,m(e,t));n.mtime=o,n.lastUpdate=Date.now(),n.updateDelay=null,m(e,t)}})})},n.updateDelay),n.updateTimeout.unref&&n.updateTimeout.unref())}function h(e,t,n){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),c[e]===t&&delete c[e],t.options.onCompromised(n)}function g(e,t,n){t={stale:1e4,update:null,realpath:!0,retries:0,fs:i,onCompromised:e=>{throw e},...t},t.retries=t.retries||0,t.retries=typeof t.retries==`number`?{retries:t.retries}:t.retries,t.stale=Math.max(t.stale||0,2e3),t.update=t.update==null?t.stale/2:t.update||0,t.update=Math.max(Math.min(t.update,t.stale/2),1e3),u(e,t,(e,r)=>{if(e)return n(e);let i=a.operation(t.retries);i.attempt(()=>{d(r,t,(e,a,o)=>{if(i.retry(e))return;if(e)return n(i.mainError());let s=c[r]={lockfilePath:l(r,t),mtime:a,mtimePrecision:o,options:t,lastUpdate:Date.now()};m(r,t),n(null,e=>{if(s.released)return e&&e(Object.assign(Error(`Lock is already released`),{code:`ERELEASED`}));_(r,{...t,realpath:!1},e)})})})})}function _(e,t,n){t={fs:i,realpath:!0,...t},u(e,t,(e,r)=>{if(e)return n(e);let i=c[r];if(!i)return n(Object.assign(Error(`Lock is not acquired/owned by you`),{code:`ENOTACQUIRED`}));i.updateTimeout&&clearTimeout(i.updateTimeout),i.released=!0,delete c[r],p(r,t,n)})}function v(e,t,n){t={stale:1e4,realpath:!0,fs:i,...t},t.stale=Math.max(t.stale||0,2e3),u(e,t,(e,r)=>{if(e)return n(e);t.fs.stat(l(r,t),(e,r)=>e?e.code===`ENOENT`?n(null,!1):n(e):n(null,!f(r,t)))})}function y(){return c}o(()=>{for(let e in c){let t=c[e].options;try{t.fs.rmdirSync(l(e,t))}catch{}}}),n.exports.lock=g,n.exports.unlock=_,n.exports.check=v,n.exports.getLocks=y})),XAe=i(((e,t)=>{let n=q7();function r(e){let t=[`mkdir`,`realpath`,`stat`,`rmdir`,`utimes`],n={...e};return t.forEach(t=>{n[t]=(...n)=>{let r=n.pop(),i;try{i=e[`${t}Sync`](...n)}catch(e){return r(e)}r(null,i)}}),n}function i(e){return(...t)=>new Promise((n,r)=>{t.push((e,t)=>{e?r(e):n(t)}),e(...t)})}function a(e){return(...t)=>{let n,r;if(t.push((e,t)=>{n=e,r=t}),e(...t),n)throw n;return r}}function o(e){if(e={...e},e.fs=r(e.fs||n),typeof e.retries==`number`&&e.retries>0||e.retries&&typeof e.retries.retries==`number`&&e.retries.retries>0)throw Object.assign(Error(`Cannot use retries with the sync api`),{code:`ESYNC`});return e}t.exports={toPromise:i,toSync:a,toSyncOptions:o}})),J7=e(i(((e,t)=>{let n=YAe(),{toPromise:r,toSync:i,toSyncOptions:a}=XAe();async function o(e,t){let i=await r(n.lock)(e,t);return r(i)}function s(e,t){let r=i(n.lock)(e,a(t));return i(r)}function c(e,t){return r(n.unlock)(e,t)}function l(e,t){return i(n.unlock)(e,a(t))}function u(e,t){return r(n.check)(e,t)}function d(e,t){return i(n.check)(e,a(t))}t.exports=o,t.exports.lock=o,t.exports.unlock=c,t.exports.lockSync=s,t.exports.unlockSync=l,t.exports.check=u,t.exports.checkSync=d}))(),1);const Y7=5e3;function X7(e,t,n){if(!(e instanceof Error)||!(`code`in e)||e.code!==`ELOCKED`)throw e;let r=t-performance.now();if(r<=0)throw Object.assign(Error(`Could not acquire Pi trust lock at ${n}.lock within ${Y7}ms`,{cause:e}),{code:`ELOCKED`});return Math.min(25,r)}function Z7(e,t){}function Q7(e,t){if(e.length===0)return;if(e.length===1)throw e[0];let[n,r]=e,i=n instanceof Error?n.message:String(n),a=r instanceof Error?r.message:String(r);throw AggregateError(e,`Pi trust update failed: ${i}\nReleasing Pi trust lock ${t}.lock also failed: ${a}`)}async function ZAe(e,t,n){await Il(`${t}.ok.lock`,async()=>{let t=performance.now()+Y7,r;for(;;)try{r=await J7.default.lock(M(e),{realpath:!1,lockfilePath:`${e}.lock`});break}catch(n){await ze(X7(n,t,e))}let i=[];try{n()}catch(e){i.push(e)}finally{try{await r()}catch(e){i.push(e)}}Q7(i,e)},{onWarn:Z7})}function QAe(e,t,n){Rl(`${t}.ok.lock`,()=>{let t=performance.now()+Y7,r=new Int32Array(new SharedArrayBuffer(4)),i;for(;;)try{i=J7.default.lockSync(M(e),{realpath:!1,lockfilePath:`${e}.lock`});break}catch(n){Atomics.wait(r,0,0,X7(n,t,e))}let a=[];try{n()}catch(e){a.push(e)}finally{try{i()}catch(e){a.push(e)}}Q7(a,e)},{onWarn:Z7})}const $Ae=[`settings.json`,`prompts`,`themes`,`SYSTEM.md`,`APPEND_SYSTEM.md`];var $7=class extends Error{name=`PiResourceInspectionError`};function e9(e){let t;try{t=_(e)}catch(e){if(e.code===`ENOENT`)return!1;throw e}let n;try{n=te(e)}catch(e){throw t.isSymbolicLink()&&e.code===`ENOENT`?new $7(r7(`missing-symlink-target`),{cause:e}):e}return d(e,p.R_OK|(n.isDirectory()?p.X_OK:0)),!0}function eje(e){return e===`open-knowledge`||e.startsWith(`open-knowledge-`)}function tje(e,t,n){let r=e;try{let i=E(e),a;r=t;try{a=E(t)}catch(e){if(e.code!==`ENOENT`)throw e;a=be(t)}let o=N(a,`.agents`,`skills`),s=[];for(let e of $Ae)r=N(i,`.pi`,e),e9(r)&&s.push(r);if(r=N(i,`.pi`,`extensions`),e9(r))for(let t of w(r).sort()){let i=N(r,t);be(n)!==N(be(e),`.pi`,`extensions`,t)&&s.push(i)}for(let e of[N(i,`.pi`,`skills`),N(i,`.agents`,`skills`)])if(e!==o&&(r=e,e9(e)))for(let t of w(e).sort())eje(t)||s.push(N(e,t));let c=M(i);for(;c!==i;){r=N(c,`.agents`,`skills`),r!==o&&e9(r)&&s.push(r);let e=M(c);if(e===c)break;c=e}return s.length===0?{kind:`none`}:{kind:`shared`,paths:s.sort()}}catch(e){return{kind:`unreadable`,error:`Could not inspect Pi project resources at ${N7(r)}: ${e instanceof $7?e.message:r7(n7(e))}`}}}function t9(e){let t;try{t=_(e).isSymbolicLink()}catch(e){return e.code===`ENOENT`?{kind:`not-present`}:{kind:`declined`,reason:n7(e)}}let n=G5(e);if(n.readPath===null)return{kind:`declined`,reason:`unresolved-symlink`};try{if(!te(n.readPath).isFile())return{kind:`declined`,reason:`not-a-file`}}catch(e){return{kind:`declined`,reason:t&&e.code===`ENOENT`?`missing-symlink-target`:n7(e)}}return{kind:`ready`,path:n.writePath,symlink:t}}function n9(e,t,n){let r=be(e),i=EX({home:t,env:n??(t===void 0?process.env:{})});return{cwd:r,bridgePath:OX.pi.projectConfigPath(r),trustPath:N(i,`trust.json`)}}function r9(e){try{let t=E(e);return te(t).isDirectory()?(d(t,p.X_OK),{kind:`ready`,project:{path:e,canonical:t}}):{kind:`refused`,error:`Pi project path ${N7(e)} is not a directory; restore the intended project directory, then retry`}}catch(t){return{kind:`refused`,error:`Pi project directory ${N7(e)} could not be resolved or accessed: ${N7(t instanceof Error?t.message:String(t))}; restore the directory or symlink and check its permissions, then retry`}}}function i9(e){let t=r9(e.path);if(t.kind===`refused`)return t.error;if(t.project.canonical!==e.canonical)return`Pi project path ${N7(e.path)} changed while waiting for its trust lock; restore the intended project location, then retry`}function a9(e,t,n){let r=y7(OX.pi,e,n,t);if(r.kind===`absent`)return{state:`absent`,text:null};if(r.kind!==`present`)return{state:`unreadable`,text:null};let i=r.entry,a=Array.isArray(i.args)&&typeof i.args[0]==`string`?i.args[0]:null;return cX(i)?{state:`own-current`,text:a}:P5(i)?{state:`own-stale`,text:a}:{state:`foreign`,text:a}}function o9(e,t){let n;try{n=S(e.path,`utf-8`)}catch(t){let n=t.code;return e.kind===`missing`&&n===`ENOENT`?{state:`untrusted`,entries:{},trailingNewline:!1}:{state:`unreadable`,reason:n7(t)}}if(n.trim()===``)return{state:`untrusted`,entries:{},trailingNewline:!1};let r;try{r=JSON.parse(n)}catch{return{state:`unreadable`,reason:`invalid-json`}}return WY(r)?{state:r[t]===!0?`trusted`:`untrusted`,entries:r,trailingNewline:n.endsWith(`
|
|
1520
|
+
`)}:{state:`unreadable`,reason:`invalid-json`}}function nje(e){switch(e){case`invalid-json`:return`the file is not a valid JSON object; repair its JSON, then retry`;case`path-changed`:return`the path changed while waiting for its lock; retry to check its current state`;case`unavailable-root`:return`the filesystem root is unavailable; reconnect the drive or network share, then retry`;default:return r7(e)}}function s9(e,t){return{kind:`refused`,error:`trust store ${N7(e)}: ${nje(t)}`}}function c9(e){let t=t9(e);try{switch(t.kind){case`declined`:return s9(e,t.reason);case`ready`:return{kind:`ready`,path:E(t.path)};case`not-present`:break;default:throw Error(`unhandled trust file resolution: ${t}`)}let n=M(e),r=[me(e)],i=_(n,{throwIfNoEntry:!1});for(;!i;){let t=M(n);if(t===n)return s9(e,`unavailable-root`);r.unshift(me(n)),n=t,i=_(n,{throwIfNoEntry:!1})}try{return{kind:`missing`,path:N(E(n),...r)}}catch(t){return s9(e,i.isSymbolicLink()&&t.code===`ENOENT`?`missing-symlink-target`:n7(t))}}catch(t){return s9(e,n7(t))}}function l9(e,t){let n=c9(e);return n.kind===`refused`?n:n.path!==t.path||t.kind===`ready`&&n.kind===`missing`?s9(e,`path-changed`):n}function rje(e,t,n){let r=n9(e,t,n),i=r9(r.cwd);if(i.kind===`refused`)return{...r,project:`unavailable`,error:i.error};let a=a9(r.cwd,r.bridgePath,t).state,o=c9(r.trustPath),s=o.kind===`refused`?`unreadable`:o.kind===`missing`?`untrusted`:o9(o,i.project.canonical).state;return{...r,project:`ready`,canonicalCwd:i.project.canonical,bridge:a,trust:s,bridgeLoadable:(a===`own-current`||a===`own-stale`)&&s===`trusted`,otherExtensions:ije(r.bridgePath).displayNames}}function ije(e){let t=M(e),n=me(e);try{return{displayNames:w(t).filter(e=>e!==n&&e.endsWith(`.ts`)).sort().map(e=>N7(JSON.stringify(e)))}}catch{return{displayNames:[]}}}async function aje(e,t={mode:`published`},n,r,i){let a=n9(e,n,r),o=r9(a.cwd);if(o.kind===`refused`)return{...a,ok:!1,bridge:`refused-project-path`,trust:`skipped`,error:o.error};if(i!==void 0&&o.project.canonical!==i)return{...a,ok:!1,bridge:`refused-project-path`,trust:`skipped`,error:`The approved Pi project directory ${N7(i)} no longer matches the current directory ${N7(o.project.canonical)}. Reopen the intended project and approve the Pi integration again; no bridge or trust settings were changed.`};let s=a9(a.cwd,a.bridgePath,n);if(s.state===`foreign`)return{...a,ok:!1,bridge:`refused-foreign`,trust:`skipped`};if(s.state===`unreadable`)return{...a,ok:!1,bridge:`refused-unreadable`,trust:`skipped`};let c;if(s.state===`absent`)c=`written`;else{let e;try{e=F5(t)}catch{e=void 0}c=e!==void 0&&s.text===e?`unchanged`:`refreshed`}if(c!==`unchanged`){let e=g7(OX.pi,a.cwd,t,n,a.bridgePath);if(e.action!==`written`&&e.action!==`overwritten`)return{...a,ok:!1,bridge:`failed`,trust:`skipped`,error:e.error===void 0?`bridge write ${e.action}`:N7(e.error)}}let l=await oje(a.trustPath,o.project,n??k());return{...a,ok:l.action===`already-trusted`||l.action===`added`,bridge:c,trust:l.action,...l.error===void 0?{}:{error:l.error}}}async function oje(e,t,n){let r=t.canonical,i=c9(e);if(i.kind===`refused`)return{action:`refused-unreadable`,error:i.error};try{v(M(i.path),{recursive:!0})}catch(e){return{action:`failed`,error:N7(e instanceof Error?e.message:String(e))}}let a={action:`added`};try{await ZAe(e,i.path,()=>{let o=i9(t);if(o){a.action=`refused-unreadable`,a.error=o;return}let s=l9(e,i);if(s.kind===`refused`){a.action=`refused-unreadable`,a.error=s.error;return}let c=o9(s,r);if(c.state===`trusted`){a.action=`already-trusted`;return}if(c.state===`unreadable`){a.action=`refused-unreadable`,a.error=s9(e,c.reason).error;return}let l=d9(n,()=>{let t=G7(n,r).find(e=>e.record.canonicalTrustPath===s.path);return t&&K7(n,t),RAe(n,r,e,s.path,Object.hasOwn(c.entries,r)?{present:!0,value:c.entries[r]}:{present:!1})}),u={...c.entries,[r]:!0},d=JSON.stringify(u,null,2)+(c.trailingNewline?`
|
|
1521
|
+
`:``),f=a7(s.path);Pl(s.path,d,f===void 0?void 0:{mode:f}),d9(n,()=>zAe(n,l)),a.action=`added`})}catch(e){return{action:`failed`,error:N7(e instanceof Error?e.message:String(e))}}return a}function sje(e){let t=[],n=e;try{for(;;){if(_(n,{throwIfNoEntry:!1})){if(t.length===0)return;let e=E(n);return te(e).isDirectory()?(d(e,p.X_OK),N(e,...t)):void 0}let e=M(n);if(e===n)return;t.unshift(me(n)),n=e}}catch{return}}function u9(e){let t={"not-present":0,removed:1,"kept-unowned":2,"kept-shared":3,"kept-unverified":4,"refused-unreadable":5,failed:6},n=e.reduce((e,n)=>t[n.action]>t[e.action]?n:e,{action:`not-present`}),r=e.flatMap(e=>e.error??[]),i=e.flatMap(e=>e.detail??[]);return r.length>0?{action:n.error===void 0?`failed`:n.action,error:[...r,...i].join(`
|
|
1520
1522
|
`)}:n.detail===void 0?n:{...n,detail:i.join(`
|
|
1521
|
-
`)}}function
|
|
1522
|
-
`)}}let u=
|
|
1523
|
-
`:``),p=a7(r);Pl(r,f,p===void 0?void 0:{mode:p}),i.entries=d,d9(t,()=>K7(t,l)),s.result={action:`removed`}}function
|
|
1523
|
+
`)}}function cje(e,t,n,r={}){let i=n9(e,t,n),a=t??k(),o=r9(i.cwd),s=o.kind===`refused`&&r.recordedOnly?sje(i.cwd):void 0,c=o.kind===`ready`?o.project.canonical:s,l;try{l=d9(a,()=>{let e=G7(a,i.cwd);return c===void 0||c===i.cwd?e:[...G7(a,c),...e]})}catch(e){return{action:`failed`,error:N7(e instanceof Error?e.message:String(e))}}if(l.length===0&&r.recordedOnly)return o.kind===`ready`||s!==void 0?{action:`not-present`}:{action:`kept-unverified`,error:`${o.error}. OpenKnowledge could not verify whether this path refers to a project with recorded Pi trust; cleanup was left pending. Retry once the project path can be resolved to check again.`};if(o.kind===`refused`){if(l.length===0)return{action:`kept-unverified`,error:o.error};let e=l.map(({path:e,record:t})=>`key ${N7(JSON.stringify(t.cwd))}; configured store ${N7(JSON.stringify(t.configuredTrustPath))}; recorded destination ${N7(JSON.stringify(t.canonicalTrustPath))}; ownership record ${N7(JSON.stringify(e))} (${t.state})`);return{action:`kept-unverified`,error:[`${o.error}. OpenKnowledge kept these Pi trust ownership records; current trust decisions were not checked:`,...e,`To review manually, close Pi, verify the intended store against its recorded destination, and inspect only the exact key. A pending record does not prove setup completed or ownership of a current grant. If you choose to undo a current true decision, restore the recorded previous value, or remove that key only when no previous entry was recorded. Preserve other current decisions; parent-folder and global trust settings still apply.`].join(`
|
|
1524
|
+
`)}}let u=tje(o.project.canonical,a,OX.pi.projectConfigPath(o.project.canonical));if(u.kind===`unreadable`)return{action:`kept-unverified`,error:u.error};let d=u.kind===`shared`?u.paths:[],f=[],p=new Map,m=(e,t)=>{let n=p.get(e);if(!n){let t=c9(e);if(t.kind===`refused`){f.push({action:`refused-unreadable`,error:t.error});return}n={trustPath:e,resolved:t,keys:new Map},p.set(e,n)}if(t){if(n.resolved.path!==t.record.canonicalTrustPath){f.push({action:`refused-unreadable`,error:`Pi trust store ${N7(e)} no longer points to its recorded destination ${N7(t.record.canonicalTrustPath)}; restore the intended file location or symlink, then retry`});return}n.keys.set(t.record.cwd,{cwd:t.record.cwd,mode:`recorded`,receipt:t})}};for(let e of l)m(e.record.configuredTrustPath,e);m(i.trustPath);for(let e of p.values()){for(let t of[o.project.canonical,i.cwd])e.keys.has(t)||e.keys.set(t,{cwd:t,mode:`inspect`,receipt:l.find(n=>n.record.cwd===t&&n.record.canonicalTrustPath===e.resolved.path)});f.push(lje(e,a,d,o.project))}return u9(f)}function d9(e,t){try{return t()}catch(t){throw t instanceof R7?t:Error(`Could not access OpenKnowledge's Pi trust ownership records at ${N7(N(e,`.ok`,`pi-trust`))}: ${N7(t instanceof Error?t.message:String(t))}. Check the records and their permissions, then retry.`,{cause:t})}}function lje(e,t,n,r){let{trustPath:i,resolved:a}=e,o=[...e.keys.values()];if(!o.some(e=>e.mode===`recorded`)&&a.kind===`missing`)return{action:`not-present`};if(a.kind===`missing`)try{_(M(a.path))}catch(e){return{action:`failed`,error:`The recorded Pi trust directory ${N7(M(a.path))} is unavailable: ${N7(e instanceof Error?e.message:String(e))}. Restore access to its parent directory or mounted drive, then retry; the ownership record was kept.`}}let s=[],c={result:{action:`not-present`}};try{QAe(i,a.path,()=>{let e=i9(r);if(e){c.result={action:`kept-unverified`,error:e};return}let l=l9(i,a);if(l.kind===`refused`){c.result={action:`refused-unreadable`,error:l.error};return}let u=o9(l,r.canonical);if(u.state===`unreadable`){c.result={action:`refused-unreadable`,error:s9(i,u.reason).error};return}let d=o.map(e=>({cwd:e.cwd,mode:e.mode,expectedConfiguredPath:e.receipt?.record.configuredTrustPath,receipt:d9(t,()=>G7(t,e.cwd).find(e=>e.record.canonicalTrustPath===l.path))}));if(d.some(e=>e.receipt&&e.receipt.record.configuredTrustPath!==e.expectedConfiguredPath)){c.result={action:`failed`,error:`The Pi trust ownership record changed during cleanup; retry to read its current location.`};return}for(let e of d){try{uje(e,t,i,l.path,u,n,r,c)}catch(t){let n=N7(t instanceof Error?t.message:String(t)),r=t instanceof R7?``:`; retry to check its current state.`;s.push({action:`failed`,error:`Pi trust entry ${N7(JSON.stringify(e.cwd))} in ${N7(i)} could not be reconciled: ${n}${r}`})}s.push(c.result),c.result={action:`not-present`}}})}catch(e){s.push({action:`failed`,error:N7(e instanceof Error?e.message:String(e))})}return u9([...s,c.result])}function uje(e,t,n,r,i,a,o,s){let{cwd:c,receipt:l}=e;if(i.entries[c]!==!0){l&&e.mode===`recorded`&&d9(t,()=>K7(t,l)),s.result={action:`not-present`};return}let u=`To remove this grant manually, close Pi and remove only the ${N7(JSON.stringify(c))} entry from ${N7(n)}; parent-folder and global trust settings still apply.`;if(a.length>0&&c===o.canonical){let n=`kept Pi's folder trust because other resources still need it: ${a.slice(0,3).map(e=>N7(JSON.stringify(e))).join(`, `)}${a.length>3?` (+${a.length-3} more)`:``}. ${u} Removing this grant may stop Pi from loading those resources, including any not listed here.`;s.result={action:`kept-shared`,detail:n},l&&e.mode===`recorded`&&d9(t,()=>K7(t,l)),s.result={action:`kept-shared`,detail:`${n} ${l?e.mode===`recorded`?`OpenKnowledge has relinquished this grant and will not revoke it on later cleanup runs.`:`OpenKnowledge kept the existing ownership record; cleanup of its recorded location remains incomplete.`:`OpenKnowledge has no ownership record for this grant and will not revoke it on later cleanup runs.`}`};return}if(e.mode===`inspect`||!l||l.record.state===`pending`){let e=l?l.record.state===`pending`?`its ownership record is pending after an interrupted setup; completion cannot be verified. Re-running setup or cleanup does not reconcile this record while the folder remains trusted.`:`OpenKnowledge must reconcile its recorded location at ${N7(l.record.configuredTrustPath)} before removing it.`:`no OpenKnowledge ownership record exists; this includes every grant made before ownership recording was introduced.`;s.result={action:`kept-unowned`,detail:`${c===o.canonical?`kept Pi's folder trust because ${e}`:`kept a Pi trust entry under a non-canonical project path because ${e} Pi uses the real project directory instead of this key.`} ${u}`};return}let d={...i.entries};l.record.previous.present?d[c]=l.record.previous.value:delete d[c];let f=JSON.stringify(d,null,2)+(i.trailingNewline?`
|
|
1525
|
+
`:``),p=a7(r);Pl(r,f,p===void 0?void 0:{mode:p}),i.entries=d,d9(t,()=>K7(t,l)),s.result={action:`removed`}}function dje(e){return cX(e)||dX(e)||P5(e)}const f9=10485760;function p9(e,t,n,r=!1){let i=cje(e,t,n,{recordedOnly:r});switch(i.action){case`removed`:case`not-present`:return{trust:i.action};case`kept-shared`:case`kept-unowned`:return{trust:i.action,trustDetail:i.detail};case`failed`:case`refused-unreadable`:case`kept-unverified`:{let e=r?`Trust cleanup remains incomplete`:`The bridge file was left untouched`;throw Error(`Pi trust cleanup failed (${i.action}):\n${i.error}\n${e} so cleanup can be retried.`)}default:throw Error(`unhandled Pi trust cleanup result: ${i}`)}}function m9(e,t,n,r){if(e.id!==`pi`)return{kind:`not-present`};let i=p9(t,n,r,!0);return i.trust===`not-present`?{kind:`not-present`}:{kind:`removed`,...i}}function fje(e,t,n,r,i){let a;try{a=r??e.configPath(t,n)}catch{return{kind:`not-present`}}let o=t9(a);if(o.kind===`not-present`)return m9(e,t,n,i);if(o.kind===`declined`)return o;let s=y7(e,t,n,o.path);if(s.kind===`absent`||s.kind===`no-entry`)return m9(e,t,n,i);if(s.kind===`decline`)return{kind:`declined`,reason:s.reason};if(!dje(s.entry))return{kind:`left-foreign`};let c=e.serverName(t);if(e.format===`file`){let e=p9(t,n,i);try{O(a,{force:!0})}catch(t){throw e.trustDetail?Error(`${t instanceof Error?t.message:String(t)}\n${e.trustDetail}`,{cause:t}):t}return{kind:`removed`,...e}}return e.format===`toml`?hje(o.path,c):e.format===`yaml`?mje(o.path,e.topLevelKey,c):pje(o.path,e.topLevelKey,e.serverMapSubKey,c)}function pje(e,t,n,r){let i;try{i=S(e,`utf-8`)}catch(e){return{kind:`declined`,reason:n7(e)}}if(Buffer.byteLength(i,`utf-8`)>f9)return{kind:`declined`,reason:`oversize`};let{text:a,changed:o}=tAe(i,d7(t,n,r));return o?(Pl(e,a,{mode:a7(e)}),{kind:`removed`}):{kind:`not-present`}}function mje(e,t,n){let r;try{r=S(e,`utf-8`)}catch(e){return{kind:`declined`,reason:n7(e)}}if(Buffer.byteLength(r,`utf-8`)>f9)return{kind:`declined`,reason:`oversize`};let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=(0,cs.parseDocument)(a);if(o.errors.length>0)return{kind:`declined`,reason:`unparseable`};let s=[t,n];if(!o.hasIn(s))return{kind:`not-present`};o.deleteIn(s);let c=o.toString(),l=i7(a);a.trim()===``||a.endsWith(`
|
|
1524
1526
|
`)?c.endsWith(`
|
|
1525
1527
|
`)||(c=`${c}\n`):c=c.replace(/\n+$/,``),l&&(c=c.replace(/\r\n/g,`
|
|
1526
1528
|
`).replace(/\n/g,`\r
|
|
1527
|
-
`));let u=`${i?``:``}${c}`;return u!==r&&Pl(e,u,{mode:a7(e)}),{kind:`removed`}}function
|
|
1529
|
+
`));let u=`${i?``:``}${c}`;return u!==r&&Pl(e,u,{mode:a7(e)}),{kind:`removed`}}function hje(e,t){let n=XY();if(n.backend===`fallback`)return{kind:`declined`,reason:`no-native-writer`};let r;try{r=S(e,`utf-8`)}catch(e){return{kind:`declined`,reason:n7(e)}}let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=i7(a),s=a.trim()===``||a.endsWith(`
|
|
1528
1530
|
`),c;try{c=n.removeEntry(a,t)}catch{return{kind:`declined`,reason:`unparseable`}}if(!c.existed)return{kind:`not-present`};let l=c.text;s?l.endsWith(`
|
|
1529
1531
|
`)||(l=`${l}\n`):l=l.replace(/\n+$/,``),o&&(l=l.replace(/\r\n/g,`
|
|
1530
1532
|
`).replace(/\n/g,`\r
|
|
1531
|
-
`));let u=`${i?``:``}${l}`;return u!==r&&Pl(e,u,{mode:a7(e)}),{kind:`removed`}}function hje(e){return{event:`mcp-config-decline`,scope:e.scope,surface:e.surface,editorId:e.editorId,reason:e.reason}}function gje(e){let{priorCommand:t,priorArgs:n}=h9(e.priorEntry);return{event:`mcp-config-migrate`,scope:e.scope,surface:e.surface,editorId:e.editorId,configPath:e.configPath,priorCommand:t,priorArgs:n}}function h9(e){return{priorCommand:typeof e.command==`string`?e.command.slice(0,200):null,priorArgs:Array.isArray(e.args)?e.args.slice(0,10).map(e=>typeof e==`string`?e.slice(0,200):e):null}}function g9(e,t,n={}){let r=eke(e,t),i;try{i=S(r,`utf-8`)}catch(e){return e&&typeof e==`object`&&`code`in e&&e.code===`ENOENT`?{status:`missing`,lockPath:r}:{status:`read-error`,lockPath:r,error:e instanceof Error?e.message:String(e)}}let a;try{a=JSON.parse(i)}catch{return{status:`corrupt`,lockPath:r}}let o=a&&typeof a==`object`?a:{},s=`machineId`in o&&typeof o.machineId==`string`?o.machineId!==(n.machineId??$Oe()):`hostname`in o&&typeof o.hostname==`string`&&o.hostname!==(n.host??ce());if(!a||typeof a!=`object`||!aOe(a.pid))return{status:`corrupt`,lockPath:r,...s?{foreignHost:!0}:{}};let c=a.pid,l=`machineId`in o&&typeof o.machineId==`string`||`hostname`in o&&typeof o.hostname==`string`;return s?{status:`foreign-host`,lockPath:r,lock:a}:(n.isAlive??M8)(c)?l?{status:`alive`,lockPath:r,lock:a}:{status:`unverified-owner`,lockPath:r,pid:c}:{status:`dead-pid`,lockPath:r,lock:a}}async function _je(e,t=void 0){let n=g9(e,`server`);if(n.status!==`alive`&&n.status!==`foreign-host`)return null;let r=nke(n.lock);if(r===null)return null;try{let n=await fetch(`${r}/api/server-info`,{signal:AbortSignal.timeout(1500),redirect:`manual`});if(!n.ok)return t?.warn({lockDir:e,baseUrl:r,outcome:`http-error`,status:n.status},`stop client-probe failed`),null;let i=(await n.json())?.collabClients;return typeof i==`number`&&Number.isFinite(i)?i:(t?.warn({lockDir:e,baseUrl:r,outcome:`no-client-count`,received:typeof i},`stop client-probe failed`),null)}catch(n){return t?.warn({lockDir:e,baseUrl:r,outcome:`unreachable`,err:n},`stop client-probe failed`),null}}function vje(e,t={}){return{targets:bje(e,t.isAlive??M8)?[{name:`server`,pid:e.lock.pid,port:e.lock.port}]:[]}}async function yje(e){let t=e.inspect??(()=>g9(e.lockDir,`server`)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=e.probeClients??_je,o=e.logger??void 0,s=vje(t(),{isAlive:e.isAlive});if(s.targets.length===0)return r(`No running open-knowledge processes.`),o?.info({lockDir:e.lockDir,targets:0},`stop found nothing to signal`),{stopped:[],failed:[],hadTargets:!1};if(e.force!==!0){let t=await a(e.lockDir,o);if(t!==null&&t>0)return i(`Not stopping: ${t} collaboration client${t===1?``:`s`} (editor window${t===1?``:`s`} or agents) still connected to the server at ${e.lockDir}. Close them, or re-run with --force to terminate anyway.`),o?.warn({lockDir:e.lockDir,clients:t,pids:s.targets.map(e=>e.pid)},`stop declined: live collaboration clients`),{stopped:[],failed:[],hadTargets:!0,declined:{clients:t}}}let c=[],l=[];for(let e of s.targets)try{n(e.pid,`SIGTERM`),c.push(e)}catch(t){l.push({target:e,error:t instanceof Error?t.message:String(t)})}return c.length>0&&r(`Stopped: ${c.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),o?.info({lockDir:e.lockDir,signalled:c.map(e=>({name:e.name,pid:e.pid,port:e.port})),failed:l.map(({target:e,error:t})=>({pid:e.pid,error:t})),forced:e.force===!0},`stop signalled processes`),l.length>0&&i(`Failed to stop: ${l.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:c,failed:l,hadTargets:!0}}function bje(e,t){return e.status===`alive`||e.status===`foreign-host`&&t(e.lock.pid)}function _9(e){if(!g(e))return{value:null,path:e,source:null,doc:null};let t;try{t=S(e,`utf-8`)}catch(t){let n=t instanceof Error?t.message:String(t);return console.warn(`[config] Failed to read ${e}: ${n}`),{value:null,path:e,source:null,doc:null,diagnostic:{code:`UNREADABLE`,detail:`${e}: ${n}`}}}let n=(0,cs.parseDocument)(t);if(n.errors.length>0){let r=n.errors.map(e=>e.message).join(`; `);return console.warn(`[config] Failed to parse ${e}: ${r}`),{value:null,path:e,source:t,doc:null,diagnostic:{code:`YAML_PARSE`,detail:`${e}: ${r}`}}}let r=n.toJSON();return WY(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function xje(e,t){return e.map(e=>{let n=e.path.map(e=>typeof e==`symbol`?String(e):e),r={path:n,message:e.message,issueCode:e.code};if(t.doc!==null&&t.source!==null){let e=Ic({file:t.path,source:t.source,doc:t.doc,path:n});if(e!==void 0)return{...r,source:e}}return r})}function Sje(e){let t=e??process.cwd(),n=[],r=[],i=[],a=[],o=Bl(`user`,t),s=Tl({absPath:o});r.push(...s.diagnostics),!s.valid&&s.sidelinedTo!==void 0&&i.push({from:o,to:s.sidelinedTo}),s.valid&&s.source!==void 0&&n.push(o);let c=(e,t=!1)=>{let i=_9(e);if(i.diagnostic!==void 0&&r.push(i.diagnostic),i.value===null)return{};let o=il({value:i.value,file:i.path,source:i.source,doc:i.doc});r.push(...o),n.push(e);let s=o.length>0?ol(i.value):i.value;return t&&a.push(...KR({value:s,file:i.path,source:i.source,doc:i.doc})),s},l=be(t,`.ok`,`config.yml`),u=c(l,!0),d=c(Bl(`project-local`,t)),f=qR(s.value,u,d),p=hke.safeParse(f);if(!p.success){let e=_9(l),t={code:`SCHEMA_INVALID`,issues:xje(p.error.issues,e)};throw Error($c(t))}return{config:p.data,sources:n,diagnostics:r,sidelined:i,ignoredCommittedKeys:a}}function v9(e){return e.replace(/:\d+$/,``)}function y9(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:v9(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:v9(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:v9(e[1]),owner:e[2],name:e[3]}}{let e=/^(?:[\w.\-~%]+@)?([\w.-]+):([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e?.[1].includes(`.`)||e&&t.startsWith(`git@`))return{protocol:`ssh`,hostname:e[1],owner:e[2],name:e[3]}}{let e=/^git:([\w.-]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:e[1],owner:e[2],name:e[3]}}if(!t.includes(`://`)&&!t.includes(`@`)&&!t.startsWith(`/`)){let e=/^([\w.-]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e)return{protocol:`https`,hostname:`github.com`,owner:e[1],name:e[2]}}return null}function b9(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`https:`)return null;let n=fs(t.hostname);if(n===null)return null;let r=t.pathname.split(`/`).filter(e=>e.length>0);if(r.length<5||r[2]!==`blob`)return null;let i,a,o,s;try{i=decodeURIComponent(r[0]),a=decodeURIComponent(r[1]),o=decodeURIComponent(r[3]),s=r.slice(4).map(e=>decodeURIComponent(e))}catch{return null}return!i||!a||!o||s.length===0||s.some(e=>e.length===0)?null:{host:n,owner:i,repo:a,branch:o,path:s.join(`/`)}}function x9(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`https:`)return null;let n=fs(t.hostname);if(n===null)return null;let r=t.pathname.split(`/`);if(r.length<5||r[0]!==``||r[3]!==`tree`)return null;let i=r.slice(5);i.length===1&&i[0]===``&&i.pop();let a,o,s,c;try{a=decodeURIComponent(r[1]),o=decodeURIComponent(r[2]),s=decodeURIComponent(r[4]),c=i.map(e=>decodeURIComponent(e))}catch{return null}return!a||!o||!s||c.some(e=>e.length===0)?null:{host:n,owner:a,repo:o,branch:s,path:c.join(`/`)}}function Cje(e){let t=b9(e);if(t)return{kind:`doc`,...t};let n=x9(e);return n?{kind:`folder`,...n}:null}async function wje(e,t){let n,r;try{n=await we(be(e)),r=await we(be(M(e)))}catch{return{kind:`not-git`}}if(!S9(n,r))return{kind:`symlink-escape`};let i=N(n,`.git`),a;try{a=te(i)}catch{return{kind:`not-git`}}if(a.isDirectory()){let e;try{e=await we(i)}catch{return{kind:`not-git`}}if(!S9(e,n))return{kind:`symlink-escape`}}else if(!a.isFile())return{kind:`not-git`};let o=Nye(n);if(o.kind!==`repository`)return{kind:`not-git`};let s=o.repository.readRemoteUrl(`origin`);if(s.kind===`unreadable`)return{kind:`not-git`};if(s.kind===`absent`)return s.reason===`config-missing`?{kind:`not-git`}:{kind:`no-origin`};let c=s.url,l=y9(c);if(l===null)return{kind:`non-github`};let u=fs(l.hostname);if(u===null)return{kind:`non-github`};let d=u===t.host.toLowerCase(),f=l.owner.toLowerCase()===t.owner.toLowerCase(),p=l.name.toLowerCase()===t.repo.toLowerCase();return!d&&f&&p?{kind:`wrong-host`,actualHost:u}:!d||!f||!p?{kind:`wrong-repo`,actualOwner:l.owner,actualRepo:l.name}:{kind:`ok`,gitRemoteUrl:`https://${u}/${l.owner}/${l.name}.git`}}function S9(e,t){if(e===t)return!0;let n=ye(t,e);return n.length>0&&!n.startsWith(`..`)&&!ge(n)}const Tje=`# >>> open-knowledge cli >>>`,Eje=`# <<< open-knowledge cli <<<`,Dje=/^# >>> open-knowledge cli >>>\n[\s\S]*?^# <<< open-knowledge cli <<<\n?/m;function Oje(e){return N(e,`Library`,`Application Support`,`OpenKnowledge`,`path-install.json`)}function C9(e,t,n=[]){let r=g(N(e,f5[t]))?`satisfied`:`absent`;return{...r===`satisfied`?{state:r,strictness:[`reclaim-permissive`]}:{state:r},...n.length===0?{}:{sharedWith:n}}}function kje(e,t){let n=ZY.flatMap(t=>{let n=e[t];return n===null?[]:[{editor:t,root:n}]}),r=uu.filter(e=>e.scope===t).map(e=>({editor:e.editorId,root:od}));return[...n,...r]}function w9(e,t,n,r){let i=nEe(e,kje(t,r)),a=i.find(e=>e.host===n);if(a===void 0||a.state===`absent`)return[];let o=a.real;return i.filter(e=>e.host!==n&&e.state!==`absent`&&e.real===o).map(e=>e.host)}function Aje(e,t){let n=(t??k()).replace(/[\\/]+$/,``);if(!n.includes(`\\`))return e.startsWith(`${n}/`)?`~/${e.slice(n.length+1)}`:e;let r=e=>e.replace(/\\/g,`/`),i=r(n),a=r(e);return a.startsWith(`${i}/`)?`~/${a.slice(i.length+1)}`:e}function jje(e,t){let n=OX[e];return h7(n,``,t)&&!m7(n,``,t)}function T9(e,t,n,r,i){let a=OX[e],o;if(i===void 0)try{o=a.configPath(n,r)}catch{return{state:`structural-na`}}else o=i;let s=i===void 0?Aje(o,r):void 0,c=y7(a,n,r,i);switch(c.kind){case`absent`:case`no-entry`:return i===void 0&&jje(e,r)?{state:`structural-na`}:{state:`absent`,path:s};case`decline`:return{state:`unprobed`};case`present`:{let{entry:r}=c,i=[];cX(r)&&i.push(`reclaim-permissive`),dX(r)&&i.push(`pre-approval-exact`),b7(e)(r)&&i.push(`injection-functional`);let o=Ave(a,n);return i.length>0&&(o!==null&&jve(r,o)||t.includes(`pre-approval-exact`)&&i.includes(`reclaim-permissive`)&&!i.includes(`pre-approval-exact`))?{state:`drifted`,strictness:i,path:s}:i.length>0?{state:`satisfied`,strictness:i,path:s}:Tve(a)?{state:`foreign-replaceable`,path:s}:{state:`foreign`,path:s}}}}function Mje(e){let{cwd:t,home:n}=e;return e=>{if(e.pathId===null)return null;let r=Au(e.pathId);if(r===null)return null;if(r.kind===`central-skill-store`)return n===void 0?null:C9(N(n,od),`discovery`,w9(n,lu,e.agent,`global`));let i=r.editor;switch(r.kind){case`editor-user-skill-root`:{let e=lu[i];return e===null||n===void 0?null:v5(n).some(e=>e.editorId===i)?C9(N(n,e),`discovery`,w9(n,lu,i,`global`)):{state:`structural-na`}}case`editor-project-skill-root`:{let e=cu[i];return e===null?null:C9(N(t,e),`project`,w9(t,cu,i,`project`))}case`editor-user-config`:return T9(i,e.strictness,t,n);case`editor-project-config`:{let r=OX[i].projectConfigPath?.(t);return r===void 0?null:T9(i,e.strictness,t,n,r)}}}}[...p5.map(e=>f5[e])];function Nje(e){if(!ge(e))throw Error(`skill cleanup requires an absolute home directory; got ${JSON.stringify(e)}`);let t=be(e);if(t===xe||M(t)===t)throw Error(`skill cleanup refuses to operate on the filesystem root (${t})`);return t}function E9(e){let t=Nje(e),n=[];for(let e of p5){let r=f5[e];n.push({path:N(t,`.agents`,`skills`,r),bundleId:e,scope:`central`});for(let i of pu)n.push({path:N(t,i.skillsRoot,r),bundleId:e,scope:`host`,hostDir:i.hostDir})}return n}function Pje(e,t){let n=[];for(let r of E9(e))if(r.bundleId===t)try{O(r.path,{recursive:!0,force:!0})}catch(e){n.push(e instanceof Error?e:Error(String(e)))}if(n.length>0)throw AggregateError(n,`Failed to remove ${n.length} path(s) for ${t}`)}const Fje=[{id:`mcp-config`,write(e,t,n){let r=e.projectConfigPath?.(t);if(!r)return{integration:`mcp-config`,editorId:e.id,action:`skipped-unsupported`};try{let i=g7(e,t,n,void 0,r);return i.action===`written`||i.action===`overwritten`?{integration:`mcp-config`,editorId:e.id,action:i.action,path:i.configPath}:i.action===`failed`?{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:i.error??`unknown failure`}:i.action===`declined`?{integration:`mcp-config`,editorId:e.id,action:`declined`,path:i.configPath,...i.declineReason===void 0?{}:{reason:i.declineReason}}:{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:`unexpected project-scope action: ${i.action}`}}catch(t){return{integration:`mcp-config`,editorId:e.id,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}},{id:`project-skill`,write(e,t,n){try{let r=U5(e,t,{home:n.home});return{integration:`project-skill`,editorId:e.id,action:r.action,...r.path?{path:r.path}:{},...r.error?{error:r.error}:{}}}catch(t){return{integration:`project-skill`,editorId:e.id,action:`failed`,error:t instanceof Error?t.message:String(t)}}}}];function Ije(e,t,n={},r=Fje){let i=[];for(let a of t){let t=OX[a];for(let a of r)i.push(a.write(t,e,n))}let a=zke(e,t);return a&&i.push({integration:`project-skill`,editorId:a.editorId,action:a.action,...a.path?{path:a.path}:{},...a.error?{error:a.error}:{}}),i}function Lje(e,t,n={}){return{integrations:Ije(e,t,n)}}function D9(e,t){let n=lu[e];return n===null?null:N(t,...n.split(`/`),f5.discovery,`SKILL.md`)}function Rje(e,t){let n=D9(e,t);if(n===null)return{editorId:e,label:e,action:`skipped-unsupported`,path:``};if(!v5(t).some(t=>t.editorId===e))return{editorId:e,label:e,action:`skipped-unsupported`,path:n};try{let r=g5(`discovery`,{checkDesktop:!0});return z5(M(n),t),{editorId:e,label:e,action:B5(r,n),path:n}}catch(t){return{editorId:e,label:e,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function zje(e){return g(N(e,...`.agents/skills`.split(`/`),f5.discovery))?!0:su.some(t=>{let n=D9(t,e);return n!==null&&g(M(n))})}function Bje(e,t){let n=D9(e,t);if(n===null)return{editorId:e,label:e,action:`skipped-unsupported`,path:``};let r=M(n);try{return g(n)?(z5(r,t),O(r,{recursive:!0,force:!0}),{editorId:e,label:e,action:`removed`,path:n}):{editorId:e,label:e,action:`not-present`,path:n}}catch(t){return{editorId:e,label:e,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function Vje(e){return Tl({absPath:Bl(`user`,e,e),sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function O9({home:e=k(),env:t=process.env}={}){let n=Vje(e),{override:r,preferenceList:i}=Gl(t),{locale:a,source:o}=eV({override:r,storedPreference:n,supportedLocales:js,preferenceList:i,autoDetectableLocales:sie});return{preference:n,locale:a,source:o,systemLanguages:i}}function k9(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function Hje(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function A9(e,t){if(typeof e==`string`)return k9(e,t.contentDir);if(Array.isArray(e))return e.map(e=>A9(e,t));if(!Hje(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=A9(i,t);return n}function j9(e,t){let n=S(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
|
|
1533
|
+
`));let u=`${i?``:``}${l}`;return u!==r&&Pl(e,u,{mode:a7(e)}),{kind:`removed`}}function gje(e){return{event:`mcp-config-decline`,scope:e.scope,surface:e.surface,editorId:e.editorId,reason:e.reason}}function _je(e){let{priorCommand:t,priorArgs:n}=h9(e.priorEntry);return{event:`mcp-config-migrate`,scope:e.scope,surface:e.surface,editorId:e.editorId,configPath:e.configPath,priorCommand:t,priorArgs:n}}function h9(e){return{priorCommand:typeof e.command==`string`?e.command.slice(0,200):null,priorArgs:Array.isArray(e.args)?e.args.slice(0,10).map(e=>typeof e==`string`?e.slice(0,200):e):null}}function g9(e,t,n={}){let r=tke(e,t),i;try{i=S(r,`utf-8`)}catch(e){return e&&typeof e==`object`&&`code`in e&&e.code===`ENOENT`?{status:`missing`,lockPath:r}:{status:`read-error`,lockPath:r,error:e instanceof Error?e.message:String(e)}}let a;try{a=JSON.parse(i)}catch{return{status:`corrupt`,lockPath:r}}let o=a&&typeof a==`object`?a:{},s=`machineId`in o&&typeof o.machineId==`string`?o.machineId!==(n.machineId??eke()):`hostname`in o&&typeof o.hostname==`string`&&o.hostname!==(n.host??ce());if(!a||typeof a!=`object`||!oOe(a.pid))return{status:`corrupt`,lockPath:r,...s?{foreignHost:!0}:{}};let c=a.pid,l=`machineId`in o&&typeof o.machineId==`string`||`hostname`in o&&typeof o.hostname==`string`;return s?{status:`foreign-host`,lockPath:r,lock:a}:(n.isAlive??M8)(c)?l?{status:`alive`,lockPath:r,lock:a}:{status:`unverified-owner`,lockPath:r,pid:c}:{status:`dead-pid`,lockPath:r,lock:a}}async function vje(e,t=void 0){let n=g9(e,`server`);if(n.status!==`alive`&&n.status!==`foreign-host`)return null;let r=rke(n.lock);if(r===null)return null;try{let n=await fetch(`${r}/api/server-info`,{signal:AbortSignal.timeout(1500),redirect:`manual`});if(!n.ok)return t?.warn({lockDir:e,baseUrl:r,outcome:`http-error`,status:n.status},`stop client-probe failed`),null;let i=(await n.json())?.collabClients;return typeof i==`number`&&Number.isFinite(i)?i:(t?.warn({lockDir:e,baseUrl:r,outcome:`no-client-count`,received:typeof i},`stop client-probe failed`),null)}catch(n){return t?.warn({lockDir:e,baseUrl:r,outcome:`unreachable`,err:n},`stop client-probe failed`),null}}function yje(e,t={}){return{targets:xje(e,t.isAlive??M8)?[{name:`server`,pid:e.lock.pid,port:e.lock.port}]:[]}}async function bje(e){let t=e.inspect??(()=>g9(e.lockDir,`server`)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=e.probeClients??vje,o=e.logger??void 0,s=yje(t(),{isAlive:e.isAlive});if(s.targets.length===0)return r(`No running open-knowledge processes.`),o?.info({lockDir:e.lockDir,targets:0},`stop found nothing to signal`),{stopped:[],failed:[],hadTargets:!1};if(e.force!==!0){let t=await a(e.lockDir,o);if(t!==null&&t>0)return i(`Not stopping: ${t} collaboration client${t===1?``:`s`} (editor window${t===1?``:`s`} or agents) still connected to the server at ${e.lockDir}. Close them, or re-run with --force to terminate anyway.`),o?.warn({lockDir:e.lockDir,clients:t,pids:s.targets.map(e=>e.pid)},`stop declined: live collaboration clients`),{stopped:[],failed:[],hadTargets:!0,declined:{clients:t}}}let c=[],l=[];for(let e of s.targets)try{n(e.pid,`SIGTERM`),c.push(e)}catch(t){l.push({target:e,error:t instanceof Error?t.message:String(t)})}return c.length>0&&r(`Stopped: ${c.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),o?.info({lockDir:e.lockDir,signalled:c.map(e=>({name:e.name,pid:e.pid,port:e.port})),failed:l.map(({target:e,error:t})=>({pid:e.pid,error:t})),forced:e.force===!0},`stop signalled processes`),l.length>0&&i(`Failed to stop: ${l.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:c,failed:l,hadTargets:!0}}function xje(e,t){return e.status===`alive`||e.status===`foreign-host`&&t(e.lock.pid)}function _9(e){if(!g(e))return{value:null,path:e,source:null,doc:null};let t;try{t=S(e,`utf-8`)}catch(t){let n=t instanceof Error?t.message:String(t);return console.warn(`[config] Failed to read ${e}: ${n}`),{value:null,path:e,source:null,doc:null,diagnostic:{code:`UNREADABLE`,detail:`${e}: ${n}`}}}let n=(0,cs.parseDocument)(t);if(n.errors.length>0){let r=n.errors.map(e=>e.message).join(`; `);return console.warn(`[config] Failed to parse ${e}: ${r}`),{value:null,path:e,source:t,doc:null,diagnostic:{code:`YAML_PARSE`,detail:`${e}: ${r}`}}}let r=n.toJSON();return WY(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function Sje(e,t){return e.map(e=>{let n=e.path.map(e=>typeof e==`symbol`?String(e):e),r={path:n,message:e.message,issueCode:e.code};if(t.doc!==null&&t.source!==null){let e=Ic({file:t.path,source:t.source,doc:t.doc,path:n});if(e!==void 0)return{...r,source:e}}return r})}function Cje(e){let t=e??process.cwd(),n=[],r=[],i=[],a=[],o=Bl(`user`,t),s=Tl({absPath:o});r.push(...s.diagnostics),!s.valid&&s.sidelinedTo!==void 0&&i.push({from:o,to:s.sidelinedTo}),s.valid&&s.source!==void 0&&n.push(o);let c=(e,t=!1)=>{let i=_9(e);if(i.diagnostic!==void 0&&r.push(i.diagnostic),i.value===null)return{};let o=il({value:i.value,file:i.path,source:i.source,doc:i.doc});r.push(...o),n.push(e);let s=o.length>0?ol(i.value):i.value;return t&&a.push(...KR({value:s,file:i.path,source:i.source,doc:i.doc})),s},l=be(t,`.ok`,`config.yml`),u=c(l,!0),d=c(Bl(`project-local`,t)),f=qR(s.value,u,d),p=gke.safeParse(f);if(!p.success){let e=_9(l),t={code:`SCHEMA_INVALID`,issues:Sje(p.error.issues,e)};throw Error($c(t))}return{config:p.data,sources:n,diagnostics:r,sidelined:i,ignoredCommittedKeys:a}}function v9(e){return e.replace(/:\d+$/,``)}function y9(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:v9(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:v9(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:v9(e[1]),owner:e[2],name:e[3]}}{let e=/^(?:[\w.\-~%]+@)?([\w.-]+):([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e?.[1].includes(`.`)||e&&t.startsWith(`git@`))return{protocol:`ssh`,hostname:e[1],owner:e[2],name:e[3]}}{let e=/^git:([\w.-]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:e[1],owner:e[2],name:e[3]}}if(!t.includes(`://`)&&!t.includes(`@`)&&!t.startsWith(`/`)){let e=/^([\w.-]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e)return{protocol:`https`,hostname:`github.com`,owner:e[1],name:e[2]}}return null}function b9(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`https:`)return null;let n=fs(t.hostname);if(n===null)return null;let r=t.pathname.split(`/`).filter(e=>e.length>0);if(r.length<5||r[2]!==`blob`)return null;let i,a,o,s;try{i=decodeURIComponent(r[0]),a=decodeURIComponent(r[1]),o=decodeURIComponent(r[3]),s=r.slice(4).map(e=>decodeURIComponent(e))}catch{return null}return!i||!a||!o||s.length===0||s.some(e=>e.length===0)?null:{host:n,owner:i,repo:a,branch:o,path:s.join(`/`)}}function x9(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`https:`)return null;let n=fs(t.hostname);if(n===null)return null;let r=t.pathname.split(`/`);if(r.length<5||r[0]!==``||r[3]!==`tree`)return null;let i=r.slice(5);i.length===1&&i[0]===``&&i.pop();let a,o,s,c;try{a=decodeURIComponent(r[1]),o=decodeURIComponent(r[2]),s=decodeURIComponent(r[4]),c=i.map(e=>decodeURIComponent(e))}catch{return null}return!a||!o||!s||c.some(e=>e.length===0)?null:{host:n,owner:a,repo:o,branch:s,path:c.join(`/`)}}function wje(e){let t=b9(e);if(t)return{kind:`doc`,...t};let n=x9(e);return n?{kind:`folder`,...n}:null}async function Tje(e,t){let n,r;try{n=await we(be(e)),r=await we(be(M(e)))}catch{return{kind:`not-git`}}if(!S9(n,r))return{kind:`symlink-escape`};let i=N(n,`.git`),a;try{a=te(i)}catch{return{kind:`not-git`}}if(a.isDirectory()){let e;try{e=await we(i)}catch{return{kind:`not-git`}}if(!S9(e,n))return{kind:`symlink-escape`}}else if(!a.isFile())return{kind:`not-git`};let o=Pye(n);if(o.kind!==`repository`)return{kind:`not-git`};let s=o.repository.readRemoteUrl(`origin`);if(s.kind===`unreadable`)return{kind:`not-git`};if(s.kind===`absent`)return s.reason===`config-missing`?{kind:`not-git`}:{kind:`no-origin`};let c=s.url,l=y9(c);if(l===null)return{kind:`non-github`};let u=fs(l.hostname);if(u===null)return{kind:`non-github`};let d=u===t.host.toLowerCase(),f=l.owner.toLowerCase()===t.owner.toLowerCase(),p=l.name.toLowerCase()===t.repo.toLowerCase();return!d&&f&&p?{kind:`wrong-host`,actualHost:u}:!d||!f||!p?{kind:`wrong-repo`,actualOwner:l.owner,actualRepo:l.name}:{kind:`ok`,gitRemoteUrl:`https://${u}/${l.owner}/${l.name}.git`}}function S9(e,t){if(e===t)return!0;let n=ye(t,e);return n.length>0&&!n.startsWith(`..`)&&!ge(n)}const Eje=`# >>> open-knowledge cli >>>`,Dje=`# <<< open-knowledge cli <<<`,Oje=/^# >>> open-knowledge cli >>>\n[\s\S]*?^# <<< open-knowledge cli <<<\n?/m;function kje(e){return N(e,`Library`,`Application Support`,`OpenKnowledge`,`path-install.json`)}function C9(e,t,n=[]){let r=g(N(e,f5[t]))?`satisfied`:`absent`;return{...r===`satisfied`?{state:r,strictness:[`reclaim-permissive`]}:{state:r},...n.length===0?{}:{sharedWith:n}}}function Aje(e,t){let n=ZY.flatMap(t=>{let n=e[t];return n===null?[]:[{editor:t,root:n}]}),r=uu.filter(e=>e.scope===t).map(e=>({editor:e.editorId,root:od}));return[...n,...r]}function w9(e,t,n,r){let i=rEe(e,Aje(t,r)),a=i.find(e=>e.host===n);if(a===void 0||a.state===`absent`)return[];let o=a.real;return i.filter(e=>e.host!==n&&e.state!==`absent`&&e.real===o).map(e=>e.host)}function jje(e,t){let n=(t??k()).replace(/[\\/]+$/,``);if(!n.includes(`\\`))return e.startsWith(`${n}/`)?`~/${e.slice(n.length+1)}`:e;let r=e=>e.replace(/\\/g,`/`),i=r(n),a=r(e);return a.startsWith(`${i}/`)?`~/${a.slice(i.length+1)}`:e}function Mje(e,t){let n=OX[e];return h7(n,``,t)&&!m7(n,``,t)}function T9(e,t,n,r,i){let a=OX[e],o;if(i===void 0)try{o=a.configPath(n,r)}catch{return{state:`structural-na`}}else o=i;let s=i===void 0?jje(o,r):void 0,c=y7(a,n,r,i);switch(c.kind){case`absent`:case`no-entry`:return i===void 0&&Mje(e,r)?{state:`structural-na`}:{state:`absent`,path:s};case`decline`:return{state:`unprobed`};case`present`:{let{entry:r}=c,i=[];cX(r)&&i.push(`reclaim-permissive`),dX(r)&&i.push(`pre-approval-exact`),b7(e)(r)&&i.push(`injection-functional`);let o=jve(a,n);return i.length>0&&(o!==null&&Mve(r,o)||t.includes(`pre-approval-exact`)&&i.includes(`reclaim-permissive`)&&!i.includes(`pre-approval-exact`))?{state:`drifted`,strictness:i,path:s}:i.length>0?{state:`satisfied`,strictness:i,path:s}:Eve(a)?{state:`foreign-replaceable`,path:s}:{state:`foreign`,path:s}}}}function Nje(e){let{cwd:t,home:n}=e;return e=>{if(e.pathId===null)return null;let r=Au(e.pathId);if(r===null)return null;if(r.kind===`central-skill-store`)return n===void 0?null:C9(N(n,od),`discovery`,w9(n,lu,e.agent,`global`));let i=r.editor;switch(r.kind){case`editor-user-skill-root`:{let e=lu[i];return e===null||n===void 0?null:v5(n).some(e=>e.editorId===i)?C9(N(n,e),`discovery`,w9(n,lu,i,`global`)):{state:`structural-na`}}case`editor-project-skill-root`:{let e=cu[i];return e===null?null:C9(N(t,e),`project`,w9(t,cu,i,`project`))}case`editor-user-config`:return T9(i,e.strictness,t,n);case`editor-project-config`:{let r=OX[i].projectConfigPath?.(t);return r===void 0?null:T9(i,e.strictness,t,n,r)}}}}[...p5.map(e=>f5[e])];function Pje(e){if(!ge(e))throw Error(`skill cleanup requires an absolute home directory; got ${JSON.stringify(e)}`);let t=be(e);if(t===xe||M(t)===t)throw Error(`skill cleanup refuses to operate on the filesystem root (${t})`);return t}function E9(e){let t=Pje(e),n=[];for(let e of p5){let r=f5[e];n.push({path:N(t,`.agents`,`skills`,r),bundleId:e,scope:`central`});for(let i of pu)n.push({path:N(t,i.skillsRoot,r),bundleId:e,scope:`host`,hostDir:i.hostDir})}return n}function Fje(e,t){let n=[];for(let r of E9(e))if(r.bundleId===t)try{O(r.path,{recursive:!0,force:!0})}catch(e){n.push(e instanceof Error?e:Error(String(e)))}if(n.length>0)throw AggregateError(n,`Failed to remove ${n.length} path(s) for ${t}`)}const Ije=[{id:`mcp-config`,write(e,t,n){let r=e.projectConfigPath?.(t);if(!r)return{integration:`mcp-config`,editorId:e.id,action:`skipped-unsupported`};try{let i=g7(e,t,n,void 0,r);return i.action===`written`||i.action===`overwritten`?{integration:`mcp-config`,editorId:e.id,action:i.action,path:i.configPath}:i.action===`failed`?{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:i.error??`unknown failure`}:i.action===`declined`?{integration:`mcp-config`,editorId:e.id,action:`declined`,path:i.configPath,...i.declineReason===void 0?{}:{reason:i.declineReason}}:{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:`unexpected project-scope action: ${i.action}`}}catch(t){return{integration:`mcp-config`,editorId:e.id,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}},{id:`project-skill`,write(e,t,n){try{let r=U5(e,t,{home:n.home});return{integration:`project-skill`,editorId:e.id,action:r.action,...r.path?{path:r.path}:{},...r.error?{error:r.error}:{}}}catch(t){return{integration:`project-skill`,editorId:e.id,action:`failed`,error:t instanceof Error?t.message:String(t)}}}}];function Lje(e,t,n={},r=Ije){let i=[];for(let a of t){let t=OX[a];for(let a of r)i.push(a.write(t,e,n))}let a=Bke(e,t);return a&&i.push({integration:`project-skill`,editorId:a.editorId,action:a.action,...a.path?{path:a.path}:{},...a.error?{error:a.error}:{}}),i}function Rje(e,t,n={}){return{integrations:Lje(e,t,n)}}function D9(e,t){let n=lu[e];return n===null?null:N(t,...n.split(`/`),f5.discovery,`SKILL.md`)}function zje(e,t){let n=D9(e,t);if(n===null)return{editorId:e,label:e,action:`skipped-unsupported`,path:``};if(!v5(t).some(t=>t.editorId===e))return{editorId:e,label:e,action:`skipped-unsupported`,path:n};try{let r=g5(`discovery`,{checkDesktop:!0});return z5(M(n),t),{editorId:e,label:e,action:B5(r,n),path:n}}catch(t){return{editorId:e,label:e,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function Bje(e){return g(N(e,...`.agents/skills`.split(`/`),f5.discovery))?!0:su.some(t=>{let n=D9(t,e);return n!==null&&g(M(n))})}function Vje(e,t){let n=D9(e,t);if(n===null)return{editorId:e,label:e,action:`skipped-unsupported`,path:``};let r=M(n);try{return g(n)?(z5(r,t),O(r,{recursive:!0,force:!0}),{editorId:e,label:e,action:`removed`,path:n}):{editorId:e,label:e,action:`not-present`,path:n}}catch(t){return{editorId:e,label:e,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function Hje(e){return Tl({absPath:Bl(`user`,e,e),sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function O9({home:e=k(),env:t=process.env}={}){let n=Hje(e),{override:r,preferenceList:i}=Gl(t),{locale:a,source:o}=eV({override:r,storedPreference:n,supportedLocales:js,preferenceList:i,autoDetectableLocales:sie});return{preference:n,locale:a,source:o,systemLanguages:i}}function k9(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function Uje(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function A9(e,t){if(typeof e==`string`)return k9(e,t.contentDir);if(Array.isArray(e))return e.map(e=>A9(e,t));if(!Uje(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=A9(i,t);return n}function j9(e,t){let n=S(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
|
|
1532
1534
|
`),i=n.split(`
|
|
1533
1535
|
`),a=[];for(let e=0;e<i.length;e++){let n=i[e]??``;if(e!==i.length-1||n!==``){if(n.length===0){a.push(``);continue}try{let e=A9(JSON.parse(n),t);a.push(JSON.stringify(e))}catch{a.push(n)}}}let o=r?`${a.join(`
|
|
1534
1536
|
`)}\n`:a.join(`
|
|
1535
1537
|
`);re(e,o)}function M9(e,t){let n=S(e,`utf-8`);if(n.trim().length!==0)try{let r=A9(JSON.parse(n),t),i=n.endsWith(`
|
|
1536
1538
|
`)?`
|
|
1537
|
-
`:``;re(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=k9(n,t.contentDir);r!==n&&re(e,r)}}function N9(e,t){let n=S(e,`utf-8`),r=k9(n,t.contentDir);r!==n&&re(e,r)}function P9(e){try{return w(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>N(e,t.name))}catch{return[]}}const
|
|
1538
|
-
`)}\n`:null}catch{return null}}function
|
|
1539
|
-
`:`not-running (${w})\n`;re(N(_,`state`,`server-status.txt`),oe);let se=e.diagnosticReports===void 0?`not-collected (no collection attempted)`:S7(e.diagnosticReports,y);if(re(N(_,`state`,`diagnostic-reports-status.txt`),`${se}\n`),e.processDir&&g(e.processDir)){let t=N(_,`process`);v(t,{recursive:!0}),m(e.processDir,t,{recursive:!0})}let k=e.redact===!0;k&&
|
|
1539
|
+
`:``;re(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=k9(n,t.contentDir);r!==n&&re(e,r)}}function N9(e,t){let n=S(e,`utf-8`),r=k9(n,t.contentDir);r!==n&&re(e,r)}function P9(e){try{return w(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>N(e,t.name))}catch{return[]}}const Wje=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function F9(e){return/\.log\.\d+$/.test(e)}function Gje(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||F9(e)}const Kje=[`telemetry`,`logs`,`process`,`diagnostic-reports`];function qje(e){let t={contentDir:e.contentDir};for(let n of Kje)for(let r of P9(N(e.stagingDir,n)))Gje(r)?j9(r,t):r.endsWith(`.json`)?M9(r,t):N9(r,t);for(let n of P9(N(e.stagingDir,`state`))){let e=me(n);n.endsWith(`.jsonl`)?j9(n,t):Wje.has(e)?M9(n,t):N9(n,t)}}const I9=[`.ok`,`local`,`telemetry`],L9=[`.ok`,`local`,`logs`],R9=[`.ok`,`local`,`loss-capture`],z9=`spans-current.jsonl`,B9=`spans-prev.jsonl`,V9=`server-current.jsonl`,H9=`server-prev.jsonl`,U9=`loss-current.jsonl`,W9=`loss-prev.jsonl`;function Jje(e){return N(e,...I9,z9)}function Yje(e){return N(e,...I9,B9)}function Xje(e){return N(e,...L9,V9)}function Zje(e){return N(e,...L9,H9)}function Qje(e){return N(e,...R9,U9)}function $je(e){return N(e,...R9,W9)}const G9=1e3;async function eMe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(G9)});return t.ok?await t.text():null}catch{return null}}async function tMe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(G9)});return t.ok?await t.text():null}catch{return null}}async function nMe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(G9)});return t.ok?await t.text():null}catch{return null}}function rMe(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=t.decisions;return Array.isArray(n)?n.length===0?``:`${n.map(e=>JSON.stringify(e)).join(`
|
|
1540
|
+
`)}\n`:null}catch{return null}}function iMe(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=l(`git`,[`-C`,t,`log`,`--oneline`,`-50`],F8({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function aMe(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=l(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],F8({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function K9(){let e=process.env.OK_DESKTOP_VERSION,t=process.env.OK_DESKTOP_PACKAGED,n=process.env.OK_DESKTOP_CHANNEL;return e===void 0||t===void 0||n===void 0?null:{electronVersion:e,packaged:t===`1`||t.toLowerCase()===`true`,channel:n}}function oMe(){return{nodeVersion:process.version,platform:le(),arch:ae()}}function sMe(){return process.env.OTEL_SDK_DISABLED===`false`}function q9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function J9(e){if(!g(e))return{};let t;try{t=(0,cs.parse)(S(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!q9(t))return{};let n=t.telemetry;if(!q9(n))return{};let r=n.localSink;return q9(r)?r:{}}function Y9(e){return typeof e==`boolean`?e:void 0}function cMe(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function X9(e){if(q9(e))return cMe(e.maxBytes)}function lMe(e){let t=J9(Bl(`project`,e)),n=J9(Bl(`project-local`,e));return{enabled:Y9(n.enabled)??Y9(t.enabled)??!0,spansMaxBytes:X9(n.spans)??X9(t.spans)??52428800,logsMaxBytes:X9(n.logs)??X9(t.logs)??26214400}}function uMe(e){return De(`sha256`).update(e).digest(`hex`)}function dMe(e){let t=S(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const fMe=[`"doc.name"`,`"docName"`];function pMe(e){let t=S(e,`utf-8`),n=0;for(let e of fMe){let r=t.indexOf(e);for(;r!==-1;)n++,r=t.indexOf(e,r+e.length)}return n}function Z9(e,t){if(!g(e))return!1;try{return v(M(t),{recursive:!0}),e.endsWith(`.ips`)?re(t,C7(S(e,`utf-8`))):m(e,t),!0}catch{return!1}}function Q9(e){let t=[],n=e=>{let r=w(e,{withFileTypes:!0});for(let i of r){let r=N(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const mMe=new Set([`.jsonl`]);function hMe(e){let t=e.lastIndexOf(`.`);return t!==-1&&mMe.has(e.slice(t))}const gMe=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`,`.ips`]);function _Me(e){if(F9(e))return!0;let t=e.lastIndexOf(`.`);return t!==-1&&gMe.has(e.slice(t))}function vMe(e){let t=[];for(let n of Q9(e)){let r=$9(e,n);if(!_Me(r))continue;let{redacted:i,patterns:a,lineCount:o}=dV(S(n,`utf-8`));a.length!==0&&(re(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function $9(e,t){return ye(e,t).split(xe).join(`/`)}async function yMe(e){let t=be(e.contentDir),n=be(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??eMe,a=r.fetchAgentEffects??tMe,o=r.fetchWatcherRecent??nMe,s=r.readShadowHead??iMe,c=r.readCheckpointRefs??aMe,l=r.now??(()=>new Date),u=r.okVersion??(()=>`0.80.0-beta.5`),d=r.readDesktopEnv??K9,f=r.readLanguage??O9,p=r.readRuntime??oMe,h=r.isOtlpPushEnabled??sMe,_=y(N(A(),`ok-bundle-`));try{v(N(_,`telemetry`),{recursive:!0}),v(N(_,`logs`),{recursive:!0}),v(N(_,`state`),{recursive:!0}),Z9(Jje(n),N(_,`telemetry`,z9)),Z9(Yje(n),N(_,`telemetry`,B9)),Z9(Xje(n),N(_,`logs`,V9)),Z9(Zje(n),N(_,`logs`,H9));for(let t of e.userLogFiles??[])Z9(t,N(_,`logs`,me(t)));for(let t of e.userStateFiles??[])Z9(t,N(_,NR,me(t)));let y=0;for(let t of e.diagnosticReports?.files??[])Z9(t,N(_,`diagnostic-reports`,me(t)))&&(y+=1);let b=N(n,`.ok`,`local`),x=N(b,`server.lock`),C=`not-running`,w=`no server.lock`,T=null;if(g(x)){Z9(x,N(_,`state`,`server.lock`));try{let e=S(x,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?T=t.port:w=`lock present but no port`}catch{w=`lock present but unparseable`}}if(T!==null){let e=await i(T);e===null?w=`agent-presence endpoint at :${T} unreachable`:(re(N(_,`state`,`agent-presence.json`),e),C=`running`,w=``);let t=await a(T);t!==null&&re(N(_,`state`,`agent-effects.json`),t);let n=await o(T);if(n!==null){let e=rMe(n);e!==null&&re(N(_,`state`,`watcher-recent.jsonl`),e)}}let E=s(t);E!==null&&re(N(_,`state`,`shadow-head.txt`),E);let D=c(t);D!==null&&re(N(_,`state`,`checkpoint-refs.txt`),D),Z9(Qje(n),N(_,`state`,U9)),Z9($je(n),N(_,`state`,W9)),Z9(N(b,`last-spawn-error.log`),N(_,`state`,`last-spawn-error.log`)),Z9(N(b,cl),N(_,`state`,cl)),Z9(N(b,ll),N(_,`state`,ll)),Z9(N(b,sl),N(_,`state`,sl));let ee=p(),ne=d(),ie=f(),ae={ok:{version:u(),nodeVersion:ee.nodeVersion,platform:ee.platform,arch:ee.arch},host:{desktop:ne,language:ie}};re(N(_,`state`,`runtime.json`),`${JSON.stringify(ae,null,2)}\n`);let oe=C===`running`?`running
|
|
1541
|
+
`:`not-running (${w})\n`;re(N(_,`state`,`server-status.txt`),oe);let se=e.diagnosticReports===void 0?`not-collected (no collection attempted)`:S7(e.diagnosticReports,y);if(re(N(_,`state`,`diagnostic-reports-status.txt`),`${se}\n`),e.processDir&&g(e.processDir)){let t=N(_,`process`);v(t,{recursive:!0}),m(e.processDir,t,{recursive:!0})}let k=e.redact===!0;k&&qje({stagingDir:_,contentDir:t}),e.note&&re(N(_,`note.txt`),e.note);let ce=null;e.scrubSecrets===!0&&(ce=vMe(_));for(let t of e.extraFiles??[]){let e=t.zipName??me(t.sourcePath);if(!Z9(t.sourcePath,N(_,`extra`,e))){r.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);continue}let n=T7(t,`extra/${e}`);n!==null&&(ce??={redactions:[],redactedLineCount:0},ce.redactions.push(n),ce.redactedLineCount+=n.lineCount)}let le=lMe(n),ue=Q9(_),A=[],j=0,de=0;for(let e of ue){let t=$9(_,e),n=te(e).size,r=hMe(t)?dMe(e):0;A.push({path:t,bytes:n,lines:r}),j+=n,(t.startsWith(`telemetry/`)||t.startsWith(`logs/`))&&(de+=pMe(e))}let fe={applied:k};ce!==null&&(fe.secretScrub=ce);let pe={schemaVersion:2,createdAt:l().toISOString(),ok:{version:u(),nodeVersion:ee.nodeVersion,platform:ee.platform,arch:ee.arch},host:{desktop:ne,language:ie},contentDir:{pathSha256:uMe(t),absolutePath:k?`<CONTENT_DIR>`:t},telemetry:{localSink:le,otlpPushEnabled:h()},redaction:fe,serverStatus:C,files:A};re(N(_,`manifest.json`),`${JSON.stringify(pe,null,2)}\n`);let M=ue.some(e=>{try{return S(e,`utf-8`).includes(t)}catch{return!1}}),he={stagedDiagnosticReports:y,totalBytes:j,fileCount:A.length,docNameCount:de,contentDirVisible:M,redacted:k},ge=!1;return{stagingDir:_,manifest:pe,summary:he,cleanup:()=>{ge||(ge=!0,O(_,{recursive:!0,force:!0}))}}}catch(e){throw O(_,{recursive:!0,force:!0}),e}}async function bMe(e){let{collected:t,outputPath:n}=e,r=M(n);if(!g(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new gTe.ZipFile,a=Q9(t.stagingDir);for(let e of a){let n=$9(t.stagingDir,e);i.addFile(e,n)}i.end();let o=h(n);return i.outputStream.pipe(o),await new Promise((e,t)=>{o.on(`close`,e),o.on(`error`,t),i.outputStream.on(`error`,t)}),n}function xMe(e,t){let n=N(e,`.ok`,`config.yml`);if(g(n))try{let t=(0,cs.parse)(S(n,`utf-8`)),r=WY(t)?t.content:void 0,i=WY(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return be(e,i)}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml; falling back to project root as content dir`)}return be(e)}async function SMe(e,t,n,r,i){let a=E7(t,e.logger),o=await yMe({contentDir:xMe(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...MAe(a,e.userLogsDir??N(k(),`.ok`,`logs`)),...O7(e.cachesDir??N(k(),`Library`,`Caches`))],userStateFiles:k7(e.bugReportsDir??w7()),diagnosticReports:i,deps:{readDesktopEnv:n,readLanguage:r,logger:e.logger}});try{v(M(e.outputPath),{recursive:!0}),await bMe({collected:o,outputPath:e.outputPath});let t=o.manifest.redaction.secretScrub;return{zipPath:e.outputPath,summary:{level:`full`,systemWide:!1,projectSlug:a,files:o.manifest.files.map(e=>e.path),redactions:t?.redactions??[],redactedLineCount:t?.redactedLineCount??0,generatedAt:o.manifest.createdAt}}}finally{o.cleanup()}}async function CMe(e){let{projectDir:t}=e,n=e.readDesktopEnv??K9,r=e.readLanguage??O9,i=()=>DAe(e.diagnosticReportsDir??N(k(),`Library`,`Logs`,`DiagnosticReports`),new Date);if(e.level===`full`&&t!==void 0)return SMe(e,t,n,r,i());let{zipPath:a,summary:o}=await LAe({projectDir:t,redact:e.redact,revealDocNames:e.level===`full`,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:O7(e.cachesDir??N(k(),`Library`,`Caches`)),bugReportLedgerFiles:k7(e.bugReportsDir??w7()),diagnosticReports:e.level===`full`?i():void 0,logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n(),language:r()});return{zipPath:a,summary:{level:e.level,systemWide:t===void 0,projectSlug:o.projectSlug,files:o.files,redactions:o.redactions,redactedLineCount:o.redactedLineCount,generatedAt:o.generatedAt}}}export{ZY as ALL_EDITOR_IDS,QY as EDITOR_LABELS,OX as EDITOR_TARGETS,Cve as HOSTS_WITH_USER_SKILL_DIR,pAe as LAUNCH_CONFIG_NAME,Eje as PATH_SHIM_BEGIN,Oje as PATH_SHIM_BLOCK_RE,Dje as PATH_SHIM_END,I5 as ProjectPathSafetyError,Gke as addOkPathsToGitExclude,L5 as assertProjectPathSafe,uX as buildManagedServerEntry,gje as buildMcpConfigDeclineEvent,_je as buildMcpConfigMigrateEvent,y7 as classifyExistingMcpEntry,CMe as collectReportBundle,Nje as createCliProbeResolver,Zl as createTokenStore,kAe as defaultBugReportZipPath,We as detectGh,qe as detectGhAccounts,_Ae as detectInstalledEditors,yX as droppedManagedKeys,Wve as editorConfigPathDisplay,Uve as editorEntryLocator,aje as ensurePiBridge,Z5 as formatTrackedRemediation,Jke as getExcludedOkPaths,Y5 as getInstalledSkillProjectionPaths,Sve as getNativeTomlMcpEditor,J5 as getOkArtifactPaths,cX as isEntryUpToDate,dX as isOwnManagedEntry,Cje as loadConfig,$l as makeLazyProbeTokenStore,w7 as okBugReportsDir,b9 as parseGitHubBlobUrl,wje as parseGitHubShareUrl,x9 as parseGitHubTreeUrl,y9 as parseGitUrl,kje as pathInstallMarkerPath,Ake as previewContent,vAe as probeOwnManagedEditorMcpEntry,rje as probePiBridgeState,X5 as probeTrackedOkPaths,_7 as readExistingMcpEntry,qke as readSharingMode,dV as redactContent,Kke as removeOkPathsFromGitExclude,fje as removeOwnMcpEntry,Vke as removeProjectSkill,Fje as removeUserGlobalSkillBundle,Vje as removeUserSkill,Fke as resolveProjectRoot,bje as runStop,h9 as truncatePriorEntry,E9 as userGlobalSkillBundleTargets,Bje as userSkillPresentAnywhere,Tje as validateLocalFolderForShare,g7 as writeEditorMcpConfig,Rje as writeProjectAiIntegrations,U5 as writeProjectSkill,gAe as writeUserMcpConfigs,zje as writeUserSkill};
|
|
1540
1542
|
//# sourceMappingURL=index.mjs.map
|